@odatano/core 2.0.0-rc.4 → 2.0.0-rc.40
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/CardanoBackendService/index.d.ts +357 -0
- package/@cds-models/CardanoBackendService/index.js +40 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +194 -2
- package/@cds-models/CardanoIndexerService/index.js +25 -0
- package/@cds-models/CardanoODataService/index.d.ts +305 -7
- package/@cds-models/CardanoODataService/index.js +34 -0
- package/@cds-models/CardanoSignService/index.d.ts +28 -3
- package/@cds-models/CardanoSignService/index.js +3 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +46 -13
- package/@cds-models/CardanoTransactionService/index.js +4 -0
- package/@cds-models/index.d.ts +72 -0
- package/@cds-models/index.js +12 -0
- package/@cds-models/odatano/cardano/index.d.ts +408 -7
- package/@cds-models/odatano/cardano/index.js +42 -0
- package/README.md +64 -5
- package/db/schema.cds +2297 -1633
- package/db/types.cds +114 -0
- package/package.json +27 -6
- package/scripts/migrate-slot-leader.mjs +104 -0
- package/scripts/migrate-txseq.mjs +147 -0
- package/src/index.d.ts +18 -11
- package/src/index.js +44 -14
- package/src/plugin.js +42 -52
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +53 -162
- package/srv/blockchain/backends/cardano-backend.d.ts +104 -158
- package/srv/blockchain/backends/cardano-backend.js +19 -5
- package/srv/blockchain/backends/koios-backend.d.ts +126 -60
- package/srv/blockchain/backends/koios-backend.js +376 -235
- package/srv/blockchain/backends/odatano-backend.d.ts +64 -0
- package/srv/blockchain/backends/odatano-backend.js +170 -0
- package/srv/blockchain/backends/ogmios-backend.d.ts +162 -94
- package/srv/blockchain/backends/ogmios-backend.js +556 -201
- 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 +87 -202
- package/srv/blockchain/cardano-client.js +210 -240
- package/srv/blockchain/cardano-indexer.d.ts +311 -242
- package/srv/blockchain/cardano-indexer.js +1238 -362
- package/srv/blockchain/cardano-tx-builder.d.ts +44 -81
- package/srv/blockchain/cardano-tx-builder.js +173 -132
- package/srv/blockchain/crawler/certificate-backfill.d.ts +67 -0
- package/srv/blockchain/crawler/certificate-backfill.js +169 -0
- package/srv/blockchain/crawler/crawler.d.ts +139 -54
- package/srv/blockchain/crawler/crawler.js +478 -96
- 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 +46 -28
- package/srv/blockchain/crawler/sync-state.js +128 -43
- package/srv/blockchain/crawler/transaction-backfill.d.ts +52 -0
- package/srv/blockchain/crawler/transaction-backfill.js +283 -0
- package/srv/blockchain/crawler/utxo-set-import.d.ts +78 -0
- package/srv/blockchain/crawler/utxo-set-import.js +363 -0
- package/srv/blockchain/ledger-state.d.ts +101 -0
- package/srv/blockchain/ledger-state.js +432 -0
- package/srv/blockchain/pending-spends.d.ts +28 -0
- package/srv/blockchain/pending-spends.js +89 -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 +14 -45
- package/srv/blockchain/signing/signature-verifier.js +73 -76
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -49
- package/srv/blockchain/stored-chain.d.ts +33 -0
- package/srv/blockchain/stored-chain.js +234 -0
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +111 -173
- package/srv/blockchain/transaction-building/buildooor-tx.js +649 -326
- package/srv/blockchain/transaction-building/caller-datums.d.ts +29 -0
- package/srv/blockchain/transaction-building/caller-datums.js +139 -0
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +10 -35
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +43 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +18 -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-backend-service.cds +52 -0
- package/srv/cardano-backend-service.d.ts +2 -0
- package/srv/cardano-backend-service.js +244 -0
- package/srv/cardano-indexer-service.cds +201 -73
- package/srv/cardano-indexer-service.js +280 -11
- package/srv/cardano-service.cds +65 -2
- package/srv/cardano-service.js +170 -129
- package/srv/cardano-sign-service.cds +200 -180
- package/srv/cardano-sign-service.js +57 -184
- package/srv/cardano-tx-service.cds +439 -370
- package/srv/cardano-tx-service.js +231 -190
- package/srv/cardano-ui.cds +16 -16
- package/srv/cardano-worker-service.js +7 -15
- package/srv/cbor/index.d.ts +1 -1
- package/srv/cbor/parse.d.ts +27 -0
- package/srv/cbor/parse.js +63 -2
- package/srv/server.d.ts +28 -86
- package/srv/server.js +132 -135
- 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 +922 -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 +30 -67
- package/srv/utils/const.js +32 -72
- 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 +94 -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 +20 -0
- package/srv/utils/epoch-slots.js +43 -0
- package/srv/utils/error-codes.d.ts +20 -73
- package/srv/utils/error-codes.js +19 -70
- package/srv/utils/errors.d.ts +50 -177
- package/srv/utils/errors.js +94 -218
- package/srv/utils/legacy-service-paths.d.ts +11 -0
- package/srv/utils/legacy-service-paths.js +58 -0
- package/srv/utils/liveness.d.ts +16 -0
- package/srv/utils/liveness.js +40 -0
- package/srv/utils/mappers.d.ts +128 -214
- package/srv/utils/mappers.js +354 -299
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-inline-json.d.ts +8 -0
- package/srv/utils/pg-inline-json.js +62 -0
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +56 -0
- package/srv/utils/plutus-placeholders.d.ts +23 -16
- package/srv/utils/plutus-placeholders.js +63 -27
- 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 +6 -16
- package/srv/utils/signing-helper.js +36 -60
- package/srv/utils/tx-build-helper.d.ts +28 -93
- package/srv/utils/tx-build-helper.js +75 -124
- package/srv/utils/tx-request-parsers.d.ts +101 -28
- package/srv/utils/tx-request-parsers.js +410 -43
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +252 -179
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +24 -90
- package/srv/utils/validators.js +50 -147
package/srv/utils/errors.d.ts
CHANGED
|
@@ -1,169 +1,75 @@
|
|
|
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
25
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Examples: same txHash already in mempool or on chain
|
|
26
|
+
* A crawler cursor block this instance does not follow (409). A 4xx keeps its message in production,
|
|
27
|
+
* so a remote crawler receives the `CHAIN_POINT_MISMATCH:` marker it recovers on.
|
|
71
28
|
*/
|
|
29
|
+
export declare class ChainPointMismatchError extends BackendError {
|
|
30
|
+
constructor(message: string, backendName?: string);
|
|
31
|
+
}
|
|
32
|
+
/** Transaction already in mempool or on chain (409). */
|
|
72
33
|
export declare class TransactionAlreadySubmittedError extends BackendError {
|
|
73
34
|
readonly txHash: string;
|
|
74
|
-
/** Constructor
|
|
75
|
-
* @param txHash the transaction hash that was already submitted
|
|
76
|
-
* @param originalError original error object
|
|
77
|
-
*/
|
|
78
35
|
constructor(txHash: string, originalError?: unknown);
|
|
79
36
|
}
|
|
80
37
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* Examples: trying to send more ADA than available, not enough native tokens
|
|
38
|
+
* Not enough of an asset for the transaction (400). `required`/`available` are 0n when unknown;
|
|
39
|
+
* `detail` then replaces the amounts in the message.
|
|
84
40
|
*/
|
|
85
41
|
export declare class InsufficientFundsError extends BackendError {
|
|
86
42
|
readonly assetUnit: string;
|
|
87
43
|
readonly required: bigint;
|
|
88
44
|
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
45
|
constructor(assetUnit: string, required: bigint, available: bigint, originalError?: unknown, detail?: string);
|
|
99
46
|
}
|
|
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
|
-
*/
|
|
47
|
+
/** UTxO carries native assets where ADA-only is required (400). `utxoRef` is `txHash#outputIndex`. */
|
|
104
48
|
export declare class MixedAssetsError extends BackendError {
|
|
105
49
|
readonly utxoRef: string;
|
|
106
50
|
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
51
|
constructor(utxoRef: string, assets: string[], originalError?: unknown);
|
|
113
52
|
}
|
|
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
|
-
*/
|
|
53
|
+
/** Provider unavailable or timed out (503); retryable. `timeoutMs` is appended to the message. */
|
|
119
54
|
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
55
|
constructor(message: string, backendName?: string, timeoutMs?: number, originalError?: unknown);
|
|
127
56
|
}
|
|
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
|
-
*/
|
|
57
|
+
/** Provider rate limit exceeded (429). `retryAfter` is in seconds. */
|
|
133
58
|
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
59
|
constructor(message: string, backendName?: string, retryAfter?: number, originalError?: unknown);
|
|
141
60
|
}
|
|
142
|
-
/**
|
|
143
|
-
* AllBackendsFailedError - All backends failed
|
|
144
|
-
* Aggregates multiple backend errors and returns the most relevant status
|
|
145
|
-
*/
|
|
61
|
+
/** Every backend failed; carries the last error's status, or 503 when all were skipped. */
|
|
146
62
|
export declare class AllBackendsFailedError extends BackendError {
|
|
147
63
|
readonly errors: BackendError[];
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
* @param originalError original error object
|
|
151
|
-
*/
|
|
152
|
-
constructor(errors: BackendError[], originalError?: unknown);
|
|
64
|
+
/** @param skipped why backends were not called at all, e.g. `koios: circuit open` */
|
|
65
|
+
constructor(errors: BackendError[], originalError?: unknown, skipped?: string[]);
|
|
153
66
|
}
|
|
154
67
|
/**
|
|
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.
|
|
68
|
+
* True when the resource is absent on every consulted backend: a NotFoundError, or an
|
|
69
|
+
* AllBackendsFailedError whose per-backend errors are all 404. A mixed result is not proof of absence.
|
|
162
70
|
*/
|
|
163
71
|
export declare function isNotFoundOnAllBackends(err: unknown): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* HttpErrorLike - Simplified interface for HTTP errors from various libraries
|
|
166
|
-
*/
|
|
72
|
+
/** Simplified shape of HTTP errors from various client libraries. */
|
|
167
73
|
export interface HttpErrorLike {
|
|
168
74
|
message?: string;
|
|
169
75
|
code?: string;
|
|
@@ -181,94 +87,61 @@ export interface HttpErrorLike {
|
|
|
181
87
|
}
|
|
182
88
|
/** True when a PostgREST error body's `code` denotes a provider-side SQL fault. */
|
|
183
89
|
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
|
-
*/
|
|
90
|
+
/** HTTP status of an HttpErrorLike, default 500. */
|
|
189
91
|
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
|
-
*/
|
|
92
|
+
/** Message of an HttpErrorLike: `response.data.error` (Koios), else `message`. */
|
|
195
93
|
export declare function getErrorMessage(err: HttpErrorLike | unknown): string;
|
|
196
94
|
/**
|
|
197
|
-
* Normalizes any backend error into a typed BackendError
|
|
198
|
-
*
|
|
199
|
-
*
|
|
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)
|
|
95
|
+
* Normalizes any backend error into a typed BackendError. An Ogmios script failure is recognised
|
|
96
|
+
* by its JSON-RPC code. Message hints are then checked in priority
|
|
97
|
+
* order (already submitted, script failure, validation, not found, rate limit) before the HTTP status.
|
|
209
98
|
*/
|
|
210
99
|
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
|
-
*/
|
|
100
|
+
/** HSM operation failed (session, key access, signing). */
|
|
215
101
|
export declare class HsmError extends BackendError {
|
|
216
102
|
constructor(message: string, statusCode?: number, code?: ErrorCode, originalError?: unknown);
|
|
217
103
|
}
|
|
218
|
-
/**
|
|
219
|
-
* ConfigError - Error in configuration settings
|
|
220
|
-
* Captures configuration-related issues
|
|
221
|
-
*/
|
|
104
|
+
/** Configuration error. */
|
|
222
105
|
export declare class ConfigError extends Error {
|
|
223
106
|
constructor(message: string);
|
|
224
107
|
}
|
|
225
108
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
109
|
+
* Ogmios chain-sync frame that could not be parsed. Names the block (when readable from the raw
|
|
110
|
+
* text) so the crawler can fetch that one block through the paginating backend instead.
|
|
228
111
|
*/
|
|
112
|
+
/** The Ogmios chain-sync socket closed without being asked to (server-side failure or restart). */
|
|
113
|
+
export declare class ChainSyncClosedError extends ProviderUnavailableError {
|
|
114
|
+
}
|
|
115
|
+
/** Chain-sync closed before delivering block `height`; the crawler fetches it over pagination. */
|
|
116
|
+
export declare class ChainSyncStalledError extends BackendError {
|
|
117
|
+
readonly height: number;
|
|
118
|
+
constructor(height: number, reason: string);
|
|
119
|
+
}
|
|
120
|
+
export declare class ChainSyncFrameError extends BackendError {
|
|
121
|
+
readonly height: number | null;
|
|
122
|
+
readonly id: string | null;
|
|
123
|
+
constructor(height: number | null, id: string | null, reason: string);
|
|
124
|
+
}
|
|
125
|
+
/** A backend failed to initialize. */
|
|
229
126
|
export declare class BackendInitError extends BackendError {
|
|
230
127
|
constructor(backendName: string, originalError: unknown);
|
|
231
128
|
}
|
|
232
|
-
/**
|
|
233
|
-
* AllBackendsInitFailedError - All backends failed to initialize
|
|
234
|
-
* Aggregates multiple backend initialization errors
|
|
235
|
-
*/
|
|
129
|
+
/** Every backend failed to initialize. */
|
|
236
130
|
export declare class AllBackendsInitFailedError extends Error {
|
|
237
131
|
readonly errors: BackendInitError[];
|
|
238
132
|
constructor(errors: BackendInitError[]);
|
|
239
133
|
}
|
|
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
|
-
*/
|
|
134
|
+
/** Throws a 400 INVALID_INPUT BackendError `<ctx>: <message>`. */
|
|
248
135
|
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
|
-
*/
|
|
136
|
+
/** Throws a 400 INVALID_INPUT BackendError for a missing required field. */
|
|
256
137
|
export declare function rejectMissing(req: Request, ctx: string, field: string): never;
|
|
257
|
-
/**
|
|
258
|
-
* Validation error from validators.ts
|
|
259
|
-
*/
|
|
138
|
+
/** Validation error from validators.ts */
|
|
260
139
|
interface ValidationError {
|
|
261
140
|
type: 'missing' | 'invalid';
|
|
262
141
|
field: string;
|
|
263
142
|
message: string;
|
|
264
143
|
}
|
|
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
|
-
*/
|
|
144
|
+
/** Throws a BackendError for the first validation error, if any. */
|
|
272
145
|
export declare function throwIfValidationErrors(req: Request, ctx: string, errors: ValidationError[]): void;
|
|
273
146
|
export {};
|
|
274
147
|
//# sourceMappingURL=errors.d.ts.map
|