@sentio/runtime 2.60.0-rc.11 → 2.60.0-rc.13
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-CYS2DAE4.js → chunk-26X74ASV.js} +2 -2
- package/lib/{chunk-BOHR42T4.js → chunk-2JZQGMEZ.js} +3 -2
- package/lib/{chunk-BOHR42T4.js.map → chunk-2JZQGMEZ.js.map} +1 -1
- package/lib/{chunk-TC6OWLVA.js → chunk-ZTW66EYL.js} +2 -1
- 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 +10 -3
- 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/gen/service/common/protos/common.ts +134 -1
- package/src/service-v3.ts +7 -1
- package/lib/chunk-TC6OWLVA.js.map +0 -1
- /package/lib/{chunk-CYS2DAE4.js.map → chunk-26X74ASV.js.map} +0 -0
package/lib/index.d.ts
CHANGED
@@ -1,119 +1,16 @@
|
|
1
|
+
import { S as StoreContext, E as ExecutionConfig } from './processor-BDXlufg5.js';
|
2
|
+
export { A as AbstractStoreContext, D as DataBindingContext, b as IDataBindingContext, I as IStoreContext, P as Plugin, a as PluginManager, t as timeoutError } from './processor-BDXlufg5.js';
|
1
3
|
import * as _sentio_protos from '@sentio/protos';
|
2
|
-
import {
|
3
|
-
import { Subject } from 'rxjs';
|
4
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
4
|
+
import { TemplateInstance, ProcessResult, EthCallParam, ProcessorServiceImplementation, ProcessConfigRequest, ProcessConfigResponse, StartRequest, Empty, ProcessBindingsRequest, ProcessBindingResponse, DataBinding, PreparedData, PreprocessResult, ProcessStreamRequest, HandlerType, PreprocessStreamRequest, DeepPartial, PreprocessStreamResponse, ProcessStreamResponse } from '@sentio/protos';
|
5
5
|
import { Required } from 'utility-types';
|
6
6
|
import { CallContext } from 'nice-grpc';
|
7
|
-
import
|
7
|
+
import { Subject } from 'rxjs';
|
8
8
|
import { JsonRpcProvider, Network } from 'ethers';
|
9
9
|
import PQueue from 'p-queue';
|
10
10
|
import { EthChainId } from '@sentio/chain';
|
11
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
11
12
|
import { Counter, Attributes, Gauge, Histogram } from '@opentelemetry/api';
|
12
|
-
|
13
|
-
type Request = Omit<DBRequest, 'opId'>;
|
14
|
-
type RequestType = keyof Request;
|
15
|
-
declare const timeoutError: Error;
|
16
|
-
interface IStoreContext {
|
17
|
-
sendRequest(request: DeepPartial$1<Request>, timeoutSecs?: number): Promise<DBResponse>;
|
18
|
-
result(dbResult: DBResponse): void;
|
19
|
-
error(processId: number, e: any): void;
|
20
|
-
close(): void;
|
21
|
-
}
|
22
|
-
interface IDataBindingContext extends IStoreContext {
|
23
|
-
sendTemplateRequest(templates: Array<TemplateInstance>): void;
|
24
|
-
sendTimeseriesRequest(timeseries: Array<TimeseriesResult>): void;
|
25
|
-
}
|
26
|
-
declare abstract class AbstractStoreContext implements IStoreContext {
|
27
|
-
readonly processId: number;
|
28
|
-
private static opCounter;
|
29
|
-
protected defers: Map<bigint, {
|
30
|
-
resolve: (value: any) => void;
|
31
|
-
reject: (reason?: any) => void;
|
32
|
-
requestType?: RequestType;
|
33
|
-
}>;
|
34
|
-
private statsInterval;
|
35
|
-
private pendings;
|
36
|
-
constructor(processId: number);
|
37
|
-
newPromise<T>(opId: bigint, requestType?: RequestType): Promise<T>;
|
38
|
-
abstract doSend(resp: DeepPartial$1<ProcessStreamResponse>): void;
|
39
|
-
sendRequest(request: DeepPartial$1<Request>, timeoutSecs?: number): Promise<DBResponse>;
|
40
|
-
result(dbResult: DBResponse): void;
|
41
|
-
error(processId: number, e: any): void;
|
42
|
-
close(): void;
|
43
|
-
upsertBatch: {
|
44
|
-
opId: bigint;
|
45
|
-
request: DBRequest_DBUpsert;
|
46
|
-
promise: Promise<DBResponse>;
|
47
|
-
timer: NodeJS.Timeout;
|
48
|
-
} | undefined;
|
49
|
-
private sendUpsertInBatch;
|
50
|
-
private sendBatch;
|
51
|
-
awaitPendings(): Promise<void>;
|
52
|
-
}
|
53
|
-
declare class StoreContext extends AbstractStoreContext {
|
54
|
-
readonly subject: Subject<DeepPartial$1<ProcessStreamResponse>>;
|
55
|
-
constructor(subject: Subject<DeepPartial$1<ProcessStreamResponse>>, processId: number);
|
56
|
-
doSend(resp: DeepPartial$1<ProcessStreamResponse>): void;
|
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
|
-
}
|
66
|
-
|
67
|
-
declare abstract class Plugin {
|
68
|
-
name: string;
|
69
|
-
supportedHandlers: HandlerType[];
|
70
|
-
configure(config: ProcessConfigResponse, forChainId?: string): Promise<void>;
|
71
|
-
start(start: StartRequest): Promise<void>;
|
72
|
-
/**
|
73
|
-
* @deprecated The method should not be used, use ctx.states instead
|
74
|
-
*/
|
75
|
-
stateDiff(config: ProcessConfigResponse): boolean;
|
76
|
-
processBinding(request: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult>;
|
77
|
-
preprocessBinding(request: DataBinding, preprocessStore: {
|
78
|
-
[k: string]: any;
|
79
|
-
}): Promise<PreprocessResult>;
|
80
|
-
partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions>;
|
81
|
-
/**
|
82
|
-
* method used by action server only
|
83
|
-
* @param port
|
84
|
-
*/
|
85
|
-
startServer(port?: number): Promise<void>;
|
86
|
-
/**
|
87
|
-
* method used by action server only
|
88
|
-
*/
|
89
|
-
shutdownServer(): void;
|
90
|
-
/**
|
91
|
-
* Initialize the plugin, for service v3.
|
92
|
-
* @param config
|
93
|
-
*/
|
94
|
-
init(config: InitResponse): Promise<void>;
|
95
|
-
}
|
96
|
-
declare class PluginManager {
|
97
|
-
static INSTANCE: PluginManager;
|
98
|
-
dbContextLocalStorage: AsyncLocalStorage<IStoreContext | undefined>;
|
99
|
-
plugins: Plugin[];
|
100
|
-
typesToPlugin: Map<HandlerType, Plugin>;
|
101
|
-
register(plugin: Plugin): void;
|
102
|
-
configure(config: ProcessConfigResponse, forChainId?: string): Promise<void>;
|
103
|
-
start(start: StartRequest, actionServerPort?: number): Promise<void[]>;
|
104
|
-
startServer(port?: number): Promise<void[]>;
|
105
|
-
shutdown(): void;
|
106
|
-
/**
|
107
|
-
* @deprecated The method should not be used, use ctx.states instead
|
108
|
-
*/
|
109
|
-
stateDiff(config: ProcessConfigResponse): boolean;
|
110
|
-
processBinding(request: DataBinding, preparedData: PreparedData | undefined, dbContext?: IStoreContext): Promise<ProcessResult>;
|
111
|
-
partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions>;
|
112
|
-
preprocessBinding(request: DataBinding, preprocessStore: {
|
113
|
-
[k: string]: any;
|
114
|
-
}, dbContext?: StoreContext): Promise<PreprocessResult>;
|
115
|
-
init(resp: InitResponse): Promise<void[]>;
|
116
|
-
}
|
13
|
+
import 'protobufjs/minimal.js';
|
117
14
|
|
118
15
|
declare class State {
|
119
16
|
stateMap: Map<string, any>;
|
@@ -550,7 +447,7 @@ declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
550
447
|
} | undefined;
|
551
448
|
} | undefined;
|
552
449
|
}, void, undefined>;
|
553
|
-
handlePreprocessRequests(requests: AsyncIterable<PreprocessStreamRequest>, subject: Subject<DeepPartial
|
450
|
+
handlePreprocessRequests(requests: AsyncIterable<PreprocessStreamRequest>, subject: Subject<DeepPartial<PreprocessStreamResponse>>): Promise<void>;
|
554
451
|
preprocessBindingsStream(requests: AsyncIterable<PreprocessStreamRequest>, context: CallContext): AsyncGenerator<{
|
555
452
|
processId?: number | undefined;
|
556
453
|
dbRequest?: {
|
@@ -684,46 +581,12 @@ declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
684
581
|
} | undefined;
|
685
582
|
}, void, undefined>;
|
686
583
|
private dbContexts;
|
687
|
-
protected handleRequests(requests: AsyncIterable<ProcessStreamRequest>, subject: Subject<DeepPartial
|
688
|
-
handleRequest(request: ProcessStreamRequest, lastBinding: DataBinding | undefined, subject: Subject<DeepPartial
|
584
|
+
protected handleRequests(requests: AsyncIterable<ProcessStreamRequest>, subject: Subject<DeepPartial<ProcessStreamResponse>>): Promise<void>;
|
585
|
+
handleRequest(request: ProcessStreamRequest, lastBinding: DataBinding | undefined, subject: Subject<DeepPartial<ProcessStreamResponse>>): Promise<void>;
|
689
586
|
private startProcess;
|
690
587
|
}
|
691
588
|
declare function recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType): void;
|
692
589
|
|
693
|
-
interface ExecutionConfig {
|
694
|
-
sequential: boolean;
|
695
|
-
forceExactBlockTime: boolean;
|
696
|
-
processBindingTimeout: number;
|
697
|
-
skipStartBlockValidation: boolean;
|
698
|
-
rpcRetryTimes: number;
|
699
|
-
ethAbiDecoderConfig?: ExecutionConfig_DecoderWorkerConfig | undefined;
|
700
|
-
}
|
701
|
-
declare const ExecutionConfig: {
|
702
|
-
encode(message: ExecutionConfig, writer?: _m0.Writer): _m0.Writer;
|
703
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): ExecutionConfig;
|
704
|
-
fromJSON(object: any): ExecutionConfig;
|
705
|
-
toJSON(message: ExecutionConfig): unknown;
|
706
|
-
create(base?: DeepPartial<ExecutionConfig>): ExecutionConfig;
|
707
|
-
fromPartial(object: DeepPartial<ExecutionConfig>): ExecutionConfig;
|
708
|
-
};
|
709
|
-
interface ExecutionConfig_DecoderWorkerConfig {
|
710
|
-
enabled: boolean;
|
711
|
-
workerCount?: number | undefined;
|
712
|
-
skipWhenDecodeFailed?: boolean | undefined;
|
713
|
-
}
|
714
|
-
declare const ExecutionConfig_DecoderWorkerConfig: {
|
715
|
-
encode(message: ExecutionConfig_DecoderWorkerConfig, writer?: _m0.Writer): _m0.Writer;
|
716
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): ExecutionConfig_DecoderWorkerConfig;
|
717
|
-
fromJSON(object: any): ExecutionConfig_DecoderWorkerConfig;
|
718
|
-
toJSON(message: ExecutionConfig_DecoderWorkerConfig): unknown;
|
719
|
-
create(base?: DeepPartial<ExecutionConfig_DecoderWorkerConfig>): ExecutionConfig_DecoderWorkerConfig;
|
720
|
-
fromPartial(object: DeepPartial<ExecutionConfig_DecoderWorkerConfig>): ExecutionConfig_DecoderWorkerConfig;
|
721
|
-
};
|
722
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
723
|
-
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
724
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
725
|
-
} : Partial<T>;
|
726
|
-
|
727
590
|
interface GlobalConfig {
|
728
591
|
execution: Partial<ExecutionConfig>;
|
729
592
|
}
|
@@ -889,4 +752,4 @@ declare const processMetrics: {
|
|
889
752
|
};
|
890
753
|
declare const metricsStorage: AsyncLocalStorage<string>;
|
891
754
|
|
892
|
-
export {
|
755
|
+
export { type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, ListStateStorage, MapStateStorage, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, type Semver, State, StateStorage, StoreContext, TemplateInstanceState, USER_PROCESSOR, compareSemver, configureEndpoints, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, mergeProcessResultsInPlace, metricsStorage, parseSemver, processMetrics, providerMetrics, recordRuntimeInfo };
|
package/lib/index.js
CHANGED
@@ -30,11 +30,11 @@ import {
|
|
30
30
|
providerMetrics,
|
31
31
|
recordRuntimeInfo,
|
32
32
|
timeoutError
|
33
|
-
} from "./chunk-
|
33
|
+
} from "./chunk-2JZQGMEZ.js";
|
34
34
|
import {
|
35
35
|
Plugin,
|
36
36
|
PluginManager
|
37
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-ZTW66EYL.js";
|
38
38
|
|
39
39
|
// src/chain-config.ts
|
40
40
|
import("node:process").then((p) => p.stdout.write(""));
|