@cratis/chronicle.contracts 19.152.2 → 19.153.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 (35) hide show
  1. package/dist/cjs/generated/descriptorSet.js +1 -1
  2. package/dist/cjs/generated/descriptorSet.js.map +1 -1
  3. package/dist/cjs/generated/imports.d.ts +322 -0
  4. package/dist/cjs/generated/imports.d.ts.map +1 -0
  5. package/dist/cjs/generated/imports.js +3537 -0
  6. package/dist/cjs/generated/imports.js.map +1 -0
  7. package/dist/cjs/generated/index.d.ts +2 -0
  8. package/dist/cjs/generated/index.d.ts.map +1 -1
  9. package/dist/cjs/index.js +31 -0
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/esm/generated/descriptorSet.js +1 -1
  12. package/dist/esm/generated/descriptorSet.js.map +1 -1
  13. package/dist/esm/generated/imports.d.ts +322 -0
  14. package/dist/esm/generated/imports.d.ts.map +1 -0
  15. package/dist/esm/generated/imports.js +3505 -0
  16. package/dist/esm/generated/imports.js.map +1 -0
  17. package/dist/esm/generated/index.d.ts +2 -0
  18. package/dist/esm/generated/index.d.ts.map +1 -1
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/generated/descriptorSet.js +1 -1
  22. package/dist/generated/descriptorSet.js.map +1 -1
  23. package/dist/generated/imports.d.ts +322 -0
  24. package/dist/generated/imports.d.ts.map +1 -0
  25. package/dist/generated/imports.js +3504 -0
  26. package/dist/generated/imports.js.map +1 -0
  27. package/dist/generated/index.d.ts +2 -0
  28. package/dist/generated/index.d.ts.map +1 -1
  29. package/dist/generated/index.js +1 -0
  30. package/dist/generated/index.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/generated/descriptorSet.ts +1 -1
  33. package/generated/imports.ts +4065 -0
  34. package/generated/index.ts +3 -0
  35. package/package.json +1 -1
@@ -0,0 +1,3505 @@
1
+ import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
+ import { Guid } from './protobuf-net/bcl.js';
3
+
4
+ var ImportState;
5
+ (function (ImportState) {
6
+ ImportState[ImportState["Open"] = 0] = "Open";
7
+ ImportState[ImportState["Staging"] = 1] = "Staging";
8
+ ImportState[ImportState["Validating"] = 2] = "Validating";
9
+ ImportState[ImportState["Committing"] = 3] = "Committing";
10
+ ImportState[ImportState["Completed"] = 4] = "Completed";
11
+ ImportState[ImportState["Failed"] = 5] = "Failed";
12
+ ImportState[ImportState["Abandoned"] = 6] = "Abandoned";
13
+ ImportState[ImportState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
14
+ })(ImportState || (ImportState = {}));
15
+ function importStateFromJSON(object) {
16
+ switch (object) {
17
+ case 0:
18
+ case "Open":
19
+ return ImportState.Open;
20
+ case 1:
21
+ case "Staging":
22
+ return ImportState.Staging;
23
+ case 2:
24
+ case "Validating":
25
+ return ImportState.Validating;
26
+ case 3:
27
+ case "Committing":
28
+ return ImportState.Committing;
29
+ case 4:
30
+ case "Completed":
31
+ return ImportState.Completed;
32
+ case 5:
33
+ case "Failed":
34
+ return ImportState.Failed;
35
+ case 6:
36
+ case "Abandoned":
37
+ return ImportState.Abandoned;
38
+ case -1:
39
+ case "UNRECOGNIZED":
40
+ default:
41
+ return ImportState.UNRECOGNIZED;
42
+ }
43
+ }
44
+ function importStateToJSON(object) {
45
+ switch (object) {
46
+ case ImportState.Open:
47
+ return "Open";
48
+ case ImportState.Staging:
49
+ return "Staging";
50
+ case ImportState.Validating:
51
+ return "Validating";
52
+ case ImportState.Committing:
53
+ return "Committing";
54
+ case ImportState.Completed:
55
+ return "Completed";
56
+ case ImportState.Failed:
57
+ return "Failed";
58
+ case ImportState.Abandoned:
59
+ return "Abandoned";
60
+ case ImportState.UNRECOGNIZED:
61
+ default:
62
+ return "UNRECOGNIZED";
63
+ }
64
+ }
65
+ var OnInvalidEvent;
66
+ (function (OnInvalidEvent) {
67
+ OnInvalidEvent[OnInvalidEvent["Reject"] = 0] = "Reject";
68
+ OnInvalidEvent[OnInvalidEvent["Skip"] = 1] = "Skip";
69
+ OnInvalidEvent[OnInvalidEvent["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
70
+ })(OnInvalidEvent || (OnInvalidEvent = {}));
71
+ function onInvalidEventFromJSON(object) {
72
+ switch (object) {
73
+ case 0:
74
+ case "Reject":
75
+ return OnInvalidEvent.Reject;
76
+ case 1:
77
+ case "Skip":
78
+ return OnInvalidEvent.Skip;
79
+ case -1:
80
+ case "UNRECOGNIZED":
81
+ default:
82
+ return OnInvalidEvent.UNRECOGNIZED;
83
+ }
84
+ }
85
+ function onInvalidEventToJSON(object) {
86
+ switch (object) {
87
+ case OnInvalidEvent.Reject:
88
+ return "Reject";
89
+ case OnInvalidEvent.Skip:
90
+ return "Skip";
91
+ case OnInvalidEvent.UNRECOGNIZED:
92
+ default:
93
+ return "UNRECOGNIZED";
94
+ }
95
+ }
96
+ var ValidationResultSeverity;
97
+ (function (ValidationResultSeverity) {
98
+ ValidationResultSeverity[ValidationResultSeverity["Unknown"] = 0] = "Unknown";
99
+ ValidationResultSeverity[ValidationResultSeverity["Information"] = 1] = "Information";
100
+ ValidationResultSeverity[ValidationResultSeverity["Warning"] = 2] = "Warning";
101
+ ValidationResultSeverity[ValidationResultSeverity["Error"] = 3] = "Error";
102
+ ValidationResultSeverity[ValidationResultSeverity["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
103
+ })(ValidationResultSeverity || (ValidationResultSeverity = {}));
104
+ function validationResultSeverityFromJSON(object) {
105
+ switch (object) {
106
+ case 0:
107
+ case "Unknown":
108
+ return ValidationResultSeverity.Unknown;
109
+ case 1:
110
+ case "Information":
111
+ return ValidationResultSeverity.Information;
112
+ case 2:
113
+ case "Warning":
114
+ return ValidationResultSeverity.Warning;
115
+ case 3:
116
+ case "Error":
117
+ return ValidationResultSeverity.Error;
118
+ case -1:
119
+ case "UNRECOGNIZED":
120
+ default:
121
+ return ValidationResultSeverity.UNRECOGNIZED;
122
+ }
123
+ }
124
+ function validationResultSeverityToJSON(object) {
125
+ switch (object) {
126
+ case ValidationResultSeverity.Unknown:
127
+ return "Unknown";
128
+ case ValidationResultSeverity.Information:
129
+ return "Information";
130
+ case ValidationResultSeverity.Warning:
131
+ return "Warning";
132
+ case ValidationResultSeverity.Error:
133
+ return "Error";
134
+ case ValidationResultSeverity.UNRECOGNIZED:
135
+ default:
136
+ return "UNRECOGNIZED";
137
+ }
138
+ }
139
+ function createBaseAbandonImportRequest() {
140
+ return { EventStore: "", Namespace: "", ImportId: undefined };
141
+ }
142
+ const AbandonImportRequest = {
143
+ encode(message, writer = new BinaryWriter()) {
144
+ if (message.EventStore !== "") {
145
+ writer.uint32(10).string(message.EventStore);
146
+ }
147
+ if (message.Namespace !== "") {
148
+ writer.uint32(18).string(message.Namespace);
149
+ }
150
+ if (message.ImportId !== undefined) {
151
+ Guid.encode(message.ImportId, writer.uint32(26).fork()).join();
152
+ }
153
+ return writer;
154
+ },
155
+ decode(input, length) {
156
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
157
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
158
+ if (previousRecursionDepth >= 100) {
159
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
160
+ }
161
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
162
+ try {
163
+ const end = length === undefined ? reader.len : reader.pos + length;
164
+ const message = createBaseAbandonImportRequest();
165
+ while (reader.pos < end) {
166
+ const tag = reader.uint32();
167
+ switch (tag >>> 3) {
168
+ case 1: {
169
+ if (tag !== 10) {
170
+ break;
171
+ }
172
+ message.EventStore = reader.string();
173
+ continue;
174
+ }
175
+ case 2: {
176
+ if (tag !== 18) {
177
+ break;
178
+ }
179
+ message.Namespace = reader.string();
180
+ continue;
181
+ }
182
+ case 3: {
183
+ if (tag !== 26) {
184
+ break;
185
+ }
186
+ message.ImportId = Guid.decode(reader, reader.uint32());
187
+ continue;
188
+ }
189
+ }
190
+ if ((tag & 7) === 4 || tag === 0) {
191
+ break;
192
+ }
193
+ reader.skip(tag & 7);
194
+ }
195
+ return message;
196
+ }
197
+ finally {
198
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
199
+ }
200
+ },
201
+ fromJSON(object) {
202
+ return {
203
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
204
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
205
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
206
+ };
207
+ },
208
+ toJSON(message) {
209
+ const obj = {};
210
+ if (message.EventStore !== "") {
211
+ obj.EventStore = message.EventStore;
212
+ }
213
+ if (message.Namespace !== "") {
214
+ obj.Namespace = message.Namespace;
215
+ }
216
+ if (message.ImportId !== undefined) {
217
+ obj.ImportId = Guid.toJSON(message.ImportId);
218
+ }
219
+ return obj;
220
+ },
221
+ create(base) {
222
+ return AbandonImportRequest.fromPartial(base ?? {});
223
+ },
224
+ fromPartial(object) {
225
+ const message = createBaseAbandonImportRequest();
226
+ message.EventStore = object.EventStore ?? "";
227
+ message.Namespace = object.Namespace ?? "";
228
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
229
+ ? Guid.fromPartial(object.ImportId)
230
+ : undefined;
231
+ return message;
232
+ },
233
+ };
234
+ function createBaseAbandonImportResponse() {
235
+ return { ImportId: undefined, State: 0, Error: "" };
236
+ }
237
+ const AbandonImportResponse = {
238
+ encode(message, writer = new BinaryWriter()) {
239
+ if (message.ImportId !== undefined) {
240
+ Guid.encode(message.ImportId, writer.uint32(10).fork()).join();
241
+ }
242
+ if (message.State !== 0) {
243
+ writer.uint32(16).int32(message.State);
244
+ }
245
+ if (message.Error !== "") {
246
+ writer.uint32(26).string(message.Error);
247
+ }
248
+ return writer;
249
+ },
250
+ decode(input, length) {
251
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
252
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
253
+ if (previousRecursionDepth >= 100) {
254
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
255
+ }
256
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
257
+ try {
258
+ const end = length === undefined ? reader.len : reader.pos + length;
259
+ const message = createBaseAbandonImportResponse();
260
+ while (reader.pos < end) {
261
+ const tag = reader.uint32();
262
+ switch (tag >>> 3) {
263
+ case 1: {
264
+ if (tag !== 10) {
265
+ break;
266
+ }
267
+ message.ImportId = Guid.decode(reader, reader.uint32());
268
+ continue;
269
+ }
270
+ case 2: {
271
+ if (tag !== 16) {
272
+ break;
273
+ }
274
+ message.State = reader.int32();
275
+ continue;
276
+ }
277
+ case 3: {
278
+ if (tag !== 26) {
279
+ break;
280
+ }
281
+ message.Error = reader.string();
282
+ continue;
283
+ }
284
+ }
285
+ if ((tag & 7) === 4 || tag === 0) {
286
+ break;
287
+ }
288
+ reader.skip(tag & 7);
289
+ }
290
+ return message;
291
+ }
292
+ finally {
293
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
294
+ }
295
+ },
296
+ fromJSON(object) {
297
+ return {
298
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
299
+ State: isSet(object.State) ? importStateFromJSON(object.State) : 0,
300
+ Error: isSet(object.Error) ? globalThis.String(object.Error) : "",
301
+ };
302
+ },
303
+ toJSON(message) {
304
+ const obj = {};
305
+ if (message.ImportId !== undefined) {
306
+ obj.ImportId = Guid.toJSON(message.ImportId);
307
+ }
308
+ if (message.State !== 0) {
309
+ obj.State = importStateToJSON(message.State);
310
+ }
311
+ if (message.Error !== "") {
312
+ obj.Error = message.Error;
313
+ }
314
+ return obj;
315
+ },
316
+ create(base) {
317
+ return AbandonImportResponse.fromPartial(base ?? {});
318
+ },
319
+ fromPartial(object) {
320
+ const message = createBaseAbandonImportResponse();
321
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
322
+ ? Guid.fromPartial(object.ImportId)
323
+ : undefined;
324
+ message.State = object.State ?? 0;
325
+ message.Error = object.Error ?? "";
326
+ return message;
327
+ },
328
+ };
329
+ function createBaseAddImportChunkRequest() {
330
+ return { EventStore: "", Namespace: "", ImportId: undefined, ChunkIndex: 0, FirstEventIndex: 0n, Events: [] };
331
+ }
332
+ const AddImportChunkRequest = {
333
+ encode(message, writer = new BinaryWriter()) {
334
+ if (message.EventStore !== "") {
335
+ writer.uint32(10).string(message.EventStore);
336
+ }
337
+ if (message.Namespace !== "") {
338
+ writer.uint32(18).string(message.Namespace);
339
+ }
340
+ if (message.ImportId !== undefined) {
341
+ Guid.encode(message.ImportId, writer.uint32(26).fork()).join();
342
+ }
343
+ if (message.ChunkIndex !== 0) {
344
+ writer.uint32(32).int32(message.ChunkIndex);
345
+ }
346
+ if (message.FirstEventIndex !== 0n) {
347
+ if (BigInt.asIntN(64, message.FirstEventIndex) !== message.FirstEventIndex) {
348
+ throw new globalThis.Error("value provided for field message.FirstEventIndex of type int64 too large");
349
+ }
350
+ writer.uint32(40).int64(message.FirstEventIndex);
351
+ }
352
+ for (const v of message.Events) {
353
+ ImportEvent.encode(v, writer.uint32(50).fork()).join();
354
+ }
355
+ return writer;
356
+ },
357
+ decode(input, length) {
358
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
359
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
360
+ if (previousRecursionDepth >= 100) {
361
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
362
+ }
363
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
364
+ try {
365
+ const end = length === undefined ? reader.len : reader.pos + length;
366
+ const message = createBaseAddImportChunkRequest();
367
+ while (reader.pos < end) {
368
+ const tag = reader.uint32();
369
+ switch (tag >>> 3) {
370
+ case 1: {
371
+ if (tag !== 10) {
372
+ break;
373
+ }
374
+ message.EventStore = reader.string();
375
+ continue;
376
+ }
377
+ case 2: {
378
+ if (tag !== 18) {
379
+ break;
380
+ }
381
+ message.Namespace = reader.string();
382
+ continue;
383
+ }
384
+ case 3: {
385
+ if (tag !== 26) {
386
+ break;
387
+ }
388
+ message.ImportId = Guid.decode(reader, reader.uint32());
389
+ continue;
390
+ }
391
+ case 4: {
392
+ if (tag !== 32) {
393
+ break;
394
+ }
395
+ message.ChunkIndex = reader.int32();
396
+ continue;
397
+ }
398
+ case 5: {
399
+ if (tag !== 40) {
400
+ break;
401
+ }
402
+ message.FirstEventIndex = reader.int64();
403
+ continue;
404
+ }
405
+ case 6: {
406
+ if (tag !== 50) {
407
+ break;
408
+ }
409
+ message.Events.push(ImportEvent.decode(reader, reader.uint32()));
410
+ continue;
411
+ }
412
+ }
413
+ if ((tag & 7) === 4 || tag === 0) {
414
+ break;
415
+ }
416
+ reader.skip(tag & 7);
417
+ }
418
+ return message;
419
+ }
420
+ finally {
421
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
422
+ }
423
+ },
424
+ fromJSON(object) {
425
+ return {
426
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
427
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
428
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
429
+ ChunkIndex: isSet(object.ChunkIndex) ? globalThis.Number(object.ChunkIndex) : 0,
430
+ FirstEventIndex: isSet(object.FirstEventIndex) ? BigInt(object.FirstEventIndex) : 0n,
431
+ Events: globalThis.Array.isArray(object?.Events) ? object.Events.map((e) => ImportEvent.fromJSON(e)) : [],
432
+ };
433
+ },
434
+ toJSON(message) {
435
+ const obj = {};
436
+ if (message.EventStore !== "") {
437
+ obj.EventStore = message.EventStore;
438
+ }
439
+ if (message.Namespace !== "") {
440
+ obj.Namespace = message.Namespace;
441
+ }
442
+ if (message.ImportId !== undefined) {
443
+ obj.ImportId = Guid.toJSON(message.ImportId);
444
+ }
445
+ if (message.ChunkIndex !== 0) {
446
+ obj.ChunkIndex = Math.round(message.ChunkIndex);
447
+ }
448
+ if (message.FirstEventIndex !== 0n) {
449
+ obj.FirstEventIndex = message.FirstEventIndex.toString();
450
+ }
451
+ if (message.Events?.length) {
452
+ obj.Events = message.Events.map((e) => ImportEvent.toJSON(e));
453
+ }
454
+ return obj;
455
+ },
456
+ create(base) {
457
+ return AddImportChunkRequest.fromPartial(base ?? {});
458
+ },
459
+ fromPartial(object) {
460
+ const message = createBaseAddImportChunkRequest();
461
+ message.EventStore = object.EventStore ?? "";
462
+ message.Namespace = object.Namespace ?? "";
463
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
464
+ ? Guid.fromPartial(object.ImportId)
465
+ : undefined;
466
+ message.ChunkIndex = object.ChunkIndex ?? 0;
467
+ message.FirstEventIndex = (object.FirstEventIndex !== undefined && object.FirstEventIndex !== null)
468
+ ? BigInt(object.FirstEventIndex)
469
+ : 0n;
470
+ message.Events = object.Events?.map((e) => ImportEvent.fromPartial(e)) || [];
471
+ return message;
472
+ },
473
+ };
474
+ function createBaseAddImportChunkResponse() {
475
+ return { ChunkIndex: 0, AlreadyStaged: false, EventsReceived: 0, EventsStaged: 0, Rejections: [], Error: "" };
476
+ }
477
+ const AddImportChunkResponse = {
478
+ encode(message, writer = new BinaryWriter()) {
479
+ if (message.ChunkIndex !== 0) {
480
+ writer.uint32(8).int32(message.ChunkIndex);
481
+ }
482
+ if (message.AlreadyStaged !== false) {
483
+ writer.uint32(16).bool(message.AlreadyStaged);
484
+ }
485
+ if (message.EventsReceived !== 0) {
486
+ writer.uint32(24).int32(message.EventsReceived);
487
+ }
488
+ if (message.EventsStaged !== 0) {
489
+ writer.uint32(32).int32(message.EventsStaged);
490
+ }
491
+ for (const v of message.Rejections) {
492
+ ImportEventRejection.encode(v, writer.uint32(42).fork()).join();
493
+ }
494
+ if (message.Error !== "") {
495
+ writer.uint32(50).string(message.Error);
496
+ }
497
+ return writer;
498
+ },
499
+ decode(input, length) {
500
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
501
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
502
+ if (previousRecursionDepth >= 100) {
503
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
504
+ }
505
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
506
+ try {
507
+ const end = length === undefined ? reader.len : reader.pos + length;
508
+ const message = createBaseAddImportChunkResponse();
509
+ while (reader.pos < end) {
510
+ const tag = reader.uint32();
511
+ switch (tag >>> 3) {
512
+ case 1: {
513
+ if (tag !== 8) {
514
+ break;
515
+ }
516
+ message.ChunkIndex = reader.int32();
517
+ continue;
518
+ }
519
+ case 2: {
520
+ if (tag !== 16) {
521
+ break;
522
+ }
523
+ message.AlreadyStaged = reader.bool();
524
+ continue;
525
+ }
526
+ case 3: {
527
+ if (tag !== 24) {
528
+ break;
529
+ }
530
+ message.EventsReceived = reader.int32();
531
+ continue;
532
+ }
533
+ case 4: {
534
+ if (tag !== 32) {
535
+ break;
536
+ }
537
+ message.EventsStaged = reader.int32();
538
+ continue;
539
+ }
540
+ case 5: {
541
+ if (tag !== 42) {
542
+ break;
543
+ }
544
+ message.Rejections.push(ImportEventRejection.decode(reader, reader.uint32()));
545
+ continue;
546
+ }
547
+ case 6: {
548
+ if (tag !== 50) {
549
+ break;
550
+ }
551
+ message.Error = reader.string();
552
+ continue;
553
+ }
554
+ }
555
+ if ((tag & 7) === 4 || tag === 0) {
556
+ break;
557
+ }
558
+ reader.skip(tag & 7);
559
+ }
560
+ return message;
561
+ }
562
+ finally {
563
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
564
+ }
565
+ },
566
+ fromJSON(object) {
567
+ return {
568
+ ChunkIndex: isSet(object.ChunkIndex) ? globalThis.Number(object.ChunkIndex) : 0,
569
+ AlreadyStaged: isSet(object.AlreadyStaged) ? globalThis.Boolean(object.AlreadyStaged) : false,
570
+ EventsReceived: isSet(object.EventsReceived) ? globalThis.Number(object.EventsReceived) : 0,
571
+ EventsStaged: isSet(object.EventsStaged) ? globalThis.Number(object.EventsStaged) : 0,
572
+ Rejections: globalThis.Array.isArray(object?.Rejections)
573
+ ? object.Rejections.map((e) => ImportEventRejection.fromJSON(e))
574
+ : [],
575
+ Error: isSet(object.Error) ? globalThis.String(object.Error) : "",
576
+ };
577
+ },
578
+ toJSON(message) {
579
+ const obj = {};
580
+ if (message.ChunkIndex !== 0) {
581
+ obj.ChunkIndex = Math.round(message.ChunkIndex);
582
+ }
583
+ if (message.AlreadyStaged !== false) {
584
+ obj.AlreadyStaged = message.AlreadyStaged;
585
+ }
586
+ if (message.EventsReceived !== 0) {
587
+ obj.EventsReceived = Math.round(message.EventsReceived);
588
+ }
589
+ if (message.EventsStaged !== 0) {
590
+ obj.EventsStaged = Math.round(message.EventsStaged);
591
+ }
592
+ if (message.Rejections?.length) {
593
+ obj.Rejections = message.Rejections.map((e) => ImportEventRejection.toJSON(e));
594
+ }
595
+ if (message.Error !== "") {
596
+ obj.Error = message.Error;
597
+ }
598
+ return obj;
599
+ },
600
+ create(base) {
601
+ return AddImportChunkResponse.fromPartial(base ?? {});
602
+ },
603
+ fromPartial(object) {
604
+ const message = createBaseAddImportChunkResponse();
605
+ message.ChunkIndex = object.ChunkIndex ?? 0;
606
+ message.AlreadyStaged = object.AlreadyStaged ?? false;
607
+ message.EventsReceived = object.EventsReceived ?? 0;
608
+ message.EventsStaged = object.EventsStaged ?? 0;
609
+ message.Rejections = object.Rejections?.map((e) => ImportEventRejection.fromPartial(e)) || [];
610
+ message.Error = object.Error ?? "";
611
+ return message;
612
+ },
613
+ };
614
+ function createBaseBeginImportRequest() {
615
+ return { EventStore: "", Namespace: "", EventSequenceId: "", OnInvalid: 0, ImportId: undefined };
616
+ }
617
+ const BeginImportRequest = {
618
+ encode(message, writer = new BinaryWriter()) {
619
+ if (message.EventStore !== "") {
620
+ writer.uint32(10).string(message.EventStore);
621
+ }
622
+ if (message.Namespace !== "") {
623
+ writer.uint32(18).string(message.Namespace);
624
+ }
625
+ if (message.EventSequenceId !== "") {
626
+ writer.uint32(26).string(message.EventSequenceId);
627
+ }
628
+ if (message.OnInvalid !== 0) {
629
+ writer.uint32(32).int32(message.OnInvalid);
630
+ }
631
+ if (message.ImportId !== undefined) {
632
+ Guid.encode(message.ImportId, writer.uint32(42).fork()).join();
633
+ }
634
+ return writer;
635
+ },
636
+ decode(input, length) {
637
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
638
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
639
+ if (previousRecursionDepth >= 100) {
640
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
641
+ }
642
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
643
+ try {
644
+ const end = length === undefined ? reader.len : reader.pos + length;
645
+ const message = createBaseBeginImportRequest();
646
+ while (reader.pos < end) {
647
+ const tag = reader.uint32();
648
+ switch (tag >>> 3) {
649
+ case 1: {
650
+ if (tag !== 10) {
651
+ break;
652
+ }
653
+ message.EventStore = reader.string();
654
+ continue;
655
+ }
656
+ case 2: {
657
+ if (tag !== 18) {
658
+ break;
659
+ }
660
+ message.Namespace = reader.string();
661
+ continue;
662
+ }
663
+ case 3: {
664
+ if (tag !== 26) {
665
+ break;
666
+ }
667
+ message.EventSequenceId = reader.string();
668
+ continue;
669
+ }
670
+ case 4: {
671
+ if (tag !== 32) {
672
+ break;
673
+ }
674
+ message.OnInvalid = reader.int32();
675
+ continue;
676
+ }
677
+ case 5: {
678
+ if (tag !== 42) {
679
+ break;
680
+ }
681
+ message.ImportId = Guid.decode(reader, reader.uint32());
682
+ continue;
683
+ }
684
+ }
685
+ if ((tag & 7) === 4 || tag === 0) {
686
+ break;
687
+ }
688
+ reader.skip(tag & 7);
689
+ }
690
+ return message;
691
+ }
692
+ finally {
693
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
694
+ }
695
+ },
696
+ fromJSON(object) {
697
+ return {
698
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
699
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
700
+ EventSequenceId: isSet(object.EventSequenceId) ? globalThis.String(object.EventSequenceId) : "",
701
+ OnInvalid: isSet(object.OnInvalid) ? onInvalidEventFromJSON(object.OnInvalid) : 0,
702
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
703
+ };
704
+ },
705
+ toJSON(message) {
706
+ const obj = {};
707
+ if (message.EventStore !== "") {
708
+ obj.EventStore = message.EventStore;
709
+ }
710
+ if (message.Namespace !== "") {
711
+ obj.Namespace = message.Namespace;
712
+ }
713
+ if (message.EventSequenceId !== "") {
714
+ obj.EventSequenceId = message.EventSequenceId;
715
+ }
716
+ if (message.OnInvalid !== 0) {
717
+ obj.OnInvalid = onInvalidEventToJSON(message.OnInvalid);
718
+ }
719
+ if (message.ImportId !== undefined) {
720
+ obj.ImportId = Guid.toJSON(message.ImportId);
721
+ }
722
+ return obj;
723
+ },
724
+ create(base) {
725
+ return BeginImportRequest.fromPartial(base ?? {});
726
+ },
727
+ fromPartial(object) {
728
+ const message = createBaseBeginImportRequest();
729
+ message.EventStore = object.EventStore ?? "";
730
+ message.Namespace = object.Namespace ?? "";
731
+ message.EventSequenceId = object.EventSequenceId ?? "";
732
+ message.OnInvalid = object.OnInvalid ?? 0;
733
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
734
+ ? Guid.fromPartial(object.ImportId)
735
+ : undefined;
736
+ return message;
737
+ },
738
+ };
739
+ function createBaseBeginImportResponse() {
740
+ return { ImportId: undefined, State: 0, MaxChunkEvents: 0, MaxChunkBytes: 0, Error: "" };
741
+ }
742
+ const BeginImportResponse = {
743
+ encode(message, writer = new BinaryWriter()) {
744
+ if (message.ImportId !== undefined) {
745
+ Guid.encode(message.ImportId, writer.uint32(10).fork()).join();
746
+ }
747
+ if (message.State !== 0) {
748
+ writer.uint32(16).int32(message.State);
749
+ }
750
+ if (message.MaxChunkEvents !== 0) {
751
+ writer.uint32(24).int32(message.MaxChunkEvents);
752
+ }
753
+ if (message.MaxChunkBytes !== 0) {
754
+ writer.uint32(32).int32(message.MaxChunkBytes);
755
+ }
756
+ if (message.Error !== "") {
757
+ writer.uint32(42).string(message.Error);
758
+ }
759
+ return writer;
760
+ },
761
+ decode(input, length) {
762
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
763
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
764
+ if (previousRecursionDepth >= 100) {
765
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
766
+ }
767
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
768
+ try {
769
+ const end = length === undefined ? reader.len : reader.pos + length;
770
+ const message = createBaseBeginImportResponse();
771
+ while (reader.pos < end) {
772
+ const tag = reader.uint32();
773
+ switch (tag >>> 3) {
774
+ case 1: {
775
+ if (tag !== 10) {
776
+ break;
777
+ }
778
+ message.ImportId = Guid.decode(reader, reader.uint32());
779
+ continue;
780
+ }
781
+ case 2: {
782
+ if (tag !== 16) {
783
+ break;
784
+ }
785
+ message.State = reader.int32();
786
+ continue;
787
+ }
788
+ case 3: {
789
+ if (tag !== 24) {
790
+ break;
791
+ }
792
+ message.MaxChunkEvents = reader.int32();
793
+ continue;
794
+ }
795
+ case 4: {
796
+ if (tag !== 32) {
797
+ break;
798
+ }
799
+ message.MaxChunkBytes = reader.int32();
800
+ continue;
801
+ }
802
+ case 5: {
803
+ if (tag !== 42) {
804
+ break;
805
+ }
806
+ message.Error = reader.string();
807
+ continue;
808
+ }
809
+ }
810
+ if ((tag & 7) === 4 || tag === 0) {
811
+ break;
812
+ }
813
+ reader.skip(tag & 7);
814
+ }
815
+ return message;
816
+ }
817
+ finally {
818
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
819
+ }
820
+ },
821
+ fromJSON(object) {
822
+ return {
823
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
824
+ State: isSet(object.State) ? importStateFromJSON(object.State) : 0,
825
+ MaxChunkEvents: isSet(object.MaxChunkEvents) ? globalThis.Number(object.MaxChunkEvents) : 0,
826
+ MaxChunkBytes: isSet(object.MaxChunkBytes) ? globalThis.Number(object.MaxChunkBytes) : 0,
827
+ Error: isSet(object.Error) ? globalThis.String(object.Error) : "",
828
+ };
829
+ },
830
+ toJSON(message) {
831
+ const obj = {};
832
+ if (message.ImportId !== undefined) {
833
+ obj.ImportId = Guid.toJSON(message.ImportId);
834
+ }
835
+ if (message.State !== 0) {
836
+ obj.State = importStateToJSON(message.State);
837
+ }
838
+ if (message.MaxChunkEvents !== 0) {
839
+ obj.MaxChunkEvents = Math.round(message.MaxChunkEvents);
840
+ }
841
+ if (message.MaxChunkBytes !== 0) {
842
+ obj.MaxChunkBytes = Math.round(message.MaxChunkBytes);
843
+ }
844
+ if (message.Error !== "") {
845
+ obj.Error = message.Error;
846
+ }
847
+ return obj;
848
+ },
849
+ create(base) {
850
+ return BeginImportResponse.fromPartial(base ?? {});
851
+ },
852
+ fromPartial(object) {
853
+ const message = createBaseBeginImportResponse();
854
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
855
+ ? Guid.fromPartial(object.ImportId)
856
+ : undefined;
857
+ message.State = object.State ?? 0;
858
+ message.MaxChunkEvents = object.MaxChunkEvents ?? 0;
859
+ message.MaxChunkBytes = object.MaxChunkBytes ?? 0;
860
+ message.Error = object.Error ?? "";
861
+ return message;
862
+ },
863
+ };
864
+ function createBaseCausation() {
865
+ return { Occurred: undefined, Type: "", Properties: {} };
866
+ }
867
+ const Causation = {
868
+ encode(message, writer = new BinaryWriter()) {
869
+ if (message.Occurred !== undefined) {
870
+ SerializableDateTimeOffset.encode(message.Occurred, writer.uint32(10).fork()).join();
871
+ }
872
+ if (message.Type !== "") {
873
+ writer.uint32(18).string(message.Type);
874
+ }
875
+ globalThis.Object.entries(message.Properties).forEach(([key, value]) => {
876
+ Causation_PropertiesEntry.encode({ key: key, value }, writer.uint32(26).fork()).join();
877
+ });
878
+ return writer;
879
+ },
880
+ decode(input, length) {
881
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
882
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
883
+ if (previousRecursionDepth >= 100) {
884
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
885
+ }
886
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
887
+ try {
888
+ const end = length === undefined ? reader.len : reader.pos + length;
889
+ const message = createBaseCausation();
890
+ while (reader.pos < end) {
891
+ const tag = reader.uint32();
892
+ switch (tag >>> 3) {
893
+ case 1: {
894
+ if (tag !== 10) {
895
+ break;
896
+ }
897
+ message.Occurred = SerializableDateTimeOffset.decode(reader, reader.uint32());
898
+ continue;
899
+ }
900
+ case 2: {
901
+ if (tag !== 18) {
902
+ break;
903
+ }
904
+ message.Type = reader.string();
905
+ continue;
906
+ }
907
+ case 3: {
908
+ if (tag !== 26) {
909
+ break;
910
+ }
911
+ const entry3 = Causation_PropertiesEntry.decode(reader, reader.uint32());
912
+ if (entry3.value !== undefined) {
913
+ message.Properties[entry3.key] = entry3.value;
914
+ }
915
+ continue;
916
+ }
917
+ }
918
+ if ((tag & 7) === 4 || tag === 0) {
919
+ break;
920
+ }
921
+ reader.skip(tag & 7);
922
+ }
923
+ return message;
924
+ }
925
+ finally {
926
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
927
+ }
928
+ },
929
+ fromJSON(object) {
930
+ return {
931
+ Occurred: isSet(object.Occurred) ? SerializableDateTimeOffset.fromJSON(object.Occurred) : undefined,
932
+ Type: isSet(object.Type) ? globalThis.String(object.Type) : "",
933
+ Properties: isObject(object.Properties)
934
+ ? globalThis.Object.entries(object.Properties).reduce((acc, [key, value]) => {
935
+ globalThis.Object.defineProperty(acc, key, {
936
+ value: globalThis.String(value),
937
+ enumerable: true,
938
+ configurable: true,
939
+ writable: true,
940
+ });
941
+ return acc;
942
+ }, {})
943
+ : {},
944
+ };
945
+ },
946
+ toJSON(message) {
947
+ const obj = {};
948
+ if (message.Occurred !== undefined) {
949
+ obj.Occurred = SerializableDateTimeOffset.toJSON(message.Occurred);
950
+ }
951
+ if (message.Type !== "") {
952
+ obj.Type = message.Type;
953
+ }
954
+ if (message.Properties) {
955
+ const entries = globalThis.Object.entries(message.Properties);
956
+ if (entries.length > 0) {
957
+ obj.Properties = {};
958
+ entries.forEach(([k, v]) => {
959
+ obj.Properties[k] = v;
960
+ });
961
+ }
962
+ }
963
+ return obj;
964
+ },
965
+ create(base) {
966
+ return Causation.fromPartial(base ?? {});
967
+ },
968
+ fromPartial(object) {
969
+ const message = createBaseCausation();
970
+ message.Occurred = (object.Occurred !== undefined && object.Occurred !== null)
971
+ ? SerializableDateTimeOffset.fromPartial(object.Occurred)
972
+ : undefined;
973
+ message.Type = object.Type ?? "";
974
+ message.Properties = globalThis.Object.entries(object.Properties ?? {}).reduce((acc, [key, value]) => {
975
+ if (value !== undefined) {
976
+ acc[key] = globalThis.String(value);
977
+ }
978
+ return acc;
979
+ }, {});
980
+ return message;
981
+ },
982
+ };
983
+ function createBaseCausation_PropertiesEntry() {
984
+ return { key: "", value: "" };
985
+ }
986
+ const Causation_PropertiesEntry = {
987
+ encode(message, writer = new BinaryWriter()) {
988
+ if (message.key !== "") {
989
+ writer.uint32(10).string(message.key);
990
+ }
991
+ if (message.value !== "") {
992
+ writer.uint32(18).string(message.value);
993
+ }
994
+ return writer;
995
+ },
996
+ decode(input, length) {
997
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
998
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
999
+ if (previousRecursionDepth >= 100) {
1000
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1001
+ }
1002
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1003
+ try {
1004
+ const end = length === undefined ? reader.len : reader.pos + length;
1005
+ const message = createBaseCausation_PropertiesEntry();
1006
+ while (reader.pos < end) {
1007
+ const tag = reader.uint32();
1008
+ switch (tag >>> 3) {
1009
+ case 1: {
1010
+ if (tag !== 10) {
1011
+ break;
1012
+ }
1013
+ message.key = reader.string();
1014
+ continue;
1015
+ }
1016
+ case 2: {
1017
+ if (tag !== 18) {
1018
+ break;
1019
+ }
1020
+ message.value = reader.string();
1021
+ continue;
1022
+ }
1023
+ }
1024
+ if ((tag & 7) === 4 || tag === 0) {
1025
+ break;
1026
+ }
1027
+ reader.skip(tag & 7);
1028
+ }
1029
+ return message;
1030
+ }
1031
+ finally {
1032
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1033
+ }
1034
+ },
1035
+ fromJSON(object) {
1036
+ return {
1037
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1038
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1039
+ };
1040
+ },
1041
+ toJSON(message) {
1042
+ const obj = {};
1043
+ if (message.key !== "") {
1044
+ obj.key = message.key;
1045
+ }
1046
+ if (message.value !== "") {
1047
+ obj.value = message.value;
1048
+ }
1049
+ return obj;
1050
+ },
1051
+ create(base) {
1052
+ return Causation_PropertiesEntry.fromPartial(base ?? {});
1053
+ },
1054
+ fromPartial(object) {
1055
+ const message = createBaseCausation_PropertiesEntry();
1056
+ message.key = object.key ?? "";
1057
+ message.value = object.value ?? "";
1058
+ return message;
1059
+ },
1060
+ };
1061
+ function createBaseCommandResultAbandonImportResponse() {
1062
+ return {
1063
+ CorrelationId: undefined,
1064
+ IsAuthorized: false,
1065
+ ValidationResults: [],
1066
+ ExceptionMessages: [],
1067
+ ExceptionStackTrace: "",
1068
+ AuthorizationFailureReason: "",
1069
+ Response: undefined,
1070
+ };
1071
+ }
1072
+ const CommandResultAbandonImportResponse = {
1073
+ encode(message, writer = new BinaryWriter()) {
1074
+ if (message.CorrelationId !== undefined) {
1075
+ Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join();
1076
+ }
1077
+ if (message.IsAuthorized !== false) {
1078
+ writer.uint32(16).bool(message.IsAuthorized);
1079
+ }
1080
+ for (const v of message.ValidationResults) {
1081
+ ValidationResult.encode(v, writer.uint32(26).fork()).join();
1082
+ }
1083
+ for (const v of message.ExceptionMessages) {
1084
+ writer.uint32(34).string(v);
1085
+ }
1086
+ if (message.ExceptionStackTrace !== "") {
1087
+ writer.uint32(42).string(message.ExceptionStackTrace);
1088
+ }
1089
+ if (message.AuthorizationFailureReason !== "") {
1090
+ writer.uint32(50).string(message.AuthorizationFailureReason);
1091
+ }
1092
+ if (message.Response !== undefined) {
1093
+ AbandonImportResponse.encode(message.Response, writer.uint32(58).fork()).join();
1094
+ }
1095
+ return writer;
1096
+ },
1097
+ decode(input, length) {
1098
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1099
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1100
+ if (previousRecursionDepth >= 100) {
1101
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1102
+ }
1103
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1104
+ try {
1105
+ const end = length === undefined ? reader.len : reader.pos + length;
1106
+ const message = createBaseCommandResultAbandonImportResponse();
1107
+ while (reader.pos < end) {
1108
+ const tag = reader.uint32();
1109
+ switch (tag >>> 3) {
1110
+ case 1: {
1111
+ if (tag !== 10) {
1112
+ break;
1113
+ }
1114
+ message.CorrelationId = Guid.decode(reader, reader.uint32());
1115
+ continue;
1116
+ }
1117
+ case 2: {
1118
+ if (tag !== 16) {
1119
+ break;
1120
+ }
1121
+ message.IsAuthorized = reader.bool();
1122
+ continue;
1123
+ }
1124
+ case 3: {
1125
+ if (tag !== 26) {
1126
+ break;
1127
+ }
1128
+ message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32()));
1129
+ continue;
1130
+ }
1131
+ case 4: {
1132
+ if (tag !== 34) {
1133
+ break;
1134
+ }
1135
+ message.ExceptionMessages.push(reader.string());
1136
+ continue;
1137
+ }
1138
+ case 5: {
1139
+ if (tag !== 42) {
1140
+ break;
1141
+ }
1142
+ message.ExceptionStackTrace = reader.string();
1143
+ continue;
1144
+ }
1145
+ case 6: {
1146
+ if (tag !== 50) {
1147
+ break;
1148
+ }
1149
+ message.AuthorizationFailureReason = reader.string();
1150
+ continue;
1151
+ }
1152
+ case 7: {
1153
+ if (tag !== 58) {
1154
+ break;
1155
+ }
1156
+ message.Response = AbandonImportResponse.decode(reader, reader.uint32());
1157
+ continue;
1158
+ }
1159
+ }
1160
+ if ((tag & 7) === 4 || tag === 0) {
1161
+ break;
1162
+ }
1163
+ reader.skip(tag & 7);
1164
+ }
1165
+ return message;
1166
+ }
1167
+ finally {
1168
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1169
+ }
1170
+ },
1171
+ fromJSON(object) {
1172
+ return {
1173
+ CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined,
1174
+ IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false,
1175
+ ValidationResults: globalThis.Array.isArray(object?.ValidationResults)
1176
+ ? object.ValidationResults.map((e) => ValidationResult.fromJSON(e))
1177
+ : [],
1178
+ ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages)
1179
+ ? object.ExceptionMessages.map((e) => globalThis.String(e))
1180
+ : [],
1181
+ ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "",
1182
+ AuthorizationFailureReason: isSet(object.AuthorizationFailureReason)
1183
+ ? globalThis.String(object.AuthorizationFailureReason)
1184
+ : "",
1185
+ Response: isSet(object.Response) ? AbandonImportResponse.fromJSON(object.Response) : undefined,
1186
+ };
1187
+ },
1188
+ toJSON(message) {
1189
+ const obj = {};
1190
+ if (message.CorrelationId !== undefined) {
1191
+ obj.CorrelationId = Guid.toJSON(message.CorrelationId);
1192
+ }
1193
+ if (message.IsAuthorized !== false) {
1194
+ obj.IsAuthorized = message.IsAuthorized;
1195
+ }
1196
+ if (message.ValidationResults?.length) {
1197
+ obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e));
1198
+ }
1199
+ if (message.ExceptionMessages?.length) {
1200
+ obj.ExceptionMessages = message.ExceptionMessages;
1201
+ }
1202
+ if (message.ExceptionStackTrace !== "") {
1203
+ obj.ExceptionStackTrace = message.ExceptionStackTrace;
1204
+ }
1205
+ if (message.AuthorizationFailureReason !== "") {
1206
+ obj.AuthorizationFailureReason = message.AuthorizationFailureReason;
1207
+ }
1208
+ if (message.Response !== undefined) {
1209
+ obj.Response = AbandonImportResponse.toJSON(message.Response);
1210
+ }
1211
+ return obj;
1212
+ },
1213
+ create(base) {
1214
+ return CommandResultAbandonImportResponse.fromPartial(base ?? {});
1215
+ },
1216
+ fromPartial(object) {
1217
+ const message = createBaseCommandResultAbandonImportResponse();
1218
+ message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null)
1219
+ ? Guid.fromPartial(object.CorrelationId)
1220
+ : undefined;
1221
+ message.IsAuthorized = object.IsAuthorized ?? false;
1222
+ message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || [];
1223
+ message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || [];
1224
+ message.ExceptionStackTrace = object.ExceptionStackTrace ?? "";
1225
+ message.AuthorizationFailureReason = object.AuthorizationFailureReason ?? "";
1226
+ message.Response = (object.Response !== undefined && object.Response !== null)
1227
+ ? AbandonImportResponse.fromPartial(object.Response)
1228
+ : undefined;
1229
+ return message;
1230
+ },
1231
+ };
1232
+ function createBaseCommandResultAddImportChunkResponse() {
1233
+ return {
1234
+ CorrelationId: undefined,
1235
+ IsAuthorized: false,
1236
+ ValidationResults: [],
1237
+ ExceptionMessages: [],
1238
+ ExceptionStackTrace: "",
1239
+ AuthorizationFailureReason: "",
1240
+ Response: undefined,
1241
+ };
1242
+ }
1243
+ const CommandResultAddImportChunkResponse = {
1244
+ encode(message, writer = new BinaryWriter()) {
1245
+ if (message.CorrelationId !== undefined) {
1246
+ Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join();
1247
+ }
1248
+ if (message.IsAuthorized !== false) {
1249
+ writer.uint32(16).bool(message.IsAuthorized);
1250
+ }
1251
+ for (const v of message.ValidationResults) {
1252
+ ValidationResult.encode(v, writer.uint32(26).fork()).join();
1253
+ }
1254
+ for (const v of message.ExceptionMessages) {
1255
+ writer.uint32(34).string(v);
1256
+ }
1257
+ if (message.ExceptionStackTrace !== "") {
1258
+ writer.uint32(42).string(message.ExceptionStackTrace);
1259
+ }
1260
+ if (message.AuthorizationFailureReason !== "") {
1261
+ writer.uint32(50).string(message.AuthorizationFailureReason);
1262
+ }
1263
+ if (message.Response !== undefined) {
1264
+ AddImportChunkResponse.encode(message.Response, writer.uint32(58).fork()).join();
1265
+ }
1266
+ return writer;
1267
+ },
1268
+ decode(input, length) {
1269
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1270
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1271
+ if (previousRecursionDepth >= 100) {
1272
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1273
+ }
1274
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1275
+ try {
1276
+ const end = length === undefined ? reader.len : reader.pos + length;
1277
+ const message = createBaseCommandResultAddImportChunkResponse();
1278
+ while (reader.pos < end) {
1279
+ const tag = reader.uint32();
1280
+ switch (tag >>> 3) {
1281
+ case 1: {
1282
+ if (tag !== 10) {
1283
+ break;
1284
+ }
1285
+ message.CorrelationId = Guid.decode(reader, reader.uint32());
1286
+ continue;
1287
+ }
1288
+ case 2: {
1289
+ if (tag !== 16) {
1290
+ break;
1291
+ }
1292
+ message.IsAuthorized = reader.bool();
1293
+ continue;
1294
+ }
1295
+ case 3: {
1296
+ if (tag !== 26) {
1297
+ break;
1298
+ }
1299
+ message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32()));
1300
+ continue;
1301
+ }
1302
+ case 4: {
1303
+ if (tag !== 34) {
1304
+ break;
1305
+ }
1306
+ message.ExceptionMessages.push(reader.string());
1307
+ continue;
1308
+ }
1309
+ case 5: {
1310
+ if (tag !== 42) {
1311
+ break;
1312
+ }
1313
+ message.ExceptionStackTrace = reader.string();
1314
+ continue;
1315
+ }
1316
+ case 6: {
1317
+ if (tag !== 50) {
1318
+ break;
1319
+ }
1320
+ message.AuthorizationFailureReason = reader.string();
1321
+ continue;
1322
+ }
1323
+ case 7: {
1324
+ if (tag !== 58) {
1325
+ break;
1326
+ }
1327
+ message.Response = AddImportChunkResponse.decode(reader, reader.uint32());
1328
+ continue;
1329
+ }
1330
+ }
1331
+ if ((tag & 7) === 4 || tag === 0) {
1332
+ break;
1333
+ }
1334
+ reader.skip(tag & 7);
1335
+ }
1336
+ return message;
1337
+ }
1338
+ finally {
1339
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1340
+ }
1341
+ },
1342
+ fromJSON(object) {
1343
+ return {
1344
+ CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined,
1345
+ IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false,
1346
+ ValidationResults: globalThis.Array.isArray(object?.ValidationResults)
1347
+ ? object.ValidationResults.map((e) => ValidationResult.fromJSON(e))
1348
+ : [],
1349
+ ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages)
1350
+ ? object.ExceptionMessages.map((e) => globalThis.String(e))
1351
+ : [],
1352
+ ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "",
1353
+ AuthorizationFailureReason: isSet(object.AuthorizationFailureReason)
1354
+ ? globalThis.String(object.AuthorizationFailureReason)
1355
+ : "",
1356
+ Response: isSet(object.Response) ? AddImportChunkResponse.fromJSON(object.Response) : undefined,
1357
+ };
1358
+ },
1359
+ toJSON(message) {
1360
+ const obj = {};
1361
+ if (message.CorrelationId !== undefined) {
1362
+ obj.CorrelationId = Guid.toJSON(message.CorrelationId);
1363
+ }
1364
+ if (message.IsAuthorized !== false) {
1365
+ obj.IsAuthorized = message.IsAuthorized;
1366
+ }
1367
+ if (message.ValidationResults?.length) {
1368
+ obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e));
1369
+ }
1370
+ if (message.ExceptionMessages?.length) {
1371
+ obj.ExceptionMessages = message.ExceptionMessages;
1372
+ }
1373
+ if (message.ExceptionStackTrace !== "") {
1374
+ obj.ExceptionStackTrace = message.ExceptionStackTrace;
1375
+ }
1376
+ if (message.AuthorizationFailureReason !== "") {
1377
+ obj.AuthorizationFailureReason = message.AuthorizationFailureReason;
1378
+ }
1379
+ if (message.Response !== undefined) {
1380
+ obj.Response = AddImportChunkResponse.toJSON(message.Response);
1381
+ }
1382
+ return obj;
1383
+ },
1384
+ create(base) {
1385
+ return CommandResultAddImportChunkResponse.fromPartial(base ?? {});
1386
+ },
1387
+ fromPartial(object) {
1388
+ const message = createBaseCommandResultAddImportChunkResponse();
1389
+ message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null)
1390
+ ? Guid.fromPartial(object.CorrelationId)
1391
+ : undefined;
1392
+ message.IsAuthorized = object.IsAuthorized ?? false;
1393
+ message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || [];
1394
+ message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || [];
1395
+ message.ExceptionStackTrace = object.ExceptionStackTrace ?? "";
1396
+ message.AuthorizationFailureReason = object.AuthorizationFailureReason ?? "";
1397
+ message.Response = (object.Response !== undefined && object.Response !== null)
1398
+ ? AddImportChunkResponse.fromPartial(object.Response)
1399
+ : undefined;
1400
+ return message;
1401
+ },
1402
+ };
1403
+ function createBaseCommandResultBeginImportResponse() {
1404
+ return {
1405
+ CorrelationId: undefined,
1406
+ IsAuthorized: false,
1407
+ ValidationResults: [],
1408
+ ExceptionMessages: [],
1409
+ ExceptionStackTrace: "",
1410
+ AuthorizationFailureReason: "",
1411
+ Response: undefined,
1412
+ };
1413
+ }
1414
+ const CommandResultBeginImportResponse = {
1415
+ encode(message, writer = new BinaryWriter()) {
1416
+ if (message.CorrelationId !== undefined) {
1417
+ Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join();
1418
+ }
1419
+ if (message.IsAuthorized !== false) {
1420
+ writer.uint32(16).bool(message.IsAuthorized);
1421
+ }
1422
+ for (const v of message.ValidationResults) {
1423
+ ValidationResult.encode(v, writer.uint32(26).fork()).join();
1424
+ }
1425
+ for (const v of message.ExceptionMessages) {
1426
+ writer.uint32(34).string(v);
1427
+ }
1428
+ if (message.ExceptionStackTrace !== "") {
1429
+ writer.uint32(42).string(message.ExceptionStackTrace);
1430
+ }
1431
+ if (message.AuthorizationFailureReason !== "") {
1432
+ writer.uint32(50).string(message.AuthorizationFailureReason);
1433
+ }
1434
+ if (message.Response !== undefined) {
1435
+ BeginImportResponse.encode(message.Response, writer.uint32(58).fork()).join();
1436
+ }
1437
+ return writer;
1438
+ },
1439
+ decode(input, length) {
1440
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1441
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1442
+ if (previousRecursionDepth >= 100) {
1443
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1444
+ }
1445
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1446
+ try {
1447
+ const end = length === undefined ? reader.len : reader.pos + length;
1448
+ const message = createBaseCommandResultBeginImportResponse();
1449
+ while (reader.pos < end) {
1450
+ const tag = reader.uint32();
1451
+ switch (tag >>> 3) {
1452
+ case 1: {
1453
+ if (tag !== 10) {
1454
+ break;
1455
+ }
1456
+ message.CorrelationId = Guid.decode(reader, reader.uint32());
1457
+ continue;
1458
+ }
1459
+ case 2: {
1460
+ if (tag !== 16) {
1461
+ break;
1462
+ }
1463
+ message.IsAuthorized = reader.bool();
1464
+ continue;
1465
+ }
1466
+ case 3: {
1467
+ if (tag !== 26) {
1468
+ break;
1469
+ }
1470
+ message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32()));
1471
+ continue;
1472
+ }
1473
+ case 4: {
1474
+ if (tag !== 34) {
1475
+ break;
1476
+ }
1477
+ message.ExceptionMessages.push(reader.string());
1478
+ continue;
1479
+ }
1480
+ case 5: {
1481
+ if (tag !== 42) {
1482
+ break;
1483
+ }
1484
+ message.ExceptionStackTrace = reader.string();
1485
+ continue;
1486
+ }
1487
+ case 6: {
1488
+ if (tag !== 50) {
1489
+ break;
1490
+ }
1491
+ message.AuthorizationFailureReason = reader.string();
1492
+ continue;
1493
+ }
1494
+ case 7: {
1495
+ if (tag !== 58) {
1496
+ break;
1497
+ }
1498
+ message.Response = BeginImportResponse.decode(reader, reader.uint32());
1499
+ continue;
1500
+ }
1501
+ }
1502
+ if ((tag & 7) === 4 || tag === 0) {
1503
+ break;
1504
+ }
1505
+ reader.skip(tag & 7);
1506
+ }
1507
+ return message;
1508
+ }
1509
+ finally {
1510
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1511
+ }
1512
+ },
1513
+ fromJSON(object) {
1514
+ return {
1515
+ CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined,
1516
+ IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false,
1517
+ ValidationResults: globalThis.Array.isArray(object?.ValidationResults)
1518
+ ? object.ValidationResults.map((e) => ValidationResult.fromJSON(e))
1519
+ : [],
1520
+ ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages)
1521
+ ? object.ExceptionMessages.map((e) => globalThis.String(e))
1522
+ : [],
1523
+ ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "",
1524
+ AuthorizationFailureReason: isSet(object.AuthorizationFailureReason)
1525
+ ? globalThis.String(object.AuthorizationFailureReason)
1526
+ : "",
1527
+ Response: isSet(object.Response) ? BeginImportResponse.fromJSON(object.Response) : undefined,
1528
+ };
1529
+ },
1530
+ toJSON(message) {
1531
+ const obj = {};
1532
+ if (message.CorrelationId !== undefined) {
1533
+ obj.CorrelationId = Guid.toJSON(message.CorrelationId);
1534
+ }
1535
+ if (message.IsAuthorized !== false) {
1536
+ obj.IsAuthorized = message.IsAuthorized;
1537
+ }
1538
+ if (message.ValidationResults?.length) {
1539
+ obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e));
1540
+ }
1541
+ if (message.ExceptionMessages?.length) {
1542
+ obj.ExceptionMessages = message.ExceptionMessages;
1543
+ }
1544
+ if (message.ExceptionStackTrace !== "") {
1545
+ obj.ExceptionStackTrace = message.ExceptionStackTrace;
1546
+ }
1547
+ if (message.AuthorizationFailureReason !== "") {
1548
+ obj.AuthorizationFailureReason = message.AuthorizationFailureReason;
1549
+ }
1550
+ if (message.Response !== undefined) {
1551
+ obj.Response = BeginImportResponse.toJSON(message.Response);
1552
+ }
1553
+ return obj;
1554
+ },
1555
+ create(base) {
1556
+ return CommandResultBeginImportResponse.fromPartial(base ?? {});
1557
+ },
1558
+ fromPartial(object) {
1559
+ const message = createBaseCommandResultBeginImportResponse();
1560
+ message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null)
1561
+ ? Guid.fromPartial(object.CorrelationId)
1562
+ : undefined;
1563
+ message.IsAuthorized = object.IsAuthorized ?? false;
1564
+ message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || [];
1565
+ message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || [];
1566
+ message.ExceptionStackTrace = object.ExceptionStackTrace ?? "";
1567
+ message.AuthorizationFailureReason = object.AuthorizationFailureReason ?? "";
1568
+ message.Response = (object.Response !== undefined && object.Response !== null)
1569
+ ? BeginImportResponse.fromPartial(object.Response)
1570
+ : undefined;
1571
+ return message;
1572
+ },
1573
+ };
1574
+ function createBaseCompleteImportRequest() {
1575
+ return { EventStore: "", Namespace: "", ImportId: undefined, ExpectedChunks: 0, ExpectedEvents: 0n };
1576
+ }
1577
+ const CompleteImportRequest = {
1578
+ encode(message, writer = new BinaryWriter()) {
1579
+ if (message.EventStore !== "") {
1580
+ writer.uint32(10).string(message.EventStore);
1581
+ }
1582
+ if (message.Namespace !== "") {
1583
+ writer.uint32(18).string(message.Namespace);
1584
+ }
1585
+ if (message.ImportId !== undefined) {
1586
+ Guid.encode(message.ImportId, writer.uint32(26).fork()).join();
1587
+ }
1588
+ if (message.ExpectedChunks !== 0) {
1589
+ writer.uint32(32).int32(message.ExpectedChunks);
1590
+ }
1591
+ if (message.ExpectedEvents !== 0n) {
1592
+ if (BigInt.asIntN(64, message.ExpectedEvents) !== message.ExpectedEvents) {
1593
+ throw new globalThis.Error("value provided for field message.ExpectedEvents of type int64 too large");
1594
+ }
1595
+ writer.uint32(40).int64(message.ExpectedEvents);
1596
+ }
1597
+ return writer;
1598
+ },
1599
+ decode(input, length) {
1600
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1601
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1602
+ if (previousRecursionDepth >= 100) {
1603
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1604
+ }
1605
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1606
+ try {
1607
+ const end = length === undefined ? reader.len : reader.pos + length;
1608
+ const message = createBaseCompleteImportRequest();
1609
+ while (reader.pos < end) {
1610
+ const tag = reader.uint32();
1611
+ switch (tag >>> 3) {
1612
+ case 1: {
1613
+ if (tag !== 10) {
1614
+ break;
1615
+ }
1616
+ message.EventStore = reader.string();
1617
+ continue;
1618
+ }
1619
+ case 2: {
1620
+ if (tag !== 18) {
1621
+ break;
1622
+ }
1623
+ message.Namespace = reader.string();
1624
+ continue;
1625
+ }
1626
+ case 3: {
1627
+ if (tag !== 26) {
1628
+ break;
1629
+ }
1630
+ message.ImportId = Guid.decode(reader, reader.uint32());
1631
+ continue;
1632
+ }
1633
+ case 4: {
1634
+ if (tag !== 32) {
1635
+ break;
1636
+ }
1637
+ message.ExpectedChunks = reader.int32();
1638
+ continue;
1639
+ }
1640
+ case 5: {
1641
+ if (tag !== 40) {
1642
+ break;
1643
+ }
1644
+ message.ExpectedEvents = reader.int64();
1645
+ continue;
1646
+ }
1647
+ }
1648
+ if ((tag & 7) === 4 || tag === 0) {
1649
+ break;
1650
+ }
1651
+ reader.skip(tag & 7);
1652
+ }
1653
+ return message;
1654
+ }
1655
+ finally {
1656
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1657
+ }
1658
+ },
1659
+ fromJSON(object) {
1660
+ return {
1661
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
1662
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
1663
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
1664
+ ExpectedChunks: isSet(object.ExpectedChunks) ? globalThis.Number(object.ExpectedChunks) : 0,
1665
+ ExpectedEvents: isSet(object.ExpectedEvents) ? BigInt(object.ExpectedEvents) : 0n,
1666
+ };
1667
+ },
1668
+ toJSON(message) {
1669
+ const obj = {};
1670
+ if (message.EventStore !== "") {
1671
+ obj.EventStore = message.EventStore;
1672
+ }
1673
+ if (message.Namespace !== "") {
1674
+ obj.Namespace = message.Namespace;
1675
+ }
1676
+ if (message.ImportId !== undefined) {
1677
+ obj.ImportId = Guid.toJSON(message.ImportId);
1678
+ }
1679
+ if (message.ExpectedChunks !== 0) {
1680
+ obj.ExpectedChunks = Math.round(message.ExpectedChunks);
1681
+ }
1682
+ if (message.ExpectedEvents !== 0n) {
1683
+ obj.ExpectedEvents = message.ExpectedEvents.toString();
1684
+ }
1685
+ return obj;
1686
+ },
1687
+ create(base) {
1688
+ return CompleteImportRequest.fromPartial(base ?? {});
1689
+ },
1690
+ fromPartial(object) {
1691
+ const message = createBaseCompleteImportRequest();
1692
+ message.EventStore = object.EventStore ?? "";
1693
+ message.Namespace = object.Namespace ?? "";
1694
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
1695
+ ? Guid.fromPartial(object.ImportId)
1696
+ : undefined;
1697
+ message.ExpectedChunks = object.ExpectedChunks ?? 0;
1698
+ message.ExpectedEvents = (object.ExpectedEvents !== undefined && object.ExpectedEvents !== null)
1699
+ ? BigInt(object.ExpectedEvents)
1700
+ : 0n;
1701
+ return message;
1702
+ },
1703
+ };
1704
+ function createBaseEventType() {
1705
+ return { Id: "", Generation: 0, Tombstone: false };
1706
+ }
1707
+ const EventType = {
1708
+ encode(message, writer = new BinaryWriter()) {
1709
+ if (message.Id !== "") {
1710
+ writer.uint32(10).string(message.Id);
1711
+ }
1712
+ if (message.Generation !== 0) {
1713
+ writer.uint32(16).uint32(message.Generation);
1714
+ }
1715
+ if (message.Tombstone !== false) {
1716
+ writer.uint32(24).bool(message.Tombstone);
1717
+ }
1718
+ return writer;
1719
+ },
1720
+ decode(input, length) {
1721
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1722
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1723
+ if (previousRecursionDepth >= 100) {
1724
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1725
+ }
1726
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1727
+ try {
1728
+ const end = length === undefined ? reader.len : reader.pos + length;
1729
+ const message = createBaseEventType();
1730
+ while (reader.pos < end) {
1731
+ const tag = reader.uint32();
1732
+ switch (tag >>> 3) {
1733
+ case 1: {
1734
+ if (tag !== 10) {
1735
+ break;
1736
+ }
1737
+ message.Id = reader.string();
1738
+ continue;
1739
+ }
1740
+ case 2: {
1741
+ if (tag !== 16) {
1742
+ break;
1743
+ }
1744
+ message.Generation = reader.uint32();
1745
+ continue;
1746
+ }
1747
+ case 3: {
1748
+ if (tag !== 24) {
1749
+ break;
1750
+ }
1751
+ message.Tombstone = reader.bool();
1752
+ continue;
1753
+ }
1754
+ }
1755
+ if ((tag & 7) === 4 || tag === 0) {
1756
+ break;
1757
+ }
1758
+ reader.skip(tag & 7);
1759
+ }
1760
+ return message;
1761
+ }
1762
+ finally {
1763
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1764
+ }
1765
+ },
1766
+ fromJSON(object) {
1767
+ return {
1768
+ Id: isSet(object.Id) ? globalThis.String(object.Id) : "",
1769
+ Generation: isSet(object.Generation) ? globalThis.Number(object.Generation) : 0,
1770
+ Tombstone: isSet(object.Tombstone) ? globalThis.Boolean(object.Tombstone) : false,
1771
+ };
1772
+ },
1773
+ toJSON(message) {
1774
+ const obj = {};
1775
+ if (message.Id !== "") {
1776
+ obj.Id = message.Id;
1777
+ }
1778
+ if (message.Generation !== 0) {
1779
+ obj.Generation = Math.round(message.Generation);
1780
+ }
1781
+ if (message.Tombstone !== false) {
1782
+ obj.Tombstone = message.Tombstone;
1783
+ }
1784
+ return obj;
1785
+ },
1786
+ create(base) {
1787
+ return EventType.fromPartial(base ?? {});
1788
+ },
1789
+ fromPartial(object) {
1790
+ const message = createBaseEventType();
1791
+ message.Id = object.Id ?? "";
1792
+ message.Generation = object.Generation ?? 0;
1793
+ message.Tombstone = object.Tombstone ?? false;
1794
+ return message;
1795
+ },
1796
+ };
1797
+ function createBaseGetImportRequest() {
1798
+ return { EventStore: "", Namespace: "", ImportId: undefined };
1799
+ }
1800
+ const GetImportRequest = {
1801
+ encode(message, writer = new BinaryWriter()) {
1802
+ if (message.EventStore !== "") {
1803
+ writer.uint32(10).string(message.EventStore);
1804
+ }
1805
+ if (message.Namespace !== "") {
1806
+ writer.uint32(18).string(message.Namespace);
1807
+ }
1808
+ if (message.ImportId !== undefined) {
1809
+ Guid.encode(message.ImportId, writer.uint32(26).fork()).join();
1810
+ }
1811
+ return writer;
1812
+ },
1813
+ decode(input, length) {
1814
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1815
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1816
+ if (previousRecursionDepth >= 100) {
1817
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1818
+ }
1819
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1820
+ try {
1821
+ const end = length === undefined ? reader.len : reader.pos + length;
1822
+ const message = createBaseGetImportRequest();
1823
+ while (reader.pos < end) {
1824
+ const tag = reader.uint32();
1825
+ switch (tag >>> 3) {
1826
+ case 1: {
1827
+ if (tag !== 10) {
1828
+ break;
1829
+ }
1830
+ message.EventStore = reader.string();
1831
+ continue;
1832
+ }
1833
+ case 2: {
1834
+ if (tag !== 18) {
1835
+ break;
1836
+ }
1837
+ message.Namespace = reader.string();
1838
+ continue;
1839
+ }
1840
+ case 3: {
1841
+ if (tag !== 26) {
1842
+ break;
1843
+ }
1844
+ message.ImportId = Guid.decode(reader, reader.uint32());
1845
+ continue;
1846
+ }
1847
+ }
1848
+ if ((tag & 7) === 4 || tag === 0) {
1849
+ break;
1850
+ }
1851
+ reader.skip(tag & 7);
1852
+ }
1853
+ return message;
1854
+ }
1855
+ finally {
1856
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1857
+ }
1858
+ },
1859
+ fromJSON(object) {
1860
+ return {
1861
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
1862
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
1863
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
1864
+ };
1865
+ },
1866
+ toJSON(message) {
1867
+ const obj = {};
1868
+ if (message.EventStore !== "") {
1869
+ obj.EventStore = message.EventStore;
1870
+ }
1871
+ if (message.Namespace !== "") {
1872
+ obj.Namespace = message.Namespace;
1873
+ }
1874
+ if (message.ImportId !== undefined) {
1875
+ obj.ImportId = Guid.toJSON(message.ImportId);
1876
+ }
1877
+ return obj;
1878
+ },
1879
+ create(base) {
1880
+ return GetImportRequest.fromPartial(base ?? {});
1881
+ },
1882
+ fromPartial(object) {
1883
+ const message = createBaseGetImportRequest();
1884
+ message.EventStore = object.EventStore ?? "";
1885
+ message.Namespace = object.Namespace ?? "";
1886
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
1887
+ ? Guid.fromPartial(object.ImportId)
1888
+ : undefined;
1889
+ return message;
1890
+ },
1891
+ };
1892
+ function createBaseIdentity() {
1893
+ return { Subject: "", Name: "", UserName: "", OnBehalfOf: undefined };
1894
+ }
1895
+ const Identity = {
1896
+ encode(message, writer = new BinaryWriter()) {
1897
+ if (message.Subject !== "") {
1898
+ writer.uint32(10).string(message.Subject);
1899
+ }
1900
+ if (message.Name !== "") {
1901
+ writer.uint32(18).string(message.Name);
1902
+ }
1903
+ if (message.UserName !== "") {
1904
+ writer.uint32(26).string(message.UserName);
1905
+ }
1906
+ if (message.OnBehalfOf !== undefined) {
1907
+ Identity.encode(message.OnBehalfOf, writer.uint32(34).fork()).join();
1908
+ }
1909
+ return writer;
1910
+ },
1911
+ decode(input, length) {
1912
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1913
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1914
+ if (previousRecursionDepth >= 100) {
1915
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1916
+ }
1917
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1918
+ try {
1919
+ const end = length === undefined ? reader.len : reader.pos + length;
1920
+ const message = createBaseIdentity();
1921
+ while (reader.pos < end) {
1922
+ const tag = reader.uint32();
1923
+ switch (tag >>> 3) {
1924
+ case 1: {
1925
+ if (tag !== 10) {
1926
+ break;
1927
+ }
1928
+ message.Subject = reader.string();
1929
+ continue;
1930
+ }
1931
+ case 2: {
1932
+ if (tag !== 18) {
1933
+ break;
1934
+ }
1935
+ message.Name = reader.string();
1936
+ continue;
1937
+ }
1938
+ case 3: {
1939
+ if (tag !== 26) {
1940
+ break;
1941
+ }
1942
+ message.UserName = reader.string();
1943
+ continue;
1944
+ }
1945
+ case 4: {
1946
+ if (tag !== 34) {
1947
+ break;
1948
+ }
1949
+ message.OnBehalfOf = Identity.decode(reader, reader.uint32());
1950
+ continue;
1951
+ }
1952
+ }
1953
+ if ((tag & 7) === 4 || tag === 0) {
1954
+ break;
1955
+ }
1956
+ reader.skip(tag & 7);
1957
+ }
1958
+ return message;
1959
+ }
1960
+ finally {
1961
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1962
+ }
1963
+ },
1964
+ fromJSON(object) {
1965
+ return {
1966
+ Subject: isSet(object.Subject) ? globalThis.String(object.Subject) : "",
1967
+ Name: isSet(object.Name) ? globalThis.String(object.Name) : "",
1968
+ UserName: isSet(object.UserName) ? globalThis.String(object.UserName) : "",
1969
+ OnBehalfOf: isSet(object.OnBehalfOf) ? Identity.fromJSON(object.OnBehalfOf) : undefined,
1970
+ };
1971
+ },
1972
+ toJSON(message) {
1973
+ const obj = {};
1974
+ if (message.Subject !== "") {
1975
+ obj.Subject = message.Subject;
1976
+ }
1977
+ if (message.Name !== "") {
1978
+ obj.Name = message.Name;
1979
+ }
1980
+ if (message.UserName !== "") {
1981
+ obj.UserName = message.UserName;
1982
+ }
1983
+ if (message.OnBehalfOf !== undefined) {
1984
+ obj.OnBehalfOf = Identity.toJSON(message.OnBehalfOf);
1985
+ }
1986
+ return obj;
1987
+ },
1988
+ create(base) {
1989
+ return Identity.fromPartial(base ?? {});
1990
+ },
1991
+ fromPartial(object) {
1992
+ const message = createBaseIdentity();
1993
+ message.Subject = object.Subject ?? "";
1994
+ message.Name = object.Name ?? "";
1995
+ message.UserName = object.UserName ?? "";
1996
+ message.OnBehalfOf = (object.OnBehalfOf !== undefined && object.OnBehalfOf !== null)
1997
+ ? Identity.fromPartial(object.OnBehalfOf)
1998
+ : undefined;
1999
+ return message;
2000
+ },
2001
+ };
2002
+ function createBaseImportEvent() {
2003
+ return {
2004
+ EventSourceId: "",
2005
+ EventSourceType: "",
2006
+ EventStreamType: "",
2007
+ EventStreamId: "",
2008
+ EventType: undefined,
2009
+ Content: "",
2010
+ Tags: [],
2011
+ NamedTags: [],
2012
+ Occurred: undefined,
2013
+ Subject: "",
2014
+ CorrelationId: undefined,
2015
+ Causation: [],
2016
+ CausedBy: undefined,
2017
+ IdempotencyKey: "",
2018
+ EventSource: "",
2019
+ SourceSequenceNumber: 0n,
2020
+ };
2021
+ }
2022
+ const ImportEvent = {
2023
+ encode(message, writer = new BinaryWriter()) {
2024
+ if (message.EventSourceId !== "") {
2025
+ writer.uint32(10).string(message.EventSourceId);
2026
+ }
2027
+ if (message.EventSourceType !== "") {
2028
+ writer.uint32(18).string(message.EventSourceType);
2029
+ }
2030
+ if (message.EventStreamType !== "") {
2031
+ writer.uint32(26).string(message.EventStreamType);
2032
+ }
2033
+ if (message.EventStreamId !== "") {
2034
+ writer.uint32(34).string(message.EventStreamId);
2035
+ }
2036
+ if (message.EventType !== undefined) {
2037
+ EventType.encode(message.EventType, writer.uint32(42).fork()).join();
2038
+ }
2039
+ if (message.Content !== "") {
2040
+ writer.uint32(50).string(message.Content);
2041
+ }
2042
+ for (const v of message.Tags) {
2043
+ writer.uint32(58).string(v);
2044
+ }
2045
+ for (const v of message.NamedTags) {
2046
+ NamedTag.encode(v, writer.uint32(66).fork()).join();
2047
+ }
2048
+ if (message.Occurred !== undefined) {
2049
+ SerializableDateTimeOffset.encode(message.Occurred, writer.uint32(74).fork()).join();
2050
+ }
2051
+ if (message.Subject !== "") {
2052
+ writer.uint32(82).string(message.Subject);
2053
+ }
2054
+ if (message.CorrelationId !== undefined) {
2055
+ Guid.encode(message.CorrelationId, writer.uint32(90).fork()).join();
2056
+ }
2057
+ for (const v of message.Causation) {
2058
+ Causation.encode(v, writer.uint32(98).fork()).join();
2059
+ }
2060
+ if (message.CausedBy !== undefined) {
2061
+ Identity.encode(message.CausedBy, writer.uint32(106).fork()).join();
2062
+ }
2063
+ if (message.IdempotencyKey !== "") {
2064
+ writer.uint32(114).string(message.IdempotencyKey);
2065
+ }
2066
+ if (message.EventSource !== "") {
2067
+ writer.uint32(122).string(message.EventSource);
2068
+ }
2069
+ if (message.SourceSequenceNumber !== 0n) {
2070
+ if (BigInt.asUintN(64, message.SourceSequenceNumber) !== message.SourceSequenceNumber) {
2071
+ throw new globalThis.Error("value provided for field message.SourceSequenceNumber of type uint64 too large");
2072
+ }
2073
+ writer.uint32(128).uint64(message.SourceSequenceNumber);
2074
+ }
2075
+ return writer;
2076
+ },
2077
+ decode(input, length) {
2078
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2079
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2080
+ if (previousRecursionDepth >= 100) {
2081
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2082
+ }
2083
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2084
+ try {
2085
+ const end = length === undefined ? reader.len : reader.pos + length;
2086
+ const message = createBaseImportEvent();
2087
+ while (reader.pos < end) {
2088
+ const tag = reader.uint32();
2089
+ switch (tag >>> 3) {
2090
+ case 1: {
2091
+ if (tag !== 10) {
2092
+ break;
2093
+ }
2094
+ message.EventSourceId = reader.string();
2095
+ continue;
2096
+ }
2097
+ case 2: {
2098
+ if (tag !== 18) {
2099
+ break;
2100
+ }
2101
+ message.EventSourceType = reader.string();
2102
+ continue;
2103
+ }
2104
+ case 3: {
2105
+ if (tag !== 26) {
2106
+ break;
2107
+ }
2108
+ message.EventStreamType = reader.string();
2109
+ continue;
2110
+ }
2111
+ case 4: {
2112
+ if (tag !== 34) {
2113
+ break;
2114
+ }
2115
+ message.EventStreamId = reader.string();
2116
+ continue;
2117
+ }
2118
+ case 5: {
2119
+ if (tag !== 42) {
2120
+ break;
2121
+ }
2122
+ message.EventType = EventType.decode(reader, reader.uint32());
2123
+ continue;
2124
+ }
2125
+ case 6: {
2126
+ if (tag !== 50) {
2127
+ break;
2128
+ }
2129
+ message.Content = reader.string();
2130
+ continue;
2131
+ }
2132
+ case 7: {
2133
+ if (tag !== 58) {
2134
+ break;
2135
+ }
2136
+ message.Tags.push(reader.string());
2137
+ continue;
2138
+ }
2139
+ case 8: {
2140
+ if (tag !== 66) {
2141
+ break;
2142
+ }
2143
+ message.NamedTags.push(NamedTag.decode(reader, reader.uint32()));
2144
+ continue;
2145
+ }
2146
+ case 9: {
2147
+ if (tag !== 74) {
2148
+ break;
2149
+ }
2150
+ message.Occurred = SerializableDateTimeOffset.decode(reader, reader.uint32());
2151
+ continue;
2152
+ }
2153
+ case 10: {
2154
+ if (tag !== 82) {
2155
+ break;
2156
+ }
2157
+ message.Subject = reader.string();
2158
+ continue;
2159
+ }
2160
+ case 11: {
2161
+ if (tag !== 90) {
2162
+ break;
2163
+ }
2164
+ message.CorrelationId = Guid.decode(reader, reader.uint32());
2165
+ continue;
2166
+ }
2167
+ case 12: {
2168
+ if (tag !== 98) {
2169
+ break;
2170
+ }
2171
+ message.Causation.push(Causation.decode(reader, reader.uint32()));
2172
+ continue;
2173
+ }
2174
+ case 13: {
2175
+ if (tag !== 106) {
2176
+ break;
2177
+ }
2178
+ message.CausedBy = Identity.decode(reader, reader.uint32());
2179
+ continue;
2180
+ }
2181
+ case 14: {
2182
+ if (tag !== 114) {
2183
+ break;
2184
+ }
2185
+ message.IdempotencyKey = reader.string();
2186
+ continue;
2187
+ }
2188
+ case 15: {
2189
+ if (tag !== 122) {
2190
+ break;
2191
+ }
2192
+ message.EventSource = reader.string();
2193
+ continue;
2194
+ }
2195
+ case 16: {
2196
+ if (tag !== 128) {
2197
+ break;
2198
+ }
2199
+ message.SourceSequenceNumber = reader.uint64();
2200
+ continue;
2201
+ }
2202
+ }
2203
+ if ((tag & 7) === 4 || tag === 0) {
2204
+ break;
2205
+ }
2206
+ reader.skip(tag & 7);
2207
+ }
2208
+ return message;
2209
+ }
2210
+ finally {
2211
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2212
+ }
2213
+ },
2214
+ fromJSON(object) {
2215
+ return {
2216
+ EventSourceId: isSet(object.EventSourceId) ? globalThis.String(object.EventSourceId) : "",
2217
+ EventSourceType: isSet(object.EventSourceType) ? globalThis.String(object.EventSourceType) : "",
2218
+ EventStreamType: isSet(object.EventStreamType) ? globalThis.String(object.EventStreamType) : "",
2219
+ EventStreamId: isSet(object.EventStreamId) ? globalThis.String(object.EventStreamId) : "",
2220
+ EventType: isSet(object.EventType) ? EventType.fromJSON(object.EventType) : undefined,
2221
+ Content: isSet(object.Content) ? globalThis.String(object.Content) : "",
2222
+ Tags: globalThis.Array.isArray(object?.Tags) ? object.Tags.map((e) => globalThis.String(e)) : [],
2223
+ NamedTags: globalThis.Array.isArray(object?.NamedTags)
2224
+ ? object.NamedTags.map((e) => NamedTag.fromJSON(e))
2225
+ : [],
2226
+ Occurred: isSet(object.Occurred) ? SerializableDateTimeOffset.fromJSON(object.Occurred) : undefined,
2227
+ Subject: isSet(object.Subject) ? globalThis.String(object.Subject) : "",
2228
+ CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined,
2229
+ Causation: globalThis.Array.isArray(object?.Causation)
2230
+ ? object.Causation.map((e) => Causation.fromJSON(e))
2231
+ : [],
2232
+ CausedBy: isSet(object.CausedBy) ? Identity.fromJSON(object.CausedBy) : undefined,
2233
+ IdempotencyKey: isSet(object.IdempotencyKey) ? globalThis.String(object.IdempotencyKey) : "",
2234
+ EventSource: isSet(object.EventSource) ? globalThis.String(object.EventSource) : "",
2235
+ SourceSequenceNumber: isSet(object.SourceSequenceNumber) ? BigInt(object.SourceSequenceNumber) : 0n,
2236
+ };
2237
+ },
2238
+ toJSON(message) {
2239
+ const obj = {};
2240
+ if (message.EventSourceId !== "") {
2241
+ obj.EventSourceId = message.EventSourceId;
2242
+ }
2243
+ if (message.EventSourceType !== "") {
2244
+ obj.EventSourceType = message.EventSourceType;
2245
+ }
2246
+ if (message.EventStreamType !== "") {
2247
+ obj.EventStreamType = message.EventStreamType;
2248
+ }
2249
+ if (message.EventStreamId !== "") {
2250
+ obj.EventStreamId = message.EventStreamId;
2251
+ }
2252
+ if (message.EventType !== undefined) {
2253
+ obj.EventType = EventType.toJSON(message.EventType);
2254
+ }
2255
+ if (message.Content !== "") {
2256
+ obj.Content = message.Content;
2257
+ }
2258
+ if (message.Tags?.length) {
2259
+ obj.Tags = message.Tags;
2260
+ }
2261
+ if (message.NamedTags?.length) {
2262
+ obj.NamedTags = message.NamedTags.map((e) => NamedTag.toJSON(e));
2263
+ }
2264
+ if (message.Occurred !== undefined) {
2265
+ obj.Occurred = SerializableDateTimeOffset.toJSON(message.Occurred);
2266
+ }
2267
+ if (message.Subject !== "") {
2268
+ obj.Subject = message.Subject;
2269
+ }
2270
+ if (message.CorrelationId !== undefined) {
2271
+ obj.CorrelationId = Guid.toJSON(message.CorrelationId);
2272
+ }
2273
+ if (message.Causation?.length) {
2274
+ obj.Causation = message.Causation.map((e) => Causation.toJSON(e));
2275
+ }
2276
+ if (message.CausedBy !== undefined) {
2277
+ obj.CausedBy = Identity.toJSON(message.CausedBy);
2278
+ }
2279
+ if (message.IdempotencyKey !== "") {
2280
+ obj.IdempotencyKey = message.IdempotencyKey;
2281
+ }
2282
+ if (message.EventSource !== "") {
2283
+ obj.EventSource = message.EventSource;
2284
+ }
2285
+ if (message.SourceSequenceNumber !== 0n) {
2286
+ obj.SourceSequenceNumber = message.SourceSequenceNumber.toString();
2287
+ }
2288
+ return obj;
2289
+ },
2290
+ create(base) {
2291
+ return ImportEvent.fromPartial(base ?? {});
2292
+ },
2293
+ fromPartial(object) {
2294
+ const message = createBaseImportEvent();
2295
+ message.EventSourceId = object.EventSourceId ?? "";
2296
+ message.EventSourceType = object.EventSourceType ?? "";
2297
+ message.EventStreamType = object.EventStreamType ?? "";
2298
+ message.EventStreamId = object.EventStreamId ?? "";
2299
+ message.EventType = (object.EventType !== undefined && object.EventType !== null)
2300
+ ? EventType.fromPartial(object.EventType)
2301
+ : undefined;
2302
+ message.Content = object.Content ?? "";
2303
+ message.Tags = object.Tags?.map((e) => e) || [];
2304
+ message.NamedTags = object.NamedTags?.map((e) => NamedTag.fromPartial(e)) || [];
2305
+ message.Occurred = (object.Occurred !== undefined && object.Occurred !== null)
2306
+ ? SerializableDateTimeOffset.fromPartial(object.Occurred)
2307
+ : undefined;
2308
+ message.Subject = object.Subject ?? "";
2309
+ message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null)
2310
+ ? Guid.fromPartial(object.CorrelationId)
2311
+ : undefined;
2312
+ message.Causation = object.Causation?.map((e) => Causation.fromPartial(e)) || [];
2313
+ message.CausedBy = (object.CausedBy !== undefined && object.CausedBy !== null)
2314
+ ? Identity.fromPartial(object.CausedBy)
2315
+ : undefined;
2316
+ message.IdempotencyKey = object.IdempotencyKey ?? "";
2317
+ message.EventSource = object.EventSource ?? "";
2318
+ message.SourceSequenceNumber = (object.SourceSequenceNumber !== undefined && object.SourceSequenceNumber !== null)
2319
+ ? BigInt(object.SourceSequenceNumber)
2320
+ : 0n;
2321
+ return message;
2322
+ },
2323
+ };
2324
+ function createBaseImportEventRejection() {
2325
+ return { Index: 0n, EventType: "", Reasons: [] };
2326
+ }
2327
+ const ImportEventRejection = {
2328
+ encode(message, writer = new BinaryWriter()) {
2329
+ if (message.Index !== 0n) {
2330
+ if (BigInt.asIntN(64, message.Index) !== message.Index) {
2331
+ throw new globalThis.Error("value provided for field message.Index of type int64 too large");
2332
+ }
2333
+ writer.uint32(8).int64(message.Index);
2334
+ }
2335
+ if (message.EventType !== "") {
2336
+ writer.uint32(18).string(message.EventType);
2337
+ }
2338
+ for (const v of message.Reasons) {
2339
+ writer.uint32(26).string(v);
2340
+ }
2341
+ return writer;
2342
+ },
2343
+ decode(input, length) {
2344
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2345
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2346
+ if (previousRecursionDepth >= 100) {
2347
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2348
+ }
2349
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2350
+ try {
2351
+ const end = length === undefined ? reader.len : reader.pos + length;
2352
+ const message = createBaseImportEventRejection();
2353
+ while (reader.pos < end) {
2354
+ const tag = reader.uint32();
2355
+ switch (tag >>> 3) {
2356
+ case 1: {
2357
+ if (tag !== 8) {
2358
+ break;
2359
+ }
2360
+ message.Index = reader.int64();
2361
+ continue;
2362
+ }
2363
+ case 2: {
2364
+ if (tag !== 18) {
2365
+ break;
2366
+ }
2367
+ message.EventType = reader.string();
2368
+ continue;
2369
+ }
2370
+ case 3: {
2371
+ if (tag !== 26) {
2372
+ break;
2373
+ }
2374
+ message.Reasons.push(reader.string());
2375
+ continue;
2376
+ }
2377
+ }
2378
+ if ((tag & 7) === 4 || tag === 0) {
2379
+ break;
2380
+ }
2381
+ reader.skip(tag & 7);
2382
+ }
2383
+ return message;
2384
+ }
2385
+ finally {
2386
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2387
+ }
2388
+ },
2389
+ fromJSON(object) {
2390
+ return {
2391
+ Index: isSet(object.Index) ? BigInt(object.Index) : 0n,
2392
+ EventType: isSet(object.EventType) ? globalThis.String(object.EventType) : "",
2393
+ Reasons: globalThis.Array.isArray(object?.Reasons) ? object.Reasons.map((e) => globalThis.String(e)) : [],
2394
+ };
2395
+ },
2396
+ toJSON(message) {
2397
+ const obj = {};
2398
+ if (message.Index !== 0n) {
2399
+ obj.Index = message.Index.toString();
2400
+ }
2401
+ if (message.EventType !== "") {
2402
+ obj.EventType = message.EventType;
2403
+ }
2404
+ if (message.Reasons?.length) {
2405
+ obj.Reasons = message.Reasons;
2406
+ }
2407
+ return obj;
2408
+ },
2409
+ create(base) {
2410
+ return ImportEventRejection.fromPartial(base ?? {});
2411
+ },
2412
+ fromPartial(object) {
2413
+ const message = createBaseImportEventRejection();
2414
+ message.Index = (object.Index !== undefined && object.Index !== null) ? BigInt(object.Index) : 0n;
2415
+ message.EventType = object.EventType ?? "";
2416
+ message.Reasons = object.Reasons?.map((e) => e) || [];
2417
+ return message;
2418
+ },
2419
+ };
2420
+ function createBaseImportProgressResponse() {
2421
+ return {
2422
+ ImportId: undefined,
2423
+ EventSequenceId: "",
2424
+ State: 0,
2425
+ OnInvalid: 0,
2426
+ Created: undefined,
2427
+ LastActivity: undefined,
2428
+ StagedChunks: [],
2429
+ EventsReceived: 0n,
2430
+ EventsStaged: 0n,
2431
+ EventsCommitted: 0n,
2432
+ AlreadyAppended: 0n,
2433
+ RejectedCount: 0n,
2434
+ Rejections: [],
2435
+ CommittedRanges: [],
2436
+ FirstSequenceNumber: 0n,
2437
+ LastSequenceNumber: 0n,
2438
+ FailureReason: "",
2439
+ MaxChunkEvents: 0,
2440
+ MaxChunkBytes: 0,
2441
+ AcknowledgedChunks: 0,
2442
+ AcknowledgedEvents: 0n,
2443
+ };
2444
+ }
2445
+ const ImportProgressResponse = {
2446
+ encode(message, writer = new BinaryWriter()) {
2447
+ if (message.ImportId !== undefined) {
2448
+ Guid.encode(message.ImportId, writer.uint32(10).fork()).join();
2449
+ }
2450
+ if (message.EventSequenceId !== "") {
2451
+ writer.uint32(18).string(message.EventSequenceId);
2452
+ }
2453
+ if (message.State !== 0) {
2454
+ writer.uint32(24).int32(message.State);
2455
+ }
2456
+ if (message.OnInvalid !== 0) {
2457
+ writer.uint32(32).int32(message.OnInvalid);
2458
+ }
2459
+ if (message.Created !== undefined) {
2460
+ SerializableDateTimeOffset.encode(message.Created, writer.uint32(42).fork()).join();
2461
+ }
2462
+ if (message.LastActivity !== undefined) {
2463
+ SerializableDateTimeOffset.encode(message.LastActivity, writer.uint32(50).fork()).join();
2464
+ }
2465
+ for (const v of message.StagedChunks) {
2466
+ writer.uint32(56).int32(v);
2467
+ }
2468
+ if (message.EventsReceived !== 0n) {
2469
+ if (BigInt.asIntN(64, message.EventsReceived) !== message.EventsReceived) {
2470
+ throw new globalThis.Error("value provided for field message.EventsReceived of type int64 too large");
2471
+ }
2472
+ writer.uint32(64).int64(message.EventsReceived);
2473
+ }
2474
+ if (message.EventsStaged !== 0n) {
2475
+ if (BigInt.asIntN(64, message.EventsStaged) !== message.EventsStaged) {
2476
+ throw new globalThis.Error("value provided for field message.EventsStaged of type int64 too large");
2477
+ }
2478
+ writer.uint32(72).int64(message.EventsStaged);
2479
+ }
2480
+ if (message.EventsCommitted !== 0n) {
2481
+ if (BigInt.asIntN(64, message.EventsCommitted) !== message.EventsCommitted) {
2482
+ throw new globalThis.Error("value provided for field message.EventsCommitted of type int64 too large");
2483
+ }
2484
+ writer.uint32(80).int64(message.EventsCommitted);
2485
+ }
2486
+ if (message.AlreadyAppended !== 0n) {
2487
+ if (BigInt.asIntN(64, message.AlreadyAppended) !== message.AlreadyAppended) {
2488
+ throw new globalThis.Error("value provided for field message.AlreadyAppended of type int64 too large");
2489
+ }
2490
+ writer.uint32(88).int64(message.AlreadyAppended);
2491
+ }
2492
+ if (message.RejectedCount !== 0n) {
2493
+ if (BigInt.asIntN(64, message.RejectedCount) !== message.RejectedCount) {
2494
+ throw new globalThis.Error("value provided for field message.RejectedCount of type int64 too large");
2495
+ }
2496
+ writer.uint32(96).int64(message.RejectedCount);
2497
+ }
2498
+ for (const v of message.Rejections) {
2499
+ ImportEventRejection.encode(v, writer.uint32(106).fork()).join();
2500
+ }
2501
+ for (const v of message.CommittedRanges) {
2502
+ ImportSequenceRange.encode(v, writer.uint32(114).fork()).join();
2503
+ }
2504
+ if (message.FirstSequenceNumber !== 0n) {
2505
+ if (BigInt.asUintN(64, message.FirstSequenceNumber) !== message.FirstSequenceNumber) {
2506
+ throw new globalThis.Error("value provided for field message.FirstSequenceNumber of type uint64 too large");
2507
+ }
2508
+ writer.uint32(120).uint64(message.FirstSequenceNumber);
2509
+ }
2510
+ if (message.LastSequenceNumber !== 0n) {
2511
+ if (BigInt.asUintN(64, message.LastSequenceNumber) !== message.LastSequenceNumber) {
2512
+ throw new globalThis.Error("value provided for field message.LastSequenceNumber of type uint64 too large");
2513
+ }
2514
+ writer.uint32(128).uint64(message.LastSequenceNumber);
2515
+ }
2516
+ if (message.FailureReason !== "") {
2517
+ writer.uint32(138).string(message.FailureReason);
2518
+ }
2519
+ if (message.MaxChunkEvents !== 0) {
2520
+ writer.uint32(144).int32(message.MaxChunkEvents);
2521
+ }
2522
+ if (message.MaxChunkBytes !== 0) {
2523
+ writer.uint32(152).int32(message.MaxChunkBytes);
2524
+ }
2525
+ if (message.AcknowledgedChunks !== 0) {
2526
+ writer.uint32(160).int32(message.AcknowledgedChunks);
2527
+ }
2528
+ if (message.AcknowledgedEvents !== 0n) {
2529
+ if (BigInt.asIntN(64, message.AcknowledgedEvents) !== message.AcknowledgedEvents) {
2530
+ throw new globalThis.Error("value provided for field message.AcknowledgedEvents of type int64 too large");
2531
+ }
2532
+ writer.uint32(168).int64(message.AcknowledgedEvents);
2533
+ }
2534
+ return writer;
2535
+ },
2536
+ decode(input, length) {
2537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2538
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2539
+ if (previousRecursionDepth >= 100) {
2540
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2541
+ }
2542
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2543
+ try {
2544
+ const end = length === undefined ? reader.len : reader.pos + length;
2545
+ const message = createBaseImportProgressResponse();
2546
+ while (reader.pos < end) {
2547
+ const tag = reader.uint32();
2548
+ switch (tag >>> 3) {
2549
+ case 1: {
2550
+ if (tag !== 10) {
2551
+ break;
2552
+ }
2553
+ message.ImportId = Guid.decode(reader, reader.uint32());
2554
+ continue;
2555
+ }
2556
+ case 2: {
2557
+ if (tag !== 18) {
2558
+ break;
2559
+ }
2560
+ message.EventSequenceId = reader.string();
2561
+ continue;
2562
+ }
2563
+ case 3: {
2564
+ if (tag !== 24) {
2565
+ break;
2566
+ }
2567
+ message.State = reader.int32();
2568
+ continue;
2569
+ }
2570
+ case 4: {
2571
+ if (tag !== 32) {
2572
+ break;
2573
+ }
2574
+ message.OnInvalid = reader.int32();
2575
+ continue;
2576
+ }
2577
+ case 5: {
2578
+ if (tag !== 42) {
2579
+ break;
2580
+ }
2581
+ message.Created = SerializableDateTimeOffset.decode(reader, reader.uint32());
2582
+ continue;
2583
+ }
2584
+ case 6: {
2585
+ if (tag !== 50) {
2586
+ break;
2587
+ }
2588
+ message.LastActivity = SerializableDateTimeOffset.decode(reader, reader.uint32());
2589
+ continue;
2590
+ }
2591
+ case 7: {
2592
+ if (tag === 56) {
2593
+ message.StagedChunks.push(reader.int32());
2594
+ continue;
2595
+ }
2596
+ if (tag === 58) {
2597
+ const end2 = reader.uint32() + reader.pos;
2598
+ while (reader.pos < end2) {
2599
+ message.StagedChunks.push(reader.int32());
2600
+ }
2601
+ continue;
2602
+ }
2603
+ break;
2604
+ }
2605
+ case 8: {
2606
+ if (tag !== 64) {
2607
+ break;
2608
+ }
2609
+ message.EventsReceived = reader.int64();
2610
+ continue;
2611
+ }
2612
+ case 9: {
2613
+ if (tag !== 72) {
2614
+ break;
2615
+ }
2616
+ message.EventsStaged = reader.int64();
2617
+ continue;
2618
+ }
2619
+ case 10: {
2620
+ if (tag !== 80) {
2621
+ break;
2622
+ }
2623
+ message.EventsCommitted = reader.int64();
2624
+ continue;
2625
+ }
2626
+ case 11: {
2627
+ if (tag !== 88) {
2628
+ break;
2629
+ }
2630
+ message.AlreadyAppended = reader.int64();
2631
+ continue;
2632
+ }
2633
+ case 12: {
2634
+ if (tag !== 96) {
2635
+ break;
2636
+ }
2637
+ message.RejectedCount = reader.int64();
2638
+ continue;
2639
+ }
2640
+ case 13: {
2641
+ if (tag !== 106) {
2642
+ break;
2643
+ }
2644
+ message.Rejections.push(ImportEventRejection.decode(reader, reader.uint32()));
2645
+ continue;
2646
+ }
2647
+ case 14: {
2648
+ if (tag !== 114) {
2649
+ break;
2650
+ }
2651
+ message.CommittedRanges.push(ImportSequenceRange.decode(reader, reader.uint32()));
2652
+ continue;
2653
+ }
2654
+ case 15: {
2655
+ if (tag !== 120) {
2656
+ break;
2657
+ }
2658
+ message.FirstSequenceNumber = reader.uint64();
2659
+ continue;
2660
+ }
2661
+ case 16: {
2662
+ if (tag !== 128) {
2663
+ break;
2664
+ }
2665
+ message.LastSequenceNumber = reader.uint64();
2666
+ continue;
2667
+ }
2668
+ case 17: {
2669
+ if (tag !== 138) {
2670
+ break;
2671
+ }
2672
+ message.FailureReason = reader.string();
2673
+ continue;
2674
+ }
2675
+ case 18: {
2676
+ if (tag !== 144) {
2677
+ break;
2678
+ }
2679
+ message.MaxChunkEvents = reader.int32();
2680
+ continue;
2681
+ }
2682
+ case 19: {
2683
+ if (tag !== 152) {
2684
+ break;
2685
+ }
2686
+ message.MaxChunkBytes = reader.int32();
2687
+ continue;
2688
+ }
2689
+ case 20: {
2690
+ if (tag !== 160) {
2691
+ break;
2692
+ }
2693
+ message.AcknowledgedChunks = reader.int32();
2694
+ continue;
2695
+ }
2696
+ case 21: {
2697
+ if (tag !== 168) {
2698
+ break;
2699
+ }
2700
+ message.AcknowledgedEvents = reader.int64();
2701
+ continue;
2702
+ }
2703
+ }
2704
+ if ((tag & 7) === 4 || tag === 0) {
2705
+ break;
2706
+ }
2707
+ reader.skip(tag & 7);
2708
+ }
2709
+ return message;
2710
+ }
2711
+ finally {
2712
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2713
+ }
2714
+ },
2715
+ fromJSON(object) {
2716
+ return {
2717
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
2718
+ EventSequenceId: isSet(object.EventSequenceId) ? globalThis.String(object.EventSequenceId) : "",
2719
+ State: isSet(object.State) ? importStateFromJSON(object.State) : 0,
2720
+ OnInvalid: isSet(object.OnInvalid) ? onInvalidEventFromJSON(object.OnInvalid) : 0,
2721
+ Created: isSet(object.Created) ? SerializableDateTimeOffset.fromJSON(object.Created) : undefined,
2722
+ LastActivity: isSet(object.LastActivity) ? SerializableDateTimeOffset.fromJSON(object.LastActivity) : undefined,
2723
+ StagedChunks: globalThis.Array.isArray(object?.StagedChunks)
2724
+ ? object.StagedChunks.map((e) => globalThis.Number(e))
2725
+ : [],
2726
+ EventsReceived: isSet(object.EventsReceived) ? BigInt(object.EventsReceived) : 0n,
2727
+ EventsStaged: isSet(object.EventsStaged) ? BigInt(object.EventsStaged) : 0n,
2728
+ EventsCommitted: isSet(object.EventsCommitted) ? BigInt(object.EventsCommitted) : 0n,
2729
+ AlreadyAppended: isSet(object.AlreadyAppended) ? BigInt(object.AlreadyAppended) : 0n,
2730
+ RejectedCount: isSet(object.RejectedCount) ? BigInt(object.RejectedCount) : 0n,
2731
+ Rejections: globalThis.Array.isArray(object?.Rejections)
2732
+ ? object.Rejections.map((e) => ImportEventRejection.fromJSON(e))
2733
+ : [],
2734
+ CommittedRanges: globalThis.Array.isArray(object?.CommittedRanges)
2735
+ ? object.CommittedRanges.map((e) => ImportSequenceRange.fromJSON(e))
2736
+ : [],
2737
+ FirstSequenceNumber: isSet(object.FirstSequenceNumber) ? BigInt(object.FirstSequenceNumber) : 0n,
2738
+ LastSequenceNumber: isSet(object.LastSequenceNumber) ? BigInt(object.LastSequenceNumber) : 0n,
2739
+ FailureReason: isSet(object.FailureReason) ? globalThis.String(object.FailureReason) : "",
2740
+ MaxChunkEvents: isSet(object.MaxChunkEvents) ? globalThis.Number(object.MaxChunkEvents) : 0,
2741
+ MaxChunkBytes: isSet(object.MaxChunkBytes) ? globalThis.Number(object.MaxChunkBytes) : 0,
2742
+ AcknowledgedChunks: isSet(object.AcknowledgedChunks) ? globalThis.Number(object.AcknowledgedChunks) : 0,
2743
+ AcknowledgedEvents: isSet(object.AcknowledgedEvents) ? BigInt(object.AcknowledgedEvents) : 0n,
2744
+ };
2745
+ },
2746
+ toJSON(message) {
2747
+ const obj = {};
2748
+ if (message.ImportId !== undefined) {
2749
+ obj.ImportId = Guid.toJSON(message.ImportId);
2750
+ }
2751
+ if (message.EventSequenceId !== "") {
2752
+ obj.EventSequenceId = message.EventSequenceId;
2753
+ }
2754
+ if (message.State !== 0) {
2755
+ obj.State = importStateToJSON(message.State);
2756
+ }
2757
+ if (message.OnInvalid !== 0) {
2758
+ obj.OnInvalid = onInvalidEventToJSON(message.OnInvalid);
2759
+ }
2760
+ if (message.Created !== undefined) {
2761
+ obj.Created = SerializableDateTimeOffset.toJSON(message.Created);
2762
+ }
2763
+ if (message.LastActivity !== undefined) {
2764
+ obj.LastActivity = SerializableDateTimeOffset.toJSON(message.LastActivity);
2765
+ }
2766
+ if (message.StagedChunks?.length) {
2767
+ obj.StagedChunks = message.StagedChunks.map((e) => Math.round(e));
2768
+ }
2769
+ if (message.EventsReceived !== 0n) {
2770
+ obj.EventsReceived = message.EventsReceived.toString();
2771
+ }
2772
+ if (message.EventsStaged !== 0n) {
2773
+ obj.EventsStaged = message.EventsStaged.toString();
2774
+ }
2775
+ if (message.EventsCommitted !== 0n) {
2776
+ obj.EventsCommitted = message.EventsCommitted.toString();
2777
+ }
2778
+ if (message.AlreadyAppended !== 0n) {
2779
+ obj.AlreadyAppended = message.AlreadyAppended.toString();
2780
+ }
2781
+ if (message.RejectedCount !== 0n) {
2782
+ obj.RejectedCount = message.RejectedCount.toString();
2783
+ }
2784
+ if (message.Rejections?.length) {
2785
+ obj.Rejections = message.Rejections.map((e) => ImportEventRejection.toJSON(e));
2786
+ }
2787
+ if (message.CommittedRanges?.length) {
2788
+ obj.CommittedRanges = message.CommittedRanges.map((e) => ImportSequenceRange.toJSON(e));
2789
+ }
2790
+ if (message.FirstSequenceNumber !== 0n) {
2791
+ obj.FirstSequenceNumber = message.FirstSequenceNumber.toString();
2792
+ }
2793
+ if (message.LastSequenceNumber !== 0n) {
2794
+ obj.LastSequenceNumber = message.LastSequenceNumber.toString();
2795
+ }
2796
+ if (message.FailureReason !== "") {
2797
+ obj.FailureReason = message.FailureReason;
2798
+ }
2799
+ if (message.MaxChunkEvents !== 0) {
2800
+ obj.MaxChunkEvents = Math.round(message.MaxChunkEvents);
2801
+ }
2802
+ if (message.MaxChunkBytes !== 0) {
2803
+ obj.MaxChunkBytes = Math.round(message.MaxChunkBytes);
2804
+ }
2805
+ if (message.AcknowledgedChunks !== 0) {
2806
+ obj.AcknowledgedChunks = Math.round(message.AcknowledgedChunks);
2807
+ }
2808
+ if (message.AcknowledgedEvents !== 0n) {
2809
+ obj.AcknowledgedEvents = message.AcknowledgedEvents.toString();
2810
+ }
2811
+ return obj;
2812
+ },
2813
+ create(base) {
2814
+ return ImportProgressResponse.fromPartial(base ?? {});
2815
+ },
2816
+ fromPartial(object) {
2817
+ const message = createBaseImportProgressResponse();
2818
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
2819
+ ? Guid.fromPartial(object.ImportId)
2820
+ : undefined;
2821
+ message.EventSequenceId = object.EventSequenceId ?? "";
2822
+ message.State = object.State ?? 0;
2823
+ message.OnInvalid = object.OnInvalid ?? 0;
2824
+ message.Created = (object.Created !== undefined && object.Created !== null)
2825
+ ? SerializableDateTimeOffset.fromPartial(object.Created)
2826
+ : undefined;
2827
+ message.LastActivity = (object.LastActivity !== undefined && object.LastActivity !== null)
2828
+ ? SerializableDateTimeOffset.fromPartial(object.LastActivity)
2829
+ : undefined;
2830
+ message.StagedChunks = object.StagedChunks?.map((e) => e) || [];
2831
+ message.EventsReceived = (object.EventsReceived !== undefined && object.EventsReceived !== null)
2832
+ ? BigInt(object.EventsReceived)
2833
+ : 0n;
2834
+ message.EventsStaged = (object.EventsStaged !== undefined && object.EventsStaged !== null)
2835
+ ? BigInt(object.EventsStaged)
2836
+ : 0n;
2837
+ message.EventsCommitted = (object.EventsCommitted !== undefined && object.EventsCommitted !== null)
2838
+ ? BigInt(object.EventsCommitted)
2839
+ : 0n;
2840
+ message.AlreadyAppended = (object.AlreadyAppended !== undefined && object.AlreadyAppended !== null)
2841
+ ? BigInt(object.AlreadyAppended)
2842
+ : 0n;
2843
+ message.RejectedCount = (object.RejectedCount !== undefined && object.RejectedCount !== null)
2844
+ ? BigInt(object.RejectedCount)
2845
+ : 0n;
2846
+ message.Rejections = object.Rejections?.map((e) => ImportEventRejection.fromPartial(e)) || [];
2847
+ message.CommittedRanges = object.CommittedRanges?.map((e) => ImportSequenceRange.fromPartial(e)) || [];
2848
+ message.FirstSequenceNumber = (object.FirstSequenceNumber !== undefined && object.FirstSequenceNumber !== null)
2849
+ ? BigInt(object.FirstSequenceNumber)
2850
+ : 0n;
2851
+ message.LastSequenceNumber = (object.LastSequenceNumber !== undefined && object.LastSequenceNumber !== null)
2852
+ ? BigInt(object.LastSequenceNumber)
2853
+ : 0n;
2854
+ message.FailureReason = object.FailureReason ?? "";
2855
+ message.MaxChunkEvents = object.MaxChunkEvents ?? 0;
2856
+ message.MaxChunkBytes = object.MaxChunkBytes ?? 0;
2857
+ message.AcknowledgedChunks = object.AcknowledgedChunks ?? 0;
2858
+ message.AcknowledgedEvents = (object.AcknowledgedEvents !== undefined && object.AcknowledgedEvents !== null)
2859
+ ? BigInt(object.AcknowledgedEvents)
2860
+ : 0n;
2861
+ return message;
2862
+ },
2863
+ };
2864
+ function createBaseImportSequenceRange() {
2865
+ return { ChunkIndex: 0, First: 0n, Last: 0n };
2866
+ }
2867
+ const ImportSequenceRange = {
2868
+ encode(message, writer = new BinaryWriter()) {
2869
+ if (message.ChunkIndex !== 0) {
2870
+ writer.uint32(8).int32(message.ChunkIndex);
2871
+ }
2872
+ if (message.First !== 0n) {
2873
+ if (BigInt.asUintN(64, message.First) !== message.First) {
2874
+ throw new globalThis.Error("value provided for field message.First of type uint64 too large");
2875
+ }
2876
+ writer.uint32(16).uint64(message.First);
2877
+ }
2878
+ if (message.Last !== 0n) {
2879
+ if (BigInt.asUintN(64, message.Last) !== message.Last) {
2880
+ throw new globalThis.Error("value provided for field message.Last of type uint64 too large");
2881
+ }
2882
+ writer.uint32(24).uint64(message.Last);
2883
+ }
2884
+ return writer;
2885
+ },
2886
+ decode(input, length) {
2887
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2888
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2889
+ if (previousRecursionDepth >= 100) {
2890
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2891
+ }
2892
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2893
+ try {
2894
+ const end = length === undefined ? reader.len : reader.pos + length;
2895
+ const message = createBaseImportSequenceRange();
2896
+ while (reader.pos < end) {
2897
+ const tag = reader.uint32();
2898
+ switch (tag >>> 3) {
2899
+ case 1: {
2900
+ if (tag !== 8) {
2901
+ break;
2902
+ }
2903
+ message.ChunkIndex = reader.int32();
2904
+ continue;
2905
+ }
2906
+ case 2: {
2907
+ if (tag !== 16) {
2908
+ break;
2909
+ }
2910
+ message.First = reader.uint64();
2911
+ continue;
2912
+ }
2913
+ case 3: {
2914
+ if (tag !== 24) {
2915
+ break;
2916
+ }
2917
+ message.Last = reader.uint64();
2918
+ continue;
2919
+ }
2920
+ }
2921
+ if ((tag & 7) === 4 || tag === 0) {
2922
+ break;
2923
+ }
2924
+ reader.skip(tag & 7);
2925
+ }
2926
+ return message;
2927
+ }
2928
+ finally {
2929
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2930
+ }
2931
+ },
2932
+ fromJSON(object) {
2933
+ return {
2934
+ ChunkIndex: isSet(object.ChunkIndex) ? globalThis.Number(object.ChunkIndex) : 0,
2935
+ First: isSet(object.First) ? BigInt(object.First) : 0n,
2936
+ Last: isSet(object.Last) ? BigInt(object.Last) : 0n,
2937
+ };
2938
+ },
2939
+ toJSON(message) {
2940
+ const obj = {};
2941
+ if (message.ChunkIndex !== 0) {
2942
+ obj.ChunkIndex = Math.round(message.ChunkIndex);
2943
+ }
2944
+ if (message.First !== 0n) {
2945
+ obj.First = message.First.toString();
2946
+ }
2947
+ if (message.Last !== 0n) {
2948
+ obj.Last = message.Last.toString();
2949
+ }
2950
+ return obj;
2951
+ },
2952
+ create(base) {
2953
+ return ImportSequenceRange.fromPartial(base ?? {});
2954
+ },
2955
+ fromPartial(object) {
2956
+ const message = createBaseImportSequenceRange();
2957
+ message.ChunkIndex = object.ChunkIndex ?? 0;
2958
+ message.First = (object.First !== undefined && object.First !== null) ? BigInt(object.First) : 0n;
2959
+ message.Last = (object.Last !== undefined && object.Last !== null) ? BigInt(object.Last) : 0n;
2960
+ return message;
2961
+ },
2962
+ };
2963
+ function createBaseNamedTag() {
2964
+ return { Name: "", Value: "" };
2965
+ }
2966
+ const NamedTag = {
2967
+ encode(message, writer = new BinaryWriter()) {
2968
+ if (message.Name !== "") {
2969
+ writer.uint32(10).string(message.Name);
2970
+ }
2971
+ if (message.Value !== "") {
2972
+ writer.uint32(18).string(message.Value);
2973
+ }
2974
+ return writer;
2975
+ },
2976
+ decode(input, length) {
2977
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2978
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2979
+ if (previousRecursionDepth >= 100) {
2980
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2981
+ }
2982
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2983
+ try {
2984
+ const end = length === undefined ? reader.len : reader.pos + length;
2985
+ const message = createBaseNamedTag();
2986
+ while (reader.pos < end) {
2987
+ const tag = reader.uint32();
2988
+ switch (tag >>> 3) {
2989
+ case 1: {
2990
+ if (tag !== 10) {
2991
+ break;
2992
+ }
2993
+ message.Name = reader.string();
2994
+ continue;
2995
+ }
2996
+ case 2: {
2997
+ if (tag !== 18) {
2998
+ break;
2999
+ }
3000
+ message.Value = reader.string();
3001
+ continue;
3002
+ }
3003
+ }
3004
+ if ((tag & 7) === 4 || tag === 0) {
3005
+ break;
3006
+ }
3007
+ reader.skip(tag & 7);
3008
+ }
3009
+ return message;
3010
+ }
3011
+ finally {
3012
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3013
+ }
3014
+ },
3015
+ fromJSON(object) {
3016
+ return {
3017
+ Name: isSet(object.Name) ? globalThis.String(object.Name) : "",
3018
+ Value: isSet(object.Value) ? globalThis.String(object.Value) : "",
3019
+ };
3020
+ },
3021
+ toJSON(message) {
3022
+ const obj = {};
3023
+ if (message.Name !== "") {
3024
+ obj.Name = message.Name;
3025
+ }
3026
+ if (message.Value !== "") {
3027
+ obj.Value = message.Value;
3028
+ }
3029
+ return obj;
3030
+ },
3031
+ create(base) {
3032
+ return NamedTag.fromPartial(base ?? {});
3033
+ },
3034
+ fromPartial(object) {
3035
+ const message = createBaseNamedTag();
3036
+ message.Name = object.Name ?? "";
3037
+ message.Value = object.Value ?? "";
3038
+ return message;
3039
+ },
3040
+ };
3041
+ function createBaseObserveImportRequest() {
3042
+ return { EventStore: "", Namespace: "", ImportId: undefined };
3043
+ }
3044
+ const ObserveImportRequest = {
3045
+ encode(message, writer = new BinaryWriter()) {
3046
+ if (message.EventStore !== "") {
3047
+ writer.uint32(10).string(message.EventStore);
3048
+ }
3049
+ if (message.Namespace !== "") {
3050
+ writer.uint32(18).string(message.Namespace);
3051
+ }
3052
+ if (message.ImportId !== undefined) {
3053
+ Guid.encode(message.ImportId, writer.uint32(26).fork()).join();
3054
+ }
3055
+ return writer;
3056
+ },
3057
+ decode(input, length) {
3058
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3059
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3060
+ if (previousRecursionDepth >= 100) {
3061
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3062
+ }
3063
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3064
+ try {
3065
+ const end = length === undefined ? reader.len : reader.pos + length;
3066
+ const message = createBaseObserveImportRequest();
3067
+ while (reader.pos < end) {
3068
+ const tag = reader.uint32();
3069
+ switch (tag >>> 3) {
3070
+ case 1: {
3071
+ if (tag !== 10) {
3072
+ break;
3073
+ }
3074
+ message.EventStore = reader.string();
3075
+ continue;
3076
+ }
3077
+ case 2: {
3078
+ if (tag !== 18) {
3079
+ break;
3080
+ }
3081
+ message.Namespace = reader.string();
3082
+ continue;
3083
+ }
3084
+ case 3: {
3085
+ if (tag !== 26) {
3086
+ break;
3087
+ }
3088
+ message.ImportId = Guid.decode(reader, reader.uint32());
3089
+ continue;
3090
+ }
3091
+ }
3092
+ if ((tag & 7) === 4 || tag === 0) {
3093
+ break;
3094
+ }
3095
+ reader.skip(tag & 7);
3096
+ }
3097
+ return message;
3098
+ }
3099
+ finally {
3100
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3101
+ }
3102
+ },
3103
+ fromJSON(object) {
3104
+ return {
3105
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
3106
+ Namespace: isSet(object.Namespace) ? globalThis.String(object.Namespace) : "",
3107
+ ImportId: isSet(object.ImportId) ? Guid.fromJSON(object.ImportId) : undefined,
3108
+ };
3109
+ },
3110
+ toJSON(message) {
3111
+ const obj = {};
3112
+ if (message.EventStore !== "") {
3113
+ obj.EventStore = message.EventStore;
3114
+ }
3115
+ if (message.Namespace !== "") {
3116
+ obj.Namespace = message.Namespace;
3117
+ }
3118
+ if (message.ImportId !== undefined) {
3119
+ obj.ImportId = Guid.toJSON(message.ImportId);
3120
+ }
3121
+ return obj;
3122
+ },
3123
+ create(base) {
3124
+ return ObserveImportRequest.fromPartial(base ?? {});
3125
+ },
3126
+ fromPartial(object) {
3127
+ const message = createBaseObserveImportRequest();
3128
+ message.EventStore = object.EventStore ?? "";
3129
+ message.Namespace = object.Namespace ?? "";
3130
+ message.ImportId = (object.ImportId !== undefined && object.ImportId !== null)
3131
+ ? Guid.fromPartial(object.ImportId)
3132
+ : undefined;
3133
+ return message;
3134
+ },
3135
+ };
3136
+ function createBaseQueryResultImportProgressResponse() {
3137
+ return {
3138
+ CorrelationId: undefined,
3139
+ IsAuthorized: false,
3140
+ ValidationResults: [],
3141
+ ExceptionMessages: [],
3142
+ ExceptionStackTrace: "",
3143
+ Data: undefined,
3144
+ };
3145
+ }
3146
+ const QueryResultImportProgressResponse = {
3147
+ encode(message, writer = new BinaryWriter()) {
3148
+ if (message.CorrelationId !== undefined) {
3149
+ Guid.encode(message.CorrelationId, writer.uint32(10).fork()).join();
3150
+ }
3151
+ if (message.IsAuthorized !== false) {
3152
+ writer.uint32(16).bool(message.IsAuthorized);
3153
+ }
3154
+ for (const v of message.ValidationResults) {
3155
+ ValidationResult.encode(v, writer.uint32(26).fork()).join();
3156
+ }
3157
+ for (const v of message.ExceptionMessages) {
3158
+ writer.uint32(34).string(v);
3159
+ }
3160
+ if (message.ExceptionStackTrace !== "") {
3161
+ writer.uint32(42).string(message.ExceptionStackTrace);
3162
+ }
3163
+ if (message.Data !== undefined) {
3164
+ ImportProgressResponse.encode(message.Data, writer.uint32(50).fork()).join();
3165
+ }
3166
+ return writer;
3167
+ },
3168
+ decode(input, length) {
3169
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3170
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3171
+ if (previousRecursionDepth >= 100) {
3172
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3173
+ }
3174
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3175
+ try {
3176
+ const end = length === undefined ? reader.len : reader.pos + length;
3177
+ const message = createBaseQueryResultImportProgressResponse();
3178
+ while (reader.pos < end) {
3179
+ const tag = reader.uint32();
3180
+ switch (tag >>> 3) {
3181
+ case 1: {
3182
+ if (tag !== 10) {
3183
+ break;
3184
+ }
3185
+ message.CorrelationId = Guid.decode(reader, reader.uint32());
3186
+ continue;
3187
+ }
3188
+ case 2: {
3189
+ if (tag !== 16) {
3190
+ break;
3191
+ }
3192
+ message.IsAuthorized = reader.bool();
3193
+ continue;
3194
+ }
3195
+ case 3: {
3196
+ if (tag !== 26) {
3197
+ break;
3198
+ }
3199
+ message.ValidationResults.push(ValidationResult.decode(reader, reader.uint32()));
3200
+ continue;
3201
+ }
3202
+ case 4: {
3203
+ if (tag !== 34) {
3204
+ break;
3205
+ }
3206
+ message.ExceptionMessages.push(reader.string());
3207
+ continue;
3208
+ }
3209
+ case 5: {
3210
+ if (tag !== 42) {
3211
+ break;
3212
+ }
3213
+ message.ExceptionStackTrace = reader.string();
3214
+ continue;
3215
+ }
3216
+ case 6: {
3217
+ if (tag !== 50) {
3218
+ break;
3219
+ }
3220
+ message.Data = ImportProgressResponse.decode(reader, reader.uint32());
3221
+ continue;
3222
+ }
3223
+ }
3224
+ if ((tag & 7) === 4 || tag === 0) {
3225
+ break;
3226
+ }
3227
+ reader.skip(tag & 7);
3228
+ }
3229
+ return message;
3230
+ }
3231
+ finally {
3232
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3233
+ }
3234
+ },
3235
+ fromJSON(object) {
3236
+ return {
3237
+ CorrelationId: isSet(object.CorrelationId) ? Guid.fromJSON(object.CorrelationId) : undefined,
3238
+ IsAuthorized: isSet(object.IsAuthorized) ? globalThis.Boolean(object.IsAuthorized) : false,
3239
+ ValidationResults: globalThis.Array.isArray(object?.ValidationResults)
3240
+ ? object.ValidationResults.map((e) => ValidationResult.fromJSON(e))
3241
+ : [],
3242
+ ExceptionMessages: globalThis.Array.isArray(object?.ExceptionMessages)
3243
+ ? object.ExceptionMessages.map((e) => globalThis.String(e))
3244
+ : [],
3245
+ ExceptionStackTrace: isSet(object.ExceptionStackTrace) ? globalThis.String(object.ExceptionStackTrace) : "",
3246
+ Data: isSet(object.Data) ? ImportProgressResponse.fromJSON(object.Data) : undefined,
3247
+ };
3248
+ },
3249
+ toJSON(message) {
3250
+ const obj = {};
3251
+ if (message.CorrelationId !== undefined) {
3252
+ obj.CorrelationId = Guid.toJSON(message.CorrelationId);
3253
+ }
3254
+ if (message.IsAuthorized !== false) {
3255
+ obj.IsAuthorized = message.IsAuthorized;
3256
+ }
3257
+ if (message.ValidationResults?.length) {
3258
+ obj.ValidationResults = message.ValidationResults.map((e) => ValidationResult.toJSON(e));
3259
+ }
3260
+ if (message.ExceptionMessages?.length) {
3261
+ obj.ExceptionMessages = message.ExceptionMessages;
3262
+ }
3263
+ if (message.ExceptionStackTrace !== "") {
3264
+ obj.ExceptionStackTrace = message.ExceptionStackTrace;
3265
+ }
3266
+ if (message.Data !== undefined) {
3267
+ obj.Data = ImportProgressResponse.toJSON(message.Data);
3268
+ }
3269
+ return obj;
3270
+ },
3271
+ create(base) {
3272
+ return QueryResultImportProgressResponse.fromPartial(base ?? {});
3273
+ },
3274
+ fromPartial(object) {
3275
+ const message = createBaseQueryResultImportProgressResponse();
3276
+ message.CorrelationId = (object.CorrelationId !== undefined && object.CorrelationId !== null)
3277
+ ? Guid.fromPartial(object.CorrelationId)
3278
+ : undefined;
3279
+ message.IsAuthorized = object.IsAuthorized ?? false;
3280
+ message.ValidationResults = object.ValidationResults?.map((e) => ValidationResult.fromPartial(e)) || [];
3281
+ message.ExceptionMessages = object.ExceptionMessages?.map((e) => e) || [];
3282
+ message.ExceptionStackTrace = object.ExceptionStackTrace ?? "";
3283
+ message.Data = (object.Data !== undefined && object.Data !== null)
3284
+ ? ImportProgressResponse.fromPartial(object.Data)
3285
+ : undefined;
3286
+ return message;
3287
+ },
3288
+ };
3289
+ function createBaseSerializableDateTimeOffset() {
3290
+ return { Value: "" };
3291
+ }
3292
+ const SerializableDateTimeOffset = {
3293
+ encode(message, writer = new BinaryWriter()) {
3294
+ if (message.Value !== "") {
3295
+ writer.uint32(10).string(message.Value);
3296
+ }
3297
+ return writer;
3298
+ },
3299
+ decode(input, length) {
3300
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3301
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3302
+ if (previousRecursionDepth >= 100) {
3303
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3304
+ }
3305
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3306
+ try {
3307
+ const end = length === undefined ? reader.len : reader.pos + length;
3308
+ const message = createBaseSerializableDateTimeOffset();
3309
+ while (reader.pos < end) {
3310
+ const tag = reader.uint32();
3311
+ switch (tag >>> 3) {
3312
+ case 1: {
3313
+ if (tag !== 10) {
3314
+ break;
3315
+ }
3316
+ message.Value = reader.string();
3317
+ continue;
3318
+ }
3319
+ }
3320
+ if ((tag & 7) === 4 || tag === 0) {
3321
+ break;
3322
+ }
3323
+ reader.skip(tag & 7);
3324
+ }
3325
+ return message;
3326
+ }
3327
+ finally {
3328
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3329
+ }
3330
+ },
3331
+ fromJSON(object) {
3332
+ return { Value: isSet(object.Value) ? globalThis.String(object.Value) : "" };
3333
+ },
3334
+ toJSON(message) {
3335
+ const obj = {};
3336
+ if (message.Value !== "") {
3337
+ obj.Value = message.Value;
3338
+ }
3339
+ return obj;
3340
+ },
3341
+ create(base) {
3342
+ return SerializableDateTimeOffset.fromPartial(base ?? {});
3343
+ },
3344
+ fromPartial(object) {
3345
+ const message = createBaseSerializableDateTimeOffset();
3346
+ message.Value = object.Value ?? "";
3347
+ return message;
3348
+ },
3349
+ };
3350
+ function createBaseValidationResult() {
3351
+ return { Severity: 0, Message: "", Members: [] };
3352
+ }
3353
+ const ValidationResult = {
3354
+ encode(message, writer = new BinaryWriter()) {
3355
+ if (message.Severity !== 0) {
3356
+ writer.uint32(8).int32(message.Severity);
3357
+ }
3358
+ if (message.Message !== "") {
3359
+ writer.uint32(18).string(message.Message);
3360
+ }
3361
+ for (const v of message.Members) {
3362
+ writer.uint32(26).string(v);
3363
+ }
3364
+ return writer;
3365
+ },
3366
+ decode(input, length) {
3367
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3368
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3369
+ if (previousRecursionDepth >= 100) {
3370
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3371
+ }
3372
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3373
+ try {
3374
+ const end = length === undefined ? reader.len : reader.pos + length;
3375
+ const message = createBaseValidationResult();
3376
+ while (reader.pos < end) {
3377
+ const tag = reader.uint32();
3378
+ switch (tag >>> 3) {
3379
+ case 1: {
3380
+ if (tag !== 8) {
3381
+ break;
3382
+ }
3383
+ message.Severity = reader.int32();
3384
+ continue;
3385
+ }
3386
+ case 2: {
3387
+ if (tag !== 18) {
3388
+ break;
3389
+ }
3390
+ message.Message = reader.string();
3391
+ continue;
3392
+ }
3393
+ case 3: {
3394
+ if (tag !== 26) {
3395
+ break;
3396
+ }
3397
+ message.Members.push(reader.string());
3398
+ continue;
3399
+ }
3400
+ }
3401
+ if ((tag & 7) === 4 || tag === 0) {
3402
+ break;
3403
+ }
3404
+ reader.skip(tag & 7);
3405
+ }
3406
+ return message;
3407
+ }
3408
+ finally {
3409
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3410
+ }
3411
+ },
3412
+ fromJSON(object) {
3413
+ return {
3414
+ Severity: isSet(object.Severity) ? validationResultSeverityFromJSON(object.Severity) : 0,
3415
+ Message: isSet(object.Message) ? globalThis.String(object.Message) : "",
3416
+ Members: globalThis.Array.isArray(object?.Members) ? object.Members.map((e) => globalThis.String(e)) : [],
3417
+ };
3418
+ },
3419
+ toJSON(message) {
3420
+ const obj = {};
3421
+ if (message.Severity !== 0) {
3422
+ obj.Severity = validationResultSeverityToJSON(message.Severity);
3423
+ }
3424
+ if (message.Message !== "") {
3425
+ obj.Message = message.Message;
3426
+ }
3427
+ if (message.Members?.length) {
3428
+ obj.Members = message.Members;
3429
+ }
3430
+ return obj;
3431
+ },
3432
+ create(base) {
3433
+ return ValidationResult.fromPartial(base ?? {});
3434
+ },
3435
+ fromPartial(object) {
3436
+ const message = createBaseValidationResult();
3437
+ message.Severity = object.Severity ?? 0;
3438
+ message.Message = object.Message ?? "";
3439
+ message.Members = object.Members?.map((e) => e) || [];
3440
+ return message;
3441
+ },
3442
+ };
3443
+ const ImportsDefinition = {
3444
+ name: "Imports",
3445
+ fullName: "Cratis.Chronicle.Contracts.Imports.Imports",
3446
+ methods: {
3447
+ abandonImport: {
3448
+ name: "AbandonImport",
3449
+ requestType: AbandonImportRequest,
3450
+ requestStream: false,
3451
+ responseType: CommandResultAbandonImportResponse,
3452
+ responseStream: false,
3453
+ options: {},
3454
+ },
3455
+ addImportChunk: {
3456
+ name: "AddImportChunk",
3457
+ requestType: AddImportChunkRequest,
3458
+ requestStream: false,
3459
+ responseType: CommandResultAddImportChunkResponse,
3460
+ responseStream: false,
3461
+ options: {},
3462
+ },
3463
+ beginImport: {
3464
+ name: "BeginImport",
3465
+ requestType: BeginImportRequest,
3466
+ requestStream: false,
3467
+ responseType: CommandResultBeginImportResponse,
3468
+ responseStream: false,
3469
+ options: {},
3470
+ },
3471
+ completeImport: {
3472
+ name: "CompleteImport",
3473
+ requestType: CompleteImportRequest,
3474
+ requestStream: false,
3475
+ responseType: CommandResultAbandonImportResponse,
3476
+ responseStream: false,
3477
+ options: {},
3478
+ },
3479
+ getImport: {
3480
+ name: "GetImport",
3481
+ requestType: GetImportRequest,
3482
+ requestStream: false,
3483
+ responseType: QueryResultImportProgressResponse,
3484
+ responseStream: false,
3485
+ options: {},
3486
+ },
3487
+ observeImport: {
3488
+ name: "ObserveImport",
3489
+ requestType: ObserveImportRequest,
3490
+ requestStream: false,
3491
+ responseType: QueryResultImportProgressResponse,
3492
+ responseStream: true,
3493
+ options: {},
3494
+ },
3495
+ },
3496
+ };
3497
+ function isObject(value) {
3498
+ return typeof value === "object" && value !== null;
3499
+ }
3500
+ function isSet(value) {
3501
+ return value !== null && value !== undefined;
3502
+ }
3503
+
3504
+ export { AbandonImportRequest, AbandonImportResponse, AddImportChunkRequest, AddImportChunkResponse, BeginImportRequest, BeginImportResponse, Causation, Causation_PropertiesEntry, CommandResultAbandonImportResponse, CommandResultAddImportChunkResponse, CommandResultBeginImportResponse, CompleteImportRequest, EventType, GetImportRequest, Identity, ImportEvent, ImportEventRejection, ImportProgressResponse, ImportSequenceRange, ImportState, ImportsDefinition, NamedTag, ObserveImportRequest, OnInvalidEvent, QueryResultImportProgressResponse, SerializableDateTimeOffset, ValidationResult, ValidationResultSeverity, importStateFromJSON, importStateToJSON, onInvalidEventFromJSON, onInvalidEventToJSON, validationResultSeverityFromJSON, validationResultSeverityToJSON };
3505
+ //# sourceMappingURL=imports.js.map