@sentio/runtime 2.34.1 → 2.35.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.34.1",
3
+ "version": "2.35.0-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,10 +30,10 @@
30
30
  "protobufjs": "^7.2.6",
31
31
  "utility-types": "^3.11.0",
32
32
  "winston": "^3.11.0",
33
- "@sentio/protos": "2.34.1"
33
+ "@sentio/protos": "2.35.0-rc.1"
34
34
  },
35
35
  "peerDependencies": {
36
- "@sentio/sdk": "^2.34.1"
36
+ "@sentio/sdk": "^2.35.0-rc.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/command-line-args": "^5.2.3",
@@ -14,16 +14,17 @@ export const Empty = {
14
14
  },
15
15
 
16
16
  decode(input: _m0.Reader | Uint8Array, length?: number): Empty {
17
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
17
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
18
18
  let end = length === undefined ? reader.len : reader.pos + length;
19
19
  const message = createBaseEmpty();
20
20
  while (reader.pos < end) {
21
21
  const tag = reader.uint32();
22
22
  switch (tag >>> 3) {
23
- default:
24
- reader.skipType(tag & 7);
25
- break;
26
23
  }
24
+ if ((tag & 7) === 4 || tag === 0) {
25
+ break;
26
+ }
27
+ reader.skipType(tag & 7);
27
28
  }
28
29
  return message;
29
30
  },
@@ -40,16 +41,16 @@ export const Empty = {
40
41
  create(base?: DeepPartial<Empty>): Empty {
41
42
  return Empty.fromPartial(base ?? {});
42
43
  },
43
-
44
44
  fromPartial(_: DeepPartial<Empty>): Empty {
45
45
  const message = createBaseEmpty();
46
46
  return message;
47
47
  },
48
48
  };
49
49
 
50
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
50
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
51
51
 
52
52
  type DeepPartial<T> = T extends Builtin ? T
53
- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
53
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
54
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
54
55
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
55
56
  : Partial<T>;
@@ -65,22 +65,27 @@ export const Struct = {
65
65
  },
66
66
 
67
67
  decode(input: _m0.Reader | Uint8Array, length?: number): Struct {
68
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
68
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
69
69
  let end = length === undefined ? reader.len : reader.pos + length;
70
70
  const message = createBaseStruct();
71
71
  while (reader.pos < end) {
72
72
  const tag = reader.uint32();
73
73
  switch (tag >>> 3) {
74
74
  case 1:
75
+ if (tag !== 10) {
76
+ break;
77
+ }
78
+
75
79
  const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
76
80
  if (entry1.value !== undefined) {
77
81
  message.fields[entry1.key] = entry1.value;
78
82
  }
79
- break;
80
- default:
81
- reader.skipType(tag & 7);
82
- break;
83
+ continue;
83
84
  }
85
+ if ((tag & 7) === 4 || tag === 0) {
86
+ break;
87
+ }
88
+ reader.skipType(tag & 7);
84
89
  }
85
90
  return message;
86
91
  },
@@ -98,11 +103,14 @@ export const Struct = {
98
103
 
99
104
  toJSON(message: Struct): unknown {
100
105
  const obj: any = {};
101
- obj.fields = {};
102
106
  if (message.fields) {
103
- Object.entries(message.fields).forEach(([k, v]) => {
104
- obj.fields[k] = v;
105
- });
107
+ const entries = Object.entries(message.fields);
108
+ if (entries.length > 0) {
109
+ obj.fields = {};
110
+ entries.forEach(([k, v]) => {
111
+ obj.fields[k] = v;
112
+ });
113
+ }
106
114
  }
107
115
  return obj;
108
116
  },
@@ -110,7 +118,6 @@ export const Struct = {
110
118
  create(base?: DeepPartial<Struct>): Struct {
111
119
  return Struct.fromPartial(base ?? {});
112
120
  },
113
-
114
121
  fromPartial(object: DeepPartial<Struct>): Struct {
115
122
  const message = createBaseStruct();
116
123
  message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>(
@@ -127,10 +134,11 @@ export const Struct = {
127
134
 
128
135
  wrap(object: { [key: string]: any } | undefined): Struct {
129
136
  const struct = createBaseStruct();
137
+
130
138
  if (object !== undefined) {
131
- Object.keys(object).forEach((key) => {
139
+ for (const key of Object.keys(object)) {
132
140
  struct.fields[key] = object[key];
133
- });
141
+ }
134
142
  }
135
143
  return struct;
136
144
  },
@@ -138,9 +146,9 @@ export const Struct = {
138
146
  unwrap(message: Struct): { [key: string]: any } {
139
147
  const object: { [key: string]: any } = {};
140
148
  if (message.fields) {
141
- Object.keys(message.fields).forEach((key) => {
149
+ for (const key of Object.keys(message.fields)) {
142
150
  object[key] = message.fields[key];
143
- });
151
+ }
144
152
  }
145
153
  return object;
146
154
  },
@@ -162,41 +170,56 @@ export const Struct_FieldsEntry = {
162
170
  },
163
171
 
164
172
  decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry {
165
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
173
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
166
174
  let end = length === undefined ? reader.len : reader.pos + length;
167
175
  const message = createBaseStruct_FieldsEntry();
168
176
  while (reader.pos < end) {
169
177
  const tag = reader.uint32();
170
178
  switch (tag >>> 3) {
171
179
  case 1:
180
+ if (tag !== 10) {
181
+ break;
182
+ }
183
+
172
184
  message.key = reader.string();
173
- break;
185
+ continue;
174
186
  case 2:
187
+ if (tag !== 18) {
188
+ break;
189
+ }
190
+
175
191
  message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
176
- break;
177
- default:
178
- reader.skipType(tag & 7);
179
- break;
192
+ continue;
193
+ }
194
+ if ((tag & 7) === 4 || tag === 0) {
195
+ break;
180
196
  }
197
+ reader.skipType(tag & 7);
181
198
  }
182
199
  return message;
183
200
  },
184
201
 
185
202
  fromJSON(object: any): Struct_FieldsEntry {
186
- return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined };
203
+ return {
204
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
205
+ value: isSet(object?.value) ? object.value : undefined,
206
+ };
187
207
  },
188
208
 
189
209
  toJSON(message: Struct_FieldsEntry): unknown {
190
210
  const obj: any = {};
191
- message.key !== undefined && (obj.key = message.key);
192
- message.value !== undefined && (obj.value = message.value);
211
+ if (message.key !== "") {
212
+ obj.key = message.key;
213
+ }
214
+ if (message.value !== undefined) {
215
+ obj.value = message.value;
216
+ }
193
217
  return obj;
194
218
  },
195
219
 
196
220
  create(base?: DeepPartial<Struct_FieldsEntry>): Struct_FieldsEntry {
197
221
  return Struct_FieldsEntry.fromPartial(base ?? {});
198
222
  },
199
-
200
223
  fromPartial(object: DeepPartial<Struct_FieldsEntry>): Struct_FieldsEntry {
201
224
  const message = createBaseStruct_FieldsEntry();
202
225
  message.key = object.key ?? "";
@@ -240,34 +263,59 @@ export const Value = {
240
263
  },
241
264
 
242
265
  decode(input: _m0.Reader | Uint8Array, length?: number): Value {
243
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
266
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
244
267
  let end = length === undefined ? reader.len : reader.pos + length;
245
268
  const message = createBaseValue();
246
269
  while (reader.pos < end) {
247
270
  const tag = reader.uint32();
248
271
  switch (tag >>> 3) {
249
272
  case 1:
273
+ if (tag !== 8) {
274
+ break;
275
+ }
276
+
250
277
  message.nullValue = reader.int32() as any;
251
- break;
278
+ continue;
252
279
  case 2:
280
+ if (tag !== 17) {
281
+ break;
282
+ }
283
+
253
284
  message.numberValue = reader.double();
254
- break;
285
+ continue;
255
286
  case 3:
287
+ if (tag !== 26) {
288
+ break;
289
+ }
290
+
256
291
  message.stringValue = reader.string();
257
- break;
292
+ continue;
258
293
  case 4:
294
+ if (tag !== 32) {
295
+ break;
296
+ }
297
+
259
298
  message.boolValue = reader.bool();
260
- break;
299
+ continue;
261
300
  case 5:
301
+ if (tag !== 42) {
302
+ break;
303
+ }
304
+
262
305
  message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
263
- break;
306
+ continue;
264
307
  case 6:
308
+ if (tag !== 50) {
309
+ break;
310
+ }
311
+
265
312
  message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
266
- break;
267
- default:
268
- reader.skipType(tag & 7);
269
- break;
313
+ continue;
314
+ }
315
+ if ((tag & 7) === 4 || tag === 0) {
316
+ break;
270
317
  }
318
+ reader.skipType(tag & 7);
271
319
  }
272
320
  return message;
273
321
  },
@@ -275,30 +323,40 @@ export const Value = {
275
323
  fromJSON(object: any): Value {
276
324
  return {
277
325
  nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined,
278
- numberValue: isSet(object.numberValue) ? Number(object.numberValue) : undefined,
279
- stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined,
280
- boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined,
326
+ numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined,
327
+ stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined,
328
+ boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined,
281
329
  structValue: isObject(object.structValue) ? object.structValue : undefined,
282
- listValue: Array.isArray(object.listValue) ? [...object.listValue] : undefined,
330
+ listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : undefined,
283
331
  };
284
332
  },
285
333
 
286
334
  toJSON(message: Value): unknown {
287
335
  const obj: any = {};
288
- message.nullValue !== undefined &&
289
- (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined);
290
- message.numberValue !== undefined && (obj.numberValue = message.numberValue);
291
- message.stringValue !== undefined && (obj.stringValue = message.stringValue);
292
- message.boolValue !== undefined && (obj.boolValue = message.boolValue);
293
- message.structValue !== undefined && (obj.structValue = message.structValue);
294
- message.listValue !== undefined && (obj.listValue = message.listValue);
336
+ if (message.nullValue !== undefined) {
337
+ obj.nullValue = nullValueToJSON(message.nullValue);
338
+ }
339
+ if (message.numberValue !== undefined) {
340
+ obj.numberValue = message.numberValue;
341
+ }
342
+ if (message.stringValue !== undefined) {
343
+ obj.stringValue = message.stringValue;
344
+ }
345
+ if (message.boolValue !== undefined) {
346
+ obj.boolValue = message.boolValue;
347
+ }
348
+ if (message.structValue !== undefined) {
349
+ obj.structValue = message.structValue;
350
+ }
351
+ if (message.listValue !== undefined) {
352
+ obj.listValue = message.listValue;
353
+ }
295
354
  return obj;
296
355
  },
297
356
 
298
357
  create(base?: DeepPartial<Value>): Value {
299
358
  return Value.fromPartial(base ?? {});
300
359
  },
301
-
302
360
  fromPartial(object: DeepPartial<Value>): Value {
303
361
  const message = createBaseValue();
304
362
  message.nullValue = object.nullValue ?? undefined;
@@ -320,12 +378,12 @@ export const Value = {
320
378
  result.numberValue = value;
321
379
  } else if (typeof value === "string") {
322
380
  result.stringValue = value;
323
- } else if (Array.isArray(value)) {
381
+ } else if (globalThis.Array.isArray(value)) {
324
382
  result.listValue = value;
325
383
  } else if (typeof value === "object") {
326
384
  result.structValue = value;
327
385
  } else if (typeof value !== "undefined") {
328
- throw new Error("Unsupported any value type: " + typeof value);
386
+ throw new globalThis.Error("Unsupported any value type: " + typeof value);
329
387
  }
330
388
  return result;
331
389
  },
@@ -361,33 +419,36 @@ export const ListValue = {
361
419
  },
362
420
 
363
421
  decode(input: _m0.Reader | Uint8Array, length?: number): ListValue {
364
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
422
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
365
423
  let end = length === undefined ? reader.len : reader.pos + length;
366
424
  const message = createBaseListValue();
367
425
  while (reader.pos < end) {
368
426
  const tag = reader.uint32();
369
427
  switch (tag >>> 3) {
370
428
  case 1:
429
+ if (tag !== 10) {
430
+ break;
431
+ }
432
+
371
433
  message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
372
- break;
373
- default:
374
- reader.skipType(tag & 7);
375
- break;
434
+ continue;
376
435
  }
436
+ if ((tag & 7) === 4 || tag === 0) {
437
+ break;
438
+ }
439
+ reader.skipType(tag & 7);
377
440
  }
378
441
  return message;
379
442
  },
380
443
 
381
444
  fromJSON(object: any): ListValue {
382
- return { values: Array.isArray(object?.values) ? [...object.values] : [] };
445
+ return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] };
383
446
  },
384
447
 
385
448
  toJSON(message: ListValue): unknown {
386
449
  const obj: any = {};
387
- if (message.values) {
388
- obj.values = message.values.map((e) => e);
389
- } else {
390
- obj.values = [];
450
+ if (message.values?.length) {
451
+ obj.values = message.values;
391
452
  }
392
453
  return obj;
393
454
  },
@@ -395,7 +456,6 @@ export const ListValue = {
395
456
  create(base?: DeepPartial<ListValue>): ListValue {
396
457
  return ListValue.fromPartial(base ?? {});
397
458
  },
398
-
399
459
  fromPartial(object: DeepPartial<ListValue>): ListValue {
400
460
  const message = createBaseListValue();
401
461
  message.values = object.values?.map((e) => e) || [];
@@ -409,7 +469,7 @@ export const ListValue = {
409
469
  },
410
470
 
411
471
  unwrap(message: ListValue): Array<any> {
412
- if (message?.hasOwnProperty("values") && Array.isArray(message.values)) {
472
+ if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) {
413
473
  return message.values;
414
474
  } else {
415
475
  return message as any;
@@ -417,10 +477,11 @@ export const ListValue = {
417
477
  },
418
478
  };
419
479
 
420
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
480
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
421
481
 
422
482
  type DeepPartial<T> = T extends Builtin ? T
423
- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
483
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
484
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
424
485
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
425
486
  : Partial<T>;
426
487
 
@@ -14,6 +14,9 @@ function createBaseTimestamp(): Timestamp {
14
14
  export const Timestamp = {
15
15
  encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
16
16
  if (message.seconds !== BigInt("0")) {
17
+ if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
18
+ throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
19
+ }
17
20
  writer.uint32(8).int64(message.seconds.toString());
18
21
  }
19
22
  if (message.nanos !== 0) {
@@ -23,22 +26,31 @@ export const Timestamp = {
23
26
  },
24
27
 
25
28
  decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
26
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
29
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
27
30
  let end = length === undefined ? reader.len : reader.pos + length;
28
31
  const message = createBaseTimestamp();
29
32
  while (reader.pos < end) {
30
33
  const tag = reader.uint32();
31
34
  switch (tag >>> 3) {
32
35
  case 1:
36
+ if (tag !== 8) {
37
+ break;
38
+ }
39
+
33
40
  message.seconds = longToBigint(reader.int64() as Long);
34
- break;
41
+ continue;
35
42
  case 2:
43
+ if (tag !== 16) {
44
+ break;
45
+ }
46
+
36
47
  message.nanos = reader.int32();
37
- break;
38
- default:
39
- reader.skipType(tag & 7);
40
- break;
48
+ continue;
41
49
  }
50
+ if ((tag & 7) === 4 || tag === 0) {
51
+ break;
52
+ }
53
+ reader.skipType(tag & 7);
42
54
  }
43
55
  return message;
44
56
  },
@@ -46,21 +58,24 @@ export const Timestamp = {
46
58
  fromJSON(object: any): Timestamp {
47
59
  return {
48
60
  seconds: isSet(object.seconds) ? BigInt(object.seconds) : BigInt("0"),
49
- nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
61
+ nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
50
62
  };
51
63
  },
52
64
 
53
65
  toJSON(message: Timestamp): unknown {
54
66
  const obj: any = {};
55
- message.seconds !== undefined && (obj.seconds = message.seconds.toString());
56
- message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
67
+ if (message.seconds !== BigInt("0")) {
68
+ obj.seconds = message.seconds.toString();
69
+ }
70
+ if (message.nanos !== 0) {
71
+ obj.nanos = Math.round(message.nanos);
72
+ }
57
73
  return obj;
58
74
  },
59
75
 
60
76
  create(base?: DeepPartial<Timestamp>): Timestamp {
61
77
  return Timestamp.fromPartial(base ?? {});
62
78
  },
63
-
64
79
  fromPartial(object: DeepPartial<Timestamp>): Timestamp {
65
80
  const message = createBaseTimestamp();
66
81
  message.seconds = object.seconds ?? BigInt("0");
@@ -69,10 +84,11 @@ export const Timestamp = {
69
84
  },
70
85
  };
71
86
 
72
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
87
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
73
88
 
74
89
  type DeepPartial<T> = T extends Builtin ? T
75
- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
90
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
91
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
76
92
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
77
93
  : Partial<T>;
78
94