@stanterprise/protobuf 0.0.2 → 0.0.4
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/README.md +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +92 -2514
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -2496
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
- package/LICENSE +0 -0
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Ack: () => Ack,
|
|
@@ -28,2454 +28,15 @@ __export(index_exports, {
|
|
|
28
28
|
TestStartEvent: () => TestStartEvent,
|
|
29
29
|
TestStatus: () => TestStatus,
|
|
30
30
|
TestStep: () => TestStep,
|
|
31
|
-
TestStepEvent: () => TestStepEvent
|
|
32
|
-
Timestamp: () => Timestamp
|
|
31
|
+
TestStepEvent: () => TestStepEvent
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(index_exports);
|
|
35
34
|
|
|
36
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/json-typings.js
|
|
37
|
-
function typeofJsonValue(value) {
|
|
38
|
-
let t = typeof value;
|
|
39
|
-
if (t == "object") {
|
|
40
|
-
if (Array.isArray(value))
|
|
41
|
-
return "array";
|
|
42
|
-
if (value === null)
|
|
43
|
-
return "null";
|
|
44
|
-
}
|
|
45
|
-
return t;
|
|
46
|
-
}
|
|
47
|
-
function isJsonObject(value) {
|
|
48
|
-
return value !== null && typeof value == "object" && !Array.isArray(value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/base64.js
|
|
52
|
-
var encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
53
|
-
var decTable = [];
|
|
54
|
-
for (let i = 0; i < encTable.length; i++)
|
|
55
|
-
decTable[encTable[i].charCodeAt(0)] = i;
|
|
56
|
-
decTable["-".charCodeAt(0)] = encTable.indexOf("+");
|
|
57
|
-
decTable["_".charCodeAt(0)] = encTable.indexOf("/");
|
|
58
|
-
function base64decode(base64Str) {
|
|
59
|
-
let es = base64Str.length * 3 / 4;
|
|
60
|
-
if (base64Str[base64Str.length - 2] == "=")
|
|
61
|
-
es -= 2;
|
|
62
|
-
else if (base64Str[base64Str.length - 1] == "=")
|
|
63
|
-
es -= 1;
|
|
64
|
-
let bytes = new Uint8Array(es), bytePos = 0, groupPos = 0, b, p = 0;
|
|
65
|
-
for (let i = 0; i < base64Str.length; i++) {
|
|
66
|
-
b = decTable[base64Str.charCodeAt(i)];
|
|
67
|
-
if (b === void 0) {
|
|
68
|
-
switch (base64Str[i]) {
|
|
69
|
-
case "=":
|
|
70
|
-
groupPos = 0;
|
|
71
|
-
// reset state when padding found
|
|
72
|
-
case "\n":
|
|
73
|
-
case "\r":
|
|
74
|
-
case " ":
|
|
75
|
-
case " ":
|
|
76
|
-
continue;
|
|
77
|
-
// skip white-space, and padding
|
|
78
|
-
default:
|
|
79
|
-
throw Error(`invalid base64 string.`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
switch (groupPos) {
|
|
83
|
-
case 0:
|
|
84
|
-
p = b;
|
|
85
|
-
groupPos = 1;
|
|
86
|
-
break;
|
|
87
|
-
case 1:
|
|
88
|
-
bytes[bytePos++] = p << 2 | (b & 48) >> 4;
|
|
89
|
-
p = b;
|
|
90
|
-
groupPos = 2;
|
|
91
|
-
break;
|
|
92
|
-
case 2:
|
|
93
|
-
bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2;
|
|
94
|
-
p = b;
|
|
95
|
-
groupPos = 3;
|
|
96
|
-
break;
|
|
97
|
-
case 3:
|
|
98
|
-
bytes[bytePos++] = (p & 3) << 6 | b;
|
|
99
|
-
groupPos = 0;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (groupPos == 1)
|
|
104
|
-
throw Error(`invalid base64 string.`);
|
|
105
|
-
return bytes.subarray(0, bytePos);
|
|
106
|
-
}
|
|
107
|
-
function base64encode(bytes) {
|
|
108
|
-
let base64 = "", groupPos = 0, b, p = 0;
|
|
109
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
110
|
-
b = bytes[i];
|
|
111
|
-
switch (groupPos) {
|
|
112
|
-
case 0:
|
|
113
|
-
base64 += encTable[b >> 2];
|
|
114
|
-
p = (b & 3) << 4;
|
|
115
|
-
groupPos = 1;
|
|
116
|
-
break;
|
|
117
|
-
case 1:
|
|
118
|
-
base64 += encTable[p | b >> 4];
|
|
119
|
-
p = (b & 15) << 2;
|
|
120
|
-
groupPos = 2;
|
|
121
|
-
break;
|
|
122
|
-
case 2:
|
|
123
|
-
base64 += encTable[p | b >> 6];
|
|
124
|
-
base64 += encTable[b & 63];
|
|
125
|
-
groupPos = 0;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (groupPos) {
|
|
130
|
-
base64 += encTable[p];
|
|
131
|
-
base64 += "=";
|
|
132
|
-
if (groupPos == 1)
|
|
133
|
-
base64 += "=";
|
|
134
|
-
}
|
|
135
|
-
return base64;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/binary-format-contract.js
|
|
139
|
-
var UnknownFieldHandler;
|
|
140
|
-
(function(UnknownFieldHandler2) {
|
|
141
|
-
UnknownFieldHandler2.symbol = Symbol.for("protobuf-ts/unknown");
|
|
142
|
-
UnknownFieldHandler2.onRead = (typeName, message, fieldNo, wireType, data) => {
|
|
143
|
-
let container = is(message) ? message[UnknownFieldHandler2.symbol] : message[UnknownFieldHandler2.symbol] = [];
|
|
144
|
-
container.push({ no: fieldNo, wireType, data });
|
|
145
|
-
};
|
|
146
|
-
UnknownFieldHandler2.onWrite = (typeName, message, writer) => {
|
|
147
|
-
for (let { no, wireType, data } of UnknownFieldHandler2.list(message))
|
|
148
|
-
writer.tag(no, wireType).raw(data);
|
|
149
|
-
};
|
|
150
|
-
UnknownFieldHandler2.list = (message, fieldNo) => {
|
|
151
|
-
if (is(message)) {
|
|
152
|
-
let all = message[UnknownFieldHandler2.symbol];
|
|
153
|
-
return fieldNo ? all.filter((uf) => uf.no == fieldNo) : all;
|
|
154
|
-
}
|
|
155
|
-
return [];
|
|
156
|
-
};
|
|
157
|
-
UnknownFieldHandler2.last = (message, fieldNo) => UnknownFieldHandler2.list(message, fieldNo).slice(-1)[0];
|
|
158
|
-
const is = (message) => message && Array.isArray(message[UnknownFieldHandler2.symbol]);
|
|
159
|
-
})(UnknownFieldHandler || (UnknownFieldHandler = {}));
|
|
160
|
-
var WireType;
|
|
161
|
-
(function(WireType2) {
|
|
162
|
-
WireType2[WireType2["Varint"] = 0] = "Varint";
|
|
163
|
-
WireType2[WireType2["Bit64"] = 1] = "Bit64";
|
|
164
|
-
WireType2[WireType2["LengthDelimited"] = 2] = "LengthDelimited";
|
|
165
|
-
WireType2[WireType2["StartGroup"] = 3] = "StartGroup";
|
|
166
|
-
WireType2[WireType2["EndGroup"] = 4] = "EndGroup";
|
|
167
|
-
WireType2[WireType2["Bit32"] = 5] = "Bit32";
|
|
168
|
-
})(WireType || (WireType = {}));
|
|
169
|
-
|
|
170
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/goog-varint.js
|
|
171
|
-
function varint64read() {
|
|
172
|
-
let lowBits = 0;
|
|
173
|
-
let highBits = 0;
|
|
174
|
-
for (let shift = 0; shift < 28; shift += 7) {
|
|
175
|
-
let b = this.buf[this.pos++];
|
|
176
|
-
lowBits |= (b & 127) << shift;
|
|
177
|
-
if ((b & 128) == 0) {
|
|
178
|
-
this.assertBounds();
|
|
179
|
-
return [lowBits, highBits];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
let middleByte = this.buf[this.pos++];
|
|
183
|
-
lowBits |= (middleByte & 15) << 28;
|
|
184
|
-
highBits = (middleByte & 112) >> 4;
|
|
185
|
-
if ((middleByte & 128) == 0) {
|
|
186
|
-
this.assertBounds();
|
|
187
|
-
return [lowBits, highBits];
|
|
188
|
-
}
|
|
189
|
-
for (let shift = 3; shift <= 31; shift += 7) {
|
|
190
|
-
let b = this.buf[this.pos++];
|
|
191
|
-
highBits |= (b & 127) << shift;
|
|
192
|
-
if ((b & 128) == 0) {
|
|
193
|
-
this.assertBounds();
|
|
194
|
-
return [lowBits, highBits];
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
throw new Error("invalid varint");
|
|
198
|
-
}
|
|
199
|
-
function varint64write(lo, hi, bytes) {
|
|
200
|
-
for (let i = 0; i < 28; i = i + 7) {
|
|
201
|
-
const shift = lo >>> i;
|
|
202
|
-
const hasNext = !(shift >>> 7 == 0 && hi == 0);
|
|
203
|
-
const byte = (hasNext ? shift | 128 : shift) & 255;
|
|
204
|
-
bytes.push(byte);
|
|
205
|
-
if (!hasNext) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const splitBits = lo >>> 28 & 15 | (hi & 7) << 4;
|
|
210
|
-
const hasMoreBits = !(hi >> 3 == 0);
|
|
211
|
-
bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255);
|
|
212
|
-
if (!hasMoreBits) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
for (let i = 3; i < 31; i = i + 7) {
|
|
216
|
-
const shift = hi >>> i;
|
|
217
|
-
const hasNext = !(shift >>> 7 == 0);
|
|
218
|
-
const byte = (hasNext ? shift | 128 : shift) & 255;
|
|
219
|
-
bytes.push(byte);
|
|
220
|
-
if (!hasNext) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
bytes.push(hi >>> 31 & 1);
|
|
225
|
-
}
|
|
226
|
-
var TWO_PWR_32_DBL = (1 << 16) * (1 << 16);
|
|
227
|
-
function int64fromString(dec) {
|
|
228
|
-
let minus = dec[0] == "-";
|
|
229
|
-
if (minus)
|
|
230
|
-
dec = dec.slice(1);
|
|
231
|
-
const base = 1e6;
|
|
232
|
-
let lowBits = 0;
|
|
233
|
-
let highBits = 0;
|
|
234
|
-
function add1e6digit(begin, end) {
|
|
235
|
-
const digit1e6 = Number(dec.slice(begin, end));
|
|
236
|
-
highBits *= base;
|
|
237
|
-
lowBits = lowBits * base + digit1e6;
|
|
238
|
-
if (lowBits >= TWO_PWR_32_DBL) {
|
|
239
|
-
highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
|
|
240
|
-
lowBits = lowBits % TWO_PWR_32_DBL;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
add1e6digit(-24, -18);
|
|
244
|
-
add1e6digit(-18, -12);
|
|
245
|
-
add1e6digit(-12, -6);
|
|
246
|
-
add1e6digit(-6);
|
|
247
|
-
return [minus, lowBits, highBits];
|
|
248
|
-
}
|
|
249
|
-
function int64toString(bitsLow, bitsHigh) {
|
|
250
|
-
if (bitsHigh >>> 0 <= 2097151) {
|
|
251
|
-
return "" + (TWO_PWR_32_DBL * bitsHigh + (bitsLow >>> 0));
|
|
252
|
-
}
|
|
253
|
-
let low = bitsLow & 16777215;
|
|
254
|
-
let mid = (bitsLow >>> 24 | bitsHigh << 8) >>> 0 & 16777215;
|
|
255
|
-
let high = bitsHigh >> 16 & 65535;
|
|
256
|
-
let digitA = low + mid * 6777216 + high * 6710656;
|
|
257
|
-
let digitB = mid + high * 8147497;
|
|
258
|
-
let digitC = high * 2;
|
|
259
|
-
let base = 1e7;
|
|
260
|
-
if (digitA >= base) {
|
|
261
|
-
digitB += Math.floor(digitA / base);
|
|
262
|
-
digitA %= base;
|
|
263
|
-
}
|
|
264
|
-
if (digitB >= base) {
|
|
265
|
-
digitC += Math.floor(digitB / base);
|
|
266
|
-
digitB %= base;
|
|
267
|
-
}
|
|
268
|
-
function decimalFrom1e7(digit1e7, needLeadingZeros) {
|
|
269
|
-
let partial = digit1e7 ? String(digit1e7) : "";
|
|
270
|
-
if (needLeadingZeros) {
|
|
271
|
-
return "0000000".slice(partial.length) + partial;
|
|
272
|
-
}
|
|
273
|
-
return partial;
|
|
274
|
-
}
|
|
275
|
-
return decimalFrom1e7(
|
|
276
|
-
digitC,
|
|
277
|
-
/*needLeadingZeros=*/
|
|
278
|
-
0
|
|
279
|
-
) + decimalFrom1e7(
|
|
280
|
-
digitB,
|
|
281
|
-
/*needLeadingZeros=*/
|
|
282
|
-
digitC
|
|
283
|
-
) + // If the final 1e7 digit didn't need leading zeros, we would have
|
|
284
|
-
// returned via the trivial code path at the top.
|
|
285
|
-
decimalFrom1e7(
|
|
286
|
-
digitA,
|
|
287
|
-
/*needLeadingZeros=*/
|
|
288
|
-
1
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
function varint32write(value, bytes) {
|
|
292
|
-
if (value >= 0) {
|
|
293
|
-
while (value > 127) {
|
|
294
|
-
bytes.push(value & 127 | 128);
|
|
295
|
-
value = value >>> 7;
|
|
296
|
-
}
|
|
297
|
-
bytes.push(value);
|
|
298
|
-
} else {
|
|
299
|
-
for (let i = 0; i < 9; i++) {
|
|
300
|
-
bytes.push(value & 127 | 128);
|
|
301
|
-
value = value >> 7;
|
|
302
|
-
}
|
|
303
|
-
bytes.push(1);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function varint32read() {
|
|
307
|
-
let b = this.buf[this.pos++];
|
|
308
|
-
let result = b & 127;
|
|
309
|
-
if ((b & 128) == 0) {
|
|
310
|
-
this.assertBounds();
|
|
311
|
-
return result;
|
|
312
|
-
}
|
|
313
|
-
b = this.buf[this.pos++];
|
|
314
|
-
result |= (b & 127) << 7;
|
|
315
|
-
if ((b & 128) == 0) {
|
|
316
|
-
this.assertBounds();
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
b = this.buf[this.pos++];
|
|
320
|
-
result |= (b & 127) << 14;
|
|
321
|
-
if ((b & 128) == 0) {
|
|
322
|
-
this.assertBounds();
|
|
323
|
-
return result;
|
|
324
|
-
}
|
|
325
|
-
b = this.buf[this.pos++];
|
|
326
|
-
result |= (b & 127) << 21;
|
|
327
|
-
if ((b & 128) == 0) {
|
|
328
|
-
this.assertBounds();
|
|
329
|
-
return result;
|
|
330
|
-
}
|
|
331
|
-
b = this.buf[this.pos++];
|
|
332
|
-
result |= (b & 15) << 28;
|
|
333
|
-
for (let readBytes = 5; (b & 128) !== 0 && readBytes < 10; readBytes++)
|
|
334
|
-
b = this.buf[this.pos++];
|
|
335
|
-
if ((b & 128) != 0)
|
|
336
|
-
throw new Error("invalid varint");
|
|
337
|
-
this.assertBounds();
|
|
338
|
-
return result >>> 0;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/pb-long.js
|
|
342
|
-
var BI;
|
|
343
|
-
function detectBi() {
|
|
344
|
-
const dv = new DataView(new ArrayBuffer(8));
|
|
345
|
-
const ok = globalThis.BigInt !== void 0 && typeof dv.getBigInt64 === "function" && typeof dv.getBigUint64 === "function" && typeof dv.setBigInt64 === "function" && typeof dv.setBigUint64 === "function";
|
|
346
|
-
BI = ok ? {
|
|
347
|
-
MIN: BigInt("-9223372036854775808"),
|
|
348
|
-
MAX: BigInt("9223372036854775807"),
|
|
349
|
-
UMIN: BigInt("0"),
|
|
350
|
-
UMAX: BigInt("18446744073709551615"),
|
|
351
|
-
C: BigInt,
|
|
352
|
-
V: dv
|
|
353
|
-
} : void 0;
|
|
354
|
-
}
|
|
355
|
-
detectBi();
|
|
356
|
-
function assertBi(bi) {
|
|
357
|
-
if (!bi)
|
|
358
|
-
throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
|
|
359
|
-
}
|
|
360
|
-
var RE_DECIMAL_STR = /^-?[0-9]+$/;
|
|
361
|
-
var TWO_PWR_32_DBL2 = 4294967296;
|
|
362
|
-
var HALF_2_PWR_32 = 2147483648;
|
|
363
|
-
var SharedPbLong = class {
|
|
364
|
-
/**
|
|
365
|
-
* Create a new instance with the given bits.
|
|
366
|
-
*/
|
|
367
|
-
constructor(lo, hi) {
|
|
368
|
-
this.lo = lo | 0;
|
|
369
|
-
this.hi = hi | 0;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Is this instance equal to 0?
|
|
373
|
-
*/
|
|
374
|
-
isZero() {
|
|
375
|
-
return this.lo == 0 && this.hi == 0;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Convert to a native number.
|
|
379
|
-
*/
|
|
380
|
-
toNumber() {
|
|
381
|
-
let result = this.hi * TWO_PWR_32_DBL2 + (this.lo >>> 0);
|
|
382
|
-
if (!Number.isSafeInteger(result))
|
|
383
|
-
throw new Error("cannot convert to safe number");
|
|
384
|
-
return result;
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
var PbULong = class _PbULong extends SharedPbLong {
|
|
388
|
-
/**
|
|
389
|
-
* Create instance from a `string`, `number` or `bigint`.
|
|
390
|
-
*/
|
|
391
|
-
static from(value) {
|
|
392
|
-
if (BI)
|
|
393
|
-
switch (typeof value) {
|
|
394
|
-
case "string":
|
|
395
|
-
if (value == "0")
|
|
396
|
-
return this.ZERO;
|
|
397
|
-
if (value == "")
|
|
398
|
-
throw new Error("string is no integer");
|
|
399
|
-
value = BI.C(value);
|
|
400
|
-
case "number":
|
|
401
|
-
if (value === 0)
|
|
402
|
-
return this.ZERO;
|
|
403
|
-
value = BI.C(value);
|
|
404
|
-
case "bigint":
|
|
405
|
-
if (!value)
|
|
406
|
-
return this.ZERO;
|
|
407
|
-
if (value < BI.UMIN)
|
|
408
|
-
throw new Error("signed value for ulong");
|
|
409
|
-
if (value > BI.UMAX)
|
|
410
|
-
throw new Error("ulong too large");
|
|
411
|
-
BI.V.setBigUint64(0, value, true);
|
|
412
|
-
return new _PbULong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
|
|
413
|
-
}
|
|
414
|
-
else
|
|
415
|
-
switch (typeof value) {
|
|
416
|
-
case "string":
|
|
417
|
-
if (value == "0")
|
|
418
|
-
return this.ZERO;
|
|
419
|
-
value = value.trim();
|
|
420
|
-
if (!RE_DECIMAL_STR.test(value))
|
|
421
|
-
throw new Error("string is no integer");
|
|
422
|
-
let [minus, lo, hi] = int64fromString(value);
|
|
423
|
-
if (minus)
|
|
424
|
-
throw new Error("signed value for ulong");
|
|
425
|
-
return new _PbULong(lo, hi);
|
|
426
|
-
case "number":
|
|
427
|
-
if (value == 0)
|
|
428
|
-
return this.ZERO;
|
|
429
|
-
if (!Number.isSafeInteger(value))
|
|
430
|
-
throw new Error("number is no integer");
|
|
431
|
-
if (value < 0)
|
|
432
|
-
throw new Error("signed value for ulong");
|
|
433
|
-
return new _PbULong(value, value / TWO_PWR_32_DBL2);
|
|
434
|
-
}
|
|
435
|
-
throw new Error("unknown value " + typeof value);
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Convert to decimal string.
|
|
439
|
-
*/
|
|
440
|
-
toString() {
|
|
441
|
-
return BI ? this.toBigInt().toString() : int64toString(this.lo, this.hi);
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Convert to native bigint.
|
|
445
|
-
*/
|
|
446
|
-
toBigInt() {
|
|
447
|
-
assertBi(BI);
|
|
448
|
-
BI.V.setInt32(0, this.lo, true);
|
|
449
|
-
BI.V.setInt32(4, this.hi, true);
|
|
450
|
-
return BI.V.getBigUint64(0, true);
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
PbULong.ZERO = new PbULong(0, 0);
|
|
454
|
-
var PbLong = class _PbLong extends SharedPbLong {
|
|
455
|
-
/**
|
|
456
|
-
* Create instance from a `string`, `number` or `bigint`.
|
|
457
|
-
*/
|
|
458
|
-
static from(value) {
|
|
459
|
-
if (BI)
|
|
460
|
-
switch (typeof value) {
|
|
461
|
-
case "string":
|
|
462
|
-
if (value == "0")
|
|
463
|
-
return this.ZERO;
|
|
464
|
-
if (value == "")
|
|
465
|
-
throw new Error("string is no integer");
|
|
466
|
-
value = BI.C(value);
|
|
467
|
-
case "number":
|
|
468
|
-
if (value === 0)
|
|
469
|
-
return this.ZERO;
|
|
470
|
-
value = BI.C(value);
|
|
471
|
-
case "bigint":
|
|
472
|
-
if (!value)
|
|
473
|
-
return this.ZERO;
|
|
474
|
-
if (value < BI.MIN)
|
|
475
|
-
throw new Error("signed long too small");
|
|
476
|
-
if (value > BI.MAX)
|
|
477
|
-
throw new Error("signed long too large");
|
|
478
|
-
BI.V.setBigInt64(0, value, true);
|
|
479
|
-
return new _PbLong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
|
|
480
|
-
}
|
|
481
|
-
else
|
|
482
|
-
switch (typeof value) {
|
|
483
|
-
case "string":
|
|
484
|
-
if (value == "0")
|
|
485
|
-
return this.ZERO;
|
|
486
|
-
value = value.trim();
|
|
487
|
-
if (!RE_DECIMAL_STR.test(value))
|
|
488
|
-
throw new Error("string is no integer");
|
|
489
|
-
let [minus, lo, hi] = int64fromString(value);
|
|
490
|
-
if (minus) {
|
|
491
|
-
if (hi > HALF_2_PWR_32 || hi == HALF_2_PWR_32 && lo != 0)
|
|
492
|
-
throw new Error("signed long too small");
|
|
493
|
-
} else if (hi >= HALF_2_PWR_32)
|
|
494
|
-
throw new Error("signed long too large");
|
|
495
|
-
let pbl = new _PbLong(lo, hi);
|
|
496
|
-
return minus ? pbl.negate() : pbl;
|
|
497
|
-
case "number":
|
|
498
|
-
if (value == 0)
|
|
499
|
-
return this.ZERO;
|
|
500
|
-
if (!Number.isSafeInteger(value))
|
|
501
|
-
throw new Error("number is no integer");
|
|
502
|
-
return value > 0 ? new _PbLong(value, value / TWO_PWR_32_DBL2) : new _PbLong(-value, -value / TWO_PWR_32_DBL2).negate();
|
|
503
|
-
}
|
|
504
|
-
throw new Error("unknown value " + typeof value);
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Do we have a minus sign?
|
|
508
|
-
*/
|
|
509
|
-
isNegative() {
|
|
510
|
-
return (this.hi & HALF_2_PWR_32) !== 0;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Negate two's complement.
|
|
514
|
-
* Invert all the bits and add one to the result.
|
|
515
|
-
*/
|
|
516
|
-
negate() {
|
|
517
|
-
let hi = ~this.hi, lo = this.lo;
|
|
518
|
-
if (lo)
|
|
519
|
-
lo = ~lo + 1;
|
|
520
|
-
else
|
|
521
|
-
hi += 1;
|
|
522
|
-
return new _PbLong(lo, hi);
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Convert to decimal string.
|
|
526
|
-
*/
|
|
527
|
-
toString() {
|
|
528
|
-
if (BI)
|
|
529
|
-
return this.toBigInt().toString();
|
|
530
|
-
if (this.isNegative()) {
|
|
531
|
-
let n = this.negate();
|
|
532
|
-
return "-" + int64toString(n.lo, n.hi);
|
|
533
|
-
}
|
|
534
|
-
return int64toString(this.lo, this.hi);
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Convert to native bigint.
|
|
538
|
-
*/
|
|
539
|
-
toBigInt() {
|
|
540
|
-
assertBi(BI);
|
|
541
|
-
BI.V.setInt32(0, this.lo, true);
|
|
542
|
-
BI.V.setInt32(4, this.hi, true);
|
|
543
|
-
return BI.V.getBigInt64(0, true);
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
PbLong.ZERO = new PbLong(0, 0);
|
|
547
|
-
|
|
548
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/binary-reader.js
|
|
549
|
-
var defaultsRead = {
|
|
550
|
-
readUnknownField: true,
|
|
551
|
-
readerFactory: (bytes) => new BinaryReader(bytes)
|
|
552
|
-
};
|
|
553
|
-
function binaryReadOptions(options) {
|
|
554
|
-
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
|
|
555
|
-
}
|
|
556
|
-
var BinaryReader = class {
|
|
557
|
-
constructor(buf, textDecoder) {
|
|
558
|
-
this.varint64 = varint64read;
|
|
559
|
-
this.uint32 = varint32read;
|
|
560
|
-
this.buf = buf;
|
|
561
|
-
this.len = buf.length;
|
|
562
|
-
this.pos = 0;
|
|
563
|
-
this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
564
|
-
this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
|
|
565
|
-
fatal: true,
|
|
566
|
-
ignoreBOM: true
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Reads a tag - field number and wire type.
|
|
571
|
-
*/
|
|
572
|
-
tag() {
|
|
573
|
-
let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
|
|
574
|
-
if (fieldNo <= 0 || wireType < 0 || wireType > 5)
|
|
575
|
-
throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
|
|
576
|
-
return [fieldNo, wireType];
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Skip one element on the wire and return the skipped data.
|
|
580
|
-
* Supports WireType.StartGroup since v2.0.0-alpha.23.
|
|
581
|
-
*/
|
|
582
|
-
skip(wireType) {
|
|
583
|
-
let start = this.pos;
|
|
584
|
-
switch (wireType) {
|
|
585
|
-
case WireType.Varint:
|
|
586
|
-
while (this.buf[this.pos++] & 128) {
|
|
587
|
-
}
|
|
588
|
-
break;
|
|
589
|
-
case WireType.Bit64:
|
|
590
|
-
this.pos += 4;
|
|
591
|
-
case WireType.Bit32:
|
|
592
|
-
this.pos += 4;
|
|
593
|
-
break;
|
|
594
|
-
case WireType.LengthDelimited:
|
|
595
|
-
let len = this.uint32();
|
|
596
|
-
this.pos += len;
|
|
597
|
-
break;
|
|
598
|
-
case WireType.StartGroup:
|
|
599
|
-
let t;
|
|
600
|
-
while ((t = this.tag()[1]) !== WireType.EndGroup) {
|
|
601
|
-
this.skip(t);
|
|
602
|
-
}
|
|
603
|
-
break;
|
|
604
|
-
default:
|
|
605
|
-
throw new Error("cant skip wire type " + wireType);
|
|
606
|
-
}
|
|
607
|
-
this.assertBounds();
|
|
608
|
-
return this.buf.subarray(start, this.pos);
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Throws error if position in byte array is out of range.
|
|
612
|
-
*/
|
|
613
|
-
assertBounds() {
|
|
614
|
-
if (this.pos > this.len)
|
|
615
|
-
throw new RangeError("premature EOF");
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Read a `int32` field, a signed 32 bit varint.
|
|
619
|
-
*/
|
|
620
|
-
int32() {
|
|
621
|
-
return this.uint32() | 0;
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
|
|
625
|
-
*/
|
|
626
|
-
sint32() {
|
|
627
|
-
let zze = this.uint32();
|
|
628
|
-
return zze >>> 1 ^ -(zze & 1);
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Read a `int64` field, a signed 64-bit varint.
|
|
632
|
-
*/
|
|
633
|
-
int64() {
|
|
634
|
-
return new PbLong(...this.varint64());
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
638
|
-
*/
|
|
639
|
-
uint64() {
|
|
640
|
-
return new PbULong(...this.varint64());
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
644
|
-
*/
|
|
645
|
-
sint64() {
|
|
646
|
-
let [lo, hi] = this.varint64();
|
|
647
|
-
let s = -(lo & 1);
|
|
648
|
-
lo = (lo >>> 1 | (hi & 1) << 31) ^ s;
|
|
649
|
-
hi = hi >>> 1 ^ s;
|
|
650
|
-
return new PbLong(lo, hi);
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Read a `bool` field, a variant.
|
|
654
|
-
*/
|
|
655
|
-
bool() {
|
|
656
|
-
let [lo, hi] = this.varint64();
|
|
657
|
-
return lo !== 0 || hi !== 0;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
|
|
661
|
-
*/
|
|
662
|
-
fixed32() {
|
|
663
|
-
return this.view.getUint32((this.pos += 4) - 4, true);
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
|
|
667
|
-
*/
|
|
668
|
-
sfixed32() {
|
|
669
|
-
return this.view.getInt32((this.pos += 4) - 4, true);
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
|
673
|
-
*/
|
|
674
|
-
fixed64() {
|
|
675
|
-
return new PbULong(this.sfixed32(), this.sfixed32());
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
679
|
-
*/
|
|
680
|
-
sfixed64() {
|
|
681
|
-
return new PbLong(this.sfixed32(), this.sfixed32());
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Read a `float` field, 32-bit floating point number.
|
|
685
|
-
*/
|
|
686
|
-
float() {
|
|
687
|
-
return this.view.getFloat32((this.pos += 4) - 4, true);
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Read a `double` field, a 64-bit floating point number.
|
|
691
|
-
*/
|
|
692
|
-
double() {
|
|
693
|
-
return this.view.getFloat64((this.pos += 8) - 8, true);
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Read a `bytes` field, length-delimited arbitrary data.
|
|
697
|
-
*/
|
|
698
|
-
bytes() {
|
|
699
|
-
let len = this.uint32();
|
|
700
|
-
let start = this.pos;
|
|
701
|
-
this.pos += len;
|
|
702
|
-
this.assertBounds();
|
|
703
|
-
return this.buf.subarray(start, start + len);
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
|
707
|
-
*/
|
|
708
|
-
string() {
|
|
709
|
-
return this.textDecoder.decode(this.bytes());
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/assert.js
|
|
714
|
-
function assert(condition, msg) {
|
|
715
|
-
if (!condition) {
|
|
716
|
-
throw new Error(msg);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
function assertNever(value, msg) {
|
|
720
|
-
throw new Error(msg !== null && msg !== void 0 ? msg : "Unexpected object: " + value);
|
|
721
|
-
}
|
|
722
|
-
var FLOAT32_MAX = 34028234663852886e22;
|
|
723
|
-
var FLOAT32_MIN = -34028234663852886e22;
|
|
724
|
-
var UINT32_MAX = 4294967295;
|
|
725
|
-
var INT32_MAX = 2147483647;
|
|
726
|
-
var INT32_MIN = -2147483648;
|
|
727
|
-
function assertInt32(arg) {
|
|
728
|
-
if (typeof arg !== "number")
|
|
729
|
-
throw new Error("invalid int 32: " + typeof arg);
|
|
730
|
-
if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
|
|
731
|
-
throw new Error("invalid int 32: " + arg);
|
|
732
|
-
}
|
|
733
|
-
function assertUInt32(arg) {
|
|
734
|
-
if (typeof arg !== "number")
|
|
735
|
-
throw new Error("invalid uint 32: " + typeof arg);
|
|
736
|
-
if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
|
|
737
|
-
throw new Error("invalid uint 32: " + arg);
|
|
738
|
-
}
|
|
739
|
-
function assertFloat32(arg) {
|
|
740
|
-
if (typeof arg !== "number")
|
|
741
|
-
throw new Error("invalid float 32: " + typeof arg);
|
|
742
|
-
if (!Number.isFinite(arg))
|
|
743
|
-
return;
|
|
744
|
-
if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
|
|
745
|
-
throw new Error("invalid float 32: " + arg);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/binary-writer.js
|
|
749
|
-
var defaultsWrite = {
|
|
750
|
-
writeUnknownFields: true,
|
|
751
|
-
writerFactory: () => new BinaryWriter()
|
|
752
|
-
};
|
|
753
|
-
function binaryWriteOptions(options) {
|
|
754
|
-
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
|
|
755
|
-
}
|
|
756
|
-
var BinaryWriter = class {
|
|
757
|
-
constructor(textEncoder) {
|
|
758
|
-
this.stack = [];
|
|
759
|
-
this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();
|
|
760
|
-
this.chunks = [];
|
|
761
|
-
this.buf = [];
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Return all bytes written and reset this writer.
|
|
765
|
-
*/
|
|
766
|
-
finish() {
|
|
767
|
-
this.chunks.push(new Uint8Array(this.buf));
|
|
768
|
-
let len = 0;
|
|
769
|
-
for (let i = 0; i < this.chunks.length; i++)
|
|
770
|
-
len += this.chunks[i].length;
|
|
771
|
-
let bytes = new Uint8Array(len);
|
|
772
|
-
let offset = 0;
|
|
773
|
-
for (let i = 0; i < this.chunks.length; i++) {
|
|
774
|
-
bytes.set(this.chunks[i], offset);
|
|
775
|
-
offset += this.chunks[i].length;
|
|
776
|
-
}
|
|
777
|
-
this.chunks = [];
|
|
778
|
-
return bytes;
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Start a new fork for length-delimited data like a message
|
|
782
|
-
* or a packed repeated field.
|
|
783
|
-
*
|
|
784
|
-
* Must be joined later with `join()`.
|
|
785
|
-
*/
|
|
786
|
-
fork() {
|
|
787
|
-
this.stack.push({ chunks: this.chunks, buf: this.buf });
|
|
788
|
-
this.chunks = [];
|
|
789
|
-
this.buf = [];
|
|
790
|
-
return this;
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Join the last fork. Write its length and bytes, then
|
|
794
|
-
* return to the previous state.
|
|
795
|
-
*/
|
|
796
|
-
join() {
|
|
797
|
-
let chunk = this.finish();
|
|
798
|
-
let prev = this.stack.pop();
|
|
799
|
-
if (!prev)
|
|
800
|
-
throw new Error("invalid state, fork stack empty");
|
|
801
|
-
this.chunks = prev.chunks;
|
|
802
|
-
this.buf = prev.buf;
|
|
803
|
-
this.uint32(chunk.byteLength);
|
|
804
|
-
return this.raw(chunk);
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Writes a tag (field number and wire type).
|
|
808
|
-
*
|
|
809
|
-
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
|
|
810
|
-
*
|
|
811
|
-
* Generated code should compute the tag ahead of time and call `uint32()`.
|
|
812
|
-
*/
|
|
813
|
-
tag(fieldNo, type) {
|
|
814
|
-
return this.uint32((fieldNo << 3 | type) >>> 0);
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Write a chunk of raw bytes.
|
|
818
|
-
*/
|
|
819
|
-
raw(chunk) {
|
|
820
|
-
if (this.buf.length) {
|
|
821
|
-
this.chunks.push(new Uint8Array(this.buf));
|
|
822
|
-
this.buf = [];
|
|
823
|
-
}
|
|
824
|
-
this.chunks.push(chunk);
|
|
825
|
-
return this;
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
829
|
-
*/
|
|
830
|
-
uint32(value) {
|
|
831
|
-
assertUInt32(value);
|
|
832
|
-
while (value > 127) {
|
|
833
|
-
this.buf.push(value & 127 | 128);
|
|
834
|
-
value = value >>> 7;
|
|
835
|
-
}
|
|
836
|
-
this.buf.push(value);
|
|
837
|
-
return this;
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Write a `int32` value, a signed 32 bit varint.
|
|
841
|
-
*/
|
|
842
|
-
int32(value) {
|
|
843
|
-
assertInt32(value);
|
|
844
|
-
varint32write(value, this.buf);
|
|
845
|
-
return this;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Write a `bool` value, a variant.
|
|
849
|
-
*/
|
|
850
|
-
bool(value) {
|
|
851
|
-
this.buf.push(value ? 1 : 0);
|
|
852
|
-
return this;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Write a `bytes` value, length-delimited arbitrary data.
|
|
856
|
-
*/
|
|
857
|
-
bytes(value) {
|
|
858
|
-
this.uint32(value.byteLength);
|
|
859
|
-
return this.raw(value);
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Write a `string` value, length-delimited data converted to UTF-8 text.
|
|
863
|
-
*/
|
|
864
|
-
string(value) {
|
|
865
|
-
let chunk = this.textEncoder.encode(value);
|
|
866
|
-
this.uint32(chunk.byteLength);
|
|
867
|
-
return this.raw(chunk);
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Write a `float` value, 32-bit floating point number.
|
|
871
|
-
*/
|
|
872
|
-
float(value) {
|
|
873
|
-
assertFloat32(value);
|
|
874
|
-
let chunk = new Uint8Array(4);
|
|
875
|
-
new DataView(chunk.buffer).setFloat32(0, value, true);
|
|
876
|
-
return this.raw(chunk);
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
|
-
* Write a `double` value, a 64-bit floating point number.
|
|
880
|
-
*/
|
|
881
|
-
double(value) {
|
|
882
|
-
let chunk = new Uint8Array(8);
|
|
883
|
-
new DataView(chunk.buffer).setFloat64(0, value, true);
|
|
884
|
-
return this.raw(chunk);
|
|
885
|
-
}
|
|
886
|
-
/**
|
|
887
|
-
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
888
|
-
*/
|
|
889
|
-
fixed32(value) {
|
|
890
|
-
assertUInt32(value);
|
|
891
|
-
let chunk = new Uint8Array(4);
|
|
892
|
-
new DataView(chunk.buffer).setUint32(0, value, true);
|
|
893
|
-
return this.raw(chunk);
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
897
|
-
*/
|
|
898
|
-
sfixed32(value) {
|
|
899
|
-
assertInt32(value);
|
|
900
|
-
let chunk = new Uint8Array(4);
|
|
901
|
-
new DataView(chunk.buffer).setInt32(0, value, true);
|
|
902
|
-
return this.raw(chunk);
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
906
|
-
*/
|
|
907
|
-
sint32(value) {
|
|
908
|
-
assertInt32(value);
|
|
909
|
-
value = (value << 1 ^ value >> 31) >>> 0;
|
|
910
|
-
varint32write(value, this.buf);
|
|
911
|
-
return this;
|
|
912
|
-
}
|
|
913
|
-
/**
|
|
914
|
-
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
915
|
-
*/
|
|
916
|
-
sfixed64(value) {
|
|
917
|
-
let chunk = new Uint8Array(8);
|
|
918
|
-
let view = new DataView(chunk.buffer);
|
|
919
|
-
let long = PbLong.from(value);
|
|
920
|
-
view.setInt32(0, long.lo, true);
|
|
921
|
-
view.setInt32(4, long.hi, true);
|
|
922
|
-
return this.raw(chunk);
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
|
926
|
-
*/
|
|
927
|
-
fixed64(value) {
|
|
928
|
-
let chunk = new Uint8Array(8);
|
|
929
|
-
let view = new DataView(chunk.buffer);
|
|
930
|
-
let long = PbULong.from(value);
|
|
931
|
-
view.setInt32(0, long.lo, true);
|
|
932
|
-
view.setInt32(4, long.hi, true);
|
|
933
|
-
return this.raw(chunk);
|
|
934
|
-
}
|
|
935
|
-
/**
|
|
936
|
-
* Write a `int64` value, a signed 64-bit varint.
|
|
937
|
-
*/
|
|
938
|
-
int64(value) {
|
|
939
|
-
let long = PbLong.from(value);
|
|
940
|
-
varint64write(long.lo, long.hi, this.buf);
|
|
941
|
-
return this;
|
|
942
|
-
}
|
|
943
|
-
/**
|
|
944
|
-
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
945
|
-
*/
|
|
946
|
-
sint64(value) {
|
|
947
|
-
let long = PbLong.from(value), sign = long.hi >> 31, lo = long.lo << 1 ^ sign, hi = (long.hi << 1 | long.lo >>> 31) ^ sign;
|
|
948
|
-
varint64write(lo, hi, this.buf);
|
|
949
|
-
return this;
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
953
|
-
*/
|
|
954
|
-
uint64(value) {
|
|
955
|
-
let long = PbULong.from(value);
|
|
956
|
-
varint64write(long.lo, long.hi, this.buf);
|
|
957
|
-
return this;
|
|
958
|
-
}
|
|
959
|
-
};
|
|
960
|
-
|
|
961
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/json-format-contract.js
|
|
962
|
-
var defaultsWrite2 = {
|
|
963
|
-
emitDefaultValues: false,
|
|
964
|
-
enumAsInteger: false,
|
|
965
|
-
useProtoFieldName: false,
|
|
966
|
-
prettySpaces: 0
|
|
967
|
-
};
|
|
968
|
-
var defaultsRead2 = {
|
|
969
|
-
ignoreUnknownFields: false
|
|
970
|
-
};
|
|
971
|
-
function jsonReadOptions(options) {
|
|
972
|
-
return options ? Object.assign(Object.assign({}, defaultsRead2), options) : defaultsRead2;
|
|
973
|
-
}
|
|
974
|
-
function jsonWriteOptions(options) {
|
|
975
|
-
return options ? Object.assign(Object.assign({}, defaultsWrite2), options) : defaultsWrite2;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/message-type-contract.js
|
|
979
|
-
var MESSAGE_TYPE = Symbol.for("protobuf-ts/message-type");
|
|
980
|
-
|
|
981
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/lower-camel-case.js
|
|
982
|
-
function lowerCamelCase(snakeCase) {
|
|
983
|
-
let capNext = false;
|
|
984
|
-
const sb = [];
|
|
985
|
-
for (let i = 0; i < snakeCase.length; i++) {
|
|
986
|
-
let next = snakeCase.charAt(i);
|
|
987
|
-
if (next == "_") {
|
|
988
|
-
capNext = true;
|
|
989
|
-
} else if (/\d/.test(next)) {
|
|
990
|
-
sb.push(next);
|
|
991
|
-
capNext = true;
|
|
992
|
-
} else if (capNext) {
|
|
993
|
-
sb.push(next.toUpperCase());
|
|
994
|
-
capNext = false;
|
|
995
|
-
} else if (i == 0) {
|
|
996
|
-
sb.push(next.toLowerCase());
|
|
997
|
-
} else {
|
|
998
|
-
sb.push(next);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
return sb.join("");
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-info.js
|
|
1005
|
-
var ScalarType;
|
|
1006
|
-
(function(ScalarType2) {
|
|
1007
|
-
ScalarType2[ScalarType2["DOUBLE"] = 1] = "DOUBLE";
|
|
1008
|
-
ScalarType2[ScalarType2["FLOAT"] = 2] = "FLOAT";
|
|
1009
|
-
ScalarType2[ScalarType2["INT64"] = 3] = "INT64";
|
|
1010
|
-
ScalarType2[ScalarType2["UINT64"] = 4] = "UINT64";
|
|
1011
|
-
ScalarType2[ScalarType2["INT32"] = 5] = "INT32";
|
|
1012
|
-
ScalarType2[ScalarType2["FIXED64"] = 6] = "FIXED64";
|
|
1013
|
-
ScalarType2[ScalarType2["FIXED32"] = 7] = "FIXED32";
|
|
1014
|
-
ScalarType2[ScalarType2["BOOL"] = 8] = "BOOL";
|
|
1015
|
-
ScalarType2[ScalarType2["STRING"] = 9] = "STRING";
|
|
1016
|
-
ScalarType2[ScalarType2["BYTES"] = 12] = "BYTES";
|
|
1017
|
-
ScalarType2[ScalarType2["UINT32"] = 13] = "UINT32";
|
|
1018
|
-
ScalarType2[ScalarType2["SFIXED32"] = 15] = "SFIXED32";
|
|
1019
|
-
ScalarType2[ScalarType2["SFIXED64"] = 16] = "SFIXED64";
|
|
1020
|
-
ScalarType2[ScalarType2["SINT32"] = 17] = "SINT32";
|
|
1021
|
-
ScalarType2[ScalarType2["SINT64"] = 18] = "SINT64";
|
|
1022
|
-
})(ScalarType || (ScalarType = {}));
|
|
1023
|
-
var LongType;
|
|
1024
|
-
(function(LongType2) {
|
|
1025
|
-
LongType2[LongType2["BIGINT"] = 0] = "BIGINT";
|
|
1026
|
-
LongType2[LongType2["STRING"] = 1] = "STRING";
|
|
1027
|
-
LongType2[LongType2["NUMBER"] = 2] = "NUMBER";
|
|
1028
|
-
})(LongType || (LongType = {}));
|
|
1029
|
-
var RepeatType;
|
|
1030
|
-
(function(RepeatType2) {
|
|
1031
|
-
RepeatType2[RepeatType2["NO"] = 0] = "NO";
|
|
1032
|
-
RepeatType2[RepeatType2["PACKED"] = 1] = "PACKED";
|
|
1033
|
-
RepeatType2[RepeatType2["UNPACKED"] = 2] = "UNPACKED";
|
|
1034
|
-
})(RepeatType || (RepeatType = {}));
|
|
1035
|
-
function normalizeFieldInfo(field) {
|
|
1036
|
-
var _a, _b, _c, _d;
|
|
1037
|
-
field.localName = (_a = field.localName) !== null && _a !== void 0 ? _a : lowerCamelCase(field.name);
|
|
1038
|
-
field.jsonName = (_b = field.jsonName) !== null && _b !== void 0 ? _b : lowerCamelCase(field.name);
|
|
1039
|
-
field.repeat = (_c = field.repeat) !== null && _c !== void 0 ? _c : RepeatType.NO;
|
|
1040
|
-
field.opt = (_d = field.opt) !== null && _d !== void 0 ? _d : field.repeat ? false : field.oneof ? false : field.kind == "message";
|
|
1041
|
-
return field;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/oneof.js
|
|
1045
|
-
function isOneofGroup(any) {
|
|
1046
|
-
if (typeof any != "object" || any === null || !any.hasOwnProperty("oneofKind")) {
|
|
1047
|
-
return false;
|
|
1048
|
-
}
|
|
1049
|
-
switch (typeof any.oneofKind) {
|
|
1050
|
-
case "string":
|
|
1051
|
-
if (any[any.oneofKind] === void 0)
|
|
1052
|
-
return false;
|
|
1053
|
-
return Object.keys(any).length == 2;
|
|
1054
|
-
case "undefined":
|
|
1055
|
-
return Object.keys(any).length == 1;
|
|
1056
|
-
default:
|
|
1057
|
-
return false;
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-type-check.js
|
|
1062
|
-
var ReflectionTypeCheck = class {
|
|
1063
|
-
constructor(info) {
|
|
1064
|
-
var _a;
|
|
1065
|
-
this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
|
|
1066
|
-
}
|
|
1067
|
-
prepare() {
|
|
1068
|
-
if (this.data)
|
|
1069
|
-
return;
|
|
1070
|
-
const req = [], known = [], oneofs = [];
|
|
1071
|
-
for (let field of this.fields) {
|
|
1072
|
-
if (field.oneof) {
|
|
1073
|
-
if (!oneofs.includes(field.oneof)) {
|
|
1074
|
-
oneofs.push(field.oneof);
|
|
1075
|
-
req.push(field.oneof);
|
|
1076
|
-
known.push(field.oneof);
|
|
1077
|
-
}
|
|
1078
|
-
} else {
|
|
1079
|
-
known.push(field.localName);
|
|
1080
|
-
switch (field.kind) {
|
|
1081
|
-
case "scalar":
|
|
1082
|
-
case "enum":
|
|
1083
|
-
if (!field.opt || field.repeat)
|
|
1084
|
-
req.push(field.localName);
|
|
1085
|
-
break;
|
|
1086
|
-
case "message":
|
|
1087
|
-
if (field.repeat)
|
|
1088
|
-
req.push(field.localName);
|
|
1089
|
-
break;
|
|
1090
|
-
case "map":
|
|
1091
|
-
req.push(field.localName);
|
|
1092
|
-
break;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
this.data = { req, known, oneofs: Object.values(oneofs) };
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Is the argument a valid message as specified by the
|
|
1100
|
-
* reflection information?
|
|
1101
|
-
*
|
|
1102
|
-
* Checks all field types recursively. The `depth`
|
|
1103
|
-
* specifies how deep into the structure the check will be.
|
|
1104
|
-
*
|
|
1105
|
-
* With a depth of 0, only the presence of fields
|
|
1106
|
-
* is checked.
|
|
1107
|
-
*
|
|
1108
|
-
* With a depth of 1 or more, the field types are checked.
|
|
1109
|
-
*
|
|
1110
|
-
* With a depth of 2 or more, the members of map, repeated
|
|
1111
|
-
* and message fields are checked.
|
|
1112
|
-
*
|
|
1113
|
-
* Message fields will be checked recursively with depth - 1.
|
|
1114
|
-
*
|
|
1115
|
-
* The number of map entries / repeated values being checked
|
|
1116
|
-
* is < depth.
|
|
1117
|
-
*/
|
|
1118
|
-
is(message, depth, allowExcessProperties = false) {
|
|
1119
|
-
if (depth < 0)
|
|
1120
|
-
return true;
|
|
1121
|
-
if (message === null || message === void 0 || typeof message != "object")
|
|
1122
|
-
return false;
|
|
1123
|
-
this.prepare();
|
|
1124
|
-
let keys = Object.keys(message), data = this.data;
|
|
1125
|
-
if (keys.length < data.req.length || data.req.some((n) => !keys.includes(n)))
|
|
1126
|
-
return false;
|
|
1127
|
-
if (!allowExcessProperties) {
|
|
1128
|
-
if (keys.some((k) => !data.known.includes(k)))
|
|
1129
|
-
return false;
|
|
1130
|
-
}
|
|
1131
|
-
if (depth < 1) {
|
|
1132
|
-
return true;
|
|
1133
|
-
}
|
|
1134
|
-
for (const name of data.oneofs) {
|
|
1135
|
-
const group = message[name];
|
|
1136
|
-
if (!isOneofGroup(group))
|
|
1137
|
-
return false;
|
|
1138
|
-
if (group.oneofKind === void 0)
|
|
1139
|
-
continue;
|
|
1140
|
-
const field = this.fields.find((f) => f.localName === group.oneofKind);
|
|
1141
|
-
if (!field)
|
|
1142
|
-
return false;
|
|
1143
|
-
if (!this.field(group[group.oneofKind], field, allowExcessProperties, depth))
|
|
1144
|
-
return false;
|
|
1145
|
-
}
|
|
1146
|
-
for (const field of this.fields) {
|
|
1147
|
-
if (field.oneof !== void 0)
|
|
1148
|
-
continue;
|
|
1149
|
-
if (!this.field(message[field.localName], field, allowExcessProperties, depth))
|
|
1150
|
-
return false;
|
|
1151
|
-
}
|
|
1152
|
-
return true;
|
|
1153
|
-
}
|
|
1154
|
-
field(arg, field, allowExcessProperties, depth) {
|
|
1155
|
-
let repeated = field.repeat;
|
|
1156
|
-
switch (field.kind) {
|
|
1157
|
-
case "scalar":
|
|
1158
|
-
if (arg === void 0)
|
|
1159
|
-
return field.opt;
|
|
1160
|
-
if (repeated)
|
|
1161
|
-
return this.scalars(arg, field.T, depth, field.L);
|
|
1162
|
-
return this.scalar(arg, field.T, field.L);
|
|
1163
|
-
case "enum":
|
|
1164
|
-
if (arg === void 0)
|
|
1165
|
-
return field.opt;
|
|
1166
|
-
if (repeated)
|
|
1167
|
-
return this.scalars(arg, ScalarType.INT32, depth);
|
|
1168
|
-
return this.scalar(arg, ScalarType.INT32);
|
|
1169
|
-
case "message":
|
|
1170
|
-
if (arg === void 0)
|
|
1171
|
-
return true;
|
|
1172
|
-
if (repeated)
|
|
1173
|
-
return this.messages(arg, field.T(), allowExcessProperties, depth);
|
|
1174
|
-
return this.message(arg, field.T(), allowExcessProperties, depth);
|
|
1175
|
-
case "map":
|
|
1176
|
-
if (typeof arg != "object" || arg === null)
|
|
1177
|
-
return false;
|
|
1178
|
-
if (depth < 2)
|
|
1179
|
-
return true;
|
|
1180
|
-
if (!this.mapKeys(arg, field.K, depth))
|
|
1181
|
-
return false;
|
|
1182
|
-
switch (field.V.kind) {
|
|
1183
|
-
case "scalar":
|
|
1184
|
-
return this.scalars(Object.values(arg), field.V.T, depth, field.V.L);
|
|
1185
|
-
case "enum":
|
|
1186
|
-
return this.scalars(Object.values(arg), ScalarType.INT32, depth);
|
|
1187
|
-
case "message":
|
|
1188
|
-
return this.messages(Object.values(arg), field.V.T(), allowExcessProperties, depth);
|
|
1189
|
-
}
|
|
1190
|
-
break;
|
|
1191
|
-
}
|
|
1192
|
-
return true;
|
|
1193
|
-
}
|
|
1194
|
-
message(arg, type, allowExcessProperties, depth) {
|
|
1195
|
-
if (allowExcessProperties) {
|
|
1196
|
-
return type.isAssignable(arg, depth);
|
|
1197
|
-
}
|
|
1198
|
-
return type.is(arg, depth);
|
|
1199
|
-
}
|
|
1200
|
-
messages(arg, type, allowExcessProperties, depth) {
|
|
1201
|
-
if (!Array.isArray(arg))
|
|
1202
|
-
return false;
|
|
1203
|
-
if (depth < 2)
|
|
1204
|
-
return true;
|
|
1205
|
-
if (allowExcessProperties) {
|
|
1206
|
-
for (let i = 0; i < arg.length && i < depth; i++)
|
|
1207
|
-
if (!type.isAssignable(arg[i], depth - 1))
|
|
1208
|
-
return false;
|
|
1209
|
-
} else {
|
|
1210
|
-
for (let i = 0; i < arg.length && i < depth; i++)
|
|
1211
|
-
if (!type.is(arg[i], depth - 1))
|
|
1212
|
-
return false;
|
|
1213
|
-
}
|
|
1214
|
-
return true;
|
|
1215
|
-
}
|
|
1216
|
-
scalar(arg, type, longType) {
|
|
1217
|
-
let argType = typeof arg;
|
|
1218
|
-
switch (type) {
|
|
1219
|
-
case ScalarType.UINT64:
|
|
1220
|
-
case ScalarType.FIXED64:
|
|
1221
|
-
case ScalarType.INT64:
|
|
1222
|
-
case ScalarType.SFIXED64:
|
|
1223
|
-
case ScalarType.SINT64:
|
|
1224
|
-
switch (longType) {
|
|
1225
|
-
case LongType.BIGINT:
|
|
1226
|
-
return argType == "bigint";
|
|
1227
|
-
case LongType.NUMBER:
|
|
1228
|
-
return argType == "number" && !isNaN(arg);
|
|
1229
|
-
default:
|
|
1230
|
-
return argType == "string";
|
|
1231
|
-
}
|
|
1232
|
-
case ScalarType.BOOL:
|
|
1233
|
-
return argType == "boolean";
|
|
1234
|
-
case ScalarType.STRING:
|
|
1235
|
-
return argType == "string";
|
|
1236
|
-
case ScalarType.BYTES:
|
|
1237
|
-
return arg instanceof Uint8Array;
|
|
1238
|
-
case ScalarType.DOUBLE:
|
|
1239
|
-
case ScalarType.FLOAT:
|
|
1240
|
-
return argType == "number" && !isNaN(arg);
|
|
1241
|
-
default:
|
|
1242
|
-
return argType == "number" && Number.isInteger(arg);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
scalars(arg, type, depth, longType) {
|
|
1246
|
-
if (!Array.isArray(arg))
|
|
1247
|
-
return false;
|
|
1248
|
-
if (depth < 2)
|
|
1249
|
-
return true;
|
|
1250
|
-
if (Array.isArray(arg)) {
|
|
1251
|
-
for (let i = 0; i < arg.length && i < depth; i++)
|
|
1252
|
-
if (!this.scalar(arg[i], type, longType))
|
|
1253
|
-
return false;
|
|
1254
|
-
}
|
|
1255
|
-
return true;
|
|
1256
|
-
}
|
|
1257
|
-
mapKeys(map, type, depth) {
|
|
1258
|
-
let keys = Object.keys(map);
|
|
1259
|
-
switch (type) {
|
|
1260
|
-
case ScalarType.INT32:
|
|
1261
|
-
case ScalarType.FIXED32:
|
|
1262
|
-
case ScalarType.SFIXED32:
|
|
1263
|
-
case ScalarType.SINT32:
|
|
1264
|
-
case ScalarType.UINT32:
|
|
1265
|
-
return this.scalars(keys.slice(0, depth).map((k) => parseInt(k)), type, depth);
|
|
1266
|
-
case ScalarType.BOOL:
|
|
1267
|
-
return this.scalars(keys.slice(0, depth).map((k) => k == "true" ? true : k == "false" ? false : k), type, depth);
|
|
1268
|
-
default:
|
|
1269
|
-
return this.scalars(keys, type, depth, LongType.STRING);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
};
|
|
1273
|
-
|
|
1274
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-long-convert.js
|
|
1275
|
-
function reflectionLongConvert(long, type) {
|
|
1276
|
-
switch (type) {
|
|
1277
|
-
case LongType.BIGINT:
|
|
1278
|
-
return long.toBigInt();
|
|
1279
|
-
case LongType.NUMBER:
|
|
1280
|
-
return long.toNumber();
|
|
1281
|
-
default:
|
|
1282
|
-
return long.toString();
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-reader.js
|
|
1287
|
-
var ReflectionJsonReader = class {
|
|
1288
|
-
constructor(info) {
|
|
1289
|
-
this.info = info;
|
|
1290
|
-
}
|
|
1291
|
-
prepare() {
|
|
1292
|
-
var _a;
|
|
1293
|
-
if (this.fMap === void 0) {
|
|
1294
|
-
this.fMap = {};
|
|
1295
|
-
const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
|
|
1296
|
-
for (const field of fieldsInput) {
|
|
1297
|
-
this.fMap[field.name] = field;
|
|
1298
|
-
this.fMap[field.jsonName] = field;
|
|
1299
|
-
this.fMap[field.localName] = field;
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
// Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
|
|
1304
|
-
assert(condition, fieldName, jsonValue) {
|
|
1305
|
-
if (!condition) {
|
|
1306
|
-
let what = typeofJsonValue(jsonValue);
|
|
1307
|
-
if (what == "number" || what == "boolean")
|
|
1308
|
-
what = jsonValue.toString();
|
|
1309
|
-
throw new Error(`Cannot parse JSON ${what} for ${this.info.typeName}#${fieldName}`);
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Reads a message from canonical JSON format into the target message.
|
|
1314
|
-
*
|
|
1315
|
-
* Repeated fields are appended. Map entries are added, overwriting
|
|
1316
|
-
* existing keys.
|
|
1317
|
-
*
|
|
1318
|
-
* If a message field is already present, it will be merged with the
|
|
1319
|
-
* new data.
|
|
1320
|
-
*/
|
|
1321
|
-
read(input, message, options) {
|
|
1322
|
-
this.prepare();
|
|
1323
|
-
const oneofsHandled = [];
|
|
1324
|
-
for (const [jsonKey, jsonValue] of Object.entries(input)) {
|
|
1325
|
-
const field = this.fMap[jsonKey];
|
|
1326
|
-
if (!field) {
|
|
1327
|
-
if (!options.ignoreUnknownFields)
|
|
1328
|
-
throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${jsonKey}`);
|
|
1329
|
-
continue;
|
|
1330
|
-
}
|
|
1331
|
-
const localName = field.localName;
|
|
1332
|
-
let target;
|
|
1333
|
-
if (field.oneof) {
|
|
1334
|
-
if (jsonValue === null && (field.kind !== "enum" || field.T()[0] !== "google.protobuf.NullValue")) {
|
|
1335
|
-
continue;
|
|
1336
|
-
}
|
|
1337
|
-
if (oneofsHandled.includes(field.oneof))
|
|
1338
|
-
throw new Error(`Multiple members of the oneof group "${field.oneof}" of ${this.info.typeName} are present in JSON.`);
|
|
1339
|
-
oneofsHandled.push(field.oneof);
|
|
1340
|
-
target = message[field.oneof] = {
|
|
1341
|
-
oneofKind: localName
|
|
1342
|
-
};
|
|
1343
|
-
} else {
|
|
1344
|
-
target = message;
|
|
1345
|
-
}
|
|
1346
|
-
if (field.kind == "map") {
|
|
1347
|
-
if (jsonValue === null) {
|
|
1348
|
-
continue;
|
|
1349
|
-
}
|
|
1350
|
-
this.assert(isJsonObject(jsonValue), field.name, jsonValue);
|
|
1351
|
-
const fieldObj = target[localName];
|
|
1352
|
-
for (const [jsonObjKey, jsonObjValue] of Object.entries(jsonValue)) {
|
|
1353
|
-
this.assert(jsonObjValue !== null, field.name + " map value", null);
|
|
1354
|
-
let val;
|
|
1355
|
-
switch (field.V.kind) {
|
|
1356
|
-
case "message":
|
|
1357
|
-
val = field.V.T().internalJsonRead(jsonObjValue, options);
|
|
1358
|
-
break;
|
|
1359
|
-
case "enum":
|
|
1360
|
-
val = this.enum(field.V.T(), jsonObjValue, field.name, options.ignoreUnknownFields);
|
|
1361
|
-
if (val === false)
|
|
1362
|
-
continue;
|
|
1363
|
-
break;
|
|
1364
|
-
case "scalar":
|
|
1365
|
-
val = this.scalar(jsonObjValue, field.V.T, field.V.L, field.name);
|
|
1366
|
-
break;
|
|
1367
|
-
}
|
|
1368
|
-
this.assert(val !== void 0, field.name + " map value", jsonObjValue);
|
|
1369
|
-
let key = jsonObjKey;
|
|
1370
|
-
if (field.K == ScalarType.BOOL)
|
|
1371
|
-
key = key == "true" ? true : key == "false" ? false : key;
|
|
1372
|
-
key = this.scalar(key, field.K, LongType.STRING, field.name).toString();
|
|
1373
|
-
fieldObj[key] = val;
|
|
1374
|
-
}
|
|
1375
|
-
} else if (field.repeat) {
|
|
1376
|
-
if (jsonValue === null)
|
|
1377
|
-
continue;
|
|
1378
|
-
this.assert(Array.isArray(jsonValue), field.name, jsonValue);
|
|
1379
|
-
const fieldArr = target[localName];
|
|
1380
|
-
for (const jsonItem of jsonValue) {
|
|
1381
|
-
this.assert(jsonItem !== null, field.name, null);
|
|
1382
|
-
let val;
|
|
1383
|
-
switch (field.kind) {
|
|
1384
|
-
case "message":
|
|
1385
|
-
val = field.T().internalJsonRead(jsonItem, options);
|
|
1386
|
-
break;
|
|
1387
|
-
case "enum":
|
|
1388
|
-
val = this.enum(field.T(), jsonItem, field.name, options.ignoreUnknownFields);
|
|
1389
|
-
if (val === false)
|
|
1390
|
-
continue;
|
|
1391
|
-
break;
|
|
1392
|
-
case "scalar":
|
|
1393
|
-
val = this.scalar(jsonItem, field.T, field.L, field.name);
|
|
1394
|
-
break;
|
|
1395
|
-
}
|
|
1396
|
-
this.assert(val !== void 0, field.name, jsonValue);
|
|
1397
|
-
fieldArr.push(val);
|
|
1398
|
-
}
|
|
1399
|
-
} else {
|
|
1400
|
-
switch (field.kind) {
|
|
1401
|
-
case "message":
|
|
1402
|
-
if (jsonValue === null && field.T().typeName != "google.protobuf.Value") {
|
|
1403
|
-
this.assert(field.oneof === void 0, field.name + " (oneof member)", null);
|
|
1404
|
-
continue;
|
|
1405
|
-
}
|
|
1406
|
-
target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]);
|
|
1407
|
-
break;
|
|
1408
|
-
case "enum":
|
|
1409
|
-
if (jsonValue === null)
|
|
1410
|
-
continue;
|
|
1411
|
-
let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields);
|
|
1412
|
-
if (val === false)
|
|
1413
|
-
continue;
|
|
1414
|
-
target[localName] = val;
|
|
1415
|
-
break;
|
|
1416
|
-
case "scalar":
|
|
1417
|
-
if (jsonValue === null)
|
|
1418
|
-
continue;
|
|
1419
|
-
target[localName] = this.scalar(jsonValue, field.T, field.L, field.name);
|
|
1420
|
-
break;
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* Returns `false` for unrecognized string representations.
|
|
1427
|
-
*
|
|
1428
|
-
* google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
|
|
1429
|
-
*/
|
|
1430
|
-
enum(type, json, fieldName, ignoreUnknownFields) {
|
|
1431
|
-
if (type[0] == "google.protobuf.NullValue")
|
|
1432
|
-
assert(json === null || json === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} only accepts null.`);
|
|
1433
|
-
if (json === null)
|
|
1434
|
-
return 0;
|
|
1435
|
-
switch (typeof json) {
|
|
1436
|
-
case "number":
|
|
1437
|
-
assert(Number.isInteger(json), `Unable to parse field ${this.info.typeName}#${fieldName}, enum can only be integral number, got ${json}.`);
|
|
1438
|
-
return json;
|
|
1439
|
-
case "string":
|
|
1440
|
-
let localEnumName = json;
|
|
1441
|
-
if (type[2] && json.substring(0, type[2].length) === type[2])
|
|
1442
|
-
localEnumName = json.substring(type[2].length);
|
|
1443
|
-
let enumNumber = type[1][localEnumName];
|
|
1444
|
-
if (typeof enumNumber === "undefined" && ignoreUnknownFields) {
|
|
1445
|
-
return false;
|
|
1446
|
-
}
|
|
1447
|
-
assert(typeof enumNumber == "number", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} has no value for "${json}".`);
|
|
1448
|
-
return enumNumber;
|
|
1449
|
-
}
|
|
1450
|
-
assert(false, `Unable to parse field ${this.info.typeName}#${fieldName}, cannot parse enum value from ${typeof json}".`);
|
|
1451
|
-
}
|
|
1452
|
-
scalar(json, type, longType, fieldName) {
|
|
1453
|
-
let e;
|
|
1454
|
-
try {
|
|
1455
|
-
switch (type) {
|
|
1456
|
-
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
|
1457
|
-
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
|
1458
|
-
case ScalarType.DOUBLE:
|
|
1459
|
-
case ScalarType.FLOAT:
|
|
1460
|
-
if (json === null)
|
|
1461
|
-
return 0;
|
|
1462
|
-
if (json === "NaN")
|
|
1463
|
-
return Number.NaN;
|
|
1464
|
-
if (json === "Infinity")
|
|
1465
|
-
return Number.POSITIVE_INFINITY;
|
|
1466
|
-
if (json === "-Infinity")
|
|
1467
|
-
return Number.NEGATIVE_INFINITY;
|
|
1468
|
-
if (json === "") {
|
|
1469
|
-
e = "empty string";
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
if (typeof json == "string" && json.trim().length !== json.length) {
|
|
1473
|
-
e = "extra whitespace";
|
|
1474
|
-
break;
|
|
1475
|
-
}
|
|
1476
|
-
if (typeof json != "string" && typeof json != "number") {
|
|
1477
|
-
break;
|
|
1478
|
-
}
|
|
1479
|
-
let float = Number(json);
|
|
1480
|
-
if (Number.isNaN(float)) {
|
|
1481
|
-
e = "not a number";
|
|
1482
|
-
break;
|
|
1483
|
-
}
|
|
1484
|
-
if (!Number.isFinite(float)) {
|
|
1485
|
-
e = "too large or small";
|
|
1486
|
-
break;
|
|
1487
|
-
}
|
|
1488
|
-
if (type == ScalarType.FLOAT)
|
|
1489
|
-
assertFloat32(float);
|
|
1490
|
-
return float;
|
|
1491
|
-
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
|
1492
|
-
case ScalarType.INT32:
|
|
1493
|
-
case ScalarType.FIXED32:
|
|
1494
|
-
case ScalarType.SFIXED32:
|
|
1495
|
-
case ScalarType.SINT32:
|
|
1496
|
-
case ScalarType.UINT32:
|
|
1497
|
-
if (json === null)
|
|
1498
|
-
return 0;
|
|
1499
|
-
let int32;
|
|
1500
|
-
if (typeof json == "number")
|
|
1501
|
-
int32 = json;
|
|
1502
|
-
else if (json === "")
|
|
1503
|
-
e = "empty string";
|
|
1504
|
-
else if (typeof json == "string") {
|
|
1505
|
-
if (json.trim().length !== json.length)
|
|
1506
|
-
e = "extra whitespace";
|
|
1507
|
-
else
|
|
1508
|
-
int32 = Number(json);
|
|
1509
|
-
}
|
|
1510
|
-
if (int32 === void 0)
|
|
1511
|
-
break;
|
|
1512
|
-
if (type == ScalarType.UINT32)
|
|
1513
|
-
assertUInt32(int32);
|
|
1514
|
-
else
|
|
1515
|
-
assertInt32(int32);
|
|
1516
|
-
return int32;
|
|
1517
|
-
// int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.
|
|
1518
|
-
case ScalarType.INT64:
|
|
1519
|
-
case ScalarType.SFIXED64:
|
|
1520
|
-
case ScalarType.SINT64:
|
|
1521
|
-
if (json === null)
|
|
1522
|
-
return reflectionLongConvert(PbLong.ZERO, longType);
|
|
1523
|
-
if (typeof json != "number" && typeof json != "string")
|
|
1524
|
-
break;
|
|
1525
|
-
return reflectionLongConvert(PbLong.from(json), longType);
|
|
1526
|
-
case ScalarType.FIXED64:
|
|
1527
|
-
case ScalarType.UINT64:
|
|
1528
|
-
if (json === null)
|
|
1529
|
-
return reflectionLongConvert(PbULong.ZERO, longType);
|
|
1530
|
-
if (typeof json != "number" && typeof json != "string")
|
|
1531
|
-
break;
|
|
1532
|
-
return reflectionLongConvert(PbULong.from(json), longType);
|
|
1533
|
-
// bool:
|
|
1534
|
-
case ScalarType.BOOL:
|
|
1535
|
-
if (json === null)
|
|
1536
|
-
return false;
|
|
1537
|
-
if (typeof json !== "boolean")
|
|
1538
|
-
break;
|
|
1539
|
-
return json;
|
|
1540
|
-
// string:
|
|
1541
|
-
case ScalarType.STRING:
|
|
1542
|
-
if (json === null)
|
|
1543
|
-
return "";
|
|
1544
|
-
if (typeof json !== "string") {
|
|
1545
|
-
e = "extra whitespace";
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
try {
|
|
1549
|
-
encodeURIComponent(json);
|
|
1550
|
-
} catch (e2) {
|
|
1551
|
-
e2 = "invalid UTF8";
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
return json;
|
|
1555
|
-
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
|
1556
|
-
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
|
1557
|
-
case ScalarType.BYTES:
|
|
1558
|
-
if (json === null || json === "")
|
|
1559
|
-
return new Uint8Array(0);
|
|
1560
|
-
if (typeof json !== "string")
|
|
1561
|
-
break;
|
|
1562
|
-
return base64decode(json);
|
|
1563
|
-
}
|
|
1564
|
-
} catch (error) {
|
|
1565
|
-
e = error.message;
|
|
1566
|
-
}
|
|
1567
|
-
this.assert(false, fieldName + (e ? " - " + e : ""), json);
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-writer.js
|
|
1572
|
-
var ReflectionJsonWriter = class {
|
|
1573
|
-
constructor(info) {
|
|
1574
|
-
var _a;
|
|
1575
|
-
this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
|
|
1576
|
-
}
|
|
1577
|
-
/**
|
|
1578
|
-
* Converts the message to a JSON object, based on the field descriptors.
|
|
1579
|
-
*/
|
|
1580
|
-
write(message, options) {
|
|
1581
|
-
const json = {}, source = message;
|
|
1582
|
-
for (const field of this.fields) {
|
|
1583
|
-
if (!field.oneof) {
|
|
1584
|
-
let jsonValue2 = this.field(field, source[field.localName], options);
|
|
1585
|
-
if (jsonValue2 !== void 0)
|
|
1586
|
-
json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue2;
|
|
1587
|
-
continue;
|
|
1588
|
-
}
|
|
1589
|
-
const group = source[field.oneof];
|
|
1590
|
-
if (group.oneofKind !== field.localName)
|
|
1591
|
-
continue;
|
|
1592
|
-
const opt = field.kind == "scalar" || field.kind == "enum" ? Object.assign(Object.assign({}, options), { emitDefaultValues: true }) : options;
|
|
1593
|
-
let jsonValue = this.field(field, group[field.localName], opt);
|
|
1594
|
-
assert(jsonValue !== void 0);
|
|
1595
|
-
json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;
|
|
1596
|
-
}
|
|
1597
|
-
return json;
|
|
1598
|
-
}
|
|
1599
|
-
field(field, value, options) {
|
|
1600
|
-
let jsonValue = void 0;
|
|
1601
|
-
if (field.kind == "map") {
|
|
1602
|
-
assert(typeof value == "object" && value !== null);
|
|
1603
|
-
const jsonObj = {};
|
|
1604
|
-
switch (field.V.kind) {
|
|
1605
|
-
case "scalar":
|
|
1606
|
-
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
1607
|
-
const val = this.scalar(field.V.T, entryValue, field.name, false, true);
|
|
1608
|
-
assert(val !== void 0);
|
|
1609
|
-
jsonObj[entryKey.toString()] = val;
|
|
1610
|
-
}
|
|
1611
|
-
break;
|
|
1612
|
-
case "message":
|
|
1613
|
-
const messageType = field.V.T();
|
|
1614
|
-
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
1615
|
-
const val = this.message(messageType, entryValue, field.name, options);
|
|
1616
|
-
assert(val !== void 0);
|
|
1617
|
-
jsonObj[entryKey.toString()] = val;
|
|
1618
|
-
}
|
|
1619
|
-
break;
|
|
1620
|
-
case "enum":
|
|
1621
|
-
const enumInfo = field.V.T();
|
|
1622
|
-
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
1623
|
-
assert(entryValue === void 0 || typeof entryValue == "number");
|
|
1624
|
-
const val = this.enum(enumInfo, entryValue, field.name, false, true, options.enumAsInteger);
|
|
1625
|
-
assert(val !== void 0);
|
|
1626
|
-
jsonObj[entryKey.toString()] = val;
|
|
1627
|
-
}
|
|
1628
|
-
break;
|
|
1629
|
-
}
|
|
1630
|
-
if (options.emitDefaultValues || Object.keys(jsonObj).length > 0)
|
|
1631
|
-
jsonValue = jsonObj;
|
|
1632
|
-
} else if (field.repeat) {
|
|
1633
|
-
assert(Array.isArray(value));
|
|
1634
|
-
const jsonArr = [];
|
|
1635
|
-
switch (field.kind) {
|
|
1636
|
-
case "scalar":
|
|
1637
|
-
for (let i = 0; i < value.length; i++) {
|
|
1638
|
-
const val = this.scalar(field.T, value[i], field.name, field.opt, true);
|
|
1639
|
-
assert(val !== void 0);
|
|
1640
|
-
jsonArr.push(val);
|
|
1641
|
-
}
|
|
1642
|
-
break;
|
|
1643
|
-
case "enum":
|
|
1644
|
-
const enumInfo = field.T();
|
|
1645
|
-
for (let i = 0; i < value.length; i++) {
|
|
1646
|
-
assert(value[i] === void 0 || typeof value[i] == "number");
|
|
1647
|
-
const val = this.enum(enumInfo, value[i], field.name, field.opt, true, options.enumAsInteger);
|
|
1648
|
-
assert(val !== void 0);
|
|
1649
|
-
jsonArr.push(val);
|
|
1650
|
-
}
|
|
1651
|
-
break;
|
|
1652
|
-
case "message":
|
|
1653
|
-
const messageType = field.T();
|
|
1654
|
-
for (let i = 0; i < value.length; i++) {
|
|
1655
|
-
const val = this.message(messageType, value[i], field.name, options);
|
|
1656
|
-
assert(val !== void 0);
|
|
1657
|
-
jsonArr.push(val);
|
|
1658
|
-
}
|
|
1659
|
-
break;
|
|
1660
|
-
}
|
|
1661
|
-
if (options.emitDefaultValues || jsonArr.length > 0 || options.emitDefaultValues)
|
|
1662
|
-
jsonValue = jsonArr;
|
|
1663
|
-
} else {
|
|
1664
|
-
switch (field.kind) {
|
|
1665
|
-
case "scalar":
|
|
1666
|
-
jsonValue = this.scalar(field.T, value, field.name, field.opt, options.emitDefaultValues);
|
|
1667
|
-
break;
|
|
1668
|
-
case "enum":
|
|
1669
|
-
jsonValue = this.enum(field.T(), value, field.name, field.opt, options.emitDefaultValues, options.enumAsInteger);
|
|
1670
|
-
break;
|
|
1671
|
-
case "message":
|
|
1672
|
-
jsonValue = this.message(field.T(), value, field.name, options);
|
|
1673
|
-
break;
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
return jsonValue;
|
|
1677
|
-
}
|
|
1678
|
-
/**
|
|
1679
|
-
* Returns `null` as the default for google.protobuf.NullValue.
|
|
1680
|
-
*/
|
|
1681
|
-
enum(type, value, fieldName, optional, emitDefaultValues, enumAsInteger) {
|
|
1682
|
-
if (type[0] == "google.protobuf.NullValue")
|
|
1683
|
-
return !emitDefaultValues && !optional ? void 0 : null;
|
|
1684
|
-
if (value === void 0) {
|
|
1685
|
-
assert(optional);
|
|
1686
|
-
return void 0;
|
|
1687
|
-
}
|
|
1688
|
-
if (value === 0 && !emitDefaultValues && !optional)
|
|
1689
|
-
return void 0;
|
|
1690
|
-
assert(typeof value == "number");
|
|
1691
|
-
assert(Number.isInteger(value));
|
|
1692
|
-
if (enumAsInteger || !type[1].hasOwnProperty(value))
|
|
1693
|
-
return value;
|
|
1694
|
-
if (type[2])
|
|
1695
|
-
return type[2] + type[1][value];
|
|
1696
|
-
return type[1][value];
|
|
1697
|
-
}
|
|
1698
|
-
message(type, value, fieldName, options) {
|
|
1699
|
-
if (value === void 0)
|
|
1700
|
-
return options.emitDefaultValues ? null : void 0;
|
|
1701
|
-
return type.internalJsonWrite(value, options);
|
|
1702
|
-
}
|
|
1703
|
-
scalar(type, value, fieldName, optional, emitDefaultValues) {
|
|
1704
|
-
if (value === void 0) {
|
|
1705
|
-
assert(optional);
|
|
1706
|
-
return void 0;
|
|
1707
|
-
}
|
|
1708
|
-
const ed = emitDefaultValues || optional;
|
|
1709
|
-
switch (type) {
|
|
1710
|
-
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
|
1711
|
-
case ScalarType.INT32:
|
|
1712
|
-
case ScalarType.SFIXED32:
|
|
1713
|
-
case ScalarType.SINT32:
|
|
1714
|
-
if (value === 0)
|
|
1715
|
-
return ed ? 0 : void 0;
|
|
1716
|
-
assertInt32(value);
|
|
1717
|
-
return value;
|
|
1718
|
-
case ScalarType.FIXED32:
|
|
1719
|
-
case ScalarType.UINT32:
|
|
1720
|
-
if (value === 0)
|
|
1721
|
-
return ed ? 0 : void 0;
|
|
1722
|
-
assertUInt32(value);
|
|
1723
|
-
return value;
|
|
1724
|
-
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
|
1725
|
-
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
|
1726
|
-
case ScalarType.FLOAT:
|
|
1727
|
-
assertFloat32(value);
|
|
1728
|
-
case ScalarType.DOUBLE:
|
|
1729
|
-
if (value === 0)
|
|
1730
|
-
return ed ? 0 : void 0;
|
|
1731
|
-
assert(typeof value == "number");
|
|
1732
|
-
if (Number.isNaN(value))
|
|
1733
|
-
return "NaN";
|
|
1734
|
-
if (value === Number.POSITIVE_INFINITY)
|
|
1735
|
-
return "Infinity";
|
|
1736
|
-
if (value === Number.NEGATIVE_INFINITY)
|
|
1737
|
-
return "-Infinity";
|
|
1738
|
-
return value;
|
|
1739
|
-
// string:
|
|
1740
|
-
case ScalarType.STRING:
|
|
1741
|
-
if (value === "")
|
|
1742
|
-
return ed ? "" : void 0;
|
|
1743
|
-
assert(typeof value == "string");
|
|
1744
|
-
return value;
|
|
1745
|
-
// bool:
|
|
1746
|
-
case ScalarType.BOOL:
|
|
1747
|
-
if (value === false)
|
|
1748
|
-
return ed ? false : void 0;
|
|
1749
|
-
assert(typeof value == "boolean");
|
|
1750
|
-
return value;
|
|
1751
|
-
// JSON value will be a decimal string. Either numbers or strings are accepted.
|
|
1752
|
-
case ScalarType.UINT64:
|
|
1753
|
-
case ScalarType.FIXED64:
|
|
1754
|
-
assert(typeof value == "number" || typeof value == "string" || typeof value == "bigint");
|
|
1755
|
-
let ulong = PbULong.from(value);
|
|
1756
|
-
if (ulong.isZero() && !ed)
|
|
1757
|
-
return void 0;
|
|
1758
|
-
return ulong.toString();
|
|
1759
|
-
// JSON value will be a decimal string. Either numbers or strings are accepted.
|
|
1760
|
-
case ScalarType.INT64:
|
|
1761
|
-
case ScalarType.SFIXED64:
|
|
1762
|
-
case ScalarType.SINT64:
|
|
1763
|
-
assert(typeof value == "number" || typeof value == "string" || typeof value == "bigint");
|
|
1764
|
-
let long = PbLong.from(value);
|
|
1765
|
-
if (long.isZero() && !ed)
|
|
1766
|
-
return void 0;
|
|
1767
|
-
return long.toString();
|
|
1768
|
-
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
|
1769
|
-
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
|
1770
|
-
case ScalarType.BYTES:
|
|
1771
|
-
assert(value instanceof Uint8Array);
|
|
1772
|
-
if (!value.byteLength)
|
|
1773
|
-
return ed ? "" : void 0;
|
|
1774
|
-
return base64encode(value);
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
};
|
|
1778
|
-
|
|
1779
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-scalar-default.js
|
|
1780
|
-
function reflectionScalarDefault(type, longType = LongType.STRING) {
|
|
1781
|
-
switch (type) {
|
|
1782
|
-
case ScalarType.BOOL:
|
|
1783
|
-
return false;
|
|
1784
|
-
case ScalarType.UINT64:
|
|
1785
|
-
case ScalarType.FIXED64:
|
|
1786
|
-
return reflectionLongConvert(PbULong.ZERO, longType);
|
|
1787
|
-
case ScalarType.INT64:
|
|
1788
|
-
case ScalarType.SFIXED64:
|
|
1789
|
-
case ScalarType.SINT64:
|
|
1790
|
-
return reflectionLongConvert(PbLong.ZERO, longType);
|
|
1791
|
-
case ScalarType.DOUBLE:
|
|
1792
|
-
case ScalarType.FLOAT:
|
|
1793
|
-
return 0;
|
|
1794
|
-
case ScalarType.BYTES:
|
|
1795
|
-
return new Uint8Array(0);
|
|
1796
|
-
case ScalarType.STRING:
|
|
1797
|
-
return "";
|
|
1798
|
-
default:
|
|
1799
|
-
return 0;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-reader.js
|
|
1804
|
-
var ReflectionBinaryReader = class {
|
|
1805
|
-
constructor(info) {
|
|
1806
|
-
this.info = info;
|
|
1807
|
-
}
|
|
1808
|
-
prepare() {
|
|
1809
|
-
var _a;
|
|
1810
|
-
if (!this.fieldNoToField) {
|
|
1811
|
-
const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
|
|
1812
|
-
this.fieldNoToField = new Map(fieldsInput.map((field) => [field.no, field]));
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
/**
|
|
1816
|
-
* Reads a message from binary format into the target message.
|
|
1817
|
-
*
|
|
1818
|
-
* Repeated fields are appended. Map entries are added, overwriting
|
|
1819
|
-
* existing keys.
|
|
1820
|
-
*
|
|
1821
|
-
* If a message field is already present, it will be merged with the
|
|
1822
|
-
* new data.
|
|
1823
|
-
*/
|
|
1824
|
-
read(reader, message, options, length) {
|
|
1825
|
-
this.prepare();
|
|
1826
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1827
|
-
while (reader.pos < end) {
|
|
1828
|
-
const [fieldNo, wireType] = reader.tag(), field = this.fieldNoToField.get(fieldNo);
|
|
1829
|
-
if (!field) {
|
|
1830
|
-
let u = options.readUnknownField;
|
|
1831
|
-
if (u == "throw")
|
|
1832
|
-
throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.info.typeName}`);
|
|
1833
|
-
let d = reader.skip(wireType);
|
|
1834
|
-
if (u !== false)
|
|
1835
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.info.typeName, message, fieldNo, wireType, d);
|
|
1836
|
-
continue;
|
|
1837
|
-
}
|
|
1838
|
-
let target = message, repeated = field.repeat, localName = field.localName;
|
|
1839
|
-
if (field.oneof) {
|
|
1840
|
-
target = target[field.oneof];
|
|
1841
|
-
if (target.oneofKind !== localName)
|
|
1842
|
-
target = message[field.oneof] = {
|
|
1843
|
-
oneofKind: localName
|
|
1844
|
-
};
|
|
1845
|
-
}
|
|
1846
|
-
switch (field.kind) {
|
|
1847
|
-
case "scalar":
|
|
1848
|
-
case "enum":
|
|
1849
|
-
let T = field.kind == "enum" ? ScalarType.INT32 : field.T;
|
|
1850
|
-
let L = field.kind == "scalar" ? field.L : void 0;
|
|
1851
|
-
if (repeated) {
|
|
1852
|
-
let arr = target[localName];
|
|
1853
|
-
if (wireType == WireType.LengthDelimited && T != ScalarType.STRING && T != ScalarType.BYTES) {
|
|
1854
|
-
let e = reader.uint32() + reader.pos;
|
|
1855
|
-
while (reader.pos < e)
|
|
1856
|
-
arr.push(this.scalar(reader, T, L));
|
|
1857
|
-
} else
|
|
1858
|
-
arr.push(this.scalar(reader, T, L));
|
|
1859
|
-
} else
|
|
1860
|
-
target[localName] = this.scalar(reader, T, L);
|
|
1861
|
-
break;
|
|
1862
|
-
case "message":
|
|
1863
|
-
if (repeated) {
|
|
1864
|
-
let arr = target[localName];
|
|
1865
|
-
let msg = field.T().internalBinaryRead(reader, reader.uint32(), options);
|
|
1866
|
-
arr.push(msg);
|
|
1867
|
-
} else
|
|
1868
|
-
target[localName] = field.T().internalBinaryRead(reader, reader.uint32(), options, target[localName]);
|
|
1869
|
-
break;
|
|
1870
|
-
case "map":
|
|
1871
|
-
let [mapKey, mapVal] = this.mapEntry(field, reader, options);
|
|
1872
|
-
target[localName][mapKey] = mapVal;
|
|
1873
|
-
break;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
/**
|
|
1878
|
-
* Read a map field, expecting key field = 1, value field = 2
|
|
1879
|
-
*/
|
|
1880
|
-
mapEntry(field, reader, options) {
|
|
1881
|
-
let length = reader.uint32();
|
|
1882
|
-
let end = reader.pos + length;
|
|
1883
|
-
let key = void 0;
|
|
1884
|
-
let val = void 0;
|
|
1885
|
-
while (reader.pos < end) {
|
|
1886
|
-
let [fieldNo, wireType] = reader.tag();
|
|
1887
|
-
switch (fieldNo) {
|
|
1888
|
-
case 1:
|
|
1889
|
-
if (field.K == ScalarType.BOOL)
|
|
1890
|
-
key = reader.bool().toString();
|
|
1891
|
-
else
|
|
1892
|
-
key = this.scalar(reader, field.K, LongType.STRING);
|
|
1893
|
-
break;
|
|
1894
|
-
case 2:
|
|
1895
|
-
switch (field.V.kind) {
|
|
1896
|
-
case "scalar":
|
|
1897
|
-
val = this.scalar(reader, field.V.T, field.V.L);
|
|
1898
|
-
break;
|
|
1899
|
-
case "enum":
|
|
1900
|
-
val = reader.int32();
|
|
1901
|
-
break;
|
|
1902
|
-
case "message":
|
|
1903
|
-
val = field.V.T().internalBinaryRead(reader, reader.uint32(), options);
|
|
1904
|
-
break;
|
|
1905
|
-
}
|
|
1906
|
-
break;
|
|
1907
|
-
default:
|
|
1908
|
-
throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) in map entry for ${this.info.typeName}#${field.name}`);
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
if (key === void 0) {
|
|
1912
|
-
let keyRaw = reflectionScalarDefault(field.K);
|
|
1913
|
-
key = field.K == ScalarType.BOOL ? keyRaw.toString() : keyRaw;
|
|
1914
|
-
}
|
|
1915
|
-
if (val === void 0)
|
|
1916
|
-
switch (field.V.kind) {
|
|
1917
|
-
case "scalar":
|
|
1918
|
-
val = reflectionScalarDefault(field.V.T, field.V.L);
|
|
1919
|
-
break;
|
|
1920
|
-
case "enum":
|
|
1921
|
-
val = 0;
|
|
1922
|
-
break;
|
|
1923
|
-
case "message":
|
|
1924
|
-
val = field.V.T().create();
|
|
1925
|
-
break;
|
|
1926
|
-
}
|
|
1927
|
-
return [key, val];
|
|
1928
|
-
}
|
|
1929
|
-
scalar(reader, type, longType) {
|
|
1930
|
-
switch (type) {
|
|
1931
|
-
case ScalarType.INT32:
|
|
1932
|
-
return reader.int32();
|
|
1933
|
-
case ScalarType.STRING:
|
|
1934
|
-
return reader.string();
|
|
1935
|
-
case ScalarType.BOOL:
|
|
1936
|
-
return reader.bool();
|
|
1937
|
-
case ScalarType.DOUBLE:
|
|
1938
|
-
return reader.double();
|
|
1939
|
-
case ScalarType.FLOAT:
|
|
1940
|
-
return reader.float();
|
|
1941
|
-
case ScalarType.INT64:
|
|
1942
|
-
return reflectionLongConvert(reader.int64(), longType);
|
|
1943
|
-
case ScalarType.UINT64:
|
|
1944
|
-
return reflectionLongConvert(reader.uint64(), longType);
|
|
1945
|
-
case ScalarType.FIXED64:
|
|
1946
|
-
return reflectionLongConvert(reader.fixed64(), longType);
|
|
1947
|
-
case ScalarType.FIXED32:
|
|
1948
|
-
return reader.fixed32();
|
|
1949
|
-
case ScalarType.BYTES:
|
|
1950
|
-
return reader.bytes();
|
|
1951
|
-
case ScalarType.UINT32:
|
|
1952
|
-
return reader.uint32();
|
|
1953
|
-
case ScalarType.SFIXED32:
|
|
1954
|
-
return reader.sfixed32();
|
|
1955
|
-
case ScalarType.SFIXED64:
|
|
1956
|
-
return reflectionLongConvert(reader.sfixed64(), longType);
|
|
1957
|
-
case ScalarType.SINT32:
|
|
1958
|
-
return reader.sint32();
|
|
1959
|
-
case ScalarType.SINT64:
|
|
1960
|
-
return reflectionLongConvert(reader.sint64(), longType);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
};
|
|
1964
|
-
|
|
1965
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-writer.js
|
|
1966
|
-
var ReflectionBinaryWriter = class {
|
|
1967
|
-
constructor(info) {
|
|
1968
|
-
this.info = info;
|
|
1969
|
-
}
|
|
1970
|
-
prepare() {
|
|
1971
|
-
if (!this.fields) {
|
|
1972
|
-
const fieldsInput = this.info.fields ? this.info.fields.concat() : [];
|
|
1973
|
-
this.fields = fieldsInput.sort((a, b) => a.no - b.no);
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Writes the message to binary format.
|
|
1978
|
-
*/
|
|
1979
|
-
write(message, writer, options) {
|
|
1980
|
-
this.prepare();
|
|
1981
|
-
for (const field of this.fields) {
|
|
1982
|
-
let value, emitDefault, repeated = field.repeat, localName = field.localName;
|
|
1983
|
-
if (field.oneof) {
|
|
1984
|
-
const group = message[field.oneof];
|
|
1985
|
-
if (group.oneofKind !== localName)
|
|
1986
|
-
continue;
|
|
1987
|
-
value = group[localName];
|
|
1988
|
-
emitDefault = true;
|
|
1989
|
-
} else {
|
|
1990
|
-
value = message[localName];
|
|
1991
|
-
emitDefault = false;
|
|
1992
|
-
}
|
|
1993
|
-
switch (field.kind) {
|
|
1994
|
-
case "scalar":
|
|
1995
|
-
case "enum":
|
|
1996
|
-
let T = field.kind == "enum" ? ScalarType.INT32 : field.T;
|
|
1997
|
-
if (repeated) {
|
|
1998
|
-
assert(Array.isArray(value));
|
|
1999
|
-
if (repeated == RepeatType.PACKED)
|
|
2000
|
-
this.packed(writer, T, field.no, value);
|
|
2001
|
-
else
|
|
2002
|
-
for (const item of value)
|
|
2003
|
-
this.scalar(writer, T, field.no, item, true);
|
|
2004
|
-
} else if (value === void 0)
|
|
2005
|
-
assert(field.opt);
|
|
2006
|
-
else
|
|
2007
|
-
this.scalar(writer, T, field.no, value, emitDefault || field.opt);
|
|
2008
|
-
break;
|
|
2009
|
-
case "message":
|
|
2010
|
-
if (repeated) {
|
|
2011
|
-
assert(Array.isArray(value));
|
|
2012
|
-
for (const item of value)
|
|
2013
|
-
this.message(writer, options, field.T(), field.no, item);
|
|
2014
|
-
} else {
|
|
2015
|
-
this.message(writer, options, field.T(), field.no, value);
|
|
2016
|
-
}
|
|
2017
|
-
break;
|
|
2018
|
-
case "map":
|
|
2019
|
-
assert(typeof value == "object" && value !== null);
|
|
2020
|
-
for (const [key, val] of Object.entries(value))
|
|
2021
|
-
this.mapEntry(writer, options, field, key, val);
|
|
2022
|
-
break;
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
let u = options.writeUnknownFields;
|
|
2026
|
-
if (u !== false)
|
|
2027
|
-
(u === true ? UnknownFieldHandler.onWrite : u)(this.info.typeName, message, writer);
|
|
2028
|
-
}
|
|
2029
|
-
mapEntry(writer, options, field, key, value) {
|
|
2030
|
-
writer.tag(field.no, WireType.LengthDelimited);
|
|
2031
|
-
writer.fork();
|
|
2032
|
-
let keyValue = key;
|
|
2033
|
-
switch (field.K) {
|
|
2034
|
-
case ScalarType.INT32:
|
|
2035
|
-
case ScalarType.FIXED32:
|
|
2036
|
-
case ScalarType.UINT32:
|
|
2037
|
-
case ScalarType.SFIXED32:
|
|
2038
|
-
case ScalarType.SINT32:
|
|
2039
|
-
keyValue = Number.parseInt(key);
|
|
2040
|
-
break;
|
|
2041
|
-
case ScalarType.BOOL:
|
|
2042
|
-
assert(key == "true" || key == "false");
|
|
2043
|
-
keyValue = key == "true";
|
|
2044
|
-
break;
|
|
2045
|
-
}
|
|
2046
|
-
this.scalar(writer, field.K, 1, keyValue, true);
|
|
2047
|
-
switch (field.V.kind) {
|
|
2048
|
-
case "scalar":
|
|
2049
|
-
this.scalar(writer, field.V.T, 2, value, true);
|
|
2050
|
-
break;
|
|
2051
|
-
case "enum":
|
|
2052
|
-
this.scalar(writer, ScalarType.INT32, 2, value, true);
|
|
2053
|
-
break;
|
|
2054
|
-
case "message":
|
|
2055
|
-
this.message(writer, options, field.V.T(), 2, value);
|
|
2056
|
-
break;
|
|
2057
|
-
}
|
|
2058
|
-
writer.join();
|
|
2059
|
-
}
|
|
2060
|
-
message(writer, options, handler, fieldNo, value) {
|
|
2061
|
-
if (value === void 0)
|
|
2062
|
-
return;
|
|
2063
|
-
handler.internalBinaryWrite(value, writer.tag(fieldNo, WireType.LengthDelimited).fork(), options);
|
|
2064
|
-
writer.join();
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* Write a single scalar value.
|
|
2068
|
-
*/
|
|
2069
|
-
scalar(writer, type, fieldNo, value, emitDefault) {
|
|
2070
|
-
let [wireType, method, isDefault] = this.scalarInfo(type, value);
|
|
2071
|
-
if (!isDefault || emitDefault) {
|
|
2072
|
-
writer.tag(fieldNo, wireType);
|
|
2073
|
-
writer[method](value);
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
/**
|
|
2077
|
-
* Write an array of scalar values in packed format.
|
|
2078
|
-
*/
|
|
2079
|
-
packed(writer, type, fieldNo, value) {
|
|
2080
|
-
if (!value.length)
|
|
2081
|
-
return;
|
|
2082
|
-
assert(type !== ScalarType.BYTES && type !== ScalarType.STRING);
|
|
2083
|
-
writer.tag(fieldNo, WireType.LengthDelimited);
|
|
2084
|
-
writer.fork();
|
|
2085
|
-
let [, method] = this.scalarInfo(type);
|
|
2086
|
-
for (let i = 0; i < value.length; i++)
|
|
2087
|
-
writer[method](value[i]);
|
|
2088
|
-
writer.join();
|
|
2089
|
-
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Get information for writing a scalar value.
|
|
2092
|
-
*
|
|
2093
|
-
* Returns tuple:
|
|
2094
|
-
* [0]: appropriate WireType
|
|
2095
|
-
* [1]: name of the appropriate method of IBinaryWriter
|
|
2096
|
-
* [2]: whether the given value is a default value
|
|
2097
|
-
*
|
|
2098
|
-
* If argument `value` is omitted, [2] is always false.
|
|
2099
|
-
*/
|
|
2100
|
-
scalarInfo(type, value) {
|
|
2101
|
-
let t = WireType.Varint;
|
|
2102
|
-
let m;
|
|
2103
|
-
let i = value === void 0;
|
|
2104
|
-
let d = value === 0;
|
|
2105
|
-
switch (type) {
|
|
2106
|
-
case ScalarType.INT32:
|
|
2107
|
-
m = "int32";
|
|
2108
|
-
break;
|
|
2109
|
-
case ScalarType.STRING:
|
|
2110
|
-
d = i || !value.length;
|
|
2111
|
-
t = WireType.LengthDelimited;
|
|
2112
|
-
m = "string";
|
|
2113
|
-
break;
|
|
2114
|
-
case ScalarType.BOOL:
|
|
2115
|
-
d = value === false;
|
|
2116
|
-
m = "bool";
|
|
2117
|
-
break;
|
|
2118
|
-
case ScalarType.UINT32:
|
|
2119
|
-
m = "uint32";
|
|
2120
|
-
break;
|
|
2121
|
-
case ScalarType.DOUBLE:
|
|
2122
|
-
t = WireType.Bit64;
|
|
2123
|
-
m = "double";
|
|
2124
|
-
break;
|
|
2125
|
-
case ScalarType.FLOAT:
|
|
2126
|
-
t = WireType.Bit32;
|
|
2127
|
-
m = "float";
|
|
2128
|
-
break;
|
|
2129
|
-
case ScalarType.INT64:
|
|
2130
|
-
d = i || PbLong.from(value).isZero();
|
|
2131
|
-
m = "int64";
|
|
2132
|
-
break;
|
|
2133
|
-
case ScalarType.UINT64:
|
|
2134
|
-
d = i || PbULong.from(value).isZero();
|
|
2135
|
-
m = "uint64";
|
|
2136
|
-
break;
|
|
2137
|
-
case ScalarType.FIXED64:
|
|
2138
|
-
d = i || PbULong.from(value).isZero();
|
|
2139
|
-
t = WireType.Bit64;
|
|
2140
|
-
m = "fixed64";
|
|
2141
|
-
break;
|
|
2142
|
-
case ScalarType.BYTES:
|
|
2143
|
-
d = i || !value.byteLength;
|
|
2144
|
-
t = WireType.LengthDelimited;
|
|
2145
|
-
m = "bytes";
|
|
2146
|
-
break;
|
|
2147
|
-
case ScalarType.FIXED32:
|
|
2148
|
-
t = WireType.Bit32;
|
|
2149
|
-
m = "fixed32";
|
|
2150
|
-
break;
|
|
2151
|
-
case ScalarType.SFIXED32:
|
|
2152
|
-
t = WireType.Bit32;
|
|
2153
|
-
m = "sfixed32";
|
|
2154
|
-
break;
|
|
2155
|
-
case ScalarType.SFIXED64:
|
|
2156
|
-
d = i || PbLong.from(value).isZero();
|
|
2157
|
-
t = WireType.Bit64;
|
|
2158
|
-
m = "sfixed64";
|
|
2159
|
-
break;
|
|
2160
|
-
case ScalarType.SINT32:
|
|
2161
|
-
m = "sint32";
|
|
2162
|
-
break;
|
|
2163
|
-
case ScalarType.SINT64:
|
|
2164
|
-
d = i || PbLong.from(value).isZero();
|
|
2165
|
-
m = "sint64";
|
|
2166
|
-
break;
|
|
2167
|
-
}
|
|
2168
|
-
return [t, m, i || d];
|
|
2169
|
-
}
|
|
2170
|
-
};
|
|
2171
|
-
|
|
2172
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-create.js
|
|
2173
|
-
function reflectionCreate(type) {
|
|
2174
|
-
const msg = type.messagePrototype ? Object.create(type.messagePrototype) : Object.defineProperty({}, MESSAGE_TYPE, { value: type });
|
|
2175
|
-
for (let field of type.fields) {
|
|
2176
|
-
let name = field.localName;
|
|
2177
|
-
if (field.opt)
|
|
2178
|
-
continue;
|
|
2179
|
-
if (field.oneof)
|
|
2180
|
-
msg[field.oneof] = { oneofKind: void 0 };
|
|
2181
|
-
else if (field.repeat)
|
|
2182
|
-
msg[name] = [];
|
|
2183
|
-
else
|
|
2184
|
-
switch (field.kind) {
|
|
2185
|
-
case "scalar":
|
|
2186
|
-
msg[name] = reflectionScalarDefault(field.T, field.L);
|
|
2187
|
-
break;
|
|
2188
|
-
case "enum":
|
|
2189
|
-
msg[name] = 0;
|
|
2190
|
-
break;
|
|
2191
|
-
case "map":
|
|
2192
|
-
msg[name] = {};
|
|
2193
|
-
break;
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
return msg;
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-merge-partial.js
|
|
2200
|
-
function reflectionMergePartial(info, target, source) {
|
|
2201
|
-
let fieldValue, input = source, output;
|
|
2202
|
-
for (let field of info.fields) {
|
|
2203
|
-
let name = field.localName;
|
|
2204
|
-
if (field.oneof) {
|
|
2205
|
-
const group = input[field.oneof];
|
|
2206
|
-
if ((group === null || group === void 0 ? void 0 : group.oneofKind) == void 0) {
|
|
2207
|
-
continue;
|
|
2208
|
-
}
|
|
2209
|
-
fieldValue = group[name];
|
|
2210
|
-
output = target[field.oneof];
|
|
2211
|
-
output.oneofKind = group.oneofKind;
|
|
2212
|
-
if (fieldValue == void 0) {
|
|
2213
|
-
delete output[name];
|
|
2214
|
-
continue;
|
|
2215
|
-
}
|
|
2216
|
-
} else {
|
|
2217
|
-
fieldValue = input[name];
|
|
2218
|
-
output = target;
|
|
2219
|
-
if (fieldValue == void 0) {
|
|
2220
|
-
continue;
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
if (field.repeat)
|
|
2224
|
-
output[name].length = fieldValue.length;
|
|
2225
|
-
switch (field.kind) {
|
|
2226
|
-
case "scalar":
|
|
2227
|
-
case "enum":
|
|
2228
|
-
if (field.repeat)
|
|
2229
|
-
for (let i = 0; i < fieldValue.length; i++)
|
|
2230
|
-
output[name][i] = fieldValue[i];
|
|
2231
|
-
else
|
|
2232
|
-
output[name] = fieldValue;
|
|
2233
|
-
break;
|
|
2234
|
-
case "message":
|
|
2235
|
-
let T = field.T();
|
|
2236
|
-
if (field.repeat)
|
|
2237
|
-
for (let i = 0; i < fieldValue.length; i++)
|
|
2238
|
-
output[name][i] = T.create(fieldValue[i]);
|
|
2239
|
-
else if (output[name] === void 0)
|
|
2240
|
-
output[name] = T.create(fieldValue);
|
|
2241
|
-
else
|
|
2242
|
-
T.mergePartial(output[name], fieldValue);
|
|
2243
|
-
break;
|
|
2244
|
-
case "map":
|
|
2245
|
-
switch (field.V.kind) {
|
|
2246
|
-
case "scalar":
|
|
2247
|
-
case "enum":
|
|
2248
|
-
Object.assign(output[name], fieldValue);
|
|
2249
|
-
break;
|
|
2250
|
-
case "message":
|
|
2251
|
-
let T2 = field.V.T();
|
|
2252
|
-
for (let k of Object.keys(fieldValue))
|
|
2253
|
-
output[name][k] = T2.create(fieldValue[k]);
|
|
2254
|
-
break;
|
|
2255
|
-
}
|
|
2256
|
-
break;
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/reflection-equals.js
|
|
2262
|
-
function reflectionEquals(info, a, b) {
|
|
2263
|
-
if (a === b)
|
|
2264
|
-
return true;
|
|
2265
|
-
if (!a || !b)
|
|
2266
|
-
return false;
|
|
2267
|
-
for (let field of info.fields) {
|
|
2268
|
-
let localName = field.localName;
|
|
2269
|
-
let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
|
|
2270
|
-
let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
|
|
2271
|
-
switch (field.kind) {
|
|
2272
|
-
case "enum":
|
|
2273
|
-
case "scalar":
|
|
2274
|
-
let t = field.kind == "enum" ? ScalarType.INT32 : field.T;
|
|
2275
|
-
if (!(field.repeat ? repeatedPrimitiveEq(t, val_a, val_b) : primitiveEq(t, val_a, val_b)))
|
|
2276
|
-
return false;
|
|
2277
|
-
break;
|
|
2278
|
-
case "map":
|
|
2279
|
-
if (!(field.V.kind == "message" ? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b)) : repeatedPrimitiveEq(field.V.kind == "enum" ? ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))
|
|
2280
|
-
return false;
|
|
2281
|
-
break;
|
|
2282
|
-
case "message":
|
|
2283
|
-
let T = field.T();
|
|
2284
|
-
if (!(field.repeat ? repeatedMsgEq(T, val_a, val_b) : T.equals(val_a, val_b)))
|
|
2285
|
-
return false;
|
|
2286
|
-
break;
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
return true;
|
|
2290
|
-
}
|
|
2291
|
-
var objectValues = Object.values;
|
|
2292
|
-
function primitiveEq(type, a, b) {
|
|
2293
|
-
if (a === b)
|
|
2294
|
-
return true;
|
|
2295
|
-
if (type !== ScalarType.BYTES)
|
|
2296
|
-
return false;
|
|
2297
|
-
let ba = a;
|
|
2298
|
-
let bb = b;
|
|
2299
|
-
if (ba.length !== bb.length)
|
|
2300
|
-
return false;
|
|
2301
|
-
for (let i = 0; i < ba.length; i++)
|
|
2302
|
-
if (ba[i] != bb[i])
|
|
2303
|
-
return false;
|
|
2304
|
-
return true;
|
|
2305
|
-
}
|
|
2306
|
-
function repeatedPrimitiveEq(type, a, b) {
|
|
2307
|
-
if (a.length !== b.length)
|
|
2308
|
-
return false;
|
|
2309
|
-
for (let i = 0; i < a.length; i++)
|
|
2310
|
-
if (!primitiveEq(type, a[i], b[i]))
|
|
2311
|
-
return false;
|
|
2312
|
-
return true;
|
|
2313
|
-
}
|
|
2314
|
-
function repeatedMsgEq(type, a, b) {
|
|
2315
|
-
if (a.length !== b.length)
|
|
2316
|
-
return false;
|
|
2317
|
-
for (let i = 0; i < a.length; i++)
|
|
2318
|
-
if (!type.equals(a[i], b[i]))
|
|
2319
|
-
return false;
|
|
2320
|
-
return true;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
// node_modules/@protobuf-ts/runtime/build/es2015/message-type.js
|
|
2324
|
-
var baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
|
|
2325
|
-
var MessageType = class {
|
|
2326
|
-
constructor(name, fields, options) {
|
|
2327
|
-
this.defaultCheckDepth = 16;
|
|
2328
|
-
this.typeName = name;
|
|
2329
|
-
this.fields = fields.map(normalizeFieldInfo);
|
|
2330
|
-
this.options = options !== null && options !== void 0 ? options : {};
|
|
2331
|
-
this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [MESSAGE_TYPE]: { value: this } }));
|
|
2332
|
-
this.refTypeCheck = new ReflectionTypeCheck(this);
|
|
2333
|
-
this.refJsonReader = new ReflectionJsonReader(this);
|
|
2334
|
-
this.refJsonWriter = new ReflectionJsonWriter(this);
|
|
2335
|
-
this.refBinReader = new ReflectionBinaryReader(this);
|
|
2336
|
-
this.refBinWriter = new ReflectionBinaryWriter(this);
|
|
2337
|
-
}
|
|
2338
|
-
create(value) {
|
|
2339
|
-
let message = reflectionCreate(this);
|
|
2340
|
-
if (value !== void 0) {
|
|
2341
|
-
reflectionMergePartial(this, message, value);
|
|
2342
|
-
}
|
|
2343
|
-
return message;
|
|
2344
|
-
}
|
|
2345
|
-
/**
|
|
2346
|
-
* Clone the message.
|
|
2347
|
-
*
|
|
2348
|
-
* Unknown fields are discarded.
|
|
2349
|
-
*/
|
|
2350
|
-
clone(message) {
|
|
2351
|
-
let copy = this.create();
|
|
2352
|
-
reflectionMergePartial(this, copy, message);
|
|
2353
|
-
return copy;
|
|
2354
|
-
}
|
|
2355
|
-
/**
|
|
2356
|
-
* Determines whether two message of the same type have the same field values.
|
|
2357
|
-
* Checks for deep equality, traversing repeated fields, oneof groups, maps
|
|
2358
|
-
* and messages recursively.
|
|
2359
|
-
* Will also return true if both messages are `undefined`.
|
|
2360
|
-
*/
|
|
2361
|
-
equals(a, b) {
|
|
2362
|
-
return reflectionEquals(this, a, b);
|
|
2363
|
-
}
|
|
2364
|
-
/**
|
|
2365
|
-
* Is the given value assignable to our message type
|
|
2366
|
-
* and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
|
|
2367
|
-
*/
|
|
2368
|
-
is(arg, depth = this.defaultCheckDepth) {
|
|
2369
|
-
return this.refTypeCheck.is(arg, depth, false);
|
|
2370
|
-
}
|
|
2371
|
-
/**
|
|
2372
|
-
* Is the given value assignable to our message type,
|
|
2373
|
-
* regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
|
|
2374
|
-
*/
|
|
2375
|
-
isAssignable(arg, depth = this.defaultCheckDepth) {
|
|
2376
|
-
return this.refTypeCheck.is(arg, depth, true);
|
|
2377
|
-
}
|
|
2378
|
-
/**
|
|
2379
|
-
* Copy partial data into the target message.
|
|
2380
|
-
*/
|
|
2381
|
-
mergePartial(target, source) {
|
|
2382
|
-
reflectionMergePartial(this, target, source);
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* Create a new message from binary format.
|
|
2386
|
-
*/
|
|
2387
|
-
fromBinary(data, options) {
|
|
2388
|
-
let opt = binaryReadOptions(options);
|
|
2389
|
-
return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);
|
|
2390
|
-
}
|
|
2391
|
-
/**
|
|
2392
|
-
* Read a new message from a JSON value.
|
|
2393
|
-
*/
|
|
2394
|
-
fromJson(json, options) {
|
|
2395
|
-
return this.internalJsonRead(json, jsonReadOptions(options));
|
|
2396
|
-
}
|
|
2397
|
-
/**
|
|
2398
|
-
* Read a new message from a JSON string.
|
|
2399
|
-
* This is equivalent to `T.fromJson(JSON.parse(json))`.
|
|
2400
|
-
*/
|
|
2401
|
-
fromJsonString(json, options) {
|
|
2402
|
-
let value = JSON.parse(json);
|
|
2403
|
-
return this.fromJson(value, options);
|
|
2404
|
-
}
|
|
2405
|
-
/**
|
|
2406
|
-
* Write the message to canonical JSON value.
|
|
2407
|
-
*/
|
|
2408
|
-
toJson(message, options) {
|
|
2409
|
-
return this.internalJsonWrite(message, jsonWriteOptions(options));
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Convert the message to canonical JSON string.
|
|
2413
|
-
* This is equivalent to `JSON.stringify(T.toJson(t))`
|
|
2414
|
-
*/
|
|
2415
|
-
toJsonString(message, options) {
|
|
2416
|
-
var _a;
|
|
2417
|
-
let value = this.toJson(message, options);
|
|
2418
|
-
return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);
|
|
2419
|
-
}
|
|
2420
|
-
/**
|
|
2421
|
-
* Write the message to binary format.
|
|
2422
|
-
*/
|
|
2423
|
-
toBinary(message, options) {
|
|
2424
|
-
let opt = binaryWriteOptions(options);
|
|
2425
|
-
return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();
|
|
2426
|
-
}
|
|
2427
|
-
/**
|
|
2428
|
-
* This is an internal method. If you just want to read a message from
|
|
2429
|
-
* JSON, use `fromJson()` or `fromJsonString()`.
|
|
2430
|
-
*
|
|
2431
|
-
* Reads JSON value and merges the fields into the target
|
|
2432
|
-
* according to protobuf rules. If the target is omitted,
|
|
2433
|
-
* a new instance is created first.
|
|
2434
|
-
*/
|
|
2435
|
-
internalJsonRead(json, options, target) {
|
|
2436
|
-
if (json !== null && typeof json == "object" && !Array.isArray(json)) {
|
|
2437
|
-
let message = target !== null && target !== void 0 ? target : this.create();
|
|
2438
|
-
this.refJsonReader.read(json, message, options);
|
|
2439
|
-
return message;
|
|
2440
|
-
}
|
|
2441
|
-
throw new Error(`Unable to parse message ${this.typeName} from JSON ${typeofJsonValue(json)}.`);
|
|
2442
|
-
}
|
|
2443
|
-
/**
|
|
2444
|
-
* This is an internal method. If you just want to write a message
|
|
2445
|
-
* to JSON, use `toJson()` or `toJsonString().
|
|
2446
|
-
*
|
|
2447
|
-
* Writes JSON value and returns it.
|
|
2448
|
-
*/
|
|
2449
|
-
internalJsonWrite(message, options) {
|
|
2450
|
-
return this.refJsonWriter.write(message, options);
|
|
2451
|
-
}
|
|
2452
|
-
/**
|
|
2453
|
-
* This is an internal method. If you just want to write a message
|
|
2454
|
-
* in binary format, use `toBinary()`.
|
|
2455
|
-
*
|
|
2456
|
-
* Serializes the message in binary format and appends it to the given
|
|
2457
|
-
* writer. Returns passed writer.
|
|
2458
|
-
*/
|
|
2459
|
-
internalBinaryWrite(message, writer, options) {
|
|
2460
|
-
this.refBinWriter.write(message, writer, options);
|
|
2461
|
-
return writer;
|
|
2462
|
-
}
|
|
2463
|
-
/**
|
|
2464
|
-
* This is an internal method. If you just want to read a message from
|
|
2465
|
-
* binary data, use `fromBinary()`.
|
|
2466
|
-
*
|
|
2467
|
-
* Reads data from binary format and merges the fields into
|
|
2468
|
-
* the target according to protobuf rules. If the target is
|
|
2469
|
-
* omitted, a new instance is created first.
|
|
2470
|
-
*/
|
|
2471
|
-
internalBinaryRead(reader, length, options, target) {
|
|
2472
|
-
let message = target !== null && target !== void 0 ? target : this.create();
|
|
2473
|
-
this.refBinReader.read(reader, message, options, length);
|
|
2474
|
-
return message;
|
|
2475
|
-
}
|
|
2476
|
-
};
|
|
2477
|
-
|
|
2478
35
|
// lib/common.ts
|
|
36
|
+
var import_runtime = require("@protobuf-ts/runtime");
|
|
37
|
+
var import_runtime2 = require("@protobuf-ts/runtime");
|
|
38
|
+
var import_runtime3 = require("@protobuf-ts/runtime");
|
|
39
|
+
var import_runtime4 = require("@protobuf-ts/runtime");
|
|
2479
40
|
var TestStatus = /* @__PURE__ */ ((TestStatus2) => {
|
|
2480
41
|
TestStatus2[TestStatus2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
2481
42
|
TestStatus2[TestStatus2["PASSED"] = 1] = "PASSED";
|
|
@@ -2484,7 +45,7 @@ var TestStatus = /* @__PURE__ */ ((TestStatus2) => {
|
|
|
2484
45
|
TestStatus2[TestStatus2["BROKEN"] = 4] = "BROKEN";
|
|
2485
46
|
return TestStatus2;
|
|
2486
47
|
})(TestStatus || {});
|
|
2487
|
-
var Attachment$Type = class extends MessageType {
|
|
48
|
+
var Attachment$Type = class extends import_runtime4.MessageType {
|
|
2488
49
|
constructor() {
|
|
2489
50
|
super("testsystem.common.Attachment", [
|
|
2490
51
|
{
|
|
@@ -2516,11 +77,11 @@ var Attachment$Type = class extends MessageType {
|
|
|
2516
77
|
message.mimeType = "";
|
|
2517
78
|
message.content = new Uint8Array(0);
|
|
2518
79
|
if (value !== void 0)
|
|
2519
|
-
reflectionMergePartial(this, message, value);
|
|
80
|
+
(0, import_runtime3.reflectionMergePartial)(this, message, value);
|
|
2520
81
|
return message;
|
|
2521
82
|
}
|
|
2522
83
|
internalBinaryRead(reader, length, options, target) {
|
|
2523
|
-
let message = target
|
|
84
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2524
85
|
while (reader.pos < end) {
|
|
2525
86
|
let [fieldNo, wireType] = reader.tag();
|
|
2526
87
|
switch (fieldNo) {
|
|
@@ -2542,28 +103,40 @@ var Attachment$Type = class extends MessageType {
|
|
|
2542
103
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2543
104
|
let d = reader.skip(wireType);
|
|
2544
105
|
if (u !== false)
|
|
2545
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
106
|
+
(u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2546
107
|
}
|
|
2547
108
|
}
|
|
2548
109
|
return message;
|
|
2549
110
|
}
|
|
2550
111
|
internalBinaryWrite(message, writer, options) {
|
|
2551
112
|
if (message.name !== "")
|
|
2552
|
-
writer.tag(1, WireType.LengthDelimited).string(message.name);
|
|
113
|
+
writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.name);
|
|
2553
114
|
if (message.mimeType !== "")
|
|
2554
|
-
writer.tag(2, WireType.LengthDelimited).string(message.mimeType);
|
|
115
|
+
writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.mimeType);
|
|
2555
116
|
if (message.content.length)
|
|
2556
|
-
writer.tag(3, WireType.LengthDelimited).bytes(message.content);
|
|
117
|
+
writer.tag(3, import_runtime.WireType.LengthDelimited).bytes(message.content);
|
|
2557
118
|
let u = options.writeUnknownFields;
|
|
2558
119
|
if (u !== false)
|
|
2559
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
120
|
+
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2560
121
|
return writer;
|
|
2561
122
|
}
|
|
2562
123
|
};
|
|
2563
124
|
var Attachment = new Attachment$Type();
|
|
2564
125
|
|
|
126
|
+
// lib/events.ts
|
|
127
|
+
var import_runtime11 = require("@protobuf-ts/runtime");
|
|
128
|
+
var import_runtime12 = require("@protobuf-ts/runtime");
|
|
129
|
+
var import_runtime13 = require("@protobuf-ts/runtime");
|
|
130
|
+
var import_runtime14 = require("@protobuf-ts/runtime");
|
|
131
|
+
|
|
2565
132
|
// lib/google/protobuf/timestamp.ts
|
|
2566
|
-
var
|
|
133
|
+
var import_runtime5 = require("@protobuf-ts/runtime");
|
|
134
|
+
var import_runtime6 = require("@protobuf-ts/runtime");
|
|
135
|
+
var import_runtime7 = require("@protobuf-ts/runtime");
|
|
136
|
+
var import_runtime8 = require("@protobuf-ts/runtime");
|
|
137
|
+
var import_runtime9 = require("@protobuf-ts/runtime");
|
|
138
|
+
var import_runtime10 = require("@protobuf-ts/runtime");
|
|
139
|
+
var Timestamp$Type = class extends import_runtime10.MessageType {
|
|
2567
140
|
constructor() {
|
|
2568
141
|
super("google.protobuf.Timestamp", [
|
|
2569
142
|
{
|
|
@@ -2588,7 +161,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2588
161
|
now() {
|
|
2589
162
|
const msg = this.create();
|
|
2590
163
|
const ms = Date.now();
|
|
2591
|
-
msg.seconds = PbLong.from(Math.floor(ms / 1e3)).toString();
|
|
164
|
+
msg.seconds = import_runtime9.PbLong.from(Math.floor(ms / 1e3)).toString();
|
|
2592
165
|
msg.nanos = ms % 1e3 * 1e6;
|
|
2593
166
|
return msg;
|
|
2594
167
|
}
|
|
@@ -2596,7 +169,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2596
169
|
* Converts a `Timestamp` to a JavaScript Date.
|
|
2597
170
|
*/
|
|
2598
171
|
toDate(message) {
|
|
2599
|
-
return new Date(PbLong.from(message.seconds).toNumber() * 1e3 + Math.ceil(message.nanos / 1e6));
|
|
172
|
+
return new Date(import_runtime9.PbLong.from(message.seconds).toNumber() * 1e3 + Math.ceil(message.nanos / 1e6));
|
|
2600
173
|
}
|
|
2601
174
|
/**
|
|
2602
175
|
* Converts a JavaScript Date to a `Timestamp`.
|
|
@@ -2604,7 +177,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2604
177
|
fromDate(date) {
|
|
2605
178
|
const msg = this.create();
|
|
2606
179
|
const ms = date.getTime();
|
|
2607
|
-
msg.seconds = PbLong.from(Math.floor(ms / 1e3)).toString();
|
|
180
|
+
msg.seconds = import_runtime9.PbLong.from(Math.floor(ms / 1e3)).toString();
|
|
2608
181
|
msg.nanos = (ms % 1e3 + (ms < 0 && ms % 1e3 !== 0 ? 1e3 : 0)) * 1e6;
|
|
2609
182
|
return msg;
|
|
2610
183
|
}
|
|
@@ -2613,7 +186,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2613
186
|
* in the RFC 3339 format.
|
|
2614
187
|
*/
|
|
2615
188
|
internalJsonWrite(message, options) {
|
|
2616
|
-
let ms = PbLong.from(message.seconds).toNumber() * 1e3;
|
|
189
|
+
let ms = import_runtime9.PbLong.from(message.seconds).toNumber() * 1e3;
|
|
2617
190
|
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
|
2618
191
|
throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
2619
192
|
if (message.nanos < 0)
|
|
@@ -2636,7 +209,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2636
209
|
*/
|
|
2637
210
|
internalJsonRead(json, options, target) {
|
|
2638
211
|
if (typeof json !== "string")
|
|
2639
|
-
throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
|
|
212
|
+
throw new Error("Unable to parse Timestamp from JSON " + (0, import_runtime8.typeofJsonValue)(json) + ".");
|
|
2640
213
|
let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
|
2641
214
|
if (!matches)
|
|
2642
215
|
throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
|
|
@@ -2647,7 +220,7 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2647
220
|
throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
2648
221
|
if (!target)
|
|
2649
222
|
target = this.create();
|
|
2650
|
-
target.seconds = PbLong.from(ms / 1e3).toString();
|
|
223
|
+
target.seconds = import_runtime9.PbLong.from(ms / 1e3).toString();
|
|
2651
224
|
target.nanos = 0;
|
|
2652
225
|
if (matches[7])
|
|
2653
226
|
target.nanos = parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1e9;
|
|
@@ -2658,11 +231,11 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2658
231
|
message.seconds = "0";
|
|
2659
232
|
message.nanos = 0;
|
|
2660
233
|
if (value !== void 0)
|
|
2661
|
-
reflectionMergePartial(this, message, value);
|
|
234
|
+
(0, import_runtime7.reflectionMergePartial)(this, message, value);
|
|
2662
235
|
return message;
|
|
2663
236
|
}
|
|
2664
237
|
internalBinaryRead(reader, length, options, target) {
|
|
2665
|
-
let message = target
|
|
238
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2666
239
|
while (reader.pos < end) {
|
|
2667
240
|
let [fieldNo, wireType] = reader.tag();
|
|
2668
241
|
switch (fieldNo) {
|
|
@@ -2680,26 +253,26 @@ var Timestamp$Type = class extends MessageType {
|
|
|
2680
253
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2681
254
|
let d = reader.skip(wireType);
|
|
2682
255
|
if (u !== false)
|
|
2683
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
256
|
+
(u === true ? import_runtime6.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2684
257
|
}
|
|
2685
258
|
}
|
|
2686
259
|
return message;
|
|
2687
260
|
}
|
|
2688
261
|
internalBinaryWrite(message, writer, options) {
|
|
2689
262
|
if (message.seconds !== "0")
|
|
2690
|
-
writer.tag(1, WireType.Varint).int64(message.seconds);
|
|
263
|
+
writer.tag(1, import_runtime5.WireType.Varint).int64(message.seconds);
|
|
2691
264
|
if (message.nanos !== 0)
|
|
2692
|
-
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
265
|
+
writer.tag(2, import_runtime5.WireType.Varint).int32(message.nanos);
|
|
2693
266
|
let u = options.writeUnknownFields;
|
|
2694
267
|
if (u !== false)
|
|
2695
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
268
|
+
(u == true ? import_runtime6.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2696
269
|
return writer;
|
|
2697
270
|
}
|
|
2698
271
|
};
|
|
2699
272
|
var Timestamp = new Timestamp$Type();
|
|
2700
273
|
|
|
2701
274
|
// lib/events.ts
|
|
2702
|
-
var TestStartEvent$Type = class extends MessageType {
|
|
275
|
+
var TestStartEvent$Type = class extends import_runtime14.MessageType {
|
|
2703
276
|
constructor() {
|
|
2704
277
|
super("testsystem.events.TestStartEvent", [
|
|
2705
278
|
{
|
|
@@ -2730,11 +303,11 @@ var TestStartEvent$Type = class extends MessageType {
|
|
|
2730
303
|
message.testName = "";
|
|
2731
304
|
message.metadata = {};
|
|
2732
305
|
if (value !== void 0)
|
|
2733
|
-
reflectionMergePartial(this, message, value);
|
|
306
|
+
(0, import_runtime13.reflectionMergePartial)(this, message, value);
|
|
2734
307
|
return message;
|
|
2735
308
|
}
|
|
2736
309
|
internalBinaryRead(reader, length, options, target) {
|
|
2737
|
-
let message = target
|
|
310
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2738
311
|
while (reader.pos < end) {
|
|
2739
312
|
let [fieldNo, wireType] = reader.tag();
|
|
2740
313
|
switch (fieldNo) {
|
|
@@ -2760,7 +333,7 @@ var TestStartEvent$Type = class extends MessageType {
|
|
|
2760
333
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2761
334
|
let d = reader.skip(wireType);
|
|
2762
335
|
if (u !== false)
|
|
2763
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
336
|
+
(u === true ? import_runtime12.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2764
337
|
}
|
|
2765
338
|
}
|
|
2766
339
|
return message;
|
|
@@ -2780,25 +353,25 @@ var TestStartEvent$Type = class extends MessageType {
|
|
|
2780
353
|
throw new globalThis.Error("unknown map entry field for testsystem.events.TestStartEvent.metadata");
|
|
2781
354
|
}
|
|
2782
355
|
}
|
|
2783
|
-
map[key
|
|
356
|
+
map[key ?? ""] = val ?? "";
|
|
2784
357
|
}
|
|
2785
358
|
internalBinaryWrite(message, writer, options) {
|
|
2786
359
|
if (message.testId !== "")
|
|
2787
|
-
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
360
|
+
writer.tag(1, import_runtime11.WireType.LengthDelimited).string(message.testId);
|
|
2788
361
|
if (message.testName !== "")
|
|
2789
|
-
writer.tag(2, WireType.LengthDelimited).string(message.testName);
|
|
362
|
+
writer.tag(2, import_runtime11.WireType.LengthDelimited).string(message.testName);
|
|
2790
363
|
if (message.startTime)
|
|
2791
|
-
Timestamp.internalBinaryWrite(message.startTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
364
|
+
Timestamp.internalBinaryWrite(message.startTime, writer.tag(3, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
2792
365
|
for (let k of globalThis.Object.keys(message.metadata))
|
|
2793
|
-
writer.tag(4, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.metadata[k]).join();
|
|
366
|
+
writer.tag(4, import_runtime11.WireType.LengthDelimited).fork().tag(1, import_runtime11.WireType.LengthDelimited).string(k).tag(2, import_runtime11.WireType.LengthDelimited).string(message.metadata[k]).join();
|
|
2794
367
|
let u = options.writeUnknownFields;
|
|
2795
368
|
if (u !== false)
|
|
2796
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
369
|
+
(u == true ? import_runtime12.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2797
370
|
return writer;
|
|
2798
371
|
}
|
|
2799
372
|
};
|
|
2800
373
|
var TestStartEvent = new TestStartEvent$Type();
|
|
2801
|
-
var TestFinishEvent$Type = class extends MessageType {
|
|
374
|
+
var TestFinishEvent$Type = class extends import_runtime14.MessageType {
|
|
2802
375
|
constructor() {
|
|
2803
376
|
super("testsystem.events.TestFinishEvent", [
|
|
2804
377
|
{
|
|
@@ -2835,11 +408,11 @@ var TestFinishEvent$Type = class extends MessageType {
|
|
|
2835
408
|
message.errorMessage = "";
|
|
2836
409
|
message.stackTrace = "";
|
|
2837
410
|
if (value !== void 0)
|
|
2838
|
-
reflectionMergePartial(this, message, value);
|
|
411
|
+
(0, import_runtime13.reflectionMergePartial)(this, message, value);
|
|
2839
412
|
return message;
|
|
2840
413
|
}
|
|
2841
414
|
internalBinaryRead(reader, length, options, target) {
|
|
2842
|
-
let message = target
|
|
415
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2843
416
|
while (reader.pos < end) {
|
|
2844
417
|
let [fieldNo, wireType] = reader.tag();
|
|
2845
418
|
switch (fieldNo) {
|
|
@@ -2873,32 +446,32 @@ var TestFinishEvent$Type = class extends MessageType {
|
|
|
2873
446
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2874
447
|
let d = reader.skip(wireType);
|
|
2875
448
|
if (u !== false)
|
|
2876
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
449
|
+
(u === true ? import_runtime12.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2877
450
|
}
|
|
2878
451
|
}
|
|
2879
452
|
return message;
|
|
2880
453
|
}
|
|
2881
454
|
internalBinaryWrite(message, writer, options) {
|
|
2882
455
|
if (message.testId !== "")
|
|
2883
|
-
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
456
|
+
writer.tag(1, import_runtime11.WireType.LengthDelimited).string(message.testId);
|
|
2884
457
|
if (message.status !== 0)
|
|
2885
|
-
writer.tag(2, WireType.Varint).int32(message.status);
|
|
458
|
+
writer.tag(2, import_runtime11.WireType.Varint).int32(message.status);
|
|
2886
459
|
if (message.endTime)
|
|
2887
|
-
Timestamp.internalBinaryWrite(message.endTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
460
|
+
Timestamp.internalBinaryWrite(message.endTime, writer.tag(3, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
2888
461
|
for (let i = 0; i < message.attachments.length; i++)
|
|
2889
|
-
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
|
|
462
|
+
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
2890
463
|
if (message.errorMessage !== "")
|
|
2891
|
-
writer.tag(5, WireType.LengthDelimited).string(message.errorMessage);
|
|
464
|
+
writer.tag(5, import_runtime11.WireType.LengthDelimited).string(message.errorMessage);
|
|
2892
465
|
if (message.stackTrace !== "")
|
|
2893
|
-
writer.tag(6, WireType.LengthDelimited).string(message.stackTrace);
|
|
466
|
+
writer.tag(6, import_runtime11.WireType.LengthDelimited).string(message.stackTrace);
|
|
2894
467
|
let u = options.writeUnknownFields;
|
|
2895
468
|
if (u !== false)
|
|
2896
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
469
|
+
(u == true ? import_runtime12.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2897
470
|
return writer;
|
|
2898
471
|
}
|
|
2899
472
|
};
|
|
2900
473
|
var TestFinishEvent = new TestFinishEvent$Type();
|
|
2901
|
-
var TestStep$Type = class extends MessageType {
|
|
474
|
+
var TestStep$Type = class extends import_runtime14.MessageType {
|
|
2902
475
|
constructor() {
|
|
2903
476
|
super("testsystem.events.TestStep", [
|
|
2904
477
|
{
|
|
@@ -2919,11 +492,11 @@ var TestStep$Type = class extends MessageType {
|
|
|
2919
492
|
message.status = 0;
|
|
2920
493
|
message.attachments = [];
|
|
2921
494
|
if (value !== void 0)
|
|
2922
|
-
reflectionMergePartial(this, message, value);
|
|
495
|
+
(0, import_runtime13.reflectionMergePartial)(this, message, value);
|
|
2923
496
|
return message;
|
|
2924
497
|
}
|
|
2925
498
|
internalBinaryRead(reader, length, options, target) {
|
|
2926
|
-
let message = target
|
|
499
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2927
500
|
while (reader.pos < end) {
|
|
2928
501
|
let [fieldNo, wireType] = reader.tag();
|
|
2929
502
|
switch (fieldNo) {
|
|
@@ -2949,28 +522,28 @@ var TestStep$Type = class extends MessageType {
|
|
|
2949
522
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2950
523
|
let d = reader.skip(wireType);
|
|
2951
524
|
if (u !== false)
|
|
2952
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
525
|
+
(u === true ? import_runtime12.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2953
526
|
}
|
|
2954
527
|
}
|
|
2955
528
|
return message;
|
|
2956
529
|
}
|
|
2957
530
|
internalBinaryWrite(message, writer, options) {
|
|
2958
531
|
if (message.description !== "")
|
|
2959
|
-
writer.tag(1, WireType.LengthDelimited).string(message.description);
|
|
532
|
+
writer.tag(1, import_runtime11.WireType.LengthDelimited).string(message.description);
|
|
2960
533
|
if (message.timestamp)
|
|
2961
|
-
Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
534
|
+
Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
2962
535
|
if (message.status !== 0)
|
|
2963
|
-
writer.tag(3, WireType.Varint).int32(message.status);
|
|
536
|
+
writer.tag(3, import_runtime11.WireType.Varint).int32(message.status);
|
|
2964
537
|
for (let i = 0; i < message.attachments.length; i++)
|
|
2965
|
-
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
|
|
538
|
+
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
2966
539
|
let u = options.writeUnknownFields;
|
|
2967
540
|
if (u !== false)
|
|
2968
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
541
|
+
(u == true ? import_runtime12.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2969
542
|
return writer;
|
|
2970
543
|
}
|
|
2971
544
|
};
|
|
2972
545
|
var TestStep = new TestStep$Type();
|
|
2973
|
-
var TestStepEvent$Type = class extends MessageType {
|
|
546
|
+
var TestStepEvent$Type = class extends import_runtime14.MessageType {
|
|
2974
547
|
constructor() {
|
|
2975
548
|
super("testsystem.events.TestStepEvent", [
|
|
2976
549
|
{
|
|
@@ -2988,11 +561,11 @@ var TestStepEvent$Type = class extends MessageType {
|
|
|
2988
561
|
message.testId = "";
|
|
2989
562
|
message.steps = [];
|
|
2990
563
|
if (value !== void 0)
|
|
2991
|
-
reflectionMergePartial(this, message, value);
|
|
564
|
+
(0, import_runtime13.reflectionMergePartial)(this, message, value);
|
|
2992
565
|
return message;
|
|
2993
566
|
}
|
|
2994
567
|
internalBinaryRead(reader, length, options, target) {
|
|
2995
|
-
let message = target
|
|
568
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2996
569
|
while (reader.pos < end) {
|
|
2997
570
|
let [fieldNo, wireType] = reader.tag();
|
|
2998
571
|
switch (fieldNo) {
|
|
@@ -3010,30 +583,31 @@ var TestStepEvent$Type = class extends MessageType {
|
|
|
3010
583
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
3011
584
|
let d = reader.skip(wireType);
|
|
3012
585
|
if (u !== false)
|
|
3013
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
586
|
+
(u === true ? import_runtime12.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
3014
587
|
}
|
|
3015
588
|
}
|
|
3016
589
|
return message;
|
|
3017
590
|
}
|
|
3018
591
|
internalBinaryWrite(message, writer, options) {
|
|
3019
592
|
if (message.testId !== "")
|
|
3020
|
-
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
593
|
+
writer.tag(1, import_runtime11.WireType.LengthDelimited).string(message.testId);
|
|
3021
594
|
for (let i = 0; i < message.steps.length; i++)
|
|
3022
|
-
TestStep.internalBinaryWrite(message.steps[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
595
|
+
TestStep.internalBinaryWrite(message.steps[i], writer.tag(2, import_runtime11.WireType.LengthDelimited).fork(), options).join();
|
|
3023
596
|
let u = options.writeUnknownFields;
|
|
3024
597
|
if (u !== false)
|
|
3025
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
598
|
+
(u == true ? import_runtime12.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
3026
599
|
return writer;
|
|
3027
600
|
}
|
|
3028
601
|
};
|
|
3029
602
|
var TestStepEvent = new TestStepEvent$Type();
|
|
3030
603
|
|
|
3031
604
|
// node_modules/@protobuf-ts/runtime-rpc/build/es2015/reflection-info.js
|
|
605
|
+
var import_runtime15 = require("@protobuf-ts/runtime");
|
|
3032
606
|
function normalizeMethodInfo(method, service) {
|
|
3033
607
|
var _a, _b, _c;
|
|
3034
608
|
let m = method;
|
|
3035
609
|
m.service = service;
|
|
3036
|
-
m.localName = (_a = m.localName) !== null && _a !== void 0 ? _a : lowerCamelCase(m.name);
|
|
610
|
+
m.localName = (_a = m.localName) !== null && _a !== void 0 ? _a : (0, import_runtime15.lowerCamelCase)(m.name);
|
|
3037
611
|
m.serverStreaming = !!m.serverStreaming;
|
|
3038
612
|
m.clientStreaming = !!m.clientStreaming;
|
|
3039
613
|
m.options = (_b = m.options) !== null && _b !== void 0 ? _b : {};
|
|
@@ -3051,6 +625,7 @@ var ServiceType = class {
|
|
|
3051
625
|
};
|
|
3052
626
|
|
|
3053
627
|
// node_modules/@protobuf-ts/runtime-rpc/build/es2015/rpc-interceptor.js
|
|
628
|
+
var import_runtime16 = require("@protobuf-ts/runtime");
|
|
3054
629
|
function stackIntercept(kind, transport, method, options, input) {
|
|
3055
630
|
var _a, _b, _c, _d;
|
|
3056
631
|
if (kind == "unary") {
|
|
@@ -3085,11 +660,15 @@ function stackIntercept(kind, transport, method, options, input) {
|
|
|
3085
660
|
}
|
|
3086
661
|
return tail(method, options);
|
|
3087
662
|
}
|
|
3088
|
-
assertNever(kind);
|
|
663
|
+
(0, import_runtime16.assertNever)(kind);
|
|
3089
664
|
}
|
|
3090
665
|
|
|
3091
666
|
// lib/observer.ts
|
|
3092
|
-
var
|
|
667
|
+
var import_runtime17 = require("@protobuf-ts/runtime");
|
|
668
|
+
var import_runtime18 = require("@protobuf-ts/runtime");
|
|
669
|
+
var import_runtime19 = require("@protobuf-ts/runtime");
|
|
670
|
+
var import_runtime20 = require("@protobuf-ts/runtime");
|
|
671
|
+
var Ack$Type = class extends import_runtime20.MessageType {
|
|
3093
672
|
constructor() {
|
|
3094
673
|
super("testsystem.observer.Ack", [
|
|
3095
674
|
{
|
|
@@ -3113,11 +692,11 @@ var Ack$Type = class extends MessageType {
|
|
|
3113
692
|
message.success = false;
|
|
3114
693
|
message.message = "";
|
|
3115
694
|
if (value !== void 0)
|
|
3116
|
-
reflectionMergePartial(this, message, value);
|
|
695
|
+
(0, import_runtime19.reflectionMergePartial)(this, message, value);
|
|
3117
696
|
return message;
|
|
3118
697
|
}
|
|
3119
698
|
internalBinaryRead(reader, length, options, target) {
|
|
3120
|
-
let message = target
|
|
699
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
3121
700
|
while (reader.pos < end) {
|
|
3122
701
|
let [fieldNo, wireType] = reader.tag();
|
|
3123
702
|
switch (fieldNo) {
|
|
@@ -3135,19 +714,19 @@ var Ack$Type = class extends MessageType {
|
|
|
3135
714
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
3136
715
|
let d = reader.skip(wireType);
|
|
3137
716
|
if (u !== false)
|
|
3138
|
-
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
717
|
+
(u === true ? import_runtime18.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
3139
718
|
}
|
|
3140
719
|
}
|
|
3141
720
|
return message;
|
|
3142
721
|
}
|
|
3143
722
|
internalBinaryWrite(message, writer, options) {
|
|
3144
723
|
if (message.success !== false)
|
|
3145
|
-
writer.tag(1, WireType.Varint).bool(message.success);
|
|
724
|
+
writer.tag(1, import_runtime17.WireType.Varint).bool(message.success);
|
|
3146
725
|
if (message.message !== "")
|
|
3147
|
-
writer.tag(2, WireType.LengthDelimited).string(message.message);
|
|
726
|
+
writer.tag(2, import_runtime17.WireType.LengthDelimited).string(message.message);
|
|
3148
727
|
let u = options.writeUnknownFields;
|
|
3149
728
|
if (u !== false)
|
|
3150
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
729
|
+
(u == true ? import_runtime18.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
3151
730
|
return writer;
|
|
3152
731
|
}
|
|
3153
732
|
};
|
|
@@ -3198,7 +777,6 @@ var TestEventCollectorClient = class {
|
|
|
3198
777
|
TestStartEvent,
|
|
3199
778
|
TestStatus,
|
|
3200
779
|
TestStep,
|
|
3201
|
-
TestStepEvent
|
|
3202
|
-
Timestamp
|
|
780
|
+
TestStepEvent
|
|
3203
781
|
});
|
|
3204
782
|
//# sourceMappingURL=index.js.map
|