@sentio/runtime 2.59.5-rc.1 → 2.60.0-rc.2
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-L7MQIWIO.js → chunk-7JPTCCHQ.js} +32 -2
- package/lib/{chunk-L7MQIWIO.js.map → chunk-7JPTCCHQ.js.map} +1 -1
- package/lib/{chunk-LCS6SRJY.js → chunk-AQYRWO7H.js} +13 -4
- package/lib/chunk-AQYRWO7H.js.map +1 -0
- package/lib/{chunk-U5UZYRQ4.js → chunk-RJMWLF3Q.js} +2 -2
- package/lib/index.d.ts +22 -4
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.js +3 -3
- package/lib/service-worker.js +3 -3
- package/package.json +1 -1
- package/src/db-context.ts +43 -1
- package/src/gen/processor/protos/processor.ts +506 -0
- package/src/gen/service/common/protos/common.ts +195 -0
- package/src/plugin.ts +14 -3
- package/src/service-v2.ts +207 -0
- package/lib/chunk-LCS6SRJY.js.map +0 -1
- /package/lib/{chunk-U5UZYRQ4.js.map → chunk-RJMWLF3Q.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
__require,
|
7
7
|
__toCommonJS,
|
8
8
|
__toESM
|
9
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-AQYRWO7H.js";
|
10
10
|
|
11
11
|
// ../../node_modules/.pnpm/logform@2.6.0/node_modules/logform/format.js
|
12
12
|
var require_format = __commonJS({
|
@@ -10972,4 +10972,4 @@ export {
|
|
10972
10972
|
safe-buffer/index.js:
|
10973
10973
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
10974
10974
|
*/
|
10975
|
-
//# sourceMappingURL=chunk-
|
10975
|
+
//# sourceMappingURL=chunk-RJMWLF3Q.js.map
|
package/lib/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as _sentio_protos from '@sentio/protos';
|
2
|
-
import { DeepPartial as DeepPartial$1, DBResponse, ProcessStreamResponse, DBRequest_DBUpsert, DBRequest, HandlerType, ProcessConfigResponse, StartRequest, DataBinding, PreparedData, ProcessResult, PreprocessResult, ProcessStreamResponse_Partitions,
|
2
|
+
import { DeepPartial as DeepPartial$1, DBResponse, TemplateInstance, TimeseriesResult, ProcessStreamResponse, DBRequest_DBUpsert, ProcessStreamResponseV2, DBRequest, HandlerType, ProcessConfigResponse, StartRequest, DataBinding, PreparedData, ProcessResult, PreprocessResult, ProcessStreamResponse_Partitions, InitResponse, EthCallParam, ProcessorServiceImplementation, ProcessConfigRequest, Empty, ProcessBindingsRequest, ProcessBindingResponse, ProcessStreamRequest, PreprocessStreamRequest, PreprocessStreamResponse } from '@sentio/protos';
|
3
3
|
import { Subject } from 'rxjs';
|
4
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
5
5
|
import { Required } from 'utility-types';
|
@@ -19,6 +19,10 @@ interface IStoreContext {
|
|
19
19
|
error(processId: number, e: any): void;
|
20
20
|
close(): void;
|
21
21
|
}
|
22
|
+
interface IDataBindingContext extends IStoreContext {
|
23
|
+
sendTemplateRequest(templates: Array<TemplateInstance>): void;
|
24
|
+
sendTimeseriesRequest(timeseries: Array<TimeseriesResult>): void;
|
25
|
+
}
|
22
26
|
declare abstract class AbstractStoreContext implements IStoreContext {
|
23
27
|
readonly processId: number;
|
24
28
|
private static opCounter;
|
@@ -51,11 +55,19 @@ declare class StoreContext extends AbstractStoreContext {
|
|
51
55
|
constructor(subject: Subject<DeepPartial$1<ProcessStreamResponse>>, processId: number);
|
52
56
|
doSend(resp: DeepPartial$1<ProcessStreamResponse>): void;
|
53
57
|
}
|
58
|
+
declare class DataBindingContext extends AbstractStoreContext implements IDataBindingContext {
|
59
|
+
readonly processId: number;
|
60
|
+
readonly subject: Subject<DeepPartial$1<ProcessStreamResponseV2>>;
|
61
|
+
constructor(processId: number, subject: Subject<DeepPartial$1<ProcessStreamResponseV2>>);
|
62
|
+
sendTemplateRequest(templates: Array<TemplateInstance>): void;
|
63
|
+
sendTimeseriesRequest(timeseries: Array<TimeseriesResult>): void;
|
64
|
+
doSend(resp: DeepPartial$1<ProcessStreamResponseV2>): void;
|
65
|
+
}
|
54
66
|
|
55
67
|
declare abstract class Plugin {
|
56
68
|
name: string;
|
57
69
|
supportedHandlers: HandlerType[];
|
58
|
-
configure(config: ProcessConfigResponse): Promise<void>;
|
70
|
+
configure(config: ProcessConfigResponse, forChainId?: string): Promise<void>;
|
59
71
|
start(start: StartRequest): Promise<void>;
|
60
72
|
/**
|
61
73
|
* @deprecated The method should not be used, use ctx.states instead
|
@@ -75,6 +87,11 @@ declare abstract class Plugin {
|
|
75
87
|
* method used by action server only
|
76
88
|
*/
|
77
89
|
shutdownServer(): void;
|
90
|
+
/**
|
91
|
+
* Initialize the plugin, for service v2.
|
92
|
+
* @param config
|
93
|
+
*/
|
94
|
+
init(config: InitResponse): Promise<void>;
|
78
95
|
}
|
79
96
|
declare class PluginManager {
|
80
97
|
static INSTANCE: PluginManager;
|
@@ -82,7 +99,7 @@ declare class PluginManager {
|
|
82
99
|
plugins: Plugin[];
|
83
100
|
typesToPlugin: Map<HandlerType, Plugin>;
|
84
101
|
register(plugin: Plugin): void;
|
85
|
-
configure(config: ProcessConfigResponse): Promise<void
|
102
|
+
configure(config: ProcessConfigResponse, forChainId?: string): Promise<void>;
|
86
103
|
start(start: StartRequest, actionServerPort?: number): Promise<void[]>;
|
87
104
|
startServer(port?: number): Promise<void[]>;
|
88
105
|
shutdown(): void;
|
@@ -95,6 +112,7 @@ declare class PluginManager {
|
|
95
112
|
preprocessBinding(request: DataBinding, preprocessStore: {
|
96
113
|
[k: string]: any;
|
97
114
|
}, dbContext?: StoreContext): Promise<PreprocessResult>;
|
115
|
+
init(resp: InitResponse): Promise<void[]>;
|
98
116
|
}
|
99
117
|
|
100
118
|
declare class State {
|
@@ -871,4 +889,4 @@ declare const processMetrics: {
|
|
871
889
|
};
|
872
890
|
declare const metricsStorage: AsyncLocalStorage<string>;
|
873
891
|
|
874
|
-
export { AbstractStoreContext, type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, type IStoreContext, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, type Semver, State, StateStorage, StoreContext, TemplateInstanceState, USER_PROCESSOR, compareSemver, configureEndpoints, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, mergeProcessResultsInPlace, metricsStorage, parseSemver, processMetrics, providerMetrics, recordRuntimeInfo, timeoutError };
|
892
|
+
export { AbstractStoreContext, type ChainConfig, DataBindingContext, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, type IDataBindingContext, type IStoreContext, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, type Semver, State, StateStorage, StoreContext, TemplateInstanceState, USER_PROCESSOR, compareSemver, configureEndpoints, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, mergeProcessResultsInPlace, metricsStorage, parseSemver, processMetrics, providerMetrics, recordRuntimeInfo, timeoutError };
|
package/lib/index.js
CHANGED
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
} from "./chunk-6XHWJ2VS.js";
|
9
9
|
import {
|
10
10
|
AbstractStoreContext,
|
11
|
+
DataBindingContext,
|
11
12
|
DummyProvider,
|
12
13
|
Endpoints,
|
13
14
|
GLOBAL_CONFIG,
|
@@ -29,11 +30,11 @@ import {
|
|
29
30
|
providerMetrics,
|
30
31
|
recordRuntimeInfo,
|
31
32
|
timeoutError
|
32
|
-
} from "./chunk-
|
33
|
+
} from "./chunk-7JPTCCHQ.js";
|
33
34
|
import {
|
34
35
|
Plugin,
|
35
36
|
PluginManager
|
36
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-AQYRWO7H.js";
|
37
38
|
|
38
39
|
// src/chain-config.ts
|
39
40
|
import("node:process").then((p) => p.stdout.write(""));
|
@@ -42,6 +43,7 @@ import("node:process").then((p) => p.stdout.write(""));
|
|
42
43
|
import("node:process").then((p) => p.stdout.write(""));
|
43
44
|
export {
|
44
45
|
AbstractStoreContext,
|
46
|
+
DataBindingContext,
|
45
47
|
DummyProvider,
|
46
48
|
Endpoints,
|
47
49
|
GLOBAL_CONFIG,
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/chain-config.ts","../src/index.ts"],"sourcesContent":["export interface ChainConfig {\n ChainID: string\n Https?: string[]\n ChainServer?: string\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export * from './plugin.js'\nexport * from './state.js'\nexport * from './utils.js'\nexport * from './endpoints.js'\nexport * from './chain-config.js'\nexport * from './service.js'\nexport { GLOBAL_CONFIG, type GlobalConfig } from './global-config.js'\nexport * from './db-context.js'\nexport * from './provider.js'\nexport * from './metrics.js'\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":"
|
1
|
+
{"version":3,"sources":["../src/chain-config.ts","../src/index.ts"],"sourcesContent":["export interface ChainConfig {\n ChainID: string\n Https?: string[]\n ChainServer?: string\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export * from './plugin.js'\nexport * from './state.js'\nexport * from './utils.js'\nexport * from './endpoints.js'\nexport * from './chain-config.js'\nexport * from './service.js'\nexport { GLOBAL_CONFIG, type GlobalConfig } from './global-config.js'\nexport * from './db-context.js'\nexport * from './provider.js'\nexport * from './metrics.js'\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKC,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;;;ACKrD,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
|
package/lib/processor-runner.js
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
} from "./chunk-6XHWJ2VS.js";
|
6
6
|
import {
|
7
7
|
setupLogger
|
8
|
-
} from "./chunk-
|
8
|
+
} from "./chunk-RJMWLF3Q.js";
|
9
9
|
import {
|
10
10
|
DiagConsoleLogger,
|
11
11
|
DiagLogLevel,
|
@@ -43,7 +43,7 @@ import {
|
|
43
43
|
require_lodash,
|
44
44
|
require_src,
|
45
45
|
trace
|
46
|
-
} from "./chunk-
|
46
|
+
} from "./chunk-7JPTCCHQ.js";
|
47
47
|
import {
|
48
48
|
ExecutionConfig,
|
49
49
|
PluginManager,
|
@@ -57,7 +57,7 @@ import {
|
|
57
57
|
__toCommonJS,
|
58
58
|
__toESM,
|
59
59
|
require_minimal2 as require_minimal
|
60
|
-
} from "./chunk-
|
60
|
+
} from "./chunk-AQYRWO7H.js";
|
61
61
|
|
62
62
|
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.25.1/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js
|
63
63
|
// @__NO_SIDE_EFFECTS__
|
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-RJMWLF3Q.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-7JPTCCHQ.js";
|
14
14
|
import {
|
15
15
|
__toESM
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-AQYRWO7H.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/db-context.ts
CHANGED
@@ -5,7 +5,10 @@ import {
|
|
5
5
|
DBResponse,
|
6
6
|
DeepPartial,
|
7
7
|
ProcessResult,
|
8
|
-
ProcessStreamResponse
|
8
|
+
ProcessStreamResponse,
|
9
|
+
ProcessStreamResponseV2,
|
10
|
+
TemplateInstance,
|
11
|
+
TimeseriesResult
|
9
12
|
} from '@sentio/protos'
|
10
13
|
import * as process from 'node:process'
|
11
14
|
import { dbMetrics } from './metrics.js'
|
@@ -38,6 +41,11 @@ export interface IStoreContext {
|
|
38
41
|
close(): void
|
39
42
|
}
|
40
43
|
|
44
|
+
export interface IDataBindingContext extends IStoreContext {
|
45
|
+
sendTemplateRequest(templates: Array<TemplateInstance>): void
|
46
|
+
sendTimeseriesRequest(timeseries: Array<TimeseriesResult>): void
|
47
|
+
}
|
48
|
+
|
41
49
|
export abstract class AbstractStoreContext implements IStoreContext {
|
42
50
|
private static opCounter = 0n
|
43
51
|
protected defers = new Map<
|
@@ -244,3 +252,37 @@ export class StoreContext extends AbstractStoreContext {
|
|
244
252
|
})
|
245
253
|
}
|
246
254
|
}
|
255
|
+
|
256
|
+
// for service v2
|
257
|
+
export class DataBindingContext extends AbstractStoreContext implements IDataBindingContext {
|
258
|
+
constructor(
|
259
|
+
readonly processId: number,
|
260
|
+
readonly subject: Subject<DeepPartial<ProcessStreamResponseV2>>
|
261
|
+
) {
|
262
|
+
super(processId)
|
263
|
+
}
|
264
|
+
|
265
|
+
sendTemplateRequest(templates: Array<TemplateInstance>) {
|
266
|
+
this.subject.next({
|
267
|
+
processId: this.processId,
|
268
|
+
tplRequest: {
|
269
|
+
templates
|
270
|
+
}
|
271
|
+
})
|
272
|
+
}
|
273
|
+
sendTimeseriesRequest(timeseries: Array<TimeseriesResult>) {
|
274
|
+
this.subject.next({
|
275
|
+
processId: this.processId,
|
276
|
+
tsRequest: {
|
277
|
+
data: timeseries
|
278
|
+
}
|
279
|
+
})
|
280
|
+
}
|
281
|
+
|
282
|
+
doSend(resp: DeepPartial<ProcessStreamResponseV2>) {
|
283
|
+
this.subject.next({
|
284
|
+
...resp,
|
285
|
+
processId: this.processId
|
286
|
+
})
|
287
|
+
}
|
288
|
+
}
|