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

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