@cratis/chronicle.contracts 19.152.2 → 19.153.1

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