@sentio/runtime 2.40.0-rc.14 → 2.40.0-rc.16
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-K6CPN5YU.js} +15 -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 +18 -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) {
|
@@ -78587,6 +78589,7 @@ var ProcessorServiceImpl = class {
|
|
78587
78589
|
}
|
78588
78590
|
const subject = new import_rxjs.Subject();
|
78589
78591
|
this.handleRequests(requests, subject).then(() => {
|
78592
|
+
this.preparedData = { ethCallResults: {} };
|
78590
78593
|
subject.complete();
|
78591
78594
|
}).catch((e) => {
|
78592
78595
|
console.error(e);
|
@@ -78603,7 +78606,13 @@ var ProcessorServiceImpl = class {
|
|
78603
78606
|
const bindings = request.bindings.bindings;
|
78604
78607
|
const dbContext = contexts.new(request.processId, subject);
|
78605
78608
|
const start = Date.now();
|
78606
|
-
this.preprocessBindings(bindings, dbContext).then(() => {
|
78609
|
+
this.preprocessBindings(bindings, dbContext).then((preparedData) => {
|
78610
|
+
this.preparedData = {
|
78611
|
+
ethCallResults: {
|
78612
|
+
...this.preparedData?.ethCallResults,
|
78613
|
+
...preparedData.ethCallResults
|
78614
|
+
}
|
78615
|
+
};
|
78607
78616
|
subject.next({
|
78608
78617
|
processId: request.processId
|
78609
78618
|
});
|
@@ -78648,7 +78657,7 @@ var ProcessorServiceImpl = class {
|
|
78648
78657
|
const binding = request.binding;
|
78649
78658
|
const dbContext = contexts.new(request.processId, subject);
|
78650
78659
|
const start = Date.now();
|
78651
|
-
PluginManager.INSTANCE.processBinding(binding,
|
78660
|
+
PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext).then((result) => {
|
78652
78661
|
subject.next({
|
78653
78662
|
result,
|
78654
78663
|
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(
|
@@ -278,6 +280,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
278
280
|
const subject = new Subject<DeepPartial<ProcessStreamResponse>>()
|
279
281
|
this.handleRequests(requests, subject)
|
280
282
|
.then(() => {
|
283
|
+
this.preparedData = { ethCallResults: {} }
|
281
284
|
subject.complete()
|
282
285
|
})
|
283
286
|
.catch((e) => {
|
@@ -301,7 +304,14 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
301
304
|
const dbContext = contexts.new(request.processId, subject)
|
302
305
|
const start = Date.now()
|
303
306
|
this.preprocessBindings(bindings, dbContext)
|
304
|
-
.then(() => {
|
307
|
+
.then((preparedData) => {
|
308
|
+
// TODO maybe not proper to pass data in this way
|
309
|
+
this.preparedData = {
|
310
|
+
ethCallResults: {
|
311
|
+
...this.preparedData?.ethCallResults,
|
312
|
+
...preparedData.ethCallResults
|
313
|
+
}
|
314
|
+
}
|
305
315
|
subject.next({
|
306
316
|
processId: request.processId
|
307
317
|
})
|
@@ -358,7 +368,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
358
368
|
const binding = request.binding
|
359
369
|
const dbContext = contexts.new(request.processId, subject)
|
360
370
|
const start = Date.now()
|
361
|
-
PluginManager.INSTANCE.processBinding(binding,
|
371
|
+
PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext)
|
362
372
|
.then((result) => {
|
363
373
|
subject.next({
|
364
374
|
result,
|