@odatano/core 2.0.0-rc.2 → 2.0.0-rc.21
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/@cds-models/CardanoAgentService/index.d.ts +251 -0
- package/@cds-models/CardanoAgentService/index.js +36 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +139 -2
- package/@cds-models/CardanoIndexerService/index.js +18 -0
- package/@cds-models/CardanoODataService/index.d.ts +231 -6
- package/@cds-models/CardanoODataService/index.js +27 -0
- package/@cds-models/CardanoSignService/index.d.ts +5 -2
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
- package/@cds-models/odatano/cardano/index.d.ts +323 -6
- package/@cds-models/odatano/cardano/index.js +33 -0
- package/README.md +195 -136
- package/db/schema.cds +2133 -1633
- package/package.json +181 -173
- package/scripts/migrate-slot-leader.mjs +104 -0
- package/scripts/migrate-txseq.mjs +147 -0
- package/src/index.d.ts +10 -10
- package/src/index.js +24 -14
- package/src/plugin.js +39 -52
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +45 -158
- package/srv/blockchain/backends/cardano-backend.d.ts +83 -158
- package/srv/blockchain/backends/cardano-backend.js +14 -5
- package/srv/blockchain/backends/koios-backend.d.ts +126 -60
- package/srv/blockchain/backends/koios-backend.js +293 -203
- package/srv/blockchain/backends/ogmios-backend.d.ts +69 -94
- package/srv/blockchain/backends/ogmios-backend.js +319 -185
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
- package/srv/blockchain/cardano-client.d.ts +57 -204
- package/srv/blockchain/cardano-client.js +94 -226
- package/srv/blockchain/cardano-indexer.d.ts +176 -240
- package/srv/blockchain/cardano-indexer.js +615 -338
- package/srv/blockchain/cardano-tx-builder.d.ts +29 -82
- package/srv/blockchain/cardano-tx-builder.js +88 -128
- package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
- package/srv/blockchain/crawler/certificate-backfill.js +150 -0
- package/srv/blockchain/crawler/crawler.d.ts +121 -53
- package/srv/blockchain/crawler/crawler.js +403 -89
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +5 -0
- package/srv/blockchain/crawler/index.js +35 -7
- package/srv/blockchain/crawler/sync-state.d.ts +44 -28
- package/srv/blockchain/crawler/sync-state.js +115 -43
- package/srv/blockchain/crawler/utxo-set-import.d.ts +69 -0
- package/srv/blockchain/crawler/utxo-set-import.js +269 -0
- package/srv/blockchain/ledger-state.d.ts +80 -0
- package/srv/blockchain/ledger-state.js +383 -0
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -48
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +71 -160
- package/srv/blockchain/transaction-building/buildooor-tx.js +185 -260
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +42 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +39 -23
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +40 -91
- package/srv/cardano-agent-service.cds +146 -0
- package/srv/cardano-agent-service.d.ts +2 -0
- package/srv/cardano-agent-service.js +12 -0
- package/srv/cardano-indexer-service.cds +164 -73
- package/srv/cardano-indexer-service.js +156 -11
- package/srv/cardano-service.cds +45 -0
- package/srv/cardano-service.js +38 -96
- package/srv/cardano-sign-service.cds +200 -180
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +32 -26
- package/srv/cardano-tx-service.js +136 -196
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +28 -86
- package/srv/server.js +95 -128
- package/srv/utils/agent-grants-config.d.ts +37 -0
- package/srv/utils/agent-grants-config.js +138 -0
- package/srv/utils/agent-grants.d.ts +262 -0
- package/srv/utils/agent-grants.js +914 -0
- package/srv/utils/agent-token-auth.d.ts +16 -0
- package/srv/utils/agent-token-auth.js +78 -0
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +19 -68
- package/srv/utils/const.js +20 -69
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +25 -0
- package/srv/utils/db-indexes.js +93 -0
- package/srv/utils/db-sanitize.d.ts +27 -0
- package/srv/utils/db-sanitize.js +85 -0
- package/srv/utils/epoch-slots.d.ts +13 -0
- package/srv/utils/epoch-slots.js +25 -0
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +36 -179
- package/srv/utils/errors.js +62 -220
- package/srv/utils/liveness.d.ts +16 -0
- package/srv/utils/liveness.js +41 -0
- package/srv/utils/mappers.d.ts +89 -214
- package/srv/utils/mappers.js +289 -301
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +57 -0
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +46 -0
- package/srv/utils/rate-limiter.js +116 -0
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +18 -92
- package/srv/utils/tx-build-helper.js +32 -123
- package/srv/utils/tx-request-parsers.d.ts +14 -20
- package/srv/utils/tx-request-parsers.js +33 -20
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +114 -169
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +19 -89
- package/srv/utils/validators.js +31 -138
package/srv/utils/errors.d.ts
CHANGED
|
@@ -1,169 +1,68 @@
|
|
|
1
1
|
import { type ErrorCode } from './error-codes';
|
|
2
2
|
import { Request } from '@sap/cds';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
* Defines typed errors for backend communication issues
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* BackendError Base class for all backend-related errors
|
|
9
|
-
*/
|
|
3
|
+
/** Typed errors for backend communication and request validation. */
|
|
4
|
+
/** Base class for all backend-related errors. */
|
|
10
5
|
export declare class BackendError extends Error {
|
|
11
6
|
readonly statusCode: number;
|
|
12
7
|
readonly code: ErrorCode;
|
|
13
8
|
readonly backendName?: string | undefined;
|
|
14
9
|
readonly originalError?: unknown | undefined;
|
|
15
10
|
readonly target?: string | undefined;
|
|
16
|
-
/** Constructor
|
|
17
|
-
* @param message error message string
|
|
18
|
-
* @param statusCode error status code
|
|
19
|
-
* @param code error code
|
|
20
|
-
* @param backendName name of the backend where the error originated
|
|
21
|
-
* @param originalError original error object
|
|
22
|
-
* @param target target resource (if applicable)
|
|
23
|
-
*/
|
|
24
11
|
constructor(message: string, statusCode?: number, code?: ErrorCode, backendName?: string | undefined, originalError?: unknown | undefined, target?: string | undefined);
|
|
25
12
|
}
|
|
26
|
-
/**
|
|
27
|
-
* NotFoundError - Resource not found in backend (404)
|
|
28
|
-
* This is NOT a provider error - it's a valid response indicating the resource doesn't exist
|
|
29
|
-
* Examples: transaction hash not found, address has no UTxOs
|
|
30
|
-
*/
|
|
13
|
+
/** Resource not found (404); a valid response, not a provider fault. */
|
|
31
14
|
export declare class NotFoundError extends BackendError {
|
|
32
|
-
/** Constructor
|
|
33
|
-
* @param resource name of the resource that was not found
|
|
34
|
-
* @param backendName name of the backend where the error originated
|
|
35
|
-
* @param originalError original error object
|
|
36
|
-
*/
|
|
37
15
|
constructor(resource: string, backendName?: string, originalError?: unknown);
|
|
38
16
|
}
|
|
39
|
-
/**
|
|
40
|
-
* TransactionValidationError - Transaction failed validation (400)
|
|
41
|
-
* Indicates that the transaction failed validation checks
|
|
42
|
-
* Examples: wrong signature, tampered CBOR, invalid witnesses
|
|
43
|
-
*/
|
|
17
|
+
/** Transaction failed validation (400): wrong signature, tampered CBOR, invalid witnesses. `code` may be `TX_PARSE_FAILED`. */
|
|
44
18
|
export declare class TransactionValidationError extends BackendError {
|
|
45
|
-
/** Constructor
|
|
46
|
-
* @param message detailed validation failure message
|
|
47
|
-
* @param originalError original error object
|
|
48
|
-
* @param code optional override (e.g. `TX_PARSE_FAILED` for CBOR decode failures);
|
|
49
|
-
* defaults to `TX_VALIDATION_FAILED`.
|
|
50
|
-
*/
|
|
51
19
|
constructor(message: string, originalError?: unknown, code?: ErrorCode);
|
|
52
20
|
}
|
|
53
|
-
/**
|
|
54
|
-
* ScriptValidationError - Plutus script validation failed on the ledger (400)
|
|
55
|
-
* Distinguishes a clean ledger rejection (PlutusFailure, CekError, overspent
|
|
56
|
-
* budget, script hash mismatch) from provider outages (503). The transaction
|
|
57
|
-
* was well-formed enough to reach phase-2 validation — retrying against a
|
|
58
|
-
* different provider will not help; the tx shape itself is the problem.
|
|
59
|
-
*/
|
|
21
|
+
/** Ledger phase-2 script rejection (400): PlutusFailure, CekError, budget, hash mismatch. Not retryable on another provider. */
|
|
60
22
|
export declare class ScriptValidationError extends BackendError {
|
|
61
|
-
/** Constructor
|
|
62
|
-
* @param message detailed script failure message (typically from ledger)
|
|
63
|
-
* @param originalError original error object
|
|
64
|
-
*/
|
|
65
23
|
constructor(message: string, originalError?: unknown);
|
|
66
24
|
}
|
|
67
|
-
/**
|
|
68
|
-
* TransactionAlreadySubmittedError - Transaction already exists (409)
|
|
69
|
-
* Indicates that the transaction has already been submitted (duplicate/replay)
|
|
70
|
-
* Examples: same txHash already in mempool or on chain
|
|
71
|
-
*/
|
|
25
|
+
/** Transaction already in mempool or on chain (409). */
|
|
72
26
|
export declare class TransactionAlreadySubmittedError extends BackendError {
|
|
73
27
|
readonly txHash: string;
|
|
74
|
-
/** Constructor
|
|
75
|
-
* @param txHash the transaction hash that was already submitted
|
|
76
|
-
* @param originalError original error object
|
|
77
|
-
*/
|
|
78
28
|
constructor(txHash: string, originalError?: unknown);
|
|
79
29
|
}
|
|
80
30
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* Examples: trying to send more ADA than available, not enough native tokens
|
|
31
|
+
* Not enough of an asset for the transaction (400). `required`/`available` are 0n when unknown;
|
|
32
|
+
* `detail` then replaces the amounts in the message.
|
|
84
33
|
*/
|
|
85
34
|
export declare class InsufficientFundsError extends BackendError {
|
|
86
35
|
readonly assetUnit: string;
|
|
87
36
|
readonly required: bigint;
|
|
88
37
|
readonly available: bigint;
|
|
89
|
-
/** Constructor
|
|
90
|
-
* @param assetUnit the asset unit that is insufficient (e.g., "lovelace" or "policyId.assetName")
|
|
91
|
-
* @param required the required amount (0n when unknown)
|
|
92
|
-
* @param available the available amount (0n when unknown)
|
|
93
|
-
* @param originalError original error object
|
|
94
|
-
* @param detail human-readable cause shown INSTEAD of the amounts — use when
|
|
95
|
-
* the amounts are unknown; "required 0, available 0" reads as
|
|
96
|
-
* nonsense from the consumer's perspective
|
|
97
|
-
*/
|
|
98
38
|
constructor(assetUnit: string, required: bigint, available: bigint, originalError?: unknown, detail?: string);
|
|
99
39
|
}
|
|
100
|
-
/**
|
|
101
|
-
* MixedAssetsError - UTxO contains mixed assets when pure ADA is required (400)
|
|
102
|
-
* Indicates that a UTxO contains native assets in addition to ADA, but the operation requires ADA-only UTxOs
|
|
103
|
-
*/
|
|
40
|
+
/** UTxO carries native assets where ADA-only is required (400). `utxoRef` is `txHash#outputIndex`. */
|
|
104
41
|
export declare class MixedAssetsError extends BackendError {
|
|
105
42
|
readonly utxoRef: string;
|
|
106
43
|
readonly assets: string[];
|
|
107
|
-
/** Constructor
|
|
108
|
-
* @param utxoRef UTxO reference (txHash#outputIndex)
|
|
109
|
-
* @param assets list of non-ADA assets found in the UTxO
|
|
110
|
-
* @param originalError original error object
|
|
111
|
-
*/
|
|
112
44
|
constructor(utxoRef: string, assets: string[], originalError?: unknown);
|
|
113
45
|
}
|
|
114
|
-
/**
|
|
115
|
-
* ProviderUnavailableError - Provider unavailable or timeout (503)
|
|
116
|
-
* Indicates a temporary issue - retrying may help
|
|
117
|
-
* Examples: network timeout, 5xx errors, service down
|
|
118
|
-
*/
|
|
46
|
+
/** Provider unavailable or timed out (503); retryable. `timeoutMs` is appended to the message. */
|
|
119
47
|
export declare class ProviderUnavailableError extends BackendError {
|
|
120
|
-
/** Constructor
|
|
121
|
-
* @param message error message string
|
|
122
|
-
* @param backendName name of the backend where the error originated
|
|
123
|
-
* @param timeoutMs optional timeout duration in milliseconds
|
|
124
|
-
* @param originalError original error object
|
|
125
|
-
*/
|
|
126
48
|
constructor(message: string, backendName?: string, timeoutMs?: number, originalError?: unknown);
|
|
127
49
|
}
|
|
128
|
-
/**
|
|
129
|
-
* RateLimitError - Provider rate limit exceeded (429)
|
|
130
|
-
* Indicates too many requests - client should back off and retry later
|
|
131
|
-
* Examples: Blockfrost 10 req/sec limit, Koios tier limits
|
|
132
|
-
*/
|
|
50
|
+
/** Provider rate limit exceeded (429). `retryAfter` is in seconds. */
|
|
133
51
|
export declare class RateLimitError extends BackendError {
|
|
134
|
-
/** Constructor
|
|
135
|
-
* @param message error message string
|
|
136
|
-
* @param backendName name of the backend where the error originated
|
|
137
|
-
* @param retryAfter optional retry-after duration in seconds
|
|
138
|
-
* @param originalError original error object
|
|
139
|
-
*/
|
|
140
52
|
constructor(message: string, backendName?: string, retryAfter?: number, originalError?: unknown);
|
|
141
53
|
}
|
|
142
|
-
/**
|
|
143
|
-
* AllBackendsFailedError - All backends failed
|
|
144
|
-
* Aggregates multiple backend errors and returns the most relevant status
|
|
145
|
-
*/
|
|
54
|
+
/** Every backend failed; carries the last error's status, or 503 when all were skipped. */
|
|
146
55
|
export declare class AllBackendsFailedError extends BackendError {
|
|
147
56
|
readonly errors: BackendError[];
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
* @param originalError original error object
|
|
151
|
-
*/
|
|
152
|
-
constructor(errors: BackendError[], originalError?: unknown);
|
|
57
|
+
/** @param skipped why backends were not called at all, e.g. `koios: circuit open` */
|
|
58
|
+
constructor(errors: BackendError[], originalError?: unknown, skipped?: string[]);
|
|
153
59
|
}
|
|
154
60
|
/**
|
|
155
|
-
* True when the
|
|
156
|
-
*
|
|
157
|
-
* collected per-backend errors are all 404s. CardanoClient's failover wraps
|
|
158
|
-
* per-backend errors (including 404s) into AllBackendsFailedError, so callers
|
|
159
|
-
* that need "definitively not found" (e.g. the wallet-worker's dropped-tx
|
|
160
|
-
* detection) must use this instead of `instanceof NotFoundError`. A mixed
|
|
161
|
-
* result (one backend 404, another 500) is NOT proof of absence.
|
|
61
|
+
* True when the resource is absent on every consulted backend: a NotFoundError, or an
|
|
62
|
+
* AllBackendsFailedError whose per-backend errors are all 404. A mixed result is not proof of absence.
|
|
162
63
|
*/
|
|
163
64
|
export declare function isNotFoundOnAllBackends(err: unknown): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* HttpErrorLike - Simplified interface for HTTP errors from various libraries
|
|
166
|
-
*/
|
|
65
|
+
/** Simplified shape of HTTP errors from various client libraries. */
|
|
167
66
|
export interface HttpErrorLike {
|
|
168
67
|
message?: string;
|
|
169
68
|
code?: string;
|
|
@@ -181,94 +80,52 @@ export interface HttpErrorLike {
|
|
|
181
80
|
}
|
|
182
81
|
/** True when a PostgREST error body's `code` denotes a provider-side SQL fault. */
|
|
183
82
|
export declare function isPostgrestServerErrorCode(code: unknown): boolean;
|
|
184
|
-
/**
|
|
185
|
-
* Utility functions to extract status and message from HttpErrorLike
|
|
186
|
-
* @param err error object
|
|
187
|
-
* @returns {number} status code
|
|
188
|
-
*/
|
|
83
|
+
/** HTTP status of an HttpErrorLike, default 500. */
|
|
189
84
|
export declare function getErrorStatus(err: HttpErrorLike | unknown): number;
|
|
190
|
-
/**
|
|
191
|
-
* Utility functions to extract status and message from HttpErrorLike
|
|
192
|
-
* @param err error object
|
|
193
|
-
* @returns {string} error message
|
|
194
|
-
*/
|
|
85
|
+
/** Message of an HttpErrorLike: `response.data.error` (Koios), else `message`. */
|
|
195
86
|
export declare function getErrorMessage(err: HttpErrorLike | unknown): string;
|
|
196
87
|
/**
|
|
197
|
-
* Normalizes any backend error into a typed BackendError
|
|
198
|
-
*
|
|
199
|
-
* Priority (checked in order):
|
|
200
|
-
* 1. TX Submission — Already submitted/duplicate → 409
|
|
201
|
-
* 2. TX Submission — Plutus script validation failure → 400 (ScriptValidationError)
|
|
202
|
-
* 3. TX Submission — Validation/Signature errors → 400
|
|
203
|
-
* 4. Message indicates "not found" → 404 (even if provider returns 5xx)
|
|
204
|
-
* 5. Rate limiting (status 429 or message patterns) → 429
|
|
205
|
-
* 6. Explicit 404 status → 404
|
|
206
|
-
* 7. 5xx errors → 503 (Provider unavailable, retry-able)
|
|
207
|
-
* 8. Other 4xx → 503
|
|
208
|
-
* 9. Unknown/network errors → 503 (default fallback)
|
|
88
|
+
* Normalizes any backend error into a typed BackendError. Message hints are checked in priority
|
|
89
|
+
* order (already submitted, script failure, validation, not found, rate limit) before the HTTP status.
|
|
209
90
|
*/
|
|
210
91
|
export declare function normalizeBackendError(err: unknown, backendName?: string): BackendError;
|
|
211
|
-
/**
|
|
212
|
-
* HsmError - Error related to HSM operations (signing, session, key access)
|
|
213
|
-
* Indicates that the Hardware Security Module is unavailable or signing failed
|
|
214
|
-
*/
|
|
92
|
+
/** HSM operation failed (session, key access, signing). */
|
|
215
93
|
export declare class HsmError extends BackendError {
|
|
216
94
|
constructor(message: string, statusCode?: number, code?: ErrorCode, originalError?: unknown);
|
|
217
95
|
}
|
|
218
|
-
/**
|
|
219
|
-
* ConfigError - Error in configuration settings
|
|
220
|
-
* Captures configuration-related issues
|
|
221
|
-
*/
|
|
96
|
+
/** Configuration error. */
|
|
222
97
|
export declare class ConfigError extends Error {
|
|
223
98
|
constructor(message: string);
|
|
224
99
|
}
|
|
225
100
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
101
|
+
* Ogmios chain-sync frame that could not be parsed. Names the block (when readable from the raw
|
|
102
|
+
* text) so the crawler can fetch that one block through the paginating backend instead.
|
|
228
103
|
*/
|
|
104
|
+
export declare class ChainSyncFrameError extends BackendError {
|
|
105
|
+
readonly height: number | null;
|
|
106
|
+
readonly id: string | null;
|
|
107
|
+
constructor(height: number | null, id: string | null, reason: string);
|
|
108
|
+
}
|
|
109
|
+
/** A backend failed to initialize. */
|
|
229
110
|
export declare class BackendInitError extends BackendError {
|
|
230
111
|
constructor(backendName: string, originalError: unknown);
|
|
231
112
|
}
|
|
232
|
-
/**
|
|
233
|
-
* AllBackendsInitFailedError - All backends failed to initialize
|
|
234
|
-
* Aggregates multiple backend initialization errors
|
|
235
|
-
*/
|
|
113
|
+
/** Every backend failed to initialize. */
|
|
236
114
|
export declare class AllBackendsInitFailedError extends Error {
|
|
237
115
|
readonly errors: BackendInitError[];
|
|
238
116
|
constructor(errors: BackendInitError[]);
|
|
239
117
|
}
|
|
240
|
-
/**
|
|
241
|
-
* Function to reject requests with standardized error messages
|
|
242
|
-
* @param req - The incoming request
|
|
243
|
-
* @param ctx - Context string for the error
|
|
244
|
-
* @param message - Detailed error message
|
|
245
|
-
* @param target - Optional target resource
|
|
246
|
-
* @throws {BackendError} BackendError with 400 status code
|
|
247
|
-
*/
|
|
118
|
+
/** Throws a 400 INVALID_INPUT BackendError `<ctx>: <message>`. */
|
|
248
119
|
export declare function rejectInvalid(req: Request, ctx: string, message: string, target?: string): never;
|
|
249
|
-
/**
|
|
250
|
-
* Function to reject requests for missing required fields
|
|
251
|
-
* @param req - The incoming request
|
|
252
|
-
* @param ctx - Context string for the error
|
|
253
|
-
* @param field - Name of the missing field
|
|
254
|
-
* @throws {BackendError} BackendError with 400 status code
|
|
255
|
-
*/
|
|
120
|
+
/** Throws a 400 INVALID_INPUT BackendError for a missing required field. */
|
|
256
121
|
export declare function rejectMissing(req: Request, ctx: string, field: string): never;
|
|
257
|
-
/**
|
|
258
|
-
* Validation error from validators.ts
|
|
259
|
-
*/
|
|
122
|
+
/** Validation error from validators.ts */
|
|
260
123
|
interface ValidationError {
|
|
261
124
|
type: 'missing' | 'invalid';
|
|
262
125
|
field: string;
|
|
263
126
|
message: string;
|
|
264
127
|
}
|
|
265
|
-
/**
|
|
266
|
-
* Throw BackendError for the first validation error in the list
|
|
267
|
-
* @param req - The incoming request
|
|
268
|
-
* @param ctx - Context string for the error
|
|
269
|
-
* @param errors - Array of validation errors from validateTransactionInputs
|
|
270
|
-
* @throws {BackendError} if errors array is not empty
|
|
271
|
-
*/
|
|
128
|
+
/** Throws a BackendError for the first validation error, if any. */
|
|
272
129
|
export declare function throwIfValidationErrors(req: Request, ctx: string, errors: ValidationError[]): void;
|
|
273
130
|
export {};
|
|
274
131
|
//# sourceMappingURL=errors.d.ts.map
|