@apibara/protocol 2.1.0-beta.4 → 2.1.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.
- package/dist/codec.cjs +242 -0
- package/dist/codec.cjs.map +1 -0
- package/dist/codec.d.cts +81 -0
- package/dist/codec.d.mts +81 -0
- package/dist/codec.d.ts +81 -0
- package/dist/codec.mjs +224 -0
- package/dist/codec.mjs.map +1 -0
- package/dist/index.cjs +43 -30
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +40 -22
- package/dist/index.mjs.map +1 -0
- package/dist/shared/{protocol.4b1cfe2c.d.cts → protocol.0e734e33.d.cts} +400 -247
- package/dist/shared/{protocol.4b1cfe2c.d.mts → protocol.21e66b9e.d.mts} +400 -247
- package/dist/shared/{protocol.e39e40d6.cjs → protocol.53f81a1e.cjs} +177 -177
- package/dist/shared/protocol.53f81a1e.cjs.map +1 -0
- package/dist/shared/{protocol.991ff9ad.mjs → protocol.68fdd897.mjs} +176 -171
- package/dist/shared/protocol.68fdd897.mjs.map +1 -0
- package/dist/shared/{protocol.4b1cfe2c.d.ts → protocol.8fb09325.d.ts} +400 -247
- package/dist/testing/index.cjs +26 -38
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +107 -54
- package/dist/testing/index.d.mts +107 -54
- package/dist/testing/index.d.ts +107 -54
- package/dist/testing/index.mjs +26 -38
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +8 -3
- package/src/client.ts +39 -14
- package/src/codec.ts +662 -0
- package/src/common.ts +70 -53
- package/src/config.ts +4 -4
- package/src/proto/google/protobuf/duration.ts +8 -6
- package/src/proto/stream.ts +38 -24
- package/src/status.ts +9 -16
- package/src/stream.ts +145 -144
- package/src/testing/mock.ts +36 -38
- package/src/common.test.ts +0 -67
- package/src/status.test.ts +0 -51
- package/src/stream.test-d.ts +0 -33
- package/src/stream.test.ts +0 -254
- package/src/testing/client.test.ts +0 -97
- package/src/testing/mock.test.ts +0 -35
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const _m0 = require('protobufjs/minimal.js');
|
|
4
|
-
const
|
|
5
|
-
const effect = require('effect');
|
|
4
|
+
const codec = require('../codec.cjs');
|
|
6
5
|
const viem = require('viem');
|
|
7
6
|
const Long = require('long');
|
|
8
7
|
|
|
@@ -14,15 +13,15 @@ const Long__default = /*#__PURE__*/_interopDefaultCompat(Long);
|
|
|
14
13
|
function createBaseDuration() {
|
|
15
14
|
return { seconds: BigInt("0"), nanos: 0 };
|
|
16
15
|
}
|
|
17
|
-
const Duration
|
|
16
|
+
const Duration = {
|
|
18
17
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
19
|
-
if (message.seconds !== BigInt("0")) {
|
|
18
|
+
if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
|
|
20
19
|
if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
|
|
21
20
|
throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
|
|
22
21
|
}
|
|
23
22
|
writer.uint32(8).int64(message.seconds.toString());
|
|
24
23
|
}
|
|
25
|
-
if (message.nanos !== 0) {
|
|
24
|
+
if (message.nanos !== void 0 && message.nanos !== 0) {
|
|
26
25
|
writer.uint32(16).int32(message.nanos);
|
|
27
26
|
}
|
|
28
27
|
return writer;
|
|
@@ -62,16 +61,16 @@ const Duration$1 = {
|
|
|
62
61
|
},
|
|
63
62
|
toJSON(message) {
|
|
64
63
|
const obj = {};
|
|
65
|
-
if (message.seconds !== BigInt("0")) {
|
|
64
|
+
if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
|
|
66
65
|
obj.seconds = message.seconds.toString();
|
|
67
66
|
}
|
|
68
|
-
if (message.nanos !== 0) {
|
|
67
|
+
if (message.nanos !== void 0 && message.nanos !== 0) {
|
|
69
68
|
obj.nanos = Math.round(message.nanos);
|
|
70
69
|
}
|
|
71
70
|
return obj;
|
|
72
71
|
},
|
|
73
72
|
create(base) {
|
|
74
|
-
return Duration
|
|
73
|
+
return Duration.fromPartial(base ?? {});
|
|
75
74
|
},
|
|
76
75
|
fromPartial(object) {
|
|
77
76
|
const message = createBaseDuration();
|
|
@@ -177,13 +176,13 @@ function createBaseCursor() {
|
|
|
177
176
|
}
|
|
178
177
|
const Cursor$1 = {
|
|
179
178
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
180
|
-
if (message.orderKey !== BigInt("0")) {
|
|
179
|
+
if (message.orderKey !== void 0 && message.orderKey !== BigInt("0")) {
|
|
181
180
|
if (BigInt.asUintN(64, message.orderKey) !== message.orderKey) {
|
|
182
181
|
throw new globalThis.Error("value provided for field message.orderKey of type uint64 too large");
|
|
183
182
|
}
|
|
184
183
|
writer.uint32(8).uint64(message.orderKey.toString());
|
|
185
184
|
}
|
|
186
|
-
if (message.uniqueKey.length !== 0) {
|
|
185
|
+
if (message.uniqueKey !== void 0 && message.uniqueKey.length !== 0) {
|
|
187
186
|
writer.uint32(18).bytes(message.uniqueKey);
|
|
188
187
|
}
|
|
189
188
|
return writer;
|
|
@@ -223,10 +222,10 @@ const Cursor$1 = {
|
|
|
223
222
|
},
|
|
224
223
|
toJSON(message) {
|
|
225
224
|
const obj = {};
|
|
226
|
-
if (message.orderKey !== BigInt("0")) {
|
|
225
|
+
if (message.orderKey !== void 0 && message.orderKey !== BigInt("0")) {
|
|
227
226
|
obj.orderKey = message.orderKey.toString();
|
|
228
227
|
}
|
|
229
|
-
if (message.uniqueKey.length !== 0) {
|
|
228
|
+
if (message.uniqueKey !== void 0 && message.uniqueKey.length !== 0) {
|
|
230
229
|
obj.uniqueKey = base64FromBytes(message.uniqueKey);
|
|
231
230
|
}
|
|
232
231
|
return obj;
|
|
@@ -381,11 +380,13 @@ const StreamDataRequest$1 = {
|
|
|
381
380
|
if (message.finality !== void 0) {
|
|
382
381
|
writer.uint32(16).int32(message.finality);
|
|
383
382
|
}
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
if (message.filter !== void 0 && message.filter.length !== 0) {
|
|
384
|
+
for (const v of message.filter) {
|
|
385
|
+
writer.uint32(26).bytes(v);
|
|
386
|
+
}
|
|
386
387
|
}
|
|
387
388
|
if (message.heartbeatInterval !== void 0) {
|
|
388
|
-
Duration
|
|
389
|
+
Duration.encode(message.heartbeatInterval, writer.uint32(34).fork()).ldelim();
|
|
389
390
|
}
|
|
390
391
|
return writer;
|
|
391
392
|
},
|
|
@@ -418,7 +419,7 @@ const StreamDataRequest$1 = {
|
|
|
418
419
|
if (tag !== 34) {
|
|
419
420
|
break;
|
|
420
421
|
}
|
|
421
|
-
message.heartbeatInterval = Duration
|
|
422
|
+
message.heartbeatInterval = Duration.decode(reader, reader.uint32());
|
|
422
423
|
continue;
|
|
423
424
|
}
|
|
424
425
|
if ((tag & 7) === 4 || tag === 0) {
|
|
@@ -433,7 +434,7 @@ const StreamDataRequest$1 = {
|
|
|
433
434
|
startingCursor: isSet$1(object.startingCursor) ? Cursor$1.fromJSON(object.startingCursor) : void 0,
|
|
434
435
|
finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : void 0,
|
|
435
436
|
filter: globalThis.Array.isArray(object?.filter) ? object.filter.map((e) => bytesFromBase64(e)) : [],
|
|
436
|
-
heartbeatInterval: isSet$1(object.heartbeatInterval) ? Duration
|
|
437
|
+
heartbeatInterval: isSet$1(object.heartbeatInterval) ? Duration.fromJSON(object.heartbeatInterval) : void 0
|
|
437
438
|
};
|
|
438
439
|
},
|
|
439
440
|
toJSON(message) {
|
|
@@ -448,7 +449,7 @@ const StreamDataRequest$1 = {
|
|
|
448
449
|
obj.filter = message.filter.map((e) => base64FromBytes(e));
|
|
449
450
|
}
|
|
450
451
|
if (message.heartbeatInterval !== void 0) {
|
|
451
|
-
obj.heartbeatInterval = Duration
|
|
452
|
+
obj.heartbeatInterval = Duration.toJSON(message.heartbeatInterval);
|
|
452
453
|
}
|
|
453
454
|
return obj;
|
|
454
455
|
},
|
|
@@ -460,7 +461,7 @@ const StreamDataRequest$1 = {
|
|
|
460
461
|
message.startingCursor = object.startingCursor !== void 0 && object.startingCursor !== null ? Cursor$1.fromPartial(object.startingCursor) : void 0;
|
|
461
462
|
message.finality = object.finality ?? void 0;
|
|
462
463
|
message.filter = object.filter?.map((e) => e) || [];
|
|
463
|
-
message.heartbeatInterval = object.heartbeatInterval !== void 0 && object.heartbeatInterval !== null ? Duration
|
|
464
|
+
message.heartbeatInterval = object.heartbeatInterval !== void 0 && object.heartbeatInterval !== null ? Duration.fromPartial(object.heartbeatInterval) : void 0;
|
|
464
465
|
return message;
|
|
465
466
|
}
|
|
466
467
|
};
|
|
@@ -591,8 +592,10 @@ const Invalidate$1 = {
|
|
|
591
592
|
if (message.cursor !== void 0) {
|
|
592
593
|
Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
|
|
593
594
|
}
|
|
594
|
-
|
|
595
|
-
|
|
595
|
+
if (message.removed !== void 0 && message.removed.length !== 0) {
|
|
596
|
+
for (const v of message.removed) {
|
|
597
|
+
Cursor$1.encode(v, writer.uint32(18).fork()).ldelim();
|
|
598
|
+
}
|
|
596
599
|
}
|
|
597
600
|
return writer;
|
|
598
601
|
},
|
|
@@ -710,13 +713,15 @@ const Data$1 = {
|
|
|
710
713
|
if (message.endCursor !== void 0) {
|
|
711
714
|
Cursor$1.encode(message.endCursor, writer.uint32(18).fork()).ldelim();
|
|
712
715
|
}
|
|
713
|
-
if (message.finality !== 0) {
|
|
716
|
+
if (message.finality !== void 0 && message.finality !== 0) {
|
|
714
717
|
writer.uint32(24).int32(message.finality);
|
|
715
718
|
}
|
|
716
|
-
|
|
717
|
-
|
|
719
|
+
if (message.data !== void 0 && message.data.length !== 0) {
|
|
720
|
+
for (const v of message.data) {
|
|
721
|
+
writer.uint32(34).bytes(v);
|
|
722
|
+
}
|
|
718
723
|
}
|
|
719
|
-
if (message.production !== 0) {
|
|
724
|
+
if (message.production !== void 0 && message.production !== 0) {
|
|
720
725
|
writer.uint32(40).int32(message.production);
|
|
721
726
|
}
|
|
722
727
|
return writer;
|
|
@@ -783,13 +788,13 @@ const Data$1 = {
|
|
|
783
788
|
if (message.endCursor !== void 0) {
|
|
784
789
|
obj.endCursor = Cursor$1.toJSON(message.endCursor);
|
|
785
790
|
}
|
|
786
|
-
if (message.finality !== 0) {
|
|
791
|
+
if (message.finality !== void 0 && message.finality !== 0) {
|
|
787
792
|
obj.finality = dataFinalityToJSON(message.finality);
|
|
788
793
|
}
|
|
789
794
|
if (message.data?.length) {
|
|
790
795
|
obj.data = message.data.map((e) => base64FromBytes(e));
|
|
791
796
|
}
|
|
792
|
-
if (message.production !== 0) {
|
|
797
|
+
if (message.production !== void 0 && message.production !== 0) {
|
|
793
798
|
obj.production = dataProductionToJSON(message.production);
|
|
794
799
|
}
|
|
795
800
|
return obj;
|
|
@@ -1105,54 +1110,59 @@ const testing = {
|
|
|
1105
1110
|
protobufPackage: protobufPackage
|
|
1106
1111
|
};
|
|
1107
1112
|
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
{
|
|
1116
|
-
|
|
1117
|
-
|
|
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
|
-
);
|
|
1113
|
+
const BytesFromUint8Array = {
|
|
1114
|
+
decode(value) {
|
|
1115
|
+
if (!value || value?.length === 0) {
|
|
1116
|
+
return void 0;
|
|
1117
|
+
}
|
|
1118
|
+
return viem.toHex(value);
|
|
1119
|
+
},
|
|
1120
|
+
encode(value) {
|
|
1121
|
+
if (value === void 0) {
|
|
1122
|
+
return new Uint8Array(0);
|
|
1127
1123
|
}
|
|
1124
|
+
return viem.hexToBytes(value);
|
|
1128
1125
|
}
|
|
1129
|
-
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1126
|
+
};
|
|
1127
|
+
const Cursor = {
|
|
1128
|
+
decode(value) {
|
|
1129
|
+
const { orderKey, uniqueKey } = value;
|
|
1130
|
+
return {
|
|
1131
|
+
orderKey: orderKey ?? 0n,
|
|
1132
|
+
uniqueKey: BytesFromUint8Array.decode(uniqueKey)
|
|
1133
|
+
};
|
|
1134
|
+
},
|
|
1135
|
+
encode(value) {
|
|
1136
|
+
const { orderKey, uniqueKey } = value;
|
|
1137
|
+
return {
|
|
1138
|
+
orderKey,
|
|
1139
|
+
uniqueKey: BytesFromUint8Array.encode(uniqueKey)
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1137
1143
|
const createCursor = (props) => props;
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1144
|
+
const CursorFromBytes = {
|
|
1145
|
+
encode(value) {
|
|
1146
|
+
const { orderKey, uniqueKey } = value;
|
|
1147
|
+
return Cursor$1.encode({
|
|
1148
|
+
orderKey,
|
|
1149
|
+
uniqueKey: BytesFromUint8Array.encode(uniqueKey)
|
|
1150
|
+
}).finish();
|
|
1151
|
+
},
|
|
1152
|
+
decode(value) {
|
|
1153
|
+
const { orderKey, uniqueKey } = Cursor$1.decode(value);
|
|
1154
|
+
return {
|
|
1155
|
+
orderKey: orderKey ?? 0n,
|
|
1156
|
+
uniqueKey: BytesFromUint8Array.decode(uniqueKey)
|
|
1157
|
+
};
|
|
1150
1158
|
}
|
|
1151
|
-
|
|
1152
|
-
const cursorToBytes = schema.Schema.encodeSync(CursorFromBytes);
|
|
1153
|
-
const cursorFromBytes = schema.Schema.decodeSync(CursorFromBytes);
|
|
1159
|
+
};
|
|
1154
1160
|
function isCursor(value) {
|
|
1155
|
-
|
|
1161
|
+
if (typeof value !== "object" || value === null) {
|
|
1162
|
+
return false;
|
|
1163
|
+
}
|
|
1164
|
+
const { orderKey, uniqueKey } = value;
|
|
1165
|
+
return typeof orderKey === "bigint" && (uniqueKey === null || uniqueKey === void 0 || typeof uniqueKey === "string" && uniqueKey.startsWith("0x"));
|
|
1156
1166
|
}
|
|
1157
1167
|
function normalizeCursor(cursor) {
|
|
1158
1168
|
if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
|
|
@@ -1167,116 +1177,109 @@ function normalizeCursor(cursor) {
|
|
|
1167
1177
|
};
|
|
1168
1178
|
}
|
|
1169
1179
|
|
|
1170
|
-
const DataFinality =
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
unknown: DataFinality$1.UNKNOWN
|
|
1190
|
-
};
|
|
1191
|
-
return enumMap[value] ?? DataFinality$1.UNKNOWN;
|
|
1192
|
-
}
|
|
1180
|
+
const DataFinality = {
|
|
1181
|
+
encode(x) {
|
|
1182
|
+
const enumMap = {
|
|
1183
|
+
finalized: DataFinality$1.FINALIZED,
|
|
1184
|
+
accepted: DataFinality$1.ACCEPTED,
|
|
1185
|
+
pending: DataFinality$1.PENDING,
|
|
1186
|
+
unknown: DataFinality$1.UNKNOWN
|
|
1187
|
+
};
|
|
1188
|
+
return enumMap[x] ?? DataFinality$1.UNKNOWN;
|
|
1189
|
+
},
|
|
1190
|
+
decode(p) {
|
|
1191
|
+
const enumMap = {
|
|
1192
|
+
[DataFinality$1.FINALIZED]: "finalized",
|
|
1193
|
+
[DataFinality$1.ACCEPTED]: "accepted",
|
|
1194
|
+
[DataFinality$1.PENDING]: "pending",
|
|
1195
|
+
[DataFinality$1.UNKNOWN]: "unknown",
|
|
1196
|
+
[DataFinality$1.UNRECOGNIZED]: "unknown"
|
|
1197
|
+
};
|
|
1198
|
+
return enumMap[p] ?? "unknown";
|
|
1193
1199
|
}
|
|
1194
|
-
|
|
1195
|
-
const DataProduction =
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1200
|
+
};
|
|
1201
|
+
const DataProduction = {
|
|
1202
|
+
encode(x) {
|
|
1203
|
+
switch (x) {
|
|
1204
|
+
case "backfill":
|
|
1205
|
+
return DataProduction$1.BACKFILL;
|
|
1206
|
+
case "live":
|
|
1207
|
+
return DataProduction$1.LIVE;
|
|
1208
|
+
case "unknown":
|
|
1209
|
+
return DataProduction$1.UNKNOWN;
|
|
1210
|
+
default:
|
|
1211
|
+
return DataProduction$1.UNRECOGNIZED;
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
decode(p) {
|
|
1215
|
+
const enumMap = {
|
|
1216
|
+
[DataProduction$1.BACKFILL]: "backfill",
|
|
1217
|
+
[DataProduction$1.LIVE]: "live",
|
|
1218
|
+
[DataProduction$1.UNKNOWN]: "unknown",
|
|
1219
|
+
[DataProduction$1.UNRECOGNIZED]: "unknown"
|
|
1220
|
+
};
|
|
1221
|
+
return enumMap[p] ?? "unknown";
|
|
1216
1222
|
}
|
|
1217
|
-
|
|
1218
|
-
const
|
|
1219
|
-
seconds:
|
|
1220
|
-
nanos:
|
|
1223
|
+
};
|
|
1224
|
+
const DurationCodec = codec.MessageCodec({
|
|
1225
|
+
seconds: codec.BigIntCodec,
|
|
1226
|
+
nanos: codec.NumberCodec
|
|
1221
1227
|
});
|
|
1222
|
-
const StreamDataRequest = (filter) =>
|
|
1223
|
-
finality:
|
|
1224
|
-
startingCursor:
|
|
1225
|
-
filter:
|
|
1226
|
-
heartbeatInterval:
|
|
1228
|
+
const StreamDataRequest = (filter) => codec.MessageCodec({
|
|
1229
|
+
finality: codec.OptionalCodec(DataFinality),
|
|
1230
|
+
startingCursor: codec.OptionalCodec(Cursor),
|
|
1231
|
+
filter: codec.MutableArrayCodec(filter),
|
|
1232
|
+
heartbeatInterval: codec.OptionalCodec(DurationCodec)
|
|
1227
1233
|
});
|
|
1228
|
-
const Invalidate =
|
|
1229
|
-
|
|
1230
|
-
invalidate: schema.Schema.Struct({
|
|
1231
|
-
cursor: schema.Schema.optional(Cursor)
|
|
1232
|
-
})
|
|
1234
|
+
const Invalidate = codec.MessageCodec({
|
|
1235
|
+
cursor: codec.OptionalCodec(Cursor)
|
|
1233
1236
|
});
|
|
1234
|
-
const Finalize =
|
|
1235
|
-
|
|
1236
|
-
finalize: schema.Schema.Struct({
|
|
1237
|
-
cursor: schema.Schema.optional(Cursor)
|
|
1238
|
-
})
|
|
1237
|
+
const Finalize = codec.MessageCodec({
|
|
1238
|
+
cursor: codec.OptionalCodec(Cursor)
|
|
1239
1239
|
});
|
|
1240
|
-
const Heartbeat =
|
|
1241
|
-
|
|
1240
|
+
const Heartbeat = codec.UndefinedCodec;
|
|
1241
|
+
const StdOut = codec.StringCodec;
|
|
1242
|
+
const StdErr = codec.StringCodec;
|
|
1243
|
+
const SystemMessage = codec.MessageCodec({
|
|
1244
|
+
output: codec.OneOfCodec({
|
|
1245
|
+
stdout: StdOut,
|
|
1246
|
+
stderr: StdErr
|
|
1247
|
+
})
|
|
1242
1248
|
});
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
|
|
1249
|
+
const _DataOrNull = (schema) => ({
|
|
1250
|
+
encode(x) {
|
|
1251
|
+
if (x === null) {
|
|
1252
|
+
return new Uint8Array();
|
|
1253
|
+
}
|
|
1254
|
+
return schema.encode(x);
|
|
1255
|
+
},
|
|
1256
|
+
decode(p) {
|
|
1257
|
+
if (p.length === 0) {
|
|
1258
|
+
return null;
|
|
1259
|
+
}
|
|
1260
|
+
return schema.decode(p);
|
|
1261
|
+
}
|
|
1246
1262
|
});
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1249
|
-
|
|
1263
|
+
const Data = (schema) => codec.MessageCodec({
|
|
1264
|
+
cursor: codec.OptionalCodec(Cursor),
|
|
1265
|
+
endCursor: Cursor,
|
|
1266
|
+
finality: DataFinality,
|
|
1267
|
+
production: DataProduction,
|
|
1268
|
+
data: codec.ArrayCodec(_DataOrNull(schema))
|
|
1250
1269
|
});
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1270
|
+
const StreamDataResponse = (schema) => codec.OneOfCodec({
|
|
1271
|
+
data: Data(schema),
|
|
1272
|
+
invalidate: Invalidate,
|
|
1273
|
+
finalize: Finalize,
|
|
1274
|
+
heartbeat: Heartbeat,
|
|
1275
|
+
systemMessage: SystemMessage
|
|
1256
1276
|
});
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
finality: DataFinality,
|
|
1263
|
-
production: DataProduction,
|
|
1264
|
-
data: schema.Schema.Array(schema$1)
|
|
1265
|
-
})
|
|
1277
|
+
const ResponseWithoutData = codec.OneOfCodec({
|
|
1278
|
+
invalidate: Invalidate,
|
|
1279
|
+
finalize: Finalize,
|
|
1280
|
+
heartbeat: Heartbeat,
|
|
1281
|
+
systemMessage: SystemMessage
|
|
1266
1282
|
});
|
|
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
1283
|
|
|
1281
1284
|
var __defProp = Object.defineProperty;
|
|
1282
1285
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -1285,10 +1288,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1285
1288
|
return value;
|
|
1286
1289
|
};
|
|
1287
1290
|
class StreamConfig {
|
|
1288
|
-
constructor(filter, block, mergeFilter) {
|
|
1291
|
+
constructor(filter, block, mergeFilter, name) {
|
|
1289
1292
|
this.filter = filter;
|
|
1290
1293
|
this.block = block;
|
|
1291
1294
|
this.mergeFilter = mergeFilter;
|
|
1295
|
+
this.name = name;
|
|
1292
1296
|
__publicField(this, "request");
|
|
1293
1297
|
__publicField(this, "response");
|
|
1294
1298
|
this.request = StreamDataRequest(this.filter);
|
|
@@ -1312,7 +1316,6 @@ class StreamConfig {
|
|
|
1312
1316
|
}
|
|
1313
1317
|
}
|
|
1314
1318
|
|
|
1315
|
-
exports.Bytes = Bytes;
|
|
1316
1319
|
exports.BytesFromUint8Array = BytesFromUint8Array;
|
|
1317
1320
|
exports.Cursor = Cursor;
|
|
1318
1321
|
exports.CursorFromBytes = CursorFromBytes;
|
|
@@ -1320,25 +1323,22 @@ exports.Data = Data;
|
|
|
1320
1323
|
exports.DataFinality = DataFinality;
|
|
1321
1324
|
exports.DataProduction = DataProduction;
|
|
1322
1325
|
exports.DnaStreamDefinition = DnaStreamDefinition;
|
|
1323
|
-
exports.
|
|
1326
|
+
exports.DurationCodec = DurationCodec;
|
|
1324
1327
|
exports.Finalize = Finalize;
|
|
1325
1328
|
exports.Heartbeat = Heartbeat;
|
|
1326
1329
|
exports.Invalidate = Invalidate;
|
|
1327
1330
|
exports.MockBlock = MockBlock;
|
|
1328
1331
|
exports.MockFilter = MockFilter;
|
|
1332
|
+
exports.ResponseWithoutData = ResponseWithoutData;
|
|
1329
1333
|
exports.StdErr = StdErr;
|
|
1330
1334
|
exports.StdOut = StdOut;
|
|
1331
1335
|
exports.StreamConfig = StreamConfig;
|
|
1332
1336
|
exports.StreamDataRequest = StreamDataRequest;
|
|
1333
1337
|
exports.StreamDataResponse = StreamDataResponse;
|
|
1334
1338
|
exports.SystemMessage = SystemMessage;
|
|
1335
|
-
exports._Cursor = _Cursor;
|
|
1336
1339
|
exports.createCursor = createCursor;
|
|
1337
|
-
exports.cursorFromBytes = cursorFromBytes;
|
|
1338
|
-
exports.cursorFromProto = cursorFromProto;
|
|
1339
|
-
exports.cursorToBytes = cursorToBytes;
|
|
1340
|
-
exports.cursorToProto = cursorToProto;
|
|
1341
1340
|
exports.isCursor = isCursor;
|
|
1342
1341
|
exports.normalizeCursor = normalizeCursor;
|
|
1343
1342
|
exports.stream = stream;
|
|
1344
1343
|
exports.testing = testing;
|
|
1344
|
+
//# sourceMappingURL=protocol.53f81a1e.cjs.map
|