@sentio/runtime 2.61.0-rc.9 → 2.61.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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StoreContext, E as ExecutionConfig } from './processor-Cbun9NKJ.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-Cbun9NKJ.js';
1
+ import { S as StoreContext, E as ExecutionConfig } from './processor-DwZlMkFj.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-DwZlMkFj.js';
3
3
  import * as _sentio_protos from '@sentio/protos';
4
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';
package/lib/index.js CHANGED
@@ -30,11 +30,11 @@ import {
30
30
  providerMetrics,
31
31
  recordRuntimeInfo,
32
32
  timeoutError
33
- } from "./chunk-XIU7XZT7.js";
33
+ } from "./chunk-NVBA53K5.js";
34
34
  import {
35
35
  Plugin,
36
36
  PluginManager
37
- } from "./chunk-J4QKUO6L.js";
37
+ } from "./chunk-4M76KZSL.js";
38
38
 
39
39
  // src/chain-config.ts
40
40
  import("node:process").then((p) => p.stdout.write(""));
@@ -1,4 +1,4 @@
1
- import { DeepPartial as DeepPartial$2, DBResponse, TemplateInstance, TimeseriesResult as TimeseriesResult$1, ProcessStreamResponse, DBRequest_DBUpsert, ProcessStreamResponseV2, DBRequest, HandlerType as HandlerType$1, ProcessConfigResponse, StartRequest, DataBinding as DataBinding$1, PreparedData, ProcessResult as ProcessResult$1, PreprocessResult, ProcessStreamResponse_Partitions, InitResponse } from '@sentio/protos';
1
+ import { DeepPartial as DeepPartial$2, DBResponse, TemplateInstance, TimeseriesResult as TimeseriesResult$1, ProcessStreamResponse, DBRequest_DBUpsert, ProcessStreamResponseV3, DBRequest, HandlerType as HandlerType$1, ProcessConfigResponse, StartRequest, DataBinding as DataBinding$1, PreparedData, ProcessResult as ProcessResult$1, PreprocessResult, ProcessStreamResponse_Partitions, UpdateTemplatesRequest } from '@sentio/protos';
2
2
  import { Subject } from 'rxjs';
3
3
  import { AsyncLocalStorage } from 'node:async_hooks';
4
4
  import _m0 from 'protobufjs/minimal.js';
@@ -50,11 +50,11 @@ declare class StoreContext extends AbstractStoreContext {
50
50
  }
51
51
  declare class DataBindingContext extends AbstractStoreContext implements IDataBindingContext {
52
52
  readonly processId: number;
53
- readonly subject: Subject<DeepPartial$2<ProcessStreamResponseV2>>;
54
- constructor(processId: number, subject: Subject<DeepPartial$2<ProcessStreamResponseV2>>);
53
+ readonly subject: Subject<DeepPartial$2<ProcessStreamResponseV3>>;
54
+ constructor(processId: number, subject: Subject<DeepPartial$2<ProcessStreamResponseV3>>);
55
55
  sendTemplateRequest(templates: Array<TemplateInstance>): void;
56
56
  sendTimeseriesRequest(timeseries: Array<TimeseriesResult$1>): void;
57
- doSend(resp: DeepPartial$2<ProcessStreamResponseV2>): void;
57
+ doSend(resp: DeepPartial$2<ProcessStreamResponseV3>): void;
58
58
  }
59
59
 
60
60
  declare abstract class Plugin {
@@ -80,11 +80,6 @@ declare abstract class Plugin {
80
80
  * method used by action server only
81
81
  */
82
82
  shutdownServer(): void;
83
- /**
84
- * Initialize the plugin, for service v3.
85
- * @param config
86
- */
87
- init(config: InitResponse): Promise<void>;
88
83
  }
89
84
  declare class PluginManager {
90
85
  static INSTANCE: PluginManager;
@@ -92,7 +87,7 @@ declare class PluginManager {
92
87
  plugins: Plugin[];
93
88
  typesToPlugin: Map<HandlerType$1, Plugin>;
94
89
  register(plugin: Plugin): void;
95
- configure(config: ProcessConfigResponse, forChainId?: string): Promise<void>;
90
+ configure(config: ProcessConfigResponse): Promise<void>;
96
91
  start(start: StartRequest, actionServerPort?: number): Promise<void[]>;
97
92
  startServer(port?: number): Promise<void[]>;
98
93
  shutdown(): void;
@@ -105,7 +100,7 @@ declare class PluginManager {
105
100
  preprocessBinding(request: DataBinding$1, preprocessStore: {
106
101
  [k: string]: any;
107
102
  }, dbContext?: StoreContext): Promise<PreprocessResult>;
108
- init(resp: InitResponse): Promise<void[]>;
103
+ updateTemplates(request: UpdateTemplatesRequest): Promise<void>;
109
104
  }
110
105
 
111
106
  declare enum RichValue_NullValue {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-6XHWJ2VS.js";
6
6
  import {
7
7
  setupLogger
8
- } from "./chunk-2LXJZQSF.js";
8
+ } from "./chunk-DPHTMNDV.js";
9
9
  import {
10
10
  DataBindingContext,
11
11
  DiagConsoleLogger,
@@ -30,6 +30,7 @@ import {
30
30
  errorString,
31
31
  es_exports,
32
32
  esm_exports,
33
+ freezeGlobalConfig,
33
34
  from,
34
35
  init_es,
35
36
  init_esm,
@@ -50,11 +51,10 @@ import {
50
51
  require_src,
51
52
  trace,
52
53
  withAbort
53
- } from "./chunk-XIU7XZT7.js";
54
+ } from "./chunk-NVBA53K5.js";
54
55
  import {
55
56
  ExecutionConfig,
56
57
  HandlerType,
57
- InitResponse,
58
58
  PluginManager,
59
59
  ProcessConfigResponse,
60
60
  ProcessResult,
@@ -68,7 +68,7 @@ import {
68
68
  __toCommonJS,
69
69
  __toESM,
70
70
  require_minimal2 as require_minimal
71
- } from "./chunk-J4QKUO6L.js";
71
+ } from "./chunk-4M76KZSL.js";
72
72
 
73
73
  // ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.25.1/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js
74
74
  // @__NO_SIDE_EFFECTS__
@@ -12974,19 +12974,19 @@ var require_root = __commonJS({
12974
12974
  return Span2;
12975
12975
  }();
12976
12976
  v1.Status = function() {
12977
- function Status(properties) {
12977
+ function Status2(properties) {
12978
12978
  if (properties) {
12979
12979
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
12980
12980
  if (properties[keys[i]] != null)
12981
12981
  this[keys[i]] = properties[keys[i]];
12982
12982
  }
12983
12983
  }
12984
- Status.prototype.message = null;
12985
- Status.prototype.code = null;
12986
- Status.create = function create(properties) {
12987
- return new Status(properties);
12984
+ Status2.prototype.message = null;
12985
+ Status2.prototype.code = null;
12986
+ Status2.create = function create(properties) {
12987
+ return new Status2(properties);
12988
12988
  };
12989
- Status.encode = function encode(message, writer) {
12989
+ Status2.encode = function encode(message, writer) {
12990
12990
  if (!writer)
12991
12991
  writer = $Writer.create();
12992
12992
  if (message.message != null && Object.hasOwnProperty.call(message, "message"))
@@ -13001,10 +13001,10 @@ var require_root = __commonJS({
13001
13001
  ).int32(message.code);
13002
13002
  return writer;
13003
13003
  };
13004
- Status.encodeDelimited = function encodeDelimited(message, writer) {
13004
+ Status2.encodeDelimited = function encodeDelimited(message, writer) {
13005
13005
  return this.encode(message, writer).ldelim();
13006
13006
  };
13007
- Status.decode = function decode(reader, length) {
13007
+ Status2.decode = function decode(reader, length) {
13008
13008
  if (!(reader instanceof $Reader))
13009
13009
  reader = $Reader.create(reader);
13010
13010
  var end = length === void 0 ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Status();
@@ -13026,12 +13026,12 @@ var require_root = __commonJS({
13026
13026
  }
13027
13027
  return message;
13028
13028
  };
13029
- Status.decodeDelimited = function decodeDelimited(reader) {
13029
+ Status2.decodeDelimited = function decodeDelimited(reader) {
13030
13030
  if (!(reader instanceof $Reader))
13031
13031
  reader = new $Reader(reader);
13032
13032
  return this.decode(reader, reader.uint32());
13033
13033
  };
13034
- Status.verify = function verify(message) {
13034
+ Status2.verify = function verify(message) {
13035
13035
  if (typeof message !== "object" || message === null)
13036
13036
  return "object expected";
13037
13037
  if (message.message != null && message.hasOwnProperty("message")) {
@@ -13049,7 +13049,7 @@ var require_root = __commonJS({
13049
13049
  }
13050
13050
  return null;
13051
13051
  };
13052
- Status.fromObject = function fromObject(object) {
13052
+ Status2.fromObject = function fromObject(object) {
13053
13053
  if (object instanceof $root.opentelemetry.proto.trace.v1.Status)
13054
13054
  return object;
13055
13055
  var message = new $root.opentelemetry.proto.trace.v1.Status();
@@ -13077,7 +13077,7 @@ var require_root = __commonJS({
13077
13077
  }
13078
13078
  return message;
13079
13079
  };
13080
- Status.toObject = function toObject(message, options2) {
13080
+ Status2.toObject = function toObject(message, options2) {
13081
13081
  if (!options2)
13082
13082
  options2 = {};
13083
13083
  var object = {};
@@ -13091,23 +13091,23 @@ var require_root = __commonJS({
13091
13091
  object.code = options2.enums === String ? $root.opentelemetry.proto.trace.v1.Status.StatusCode[message.code] === void 0 ? message.code : $root.opentelemetry.proto.trace.v1.Status.StatusCode[message.code] : message.code;
13092
13092
  return object;
13093
13093
  };
13094
- Status.prototype.toJSON = function toJSON() {
13094
+ Status2.prototype.toJSON = function toJSON() {
13095
13095
  return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
13096
13096
  };
13097
- Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
13097
+ Status2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
13098
13098
  if (typeUrlPrefix === void 0) {
13099
13099
  typeUrlPrefix = "type.googleapis.com";
13100
13100
  }
13101
13101
  return typeUrlPrefix + "/opentelemetry.proto.trace.v1.Status";
13102
13102
  };
13103
- Status.StatusCode = function() {
13103
+ Status2.StatusCode = function() {
13104
13104
  var valuesById = {}, values = Object.create(valuesById);
13105
13105
  values[valuesById[0] = "STATUS_CODE_UNSET"] = 0;
13106
13106
  values[valuesById[1] = "STATUS_CODE_OK"] = 1;
13107
13107
  values[valuesById[2] = "STATUS_CODE_ERROR"] = 2;
13108
13108
  return values;
13109
13109
  }();
13110
- return Status;
13110
+ return Status2;
13111
13111
  }();
13112
13112
  return v1;
13113
13113
  }();
@@ -25953,7 +25953,7 @@ function commandLineArgs(optionDefinitions2, options2) {
25953
25953
  var command_line_args_default = commandLineArgs;
25954
25954
 
25955
25955
  // src/processor-runner.ts
25956
- var import_nice_grpc = __toESM(require_lib3(), 1);
25956
+ var import_nice_grpc2 = __toESM(require_lib3(), 1);
25957
25957
  var import_nice_grpc_error_details = __toESM(require_lib4(), 1);
25958
25958
  var import_nice_grpc_opentelemetry = __toESM(require_lib5(), 1);
25959
25959
  import http2 from "http";
@@ -26238,13 +26238,11 @@ var FullProcessorServiceV3Impl = class {
26238
26238
  this.instance = instance;
26239
26239
  }
26240
26240
  patcher = new RuntimeServicePatcher();
26241
- async init(request3, context2) {
26242
- const resp = await this.instance.init(request3, context2);
26243
- resp.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution);
26244
- return resp;
26241
+ async start(request3, context2) {
26242
+ return this.instance.start(request3, context2);
26245
26243
  }
26246
- async configureHandlers(request3, context2) {
26247
- const config = await this.instance.configureHandlers(request3, context2);
26244
+ async getConfig(request3, context2) {
26245
+ const config = await this.instance.getConfig(request3, context2);
26248
26246
  this.patcher.patchConfig(config);
26249
26247
  return config;
26250
26248
  }
@@ -26257,6 +26255,9 @@ var FullProcessorServiceV3Impl = class {
26257
26255
  yield request3;
26258
26256
  }
26259
26257
  }
26258
+ async updateTemplates(request3, context2) {
26259
+ return this.instance.updateTemplates(request3, context2);
26260
+ }
26260
26261
  };
26261
26262
  import("node:process").then((p) => p.stdout.write(""));
26262
26263
 
@@ -26487,25 +26488,40 @@ import("node:process").then((p) => p.stdout.write(""));
26487
26488
  import path2 from "path";
26488
26489
 
26489
26490
  // src/service-v3.ts
26491
+ var import_nice_grpc = __toESM(require_lib3(), 1);
26490
26492
  var import_rxjs = __toESM(require_cjs(), 1);
26491
26493
  var { process_binding_count, process_binding_time, process_binding_error } = processMetrics;
26492
26494
  var ProcessorServiceImplV3 = class {
26493
26495
  enablePartition;
26494
26496
  loader;
26495
26497
  shutdownHandler;
26498
+ started = false;
26496
26499
  constructor(loader2, options2, shutdownHandler) {
26497
26500
  this.loader = loader2;
26498
26501
  this.shutdownHandler = shutdownHandler;
26499
26502
  this.enablePartition = options2?.["enable-partition"] == true;
26500
26503
  }
26501
- async init(request3, context2) {
26502
- await this.loader();
26503
- const resp = InitResponse.fromPartial({
26504
- chainIds: []
26505
- });
26506
- await PluginManager.INSTANCE.init(resp);
26507
- resp.chainIds = Array.from(new Set(resp.chainIds));
26508
- return resp;
26504
+ async start(request3, context2) {
26505
+ if (this.started) {
26506
+ return {};
26507
+ }
26508
+ freezeGlobalConfig();
26509
+ try {
26510
+ await this.loader();
26511
+ } catch (e) {
26512
+ throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Failed to load processor: " + errorString(e));
26513
+ }
26514
+ await PluginManager.INSTANCE.start(request3);
26515
+ this.started = true;
26516
+ return {};
26517
+ }
26518
+ async getConfig(request3, context2) {
26519
+ if (!this.started) {
26520
+ throw new import_nice_grpc.ServerError(import_nice_grpc.Status.UNAVAILABLE, "Service Not started.");
26521
+ }
26522
+ const newConfig = ProcessConfigResponse.fromPartial({});
26523
+ await PluginManager.INSTANCE.configure(newConfig);
26524
+ return newConfig;
26509
26525
  }
26510
26526
  async *processBindingsStream(requests, context2) {
26511
26527
  const subject = new import_rxjs.Subject();
@@ -26620,18 +26636,9 @@ var ProcessorServiceImplV3 = class {
26620
26636
  console.debug("process binding done", processId);
26621
26637
  });
26622
26638
  }
26623
- async configureHandlers(request3, context2) {
26624
- await PluginManager.INSTANCE.start(
26625
- StartRequest.fromPartial({
26626
- templateInstances: request3.templateInstances
26627
- })
26628
- );
26629
- const newConfig = ProcessConfigResponse.fromPartial({});
26630
- await PluginManager.INSTANCE.configure(newConfig, request3.chainId);
26631
- return {
26632
- accountConfigs: newConfig.accountConfigs,
26633
- contractConfigs: newConfig.contractConfigs
26634
- };
26639
+ async updateTemplates(request3, context2) {
26640
+ await PluginManager.INSTANCE.updateTemplates(request3);
26641
+ return {};
26635
26642
  }
26636
26643
  };
26637
26644
  var Contexts2 = class {
@@ -26705,7 +26712,7 @@ if (options["start-action-server"]) {
26705
26712
  server = new ActionServer(loader);
26706
26713
  server.listen(options.port);
26707
26714
  } else {
26708
- server = (0, import_nice_grpc.createServer)({
26715
+ server = (0, import_nice_grpc2.createServer)({
26709
26716
  "grpc.max_send_message_length": 768 * 1024 * 1024,
26710
26717
  "grpc.max_receive_message_length": 768 * 1024 * 1024,
26711
26718
  "grpc.default_compression_algorithm": import_grpc_js.compressionAlgorithms.gzip