@sentio/runtime 2.63.0-rc2.2 → 2.63.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/lib/chunk-AUPVVLD3.js +3 -0
- package/lib/chunk-CJDESLYQ.js +3 -0
- package/lib/{chunk-L2A6JPIQ.js.map → chunk-CJDESLYQ.js.map} +1 -1
- package/lib/chunk-G6HW3DCN.js +3 -0
- package/lib/{chunk-MV6JXS2P.js.map → chunk-G6HW3DCN.js.map} +1 -1
- package/lib/chunk-TBN64DSW.js +26 -0
- package/lib/chunk-TBN64DSW.js.map +1 -0
- package/lib/chunk-WHWNPZZ3.js +3 -0
- package/lib/{chunk-6XHWJ2VS.js.map → chunk-WHWNPZZ3.js.map} +1 -1
- package/lib/chunk-WUUWUOFG.js +117 -0
- package/lib/{chunk-FLUYK6N3.js.map → chunk-WUUWUOFG.js.map} +1 -1
- package/lib/chunk-XI22N6AJ.js +38 -0
- package/lib/{chunk-CPJKSHSV.js.map → chunk-XI22N6AJ.js.map} +1 -1
- package/lib/getMachineId-bsd-I6PJXCQT.js +3 -0
- package/lib/{getMachineId-bsd-ZJR2OQTA.js.map → getMachineId-bsd-I6PJXCQT.js.map} +1 -1
- package/lib/getMachineId-darwin-HKHV3WMW.js +4 -0
- package/lib/{getMachineId-darwin-OW6SYINH.js.map → getMachineId-darwin-HKHV3WMW.js.map} +1 -1
- package/lib/getMachineId-linux-I76A7IOE.js +3 -0
- package/lib/{getMachineId-linux-L5XPRJBN.js.map → getMachineId-linux-I76A7IOE.js.map} +1 -1
- package/lib/getMachineId-unsupported-VPOZWIZS.js +3 -0
- package/lib/{getMachineId-unsupported-B3NMIOO3.js.map → getMachineId-unsupported-VPOZWIZS.js.map} +1 -1
- package/lib/getMachineId-win-W5S4EK74.js +3 -0
- package/lib/{getMachineId-win-TT64F63B.js.map → getMachineId-win-W5S4EK74.js.map} +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -76
- package/lib/index.js.map +1 -1
- package/lib/{processor-C-5LJT6m.d.ts → processor-HP-BeI2_.d.ts} +1 -0
- package/lib/processor-runner.js +47 -32977
- package/lib/processor-runner.js.map +1 -1
- package/lib/service-worker.js +2 -132
- package/lib/service-worker.js.map +1 -1
- package/lib/test-processor.test.d.ts +1 -1
- package/lib/test-processor.test.js.map +1 -1
- package/package.json +1 -1
- package/src/full-service.ts +6 -0
- package/src/gen/processor/protos/processor.ts +24 -1
- package/lib/chunk-36V5YZUD.js +0 -25925
- package/lib/chunk-36V5YZUD.js.map +0 -1
- package/lib/chunk-6XHWJ2VS.js +0 -92
- package/lib/chunk-CPJKSHSV.js +0 -10976
- package/lib/chunk-FLUYK6N3.js +0 -60177
- package/lib/chunk-KVSDPGUI.js +0 -50
- package/lib/chunk-L2A6JPIQ.js +0 -21
- package/lib/chunk-MV6JXS2P.js +0 -1703
- package/lib/getMachineId-bsd-ZJR2OQTA.js +0 -41
- package/lib/getMachineId-darwin-OW6SYINH.js +0 -41
- package/lib/getMachineId-linux-L5XPRJBN.js +0 -33
- package/lib/getMachineId-unsupported-B3NMIOO3.js +0 -24
- package/lib/getMachineId-win-TT64F63B.js +0 -43
- /package/lib/{chunk-KVSDPGUI.js.map → chunk-AUPVVLD3.js.map} +0 -0
package/lib/service-worker.js
CHANGED
|
@@ -1,134 +1,4 @@
|
|
|
1
1
|
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-CPJKSHSV.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-FLUYK6N3.js";
|
|
14
|
-
import "./chunk-36V5YZUD.js";
|
|
15
|
-
import "./chunk-MV6JXS2P.js";
|
|
16
|
-
import {
|
|
17
|
-
__toESM
|
|
18
|
-
} from "./chunk-KVSDPGUI.js";
|
|
19
|
-
|
|
20
|
-
// src/service-worker.ts
|
|
21
|
-
var import_nice_grpc = __toESM(require_lib(), 1);
|
|
22
|
-
var import_nice_grpc_error_details = __toESM(require_lib2(), 1);
|
|
23
|
-
import { threadId } from "worker_threads";
|
|
24
|
-
import { Piscina } from "piscina";
|
|
25
|
-
var import_rxjs = __toESM(require_cjs(), 1);
|
|
26
|
-
var started = false;
|
|
27
|
-
var unhandled;
|
|
28
|
-
process.on("uncaughtException", (err) => {
|
|
29
|
-
console.error("Uncaught Exception, please checking if await is properly used", err);
|
|
30
|
-
unhandled = err;
|
|
31
|
-
}).on("unhandledRejection", (reason, p) => {
|
|
32
|
-
if (reason?.message.startsWith('invalid ENS name (disallowed character: "*"')) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
console.error("Unhandled Rejection, please checking if await is properly", reason);
|
|
36
|
-
unhandled = reason;
|
|
37
|
-
}).on("exit", () => {
|
|
38
|
-
console.info("Worker thread exiting, threadId:", threadId);
|
|
39
|
-
});
|
|
40
|
-
var service;
|
|
41
|
-
var loader = async (options) => {
|
|
42
|
-
if (options.target) {
|
|
43
|
-
const m = await import(options.target);
|
|
44
|
-
console.debug("Module loaded, path:", options.target, "module:", m);
|
|
45
|
-
return m;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var emptyCallContext = {};
|
|
49
|
-
async function start(request, options) {
|
|
50
|
-
if (started) {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
freezeGlobalConfig();
|
|
54
|
-
try {
|
|
55
|
-
service = new ProcessorServiceImpl(() => loader(options), options);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Failed to load processor: " + errorString(e));
|
|
58
|
-
}
|
|
59
|
-
await service.start(request, emptyCallContext);
|
|
60
|
-
started = true;
|
|
61
|
-
return {};
|
|
62
|
-
}
|
|
63
|
-
async function service_worker_default({
|
|
64
|
-
processId,
|
|
65
|
-
request: firstRequest,
|
|
66
|
-
workerPort
|
|
67
|
-
}) {
|
|
68
|
-
const { startRequest, configRequest, options } = Piscina.workerData;
|
|
69
|
-
if (!started) {
|
|
70
|
-
const logLevel = process.env["LOG_LEVEL"]?.toUpperCase();
|
|
71
|
-
setupLogger(options.logFormat === "json", logLevel === "debug" ? true : options.debug, threadId);
|
|
72
|
-
configureEndpoints(options);
|
|
73
|
-
if (startRequest) {
|
|
74
|
-
await start(startRequest, options);
|
|
75
|
-
console.debug("worker", threadId, " started, template instance:", startRequest.templateInstances?.length);
|
|
76
|
-
}
|
|
77
|
-
if (configRequest) {
|
|
78
|
-
await service?.getConfig(configRequest, emptyCallContext);
|
|
79
|
-
console.debug("worker", threadId, " configured");
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (unhandled) {
|
|
83
|
-
const err = unhandled;
|
|
84
|
-
unhandled = void 0;
|
|
85
|
-
console.error("Unhandled exception/rejection in previous request:", err);
|
|
86
|
-
throw new import_nice_grpc_error_details.RichServerError(
|
|
87
|
-
import_nice_grpc.Status.UNAVAILABLE,
|
|
88
|
-
"Unhandled exception/rejection in previous request: " + errorString(err),
|
|
89
|
-
[
|
|
90
|
-
import_nice_grpc_error_details.DebugInfo.fromPartial({
|
|
91
|
-
detail: err.message,
|
|
92
|
-
stackEntries: err.stack?.split("\n")
|
|
93
|
-
})
|
|
94
|
-
]
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
const timeout = (options.workerTimeout || 0) * 1e3;
|
|
98
|
-
const enablePartition = options.enablePartition || false;
|
|
99
|
-
await new Promise((resolve, reject) => {
|
|
100
|
-
const subject = new import_rxjs.Subject();
|
|
101
|
-
let timeoutId = void 0;
|
|
102
|
-
subject.subscribe((resp) => {
|
|
103
|
-
console.debug("Worker", threadId, "send response:", resp.result ? "result" : "dbResult");
|
|
104
|
-
workerPort.postMessage(resp);
|
|
105
|
-
if (resp.result) {
|
|
106
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
107
|
-
resolve();
|
|
108
|
-
workerPort.close();
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
workerPort.on("message", (msg) => {
|
|
112
|
-
const request = msg;
|
|
113
|
-
console.debug("Worker", threadId, "received request:", request.start ? "start" : "dbResult");
|
|
114
|
-
service?.handleRequest(request, firstRequest.binding, subject);
|
|
115
|
-
if (enablePartition && request.start && timeout > 0) {
|
|
116
|
-
timeoutId = setTimeout(async () => {
|
|
117
|
-
reject(new import_nice_grpc_error_details.RichServerError(import_nice_grpc.Status.DEADLINE_EXCEEDED, "Worker timeout exceeded"));
|
|
118
|
-
}, timeout);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
console.debug("Worker", threadId, "handle request: binding");
|
|
122
|
-
service?.handleRequest(firstRequest, firstRequest.binding, subject);
|
|
123
|
-
if (!enablePartition && timeout > 0) {
|
|
124
|
-
timeoutId = setTimeout(() => {
|
|
125
|
-
reject(new import_nice_grpc_error_details.RichServerError(import_nice_grpc.Status.DEADLINE_EXCEEDED, "Worker timeout exceeded"));
|
|
126
|
-
}, timeout);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
import("node:process").then((p) => p.stdout.write(""));
|
|
131
|
-
export {
|
|
132
|
-
service_worker_default as default
|
|
133
|
-
};
|
|
2
|
+
import{b as k}from"./chunk-XI22N6AJ.js";import{C as y,H as I,c as h,j as S,o as x,p as C,t as q}from"./chunk-WUUWUOFG.js";import"./chunk-TBN64DSW.js";import"./chunk-G6HW3DCN.js";import{e as E}from"./chunk-AUPVVLD3.js";var s=E(x(),1);var i=E(C(),1);import{threadId as o}from"worker_threads";import{Piscina as L}from"piscina";var D=E(y(),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 F({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.logFormat==="json",r==="debug"?!0:n.debug,o),S(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.workerTimeout||0)*1e3,P=n.enablePartition||!1;await new Promise((r,R)=>{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),P&&g.start&&l>0&&(m=setTimeout(async()=>{R(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))}),console.debug("Worker",o,"handle request: binding"),d?.handleRequest(t,t.binding,f),!P&&l>0&&(m=setTimeout(()=>{R(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))})}import("node:process").then(e=>e.stdout.write(""));export{F as default};
|
|
134
4
|
//# 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'\nimport { ProcessorRuntimeOptions } from 'processor-runner-program.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 .on('exit', () => {\n console.info('Worker thread exiting, threadId:', threadId)\n })\n\nlet service: ProcessorServiceImpl | undefined\n\nconst loader = async (options: ProcessorRuntimeOptions) => {\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: ProcessorRuntimeOptions): 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.logFormat === '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.workerTimeout || 0) * 1000 // convert to milliseconds\n const enablePartition = options.enablePartition || 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":"
|
|
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'\nimport { ProcessorRuntimeOptions } from 'processor-runner-program.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 .on('exit', () => {\n console.info('Worker thread exiting, threadId:', threadId)\n })\n\nlet service: ProcessorServiceImpl | undefined\n\nconst loader = async (options: ProcessorRuntimeOptions) => {\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: ProcessorRuntimeOptions): 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.logFormat === '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.workerTimeout || 0) * 1000 // convert to milliseconds\n const enablePartition = options.enablePartition || 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":"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","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,4 +1,4 @@
|
|
|
1
|
-
import { P as Plugin, D as DataBinding, a as ProcessResult, H as HandlerType } from './processor-
|
|
1
|
+
import { P as Plugin, D as DataBinding, a as ProcessResult, H as HandlerType } from './processor-HP-BeI2_.js';
|
|
2
2
|
import { ProcessStreamResponse_Partitions, InitResponse, ProcessConfigResponse } from '@sentio/protos';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'node:async_hooks';
|
|
@@ -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 { AccountConfig, InitResponse, ProcessConfigResponse, ProcessStreamResponse_Partitions } from '@sentio/protos'\n\nexport class 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 async init(config: InitResponse): Promise<void> {\n config.chainIds = ['1']\n }\n\n async configure(config: ProcessConfigResponse, forChainId?: string): Promise<void> {\n config.accountConfigs = [\n AccountConfig.fromPartial({\n address: '0x',\n chainId: '1'\n })\n ]\n }\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":"
|
|
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 { AccountConfig, InitResponse, ProcessConfigResponse, ProcessStreamResponse_Partitions } from '@sentio/protos'\n\nexport class 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 async init(config: InitResponse): Promise<void> {\n config.chainIds = ['1']\n }\n\n async configure(config: ProcessConfigResponse, forChainId?: string): Promise<void> {\n config.accountConfigs = [\n AccountConfig.fromPartial({\n address: '0x',\n chainId: '1'\n })\n ]\n }\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";yFAIO,IAAMA,EAAN,cAAyBC,CAAO,CACrC,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,CAEA,MAAM,KAAKC,EAAqC,CAC9CA,EAAO,SAAW,CAAC,GAAG,CACxB,CAEA,MAAM,UAAUA,EAA+BC,EAAoC,CACjFD,EAAO,eAAiB,CACtBE,EAAc,YAAY,CACxB,QAAS,KACT,QAAS,GACX,CAAC,CACH,CACF,CACF,EAEAN,EAAc,SAAS,QAAU,CAAC,EAClCA,EAAc,SAAS,SAAS,IAAIJ,CAAY,EAC/C,OAAO,cAAc,EAAE,KAAMW,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["TestPlugin","Plugin","request","dbContext","PluginManager","ProcessResult","acc","id","config","forChainId","AccountConfig","p"]}
|
package/package.json
CHANGED
package/src/full-service.ts
CHANGED
|
@@ -158,6 +158,12 @@ export class RuntimeServicePatcher {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
break
|
|
161
|
+
case HandlerType.SOL_INSTRUCTION:
|
|
162
|
+
const solInstruction = dataBinding.data?.solInstruction
|
|
163
|
+
if (solInstruction?.parsed == null && solInstruction?.rawParsed) {
|
|
164
|
+
solInstruction.parsed = getParsedData(solInstruction.rawParsed)
|
|
165
|
+
}
|
|
166
|
+
break
|
|
161
167
|
case HandlerType.FUEL_TRANSACTION:
|
|
162
168
|
if (compareSemver(this.sdkVersion, FUEL_PROTO_UPDATE_VERSION) < 0) {
|
|
163
169
|
dataBinding.handlerType = HandlerType.FUEL_CALL
|
|
@@ -1277,6 +1277,7 @@ export interface Data_SolInstruction {
|
|
|
1277
1277
|
programAccountId: string;
|
|
1278
1278
|
accounts: string[];
|
|
1279
1279
|
parsed?: { [key: string]: any } | undefined;
|
|
1280
|
+
rawParsed?: string | undefined;
|
|
1280
1281
|
}
|
|
1281
1282
|
|
|
1282
1283
|
export interface Data_AptEvent {
|
|
@@ -10590,7 +10591,14 @@ export const Data_EthTrace = {
|
|
|
10590
10591
|
};
|
|
10591
10592
|
|
|
10592
10593
|
function createBaseData_SolInstruction(): Data_SolInstruction {
|
|
10593
|
-
return {
|
|
10594
|
+
return {
|
|
10595
|
+
instructionData: "",
|
|
10596
|
+
slot: BigInt("0"),
|
|
10597
|
+
programAccountId: "",
|
|
10598
|
+
accounts: [],
|
|
10599
|
+
parsed: undefined,
|
|
10600
|
+
rawParsed: undefined,
|
|
10601
|
+
};
|
|
10594
10602
|
}
|
|
10595
10603
|
|
|
10596
10604
|
export const Data_SolInstruction = {
|
|
@@ -10613,6 +10621,9 @@ export const Data_SolInstruction = {
|
|
|
10613
10621
|
if (message.parsed !== undefined) {
|
|
10614
10622
|
Struct.encode(Struct.wrap(message.parsed), writer.uint32(34).fork()).ldelim();
|
|
10615
10623
|
}
|
|
10624
|
+
if (message.rawParsed !== undefined) {
|
|
10625
|
+
writer.uint32(58).string(message.rawParsed);
|
|
10626
|
+
}
|
|
10616
10627
|
return writer;
|
|
10617
10628
|
},
|
|
10618
10629
|
|
|
@@ -10658,6 +10669,13 @@ export const Data_SolInstruction = {
|
|
|
10658
10669
|
|
|
10659
10670
|
message.parsed = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
10660
10671
|
continue;
|
|
10672
|
+
case 7:
|
|
10673
|
+
if (tag !== 58) {
|
|
10674
|
+
break;
|
|
10675
|
+
}
|
|
10676
|
+
|
|
10677
|
+
message.rawParsed = reader.string();
|
|
10678
|
+
continue;
|
|
10661
10679
|
}
|
|
10662
10680
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10663
10681
|
break;
|
|
@@ -10674,6 +10692,7 @@ export const Data_SolInstruction = {
|
|
|
10674
10692
|
programAccountId: isSet(object.programAccountId) ? globalThis.String(object.programAccountId) : "",
|
|
10675
10693
|
accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => globalThis.String(e)) : [],
|
|
10676
10694
|
parsed: isObject(object.parsed) ? object.parsed : undefined,
|
|
10695
|
+
rawParsed: isSet(object.rawParsed) ? globalThis.String(object.rawParsed) : undefined,
|
|
10677
10696
|
};
|
|
10678
10697
|
},
|
|
10679
10698
|
|
|
@@ -10694,6 +10713,9 @@ export const Data_SolInstruction = {
|
|
|
10694
10713
|
if (message.parsed !== undefined) {
|
|
10695
10714
|
obj.parsed = message.parsed;
|
|
10696
10715
|
}
|
|
10716
|
+
if (message.rawParsed !== undefined) {
|
|
10717
|
+
obj.rawParsed = message.rawParsed;
|
|
10718
|
+
}
|
|
10697
10719
|
return obj;
|
|
10698
10720
|
},
|
|
10699
10721
|
|
|
@@ -10707,6 +10729,7 @@ export const Data_SolInstruction = {
|
|
|
10707
10729
|
message.programAccountId = object.programAccountId ?? "";
|
|
10708
10730
|
message.accounts = object.accounts?.map((e) => e) || [];
|
|
10709
10731
|
message.parsed = object.parsed ?? undefined;
|
|
10732
|
+
message.rawParsed = object.rawParsed ?? undefined;
|
|
10710
10733
|
return message;
|
|
10711
10734
|
},
|
|
10712
10735
|
};
|