@metamask-previews/bridge-status-controller 73.1.0-preview-e12e4a38f → 74.0.0-preview-4f9d41d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/bridge-status-controller.cjs +167 -21
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +6 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +6 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +167 -21
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/constants.cjs +1 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/quote-status-manager/constants.cjs +181 -0
- package/dist/quote-status-manager/constants.cjs.map +1 -0
- package/dist/quote-status-manager/constants.d.cts +137 -0
- package/dist/quote-status-manager/constants.d.cts.map +1 -0
- package/dist/quote-status-manager/constants.d.mts +137 -0
- package/dist/quote-status-manager/constants.d.mts.map +1 -0
- package/dist/quote-status-manager/constants.mjs +178 -0
- package/dist/quote-status-manager/constants.mjs.map +1 -0
- package/dist/quote-status-manager/errors.cjs +51 -0
- package/dist/quote-status-manager/errors.cjs.map +1 -0
- package/dist/quote-status-manager/errors.d.cts +45 -0
- package/dist/quote-status-manager/errors.d.cts.map +1 -0
- package/dist/quote-status-manager/errors.d.mts +45 -0
- package/dist/quote-status-manager/errors.d.mts.map +1 -0
- package/dist/quote-status-manager/errors.mjs +46 -0
- package/dist/quote-status-manager/errors.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.cjs +241 -0
- package/dist/quote-status-manager/quote-status-api-service.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.d.cts +93 -0
- package/dist/quote-status-manager/quote-status-api-service.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.d.mts +93 -0
- package/dist/quote-status-manager/quote-status-api-service.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.mjs +237 -0
- package/dist/quote-status-manager/quote-status-api-service.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.cjs +271 -0
- package/dist/quote-status-manager/quote-status-entry-store.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.cts +144 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.mts +144 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.mjs +267 -0
- package/dist/quote-status-manager/quote-status-entry-store.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs +29 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts +32 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts +32 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs +25 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.cjs +107 -0
- package/dist/quote-status-manager/quote-status-state-fsm.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.cts +57 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts +57 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.mjs +103 -0
- package/dist/quote-status-manager/quote-status-state-fsm.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs +27 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts +30 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts +30 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs +23 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.cjs +477 -0
- package/dist/quote-status-manager/quotes-status-manager.cjs.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.d.cts +124 -0
- package/dist/quote-status-manager/quotes-status-manager.d.cts.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.d.mts +124 -0
- package/dist/quote-status-manager/quotes-status-manager.d.mts.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.mjs +473 -0
- package/dist/quote-status-manager/quotes-status-manager.mjs.map +1 -0
- package/dist/quote-status-manager/types.cjs +8 -0
- package/dist/quote-status-manager/types.cjs.map +1 -0
- package/dist/quote-status-manager/types.d.cts +145 -0
- package/dist/quote-status-manager/types.d.cts.map +1 -0
- package/dist/quote-status-manager/types.d.mts +145 -0
- package/dist/quote-status-manager/types.d.mts.map +1 -0
- package/dist/quote-status-manager/types.mjs +6 -0
- package/dist/quote-status-manager/types.mjs.map +1 -0
- package/dist/quote-status-manager/utils.cjs +11 -0
- package/dist/quote-status-manager/utils.cjs.map +1 -0
- package/dist/quote-status-manager/utils.d.cts +7 -0
- package/dist/quote-status-manager/utils.d.cts.map +1 -0
- package/dist/quote-status-manager/utils.d.mts +7 -0
- package/dist/quote-status-manager/utils.d.mts.map +1 -0
- package/dist/quote-status-manager/utils.mjs +7 -0
- package/dist/quote-status-manager/utils.mjs.map +1 -0
- package/dist/quote-status-manager/validators.cjs +44 -0
- package/dist/quote-status-manager/validators.cjs.map +1 -0
- package/dist/quote-status-manager/validators.d.cts +172 -0
- package/dist/quote-status-manager/validators.d.cts.map +1 -0
- package/dist/quote-status-manager/validators.d.mts +172 -0
- package/dist/quote-status-manager/validators.d.mts.map +1 -0
- package/dist/quote-status-manager/validators.mjs +39 -0
- package/dist/quote-status-manager/validators.mjs.map +1 -0
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +15 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +15 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/history.cjs +1 -0
- package/dist/utils/history.cjs.map +1 -1
- package/dist/utils/history.d.cts.map +1 -1
- package/dist/utils/history.d.mts.map +1 -1
- package/dist/utils/history.mjs +1 -0
- package/dist/utils/history.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BridgeClientId, BridgeStatusControllerMessenger } from "../types.cjs";
|
|
2
|
+
import { QuoteStatusUpdateError } from "./errors.cjs";
|
|
3
|
+
import { QuoteStatusPersistEntry } from "./types.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* Tracks bridge/swap quotes through their lifecycle and keeps the backend in
|
|
6
|
+
* sync with the latest known status of each quote.
|
|
7
|
+
*
|
|
8
|
+
* Quotes are reported via {@link reportSubmitted} and {@link reportFinalised},
|
|
9
|
+
* stored as runtime entries, and pushed to the backend. Updates that fail in a
|
|
10
|
+
* retryable way are retried on a periodic timer until each entry reaches a
|
|
11
|
+
* terminal state, at which point it is evicted and the timer stops once the
|
|
12
|
+
* store is empty.
|
|
13
|
+
*/
|
|
14
|
+
export declare class QuoteStatusManager {
|
|
15
|
+
#private;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new manager and immediately processes any persisted entries.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Constructor options.
|
|
20
|
+
* @param options.messenger - Messenger used to communicate with the backend
|
|
21
|
+
* API service.
|
|
22
|
+
* @param options.clientId - Identifier of the client making the requests.
|
|
23
|
+
* @param options.clientProduct - Name of the client product making the
|
|
24
|
+
* requests.
|
|
25
|
+
* @param options.clientVersion - Optional version of the client product.
|
|
26
|
+
* @param options.apiBaseUrl - Base URL of the quote status backend API.
|
|
27
|
+
* @param options.onPersistUpdates - Callback invoked to persist entry updates.
|
|
28
|
+
* @param options.onError - Optional callback invoked when a non-recoverable
|
|
29
|
+
* error occurs.
|
|
30
|
+
* @param options.isEnabled - Optional predicate gating whether the manager
|
|
31
|
+
* performs any work.
|
|
32
|
+
* @param options.entryTtlMs - Time-to-live, in milliseconds, after which a
|
|
33
|
+
* tracked entry is evicted.
|
|
34
|
+
* @param options.updateIntervalMs - How often the manager re-processes entries that
|
|
35
|
+
* have not yet reached a terminal state
|
|
36
|
+
* @param options.initialData - Persisted entries to rehydrate on startup.
|
|
37
|
+
*/
|
|
38
|
+
constructor({ messenger, clientId, clientProduct, clientVersion, apiBaseUrl, onError, isEnabled, onPersistUpdates, entryTtlMs, updateIntervalMs, initialData, }: {
|
|
39
|
+
messenger: BridgeStatusControllerMessenger;
|
|
40
|
+
clientId: BridgeClientId;
|
|
41
|
+
clientProduct: string;
|
|
42
|
+
clientVersion?: string;
|
|
43
|
+
apiBaseUrl: string;
|
|
44
|
+
onPersistUpdates: (updates: Record<string, QuoteStatusPersistEntry>) => void;
|
|
45
|
+
onError?: (error: QuoteStatusUpdateError) => void;
|
|
46
|
+
isEnabled?: () => boolean;
|
|
47
|
+
entryTtlMs: number;
|
|
48
|
+
updateIntervalMs: number;
|
|
49
|
+
initialData: Record<string, QuoteStatusPersistEntry>;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Whether quote-status tracking and backend sync are currently active.
|
|
53
|
+
*
|
|
54
|
+
* Reflects the latest value returned by the optional `isEnabled` predicate
|
|
55
|
+
* supplied at construction time. When no predicate was provided, this is
|
|
56
|
+
* always `false` and all public methods that gate on enablement no-op.
|
|
57
|
+
*
|
|
58
|
+
* @returns `true` when the `isEnabled` predicate returns a truthy value.
|
|
59
|
+
*/
|
|
60
|
+
get enabled(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Reports that a previously submitted quote has finalized on-chain.
|
|
63
|
+
*
|
|
64
|
+
* Looks up the tracked entry by its transaction metadata id, transitions it to
|
|
65
|
+
* the appropriate terminal state, and processes the update. No-ops when the
|
|
66
|
+
* manager is disabled, and surfaces an error when the entry is missing or
|
|
67
|
+
* cannot transition to the finalized state.
|
|
68
|
+
*
|
|
69
|
+
* @param txMetaId - Transaction metadata id of the finalized quote.
|
|
70
|
+
* @param success - Whether the transaction finalized successfully.
|
|
71
|
+
*/
|
|
72
|
+
reportFinalised(txMetaId: string, success: boolean): void;
|
|
73
|
+
/**
|
|
74
|
+
* Reports that a quote has been submitted on-chain and begins tracking it.
|
|
75
|
+
*
|
|
76
|
+
* Creates a new entry in the `Submitted` state, starts the retry timer, and
|
|
77
|
+
* processes the initial status update. No-ops when the manager is disabled,
|
|
78
|
+
* and surfaces an error if the entry cannot be retrieved after being stored.
|
|
79
|
+
*
|
|
80
|
+
* @param quoteId - Identifier of the submitted quote.
|
|
81
|
+
* @param srcTxHash - Hash of the source-chain transaction for the quote.
|
|
82
|
+
* @param txMetaId - Optional transaction metadata id used to correlate
|
|
83
|
+
* finalization reports.
|
|
84
|
+
*/
|
|
85
|
+
reportSubmitted(quoteId: string, srcTxHash: string, txMetaId?: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Tears down the manager by stopping the retry timer and clearing all tracked
|
|
88
|
+
* entries.
|
|
89
|
+
*/
|
|
90
|
+
destroy(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Reconciles quote-status entries whose finalization was missed while the
|
|
93
|
+
* client was closed. Called once during initialization.
|
|
94
|
+
*
|
|
95
|
+
* Swap/bridge source transactions report their final status through the
|
|
96
|
+
* `TransactionController:transactionStatusUpdated` subscription
|
|
97
|
+
* ({@link #onTransactionConfirmed}/{@link #onTransactionFailed}). When a source
|
|
98
|
+
* transaction reaches a terminal state while the client is not running, that
|
|
99
|
+
* event is never re-emitted on the next startup, so the persisted entry would
|
|
100
|
+
* remain `Submitted` until it expires via TTL. This replays the missed terminal
|
|
101
|
+
* event for both swaps and bridges: a confirmed source transaction is reported
|
|
102
|
+
* as a finalized success and a failed/dropped one as a finalized failure.
|
|
103
|
+
*
|
|
104
|
+
* `rejected` is ignored because the transaction was never broadcast.
|
|
105
|
+
*/
|
|
106
|
+
init(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Fetches the current quote status from the backend with automatic retries.
|
|
109
|
+
*
|
|
110
|
+
* Unlike {@link reportSubmitted} and {@link reportFinalised}, this is a
|
|
111
|
+
* read-only query and does not mutate tracked entries. Returns `null` when
|
|
112
|
+
* the manager is disabled ({@link enabled} is `false`).
|
|
113
|
+
*
|
|
114
|
+
* @param quoteId - Identifier of the quote whose status should be fetched.
|
|
115
|
+
* @param options - Retry configuration.
|
|
116
|
+
* @param options.maxRetries - Maximum number of retries after the initial attempt.
|
|
117
|
+
* @param options.delayMsBetweenRetries - Delay in milliseconds between attempts.
|
|
118
|
+
*/
|
|
119
|
+
getStatus(quoteId: string, options?: {
|
|
120
|
+
maxRetries?: number;
|
|
121
|
+
delayMsBetweenRetries?: number;
|
|
122
|
+
}): void;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=quotes-status-manager.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes-status-manager.d.cts","sourceRoot":"","sources":["../../src/quote-status-manager/quotes-status-manager.ts"],"names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,IAAI,IAAI;IAuCZ;;;;;;;;;;;OAWG;IACH,SAAS,CACP,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAIhC,GACA,IAAI;CA8YR"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BridgeClientId, BridgeStatusControllerMessenger } from "../types.mjs";
|
|
2
|
+
import { QuoteStatusUpdateError } from "./errors.mjs";
|
|
3
|
+
import { QuoteStatusPersistEntry } from "./types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Tracks bridge/swap quotes through their lifecycle and keeps the backend in
|
|
6
|
+
* sync with the latest known status of each quote.
|
|
7
|
+
*
|
|
8
|
+
* Quotes are reported via {@link reportSubmitted} and {@link reportFinalised},
|
|
9
|
+
* stored as runtime entries, and pushed to the backend. Updates that fail in a
|
|
10
|
+
* retryable way are retried on a periodic timer until each entry reaches a
|
|
11
|
+
* terminal state, at which point it is evicted and the timer stops once the
|
|
12
|
+
* store is empty.
|
|
13
|
+
*/
|
|
14
|
+
export declare class QuoteStatusManager {
|
|
15
|
+
#private;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new manager and immediately processes any persisted entries.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Constructor options.
|
|
20
|
+
* @param options.messenger - Messenger used to communicate with the backend
|
|
21
|
+
* API service.
|
|
22
|
+
* @param options.clientId - Identifier of the client making the requests.
|
|
23
|
+
* @param options.clientProduct - Name of the client product making the
|
|
24
|
+
* requests.
|
|
25
|
+
* @param options.clientVersion - Optional version of the client product.
|
|
26
|
+
* @param options.apiBaseUrl - Base URL of the quote status backend API.
|
|
27
|
+
* @param options.onPersistUpdates - Callback invoked to persist entry updates.
|
|
28
|
+
* @param options.onError - Optional callback invoked when a non-recoverable
|
|
29
|
+
* error occurs.
|
|
30
|
+
* @param options.isEnabled - Optional predicate gating whether the manager
|
|
31
|
+
* performs any work.
|
|
32
|
+
* @param options.entryTtlMs - Time-to-live, in milliseconds, after which a
|
|
33
|
+
* tracked entry is evicted.
|
|
34
|
+
* @param options.updateIntervalMs - How often the manager re-processes entries that
|
|
35
|
+
* have not yet reached a terminal state
|
|
36
|
+
* @param options.initialData - Persisted entries to rehydrate on startup.
|
|
37
|
+
*/
|
|
38
|
+
constructor({ messenger, clientId, clientProduct, clientVersion, apiBaseUrl, onError, isEnabled, onPersistUpdates, entryTtlMs, updateIntervalMs, initialData, }: {
|
|
39
|
+
messenger: BridgeStatusControllerMessenger;
|
|
40
|
+
clientId: BridgeClientId;
|
|
41
|
+
clientProduct: string;
|
|
42
|
+
clientVersion?: string;
|
|
43
|
+
apiBaseUrl: string;
|
|
44
|
+
onPersistUpdates: (updates: Record<string, QuoteStatusPersistEntry>) => void;
|
|
45
|
+
onError?: (error: QuoteStatusUpdateError) => void;
|
|
46
|
+
isEnabled?: () => boolean;
|
|
47
|
+
entryTtlMs: number;
|
|
48
|
+
updateIntervalMs: number;
|
|
49
|
+
initialData: Record<string, QuoteStatusPersistEntry>;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Whether quote-status tracking and backend sync are currently active.
|
|
53
|
+
*
|
|
54
|
+
* Reflects the latest value returned by the optional `isEnabled` predicate
|
|
55
|
+
* supplied at construction time. When no predicate was provided, this is
|
|
56
|
+
* always `false` and all public methods that gate on enablement no-op.
|
|
57
|
+
*
|
|
58
|
+
* @returns `true` when the `isEnabled` predicate returns a truthy value.
|
|
59
|
+
*/
|
|
60
|
+
get enabled(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Reports that a previously submitted quote has finalized on-chain.
|
|
63
|
+
*
|
|
64
|
+
* Looks up the tracked entry by its transaction metadata id, transitions it to
|
|
65
|
+
* the appropriate terminal state, and processes the update. No-ops when the
|
|
66
|
+
* manager is disabled, and surfaces an error when the entry is missing or
|
|
67
|
+
* cannot transition to the finalized state.
|
|
68
|
+
*
|
|
69
|
+
* @param txMetaId - Transaction metadata id of the finalized quote.
|
|
70
|
+
* @param success - Whether the transaction finalized successfully.
|
|
71
|
+
*/
|
|
72
|
+
reportFinalised(txMetaId: string, success: boolean): void;
|
|
73
|
+
/**
|
|
74
|
+
* Reports that a quote has been submitted on-chain and begins tracking it.
|
|
75
|
+
*
|
|
76
|
+
* Creates a new entry in the `Submitted` state, starts the retry timer, and
|
|
77
|
+
* processes the initial status update. No-ops when the manager is disabled,
|
|
78
|
+
* and surfaces an error if the entry cannot be retrieved after being stored.
|
|
79
|
+
*
|
|
80
|
+
* @param quoteId - Identifier of the submitted quote.
|
|
81
|
+
* @param srcTxHash - Hash of the source-chain transaction for the quote.
|
|
82
|
+
* @param txMetaId - Optional transaction metadata id used to correlate
|
|
83
|
+
* finalization reports.
|
|
84
|
+
*/
|
|
85
|
+
reportSubmitted(quoteId: string, srcTxHash: string, txMetaId?: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Tears down the manager by stopping the retry timer and clearing all tracked
|
|
88
|
+
* entries.
|
|
89
|
+
*/
|
|
90
|
+
destroy(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Reconciles quote-status entries whose finalization was missed while the
|
|
93
|
+
* client was closed. Called once during initialization.
|
|
94
|
+
*
|
|
95
|
+
* Swap/bridge source transactions report their final status through the
|
|
96
|
+
* `TransactionController:transactionStatusUpdated` subscription
|
|
97
|
+
* ({@link #onTransactionConfirmed}/{@link #onTransactionFailed}). When a source
|
|
98
|
+
* transaction reaches a terminal state while the client is not running, that
|
|
99
|
+
* event is never re-emitted on the next startup, so the persisted entry would
|
|
100
|
+
* remain `Submitted` until it expires via TTL. This replays the missed terminal
|
|
101
|
+
* event for both swaps and bridges: a confirmed source transaction is reported
|
|
102
|
+
* as a finalized success and a failed/dropped one as a finalized failure.
|
|
103
|
+
*
|
|
104
|
+
* `rejected` is ignored because the transaction was never broadcast.
|
|
105
|
+
*/
|
|
106
|
+
init(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Fetches the current quote status from the backend with automatic retries.
|
|
109
|
+
*
|
|
110
|
+
* Unlike {@link reportSubmitted} and {@link reportFinalised}, this is a
|
|
111
|
+
* read-only query and does not mutate tracked entries. Returns `null` when
|
|
112
|
+
* the manager is disabled ({@link enabled} is `false`).
|
|
113
|
+
*
|
|
114
|
+
* @param quoteId - Identifier of the quote whose status should be fetched.
|
|
115
|
+
* @param options - Retry configuration.
|
|
116
|
+
* @param options.maxRetries - Maximum number of retries after the initial attempt.
|
|
117
|
+
* @param options.delayMsBetweenRetries - Delay in milliseconds between attempts.
|
|
118
|
+
*/
|
|
119
|
+
getStatus(quoteId: string, options?: {
|
|
120
|
+
maxRetries?: number;
|
|
121
|
+
delayMsBetweenRetries?: number;
|
|
122
|
+
}): void;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=quotes-status-manager.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes-status-manager.d.mts","sourceRoot":"","sources":["../../src/quote-status-manager/quotes-status-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,+BAA+B,EAAE,qBAAiB;AAa3E,OAAO,EAAE,sBAAsB,EAAE,qBAAiB;AAKlD,OAAO,EAAE,uBAAuB,EAA2B,oBAAgB;AAE3E;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;;IAqB7B;;;;;;;;;;;;;;;;;;;;;OAqBG;gBACS,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,UAAU,EACV,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,QAAQ,EAAE,cAAc,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,EAAE,CAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uB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