@sentio/runtime 2.40.0-rc.14 → 2.40.0-rc.15
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-FFU5RYDX.js → chunk-IO6D7U2E.js} +9 -6
- package/lib/index.d.ts +2 -4
- package/lib/index.js +1 -1
- package/lib/processor-runner.js +1 -1
- package/package.json +1 -1
- package/src/service.ts +12 -8
@@ -78428,7 +78428,7 @@ var ProcessorServiceImpl = class {
|
|
78428
78428
|
// private processorConfig: ProcessConfigResponse
|
78429
78429
|
loader;
|
78430
78430
|
shutdownHandler;
|
78431
|
-
|
78431
|
+
preparedData;
|
78432
78432
|
constructor(loader, shutdownHandler) {
|
78433
78433
|
this.loader = loader;
|
78434
78434
|
this.shutdownHandler = shutdownHandler;
|
@@ -78468,10 +78468,10 @@ var ProcessorServiceImpl = class {
|
|
78468
78468
|
return {};
|
78469
78469
|
}
|
78470
78470
|
async processBindings(request, options) {
|
78471
|
-
const
|
78471
|
+
const preparedData = await this.preprocessBindings(request.bindings, void 0, options);
|
78472
78472
|
const promises = [];
|
78473
78473
|
for (const binding of request.bindings) {
|
78474
|
-
const promise2 = this.processBinding(binding,
|
78474
|
+
const promise2 = this.processBinding(binding, preparedData);
|
78475
78475
|
if (GLOBAL_CONFIG.execution.sequential) {
|
78476
78476
|
await promise2;
|
78477
78477
|
}
|
@@ -78541,7 +78541,9 @@ var ProcessorServiceImpl = class {
|
|
78541
78541
|
console.error(`eth call error: ${e}`);
|
78542
78542
|
}
|
78543
78543
|
console.log(`${callPromises.length} calls finished, elapsed: ${Date.now() - start}ms`);
|
78544
|
-
return
|
78544
|
+
return {
|
78545
|
+
ethCallResults: results
|
78546
|
+
};
|
78545
78547
|
}
|
78546
78548
|
async preprocessBinding(request, dbContext, options) {
|
78547
78549
|
if (!this.started) {
|
@@ -78603,7 +78605,8 @@ var ProcessorServiceImpl = class {
|
|
78603
78605
|
const bindings = request.bindings.bindings;
|
78604
78606
|
const dbContext = contexts.new(request.processId, subject);
|
78605
78607
|
const start = Date.now();
|
78606
|
-
this.preprocessBindings(bindings, dbContext).then(() => {
|
78608
|
+
this.preprocessBindings(bindings, dbContext).then((preparedData) => {
|
78609
|
+
this.preparedData = preparedData;
|
78607
78610
|
subject.next({
|
78608
78611
|
processId: request.processId
|
78609
78612
|
});
|
@@ -78648,7 +78651,7 @@ var ProcessorServiceImpl = class {
|
|
78648
78651
|
const binding = request.binding;
|
78649
78652
|
const dbContext = contexts.new(request.processId, subject);
|
78650
78653
|
const start = Date.now();
|
78651
|
-
PluginManager.INSTANCE.processBinding(binding,
|
78654
|
+
PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext).then((result) => {
|
78652
78655
|
subject.next({
|
78653
78656
|
result,
|
78654
78657
|
processId: request.processId
|
package/lib/index.d.ts
CHANGED
@@ -107,15 +107,13 @@ declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
107
107
|
unhandled: Error;
|
108
108
|
private readonly loader;
|
109
109
|
private readonly shutdownHandler?;
|
110
|
-
private
|
110
|
+
private preparedData;
|
111
111
|
constructor(loader: () => Promise<any>, shutdownHandler?: () => void);
|
112
112
|
getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse>;
|
113
113
|
start(request: StartRequest, context: CallContext): Promise<Empty>;
|
114
114
|
stop(request: Empty, context: CallContext): Promise<Empty>;
|
115
115
|
processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse>;
|
116
|
-
preprocessBindings(bindings: DataBinding[], dbContext?: StoreContext, options?: CallContext): Promise<
|
117
|
-
[ethCallKey: string]: string;
|
118
|
-
}>;
|
116
|
+
preprocessBindings(bindings: DataBinding[], dbContext?: StoreContext, options?: CallContext): Promise<PreparedData>;
|
119
117
|
preprocessBinding(request: DataBinding, dbContext?: StoreContext, options?: CallContext): Promise<PreprocessResult>;
|
120
118
|
processBinding(request: DataBinding, preparedData: PreparedData | undefined, options?: CallContext): Promise<ProcessResult>;
|
121
119
|
processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext): AsyncGenerator<{
|
package/lib/index.js
CHANGED
package/lib/processor-runner.js
CHANGED
package/package.json
CHANGED
package/src/service.ts
CHANGED
@@ -54,7 +54,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
54
54
|
|
55
55
|
private readonly shutdownHandler?: () => void
|
56
56
|
|
57
|
-
private
|
57
|
+
private preparedData: PreparedData | undefined
|
58
58
|
|
59
59
|
constructor(loader: () => Promise<any>, shutdownHandler?: () => void) {
|
60
60
|
this.loader = loader
|
@@ -128,11 +128,11 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
128
128
|
}
|
129
129
|
|
130
130
|
async processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse> {
|
131
|
-
const
|
131
|
+
const preparedData = await this.preprocessBindings(request.bindings, undefined, options)
|
132
132
|
|
133
133
|
const promises = []
|
134
134
|
for (const binding of request.bindings) {
|
135
|
-
const promise = this.processBinding(binding,
|
135
|
+
const promise = this.processBinding(binding, preparedData)
|
136
136
|
if (GLOBAL_CONFIG.execution.sequential) {
|
137
137
|
await promise
|
138
138
|
}
|
@@ -161,7 +161,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
161
161
|
bindings: DataBinding[],
|
162
162
|
dbContext?: StoreContext,
|
163
163
|
options?: CallContext
|
164
|
-
): Promise<
|
164
|
+
): Promise<PreparedData> {
|
165
165
|
console.debug(`preprocessBindings start, bindings: ${bindings.length}`)
|
166
166
|
const promises = []
|
167
167
|
for (const binding of bindings) {
|
@@ -212,14 +212,16 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
212
212
|
)
|
213
213
|
}
|
214
214
|
}
|
215
|
-
let results = {}
|
215
|
+
let results: { [p: string]: string } = {}
|
216
216
|
try {
|
217
217
|
results = Object.fromEntries(await Promise.all(callPromises))
|
218
218
|
} catch (e) {
|
219
219
|
console.error(`eth call error: ${e}`)
|
220
220
|
}
|
221
221
|
console.log(`${callPromises.length} calls finished, elapsed: ${Date.now() - start}ms`)
|
222
|
-
return
|
222
|
+
return {
|
223
|
+
ethCallResults: results
|
224
|
+
}
|
223
225
|
}
|
224
226
|
|
225
227
|
async preprocessBinding(
|
@@ -301,7 +303,9 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
301
303
|
const dbContext = contexts.new(request.processId, subject)
|
302
304
|
const start = Date.now()
|
303
305
|
this.preprocessBindings(bindings, dbContext)
|
304
|
-
.then(() => {
|
306
|
+
.then((preparedData) => {
|
307
|
+
// TODO maybe not proper to pass data in this way
|
308
|
+
this.preparedData = preparedData
|
305
309
|
subject.next({
|
306
310
|
processId: request.processId
|
307
311
|
})
|
@@ -358,7 +362,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
358
362
|
const binding = request.binding
|
359
363
|
const dbContext = contexts.new(request.processId, subject)
|
360
364
|
const start = Date.now()
|
361
|
-
PluginManager.INSTANCE.processBinding(binding,
|
365
|
+
PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext)
|
362
366
|
.then((result) => {
|
363
367
|
subject.next({
|
364
368
|
result,
|