@sentio/runtime 2.57.12-rc.i → 2.57.12-rc.j

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.
@@ -6,7 +6,7 @@ import {
6
6
  recordRuntimeInfo,
7
7
  require_lib3 as require_lib,
8
8
  require_lib4 as require_lib2
9
- } from "./chunk-CAKQS6AI.js";
9
+ } from "./chunk-PDTC7P7O.js";
10
10
  import {
11
11
  PluginManager,
12
12
  ProcessConfigResponse,
@@ -76,30 +76,25 @@ async function service_worker_default({ request }) {
76
76
  console.debug("worker configured");
77
77
  }
78
78
  }
79
- try {
80
- if (unhandled) {
81
- throw new import_nice_grpc_error_details.RichServerError(
82
- import_nice_grpc.Status.UNAVAILABLE,
83
- "Unhandled exception/rejection in previous request: " + errorString(unhandled),
84
- [
85
- import_nice_grpc_error_details.DebugInfo.fromPartial({
86
- detail: unhandled.message,
87
- stackEntries: unhandled.stack?.split("\n")
88
- })
89
- ]
90
- );
91
- }
92
- const result = await PluginManager.INSTANCE.processBinding(
93
- request,
94
- void 0
95
- // PluginManager.INSTANCE.dbContextLocalStorage.getStore()
79
+ if (unhandled) {
80
+ throw new import_nice_grpc_error_details.RichServerError(
81
+ import_nice_grpc.Status.UNAVAILABLE,
82
+ "Unhandled exception/rejection in previous request: " + errorString(unhandled),
83
+ [
84
+ import_nice_grpc_error_details.DebugInfo.fromPartial({
85
+ detail: unhandled.message,
86
+ stackEntries: unhandled.stack?.split("\n")
87
+ })
88
+ ]
96
89
  );
97
- recordRuntimeInfo(result, request.handlerType);
98
- return result;
99
- } catch (e) {
100
- console.error("worker process binding failed", e);
101
- throw e;
102
90
  }
91
+ const result = await PluginManager.INSTANCE.processBinding(
92
+ request,
93
+ void 0
94
+ // PluginManager.INSTANCE.dbContextLocalStorage.getStore()
95
+ );
96
+ recordRuntimeInfo(result, request.handlerType);
97
+ return result;
103
98
  }
104
99
  import("node:process").then((p) => p.stdout.write(""));
105
100
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service-worker.ts"],"sourcesContent":["import { DataBinding, Empty, ProcessConfigRequest, ProcessConfigResponse, StartRequest } from '@sentio/protos'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { PluginManager } from './plugin.js'\nimport { errorString } from './utils.js'\nimport { freezeGlobalConfig } from './global-config.js'\nimport { DebugInfo, RichServerError } from 'nice-grpc-error-details'\nimport { recordRuntimeInfo } from './service.js'\nimport { BroadcastChannel } from 'worker_threads'\nimport { Piscina } from 'piscina'\nimport { configureEndpoints } from './endpoints.js'\n\nlet started = false\n\nlet unhandled: Error | undefined\n\nprocess\n .on('uncaughtException', (err) => {\n console.error('Uncaught Exception, please checking if await is properly used', err)\n unhandled = err\n })\n .on('unhandledRejection', (reason, p) => {\n // @ts-ignore ignore invalid ens error\n if (reason?.message.startsWith('invalid ENS name (disallowed character: \"*\"')) {\n return\n }\n console.error('Unhandled Rejection, please checking if await is properly', reason)\n unhandled = reason as Error\n // shutdownServers(1)\n })\n\nasync function getConfig(request: ProcessConfigRequest, context?: CallContext): Promise<ProcessConfigResponse> {\n if (!started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const newConfig = ProcessConfigResponse.fromPartial({})\n await PluginManager.INSTANCE.configure(newConfig)\n return newConfig\n}\n\nconst loader = async (options: any) => {\n if (options.target) {\n const m = await import(options.target)\n console.debug('Module loaded, path:', options.target, 'module:', m)\n return m\n }\n}\n\nconst configureChannel = new BroadcastChannel('configure_channel')\nconfigureChannel.onmessage = (request: ProcessConfigRequest) => {\n getConfig(request)\n}\n\nasync function start(request: StartRequest, options: any): Promise<Empty> {\n if (started) {\n return {}\n }\n freezeGlobalConfig()\n\n try {\n await loader(options)\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n await PluginManager.INSTANCE.start(request)\n started = true\n return {}\n}\n\nexport default async function ({ request }: { request: DataBinding }) {\n const { startRequest, configRequest, options } = Piscina.workerData\n if (!started) {\n configureEndpoints(options)\n\n if (startRequest) {\n await start(startRequest, options)\n console.debug('worker started')\n }\n\n if (configRequest) {\n await getConfig(configRequest)\n console.debug('worker configured')\n }\n }\n\n try {\n if (unhandled) {\n throw new RichServerError(\n Status.UNAVAILABLE,\n 'Unhandled exception/rejection in previous request: ' + errorString(unhandled),\n [\n DebugInfo.fromPartial({\n detail: unhandled.message,\n stackEntries: unhandled.stack?.split('\\n')\n })\n ]\n )\n }\n\n const result = await PluginManager.INSTANCE.processBinding(\n request,\n undefined\n // PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n )\n recordRuntimeInfo(result, request.handlerType)\n return result\n } catch (e) {\n console.error('worker process binding failed', e)\n throw e\n }\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;;;;;;;AACA,uBAAiD;AAIjD,qCAA2C;AAE3C,SAAS,wBAAwB;AACjC,SAAS,eAAe;AAGxB,IAAI,UAAU;AAEd,IAAI;AAEJ,QACG,GAAG,qBAAqB,CAAC,QAAQ;AAChC,UAAQ,MAAM,iEAAiE,GAAG;AAClF,cAAY;AACd,CAAC,EACA,GAAG,sBAAsB,CAAC,QAAQ,MAAM;AAEvC,MAAI,QAAQ,QAAQ,WAAW,6CAA6C,GAAG;AAC7E;AAAA,EACF;AACA,UAAQ,MAAM,6DAA6D,MAAM;AACjF,cAAY;AAEd,CAAC;AAEH,eAAe,UAAU,SAA+B,SAAuD;AAC7G,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,6BAAY,wBAAO,aAAa,sBAAsB;AAAA,EAClE;AAEA,QAAM,YAAY,sBAAsB,YAAY,CAAC,CAAC;AACtD,QAAM,cAAc,SAAS,UAAU,SAAS;AAChD,SAAO;AACT;AAEA,IAAM,SAAS,OAAO,YAAiB;AACrC,MAAI,QAAQ,QAAQ;AAClB,UAAM,IAAI,MAAM,OAAO,QAAQ;AAC/B,YAAQ,MAAM,wBAAwB,QAAQ,QAAQ,W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cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/service-worker.ts"],"sourcesContent":["import { DataBinding, Empty, ProcessConfigRequest, ProcessConfigResponse, StartRequest } from '@sentio/protos'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { PluginManager } from './plugin.js'\nimport { errorString } from './utils.js'\nimport { freezeGlobalConfig } from './global-config.js'\nimport { DebugInfo, RichServerError } from 'nice-grpc-error-details'\nimport { recordRuntimeInfo } from './service.js'\nimport { BroadcastChannel } from 'worker_threads'\nimport { Piscina } from 'piscina'\nimport { configureEndpoints } from './endpoints.js'\n\nlet started = false\n\nlet unhandled: Error | undefined\n\nprocess\n .on('uncaughtException', (err) => {\n console.error('Uncaught Exception, please checking if await is properly used', err)\n unhandled = err\n })\n .on('unhandledRejection', (reason, p) => {\n // @ts-ignore ignore invalid ens error\n if (reason?.message.startsWith('invalid ENS name (disallowed character: \"*\"')) {\n return\n }\n console.error('Unhandled Rejection, please checking if await is properly', reason)\n unhandled = reason as Error\n // shutdownServers(1)\n })\n\nasync function getConfig(request: ProcessConfigRequest, context?: CallContext): Promise<ProcessConfigResponse> {\n if (!started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const newConfig = ProcessConfigResponse.fromPartial({})\n await PluginManager.INSTANCE.configure(newConfig)\n return newConfig\n}\n\nconst loader = async (options: any) => {\n if (options.target) {\n const m = await import(options.target)\n console.debug('Module loaded, path:', options.target, 'module:', m)\n return m\n }\n}\n\nconst configureChannel = new BroadcastChannel('configure_channel')\nconfigureChannel.onmessage = (request: ProcessConfigRequest) => {\n getConfig(request)\n}\n\nasync function start(request: StartRequest, options: any): Promise<Empty> {\n if (started) {\n return {}\n }\n freezeGlobalConfig()\n\n try {\n await loader(options)\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n await PluginManager.INSTANCE.start(request)\n started = true\n return {}\n}\n\nexport default async function ({ request }: { request: DataBinding }) {\n const { startRequest, configRequest, options } = Piscina.workerData\n if (!started) {\n configureEndpoints(options)\n\n if (startRequest) {\n await start(startRequest, options)\n console.debug('worker started')\n }\n\n if (configRequest) {\n await getConfig(configRequest)\n console.debug('worker configured')\n }\n }\n\n if (unhandled) {\n throw new RichServerError(\n Status.UNAVAILABLE,\n 'Unhandled exception/rejection in previous request: ' + errorString(unhandled),\n [\n DebugInfo.fromPartial({\n detail: unhandled.message,\n stackEntries: unhandled.stack?.split('\\n')\n })\n ]\n )\n }\n\n const result = await PluginManager.INSTANCE.processBinding(\n request,\n undefined\n // PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n )\n recordRuntimeInfo(result, request.handlerType)\n return result\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;;;;;;;AACA,uBAAiD;AAIjD,qCAA2C;AAE3C,SAAS,wBAAwB;AACjC,SAAS,eAAe;AAGxB,IAAI,UAAU;AAEd,IAAI;AAEJ,QACG,GAAG,qBAAqB,CAAC,QAAQ;AAChC,UAAQ,MAAM,iEAAiE,GAAG;AAClF,cAAY;AACd,CAAC,EACA,GAAG,sBAAsB,CAAC,QAAQ,MAAM;AAEvC,MAAI,QAAQ,QAAQ,WAAW,6CAA6C,GAAG;AAC7E;AAAA,EACF;AACA,UAAQ,MAAM,6DAA6D,MAAM;AACjF,cAAY;AAEd,CAAC;AAEH,eAAe,UAAU,SAA+B,SAAuD;AAC7G,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,6BAAY,wBAAO,aAAa,sBAAsB;AAAA,EAClE;AAEA,QAAM,YAAY,sBAAsB,YAAY,CAAC,CAAC;AACtD,QAAM,cAAc,SAAS,UAAU,SAAS;AAChD,SAAO;AACT;AAEA,IAAM,SAAS,OAAO,YAAiB;AACrC,MAAI,QAAQ,QAAQ;AAClB,UAAM,IAAI,MAAM,OAAO,QAAQ;AAC/B,YAAQ,MAAM,wB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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.57.12-rc.i",
3
+ "version": "2.57.12-rc.j",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/endpoints.ts CHANGED
@@ -14,9 +14,7 @@ export class Endpoints {
14
14
  batchCount = 1
15
15
  }
16
16
 
17
-
18
- export function configureEndpoints(options:any) {
19
-
17
+ export function configureEndpoints(options: any) {
20
18
  const fullPath = path.resolve(options['chains-config'])
21
19
  const chainsConfig = fs.readJsonSync(fullPath)
22
20
 
@@ -45,4 +43,4 @@ export function configureEndpoints(options:any) {
45
43
  }
46
44
  }
47
45
  }
48
- }
46
+ }
@@ -213,7 +213,6 @@ export class ServiceManager implements ProcessorServiceImplementation {
213
213
  })
214
214
  })
215
215
  .catch((e) => {
216
- console.debug(e)
217
216
  dbContext.error(request.processId, e)
218
217
  process_binding_error.add(1)
219
218
  })
@@ -84,29 +84,24 @@ export default async function ({ request }: { request: DataBinding }) {
84
84
  }
85
85
  }
86
86
 
87
- try {
88
- if (unhandled) {
89
- throw new RichServerError(
90
- Status.UNAVAILABLE,
91
- 'Unhandled exception/rejection in previous request: ' + errorString(unhandled),
92
- [
93
- DebugInfo.fromPartial({
94
- detail: unhandled.message,
95
- stackEntries: unhandled.stack?.split('\n')
96
- })
97
- ]
98
- )
99
- }
100
-
101
- const result = await PluginManager.INSTANCE.processBinding(
102
- request,
103
- undefined
104
- // PluginManager.INSTANCE.dbContextLocalStorage.getStore()
87
+ if (unhandled) {
88
+ throw new RichServerError(
89
+ Status.UNAVAILABLE,
90
+ 'Unhandled exception/rejection in previous request: ' + errorString(unhandled),
91
+ [
92
+ DebugInfo.fromPartial({
93
+ detail: unhandled.message,
94
+ stackEntries: unhandled.stack?.split('\n')
95
+ })
96
+ ]
105
97
  )
106
- recordRuntimeInfo(result, request.handlerType)
107
- return result
108
- } catch (e) {
109
- console.error('worker process binding failed', e)
110
- throw e
111
98
  }
99
+
100
+ const result = await PluginManager.INSTANCE.processBinding(
101
+ request,
102
+ undefined
103
+ // PluginManager.INSTANCE.dbContextLocalStorage.getStore()
104
+ )
105
+ recordRuntimeInfo(result, request.handlerType)
106
+ return result
112
107
  }