@sentio/runtime 2.60.0-rc.9 → 2.60.1-rc.1
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-RJMWLF3Q.js → chunk-26X74ASV.js} +2 -2
- package/lib/{chunk-EFMEF6FT.js → chunk-OJKZJGLN.js} +130 -107
- package/lib/{chunk-EFMEF6FT.js.map → chunk-OJKZJGLN.js.map} +1 -1
- package/lib/{chunk-AQYRWO7H.js → chunk-ZTW66EYL.js} +4890 -529
- package/lib/chunk-ZTW66EYL.js.map +1 -0
- package/lib/index.d.ts +10 -147
- package/lib/index.js +2 -2
- package/lib/processor-BDXlufg5.d.ts +900 -0
- package/lib/processor-runner.js +372 -151
- package/lib/processor-runner.js.map +1 -1
- package/lib/service-worker.js +3 -3
- package/lib/test-processor.test.d.ts +14 -1
- package/lib/test-processor.test.js.map +1 -1
- package/package.json +1 -1
- package/src/db-context.ts +1 -0
- package/src/full-service.ts +167 -109
- package/src/gen/processor/protos/processor.ts +191 -10
- package/src/gen/service/common/protos/common.ts +134 -1
- package/src/plugin.ts +1 -1
- package/src/processor-runner.ts +7 -2
- package/src/{service-v2.ts → service-v3.ts} +33 -6
- package/lib/chunk-AQYRWO7H.js.map +0 -1
- /package/lib/{chunk-RJMWLF3Q.js.map → chunk-26X74ASV.js.map} +0 -0
@@ -348,6 +348,7 @@ export interface User {
|
|
348
348
|
username: string;
|
349
349
|
accountStatus: User_AccountStatus;
|
350
350
|
tier: Tier;
|
351
|
+
isOrganization: boolean;
|
351
352
|
}
|
352
353
|
|
353
354
|
export enum User_AccountStatus {
|
@@ -517,6 +518,12 @@ export interface Project_ProjectMember {
|
|
517
518
|
export interface CommunityProject {
|
518
519
|
dashAlias: string;
|
519
520
|
curated?: boolean | undefined;
|
521
|
+
chain: { [key: string]: StringList };
|
522
|
+
}
|
523
|
+
|
524
|
+
export interface CommunityProject_ChainEntry {
|
525
|
+
key: string;
|
526
|
+
value: StringList | undefined;
|
520
527
|
}
|
521
528
|
|
522
529
|
export interface ProjectInfo {
|
@@ -2535,6 +2542,7 @@ function createBaseUser(): User {
|
|
2535
2542
|
username: "",
|
2536
2543
|
accountStatus: 0,
|
2537
2544
|
tier: 0,
|
2545
|
+
isOrganization: false,
|
2538
2546
|
};
|
2539
2547
|
}
|
2540
2548
|
|
@@ -2588,6 +2596,9 @@ export const User = {
|
|
2588
2596
|
if (message.tier !== 0) {
|
2589
2597
|
writer.uint32(120).int32(message.tier);
|
2590
2598
|
}
|
2599
|
+
if (message.isOrganization !== false) {
|
2600
|
+
writer.uint32(128).bool(message.isOrganization);
|
2601
|
+
}
|
2591
2602
|
return writer;
|
2592
2603
|
},
|
2593
2604
|
|
@@ -2696,6 +2707,13 @@ export const User = {
|
|
2696
2707
|
|
2697
2708
|
message.tier = reader.int32() as any;
|
2698
2709
|
continue;
|
2710
|
+
case 16:
|
2711
|
+
if (tag !== 128) {
|
2712
|
+
break;
|
2713
|
+
}
|
2714
|
+
|
2715
|
+
message.isOrganization = reader.bool();
|
2716
|
+
continue;
|
2699
2717
|
}
|
2700
2718
|
if ((tag & 7) === 4 || tag === 0) {
|
2701
2719
|
break;
|
@@ -2721,6 +2739,7 @@ export const User = {
|
|
2721
2739
|
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
2722
2740
|
accountStatus: isSet(object.accountStatus) ? user_AccountStatusFromJSON(object.accountStatus) : 0,
|
2723
2741
|
tier: isSet(object.tier) ? tierFromJSON(object.tier) : 0,
|
2742
|
+
isOrganization: isSet(object.isOrganization) ? globalThis.Boolean(object.isOrganization) : false,
|
2724
2743
|
};
|
2725
2744
|
},
|
2726
2745
|
|
@@ -2768,6 +2787,9 @@ export const User = {
|
|
2768
2787
|
if (message.tier !== 0) {
|
2769
2788
|
obj.tier = tierToJSON(message.tier);
|
2770
2789
|
}
|
2790
|
+
if (message.isOrganization !== false) {
|
2791
|
+
obj.isOrganization = message.isOrganization;
|
2792
|
+
}
|
2771
2793
|
return obj;
|
2772
2794
|
},
|
2773
2795
|
|
@@ -2790,6 +2812,7 @@ export const User = {
|
|
2790
2812
|
message.username = object.username ?? "";
|
2791
2813
|
message.accountStatus = object.accountStatus ?? 0;
|
2792
2814
|
message.tier = object.tier ?? 0;
|
2815
|
+
message.isOrganization = object.isOrganization ?? false;
|
2793
2816
|
return message;
|
2794
2817
|
},
|
2795
2818
|
};
|
@@ -3493,7 +3516,7 @@ export const Project_ProjectMember = {
|
|
3493
3516
|
};
|
3494
3517
|
|
3495
3518
|
function createBaseCommunityProject(): CommunityProject {
|
3496
|
-
return { dashAlias: "", curated: undefined };
|
3519
|
+
return { dashAlias: "", curated: undefined, chain: {} };
|
3497
3520
|
}
|
3498
3521
|
|
3499
3522
|
export const CommunityProject = {
|
@@ -3504,6 +3527,9 @@ export const CommunityProject = {
|
|
3504
3527
|
if (message.curated !== undefined) {
|
3505
3528
|
writer.uint32(16).bool(message.curated);
|
3506
3529
|
}
|
3530
|
+
Object.entries(message.chain).forEach(([key, value]) => {
|
3531
|
+
CommunityProject_ChainEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim();
|
3532
|
+
});
|
3507
3533
|
return writer;
|
3508
3534
|
},
|
3509
3535
|
|
@@ -3528,6 +3554,16 @@ export const CommunityProject = {
|
|
3528
3554
|
|
3529
3555
|
message.curated = reader.bool();
|
3530
3556
|
continue;
|
3557
|
+
case 3:
|
3558
|
+
if (tag !== 26) {
|
3559
|
+
break;
|
3560
|
+
}
|
3561
|
+
|
3562
|
+
const entry3 = CommunityProject_ChainEntry.decode(reader, reader.uint32());
|
3563
|
+
if (entry3.value !== undefined) {
|
3564
|
+
message.chain[entry3.key] = entry3.value;
|
3565
|
+
}
|
3566
|
+
continue;
|
3531
3567
|
}
|
3532
3568
|
if ((tag & 7) === 4 || tag === 0) {
|
3533
3569
|
break;
|
@@ -3541,6 +3577,12 @@ export const CommunityProject = {
|
|
3541
3577
|
return {
|
3542
3578
|
dashAlias: isSet(object.dashAlias) ? globalThis.String(object.dashAlias) : "",
|
3543
3579
|
curated: isSet(object.curated) ? globalThis.Boolean(object.curated) : undefined,
|
3580
|
+
chain: isObject(object.chain)
|
3581
|
+
? Object.entries(object.chain).reduce<{ [key: string]: StringList }>((acc, [key, value]) => {
|
3582
|
+
acc[key] = StringList.fromJSON(value);
|
3583
|
+
return acc;
|
3584
|
+
}, {})
|
3585
|
+
: {},
|
3544
3586
|
};
|
3545
3587
|
},
|
3546
3588
|
|
@@ -3552,6 +3594,15 @@ export const CommunityProject = {
|
|
3552
3594
|
if (message.curated !== undefined) {
|
3553
3595
|
obj.curated = message.curated;
|
3554
3596
|
}
|
3597
|
+
if (message.chain) {
|
3598
|
+
const entries = Object.entries(message.chain);
|
3599
|
+
if (entries.length > 0) {
|
3600
|
+
obj.chain = {};
|
3601
|
+
entries.forEach(([k, v]) => {
|
3602
|
+
obj.chain[k] = StringList.toJSON(v);
|
3603
|
+
});
|
3604
|
+
}
|
3605
|
+
}
|
3555
3606
|
return obj;
|
3556
3607
|
},
|
3557
3608
|
|
@@ -3562,6 +3613,88 @@ export const CommunityProject = {
|
|
3562
3613
|
const message = createBaseCommunityProject();
|
3563
3614
|
message.dashAlias = object.dashAlias ?? "";
|
3564
3615
|
message.curated = object.curated ?? undefined;
|
3616
|
+
message.chain = Object.entries(object.chain ?? {}).reduce<{ [key: string]: StringList }>((acc, [key, value]) => {
|
3617
|
+
if (value !== undefined) {
|
3618
|
+
acc[key] = StringList.fromPartial(value);
|
3619
|
+
}
|
3620
|
+
return acc;
|
3621
|
+
}, {});
|
3622
|
+
return message;
|
3623
|
+
},
|
3624
|
+
};
|
3625
|
+
|
3626
|
+
function createBaseCommunityProject_ChainEntry(): CommunityProject_ChainEntry {
|
3627
|
+
return { key: "", value: undefined };
|
3628
|
+
}
|
3629
|
+
|
3630
|
+
export const CommunityProject_ChainEntry = {
|
3631
|
+
encode(message: CommunityProject_ChainEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
3632
|
+
if (message.key !== "") {
|
3633
|
+
writer.uint32(10).string(message.key);
|
3634
|
+
}
|
3635
|
+
if (message.value !== undefined) {
|
3636
|
+
StringList.encode(message.value, writer.uint32(18).fork()).ldelim();
|
3637
|
+
}
|
3638
|
+
return writer;
|
3639
|
+
},
|
3640
|
+
|
3641
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CommunityProject_ChainEntry {
|
3642
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
3643
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
3644
|
+
const message = createBaseCommunityProject_ChainEntry();
|
3645
|
+
while (reader.pos < end) {
|
3646
|
+
const tag = reader.uint32();
|
3647
|
+
switch (tag >>> 3) {
|
3648
|
+
case 1:
|
3649
|
+
if (tag !== 10) {
|
3650
|
+
break;
|
3651
|
+
}
|
3652
|
+
|
3653
|
+
message.key = reader.string();
|
3654
|
+
continue;
|
3655
|
+
case 2:
|
3656
|
+
if (tag !== 18) {
|
3657
|
+
break;
|
3658
|
+
}
|
3659
|
+
|
3660
|
+
message.value = StringList.decode(reader, reader.uint32());
|
3661
|
+
continue;
|
3662
|
+
}
|
3663
|
+
if ((tag & 7) === 4 || tag === 0) {
|
3664
|
+
break;
|
3665
|
+
}
|
3666
|
+
reader.skipType(tag & 7);
|
3667
|
+
}
|
3668
|
+
return message;
|
3669
|
+
},
|
3670
|
+
|
3671
|
+
fromJSON(object: any): CommunityProject_ChainEntry {
|
3672
|
+
return {
|
3673
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
3674
|
+
value: isSet(object.value) ? StringList.fromJSON(object.value) : undefined,
|
3675
|
+
};
|
3676
|
+
},
|
3677
|
+
|
3678
|
+
toJSON(message: CommunityProject_ChainEntry): unknown {
|
3679
|
+
const obj: any = {};
|
3680
|
+
if (message.key !== "") {
|
3681
|
+
obj.key = message.key;
|
3682
|
+
}
|
3683
|
+
if (message.value !== undefined) {
|
3684
|
+
obj.value = StringList.toJSON(message.value);
|
3685
|
+
}
|
3686
|
+
return obj;
|
3687
|
+
},
|
3688
|
+
|
3689
|
+
create(base?: DeepPartial<CommunityProject_ChainEntry>): CommunityProject_ChainEntry {
|
3690
|
+
return CommunityProject_ChainEntry.fromPartial(base ?? {});
|
3691
|
+
},
|
3692
|
+
fromPartial(object: DeepPartial<CommunityProject_ChainEntry>): CommunityProject_ChainEntry {
|
3693
|
+
const message = createBaseCommunityProject_ChainEntry();
|
3694
|
+
message.key = object.key ?? "";
|
3695
|
+
message.value = (object.value !== undefined && object.value !== null)
|
3696
|
+
? StringList.fromPartial(object.value)
|
3697
|
+
: undefined;
|
3565
3698
|
return message;
|
3566
3699
|
},
|
3567
3700
|
};
|
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)
|
@@ -1,14 +1,16 @@
|
|
1
1
|
import {
|
2
2
|
ConfigureHandlersRequest,
|
3
|
+
ConfigureHandlersResponse,
|
3
4
|
DataBinding,
|
4
5
|
DeepPartial,
|
5
6
|
Empty,
|
6
7
|
HandlerType,
|
7
8
|
InitResponse,
|
8
9
|
ProcessConfigResponse,
|
9
|
-
|
10
|
+
ProcessorV3ServiceImplementation,
|
10
11
|
ProcessResult,
|
11
12
|
ProcessStreamRequest,
|
13
|
+
ProcessStreamResponse,
|
12
14
|
ProcessStreamResponseV2,
|
13
15
|
StartRequest
|
14
16
|
} from '@sentio/protos'
|
@@ -27,7 +29,7 @@ import { TemplateInstanceState } from './state.js'
|
|
27
29
|
|
28
30
|
const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
|
29
31
|
|
30
|
-
export class
|
32
|
+
export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation {
|
31
33
|
readonly enablePartition: boolean
|
32
34
|
private readonly loader: () => Promise<any>
|
33
35
|
private readonly shutdownHandler?: () => void
|
@@ -40,6 +42,7 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
40
42
|
}
|
41
43
|
|
42
44
|
async init(request: Empty, context: CallContext): Promise<DeepPartial<InitResponse>> {
|
45
|
+
await this.loader()
|
43
46
|
const resp = InitResponse.fromPartial({
|
44
47
|
chainIds: []
|
45
48
|
})
|
@@ -50,6 +53,21 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
50
53
|
|
51
54
|
async *processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext) {
|
52
55
|
const subject = new Subject<DeepPartial<ProcessStreamResponseV2>>()
|
56
|
+
this.handleRequests(requests, subject)
|
57
|
+
.then(() => {
|
58
|
+
subject.complete()
|
59
|
+
})
|
60
|
+
.catch((e) => {
|
61
|
+
console.error(e)
|
62
|
+
subject.error(e)
|
63
|
+
})
|
64
|
+
yield* from(subject).pipe(withAbort(context.signal))
|
65
|
+
}
|
66
|
+
|
67
|
+
protected async handleRequests(
|
68
|
+
requests: AsyncIterable<ProcessStreamRequest>,
|
69
|
+
subject: Subject<DeepPartial<ProcessStreamResponse>>
|
70
|
+
) {
|
53
71
|
let lastBinding: DataBinding | undefined = undefined
|
54
72
|
for await (const request of requests) {
|
55
73
|
try {
|
@@ -63,8 +81,8 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
63
81
|
console.error('unexpect error during handle loop', e)
|
64
82
|
}
|
65
83
|
}
|
66
|
-
yield* from(subject).pipe(withAbort(context.signal))
|
67
84
|
}
|
85
|
+
|
68
86
|
private contexts = new Contexts()
|
69
87
|
|
70
88
|
async handleRequest(
|
@@ -85,6 +103,7 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
85
103
|
|
86
104
|
if (this.enablePartition) {
|
87
105
|
try {
|
106
|
+
console.debug('sending partition request', request.binding)
|
88
107
|
const partitions = await PluginManager.INSTANCE.partition(request.binding)
|
89
108
|
subject.next({
|
90
109
|
processId: request.processId,
|
@@ -126,11 +145,13 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
126
145
|
) {
|
127
146
|
const context = this.contexts.new(processId, subject)
|
128
147
|
const start = Date.now()
|
148
|
+
console.debug('process binding', processId)
|
129
149
|
PluginManager.INSTANCE.processBinding(binding, undefined, context)
|
130
150
|
.then(async (result) => {
|
131
|
-
|
151
|
+
console.debug(`process binding ${processId} done`)
|
132
152
|
await context.awaitPendings()
|
133
153
|
|
154
|
+
console.debug('sending ts data length:', result.timeseriesResult.length)
|
134
155
|
for (const ts of result.timeseriesResult) {
|
135
156
|
subject.next({
|
136
157
|
processId,
|
@@ -141,6 +162,7 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
141
162
|
}
|
142
163
|
|
143
164
|
if (result.states?.configUpdated) {
|
165
|
+
console.debug('sending tpl updates:')
|
144
166
|
subject.next({
|
145
167
|
processId,
|
146
168
|
tplRequest: {
|
@@ -149,6 +171,7 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
149
171
|
})
|
150
172
|
}
|
151
173
|
|
174
|
+
console.debug('sending binding result', processId)
|
152
175
|
subject.next({
|
153
176
|
result: {
|
154
177
|
states: result.states,
|
@@ -167,13 +190,14 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
167
190
|
const cost = Date.now() - start
|
168
191
|
process_binding_time.add(cost)
|
169
192
|
this.contexts.delete(processId)
|
193
|
+
console.debug('process binding done', processId)
|
170
194
|
})
|
171
195
|
}
|
172
196
|
|
173
197
|
async configureHandlers(
|
174
198
|
request: ConfigureHandlersRequest,
|
175
199
|
context: CallContext
|
176
|
-
): Promise<DeepPartial<
|
200
|
+
): Promise<DeepPartial<ConfigureHandlersResponse>> {
|
177
201
|
await PluginManager.INSTANCE.start(
|
178
202
|
StartRequest.fromPartial({
|
179
203
|
templateInstances: request.templateInstances
|
@@ -182,7 +206,10 @@ export class ProcessorServiceImplV2 implements ProcessorV2ServiceImplementation
|
|
182
206
|
|
183
207
|
const newConfig = ProcessConfigResponse.fromPartial({})
|
184
208
|
await PluginManager.INSTANCE.configure(newConfig, request.chainId)
|
185
|
-
return
|
209
|
+
return {
|
210
|
+
accountConfigs: newConfig.accountConfigs,
|
211
|
+
contractConfigs: newConfig.contractConfigs
|
212
|
+
}
|
186
213
|
}
|
187
214
|
}
|
188
215
|
|