From 6b9b4ba7cc1576e7cc91e2b30e9d5e75edbe0037 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 13 Mar 2024 21:07:46 +0100 Subject: wallet-core: preparations for materialzed txns --- packages/taler-wallet-core/src/common.ts | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'packages/taler-wallet-core/src/common.ts') diff --git a/packages/taler-wallet-core/src/common.ts b/packages/taler-wallet-core/src/common.ts index 5acdeeba4..eb06b8eb0 100644 --- a/packages/taler-wallet-core/src/common.ts +++ b/packages/taler-wallet-core/src/common.ts @@ -61,11 +61,7 @@ import { timestampPreciseToDb, } from "./db.js"; import { createRefreshGroup } from "./refresh.js"; -import { - InternalWalletState, - WalletExecutionContext, - getDenomInfo, -} from "./wallet.js"; +import { WalletExecutionContext, getDenomInfo } from "./wallet.js"; const logger = new Logger("operations/common.ts"); @@ -696,11 +692,32 @@ export namespace TaskIdentifiers { /** * Result of a transaction transition. */ -export enum TransitionResult { +export enum TransitionResultType { Transition = 1, Stay = 2, + Delete = 3, } +export type TransitionResult = + | { type: TransitionResultType.Stay } + | { type: TransitionResultType.Transition; rec: R } + | { type: TransitionResultType.Delete }; + +export const TransitionResult = { + stay(): TransitionResult { + return { type: TransitionResultType.Stay }; + }, + delete(): TransitionResult { + return { type: TransitionResultType.Delete }; + }, + transition(rec: T): TransitionResult { + return { + type: TransitionResultType.Transition, + rec, + }; + }, +}; + /** * Transaction context. * Uniform interface to all transactions. -- cgit v1.2.3