From 7b7e3b4565169835ad04062d5c76ba655abd770a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 10 Jun 2021 10:37:49 +0200 Subject: transaction fixes --- packages/taler-wallet-core/src/db.ts | 19 +++++++++++++++++++ packages/taler-wallet-core/src/util/query.ts | 14 ++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'packages/taler-wallet-core/src') diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index b6bab02c5..d02ea192f 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -1,3 +1,22 @@ +/* + This file is part of GNU Taler + (C) 2021 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see + */ + +/** + * Imports. + */ import { openDatabase, describeStore, diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts index ab5a1fc7a..cf3f791d5 100644 --- a/packages/taler-wallet-core/src/util/query.ts +++ b/packages/taler-wallet-core/src/util/query.ts @@ -454,8 +454,11 @@ function makeReadContext( const indexes: { [s: string]: IndexReadOnlyAccessor } = {}; const swi = storePick[storeAlias]; const storeName = swi.store.name; - for (const indexName in storePick[storeAlias].indexMap) { - indexes[indexName] = { + for (const indexAlias in storePick[storeAlias].indexMap) { + const indexDescriptor: IndexDescriptor = + storePick[storeAlias].indexMap[indexAlias]; + const indexName = indexDescriptor.name; + indexes[indexAlias] = { get(key) { const req = tx.objectStore(storeName).index(indexName).get(key); return requestToPromise(req); @@ -493,8 +496,11 @@ function makeWriteContext( const indexes: { [s: string]: IndexReadWriteAccessor } = {}; const swi = storePick[storeAlias]; const storeName = swi.store.name; - for (const indexName in storePick[storeAlias].indexMap) { - indexes[indexName] = { + for (const indexAlias in storePick[storeAlias].indexMap) { + const indexDescriptor: IndexDescriptor = + storePick[storeAlias].indexMap[indexAlias]; + const indexName = indexDescriptor.name; + indexes[indexAlias] = { get(key) { const req = tx.objectStore(storeName).index(indexName).get(key); return requestToPromise(req); -- cgit v1.2.3