aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db-utils.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-13 13:25:41 +0200
committerFlorian Dold <florian@dold.me>2022-09-13 16:10:42 +0200
commit48540f62644b4c2e4e96095b11e202cb62e3e93d (patch)
tree0f1214f9b3e8d63a81b52b794bf44f9eb2a61dfc /packages/taler-wallet-core/src/db-utils.ts
parent13e7a674778754c0ed641dfd428e3d6b2b71ab2d (diff)
downloadwallet-core-48540f62644b4c2e4e96095b11e202cb62e3e93d.tar.xz
wallet-core: introduce easier syntax for transactions
Diffstat (limited to 'packages/taler-wallet-core/src/db-utils.ts')
-rw-r--r--packages/taler-wallet-core/src/db-utils.ts16
1 files changed, 8 insertions, 8 deletions
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<StoreDescriptor<unknown>, any> = storeMap[n];
+ const swi: StoreWithIndexes<
+ any,
+ StoreDescriptor<unknown>,
+ any
+ > = storeMap[n];
const storeDesc: StoreDescriptor<unknown> = 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,