summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-12-11 11:56:35 +0100
committerFlorian Dold <florian@dold.me>2023-12-11 11:56:35 +0100
commit805078c3dbd6eff4b62b872ad7663156980312a6 (patch)
tree1f6d4809a65af3f2436180b9445dfd66daadc55c /packages/taler-wallet-core/src/db.ts
parentce139cd061f0d592804232d72aaf8904bbaf0caf (diff)
downloadwallet-core-805078c3dbd6eff4b62b872ad7663156980312a6.tar.gz
wallet-core-805078c3dbd6eff4b62b872ad7663156980312a6.tar.bz2
wallet-core-805078c3dbd6eff4b62b872ad7663156980312a6.zip
wallet-core: fix db import
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts37
1 files changed, 19 insertions, 18 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 4cc11d9eb..6b1fc2f5f 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -26,6 +26,7 @@ import {
IDBRequest,
IDBTransaction,
structuredEncapsulate,
+ structuredRevive,
} from "@gnu-taler/idb-bridge";
import {
AbsoluteTime,
@@ -577,11 +578,11 @@ export interface ExchangeDetailsRecord {
* Information about ToS acceptance from the user.
*/
tosAccepted:
- | {
- etag: string;
- timestamp: DbPreciseTimestamp;
- }
- | undefined;
+ | {
+ etag: string;
+ timestamp: DbPreciseTimestamp;
+ }
+ | undefined;
wireInfo: WireInfo;
@@ -1334,9 +1335,9 @@ export enum ConfigRecordKey {
*/
export type ConfigRecord =
| {
- key: ConfigRecordKey.WalletBackupState;
- value: WalletBackupConfState;
- }
+ key: ConfigRecordKey.WalletBackupState;
+ value: WalletBackupConfState;
+ }
| { key: ConfigRecordKey.CurrencyDefaultsApplied; value: boolean }
| { key: ConfigRecordKey.DevMode; value: boolean };
@@ -1603,15 +1604,15 @@ export enum BackupProviderStateTag {
export type BackupProviderState =
| {
- tag: BackupProviderStateTag.Provisional;
- }
+ tag: BackupProviderStateTag.Provisional;
+ }
| {
- tag: BackupProviderStateTag.Ready;
- nextBackupTimestamp: DbPreciseTimestamp;
- }
+ tag: BackupProviderStateTag.Ready;
+ nextBackupTimestamp: DbPreciseTimestamp;
+ }
| {
- tag: BackupProviderStateTag.Retrying;
- };
+ tag: BackupProviderStateTag.Retrying;
+ };
export interface BackupProviderTerms {
supportedProtocolVersion: string;
@@ -2840,7 +2841,7 @@ function checkDbDump(x: any): x is DbDump {
}
export async function importDb(db: IDBDatabase, dumpJson: any): Promise<void> {
- const d = dumpJson;
+ const d = structuredRevive(dumpJson);
if (checkDbDump(d)) {
const walletDb = d.databases[TALER_WALLET_MAIN_DB_NAME];
if (!walletDb) {
@@ -3069,7 +3070,7 @@ export async function openStoredBackupsDatabase(
idbFactory,
TALER_WALLET_STORED_BACKUPS_DB_NAME,
1,
- () => { },
+ () => {},
onStoredBackupsDbUpgradeNeeded,
);
@@ -3092,7 +3093,7 @@ export async function openTalerDatabase(
idbFactory,
TALER_WALLET_META_DB_NAME,
1,
- () => { },
+ () => {},
onMetaDbUpgradeNeeded,
);