@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,770 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.19.1
|
|
5
|
+
// source: common.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "kronosdb";
|
|
11
|
+
|
|
12
|
+
/** Keys for processing instructions. */
|
|
13
|
+
export enum ProcessingKey {
|
|
14
|
+
/** ROUTING_KEY - Use the attached value for consistent routing (sticky sessions). */
|
|
15
|
+
ROUTING_KEY = 0,
|
|
16
|
+
/** PRIORITY - Relative priority of this message. */
|
|
17
|
+
PRIORITY = 1,
|
|
18
|
+
/** TIMEOUT - Message validity timeout in milliseconds. */
|
|
19
|
+
TIMEOUT = 2,
|
|
20
|
+
/** NR_OF_RESULTS - Maximum number of results expected. -1 for unlimited. */
|
|
21
|
+
NR_OF_RESULTS = 3,
|
|
22
|
+
UNRECOGNIZED = -1,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function processingKeyFromJSON(object: any): ProcessingKey {
|
|
26
|
+
switch (object) {
|
|
27
|
+
case 0:
|
|
28
|
+
case "ROUTING_KEY":
|
|
29
|
+
return ProcessingKey.ROUTING_KEY;
|
|
30
|
+
case 1:
|
|
31
|
+
case "PRIORITY":
|
|
32
|
+
return ProcessingKey.PRIORITY;
|
|
33
|
+
case 2:
|
|
34
|
+
case "TIMEOUT":
|
|
35
|
+
return ProcessingKey.TIMEOUT;
|
|
36
|
+
case 3:
|
|
37
|
+
case "NR_OF_RESULTS":
|
|
38
|
+
return ProcessingKey.NR_OF_RESULTS;
|
|
39
|
+
case -1:
|
|
40
|
+
case "UNRECOGNIZED":
|
|
41
|
+
default:
|
|
42
|
+
return ProcessingKey.UNRECOGNIZED;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function processingKeyToJSON(object: ProcessingKey): string {
|
|
47
|
+
switch (object) {
|
|
48
|
+
case ProcessingKey.ROUTING_KEY:
|
|
49
|
+
return "ROUTING_KEY";
|
|
50
|
+
case ProcessingKey.PRIORITY:
|
|
51
|
+
return "PRIORITY";
|
|
52
|
+
case ProcessingKey.TIMEOUT:
|
|
53
|
+
return "TIMEOUT";
|
|
54
|
+
case ProcessingKey.NR_OF_RESULTS:
|
|
55
|
+
return "NR_OF_RESULTS";
|
|
56
|
+
case ProcessingKey.UNRECOGNIZED:
|
|
57
|
+
default:
|
|
58
|
+
return "UNRECOGNIZED";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A serialized object with type information. */
|
|
63
|
+
export interface SerializedObject {
|
|
64
|
+
/** The type identifier of the serialized object. */
|
|
65
|
+
type: string;
|
|
66
|
+
/** The revision of the serialized form. */
|
|
67
|
+
revision: string;
|
|
68
|
+
/** The serialized data. */
|
|
69
|
+
data: Uint8Array;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A metadata value, supporting multiple types. */
|
|
73
|
+
export interface MetadataValue {
|
|
74
|
+
textValue?: string | undefined;
|
|
75
|
+
numberValue?: bigint | undefined;
|
|
76
|
+
booleanValue?: boolean | undefined;
|
|
77
|
+
doubleValue?: number | undefined;
|
|
78
|
+
bytesValue?: SerializedObject | undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** An instruction for routing or processing a message. */
|
|
82
|
+
export interface ProcessingInstruction {
|
|
83
|
+
key: ProcessingKey;
|
|
84
|
+
value: MetadataValue | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Details of an error. */
|
|
88
|
+
export interface ErrorMessage {
|
|
89
|
+
message: string;
|
|
90
|
+
location: string;
|
|
91
|
+
details: string[];
|
|
92
|
+
errorCode: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Flow control: grant permits for the server to send more messages. */
|
|
96
|
+
export interface FlowControl {
|
|
97
|
+
clientId: string;
|
|
98
|
+
permits: bigint;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Acknowledgement of an instruction. */
|
|
102
|
+
export interface InstructionAck {
|
|
103
|
+
instructionId: string;
|
|
104
|
+
success: boolean;
|
|
105
|
+
error: ErrorMessage | undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function createBaseSerializedObject(): SerializedObject {
|
|
109
|
+
return { type: "", revision: "", data: new Uint8Array(0) };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const SerializedObject: MessageFns<SerializedObject> = {
|
|
113
|
+
encode(message: SerializedObject, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
114
|
+
if (message.type !== "") {
|
|
115
|
+
writer.uint32(10).string(message.type);
|
|
116
|
+
}
|
|
117
|
+
if (message.revision !== "") {
|
|
118
|
+
writer.uint32(18).string(message.revision);
|
|
119
|
+
}
|
|
120
|
+
if (message.data.length !== 0) {
|
|
121
|
+
writer.uint32(26).bytes(message.data);
|
|
122
|
+
}
|
|
123
|
+
return writer;
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SerializedObject {
|
|
127
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
128
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
129
|
+
const message = createBaseSerializedObject();
|
|
130
|
+
while (reader.pos < end) {
|
|
131
|
+
const tag = reader.uint32();
|
|
132
|
+
switch (tag >>> 3) {
|
|
133
|
+
case 1: {
|
|
134
|
+
if (tag !== 10) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
message.type = reader.string();
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
case 2: {
|
|
142
|
+
if (tag !== 18) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
message.revision = reader.string();
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
case 3: {
|
|
150
|
+
if (tag !== 26) {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
message.data = reader.bytes();
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
reader.skip(tag & 7);
|
|
162
|
+
}
|
|
163
|
+
return message;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
fromJSON(object: any): SerializedObject {
|
|
167
|
+
return {
|
|
168
|
+
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
|
169
|
+
revision: isSet(object.revision) ? globalThis.String(object.revision) : "",
|
|
170
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
toJSON(message: SerializedObject): unknown {
|
|
175
|
+
const obj: any = {};
|
|
176
|
+
if (message.type !== "") {
|
|
177
|
+
obj.type = message.type;
|
|
178
|
+
}
|
|
179
|
+
if (message.revision !== "") {
|
|
180
|
+
obj.revision = message.revision;
|
|
181
|
+
}
|
|
182
|
+
if (message.data.length !== 0) {
|
|
183
|
+
obj.data = base64FromBytes(message.data);
|
|
184
|
+
}
|
|
185
|
+
return obj;
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
create(base?: DeepPartial<SerializedObject>): SerializedObject {
|
|
189
|
+
return SerializedObject.fromPartial(base ?? {});
|
|
190
|
+
},
|
|
191
|
+
fromPartial(object: DeepPartial<SerializedObject>): SerializedObject {
|
|
192
|
+
const message = createBaseSerializedObject();
|
|
193
|
+
message.type = object.type ?? "";
|
|
194
|
+
message.revision = object.revision ?? "";
|
|
195
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
196
|
+
return message;
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
function createBaseMetadataValue(): MetadataValue {
|
|
201
|
+
return {
|
|
202
|
+
textValue: undefined,
|
|
203
|
+
numberValue: undefined,
|
|
204
|
+
booleanValue: undefined,
|
|
205
|
+
doubleValue: undefined,
|
|
206
|
+
bytesValue: undefined,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const MetadataValue: MessageFns<MetadataValue> = {
|
|
211
|
+
encode(message: MetadataValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
212
|
+
if (message.textValue !== undefined) {
|
|
213
|
+
writer.uint32(10).string(message.textValue);
|
|
214
|
+
}
|
|
215
|
+
if (message.numberValue !== undefined) {
|
|
216
|
+
if (BigInt.asIntN(64, message.numberValue) !== message.numberValue) {
|
|
217
|
+
throw new globalThis.Error("value provided for field message.numberValue of type sint64 too large");
|
|
218
|
+
}
|
|
219
|
+
writer.uint32(16).sint64(message.numberValue);
|
|
220
|
+
}
|
|
221
|
+
if (message.booleanValue !== undefined) {
|
|
222
|
+
writer.uint32(24).bool(message.booleanValue);
|
|
223
|
+
}
|
|
224
|
+
if (message.doubleValue !== undefined) {
|
|
225
|
+
writer.uint32(33).double(message.doubleValue);
|
|
226
|
+
}
|
|
227
|
+
if (message.bytesValue !== undefined) {
|
|
228
|
+
SerializedObject.encode(message.bytesValue, writer.uint32(42).fork()).join();
|
|
229
|
+
}
|
|
230
|
+
return writer;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetadataValue {
|
|
234
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
235
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
236
|
+
const message = createBaseMetadataValue();
|
|
237
|
+
while (reader.pos < end) {
|
|
238
|
+
const tag = reader.uint32();
|
|
239
|
+
switch (tag >>> 3) {
|
|
240
|
+
case 1: {
|
|
241
|
+
if (tag !== 10) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
message.textValue = reader.string();
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
case 2: {
|
|
249
|
+
if (tag !== 16) {
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
message.numberValue = reader.sint64() as bigint;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
case 3: {
|
|
257
|
+
if (tag !== 24) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
message.booleanValue = reader.bool();
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
case 4: {
|
|
265
|
+
if (tag !== 33) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
message.doubleValue = reader.double();
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
case 5: {
|
|
273
|
+
if (tag !== 42) {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
message.bytesValue = SerializedObject.decode(reader, reader.uint32());
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
reader.skip(tag & 7);
|
|
285
|
+
}
|
|
286
|
+
return message;
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
fromJSON(object: any): MetadataValue {
|
|
290
|
+
return {
|
|
291
|
+
textValue: isSet(object.textValue)
|
|
292
|
+
? globalThis.String(object.textValue)
|
|
293
|
+
: isSet(object.text_value)
|
|
294
|
+
? globalThis.String(object.text_value)
|
|
295
|
+
: undefined,
|
|
296
|
+
numberValue: isSet(object.numberValue)
|
|
297
|
+
? BigInt(object.numberValue)
|
|
298
|
+
: isSet(object.number_value)
|
|
299
|
+
? BigInt(object.number_value)
|
|
300
|
+
: undefined,
|
|
301
|
+
booleanValue: isSet(object.booleanValue)
|
|
302
|
+
? globalThis.Boolean(object.booleanValue)
|
|
303
|
+
: isSet(object.boolean_value)
|
|
304
|
+
? globalThis.Boolean(object.boolean_value)
|
|
305
|
+
: undefined,
|
|
306
|
+
doubleValue: isSet(object.doubleValue)
|
|
307
|
+
? globalThis.Number(object.doubleValue)
|
|
308
|
+
: isSet(object.double_value)
|
|
309
|
+
? globalThis.Number(object.double_value)
|
|
310
|
+
: undefined,
|
|
311
|
+
bytesValue: isSet(object.bytesValue)
|
|
312
|
+
? SerializedObject.fromJSON(object.bytesValue)
|
|
313
|
+
: isSet(object.bytes_value)
|
|
314
|
+
? SerializedObject.fromJSON(object.bytes_value)
|
|
315
|
+
: undefined,
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
toJSON(message: MetadataValue): unknown {
|
|
320
|
+
const obj: any = {};
|
|
321
|
+
if (message.textValue !== undefined) {
|
|
322
|
+
obj.textValue = message.textValue;
|
|
323
|
+
}
|
|
324
|
+
if (message.numberValue !== undefined) {
|
|
325
|
+
obj.numberValue = message.numberValue.toString();
|
|
326
|
+
}
|
|
327
|
+
if (message.booleanValue !== undefined) {
|
|
328
|
+
obj.booleanValue = message.booleanValue;
|
|
329
|
+
}
|
|
330
|
+
if (message.doubleValue !== undefined) {
|
|
331
|
+
obj.doubleValue = message.doubleValue;
|
|
332
|
+
}
|
|
333
|
+
if (message.bytesValue !== undefined) {
|
|
334
|
+
obj.bytesValue = SerializedObject.toJSON(message.bytesValue);
|
|
335
|
+
}
|
|
336
|
+
return obj;
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
create(base?: DeepPartial<MetadataValue>): MetadataValue {
|
|
340
|
+
return MetadataValue.fromPartial(base ?? {});
|
|
341
|
+
},
|
|
342
|
+
fromPartial(object: DeepPartial<MetadataValue>): MetadataValue {
|
|
343
|
+
const message = createBaseMetadataValue();
|
|
344
|
+
message.textValue = object.textValue ?? undefined;
|
|
345
|
+
message.numberValue = object.numberValue ?? undefined;
|
|
346
|
+
message.booleanValue = object.booleanValue ?? undefined;
|
|
347
|
+
message.doubleValue = object.doubleValue ?? undefined;
|
|
348
|
+
message.bytesValue = (object.bytesValue !== undefined && object.bytesValue !== null)
|
|
349
|
+
? SerializedObject.fromPartial(object.bytesValue)
|
|
350
|
+
: undefined;
|
|
351
|
+
return message;
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
function createBaseProcessingInstruction(): ProcessingInstruction {
|
|
356
|
+
return { key: 0, value: undefined };
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export const ProcessingInstruction: MessageFns<ProcessingInstruction> = {
|
|
360
|
+
encode(message: ProcessingInstruction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
361
|
+
if (message.key !== 0) {
|
|
362
|
+
writer.uint32(8).int32(message.key);
|
|
363
|
+
}
|
|
364
|
+
if (message.value !== undefined) {
|
|
365
|
+
MetadataValue.encode(message.value, writer.uint32(18).fork()).join();
|
|
366
|
+
}
|
|
367
|
+
return writer;
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ProcessingInstruction {
|
|
371
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
372
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
373
|
+
const message = createBaseProcessingInstruction();
|
|
374
|
+
while (reader.pos < end) {
|
|
375
|
+
const tag = reader.uint32();
|
|
376
|
+
switch (tag >>> 3) {
|
|
377
|
+
case 1: {
|
|
378
|
+
if (tag !== 8) {
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
message.key = reader.int32() as any;
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
case 2: {
|
|
386
|
+
if (tag !== 18) {
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
message.value = MetadataValue.decode(reader, reader.uint32());
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
reader.skip(tag & 7);
|
|
398
|
+
}
|
|
399
|
+
return message;
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
fromJSON(object: any): ProcessingInstruction {
|
|
403
|
+
return {
|
|
404
|
+
key: isSet(object.key) ? processingKeyFromJSON(object.key) : 0,
|
|
405
|
+
value: isSet(object.value) ? MetadataValue.fromJSON(object.value) : undefined,
|
|
406
|
+
};
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
toJSON(message: ProcessingInstruction): unknown {
|
|
410
|
+
const obj: any = {};
|
|
411
|
+
if (message.key !== 0) {
|
|
412
|
+
obj.key = processingKeyToJSON(message.key);
|
|
413
|
+
}
|
|
414
|
+
if (message.value !== undefined) {
|
|
415
|
+
obj.value = MetadataValue.toJSON(message.value);
|
|
416
|
+
}
|
|
417
|
+
return obj;
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
create(base?: DeepPartial<ProcessingInstruction>): ProcessingInstruction {
|
|
421
|
+
return ProcessingInstruction.fromPartial(base ?? {});
|
|
422
|
+
},
|
|
423
|
+
fromPartial(object: DeepPartial<ProcessingInstruction>): ProcessingInstruction {
|
|
424
|
+
const message = createBaseProcessingInstruction();
|
|
425
|
+
message.key = object.key ?? 0;
|
|
426
|
+
message.value = (object.value !== undefined && object.value !== null)
|
|
427
|
+
? MetadataValue.fromPartial(object.value)
|
|
428
|
+
: undefined;
|
|
429
|
+
return message;
|
|
430
|
+
},
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
function createBaseErrorMessage(): ErrorMessage {
|
|
434
|
+
return { message: "", location: "", details: [], errorCode: "" };
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export const ErrorMessage: MessageFns<ErrorMessage> = {
|
|
438
|
+
encode(message: ErrorMessage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
439
|
+
if (message.message !== "") {
|
|
440
|
+
writer.uint32(10).string(message.message);
|
|
441
|
+
}
|
|
442
|
+
if (message.location !== "") {
|
|
443
|
+
writer.uint32(18).string(message.location);
|
|
444
|
+
}
|
|
445
|
+
for (const v of message.details) {
|
|
446
|
+
writer.uint32(26).string(v!);
|
|
447
|
+
}
|
|
448
|
+
if (message.errorCode !== "") {
|
|
449
|
+
writer.uint32(34).string(message.errorCode);
|
|
450
|
+
}
|
|
451
|
+
return writer;
|
|
452
|
+
},
|
|
453
|
+
|
|
454
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ErrorMessage {
|
|
455
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
456
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
457
|
+
const message = createBaseErrorMessage();
|
|
458
|
+
while (reader.pos < end) {
|
|
459
|
+
const tag = reader.uint32();
|
|
460
|
+
switch (tag >>> 3) {
|
|
461
|
+
case 1: {
|
|
462
|
+
if (tag !== 10) {
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
message.message = reader.string();
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
case 2: {
|
|
470
|
+
if (tag !== 18) {
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
message.location = reader.string();
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
case 3: {
|
|
478
|
+
if (tag !== 26) {
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
message.details.push(reader.string());
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
case 4: {
|
|
486
|
+
if (tag !== 34) {
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
message.errorCode = reader.string();
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
reader.skip(tag & 7);
|
|
498
|
+
}
|
|
499
|
+
return message;
|
|
500
|
+
},
|
|
501
|
+
|
|
502
|
+
fromJSON(object: any): ErrorMessage {
|
|
503
|
+
return {
|
|
504
|
+
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
505
|
+
location: isSet(object.location) ? globalThis.String(object.location) : "",
|
|
506
|
+
details: globalThis.Array.isArray(object?.details) ? object.details.map((e: any) => globalThis.String(e)) : [],
|
|
507
|
+
errorCode: isSet(object.errorCode)
|
|
508
|
+
? globalThis.String(object.errorCode)
|
|
509
|
+
: isSet(object.error_code)
|
|
510
|
+
? globalThis.String(object.error_code)
|
|
511
|
+
: "",
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
toJSON(message: ErrorMessage): unknown {
|
|
516
|
+
const obj: any = {};
|
|
517
|
+
if (message.message !== "") {
|
|
518
|
+
obj.message = message.message;
|
|
519
|
+
}
|
|
520
|
+
if (message.location !== "") {
|
|
521
|
+
obj.location = message.location;
|
|
522
|
+
}
|
|
523
|
+
if (message.details?.length) {
|
|
524
|
+
obj.details = message.details;
|
|
525
|
+
}
|
|
526
|
+
if (message.errorCode !== "") {
|
|
527
|
+
obj.errorCode = message.errorCode;
|
|
528
|
+
}
|
|
529
|
+
return obj;
|
|
530
|
+
},
|
|
531
|
+
|
|
532
|
+
create(base?: DeepPartial<ErrorMessage>): ErrorMessage {
|
|
533
|
+
return ErrorMessage.fromPartial(base ?? {});
|
|
534
|
+
},
|
|
535
|
+
fromPartial(object: DeepPartial<ErrorMessage>): ErrorMessage {
|
|
536
|
+
const message = createBaseErrorMessage();
|
|
537
|
+
message.message = object.message ?? "";
|
|
538
|
+
message.location = object.location ?? "";
|
|
539
|
+
message.details = object.details?.map((e) => e) || [];
|
|
540
|
+
message.errorCode = object.errorCode ?? "";
|
|
541
|
+
return message;
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
function createBaseFlowControl(): FlowControl {
|
|
546
|
+
return { clientId: "", permits: 0n };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export const FlowControl: MessageFns<FlowControl> = {
|
|
550
|
+
encode(message: FlowControl, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
551
|
+
if (message.clientId !== "") {
|
|
552
|
+
writer.uint32(10).string(message.clientId);
|
|
553
|
+
}
|
|
554
|
+
if (message.permits !== 0n) {
|
|
555
|
+
if (BigInt.asIntN(64, message.permits) !== message.permits) {
|
|
556
|
+
throw new globalThis.Error("value provided for field message.permits of type int64 too large");
|
|
557
|
+
}
|
|
558
|
+
writer.uint32(16).int64(message.permits);
|
|
559
|
+
}
|
|
560
|
+
return writer;
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
decode(input: BinaryReader | Uint8Array, length?: number): FlowControl {
|
|
564
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
565
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
566
|
+
const message = createBaseFlowControl();
|
|
567
|
+
while (reader.pos < end) {
|
|
568
|
+
const tag = reader.uint32();
|
|
569
|
+
switch (tag >>> 3) {
|
|
570
|
+
case 1: {
|
|
571
|
+
if (tag !== 10) {
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
message.clientId = reader.string();
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
case 2: {
|
|
579
|
+
if (tag !== 16) {
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
message.permits = reader.int64() as bigint;
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
reader.skip(tag & 7);
|
|
591
|
+
}
|
|
592
|
+
return message;
|
|
593
|
+
},
|
|
594
|
+
|
|
595
|
+
fromJSON(object: any): FlowControl {
|
|
596
|
+
return {
|
|
597
|
+
clientId: isSet(object.clientId)
|
|
598
|
+
? globalThis.String(object.clientId)
|
|
599
|
+
: isSet(object.client_id)
|
|
600
|
+
? globalThis.String(object.client_id)
|
|
601
|
+
: "",
|
|
602
|
+
permits: isSet(object.permits) ? BigInt(object.permits) : 0n,
|
|
603
|
+
};
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
toJSON(message: FlowControl): unknown {
|
|
607
|
+
const obj: any = {};
|
|
608
|
+
if (message.clientId !== "") {
|
|
609
|
+
obj.clientId = message.clientId;
|
|
610
|
+
}
|
|
611
|
+
if (message.permits !== 0n) {
|
|
612
|
+
obj.permits = message.permits.toString();
|
|
613
|
+
}
|
|
614
|
+
return obj;
|
|
615
|
+
},
|
|
616
|
+
|
|
617
|
+
create(base?: DeepPartial<FlowControl>): FlowControl {
|
|
618
|
+
return FlowControl.fromPartial(base ?? {});
|
|
619
|
+
},
|
|
620
|
+
fromPartial(object: DeepPartial<FlowControl>): FlowControl {
|
|
621
|
+
const message = createBaseFlowControl();
|
|
622
|
+
message.clientId = object.clientId ?? "";
|
|
623
|
+
message.permits = object.permits ?? 0n;
|
|
624
|
+
return message;
|
|
625
|
+
},
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
function createBaseInstructionAck(): InstructionAck {
|
|
629
|
+
return { instructionId: "", success: false, error: undefined };
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export const InstructionAck: MessageFns<InstructionAck> = {
|
|
633
|
+
encode(message: InstructionAck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
634
|
+
if (message.instructionId !== "") {
|
|
635
|
+
writer.uint32(10).string(message.instructionId);
|
|
636
|
+
}
|
|
637
|
+
if (message.success !== false) {
|
|
638
|
+
writer.uint32(16).bool(message.success);
|
|
639
|
+
}
|
|
640
|
+
if (message.error !== undefined) {
|
|
641
|
+
ErrorMessage.encode(message.error, writer.uint32(26).fork()).join();
|
|
642
|
+
}
|
|
643
|
+
return writer;
|
|
644
|
+
},
|
|
645
|
+
|
|
646
|
+
decode(input: BinaryReader | Uint8Array, length?: number): InstructionAck {
|
|
647
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
648
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
649
|
+
const message = createBaseInstructionAck();
|
|
650
|
+
while (reader.pos < end) {
|
|
651
|
+
const tag = reader.uint32();
|
|
652
|
+
switch (tag >>> 3) {
|
|
653
|
+
case 1: {
|
|
654
|
+
if (tag !== 10) {
|
|
655
|
+
break;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
message.instructionId = reader.string();
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
case 2: {
|
|
662
|
+
if (tag !== 16) {
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
message.success = reader.bool();
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
case 3: {
|
|
670
|
+
if (tag !== 26) {
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
message.error = ErrorMessage.decode(reader, reader.uint32());
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
reader.skip(tag & 7);
|
|
682
|
+
}
|
|
683
|
+
return message;
|
|
684
|
+
},
|
|
685
|
+
|
|
686
|
+
fromJSON(object: any): InstructionAck {
|
|
687
|
+
return {
|
|
688
|
+
instructionId: isSet(object.instructionId)
|
|
689
|
+
? globalThis.String(object.instructionId)
|
|
690
|
+
: isSet(object.instruction_id)
|
|
691
|
+
? globalThis.String(object.instruction_id)
|
|
692
|
+
: "",
|
|
693
|
+
success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
|
|
694
|
+
error: isSet(object.error) ? ErrorMessage.fromJSON(object.error) : undefined,
|
|
695
|
+
};
|
|
696
|
+
},
|
|
697
|
+
|
|
698
|
+
toJSON(message: InstructionAck): unknown {
|
|
699
|
+
const obj: any = {};
|
|
700
|
+
if (message.instructionId !== "") {
|
|
701
|
+
obj.instructionId = message.instructionId;
|
|
702
|
+
}
|
|
703
|
+
if (message.success !== false) {
|
|
704
|
+
obj.success = message.success;
|
|
705
|
+
}
|
|
706
|
+
if (message.error !== undefined) {
|
|
707
|
+
obj.error = ErrorMessage.toJSON(message.error);
|
|
708
|
+
}
|
|
709
|
+
return obj;
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
create(base?: DeepPartial<InstructionAck>): InstructionAck {
|
|
713
|
+
return InstructionAck.fromPartial(base ?? {});
|
|
714
|
+
},
|
|
715
|
+
fromPartial(object: DeepPartial<InstructionAck>): InstructionAck {
|
|
716
|
+
const message = createBaseInstructionAck();
|
|
717
|
+
message.instructionId = object.instructionId ?? "";
|
|
718
|
+
message.success = object.success ?? false;
|
|
719
|
+
message.error = (object.error !== undefined && object.error !== null)
|
|
720
|
+
? ErrorMessage.fromPartial(object.error)
|
|
721
|
+
: undefined;
|
|
722
|
+
return message;
|
|
723
|
+
},
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
function bytesFromBase64(b64: string): Uint8Array {
|
|
727
|
+
if ((globalThis as any).Buffer) {
|
|
728
|
+
return Uint8Array.from((globalThis as any).Buffer.from(b64, "base64"));
|
|
729
|
+
} else {
|
|
730
|
+
const bin = globalThis.atob(b64);
|
|
731
|
+
const arr = new Uint8Array(bin.length);
|
|
732
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
733
|
+
arr[i] = bin.charCodeAt(i);
|
|
734
|
+
}
|
|
735
|
+
return arr;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function base64FromBytes(arr: Uint8Array): string {
|
|
740
|
+
if ((globalThis as any).Buffer) {
|
|
741
|
+
return (globalThis as any).Buffer.from(arr).toString("base64");
|
|
742
|
+
} else {
|
|
743
|
+
const bin: string[] = [];
|
|
744
|
+
arr.forEach((byte) => {
|
|
745
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
746
|
+
});
|
|
747
|
+
return globalThis.btoa(bin.join(""));
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
752
|
+
|
|
753
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
754
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
755
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
756
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
757
|
+
: Partial<T>;
|
|
758
|
+
|
|
759
|
+
function isSet(value: any): boolean {
|
|
760
|
+
return value !== null && value !== undefined;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export interface MessageFns<T> {
|
|
764
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
765
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
766
|
+
fromJSON(object: any): T;
|
|
767
|
+
toJSON(message: T): unknown;
|
|
768
|
+
create(base?: DeepPartial<T>): T;
|
|
769
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
770
|
+
}
|