@apibara/protocol 2.0.0-beta.2 → 2.0.0-beta.21
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/index.cjs +14 -7
- package/dist/index.d.cts +5 -6
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.mjs +13 -8
- package/dist/shared/{protocol.e9aed6a3.d.ts → protocol.59e5839c.d.cts} +247 -79
- package/dist/shared/{protocol.e9aed6a3.d.cts → protocol.59e5839c.d.mts} +247 -79
- package/dist/shared/{protocol.e9aed6a3.d.mts → protocol.59e5839c.d.ts} +247 -79
- package/dist/shared/{protocol.a07a51b5.mjs → protocol.d9596779.mjs} +293 -106
- package/dist/shared/{protocol.6b1bdade.cjs → protocol.e1dec68a.cjs} +294 -106
- package/dist/testing/index.cjs +2 -2
- package/dist/testing/index.d.cts +7 -2
- package/dist/testing/index.d.mts +7 -2
- package/dist/testing/index.d.ts +7 -2
- package/dist/testing/index.mjs +2 -2
- package/package.json +33 -47
- package/src/client.ts +21 -5
- package/src/common.ts +2 -2
- package/src/proto/google/protobuf/duration.ts +189 -0
- package/src/proto/index.ts +1 -2
- package/src/proto/stream.ts +442 -11
- package/src/proto/testing.ts +1 -1
- package/src/status.ts +2 -0
- package/src/stream.ts +22 -2
- package/CHANGELOG.md +0 -103
- package/LICENSE.txt +0 -202
- package/buf.gen.yaml +0 -14
- package/build.config.ts +0 -11
- package/proto/common.proto +0 -22
- package/proto/stream.proto +0 -83
- package/proto/testing.proto +0 -11
- package/src/proto/common.ts +0 -279
- package/tsconfig.json +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const _m0 = require('protobufjs/minimal');
|
|
3
|
+
const _m0 = require('protobufjs/minimal.js');
|
|
4
4
|
const schema = require('@effect/schema');
|
|
5
5
|
const effect = require('effect');
|
|
6
6
|
const viem = require('viem');
|
|
@@ -11,7 +11,130 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
const _m0__default = /*#__PURE__*/_interopDefaultCompat(_m0);
|
|
12
12
|
const Long__default = /*#__PURE__*/_interopDefaultCompat(Long);
|
|
13
13
|
|
|
14
|
-
|
|
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
|
+
}
|
|
15
138
|
function createBaseCursor() {
|
|
16
139
|
return { orderKey: BigInt("0"), uniqueKey: new Uint8Array(0) };
|
|
17
140
|
}
|
|
@@ -57,8 +180,8 @@ const Cursor$1 = {
|
|
|
57
180
|
},
|
|
58
181
|
fromJSON(object) {
|
|
59
182
|
return {
|
|
60
|
-
orderKey: isSet$
|
|
61
|
-
uniqueKey: isSet$
|
|
183
|
+
orderKey: isSet$1(object.orderKey) ? BigInt(object.orderKey) : BigInt("0"),
|
|
184
|
+
uniqueKey: isSet$1(object.uniqueKey) ? bytesFromBase64(object.uniqueKey) : new Uint8Array(0)
|
|
62
185
|
};
|
|
63
186
|
},
|
|
64
187
|
toJSON(message) {
|
|
@@ -67,7 +190,7 @@ const Cursor$1 = {
|
|
|
67
190
|
obj.orderKey = message.orderKey.toString();
|
|
68
191
|
}
|
|
69
192
|
if (message.uniqueKey.length !== 0) {
|
|
70
|
-
obj.uniqueKey = base64FromBytes
|
|
193
|
+
obj.uniqueKey = base64FromBytes(message.uniqueKey);
|
|
71
194
|
}
|
|
72
195
|
return obj;
|
|
73
196
|
},
|
|
@@ -117,7 +240,7 @@ const StatusRequest = {
|
|
|
117
240
|
}
|
|
118
241
|
};
|
|
119
242
|
function createBaseStatusResponse() {
|
|
120
|
-
return { currentHead: void 0, lastIngested: void 0 };
|
|
243
|
+
return { currentHead: void 0, lastIngested: void 0, finalized: void 0, starting: void 0 };
|
|
121
244
|
}
|
|
122
245
|
const StatusResponse = {
|
|
123
246
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
@@ -127,6 +250,12 @@ const StatusResponse = {
|
|
|
127
250
|
if (message.lastIngested !== void 0) {
|
|
128
251
|
Cursor$1.encode(message.lastIngested, writer.uint32(18).fork()).ldelim();
|
|
129
252
|
}
|
|
253
|
+
if (message.finalized !== void 0) {
|
|
254
|
+
Cursor$1.encode(message.finalized, writer.uint32(26).fork()).ldelim();
|
|
255
|
+
}
|
|
256
|
+
if (message.starting !== void 0) {
|
|
257
|
+
Cursor$1.encode(message.starting, writer.uint32(34).fork()).ldelim();
|
|
258
|
+
}
|
|
130
259
|
return writer;
|
|
131
260
|
},
|
|
132
261
|
decode(input, length) {
|
|
@@ -148,6 +277,18 @@ const StatusResponse = {
|
|
|
148
277
|
}
|
|
149
278
|
message.lastIngested = Cursor$1.decode(reader, reader.uint32());
|
|
150
279
|
continue;
|
|
280
|
+
case 3:
|
|
281
|
+
if (tag !== 26) {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
message.finalized = Cursor$1.decode(reader, reader.uint32());
|
|
285
|
+
continue;
|
|
286
|
+
case 4:
|
|
287
|
+
if (tag !== 34) {
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
message.starting = Cursor$1.decode(reader, reader.uint32());
|
|
291
|
+
continue;
|
|
151
292
|
}
|
|
152
293
|
if ((tag & 7) === 4 || tag === 0) {
|
|
153
294
|
break;
|
|
@@ -158,8 +299,10 @@ const StatusResponse = {
|
|
|
158
299
|
},
|
|
159
300
|
fromJSON(object) {
|
|
160
301
|
return {
|
|
161
|
-
currentHead: isSet$
|
|
162
|
-
lastIngested: isSet$
|
|
302
|
+
currentHead: isSet$1(object.currentHead) ? Cursor$1.fromJSON(object.currentHead) : void 0,
|
|
303
|
+
lastIngested: isSet$1(object.lastIngested) ? Cursor$1.fromJSON(object.lastIngested) : void 0,
|
|
304
|
+
finalized: isSet$1(object.finalized) ? Cursor$1.fromJSON(object.finalized) : void 0,
|
|
305
|
+
starting: isSet$1(object.starting) ? Cursor$1.fromJSON(object.starting) : void 0
|
|
163
306
|
};
|
|
164
307
|
},
|
|
165
308
|
toJSON(message) {
|
|
@@ -170,6 +313,12 @@ const StatusResponse = {
|
|
|
170
313
|
if (message.lastIngested !== void 0) {
|
|
171
314
|
obj.lastIngested = Cursor$1.toJSON(message.lastIngested);
|
|
172
315
|
}
|
|
316
|
+
if (message.finalized !== void 0) {
|
|
317
|
+
obj.finalized = Cursor$1.toJSON(message.finalized);
|
|
318
|
+
}
|
|
319
|
+
if (message.starting !== void 0) {
|
|
320
|
+
obj.starting = Cursor$1.toJSON(message.starting);
|
|
321
|
+
}
|
|
173
322
|
return obj;
|
|
174
323
|
},
|
|
175
324
|
create(base) {
|
|
@@ -179,97 +328,13 @@ const StatusResponse = {
|
|
|
179
328
|
const message = createBaseStatusResponse();
|
|
180
329
|
message.currentHead = object.currentHead !== void 0 && object.currentHead !== null ? Cursor$1.fromPartial(object.currentHead) : void 0;
|
|
181
330
|
message.lastIngested = object.lastIngested !== void 0 && object.lastIngested !== null ? Cursor$1.fromPartial(object.lastIngested) : void 0;
|
|
331
|
+
message.finalized = object.finalized !== void 0 && object.finalized !== null ? Cursor$1.fromPartial(object.finalized) : void 0;
|
|
332
|
+
message.starting = object.starting !== void 0 && object.starting !== null ? Cursor$1.fromPartial(object.starting) : void 0;
|
|
182
333
|
return message;
|
|
183
334
|
}
|
|
184
335
|
};
|
|
185
|
-
function bytesFromBase64$1(b64) {
|
|
186
|
-
if (globalThis.Buffer) {
|
|
187
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
188
|
-
} else {
|
|
189
|
-
const bin = globalThis.atob(b64);
|
|
190
|
-
const arr = new Uint8Array(bin.length);
|
|
191
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
192
|
-
arr[i] = bin.charCodeAt(i);
|
|
193
|
-
}
|
|
194
|
-
return arr;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function base64FromBytes$1(arr) {
|
|
198
|
-
if (globalThis.Buffer) {
|
|
199
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
200
|
-
} else {
|
|
201
|
-
const bin = [];
|
|
202
|
-
arr.forEach((byte) => {
|
|
203
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
204
|
-
});
|
|
205
|
-
return globalThis.btoa(bin.join(""));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function longToBigint(long) {
|
|
209
|
-
return BigInt(long.toString());
|
|
210
|
-
}
|
|
211
|
-
if (_m0__default.util.Long !== Long__default) {
|
|
212
|
-
_m0__default.util.Long = Long__default;
|
|
213
|
-
_m0__default.configure();
|
|
214
|
-
}
|
|
215
|
-
function isSet$2(value) {
|
|
216
|
-
return value !== null && value !== void 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const common = {
|
|
220
|
-
__proto__: null,
|
|
221
|
-
Cursor: Cursor$1,
|
|
222
|
-
StatusRequest: StatusRequest,
|
|
223
|
-
StatusResponse: StatusResponse,
|
|
224
|
-
protobufPackage: protobufPackage$2
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const protobufPackage$1 = "dna.v2.stream";
|
|
228
|
-
var DataFinality$1 = /* @__PURE__ */ ((DataFinality2) => {
|
|
229
|
-
DataFinality2[DataFinality2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
230
|
-
DataFinality2[DataFinality2["PENDING"] = 1] = "PENDING";
|
|
231
|
-
DataFinality2[DataFinality2["ACCEPTED"] = 2] = "ACCEPTED";
|
|
232
|
-
DataFinality2[DataFinality2["FINALIZED"] = 3] = "FINALIZED";
|
|
233
|
-
DataFinality2[DataFinality2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
234
|
-
return DataFinality2;
|
|
235
|
-
})(DataFinality$1 || {});
|
|
236
|
-
function dataFinalityFromJSON(object) {
|
|
237
|
-
switch (object) {
|
|
238
|
-
case 0:
|
|
239
|
-
case "DATA_FINALITY_UNKNOWN":
|
|
240
|
-
return 0 /* UNKNOWN */;
|
|
241
|
-
case 1:
|
|
242
|
-
case "DATA_FINALITY_PENDING":
|
|
243
|
-
return 1 /* PENDING */;
|
|
244
|
-
case 2:
|
|
245
|
-
case "DATA_FINALITY_ACCEPTED":
|
|
246
|
-
return 2 /* ACCEPTED */;
|
|
247
|
-
case 3:
|
|
248
|
-
case "DATA_FINALITY_FINALIZED":
|
|
249
|
-
return 3 /* FINALIZED */;
|
|
250
|
-
case -1:
|
|
251
|
-
case "UNRECOGNIZED":
|
|
252
|
-
default:
|
|
253
|
-
return -1 /* UNRECOGNIZED */;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
function dataFinalityToJSON(object) {
|
|
257
|
-
switch (object) {
|
|
258
|
-
case 0 /* UNKNOWN */:
|
|
259
|
-
return "DATA_FINALITY_UNKNOWN";
|
|
260
|
-
case 1 /* PENDING */:
|
|
261
|
-
return "DATA_FINALITY_PENDING";
|
|
262
|
-
case 2 /* ACCEPTED */:
|
|
263
|
-
return "DATA_FINALITY_ACCEPTED";
|
|
264
|
-
case 3 /* FINALIZED */:
|
|
265
|
-
return "DATA_FINALITY_FINALIZED";
|
|
266
|
-
case -1 /* UNRECOGNIZED */:
|
|
267
|
-
default:
|
|
268
|
-
return "UNRECOGNIZED";
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
336
|
function createBaseStreamDataRequest() {
|
|
272
|
-
return { startingCursor: void 0, finality: void 0, filter: [] };
|
|
337
|
+
return { startingCursor: void 0, finality: void 0, filter: [], heartbeatInterval: void 0 };
|
|
273
338
|
}
|
|
274
339
|
const StreamDataRequest$1 = {
|
|
275
340
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
@@ -282,6 +347,9 @@ const StreamDataRequest$1 = {
|
|
|
282
347
|
for (const v of message.filter) {
|
|
283
348
|
writer.uint32(26).bytes(v);
|
|
284
349
|
}
|
|
350
|
+
if (message.heartbeatInterval !== void 0) {
|
|
351
|
+
Duration$1.encode(message.heartbeatInterval, writer.uint32(34).fork()).ldelim();
|
|
352
|
+
}
|
|
285
353
|
return writer;
|
|
286
354
|
},
|
|
287
355
|
decode(input, length) {
|
|
@@ -309,6 +377,12 @@ const StreamDataRequest$1 = {
|
|
|
309
377
|
}
|
|
310
378
|
message.filter.push(reader.bytes());
|
|
311
379
|
continue;
|
|
380
|
+
case 4:
|
|
381
|
+
if (tag !== 34) {
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
message.heartbeatInterval = Duration$1.decode(reader, reader.uint32());
|
|
385
|
+
continue;
|
|
312
386
|
}
|
|
313
387
|
if ((tag & 7) === 4 || tag === 0) {
|
|
314
388
|
break;
|
|
@@ -321,7 +395,8 @@ const StreamDataRequest$1 = {
|
|
|
321
395
|
return {
|
|
322
396
|
startingCursor: isSet$1(object.startingCursor) ? Cursor$1.fromJSON(object.startingCursor) : void 0,
|
|
323
397
|
finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : void 0,
|
|
324
|
-
filter: globalThis.Array.isArray(object?.filter) ? object.filter.map((e) => bytesFromBase64(e)) : []
|
|
398
|
+
filter: globalThis.Array.isArray(object?.filter) ? object.filter.map((e) => bytesFromBase64(e)) : [],
|
|
399
|
+
heartbeatInterval: isSet$1(object.heartbeatInterval) ? Duration$1.fromJSON(object.heartbeatInterval) : void 0
|
|
325
400
|
};
|
|
326
401
|
},
|
|
327
402
|
toJSON(message) {
|
|
@@ -335,6 +410,9 @@ const StreamDataRequest$1 = {
|
|
|
335
410
|
if (message.filter?.length) {
|
|
336
411
|
obj.filter = message.filter.map((e) => base64FromBytes(e));
|
|
337
412
|
}
|
|
413
|
+
if (message.heartbeatInterval !== void 0) {
|
|
414
|
+
obj.heartbeatInterval = Duration$1.toJSON(message.heartbeatInterval);
|
|
415
|
+
}
|
|
338
416
|
return obj;
|
|
339
417
|
},
|
|
340
418
|
create(base) {
|
|
@@ -345,6 +423,7 @@ const StreamDataRequest$1 = {
|
|
|
345
423
|
message.startingCursor = object.startingCursor !== void 0 && object.startingCursor !== null ? Cursor$1.fromPartial(object.startingCursor) : void 0;
|
|
346
424
|
message.finality = object.finality ?? void 0;
|
|
347
425
|
message.filter = object.filter?.map((e) => e) || [];
|
|
426
|
+
message.heartbeatInterval = object.heartbeatInterval !== void 0 && object.heartbeatInterval !== null ? Duration$1.fromPartial(object.heartbeatInterval) : void 0;
|
|
348
427
|
return message;
|
|
349
428
|
}
|
|
350
429
|
};
|
|
@@ -360,11 +439,14 @@ const StreamDataResponse$1 = {
|
|
|
360
439
|
case "invalidate":
|
|
361
440
|
Invalidate$1.encode(message.message.invalidate, writer.uint32(18).fork()).ldelim();
|
|
362
441
|
break;
|
|
442
|
+
case "finalize":
|
|
443
|
+
Finalize$1.encode(message.message.finalize, writer.uint32(26).fork()).ldelim();
|
|
444
|
+
break;
|
|
363
445
|
case "heartbeat":
|
|
364
|
-
Heartbeat$1.encode(message.message.heartbeat, writer.uint32(
|
|
446
|
+
Heartbeat$1.encode(message.message.heartbeat, writer.uint32(34).fork()).ldelim();
|
|
365
447
|
break;
|
|
366
448
|
case "systemMessage":
|
|
367
|
-
SystemMessage$1.encode(message.message.systemMessage, writer.uint32(
|
|
449
|
+
SystemMessage$1.encode(message.message.systemMessage, writer.uint32(42).fork()).ldelim();
|
|
368
450
|
break;
|
|
369
451
|
}
|
|
370
452
|
return writer;
|
|
@@ -392,12 +474,18 @@ const StreamDataResponse$1 = {
|
|
|
392
474
|
if (tag !== 26) {
|
|
393
475
|
break;
|
|
394
476
|
}
|
|
395
|
-
message.message = { $case: "
|
|
477
|
+
message.message = { $case: "finalize", finalize: Finalize$1.decode(reader, reader.uint32()) };
|
|
396
478
|
continue;
|
|
397
479
|
case 4:
|
|
398
480
|
if (tag !== 34) {
|
|
399
481
|
break;
|
|
400
482
|
}
|
|
483
|
+
message.message = { $case: "heartbeat", heartbeat: Heartbeat$1.decode(reader, reader.uint32()) };
|
|
484
|
+
continue;
|
|
485
|
+
case 5:
|
|
486
|
+
if (tag !== 42) {
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
401
489
|
message.message = { $case: "systemMessage", systemMessage: SystemMessage$1.decode(reader, reader.uint32()) };
|
|
402
490
|
continue;
|
|
403
491
|
}
|
|
@@ -410,7 +498,7 @@ const StreamDataResponse$1 = {
|
|
|
410
498
|
},
|
|
411
499
|
fromJSON(object) {
|
|
412
500
|
return {
|
|
413
|
-
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.heartbeat) ? { $case: "heartbeat", heartbeat: Heartbeat$1.fromJSON(object.heartbeat) } : isSet$1(object.systemMessage) ? { $case: "systemMessage", systemMessage: SystemMessage$1.fromJSON(object.systemMessage) } : void 0
|
|
501
|
+
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
|
|
414
502
|
};
|
|
415
503
|
},
|
|
416
504
|
toJSON(message) {
|
|
@@ -421,6 +509,9 @@ const StreamDataResponse$1 = {
|
|
|
421
509
|
if (message.message?.$case === "invalidate") {
|
|
422
510
|
obj.invalidate = Invalidate$1.toJSON(message.message.invalidate);
|
|
423
511
|
}
|
|
512
|
+
if (message.message?.$case === "finalize") {
|
|
513
|
+
obj.finalize = Finalize$1.toJSON(message.message.finalize);
|
|
514
|
+
}
|
|
424
515
|
if (message.message?.$case === "heartbeat") {
|
|
425
516
|
obj.heartbeat = Heartbeat$1.toJSON(message.message.heartbeat);
|
|
426
517
|
}
|
|
@@ -440,6 +531,9 @@ const StreamDataResponse$1 = {
|
|
|
440
531
|
if (object.message?.$case === "invalidate" && object.message?.invalidate !== void 0 && object.message?.invalidate !== null) {
|
|
441
532
|
message.message = { $case: "invalidate", invalidate: Invalidate$1.fromPartial(object.message.invalidate) };
|
|
442
533
|
}
|
|
534
|
+
if (object.message?.$case === "finalize" && object.message?.finalize !== void 0 && object.message?.finalize !== null) {
|
|
535
|
+
message.message = { $case: "finalize", finalize: Finalize$1.fromPartial(object.message.finalize) };
|
|
536
|
+
}
|
|
443
537
|
if (object.message?.$case === "heartbeat" && object.message?.heartbeat !== void 0 && object.message?.heartbeat !== null) {
|
|
444
538
|
message.message = { $case: "heartbeat", heartbeat: Heartbeat$1.fromPartial(object.message.heartbeat) };
|
|
445
539
|
}
|
|
@@ -453,13 +547,16 @@ const StreamDataResponse$1 = {
|
|
|
453
547
|
}
|
|
454
548
|
};
|
|
455
549
|
function createBaseInvalidate() {
|
|
456
|
-
return { cursor: void 0 };
|
|
550
|
+
return { cursor: void 0, removed: [] };
|
|
457
551
|
}
|
|
458
552
|
const Invalidate$1 = {
|
|
459
553
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
460
554
|
if (message.cursor !== void 0) {
|
|
461
555
|
Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
|
|
462
556
|
}
|
|
557
|
+
for (const v of message.removed) {
|
|
558
|
+
Cursor$1.encode(v, writer.uint32(18).fork()).ldelim();
|
|
559
|
+
}
|
|
463
560
|
return writer;
|
|
464
561
|
},
|
|
465
562
|
decode(input, length) {
|
|
@@ -475,6 +572,12 @@ const Invalidate$1 = {
|
|
|
475
572
|
}
|
|
476
573
|
message.cursor = Cursor$1.decode(reader, reader.uint32());
|
|
477
574
|
continue;
|
|
575
|
+
case 2:
|
|
576
|
+
if (tag !== 18) {
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
message.removed.push(Cursor$1.decode(reader, reader.uint32()));
|
|
580
|
+
continue;
|
|
478
581
|
}
|
|
479
582
|
if ((tag & 7) === 4 || tag === 0) {
|
|
480
583
|
break;
|
|
@@ -484,13 +587,19 @@ const Invalidate$1 = {
|
|
|
484
587
|
return message;
|
|
485
588
|
},
|
|
486
589
|
fromJSON(object) {
|
|
487
|
-
return {
|
|
590
|
+
return {
|
|
591
|
+
cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0,
|
|
592
|
+
removed: globalThis.Array.isArray(object?.removed) ? object.removed.map((e) => Cursor$1.fromJSON(e)) : []
|
|
593
|
+
};
|
|
488
594
|
},
|
|
489
595
|
toJSON(message) {
|
|
490
596
|
const obj = {};
|
|
491
597
|
if (message.cursor !== void 0) {
|
|
492
598
|
obj.cursor = Cursor$1.toJSON(message.cursor);
|
|
493
599
|
}
|
|
600
|
+
if (message.removed?.length) {
|
|
601
|
+
obj.removed = message.removed.map((e) => Cursor$1.toJSON(e));
|
|
602
|
+
}
|
|
494
603
|
return obj;
|
|
495
604
|
},
|
|
496
605
|
create(base) {
|
|
@@ -499,6 +608,57 @@ const Invalidate$1 = {
|
|
|
499
608
|
fromPartial(object) {
|
|
500
609
|
const message = createBaseInvalidate();
|
|
501
610
|
message.cursor = object.cursor !== void 0 && object.cursor !== null ? Cursor$1.fromPartial(object.cursor) : void 0;
|
|
611
|
+
message.removed = object.removed?.map((e) => Cursor$1.fromPartial(e)) || [];
|
|
612
|
+
return message;
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
function createBaseFinalize() {
|
|
616
|
+
return { cursor: void 0 };
|
|
617
|
+
}
|
|
618
|
+
const Finalize$1 = {
|
|
619
|
+
encode(message, writer = _m0__default.Writer.create()) {
|
|
620
|
+
if (message.cursor !== void 0) {
|
|
621
|
+
Cursor$1.encode(message.cursor, writer.uint32(10).fork()).ldelim();
|
|
622
|
+
}
|
|
623
|
+
return writer;
|
|
624
|
+
},
|
|
625
|
+
decode(input, length) {
|
|
626
|
+
const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
|
|
627
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
628
|
+
const message = createBaseFinalize();
|
|
629
|
+
while (reader.pos < end) {
|
|
630
|
+
const tag = reader.uint32();
|
|
631
|
+
switch (tag >>> 3) {
|
|
632
|
+
case 1:
|
|
633
|
+
if (tag !== 10) {
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
message.cursor = Cursor$1.decode(reader, reader.uint32());
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
reader.skipType(tag & 7);
|
|
643
|
+
}
|
|
644
|
+
return message;
|
|
645
|
+
},
|
|
646
|
+
fromJSON(object) {
|
|
647
|
+
return { cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0 };
|
|
648
|
+
},
|
|
649
|
+
toJSON(message) {
|
|
650
|
+
const obj = {};
|
|
651
|
+
if (message.cursor !== void 0) {
|
|
652
|
+
obj.cursor = Cursor$1.toJSON(message.cursor);
|
|
653
|
+
}
|
|
654
|
+
return obj;
|
|
655
|
+
},
|
|
656
|
+
create(base) {
|
|
657
|
+
return Finalize$1.fromPartial(base ?? {});
|
|
658
|
+
},
|
|
659
|
+
fromPartial(object) {
|
|
660
|
+
const message = createBaseFinalize();
|
|
661
|
+
message.cursor = object.cursor !== void 0 && object.cursor !== null ? Cursor$1.fromPartial(object.cursor) : void 0;
|
|
502
662
|
return message;
|
|
503
663
|
}
|
|
504
664
|
};
|
|
@@ -749,17 +909,28 @@ function base64FromBytes(arr) {
|
|
|
749
909
|
return globalThis.btoa(bin.join(""));
|
|
750
910
|
}
|
|
751
911
|
}
|
|
912
|
+
function longToBigint(long) {
|
|
913
|
+
return BigInt(long.toString());
|
|
914
|
+
}
|
|
915
|
+
if (_m0__default.util.Long !== Long__default) {
|
|
916
|
+
_m0__default.util.Long = Long__default;
|
|
917
|
+
_m0__default.configure();
|
|
918
|
+
}
|
|
752
919
|
function isSet$1(value) {
|
|
753
920
|
return value !== null && value !== void 0;
|
|
754
921
|
}
|
|
755
922
|
|
|
756
923
|
const stream = {
|
|
757
924
|
__proto__: null,
|
|
925
|
+
Cursor: Cursor$1,
|
|
758
926
|
Data: Data$1,
|
|
759
927
|
DataFinality: DataFinality$1,
|
|
760
928
|
DnaStreamDefinition: DnaStreamDefinition,
|
|
929
|
+
Finalize: Finalize$1,
|
|
761
930
|
Heartbeat: Heartbeat$1,
|
|
762
931
|
Invalidate: Invalidate$1,
|
|
932
|
+
StatusRequest: StatusRequest,
|
|
933
|
+
StatusResponse: StatusResponse,
|
|
763
934
|
StreamDataRequest: StreamDataRequest$1,
|
|
764
935
|
StreamDataResponse: StreamDataResponse$1,
|
|
765
936
|
SystemMessage: SystemMessage$1,
|
|
@@ -952,10 +1123,15 @@ const DataFinality = schema.Schema.transform(
|
|
|
952
1123
|
}
|
|
953
1124
|
}
|
|
954
1125
|
);
|
|
1126
|
+
const Duration = schema.Schema.Struct({
|
|
1127
|
+
seconds: schema.Schema.BigIntFromSelf,
|
|
1128
|
+
nanos: schema.Schema.Number
|
|
1129
|
+
});
|
|
955
1130
|
const StreamDataRequest = (filter) => schema.Schema.Struct({
|
|
956
1131
|
finality: schema.Schema.optional(DataFinality),
|
|
957
1132
|
startingCursor: schema.Schema.optional(Cursor),
|
|
958
|
-
filter: schema.Schema.mutable(schema.Schema.Array(filter))
|
|
1133
|
+
filter: schema.Schema.mutable(schema.Schema.Array(filter)),
|
|
1134
|
+
heartbeatInterval: schema.Schema.optional(Duration)
|
|
959
1135
|
});
|
|
960
1136
|
const Invalidate = schema.Schema.Struct({
|
|
961
1137
|
_tag: tag("invalidate"),
|
|
@@ -963,6 +1139,12 @@ const Invalidate = schema.Schema.Struct({
|
|
|
963
1139
|
cursor: schema.Schema.optional(Cursor)
|
|
964
1140
|
})
|
|
965
1141
|
});
|
|
1142
|
+
const Finalize = schema.Schema.Struct({
|
|
1143
|
+
_tag: tag("finalize"),
|
|
1144
|
+
finalize: schema.Schema.Struct({
|
|
1145
|
+
cursor: schema.Schema.optional(Cursor)
|
|
1146
|
+
})
|
|
1147
|
+
});
|
|
966
1148
|
const Heartbeat = schema.Schema.Struct({
|
|
967
1149
|
_tag: tag("heartbeat")
|
|
968
1150
|
});
|
|
@@ -989,8 +1171,13 @@ const Data = (schema$1) => schema.Schema.Struct({
|
|
|
989
1171
|
data: schema.Schema.Array(schema$1)
|
|
990
1172
|
})
|
|
991
1173
|
});
|
|
992
|
-
const StreamDataResponse = (data) => schema.Schema.Union(Data(data), Invalidate, Heartbeat, SystemMessage);
|
|
993
|
-
schema.Schema.Union(
|
|
1174
|
+
const StreamDataResponse = (data) => schema.Schema.Union(Data(data), Invalidate, Finalize, Heartbeat, SystemMessage);
|
|
1175
|
+
schema.Schema.Union(
|
|
1176
|
+
Invalidate,
|
|
1177
|
+
Finalize,
|
|
1178
|
+
Heartbeat,
|
|
1179
|
+
SystemMessage
|
|
1180
|
+
);
|
|
994
1181
|
function tag(tag2) {
|
|
995
1182
|
return schema.Schema.Literal(tag2).pipe(
|
|
996
1183
|
schema.Schema.propertySignature,
|
|
@@ -1039,6 +1226,8 @@ exports.CursorFromBytes = CursorFromBytes;
|
|
|
1039
1226
|
exports.Data = Data;
|
|
1040
1227
|
exports.DataFinality = DataFinality;
|
|
1041
1228
|
exports.DnaStreamDefinition = DnaStreamDefinition;
|
|
1229
|
+
exports.Duration = Duration;
|
|
1230
|
+
exports.Finalize = Finalize;
|
|
1042
1231
|
exports.Heartbeat = Heartbeat;
|
|
1043
1232
|
exports.Invalidate = Invalidate;
|
|
1044
1233
|
exports.MockBlock = MockBlock;
|
|
@@ -1050,7 +1239,6 @@ exports.StreamDataRequest = StreamDataRequest;
|
|
|
1050
1239
|
exports.StreamDataResponse = StreamDataResponse;
|
|
1051
1240
|
exports.SystemMessage = SystemMessage;
|
|
1052
1241
|
exports._Cursor = _Cursor;
|
|
1053
|
-
exports.common = common;
|
|
1054
1242
|
exports.createCursor = createCursor;
|
|
1055
1243
|
exports.cursorFromBytes = cursorFromBytes;
|
|
1056
1244
|
exports.cursorFromProto = cursorFromProto;
|
package/dist/testing/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const schema = require('@effect/schema');
|
|
4
|
-
const config = require('../shared/protocol.
|
|
5
|
-
require('protobufjs/minimal');
|
|
4
|
+
const config = require('../shared/protocol.e1dec68a.cjs');
|
|
5
|
+
require('protobufjs/minimal.js');
|
|
6
6
|
require('effect');
|
|
7
7
|
require('viem');
|
|
8
8
|
require('long');
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as Client, q as StreamDataRequest, z as StreamDataOptions, w as StreamDataResponse, S as StatusRequest, y as ClientCallOptions,
|
|
1
|
+
import { A as Client, q as StreamDataRequest, z as StreamDataOptions, w as StreamDataResponse, S as StatusRequest, y as ClientCallOptions, l as StatusResponse, x as StreamConfig, c as Cursor, C as CursorProto, L as DataFinality } from '../shared/protocol.59e5839c.cjs';
|
|
2
2
|
import { Schema } from '@effect/schema';
|
|
3
3
|
import 'nice-grpc';
|
|
4
4
|
import 'nice-grpc-common';
|
|
5
|
-
import 'protobufjs/minimal';
|
|
5
|
+
import 'protobufjs/minimal.js';
|
|
6
6
|
import '@effect/schema/AST';
|
|
7
7
|
|
|
8
8
|
declare class MockClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
|
|
@@ -51,6 +51,11 @@ declare const MockStreamResponse: Schema.Union<[Schema.Struct<{
|
|
|
51
51
|
invalidate: Schema.Struct<{
|
|
52
52
|
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
53
53
|
}>;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
56
|
+
finalize: Schema.Struct<{
|
|
57
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
58
|
+
}>;
|
|
54
59
|
}>, Schema.Struct<{
|
|
55
60
|
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
56
61
|
}>, Schema.Struct<{
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as Client, q as StreamDataRequest, z as StreamDataOptions, w as StreamDataResponse, S as StatusRequest, y as ClientCallOptions,
|
|
1
|
+
import { A as Client, q as StreamDataRequest, z as StreamDataOptions, w as StreamDataResponse, S as StatusRequest, y as ClientCallOptions, l as StatusResponse, x as StreamConfig, c as Cursor, C as CursorProto, L as DataFinality } from '../shared/protocol.59e5839c.mjs';
|
|
2
2
|
import { Schema } from '@effect/schema';
|
|
3
3
|
import 'nice-grpc';
|
|
4
4
|
import 'nice-grpc-common';
|
|
5
|
-
import 'protobufjs/minimal';
|
|
5
|
+
import 'protobufjs/minimal.js';
|
|
6
6
|
import '@effect/schema/AST';
|
|
7
7
|
|
|
8
8
|
declare class MockClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
|
|
@@ -51,6 +51,11 @@ declare const MockStreamResponse: Schema.Union<[Schema.Struct<{
|
|
|
51
51
|
invalidate: Schema.Struct<{
|
|
52
52
|
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
53
53
|
}>;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
56
|
+
finalize: Schema.Struct<{
|
|
57
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
58
|
+
}>;
|
|
54
59
|
}>, Schema.Struct<{
|
|
55
60
|
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
56
61
|
}>, Schema.Struct<{
|