@polygonlabs/servercore 1.0.0-dev.25 → 1.0.0-dev.27

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.
@@ -0,0 +1,23 @@
1
+ import { AbstractEventConsumer } from './abstract_event_consumer.js';
2
+ import '../errors/consumer_errors.js';
3
+ import '../errors/base_error.js';
4
+ import 'events';
5
+
6
+ declare abstract class AbstractCronEventConsumer extends AbstractEventConsumer {
7
+ private cronJob;
8
+ /**
9
+ * Start the cron job with the given cron expression.
10
+ * @param cronExpr Cron expression string
11
+ */
12
+ startCron(cronExpr: string): void;
13
+ /**
14
+ * Stop the cron job.
15
+ */
16
+ stopCron(): void;
17
+ /**
18
+ * Implement this in subclasses to define what happens on each cron tick.
19
+ */
20
+ protected abstract onTick(): Promise<void>;
21
+ }
22
+
23
+ export { AbstractCronEventConsumer };
@@ -0,0 +1,30 @@
1
+ import { Cron } from "croner";
2
+ import { AbstractEventConsumer } from "./abstract_event_consumer";
3
+ class AbstractCronEventConsumer extends AbstractEventConsumer {
4
+ cronJob = null;
5
+ /**
6
+ * Start the cron job with the given cron expression.
7
+ * @param cronExpr Cron expression string
8
+ */
9
+ startCron(cronExpr) {
10
+ if (this.cronJob) {
11
+ this.cronJob.stop();
12
+ }
13
+ this.cronJob = new Cron(cronExpr, { protect: true }, async () => {
14
+ await this.onTick();
15
+ });
16
+ }
17
+ /**
18
+ * Stop the cron job.
19
+ */
20
+ stopCron() {
21
+ if (this.cronJob) {
22
+ this.cronJob.stop();
23
+ this.cronJob = null;
24
+ }
25
+ }
26
+ }
27
+ export {
28
+ AbstractCronEventConsumer
29
+ };
30
+ //# sourceMappingURL=abstract_cron_event_consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/consumers/abstract_cron_event_consumer.ts"],"sourcesContent":["import { Cron } from \"croner\";\nimport { AbstractEventConsumer } from \"./abstract_event_consumer\";\n\nexport abstract class AbstractCronEventConsumer extends AbstractEventConsumer {\n private cronJob: Cron | null = null;\n\n /**\n * Start the cron job with the given cron expression.\n * @param cronExpr Cron expression string\n */\n public startCron(cronExpr: string): void {\n if (this.cronJob) {\n this.cronJob.stop();\n }\n this.cronJob = new Cron(cronExpr, { protect: true }, async () => {\n await this.onTick();\n });\n }\n\n /**\n * Stop the cron job.\n */\n public stopCron(): void {\n if (this.cronJob) {\n this.cronJob.stop();\n this.cronJob = null;\n }\n }\n\n /**\n * Implement this in subclasses to define what happens on each cron tick.\n */\n protected abstract onTick(): Promise<void>;\n}\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,6BAA6B;AAE/B,MAAe,kCAAkC,sBAAsB;AAAA,EAClE,UAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,UAAU,UAAwB;AACrC,QAAI,KAAK,SAAS;AACd,WAAK,QAAQ,KAAK;AAAA,IACtB;AACA,SAAK,UAAU,IAAI,KAAK,UAAU,EAAE,SAAS,KAAK,GAAG,YAAY;AAC7D,YAAM,KAAK,OAAO;AAAA,IACtB,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKO,WAAiB;AACpB,QAAI,KAAK,SAAS;AACd,WAAK,QAAQ,KAAK;AAClB,WAAK,UAAU;AAAA,IACnB;AAAA,EACJ;AAMJ;","names":[]}
@@ -1,4 +1,5 @@
1
1
  export { EventConsumer } from './event_consumer.js';
2
+ export { RestAPIConsumer } from './rest_api_consumer.js';
2
3
  import 'viem';
3
4
  import '../errors/consumer_errors.js';
4
5
  import '../errors/base_error.js';
@@ -6,3 +7,5 @@ import '../types/observer.js';
6
7
  import '../types/event_consumer_config.js';
7
8
  import './abstract_event_consumer.js';
8
9
  import 'events';
10
+ import '../types/rest_api_consumer_config.js';
11
+ import './abstract_cron_event_consumer.js';
@@ -1,2 +1,3 @@
1
1
  export * from "./event_consumer";
2
+ export * from "./rest_api_consumer";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/consumers/index.ts"],"sourcesContent":["export * from \"./event_consumer\";\n"],"mappings":"AAAA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/consumers/index.ts"],"sourcesContent":["export * from \"./event_consumer\";\nexport * from \"./rest_api_consumer\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,30 @@
1
+ import { ConsumerError } from '../errors/consumer_errors.js';
2
+ import { IObserver } from '../types/observer.js';
3
+ import { IRestAPIConsumerConfig } from '../types/rest_api_consumer_config.js';
4
+ import { AbstractCronEventConsumer } from './abstract_cron_event_consumer.js';
5
+ import '../errors/base_error.js';
6
+ import './abstract_event_consumer.js';
7
+ import 'events';
8
+
9
+ declare class RestAPIConsumer<T, U> extends AbstractCronEventConsumer {
10
+ private config;
11
+ protected observer: IObserver<T, ConsumerError, U> | null;
12
+ private currentPage;
13
+ private highestValueSeen;
14
+ constructor(config: IRestAPIConsumerConfig);
15
+ start(observer: IObserver<T, ConsumerError, U>): Promise<void>;
16
+ stop(): void;
17
+ protected onTick(): Promise<void>;
18
+ private fetchPage;
19
+ private getValueByPath;
20
+ private processDataForCurrentCountValue;
21
+ /**
22
+ * Updates the start count value to a specific value.
23
+ * This allows reprocessing data from a specified point.
24
+ *
25
+ * @param value The value to set as the new start count
26
+ */
27
+ setStartValue(value: number): void;
28
+ }
29
+
30
+ export { RestAPIConsumer };
@@ -0,0 +1,128 @@
1
+ import { errorCodes } from "../constants";
2
+ import { ConsumerError } from "../errors";
3
+ import { AbstractCronEventConsumer } from "./abstract_cron_event_consumer";
4
+ class RestAPIConsumer extends AbstractCronEventConsumer {
5
+ constructor(config) {
6
+ super();
7
+ this.config = config;
8
+ this.highestValueSeen = this.config.startCount.value;
9
+ }
10
+ observer = null;
11
+ currentPage = 0;
12
+ highestValueSeen = 0;
13
+ async start(observer) {
14
+ this.observer = observer;
15
+ this.currentPage = 1;
16
+ if (this.config.cronExpr) {
17
+ this.startCron(this.config.cronExpr);
18
+ } else {
19
+ await this.onTick();
20
+ }
21
+ }
22
+ stop() {
23
+ this.stopCron();
24
+ }
25
+ async onTick() {
26
+ this.currentPage = 1;
27
+ let shouldFetchNextPage = true;
28
+ while (shouldFetchNextPage) {
29
+ shouldFetchNextPage = await this.fetchPage();
30
+ }
31
+ this.config.startCount.value = this.highestValueSeen;
32
+ }
33
+ async fetchPage() {
34
+ try {
35
+ const paginationParam = this.config.paginationParam || "page";
36
+ const params = {
37
+ ...this.config.params || {},
38
+ [paginationParam]: this.currentPage.toString()
39
+ };
40
+ let url = this.config.apiUrl.toString();
41
+ if (Object.keys(params).length > 0) {
42
+ const queryString = new URLSearchParams(params).toString();
43
+ url += (url.includes("?") ? "&" : "?") + queryString;
44
+ }
45
+ const response = await fetch(url, {
46
+ method: this.config.method || "GET",
47
+ headers: this.config.headers,
48
+ body: this.config.body ? JSON.stringify(this.config.body) : void 0
49
+ });
50
+ if (!response.ok) {
51
+ throw new ConsumerError(
52
+ `Failed to fetch from API: ${response.statusText}`,
53
+ {
54
+ code: errorCodes.external.UNKNOWN_EXTERNAL_DEPENDENCY_ERROR,
55
+ isFatal: true,
56
+ origin: "rest_api_consumer"
57
+ }
58
+ );
59
+ }
60
+ let data = await response.json();
61
+ if (this.config.resultPath) {
62
+ data = this.getValueByPath(data, this.config.resultPath);
63
+ }
64
+ const countKey = this.config.startCount.key;
65
+ let currentValue = void 0;
66
+ if (Array.isArray(data)) {
67
+ if (data.length === 0) {
68
+ return false;
69
+ }
70
+ for (const elem of data) {
71
+ currentValue = this.processDataForCurrentCountValue(
72
+ elem,
73
+ countKey
74
+ );
75
+ }
76
+ } else {
77
+ currentValue = this.processDataForCurrentCountValue(
78
+ data,
79
+ countKey
80
+ );
81
+ }
82
+ this.observer?.next(data);
83
+ this.currentPage++;
84
+ if (currentValue === void 0) {
85
+ return false;
86
+ }
87
+ return currentValue > this.config.startCount.value;
88
+ } catch (error) {
89
+ this.onFatalError(error);
90
+ return false;
91
+ }
92
+ }
93
+ // Utility to get nested values using dot notation (e.g., "response.data.count")
94
+ getValueByPath(obj, path) {
95
+ return path.split(".").reduce((prev, curr) => {
96
+ return prev && prev[curr] !== void 0 ? prev[curr] : void 0;
97
+ }, obj);
98
+ }
99
+ processDataForCurrentCountValue(item, countKey) {
100
+ const value = this.getValueByPath(item, countKey);
101
+ if (value === void 0) {
102
+ throw new ConsumerError(
103
+ `Count key '${countKey}' not found in API response`,
104
+ {
105
+ code: errorCodes.external.UNKNOWN_EXTERNAL_DEPENDENCY_ERROR,
106
+ isFatal: false,
107
+ origin: "rest_api_consumer"
108
+ }
109
+ );
110
+ }
111
+ this.highestValueSeen = Math.max(this.highestValueSeen, value);
112
+ return value;
113
+ }
114
+ /**
115
+ * Updates the start count value to a specific value.
116
+ * This allows reprocessing data from a specified point.
117
+ *
118
+ * @param value The value to set as the new start count
119
+ */
120
+ setStartValue(value) {
121
+ this.config.startCount.value = value;
122
+ this.highestValueSeen = value;
123
+ }
124
+ }
125
+ export {
126
+ RestAPIConsumer
127
+ };
128
+ //# sourceMappingURL=rest_api_consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/consumers/rest_api_consumer.ts"],"sourcesContent":["import { errorCodes } from \"../constants\";\nimport { ConsumerError } from \"../errors\";\nimport type { IObserver, IRestAPIConsumerConfig } from \"../types\";\nimport { AbstractCronEventConsumer } from \"./abstract_cron_event_consumer\";\n\nexport class RestAPIConsumer<T, U> extends AbstractCronEventConsumer {\n protected observer: IObserver<T, ConsumerError, U> | null = null;\n private currentPage = 0;\n private highestValueSeen = 0;\n\n constructor(private config: IRestAPIConsumerConfig) {\n super();\n this.highestValueSeen = this.config.startCount.value;\n }\n\n public async start(\n observer: IObserver<T, ConsumerError, U>\n ): Promise<void> {\n this.observer = observer;\n this.currentPage = 1;\n if (this.config.cronExpr) {\n this.startCron(this.config.cronExpr);\n } else {\n // fallback: run once if no cron\n await this.onTick();\n }\n }\n\n public stop(): void {\n this.stopCron();\n }\n\n protected async onTick(): Promise<void> {\n // Reset page counter at the start of each cron run\n this.currentPage = 1;\n\n // Keep fetching pages until we've caught up\n let shouldFetchNextPage = true;\n\n while (shouldFetchNextPage) {\n shouldFetchNextPage = await this.fetchPage();\n }\n\n // Update config with the highest value we've seen\n // This prevents fetching the same data in the next cron run\n this.config.startCount.value = this.highestValueSeen;\n }\n\n private async fetchPage(): Promise<boolean> {\n try {\n // Use paginationParam from config or default to \"page\"\n const paginationParam = this.config.paginationParam || \"page\";\n const params = {\n ...(this.config.params || {}),\n [paginationParam]: this.currentPage.toString(),\n };\n\n let url = this.config.apiUrl.toString();\n if (Object.keys(params).length > 0) {\n const queryString = new URLSearchParams(params).toString();\n url += (url.includes(\"?\") ? \"&\" : \"?\") + queryString;\n }\n\n const response = await fetch(url, {\n method: this.config.method || \"GET\",\n headers: this.config.headers,\n body: this.config.body\n ? JSON.stringify(this.config.body)\n : undefined,\n });\n\n if (!response.ok) {\n throw new ConsumerError(\n `Failed to fetch from API: ${response.statusText}`,\n {\n code: errorCodes.external\n .UNKNOWN_EXTERNAL_DEPENDENCY_ERROR,\n isFatal: true,\n origin: \"rest_api_consumer\",\n }\n );\n }\n\n let data = await response.json();\n if (this.config.resultPath) {\n data = this.getValueByPath(data, this.config.resultPath);\n }\n\n // Extract the value we're tracking\n const countKey = this.config.startCount.key;\n let currentValue: number | undefined = undefined;\n\n if (Array.isArray(data)) {\n if (data.length === 0) {\n return false;\n }\n for (const elem of data) {\n currentValue = this.processDataForCurrentCountValue(\n elem,\n countKey\n );\n }\n } else {\n currentValue = this.processDataForCurrentCountValue(\n data,\n countKey\n );\n }\n\n // Send data to observer\n this.observer?.next(data);\n\n // Increment page for next potential fetch\n this.currentPage++;\n\n // Continue fetching if the current value is <= our threshold\n if (currentValue === undefined) {\n // If currentValue was never set, stop fetching\n return false;\n }\n return currentValue > this.config.startCount.value;\n } catch (error) {\n this.onFatalError(error as ConsumerError);\n return false; // Stop fetching on error\n }\n }\n\n // Utility to get nested values using dot notation (e.g., \"response.data.count\")\n private getValueByPath(obj: any, path: string): any {\n return path.split(\".\").reduce((prev, curr) => {\n return prev && prev[curr] !== undefined ? prev[curr] : undefined;\n }, obj);\n }\n\n private processDataForCurrentCountValue(\n item: any,\n countKey: string\n ): number {\n const value = this.getValueByPath(item, countKey);\n if (value === undefined) {\n throw new ConsumerError(\n `Count key '${countKey}' not found in API response`,\n {\n code: errorCodes.external.UNKNOWN_EXTERNAL_DEPENDENCY_ERROR,\n isFatal: false,\n origin: \"rest_api_consumer\",\n }\n );\n }\n this.highestValueSeen = Math.max(this.highestValueSeen, value);\n return value;\n }\n\n /**\n * Updates the start count value to a specific value.\n * This allows reprocessing data from a specified point.\n *\n * @param value The value to set as the new start count\n */\n public setStartValue(value: number): void {\n this.config.startCount.value = value;\n this.highestValueSeen = value;\n }\n}\n"],"mappings":"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","names":[]}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { IObserver } from './types/observer.js';
9
9
  export { ChainNativeCurrency, IEventConsumerConfig } from './types/event_consumer_config.js';
10
10
  export { ResponseContext } from './types/response_context.js';
11
11
  export { JobOpts } from './types/queue_job_opts.js';
12
+ export { IRestAPIConsumerConfig } from './types/rest_api_consumer_config.js';
12
13
  export { ApiError, BadRequestError, ForbiddenError, NotFoundError, RateLimitError, TimeoutError, UnauthorizedError } from './errors/api_errors.js';
13
14
  export { DatabaseError } from './errors/database_errors.js';
14
15
  export { ExternalDependencyError } from './errors/external_dependency_error.js';
@@ -17,9 +18,11 @@ export { ConsumerError } from './errors/consumer_errors.js';
17
18
  export { Database } from './storage/db_interface.js';
18
19
  export { IQueue } from './storage/queue_interface.js';
19
20
  export { EventConsumer } from './consumers/event_consumer.js';
21
+ export { RestAPIConsumer } from './consumers/rest_api_consumer.js';
20
22
  export { parseEventLog } from './utils/decoder.js';
21
23
  import 'zod';
22
24
  import 'winston';
23
25
  import 'viem';
24
26
  import './consumers/abstract_event_consumer.js';
25
27
  import 'events';
28
+ import './consumers/abstract_cron_event_consumer.js';
@@ -4,5 +4,6 @@ export { IObserver } from './observer.js';
4
4
  export { ChainNativeCurrency, IEventConsumerConfig } from './event_consumer_config.js';
5
5
  export { ResponseContext } from './response_context.js';
6
6
  export { JobOpts } from './queue_job_opts.js';
7
+ export { IRestAPIConsumerConfig } from './rest_api_consumer_config.js';
7
8
  import 'winston';
8
9
  import 'viem';
@@ -4,4 +4,5 @@ export * from "./observer";
4
4
  export * from "./event_consumer_config";
5
5
  export * from "./response_context";
6
6
  export * from "./queue_job_opts";
7
+ export * from "./rest_api_consumer_config";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./logger_config\";\nexport * from \"./database\";\nexport * from \"./observer\";\nexport * from \"./event_consumer_config\";\nexport * from \"./response_context\";\nexport * from \"./queue_job_opts\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./logger_config\";\nexport * from \"./database\";\nexport * from \"./observer\";\nexport * from \"./event_consumer_config\";\nexport * from \"./response_context\";\nexport * from \"./queue_job_opts\";\nexport * from \"./rest_api_consumer_config\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,17 @@
1
+ interface IRestAPIConsumerConfig {
2
+ apiUrl: URL;
3
+ startCount: {
4
+ key: string;
5
+ value: number;
6
+ };
7
+ cronExpr?: string;
8
+ pollSize?: number;
9
+ body?: Record<string, any>;
10
+ headers?: Record<string, string>;
11
+ method?: "GET" | "POST";
12
+ params?: Record<string, string>;
13
+ paginationParam?: string;
14
+ resultPath?: string;
15
+ }
16
+
17
+ export type { IRestAPIConsumerConfig };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=rest_api_consumer_config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygonlabs/servercore",
3
- "version": "1.0.0-dev.25",
3
+ "version": "1.0.0-dev.27",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,6 +37,7 @@
37
37
  "typescript": "^5"
38
38
  },
39
39
  "dependencies": {
40
+ "croner": "^9.0.0",
40
41
  "viem": "^2.26.3",
41
42
  "winston": "^3.17.0",
42
43
  "winston-transport-sentry-node": "^3.0.0",