@sentio/runtime 3.0.0-rc.1 → 3.0.0-rc.10

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.
@@ -10,8 +10,8 @@ import {
10
10
  require_cjs,
11
11
  require_lib3 as require_lib,
12
12
  require_lib4 as require_lib2
13
- } from "./chunk-3QIPRNAH.js";
14
- import "./chunk-OFR7W4ZG.js";
13
+ } from "./chunk-AFB5F2CR.js";
14
+ import "./chunk-ROBPWJIE.js";
15
15
  import "./chunk-MV6JXS2P.js";
16
16
  import {
17
17
  __toESM
@@ -1,4 +1,4 @@
1
- import { P as Plugin, D as DataBinding, a as ProcessResult, H as HandlerType } from './processor-CIR4erWa.js';
1
+ import { P as Plugin, D as DataBinding, a as ProcessResult, H as HandlerType } from './processor-BUTmbpmJ.js';
2
2
  import { ProcessStreamResponse_Partitions, InitResponse, ProcessConfigResponse } from '@sentio/protos';
3
3
  import 'rxjs';
4
4
  import 'node:async_hooks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/db-context.ts CHANGED
@@ -42,7 +42,7 @@ export interface IStoreContext {
42
42
  }
43
43
 
44
44
  export interface IDataBindingContext extends IStoreContext {
45
- sendTemplateRequest(templates: Array<TemplateInstance>): void
45
+ sendTemplateRequest(templates: Array<TemplateInstance>, unbind: boolean): void
46
46
  sendTimeseriesRequest(timeseries: Array<TimeseriesResult>): void
47
47
  }
48
48
 
@@ -253,7 +253,7 @@ export class StoreContext extends AbstractStoreContext {
253
253
  }
254
254
  }
255
255
 
256
- // for service v2
256
+ // for service v3
257
257
  export class DataBindingContext extends AbstractStoreContext implements IDataBindingContext {
258
258
  constructor(
259
259
  readonly processId: number,
@@ -262,11 +262,12 @@ export class DataBindingContext extends AbstractStoreContext implements IDataBin
262
262
  super(processId)
263
263
  }
264
264
 
265
- sendTemplateRequest(templates: Array<TemplateInstance>) {
265
+ sendTemplateRequest(templates: Array<TemplateInstance>, unbind: boolean) {
266
266
  this.subject.next({
267
267
  processId: this.processId,
268
268
  tplRequest: {
269
- templates
269
+ templates,
270
+ remove: unbind
270
271
  }
271
272
  })
272
273
  }
@@ -1062,6 +1062,7 @@ export interface EntityUpdateData_FieldsEntry {
1062
1062
 
1063
1063
  export interface TPLRequest {
1064
1064
  templates: TemplateInstance[];
1065
+ remove: boolean;
1065
1066
  }
1066
1067
 
1067
1068
  export interface TSRequest {
@@ -8749,7 +8750,7 @@ export const EntityUpdateData_FieldsEntry = {
8749
8750
  };
8750
8751
 
8751
8752
  function createBaseTPLRequest(): TPLRequest {
8752
- return { templates: [] };
8753
+ return { templates: [], remove: false };
8753
8754
  }
8754
8755
 
8755
8756
  export const TPLRequest = {
@@ -8757,6 +8758,9 @@ export const TPLRequest = {
8757
8758
  for (const v of message.templates) {
8758
8759
  TemplateInstance.encode(v!, writer.uint32(10).fork()).ldelim();
8759
8760
  }
8761
+ if (message.remove !== false) {
8762
+ writer.uint32(16).bool(message.remove);
8763
+ }
8760
8764
  return writer;
8761
8765
  },
8762
8766
 
@@ -8774,6 +8778,13 @@ export const TPLRequest = {
8774
8778
 
8775
8779
  message.templates.push(TemplateInstance.decode(reader, reader.uint32()));
8776
8780
  continue;
8781
+ case 2:
8782
+ if (tag !== 16) {
8783
+ break;
8784
+ }
8785
+
8786
+ message.remove = reader.bool();
8787
+ continue;
8777
8788
  }
8778
8789
  if ((tag & 7) === 4 || tag === 0) {
8779
8790
  break;
@@ -8788,6 +8799,7 @@ export const TPLRequest = {
8788
8799
  templates: globalThis.Array.isArray(object?.templates)
8789
8800
  ? object.templates.map((e: any) => TemplateInstance.fromJSON(e))
8790
8801
  : [],
8802
+ remove: isSet(object.remove) ? globalThis.Boolean(object.remove) : false,
8791
8803
  };
8792
8804
  },
8793
8805
 
@@ -8796,6 +8808,9 @@ export const TPLRequest = {
8796
8808
  if (message.templates?.length) {
8797
8809
  obj.templates = message.templates.map((e) => TemplateInstance.toJSON(e));
8798
8810
  }
8811
+ if (message.remove !== false) {
8812
+ obj.remove = message.remove;
8813
+ }
8799
8814
  return obj;
8800
8815
  },
8801
8816
 
@@ -8805,6 +8820,7 @@ export const TPLRequest = {
8805
8820
  fromPartial(object: DeepPartial<TPLRequest>): TPLRequest {
8806
8821
  const message = createBaseTPLRequest();
8807
8822
  message.templates = object.templates?.map((e) => TemplateInstance.fromPartial(e)) || [];
8823
+ message.remove = object.remove ?? false;
8808
8824
  return message;
8809
8825
  },
8810
8826
  };
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable */
2
2
  import Long from "long";
3
3
  import _m0 from "protobufjs/minimal.js";
4
- import { Struct } from "../../../google/protobuf/struct.js";
4
+ import { ListValue, Struct } from "../../../google/protobuf/struct.js";
5
5
  import { Timestamp } from "../../../google/protobuf/timestamp.js";
6
6
  import { Money } from "../../../google/type/money.js";
7
7
 
@@ -311,6 +311,45 @@ export function notificationTypeToJSON(object: NotificationType): string {
311
311
  }
312
312
  }
313
313
 
314
+ export enum ChatType {
315
+ CHAT_TYPE_UNSPECIFIED = 0,
316
+ CHAT_TYPE_CHAT = 1,
317
+ CHAT_TYPE_ACTION = 2,
318
+ UNRECOGNIZED = -1,
319
+ }
320
+
321
+ export function chatTypeFromJSON(object: any): ChatType {
322
+ switch (object) {
323
+ case 0:
324
+ case "CHAT_TYPE_UNSPECIFIED":
325
+ return ChatType.CHAT_TYPE_UNSPECIFIED;
326
+ case 1:
327
+ case "CHAT_TYPE_CHAT":
328
+ return ChatType.CHAT_TYPE_CHAT;
329
+ case 2:
330
+ case "CHAT_TYPE_ACTION":
331
+ return ChatType.CHAT_TYPE_ACTION;
332
+ case -1:
333
+ case "UNRECOGNIZED":
334
+ default:
335
+ return ChatType.UNRECOGNIZED;
336
+ }
337
+ }
338
+
339
+ export function chatTypeToJSON(object: ChatType): string {
340
+ switch (object) {
341
+ case ChatType.CHAT_TYPE_UNSPECIFIED:
342
+ return "CHAT_TYPE_UNSPECIFIED";
343
+ case ChatType.CHAT_TYPE_CHAT:
344
+ return "CHAT_TYPE_CHAT";
345
+ case ChatType.CHAT_TYPE_ACTION:
346
+ return "CHAT_TYPE_ACTION";
347
+ case ChatType.UNRECOGNIZED:
348
+ default:
349
+ return "UNRECOGNIZED";
350
+ }
351
+ }
352
+
314
353
  export interface UsageTracker {
315
354
  apiSku: string;
316
355
  webuiSku: string;
@@ -412,6 +451,8 @@ export interface User {
412
451
  accountStatus: User_AccountStatus;
413
452
  tier: Tier;
414
453
  isOrganization: boolean;
454
+ walletAddress: string;
455
+ identities: string[];
415
456
  }
416
457
 
417
458
  export enum User_AccountStatus {
@@ -2050,6 +2091,23 @@ export interface RequestLog {
2050
2091
  chainId: string;
2051
2092
  }
2052
2093
 
2094
+ export interface HistoryChat {
2095
+ id: string;
2096
+ title: string;
2097
+ messages: Array<any> | undefined;
2098
+ type: ChatType;
2099
+ meta: { [key: string]: any } | undefined;
2100
+ createdAt: Date | undefined;
2101
+ updatedAt: Date | undefined;
2102
+ projectOwner?: string | undefined;
2103
+ projectSlug?: string | undefined;
2104
+ }
2105
+
2106
+ export interface ProjectOwnerAndSlug {
2107
+ ownerName: string;
2108
+ slug: string;
2109
+ }
2110
+
2053
2111
  function createBaseUsageTracker(): UsageTracker {
2054
2112
  return {
2055
2113
  apiSku: "",
@@ -2796,6 +2854,8 @@ function createBaseUser(): User {
2796
2854
  accountStatus: 0,
2797
2855
  tier: 0,
2798
2856
  isOrganization: false,
2857
+ walletAddress: "",
2858
+ identities: [],
2799
2859
  };
2800
2860
  }
2801
2861
 
@@ -2852,6 +2912,12 @@ export const User = {
2852
2912
  if (message.isOrganization !== false) {
2853
2913
  writer.uint32(128).bool(message.isOrganization);
2854
2914
  }
2915
+ if (message.walletAddress !== "") {
2916
+ writer.uint32(138).string(message.walletAddress);
2917
+ }
2918
+ for (const v of message.identities) {
2919
+ writer.uint32(146).string(v!);
2920
+ }
2855
2921
  return writer;
2856
2922
  },
2857
2923
 
@@ -2967,6 +3033,20 @@ export const User = {
2967
3033
 
2968
3034
  message.isOrganization = reader.bool();
2969
3035
  continue;
3036
+ case 17:
3037
+ if (tag !== 138) {
3038
+ break;
3039
+ }
3040
+
3041
+ message.walletAddress = reader.string();
3042
+ continue;
3043
+ case 18:
3044
+ if (tag !== 146) {
3045
+ break;
3046
+ }
3047
+
3048
+ message.identities.push(reader.string());
3049
+ continue;
2970
3050
  }
2971
3051
  if ((tag & 7) === 4 || tag === 0) {
2972
3052
  break;
@@ -2993,6 +3073,10 @@ export const User = {
2993
3073
  accountStatus: isSet(object.accountStatus) ? user_AccountStatusFromJSON(object.accountStatus) : 0,
2994
3074
  tier: isSet(object.tier) ? tierFromJSON(object.tier) : 0,
2995
3075
  isOrganization: isSet(object.isOrganization) ? globalThis.Boolean(object.isOrganization) : false,
3076
+ walletAddress: isSet(object.walletAddress) ? globalThis.String(object.walletAddress) : "",
3077
+ identities: globalThis.Array.isArray(object?.identities)
3078
+ ? object.identities.map((e: any) => globalThis.String(e))
3079
+ : [],
2996
3080
  };
2997
3081
  },
2998
3082
 
@@ -3043,6 +3127,12 @@ export const User = {
3043
3127
  if (message.isOrganization !== false) {
3044
3128
  obj.isOrganization = message.isOrganization;
3045
3129
  }
3130
+ if (message.walletAddress !== "") {
3131
+ obj.walletAddress = message.walletAddress;
3132
+ }
3133
+ if (message.identities?.length) {
3134
+ obj.identities = message.identities;
3135
+ }
3046
3136
  return obj;
3047
3137
  },
3048
3138
 
@@ -3066,6 +3156,8 @@ export const User = {
3066
3156
  message.accountStatus = object.accountStatus ?? 0;
3067
3157
  message.tier = object.tier ?? 0;
3068
3158
  message.isOrganization = object.isOrganization ?? false;
3159
+ message.walletAddress = object.walletAddress ?? "";
3160
+ message.identities = object.identities?.map((e) => e) || [];
3069
3161
  return message;
3070
3162
  },
3071
3163
  };
@@ -14695,6 +14787,269 @@ export const RequestLog = {
14695
14787
  },
14696
14788
  };
14697
14789
 
14790
+ function createBaseHistoryChat(): HistoryChat {
14791
+ return {
14792
+ id: "",
14793
+ title: "",
14794
+ messages: undefined,
14795
+ type: 0,
14796
+ meta: undefined,
14797
+ createdAt: undefined,
14798
+ updatedAt: undefined,
14799
+ projectOwner: undefined,
14800
+ projectSlug: undefined,
14801
+ };
14802
+ }
14803
+
14804
+ export const HistoryChat = {
14805
+ encode(message: HistoryChat, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
14806
+ if (message.id !== "") {
14807
+ writer.uint32(10).string(message.id);
14808
+ }
14809
+ if (message.title !== "") {
14810
+ writer.uint32(18).string(message.title);
14811
+ }
14812
+ if (message.messages !== undefined) {
14813
+ ListValue.encode(ListValue.wrap(message.messages), writer.uint32(34).fork()).ldelim();
14814
+ }
14815
+ if (message.type !== 0) {
14816
+ writer.uint32(40).int32(message.type);
14817
+ }
14818
+ if (message.meta !== undefined) {
14819
+ Struct.encode(Struct.wrap(message.meta), writer.uint32(50).fork()).ldelim();
14820
+ }
14821
+ if (message.createdAt !== undefined) {
14822
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim();
14823
+ }
14824
+ if (message.updatedAt !== undefined) {
14825
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).ldelim();
14826
+ }
14827
+ if (message.projectOwner !== undefined) {
14828
+ writer.uint32(74).string(message.projectOwner);
14829
+ }
14830
+ if (message.projectSlug !== undefined) {
14831
+ writer.uint32(82).string(message.projectSlug);
14832
+ }
14833
+ return writer;
14834
+ },
14835
+
14836
+ decode(input: _m0.Reader | Uint8Array, length?: number): HistoryChat {
14837
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
14838
+ let end = length === undefined ? reader.len : reader.pos + length;
14839
+ const message = createBaseHistoryChat();
14840
+ while (reader.pos < end) {
14841
+ const tag = reader.uint32();
14842
+ switch (tag >>> 3) {
14843
+ case 1:
14844
+ if (tag !== 10) {
14845
+ break;
14846
+ }
14847
+
14848
+ message.id = reader.string();
14849
+ continue;
14850
+ case 2:
14851
+ if (tag !== 18) {
14852
+ break;
14853
+ }
14854
+
14855
+ message.title = reader.string();
14856
+ continue;
14857
+ case 4:
14858
+ if (tag !== 34) {
14859
+ break;
14860
+ }
14861
+
14862
+ message.messages = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
14863
+ continue;
14864
+ case 5:
14865
+ if (tag !== 40) {
14866
+ break;
14867
+ }
14868
+
14869
+ message.type = reader.int32() as any;
14870
+ continue;
14871
+ case 6:
14872
+ if (tag !== 50) {
14873
+ break;
14874
+ }
14875
+
14876
+ message.meta = Struct.unwrap(Struct.decode(reader, reader.uint32()));
14877
+ continue;
14878
+ case 7:
14879
+ if (tag !== 58) {
14880
+ break;
14881
+ }
14882
+
14883
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
14884
+ continue;
14885
+ case 8:
14886
+ if (tag !== 66) {
14887
+ break;
14888
+ }
14889
+
14890
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
14891
+ continue;
14892
+ case 9:
14893
+ if (tag !== 74) {
14894
+ break;
14895
+ }
14896
+
14897
+ message.projectOwner = reader.string();
14898
+ continue;
14899
+ case 10:
14900
+ if (tag !== 82) {
14901
+ break;
14902
+ }
14903
+
14904
+ message.projectSlug = reader.string();
14905
+ continue;
14906
+ }
14907
+ if ((tag & 7) === 4 || tag === 0) {
14908
+ break;
14909
+ }
14910
+ reader.skipType(tag & 7);
14911
+ }
14912
+ return message;
14913
+ },
14914
+
14915
+ fromJSON(object: any): HistoryChat {
14916
+ return {
14917
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
14918
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
14919
+ messages: globalThis.Array.isArray(object.messages) ? [...object.messages] : undefined,
14920
+ type: isSet(object.type) ? chatTypeFromJSON(object.type) : 0,
14921
+ meta: isObject(object.meta) ? object.meta : undefined,
14922
+ createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
14923
+ updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
14924
+ projectOwner: isSet(object.projectOwner) ? globalThis.String(object.projectOwner) : undefined,
14925
+ projectSlug: isSet(object.projectSlug) ? globalThis.String(object.projectSlug) : undefined,
14926
+ };
14927
+ },
14928
+
14929
+ toJSON(message: HistoryChat): unknown {
14930
+ const obj: any = {};
14931
+ if (message.id !== "") {
14932
+ obj.id = message.id;
14933
+ }
14934
+ if (message.title !== "") {
14935
+ obj.title = message.title;
14936
+ }
14937
+ if (message.messages !== undefined) {
14938
+ obj.messages = message.messages;
14939
+ }
14940
+ if (message.type !== 0) {
14941
+ obj.type = chatTypeToJSON(message.type);
14942
+ }
14943
+ if (message.meta !== undefined) {
14944
+ obj.meta = message.meta;
14945
+ }
14946
+ if (message.createdAt !== undefined) {
14947
+ obj.createdAt = message.createdAt.toISOString();
14948
+ }
14949
+ if (message.updatedAt !== undefined) {
14950
+ obj.updatedAt = message.updatedAt.toISOString();
14951
+ }
14952
+ if (message.projectOwner !== undefined) {
14953
+ obj.projectOwner = message.projectOwner;
14954
+ }
14955
+ if (message.projectSlug !== undefined) {
14956
+ obj.projectSlug = message.projectSlug;
14957
+ }
14958
+ return obj;
14959
+ },
14960
+
14961
+ create(base?: DeepPartial<HistoryChat>): HistoryChat {
14962
+ return HistoryChat.fromPartial(base ?? {});
14963
+ },
14964
+ fromPartial(object: DeepPartial<HistoryChat>): HistoryChat {
14965
+ const message = createBaseHistoryChat();
14966
+ message.id = object.id ?? "";
14967
+ message.title = object.title ?? "";
14968
+ message.messages = object.messages ?? undefined;
14969
+ message.type = object.type ?? 0;
14970
+ message.meta = object.meta ?? undefined;
14971
+ message.createdAt = object.createdAt ?? undefined;
14972
+ message.updatedAt = object.updatedAt ?? undefined;
14973
+ message.projectOwner = object.projectOwner ?? undefined;
14974
+ message.projectSlug = object.projectSlug ?? undefined;
14975
+ return message;
14976
+ },
14977
+ };
14978
+
14979
+ function createBaseProjectOwnerAndSlug(): ProjectOwnerAndSlug {
14980
+ return { ownerName: "", slug: "" };
14981
+ }
14982
+
14983
+ export const ProjectOwnerAndSlug = {
14984
+ encode(message: ProjectOwnerAndSlug, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
14985
+ if (message.ownerName !== "") {
14986
+ writer.uint32(10).string(message.ownerName);
14987
+ }
14988
+ if (message.slug !== "") {
14989
+ writer.uint32(18).string(message.slug);
14990
+ }
14991
+ return writer;
14992
+ },
14993
+
14994
+ decode(input: _m0.Reader | Uint8Array, length?: number): ProjectOwnerAndSlug {
14995
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
14996
+ let end = length === undefined ? reader.len : reader.pos + length;
14997
+ const message = createBaseProjectOwnerAndSlug();
14998
+ while (reader.pos < end) {
14999
+ const tag = reader.uint32();
15000
+ switch (tag >>> 3) {
15001
+ case 1:
15002
+ if (tag !== 10) {
15003
+ break;
15004
+ }
15005
+
15006
+ message.ownerName = reader.string();
15007
+ continue;
15008
+ case 2:
15009
+ if (tag !== 18) {
15010
+ break;
15011
+ }
15012
+
15013
+ message.slug = reader.string();
15014
+ continue;
15015
+ }
15016
+ if ((tag & 7) === 4 || tag === 0) {
15017
+ break;
15018
+ }
15019
+ reader.skipType(tag & 7);
15020
+ }
15021
+ return message;
15022
+ },
15023
+
15024
+ fromJSON(object: any): ProjectOwnerAndSlug {
15025
+ return {
15026
+ ownerName: isSet(object.ownerName) ? globalThis.String(object.ownerName) : "",
15027
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
15028
+ };
15029
+ },
15030
+
15031
+ toJSON(message: ProjectOwnerAndSlug): unknown {
15032
+ const obj: any = {};
15033
+ if (message.ownerName !== "") {
15034
+ obj.ownerName = message.ownerName;
15035
+ }
15036
+ if (message.slug !== "") {
15037
+ obj.slug = message.slug;
15038
+ }
15039
+ return obj;
15040
+ },
15041
+
15042
+ create(base?: DeepPartial<ProjectOwnerAndSlug>): ProjectOwnerAndSlug {
15043
+ return ProjectOwnerAndSlug.fromPartial(base ?? {});
15044
+ },
15045
+ fromPartial(object: DeepPartial<ProjectOwnerAndSlug>): ProjectOwnerAndSlug {
15046
+ const message = createBaseProjectOwnerAndSlug();
15047
+ message.ownerName = object.ownerName ?? "";
15048
+ message.slug = object.slug ?? "";
15049
+ return message;
15050
+ },
15051
+ };
15052
+
14698
15053
  function bytesFromBase64(b64: string): Uint8Array {
14699
15054
  if ((globalThis as any).Buffer) {
14700
15055
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
package/src/plugin.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  StartRequest,
11
11
  UpdateTemplatesRequest
12
12
  } from '@sentio/protos'
13
- import { IStoreContext, StoreContext } from './db-context.js'
13
+ import { IDataBindingContext, IStoreContext } from './db-context.js'
14
14
  import { AsyncLocalStorage } from 'node:async_hooks'
15
15
 
16
16
  export abstract class Plugin {
@@ -65,7 +65,7 @@ export abstract class Plugin {
65
65
  export class PluginManager {
66
66
  static INSTANCE = new PluginManager()
67
67
 
68
- dbContextLocalStorage = new AsyncLocalStorage<IStoreContext | undefined>()
68
+ dbContextLocalStorage = new AsyncLocalStorage<IDataBindingContext | IStoreContext | undefined>()
69
69
  plugins: Plugin[] = []
70
70
  typesToPlugin = new Map<HandlerType, Plugin>()
71
71
 
@@ -112,7 +112,7 @@ export class PluginManager {
112
112
  processBinding(
113
113
  request: DataBinding,
114
114
  preparedData: PreparedData | undefined,
115
- dbContext?: IStoreContext
115
+ dbContext?: IDataBindingContext | IStoreContext
116
116
  ): Promise<ProcessResult> {
117
117
  const plugin = this.typesToPlugin.get(request.handlerType)
118
118
  if (!plugin) {
@@ -134,7 +134,7 @@ export class PluginManager {
134
134
  preprocessBinding(
135
135
  request: DataBinding,
136
136
  preprocessStore: { [k: string]: any },
137
- dbContext?: StoreContext
137
+ dbContext?: IDataBindingContext | IStoreContext
138
138
  ): Promise<PreprocessResult> {
139
139
  const plugin = this.typesToPlugin.get(request.handlerType)
140
140
  if (!plugin) {
@@ -15,7 +15,6 @@ import { Subject } from 'rxjs'
15
15
 
16
16
  import { MessageChannel } from 'node:worker_threads'
17
17
  import { ProcessorServiceImpl } from './service.js'
18
- import { TemplateInstanceState } from './state.js'
19
18
  import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
20
19
  ;(BigInt.prototype as any).toJSON = function () {
21
20
  return this.toString()
@@ -140,13 +139,6 @@ export class ServiceManager extends ProcessorServiceImpl {
140
139
  argv: process.argv,
141
140
  workerData: this.workerData
142
141
  })
143
- // @ts-ignore - Piscina message handling for template instance sync
144
- this.pool.on('message', (msg: any) => {
145
- if (msg.event == 'add_template_instance') {
146
- // sync the template state from worker to the main thread
147
- TemplateInstanceState.INSTANCE.addValue(msg.value)
148
- }
149
- })
150
142
  }
151
143
  }
152
144
 
package/src/service-v3.ts CHANGED
@@ -24,7 +24,6 @@ import { errorString } from './utils.js'
24
24
  import { processMetrics } from './metrics.js'
25
25
  import { recordRuntimeInfo } from './service.js'
26
26
  import { DataBindingContext } from './db-context.js'
27
- import { TemplateInstanceState } from './state.js'
28
27
  import { freezeGlobalConfig } from './global-config.js'
29
28
  import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
30
29
 
@@ -182,7 +181,7 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
182
181
  })
183
182
  }
184
183
 
185
- if (result.states?.configUpdated) {
184
+ /* if (result.states?.configUpdated) {
186
185
  console.debug('sending tpl updates:')
187
186
  subject.next({
188
187
  processId,
@@ -190,7 +189,7 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
190
189
  templates: TemplateInstanceState.INSTANCE.getValues()
191
190
  }
192
191
  })
193
- }
192
+ }*/
194
193
 
195
194
  console.debug('sending binding result', processId)
196
195
  subject.next({
package/src/state.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { TemplateInstance } from '@sentio/protos'
2
- import { isMainThread, parentPort, threadId } from 'node:worker_threads'
3
-
4
1
  export class State {
5
2
  stateMap = new Map<string, any>()
6
3
 
@@ -84,19 +81,3 @@ export abstract class ListStateStorage<T> extends StateStorage<T[]> {
84
81
  return value
85
82
  }
86
83
  }
87
-
88
- export class TemplateInstanceState extends ListStateStorage<TemplateInstance> {
89
- static INSTANCE = new TemplateInstanceState()
90
-
91
- constructor() {
92
- super()
93
- }
94
-
95
- override addValue(value: TemplateInstance): TemplateInstance {
96
- if (!isMainThread) {
97
- // I'm worker thread, should notice the main thread
98
- parentPort?.postMessage({ event: 'add_template_instance', value, from: threadId })
99
- }
100
- return super.addValue(value)
101
- }
102
- }