@kronos-ts/kronosdb 0.1.0
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/connection.d.ts +86 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +133 -0
- package/dist/connection.js.map +1 -0
- package/dist/errors.d.ts +72 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +149 -0
- package/dist/errors.js.map +1 -0
- package/dist/event-processor-info.d.ts +32 -0
- package/dist/event-processor-info.d.ts.map +1 -0
- package/dist/event-processor-info.js +24 -0
- package/dist/event-processor-info.js.map +1 -0
- package/dist/flow-controlled-sender.d.ts +12 -0
- package/dist/flow-controlled-sender.d.ts.map +1 -0
- package/dist/flow-controlled-sender.js +53 -0
- package/dist/flow-controlled-sender.js.map +1 -0
- package/dist/generated/command.d.ts +169 -0
- package/dist/generated/command.d.ts.map +1 -0
- package/dist/generated/command.js +964 -0
- package/dist/generated/command.js.map +1 -0
- package/dist/generated/common.d.ts +76 -0
- package/dist/generated/common.d.ts.map +1 -0
- package/dist/generated/common.js +648 -0
- package/dist/generated/common.js.map +1 -0
- package/dist/generated/eventstore.d.ts +337 -0
- package/dist/generated/eventstore.d.ts.map +1 -0
- package/dist/generated/eventstore.js +1757 -0
- package/dist/generated/eventstore.js.map +1 -0
- package/dist/generated/platform.d.ts +242 -0
- package/dist/generated/platform.d.ts.map +1 -0
- package/dist/generated/platform.js +1525 -0
- package/dist/generated/platform.js.map +1 -0
- package/dist/generated/query.d.ts +265 -0
- package/dist/generated/query.d.ts.map +1 -0
- package/dist/generated/query.js +2114 -0
- package/dist/generated/query.js.map +1 -0
- package/dist/generated/snapshot.d.ts +180 -0
- package/dist/generated/snapshot.d.ts.map +1 -0
- package/dist/generated/snapshot.js +861 -0
- package/dist/generated/snapshot.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/kronosdb-event-store.d.ts +17 -0
- package/dist/kronosdb-event-store.d.ts.map +1 -0
- package/dist/kronosdb-event-store.js +328 -0
- package/dist/kronosdb-event-store.js.map +1 -0
- package/dist/kronosdb-snapshot-store.d.ts +10 -0
- package/dist/kronosdb-snapshot-store.d.ts.map +1 -0
- package/dist/kronosdb-snapshot-store.js +79 -0
- package/dist/kronosdb-snapshot-store.js.map +1 -0
- package/dist/kronosdb.d.ts +53 -0
- package/dist/kronosdb.d.ts.map +1 -0
- package/dist/kronosdb.js +852 -0
- package/dist/kronosdb.js.map +1 -0
- package/dist/metadata-conversion.d.ts +37 -0
- package/dist/metadata-conversion.d.ts.map +1 -0
- package/dist/metadata-conversion.js +75 -0
- package/dist/metadata-conversion.js.map +1 -0
- package/dist/outbound-stream.d.ts +15 -0
- package/dist/outbound-stream.d.ts.map +1 -0
- package/dist/outbound-stream.js +39 -0
- package/dist/outbound-stream.js.map +1 -0
- package/dist/platform-service.d.ts +87 -0
- package/dist/platform-service.d.ts.map +1 -0
- package/dist/platform-service.js +218 -0
- package/dist/platform-service.js.map +1 -0
- package/dist/service-definitions.d.ts +187 -0
- package/dist/service-definitions.d.ts.map +1 -0
- package/dist/service-definitions.js +18 -0
- package/dist/service-definitions.js.map +1 -0
- package/dist/shutdown-latch.d.ts +18 -0
- package/dist/shutdown-latch.d.ts.map +1 -0
- package/dist/shutdown-latch.js +51 -0
- package/dist/shutdown-latch.js.map +1 -0
- package/package.json +69 -0
- package/src/connection.ts +235 -0
- package/src/errors.ts +173 -0
- package/src/event-processor-info.ts +53 -0
- package/src/flow-controlled-sender.ts +73 -0
- package/src/generated/command.ts +1226 -0
- package/src/generated/common.ts +770 -0
- package/src/generated/eventstore.ts +2241 -0
- package/src/generated/platform.ts +1914 -0
- package/src/generated/query.ts +2571 -0
- package/src/generated/snapshot.ts +1110 -0
- package/src/index.ts +87 -0
- package/src/kronosdb-event-store.ts +401 -0
- package/src/kronosdb-snapshot-store.ts +104 -0
- package/src/kronosdb.ts +1000 -0
- package/src/metadata-conversion.ts +85 -0
- package/src/outbound-stream.ts +52 -0
- package/src/platform-service.ts +297 -0
- package/src/service-definitions.ts +25 -0
- package/src/shutdown-latch.ts +74 -0
|
@@ -0,0 +1,2241 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.19.1
|
|
5
|
+
// source: eventstore.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "kronosdb.eventstore";
|
|
12
|
+
|
|
13
|
+
/** An event as provided by the client. */
|
|
14
|
+
export interface Event {
|
|
15
|
+
/** Client-provided unique identifier. */
|
|
16
|
+
identifier: string;
|
|
17
|
+
/** Timestamp in milliseconds since epoch. Client-provided. */
|
|
18
|
+
timestamp: bigint;
|
|
19
|
+
/** The event type name (e.g., "OrderPlaced"). */
|
|
20
|
+
name: string;
|
|
21
|
+
/** The schema version of the event payload. */
|
|
22
|
+
version: string;
|
|
23
|
+
/** The opaque event payload. */
|
|
24
|
+
payload: Uint8Array;
|
|
25
|
+
/** Arbitrary key-value metadata. */
|
|
26
|
+
metadata: { [key: string]: string };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Event_MetadataEntry {
|
|
30
|
+
key: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A tag describing an event. Key-value pair using domain concepts. */
|
|
35
|
+
export interface Tag {
|
|
36
|
+
key: Uint8Array;
|
|
37
|
+
value: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** An event with its tags, used for appending. */
|
|
41
|
+
export interface TaggedEvent {
|
|
42
|
+
event: Event | undefined;
|
|
43
|
+
tags: Tag[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** An event with its assigned sequence position, returned on reads. */
|
|
47
|
+
export interface SequencedEvent {
|
|
48
|
+
sequence: bigint;
|
|
49
|
+
event: Event | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Request to append events. Sent as a stream to allow batching. */
|
|
53
|
+
export interface AppendRequest {
|
|
54
|
+
/** Optional consistency condition. If omitted, events are appended unconditionally. */
|
|
55
|
+
condition:
|
|
56
|
+
| ConsistencyCondition
|
|
57
|
+
| undefined;
|
|
58
|
+
/** Events to append. All-or-nothing transaction. */
|
|
59
|
+
events: TaggedEvent[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Response to a successful append. */
|
|
63
|
+
export interface AppendResponse {
|
|
64
|
+
/** Sequence of the first event appended. */
|
|
65
|
+
firstSequence: bigint;
|
|
66
|
+
/** Number of events appended. */
|
|
67
|
+
count: number;
|
|
68
|
+
/** Consistency marker for subsequent appends. */
|
|
69
|
+
consistencyMarker: bigint;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The consistency condition for conditional appends.
|
|
74
|
+
* "Reject if any event matching the criteria exists after the consistency marker."
|
|
75
|
+
*/
|
|
76
|
+
export interface ConsistencyCondition {
|
|
77
|
+
/** Position after which to check for conflicts. Events with sequence > this are checked. */
|
|
78
|
+
consistencyMarker: bigint;
|
|
79
|
+
/** Criteria defining which events would conflict. */
|
|
80
|
+
criteria: Criterion[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A single criterion. Matches an event if ALL tags are present AND the event name
|
|
85
|
+
* is in the names list (if names is non-empty).
|
|
86
|
+
*/
|
|
87
|
+
export interface Criterion {
|
|
88
|
+
/** Event type names. If non-empty, the event name must match one of these. */
|
|
89
|
+
names: string[];
|
|
90
|
+
/** Tags that must ALL be present on the event. */
|
|
91
|
+
tags: Tag[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Request to source (finite read) events matching criteria. */
|
|
95
|
+
export interface SourceRequest {
|
|
96
|
+
/** Inclusive starting sequence position. */
|
|
97
|
+
fromSequence: bigint;
|
|
98
|
+
/** Criteria to filter events. If empty, all events are returned. */
|
|
99
|
+
criteria: Criterion[];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Response containing either a matching event or the final consistency marker. */
|
|
103
|
+
export interface SourceResponse {
|
|
104
|
+
/** A matching event with its sequence. */
|
|
105
|
+
event?:
|
|
106
|
+
| SequencedEvent
|
|
107
|
+
| undefined;
|
|
108
|
+
/**
|
|
109
|
+
* The consistency marker at the end of the stream.
|
|
110
|
+
* Use this for subsequent appends related to the same criteria.
|
|
111
|
+
*/
|
|
112
|
+
consistencyMarker?: bigint | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Client-to-server messages on the Stream RPC.
|
|
117
|
+
* The first message MUST be a Subscribe; subsequent messages grant permits.
|
|
118
|
+
*/
|
|
119
|
+
export interface StreamControl {
|
|
120
|
+
/** Initial subscription — sent once to start the stream. */
|
|
121
|
+
subscribe?:
|
|
122
|
+
| StreamSubscribe
|
|
123
|
+
| undefined;
|
|
124
|
+
/** Grant additional permits — server may send one event per permit. */
|
|
125
|
+
permits?: StreamPermits | undefined;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Opens the event stream with criteria and initial permits. */
|
|
129
|
+
export interface StreamSubscribe {
|
|
130
|
+
/** Inclusive starting sequence position. */
|
|
131
|
+
fromSequence: bigint;
|
|
132
|
+
/** Criteria to filter events. If empty, all events are streamed. */
|
|
133
|
+
criteria: Criterion[];
|
|
134
|
+
/**
|
|
135
|
+
* Initial number of permits. The server will send at most this many events
|
|
136
|
+
* before waiting for more permits. Must be > 0.
|
|
137
|
+
*/
|
|
138
|
+
initialPermits: bigint;
|
|
139
|
+
/**
|
|
140
|
+
* Optional: event type names to exclude from the stream.
|
|
141
|
+
* Events matching any of these names are silently skipped (payload blacklisting).
|
|
142
|
+
*/
|
|
143
|
+
blacklistedNames: string[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Grants additional permits on an active stream. */
|
|
147
|
+
export interface StreamPermits {
|
|
148
|
+
/** Number of additional permits to grant. */
|
|
149
|
+
permits: bigint;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** A message on the event stream — either a matching event or a keep-alive heartbeat. */
|
|
153
|
+
export interface StreamResponse {
|
|
154
|
+
/** A matching event with its sequence. */
|
|
155
|
+
event?:
|
|
156
|
+
| SequencedEvent
|
|
157
|
+
| undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Server heartbeat — sent periodically to detect slow/dead consumers.
|
|
160
|
+
* Clients should ignore this (no response needed).
|
|
161
|
+
*/
|
|
162
|
+
heartbeat?: StreamHeartbeat | undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Keep-alive heartbeat on event streams. */
|
|
166
|
+
export interface StreamHeartbeat {
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface GetHeadRequest {
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface GetHeadResponse {
|
|
173
|
+
/** The sequence of the next event to be appended. 0 for an empty store. */
|
|
174
|
+
sequence: bigint;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface GetTailRequest {
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface GetTailResponse {
|
|
181
|
+
/** The sequence of the first event in the store. 0 for an empty or non-truncated store. */
|
|
182
|
+
sequence: bigint;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface GetTagsRequest {
|
|
186
|
+
sequence: bigint;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface GetTagsResponse {
|
|
190
|
+
tags: Tag[];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface GetSequenceAtRequest {
|
|
194
|
+
/** Timestamp in milliseconds since epoch. */
|
|
195
|
+
timestamp: bigint;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface GetSequenceAtResponse {
|
|
199
|
+
/**
|
|
200
|
+
* Sequence of the first event at or after the given timestamp.
|
|
201
|
+
* -1 if no such event exists.
|
|
202
|
+
*/
|
|
203
|
+
sequence: bigint;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function createBaseEvent(): Event {
|
|
207
|
+
return { identifier: "", timestamp: 0n, name: "", version: "", payload: new Uint8Array(0), metadata: {} };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const Event: MessageFns<Event> = {
|
|
211
|
+
encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
212
|
+
if (message.identifier !== "") {
|
|
213
|
+
writer.uint32(10).string(message.identifier);
|
|
214
|
+
}
|
|
215
|
+
if (message.timestamp !== 0n) {
|
|
216
|
+
if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
|
|
217
|
+
throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
|
|
218
|
+
}
|
|
219
|
+
writer.uint32(16).int64(message.timestamp);
|
|
220
|
+
}
|
|
221
|
+
if (message.name !== "") {
|
|
222
|
+
writer.uint32(26).string(message.name);
|
|
223
|
+
}
|
|
224
|
+
if (message.version !== "") {
|
|
225
|
+
writer.uint32(34).string(message.version);
|
|
226
|
+
}
|
|
227
|
+
if (message.payload.length !== 0) {
|
|
228
|
+
writer.uint32(42).bytes(message.payload);
|
|
229
|
+
}
|
|
230
|
+
globalThis.Object.entries(message.metadata).forEach(([key, value]: [string, string]) => {
|
|
231
|
+
Event_MetadataEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).join();
|
|
232
|
+
});
|
|
233
|
+
return writer;
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Event {
|
|
237
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
238
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
239
|
+
const message = createBaseEvent();
|
|
240
|
+
while (reader.pos < end) {
|
|
241
|
+
const tag = reader.uint32();
|
|
242
|
+
switch (tag >>> 3) {
|
|
243
|
+
case 1: {
|
|
244
|
+
if (tag !== 10) {
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
message.identifier = reader.string();
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
case 2: {
|
|
252
|
+
if (tag !== 16) {
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
message.timestamp = reader.int64() as bigint;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
case 3: {
|
|
260
|
+
if (tag !== 26) {
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
message.name = reader.string();
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
case 4: {
|
|
268
|
+
if (tag !== 34) {
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
message.version = reader.string();
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
case 5: {
|
|
276
|
+
if (tag !== 42) {
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
message.payload = reader.bytes();
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
case 6: {
|
|
284
|
+
if (tag !== 50) {
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const entry6 = Event_MetadataEntry.decode(reader, reader.uint32());
|
|
289
|
+
if (entry6.value !== undefined) {
|
|
290
|
+
message.metadata[entry6.key] = entry6.value;
|
|
291
|
+
}
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
reader.skip(tag & 7);
|
|
299
|
+
}
|
|
300
|
+
return message;
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
fromJSON(object: any): Event {
|
|
304
|
+
return {
|
|
305
|
+
identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
|
|
306
|
+
timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n,
|
|
307
|
+
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
308
|
+
version: isSet(object.version) ? globalThis.String(object.version) : "",
|
|
309
|
+
payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0),
|
|
310
|
+
metadata: isObject(object.metadata)
|
|
311
|
+
? (globalThis.Object.entries(object.metadata) as [string, any][]).reduce(
|
|
312
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
313
|
+
acc[key] = globalThis.String(value);
|
|
314
|
+
return acc;
|
|
315
|
+
},
|
|
316
|
+
{},
|
|
317
|
+
)
|
|
318
|
+
: {},
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
toJSON(message: Event): unknown {
|
|
323
|
+
const obj: any = {};
|
|
324
|
+
if (message.identifier !== "") {
|
|
325
|
+
obj.identifier = message.identifier;
|
|
326
|
+
}
|
|
327
|
+
if (message.timestamp !== 0n) {
|
|
328
|
+
obj.timestamp = message.timestamp.toString();
|
|
329
|
+
}
|
|
330
|
+
if (message.name !== "") {
|
|
331
|
+
obj.name = message.name;
|
|
332
|
+
}
|
|
333
|
+
if (message.version !== "") {
|
|
334
|
+
obj.version = message.version;
|
|
335
|
+
}
|
|
336
|
+
if (message.payload.length !== 0) {
|
|
337
|
+
obj.payload = base64FromBytes(message.payload);
|
|
338
|
+
}
|
|
339
|
+
if (message.metadata) {
|
|
340
|
+
const entries = globalThis.Object.entries(message.metadata) as [string, string][];
|
|
341
|
+
if (entries.length > 0) {
|
|
342
|
+
obj.metadata = {};
|
|
343
|
+
entries.forEach(([k, v]) => {
|
|
344
|
+
obj.metadata[k] = v;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return obj;
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
create(base?: DeepPartial<Event>): Event {
|
|
352
|
+
return Event.fromPartial(base ?? {});
|
|
353
|
+
},
|
|
354
|
+
fromPartial(object: DeepPartial<Event>): Event {
|
|
355
|
+
const message = createBaseEvent();
|
|
356
|
+
message.identifier = object.identifier ?? "";
|
|
357
|
+
message.timestamp = object.timestamp ?? 0n;
|
|
358
|
+
message.name = object.name ?? "";
|
|
359
|
+
message.version = object.version ?? "";
|
|
360
|
+
message.payload = object.payload ?? new Uint8Array(0);
|
|
361
|
+
message.metadata = (globalThis.Object.entries(object.metadata ?? {}) as [string, string][]).reduce(
|
|
362
|
+
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
|
363
|
+
if (value !== undefined) {
|
|
364
|
+
acc[key] = globalThis.String(value);
|
|
365
|
+
}
|
|
366
|
+
return acc;
|
|
367
|
+
},
|
|
368
|
+
{},
|
|
369
|
+
);
|
|
370
|
+
return message;
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
function createBaseEvent_MetadataEntry(): Event_MetadataEntry {
|
|
375
|
+
return { key: "", value: "" };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export const Event_MetadataEntry: MessageFns<Event_MetadataEntry> = {
|
|
379
|
+
encode(message: Event_MetadataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
380
|
+
if (message.key !== "") {
|
|
381
|
+
writer.uint32(10).string(message.key);
|
|
382
|
+
}
|
|
383
|
+
if (message.value !== "") {
|
|
384
|
+
writer.uint32(18).string(message.value);
|
|
385
|
+
}
|
|
386
|
+
return writer;
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Event_MetadataEntry {
|
|
390
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
391
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
392
|
+
const message = createBaseEvent_MetadataEntry();
|
|
393
|
+
while (reader.pos < end) {
|
|
394
|
+
const tag = reader.uint32();
|
|
395
|
+
switch (tag >>> 3) {
|
|
396
|
+
case 1: {
|
|
397
|
+
if (tag !== 10) {
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
message.key = reader.string();
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
case 2: {
|
|
405
|
+
if (tag !== 18) {
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
message.value = reader.string();
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
reader.skip(tag & 7);
|
|
417
|
+
}
|
|
418
|
+
return message;
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
fromJSON(object: any): Event_MetadataEntry {
|
|
422
|
+
return {
|
|
423
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
424
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
425
|
+
};
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
toJSON(message: Event_MetadataEntry): unknown {
|
|
429
|
+
const obj: any = {};
|
|
430
|
+
if (message.key !== "") {
|
|
431
|
+
obj.key = message.key;
|
|
432
|
+
}
|
|
433
|
+
if (message.value !== "") {
|
|
434
|
+
obj.value = message.value;
|
|
435
|
+
}
|
|
436
|
+
return obj;
|
|
437
|
+
},
|
|
438
|
+
|
|
439
|
+
create(base?: DeepPartial<Event_MetadataEntry>): Event_MetadataEntry {
|
|
440
|
+
return Event_MetadataEntry.fromPartial(base ?? {});
|
|
441
|
+
},
|
|
442
|
+
fromPartial(object: DeepPartial<Event_MetadataEntry>): Event_MetadataEntry {
|
|
443
|
+
const message = createBaseEvent_MetadataEntry();
|
|
444
|
+
message.key = object.key ?? "";
|
|
445
|
+
message.value = object.value ?? "";
|
|
446
|
+
return message;
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
function createBaseTag(): Tag {
|
|
451
|
+
return { key: new Uint8Array(0), value: new Uint8Array(0) };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export const Tag: MessageFns<Tag> = {
|
|
455
|
+
encode(message: Tag, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
456
|
+
if (message.key.length !== 0) {
|
|
457
|
+
writer.uint32(10).bytes(message.key);
|
|
458
|
+
}
|
|
459
|
+
if (message.value.length !== 0) {
|
|
460
|
+
writer.uint32(18).bytes(message.value);
|
|
461
|
+
}
|
|
462
|
+
return writer;
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Tag {
|
|
466
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
467
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
468
|
+
const message = createBaseTag();
|
|
469
|
+
while (reader.pos < end) {
|
|
470
|
+
const tag = reader.uint32();
|
|
471
|
+
switch (tag >>> 3) {
|
|
472
|
+
case 1: {
|
|
473
|
+
if (tag !== 10) {
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
message.key = reader.bytes();
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
case 2: {
|
|
481
|
+
if (tag !== 18) {
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
message.value = reader.bytes();
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
reader.skip(tag & 7);
|
|
493
|
+
}
|
|
494
|
+
return message;
|
|
495
|
+
},
|
|
496
|
+
|
|
497
|
+
fromJSON(object: any): Tag {
|
|
498
|
+
return {
|
|
499
|
+
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
|
500
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
|
|
504
|
+
toJSON(message: Tag): unknown {
|
|
505
|
+
const obj: any = {};
|
|
506
|
+
if (message.key.length !== 0) {
|
|
507
|
+
obj.key = base64FromBytes(message.key);
|
|
508
|
+
}
|
|
509
|
+
if (message.value.length !== 0) {
|
|
510
|
+
obj.value = base64FromBytes(message.value);
|
|
511
|
+
}
|
|
512
|
+
return obj;
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
create(base?: DeepPartial<Tag>): Tag {
|
|
516
|
+
return Tag.fromPartial(base ?? {});
|
|
517
|
+
},
|
|
518
|
+
fromPartial(object: DeepPartial<Tag>): Tag {
|
|
519
|
+
const message = createBaseTag();
|
|
520
|
+
message.key = object.key ?? new Uint8Array(0);
|
|
521
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
522
|
+
return message;
|
|
523
|
+
},
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
function createBaseTaggedEvent(): TaggedEvent {
|
|
527
|
+
return { event: undefined, tags: [] };
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export const TaggedEvent: MessageFns<TaggedEvent> = {
|
|
531
|
+
encode(message: TaggedEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
532
|
+
if (message.event !== undefined) {
|
|
533
|
+
Event.encode(message.event, writer.uint32(10).fork()).join();
|
|
534
|
+
}
|
|
535
|
+
for (const v of message.tags) {
|
|
536
|
+
Tag.encode(v!, writer.uint32(18).fork()).join();
|
|
537
|
+
}
|
|
538
|
+
return writer;
|
|
539
|
+
},
|
|
540
|
+
|
|
541
|
+
decode(input: BinaryReader | Uint8Array, length?: number): TaggedEvent {
|
|
542
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
543
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
544
|
+
const message = createBaseTaggedEvent();
|
|
545
|
+
while (reader.pos < end) {
|
|
546
|
+
const tag = reader.uint32();
|
|
547
|
+
switch (tag >>> 3) {
|
|
548
|
+
case 1: {
|
|
549
|
+
if (tag !== 10) {
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
message.event = Event.decode(reader, reader.uint32());
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
case 2: {
|
|
557
|
+
if (tag !== 18) {
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
message.tags.push(Tag.decode(reader, reader.uint32()));
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
reader.skip(tag & 7);
|
|
569
|
+
}
|
|
570
|
+
return message;
|
|
571
|
+
},
|
|
572
|
+
|
|
573
|
+
fromJSON(object: any): TaggedEvent {
|
|
574
|
+
return {
|
|
575
|
+
event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
|
|
576
|
+
tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e: any) => Tag.fromJSON(e)) : [],
|
|
577
|
+
};
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
toJSON(message: TaggedEvent): unknown {
|
|
581
|
+
const obj: any = {};
|
|
582
|
+
if (message.event !== undefined) {
|
|
583
|
+
obj.event = Event.toJSON(message.event);
|
|
584
|
+
}
|
|
585
|
+
if (message.tags?.length) {
|
|
586
|
+
obj.tags = message.tags.map((e) => Tag.toJSON(e));
|
|
587
|
+
}
|
|
588
|
+
return obj;
|
|
589
|
+
},
|
|
590
|
+
|
|
591
|
+
create(base?: DeepPartial<TaggedEvent>): TaggedEvent {
|
|
592
|
+
return TaggedEvent.fromPartial(base ?? {});
|
|
593
|
+
},
|
|
594
|
+
fromPartial(object: DeepPartial<TaggedEvent>): TaggedEvent {
|
|
595
|
+
const message = createBaseTaggedEvent();
|
|
596
|
+
message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
|
|
597
|
+
message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || [];
|
|
598
|
+
return message;
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
function createBaseSequencedEvent(): SequencedEvent {
|
|
603
|
+
return { sequence: 0n, event: undefined };
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export const SequencedEvent: MessageFns<SequencedEvent> = {
|
|
607
|
+
encode(message: SequencedEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
608
|
+
if (message.sequence !== 0n) {
|
|
609
|
+
if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
|
|
610
|
+
throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
|
|
611
|
+
}
|
|
612
|
+
writer.uint32(8).int64(message.sequence);
|
|
613
|
+
}
|
|
614
|
+
if (message.event !== undefined) {
|
|
615
|
+
Event.encode(message.event, writer.uint32(18).fork()).join();
|
|
616
|
+
}
|
|
617
|
+
return writer;
|
|
618
|
+
},
|
|
619
|
+
|
|
620
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SequencedEvent {
|
|
621
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
622
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
623
|
+
const message = createBaseSequencedEvent();
|
|
624
|
+
while (reader.pos < end) {
|
|
625
|
+
const tag = reader.uint32();
|
|
626
|
+
switch (tag >>> 3) {
|
|
627
|
+
case 1: {
|
|
628
|
+
if (tag !== 8) {
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
message.sequence = reader.int64() as bigint;
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
case 2: {
|
|
636
|
+
if (tag !== 18) {
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
message.event = Event.decode(reader, reader.uint32());
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
reader.skip(tag & 7);
|
|
648
|
+
}
|
|
649
|
+
return message;
|
|
650
|
+
},
|
|
651
|
+
|
|
652
|
+
fromJSON(object: any): SequencedEvent {
|
|
653
|
+
return {
|
|
654
|
+
sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
|
|
655
|
+
event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
|
|
656
|
+
};
|
|
657
|
+
},
|
|
658
|
+
|
|
659
|
+
toJSON(message: SequencedEvent): unknown {
|
|
660
|
+
const obj: any = {};
|
|
661
|
+
if (message.sequence !== 0n) {
|
|
662
|
+
obj.sequence = message.sequence.toString();
|
|
663
|
+
}
|
|
664
|
+
if (message.event !== undefined) {
|
|
665
|
+
obj.event = Event.toJSON(message.event);
|
|
666
|
+
}
|
|
667
|
+
return obj;
|
|
668
|
+
},
|
|
669
|
+
|
|
670
|
+
create(base?: DeepPartial<SequencedEvent>): SequencedEvent {
|
|
671
|
+
return SequencedEvent.fromPartial(base ?? {});
|
|
672
|
+
},
|
|
673
|
+
fromPartial(object: DeepPartial<SequencedEvent>): SequencedEvent {
|
|
674
|
+
const message = createBaseSequencedEvent();
|
|
675
|
+
message.sequence = object.sequence ?? 0n;
|
|
676
|
+
message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
|
|
677
|
+
return message;
|
|
678
|
+
},
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
function createBaseAppendRequest(): AppendRequest {
|
|
682
|
+
return { condition: undefined, events: [] };
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export const AppendRequest: MessageFns<AppendRequest> = {
|
|
686
|
+
encode(message: AppendRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
687
|
+
if (message.condition !== undefined) {
|
|
688
|
+
ConsistencyCondition.encode(message.condition, writer.uint32(10).fork()).join();
|
|
689
|
+
}
|
|
690
|
+
for (const v of message.events) {
|
|
691
|
+
TaggedEvent.encode(v!, writer.uint32(18).fork()).join();
|
|
692
|
+
}
|
|
693
|
+
return writer;
|
|
694
|
+
},
|
|
695
|
+
|
|
696
|
+
decode(input: BinaryReader | Uint8Array, length?: number): AppendRequest {
|
|
697
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
698
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
699
|
+
const message = createBaseAppendRequest();
|
|
700
|
+
while (reader.pos < end) {
|
|
701
|
+
const tag = reader.uint32();
|
|
702
|
+
switch (tag >>> 3) {
|
|
703
|
+
case 1: {
|
|
704
|
+
if (tag !== 10) {
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
message.condition = ConsistencyCondition.decode(reader, reader.uint32());
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
case 2: {
|
|
712
|
+
if (tag !== 18) {
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
message.events.push(TaggedEvent.decode(reader, reader.uint32()));
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
reader.skip(tag & 7);
|
|
724
|
+
}
|
|
725
|
+
return message;
|
|
726
|
+
},
|
|
727
|
+
|
|
728
|
+
fromJSON(object: any): AppendRequest {
|
|
729
|
+
return {
|
|
730
|
+
condition: isSet(object.condition) ? ConsistencyCondition.fromJSON(object.condition) : undefined,
|
|
731
|
+
events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => TaggedEvent.fromJSON(e)) : [],
|
|
732
|
+
};
|
|
733
|
+
},
|
|
734
|
+
|
|
735
|
+
toJSON(message: AppendRequest): unknown {
|
|
736
|
+
const obj: any = {};
|
|
737
|
+
if (message.condition !== undefined) {
|
|
738
|
+
obj.condition = ConsistencyCondition.toJSON(message.condition);
|
|
739
|
+
}
|
|
740
|
+
if (message.events?.length) {
|
|
741
|
+
obj.events = message.events.map((e) => TaggedEvent.toJSON(e));
|
|
742
|
+
}
|
|
743
|
+
return obj;
|
|
744
|
+
},
|
|
745
|
+
|
|
746
|
+
create(base?: DeepPartial<AppendRequest>): AppendRequest {
|
|
747
|
+
return AppendRequest.fromPartial(base ?? {});
|
|
748
|
+
},
|
|
749
|
+
fromPartial(object: DeepPartial<AppendRequest>): AppendRequest {
|
|
750
|
+
const message = createBaseAppendRequest();
|
|
751
|
+
message.condition = (object.condition !== undefined && object.condition !== null)
|
|
752
|
+
? ConsistencyCondition.fromPartial(object.condition)
|
|
753
|
+
: undefined;
|
|
754
|
+
message.events = object.events?.map((e) => TaggedEvent.fromPartial(e)) || [];
|
|
755
|
+
return message;
|
|
756
|
+
},
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
function createBaseAppendResponse(): AppendResponse {
|
|
760
|
+
return { firstSequence: 0n, count: 0, consistencyMarker: 0n };
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export const AppendResponse: MessageFns<AppendResponse> = {
|
|
764
|
+
encode(message: AppendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
765
|
+
if (message.firstSequence !== 0n) {
|
|
766
|
+
if (BigInt.asIntN(64, message.firstSequence) !== message.firstSequence) {
|
|
767
|
+
throw new globalThis.Error("value provided for field message.firstSequence of type int64 too large");
|
|
768
|
+
}
|
|
769
|
+
writer.uint32(8).int64(message.firstSequence);
|
|
770
|
+
}
|
|
771
|
+
if (message.count !== 0) {
|
|
772
|
+
writer.uint32(16).int32(message.count);
|
|
773
|
+
}
|
|
774
|
+
if (message.consistencyMarker !== 0n) {
|
|
775
|
+
if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
|
|
776
|
+
throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
|
|
777
|
+
}
|
|
778
|
+
writer.uint32(24).int64(message.consistencyMarker);
|
|
779
|
+
}
|
|
780
|
+
return writer;
|
|
781
|
+
},
|
|
782
|
+
|
|
783
|
+
decode(input: BinaryReader | Uint8Array, length?: number): AppendResponse {
|
|
784
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
785
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
786
|
+
const message = createBaseAppendResponse();
|
|
787
|
+
while (reader.pos < end) {
|
|
788
|
+
const tag = reader.uint32();
|
|
789
|
+
switch (tag >>> 3) {
|
|
790
|
+
case 1: {
|
|
791
|
+
if (tag !== 8) {
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
message.firstSequence = reader.int64() as bigint;
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
798
|
+
case 2: {
|
|
799
|
+
if (tag !== 16) {
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
message.count = reader.int32();
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
case 3: {
|
|
807
|
+
if (tag !== 24) {
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
message.consistencyMarker = reader.int64() as bigint;
|
|
812
|
+
continue;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
reader.skip(tag & 7);
|
|
819
|
+
}
|
|
820
|
+
return message;
|
|
821
|
+
},
|
|
822
|
+
|
|
823
|
+
fromJSON(object: any): AppendResponse {
|
|
824
|
+
return {
|
|
825
|
+
firstSequence: isSet(object.firstSequence)
|
|
826
|
+
? BigInt(object.firstSequence)
|
|
827
|
+
: isSet(object.first_sequence)
|
|
828
|
+
? BigInt(object.first_sequence)
|
|
829
|
+
: 0n,
|
|
830
|
+
count: isSet(object.count) ? globalThis.Number(object.count) : 0,
|
|
831
|
+
consistencyMarker: isSet(object.consistencyMarker)
|
|
832
|
+
? BigInt(object.consistencyMarker)
|
|
833
|
+
: isSet(object.consistency_marker)
|
|
834
|
+
? BigInt(object.consistency_marker)
|
|
835
|
+
: 0n,
|
|
836
|
+
};
|
|
837
|
+
},
|
|
838
|
+
|
|
839
|
+
toJSON(message: AppendResponse): unknown {
|
|
840
|
+
const obj: any = {};
|
|
841
|
+
if (message.firstSequence !== 0n) {
|
|
842
|
+
obj.firstSequence = message.firstSequence.toString();
|
|
843
|
+
}
|
|
844
|
+
if (message.count !== 0) {
|
|
845
|
+
obj.count = Math.round(message.count);
|
|
846
|
+
}
|
|
847
|
+
if (message.consistencyMarker !== 0n) {
|
|
848
|
+
obj.consistencyMarker = message.consistencyMarker.toString();
|
|
849
|
+
}
|
|
850
|
+
return obj;
|
|
851
|
+
},
|
|
852
|
+
|
|
853
|
+
create(base?: DeepPartial<AppendResponse>): AppendResponse {
|
|
854
|
+
return AppendResponse.fromPartial(base ?? {});
|
|
855
|
+
},
|
|
856
|
+
fromPartial(object: DeepPartial<AppendResponse>): AppendResponse {
|
|
857
|
+
const message = createBaseAppendResponse();
|
|
858
|
+
message.firstSequence = object.firstSequence ?? 0n;
|
|
859
|
+
message.count = object.count ?? 0;
|
|
860
|
+
message.consistencyMarker = object.consistencyMarker ?? 0n;
|
|
861
|
+
return message;
|
|
862
|
+
},
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
function createBaseConsistencyCondition(): ConsistencyCondition {
|
|
866
|
+
return { consistencyMarker: 0n, criteria: [] };
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export const ConsistencyCondition: MessageFns<ConsistencyCondition> = {
|
|
870
|
+
encode(message: ConsistencyCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
871
|
+
if (message.consistencyMarker !== 0n) {
|
|
872
|
+
if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
|
|
873
|
+
throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
|
|
874
|
+
}
|
|
875
|
+
writer.uint32(8).int64(message.consistencyMarker);
|
|
876
|
+
}
|
|
877
|
+
for (const v of message.criteria) {
|
|
878
|
+
Criterion.encode(v!, writer.uint32(18).fork()).join();
|
|
879
|
+
}
|
|
880
|
+
return writer;
|
|
881
|
+
},
|
|
882
|
+
|
|
883
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ConsistencyCondition {
|
|
884
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
885
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
886
|
+
const message = createBaseConsistencyCondition();
|
|
887
|
+
while (reader.pos < end) {
|
|
888
|
+
const tag = reader.uint32();
|
|
889
|
+
switch (tag >>> 3) {
|
|
890
|
+
case 1: {
|
|
891
|
+
if (tag !== 8) {
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
message.consistencyMarker = reader.int64() as bigint;
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
case 2: {
|
|
899
|
+
if (tag !== 18) {
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
message.criteria.push(Criterion.decode(reader, reader.uint32()));
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
reader.skip(tag & 7);
|
|
911
|
+
}
|
|
912
|
+
return message;
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
fromJSON(object: any): ConsistencyCondition {
|
|
916
|
+
return {
|
|
917
|
+
consistencyMarker: isSet(object.consistencyMarker)
|
|
918
|
+
? BigInt(object.consistencyMarker)
|
|
919
|
+
: isSet(object.consistency_marker)
|
|
920
|
+
? BigInt(object.consistency_marker)
|
|
921
|
+
: 0n,
|
|
922
|
+
criteria: globalThis.Array.isArray(object?.criteria)
|
|
923
|
+
? object.criteria.map((e: any) => Criterion.fromJSON(e))
|
|
924
|
+
: [],
|
|
925
|
+
};
|
|
926
|
+
},
|
|
927
|
+
|
|
928
|
+
toJSON(message: ConsistencyCondition): unknown {
|
|
929
|
+
const obj: any = {};
|
|
930
|
+
if (message.consistencyMarker !== 0n) {
|
|
931
|
+
obj.consistencyMarker = message.consistencyMarker.toString();
|
|
932
|
+
}
|
|
933
|
+
if (message.criteria?.length) {
|
|
934
|
+
obj.criteria = message.criteria.map((e) => Criterion.toJSON(e));
|
|
935
|
+
}
|
|
936
|
+
return obj;
|
|
937
|
+
},
|
|
938
|
+
|
|
939
|
+
create(base?: DeepPartial<ConsistencyCondition>): ConsistencyCondition {
|
|
940
|
+
return ConsistencyCondition.fromPartial(base ?? {});
|
|
941
|
+
},
|
|
942
|
+
fromPartial(object: DeepPartial<ConsistencyCondition>): ConsistencyCondition {
|
|
943
|
+
const message = createBaseConsistencyCondition();
|
|
944
|
+
message.consistencyMarker = object.consistencyMarker ?? 0n;
|
|
945
|
+
message.criteria = object.criteria?.map((e) => Criterion.fromPartial(e)) || [];
|
|
946
|
+
return message;
|
|
947
|
+
},
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
function createBaseCriterion(): Criterion {
|
|
951
|
+
return { names: [], tags: [] };
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
export const Criterion: MessageFns<Criterion> = {
|
|
955
|
+
encode(message: Criterion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
956
|
+
for (const v of message.names) {
|
|
957
|
+
writer.uint32(10).string(v!);
|
|
958
|
+
}
|
|
959
|
+
for (const v of message.tags) {
|
|
960
|
+
Tag.encode(v!, writer.uint32(18).fork()).join();
|
|
961
|
+
}
|
|
962
|
+
return writer;
|
|
963
|
+
},
|
|
964
|
+
|
|
965
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Criterion {
|
|
966
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
967
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
968
|
+
const message = createBaseCriterion();
|
|
969
|
+
while (reader.pos < end) {
|
|
970
|
+
const tag = reader.uint32();
|
|
971
|
+
switch (tag >>> 3) {
|
|
972
|
+
case 1: {
|
|
973
|
+
if (tag !== 10) {
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
message.names.push(reader.string());
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
case 2: {
|
|
981
|
+
if (tag !== 18) {
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
message.tags.push(Tag.decode(reader, reader.uint32()));
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
reader.skip(tag & 7);
|
|
993
|
+
}
|
|
994
|
+
return message;
|
|
995
|
+
},
|
|
996
|
+
|
|
997
|
+
fromJSON(object: any): Criterion {
|
|
998
|
+
return {
|
|
999
|
+
names: globalThis.Array.isArray(object?.names) ? object.names.map((e: any) => globalThis.String(e)) : [],
|
|
1000
|
+
tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e: any) => Tag.fromJSON(e)) : [],
|
|
1001
|
+
};
|
|
1002
|
+
},
|
|
1003
|
+
|
|
1004
|
+
toJSON(message: Criterion): unknown {
|
|
1005
|
+
const obj: any = {};
|
|
1006
|
+
if (message.names?.length) {
|
|
1007
|
+
obj.names = message.names;
|
|
1008
|
+
}
|
|
1009
|
+
if (message.tags?.length) {
|
|
1010
|
+
obj.tags = message.tags.map((e) => Tag.toJSON(e));
|
|
1011
|
+
}
|
|
1012
|
+
return obj;
|
|
1013
|
+
},
|
|
1014
|
+
|
|
1015
|
+
create(base?: DeepPartial<Criterion>): Criterion {
|
|
1016
|
+
return Criterion.fromPartial(base ?? {});
|
|
1017
|
+
},
|
|
1018
|
+
fromPartial(object: DeepPartial<Criterion>): Criterion {
|
|
1019
|
+
const message = createBaseCriterion();
|
|
1020
|
+
message.names = object.names?.map((e) => e) || [];
|
|
1021
|
+
message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || [];
|
|
1022
|
+
return message;
|
|
1023
|
+
},
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
function createBaseSourceRequest(): SourceRequest {
|
|
1027
|
+
return { fromSequence: 0n, criteria: [] };
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
export const SourceRequest: MessageFns<SourceRequest> = {
|
|
1031
|
+
encode(message: SourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1032
|
+
if (message.fromSequence !== 0n) {
|
|
1033
|
+
if (BigInt.asIntN(64, message.fromSequence) !== message.fromSequence) {
|
|
1034
|
+
throw new globalThis.Error("value provided for field message.fromSequence of type int64 too large");
|
|
1035
|
+
}
|
|
1036
|
+
writer.uint32(8).int64(message.fromSequence);
|
|
1037
|
+
}
|
|
1038
|
+
for (const v of message.criteria) {
|
|
1039
|
+
Criterion.encode(v!, writer.uint32(18).fork()).join();
|
|
1040
|
+
}
|
|
1041
|
+
return writer;
|
|
1042
|
+
},
|
|
1043
|
+
|
|
1044
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SourceRequest {
|
|
1045
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1046
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1047
|
+
const message = createBaseSourceRequest();
|
|
1048
|
+
while (reader.pos < end) {
|
|
1049
|
+
const tag = reader.uint32();
|
|
1050
|
+
switch (tag >>> 3) {
|
|
1051
|
+
case 1: {
|
|
1052
|
+
if (tag !== 8) {
|
|
1053
|
+
break;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
message.fromSequence = reader.int64() as bigint;
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
case 2: {
|
|
1060
|
+
if (tag !== 18) {
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
message.criteria.push(Criterion.decode(reader, reader.uint32()));
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
reader.skip(tag & 7);
|
|
1072
|
+
}
|
|
1073
|
+
return message;
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
fromJSON(object: any): SourceRequest {
|
|
1077
|
+
return {
|
|
1078
|
+
fromSequence: isSet(object.fromSequence)
|
|
1079
|
+
? BigInt(object.fromSequence)
|
|
1080
|
+
: isSet(object.from_sequence)
|
|
1081
|
+
? BigInt(object.from_sequence)
|
|
1082
|
+
: 0n,
|
|
1083
|
+
criteria: globalThis.Array.isArray(object?.criteria)
|
|
1084
|
+
? object.criteria.map((e: any) => Criterion.fromJSON(e))
|
|
1085
|
+
: [],
|
|
1086
|
+
};
|
|
1087
|
+
},
|
|
1088
|
+
|
|
1089
|
+
toJSON(message: SourceRequest): unknown {
|
|
1090
|
+
const obj: any = {};
|
|
1091
|
+
if (message.fromSequence !== 0n) {
|
|
1092
|
+
obj.fromSequence = message.fromSequence.toString();
|
|
1093
|
+
}
|
|
1094
|
+
if (message.criteria?.length) {
|
|
1095
|
+
obj.criteria = message.criteria.map((e) => Criterion.toJSON(e));
|
|
1096
|
+
}
|
|
1097
|
+
return obj;
|
|
1098
|
+
},
|
|
1099
|
+
|
|
1100
|
+
create(base?: DeepPartial<SourceRequest>): SourceRequest {
|
|
1101
|
+
return SourceRequest.fromPartial(base ?? {});
|
|
1102
|
+
},
|
|
1103
|
+
fromPartial(object: DeepPartial<SourceRequest>): SourceRequest {
|
|
1104
|
+
const message = createBaseSourceRequest();
|
|
1105
|
+
message.fromSequence = object.fromSequence ?? 0n;
|
|
1106
|
+
message.criteria = object.criteria?.map((e) => Criterion.fromPartial(e)) || [];
|
|
1107
|
+
return message;
|
|
1108
|
+
},
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
function createBaseSourceResponse(): SourceResponse {
|
|
1112
|
+
return { event: undefined, consistencyMarker: undefined };
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
export const SourceResponse: MessageFns<SourceResponse> = {
|
|
1116
|
+
encode(message: SourceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1117
|
+
if (message.event !== undefined) {
|
|
1118
|
+
SequencedEvent.encode(message.event, writer.uint32(10).fork()).join();
|
|
1119
|
+
}
|
|
1120
|
+
if (message.consistencyMarker !== undefined) {
|
|
1121
|
+
if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
|
|
1122
|
+
throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
|
|
1123
|
+
}
|
|
1124
|
+
writer.uint32(16).int64(message.consistencyMarker);
|
|
1125
|
+
}
|
|
1126
|
+
return writer;
|
|
1127
|
+
},
|
|
1128
|
+
|
|
1129
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SourceResponse {
|
|
1130
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1131
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1132
|
+
const message = createBaseSourceResponse();
|
|
1133
|
+
while (reader.pos < end) {
|
|
1134
|
+
const tag = reader.uint32();
|
|
1135
|
+
switch (tag >>> 3) {
|
|
1136
|
+
case 1: {
|
|
1137
|
+
if (tag !== 10) {
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
message.event = SequencedEvent.decode(reader, reader.uint32());
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
case 2: {
|
|
1145
|
+
if (tag !== 16) {
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
message.consistencyMarker = reader.int64() as bigint;
|
|
1150
|
+
continue;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
reader.skip(tag & 7);
|
|
1157
|
+
}
|
|
1158
|
+
return message;
|
|
1159
|
+
},
|
|
1160
|
+
|
|
1161
|
+
fromJSON(object: any): SourceResponse {
|
|
1162
|
+
return {
|
|
1163
|
+
event: isSet(object.event) ? SequencedEvent.fromJSON(object.event) : undefined,
|
|
1164
|
+
consistencyMarker: isSet(object.consistencyMarker)
|
|
1165
|
+
? BigInt(object.consistencyMarker)
|
|
1166
|
+
: isSet(object.consistency_marker)
|
|
1167
|
+
? BigInt(object.consistency_marker)
|
|
1168
|
+
: undefined,
|
|
1169
|
+
};
|
|
1170
|
+
},
|
|
1171
|
+
|
|
1172
|
+
toJSON(message: SourceResponse): unknown {
|
|
1173
|
+
const obj: any = {};
|
|
1174
|
+
if (message.event !== undefined) {
|
|
1175
|
+
obj.event = SequencedEvent.toJSON(message.event);
|
|
1176
|
+
}
|
|
1177
|
+
if (message.consistencyMarker !== undefined) {
|
|
1178
|
+
obj.consistencyMarker = message.consistencyMarker.toString();
|
|
1179
|
+
}
|
|
1180
|
+
return obj;
|
|
1181
|
+
},
|
|
1182
|
+
|
|
1183
|
+
create(base?: DeepPartial<SourceResponse>): SourceResponse {
|
|
1184
|
+
return SourceResponse.fromPartial(base ?? {});
|
|
1185
|
+
},
|
|
1186
|
+
fromPartial(object: DeepPartial<SourceResponse>): SourceResponse {
|
|
1187
|
+
const message = createBaseSourceResponse();
|
|
1188
|
+
message.event = (object.event !== undefined && object.event !== null)
|
|
1189
|
+
? SequencedEvent.fromPartial(object.event)
|
|
1190
|
+
: undefined;
|
|
1191
|
+
message.consistencyMarker = object.consistencyMarker ?? undefined;
|
|
1192
|
+
return message;
|
|
1193
|
+
},
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
function createBaseStreamControl(): StreamControl {
|
|
1197
|
+
return { subscribe: undefined, permits: undefined };
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
export const StreamControl: MessageFns<StreamControl> = {
|
|
1201
|
+
encode(message: StreamControl, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1202
|
+
if (message.subscribe !== undefined) {
|
|
1203
|
+
StreamSubscribe.encode(message.subscribe, writer.uint32(10).fork()).join();
|
|
1204
|
+
}
|
|
1205
|
+
if (message.permits !== undefined) {
|
|
1206
|
+
StreamPermits.encode(message.permits, writer.uint32(18).fork()).join();
|
|
1207
|
+
}
|
|
1208
|
+
return writer;
|
|
1209
|
+
},
|
|
1210
|
+
|
|
1211
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamControl {
|
|
1212
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1213
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1214
|
+
const message = createBaseStreamControl();
|
|
1215
|
+
while (reader.pos < end) {
|
|
1216
|
+
const tag = reader.uint32();
|
|
1217
|
+
switch (tag >>> 3) {
|
|
1218
|
+
case 1: {
|
|
1219
|
+
if (tag !== 10) {
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
message.subscribe = StreamSubscribe.decode(reader, reader.uint32());
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
case 2: {
|
|
1227
|
+
if (tag !== 18) {
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
message.permits = StreamPermits.decode(reader, reader.uint32());
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
reader.skip(tag & 7);
|
|
1239
|
+
}
|
|
1240
|
+
return message;
|
|
1241
|
+
},
|
|
1242
|
+
|
|
1243
|
+
fromJSON(object: any): StreamControl {
|
|
1244
|
+
return {
|
|
1245
|
+
subscribe: isSet(object.subscribe) ? StreamSubscribe.fromJSON(object.subscribe) : undefined,
|
|
1246
|
+
permits: isSet(object.permits) ? StreamPermits.fromJSON(object.permits) : undefined,
|
|
1247
|
+
};
|
|
1248
|
+
},
|
|
1249
|
+
|
|
1250
|
+
toJSON(message: StreamControl): unknown {
|
|
1251
|
+
const obj: any = {};
|
|
1252
|
+
if (message.subscribe !== undefined) {
|
|
1253
|
+
obj.subscribe = StreamSubscribe.toJSON(message.subscribe);
|
|
1254
|
+
}
|
|
1255
|
+
if (message.permits !== undefined) {
|
|
1256
|
+
obj.permits = StreamPermits.toJSON(message.permits);
|
|
1257
|
+
}
|
|
1258
|
+
return obj;
|
|
1259
|
+
},
|
|
1260
|
+
|
|
1261
|
+
create(base?: DeepPartial<StreamControl>): StreamControl {
|
|
1262
|
+
return StreamControl.fromPartial(base ?? {});
|
|
1263
|
+
},
|
|
1264
|
+
fromPartial(object: DeepPartial<StreamControl>): StreamControl {
|
|
1265
|
+
const message = createBaseStreamControl();
|
|
1266
|
+
message.subscribe = (object.subscribe !== undefined && object.subscribe !== null)
|
|
1267
|
+
? StreamSubscribe.fromPartial(object.subscribe)
|
|
1268
|
+
: undefined;
|
|
1269
|
+
message.permits = (object.permits !== undefined && object.permits !== null)
|
|
1270
|
+
? StreamPermits.fromPartial(object.permits)
|
|
1271
|
+
: undefined;
|
|
1272
|
+
return message;
|
|
1273
|
+
},
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
function createBaseStreamSubscribe(): StreamSubscribe {
|
|
1277
|
+
return { fromSequence: 0n, criteria: [], initialPermits: 0n, blacklistedNames: [] };
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
export const StreamSubscribe: MessageFns<StreamSubscribe> = {
|
|
1281
|
+
encode(message: StreamSubscribe, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1282
|
+
if (message.fromSequence !== 0n) {
|
|
1283
|
+
if (BigInt.asIntN(64, message.fromSequence) !== message.fromSequence) {
|
|
1284
|
+
throw new globalThis.Error("value provided for field message.fromSequence of type int64 too large");
|
|
1285
|
+
}
|
|
1286
|
+
writer.uint32(8).int64(message.fromSequence);
|
|
1287
|
+
}
|
|
1288
|
+
for (const v of message.criteria) {
|
|
1289
|
+
Criterion.encode(v!, writer.uint32(18).fork()).join();
|
|
1290
|
+
}
|
|
1291
|
+
if (message.initialPermits !== 0n) {
|
|
1292
|
+
if (BigInt.asIntN(64, message.initialPermits) !== message.initialPermits) {
|
|
1293
|
+
throw new globalThis.Error("value provided for field message.initialPermits of type int64 too large");
|
|
1294
|
+
}
|
|
1295
|
+
writer.uint32(24).int64(message.initialPermits);
|
|
1296
|
+
}
|
|
1297
|
+
for (const v of message.blacklistedNames) {
|
|
1298
|
+
writer.uint32(34).string(v!);
|
|
1299
|
+
}
|
|
1300
|
+
return writer;
|
|
1301
|
+
},
|
|
1302
|
+
|
|
1303
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamSubscribe {
|
|
1304
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1305
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1306
|
+
const message = createBaseStreamSubscribe();
|
|
1307
|
+
while (reader.pos < end) {
|
|
1308
|
+
const tag = reader.uint32();
|
|
1309
|
+
switch (tag >>> 3) {
|
|
1310
|
+
case 1: {
|
|
1311
|
+
if (tag !== 8) {
|
|
1312
|
+
break;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
message.fromSequence = reader.int64() as bigint;
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
case 2: {
|
|
1319
|
+
if (tag !== 18) {
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
message.criteria.push(Criterion.decode(reader, reader.uint32()));
|
|
1324
|
+
continue;
|
|
1325
|
+
}
|
|
1326
|
+
case 3: {
|
|
1327
|
+
if (tag !== 24) {
|
|
1328
|
+
break;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
message.initialPermits = reader.int64() as bigint;
|
|
1332
|
+
continue;
|
|
1333
|
+
}
|
|
1334
|
+
case 4: {
|
|
1335
|
+
if (tag !== 34) {
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
message.blacklistedNames.push(reader.string());
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
reader.skip(tag & 7);
|
|
1347
|
+
}
|
|
1348
|
+
return message;
|
|
1349
|
+
},
|
|
1350
|
+
|
|
1351
|
+
fromJSON(object: any): StreamSubscribe {
|
|
1352
|
+
return {
|
|
1353
|
+
fromSequence: isSet(object.fromSequence)
|
|
1354
|
+
? BigInt(object.fromSequence)
|
|
1355
|
+
: isSet(object.from_sequence)
|
|
1356
|
+
? BigInt(object.from_sequence)
|
|
1357
|
+
: 0n,
|
|
1358
|
+
criteria: globalThis.Array.isArray(object?.criteria)
|
|
1359
|
+
? object.criteria.map((e: any) => Criterion.fromJSON(e))
|
|
1360
|
+
: [],
|
|
1361
|
+
initialPermits: isSet(object.initialPermits)
|
|
1362
|
+
? BigInt(object.initialPermits)
|
|
1363
|
+
: isSet(object.initial_permits)
|
|
1364
|
+
? BigInt(object.initial_permits)
|
|
1365
|
+
: 0n,
|
|
1366
|
+
blacklistedNames: globalThis.Array.isArray(object?.blacklistedNames)
|
|
1367
|
+
? object.blacklistedNames.map((e: any) => globalThis.String(e))
|
|
1368
|
+
: globalThis.Array.isArray(object?.blacklisted_names)
|
|
1369
|
+
? object.blacklisted_names.map((e: any) => globalThis.String(e))
|
|
1370
|
+
: [],
|
|
1371
|
+
};
|
|
1372
|
+
},
|
|
1373
|
+
|
|
1374
|
+
toJSON(message: StreamSubscribe): unknown {
|
|
1375
|
+
const obj: any = {};
|
|
1376
|
+
if (message.fromSequence !== 0n) {
|
|
1377
|
+
obj.fromSequence = message.fromSequence.toString();
|
|
1378
|
+
}
|
|
1379
|
+
if (message.criteria?.length) {
|
|
1380
|
+
obj.criteria = message.criteria.map((e) => Criterion.toJSON(e));
|
|
1381
|
+
}
|
|
1382
|
+
if (message.initialPermits !== 0n) {
|
|
1383
|
+
obj.initialPermits = message.initialPermits.toString();
|
|
1384
|
+
}
|
|
1385
|
+
if (message.blacklistedNames?.length) {
|
|
1386
|
+
obj.blacklistedNames = message.blacklistedNames;
|
|
1387
|
+
}
|
|
1388
|
+
return obj;
|
|
1389
|
+
},
|
|
1390
|
+
|
|
1391
|
+
create(base?: DeepPartial<StreamSubscribe>): StreamSubscribe {
|
|
1392
|
+
return StreamSubscribe.fromPartial(base ?? {});
|
|
1393
|
+
},
|
|
1394
|
+
fromPartial(object: DeepPartial<StreamSubscribe>): StreamSubscribe {
|
|
1395
|
+
const message = createBaseStreamSubscribe();
|
|
1396
|
+
message.fromSequence = object.fromSequence ?? 0n;
|
|
1397
|
+
message.criteria = object.criteria?.map((e) => Criterion.fromPartial(e)) || [];
|
|
1398
|
+
message.initialPermits = object.initialPermits ?? 0n;
|
|
1399
|
+
message.blacklistedNames = object.blacklistedNames?.map((e) => e) || [];
|
|
1400
|
+
return message;
|
|
1401
|
+
},
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
function createBaseStreamPermits(): StreamPermits {
|
|
1405
|
+
return { permits: 0n };
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
export const StreamPermits: MessageFns<StreamPermits> = {
|
|
1409
|
+
encode(message: StreamPermits, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1410
|
+
if (message.permits !== 0n) {
|
|
1411
|
+
if (BigInt.asIntN(64, message.permits) !== message.permits) {
|
|
1412
|
+
throw new globalThis.Error("value provided for field message.permits of type int64 too large");
|
|
1413
|
+
}
|
|
1414
|
+
writer.uint32(8).int64(message.permits);
|
|
1415
|
+
}
|
|
1416
|
+
return writer;
|
|
1417
|
+
},
|
|
1418
|
+
|
|
1419
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamPermits {
|
|
1420
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1421
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1422
|
+
const message = createBaseStreamPermits();
|
|
1423
|
+
while (reader.pos < end) {
|
|
1424
|
+
const tag = reader.uint32();
|
|
1425
|
+
switch (tag >>> 3) {
|
|
1426
|
+
case 1: {
|
|
1427
|
+
if (tag !== 8) {
|
|
1428
|
+
break;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
message.permits = reader.int64() as bigint;
|
|
1432
|
+
continue;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
reader.skip(tag & 7);
|
|
1439
|
+
}
|
|
1440
|
+
return message;
|
|
1441
|
+
},
|
|
1442
|
+
|
|
1443
|
+
fromJSON(object: any): StreamPermits {
|
|
1444
|
+
return { permits: isSet(object.permits) ? BigInt(object.permits) : 0n };
|
|
1445
|
+
},
|
|
1446
|
+
|
|
1447
|
+
toJSON(message: StreamPermits): unknown {
|
|
1448
|
+
const obj: any = {};
|
|
1449
|
+
if (message.permits !== 0n) {
|
|
1450
|
+
obj.permits = message.permits.toString();
|
|
1451
|
+
}
|
|
1452
|
+
return obj;
|
|
1453
|
+
},
|
|
1454
|
+
|
|
1455
|
+
create(base?: DeepPartial<StreamPermits>): StreamPermits {
|
|
1456
|
+
return StreamPermits.fromPartial(base ?? {});
|
|
1457
|
+
},
|
|
1458
|
+
fromPartial(object: DeepPartial<StreamPermits>): StreamPermits {
|
|
1459
|
+
const message = createBaseStreamPermits();
|
|
1460
|
+
message.permits = object.permits ?? 0n;
|
|
1461
|
+
return message;
|
|
1462
|
+
},
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
function createBaseStreamResponse(): StreamResponse {
|
|
1466
|
+
return { event: undefined, heartbeat: undefined };
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
export const StreamResponse: MessageFns<StreamResponse> = {
|
|
1470
|
+
encode(message: StreamResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1471
|
+
if (message.event !== undefined) {
|
|
1472
|
+
SequencedEvent.encode(message.event, writer.uint32(10).fork()).join();
|
|
1473
|
+
}
|
|
1474
|
+
if (message.heartbeat !== undefined) {
|
|
1475
|
+
StreamHeartbeat.encode(message.heartbeat, writer.uint32(18).fork()).join();
|
|
1476
|
+
}
|
|
1477
|
+
return writer;
|
|
1478
|
+
},
|
|
1479
|
+
|
|
1480
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamResponse {
|
|
1481
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1482
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1483
|
+
const message = createBaseStreamResponse();
|
|
1484
|
+
while (reader.pos < end) {
|
|
1485
|
+
const tag = reader.uint32();
|
|
1486
|
+
switch (tag >>> 3) {
|
|
1487
|
+
case 1: {
|
|
1488
|
+
if (tag !== 10) {
|
|
1489
|
+
break;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
message.event = SequencedEvent.decode(reader, reader.uint32());
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
case 2: {
|
|
1496
|
+
if (tag !== 18) {
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
message.heartbeat = StreamHeartbeat.decode(reader, reader.uint32());
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
reader.skip(tag & 7);
|
|
1508
|
+
}
|
|
1509
|
+
return message;
|
|
1510
|
+
},
|
|
1511
|
+
|
|
1512
|
+
fromJSON(object: any): StreamResponse {
|
|
1513
|
+
return {
|
|
1514
|
+
event: isSet(object.event) ? SequencedEvent.fromJSON(object.event) : undefined,
|
|
1515
|
+
heartbeat: isSet(object.heartbeat) ? StreamHeartbeat.fromJSON(object.heartbeat) : undefined,
|
|
1516
|
+
};
|
|
1517
|
+
},
|
|
1518
|
+
|
|
1519
|
+
toJSON(message: StreamResponse): unknown {
|
|
1520
|
+
const obj: any = {};
|
|
1521
|
+
if (message.event !== undefined) {
|
|
1522
|
+
obj.event = SequencedEvent.toJSON(message.event);
|
|
1523
|
+
}
|
|
1524
|
+
if (message.heartbeat !== undefined) {
|
|
1525
|
+
obj.heartbeat = StreamHeartbeat.toJSON(message.heartbeat);
|
|
1526
|
+
}
|
|
1527
|
+
return obj;
|
|
1528
|
+
},
|
|
1529
|
+
|
|
1530
|
+
create(base?: DeepPartial<StreamResponse>): StreamResponse {
|
|
1531
|
+
return StreamResponse.fromPartial(base ?? {});
|
|
1532
|
+
},
|
|
1533
|
+
fromPartial(object: DeepPartial<StreamResponse>): StreamResponse {
|
|
1534
|
+
const message = createBaseStreamResponse();
|
|
1535
|
+
message.event = (object.event !== undefined && object.event !== null)
|
|
1536
|
+
? SequencedEvent.fromPartial(object.event)
|
|
1537
|
+
: undefined;
|
|
1538
|
+
message.heartbeat = (object.heartbeat !== undefined && object.heartbeat !== null)
|
|
1539
|
+
? StreamHeartbeat.fromPartial(object.heartbeat)
|
|
1540
|
+
: undefined;
|
|
1541
|
+
return message;
|
|
1542
|
+
},
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
function createBaseStreamHeartbeat(): StreamHeartbeat {
|
|
1546
|
+
return {};
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
export const StreamHeartbeat: MessageFns<StreamHeartbeat> = {
|
|
1550
|
+
encode(_: StreamHeartbeat, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1551
|
+
return writer;
|
|
1552
|
+
},
|
|
1553
|
+
|
|
1554
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamHeartbeat {
|
|
1555
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1556
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1557
|
+
const message = createBaseStreamHeartbeat();
|
|
1558
|
+
while (reader.pos < end) {
|
|
1559
|
+
const tag = reader.uint32();
|
|
1560
|
+
switch (tag >>> 3) {
|
|
1561
|
+
}
|
|
1562
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
reader.skip(tag & 7);
|
|
1566
|
+
}
|
|
1567
|
+
return message;
|
|
1568
|
+
},
|
|
1569
|
+
|
|
1570
|
+
fromJSON(_: any): StreamHeartbeat {
|
|
1571
|
+
return {};
|
|
1572
|
+
},
|
|
1573
|
+
|
|
1574
|
+
toJSON(_: StreamHeartbeat): unknown {
|
|
1575
|
+
const obj: any = {};
|
|
1576
|
+
return obj;
|
|
1577
|
+
},
|
|
1578
|
+
|
|
1579
|
+
create(base?: DeepPartial<StreamHeartbeat>): StreamHeartbeat {
|
|
1580
|
+
return StreamHeartbeat.fromPartial(base ?? {});
|
|
1581
|
+
},
|
|
1582
|
+
fromPartial(_: DeepPartial<StreamHeartbeat>): StreamHeartbeat {
|
|
1583
|
+
const message = createBaseStreamHeartbeat();
|
|
1584
|
+
return message;
|
|
1585
|
+
},
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
function createBaseGetHeadRequest(): GetHeadRequest {
|
|
1589
|
+
return {};
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
export const GetHeadRequest: MessageFns<GetHeadRequest> = {
|
|
1593
|
+
encode(_: GetHeadRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1594
|
+
return writer;
|
|
1595
|
+
},
|
|
1596
|
+
|
|
1597
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetHeadRequest {
|
|
1598
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1599
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1600
|
+
const message = createBaseGetHeadRequest();
|
|
1601
|
+
while (reader.pos < end) {
|
|
1602
|
+
const tag = reader.uint32();
|
|
1603
|
+
switch (tag >>> 3) {
|
|
1604
|
+
}
|
|
1605
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1606
|
+
break;
|
|
1607
|
+
}
|
|
1608
|
+
reader.skip(tag & 7);
|
|
1609
|
+
}
|
|
1610
|
+
return message;
|
|
1611
|
+
},
|
|
1612
|
+
|
|
1613
|
+
fromJSON(_: any): GetHeadRequest {
|
|
1614
|
+
return {};
|
|
1615
|
+
},
|
|
1616
|
+
|
|
1617
|
+
toJSON(_: GetHeadRequest): unknown {
|
|
1618
|
+
const obj: any = {};
|
|
1619
|
+
return obj;
|
|
1620
|
+
},
|
|
1621
|
+
|
|
1622
|
+
create(base?: DeepPartial<GetHeadRequest>): GetHeadRequest {
|
|
1623
|
+
return GetHeadRequest.fromPartial(base ?? {});
|
|
1624
|
+
},
|
|
1625
|
+
fromPartial(_: DeepPartial<GetHeadRequest>): GetHeadRequest {
|
|
1626
|
+
const message = createBaseGetHeadRequest();
|
|
1627
|
+
return message;
|
|
1628
|
+
},
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
function createBaseGetHeadResponse(): GetHeadResponse {
|
|
1632
|
+
return { sequence: 0n };
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
export const GetHeadResponse: MessageFns<GetHeadResponse> = {
|
|
1636
|
+
encode(message: GetHeadResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1637
|
+
if (message.sequence !== 0n) {
|
|
1638
|
+
if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
|
|
1639
|
+
throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
|
|
1640
|
+
}
|
|
1641
|
+
writer.uint32(8).int64(message.sequence);
|
|
1642
|
+
}
|
|
1643
|
+
return writer;
|
|
1644
|
+
},
|
|
1645
|
+
|
|
1646
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetHeadResponse {
|
|
1647
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1648
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1649
|
+
const message = createBaseGetHeadResponse();
|
|
1650
|
+
while (reader.pos < end) {
|
|
1651
|
+
const tag = reader.uint32();
|
|
1652
|
+
switch (tag >>> 3) {
|
|
1653
|
+
case 1: {
|
|
1654
|
+
if (tag !== 8) {
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
message.sequence = reader.int64() as bigint;
|
|
1659
|
+
continue;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1663
|
+
break;
|
|
1664
|
+
}
|
|
1665
|
+
reader.skip(tag & 7);
|
|
1666
|
+
}
|
|
1667
|
+
return message;
|
|
1668
|
+
},
|
|
1669
|
+
|
|
1670
|
+
fromJSON(object: any): GetHeadResponse {
|
|
1671
|
+
return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
|
|
1672
|
+
},
|
|
1673
|
+
|
|
1674
|
+
toJSON(message: GetHeadResponse): unknown {
|
|
1675
|
+
const obj: any = {};
|
|
1676
|
+
if (message.sequence !== 0n) {
|
|
1677
|
+
obj.sequence = message.sequence.toString();
|
|
1678
|
+
}
|
|
1679
|
+
return obj;
|
|
1680
|
+
},
|
|
1681
|
+
|
|
1682
|
+
create(base?: DeepPartial<GetHeadResponse>): GetHeadResponse {
|
|
1683
|
+
return GetHeadResponse.fromPartial(base ?? {});
|
|
1684
|
+
},
|
|
1685
|
+
fromPartial(object: DeepPartial<GetHeadResponse>): GetHeadResponse {
|
|
1686
|
+
const message = createBaseGetHeadResponse();
|
|
1687
|
+
message.sequence = object.sequence ?? 0n;
|
|
1688
|
+
return message;
|
|
1689
|
+
},
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1692
|
+
function createBaseGetTailRequest(): GetTailRequest {
|
|
1693
|
+
return {};
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
export const GetTailRequest: MessageFns<GetTailRequest> = {
|
|
1697
|
+
encode(_: GetTailRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1698
|
+
return writer;
|
|
1699
|
+
},
|
|
1700
|
+
|
|
1701
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetTailRequest {
|
|
1702
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1703
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1704
|
+
const message = createBaseGetTailRequest();
|
|
1705
|
+
while (reader.pos < end) {
|
|
1706
|
+
const tag = reader.uint32();
|
|
1707
|
+
switch (tag >>> 3) {
|
|
1708
|
+
}
|
|
1709
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1710
|
+
break;
|
|
1711
|
+
}
|
|
1712
|
+
reader.skip(tag & 7);
|
|
1713
|
+
}
|
|
1714
|
+
return message;
|
|
1715
|
+
},
|
|
1716
|
+
|
|
1717
|
+
fromJSON(_: any): GetTailRequest {
|
|
1718
|
+
return {};
|
|
1719
|
+
},
|
|
1720
|
+
|
|
1721
|
+
toJSON(_: GetTailRequest): unknown {
|
|
1722
|
+
const obj: any = {};
|
|
1723
|
+
return obj;
|
|
1724
|
+
},
|
|
1725
|
+
|
|
1726
|
+
create(base?: DeepPartial<GetTailRequest>): GetTailRequest {
|
|
1727
|
+
return GetTailRequest.fromPartial(base ?? {});
|
|
1728
|
+
},
|
|
1729
|
+
fromPartial(_: DeepPartial<GetTailRequest>): GetTailRequest {
|
|
1730
|
+
const message = createBaseGetTailRequest();
|
|
1731
|
+
return message;
|
|
1732
|
+
},
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
function createBaseGetTailResponse(): GetTailResponse {
|
|
1736
|
+
return { sequence: 0n };
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
export const GetTailResponse: MessageFns<GetTailResponse> = {
|
|
1740
|
+
encode(message: GetTailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1741
|
+
if (message.sequence !== 0n) {
|
|
1742
|
+
if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
|
|
1743
|
+
throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
|
|
1744
|
+
}
|
|
1745
|
+
writer.uint32(8).int64(message.sequence);
|
|
1746
|
+
}
|
|
1747
|
+
return writer;
|
|
1748
|
+
},
|
|
1749
|
+
|
|
1750
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetTailResponse {
|
|
1751
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1752
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1753
|
+
const message = createBaseGetTailResponse();
|
|
1754
|
+
while (reader.pos < end) {
|
|
1755
|
+
const tag = reader.uint32();
|
|
1756
|
+
switch (tag >>> 3) {
|
|
1757
|
+
case 1: {
|
|
1758
|
+
if (tag !== 8) {
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
message.sequence = reader.int64() as bigint;
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1767
|
+
break;
|
|
1768
|
+
}
|
|
1769
|
+
reader.skip(tag & 7);
|
|
1770
|
+
}
|
|
1771
|
+
return message;
|
|
1772
|
+
},
|
|
1773
|
+
|
|
1774
|
+
fromJSON(object: any): GetTailResponse {
|
|
1775
|
+
return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
|
|
1776
|
+
},
|
|
1777
|
+
|
|
1778
|
+
toJSON(message: GetTailResponse): unknown {
|
|
1779
|
+
const obj: any = {};
|
|
1780
|
+
if (message.sequence !== 0n) {
|
|
1781
|
+
obj.sequence = message.sequence.toString();
|
|
1782
|
+
}
|
|
1783
|
+
return obj;
|
|
1784
|
+
},
|
|
1785
|
+
|
|
1786
|
+
create(base?: DeepPartial<GetTailResponse>): GetTailResponse {
|
|
1787
|
+
return GetTailResponse.fromPartial(base ?? {});
|
|
1788
|
+
},
|
|
1789
|
+
fromPartial(object: DeepPartial<GetTailResponse>): GetTailResponse {
|
|
1790
|
+
const message = createBaseGetTailResponse();
|
|
1791
|
+
message.sequence = object.sequence ?? 0n;
|
|
1792
|
+
return message;
|
|
1793
|
+
},
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
function createBaseGetTagsRequest(): GetTagsRequest {
|
|
1797
|
+
return { sequence: 0n };
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
export const GetTagsRequest: MessageFns<GetTagsRequest> = {
|
|
1801
|
+
encode(message: GetTagsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1802
|
+
if (message.sequence !== 0n) {
|
|
1803
|
+
if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
|
|
1804
|
+
throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
|
|
1805
|
+
}
|
|
1806
|
+
writer.uint32(8).int64(message.sequence);
|
|
1807
|
+
}
|
|
1808
|
+
return writer;
|
|
1809
|
+
},
|
|
1810
|
+
|
|
1811
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetTagsRequest {
|
|
1812
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1813
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1814
|
+
const message = createBaseGetTagsRequest();
|
|
1815
|
+
while (reader.pos < end) {
|
|
1816
|
+
const tag = reader.uint32();
|
|
1817
|
+
switch (tag >>> 3) {
|
|
1818
|
+
case 1: {
|
|
1819
|
+
if (tag !== 8) {
|
|
1820
|
+
break;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
message.sequence = reader.int64() as bigint;
|
|
1824
|
+
continue;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1828
|
+
break;
|
|
1829
|
+
}
|
|
1830
|
+
reader.skip(tag & 7);
|
|
1831
|
+
}
|
|
1832
|
+
return message;
|
|
1833
|
+
},
|
|
1834
|
+
|
|
1835
|
+
fromJSON(object: any): GetTagsRequest {
|
|
1836
|
+
return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
|
|
1837
|
+
},
|
|
1838
|
+
|
|
1839
|
+
toJSON(message: GetTagsRequest): unknown {
|
|
1840
|
+
const obj: any = {};
|
|
1841
|
+
if (message.sequence !== 0n) {
|
|
1842
|
+
obj.sequence = message.sequence.toString();
|
|
1843
|
+
}
|
|
1844
|
+
return obj;
|
|
1845
|
+
},
|
|
1846
|
+
|
|
1847
|
+
create(base?: DeepPartial<GetTagsRequest>): GetTagsRequest {
|
|
1848
|
+
return GetTagsRequest.fromPartial(base ?? {});
|
|
1849
|
+
},
|
|
1850
|
+
fromPartial(object: DeepPartial<GetTagsRequest>): GetTagsRequest {
|
|
1851
|
+
const message = createBaseGetTagsRequest();
|
|
1852
|
+
message.sequence = object.sequence ?? 0n;
|
|
1853
|
+
return message;
|
|
1854
|
+
},
|
|
1855
|
+
};
|
|
1856
|
+
|
|
1857
|
+
function createBaseGetTagsResponse(): GetTagsResponse {
|
|
1858
|
+
return { tags: [] };
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
export const GetTagsResponse: MessageFns<GetTagsResponse> = {
|
|
1862
|
+
encode(message: GetTagsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1863
|
+
for (const v of message.tags) {
|
|
1864
|
+
Tag.encode(v!, writer.uint32(10).fork()).join();
|
|
1865
|
+
}
|
|
1866
|
+
return writer;
|
|
1867
|
+
},
|
|
1868
|
+
|
|
1869
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetTagsResponse {
|
|
1870
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1871
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1872
|
+
const message = createBaseGetTagsResponse();
|
|
1873
|
+
while (reader.pos < end) {
|
|
1874
|
+
const tag = reader.uint32();
|
|
1875
|
+
switch (tag >>> 3) {
|
|
1876
|
+
case 1: {
|
|
1877
|
+
if (tag !== 10) {
|
|
1878
|
+
break;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
message.tags.push(Tag.decode(reader, reader.uint32()));
|
|
1882
|
+
continue;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
reader.skip(tag & 7);
|
|
1889
|
+
}
|
|
1890
|
+
return message;
|
|
1891
|
+
},
|
|
1892
|
+
|
|
1893
|
+
fromJSON(object: any): GetTagsResponse {
|
|
1894
|
+
return { tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e: any) => Tag.fromJSON(e)) : [] };
|
|
1895
|
+
},
|
|
1896
|
+
|
|
1897
|
+
toJSON(message: GetTagsResponse): unknown {
|
|
1898
|
+
const obj: any = {};
|
|
1899
|
+
if (message.tags?.length) {
|
|
1900
|
+
obj.tags = message.tags.map((e) => Tag.toJSON(e));
|
|
1901
|
+
}
|
|
1902
|
+
return obj;
|
|
1903
|
+
},
|
|
1904
|
+
|
|
1905
|
+
create(base?: DeepPartial<GetTagsResponse>): GetTagsResponse {
|
|
1906
|
+
return GetTagsResponse.fromPartial(base ?? {});
|
|
1907
|
+
},
|
|
1908
|
+
fromPartial(object: DeepPartial<GetTagsResponse>): GetTagsResponse {
|
|
1909
|
+
const message = createBaseGetTagsResponse();
|
|
1910
|
+
message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || [];
|
|
1911
|
+
return message;
|
|
1912
|
+
},
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
function createBaseGetSequenceAtRequest(): GetSequenceAtRequest {
|
|
1916
|
+
return { timestamp: 0n };
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
export const GetSequenceAtRequest: MessageFns<GetSequenceAtRequest> = {
|
|
1920
|
+
encode(message: GetSequenceAtRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1921
|
+
if (message.timestamp !== 0n) {
|
|
1922
|
+
if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
|
|
1923
|
+
throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
|
|
1924
|
+
}
|
|
1925
|
+
writer.uint32(8).int64(message.timestamp);
|
|
1926
|
+
}
|
|
1927
|
+
return writer;
|
|
1928
|
+
},
|
|
1929
|
+
|
|
1930
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetSequenceAtRequest {
|
|
1931
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1932
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1933
|
+
const message = createBaseGetSequenceAtRequest();
|
|
1934
|
+
while (reader.pos < end) {
|
|
1935
|
+
const tag = reader.uint32();
|
|
1936
|
+
switch (tag >>> 3) {
|
|
1937
|
+
case 1: {
|
|
1938
|
+
if (tag !== 8) {
|
|
1939
|
+
break;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
message.timestamp = reader.int64() as bigint;
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1947
|
+
break;
|
|
1948
|
+
}
|
|
1949
|
+
reader.skip(tag & 7);
|
|
1950
|
+
}
|
|
1951
|
+
return message;
|
|
1952
|
+
},
|
|
1953
|
+
|
|
1954
|
+
fromJSON(object: any): GetSequenceAtRequest {
|
|
1955
|
+
return { timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n };
|
|
1956
|
+
},
|
|
1957
|
+
|
|
1958
|
+
toJSON(message: GetSequenceAtRequest): unknown {
|
|
1959
|
+
const obj: any = {};
|
|
1960
|
+
if (message.timestamp !== 0n) {
|
|
1961
|
+
obj.timestamp = message.timestamp.toString();
|
|
1962
|
+
}
|
|
1963
|
+
return obj;
|
|
1964
|
+
},
|
|
1965
|
+
|
|
1966
|
+
create(base?: DeepPartial<GetSequenceAtRequest>): GetSequenceAtRequest {
|
|
1967
|
+
return GetSequenceAtRequest.fromPartial(base ?? {});
|
|
1968
|
+
},
|
|
1969
|
+
fromPartial(object: DeepPartial<GetSequenceAtRequest>): GetSequenceAtRequest {
|
|
1970
|
+
const message = createBaseGetSequenceAtRequest();
|
|
1971
|
+
message.timestamp = object.timestamp ?? 0n;
|
|
1972
|
+
return message;
|
|
1973
|
+
},
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
function createBaseGetSequenceAtResponse(): GetSequenceAtResponse {
|
|
1977
|
+
return { sequence: 0n };
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
export const GetSequenceAtResponse: MessageFns<GetSequenceAtResponse> = {
|
|
1981
|
+
encode(message: GetSequenceAtResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1982
|
+
if (message.sequence !== 0n) {
|
|
1983
|
+
if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
|
|
1984
|
+
throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
|
|
1985
|
+
}
|
|
1986
|
+
writer.uint32(8).int64(message.sequence);
|
|
1987
|
+
}
|
|
1988
|
+
return writer;
|
|
1989
|
+
},
|
|
1990
|
+
|
|
1991
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetSequenceAtResponse {
|
|
1992
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1993
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1994
|
+
const message = createBaseGetSequenceAtResponse();
|
|
1995
|
+
while (reader.pos < end) {
|
|
1996
|
+
const tag = reader.uint32();
|
|
1997
|
+
switch (tag >>> 3) {
|
|
1998
|
+
case 1: {
|
|
1999
|
+
if (tag !== 8) {
|
|
2000
|
+
break;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
message.sequence = reader.int64() as bigint;
|
|
2004
|
+
continue;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
reader.skip(tag & 7);
|
|
2011
|
+
}
|
|
2012
|
+
return message;
|
|
2013
|
+
},
|
|
2014
|
+
|
|
2015
|
+
fromJSON(object: any): GetSequenceAtResponse {
|
|
2016
|
+
return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
|
|
2017
|
+
},
|
|
2018
|
+
|
|
2019
|
+
toJSON(message: GetSequenceAtResponse): unknown {
|
|
2020
|
+
const obj: any = {};
|
|
2021
|
+
if (message.sequence !== 0n) {
|
|
2022
|
+
obj.sequence = message.sequence.toString();
|
|
2023
|
+
}
|
|
2024
|
+
return obj;
|
|
2025
|
+
},
|
|
2026
|
+
|
|
2027
|
+
create(base?: DeepPartial<GetSequenceAtResponse>): GetSequenceAtResponse {
|
|
2028
|
+
return GetSequenceAtResponse.fromPartial(base ?? {});
|
|
2029
|
+
},
|
|
2030
|
+
fromPartial(object: DeepPartial<GetSequenceAtResponse>): GetSequenceAtResponse {
|
|
2031
|
+
const message = createBaseGetSequenceAtResponse();
|
|
2032
|
+
message.sequence = object.sequence ?? 0n;
|
|
2033
|
+
return message;
|
|
2034
|
+
},
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
/** The Event Store service. */
|
|
2038
|
+
export type EventStoreDefinition = typeof EventStoreDefinition;
|
|
2039
|
+
export const EventStoreDefinition = {
|
|
2040
|
+
name: "EventStore",
|
|
2041
|
+
fullName: "kronosdb.eventstore.EventStore",
|
|
2042
|
+
methods: {
|
|
2043
|
+
/** Appends new events to the store. */
|
|
2044
|
+
append: {
|
|
2045
|
+
name: "Append",
|
|
2046
|
+
requestType: AppendRequest as typeof AppendRequest,
|
|
2047
|
+
requestStream: true,
|
|
2048
|
+
responseType: AppendResponse as typeof AppendResponse,
|
|
2049
|
+
responseStream: false,
|
|
2050
|
+
options: {},
|
|
2051
|
+
},
|
|
2052
|
+
/** Provides a finite stream of events matching the given criteria. */
|
|
2053
|
+
source: {
|
|
2054
|
+
name: "Source",
|
|
2055
|
+
requestType: SourceRequest as typeof SourceRequest,
|
|
2056
|
+
requestStream: false,
|
|
2057
|
+
responseType: SourceResponse as typeof SourceResponse,
|
|
2058
|
+
responseStream: true,
|
|
2059
|
+
options: {},
|
|
2060
|
+
},
|
|
2061
|
+
/**
|
|
2062
|
+
* Provides an infinite stream of events matching the given criteria.
|
|
2063
|
+
* Stays open and pushes new events as they are appended.
|
|
2064
|
+
* Bidirectional with permit-based flow control: the first client message
|
|
2065
|
+
* carries the criteria and initial permits. Subsequent messages grant
|
|
2066
|
+
* additional permits. The server only sends events when permits > 0.
|
|
2067
|
+
*/
|
|
2068
|
+
stream: {
|
|
2069
|
+
name: "Stream",
|
|
2070
|
+
requestType: StreamControl as typeof StreamControl,
|
|
2071
|
+
requestStream: true,
|
|
2072
|
+
responseType: StreamResponse as typeof StreamResponse,
|
|
2073
|
+
responseStream: true,
|
|
2074
|
+
options: {},
|
|
2075
|
+
},
|
|
2076
|
+
/** Gets the current head of the event store (next position to be assigned). */
|
|
2077
|
+
getHead: {
|
|
2078
|
+
name: "GetHead",
|
|
2079
|
+
requestType: GetHeadRequest as typeof GetHeadRequest,
|
|
2080
|
+
requestStream: false,
|
|
2081
|
+
responseType: GetHeadResponse as typeof GetHeadResponse,
|
|
2082
|
+
responseStream: false,
|
|
2083
|
+
options: {},
|
|
2084
|
+
},
|
|
2085
|
+
/** Gets the current tail of the event store (first event position). */
|
|
2086
|
+
getTail: {
|
|
2087
|
+
name: "GetTail",
|
|
2088
|
+
requestType: GetTailRequest as typeof GetTailRequest,
|
|
2089
|
+
requestStream: false,
|
|
2090
|
+
responseType: GetTailResponse as typeof GetTailResponse,
|
|
2091
|
+
responseStream: false,
|
|
2092
|
+
options: {},
|
|
2093
|
+
},
|
|
2094
|
+
/** Gets tags for an event by its sequence position. */
|
|
2095
|
+
getTags: {
|
|
2096
|
+
name: "GetTags",
|
|
2097
|
+
requestType: GetTagsRequest as typeof GetTagsRequest,
|
|
2098
|
+
requestStream: false,
|
|
2099
|
+
responseType: GetTagsResponse as typeof GetTagsResponse,
|
|
2100
|
+
responseStream: false,
|
|
2101
|
+
options: {},
|
|
2102
|
+
},
|
|
2103
|
+
/**
|
|
2104
|
+
* Gets the sequence number of the first event at or after the given timestamp.
|
|
2105
|
+
* Used by event processors to support time-based replay (e.g., Axon's tokenAt).
|
|
2106
|
+
*/
|
|
2107
|
+
getSequenceAt: {
|
|
2108
|
+
name: "GetSequenceAt",
|
|
2109
|
+
requestType: GetSequenceAtRequest as typeof GetSequenceAtRequest,
|
|
2110
|
+
requestStream: false,
|
|
2111
|
+
responseType: GetSequenceAtResponse as typeof GetSequenceAtResponse,
|
|
2112
|
+
responseStream: false,
|
|
2113
|
+
options: {},
|
|
2114
|
+
},
|
|
2115
|
+
},
|
|
2116
|
+
} as const;
|
|
2117
|
+
|
|
2118
|
+
export interface EventStoreServiceImplementation<CallContextExt = {}> {
|
|
2119
|
+
/** Appends new events to the store. */
|
|
2120
|
+
append(
|
|
2121
|
+
request: AsyncIterable<AppendRequest>,
|
|
2122
|
+
context: CallContext & CallContextExt,
|
|
2123
|
+
): Promise<DeepPartial<AppendResponse>>;
|
|
2124
|
+
/** Provides a finite stream of events matching the given criteria. */
|
|
2125
|
+
source(
|
|
2126
|
+
request: SourceRequest,
|
|
2127
|
+
context: CallContext & CallContextExt,
|
|
2128
|
+
): ServerStreamingMethodResult<DeepPartial<SourceResponse>>;
|
|
2129
|
+
/**
|
|
2130
|
+
* Provides an infinite stream of events matching the given criteria.
|
|
2131
|
+
* Stays open and pushes new events as they are appended.
|
|
2132
|
+
* Bidirectional with permit-based flow control: the first client message
|
|
2133
|
+
* carries the criteria and initial permits. Subsequent messages grant
|
|
2134
|
+
* additional permits. The server only sends events when permits > 0.
|
|
2135
|
+
*/
|
|
2136
|
+
stream(
|
|
2137
|
+
request: AsyncIterable<StreamControl>,
|
|
2138
|
+
context: CallContext & CallContextExt,
|
|
2139
|
+
): ServerStreamingMethodResult<DeepPartial<StreamResponse>>;
|
|
2140
|
+
/** Gets the current head of the event store (next position to be assigned). */
|
|
2141
|
+
getHead(request: GetHeadRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetHeadResponse>>;
|
|
2142
|
+
/** Gets the current tail of the event store (first event position). */
|
|
2143
|
+
getTail(request: GetTailRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetTailResponse>>;
|
|
2144
|
+
/** Gets tags for an event by its sequence position. */
|
|
2145
|
+
getTags(request: GetTagsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetTagsResponse>>;
|
|
2146
|
+
/**
|
|
2147
|
+
* Gets the sequence number of the first event at or after the given timestamp.
|
|
2148
|
+
* Used by event processors to support time-based replay (e.g., Axon's tokenAt).
|
|
2149
|
+
*/
|
|
2150
|
+
getSequenceAt(
|
|
2151
|
+
request: GetSequenceAtRequest,
|
|
2152
|
+
context: CallContext & CallContextExt,
|
|
2153
|
+
): Promise<DeepPartial<GetSequenceAtResponse>>;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
export interface EventStoreClient<CallOptionsExt = {}> {
|
|
2157
|
+
/** Appends new events to the store. */
|
|
2158
|
+
append(
|
|
2159
|
+
request: AsyncIterable<DeepPartial<AppendRequest>>,
|
|
2160
|
+
options?: CallOptions & CallOptionsExt,
|
|
2161
|
+
): Promise<AppendResponse>;
|
|
2162
|
+
/** Provides a finite stream of events matching the given criteria. */
|
|
2163
|
+
source(request: DeepPartial<SourceRequest>, options?: CallOptions & CallOptionsExt): AsyncIterable<SourceResponse>;
|
|
2164
|
+
/**
|
|
2165
|
+
* Provides an infinite stream of events matching the given criteria.
|
|
2166
|
+
* Stays open and pushes new events as they are appended.
|
|
2167
|
+
* Bidirectional with permit-based flow control: the first client message
|
|
2168
|
+
* carries the criteria and initial permits. Subsequent messages grant
|
|
2169
|
+
* additional permits. The server only sends events when permits > 0.
|
|
2170
|
+
*/
|
|
2171
|
+
stream(
|
|
2172
|
+
request: AsyncIterable<DeepPartial<StreamControl>>,
|
|
2173
|
+
options?: CallOptions & CallOptionsExt,
|
|
2174
|
+
): AsyncIterable<StreamResponse>;
|
|
2175
|
+
/** Gets the current head of the event store (next position to be assigned). */
|
|
2176
|
+
getHead(request: DeepPartial<GetHeadRequest>, options?: CallOptions & CallOptionsExt): Promise<GetHeadResponse>;
|
|
2177
|
+
/** Gets the current tail of the event store (first event position). */
|
|
2178
|
+
getTail(request: DeepPartial<GetTailRequest>, options?: CallOptions & CallOptionsExt): Promise<GetTailResponse>;
|
|
2179
|
+
/** Gets tags for an event by its sequence position. */
|
|
2180
|
+
getTags(request: DeepPartial<GetTagsRequest>, options?: CallOptions & CallOptionsExt): Promise<GetTagsResponse>;
|
|
2181
|
+
/**
|
|
2182
|
+
* Gets the sequence number of the first event at or after the given timestamp.
|
|
2183
|
+
* Used by event processors to support time-based replay (e.g., Axon's tokenAt).
|
|
2184
|
+
*/
|
|
2185
|
+
getSequenceAt(
|
|
2186
|
+
request: DeepPartial<GetSequenceAtRequest>,
|
|
2187
|
+
options?: CallOptions & CallOptionsExt,
|
|
2188
|
+
): Promise<GetSequenceAtResponse>;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
function bytesFromBase64(b64: string): Uint8Array {
|
|
2192
|
+
if ((globalThis as any).Buffer) {
|
|
2193
|
+
return Uint8Array.from((globalThis as any).Buffer.from(b64, "base64"));
|
|
2194
|
+
} else {
|
|
2195
|
+
const bin = globalThis.atob(b64);
|
|
2196
|
+
const arr = new Uint8Array(bin.length);
|
|
2197
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
2198
|
+
arr[i] = bin.charCodeAt(i);
|
|
2199
|
+
}
|
|
2200
|
+
return arr;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
function base64FromBytes(arr: Uint8Array): string {
|
|
2205
|
+
if ((globalThis as any).Buffer) {
|
|
2206
|
+
return (globalThis as any).Buffer.from(arr).toString("base64");
|
|
2207
|
+
} else {
|
|
2208
|
+
const bin: string[] = [];
|
|
2209
|
+
arr.forEach((byte) => {
|
|
2210
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
2211
|
+
});
|
|
2212
|
+
return globalThis.btoa(bin.join(""));
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
2217
|
+
|
|
2218
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
2219
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
2220
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
2221
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
2222
|
+
: Partial<T>;
|
|
2223
|
+
|
|
2224
|
+
function isObject(value: any): boolean {
|
|
2225
|
+
return typeof value === "object" && value !== null;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
function isSet(value: any): boolean {
|
|
2229
|
+
return value !== null && value !== undefined;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };
|
|
2233
|
+
|
|
2234
|
+
export interface MessageFns<T> {
|
|
2235
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
2236
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
2237
|
+
fromJSON(object: any): T;
|
|
2238
|
+
toJSON(message: T): unknown;
|
|
2239
|
+
create(base?: DeepPartial<T>): T;
|
|
2240
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
2241
|
+
}
|