@apibara/protocol 2.0.0-beta.32 → 2.0.0-beta.34
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 +42 -20
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +42 -22
- package/dist/shared/{protocol.74b3c596.cjs → protocol.2d8d950d.cjs} +81 -2
- package/dist/shared/{protocol.32079ba8.mjs → protocol.91527bce.mjs} +81 -3
- package/dist/shared/{protocol.f9e14c27.d.ts → protocol.ef662c22.d.cts} +30 -3
- package/dist/shared/{protocol.f9e14c27.d.cts → protocol.ef662c22.d.mts} +30 -3
- package/dist/shared/{protocol.f9e14c27.d.mts → protocol.ef662c22.d.ts} +30 -3
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +2 -1
- package/dist/testing/index.d.mts +2 -1
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.mjs +1 -1
- package/package.json +1 -1
- package/src/client.ts +51 -23
- package/src/proto/stream.ts +60 -1
- package/src/stream.test.ts +2 -0
- package/src/stream.ts +31 -0
- package/src/testing/client.test.ts +12 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const config = require('./shared/protocol.
|
|
3
|
+
const config = require('./shared/protocol.2d8d950d.cjs');
|
|
4
4
|
const schema = require('@effect/schema');
|
|
5
5
|
const niceGrpc = require('nice-grpc');
|
|
6
6
|
require('protobufjs/minimal.js');
|
|
@@ -37,6 +37,13 @@ var __publicField$1 = (obj, key, value) => {
|
|
|
37
37
|
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
38
|
return value;
|
|
39
39
|
};
|
|
40
|
+
const DEFAULT_TIMEOUT_MS = 45e3;
|
|
41
|
+
class TimeoutError extends Error {
|
|
42
|
+
constructor(timeout) {
|
|
43
|
+
super(`No message received in ${timeout}ms`);
|
|
44
|
+
this.name = "TimeoutError";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
40
47
|
function createClient(config$1, streamUrl, options = {}) {
|
|
41
48
|
const channel = niceGrpc.createChannel(
|
|
42
49
|
streamUrl,
|
|
@@ -79,34 +86,47 @@ class StreamDataIterable {
|
|
|
79
86
|
const inner = this.it[Symbol.asyncIterator]();
|
|
80
87
|
const schema$1 = config.StreamDataResponse(this.schema);
|
|
81
88
|
const decoder = schema.Schema.decodeSync(schema$1);
|
|
82
|
-
const { endingCursor } = this.options ?? {};
|
|
89
|
+
const { endingCursor, timeout = DEFAULT_TIMEOUT_MS } = this.options ?? {};
|
|
83
90
|
let shouldStop = false;
|
|
91
|
+
let clock;
|
|
84
92
|
return {
|
|
85
93
|
async next() {
|
|
86
94
|
if (shouldStop) {
|
|
87
95
|
return { done: true, value: void 0 };
|
|
88
96
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const {
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
const t = new Promise(
|
|
98
|
+
(_, reject) => {
|
|
99
|
+
clock = setTimeout(() => {
|
|
100
|
+
reject(new TimeoutError(timeout));
|
|
101
|
+
}, timeout);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
try {
|
|
105
|
+
const { done, value } = await Promise.race([inner.next(), t]);
|
|
106
|
+
clearTimeout(clock);
|
|
107
|
+
if (done || value.message === void 0) {
|
|
108
|
+
return { done: true, value: void 0 };
|
|
109
|
+
}
|
|
110
|
+
const decodedMessage = decoder(value.message);
|
|
111
|
+
if (endingCursor) {
|
|
112
|
+
assert__default(value.message.$case === "data");
|
|
113
|
+
assert__default(decodedMessage._tag === "data");
|
|
114
|
+
const { orderKey, uniqueKey } = endingCursor;
|
|
115
|
+
const endCursor = decodedMessage.data.endCursor;
|
|
116
|
+
if (orderKey === endCursor?.orderKey) {
|
|
117
|
+
if (!uniqueKey || uniqueKey === endCursor.uniqueKey) {
|
|
118
|
+
shouldStop = true;
|
|
119
|
+
return { done: false, value: decodedMessage };
|
|
120
|
+
}
|
|
103
121
|
}
|
|
104
122
|
}
|
|
123
|
+
return {
|
|
124
|
+
done: false,
|
|
125
|
+
value: decodedMessage
|
|
126
|
+
};
|
|
127
|
+
} finally {
|
|
128
|
+
clearTimeout(clock);
|
|
105
129
|
}
|
|
106
|
-
return {
|
|
107
|
-
done: false,
|
|
108
|
-
value: decodedMessage
|
|
109
|
-
};
|
|
110
130
|
}
|
|
111
131
|
};
|
|
112
132
|
}
|
|
@@ -166,6 +186,7 @@ exports.Cursor = config.Cursor;
|
|
|
166
186
|
exports.CursorFromBytes = config.CursorFromBytes;
|
|
167
187
|
exports.Data = config.Data;
|
|
168
188
|
exports.DataFinality = config.DataFinality;
|
|
189
|
+
exports.DataProduction = config.DataProduction;
|
|
169
190
|
exports.DnaStreamDefinition = config.DnaStreamDefinition;
|
|
170
191
|
exports.Duration = config.Duration;
|
|
171
192
|
exports.Finalize = config.Finalize;
|
|
@@ -191,6 +212,7 @@ exports.RateGauge = RateGauge;
|
|
|
191
212
|
exports.StatusRequest = StatusRequest;
|
|
192
213
|
exports.StatusResponse = StatusResponse;
|
|
193
214
|
exports.StreamDataIterable = StreamDataIterable;
|
|
215
|
+
exports.TimeoutError = TimeoutError;
|
|
194
216
|
exports.createClient = createClient;
|
|
195
217
|
exports.proto = index;
|
|
196
218
|
exports.statusRequestFromProto = statusRequestFromProto;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.ef662c22.cjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, G as Client, A as ClientCallOptions, J as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, x as Data, p as DataFinality, q as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, r as Duration, F as Finalize, L as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, v as StdErr, u as StdOut, z as StreamConfig, M as StreamDataIterable, E as StreamDataOptions, t as StreamDataRequest, y as StreamDataResponse, w as SystemMessage, T as TimeoutError, _ as _Cursor, K as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.ef662c22.cjs';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.ef662c22.mjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, G as Client, A as ClientCallOptions, J as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, x as Data, p as DataFinality, q as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, r as Duration, F as Finalize, L as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, v as StdErr, u as StdOut, z as StreamConfig, M as StreamDataIterable, E as StreamDataOptions, t as StreamDataRequest, y as StreamDataResponse, w as SystemMessage, T as TimeoutError, _ as _Cursor, K as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.ef662c22.mjs';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.ef662c22.js';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, G as Client, A as ClientCallOptions, J as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, x as Data, p as DataFinality, q as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, r as Duration, F as Finalize, L as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, v as StdErr, u as StdOut, z as StreamConfig, M as StreamDataIterable, E as StreamDataOptions, t as StreamDataRequest, y as StreamDataResponse, w as SystemMessage, T as TimeoutError, _ as _Cursor, K as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.ef662c22.js';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream, t as testing, C as Cursor, D as DnaStreamDefinition, S as StreamDataResponse } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, a as BytesFromUint8Array, e as CursorFromBytes,
|
|
1
|
+
import { s as stream, t as testing, C as Cursor, D as DnaStreamDefinition, S as StreamDataResponse } from './shared/protocol.91527bce.mjs';
|
|
2
|
+
export { B as Bytes, a as BytesFromUint8Array, e as CursorFromBytes, p as Data, h as DataFinality, j as DataProduction, k as Duration, F as Finalize, H as Heartbeat, I as Invalidate, n as StdErr, m as StdOut, q as StreamConfig, l as StreamDataRequest, o as SystemMessage, _ as _Cursor, c as createCursor, g as cursorFromBytes, d as cursorFromProto, f as cursorToBytes, b as cursorToProto, i as isCursor } from './shared/protocol.91527bce.mjs';
|
|
3
3
|
import { Schema } from '@effect/schema';
|
|
4
4
|
import { createChannel, createClient as createClient$1 } from 'nice-grpc';
|
|
5
5
|
export { ClientError, Status } from 'nice-grpc';
|
|
@@ -33,6 +33,13 @@ var __publicField$1 = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
+
const DEFAULT_TIMEOUT_MS = 45e3;
|
|
37
|
+
class TimeoutError extends Error {
|
|
38
|
+
constructor(timeout) {
|
|
39
|
+
super(`No message received in ${timeout}ms`);
|
|
40
|
+
this.name = "TimeoutError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
36
43
|
function createClient(config, streamUrl, options = {}) {
|
|
37
44
|
const channel = createChannel(
|
|
38
45
|
streamUrl,
|
|
@@ -75,34 +82,47 @@ class StreamDataIterable {
|
|
|
75
82
|
const inner = this.it[Symbol.asyncIterator]();
|
|
76
83
|
const schema = StreamDataResponse(this.schema);
|
|
77
84
|
const decoder = Schema.decodeSync(schema);
|
|
78
|
-
const { endingCursor } = this.options ?? {};
|
|
85
|
+
const { endingCursor, timeout = DEFAULT_TIMEOUT_MS } = this.options ?? {};
|
|
79
86
|
let shouldStop = false;
|
|
87
|
+
let clock;
|
|
80
88
|
return {
|
|
81
89
|
async next() {
|
|
82
90
|
if (shouldStop) {
|
|
83
91
|
return { done: true, value: void 0 };
|
|
84
92
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const {
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const t = new Promise(
|
|
94
|
+
(_, reject) => {
|
|
95
|
+
clock = setTimeout(() => {
|
|
96
|
+
reject(new TimeoutError(timeout));
|
|
97
|
+
}, timeout);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
try {
|
|
101
|
+
const { done, value } = await Promise.race([inner.next(), t]);
|
|
102
|
+
clearTimeout(clock);
|
|
103
|
+
if (done || value.message === void 0) {
|
|
104
|
+
return { done: true, value: void 0 };
|
|
105
|
+
}
|
|
106
|
+
const decodedMessage = decoder(value.message);
|
|
107
|
+
if (endingCursor) {
|
|
108
|
+
assert(value.message.$case === "data");
|
|
109
|
+
assert(decodedMessage._tag === "data");
|
|
110
|
+
const { orderKey, uniqueKey } = endingCursor;
|
|
111
|
+
const endCursor = decodedMessage.data.endCursor;
|
|
112
|
+
if (orderKey === endCursor?.orderKey) {
|
|
113
|
+
if (!uniqueKey || uniqueKey === endCursor.uniqueKey) {
|
|
114
|
+
shouldStop = true;
|
|
115
|
+
return { done: false, value: decodedMessage };
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
119
|
+
return {
|
|
120
|
+
done: false,
|
|
121
|
+
value: decodedMessage
|
|
122
|
+
};
|
|
123
|
+
} finally {
|
|
124
|
+
clearTimeout(clock);
|
|
101
125
|
}
|
|
102
|
-
return {
|
|
103
|
-
done: false,
|
|
104
|
-
value: decodedMessage
|
|
105
|
-
};
|
|
106
126
|
}
|
|
107
127
|
};
|
|
108
128
|
}
|
|
@@ -156,4 +176,4 @@ class RateGauge {
|
|
|
156
176
|
}
|
|
157
177
|
}
|
|
158
178
|
|
|
159
|
-
export { Cursor, DnaStreamDefinition, GrpcClient, RateGauge, StatusRequest, StatusResponse, StreamDataIterable, StreamDataResponse, createClient, index as proto, statusRequestFromProto, statusRequestToProto, statusResponseFromProto, statusResponseToProto };
|
|
179
|
+
export { Cursor, DnaStreamDefinition, GrpcClient, RateGauge, StatusRequest, StatusResponse, StreamDataIterable, StreamDataResponse, TimeoutError, createClient, index as proto, statusRequestFromProto, statusRequestToProto, statusResponseFromProto, statusResponseToProto };
|
|
@@ -135,6 +135,43 @@ function dataFinalityToJSON(object) {
|
|
|
135
135
|
return "UNRECOGNIZED";
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
var DataProduction$1 = /* @__PURE__ */ ((DataProduction2) => {
|
|
139
|
+
DataProduction2[DataProduction2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
140
|
+
DataProduction2[DataProduction2["BACKFILL"] = 1] = "BACKFILL";
|
|
141
|
+
DataProduction2[DataProduction2["LIVE"] = 2] = "LIVE";
|
|
142
|
+
DataProduction2[DataProduction2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
143
|
+
return DataProduction2;
|
|
144
|
+
})(DataProduction$1 || {});
|
|
145
|
+
function dataProductionFromJSON(object) {
|
|
146
|
+
switch (object) {
|
|
147
|
+
case 0:
|
|
148
|
+
case "DATA_PRODUCTION_UNKNOWN":
|
|
149
|
+
return 0 /* UNKNOWN */;
|
|
150
|
+
case 1:
|
|
151
|
+
case "DATA_PRODUCTION_BACKFILL":
|
|
152
|
+
return 1 /* BACKFILL */;
|
|
153
|
+
case 2:
|
|
154
|
+
case "DATA_PRODUCTION_LIVE":
|
|
155
|
+
return 2 /* LIVE */;
|
|
156
|
+
case -1:
|
|
157
|
+
case "UNRECOGNIZED":
|
|
158
|
+
default:
|
|
159
|
+
return -1 /* UNRECOGNIZED */;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function dataProductionToJSON(object) {
|
|
163
|
+
switch (object) {
|
|
164
|
+
case 0 /* UNKNOWN */:
|
|
165
|
+
return "DATA_PRODUCTION_UNKNOWN";
|
|
166
|
+
case 1 /* BACKFILL */:
|
|
167
|
+
return "DATA_PRODUCTION_BACKFILL";
|
|
168
|
+
case 2 /* LIVE */:
|
|
169
|
+
return "DATA_PRODUCTION_LIVE";
|
|
170
|
+
case -1 /* UNRECOGNIZED */:
|
|
171
|
+
default:
|
|
172
|
+
return "UNRECOGNIZED";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
138
175
|
function createBaseCursor() {
|
|
139
176
|
return { orderKey: BigInt("0"), uniqueKey: new Uint8Array(0) };
|
|
140
177
|
}
|
|
@@ -663,7 +700,7 @@ const Finalize$1 = {
|
|
|
663
700
|
}
|
|
664
701
|
};
|
|
665
702
|
function createBaseData() {
|
|
666
|
-
return { cursor: void 0, endCursor: void 0, finality: 0, data: [] };
|
|
703
|
+
return { cursor: void 0, endCursor: void 0, finality: 0, data: [], production: 0 };
|
|
667
704
|
}
|
|
668
705
|
const Data$1 = {
|
|
669
706
|
encode(message, writer = _m0__default.Writer.create()) {
|
|
@@ -679,6 +716,9 @@ const Data$1 = {
|
|
|
679
716
|
for (const v of message.data) {
|
|
680
717
|
writer.uint32(34).bytes(v);
|
|
681
718
|
}
|
|
719
|
+
if (message.production !== 0) {
|
|
720
|
+
writer.uint32(40).int32(message.production);
|
|
721
|
+
}
|
|
682
722
|
return writer;
|
|
683
723
|
},
|
|
684
724
|
decode(input, length) {
|
|
@@ -712,6 +752,12 @@ const Data$1 = {
|
|
|
712
752
|
}
|
|
713
753
|
message.data.push(reader.bytes());
|
|
714
754
|
continue;
|
|
755
|
+
case 5:
|
|
756
|
+
if (tag !== 40) {
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
message.production = reader.int32();
|
|
760
|
+
continue;
|
|
715
761
|
}
|
|
716
762
|
if ((tag & 7) === 4 || tag === 0) {
|
|
717
763
|
break;
|
|
@@ -725,7 +771,8 @@ const Data$1 = {
|
|
|
725
771
|
cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0,
|
|
726
772
|
endCursor: isSet$1(object.endCursor) ? Cursor$1.fromJSON(object.endCursor) : void 0,
|
|
727
773
|
finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : 0,
|
|
728
|
-
data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => bytesFromBase64(e)) : []
|
|
774
|
+
data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => bytesFromBase64(e)) : [],
|
|
775
|
+
production: isSet$1(object.production) ? dataProductionFromJSON(object.production) : 0
|
|
729
776
|
};
|
|
730
777
|
},
|
|
731
778
|
toJSON(message) {
|
|
@@ -742,6 +789,9 @@ const Data$1 = {
|
|
|
742
789
|
if (message.data?.length) {
|
|
743
790
|
obj.data = message.data.map((e) => base64FromBytes(e));
|
|
744
791
|
}
|
|
792
|
+
if (message.production !== 0) {
|
|
793
|
+
obj.production = dataProductionToJSON(message.production);
|
|
794
|
+
}
|
|
745
795
|
return obj;
|
|
746
796
|
},
|
|
747
797
|
create(base) {
|
|
@@ -753,6 +803,7 @@ const Data$1 = {
|
|
|
753
803
|
message.endCursor = object.endCursor !== void 0 && object.endCursor !== null ? Cursor$1.fromPartial(object.endCursor) : void 0;
|
|
754
804
|
message.finality = object.finality ?? 0;
|
|
755
805
|
message.data = object.data?.map((e) => e) || [];
|
|
806
|
+
message.production = object.production ?? 0;
|
|
756
807
|
return message;
|
|
757
808
|
}
|
|
758
809
|
};
|
|
@@ -925,6 +976,7 @@ const stream = {
|
|
|
925
976
|
Cursor: Cursor$1,
|
|
926
977
|
Data: Data$1,
|
|
927
978
|
DataFinality: DataFinality$1,
|
|
979
|
+
DataProduction: DataProduction$1,
|
|
928
980
|
DnaStreamDefinition: DnaStreamDefinition,
|
|
929
981
|
Finalize: Finalize$1,
|
|
930
982
|
Heartbeat: Heartbeat$1,
|
|
@@ -936,6 +988,8 @@ const stream = {
|
|
|
936
988
|
SystemMessage: SystemMessage$1,
|
|
937
989
|
dataFinalityFromJSON: dataFinalityFromJSON,
|
|
938
990
|
dataFinalityToJSON: dataFinalityToJSON,
|
|
991
|
+
dataProductionFromJSON: dataProductionFromJSON,
|
|
992
|
+
dataProductionToJSON: dataProductionToJSON,
|
|
939
993
|
protobufPackage: protobufPackage$1
|
|
940
994
|
};
|
|
941
995
|
|
|
@@ -1126,6 +1180,29 @@ const DataFinality = schema.Schema.transform(
|
|
|
1126
1180
|
}
|
|
1127
1181
|
}
|
|
1128
1182
|
);
|
|
1183
|
+
const DataProduction = schema.Schema.transform(
|
|
1184
|
+
schema.Schema.Enums(DataProduction$1),
|
|
1185
|
+
schema.Schema.Literal("backfill", "live", "unknown"),
|
|
1186
|
+
{
|
|
1187
|
+
decode(value) {
|
|
1188
|
+
const enumMap = {
|
|
1189
|
+
[DataProduction$1.BACKFILL]: "backfill",
|
|
1190
|
+
[DataProduction$1.LIVE]: "live",
|
|
1191
|
+
[DataProduction$1.UNKNOWN]: "unknown",
|
|
1192
|
+
[DataProduction$1.UNRECOGNIZED]: "unknown"
|
|
1193
|
+
};
|
|
1194
|
+
return enumMap[value] ?? "unknown";
|
|
1195
|
+
},
|
|
1196
|
+
encode(value) {
|
|
1197
|
+
const enumMap = {
|
|
1198
|
+
backfill: DataProduction$1.BACKFILL,
|
|
1199
|
+
live: DataProduction$1.LIVE,
|
|
1200
|
+
unknown: DataProduction$1.UNKNOWN
|
|
1201
|
+
};
|
|
1202
|
+
return enumMap[value] ?? DataProduction$1.UNKNOWN;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
);
|
|
1129
1206
|
const Duration = schema.Schema.Struct({
|
|
1130
1207
|
seconds: schema.Schema.BigIntFromSelf,
|
|
1131
1208
|
nanos: schema.Schema.Number
|
|
@@ -1171,6 +1248,7 @@ const Data = (schema$1) => schema.Schema.Struct({
|
|
|
1171
1248
|
cursor: schema.Schema.optional(Cursor),
|
|
1172
1249
|
endCursor: schema.Schema.optional(Cursor),
|
|
1173
1250
|
finality: DataFinality,
|
|
1251
|
+
production: DataProduction,
|
|
1174
1252
|
data: schema.Schema.Array(schema$1)
|
|
1175
1253
|
})
|
|
1176
1254
|
});
|
|
@@ -1228,6 +1306,7 @@ exports.Cursor = Cursor;
|
|
|
1228
1306
|
exports.CursorFromBytes = CursorFromBytes;
|
|
1229
1307
|
exports.Data = Data;
|
|
1230
1308
|
exports.DataFinality = DataFinality;
|
|
1309
|
+
exports.DataProduction = DataProduction;
|
|
1231
1310
|
exports.DnaStreamDefinition = DnaStreamDefinition;
|
|
1232
1311
|
exports.Duration = Duration;
|
|
1233
1312
|
exports.Finalize = Finalize;
|
|
@@ -128,6 +128,43 @@ function dataFinalityToJSON(object) {
|
|
|
128
128
|
return "UNRECOGNIZED";
|
|
129
129
|
}
|
|
130
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
|
+
}
|
|
131
168
|
function createBaseCursor() {
|
|
132
169
|
return { orderKey: BigInt("0"), uniqueKey: new Uint8Array(0) };
|
|
133
170
|
}
|
|
@@ -656,7 +693,7 @@ const Finalize$1 = {
|
|
|
656
693
|
}
|
|
657
694
|
};
|
|
658
695
|
function createBaseData() {
|
|
659
|
-
return { cursor: void 0, endCursor: void 0, finality: 0, data: [] };
|
|
696
|
+
return { cursor: void 0, endCursor: void 0, finality: 0, data: [], production: 0 };
|
|
660
697
|
}
|
|
661
698
|
const Data$1 = {
|
|
662
699
|
encode(message, writer = _m0.Writer.create()) {
|
|
@@ -672,6 +709,9 @@ const Data$1 = {
|
|
|
672
709
|
for (const v of message.data) {
|
|
673
710
|
writer.uint32(34).bytes(v);
|
|
674
711
|
}
|
|
712
|
+
if (message.production !== 0) {
|
|
713
|
+
writer.uint32(40).int32(message.production);
|
|
714
|
+
}
|
|
675
715
|
return writer;
|
|
676
716
|
},
|
|
677
717
|
decode(input, length) {
|
|
@@ -705,6 +745,12 @@ const Data$1 = {
|
|
|
705
745
|
}
|
|
706
746
|
message.data.push(reader.bytes());
|
|
707
747
|
continue;
|
|
748
|
+
case 5:
|
|
749
|
+
if (tag !== 40) {
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
message.production = reader.int32();
|
|
753
|
+
continue;
|
|
708
754
|
}
|
|
709
755
|
if ((tag & 7) === 4 || tag === 0) {
|
|
710
756
|
break;
|
|
@@ -718,7 +764,8 @@ const Data$1 = {
|
|
|
718
764
|
cursor: isSet$1(object.cursor) ? Cursor$1.fromJSON(object.cursor) : void 0,
|
|
719
765
|
endCursor: isSet$1(object.endCursor) ? Cursor$1.fromJSON(object.endCursor) : void 0,
|
|
720
766
|
finality: isSet$1(object.finality) ? dataFinalityFromJSON(object.finality) : 0,
|
|
721
|
-
data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => bytesFromBase64(e)) : []
|
|
767
|
+
data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => bytesFromBase64(e)) : [],
|
|
768
|
+
production: isSet$1(object.production) ? dataProductionFromJSON(object.production) : 0
|
|
722
769
|
};
|
|
723
770
|
},
|
|
724
771
|
toJSON(message) {
|
|
@@ -735,6 +782,9 @@ const Data$1 = {
|
|
|
735
782
|
if (message.data?.length) {
|
|
736
783
|
obj.data = message.data.map((e) => base64FromBytes(e));
|
|
737
784
|
}
|
|
785
|
+
if (message.production !== 0) {
|
|
786
|
+
obj.production = dataProductionToJSON(message.production);
|
|
787
|
+
}
|
|
738
788
|
return obj;
|
|
739
789
|
},
|
|
740
790
|
create(base) {
|
|
@@ -746,6 +796,7 @@ const Data$1 = {
|
|
|
746
796
|
message.endCursor = object.endCursor !== void 0 && object.endCursor !== null ? Cursor$1.fromPartial(object.endCursor) : void 0;
|
|
747
797
|
message.finality = object.finality ?? 0;
|
|
748
798
|
message.data = object.data?.map((e) => e) || [];
|
|
799
|
+
message.production = object.production ?? 0;
|
|
749
800
|
return message;
|
|
750
801
|
}
|
|
751
802
|
};
|
|
@@ -918,6 +969,7 @@ const stream = {
|
|
|
918
969
|
Cursor: Cursor$1,
|
|
919
970
|
Data: Data$1,
|
|
920
971
|
DataFinality: DataFinality$1,
|
|
972
|
+
DataProduction: DataProduction$1,
|
|
921
973
|
DnaStreamDefinition: DnaStreamDefinition,
|
|
922
974
|
Finalize: Finalize$1,
|
|
923
975
|
Heartbeat: Heartbeat$1,
|
|
@@ -929,6 +981,8 @@ const stream = {
|
|
|
929
981
|
SystemMessage: SystemMessage$1,
|
|
930
982
|
dataFinalityFromJSON: dataFinalityFromJSON,
|
|
931
983
|
dataFinalityToJSON: dataFinalityToJSON,
|
|
984
|
+
dataProductionFromJSON: dataProductionFromJSON,
|
|
985
|
+
dataProductionToJSON: dataProductionToJSON,
|
|
932
986
|
protobufPackage: protobufPackage$1
|
|
933
987
|
};
|
|
934
988
|
|
|
@@ -1119,6 +1173,29 @@ const DataFinality = Schema.transform(
|
|
|
1119
1173
|
}
|
|
1120
1174
|
}
|
|
1121
1175
|
);
|
|
1176
|
+
const DataProduction = Schema.transform(
|
|
1177
|
+
Schema.Enums(DataProduction$1),
|
|
1178
|
+
Schema.Literal("backfill", "live", "unknown"),
|
|
1179
|
+
{
|
|
1180
|
+
decode(value) {
|
|
1181
|
+
const enumMap = {
|
|
1182
|
+
[DataProduction$1.BACKFILL]: "backfill",
|
|
1183
|
+
[DataProduction$1.LIVE]: "live",
|
|
1184
|
+
[DataProduction$1.UNKNOWN]: "unknown",
|
|
1185
|
+
[DataProduction$1.UNRECOGNIZED]: "unknown"
|
|
1186
|
+
};
|
|
1187
|
+
return enumMap[value] ?? "unknown";
|
|
1188
|
+
},
|
|
1189
|
+
encode(value) {
|
|
1190
|
+
const enumMap = {
|
|
1191
|
+
backfill: DataProduction$1.BACKFILL,
|
|
1192
|
+
live: DataProduction$1.LIVE,
|
|
1193
|
+
unknown: DataProduction$1.UNKNOWN
|
|
1194
|
+
};
|
|
1195
|
+
return enumMap[value] ?? DataProduction$1.UNKNOWN;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
);
|
|
1122
1199
|
const Duration = Schema.Struct({
|
|
1123
1200
|
seconds: Schema.BigIntFromSelf,
|
|
1124
1201
|
nanos: Schema.Number
|
|
@@ -1164,6 +1241,7 @@ const Data = (schema) => Schema.Struct({
|
|
|
1164
1241
|
cursor: Schema.optional(Cursor),
|
|
1165
1242
|
endCursor: Schema.optional(Cursor),
|
|
1166
1243
|
finality: DataFinality,
|
|
1244
|
+
production: DataProduction,
|
|
1167
1245
|
data: Schema.Array(schema)
|
|
1168
1246
|
})
|
|
1169
1247
|
});
|
|
@@ -1215,4 +1293,4 @@ class StreamConfig {
|
|
|
1215
1293
|
}
|
|
1216
1294
|
}
|
|
1217
1295
|
|
|
1218
|
-
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,
|
|
1296
|
+
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, StdErr as n, SystemMessage as o, Data as p, StreamConfig as q, MockBlock as r, stream as s, testing as t };
|
|
@@ -115,6 +115,17 @@ declare enum DataFinality$1 {
|
|
|
115
115
|
}
|
|
116
116
|
declare function dataFinalityFromJSON(object: any): DataFinality$1;
|
|
117
117
|
declare function dataFinalityToJSON(object: DataFinality$1): string;
|
|
118
|
+
/** Data production mode. */
|
|
119
|
+
declare enum DataProduction$1 {
|
|
120
|
+
UNKNOWN = 0,
|
|
121
|
+
/** BACKFILL - Data is for a backfilled block. */
|
|
122
|
+
BACKFILL = 1,
|
|
123
|
+
/** LIVE - Data is for a live block. */
|
|
124
|
+
LIVE = 2,
|
|
125
|
+
UNRECOGNIZED = -1
|
|
126
|
+
}
|
|
127
|
+
declare function dataProductionFromJSON(object: any): DataProduction$1;
|
|
128
|
+
declare function dataProductionToJSON(object: DataProduction$1): string;
|
|
118
129
|
/** A cursor over the stream content. */
|
|
119
130
|
interface Cursor$1 {
|
|
120
131
|
/**
|
|
@@ -286,6 +297,8 @@ interface Data$1 {
|
|
|
286
297
|
* This message contains chain-specific data serialized using protobuf.
|
|
287
298
|
*/
|
|
288
299
|
readonly data: readonly Uint8Array[];
|
|
300
|
+
/** The production mode of the block. */
|
|
301
|
+
readonly production: DataProduction$1;
|
|
289
302
|
}
|
|
290
303
|
declare const Data$1: {
|
|
291
304
|
encode(message: Data$1, writer?: _m0.Writer): _m0.Writer;
|
|
@@ -410,9 +423,11 @@ type stream_DnaStreamServiceImplementation<CallContextExt = {}> = DnaStreamServi
|
|
|
410
423
|
type stream_ServerStreamingMethodResult<Response> = ServerStreamingMethodResult<Response>;
|
|
411
424
|
declare const stream_dataFinalityFromJSON: typeof dataFinalityFromJSON;
|
|
412
425
|
declare const stream_dataFinalityToJSON: typeof dataFinalityToJSON;
|
|
426
|
+
declare const stream_dataProductionFromJSON: typeof dataProductionFromJSON;
|
|
427
|
+
declare const stream_dataProductionToJSON: typeof dataProductionToJSON;
|
|
413
428
|
declare const stream_protobufPackage: typeof protobufPackage;
|
|
414
429
|
declare namespace stream {
|
|
415
|
-
export { Cursor$1 as Cursor, Data$1 as Data, DataFinality$1 as DataFinality, type stream_DeepPartial as DeepPartial, type stream_DnaStreamClient as DnaStreamClient, stream_DnaStreamDefinition as DnaStreamDefinition, type stream_DnaStreamServiceImplementation as DnaStreamServiceImplementation, Finalize$1 as Finalize, Heartbeat$1 as Heartbeat, Invalidate$1 as Invalidate, type stream_ServerStreamingMethodResult as ServerStreamingMethodResult, StatusRequest$1 as StatusRequest, StatusResponse$1 as StatusResponse, StreamDataRequest$1 as StreamDataRequest, StreamDataResponse$1 as StreamDataResponse, SystemMessage$1 as SystemMessage, stream_dataFinalityFromJSON as dataFinalityFromJSON, stream_dataFinalityToJSON as dataFinalityToJSON, stream_protobufPackage as protobufPackage };
|
|
430
|
+
export { Cursor$1 as Cursor, Data$1 as Data, DataFinality$1 as DataFinality, DataProduction$1 as DataProduction, type stream_DeepPartial as DeepPartial, type stream_DnaStreamClient as DnaStreamClient, stream_DnaStreamDefinition as DnaStreamDefinition, type stream_DnaStreamServiceImplementation as DnaStreamServiceImplementation, Finalize$1 as Finalize, Heartbeat$1 as Heartbeat, Invalidate$1 as Invalidate, type stream_ServerStreamingMethodResult as ServerStreamingMethodResult, StatusRequest$1 as StatusRequest, StatusResponse$1 as StatusResponse, StreamDataRequest$1 as StreamDataRequest, StreamDataResponse$1 as StreamDataResponse, SystemMessage$1 as SystemMessage, stream_dataFinalityFromJSON as dataFinalityFromJSON, stream_dataFinalityToJSON as dataFinalityToJSON, stream_dataProductionFromJSON as dataProductionFromJSON, stream_dataProductionToJSON as dataProductionToJSON, stream_protobufPackage as protobufPackage };
|
|
416
431
|
}
|
|
417
432
|
|
|
418
433
|
/** Bytes encoded as a 0x-prefixed hex string. */
|
|
@@ -479,6 +494,9 @@ declare const statusResponseFromProto: (i: {
|
|
|
479
494
|
/** Data finality. */
|
|
480
495
|
declare const DataFinality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
481
496
|
type DataFinality = typeof DataFinality.Type;
|
|
497
|
+
/** Data production mode. */
|
|
498
|
+
declare const DataProduction: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
499
|
+
type DataProduction = typeof DataProduction.Type;
|
|
482
500
|
declare const Duration: Schema.Struct<{
|
|
483
501
|
seconds: typeof Schema.BigIntFromSelf;
|
|
484
502
|
nanos: typeof Schema.Number;
|
|
@@ -545,6 +563,7 @@ declare const Data: <TA, TR>(schema: Schema.Schema<TA | null, Uint8Array, TR>) =
|
|
|
545
563
|
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
546
564
|
endCursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
547
565
|
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
566
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
548
567
|
data: Schema.Array$<Schema.Schema<TA | null, Uint8Array, TR>>;
|
|
549
568
|
}>;
|
|
550
569
|
}>;
|
|
@@ -579,6 +598,7 @@ declare const StreamDataResponse: <TA, TR>(data: Schema.Schema<TA | null, Uint8A
|
|
|
579
598
|
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
580
599
|
endCursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
581
600
|
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
601
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
582
602
|
data: Schema.Array$<Schema.Schema<TA | null, Uint8Array, TR>>;
|
|
583
603
|
}>;
|
|
584
604
|
}>, Schema.Struct<{
|
|
@@ -611,6 +631,7 @@ type StreamDataResponse<TA> = ResponseWithoutData | {
|
|
|
611
631
|
cursor?: Cursor | undefined;
|
|
612
632
|
endCursor?: Cursor | undefined;
|
|
613
633
|
finality: DataFinality;
|
|
634
|
+
production: DataProduction;
|
|
614
635
|
data: readonly (TA | null)[];
|
|
615
636
|
};
|
|
616
637
|
};
|
|
@@ -644,6 +665,7 @@ declare class StreamConfig<TFilter, TBlock> {
|
|
|
644
665
|
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
645
666
|
endCursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
646
667
|
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
668
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
647
669
|
data: Schema.Array$<Schema.Schema<TBlock | null, Uint8Array, never>>;
|
|
648
670
|
}>;
|
|
649
671
|
}>, Schema.Struct<{
|
|
@@ -672,13 +694,18 @@ declare class StreamConfig<TFilter, TBlock> {
|
|
|
672
694
|
}>]>;
|
|
673
695
|
}
|
|
674
696
|
|
|
697
|
+
declare class TimeoutError extends Error {
|
|
698
|
+
constructor(timeout: number);
|
|
699
|
+
}
|
|
675
700
|
/** Client call options. */
|
|
676
701
|
interface ClientCallOptions {
|
|
677
702
|
signal?: AbortSignal;
|
|
678
703
|
}
|
|
679
704
|
interface StreamDataOptions extends ClientCallOptions {
|
|
680
|
-
/** Stop at the specified cursor (inclusive) */
|
|
705
|
+
/** Stop at the specified cursor (inclusive). */
|
|
681
706
|
endingCursor?: Cursor;
|
|
707
|
+
/** Timeout between messages, in milliseconds. */
|
|
708
|
+
timeout?: number;
|
|
682
709
|
}
|
|
683
710
|
/** DNA client. */
|
|
684
711
|
interface Client<TFilter, TBlock> {
|
|
@@ -715,4 +742,4 @@ declare class StreamDataIterable<TBlock> {
|
|
|
715
742
|
[Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
|
|
716
743
|
}
|
|
717
744
|
|
|
718
|
-
export { type
|
|
745
|
+
export { type ClientCallOptions as A, Bytes as B, type CursorProto as C, type DnaStreamClient as D, type StreamDataOptions as E, Finalize as F, type Client as G, Heartbeat as H, Invalidate as I, type CreateClientOptions as J, createClient as K, GrpcClient as L, StreamDataIterable as M, DataFinality$1 as N, DataProduction$1 as O, StatusRequest as S, TimeoutError as T, _Cursor as _, DnaStreamDefinition as a, BytesFromUint8Array as b, Cursor as c, createCursor as d, cursorToProto as e, cursorFromProto as f, CursorFromBytes as g, cursorToBytes as h, cursorFromBytes as i, isCursor as j, statusRequestToProto as k, statusRequestFromProto as l, StatusResponse as m, statusResponseToProto as n, statusResponseFromProto as o, DataFinality as p, DataProduction as q, Duration as r, stream as s, StreamDataRequest as t, StdOut as u, StdErr as v, SystemMessage as w, Data as x, StreamDataResponse as y, StreamConfig as z };
|