@sentio/runtime 2.60.0-rc.1 → 2.60.0-rc.10
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-7JPTCCHQ.js → chunk-BOHR42T4.js} +54 -27
- package/lib/{chunk-7JPTCCHQ.js.map → chunk-BOHR42T4.js.map} +1 -1
- package/lib/{chunk-RJMWLF3Q.js → chunk-CYS2DAE4.js} +2 -2
- package/lib/{chunk-AQYRWO7H.js → chunk-TC6OWLVA.js} +4889 -529
- package/lib/chunk-TC6OWLVA.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/processor-runner.js +356 -151
- package/lib/processor-runner.js.map +1 -1
- package/lib/service-worker.js +3 -3
- package/package.json +1 -1
- package/src/full-service.ts +167 -109
- package/src/gen/processor/protos/processor.ts +191 -10
- package/src/plugin.ts +1 -1
- package/src/processor-runner.ts +7 -2
- package/src/{service-v2.ts → service-v3.ts} +8 -4
- package/lib/chunk-AQYRWO7H.js.map +0 -1
- /package/lib/{chunk-RJMWLF3Q.js.map → chunk-CYS2DAE4.js.map} +0 -0
package/lib/service-worker.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
2
2
|
import {
|
3
3
|
setupLogger
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-CYS2DAE4.js";
|
5
5
|
import {
|
6
6
|
ProcessorServiceImpl,
|
7
7
|
configureEndpoints,
|
@@ -10,10 +10,10 @@ import {
|
|
10
10
|
require_cjs,
|
11
11
|
require_lib3 as require_lib,
|
12
12
|
require_lib4 as require_lib2
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-BOHR42T4.js";
|
14
14
|
import {
|
15
15
|
__toESM
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-TC6OWLVA.js";
|
17
17
|
|
18
18
|
// src/service-worker.ts
|
19
19
|
var import_nice_grpc = __toESM(require_lib(), 1);
|
package/package.json
CHANGED
package/src/full-service.ts
CHANGED
@@ -2,19 +2,22 @@ import { CallContext } from 'nice-grpc'
|
|
2
2
|
import { createRequire } from 'module'
|
3
3
|
// Different than the simple one which
|
4
4
|
import {
|
5
|
+
ConfigureHandlersRequest,
|
5
6
|
DataBinding,
|
6
7
|
ExecutionConfig,
|
7
8
|
HandlerType,
|
9
|
+
InitResponse,
|
8
10
|
PreprocessStreamRequest,
|
9
11
|
ProcessBindingsRequest,
|
10
12
|
ProcessConfigRequest,
|
13
|
+
ProcessConfigResponse,
|
11
14
|
ProcessorServiceImplementation,
|
12
15
|
ProcessResult,
|
13
16
|
ProcessStreamRequest,
|
14
17
|
StartRequest
|
15
18
|
} from './gen/processor/protos/processor.js'
|
16
19
|
|
17
|
-
import { Empty } from '@sentio/protos'
|
20
|
+
import { ConfigureHandlersResponse, DeepPartial, Empty, ProcessorV3ServiceImplementation } from '@sentio/protos'
|
18
21
|
import fs from 'fs-extra'
|
19
22
|
import path from 'path'
|
20
23
|
import os from 'os'
|
@@ -78,9 +81,15 @@ function locatePackageJson(pkgId: string) {
|
|
78
81
|
return JSON.parse(content)
|
79
82
|
}
|
80
83
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
/**
|
85
|
+
* The RuntimeServicePatcher class is responsible for providing backward compatibility
|
86
|
+
* patches for different SDK versions. It ensures that the runtime can adapt to changes
|
87
|
+
* in the SDK by applying necessary adjustments to data bindings and other configurations.
|
88
|
+
*/
|
89
|
+
export class RuntimeServicePatcher {
|
90
|
+
sdkVersion: Semver
|
91
|
+
|
92
|
+
constructor() {
|
84
93
|
const sdkPackageJson = locatePackageJson('@sentio/sdk')
|
85
94
|
const runtimePackageJson = locatePackageJson('@sentio/runtime')
|
86
95
|
|
@@ -89,111 +98,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
89
98
|
this.sdkVersion = parseSemver(sdkPackageJson.version)
|
90
99
|
}
|
91
100
|
|
92
|
-
|
93
|
-
sdkVersion: Semver
|
94
|
-
|
95
|
-
async getConfig(request: ProcessConfigRequest, context: CallContext) {
|
96
|
-
const config = await this.instance.getConfig(request, context)
|
97
|
-
config.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution)
|
98
|
-
|
99
|
-
if (config.contractConfigs) {
|
100
|
-
for (const contract of config.contractConfigs) {
|
101
|
-
// for old fuel processor
|
102
|
-
if (
|
103
|
-
compareSemver(this.sdkVersion, FUEL_PROTO_NO_FUEL_TRANSACTION_AS_CALL_VERSION) < 0 &&
|
104
|
-
contract.fuelCallConfigs
|
105
|
-
) {
|
106
|
-
contract.fuelTransactionConfigs = contract.fuelCallConfigs
|
107
|
-
contract.fuelCallConfigs = undefined
|
108
|
-
}
|
109
|
-
|
110
|
-
// @ts-ignore convert old fuelLogConfigs to fuelReceiptConfigs
|
111
|
-
if (contract.fuelLogConfigs) {
|
112
|
-
contract.fuelReceiptConfigs = contract.fuelLogConfigs.map((e) => ({
|
113
|
-
handlerId: e.handlerId,
|
114
|
-
handlerName: e.handlerName,
|
115
|
-
log: {
|
116
|
-
logIds: e.logIds
|
117
|
-
}
|
118
|
-
}))
|
119
|
-
}
|
120
|
-
|
121
|
-
// @ts-ignore old fields
|
122
|
-
if (contract.aptosCallConfigs) {
|
123
|
-
// @ts-ignore old fields
|
124
|
-
contract.moveCallConfigs = contract.aptosCallConfigs
|
125
|
-
}
|
126
|
-
// @ts-ignore old fields
|
127
|
-
if (contract.aptosEventConfigs) {
|
128
|
-
// @ts-ignore old fields
|
129
|
-
contract.moveEventConfigs = contract.aptosEventConfigs
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
if (compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0) {
|
135
|
-
PROCESSED_MOVE_EVENT_TX_HANDLER.clear()
|
136
|
-
}
|
137
|
-
|
138
|
-
return config
|
139
|
-
}
|
140
|
-
|
141
|
-
async start(request: StartRequest, context: CallContext) {
|
142
|
-
return await this.instance.start(request, context)
|
143
|
-
}
|
144
|
-
|
145
|
-
async stop(request: Empty, context: CallContext) {
|
146
|
-
return await this.instance.stop(request, context)
|
147
|
-
}
|
148
|
-
|
149
|
-
async processBindings(request: ProcessBindingsRequest, options: CallContext) {
|
150
|
-
// if (GLOBAL_CONFIG.execution.sequential) {
|
151
|
-
// request.bindings = request.bindings.sort(dataCompare)
|
152
|
-
// }
|
153
|
-
|
154
|
-
for (const binding of request.bindings) {
|
155
|
-
this.adjustDataBinding(binding)
|
156
|
-
}
|
157
|
-
try {
|
158
|
-
const result = await this.instance.processBindings(request, options)
|
159
|
-
this.adjustResult(result.result as ProcessResult)
|
160
|
-
if (!result.configUpdated && result.result?.states?.configUpdated) {
|
161
|
-
result.configUpdated = result.result?.states?.configUpdated
|
162
|
-
}
|
163
|
-
return result
|
164
|
-
} catch (e) {
|
165
|
-
if (this.sdkVersion.minor <= 16) {
|
166
|
-
// Old sdk doesn't handle this well
|
167
|
-
if (
|
168
|
-
e.code === os.constants.errno.ECONNRESET ||
|
169
|
-
e.code === os.constants.errno.ECONNREFUSED ||
|
170
|
-
e.code === os.constants.errno.ECONNABORTED
|
171
|
-
) {
|
172
|
-
process.exit(1)
|
173
|
-
}
|
174
|
-
}
|
175
|
-
throw e
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
|
-
async *adjustBindingsStream(requests: AsyncIterable<ProcessStreamRequest>): AsyncIterable<ProcessStreamRequest> {
|
180
|
-
for await (const request of requests) {
|
181
|
-
this.adjustDataBinding(request.binding)
|
182
|
-
yield request
|
183
|
-
}
|
184
|
-
}
|
185
|
-
|
186
|
-
async *processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext) {
|
187
|
-
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context)
|
188
|
-
}
|
189
|
-
|
190
|
-
async *preprocessBindingsStream(requests: AsyncIterable<PreprocessStreamRequest>, context: CallContext) {
|
191
|
-
yield* this.instance.preprocessBindingsStream(this.adjustBindingsStream(requests), context)
|
192
|
-
}
|
193
|
-
|
194
|
-
private adjustResult(res: ProcessResult): void {}
|
195
|
-
|
196
|
-
private adjustDataBinding(dataBinding?: DataBinding): void {
|
101
|
+
adjustDataBinding(dataBinding?: DataBinding): void {
|
197
102
|
const isBeforeMoveUseRawVersion = compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0
|
198
103
|
// const isBeforeEthUseRawVersion = compareSemver(this.sdkVersion,ETH_USE_RAW_VERSION) < 0
|
199
104
|
|
@@ -350,6 +255,127 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
350
255
|
break
|
351
256
|
}
|
352
257
|
}
|
258
|
+
|
259
|
+
patchConfig(config: DeepPartial<ProcessConfigResponse>): void {
|
260
|
+
config.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution)
|
261
|
+
|
262
|
+
if (config.contractConfigs) {
|
263
|
+
for (const contract of config.contractConfigs) {
|
264
|
+
// for old fuel processor
|
265
|
+
if (
|
266
|
+
compareSemver(this.sdkVersion, FUEL_PROTO_NO_FUEL_TRANSACTION_AS_CALL_VERSION) < 0 &&
|
267
|
+
contract.fuelCallConfigs
|
268
|
+
) {
|
269
|
+
contract.fuelTransactionConfigs = contract.fuelCallConfigs
|
270
|
+
contract.fuelCallConfigs = undefined
|
271
|
+
}
|
272
|
+
|
273
|
+
// @ts-ignore convert old fuelLogConfigs to fuelReceiptConfigs
|
274
|
+
if (contract.fuelLogConfigs) {
|
275
|
+
contract.fuelReceiptConfigs = contract.fuelLogConfigs.map((e) => ({
|
276
|
+
handlerId: e.handlerId,
|
277
|
+
handlerName: e.handlerName,
|
278
|
+
log: {
|
279
|
+
logIds: e.logIds
|
280
|
+
}
|
281
|
+
}))
|
282
|
+
}
|
283
|
+
|
284
|
+
// @ts-ignore old fields
|
285
|
+
if (contract.aptosCallConfigs) {
|
286
|
+
// @ts-ignore old fields
|
287
|
+
contract.moveCallConfigs = contract.aptosCallConfigs
|
288
|
+
}
|
289
|
+
// @ts-ignore old fields
|
290
|
+
if (contract.aptosEventConfigs) {
|
291
|
+
// @ts-ignore old fields
|
292
|
+
contract.moveEventConfigs = contract.aptosEventConfigs
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
export class FullProcessorServiceImpl implements ProcessorServiceImplementation {
|
300
|
+
constructor(instance: ProcessorServiceImplementation) {
|
301
|
+
this.instance = instance
|
302
|
+
const sdkPackageJson = locatePackageJson('@sentio/sdk')
|
303
|
+
const runtimePackageJson = locatePackageJson('@sentio/runtime')
|
304
|
+
|
305
|
+
console.log('Runtime version:', runtimePackageJson.version, 'SDK version:', sdkPackageJson.version)
|
306
|
+
|
307
|
+
this.sdkVersion = parseSemver(sdkPackageJson.version)
|
308
|
+
}
|
309
|
+
|
310
|
+
instance: ProcessorServiceImplementation
|
311
|
+
sdkVersion: Semver
|
312
|
+
patcher: RuntimeServicePatcher = new RuntimeServicePatcher()
|
313
|
+
|
314
|
+
async getConfig(request: ProcessConfigRequest, context: CallContext) {
|
315
|
+
const config = await this.instance.getConfig(request, context)
|
316
|
+
this.patcher.patchConfig(config)
|
317
|
+
|
318
|
+
if (compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0) {
|
319
|
+
PROCESSED_MOVE_EVENT_TX_HANDLER.clear()
|
320
|
+
}
|
321
|
+
|
322
|
+
return config
|
323
|
+
}
|
324
|
+
|
325
|
+
async start(request: StartRequest, context: CallContext) {
|
326
|
+
return await this.instance.start(request, context)
|
327
|
+
}
|
328
|
+
|
329
|
+
async stop(request: Empty, context: CallContext) {
|
330
|
+
return await this.instance.stop(request, context)
|
331
|
+
}
|
332
|
+
|
333
|
+
async processBindings(request: ProcessBindingsRequest, options: CallContext) {
|
334
|
+
// if (GLOBAL_CONFIG.execution.sequential) {
|
335
|
+
// request.bindings = request.bindings.sort(dataCompare)
|
336
|
+
// }
|
337
|
+
|
338
|
+
for (const binding of request.bindings) {
|
339
|
+
this.patcher.adjustDataBinding(binding)
|
340
|
+
}
|
341
|
+
try {
|
342
|
+
const result = await this.instance.processBindings(request, options)
|
343
|
+
this.adjustResult(result.result as ProcessResult)
|
344
|
+
if (!result.configUpdated && result.result?.states?.configUpdated) {
|
345
|
+
result.configUpdated = result.result?.states?.configUpdated
|
346
|
+
}
|
347
|
+
return result
|
348
|
+
} catch (e) {
|
349
|
+
if (this.sdkVersion.minor <= 16) {
|
350
|
+
// Old sdk doesn't handle this well
|
351
|
+
if (
|
352
|
+
e.code === os.constants.errno.ECONNRESET ||
|
353
|
+
e.code === os.constants.errno.ECONNREFUSED ||
|
354
|
+
e.code === os.constants.errno.ECONNABORTED
|
355
|
+
) {
|
356
|
+
process.exit(1)
|
357
|
+
}
|
358
|
+
}
|
359
|
+
throw e
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
async *adjustBindingsStream(requests: AsyncIterable<ProcessStreamRequest>): AsyncIterable<ProcessStreamRequest> {
|
364
|
+
for await (const request of requests) {
|
365
|
+
this.patcher.adjustDataBinding(request.binding)
|
366
|
+
yield request
|
367
|
+
}
|
368
|
+
}
|
369
|
+
|
370
|
+
async *processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext) {
|
371
|
+
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context)
|
372
|
+
}
|
373
|
+
|
374
|
+
async *preprocessBindingsStream(requests: AsyncIterable<PreprocessStreamRequest>, context: CallContext) {
|
375
|
+
yield* this.instance.preprocessBindingsStream(this.adjustBindingsStream(requests), context)
|
376
|
+
}
|
377
|
+
|
378
|
+
private adjustResult(res: ProcessResult): void {}
|
353
379
|
}
|
354
380
|
|
355
381
|
// function dataCompare(a: DataBinding, b: DataBinding): number {
|
@@ -383,3 +409,35 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
383
409
|
// d.data?.ethTrace?.trace?.transactionPosition
|
384
410
|
// )
|
385
411
|
// }
|
412
|
+
|
413
|
+
export class FullProcessorServiceV3Impl implements ProcessorV3ServiceImplementation {
|
414
|
+
patcher: RuntimeServicePatcher = new RuntimeServicePatcher()
|
415
|
+
|
416
|
+
constructor(readonly instance: ProcessorV3ServiceImplementation) {}
|
417
|
+
|
418
|
+
async init(request: Empty, context: CallContext): Promise<DeepPartial<InitResponse>> {
|
419
|
+
const resp = await this.instance.init(request, context)
|
420
|
+
resp.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution)
|
421
|
+
return resp
|
422
|
+
}
|
423
|
+
|
424
|
+
async configureHandlers(
|
425
|
+
request: ConfigureHandlersRequest,
|
426
|
+
context: CallContext
|
427
|
+
): Promise<DeepPartial<ConfigureHandlersResponse>> {
|
428
|
+
const config = await this.instance.configureHandlers(request, context)
|
429
|
+
this.patcher.patchConfig(config)
|
430
|
+
return config
|
431
|
+
}
|
432
|
+
|
433
|
+
async *processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext) {
|
434
|
+
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context)
|
435
|
+
}
|
436
|
+
|
437
|
+
async *adjustBindingsStream(requests: AsyncIterable<ProcessStreamRequest>): AsyncIterable<ProcessStreamRequest> {
|
438
|
+
for await (const request of requests) {
|
439
|
+
this.patcher.adjustDataBinding(request.binding)
|
440
|
+
yield request
|
441
|
+
}
|
442
|
+
}
|
443
|
+
}
|
@@ -434,6 +434,11 @@ export interface ProcessConfigResponse {
|
|
434
434
|
dbSchema: DataBaseSchema | undefined;
|
435
435
|
}
|
436
436
|
|
437
|
+
export interface ConfigureHandlersResponse {
|
438
|
+
contractConfigs: ContractConfig[];
|
439
|
+
accountConfigs: AccountConfig[];
|
440
|
+
}
|
441
|
+
|
437
442
|
export interface ContractConfig {
|
438
443
|
contract: ContractInfo | undefined;
|
439
444
|
intervalConfigs: OnIntervalConfig[];
|
@@ -668,6 +673,11 @@ export interface TemplateInstance {
|
|
668
673
|
export interface InitResponse {
|
669
674
|
chainIds: string[];
|
670
675
|
dbSchema: DataBaseSchema | undefined;
|
676
|
+
config: ProjectConfig | undefined;
|
677
|
+
executionConfig: ExecutionConfig | undefined;
|
678
|
+
metricConfigs: MetricConfig[];
|
679
|
+
exportConfigs: ExportConfig[];
|
680
|
+
eventLogConfigs: EventLogConfig[];
|
671
681
|
}
|
672
682
|
|
673
683
|
export interface ConfigureHandlersRequest {
|
@@ -2148,6 +2158,84 @@ export const ProcessConfigResponse = {
|
|
2148
2158
|
},
|
2149
2159
|
};
|
2150
2160
|
|
2161
|
+
function createBaseConfigureHandlersResponse(): ConfigureHandlersResponse {
|
2162
|
+
return { contractConfigs: [], accountConfigs: [] };
|
2163
|
+
}
|
2164
|
+
|
2165
|
+
export const ConfigureHandlersResponse = {
|
2166
|
+
encode(message: ConfigureHandlersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
2167
|
+
for (const v of message.contractConfigs) {
|
2168
|
+
ContractConfig.encode(v!, writer.uint32(18).fork()).ldelim();
|
2169
|
+
}
|
2170
|
+
for (const v of message.accountConfigs) {
|
2171
|
+
AccountConfig.encode(v!, writer.uint32(34).fork()).ldelim();
|
2172
|
+
}
|
2173
|
+
return writer;
|
2174
|
+
},
|
2175
|
+
|
2176
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ConfigureHandlersResponse {
|
2177
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
2178
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
2179
|
+
const message = createBaseConfigureHandlersResponse();
|
2180
|
+
while (reader.pos < end) {
|
2181
|
+
const tag = reader.uint32();
|
2182
|
+
switch (tag >>> 3) {
|
2183
|
+
case 2:
|
2184
|
+
if (tag !== 18) {
|
2185
|
+
break;
|
2186
|
+
}
|
2187
|
+
|
2188
|
+
message.contractConfigs.push(ContractConfig.decode(reader, reader.uint32()));
|
2189
|
+
continue;
|
2190
|
+
case 4:
|
2191
|
+
if (tag !== 34) {
|
2192
|
+
break;
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
message.accountConfigs.push(AccountConfig.decode(reader, reader.uint32()));
|
2196
|
+
continue;
|
2197
|
+
}
|
2198
|
+
if ((tag & 7) === 4 || tag === 0) {
|
2199
|
+
break;
|
2200
|
+
}
|
2201
|
+
reader.skipType(tag & 7);
|
2202
|
+
}
|
2203
|
+
return message;
|
2204
|
+
},
|
2205
|
+
|
2206
|
+
fromJSON(object: any): ConfigureHandlersResponse {
|
2207
|
+
return {
|
2208
|
+
contractConfigs: globalThis.Array.isArray(object?.contractConfigs)
|
2209
|
+
? object.contractConfigs.map((e: any) => ContractConfig.fromJSON(e))
|
2210
|
+
: [],
|
2211
|
+
accountConfigs: globalThis.Array.isArray(object?.accountConfigs)
|
2212
|
+
? object.accountConfigs.map((e: any) => AccountConfig.fromJSON(e))
|
2213
|
+
: [],
|
2214
|
+
};
|
2215
|
+
},
|
2216
|
+
|
2217
|
+
toJSON(message: ConfigureHandlersResponse): unknown {
|
2218
|
+
const obj: any = {};
|
2219
|
+
if (message.contractConfigs?.length) {
|
2220
|
+
obj.contractConfigs = message.contractConfigs.map((e) => ContractConfig.toJSON(e));
|
2221
|
+
}
|
2222
|
+
if (message.accountConfigs?.length) {
|
2223
|
+
obj.accountConfigs = message.accountConfigs.map((e) => AccountConfig.toJSON(e));
|
2224
|
+
}
|
2225
|
+
return obj;
|
2226
|
+
},
|
2227
|
+
|
2228
|
+
create(base?: DeepPartial<ConfigureHandlersResponse>): ConfigureHandlersResponse {
|
2229
|
+
return ConfigureHandlersResponse.fromPartial(base ?? {});
|
2230
|
+
},
|
2231
|
+
fromPartial(object: DeepPartial<ConfigureHandlersResponse>): ConfigureHandlersResponse {
|
2232
|
+
const message = createBaseConfigureHandlersResponse();
|
2233
|
+
message.contractConfigs = object.contractConfigs?.map((e) => ContractConfig.fromPartial(e)) || [];
|
2234
|
+
message.accountConfigs = object.accountConfigs?.map((e) => AccountConfig.fromPartial(e)) || [];
|
2235
|
+
return message;
|
2236
|
+
},
|
2237
|
+
};
|
2238
|
+
|
2151
2239
|
function createBaseContractConfig(): ContractConfig {
|
2152
2240
|
return {
|
2153
2241
|
contract: undefined,
|
@@ -4405,7 +4493,15 @@ export const TemplateInstance = {
|
|
4405
4493
|
};
|
4406
4494
|
|
4407
4495
|
function createBaseInitResponse(): InitResponse {
|
4408
|
-
return {
|
4496
|
+
return {
|
4497
|
+
chainIds: [],
|
4498
|
+
dbSchema: undefined,
|
4499
|
+
config: undefined,
|
4500
|
+
executionConfig: undefined,
|
4501
|
+
metricConfigs: [],
|
4502
|
+
exportConfigs: [],
|
4503
|
+
eventLogConfigs: [],
|
4504
|
+
};
|
4409
4505
|
}
|
4410
4506
|
|
4411
4507
|
export const InitResponse = {
|
@@ -4416,6 +4512,21 @@ export const InitResponse = {
|
|
4416
4512
|
if (message.dbSchema !== undefined) {
|
4417
4513
|
DataBaseSchema.encode(message.dbSchema, writer.uint32(18).fork()).ldelim();
|
4418
4514
|
}
|
4515
|
+
if (message.config !== undefined) {
|
4516
|
+
ProjectConfig.encode(message.config, writer.uint32(26).fork()).ldelim();
|
4517
|
+
}
|
4518
|
+
if (message.executionConfig !== undefined) {
|
4519
|
+
ExecutionConfig.encode(message.executionConfig, writer.uint32(34).fork()).ldelim();
|
4520
|
+
}
|
4521
|
+
for (const v of message.metricConfigs) {
|
4522
|
+
MetricConfig.encode(v!, writer.uint32(42).fork()).ldelim();
|
4523
|
+
}
|
4524
|
+
for (const v of message.exportConfigs) {
|
4525
|
+
ExportConfig.encode(v!, writer.uint32(50).fork()).ldelim();
|
4526
|
+
}
|
4527
|
+
for (const v of message.eventLogConfigs) {
|
4528
|
+
EventLogConfig.encode(v!, writer.uint32(58).fork()).ldelim();
|
4529
|
+
}
|
4419
4530
|
return writer;
|
4420
4531
|
},
|
4421
4532
|
|
@@ -4440,6 +4551,41 @@ export const InitResponse = {
|
|
4440
4551
|
|
4441
4552
|
message.dbSchema = DataBaseSchema.decode(reader, reader.uint32());
|
4442
4553
|
continue;
|
4554
|
+
case 3:
|
4555
|
+
if (tag !== 26) {
|
4556
|
+
break;
|
4557
|
+
}
|
4558
|
+
|
4559
|
+
message.config = ProjectConfig.decode(reader, reader.uint32());
|
4560
|
+
continue;
|
4561
|
+
case 4:
|
4562
|
+
if (tag !== 34) {
|
4563
|
+
break;
|
4564
|
+
}
|
4565
|
+
|
4566
|
+
message.executionConfig = ExecutionConfig.decode(reader, reader.uint32());
|
4567
|
+
continue;
|
4568
|
+
case 5:
|
4569
|
+
if (tag !== 42) {
|
4570
|
+
break;
|
4571
|
+
}
|
4572
|
+
|
4573
|
+
message.metricConfigs.push(MetricConfig.decode(reader, reader.uint32()));
|
4574
|
+
continue;
|
4575
|
+
case 6:
|
4576
|
+
if (tag !== 50) {
|
4577
|
+
break;
|
4578
|
+
}
|
4579
|
+
|
4580
|
+
message.exportConfigs.push(ExportConfig.decode(reader, reader.uint32()));
|
4581
|
+
continue;
|
4582
|
+
case 7:
|
4583
|
+
if (tag !== 58) {
|
4584
|
+
break;
|
4585
|
+
}
|
4586
|
+
|
4587
|
+
message.eventLogConfigs.push(EventLogConfig.decode(reader, reader.uint32()));
|
4588
|
+
continue;
|
4443
4589
|
}
|
4444
4590
|
if ((tag & 7) === 4 || tag === 0) {
|
4445
4591
|
break;
|
@@ -4453,6 +4599,17 @@ export const InitResponse = {
|
|
4453
4599
|
return {
|
4454
4600
|
chainIds: globalThis.Array.isArray(object?.chainIds) ? object.chainIds.map((e: any) => globalThis.String(e)) : [],
|
4455
4601
|
dbSchema: isSet(object.dbSchema) ? DataBaseSchema.fromJSON(object.dbSchema) : undefined,
|
4602
|
+
config: isSet(object.config) ? ProjectConfig.fromJSON(object.config) : undefined,
|
4603
|
+
executionConfig: isSet(object.executionConfig) ? ExecutionConfig.fromJSON(object.executionConfig) : undefined,
|
4604
|
+
metricConfigs: globalThis.Array.isArray(object?.metricConfigs)
|
4605
|
+
? object.metricConfigs.map((e: any) => MetricConfig.fromJSON(e))
|
4606
|
+
: [],
|
4607
|
+
exportConfigs: globalThis.Array.isArray(object?.exportConfigs)
|
4608
|
+
? object.exportConfigs.map((e: any) => ExportConfig.fromJSON(e))
|
4609
|
+
: [],
|
4610
|
+
eventLogConfigs: globalThis.Array.isArray(object?.eventLogConfigs)
|
4611
|
+
? object.eventLogConfigs.map((e: any) => EventLogConfig.fromJSON(e))
|
4612
|
+
: [],
|
4456
4613
|
};
|
4457
4614
|
},
|
4458
4615
|
|
@@ -4464,6 +4621,21 @@ export const InitResponse = {
|
|
4464
4621
|
if (message.dbSchema !== undefined) {
|
4465
4622
|
obj.dbSchema = DataBaseSchema.toJSON(message.dbSchema);
|
4466
4623
|
}
|
4624
|
+
if (message.config !== undefined) {
|
4625
|
+
obj.config = ProjectConfig.toJSON(message.config);
|
4626
|
+
}
|
4627
|
+
if (message.executionConfig !== undefined) {
|
4628
|
+
obj.executionConfig = ExecutionConfig.toJSON(message.executionConfig);
|
4629
|
+
}
|
4630
|
+
if (message.metricConfigs?.length) {
|
4631
|
+
obj.metricConfigs = message.metricConfigs.map((e) => MetricConfig.toJSON(e));
|
4632
|
+
}
|
4633
|
+
if (message.exportConfigs?.length) {
|
4634
|
+
obj.exportConfigs = message.exportConfigs.map((e) => ExportConfig.toJSON(e));
|
4635
|
+
}
|
4636
|
+
if (message.eventLogConfigs?.length) {
|
4637
|
+
obj.eventLogConfigs = message.eventLogConfigs.map((e) => EventLogConfig.toJSON(e));
|
4638
|
+
}
|
4467
4639
|
return obj;
|
4468
4640
|
},
|
4469
4641
|
|
@@ -4476,6 +4648,15 @@ export const InitResponse = {
|
|
4476
4648
|
message.dbSchema = (object.dbSchema !== undefined && object.dbSchema !== null)
|
4477
4649
|
? DataBaseSchema.fromPartial(object.dbSchema)
|
4478
4650
|
: undefined;
|
4651
|
+
message.config = (object.config !== undefined && object.config !== null)
|
4652
|
+
? ProjectConfig.fromPartial(object.config)
|
4653
|
+
: undefined;
|
4654
|
+
message.executionConfig = (object.executionConfig !== undefined && object.executionConfig !== null)
|
4655
|
+
? ExecutionConfig.fromPartial(object.executionConfig)
|
4656
|
+
: undefined;
|
4657
|
+
message.metricConfigs = object.metricConfigs?.map((e) => MetricConfig.fromPartial(e)) || [];
|
4658
|
+
message.exportConfigs = object.exportConfigs?.map((e) => ExportConfig.fromPartial(e)) || [];
|
4659
|
+
message.eventLogConfigs = object.eventLogConfigs?.map((e) => EventLogConfig.fromPartial(e)) || [];
|
4479
4660
|
return message;
|
4480
4661
|
},
|
4481
4662
|
};
|
@@ -14994,10 +15175,10 @@ export interface ProcessorClient<CallOptionsExt = {}> {
|
|
14994
15175
|
): AsyncIterable<PreprocessStreamResponse>;
|
14995
15176
|
}
|
14996
15177
|
|
14997
|
-
export type
|
14998
|
-
export const
|
14999
|
-
name: "
|
15000
|
-
fullName: "processor.
|
15178
|
+
export type ProcessorV3Definition = typeof ProcessorV3Definition;
|
15179
|
+
export const ProcessorV3Definition = {
|
15180
|
+
name: "ProcessorV3",
|
15181
|
+
fullName: "processor.ProcessorV3",
|
15001
15182
|
methods: {
|
15002
15183
|
init: {
|
15003
15184
|
name: "Init",
|
@@ -15011,7 +15192,7 @@ export const ProcessorV2Definition = {
|
|
15011
15192
|
name: "ConfigureHandlers",
|
15012
15193
|
requestType: ConfigureHandlersRequest,
|
15013
15194
|
requestStream: false,
|
15014
|
-
responseType:
|
15195
|
+
responseType: ConfigureHandlersResponse,
|
15015
15196
|
responseStream: false,
|
15016
15197
|
options: {},
|
15017
15198
|
},
|
@@ -15026,24 +15207,24 @@ export const ProcessorV2Definition = {
|
|
15026
15207
|
},
|
15027
15208
|
} as const;
|
15028
15209
|
|
15029
|
-
export interface
|
15210
|
+
export interface ProcessorV3ServiceImplementation<CallContextExt = {}> {
|
15030
15211
|
init(request: Empty, context: CallContext & CallContextExt): Promise<DeepPartial<InitResponse>>;
|
15031
15212
|
configureHandlers(
|
15032
15213
|
request: ConfigureHandlersRequest,
|
15033
15214
|
context: CallContext & CallContextExt,
|
15034
|
-
): Promise<DeepPartial<
|
15215
|
+
): Promise<DeepPartial<ConfigureHandlersResponse>>;
|
15035
15216
|
processBindingsStream(
|
15036
15217
|
request: AsyncIterable<ProcessStreamRequest>,
|
15037
15218
|
context: CallContext & CallContextExt,
|
15038
15219
|
): ServerStreamingMethodResult<DeepPartial<ProcessStreamResponseV2>>;
|
15039
15220
|
}
|
15040
15221
|
|
15041
|
-
export interface
|
15222
|
+
export interface ProcessorV3Client<CallOptionsExt = {}> {
|
15042
15223
|
init(request: DeepPartial<Empty>, options?: CallOptions & CallOptionsExt): Promise<InitResponse>;
|
15043
15224
|
configureHandlers(
|
15044
15225
|
request: DeepPartial<ConfigureHandlersRequest>,
|
15045
15226
|
options?: CallOptions & CallOptionsExt,
|
15046
|
-
): Promise<
|
15227
|
+
): Promise<ConfigureHandlersResponse>;
|
15047
15228
|
processBindingsStream(
|
15048
15229
|
request: AsyncIterable<DeepPartial<ProcessStreamRequest>>,
|
15049
15230
|
options?: CallOptions & CallOptionsExt,
|
package/src/plugin.ts
CHANGED
package/src/processor-runner.ts
CHANGED
@@ -15,13 +15,15 @@ import { Session } from 'node:inspector/promises'
|
|
15
15
|
import { ProcessorDefinition } from './gen/processor/protos/processor.js'
|
16
16
|
import { ProcessorServiceImpl } from './service.js'
|
17
17
|
import { configureEndpoints } from './endpoints.js'
|
18
|
-
import { FullProcessorServiceImpl } from './full-service.js'
|
18
|
+
import { FullProcessorServiceImpl, FullProcessorServiceV3Impl } from './full-service.js'
|
19
19
|
import { setupLogger } from './logger.js'
|
20
20
|
|
21
21
|
import { setupOTLP } from './otlp.js'
|
22
22
|
import { ActionServer } from './action-server.js'
|
23
23
|
import { ServiceManager } from './service-manager.js'
|
24
24
|
import path from 'path'
|
25
|
+
import { ProcessorV3Definition } from '@sentio/protos'
|
26
|
+
import { ProcessorServiceImplV3 } from './service-v3.js'
|
25
27
|
|
26
28
|
// const mergedRegistry = Registry.merge([globalRegistry, niceGrpcRegistry])
|
27
29
|
|
@@ -103,7 +105,10 @@ if (options['start-action-server']) {
|
|
103
105
|
const service = new FullProcessorServiceImpl(baseService)
|
104
106
|
|
105
107
|
server.add(ProcessorDefinition, service)
|
106
|
-
|
108
|
+
server.add(
|
109
|
+
ProcessorV3Definition,
|
110
|
+
new FullProcessorServiceV3Impl(new ProcessorServiceImplV3(loader, options, server.shutdown))
|
111
|
+
)
|
107
112
|
server.listen('0.0.0.0:' + options.port)
|
108
113
|
|
109
114
|
console.log('Processor Server Started at:', options.port)
|