@eclesia/indexer-engine 2.9.9 → 2.10.0-next.0
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/constants.cjs +74 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +68 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.ts +68 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +64 -0
- package/dist/constants.js.map +1 -0
- package/dist/emitter/index.cjs +0 -1
- package/dist/emitter/index.cjs.map +1 -1
- package/dist/errors/index.cjs +107 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +75 -0
- package/dist/errors/index.d.cts.map +1 -0
- package/dist/errors/index.d.ts +75 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +100 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.cjs +38 -10
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/indexer/index.cjs +51 -27
- package/dist/indexer/index.cjs.map +1 -1
- package/dist/indexer/index.d.cts +1 -0
- package/dist/indexer/index.d.cts.map +1 -1
- package/dist/indexer/index.d.ts +1 -0
- package/dist/indexer/index.d.ts.map +1 -1
- package/dist/indexer/index.js +51 -20
- package/dist/indexer/index.js.map +1 -1
- package/dist/metrics/index.cjs +146 -0
- package/dist/metrics/index.cjs.map +1 -0
- package/dist/metrics/index.d.cts +56 -0
- package/dist/metrics/index.d.cts.map +1 -0
- package/dist/metrics/index.d.ts +56 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +145 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/promise-queue/index.cjs +6 -4
- package/dist/promise-queue/index.cjs.map +1 -1
- package/dist/promise-queue/index.d.cts +6 -2
- package/dist/promise-queue/index.d.cts.map +1 -1
- package/dist/promise-queue/index.d.ts +6 -2
- package/dist/promise-queue/index.d.ts.map +1 -1
- package/dist/promise-queue/index.js +6 -4
- package/dist/promise-queue/index.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +6 -0
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/bech32.cjs +0 -1
- package/dist/utils/bech32.cjs.map +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/validation/index.cjs +150 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +52 -0
- package/dist/validation/index.d.cts.map +1 -0
- package/dist/validation/index.d.ts +52 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +140 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Configuration constants for the Eclesia indexer
|
|
5
|
+
* These values control performance, timeouts, and connection management
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Number of blocks to prefetch and keep in the processing queue
|
|
9
|
+
* Higher values increase memory usage but improve throughput
|
|
10
|
+
* Recommended range: 300-1000 depending on block size and available memory
|
|
11
|
+
*/
|
|
12
|
+
const DEFAULT_BATCH_SIZE = 500;
|
|
13
|
+
/**
|
|
14
|
+
* Default start height for indexing when no previous height is found
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_START_HEIGHT = 1;
|
|
17
|
+
/**
|
|
18
|
+
* Default port for health check HTTP server
|
|
19
|
+
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_HEALTH_CHECK_PORT = 8080;
|
|
22
|
+
/**
|
|
23
|
+
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_POLLING_INTERVAL_MS = 5e3;
|
|
26
|
+
/**
|
|
27
|
+
* Timeout for RPC calls in milliseconds
|
|
28
|
+
* If a call takes longer than this, it will be rejected
|
|
29
|
+
*/
|
|
30
|
+
const RPC_TIMEOUT_MS = 2e4;
|
|
31
|
+
/**
|
|
32
|
+
* Timeout for block queue dequeue operations in milliseconds
|
|
33
|
+
* If no block is available within this time, an error will be thrown
|
|
34
|
+
*/
|
|
35
|
+
const QUEUE_DEQUEUE_TIMEOUT_MS = 3e4;
|
|
36
|
+
/**
|
|
37
|
+
* Number of successful transactions before recycling the database client
|
|
38
|
+
* Prevents long-running connection issues and stale connections
|
|
39
|
+
*/
|
|
40
|
+
const DB_CLIENT_RECYCLE_COUNT = 1500;
|
|
41
|
+
/**
|
|
42
|
+
* Block intervals for periodic event emission
|
|
43
|
+
* Used for operations that should run at regular block intervals
|
|
44
|
+
*/
|
|
45
|
+
const PERIODIC_INTERVALS = {
|
|
46
|
+
SMALL: 50,
|
|
47
|
+
MEDIUM: 100,
|
|
48
|
+
LARGE: 1e3
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Pagination limits for blockchain queries
|
|
52
|
+
*/
|
|
53
|
+
const PAGINATION_LIMITS = {
|
|
54
|
+
VALIDATORS: 1000n,
|
|
55
|
+
DELEGATIONS: 250n
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Batch size for streaming genesis file processing
|
|
59
|
+
* Number of entries to process at once from genesis JSON
|
|
60
|
+
*/
|
|
61
|
+
const GENESIS_BATCH_SIZE = 1e3;
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.DB_CLIENT_RECYCLE_COUNT = DB_CLIENT_RECYCLE_COUNT;
|
|
65
|
+
exports.DEFAULT_BATCH_SIZE = DEFAULT_BATCH_SIZE;
|
|
66
|
+
exports.DEFAULT_HEALTH_CHECK_PORT = DEFAULT_HEALTH_CHECK_PORT;
|
|
67
|
+
exports.DEFAULT_POLLING_INTERVAL_MS = DEFAULT_POLLING_INTERVAL_MS;
|
|
68
|
+
exports.DEFAULT_START_HEIGHT = DEFAULT_START_HEIGHT;
|
|
69
|
+
exports.GENESIS_BATCH_SIZE = GENESIS_BATCH_SIZE;
|
|
70
|
+
exports.PAGINATION_LIMITS = PAGINATION_LIMITS;
|
|
71
|
+
exports.PERIODIC_INTERVALS = PERIODIC_INTERVALS;
|
|
72
|
+
exports.QUEUE_DEQUEUE_TIMEOUT_MS = QUEUE_DEQUEUE_TIMEOUT_MS;
|
|
73
|
+
exports.RPC_TIMEOUT_MS = RPC_TIMEOUT_MS;
|
|
74
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +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 * Changed from 80 to 8080 to avoid requiring root privileges\n */\nexport const DEFAULT_HEALTH_CHECK_PORT = 8080;\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;;;;;AAMpC,MAAa,4BAA4B;;;;AAKzC,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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration constants for the Eclesia indexer
|
|
4
|
+
* These values control performance, timeouts, and connection management
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Number of blocks to prefetch and keep in the processing queue
|
|
8
|
+
* Higher values increase memory usage but improve throughput
|
|
9
|
+
* Recommended range: 300-1000 depending on block size and available memory
|
|
10
|
+
*/
|
|
11
|
+
declare const DEFAULT_BATCH_SIZE = 500;
|
|
12
|
+
/**
|
|
13
|
+
* Default start height for indexing when no previous height is found
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_START_HEIGHT = 1;
|
|
16
|
+
/**
|
|
17
|
+
* Default port for health check HTTP server
|
|
18
|
+
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
|
+
*/
|
|
20
|
+
declare const DEFAULT_HEALTH_CHECK_PORT = 8080;
|
|
21
|
+
/**
|
|
22
|
+
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
|
+
*/
|
|
24
|
+
declare const DEFAULT_POLLING_INTERVAL_MS = 5000;
|
|
25
|
+
/**
|
|
26
|
+
* Timeout for RPC calls in milliseconds
|
|
27
|
+
* If a call takes longer than this, it will be rejected
|
|
28
|
+
*/
|
|
29
|
+
declare const RPC_TIMEOUT_MS = 20000;
|
|
30
|
+
/**
|
|
31
|
+
* Timeout for block queue dequeue operations in milliseconds
|
|
32
|
+
* If no block is available within this time, an error will be thrown
|
|
33
|
+
*/
|
|
34
|
+
declare const QUEUE_DEQUEUE_TIMEOUT_MS = 30000;
|
|
35
|
+
/**
|
|
36
|
+
* Number of successful transactions before recycling the database client
|
|
37
|
+
* Prevents long-running connection issues and stale connections
|
|
38
|
+
*/
|
|
39
|
+
declare const DB_CLIENT_RECYCLE_COUNT = 1500;
|
|
40
|
+
/**
|
|
41
|
+
* Block intervals for periodic event emission
|
|
42
|
+
* Used for operations that should run at regular block intervals
|
|
43
|
+
*/
|
|
44
|
+
declare const PERIODIC_INTERVALS: {
|
|
45
|
+
/** Emit periodic event every 50 blocks */
|
|
46
|
+
readonly SMALL: 50;
|
|
47
|
+
/** Emit periodic event every 100 blocks */
|
|
48
|
+
readonly MEDIUM: 100;
|
|
49
|
+
/** Emit periodic event every 1000 blocks - used for performance logging */
|
|
50
|
+
readonly LARGE: 1000;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Pagination limits for blockchain queries
|
|
54
|
+
*/
|
|
55
|
+
declare const PAGINATION_LIMITS: {
|
|
56
|
+
/** Default limit for validator queries */
|
|
57
|
+
readonly VALIDATORS: 1000n;
|
|
58
|
+
/** Default limit for delegation queries */
|
|
59
|
+
readonly DELEGATIONS: 250n;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Batch size for streaming genesis file processing
|
|
63
|
+
* Number of entries to process at once from genesis JSON
|
|
64
|
+
*/
|
|
65
|
+
declare const GENESIS_BATCH_SIZE = 1000;
|
|
66
|
+
//#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.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAUA;AAKA;AAMA;AAKA;AAMA;AAMA;AAMA;AAMA;AAYa,cApDA,kBAAA,GAyDH,GAAA;AAMV;;;cA1Da,oBAAA;;;;;cAMA,yBAAA;;;;cAKA,2BAAA;;;;;cAMA,cAAA;;;;;cAMA,wBAAA;;;;;cAMA,uBAAA;;;;;cAMA;;;;;;;;;;;cAYA;;;;;;;;;;cAWA,kBAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration constants for the Eclesia indexer
|
|
4
|
+
* These values control performance, timeouts, and connection management
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Number of blocks to prefetch and keep in the processing queue
|
|
8
|
+
* Higher values increase memory usage but improve throughput
|
|
9
|
+
* Recommended range: 300-1000 depending on block size and available memory
|
|
10
|
+
*/
|
|
11
|
+
declare const DEFAULT_BATCH_SIZE = 500;
|
|
12
|
+
/**
|
|
13
|
+
* Default start height for indexing when no previous height is found
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_START_HEIGHT = 1;
|
|
16
|
+
/**
|
|
17
|
+
* Default port for health check HTTP server
|
|
18
|
+
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
|
+
*/
|
|
20
|
+
declare const DEFAULT_HEALTH_CHECK_PORT = 8080;
|
|
21
|
+
/**
|
|
22
|
+
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
|
+
*/
|
|
24
|
+
declare const DEFAULT_POLLING_INTERVAL_MS = 5000;
|
|
25
|
+
/**
|
|
26
|
+
* Timeout for RPC calls in milliseconds
|
|
27
|
+
* If a call takes longer than this, it will be rejected
|
|
28
|
+
*/
|
|
29
|
+
declare const RPC_TIMEOUT_MS = 20000;
|
|
30
|
+
/**
|
|
31
|
+
* Timeout for block queue dequeue operations in milliseconds
|
|
32
|
+
* If no block is available within this time, an error will be thrown
|
|
33
|
+
*/
|
|
34
|
+
declare const QUEUE_DEQUEUE_TIMEOUT_MS = 30000;
|
|
35
|
+
/**
|
|
36
|
+
* Number of successful transactions before recycling the database client
|
|
37
|
+
* Prevents long-running connection issues and stale connections
|
|
38
|
+
*/
|
|
39
|
+
declare const DB_CLIENT_RECYCLE_COUNT = 1500;
|
|
40
|
+
/**
|
|
41
|
+
* Block intervals for periodic event emission
|
|
42
|
+
* Used for operations that should run at regular block intervals
|
|
43
|
+
*/
|
|
44
|
+
declare const PERIODIC_INTERVALS: {
|
|
45
|
+
/** Emit periodic event every 50 blocks */
|
|
46
|
+
readonly SMALL: 50;
|
|
47
|
+
/** Emit periodic event every 100 blocks */
|
|
48
|
+
readonly MEDIUM: 100;
|
|
49
|
+
/** Emit periodic event every 1000 blocks - used for performance logging */
|
|
50
|
+
readonly LARGE: 1000;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Pagination limits for blockchain queries
|
|
54
|
+
*/
|
|
55
|
+
declare const PAGINATION_LIMITS: {
|
|
56
|
+
/** Default limit for validator queries */
|
|
57
|
+
readonly VALIDATORS: 1000n;
|
|
58
|
+
/** Default limit for delegation queries */
|
|
59
|
+
readonly DELEGATIONS: 250n;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Batch size for streaming genesis file processing
|
|
63
|
+
* Number of entries to process at once from genesis JSON
|
|
64
|
+
*/
|
|
65
|
+
declare const GENESIS_BATCH_SIZE = 1000;
|
|
66
|
+
//#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.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;AAUA;AAKA;AAMA;AAKA;AAMA;AAMA;AAMA;AAMA;AAYa,cApDA,kBAAA,GAyDH,GAAA;AAMV;;;cA1Da,oBAAA;;;;;cAMA,yBAAA;;;;cAKA,2BAAA;;;;;cAMA,cAAA;;;;;cAMA,wBAAA;;;;;cAMA,uBAAA;;;;;cAMA;;;;;;;;;;;cAYA;;;;;;;;;;cAWA,kBAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration constants for the Eclesia indexer
|
|
4
|
+
* These values control performance, timeouts, and connection management
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Number of blocks to prefetch and keep in the processing queue
|
|
8
|
+
* Higher values increase memory usage but improve throughput
|
|
9
|
+
* Recommended range: 300-1000 depending on block size and available memory
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_BATCH_SIZE = 500;
|
|
12
|
+
/**
|
|
13
|
+
* Default start height for indexing when no previous height is found
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_START_HEIGHT = 1;
|
|
16
|
+
/**
|
|
17
|
+
* Default port for health check HTTP server
|
|
18
|
+
* Changed from 80 to 8080 to avoid requiring root privileges
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_HEALTH_CHECK_PORT = 8080;
|
|
21
|
+
/**
|
|
22
|
+
* Default polling interval in milliseconds when using polling mode instead of WebSocket
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_POLLING_INTERVAL_MS = 5e3;
|
|
25
|
+
/**
|
|
26
|
+
* Timeout for RPC calls in milliseconds
|
|
27
|
+
* If a call takes longer than this, it will be rejected
|
|
28
|
+
*/
|
|
29
|
+
const RPC_TIMEOUT_MS = 2e4;
|
|
30
|
+
/**
|
|
31
|
+
* Timeout for block queue dequeue operations in milliseconds
|
|
32
|
+
* If no block is available within this time, an error will be thrown
|
|
33
|
+
*/
|
|
34
|
+
const QUEUE_DEQUEUE_TIMEOUT_MS = 3e4;
|
|
35
|
+
/**
|
|
36
|
+
* Number of successful transactions before recycling the database client
|
|
37
|
+
* Prevents long-running connection issues and stale connections
|
|
38
|
+
*/
|
|
39
|
+
const DB_CLIENT_RECYCLE_COUNT = 1500;
|
|
40
|
+
/**
|
|
41
|
+
* Block intervals for periodic event emission
|
|
42
|
+
* Used for operations that should run at regular block intervals
|
|
43
|
+
*/
|
|
44
|
+
const PERIODIC_INTERVALS = {
|
|
45
|
+
SMALL: 50,
|
|
46
|
+
MEDIUM: 100,
|
|
47
|
+
LARGE: 1e3
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Pagination limits for blockchain queries
|
|
51
|
+
*/
|
|
52
|
+
const PAGINATION_LIMITS = {
|
|
53
|
+
VALIDATORS: 1000n,
|
|
54
|
+
DELEGATIONS: 250n
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Batch size for streaming genesis file processing
|
|
58
|
+
* Number of entries to process at once from genesis JSON
|
|
59
|
+
*/
|
|
60
|
+
const GENESIS_BATCH_SIZE = 1e3;
|
|
61
|
+
|
|
62
|
+
//#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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","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 * Changed from 80 to 8080 to avoid requiring root privileges\n */\nexport const DEFAULT_HEALTH_CHECK_PORT = 8080;\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;;;;;AAMpC,MAAa,4BAA4B;;;;AAKzC,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
|
@@ -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":"
|
|
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;;;;;CAc1B,cAAc;OAZN,UAAU,IAAIA,qBAAc;OAG7B,0BAAU,IAAI,KAAqB;OAGlC,6BAAa,IAAI,SAAS;AAOhC,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"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/errors/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* Custom error classes for the Eclesia indexer
|
|
5
|
+
* These provide better context and error tracking throughout the application
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base error class for all indexer errors
|
|
9
|
+
* Extends Error with additional context fields
|
|
10
|
+
*/
|
|
11
|
+
var IndexerError = class extends Error {
|
|
12
|
+
constructor(message, code = "INDEXER_ERROR", context) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = this.constructor.name;
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.context = context;
|
|
17
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration-related errors
|
|
22
|
+
* Thrown when indexer configuration is invalid or missing
|
|
23
|
+
*/
|
|
24
|
+
var ConfigurationError = class extends IndexerError {
|
|
25
|
+
constructor(message, context) {
|
|
26
|
+
super(message, "CONFIGURATION_ERROR", context);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* RPC connection and communication errors
|
|
31
|
+
* Thrown when RPC calls fail or connections are lost
|
|
32
|
+
*/
|
|
33
|
+
var RPCError = class extends IndexerError {
|
|
34
|
+
constructor(message, endpoint, height, context) {
|
|
35
|
+
super(message, "RPC_ERROR", {
|
|
36
|
+
...context,
|
|
37
|
+
endpoint,
|
|
38
|
+
height
|
|
39
|
+
});
|
|
40
|
+
this.endpoint = endpoint;
|
|
41
|
+
this.height = height;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Database operation errors
|
|
46
|
+
* Thrown when database queries or transactions fail
|
|
47
|
+
*/
|
|
48
|
+
var DatabaseError = class extends IndexerError {
|
|
49
|
+
constructor(message, operation, query, context) {
|
|
50
|
+
super(message, "DATABASE_ERROR", {
|
|
51
|
+
...context,
|
|
52
|
+
operation,
|
|
53
|
+
query
|
|
54
|
+
});
|
|
55
|
+
this.operation = operation;
|
|
56
|
+
this.query = query;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Block processing errors
|
|
61
|
+
* Thrown when block data is invalid or processing fails
|
|
62
|
+
*/
|
|
63
|
+
var BlockProcessingError = class extends IndexerError {
|
|
64
|
+
constructor(message, height, context) {
|
|
65
|
+
super(message, "BLOCK_PROCESSING_ERROR", {
|
|
66
|
+
...context,
|
|
67
|
+
height
|
|
68
|
+
});
|
|
69
|
+
this.height = height;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Module initialization errors
|
|
74
|
+
* Thrown when indexing modules fail to initialize
|
|
75
|
+
*/
|
|
76
|
+
var ModuleError = class extends IndexerError {
|
|
77
|
+
constructor(message, moduleName, context) {
|
|
78
|
+
super(message, "MODULE_ERROR", {
|
|
79
|
+
...context,
|
|
80
|
+
moduleName
|
|
81
|
+
});
|
|
82
|
+
this.moduleName = moduleName;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Genesis processing errors
|
|
87
|
+
* Thrown when genesis file parsing or processing fails
|
|
88
|
+
*/
|
|
89
|
+
var GenesisError = class extends IndexerError {
|
|
90
|
+
constructor(message, genesisPath, context) {
|
|
91
|
+
super(message, "GENESIS_ERROR", {
|
|
92
|
+
...context,
|
|
93
|
+
genesisPath
|
|
94
|
+
});
|
|
95
|
+
this.genesisPath = genesisPath;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
exports.BlockProcessingError = BlockProcessingError;
|
|
101
|
+
exports.ConfigurationError = ConfigurationError;
|
|
102
|
+
exports.DatabaseError = DatabaseError;
|
|
103
|
+
exports.GenesisError = GenesisError;
|
|
104
|
+
exports.IndexerError = IndexerError;
|
|
105
|
+
exports.ModuleError = ModuleError;
|
|
106
|
+
exports.RPCError = RPCError;
|
|
107
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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;CAOtC,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;CAOzC,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;CAO9C,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;CAIrD,YAAY,SAAiB,QAAgB,SAAmC;AAC9E,QAAM,SAAS,0BAA0B;GACvC,GAAG;GACH;GACD,CAAC;AACF,OAAK,SAAS;;;;;;;AAQlB,IAAa,cAAb,cAAiC,aAAa;CAI5C,YAAY,SAAiB,YAAoB,SAAmC;AAClF,QAAM,SAAS,gBAAgB;GAC7B,GAAG;GACH;GACD,CAAC;AACF,OAAK,aAAa;;;;;;;AAQtB,IAAa,eAAb,cAAkC,aAAa;CAI7C,YAAY,SAAiB,aAAsB,SAAmC;AACpF,QAAM,SAAS,iBAAiB;GAC9B,GAAG;GACH;GACD,CAAC;AACF,OAAK,cAAc"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/errors/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Custom error classes for the Eclesia indexer
|
|
4
|
+
* These provide better context and error tracking throughout the application
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for all indexer errors
|
|
8
|
+
* Extends Error with additional context fields
|
|
9
|
+
*/
|
|
10
|
+
declare class IndexerError extends Error {
|
|
11
|
+
/** Error code for programmatic error handling */
|
|
12
|
+
readonly code: string;
|
|
13
|
+
/** Additional context data for debugging */
|
|
14
|
+
readonly context?: Record<string, unknown>;
|
|
15
|
+
constructor(message: string, code?: string, context?: Record<string, unknown>);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration-related errors
|
|
19
|
+
* Thrown when indexer configuration is invalid or missing
|
|
20
|
+
*/
|
|
21
|
+
declare class ConfigurationError extends IndexerError {
|
|
22
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* RPC connection and communication errors
|
|
26
|
+
* Thrown when RPC calls fail or connections are lost
|
|
27
|
+
*/
|
|
28
|
+
declare class RPCError extends IndexerError {
|
|
29
|
+
/** The RPC endpoint that failed */
|
|
30
|
+
readonly endpoint?: string;
|
|
31
|
+
/** The height being queried when error occurred */
|
|
32
|
+
readonly height?: number;
|
|
33
|
+
constructor(message: string, endpoint?: string, height?: number, context?: Record<string, unknown>);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Database operation errors
|
|
37
|
+
* Thrown when database queries or transactions fail
|
|
38
|
+
*/
|
|
39
|
+
declare class DatabaseError extends IndexerError {
|
|
40
|
+
/** The SQL query that failed */
|
|
41
|
+
readonly query?: string;
|
|
42
|
+
/** The operation that failed (e.g., "BEGIN", "COMMIT", "ROLLBACK") */
|
|
43
|
+
readonly operation?: string;
|
|
44
|
+
constructor(message: string, operation?: string, query?: string, context?: Record<string, unknown>);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Block processing errors
|
|
48
|
+
* Thrown when block data is invalid or processing fails
|
|
49
|
+
*/
|
|
50
|
+
declare class BlockProcessingError extends IndexerError {
|
|
51
|
+
/** The height of the block that failed to process */
|
|
52
|
+
readonly height: number;
|
|
53
|
+
constructor(message: string, height: number, context?: Record<string, unknown>);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Module initialization errors
|
|
57
|
+
* Thrown when indexing modules fail to initialize
|
|
58
|
+
*/
|
|
59
|
+
declare class ModuleError extends IndexerError {
|
|
60
|
+
/** The name of the module that failed */
|
|
61
|
+
readonly moduleName: string;
|
|
62
|
+
constructor(message: string, moduleName: string, context?: Record<string, unknown>);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Genesis processing errors
|
|
66
|
+
* Thrown when genesis file parsing or processing fails
|
|
67
|
+
*/
|
|
68
|
+
declare class GenesisError extends IndexerError {
|
|
69
|
+
/** Path to the genesis file */
|
|
70
|
+
readonly genesisPath?: string;
|
|
71
|
+
constructor(message: string, genesisPath?: string, context?: Record<string, unknown>);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError };
|
|
75
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":[],"mappings":";;AASA;;;;;;AAwBA;AAAgC,cAxBnB,YAAA,SAAqB,KAAA,CAwBF;;WAAQ,IAAA,EAAA,MAAA;EAAY;EAUvC,SAAA,OAAS,CAAA,EA7BM,MA6BN,CAAA,MAAA,EAAA,OAAA,CAAA;EAAA,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA3BmD,MA2BnD,CAAA,MAAA,EAAA,OAAA,CAAA;;;;AA2BtB;;AAO6E,cA5ChE,kBAAA,SAA2B,YAAA,CA4CqC;aAP1C,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EApCM,MAoCN,CAAA,MAAA,EAAA,OAAA,CAAA;;AAsBnC;;;;AAAsD,cAjDzC,QAAA,SAAiB,YAAA,CAiDwB;EAiBzC;EAAY,SAAA,QAAA,CAAA,EAAA,MAAA;;WAAQ,MAAA,CAAA,EAAA,MAAA;EAAY,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAvD/B,MAuD+B,CAAA,MAAA,EAAA,OAAA,CAAA;AAiB7C;;;;;cAxDa,aAAA,SAAsB,YAAA;;;;;6EAO0C;;;;;;cAehE,oBAAA,SAA6B,YAAA;;;yDAIe;;;;;;cAa5C,WAAA,SAAoB,YAAA;;;6DAI4B;;;;;;cAahD,YAAA,SAAqB,YAAA;;;+DAI6B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/errors/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Custom error classes for the Eclesia indexer
|
|
4
|
+
* These provide better context and error tracking throughout the application
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for all indexer errors
|
|
8
|
+
* Extends Error with additional context fields
|
|
9
|
+
*/
|
|
10
|
+
declare class IndexerError extends Error {
|
|
11
|
+
/** Error code for programmatic error handling */
|
|
12
|
+
readonly code: string;
|
|
13
|
+
/** Additional context data for debugging */
|
|
14
|
+
readonly context?: Record<string, unknown>;
|
|
15
|
+
constructor(message: string, code?: string, context?: Record<string, unknown>);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration-related errors
|
|
19
|
+
* Thrown when indexer configuration is invalid or missing
|
|
20
|
+
*/
|
|
21
|
+
declare class ConfigurationError extends IndexerError {
|
|
22
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* RPC connection and communication errors
|
|
26
|
+
* Thrown when RPC calls fail or connections are lost
|
|
27
|
+
*/
|
|
28
|
+
declare class RPCError extends IndexerError {
|
|
29
|
+
/** The RPC endpoint that failed */
|
|
30
|
+
readonly endpoint?: string;
|
|
31
|
+
/** The height being queried when error occurred */
|
|
32
|
+
readonly height?: number;
|
|
33
|
+
constructor(message: string, endpoint?: string, height?: number, context?: Record<string, unknown>);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Database operation errors
|
|
37
|
+
* Thrown when database queries or transactions fail
|
|
38
|
+
*/
|
|
39
|
+
declare class DatabaseError extends IndexerError {
|
|
40
|
+
/** The SQL query that failed */
|
|
41
|
+
readonly query?: string;
|
|
42
|
+
/** The operation that failed (e.g., "BEGIN", "COMMIT", "ROLLBACK") */
|
|
43
|
+
readonly operation?: string;
|
|
44
|
+
constructor(message: string, operation?: string, query?: string, context?: Record<string, unknown>);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Block processing errors
|
|
48
|
+
* Thrown when block data is invalid or processing fails
|
|
49
|
+
*/
|
|
50
|
+
declare class BlockProcessingError extends IndexerError {
|
|
51
|
+
/** The height of the block that failed to process */
|
|
52
|
+
readonly height: number;
|
|
53
|
+
constructor(message: string, height: number, context?: Record<string, unknown>);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Module initialization errors
|
|
57
|
+
* Thrown when indexing modules fail to initialize
|
|
58
|
+
*/
|
|
59
|
+
declare class ModuleError extends IndexerError {
|
|
60
|
+
/** The name of the module that failed */
|
|
61
|
+
readonly moduleName: string;
|
|
62
|
+
constructor(message: string, moduleName: string, context?: Record<string, unknown>);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Genesis processing errors
|
|
66
|
+
* Thrown when genesis file parsing or processing fails
|
|
67
|
+
*/
|
|
68
|
+
declare class GenesisError extends IndexerError {
|
|
69
|
+
/** Path to the genesis file */
|
|
70
|
+
readonly genesisPath?: string;
|
|
71
|
+
constructor(message: string, genesisPath?: string, context?: Record<string, unknown>);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError };
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/errors/index.ts"],"sourcesContent":[],"mappings":";;AASA;;;;;;AAwBA;AAAgC,cAxBnB,YAAA,SAAqB,KAAA,CAwBF;;WAAQ,IAAA,EAAA,MAAA;EAAY;EAUvC,SAAA,OAAS,CAAA,EA7BM,MA6BN,CAAA,MAAA,EAAA,OAAA,CAAA;EAAA,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA3BmD,MA2BnD,CAAA,MAAA,EAAA,OAAA,CAAA;;;;AA2BtB;;AAO6E,cA5ChE,kBAAA,SAA2B,YAAA,CA4CqC;aAP1C,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EApCM,MAoCN,CAAA,MAAA,EAAA,OAAA,CAAA;;AAsBnC;;;;AAAsD,cAjDzC,QAAA,SAAiB,YAAA,CAiDwB;EAiBzC;EAAY,SAAA,QAAA,CAAA,EAAA,MAAA;;WAAQ,MAAA,CAAA,EAAA,MAAA;EAAY,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAvD/B,MAuD+B,CAAA,MAAA,EAAA,OAAA,CAAA;AAiB7C;;;;;cAxDa,aAAA,SAAsB,YAAA;;;;;6EAO0C;;;;;;cAehE,oBAAA,SAA6B,YAAA;;;yDAIe;;;;;;cAa5C,WAAA,SAAoB,YAAA;;;6DAI4B;;;;;;cAahD,YAAA,SAAqB,YAAA;;;+DAI6B"}
|