@sentio/runtime 2.59.2 → 2.59.3-rc.2

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.
@@ -1,4 +1,132 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{a as k}from"./chunk-JPHAFAK7.js";import{$ as I,W as C,c as h,j as R,p as x,q as y,s as q}from"./chunk-PEHR2WT4.js";import{e as E}from"./chunk-VUN3TGG5.js";var s=E(x(),1);var i=E(y(),1);import{threadId as o}from"worker_threads";import{Piscina as L}from"piscina";var D=E(C(),1),b=!1,u;process.on("uncaughtException",e=>{console.error("Uncaught Exception, please checking if await is properly used",e),u=e}).on("unhandledRejection",(e,t)=>{e?.message.startsWith('invalid ENS name (disallowed character: "*"')||(console.error("Unhandled Rejection, please checking if await is properly",e),u=e)}).on("exit",()=>{console.info("Worker thread exiting, threadId:",o)});var d,A=async e=>{if(e.target){let t=await import(e.target);return console.debug("Module loaded, path:",e.target,"module:",t),t}},v={};async function N(e,t){if(b)return{};q();try{d=new I(()=>A(t),t)}catch(a){throw new s.ServerError(s.Status.INVALID_ARGUMENT,"Failed to load processor: "+h(a))}return await d.start(e,v),b=!0,{}}async function z({processId:e,request:t,workerPort:a}){let{startRequest:p,configRequest:w,options:n}=L.workerData;if(!b){let r=process.env.LOG_LEVEL?.toUpperCase();k(n["log-format"]==="json",r==="debug"?!0:n.debug,o),R(n),p&&(await N(p,n),console.debug("worker",o," started, template instance:",p.templateInstances?.length)),w&&(await d?.getConfig(w,v),console.debug("worker",o," configured"))}if(u){let r=u;throw u=void 0,console.error("Unhandled exception/rejection in previous request:",r),new i.RichServerError(s.Status.UNAVAILABLE,"Unhandled exception/rejection in previous request: "+h(r),[i.DebugInfo.fromPartial({detail:r.message,stackEntries:r.stack?.split(`
3
- `)})])}let l=n["worker-timeout"]||0,S=n["enable-partition"]||!1;await new Promise((r,P)=>{let f=new D.Subject,m;f.subscribe(c=>{console.debug("Worker",o,"send response:",c.result?"result":"dbResult"),a.postMessage(c),c.result&&(m&&clearTimeout(m),r(),a.close())}),a.on("message",c=>{let g=c;console.debug("Worker",o,"received request:",g.start?"start":"dbResult"),d?.handleRequest(g,t.binding,f),S&&g.start&&l>0&&(m=setTimeout(async()=>{P(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))}),console.debug("Worker",o,"handle request: binding"),d?.handleRequest(t,t.binding,f),!S&&l>0&&(m=setTimeout(()=>{P(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))})}import("node:process").then(e=>e.stdout.write(""));export{z as default};
2
+ import {
3
+ setupLogger
4
+ } from "./chunk-U5UZYRQ4.js";
5
+ import {
6
+ ProcessorServiceImpl,
7
+ configureEndpoints,
8
+ errorString,
9
+ freezeGlobalConfig,
10
+ require_cjs,
11
+ require_lib3 as require_lib,
12
+ require_lib4 as require_lib2
13
+ } from "./chunk-L7MQIWIO.js";
14
+ import {
15
+ __toESM
16
+ } from "./chunk-LCS6SRJY.js";
17
+
18
+ // src/service-worker.ts
19
+ var import_nice_grpc = __toESM(require_lib(), 1);
20
+ var import_nice_grpc_error_details = __toESM(require_lib2(), 1);
21
+ import { threadId } from "worker_threads";
22
+ import { Piscina } from "piscina";
23
+ var import_rxjs = __toESM(require_cjs(), 1);
24
+ var started = false;
25
+ var unhandled;
26
+ process.on("uncaughtException", (err) => {
27
+ console.error("Uncaught Exception, please checking if await is properly used", err);
28
+ unhandled = err;
29
+ }).on("unhandledRejection", (reason, p) => {
30
+ if (reason?.message.startsWith('invalid ENS name (disallowed character: "*"')) {
31
+ return;
32
+ }
33
+ console.error("Unhandled Rejection, please checking if await is properly", reason);
34
+ unhandled = reason;
35
+ }).on("exit", () => {
36
+ console.info("Worker thread exiting, threadId:", threadId);
37
+ });
38
+ var service;
39
+ var loader = async (options) => {
40
+ if (options.target) {
41
+ const m = await import(options.target);
42
+ console.debug("Module loaded, path:", options.target, "module:", m);
43
+ return m;
44
+ }
45
+ };
46
+ var emptyCallContext = {};
47
+ async function start(request, options) {
48
+ if (started) {
49
+ return {};
50
+ }
51
+ freezeGlobalConfig();
52
+ try {
53
+ service = new ProcessorServiceImpl(() => loader(options), options);
54
+ } catch (e) {
55
+ throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Failed to load processor: " + errorString(e));
56
+ }
57
+ await service.start(request, emptyCallContext);
58
+ started = true;
59
+ return {};
60
+ }
61
+ async function service_worker_default({
62
+ processId,
63
+ request: firstRequest,
64
+ workerPort
65
+ }) {
66
+ const { startRequest, configRequest, options } = Piscina.workerData;
67
+ if (!started) {
68
+ const logLevel = process.env["LOG_LEVEL"]?.toUpperCase();
69
+ setupLogger(options["log-format"] === "json", logLevel === "debug" ? true : options.debug, threadId);
70
+ configureEndpoints(options);
71
+ if (startRequest) {
72
+ await start(startRequest, options);
73
+ console.debug("worker", threadId, " started, template instance:", startRequest.templateInstances?.length);
74
+ }
75
+ if (configRequest) {
76
+ await service?.getConfig(configRequest, emptyCallContext);
77
+ console.debug("worker", threadId, " configured");
78
+ }
79
+ }
80
+ if (unhandled) {
81
+ const err = unhandled;
82
+ unhandled = void 0;
83
+ console.error("Unhandled exception/rejection in previous request:", err);
84
+ throw new import_nice_grpc_error_details.RichServerError(
85
+ import_nice_grpc.Status.UNAVAILABLE,
86
+ "Unhandled exception/rejection in previous request: " + errorString(err),
87
+ [
88
+ import_nice_grpc_error_details.DebugInfo.fromPartial({
89
+ detail: err.message,
90
+ stackEntries: err.stack?.split("\n")
91
+ })
92
+ ]
93
+ );
94
+ }
95
+ const timeout = options["worker-timeout"] || 0;
96
+ const enablePartition = options["enable-partition"] || false;
97
+ await new Promise((resolve, reject) => {
98
+ const subject = new import_rxjs.Subject();
99
+ let timeoutId = void 0;
100
+ subject.subscribe((resp) => {
101
+ console.debug("Worker", threadId, "send response:", resp.result ? "result" : "dbResult");
102
+ workerPort.postMessage(resp);
103
+ if (resp.result) {
104
+ if (timeoutId) clearTimeout(timeoutId);
105
+ resolve();
106
+ workerPort.close();
107
+ }
108
+ });
109
+ workerPort.on("message", (msg) => {
110
+ const request = msg;
111
+ console.debug("Worker", threadId, "received request:", request.start ? "start" : "dbResult");
112
+ service?.handleRequest(request, firstRequest.binding, subject);
113
+ if (enablePartition && request.start && timeout > 0) {
114
+ timeoutId = setTimeout(async () => {
115
+ reject(new import_nice_grpc_error_details.RichServerError(import_nice_grpc.Status.DEADLINE_EXCEEDED, "Worker timeout exceeded"));
116
+ }, timeout);
117
+ }
118
+ });
119
+ console.debug("Worker", threadId, "handle request: binding");
120
+ service?.handleRequest(firstRequest, firstRequest.binding, subject);
121
+ if (!enablePartition && timeout > 0) {
122
+ timeoutId = setTimeout(() => {
123
+ reject(new import_nice_grpc_error_details.RichServerError(import_nice_grpc.Status.DEADLINE_EXCEEDED, "Worker timeout exceeded"));
124
+ }, timeout);
125
+ }
126
+ });
127
+ }
128
+ import("node:process").then((p) => p.stdout.write(""));
129
+ export {
130
+ service_worker_default as default
131
+ };
4
132
  //# sourceMappingURL=service-worker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service-worker.ts"],"sourcesContent":["import { DeepPartial, Empty, ProcessStreamRequest, ProcessStreamResponse, StartRequest } from '@sentio/protos'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { errorString } from './utils.js'\nimport { freezeGlobalConfig } from './global-config.js'\nimport { DebugInfo, RichServerError } from 'nice-grpc-error-details'\nimport { ProcessorServiceImpl } from './service.js'\nimport { MessagePort, threadId } from 'worker_threads'\nimport { Piscina } from 'piscina'\nimport { configureEndpoints } from './endpoints.js'\nimport { setupLogger } from './logger.js'\nimport { Subject } from 'rxjs'\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 .on('exit', () => {\n console.info('Worker thread exiting, threadId:', threadId)\n })\n\nlet service: ProcessorServiceImpl | undefined\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 emptyCallContext = <CallContext>{}\n\nasync function start(request: StartRequest, options: any): Promise<Empty> {\n if (started) {\n return {}\n }\n freezeGlobalConfig()\n\n try {\n service = new ProcessorServiceImpl(() => loader(options), options)\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n await service.start(request, emptyCallContext)\n started = true\n return {}\n}\n\nexport default async function ({\n processId,\n request: firstRequest,\n workerPort\n}: {\n processId: number\n request: ProcessStreamRequest\n workerPort: MessagePort\n}) {\n const { startRequest, configRequest, options } = Piscina.workerData\n if (!started) {\n const logLevel = process.env['LOG_LEVEL']?.toUpperCase()\n setupLogger(options['log-format'] === 'json', logLevel === 'debug' ? true : options.debug, threadId)\n\n configureEndpoints(options)\n\n if (startRequest) {\n await start(startRequest, options)\n console.debug('worker', threadId, ' started, template instance:', startRequest.templateInstances?.length)\n }\n\n if (configRequest) {\n await service?.getConfig(configRequest, emptyCallContext)\n console.debug('worker', threadId, ' configured')\n }\n }\n\n if (unhandled) {\n const err = unhandled\n unhandled = undefined\n console.error('Unhandled exception/rejection in previous request:', err)\n throw new RichServerError(\n Status.UNAVAILABLE,\n 'Unhandled exception/rejection in previous request: ' + errorString(err),\n [\n DebugInfo.fromPartial({\n detail: err.message,\n stackEntries: err.stack?.split('\\n')\n })\n ]\n )\n }\n const timeout = options['worker-timeout'] || 0\n const enablePartition = options['enable-partition'] || false\n await new Promise<void>((resolve, reject) => {\n const subject = new Subject<DeepPartial<ProcessStreamResponse>>()\n let timeoutId: NodeJS.Timeout | undefined = undefined\n subject.subscribe((resp: ProcessStreamResponse) => {\n console.debug('Worker', threadId, 'send response:', resp.result ? 'result' : 'dbResult')\n workerPort.postMessage(resp)\n // receive the response from the processor , close and resolve the promise\n if (resp.result) {\n if (timeoutId) clearTimeout(timeoutId)\n resolve()\n workerPort.close()\n }\n })\n workerPort.on('message', (msg: ProcessStreamRequest) => {\n const request = msg as ProcessStreamRequest\n console.debug('Worker', threadId, 'received request:', request.start ? 'start' : 'dbResult')\n service?.handleRequest(request, firstRequest.binding, subject)\n if (enablePartition && request.start && timeout > 0) {\n timeoutId = setTimeout(async () => {\n reject(new RichServerError(Status.DEADLINE_EXCEEDED, 'Worker timeout exceeded'))\n }, timeout)\n }\n })\n console.debug('Worker', threadId, 'handle request: binding')\n service?.handleRequest(firstRequest, firstRequest.binding, subject)\n if (!enablePartition && timeout > 0) {\n timeoutId = setTimeout(() => {\n reject(new RichServerError(Status.DEADLINE_EXCEEDED, 'Worker timeout exceeded'))\n }, timeout)\n }\n })\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";kKACA,IAAAA,EAAiD,SAGjD,IAAAC,EAA2C,SAE3C,OAAsB,YAAAC,MAAgB,iBACtC,OAAS,WAAAC,MAAe,UAGxB,IAAAC,EAAwB,SAEpBC,EAAU,GAEVC,EAEJ,QACG,GAAG,oBAAsBC,GAAQ,CAChC,QAAQ,MAAM,gEAAiEA,CAAG,EAClFD,EAAYC,CACd,CAAC,EACA,GAAG,qBAAsB,CAACC,EAAQC,IAAM,CAEnCD,GAAQ,QAAQ,WAAW,6CAA6C,IAG5E,QAAQ,MAAM,4DAA6DA,CAAM,EACjFF,EAAYE,EAEd,CAAC,EACA,GAAG,OAAQ,IAAM,CAChB,QAAQ,KAAK,mCAAoCE,CAAQ,CAC3D,CAAC,EAEH,IAAIC,EAEEC,EAAS,MAAOC,GAAiB,CACrC,GAAIA,EAAQ,OAAQ,CAClB,IAAMC,EAAI,MAAM,OAAOD,EAA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gBAAgB,GAAK,EACvCoB,EAAkBpB,EAAQ,kBAAkB,GAAK,GACvD,MAAM,IAAI,QAAc,CAACqB,EAASC,IAAW,CAC3C,IAAMC,EAAU,IAAI,UAChBC,EACJD,EAAQ,UAAWE,GAAgC,CACjD,QAAQ,MAAM,SAAU5B,EAAU,iBAAkB4B,EAAK,OAAS,SAAW,UAAU,EACvFb,EAAW,YAAYa,CAAI,EAEvBA,EAAK,SACHD,GAAW,aAAaA,CAAS,EACrCH,EAAQ,EACRT,EAAW,MAAM,EAErB,CAAC,EACDA,EAAW,GAAG,UAAYc,GAA8B,CACtD,IAAMtB,EAAUsB,EAChB,QAAQ,MAAM,SAAU7B,EAAU,oBAAqBO,EAAQ,MAAQ,QAAU,UAAU,EAC3FN,GAAS,cAAcM,EAASO,EAAa,QAASY,CAAO,EACzDH,GAAmBhB,EAAQ,OAASe,EAAU,IAChDK,EAAY,WAAW,SAAY,CACjCF,EAAO,IAAI,kBAAgB,SAAO,kBAAmB,yBAAyB,CAAC,CACjF,EAAGH,CAAO,EAEd,CAAC,EACD,QAAQ,MAAM,SAAUtB,EAAU,yBAAyB,EAC3DC,GAAS,cAAca,EAAcA,EAAa,QAASY,CAAO,EAC9D,CAACH,GAAmBD,EAAU,IAChCK,EAAY,WAAW,IAAM,CAC3BF,EAAO,IAAI,kBAAgB,SAAO,kBAAmB,yBAAyB,CAAC,CACjF,EAAGH,CAAO,EAEd,CAAC,CACH,CACC,OAAO,cAAc,EAAE,KAAMvB,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["import_nice_grpc","import_nice_grpc_error_details","threadId","Piscina","import_rxjs","started","unhandled","err","reason","p","threadId","service","loader","options","m","emptyCallContext","start","request","freezeGlobalConfig","ProcessorServiceImpl","e","errorString","service_worker_default","processId","firstRequest","workerPort","startRequest","configRequest","Piscina","logLevel","setupLogger","configureEndpoints","timeout","enablePartition","resolve","reject","subject","timeoutId","resp","msg"]}
1
+ {"version":3,"sources":["../src/service-worker.ts"],"sourcesContent":["import { DeepPartial, Empty, ProcessStreamRequest, ProcessStreamResponse, StartRequest } from '@sentio/protos'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { errorString } from './utils.js'\nimport { freezeGlobalConfig } from './global-config.js'\nimport { DebugInfo, RichServerError } from 'nice-grpc-error-details'\nimport { ProcessorServiceImpl } from './service.js'\nimport { MessagePort, threadId } from 'worker_threads'\nimport { Piscina } from 'piscina'\nimport { configureEndpoints } from './endpoints.js'\nimport { setupLogger } from './logger.js'\nimport { Subject } from 'rxjs'\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 .on('exit', () => {\n console.info('Worker thread exiting, threadId:', threadId)\n })\n\nlet service: ProcessorServiceImpl | undefined\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 emptyCallContext = <CallContext>{}\n\nasync function start(request: StartRequest, options: any): Promise<Empty> {\n if (started) {\n return {}\n }\n freezeGlobalConfig()\n\n try {\n service = new ProcessorServiceImpl(() => loader(options), options)\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n await service.start(request, emptyCallContext)\n started = true\n return {}\n}\n\nexport default async function ({\n processId,\n request: firstRequest,\n workerPort\n}: {\n processId: number\n request: ProcessStreamRequest\n workerPort: MessagePort\n}) {\n const { startRequest, configRequest, options } = Piscina.workerData\n if (!started) {\n const logLevel = process.env['LOG_LEVEL']?.toUpperCase()\n setupLogger(options['log-format'] === 'json', logLevel === 'debug' ? true : options.debug, threadId)\n\n configureEndpoints(options)\n\n if (startRequest) {\n await start(startRequest, options)\n console.debug('worker', threadId, ' started, template instance:', startRequest.templateInstances?.length)\n }\n\n if (configRequest) {\n await service?.getConfig(configRequest, emptyCallContext)\n console.debug('worker', threadId, ' configured')\n }\n }\n\n if (unhandled) {\n const err = unhandled\n unhandled = undefined\n console.error('Unhandled exception/rejection in previous request:', err)\n throw new RichServerError(\n Status.UNAVAILABLE,\n 'Unhandled exception/rejection in previous request: ' + errorString(err),\n [\n DebugInfo.fromPartial({\n detail: err.message,\n stackEntries: err.stack?.split('\\n')\n })\n ]\n )\n }\n const timeout = options['worker-timeout'] || 0\n const enablePartition = options['enable-partition'] || false\n await new Promise<void>((resolve, reject) => {\n const subject = new Subject<DeepPartial<ProcessStreamResponse>>()\n let timeoutId: NodeJS.Timeout | undefined = undefined\n subject.subscribe((resp: ProcessStreamResponse) => {\n console.debug('Worker', threadId, 'send response:', resp.result ? 'result' : 'dbResult')\n workerPort.postMessage(resp)\n // receive the response from the processor , close and resolve the promise\n if (resp.result) {\n if (timeoutId) clearTimeout(timeoutId)\n resolve()\n workerPort.close()\n }\n })\n workerPort.on('message', (msg: ProcessStreamRequest) => {\n const request = msg as ProcessStreamRequest\n console.debug('Worker', threadId, 'received request:', request.start ? 'start' : 'dbResult')\n service?.handleRequest(request, firstRequest.binding, subject)\n if (enablePartition && request.start && timeout > 0) {\n timeoutId = setTimeout(async () => {\n reject(new RichServerError(Status.DEADLINE_EXCEEDED, 'Worker timeout exceeded'))\n }, timeout)\n }\n })\n console.debug('Worker', threadId, 'handle request: binding')\n service?.handleRequest(firstRequest, firstRequest.binding, subject)\n if (!enablePartition && timeout > 0) {\n timeoutId = setTimeout(() => {\n reject(new RichServerError(Status.DEADLINE_EXCEEDED, 'Worker timeout exceeded'))\n }, timeout)\n }\n })\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;;;;;;;;;AACA,uBAAiD;AAGjD,qCAA2C;AAE3C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BAAO,IAAI,+CAAgB,wBAAO,mBAAmB,yBAAyB,CAAC;AAAA,QACjF,GAAG,OAAO;AAAA,MACZ;AAAA,IACF,CAAC;AACD,YAAQ,MAAM,UAAU,UAAU,yBAAyB;AAC3D,aAAS,cAAc,cAAc,aAAa,SAAS,OAAO;AAClE,QAAI,CAAC,mBAAmB,UAAU,GAAG;AACnC,kBAAY,WAAW,MAAM;AAC3B,eAAO,IAAI,+CAAgB,wBAAO,mBAAmB,yBAAyB,CAAC;AAAA,MACjF,GAAG,OAAO;AAAA,IACZ;AAAA,EACF,CAAC;AACH;AACC,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/test-processor.test.ts"],"sourcesContent":["import { Plugin, PluginManager } from './plugin.js'\nimport { DataBinding, HandlerType, ProcessResult } from './gen/processor/protos/processor.js'\nimport { ProcessStreamResponse_Partitions } from '@sentio/protos'\n\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n if (dbContext) {\n await dbContext.sendRequest({\n get: {\n entity: 'Test',\n id: '1'\n }\n })\n }\n\n return ProcessResult.fromPartial({\n states: {\n configUpdated: true\n }\n })\n }\n supportedHandlers = [HandlerType.UNKNOWN, HandlerType.ETH_LOG]\n\n async partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions> {\n return {\n partitions: request.handlerIds.reduce(\n (acc, id) => ({\n ...acc,\n [id]: {\n userValue: 'test'\n }\n }),\n {}\n )\n }\n }\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";sDAIA,IAAMA,EAAN,cAAyBC,CAAO,CAC9B,MAAM,eAAeC,EAA8C,CACjE,IAAMC,EAAYC,EAAc,SAAS,sBAAsB,SAAS,EACxE,OAAID,GACF,MAAMA,EAAU,YAAY,CAC1B,IAAK,CACH,OAAQ,OACR,GAAI,GACN,CACF,CAAC,EAGIE,EAAc,YAAY,CAC/B,OAAQ,CACN,cAAe,EACjB,CACF,CAAC,CACH,CACA,kBAAoB,IAAyC,EAE7D,MAAM,UAAUH,EAAiE,CAC/E,MAAO,CACL,WAAYA,EAAQ,WAAW,OAC7B,CAACI,EAAKC,KAAQ,CACZ,GAAGD,EACH,CAACC,CAAE,EAAG,CACJ,UAAW,MACb,CACF,GACA,CAAC,CACH,CACF,CACF,CACF,EAEAH,EAAc,SAAS,QAAU,CAAC,EAClCA,EAAc,SAAS,SAAS,IAAIJ,CAAY,EAC/C,OAAO,cAAc,EAAE,KAAMQ,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["TestPlugin","Plugin","request","dbContext","PluginManager","ProcessResult","acc","id","p"]}
1
+ {"version":3,"sources":["../src/test-processor.test.ts"],"sourcesContent":["import { Plugin, PluginManager } from './plugin.js'\nimport { DataBinding, HandlerType, ProcessResult } from './gen/processor/protos/processor.js'\nimport { ProcessStreamResponse_Partitions } from '@sentio/protos'\n\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n if (dbContext) {\n await dbContext.sendRequest({\n get: {\n entity: 'Test',\n id: '1'\n }\n })\n }\n\n return ProcessResult.fromPartial({\n states: {\n configUpdated: true\n }\n })\n }\n supportedHandlers = [HandlerType.UNKNOWN, HandlerType.ETH_LOG]\n\n async partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions> {\n return {\n partitions: request.handlerIds.reduce(\n (acc, id) => ({\n ...acc,\n [id]: {\n userValue: 'test'\n }\n }),\n {}\n )\n }\n }\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;AAIA,IAAM,aAAN,cAAyB,OAAO;AAAA,EAC9B,MAAM,eAAe,SAA8C;AACjE,UAAM,YAAY,cAAc,SAAS,sBAAsB,SAAS;AACxE,QAAI,WAAW;AACb,YAAM,UAAU,YAAY;AAAA,QAC1B,KAAK;AAAA,UACH,QAAQ;AAAA,UACR,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,cAAc,YAAY;AAAA,MAC/B,QAAQ;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,oBAAoB,iCAAyC;AAAA,EAE7D,MAAM,UAAU,SAAiE;AAC/E,WAAO;AAAA,MACL,YAAY,QAAQ,WAAW;AAAA,QAC7B,CAAC,KAAK,QAAQ;AAAA,UACZ,GAAG;AAAA,UACH,CAAC,EAAE,GAAG;AAAA,YACJ,WAAW;AAAA,UACb;AAAA,QACF;AAAA,QACA,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEA,cAAc,SAAS,UAAU,CAAC;AAClC,cAAc,SAAS,SAAS,IAAI,WAAW,CAAC;AAC/C,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.59.2",
3
+ "version": "2.59.3-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {