diff options
author | Florian Dold <florian@dold.me> | 2023-08-30 18:33:56 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-08-30 18:33:56 +0200 |
commit | 8fed5b4b7370431602c0b25f8142009e61f7b906 (patch) | |
tree | 3f188e815eb56e9d69ef1ef7fe6da663a8d8e2e5 /packages/taler-wallet-core/src/wallet.ts | |
parent | a713d90c3c564408309d92223d383ecc9225924f (diff) | |
download | wallet-core-8fed5b4b7370431602c0b25f8142009e61f7b906.tar.xz |
wallet-core: allow version change event
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 283539a08..626409dd6 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -343,9 +343,8 @@ async function callOperationHandler( return await processRecoupGroup(ws, pending.recoupGroupId); case PendingTaskType.ExchangeCheckRefresh: return await autoRefresh(ws, pending.exchangeBaseUrl); - case PendingTaskType.Deposit: { + case PendingTaskType.Deposit: return await processDepositGroup(ws, pending.depositGroupId); - } case PendingTaskType.Backup: return await processBackupForProvider(ws, pending.backupProviderBaseUrl); case PendingTaskType.PeerPushDebit: @@ -1031,9 +1030,15 @@ async function createStoredBackup( const backup = await exportDb(ws.idb); const backupsDb = await openStoredBackupsDatabase(ws.idb); const name = `backup-${new Date().getTime()}`; - backupsDb.mktxAll().runReadWrite(async (tx) => {}); - - throw Error("not implemented"); + await backupsDb.mktxAll().runReadWrite(async (tx) => { + await tx.backupMeta.add({ + name, + }); + await tx.backupData.add(backup, name); + }); + return { + name, + }; } /** @@ -1634,7 +1639,7 @@ export function getVersion(ws: InternalWalletState): WalletCoreVersion { /** * Handle a request to the wallet-core API. */ -export async function handleCoreApiRequest( +async function handleCoreApiRequest( ws: InternalWalletState, operation: string, id: string, @@ -1849,11 +1854,8 @@ class InternalWalletStateImpl implements InternalWalletState { if (this._db) { return; } - const myVersionChange = (): Promise<void> => { - logger.error("version change requested, should not happen"); - throw Error( - "BUG: wallet DB version change event can't happen with memory IDB", - ); + const myVersionChange = async (): Promise<void> => { + logger.info("version change requested for Taler DB"); }; const myDb = await openTalerDatabase(this.idb, myVersionChange); this._db = myDb; |