diff options
Diffstat (limited to 'packages/taler-wallet-core/src/query.ts')
-rw-r--r-- | packages/taler-wallet-core/src/query.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/query.ts b/packages/taler-wallet-core/src/query.ts index 0a321b835..eb5752fbe 100644 --- a/packages/taler-wallet-core/src/query.ts +++ b/packages/taler-wallet-core/src/query.ts @@ -819,12 +819,16 @@ export interface DbAccess<StoreMap> { ): Promise<T>; runReadWriteTx<T, StoreNameArray extends Array<StoreNames<StoreMap>>>( - storeNames: StoreNameArray, + opts: { + storeNames: StoreNameArray; + }, txf: (tx: DbReadWriteTransaction<StoreMap, StoreNameArray>) => Promise<T>, ): Promise<T>; runReadOnlyTx<T, StoreNameArray extends Array<StoreNames<StoreMap>>>( - storeNames: StoreNameArray, + opts: { + storeNames: StoreNameArray; + }, txf: (tx: DbReadOnlyTransaction<StoreMap, StoreNameArray>) => Promise<T>, ): Promise<T>; } @@ -945,13 +949,15 @@ export class DbAccessImpl<StoreMap> implements DbAccess<StoreMap> { } async runReadWriteTx<T, StoreNameArray extends Array<StoreNames<StoreMap>>>( - storeNames: StoreNameArray, + opts: { + storeNames: StoreNameArray; + }, txf: (tx: DbReadWriteTransaction<StoreMap, StoreNameArray>) => Promise<T>, ): Promise<T> { const accessibleStores: { [x: string]: StoreWithIndexes<any, any, any> } = {}; const strStoreNames: string[] = []; - for (const sn of storeNames) { + for (const sn of opts.storeNames) { const swi = (this.stores as any)[sn] as StoreWithIndexes<any, any, any>; strStoreNames.push(swi.storeName); accessibleStores[swi.storeName] = swi; @@ -969,13 +975,15 @@ export class DbAccessImpl<StoreMap> implements DbAccess<StoreMap> { } runReadOnlyTx<T, StoreNameArray extends Array<StoreNames<StoreMap>>>( - storeNames: StoreNameArray, + opts: { + storeNames: StoreNameArray; + }, txf: (tx: DbReadOnlyTransaction<StoreMap, StoreNameArray>) => Promise<T>, ): Promise<T> { const accessibleStores: { [x: string]: StoreWithIndexes<any, any, any> } = {}; const strStoreNames: string[] = []; - for (const sn of storeNames) { + for (const sn of opts.storeNames) { const swi = (this.stores as any)[sn] as StoreWithIndexes<any, any, any>; strStoreNames.push(swi.storeName); accessibleStores[swi.storeName] = swi; |