@eclesia/indexer-engine 2.9.8 → 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.
Files changed (66) hide show
  1. package/LICENSE.md +223 -0
  2. package/dist/constants.cjs +74 -0
  3. package/dist/constants.cjs.map +1 -0
  4. package/dist/constants.d.cts +68 -0
  5. package/dist/constants.d.cts.map +1 -0
  6. package/dist/constants.d.ts +68 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +64 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/emitter/index.cjs +0 -1
  11. package/dist/emitter/index.cjs.map +1 -1
  12. package/dist/errors/index.cjs +107 -0
  13. package/dist/errors/index.cjs.map +1 -0
  14. package/dist/errors/index.d.cts +75 -0
  15. package/dist/errors/index.d.cts.map +1 -0
  16. package/dist/errors/index.d.ts +75 -0
  17. package/dist/errors/index.d.ts.map +1 -0
  18. package/dist/errors/index.js +100 -0
  19. package/dist/errors/index.js.map +1 -0
  20. package/dist/index.cjs +38 -10
  21. package/dist/index.d.cts +5 -1
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.js +5 -1
  24. package/dist/indexer/index.cjs +51 -27
  25. package/dist/indexer/index.cjs.map +1 -1
  26. package/dist/indexer/index.d.cts +1 -0
  27. package/dist/indexer/index.d.cts.map +1 -1
  28. package/dist/indexer/index.d.ts +1 -0
  29. package/dist/indexer/index.d.ts.map +1 -1
  30. package/dist/indexer/index.js +51 -20
  31. package/dist/indexer/index.js.map +1 -1
  32. package/dist/metrics/index.cjs +146 -0
  33. package/dist/metrics/index.cjs.map +1 -0
  34. package/dist/metrics/index.d.cts +56 -0
  35. package/dist/metrics/index.d.cts.map +1 -0
  36. package/dist/metrics/index.d.ts +56 -0
  37. package/dist/metrics/index.d.ts.map +1 -0
  38. package/dist/metrics/index.js +145 -0
  39. package/dist/metrics/index.js.map +1 -0
  40. package/dist/promise-queue/index.cjs +6 -4
  41. package/dist/promise-queue/index.cjs.map +1 -1
  42. package/dist/promise-queue/index.d.cts +6 -2
  43. package/dist/promise-queue/index.d.cts.map +1 -1
  44. package/dist/promise-queue/index.d.ts +6 -2
  45. package/dist/promise-queue/index.d.ts.map +1 -1
  46. package/dist/promise-queue/index.js +6 -4
  47. package/dist/promise-queue/index.js.map +1 -1
  48. package/dist/types/index.cjs.map +1 -1
  49. package/dist/types/index.d.cts +6 -0
  50. package/dist/types/index.d.cts.map +1 -1
  51. package/dist/types/index.d.ts +6 -0
  52. package/dist/types/index.d.ts.map +1 -1
  53. package/dist/types/index.js.map +1 -1
  54. package/dist/utils/bech32.cjs +0 -1
  55. package/dist/utils/bech32.cjs.map +1 -1
  56. package/dist/utils/index.cjs.map +1 -1
  57. package/dist/utils/index.js.map +1 -1
  58. package/dist/validation/index.cjs +150 -0
  59. package/dist/validation/index.cjs.map +1 -0
  60. package/dist/validation/index.d.cts +52 -0
  61. package/dist/validation/index.d.cts.map +1 -0
  62. package/dist/validation/index.d.ts +52 -0
  63. package/dist/validation/index.d.ts.map +1 -0
  64. package/dist/validation/index.js +140 -0
  65. package/dist/validation/index.js.map +1 -0
  66. package/package.json +3 -1
@@ -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"}
@@ -0,0 +1,100 @@
1
+ //#region src/errors/index.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
+ var IndexerError = class extends Error {
11
+ constructor(message, code = "INDEXER_ERROR", context) {
12
+ super(message);
13
+ this.name = this.constructor.name;
14
+ this.code = code;
15
+ this.context = context;
16
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
17
+ }
18
+ };
19
+ /**
20
+ * Configuration-related errors
21
+ * Thrown when indexer configuration is invalid or missing
22
+ */
23
+ var ConfigurationError = class extends IndexerError {
24
+ constructor(message, context) {
25
+ super(message, "CONFIGURATION_ERROR", context);
26
+ }
27
+ };
28
+ /**
29
+ * RPC connection and communication errors
30
+ * Thrown when RPC calls fail or connections are lost
31
+ */
32
+ var RPCError = class extends IndexerError {
33
+ constructor(message, endpoint, height, context) {
34
+ super(message, "RPC_ERROR", {
35
+ ...context,
36
+ endpoint,
37
+ height
38
+ });
39
+ this.endpoint = endpoint;
40
+ this.height = height;
41
+ }
42
+ };
43
+ /**
44
+ * Database operation errors
45
+ * Thrown when database queries or transactions fail
46
+ */
47
+ var DatabaseError = class extends IndexerError {
48
+ constructor(message, operation, query, context) {
49
+ super(message, "DATABASE_ERROR", {
50
+ ...context,
51
+ operation,
52
+ query
53
+ });
54
+ this.operation = operation;
55
+ this.query = query;
56
+ }
57
+ };
58
+ /**
59
+ * Block processing errors
60
+ * Thrown when block data is invalid or processing fails
61
+ */
62
+ var BlockProcessingError = class extends IndexerError {
63
+ constructor(message, height, context) {
64
+ super(message, "BLOCK_PROCESSING_ERROR", {
65
+ ...context,
66
+ height
67
+ });
68
+ this.height = height;
69
+ }
70
+ };
71
+ /**
72
+ * Module initialization errors
73
+ * Thrown when indexing modules fail to initialize
74
+ */
75
+ var ModuleError = class extends IndexerError {
76
+ constructor(message, moduleName, context) {
77
+ super(message, "MODULE_ERROR", {
78
+ ...context,
79
+ moduleName
80
+ });
81
+ this.moduleName = moduleName;
82
+ }
83
+ };
84
+ /**
85
+ * Genesis processing errors
86
+ * Thrown when genesis file parsing or processing fails
87
+ */
88
+ var GenesisError = class extends IndexerError {
89
+ constructor(message, genesisPath, context) {
90
+ super(message, "GENESIS_ERROR", {
91
+ ...context,
92
+ genesisPath
93
+ });
94
+ this.genesisPath = genesisPath;
95
+ }
96
+ };
97
+
98
+ //#endregion
99
+ export { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError };
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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"}
package/dist/index.cjs CHANGED
@@ -1,23 +1,51 @@
1
+ const require_constants = require('./constants.cjs');
1
2
  const require_index = require('./emitter/index.cjs');
2
- const require_index$1 = require('./promise-queue/index.cjs');
3
- const require_index$2 = require('./utils/index.cjs');
4
- const require_index$3 = require('./indexer/index.cjs');
5
- const require_index$4 = require('./types/index.cjs');
3
+ const require_index$1 = require('./errors/index.cjs');
4
+ const require_index$2 = require('./promise-queue/index.cjs');
5
+ const require_index$3 = require('./utils/index.cjs');
6
+ const require_index$4 = require('./validation/index.cjs');
7
+ const require_index$5 = require('./indexer/index.cjs');
8
+ const require_index$6 = require('./metrics/index.cjs');
9
+ const require_index$7 = require('./types/index.cjs');
6
10
 
7
- exports.CircularBuffer = require_index$1.CircularBuffer;
8
- exports.EcleciaIndexer = require_index$3.EcleciaIndexer;
11
+ exports.BlockProcessingError = require_index$1.BlockProcessingError;
12
+ exports.CircularBuffer = require_index$2.CircularBuffer;
13
+ exports.ConfigurationError = require_index$1.ConfigurationError;
14
+ exports.DB_CLIENT_RECYCLE_COUNT = require_constants.DB_CLIENT_RECYCLE_COUNT;
15
+ exports.DEFAULT_BATCH_SIZE = require_constants.DEFAULT_BATCH_SIZE;
16
+ exports.DEFAULT_HEALTH_CHECK_PORT = require_constants.DEFAULT_HEALTH_CHECK_PORT;
17
+ exports.DEFAULT_POLLING_INTERVAL_MS = require_constants.DEFAULT_POLLING_INTERVAL_MS;
18
+ exports.DEFAULT_START_HEIGHT = require_constants.DEFAULT_START_HEIGHT;
19
+ exports.DatabaseError = require_index$1.DatabaseError;
20
+ exports.EcleciaIndexer = require_index$5.EcleciaIndexer;
9
21
  exports.EclesiaEmitter = require_index.EclesiaEmitter;
10
- exports.PromiseQueue = require_index$1.PromiseQueue;
22
+ exports.GENESIS_BATCH_SIZE = require_constants.GENESIS_BATCH_SIZE;
23
+ exports.GenesisError = require_index$1.GenesisError;
24
+ exports.IndexerError = require_index$1.IndexerError;
25
+ exports.IndexerMetrics = require_index$6.IndexerMetrics;
26
+ exports.ModuleError = require_index$1.ModuleError;
27
+ exports.PAGINATION_LIMITS = require_constants.PAGINATION_LIMITS;
28
+ exports.PERIODIC_INTERVALS = require_constants.PERIODIC_INTERVALS;
29
+ exports.PromiseQueue = require_index$2.PromiseQueue;
30
+ exports.QUEUE_DEQUEUE_TIMEOUT_MS = require_constants.QUEUE_DEQUEUE_TIMEOUT_MS;
31
+ exports.RPCError = require_index$1.RPCError;
32
+ exports.RPC_TIMEOUT_MS = require_constants.RPC_TIMEOUT_MS;
11
33
  Object.defineProperty(exports, 'Types', {
12
34
  enumerable: true,
13
35
  get: function () {
14
- return require_index$4.types_exports;
36
+ return require_index$7.types_exports;
15
37
  }
16
38
  });
17
39
  Object.defineProperty(exports, 'Utils', {
18
40
  enumerable: true,
19
41
  get: function () {
20
- return require_index$2.utils_exports;
42
+ return require_index$3.utils_exports;
21
43
  }
22
44
  });
23
- exports.defaultIndexerConfig = require_index$3.defaultIndexerConfig;
45
+ Object.defineProperty(exports, 'Validation', {
46
+ enumerable: true,
47
+ get: function () {
48
+ return require_index$4.validation_exports;
49
+ }
50
+ });
51
+ exports.defaultIndexerConfig = require_index$5.defaultIndexerConfig;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,10 @@
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
2
  import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.cjs";
2
3
  import { CircularBuffer, PromiseQueue } from "./promise-queue/index.cjs";
3
4
  import { index_d_exports } from "./types/index.cjs";
4
5
  import { EclesiaEmitter } from "./emitter/index.cjs";
6
+ import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.cjs";
7
+ import { IndexerMetrics } from "./metrics/index.cjs";
5
8
  import { index_d_exports as index_d_exports$1 } from "./utils/index.cjs";
6
- export { CircularBuffer, EcleciaIndexer, EclesiaEmitter, PromiseQueue, index_d_exports as Types, index_d_exports$1 as Utils, defaultIndexerConfig };
9
+ import { index_d_exports as index_d_exports$2 } from "./validation/index.cjs";
10
+ export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, ModuleError, PAGINATION_LIMITS, PERIODIC_INTERVALS, PromiseQueue, QUEUE_DEQUEUE_TIMEOUT_MS, RPCError, RPC_TIMEOUT_MS, index_d_exports as Types, index_d_exports$1 as Utils, index_d_exports$2 as Validation, defaultIndexerConfig };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
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.js";
1
2
  import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.js";
2
3
  import { CircularBuffer, PromiseQueue } from "./promise-queue/index.js";
3
4
  import { index_d_exports } from "./types/index.js";
4
5
  import { EclesiaEmitter } from "./emitter/index.js";
6
+ import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.js";
7
+ import { IndexerMetrics } from "./metrics/index.js";
5
8
  import { index_d_exports as index_d_exports$1 } from "./utils/index.js";
6
- export { CircularBuffer, EcleciaIndexer, EclesiaEmitter, PromiseQueue, index_d_exports as Types, index_d_exports$1 as Utils, defaultIndexerConfig };
9
+ import { index_d_exports as index_d_exports$2 } from "./validation/index.js";
10
+ export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, ModuleError, PAGINATION_LIMITS, PERIODIC_INTERVALS, PromiseQueue, QUEUE_DEQUEUE_TIMEOUT_MS, RPCError, RPC_TIMEOUT_MS, index_d_exports as Types, index_d_exports$1 as Utils, index_d_exports$2 as Validation, defaultIndexerConfig };
package/dist/index.js CHANGED
@@ -1,7 +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.js";
1
2
  import { EclesiaEmitter } from "./emitter/index.js";
3
+ import { BlockProcessingError, ConfigurationError, DatabaseError, GenesisError, IndexerError, ModuleError, RPCError } from "./errors/index.js";
2
4
  import { CircularBuffer, PromiseQueue } from "./promise-queue/index.js";
3
5
  import { utils_exports } from "./utils/index.js";
6
+ import { validation_exports } from "./validation/index.js";
4
7
  import { EcleciaIndexer, defaultIndexerConfig } from "./indexer/index.js";
8
+ import { IndexerMetrics } from "./metrics/index.js";
5
9
  import { types_exports } from "./types/index.js";
6
10
 
7
- export { CircularBuffer, EcleciaIndexer, EclesiaEmitter, PromiseQueue, types_exports as Types, utils_exports as Utils, defaultIndexerConfig };
11
+ export { BlockProcessingError, CircularBuffer, ConfigurationError, DB_CLIENT_RECYCLE_COUNT, DEFAULT_BATCH_SIZE, DEFAULT_HEALTH_CHECK_PORT, DEFAULT_POLLING_INTERVAL_MS, DEFAULT_START_HEIGHT, DatabaseError, EcleciaIndexer, EclesiaEmitter, GENESIS_BATCH_SIZE, GenesisError, IndexerError, IndexerMetrics, 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 };