@apibara/protocol 2.0.0-beta.4 → 2.0.0-beta.41
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 +222 -0
- package/dist/index.d.cts +71 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.mjs +179 -0
- package/dist/shared/protocol.4b1cfe2c.d.cts +756 -0
- package/dist/shared/protocol.4b1cfe2c.d.mts +756 -0
- package/dist/shared/protocol.4b1cfe2c.d.ts +756 -0
- package/dist/shared/protocol.991ff9ad.mjs +1308 -0
- package/dist/shared/protocol.e39e40d6.cjs +1344 -0
- package/dist/testing/index.cjs +105 -0
- package/dist/testing/index.d.cts +76 -0
- package/dist/testing/index.d.mts +76 -0
- package/dist/testing/index.d.ts +76 -0
- package/dist/testing/index.mjs +97 -0
- package/package.json +8 -10
- package/src/client.ts +72 -28
- package/src/common.ts +28 -0
- package/src/proto/google/protobuf/duration.ts +1 -1
- package/src/proto/stream.ts +62 -3
- package/src/proto/testing.ts +1 -1
- package/src/stream.test.ts +16 -0
- package/src/stream.ts +34 -3
- package/src/testing/client.test.ts +28 -2
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import { Schema } from '@effect/schema';
|
|
2
|
+
import { DefaultCallOptions, NormalizedServiceDefinition, ChannelCredentials, ChannelOptions } from 'nice-grpc';
|
|
3
|
+
import { CallContext, CallOptions } from 'nice-grpc-common';
|
|
4
|
+
import _m0 from 'protobufjs/minimal.js';
|
|
5
|
+
import * as _effect_schema_AST from '@effect/schema/AST';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A Duration represents a signed, fixed-length span of time represented
|
|
9
|
+
* as a count of seconds and fractions of seconds at nanosecond
|
|
10
|
+
* resolution. It is independent of any calendar and concepts like "day"
|
|
11
|
+
* or "month". It is related to Timestamp in that the difference between
|
|
12
|
+
* two Timestamp values is a Duration and it can be added or subtracted
|
|
13
|
+
* from a Timestamp. Range is approximately +-10,000 years.
|
|
14
|
+
*
|
|
15
|
+
* # Examples
|
|
16
|
+
*
|
|
17
|
+
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
18
|
+
*
|
|
19
|
+
* Timestamp start = ...;
|
|
20
|
+
* Timestamp end = ...;
|
|
21
|
+
* Duration duration = ...;
|
|
22
|
+
*
|
|
23
|
+
* duration.seconds = end.seconds - start.seconds;
|
|
24
|
+
* duration.nanos = end.nanos - start.nanos;
|
|
25
|
+
*
|
|
26
|
+
* if (duration.seconds < 0 && duration.nanos > 0) {
|
|
27
|
+
* duration.seconds += 1;
|
|
28
|
+
* duration.nanos -= 1000000000;
|
|
29
|
+
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
30
|
+
* duration.seconds -= 1;
|
|
31
|
+
* duration.nanos += 1000000000;
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
35
|
+
*
|
|
36
|
+
* Timestamp start = ...;
|
|
37
|
+
* Duration duration = ...;
|
|
38
|
+
* Timestamp end = ...;
|
|
39
|
+
*
|
|
40
|
+
* end.seconds = start.seconds + duration.seconds;
|
|
41
|
+
* end.nanos = start.nanos + duration.nanos;
|
|
42
|
+
*
|
|
43
|
+
* if (end.nanos < 0) {
|
|
44
|
+
* end.seconds -= 1;
|
|
45
|
+
* end.nanos += 1000000000;
|
|
46
|
+
* } else if (end.nanos >= 1000000000) {
|
|
47
|
+
* end.seconds += 1;
|
|
48
|
+
* end.nanos -= 1000000000;
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* Example 3: Compute Duration from datetime.timedelta in Python.
|
|
52
|
+
*
|
|
53
|
+
* td = datetime.timedelta(days=3, minutes=10)
|
|
54
|
+
* duration = Duration()
|
|
55
|
+
* duration.FromTimedelta(td)
|
|
56
|
+
*
|
|
57
|
+
* # JSON Mapping
|
|
58
|
+
*
|
|
59
|
+
* In JSON format, the Duration type is encoded as a string rather than an
|
|
60
|
+
* object, where the string ends in the suffix "s" (indicating seconds) and
|
|
61
|
+
* is preceded by the number of seconds, with nanoseconds expressed as
|
|
62
|
+
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
63
|
+
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
64
|
+
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
65
|
+
* microsecond should be expressed in JSON format as "3.000001s".
|
|
66
|
+
*/
|
|
67
|
+
interface Duration$1 {
|
|
68
|
+
/**
|
|
69
|
+
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
70
|
+
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
71
|
+
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
72
|
+
*/
|
|
73
|
+
readonly seconds: bigint;
|
|
74
|
+
/**
|
|
75
|
+
* Signed fractions of a second at nanosecond resolution of the span
|
|
76
|
+
* of time. Durations less than one second are represented with a 0
|
|
77
|
+
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
78
|
+
* of one second or more, a non-zero value for the `nanos` field must be
|
|
79
|
+
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
80
|
+
* to +999,999,999 inclusive.
|
|
81
|
+
*/
|
|
82
|
+
readonly nanos: number;
|
|
83
|
+
}
|
|
84
|
+
declare const Duration$1: {
|
|
85
|
+
encode(message: Duration$1, writer?: _m0.Writer): _m0.Writer;
|
|
86
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Duration$1;
|
|
87
|
+
fromJSON(object: any): Duration$1;
|
|
88
|
+
toJSON(message: Duration$1): unknown;
|
|
89
|
+
create(base?: DeepPartial$1<Duration$1>): Duration$1;
|
|
90
|
+
fromPartial(object: DeepPartial$1<Duration$1>): Duration$1;
|
|
91
|
+
};
|
|
92
|
+
type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
93
|
+
type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {
|
|
94
|
+
readonly $case: string;
|
|
95
|
+
} ? {
|
|
96
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial$1<T[K]>;
|
|
97
|
+
} & {
|
|
98
|
+
readonly $case: T["$case"];
|
|
99
|
+
} : T extends {} ? {
|
|
100
|
+
[K in keyof T]?: DeepPartial$1<T[K]>;
|
|
101
|
+
} : Partial<T>;
|
|
102
|
+
|
|
103
|
+
declare const protobufPackage = "dna.v2.stream";
|
|
104
|
+
/** Apibara DNA server V2 */
|
|
105
|
+
/** Data finality. */
|
|
106
|
+
declare enum DataFinality$1 {
|
|
107
|
+
UNKNOWN = 0,
|
|
108
|
+
/** PENDING - Data was received, but is not part of the canonical chain yet. */
|
|
109
|
+
PENDING = 1,
|
|
110
|
+
/** ACCEPTED - Data is now part of the canonical chain, but could still be invalidated. */
|
|
111
|
+
ACCEPTED = 2,
|
|
112
|
+
/** FINALIZED - Data is finalized and cannot be invalidated. */
|
|
113
|
+
FINALIZED = 3,
|
|
114
|
+
UNRECOGNIZED = -1
|
|
115
|
+
}
|
|
116
|
+
declare function dataFinalityFromJSON(object: any): DataFinality$1;
|
|
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;
|
|
129
|
+
/** A cursor over the stream content. */
|
|
130
|
+
interface Cursor$1 {
|
|
131
|
+
/**
|
|
132
|
+
* Key used for ordering messages in the stream.
|
|
133
|
+
*
|
|
134
|
+
* This is usually the block or slot number.
|
|
135
|
+
*/
|
|
136
|
+
readonly orderKey: bigint;
|
|
137
|
+
/**
|
|
138
|
+
* Key used to discriminate branches in the stream.
|
|
139
|
+
*
|
|
140
|
+
* This is usually the hash of the block.
|
|
141
|
+
*/
|
|
142
|
+
readonly uniqueKey: Uint8Array;
|
|
143
|
+
}
|
|
144
|
+
declare const Cursor$1: {
|
|
145
|
+
encode(message: Cursor$1, writer?: _m0.Writer): _m0.Writer;
|
|
146
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Cursor$1;
|
|
147
|
+
fromJSON(object: any): Cursor$1;
|
|
148
|
+
toJSON(message: Cursor$1): unknown;
|
|
149
|
+
create(base?: DeepPartial<Cursor$1>): Cursor$1;
|
|
150
|
+
fromPartial(object: DeepPartial<Cursor$1>): Cursor$1;
|
|
151
|
+
};
|
|
152
|
+
/** Request for the `Status` method. */
|
|
153
|
+
interface StatusRequest$1 {
|
|
154
|
+
}
|
|
155
|
+
declare const StatusRequest$1: {
|
|
156
|
+
encode(_: StatusRequest$1, writer?: _m0.Writer): _m0.Writer;
|
|
157
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StatusRequest$1;
|
|
158
|
+
fromJSON(_: any): StatusRequest$1;
|
|
159
|
+
toJSON(_: StatusRequest$1): unknown;
|
|
160
|
+
create(base?: DeepPartial<StatusRequest$1>): StatusRequest$1;
|
|
161
|
+
fromPartial(_: DeepPartial<StatusRequest$1>): StatusRequest$1;
|
|
162
|
+
};
|
|
163
|
+
/** Response for the `Status` method. */
|
|
164
|
+
interface StatusResponse$1 {
|
|
165
|
+
/** The current head of the chain. */
|
|
166
|
+
readonly currentHead?: Cursor$1 | undefined;
|
|
167
|
+
/** The last cursor that was ingested by the node. */
|
|
168
|
+
readonly lastIngested?: Cursor$1 | undefined;
|
|
169
|
+
/** The finalized block. */
|
|
170
|
+
readonly finalized?: Cursor$1 | undefined;
|
|
171
|
+
/** The first block available. */
|
|
172
|
+
readonly starting?: Cursor$1 | undefined;
|
|
173
|
+
}
|
|
174
|
+
declare const StatusResponse$1: {
|
|
175
|
+
encode(message: StatusResponse$1, writer?: _m0.Writer): _m0.Writer;
|
|
176
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StatusResponse$1;
|
|
177
|
+
fromJSON(object: any): StatusResponse$1;
|
|
178
|
+
toJSON(message: StatusResponse$1): unknown;
|
|
179
|
+
create(base?: DeepPartial<StatusResponse$1>): StatusResponse$1;
|
|
180
|
+
fromPartial(object: DeepPartial<StatusResponse$1>): StatusResponse$1;
|
|
181
|
+
};
|
|
182
|
+
/** Request data to be streamed. */
|
|
183
|
+
interface StreamDataRequest$1 {
|
|
184
|
+
/**
|
|
185
|
+
* Cursor to start streaming from.
|
|
186
|
+
*
|
|
187
|
+
* If not specified, starts from the genesis block.
|
|
188
|
+
* Use the data's message `end_cursor` field to resume streaming.
|
|
189
|
+
*/
|
|
190
|
+
readonly startingCursor?: Cursor$1 | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Return data with the specified finality.
|
|
193
|
+
*
|
|
194
|
+
* If not specified, defaults to `DATA_FINALITY_ACCEPTED`.
|
|
195
|
+
*/
|
|
196
|
+
readonly finality?: DataFinality$1 | undefined;
|
|
197
|
+
/** Filters used to generate data. */
|
|
198
|
+
readonly filter: readonly Uint8Array[];
|
|
199
|
+
/**
|
|
200
|
+
* Heartbeat interval.
|
|
201
|
+
*
|
|
202
|
+
* Value must be between 10 and 60 seconds.
|
|
203
|
+
* If not specified, defaults to 30 seconds.
|
|
204
|
+
*/
|
|
205
|
+
readonly heartbeatInterval?: Duration$1 | undefined;
|
|
206
|
+
}
|
|
207
|
+
declare const StreamDataRequest$1: {
|
|
208
|
+
encode(message: StreamDataRequest$1, writer?: _m0.Writer): _m0.Writer;
|
|
209
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StreamDataRequest$1;
|
|
210
|
+
fromJSON(object: any): StreamDataRequest$1;
|
|
211
|
+
toJSON(message: StreamDataRequest$1): unknown;
|
|
212
|
+
create(base?: DeepPartial<StreamDataRequest$1>): StreamDataRequest$1;
|
|
213
|
+
fromPartial(object: DeepPartial<StreamDataRequest$1>): StreamDataRequest$1;
|
|
214
|
+
};
|
|
215
|
+
/** Contains a piece of streamed data. */
|
|
216
|
+
interface StreamDataResponse$1 {
|
|
217
|
+
readonly message?: {
|
|
218
|
+
readonly $case: "data";
|
|
219
|
+
readonly data: Data$1;
|
|
220
|
+
} | {
|
|
221
|
+
readonly $case: "invalidate";
|
|
222
|
+
readonly invalidate: Invalidate$1;
|
|
223
|
+
} | {
|
|
224
|
+
readonly $case: "finalize";
|
|
225
|
+
readonly finalize: Finalize$1;
|
|
226
|
+
} | {
|
|
227
|
+
readonly $case: "heartbeat";
|
|
228
|
+
readonly heartbeat: Heartbeat$1;
|
|
229
|
+
} | {
|
|
230
|
+
readonly $case: "systemMessage";
|
|
231
|
+
readonly systemMessage: SystemMessage$1;
|
|
232
|
+
} | undefined;
|
|
233
|
+
}
|
|
234
|
+
declare const StreamDataResponse$1: {
|
|
235
|
+
encode(message: StreamDataResponse$1, writer?: _m0.Writer): _m0.Writer;
|
|
236
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StreamDataResponse$1;
|
|
237
|
+
fromJSON(object: any): StreamDataResponse$1;
|
|
238
|
+
toJSON(message: StreamDataResponse$1): unknown;
|
|
239
|
+
create(base?: DeepPartial<StreamDataResponse$1>): StreamDataResponse$1;
|
|
240
|
+
fromPartial(object: DeepPartial<StreamDataResponse$1>): StreamDataResponse$1;
|
|
241
|
+
};
|
|
242
|
+
/** Invalidate data after the given cursor. */
|
|
243
|
+
interface Invalidate$1 {
|
|
244
|
+
/**
|
|
245
|
+
* The cursor of the new chain's head.
|
|
246
|
+
*
|
|
247
|
+
* All data after this cursor should be considered invalid.
|
|
248
|
+
*/
|
|
249
|
+
readonly cursor?: Cursor$1 | undefined;
|
|
250
|
+
/** List of blocks that were removed from the chain. */
|
|
251
|
+
readonly removed: readonly Cursor$1[];
|
|
252
|
+
}
|
|
253
|
+
declare const Invalidate$1: {
|
|
254
|
+
encode(message: Invalidate$1, writer?: _m0.Writer): _m0.Writer;
|
|
255
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Invalidate$1;
|
|
256
|
+
fromJSON(object: any): Invalidate$1;
|
|
257
|
+
toJSON(message: Invalidate$1): unknown;
|
|
258
|
+
create(base?: DeepPartial<Invalidate$1>): Invalidate$1;
|
|
259
|
+
fromPartial(object: DeepPartial<Invalidate$1>): Invalidate$1;
|
|
260
|
+
};
|
|
261
|
+
/** Move the finalized block forward. */
|
|
262
|
+
interface Finalize$1 {
|
|
263
|
+
/**
|
|
264
|
+
* The cursor of the new finalized block.
|
|
265
|
+
*
|
|
266
|
+
* All data before this cursor cannot be invalidated.
|
|
267
|
+
*/
|
|
268
|
+
readonly cursor?: Cursor$1 | undefined;
|
|
269
|
+
}
|
|
270
|
+
declare const Finalize$1: {
|
|
271
|
+
encode(message: Finalize$1, writer?: _m0.Writer): _m0.Writer;
|
|
272
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Finalize$1;
|
|
273
|
+
fromJSON(object: any): Finalize$1;
|
|
274
|
+
toJSON(message: Finalize$1): unknown;
|
|
275
|
+
create(base?: DeepPartial<Finalize$1>): Finalize$1;
|
|
276
|
+
fromPartial(object: DeepPartial<Finalize$1>): Finalize$1;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* A single block of data.
|
|
280
|
+
*
|
|
281
|
+
* If the request specified multiple filters, the `data` field will contain the
|
|
282
|
+
* data for each filter in the same order as the filters were specified in the
|
|
283
|
+
* request.
|
|
284
|
+
* If no data is available for a filter, the corresponding data field will be
|
|
285
|
+
* empty.
|
|
286
|
+
*/
|
|
287
|
+
interface Data$1 {
|
|
288
|
+
/** Cursor that generated this block of data. */
|
|
289
|
+
readonly cursor?: Cursor$1 | undefined;
|
|
290
|
+
/** Block cursor. Use this cursor to resume the stream. */
|
|
291
|
+
readonly endCursor?: Cursor$1 | undefined;
|
|
292
|
+
/** The finality status of the block. */
|
|
293
|
+
readonly finality: DataFinality$1;
|
|
294
|
+
/**
|
|
295
|
+
* The block data.
|
|
296
|
+
*
|
|
297
|
+
* This message contains chain-specific data serialized using protobuf.
|
|
298
|
+
*/
|
|
299
|
+
readonly data: readonly Uint8Array[];
|
|
300
|
+
/** The production mode of the block. */
|
|
301
|
+
readonly production: DataProduction$1;
|
|
302
|
+
}
|
|
303
|
+
declare const Data$1: {
|
|
304
|
+
encode(message: Data$1, writer?: _m0.Writer): _m0.Writer;
|
|
305
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Data$1;
|
|
306
|
+
fromJSON(object: any): Data$1;
|
|
307
|
+
toJSON(message: Data$1): unknown;
|
|
308
|
+
create(base?: DeepPartial<Data$1>): Data$1;
|
|
309
|
+
fromPartial(object: DeepPartial<Data$1>): Data$1;
|
|
310
|
+
};
|
|
311
|
+
/** Sent to clients to check if stream is still connected. */
|
|
312
|
+
interface Heartbeat$1 {
|
|
313
|
+
}
|
|
314
|
+
declare const Heartbeat$1: {
|
|
315
|
+
encode(_: Heartbeat$1, writer?: _m0.Writer): _m0.Writer;
|
|
316
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Heartbeat$1;
|
|
317
|
+
fromJSON(_: any): Heartbeat$1;
|
|
318
|
+
toJSON(_: Heartbeat$1): unknown;
|
|
319
|
+
create(base?: DeepPartial<Heartbeat$1>): Heartbeat$1;
|
|
320
|
+
fromPartial(_: DeepPartial<Heartbeat$1>): Heartbeat$1;
|
|
321
|
+
};
|
|
322
|
+
/** Message from the server to the client. */
|
|
323
|
+
interface SystemMessage$1 {
|
|
324
|
+
readonly output?: {
|
|
325
|
+
readonly $case: "stdout";
|
|
326
|
+
readonly stdout: string;
|
|
327
|
+
} | {
|
|
328
|
+
readonly $case: "stderr";
|
|
329
|
+
readonly stderr: string;
|
|
330
|
+
} | undefined;
|
|
331
|
+
}
|
|
332
|
+
declare const SystemMessage$1: {
|
|
333
|
+
encode(message: SystemMessage$1, writer?: _m0.Writer): _m0.Writer;
|
|
334
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SystemMessage$1;
|
|
335
|
+
fromJSON(object: any): SystemMessage$1;
|
|
336
|
+
toJSON(message: SystemMessage$1): unknown;
|
|
337
|
+
create(base?: DeepPartial<SystemMessage$1>): SystemMessage$1;
|
|
338
|
+
fromPartial(object: DeepPartial<SystemMessage$1>): SystemMessage$1;
|
|
339
|
+
};
|
|
340
|
+
type DnaStreamDefinition = typeof DnaStreamDefinition;
|
|
341
|
+
declare const DnaStreamDefinition: {
|
|
342
|
+
readonly name: "DnaStream";
|
|
343
|
+
readonly fullName: "dna.v2.stream.DnaStream";
|
|
344
|
+
readonly methods: {
|
|
345
|
+
/** Stream data from the server. */
|
|
346
|
+
readonly streamData: {
|
|
347
|
+
readonly name: "StreamData";
|
|
348
|
+
readonly requestType: {
|
|
349
|
+
encode(message: StreamDataRequest$1, writer?: _m0.Writer): _m0.Writer;
|
|
350
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StreamDataRequest$1;
|
|
351
|
+
fromJSON(object: any): StreamDataRequest$1;
|
|
352
|
+
toJSON(message: StreamDataRequest$1): unknown;
|
|
353
|
+
create(base?: DeepPartial<StreamDataRequest$1>): StreamDataRequest$1;
|
|
354
|
+
fromPartial(object: DeepPartial<StreamDataRequest$1>): StreamDataRequest$1;
|
|
355
|
+
};
|
|
356
|
+
readonly requestStream: false;
|
|
357
|
+
readonly responseType: {
|
|
358
|
+
encode(message: StreamDataResponse$1, writer?: _m0.Writer): _m0.Writer;
|
|
359
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StreamDataResponse$1;
|
|
360
|
+
fromJSON(object: any): StreamDataResponse$1;
|
|
361
|
+
toJSON(message: StreamDataResponse$1): unknown;
|
|
362
|
+
create(base?: DeepPartial<StreamDataResponse$1>): StreamDataResponse$1;
|
|
363
|
+
fromPartial(object: DeepPartial<StreamDataResponse$1>): StreamDataResponse$1;
|
|
364
|
+
};
|
|
365
|
+
readonly responseStream: true;
|
|
366
|
+
readonly options: {};
|
|
367
|
+
};
|
|
368
|
+
/** Get DNA server status. */
|
|
369
|
+
readonly status: {
|
|
370
|
+
readonly name: "Status";
|
|
371
|
+
readonly requestType: {
|
|
372
|
+
encode(_: StatusRequest$1, writer?: _m0.Writer): _m0.Writer;
|
|
373
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StatusRequest$1;
|
|
374
|
+
fromJSON(_: any): StatusRequest$1;
|
|
375
|
+
toJSON(_: StatusRequest$1): unknown;
|
|
376
|
+
create(base?: DeepPartial<StatusRequest$1>): StatusRequest$1;
|
|
377
|
+
fromPartial(_: DeepPartial<StatusRequest$1>): StatusRequest$1;
|
|
378
|
+
};
|
|
379
|
+
readonly requestStream: false;
|
|
380
|
+
readonly responseType: {
|
|
381
|
+
encode(message: StatusResponse$1, writer?: _m0.Writer): _m0.Writer;
|
|
382
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): StatusResponse$1;
|
|
383
|
+
fromJSON(object: any): StatusResponse$1;
|
|
384
|
+
toJSON(message: StatusResponse$1): unknown;
|
|
385
|
+
create(base?: DeepPartial<StatusResponse$1>): StatusResponse$1;
|
|
386
|
+
fromPartial(object: DeepPartial<StatusResponse$1>): StatusResponse$1;
|
|
387
|
+
};
|
|
388
|
+
readonly responseStream: false;
|
|
389
|
+
readonly options: {};
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
interface DnaStreamServiceImplementation<CallContextExt = {}> {
|
|
394
|
+
/** Stream data from the server. */
|
|
395
|
+
streamData(request: StreamDataRequest$1, context: CallContext & CallContextExt): ServerStreamingMethodResult<DeepPartial<StreamDataResponse$1>>;
|
|
396
|
+
/** Get DNA server status. */
|
|
397
|
+
status(request: StatusRequest$1, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse$1>>;
|
|
398
|
+
}
|
|
399
|
+
interface DnaStreamClient<CallOptionsExt = {}> {
|
|
400
|
+
/** Stream data from the server. */
|
|
401
|
+
streamData(request: DeepPartial<StreamDataRequest$1>, options?: CallOptions & CallOptionsExt): AsyncIterable<StreamDataResponse$1>;
|
|
402
|
+
/** Get DNA server status. */
|
|
403
|
+
status(request: DeepPartial<StatusRequest$1>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse$1>;
|
|
404
|
+
}
|
|
405
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
406
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
407
|
+
readonly $case: string;
|
|
408
|
+
} ? {
|
|
409
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
410
|
+
} & {
|
|
411
|
+
readonly $case: T["$case"];
|
|
412
|
+
} : T extends {} ? {
|
|
413
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
414
|
+
} : Partial<T>;
|
|
415
|
+
type ServerStreamingMethodResult<Response> = {
|
|
416
|
+
[Symbol.asyncIterator](): AsyncIterator<Response, void>;
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
type stream_DeepPartial<T> = DeepPartial<T>;
|
|
420
|
+
type stream_DnaStreamClient<CallOptionsExt = {}> = DnaStreamClient<CallOptionsExt>;
|
|
421
|
+
declare const stream_DnaStreamDefinition: typeof DnaStreamDefinition;
|
|
422
|
+
type stream_DnaStreamServiceImplementation<CallContextExt = {}> = DnaStreamServiceImplementation<CallContextExt>;
|
|
423
|
+
type stream_ServerStreamingMethodResult<Response> = ServerStreamingMethodResult<Response>;
|
|
424
|
+
declare const stream_dataFinalityFromJSON: typeof dataFinalityFromJSON;
|
|
425
|
+
declare const stream_dataFinalityToJSON: typeof dataFinalityToJSON;
|
|
426
|
+
declare const stream_dataProductionFromJSON: typeof dataProductionFromJSON;
|
|
427
|
+
declare const stream_dataProductionToJSON: typeof dataProductionToJSON;
|
|
428
|
+
declare const stream_protobufPackage: typeof protobufPackage;
|
|
429
|
+
declare namespace stream {
|
|
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 };
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Bytes encoded as a 0x-prefixed hex string. */
|
|
434
|
+
declare const Bytes: Schema.SchemaClass<`0x${string}`, `0x${string}`, never>;
|
|
435
|
+
type Bytes = typeof Bytes.Type;
|
|
436
|
+
declare const BytesFromUint8Array: Schema.PropertySignature<"?:", `0x${string}`, never, ":", Uint8Array, false, never>;
|
|
437
|
+
/** Represent a position in the stream. */
|
|
438
|
+
declare const _Cursor: Schema.Struct<{
|
|
439
|
+
/** The block number. */
|
|
440
|
+
orderKey: typeof Schema.BigIntFromSelf;
|
|
441
|
+
/** The block hash, if any. */
|
|
442
|
+
uniqueKey: Schema.PropertySignature<"?:", `0x${string}`, never, ":", Uint8Array, false, never>;
|
|
443
|
+
}>;
|
|
444
|
+
/** The Cursor protobuf representation. */
|
|
445
|
+
interface CursorProto extends Schema.Schema.Encoded<typeof _Cursor> {
|
|
446
|
+
}
|
|
447
|
+
interface Cursor extends Schema.Schema.Type<typeof _Cursor> {
|
|
448
|
+
}
|
|
449
|
+
declare const Cursor: Schema.Schema<Cursor, CursorProto>;
|
|
450
|
+
declare const createCursor: (props: Cursor) => Cursor;
|
|
451
|
+
declare const cursorToProto: (a: Cursor, overrideOptions?: _effect_schema_AST.ParseOptions) => CursorProto;
|
|
452
|
+
declare const cursorFromProto: (i: CursorProto, overrideOptions?: _effect_schema_AST.ParseOptions) => Cursor;
|
|
453
|
+
declare const CursorFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.Schema<Cursor, CursorProto, never>>;
|
|
454
|
+
declare const cursorToBytes: (a: Cursor, overrideOptions?: _effect_schema_AST.ParseOptions) => Uint8Array;
|
|
455
|
+
declare const cursorFromBytes: (i: Uint8Array, overrideOptions?: _effect_schema_AST.ParseOptions) => Cursor;
|
|
456
|
+
declare function isCursor(value: unknown): value is Cursor;
|
|
457
|
+
/** Normalize a cursor.
|
|
458
|
+
*
|
|
459
|
+
* The challenge is that the `Cursor` validator expects `uniqueKey` to be either a `0x${string}`
|
|
460
|
+
* or not present at all. Setting the field to `undefined` will result in a validation error.
|
|
461
|
+
*
|
|
462
|
+
* @param cursor The cursor to normalize
|
|
463
|
+
*/
|
|
464
|
+
declare function normalizeCursor(cursor: {
|
|
465
|
+
orderKey: bigint;
|
|
466
|
+
uniqueKey: string | null;
|
|
467
|
+
}): Cursor;
|
|
468
|
+
|
|
469
|
+
/** The request to the `status` endpoint. */
|
|
470
|
+
declare const StatusRequest: Schema.Struct<{}>;
|
|
471
|
+
type StatusRequest = typeof StatusRequest.Type;
|
|
472
|
+
declare const statusRequestToProto: (a: {}, overrideOptions?: _effect_schema_AST.ParseOptions) => {};
|
|
473
|
+
declare const statusRequestFromProto: (i: {}, overrideOptions?: _effect_schema_AST.ParseOptions) => {};
|
|
474
|
+
/** The response from the `status` endpoint. */
|
|
475
|
+
declare const StatusResponse: Schema.Struct<{
|
|
476
|
+
currentHead: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
477
|
+
lastIngested: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
478
|
+
finalized: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
479
|
+
starting: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
480
|
+
}>;
|
|
481
|
+
type StatusResponse = typeof StatusResponse.Type;
|
|
482
|
+
declare const statusResponseToProto: (a: {
|
|
483
|
+
readonly currentHead?: Cursor | undefined;
|
|
484
|
+
readonly lastIngested?: Cursor | undefined;
|
|
485
|
+
readonly finalized?: Cursor | undefined;
|
|
486
|
+
readonly starting?: Cursor | undefined;
|
|
487
|
+
}, overrideOptions?: _effect_schema_AST.ParseOptions) => {
|
|
488
|
+
readonly currentHead?: CursorProto | undefined;
|
|
489
|
+
readonly lastIngested?: CursorProto | undefined;
|
|
490
|
+
readonly finalized?: CursorProto | undefined;
|
|
491
|
+
readonly starting?: CursorProto | undefined;
|
|
492
|
+
};
|
|
493
|
+
declare const statusResponseFromProto: (i: {
|
|
494
|
+
readonly currentHead?: CursorProto | undefined;
|
|
495
|
+
readonly lastIngested?: CursorProto | undefined;
|
|
496
|
+
readonly finalized?: CursorProto | undefined;
|
|
497
|
+
readonly starting?: CursorProto | undefined;
|
|
498
|
+
}, overrideOptions?: _effect_schema_AST.ParseOptions) => {
|
|
499
|
+
readonly currentHead?: Cursor | undefined;
|
|
500
|
+
readonly lastIngested?: Cursor | undefined;
|
|
501
|
+
readonly finalized?: Cursor | undefined;
|
|
502
|
+
readonly starting?: Cursor | undefined;
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/** Data finality. */
|
|
506
|
+
declare const DataFinality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
507
|
+
type DataFinality = typeof DataFinality.Type;
|
|
508
|
+
/** Data production mode. */
|
|
509
|
+
declare const DataProduction: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
510
|
+
type DataProduction = typeof DataProduction.Type;
|
|
511
|
+
declare const Duration: Schema.Struct<{
|
|
512
|
+
seconds: typeof Schema.BigIntFromSelf;
|
|
513
|
+
nanos: typeof Schema.Number;
|
|
514
|
+
}>;
|
|
515
|
+
/** Create a `StreamDataRequest` with the given filter schema. */
|
|
516
|
+
declare const StreamDataRequest: <TA, TR>(filter: Schema.Schema<TA, Uint8Array, TR>) => Schema.Struct<{
|
|
517
|
+
finality: Schema.optional<Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>>;
|
|
518
|
+
startingCursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
519
|
+
filter: Schema.mutable<Schema.Array$<Schema.Schema<TA, Uint8Array, TR>>>;
|
|
520
|
+
heartbeatInterval: Schema.optional<Schema.Struct<{
|
|
521
|
+
seconds: typeof Schema.BigIntFromSelf;
|
|
522
|
+
nanos: typeof Schema.Number;
|
|
523
|
+
}>>;
|
|
524
|
+
}>;
|
|
525
|
+
type StreamDataRequest<TA> = {
|
|
526
|
+
finality?: DataFinality | undefined;
|
|
527
|
+
startingCursor?: Cursor | undefined;
|
|
528
|
+
filter: TA[];
|
|
529
|
+
};
|
|
530
|
+
declare const Invalidate: Schema.Struct<{
|
|
531
|
+
_tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
|
|
532
|
+
invalidate: Schema.Struct<{
|
|
533
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
534
|
+
}>;
|
|
535
|
+
}>;
|
|
536
|
+
type Invalidate = typeof Invalidate.Type;
|
|
537
|
+
declare const Finalize: Schema.Struct<{
|
|
538
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
539
|
+
finalize: Schema.Struct<{
|
|
540
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
541
|
+
}>;
|
|
542
|
+
}>;
|
|
543
|
+
type Finalize = typeof Finalize.Type;
|
|
544
|
+
declare const Heartbeat: Schema.Struct<{
|
|
545
|
+
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
546
|
+
}>;
|
|
547
|
+
type Heartbeat = typeof Heartbeat.Type;
|
|
548
|
+
declare const StdOut: Schema.Struct<{
|
|
549
|
+
_tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
|
|
550
|
+
stdout: typeof Schema.String;
|
|
551
|
+
}>;
|
|
552
|
+
type StdOut = typeof StdOut.Type;
|
|
553
|
+
declare const StdErr: Schema.Struct<{
|
|
554
|
+
_tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
|
|
555
|
+
stderr: typeof Schema.String;
|
|
556
|
+
}>;
|
|
557
|
+
type StdErr = typeof StdErr.Type;
|
|
558
|
+
declare const SystemMessage: Schema.Struct<{
|
|
559
|
+
_tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
|
|
560
|
+
systemMessage: Schema.Struct<{
|
|
561
|
+
output: Schema.Union<[Schema.Struct<{
|
|
562
|
+
_tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
|
|
563
|
+
stdout: typeof Schema.String;
|
|
564
|
+
}>, Schema.Struct<{
|
|
565
|
+
_tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
|
|
566
|
+
stderr: typeof Schema.String;
|
|
567
|
+
}>]>;
|
|
568
|
+
}>;
|
|
569
|
+
}>;
|
|
570
|
+
type SystemMessage = typeof SystemMessage.Type;
|
|
571
|
+
declare const Data: <TA, TR>(schema: Schema.Schema<TA | null, Uint8Array, TR>) => Schema.Struct<{
|
|
572
|
+
_tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
|
|
573
|
+
data: Schema.Struct<{
|
|
574
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
575
|
+
endCursor: Schema.Schema<Cursor, CursorProto, never>;
|
|
576
|
+
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
577
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
578
|
+
data: Schema.Array$<Schema.Schema<TA | null, Uint8Array, TR>>;
|
|
579
|
+
}>;
|
|
580
|
+
}>;
|
|
581
|
+
declare const ResponseWithoutData: Schema.Union<[Schema.Struct<{
|
|
582
|
+
_tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
|
|
583
|
+
invalidate: Schema.Struct<{
|
|
584
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
585
|
+
}>;
|
|
586
|
+
}>, Schema.Struct<{
|
|
587
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
588
|
+
finalize: Schema.Struct<{
|
|
589
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
590
|
+
}>;
|
|
591
|
+
}>, Schema.Struct<{
|
|
592
|
+
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
593
|
+
}>, Schema.Struct<{
|
|
594
|
+
_tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
|
|
595
|
+
systemMessage: Schema.Struct<{
|
|
596
|
+
output: Schema.Union<[Schema.Struct<{
|
|
597
|
+
_tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
|
|
598
|
+
stdout: typeof Schema.String;
|
|
599
|
+
}>, Schema.Struct<{
|
|
600
|
+
_tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
|
|
601
|
+
stderr: typeof Schema.String;
|
|
602
|
+
}>]>;
|
|
603
|
+
}>;
|
|
604
|
+
}>]>;
|
|
605
|
+
type ResponseWithoutData = typeof ResponseWithoutData.Type;
|
|
606
|
+
declare const StreamDataResponse: <TA, TR>(data: Schema.Schema<TA | null, Uint8Array, TR>) => Schema.Union<[Schema.Struct<{
|
|
607
|
+
_tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
|
|
608
|
+
data: Schema.Struct<{
|
|
609
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
610
|
+
endCursor: Schema.Schema<Cursor, CursorProto, never>;
|
|
611
|
+
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
612
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
613
|
+
data: Schema.Array$<Schema.Schema<TA | null, Uint8Array, TR>>;
|
|
614
|
+
}>;
|
|
615
|
+
}>, Schema.Struct<{
|
|
616
|
+
_tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
|
|
617
|
+
invalidate: Schema.Struct<{
|
|
618
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
619
|
+
}>;
|
|
620
|
+
}>, Schema.Struct<{
|
|
621
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
622
|
+
finalize: Schema.Struct<{
|
|
623
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
624
|
+
}>;
|
|
625
|
+
}>, Schema.Struct<{
|
|
626
|
+
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
627
|
+
}>, Schema.Struct<{
|
|
628
|
+
_tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
|
|
629
|
+
systemMessage: Schema.Struct<{
|
|
630
|
+
output: Schema.Union<[Schema.Struct<{
|
|
631
|
+
_tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
|
|
632
|
+
stdout: typeof Schema.String;
|
|
633
|
+
}>, Schema.Struct<{
|
|
634
|
+
_tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
|
|
635
|
+
stderr: typeof Schema.String;
|
|
636
|
+
}>]>;
|
|
637
|
+
}>;
|
|
638
|
+
}>]>;
|
|
639
|
+
type StreamDataResponse<TA> = ResponseWithoutData | {
|
|
640
|
+
_tag: "data";
|
|
641
|
+
data: {
|
|
642
|
+
cursor?: Cursor | undefined;
|
|
643
|
+
endCursor: Cursor;
|
|
644
|
+
finality: DataFinality;
|
|
645
|
+
production: DataProduction;
|
|
646
|
+
data: readonly (TA | null)[];
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
/** Configure a DNA stream. */
|
|
651
|
+
declare class StreamConfig<TFilter, TBlock> {
|
|
652
|
+
private filter;
|
|
653
|
+
private block;
|
|
654
|
+
mergeFilter: (a: TFilter, b: TFilter) => TFilter;
|
|
655
|
+
private request;
|
|
656
|
+
private response;
|
|
657
|
+
constructor(filter: Schema.Schema<TFilter, Uint8Array, never>, block: Schema.Schema<TBlock | null, Uint8Array, never>, mergeFilter: (a: TFilter, b: TFilter) => TFilter);
|
|
658
|
+
/** Filter schema. */
|
|
659
|
+
get Filter(): Schema.Schema<TFilter, Uint8Array, never>;
|
|
660
|
+
/** Block schema. */
|
|
661
|
+
get Block(): Schema.Schema<TBlock | null, Uint8Array, never>;
|
|
662
|
+
/** Stream data request schema. */
|
|
663
|
+
get Request(): Schema.Struct<{
|
|
664
|
+
finality: Schema.optional<Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>>;
|
|
665
|
+
startingCursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
666
|
+
filter: Schema.mutable<Schema.Array$<Schema.Schema<TFilter, Uint8Array, never>>>;
|
|
667
|
+
heartbeatInterval: Schema.optional<Schema.Struct<{
|
|
668
|
+
seconds: typeof Schema.BigIntFromSelf;
|
|
669
|
+
nanos: typeof Schema.Number;
|
|
670
|
+
}>>;
|
|
671
|
+
}>;
|
|
672
|
+
/** Stream data response schema. */
|
|
673
|
+
get Response(): Schema.Union<[Schema.Struct<{
|
|
674
|
+
_tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
|
|
675
|
+
data: Schema.Struct<{
|
|
676
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
677
|
+
endCursor: Schema.Schema<Cursor, CursorProto, never>;
|
|
678
|
+
finality: Schema.transform<Schema.Enums<typeof DataFinality$1>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
|
|
679
|
+
production: Schema.transform<Schema.Enums<typeof DataProduction$1>, Schema.Literal<["backfill", "live", "unknown"]>>;
|
|
680
|
+
data: Schema.Array$<Schema.Schema<TBlock | null, Uint8Array, never>>;
|
|
681
|
+
}>;
|
|
682
|
+
}>, Schema.Struct<{
|
|
683
|
+
_tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
|
|
684
|
+
invalidate: Schema.Struct<{
|
|
685
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
686
|
+
}>;
|
|
687
|
+
}>, Schema.Struct<{
|
|
688
|
+
_tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
|
|
689
|
+
finalize: Schema.Struct<{
|
|
690
|
+
cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
|
|
691
|
+
}>;
|
|
692
|
+
}>, Schema.Struct<{
|
|
693
|
+
_tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
|
|
694
|
+
}>, Schema.Struct<{
|
|
695
|
+
_tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
|
|
696
|
+
systemMessage: Schema.Struct<{
|
|
697
|
+
output: Schema.Union<[Schema.Struct<{
|
|
698
|
+
_tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
|
|
699
|
+
stdout: typeof Schema.String;
|
|
700
|
+
}>, Schema.Struct<{
|
|
701
|
+
_tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
|
|
702
|
+
stderr: typeof Schema.String;
|
|
703
|
+
}>]>;
|
|
704
|
+
}>;
|
|
705
|
+
}>]>;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
declare class TimeoutError extends Error {
|
|
709
|
+
constructor(timeout: number);
|
|
710
|
+
}
|
|
711
|
+
/** Client call options. */
|
|
712
|
+
interface ClientCallOptions {
|
|
713
|
+
signal?: AbortSignal;
|
|
714
|
+
}
|
|
715
|
+
interface StreamDataOptions extends ClientCallOptions {
|
|
716
|
+
/** Stop at the specified cursor (inclusive). */
|
|
717
|
+
endingCursor?: Cursor;
|
|
718
|
+
/** Timeout between messages, in milliseconds. */
|
|
719
|
+
timeout?: number;
|
|
720
|
+
}
|
|
721
|
+
/** DNA client. */
|
|
722
|
+
interface Client<TFilter, TBlock> {
|
|
723
|
+
/** Fetch the DNA stream status. */
|
|
724
|
+
status(request?: StatusRequest, options?: ClientCallOptions): Promise<StatusResponse>;
|
|
725
|
+
/** Start streaming data from the DNA server. */
|
|
726
|
+
streamData(request: StreamDataRequest<TFilter>, options?: StreamDataOptions): AsyncIterable<StreamDataResponse<TBlock>>;
|
|
727
|
+
}
|
|
728
|
+
type CreateClientOptions = {
|
|
729
|
+
defaultCallOptions?: DefaultCallOptions<NormalizedServiceDefinition<DnaStreamDefinition>>;
|
|
730
|
+
credentials?: ChannelCredentials;
|
|
731
|
+
channelOptions?: ChannelOptions;
|
|
732
|
+
};
|
|
733
|
+
/** Create a client connecting to the DNA grpc service. */
|
|
734
|
+
declare function createClient<TFilter, TBlock>(config: StreamConfig<TFilter, TBlock>, streamUrl: string, options?: CreateClientOptions): GrpcClient<TFilter, TBlock>;
|
|
735
|
+
declare class GrpcClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
|
|
736
|
+
private config;
|
|
737
|
+
private client;
|
|
738
|
+
private encodeRequest;
|
|
739
|
+
constructor(config: StreamConfig<TFilter, TBlock>, client: DnaStreamClient);
|
|
740
|
+
status(request?: StatusRequest, options?: ClientCallOptions): Promise<{
|
|
741
|
+
readonly currentHead?: Cursor | undefined;
|
|
742
|
+
readonly lastIngested?: Cursor | undefined;
|
|
743
|
+
readonly finalized?: Cursor | undefined;
|
|
744
|
+
readonly starting?: Cursor | undefined;
|
|
745
|
+
}>;
|
|
746
|
+
streamData(request: StreamDataRequest<TFilter>, options?: StreamDataOptions): StreamDataIterable<TBlock>;
|
|
747
|
+
}
|
|
748
|
+
declare class StreamDataIterable<TBlock> {
|
|
749
|
+
private it;
|
|
750
|
+
private schema;
|
|
751
|
+
private options?;
|
|
752
|
+
constructor(it: AsyncIterable<StreamDataResponse$1>, schema: Schema.Schema<TBlock | null, Uint8Array, never>, options?: StreamDataOptions | undefined);
|
|
753
|
+
[Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export { StreamConfig as A, Bytes as B, type CursorProto as C, type DnaStreamClient as D, type ClientCallOptions as E, Finalize as F, type StreamDataOptions as G, Heartbeat as H, Invalidate as I, type Client as J, type CreateClientOptions as K, createClient as L, GrpcClient as M, StreamDataIterable as N, DataFinality$1 as O, DataProduction$1 as P, 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, normalizeCursor as n, statusResponseToProto as o, statusResponseFromProto as p, DataFinality as q, DataProduction as r, stream as s, Duration as t, StreamDataRequest as u, StdOut as v, StdErr as w, SystemMessage as x, Data as y, StreamDataResponse as z };
|