@apibara/protocol 2.1.0-beta.5 → 2.1.0-beta.51

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.
Files changed (65) hide show
  1. package/dist/codec.cjs +242 -0
  2. package/dist/codec.cjs.map +1 -0
  3. package/dist/codec.d.cts +81 -0
  4. package/dist/codec.d.mts +81 -0
  5. package/dist/codec.d.ts +81 -0
  6. package/dist/codec.mjs +224 -0
  7. package/dist/codec.mjs.map +1 -0
  8. package/dist/index.cjs +45 -30
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +5 -5
  11. package/dist/index.d.mts +5 -5
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.mjs +41 -22
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/rpc/index.cjs +12 -0
  16. package/dist/rpc/index.cjs.map +1 -0
  17. package/dist/rpc/index.d.cts +6 -0
  18. package/dist/rpc/index.d.mts +6 -0
  19. package/dist/rpc/index.d.ts +6 -0
  20. package/dist/rpc/index.mjs +3 -0
  21. package/dist/rpc/index.mjs.map +1 -0
  22. package/dist/shared/{protocol.4b1cfe2c.d.cts → protocol.0e734e33.d.cts} +400 -247
  23. package/dist/shared/{protocol.4b1cfe2c.d.mts → protocol.21e66b9e.d.mts} +400 -247
  24. package/dist/shared/{protocol.e39e40d6.cjs → protocol.53f81a1e.cjs} +177 -177
  25. package/dist/shared/protocol.53f81a1e.cjs.map +1 -0
  26. package/dist/shared/protocol.54f17699.cjs +536 -0
  27. package/dist/shared/protocol.54f17699.cjs.map +1 -0
  28. package/dist/shared/{protocol.991ff9ad.mjs → protocol.68fdd897.mjs} +176 -171
  29. package/dist/shared/protocol.68fdd897.mjs.map +1 -0
  30. package/dist/shared/protocol.6ab8d6dd.d.mts +104 -0
  31. package/dist/shared/protocol.7aa4aab6.d.cts +104 -0
  32. package/dist/shared/protocol.8407f25e.d.ts +104 -0
  33. package/dist/shared/{protocol.4b1cfe2c.d.ts → protocol.8fb09325.d.ts} +400 -247
  34. package/dist/shared/protocol.bde61588.mjs +530 -0
  35. package/dist/shared/protocol.bde61588.mjs.map +1 -0
  36. package/dist/testing/index.cjs +26 -38
  37. package/dist/testing/index.cjs.map +1 -0
  38. package/dist/testing/index.d.cts +107 -54
  39. package/dist/testing/index.d.mts +107 -54
  40. package/dist/testing/index.d.ts +107 -54
  41. package/dist/testing/index.mjs +26 -38
  42. package/dist/testing/index.mjs.map +1 -0
  43. package/package.json +14 -3
  44. package/src/client.ts +39 -14
  45. package/src/codec.ts +662 -0
  46. package/src/common.ts +70 -53
  47. package/src/config.ts +4 -4
  48. package/src/index.ts +2 -0
  49. package/src/proto/google/protobuf/duration.ts +8 -6
  50. package/src/proto/stream.ts +38 -24
  51. package/src/rpc/chain-tracker.ts +327 -0
  52. package/src/rpc/client.ts +51 -0
  53. package/src/rpc/config.ts +88 -0
  54. package/src/rpc/data-stream.ts +366 -0
  55. package/src/rpc/helpers.ts +9 -0
  56. package/src/rpc/index.ts +13 -0
  57. package/src/status.ts +9 -16
  58. package/src/stream.ts +145 -144
  59. package/src/testing/mock.ts +36 -38
  60. package/src/common.test.ts +0 -67
  61. package/src/status.test.ts +0 -51
  62. package/src/stream.test-d.ts +0 -33
  63. package/src/stream.test.ts +0 -254
  64. package/src/testing/client.test.ts +0 -97
  65. package/src/testing/mock.test.ts +0 -35
@@ -1,21 +1,20 @@
1
1
  import _m0 from 'protobufjs/minimal.js';
2
- import { Schema } from '@effect/schema';
3
- import { Option } from 'effect';
2
+ import { MessageCodec, BigIntCodec, NumberCodec, OptionalCodec, MutableArrayCodec, UndefinedCodec, StringCodec, OneOfCodec, ArrayCodec } from '../codec.mjs';
4
3
  import { toHex, hexToBytes } from 'viem';
5
4
  import Long from 'long';
6
5
 
7
6
  function createBaseDuration() {
8
7
  return { seconds: BigInt("0"), nanos: 0 };
9
8
  }
10
- const Duration$1 = {
9
+ const Duration = {
11
10
  encode(message, writer = _m0.Writer.create()) {
12
- if (message.seconds !== BigInt("0")) {
11
+ if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
13
12
  if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
14
13
  throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
15
14
  }
16
15
  writer.uint32(8).int64(message.seconds.toString());
17
16
  }
18
- if (message.nanos !== 0) {
17
+ if (message.nanos !== void 0 && message.nanos !== 0) {
19
18
  writer.uint32(16).int32(message.nanos);
20
19
  }
21
20
  return writer;
@@ -55,16 +54,16 @@ const Duration$1 = {
55
54
  },
56
55
  toJSON(message) {
57
56
  const obj = {};
58
- if (message.seconds !== BigInt("0")) {
57
+ if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
59
58
  obj.seconds = message.seconds.toString();
60
59
  }
61
- if (message.nanos !== 0) {
60
+ if (message.nanos !== void 0 && message.nanos !== 0) {
62
61
  obj.nanos = Math.round(message.nanos);
63
62
  }
64
63
  return obj;
65
64
  },
66
65
  create(base) {
67
- return Duration$1.fromPartial(base ?? {});
66
+ return Duration.fromPartial(base ?? {});
68
67
  },
69
68
  fromPartial(object) {
70
69
  const message = createBaseDuration();
@@ -170,13 +169,13 @@ function createBaseCursor() {
170
169
  }
171
170
  const Cursor$1 = {
172
171
  encode(message, writer = _m0.Writer.create()) {
173
- if (message.orderKey !== BigInt("0")) {
172
+ if (message.orderKey !== void 0 && message.orderKey !== BigInt("0")) {
174
173
  if (BigInt.asUintN(64, message.orderKey) !== message.orderKey) {
175
174
  throw new globalThis.Error("value provided for field message.orderKey of type uint64 too large");
176
175
  }
177
176
  writer.uint32(8).uint64(message.orderKey.toString());
178
177
  }
179
- if (message.uniqueKey.length !== 0) {
178
+ if (message.uniqueKey !== void 0 && message.uniqueKey.length !== 0) {
180
179
  writer.uint32(18).bytes(message.uniqueKey);
181
180
  }
182
181
  return writer;
@@ -216,10 +215,10 @@ const Cursor$1 = {
216
215
  },
217
216
  toJSON(message) {
218
217
  const obj = {};
219
- if (message.orderKey !== BigInt("0")) {
218
+ if (message.orderKey !== void 0 && message.orderKey !== BigInt("0")) {
220
219
  obj.orderKey = message.orderKey.toString();
221
220
  }
222
- if (message.uniqueKey.length !== 0) {
221
+ if (message.uniqueKey !== void 0 && message.uniqueKey.length !== 0) {
223
222
  obj.uniqueKey = base64FromBytes(message.uniqueKey);
224
223
  }
225
224
  return obj;
@@ -374,11 +373,13 @@ const StreamDataRequest$1 = {
374
373
  if (message.finality !== void 0) {
375
374
  writer.uint32(16).int32(message.finality);
376
375
  }
377
- for (const v of message.filter) {
378
- writer.uint32(26).bytes(v);
376
+ if (message.filter !== void 0 && message.filter.length !== 0) {
377
+ for (const v of message.filter) {
378
+ writer.uint32(26).bytes(v);
379
+ }
379
380
  }
380
381
  if (message.heartbeatInterval !== void 0) {
381
- Duration$1.encode(message.heartbeatInterval, writer.uint32(34).fork()).ldelim();
382
+ Duration.encode(message.heartbeatInterval, writer.uint32(34).fork()).ldelim();
382
383
  }
383
384
  return writer;
384
385
  },
@@ -411,7 +412,7 @@ const StreamDataRequest$1 = {
411
412
  if (tag !== 34) {
412
413
  break;
413
414
  }
414
- message.heartbeatInterval = Duration$1.decode(reader, reader.uint32());
415
+ message.heartbeatInterval = Duration.decode(reader, reader.uint32());
415
416
  continue;
416
417
  }
417
418
  if ((tag & 7) === 4 || tag === 0) {
@@ -426,7 +427,7 @@ const StreamDataRequest$1 = {
426
427
  startingCursor: isSet$1(object.startingCursor) ? Cursor$1.fromJSON(object.startingCursor) : void 0,
427
428
  finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : void 0,
428
429
  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
+ heartbeatInterval: isSet$1(object.heartbeatInterval) ? Duration.fromJSON(object.heartbeatInterval) : void 0
430
431
  };
431
432
  },
432
433
  toJSON(message) {
@@ -441,7 +442,7 @@ const StreamDataRequest$1 = {
441
442
  obj.filter = message.filter.map((e) => base64FromBytes(e));
442
443
  }
443
444
  if (message.heartbeatInterval !== void 0) {
444
- obj.heartbeatInterval = Duration$1.toJSON(message.heartbeatInterval);
445
+ obj.heartbeatInterval = Duration.toJSON(message.heartbeatInterval);
445
446
  }
446
447
  return obj;
447
448
  },
@@ -453,7 +454,7 @@ const StreamDataRequest$1 = {
453
454
  message.startingCursor = object.startingCursor !== void 0 && object.startingCursor !== null ? Cursor$1.fromPartial(object.startingCursor) : void 0;
454
455
  message.finality = object.finality ?? void 0;
455
456
  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
+ message.heartbeatInterval = object.heartbeatInterval !== void 0 && object.heartbeatInterval !== null ? Duration.fromPartial(object.heartbeatInterval) : void 0;
457
458
  return message;
458
459
  }
459
460
  };
@@ -584,8 +585,10 @@ const Invalidate$1 = {
584
585
  if (message.cursor !== void 0) {
585
586
  Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
586
587
  }
587
- for (const v of message.removed) {
588
- Cursor$1.encode(v, writer.uint32(18).fork()).ldelim();
588
+ if (message.removed !== void 0 && message.removed.length !== 0) {
589
+ for (const v of message.removed) {
590
+ Cursor$1.encode(v, writer.uint32(18).fork()).ldelim();
591
+ }
589
592
  }
590
593
  return writer;
591
594
  },
@@ -703,13 +706,15 @@ const Data$1 = {
703
706
  if (message.endCursor !== void 0) {
704
707
  Cursor$1.encode(message.endCursor, writer.uint32(18).fork()).ldelim();
705
708
  }
706
- if (message.finality !== 0) {
709
+ if (message.finality !== void 0 && message.finality !== 0) {
707
710
  writer.uint32(24).int32(message.finality);
708
711
  }
709
- for (const v of message.data) {
710
- writer.uint32(34).bytes(v);
712
+ if (message.data !== void 0 && message.data.length !== 0) {
713
+ for (const v of message.data) {
714
+ writer.uint32(34).bytes(v);
715
+ }
711
716
  }
712
- if (message.production !== 0) {
717
+ if (message.production !== void 0 && message.production !== 0) {
713
718
  writer.uint32(40).int32(message.production);
714
719
  }
715
720
  return writer;
@@ -776,13 +781,13 @@ const Data$1 = {
776
781
  if (message.endCursor !== void 0) {
777
782
  obj.endCursor = Cursor$1.toJSON(message.endCursor);
778
783
  }
779
- if (message.finality !== 0) {
784
+ if (message.finality !== void 0 && message.finality !== 0) {
780
785
  obj.finality = dataFinalityToJSON(message.finality);
781
786
  }
782
787
  if (message.data?.length) {
783
788
  obj.data = message.data.map((e) => base64FromBytes(e));
784
789
  }
785
- if (message.production !== 0) {
790
+ if (message.production !== void 0 && message.production !== 0) {
786
791
  obj.production = dataProductionToJSON(message.production);
787
792
  }
788
793
  return obj;
@@ -1098,54 +1103,59 @@ const testing = {
1098
1103
  protobufPackage: protobufPackage
1099
1104
  };
1100
1105
 
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
- );
1106
+ const BytesFromUint8Array = {
1107
+ decode(value) {
1108
+ if (!value || value?.length === 0) {
1109
+ return void 0;
1110
+ }
1111
+ return toHex(value);
1112
+ },
1113
+ encode(value) {
1114
+ if (value === void 0) {
1115
+ return new Uint8Array(0);
1120
1116
  }
1117
+ return hexToBytes(value);
1121
1118
  }
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;
1119
+ };
1120
+ const Cursor = {
1121
+ decode(value) {
1122
+ const { orderKey, uniqueKey } = value;
1123
+ return {
1124
+ orderKey: orderKey ?? 0n,
1125
+ uniqueKey: BytesFromUint8Array.decode(uniqueKey)
1126
+ };
1127
+ },
1128
+ encode(value) {
1129
+ const { orderKey, uniqueKey } = value;
1130
+ return {
1131
+ orderKey,
1132
+ uniqueKey: BytesFromUint8Array.encode(uniqueKey)
1133
+ };
1134
+ }
1135
+ };
1130
1136
  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
- }
1137
+ const CursorFromBytes = {
1138
+ encode(value) {
1139
+ const { orderKey, uniqueKey } = value;
1140
+ return Cursor$1.encode({
1141
+ orderKey,
1142
+ uniqueKey: BytesFromUint8Array.encode(uniqueKey)
1143
+ }).finish();
1144
+ },
1145
+ decode(value) {
1146
+ const { orderKey, uniqueKey } = Cursor$1.decode(value);
1147
+ return {
1148
+ orderKey: orderKey ?? 0n,
1149
+ uniqueKey: BytesFromUint8Array.decode(uniqueKey)
1150
+ };
1143
1151
  }
1144
- );
1145
- const cursorToBytes = Schema.encodeSync(CursorFromBytes);
1146
- const cursorFromBytes = Schema.decodeSync(CursorFromBytes);
1152
+ };
1147
1153
  function isCursor(value) {
1148
- return Schema.is(Cursor)(value);
1154
+ if (typeof value !== "object" || value === null) {
1155
+ return false;
1156
+ }
1157
+ const { orderKey, uniqueKey } = value;
1158
+ return typeof orderKey === "bigint" && (uniqueKey === null || uniqueKey === void 0 || typeof uniqueKey === "string" && uniqueKey.startsWith("0x"));
1149
1159
  }
1150
1160
  function normalizeCursor(cursor) {
1151
1161
  if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
@@ -1160,116 +1170,109 @@ function normalizeCursor(cursor) {
1160
1170
  };
1161
1171
  }
1162
1172
 
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
- }
1173
+ const DataFinality = {
1174
+ encode(x) {
1175
+ const enumMap = {
1176
+ finalized: DataFinality$1.FINALIZED,
1177
+ accepted: DataFinality$1.ACCEPTED,
1178
+ pending: DataFinality$1.PENDING,
1179
+ unknown: DataFinality$1.UNKNOWN
1180
+ };
1181
+ return enumMap[x] ?? DataFinality$1.UNKNOWN;
1182
+ },
1183
+ decode(p) {
1184
+ const enumMap = {
1185
+ [DataFinality$1.FINALIZED]: "finalized",
1186
+ [DataFinality$1.ACCEPTED]: "accepted",
1187
+ [DataFinality$1.PENDING]: "pending",
1188
+ [DataFinality$1.UNKNOWN]: "unknown",
1189
+ [DataFinality$1.UNRECOGNIZED]: "unknown"
1190
+ };
1191
+ return enumMap[p] ?? "unknown";
1186
1192
  }
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
- }
1193
+ };
1194
+ const DataProduction = {
1195
+ encode(x) {
1196
+ switch (x) {
1197
+ case "backfill":
1198
+ return DataProduction$1.BACKFILL;
1199
+ case "live":
1200
+ return DataProduction$1.LIVE;
1201
+ case "unknown":
1202
+ return DataProduction$1.UNKNOWN;
1203
+ default:
1204
+ return DataProduction$1.UNRECOGNIZED;
1205
+ }
1206
+ },
1207
+ decode(p) {
1208
+ const enumMap = {
1209
+ [DataProduction$1.BACKFILL]: "backfill",
1210
+ [DataProduction$1.LIVE]: "live",
1211
+ [DataProduction$1.UNKNOWN]: "unknown",
1212
+ [DataProduction$1.UNRECOGNIZED]: "unknown"
1213
+ };
1214
+ return enumMap[p] ?? "unknown";
1209
1215
  }
1210
- );
1211
- const Duration = Schema.Struct({
1212
- seconds: Schema.BigIntFromSelf,
1213
- nanos: Schema.Number
1216
+ };
1217
+ const DurationCodec = MessageCodec({
1218
+ seconds: BigIntCodec,
1219
+ nanos: NumberCodec
1214
1220
  });
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)
1221
+ const StreamDataRequest = (filter) => MessageCodec({
1222
+ finality: OptionalCodec(DataFinality),
1223
+ startingCursor: OptionalCodec(Cursor),
1224
+ filter: MutableArrayCodec(filter),
1225
+ heartbeatInterval: OptionalCodec(DurationCodec)
1220
1226
  });
1221
- const Invalidate = Schema.Struct({
1222
- _tag: tag("invalidate"),
1223
- invalidate: Schema.Struct({
1224
- cursor: Schema.optional(Cursor)
1225
- })
1227
+ const Invalidate = MessageCodec({
1228
+ cursor: OptionalCodec(Cursor)
1226
1229
  });
1227
- const Finalize = Schema.Struct({
1228
- _tag: tag("finalize"),
1229
- finalize: Schema.Struct({
1230
- cursor: Schema.optional(Cursor)
1231
- })
1230
+ const Finalize = MessageCodec({
1231
+ cursor: OptionalCodec(Cursor)
1232
1232
  });
1233
- const Heartbeat = Schema.Struct({
1234
- _tag: tag("heartbeat")
1233
+ const Heartbeat = UndefinedCodec;
1234
+ const StdOut = StringCodec;
1235
+ const StdErr = StringCodec;
1236
+ const SystemMessage = MessageCodec({
1237
+ output: OneOfCodec({
1238
+ stdout: StdOut,
1239
+ stderr: StdErr
1240
+ })
1235
1241
  });
1236
- const StdOut = Schema.Struct({
1237
- _tag: tag("stdout"),
1238
- stdout: Schema.String
1242
+ const _DataOrNull = (schema) => ({
1243
+ encode(x) {
1244
+ if (x === null) {
1245
+ return new Uint8Array();
1246
+ }
1247
+ return schema.encode(x);
1248
+ },
1249
+ decode(p) {
1250
+ if (p.length === 0) {
1251
+ return null;
1252
+ }
1253
+ return schema.decode(p);
1254
+ }
1239
1255
  });
1240
- const StdErr = Schema.Struct({
1241
- _tag: tag("stderr"),
1242
- stderr: Schema.String
1256
+ const Data = (schema) => MessageCodec({
1257
+ cursor: OptionalCodec(Cursor),
1258
+ endCursor: Cursor,
1259
+ finality: DataFinality,
1260
+ production: DataProduction,
1261
+ data: ArrayCodec(_DataOrNull(schema))
1243
1262
  });
1244
- const SystemMessage = Schema.Struct({
1245
- _tag: tag("systemMessage"),
1246
- systemMessage: Schema.Struct({
1247
- output: Schema.Union(StdOut, StdErr)
1248
- })
1263
+ const StreamDataResponse = (schema) => OneOfCodec({
1264
+ data: Data(schema),
1265
+ invalidate: Invalidate,
1266
+ finalize: Finalize,
1267
+ heartbeat: Heartbeat,
1268
+ systemMessage: SystemMessage
1249
1269
  });
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
- })
1270
+ const ResponseWithoutData = OneOfCodec({
1271
+ invalidate: Invalidate,
1272
+ finalize: Finalize,
1273
+ heartbeat: Heartbeat,
1274
+ systemMessage: SystemMessage
1259
1275
  });
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
1276
 
1274
1277
  var __defProp = Object.defineProperty;
1275
1278
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -1278,10 +1281,11 @@ var __publicField = (obj, key, value) => {
1278
1281
  return value;
1279
1282
  };
1280
1283
  class StreamConfig {
1281
- constructor(filter, block, mergeFilter) {
1284
+ constructor(filter, block, mergeFilter, name) {
1282
1285
  this.filter = filter;
1283
1286
  this.block = block;
1284
1287
  this.mergeFilter = mergeFilter;
1288
+ this.name = name;
1285
1289
  __publicField(this, "request");
1286
1290
  __publicField(this, "response");
1287
1291
  this.request = StreamDataRequest(this.filter);
@@ -1305,4 +1309,5 @@ class StreamConfig {
1305
1309
  }
1306
1310
  }
1307
1311
 
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 };
1312
+ export { BytesFromUint8Array as B, Cursor as C, DnaStreamDefinition as D, Finalize as F, Heartbeat as H, Invalidate as I, MockFilter as M, ResponseWithoutData as R, StreamDataResponse as S, CursorFromBytes as a, DataFinality as b, createCursor as c, DataProduction as d, DurationCodec as e, StreamDataRequest as f, StdOut as g, StdErr as h, isCursor as i, SystemMessage as j, Data as k, StreamConfig as l, MockBlock as m, normalizeCursor as n, stream as s, testing as t };
1313
+ //# sourceMappingURL=protocol.68fdd897.mjs.map