diff options
author | Florian Dold <florian@dold.me> | 2022-09-16 17:21:54 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-16 17:21:54 +0200 |
commit | 16e7814445d57c2494ddaf3aaf11d60abb2b036b (patch) | |
tree | 778f4e473b9f4b8665ea4e9c2ccf59b9836e993f /packages/taler-wallet-core/src/util/retries.ts | |
parent | d6c545a0ba68d5fce107779d4b0a2244a137b1aa (diff) | |
download | wallet-core-16e7814445d57c2494ddaf3aaf11d60abb2b036b.tar.xz |
-move declaration
Diffstat (limited to 'packages/taler-wallet-core/src/util/retries.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/retries.ts | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/util/retries.ts b/packages/taler-wallet-core/src/util/retries.ts index 4763bbc42..70b385c4a 100644 --- a/packages/taler-wallet-core/src/util/retries.ts +++ b/packages/taler-wallet-core/src/util/retries.ts @@ -30,8 +30,6 @@ import { BackupProviderRecord, DepositGroupRecord, ExchangeRecord, - OperationAttemptResult, - OperationAttemptResultType, ProposalRecord, PurchaseRecord, RecoupGroupRecord, @@ -45,6 +43,48 @@ import { InternalWalletState } from "../internal-wallet-state.js"; import { PendingTaskType } from "../pending-types.js"; import { GetReadWriteAccess } from "./query.js"; +export enum OperationAttemptResultType { + Finished = "finished", + Pending = "pending", + Error = "error", + Longpoll = "longpoll", +} + +// FIXME: not part of DB! +export type OperationAttemptResult<TSuccess = unknown, TPending = unknown> = + | OperationAttemptFinishedResult<TSuccess> + | OperationAttemptErrorResult + | OperationAttemptLongpollResult + | OperationAttemptPendingResult<TPending>; + +export namespace OperationAttemptResult { + export function finishedEmpty(): OperationAttemptResult<unknown, unknown> { + return { + type: OperationAttemptResultType.Finished, + result: undefined, + }; + } +} + +export interface OperationAttemptFinishedResult<T> { + type: OperationAttemptResultType.Finished; + result: T; +} + +export interface OperationAttemptPendingResult<T> { + type: OperationAttemptResultType.Pending; + result: T; +} + +export interface OperationAttemptErrorResult { + type: OperationAttemptResultType.Error; + errorDetail: TalerErrorDetail; +} + +export interface OperationAttemptLongpollResult { + type: OperationAttemptResultType.Longpoll; +} + export interface RetryInfo { firstTry: AbsoluteTime; nextRetry: AbsoluteTime; |