@eclesia/indexer-engine 2.10.0 → 2.11.1
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/dist/_virtual/rolldown_runtime.cjs +4 -0
- package/dist/_virtual/rolldown_runtime.mjs +38 -0
- package/dist/constants.cjs +6 -2
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +6 -3
- package/dist/constants.d.cts.map +1 -1
- package/dist/{constants.d.ts → constants.d.mts} +7 -4
- package/dist/constants.d.mts.map +1 -0
- package/dist/{constants.js → constants.mjs} +7 -4
- package/dist/constants.mjs.map +1 -0
- package/dist/emitter/index.cjs +6 -3
- package/dist/emitter/index.cjs.map +1 -1
- package/dist/emitter/index.d.cts.map +1 -1
- package/dist/emitter/{index.d.ts → index.d.mts} +2 -2
- package/dist/emitter/index.d.mts.map +1 -0
- package/dist/emitter/{index.js → index.mjs} +7 -4
- package/dist/emitter/index.mjs.map +1 -0
- package/dist/errors/index.cjs +18 -0
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/{index.d.ts → index.d.mts} +1 -1
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/{index.js → index.mjs} +19 -1
- package/dist/errors/index.mjs.map +1 -0
- package/dist/index.cjs +10 -2
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +11 -0
- package/dist/index.mjs +12 -0
- package/dist/indexer/index.cjs +113 -67
- package/dist/indexer/index.cjs.map +1 -1
- package/dist/indexer/index.d.cts +7 -1
- package/dist/indexer/index.d.cts.map +1 -1
- package/dist/indexer/{index.d.ts → index.d.mts} +11 -5
- package/dist/indexer/index.d.mts.map +1 -0
- package/dist/indexer/{index.js → index.mjs} +121 -75
- package/dist/indexer/index.mjs.map +1 -0
- package/dist/metrics/index.cjs +28 -0
- package/dist/metrics/index.cjs.map +1 -1
- package/dist/metrics/index.d.cts.map +1 -1
- package/dist/metrics/{index.d.ts → index.d.mts} +1 -1
- package/dist/metrics/index.d.mts.map +1 -0
- package/dist/metrics/{index.js → index.mjs} +29 -1
- package/dist/metrics/index.mjs.map +1 -0
- package/dist/mocks/index.cjs +17 -0
- package/dist/mocks/index.cjs.map +1 -0
- package/dist/mocks/index.d.cts +9 -0
- package/dist/mocks/index.d.cts.map +1 -0
- package/dist/mocks/index.d.mts +9 -0
- package/dist/mocks/index.d.mts.map +1 -0
- package/dist/mocks/index.mjs +12 -0
- package/dist/mocks/index.mjs.map +1 -0
- package/dist/mocks/rpc-client.cjs +209 -0
- package/dist/mocks/rpc-client.cjs.map +1 -0
- package/dist/mocks/rpc-client.d.cts +44 -0
- package/dist/mocks/rpc-client.d.cts.map +1 -0
- package/dist/mocks/rpc-client.d.mts +44 -0
- package/dist/mocks/rpc-client.d.mts.map +1 -0
- package/dist/mocks/rpc-client.mjs +208 -0
- package/dist/mocks/rpc-client.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/ascii.cjs +32 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/ascii.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/ascii.mjs +29 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/ascii.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/base64.cjs +67 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/base64.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/base64.mjs +64 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/base64.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/bech32.cjs +80 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/bech32.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/bech32.mjs +77 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/bech32.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/hex.cjs +33 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/hex.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/hex.mjs +30 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/hex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/index.cjs +106 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/index.mjs +103 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/rfc3339.cjs +52 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/rfc3339.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/rfc3339.mjs +49 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/rfc3339.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/utf8.cjs +31 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/utf8.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/utf8.mjs +28 -0
- package/dist/node_modules/.pnpm/@cosmjs_encoding@0.36.0/node_modules/@cosmjs/encoding/build/utf8.mjs.map +1 -0
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.cjs +98 -0
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.mjs +95 -0
- package/dist/node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.mjs.map +1 -0
- package/dist/promise-queue/index.cjs +34 -5
- package/dist/promise-queue/index.cjs.map +1 -1
- package/dist/promise-queue/index.d.cts.map +1 -1
- package/dist/promise-queue/{index.d.ts → index.d.mts} +1 -1
- package/dist/promise-queue/index.d.mts.map +1 -0
- package/dist/promise-queue/{index.js → index.mjs} +35 -6
- package/dist/promise-queue/index.mjs.map +1 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/{index.d.ts → index.d.mts} +5 -4
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/{index.js → index.mjs} +1 -1
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/{bech32.d.ts → bech32.d.mts} +1 -1
- package/dist/utils/bech32.d.mts.map +1 -0
- package/dist/utils/{bech32.js → bech32.mjs} +1 -1
- package/dist/utils/bech32.mjs.map +1 -0
- package/dist/utils/{bigint.d.ts → bigint.d.mts} +1 -1
- package/dist/utils/bigint.d.mts.map +1 -0
- package/dist/utils/{bigint.js → bigint.mjs} +1 -1
- package/dist/utils/bigint.mjs.map +1 -0
- package/dist/utils/{index.d.ts → index.d.mts} +4 -4
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/{index.js → index.mjs} +5 -5
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/{text.d.ts → text.d.mts} +1 -1
- package/dist/utils/text.d.mts.map +1 -0
- package/dist/utils/{text.js → text.mjs} +1 -1
- package/dist/utils/text.mjs.map +1 -0
- package/dist/validation/{index.d.ts → index.d.mts} +1 -1
- package/dist/validation/index.d.mts.map +1 -0
- package/dist/validation/{index.js → index.mjs} +3 -3
- package/dist/validation/index.mjs.map +1 -0
- package/package.json +23 -20
- package/dist/_virtual/rolldown_runtime.js +0 -13
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/emitter/index.d.ts.map +0 -1
- package/dist/emitter/index.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -11
- package/dist/indexer/index.d.ts.map +0 -1
- package/dist/indexer/index.js.map +0 -1
- package/dist/metrics/index.d.ts.map +0 -1
- package/dist/metrics/index.js.map +0 -1
- package/dist/promise-queue/index.d.ts.map +0 -1
- package/dist/promise-queue/index.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/bech32.d.ts.map +0 -1
- package/dist/utils/bech32.js.map +0 -1
- package/dist/utils/bigint.d.ts.map +0 -1
- package/dist/utils/bigint.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/text.js.map +0 -1
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (all) => {
|
|
9
12
|
let target = {};
|
|
10
13
|
for (var name in all) __defProp(target, name, {
|
|
@@ -30,5 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
33
|
|
|
31
34
|
//#endregion
|
|
32
35
|
|
|
36
|
+
exports.__commonJS = __commonJS;
|
|
33
37
|
exports.__export = __export;
|
|
34
38
|
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJS = (cb, mod) => function() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __export = (all) => {
|
|
14
|
+
let target = {};
|
|
15
|
+
for (var name in all) __defProp(target, name, {
|
|
16
|
+
get: all[name],
|
|
17
|
+
enumerable: true
|
|
18
|
+
});
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
32
|
+
value: mod,
|
|
33
|
+
enumerable: true
|
|
34
|
+
}) : target, mod));
|
|
35
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { __commonJS, __export, __require, __toESM };
|
package/dist/constants.cjs
CHANGED
|
@@ -16,9 +16,12 @@ const DEFAULT_BATCH_SIZE = 500;
|
|
|
16
16
|
const DEFAULT_START_HEIGHT = 1;
|
|
17
17
|
/**
|
|
18
18
|
* Default port for health check HTTP server
|
|
19
|
-
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
20
19
|
*/
|
|
21
|
-
const DEFAULT_HEALTH_CHECK_PORT =
|
|
20
|
+
const DEFAULT_HEALTH_CHECK_PORT = 8888;
|
|
21
|
+
/**
|
|
22
|
+
* Default port for Prometheus metrics server
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_PROMETHEUS_PORT = 9090;
|
|
22
25
|
/**
|
|
23
26
|
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
24
27
|
*/
|
|
@@ -65,6 +68,7 @@ exports.DB_CLIENT_RECYCLE_COUNT = DB_CLIENT_RECYCLE_COUNT;
|
|
|
65
68
|
exports.DEFAULT_BATCH_SIZE = DEFAULT_BATCH_SIZE;
|
|
66
69
|
exports.DEFAULT_HEALTH_CHECK_PORT = DEFAULT_HEALTH_CHECK_PORT;
|
|
67
70
|
exports.DEFAULT_POLLING_INTERVAL_MS = DEFAULT_POLLING_INTERVAL_MS;
|
|
71
|
+
exports.DEFAULT_PROMETHEUS_PORT = DEFAULT_PROMETHEUS_PORT;
|
|
68
72
|
exports.DEFAULT_START_HEIGHT = DEFAULT_START_HEIGHT;
|
|
69
73
|
exports.GENESIS_BATCH_SIZE = GENESIS_BATCH_SIZE;
|
|
70
74
|
exports.PAGINATION_LIMITS = PAGINATION_LIMITS;
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Configuration constants for the Eclesia indexer\n * These values control performance, timeouts, and connection management\n */\n\n/**\n * Number of blocks to prefetch and keep in the processing queue\n * Higher values increase memory usage but improve throughput\n * Recommended range: 300-1000 depending on block size and available memory\n */\nexport const DEFAULT_BATCH_SIZE = 500;\n\n/**\n * Default start height for indexing when no previous height is found\n */\nexport const DEFAULT_START_HEIGHT = 1;\n\n/**\n * Default port for health check HTTP server\n
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Configuration constants for the Eclesia indexer\n * These values control performance, timeouts, and connection management\n */\n\n/**\n * Number of blocks to prefetch and keep in the processing queue\n * Higher values increase memory usage but improve throughput\n * Recommended range: 300-1000 depending on block size and available memory\n */\nexport const DEFAULT_BATCH_SIZE = 500;\n\n/**\n * Default start height for indexing when no previous height is found\n */\nexport const DEFAULT_START_HEIGHT = 1;\n\n/**\n * Default port for health check HTTP server\n */\nexport const DEFAULT_HEALTH_CHECK_PORT = 8888;\n\n/**\n * Default port for Prometheus metrics server\n */\nexport const DEFAULT_PROMETHEUS_PORT = 9090;\n\n/**\n * Default polling interval in milliseconds when using polling mode instead of WebSocket\n */\nexport const DEFAULT_POLLING_INTERVAL_MS = 5000;\n\n/**\n * Timeout for RPC calls in milliseconds\n * If a call takes longer than this, it will be rejected\n */\nexport const RPC_TIMEOUT_MS = 20000;\n\n/**\n * Timeout for block queue dequeue operations in milliseconds\n * If no block is available within this time, an error will be thrown\n */\nexport const QUEUE_DEQUEUE_TIMEOUT_MS = 30000;\n\n/**\n * Number of successful transactions before recycling the database client\n * Prevents long-running connection issues and stale connections\n */\nexport const DB_CLIENT_RECYCLE_COUNT = 1500;\n\n/**\n * Block intervals for periodic event emission\n * Used for operations that should run at regular block intervals\n */\nexport const PERIODIC_INTERVALS = {\n /** Emit periodic event every 50 blocks */\n SMALL: 50,\n /** Emit periodic event every 100 blocks */\n MEDIUM: 100,\n /** Emit periodic event every 1000 blocks - used for performance logging */\n LARGE: 1000,\n} as const;\n\n/**\n * Pagination limits for blockchain queries\n */\nexport const PAGINATION_LIMITS = {\n /** Default limit for validator queries */\n VALIDATORS: 1000n,\n /** Default limit for delegation queries */\n DELEGATIONS: 250n,\n} as const;\n\n/**\n * Batch size for streaming genesis file processing\n * Number of entries to process at once from genesis JSON\n */\nexport const GENESIS_BATCH_SIZE = 1000;\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,qBAAqB;;;;AAKlC,MAAa,uBAAuB;;;;AAKpC,MAAa,4BAA4B;;;;AAKzC,MAAa,0BAA0B;;;;AAKvC,MAAa,8BAA8B;;;;;AAM3C,MAAa,iBAAiB;;;;;AAM9B,MAAa,2BAA2B;;;;;AAMxC,MAAa,0BAA0B;;;;;AAMvC,MAAa,qBAAqB;CAEhC,OAAO;CAEP,QAAQ;CAER,OAAO;CACR;;;;AAKD,MAAa,oBAAoB;CAE/B,YAAY;CAEZ,aAAa;CACd;;;;;AAMD,MAAa,qBAAqB"}
|
package/dist/constants.d.cts
CHANGED
|
@@ -15,9 +15,12 @@ declare const DEFAULT_BATCH_SIZE = 500;
|
|
|
15
15
|
declare const DEFAULT_START_HEIGHT = 1;
|
|
16
16
|
/**
|
|
17
17
|
* Default port for health check HTTP server
|
|
18
|
-
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
18
|
*/
|
|
20
|
-
declare const DEFAULT_HEALTH_CHECK_PORT =
|
|
19
|
+
declare const DEFAULT_HEALTH_CHECK_PORT = 8888;
|
|
20
|
+
/**
|
|
21
|
+
* Default port for Prometheus metrics server
|
|
22
|
+
*/
|
|
23
|
+
declare const DEFAULT_PROMETHEUS_PORT = 9090;
|
|
21
24
|
/**
|
|
22
25
|
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
26
|
*/
|
|
@@ -64,5 +67,5 @@ declare const PAGINATION_LIMITS: {
|
|
|
64
67
|
*/
|
|
65
68
|
declare const GENESIS_BATCH_SIZE = 1000;
|
|
66
69
|
//#endregion
|
|
67
|
-
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
70
|
+
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
68
71
|
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAUA;AAKA;
|
|
1
|
+
{"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAUA;AAKA;AAKA;AAKA;AAKA;AAMA;AAMA;AAMA;AAMa,cA5CA,kBAAA,GAmDH,GAAA;AAKV;AAWA;;cA9Da,oBAAA;;;;cAKA,yBAAA;;;;cAKA,uBAAA;;;;cAKA,2BAAA;;;;;cAMA,cAAA;;;;;cAMA,wBAAA;;;;;cAMA,uBAAA;;;;;cAMA;;;;;;;;;;;cAYA;;;;;;;;;;cAWA,kBAAA"}
|
|
@@ -15,9 +15,12 @@ declare const DEFAULT_BATCH_SIZE = 500;
|
|
|
15
15
|
declare const DEFAULT_START_HEIGHT = 1;
|
|
16
16
|
/**
|
|
17
17
|
* Default port for health check HTTP server
|
|
18
|
-
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
18
|
*/
|
|
20
|
-
declare const DEFAULT_HEALTH_CHECK_PORT =
|
|
19
|
+
declare const DEFAULT_HEALTH_CHECK_PORT = 8888;
|
|
20
|
+
/**
|
|
21
|
+
* Default port for Prometheus metrics server
|
|
22
|
+
*/
|
|
23
|
+
declare const DEFAULT_PROMETHEUS_PORT = 9090;
|
|
21
24
|
/**
|
|
22
25
|
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
26
|
*/
|
|
@@ -64,5 +67,5 @@ declare const PAGINATION_LIMITS: {
|
|
|
64
67
|
*/
|
|
65
68
|
declare const GENESIS_BATCH_SIZE = 1000;
|
|
66
69
|
//#endregion
|
|
67
|
-
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
68
|
-
//# sourceMappingURL=constants.d.
|
|
70
|
+
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
71
|
+
//# sourceMappingURL=constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAUA;AAKA;AAKA;AAKA;AAKA;AAMA;AAMA;AAMA;AAMa,cA5CA,kBAAA,GAmDH,GAAA;AAKV;AAWA;;cA9Da,oBAAA;;;;cAKA,yBAAA;;;;cAKA,uBAAA;;;;cAKA,2BAAA;;;;;cAMA,cAAA;;;;;cAMA,wBAAA;;;;;cAMA,uBAAA;;;;;cAMA;;;;;;;;;;;cAYA;;;;;;;;;;cAWA,kBAAA"}
|
|
@@ -15,9 +15,12 @@ const DEFAULT_BATCH_SIZE = 500;
|
|
|
15
15
|
const DEFAULT_START_HEIGHT = 1;
|
|
16
16
|
/**
|
|
17
17
|
* Default port for health check HTTP server
|
|
18
|
-
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
18
|
*/
|
|
20
|
-
const DEFAULT_HEALTH_CHECK_PORT =
|
|
19
|
+
const DEFAULT_HEALTH_CHECK_PORT = 8888;
|
|
20
|
+
/**
|
|
21
|
+
* Default port for Prometheus metrics server
|
|
22
|
+
*/
|
|
23
|
+
const DEFAULT_PROMETHEUS_PORT = 9090;
|
|
21
24
|
/**
|
|
22
25
|
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
26
|
*/
|
|
@@ -60,5 +63,5 @@ const PAGINATION_LIMITS = {
|
|
|
60
63
|
const GENESIS_BATCH_SIZE = 1e3;
|
|
61
64
|
|
|
62
65
|
//#endregion
|
|
63
|
-
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
64
|
-
//# sourceMappingURL=constants.
|
|
66
|
+
export { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS };
|
|
67
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Configuration constants for the Eclesia indexer\n * These values control performance, timeouts, and connection management\n */\n\n/**\n * Number of blocks to prefetch and keep in the processing queue\n * Higher values increase memory usage but improve throughput\n * Recommended range: 300-1000 depending on block size and available memory\n */\nexport const DEFAULT_BATCH_SIZE = 500;\n\n/**\n * Default start height for indexing when no previous height is found\n */\nexport const DEFAULT_START_HEIGHT = 1;\n\n/**\n * Default port for health check HTTP server\n */\nexport const DEFAULT_HEALTH_CHECK_PORT = 8888;\n\n/**\n * Default port for Prometheus metrics server\n */\nexport const DEFAULT_PROMETHEUS_PORT = 9090;\n\n/**\n * Default polling interval in milliseconds when using polling mode instead of WebSocket\n */\nexport const DEFAULT_POLLING_INTERVAL_MS = 5000;\n\n/**\n * Timeout for RPC calls in milliseconds\n * If a call takes longer than this, it will be rejected\n */\nexport const RPC_TIMEOUT_MS = 20000;\n\n/**\n * Timeout for block queue dequeue operations in milliseconds\n * If no block is available within this time, an error will be thrown\n */\nexport const QUEUE_DEQUEUE_TIMEOUT_MS = 30000;\n\n/**\n * Number of successful transactions before recycling the database client\n * Prevents long-running connection issues and stale connections\n */\nexport const DB_CLIENT_RECYCLE_COUNT = 1500;\n\n/**\n * Block intervals for periodic event emission\n * Used for operations that should run at regular block intervals\n */\nexport const PERIODIC_INTERVALS = {\n /** Emit periodic event every 50 blocks */\n SMALL: 50,\n /** Emit periodic event every 100 blocks */\n MEDIUM: 100,\n /** Emit periodic event every 1000 blocks - used for performance logging */\n LARGE: 1000,\n} as const;\n\n/**\n * Pagination limits for blockchain queries\n */\nexport const PAGINATION_LIMITS = {\n /** Default limit for validator queries */\n VALIDATORS: 1000n,\n /** Default limit for delegation queries */\n DELEGATIONS: 250n,\n} as const;\n\n/**\n * Batch size for streaming genesis file processing\n * Number of entries to process at once from genesis JSON\n */\nexport const GENESIS_BATCH_SIZE = 1000;\n"],"mappings":";;;;;;;;;;AAUA,MAAa,qBAAqB;;;;AAKlC,MAAa,uBAAuB;;;;AAKpC,MAAa,4BAA4B;;;;AAKzC,MAAa,0BAA0B;;;;AAKvC,MAAa,8BAA8B;;;;;AAM3C,MAAa,iBAAiB;;;;;AAM9B,MAAa,2BAA2B;;;;;AAMxC,MAAa,0BAA0B;;;;;AAMvC,MAAa,qBAAqB;CAEhC,OAAO;CAEP,QAAQ;CAER,OAAO;CACR;;;;AAKD,MAAa,oBAAoB;CAE/B,YAAY;CAEZ,aAAa;CACd;;;;;AAMD,MAAa,qBAAqB"}
|
package/dist/emitter/index.cjs
CHANGED
|
@@ -7,14 +7,17 @@ let events = require("events");
|
|
|
7
7
|
* Extends Node.js EventEmitter with UUID tracking and error handling capabilities
|
|
8
8
|
*/
|
|
9
9
|
var EclesiaEmitter = class {
|
|
10
|
+
/** Internal Node.js EventEmitter instance */
|
|
11
|
+
emitter = new events.EventEmitter();
|
|
12
|
+
/** Map tracking the number of handlers registered for each event type */
|
|
13
|
+
handled = /* @__PURE__ */ new Map();
|
|
14
|
+
/** WeakMap storing wrapper functions for proper cleanup */
|
|
15
|
+
handlerMap = /* @__PURE__ */ new WeakMap();
|
|
10
16
|
/**
|
|
11
17
|
* Creates a new EclesiaEmitter instance
|
|
12
18
|
* Sets max listeners to 0 (unlimited) to handle many modules
|
|
13
19
|
*/
|
|
14
20
|
constructor() {
|
|
15
|
-
this.emitter = new events.EventEmitter();
|
|
16
|
-
this.handled = /* @__PURE__ */ new Map();
|
|
17
|
-
this.handlerMap = /* @__PURE__ */ new WeakMap();
|
|
18
21
|
this.emitter.setMaxListeners(0);
|
|
19
22
|
}
|
|
20
23
|
emit(eventName, eventArg) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["EventEmitter"],"sources":["../../src/emitter/index.ts"],"sourcesContent":["import {\n EventEmitter,\n} from \"node:events\";\n\nimport {\n WithHeightAndUUID,\n} from \"../types/index.js\";\n\n/**\n * Custom event emitter that provides type-safe event handling for blockchain indexing\n * Extends Node.js EventEmitter with UUID tracking and error handling capabilities\n */\nexport class EclesiaEmitter {\n /** Internal Node.js EventEmitter instance */\n private emitter = new EventEmitter();\n\n /** Map tracking the number of handlers registered for each event type */\n public handled = new Map<string, number>();\n\n /** WeakMap storing wrapper functions for proper cleanup */\n private handlerMap = new WeakMap();\n\n /**\n * Creates a new EclesiaEmitter instance\n * Sets max listeners to 0 (unlimited) to handle many modules\n */\n constructor() {\n this.emitter.setMaxListeners(0);\n }\n\n emit<EType extends keyof (WithHeightAndUUID<EventMap>) & string>(\n eventName: EType,\n eventArg: WithHeightAndUUID<EventMap>[EType] & {\n uuid?: string\n },\n ) {\n if (this.handled.has(eventName)) {\n this.emitter.emit(\n eventName, eventArg,\n );\n }\n else {\n this.emitter.emit(\n \"_unhandled\", {\n type: eventName as string,\n event: eventArg,\n uuid: eventArg.uuid,\n },\n );\n }\n }\n\n on<TEventName extends keyof WithHeightAndUUID<EventMap> & string | \"_unhandled\">(\n eventName: TEventName,\n handler: TEventName extends \"_unhandled\"\n ? (eventArg: {\n type: string\n event: unknown\n uuid: string\n }) => void\n : (eventArg: TEventName extends keyof WithHeightAndUUID<EventMap> ? WithHeightAndUUID<EventMap>[TEventName] : never) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count) {\n this.handled.set(\n eventName, count + 1,\n );\n }\n else {\n this.handled.set(\n eventName, 1,\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const wrapper = async (eventData: any) => {\n try {\n await handler(eventData);\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: true,\n uuid: eventData.uuid,\n },\n );\n }\n }\n catch (error) {\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: false,\n error: error as string,\n uuid: eventData.uuid,\n },\n );\n }\n }\n };\n this.handlerMap.set(\n handler, wrapper,\n );\n this.emitter.on(\n eventName, wrapper,\n );\n }\n\n off<TEventName extends keyof WithHeightAndUUID<EventMap> & string>(\n eventName: TEventName,\n handler: (eventArg: WithHeightAndUUID<EventMap>[TEventName]) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count && count > 1) {\n this.handled.set(\n eventName, count - 1,\n );\n }\n else {\n this.handled.delete(eventName);\n }\n const wrapper = this.handlerMap.get(handler);\n if (wrapper) {\n this.emitter.off(\n eventName, wrapper,\n );\n this.handlerMap.delete(handler);\n }\n }\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,iBAAb,MAA4B
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["EventEmitter"],"sources":["../../src/emitter/index.ts"],"sourcesContent":["import {\n EventEmitter,\n} from \"node:events\";\n\nimport {\n WithHeightAndUUID,\n} from \"../types/index.js\";\n\n/**\n * Custom event emitter that provides type-safe event handling for blockchain indexing\n * Extends Node.js EventEmitter with UUID tracking and error handling capabilities\n */\nexport class EclesiaEmitter {\n /** Internal Node.js EventEmitter instance */\n private emitter = new EventEmitter();\n\n /** Map tracking the number of handlers registered for each event type */\n public handled = new Map<string, number>();\n\n /** WeakMap storing wrapper functions for proper cleanup */\n private handlerMap = new WeakMap();\n\n /**\n * Creates a new EclesiaEmitter instance\n * Sets max listeners to 0 (unlimited) to handle many modules\n */\n constructor() {\n this.emitter.setMaxListeners(0);\n }\n\n emit<EType extends keyof (WithHeightAndUUID<EventMap>) & string>(\n eventName: EType,\n eventArg: WithHeightAndUUID<EventMap>[EType] & {\n uuid?: string\n },\n ) {\n if (this.handled.has(eventName)) {\n this.emitter.emit(\n eventName, eventArg,\n );\n }\n else {\n this.emitter.emit(\n \"_unhandled\", {\n type: eventName as string,\n event: eventArg,\n uuid: eventArg.uuid,\n },\n );\n }\n }\n\n on<TEventName extends keyof WithHeightAndUUID<EventMap> & string | \"_unhandled\">(\n eventName: TEventName,\n handler: TEventName extends \"_unhandled\"\n ? (eventArg: {\n type: string\n event: unknown\n uuid: string\n }) => void\n : (eventArg: TEventName extends keyof WithHeightAndUUID<EventMap> ? WithHeightAndUUID<EventMap>[TEventName] : never) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count) {\n this.handled.set(\n eventName, count + 1,\n );\n }\n else {\n this.handled.set(\n eventName, 1,\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const wrapper = async (eventData: any) => {\n try {\n await handler(eventData);\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: true,\n uuid: eventData.uuid,\n },\n );\n }\n }\n catch (error) {\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: false,\n error: error as string,\n uuid: eventData.uuid,\n },\n );\n }\n }\n };\n this.handlerMap.set(\n handler, wrapper,\n );\n this.emitter.on(\n eventName, wrapper,\n );\n }\n\n off<TEventName extends keyof WithHeightAndUUID<EventMap> & string>(\n eventName: TEventName,\n handler: (eventArg: WithHeightAndUUID<EventMap>[TEventName]) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count && count > 1) {\n this.handled.set(\n eventName, count - 1,\n );\n }\n else {\n this.handled.delete(eventName);\n }\n const wrapper = this.handlerMap.get(handler);\n if (wrapper) {\n this.emitter.off(\n eventName, wrapper,\n );\n this.handlerMap.delete(handler);\n }\n }\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,iBAAb,MAA4B;;CAE1B,AAAQ,UAAU,IAAIA,qBAAc;;CAGpC,AAAO,0BAAU,IAAI,KAAqB;;CAG1C,AAAQ,6BAAa,IAAI,SAAS;;;;;CAMlC,cAAc;AACZ,OAAK,QAAQ,gBAAgB,EAAE;;CAGjC,KACE,WACA,UAGA;AACA,MAAI,KAAK,QAAQ,IAAI,UAAU,CAC7B,MAAK,QAAQ,KACX,WAAW,SACZ;MAGD,MAAK,QAAQ,KACX,cAAc;GACZ,MAAM;GACN,OAAO;GACP,MAAM,SAAS;GAChB,CACF;;CAIL,GACE,WACA,SAOA;EACA,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;AACzC,MAAI,MACF,MAAK,QAAQ,IACX,WAAW,QAAQ,EACpB;MAGD,MAAK,QAAQ,IACX,WAAW,EACZ;EAGH,MAAM,UAAU,OAAO,cAAmB;AACxC,OAAI;AACF,UAAM,QAAQ,UAAU;AACxB,QAAI,cAAc,UAAU,cAAc,gBAAgB,UAAU,KAClE,MAAK,KACH,QAAQ;KACN,QAAQ;KACR,MAAM,UAAU;KACjB,CACF;YAGE,OAAO;AACZ,QAAI,cAAc,UAAU,cAAc,gBAAgB,UAAU,KAClE,MAAK,KACH,QAAQ;KACN,QAAQ;KACD;KACP,MAAM,UAAU;KACjB,CACF;;;AAIP,OAAK,WAAW,IACd,SAAS,QACV;AACD,OAAK,QAAQ,GACX,WAAW,QACZ;;CAGH,IACE,WACA,SACA;EACA,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;AACzC,MAAI,SAAS,QAAQ,EACnB,MAAK,QAAQ,IACX,WAAW,QAAQ,EACpB;MAGD,MAAK,QAAQ,OAAO,UAAU;EAEhC,MAAM,UAAU,KAAK,WAAW,IAAI,QAAQ;AAC5C,MAAI,SAAS;AACX,QAAK,QAAQ,IACX,WAAW,QACZ;AACD,QAAK,WAAW,OAAO,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/emitter/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/emitter/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;AAkB8C,cAlBjC,cAAA,CAkBiC;EAAlB;EACb,QAAA,OAAA;EACiB;EAAlB,OAAA,EAfE,GAeF,CAAA,MAAA,EAAA,MAAA,CAAA;EAA4B;EAoBM,QAAA,UAAA;EAAlB;;;;EAQgC,WAAA,CAAA;EAAlB,IAAA,CAAA,cAAA,MAAA,CA9BhB,iBA8BgB,CA9BE,QA8BF,CAAA,CAAA,GAAA,MAAA,CAAA,CAAA,SAAA,EA7B7B,KA6B6B,EAAA,QAAA,EA5B9B,iBA4B8B,CA5BZ,QA4BY,CAAA,CA5BF,KA4BE,CAAA,GAAA;IAAgD,IAAA,CAAA,EAAA,MAAA;EAAlB,CAAA,CAAA,EAAA,IAAA;EAA4B,EAAA,CAAA,mBAAA,MARxE,iBAQwE,CARtD,QAQsD,CAAA,GAAA,MAAA,GAAA,YAAA,CAAA,CAAA,SAAA,EAPvF,UAOuF,EAAA,OAAA,EANzF,UAMyF,SAAA,YAAA,GAAA,CAAA,QAAA,EAAA;IA8CrD,IAAA,EAAA,MAAA;IAAlB,KAAA,EAAA,OAAA;IAChB,IAAA,EAAA,MAAA;EAC2B,CAAA,EAAA,GAAA,IAAA,GAAA,CAAA,QAAA,EAhDvB,UAgDuB,SAAA,MAhDE,iBAgDF,CAhDoB,QAgDpB,CAAA,GAhDgC,iBAgDhC,CAhDkD,QAgDlD,CAAA,CAhD4D,UAgD5D,CAAA,GAAA,KAAA,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA;EAAlB,GAAA,CAAA,mBAAA,MAFO,iBAEP,CAFyB,QAEzB,CAAA,GAAA,MAAA,CAAA,CAAA,SAAA,EADT,UACS,EAAA,OAAA,EAAA,CAAA,QAAA,EAAA,iBAAA,CAAkB,QAAlB,CAAA,CAA4B,UAA5B,CAAA,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WithHeightAndUUID } from "../types/index.
|
|
1
|
+
import { WithHeightAndUUID } from "../types/index.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/emitter/index.d.ts
|
|
4
4
|
|
|
@@ -30,4 +30,4 @@ declare class EclesiaEmitter {
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
export { EclesiaEmitter };
|
|
33
|
-
//# sourceMappingURL=index.d.
|
|
33
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/emitter/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;;AAkB8C,cAlBjC,cAAA,CAkBiC;EAAlB;EACb,QAAA,OAAA;EACiB;EAAlB,OAAA,EAfE,GAeF,CAAA,MAAA,EAAA,MAAA,CAAA;EAA4B;EAoBM,QAAA,UAAA;EAAlB;;;;EAQgC,WAAA,CAAA;EAAlB,IAAA,CAAA,cAAA,MAAA,CA9BhB,iBA8BgB,CA9BE,QA8BF,CAAA,CAAA,GAAA,MAAA,CAAA,CAAA,SAAA,EA7B7B,KA6B6B,EAAA,QAAA,EA5B9B,iBA4B8B,CA5BZ,QA4BY,CAAA,CA5BF,KA4BE,CAAA,GAAA;IAAgD,IAAA,CAAA,EAAA,MAAA;EAAlB,CAAA,CAAA,EAAA,IAAA;EAA4B,EAAA,CAAA,mBAAA,MARxE,iBAQwE,CARtD,QAQsD,CAAA,GAAA,MAAA,GAAA,YAAA,CAAA,CAAA,SAAA,EAPvF,UAOuF,EAAA,OAAA,EANzF,UAMyF,SAAA,YAAA,GAAA,CAAA,QAAA,EAAA;IA8CrD,IAAA,EAAA,MAAA;IAAlB,KAAA,EAAA,OAAA;IAChB,IAAA,EAAA,MAAA;EAC2B,CAAA,EAAA,GAAA,IAAA,GAAA,CAAA,QAAA,EAhDvB,UAgDuB,SAAA,MAhDE,iBAgDF,CAhDoB,QAgDpB,CAAA,GAhDgC,iBAgDhC,CAhDkD,QAgDlD,CAAA,CAhD4D,UAgD5D,CAAA,GAAA,KAAA,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA;EAAlB,GAAA,CAAA,mBAAA,MAFO,iBAEP,CAFyB,QAEzB,CAAA,GAAA,MAAA,CAAA,CAAA,SAAA,EADT,UACS,EAAA,OAAA,EAAA,CAAA,QAAA,EAAA,iBAAA,CAAkB,QAAlB,CAAA,CAA4B,UAA5B,CAAA,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA"}
|
|
@@ -6,14 +6,17 @@ import { EventEmitter } from "node:events";
|
|
|
6
6
|
* Extends Node.js EventEmitter with UUID tracking and error handling capabilities
|
|
7
7
|
*/
|
|
8
8
|
var EclesiaEmitter = class {
|
|
9
|
+
/** Internal Node.js EventEmitter instance */
|
|
10
|
+
emitter = new EventEmitter();
|
|
11
|
+
/** Map tracking the number of handlers registered for each event type */
|
|
12
|
+
handled = /* @__PURE__ */ new Map();
|
|
13
|
+
/** WeakMap storing wrapper functions for proper cleanup */
|
|
14
|
+
handlerMap = /* @__PURE__ */ new WeakMap();
|
|
9
15
|
/**
|
|
10
16
|
* Creates a new EclesiaEmitter instance
|
|
11
17
|
* Sets max listeners to 0 (unlimited) to handle many modules
|
|
12
18
|
*/
|
|
13
19
|
constructor() {
|
|
14
|
-
this.emitter = new EventEmitter();
|
|
15
|
-
this.handled = /* @__PURE__ */ new Map();
|
|
16
|
-
this.handlerMap = /* @__PURE__ */ new WeakMap();
|
|
17
20
|
this.emitter.setMaxListeners(0);
|
|
18
21
|
}
|
|
19
22
|
emit(eventName, eventArg) {
|
|
@@ -60,4 +63,4 @@ var EclesiaEmitter = class {
|
|
|
60
63
|
|
|
61
64
|
//#endregion
|
|
62
65
|
export { EclesiaEmitter };
|
|
63
|
-
//# sourceMappingURL=index.
|
|
66
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/emitter/index.ts"],"sourcesContent":["import {\n EventEmitter,\n} from \"node:events\";\n\nimport {\n WithHeightAndUUID,\n} from \"../types/index.js\";\n\n/**\n * Custom event emitter that provides type-safe event handling for blockchain indexing\n * Extends Node.js EventEmitter with UUID tracking and error handling capabilities\n */\nexport class EclesiaEmitter {\n /** Internal Node.js EventEmitter instance */\n private emitter = new EventEmitter();\n\n /** Map tracking the number of handlers registered for each event type */\n public handled = new Map<string, number>();\n\n /** WeakMap storing wrapper functions for proper cleanup */\n private handlerMap = new WeakMap();\n\n /**\n * Creates a new EclesiaEmitter instance\n * Sets max listeners to 0 (unlimited) to handle many modules\n */\n constructor() {\n this.emitter.setMaxListeners(0);\n }\n\n emit<EType extends keyof (WithHeightAndUUID<EventMap>) & string>(\n eventName: EType,\n eventArg: WithHeightAndUUID<EventMap>[EType] & {\n uuid?: string\n },\n ) {\n if (this.handled.has(eventName)) {\n this.emitter.emit(\n eventName, eventArg,\n );\n }\n else {\n this.emitter.emit(\n \"_unhandled\", {\n type: eventName as string,\n event: eventArg,\n uuid: eventArg.uuid,\n },\n );\n }\n }\n\n on<TEventName extends keyof WithHeightAndUUID<EventMap> & string | \"_unhandled\">(\n eventName: TEventName,\n handler: TEventName extends \"_unhandled\"\n ? (eventArg: {\n type: string\n event: unknown\n uuid: string\n }) => void\n : (eventArg: TEventName extends keyof WithHeightAndUUID<EventMap> ? WithHeightAndUUID<EventMap>[TEventName] : never) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count) {\n this.handled.set(\n eventName, count + 1,\n );\n }\n else {\n this.handled.set(\n eventName, 1,\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const wrapper = async (eventData: any) => {\n try {\n await handler(eventData);\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: true,\n uuid: eventData.uuid,\n },\n );\n }\n }\n catch (error) {\n if (eventName !== \"uuid\" && eventName !== \"_unhandled\" && eventData.uuid) {\n this.emit(\n \"uuid\", {\n status: false,\n error: error as string,\n uuid: eventData.uuid,\n },\n );\n }\n }\n };\n this.handlerMap.set(\n handler, wrapper,\n );\n this.emitter.on(\n eventName, wrapper,\n );\n }\n\n off<TEventName extends keyof WithHeightAndUUID<EventMap> & string>(\n eventName: TEventName,\n handler: (eventArg: WithHeightAndUUID<EventMap>[TEventName]) => void,\n ) {\n const count = this.handled.get(eventName);\n if (count && count > 1) {\n this.handled.set(\n eventName, count - 1,\n );\n }\n else {\n this.handled.delete(eventName);\n }\n const wrapper = this.handlerMap.get(handler);\n if (wrapper) {\n this.emitter.off(\n eventName, wrapper,\n );\n this.handlerMap.delete(handler);\n }\n }\n}\n"],"mappings":";;;;;;;AAYA,IAAa,iBAAb,MAA4B;;CAE1B,AAAQ,UAAU,IAAI,cAAc;;CAGpC,AAAO,0BAAU,IAAI,KAAqB;;CAG1C,AAAQ,6BAAa,IAAI,SAAS;;;;;CAMlC,cAAc;AACZ,OAAK,QAAQ,gBAAgB,EAAE;;CAGjC,KACE,WACA,UAGA;AACA,MAAI,KAAK,QAAQ,IAAI,UAAU,CAC7B,MAAK,QAAQ,KACX,WAAW,SACZ;MAGD,MAAK,QAAQ,KACX,cAAc;GACZ,MAAM;GACN,OAAO;GACP,MAAM,SAAS;GAChB,CACF;;CAIL,GACE,WACA,SAOA;EACA,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;AACzC,MAAI,MACF,MAAK,QAAQ,IACX,WAAW,QAAQ,EACpB;MAGD,MAAK,QAAQ,IACX,WAAW,EACZ;EAGH,MAAM,UAAU,OAAO,cAAmB;AACxC,OAAI;AACF,UAAM,QAAQ,UAAU;AACxB,QAAI,cAAc,UAAU,cAAc,gBAAgB,UAAU,KAClE,MAAK,KACH,QAAQ;KACN,QAAQ;KACR,MAAM,UAAU;KACjB,CACF;YAGE,OAAO;AACZ,QAAI,cAAc,UAAU,cAAc,gBAAgB,UAAU,KAClE,MAAK,KACH,QAAQ;KACN,QAAQ;KACD;KACP,MAAM,UAAU;KACjB,CACF;;;AAIP,OAAK,WAAW,IACd,SAAS,QACV;AACD,OAAK,QAAQ,GACX,WAAW,QACZ;;CAGH,IACE,WACA,SACA;EACA,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;AACzC,MAAI,SAAS,QAAQ,EACnB,MAAK,QAAQ,IACX,WAAW,QAAQ,EACpB;MAGD,MAAK,QAAQ,OAAO,UAAU;EAEhC,MAAM,UAAU,KAAK,WAAW,IAAI,QAAQ;AAC5C,MAAI,SAAS;AACX,QAAK,QAAQ,IACX,WAAW,QACZ;AACD,QAAK,WAAW,OAAO,QAAQ"}
|
package/dist/errors/index.cjs
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* Extends Error with additional context fields
|
|
10
10
|
*/
|
|
11
11
|
var IndexerError = class extends Error {
|
|
12
|
+
/** Error code for programmatic error handling */
|
|
13
|
+
code;
|
|
14
|
+
/** Additional context data for debugging */
|
|
15
|
+
context;
|
|
12
16
|
constructor(message, code = "INDEXER_ERROR", context) {
|
|
13
17
|
super(message);
|
|
14
18
|
this.name = this.constructor.name;
|
|
@@ -31,6 +35,10 @@ var ConfigurationError = class extends IndexerError {
|
|
|
31
35
|
* Thrown when RPC calls fail or connections are lost
|
|
32
36
|
*/
|
|
33
37
|
var RPCError = class extends IndexerError {
|
|
38
|
+
/** The RPC endpoint that failed */
|
|
39
|
+
endpoint;
|
|
40
|
+
/** The height being queried when error occurred */
|
|
41
|
+
height;
|
|
34
42
|
constructor(message, endpoint, height, context) {
|
|
35
43
|
super(message, "RPC_ERROR", {
|
|
36
44
|
...context,
|
|
@@ -46,6 +54,10 @@ var RPCError = class extends IndexerError {
|
|
|
46
54
|
* Thrown when database queries or transactions fail
|
|
47
55
|
*/
|
|
48
56
|
var DatabaseError = class extends IndexerError {
|
|
57
|
+
/** The SQL query that failed */
|
|
58
|
+
query;
|
|
59
|
+
/** The operation that failed (e.g., "BEGIN", "COMMIT", "ROLLBACK") */
|
|
60
|
+
operation;
|
|
49
61
|
constructor(message, operation, query, context) {
|
|
50
62
|
super(message, "DATABASE_ERROR", {
|
|
51
63
|
...context,
|
|
@@ -61,6 +73,8 @@ var DatabaseError = class extends IndexerError {
|
|
|
61
73
|
* Thrown when block data is invalid or processing fails
|
|
62
74
|
*/
|
|
63
75
|
var BlockProcessingError = class extends IndexerError {
|
|
76
|
+
/** The height of the block that failed to process */
|
|
77
|
+
height;
|
|
64
78
|
constructor(message, height, context) {
|
|
65
79
|
super(message, "BLOCK_PROCESSING_ERROR", {
|
|
66
80
|
...context,
|
|
@@ -74,6 +88,8 @@ var BlockProcessingError = class extends IndexerError {
|
|
|
74
88
|
* Thrown when indexing modules fail to initialize
|
|
75
89
|
*/
|
|
76
90
|
var ModuleError = class extends IndexerError {
|
|
91
|
+
/** The name of the module that failed */
|
|
92
|
+
moduleName;
|
|
77
93
|
constructor(message, moduleName, context) {
|
|
78
94
|
super(message, "MODULE_ERROR", {
|
|
79
95
|
...context,
|
|
@@ -87,6 +103,8 @@ var ModuleError = class extends IndexerError {
|
|
|
87
103
|
* Thrown when genesis file parsing or processing fails
|
|
88
104
|
*/
|
|
89
105
|
var GenesisError = class extends IndexerError {
|
|
106
|
+
/** Path to the genesis file */
|
|
107
|
+
genesisPath;
|
|
90
108
|
constructor(message, genesisPath, context) {
|
|
91
109
|
super(message, "GENESIS_ERROR", {
|
|
92
110
|
...context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":["/**\n * Custom error classes for the Eclesia indexer\n * These provide better context and error tracking throughout the application\n */\n\n/**\n * Base error class for all indexer errors\n * Extends Error with additional context fields\n */\nexport class IndexerError extends Error {\n /** Error code for programmatic error handling */\n public readonly code: string;\n\n /** Additional context data for debugging */\n public readonly context?: Record<string, unknown>;\n\n constructor(message: string, code: string = \"INDEXER_ERROR\", context?: Record<string, unknown>) {\n super(message);\n this.name = this.constructor.name;\n this.code = code;\n this.context = context;\n\n // Maintains proper stack trace for where error was thrown\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Configuration-related errors\n * Thrown when indexer configuration is invalid or missing\n */\nexport class ConfigurationError extends IndexerError {\n constructor(message: string, context?: Record<string, unknown>) {\n super(message, \"CONFIGURATION_ERROR\", context);\n }\n}\n\n/**\n * RPC connection and communication errors\n * Thrown when RPC calls fail or connections are lost\n */\nexport class RPCError extends IndexerError {\n /** The RPC endpoint that failed */\n public readonly endpoint?: string;\n\n /** The height being queried when error occurred */\n public readonly height?: number;\n\n constructor(\n message: string,\n endpoint?: string,\n height?: number,\n context?: Record<string, unknown>,\n ) {\n super(message, \"RPC_ERROR\", {\n ...context,\n endpoint,\n height,\n });\n this.endpoint = endpoint;\n this.height = height;\n }\n}\n\n/**\n * Database operation errors\n * Thrown when database queries or transactions fail\n */\nexport class DatabaseError extends IndexerError {\n /** The SQL query that failed */\n public readonly query?: string;\n\n /** The operation that failed (e.g., \"BEGIN\", \"COMMIT\", \"ROLLBACK\") */\n public readonly operation?: string;\n\n constructor(message: string, operation?: string, query?: string, context?: Record<string, unknown>) {\n super(message, \"DATABASE_ERROR\", {\n ...context,\n operation,\n query,\n });\n this.operation = operation;\n this.query = query;\n }\n}\n\n/**\n * Block processing errors\n * Thrown when block data is invalid or processing fails\n */\nexport class BlockProcessingError extends IndexerError {\n /** The height of the block that failed to process */\n public readonly height: number;\n\n constructor(message: string, height: number, context?: Record<string, unknown>) {\n super(message, \"BLOCK_PROCESSING_ERROR\", {\n ...context,\n height,\n });\n this.height = height;\n }\n}\n\n/**\n * Module initialization errors\n * Thrown when indexing modules fail to initialize\n */\nexport class ModuleError extends IndexerError {\n /** The name of the module that failed */\n public readonly moduleName: string;\n\n constructor(message: string, moduleName: string, context?: Record<string, unknown>) {\n super(message, \"MODULE_ERROR\", {\n ...context,\n moduleName,\n });\n this.moduleName = moduleName;\n }\n}\n\n/**\n * Genesis processing errors\n * Thrown when genesis file parsing or processing fails\n */\nexport class GenesisError extends IndexerError {\n /** Path to the genesis file */\n public readonly genesisPath?: string;\n\n constructor(message: string, genesisPath?: string, context?: Record<string, unknown>) {\n super(message, \"GENESIS_ERROR\", {\n ...context,\n genesisPath,\n });\n this.genesisPath = genesisPath;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,IAAa,eAAb,cAAkC,MAAM;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":["/**\n * Custom error classes for the Eclesia indexer\n * These provide better context and error tracking throughout the application\n */\n\n/**\n * Base error class for all indexer errors\n * Extends Error with additional context fields\n */\nexport class IndexerError extends Error {\n /** Error code for programmatic error handling */\n public readonly code: string;\n\n /** Additional context data for debugging */\n public readonly context?: Record<string, unknown>;\n\n constructor(message: string, code: string = \"INDEXER_ERROR\", context?: Record<string, unknown>) {\n super(message);\n this.name = this.constructor.name;\n this.code = code;\n this.context = context;\n\n // Maintains proper stack trace for where error was thrown\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Configuration-related errors\n * Thrown when indexer configuration is invalid or missing\n */\nexport class ConfigurationError extends IndexerError {\n constructor(message: string, context?: Record<string, unknown>) {\n super(message, \"CONFIGURATION_ERROR\", context);\n }\n}\n\n/**\n * RPC connection and communication errors\n * Thrown when RPC calls fail or connections are lost\n */\nexport class RPCError extends IndexerError {\n /** The RPC endpoint that failed */\n public readonly endpoint?: string;\n\n /** The height being queried when error occurred */\n public readonly height?: number;\n\n constructor(\n message: string,\n endpoint?: string,\n height?: number,\n context?: Record<string, unknown>,\n ) {\n super(message, \"RPC_ERROR\", {\n ...context,\n endpoint,\n height,\n });\n this.endpoint = endpoint;\n this.height = height;\n }\n}\n\n/**\n * Database operation errors\n * Thrown when database queries or transactions fail\n */\nexport class DatabaseError extends IndexerError {\n /** The SQL query that failed */\n public readonly query?: string;\n\n /** The operation that failed (e.g., \"BEGIN\", \"COMMIT\", \"ROLLBACK\") */\n public readonly operation?: string;\n\n constructor(message: string, operation?: string, query?: string, context?: Record<string, unknown>) {\n super(message, \"DATABASE_ERROR\", {\n ...context,\n operation,\n query,\n });\n this.operation = operation;\n this.query = query;\n }\n}\n\n/**\n * Block processing errors\n * Thrown when block data is invalid or processing fails\n */\nexport class BlockProcessingError extends IndexerError {\n /** The height of the block that failed to process */\n public readonly height: number;\n\n constructor(message: string, height: number, context?: Record<string, unknown>) {\n super(message, \"BLOCK_PROCESSING_ERROR\", {\n ...context,\n height,\n });\n this.height = height;\n }\n}\n\n/**\n * Module initialization errors\n * Thrown when indexing modules fail to initialize\n */\nexport class ModuleError extends IndexerError {\n /** The name of the module that failed */\n public readonly moduleName: string;\n\n constructor(message: string, moduleName: string, context?: Record<string, unknown>) {\n super(message, \"MODULE_ERROR\", {\n ...context,\n moduleName,\n });\n this.moduleName = moduleName;\n }\n}\n\n/**\n * Genesis processing errors\n * Thrown when genesis file parsing or processing fails\n */\nexport class GenesisError extends IndexerError {\n /** Path to the genesis file */\n public readonly genesisPath?: string;\n\n constructor(message: string, genesisPath?: string, context?: Record<string, unknown>) {\n super(message, \"GENESIS_ERROR\", {\n ...context,\n genesisPath,\n });\n this.genesisPath = genesisPath;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,IAAa,eAAb,cAAkC,MAAM;;CAEtC,AAAgB;;CAGhB,AAAgB;CAEhB,YAAY,SAAiB,OAAe,iBAAiB,SAAmC;AAC9F,QAAM,QAAQ;AACd,OAAK,OAAO,KAAK,YAAY;AAC7B,OAAK,OAAO;AACZ,OAAK,UAAU;AAGf,MAAI,MAAM,kBACR,OAAM,kBAAkB,MAAM,KAAK,YAAY;;;;;;;AASrD,IAAa,qBAAb,cAAwC,aAAa;CACnD,YAAY,SAAiB,SAAmC;AAC9D,QAAM,SAAS,uBAAuB,QAAQ;;;;;;;AAQlD,IAAa,WAAb,cAA8B,aAAa;;CAEzC,AAAgB;;CAGhB,AAAgB;CAEhB,YACE,SACA,UACA,QACA,SACA;AACA,QAAM,SAAS,aAAa;GAC1B,GAAG;GACH;GACA;GACD,CAAC;AACF,OAAK,WAAW;AAChB,OAAK,SAAS;;;;;;;AAQlB,IAAa,gBAAb,cAAmC,aAAa;;CAE9C,AAAgB;;CAGhB,AAAgB;CAEhB,YAAY,SAAiB,WAAoB,OAAgB,SAAmC;AAClG,QAAM,SAAS,kBAAkB;GAC/B,GAAG;GACH;GACA;GACD,CAAC;AACF,OAAK,YAAY;AACjB,OAAK,QAAQ;;;;;;;AAQjB,IAAa,uBAAb,cAA0C,aAAa;;CAErD,AAAgB;CAEhB,YAAY,SAAiB,QAAgB,SAAmC;AAC9E,QAAM,SAAS,0BAA0B;GACvC,GAAG;GACH;GACD,CAAC;AACF,OAAK,SAAS;;;;;;;AAQlB,IAAa,cAAb,cAAiC,aAAa;;CAE5C,AAAgB;CAEhB,YAAY,SAAiB,YAAoB,SAAmC;AAClF,QAAM,SAAS,gBAAgB;GAC7B,GAAG;GACH;GACD,CAAC;AACF,OAAK,aAAa;;;;;;;AAQtB,IAAa,eAAb,cAAkC,aAAa;;CAE7C,AAAgB;CAEhB,YAAY,SAAiB,aAAsB,SAAmC;AACpF,QAAM,SAAS,iBAAiB;GAC9B,GAAG;GACH;GACD,CAAC;AACF,OAAK,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":[],"mappings":";;AASA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":[],"mappings":";;AASA;;;;;AAwBA;AAUA;AA2Ba,cA7DA,YAAA,SAAqB,KAAA,CA6DC;EAsBtB;EAiBA,SAAA,IAAA,EAAY,MAAA;EAiBZ;qBAhHe;wDAE6C;;;;;;cAiB5D,kBAAA,SAA2B,YAAA;yCACC;;;;;;cAS5B,QAAA,SAAiB,YAAA;;;;;6EAWhB;;;;;;cAgBD,aAAA,SAAsB,YAAA;;;;;6EAO0C;;;;;;cAehE,oBAAA,SAA6B,YAAA;;;yDAIe;;;;;;cAa5C,WAAA,SAAoB,YAAA;;;6DAI4B;;;;;;cAahD,YAAA,SAAqB,YAAA;;;+DAI6B"}
|
|
@@ -72,4 +72,4 @@ declare class GenesisError extends IndexerError {
|
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
74
|
export { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError };
|
|
75
|
-
//# sourceMappingURL=index.d.
|
|
75
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":[],"mappings":";;AASA;;;;;AAwBA;AAUA;AA2Ba,cA7DA,YAAA,SAAqB,KAAA,CA6DC;EAsBtB;EAiBA,SAAA,IAAA,EAAY,MAAA;EAiBZ;qBAhHe;wDAE6C;;;;;;cAiB5D,kBAAA,SAA2B,YAAA;yCACC;;;;;;cAS5B,QAAA,SAAiB,YAAA;;;;;6EAWhB;;;;;;cAgBD,aAAA,SAAsB,YAAA;;;;;6EAO0C;;;;;;cAehE,oBAAA,SAA6B,YAAA;;;yDAIe;;;;;;cAa5C,WAAA,SAAoB,YAAA;;;6DAI4B;;;;;;cAahD,YAAA,SAAqB,YAAA;;;+DAI6B"}
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* Extends Error with additional context fields
|
|
9
9
|
*/
|
|
10
10
|
var IndexerError = class extends Error {
|
|
11
|
+
/** Error code for programmatic error handling */
|
|
12
|
+
code;
|
|
13
|
+
/** Additional context data for debugging */
|
|
14
|
+
context;
|
|
11
15
|
constructor(message, code = "INDEXER_ERROR", context) {
|
|
12
16
|
super(message);
|
|
13
17
|
this.name = this.constructor.name;
|
|
@@ -30,6 +34,10 @@ var ConfigurationError = class extends IndexerError {
|
|
|
30
34
|
* Thrown when RPC calls fail or connections are lost
|
|
31
35
|
*/
|
|
32
36
|
var RPCError = class extends IndexerError {
|
|
37
|
+
/** The RPC endpoint that failed */
|
|
38
|
+
endpoint;
|
|
39
|
+
/** The height being queried when error occurred */
|
|
40
|
+
height;
|
|
33
41
|
constructor(message, endpoint, height, context) {
|
|
34
42
|
super(message, "RPC_ERROR", {
|
|
35
43
|
...context,
|
|
@@ -45,6 +53,10 @@ var RPCError = class extends IndexerError {
|
|
|
45
53
|
* Thrown when database queries or transactions fail
|
|
46
54
|
*/
|
|
47
55
|
var DatabaseError = class extends IndexerError {
|
|
56
|
+
/** The SQL query that failed */
|
|
57
|
+
query;
|
|
58
|
+
/** The operation that failed (e.g., "BEGIN", "COMMIT", "ROLLBACK") */
|
|
59
|
+
operation;
|
|
48
60
|
constructor(message, operation, query, context) {
|
|
49
61
|
super(message, "DATABASE_ERROR", {
|
|
50
62
|
...context,
|
|
@@ -60,6 +72,8 @@ var DatabaseError = class extends IndexerError {
|
|
|
60
72
|
* Thrown when block data is invalid or processing fails
|
|
61
73
|
*/
|
|
62
74
|
var BlockProcessingError = class extends IndexerError {
|
|
75
|
+
/** The height of the block that failed to process */
|
|
76
|
+
height;
|
|
63
77
|
constructor(message, height, context) {
|
|
64
78
|
super(message, "BLOCK_PROCESSING_ERROR", {
|
|
65
79
|
...context,
|
|
@@ -73,6 +87,8 @@ var BlockProcessingError = class extends IndexerError {
|
|
|
73
87
|
* Thrown when indexing modules fail to initialize
|
|
74
88
|
*/
|
|
75
89
|
var ModuleError = class extends IndexerError {
|
|
90
|
+
/** The name of the module that failed */
|
|
91
|
+
moduleName;
|
|
76
92
|
constructor(message, moduleName, context) {
|
|
77
93
|
super(message, "MODULE_ERROR", {
|
|
78
94
|
...context,
|
|
@@ -86,6 +102,8 @@ var ModuleError = class extends IndexerError {
|
|
|
86
102
|
* Thrown when genesis file parsing or processing fails
|
|
87
103
|
*/
|
|
88
104
|
var GenesisError = class extends IndexerError {
|
|
105
|
+
/** Path to the genesis file */
|
|
106
|
+
genesisPath;
|
|
89
107
|
constructor(message, genesisPath, context) {
|
|
90
108
|
super(message, "GENESIS_ERROR", {
|
|
91
109
|
...context,
|
|
@@ -97,4 +115,4 @@ var GenesisError = class extends IndexerError {
|
|
|
97
115
|
|
|
98
116
|
//#endregion
|
|
99
117
|
export { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError };
|
|
100
|
-
//# sourceMappingURL=index.
|
|
118
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":["/**\n * Custom error classes for the Eclesia indexer\n * These provide better context and error tracking throughout the application\n */\n\n/**\n * Base error class for all indexer errors\n * Extends Error with additional context fields\n */\nexport class IndexerError extends Error {\n /** Error code for programmatic error handling */\n public readonly code: string;\n\n /** Additional context data for debugging */\n public readonly context?: Record<string, unknown>;\n\n constructor(message: string, code: string = \"INDEXER_ERROR\", context?: Record<string, unknown>) {\n super(message);\n this.name = this.constructor.name;\n this.code = code;\n this.context = context;\n\n // Maintains proper stack trace for where error was thrown\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Configuration-related errors\n * Thrown when indexer configuration is invalid or missing\n */\nexport class ConfigurationError extends IndexerError {\n constructor(message: string, context?: Record<string, unknown>) {\n super(message, \"CONFIGURATION_ERROR\", context);\n }\n}\n\n/**\n * RPC connection and communication errors\n * Thrown when RPC calls fail or connections are lost\n */\nexport class RPCError extends IndexerError {\n /** The RPC endpoint that failed */\n public readonly endpoint?: string;\n\n /** The height being queried when error occurred */\n public readonly height?: number;\n\n constructor(\n message: string,\n endpoint?: string,\n height?: number,\n context?: Record<string, unknown>,\n ) {\n super(message, \"RPC_ERROR\", {\n ...context,\n endpoint,\n height,\n });\n this.endpoint = endpoint;\n this.height = height;\n }\n}\n\n/**\n * Database operation errors\n * Thrown when database queries or transactions fail\n */\nexport class DatabaseError extends IndexerError {\n /** The SQL query that failed */\n public readonly query?: string;\n\n /** The operation that failed (e.g., \"BEGIN\", \"COMMIT\", \"ROLLBACK\") */\n public readonly operation?: string;\n\n constructor(message: string, operation?: string, query?: string, context?: Record<string, unknown>) {\n super(message, \"DATABASE_ERROR\", {\n ...context,\n operation,\n query,\n });\n this.operation = operation;\n this.query = query;\n }\n}\n\n/**\n * Block processing errors\n * Thrown when block data is invalid or processing fails\n */\nexport class BlockProcessingError extends IndexerError {\n /** The height of the block that failed to process */\n public readonly height: number;\n\n constructor(message: string, height: number, context?: Record<string, unknown>) {\n super(message, \"BLOCK_PROCESSING_ERROR\", {\n ...context,\n height,\n });\n this.height = height;\n }\n}\n\n/**\n * Module initialization errors\n * Thrown when indexing modules fail to initialize\n */\nexport class ModuleError extends IndexerError {\n /** The name of the module that failed */\n public readonly moduleName: string;\n\n constructor(message: string, moduleName: string, context?: Record<string, unknown>) {\n super(message, \"MODULE_ERROR\", {\n ...context,\n moduleName,\n });\n this.moduleName = moduleName;\n }\n}\n\n/**\n * Genesis processing errors\n * Thrown when genesis file parsing or processing fails\n */\nexport class GenesisError extends IndexerError {\n /** Path to the genesis file */\n public readonly genesisPath?: string;\n\n constructor(message: string, genesisPath?: string, context?: Record<string, unknown>) {\n super(message, \"GENESIS_ERROR\", {\n ...context,\n genesisPath,\n });\n this.genesisPath = genesisPath;\n }\n}\n"],"mappings":";;;;;;;;;AASA,IAAa,eAAb,cAAkC,MAAM;;CAEtC,AAAgB;;CAGhB,AAAgB;CAEhB,YAAY,SAAiB,OAAe,iBAAiB,SAAmC;AAC9F,QAAM,QAAQ;AACd,OAAK,OAAO,KAAK,YAAY;AAC7B,OAAK,OAAO;AACZ,OAAK,UAAU;AAGf,MAAI,MAAM,kBACR,OAAM,kBAAkB,MAAM,KAAK,YAAY;;;;;;;AASrD,IAAa,qBAAb,cAAwC,aAAa;CACnD,YAAY,SAAiB,SAAmC;AAC9D,QAAM,SAAS,uBAAuB,QAAQ;;;;;;;AAQlD,IAAa,WAAb,cAA8B,aAAa;;CAEzC,AAAgB;;CAGhB,AAAgB;CAEhB,YACE,SACA,UACA,QACA,SACA;AACA,QAAM,SAAS,aAAa;GAC1B,GAAG;GACH;GACA;GACD,CAAC;AACF,OAAK,WAAW;AAChB,OAAK,SAAS;;;;;;;AAQlB,IAAa,gBAAb,cAAmC,aAAa;;CAE9C,AAAgB;;CAGhB,AAAgB;CAEhB,YAAY,SAAiB,WAAoB,OAAgB,SAAmC;AAClG,QAAM,SAAS,kBAAkB;GAC/B,GAAG;GACH;GACA;GACD,CAAC;AACF,OAAK,YAAY;AACjB,OAAK,QAAQ;;;;;;;AAQjB,IAAa,uBAAb,cAA0C,aAAa;;CAErD,AAAgB;CAEhB,YAAY,SAAiB,QAAgB,SAAmC;AAC9E,QAAM,SAAS,0BAA0B;GACvC,GAAG;GACH;GACD,CAAC;AACF,OAAK,SAAS;;;;;;;AAQlB,IAAa,cAAb,cAAiC,aAAa;;CAE5C,AAAgB;CAEhB,YAAY,SAAiB,YAAoB,SAAmC;AAClF,QAAM,SAAS,gBAAgB;GAC7B,GAAG;GACH;GACD,CAAC;AACF,OAAK,aAAa;;;;;;;AAQtB,IAAa,eAAb,cAAkC,aAAa;;CAE7C,AAAgB;CAEhB,YAAY,SAAiB,aAAsB,SAAmC;AACpF,QAAM,SAAS,iBAAiB;GAC9B,GAAG;GACH;GACD,CAAC;AACF,OAAK,cAAc"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,8 @@ const require_index$3 = require('./promise-queue/index.cjs');
|
|
|
6
6
|
const require_index$4 = require('./utils/index.cjs');
|
|
7
7
|
const require_index$5 = require('./validation/index.cjs');
|
|
8
8
|
const require_index$6 = require('./indexer/index.cjs');
|
|
9
|
-
const require_index$7 = require('./
|
|
9
|
+
const require_index$7 = require('./mocks/index.cjs');
|
|
10
|
+
const require_index$8 = require('./types/index.cjs');
|
|
10
11
|
|
|
11
12
|
exports.BlockProcessingError = require_index$1.BlockProcessingError;
|
|
12
13
|
exports.CircularBuffer = require_index$3.CircularBuffer;
|
|
@@ -15,6 +16,7 @@ exports.DB_CLIENT_RECYCLE_COUNT = require_constants.DB_CLIENT_RECYCLE_COUNT;
|
|
|
15
16
|
exports.DEFAULT_BATCH_SIZE = require_constants.DEFAULT_BATCH_SIZE;
|
|
16
17
|
exports.DEFAULT_HEALTH_CHECK_PORT = require_constants.DEFAULT_HEALTH_CHECK_PORT;
|
|
17
18
|
exports.DEFAULT_POLLING_INTERVAL_MS = require_constants.DEFAULT_POLLING_INTERVAL_MS;
|
|
19
|
+
exports.DEFAULT_PROMETHEUS_PORT = require_constants.DEFAULT_PROMETHEUS_PORT;
|
|
18
20
|
exports.DEFAULT_START_HEIGHT = require_constants.DEFAULT_START_HEIGHT;
|
|
19
21
|
exports.DatabaseError = require_index$1.DatabaseError;
|
|
20
22
|
exports.EcleciaIndexer = require_index$6.EcleciaIndexer;
|
|
@@ -23,6 +25,12 @@ exports.GENESIS_BATCH_SIZE = require_constants.GENESIS_BATCH_SIZE;
|
|
|
23
25
|
exports.GenesisError = require_index$1.GenesisError;
|
|
24
26
|
exports.IndexerError = require_index$1.IndexerError;
|
|
25
27
|
exports.IndexerMetrics = require_index$2.IndexerMetrics;
|
|
28
|
+
Object.defineProperty(exports, 'Mocks', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return require_index$7.mocks_exports;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
26
34
|
exports.ModuleError = require_index$1.ModuleError;
|
|
27
35
|
exports.PAGINATION_LIMITS = require_constants.PAGINATION_LIMITS;
|
|
28
36
|
exports.PERIODIC_INTERVALS = require_constants.PERIODIC_INTERVALS;
|
|
@@ -33,7 +41,7 @@ exports.RPC_TIMEOUT_MS = require_constants.RPC_TIMEOUT_MS;
|
|
|
33
41
|
Object.defineProperty(exports, 'Types', {
|
|
34
42
|
enumerable: true,
|
|
35
43
|
get: function () {
|
|
36
|
-
return require_index$
|
|
44
|
+
return require_index$8.types_exports;
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
Object.defineProperty(exports, 'Utils', {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS } from "./constants.cjs";
|
|
1
|
+
import { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS } from "./constants.cjs";
|
|
2
2
|
import { IndexerMetrics } from "./metrics/index.cjs";
|
|
3
3
|
import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.cjs";
|
|
4
4
|
import { CircularBuffer, PromiseQueue } from "./promise-queue/index.cjs";
|
|
5
|
-
import { index_d_exports } from "./types/index.cjs";
|
|
5
|
+
import { index_d_exports as index_d_exports$1 } from "./types/index.cjs";
|
|
6
6
|
import { EclesiaEmitter } from "./emitter/index.cjs";
|
|
7
7
|
import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.cjs";
|
|
8
|
-
import { index_d_exports
|
|
9
|
-
import { index_d_exports as index_d_exports$2 } from "./
|
|
10
|
-
|
|
8
|
+
import { index_d_exports } from "./mocks/index.cjs";
|
|
9
|
+
import { index_d_exports as index_d_exports$2 } from "./utils/index.cjs";
|
|
10
|
+
import { index_d_exports as index_d_exports$3 } from "./validation/index.cjs";
|
|
11
|
+
export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, index_d_exports as Mocks, ModuleError, PAGINATION_LIMITS, PERIODIC_INTERVALS, PromiseQueue, QUEUE_DEQUEUE_TIMEOUT_MS, RPCError, RPC_TIMEOUT_MS, index_d_exports$1 as Types, index_d_exports$2 as Utils, index_d_exports$3 as Validation, defaultIndexerConfig };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS } from "./constants.mjs";
|
|
2
|
+
import { IndexerMetrics } from "./metrics/index.mjs";
|
|
3
|
+
import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.mjs";
|
|
4
|
+
import { CircularBuffer, PromiseQueue } from "./promise-queue/index.mjs";
|
|
5
|
+
import { index_d_exports as index_d_exports$1 } from "./types/index.mjs";
|
|
6
|
+
import { EclesiaEmitter } from "./emitter/index.mjs";
|
|
7
|
+
import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.mjs";
|
|
8
|
+
import { index_d_exports } from "./mocks/index.mjs";
|
|
9
|
+
import { index_d_exports as index_d_exports$2 } from "./utils/index.mjs";
|
|
10
|
+
import { index_d_exports as index_d_exports$3 } from "./validation/index.mjs";
|
|
11
|
+
export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, index_d_exports as Mocks, ModuleError, PAGINATION_LIMITS, PERIODIC_INTERVALS, PromiseQueue, QUEUE_DEQUEUE_TIMEOUT_MS, RPCError, RPC_TIMEOUT_MS, index_d_exports$1 as Types, index_d_exports$2 as Utils, index_d_exports$3 as Validation, defaultIndexerConfig };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, GENESIS_BATCH_SIZE, PAGINATION_LIMITS, PERIODIC_INTERVALS, QUEUE_DEQUEUE_TIMEOUT_MS, RPC_TIMEOUT_MS } from "./constants.mjs";
|
|
2
|
+
import { EclesiaEmitter } from "./emitter/index.mjs";
|
|
3
|
+
import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.mjs";
|
|
4
|
+
import { IndexerMetrics } from "./metrics/index.mjs";
|
|
5
|
+
import { CircularBuffer, PromiseQueue } from "./promise-queue/index.mjs";
|
|
6
|
+
import { utils_exports } from "./utils/index.mjs";
|
|
7
|
+
import { validation_exports } from "./validation/index.mjs";
|
|
8
|
+
import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.mjs";
|
|
9
|
+
import { mocks_exports } from "./mocks/index.mjs";
|
|
10
|
+
import { types_exports } from "./types/index.mjs";
|
|
11
|
+
|
|
12
|
+
export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_PROMETHEUS_PORT, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, mocks_exports as Mocks, ModuleError, PAGINATION_LIMITS, PERIODIC_INTERVALS, PromiseQueue, QUEUE_DEQUEUE_TIMEOUT_MS, RPCError, RPC_TIMEOUT_MS, types_exports as Types, utils_exports as Utils, validation_exports as Validation, defaultIndexerConfig };
|