@miradorlabs/web-grpc 2.7.0 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miradorlabs/web-grpc",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Generated gRPC (grpc-js) client stubs for the Mirador web gateway.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,496 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/common/v1/attribute_value.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+
10
+ export const protobufPackage = "gateway.common.v1";
11
+
12
+ /**
13
+ * AttributeValue is the gateway-domain copy of the typed attribute value model
14
+ * (mirrors OTLP AnyValue). Domain isolation forbids importing the telemetry copy,
15
+ * so gateways convert at the boundary. Kept byte-for-byte shape-compatible with
16
+ * telemetry.common.v1.AttributeValue.
17
+ */
18
+ export interface AttributeValue {
19
+ stringValue?: string | undefined;
20
+ boolValue?: boolean | undefined;
21
+ intValue?: number | undefined;
22
+ doubleValue?: number | undefined;
23
+ bytesValue?: Uint8Array | undefined;
24
+ arrayValue?: AttributeArray | undefined;
25
+ kvlistValue?: AttributeKeyValueList | undefined;
26
+ }
27
+
28
+ export interface AttributeArray {
29
+ values: AttributeValue[];
30
+ }
31
+
32
+ export interface AttributeKeyValue {
33
+ key: string;
34
+ value: AttributeValue | undefined;
35
+ }
36
+
37
+ export interface AttributeKeyValueList {
38
+ values: AttributeKeyValue[];
39
+ }
40
+
41
+ function createBaseAttributeValue(): AttributeValue {
42
+ return {
43
+ stringValue: undefined,
44
+ boolValue: undefined,
45
+ intValue: undefined,
46
+ doubleValue: undefined,
47
+ bytesValue: undefined,
48
+ arrayValue: undefined,
49
+ kvlistValue: undefined,
50
+ };
51
+ }
52
+
53
+ export const AttributeValue: MessageFns<AttributeValue> = {
54
+ encode(message: AttributeValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
55
+ if (message.stringValue !== undefined) {
56
+ writer.uint32(10).string(message.stringValue);
57
+ }
58
+ if (message.boolValue !== undefined) {
59
+ writer.uint32(16).bool(message.boolValue);
60
+ }
61
+ if (message.intValue !== undefined) {
62
+ writer.uint32(24).int64(message.intValue);
63
+ }
64
+ if (message.doubleValue !== undefined) {
65
+ writer.uint32(33).double(message.doubleValue);
66
+ }
67
+ if (message.bytesValue !== undefined) {
68
+ writer.uint32(42).bytes(message.bytesValue);
69
+ }
70
+ if (message.arrayValue !== undefined) {
71
+ AttributeArray.encode(message.arrayValue, writer.uint32(50).fork()).join();
72
+ }
73
+ if (message.kvlistValue !== undefined) {
74
+ AttributeKeyValueList.encode(message.kvlistValue, writer.uint32(58).fork()).join();
75
+ }
76
+ return writer;
77
+ },
78
+
79
+ decode(input: BinaryReader | Uint8Array, length?: number): AttributeValue {
80
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
81
+ const end = length === undefined ? reader.len : reader.pos + length;
82
+ const message = createBaseAttributeValue();
83
+ while (reader.pos < end) {
84
+ const tag = reader.uint32();
85
+ switch (tag >>> 3) {
86
+ case 1: {
87
+ if (tag !== 10) {
88
+ break;
89
+ }
90
+
91
+ message.stringValue = reader.string();
92
+ continue;
93
+ }
94
+ case 2: {
95
+ if (tag !== 16) {
96
+ break;
97
+ }
98
+
99
+ message.boolValue = reader.bool();
100
+ continue;
101
+ }
102
+ case 3: {
103
+ if (tag !== 24) {
104
+ break;
105
+ }
106
+
107
+ message.intValue = longToNumber(reader.int64());
108
+ continue;
109
+ }
110
+ case 4: {
111
+ if (tag !== 33) {
112
+ break;
113
+ }
114
+
115
+ message.doubleValue = reader.double();
116
+ continue;
117
+ }
118
+ case 5: {
119
+ if (tag !== 42) {
120
+ break;
121
+ }
122
+
123
+ message.bytesValue = reader.bytes();
124
+ continue;
125
+ }
126
+ case 6: {
127
+ if (tag !== 50) {
128
+ break;
129
+ }
130
+
131
+ message.arrayValue = AttributeArray.decode(reader, reader.uint32());
132
+ continue;
133
+ }
134
+ case 7: {
135
+ if (tag !== 58) {
136
+ break;
137
+ }
138
+
139
+ message.kvlistValue = AttributeKeyValueList.decode(reader, reader.uint32());
140
+ continue;
141
+ }
142
+ }
143
+ if ((tag & 7) === 4 || tag === 0) {
144
+ break;
145
+ }
146
+ reader.skip(tag & 7);
147
+ }
148
+ return message;
149
+ },
150
+
151
+ fromJSON(object: any): AttributeValue {
152
+ return {
153
+ stringValue: isSet(object.stringValue)
154
+ ? globalThis.String(object.stringValue)
155
+ : isSet(object.string_value)
156
+ ? globalThis.String(object.string_value)
157
+ : undefined,
158
+ boolValue: isSet(object.boolValue)
159
+ ? globalThis.Boolean(object.boolValue)
160
+ : isSet(object.bool_value)
161
+ ? globalThis.Boolean(object.bool_value)
162
+ : undefined,
163
+ intValue: isSet(object.intValue)
164
+ ? globalThis.Number(object.intValue)
165
+ : isSet(object.int_value)
166
+ ? globalThis.Number(object.int_value)
167
+ : undefined,
168
+ doubleValue: isSet(object.doubleValue)
169
+ ? globalThis.Number(object.doubleValue)
170
+ : isSet(object.double_value)
171
+ ? globalThis.Number(object.double_value)
172
+ : undefined,
173
+ bytesValue: isSet(object.bytesValue)
174
+ ? bytesFromBase64(object.bytesValue)
175
+ : isSet(object.bytes_value)
176
+ ? bytesFromBase64(object.bytes_value)
177
+ : undefined,
178
+ arrayValue: isSet(object.arrayValue)
179
+ ? AttributeArray.fromJSON(object.arrayValue)
180
+ : isSet(object.array_value)
181
+ ? AttributeArray.fromJSON(object.array_value)
182
+ : undefined,
183
+ kvlistValue: isSet(object.kvlistValue)
184
+ ? AttributeKeyValueList.fromJSON(object.kvlistValue)
185
+ : isSet(object.kvlist_value)
186
+ ? AttributeKeyValueList.fromJSON(object.kvlist_value)
187
+ : undefined,
188
+ };
189
+ },
190
+
191
+ toJSON(message: AttributeValue): unknown {
192
+ const obj: any = {};
193
+ if (message.stringValue !== undefined) {
194
+ obj.stringValue = message.stringValue;
195
+ }
196
+ if (message.boolValue !== undefined) {
197
+ obj.boolValue = message.boolValue;
198
+ }
199
+ if (message.intValue !== undefined) {
200
+ obj.intValue = Math.round(message.intValue);
201
+ }
202
+ if (message.doubleValue !== undefined) {
203
+ obj.doubleValue = message.doubleValue;
204
+ }
205
+ if (message.bytesValue !== undefined) {
206
+ obj.bytesValue = base64FromBytes(message.bytesValue);
207
+ }
208
+ if (message.arrayValue !== undefined) {
209
+ obj.arrayValue = AttributeArray.toJSON(message.arrayValue);
210
+ }
211
+ if (message.kvlistValue !== undefined) {
212
+ obj.kvlistValue = AttributeKeyValueList.toJSON(message.kvlistValue);
213
+ }
214
+ return obj;
215
+ },
216
+
217
+ create<I extends Exact<DeepPartial<AttributeValue>, I>>(base?: I): AttributeValue {
218
+ return AttributeValue.fromPartial(base ?? ({} as any));
219
+ },
220
+ fromPartial<I extends Exact<DeepPartial<AttributeValue>, I>>(object: I): AttributeValue {
221
+ const message = createBaseAttributeValue();
222
+ message.stringValue = object.stringValue ?? undefined;
223
+ message.boolValue = object.boolValue ?? undefined;
224
+ message.intValue = object.intValue ?? undefined;
225
+ message.doubleValue = object.doubleValue ?? undefined;
226
+ message.bytesValue = object.bytesValue ?? undefined;
227
+ message.arrayValue = (object.arrayValue !== undefined && object.arrayValue !== null)
228
+ ? AttributeArray.fromPartial(object.arrayValue)
229
+ : undefined;
230
+ message.kvlistValue = (object.kvlistValue !== undefined && object.kvlistValue !== null)
231
+ ? AttributeKeyValueList.fromPartial(object.kvlistValue)
232
+ : undefined;
233
+ return message;
234
+ },
235
+ };
236
+
237
+ function createBaseAttributeArray(): AttributeArray {
238
+ return { values: [] };
239
+ }
240
+
241
+ export const AttributeArray: MessageFns<AttributeArray> = {
242
+ encode(message: AttributeArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
243
+ for (const v of message.values) {
244
+ AttributeValue.encode(v!, writer.uint32(10).fork()).join();
245
+ }
246
+ return writer;
247
+ },
248
+
249
+ decode(input: BinaryReader | Uint8Array, length?: number): AttributeArray {
250
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
251
+ const end = length === undefined ? reader.len : reader.pos + length;
252
+ const message = createBaseAttributeArray();
253
+ while (reader.pos < end) {
254
+ const tag = reader.uint32();
255
+ switch (tag >>> 3) {
256
+ case 1: {
257
+ if (tag !== 10) {
258
+ break;
259
+ }
260
+
261
+ message.values.push(AttributeValue.decode(reader, reader.uint32()));
262
+ continue;
263
+ }
264
+ }
265
+ if ((tag & 7) === 4 || tag === 0) {
266
+ break;
267
+ }
268
+ reader.skip(tag & 7);
269
+ }
270
+ return message;
271
+ },
272
+
273
+ fromJSON(object: any): AttributeArray {
274
+ return {
275
+ values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => AttributeValue.fromJSON(e)) : [],
276
+ };
277
+ },
278
+
279
+ toJSON(message: AttributeArray): unknown {
280
+ const obj: any = {};
281
+ if (message.values?.length) {
282
+ obj.values = message.values.map((e) => AttributeValue.toJSON(e));
283
+ }
284
+ return obj;
285
+ },
286
+
287
+ create<I extends Exact<DeepPartial<AttributeArray>, I>>(base?: I): AttributeArray {
288
+ return AttributeArray.fromPartial(base ?? ({} as any));
289
+ },
290
+ fromPartial<I extends Exact<DeepPartial<AttributeArray>, I>>(object: I): AttributeArray {
291
+ const message = createBaseAttributeArray();
292
+ message.values = object.values?.map((e) => AttributeValue.fromPartial(e)) || [];
293
+ return message;
294
+ },
295
+ };
296
+
297
+ function createBaseAttributeKeyValue(): AttributeKeyValue {
298
+ return { key: "", value: undefined };
299
+ }
300
+
301
+ export const AttributeKeyValue: MessageFns<AttributeKeyValue> = {
302
+ encode(message: AttributeKeyValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
303
+ if (message.key !== "") {
304
+ writer.uint32(10).string(message.key);
305
+ }
306
+ if (message.value !== undefined) {
307
+ AttributeValue.encode(message.value, writer.uint32(18).fork()).join();
308
+ }
309
+ return writer;
310
+ },
311
+
312
+ decode(input: BinaryReader | Uint8Array, length?: number): AttributeKeyValue {
313
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
314
+ const end = length === undefined ? reader.len : reader.pos + length;
315
+ const message = createBaseAttributeKeyValue();
316
+ while (reader.pos < end) {
317
+ const tag = reader.uint32();
318
+ switch (tag >>> 3) {
319
+ case 1: {
320
+ if (tag !== 10) {
321
+ break;
322
+ }
323
+
324
+ message.key = reader.string();
325
+ continue;
326
+ }
327
+ case 2: {
328
+ if (tag !== 18) {
329
+ break;
330
+ }
331
+
332
+ message.value = AttributeValue.decode(reader, reader.uint32());
333
+ continue;
334
+ }
335
+ }
336
+ if ((tag & 7) === 4 || tag === 0) {
337
+ break;
338
+ }
339
+ reader.skip(tag & 7);
340
+ }
341
+ return message;
342
+ },
343
+
344
+ fromJSON(object: any): AttributeKeyValue {
345
+ return {
346
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
347
+ value: isSet(object.value) ? AttributeValue.fromJSON(object.value) : undefined,
348
+ };
349
+ },
350
+
351
+ toJSON(message: AttributeKeyValue): unknown {
352
+ const obj: any = {};
353
+ if (message.key !== "") {
354
+ obj.key = message.key;
355
+ }
356
+ if (message.value !== undefined) {
357
+ obj.value = AttributeValue.toJSON(message.value);
358
+ }
359
+ return obj;
360
+ },
361
+
362
+ create<I extends Exact<DeepPartial<AttributeKeyValue>, I>>(base?: I): AttributeKeyValue {
363
+ return AttributeKeyValue.fromPartial(base ?? ({} as any));
364
+ },
365
+ fromPartial<I extends Exact<DeepPartial<AttributeKeyValue>, I>>(object: I): AttributeKeyValue {
366
+ const message = createBaseAttributeKeyValue();
367
+ message.key = object.key ?? "";
368
+ message.value = (object.value !== undefined && object.value !== null)
369
+ ? AttributeValue.fromPartial(object.value)
370
+ : undefined;
371
+ return message;
372
+ },
373
+ };
374
+
375
+ function createBaseAttributeKeyValueList(): AttributeKeyValueList {
376
+ return { values: [] };
377
+ }
378
+
379
+ export const AttributeKeyValueList: MessageFns<AttributeKeyValueList> = {
380
+ encode(message: AttributeKeyValueList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
381
+ for (const v of message.values) {
382
+ AttributeKeyValue.encode(v!, writer.uint32(10).fork()).join();
383
+ }
384
+ return writer;
385
+ },
386
+
387
+ decode(input: BinaryReader | Uint8Array, length?: number): AttributeKeyValueList {
388
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
389
+ const end = length === undefined ? reader.len : reader.pos + length;
390
+ const message = createBaseAttributeKeyValueList();
391
+ while (reader.pos < end) {
392
+ const tag = reader.uint32();
393
+ switch (tag >>> 3) {
394
+ case 1: {
395
+ if (tag !== 10) {
396
+ break;
397
+ }
398
+
399
+ message.values.push(AttributeKeyValue.decode(reader, reader.uint32()));
400
+ continue;
401
+ }
402
+ }
403
+ if ((tag & 7) === 4 || tag === 0) {
404
+ break;
405
+ }
406
+ reader.skip(tag & 7);
407
+ }
408
+ return message;
409
+ },
410
+
411
+ fromJSON(object: any): AttributeKeyValueList {
412
+ return {
413
+ values: globalThis.Array.isArray(object?.values)
414
+ ? object.values.map((e: any) => AttributeKeyValue.fromJSON(e))
415
+ : [],
416
+ };
417
+ },
418
+
419
+ toJSON(message: AttributeKeyValueList): unknown {
420
+ const obj: any = {};
421
+ if (message.values?.length) {
422
+ obj.values = message.values.map((e) => AttributeKeyValue.toJSON(e));
423
+ }
424
+ return obj;
425
+ },
426
+
427
+ create<I extends Exact<DeepPartial<AttributeKeyValueList>, I>>(base?: I): AttributeKeyValueList {
428
+ return AttributeKeyValueList.fromPartial(base ?? ({} as any));
429
+ },
430
+ fromPartial<I extends Exact<DeepPartial<AttributeKeyValueList>, I>>(object: I): AttributeKeyValueList {
431
+ const message = createBaseAttributeKeyValueList();
432
+ message.values = object.values?.map((e) => AttributeKeyValue.fromPartial(e)) || [];
433
+ return message;
434
+ },
435
+ };
436
+
437
+ function bytesFromBase64(b64: string): Uint8Array {
438
+ if ((globalThis as any).Buffer) {
439
+ return Uint8Array.from((globalThis as any).Buffer.from(b64, "base64"));
440
+ } else {
441
+ const bin = globalThis.atob(b64);
442
+ const arr = new Uint8Array(bin.length);
443
+ for (let i = 0; i < bin.length; ++i) {
444
+ arr[i] = bin.charCodeAt(i);
445
+ }
446
+ return arr;
447
+ }
448
+ }
449
+
450
+ function base64FromBytes(arr: Uint8Array): string {
451
+ if ((globalThis as any).Buffer) {
452
+ return (globalThis as any).Buffer.from(arr).toString("base64");
453
+ } else {
454
+ const bin: string[] = [];
455
+ arr.forEach((byte) => {
456
+ bin.push(globalThis.String.fromCharCode(byte));
457
+ });
458
+ return globalThis.btoa(bin.join(""));
459
+ }
460
+ }
461
+
462
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
463
+
464
+ export type DeepPartial<T> = T extends Builtin ? T
465
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
466
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
467
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
468
+ : Partial<T>;
469
+
470
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
471
+ export type Exact<P, I extends P> = P extends Builtin ? P
472
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
473
+
474
+ function longToNumber(int64: { toString(): string }): number {
475
+ const num = globalThis.Number(int64.toString());
476
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
477
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
478
+ }
479
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
480
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
481
+ }
482
+ return num;
483
+ }
484
+
485
+ function isSet(value: any): boolean {
486
+ return value !== null && value !== undefined;
487
+ }
488
+
489
+ export interface MessageFns<T> {
490
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
491
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
492
+ fromJSON(object: any): T;
493
+ toJSON(message: T): unknown;
494
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
495
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
496
+ }
@@ -0,0 +1 @@
1
+ // GENERATED CODE -- NO SERVICES IN PROTO