summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/util
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-16 17:21:54 +0200
committerFlorian Dold <florian@dold.me>2022-09-16 17:21:54 +0200
commit16e7814445d57c2494ddaf3aaf11d60abb2b036b (patch)
tree778f4e473b9f4b8665ea4e9c2ccf59b9836e993f /packages/taler-wallet-core/src/util
parentd6c545a0ba68d5fce107779d4b0a2244a137b1aa (diff)
downloadwallet-core-16e7814445d57c2494ddaf3aaf11d60abb2b036b.tar.gz
wallet-core-16e7814445d57c2494ddaf3aaf11d60abb2b036b.tar.bz2
wallet-core-16e7814445d57c2494ddaf3aaf11d60abb2b036b.zip
-move declaration
Diffstat (limited to 'packages/taler-wallet-core/src/util')
-rw-r--r--packages/taler-wallet-core/src/util/retries.ts44
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;