@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,1231 @@
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: command.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+ import {
11
+ ErrorMessage,
12
+ FlowControl,
13
+ InstructionAck,
14
+ MetaDataValue,
15
+ ProcessingInstruction,
16
+ SerializedObject,
17
+ } from "./common.js";
18
+
19
+ export const protobufPackage = "io.axoniq.axonserver.grpc.command";
20
+
21
+ /** An instruction from the components that provides the Command Handler towards AxonServer. */
22
+ export interface CommandProviderOutbound {
23
+ /** Instruction to subscribe this component as handler of a specific type of command */
24
+ subscribe?:
25
+ | CommandSubscription
26
+ | undefined;
27
+ /** Instruction to unsubscribe this component as handler of a specific type of command */
28
+ unsubscribe?:
29
+ | CommandSubscription
30
+ | undefined;
31
+ /** Instruction to increase the number of instructions AxonServer may send to this component */
32
+ flowControl?:
33
+ | FlowControl
34
+ | undefined;
35
+ /** Sends a result of Command processing */
36
+ commandResponse?:
37
+ | CommandResponse
38
+ | undefined;
39
+ /** Acknowledgement of previously sent instruction via inbound stream */
40
+ ack?:
41
+ | InstructionAck
42
+ | undefined;
43
+ /** Instruction identifier. If this identifier is set, this instruction will be acknowledged via inbound stream */
44
+ instructionId: string;
45
+ }
46
+
47
+ /** An instruction or confirmation from AxonServer towards the component that provides the Command Handler */
48
+ export interface CommandProviderInbound {
49
+ /** Acknowledgement of previously sent instruction via outbound stream */
50
+ ack?:
51
+ | InstructionAck
52
+ | undefined;
53
+ /** A command for this component to process */
54
+ command?:
55
+ | Command
56
+ | undefined;
57
+ /** Instruction identifier. If this identifier is set, this instruction will be acknowledged via outbound stream */
58
+ instructionId: string;
59
+ }
60
+
61
+ /** A message representing a Command that needs to be routed to a component capable of handling it */
62
+ export interface Command {
63
+ /** The unique identifier of the Command Message */
64
+ messageIdentifier: string;
65
+ /** The name of the command, used for routing it to a destination capable of handling it */
66
+ name: string;
67
+ /** The time at which the command was dispatched */
68
+ timestamp: bigint;
69
+ /** The payload of the Command, providing details on the instructions for the recipient */
70
+ payload:
71
+ | SerializedObject
72
+ | undefined;
73
+ /** Meta Data entries of the Command Message, providing contextual information to the recipient */
74
+ metaData: { [key: string]: MetaDataValue };
75
+ /** Instructions for AxonServer when routing this Command Message */
76
+ processingInstructions: ProcessingInstruction[];
77
+ /** The unique identifier of the component dispatching this message */
78
+ clientId: string;
79
+ /** The name/type of the component dispatching this message */
80
+ componentName: string;
81
+ }
82
+
83
+ export interface Command_MetaDataEntry {
84
+ key: string;
85
+ value: MetaDataValue | undefined;
86
+ }
87
+
88
+ /** Message representing the result of Command Handler execution */
89
+ export interface CommandResponse {
90
+ /** The unique identifier of the response message */
91
+ messageIdentifier: string;
92
+ /** An error code describing the error, if any */
93
+ errorCode: string;
94
+ /** A detailed description of the error */
95
+ errorMessage:
96
+ | ErrorMessage
97
+ | undefined;
98
+ /** The payload to provide as a result to the dispatcher */
99
+ payload:
100
+ | SerializedObject
101
+ | undefined;
102
+ /** Any meta data entries providing contextual information back to the dispatcher */
103
+ metaData: { [key: string]: MetaDataValue };
104
+ /** Instructions for AxonServer when routing this Command Response Message */
105
+ processingInstructions: ProcessingInstruction[];
106
+ /** The unique identifier of the Command Message for which this is the response */
107
+ requestIdentifier: string;
108
+ }
109
+
110
+ export interface CommandResponse_MetaDataEntry {
111
+ key: string;
112
+ value: MetaDataValue | undefined;
113
+ }
114
+
115
+ /** Message describing a component's capability of handling a command type */
116
+ export interface CommandSubscription {
117
+ /**
118
+ * A unique identifier for this subscription. This identifier is returned in Acknowledgements to allow
119
+ * pipelining of subscription messages
120
+ */
121
+ messageId: string;
122
+ /** The name of the command the component can handle */
123
+ command: string;
124
+ /** The name/type of the component handling the command */
125
+ componentName: string;
126
+ /** The unique identifier of the component instance subscribing */
127
+ clientId: string;
128
+ /**
129
+ * A number that represents the client's relative load capacity compared to other clients.
130
+ * This information is interpreted by Axon Server in relation to the other connected nodes' values.
131
+ * Used to balance the dispatching of commands. If set to 0, Axon Server consider 100 as default value.
132
+ */
133
+ loadFactor: number;
134
+ }
135
+
136
+ function createBaseCommandProviderOutbound(): CommandProviderOutbound {
137
+ return {
138
+ subscribe: undefined,
139
+ unsubscribe: undefined,
140
+ flowControl: undefined,
141
+ commandResponse: undefined,
142
+ ack: undefined,
143
+ instructionId: "",
144
+ };
145
+ }
146
+
147
+ export const CommandProviderOutbound: MessageFns<CommandProviderOutbound> = {
148
+ encode(message: CommandProviderOutbound, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
149
+ if (message.subscribe !== undefined) {
150
+ CommandSubscription.encode(message.subscribe, writer.uint32(10).fork()).join();
151
+ }
152
+ if (message.unsubscribe !== undefined) {
153
+ CommandSubscription.encode(message.unsubscribe, writer.uint32(18).fork()).join();
154
+ }
155
+ if (message.flowControl !== undefined) {
156
+ FlowControl.encode(message.flowControl, writer.uint32(26).fork()).join();
157
+ }
158
+ if (message.commandResponse !== undefined) {
159
+ CommandResponse.encode(message.commandResponse, writer.uint32(34).fork()).join();
160
+ }
161
+ if (message.ack !== undefined) {
162
+ InstructionAck.encode(message.ack, writer.uint32(42).fork()).join();
163
+ }
164
+ if (message.instructionId !== "") {
165
+ writer.uint32(50).string(message.instructionId);
166
+ }
167
+ return writer;
168
+ },
169
+
170
+ decode(input: BinaryReader | Uint8Array, length?: number): CommandProviderOutbound {
171
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
172
+ const end = length === undefined ? reader.len : reader.pos + length;
173
+ const message = createBaseCommandProviderOutbound();
174
+ while (reader.pos < end) {
175
+ const tag = reader.uint32();
176
+ switch (tag >>> 3) {
177
+ case 1: {
178
+ if (tag !== 10) {
179
+ break;
180
+ }
181
+
182
+ message.subscribe = CommandSubscription.decode(reader, reader.uint32());
183
+ continue;
184
+ }
185
+ case 2: {
186
+ if (tag !== 18) {
187
+ break;
188
+ }
189
+
190
+ message.unsubscribe = CommandSubscription.decode(reader, reader.uint32());
191
+ continue;
192
+ }
193
+ case 3: {
194
+ if (tag !== 26) {
195
+ break;
196
+ }
197
+
198
+ message.flowControl = FlowControl.decode(reader, reader.uint32());
199
+ continue;
200
+ }
201
+ case 4: {
202
+ if (tag !== 34) {
203
+ break;
204
+ }
205
+
206
+ message.commandResponse = CommandResponse.decode(reader, reader.uint32());
207
+ continue;
208
+ }
209
+ case 5: {
210
+ if (tag !== 42) {
211
+ break;
212
+ }
213
+
214
+ message.ack = InstructionAck.decode(reader, reader.uint32());
215
+ continue;
216
+ }
217
+ case 6: {
218
+ if (tag !== 50) {
219
+ break;
220
+ }
221
+
222
+ message.instructionId = reader.string();
223
+ continue;
224
+ }
225
+ }
226
+ if ((tag & 7) === 4 || tag === 0) {
227
+ break;
228
+ }
229
+ reader.skip(tag & 7);
230
+ }
231
+ return message;
232
+ },
233
+
234
+ fromJSON(object: any): CommandProviderOutbound {
235
+ return {
236
+ subscribe: isSet(object.subscribe) ? CommandSubscription.fromJSON(object.subscribe) : undefined,
237
+ unsubscribe: isSet(object.unsubscribe) ? CommandSubscription.fromJSON(object.unsubscribe) : undefined,
238
+ flowControl: isSet(object.flowControl)
239
+ ? FlowControl.fromJSON(object.flowControl)
240
+ : isSet(object.flow_control)
241
+ ? FlowControl.fromJSON(object.flow_control)
242
+ : undefined,
243
+ commandResponse: isSet(object.commandResponse)
244
+ ? CommandResponse.fromJSON(object.commandResponse)
245
+ : isSet(object.command_response)
246
+ ? CommandResponse.fromJSON(object.command_response)
247
+ : undefined,
248
+ ack: isSet(object.ack) ? InstructionAck.fromJSON(object.ack) : undefined,
249
+ instructionId: isSet(object.instructionId)
250
+ ? globalThis.String(object.instructionId)
251
+ : isSet(object.instruction_id)
252
+ ? globalThis.String(object.instruction_id)
253
+ : "",
254
+ };
255
+ },
256
+
257
+ toJSON(message: CommandProviderOutbound): unknown {
258
+ const obj: any = {};
259
+ if (message.subscribe !== undefined) {
260
+ obj.subscribe = CommandSubscription.toJSON(message.subscribe);
261
+ }
262
+ if (message.unsubscribe !== undefined) {
263
+ obj.unsubscribe = CommandSubscription.toJSON(message.unsubscribe);
264
+ }
265
+ if (message.flowControl !== undefined) {
266
+ obj.flowControl = FlowControl.toJSON(message.flowControl);
267
+ }
268
+ if (message.commandResponse !== undefined) {
269
+ obj.commandResponse = CommandResponse.toJSON(message.commandResponse);
270
+ }
271
+ if (message.ack !== undefined) {
272
+ obj.ack = InstructionAck.toJSON(message.ack);
273
+ }
274
+ if (message.instructionId !== "") {
275
+ obj.instructionId = message.instructionId;
276
+ }
277
+ return obj;
278
+ },
279
+
280
+ create(base?: DeepPartial<CommandProviderOutbound>): CommandProviderOutbound {
281
+ return CommandProviderOutbound.fromPartial(base ?? {});
282
+ },
283
+ fromPartial(object: DeepPartial<CommandProviderOutbound>): CommandProviderOutbound {
284
+ const message = createBaseCommandProviderOutbound();
285
+ message.subscribe = (object.subscribe !== undefined && object.subscribe !== null)
286
+ ? CommandSubscription.fromPartial(object.subscribe)
287
+ : undefined;
288
+ message.unsubscribe = (object.unsubscribe !== undefined && object.unsubscribe !== null)
289
+ ? CommandSubscription.fromPartial(object.unsubscribe)
290
+ : undefined;
291
+ message.flowControl = (object.flowControl !== undefined && object.flowControl !== null)
292
+ ? FlowControl.fromPartial(object.flowControl)
293
+ : undefined;
294
+ message.commandResponse = (object.commandResponse !== undefined && object.commandResponse !== null)
295
+ ? CommandResponse.fromPartial(object.commandResponse)
296
+ : undefined;
297
+ message.ack = (object.ack !== undefined && object.ack !== null)
298
+ ? InstructionAck.fromPartial(object.ack)
299
+ : undefined;
300
+ message.instructionId = object.instructionId ?? "";
301
+ return message;
302
+ },
303
+ };
304
+
305
+ function createBaseCommandProviderInbound(): CommandProviderInbound {
306
+ return { ack: undefined, command: undefined, instructionId: "" };
307
+ }
308
+
309
+ export const CommandProviderInbound: MessageFns<CommandProviderInbound> = {
310
+ encode(message: CommandProviderInbound, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
311
+ if (message.ack !== undefined) {
312
+ InstructionAck.encode(message.ack, writer.uint32(10).fork()).join();
313
+ }
314
+ if (message.command !== undefined) {
315
+ Command.encode(message.command, writer.uint32(18).fork()).join();
316
+ }
317
+ if (message.instructionId !== "") {
318
+ writer.uint32(26).string(message.instructionId);
319
+ }
320
+ return writer;
321
+ },
322
+
323
+ decode(input: BinaryReader | Uint8Array, length?: number): CommandProviderInbound {
324
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
325
+ const end = length === undefined ? reader.len : reader.pos + length;
326
+ const message = createBaseCommandProviderInbound();
327
+ while (reader.pos < end) {
328
+ const tag = reader.uint32();
329
+ switch (tag >>> 3) {
330
+ case 1: {
331
+ if (tag !== 10) {
332
+ break;
333
+ }
334
+
335
+ message.ack = InstructionAck.decode(reader, reader.uint32());
336
+ continue;
337
+ }
338
+ case 2: {
339
+ if (tag !== 18) {
340
+ break;
341
+ }
342
+
343
+ message.command = Command.decode(reader, reader.uint32());
344
+ continue;
345
+ }
346
+ case 3: {
347
+ if (tag !== 26) {
348
+ break;
349
+ }
350
+
351
+ message.instructionId = reader.string();
352
+ continue;
353
+ }
354
+ }
355
+ if ((tag & 7) === 4 || tag === 0) {
356
+ break;
357
+ }
358
+ reader.skip(tag & 7);
359
+ }
360
+ return message;
361
+ },
362
+
363
+ fromJSON(object: any): CommandProviderInbound {
364
+ return {
365
+ ack: isSet(object.ack) ? InstructionAck.fromJSON(object.ack) : undefined,
366
+ command: isSet(object.command) ? Command.fromJSON(object.command) : undefined,
367
+ instructionId: isSet(object.instructionId)
368
+ ? globalThis.String(object.instructionId)
369
+ : isSet(object.instruction_id)
370
+ ? globalThis.String(object.instruction_id)
371
+ : "",
372
+ };
373
+ },
374
+
375
+ toJSON(message: CommandProviderInbound): unknown {
376
+ const obj: any = {};
377
+ if (message.ack !== undefined) {
378
+ obj.ack = InstructionAck.toJSON(message.ack);
379
+ }
380
+ if (message.command !== undefined) {
381
+ obj.command = Command.toJSON(message.command);
382
+ }
383
+ if (message.instructionId !== "") {
384
+ obj.instructionId = message.instructionId;
385
+ }
386
+ return obj;
387
+ },
388
+
389
+ create(base?: DeepPartial<CommandProviderInbound>): CommandProviderInbound {
390
+ return CommandProviderInbound.fromPartial(base ?? {});
391
+ },
392
+ fromPartial(object: DeepPartial<CommandProviderInbound>): CommandProviderInbound {
393
+ const message = createBaseCommandProviderInbound();
394
+ message.ack = (object.ack !== undefined && object.ack !== null)
395
+ ? InstructionAck.fromPartial(object.ack)
396
+ : undefined;
397
+ message.command = (object.command !== undefined && object.command !== null)
398
+ ? Command.fromPartial(object.command)
399
+ : undefined;
400
+ message.instructionId = object.instructionId ?? "";
401
+ return message;
402
+ },
403
+ };
404
+
405
+ function createBaseCommand(): Command {
406
+ return {
407
+ messageIdentifier: "",
408
+ name: "",
409
+ timestamp: 0n,
410
+ payload: undefined,
411
+ metaData: {},
412
+ processingInstructions: [],
413
+ clientId: "",
414
+ componentName: "",
415
+ };
416
+ }
417
+
418
+ export const Command: MessageFns<Command> = {
419
+ encode(message: Command, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
420
+ if (message.messageIdentifier !== "") {
421
+ writer.uint32(10).string(message.messageIdentifier);
422
+ }
423
+ if (message.name !== "") {
424
+ writer.uint32(18).string(message.name);
425
+ }
426
+ if (message.timestamp !== 0n) {
427
+ if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
428
+ throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
429
+ }
430
+ writer.uint32(24).int64(message.timestamp);
431
+ }
432
+ if (message.payload !== undefined) {
433
+ SerializedObject.encode(message.payload, writer.uint32(34).fork()).join();
434
+ }
435
+ globalThis.Object.entries(message.metaData).forEach(([key, value]: [string, MetaDataValue]) => {
436
+ Command_MetaDataEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
437
+ });
438
+ for (const v of message.processingInstructions) {
439
+ ProcessingInstruction.encode(v!, writer.uint32(50).fork()).join();
440
+ }
441
+ if (message.clientId !== "") {
442
+ writer.uint32(58).string(message.clientId);
443
+ }
444
+ if (message.componentName !== "") {
445
+ writer.uint32(66).string(message.componentName);
446
+ }
447
+ return writer;
448
+ },
449
+
450
+ decode(input: BinaryReader | Uint8Array, length?: number): Command {
451
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
452
+ const end = length === undefined ? reader.len : reader.pos + length;
453
+ const message = createBaseCommand();
454
+ while (reader.pos < end) {
455
+ const tag = reader.uint32();
456
+ switch (tag >>> 3) {
457
+ case 1: {
458
+ if (tag !== 10) {
459
+ break;
460
+ }
461
+
462
+ message.messageIdentifier = reader.string();
463
+ continue;
464
+ }
465
+ case 2: {
466
+ if (tag !== 18) {
467
+ break;
468
+ }
469
+
470
+ message.name = reader.string();
471
+ continue;
472
+ }
473
+ case 3: {
474
+ if (tag !== 24) {
475
+ break;
476
+ }
477
+
478
+ message.timestamp = reader.int64() as bigint;
479
+ continue;
480
+ }
481
+ case 4: {
482
+ if (tag !== 34) {
483
+ break;
484
+ }
485
+
486
+ message.payload = SerializedObject.decode(reader, reader.uint32());
487
+ continue;
488
+ }
489
+ case 5: {
490
+ if (tag !== 42) {
491
+ break;
492
+ }
493
+
494
+ const entry5 = Command_MetaDataEntry.decode(reader, reader.uint32());
495
+ if (entry5.value !== undefined) {
496
+ message.metaData[entry5.key] = entry5.value;
497
+ }
498
+ continue;
499
+ }
500
+ case 6: {
501
+ if (tag !== 50) {
502
+ break;
503
+ }
504
+
505
+ message.processingInstructions.push(ProcessingInstruction.decode(reader, reader.uint32()));
506
+ continue;
507
+ }
508
+ case 7: {
509
+ if (tag !== 58) {
510
+ break;
511
+ }
512
+
513
+ message.clientId = reader.string();
514
+ continue;
515
+ }
516
+ case 8: {
517
+ if (tag !== 66) {
518
+ break;
519
+ }
520
+
521
+ message.componentName = reader.string();
522
+ continue;
523
+ }
524
+ }
525
+ if ((tag & 7) === 4 || tag === 0) {
526
+ break;
527
+ }
528
+ reader.skip(tag & 7);
529
+ }
530
+ return message;
531
+ },
532
+
533
+ fromJSON(object: any): Command {
534
+ return {
535
+ messageIdentifier: isSet(object.messageIdentifier)
536
+ ? globalThis.String(object.messageIdentifier)
537
+ : isSet(object.message_identifier)
538
+ ? globalThis.String(object.message_identifier)
539
+ : "",
540
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
541
+ timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n,
542
+ payload: isSet(object.payload) ? SerializedObject.fromJSON(object.payload) : undefined,
543
+ metaData: isObject(object.metaData)
544
+ ? (globalThis.Object.entries(object.metaData) as [string, any][]).reduce(
545
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
546
+ acc[key] = MetaDataValue.fromJSON(value);
547
+ return acc;
548
+ },
549
+ {},
550
+ )
551
+ : isObject(object.meta_data)
552
+ ? (globalThis.Object.entries(object.meta_data) as [string, any][]).reduce(
553
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
554
+ acc[key] = MetaDataValue.fromJSON(value);
555
+ return acc;
556
+ },
557
+ {},
558
+ )
559
+ : {},
560
+ processingInstructions: globalThis.Array.isArray(object?.processingInstructions)
561
+ ? object.processingInstructions.map((e: any) => ProcessingInstruction.fromJSON(e))
562
+ : globalThis.Array.isArray(object?.processing_instructions)
563
+ ? object.processing_instructions.map((e: any) => ProcessingInstruction.fromJSON(e))
564
+ : [],
565
+ clientId: isSet(object.clientId)
566
+ ? globalThis.String(object.clientId)
567
+ : isSet(object.client_id)
568
+ ? globalThis.String(object.client_id)
569
+ : "",
570
+ componentName: isSet(object.componentName)
571
+ ? globalThis.String(object.componentName)
572
+ : isSet(object.component_name)
573
+ ? globalThis.String(object.component_name)
574
+ : "",
575
+ };
576
+ },
577
+
578
+ toJSON(message: Command): unknown {
579
+ const obj: any = {};
580
+ if (message.messageIdentifier !== "") {
581
+ obj.messageIdentifier = message.messageIdentifier;
582
+ }
583
+ if (message.name !== "") {
584
+ obj.name = message.name;
585
+ }
586
+ if (message.timestamp !== 0n) {
587
+ obj.timestamp = message.timestamp.toString();
588
+ }
589
+ if (message.payload !== undefined) {
590
+ obj.payload = SerializedObject.toJSON(message.payload);
591
+ }
592
+ if (message.metaData) {
593
+ const entries = globalThis.Object.entries(message.metaData) as [string, MetaDataValue][];
594
+ if (entries.length > 0) {
595
+ obj.metaData = {};
596
+ entries.forEach(([k, v]) => {
597
+ obj.metaData[k] = MetaDataValue.toJSON(v);
598
+ });
599
+ }
600
+ }
601
+ if (message.processingInstructions?.length) {
602
+ obj.processingInstructions = message.processingInstructions.map((e) => ProcessingInstruction.toJSON(e));
603
+ }
604
+ if (message.clientId !== "") {
605
+ obj.clientId = message.clientId;
606
+ }
607
+ if (message.componentName !== "") {
608
+ obj.componentName = message.componentName;
609
+ }
610
+ return obj;
611
+ },
612
+
613
+ create(base?: DeepPartial<Command>): Command {
614
+ return Command.fromPartial(base ?? {});
615
+ },
616
+ fromPartial(object: DeepPartial<Command>): Command {
617
+ const message = createBaseCommand();
618
+ message.messageIdentifier = object.messageIdentifier ?? "";
619
+ message.name = object.name ?? "";
620
+ message.timestamp = object.timestamp ?? 0n;
621
+ message.payload = (object.payload !== undefined && object.payload !== null)
622
+ ? SerializedObject.fromPartial(object.payload)
623
+ : undefined;
624
+ message.metaData = (globalThis.Object.entries(object.metaData ?? {}) as [string, MetaDataValue][]).reduce(
625
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, MetaDataValue]) => {
626
+ if (value !== undefined) {
627
+ acc[key] = MetaDataValue.fromPartial(value);
628
+ }
629
+ return acc;
630
+ },
631
+ {},
632
+ );
633
+ message.processingInstructions = object.processingInstructions?.map((e) => ProcessingInstruction.fromPartial(e)) ||
634
+ [];
635
+ message.clientId = object.clientId ?? "";
636
+ message.componentName = object.componentName ?? "";
637
+ return message;
638
+ },
639
+ };
640
+
641
+ function createBaseCommand_MetaDataEntry(): Command_MetaDataEntry {
642
+ return { key: "", value: undefined };
643
+ }
644
+
645
+ export const Command_MetaDataEntry: MessageFns<Command_MetaDataEntry> = {
646
+ encode(message: Command_MetaDataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
647
+ if (message.key !== "") {
648
+ writer.uint32(10).string(message.key);
649
+ }
650
+ if (message.value !== undefined) {
651
+ MetaDataValue.encode(message.value, writer.uint32(18).fork()).join();
652
+ }
653
+ return writer;
654
+ },
655
+
656
+ decode(input: BinaryReader | Uint8Array, length?: number): Command_MetaDataEntry {
657
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
658
+ const end = length === undefined ? reader.len : reader.pos + length;
659
+ const message = createBaseCommand_MetaDataEntry();
660
+ while (reader.pos < end) {
661
+ const tag = reader.uint32();
662
+ switch (tag >>> 3) {
663
+ case 1: {
664
+ if (tag !== 10) {
665
+ break;
666
+ }
667
+
668
+ message.key = reader.string();
669
+ continue;
670
+ }
671
+ case 2: {
672
+ if (tag !== 18) {
673
+ break;
674
+ }
675
+
676
+ message.value = MetaDataValue.decode(reader, reader.uint32());
677
+ continue;
678
+ }
679
+ }
680
+ if ((tag & 7) === 4 || tag === 0) {
681
+ break;
682
+ }
683
+ reader.skip(tag & 7);
684
+ }
685
+ return message;
686
+ },
687
+
688
+ fromJSON(object: any): Command_MetaDataEntry {
689
+ return {
690
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
691
+ value: isSet(object.value) ? MetaDataValue.fromJSON(object.value) : undefined,
692
+ };
693
+ },
694
+
695
+ toJSON(message: Command_MetaDataEntry): unknown {
696
+ const obj: any = {};
697
+ if (message.key !== "") {
698
+ obj.key = message.key;
699
+ }
700
+ if (message.value !== undefined) {
701
+ obj.value = MetaDataValue.toJSON(message.value);
702
+ }
703
+ return obj;
704
+ },
705
+
706
+ create(base?: DeepPartial<Command_MetaDataEntry>): Command_MetaDataEntry {
707
+ return Command_MetaDataEntry.fromPartial(base ?? {});
708
+ },
709
+ fromPartial(object: DeepPartial<Command_MetaDataEntry>): Command_MetaDataEntry {
710
+ const message = createBaseCommand_MetaDataEntry();
711
+ message.key = object.key ?? "";
712
+ message.value = (object.value !== undefined && object.value !== null)
713
+ ? MetaDataValue.fromPartial(object.value)
714
+ : undefined;
715
+ return message;
716
+ },
717
+ };
718
+
719
+ function createBaseCommandResponse(): CommandResponse {
720
+ return {
721
+ messageIdentifier: "",
722
+ errorCode: "",
723
+ errorMessage: undefined,
724
+ payload: undefined,
725
+ metaData: {},
726
+ processingInstructions: [],
727
+ requestIdentifier: "",
728
+ };
729
+ }
730
+
731
+ export const CommandResponse: MessageFns<CommandResponse> = {
732
+ encode(message: CommandResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
733
+ if (message.messageIdentifier !== "") {
734
+ writer.uint32(10).string(message.messageIdentifier);
735
+ }
736
+ if (message.errorCode !== "") {
737
+ writer.uint32(18).string(message.errorCode);
738
+ }
739
+ if (message.errorMessage !== undefined) {
740
+ ErrorMessage.encode(message.errorMessage, writer.uint32(26).fork()).join();
741
+ }
742
+ if (message.payload !== undefined) {
743
+ SerializedObject.encode(message.payload, writer.uint32(34).fork()).join();
744
+ }
745
+ globalThis.Object.entries(message.metaData).forEach(([key, value]: [string, MetaDataValue]) => {
746
+ CommandResponse_MetaDataEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
747
+ });
748
+ for (const v of message.processingInstructions) {
749
+ ProcessingInstruction.encode(v!, writer.uint32(50).fork()).join();
750
+ }
751
+ if (message.requestIdentifier !== "") {
752
+ writer.uint32(58).string(message.requestIdentifier);
753
+ }
754
+ return writer;
755
+ },
756
+
757
+ decode(input: BinaryReader | Uint8Array, length?: number): CommandResponse {
758
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
759
+ const end = length === undefined ? reader.len : reader.pos + length;
760
+ const message = createBaseCommandResponse();
761
+ while (reader.pos < end) {
762
+ const tag = reader.uint32();
763
+ switch (tag >>> 3) {
764
+ case 1: {
765
+ if (tag !== 10) {
766
+ break;
767
+ }
768
+
769
+ message.messageIdentifier = reader.string();
770
+ continue;
771
+ }
772
+ case 2: {
773
+ if (tag !== 18) {
774
+ break;
775
+ }
776
+
777
+ message.errorCode = reader.string();
778
+ continue;
779
+ }
780
+ case 3: {
781
+ if (tag !== 26) {
782
+ break;
783
+ }
784
+
785
+ message.errorMessage = ErrorMessage.decode(reader, reader.uint32());
786
+ continue;
787
+ }
788
+ case 4: {
789
+ if (tag !== 34) {
790
+ break;
791
+ }
792
+
793
+ message.payload = SerializedObject.decode(reader, reader.uint32());
794
+ continue;
795
+ }
796
+ case 5: {
797
+ if (tag !== 42) {
798
+ break;
799
+ }
800
+
801
+ const entry5 = CommandResponse_MetaDataEntry.decode(reader, reader.uint32());
802
+ if (entry5.value !== undefined) {
803
+ message.metaData[entry5.key] = entry5.value;
804
+ }
805
+ continue;
806
+ }
807
+ case 6: {
808
+ if (tag !== 50) {
809
+ break;
810
+ }
811
+
812
+ message.processingInstructions.push(ProcessingInstruction.decode(reader, reader.uint32()));
813
+ continue;
814
+ }
815
+ case 7: {
816
+ if (tag !== 58) {
817
+ break;
818
+ }
819
+
820
+ message.requestIdentifier = reader.string();
821
+ continue;
822
+ }
823
+ }
824
+ if ((tag & 7) === 4 || tag === 0) {
825
+ break;
826
+ }
827
+ reader.skip(tag & 7);
828
+ }
829
+ return message;
830
+ },
831
+
832
+ fromJSON(object: any): CommandResponse {
833
+ return {
834
+ messageIdentifier: isSet(object.messageIdentifier)
835
+ ? globalThis.String(object.messageIdentifier)
836
+ : isSet(object.message_identifier)
837
+ ? globalThis.String(object.message_identifier)
838
+ : "",
839
+ errorCode: isSet(object.errorCode)
840
+ ? globalThis.String(object.errorCode)
841
+ : isSet(object.error_code)
842
+ ? globalThis.String(object.error_code)
843
+ : "",
844
+ errorMessage: isSet(object.errorMessage)
845
+ ? ErrorMessage.fromJSON(object.errorMessage)
846
+ : isSet(object.error_message)
847
+ ? ErrorMessage.fromJSON(object.error_message)
848
+ : undefined,
849
+ payload: isSet(object.payload) ? SerializedObject.fromJSON(object.payload) : undefined,
850
+ metaData: isObject(object.metaData)
851
+ ? (globalThis.Object.entries(object.metaData) as [string, any][]).reduce(
852
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
853
+ acc[key] = MetaDataValue.fromJSON(value);
854
+ return acc;
855
+ },
856
+ {},
857
+ )
858
+ : isObject(object.meta_data)
859
+ ? (globalThis.Object.entries(object.meta_data) as [string, any][]).reduce(
860
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, any]) => {
861
+ acc[key] = MetaDataValue.fromJSON(value);
862
+ return acc;
863
+ },
864
+ {},
865
+ )
866
+ : {},
867
+ processingInstructions: globalThis.Array.isArray(object?.processingInstructions)
868
+ ? object.processingInstructions.map((e: any) => ProcessingInstruction.fromJSON(e))
869
+ : globalThis.Array.isArray(object?.processing_instructions)
870
+ ? object.processing_instructions.map((e: any) => ProcessingInstruction.fromJSON(e))
871
+ : [],
872
+ requestIdentifier: isSet(object.requestIdentifier)
873
+ ? globalThis.String(object.requestIdentifier)
874
+ : isSet(object.request_identifier)
875
+ ? globalThis.String(object.request_identifier)
876
+ : "",
877
+ };
878
+ },
879
+
880
+ toJSON(message: CommandResponse): unknown {
881
+ const obj: any = {};
882
+ if (message.messageIdentifier !== "") {
883
+ obj.messageIdentifier = message.messageIdentifier;
884
+ }
885
+ if (message.errorCode !== "") {
886
+ obj.errorCode = message.errorCode;
887
+ }
888
+ if (message.errorMessage !== undefined) {
889
+ obj.errorMessage = ErrorMessage.toJSON(message.errorMessage);
890
+ }
891
+ if (message.payload !== undefined) {
892
+ obj.payload = SerializedObject.toJSON(message.payload);
893
+ }
894
+ if (message.metaData) {
895
+ const entries = globalThis.Object.entries(message.metaData) as [string, MetaDataValue][];
896
+ if (entries.length > 0) {
897
+ obj.metaData = {};
898
+ entries.forEach(([k, v]) => {
899
+ obj.metaData[k] = MetaDataValue.toJSON(v);
900
+ });
901
+ }
902
+ }
903
+ if (message.processingInstructions?.length) {
904
+ obj.processingInstructions = message.processingInstructions.map((e) => ProcessingInstruction.toJSON(e));
905
+ }
906
+ if (message.requestIdentifier !== "") {
907
+ obj.requestIdentifier = message.requestIdentifier;
908
+ }
909
+ return obj;
910
+ },
911
+
912
+ create(base?: DeepPartial<CommandResponse>): CommandResponse {
913
+ return CommandResponse.fromPartial(base ?? {});
914
+ },
915
+ fromPartial(object: DeepPartial<CommandResponse>): CommandResponse {
916
+ const message = createBaseCommandResponse();
917
+ message.messageIdentifier = object.messageIdentifier ?? "";
918
+ message.errorCode = object.errorCode ?? "";
919
+ message.errorMessage = (object.errorMessage !== undefined && object.errorMessage !== null)
920
+ ? ErrorMessage.fromPartial(object.errorMessage)
921
+ : undefined;
922
+ message.payload = (object.payload !== undefined && object.payload !== null)
923
+ ? SerializedObject.fromPartial(object.payload)
924
+ : undefined;
925
+ message.metaData = (globalThis.Object.entries(object.metaData ?? {}) as [string, MetaDataValue][]).reduce(
926
+ (acc: { [key: string]: MetaDataValue }, [key, value]: [string, MetaDataValue]) => {
927
+ if (value !== undefined) {
928
+ acc[key] = MetaDataValue.fromPartial(value);
929
+ }
930
+ return acc;
931
+ },
932
+ {},
933
+ );
934
+ message.processingInstructions = object.processingInstructions?.map((e) => ProcessingInstruction.fromPartial(e)) ||
935
+ [];
936
+ message.requestIdentifier = object.requestIdentifier ?? "";
937
+ return message;
938
+ },
939
+ };
940
+
941
+ function createBaseCommandResponse_MetaDataEntry(): CommandResponse_MetaDataEntry {
942
+ return { key: "", value: undefined };
943
+ }
944
+
945
+ export const CommandResponse_MetaDataEntry: MessageFns<CommandResponse_MetaDataEntry> = {
946
+ encode(message: CommandResponse_MetaDataEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
947
+ if (message.key !== "") {
948
+ writer.uint32(10).string(message.key);
949
+ }
950
+ if (message.value !== undefined) {
951
+ MetaDataValue.encode(message.value, writer.uint32(18).fork()).join();
952
+ }
953
+ return writer;
954
+ },
955
+
956
+ decode(input: BinaryReader | Uint8Array, length?: number): CommandResponse_MetaDataEntry {
957
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
958
+ const end = length === undefined ? reader.len : reader.pos + length;
959
+ const message = createBaseCommandResponse_MetaDataEntry();
960
+ while (reader.pos < end) {
961
+ const tag = reader.uint32();
962
+ switch (tag >>> 3) {
963
+ case 1: {
964
+ if (tag !== 10) {
965
+ break;
966
+ }
967
+
968
+ message.key = reader.string();
969
+ continue;
970
+ }
971
+ case 2: {
972
+ if (tag !== 18) {
973
+ break;
974
+ }
975
+
976
+ message.value = MetaDataValue.decode(reader, reader.uint32());
977
+ continue;
978
+ }
979
+ }
980
+ if ((tag & 7) === 4 || tag === 0) {
981
+ break;
982
+ }
983
+ reader.skip(tag & 7);
984
+ }
985
+ return message;
986
+ },
987
+
988
+ fromJSON(object: any): CommandResponse_MetaDataEntry {
989
+ return {
990
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
991
+ value: isSet(object.value) ? MetaDataValue.fromJSON(object.value) : undefined,
992
+ };
993
+ },
994
+
995
+ toJSON(message: CommandResponse_MetaDataEntry): unknown {
996
+ const obj: any = {};
997
+ if (message.key !== "") {
998
+ obj.key = message.key;
999
+ }
1000
+ if (message.value !== undefined) {
1001
+ obj.value = MetaDataValue.toJSON(message.value);
1002
+ }
1003
+ return obj;
1004
+ },
1005
+
1006
+ create(base?: DeepPartial<CommandResponse_MetaDataEntry>): CommandResponse_MetaDataEntry {
1007
+ return CommandResponse_MetaDataEntry.fromPartial(base ?? {});
1008
+ },
1009
+ fromPartial(object: DeepPartial<CommandResponse_MetaDataEntry>): CommandResponse_MetaDataEntry {
1010
+ const message = createBaseCommandResponse_MetaDataEntry();
1011
+ message.key = object.key ?? "";
1012
+ message.value = (object.value !== undefined && object.value !== null)
1013
+ ? MetaDataValue.fromPartial(object.value)
1014
+ : undefined;
1015
+ return message;
1016
+ },
1017
+ };
1018
+
1019
+ function createBaseCommandSubscription(): CommandSubscription {
1020
+ return { messageId: "", command: "", componentName: "", clientId: "", loadFactor: 0 };
1021
+ }
1022
+
1023
+ export const CommandSubscription: MessageFns<CommandSubscription> = {
1024
+ encode(message: CommandSubscription, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1025
+ if (message.messageId !== "") {
1026
+ writer.uint32(10).string(message.messageId);
1027
+ }
1028
+ if (message.command !== "") {
1029
+ writer.uint32(18).string(message.command);
1030
+ }
1031
+ if (message.componentName !== "") {
1032
+ writer.uint32(26).string(message.componentName);
1033
+ }
1034
+ if (message.clientId !== "") {
1035
+ writer.uint32(34).string(message.clientId);
1036
+ }
1037
+ if (message.loadFactor !== 0) {
1038
+ writer.uint32(40).int32(message.loadFactor);
1039
+ }
1040
+ return writer;
1041
+ },
1042
+
1043
+ decode(input: BinaryReader | Uint8Array, length?: number): CommandSubscription {
1044
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1045
+ const end = length === undefined ? reader.len : reader.pos + length;
1046
+ const message = createBaseCommandSubscription();
1047
+ while (reader.pos < end) {
1048
+ const tag = reader.uint32();
1049
+ switch (tag >>> 3) {
1050
+ case 1: {
1051
+ if (tag !== 10) {
1052
+ break;
1053
+ }
1054
+
1055
+ message.messageId = reader.string();
1056
+ continue;
1057
+ }
1058
+ case 2: {
1059
+ if (tag !== 18) {
1060
+ break;
1061
+ }
1062
+
1063
+ message.command = reader.string();
1064
+ continue;
1065
+ }
1066
+ case 3: {
1067
+ if (tag !== 26) {
1068
+ break;
1069
+ }
1070
+
1071
+ message.componentName = reader.string();
1072
+ continue;
1073
+ }
1074
+ case 4: {
1075
+ if (tag !== 34) {
1076
+ break;
1077
+ }
1078
+
1079
+ message.clientId = reader.string();
1080
+ continue;
1081
+ }
1082
+ case 5: {
1083
+ if (tag !== 40) {
1084
+ break;
1085
+ }
1086
+
1087
+ message.loadFactor = reader.int32();
1088
+ continue;
1089
+ }
1090
+ }
1091
+ if ((tag & 7) === 4 || tag === 0) {
1092
+ break;
1093
+ }
1094
+ reader.skip(tag & 7);
1095
+ }
1096
+ return message;
1097
+ },
1098
+
1099
+ fromJSON(object: any): CommandSubscription {
1100
+ return {
1101
+ messageId: isSet(object.messageId)
1102
+ ? globalThis.String(object.messageId)
1103
+ : isSet(object.message_id)
1104
+ ? globalThis.String(object.message_id)
1105
+ : "",
1106
+ command: isSet(object.command) ? globalThis.String(object.command) : "",
1107
+ componentName: isSet(object.componentName)
1108
+ ? globalThis.String(object.componentName)
1109
+ : isSet(object.component_name)
1110
+ ? globalThis.String(object.component_name)
1111
+ : "",
1112
+ clientId: isSet(object.clientId)
1113
+ ? globalThis.String(object.clientId)
1114
+ : isSet(object.client_id)
1115
+ ? globalThis.String(object.client_id)
1116
+ : "",
1117
+ loadFactor: isSet(object.loadFactor)
1118
+ ? globalThis.Number(object.loadFactor)
1119
+ : isSet(object.load_factor)
1120
+ ? globalThis.Number(object.load_factor)
1121
+ : 0,
1122
+ };
1123
+ },
1124
+
1125
+ toJSON(message: CommandSubscription): unknown {
1126
+ const obj: any = {};
1127
+ if (message.messageId !== "") {
1128
+ obj.messageId = message.messageId;
1129
+ }
1130
+ if (message.command !== "") {
1131
+ obj.command = message.command;
1132
+ }
1133
+ if (message.componentName !== "") {
1134
+ obj.componentName = message.componentName;
1135
+ }
1136
+ if (message.clientId !== "") {
1137
+ obj.clientId = message.clientId;
1138
+ }
1139
+ if (message.loadFactor !== 0) {
1140
+ obj.loadFactor = Math.round(message.loadFactor);
1141
+ }
1142
+ return obj;
1143
+ },
1144
+
1145
+ create(base?: DeepPartial<CommandSubscription>): CommandSubscription {
1146
+ return CommandSubscription.fromPartial(base ?? {});
1147
+ },
1148
+ fromPartial(object: DeepPartial<CommandSubscription>): CommandSubscription {
1149
+ const message = createBaseCommandSubscription();
1150
+ message.messageId = object.messageId ?? "";
1151
+ message.command = object.command ?? "";
1152
+ message.componentName = object.componentName ?? "";
1153
+ message.clientId = object.clientId ?? "";
1154
+ message.loadFactor = object.loadFactor ?? 0;
1155
+ return message;
1156
+ },
1157
+ };
1158
+
1159
+ /** The CommandService defines the gRPC requests necessary for subscribing command handlers, and dispatching commands. */
1160
+ export type CommandServiceDefinition = typeof CommandServiceDefinition;
1161
+ export const CommandServiceDefinition = {
1162
+ name: "CommandService",
1163
+ fullName: "io.axoniq.axonserver.grpc.command.CommandService",
1164
+ methods: {
1165
+ /** Opens a stream allowing clients to register command handlers and receive commands. */
1166
+ openStream: {
1167
+ name: "OpenStream",
1168
+ requestType: CommandProviderOutbound as typeof CommandProviderOutbound,
1169
+ requestStream: true,
1170
+ responseType: CommandProviderInbound as typeof CommandProviderInbound,
1171
+ responseStream: true,
1172
+ options: {},
1173
+ },
1174
+ /** Dispatches the given command, returning the result of command execution */
1175
+ dispatch: {
1176
+ name: "Dispatch",
1177
+ requestType: Command as typeof Command,
1178
+ requestStream: false,
1179
+ responseType: CommandResponse as typeof CommandResponse,
1180
+ responseStream: false,
1181
+ options: {},
1182
+ },
1183
+ },
1184
+ } as const;
1185
+
1186
+ export interface CommandServiceImplementation<CallContextExt = {}> {
1187
+ /** Opens a stream allowing clients to register command handlers and receive commands. */
1188
+ openStream(
1189
+ request: AsyncIterable<CommandProviderOutbound>,
1190
+ context: CallContext & CallContextExt,
1191
+ ): ServerStreamingMethodResult<DeepPartial<CommandProviderInbound>>;
1192
+ /** Dispatches the given command, returning the result of command execution */
1193
+ dispatch(request: Command, context: CallContext & CallContextExt): Promise<DeepPartial<CommandResponse>>;
1194
+ }
1195
+
1196
+ export interface CommandServiceClient<CallOptionsExt = {}> {
1197
+ /** Opens a stream allowing clients to register command handlers and receive commands. */
1198
+ openStream(
1199
+ request: AsyncIterable<DeepPartial<CommandProviderOutbound>>,
1200
+ options?: CallOptions & CallOptionsExt,
1201
+ ): AsyncIterable<CommandProviderInbound>;
1202
+ /** Dispatches the given command, returning the result of command execution */
1203
+ dispatch(request: DeepPartial<Command>, options?: CallOptions & CallOptionsExt): Promise<CommandResponse>;
1204
+ }
1205
+
1206
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
1207
+
1208
+ export type DeepPartial<T> = T extends Builtin ? T
1209
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1210
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1211
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1212
+ : Partial<T>;
1213
+
1214
+ function isObject(value: any): boolean {
1215
+ return typeof value === "object" && value !== null;
1216
+ }
1217
+
1218
+ function isSet(value: any): boolean {
1219
+ return value !== null && value !== undefined;
1220
+ }
1221
+
1222
+ export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };
1223
+
1224
+ export interface MessageFns<T> {
1225
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1226
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1227
+ fromJSON(object: any): T;
1228
+ toJSON(message: T): unknown;
1229
+ create(base?: DeepPartial<T>): T;
1230
+ fromPartial(object: DeepPartial<T>): T;
1231
+ }