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