@odatano/core 2.0.0-rc.5 → 2.0.0-rc.50
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 +99 -51
- package/@cds-models/CardanoAgentService/index.js +15 -0
- package/@cds-models/CardanoBackendService/index.d.ts +347 -0
- package/@cds-models/CardanoBackendService/index.js +40 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +496 -11
- package/@cds-models/CardanoIndexerService/index.js +64 -0
- package/@cds-models/CardanoODataService/index.d.ts +414 -57
- package/@cds-models/CardanoODataService/index.js +42 -0
- package/@cds-models/CardanoSignService/index.d.ts +32 -19
- package/@cds-models/CardanoSignService/index.js +3 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +58 -44
- package/@cds-models/CardanoTransactionService/index.js +4 -0
- package/@cds-models/CardanoWorkerService/index.d.ts +7 -22
- package/@cds-models/index.d.ts +101 -1
- package/@cds-models/index.js +16 -1
- package/@cds-models/odatano/cardano/index.d.ts +437 -32
- package/@cds-models/odatano/cardano/index.js +48 -0
- package/README.md +207 -167
- package/db/schema.cds +2402 -1705
- package/db/types.cds +446 -295
- package/package.json +41 -16
- package/scripts/migrate-schema.mjs +334 -0
- package/scripts/migrate-slot-leader.mjs +96 -0
- package/src/index.d.ts +20 -21
- package/src/index.js +45 -31
- package/src/plugin.js +17 -35
- package/srv/blockchain/asset-decimals.d.ts +7 -0
- package/srv/blockchain/asset-decimals.js +91 -0
- package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -135
- package/srv/blockchain/backends/blockfrost-backend.js +66 -172
- package/srv/blockchain/backends/cardano-backend.d.ts +94 -186
- package/srv/blockchain/backends/cardano-backend.js +29 -5
- package/srv/blockchain/backends/koios-backend.d.ts +103 -168
- package/srv/blockchain/backends/koios-backend.js +428 -360
- package/srv/blockchain/backends/odatano-backend.d.ts +54 -0
- package/srv/blockchain/backends/odatano-backend.js +169 -0
- package/srv/blockchain/backends/ogmios-backend.d.ts +123 -190
- package/srv/blockchain/backends/ogmios-backend.js +637 -315
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
- package/srv/blockchain/cardano-client.d.ts +61 -241
- package/srv/blockchain/cardano-client.js +253 -293
- package/srv/blockchain/cardano-indexer.d.ts +282 -281
- package/srv/blockchain/cardano-indexer.js +1551 -484
- package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
- package/srv/blockchain/cardano-tx-builder.js +164 -140
- package/srv/blockchain/circuit-breaker.d.ts +1 -13
- package/srv/blockchain/circuit-breaker.js +5 -15
- package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
- package/srv/blockchain/crawler/account-snapshots.js +153 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +43 -0
- package/srv/blockchain/crawler/asset-registry-backfill.js +153 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +52 -0
- package/srv/blockchain/crawler/certificate-backfill.js +162 -0
- package/srv/blockchain/crawler/crawler.d.ts +104 -81
- package/srv/blockchain/crawler/crawler.js +532 -160
- package/srv/blockchain/crawler/credential-backfill.d.ts +28 -0
- package/srv/blockchain/crawler/credential-backfill.js +124 -0
- package/srv/blockchain/crawler/hooks.d.ts +2 -17
- package/srv/blockchain/crawler/index.d.ts +1 -8
- package/srv/blockchain/crawler/index.js +31 -17
- package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
- package/srv/blockchain/crawler/input-asset-copies.js +171 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
- package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
- package/srv/blockchain/crawler/sync-state.d.ts +27 -47
- package/srv/blockchain/crawler/sync-state.js +113 -63
- package/srv/blockchain/crawler/transaction-backfill.d.ts +44 -0
- package/srv/blockchain/crawler/transaction-backfill.js +278 -0
- package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
- package/srv/blockchain/crawler/utxo-set-import.js +399 -0
- package/srv/blockchain/ledger-state.d.ts +62 -0
- package/srv/blockchain/ledger-state.js +419 -0
- package/srv/blockchain/pending-spends.d.ts +16 -0
- package/srv/blockchain/pending-spends.js +81 -0
- package/srv/blockchain/pool-metadata.d.ts +15 -0
- package/srv/blockchain/pool-metadata.js +132 -0
- package/srv/blockchain/request-coalescer.d.ts +2 -16
- package/srv/blockchain/request-coalescer.js +2 -16
- package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
- package/srv/blockchain/signing/cose-verifier.js +146 -70
- package/srv/blockchain/signing/external-signer.d.ts +15 -115
- package/srv/blockchain/signing/external-signer.js +17 -126
- package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
- package/srv/blockchain/signing/hsm-signer.js +28 -79
- package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
- package/srv/blockchain/signing/signature-verifier.js +70 -83
- package/srv/blockchain/signing/submission-finalizer.d.ts +23 -45
- package/srv/blockchain/signing/submission-finalizer.js +219 -86
- package/srv/blockchain/stored-chain.d.ts +20 -0
- package/srv/blockchain/stored-chain.js +237 -0
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
- package/srv/blockchain/transaction-building/buildooor-tx.js +652 -416
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
- package/srv/blockchain/transaction-presence.d.ts +5 -0
- package/srv/blockchain/transaction-presence.js +29 -0
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +44 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +5 -20
- package/srv/blockchain/wallet-worker/build-request.js +47 -30
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -46
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +25 -45
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -11
- package/srv/blockchain/wallet-worker/job-store.d.ts +30 -148
- package/srv/blockchain/wallet-worker/job-store.js +101 -201
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
- package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
- package/srv/blockchain/wallet-worker/signers.js +4 -12
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +8 -80
- package/srv/blockchain/wallet-worker/wallet-worker.js +107 -155
- package/srv/cardano-agent-service.cds +122 -84
- package/srv/cardano-agent-service.js +4 -9
- package/srv/cardano-backend-service.cds +78 -0
- package/srv/cardano-backend-service.d.ts +2 -0
- package/srv/cardano-backend-service.js +242 -0
- package/srv/cardano-indexer-service.cds +387 -73
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +532 -16
- package/srv/cardano-service.cds +424 -269
- package/srv/cardano-service.js +289 -201
- package/srv/cardano-sign-service.cds +201 -180
- package/srv/cardano-sign-service.js +71 -201
- package/srv/cardano-tx-service.cds +451 -370
- package/srv/cardano-tx-service.js +271 -289
- package/srv/cardano-ui.cds +16 -16
- package/srv/cardano-worker-service.cds +118 -125
- package/srv/cardano-worker-service.js +52 -61
- package/srv/cbor/cip68.d.ts +13 -0
- package/srv/cbor/cip68.js +56 -0
- package/srv/cbor/index.d.ts +3 -1
- package/srv/cbor/index.js +9 -1
- package/srv/cbor/parse.d.ts +30 -18
- package/srv/cbor/parse.js +44 -9
- package/srv/cbor/plutus-data-json.d.ts +20 -0
- package/srv/cbor/plutus-data-json.js +32 -0
- package/srv/config.d.ts +113 -0
- package/srv/config.js +409 -0
- package/srv/server.d.ts +15 -110
- package/srv/server.js +84 -404
- package/srv/utils/agent-access.d.ts +9 -0
- package/srv/utils/agent-access.js +67 -0
- package/srv/utils/agent-grants-config.d.ts +0 -46
- package/srv/utils/agent-grants-config.js +17 -85
- package/srv/utils/agent-grants.d.ts +106 -122
- package/srv/utils/agent-grants.js +538 -236
- package/srv/utils/agent-token-auth.d.ts +4 -99
- package/srv/utils/agent-token-auth.js +18 -182
- package/srv/utils/backend-request-handler.d.ts +3 -17
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +3 -10
- package/srv/utils/collections.js +3 -10
- package/srv/utils/const.d.ts +23 -74
- package/srv/utils/const.js +32 -79
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +6 -21
- package/srv/utils/db-indexes.d.ts +27 -0
- package/srv/utils/db-indexes.js +120 -0
- package/srv/utils/db-sanitize.d.ts +20 -0
- package/srv/utils/db-sanitize.js +80 -0
- package/srv/utils/deep-json.d.ts +6 -0
- package/srv/utils/deep-json.js +240 -0
- package/srv/utils/epoch-slots.d.ts +13 -0
- package/srv/utils/epoch-slots.js +38 -0
- package/srv/utils/error-codes.d.ts +22 -75
- package/srv/utils/error-codes.js +23 -72
- package/srv/utils/errors.d.ts +46 -187
- package/srv/utils/errors.js +114 -230
- package/srv/utils/liveness.d.ts +12 -0
- package/srv/utils/liveness.js +35 -0
- package/srv/utils/mappers.d.ts +102 -223
- package/srv/utils/mappers.js +387 -316
- package/srv/utils/network-context.js +2 -13
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.d.ts +8 -0
- package/srv/utils/pg-inline-json.js +58 -0
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +54 -0
- package/srv/utils/plutus-placeholders.d.ts +16 -22
- package/srv/utils/plutus-placeholders.js +62 -33
- package/srv/utils/rate-limiter.d.ts +2 -21
- package/srv/utils/rate-limiter.js +5 -17
- package/srv/utils/readiness.d.ts +12 -0
- package/srv/utils/readiness.js +29 -0
- package/srv/utils/reference-script.d.ts +19 -0
- package/srv/utils/reference-script.js +84 -0
- package/srv/utils/result-numbers.d.ts +15 -0
- package/srv/utils/result-numbers.js +61 -0
- package/srv/utils/service-events.d.ts +0 -24
- package/srv/utils/service-events.js +3 -25
- package/srv/utils/signing-helper.d.ts +3 -20
- package/srv/utils/signing-helper.js +35 -64
- package/srv/utils/tx-build-helper.d.ts +10 -105
- package/srv/utils/tx-build-helper.js +81 -144
- package/srv/utils/tx-request-parsers.d.ts +82 -33
- package/srv/utils/tx-request-parsers.js +401 -49
- package/srv/utils/tx-utils.d.ts +3 -27
- package/srv/utils/tx-utils.js +32 -50
- package/srv/utils/types.d.ts +261 -191
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +22 -92
- package/srv/utils/validators.js +50 -149
package/srv/utils/errors.d.ts
CHANGED
|
@@ -1,169 +1,69 @@
|
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*/
|
|
25
|
+
export declare class ChainPointMismatchError extends BackendError {
|
|
26
|
+
constructor(message: string, backendName?: string);
|
|
27
|
+
}
|
|
28
|
+
/** Transaction already in mempool or on chain (409). */
|
|
72
29
|
export declare class TransactionAlreadySubmittedError extends BackendError {
|
|
73
30
|
readonly txHash: string;
|
|
74
|
-
/** Constructor
|
|
75
|
-
* @param txHash the transaction hash that was already submitted
|
|
76
|
-
* @param originalError original error object
|
|
77
|
-
*/
|
|
78
31
|
constructor(txHash: string, originalError?: unknown);
|
|
79
32
|
}
|
|
80
|
-
/**
|
|
81
|
-
* InsufficientFundsError - Not enough funds or assets available (400)
|
|
82
|
-
* Indicates that the address does not have enough of a specific asset to complete the transaction
|
|
83
|
-
* Examples: trying to send more ADA than available, not enough native tokens
|
|
84
|
-
*/
|
|
85
33
|
export declare class InsufficientFundsError extends BackendError {
|
|
86
34
|
readonly assetUnit: string;
|
|
87
35
|
readonly required: bigint;
|
|
88
36
|
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
37
|
constructor(assetUnit: string, required: bigint, available: bigint, originalError?: unknown, detail?: string);
|
|
99
38
|
}
|
|
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
|
-
*/
|
|
39
|
+
/** UTxO carries native assets where ADA-only is required (400). `utxoRef` is `txHash#outputIndex`. */
|
|
104
40
|
export declare class MixedAssetsError extends BackendError {
|
|
105
41
|
readonly utxoRef: string;
|
|
106
42
|
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
43
|
constructor(utxoRef: string, assets: string[], originalError?: unknown);
|
|
113
44
|
}
|
|
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
|
-
*/
|
|
45
|
+
/** Provider unavailable or timed out (503); retryable. `timeoutMs` is appended to the message. */
|
|
119
46
|
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
47
|
constructor(message: string, backendName?: string, timeoutMs?: number, originalError?: unknown);
|
|
127
48
|
}
|
|
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
|
-
*/
|
|
49
|
+
/** Provider rate limit exceeded (429). `retryAfter` is in seconds. */
|
|
133
50
|
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
51
|
constructor(message: string, backendName?: string, retryAfter?: number, originalError?: unknown);
|
|
141
52
|
}
|
|
142
|
-
/**
|
|
143
|
-
* AllBackendsFailedError - All backends failed
|
|
144
|
-
* Aggregates multiple backend errors and returns the most relevant status
|
|
145
|
-
*/
|
|
53
|
+
/** Every backend failed; carries the last error's status, or 503 when all were skipped. */
|
|
146
54
|
export declare class AllBackendsFailedError extends BackendError {
|
|
147
55
|
readonly errors: BackendError[];
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
* @param originalError original error object
|
|
151
|
-
*/
|
|
152
|
-
constructor(errors: BackendError[], originalError?: unknown);
|
|
56
|
+
/** @param skipped why backends were not called at all, e.g. `koios: circuit open` */
|
|
57
|
+
constructor(errors: BackendError[], originalError?: unknown, skipped?: string[]);
|
|
153
58
|
}
|
|
154
|
-
/**
|
|
155
|
-
* True when the error proves the resource is absent on EVERY backend that was
|
|
156
|
-
* consulted: either a direct NotFoundError, or an AllBackendsFailedError whose
|
|
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.
|
|
162
|
-
*/
|
|
163
59
|
export declare function isNotFoundOnAllBackends(err: unknown): boolean;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
60
|
+
export declare function isSubmitRejection(err: unknown): boolean;
|
|
61
|
+
/** A submit failed without a verdict (503). The record stays open and the server keeps resolving it. */
|
|
62
|
+
export declare class SubmitOutcomeUnknownError extends BackendError {
|
|
63
|
+
readonly txHash: string;
|
|
64
|
+
constructor(txHash: string, originalError?: unknown);
|
|
65
|
+
}
|
|
66
|
+
/** Simplified shape of HTTP errors from various client libraries. */
|
|
167
67
|
export interface HttpErrorLike {
|
|
168
68
|
message?: string;
|
|
169
69
|
code?: string;
|
|
@@ -181,94 +81,53 @@ export interface HttpErrorLike {
|
|
|
181
81
|
}
|
|
182
82
|
/** True when a PostgREST error body's `code` denotes a provider-side SQL fault. */
|
|
183
83
|
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
|
-
*/
|
|
84
|
+
/** HTTP status of an HttpErrorLike, default 500. */
|
|
189
85
|
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
|
-
*/
|
|
86
|
+
/** Message of an HttpErrorLike: `response.data.error` (Koios), else `message`. */
|
|
195
87
|
export declare function getErrorMessage(err: HttpErrorLike | unknown): string;
|
|
196
|
-
/**
|
|
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)
|
|
209
|
-
*/
|
|
210
88
|
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
|
-
*/
|
|
89
|
+
/** HSM operation failed (session, key access, signing). */
|
|
215
90
|
export declare class HsmError extends BackendError {
|
|
216
91
|
constructor(message: string, statusCode?: number, code?: ErrorCode, originalError?: unknown);
|
|
217
92
|
}
|
|
218
|
-
/**
|
|
219
|
-
* ConfigError - Error in configuration settings
|
|
220
|
-
* Captures configuration-related issues
|
|
221
|
-
*/
|
|
93
|
+
/** Configuration error. */
|
|
222
94
|
export declare class ConfigError extends Error {
|
|
223
95
|
constructor(message: string);
|
|
224
96
|
}
|
|
225
|
-
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
*/
|
|
97
|
+
/** The Ogmios chain-sync socket closed without being asked to. */
|
|
98
|
+
export declare class ChainSyncClosedError extends ProviderUnavailableError {
|
|
99
|
+
}
|
|
100
|
+
/** Chain-sync closed before delivering block `height`; the crawler fetches it over pagination. */
|
|
101
|
+
export declare class ChainSyncStalledError extends BackendError {
|
|
102
|
+
readonly height: number;
|
|
103
|
+
constructor(height: number, reason: string);
|
|
104
|
+
}
|
|
105
|
+
/** Unparsable chain-sync frame. Names the block when readable, so the crawler can fetch it by pagination. */
|
|
106
|
+
export declare class ChainSyncFrameError extends BackendError {
|
|
107
|
+
readonly height: number | null;
|
|
108
|
+
readonly id: string | null;
|
|
109
|
+
constructor(height: number | null, id: string | null, reason: string);
|
|
110
|
+
}
|
|
111
|
+
/** A backend failed to initialize. */
|
|
229
112
|
export declare class BackendInitError extends BackendError {
|
|
230
113
|
constructor(backendName: string, originalError: unknown);
|
|
231
114
|
}
|
|
232
|
-
/**
|
|
233
|
-
* AllBackendsInitFailedError - All backends failed to initialize
|
|
234
|
-
* Aggregates multiple backend initialization errors
|
|
235
|
-
*/
|
|
115
|
+
/** Every backend failed to initialize. */
|
|
236
116
|
export declare class AllBackendsInitFailedError extends Error {
|
|
237
117
|
readonly errors: BackendInitError[];
|
|
238
118
|
constructor(errors: BackendInitError[]);
|
|
239
119
|
}
|
|
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
|
-
*/
|
|
120
|
+
/** Throws a 400 INVALID_INPUT BackendError `<ctx>: <message>`. */
|
|
248
121
|
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
|
-
*/
|
|
122
|
+
/** Throws a 400 INVALID_INPUT BackendError for a missing required field. */
|
|
256
123
|
export declare function rejectMissing(req: Request, ctx: string, field: string): never;
|
|
257
|
-
/**
|
|
258
|
-
* Validation error from validators.ts
|
|
259
|
-
*/
|
|
124
|
+
/** Validation error from validators.ts */
|
|
260
125
|
interface ValidationError {
|
|
261
126
|
type: 'missing' | 'invalid';
|
|
262
127
|
field: string;
|
|
263
128
|
message: string;
|
|
264
129
|
}
|
|
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
|
-
*/
|
|
130
|
+
/** Throws a BackendError for the first validation error, if any. */
|
|
272
131
|
export declare function throwIfValidationErrors(req: Request, ctx: string, errors: ValidationError[]): void;
|
|
273
132
|
export {};
|
|
274
133
|
//# sourceMappingURL=errors.d.ts.map
|