@kronos-ts/axon-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/axon-server-event-store.d.ts +16 -0
  2. package/dist/axon-server-event-store.d.ts.map +1 -0
  3. package/dist/axon-server-event-store.js +282 -0
  4. package/dist/axon-server-event-store.js.map +1 -0
  5. package/dist/axon-server-snapshot-store.d.ts +12 -0
  6. package/dist/axon-server-snapshot-store.d.ts.map +1 -0
  7. package/dist/axon-server-snapshot-store.js +88 -0
  8. package/dist/axon-server-snapshot-store.js.map +1 -0
  9. package/dist/axon-server.d.ts +115 -0
  10. package/dist/axon-server.d.ts.map +1 -0
  11. package/dist/axon-server.js +986 -0
  12. package/dist/axon-server.js.map +1 -0
  13. package/dist/connection-manager.d.ts +49 -0
  14. package/dist/connection-manager.d.ts.map +1 -0
  15. package/dist/connection-manager.js +37 -0
  16. package/dist/connection-manager.js.map +1 -0
  17. package/dist/connection.d.ts +129 -0
  18. package/dist/connection.d.ts.map +1 -0
  19. package/dist/connection.js +130 -0
  20. package/dist/connection.js.map +1 -0
  21. package/dist/errors.d.ts +96 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/errors.js +189 -0
  24. package/dist/errors.js.map +1 -0
  25. package/dist/event-processor-info.d.ts +35 -0
  26. package/dist/event-processor-info.d.ts.map +1 -0
  27. package/dist/event-processor-info.js +28 -0
  28. package/dist/event-processor-info.js.map +1 -0
  29. package/dist/flow-controlled-sender.d.ts +30 -0
  30. package/dist/flow-controlled-sender.d.ts.map +1 -0
  31. package/dist/flow-controlled-sender.js +60 -0
  32. package/dist/flow-controlled-sender.js.map +1 -0
  33. package/dist/generated/command.d.ts +158 -0
  34. package/dist/generated/command.d.ts.map +1 -0
  35. package/dist/generated/command.js +970 -0
  36. package/dist/generated/command.js.map +1 -0
  37. package/dist/generated/common.d.ts +130 -0
  38. package/dist/generated/common.d.ts.map +1 -0
  39. package/dist/generated/common.js +908 -0
  40. package/dist/generated/common.js.map +1 -0
  41. package/dist/generated/control.d.ts +293 -0
  42. package/dist/generated/control.d.ts.map +1 -0
  43. package/dist/generated/control.js +1938 -0
  44. package/dist/generated/control.js.map +1 -0
  45. package/dist/generated/dcb.d.ts +650 -0
  46. package/dist/generated/dcb.d.ts.map +1 -0
  47. package/dist/generated/dcb.js +2943 -0
  48. package/dist/generated/dcb.js.map +1 -0
  49. package/dist/generated/event.d.ts +667 -0
  50. package/dist/generated/event.d.ts.map +1 -0
  51. package/dist/generated/event.js +3185 -0
  52. package/dist/generated/event.js.map +1 -0
  53. package/dist/generated/google/protobuf/empty.d.ts +30 -0
  54. package/dist/generated/google/protobuf/empty.d.ts.map +1 -0
  55. package/dist/generated/google/protobuf/empty.js +46 -0
  56. package/dist/generated/google/protobuf/empty.js.map +1 -0
  57. package/dist/generated/query.d.ts +300 -0
  58. package/dist/generated/query.d.ts.map +1 -0
  59. package/dist/generated/query.js +2183 -0
  60. package/dist/generated/query.js.map +1 -0
  61. package/dist/index.d.ts +12 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +12 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/message-size.d.ts +38 -0
  66. package/dist/message-size.d.ts.map +1 -0
  67. package/dist/message-size.js +57 -0
  68. package/dist/message-size.js.map +1 -0
  69. package/dist/metadata-conversion.d.ts +11 -0
  70. package/dist/metadata-conversion.d.ts.map +1 -0
  71. package/dist/metadata-conversion.js +51 -0
  72. package/dist/metadata-conversion.js.map +1 -0
  73. package/dist/outbound-stream.d.ts +15 -0
  74. package/dist/outbound-stream.d.ts.map +1 -0
  75. package/dist/outbound-stream.js +39 -0
  76. package/dist/outbound-stream.js.map +1 -0
  77. package/dist/platform-service.d.ts +119 -0
  78. package/dist/platform-service.d.ts.map +1 -0
  79. package/dist/platform-service.js +250 -0
  80. package/dist/platform-service.js.map +1 -0
  81. package/dist/shutdown-latch.d.ts +38 -0
  82. package/dist/shutdown-latch.d.ts.map +1 -0
  83. package/dist/shutdown-latch.js +51 -0
  84. package/dist/shutdown-latch.js.map +1 -0
  85. package/package.json +69 -0
  86. package/src/axon-server-event-store.ts +358 -0
  87. package/src/axon-server-snapshot-store.ts +118 -0
  88. package/src/axon-server.ts +1202 -0
  89. package/src/connection-manager.ts +88 -0
  90. package/src/connection.ts +272 -0
  91. package/src/errors.ts +223 -0
  92. package/src/event-processor-info.ts +62 -0
  93. package/src/flow-controlled-sender.ts +91 -0
  94. package/src/generated/command.ts +1231 -0
  95. package/src/generated/common.ts +1097 -0
  96. package/src/generated/control.ts +2419 -0
  97. package/src/generated/dcb.ts +3826 -0
  98. package/src/generated/event.ts +4076 -0
  99. package/src/generated/google/protobuf/empty.ts +84 -0
  100. package/src/generated/query.ts +2723 -0
  101. package/src/index.ts +75 -0
  102. package/src/message-size.ts +75 -0
  103. package/src/metadata-conversion.ts +46 -0
  104. package/src/outbound-stream.ts +52 -0
  105. package/src/platform-service.ts +361 -0
  106. package/src/shutdown-latch.ts +97 -0
@@ -0,0 +1,1097 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.6
4
+ // protoc v3.19.1
5
+ // source: common.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+
10
+ export const protobufPackage = "io.axoniq.axonserver.grpc";
11
+
12
+ /** An enumeration of possible keys for processing instructions. */
13
+ export enum ProcessingKey {
14
+ /** ROUTING_KEY - key indicating that the attached value should be used for consistent routing. */
15
+ ROUTING_KEY = 0,
16
+ /** PRIORITY - key indicating that the attached value indicates relative priority of this message. */
17
+ PRIORITY = 1,
18
+ /** TIMEOUT - key indicating that the accompanied message has a finite validity. The attached value contains the number of milliseconds. */
19
+ TIMEOUT = 2,
20
+ /** NR_OF_RESULTS - key indicating that the requester expects at most the given number of results from this message. Use -1 for unlimited. */
21
+ NR_OF_RESULTS = 3,
22
+ /** SERVER_SUPPORTS_STREAMING - key indicating whether Axon Server supports streaming. */
23
+ SERVER_SUPPORTS_STREAMING = 7,
24
+ /** CLIENT_SUPPORTS_STREAMING - key indicating whether Client supports streaming. */
25
+ CLIENT_SUPPORTS_STREAMING = 8,
26
+ UNRECOGNIZED = -1,
27
+ }
28
+
29
+ export function processingKeyFromJSON(object: any): ProcessingKey {
30
+ switch (object) {
31
+ case 0:
32
+ case "ROUTING_KEY":
33
+ return ProcessingKey.ROUTING_KEY;
34
+ case 1:
35
+ case "PRIORITY":
36
+ return ProcessingKey.PRIORITY;
37
+ case 2:
38
+ case "TIMEOUT":
39
+ return ProcessingKey.TIMEOUT;
40
+ case 3:
41
+ case "NR_OF_RESULTS":
42
+ return ProcessingKey.NR_OF_RESULTS;
43
+ case 7:
44
+ case "SERVER_SUPPORTS_STREAMING":
45
+ return ProcessingKey.SERVER_SUPPORTS_STREAMING;
46
+ case 8:
47
+ case "CLIENT_SUPPORTS_STREAMING":
48
+ return ProcessingKey.CLIENT_SUPPORTS_STREAMING;
49
+ case -1:
50
+ case "UNRECOGNIZED":
51
+ default:
52
+ return ProcessingKey.UNRECOGNIZED;
53
+ }
54
+ }
55
+
56
+ export function processingKeyToJSON(object: ProcessingKey): string {
57
+ switch (object) {
58
+ case ProcessingKey.ROUTING_KEY:
59
+ return "ROUTING_KEY";
60
+ case ProcessingKey.PRIORITY:
61
+ return "PRIORITY";
62
+ case ProcessingKey.TIMEOUT:
63
+ return "TIMEOUT";
64
+ case ProcessingKey.NR_OF_RESULTS:
65
+ return "NR_OF_RESULTS";
66
+ case ProcessingKey.SERVER_SUPPORTS_STREAMING:
67
+ return "SERVER_SUPPORTS_STREAMING";
68
+ case ProcessingKey.CLIENT_SUPPORTS_STREAMING:
69
+ return "CLIENT_SUPPORTS_STREAMING";
70
+ case ProcessingKey.UNRECOGNIZED:
71
+ default:
72
+ return "UNRECOGNIZED";
73
+ }
74
+ }
75
+
76
+ /** Defines status values for a scheduled task */
77
+ export enum TaskStatus {
78
+ /** SCHEDULED - Task is scheduled for execution */
79
+ SCHEDULED = 0,
80
+ /** COMPLETED - Task execution completed successfully */
81
+ COMPLETED = 1,
82
+ /** FAILED - Task execution failed with non transient exception */
83
+ FAILED = 2,
84
+ /** RUNNING - Task execution is in progress */
85
+ RUNNING = 3,
86
+ /** CANCELLED - Task execution is in progress */
87
+ CANCELLED = 4,
88
+ UNRECOGNIZED = -1,
89
+ }
90
+
91
+ export function taskStatusFromJSON(object: any): TaskStatus {
92
+ switch (object) {
93
+ case 0:
94
+ case "SCHEDULED":
95
+ return TaskStatus.SCHEDULED;
96
+ case 1:
97
+ case "COMPLETED":
98
+ return TaskStatus.COMPLETED;
99
+ case 2:
100
+ case "FAILED":
101
+ return TaskStatus.FAILED;
102
+ case 3:
103
+ case "RUNNING":
104
+ return TaskStatus.RUNNING;
105
+ case 4:
106
+ case "CANCELLED":
107
+ return TaskStatus.CANCELLED;
108
+ case -1:
109
+ case "UNRECOGNIZED":
110
+ default:
111
+ return TaskStatus.UNRECOGNIZED;
112
+ }
113
+ }
114
+
115
+ export function taskStatusToJSON(object: TaskStatus): string {
116
+ switch (object) {
117
+ case TaskStatus.SCHEDULED:
118
+ return "SCHEDULED";
119
+ case TaskStatus.COMPLETED:
120
+ return "COMPLETED";
121
+ case TaskStatus.FAILED:
122
+ return "FAILED";
123
+ case TaskStatus.RUNNING:
124
+ return "RUNNING";
125
+ case TaskStatus.CANCELLED:
126
+ return "CANCELLED";
127
+ case TaskStatus.UNRECOGNIZED:
128
+ default:
129
+ return "UNRECOGNIZED";
130
+ }
131
+ }
132
+
133
+ /** Describes a serialized object */
134
+ export interface SerializedObject {
135
+ /** The type identifier of the serialized object. */
136
+ type: string;
137
+ /** The revision of the serialized form of the given type. */
138
+ revision: string;
139
+ /** The actual data representing the object in serialized form. */
140
+ data: Uint8Array;
141
+ }
142
+
143
+ /** The value of a MetaData entry. */
144
+ export interface MetaDataValue {
145
+ /** The text value of the Meta Data entry. */
146
+ textValue?:
147
+ | string
148
+ | undefined;
149
+ /** The numeric value of the Meta Data entry. */
150
+ numberValue?:
151
+ | bigint
152
+ | undefined;
153
+ /** The boolean value of the Meta Data entry. */
154
+ booleanValue?:
155
+ | boolean
156
+ | undefined;
157
+ /** The floating point value of the Meta Data entry. */
158
+ doubleValue?:
159
+ | number
160
+ | undefined;
161
+ /** The binary value of the Meta Data entry. */
162
+ bytesValue?: SerializedObject | undefined;
163
+ }
164
+
165
+ /** An instruction for routing components when routing or processing a message. */
166
+ export interface ProcessingInstruction {
167
+ /** The type of processing message. */
168
+ key: ProcessingKey;
169
+ /** The value associated with the processing key. */
170
+ value: MetaDataValue | undefined;
171
+ }
172
+
173
+ /** Message containing details of an error */
174
+ export interface ErrorMessage {
175
+ /** A human readable message explaining the error */
176
+ message: string;
177
+ /** A description of the location (client component, server) where the error occurred */
178
+ location: string;
179
+ /** A collection of messages providing more details about root causes of the error */
180
+ details: string[];
181
+ /** An Error Code identifying the type of error */
182
+ errorCode: string;
183
+ }
184
+
185
+ /** Message used for Flow Control instruction, providing the counterpart with additional permits for sending messages */
186
+ export interface FlowControl {
187
+ /** The ClientID of the component providing additional permits */
188
+ clientId: string;
189
+ /** The number of permits to provide */
190
+ permits: bigint;
191
+ }
192
+
193
+ /** Message describing instruction acknowledgement */
194
+ export interface InstructionAck {
195
+ /** The identifier of the instruction */
196
+ instructionId: string;
197
+ /** Indicator whether the instruction was acknowledged successfully */
198
+ success: boolean;
199
+ /** Set if instruction acknowledgement failed. */
200
+ error: ErrorMessage | undefined;
201
+ }
202
+
203
+ /** Message describing the result of the execution of an instruction */
204
+ export interface InstructionResult {
205
+ /** The identifier of the instruction */
206
+ instructionId: string;
207
+ /** Indicator whether the instruction was processed successfully */
208
+ success: boolean;
209
+ /** Cause of instruction handling failure. */
210
+ error: ErrorMessage | undefined;
211
+ }
212
+
213
+ export interface Component {
214
+ component: string;
215
+ }
216
+
217
+ export interface Principal {
218
+ user: string;
219
+ }
220
+
221
+ function createBaseSerializedObject(): SerializedObject {
222
+ return { type: "", revision: "", data: new Uint8Array(0) };
223
+ }
224
+
225
+ export const SerializedObject: MessageFns<SerializedObject> = {
226
+ encode(message: SerializedObject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
227
+ if (message.type !== "") {
228
+ writer.uint32(10).string(message.type);
229
+ }
230
+ if (message.revision !== "") {
231
+ writer.uint32(18).string(message.revision);
232
+ }
233
+ if (message.data.length !== 0) {
234
+ writer.uint32(26).bytes(message.data);
235
+ }
236
+ return writer;
237
+ },
238
+
239
+ decode(input: BinaryReader | Uint8Array, length?: number): SerializedObject {
240
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
241
+ const end = length === undefined ? reader.len : reader.pos + length;
242
+ const message = createBaseSerializedObject();
243
+ while (reader.pos < end) {
244
+ const tag = reader.uint32();
245
+ switch (tag >>> 3) {
246
+ case 1: {
247
+ if (tag !== 10) {
248
+ break;
249
+ }
250
+
251
+ message.type = reader.string();
252
+ continue;
253
+ }
254
+ case 2: {
255
+ if (tag !== 18) {
256
+ break;
257
+ }
258
+
259
+ message.revision = reader.string();
260
+ continue;
261
+ }
262
+ case 3: {
263
+ if (tag !== 26) {
264
+ break;
265
+ }
266
+
267
+ message.data = reader.bytes();
268
+ continue;
269
+ }
270
+ }
271
+ if ((tag & 7) === 4 || tag === 0) {
272
+ break;
273
+ }
274
+ reader.skip(tag & 7);
275
+ }
276
+ return message;
277
+ },
278
+
279
+ fromJSON(object: any): SerializedObject {
280
+ return {
281
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
282
+ revision: isSet(object.revision) ? globalThis.String(object.revision) : "",
283
+ data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
284
+ };
285
+ },
286
+
287
+ toJSON(message: SerializedObject): unknown {
288
+ const obj: any = {};
289
+ if (message.type !== "") {
290
+ obj.type = message.type;
291
+ }
292
+ if (message.revision !== "") {
293
+ obj.revision = message.revision;
294
+ }
295
+ if (message.data.length !== 0) {
296
+ obj.data = base64FromBytes(message.data);
297
+ }
298
+ return obj;
299
+ },
300
+
301
+ create(base?: DeepPartial<SerializedObject>): SerializedObject {
302
+ return SerializedObject.fromPartial(base ?? {});
303
+ },
304
+ fromPartial(object: DeepPartial<SerializedObject>): SerializedObject {
305
+ const message = createBaseSerializedObject();
306
+ message.type = object.type ?? "";
307
+ message.revision = object.revision ?? "";
308
+ message.data = object.data ?? new Uint8Array(0);
309
+ return message;
310
+ },
311
+ };
312
+
313
+ function createBaseMetaDataValue(): MetaDataValue {
314
+ return {
315
+ textValue: undefined,
316
+ numberValue: undefined,
317
+ booleanValue: undefined,
318
+ doubleValue: undefined,
319
+ bytesValue: undefined,
320
+ };
321
+ }
322
+
323
+ export const MetaDataValue: MessageFns<MetaDataValue> = {
324
+ encode(message: MetaDataValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
325
+ if (message.textValue !== undefined) {
326
+ writer.uint32(10).string(message.textValue);
327
+ }
328
+ if (message.numberValue !== undefined) {
329
+ if (BigInt.asIntN(64, message.numberValue) !== message.numberValue) {
330
+ throw new globalThis.Error("value provided for field message.numberValue of type sint64 too large");
331
+ }
332
+ writer.uint32(16).sint64(message.numberValue);
333
+ }
334
+ if (message.booleanValue !== undefined) {
335
+ writer.uint32(24).bool(message.booleanValue);
336
+ }
337
+ if (message.doubleValue !== undefined) {
338
+ writer.uint32(33).double(message.doubleValue);
339
+ }
340
+ if (message.bytesValue !== undefined) {
341
+ SerializedObject.encode(message.bytesValue, writer.uint32(42).fork()).join();
342
+ }
343
+ return writer;
344
+ },
345
+
346
+ decode(input: BinaryReader | Uint8Array, length?: number): MetaDataValue {
347
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
348
+ const end = length === undefined ? reader.len : reader.pos + length;
349
+ const message = createBaseMetaDataValue();
350
+ while (reader.pos < end) {
351
+ const tag = reader.uint32();
352
+ switch (tag >>> 3) {
353
+ case 1: {
354
+ if (tag !== 10) {
355
+ break;
356
+ }
357
+
358
+ message.textValue = reader.string();
359
+ continue;
360
+ }
361
+ case 2: {
362
+ if (tag !== 16) {
363
+ break;
364
+ }
365
+
366
+ message.numberValue = reader.sint64() as bigint;
367
+ continue;
368
+ }
369
+ case 3: {
370
+ if (tag !== 24) {
371
+ break;
372
+ }
373
+
374
+ message.booleanValue = reader.bool();
375
+ continue;
376
+ }
377
+ case 4: {
378
+ if (tag !== 33) {
379
+ break;
380
+ }
381
+
382
+ message.doubleValue = reader.double();
383
+ continue;
384
+ }
385
+ case 5: {
386
+ if (tag !== 42) {
387
+ break;
388
+ }
389
+
390
+ message.bytesValue = SerializedObject.decode(reader, reader.uint32());
391
+ continue;
392
+ }
393
+ }
394
+ if ((tag & 7) === 4 || tag === 0) {
395
+ break;
396
+ }
397
+ reader.skip(tag & 7);
398
+ }
399
+ return message;
400
+ },
401
+
402
+ fromJSON(object: any): MetaDataValue {
403
+ return {
404
+ textValue: isSet(object.textValue)
405
+ ? globalThis.String(object.textValue)
406
+ : isSet(object.text_value)
407
+ ? globalThis.String(object.text_value)
408
+ : undefined,
409
+ numberValue: isSet(object.numberValue)
410
+ ? BigInt(object.numberValue)
411
+ : isSet(object.number_value)
412
+ ? BigInt(object.number_value)
413
+ : undefined,
414
+ booleanValue: isSet(object.booleanValue)
415
+ ? globalThis.Boolean(object.booleanValue)
416
+ : isSet(object.boolean_value)
417
+ ? globalThis.Boolean(object.boolean_value)
418
+ : undefined,
419
+ doubleValue: isSet(object.doubleValue)
420
+ ? globalThis.Number(object.doubleValue)
421
+ : isSet(object.double_value)
422
+ ? globalThis.Number(object.double_value)
423
+ : undefined,
424
+ bytesValue: isSet(object.bytesValue)
425
+ ? SerializedObject.fromJSON(object.bytesValue)
426
+ : isSet(object.bytes_value)
427
+ ? SerializedObject.fromJSON(object.bytes_value)
428
+ : undefined,
429
+ };
430
+ },
431
+
432
+ toJSON(message: MetaDataValue): unknown {
433
+ const obj: any = {};
434
+ if (message.textValue !== undefined) {
435
+ obj.textValue = message.textValue;
436
+ }
437
+ if (message.numberValue !== undefined) {
438
+ obj.numberValue = message.numberValue.toString();
439
+ }
440
+ if (message.booleanValue !== undefined) {
441
+ obj.booleanValue = message.booleanValue;
442
+ }
443
+ if (message.doubleValue !== undefined) {
444
+ obj.doubleValue = message.doubleValue;
445
+ }
446
+ if (message.bytesValue !== undefined) {
447
+ obj.bytesValue = SerializedObject.toJSON(message.bytesValue);
448
+ }
449
+ return obj;
450
+ },
451
+
452
+ create(base?: DeepPartial<MetaDataValue>): MetaDataValue {
453
+ return MetaDataValue.fromPartial(base ?? {});
454
+ },
455
+ fromPartial(object: DeepPartial<MetaDataValue>): MetaDataValue {
456
+ const message = createBaseMetaDataValue();
457
+ message.textValue = object.textValue ?? undefined;
458
+ message.numberValue = object.numberValue ?? undefined;
459
+ message.booleanValue = object.booleanValue ?? undefined;
460
+ message.doubleValue = object.doubleValue ?? undefined;
461
+ message.bytesValue = (object.bytesValue !== undefined && object.bytesValue !== null)
462
+ ? SerializedObject.fromPartial(object.bytesValue)
463
+ : undefined;
464
+ return message;
465
+ },
466
+ };
467
+
468
+ function createBaseProcessingInstruction(): ProcessingInstruction {
469
+ return { key: 0, value: undefined };
470
+ }
471
+
472
+ export const ProcessingInstruction: MessageFns<ProcessingInstruction> = {
473
+ encode(message: ProcessingInstruction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
474
+ if (message.key !== 0) {
475
+ writer.uint32(8).int32(message.key);
476
+ }
477
+ if (message.value !== undefined) {
478
+ MetaDataValue.encode(message.value, writer.uint32(18).fork()).join();
479
+ }
480
+ return writer;
481
+ },
482
+
483
+ decode(input: BinaryReader | Uint8Array, length?: number): ProcessingInstruction {
484
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
485
+ const end = length === undefined ? reader.len : reader.pos + length;
486
+ const message = createBaseProcessingInstruction();
487
+ while (reader.pos < end) {
488
+ const tag = reader.uint32();
489
+ switch (tag >>> 3) {
490
+ case 1: {
491
+ if (tag !== 8) {
492
+ break;
493
+ }
494
+
495
+ message.key = reader.int32() as any;
496
+ continue;
497
+ }
498
+ case 2: {
499
+ if (tag !== 18) {
500
+ break;
501
+ }
502
+
503
+ message.value = MetaDataValue.decode(reader, reader.uint32());
504
+ continue;
505
+ }
506
+ }
507
+ if ((tag & 7) === 4 || tag === 0) {
508
+ break;
509
+ }
510
+ reader.skip(tag & 7);
511
+ }
512
+ return message;
513
+ },
514
+
515
+ fromJSON(object: any): ProcessingInstruction {
516
+ return {
517
+ key: isSet(object.key) ? processingKeyFromJSON(object.key) : 0,
518
+ value: isSet(object.value) ? MetaDataValue.fromJSON(object.value) : undefined,
519
+ };
520
+ },
521
+
522
+ toJSON(message: ProcessingInstruction): unknown {
523
+ const obj: any = {};
524
+ if (message.key !== 0) {
525
+ obj.key = processingKeyToJSON(message.key);
526
+ }
527
+ if (message.value !== undefined) {
528
+ obj.value = MetaDataValue.toJSON(message.value);
529
+ }
530
+ return obj;
531
+ },
532
+
533
+ create(base?: DeepPartial<ProcessingInstruction>): ProcessingInstruction {
534
+ return ProcessingInstruction.fromPartial(base ?? {});
535
+ },
536
+ fromPartial(object: DeepPartial<ProcessingInstruction>): ProcessingInstruction {
537
+ const message = createBaseProcessingInstruction();
538
+ message.key = object.key ?? 0;
539
+ message.value = (object.value !== undefined && object.value !== null)
540
+ ? MetaDataValue.fromPartial(object.value)
541
+ : undefined;
542
+ return message;
543
+ },
544
+ };
545
+
546
+ function createBaseErrorMessage(): ErrorMessage {
547
+ return { message: "", location: "", details: [], errorCode: "" };
548
+ }
549
+
550
+ export const ErrorMessage: MessageFns<ErrorMessage> = {
551
+ encode(message: ErrorMessage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
552
+ if (message.message !== "") {
553
+ writer.uint32(10).string(message.message);
554
+ }
555
+ if (message.location !== "") {
556
+ writer.uint32(18).string(message.location);
557
+ }
558
+ for (const v of message.details) {
559
+ writer.uint32(26).string(v!);
560
+ }
561
+ if (message.errorCode !== "") {
562
+ writer.uint32(34).string(message.errorCode);
563
+ }
564
+ return writer;
565
+ },
566
+
567
+ decode(input: BinaryReader | Uint8Array, length?: number): ErrorMessage {
568
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
569
+ const end = length === undefined ? reader.len : reader.pos + length;
570
+ const message = createBaseErrorMessage();
571
+ while (reader.pos < end) {
572
+ const tag = reader.uint32();
573
+ switch (tag >>> 3) {
574
+ case 1: {
575
+ if (tag !== 10) {
576
+ break;
577
+ }
578
+
579
+ message.message = reader.string();
580
+ continue;
581
+ }
582
+ case 2: {
583
+ if (tag !== 18) {
584
+ break;
585
+ }
586
+
587
+ message.location = reader.string();
588
+ continue;
589
+ }
590
+ case 3: {
591
+ if (tag !== 26) {
592
+ break;
593
+ }
594
+
595
+ message.details.push(reader.string());
596
+ continue;
597
+ }
598
+ case 4: {
599
+ if (tag !== 34) {
600
+ break;
601
+ }
602
+
603
+ message.errorCode = reader.string();
604
+ continue;
605
+ }
606
+ }
607
+ if ((tag & 7) === 4 || tag === 0) {
608
+ break;
609
+ }
610
+ reader.skip(tag & 7);
611
+ }
612
+ return message;
613
+ },
614
+
615
+ fromJSON(object: any): ErrorMessage {
616
+ return {
617
+ message: isSet(object.message) ? globalThis.String(object.message) : "",
618
+ location: isSet(object.location) ? globalThis.String(object.location) : "",
619
+ details: globalThis.Array.isArray(object?.details) ? object.details.map((e: any) => globalThis.String(e)) : [],
620
+ errorCode: isSet(object.errorCode)
621
+ ? globalThis.String(object.errorCode)
622
+ : isSet(object.error_code)
623
+ ? globalThis.String(object.error_code)
624
+ : "",
625
+ };
626
+ },
627
+
628
+ toJSON(message: ErrorMessage): unknown {
629
+ const obj: any = {};
630
+ if (message.message !== "") {
631
+ obj.message = message.message;
632
+ }
633
+ if (message.location !== "") {
634
+ obj.location = message.location;
635
+ }
636
+ if (message.details?.length) {
637
+ obj.details = message.details;
638
+ }
639
+ if (message.errorCode !== "") {
640
+ obj.errorCode = message.errorCode;
641
+ }
642
+ return obj;
643
+ },
644
+
645
+ create(base?: DeepPartial<ErrorMessage>): ErrorMessage {
646
+ return ErrorMessage.fromPartial(base ?? {});
647
+ },
648
+ fromPartial(object: DeepPartial<ErrorMessage>): ErrorMessage {
649
+ const message = createBaseErrorMessage();
650
+ message.message = object.message ?? "";
651
+ message.location = object.location ?? "";
652
+ message.details = object.details?.map((e) => e) || [];
653
+ message.errorCode = object.errorCode ?? "";
654
+ return message;
655
+ },
656
+ };
657
+
658
+ function createBaseFlowControl(): FlowControl {
659
+ return { clientId: "", permits: 0n };
660
+ }
661
+
662
+ export const FlowControl: MessageFns<FlowControl> = {
663
+ encode(message: FlowControl, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
664
+ if (message.clientId !== "") {
665
+ writer.uint32(18).string(message.clientId);
666
+ }
667
+ if (message.permits !== 0n) {
668
+ if (BigInt.asIntN(64, message.permits) !== message.permits) {
669
+ throw new globalThis.Error("value provided for field message.permits of type int64 too large");
670
+ }
671
+ writer.uint32(24).int64(message.permits);
672
+ }
673
+ return writer;
674
+ },
675
+
676
+ decode(input: BinaryReader | Uint8Array, length?: number): FlowControl {
677
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
678
+ const end = length === undefined ? reader.len : reader.pos + length;
679
+ const message = createBaseFlowControl();
680
+ while (reader.pos < end) {
681
+ const tag = reader.uint32();
682
+ switch (tag >>> 3) {
683
+ case 2: {
684
+ if (tag !== 18) {
685
+ break;
686
+ }
687
+
688
+ message.clientId = reader.string();
689
+ continue;
690
+ }
691
+ case 3: {
692
+ if (tag !== 24) {
693
+ break;
694
+ }
695
+
696
+ message.permits = reader.int64() as bigint;
697
+ continue;
698
+ }
699
+ }
700
+ if ((tag & 7) === 4 || tag === 0) {
701
+ break;
702
+ }
703
+ reader.skip(tag & 7);
704
+ }
705
+ return message;
706
+ },
707
+
708
+ fromJSON(object: any): FlowControl {
709
+ return {
710
+ clientId: isSet(object.clientId)
711
+ ? globalThis.String(object.clientId)
712
+ : isSet(object.client_id)
713
+ ? globalThis.String(object.client_id)
714
+ : "",
715
+ permits: isSet(object.permits) ? BigInt(object.permits) : 0n,
716
+ };
717
+ },
718
+
719
+ toJSON(message: FlowControl): unknown {
720
+ const obj: any = {};
721
+ if (message.clientId !== "") {
722
+ obj.clientId = message.clientId;
723
+ }
724
+ if (message.permits !== 0n) {
725
+ obj.permits = message.permits.toString();
726
+ }
727
+ return obj;
728
+ },
729
+
730
+ create(base?: DeepPartial<FlowControl>): FlowControl {
731
+ return FlowControl.fromPartial(base ?? {});
732
+ },
733
+ fromPartial(object: DeepPartial<FlowControl>): FlowControl {
734
+ const message = createBaseFlowControl();
735
+ message.clientId = object.clientId ?? "";
736
+ message.permits = object.permits ?? 0n;
737
+ return message;
738
+ },
739
+ };
740
+
741
+ function createBaseInstructionAck(): InstructionAck {
742
+ return { instructionId: "", success: false, error: undefined };
743
+ }
744
+
745
+ export const InstructionAck: MessageFns<InstructionAck> = {
746
+ encode(message: InstructionAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
747
+ if (message.instructionId !== "") {
748
+ writer.uint32(10).string(message.instructionId);
749
+ }
750
+ if (message.success !== false) {
751
+ writer.uint32(16).bool(message.success);
752
+ }
753
+ if (message.error !== undefined) {
754
+ ErrorMessage.encode(message.error, writer.uint32(26).fork()).join();
755
+ }
756
+ return writer;
757
+ },
758
+
759
+ decode(input: BinaryReader | Uint8Array, length?: number): InstructionAck {
760
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
761
+ const end = length === undefined ? reader.len : reader.pos + length;
762
+ const message = createBaseInstructionAck();
763
+ while (reader.pos < end) {
764
+ const tag = reader.uint32();
765
+ switch (tag >>> 3) {
766
+ case 1: {
767
+ if (tag !== 10) {
768
+ break;
769
+ }
770
+
771
+ message.instructionId = reader.string();
772
+ continue;
773
+ }
774
+ case 2: {
775
+ if (tag !== 16) {
776
+ break;
777
+ }
778
+
779
+ message.success = reader.bool();
780
+ continue;
781
+ }
782
+ case 3: {
783
+ if (tag !== 26) {
784
+ break;
785
+ }
786
+
787
+ message.error = ErrorMessage.decode(reader, reader.uint32());
788
+ continue;
789
+ }
790
+ }
791
+ if ((tag & 7) === 4 || tag === 0) {
792
+ break;
793
+ }
794
+ reader.skip(tag & 7);
795
+ }
796
+ return message;
797
+ },
798
+
799
+ fromJSON(object: any): InstructionAck {
800
+ return {
801
+ instructionId: isSet(object.instructionId)
802
+ ? globalThis.String(object.instructionId)
803
+ : isSet(object.instruction_id)
804
+ ? globalThis.String(object.instruction_id)
805
+ : "",
806
+ success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
807
+ error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
808
+ };
809
+ },
810
+
811
+ toJSON(message: InstructionAck): unknown {
812
+ const obj: any = {};
813
+ if (message.instructionId !== "") {
814
+ obj.instructionId = message.instructionId;
815
+ }
816
+ if (message.success !== false) {
817
+ obj.success = message.success;
818
+ }
819
+ if (message.error !== undefined) {
820
+ obj.error = ErrorMessage.toJSON(message.error);
821
+ }
822
+ return obj;
823
+ },
824
+
825
+ create(base?: DeepPartial<InstructionAck>): InstructionAck {
826
+ return InstructionAck.fromPartial(base ?? {});
827
+ },
828
+ fromPartial(object: DeepPartial<InstructionAck>): InstructionAck {
829
+ const message = createBaseInstructionAck();
830
+ message.instructionId = object.instructionId ?? "";
831
+ message.success = object.success ?? false;
832
+ message.error = (object.error !== undefined && object.error !== null)
833
+ ? ErrorMessage.fromPartial(object.error)
834
+ : undefined;
835
+ return message;
836
+ },
837
+ };
838
+
839
+ function createBaseInstructionResult(): InstructionResult {
840
+ return { instructionId: "", success: false, error: undefined };
841
+ }
842
+
843
+ export const InstructionResult: MessageFns<InstructionResult> = {
844
+ encode(message: InstructionResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
845
+ if (message.instructionId !== "") {
846
+ writer.uint32(10).string(message.instructionId);
847
+ }
848
+ if (message.success !== false) {
849
+ writer.uint32(16).bool(message.success);
850
+ }
851
+ if (message.error !== undefined) {
852
+ ErrorMessage.encode(message.error, writer.uint32(26).fork()).join();
853
+ }
854
+ return writer;
855
+ },
856
+
857
+ decode(input: BinaryReader | Uint8Array, length?: number): InstructionResult {
858
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
859
+ const end = length === undefined ? reader.len : reader.pos + length;
860
+ const message = createBaseInstructionResult();
861
+ while (reader.pos < end) {
862
+ const tag = reader.uint32();
863
+ switch (tag >>> 3) {
864
+ case 1: {
865
+ if (tag !== 10) {
866
+ break;
867
+ }
868
+
869
+ message.instructionId = reader.string();
870
+ continue;
871
+ }
872
+ case 2: {
873
+ if (tag !== 16) {
874
+ break;
875
+ }
876
+
877
+ message.success = reader.bool();
878
+ continue;
879
+ }
880
+ case 3: {
881
+ if (tag !== 26) {
882
+ break;
883
+ }
884
+
885
+ message.error = ErrorMessage.decode(reader, reader.uint32());
886
+ continue;
887
+ }
888
+ }
889
+ if ((tag & 7) === 4 || tag === 0) {
890
+ break;
891
+ }
892
+ reader.skip(tag & 7);
893
+ }
894
+ return message;
895
+ },
896
+
897
+ fromJSON(object: any): InstructionResult {
898
+ return {
899
+ instructionId: isSet(object.instructionId)
900
+ ? globalThis.String(object.instructionId)
901
+ : isSet(object.instruction_id)
902
+ ? globalThis.String(object.instruction_id)
903
+ : "",
904
+ success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
905
+ error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
906
+ };
907
+ },
908
+
909
+ toJSON(message: InstructionResult): unknown {
910
+ const obj: any = {};
911
+ if (message.instructionId !== "") {
912
+ obj.instructionId = message.instructionId;
913
+ }
914
+ if (message.success !== false) {
915
+ obj.success = message.success;
916
+ }
917
+ if (message.error !== undefined) {
918
+ obj.error = ErrorMessage.toJSON(message.error);
919
+ }
920
+ return obj;
921
+ },
922
+
923
+ create(base?: DeepPartial<InstructionResult>): InstructionResult {
924
+ return InstructionResult.fromPartial(base ?? {});
925
+ },
926
+ fromPartial(object: DeepPartial<InstructionResult>): InstructionResult {
927
+ const message = createBaseInstructionResult();
928
+ message.instructionId = object.instructionId ?? "";
929
+ message.success = object.success ?? false;
930
+ message.error = (object.error !== undefined && object.error !== null)
931
+ ? ErrorMessage.fromPartial(object.error)
932
+ : undefined;
933
+ return message;
934
+ },
935
+ };
936
+
937
+ function createBaseComponent(): Component {
938
+ return { component: "" };
939
+ }
940
+
941
+ export const Component: MessageFns<Component> = {
942
+ encode(message: Component, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
943
+ if (message.component !== "") {
944
+ writer.uint32(10).string(message.component);
945
+ }
946
+ return writer;
947
+ },
948
+
949
+ decode(input: BinaryReader | Uint8Array, length?: number): Component {
950
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
951
+ const end = length === undefined ? reader.len : reader.pos + length;
952
+ const message = createBaseComponent();
953
+ while (reader.pos < end) {
954
+ const tag = reader.uint32();
955
+ switch (tag >>> 3) {
956
+ case 1: {
957
+ if (tag !== 10) {
958
+ break;
959
+ }
960
+
961
+ message.component = reader.string();
962
+ continue;
963
+ }
964
+ }
965
+ if ((tag & 7) === 4 || tag === 0) {
966
+ break;
967
+ }
968
+ reader.skip(tag & 7);
969
+ }
970
+ return message;
971
+ },
972
+
973
+ fromJSON(object: any): Component {
974
+ return { component: isSet(object.component) ? globalThis.String(object.component) : "" };
975
+ },
976
+
977
+ toJSON(message: Component): unknown {
978
+ const obj: any = {};
979
+ if (message.component !== "") {
980
+ obj.component = message.component;
981
+ }
982
+ return obj;
983
+ },
984
+
985
+ create(base?: DeepPartial<Component>): Component {
986
+ return Component.fromPartial(base ?? {});
987
+ },
988
+ fromPartial(object: DeepPartial<Component>): Component {
989
+ const message = createBaseComponent();
990
+ message.component = object.component ?? "";
991
+ return message;
992
+ },
993
+ };
994
+
995
+ function createBasePrincipal(): Principal {
996
+ return { user: "" };
997
+ }
998
+
999
+ export const Principal: MessageFns<Principal> = {
1000
+ encode(message: Principal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1001
+ if (message.user !== "") {
1002
+ writer.uint32(10).string(message.user);
1003
+ }
1004
+ return writer;
1005
+ },
1006
+
1007
+ decode(input: BinaryReader | Uint8Array, length?: number): Principal {
1008
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1009
+ const end = length === undefined ? reader.len : reader.pos + length;
1010
+ const message = createBasePrincipal();
1011
+ while (reader.pos < end) {
1012
+ const tag = reader.uint32();
1013
+ switch (tag >>> 3) {
1014
+ case 1: {
1015
+ if (tag !== 10) {
1016
+ break;
1017
+ }
1018
+
1019
+ message.user = reader.string();
1020
+ continue;
1021
+ }
1022
+ }
1023
+ if ((tag & 7) === 4 || tag === 0) {
1024
+ break;
1025
+ }
1026
+ reader.skip(tag & 7);
1027
+ }
1028
+ return message;
1029
+ },
1030
+
1031
+ fromJSON(object: any): Principal {
1032
+ return { user: isSet(object.user) ? globalThis.String(object.user) : "" };
1033
+ },
1034
+
1035
+ toJSON(message: Principal): unknown {
1036
+ const obj: any = {};
1037
+ if (message.user !== "") {
1038
+ obj.user = message.user;
1039
+ }
1040
+ return obj;
1041
+ },
1042
+
1043
+ create(base?: DeepPartial<Principal>): Principal {
1044
+ return Principal.fromPartial(base ?? {});
1045
+ },
1046
+ fromPartial(object: DeepPartial<Principal>): Principal {
1047
+ const message = createBasePrincipal();
1048
+ message.user = object.user ?? "";
1049
+ return message;
1050
+ },
1051
+ };
1052
+
1053
+ function bytesFromBase64(b64: string): Uint8Array {
1054
+ if ((globalThis as any).Buffer) {
1055
+ return Uint8Array.from((globalThis as any).Buffer.from(b64, "base64"));
1056
+ } else {
1057
+ const bin = globalThis.atob(b64);
1058
+ const arr = new Uint8Array(bin.length);
1059
+ for (let i = 0; i < bin.length; ++i) {
1060
+ arr[i] = bin.charCodeAt(i);
1061
+ }
1062
+ return arr;
1063
+ }
1064
+ }
1065
+
1066
+ function base64FromBytes(arr: Uint8Array): string {
1067
+ if ((globalThis as any).Buffer) {
1068
+ return (globalThis as any).Buffer.from(arr).toString("base64");
1069
+ } else {
1070
+ const bin: string[] = [];
1071
+ arr.forEach((byte) => {
1072
+ bin.push(globalThis.String.fromCharCode(byte));
1073
+ });
1074
+ return globalThis.btoa(bin.join(""));
1075
+ }
1076
+ }
1077
+
1078
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
1079
+
1080
+ export type DeepPartial<T> = T extends Builtin ? T
1081
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1082
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1083
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1084
+ : Partial<T>;
1085
+
1086
+ function isSet(value: any): boolean {
1087
+ return value !== null && value !== undefined;
1088
+ }
1089
+
1090
+ export interface MessageFns<T> {
1091
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1092
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1093
+ fromJSON(object: any): T;
1094
+ toJSON(message: T): unknown;
1095
+ create(base?: DeepPartial<T>): T;
1096
+ fromPartial(object: DeepPartial<T>): T;
1097
+ }