@cratis/chronicle.contracts 19.152.1 → 19.153.0

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