@cratis/chronicle.contracts 16.9.2 → 16.9.4

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.
@@ -0,0 +1,1183 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { Empty } from "./google/protobuf/empty";
3
+ export const protobufPackage = "Cratis.Chronicle.Contracts.ExternalServices";
4
+ export var ExternalServiceEndpointType;
5
+ (function (ExternalServiceEndpointType) {
6
+ ExternalServiceEndpointType[ExternalServiceEndpointType["Http"] = 0] = "Http";
7
+ ExternalServiceEndpointType[ExternalServiceEndpointType["MsSql"] = 1] = "MsSql";
8
+ ExternalServiceEndpointType[ExternalServiceEndpointType["PostgreSql"] = 2] = "PostgreSql";
9
+ ExternalServiceEndpointType[ExternalServiceEndpointType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10
+ })(ExternalServiceEndpointType || (ExternalServiceEndpointType = {}));
11
+ export function externalServiceEndpointTypeFromJSON(object) {
12
+ switch (object) {
13
+ case 0:
14
+ case "Http":
15
+ return ExternalServiceEndpointType.Http;
16
+ case 1:
17
+ case "MsSql":
18
+ return ExternalServiceEndpointType.MsSql;
19
+ case 2:
20
+ case "PostgreSql":
21
+ return ExternalServiceEndpointType.PostgreSql;
22
+ case -1:
23
+ case "UNRECOGNIZED":
24
+ default:
25
+ return ExternalServiceEndpointType.UNRECOGNIZED;
26
+ }
27
+ }
28
+ export function externalServiceEndpointTypeToJSON(object) {
29
+ switch (object) {
30
+ case ExternalServiceEndpointType.Http:
31
+ return "Http";
32
+ case ExternalServiceEndpointType.MsSql:
33
+ return "MsSql";
34
+ case ExternalServiceEndpointType.PostgreSql:
35
+ return "PostgreSql";
36
+ case ExternalServiceEndpointType.UNRECOGNIZED:
37
+ default:
38
+ return "UNRECOGNIZED";
39
+ }
40
+ }
41
+ function createBaseAddExternalServices() {
42
+ return { EventStore: "", ExternalServices: [] };
43
+ }
44
+ export const AddExternalServices = {
45
+ encode(message, writer = new BinaryWriter()) {
46
+ if (message.EventStore !== "") {
47
+ writer.uint32(10).string(message.EventStore);
48
+ }
49
+ for (const v of message.ExternalServices) {
50
+ ExternalServiceDefinition.encode(v, writer.uint32(18).fork()).join();
51
+ }
52
+ return writer;
53
+ },
54
+ decode(input, length) {
55
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
56
+ const end = length === undefined ? reader.len : reader.pos + length;
57
+ const message = createBaseAddExternalServices();
58
+ while (reader.pos < end) {
59
+ const tag = reader.uint32();
60
+ switch (tag >>> 3) {
61
+ case 1: {
62
+ if (tag !== 10) {
63
+ break;
64
+ }
65
+ message.EventStore = reader.string();
66
+ continue;
67
+ }
68
+ case 2: {
69
+ if (tag !== 18) {
70
+ break;
71
+ }
72
+ message.ExternalServices.push(ExternalServiceDefinition.decode(reader, reader.uint32()));
73
+ continue;
74
+ }
75
+ }
76
+ if ((tag & 7) === 4 || tag === 0) {
77
+ break;
78
+ }
79
+ reader.skip(tag & 7);
80
+ }
81
+ return message;
82
+ },
83
+ fromJSON(object) {
84
+ return {
85
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
86
+ ExternalServices: globalThis.Array.isArray(object?.ExternalServices)
87
+ ? object.ExternalServices.map((e) => ExternalServiceDefinition.fromJSON(e))
88
+ : [],
89
+ };
90
+ },
91
+ toJSON(message) {
92
+ const obj = {};
93
+ if (message.EventStore !== "") {
94
+ obj.EventStore = message.EventStore;
95
+ }
96
+ if (message.ExternalServices?.length) {
97
+ obj.ExternalServices = message.ExternalServices.map((e) => ExternalServiceDefinition.toJSON(e));
98
+ }
99
+ return obj;
100
+ },
101
+ create(base) {
102
+ return AddExternalServices.fromPartial(base ?? {});
103
+ },
104
+ fromPartial(object) {
105
+ const message = createBaseAddExternalServices();
106
+ message.EventStore = object.EventStore ?? "";
107
+ message.ExternalServices = object.ExternalServices?.map((e) => ExternalServiceDefinition.fromPartial(e)) || [];
108
+ return message;
109
+ },
110
+ };
111
+ function createBaseBasicAuthorization() {
112
+ return { Username: "", Password: "" };
113
+ }
114
+ export const BasicAuthorization = {
115
+ encode(message, writer = new BinaryWriter()) {
116
+ if (message.Username !== "") {
117
+ writer.uint32(10).string(message.Username);
118
+ }
119
+ if (message.Password !== "") {
120
+ writer.uint32(18).string(message.Password);
121
+ }
122
+ return writer;
123
+ },
124
+ decode(input, length) {
125
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
126
+ const end = length === undefined ? reader.len : reader.pos + length;
127
+ const message = createBaseBasicAuthorization();
128
+ while (reader.pos < end) {
129
+ const tag = reader.uint32();
130
+ switch (tag >>> 3) {
131
+ case 1: {
132
+ if (tag !== 10) {
133
+ break;
134
+ }
135
+ message.Username = reader.string();
136
+ continue;
137
+ }
138
+ case 2: {
139
+ if (tag !== 18) {
140
+ break;
141
+ }
142
+ message.Password = reader.string();
143
+ continue;
144
+ }
145
+ }
146
+ if ((tag & 7) === 4 || tag === 0) {
147
+ break;
148
+ }
149
+ reader.skip(tag & 7);
150
+ }
151
+ return message;
152
+ },
153
+ fromJSON(object) {
154
+ return {
155
+ Username: isSet(object.Username) ? globalThis.String(object.Username) : "",
156
+ Password: isSet(object.Password) ? globalThis.String(object.Password) : "",
157
+ };
158
+ },
159
+ toJSON(message) {
160
+ const obj = {};
161
+ if (message.Username !== "") {
162
+ obj.Username = message.Username;
163
+ }
164
+ if (message.Password !== "") {
165
+ obj.Password = message.Password;
166
+ }
167
+ return obj;
168
+ },
169
+ create(base) {
170
+ return BasicAuthorization.fromPartial(base ?? {});
171
+ },
172
+ fromPartial(object) {
173
+ const message = createBaseBasicAuthorization();
174
+ message.Username = object.Username ?? "";
175
+ message.Password = object.Password ?? "";
176
+ return message;
177
+ },
178
+ };
179
+ function createBaseBearerTokenAuthorization() {
180
+ return { Token: "" };
181
+ }
182
+ export const BearerTokenAuthorization = {
183
+ encode(message, writer = new BinaryWriter()) {
184
+ if (message.Token !== "") {
185
+ writer.uint32(10).string(message.Token);
186
+ }
187
+ return writer;
188
+ },
189
+ decode(input, length) {
190
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
191
+ const end = length === undefined ? reader.len : reader.pos + length;
192
+ const message = createBaseBearerTokenAuthorization();
193
+ while (reader.pos < end) {
194
+ const tag = reader.uint32();
195
+ switch (tag >>> 3) {
196
+ case 1: {
197
+ if (tag !== 10) {
198
+ break;
199
+ }
200
+ message.Token = reader.string();
201
+ continue;
202
+ }
203
+ }
204
+ if ((tag & 7) === 4 || tag === 0) {
205
+ break;
206
+ }
207
+ reader.skip(tag & 7);
208
+ }
209
+ return message;
210
+ },
211
+ fromJSON(object) {
212
+ return { Token: isSet(object.Token) ? globalThis.String(object.Token) : "" };
213
+ },
214
+ toJSON(message) {
215
+ const obj = {};
216
+ if (message.Token !== "") {
217
+ obj.Token = message.Token;
218
+ }
219
+ return obj;
220
+ },
221
+ create(base) {
222
+ return BearerTokenAuthorization.fromPartial(base ?? {});
223
+ },
224
+ fromPartial(object) {
225
+ const message = createBaseBearerTokenAuthorization();
226
+ message.Token = object.Token ?? "";
227
+ return message;
228
+ },
229
+ };
230
+ function createBaseDatabaseEndpointConfiguration() {
231
+ return { Host: "", Port: 0, Database: "", Username: "", Password: "", Options: {} };
232
+ }
233
+ export const DatabaseEndpointConfiguration = {
234
+ encode(message, writer = new BinaryWriter()) {
235
+ if (message.Host !== "") {
236
+ writer.uint32(10).string(message.Host);
237
+ }
238
+ if (message.Port !== 0) {
239
+ writer.uint32(16).int32(message.Port);
240
+ }
241
+ if (message.Database !== "") {
242
+ writer.uint32(26).string(message.Database);
243
+ }
244
+ if (message.Username !== "") {
245
+ writer.uint32(34).string(message.Username);
246
+ }
247
+ if (message.Password !== "") {
248
+ writer.uint32(42).string(message.Password);
249
+ }
250
+ globalThis.Object.entries(message.Options).forEach(([key, value]) => {
251
+ DatabaseEndpointConfiguration_OptionsEntry.encode({ key: key, value }, writer.uint32(50).fork()).join();
252
+ });
253
+ return writer;
254
+ },
255
+ decode(input, length) {
256
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
257
+ const end = length === undefined ? reader.len : reader.pos + length;
258
+ const message = createBaseDatabaseEndpointConfiguration();
259
+ while (reader.pos < end) {
260
+ const tag = reader.uint32();
261
+ switch (tag >>> 3) {
262
+ case 1: {
263
+ if (tag !== 10) {
264
+ break;
265
+ }
266
+ message.Host = reader.string();
267
+ continue;
268
+ }
269
+ case 2: {
270
+ if (tag !== 16) {
271
+ break;
272
+ }
273
+ message.Port = reader.int32();
274
+ continue;
275
+ }
276
+ case 3: {
277
+ if (tag !== 26) {
278
+ break;
279
+ }
280
+ message.Database = reader.string();
281
+ continue;
282
+ }
283
+ case 4: {
284
+ if (tag !== 34) {
285
+ break;
286
+ }
287
+ message.Username = reader.string();
288
+ continue;
289
+ }
290
+ case 5: {
291
+ if (tag !== 42) {
292
+ break;
293
+ }
294
+ message.Password = reader.string();
295
+ continue;
296
+ }
297
+ case 6: {
298
+ if (tag !== 50) {
299
+ break;
300
+ }
301
+ const entry6 = DatabaseEndpointConfiguration_OptionsEntry.decode(reader, reader.uint32());
302
+ if (entry6.value !== undefined) {
303
+ message.Options[entry6.key] = entry6.value;
304
+ }
305
+ continue;
306
+ }
307
+ }
308
+ if ((tag & 7) === 4 || tag === 0) {
309
+ break;
310
+ }
311
+ reader.skip(tag & 7);
312
+ }
313
+ return message;
314
+ },
315
+ fromJSON(object) {
316
+ return {
317
+ Host: isSet(object.Host) ? globalThis.String(object.Host) : "",
318
+ Port: isSet(object.Port) ? globalThis.Number(object.Port) : 0,
319
+ Database: isSet(object.Database) ? globalThis.String(object.Database) : "",
320
+ Username: isSet(object.Username) ? globalThis.String(object.Username) : "",
321
+ Password: isSet(object.Password) ? globalThis.String(object.Password) : "",
322
+ Options: isObject(object.Options)
323
+ ? globalThis.Object.entries(object.Options).reduce((acc, [key, value]) => {
324
+ acc[key] = globalThis.String(value);
325
+ return acc;
326
+ }, {})
327
+ : {},
328
+ };
329
+ },
330
+ toJSON(message) {
331
+ const obj = {};
332
+ if (message.Host !== "") {
333
+ obj.Host = message.Host;
334
+ }
335
+ if (message.Port !== 0) {
336
+ obj.Port = Math.round(message.Port);
337
+ }
338
+ if (message.Database !== "") {
339
+ obj.Database = message.Database;
340
+ }
341
+ if (message.Username !== "") {
342
+ obj.Username = message.Username;
343
+ }
344
+ if (message.Password !== "") {
345
+ obj.Password = message.Password;
346
+ }
347
+ if (message.Options) {
348
+ const entries = globalThis.Object.entries(message.Options);
349
+ if (entries.length > 0) {
350
+ obj.Options = {};
351
+ entries.forEach(([k, v]) => {
352
+ obj.Options[k] = v;
353
+ });
354
+ }
355
+ }
356
+ return obj;
357
+ },
358
+ create(base) {
359
+ return DatabaseEndpointConfiguration.fromPartial(base ?? {});
360
+ },
361
+ fromPartial(object) {
362
+ const message = createBaseDatabaseEndpointConfiguration();
363
+ message.Host = object.Host ?? "";
364
+ message.Port = object.Port ?? 0;
365
+ message.Database = object.Database ?? "";
366
+ message.Username = object.Username ?? "";
367
+ message.Password = object.Password ?? "";
368
+ message.Options = globalThis.Object.entries(object.Options ?? {}).reduce((acc, [key, value]) => {
369
+ if (value !== undefined) {
370
+ acc[key] = globalThis.String(value);
371
+ }
372
+ return acc;
373
+ }, {});
374
+ return message;
375
+ },
376
+ };
377
+ function createBaseDatabaseEndpointConfiguration_OptionsEntry() {
378
+ return { key: "", value: "" };
379
+ }
380
+ export const DatabaseEndpointConfiguration_OptionsEntry = {
381
+ encode(message, writer = new BinaryWriter()) {
382
+ if (message.key !== "") {
383
+ writer.uint32(10).string(message.key);
384
+ }
385
+ if (message.value !== "") {
386
+ writer.uint32(18).string(message.value);
387
+ }
388
+ return writer;
389
+ },
390
+ decode(input, length) {
391
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
392
+ const end = length === undefined ? reader.len : reader.pos + length;
393
+ const message = createBaseDatabaseEndpointConfiguration_OptionsEntry();
394
+ while (reader.pos < end) {
395
+ const tag = reader.uint32();
396
+ switch (tag >>> 3) {
397
+ case 1: {
398
+ if (tag !== 10) {
399
+ break;
400
+ }
401
+ message.key = reader.string();
402
+ continue;
403
+ }
404
+ case 2: {
405
+ if (tag !== 18) {
406
+ break;
407
+ }
408
+ message.value = reader.string();
409
+ continue;
410
+ }
411
+ }
412
+ if ((tag & 7) === 4 || tag === 0) {
413
+ break;
414
+ }
415
+ reader.skip(tag & 7);
416
+ }
417
+ return message;
418
+ },
419
+ fromJSON(object) {
420
+ return {
421
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
422
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
423
+ };
424
+ },
425
+ toJSON(message) {
426
+ const obj = {};
427
+ if (message.key !== "") {
428
+ obj.key = message.key;
429
+ }
430
+ if (message.value !== "") {
431
+ obj.value = message.value;
432
+ }
433
+ return obj;
434
+ },
435
+ create(base) {
436
+ return DatabaseEndpointConfiguration_OptionsEntry.fromPartial(base ?? {});
437
+ },
438
+ fromPartial(object) {
439
+ const message = createBaseDatabaseEndpointConfiguration_OptionsEntry();
440
+ message.key = object.key ?? "";
441
+ message.value = object.value ?? "";
442
+ return message;
443
+ },
444
+ };
445
+ function createBaseExternalServiceDefinition() {
446
+ return { Id: "", Name: "", Endpoint: undefined };
447
+ }
448
+ export const ExternalServiceDefinition = {
449
+ encode(message, writer = new BinaryWriter()) {
450
+ if (message.Id !== "") {
451
+ writer.uint32(10).string(message.Id);
452
+ }
453
+ if (message.Name !== "") {
454
+ writer.uint32(18).string(message.Name);
455
+ }
456
+ if (message.Endpoint !== undefined) {
457
+ ExternalServiceEndpoint.encode(message.Endpoint, writer.uint32(26).fork()).join();
458
+ }
459
+ return writer;
460
+ },
461
+ decode(input, length) {
462
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
463
+ const end = length === undefined ? reader.len : reader.pos + length;
464
+ const message = createBaseExternalServiceDefinition();
465
+ while (reader.pos < end) {
466
+ const tag = reader.uint32();
467
+ switch (tag >>> 3) {
468
+ case 1: {
469
+ if (tag !== 10) {
470
+ break;
471
+ }
472
+ message.Id = reader.string();
473
+ continue;
474
+ }
475
+ case 2: {
476
+ if (tag !== 18) {
477
+ break;
478
+ }
479
+ message.Name = reader.string();
480
+ continue;
481
+ }
482
+ case 3: {
483
+ if (tag !== 26) {
484
+ break;
485
+ }
486
+ message.Endpoint = ExternalServiceEndpoint.decode(reader, reader.uint32());
487
+ continue;
488
+ }
489
+ }
490
+ if ((tag & 7) === 4 || tag === 0) {
491
+ break;
492
+ }
493
+ reader.skip(tag & 7);
494
+ }
495
+ return message;
496
+ },
497
+ fromJSON(object) {
498
+ return {
499
+ Id: isSet(object.Id) ? globalThis.String(object.Id) : "",
500
+ Name: isSet(object.Name) ? globalThis.String(object.Name) : "",
501
+ Endpoint: isSet(object.Endpoint) ? ExternalServiceEndpoint.fromJSON(object.Endpoint) : undefined,
502
+ };
503
+ },
504
+ toJSON(message) {
505
+ const obj = {};
506
+ if (message.Id !== "") {
507
+ obj.Id = message.Id;
508
+ }
509
+ if (message.Name !== "") {
510
+ obj.Name = message.Name;
511
+ }
512
+ if (message.Endpoint !== undefined) {
513
+ obj.Endpoint = ExternalServiceEndpoint.toJSON(message.Endpoint);
514
+ }
515
+ return obj;
516
+ },
517
+ create(base) {
518
+ return ExternalServiceDefinition.fromPartial(base ?? {});
519
+ },
520
+ fromPartial(object) {
521
+ const message = createBaseExternalServiceDefinition();
522
+ message.Id = object.Id ?? "";
523
+ message.Name = object.Name ?? "";
524
+ message.Endpoint = (object.Endpoint !== undefined && object.Endpoint !== null)
525
+ ? ExternalServiceEndpoint.fromPartial(object.Endpoint)
526
+ : undefined;
527
+ return message;
528
+ },
529
+ };
530
+ function createBaseExternalServiceEndpoint() {
531
+ return { Type: 0, Http: undefined, Database: undefined };
532
+ }
533
+ export const ExternalServiceEndpoint = {
534
+ encode(message, writer = new BinaryWriter()) {
535
+ if (message.Type !== 0) {
536
+ writer.uint32(8).int32(message.Type);
537
+ }
538
+ if (message.Http !== undefined) {
539
+ HttpEndpointConfiguration.encode(message.Http, writer.uint32(18).fork()).join();
540
+ }
541
+ if (message.Database !== undefined) {
542
+ DatabaseEndpointConfiguration.encode(message.Database, writer.uint32(26).fork()).join();
543
+ }
544
+ return writer;
545
+ },
546
+ decode(input, length) {
547
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
548
+ const end = length === undefined ? reader.len : reader.pos + length;
549
+ const message = createBaseExternalServiceEndpoint();
550
+ while (reader.pos < end) {
551
+ const tag = reader.uint32();
552
+ switch (tag >>> 3) {
553
+ case 1: {
554
+ if (tag !== 8) {
555
+ break;
556
+ }
557
+ message.Type = reader.int32();
558
+ continue;
559
+ }
560
+ case 2: {
561
+ if (tag !== 18) {
562
+ break;
563
+ }
564
+ message.Http = HttpEndpointConfiguration.decode(reader, reader.uint32());
565
+ continue;
566
+ }
567
+ case 3: {
568
+ if (tag !== 26) {
569
+ break;
570
+ }
571
+ message.Database = DatabaseEndpointConfiguration.decode(reader, reader.uint32());
572
+ continue;
573
+ }
574
+ }
575
+ if ((tag & 7) === 4 || tag === 0) {
576
+ break;
577
+ }
578
+ reader.skip(tag & 7);
579
+ }
580
+ return message;
581
+ },
582
+ fromJSON(object) {
583
+ return {
584
+ Type: isSet(object.Type) ? externalServiceEndpointTypeFromJSON(object.Type) : 0,
585
+ Http: isSet(object.Http) ? HttpEndpointConfiguration.fromJSON(object.Http) : undefined,
586
+ Database: isSet(object.Database) ? DatabaseEndpointConfiguration.fromJSON(object.Database) : undefined,
587
+ };
588
+ },
589
+ toJSON(message) {
590
+ const obj = {};
591
+ if (message.Type !== 0) {
592
+ obj.Type = externalServiceEndpointTypeToJSON(message.Type);
593
+ }
594
+ if (message.Http !== undefined) {
595
+ obj.Http = HttpEndpointConfiguration.toJSON(message.Http);
596
+ }
597
+ if (message.Database !== undefined) {
598
+ obj.Database = DatabaseEndpointConfiguration.toJSON(message.Database);
599
+ }
600
+ return obj;
601
+ },
602
+ create(base) {
603
+ return ExternalServiceEndpoint.fromPartial(base ?? {});
604
+ },
605
+ fromPartial(object) {
606
+ const message = createBaseExternalServiceEndpoint();
607
+ message.Type = object.Type ?? 0;
608
+ message.Http = (object.Http !== undefined && object.Http !== null)
609
+ ? HttpEndpointConfiguration.fromPartial(object.Http)
610
+ : undefined;
611
+ message.Database = (object.Database !== undefined && object.Database !== null)
612
+ ? DatabaseEndpointConfiguration.fromPartial(object.Database)
613
+ : undefined;
614
+ return message;
615
+ },
616
+ };
617
+ function createBaseGetExternalServicesRequest() {
618
+ return { EventStore: "" };
619
+ }
620
+ export const GetExternalServicesRequest = {
621
+ encode(message, writer = new BinaryWriter()) {
622
+ if (message.EventStore !== "") {
623
+ writer.uint32(10).string(message.EventStore);
624
+ }
625
+ return writer;
626
+ },
627
+ decode(input, length) {
628
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
629
+ const end = length === undefined ? reader.len : reader.pos + length;
630
+ const message = createBaseGetExternalServicesRequest();
631
+ while (reader.pos < end) {
632
+ const tag = reader.uint32();
633
+ switch (tag >>> 3) {
634
+ case 1: {
635
+ if (tag !== 10) {
636
+ break;
637
+ }
638
+ message.EventStore = reader.string();
639
+ continue;
640
+ }
641
+ }
642
+ if ((tag & 7) === 4 || tag === 0) {
643
+ break;
644
+ }
645
+ reader.skip(tag & 7);
646
+ }
647
+ return message;
648
+ },
649
+ fromJSON(object) {
650
+ return { EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "" };
651
+ },
652
+ toJSON(message) {
653
+ const obj = {};
654
+ if (message.EventStore !== "") {
655
+ obj.EventStore = message.EventStore;
656
+ }
657
+ return obj;
658
+ },
659
+ create(base) {
660
+ return GetExternalServicesRequest.fromPartial(base ?? {});
661
+ },
662
+ fromPartial(object) {
663
+ const message = createBaseGetExternalServicesRequest();
664
+ message.EventStore = object.EventStore ?? "";
665
+ return message;
666
+ },
667
+ };
668
+ function createBaseHttpEndpointConfiguration() {
669
+ return { Url: "", Authorization: undefined, Headers: {} };
670
+ }
671
+ export const HttpEndpointConfiguration = {
672
+ encode(message, writer = new BinaryWriter()) {
673
+ if (message.Url !== "") {
674
+ writer.uint32(10).string(message.Url);
675
+ }
676
+ if (message.Authorization !== undefined) {
677
+ OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.encode(message.Authorization, writer.uint32(18).fork()).join();
678
+ }
679
+ globalThis.Object.entries(message.Headers).forEach(([key, value]) => {
680
+ HttpEndpointConfiguration_HeadersEntry.encode({ key: key, value }, writer.uint32(26).fork()).join();
681
+ });
682
+ return writer;
683
+ },
684
+ decode(input, length) {
685
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
686
+ const end = length === undefined ? reader.len : reader.pos + length;
687
+ const message = createBaseHttpEndpointConfiguration();
688
+ while (reader.pos < end) {
689
+ const tag = reader.uint32();
690
+ switch (tag >>> 3) {
691
+ case 1: {
692
+ if (tag !== 10) {
693
+ break;
694
+ }
695
+ message.Url = reader.string();
696
+ continue;
697
+ }
698
+ case 2: {
699
+ if (tag !== 18) {
700
+ break;
701
+ }
702
+ message.Authorization = OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.decode(reader, reader.uint32());
703
+ continue;
704
+ }
705
+ case 3: {
706
+ if (tag !== 26) {
707
+ break;
708
+ }
709
+ const entry3 = HttpEndpointConfiguration_HeadersEntry.decode(reader, reader.uint32());
710
+ if (entry3.value !== undefined) {
711
+ message.Headers[entry3.key] = entry3.value;
712
+ }
713
+ continue;
714
+ }
715
+ }
716
+ if ((tag & 7) === 4 || tag === 0) {
717
+ break;
718
+ }
719
+ reader.skip(tag & 7);
720
+ }
721
+ return message;
722
+ },
723
+ fromJSON(object) {
724
+ return {
725
+ Url: isSet(object.Url) ? globalThis.String(object.Url) : "",
726
+ Authorization: isSet(object.Authorization)
727
+ ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromJSON(object.Authorization)
728
+ : undefined,
729
+ Headers: isObject(object.Headers)
730
+ ? globalThis.Object.entries(object.Headers).reduce((acc, [key, value]) => {
731
+ acc[key] = globalThis.String(value);
732
+ return acc;
733
+ }, {})
734
+ : {},
735
+ };
736
+ },
737
+ toJSON(message) {
738
+ const obj = {};
739
+ if (message.Url !== "") {
740
+ obj.Url = message.Url;
741
+ }
742
+ if (message.Authorization !== undefined) {
743
+ obj.Authorization = OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.toJSON(message.Authorization);
744
+ }
745
+ if (message.Headers) {
746
+ const entries = globalThis.Object.entries(message.Headers);
747
+ if (entries.length > 0) {
748
+ obj.Headers = {};
749
+ entries.forEach(([k, v]) => {
750
+ obj.Headers[k] = v;
751
+ });
752
+ }
753
+ }
754
+ return obj;
755
+ },
756
+ create(base) {
757
+ return HttpEndpointConfiguration.fromPartial(base ?? {});
758
+ },
759
+ fromPartial(object) {
760
+ const message = createBaseHttpEndpointConfiguration();
761
+ message.Url = object.Url ?? "";
762
+ message.Authorization = (object.Authorization !== undefined && object.Authorization !== null)
763
+ ? OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromPartial(object.Authorization)
764
+ : undefined;
765
+ message.Headers = globalThis.Object.entries(object.Headers ?? {}).reduce((acc, [key, value]) => {
766
+ if (value !== undefined) {
767
+ acc[key] = globalThis.String(value);
768
+ }
769
+ return acc;
770
+ }, {});
771
+ return message;
772
+ },
773
+ };
774
+ function createBaseHttpEndpointConfiguration_HeadersEntry() {
775
+ return { key: "", value: "" };
776
+ }
777
+ export const HttpEndpointConfiguration_HeadersEntry = {
778
+ encode(message, writer = new BinaryWriter()) {
779
+ if (message.key !== "") {
780
+ writer.uint32(10).string(message.key);
781
+ }
782
+ if (message.value !== "") {
783
+ writer.uint32(18).string(message.value);
784
+ }
785
+ return writer;
786
+ },
787
+ decode(input, length) {
788
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
789
+ const end = length === undefined ? reader.len : reader.pos + length;
790
+ const message = createBaseHttpEndpointConfiguration_HeadersEntry();
791
+ while (reader.pos < end) {
792
+ const tag = reader.uint32();
793
+ switch (tag >>> 3) {
794
+ case 1: {
795
+ if (tag !== 10) {
796
+ break;
797
+ }
798
+ message.key = reader.string();
799
+ continue;
800
+ }
801
+ case 2: {
802
+ if (tag !== 18) {
803
+ break;
804
+ }
805
+ message.value = reader.string();
806
+ continue;
807
+ }
808
+ }
809
+ if ((tag & 7) === 4 || tag === 0) {
810
+ break;
811
+ }
812
+ reader.skip(tag & 7);
813
+ }
814
+ return message;
815
+ },
816
+ fromJSON(object) {
817
+ return {
818
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
819
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
820
+ };
821
+ },
822
+ toJSON(message) {
823
+ const obj = {};
824
+ if (message.key !== "") {
825
+ obj.key = message.key;
826
+ }
827
+ if (message.value !== "") {
828
+ obj.value = message.value;
829
+ }
830
+ return obj;
831
+ },
832
+ create(base) {
833
+ return HttpEndpointConfiguration_HeadersEntry.fromPartial(base ?? {});
834
+ },
835
+ fromPartial(object) {
836
+ const message = createBaseHttpEndpointConfiguration_HeadersEntry();
837
+ message.key = object.key ?? "";
838
+ message.value = object.value ?? "";
839
+ return message;
840
+ },
841
+ };
842
+ function createBaseIEnumerableExternalServiceDefinition() {
843
+ return { items: [] };
844
+ }
845
+ export const IEnumerableExternalServiceDefinition = {
846
+ encode(message, writer = new BinaryWriter()) {
847
+ for (const v of message.items) {
848
+ ExternalServiceDefinition.encode(v, writer.uint32(10).fork()).join();
849
+ }
850
+ return writer;
851
+ },
852
+ decode(input, length) {
853
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
854
+ const end = length === undefined ? reader.len : reader.pos + length;
855
+ const message = createBaseIEnumerableExternalServiceDefinition();
856
+ while (reader.pos < end) {
857
+ const tag = reader.uint32();
858
+ switch (tag >>> 3) {
859
+ case 1: {
860
+ if (tag !== 10) {
861
+ break;
862
+ }
863
+ message.items.push(ExternalServiceDefinition.decode(reader, reader.uint32()));
864
+ continue;
865
+ }
866
+ }
867
+ if ((tag & 7) === 4 || tag === 0) {
868
+ break;
869
+ }
870
+ reader.skip(tag & 7);
871
+ }
872
+ return message;
873
+ },
874
+ fromJSON(object) {
875
+ return {
876
+ items: globalThis.Array.isArray(object?.items)
877
+ ? object.items.map((e) => ExternalServiceDefinition.fromJSON(e))
878
+ : [],
879
+ };
880
+ },
881
+ toJSON(message) {
882
+ const obj = {};
883
+ if (message.items?.length) {
884
+ obj.items = message.items.map((e) => ExternalServiceDefinition.toJSON(e));
885
+ }
886
+ return obj;
887
+ },
888
+ create(base) {
889
+ return IEnumerableExternalServiceDefinition.fromPartial(base ?? {});
890
+ },
891
+ fromPartial(object) {
892
+ const message = createBaseIEnumerableExternalServiceDefinition();
893
+ message.items = object.items?.map((e) => ExternalServiceDefinition.fromPartial(e)) || [];
894
+ return message;
895
+ },
896
+ };
897
+ function createBaseOAuthAuthorization() {
898
+ return { Authority: "", ClientId: "", ClientSecret: "" };
899
+ }
900
+ export const OAuthAuthorization = {
901
+ encode(message, writer = new BinaryWriter()) {
902
+ if (message.Authority !== "") {
903
+ writer.uint32(10).string(message.Authority);
904
+ }
905
+ if (message.ClientId !== "") {
906
+ writer.uint32(18).string(message.ClientId);
907
+ }
908
+ if (message.ClientSecret !== "") {
909
+ writer.uint32(26).string(message.ClientSecret);
910
+ }
911
+ return writer;
912
+ },
913
+ decode(input, length) {
914
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
915
+ const end = length === undefined ? reader.len : reader.pos + length;
916
+ const message = createBaseOAuthAuthorization();
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
+ message.Authority = reader.string();
925
+ continue;
926
+ }
927
+ case 2: {
928
+ if (tag !== 18) {
929
+ break;
930
+ }
931
+ message.ClientId = reader.string();
932
+ continue;
933
+ }
934
+ case 3: {
935
+ if (tag !== 26) {
936
+ break;
937
+ }
938
+ message.ClientSecret = reader.string();
939
+ continue;
940
+ }
941
+ }
942
+ if ((tag & 7) === 4 || tag === 0) {
943
+ break;
944
+ }
945
+ reader.skip(tag & 7);
946
+ }
947
+ return message;
948
+ },
949
+ fromJSON(object) {
950
+ return {
951
+ Authority: isSet(object.Authority) ? globalThis.String(object.Authority) : "",
952
+ ClientId: isSet(object.ClientId) ? globalThis.String(object.ClientId) : "",
953
+ ClientSecret: isSet(object.ClientSecret) ? globalThis.String(object.ClientSecret) : "",
954
+ };
955
+ },
956
+ toJSON(message) {
957
+ const obj = {};
958
+ if (message.Authority !== "") {
959
+ obj.Authority = message.Authority;
960
+ }
961
+ if (message.ClientId !== "") {
962
+ obj.ClientId = message.ClientId;
963
+ }
964
+ if (message.ClientSecret !== "") {
965
+ obj.ClientSecret = message.ClientSecret;
966
+ }
967
+ return obj;
968
+ },
969
+ create(base) {
970
+ return OAuthAuthorization.fromPartial(base ?? {});
971
+ },
972
+ fromPartial(object) {
973
+ const message = createBaseOAuthAuthorization();
974
+ message.Authority = object.Authority ?? "";
975
+ message.ClientId = object.ClientId ?? "";
976
+ message.ClientSecret = object.ClientSecret ?? "";
977
+ return message;
978
+ },
979
+ };
980
+ function createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization() {
981
+ return { Value0: undefined, Value1: undefined, Value2: undefined };
982
+ }
983
+ export const OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization = {
984
+ encode(message, writer = new BinaryWriter()) {
985
+ if (message.Value0 !== undefined) {
986
+ BasicAuthorization.encode(message.Value0, writer.uint32(10).fork()).join();
987
+ }
988
+ if (message.Value1 !== undefined) {
989
+ BearerTokenAuthorization.encode(message.Value1, writer.uint32(18).fork()).join();
990
+ }
991
+ if (message.Value2 !== undefined) {
992
+ OAuthAuthorization.encode(message.Value2, writer.uint32(26).fork()).join();
993
+ }
994
+ return writer;
995
+ },
996
+ decode(input, length) {
997
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
998
+ const end = length === undefined ? reader.len : reader.pos + length;
999
+ const message = createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization();
1000
+ while (reader.pos < end) {
1001
+ const tag = reader.uint32();
1002
+ switch (tag >>> 3) {
1003
+ case 1: {
1004
+ if (tag !== 10) {
1005
+ break;
1006
+ }
1007
+ message.Value0 = BasicAuthorization.decode(reader, reader.uint32());
1008
+ continue;
1009
+ }
1010
+ case 2: {
1011
+ if (tag !== 18) {
1012
+ break;
1013
+ }
1014
+ message.Value1 = BearerTokenAuthorization.decode(reader, reader.uint32());
1015
+ continue;
1016
+ }
1017
+ case 3: {
1018
+ if (tag !== 26) {
1019
+ break;
1020
+ }
1021
+ message.Value2 = OAuthAuthorization.decode(reader, reader.uint32());
1022
+ continue;
1023
+ }
1024
+ }
1025
+ if ((tag & 7) === 4 || tag === 0) {
1026
+ break;
1027
+ }
1028
+ reader.skip(tag & 7);
1029
+ }
1030
+ return message;
1031
+ },
1032
+ fromJSON(object) {
1033
+ return {
1034
+ Value0: isSet(object.Value0) ? BasicAuthorization.fromJSON(object.Value0) : undefined,
1035
+ Value1: isSet(object.Value1) ? BearerTokenAuthorization.fromJSON(object.Value1) : undefined,
1036
+ Value2: isSet(object.Value2) ? OAuthAuthorization.fromJSON(object.Value2) : undefined,
1037
+ };
1038
+ },
1039
+ toJSON(message) {
1040
+ const obj = {};
1041
+ if (message.Value0 !== undefined) {
1042
+ obj.Value0 = BasicAuthorization.toJSON(message.Value0);
1043
+ }
1044
+ if (message.Value1 !== undefined) {
1045
+ obj.Value1 = BearerTokenAuthorization.toJSON(message.Value1);
1046
+ }
1047
+ if (message.Value2 !== undefined) {
1048
+ obj.Value2 = OAuthAuthorization.toJSON(message.Value2);
1049
+ }
1050
+ return obj;
1051
+ },
1052
+ create(base) {
1053
+ return OneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization.fromPartial(base ?? {});
1054
+ },
1055
+ fromPartial(object) {
1056
+ const message = createBaseOneOfBasicAuthorizationBearerTokenAuthorizationOAuthAuthorization();
1057
+ message.Value0 = (object.Value0 !== undefined && object.Value0 !== null)
1058
+ ? BasicAuthorization.fromPartial(object.Value0)
1059
+ : undefined;
1060
+ message.Value1 = (object.Value1 !== undefined && object.Value1 !== null)
1061
+ ? BearerTokenAuthorization.fromPartial(object.Value1)
1062
+ : undefined;
1063
+ message.Value2 = (object.Value2 !== undefined && object.Value2 !== null)
1064
+ ? OAuthAuthorization.fromPartial(object.Value2)
1065
+ : undefined;
1066
+ return message;
1067
+ },
1068
+ };
1069
+ function createBaseRemoveExternalServices() {
1070
+ return { EventStore: "", ExternalServices: [] };
1071
+ }
1072
+ export const RemoveExternalServices = {
1073
+ encode(message, writer = new BinaryWriter()) {
1074
+ if (message.EventStore !== "") {
1075
+ writer.uint32(10).string(message.EventStore);
1076
+ }
1077
+ for (const v of message.ExternalServices) {
1078
+ writer.uint32(18).string(v);
1079
+ }
1080
+ return writer;
1081
+ },
1082
+ decode(input, length) {
1083
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1084
+ const end = length === undefined ? reader.len : reader.pos + length;
1085
+ const message = createBaseRemoveExternalServices();
1086
+ while (reader.pos < end) {
1087
+ const tag = reader.uint32();
1088
+ switch (tag >>> 3) {
1089
+ case 1: {
1090
+ if (tag !== 10) {
1091
+ break;
1092
+ }
1093
+ message.EventStore = reader.string();
1094
+ continue;
1095
+ }
1096
+ case 2: {
1097
+ if (tag !== 18) {
1098
+ break;
1099
+ }
1100
+ message.ExternalServices.push(reader.string());
1101
+ continue;
1102
+ }
1103
+ }
1104
+ if ((tag & 7) === 4 || tag === 0) {
1105
+ break;
1106
+ }
1107
+ reader.skip(tag & 7);
1108
+ }
1109
+ return message;
1110
+ },
1111
+ fromJSON(object) {
1112
+ return {
1113
+ EventStore: isSet(object.EventStore) ? globalThis.String(object.EventStore) : "",
1114
+ ExternalServices: globalThis.Array.isArray(object?.ExternalServices)
1115
+ ? object.ExternalServices.map((e) => globalThis.String(e))
1116
+ : [],
1117
+ };
1118
+ },
1119
+ toJSON(message) {
1120
+ const obj = {};
1121
+ if (message.EventStore !== "") {
1122
+ obj.EventStore = message.EventStore;
1123
+ }
1124
+ if (message.ExternalServices?.length) {
1125
+ obj.ExternalServices = message.ExternalServices;
1126
+ }
1127
+ return obj;
1128
+ },
1129
+ create(base) {
1130
+ return RemoveExternalServices.fromPartial(base ?? {});
1131
+ },
1132
+ fromPartial(object) {
1133
+ const message = createBaseRemoveExternalServices();
1134
+ message.EventStore = object.EventStore ?? "";
1135
+ message.ExternalServices = object.ExternalServices?.map((e) => e) || [];
1136
+ return message;
1137
+ },
1138
+ };
1139
+ export const ExternalServicesDefinition = {
1140
+ name: "ExternalServices",
1141
+ fullName: "Cratis.Chronicle.Contracts.ExternalServices.ExternalServices",
1142
+ methods: {
1143
+ add: {
1144
+ name: "Add",
1145
+ requestType: AddExternalServices,
1146
+ requestStream: false,
1147
+ responseType: Empty,
1148
+ responseStream: false,
1149
+ options: {},
1150
+ },
1151
+ getExternalServices: {
1152
+ name: "GetExternalServices",
1153
+ requestType: GetExternalServicesRequest,
1154
+ requestStream: false,
1155
+ responseType: IEnumerableExternalServiceDefinition,
1156
+ responseStream: false,
1157
+ options: {},
1158
+ },
1159
+ observeExternalServices: {
1160
+ name: "ObserveExternalServices",
1161
+ requestType: GetExternalServicesRequest,
1162
+ requestStream: false,
1163
+ responseType: IEnumerableExternalServiceDefinition,
1164
+ responseStream: true,
1165
+ options: {},
1166
+ },
1167
+ remove: {
1168
+ name: "Remove",
1169
+ requestType: RemoveExternalServices,
1170
+ requestStream: false,
1171
+ responseType: Empty,
1172
+ responseStream: false,
1173
+ options: {},
1174
+ },
1175
+ },
1176
+ };
1177
+ function isObject(value) {
1178
+ return typeof value === "object" && value !== null;
1179
+ }
1180
+ function isSet(value) {
1181
+ return value !== null && value !== undefined;
1182
+ }
1183
+ //# sourceMappingURL=externalservices.js.map