@kronos-ts/axon-server 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.
Files changed (106) hide show
  1. package/dist/axon-server-event-store.d.ts +16 -0
  2. package/dist/axon-server-event-store.d.ts.map +1 -0
  3. package/dist/axon-server-event-store.js +282 -0
  4. package/dist/axon-server-event-store.js.map +1 -0
  5. package/dist/axon-server-snapshot-store.d.ts +12 -0
  6. package/dist/axon-server-snapshot-store.d.ts.map +1 -0
  7. package/dist/axon-server-snapshot-store.js +88 -0
  8. package/dist/axon-server-snapshot-store.js.map +1 -0
  9. package/dist/axon-server.d.ts +115 -0
  10. package/dist/axon-server.d.ts.map +1 -0
  11. package/dist/axon-server.js +986 -0
  12. package/dist/axon-server.js.map +1 -0
  13. package/dist/connection-manager.d.ts +49 -0
  14. package/dist/connection-manager.d.ts.map +1 -0
  15. package/dist/connection-manager.js +37 -0
  16. package/dist/connection-manager.js.map +1 -0
  17. package/dist/connection.d.ts +129 -0
  18. package/dist/connection.d.ts.map +1 -0
  19. package/dist/connection.js +130 -0
  20. package/dist/connection.js.map +1 -0
  21. package/dist/errors.d.ts +96 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/errors.js +189 -0
  24. package/dist/errors.js.map +1 -0
  25. package/dist/event-processor-info.d.ts +35 -0
  26. package/dist/event-processor-info.d.ts.map +1 -0
  27. package/dist/event-processor-info.js +28 -0
  28. package/dist/event-processor-info.js.map +1 -0
  29. package/dist/flow-controlled-sender.d.ts +30 -0
  30. package/dist/flow-controlled-sender.d.ts.map +1 -0
  31. package/dist/flow-controlled-sender.js +60 -0
  32. package/dist/flow-controlled-sender.js.map +1 -0
  33. package/dist/generated/command.d.ts +158 -0
  34. package/dist/generated/command.d.ts.map +1 -0
  35. package/dist/generated/command.js +970 -0
  36. package/dist/generated/command.js.map +1 -0
  37. package/dist/generated/common.d.ts +130 -0
  38. package/dist/generated/common.d.ts.map +1 -0
  39. package/dist/generated/common.js +908 -0
  40. package/dist/generated/common.js.map +1 -0
  41. package/dist/generated/control.d.ts +293 -0
  42. package/dist/generated/control.d.ts.map +1 -0
  43. package/dist/generated/control.js +1938 -0
  44. package/dist/generated/control.js.map +1 -0
  45. package/dist/generated/dcb.d.ts +650 -0
  46. package/dist/generated/dcb.d.ts.map +1 -0
  47. package/dist/generated/dcb.js +2943 -0
  48. package/dist/generated/dcb.js.map +1 -0
  49. package/dist/generated/event.d.ts +667 -0
  50. package/dist/generated/event.d.ts.map +1 -0
  51. package/dist/generated/event.js +3185 -0
  52. package/dist/generated/event.js.map +1 -0
  53. package/dist/generated/google/protobuf/empty.d.ts +30 -0
  54. package/dist/generated/google/protobuf/empty.d.ts.map +1 -0
  55. package/dist/generated/google/protobuf/empty.js +46 -0
  56. package/dist/generated/google/protobuf/empty.js.map +1 -0
  57. package/dist/generated/query.d.ts +300 -0
  58. package/dist/generated/query.d.ts.map +1 -0
  59. package/dist/generated/query.js +2183 -0
  60. package/dist/generated/query.js.map +1 -0
  61. package/dist/index.d.ts +12 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +12 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/message-size.d.ts +38 -0
  66. package/dist/message-size.d.ts.map +1 -0
  67. package/dist/message-size.js +57 -0
  68. package/dist/message-size.js.map +1 -0
  69. package/dist/metadata-conversion.d.ts +11 -0
  70. package/dist/metadata-conversion.d.ts.map +1 -0
  71. package/dist/metadata-conversion.js +51 -0
  72. package/dist/metadata-conversion.js.map +1 -0
  73. package/dist/outbound-stream.d.ts +15 -0
  74. package/dist/outbound-stream.d.ts.map +1 -0
  75. package/dist/outbound-stream.js +39 -0
  76. package/dist/outbound-stream.js.map +1 -0
  77. package/dist/platform-service.d.ts +119 -0
  78. package/dist/platform-service.d.ts.map +1 -0
  79. package/dist/platform-service.js +250 -0
  80. package/dist/platform-service.js.map +1 -0
  81. package/dist/shutdown-latch.d.ts +38 -0
  82. package/dist/shutdown-latch.d.ts.map +1 -0
  83. package/dist/shutdown-latch.js +51 -0
  84. package/dist/shutdown-latch.js.map +1 -0
  85. package/package.json +69 -0
  86. package/src/axon-server-event-store.ts +358 -0
  87. package/src/axon-server-snapshot-store.ts +118 -0
  88. package/src/axon-server.ts +1202 -0
  89. package/src/connection-manager.ts +88 -0
  90. package/src/connection.ts +272 -0
  91. package/src/errors.ts +223 -0
  92. package/src/event-processor-info.ts +62 -0
  93. package/src/flow-controlled-sender.ts +91 -0
  94. package/src/generated/command.ts +1231 -0
  95. package/src/generated/common.ts +1097 -0
  96. package/src/generated/control.ts +2419 -0
  97. package/src/generated/dcb.ts +3826 -0
  98. package/src/generated/event.ts +4076 -0
  99. package/src/generated/google/protobuf/empty.ts +84 -0
  100. package/src/generated/query.ts +2723 -0
  101. package/src/index.ts +75 -0
  102. package/src/message-size.ts +75 -0
  103. package/src/metadata-conversion.ts +46 -0
  104. package/src/outbound-stream.ts +52 -0
  105. package/src/platform-service.ts +361 -0
  106. package/src/shutdown-latch.ts +97 -0
@@ -0,0 +1,4076 @@
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: event.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+ import { InstructionAck, MetaDataValue, SerializedObject } from "./common.js";
11
+ import { Empty } from "./google/protobuf/empty.js";
12
+
13
+ export const protobufPackage = "io.axoniq.axonserver.grpc.event";
14
+
15
+ /** The state of the transformation. */
16
+ export enum TransformationState {
17
+ /** ACTIVE - The transformation is opened, able to receive request to transform events, or to be applied or cancelled. */
18
+ ACTIVE = 0,
19
+ /** CANCELLED - The transformation has been cancelled. This a final state. */
20
+ CANCELLED = 1,
21
+ /** APPLYING - The transformation is in progress of applying its actions to the event store. */
22
+ APPLYING = 2,
23
+ /** APPLIED - The transformation has been applied to the event store. This a final state. */
24
+ APPLIED = 3,
25
+ UNRECOGNIZED = -1,
26
+ }
27
+
28
+ export function transformationStateFromJSON(object: any): TransformationState {
29
+ switch (object) {
30
+ case 0:
31
+ case "ACTIVE":
32
+ return TransformationState.ACTIVE;
33
+ case 1:
34
+ case "CANCELLED":
35
+ return TransformationState.CANCELLED;
36
+ case 2:
37
+ case "APPLYING":
38
+ return TransformationState.APPLYING;
39
+ case 3:
40
+ case "APPLIED":
41
+ return TransformationState.APPLIED;
42
+ case -1:
43
+ case "UNRECOGNIZED":
44
+ default:
45
+ return TransformationState.UNRECOGNIZED;
46
+ }
47
+ }
48
+
49
+ export function transformationStateToJSON(object: TransformationState): string {
50
+ switch (object) {
51
+ case TransformationState.ACTIVE:
52
+ return "ACTIVE";
53
+ case TransformationState.CANCELLED:
54
+ return "CANCELLED";
55
+ case TransformationState.APPLYING:
56
+ return "APPLYING";
57
+ case TransformationState.APPLIED:
58
+ return "APPLIED";
59
+ case TransformationState.UNRECOGNIZED:
60
+ default:
61
+ return "UNRECOGNIZED";
62
+ }
63
+ }
64
+
65
+ /** Request to compact event store. */
66
+ export interface CompactionRequest {
67
+ }
68
+
69
+ /** The transformation data. */
70
+ export interface Transformation {
71
+ /** The identifier of the transformation. */
72
+ transformationId:
73
+ | TransformationId
74
+ | undefined;
75
+ /** The state of the transformation */
76
+ state: TransformationState;
77
+ /** The sequence of the last transformation action stored. Needed for checking sequential consistency of requests. */
78
+ sequence: bigint;
79
+ /** The bounded context in which this transformation is being executed. */
80
+ context: string;
81
+ /** The description of the transformation. */
82
+ description: string;
83
+ /** The timestamp at which the transformation was applied. Set to -1 if the transformation was not applied. */
84
+ appliedAt: bigint;
85
+ /** The username of user who requested the transformation to be applied. Empty if the transformation was not applied. */
86
+ applyRequester: string;
87
+ /** The version of the transformation. The sequence */
88
+ version: number;
89
+ }
90
+
91
+ /** Request to start a transformation */
92
+ export interface StartTransformationRequest {
93
+ /** A description of the purpose of this transformation, for reference only */
94
+ description: string;
95
+ }
96
+
97
+ /** Request to apply a transformation */
98
+ export interface ApplyTransformationRequest {
99
+ /** The identification of the transformation */
100
+ transformationId:
101
+ | TransformationId
102
+ | undefined;
103
+ /** The sequence of the last entry in this transformation */
104
+ lastSequence: bigint;
105
+ }
106
+
107
+ /** Message containing one event to transform within a transformation */
108
+ export interface TransformRequest {
109
+ /** The identification of the transformation */
110
+ transformationId:
111
+ | TransformationId
112
+ | undefined;
113
+ /** The sequence of the current transformation */
114
+ sequence: bigint;
115
+ /** Replaces the content of an event with the new content */
116
+ replaceEvent?:
117
+ | TransformedEvent
118
+ | undefined;
119
+ /** Deletes the content of an event */
120
+ deleteEvent?: DeletedEvent | undefined;
121
+ }
122
+
123
+ /** Replaces the content of an event with the new content */
124
+ export interface TransformedEvent {
125
+ /** The global index of the event to replace */
126
+ token: bigint;
127
+ /** The new content of the event */
128
+ event: Event | undefined;
129
+ }
130
+
131
+ /** Deletes the content of an event */
132
+ export interface DeletedEvent {
133
+ /** The global index of the event to clear */
134
+ token: bigint;
135
+ }
136
+
137
+ /** Uniquely identifies a transformation */
138
+ export interface TransformationId {
139
+ /** The value of the identifier. */
140
+ id: string;
141
+ }
142
+
143
+ /** Acknowledgement that event with given token has been transformed successfully */
144
+ export interface TransformRequestAck {
145
+ /** The sequence of the transformation request */
146
+ sequence: bigint;
147
+ }
148
+
149
+ /** Request message to schedule an event */
150
+ export interface ScheduleEventRequest {
151
+ /** timestamp when to publish the event */
152
+ instant: bigint;
153
+ /** the event to publish */
154
+ event: Event | undefined;
155
+ }
156
+
157
+ /** Request message to reschedule an event */
158
+ export interface RescheduleEventRequest {
159
+ /** optional token of scheduled event to cancel */
160
+ token: string;
161
+ /** timestamp when to publish the event */
162
+ instant: bigint;
163
+ /** the event to publish */
164
+ event: Event | undefined;
165
+ }
166
+
167
+ /** Request message to cancel an event */
168
+ export interface CancelScheduledEventRequest {
169
+ /** token of scheduled event to cancel */
170
+ token: string;
171
+ }
172
+
173
+ /** Token to manage a scheduled event */
174
+ export interface ScheduleToken {
175
+ /** Field defining the token identifier */
176
+ token: string;
177
+ }
178
+
179
+ /** Request message to receive the first Token (Tail Token) of the Event Stream */
180
+ export interface GetFirstTokenRequest {
181
+ }
182
+
183
+ /** Request message to receive the last Token (Head Token) of the Event Stream */
184
+ export interface GetLastTokenRequest {
185
+ }
186
+
187
+ /** Request message to receive the Token that starts streaming events from the given timestamp */
188
+ export interface GetTokenAtRequest {
189
+ /** Timestamp expressed as milliseconds since epoch */
190
+ instant: bigint;
191
+ }
192
+
193
+ /** Message containing the information necessary to track the position of events in the Event Stream */
194
+ export interface TrackingToken {
195
+ /** The value of the Token */
196
+ token: bigint;
197
+ }
198
+
199
+ /** Message wrapping an Event and a Tracking Token */
200
+ export interface EventWithToken {
201
+ /** The Token representing the position of this Event in the Stream */
202
+ token: bigint;
203
+ /** The actual Event Message */
204
+ event: Event | undefined;
205
+ }
206
+
207
+ /** Message providing the parameters for executing a Query against AxonServer. */
208
+ export interface QueryEventsRequest {
209
+ /** The query to execute against the Event Stream */
210
+ query: string;
211
+ /** The number of results AxonServer may send before new permits need to be provided */
212
+ numberOfPermits: bigint;
213
+ /** Whether to keep the query running against incoming events once the Head of the Stream is reached */
214
+ liveEvents: boolean;
215
+ /**
216
+ * Indicates whether to force querying events from the leader node of an Axon Server. Forcing reads from leader
217
+ * reduces the staleness of the data read, but also puts extra burden on the leader, reducing overall scalability.
218
+ * <p>
219
+ * This property has no effect on connections to AxonServer SE.
220
+ * </p>
221
+ */
222
+ forceReadFromLeader: boolean;
223
+ /** If true, snapshots will be queried instead of events */
224
+ querySnapshots: boolean;
225
+ /** Query from this context, not from the default context of the connection */
226
+ contextName: string;
227
+ }
228
+
229
+ /** A message describing a response to a Query request */
230
+ export interface QueryEventsResponse {
231
+ /** Provided when the response contains the names of the columns the response contains. This message typically arrives first. */
232
+ columns?:
233
+ | ColumnsResponse
234
+ | undefined;
235
+ /** Provided when the response message contains results of the Query */
236
+ row?:
237
+ | RowResponse
238
+ | undefined;
239
+ /** Provided when all historic events have been included in the query results */
240
+ filesCompleted?: Confirmation | undefined;
241
+ }
242
+
243
+ /** Message containing the names of the columns returned in a Query */
244
+ export interface ColumnsResponse {
245
+ /** The names of the columns provided in the query */
246
+ column: string[];
247
+ }
248
+
249
+ /** Message providing Query Result data */
250
+ export interface RowResponse {
251
+ /** The values which, when combined, uniquely update this row. Any previously received values with the same identifiers should be replaced with this value */
252
+ idValues: QueryValue[];
253
+ /** The sorting values to use when sorting this response compared to the others. */
254
+ sortValues: QueryValue[];
255
+ /** The actual data values for each of the columns, as a column name -> value mapping */
256
+ values: { [key: string]: QueryValue };
257
+ }
258
+
259
+ export interface RowResponse_ValuesEntry {
260
+ key: string;
261
+ value: QueryValue | undefined;
262
+ }
263
+
264
+ /** Describes the combination of an Aggregate Identifier and first expected Sequence number when opening an Aggregate-specific Event Stream */
265
+ export interface ReadHighestSequenceNrRequest {
266
+ /** The Identifier of the Aggregate for which to load events */
267
+ aggregateId: string;
268
+ /** The Sequence Number of the first event expected */
269
+ fromSequenceNr: bigint;
270
+ }
271
+
272
+ /** The highest Sequence Number found for the provided request */
273
+ export interface ReadHighestSequenceNrResponse {
274
+ /** The sequence number of the latest event */
275
+ toSequenceNr: bigint;
276
+ }
277
+
278
+ /** A confirmation to a request from the client */
279
+ export interface Confirmation {
280
+ /** True when successful, otherwise false */
281
+ success: boolean;
282
+ }
283
+
284
+ /**
285
+ * A confirmation to a request from the client, including an optional consistency marker to track the position of this confirmation in the Event Stream.
286
+ * The consistency_marker is only set for AppendEvent requests towards a DCB context.
287
+ */
288
+ export interface ConfirmationWithConsistencyMarker {
289
+ /** True when successful, otherwise false */
290
+ success: boolean;
291
+ /** The consistency marker token */
292
+ consistencyMarker: ConsistencyMarker | undefined;
293
+ }
294
+
295
+ /** A marker to track the position of a Confirmation in the Event Stream, used for consistency tracking in DCB contexts */
296
+ export interface ConsistencyMarker {
297
+ /** The token representing the position of this marker in the Stream */
298
+ token: bigint;
299
+ }
300
+
301
+ /** Request describing the desire to read events for a specific Aggregate */
302
+ export interface GetAggregateEventsRequest {
303
+ /** The identifier of the aggregate to read events for */
304
+ aggregateId: string;
305
+ /** The sequence number of the first event to receive */
306
+ initialSequence: bigint;
307
+ /** Whether a snapshot may be returned as first element in the stream */
308
+ allowSnapshots: boolean;
309
+ /** The maximum sequence number (inclusive) of the events to retrieve, 0 means up to last event */
310
+ maxSequence: bigint;
311
+ /** Hint for a minimum token to search events from */
312
+ minToken: bigint;
313
+ }
314
+
315
+ /** Request message to retrieve Snapshot Events for a specific Aggregate instance */
316
+ export interface GetAggregateSnapshotsRequest {
317
+ /** The identifier to fetch the snapshots for */
318
+ aggregateId: string;
319
+ /** The minimal sequence number of the snapshots to retrieve */
320
+ initialSequence: bigint;
321
+ /** The maximum sequence number of the snapshots to retrieve */
322
+ maxSequence: bigint;
323
+ /** The maximum number of results to stream */
324
+ maxResults: number;
325
+ }
326
+
327
+ /** Request message to open an Event Stream from the Event Store. */
328
+ export interface GetEventsRequest {
329
+ /** The token to start streaming from */
330
+ trackingToken: bigint;
331
+ /** The number of messages the server may send before it needs to wait for more permits */
332
+ numberOfPermits: bigint;
333
+ /** The unique identifier of this client instance. Used for monitoring. */
334
+ clientId: string;
335
+ /** The component name of this client instance. Used for monitoring. */
336
+ componentName: string;
337
+ /** The name of the processor requesting this stream. Used for monitoring. */
338
+ processor: string;
339
+ /**
340
+ * An enumeration of payload types that need to be blacklisted. The Server will stop sending messages of these
341
+ * types in order to reduce I/O. Note that the Server may occasionally send a blacklisted message to prevent
342
+ * time-outs and stale tokens on clients.
343
+ */
344
+ blacklist: PayloadDescription[];
345
+ /**
346
+ * Indicates whether to force reading events from the leader node of an Axon Server. Forcing reads from leader
347
+ * reduces the staleness of the data read, but also puts extra burden on the leader, reducing overall scalability.
348
+ * <p>
349
+ * This property has no effect on connections to AxonServer SE.
350
+ * </p>
351
+ */
352
+ forceReadFromLeader: boolean;
353
+ }
354
+
355
+ /** Message containing the information of an Event */
356
+ export interface Event {
357
+ /** The unique identifier of this event */
358
+ messageIdentifier: string;
359
+ /** The identifier of the Aggregate instance that published this event, if any */
360
+ aggregateIdentifier: string;
361
+ /** The sequence number of the Event in the Aggregate instance that published it, if any */
362
+ aggregateSequenceNumber: bigint;
363
+ /** The Type of the Aggregate instance that published this Event, if any */
364
+ aggregateType: string;
365
+ /** The timestamp of the Event */
366
+ timestamp: bigint;
367
+ /** The Payload of the Event */
368
+ payload:
369
+ | SerializedObject
370
+ | undefined;
371
+ /** The Meta Data of the Event */
372
+ metaData: { [key: string]: MetaDataValue };
373
+ /** Flag indicating whether the Event is a snapshot Event */
374
+ snapshot: boolean;
375
+ }
376
+
377
+ export interface Event_MetaDataEntry {
378
+ key: string;
379
+ value: MetaDataValue | undefined;
380
+ }
381
+
382
+ /** Value used in Query Responses to represent a value in its original type */
383
+ export interface QueryValue {
384
+ /** The text value */
385
+ textValue?:
386
+ | string
387
+ | undefined;
388
+ /** The (64 bits) integer value */
389
+ numberValue?:
390
+ | bigint
391
+ | undefined;
392
+ /** The boolean value */
393
+ booleanValue?:
394
+ | boolean
395
+ | undefined;
396
+ /** The (64 bits) floating point value */
397
+ doubleValue?: number | undefined;
398
+ }
399
+
400
+ /** Description of a Payload Type */
401
+ export interface PayloadDescription {
402
+ /** The type identifier of the Payload */
403
+ type: string;
404
+ /** The revision of the Payload Type */
405
+ revision: string;
406
+ }
407
+
408
+ function createBaseCompactionRequest(): CompactionRequest {
409
+ return {};
410
+ }
411
+
412
+ export const CompactionRequest: MessageFns<CompactionRequest> = {
413
+ encode(_: CompactionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
414
+ return writer;
415
+ },
416
+
417
+ decode(input: BinaryReader | Uint8Array, length?: number): CompactionRequest {
418
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
419
+ const end = length === undefined ? reader.len : reader.pos + length;
420
+ const message = createBaseCompactionRequest();
421
+ while (reader.pos < end) {
422
+ const tag = reader.uint32();
423
+ switch (tag >>> 3) {
424
+ }
425
+ if ((tag & 7) === 4 || tag === 0) {
426
+ break;
427
+ }
428
+ reader.skip(tag & 7);
429
+ }
430
+ return message;
431
+ },
432
+
433
+ fromJSON(_: any): CompactionRequest {
434
+ return {};
435
+ },
436
+
437
+ toJSON(_: CompactionRequest): unknown {
438
+ const obj: any = {};
439
+ return obj;
440
+ },
441
+
442
+ create(base?: DeepPartial<CompactionRequest>): CompactionRequest {
443
+ return CompactionRequest.fromPartial(base ?? {});
444
+ },
445
+ fromPartial(_: DeepPartial<CompactionRequest>): CompactionRequest {
446
+ const message = createBaseCompactionRequest();
447
+ return message;
448
+ },
449
+ };
450
+
451
+ function createBaseTransformation(): Transformation {
452
+ return {
453
+ transformationId: undefined,
454
+ state: 0,
455
+ sequence: 0n,
456
+ context: "",
457
+ description: "",
458
+ appliedAt: 0n,
459
+ applyRequester: "",
460
+ version: 0,
461
+ };
462
+ }
463
+
464
+ export const Transformation: MessageFns<Transformation> = {
465
+ encode(message: Transformation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
466
+ if (message.transformationId !== undefined) {
467
+ TransformationId.encode(message.transformationId, writer.uint32(10).fork()).join();
468
+ }
469
+ if (message.state !== 0) {
470
+ writer.uint32(16).int32(message.state);
471
+ }
472
+ if (message.sequence !== 0n) {
473
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
474
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
475
+ }
476
+ writer.uint32(24).int64(message.sequence);
477
+ }
478
+ if (message.context !== "") {
479
+ writer.uint32(34).string(message.context);
480
+ }
481
+ if (message.description !== "") {
482
+ writer.uint32(42).string(message.description);
483
+ }
484
+ if (message.appliedAt !== 0n) {
485
+ if (BigInt.asIntN(64, message.appliedAt) !== message.appliedAt) {
486
+ throw new globalThis.Error("value provided for field message.appliedAt of type int64 too large");
487
+ }
488
+ writer.uint32(48).int64(message.appliedAt);
489
+ }
490
+ if (message.applyRequester !== "") {
491
+ writer.uint32(58).string(message.applyRequester);
492
+ }
493
+ if (message.version !== 0) {
494
+ writer.uint32(64).int32(message.version);
495
+ }
496
+ return writer;
497
+ },
498
+
499
+ decode(input: BinaryReader | Uint8Array, length?: number): Transformation {
500
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
501
+ const end = length === undefined ? reader.len : reader.pos + length;
502
+ const message = createBaseTransformation();
503
+ while (reader.pos < end) {
504
+ const tag = reader.uint32();
505
+ switch (tag >>> 3) {
506
+ case 1: {
507
+ if (tag !== 10) {
508
+ break;
509
+ }
510
+
511
+ message.transformationId = TransformationId.decode(reader, reader.uint32());
512
+ continue;
513
+ }
514
+ case 2: {
515
+ if (tag !== 16) {
516
+ break;
517
+ }
518
+
519
+ message.state = reader.int32() as any;
520
+ continue;
521
+ }
522
+ case 3: {
523
+ if (tag !== 24) {
524
+ break;
525
+ }
526
+
527
+ message.sequence = reader.int64() as bigint;
528
+ continue;
529
+ }
530
+ case 4: {
531
+ if (tag !== 34) {
532
+ break;
533
+ }
534
+
535
+ message.context = reader.string();
536
+ continue;
537
+ }
538
+ case 5: {
539
+ if (tag !== 42) {
540
+ break;
541
+ }
542
+
543
+ message.description = reader.string();
544
+ continue;
545
+ }
546
+ case 6: {
547
+ if (tag !== 48) {
548
+ break;
549
+ }
550
+
551
+ message.appliedAt = reader.int64() as bigint;
552
+ continue;
553
+ }
554
+ case 7: {
555
+ if (tag !== 58) {
556
+ break;
557
+ }
558
+
559
+ message.applyRequester = reader.string();
560
+ continue;
561
+ }
562
+ case 8: {
563
+ if (tag !== 64) {
564
+ break;
565
+ }
566
+
567
+ message.version = reader.int32();
568
+ continue;
569
+ }
570
+ }
571
+ if ((tag & 7) === 4 || tag === 0) {
572
+ break;
573
+ }
574
+ reader.skip(tag & 7);
575
+ }
576
+ return message;
577
+ },
578
+
579
+ fromJSON(object: any): Transformation {
580
+ return {
581
+ transformationId: isSet(object.transformationId) ? TransformationId.fromJSON(object.transformationId) : undefined,
582
+ state: isSet(object.state) ? transformationStateFromJSON(object.state) : 0,
583
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
584
+ context: isSet(object.context) ? globalThis.String(object.context) : "",
585
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
586
+ appliedAt: isSet(object.appliedAt)
587
+ ? BigInt(object.appliedAt)
588
+ : isSet(object.applied_at)
589
+ ? BigInt(object.applied_at)
590
+ : 0n,
591
+ applyRequester: isSet(object.applyRequester)
592
+ ? globalThis.String(object.applyRequester)
593
+ : isSet(object.apply_requester)
594
+ ? globalThis.String(object.apply_requester)
595
+ : "",
596
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
597
+ };
598
+ },
599
+
600
+ toJSON(message: Transformation): unknown {
601
+ const obj: any = {};
602
+ if (message.transformationId !== undefined) {
603
+ obj.transformationId = TransformationId.toJSON(message.transformationId);
604
+ }
605
+ if (message.state !== 0) {
606
+ obj.state = transformationStateToJSON(message.state);
607
+ }
608
+ if (message.sequence !== 0n) {
609
+ obj.sequence = message.sequence.toString();
610
+ }
611
+ if (message.context !== "") {
612
+ obj.context = message.context;
613
+ }
614
+ if (message.description !== "") {
615
+ obj.description = message.description;
616
+ }
617
+ if (message.appliedAt !== 0n) {
618
+ obj.appliedAt = message.appliedAt.toString();
619
+ }
620
+ if (message.applyRequester !== "") {
621
+ obj.applyRequester = message.applyRequester;
622
+ }
623
+ if (message.version !== 0) {
624
+ obj.version = Math.round(message.version);
625
+ }
626
+ return obj;
627
+ },
628
+
629
+ create(base?: DeepPartial<Transformation>): Transformation {
630
+ return Transformation.fromPartial(base ?? {});
631
+ },
632
+ fromPartial(object: DeepPartial<Transformation>): Transformation {
633
+ const message = createBaseTransformation();
634
+ message.transformationId = (object.transformationId !== undefined && object.transformationId !== null)
635
+ ? TransformationId.fromPartial(object.transformationId)
636
+ : undefined;
637
+ message.state = object.state ?? 0;
638
+ message.sequence = object.sequence ?? 0n;
639
+ message.context = object.context ?? "";
640
+ message.description = object.description ?? "";
641
+ message.appliedAt = object.appliedAt ?? 0n;
642
+ message.applyRequester = object.applyRequester ?? "";
643
+ message.version = object.version ?? 0;
644
+ return message;
645
+ },
646
+ };
647
+
648
+ function createBaseStartTransformationRequest(): StartTransformationRequest {
649
+ return { description: "" };
650
+ }
651
+
652
+ export const StartTransformationRequest: MessageFns<StartTransformationRequest> = {
653
+ encode(message: StartTransformationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
654
+ if (message.description !== "") {
655
+ writer.uint32(10).string(message.description);
656
+ }
657
+ return writer;
658
+ },
659
+
660
+ decode(input: BinaryReader | Uint8Array, length?: number): StartTransformationRequest {
661
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
662
+ const end = length === undefined ? reader.len : reader.pos + length;
663
+ const message = createBaseStartTransformationRequest();
664
+ while (reader.pos < end) {
665
+ const tag = reader.uint32();
666
+ switch (tag >>> 3) {
667
+ case 1: {
668
+ if (tag !== 10) {
669
+ break;
670
+ }
671
+
672
+ message.description = reader.string();
673
+ continue;
674
+ }
675
+ }
676
+ if ((tag & 7) === 4 || tag === 0) {
677
+ break;
678
+ }
679
+ reader.skip(tag & 7);
680
+ }
681
+ return message;
682
+ },
683
+
684
+ fromJSON(object: any): StartTransformationRequest {
685
+ return { description: isSet(object.description) ? globalThis.String(object.description) : "" };
686
+ },
687
+
688
+ toJSON(message: StartTransformationRequest): unknown {
689
+ const obj: any = {};
690
+ if (message.description !== "") {
691
+ obj.description = message.description;
692
+ }
693
+ return obj;
694
+ },
695
+
696
+ create(base?: DeepPartial<StartTransformationRequest>): StartTransformationRequest {
697
+ return StartTransformationRequest.fromPartial(base ?? {});
698
+ },
699
+ fromPartial(object: DeepPartial<StartTransformationRequest>): StartTransformationRequest {
700
+ const message = createBaseStartTransformationRequest();
701
+ message.description = object.description ?? "";
702
+ return message;
703
+ },
704
+ };
705
+
706
+ function createBaseApplyTransformationRequest(): ApplyTransformationRequest {
707
+ return { transformationId: undefined, lastSequence: 0n };
708
+ }
709
+
710
+ export const ApplyTransformationRequest: MessageFns<ApplyTransformationRequest> = {
711
+ encode(message: ApplyTransformationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
712
+ if (message.transformationId !== undefined) {
713
+ TransformationId.encode(message.transformationId, writer.uint32(10).fork()).join();
714
+ }
715
+ if (message.lastSequence !== 0n) {
716
+ if (BigInt.asIntN(64, message.lastSequence) !== message.lastSequence) {
717
+ throw new globalThis.Error("value provided for field message.lastSequence of type int64 too large");
718
+ }
719
+ writer.uint32(16).int64(message.lastSequence);
720
+ }
721
+ return writer;
722
+ },
723
+
724
+ decode(input: BinaryReader | Uint8Array, length?: number): ApplyTransformationRequest {
725
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
726
+ const end = length === undefined ? reader.len : reader.pos + length;
727
+ const message = createBaseApplyTransformationRequest();
728
+ while (reader.pos < end) {
729
+ const tag = reader.uint32();
730
+ switch (tag >>> 3) {
731
+ case 1: {
732
+ if (tag !== 10) {
733
+ break;
734
+ }
735
+
736
+ message.transformationId = TransformationId.decode(reader, reader.uint32());
737
+ continue;
738
+ }
739
+ case 2: {
740
+ if (tag !== 16) {
741
+ break;
742
+ }
743
+
744
+ message.lastSequence = reader.int64() as bigint;
745
+ continue;
746
+ }
747
+ }
748
+ if ((tag & 7) === 4 || tag === 0) {
749
+ break;
750
+ }
751
+ reader.skip(tag & 7);
752
+ }
753
+ return message;
754
+ },
755
+
756
+ fromJSON(object: any): ApplyTransformationRequest {
757
+ return {
758
+ transformationId: isSet(object.transformationId)
759
+ ? TransformationId.fromJSON(object.transformationId)
760
+ : isSet(object.transformation_id)
761
+ ? TransformationId.fromJSON(object.transformation_id)
762
+ : undefined,
763
+ lastSequence: isSet(object.lastSequence)
764
+ ? BigInt(object.lastSequence)
765
+ : isSet(object.last_sequence)
766
+ ? BigInt(object.last_sequence)
767
+ : 0n,
768
+ };
769
+ },
770
+
771
+ toJSON(message: ApplyTransformationRequest): unknown {
772
+ const obj: any = {};
773
+ if (message.transformationId !== undefined) {
774
+ obj.transformationId = TransformationId.toJSON(message.transformationId);
775
+ }
776
+ if (message.lastSequence !== 0n) {
777
+ obj.lastSequence = message.lastSequence.toString();
778
+ }
779
+ return obj;
780
+ },
781
+
782
+ create(base?: DeepPartial<ApplyTransformationRequest>): ApplyTransformationRequest {
783
+ return ApplyTransformationRequest.fromPartial(base ?? {});
784
+ },
785
+ fromPartial(object: DeepPartial<ApplyTransformationRequest>): ApplyTransformationRequest {
786
+ const message = createBaseApplyTransformationRequest();
787
+ message.transformationId = (object.transformationId !== undefined && object.transformationId !== null)
788
+ ? TransformationId.fromPartial(object.transformationId)
789
+ : undefined;
790
+ message.lastSequence = object.lastSequence ?? 0n;
791
+ return message;
792
+ },
793
+ };
794
+
795
+ function createBaseTransformRequest(): TransformRequest {
796
+ return { transformationId: undefined, sequence: 0n, replaceEvent: undefined, deleteEvent: undefined };
797
+ }
798
+
799
+ export const TransformRequest: MessageFns<TransformRequest> = {
800
+ encode(message: TransformRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
801
+ if (message.transformationId !== undefined) {
802
+ TransformationId.encode(message.transformationId, writer.uint32(10).fork()).join();
803
+ }
804
+ if (message.sequence !== 0n) {
805
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
806
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
807
+ }
808
+ writer.uint32(16).int64(message.sequence);
809
+ }
810
+ if (message.replaceEvent !== undefined) {
811
+ TransformedEvent.encode(message.replaceEvent, writer.uint32(26).fork()).join();
812
+ }
813
+ if (message.deleteEvent !== undefined) {
814
+ DeletedEvent.encode(message.deleteEvent, writer.uint32(34).fork()).join();
815
+ }
816
+ return writer;
817
+ },
818
+
819
+ decode(input: BinaryReader | Uint8Array, length?: number): TransformRequest {
820
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
821
+ const end = length === undefined ? reader.len : reader.pos + length;
822
+ const message = createBaseTransformRequest();
823
+ while (reader.pos < end) {
824
+ const tag = reader.uint32();
825
+ switch (tag >>> 3) {
826
+ case 1: {
827
+ if (tag !== 10) {
828
+ break;
829
+ }
830
+
831
+ message.transformationId = TransformationId.decode(reader, reader.uint32());
832
+ continue;
833
+ }
834
+ case 2: {
835
+ if (tag !== 16) {
836
+ break;
837
+ }
838
+
839
+ message.sequence = reader.int64() as bigint;
840
+ continue;
841
+ }
842
+ case 3: {
843
+ if (tag !== 26) {
844
+ break;
845
+ }
846
+
847
+ message.replaceEvent = TransformedEvent.decode(reader, reader.uint32());
848
+ continue;
849
+ }
850
+ case 4: {
851
+ if (tag !== 34) {
852
+ break;
853
+ }
854
+
855
+ message.deleteEvent = DeletedEvent.decode(reader, reader.uint32());
856
+ continue;
857
+ }
858
+ }
859
+ if ((tag & 7) === 4 || tag === 0) {
860
+ break;
861
+ }
862
+ reader.skip(tag & 7);
863
+ }
864
+ return message;
865
+ },
866
+
867
+ fromJSON(object: any): TransformRequest {
868
+ return {
869
+ transformationId: isSet(object.transformationId)
870
+ ? TransformationId.fromJSON(object.transformationId)
871
+ : isSet(object.transformation_id)
872
+ ? TransformationId.fromJSON(object.transformation_id)
873
+ : undefined,
874
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
875
+ replaceEvent: isSet(object.replaceEvent)
876
+ ? TransformedEvent.fromJSON(object.replaceEvent)
877
+ : isSet(object.replace_event)
878
+ ? TransformedEvent.fromJSON(object.replace_event)
879
+ : undefined,
880
+ deleteEvent: isSet(object.deleteEvent)
881
+ ? DeletedEvent.fromJSON(object.deleteEvent)
882
+ : isSet(object.delete_event)
883
+ ? DeletedEvent.fromJSON(object.delete_event)
884
+ : undefined,
885
+ };
886
+ },
887
+
888
+ toJSON(message: TransformRequest): unknown {
889
+ const obj: any = {};
890
+ if (message.transformationId !== undefined) {
891
+ obj.transformationId = TransformationId.toJSON(message.transformationId);
892
+ }
893
+ if (message.sequence !== 0n) {
894
+ obj.sequence = message.sequence.toString();
895
+ }
896
+ if (message.replaceEvent !== undefined) {
897
+ obj.replaceEvent = TransformedEvent.toJSON(message.replaceEvent);
898
+ }
899
+ if (message.deleteEvent !== undefined) {
900
+ obj.deleteEvent = DeletedEvent.toJSON(message.deleteEvent);
901
+ }
902
+ return obj;
903
+ },
904
+
905
+ create(base?: DeepPartial<TransformRequest>): TransformRequest {
906
+ return TransformRequest.fromPartial(base ?? {});
907
+ },
908
+ fromPartial(object: DeepPartial<TransformRequest>): TransformRequest {
909
+ const message = createBaseTransformRequest();
910
+ message.transformationId = (object.transformationId !== undefined && object.transformationId !== null)
911
+ ? TransformationId.fromPartial(object.transformationId)
912
+ : undefined;
913
+ message.sequence = object.sequence ?? 0n;
914
+ message.replaceEvent = (object.replaceEvent !== undefined && object.replaceEvent !== null)
915
+ ? TransformedEvent.fromPartial(object.replaceEvent)
916
+ : undefined;
917
+ message.deleteEvent = (object.deleteEvent !== undefined && object.deleteEvent !== null)
918
+ ? DeletedEvent.fromPartial(object.deleteEvent)
919
+ : undefined;
920
+ return message;
921
+ },
922
+ };
923
+
924
+ function createBaseTransformedEvent(): TransformedEvent {
925
+ return { token: 0n, event: undefined };
926
+ }
927
+
928
+ export const TransformedEvent: MessageFns<TransformedEvent> = {
929
+ encode(message: TransformedEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
930
+ if (message.token !== 0n) {
931
+ if (BigInt.asIntN(64, message.token) !== message.token) {
932
+ throw new globalThis.Error("value provided for field message.token of type int64 too large");
933
+ }
934
+ writer.uint32(8).int64(message.token);
935
+ }
936
+ if (message.event !== undefined) {
937
+ Event.encode(message.event, writer.uint32(18).fork()).join();
938
+ }
939
+ return writer;
940
+ },
941
+
942
+ decode(input: BinaryReader | Uint8Array, length?: number): TransformedEvent {
943
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
944
+ const end = length === undefined ? reader.len : reader.pos + length;
945
+ const message = createBaseTransformedEvent();
946
+ while (reader.pos < end) {
947
+ const tag = reader.uint32();
948
+ switch (tag >>> 3) {
949
+ case 1: {
950
+ if (tag !== 8) {
951
+ break;
952
+ }
953
+
954
+ message.token = reader.int64() as bigint;
955
+ continue;
956
+ }
957
+ case 2: {
958
+ if (tag !== 18) {
959
+ break;
960
+ }
961
+
962
+ message.event = Event.decode(reader, reader.uint32());
963
+ continue;
964
+ }
965
+ }
966
+ if ((tag & 7) === 4 || tag === 0) {
967
+ break;
968
+ }
969
+ reader.skip(tag & 7);
970
+ }
971
+ return message;
972
+ },
973
+
974
+ fromJSON(object: any): TransformedEvent {
975
+ return {
976
+ token: isSet(object.token) ? BigInt(object.token) : 0n,
977
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
978
+ };
979
+ },
980
+
981
+ toJSON(message: TransformedEvent): unknown {
982
+ const obj: any = {};
983
+ if (message.token !== 0n) {
984
+ obj.token = message.token.toString();
985
+ }
986
+ if (message.event !== undefined) {
987
+ obj.event = Event.toJSON(message.event);
988
+ }
989
+ return obj;
990
+ },
991
+
992
+ create(base?: DeepPartial<TransformedEvent>): TransformedEvent {
993
+ return TransformedEvent.fromPartial(base ?? {});
994
+ },
995
+ fromPartial(object: DeepPartial<TransformedEvent>): TransformedEvent {
996
+ const message = createBaseTransformedEvent();
997
+ message.token = object.token ?? 0n;
998
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
999
+ return message;
1000
+ },
1001
+ };
1002
+
1003
+ function createBaseDeletedEvent(): DeletedEvent {
1004
+ return { token: 0n };
1005
+ }
1006
+
1007
+ export const DeletedEvent: MessageFns<DeletedEvent> = {
1008
+ encode(message: DeletedEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1009
+ if (message.token !== 0n) {
1010
+ if (BigInt.asIntN(64, message.token) !== message.token) {
1011
+ throw new globalThis.Error("value provided for field message.token of type int64 too large");
1012
+ }
1013
+ writer.uint32(8).int64(message.token);
1014
+ }
1015
+ return writer;
1016
+ },
1017
+
1018
+ decode(input: BinaryReader | Uint8Array, length?: number): DeletedEvent {
1019
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1020
+ const end = length === undefined ? reader.len : reader.pos + length;
1021
+ const message = createBaseDeletedEvent();
1022
+ while (reader.pos < end) {
1023
+ const tag = reader.uint32();
1024
+ switch (tag >>> 3) {
1025
+ case 1: {
1026
+ if (tag !== 8) {
1027
+ break;
1028
+ }
1029
+
1030
+ message.token = reader.int64() as bigint;
1031
+ continue;
1032
+ }
1033
+ }
1034
+ if ((tag & 7) === 4 || tag === 0) {
1035
+ break;
1036
+ }
1037
+ reader.skip(tag & 7);
1038
+ }
1039
+ return message;
1040
+ },
1041
+
1042
+ fromJSON(object: any): DeletedEvent {
1043
+ return { token: isSet(object.token) ? BigInt(object.token) : 0n };
1044
+ },
1045
+
1046
+ toJSON(message: DeletedEvent): unknown {
1047
+ const obj: any = {};
1048
+ if (message.token !== 0n) {
1049
+ obj.token = message.token.toString();
1050
+ }
1051
+ return obj;
1052
+ },
1053
+
1054
+ create(base?: DeepPartial<DeletedEvent>): DeletedEvent {
1055
+ return DeletedEvent.fromPartial(base ?? {});
1056
+ },
1057
+ fromPartial(object: DeepPartial<DeletedEvent>): DeletedEvent {
1058
+ const message = createBaseDeletedEvent();
1059
+ message.token = object.token ?? 0n;
1060
+ return message;
1061
+ },
1062
+ };
1063
+
1064
+ function createBaseTransformationId(): TransformationId {
1065
+ return { id: "" };
1066
+ }
1067
+
1068
+ export const TransformationId: MessageFns<TransformationId> = {
1069
+ encode(message: TransformationId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1070
+ if (message.id !== "") {
1071
+ writer.uint32(10).string(message.id);
1072
+ }
1073
+ return writer;
1074
+ },
1075
+
1076
+ decode(input: BinaryReader | Uint8Array, length?: number): TransformationId {
1077
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1078
+ const end = length === undefined ? reader.len : reader.pos + length;
1079
+ const message = createBaseTransformationId();
1080
+ while (reader.pos < end) {
1081
+ const tag = reader.uint32();
1082
+ switch (tag >>> 3) {
1083
+ case 1: {
1084
+ if (tag !== 10) {
1085
+ break;
1086
+ }
1087
+
1088
+ message.id = reader.string();
1089
+ continue;
1090
+ }
1091
+ }
1092
+ if ((tag & 7) === 4 || tag === 0) {
1093
+ break;
1094
+ }
1095
+ reader.skip(tag & 7);
1096
+ }
1097
+ return message;
1098
+ },
1099
+
1100
+ fromJSON(object: any): TransformationId {
1101
+ return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
1102
+ },
1103
+
1104
+ toJSON(message: TransformationId): unknown {
1105
+ const obj: any = {};
1106
+ if (message.id !== "") {
1107
+ obj.id = message.id;
1108
+ }
1109
+ return obj;
1110
+ },
1111
+
1112
+ create(base?: DeepPartial<TransformationId>): TransformationId {
1113
+ return TransformationId.fromPartial(base ?? {});
1114
+ },
1115
+ fromPartial(object: DeepPartial<TransformationId>): TransformationId {
1116
+ const message = createBaseTransformationId();
1117
+ message.id = object.id ?? "";
1118
+ return message;
1119
+ },
1120
+ };
1121
+
1122
+ function createBaseTransformRequestAck(): TransformRequestAck {
1123
+ return { sequence: 0n };
1124
+ }
1125
+
1126
+ export const TransformRequestAck: MessageFns<TransformRequestAck> = {
1127
+ encode(message: TransformRequestAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1128
+ if (message.sequence !== 0n) {
1129
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1130
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1131
+ }
1132
+ writer.uint32(8).int64(message.sequence);
1133
+ }
1134
+ return writer;
1135
+ },
1136
+
1137
+ decode(input: BinaryReader | Uint8Array, length?: number): TransformRequestAck {
1138
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1139
+ const end = length === undefined ? reader.len : reader.pos + length;
1140
+ const message = createBaseTransformRequestAck();
1141
+ while (reader.pos < end) {
1142
+ const tag = reader.uint32();
1143
+ switch (tag >>> 3) {
1144
+ case 1: {
1145
+ if (tag !== 8) {
1146
+ break;
1147
+ }
1148
+
1149
+ message.sequence = 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): TransformRequestAck {
1162
+ return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
1163
+ },
1164
+
1165
+ toJSON(message: TransformRequestAck): unknown {
1166
+ const obj: any = {};
1167
+ if (message.sequence !== 0n) {
1168
+ obj.sequence = message.sequence.toString();
1169
+ }
1170
+ return obj;
1171
+ },
1172
+
1173
+ create(base?: DeepPartial<TransformRequestAck>): TransformRequestAck {
1174
+ return TransformRequestAck.fromPartial(base ?? {});
1175
+ },
1176
+ fromPartial(object: DeepPartial<TransformRequestAck>): TransformRequestAck {
1177
+ const message = createBaseTransformRequestAck();
1178
+ message.sequence = object.sequence ?? 0n;
1179
+ return message;
1180
+ },
1181
+ };
1182
+
1183
+ function createBaseScheduleEventRequest(): ScheduleEventRequest {
1184
+ return { instant: 0n, event: undefined };
1185
+ }
1186
+
1187
+ export const ScheduleEventRequest: MessageFns<ScheduleEventRequest> = {
1188
+ encode(message: ScheduleEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1189
+ if (message.instant !== 0n) {
1190
+ if (BigInt.asIntN(64, message.instant) !== message.instant) {
1191
+ throw new globalThis.Error("value provided for field message.instant of type int64 too large");
1192
+ }
1193
+ writer.uint32(8).int64(message.instant);
1194
+ }
1195
+ if (message.event !== undefined) {
1196
+ Event.encode(message.event, writer.uint32(18).fork()).join();
1197
+ }
1198
+ return writer;
1199
+ },
1200
+
1201
+ decode(input: BinaryReader | Uint8Array, length?: number): ScheduleEventRequest {
1202
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1203
+ const end = length === undefined ? reader.len : reader.pos + length;
1204
+ const message = createBaseScheduleEventRequest();
1205
+ while (reader.pos < end) {
1206
+ const tag = reader.uint32();
1207
+ switch (tag >>> 3) {
1208
+ case 1: {
1209
+ if (tag !== 8) {
1210
+ break;
1211
+ }
1212
+
1213
+ message.instant = reader.int64() as bigint;
1214
+ continue;
1215
+ }
1216
+ case 2: {
1217
+ if (tag !== 18) {
1218
+ break;
1219
+ }
1220
+
1221
+ message.event = Event.decode(reader, reader.uint32());
1222
+ continue;
1223
+ }
1224
+ }
1225
+ if ((tag & 7) === 4 || tag === 0) {
1226
+ break;
1227
+ }
1228
+ reader.skip(tag & 7);
1229
+ }
1230
+ return message;
1231
+ },
1232
+
1233
+ fromJSON(object: any): ScheduleEventRequest {
1234
+ return {
1235
+ instant: isSet(object.instant) ? BigInt(object.instant) : 0n,
1236
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
1237
+ };
1238
+ },
1239
+
1240
+ toJSON(message: ScheduleEventRequest): unknown {
1241
+ const obj: any = {};
1242
+ if (message.instant !== 0n) {
1243
+ obj.instant = message.instant.toString();
1244
+ }
1245
+ if (message.event !== undefined) {
1246
+ obj.event = Event.toJSON(message.event);
1247
+ }
1248
+ return obj;
1249
+ },
1250
+
1251
+ create(base?: DeepPartial<ScheduleEventRequest>): ScheduleEventRequest {
1252
+ return ScheduleEventRequest.fromPartial(base ?? {});
1253
+ },
1254
+ fromPartial(object: DeepPartial<ScheduleEventRequest>): ScheduleEventRequest {
1255
+ const message = createBaseScheduleEventRequest();
1256
+ message.instant = object.instant ?? 0n;
1257
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
1258
+ return message;
1259
+ },
1260
+ };
1261
+
1262
+ function createBaseRescheduleEventRequest(): RescheduleEventRequest {
1263
+ return { token: "", instant: 0n, event: undefined };
1264
+ }
1265
+
1266
+ export const RescheduleEventRequest: MessageFns<RescheduleEventRequest> = {
1267
+ encode(message: RescheduleEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1268
+ if (message.token !== "") {
1269
+ writer.uint32(10).string(message.token);
1270
+ }
1271
+ if (message.instant !== 0n) {
1272
+ if (BigInt.asIntN(64, message.instant) !== message.instant) {
1273
+ throw new globalThis.Error("value provided for field message.instant of type int64 too large");
1274
+ }
1275
+ writer.uint32(16).int64(message.instant);
1276
+ }
1277
+ if (message.event !== undefined) {
1278
+ Event.encode(message.event, writer.uint32(26).fork()).join();
1279
+ }
1280
+ return writer;
1281
+ },
1282
+
1283
+ decode(input: BinaryReader | Uint8Array, length?: number): RescheduleEventRequest {
1284
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1285
+ const end = length === undefined ? reader.len : reader.pos + length;
1286
+ const message = createBaseRescheduleEventRequest();
1287
+ while (reader.pos < end) {
1288
+ const tag = reader.uint32();
1289
+ switch (tag >>> 3) {
1290
+ case 1: {
1291
+ if (tag !== 10) {
1292
+ break;
1293
+ }
1294
+
1295
+ message.token = reader.string();
1296
+ continue;
1297
+ }
1298
+ case 2: {
1299
+ if (tag !== 16) {
1300
+ break;
1301
+ }
1302
+
1303
+ message.instant = reader.int64() as bigint;
1304
+ continue;
1305
+ }
1306
+ case 3: {
1307
+ if (tag !== 26) {
1308
+ break;
1309
+ }
1310
+
1311
+ message.event = Event.decode(reader, reader.uint32());
1312
+ continue;
1313
+ }
1314
+ }
1315
+ if ((tag & 7) === 4 || tag === 0) {
1316
+ break;
1317
+ }
1318
+ reader.skip(tag & 7);
1319
+ }
1320
+ return message;
1321
+ },
1322
+
1323
+ fromJSON(object: any): RescheduleEventRequest {
1324
+ return {
1325
+ token: isSet(object.token) ? globalThis.String(object.token) : "",
1326
+ instant: isSet(object.instant) ? BigInt(object.instant) : 0n,
1327
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
1328
+ };
1329
+ },
1330
+
1331
+ toJSON(message: RescheduleEventRequest): unknown {
1332
+ const obj: any = {};
1333
+ if (message.token !== "") {
1334
+ obj.token = message.token;
1335
+ }
1336
+ if (message.instant !== 0n) {
1337
+ obj.instant = message.instant.toString();
1338
+ }
1339
+ if (message.event !== undefined) {
1340
+ obj.event = Event.toJSON(message.event);
1341
+ }
1342
+ return obj;
1343
+ },
1344
+
1345
+ create(base?: DeepPartial<RescheduleEventRequest>): RescheduleEventRequest {
1346
+ return RescheduleEventRequest.fromPartial(base ?? {});
1347
+ },
1348
+ fromPartial(object: DeepPartial<RescheduleEventRequest>): RescheduleEventRequest {
1349
+ const message = createBaseRescheduleEventRequest();
1350
+ message.token = object.token ?? "";
1351
+ message.instant = object.instant ?? 0n;
1352
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
1353
+ return message;
1354
+ },
1355
+ };
1356
+
1357
+ function createBaseCancelScheduledEventRequest(): CancelScheduledEventRequest {
1358
+ return { token: "" };
1359
+ }
1360
+
1361
+ export const CancelScheduledEventRequest: MessageFns<CancelScheduledEventRequest> = {
1362
+ encode(message: CancelScheduledEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1363
+ if (message.token !== "") {
1364
+ writer.uint32(10).string(message.token);
1365
+ }
1366
+ return writer;
1367
+ },
1368
+
1369
+ decode(input: BinaryReader | Uint8Array, length?: number): CancelScheduledEventRequest {
1370
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1371
+ const end = length === undefined ? reader.len : reader.pos + length;
1372
+ const message = createBaseCancelScheduledEventRequest();
1373
+ while (reader.pos < end) {
1374
+ const tag = reader.uint32();
1375
+ switch (tag >>> 3) {
1376
+ case 1: {
1377
+ if (tag !== 10) {
1378
+ break;
1379
+ }
1380
+
1381
+ message.token = reader.string();
1382
+ continue;
1383
+ }
1384
+ }
1385
+ if ((tag & 7) === 4 || tag === 0) {
1386
+ break;
1387
+ }
1388
+ reader.skip(tag & 7);
1389
+ }
1390
+ return message;
1391
+ },
1392
+
1393
+ fromJSON(object: any): CancelScheduledEventRequest {
1394
+ return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
1395
+ },
1396
+
1397
+ toJSON(message: CancelScheduledEventRequest): unknown {
1398
+ const obj: any = {};
1399
+ if (message.token !== "") {
1400
+ obj.token = message.token;
1401
+ }
1402
+ return obj;
1403
+ },
1404
+
1405
+ create(base?: DeepPartial<CancelScheduledEventRequest>): CancelScheduledEventRequest {
1406
+ return CancelScheduledEventRequest.fromPartial(base ?? {});
1407
+ },
1408
+ fromPartial(object: DeepPartial<CancelScheduledEventRequest>): CancelScheduledEventRequest {
1409
+ const message = createBaseCancelScheduledEventRequest();
1410
+ message.token = object.token ?? "";
1411
+ return message;
1412
+ },
1413
+ };
1414
+
1415
+ function createBaseScheduleToken(): ScheduleToken {
1416
+ return { token: "" };
1417
+ }
1418
+
1419
+ export const ScheduleToken: MessageFns<ScheduleToken> = {
1420
+ encode(message: ScheduleToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1421
+ if (message.token !== "") {
1422
+ writer.uint32(10).string(message.token);
1423
+ }
1424
+ return writer;
1425
+ },
1426
+
1427
+ decode(input: BinaryReader | Uint8Array, length?: number): ScheduleToken {
1428
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1429
+ const end = length === undefined ? reader.len : reader.pos + length;
1430
+ const message = createBaseScheduleToken();
1431
+ while (reader.pos < end) {
1432
+ const tag = reader.uint32();
1433
+ switch (tag >>> 3) {
1434
+ case 1: {
1435
+ if (tag !== 10) {
1436
+ break;
1437
+ }
1438
+
1439
+ message.token = reader.string();
1440
+ continue;
1441
+ }
1442
+ }
1443
+ if ((tag & 7) === 4 || tag === 0) {
1444
+ break;
1445
+ }
1446
+ reader.skip(tag & 7);
1447
+ }
1448
+ return message;
1449
+ },
1450
+
1451
+ fromJSON(object: any): ScheduleToken {
1452
+ return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
1453
+ },
1454
+
1455
+ toJSON(message: ScheduleToken): unknown {
1456
+ const obj: any = {};
1457
+ if (message.token !== "") {
1458
+ obj.token = message.token;
1459
+ }
1460
+ return obj;
1461
+ },
1462
+
1463
+ create(base?: DeepPartial<ScheduleToken>): ScheduleToken {
1464
+ return ScheduleToken.fromPartial(base ?? {});
1465
+ },
1466
+ fromPartial(object: DeepPartial<ScheduleToken>): ScheduleToken {
1467
+ const message = createBaseScheduleToken();
1468
+ message.token = object.token ?? "";
1469
+ return message;
1470
+ },
1471
+ };
1472
+
1473
+ function createBaseGetFirstTokenRequest(): GetFirstTokenRequest {
1474
+ return {};
1475
+ }
1476
+
1477
+ export const GetFirstTokenRequest: MessageFns<GetFirstTokenRequest> = {
1478
+ encode(_: GetFirstTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1479
+ return writer;
1480
+ },
1481
+
1482
+ decode(input: BinaryReader | Uint8Array, length?: number): GetFirstTokenRequest {
1483
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1484
+ const end = length === undefined ? reader.len : reader.pos + length;
1485
+ const message = createBaseGetFirstTokenRequest();
1486
+ while (reader.pos < end) {
1487
+ const tag = reader.uint32();
1488
+ switch (tag >>> 3) {
1489
+ }
1490
+ if ((tag & 7) === 4 || tag === 0) {
1491
+ break;
1492
+ }
1493
+ reader.skip(tag & 7);
1494
+ }
1495
+ return message;
1496
+ },
1497
+
1498
+ fromJSON(_: any): GetFirstTokenRequest {
1499
+ return {};
1500
+ },
1501
+
1502
+ toJSON(_: GetFirstTokenRequest): unknown {
1503
+ const obj: any = {};
1504
+ return obj;
1505
+ },
1506
+
1507
+ create(base?: DeepPartial<GetFirstTokenRequest>): GetFirstTokenRequest {
1508
+ return GetFirstTokenRequest.fromPartial(base ?? {});
1509
+ },
1510
+ fromPartial(_: DeepPartial<GetFirstTokenRequest>): GetFirstTokenRequest {
1511
+ const message = createBaseGetFirstTokenRequest();
1512
+ return message;
1513
+ },
1514
+ };
1515
+
1516
+ function createBaseGetLastTokenRequest(): GetLastTokenRequest {
1517
+ return {};
1518
+ }
1519
+
1520
+ export const GetLastTokenRequest: MessageFns<GetLastTokenRequest> = {
1521
+ encode(_: GetLastTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1522
+ return writer;
1523
+ },
1524
+
1525
+ decode(input: BinaryReader | Uint8Array, length?: number): GetLastTokenRequest {
1526
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1527
+ const end = length === undefined ? reader.len : reader.pos + length;
1528
+ const message = createBaseGetLastTokenRequest();
1529
+ while (reader.pos < end) {
1530
+ const tag = reader.uint32();
1531
+ switch (tag >>> 3) {
1532
+ }
1533
+ if ((tag & 7) === 4 || tag === 0) {
1534
+ break;
1535
+ }
1536
+ reader.skip(tag & 7);
1537
+ }
1538
+ return message;
1539
+ },
1540
+
1541
+ fromJSON(_: any): GetLastTokenRequest {
1542
+ return {};
1543
+ },
1544
+
1545
+ toJSON(_: GetLastTokenRequest): unknown {
1546
+ const obj: any = {};
1547
+ return obj;
1548
+ },
1549
+
1550
+ create(base?: DeepPartial<GetLastTokenRequest>): GetLastTokenRequest {
1551
+ return GetLastTokenRequest.fromPartial(base ?? {});
1552
+ },
1553
+ fromPartial(_: DeepPartial<GetLastTokenRequest>): GetLastTokenRequest {
1554
+ const message = createBaseGetLastTokenRequest();
1555
+ return message;
1556
+ },
1557
+ };
1558
+
1559
+ function createBaseGetTokenAtRequest(): GetTokenAtRequest {
1560
+ return { instant: 0n };
1561
+ }
1562
+
1563
+ export const GetTokenAtRequest: MessageFns<GetTokenAtRequest> = {
1564
+ encode(message: GetTokenAtRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1565
+ if (message.instant !== 0n) {
1566
+ if (BigInt.asIntN(64, message.instant) !== message.instant) {
1567
+ throw new globalThis.Error("value provided for field message.instant of type int64 too large");
1568
+ }
1569
+ writer.uint32(8).int64(message.instant);
1570
+ }
1571
+ return writer;
1572
+ },
1573
+
1574
+ decode(input: BinaryReader | Uint8Array, length?: number): GetTokenAtRequest {
1575
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1576
+ const end = length === undefined ? reader.len : reader.pos + length;
1577
+ const message = createBaseGetTokenAtRequest();
1578
+ while (reader.pos < end) {
1579
+ const tag = reader.uint32();
1580
+ switch (tag >>> 3) {
1581
+ case 1: {
1582
+ if (tag !== 8) {
1583
+ break;
1584
+ }
1585
+
1586
+ message.instant = reader.int64() as bigint;
1587
+ continue;
1588
+ }
1589
+ }
1590
+ if ((tag & 7) === 4 || tag === 0) {
1591
+ break;
1592
+ }
1593
+ reader.skip(tag & 7);
1594
+ }
1595
+ return message;
1596
+ },
1597
+
1598
+ fromJSON(object: any): GetTokenAtRequest {
1599
+ return { instant: isSet(object.instant) ? BigInt(object.instant) : 0n };
1600
+ },
1601
+
1602
+ toJSON(message: GetTokenAtRequest): unknown {
1603
+ const obj: any = {};
1604
+ if (message.instant !== 0n) {
1605
+ obj.instant = message.instant.toString();
1606
+ }
1607
+ return obj;
1608
+ },
1609
+
1610
+ create(base?: DeepPartial<GetTokenAtRequest>): GetTokenAtRequest {
1611
+ return GetTokenAtRequest.fromPartial(base ?? {});
1612
+ },
1613
+ fromPartial(object: DeepPartial<GetTokenAtRequest>): GetTokenAtRequest {
1614
+ const message = createBaseGetTokenAtRequest();
1615
+ message.instant = object.instant ?? 0n;
1616
+ return message;
1617
+ },
1618
+ };
1619
+
1620
+ function createBaseTrackingToken(): TrackingToken {
1621
+ return { token: 0n };
1622
+ }
1623
+
1624
+ export const TrackingToken: MessageFns<TrackingToken> = {
1625
+ encode(message: TrackingToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1626
+ if (message.token !== 0n) {
1627
+ if (BigInt.asIntN(64, message.token) !== message.token) {
1628
+ throw new globalThis.Error("value provided for field message.token of type int64 too large");
1629
+ }
1630
+ writer.uint32(8).int64(message.token);
1631
+ }
1632
+ return writer;
1633
+ },
1634
+
1635
+ decode(input: BinaryReader | Uint8Array, length?: number): TrackingToken {
1636
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1637
+ const end = length === undefined ? reader.len : reader.pos + length;
1638
+ const message = createBaseTrackingToken();
1639
+ while (reader.pos < end) {
1640
+ const tag = reader.uint32();
1641
+ switch (tag >>> 3) {
1642
+ case 1: {
1643
+ if (tag !== 8) {
1644
+ break;
1645
+ }
1646
+
1647
+ message.token = reader.int64() as bigint;
1648
+ continue;
1649
+ }
1650
+ }
1651
+ if ((tag & 7) === 4 || tag === 0) {
1652
+ break;
1653
+ }
1654
+ reader.skip(tag & 7);
1655
+ }
1656
+ return message;
1657
+ },
1658
+
1659
+ fromJSON(object: any): TrackingToken {
1660
+ return { token: isSet(object.token) ? BigInt(object.token) : 0n };
1661
+ },
1662
+
1663
+ toJSON(message: TrackingToken): unknown {
1664
+ const obj: any = {};
1665
+ if (message.token !== 0n) {
1666
+ obj.token = message.token.toString();
1667
+ }
1668
+ return obj;
1669
+ },
1670
+
1671
+ create(base?: DeepPartial<TrackingToken>): TrackingToken {
1672
+ return TrackingToken.fromPartial(base ?? {});
1673
+ },
1674
+ fromPartial(object: DeepPartial<TrackingToken>): TrackingToken {
1675
+ const message = createBaseTrackingToken();
1676
+ message.token = object.token ?? 0n;
1677
+ return message;
1678
+ },
1679
+ };
1680
+
1681
+ function createBaseEventWithToken(): EventWithToken {
1682
+ return { token: 0n, event: undefined };
1683
+ }
1684
+
1685
+ export const EventWithToken: MessageFns<EventWithToken> = {
1686
+ encode(message: EventWithToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1687
+ if (message.token !== 0n) {
1688
+ if (BigInt.asIntN(64, message.token) !== message.token) {
1689
+ throw new globalThis.Error("value provided for field message.token of type int64 too large");
1690
+ }
1691
+ writer.uint32(8).int64(message.token);
1692
+ }
1693
+ if (message.event !== undefined) {
1694
+ Event.encode(message.event, writer.uint32(18).fork()).join();
1695
+ }
1696
+ return writer;
1697
+ },
1698
+
1699
+ decode(input: BinaryReader | Uint8Array, length?: number): EventWithToken {
1700
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1701
+ const end = length === undefined ? reader.len : reader.pos + length;
1702
+ const message = createBaseEventWithToken();
1703
+ while (reader.pos < end) {
1704
+ const tag = reader.uint32();
1705
+ switch (tag >>> 3) {
1706
+ case 1: {
1707
+ if (tag !== 8) {
1708
+ break;
1709
+ }
1710
+
1711
+ message.token = reader.int64() as bigint;
1712
+ continue;
1713
+ }
1714
+ case 2: {
1715
+ if (tag !== 18) {
1716
+ break;
1717
+ }
1718
+
1719
+ message.event = Event.decode(reader, reader.uint32());
1720
+ continue;
1721
+ }
1722
+ }
1723
+ if ((tag & 7) === 4 || tag === 0) {
1724
+ break;
1725
+ }
1726
+ reader.skip(tag & 7);
1727
+ }
1728
+ return message;
1729
+ },
1730
+
1731
+ fromJSON(object: any): EventWithToken {
1732
+ return {
1733
+ token: isSet(object.token) ? BigInt(object.token) : 0n,
1734
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
1735
+ };
1736
+ },
1737
+
1738
+ toJSON(message: EventWithToken): unknown {
1739
+ const obj: any = {};
1740
+ if (message.token !== 0n) {
1741
+ obj.token = message.token.toString();
1742
+ }
1743
+ if (message.event !== undefined) {
1744
+ obj.event = Event.toJSON(message.event);
1745
+ }
1746
+ return obj;
1747
+ },
1748
+
1749
+ create(base?: DeepPartial<EventWithToken>): EventWithToken {
1750
+ return EventWithToken.fromPartial(base ?? {});
1751
+ },
1752
+ fromPartial(object: DeepPartial<EventWithToken>): EventWithToken {
1753
+ const message = createBaseEventWithToken();
1754
+ message.token = object.token ?? 0n;
1755
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
1756
+ return message;
1757
+ },
1758
+ };
1759
+
1760
+ function createBaseQueryEventsRequest(): QueryEventsRequest {
1761
+ return {
1762
+ query: "",
1763
+ numberOfPermits: 0n,
1764
+ liveEvents: false,
1765
+ forceReadFromLeader: false,
1766
+ querySnapshots: false,
1767
+ contextName: "",
1768
+ };
1769
+ }
1770
+
1771
+ export const QueryEventsRequest: MessageFns<QueryEventsRequest> = {
1772
+ encode(message: QueryEventsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1773
+ if (message.query !== "") {
1774
+ writer.uint32(10).string(message.query);
1775
+ }
1776
+ if (message.numberOfPermits !== 0n) {
1777
+ if (BigInt.asIntN(64, message.numberOfPermits) !== message.numberOfPermits) {
1778
+ throw new globalThis.Error("value provided for field message.numberOfPermits of type int64 too large");
1779
+ }
1780
+ writer.uint32(16).int64(message.numberOfPermits);
1781
+ }
1782
+ if (message.liveEvents !== false) {
1783
+ writer.uint32(24).bool(message.liveEvents);
1784
+ }
1785
+ if (message.forceReadFromLeader !== false) {
1786
+ writer.uint32(32).bool(message.forceReadFromLeader);
1787
+ }
1788
+ if (message.querySnapshots !== false) {
1789
+ writer.uint32(40).bool(message.querySnapshots);
1790
+ }
1791
+ if (message.contextName !== "") {
1792
+ writer.uint32(50).string(message.contextName);
1793
+ }
1794
+ return writer;
1795
+ },
1796
+
1797
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryEventsRequest {
1798
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1799
+ const end = length === undefined ? reader.len : reader.pos + length;
1800
+ const message = createBaseQueryEventsRequest();
1801
+ while (reader.pos < end) {
1802
+ const tag = reader.uint32();
1803
+ switch (tag >>> 3) {
1804
+ case 1: {
1805
+ if (tag !== 10) {
1806
+ break;
1807
+ }
1808
+
1809
+ message.query = reader.string();
1810
+ continue;
1811
+ }
1812
+ case 2: {
1813
+ if (tag !== 16) {
1814
+ break;
1815
+ }
1816
+
1817
+ message.numberOfPermits = reader.int64() as bigint;
1818
+ continue;
1819
+ }
1820
+ case 3: {
1821
+ if (tag !== 24) {
1822
+ break;
1823
+ }
1824
+
1825
+ message.liveEvents = reader.bool();
1826
+ continue;
1827
+ }
1828
+ case 4: {
1829
+ if (tag !== 32) {
1830
+ break;
1831
+ }
1832
+
1833
+ message.forceReadFromLeader = reader.bool();
1834
+ continue;
1835
+ }
1836
+ case 5: {
1837
+ if (tag !== 40) {
1838
+ break;
1839
+ }
1840
+
1841
+ message.querySnapshots = reader.bool();
1842
+ continue;
1843
+ }
1844
+ case 6: {
1845
+ if (tag !== 50) {
1846
+ break;
1847
+ }
1848
+
1849
+ message.contextName = reader.string();
1850
+ continue;
1851
+ }
1852
+ }
1853
+ if ((tag & 7) === 4 || tag === 0) {
1854
+ break;
1855
+ }
1856
+ reader.skip(tag & 7);
1857
+ }
1858
+ return message;
1859
+ },
1860
+
1861
+ fromJSON(object: any): QueryEventsRequest {
1862
+ return {
1863
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
1864
+ numberOfPermits: isSet(object.numberOfPermits)
1865
+ ? BigInt(object.numberOfPermits)
1866
+ : isSet(object.number_of_permits)
1867
+ ? BigInt(object.number_of_permits)
1868
+ : 0n,
1869
+ liveEvents: isSet(object.liveEvents)
1870
+ ? globalThis.Boolean(object.liveEvents)
1871
+ : isSet(object.live_events)
1872
+ ? globalThis.Boolean(object.live_events)
1873
+ : false,
1874
+ forceReadFromLeader: isSet(object.forceReadFromLeader)
1875
+ ? globalThis.Boolean(object.forceReadFromLeader)
1876
+ : isSet(object.force_read_from_leader)
1877
+ ? globalThis.Boolean(object.force_read_from_leader)
1878
+ : false,
1879
+ querySnapshots: isSet(object.querySnapshots)
1880
+ ? globalThis.Boolean(object.querySnapshots)
1881
+ : isSet(object.query_snapshots)
1882
+ ? globalThis.Boolean(object.query_snapshots)
1883
+ : false,
1884
+ contextName: isSet(object.contextName)
1885
+ ? globalThis.String(object.contextName)
1886
+ : isSet(object.context_name)
1887
+ ? globalThis.String(object.context_name)
1888
+ : "",
1889
+ };
1890
+ },
1891
+
1892
+ toJSON(message: QueryEventsRequest): unknown {
1893
+ const obj: any = {};
1894
+ if (message.query !== "") {
1895
+ obj.query = message.query;
1896
+ }
1897
+ if (message.numberOfPermits !== 0n) {
1898
+ obj.numberOfPermits = message.numberOfPermits.toString();
1899
+ }
1900
+ if (message.liveEvents !== false) {
1901
+ obj.liveEvents = message.liveEvents;
1902
+ }
1903
+ if (message.forceReadFromLeader !== false) {
1904
+ obj.forceReadFromLeader = message.forceReadFromLeader;
1905
+ }
1906
+ if (message.querySnapshots !== false) {
1907
+ obj.querySnapshots = message.querySnapshots;
1908
+ }
1909
+ if (message.contextName !== "") {
1910
+ obj.contextName = message.contextName;
1911
+ }
1912
+ return obj;
1913
+ },
1914
+
1915
+ create(base?: DeepPartial<QueryEventsRequest>): QueryEventsRequest {
1916
+ return QueryEventsRequest.fromPartial(base ?? {});
1917
+ },
1918
+ fromPartial(object: DeepPartial<QueryEventsRequest>): QueryEventsRequest {
1919
+ const message = createBaseQueryEventsRequest();
1920
+ message.query = object.query ?? "";
1921
+ message.numberOfPermits = object.numberOfPermits ?? 0n;
1922
+ message.liveEvents = object.liveEvents ?? false;
1923
+ message.forceReadFromLeader = object.forceReadFromLeader ?? false;
1924
+ message.querySnapshots = object.querySnapshots ?? false;
1925
+ message.contextName = object.contextName ?? "";
1926
+ return message;
1927
+ },
1928
+ };
1929
+
1930
+ function createBaseQueryEventsResponse(): QueryEventsResponse {
1931
+ return { columns: undefined, row: undefined, filesCompleted: undefined };
1932
+ }
1933
+
1934
+ export const QueryEventsResponse: MessageFns<QueryEventsResponse> = {
1935
+ encode(message: QueryEventsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1936
+ if (message.columns !== undefined) {
1937
+ ColumnsResponse.encode(message.columns, writer.uint32(10).fork()).join();
1938
+ }
1939
+ if (message.row !== undefined) {
1940
+ RowResponse.encode(message.row, writer.uint32(18).fork()).join();
1941
+ }
1942
+ if (message.filesCompleted !== undefined) {
1943
+ Confirmation.encode(message.filesCompleted, writer.uint32(26).fork()).join();
1944
+ }
1945
+ return writer;
1946
+ },
1947
+
1948
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryEventsResponse {
1949
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1950
+ const end = length === undefined ? reader.len : reader.pos + length;
1951
+ const message = createBaseQueryEventsResponse();
1952
+ while (reader.pos < end) {
1953
+ const tag = reader.uint32();
1954
+ switch (tag >>> 3) {
1955
+ case 1: {
1956
+ if (tag !== 10) {
1957
+ break;
1958
+ }
1959
+
1960
+ message.columns = ColumnsResponse.decode(reader, reader.uint32());
1961
+ continue;
1962
+ }
1963
+ case 2: {
1964
+ if (tag !== 18) {
1965
+ break;
1966
+ }
1967
+
1968
+ message.row = RowResponse.decode(reader, reader.uint32());
1969
+ continue;
1970
+ }
1971
+ case 3: {
1972
+ if (tag !== 26) {
1973
+ break;
1974
+ }
1975
+
1976
+ message.filesCompleted = Confirmation.decode(reader, reader.uint32());
1977
+ continue;
1978
+ }
1979
+ }
1980
+ if ((tag & 7) === 4 || tag === 0) {
1981
+ break;
1982
+ }
1983
+ reader.skip(tag & 7);
1984
+ }
1985
+ return message;
1986
+ },
1987
+
1988
+ fromJSON(object: any): QueryEventsResponse {
1989
+ return {
1990
+ columns: isSet(object.columns) ? ColumnsResponse.fromJSON(object.columns) : undefined,
1991
+ row: isSet(object.row) ? RowResponse.fromJSON(object.row) : undefined,
1992
+ filesCompleted: isSet(object.filesCompleted)
1993
+ ? Confirmation.fromJSON(object.filesCompleted)
1994
+ : isSet(object.files_completed)
1995
+ ? Confirmation.fromJSON(object.files_completed)
1996
+ : undefined,
1997
+ };
1998
+ },
1999
+
2000
+ toJSON(message: QueryEventsResponse): unknown {
2001
+ const obj: any = {};
2002
+ if (message.columns !== undefined) {
2003
+ obj.columns = ColumnsResponse.toJSON(message.columns);
2004
+ }
2005
+ if (message.row !== undefined) {
2006
+ obj.row = RowResponse.toJSON(message.row);
2007
+ }
2008
+ if (message.filesCompleted !== undefined) {
2009
+ obj.filesCompleted = Confirmation.toJSON(message.filesCompleted);
2010
+ }
2011
+ return obj;
2012
+ },
2013
+
2014
+ create(base?: DeepPartial<QueryEventsResponse>): QueryEventsResponse {
2015
+ return QueryEventsResponse.fromPartial(base ?? {});
2016
+ },
2017
+ fromPartial(object: DeepPartial<QueryEventsResponse>): QueryEventsResponse {
2018
+ const message = createBaseQueryEventsResponse();
2019
+ message.columns = (object.columns !== undefined && object.columns !== null)
2020
+ ? ColumnsResponse.fromPartial(object.columns)
2021
+ : undefined;
2022
+ message.row = (object.row !== undefined && object.row !== null) ? RowResponse.fromPartial(object.row) : undefined;
2023
+ message.filesCompleted = (object.filesCompleted !== undefined && object.filesCompleted !== null)
2024
+ ? Confirmation.fromPartial(object.filesCompleted)
2025
+ : undefined;
2026
+ return message;
2027
+ },
2028
+ };
2029
+
2030
+ function createBaseColumnsResponse(): ColumnsResponse {
2031
+ return { column: [] };
2032
+ }
2033
+
2034
+ export const ColumnsResponse: MessageFns<ColumnsResponse> = {
2035
+ encode(message: ColumnsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2036
+ for (const v of message.column) {
2037
+ writer.uint32(10).string(v!);
2038
+ }
2039
+ return writer;
2040
+ },
2041
+
2042
+ decode(input: BinaryReader | Uint8Array, length?: number): ColumnsResponse {
2043
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2044
+ const end = length === undefined ? reader.len : reader.pos + length;
2045
+ const message = createBaseColumnsResponse();
2046
+ while (reader.pos < end) {
2047
+ const tag = reader.uint32();
2048
+ switch (tag >>> 3) {
2049
+ case 1: {
2050
+ if (tag !== 10) {
2051
+ break;
2052
+ }
2053
+
2054
+ message.column.push(reader.string());
2055
+ continue;
2056
+ }
2057
+ }
2058
+ if ((tag & 7) === 4 || tag === 0) {
2059
+ break;
2060
+ }
2061
+ reader.skip(tag & 7);
2062
+ }
2063
+ return message;
2064
+ },
2065
+
2066
+ fromJSON(object: any): ColumnsResponse {
2067
+ return {
2068
+ column: globalThis.Array.isArray(object?.column) ? object.column.map((e: any) => globalThis.String(e)) : [],
2069
+ };
2070
+ },
2071
+
2072
+ toJSON(message: ColumnsResponse): unknown {
2073
+ const obj: any = {};
2074
+ if (message.column?.length) {
2075
+ obj.column = message.column;
2076
+ }
2077
+ return obj;
2078
+ },
2079
+
2080
+ create(base?: DeepPartial<ColumnsResponse>): ColumnsResponse {
2081
+ return ColumnsResponse.fromPartial(base ?? {});
2082
+ },
2083
+ fromPartial(object: DeepPartial<ColumnsResponse>): ColumnsResponse {
2084
+ const message = createBaseColumnsResponse();
2085
+ message.column = object.column?.map((e) => e) || [];
2086
+ return message;
2087
+ },
2088
+ };
2089
+
2090
+ function createBaseRowResponse(): RowResponse {
2091
+ return { idValues: [], sortValues: [], values: {} };
2092
+ }
2093
+
2094
+ export const RowResponse: MessageFns<RowResponse> = {
2095
+ encode(message: RowResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2096
+ for (const v of message.idValues) {
2097
+ QueryValue.encode(v!, writer.uint32(10).fork()).join();
2098
+ }
2099
+ for (const v of message.sortValues) {
2100
+ QueryValue.encode(v!, writer.uint32(18).fork()).join();
2101
+ }
2102
+ globalThis.Object.entries(message.values).forEach(([key, value]: [string, QueryValue]) => {
2103
+ RowResponse_ValuesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
2104
+ });
2105
+ return writer;
2106
+ },
2107
+
2108
+ decode(input: BinaryReader | Uint8Array, length?: number): RowResponse {
2109
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2110
+ const end = length === undefined ? reader.len : reader.pos + length;
2111
+ const message = createBaseRowResponse();
2112
+ while (reader.pos < end) {
2113
+ const tag = reader.uint32();
2114
+ switch (tag >>> 3) {
2115
+ case 1: {
2116
+ if (tag !== 10) {
2117
+ break;
2118
+ }
2119
+
2120
+ message.idValues.push(QueryValue.decode(reader, reader.uint32()));
2121
+ continue;
2122
+ }
2123
+ case 2: {
2124
+ if (tag !== 18) {
2125
+ break;
2126
+ }
2127
+
2128
+ message.sortValues.push(QueryValue.decode(reader, reader.uint32()));
2129
+ continue;
2130
+ }
2131
+ case 3: {
2132
+ if (tag !== 26) {
2133
+ break;
2134
+ }
2135
+
2136
+ const entry3 = RowResponse_ValuesEntry.decode(reader, reader.uint32());
2137
+ if (entry3.value !== undefined) {
2138
+ message.values[entry3.key] = entry3.value;
2139
+ }
2140
+ continue;
2141
+ }
2142
+ }
2143
+ if ((tag & 7) === 4 || tag === 0) {
2144
+ break;
2145
+ }
2146
+ reader.skip(tag & 7);
2147
+ }
2148
+ return message;
2149
+ },
2150
+
2151
+ fromJSON(object: any): RowResponse {
2152
+ return {
2153
+ idValues: globalThis.Array.isArray(object?.idValues)
2154
+ ? object.idValues.map((e: any) => QueryValue.fromJSON(e))
2155
+ : globalThis.Array.isArray(object?.id_values)
2156
+ ? object.id_values.map((e: any) => QueryValue.fromJSON(e))
2157
+ : [],
2158
+ sortValues: globalThis.Array.isArray(object?.sortValues)
2159
+ ? object.sortValues.map((e: any) => QueryValue.fromJSON(e))
2160
+ : globalThis.Array.isArray(object?.sort_values)
2161
+ ? object.sort_values.map((e: any) => QueryValue.fromJSON(e))
2162
+ : [],
2163
+ values: isObject(object.values)
2164
+ ? (globalThis.Object.entries(object.values) as [string, any][]).reduce(
2165
+ (acc: { [key: string]: QueryValue }, [key, value]: [string, any]) => {
2166
+ acc[key] = QueryValue.fromJSON(value);
2167
+ return acc;
2168
+ },
2169
+ {},
2170
+ )
2171
+ : {},
2172
+ };
2173
+ },
2174
+
2175
+ toJSON(message: RowResponse): unknown {
2176
+ const obj: any = {};
2177
+ if (message.idValues?.length) {
2178
+ obj.idValues = message.idValues.map((e) => QueryValue.toJSON(e));
2179
+ }
2180
+ if (message.sortValues?.length) {
2181
+ obj.sortValues = message.sortValues.map((e) => QueryValue.toJSON(e));
2182
+ }
2183
+ if (message.values) {
2184
+ const entries = globalThis.Object.entries(message.values) as [string, QueryValue][];
2185
+ if (entries.length > 0) {
2186
+ obj.values = {};
2187
+ entries.forEach(([k, v]) => {
2188
+ obj.values[k] = QueryValue.toJSON(v);
2189
+ });
2190
+ }
2191
+ }
2192
+ return obj;
2193
+ },
2194
+
2195
+ create(base?: DeepPartial<RowResponse>): RowResponse {
2196
+ return RowResponse.fromPartial(base ?? {});
2197
+ },
2198
+ fromPartial(object: DeepPartial<RowResponse>): RowResponse {
2199
+ const message = createBaseRowResponse();
2200
+ message.idValues = object.idValues?.map((e) => QueryValue.fromPartial(e)) || [];
2201
+ message.sortValues = object.sortValues?.map((e) => QueryValue.fromPartial(e)) || [];
2202
+ message.values = (globalThis.Object.entries(object.values ?? {}) as [string, QueryValue][]).reduce(
2203
+ (acc: { [key: string]: QueryValue }, [key, value]: [string, QueryValue]) => {
2204
+ if (value !== undefined) {
2205
+ acc[key] = QueryValue.fromPartial(value);
2206
+ }
2207
+ return acc;
2208
+ },
2209
+ {},
2210
+ );
2211
+ return message;
2212
+ },
2213
+ };
2214
+
2215
+ function createBaseRowResponse_ValuesEntry(): RowResponse_ValuesEntry {
2216
+ return { key: "", value: undefined };
2217
+ }
2218
+
2219
+ export const RowResponse_ValuesEntry: MessageFns<RowResponse_ValuesEntry> = {
2220
+ encode(message: RowResponse_ValuesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2221
+ if (message.key !== "") {
2222
+ writer.uint32(10).string(message.key);
2223
+ }
2224
+ if (message.value !== undefined) {
2225
+ QueryValue.encode(message.value, writer.uint32(18).fork()).join();
2226
+ }
2227
+ return writer;
2228
+ },
2229
+
2230
+ decode(input: BinaryReader | Uint8Array, length?: number): RowResponse_ValuesEntry {
2231
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2232
+ const end = length === undefined ? reader.len : reader.pos + length;
2233
+ const message = createBaseRowResponse_ValuesEntry();
2234
+ while (reader.pos < end) {
2235
+ const tag = reader.uint32();
2236
+ switch (tag >>> 3) {
2237
+ case 1: {
2238
+ if (tag !== 10) {
2239
+ break;
2240
+ }
2241
+
2242
+ message.key = reader.string();
2243
+ continue;
2244
+ }
2245
+ case 2: {
2246
+ if (tag !== 18) {
2247
+ break;
2248
+ }
2249
+
2250
+ message.value = QueryValue.decode(reader, reader.uint32());
2251
+ continue;
2252
+ }
2253
+ }
2254
+ if ((tag & 7) === 4 || tag === 0) {
2255
+ break;
2256
+ }
2257
+ reader.skip(tag & 7);
2258
+ }
2259
+ return message;
2260
+ },
2261
+
2262
+ fromJSON(object: any): RowResponse_ValuesEntry {
2263
+ return {
2264
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2265
+ value: isSet(object.value) ? QueryValue.fromJSON(object.value) : undefined,
2266
+ };
2267
+ },
2268
+
2269
+ toJSON(message: RowResponse_ValuesEntry): unknown {
2270
+ const obj: any = {};
2271
+ if (message.key !== "") {
2272
+ obj.key = message.key;
2273
+ }
2274
+ if (message.value !== undefined) {
2275
+ obj.value = QueryValue.toJSON(message.value);
2276
+ }
2277
+ return obj;
2278
+ },
2279
+
2280
+ create(base?: DeepPartial<RowResponse_ValuesEntry>): RowResponse_ValuesEntry {
2281
+ return RowResponse_ValuesEntry.fromPartial(base ?? {});
2282
+ },
2283
+ fromPartial(object: DeepPartial<RowResponse_ValuesEntry>): RowResponse_ValuesEntry {
2284
+ const message = createBaseRowResponse_ValuesEntry();
2285
+ message.key = object.key ?? "";
2286
+ message.value = (object.value !== undefined && object.value !== null)
2287
+ ? QueryValue.fromPartial(object.value)
2288
+ : undefined;
2289
+ return message;
2290
+ },
2291
+ };
2292
+
2293
+ function createBaseReadHighestSequenceNrRequest(): ReadHighestSequenceNrRequest {
2294
+ return { aggregateId: "", fromSequenceNr: 0n };
2295
+ }
2296
+
2297
+ export const ReadHighestSequenceNrRequest: MessageFns<ReadHighestSequenceNrRequest> = {
2298
+ encode(message: ReadHighestSequenceNrRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2299
+ if (message.aggregateId !== "") {
2300
+ writer.uint32(10).string(message.aggregateId);
2301
+ }
2302
+ if (message.fromSequenceNr !== 0n) {
2303
+ if (BigInt.asIntN(64, message.fromSequenceNr) !== message.fromSequenceNr) {
2304
+ throw new globalThis.Error("value provided for field message.fromSequenceNr of type int64 too large");
2305
+ }
2306
+ writer.uint32(24).int64(message.fromSequenceNr);
2307
+ }
2308
+ return writer;
2309
+ },
2310
+
2311
+ decode(input: BinaryReader | Uint8Array, length?: number): ReadHighestSequenceNrRequest {
2312
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2313
+ const end = length === undefined ? reader.len : reader.pos + length;
2314
+ const message = createBaseReadHighestSequenceNrRequest();
2315
+ while (reader.pos < end) {
2316
+ const tag = reader.uint32();
2317
+ switch (tag >>> 3) {
2318
+ case 1: {
2319
+ if (tag !== 10) {
2320
+ break;
2321
+ }
2322
+
2323
+ message.aggregateId = reader.string();
2324
+ continue;
2325
+ }
2326
+ case 3: {
2327
+ if (tag !== 24) {
2328
+ break;
2329
+ }
2330
+
2331
+ message.fromSequenceNr = reader.int64() as bigint;
2332
+ continue;
2333
+ }
2334
+ }
2335
+ if ((tag & 7) === 4 || tag === 0) {
2336
+ break;
2337
+ }
2338
+ reader.skip(tag & 7);
2339
+ }
2340
+ return message;
2341
+ },
2342
+
2343
+ fromJSON(object: any): ReadHighestSequenceNrRequest {
2344
+ return {
2345
+ aggregateId: isSet(object.aggregateId)
2346
+ ? globalThis.String(object.aggregateId)
2347
+ : isSet(object.aggregate_id)
2348
+ ? globalThis.String(object.aggregate_id)
2349
+ : "",
2350
+ fromSequenceNr: isSet(object.fromSequenceNr)
2351
+ ? BigInt(object.fromSequenceNr)
2352
+ : isSet(object.from_sequence_nr)
2353
+ ? BigInt(object.from_sequence_nr)
2354
+ : 0n,
2355
+ };
2356
+ },
2357
+
2358
+ toJSON(message: ReadHighestSequenceNrRequest): unknown {
2359
+ const obj: any = {};
2360
+ if (message.aggregateId !== "") {
2361
+ obj.aggregateId = message.aggregateId;
2362
+ }
2363
+ if (message.fromSequenceNr !== 0n) {
2364
+ obj.fromSequenceNr = message.fromSequenceNr.toString();
2365
+ }
2366
+ return obj;
2367
+ },
2368
+
2369
+ create(base?: DeepPartial<ReadHighestSequenceNrRequest>): ReadHighestSequenceNrRequest {
2370
+ return ReadHighestSequenceNrRequest.fromPartial(base ?? {});
2371
+ },
2372
+ fromPartial(object: DeepPartial<ReadHighestSequenceNrRequest>): ReadHighestSequenceNrRequest {
2373
+ const message = createBaseReadHighestSequenceNrRequest();
2374
+ message.aggregateId = object.aggregateId ?? "";
2375
+ message.fromSequenceNr = object.fromSequenceNr ?? 0n;
2376
+ return message;
2377
+ },
2378
+ };
2379
+
2380
+ function createBaseReadHighestSequenceNrResponse(): ReadHighestSequenceNrResponse {
2381
+ return { toSequenceNr: 0n };
2382
+ }
2383
+
2384
+ export const ReadHighestSequenceNrResponse: MessageFns<ReadHighestSequenceNrResponse> = {
2385
+ encode(message: ReadHighestSequenceNrResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2386
+ if (message.toSequenceNr !== 0n) {
2387
+ if (BigInt.asIntN(64, message.toSequenceNr) !== message.toSequenceNr) {
2388
+ throw new globalThis.Error("value provided for field message.toSequenceNr of type int64 too large");
2389
+ }
2390
+ writer.uint32(8).int64(message.toSequenceNr);
2391
+ }
2392
+ return writer;
2393
+ },
2394
+
2395
+ decode(input: BinaryReader | Uint8Array, length?: number): ReadHighestSequenceNrResponse {
2396
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2397
+ const end = length === undefined ? reader.len : reader.pos + length;
2398
+ const message = createBaseReadHighestSequenceNrResponse();
2399
+ while (reader.pos < end) {
2400
+ const tag = reader.uint32();
2401
+ switch (tag >>> 3) {
2402
+ case 1: {
2403
+ if (tag !== 8) {
2404
+ break;
2405
+ }
2406
+
2407
+ message.toSequenceNr = reader.int64() as bigint;
2408
+ continue;
2409
+ }
2410
+ }
2411
+ if ((tag & 7) === 4 || tag === 0) {
2412
+ break;
2413
+ }
2414
+ reader.skip(tag & 7);
2415
+ }
2416
+ return message;
2417
+ },
2418
+
2419
+ fromJSON(object: any): ReadHighestSequenceNrResponse {
2420
+ return {
2421
+ toSequenceNr: isSet(object.toSequenceNr)
2422
+ ? BigInt(object.toSequenceNr)
2423
+ : isSet(object.to_sequence_nr)
2424
+ ? BigInt(object.to_sequence_nr)
2425
+ : 0n,
2426
+ };
2427
+ },
2428
+
2429
+ toJSON(message: ReadHighestSequenceNrResponse): unknown {
2430
+ const obj: any = {};
2431
+ if (message.toSequenceNr !== 0n) {
2432
+ obj.toSequenceNr = message.toSequenceNr.toString();
2433
+ }
2434
+ return obj;
2435
+ },
2436
+
2437
+ create(base?: DeepPartial<ReadHighestSequenceNrResponse>): ReadHighestSequenceNrResponse {
2438
+ return ReadHighestSequenceNrResponse.fromPartial(base ?? {});
2439
+ },
2440
+ fromPartial(object: DeepPartial<ReadHighestSequenceNrResponse>): ReadHighestSequenceNrResponse {
2441
+ const message = createBaseReadHighestSequenceNrResponse();
2442
+ message.toSequenceNr = object.toSequenceNr ?? 0n;
2443
+ return message;
2444
+ },
2445
+ };
2446
+
2447
+ function createBaseConfirmation(): Confirmation {
2448
+ return { success: false };
2449
+ }
2450
+
2451
+ export const Confirmation: MessageFns<Confirmation> = {
2452
+ encode(message: Confirmation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2453
+ if (message.success !== false) {
2454
+ writer.uint32(8).bool(message.success);
2455
+ }
2456
+ return writer;
2457
+ },
2458
+
2459
+ decode(input: BinaryReader | Uint8Array, length?: number): Confirmation {
2460
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2461
+ const end = length === undefined ? reader.len : reader.pos + length;
2462
+ const message = createBaseConfirmation();
2463
+ while (reader.pos < end) {
2464
+ const tag = reader.uint32();
2465
+ switch (tag >>> 3) {
2466
+ case 1: {
2467
+ if (tag !== 8) {
2468
+ break;
2469
+ }
2470
+
2471
+ message.success = reader.bool();
2472
+ continue;
2473
+ }
2474
+ }
2475
+ if ((tag & 7) === 4 || tag === 0) {
2476
+ break;
2477
+ }
2478
+ reader.skip(tag & 7);
2479
+ }
2480
+ return message;
2481
+ },
2482
+
2483
+ fromJSON(object: any): Confirmation {
2484
+ return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false };
2485
+ },
2486
+
2487
+ toJSON(message: Confirmation): unknown {
2488
+ const obj: any = {};
2489
+ if (message.success !== false) {
2490
+ obj.success = message.success;
2491
+ }
2492
+ return obj;
2493
+ },
2494
+
2495
+ create(base?: DeepPartial<Confirmation>): Confirmation {
2496
+ return Confirmation.fromPartial(base ?? {});
2497
+ },
2498
+ fromPartial(object: DeepPartial<Confirmation>): Confirmation {
2499
+ const message = createBaseConfirmation();
2500
+ message.success = object.success ?? false;
2501
+ return message;
2502
+ },
2503
+ };
2504
+
2505
+ function createBaseConfirmationWithConsistencyMarker(): ConfirmationWithConsistencyMarker {
2506
+ return { success: false, consistencyMarker: undefined };
2507
+ }
2508
+
2509
+ export const ConfirmationWithConsistencyMarker: MessageFns<ConfirmationWithConsistencyMarker> = {
2510
+ encode(message: ConfirmationWithConsistencyMarker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2511
+ if (message.success !== false) {
2512
+ writer.uint32(8).bool(message.success);
2513
+ }
2514
+ if (message.consistencyMarker !== undefined) {
2515
+ ConsistencyMarker.encode(message.consistencyMarker, writer.uint32(18).fork()).join();
2516
+ }
2517
+ return writer;
2518
+ },
2519
+
2520
+ decode(input: BinaryReader | Uint8Array, length?: number): ConfirmationWithConsistencyMarker {
2521
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2522
+ const end = length === undefined ? reader.len : reader.pos + length;
2523
+ const message = createBaseConfirmationWithConsistencyMarker();
2524
+ while (reader.pos < end) {
2525
+ const tag = reader.uint32();
2526
+ switch (tag >>> 3) {
2527
+ case 1: {
2528
+ if (tag !== 8) {
2529
+ break;
2530
+ }
2531
+
2532
+ message.success = reader.bool();
2533
+ continue;
2534
+ }
2535
+ case 2: {
2536
+ if (tag !== 18) {
2537
+ break;
2538
+ }
2539
+
2540
+ message.consistencyMarker = ConsistencyMarker.decode(reader, reader.uint32());
2541
+ continue;
2542
+ }
2543
+ }
2544
+ if ((tag & 7) === 4 || tag === 0) {
2545
+ break;
2546
+ }
2547
+ reader.skip(tag & 7);
2548
+ }
2549
+ return message;
2550
+ },
2551
+
2552
+ fromJSON(object: any): ConfirmationWithConsistencyMarker {
2553
+ return {
2554
+ success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
2555
+ consistencyMarker: isSet(object.consistencyMarker)
2556
+ ? ConsistencyMarker.fromJSON(object.consistencyMarker)
2557
+ : isSet(object.consistency_marker)
2558
+ ? ConsistencyMarker.fromJSON(object.consistency_marker)
2559
+ : undefined,
2560
+ };
2561
+ },
2562
+
2563
+ toJSON(message: ConfirmationWithConsistencyMarker): unknown {
2564
+ const obj: any = {};
2565
+ if (message.success !== false) {
2566
+ obj.success = message.success;
2567
+ }
2568
+ if (message.consistencyMarker !== undefined) {
2569
+ obj.consistencyMarker = ConsistencyMarker.toJSON(message.consistencyMarker);
2570
+ }
2571
+ return obj;
2572
+ },
2573
+
2574
+ create(base?: DeepPartial<ConfirmationWithConsistencyMarker>): ConfirmationWithConsistencyMarker {
2575
+ return ConfirmationWithConsistencyMarker.fromPartial(base ?? {});
2576
+ },
2577
+ fromPartial(object: DeepPartial<ConfirmationWithConsistencyMarker>): ConfirmationWithConsistencyMarker {
2578
+ const message = createBaseConfirmationWithConsistencyMarker();
2579
+ message.success = object.success ?? false;
2580
+ message.consistencyMarker = (object.consistencyMarker !== undefined && object.consistencyMarker !== null)
2581
+ ? ConsistencyMarker.fromPartial(object.consistencyMarker)
2582
+ : undefined;
2583
+ return message;
2584
+ },
2585
+ };
2586
+
2587
+ function createBaseConsistencyMarker(): ConsistencyMarker {
2588
+ return { token: 0n };
2589
+ }
2590
+
2591
+ export const ConsistencyMarker: MessageFns<ConsistencyMarker> = {
2592
+ encode(message: ConsistencyMarker, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2593
+ if (message.token !== 0n) {
2594
+ if (BigInt.asIntN(64, message.token) !== message.token) {
2595
+ throw new globalThis.Error("value provided for field message.token of type int64 too large");
2596
+ }
2597
+ writer.uint32(8).int64(message.token);
2598
+ }
2599
+ return writer;
2600
+ },
2601
+
2602
+ decode(input: BinaryReader | Uint8Array, length?: number): ConsistencyMarker {
2603
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2604
+ const end = length === undefined ? reader.len : reader.pos + length;
2605
+ const message = createBaseConsistencyMarker();
2606
+ while (reader.pos < end) {
2607
+ const tag = reader.uint32();
2608
+ switch (tag >>> 3) {
2609
+ case 1: {
2610
+ if (tag !== 8) {
2611
+ break;
2612
+ }
2613
+
2614
+ message.token = reader.int64() as bigint;
2615
+ continue;
2616
+ }
2617
+ }
2618
+ if ((tag & 7) === 4 || tag === 0) {
2619
+ break;
2620
+ }
2621
+ reader.skip(tag & 7);
2622
+ }
2623
+ return message;
2624
+ },
2625
+
2626
+ fromJSON(object: any): ConsistencyMarker {
2627
+ return { token: isSet(object.token) ? BigInt(object.token) : 0n };
2628
+ },
2629
+
2630
+ toJSON(message: ConsistencyMarker): unknown {
2631
+ const obj: any = {};
2632
+ if (message.token !== 0n) {
2633
+ obj.token = message.token.toString();
2634
+ }
2635
+ return obj;
2636
+ },
2637
+
2638
+ create(base?: DeepPartial<ConsistencyMarker>): ConsistencyMarker {
2639
+ return ConsistencyMarker.fromPartial(base ?? {});
2640
+ },
2641
+ fromPartial(object: DeepPartial<ConsistencyMarker>): ConsistencyMarker {
2642
+ const message = createBaseConsistencyMarker();
2643
+ message.token = object.token ?? 0n;
2644
+ return message;
2645
+ },
2646
+ };
2647
+
2648
+ function createBaseGetAggregateEventsRequest(): GetAggregateEventsRequest {
2649
+ return { aggregateId: "", initialSequence: 0n, allowSnapshots: false, maxSequence: 0n, minToken: 0n };
2650
+ }
2651
+
2652
+ export const GetAggregateEventsRequest: MessageFns<GetAggregateEventsRequest> = {
2653
+ encode(message: GetAggregateEventsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2654
+ if (message.aggregateId !== "") {
2655
+ writer.uint32(10).string(message.aggregateId);
2656
+ }
2657
+ if (message.initialSequence !== 0n) {
2658
+ if (BigInt.asIntN(64, message.initialSequence) !== message.initialSequence) {
2659
+ throw new globalThis.Error("value provided for field message.initialSequence of type int64 too large");
2660
+ }
2661
+ writer.uint32(16).int64(message.initialSequence);
2662
+ }
2663
+ if (message.allowSnapshots !== false) {
2664
+ writer.uint32(24).bool(message.allowSnapshots);
2665
+ }
2666
+ if (message.maxSequence !== 0n) {
2667
+ if (BigInt.asIntN(64, message.maxSequence) !== message.maxSequence) {
2668
+ throw new globalThis.Error("value provided for field message.maxSequence of type int64 too large");
2669
+ }
2670
+ writer.uint32(32).int64(message.maxSequence);
2671
+ }
2672
+ if (message.minToken !== 0n) {
2673
+ if (BigInt.asIntN(64, message.minToken) !== message.minToken) {
2674
+ throw new globalThis.Error("value provided for field message.minToken of type int64 too large");
2675
+ }
2676
+ writer.uint32(40).int64(message.minToken);
2677
+ }
2678
+ return writer;
2679
+ },
2680
+
2681
+ decode(input: BinaryReader | Uint8Array, length?: number): GetAggregateEventsRequest {
2682
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2683
+ const end = length === undefined ? reader.len : reader.pos + length;
2684
+ const message = createBaseGetAggregateEventsRequest();
2685
+ while (reader.pos < end) {
2686
+ const tag = reader.uint32();
2687
+ switch (tag >>> 3) {
2688
+ case 1: {
2689
+ if (tag !== 10) {
2690
+ break;
2691
+ }
2692
+
2693
+ message.aggregateId = reader.string();
2694
+ continue;
2695
+ }
2696
+ case 2: {
2697
+ if (tag !== 16) {
2698
+ break;
2699
+ }
2700
+
2701
+ message.initialSequence = reader.int64() as bigint;
2702
+ continue;
2703
+ }
2704
+ case 3: {
2705
+ if (tag !== 24) {
2706
+ break;
2707
+ }
2708
+
2709
+ message.allowSnapshots = reader.bool();
2710
+ continue;
2711
+ }
2712
+ case 4: {
2713
+ if (tag !== 32) {
2714
+ break;
2715
+ }
2716
+
2717
+ message.maxSequence = reader.int64() as bigint;
2718
+ continue;
2719
+ }
2720
+ case 5: {
2721
+ if (tag !== 40) {
2722
+ break;
2723
+ }
2724
+
2725
+ message.minToken = reader.int64() as bigint;
2726
+ continue;
2727
+ }
2728
+ }
2729
+ if ((tag & 7) === 4 || tag === 0) {
2730
+ break;
2731
+ }
2732
+ reader.skip(tag & 7);
2733
+ }
2734
+ return message;
2735
+ },
2736
+
2737
+ fromJSON(object: any): GetAggregateEventsRequest {
2738
+ return {
2739
+ aggregateId: isSet(object.aggregateId)
2740
+ ? globalThis.String(object.aggregateId)
2741
+ : isSet(object.aggregate_id)
2742
+ ? globalThis.String(object.aggregate_id)
2743
+ : "",
2744
+ initialSequence: isSet(object.initialSequence)
2745
+ ? BigInt(object.initialSequence)
2746
+ : isSet(object.initial_sequence)
2747
+ ? BigInt(object.initial_sequence)
2748
+ : 0n,
2749
+ allowSnapshots: isSet(object.allowSnapshots)
2750
+ ? globalThis.Boolean(object.allowSnapshots)
2751
+ : isSet(object.allow_snapshots)
2752
+ ? globalThis.Boolean(object.allow_snapshots)
2753
+ : false,
2754
+ maxSequence: isSet(object.maxSequence)
2755
+ ? BigInt(object.maxSequence)
2756
+ : isSet(object.max_sequence)
2757
+ ? BigInt(object.max_sequence)
2758
+ : 0n,
2759
+ minToken: isSet(object.minToken)
2760
+ ? BigInt(object.minToken)
2761
+ : isSet(object.min_token)
2762
+ ? BigInt(object.min_token)
2763
+ : 0n,
2764
+ };
2765
+ },
2766
+
2767
+ toJSON(message: GetAggregateEventsRequest): unknown {
2768
+ const obj: any = {};
2769
+ if (message.aggregateId !== "") {
2770
+ obj.aggregateId = message.aggregateId;
2771
+ }
2772
+ if (message.initialSequence !== 0n) {
2773
+ obj.initialSequence = message.initialSequence.toString();
2774
+ }
2775
+ if (message.allowSnapshots !== false) {
2776
+ obj.allowSnapshots = message.allowSnapshots;
2777
+ }
2778
+ if (message.maxSequence !== 0n) {
2779
+ obj.maxSequence = message.maxSequence.toString();
2780
+ }
2781
+ if (message.minToken !== 0n) {
2782
+ obj.minToken = message.minToken.toString();
2783
+ }
2784
+ return obj;
2785
+ },
2786
+
2787
+ create(base?: DeepPartial<GetAggregateEventsRequest>): GetAggregateEventsRequest {
2788
+ return GetAggregateEventsRequest.fromPartial(base ?? {});
2789
+ },
2790
+ fromPartial(object: DeepPartial<GetAggregateEventsRequest>): GetAggregateEventsRequest {
2791
+ const message = createBaseGetAggregateEventsRequest();
2792
+ message.aggregateId = object.aggregateId ?? "";
2793
+ message.initialSequence = object.initialSequence ?? 0n;
2794
+ message.allowSnapshots = object.allowSnapshots ?? false;
2795
+ message.maxSequence = object.maxSequence ?? 0n;
2796
+ message.minToken = object.minToken ?? 0n;
2797
+ return message;
2798
+ },
2799
+ };
2800
+
2801
+ function createBaseGetAggregateSnapshotsRequest(): GetAggregateSnapshotsRequest {
2802
+ return { aggregateId: "", initialSequence: 0n, maxSequence: 0n, maxResults: 0 };
2803
+ }
2804
+
2805
+ export const GetAggregateSnapshotsRequest: MessageFns<GetAggregateSnapshotsRequest> = {
2806
+ encode(message: GetAggregateSnapshotsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2807
+ if (message.aggregateId !== "") {
2808
+ writer.uint32(10).string(message.aggregateId);
2809
+ }
2810
+ if (message.initialSequence !== 0n) {
2811
+ if (BigInt.asIntN(64, message.initialSequence) !== message.initialSequence) {
2812
+ throw new globalThis.Error("value provided for field message.initialSequence of type int64 too large");
2813
+ }
2814
+ writer.uint32(16).int64(message.initialSequence);
2815
+ }
2816
+ if (message.maxSequence !== 0n) {
2817
+ if (BigInt.asIntN(64, message.maxSequence) !== message.maxSequence) {
2818
+ throw new globalThis.Error("value provided for field message.maxSequence of type int64 too large");
2819
+ }
2820
+ writer.uint32(24).int64(message.maxSequence);
2821
+ }
2822
+ if (message.maxResults !== 0) {
2823
+ writer.uint32(32).int32(message.maxResults);
2824
+ }
2825
+ return writer;
2826
+ },
2827
+
2828
+ decode(input: BinaryReader | Uint8Array, length?: number): GetAggregateSnapshotsRequest {
2829
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2830
+ const end = length === undefined ? reader.len : reader.pos + length;
2831
+ const message = createBaseGetAggregateSnapshotsRequest();
2832
+ while (reader.pos < end) {
2833
+ const tag = reader.uint32();
2834
+ switch (tag >>> 3) {
2835
+ case 1: {
2836
+ if (tag !== 10) {
2837
+ break;
2838
+ }
2839
+
2840
+ message.aggregateId = reader.string();
2841
+ continue;
2842
+ }
2843
+ case 2: {
2844
+ if (tag !== 16) {
2845
+ break;
2846
+ }
2847
+
2848
+ message.initialSequence = reader.int64() as bigint;
2849
+ continue;
2850
+ }
2851
+ case 3: {
2852
+ if (tag !== 24) {
2853
+ break;
2854
+ }
2855
+
2856
+ message.maxSequence = reader.int64() as bigint;
2857
+ continue;
2858
+ }
2859
+ case 4: {
2860
+ if (tag !== 32) {
2861
+ break;
2862
+ }
2863
+
2864
+ message.maxResults = reader.int32();
2865
+ continue;
2866
+ }
2867
+ }
2868
+ if ((tag & 7) === 4 || tag === 0) {
2869
+ break;
2870
+ }
2871
+ reader.skip(tag & 7);
2872
+ }
2873
+ return message;
2874
+ },
2875
+
2876
+ fromJSON(object: any): GetAggregateSnapshotsRequest {
2877
+ return {
2878
+ aggregateId: isSet(object.aggregateId)
2879
+ ? globalThis.String(object.aggregateId)
2880
+ : isSet(object.aggregate_id)
2881
+ ? globalThis.String(object.aggregate_id)
2882
+ : "",
2883
+ initialSequence: isSet(object.initialSequence)
2884
+ ? BigInt(object.initialSequence)
2885
+ : isSet(object.initial_sequence)
2886
+ ? BigInt(object.initial_sequence)
2887
+ : 0n,
2888
+ maxSequence: isSet(object.maxSequence)
2889
+ ? BigInt(object.maxSequence)
2890
+ : isSet(object.max_sequence)
2891
+ ? BigInt(object.max_sequence)
2892
+ : 0n,
2893
+ maxResults: isSet(object.maxResults)
2894
+ ? globalThis.Number(object.maxResults)
2895
+ : isSet(object.max_results)
2896
+ ? globalThis.Number(object.max_results)
2897
+ : 0,
2898
+ };
2899
+ },
2900
+
2901
+ toJSON(message: GetAggregateSnapshotsRequest): unknown {
2902
+ const obj: any = {};
2903
+ if (message.aggregateId !== "") {
2904
+ obj.aggregateId = message.aggregateId;
2905
+ }
2906
+ if (message.initialSequence !== 0n) {
2907
+ obj.initialSequence = message.initialSequence.toString();
2908
+ }
2909
+ if (message.maxSequence !== 0n) {
2910
+ obj.maxSequence = message.maxSequence.toString();
2911
+ }
2912
+ if (message.maxResults !== 0) {
2913
+ obj.maxResults = Math.round(message.maxResults);
2914
+ }
2915
+ return obj;
2916
+ },
2917
+
2918
+ create(base?: DeepPartial<GetAggregateSnapshotsRequest>): GetAggregateSnapshotsRequest {
2919
+ return GetAggregateSnapshotsRequest.fromPartial(base ?? {});
2920
+ },
2921
+ fromPartial(object: DeepPartial<GetAggregateSnapshotsRequest>): GetAggregateSnapshotsRequest {
2922
+ const message = createBaseGetAggregateSnapshotsRequest();
2923
+ message.aggregateId = object.aggregateId ?? "";
2924
+ message.initialSequence = object.initialSequence ?? 0n;
2925
+ message.maxSequence = object.maxSequence ?? 0n;
2926
+ message.maxResults = object.maxResults ?? 0;
2927
+ return message;
2928
+ },
2929
+ };
2930
+
2931
+ function createBaseGetEventsRequest(): GetEventsRequest {
2932
+ return {
2933
+ trackingToken: 0n,
2934
+ numberOfPermits: 0n,
2935
+ clientId: "",
2936
+ componentName: "",
2937
+ processor: "",
2938
+ blacklist: [],
2939
+ forceReadFromLeader: false,
2940
+ };
2941
+ }
2942
+
2943
+ export const GetEventsRequest: MessageFns<GetEventsRequest> = {
2944
+ encode(message: GetEventsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2945
+ if (message.trackingToken !== 0n) {
2946
+ if (BigInt.asIntN(64, message.trackingToken) !== message.trackingToken) {
2947
+ throw new globalThis.Error("value provided for field message.trackingToken of type int64 too large");
2948
+ }
2949
+ writer.uint32(8).int64(message.trackingToken);
2950
+ }
2951
+ if (message.numberOfPermits !== 0n) {
2952
+ if (BigInt.asIntN(64, message.numberOfPermits) !== message.numberOfPermits) {
2953
+ throw new globalThis.Error("value provided for field message.numberOfPermits of type int64 too large");
2954
+ }
2955
+ writer.uint32(16).int64(message.numberOfPermits);
2956
+ }
2957
+ if (message.clientId !== "") {
2958
+ writer.uint32(26).string(message.clientId);
2959
+ }
2960
+ if (message.componentName !== "") {
2961
+ writer.uint32(34).string(message.componentName);
2962
+ }
2963
+ if (message.processor !== "") {
2964
+ writer.uint32(42).string(message.processor);
2965
+ }
2966
+ for (const v of message.blacklist) {
2967
+ PayloadDescription.encode(v!, writer.uint32(50).fork()).join();
2968
+ }
2969
+ if (message.forceReadFromLeader !== false) {
2970
+ writer.uint32(56).bool(message.forceReadFromLeader);
2971
+ }
2972
+ return writer;
2973
+ },
2974
+
2975
+ decode(input: BinaryReader | Uint8Array, length?: number): GetEventsRequest {
2976
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2977
+ const end = length === undefined ? reader.len : reader.pos + length;
2978
+ const message = createBaseGetEventsRequest();
2979
+ while (reader.pos < end) {
2980
+ const tag = reader.uint32();
2981
+ switch (tag >>> 3) {
2982
+ case 1: {
2983
+ if (tag !== 8) {
2984
+ break;
2985
+ }
2986
+
2987
+ message.trackingToken = reader.int64() as bigint;
2988
+ continue;
2989
+ }
2990
+ case 2: {
2991
+ if (tag !== 16) {
2992
+ break;
2993
+ }
2994
+
2995
+ message.numberOfPermits = reader.int64() as bigint;
2996
+ continue;
2997
+ }
2998
+ case 3: {
2999
+ if (tag !== 26) {
3000
+ break;
3001
+ }
3002
+
3003
+ message.clientId = reader.string();
3004
+ continue;
3005
+ }
3006
+ case 4: {
3007
+ if (tag !== 34) {
3008
+ break;
3009
+ }
3010
+
3011
+ message.componentName = reader.string();
3012
+ continue;
3013
+ }
3014
+ case 5: {
3015
+ if (tag !== 42) {
3016
+ break;
3017
+ }
3018
+
3019
+ message.processor = reader.string();
3020
+ continue;
3021
+ }
3022
+ case 6: {
3023
+ if (tag !== 50) {
3024
+ break;
3025
+ }
3026
+
3027
+ message.blacklist.push(PayloadDescription.decode(reader, reader.uint32()));
3028
+ continue;
3029
+ }
3030
+ case 7: {
3031
+ if (tag !== 56) {
3032
+ break;
3033
+ }
3034
+
3035
+ message.forceReadFromLeader = reader.bool();
3036
+ continue;
3037
+ }
3038
+ }
3039
+ if ((tag & 7) === 4 || tag === 0) {
3040
+ break;
3041
+ }
3042
+ reader.skip(tag & 7);
3043
+ }
3044
+ return message;
3045
+ },
3046
+
3047
+ fromJSON(object: any): GetEventsRequest {
3048
+ return {
3049
+ trackingToken: isSet(object.trackingToken)
3050
+ ? BigInt(object.trackingToken)
3051
+ : isSet(object.tracking_token)
3052
+ ? BigInt(object.tracking_token)
3053
+ : 0n,
3054
+ numberOfPermits: isSet(object.numberOfPermits)
3055
+ ? BigInt(object.numberOfPermits)
3056
+ : isSet(object.number_of_permits)
3057
+ ? BigInt(object.number_of_permits)
3058
+ : 0n,
3059
+ clientId: isSet(object.clientId)
3060
+ ? globalThis.String(object.clientId)
3061
+ : isSet(object.client_id)
3062
+ ? globalThis.String(object.client_id)
3063
+ : "",
3064
+ componentName: isSet(object.componentName)
3065
+ ? globalThis.String(object.componentName)
3066
+ : isSet(object.component_name)
3067
+ ? globalThis.String(object.component_name)
3068
+ : "",
3069
+ processor: isSet(object.processor) ? globalThis.String(object.processor) : "",
3070
+ blacklist: globalThis.Array.isArray(object?.blacklist)
3071
+ ? object.blacklist.map((e: any) => PayloadDescription.fromJSON(e))
3072
+ : [],
3073
+ forceReadFromLeader: isSet(object.forceReadFromLeader)
3074
+ ? globalThis.Boolean(object.forceReadFromLeader)
3075
+ : isSet(object.force_read_from_leader)
3076
+ ? globalThis.Boolean(object.force_read_from_leader)
3077
+ : false,
3078
+ };
3079
+ },
3080
+
3081
+ toJSON(message: GetEventsRequest): unknown {
3082
+ const obj: any = {};
3083
+ if (message.trackingToken !== 0n) {
3084
+ obj.trackingToken = message.trackingToken.toString();
3085
+ }
3086
+ if (message.numberOfPermits !== 0n) {
3087
+ obj.numberOfPermits = message.numberOfPermits.toString();
3088
+ }
3089
+ if (message.clientId !== "") {
3090
+ obj.clientId = message.clientId;
3091
+ }
3092
+ if (message.componentName !== "") {
3093
+ obj.componentName = message.componentName;
3094
+ }
3095
+ if (message.processor !== "") {
3096
+ obj.processor = message.processor;
3097
+ }
3098
+ if (message.blacklist?.length) {
3099
+ obj.blacklist = message.blacklist.map((e) => PayloadDescription.toJSON(e));
3100
+ }
3101
+ if (message.forceReadFromLeader !== false) {
3102
+ obj.forceReadFromLeader = message.forceReadFromLeader;
3103
+ }
3104
+ return obj;
3105
+ },
3106
+
3107
+ create(base?: DeepPartial<GetEventsRequest>): GetEventsRequest {
3108
+ return GetEventsRequest.fromPartial(base ?? {});
3109
+ },
3110
+ fromPartial(object: DeepPartial<GetEventsRequest>): GetEventsRequest {
3111
+ const message = createBaseGetEventsRequest();
3112
+ message.trackingToken = object.trackingToken ?? 0n;
3113
+ message.numberOfPermits = object.numberOfPermits ?? 0n;
3114
+ message.clientId = object.clientId ?? "";
3115
+ message.componentName = object.componentName ?? "";
3116
+ message.processor = object.processor ?? "";
3117
+ message.blacklist = object.blacklist?.map((e) => PayloadDescription.fromPartial(e)) || [];
3118
+ message.forceReadFromLeader = object.forceReadFromLeader ?? false;
3119
+ return message;
3120
+ },
3121
+ };
3122
+
3123
+ function createBaseEvent(): Event {
3124
+ return {
3125
+ messageIdentifier: "",
3126
+ aggregateIdentifier: "",
3127
+ aggregateSequenceNumber: 0n,
3128
+ aggregateType: "",
3129
+ timestamp: 0n,
3130
+ payload: undefined,
3131
+ metaData: {},
3132
+ snapshot: false,
3133
+ };
3134
+ }
3135
+
3136
+ export const Event: MessageFns<Event> = {
3137
+ encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3138
+ if (message.messageIdentifier !== "") {
3139
+ writer.uint32(10).string(message.messageIdentifier);
3140
+ }
3141
+ if (message.aggregateIdentifier !== "") {
3142
+ writer.uint32(18).string(message.aggregateIdentifier);
3143
+ }
3144
+ if (message.aggregateSequenceNumber !== 0n) {
3145
+ if (BigInt.asIntN(64, message.aggregateSequenceNumber) !== message.aggregateSequenceNumber) {
3146
+ throw new globalThis.Error("value provided for field message.aggregateSequenceNumber of type int64 too large");
3147
+ }
3148
+ writer.uint32(24).int64(message.aggregateSequenceNumber);
3149
+ }
3150
+ if (message.aggregateType !== "") {
3151
+ writer.uint32(34).string(message.aggregateType);
3152
+ }
3153
+ if (message.timestamp !== 0n) {
3154
+ if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
3155
+ throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
3156
+ }
3157
+ writer.uint32(40).int64(message.timestamp);
3158
+ }
3159
+ if (message.payload !== undefined) {
3160
+ SerializedObject.encode(message.payload, writer.uint32(50).fork()).join();
3161
+ }
3162
+ globalThis.Object.entries(message.metaData).forEach(([key, value]: [string, MetaDataValue]) => {
3163
+ Event_MetaDataEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).join();
3164
+ });
3165
+ if (message.snapshot !== false) {
3166
+ writer.uint32(64).bool(message.snapshot);
3167
+ }
3168
+ return writer;
3169
+ },
3170
+
3171
+ decode(input: BinaryReader | Uint8Array, length?: number): Event {
3172
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3173
+ const end = length === undefined ? reader.len : reader.pos + length;
3174
+ const message = createBaseEvent();
3175
+ while (reader.pos < end) {
3176
+ const tag = reader.uint32();
3177
+ switch (tag >>> 3) {
3178
+ case 1: {
3179
+ if (tag !== 10) {
3180
+ break;
3181
+ }
3182
+
3183
+ message.messageIdentifier = reader.string();
3184
+ continue;
3185
+ }
3186
+ case 2: {
3187
+ if (tag !== 18) {
3188
+ break;
3189
+ }
3190
+
3191
+ message.aggregateIdentifier = reader.string();
3192
+ continue;
3193
+ }
3194
+ case 3: {
3195
+ if (tag !== 24) {
3196
+ break;
3197
+ }
3198
+
3199
+ message.aggregateSequenceNumber = reader.int64() as bigint;
3200
+ continue;
3201
+ }
3202
+ case 4: {
3203
+ if (tag !== 34) {
3204
+ break;
3205
+ }
3206
+
3207
+ message.aggregateType = reader.string();
3208
+ continue;
3209
+ }
3210
+ case 5: {
3211
+ if (tag !== 40) {
3212
+ break;
3213
+ }
3214
+
3215
+ message.timestamp = reader.int64() as bigint;
3216
+ continue;
3217
+ }
3218
+ case 6: {
3219
+ if (tag !== 50) {
3220
+ break;
3221
+ }
3222
+
3223
+ message.payload = SerializedObject.decode(reader, reader.uint32());
3224
+ continue;
3225
+ }
3226
+ case 7: {
3227
+ if (tag !== 58) {
3228
+ break;
3229
+ }
3230
+
3231
+ const entry7 = Event_MetaDataEntry.decode(reader, reader.uint32());
3232
+ if (entry7.value !== undefined) {
3233
+ message.metaData[entry7.key] = entry7.value;
3234
+ }
3235
+ continue;
3236
+ }
3237
+ case 8: {
3238
+ if (tag !== 64) {
3239
+ break;
3240
+ }
3241
+
3242
+ message.snapshot = reader.bool();
3243
+ continue;
3244
+ }
3245
+ }
3246
+ if ((tag & 7) === 4 || tag === 0) {
3247
+ break;
3248
+ }
3249
+ reader.skip(tag & 7);
3250
+ }
3251
+ return message;
3252
+ },
3253
+
3254
+ fromJSON(object: any): Event {
3255
+ return {
3256
+ messageIdentifier: isSet(object.messageIdentifier)
3257
+ ? globalThis.String(object.messageIdentifier)
3258
+ : isSet(object.message_identifier)
3259
+ ? globalThis.String(object.message_identifier)
3260
+ : "",
3261
+ aggregateIdentifier: isSet(object.aggregateIdentifier)
3262
+ ? globalThis.String(object.aggregateIdentifier)
3263
+ : isSet(object.aggregate_identifier)
3264
+ ? globalThis.String(object.aggregate_identifier)
3265
+ : "",
3266
+ aggregateSequenceNumber: isSet(object.aggregateSequenceNumber)
3267
+ ? BigInt(object.aggregateSequenceNumber)
3268
+ : isSet(object.aggregate_sequence_number)
3269
+ ? BigInt(object.aggregate_sequence_number)
3270
+ : 0n,
3271
+ aggregateType: isSet(object.aggregateType)
3272
+ ? globalThis.String(object.aggregateType)
3273
+ : isSet(object.aggregate_type)
3274
+ ? globalThis.String(object.aggregate_type)
3275
+ : "",
3276
+ timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n,
3277
+ payload: isSet(object.payload) ? SerializedObject.fromJSON(object.payload) : undefined,
3278
+ metaData: isObject(object.metaData)
3279
+ ? (globalThis.Object.entries(object.metaData) as [string, any][]).reduce(
3280
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
3281
+ acc[key] = MetaDataValue.fromJSON(value);
3282
+ return acc;
3283
+ },
3284
+ {},
3285
+ )
3286
+ : isObject(object.meta_data)
3287
+ ? (globalThis.Object.entries(object.meta_data) as [string, any][]).reduce(
3288
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
3289
+ acc[key] = MetaDataValue.fromJSON(value);
3290
+ return acc;
3291
+ },
3292
+ {},
3293
+ )
3294
+ : {},
3295
+ snapshot: isSet(object.snapshot) ? globalThis.Boolean(object.snapshot) : false,
3296
+ };
3297
+ },
3298
+
3299
+ toJSON(message: Event): unknown {
3300
+ const obj: any = {};
3301
+ if (message.messageIdentifier !== "") {
3302
+ obj.messageIdentifier = message.messageIdentifier;
3303
+ }
3304
+ if (message.aggregateIdentifier !== "") {
3305
+ obj.aggregateIdentifier = message.aggregateIdentifier;
3306
+ }
3307
+ if (message.aggregateSequenceNumber !== 0n) {
3308
+ obj.aggregateSequenceNumber = message.aggregateSequenceNumber.toString();
3309
+ }
3310
+ if (message.aggregateType !== "") {
3311
+ obj.aggregateType = message.aggregateType;
3312
+ }
3313
+ if (message.timestamp !== 0n) {
3314
+ obj.timestamp = message.timestamp.toString();
3315
+ }
3316
+ if (message.payload !== undefined) {
3317
+ obj.payload = SerializedObject.toJSON(message.payload);
3318
+ }
3319
+ if (message.metaData) {
3320
+ const entries = globalThis.Object.entries(message.metaData) as [string, MetaDataValue][];
3321
+ if (entries.length > 0) {
3322
+ obj.metaData = {};
3323
+ entries.forEach(([k, v]) => {
3324
+ obj.metaData[k] = MetaDataValue.toJSON(v);
3325
+ });
3326
+ }
3327
+ }
3328
+ if (message.snapshot !== false) {
3329
+ obj.snapshot = message.snapshot;
3330
+ }
3331
+ return obj;
3332
+ },
3333
+
3334
+ create(base?: DeepPartial<Event>): Event {
3335
+ return Event.fromPartial(base ?? {});
3336
+ },
3337
+ fromPartial(object: DeepPartial<Event>): Event {
3338
+ const message = createBaseEvent();
3339
+ message.messageIdentifier = object.messageIdentifier ?? "";
3340
+ message.aggregateIdentifier = object.aggregateIdentifier ?? "";
3341
+ message.aggregateSequenceNumber = object.aggregateSequenceNumber ?? 0n;
3342
+ message.aggregateType = object.aggregateType ?? "";
3343
+ message.timestamp = object.timestamp ?? 0n;
3344
+ message.payload = (object.payload !== undefined && object.payload !== null)
3345
+ ? SerializedObject.fromPartial(object.payload)
3346
+ : undefined;
3347
+ message.metaData = (globalThis.Object.entries(object.metaData ?? {}) as [string, MetaDataValue][]).reduce(
3348
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, MetaDataValue]) => {
3349
+ if (value !== undefined) {
3350
+ acc[key] = MetaDataValue.fromPartial(value);
3351
+ }
3352
+ return acc;
3353
+ },
3354
+ {},
3355
+ );
3356
+ message.snapshot = object.snapshot ?? false;
3357
+ return message;
3358
+ },
3359
+ };
3360
+
3361
+ function createBaseEvent_MetaDataEntry(): Event_MetaDataEntry {
3362
+ return { key: "", value: undefined };
3363
+ }
3364
+
3365
+ export const Event_MetaDataEntry: MessageFns<Event_MetaDataEntry> = {
3366
+ encode(message: Event_MetaDataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3367
+ if (message.key !== "") {
3368
+ writer.uint32(10).string(message.key);
3369
+ }
3370
+ if (message.value !== undefined) {
3371
+ MetaDataValue.encode(message.value, writer.uint32(18).fork()).join();
3372
+ }
3373
+ return writer;
3374
+ },
3375
+
3376
+ decode(input: BinaryReader | Uint8Array, length?: number): Event_MetaDataEntry {
3377
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3378
+ const end = length === undefined ? reader.len : reader.pos + length;
3379
+ const message = createBaseEvent_MetaDataEntry();
3380
+ while (reader.pos < end) {
3381
+ const tag = reader.uint32();
3382
+ switch (tag >>> 3) {
3383
+ case 1: {
3384
+ if (tag !== 10) {
3385
+ break;
3386
+ }
3387
+
3388
+ message.key = reader.string();
3389
+ continue;
3390
+ }
3391
+ case 2: {
3392
+ if (tag !== 18) {
3393
+ break;
3394
+ }
3395
+
3396
+ message.value = MetaDataValue.decode(reader, reader.uint32());
3397
+ continue;
3398
+ }
3399
+ }
3400
+ if ((tag & 7) === 4 || tag === 0) {
3401
+ break;
3402
+ }
3403
+ reader.skip(tag & 7);
3404
+ }
3405
+ return message;
3406
+ },
3407
+
3408
+ fromJSON(object: any): Event_MetaDataEntry {
3409
+ return {
3410
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
3411
+ value: isSet(object.value) ? MetaDataValue.fromJSON(object.value) : undefined,
3412
+ };
3413
+ },
3414
+
3415
+ toJSON(message: Event_MetaDataEntry): unknown {
3416
+ const obj: any = {};
3417
+ if (message.key !== "") {
3418
+ obj.key = message.key;
3419
+ }
3420
+ if (message.value !== undefined) {
3421
+ obj.value = MetaDataValue.toJSON(message.value);
3422
+ }
3423
+ return obj;
3424
+ },
3425
+
3426
+ create(base?: DeepPartial<Event_MetaDataEntry>): Event_MetaDataEntry {
3427
+ return Event_MetaDataEntry.fromPartial(base ?? {});
3428
+ },
3429
+ fromPartial(object: DeepPartial<Event_MetaDataEntry>): Event_MetaDataEntry {
3430
+ const message = createBaseEvent_MetaDataEntry();
3431
+ message.key = object.key ?? "";
3432
+ message.value = (object.value !== undefined && object.value !== null)
3433
+ ? MetaDataValue.fromPartial(object.value)
3434
+ : undefined;
3435
+ return message;
3436
+ },
3437
+ };
3438
+
3439
+ function createBaseQueryValue(): QueryValue {
3440
+ return { textValue: undefined, numberValue: undefined, booleanValue: undefined, doubleValue: undefined };
3441
+ }
3442
+
3443
+ export const QueryValue: MessageFns<QueryValue> = {
3444
+ encode(message: QueryValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3445
+ if (message.textValue !== undefined) {
3446
+ writer.uint32(10).string(message.textValue);
3447
+ }
3448
+ if (message.numberValue !== undefined) {
3449
+ if (BigInt.asIntN(64, message.numberValue) !== message.numberValue) {
3450
+ throw new globalThis.Error("value provided for field message.numberValue of type sint64 too large");
3451
+ }
3452
+ writer.uint32(16).sint64(message.numberValue);
3453
+ }
3454
+ if (message.booleanValue !== undefined) {
3455
+ writer.uint32(24).bool(message.booleanValue);
3456
+ }
3457
+ if (message.doubleValue !== undefined) {
3458
+ writer.uint32(33).double(message.doubleValue);
3459
+ }
3460
+ return writer;
3461
+ },
3462
+
3463
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryValue {
3464
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3465
+ const end = length === undefined ? reader.len : reader.pos + length;
3466
+ const message = createBaseQueryValue();
3467
+ while (reader.pos < end) {
3468
+ const tag = reader.uint32();
3469
+ switch (tag >>> 3) {
3470
+ case 1: {
3471
+ if (tag !== 10) {
3472
+ break;
3473
+ }
3474
+
3475
+ message.textValue = reader.string();
3476
+ continue;
3477
+ }
3478
+ case 2: {
3479
+ if (tag !== 16) {
3480
+ break;
3481
+ }
3482
+
3483
+ message.numberValue = reader.sint64() as bigint;
3484
+ continue;
3485
+ }
3486
+ case 3: {
3487
+ if (tag !== 24) {
3488
+ break;
3489
+ }
3490
+
3491
+ message.booleanValue = reader.bool();
3492
+ continue;
3493
+ }
3494
+ case 4: {
3495
+ if (tag !== 33) {
3496
+ break;
3497
+ }
3498
+
3499
+ message.doubleValue = reader.double();
3500
+ continue;
3501
+ }
3502
+ }
3503
+ if ((tag & 7) === 4 || tag === 0) {
3504
+ break;
3505
+ }
3506
+ reader.skip(tag & 7);
3507
+ }
3508
+ return message;
3509
+ },
3510
+
3511
+ fromJSON(object: any): QueryValue {
3512
+ return {
3513
+ textValue: isSet(object.textValue)
3514
+ ? globalThis.String(object.textValue)
3515
+ : isSet(object.text_value)
3516
+ ? globalThis.String(object.text_value)
3517
+ : undefined,
3518
+ numberValue: isSet(object.numberValue)
3519
+ ? BigInt(object.numberValue)
3520
+ : isSet(object.number_value)
3521
+ ? BigInt(object.number_value)
3522
+ : undefined,
3523
+ booleanValue: isSet(object.booleanValue)
3524
+ ? globalThis.Boolean(object.booleanValue)
3525
+ : isSet(object.boolean_value)
3526
+ ? globalThis.Boolean(object.boolean_value)
3527
+ : undefined,
3528
+ doubleValue: isSet(object.doubleValue)
3529
+ ? globalThis.Number(object.doubleValue)
3530
+ : isSet(object.double_value)
3531
+ ? globalThis.Number(object.double_value)
3532
+ : undefined,
3533
+ };
3534
+ },
3535
+
3536
+ toJSON(message: QueryValue): unknown {
3537
+ const obj: any = {};
3538
+ if (message.textValue !== undefined) {
3539
+ obj.textValue = message.textValue;
3540
+ }
3541
+ if (message.numberValue !== undefined) {
3542
+ obj.numberValue = message.numberValue.toString();
3543
+ }
3544
+ if (message.booleanValue !== undefined) {
3545
+ obj.booleanValue = message.booleanValue;
3546
+ }
3547
+ if (message.doubleValue !== undefined) {
3548
+ obj.doubleValue = message.doubleValue;
3549
+ }
3550
+ return obj;
3551
+ },
3552
+
3553
+ create(base?: DeepPartial<QueryValue>): QueryValue {
3554
+ return QueryValue.fromPartial(base ?? {});
3555
+ },
3556
+ fromPartial(object: DeepPartial<QueryValue>): QueryValue {
3557
+ const message = createBaseQueryValue();
3558
+ message.textValue = object.textValue ?? undefined;
3559
+ message.numberValue = object.numberValue ?? undefined;
3560
+ message.booleanValue = object.booleanValue ?? undefined;
3561
+ message.doubleValue = object.doubleValue ?? undefined;
3562
+ return message;
3563
+ },
3564
+ };
3565
+
3566
+ function createBasePayloadDescription(): PayloadDescription {
3567
+ return { type: "", revision: "" };
3568
+ }
3569
+
3570
+ export const PayloadDescription: MessageFns<PayloadDescription> = {
3571
+ encode(message: PayloadDescription, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3572
+ if (message.type !== "") {
3573
+ writer.uint32(10).string(message.type);
3574
+ }
3575
+ if (message.revision !== "") {
3576
+ writer.uint32(18).string(message.revision);
3577
+ }
3578
+ return writer;
3579
+ },
3580
+
3581
+ decode(input: BinaryReader | Uint8Array, length?: number): PayloadDescription {
3582
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3583
+ const end = length === undefined ? reader.len : reader.pos + length;
3584
+ const message = createBasePayloadDescription();
3585
+ while (reader.pos < end) {
3586
+ const tag = reader.uint32();
3587
+ switch (tag >>> 3) {
3588
+ case 1: {
3589
+ if (tag !== 10) {
3590
+ break;
3591
+ }
3592
+
3593
+ message.type = reader.string();
3594
+ continue;
3595
+ }
3596
+ case 2: {
3597
+ if (tag !== 18) {
3598
+ break;
3599
+ }
3600
+
3601
+ message.revision = reader.string();
3602
+ continue;
3603
+ }
3604
+ }
3605
+ if ((tag & 7) === 4 || tag === 0) {
3606
+ break;
3607
+ }
3608
+ reader.skip(tag & 7);
3609
+ }
3610
+ return message;
3611
+ },
3612
+
3613
+ fromJSON(object: any): PayloadDescription {
3614
+ return {
3615
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
3616
+ revision: isSet(object.revision) ? globalThis.String(object.revision) : "",
3617
+ };
3618
+ },
3619
+
3620
+ toJSON(message: PayloadDescription): unknown {
3621
+ const obj: any = {};
3622
+ if (message.type !== "") {
3623
+ obj.type = message.type;
3624
+ }
3625
+ if (message.revision !== "") {
3626
+ obj.revision = message.revision;
3627
+ }
3628
+ return obj;
3629
+ },
3630
+
3631
+ create(base?: DeepPartial<PayloadDescription>): PayloadDescription {
3632
+ return PayloadDescription.fromPartial(base ?? {});
3633
+ },
3634
+ fromPartial(object: DeepPartial<PayloadDescription>): PayloadDescription {
3635
+ const message = createBasePayloadDescription();
3636
+ message.type = object.type ?? "";
3637
+ message.revision = object.revision ?? "";
3638
+ return message;
3639
+ },
3640
+ };
3641
+
3642
+ /** Service providing operations against the EventStore functionality of Axon Server */
3643
+ export type EventStoreDefinition = typeof EventStoreDefinition;
3644
+ export const EventStoreDefinition = {
3645
+ name: "EventStore",
3646
+ fullName: "io.axoniq.axonserver.grpc.event.EventStore",
3647
+ methods: {
3648
+ /** Accepts a stream of Events returning a Confirmation when completed. */
3649
+ appendEvent: {
3650
+ name: "AppendEvent",
3651
+ requestType: Event as typeof Event,
3652
+ requestStream: true,
3653
+ responseType: ConfirmationWithConsistencyMarker as typeof ConfirmationWithConsistencyMarker,
3654
+ responseStream: false,
3655
+ options: {},
3656
+ },
3657
+ /** Accepts a Snapshot event returning a Confirmation when completed. */
3658
+ appendSnapshot: {
3659
+ name: "AppendSnapshot",
3660
+ requestType: Event as typeof Event,
3661
+ requestStream: false,
3662
+ responseType: Confirmation as typeof Confirmation,
3663
+ responseStream: false,
3664
+ options: {},
3665
+ },
3666
+ /** Retrieves the Events for a given aggregate. Results are streamed rather than returned at once. */
3667
+ listAggregateEvents: {
3668
+ name: "ListAggregateEvents",
3669
+ requestType: GetAggregateEventsRequest as typeof GetAggregateEventsRequest,
3670
+ requestStream: false,
3671
+ responseType: Event as typeof Event,
3672
+ responseStream: true,
3673
+ options: {},
3674
+ },
3675
+ /** Retrieves the Snapshots for a given aggregate. Results are streamed rather than returned at once. */
3676
+ listAggregateSnapshots: {
3677
+ name: "ListAggregateSnapshots",
3678
+ requestType: GetAggregateSnapshotsRequest as typeof GetAggregateSnapshotsRequest,
3679
+ requestStream: false,
3680
+ responseType: Event as typeof Event,
3681
+ responseStream: true,
3682
+ options: {},
3683
+ },
3684
+ /**
3685
+ * Retrieves the Events from a given tracking token. However, if several GetEventsRequests are sent in the stream
3686
+ * only first one will create the tracker, others are used for increasing number of permits or blacklisting. Results
3687
+ * are streamed rather than returned at once.
3688
+ */
3689
+ listEvents: {
3690
+ name: "ListEvents",
3691
+ requestType: GetEventsRequest as typeof GetEventsRequest,
3692
+ requestStream: true,
3693
+ responseType: EventWithToken as typeof EventWithToken,
3694
+ responseStream: true,
3695
+ options: {},
3696
+ },
3697
+ /** Gets the highest sequence number for a specific aggregate. */
3698
+ readHighestSequenceNr: {
3699
+ name: "ReadHighestSequenceNr",
3700
+ requestType: ReadHighestSequenceNrRequest as typeof ReadHighestSequenceNrRequest,
3701
+ requestStream: false,
3702
+ responseType: ReadHighestSequenceNrResponse as typeof ReadHighestSequenceNrResponse,
3703
+ responseStream: false,
3704
+ options: {},
3705
+ },
3706
+ /**
3707
+ * Performs a query on the event store, returns a stream of results. Input is a stream to allow flow control from the
3708
+ * client
3709
+ */
3710
+ queryEvents: {
3711
+ name: "QueryEvents",
3712
+ requestType: QueryEventsRequest as typeof QueryEventsRequest,
3713
+ requestStream: true,
3714
+ responseType: QueryEventsResponse as typeof QueryEventsResponse,
3715
+ responseStream: true,
3716
+ options: {},
3717
+ },
3718
+ /** Retrieves the first token available in event store (typically 0). Returns 0 when no events in store. */
3719
+ getFirstToken: {
3720
+ name: "GetFirstToken",
3721
+ requestType: GetFirstTokenRequest as typeof GetFirstTokenRequest,
3722
+ requestStream: false,
3723
+ responseType: TrackingToken as typeof TrackingToken,
3724
+ responseStream: false,
3725
+ options: {},
3726
+ },
3727
+ /** Retrieves the last committed token in event store. Returns -1 when no events in store. */
3728
+ getLastToken: {
3729
+ name: "GetLastToken",
3730
+ requestType: GetLastTokenRequest as typeof GetLastTokenRequest,
3731
+ requestStream: false,
3732
+ responseType: TrackingToken as typeof TrackingToken,
3733
+ responseStream: false,
3734
+ options: {},
3735
+ },
3736
+ /** Retrieves the token of the first token of an event from specified time in event store. Returns -1 when no events in store. */
3737
+ getTokenAt: {
3738
+ name: "GetTokenAt",
3739
+ requestType: GetTokenAtRequest as typeof GetTokenAtRequest,
3740
+ requestStream: false,
3741
+ responseType: TrackingToken as typeof TrackingToken,
3742
+ responseStream: false,
3743
+ options: {},
3744
+ },
3745
+ },
3746
+ } as const;
3747
+
3748
+ export interface EventStoreServiceImplementation<CallContextExt = {}> {
3749
+ /** Accepts a stream of Events returning a Confirmation when completed. */
3750
+ appendEvent(
3751
+ request: AsyncIterable<Event>,
3752
+ context: CallContext & CallContextExt,
3753
+ ): Promise<DeepPartial<ConfirmationWithConsistencyMarker>>;
3754
+ /** Accepts a Snapshot event returning a Confirmation when completed. */
3755
+ appendSnapshot(request: Event, context: CallContext & CallContextExt): Promise<DeepPartial<Confirmation>>;
3756
+ /** Retrieves the Events for a given aggregate. Results are streamed rather than returned at once. */
3757
+ listAggregateEvents(
3758
+ request: GetAggregateEventsRequest,
3759
+ context: CallContext & CallContextExt,
3760
+ ): ServerStreamingMethodResult<DeepPartial<Event>>;
3761
+ /** Retrieves the Snapshots for a given aggregate. Results are streamed rather than returned at once. */
3762
+ listAggregateSnapshots(
3763
+ request: GetAggregateSnapshotsRequest,
3764
+ context: CallContext & CallContextExt,
3765
+ ): ServerStreamingMethodResult<DeepPartial<Event>>;
3766
+ /**
3767
+ * Retrieves the Events from a given tracking token. However, if several GetEventsRequests are sent in the stream
3768
+ * only first one will create the tracker, others are used for increasing number of permits or blacklisting. Results
3769
+ * are streamed rather than returned at once.
3770
+ */
3771
+ listEvents(
3772
+ request: AsyncIterable<GetEventsRequest>,
3773
+ context: CallContext & CallContextExt,
3774
+ ): ServerStreamingMethodResult<DeepPartial<EventWithToken>>;
3775
+ /** Gets the highest sequence number for a specific aggregate. */
3776
+ readHighestSequenceNr(
3777
+ request: ReadHighestSequenceNrRequest,
3778
+ context: CallContext & CallContextExt,
3779
+ ): Promise<DeepPartial<ReadHighestSequenceNrResponse>>;
3780
+ /**
3781
+ * Performs a query on the event store, returns a stream of results. Input is a stream to allow flow control from the
3782
+ * client
3783
+ */
3784
+ queryEvents(
3785
+ request: AsyncIterable<QueryEventsRequest>,
3786
+ context: CallContext & CallContextExt,
3787
+ ): ServerStreamingMethodResult<DeepPartial<QueryEventsResponse>>;
3788
+ /** Retrieves the first token available in event store (typically 0). Returns 0 when no events in store. */
3789
+ getFirstToken(
3790
+ request: GetFirstTokenRequest,
3791
+ context: CallContext & CallContextExt,
3792
+ ): Promise<DeepPartial<TrackingToken>>;
3793
+ /** Retrieves the last committed token in event store. Returns -1 when no events in store. */
3794
+ getLastToken(
3795
+ request: GetLastTokenRequest,
3796
+ context: CallContext & CallContextExt,
3797
+ ): Promise<DeepPartial<TrackingToken>>;
3798
+ /** Retrieves the token of the first token of an event from specified time in event store. Returns -1 when no events in store. */
3799
+ getTokenAt(request: GetTokenAtRequest, context: CallContext & CallContextExt): Promise<DeepPartial<TrackingToken>>;
3800
+ }
3801
+
3802
+ export interface EventStoreClient<CallOptionsExt = {}> {
3803
+ /** Accepts a stream of Events returning a Confirmation when completed. */
3804
+ appendEvent(
3805
+ request: AsyncIterable<DeepPartial<Event>>,
3806
+ options?: CallOptions & CallOptionsExt,
3807
+ ): Promise<ConfirmationWithConsistencyMarker>;
3808
+ /** Accepts a Snapshot event returning a Confirmation when completed. */
3809
+ appendSnapshot(request: DeepPartial<Event>, options?: CallOptions & CallOptionsExt): Promise<Confirmation>;
3810
+ /** Retrieves the Events for a given aggregate. Results are streamed rather than returned at once. */
3811
+ listAggregateEvents(
3812
+ request: DeepPartial<GetAggregateEventsRequest>,
3813
+ options?: CallOptions & CallOptionsExt,
3814
+ ): AsyncIterable<Event>;
3815
+ /** Retrieves the Snapshots for a given aggregate. Results are streamed rather than returned at once. */
3816
+ listAggregateSnapshots(
3817
+ request: DeepPartial<GetAggregateSnapshotsRequest>,
3818
+ options?: CallOptions & CallOptionsExt,
3819
+ ): AsyncIterable<Event>;
3820
+ /**
3821
+ * Retrieves the Events from a given tracking token. However, if several GetEventsRequests are sent in the stream
3822
+ * only first one will create the tracker, others are used for increasing number of permits or blacklisting. Results
3823
+ * are streamed rather than returned at once.
3824
+ */
3825
+ listEvents(
3826
+ request: AsyncIterable<DeepPartial<GetEventsRequest>>,
3827
+ options?: CallOptions & CallOptionsExt,
3828
+ ): AsyncIterable<EventWithToken>;
3829
+ /** Gets the highest sequence number for a specific aggregate. */
3830
+ readHighestSequenceNr(
3831
+ request: DeepPartial<ReadHighestSequenceNrRequest>,
3832
+ options?: CallOptions & CallOptionsExt,
3833
+ ): Promise<ReadHighestSequenceNrResponse>;
3834
+ /**
3835
+ * Performs a query on the event store, returns a stream of results. Input is a stream to allow flow control from the
3836
+ * client
3837
+ */
3838
+ queryEvents(
3839
+ request: AsyncIterable<DeepPartial<QueryEventsRequest>>,
3840
+ options?: CallOptions & CallOptionsExt,
3841
+ ): AsyncIterable<QueryEventsResponse>;
3842
+ /** Retrieves the first token available in event store (typically 0). Returns 0 when no events in store. */
3843
+ getFirstToken(
3844
+ request: DeepPartial<GetFirstTokenRequest>,
3845
+ options?: CallOptions & CallOptionsExt,
3846
+ ): Promise<TrackingToken>;
3847
+ /** Retrieves the last committed token in event store. Returns -1 when no events in store. */
3848
+ getLastToken(
3849
+ request: DeepPartial<GetLastTokenRequest>,
3850
+ options?: CallOptions & CallOptionsExt,
3851
+ ): Promise<TrackingToken>;
3852
+ /** Retrieves the token of the first token of an event from specified time in event store. Returns -1 when no events in store. */
3853
+ getTokenAt(request: DeepPartial<GetTokenAtRequest>, options?: CallOptions & CallOptionsExt): Promise<TrackingToken>;
3854
+ }
3855
+
3856
+ /** Service to use AxonServer as a provider of an EventScheduler */
3857
+ export type EventSchedulerDefinition = typeof EventSchedulerDefinition;
3858
+ export const EventSchedulerDefinition = {
3859
+ name: "EventScheduler",
3860
+ fullName: "io.axoniq.axonserver.grpc.event.EventScheduler",
3861
+ methods: {
3862
+ /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to cancel the planned publication. */
3863
+ scheduleEvent: {
3864
+ name: "ScheduleEvent",
3865
+ requestType: ScheduleEventRequest as typeof ScheduleEventRequest,
3866
+ requestStream: false,
3867
+ responseType: ScheduleToken as typeof ScheduleToken,
3868
+ responseStream: false,
3869
+ options: {},
3870
+ },
3871
+ /** Cancel a scheduled event and schedule another in its place. */
3872
+ rescheduleEvent: {
3873
+ name: "RescheduleEvent",
3874
+ requestType: RescheduleEventRequest as typeof RescheduleEventRequest,
3875
+ requestStream: false,
3876
+ responseType: ScheduleToken as typeof ScheduleToken,
3877
+ responseStream: false,
3878
+ options: {},
3879
+ },
3880
+ /** Cancel the publication of a scheduled event. If the events has already been published, this method does nothing. */
3881
+ cancelScheduledEvent: {
3882
+ name: "CancelScheduledEvent",
3883
+ requestType: CancelScheduledEventRequest as typeof CancelScheduledEventRequest,
3884
+ requestStream: false,
3885
+ responseType: InstructionAck as typeof InstructionAck,
3886
+ responseStream: false,
3887
+ options: {},
3888
+ },
3889
+ },
3890
+ } as const;
3891
+
3892
+ export interface EventSchedulerServiceImplementation<CallContextExt = {}> {
3893
+ /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to cancel the planned publication. */
3894
+ scheduleEvent(
3895
+ request: ScheduleEventRequest,
3896
+ context: CallContext & CallContextExt,
3897
+ ): Promise<DeepPartial<ScheduleToken>>;
3898
+ /** Cancel a scheduled event and schedule another in its place. */
3899
+ rescheduleEvent(
3900
+ request: RescheduleEventRequest,
3901
+ context: CallContext & CallContextExt,
3902
+ ): Promise<DeepPartial<ScheduleToken>>;
3903
+ /** Cancel the publication of a scheduled event. If the events has already been published, this method does nothing. */
3904
+ cancelScheduledEvent(
3905
+ request: CancelScheduledEventRequest,
3906
+ context: CallContext & CallContextExt,
3907
+ ): Promise<DeepPartial<InstructionAck>>;
3908
+ }
3909
+
3910
+ export interface EventSchedulerClient<CallOptionsExt = {}> {
3911
+ /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to cancel the planned publication. */
3912
+ scheduleEvent(
3913
+ request: DeepPartial<ScheduleEventRequest>,
3914
+ options?: CallOptions & CallOptionsExt,
3915
+ ): Promise<ScheduleToken>;
3916
+ /** Cancel a scheduled event and schedule another in its place. */
3917
+ rescheduleEvent(
3918
+ request: DeepPartial<RescheduleEventRequest>,
3919
+ options?: CallOptions & CallOptionsExt,
3920
+ ): Promise<ScheduleToken>;
3921
+ /** Cancel the publication of a scheduled event. If the events has already been published, this method does nothing. */
3922
+ cancelScheduledEvent(
3923
+ request: DeepPartial<CancelScheduledEventRequest>,
3924
+ options?: CallOptions & CallOptionsExt,
3925
+ ): Promise<InstructionAck>;
3926
+ }
3927
+
3928
+ /** Service to transform events in an event store */
3929
+ export type EventTransformationServiceDefinition = typeof EventTransformationServiceDefinition;
3930
+ export const EventTransformationServiceDefinition = {
3931
+ name: "EventTransformationService",
3932
+ fullName: "io.axoniq.axonserver.grpc.event.EventTransformationService",
3933
+ methods: {
3934
+ /** Returns the list of all transformations. */
3935
+ transformations: {
3936
+ name: "Transformations",
3937
+ requestType: Empty as typeof Empty,
3938
+ requestStream: false,
3939
+ responseType: Transformation as typeof Transformation,
3940
+ responseStream: true,
3941
+ options: {},
3942
+ },
3943
+ /** Starts a new transformation. */
3944
+ startTransformation: {
3945
+ name: "StartTransformation",
3946
+ requestType: StartTransformationRequest as typeof StartTransformationRequest,
3947
+ requestStream: false,
3948
+ responseType: TransformationId as typeof TransformationId,
3949
+ responseStream: false,
3950
+ options: {},
3951
+ },
3952
+ /** Adds requests to transform an event to a transformation. */
3953
+ transformEvents: {
3954
+ name: "TransformEvents",
3955
+ requestType: TransformRequest as typeof TransformRequest,
3956
+ requestStream: true,
3957
+ responseType: TransformRequestAck as typeof TransformRequestAck,
3958
+ responseStream: true,
3959
+ options: {},
3960
+ },
3961
+ /** Cancels a transformation before it is applied. */
3962
+ cancelTransformation: {
3963
+ name: "CancelTransformation",
3964
+ requestType: TransformationId as typeof TransformationId,
3965
+ requestStream: false,
3966
+ responseType: Empty as typeof Empty,
3967
+ responseStream: true,
3968
+ options: {},
3969
+ },
3970
+ /** Applies the changes from a transformation in the event store. */
3971
+ applyTransformation: {
3972
+ name: "ApplyTransformation",
3973
+ requestType: ApplyTransformationRequest as typeof ApplyTransformationRequest,
3974
+ requestStream: false,
3975
+ responseType: Empty as typeof Empty,
3976
+ responseStream: true,
3977
+ options: {},
3978
+ },
3979
+ /** Deletes old versions of events updated by a transformation. */
3980
+ compact: {
3981
+ name: "Compact",
3982
+ requestType: CompactionRequest as typeof CompactionRequest,
3983
+ requestStream: false,
3984
+ responseType: Empty as typeof Empty,
3985
+ responseStream: true,
3986
+ options: {},
3987
+ },
3988
+ },
3989
+ } as const;
3990
+
3991
+ export interface EventTransformationServiceImplementation<CallContextExt = {}> {
3992
+ /** Returns the list of all transformations. */
3993
+ transformations(
3994
+ request: Empty,
3995
+ context: CallContext & CallContextExt,
3996
+ ): ServerStreamingMethodResult<DeepPartial<Transformation>>;
3997
+ /** Starts a new transformation. */
3998
+ startTransformation(
3999
+ request: StartTransformationRequest,
4000
+ context: CallContext & CallContextExt,
4001
+ ): Promise<DeepPartial<TransformationId>>;
4002
+ /** Adds requests to transform an event to a transformation. */
4003
+ transformEvents(
4004
+ request: AsyncIterable<TransformRequest>,
4005
+ context: CallContext & CallContextExt,
4006
+ ): ServerStreamingMethodResult<DeepPartial<TransformRequestAck>>;
4007
+ /** Cancels a transformation before it is applied. */
4008
+ cancelTransformation(
4009
+ request: TransformationId,
4010
+ context: CallContext & CallContextExt,
4011
+ ): ServerStreamingMethodResult<DeepPartial<Empty>>;
4012
+ /** Applies the changes from a transformation in the event store. */
4013
+ applyTransformation(
4014
+ request: ApplyTransformationRequest,
4015
+ context: CallContext & CallContextExt,
4016
+ ): ServerStreamingMethodResult<DeepPartial<Empty>>;
4017
+ /** Deletes old versions of events updated by a transformation. */
4018
+ compact(
4019
+ request: CompactionRequest,
4020
+ context: CallContext & CallContextExt,
4021
+ ): ServerStreamingMethodResult<DeepPartial<Empty>>;
4022
+ }
4023
+
4024
+ export interface EventTransformationServiceClient<CallOptionsExt = {}> {
4025
+ /** Returns the list of all transformations. */
4026
+ transformations(request: DeepPartial<Empty>, options?: CallOptions & CallOptionsExt): AsyncIterable<Transformation>;
4027
+ /** Starts a new transformation. */
4028
+ startTransformation(
4029
+ request: DeepPartial<StartTransformationRequest>,
4030
+ options?: CallOptions & CallOptionsExt,
4031
+ ): Promise<TransformationId>;
4032
+ /** Adds requests to transform an event to a transformation. */
4033
+ transformEvents(
4034
+ request: AsyncIterable<DeepPartial<TransformRequest>>,
4035
+ options?: CallOptions & CallOptionsExt,
4036
+ ): AsyncIterable<TransformRequestAck>;
4037
+ /** Cancels a transformation before it is applied. */
4038
+ cancelTransformation(
4039
+ request: DeepPartial<TransformationId>,
4040
+ options?: CallOptions & CallOptionsExt,
4041
+ ): AsyncIterable<Empty>;
4042
+ /** Applies the changes from a transformation in the event store. */
4043
+ applyTransformation(
4044
+ request: DeepPartial<ApplyTransformationRequest>,
4045
+ options?: CallOptions & CallOptionsExt,
4046
+ ): AsyncIterable<Empty>;
4047
+ /** Deletes old versions of events updated by a transformation. */
4048
+ compact(request: DeepPartial<CompactionRequest>, options?: CallOptions & CallOptionsExt): AsyncIterable<Empty>;
4049
+ }
4050
+
4051
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
4052
+
4053
+ export type DeepPartial<T> = T extends Builtin ? T
4054
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
4055
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
4056
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
4057
+ : Partial<T>;
4058
+
4059
+ function isObject(value: any): boolean {
4060
+ return typeof value === "object" && value !== null;
4061
+ }
4062
+
4063
+ function isSet(value: any): boolean {
4064
+ return value !== null && value !== undefined;
4065
+ }
4066
+
4067
+ export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };
4068
+
4069
+ export interface MessageFns<T> {
4070
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
4071
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
4072
+ fromJSON(object: any): T;
4073
+ toJSON(message: T): unknown;
4074
+ create(base?: DeepPartial<T>): T;
4075
+ fromPartial(object: DeepPartial<T>): T;
4076
+ }