@apibara/protocol 2.0.0-beta.4 → 2.0.0-beta.41

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.
@@ -0,0 +1,1344 @@
1
+ 'use strict';
2
+
3
+ const _m0 = require('protobufjs/minimal.js');
4
+ const schema = require('@effect/schema');
5
+ const effect = require('effect');
6
+ const viem = require('viem');
7
+ const Long = require('long');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
+
11
+ const _m0__default = /*#__PURE__*/_interopDefaultCompat(_m0);
12
+ const Long__default = /*#__PURE__*/_interopDefaultCompat(Long);
13
+
14
+ function createBaseDuration() {
15
+ return { seconds: BigInt("0"), nanos: 0 };
16
+ }
17
+ const Duration$1 = {
18
+ encode(message, writer = _m0__default.Writer.create()) {
19
+ if (message.seconds !== BigInt("0")) {
20
+ if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
21
+ throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
22
+ }
23
+ writer.uint32(8).int64(message.seconds.toString());
24
+ }
25
+ if (message.nanos !== 0) {
26
+ writer.uint32(16).int32(message.nanos);
27
+ }
28
+ return writer;
29
+ },
30
+ decode(input, length) {
31
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
32
+ let end = length === void 0 ? reader.len : reader.pos + length;
33
+ const message = createBaseDuration();
34
+ while (reader.pos < end) {
35
+ const tag = reader.uint32();
36
+ switch (tag >>> 3) {
37
+ case 1:
38
+ if (tag !== 8) {
39
+ break;
40
+ }
41
+ message.seconds = longToBigint$1(reader.int64());
42
+ continue;
43
+ case 2:
44
+ if (tag !== 16) {
45
+ break;
46
+ }
47
+ message.nanos = reader.int32();
48
+ continue;
49
+ }
50
+ if ((tag & 7) === 4 || tag === 0) {
51
+ break;
52
+ }
53
+ reader.skipType(tag & 7);
54
+ }
55
+ return message;
56
+ },
57
+ fromJSON(object) {
58
+ return {
59
+ seconds: isSet$2(object.seconds) ? BigInt(object.seconds) : BigInt("0"),
60
+ nanos: isSet$2(object.nanos) ? globalThis.Number(object.nanos) : 0
61
+ };
62
+ },
63
+ toJSON(message) {
64
+ const obj = {};
65
+ if (message.seconds !== BigInt("0")) {
66
+ obj.seconds = message.seconds.toString();
67
+ }
68
+ if (message.nanos !== 0) {
69
+ obj.nanos = Math.round(message.nanos);
70
+ }
71
+ return obj;
72
+ },
73
+ create(base) {
74
+ return Duration$1.fromPartial(base ?? {});
75
+ },
76
+ fromPartial(object) {
77
+ const message = createBaseDuration();
78
+ message.seconds = object.seconds ?? BigInt("0");
79
+ message.nanos = object.nanos ?? 0;
80
+ return message;
81
+ }
82
+ };
83
+ function longToBigint$1(long) {
84
+ return BigInt(long.toString());
85
+ }
86
+ if (_m0__default.util.Long !== Long__default) {
87
+ _m0__default.util.Long = Long__default;
88
+ _m0__default.configure();
89
+ }
90
+ function isSet$2(value) {
91
+ return value !== null && value !== void 0;
92
+ }
93
+
94
+ const protobufPackage$1 = "dna.v2.stream";
95
+ var DataFinality$1 = /* @__PURE__ */ ((DataFinality2) => {
96
+ DataFinality2[DataFinality2["UNKNOWN"] = 0] = "UNKNOWN";
97
+ DataFinality2[DataFinality2["PENDING"] = 1] = "PENDING";
98
+ DataFinality2[DataFinality2["ACCEPTED"] = 2] = "ACCEPTED";
99
+ DataFinality2[DataFinality2["FINALIZED"] = 3] = "FINALIZED";
100
+ DataFinality2[DataFinality2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
101
+ return DataFinality2;
102
+ })(DataFinality$1 || {});
103
+ function dataFinalityFromJSON(object) {
104
+ switch (object) {
105
+ case 0:
106
+ case "DATA_FINALITY_UNKNOWN":
107
+ return 0 /* UNKNOWN */;
108
+ case 1:
109
+ case "DATA_FINALITY_PENDING":
110
+ return 1 /* PENDING */;
111
+ case 2:
112
+ case "DATA_FINALITY_ACCEPTED":
113
+ return 2 /* ACCEPTED */;
114
+ case 3:
115
+ case "DATA_FINALITY_FINALIZED":
116
+ return 3 /* FINALIZED */;
117
+ case -1:
118
+ case "UNRECOGNIZED":
119
+ default:
120
+ return -1 /* UNRECOGNIZED */;
121
+ }
122
+ }
123
+ function dataFinalityToJSON(object) {
124
+ switch (object) {
125
+ case 0 /* UNKNOWN */:
126
+ return "DATA_FINALITY_UNKNOWN";
127
+ case 1 /* PENDING */:
128
+ return "DATA_FINALITY_PENDING";
129
+ case 2 /* ACCEPTED */:
130
+ return "DATA_FINALITY_ACCEPTED";
131
+ case 3 /* FINALIZED */:
132
+ return "DATA_FINALITY_FINALIZED";
133
+ case -1 /* UNRECOGNIZED */:
134
+ default:
135
+ return "UNRECOGNIZED";
136
+ }
137
+ }
138
+ var DataProduction$1 = /* @__PURE__ */ ((DataProduction2) => {
139
+ DataProduction2[DataProduction2["UNKNOWN"] = 0] = "UNKNOWN";
140
+ DataProduction2[DataProduction2["BACKFILL"] = 1] = "BACKFILL";
141
+ DataProduction2[DataProduction2["LIVE"] = 2] = "LIVE";
142
+ DataProduction2[DataProduction2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
143
+ return DataProduction2;
144
+ })(DataProduction$1 || {});
145
+ function dataProductionFromJSON(object) {
146
+ switch (object) {
147
+ case 0:
148
+ case "DATA_PRODUCTION_UNKNOWN":
149
+ return 0 /* UNKNOWN */;
150
+ case 1:
151
+ case "DATA_PRODUCTION_BACKFILL":
152
+ return 1 /* BACKFILL */;
153
+ case 2:
154
+ case "DATA_PRODUCTION_LIVE":
155
+ return 2 /* LIVE */;
156
+ case -1:
157
+ case "UNRECOGNIZED":
158
+ default:
159
+ return -1 /* UNRECOGNIZED */;
160
+ }
161
+ }
162
+ function dataProductionToJSON(object) {
163
+ switch (object) {
164
+ case 0 /* UNKNOWN */:
165
+ return "DATA_PRODUCTION_UNKNOWN";
166
+ case 1 /* BACKFILL */:
167
+ return "DATA_PRODUCTION_BACKFILL";
168
+ case 2 /* LIVE */:
169
+ return "DATA_PRODUCTION_LIVE";
170
+ case -1 /* UNRECOGNIZED */:
171
+ default:
172
+ return "UNRECOGNIZED";
173
+ }
174
+ }
175
+ function createBaseCursor() {
176
+ return { orderKey: BigInt("0"), uniqueKey: new Uint8Array(0) };
177
+ }
178
+ const Cursor$1 = {
179
+ encode(message, writer = _m0__default.Writer.create()) {
180
+ if (message.orderKey !== BigInt("0")) {
181
+ if (BigInt.asUintN(64, message.orderKey) !== message.orderKey) {
182
+ throw new globalThis.Error("value provided for field message.orderKey of type uint64 too large");
183
+ }
184
+ writer.uint32(8).uint64(message.orderKey.toString());
185
+ }
186
+ if (message.uniqueKey.length !== 0) {
187
+ writer.uint32(18).bytes(message.uniqueKey);
188
+ }
189
+ return writer;
190
+ },
191
+ decode(input, length) {
192
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
193
+ let end = length === void 0 ? reader.len : reader.pos + length;
194
+ const message = createBaseCursor();
195
+ while (reader.pos < end) {
196
+ const tag = reader.uint32();
197
+ switch (tag >>> 3) {
198
+ case 1:
199
+ if (tag !== 8) {
200
+ break;
201
+ }
202
+ message.orderKey = longToBigint(reader.uint64());
203
+ continue;
204
+ case 2:
205
+ if (tag !== 18) {
206
+ break;
207
+ }
208
+ message.uniqueKey = reader.bytes();
209
+ continue;
210
+ }
211
+ if ((tag & 7) === 4 || tag === 0) {
212
+ break;
213
+ }
214
+ reader.skipType(tag & 7);
215
+ }
216
+ return message;
217
+ },
218
+ fromJSON(object) {
219
+ return {
220
+ orderKey: isSet$1(object.orderKey) ? BigInt(object.orderKey) : BigInt("0"),
221
+ uniqueKey: isSet$1(object.uniqueKey) ? bytesFromBase64(object.uniqueKey) : new Uint8Array(0)
222
+ };
223
+ },
224
+ toJSON(message) {
225
+ const obj = {};
226
+ if (message.orderKey !== BigInt("0")) {
227
+ obj.orderKey = message.orderKey.toString();
228
+ }
229
+ if (message.uniqueKey.length !== 0) {
230
+ obj.uniqueKey = base64FromBytes(message.uniqueKey);
231
+ }
232
+ return obj;
233
+ },
234
+ create(base) {
235
+ return Cursor$1.fromPartial(base ?? {});
236
+ },
237
+ fromPartial(object) {
238
+ const message = createBaseCursor();
239
+ message.orderKey = object.orderKey ?? BigInt("0");
240
+ message.uniqueKey = object.uniqueKey ?? new Uint8Array(0);
241
+ return message;
242
+ }
243
+ };
244
+ function createBaseStatusRequest() {
245
+ return {};
246
+ }
247
+ const StatusRequest = {
248
+ encode(_, writer = _m0__default.Writer.create()) {
249
+ return writer;
250
+ },
251
+ decode(input, length) {
252
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
253
+ let end = length === void 0 ? reader.len : reader.pos + length;
254
+ const message = createBaseStatusRequest();
255
+ while (reader.pos < end) {
256
+ const tag = reader.uint32();
257
+ if ((tag & 7) === 4 || tag === 0) {
258
+ break;
259
+ }
260
+ reader.skipType(tag & 7);
261
+ }
262
+ return message;
263
+ },
264
+ fromJSON(_) {
265
+ return {};
266
+ },
267
+ toJSON(_) {
268
+ const obj = {};
269
+ return obj;
270
+ },
271
+ create(base) {
272
+ return StatusRequest.fromPartial(base ?? {});
273
+ },
274
+ fromPartial(_) {
275
+ const message = createBaseStatusRequest();
276
+ return message;
277
+ }
278
+ };
279
+ function createBaseStatusResponse() {
280
+ return { currentHead: void 0, lastIngested: void 0, finalized: void 0, starting: void 0 };
281
+ }
282
+ const StatusResponse = {
283
+ encode(message, writer = _m0__default.Writer.create()) {
284
+ if (message.currentHead !== void 0) {
285
+ Cursor$1.encode(message.currentHead, writer.uint32(10).fork()).ldelim();
286
+ }
287
+ if (message.lastIngested !== void 0) {
288
+ Cursor$1.encode(message.lastIngested, writer.uint32(18).fork()).ldelim();
289
+ }
290
+ if (message.finalized !== void 0) {
291
+ Cursor$1.encode(message.finalized, writer.uint32(26).fork()).ldelim();
292
+ }
293
+ if (message.starting !== void 0) {
294
+ Cursor$1.encode(message.starting, writer.uint32(34).fork()).ldelim();
295
+ }
296
+ return writer;
297
+ },
298
+ decode(input, length) {
299
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
300
+ let end = length === void 0 ? reader.len : reader.pos + length;
301
+ const message = createBaseStatusResponse();
302
+ while (reader.pos < end) {
303
+ const tag = reader.uint32();
304
+ switch (tag >>> 3) {
305
+ case 1:
306
+ if (tag !== 10) {
307
+ break;
308
+ }
309
+ message.currentHead = Cursor$1.decode(reader, reader.uint32());
310
+ continue;
311
+ case 2:
312
+ if (tag !== 18) {
313
+ break;
314
+ }
315
+ message.lastIngested = Cursor$1.decode(reader, reader.uint32());
316
+ continue;
317
+ case 3:
318
+ if (tag !== 26) {
319
+ break;
320
+ }
321
+ message.finalized = Cursor$1.decode(reader, reader.uint32());
322
+ continue;
323
+ case 4:
324
+ if (tag !== 34) {
325
+ break;
326
+ }
327
+ message.starting = Cursor$1.decode(reader, reader.uint32());
328
+ continue;
329
+ }
330
+ if ((tag & 7) === 4 || tag === 0) {
331
+ break;
332
+ }
333
+ reader.skipType(tag & 7);
334
+ }
335
+ return message;
336
+ },
337
+ fromJSON(object) {
338
+ return {
339
+ currentHead: isSet$1(object.currentHead) ? Cursor$1.fromJSON(object.currentHead) : void 0,
340
+ lastIngested: isSet$1(object.lastIngested) ? Cursor$1.fromJSON(object.lastIngested) : void 0,
341
+ finalized: isSet$1(object.finalized) ? Cursor$1.fromJSON(object.finalized) : void 0,
342
+ starting: isSet$1(object.starting) ? Cursor$1.fromJSON(object.starting) : void 0
343
+ };
344
+ },
345
+ toJSON(message) {
346
+ const obj = {};
347
+ if (message.currentHead !== void 0) {
348
+ obj.currentHead = Cursor$1.toJSON(message.currentHead);
349
+ }
350
+ if (message.lastIngested !== void 0) {
351
+ obj.lastIngested = Cursor$1.toJSON(message.lastIngested);
352
+ }
353
+ if (message.finalized !== void 0) {
354
+ obj.finalized = Cursor$1.toJSON(message.finalized);
355
+ }
356
+ if (message.starting !== void 0) {
357
+ obj.starting = Cursor$1.toJSON(message.starting);
358
+ }
359
+ return obj;
360
+ },
361
+ create(base) {
362
+ return StatusResponse.fromPartial(base ?? {});
363
+ },
364
+ fromPartial(object) {
365
+ const message = createBaseStatusResponse();
366
+ message.currentHead = object.currentHead !== void 0 && object.currentHead !== null ? Cursor$1.fromPartial(object.currentHead) : void 0;
367
+ message.lastIngested = object.lastIngested !== void 0 && object.lastIngested !== null ? Cursor$1.fromPartial(object.lastIngested) : void 0;
368
+ message.finalized = object.finalized !== void 0 && object.finalized !== null ? Cursor$1.fromPartial(object.finalized) : void 0;
369
+ message.starting = object.starting !== void 0 && object.starting !== null ? Cursor$1.fromPartial(object.starting) : void 0;
370
+ return message;
371
+ }
372
+ };
373
+ function createBaseStreamDataRequest() {
374
+ return { startingCursor: void 0, finality: void 0, filter: [], heartbeatInterval: void 0 };
375
+ }
376
+ const StreamDataRequest$1 = {
377
+ encode(message, writer = _m0__default.Writer.create()) {
378
+ if (message.startingCursor !== void 0) {
379
+ Cursor$1.encode(message.startingCursor, writer.uint32(10).fork()).ldelim();
380
+ }
381
+ if (message.finality !== void 0) {
382
+ writer.uint32(16).int32(message.finality);
383
+ }
384
+ for (const v of message.filter) {
385
+ writer.uint32(26).bytes(v);
386
+ }
387
+ if (message.heartbeatInterval !== void 0) {
388
+ Duration$1.encode(message.heartbeatInterval, writer.uint32(34).fork()).ldelim();
389
+ }
390
+ return writer;
391
+ },
392
+ decode(input, length) {
393
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
394
+ let end = length === void 0 ? reader.len : reader.pos + length;
395
+ const message = createBaseStreamDataRequest();
396
+ while (reader.pos < end) {
397
+ const tag = reader.uint32();
398
+ switch (tag >>> 3) {
399
+ case 1:
400
+ if (tag !== 10) {
401
+ break;
402
+ }
403
+ message.startingCursor = Cursor$1.decode(reader, reader.uint32());
404
+ continue;
405
+ case 2:
406
+ if (tag !== 16) {
407
+ break;
408
+ }
409
+ message.finality = reader.int32();
410
+ continue;
411
+ case 3:
412
+ if (tag !== 26) {
413
+ break;
414
+ }
415
+ message.filter.push(reader.bytes());
416
+ continue;
417
+ case 4:
418
+ if (tag !== 34) {
419
+ break;
420
+ }
421
+ message.heartbeatInterval = Duration$1.decode(reader, reader.uint32());
422
+ continue;
423
+ }
424
+ if ((tag & 7) === 4 || tag === 0) {
425
+ break;
426
+ }
427
+ reader.skipType(tag & 7);
428
+ }
429
+ return message;
430
+ },
431
+ fromJSON(object) {
432
+ return {
433
+ startingCursor: isSet$1(object.startingCursor) ? Cursor$1.fromJSON(object.startingCursor) : void 0,
434
+ finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : void 0,
435
+ filter: globalThis.Array.isArray(object?.filter) ? object.filter.map((e) => bytesFromBase64(e)) : [],
436
+ heartbeatInterval: isSet$1(object.heartbeatInterval) ? Duration$1.fromJSON(object.heartbeatInterval) : void 0
437
+ };
438
+ },
439
+ toJSON(message) {
440
+ const obj = {};
441
+ if (message.startingCursor !== void 0) {
442
+ obj.startingCursor = Cursor$1.toJSON(message.startingCursor);
443
+ }
444
+ if (message.finality !== void 0) {
445
+ obj.finality = dataFinalityToJSON(message.finality);
446
+ }
447
+ if (message.filter?.length) {
448
+ obj.filter = message.filter.map((e) => base64FromBytes(e));
449
+ }
450
+ if (message.heartbeatInterval !== void 0) {
451
+ obj.heartbeatInterval = Duration$1.toJSON(message.heartbeatInterval);
452
+ }
453
+ return obj;
454
+ },
455
+ create(base) {
456
+ return StreamDataRequest$1.fromPartial(base ?? {});
457
+ },
458
+ fromPartial(object) {
459
+ const message = createBaseStreamDataRequest();
460
+ message.startingCursor = object.startingCursor !== void 0 && object.startingCursor !== null ? Cursor$1.fromPartial(object.startingCursor) : void 0;
461
+ message.finality = object.finality ?? void 0;
462
+ message.filter = object.filter?.map((e) => e) || [];
463
+ message.heartbeatInterval = object.heartbeatInterval !== void 0 && object.heartbeatInterval !== null ? Duration$1.fromPartial(object.heartbeatInterval) : void 0;
464
+ return message;
465
+ }
466
+ };
467
+ function createBaseStreamDataResponse() {
468
+ return { message: void 0 };
469
+ }
470
+ const StreamDataResponse$1 = {
471
+ encode(message, writer = _m0__default.Writer.create()) {
472
+ switch (message.message?.$case) {
473
+ case "data":
474
+ Data$1.encode(message.message.data, writer.uint32(10).fork()).ldelim();
475
+ break;
476
+ case "invalidate":
477
+ Invalidate$1.encode(message.message.invalidate, writer.uint32(18).fork()).ldelim();
478
+ break;
479
+ case "finalize":
480
+ Finalize$1.encode(message.message.finalize, writer.uint32(26).fork()).ldelim();
481
+ break;
482
+ case "heartbeat":
483
+ Heartbeat$1.encode(message.message.heartbeat, writer.uint32(34).fork()).ldelim();
484
+ break;
485
+ case "systemMessage":
486
+ SystemMessage$1.encode(message.message.systemMessage, writer.uint32(42).fork()).ldelim();
487
+ break;
488
+ }
489
+ return writer;
490
+ },
491
+ decode(input, length) {
492
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
493
+ let end = length === void 0 ? reader.len : reader.pos + length;
494
+ const message = createBaseStreamDataResponse();
495
+ while (reader.pos < end) {
496
+ const tag = reader.uint32();
497
+ switch (tag >>> 3) {
498
+ case 1:
499
+ if (tag !== 10) {
500
+ break;
501
+ }
502
+ message.message = { $case: "data", data: Data$1.decode(reader, reader.uint32()) };
503
+ continue;
504
+ case 2:
505
+ if (tag !== 18) {
506
+ break;
507
+ }
508
+ message.message = { $case: "invalidate", invalidate: Invalidate$1.decode(reader, reader.uint32()) };
509
+ continue;
510
+ case 3:
511
+ if (tag !== 26) {
512
+ break;
513
+ }
514
+ message.message = { $case: "finalize", finalize: Finalize$1.decode(reader, reader.uint32()) };
515
+ continue;
516
+ case 4:
517
+ if (tag !== 34) {
518
+ break;
519
+ }
520
+ message.message = { $case: "heartbeat", heartbeat: Heartbeat$1.decode(reader, reader.uint32()) };
521
+ continue;
522
+ case 5:
523
+ if (tag !== 42) {
524
+ break;
525
+ }
526
+ message.message = { $case: "systemMessage", systemMessage: SystemMessage$1.decode(reader, reader.uint32()) };
527
+ continue;
528
+ }
529
+ if ((tag & 7) === 4 || tag === 0) {
530
+ break;
531
+ }
532
+ reader.skipType(tag & 7);
533
+ }
534
+ return message;
535
+ },
536
+ fromJSON(object) {
537
+ return {
538
+ message: isSet$1(object.data) ? { $case: "data", data: Data$1.fromJSON(object.data) } : isSet$1(object.invalidate) ? { $case: "invalidate", invalidate: Invalidate$1.fromJSON(object.invalidate) } : isSet$1(object.finalize) ? { $case: "finalize", finalize: Finalize$1.fromJSON(object.finalize) } : isSet$1(object.heartbeat) ? { $case: "heartbeat", heartbeat: Heartbeat$1.fromJSON(object.heartbeat) } : isSet$1(object.systemMessage) ? { $case: "systemMessage", systemMessage: SystemMessage$1.fromJSON(object.systemMessage) } : void 0
539
+ };
540
+ },
541
+ toJSON(message) {
542
+ const obj = {};
543
+ if (message.message?.$case === "data") {
544
+ obj.data = Data$1.toJSON(message.message.data);
545
+ }
546
+ if (message.message?.$case === "invalidate") {
547
+ obj.invalidate = Invalidate$1.toJSON(message.message.invalidate);
548
+ }
549
+ if (message.message?.$case === "finalize") {
550
+ obj.finalize = Finalize$1.toJSON(message.message.finalize);
551
+ }
552
+ if (message.message?.$case === "heartbeat") {
553
+ obj.heartbeat = Heartbeat$1.toJSON(message.message.heartbeat);
554
+ }
555
+ if (message.message?.$case === "systemMessage") {
556
+ obj.systemMessage = SystemMessage$1.toJSON(message.message.systemMessage);
557
+ }
558
+ return obj;
559
+ },
560
+ create(base) {
561
+ return StreamDataResponse$1.fromPartial(base ?? {});
562
+ },
563
+ fromPartial(object) {
564
+ const message = createBaseStreamDataResponse();
565
+ if (object.message?.$case === "data" && object.message?.data !== void 0 && object.message?.data !== null) {
566
+ message.message = { $case: "data", data: Data$1.fromPartial(object.message.data) };
567
+ }
568
+ if (object.message?.$case === "invalidate" && object.message?.invalidate !== void 0 && object.message?.invalidate !== null) {
569
+ message.message = { $case: "invalidate", invalidate: Invalidate$1.fromPartial(object.message.invalidate) };
570
+ }
571
+ if (object.message?.$case === "finalize" && object.message?.finalize !== void 0 && object.message?.finalize !== null) {
572
+ message.message = { $case: "finalize", finalize: Finalize$1.fromPartial(object.message.finalize) };
573
+ }
574
+ if (object.message?.$case === "heartbeat" && object.message?.heartbeat !== void 0 && object.message?.heartbeat !== null) {
575
+ message.message = { $case: "heartbeat", heartbeat: Heartbeat$1.fromPartial(object.message.heartbeat) };
576
+ }
577
+ if (object.message?.$case === "systemMessage" && object.message?.systemMessage !== void 0 && object.message?.systemMessage !== null) {
578
+ message.message = {
579
+ $case: "systemMessage",
580
+ systemMessage: SystemMessage$1.fromPartial(object.message.systemMessage)
581
+ };
582
+ }
583
+ return message;
584
+ }
585
+ };
586
+ function createBaseInvalidate() {
587
+ return { cursor: void 0, removed: [] };
588
+ }
589
+ const Invalidate$1 = {
590
+ encode(message, writer = _m0__default.Writer.create()) {
591
+ if (message.cursor !== void 0) {
592
+ Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
593
+ }
594
+ for (const v of message.removed) {
595
+ Cursor$1.encode(v, writer.uint32(18).fork()).ldelim();
596
+ }
597
+ return writer;
598
+ },
599
+ decode(input, length) {
600
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
601
+ let end = length === void 0 ? reader.len : reader.pos + length;
602
+ const message = createBaseInvalidate();
603
+ while (reader.pos < end) {
604
+ const tag = reader.uint32();
605
+ switch (tag >>> 3) {
606
+ case 1:
607
+ if (tag !== 10) {
608
+ break;
609
+ }
610
+ message.cursor = Cursor$1.decode(reader, reader.uint32());
611
+ continue;
612
+ case 2:
613
+ if (tag !== 18) {
614
+ break;
615
+ }
616
+ message.removed.push(Cursor$1.decode(reader, reader.uint32()));
617
+ continue;
618
+ }
619
+ if ((tag & 7) === 4 || tag === 0) {
620
+ break;
621
+ }
622
+ reader.skipType(tag & 7);
623
+ }
624
+ return message;
625
+ },
626
+ fromJSON(object) {
627
+ return {
628
+ cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0,
629
+ removed: globalThis.Array.isArray(object?.removed) ? object.removed.map((e) => Cursor$1.fromJSON(e)) : []
630
+ };
631
+ },
632
+ toJSON(message) {
633
+ const obj = {};
634
+ if (message.cursor !== void 0) {
635
+ obj.cursor = Cursor$1.toJSON(message.cursor);
636
+ }
637
+ if (message.removed?.length) {
638
+ obj.removed = message.removed.map((e) => Cursor$1.toJSON(e));
639
+ }
640
+ return obj;
641
+ },
642
+ create(base) {
643
+ return Invalidate$1.fromPartial(base ?? {});
644
+ },
645
+ fromPartial(object) {
646
+ const message = createBaseInvalidate();
647
+ message.cursor = object.cursor !== void 0 && object.cursor !== null ? Cursor$1.fromPartial(object.cursor) : void 0;
648
+ message.removed = object.removed?.map((e) => Cursor$1.fromPartial(e)) || [];
649
+ return message;
650
+ }
651
+ };
652
+ function createBaseFinalize() {
653
+ return { cursor: void 0 };
654
+ }
655
+ const Finalize$1 = {
656
+ encode(message, writer = _m0__default.Writer.create()) {
657
+ if (message.cursor !== void 0) {
658
+ Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
659
+ }
660
+ return writer;
661
+ },
662
+ decode(input, length) {
663
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
664
+ let end = length === void 0 ? reader.len : reader.pos + length;
665
+ const message = createBaseFinalize();
666
+ while (reader.pos < end) {
667
+ const tag = reader.uint32();
668
+ switch (tag >>> 3) {
669
+ case 1:
670
+ if (tag !== 10) {
671
+ break;
672
+ }
673
+ message.cursor = Cursor$1.decode(reader, reader.uint32());
674
+ continue;
675
+ }
676
+ if ((tag & 7) === 4 || tag === 0) {
677
+ break;
678
+ }
679
+ reader.skipType(tag & 7);
680
+ }
681
+ return message;
682
+ },
683
+ fromJSON(object) {
684
+ return { cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0 };
685
+ },
686
+ toJSON(message) {
687
+ const obj = {};
688
+ if (message.cursor !== void 0) {
689
+ obj.cursor = Cursor$1.toJSON(message.cursor);
690
+ }
691
+ return obj;
692
+ },
693
+ create(base) {
694
+ return Finalize$1.fromPartial(base ?? {});
695
+ },
696
+ fromPartial(object) {
697
+ const message = createBaseFinalize();
698
+ message.cursor = object.cursor !== void 0 && object.cursor !== null ? Cursor$1.fromPartial(object.cursor) : void 0;
699
+ return message;
700
+ }
701
+ };
702
+ function createBaseData() {
703
+ return { cursor: void 0, endCursor: void 0, finality: 0, data: [], production: 0 };
704
+ }
705
+ const Data$1 = {
706
+ encode(message, writer = _m0__default.Writer.create()) {
707
+ if (message.cursor !== void 0) {
708
+ Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
709
+ }
710
+ if (message.endCursor !== void 0) {
711
+ Cursor$1.encode(message.endCursor, writer.uint32(18).fork()).ldelim();
712
+ }
713
+ if (message.finality !== 0) {
714
+ writer.uint32(24).int32(message.finality);
715
+ }
716
+ for (const v of message.data) {
717
+ writer.uint32(34).bytes(v);
718
+ }
719
+ if (message.production !== 0) {
720
+ writer.uint32(40).int32(message.production);
721
+ }
722
+ return writer;
723
+ },
724
+ decode(input, length) {
725
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
726
+ let end = length === void 0 ? reader.len : reader.pos + length;
727
+ const message = createBaseData();
728
+ while (reader.pos < end) {
729
+ const tag = reader.uint32();
730
+ switch (tag >>> 3) {
731
+ case 1:
732
+ if (tag !== 10) {
733
+ break;
734
+ }
735
+ message.cursor = Cursor$1.decode(reader, reader.uint32());
736
+ continue;
737
+ case 2:
738
+ if (tag !== 18) {
739
+ break;
740
+ }
741
+ message.endCursor = Cursor$1.decode(reader, reader.uint32());
742
+ continue;
743
+ case 3:
744
+ if (tag !== 24) {
745
+ break;
746
+ }
747
+ message.finality = reader.int32();
748
+ continue;
749
+ case 4:
750
+ if (tag !== 34) {
751
+ break;
752
+ }
753
+ message.data.push(reader.bytes());
754
+ continue;
755
+ case 5:
756
+ if (tag !== 40) {
757
+ break;
758
+ }
759
+ message.production = reader.int32();
760
+ continue;
761
+ }
762
+ if ((tag & 7) === 4 || tag === 0) {
763
+ break;
764
+ }
765
+ reader.skipType(tag & 7);
766
+ }
767
+ return message;
768
+ },
769
+ fromJSON(object) {
770
+ return {
771
+ cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0,
772
+ endCursor: isSet$1(object.endCursor) ? Cursor$1.fromJSON(object.endCursor) : void 0,
773
+ finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : 0,
774
+ data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => bytesFromBase64(e)) : [],
775
+ production: isSet$1(object.production) ? dataProductionFromJSON(object.production) : 0
776
+ };
777
+ },
778
+ toJSON(message) {
779
+ const obj = {};
780
+ if (message.cursor !== void 0) {
781
+ obj.cursor = Cursor$1.toJSON(message.cursor);
782
+ }
783
+ if (message.endCursor !== void 0) {
784
+ obj.endCursor = Cursor$1.toJSON(message.endCursor);
785
+ }
786
+ if (message.finality !== 0) {
787
+ obj.finality = dataFinalityToJSON(message.finality);
788
+ }
789
+ if (message.data?.length) {
790
+ obj.data = message.data.map((e) => base64FromBytes(e));
791
+ }
792
+ if (message.production !== 0) {
793
+ obj.production = dataProductionToJSON(message.production);
794
+ }
795
+ return obj;
796
+ },
797
+ create(base) {
798
+ return Data$1.fromPartial(base ?? {});
799
+ },
800
+ fromPartial(object) {
801
+ const message = createBaseData();
802
+ message.cursor = object.cursor !== void 0 && object.cursor !== null ? Cursor$1.fromPartial(object.cursor) : void 0;
803
+ message.endCursor = object.endCursor !== void 0 && object.endCursor !== null ? Cursor$1.fromPartial(object.endCursor) : void 0;
804
+ message.finality = object.finality ?? 0;
805
+ message.data = object.data?.map((e) => e) || [];
806
+ message.production = object.production ?? 0;
807
+ return message;
808
+ }
809
+ };
810
+ function createBaseHeartbeat() {
811
+ return {};
812
+ }
813
+ const Heartbeat$1 = {
814
+ encode(_, writer = _m0__default.Writer.create()) {
815
+ return writer;
816
+ },
817
+ decode(input, length) {
818
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
819
+ let end = length === void 0 ? reader.len : reader.pos + length;
820
+ const message = createBaseHeartbeat();
821
+ while (reader.pos < end) {
822
+ const tag = reader.uint32();
823
+ if ((tag & 7) === 4 || tag === 0) {
824
+ break;
825
+ }
826
+ reader.skipType(tag & 7);
827
+ }
828
+ return message;
829
+ },
830
+ fromJSON(_) {
831
+ return {};
832
+ },
833
+ toJSON(_) {
834
+ const obj = {};
835
+ return obj;
836
+ },
837
+ create(base) {
838
+ return Heartbeat$1.fromPartial(base ?? {});
839
+ },
840
+ fromPartial(_) {
841
+ const message = createBaseHeartbeat();
842
+ return message;
843
+ }
844
+ };
845
+ function createBaseSystemMessage() {
846
+ return { output: void 0 };
847
+ }
848
+ const SystemMessage$1 = {
849
+ encode(message, writer = _m0__default.Writer.create()) {
850
+ switch (message.output?.$case) {
851
+ case "stdout":
852
+ writer.uint32(10).string(message.output.stdout);
853
+ break;
854
+ case "stderr":
855
+ writer.uint32(18).string(message.output.stderr);
856
+ break;
857
+ }
858
+ return writer;
859
+ },
860
+ decode(input, length) {
861
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
862
+ let end = length === void 0 ? reader.len : reader.pos + length;
863
+ const message = createBaseSystemMessage();
864
+ while (reader.pos < end) {
865
+ const tag = reader.uint32();
866
+ switch (tag >>> 3) {
867
+ case 1:
868
+ if (tag !== 10) {
869
+ break;
870
+ }
871
+ message.output = { $case: "stdout", stdout: reader.string() };
872
+ continue;
873
+ case 2:
874
+ if (tag !== 18) {
875
+ break;
876
+ }
877
+ message.output = { $case: "stderr", stderr: reader.string() };
878
+ continue;
879
+ }
880
+ if ((tag & 7) === 4 || tag === 0) {
881
+ break;
882
+ }
883
+ reader.skipType(tag & 7);
884
+ }
885
+ return message;
886
+ },
887
+ fromJSON(object) {
888
+ return {
889
+ output: isSet$1(object.stdout) ? { $case: "stdout", stdout: globalThis.String(object.stdout) } : isSet$1(object.stderr) ? { $case: "stderr", stderr: globalThis.String(object.stderr) } : void 0
890
+ };
891
+ },
892
+ toJSON(message) {
893
+ const obj = {};
894
+ if (message.output?.$case === "stdout") {
895
+ obj.stdout = message.output.stdout;
896
+ }
897
+ if (message.output?.$case === "stderr") {
898
+ obj.stderr = message.output.stderr;
899
+ }
900
+ return obj;
901
+ },
902
+ create(base) {
903
+ return SystemMessage$1.fromPartial(base ?? {});
904
+ },
905
+ fromPartial(object) {
906
+ const message = createBaseSystemMessage();
907
+ if (object.output?.$case === "stdout" && object.output?.stdout !== void 0 && object.output?.stdout !== null) {
908
+ message.output = { $case: "stdout", stdout: object.output.stdout };
909
+ }
910
+ if (object.output?.$case === "stderr" && object.output?.stderr !== void 0 && object.output?.stderr !== null) {
911
+ message.output = { $case: "stderr", stderr: object.output.stderr };
912
+ }
913
+ return message;
914
+ }
915
+ };
916
+ const DnaStreamDefinition = {
917
+ name: "DnaStream",
918
+ fullName: "dna.v2.stream.DnaStream",
919
+ methods: {
920
+ /** Stream data from the server. */
921
+ streamData: {
922
+ name: "StreamData",
923
+ requestType: StreamDataRequest$1,
924
+ requestStream: false,
925
+ responseType: StreamDataResponse$1,
926
+ responseStream: true,
927
+ options: {}
928
+ },
929
+ /** Get DNA server status. */
930
+ status: {
931
+ name: "Status",
932
+ requestType: StatusRequest,
933
+ requestStream: false,
934
+ responseType: StatusResponse,
935
+ responseStream: false,
936
+ options: {}
937
+ }
938
+ }
939
+ };
940
+ function bytesFromBase64(b64) {
941
+ if (globalThis.Buffer) {
942
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
943
+ } else {
944
+ const bin = globalThis.atob(b64);
945
+ const arr = new Uint8Array(bin.length);
946
+ for (let i = 0; i < bin.length; ++i) {
947
+ arr[i] = bin.charCodeAt(i);
948
+ }
949
+ return arr;
950
+ }
951
+ }
952
+ function base64FromBytes(arr) {
953
+ if (globalThis.Buffer) {
954
+ return globalThis.Buffer.from(arr).toString("base64");
955
+ } else {
956
+ const bin = [];
957
+ arr.forEach((byte) => {
958
+ bin.push(globalThis.String.fromCharCode(byte));
959
+ });
960
+ return globalThis.btoa(bin.join(""));
961
+ }
962
+ }
963
+ function longToBigint(long) {
964
+ return BigInt(long.toString());
965
+ }
966
+ if (_m0__default.util.Long !== Long__default) {
967
+ _m0__default.util.Long = Long__default;
968
+ _m0__default.configure();
969
+ }
970
+ function isSet$1(value) {
971
+ return value !== null && value !== void 0;
972
+ }
973
+
974
+ const stream = {
975
+ __proto__: null,
976
+ Cursor: Cursor$1,
977
+ Data: Data$1,
978
+ DataFinality: DataFinality$1,
979
+ DataProduction: DataProduction$1,
980
+ DnaStreamDefinition: DnaStreamDefinition,
981
+ Finalize: Finalize$1,
982
+ Heartbeat: Heartbeat$1,
983
+ Invalidate: Invalidate$1,
984
+ StatusRequest: StatusRequest,
985
+ StatusResponse: StatusResponse,
986
+ StreamDataRequest: StreamDataRequest$1,
987
+ StreamDataResponse: StreamDataResponse$1,
988
+ SystemMessage: SystemMessage$1,
989
+ dataFinalityFromJSON: dataFinalityFromJSON,
990
+ dataFinalityToJSON: dataFinalityToJSON,
991
+ dataProductionFromJSON: dataProductionFromJSON,
992
+ dataProductionToJSON: dataProductionToJSON,
993
+ protobufPackage: protobufPackage$1
994
+ };
995
+
996
+ const protobufPackage = "dna.v2.testing";
997
+ function createBaseMockFilter() {
998
+ return { filter: void 0 };
999
+ }
1000
+ const MockFilter = {
1001
+ encode(message, writer = _m0__default.Writer.create()) {
1002
+ if (message.filter !== void 0) {
1003
+ writer.uint32(10).string(message.filter);
1004
+ }
1005
+ return writer;
1006
+ },
1007
+ decode(input, length) {
1008
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1009
+ let end = length === void 0 ? reader.len : reader.pos + length;
1010
+ const message = createBaseMockFilter();
1011
+ while (reader.pos < end) {
1012
+ const tag = reader.uint32();
1013
+ switch (tag >>> 3) {
1014
+ case 1:
1015
+ if (tag !== 10) {
1016
+ break;
1017
+ }
1018
+ message.filter = reader.string();
1019
+ continue;
1020
+ }
1021
+ if ((tag & 7) === 4 || tag === 0) {
1022
+ break;
1023
+ }
1024
+ reader.skipType(tag & 7);
1025
+ }
1026
+ return message;
1027
+ },
1028
+ fromJSON(object) {
1029
+ return { filter: isSet(object.filter) ? globalThis.String(object.filter) : void 0 };
1030
+ },
1031
+ toJSON(message) {
1032
+ const obj = {};
1033
+ if (message.filter !== void 0) {
1034
+ obj.filter = message.filter;
1035
+ }
1036
+ return obj;
1037
+ },
1038
+ create(base) {
1039
+ return MockFilter.fromPartial(base ?? {});
1040
+ },
1041
+ fromPartial(object) {
1042
+ const message = createBaseMockFilter();
1043
+ message.filter = object.filter ?? void 0;
1044
+ return message;
1045
+ }
1046
+ };
1047
+ function createBaseMockBlock() {
1048
+ return { data: void 0 };
1049
+ }
1050
+ const MockBlock = {
1051
+ encode(message, writer = _m0__default.Writer.create()) {
1052
+ if (message.data !== void 0) {
1053
+ writer.uint32(10).string(message.data);
1054
+ }
1055
+ return writer;
1056
+ },
1057
+ decode(input, length) {
1058
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1059
+ let end = length === void 0 ? reader.len : reader.pos + length;
1060
+ const message = createBaseMockBlock();
1061
+ while (reader.pos < end) {
1062
+ const tag = reader.uint32();
1063
+ switch (tag >>> 3) {
1064
+ case 1:
1065
+ if (tag !== 10) {
1066
+ break;
1067
+ }
1068
+ message.data = reader.string();
1069
+ continue;
1070
+ }
1071
+ if ((tag & 7) === 4 || tag === 0) {
1072
+ break;
1073
+ }
1074
+ reader.skipType(tag & 7);
1075
+ }
1076
+ return message;
1077
+ },
1078
+ fromJSON(object) {
1079
+ return { data: isSet(object.data) ? globalThis.String(object.data) : void 0 };
1080
+ },
1081
+ toJSON(message) {
1082
+ const obj = {};
1083
+ if (message.data !== void 0) {
1084
+ obj.data = message.data;
1085
+ }
1086
+ return obj;
1087
+ },
1088
+ create(base) {
1089
+ return MockBlock.fromPartial(base ?? {});
1090
+ },
1091
+ fromPartial(object) {
1092
+ const message = createBaseMockBlock();
1093
+ message.data = object.data ?? void 0;
1094
+ return message;
1095
+ }
1096
+ };
1097
+ function isSet(value) {
1098
+ return value !== null && value !== void 0;
1099
+ }
1100
+
1101
+ const testing = {
1102
+ __proto__: null,
1103
+ MockBlock: MockBlock,
1104
+ MockFilter: MockFilter,
1105
+ protobufPackage: protobufPackage
1106
+ };
1107
+
1108
+ const Bytes = schema.Schema.TemplateLiteral(
1109
+ schema.Schema.Literal("0x"),
1110
+ schema.Schema.String
1111
+ );
1112
+ const BytesFromUint8Array = schema.Schema.requiredToOptional(
1113
+ schema.Schema.Uint8ArrayFromSelf,
1114
+ Bytes,
1115
+ {
1116
+ decode(value) {
1117
+ if (value.length === 0) {
1118
+ return effect.Option.none();
1119
+ }
1120
+ return effect.Option.some(viem.toHex(value));
1121
+ },
1122
+ encode(value) {
1123
+ return value.pipe(
1124
+ effect.Option.map(viem.hexToBytes),
1125
+ effect.Option.getOrElse(() => new Uint8Array(0))
1126
+ );
1127
+ }
1128
+ }
1129
+ );
1130
+ const _Cursor = schema.Schema.Struct({
1131
+ /** The block number. */
1132
+ orderKey: schema.Schema.BigIntFromSelf,
1133
+ /** The block hash, if any. */
1134
+ uniqueKey: BytesFromUint8Array
1135
+ });
1136
+ const Cursor = _Cursor;
1137
+ const createCursor = (props) => props;
1138
+ const cursorToProto = schema.Schema.encodeSync(Cursor);
1139
+ const cursorFromProto = schema.Schema.decodeSync(Cursor);
1140
+ const CursorFromBytes = schema.Schema.transform(
1141
+ schema.Schema.Uint8ArrayFromSelf,
1142
+ Cursor,
1143
+ {
1144
+ decode(value) {
1145
+ return Cursor$1.decode(value);
1146
+ },
1147
+ encode(value) {
1148
+ return Cursor$1.encode(value).finish();
1149
+ }
1150
+ }
1151
+ );
1152
+ const cursorToBytes = schema.Schema.encodeSync(CursorFromBytes);
1153
+ const cursorFromBytes = schema.Schema.decodeSync(CursorFromBytes);
1154
+ function isCursor(value) {
1155
+ return schema.Schema.is(Cursor)(value);
1156
+ }
1157
+ function normalizeCursor(cursor) {
1158
+ if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
1159
+ const uniqueKey = cursor.uniqueKey;
1160
+ return {
1161
+ orderKey: BigInt(cursor.orderKey),
1162
+ uniqueKey
1163
+ };
1164
+ }
1165
+ return {
1166
+ orderKey: BigInt(cursor.orderKey)
1167
+ };
1168
+ }
1169
+
1170
+ const DataFinality = schema.Schema.transform(
1171
+ schema.Schema.Enums(DataFinality$1),
1172
+ schema.Schema.Literal("finalized", "accepted", "pending", "unknown"),
1173
+ {
1174
+ decode(value) {
1175
+ const enumMap = {
1176
+ [DataFinality$1.FINALIZED]: "finalized",
1177
+ [DataFinality$1.ACCEPTED]: "accepted",
1178
+ [DataFinality$1.PENDING]: "pending",
1179
+ [DataFinality$1.UNKNOWN]: "unknown",
1180
+ [DataFinality$1.UNRECOGNIZED]: "unknown"
1181
+ };
1182
+ return enumMap[value] ?? "unknown";
1183
+ },
1184
+ encode(value) {
1185
+ const enumMap = {
1186
+ finalized: DataFinality$1.FINALIZED,
1187
+ accepted: DataFinality$1.ACCEPTED,
1188
+ pending: DataFinality$1.PENDING,
1189
+ unknown: DataFinality$1.UNKNOWN
1190
+ };
1191
+ return enumMap[value] ?? DataFinality$1.UNKNOWN;
1192
+ }
1193
+ }
1194
+ );
1195
+ const DataProduction = schema.Schema.transform(
1196
+ schema.Schema.Enums(DataProduction$1),
1197
+ schema.Schema.Literal("backfill", "live", "unknown"),
1198
+ {
1199
+ decode(value) {
1200
+ const enumMap = {
1201
+ [DataProduction$1.BACKFILL]: "backfill",
1202
+ [DataProduction$1.LIVE]: "live",
1203
+ [DataProduction$1.UNKNOWN]: "unknown",
1204
+ [DataProduction$1.UNRECOGNIZED]: "unknown"
1205
+ };
1206
+ return enumMap[value] ?? "unknown";
1207
+ },
1208
+ encode(value) {
1209
+ const enumMap = {
1210
+ backfill: DataProduction$1.BACKFILL,
1211
+ live: DataProduction$1.LIVE,
1212
+ unknown: DataProduction$1.UNKNOWN
1213
+ };
1214
+ return enumMap[value] ?? DataProduction$1.UNKNOWN;
1215
+ }
1216
+ }
1217
+ );
1218
+ const Duration = schema.Schema.Struct({
1219
+ seconds: schema.Schema.BigIntFromSelf,
1220
+ nanos: schema.Schema.Number
1221
+ });
1222
+ const StreamDataRequest = (filter) => schema.Schema.Struct({
1223
+ finality: schema.Schema.optional(DataFinality),
1224
+ startingCursor: schema.Schema.optional(Cursor),
1225
+ filter: schema.Schema.mutable(schema.Schema.Array(filter)),
1226
+ heartbeatInterval: schema.Schema.optional(Duration)
1227
+ });
1228
+ const Invalidate = schema.Schema.Struct({
1229
+ _tag: tag("invalidate"),
1230
+ invalidate: schema.Schema.Struct({
1231
+ cursor: schema.Schema.optional(Cursor)
1232
+ })
1233
+ });
1234
+ const Finalize = schema.Schema.Struct({
1235
+ _tag: tag("finalize"),
1236
+ finalize: schema.Schema.Struct({
1237
+ cursor: schema.Schema.optional(Cursor)
1238
+ })
1239
+ });
1240
+ const Heartbeat = schema.Schema.Struct({
1241
+ _tag: tag("heartbeat")
1242
+ });
1243
+ const StdOut = schema.Schema.Struct({
1244
+ _tag: tag("stdout"),
1245
+ stdout: schema.Schema.String
1246
+ });
1247
+ const StdErr = schema.Schema.Struct({
1248
+ _tag: tag("stderr"),
1249
+ stderr: schema.Schema.String
1250
+ });
1251
+ const SystemMessage = schema.Schema.Struct({
1252
+ _tag: tag("systemMessage"),
1253
+ systemMessage: schema.Schema.Struct({
1254
+ output: schema.Schema.Union(StdOut, StdErr)
1255
+ })
1256
+ });
1257
+ const Data = (schema$1) => schema.Schema.Struct({
1258
+ _tag: tag("data"),
1259
+ data: schema.Schema.Struct({
1260
+ cursor: schema.Schema.optional(Cursor),
1261
+ endCursor: Cursor,
1262
+ finality: DataFinality,
1263
+ production: DataProduction,
1264
+ data: schema.Schema.Array(schema$1)
1265
+ })
1266
+ });
1267
+ const StreamDataResponse = (data) => schema.Schema.Union(Data(data), Invalidate, Finalize, Heartbeat, SystemMessage);
1268
+ schema.Schema.Union(
1269
+ Invalidate,
1270
+ Finalize,
1271
+ Heartbeat,
1272
+ SystemMessage
1273
+ );
1274
+ function tag(tag2) {
1275
+ return schema.Schema.Literal(tag2).pipe(
1276
+ schema.Schema.propertySignature,
1277
+ schema.Schema.fromKey("$case")
1278
+ );
1279
+ }
1280
+
1281
+ var __defProp = Object.defineProperty;
1282
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1283
+ var __publicField = (obj, key, value) => {
1284
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1285
+ return value;
1286
+ };
1287
+ class StreamConfig {
1288
+ constructor(filter, block, mergeFilter) {
1289
+ this.filter = filter;
1290
+ this.block = block;
1291
+ this.mergeFilter = mergeFilter;
1292
+ __publicField(this, "request");
1293
+ __publicField(this, "response");
1294
+ this.request = StreamDataRequest(this.filter);
1295
+ this.response = StreamDataResponse(this.block);
1296
+ }
1297
+ /** Filter schema. */
1298
+ get Filter() {
1299
+ return this.filter;
1300
+ }
1301
+ /** Block schema. */
1302
+ get Block() {
1303
+ return this.block;
1304
+ }
1305
+ /** Stream data request schema. */
1306
+ get Request() {
1307
+ return this.request;
1308
+ }
1309
+ /** Stream data response schema. */
1310
+ get Response() {
1311
+ return this.response;
1312
+ }
1313
+ }
1314
+
1315
+ exports.Bytes = Bytes;
1316
+ exports.BytesFromUint8Array = BytesFromUint8Array;
1317
+ exports.Cursor = Cursor;
1318
+ exports.CursorFromBytes = CursorFromBytes;
1319
+ exports.Data = Data;
1320
+ exports.DataFinality = DataFinality;
1321
+ exports.DataProduction = DataProduction;
1322
+ exports.DnaStreamDefinition = DnaStreamDefinition;
1323
+ exports.Duration = Duration;
1324
+ exports.Finalize = Finalize;
1325
+ exports.Heartbeat = Heartbeat;
1326
+ exports.Invalidate = Invalidate;
1327
+ exports.MockBlock = MockBlock;
1328
+ exports.MockFilter = MockFilter;
1329
+ exports.StdErr = StdErr;
1330
+ exports.StdOut = StdOut;
1331
+ exports.StreamConfig = StreamConfig;
1332
+ exports.StreamDataRequest = StreamDataRequest;
1333
+ exports.StreamDataResponse = StreamDataResponse;
1334
+ exports.SystemMessage = SystemMessage;
1335
+ exports._Cursor = _Cursor;
1336
+ exports.createCursor = createCursor;
1337
+ exports.cursorFromBytes = cursorFromBytes;
1338
+ exports.cursorFromProto = cursorFromProto;
1339
+ exports.cursorToBytes = cursorToBytes;
1340
+ exports.cursorToProto = cursorToProto;
1341
+ exports.isCursor = isCursor;
1342
+ exports.normalizeCursor = normalizeCursor;
1343
+ exports.stream = stream;
1344
+ exports.testing = testing;