@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,2943 @@
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: dcb.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { InstructionAck } from "./common.js";
9
+ export const protobufPackage = "io.axoniq.axonserver.grpc.event.dcb";
10
+ function createBaseScheduleEventRequest() {
11
+ return { instant: 0n, event: undefined };
12
+ }
13
+ export const ScheduleEventRequest = {
14
+ encode(message, writer = new BinaryWriter()) {
15
+ if (message.instant !== 0n) {
16
+ if (BigInt.asIntN(64, message.instant) !== message.instant) {
17
+ throw new globalThis.Error("value provided for field message.instant of type int64 too large");
18
+ }
19
+ writer.uint32(8).int64(message.instant);
20
+ }
21
+ if (message.event !== undefined) {
22
+ Event.encode(message.event, writer.uint32(18).fork()).join();
23
+ }
24
+ return writer;
25
+ },
26
+ decode(input, length) {
27
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
28
+ const end = length === undefined ? reader.len : reader.pos + length;
29
+ const message = createBaseScheduleEventRequest();
30
+ while (reader.pos < end) {
31
+ const tag = reader.uint32();
32
+ switch (tag >>> 3) {
33
+ case 1: {
34
+ if (tag !== 8) {
35
+ break;
36
+ }
37
+ message.instant = reader.int64();
38
+ continue;
39
+ }
40
+ case 2: {
41
+ if (tag !== 18) {
42
+ break;
43
+ }
44
+ message.event = Event.decode(reader, reader.uint32());
45
+ continue;
46
+ }
47
+ }
48
+ if ((tag & 7) === 4 || tag === 0) {
49
+ break;
50
+ }
51
+ reader.skip(tag & 7);
52
+ }
53
+ return message;
54
+ },
55
+ fromJSON(object) {
56
+ return {
57
+ instant: isSet(object.instant) ? BigInt(object.instant) : 0n,
58
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
59
+ };
60
+ },
61
+ toJSON(message) {
62
+ const obj = {};
63
+ if (message.instant !== 0n) {
64
+ obj.instant = message.instant.toString();
65
+ }
66
+ if (message.event !== undefined) {
67
+ obj.event = Event.toJSON(message.event);
68
+ }
69
+ return obj;
70
+ },
71
+ create(base) {
72
+ return ScheduleEventRequest.fromPartial(base ?? {});
73
+ },
74
+ fromPartial(object) {
75
+ const message = createBaseScheduleEventRequest();
76
+ message.instant = object.instant ?? 0n;
77
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
78
+ return message;
79
+ },
80
+ };
81
+ function createBaseRescheduleEventRequest() {
82
+ return { token: "", instant: 0n, event: undefined };
83
+ }
84
+ export const RescheduleEventRequest = {
85
+ encode(message, writer = new BinaryWriter()) {
86
+ if (message.token !== "") {
87
+ writer.uint32(10).string(message.token);
88
+ }
89
+ if (message.instant !== 0n) {
90
+ if (BigInt.asIntN(64, message.instant) !== message.instant) {
91
+ throw new globalThis.Error("value provided for field message.instant of type int64 too large");
92
+ }
93
+ writer.uint32(16).int64(message.instant);
94
+ }
95
+ if (message.event !== undefined) {
96
+ Event.encode(message.event, writer.uint32(26).fork()).join();
97
+ }
98
+ return writer;
99
+ },
100
+ decode(input, length) {
101
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
102
+ const end = length === undefined ? reader.len : reader.pos + length;
103
+ const message = createBaseRescheduleEventRequest();
104
+ while (reader.pos < end) {
105
+ const tag = reader.uint32();
106
+ switch (tag >>> 3) {
107
+ case 1: {
108
+ if (tag !== 10) {
109
+ break;
110
+ }
111
+ message.token = reader.string();
112
+ continue;
113
+ }
114
+ case 2: {
115
+ if (tag !== 16) {
116
+ break;
117
+ }
118
+ message.instant = reader.int64();
119
+ continue;
120
+ }
121
+ case 3: {
122
+ if (tag !== 26) {
123
+ break;
124
+ }
125
+ message.event = Event.decode(reader, reader.uint32());
126
+ continue;
127
+ }
128
+ }
129
+ if ((tag & 7) === 4 || tag === 0) {
130
+ break;
131
+ }
132
+ reader.skip(tag & 7);
133
+ }
134
+ return message;
135
+ },
136
+ fromJSON(object) {
137
+ return {
138
+ token: isSet(object.token) ? globalThis.String(object.token) : "",
139
+ instant: isSet(object.instant) ? BigInt(object.instant) : 0n,
140
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
141
+ };
142
+ },
143
+ toJSON(message) {
144
+ const obj = {};
145
+ if (message.token !== "") {
146
+ obj.token = message.token;
147
+ }
148
+ if (message.instant !== 0n) {
149
+ obj.instant = message.instant.toString();
150
+ }
151
+ if (message.event !== undefined) {
152
+ obj.event = Event.toJSON(message.event);
153
+ }
154
+ return obj;
155
+ },
156
+ create(base) {
157
+ return RescheduleEventRequest.fromPartial(base ?? {});
158
+ },
159
+ fromPartial(object) {
160
+ const message = createBaseRescheduleEventRequest();
161
+ message.token = object.token ?? "";
162
+ message.instant = object.instant ?? 0n;
163
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
164
+ return message;
165
+ },
166
+ };
167
+ function createBaseCancelScheduledEventRequest() {
168
+ return { token: "" };
169
+ }
170
+ export const CancelScheduledEventRequest = {
171
+ encode(message, writer = new BinaryWriter()) {
172
+ if (message.token !== "") {
173
+ writer.uint32(10).string(message.token);
174
+ }
175
+ return writer;
176
+ },
177
+ decode(input, length) {
178
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
179
+ const end = length === undefined ? reader.len : reader.pos + length;
180
+ const message = createBaseCancelScheduledEventRequest();
181
+ while (reader.pos < end) {
182
+ const tag = reader.uint32();
183
+ switch (tag >>> 3) {
184
+ case 1: {
185
+ if (tag !== 10) {
186
+ break;
187
+ }
188
+ message.token = reader.string();
189
+ continue;
190
+ }
191
+ }
192
+ if ((tag & 7) === 4 || tag === 0) {
193
+ break;
194
+ }
195
+ reader.skip(tag & 7);
196
+ }
197
+ return message;
198
+ },
199
+ fromJSON(object) {
200
+ return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
201
+ },
202
+ toJSON(message) {
203
+ const obj = {};
204
+ if (message.token !== "") {
205
+ obj.token = message.token;
206
+ }
207
+ return obj;
208
+ },
209
+ create(base) {
210
+ return CancelScheduledEventRequest.fromPartial(base ?? {});
211
+ },
212
+ fromPartial(object) {
213
+ const message = createBaseCancelScheduledEventRequest();
214
+ message.token = object.token ?? "";
215
+ return message;
216
+ },
217
+ };
218
+ function createBaseScheduleToken() {
219
+ return { token: "" };
220
+ }
221
+ export const ScheduleToken = {
222
+ encode(message, writer = new BinaryWriter()) {
223
+ if (message.token !== "") {
224
+ writer.uint32(10).string(message.token);
225
+ }
226
+ return writer;
227
+ },
228
+ decode(input, length) {
229
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
230
+ const end = length === undefined ? reader.len : reader.pos + length;
231
+ const message = createBaseScheduleToken();
232
+ while (reader.pos < end) {
233
+ const tag = reader.uint32();
234
+ switch (tag >>> 3) {
235
+ case 1: {
236
+ if (tag !== 10) {
237
+ break;
238
+ }
239
+ message.token = reader.string();
240
+ continue;
241
+ }
242
+ }
243
+ if ((tag & 7) === 4 || tag === 0) {
244
+ break;
245
+ }
246
+ reader.skip(tag & 7);
247
+ }
248
+ return message;
249
+ },
250
+ fromJSON(object) {
251
+ return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
252
+ },
253
+ toJSON(message) {
254
+ const obj = {};
255
+ if (message.token !== "") {
256
+ obj.token = message.token;
257
+ }
258
+ return obj;
259
+ },
260
+ create(base) {
261
+ return ScheduleToken.fromPartial(base ?? {});
262
+ },
263
+ fromPartial(object) {
264
+ const message = createBaseScheduleToken();
265
+ message.token = object.token ?? "";
266
+ return message;
267
+ },
268
+ };
269
+ function createBaseEvent() {
270
+ return { identifier: "", timestamp: 0n, name: "", version: "", payload: new Uint8Array(0), metadata: {} };
271
+ }
272
+ export const Event = {
273
+ encode(message, writer = new BinaryWriter()) {
274
+ if (message.identifier !== "") {
275
+ writer.uint32(10).string(message.identifier);
276
+ }
277
+ if (message.timestamp !== 0n) {
278
+ if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
279
+ throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
280
+ }
281
+ writer.uint32(16).int64(message.timestamp);
282
+ }
283
+ if (message.name !== "") {
284
+ writer.uint32(26).string(message.name);
285
+ }
286
+ if (message.version !== "") {
287
+ writer.uint32(34).string(message.version);
288
+ }
289
+ if (message.payload.length !== 0) {
290
+ writer.uint32(42).bytes(message.payload);
291
+ }
292
+ globalThis.Object.entries(message.metadata).forEach(([key, value]) => {
293
+ Event_MetadataEntry.encode({ key: key, value }, writer.uint32(50).fork()).join();
294
+ });
295
+ return writer;
296
+ },
297
+ decode(input, length) {
298
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
299
+ const end = length === undefined ? reader.len : reader.pos + length;
300
+ const message = createBaseEvent();
301
+ while (reader.pos < end) {
302
+ const tag = reader.uint32();
303
+ switch (tag >>> 3) {
304
+ case 1: {
305
+ if (tag !== 10) {
306
+ break;
307
+ }
308
+ message.identifier = reader.string();
309
+ continue;
310
+ }
311
+ case 2: {
312
+ if (tag !== 16) {
313
+ break;
314
+ }
315
+ message.timestamp = reader.int64();
316
+ continue;
317
+ }
318
+ case 3: {
319
+ if (tag !== 26) {
320
+ break;
321
+ }
322
+ message.name = reader.string();
323
+ continue;
324
+ }
325
+ case 4: {
326
+ if (tag !== 34) {
327
+ break;
328
+ }
329
+ message.version = reader.string();
330
+ continue;
331
+ }
332
+ case 5: {
333
+ if (tag !== 42) {
334
+ break;
335
+ }
336
+ message.payload = reader.bytes();
337
+ continue;
338
+ }
339
+ case 6: {
340
+ if (tag !== 50) {
341
+ break;
342
+ }
343
+ const entry6 = Event_MetadataEntry.decode(reader, reader.uint32());
344
+ if (entry6.value !== undefined) {
345
+ message.metadata[entry6.key] = entry6.value;
346
+ }
347
+ continue;
348
+ }
349
+ }
350
+ if ((tag & 7) === 4 || tag === 0) {
351
+ break;
352
+ }
353
+ reader.skip(tag & 7);
354
+ }
355
+ return message;
356
+ },
357
+ fromJSON(object) {
358
+ return {
359
+ identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
360
+ timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n,
361
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
362
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
363
+ payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0),
364
+ metadata: isObject(object.metadata)
365
+ ? globalThis.Object.entries(object.metadata).reduce((acc, [key, value]) => {
366
+ acc[key] = globalThis.String(value);
367
+ return acc;
368
+ }, {})
369
+ : {},
370
+ };
371
+ },
372
+ toJSON(message) {
373
+ const obj = {};
374
+ if (message.identifier !== "") {
375
+ obj.identifier = message.identifier;
376
+ }
377
+ if (message.timestamp !== 0n) {
378
+ obj.timestamp = message.timestamp.toString();
379
+ }
380
+ if (message.name !== "") {
381
+ obj.name = message.name;
382
+ }
383
+ if (message.version !== "") {
384
+ obj.version = message.version;
385
+ }
386
+ if (message.payload.length !== 0) {
387
+ obj.payload = base64FromBytes(message.payload);
388
+ }
389
+ if (message.metadata) {
390
+ const entries = globalThis.Object.entries(message.metadata);
391
+ if (entries.length > 0) {
392
+ obj.metadata = {};
393
+ entries.forEach(([k, v]) => {
394
+ obj.metadata[k] = v;
395
+ });
396
+ }
397
+ }
398
+ return obj;
399
+ },
400
+ create(base) {
401
+ return Event.fromPartial(base ?? {});
402
+ },
403
+ fromPartial(object) {
404
+ const message = createBaseEvent();
405
+ message.identifier = object.identifier ?? "";
406
+ message.timestamp = object.timestamp ?? 0n;
407
+ message.name = object.name ?? "";
408
+ message.version = object.version ?? "";
409
+ message.payload = object.payload ?? new Uint8Array(0);
410
+ message.metadata = globalThis.Object.entries(object.metadata ?? {}).reduce((acc, [key, value]) => {
411
+ if (value !== undefined) {
412
+ acc[key] = globalThis.String(value);
413
+ }
414
+ return acc;
415
+ }, {});
416
+ return message;
417
+ },
418
+ };
419
+ function createBaseEvent_MetadataEntry() {
420
+ return { key: "", value: "" };
421
+ }
422
+ export const Event_MetadataEntry = {
423
+ encode(message, writer = new BinaryWriter()) {
424
+ if (message.key !== "") {
425
+ writer.uint32(10).string(message.key);
426
+ }
427
+ if (message.value !== "") {
428
+ writer.uint32(18).string(message.value);
429
+ }
430
+ return writer;
431
+ },
432
+ decode(input, length) {
433
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
434
+ const end = length === undefined ? reader.len : reader.pos + length;
435
+ const message = createBaseEvent_MetadataEntry();
436
+ while (reader.pos < end) {
437
+ const tag = reader.uint32();
438
+ switch (tag >>> 3) {
439
+ case 1: {
440
+ if (tag !== 10) {
441
+ break;
442
+ }
443
+ message.key = reader.string();
444
+ continue;
445
+ }
446
+ case 2: {
447
+ if (tag !== 18) {
448
+ break;
449
+ }
450
+ message.value = reader.string();
451
+ continue;
452
+ }
453
+ }
454
+ if ((tag & 7) === 4 || tag === 0) {
455
+ break;
456
+ }
457
+ reader.skip(tag & 7);
458
+ }
459
+ return message;
460
+ },
461
+ fromJSON(object) {
462
+ return {
463
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
464
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
465
+ };
466
+ },
467
+ toJSON(message) {
468
+ const obj = {};
469
+ if (message.key !== "") {
470
+ obj.key = message.key;
471
+ }
472
+ if (message.value !== "") {
473
+ obj.value = message.value;
474
+ }
475
+ return obj;
476
+ },
477
+ create(base) {
478
+ return Event_MetadataEntry.fromPartial(base ?? {});
479
+ },
480
+ fromPartial(object) {
481
+ const message = createBaseEvent_MetadataEntry();
482
+ message.key = object.key ?? "";
483
+ message.value = object.value ?? "";
484
+ return message;
485
+ },
486
+ };
487
+ function createBaseTag() {
488
+ return { key: new Uint8Array(0), value: new Uint8Array(0) };
489
+ }
490
+ export const Tag = {
491
+ encode(message, writer = new BinaryWriter()) {
492
+ if (message.key.length !== 0) {
493
+ writer.uint32(10).bytes(message.key);
494
+ }
495
+ if (message.value.length !== 0) {
496
+ writer.uint32(18).bytes(message.value);
497
+ }
498
+ return writer;
499
+ },
500
+ decode(input, length) {
501
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
502
+ const end = length === undefined ? reader.len : reader.pos + length;
503
+ const message = createBaseTag();
504
+ while (reader.pos < end) {
505
+ const tag = reader.uint32();
506
+ switch (tag >>> 3) {
507
+ case 1: {
508
+ if (tag !== 10) {
509
+ break;
510
+ }
511
+ message.key = reader.bytes();
512
+ continue;
513
+ }
514
+ case 2: {
515
+ if (tag !== 18) {
516
+ break;
517
+ }
518
+ message.value = reader.bytes();
519
+ continue;
520
+ }
521
+ }
522
+ if ((tag & 7) === 4 || tag === 0) {
523
+ break;
524
+ }
525
+ reader.skip(tag & 7);
526
+ }
527
+ return message;
528
+ },
529
+ fromJSON(object) {
530
+ return {
531
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
532
+ value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
533
+ };
534
+ },
535
+ toJSON(message) {
536
+ const obj = {};
537
+ if (message.key.length !== 0) {
538
+ obj.key = base64FromBytes(message.key);
539
+ }
540
+ if (message.value.length !== 0) {
541
+ obj.value = base64FromBytes(message.value);
542
+ }
543
+ return obj;
544
+ },
545
+ create(base) {
546
+ return Tag.fromPartial(base ?? {});
547
+ },
548
+ fromPartial(object) {
549
+ const message = createBaseTag();
550
+ message.key = object.key ?? new Uint8Array(0);
551
+ message.value = object.value ?? new Uint8Array(0);
552
+ return message;
553
+ },
554
+ };
555
+ function createBaseTaggedEvent() {
556
+ return { event: undefined, tag: [] };
557
+ }
558
+ export const TaggedEvent = {
559
+ encode(message, writer = new BinaryWriter()) {
560
+ if (message.event !== undefined) {
561
+ Event.encode(message.event, writer.uint32(10).fork()).join();
562
+ }
563
+ for (const v of message.tag) {
564
+ Tag.encode(v, writer.uint32(18).fork()).join();
565
+ }
566
+ return writer;
567
+ },
568
+ decode(input, length) {
569
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
570
+ const end = length === undefined ? reader.len : reader.pos + length;
571
+ const message = createBaseTaggedEvent();
572
+ while (reader.pos < end) {
573
+ const tag = reader.uint32();
574
+ switch (tag >>> 3) {
575
+ case 1: {
576
+ if (tag !== 10) {
577
+ break;
578
+ }
579
+ message.event = Event.decode(reader, reader.uint32());
580
+ continue;
581
+ }
582
+ case 2: {
583
+ if (tag !== 18) {
584
+ break;
585
+ }
586
+ message.tag.push(Tag.decode(reader, reader.uint32()));
587
+ continue;
588
+ }
589
+ }
590
+ if ((tag & 7) === 4 || tag === 0) {
591
+ break;
592
+ }
593
+ reader.skip(tag & 7);
594
+ }
595
+ return message;
596
+ },
597
+ fromJSON(object) {
598
+ return {
599
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
600
+ tag: globalThis.Array.isArray(object?.tag) ? object.tag.map((e) => Tag.fromJSON(e)) : [],
601
+ };
602
+ },
603
+ toJSON(message) {
604
+ const obj = {};
605
+ if (message.event !== undefined) {
606
+ obj.event = Event.toJSON(message.event);
607
+ }
608
+ if (message.tag?.length) {
609
+ obj.tag = message.tag.map((e) => Tag.toJSON(e));
610
+ }
611
+ return obj;
612
+ },
613
+ create(base) {
614
+ return TaggedEvent.fromPartial(base ?? {});
615
+ },
616
+ fromPartial(object) {
617
+ const message = createBaseTaggedEvent();
618
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
619
+ message.tag = object.tag?.map((e) => Tag.fromPartial(e)) || [];
620
+ return message;
621
+ },
622
+ };
623
+ function createBaseSequencedEvent() {
624
+ return { sequence: 0n, event: undefined };
625
+ }
626
+ export const SequencedEvent = {
627
+ encode(message, writer = new BinaryWriter()) {
628
+ if (message.sequence !== 0n) {
629
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
630
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
631
+ }
632
+ writer.uint32(8).int64(message.sequence);
633
+ }
634
+ if (message.event !== undefined) {
635
+ Event.encode(message.event, writer.uint32(18).fork()).join();
636
+ }
637
+ return writer;
638
+ },
639
+ decode(input, length) {
640
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
641
+ const end = length === undefined ? reader.len : reader.pos + length;
642
+ const message = createBaseSequencedEvent();
643
+ while (reader.pos < end) {
644
+ const tag = reader.uint32();
645
+ switch (tag >>> 3) {
646
+ case 1: {
647
+ if (tag !== 8) {
648
+ break;
649
+ }
650
+ message.sequence = reader.int64();
651
+ continue;
652
+ }
653
+ case 2: {
654
+ if (tag !== 18) {
655
+ break;
656
+ }
657
+ message.event = Event.decode(reader, reader.uint32());
658
+ continue;
659
+ }
660
+ }
661
+ if ((tag & 7) === 4 || tag === 0) {
662
+ break;
663
+ }
664
+ reader.skip(tag & 7);
665
+ }
666
+ return message;
667
+ },
668
+ fromJSON(object) {
669
+ return {
670
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
671
+ event: isSet(object.event) ? Event.fromJSON(object.event) : undefined,
672
+ };
673
+ },
674
+ toJSON(message) {
675
+ const obj = {};
676
+ if (message.sequence !== 0n) {
677
+ obj.sequence = message.sequence.toString();
678
+ }
679
+ if (message.event !== undefined) {
680
+ obj.event = Event.toJSON(message.event);
681
+ }
682
+ return obj;
683
+ },
684
+ create(base) {
685
+ return SequencedEvent.fromPartial(base ?? {});
686
+ },
687
+ fromPartial(object) {
688
+ const message = createBaseSequencedEvent();
689
+ message.sequence = object.sequence ?? 0n;
690
+ message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined;
691
+ return message;
692
+ },
693
+ };
694
+ function createBaseAppendEventsRequest() {
695
+ return { condition: undefined, event: [] };
696
+ }
697
+ export const AppendEventsRequest = {
698
+ encode(message, writer = new BinaryWriter()) {
699
+ if (message.condition !== undefined) {
700
+ ConsistencyCondition.encode(message.condition, writer.uint32(10).fork()).join();
701
+ }
702
+ for (const v of message.event) {
703
+ TaggedEvent.encode(v, writer.uint32(18).fork()).join();
704
+ }
705
+ return writer;
706
+ },
707
+ decode(input, length) {
708
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
709
+ const end = length === undefined ? reader.len : reader.pos + length;
710
+ const message = createBaseAppendEventsRequest();
711
+ while (reader.pos < end) {
712
+ const tag = reader.uint32();
713
+ switch (tag >>> 3) {
714
+ case 1: {
715
+ if (tag !== 10) {
716
+ break;
717
+ }
718
+ message.condition = ConsistencyCondition.decode(reader, reader.uint32());
719
+ continue;
720
+ }
721
+ case 2: {
722
+ if (tag !== 18) {
723
+ break;
724
+ }
725
+ message.event.push(TaggedEvent.decode(reader, reader.uint32()));
726
+ continue;
727
+ }
728
+ }
729
+ if ((tag & 7) === 4 || tag === 0) {
730
+ break;
731
+ }
732
+ reader.skip(tag & 7);
733
+ }
734
+ return message;
735
+ },
736
+ fromJSON(object) {
737
+ return {
738
+ condition: isSet(object.condition) ? ConsistencyCondition.fromJSON(object.condition) : undefined,
739
+ event: globalThis.Array.isArray(object?.event) ? object.event.map((e) => TaggedEvent.fromJSON(e)) : [],
740
+ };
741
+ },
742
+ toJSON(message) {
743
+ const obj = {};
744
+ if (message.condition !== undefined) {
745
+ obj.condition = ConsistencyCondition.toJSON(message.condition);
746
+ }
747
+ if (message.event?.length) {
748
+ obj.event = message.event.map((e) => TaggedEvent.toJSON(e));
749
+ }
750
+ return obj;
751
+ },
752
+ create(base) {
753
+ return AppendEventsRequest.fromPartial(base ?? {});
754
+ },
755
+ fromPartial(object) {
756
+ const message = createBaseAppendEventsRequest();
757
+ message.condition = (object.condition !== undefined && object.condition !== null)
758
+ ? ConsistencyCondition.fromPartial(object.condition)
759
+ : undefined;
760
+ message.event = object.event?.map((e) => TaggedEvent.fromPartial(e)) || [];
761
+ return message;
762
+ },
763
+ };
764
+ function createBaseAppendEventsResponse() {
765
+ return { sequenceOfTheFirstEvent: 0n, transactionSize: 0, consistencyMarker: 0n };
766
+ }
767
+ export const AppendEventsResponse = {
768
+ encode(message, writer = new BinaryWriter()) {
769
+ if (message.sequenceOfTheFirstEvent !== 0n) {
770
+ if (BigInt.asIntN(64, message.sequenceOfTheFirstEvent) !== message.sequenceOfTheFirstEvent) {
771
+ throw new globalThis.Error("value provided for field message.sequenceOfTheFirstEvent of type int64 too large");
772
+ }
773
+ writer.uint32(8).int64(message.sequenceOfTheFirstEvent);
774
+ }
775
+ if (message.transactionSize !== 0) {
776
+ writer.uint32(16).int32(message.transactionSize);
777
+ }
778
+ if (message.consistencyMarker !== 0n) {
779
+ if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
780
+ throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
781
+ }
782
+ writer.uint32(24).int64(message.consistencyMarker);
783
+ }
784
+ return writer;
785
+ },
786
+ decode(input, length) {
787
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
788
+ const end = length === undefined ? reader.len : reader.pos + length;
789
+ const message = createBaseAppendEventsResponse();
790
+ while (reader.pos < end) {
791
+ const tag = reader.uint32();
792
+ switch (tag >>> 3) {
793
+ case 1: {
794
+ if (tag !== 8) {
795
+ break;
796
+ }
797
+ message.sequenceOfTheFirstEvent = reader.int64();
798
+ continue;
799
+ }
800
+ case 2: {
801
+ if (tag !== 16) {
802
+ break;
803
+ }
804
+ message.transactionSize = reader.int32();
805
+ continue;
806
+ }
807
+ case 3: {
808
+ if (tag !== 24) {
809
+ break;
810
+ }
811
+ message.consistencyMarker = reader.int64();
812
+ continue;
813
+ }
814
+ }
815
+ if ((tag & 7) === 4 || tag === 0) {
816
+ break;
817
+ }
818
+ reader.skip(tag & 7);
819
+ }
820
+ return message;
821
+ },
822
+ fromJSON(object) {
823
+ return {
824
+ sequenceOfTheFirstEvent: isSet(object.sequenceOfTheFirstEvent)
825
+ ? BigInt(object.sequenceOfTheFirstEvent)
826
+ : isSet(object.sequence_of_the_first_event)
827
+ ? BigInt(object.sequence_of_the_first_event)
828
+ : 0n,
829
+ transactionSize: isSet(object.transactionSize)
830
+ ? globalThis.Number(object.transactionSize)
831
+ : isSet(object.transaction_size)
832
+ ? globalThis.Number(object.transaction_size)
833
+ : 0,
834
+ consistencyMarker: isSet(object.consistencyMarker)
835
+ ? BigInt(object.consistencyMarker)
836
+ : isSet(object.consistency_marker)
837
+ ? BigInt(object.consistency_marker)
838
+ : 0n,
839
+ };
840
+ },
841
+ toJSON(message) {
842
+ const obj = {};
843
+ if (message.sequenceOfTheFirstEvent !== 0n) {
844
+ obj.sequenceOfTheFirstEvent = message.sequenceOfTheFirstEvent.toString();
845
+ }
846
+ if (message.transactionSize !== 0) {
847
+ obj.transactionSize = Math.round(message.transactionSize);
848
+ }
849
+ if (message.consistencyMarker !== 0n) {
850
+ obj.consistencyMarker = message.consistencyMarker.toString();
851
+ }
852
+ return obj;
853
+ },
854
+ create(base) {
855
+ return AppendEventsResponse.fromPartial(base ?? {});
856
+ },
857
+ fromPartial(object) {
858
+ const message = createBaseAppendEventsResponse();
859
+ message.sequenceOfTheFirstEvent = object.sequenceOfTheFirstEvent ?? 0n;
860
+ message.transactionSize = object.transactionSize ?? 0;
861
+ message.consistencyMarker = object.consistencyMarker ?? 0n;
862
+ return message;
863
+ },
864
+ };
865
+ function createBaseSourceEventsRequest() {
866
+ return { fromSequence: 0n, criterion: [] };
867
+ }
868
+ export const SourceEventsRequest = {
869
+ encode(message, writer = new BinaryWriter()) {
870
+ if (message.fromSequence !== 0n) {
871
+ if (BigInt.asIntN(64, message.fromSequence) !== message.fromSequence) {
872
+ throw new globalThis.Error("value provided for field message.fromSequence of type int64 too large");
873
+ }
874
+ writer.uint32(8).int64(message.fromSequence);
875
+ }
876
+ for (const v of message.criterion) {
877
+ Criterion.encode(v, writer.uint32(18).fork()).join();
878
+ }
879
+ return writer;
880
+ },
881
+ decode(input, length) {
882
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
883
+ const end = length === undefined ? reader.len : reader.pos + length;
884
+ const message = createBaseSourceEventsRequest();
885
+ while (reader.pos < end) {
886
+ const tag = reader.uint32();
887
+ switch (tag >>> 3) {
888
+ case 1: {
889
+ if (tag !== 8) {
890
+ break;
891
+ }
892
+ message.fromSequence = reader.int64();
893
+ continue;
894
+ }
895
+ case 2: {
896
+ if (tag !== 18) {
897
+ break;
898
+ }
899
+ message.criterion.push(Criterion.decode(reader, reader.uint32()));
900
+ continue;
901
+ }
902
+ }
903
+ if ((tag & 7) === 4 || tag === 0) {
904
+ break;
905
+ }
906
+ reader.skip(tag & 7);
907
+ }
908
+ return message;
909
+ },
910
+ fromJSON(object) {
911
+ return {
912
+ fromSequence: isSet(object.fromSequence)
913
+ ? BigInt(object.fromSequence)
914
+ : isSet(object.from_sequence)
915
+ ? BigInt(object.from_sequence)
916
+ : 0n,
917
+ criterion: globalThis.Array.isArray(object?.criterion)
918
+ ? object.criterion.map((e) => Criterion.fromJSON(e))
919
+ : [],
920
+ };
921
+ },
922
+ toJSON(message) {
923
+ const obj = {};
924
+ if (message.fromSequence !== 0n) {
925
+ obj.fromSequence = message.fromSequence.toString();
926
+ }
927
+ if (message.criterion?.length) {
928
+ obj.criterion = message.criterion.map((e) => Criterion.toJSON(e));
929
+ }
930
+ return obj;
931
+ },
932
+ create(base) {
933
+ return SourceEventsRequest.fromPartial(base ?? {});
934
+ },
935
+ fromPartial(object) {
936
+ const message = createBaseSourceEventsRequest();
937
+ message.fromSequence = object.fromSequence ?? 0n;
938
+ message.criterion = object.criterion?.map((e) => Criterion.fromPartial(e)) || [];
939
+ return message;
940
+ },
941
+ };
942
+ function createBaseSourceEventsResponse() {
943
+ return { event: undefined, consistencyMarker: undefined };
944
+ }
945
+ export const SourceEventsResponse = {
946
+ encode(message, writer = new BinaryWriter()) {
947
+ if (message.event !== undefined) {
948
+ SequencedEvent.encode(message.event, writer.uint32(10).fork()).join();
949
+ }
950
+ if (message.consistencyMarker !== undefined) {
951
+ if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
952
+ throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
953
+ }
954
+ writer.uint32(16).int64(message.consistencyMarker);
955
+ }
956
+ return writer;
957
+ },
958
+ decode(input, length) {
959
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
960
+ const end = length === undefined ? reader.len : reader.pos + length;
961
+ const message = createBaseSourceEventsResponse();
962
+ while (reader.pos < end) {
963
+ const tag = reader.uint32();
964
+ switch (tag >>> 3) {
965
+ case 1: {
966
+ if (tag !== 10) {
967
+ break;
968
+ }
969
+ message.event = SequencedEvent.decode(reader, reader.uint32());
970
+ continue;
971
+ }
972
+ case 2: {
973
+ if (tag !== 16) {
974
+ break;
975
+ }
976
+ message.consistencyMarker = reader.int64();
977
+ continue;
978
+ }
979
+ }
980
+ if ((tag & 7) === 4 || tag === 0) {
981
+ break;
982
+ }
983
+ reader.skip(tag & 7);
984
+ }
985
+ return message;
986
+ },
987
+ fromJSON(object) {
988
+ return {
989
+ event: isSet(object.event) ? SequencedEvent.fromJSON(object.event) : undefined,
990
+ consistencyMarker: isSet(object.consistencyMarker)
991
+ ? BigInt(object.consistencyMarker)
992
+ : isSet(object.consistency_marker)
993
+ ? BigInt(object.consistency_marker)
994
+ : undefined,
995
+ };
996
+ },
997
+ toJSON(message) {
998
+ const obj = {};
999
+ if (message.event !== undefined) {
1000
+ obj.event = SequencedEvent.toJSON(message.event);
1001
+ }
1002
+ if (message.consistencyMarker !== undefined) {
1003
+ obj.consistencyMarker = message.consistencyMarker.toString();
1004
+ }
1005
+ return obj;
1006
+ },
1007
+ create(base) {
1008
+ return SourceEventsResponse.fromPartial(base ?? {});
1009
+ },
1010
+ fromPartial(object) {
1011
+ const message = createBaseSourceEventsResponse();
1012
+ message.event = (object.event !== undefined && object.event !== null)
1013
+ ? SequencedEvent.fromPartial(object.event)
1014
+ : undefined;
1015
+ message.consistencyMarker = object.consistencyMarker ?? undefined;
1016
+ return message;
1017
+ },
1018
+ };
1019
+ function createBaseConsistencyCondition() {
1020
+ return { consistencyMarker: 0n, criterion: [] };
1021
+ }
1022
+ export const ConsistencyCondition = {
1023
+ encode(message, writer = new BinaryWriter()) {
1024
+ if (message.consistencyMarker !== 0n) {
1025
+ if (BigInt.asIntN(64, message.consistencyMarker) !== message.consistencyMarker) {
1026
+ throw new globalThis.Error("value provided for field message.consistencyMarker of type int64 too large");
1027
+ }
1028
+ writer.uint32(8).int64(message.consistencyMarker);
1029
+ }
1030
+ for (const v of message.criterion) {
1031
+ Criterion.encode(v, writer.uint32(18).fork()).join();
1032
+ }
1033
+ return writer;
1034
+ },
1035
+ decode(input, length) {
1036
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1037
+ const end = length === undefined ? reader.len : reader.pos + length;
1038
+ const message = createBaseConsistencyCondition();
1039
+ while (reader.pos < end) {
1040
+ const tag = reader.uint32();
1041
+ switch (tag >>> 3) {
1042
+ case 1: {
1043
+ if (tag !== 8) {
1044
+ break;
1045
+ }
1046
+ message.consistencyMarker = reader.int64();
1047
+ continue;
1048
+ }
1049
+ case 2: {
1050
+ if (tag !== 18) {
1051
+ break;
1052
+ }
1053
+ message.criterion.push(Criterion.decode(reader, reader.uint32()));
1054
+ continue;
1055
+ }
1056
+ }
1057
+ if ((tag & 7) === 4 || tag === 0) {
1058
+ break;
1059
+ }
1060
+ reader.skip(tag & 7);
1061
+ }
1062
+ return message;
1063
+ },
1064
+ fromJSON(object) {
1065
+ return {
1066
+ consistencyMarker: isSet(object.consistencyMarker)
1067
+ ? BigInt(object.consistencyMarker)
1068
+ : isSet(object.consistency_marker)
1069
+ ? BigInt(object.consistency_marker)
1070
+ : 0n,
1071
+ criterion: globalThis.Array.isArray(object?.criterion)
1072
+ ? object.criterion.map((e) => Criterion.fromJSON(e))
1073
+ : [],
1074
+ };
1075
+ },
1076
+ toJSON(message) {
1077
+ const obj = {};
1078
+ if (message.consistencyMarker !== 0n) {
1079
+ obj.consistencyMarker = message.consistencyMarker.toString();
1080
+ }
1081
+ if (message.criterion?.length) {
1082
+ obj.criterion = message.criterion.map((e) => Criterion.toJSON(e));
1083
+ }
1084
+ return obj;
1085
+ },
1086
+ create(base) {
1087
+ return ConsistencyCondition.fromPartial(base ?? {});
1088
+ },
1089
+ fromPartial(object) {
1090
+ const message = createBaseConsistencyCondition();
1091
+ message.consistencyMarker = object.consistencyMarker ?? 0n;
1092
+ message.criterion = object.criterion?.map((e) => Criterion.fromPartial(e)) || [];
1093
+ return message;
1094
+ },
1095
+ };
1096
+ function createBaseCriterion() {
1097
+ return { tagsAndNames: undefined };
1098
+ }
1099
+ export const Criterion = {
1100
+ encode(message, writer = new BinaryWriter()) {
1101
+ if (message.tagsAndNames !== undefined) {
1102
+ TagsAndNamesCriterion.encode(message.tagsAndNames, writer.uint32(10).fork()).join();
1103
+ }
1104
+ return writer;
1105
+ },
1106
+ decode(input, length) {
1107
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1108
+ const end = length === undefined ? reader.len : reader.pos + length;
1109
+ const message = createBaseCriterion();
1110
+ while (reader.pos < end) {
1111
+ const tag = reader.uint32();
1112
+ switch (tag >>> 3) {
1113
+ case 1: {
1114
+ if (tag !== 10) {
1115
+ break;
1116
+ }
1117
+ message.tagsAndNames = TagsAndNamesCriterion.decode(reader, reader.uint32());
1118
+ continue;
1119
+ }
1120
+ }
1121
+ if ((tag & 7) === 4 || tag === 0) {
1122
+ break;
1123
+ }
1124
+ reader.skip(tag & 7);
1125
+ }
1126
+ return message;
1127
+ },
1128
+ fromJSON(object) {
1129
+ return {
1130
+ tagsAndNames: isSet(object.tagsAndNames)
1131
+ ? TagsAndNamesCriterion.fromJSON(object.tagsAndNames)
1132
+ : isSet(object.tags_and_names)
1133
+ ? TagsAndNamesCriterion.fromJSON(object.tags_and_names)
1134
+ : undefined,
1135
+ };
1136
+ },
1137
+ toJSON(message) {
1138
+ const obj = {};
1139
+ if (message.tagsAndNames !== undefined) {
1140
+ obj.tagsAndNames = TagsAndNamesCriterion.toJSON(message.tagsAndNames);
1141
+ }
1142
+ return obj;
1143
+ },
1144
+ create(base) {
1145
+ return Criterion.fromPartial(base ?? {});
1146
+ },
1147
+ fromPartial(object) {
1148
+ const message = createBaseCriterion();
1149
+ message.tagsAndNames = (object.tagsAndNames !== undefined && object.tagsAndNames !== null)
1150
+ ? TagsAndNamesCriterion.fromPartial(object.tagsAndNames)
1151
+ : undefined;
1152
+ return message;
1153
+ },
1154
+ };
1155
+ function createBaseTagsAndNamesCriterion() {
1156
+ return { name: [], tag: [] };
1157
+ }
1158
+ export const TagsAndNamesCriterion = {
1159
+ encode(message, writer = new BinaryWriter()) {
1160
+ for (const v of message.name) {
1161
+ writer.uint32(10).string(v);
1162
+ }
1163
+ for (const v of message.tag) {
1164
+ Tag.encode(v, writer.uint32(18).fork()).join();
1165
+ }
1166
+ return writer;
1167
+ },
1168
+ decode(input, length) {
1169
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1170
+ const end = length === undefined ? reader.len : reader.pos + length;
1171
+ const message = createBaseTagsAndNamesCriterion();
1172
+ while (reader.pos < end) {
1173
+ const tag = reader.uint32();
1174
+ switch (tag >>> 3) {
1175
+ case 1: {
1176
+ if (tag !== 10) {
1177
+ break;
1178
+ }
1179
+ message.name.push(reader.string());
1180
+ continue;
1181
+ }
1182
+ case 2: {
1183
+ if (tag !== 18) {
1184
+ break;
1185
+ }
1186
+ message.tag.push(Tag.decode(reader, reader.uint32()));
1187
+ continue;
1188
+ }
1189
+ }
1190
+ if ((tag & 7) === 4 || tag === 0) {
1191
+ break;
1192
+ }
1193
+ reader.skip(tag & 7);
1194
+ }
1195
+ return message;
1196
+ },
1197
+ fromJSON(object) {
1198
+ return {
1199
+ name: globalThis.Array.isArray(object?.name) ? object.name.map((e) => globalThis.String(e)) : [],
1200
+ tag: globalThis.Array.isArray(object?.tag) ? object.tag.map((e) => Tag.fromJSON(e)) : [],
1201
+ };
1202
+ },
1203
+ toJSON(message) {
1204
+ const obj = {};
1205
+ if (message.name?.length) {
1206
+ obj.name = message.name;
1207
+ }
1208
+ if (message.tag?.length) {
1209
+ obj.tag = message.tag.map((e) => Tag.toJSON(e));
1210
+ }
1211
+ return obj;
1212
+ },
1213
+ create(base) {
1214
+ return TagsAndNamesCriterion.fromPartial(base ?? {});
1215
+ },
1216
+ fromPartial(object) {
1217
+ const message = createBaseTagsAndNamesCriterion();
1218
+ message.name = object.name?.map((e) => e) || [];
1219
+ message.tag = object.tag?.map((e) => Tag.fromPartial(e)) || [];
1220
+ return message;
1221
+ },
1222
+ };
1223
+ function createBaseStreamEventsRequest() {
1224
+ return { fromSequence: 0n, criterion: [] };
1225
+ }
1226
+ export const StreamEventsRequest = {
1227
+ encode(message, writer = new BinaryWriter()) {
1228
+ if (message.fromSequence !== 0n) {
1229
+ if (BigInt.asIntN(64, message.fromSequence) !== message.fromSequence) {
1230
+ throw new globalThis.Error("value provided for field message.fromSequence of type int64 too large");
1231
+ }
1232
+ writer.uint32(8).int64(message.fromSequence);
1233
+ }
1234
+ for (const v of message.criterion) {
1235
+ Criterion.encode(v, writer.uint32(18).fork()).join();
1236
+ }
1237
+ return writer;
1238
+ },
1239
+ decode(input, length) {
1240
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1241
+ const end = length === undefined ? reader.len : reader.pos + length;
1242
+ const message = createBaseStreamEventsRequest();
1243
+ while (reader.pos < end) {
1244
+ const tag = reader.uint32();
1245
+ switch (tag >>> 3) {
1246
+ case 1: {
1247
+ if (tag !== 8) {
1248
+ break;
1249
+ }
1250
+ message.fromSequence = reader.int64();
1251
+ continue;
1252
+ }
1253
+ case 2: {
1254
+ if (tag !== 18) {
1255
+ break;
1256
+ }
1257
+ message.criterion.push(Criterion.decode(reader, reader.uint32()));
1258
+ continue;
1259
+ }
1260
+ }
1261
+ if ((tag & 7) === 4 || tag === 0) {
1262
+ break;
1263
+ }
1264
+ reader.skip(tag & 7);
1265
+ }
1266
+ return message;
1267
+ },
1268
+ fromJSON(object) {
1269
+ return {
1270
+ fromSequence: isSet(object.fromSequence)
1271
+ ? BigInt(object.fromSequence)
1272
+ : isSet(object.from_sequence)
1273
+ ? BigInt(object.from_sequence)
1274
+ : 0n,
1275
+ criterion: globalThis.Array.isArray(object?.criterion)
1276
+ ? object.criterion.map((e) => Criterion.fromJSON(e))
1277
+ : [],
1278
+ };
1279
+ },
1280
+ toJSON(message) {
1281
+ const obj = {};
1282
+ if (message.fromSequence !== 0n) {
1283
+ obj.fromSequence = message.fromSequence.toString();
1284
+ }
1285
+ if (message.criterion?.length) {
1286
+ obj.criterion = message.criterion.map((e) => Criterion.toJSON(e));
1287
+ }
1288
+ return obj;
1289
+ },
1290
+ create(base) {
1291
+ return StreamEventsRequest.fromPartial(base ?? {});
1292
+ },
1293
+ fromPartial(object) {
1294
+ const message = createBaseStreamEventsRequest();
1295
+ message.fromSequence = object.fromSequence ?? 0n;
1296
+ message.criterion = object.criterion?.map((e) => Criterion.fromPartial(e)) || [];
1297
+ return message;
1298
+ },
1299
+ };
1300
+ function createBaseStreamEventsResponse() {
1301
+ return { event: undefined };
1302
+ }
1303
+ export const StreamEventsResponse = {
1304
+ encode(message, writer = new BinaryWriter()) {
1305
+ if (message.event !== undefined) {
1306
+ SequencedEvent.encode(message.event, writer.uint32(10).fork()).join();
1307
+ }
1308
+ return writer;
1309
+ },
1310
+ decode(input, length) {
1311
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1312
+ const end = length === undefined ? reader.len : reader.pos + length;
1313
+ const message = createBaseStreamEventsResponse();
1314
+ while (reader.pos < end) {
1315
+ const tag = reader.uint32();
1316
+ switch (tag >>> 3) {
1317
+ case 1: {
1318
+ if (tag !== 10) {
1319
+ break;
1320
+ }
1321
+ message.event = SequencedEvent.decode(reader, reader.uint32());
1322
+ continue;
1323
+ }
1324
+ }
1325
+ if ((tag & 7) === 4 || tag === 0) {
1326
+ break;
1327
+ }
1328
+ reader.skip(tag & 7);
1329
+ }
1330
+ return message;
1331
+ },
1332
+ fromJSON(object) {
1333
+ return { event: isSet(object.event) ? SequencedEvent.fromJSON(object.event) : undefined };
1334
+ },
1335
+ toJSON(message) {
1336
+ const obj = {};
1337
+ if (message.event !== undefined) {
1338
+ obj.event = SequencedEvent.toJSON(message.event);
1339
+ }
1340
+ return obj;
1341
+ },
1342
+ create(base) {
1343
+ return StreamEventsResponse.fromPartial(base ?? {});
1344
+ },
1345
+ fromPartial(object) {
1346
+ const message = createBaseStreamEventsResponse();
1347
+ message.event = (object.event !== undefined && object.event !== null)
1348
+ ? SequencedEvent.fromPartial(object.event)
1349
+ : undefined;
1350
+ return message;
1351
+ },
1352
+ };
1353
+ function createBaseGetHeadRequest() {
1354
+ return {};
1355
+ }
1356
+ export const GetHeadRequest = {
1357
+ encode(_, writer = new BinaryWriter()) {
1358
+ return writer;
1359
+ },
1360
+ decode(input, length) {
1361
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1362
+ const end = length === undefined ? reader.len : reader.pos + length;
1363
+ const message = createBaseGetHeadRequest();
1364
+ while (reader.pos < end) {
1365
+ const tag = reader.uint32();
1366
+ switch (tag >>> 3) {
1367
+ }
1368
+ if ((tag & 7) === 4 || tag === 0) {
1369
+ break;
1370
+ }
1371
+ reader.skip(tag & 7);
1372
+ }
1373
+ return message;
1374
+ },
1375
+ fromJSON(_) {
1376
+ return {};
1377
+ },
1378
+ toJSON(_) {
1379
+ const obj = {};
1380
+ return obj;
1381
+ },
1382
+ create(base) {
1383
+ return GetHeadRequest.fromPartial(base ?? {});
1384
+ },
1385
+ fromPartial(_) {
1386
+ const message = createBaseGetHeadRequest();
1387
+ return message;
1388
+ },
1389
+ };
1390
+ function createBaseGetHeadResponse() {
1391
+ return { sequence: 0n };
1392
+ }
1393
+ export const GetHeadResponse = {
1394
+ encode(message, writer = new BinaryWriter()) {
1395
+ if (message.sequence !== 0n) {
1396
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1397
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1398
+ }
1399
+ writer.uint32(8).int64(message.sequence);
1400
+ }
1401
+ return writer;
1402
+ },
1403
+ decode(input, length) {
1404
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1405
+ const end = length === undefined ? reader.len : reader.pos + length;
1406
+ const message = createBaseGetHeadResponse();
1407
+ while (reader.pos < end) {
1408
+ const tag = reader.uint32();
1409
+ switch (tag >>> 3) {
1410
+ case 1: {
1411
+ if (tag !== 8) {
1412
+ break;
1413
+ }
1414
+ message.sequence = reader.int64();
1415
+ continue;
1416
+ }
1417
+ }
1418
+ if ((tag & 7) === 4 || tag === 0) {
1419
+ break;
1420
+ }
1421
+ reader.skip(tag & 7);
1422
+ }
1423
+ return message;
1424
+ },
1425
+ fromJSON(object) {
1426
+ return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
1427
+ },
1428
+ toJSON(message) {
1429
+ const obj = {};
1430
+ if (message.sequence !== 0n) {
1431
+ obj.sequence = message.sequence.toString();
1432
+ }
1433
+ return obj;
1434
+ },
1435
+ create(base) {
1436
+ return GetHeadResponse.fromPartial(base ?? {});
1437
+ },
1438
+ fromPartial(object) {
1439
+ const message = createBaseGetHeadResponse();
1440
+ message.sequence = object.sequence ?? 0n;
1441
+ return message;
1442
+ },
1443
+ };
1444
+ function createBaseGetTailRequest() {
1445
+ return {};
1446
+ }
1447
+ export const GetTailRequest = {
1448
+ encode(_, writer = new BinaryWriter()) {
1449
+ return writer;
1450
+ },
1451
+ decode(input, length) {
1452
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1453
+ const end = length === undefined ? reader.len : reader.pos + length;
1454
+ const message = createBaseGetTailRequest();
1455
+ while (reader.pos < end) {
1456
+ const tag = reader.uint32();
1457
+ switch (tag >>> 3) {
1458
+ }
1459
+ if ((tag & 7) === 4 || tag === 0) {
1460
+ break;
1461
+ }
1462
+ reader.skip(tag & 7);
1463
+ }
1464
+ return message;
1465
+ },
1466
+ fromJSON(_) {
1467
+ return {};
1468
+ },
1469
+ toJSON(_) {
1470
+ const obj = {};
1471
+ return obj;
1472
+ },
1473
+ create(base) {
1474
+ return GetTailRequest.fromPartial(base ?? {});
1475
+ },
1476
+ fromPartial(_) {
1477
+ const message = createBaseGetTailRequest();
1478
+ return message;
1479
+ },
1480
+ };
1481
+ function createBaseGetTailResponse() {
1482
+ return { sequence: 0n };
1483
+ }
1484
+ export const GetTailResponse = {
1485
+ encode(message, writer = new BinaryWriter()) {
1486
+ if (message.sequence !== 0n) {
1487
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1488
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1489
+ }
1490
+ writer.uint32(8).int64(message.sequence);
1491
+ }
1492
+ return writer;
1493
+ },
1494
+ decode(input, length) {
1495
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1496
+ const end = length === undefined ? reader.len : reader.pos + length;
1497
+ const message = createBaseGetTailResponse();
1498
+ while (reader.pos < end) {
1499
+ const tag = reader.uint32();
1500
+ switch (tag >>> 3) {
1501
+ case 1: {
1502
+ if (tag !== 8) {
1503
+ break;
1504
+ }
1505
+ message.sequence = reader.int64();
1506
+ continue;
1507
+ }
1508
+ }
1509
+ if ((tag & 7) === 4 || tag === 0) {
1510
+ break;
1511
+ }
1512
+ reader.skip(tag & 7);
1513
+ }
1514
+ return message;
1515
+ },
1516
+ fromJSON(object) {
1517
+ return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
1518
+ },
1519
+ toJSON(message) {
1520
+ const obj = {};
1521
+ if (message.sequence !== 0n) {
1522
+ obj.sequence = message.sequence.toString();
1523
+ }
1524
+ return obj;
1525
+ },
1526
+ create(base) {
1527
+ return GetTailResponse.fromPartial(base ?? {});
1528
+ },
1529
+ fromPartial(object) {
1530
+ const message = createBaseGetTailResponse();
1531
+ message.sequence = object.sequence ?? 0n;
1532
+ return message;
1533
+ },
1534
+ };
1535
+ function createBaseGetSequenceAtRequest() {
1536
+ return { timestamp: 0n };
1537
+ }
1538
+ export const GetSequenceAtRequest = {
1539
+ encode(message, writer = new BinaryWriter()) {
1540
+ if (message.timestamp !== 0n) {
1541
+ if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
1542
+ throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
1543
+ }
1544
+ writer.uint32(8).int64(message.timestamp);
1545
+ }
1546
+ return writer;
1547
+ },
1548
+ decode(input, length) {
1549
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1550
+ const end = length === undefined ? reader.len : reader.pos + length;
1551
+ const message = createBaseGetSequenceAtRequest();
1552
+ while (reader.pos < end) {
1553
+ const tag = reader.uint32();
1554
+ switch (tag >>> 3) {
1555
+ case 1: {
1556
+ if (tag !== 8) {
1557
+ break;
1558
+ }
1559
+ message.timestamp = reader.int64();
1560
+ continue;
1561
+ }
1562
+ }
1563
+ if ((tag & 7) === 4 || tag === 0) {
1564
+ break;
1565
+ }
1566
+ reader.skip(tag & 7);
1567
+ }
1568
+ return message;
1569
+ },
1570
+ fromJSON(object) {
1571
+ return { timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n };
1572
+ },
1573
+ toJSON(message) {
1574
+ const obj = {};
1575
+ if (message.timestamp !== 0n) {
1576
+ obj.timestamp = message.timestamp.toString();
1577
+ }
1578
+ return obj;
1579
+ },
1580
+ create(base) {
1581
+ return GetSequenceAtRequest.fromPartial(base ?? {});
1582
+ },
1583
+ fromPartial(object) {
1584
+ const message = createBaseGetSequenceAtRequest();
1585
+ message.timestamp = object.timestamp ?? 0n;
1586
+ return message;
1587
+ },
1588
+ };
1589
+ function createBaseGetSequenceAtResponse() {
1590
+ return { sequence: 0n };
1591
+ }
1592
+ export const GetSequenceAtResponse = {
1593
+ encode(message, writer = new BinaryWriter()) {
1594
+ if (message.sequence !== 0n) {
1595
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1596
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1597
+ }
1598
+ writer.uint32(8).int64(message.sequence);
1599
+ }
1600
+ return writer;
1601
+ },
1602
+ decode(input, length) {
1603
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1604
+ const end = length === undefined ? reader.len : reader.pos + length;
1605
+ const message = createBaseGetSequenceAtResponse();
1606
+ while (reader.pos < end) {
1607
+ const tag = reader.uint32();
1608
+ switch (tag >>> 3) {
1609
+ case 1: {
1610
+ if (tag !== 8) {
1611
+ break;
1612
+ }
1613
+ message.sequence = reader.int64();
1614
+ continue;
1615
+ }
1616
+ }
1617
+ if ((tag & 7) === 4 || tag === 0) {
1618
+ break;
1619
+ }
1620
+ reader.skip(tag & 7);
1621
+ }
1622
+ return message;
1623
+ },
1624
+ fromJSON(object) {
1625
+ return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
1626
+ },
1627
+ toJSON(message) {
1628
+ const obj = {};
1629
+ if (message.sequence !== 0n) {
1630
+ obj.sequence = message.sequence.toString();
1631
+ }
1632
+ return obj;
1633
+ },
1634
+ create(base) {
1635
+ return GetSequenceAtResponse.fromPartial(base ?? {});
1636
+ },
1637
+ fromPartial(object) {
1638
+ const message = createBaseGetSequenceAtResponse();
1639
+ message.sequence = object.sequence ?? 0n;
1640
+ return message;
1641
+ },
1642
+ };
1643
+ function createBaseAddTagsRequest() {
1644
+ return { sequence: 0n, tag: [] };
1645
+ }
1646
+ export const AddTagsRequest = {
1647
+ encode(message, writer = new BinaryWriter()) {
1648
+ if (message.sequence !== 0n) {
1649
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1650
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1651
+ }
1652
+ writer.uint32(8).int64(message.sequence);
1653
+ }
1654
+ for (const v of message.tag) {
1655
+ Tag.encode(v, writer.uint32(18).fork()).join();
1656
+ }
1657
+ return writer;
1658
+ },
1659
+ decode(input, length) {
1660
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1661
+ const end = length === undefined ? reader.len : reader.pos + length;
1662
+ const message = createBaseAddTagsRequest();
1663
+ while (reader.pos < end) {
1664
+ const tag = reader.uint32();
1665
+ switch (tag >>> 3) {
1666
+ case 1: {
1667
+ if (tag !== 8) {
1668
+ break;
1669
+ }
1670
+ message.sequence = reader.int64();
1671
+ continue;
1672
+ }
1673
+ case 2: {
1674
+ if (tag !== 18) {
1675
+ break;
1676
+ }
1677
+ message.tag.push(Tag.decode(reader, reader.uint32()));
1678
+ continue;
1679
+ }
1680
+ }
1681
+ if ((tag & 7) === 4 || tag === 0) {
1682
+ break;
1683
+ }
1684
+ reader.skip(tag & 7);
1685
+ }
1686
+ return message;
1687
+ },
1688
+ fromJSON(object) {
1689
+ return {
1690
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
1691
+ tag: globalThis.Array.isArray(object?.tag) ? object.tag.map((e) => Tag.fromJSON(e)) : [],
1692
+ };
1693
+ },
1694
+ toJSON(message) {
1695
+ const obj = {};
1696
+ if (message.sequence !== 0n) {
1697
+ obj.sequence = message.sequence.toString();
1698
+ }
1699
+ if (message.tag?.length) {
1700
+ obj.tag = message.tag.map((e) => Tag.toJSON(e));
1701
+ }
1702
+ return obj;
1703
+ },
1704
+ create(base) {
1705
+ return AddTagsRequest.fromPartial(base ?? {});
1706
+ },
1707
+ fromPartial(object) {
1708
+ const message = createBaseAddTagsRequest();
1709
+ message.sequence = object.sequence ?? 0n;
1710
+ message.tag = object.tag?.map((e) => Tag.fromPartial(e)) || [];
1711
+ return message;
1712
+ },
1713
+ };
1714
+ function createBaseAddTagsResponse() {
1715
+ return {};
1716
+ }
1717
+ export const AddTagsResponse = {
1718
+ encode(_, writer = new BinaryWriter()) {
1719
+ return writer;
1720
+ },
1721
+ decode(input, length) {
1722
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1723
+ const end = length === undefined ? reader.len : reader.pos + length;
1724
+ const message = createBaseAddTagsResponse();
1725
+ while (reader.pos < end) {
1726
+ const tag = reader.uint32();
1727
+ switch (tag >>> 3) {
1728
+ }
1729
+ if ((tag & 7) === 4 || tag === 0) {
1730
+ break;
1731
+ }
1732
+ reader.skip(tag & 7);
1733
+ }
1734
+ return message;
1735
+ },
1736
+ fromJSON(_) {
1737
+ return {};
1738
+ },
1739
+ toJSON(_) {
1740
+ const obj = {};
1741
+ return obj;
1742
+ },
1743
+ create(base) {
1744
+ return AddTagsResponse.fromPartial(base ?? {});
1745
+ },
1746
+ fromPartial(_) {
1747
+ const message = createBaseAddTagsResponse();
1748
+ return message;
1749
+ },
1750
+ };
1751
+ function createBaseRemoveTagsRequest() {
1752
+ return { sequence: 0n, tag: [] };
1753
+ }
1754
+ export const RemoveTagsRequest = {
1755
+ encode(message, writer = new BinaryWriter()) {
1756
+ if (message.sequence !== 0n) {
1757
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1758
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1759
+ }
1760
+ writer.uint32(8).int64(message.sequence);
1761
+ }
1762
+ for (const v of message.tag) {
1763
+ Tag.encode(v, writer.uint32(18).fork()).join();
1764
+ }
1765
+ return writer;
1766
+ },
1767
+ decode(input, length) {
1768
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1769
+ const end = length === undefined ? reader.len : reader.pos + length;
1770
+ const message = createBaseRemoveTagsRequest();
1771
+ while (reader.pos < end) {
1772
+ const tag = reader.uint32();
1773
+ switch (tag >>> 3) {
1774
+ case 1: {
1775
+ if (tag !== 8) {
1776
+ break;
1777
+ }
1778
+ message.sequence = reader.int64();
1779
+ continue;
1780
+ }
1781
+ case 2: {
1782
+ if (tag !== 18) {
1783
+ break;
1784
+ }
1785
+ message.tag.push(Tag.decode(reader, reader.uint32()));
1786
+ continue;
1787
+ }
1788
+ }
1789
+ if ((tag & 7) === 4 || tag === 0) {
1790
+ break;
1791
+ }
1792
+ reader.skip(tag & 7);
1793
+ }
1794
+ return message;
1795
+ },
1796
+ fromJSON(object) {
1797
+ return {
1798
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
1799
+ tag: globalThis.Array.isArray(object?.tag) ? object.tag.map((e) => Tag.fromJSON(e)) : [],
1800
+ };
1801
+ },
1802
+ toJSON(message) {
1803
+ const obj = {};
1804
+ if (message.sequence !== 0n) {
1805
+ obj.sequence = message.sequence.toString();
1806
+ }
1807
+ if (message.tag?.length) {
1808
+ obj.tag = message.tag.map((e) => Tag.toJSON(e));
1809
+ }
1810
+ return obj;
1811
+ },
1812
+ create(base) {
1813
+ return RemoveTagsRequest.fromPartial(base ?? {});
1814
+ },
1815
+ fromPartial(object) {
1816
+ const message = createBaseRemoveTagsRequest();
1817
+ message.sequence = object.sequence ?? 0n;
1818
+ message.tag = object.tag?.map((e) => Tag.fromPartial(e)) || [];
1819
+ return message;
1820
+ },
1821
+ };
1822
+ function createBaseRemoveTagsResponse() {
1823
+ return {};
1824
+ }
1825
+ export const RemoveTagsResponse = {
1826
+ encode(_, writer = new BinaryWriter()) {
1827
+ return writer;
1828
+ },
1829
+ decode(input, length) {
1830
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1831
+ const end = length === undefined ? reader.len : reader.pos + length;
1832
+ const message = createBaseRemoveTagsResponse();
1833
+ while (reader.pos < end) {
1834
+ const tag = reader.uint32();
1835
+ switch (tag >>> 3) {
1836
+ }
1837
+ if ((tag & 7) === 4 || tag === 0) {
1838
+ break;
1839
+ }
1840
+ reader.skip(tag & 7);
1841
+ }
1842
+ return message;
1843
+ },
1844
+ fromJSON(_) {
1845
+ return {};
1846
+ },
1847
+ toJSON(_) {
1848
+ const obj = {};
1849
+ return obj;
1850
+ },
1851
+ create(base) {
1852
+ return RemoveTagsResponse.fromPartial(base ?? {});
1853
+ },
1854
+ fromPartial(_) {
1855
+ const message = createBaseRemoveTagsResponse();
1856
+ return message;
1857
+ },
1858
+ };
1859
+ function createBaseGetTagsRequest() {
1860
+ return { sequence: 0n };
1861
+ }
1862
+ export const GetTagsRequest = {
1863
+ encode(message, writer = new BinaryWriter()) {
1864
+ if (message.sequence !== 0n) {
1865
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
1866
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
1867
+ }
1868
+ writer.uint32(8).int64(message.sequence);
1869
+ }
1870
+ return writer;
1871
+ },
1872
+ decode(input, length) {
1873
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1874
+ const end = length === undefined ? reader.len : reader.pos + length;
1875
+ const message = createBaseGetTagsRequest();
1876
+ while (reader.pos < end) {
1877
+ const tag = reader.uint32();
1878
+ switch (tag >>> 3) {
1879
+ case 1: {
1880
+ if (tag !== 8) {
1881
+ break;
1882
+ }
1883
+ message.sequence = reader.int64();
1884
+ continue;
1885
+ }
1886
+ }
1887
+ if ((tag & 7) === 4 || tag === 0) {
1888
+ break;
1889
+ }
1890
+ reader.skip(tag & 7);
1891
+ }
1892
+ return message;
1893
+ },
1894
+ fromJSON(object) {
1895
+ return { sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n };
1896
+ },
1897
+ toJSON(message) {
1898
+ const obj = {};
1899
+ if (message.sequence !== 0n) {
1900
+ obj.sequence = message.sequence.toString();
1901
+ }
1902
+ return obj;
1903
+ },
1904
+ create(base) {
1905
+ return GetTagsRequest.fromPartial(base ?? {});
1906
+ },
1907
+ fromPartial(object) {
1908
+ const message = createBaseGetTagsRequest();
1909
+ message.sequence = object.sequence ?? 0n;
1910
+ return message;
1911
+ },
1912
+ };
1913
+ function createBaseGetTagsResponse() {
1914
+ return { tag: [] };
1915
+ }
1916
+ export const GetTagsResponse = {
1917
+ encode(message, writer = new BinaryWriter()) {
1918
+ for (const v of message.tag) {
1919
+ Tag.encode(v, writer.uint32(10).fork()).join();
1920
+ }
1921
+ return writer;
1922
+ },
1923
+ decode(input, length) {
1924
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1925
+ const end = length === undefined ? reader.len : reader.pos + length;
1926
+ const message = createBaseGetTagsResponse();
1927
+ while (reader.pos < end) {
1928
+ const tag = reader.uint32();
1929
+ switch (tag >>> 3) {
1930
+ case 1: {
1931
+ if (tag !== 10) {
1932
+ break;
1933
+ }
1934
+ message.tag.push(Tag.decode(reader, reader.uint32()));
1935
+ continue;
1936
+ }
1937
+ }
1938
+ if ((tag & 7) === 4 || tag === 0) {
1939
+ break;
1940
+ }
1941
+ reader.skip(tag & 7);
1942
+ }
1943
+ return message;
1944
+ },
1945
+ fromJSON(object) {
1946
+ return { tag: globalThis.Array.isArray(object?.tag) ? object.tag.map((e) => Tag.fromJSON(e)) : [] };
1947
+ },
1948
+ toJSON(message) {
1949
+ const obj = {};
1950
+ if (message.tag?.length) {
1951
+ obj.tag = message.tag.map((e) => Tag.toJSON(e));
1952
+ }
1953
+ return obj;
1954
+ },
1955
+ create(base) {
1956
+ return GetTagsResponse.fromPartial(base ?? {});
1957
+ },
1958
+ fromPartial(object) {
1959
+ const message = createBaseGetTagsResponse();
1960
+ message.tag = object.tag?.map((e) => Tag.fromPartial(e)) || [];
1961
+ return message;
1962
+ },
1963
+ };
1964
+ function createBaseSnapshot() {
1965
+ return { name: "", version: "", payload: new Uint8Array(0), timestamp: 0n, metadata: {} };
1966
+ }
1967
+ export const Snapshot = {
1968
+ encode(message, writer = new BinaryWriter()) {
1969
+ if (message.name !== "") {
1970
+ writer.uint32(10).string(message.name);
1971
+ }
1972
+ if (message.version !== "") {
1973
+ writer.uint32(18).string(message.version);
1974
+ }
1975
+ if (message.payload.length !== 0) {
1976
+ writer.uint32(26).bytes(message.payload);
1977
+ }
1978
+ if (message.timestamp !== 0n) {
1979
+ if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
1980
+ throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
1981
+ }
1982
+ writer.uint32(32).int64(message.timestamp);
1983
+ }
1984
+ globalThis.Object.entries(message.metadata).forEach(([key, value]) => {
1985
+ Snapshot_MetadataEntry.encode({ key: key, value }, writer.uint32(42).fork()).join();
1986
+ });
1987
+ return writer;
1988
+ },
1989
+ decode(input, length) {
1990
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1991
+ const end = length === undefined ? reader.len : reader.pos + length;
1992
+ const message = createBaseSnapshot();
1993
+ while (reader.pos < end) {
1994
+ const tag = reader.uint32();
1995
+ switch (tag >>> 3) {
1996
+ case 1: {
1997
+ if (tag !== 10) {
1998
+ break;
1999
+ }
2000
+ message.name = reader.string();
2001
+ continue;
2002
+ }
2003
+ case 2: {
2004
+ if (tag !== 18) {
2005
+ break;
2006
+ }
2007
+ message.version = reader.string();
2008
+ continue;
2009
+ }
2010
+ case 3: {
2011
+ if (tag !== 26) {
2012
+ break;
2013
+ }
2014
+ message.payload = reader.bytes();
2015
+ continue;
2016
+ }
2017
+ case 4: {
2018
+ if (tag !== 32) {
2019
+ break;
2020
+ }
2021
+ message.timestamp = reader.int64();
2022
+ continue;
2023
+ }
2024
+ case 5: {
2025
+ if (tag !== 42) {
2026
+ break;
2027
+ }
2028
+ const entry5 = Snapshot_MetadataEntry.decode(reader, reader.uint32());
2029
+ if (entry5.value !== undefined) {
2030
+ message.metadata[entry5.key] = entry5.value;
2031
+ }
2032
+ continue;
2033
+ }
2034
+ }
2035
+ if ((tag & 7) === 4 || tag === 0) {
2036
+ break;
2037
+ }
2038
+ reader.skip(tag & 7);
2039
+ }
2040
+ return message;
2041
+ },
2042
+ fromJSON(object) {
2043
+ return {
2044
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2045
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
2046
+ payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0),
2047
+ timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n,
2048
+ metadata: isObject(object.metadata)
2049
+ ? globalThis.Object.entries(object.metadata).reduce((acc, [key, value]) => {
2050
+ acc[key] = globalThis.String(value);
2051
+ return acc;
2052
+ }, {})
2053
+ : {},
2054
+ };
2055
+ },
2056
+ toJSON(message) {
2057
+ const obj = {};
2058
+ if (message.name !== "") {
2059
+ obj.name = message.name;
2060
+ }
2061
+ if (message.version !== "") {
2062
+ obj.version = message.version;
2063
+ }
2064
+ if (message.payload.length !== 0) {
2065
+ obj.payload = base64FromBytes(message.payload);
2066
+ }
2067
+ if (message.timestamp !== 0n) {
2068
+ obj.timestamp = message.timestamp.toString();
2069
+ }
2070
+ if (message.metadata) {
2071
+ const entries = globalThis.Object.entries(message.metadata);
2072
+ if (entries.length > 0) {
2073
+ obj.metadata = {};
2074
+ entries.forEach(([k, v]) => {
2075
+ obj.metadata[k] = v;
2076
+ });
2077
+ }
2078
+ }
2079
+ return obj;
2080
+ },
2081
+ create(base) {
2082
+ return Snapshot.fromPartial(base ?? {});
2083
+ },
2084
+ fromPartial(object) {
2085
+ const message = createBaseSnapshot();
2086
+ message.name = object.name ?? "";
2087
+ message.version = object.version ?? "";
2088
+ message.payload = object.payload ?? new Uint8Array(0);
2089
+ message.timestamp = object.timestamp ?? 0n;
2090
+ message.metadata = globalThis.Object.entries(object.metadata ?? {}).reduce((acc, [key, value]) => {
2091
+ if (value !== undefined) {
2092
+ acc[key] = globalThis.String(value);
2093
+ }
2094
+ return acc;
2095
+ }, {});
2096
+ return message;
2097
+ },
2098
+ };
2099
+ function createBaseSnapshot_MetadataEntry() {
2100
+ return { key: "", value: "" };
2101
+ }
2102
+ export const Snapshot_MetadataEntry = {
2103
+ encode(message, writer = new BinaryWriter()) {
2104
+ if (message.key !== "") {
2105
+ writer.uint32(10).string(message.key);
2106
+ }
2107
+ if (message.value !== "") {
2108
+ writer.uint32(18).string(message.value);
2109
+ }
2110
+ return writer;
2111
+ },
2112
+ decode(input, length) {
2113
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2114
+ const end = length === undefined ? reader.len : reader.pos + length;
2115
+ const message = createBaseSnapshot_MetadataEntry();
2116
+ while (reader.pos < end) {
2117
+ const tag = reader.uint32();
2118
+ switch (tag >>> 3) {
2119
+ case 1: {
2120
+ if (tag !== 10) {
2121
+ break;
2122
+ }
2123
+ message.key = reader.string();
2124
+ continue;
2125
+ }
2126
+ case 2: {
2127
+ if (tag !== 18) {
2128
+ break;
2129
+ }
2130
+ message.value = reader.string();
2131
+ continue;
2132
+ }
2133
+ }
2134
+ if ((tag & 7) === 4 || tag === 0) {
2135
+ break;
2136
+ }
2137
+ reader.skip(tag & 7);
2138
+ }
2139
+ return message;
2140
+ },
2141
+ fromJSON(object) {
2142
+ return {
2143
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2144
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
2145
+ };
2146
+ },
2147
+ toJSON(message) {
2148
+ const obj = {};
2149
+ if (message.key !== "") {
2150
+ obj.key = message.key;
2151
+ }
2152
+ if (message.value !== "") {
2153
+ obj.value = message.value;
2154
+ }
2155
+ return obj;
2156
+ },
2157
+ create(base) {
2158
+ return Snapshot_MetadataEntry.fromPartial(base ?? {});
2159
+ },
2160
+ fromPartial(object) {
2161
+ const message = createBaseSnapshot_MetadataEntry();
2162
+ message.key = object.key ?? "";
2163
+ message.value = object.value ?? "";
2164
+ return message;
2165
+ },
2166
+ };
2167
+ function createBaseAddSnapshotRequest() {
2168
+ return { key: new Uint8Array(0), sequence: 0n, prune: false, snapshot: undefined };
2169
+ }
2170
+ export const AddSnapshotRequest = {
2171
+ encode(message, writer = new BinaryWriter()) {
2172
+ if (message.key.length !== 0) {
2173
+ writer.uint32(10).bytes(message.key);
2174
+ }
2175
+ if (message.sequence !== 0n) {
2176
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
2177
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
2178
+ }
2179
+ writer.uint32(16).int64(message.sequence);
2180
+ }
2181
+ if (message.prune !== false) {
2182
+ writer.uint32(24).bool(message.prune);
2183
+ }
2184
+ if (message.snapshot !== undefined) {
2185
+ Snapshot.encode(message.snapshot, writer.uint32(34).fork()).join();
2186
+ }
2187
+ return writer;
2188
+ },
2189
+ decode(input, length) {
2190
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2191
+ const end = length === undefined ? reader.len : reader.pos + length;
2192
+ const message = createBaseAddSnapshotRequest();
2193
+ while (reader.pos < end) {
2194
+ const tag = reader.uint32();
2195
+ switch (tag >>> 3) {
2196
+ case 1: {
2197
+ if (tag !== 10) {
2198
+ break;
2199
+ }
2200
+ message.key = reader.bytes();
2201
+ continue;
2202
+ }
2203
+ case 2: {
2204
+ if (tag !== 16) {
2205
+ break;
2206
+ }
2207
+ message.sequence = reader.int64();
2208
+ continue;
2209
+ }
2210
+ case 3: {
2211
+ if (tag !== 24) {
2212
+ break;
2213
+ }
2214
+ message.prune = reader.bool();
2215
+ continue;
2216
+ }
2217
+ case 4: {
2218
+ if (tag !== 34) {
2219
+ break;
2220
+ }
2221
+ message.snapshot = Snapshot.decode(reader, reader.uint32());
2222
+ continue;
2223
+ }
2224
+ }
2225
+ if ((tag & 7) === 4 || tag === 0) {
2226
+ break;
2227
+ }
2228
+ reader.skip(tag & 7);
2229
+ }
2230
+ return message;
2231
+ },
2232
+ fromJSON(object) {
2233
+ return {
2234
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
2235
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
2236
+ prune: isSet(object.prune) ? globalThis.Boolean(object.prune) : false,
2237
+ snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined,
2238
+ };
2239
+ },
2240
+ toJSON(message) {
2241
+ const obj = {};
2242
+ if (message.key.length !== 0) {
2243
+ obj.key = base64FromBytes(message.key);
2244
+ }
2245
+ if (message.sequence !== 0n) {
2246
+ obj.sequence = message.sequence.toString();
2247
+ }
2248
+ if (message.prune !== false) {
2249
+ obj.prune = message.prune;
2250
+ }
2251
+ if (message.snapshot !== undefined) {
2252
+ obj.snapshot = Snapshot.toJSON(message.snapshot);
2253
+ }
2254
+ return obj;
2255
+ },
2256
+ create(base) {
2257
+ return AddSnapshotRequest.fromPartial(base ?? {});
2258
+ },
2259
+ fromPartial(object) {
2260
+ const message = createBaseAddSnapshotRequest();
2261
+ message.key = object.key ?? new Uint8Array(0);
2262
+ message.sequence = object.sequence ?? 0n;
2263
+ message.prune = object.prune ?? false;
2264
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
2265
+ ? Snapshot.fromPartial(object.snapshot)
2266
+ : undefined;
2267
+ return message;
2268
+ },
2269
+ };
2270
+ function createBaseAddSnapshotResponse() {
2271
+ return {};
2272
+ }
2273
+ export const AddSnapshotResponse = {
2274
+ encode(_, writer = new BinaryWriter()) {
2275
+ return writer;
2276
+ },
2277
+ decode(input, length) {
2278
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2279
+ const end = length === undefined ? reader.len : reader.pos + length;
2280
+ const message = createBaseAddSnapshotResponse();
2281
+ while (reader.pos < end) {
2282
+ const tag = reader.uint32();
2283
+ switch (tag >>> 3) {
2284
+ }
2285
+ if ((tag & 7) === 4 || tag === 0) {
2286
+ break;
2287
+ }
2288
+ reader.skip(tag & 7);
2289
+ }
2290
+ return message;
2291
+ },
2292
+ fromJSON(_) {
2293
+ return {};
2294
+ },
2295
+ toJSON(_) {
2296
+ const obj = {};
2297
+ return obj;
2298
+ },
2299
+ create(base) {
2300
+ return AddSnapshotResponse.fromPartial(base ?? {});
2301
+ },
2302
+ fromPartial(_) {
2303
+ const message = createBaseAddSnapshotResponse();
2304
+ return message;
2305
+ },
2306
+ };
2307
+ function createBaseDeleteSnapshotsRequest() {
2308
+ return { key: new Uint8Array(0), toSequence: 0n };
2309
+ }
2310
+ export const DeleteSnapshotsRequest = {
2311
+ encode(message, writer = new BinaryWriter()) {
2312
+ if (message.key.length !== 0) {
2313
+ writer.uint32(10).bytes(message.key);
2314
+ }
2315
+ if (message.toSequence !== 0n) {
2316
+ if (BigInt.asIntN(64, message.toSequence) !== message.toSequence) {
2317
+ throw new globalThis.Error("value provided for field message.toSequence of type int64 too large");
2318
+ }
2319
+ writer.uint32(24).int64(message.toSequence);
2320
+ }
2321
+ return writer;
2322
+ },
2323
+ decode(input, length) {
2324
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2325
+ const end = length === undefined ? reader.len : reader.pos + length;
2326
+ const message = createBaseDeleteSnapshotsRequest();
2327
+ while (reader.pos < end) {
2328
+ const tag = reader.uint32();
2329
+ switch (tag >>> 3) {
2330
+ case 1: {
2331
+ if (tag !== 10) {
2332
+ break;
2333
+ }
2334
+ message.key = reader.bytes();
2335
+ continue;
2336
+ }
2337
+ case 3: {
2338
+ if (tag !== 24) {
2339
+ break;
2340
+ }
2341
+ message.toSequence = reader.int64();
2342
+ continue;
2343
+ }
2344
+ }
2345
+ if ((tag & 7) === 4 || tag === 0) {
2346
+ break;
2347
+ }
2348
+ reader.skip(tag & 7);
2349
+ }
2350
+ return message;
2351
+ },
2352
+ fromJSON(object) {
2353
+ return {
2354
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
2355
+ toSequence: isSet(object.toSequence)
2356
+ ? BigInt(object.toSequence)
2357
+ : isSet(object.to_sequence)
2358
+ ? BigInt(object.to_sequence)
2359
+ : 0n,
2360
+ };
2361
+ },
2362
+ toJSON(message) {
2363
+ const obj = {};
2364
+ if (message.key.length !== 0) {
2365
+ obj.key = base64FromBytes(message.key);
2366
+ }
2367
+ if (message.toSequence !== 0n) {
2368
+ obj.toSequence = message.toSequence.toString();
2369
+ }
2370
+ return obj;
2371
+ },
2372
+ create(base) {
2373
+ return DeleteSnapshotsRequest.fromPartial(base ?? {});
2374
+ },
2375
+ fromPartial(object) {
2376
+ const message = createBaseDeleteSnapshotsRequest();
2377
+ message.key = object.key ?? new Uint8Array(0);
2378
+ message.toSequence = object.toSequence ?? 0n;
2379
+ return message;
2380
+ },
2381
+ };
2382
+ function createBaseDeleteSnapshotsResponse() {
2383
+ return {};
2384
+ }
2385
+ export const DeleteSnapshotsResponse = {
2386
+ encode(_, writer = new BinaryWriter()) {
2387
+ return writer;
2388
+ },
2389
+ decode(input, length) {
2390
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2391
+ const end = length === undefined ? reader.len : reader.pos + length;
2392
+ const message = createBaseDeleteSnapshotsResponse();
2393
+ while (reader.pos < end) {
2394
+ const tag = reader.uint32();
2395
+ switch (tag >>> 3) {
2396
+ }
2397
+ if ((tag & 7) === 4 || tag === 0) {
2398
+ break;
2399
+ }
2400
+ reader.skip(tag & 7);
2401
+ }
2402
+ return message;
2403
+ },
2404
+ fromJSON(_) {
2405
+ return {};
2406
+ },
2407
+ toJSON(_) {
2408
+ const obj = {};
2409
+ return obj;
2410
+ },
2411
+ create(base) {
2412
+ return DeleteSnapshotsResponse.fromPartial(base ?? {});
2413
+ },
2414
+ fromPartial(_) {
2415
+ const message = createBaseDeleteSnapshotsResponse();
2416
+ return message;
2417
+ },
2418
+ };
2419
+ function createBaseListSnapshotsRequest() {
2420
+ return { key: new Uint8Array(0), fromSequence: 0n, toSequence: 0n };
2421
+ }
2422
+ export const ListSnapshotsRequest = {
2423
+ encode(message, writer = new BinaryWriter()) {
2424
+ if (message.key.length !== 0) {
2425
+ writer.uint32(10).bytes(message.key);
2426
+ }
2427
+ if (message.fromSequence !== 0n) {
2428
+ if (BigInt.asIntN(64, message.fromSequence) !== message.fromSequence) {
2429
+ throw new globalThis.Error("value provided for field message.fromSequence of type int64 too large");
2430
+ }
2431
+ writer.uint32(16).int64(message.fromSequence);
2432
+ }
2433
+ if (message.toSequence !== 0n) {
2434
+ if (BigInt.asIntN(64, message.toSequence) !== message.toSequence) {
2435
+ throw new globalThis.Error("value provided for field message.toSequence of type int64 too large");
2436
+ }
2437
+ writer.uint32(24).int64(message.toSequence);
2438
+ }
2439
+ return writer;
2440
+ },
2441
+ decode(input, length) {
2442
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2443
+ const end = length === undefined ? reader.len : reader.pos + length;
2444
+ const message = createBaseListSnapshotsRequest();
2445
+ while (reader.pos < end) {
2446
+ const tag = reader.uint32();
2447
+ switch (tag >>> 3) {
2448
+ case 1: {
2449
+ if (tag !== 10) {
2450
+ break;
2451
+ }
2452
+ message.key = reader.bytes();
2453
+ continue;
2454
+ }
2455
+ case 2: {
2456
+ if (tag !== 16) {
2457
+ break;
2458
+ }
2459
+ message.fromSequence = reader.int64();
2460
+ continue;
2461
+ }
2462
+ case 3: {
2463
+ if (tag !== 24) {
2464
+ break;
2465
+ }
2466
+ message.toSequence = reader.int64();
2467
+ continue;
2468
+ }
2469
+ }
2470
+ if ((tag & 7) === 4 || tag === 0) {
2471
+ break;
2472
+ }
2473
+ reader.skip(tag & 7);
2474
+ }
2475
+ return message;
2476
+ },
2477
+ fromJSON(object) {
2478
+ return {
2479
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
2480
+ fromSequence: isSet(object.fromSequence)
2481
+ ? BigInt(object.fromSequence)
2482
+ : isSet(object.from_sequence)
2483
+ ? BigInt(object.from_sequence)
2484
+ : 0n,
2485
+ toSequence: isSet(object.toSequence)
2486
+ ? BigInt(object.toSequence)
2487
+ : isSet(object.to_sequence)
2488
+ ? BigInt(object.to_sequence)
2489
+ : 0n,
2490
+ };
2491
+ },
2492
+ toJSON(message) {
2493
+ const obj = {};
2494
+ if (message.key.length !== 0) {
2495
+ obj.key = base64FromBytes(message.key);
2496
+ }
2497
+ if (message.fromSequence !== 0n) {
2498
+ obj.fromSequence = message.fromSequence.toString();
2499
+ }
2500
+ if (message.toSequence !== 0n) {
2501
+ obj.toSequence = message.toSequence.toString();
2502
+ }
2503
+ return obj;
2504
+ },
2505
+ create(base) {
2506
+ return ListSnapshotsRequest.fromPartial(base ?? {});
2507
+ },
2508
+ fromPartial(object) {
2509
+ const message = createBaseListSnapshotsRequest();
2510
+ message.key = object.key ?? new Uint8Array(0);
2511
+ message.fromSequence = object.fromSequence ?? 0n;
2512
+ message.toSequence = object.toSequence ?? 0n;
2513
+ return message;
2514
+ },
2515
+ };
2516
+ function createBaseListSnapshotsResponse() {
2517
+ return { key: new Uint8Array(0), sequence: 0n, snapshot: undefined };
2518
+ }
2519
+ export const ListSnapshotsResponse = {
2520
+ encode(message, writer = new BinaryWriter()) {
2521
+ if (message.key.length !== 0) {
2522
+ writer.uint32(10).bytes(message.key);
2523
+ }
2524
+ if (message.sequence !== 0n) {
2525
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
2526
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
2527
+ }
2528
+ writer.uint32(16).int64(message.sequence);
2529
+ }
2530
+ if (message.snapshot !== undefined) {
2531
+ Snapshot.encode(message.snapshot, writer.uint32(26).fork()).join();
2532
+ }
2533
+ return writer;
2534
+ },
2535
+ decode(input, length) {
2536
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2537
+ const end = length === undefined ? reader.len : reader.pos + length;
2538
+ const message = createBaseListSnapshotsResponse();
2539
+ while (reader.pos < end) {
2540
+ const tag = reader.uint32();
2541
+ switch (tag >>> 3) {
2542
+ case 1: {
2543
+ if (tag !== 10) {
2544
+ break;
2545
+ }
2546
+ message.key = reader.bytes();
2547
+ continue;
2548
+ }
2549
+ case 2: {
2550
+ if (tag !== 16) {
2551
+ break;
2552
+ }
2553
+ message.sequence = reader.int64();
2554
+ continue;
2555
+ }
2556
+ case 3: {
2557
+ if (tag !== 26) {
2558
+ break;
2559
+ }
2560
+ message.snapshot = Snapshot.decode(reader, reader.uint32());
2561
+ continue;
2562
+ }
2563
+ }
2564
+ if ((tag & 7) === 4 || tag === 0) {
2565
+ break;
2566
+ }
2567
+ reader.skip(tag & 7);
2568
+ }
2569
+ return message;
2570
+ },
2571
+ fromJSON(object) {
2572
+ return {
2573
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
2574
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
2575
+ snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined,
2576
+ };
2577
+ },
2578
+ toJSON(message) {
2579
+ const obj = {};
2580
+ if (message.key.length !== 0) {
2581
+ obj.key = base64FromBytes(message.key);
2582
+ }
2583
+ if (message.sequence !== 0n) {
2584
+ obj.sequence = message.sequence.toString();
2585
+ }
2586
+ if (message.snapshot !== undefined) {
2587
+ obj.snapshot = Snapshot.toJSON(message.snapshot);
2588
+ }
2589
+ return obj;
2590
+ },
2591
+ create(base) {
2592
+ return ListSnapshotsResponse.fromPartial(base ?? {});
2593
+ },
2594
+ fromPartial(object) {
2595
+ const message = createBaseListSnapshotsResponse();
2596
+ message.key = object.key ?? new Uint8Array(0);
2597
+ message.sequence = object.sequence ?? 0n;
2598
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
2599
+ ? Snapshot.fromPartial(object.snapshot)
2600
+ : undefined;
2601
+ return message;
2602
+ },
2603
+ };
2604
+ function createBaseGetLastSnapshotRequest() {
2605
+ return { key: new Uint8Array(0) };
2606
+ }
2607
+ export const GetLastSnapshotRequest = {
2608
+ encode(message, writer = new BinaryWriter()) {
2609
+ if (message.key.length !== 0) {
2610
+ writer.uint32(10).bytes(message.key);
2611
+ }
2612
+ return writer;
2613
+ },
2614
+ decode(input, length) {
2615
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2616
+ const end = length === undefined ? reader.len : reader.pos + length;
2617
+ const message = createBaseGetLastSnapshotRequest();
2618
+ while (reader.pos < end) {
2619
+ const tag = reader.uint32();
2620
+ switch (tag >>> 3) {
2621
+ case 1: {
2622
+ if (tag !== 10) {
2623
+ break;
2624
+ }
2625
+ message.key = reader.bytes();
2626
+ continue;
2627
+ }
2628
+ }
2629
+ if ((tag & 7) === 4 || tag === 0) {
2630
+ break;
2631
+ }
2632
+ reader.skip(tag & 7);
2633
+ }
2634
+ return message;
2635
+ },
2636
+ fromJSON(object) {
2637
+ return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) };
2638
+ },
2639
+ toJSON(message) {
2640
+ const obj = {};
2641
+ if (message.key.length !== 0) {
2642
+ obj.key = base64FromBytes(message.key);
2643
+ }
2644
+ return obj;
2645
+ },
2646
+ create(base) {
2647
+ return GetLastSnapshotRequest.fromPartial(base ?? {});
2648
+ },
2649
+ fromPartial(object) {
2650
+ const message = createBaseGetLastSnapshotRequest();
2651
+ message.key = object.key ?? new Uint8Array(0);
2652
+ return message;
2653
+ },
2654
+ };
2655
+ function createBaseGetLastSnapshotResponse() {
2656
+ return { key: new Uint8Array(0), sequence: 0n, snapshot: undefined };
2657
+ }
2658
+ export const GetLastSnapshotResponse = {
2659
+ encode(message, writer = new BinaryWriter()) {
2660
+ if (message.key.length !== 0) {
2661
+ writer.uint32(10).bytes(message.key);
2662
+ }
2663
+ if (message.sequence !== 0n) {
2664
+ if (BigInt.asIntN(64, message.sequence) !== message.sequence) {
2665
+ throw new globalThis.Error("value provided for field message.sequence of type int64 too large");
2666
+ }
2667
+ writer.uint32(16).int64(message.sequence);
2668
+ }
2669
+ if (message.snapshot !== undefined) {
2670
+ Snapshot.encode(message.snapshot, writer.uint32(26).fork()).join();
2671
+ }
2672
+ return writer;
2673
+ },
2674
+ decode(input, length) {
2675
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2676
+ const end = length === undefined ? reader.len : reader.pos + length;
2677
+ const message = createBaseGetLastSnapshotResponse();
2678
+ while (reader.pos < end) {
2679
+ const tag = reader.uint32();
2680
+ switch (tag >>> 3) {
2681
+ case 1: {
2682
+ if (tag !== 10) {
2683
+ break;
2684
+ }
2685
+ message.key = reader.bytes();
2686
+ continue;
2687
+ }
2688
+ case 2: {
2689
+ if (tag !== 16) {
2690
+ break;
2691
+ }
2692
+ message.sequence = reader.int64();
2693
+ continue;
2694
+ }
2695
+ case 3: {
2696
+ if (tag !== 26) {
2697
+ break;
2698
+ }
2699
+ message.snapshot = Snapshot.decode(reader, reader.uint32());
2700
+ continue;
2701
+ }
2702
+ }
2703
+ if ((tag & 7) === 4 || tag === 0) {
2704
+ break;
2705
+ }
2706
+ reader.skip(tag & 7);
2707
+ }
2708
+ return message;
2709
+ },
2710
+ fromJSON(object) {
2711
+ return {
2712
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
2713
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
2714
+ snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined,
2715
+ };
2716
+ },
2717
+ toJSON(message) {
2718
+ const obj = {};
2719
+ if (message.key.length !== 0) {
2720
+ obj.key = base64FromBytes(message.key);
2721
+ }
2722
+ if (message.sequence !== 0n) {
2723
+ obj.sequence = message.sequence.toString();
2724
+ }
2725
+ if (message.snapshot !== undefined) {
2726
+ obj.snapshot = Snapshot.toJSON(message.snapshot);
2727
+ }
2728
+ return obj;
2729
+ },
2730
+ create(base) {
2731
+ return GetLastSnapshotResponse.fromPartial(base ?? {});
2732
+ },
2733
+ fromPartial(object) {
2734
+ const message = createBaseGetLastSnapshotResponse();
2735
+ message.key = object.key ?? new Uint8Array(0);
2736
+ message.sequence = object.sequence ?? 0n;
2737
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
2738
+ ? Snapshot.fromPartial(object.snapshot)
2739
+ : undefined;
2740
+ return message;
2741
+ },
2742
+ };
2743
+ export const DcbEventStoreDefinition = {
2744
+ name: "DcbEventStore",
2745
+ fullName: "io.axoniq.axonserver.grpc.event.dcb.DcbEventStore",
2746
+ methods: {
2747
+ /** Appends new events to the store. */
2748
+ append: {
2749
+ name: "Append",
2750
+ requestType: AppendEventsRequest,
2751
+ requestStream: true,
2752
+ responseType: AppendEventsResponse,
2753
+ responseStream: false,
2754
+ options: {},
2755
+ },
2756
+ /** Provides a finite stream of events based on the passed SourceEventsRequest. */
2757
+ source: {
2758
+ name: "Source",
2759
+ requestType: SourceEventsRequest,
2760
+ requestStream: false,
2761
+ responseType: SourceEventsResponse,
2762
+ responseStream: true,
2763
+ options: {},
2764
+ },
2765
+ /** Provides an infinite stream of events based on the passed StreamEventsRequest. */
2766
+ stream: {
2767
+ name: "Stream",
2768
+ requestType: StreamEventsRequest,
2769
+ requestStream: false,
2770
+ responseType: StreamEventsResponse,
2771
+ responseStream: true,
2772
+ options: {},
2773
+ },
2774
+ /** Gets the current _head_ of the Event Store. The _head_ points to the sequence of the first event to be appended. */
2775
+ getHead: {
2776
+ name: "GetHead",
2777
+ requestType: GetHeadRequest,
2778
+ requestStream: false,
2779
+ responseType: GetHeadResponse,
2780
+ responseStream: false,
2781
+ options: {},
2782
+ },
2783
+ /** Gets the current _tail_ of the Event Store. The _tail_ points to the sequence of the first event stored. */
2784
+ getTail: {
2785
+ name: "GetTail",
2786
+ requestType: GetTailRequest,
2787
+ requestStream: false,
2788
+ responseType: GetTailResponse,
2789
+ responseStream: false,
2790
+ options: {},
2791
+ },
2792
+ /**
2793
+ * Returns the lowest sequence of an event with a timestamp equal to or higher than the given timestamp. The HEAD is
2794
+ * returned if no events exist with a timestamp equal to or higher than the given timestamp.
2795
+ *
2796
+ * N.B. Axon Server does not assign timestamps to events. The timestamps used for fulfilling this RPC are timestamps
2797
+ * provided by the client. It could happen that there are events after the returned sequence that have an earlier
2798
+ * timestamp. Axon Server does not reject appends if timestamps of events are not monotonically increasing.
2799
+ */
2800
+ getSequenceAt: {
2801
+ name: "GetSequenceAt",
2802
+ requestType: GetSequenceAtRequest,
2803
+ requestStream: false,
2804
+ responseType: GetSequenceAtResponse,
2805
+ responseStream: false,
2806
+ options: {},
2807
+ },
2808
+ /** Assigns tags to the event identified by its sequence. */
2809
+ addTags: {
2810
+ name: "AddTags",
2811
+ requestType: AddTagsRequest,
2812
+ requestStream: false,
2813
+ responseType: AddTagsResponse,
2814
+ responseStream: false,
2815
+ options: {},
2816
+ },
2817
+ /** Removes tags from the event identified by its sequence. */
2818
+ removeTags: {
2819
+ name: "RemoveTags",
2820
+ requestType: RemoveTagsRequest,
2821
+ requestStream: false,
2822
+ responseType: RemoveTagsResponse,
2823
+ responseStream: false,
2824
+ options: {},
2825
+ },
2826
+ /** Gets tags for the event identified by its sequence. */
2827
+ getTags: {
2828
+ name: "GetTags",
2829
+ requestType: GetTagsRequest,
2830
+ requestStream: false,
2831
+ responseType: GetTagsResponse,
2832
+ responseStream: false,
2833
+ options: {},
2834
+ },
2835
+ },
2836
+ };
2837
+ export const DcbSnapshotStoreDefinition = {
2838
+ name: "DcbSnapshotStore",
2839
+ fullName: "io.axoniq.axonserver.grpc.event.dcb.DcbSnapshotStore",
2840
+ methods: {
2841
+ /** Adds a snapshot to the snapshot store. */
2842
+ add: {
2843
+ name: "Add",
2844
+ requestType: AddSnapshotRequest,
2845
+ requestStream: false,
2846
+ responseType: AddSnapshotResponse,
2847
+ responseStream: false,
2848
+ options: {},
2849
+ },
2850
+ /** Deletes a snapshot from the snapshot store. */
2851
+ delete: {
2852
+ name: "Delete",
2853
+ requestType: DeleteSnapshotsRequest,
2854
+ requestStream: false,
2855
+ responseType: DeleteSnapshotsResponse,
2856
+ responseStream: false,
2857
+ options: {},
2858
+ },
2859
+ /** Retrieves snapshots from the snapshot store. */
2860
+ list: {
2861
+ name: "List",
2862
+ requestType: ListSnapshotsRequest,
2863
+ requestStream: false,
2864
+ responseType: ListSnapshotsResponse,
2865
+ responseStream: true,
2866
+ options: {},
2867
+ },
2868
+ /** Gets the latest snapshot based on the request from the snapshot store. */
2869
+ getLast: {
2870
+ name: "GetLast",
2871
+ requestType: GetLastSnapshotRequest,
2872
+ requestStream: false,
2873
+ responseType: GetLastSnapshotResponse,
2874
+ responseStream: false,
2875
+ options: {},
2876
+ },
2877
+ },
2878
+ };
2879
+ export const DcbEventSchedulerDefinition = {
2880
+ name: "DcbEventScheduler",
2881
+ fullName: "io.axoniq.axonserver.grpc.event.dcb.DcbEventScheduler",
2882
+ methods: {
2883
+ /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to reschedule or cancel the planned publication. */
2884
+ scheduleEvent: {
2885
+ name: "ScheduleEvent",
2886
+ requestType: ScheduleEventRequest,
2887
+ requestStream: false,
2888
+ responseType: ScheduleToken,
2889
+ responseStream: false,
2890
+ options: {},
2891
+ },
2892
+ /** Reschedule a scheduled event and optionally replace it by a new event. */
2893
+ rescheduleEvent: {
2894
+ name: "RescheduleEvent",
2895
+ requestType: RescheduleEventRequest,
2896
+ requestStream: false,
2897
+ responseType: ScheduleToken,
2898
+ responseStream: false,
2899
+ options: {},
2900
+ },
2901
+ /** Cancel the publication of a scheduled event. If the events has already been published, this method does nothing. */
2902
+ cancelScheduledEvent: {
2903
+ name: "CancelScheduledEvent",
2904
+ requestType: CancelScheduledEventRequest,
2905
+ requestStream: false,
2906
+ responseType: InstructionAck,
2907
+ responseStream: false,
2908
+ options: {},
2909
+ },
2910
+ },
2911
+ };
2912
+ function bytesFromBase64(b64) {
2913
+ if (globalThis.Buffer) {
2914
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
2915
+ }
2916
+ else {
2917
+ const bin = globalThis.atob(b64);
2918
+ const arr = new Uint8Array(bin.length);
2919
+ for (let i = 0; i < bin.length; ++i) {
2920
+ arr[i] = bin.charCodeAt(i);
2921
+ }
2922
+ return arr;
2923
+ }
2924
+ }
2925
+ function base64FromBytes(arr) {
2926
+ if (globalThis.Buffer) {
2927
+ return globalThis.Buffer.from(arr).toString("base64");
2928
+ }
2929
+ else {
2930
+ const bin = [];
2931
+ arr.forEach((byte) => {
2932
+ bin.push(globalThis.String.fromCharCode(byte));
2933
+ });
2934
+ return globalThis.btoa(bin.join(""));
2935
+ }
2936
+ }
2937
+ function isObject(value) {
2938
+ return typeof value === "object" && value !== null;
2939
+ }
2940
+ function isSet(value) {
2941
+ return value !== null && value !== undefined;
2942
+ }
2943
+ //# sourceMappingURL=dcb.js.map