@odatano/core 2.0.0-rc.5 → 2.0.0-rc.51

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.
Files changed (239) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +99 -51
  2. package/@cds-models/CardanoAgentService/index.js +15 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +358 -0
  4. package/@cds-models/CardanoBackendService/index.js +41 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +594 -11
  6. package/@cds-models/CardanoIndexerService/index.js +74 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +417 -57
  8. package/@cds-models/CardanoODataService/index.js +42 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +45 -19
  10. package/@cds-models/CardanoSignService/index.js +4 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +70 -44
  12. package/@cds-models/CardanoTransactionService/index.js +5 -0
  13. package/@cds-models/CardanoWorkerService/index.d.ts +35 -22
  14. package/@cds-models/CardanoWorkerService/index.js +2 -0
  15. package/@cds-models/index.d.ts +114 -4
  16. package/@cds-models/index.js +20 -4
  17. package/@cds-models/odatano/cardano/index.d.ts +451 -32
  18. package/@cds-models/odatano/cardano/index.js +48 -0
  19. package/README.md +103 -167
  20. package/db/schema.cds +2455 -1705
  21. package/db/types.cds +456 -295
  22. package/package.json +41 -53
  23. package/scripts/deploy-schema.mjs +113 -0
  24. package/scripts/migrate-schema.mjs +528 -0
  25. package/scripts/migrate-slot-leader.mjs +96 -0
  26. package/src/index.d.ts +20 -21
  27. package/src/index.js +45 -31
  28. package/src/plugin.js +17 -35
  29. package/srv/blockchain/asset-decimals.d.ts +7 -0
  30. package/srv/blockchain/asset-decimals.js +91 -0
  31. package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -137
  32. package/srv/blockchain/backends/blockfrost-backend.js +125 -215
  33. package/srv/blockchain/backends/call-signal.d.ts +7 -0
  34. package/srv/blockchain/backends/call-signal.js +22 -0
  35. package/srv/blockchain/backends/cardano-backend.d.ts +100 -189
  36. package/srv/blockchain/backends/cardano-backend.js +29 -5
  37. package/srv/blockchain/backends/koios-backend.d.ts +108 -170
  38. package/srv/blockchain/backends/koios-backend.js +488 -482
  39. package/srv/blockchain/backends/odatano-backend.d.ts +55 -0
  40. package/srv/blockchain/backends/odatano-backend.js +211 -0
  41. package/srv/blockchain/backends/ogmios-backend.d.ts +122 -190
  42. package/srv/blockchain/backends/ogmios-backend.js +683 -327
  43. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
  44. package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
  45. package/srv/blockchain/cardano-client.d.ts +71 -241
  46. package/srv/blockchain/cardano-client.js +354 -322
  47. package/srv/blockchain/cardano-indexer.d.ts +295 -283
  48. package/srv/blockchain/cardano-indexer.js +1690 -502
  49. package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
  50. package/srv/blockchain/cardano-tx-builder.js +164 -140
  51. package/srv/blockchain/circuit-breaker.d.ts +2 -13
  52. package/srv/blockchain/circuit-breaker.js +11 -15
  53. package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
  54. package/srv/blockchain/crawler/account-snapshots.js +173 -0
  55. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +17 -0
  56. package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
  57. package/srv/blockchain/crawler/asset-registry-backfill.d.ts +46 -0
  58. package/srv/blockchain/crawler/asset-registry-backfill.js +157 -0
  59. package/srv/blockchain/crawler/asset-slice-backfill.d.ts +35 -0
  60. package/srv/blockchain/crawler/asset-slice-backfill.js +149 -0
  61. package/srv/blockchain/crawler/certificate-backfill.d.ts +56 -0
  62. package/srv/blockchain/crawler/certificate-backfill.js +174 -0
  63. package/srv/blockchain/crawler/crawler.d.ts +125 -81
  64. package/srv/blockchain/crawler/crawler.js +738 -167
  65. package/srv/blockchain/crawler/credential-backfill.d.ts +30 -0
  66. package/srv/blockchain/crawler/credential-backfill.js +101 -0
  67. package/srv/blockchain/crawler/hooks.d.ts +2 -17
  68. package/srv/blockchain/crawler/index.d.ts +1 -8
  69. package/srv/blockchain/crawler/index.js +31 -17
  70. package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
  71. package/srv/blockchain/crawler/input-asset-copies.js +161 -0
  72. package/srv/blockchain/crawler/key-pages.d.ts +12 -0
  73. package/srv/blockchain/crawler/key-pages.js +48 -0
  74. package/srv/blockchain/crawler/metadata-position-backfill.d.ts +22 -0
  75. package/srv/blockchain/crawler/metadata-position-backfill.js +59 -0
  76. package/srv/blockchain/crawler/output-datum-backfill.d.ts +41 -0
  77. package/srv/blockchain/crawler/output-datum-backfill.js +100 -0
  78. package/srv/blockchain/crawler/sync-state.d.ts +31 -47
  79. package/srv/blockchain/crawler/sync-state.js +135 -128
  80. package/srv/blockchain/crawler/transaction-backfill.d.ts +46 -0
  81. package/srv/blockchain/crawler/transaction-backfill.js +271 -0
  82. package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
  83. package/srv/blockchain/crawler/utxo-set-import.js +399 -0
  84. package/srv/blockchain/crawler/window-plan.d.ts +31 -0
  85. package/srv/blockchain/crawler/window-plan.js +59 -0
  86. package/srv/blockchain/ledger-state.d.ts +62 -0
  87. package/srv/blockchain/ledger-state.js +521 -0
  88. package/srv/blockchain/pending-spends.d.ts +16 -0
  89. package/srv/blockchain/pending-spends.js +81 -0
  90. package/srv/blockchain/pool-metadata.d.ts +15 -0
  91. package/srv/blockchain/pool-metadata.js +132 -0
  92. package/srv/blockchain/request-coalescer.d.ts +2 -16
  93. package/srv/blockchain/request-coalescer.js +2 -16
  94. package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
  95. package/srv/blockchain/signing/cose-verifier.js +146 -70
  96. package/srv/blockchain/signing/external-signer.d.ts +15 -115
  97. package/srv/blockchain/signing/external-signer.js +22 -131
  98. package/srv/blockchain/signing/failed-recheck.d.ts +17 -0
  99. package/srv/blockchain/signing/failed-recheck.js +135 -0
  100. package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
  101. package/srv/blockchain/signing/hsm-signer.js +28 -79
  102. package/srv/blockchain/signing/landing-proof.d.ts +60 -0
  103. package/srv/blockchain/signing/landing-proof.js +224 -0
  104. package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
  105. package/srv/blockchain/signing/signature-verifier.js +71 -87
  106. package/srv/blockchain/signing/submission-finalizer.d.ts +37 -45
  107. package/srv/blockchain/signing/submission-finalizer.js +280 -86
  108. package/srv/blockchain/stored-chain.d.ts +19 -0
  109. package/srv/blockchain/stored-chain.js +258 -0
  110. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
  111. package/srv/blockchain/transaction-building/buildooor-tx.js +663 -421
  112. package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
  113. package/srv/blockchain/transaction-presence.d.ts +12 -0
  114. package/srv/blockchain/transaction-presence.js +29 -0
  115. package/srv/blockchain/transaction-rows.d.ts +12 -0
  116. package/srv/blockchain/transaction-rows.js +44 -0
  117. package/srv/blockchain/wallet-worker/build-request.d.ts +8 -23
  118. package/srv/blockchain/wallet-worker/build-request.js +40 -353
  119. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +27 -47
  120. package/srv/blockchain/wallet-worker/confirmation-tracker.js +158 -61
  121. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  122. package/srv/blockchain/wallet-worker/index.js +3 -11
  123. package/srv/blockchain/wallet-worker/invalidation.d.ts +35 -0
  124. package/srv/blockchain/wallet-worker/invalidation.js +128 -0
  125. package/srv/blockchain/wallet-worker/job-store.d.ts +58 -150
  126. package/srv/blockchain/wallet-worker/job-store.js +200 -273
  127. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
  128. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
  129. package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
  130. package/srv/blockchain/wallet-worker/signers.js +4 -12
  131. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +29 -82
  132. package/srv/blockchain/wallet-worker/wallet-worker.js +334 -198
  133. package/srv/cardano-agent-service.cds +122 -84
  134. package/srv/cardano-agent-service.js +12 -9
  135. package/srv/cardano-backend-service.cds +81 -0
  136. package/srv/cardano-backend-service.d.ts +2 -0
  137. package/srv/cardano-backend-service.js +259 -0
  138. package/srv/cardano-indexer-service.cds +393 -18
  139. package/srv/cardano-indexer-service.d.ts +5 -1
  140. package/srv/cardano-indexer-service.js +477 -16
  141. package/srv/cardano-service.cds +426 -269
  142. package/srv/cardano-service.js +640 -217
  143. package/srv/cardano-sign-service.cds +211 -180
  144. package/srv/cardano-sign-service.js +210 -287
  145. package/srv/cardano-tx-service.cds +462 -370
  146. package/srv/cardano-tx-service.js +283 -800
  147. package/srv/cardano-ui.cds +16 -16
  148. package/srv/cardano-worker-service.cds +141 -125
  149. package/srv/cardano-worker-service.js +104 -61
  150. package/srv/cbor/cip68.d.ts +13 -0
  151. package/srv/cbor/cip68.js +56 -0
  152. package/srv/cbor/index.d.ts +3 -1
  153. package/srv/cbor/index.js +9 -1
  154. package/srv/cbor/parse.d.ts +30 -18
  155. package/srv/cbor/parse.js +44 -9
  156. package/srv/cbor/plutus-data-json.d.ts +20 -0
  157. package/srv/cbor/plutus-data-json.js +32 -0
  158. package/srv/config.d.ts +117 -0
  159. package/srv/config.js +419 -0
  160. package/srv/server.d.ts +15 -110
  161. package/srv/server.js +83 -405
  162. package/srv/utils/agent-access.d.ts +11 -0
  163. package/srv/utils/agent-access.js +86 -0
  164. package/srv/utils/agent-grants-config.d.ts +0 -46
  165. package/srv/utils/agent-grants-config.js +17 -85
  166. package/srv/utils/agent-grants.d.ts +106 -122
  167. package/srv/utils/agent-grants.js +538 -237
  168. package/srv/utils/agent-token-auth.d.ts +4 -99
  169. package/srv/utils/agent-token-auth.js +62 -186
  170. package/srv/utils/backend-request-handler.d.ts +3 -17
  171. package/srv/utils/backend-request-handler.js +3 -18
  172. package/srv/utils/build-request.d.ts +52 -0
  173. package/srv/utils/build-request.js +487 -0
  174. package/srv/utils/collections.d.ts +4 -10
  175. package/srv/utils/collections.js +14 -10
  176. package/srv/utils/const.d.ts +32 -75
  177. package/srv/utils/const.js +40 -80
  178. package/srv/utils/crypto.d.ts +3 -12
  179. package/srv/utils/crypto.js +11 -25
  180. package/srv/utils/db-indexes.d.ts +31 -0
  181. package/srv/utils/db-indexes.js +185 -0
  182. package/srv/utils/db-kind.d.ts +23 -0
  183. package/srv/utils/db-kind.js +42 -0
  184. package/srv/utils/db-sanitize.d.ts +20 -0
  185. package/srv/utils/db-sanitize.js +80 -0
  186. package/srv/utils/deep-json.d.ts +6 -0
  187. package/srv/utils/deep-json.js +240 -0
  188. package/srv/utils/detached-run.d.ts +41 -0
  189. package/srv/utils/detached-run.js +101 -0
  190. package/srv/utils/epoch-slots.d.ts +14 -0
  191. package/srv/utils/epoch-slots.js +45 -0
  192. package/srv/utils/error-codes.d.ts +26 -75
  193. package/srv/utils/error-codes.js +27 -72
  194. package/srv/utils/errors.d.ts +55 -187
  195. package/srv/utils/errors.js +161 -235
  196. package/srv/utils/lease.d.ts +20 -0
  197. package/srv/utils/lease.js +62 -0
  198. package/srv/utils/liveness.d.ts +12 -0
  199. package/srv/utils/liveness.js +35 -0
  200. package/srv/utils/mappers.d.ts +111 -223
  201. package/srv/utils/mappers.js +432 -371
  202. package/srv/utils/navigation.d.ts +17 -0
  203. package/srv/utils/navigation.js +52 -0
  204. package/srv/utils/network-context.d.ts +0 -1
  205. package/srv/utils/network-context.js +9 -15
  206. package/srv/utils/paging.d.ts +31 -0
  207. package/srv/utils/paging.js +43 -0
  208. package/srv/utils/pg-inline-json.d.ts +8 -0
  209. package/srv/utils/pg-inline-json.js +58 -0
  210. package/srv/utils/pg-order-nulls.d.ts +14 -0
  211. package/srv/utils/pg-order-nulls.js +54 -0
  212. package/srv/utils/plutus-placeholders.d.ts +16 -22
  213. package/srv/utils/plutus-placeholders.js +62 -33
  214. package/srv/utils/rate-limiter.d.ts +2 -21
  215. package/srv/utils/rate-limiter.js +5 -17
  216. package/srv/utils/readiness.d.ts +12 -0
  217. package/srv/utils/readiness.js +29 -0
  218. package/srv/utils/reference-script.d.ts +19 -0
  219. package/srv/utils/reference-script.js +84 -0
  220. package/srv/utils/resolution.d.ts +13 -0
  221. package/srv/utils/resolution.js +47 -0
  222. package/srv/utils/result-numbers.d.ts +15 -0
  223. package/srv/utils/result-numbers.js +61 -0
  224. package/srv/utils/row-values.d.ts +7 -0
  225. package/srv/utils/row-values.js +27 -0
  226. package/srv/utils/service-events.d.ts +0 -24
  227. package/srv/utils/service-events.js +3 -25
  228. package/srv/utils/signing-helper.d.ts +3 -20
  229. package/srv/utils/signing-helper.js +35 -64
  230. package/srv/utils/tx-build-helper.d.ts +25 -105
  231. package/srv/utils/tx-build-helper.js +108 -156
  232. package/srv/utils/tx-request-parsers.d.ts +82 -33
  233. package/srv/utils/tx-request-parsers.js +401 -49
  234. package/srv/utils/tx-utils.d.ts +3 -27
  235. package/srv/utils/tx-utils.js +32 -50
  236. package/srv/utils/types.d.ts +294 -232
  237. package/srv/utils/types.js +2 -22
  238. package/srv/utils/validators.d.ts +22 -92
  239. package/srv/utils/validators.js +60 -170
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DetachedRun = void 0;
7
+ const cds_1 = __importDefault(require("@sap/cds"));
8
+ /** Longest error text a status keeps. */
9
+ const ERROR_TEXT_MAX = 500;
10
+ // One long maintenance run per kind and process, run detached from the request that started it.
11
+ // A start marks the run as running before its first await, so a second start sees it busy.
12
+ class DetachedRun {
13
+ label;
14
+ idle;
15
+ textFields;
16
+ state;
17
+ stopRequested = false;
18
+ logger = cds_1.default.log('MaintenanceRun');
19
+ constructor(label, idle,
20
+ /** Fields shown as text, like the Int64 values of the other answers. */
21
+ textFields = []) {
22
+ this.label = label;
23
+ this.idle = idle;
24
+ this.textFields = textFields;
25
+ this.state = { ...idle, status: 'none', startedAt: null, finishedAt: null, error: null };
26
+ }
27
+ isBusy() {
28
+ return this.state.status === 'running';
29
+ }
30
+ /** The status fields of the last run; text fields as strings. */
31
+ snapshot() {
32
+ const out = {};
33
+ for (const key of Object.keys(this.idle)) {
34
+ const value = this.state[key];
35
+ out[key] = this.textFields.includes(key) && value != null ? String(value) : value;
36
+ }
37
+ for (const key of ['status', 'startedAt', 'finishedAt', 'error'])
38
+ out[key] = this.state[key];
39
+ return out;
40
+ }
41
+ // Runs `prepare` for its checks, then the work detached. A check that throws leaves the previous
42
+ // state in place and reaches the caller.
43
+ async start(prepare) {
44
+ if (this.isBusy())
45
+ throw new Error(`${this.label} is already running`);
46
+ const previous = this.state;
47
+ const current = { ...this.idle, status: 'running', startedAt: new Date().toISOString(), finishedAt: null, error: null };
48
+ this.state = current;
49
+ this.stopRequested = false;
50
+ let prepared;
51
+ try {
52
+ prepared = await prepare();
53
+ }
54
+ catch (err) {
55
+ this.state = previous;
56
+ throw err;
57
+ }
58
+ Object.assign(current, prepared.initial ?? {});
59
+ const label = prepared.label ?? this.label;
60
+ // cancelled only when the run saw the request: one that ended first is done
61
+ let stopped = false;
62
+ const ctl = {
63
+ progress: (p) => { Object.assign(current, pickKnown(this.idle, p)); },
64
+ shouldStop: () => (stopped ||= this.stopRequested && this.state === current),
65
+ };
66
+ // a run that throws before it returns a promise fails like one that rejects
67
+ void Promise.resolve()
68
+ .then(() => prepared.run(ctl))
69
+ .then((result) => {
70
+ Object.assign(current, pickKnown(this.idle, result ?? {}), {
71
+ status: stopped ? 'cancelled' : 'done', finishedAt: new Date().toISOString(),
72
+ });
73
+ if (current.status === 'cancelled')
74
+ this.logger.info(`${label} cancelled`);
75
+ })
76
+ .catch((err) => {
77
+ const message = err instanceof Error ? err.message : String(err);
78
+ Object.assign(current, { status: 'failed', finishedAt: new Date().toISOString(), error: message.slice(0, ERROR_TEXT_MAX) });
79
+ this.logger.error(`${label} failed: ${message}`);
80
+ });
81
+ return prepared.answer;
82
+ }
83
+ /** Asks a running run to stop at its next check. False when nothing runs. */
84
+ cancel() {
85
+ if (!this.isBusy())
86
+ return false;
87
+ this.stopRequested = true;
88
+ return true;
89
+ }
90
+ }
91
+ exports.DetachedRun = DetachedRun;
92
+ /** The fields of `p` the status declares; a result may carry more. */
93
+ function pickKnown(idle, p) {
94
+ const out = {};
95
+ for (const [key, value] of Object.entries(p)) {
96
+ if (key in idle)
97
+ out[key] = value;
98
+ }
99
+ return out;
100
+ }
101
+ //# sourceMappingURL=detached-run.js.map
@@ -0,0 +1,14 @@
1
+ import { EPOCH_CONFIG_BY_NETWORK } from './const';
2
+ type EpochNetwork = keyof typeof EPOCH_CONFIG_BY_NETWORK;
3
+ /** Epoch a slot belongs to, from the network's Shelley anchor. */
4
+ export declare function epochOfSlot(network: EpochNetwork, slot: number): number;
5
+ /** First absolute slot of an epoch, from the network's Shelley anchor. */
6
+ export declare function epochStartSlot(network: EpochNetwork, epoch: number): number;
7
+ export declare function slotToPosixMs(network: EpochNetwork, slot: number): number;
8
+ export declare function rollbackHorizonSlots(network: EpochNetwork): number;
9
+ /** Absolute POSIX seconds for a slot, rounded down. */
10
+ export declare function slotToPosixSeconds(network: EpochNetwork, slot: number): number;
11
+ /** Slot that contains a POSIX time. Throws RangeError before Shelley, where slots were 20 s long. */
12
+ export declare function posixToSlot(network: EpochNetwork, posixMs: number): number;
13
+ export {};
14
+ //# sourceMappingURL=epoch-slots.d.ts.map
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.epochOfSlot = epochOfSlot;
4
+ exports.epochStartSlot = epochStartSlot;
5
+ exports.slotToPosixMs = slotToPosixMs;
6
+ exports.rollbackHorizonSlots = rollbackHorizonSlots;
7
+ exports.slotToPosixSeconds = slotToPosixSeconds;
8
+ exports.posixToSlot = posixToSlot;
9
+ const const_1 = require("./const");
10
+ /** Epoch a slot belongs to, from the network's Shelley anchor. */
11
+ function epochOfSlot(network, slot) {
12
+ const cfg = const_1.EPOCH_CONFIG_BY_NETWORK[network];
13
+ return cfg.shelleyStartEpoch + Math.floor((slot - cfg.shelleyStartSlot) / cfg.slotsPerEpoch);
14
+ }
15
+ /** First absolute slot of an epoch, from the network's Shelley anchor. */
16
+ function epochStartSlot(network, epoch) {
17
+ const cfg = const_1.EPOCH_CONFIG_BY_NETWORK[network];
18
+ return cfg.shelleyStartSlot + (epoch - cfg.shelleyStartEpoch) * cfg.slotsPerEpoch;
19
+ }
20
+ // POSIX milliseconds for a slot, exact for Shelley-era slots.
21
+ // Ogmios eraStart.time is relative to system start, not a Unix timestamp.
22
+ function slotToPosixMs(network, slot) {
23
+ const genesis = const_1.GENESIS_INFOS_BY_NETWORK[network];
24
+ return genesis.systemStartPosixMs + (slot - genesis.startSlotNo) * genesis.slotLengthMs;
25
+ }
26
+ // Slots after which a block can no longer be rolled back: 3k/f, the stability window of the
27
+ // ledger. k blocks have followed by then with overwhelming probability.
28
+ function rollbackHorizonSlots(network) {
29
+ const cfg = const_1.EPOCH_CONFIG_BY_NETWORK[network];
30
+ return Math.ceil((3 * cfg.securityParam) / cfg.activeSlotsCoeff);
31
+ }
32
+ /** Absolute POSIX seconds for a slot, rounded down. */
33
+ function slotToPosixSeconds(network, slot) {
34
+ return Math.floor(slotToPosixMs(network, slot) / 1000);
35
+ }
36
+ /** Slot that contains a POSIX time. Throws RangeError before Shelley, where slots were 20 s long. */
37
+ function posixToSlot(network, posixMs) {
38
+ const genesis = const_1.GENESIS_INFOS_BY_NETWORK[network];
39
+ const shelleyStartMs = slotToPosixMs(network, const_1.EPOCH_CONFIG_BY_NETWORK[network].shelleyStartSlot);
40
+ if (!Number.isFinite(posixMs) || posixMs < shelleyStartMs) {
41
+ throw new RangeError(`posixToSlot: ${posixMs} is not a time from the ${network} Shelley start on`);
42
+ }
43
+ return genesis.startSlotNo + Math.floor((posixMs - genesis.systemStartPosixMs) / genesis.slotLengthMs);
44
+ }
45
+ //# sourceMappingURL=epoch-slots.js.map
@@ -1,94 +1,45 @@
1
- /**
2
- * Error codes used throughout the ODATANO backend
3
- */
1
+ /** Error codes used throughout the backend. */
4
2
  export declare const ERROR_CODES: {
5
- /**
6
- * 400 – Invalid input
7
- * Indicates that the input provided by the client is invalid (malformed address, invalid transaction hash, etc.)
8
- */
3
+ /** 400: malformed client input (address, tx hash, ...). */
9
4
  readonly INVALID_INPUT: "ODATANO_INVALID_INPUT";
10
- /**
11
- * 403 – Caller lacks the required role
12
- * Indicates the caller is authenticated but not authorized for the operation
13
- * (e.g. HSM-backed signing without the configured hsm.requiresRole)
14
- */
5
+ /** 403: authenticated but lacking the required role (e.g. hsm.requiresRole). */
15
6
  readonly FORBIDDEN: "ODATANO_FORBIDDEN";
16
- /**
17
- * 404 – Data not found
18
- * Indicates that the requested resource could not be found (Empty result set Address with no UTxOs, Transaction hash not found, etc.)
19
- */
7
+ /** 404: requested resource not found (unknown tx hash, address without UTxOs, ...). */
20
8
  readonly NOT_FOUND: "ODATANO_NOT_FOUND";
21
- /**
22
- * 400 – Insufficient funds/assets
23
- * Indicates that the address does not have enough funds or assets to complete the transaction
24
- */
9
+ /** 400: address lacks the funds or assets for the transaction. */
25
10
  readonly INSUFFICIENT_FUNDS: "ODATANO_INSUFFICIENT_FUNDS";
26
- /**
27
- * 400 – Transaction validation failed
28
- * Indicates that the transaction failed validation (wrong signature, tampered CBOR, etc.)
29
- */
11
+ /** 400: decoded transaction failed validation (wrong signature, tampered CBOR, ...). */
30
12
  readonly TX_VALIDATION_FAILED: "ODATANO_TX_VALIDATION_FAILED";
31
- /**
32
- * 400 – Transaction CBOR parse failed
33
- * Indicates that the provided transaction CBOR could not be decoded
34
- * (malformed bytes, truncated, not a Cardano Conway tx). Distinct from
35
- * TX_VALIDATION_FAILED which applies to decoded-but-invalid transactions.
36
- */
13
+ /** 400: transaction CBOR could not be decoded (malformed, truncated, not a Conway tx). */
37
14
  readonly TX_PARSE_FAILED: "ODATANO_TX_PARSE_FAILED";
38
- /**
39
- * 400 – Plutus script validation failed
40
- * Indicates that the ledger cleanly rejected the transaction due to script
41
- * evaluation — e.g. PlutusFailure, CekError, overspent budget, script hash
42
- * mismatch. Distinct from provider outages (503) and generic tx validation.
43
- */
15
+ /** 400: ledger rejected the tx on script evaluation (PlutusFailure, CekError, budget, hash mismatch). */
44
16
  readonly SCRIPT_VALIDATION_FAILURE: "ODATANO_SCRIPT_VALIDATION_FAILURE";
45
- /**
46
- * 409 – Transaction already submitted
47
- * Indicates that the transaction has already been submitted (duplicate/replay)
48
- */
17
+ /** 409: a crawler cursor block is not on this instance's chain (orphaned by a reorg). */
18
+ readonly CHAIN_POINT_MISMATCH: "ODATANO_CHAIN_POINT_MISMATCH";
19
+ /** 409: transaction already submitted (duplicate / replay). */
49
20
  readonly TX_ALREADY_SUBMITTED: "ODATANO_TX_ALREADY_SUBMITTED";
50
- /**
51
- * 429 – Rate limiting
52
- * indicates temporary unavailability
53
- */
21
+ /** 409: the idempotency key belongs to a job with another request. */
22
+ readonly IDEMPOTENCY_KEY_CONFLICT: "ODATANO_IDEMPOTENCY_KEY_CONFLICT";
23
+ /** 409: an outcome cannot be set to failed while the transaction can still land. */
24
+ readonly OUTCOME_STILL_OPEN: "ODATANO_OUTCOME_STILL_OPEN";
25
+ /** 409: another call resolved the record first. */
26
+ readonly RESOLVED_CONCURRENTLY: "ODATANO_RESOLVED_CONCURRENTLY";
27
+ /** 429: provider rate limit hit. */
54
28
  readonly PROVIDER_RATE_LIMITED: "ODATANO_PROVIDER_RATE_LIMITED";
55
- /**
56
- * 503 – Upstream / connectivity
57
- * Indicates that the Cardano data provider is currently unavailable
58
- */
29
+ /** 503: Cardano data provider unavailable. */
59
30
  readonly PROVIDER_UNAVAILABLE: "ODATANO_PROVIDER_UNAVAILABLE";
60
- /**
61
- * 500 – Internal fallback
62
- * Indicates an unexpected internal error
63
- */
31
+ /** 503: a submit failed without a verdict; the transaction may still reach the chain. */
32
+ readonly SUBMIT_OUTCOME_UNKNOWN: "ODATANO_SUBMIT_OUTCOME_UNKNOWN";
33
+ /** 500: unexpected internal error. */
64
34
  readonly INTERNAL_ERROR: "ODATANO_INTERNAL_ERROR";
65
- /**
66
- * 503 – HSM unavailable
67
- * Indicates the HSM device or session is not available
68
- */
35
+ /** 503: HSM device or session not available. */
69
36
  readonly HSM_UNAVAILABLE: "ODATANO_HSM_UNAVAILABLE";
70
- /**
71
- * 500 – HSM signing failed
72
- * Indicates the HSM signing operation failed
73
- */
37
+ /** 500: HSM signing operation failed. */
74
38
  readonly HSM_SIGNING_FAILED: "ODATANO_HSM_SIGNING_FAILED";
75
- /**
76
- * 400 – HSM not configured
77
- * Indicates HSM signing was requested but HSM is not configured
78
- */
39
+ /** 400: HSM signing requested but HSM not configured. */
79
40
  readonly HSM_NOT_CONFIGURED: "ODATANO_HSM_NOT_CONFIGURED";
80
- /**
81
- * 503 – Detached transaction could not begin in time
82
- * The sign-service could not acquire a pooled DB connection for one of its
83
- * detached bookkeeping transactions. Most common cause: an in-process
84
- * consumer awaits SubmitVerifiedTransaction/SignAndSubmitWithHsm while its
85
- * own request transaction holds the (single) pooled sqlite connection —
86
- * see docs/KNOWN_ISSUES.md issue 11.
87
- */
88
41
  readonly NESTED_TX_TIMEOUT: "ODATANO_NESTED_TX_TIMEOUT";
89
42
  };
90
- /**
91
- * EnumType representing all possible error codes
92
- */
43
+ /** Union of all error code values. */
93
44
  export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
94
45
  //# sourceMappingURL=error-codes.d.ts.map
@@ -1,93 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ERROR_CODES = void 0;
4
- /**
5
- * Error codes used throughout the ODATANO backend
6
- */
4
+ /** Error codes used throughout the backend. */
7
5
  exports.ERROR_CODES = {
8
- /**
9
- * 400 – Invalid input
10
- * Indicates that the input provided by the client is invalid (malformed address, invalid transaction hash, etc.)
11
- */
6
+ /** 400: malformed client input (address, tx hash, ...). */
12
7
  INVALID_INPUT: 'ODATANO_INVALID_INPUT',
13
- /**
14
- * 403 – Caller lacks the required role
15
- * Indicates the caller is authenticated but not authorized for the operation
16
- * (e.g. HSM-backed signing without the configured hsm.requiresRole)
17
- */
8
+ /** 403: authenticated but lacking the required role (e.g. hsm.requiresRole). */
18
9
  FORBIDDEN: 'ODATANO_FORBIDDEN',
19
- /**
20
- * 404 – Data not found
21
- * Indicates that the requested resource could not be found (Empty result set Address with no UTxOs, Transaction hash not found, etc.)
22
- */
10
+ /** 404: requested resource not found (unknown tx hash, address without UTxOs, ...). */
23
11
  NOT_FOUND: 'ODATANO_NOT_FOUND',
24
- /**
25
- * 400 – Insufficient funds/assets
26
- * Indicates that the address does not have enough funds or assets to complete the transaction
27
- */
12
+ /** 400: address lacks the funds or assets for the transaction. */
28
13
  INSUFFICIENT_FUNDS: 'ODATANO_INSUFFICIENT_FUNDS',
29
- /**
30
- * 400 – Transaction validation failed
31
- * Indicates that the transaction failed validation (wrong signature, tampered CBOR, etc.)
32
- */
14
+ /** 400: decoded transaction failed validation (wrong signature, tampered CBOR, ...). */
33
15
  TX_VALIDATION_FAILED: 'ODATANO_TX_VALIDATION_FAILED',
34
- /**
35
- * 400 – Transaction CBOR parse failed
36
- * Indicates that the provided transaction CBOR could not be decoded
37
- * (malformed bytes, truncated, not a Cardano Conway tx). Distinct from
38
- * TX_VALIDATION_FAILED which applies to decoded-but-invalid transactions.
39
- */
16
+ /** 400: transaction CBOR could not be decoded (malformed, truncated, not a Conway tx). */
40
17
  TX_PARSE_FAILED: 'ODATANO_TX_PARSE_FAILED',
41
- /**
42
- * 400 – Plutus script validation failed
43
- * Indicates that the ledger cleanly rejected the transaction due to script
44
- * evaluation — e.g. PlutusFailure, CekError, overspent budget, script hash
45
- * mismatch. Distinct from provider outages (503) and generic tx validation.
46
- */
18
+ /** 400: ledger rejected the tx on script evaluation (PlutusFailure, CekError, budget, hash mismatch). */
47
19
  SCRIPT_VALIDATION_FAILURE: 'ODATANO_SCRIPT_VALIDATION_FAILURE',
48
- /**
49
- * 409 – Transaction already submitted
50
- * Indicates that the transaction has already been submitted (duplicate/replay)
51
- */
20
+ /** 409: a crawler cursor block is not on this instance's chain (orphaned by a reorg). */
21
+ CHAIN_POINT_MISMATCH: 'ODATANO_CHAIN_POINT_MISMATCH',
22
+ /** 409: transaction already submitted (duplicate / replay). */
52
23
  TX_ALREADY_SUBMITTED: 'ODATANO_TX_ALREADY_SUBMITTED',
53
- /**
54
- * 429 – Rate limiting
55
- * indicates temporary unavailability
56
- */
24
+ /** 409: the idempotency key belongs to a job with another request. */
25
+ IDEMPOTENCY_KEY_CONFLICT: 'ODATANO_IDEMPOTENCY_KEY_CONFLICT',
26
+ /** 409: an outcome cannot be set to failed while the transaction can still land. */
27
+ OUTCOME_STILL_OPEN: 'ODATANO_OUTCOME_STILL_OPEN',
28
+ /** 409: another call resolved the record first. */
29
+ RESOLVED_CONCURRENTLY: 'ODATANO_RESOLVED_CONCURRENTLY',
30
+ /** 429: provider rate limit hit. */
57
31
  PROVIDER_RATE_LIMITED: 'ODATANO_PROVIDER_RATE_LIMITED',
58
- /**
59
- * 503 – Upstream / connectivity
60
- * Indicates that the Cardano data provider is currently unavailable
61
- */
32
+ /** 503: Cardano data provider unavailable. */
62
33
  PROVIDER_UNAVAILABLE: 'ODATANO_PROVIDER_UNAVAILABLE',
63
- /**
64
- * 500 – Internal fallback
65
- * Indicates an unexpected internal error
66
- */
34
+ /** 503: a submit failed without a verdict; the transaction may still reach the chain. */
35
+ SUBMIT_OUTCOME_UNKNOWN: 'ODATANO_SUBMIT_OUTCOME_UNKNOWN',
36
+ /** 500: unexpected internal error. */
67
37
  INTERNAL_ERROR: 'ODATANO_INTERNAL_ERROR',
68
- /**
69
- * 503 – HSM unavailable
70
- * Indicates the HSM device or session is not available
71
- */
38
+ /** 503: HSM device or session not available. */
72
39
  HSM_UNAVAILABLE: 'ODATANO_HSM_UNAVAILABLE',
73
- /**
74
- * 500 – HSM signing failed
75
- * Indicates the HSM signing operation failed
76
- */
40
+ /** 500: HSM signing operation failed. */
77
41
  HSM_SIGNING_FAILED: 'ODATANO_HSM_SIGNING_FAILED',
78
- /**
79
- * 400 – HSM not configured
80
- * Indicates HSM signing was requested but HSM is not configured
81
- */
42
+ /** 400: HSM signing requested but HSM not configured. */
82
43
  HSM_NOT_CONFIGURED: 'ODATANO_HSM_NOT_CONFIGURED',
83
- /**
84
- * 503 – Detached transaction could not begin in time
85
- * The sign-service could not acquire a pooled DB connection for one of its
86
- * detached bookkeeping transactions. Most common cause: an in-process
87
- * consumer awaits SubmitVerifiedTransaction/SignAndSubmitWithHsm while its
88
- * own request transaction holds the (single) pooled sqlite connection —
89
- * see docs/KNOWN_ISSUES.md issue 11.
90
- */
44
+ // 503: a detached transaction got no DB connection in time. Typical cause is an in-process caller
45
+ // whose own request transaction holds the single SQLite connection.
91
46
  NESTED_TX_TIMEOUT: 'ODATANO_NESTED_TX_TIMEOUT',
92
47
  };
93
48
  //# sourceMappingURL=error-codes.js.map