@sentio/runtime 2.59.4 → 2.60.0-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/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, TemplateInstance, EthCallParam, ProcessorServiceImplementation, ProcessConfigRequest, Empty, ProcessBindingsRequest, ProcessBindingResponse, ProcessStreamRequest, PreprocessStreamRequest, PreprocessStreamResponse } from '@sentio/protos';
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
@@ -1,3 +1,76 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{a as p,b as f,c as i,d as m,e as n}from"./chunk-WHWNPZZ3.js";import{$ as B,P as u,Q as w,R as I,S as L,T as O,U as b,V as c,Y as v,Z as y,_ as A,a as x,aa as D,b as s,c as C,d as a,e as g,f as h,g as G,i as d,j as l,r as o}from"./chunk-PEHR2WT4.js";import{t,u as e}from"./chunk-VUN3TGG5.js";import("node:process").then(r=>r.stdout.write(""));import("node:process").then(r=>r.stdout.write(""));export{b as AbstractStoreContext,v as DummyProvider,d as Endpoints,o as GLOBAL_CONFIG,m as ListStateStorage,i as MapStateStorage,t as Plugin,e as PluginManager,B as ProcessorServiceImpl,A as QueuedStaticJsonRpcProvider,p as State,f as StateStorage,c as StoreContext,n as TemplateInstanceState,a as USER_PROCESSOR,G as compareSemver,l as configureEndpoints,u as dbMetrics,C as errorString,y as getProvider,g as makeEthCallKey,x as mergeProcessResults,s as mergeProcessResultsInPlace,L as metricsStorage,h as parseSemver,I as processMetrics,w as providerMetrics,D as recordRuntimeInfo,O as timeoutError};
2
+ import {
3
+ ListStateStorage,
4
+ MapStateStorage,
5
+ State,
6
+ StateStorage,
7
+ TemplateInstanceState
8
+ } from "./chunk-6XHWJ2VS.js";
9
+ import {
10
+ AbstractStoreContext,
11
+ DataBindingContext,
12
+ DummyProvider,
13
+ Endpoints,
14
+ GLOBAL_CONFIG,
15
+ ProcessorServiceImpl,
16
+ QueuedStaticJsonRpcProvider,
17
+ StoreContext,
18
+ USER_PROCESSOR,
19
+ compareSemver,
20
+ configureEndpoints,
21
+ dbMetrics,
22
+ errorString,
23
+ getProvider,
24
+ makeEthCallKey,
25
+ mergeProcessResults,
26
+ mergeProcessResultsInPlace,
27
+ metricsStorage,
28
+ parseSemver,
29
+ processMetrics,
30
+ providerMetrics,
31
+ recordRuntimeInfo,
32
+ timeoutError
33
+ } from "./chunk-7JPTCCHQ.js";
34
+ import {
35
+ Plugin,
36
+ PluginManager
37
+ } from "./chunk-AQYRWO7H.js";
38
+
39
+ // src/chain-config.ts
40
+ import("node:process").then((p) => p.stdout.write(""));
41
+
42
+ // src/index.ts
43
+ import("node:process").then((p) => p.stdout.write(""));
44
+ export {
45
+ AbstractStoreContext,
46
+ DataBindingContext,
47
+ DummyProvider,
48
+ Endpoints,
49
+ GLOBAL_CONFIG,
50
+ ListStateStorage,
51
+ MapStateStorage,
52
+ Plugin,
53
+ PluginManager,
54
+ ProcessorServiceImpl,
55
+ QueuedStaticJsonRpcProvider,
56
+ State,
57
+ StateStorage,
58
+ StoreContext,
59
+ TemplateInstanceState,
60
+ USER_PROCESSOR,
61
+ compareSemver,
62
+ configureEndpoints,
63
+ dbMetrics,
64
+ errorString,
65
+ getProvider,
66
+ makeEthCallKey,
67
+ mergeProcessResults,
68
+ mergeProcessResultsInPlace,
69
+ metricsStorage,
70
+ parseSemver,
71
+ processMetrics,
72
+ providerMetrics,
73
+ recordRuntimeInfo,
74
+ timeoutError
75
+ };
3
76
  //# sourceMappingURL=index.js.map
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":";0SAKC,OAAO,cAAc,EAAE,KAAMA,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC,ECKrD,OAAO,cAAc,EAAE,KAAMC,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["p","p"]}
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":[]}