@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,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How often the manager re-processes entries that have not yet reached a
|
|
3
|
+
* terminal state (`Completed`/`Expired`).
|
|
4
|
+
*
|
|
5
|
+
* Drives the periodic retry timer in `QuoteStatusUpdateManager`: on each tick
|
|
6
|
+
* every non-terminal entry is re-sent to the backend until it is accepted or
|
|
7
|
+
* evicted. The timer only runs while there is outstanding work.
|
|
8
|
+
*/
|
|
9
|
+
export const QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS = 30 * 60 * 1000; // 30 minutes
|
|
10
|
+
/**
|
|
11
|
+
* Maximum lifetime of a tracked quote-status entry, measured from when it was
|
|
12
|
+
* created.
|
|
13
|
+
*
|
|
14
|
+
* Once an entry is older than this it is considered `Expired`, evicted from the
|
|
15
|
+
* store on the next read, and never retried again. This bounds how long the
|
|
16
|
+
* manager keeps trying to report a status that the backend may never accept.
|
|
17
|
+
*/
|
|
18
|
+
export const QUOTE_STATUS_UPDATE_ENTRY_TTL = 12 * 60 * 60 * 1000; // 12 hours
|
|
19
|
+
/**
|
|
20
|
+
* Quote lifecycle statuses as understood by the backend `quote/updateStatus`
|
|
21
|
+
* API. These are the values sent over the wire (and echoed back in error
|
|
22
|
+
* responses).
|
|
23
|
+
*/
|
|
24
|
+
export var QuoteStatusBackendStatus;
|
|
25
|
+
(function (QuoteStatusBackendStatus) {
|
|
26
|
+
/**
|
|
27
|
+
* Quote was served to the client. Unused locally, kept for parity with the backend enum.
|
|
28
|
+
*/
|
|
29
|
+
QuoteStatusBackendStatus["Served"] = "SERVED";
|
|
30
|
+
/**
|
|
31
|
+
* User has submitted the source transaction.
|
|
32
|
+
*/
|
|
33
|
+
QuoteStatusBackendStatus["Submitted"] = "SUBMITTED";
|
|
34
|
+
/**
|
|
35
|
+
* Transaction finalized successfully on-chain.
|
|
36
|
+
*/
|
|
37
|
+
QuoteStatusBackendStatus["FinalizedSuccess"] = "FINALIZED_SUCCESS";
|
|
38
|
+
/**
|
|
39
|
+
* Transaction failed or reverted on-chain.
|
|
40
|
+
*/
|
|
41
|
+
QuoteStatusBackendStatus["FinalizedFailed"] = "FINALIZED_FAILED";
|
|
42
|
+
})(QuoteStatusBackendStatus || (QuoteStatusBackendStatus = {}));
|
|
43
|
+
/**
|
|
44
|
+
* Machine-readable error `type` values returned by the backend
|
|
45
|
+
* `quote/updateStatus` API on non-2xx responses. The comments record the HTTP
|
|
46
|
+
* status the backend pairs with each type.
|
|
47
|
+
*/
|
|
48
|
+
export var QuoteStatusUpdateBackendErrorType;
|
|
49
|
+
(function (QuoteStatusUpdateBackendErrorType) {
|
|
50
|
+
QuoteStatusUpdateBackendErrorType["QuoteNotFound"] = "QUOTE_NOT_FOUND";
|
|
51
|
+
QuoteStatusUpdateBackendErrorType["ConcurrentUpdate"] = "CONCURRENT_UPDATE";
|
|
52
|
+
QuoteStatusUpdateBackendErrorType["InvalidStatusTransaction"] = "INVALID_STATUS_TRANSITION";
|
|
53
|
+
QuoteStatusUpdateBackendErrorType["SrcTxHashRequiredForFinalized"] = "SRC_TX_HASH_REQUIRED_FOR_FINALIZED";
|
|
54
|
+
QuoteStatusUpdateBackendErrorType["PersistQuoteStatusFailed"] = "PERSIST_QUOTE_STATUS_FAILED";
|
|
55
|
+
QuoteStatusUpdateBackendErrorType["TransactionNotIndexed"] = "TRANSACTION_NOT_INDEXED";
|
|
56
|
+
QuoteStatusUpdateBackendErrorType["TxDataMissingHash"] = "TX_DATA_MISSING_HASH";
|
|
57
|
+
QuoteStatusUpdateBackendErrorType["TxDataMissingTrade"] = "TX_DATA_MISSING_TRADE";
|
|
58
|
+
/**
|
|
59
|
+
* On-chain tx payload does not match the served quote (EVM calldata, SVM message, TVM raw_data_hex).
|
|
60
|
+
*/
|
|
61
|
+
QuoteStatusUpdateBackendErrorType["TxDataMismatch"] = "TX_DATA_MISMATCH";
|
|
62
|
+
QuoteStatusUpdateBackendErrorType["SvmTradeDeserializeFailed"] = "SVM_TRADE_DESERIALIZE_FAILED";
|
|
63
|
+
/**
|
|
64
|
+
* Requested lifecycle status is inconsistent with observed on-chain tx status.
|
|
65
|
+
*/
|
|
66
|
+
QuoteStatusUpdateBackendErrorType["QuoteStatusOnChainMismatch"] = "QUOTE_STATUS_ONCHAIN_MISMATCH";
|
|
67
|
+
})(QuoteStatusUpdateBackendErrorType || (QuoteStatusUpdateBackendErrorType = {}));
|
|
68
|
+
/**
|
|
69
|
+
* Error types whose response payload carries no `currentStatus`. Used by the
|
|
70
|
+
* response validator to define the base (non-mismatch) error response schema.
|
|
71
|
+
*/
|
|
72
|
+
export const BaseQuoteStatusUpdateErrorTypes = [
|
|
73
|
+
QuoteStatusUpdateBackendErrorType.QuoteNotFound,
|
|
74
|
+
QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,
|
|
75
|
+
QuoteStatusUpdateBackendErrorType.SrcTxHashRequiredForFinalized,
|
|
76
|
+
QuoteStatusUpdateBackendErrorType.PersistQuoteStatusFailed,
|
|
77
|
+
QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,
|
|
78
|
+
QuoteStatusUpdateBackendErrorType.TxDataMissingHash,
|
|
79
|
+
QuoteStatusUpdateBackendErrorType.TxDataMissingTrade,
|
|
80
|
+
QuoteStatusUpdateBackendErrorType.TxDataMismatch,
|
|
81
|
+
QuoteStatusUpdateBackendErrorType.SvmTradeDeserializeFailed,
|
|
82
|
+
];
|
|
83
|
+
/**
|
|
84
|
+
* The full set of valid backend status values. Used by the response validator
|
|
85
|
+
* to constrain the `currentStatus`/`newStatus` fields of error responses.
|
|
86
|
+
*/
|
|
87
|
+
export const QuoteStatusBackendValues = [
|
|
88
|
+
QuoteStatusBackendStatus.Served,
|
|
89
|
+
QuoteStatusBackendStatus.Submitted,
|
|
90
|
+
QuoteStatusBackendStatus.FinalizedSuccess,
|
|
91
|
+
QuoteStatusBackendStatus.FinalizedFailed,
|
|
92
|
+
];
|
|
93
|
+
/**
|
|
94
|
+
* Error types whose response payload includes a `currentStatus` describing the
|
|
95
|
+
* backend's observed status. Used by the validator for the mismatch response
|
|
96
|
+
* schema and by the manager to reconcile local state with the backend.
|
|
97
|
+
*/
|
|
98
|
+
export const QuoteStatusUpdateBackendOnChainMismatchTypes = [
|
|
99
|
+
QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction,
|
|
100
|
+
QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch,
|
|
101
|
+
];
|
|
102
|
+
/**
|
|
103
|
+
* Error types that represent transient backend conditions. A response with one
|
|
104
|
+
* of these types is retried by `updateQuoteStatusWithRetry`; any other error
|
|
105
|
+
* type is treated as non-retryable.
|
|
106
|
+
*/
|
|
107
|
+
export const QuoteStatusUpdateRetryableBackendTypes = [
|
|
108
|
+
QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,
|
|
109
|
+
QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,
|
|
110
|
+
];
|
|
111
|
+
/**
|
|
112
|
+
* Local quote-status lifecycle states tracked by the state machine. These are
|
|
113
|
+
* the states the manager owns; a subset maps onto backend statuses while
|
|
114
|
+
* `Completed`/`Expired` are terminal, client-only states.
|
|
115
|
+
*/
|
|
116
|
+
export var QuoteStatusState;
|
|
117
|
+
(function (QuoteStatusState) {
|
|
118
|
+
/** Source transaction submitted; awaiting finalization. */
|
|
119
|
+
QuoteStatusState["Submitted"] = "Submitted";
|
|
120
|
+
/** Transaction finalized successfully on-chain. */
|
|
121
|
+
QuoteStatusState["FinalizedSuccess"] = "FinalizedSuccess";
|
|
122
|
+
/** Transaction failed or reverted on-chain. */
|
|
123
|
+
QuoteStatusState["FinalizedFailed"] = "FinalizedFailed";
|
|
124
|
+
/** Terminal: the backend accepted the final status; nothing left to report. */
|
|
125
|
+
QuoteStatusState["Completed"] = "Completed";
|
|
126
|
+
/** Terminal: the entry outlived its TTL and was abandoned. */
|
|
127
|
+
QuoteStatusState["Expired"] = "Expired";
|
|
128
|
+
})(QuoteStatusState || (QuoteStatusState = {}));
|
|
129
|
+
/**
|
|
130
|
+
* Maps each local lifecycle state to the backend status to report for it, or
|
|
131
|
+
* `null` for terminal states that require no backend update. The manager uses a
|
|
132
|
+
* `null` mapping as the signal to remove the entry instead of calling the API.
|
|
133
|
+
*/
|
|
134
|
+
export const QuoteStatusStateToBackendStatus = {
|
|
135
|
+
[QuoteStatusState.Submitted]: QuoteStatusBackendStatus.Submitted,
|
|
136
|
+
[QuoteStatusState.FinalizedSuccess]: QuoteStatusBackendStatus.FinalizedSuccess,
|
|
137
|
+
[QuoteStatusState.FinalizedFailed]: QuoteStatusBackendStatus.FinalizedFailed,
|
|
138
|
+
[QuoteStatusState.Completed]: null,
|
|
139
|
+
[QuoteStatusState.Expired]: null,
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Adjacency list defining the allowed forward-only transitions between
|
|
143
|
+
* lifecycle states. Enforced by `QuoteStatusStateFsm`; terminal states map to
|
|
144
|
+
* an empty array. Any state not present is treated as terminal.
|
|
145
|
+
*/
|
|
146
|
+
export const AllowedQuoteStatusStateTransitions = {
|
|
147
|
+
[QuoteStatusState.Submitted]: [
|
|
148
|
+
QuoteStatusState.FinalizedFailed,
|
|
149
|
+
QuoteStatusState.FinalizedSuccess,
|
|
150
|
+
QuoteStatusState.Expired,
|
|
151
|
+
],
|
|
152
|
+
[QuoteStatusState.FinalizedFailed]: [
|
|
153
|
+
QuoteStatusState.Completed,
|
|
154
|
+
QuoteStatusState.Expired,
|
|
155
|
+
],
|
|
156
|
+
[QuoteStatusState.FinalizedSuccess]: [
|
|
157
|
+
QuoteStatusState.Completed,
|
|
158
|
+
QuoteStatusState.Expired,
|
|
159
|
+
],
|
|
160
|
+
[QuoteStatusState.Completed]: [],
|
|
161
|
+
[QuoteStatusState.Expired]: [],
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Outcome of a retrying status fetch call. Tells the
|
|
165
|
+
* manager how to proceed after an update attempt completes.
|
|
166
|
+
*/
|
|
167
|
+
export var QuoteStatusFetchWithRetryOutcomeType;
|
|
168
|
+
(function (QuoteStatusFetchWithRetryOutcomeType) {
|
|
169
|
+
/** The backend accepted the update (2xx); the entry can be finalized/removed. */
|
|
170
|
+
QuoteStatusFetchWithRetryOutcomeType["Accepted"] = "accepted";
|
|
171
|
+
/** All retry attempts for a retryable error were used up; back off and try again later. */
|
|
172
|
+
QuoteStatusFetchWithRetryOutcomeType["RetryableExhausted"] = "retryableExhausted";
|
|
173
|
+
/** The backend returned a non-retryable error; the entry must be reconciled or evicted. */
|
|
174
|
+
QuoteStatusFetchWithRetryOutcomeType["NonRetryable"] = "nonRetryable";
|
|
175
|
+
/** The request was aborted (e.g. via abort signal) before completing. */
|
|
176
|
+
QuoteStatusFetchWithRetryOutcomeType["Interrupted"] = "interrupted";
|
|
177
|
+
})(QuoteStatusFetchWithRetryOutcomeType || (QuoteStatusFetchWithRetryOutcomeType = {}));
|
|
178
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/quote-status-manager/constants.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * How often the manager re-processes entries that have not yet reached a\n * terminal state (`Completed`/`Expired`).\n *\n * Drives the periodic retry timer in `QuoteStatusUpdateManager`: on each tick\n * every non-terminal entry is re-sent to the backend until it is accepted or\n * evicted. The timer only runs while there is outstanding work.\n */\nexport const QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS = 30 * 60 * 1000; // 30 minutes\n\n/**\n * Maximum lifetime of a tracked quote-status entry, measured from when it was\n * created.\n *\n * Once an entry is older than this it is considered `Expired`, evicted from the\n * store on the next read, and never retried again. This bounds how long the\n * manager keeps trying to report a status that the backend may never accept.\n */\nexport const QUOTE_STATUS_UPDATE_ENTRY_TTL = 12 * 60 * 60 * 1000; // 12 hours\n\n/**\n * Quote lifecycle statuses as understood by the backend `quote/updateStatus`\n * API. These are the values sent over the wire (and echoed back in error\n * responses).\n */\nexport enum QuoteStatusBackendStatus {\n /**\n * Quote was served to the client. Unused locally, kept for parity with the backend enum.\n */\n Served = 'SERVED',\n /**\n * User has submitted the source transaction.\n */\n Submitted = 'SUBMITTED',\n /**\n * Transaction finalized successfully on-chain.\n */\n FinalizedSuccess = 'FINALIZED_SUCCESS',\n /**\n * Transaction failed or reverted on-chain.\n */\n FinalizedFailed = 'FINALIZED_FAILED',\n}\n\n/**\n * Machine-readable error `type` values returned by the backend\n * `quote/updateStatus` API on non-2xx responses. The comments record the HTTP\n * status the backend pairs with each type.\n */\nexport enum QuoteStatusUpdateBackendErrorType {\n QuoteNotFound = 'QUOTE_NOT_FOUND', // Http status: 404\n ConcurrentUpdate = 'CONCURRENT_UPDATE', // Http status: 409\n InvalidStatusTransaction = 'INVALID_STATUS_TRANSITION', // Http status: 400\n SrcTxHashRequiredForFinalized = 'SRC_TX_HASH_REQUIRED_FOR_FINALIZED', // Http status: 400\n PersistQuoteStatusFailed = 'PERSIST_QUOTE_STATUS_FAILED', // Http status: 400\n TransactionNotIndexed = 'TRANSACTION_NOT_INDEXED', // Http status: 409\n TxDataMissingHash = 'TX_DATA_MISSING_HASH', // Http status: 400\n TxDataMissingTrade = 'TX_DATA_MISSING_TRADE', // Http status: 400\n /**\n * On-chain tx payload does not match the served quote (EVM calldata, SVM message, TVM raw_data_hex).\n */\n TxDataMismatch = 'TX_DATA_MISMATCH', // Http status: 400\n SvmTradeDeserializeFailed = 'SVM_TRADE_DESERIALIZE_FAILED', // Http status: 400\n /**\n * Requested lifecycle status is inconsistent with observed on-chain tx status.\n */\n QuoteStatusOnChainMismatch = 'QUOTE_STATUS_ONCHAIN_MISMATCH', // Http status: 400\n}\n\n/**\n * Error types whose response payload carries no `currentStatus`. Used by the\n * response validator to define the base (non-mismatch) error response schema.\n */\nexport const BaseQuoteStatusUpdateErrorTypes = [\n QuoteStatusUpdateBackendErrorType.QuoteNotFound,\n QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,\n QuoteStatusUpdateBackendErrorType.SrcTxHashRequiredForFinalized,\n QuoteStatusUpdateBackendErrorType.PersistQuoteStatusFailed,\n QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,\n QuoteStatusUpdateBackendErrorType.TxDataMissingHash,\n QuoteStatusUpdateBackendErrorType.TxDataMissingTrade,\n QuoteStatusUpdateBackendErrorType.TxDataMismatch,\n QuoteStatusUpdateBackendErrorType.SvmTradeDeserializeFailed,\n] as const;\n\n/**\n * The full set of valid backend status values. Used by the response validator\n * to constrain the `currentStatus`/`newStatus` fields of error responses.\n */\nexport const QuoteStatusBackendValues = [\n QuoteStatusBackendStatus.Served,\n QuoteStatusBackendStatus.Submitted,\n QuoteStatusBackendStatus.FinalizedSuccess,\n QuoteStatusBackendStatus.FinalizedFailed,\n] as const;\n\n/**\n * Error types whose response payload includes a `currentStatus` describing the\n * backend's observed status. Used by the validator for the mismatch response\n * schema and by the manager to reconcile local state with the backend.\n */\nexport const QuoteStatusUpdateBackendOnChainMismatchTypes = [\n QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction,\n QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch,\n] as const;\n\n/**\n * Error types that represent transient backend conditions. A response with one\n * of these types is retried by `updateQuoteStatusWithRetry`; any other error\n * type is treated as non-retryable.\n */\nexport const QuoteStatusUpdateRetryableBackendTypes = [\n QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,\n QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,\n];\n\n/**\n * Local quote-status lifecycle states tracked by the state machine. These are\n * the states the manager owns; a subset maps onto backend statuses while\n * `Completed`/`Expired` are terminal, client-only states.\n */\nexport enum QuoteStatusState {\n /** Source transaction submitted; awaiting finalization. */\n Submitted = 'Submitted',\n /** Transaction finalized successfully on-chain. */\n FinalizedSuccess = 'FinalizedSuccess',\n /** Transaction failed or reverted on-chain. */\n FinalizedFailed = 'FinalizedFailed',\n /** Terminal: the backend accepted the final status; nothing left to report. */\n Completed = 'Completed',\n /** Terminal: the entry outlived its TTL and was abandoned. */\n Expired = 'Expired',\n}\n\n/**\n * Maps each local lifecycle state to the backend status to report for it, or\n * `null` for terminal states that require no backend update. The manager uses a\n * `null` mapping as the signal to remove the entry instead of calling the API.\n */\nexport const QuoteStatusStateToBackendStatus = {\n [QuoteStatusState.Submitted]: QuoteStatusBackendStatus.Submitted,\n [QuoteStatusState.FinalizedSuccess]:\n QuoteStatusBackendStatus.FinalizedSuccess,\n [QuoteStatusState.FinalizedFailed]: QuoteStatusBackendStatus.FinalizedFailed,\n [QuoteStatusState.Completed]: null,\n [QuoteStatusState.Expired]: null,\n};\n\n/**\n * Adjacency list defining the allowed forward-only transitions between\n * lifecycle states. Enforced by `QuoteStatusStateFsm`; terminal states map to\n * an empty array. Any state not present is treated as terminal.\n */\nexport const AllowedQuoteStatusStateTransitions: Record<\n QuoteStatusState,\n readonly QuoteStatusState[]\n> = {\n [QuoteStatusState.Submitted]: [\n QuoteStatusState.FinalizedFailed,\n QuoteStatusState.FinalizedSuccess,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.FinalizedFailed]: [\n QuoteStatusState.Completed,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.FinalizedSuccess]: [\n QuoteStatusState.Completed,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.Completed]: [],\n [QuoteStatusState.Expired]: [],\n};\n\n/**\n * Outcome of a retrying status fetch call. Tells the\n * manager how to proceed after an update attempt completes.\n */\nexport enum QuoteStatusFetchWithRetryOutcomeType {\n /** The backend accepted the update (2xx); the entry can be finalized/removed. */\n Accepted = 'accepted',\n /** All retry attempts for a retryable error were used up; back off and try again later. */\n RetryableExhausted = 'retryableExhausted',\n /** The backend returned a non-retryable error; the entry must be reconciled or evicted. */\n NonRetryable = 'nonRetryable',\n /** The request was aborted (e.g. via abort signal) before completing. */\n Interrupted = 'interrupted',\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuoteStatusGetError = exports.QuoteStatusUpdateError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown for quote status update failures.
|
|
6
|
+
*
|
|
7
|
+
* The error message is prefixed with the error type when provided, and
|
|
8
|
+
* structured details are preserved on the instance for downstream handling.
|
|
9
|
+
*/
|
|
10
|
+
class QuoteStatusUpdateError extends Error {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a quote status update error with structured context.
|
|
13
|
+
*
|
|
14
|
+
* @param message - Human-readable error message.
|
|
15
|
+
* @param details - Structured metadata about the failed quote update.
|
|
16
|
+
* @param details.errorType - Optional category for known update failures.
|
|
17
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
18
|
+
*/
|
|
19
|
+
constructor(message, details) {
|
|
20
|
+
super(`${details.errorType ? `[${details.errorType}] ` : ''}${message}`);
|
|
21
|
+
this.details = details;
|
|
22
|
+
this.name = QuoteStatusUpdateError.name;
|
|
23
|
+
Object.setPrototypeOf(this, QuoteStatusUpdateError.prototype);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.QuoteStatusUpdateError = QuoteStatusUpdateError;
|
|
27
|
+
/**
|
|
28
|
+
* Error thrown for quote status fetch failures.
|
|
29
|
+
*
|
|
30
|
+
* Structured details are preserved on the instance for downstream handling.
|
|
31
|
+
*/
|
|
32
|
+
class QuoteStatusGetError extends Error {
|
|
33
|
+
/**
|
|
34
|
+
* Creates a quote status fetch error with structured context.
|
|
35
|
+
*
|
|
36
|
+
* @param message - Human-readable error message.
|
|
37
|
+
* @param details - Structured metadata about the failed quote status fetch.
|
|
38
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
39
|
+
* @param retryable - Whether the error is transient and may resolve on retry.
|
|
40
|
+
* Defaults to `false`.
|
|
41
|
+
*/
|
|
42
|
+
constructor(message, details, retryable = false) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.details = details;
|
|
45
|
+
this.retryable = retryable;
|
|
46
|
+
this.name = QuoteStatusGetError.name;
|
|
47
|
+
Object.setPrototypeOf(this, QuoteStatusGetError.prototype);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.QuoteStatusGetError = QuoteStatusGetError;
|
|
51
|
+
//# sourceMappingURL=errors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":";;;AAKA;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAG/C;;;;;;;OAOG;IACH,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC;QACxC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAjBD,wDAiBC;AAED;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAW5C;;;;;;;;OAQG;IACH,YACE,OAAe,EACf,OAAmC,EACnC,SAAS,GAAG,KAAK;QAEjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF;AA/BD,kDA+BC","sourcesContent":["import {\n QuoteStatusGetErrorDetails,\n QuoteStatusUpdateErrorDetails,\n} from './types';\n\n/**\n * Error thrown for quote status update failures.\n *\n * The error message is prefixed with the error type when provided, and\n * structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusUpdateError extends Error {\n readonly details?: QuoteStatusUpdateErrorDetails;\n\n /**\n * Creates a quote status update error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote update.\n * @param details.errorType - Optional category for known update failures.\n * @param details.quoteId - Unique quote identifier associated with the error.\n */\n constructor(message: string, details: QuoteStatusUpdateErrorDetails) {\n super(`${details.errorType ? `[${details.errorType}] ` : ''}${message}`);\n this.details = details;\n this.name = QuoteStatusUpdateError.name;\n Object.setPrototypeOf(this, QuoteStatusUpdateError.prototype);\n }\n}\n\n/**\n * Error thrown for quote status fetch failures.\n *\n * Structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusGetError extends Error {\n readonly details?: QuoteStatusGetErrorDetails;\n\n /**\n * Whether the error is transient and the request may succeed on a retry.\n *\n * `true` for 5xx (server-side) HTTP errors; `false` for 4xx (client-side)\n * errors and response-validation failures.\n */\n readonly retryable: boolean;\n\n /**\n * Creates a quote status fetch error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote status fetch.\n * @param details.quoteId - Unique quote identifier associated with the error.\n * @param retryable - Whether the error is transient and may resolve on retry.\n * Defaults to `false`.\n */\n constructor(\n message: string,\n details: QuoteStatusGetErrorDetails,\n retryable = false,\n ) {\n super(message);\n this.details = details;\n this.retryable = retryable;\n this.name = QuoteStatusGetError.name;\n Object.setPrototypeOf(this, QuoteStatusGetError.prototype);\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { QuoteStatusGetErrorDetails, QuoteStatusUpdateErrorDetails } from "./types.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown for quote status update failures.
|
|
4
|
+
*
|
|
5
|
+
* The error message is prefixed with the error type when provided, and
|
|
6
|
+
* structured details are preserved on the instance for downstream handling.
|
|
7
|
+
*/
|
|
8
|
+
export declare class QuoteStatusUpdateError extends Error {
|
|
9
|
+
readonly details?: QuoteStatusUpdateErrorDetails;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a quote status update error with structured context.
|
|
12
|
+
*
|
|
13
|
+
* @param message - Human-readable error message.
|
|
14
|
+
* @param details - Structured metadata about the failed quote update.
|
|
15
|
+
* @param details.errorType - Optional category for known update failures.
|
|
16
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
17
|
+
*/
|
|
18
|
+
constructor(message: string, details: QuoteStatusUpdateErrorDetails);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown for quote status fetch failures.
|
|
22
|
+
*
|
|
23
|
+
* Structured details are preserved on the instance for downstream handling.
|
|
24
|
+
*/
|
|
25
|
+
export declare class QuoteStatusGetError extends Error {
|
|
26
|
+
readonly details?: QuoteStatusGetErrorDetails;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the error is transient and the request may succeed on a retry.
|
|
29
|
+
*
|
|
30
|
+
* `true` for 5xx (server-side) HTTP errors; `false` for 4xx (client-side)
|
|
31
|
+
* errors and response-validation failures.
|
|
32
|
+
*/
|
|
33
|
+
readonly retryable: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a quote status fetch error with structured context.
|
|
36
|
+
*
|
|
37
|
+
* @param message - Human-readable error message.
|
|
38
|
+
* @param details - Structured metadata about the failed quote status fetch.
|
|
39
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
40
|
+
* @param retryable - Whether the error is transient and may resolve on retry.
|
|
41
|
+
* Defaults to `false`.
|
|
42
|
+
*/
|
|
43
|
+
constructor(message: string, details: QuoteStatusGetErrorDetails, retryable?: boolean);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC9B,oBAAgB;AAEjB;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,6BAA6B,CAAC;IAEjD;;;;;;;OAOG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B;CAMpE;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;;;;OAQG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,0BAA0B,EACnC,SAAS,UAAQ;CAQpB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { QuoteStatusGetErrorDetails, QuoteStatusUpdateErrorDetails } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown for quote status update failures.
|
|
4
|
+
*
|
|
5
|
+
* The error message is prefixed with the error type when provided, and
|
|
6
|
+
* structured details are preserved on the instance for downstream handling.
|
|
7
|
+
*/
|
|
8
|
+
export declare class QuoteStatusUpdateError extends Error {
|
|
9
|
+
readonly details?: QuoteStatusUpdateErrorDetails;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a quote status update error with structured context.
|
|
12
|
+
*
|
|
13
|
+
* @param message - Human-readable error message.
|
|
14
|
+
* @param details - Structured metadata about the failed quote update.
|
|
15
|
+
* @param details.errorType - Optional category for known update failures.
|
|
16
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
17
|
+
*/
|
|
18
|
+
constructor(message: string, details: QuoteStatusUpdateErrorDetails);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown for quote status fetch failures.
|
|
22
|
+
*
|
|
23
|
+
* Structured details are preserved on the instance for downstream handling.
|
|
24
|
+
*/
|
|
25
|
+
export declare class QuoteStatusGetError extends Error {
|
|
26
|
+
readonly details?: QuoteStatusGetErrorDetails;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the error is transient and the request may succeed on a retry.
|
|
29
|
+
*
|
|
30
|
+
* `true` for 5xx (server-side) HTTP errors; `false` for 4xx (client-side)
|
|
31
|
+
* errors and response-validation failures.
|
|
32
|
+
*/
|
|
33
|
+
readonly retryable: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a quote status fetch error with structured context.
|
|
36
|
+
*
|
|
37
|
+
* @param message - Human-readable error message.
|
|
38
|
+
* @param details - Structured metadata about the failed quote status fetch.
|
|
39
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
40
|
+
* @param retryable - Whether the error is transient and may resolve on retry.
|
|
41
|
+
* Defaults to `false`.
|
|
42
|
+
*/
|
|
43
|
+
constructor(message: string, details: QuoteStatusGetErrorDetails, retryable?: boolean);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC9B,oBAAgB;AAEjB;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,6BAA6B,CAAC;IAEjD;;;;;;;OAOG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B;CAMpE;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;;;;OAQG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,0BAA0B,EACnC,SAAS,UAAQ;CAQpB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown for quote status update failures.
|
|
3
|
+
*
|
|
4
|
+
* The error message is prefixed with the error type when provided, and
|
|
5
|
+
* structured details are preserved on the instance for downstream handling.
|
|
6
|
+
*/
|
|
7
|
+
export class QuoteStatusUpdateError extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a quote status update error with structured context.
|
|
10
|
+
*
|
|
11
|
+
* @param message - Human-readable error message.
|
|
12
|
+
* @param details - Structured metadata about the failed quote update.
|
|
13
|
+
* @param details.errorType - Optional category for known update failures.
|
|
14
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
15
|
+
*/
|
|
16
|
+
constructor(message, details) {
|
|
17
|
+
super(`${details.errorType ? `[${details.errorType}] ` : ''}${message}`);
|
|
18
|
+
this.details = details;
|
|
19
|
+
this.name = QuoteStatusUpdateError.name;
|
|
20
|
+
Object.setPrototypeOf(this, QuoteStatusUpdateError.prototype);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown for quote status fetch failures.
|
|
25
|
+
*
|
|
26
|
+
* Structured details are preserved on the instance for downstream handling.
|
|
27
|
+
*/
|
|
28
|
+
export class QuoteStatusGetError extends Error {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a quote status fetch error with structured context.
|
|
31
|
+
*
|
|
32
|
+
* @param message - Human-readable error message.
|
|
33
|
+
* @param details - Structured metadata about the failed quote status fetch.
|
|
34
|
+
* @param details.quoteId - Unique quote identifier associated with the error.
|
|
35
|
+
* @param retryable - Whether the error is transient and may resolve on retry.
|
|
36
|
+
* Defaults to `false`.
|
|
37
|
+
*/
|
|
38
|
+
constructor(message, details, retryable = false) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.details = details;
|
|
41
|
+
this.retryable = retryable;
|
|
42
|
+
this.name = QuoteStatusGetError.name;
|
|
43
|
+
Object.setPrototypeOf(this, QuoteStatusGetError.prototype);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAG/C;;;;;;;OAOG;IACH,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC;QACxC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAW5C;;;;;;;;OAQG;IACH,YACE,OAAe,EACf,OAAmC,EACnC,SAAS,GAAG,KAAK;QAEjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import {\n QuoteStatusGetErrorDetails,\n QuoteStatusUpdateErrorDetails,\n} from './types';\n\n/**\n * Error thrown for quote status update failures.\n *\n * The error message is prefixed with the error type when provided, and\n * structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusUpdateError extends Error {\n readonly details?: QuoteStatusUpdateErrorDetails;\n\n /**\n * Creates a quote status update error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote update.\n * @param details.errorType - Optional category for known update failures.\n * @param details.quoteId - Unique quote identifier associated with the error.\n */\n constructor(message: string, details: QuoteStatusUpdateErrorDetails) {\n super(`${details.errorType ? `[${details.errorType}] ` : ''}${message}`);\n this.details = details;\n this.name = QuoteStatusUpdateError.name;\n Object.setPrototypeOf(this, QuoteStatusUpdateError.prototype);\n }\n}\n\n/**\n * Error thrown for quote status fetch failures.\n *\n * Structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusGetError extends Error {\n readonly details?: QuoteStatusGetErrorDetails;\n\n /**\n * Whether the error is transient and the request may succeed on a retry.\n *\n * `true` for 5xx (server-side) HTTP errors; `false` for 4xx (client-side)\n * errors and response-validation failures.\n */\n readonly retryable: boolean;\n\n /**\n * Creates a quote status fetch error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote status fetch.\n * @param details.quoteId - Unique quote identifier associated with the error.\n * @param retryable - Whether the error is transient and may resolve on retry.\n * Defaults to `false`.\n */\n constructor(\n message: string,\n details: QuoteStatusGetErrorDetails,\n retryable = false,\n ) {\n super(message);\n this.details = details;\n this.retryable = retryable;\n this.name = QuoteStatusGetError.name;\n Object.setPrototypeOf(this, QuoteStatusGetError.prototype);\n }\n}\n"]}
|