@sentio/runtime 2.40.0-rc.3 → 2.40.0-rc.31
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-Y3KJTCAS.js → chunk-BWEU6VU4.js} +15795 -14005
- package/lib/index.d.ts +22 -9
- package/lib/index.js +7 -1
- package/lib/processor-runner.d.ts +3 -0
- package/lib/processor-runner.js +14974 -27315
- package/package.json +1 -1
- package/src/db-context.ts +24 -42
- package/src/gen/processor/protos/processor.ts +121 -76
- package/src/index.ts +1 -0
- package/src/metrics.ts +138 -0
- package/src/multicall.ts +1615 -0
- package/src/plugin.ts +7 -3
- package/src/processor-runner.ts +62 -21
- package/src/provider.ts +3 -9
- package/src/service.ts +95 -40
- package/src/utils.ts +11 -3
package/lib/index.d.ts
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
import * as _sentio_protos from '@sentio/protos';
|
2
|
-
import { DeepPartial as DeepPartial$1, ProcessStreamResponse, DBResponse, DBRequest_DBUpsert, DBRequest, HandlerType, ProcessConfigResponse, StartRequest, DataBinding, PreparedData, ProcessResult, PreprocessResult, ProcessorServiceImplementation, ProcessConfigRequest, Empty, ProcessBindingsRequest, ProcessBindingResponse, ProcessStreamRequest, PreprocessStreamRequest, PreprocessStreamResponse } from '@sentio/protos';
|
2
|
+
import { DeepPartial as DeepPartial$1, ProcessStreamResponse, DBResponse, DBRequest_DBUpsert, DBRequest, HandlerType, ProcessConfigResponse, StartRequest, DataBinding, PreparedData, ProcessResult, PreprocessResult, 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';
|
6
6
|
import { CallContext } from 'nice-grpc';
|
7
7
|
import _m0 from 'protobufjs/minimal.js';
|
8
|
+
import { JsonRpcProvider, Provider } from 'ethers';
|
9
|
+
import { EthChainId } from '@sentio/chain';
|
8
10
|
|
9
11
|
type Request = Omit<DBRequest, 'opId'>;
|
10
12
|
type RequestType = keyof Request;
|
11
|
-
declare const timeoutError:
|
13
|
+
declare const timeoutError: Error;
|
12
14
|
declare class StoreContext {
|
13
15
|
readonly subject: Subject<DeepPartial$1<ProcessStreamResponse>>;
|
14
16
|
readonly processId: number;
|
@@ -41,7 +43,9 @@ declare abstract class Plugin {
|
|
41
43
|
*/
|
42
44
|
stateDiff(config: ProcessConfigResponse): boolean;
|
43
45
|
processBinding(request: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult>;
|
44
|
-
preprocessBinding(request: DataBinding
|
46
|
+
preprocessBinding(request: DataBinding, preprocessStore: {
|
47
|
+
[k: string]: any;
|
48
|
+
}): Promise<PreprocessResult>;
|
45
49
|
}
|
46
50
|
declare class PluginManager {
|
47
51
|
static INSTANCE: PluginManager;
|
@@ -56,7 +60,9 @@ declare class PluginManager {
|
|
56
60
|
*/
|
57
61
|
stateDiff(config: ProcessConfigResponse): boolean;
|
58
62
|
processBinding(request: DataBinding, preparedData: PreparedData | undefined, dbContext?: StoreContext): Promise<ProcessResult>;
|
59
|
-
preprocessBinding(request: DataBinding,
|
63
|
+
preprocessBinding(request: DataBinding, preprocessStore: {
|
64
|
+
[k: string]: any;
|
65
|
+
}, dbContext?: StoreContext): Promise<PreprocessResult>;
|
60
66
|
}
|
61
67
|
|
62
68
|
declare class State {
|
@@ -85,6 +91,7 @@ declare abstract class ListStateStorage<T> extends StateStorage<T[]> {
|
|
85
91
|
declare function mergeProcessResults(results: ProcessResult[]): Required<ProcessResult, 'states'>;
|
86
92
|
declare function errorString(e: Error): string;
|
87
93
|
declare const USER_PROCESSOR = "user_processor";
|
94
|
+
declare function makeEthCallKey(param: EthCallParam): string;
|
88
95
|
|
89
96
|
declare class Endpoints {
|
90
97
|
static INSTANCE: Endpoints;
|
@@ -106,15 +113,18 @@ declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
106
113
|
unhandled: Error;
|
107
114
|
private readonly loader;
|
108
115
|
private readonly shutdownHandler?;
|
116
|
+
private preparedData;
|
109
117
|
constructor(loader: () => Promise<any>, shutdownHandler?: () => void);
|
110
118
|
getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse>;
|
111
119
|
start(request: StartRequest, context: CallContext): Promise<Empty>;
|
112
120
|
stop(request: Empty, context: CallContext): Promise<Empty>;
|
113
121
|
processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse>;
|
114
|
-
preprocessBindings(bindings: DataBinding[],
|
115
|
-
[
|
116
|
-
}>;
|
117
|
-
preprocessBinding(request: DataBinding,
|
122
|
+
preprocessBindings(bindings: DataBinding[], preprocessStore: {
|
123
|
+
[k: string]: any;
|
124
|
+
}, dbContext?: StoreContext, options?: CallContext): Promise<PreparedData>;
|
125
|
+
preprocessBinding(request: DataBinding, preprocessStore: {
|
126
|
+
[k: string]: any;
|
127
|
+
}, dbContext?: StoreContext, options?: CallContext): Promise<PreprocessResult>;
|
118
128
|
processBinding(request: DataBinding, preparedData: PreparedData | undefined, options?: CallContext): Promise<ProcessResult>;
|
119
129
|
processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext): AsyncGenerator<{
|
120
130
|
processId?: number | undefined;
|
@@ -366,4 +376,7 @@ interface GlobalConfig {
|
|
366
376
|
}
|
367
377
|
declare const GLOBAL_CONFIG: GlobalConfig;
|
368
378
|
|
369
|
-
|
379
|
+
declare const DummyProvider: JsonRpcProvider;
|
380
|
+
declare function getProvider(chainId?: EthChainId): Provider;
|
381
|
+
|
382
|
+
export { ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, GlobalConfig, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, State, StateStorage, StoreContext, USER_PROCESSOR, errorString, getProvider, makeEthCallKey, mergeProcessResults, timeoutError };
|
package/lib/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
2
2
|
import {
|
3
|
+
DummyProvider,
|
3
4
|
Endpoints,
|
4
5
|
GLOBAL_CONFIG,
|
5
6
|
Plugin,
|
@@ -9,9 +10,11 @@ import {
|
|
9
10
|
USER_PROCESSOR,
|
10
11
|
__publicField,
|
11
12
|
errorString,
|
13
|
+
getProvider,
|
14
|
+
makeEthCallKey,
|
12
15
|
mergeProcessResults,
|
13
16
|
timeoutError
|
14
|
-
} from "./chunk-
|
17
|
+
} from "./chunk-BWEU6VU4.js";
|
15
18
|
|
16
19
|
// src/state.ts
|
17
20
|
var _State = class {
|
@@ -75,6 +78,7 @@ var ListStateStorage = class extends StateStorage {
|
|
75
78
|
}
|
76
79
|
};
|
77
80
|
export {
|
81
|
+
DummyProvider,
|
78
82
|
Endpoints,
|
79
83
|
GLOBAL_CONFIG,
|
80
84
|
ListStateStorage,
|
@@ -87,6 +91,8 @@ export {
|
|
87
91
|
StoreContext,
|
88
92
|
USER_PROCESSOR,
|
89
93
|
errorString,
|
94
|
+
getProvider,
|
95
|
+
makeEthCallKey,
|
90
96
|
mergeProcessResults,
|
91
97
|
timeoutError
|
92
98
|
};
|