From 48540f62644b4c2e4e96095b11e202cb62e3e93d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 13 Sep 2022 13:25:41 +0200 Subject: wallet-core: introduce easier syntax for transactions --- packages/taler-wallet-core/src/db-utils.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'packages/taler-wallet-core/src/db-utils.ts') diff --git a/packages/taler-wallet-core/src/db-utils.ts b/packages/taler-wallet-core/src/db-utils.ts index 9f18ed9be..de54719c9 100644 --- a/packages/taler-wallet-core/src/db-utils.ts +++ b/packages/taler-wallet-core/src/db-utils.ts @@ -46,9 +46,13 @@ function upgradeFromStoreMap( ): void { if (oldVersion === 0) { for (const n in storeMap) { - const swi: StoreWithIndexes, any> = storeMap[n]; + const swi: StoreWithIndexes< + any, + StoreDescriptor, + any + > = storeMap[n]; const storeDesc: StoreDescriptor = swi.store; - const s = db.createObjectStore(storeDesc.name, { + const s = db.createObjectStore(swi.storeName, { autoIncrement: storeDesc.autoIncrement, keyPath: storeDesc.keyPath, }); @@ -117,9 +121,7 @@ export async function openTalerDatabase( const metaDb = new DbAccess(metaDbHandle, walletMetadataStore); let currentMainVersion: string | undefined; await metaDb - .mktx((x) => ({ - metaConfig: x.metaConfig, - })) + .mktx((stores) => [stores.metaConfig]) .runReadWrite(async (tx) => { const dbVersionRecord = await tx.metaConfig.get(CURRENT_DB_CONFIG_KEY); if (!dbVersionRecord) { @@ -141,9 +143,7 @@ export async function openTalerDatabase( // We consider this a pre-release // development version, no migration is done. await metaDb - .mktx((x) => ({ - metaConfig: x.metaConfig, - })) + .mktx((stores) => [stores.metaConfig]) .runReadWrite(async (tx) => { await tx.metaConfig.put({ key: CURRENT_DB_CONFIG_KEY, -- cgit v1.2.3