diff --git a/src/matrix/storage/idb/QueryTarget.ts b/src/matrix/storage/idb/QueryTarget.ts index 97b85569..f27123d5 100644 --- a/src/matrix/storage/idb/QueryTarget.ts +++ b/src/matrix/storage/idb/QueryTarget.ts @@ -37,6 +37,7 @@ interface QueryTargetInterface { openKeyCursor(range?: IDBQuery, direction?: IDBCursorDirection | undefined): IDBRequest; supports(method: string): boolean; keyPath: string | string[]; + count(keyRange?: IDBKeyRange): IDBRequest; get(key: IDBValidKey | IDBKeyRange): IDBRequest; getKey(key: IDBValidKey | IDBKeyRange): IDBRequest; } @@ -78,6 +79,10 @@ export class QueryTarget { return this._target.supports(methodName); } + count(keyRange?: IDBKeyRange): Promise { + return reqAsPromise(this._target.count(keyRange)); + } + get(key: IDBValidKey | IDBKeyRange): Promise { return reqAsPromise(this._target.get(key)); } diff --git a/src/matrix/storage/idb/Store.ts b/src/matrix/storage/idb/Store.ts index f45b3f3e..20e6f79a 100644 --- a/src/matrix/storage/idb/Store.ts +++ b/src/matrix/storage/idb/Store.ts @@ -118,6 +118,14 @@ export class QueryTargetWrapper { } } + count(keyRange?: IDBKeyRange): IDBRequest { + try { + return this._qtStore.count(keyRange); + } catch(err) { + throw new IDBRequestAttemptError("count", this._qt, err, [keyRange]); + } + } + index(name: string): IDBIndex { try { return this._qtStore.index(name);