@omnibuf/node 0.0.7 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conformance.d.ts.map +1 -1
- package/dist/conformance.js +40 -9
- package/dist/conformance.js.map +1 -1
- package/dist/gen/conformance_omnibuf.pb.d.ts +143 -0
- package/dist/gen/conformance_omnibuf.pb.d.ts.map +1 -1
- package/dist/gen/conformance_omnibuf.pb.js +1355 -25
- package/dist/gen/conformance_omnibuf.pb.js.map +1 -1
- package/dist/gen/peer_omnibuf.pb.d.ts.map +1 -1
- package/dist/gen/peer_omnibuf.pb.js +77 -30
- package/dist/gen/peer_omnibuf.pb.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -6
|
@@ -1,7 +1,1273 @@
|
|
|
1
1
|
// Code generated by protoc-gen-omnibuf-es. DO NOT EDIT.
|
|
2
|
-
// source: conformance.proto
|
|
2
|
+
// source: omnibuf/conformance/conformance.proto
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
|
-
import { Encoder, MaxNestingDepth, appendStringArrBody, appendUint32ArrBody, countSubMsgArrElems, decodeSchemaMeta, decodeUTF8, decodeVarintAuto, decodeVarintBigInt,
|
|
4
|
+
import { Encoder, MaxNestingDepth, appendStringArrBody, appendUint32ArrBody, countSubMsgArrElems, decodeSchemaMeta as $decodeSchemaMeta, decodeUTF8, decodeVarintAuto, decodeVarintBigInt, decodeZigZag32, decodeZigZagAuto, defineMessage, encodeField0SchemaMeta, float32FromBits, parseArrayHeader, readBool, readBytes, readEnum, readField0SchemaMeta, readFixed32, readFixed64Auto, readFloat32, readFloat64, readFloat64At, readInt32, readIntAuto, readLenSlice, readString, readStringArr, readSubMsgArrDecoded, readSubMsgMerged, readTypedMap, readUint32, readUint32Arr, readUintAuto, roundFloat32Shortest, spliceFields, validateMapTypes, validateMessage, validateValue, writeField0SchemaMeta, } from '@omnibuf/core';
|
|
5
|
+
export var WireFormat;
|
|
6
|
+
(function (WireFormat) {
|
|
7
|
+
WireFormat[WireFormat["WIRE_FORMAT_UNSPECIFIED"] = 0] = "WIRE_FORMAT_UNSPECIFIED";
|
|
8
|
+
WireFormat[WireFormat["WIRE_FORMAT_OMNIBUF"] = 1] = "WIRE_FORMAT_OMNIBUF";
|
|
9
|
+
WireFormat[WireFormat["WIRE_FORMAT_JSON"] = 2] = "WIRE_FORMAT_JSON";
|
|
10
|
+
})(WireFormat || (WireFormat = {}));
|
|
11
|
+
export var TestTier;
|
|
12
|
+
(function (TestTier) {
|
|
13
|
+
TestTier[TestTier["TEST_TIER_UNSPECIFIED"] = 0] = "TEST_TIER_UNSPECIFIED";
|
|
14
|
+
TestTier[TestTier["TEST_TIER_PLUGIN"] = 1] = "TEST_TIER_PLUGIN";
|
|
15
|
+
TestTier[TestTier["TEST_TIER_PROTOBUF_TYPES"] = 2] = "TEST_TIER_PROTOBUF_TYPES";
|
|
16
|
+
TestTier[TestTier["TEST_TIER_ANNOTATED_STRUCT"] = 3] = "TEST_TIER_ANNOTATED_STRUCT";
|
|
17
|
+
TestTier[TestTier["TEST_TIER_BLIND"] = 4] = "TEST_TIER_BLIND";
|
|
18
|
+
})(TestTier || (TestTier = {}));
|
|
19
|
+
export const ConformanceRequestSchema = defineMessage('omnibuf.conformance.ConformanceRequest', {
|
|
20
|
+
testName: { fieldNum: 1, name: 'test_name', type: 'string' },
|
|
21
|
+
messageType: { fieldNum: 2, name: 'message_type', type: 'string' },
|
|
22
|
+
tier: { fieldNum: 3, type: 'enum' },
|
|
23
|
+
requestedOutputFormat: { fieldNum: 4, name: 'requested_output_format', type: 'enum' },
|
|
24
|
+
omnibufPayload: { fieldNum: 5, name: 'omnibuf_payload', type: 'bytes' },
|
|
25
|
+
jsonPayload: { fieldNum: 6, name: 'json_payload', type: 'string' },
|
|
26
|
+
selfDescribing: { fieldNum: 7, name: 'self_describing', type: 'bool' },
|
|
27
|
+
testOpaqueSplice: { fieldNum: 8, name: 'test_opaque_splice', type: 'bool' },
|
|
28
|
+
testOpaqueSpliceShrink: { fieldNum: 9, name: 'test_opaque_splice_shrink', type: 'bool' },
|
|
29
|
+
});
|
|
30
|
+
class ConformanceRequestMsg {
|
|
31
|
+
testName = '';
|
|
32
|
+
get test_name() {
|
|
33
|
+
return this.testName;
|
|
34
|
+
}
|
|
35
|
+
set test_name(v) {
|
|
36
|
+
this.testName = v;
|
|
37
|
+
}
|
|
38
|
+
messageType = '';
|
|
39
|
+
get message_type() {
|
|
40
|
+
return this.messageType;
|
|
41
|
+
}
|
|
42
|
+
set message_type(v) {
|
|
43
|
+
this.messageType = v;
|
|
44
|
+
}
|
|
45
|
+
tier = 0;
|
|
46
|
+
requestedOutputFormat = 0;
|
|
47
|
+
get requested_output_format() {
|
|
48
|
+
return this.requestedOutputFormat;
|
|
49
|
+
}
|
|
50
|
+
set requested_output_format(v) {
|
|
51
|
+
this.requestedOutputFormat = v;
|
|
52
|
+
}
|
|
53
|
+
omnibufPayload = new Uint8Array(0);
|
|
54
|
+
get omnibuf_payload() {
|
|
55
|
+
return this.omnibufPayload;
|
|
56
|
+
}
|
|
57
|
+
set omnibuf_payload(v) {
|
|
58
|
+
this.omnibufPayload = v;
|
|
59
|
+
}
|
|
60
|
+
jsonPayload = '';
|
|
61
|
+
get json_payload() {
|
|
62
|
+
return this.jsonPayload;
|
|
63
|
+
}
|
|
64
|
+
set json_payload(v) {
|
|
65
|
+
this.jsonPayload = v;
|
|
66
|
+
}
|
|
67
|
+
selfDescribing = false;
|
|
68
|
+
get self_describing() {
|
|
69
|
+
return this.selfDescribing;
|
|
70
|
+
}
|
|
71
|
+
set self_describing(v) {
|
|
72
|
+
this.selfDescribing = v;
|
|
73
|
+
}
|
|
74
|
+
testOpaqueSplice = false;
|
|
75
|
+
get test_opaque_splice() {
|
|
76
|
+
return this.testOpaqueSplice;
|
|
77
|
+
}
|
|
78
|
+
set test_opaque_splice(v) {
|
|
79
|
+
this.testOpaqueSplice = v;
|
|
80
|
+
}
|
|
81
|
+
testOpaqueSpliceShrink = false;
|
|
82
|
+
get test_opaque_splice_shrink() {
|
|
83
|
+
return this.testOpaqueSpliceShrink;
|
|
84
|
+
}
|
|
85
|
+
set test_opaque_splice_shrink(v) {
|
|
86
|
+
this.testOpaqueSpliceShrink = v;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
Object.defineProperty(ConformanceRequestMsg.prototype, '$typeName', {
|
|
90
|
+
value: 'omnibuf.conformance.ConformanceRequest',
|
|
91
|
+
enumerable: false,
|
|
92
|
+
writable: true,
|
|
93
|
+
configurable: true,
|
|
94
|
+
});
|
|
95
|
+
export function createConformanceRequest(init) {
|
|
96
|
+
if (init === undefined)
|
|
97
|
+
return new ConformanceRequestMsg();
|
|
98
|
+
return ConformanceRequestSchema.create(init);
|
|
99
|
+
}
|
|
100
|
+
export function encodeConformanceRequest(enc, msg, options) {
|
|
101
|
+
enc.writeString(1, msg.testName ?? msg.test_name ?? '');
|
|
102
|
+
enc.writeString(2, msg.messageType ?? msg.message_type ?? '');
|
|
103
|
+
enc.writeInt(3, Number(msg.tier ?? 0) | 0);
|
|
104
|
+
enc.writeInt(4, Number(msg.requestedOutputFormat ?? msg.requested_output_format ?? 0) | 0);
|
|
105
|
+
enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
|
|
106
|
+
enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
|
|
107
|
+
enc.writeBool(7, Boolean(msg.selfDescribing ?? msg.self_describing));
|
|
108
|
+
enc.writeBool(8, Boolean(msg.testOpaqueSplice ?? msg.test_opaque_splice));
|
|
109
|
+
enc.writeBool(9, Boolean(msg.testOpaqueSpliceShrink ?? msg.test_opaque_splice_shrink));
|
|
110
|
+
if (options?.writeUnknownFields && Array.isArray(msg.$unknown)) {
|
|
111
|
+
for (const uf of msg.$unknown) {
|
|
112
|
+
enc.writeTag(uf.no, uf.wireType);
|
|
113
|
+
enc.writeRaw(uf.data);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export function marshalConformanceRequestOmniBuf(msg, options) {
|
|
118
|
+
const enc = new Encoder(256);
|
|
119
|
+
if (options?.selfDescribing) {
|
|
120
|
+
writeField0SchemaMeta(enc, ConformanceRequestSchema.getSchemaMeta(0, msg), Boolean(options.deterministic));
|
|
121
|
+
}
|
|
122
|
+
encodeConformanceRequest(enc, msg, options);
|
|
123
|
+
return enc.finish();
|
|
124
|
+
}
|
|
125
|
+
export function decodeConformanceRequest(buf, target, depth = 0, options, startPos = 0, endPos = buf.length) {
|
|
126
|
+
const maxDepth = options?.recursionLimit ?? MaxNestingDepth;
|
|
127
|
+
const readUnknown = options?.readUnknownFields ?? true;
|
|
128
|
+
if (depth > maxDepth) {
|
|
129
|
+
throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
|
|
130
|
+
}
|
|
131
|
+
const out = target ?? new ConformanceRequestMsg();
|
|
132
|
+
if (target !== undefined) {
|
|
133
|
+
if (!(out instanceof ConformanceRequestMsg)) {
|
|
134
|
+
Object.setPrototypeOf(out, ConformanceRequestMsg.prototype);
|
|
135
|
+
}
|
|
136
|
+
if (!options?.merge) {
|
|
137
|
+
if (Object.hasOwn(out, 'test_name'))
|
|
138
|
+
delete out.test_name;
|
|
139
|
+
if (Object.hasOwn(out, 'message_type'))
|
|
140
|
+
delete out.message_type;
|
|
141
|
+
if (Object.hasOwn(out, 'requested_output_format'))
|
|
142
|
+
delete out.requested_output_format;
|
|
143
|
+
if (Object.hasOwn(out, 'omnibuf_payload'))
|
|
144
|
+
delete out.omnibuf_payload;
|
|
145
|
+
if (Object.hasOwn(out, 'json_payload'))
|
|
146
|
+
delete out.json_payload;
|
|
147
|
+
if (Object.hasOwn(out, 'self_describing'))
|
|
148
|
+
delete out.self_describing;
|
|
149
|
+
if (Object.hasOwn(out, 'test_opaque_splice'))
|
|
150
|
+
delete out.test_opaque_splice;
|
|
151
|
+
if (Object.hasOwn(out, 'test_opaque_splice_shrink'))
|
|
152
|
+
delete out.test_opaque_splice_shrink;
|
|
153
|
+
Object.assign(out, new ConformanceRequestMsg());
|
|
154
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
155
|
+
delete out.$unknown;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const n = endPos;
|
|
159
|
+
let pos = startPos;
|
|
160
|
+
let seenMask = 0;
|
|
161
|
+
let unknownFields = Array.isArray(out.$unknown)
|
|
162
|
+
? out.$unknown
|
|
163
|
+
: null;
|
|
164
|
+
while (pos < n) {
|
|
165
|
+
let tag = 0;
|
|
166
|
+
const b0 = buf[pos];
|
|
167
|
+
if ((b0 & 1) !== 0) {
|
|
168
|
+
tag = b0 >>> 1;
|
|
169
|
+
pos += 1;
|
|
170
|
+
}
|
|
171
|
+
else if ((b0 & 2) !== 0) {
|
|
172
|
+
if (pos + 2 > n)
|
|
173
|
+
throw new Error('omnibuf: truncated tag');
|
|
174
|
+
tag = ((b0 | (buf[pos + 1] << 8)) >>> 2) >>> 0;
|
|
175
|
+
pos += 2;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const [t64, tn] = decodeVarintBigInt(buf, pos, n);
|
|
179
|
+
if (tn === 0 || t64 >> 4n > 536870911n)
|
|
180
|
+
throw new Error('omnibuf: invalid tag');
|
|
181
|
+
tag = Number(t64);
|
|
182
|
+
pos += tn;
|
|
183
|
+
}
|
|
184
|
+
const fieldNum = tag <= 0x7fffffff ? tag >>> 4 : Math.floor(tag / 16);
|
|
185
|
+
const wt = tag & 0x0f;
|
|
186
|
+
if (fieldNum === 0) {
|
|
187
|
+
if (wt !== 12)
|
|
188
|
+
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
189
|
+
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
190
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
191
|
+
pos = nextPos;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const bit = fieldNum <= 30 ? 1 << fieldNum : 0;
|
|
195
|
+
const alreadySeen = (seenMask & bit) !== 0 || Boolean(options?.merge);
|
|
196
|
+
switch (fieldNum) {
|
|
197
|
+
case 1: {
|
|
198
|
+
if (!(wt === 10)) {
|
|
199
|
+
const valStart = pos;
|
|
200
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
201
|
+
if (readUnknown) {
|
|
202
|
+
if (!unknownFields)
|
|
203
|
+
unknownFields = [];
|
|
204
|
+
unknownFields.push({
|
|
205
|
+
no: fieldNum,
|
|
206
|
+
wireType: wt,
|
|
207
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
seenMask |= bit;
|
|
213
|
+
if (pos >= n)
|
|
214
|
+
throw new Error('omnibuf: truncated string');
|
|
215
|
+
const sb = buf[pos];
|
|
216
|
+
if ((sb & 1) !== 0) {
|
|
217
|
+
const sLen = sb >>> 1;
|
|
218
|
+
pos += 1;
|
|
219
|
+
if (pos + sLen > n)
|
|
220
|
+
throw new Error('omnibuf: truncated string');
|
|
221
|
+
out.testName = decodeUTF8(buf, pos, pos + sLen);
|
|
222
|
+
pos += sLen;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
226
|
+
out.testName = decodeUTF8(s);
|
|
227
|
+
pos = nextPos;
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
case 2: {
|
|
232
|
+
if (!(wt === 10)) {
|
|
233
|
+
const valStart = pos;
|
|
234
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
235
|
+
if (readUnknown) {
|
|
236
|
+
if (!unknownFields)
|
|
237
|
+
unknownFields = [];
|
|
238
|
+
unknownFields.push({
|
|
239
|
+
no: fieldNum,
|
|
240
|
+
wireType: wt,
|
|
241
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
seenMask |= bit;
|
|
247
|
+
if (pos >= n)
|
|
248
|
+
throw new Error('omnibuf: truncated string');
|
|
249
|
+
const sb = buf[pos];
|
|
250
|
+
if ((sb & 1) !== 0) {
|
|
251
|
+
const sLen = sb >>> 1;
|
|
252
|
+
pos += 1;
|
|
253
|
+
if (pos + sLen > n)
|
|
254
|
+
throw new Error('omnibuf: truncated string');
|
|
255
|
+
out.messageType = decodeUTF8(buf, pos, pos + sLen);
|
|
256
|
+
pos += sLen;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
260
|
+
out.messageType = decodeUTF8(s);
|
|
261
|
+
pos = nextPos;
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case 3: {
|
|
266
|
+
if (!(wt === 1)) {
|
|
267
|
+
const valStart = pos;
|
|
268
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
269
|
+
if (readUnknown) {
|
|
270
|
+
if (!unknownFields)
|
|
271
|
+
unknownFields = [];
|
|
272
|
+
unknownFields.push({
|
|
273
|
+
no: fieldNum,
|
|
274
|
+
wireType: wt,
|
|
275
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
seenMask |= bit;
|
|
281
|
+
if (pos >= n)
|
|
282
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
283
|
+
const vb = buf[pos];
|
|
284
|
+
let i32Val = 0;
|
|
285
|
+
if ((vb & 1) !== 0) {
|
|
286
|
+
const u = vb >>> 1;
|
|
287
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
288
|
+
pos += 1;
|
|
289
|
+
}
|
|
290
|
+
else if ((vb & 2) !== 0) {
|
|
291
|
+
if (pos + 2 > n)
|
|
292
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
293
|
+
const u = (vb | (buf[pos + 1] << 8)) >>> 2;
|
|
294
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
295
|
+
pos += 2;
|
|
296
|
+
}
|
|
297
|
+
else if ((vb & 4) !== 0) {
|
|
298
|
+
if (pos + 4 > n)
|
|
299
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
300
|
+
const u = ((vb | (buf[pos + 1] << 8) | (buf[pos + 2] << 16) | (buf[pos + 3] << 24)) >>> 3) >>>
|
|
301
|
+
0;
|
|
302
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
303
|
+
pos += 4;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
307
|
+
if (vn === 0)
|
|
308
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
309
|
+
i32Val = decodeZigZag32(v);
|
|
310
|
+
pos += vn;
|
|
311
|
+
}
|
|
312
|
+
out.tier = i32Val;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case 4: {
|
|
316
|
+
if (!(wt === 1)) {
|
|
317
|
+
const valStart = pos;
|
|
318
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
319
|
+
if (readUnknown) {
|
|
320
|
+
if (!unknownFields)
|
|
321
|
+
unknownFields = [];
|
|
322
|
+
unknownFields.push({
|
|
323
|
+
no: fieldNum,
|
|
324
|
+
wireType: wt,
|
|
325
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
seenMask |= bit;
|
|
331
|
+
if (pos >= n)
|
|
332
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
333
|
+
const vb = buf[pos];
|
|
334
|
+
let i32Val = 0;
|
|
335
|
+
if ((vb & 1) !== 0) {
|
|
336
|
+
const u = vb >>> 1;
|
|
337
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
338
|
+
pos += 1;
|
|
339
|
+
}
|
|
340
|
+
else if ((vb & 2) !== 0) {
|
|
341
|
+
if (pos + 2 > n)
|
|
342
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
343
|
+
const u = (vb | (buf[pos + 1] << 8)) >>> 2;
|
|
344
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
345
|
+
pos += 2;
|
|
346
|
+
}
|
|
347
|
+
else if ((vb & 4) !== 0) {
|
|
348
|
+
if (pos + 4 > n)
|
|
349
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
350
|
+
const u = ((vb | (buf[pos + 1] << 8) | (buf[pos + 2] << 16) | (buf[pos + 3] << 24)) >>> 3) >>>
|
|
351
|
+
0;
|
|
352
|
+
i32Val = (u >>> 1) ^ -(u & 1);
|
|
353
|
+
pos += 4;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
357
|
+
if (vn === 0)
|
|
358
|
+
throw new Error('omnibuf: truncated int32/enum');
|
|
359
|
+
i32Val = decodeZigZag32(v);
|
|
360
|
+
pos += vn;
|
|
361
|
+
}
|
|
362
|
+
out.requestedOutputFormat = i32Val;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
case 5: {
|
|
366
|
+
if (!(wt === 11)) {
|
|
367
|
+
const valStart = pos;
|
|
368
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
369
|
+
if (readUnknown) {
|
|
370
|
+
if (!unknownFields)
|
|
371
|
+
unknownFields = [];
|
|
372
|
+
unknownFields.push({
|
|
373
|
+
no: fieldNum,
|
|
374
|
+
wireType: wt,
|
|
375
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
seenMask |= bit;
|
|
381
|
+
const [b, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
382
|
+
out.omnibufPayload = b.slice();
|
|
383
|
+
pos = nextPos;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
case 6: {
|
|
387
|
+
if (!(wt === 10)) {
|
|
388
|
+
const valStart = pos;
|
|
389
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
390
|
+
if (readUnknown) {
|
|
391
|
+
if (!unknownFields)
|
|
392
|
+
unknownFields = [];
|
|
393
|
+
unknownFields.push({
|
|
394
|
+
no: fieldNum,
|
|
395
|
+
wireType: wt,
|
|
396
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
seenMask |= bit;
|
|
402
|
+
if (pos >= n)
|
|
403
|
+
throw new Error('omnibuf: truncated string');
|
|
404
|
+
const sb = buf[pos];
|
|
405
|
+
if ((sb & 1) !== 0) {
|
|
406
|
+
const sLen = sb >>> 1;
|
|
407
|
+
pos += 1;
|
|
408
|
+
if (pos + sLen > n)
|
|
409
|
+
throw new Error('omnibuf: truncated string');
|
|
410
|
+
out.jsonPayload = decodeUTF8(buf, pos, pos + sLen);
|
|
411
|
+
pos += sLen;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
415
|
+
out.jsonPayload = decodeUTF8(s);
|
|
416
|
+
pos = nextPos;
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
case 7: {
|
|
421
|
+
if (!(wt === 2 || wt === 3)) {
|
|
422
|
+
const valStart = pos;
|
|
423
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
424
|
+
if (readUnknown) {
|
|
425
|
+
if (!unknownFields)
|
|
426
|
+
unknownFields = [];
|
|
427
|
+
unknownFields.push({
|
|
428
|
+
no: fieldNum,
|
|
429
|
+
wireType: wt,
|
|
430
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
seenMask |= bit;
|
|
436
|
+
out.selfDescribing = wt === 3;
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
case 8: {
|
|
440
|
+
if (!(wt === 2 || wt === 3)) {
|
|
441
|
+
const valStart = pos;
|
|
442
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
443
|
+
if (readUnknown) {
|
|
444
|
+
if (!unknownFields)
|
|
445
|
+
unknownFields = [];
|
|
446
|
+
unknownFields.push({
|
|
447
|
+
no: fieldNum,
|
|
448
|
+
wireType: wt,
|
|
449
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
seenMask |= bit;
|
|
455
|
+
out.testOpaqueSplice = wt === 3;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
case 9: {
|
|
459
|
+
if (!(wt === 2 || wt === 3)) {
|
|
460
|
+
const valStart = pos;
|
|
461
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
462
|
+
if (readUnknown) {
|
|
463
|
+
if (!unknownFields)
|
|
464
|
+
unknownFields = [];
|
|
465
|
+
unknownFields.push({
|
|
466
|
+
no: fieldNum,
|
|
467
|
+
wireType: wt,
|
|
468
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
seenMask |= bit;
|
|
474
|
+
out.testOpaqueSpliceShrink = wt === 3;
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
default: {
|
|
478
|
+
const valStart = pos;
|
|
479
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
480
|
+
if (readUnknown) {
|
|
481
|
+
if (!unknownFields)
|
|
482
|
+
unknownFields = [];
|
|
483
|
+
unknownFields.push({
|
|
484
|
+
no: fieldNum,
|
|
485
|
+
wireType: wt,
|
|
486
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (unknownFields && unknownFields.length > 0 && !('$unknown' in out)) {
|
|
494
|
+
Object.defineProperty(out, '$unknown', {
|
|
495
|
+
value: unknownFields,
|
|
496
|
+
enumerable: false,
|
|
497
|
+
writable: true,
|
|
498
|
+
configurable: true,
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
return out;
|
|
502
|
+
}
|
|
503
|
+
export function unmarshalConformanceRequestOmniBuf(buf, options) {
|
|
504
|
+
return decodeConformanceRequest(buf, undefined, 0, options);
|
|
505
|
+
}
|
|
506
|
+
ConformanceRequestSchema.setGeneratedCodec({
|
|
507
|
+
create: () => new ConformanceRequestMsg(),
|
|
508
|
+
encode: encodeConformanceRequest,
|
|
509
|
+
decode: decodeConformanceRequest,
|
|
510
|
+
});
|
|
511
|
+
export class OpaqueConformanceRequest {
|
|
512
|
+
_raw;
|
|
513
|
+
_dirtyMask = 0;
|
|
514
|
+
_testName;
|
|
515
|
+
_messageType;
|
|
516
|
+
_tier;
|
|
517
|
+
_requestedOutputFormat;
|
|
518
|
+
_omnibufPayload;
|
|
519
|
+
_jsonPayload;
|
|
520
|
+
_selfDescribing;
|
|
521
|
+
_testOpaqueSplice;
|
|
522
|
+
_testOpaqueSpliceShrink;
|
|
523
|
+
constructor(raw) {
|
|
524
|
+
this._raw = raw;
|
|
525
|
+
}
|
|
526
|
+
raw() {
|
|
527
|
+
return this._raw;
|
|
528
|
+
}
|
|
529
|
+
getTestName() {
|
|
530
|
+
if ((this._dirtyMask & (1 << 1)) !== 0) {
|
|
531
|
+
return this._testName;
|
|
532
|
+
}
|
|
533
|
+
return readString(this._raw, 1)[0];
|
|
534
|
+
}
|
|
535
|
+
testName() {
|
|
536
|
+
return this.getTestName();
|
|
537
|
+
}
|
|
538
|
+
test_name() {
|
|
539
|
+
return this.getTestName();
|
|
540
|
+
}
|
|
541
|
+
setTestName(val) {
|
|
542
|
+
this._testName = val;
|
|
543
|
+
this._dirtyMask |= 1 << 1;
|
|
544
|
+
}
|
|
545
|
+
getMessageType() {
|
|
546
|
+
if ((this._dirtyMask & (1 << 2)) !== 0) {
|
|
547
|
+
return this._messageType;
|
|
548
|
+
}
|
|
549
|
+
return readString(this._raw, 2)[0];
|
|
550
|
+
}
|
|
551
|
+
messageType() {
|
|
552
|
+
return this.getMessageType();
|
|
553
|
+
}
|
|
554
|
+
message_type() {
|
|
555
|
+
return this.getMessageType();
|
|
556
|
+
}
|
|
557
|
+
setMessageType(val) {
|
|
558
|
+
this._messageType = val;
|
|
559
|
+
this._dirtyMask |= 1 << 2;
|
|
560
|
+
}
|
|
561
|
+
getTier() {
|
|
562
|
+
if ((this._dirtyMask & (1 << 3)) !== 0) {
|
|
563
|
+
return this._tier;
|
|
564
|
+
}
|
|
565
|
+
return readEnum(this._raw, 3)[0];
|
|
566
|
+
}
|
|
567
|
+
tier() {
|
|
568
|
+
return this.getTier();
|
|
569
|
+
}
|
|
570
|
+
setTier(val) {
|
|
571
|
+
this._tier = val;
|
|
572
|
+
this._dirtyMask |= 1 << 3;
|
|
573
|
+
}
|
|
574
|
+
getRequestedOutputFormat() {
|
|
575
|
+
if ((this._dirtyMask & (1 << 4)) !== 0) {
|
|
576
|
+
return this._requestedOutputFormat;
|
|
577
|
+
}
|
|
578
|
+
return readEnum(this._raw, 4)[0];
|
|
579
|
+
}
|
|
580
|
+
requestedOutputFormat() {
|
|
581
|
+
return this.getRequestedOutputFormat();
|
|
582
|
+
}
|
|
583
|
+
requested_output_format() {
|
|
584
|
+
return this.getRequestedOutputFormat();
|
|
585
|
+
}
|
|
586
|
+
setRequestedOutputFormat(val) {
|
|
587
|
+
this._requestedOutputFormat = val;
|
|
588
|
+
this._dirtyMask |= 1 << 4;
|
|
589
|
+
}
|
|
590
|
+
getOmnibufPayload() {
|
|
591
|
+
if ((this._dirtyMask & (1 << 5)) !== 0) {
|
|
592
|
+
return this._omnibufPayload;
|
|
593
|
+
}
|
|
594
|
+
return readBytes(this._raw, 5)[0];
|
|
595
|
+
}
|
|
596
|
+
omnibufPayload() {
|
|
597
|
+
return this.getOmnibufPayload();
|
|
598
|
+
}
|
|
599
|
+
omnibuf_payload() {
|
|
600
|
+
return this.getOmnibufPayload();
|
|
601
|
+
}
|
|
602
|
+
setOmnibufPayload(val) {
|
|
603
|
+
this._omnibufPayload = val;
|
|
604
|
+
this._dirtyMask |= 1 << 5;
|
|
605
|
+
}
|
|
606
|
+
getJsonPayload() {
|
|
607
|
+
if ((this._dirtyMask & (1 << 6)) !== 0) {
|
|
608
|
+
return this._jsonPayload;
|
|
609
|
+
}
|
|
610
|
+
return readString(this._raw, 6)[0];
|
|
611
|
+
}
|
|
612
|
+
jsonPayload() {
|
|
613
|
+
return this.getJsonPayload();
|
|
614
|
+
}
|
|
615
|
+
json_payload() {
|
|
616
|
+
return this.getJsonPayload();
|
|
617
|
+
}
|
|
618
|
+
setJsonPayload(val) {
|
|
619
|
+
this._jsonPayload = val;
|
|
620
|
+
this._dirtyMask |= 1 << 6;
|
|
621
|
+
}
|
|
622
|
+
getSelfDescribing() {
|
|
623
|
+
if ((this._dirtyMask & (1 << 7)) !== 0) {
|
|
624
|
+
return this._selfDescribing;
|
|
625
|
+
}
|
|
626
|
+
return readBool(this._raw, 7)[0];
|
|
627
|
+
}
|
|
628
|
+
selfDescribing() {
|
|
629
|
+
return this.getSelfDescribing();
|
|
630
|
+
}
|
|
631
|
+
self_describing() {
|
|
632
|
+
return this.getSelfDescribing();
|
|
633
|
+
}
|
|
634
|
+
setSelfDescribing(val) {
|
|
635
|
+
this._selfDescribing = val;
|
|
636
|
+
this._dirtyMask |= 1 << 7;
|
|
637
|
+
}
|
|
638
|
+
getTestOpaqueSplice() {
|
|
639
|
+
if ((this._dirtyMask & (1 << 8)) !== 0) {
|
|
640
|
+
return this._testOpaqueSplice;
|
|
641
|
+
}
|
|
642
|
+
return readBool(this._raw, 8)[0];
|
|
643
|
+
}
|
|
644
|
+
testOpaqueSplice() {
|
|
645
|
+
return this.getTestOpaqueSplice();
|
|
646
|
+
}
|
|
647
|
+
test_opaque_splice() {
|
|
648
|
+
return this.getTestOpaqueSplice();
|
|
649
|
+
}
|
|
650
|
+
setTestOpaqueSplice(val) {
|
|
651
|
+
this._testOpaqueSplice = val;
|
|
652
|
+
this._dirtyMask |= 1 << 8;
|
|
653
|
+
}
|
|
654
|
+
getTestOpaqueSpliceShrink() {
|
|
655
|
+
if ((this._dirtyMask & (1 << 9)) !== 0) {
|
|
656
|
+
return this._testOpaqueSpliceShrink;
|
|
657
|
+
}
|
|
658
|
+
return readBool(this._raw, 9)[0];
|
|
659
|
+
}
|
|
660
|
+
testOpaqueSpliceShrink() {
|
|
661
|
+
return this.getTestOpaqueSpliceShrink();
|
|
662
|
+
}
|
|
663
|
+
test_opaque_splice_shrink() {
|
|
664
|
+
return this.getTestOpaqueSpliceShrink();
|
|
665
|
+
}
|
|
666
|
+
setTestOpaqueSpliceShrink(val) {
|
|
667
|
+
this._testOpaqueSpliceShrink = val;
|
|
668
|
+
this._dirtyMask |= 1 << 9;
|
|
669
|
+
}
|
|
670
|
+
marshal(options) {
|
|
671
|
+
if (this._dirtyMask !== 0) {
|
|
672
|
+
this._raw = spliceFields(this._raw, this._dirtyMask, 9, (enc, fnum) => {
|
|
673
|
+
switch (fnum) {
|
|
674
|
+
case 1: {
|
|
675
|
+
const msg = { testName: this._testName };
|
|
676
|
+
enc.writeString(1, msg.testName ?? msg.test_name ?? '');
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
case 2: {
|
|
680
|
+
const msg = { messageType: this._messageType };
|
|
681
|
+
enc.writeString(2, msg.messageType ?? msg.message_type ?? '');
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
case 3: {
|
|
685
|
+
const msg = { tier: this._tier };
|
|
686
|
+
enc.writeInt(3, Number(msg.tier ?? 0) | 0);
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
case 4: {
|
|
690
|
+
const msg = {
|
|
691
|
+
requestedOutputFormat: this._requestedOutputFormat,
|
|
692
|
+
};
|
|
693
|
+
enc.writeInt(4, Number(msg.requestedOutputFormat ?? msg.requested_output_format ?? 0) | 0);
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
case 5: {
|
|
697
|
+
const msg = { omnibufPayload: this._omnibufPayload };
|
|
698
|
+
enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
case 6: {
|
|
702
|
+
const msg = { jsonPayload: this._jsonPayload };
|
|
703
|
+
enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
case 7: {
|
|
707
|
+
const msg = { selfDescribing: this._selfDescribing };
|
|
708
|
+
enc.writeBool(7, Boolean(msg.selfDescribing ?? msg.self_describing));
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
case 8: {
|
|
712
|
+
const msg = {
|
|
713
|
+
testOpaqueSplice: this._testOpaqueSplice,
|
|
714
|
+
};
|
|
715
|
+
enc.writeBool(8, Boolean(msg.testOpaqueSplice ?? msg.test_opaque_splice));
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
case 9: {
|
|
719
|
+
const msg = {
|
|
720
|
+
testOpaqueSpliceShrink: this._testOpaqueSpliceShrink,
|
|
721
|
+
};
|
|
722
|
+
enc.writeBool(9, Boolean(msg.testOpaqueSpliceShrink ?? msg.test_opaque_splice_shrink));
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
this._dirtyMask = 0;
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
validateMessage(this._raw);
|
|
731
|
+
}
|
|
732
|
+
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
733
|
+
const f0 = encodeField0SchemaMeta(ConformanceRequestSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
734
|
+
const out = new Uint8Array(f0.length + this._raw.length);
|
|
735
|
+
out.set(f0, 0);
|
|
736
|
+
out.set(this._raw, f0.length);
|
|
737
|
+
return out;
|
|
738
|
+
}
|
|
739
|
+
return this._raw;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
export const ConformanceResponseSchema = defineMessage('omnibuf.conformance.ConformanceResponse', {
|
|
743
|
+
parseError: { fieldNum: 1, name: 'parse_error', type: 'string' },
|
|
744
|
+
serializeError: { fieldNum: 2, name: 'serialize_error', type: 'string' },
|
|
745
|
+
runtimeError: { fieldNum: 3, name: 'runtime_error', type: 'string' },
|
|
746
|
+
skipped: { fieldNum: 4, type: 'string' },
|
|
747
|
+
omnibufPayload: { fieldNum: 5, name: 'omnibuf_payload', type: 'bytes' },
|
|
748
|
+
jsonPayload: { fieldNum: 6, name: 'json_payload', type: 'string' },
|
|
749
|
+
});
|
|
750
|
+
class ConformanceResponseMsg {
|
|
751
|
+
parseError = '';
|
|
752
|
+
get parse_error() {
|
|
753
|
+
return this.parseError;
|
|
754
|
+
}
|
|
755
|
+
set parse_error(v) {
|
|
756
|
+
this.parseError = v;
|
|
757
|
+
}
|
|
758
|
+
serializeError = '';
|
|
759
|
+
get serialize_error() {
|
|
760
|
+
return this.serializeError;
|
|
761
|
+
}
|
|
762
|
+
set serialize_error(v) {
|
|
763
|
+
this.serializeError = v;
|
|
764
|
+
}
|
|
765
|
+
runtimeError = '';
|
|
766
|
+
get runtime_error() {
|
|
767
|
+
return this.runtimeError;
|
|
768
|
+
}
|
|
769
|
+
set runtime_error(v) {
|
|
770
|
+
this.runtimeError = v;
|
|
771
|
+
}
|
|
772
|
+
skipped = '';
|
|
773
|
+
omnibufPayload = new Uint8Array(0);
|
|
774
|
+
get omnibuf_payload() {
|
|
775
|
+
return this.omnibufPayload;
|
|
776
|
+
}
|
|
777
|
+
set omnibuf_payload(v) {
|
|
778
|
+
this.omnibufPayload = v;
|
|
779
|
+
}
|
|
780
|
+
jsonPayload = '';
|
|
781
|
+
get json_payload() {
|
|
782
|
+
return this.jsonPayload;
|
|
783
|
+
}
|
|
784
|
+
set json_payload(v) {
|
|
785
|
+
this.jsonPayload = v;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
Object.defineProperty(ConformanceResponseMsg.prototype, '$typeName', {
|
|
789
|
+
value: 'omnibuf.conformance.ConformanceResponse',
|
|
790
|
+
enumerable: false,
|
|
791
|
+
writable: true,
|
|
792
|
+
configurable: true,
|
|
793
|
+
});
|
|
794
|
+
export function createConformanceResponse(init) {
|
|
795
|
+
if (init === undefined)
|
|
796
|
+
return new ConformanceResponseMsg();
|
|
797
|
+
return ConformanceResponseSchema.create(init);
|
|
798
|
+
}
|
|
799
|
+
export function encodeConformanceResponse(enc, msg, options) {
|
|
800
|
+
enc.writeString(1, msg.parseError ?? msg.parse_error ?? '');
|
|
801
|
+
enc.writeString(2, msg.serializeError ?? msg.serialize_error ?? '');
|
|
802
|
+
enc.writeString(3, msg.runtimeError ?? msg.runtime_error ?? '');
|
|
803
|
+
enc.writeString(4, msg.skipped ?? '');
|
|
804
|
+
enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
|
|
805
|
+
enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
|
|
806
|
+
if (options?.writeUnknownFields && Array.isArray(msg.$unknown)) {
|
|
807
|
+
for (const uf of msg.$unknown) {
|
|
808
|
+
enc.writeTag(uf.no, uf.wireType);
|
|
809
|
+
enc.writeRaw(uf.data);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
export function marshalConformanceResponseOmniBuf(msg, options) {
|
|
814
|
+
const enc = new Encoder(256);
|
|
815
|
+
if (options?.selfDescribing) {
|
|
816
|
+
writeField0SchemaMeta(enc, ConformanceResponseSchema.getSchemaMeta(0, msg), Boolean(options.deterministic));
|
|
817
|
+
}
|
|
818
|
+
encodeConformanceResponse(enc, msg, options);
|
|
819
|
+
return enc.finish();
|
|
820
|
+
}
|
|
821
|
+
export function decodeConformanceResponse(buf, target, depth = 0, options, startPos = 0, endPos = buf.length) {
|
|
822
|
+
const maxDepth = options?.recursionLimit ?? MaxNestingDepth;
|
|
823
|
+
const readUnknown = options?.readUnknownFields ?? true;
|
|
824
|
+
if (depth > maxDepth) {
|
|
825
|
+
throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
|
|
826
|
+
}
|
|
827
|
+
const out = target ?? new ConformanceResponseMsg();
|
|
828
|
+
if (target !== undefined) {
|
|
829
|
+
if (!(out instanceof ConformanceResponseMsg)) {
|
|
830
|
+
Object.setPrototypeOf(out, ConformanceResponseMsg.prototype);
|
|
831
|
+
}
|
|
832
|
+
if (!options?.merge) {
|
|
833
|
+
if (Object.hasOwn(out, 'parse_error'))
|
|
834
|
+
delete out.parse_error;
|
|
835
|
+
if (Object.hasOwn(out, 'serialize_error'))
|
|
836
|
+
delete out.serialize_error;
|
|
837
|
+
if (Object.hasOwn(out, 'runtime_error'))
|
|
838
|
+
delete out.runtime_error;
|
|
839
|
+
if (Object.hasOwn(out, 'omnibuf_payload'))
|
|
840
|
+
delete out.omnibuf_payload;
|
|
841
|
+
if (Object.hasOwn(out, 'json_payload'))
|
|
842
|
+
delete out.json_payload;
|
|
843
|
+
Object.assign(out, new ConformanceResponseMsg());
|
|
844
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
845
|
+
delete out.$unknown;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
const n = endPos;
|
|
849
|
+
let pos = startPos;
|
|
850
|
+
let seenMask = 0;
|
|
851
|
+
let unknownFields = Array.isArray(out.$unknown)
|
|
852
|
+
? out.$unknown
|
|
853
|
+
: null;
|
|
854
|
+
while (pos < n) {
|
|
855
|
+
let tag = 0;
|
|
856
|
+
const b0 = buf[pos];
|
|
857
|
+
if ((b0 & 1) !== 0) {
|
|
858
|
+
tag = b0 >>> 1;
|
|
859
|
+
pos += 1;
|
|
860
|
+
}
|
|
861
|
+
else if ((b0 & 2) !== 0) {
|
|
862
|
+
if (pos + 2 > n)
|
|
863
|
+
throw new Error('omnibuf: truncated tag');
|
|
864
|
+
tag = ((b0 | (buf[pos + 1] << 8)) >>> 2) >>> 0;
|
|
865
|
+
pos += 2;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
const [t64, tn] = decodeVarintBigInt(buf, pos, n);
|
|
869
|
+
if (tn === 0 || t64 >> 4n > 536870911n)
|
|
870
|
+
throw new Error('omnibuf: invalid tag');
|
|
871
|
+
tag = Number(t64);
|
|
872
|
+
pos += tn;
|
|
873
|
+
}
|
|
874
|
+
const fieldNum = tag <= 0x7fffffff ? tag >>> 4 : Math.floor(tag / 16);
|
|
875
|
+
const wt = tag & 0x0f;
|
|
876
|
+
if (fieldNum === 0) {
|
|
877
|
+
if (wt !== 12)
|
|
878
|
+
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
879
|
+
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
880
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
881
|
+
pos = nextPos;
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
const bit = fieldNum <= 30 ? 1 << fieldNum : 0;
|
|
885
|
+
const alreadySeen = (seenMask & bit) !== 0 || Boolean(options?.merge);
|
|
886
|
+
switch (fieldNum) {
|
|
887
|
+
case 1: {
|
|
888
|
+
if (!(wt === 10)) {
|
|
889
|
+
const valStart = pos;
|
|
890
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
891
|
+
if (readUnknown) {
|
|
892
|
+
if (!unknownFields)
|
|
893
|
+
unknownFields = [];
|
|
894
|
+
unknownFields.push({
|
|
895
|
+
no: fieldNum,
|
|
896
|
+
wireType: wt,
|
|
897
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
seenMask |= bit;
|
|
903
|
+
if (pos >= n)
|
|
904
|
+
throw new Error('omnibuf: truncated string');
|
|
905
|
+
const sb = buf[pos];
|
|
906
|
+
if ((sb & 1) !== 0) {
|
|
907
|
+
const sLen = sb >>> 1;
|
|
908
|
+
pos += 1;
|
|
909
|
+
if (pos + sLen > n)
|
|
910
|
+
throw new Error('omnibuf: truncated string');
|
|
911
|
+
out.parseError = decodeUTF8(buf, pos, pos + sLen);
|
|
912
|
+
pos += sLen;
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
916
|
+
out.parseError = decodeUTF8(s);
|
|
917
|
+
pos = nextPos;
|
|
918
|
+
}
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
case 2: {
|
|
922
|
+
if (!(wt === 10)) {
|
|
923
|
+
const valStart = pos;
|
|
924
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
925
|
+
if (readUnknown) {
|
|
926
|
+
if (!unknownFields)
|
|
927
|
+
unknownFields = [];
|
|
928
|
+
unknownFields.push({
|
|
929
|
+
no: fieldNum,
|
|
930
|
+
wireType: wt,
|
|
931
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
break;
|
|
935
|
+
}
|
|
936
|
+
seenMask |= bit;
|
|
937
|
+
if (pos >= n)
|
|
938
|
+
throw new Error('omnibuf: truncated string');
|
|
939
|
+
const sb = buf[pos];
|
|
940
|
+
if ((sb & 1) !== 0) {
|
|
941
|
+
const sLen = sb >>> 1;
|
|
942
|
+
pos += 1;
|
|
943
|
+
if (pos + sLen > n)
|
|
944
|
+
throw new Error('omnibuf: truncated string');
|
|
945
|
+
out.serializeError = decodeUTF8(buf, pos, pos + sLen);
|
|
946
|
+
pos += sLen;
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
950
|
+
out.serializeError = decodeUTF8(s);
|
|
951
|
+
pos = nextPos;
|
|
952
|
+
}
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
case 3: {
|
|
956
|
+
if (!(wt === 10)) {
|
|
957
|
+
const valStart = pos;
|
|
958
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
959
|
+
if (readUnknown) {
|
|
960
|
+
if (!unknownFields)
|
|
961
|
+
unknownFields = [];
|
|
962
|
+
unknownFields.push({
|
|
963
|
+
no: fieldNum,
|
|
964
|
+
wireType: wt,
|
|
965
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
seenMask |= bit;
|
|
971
|
+
if (pos >= n)
|
|
972
|
+
throw new Error('omnibuf: truncated string');
|
|
973
|
+
const sb = buf[pos];
|
|
974
|
+
if ((sb & 1) !== 0) {
|
|
975
|
+
const sLen = sb >>> 1;
|
|
976
|
+
pos += 1;
|
|
977
|
+
if (pos + sLen > n)
|
|
978
|
+
throw new Error('omnibuf: truncated string');
|
|
979
|
+
out.runtimeError = decodeUTF8(buf, pos, pos + sLen);
|
|
980
|
+
pos += sLen;
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
984
|
+
out.runtimeError = decodeUTF8(s);
|
|
985
|
+
pos = nextPos;
|
|
986
|
+
}
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
case 4: {
|
|
990
|
+
if (!(wt === 10)) {
|
|
991
|
+
const valStart = pos;
|
|
992
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
993
|
+
if (readUnknown) {
|
|
994
|
+
if (!unknownFields)
|
|
995
|
+
unknownFields = [];
|
|
996
|
+
unknownFields.push({
|
|
997
|
+
no: fieldNum,
|
|
998
|
+
wireType: wt,
|
|
999
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
seenMask |= bit;
|
|
1005
|
+
if (pos >= n)
|
|
1006
|
+
throw new Error('omnibuf: truncated string');
|
|
1007
|
+
const sb = buf[pos];
|
|
1008
|
+
if ((sb & 1) !== 0) {
|
|
1009
|
+
const sLen = sb >>> 1;
|
|
1010
|
+
pos += 1;
|
|
1011
|
+
if (pos + sLen > n)
|
|
1012
|
+
throw new Error('omnibuf: truncated string');
|
|
1013
|
+
out.skipped = decodeUTF8(buf, pos, pos + sLen);
|
|
1014
|
+
pos += sLen;
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
1018
|
+
out.skipped = decodeUTF8(s);
|
|
1019
|
+
pos = nextPos;
|
|
1020
|
+
}
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
case 5: {
|
|
1024
|
+
if (!(wt === 11)) {
|
|
1025
|
+
const valStart = pos;
|
|
1026
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
1027
|
+
if (readUnknown) {
|
|
1028
|
+
if (!unknownFields)
|
|
1029
|
+
unknownFields = [];
|
|
1030
|
+
unknownFields.push({
|
|
1031
|
+
no: fieldNum,
|
|
1032
|
+
wireType: wt,
|
|
1033
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
seenMask |= bit;
|
|
1039
|
+
const [b, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
1040
|
+
out.omnibufPayload = b.slice();
|
|
1041
|
+
pos = nextPos;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
case 6: {
|
|
1045
|
+
if (!(wt === 10)) {
|
|
1046
|
+
const valStart = pos;
|
|
1047
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
1048
|
+
if (readUnknown) {
|
|
1049
|
+
if (!unknownFields)
|
|
1050
|
+
unknownFields = [];
|
|
1051
|
+
unknownFields.push({
|
|
1052
|
+
no: fieldNum,
|
|
1053
|
+
wireType: wt,
|
|
1054
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
seenMask |= bit;
|
|
1060
|
+
if (pos >= n)
|
|
1061
|
+
throw new Error('omnibuf: truncated string');
|
|
1062
|
+
const sb = buf[pos];
|
|
1063
|
+
if ((sb & 1) !== 0) {
|
|
1064
|
+
const sLen = sb >>> 1;
|
|
1065
|
+
pos += 1;
|
|
1066
|
+
if (pos + sLen > n)
|
|
1067
|
+
throw new Error('omnibuf: truncated string');
|
|
1068
|
+
out.jsonPayload = decodeUTF8(buf, pos, pos + sLen);
|
|
1069
|
+
pos += sLen;
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
const [s, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
1073
|
+
out.jsonPayload = decodeUTF8(s);
|
|
1074
|
+
pos = nextPos;
|
|
1075
|
+
}
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
default: {
|
|
1079
|
+
const valStart = pos;
|
|
1080
|
+
pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
|
|
1081
|
+
if (readUnknown) {
|
|
1082
|
+
if (!unknownFields)
|
|
1083
|
+
unknownFields = [];
|
|
1084
|
+
unknownFields.push({
|
|
1085
|
+
no: fieldNum,
|
|
1086
|
+
wireType: wt,
|
|
1087
|
+
data: buf.subarray(valStart, pos).slice(),
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
if (unknownFields && unknownFields.length > 0 && !('$unknown' in out)) {
|
|
1095
|
+
Object.defineProperty(out, '$unknown', {
|
|
1096
|
+
value: unknownFields,
|
|
1097
|
+
enumerable: false,
|
|
1098
|
+
writable: true,
|
|
1099
|
+
configurable: true,
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
return out;
|
|
1103
|
+
}
|
|
1104
|
+
export function unmarshalConformanceResponseOmniBuf(buf, options) {
|
|
1105
|
+
return decodeConformanceResponse(buf, undefined, 0, options);
|
|
1106
|
+
}
|
|
1107
|
+
ConformanceResponseSchema.setGeneratedCodec({
|
|
1108
|
+
create: () => new ConformanceResponseMsg(),
|
|
1109
|
+
encode: encodeConformanceResponse,
|
|
1110
|
+
decode: decodeConformanceResponse,
|
|
1111
|
+
});
|
|
1112
|
+
export class OpaqueConformanceResponse {
|
|
1113
|
+
_raw;
|
|
1114
|
+
_dirtyMask = 0;
|
|
1115
|
+
_parseError;
|
|
1116
|
+
_serializeError;
|
|
1117
|
+
_runtimeError;
|
|
1118
|
+
_skipped;
|
|
1119
|
+
_omnibufPayload;
|
|
1120
|
+
_jsonPayload;
|
|
1121
|
+
constructor(raw) {
|
|
1122
|
+
this._raw = raw;
|
|
1123
|
+
}
|
|
1124
|
+
raw() {
|
|
1125
|
+
return this._raw;
|
|
1126
|
+
}
|
|
1127
|
+
getParseError() {
|
|
1128
|
+
if ((this._dirtyMask & (1 << 1)) !== 0) {
|
|
1129
|
+
return this._parseError;
|
|
1130
|
+
}
|
|
1131
|
+
return readString(this._raw, 1)[0];
|
|
1132
|
+
}
|
|
1133
|
+
parseError() {
|
|
1134
|
+
return this.getParseError();
|
|
1135
|
+
}
|
|
1136
|
+
parse_error() {
|
|
1137
|
+
return this.getParseError();
|
|
1138
|
+
}
|
|
1139
|
+
setParseError(val) {
|
|
1140
|
+
this._parseError = val;
|
|
1141
|
+
this._dirtyMask |= 1 << 1;
|
|
1142
|
+
}
|
|
1143
|
+
getSerializeError() {
|
|
1144
|
+
if ((this._dirtyMask & (1 << 2)) !== 0) {
|
|
1145
|
+
return this._serializeError;
|
|
1146
|
+
}
|
|
1147
|
+
return readString(this._raw, 2)[0];
|
|
1148
|
+
}
|
|
1149
|
+
serializeError() {
|
|
1150
|
+
return this.getSerializeError();
|
|
1151
|
+
}
|
|
1152
|
+
serialize_error() {
|
|
1153
|
+
return this.getSerializeError();
|
|
1154
|
+
}
|
|
1155
|
+
setSerializeError(val) {
|
|
1156
|
+
this._serializeError = val;
|
|
1157
|
+
this._dirtyMask |= 1 << 2;
|
|
1158
|
+
}
|
|
1159
|
+
getRuntimeError() {
|
|
1160
|
+
if ((this._dirtyMask & (1 << 3)) !== 0) {
|
|
1161
|
+
return this._runtimeError;
|
|
1162
|
+
}
|
|
1163
|
+
return readString(this._raw, 3)[0];
|
|
1164
|
+
}
|
|
1165
|
+
runtimeError() {
|
|
1166
|
+
return this.getRuntimeError();
|
|
1167
|
+
}
|
|
1168
|
+
runtime_error() {
|
|
1169
|
+
return this.getRuntimeError();
|
|
1170
|
+
}
|
|
1171
|
+
setRuntimeError(val) {
|
|
1172
|
+
this._runtimeError = val;
|
|
1173
|
+
this._dirtyMask |= 1 << 3;
|
|
1174
|
+
}
|
|
1175
|
+
getSkipped() {
|
|
1176
|
+
if ((this._dirtyMask & (1 << 4)) !== 0) {
|
|
1177
|
+
return this._skipped;
|
|
1178
|
+
}
|
|
1179
|
+
return readString(this._raw, 4)[0];
|
|
1180
|
+
}
|
|
1181
|
+
skipped() {
|
|
1182
|
+
return this.getSkipped();
|
|
1183
|
+
}
|
|
1184
|
+
setSkipped(val) {
|
|
1185
|
+
this._skipped = val;
|
|
1186
|
+
this._dirtyMask |= 1 << 4;
|
|
1187
|
+
}
|
|
1188
|
+
getOmnibufPayload() {
|
|
1189
|
+
if ((this._dirtyMask & (1 << 5)) !== 0) {
|
|
1190
|
+
return this._omnibufPayload;
|
|
1191
|
+
}
|
|
1192
|
+
return readBytes(this._raw, 5)[0];
|
|
1193
|
+
}
|
|
1194
|
+
omnibufPayload() {
|
|
1195
|
+
return this.getOmnibufPayload();
|
|
1196
|
+
}
|
|
1197
|
+
omnibuf_payload() {
|
|
1198
|
+
return this.getOmnibufPayload();
|
|
1199
|
+
}
|
|
1200
|
+
setOmnibufPayload(val) {
|
|
1201
|
+
this._omnibufPayload = val;
|
|
1202
|
+
this._dirtyMask |= 1 << 5;
|
|
1203
|
+
}
|
|
1204
|
+
getJsonPayload() {
|
|
1205
|
+
if ((this._dirtyMask & (1 << 6)) !== 0) {
|
|
1206
|
+
return this._jsonPayload;
|
|
1207
|
+
}
|
|
1208
|
+
return readString(this._raw, 6)[0];
|
|
1209
|
+
}
|
|
1210
|
+
jsonPayload() {
|
|
1211
|
+
return this.getJsonPayload();
|
|
1212
|
+
}
|
|
1213
|
+
json_payload() {
|
|
1214
|
+
return this.getJsonPayload();
|
|
1215
|
+
}
|
|
1216
|
+
setJsonPayload(val) {
|
|
1217
|
+
this._jsonPayload = val;
|
|
1218
|
+
this._dirtyMask |= 1 << 6;
|
|
1219
|
+
}
|
|
1220
|
+
marshal(options) {
|
|
1221
|
+
if (this._dirtyMask !== 0) {
|
|
1222
|
+
this._raw = spliceFields(this._raw, this._dirtyMask, 6, (enc, fnum) => {
|
|
1223
|
+
switch (fnum) {
|
|
1224
|
+
case 1: {
|
|
1225
|
+
const msg = { parseError: this._parseError };
|
|
1226
|
+
enc.writeString(1, msg.parseError ?? msg.parse_error ?? '');
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
case 2: {
|
|
1230
|
+
const msg = { serializeError: this._serializeError };
|
|
1231
|
+
enc.writeString(2, msg.serializeError ?? msg.serialize_error ?? '');
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
case 3: {
|
|
1235
|
+
const msg = { runtimeError: this._runtimeError };
|
|
1236
|
+
enc.writeString(3, msg.runtimeError ?? msg.runtime_error ?? '');
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
case 4: {
|
|
1240
|
+
const msg = { skipped: this._skipped };
|
|
1241
|
+
enc.writeString(4, msg.skipped ?? '');
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
case 5: {
|
|
1245
|
+
const msg = { omnibufPayload: this._omnibufPayload };
|
|
1246
|
+
enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1249
|
+
case 6: {
|
|
1250
|
+
const msg = { jsonPayload: this._jsonPayload };
|
|
1251
|
+
enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
|
|
1252
|
+
break;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
this._dirtyMask = 0;
|
|
1257
|
+
}
|
|
1258
|
+
else {
|
|
1259
|
+
validateMessage(this._raw);
|
|
1260
|
+
}
|
|
1261
|
+
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
1262
|
+
const f0 = encodeField0SchemaMeta(ConformanceResponseSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
1263
|
+
const out = new Uint8Array(f0.length + this._raw.length);
|
|
1264
|
+
out.set(f0, 0);
|
|
1265
|
+
out.set(this._raw, f0.length);
|
|
1266
|
+
return out;
|
|
1267
|
+
}
|
|
1268
|
+
return this._raw;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
5
1271
|
export const AllTypesSubMsgSchema = defineMessage('omnibuf.conformance.AllTypesSubMsg', {
|
|
6
1272
|
id: { fieldNum: 1, type: 'uint32' },
|
|
7
1273
|
label: { fieldNum: 2, type: 'string' },
|
|
@@ -52,9 +1318,15 @@ export function decodeAllTypesSubMsg(buf, target, depth = 0, options, startPos =
|
|
|
52
1318
|
throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
|
|
53
1319
|
}
|
|
54
1320
|
const out = target ?? new AllTypesSubMsgMsg();
|
|
55
|
-
if (target !== undefined
|
|
56
|
-
|
|
57
|
-
|
|
1321
|
+
if (target !== undefined) {
|
|
1322
|
+
if (!(out instanceof AllTypesSubMsgMsg)) {
|
|
1323
|
+
Object.setPrototypeOf(out, AllTypesSubMsgMsg.prototype);
|
|
1324
|
+
}
|
|
1325
|
+
if (!options?.merge) {
|
|
1326
|
+
Object.assign(out, new AllTypesSubMsgMsg());
|
|
1327
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
1328
|
+
delete out.$unknown;
|
|
1329
|
+
}
|
|
58
1330
|
}
|
|
59
1331
|
const n = endPos;
|
|
60
1332
|
let pos = startPos;
|
|
@@ -88,7 +1360,7 @@ export function decodeAllTypesSubMsg(buf, target, depth = 0, options, startPos =
|
|
|
88
1360
|
if (wt !== 12)
|
|
89
1361
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
90
1362
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
91
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1363
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
92
1364
|
pos = nextPos;
|
|
93
1365
|
continue;
|
|
94
1366
|
}
|
|
@@ -274,7 +1546,7 @@ export class OpaqueAllTypesSubMsg {
|
|
|
274
1546
|
if ((this._dirtyMask & (1 << 1)) !== 0) {
|
|
275
1547
|
return this._id;
|
|
276
1548
|
}
|
|
277
|
-
return
|
|
1549
|
+
return readUint32(this._raw, 1)[0];
|
|
278
1550
|
}
|
|
279
1551
|
id() {
|
|
280
1552
|
return this.getId();
|
|
@@ -350,7 +1622,10 @@ export class OpaqueAllTypesSubMsg {
|
|
|
350
1622
|
});
|
|
351
1623
|
this._dirtyMask = 0;
|
|
352
1624
|
}
|
|
353
|
-
|
|
1625
|
+
else {
|
|
1626
|
+
validateMessage(this._raw);
|
|
1627
|
+
}
|
|
1628
|
+
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
354
1629
|
const f0 = encodeField0SchemaMeta(AllTypesSubMsgSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
355
1630
|
const out = new Uint8Array(f0.length + this._raw.length);
|
|
356
1631
|
out.set(f0, 0);
|
|
@@ -530,7 +1805,7 @@ export function createTestAllTypes(init) {
|
|
|
530
1805
|
export function encodeTestAllTypes(enc, msg, options) {
|
|
531
1806
|
enc.writeUint(1, Number(msg.f1Uint32 ?? msg.f1_uint32 ?? 0) >>> 0);
|
|
532
1807
|
enc.writeUint(2, msg.f2Uint64 ?? msg.f2_uint64 ?? 0);
|
|
533
|
-
enc.writeInt(3, msg.f3Sint32 ?? msg.f3_sint32 ?? 0);
|
|
1808
|
+
enc.writeInt(3, Number(msg.f3Sint32 ?? msg.f3_sint32 ?? 0) | 0);
|
|
534
1809
|
enc.writeInt(4, msg.f4Sint64 ?? msg.f4_sint64 ?? 0);
|
|
535
1810
|
enc.writeBool(5, Boolean(msg.f5Bool ?? msg.f5_bool));
|
|
536
1811
|
enc.writeString(6, msg.f6String ?? msg.f6_string ?? '');
|
|
@@ -550,7 +1825,8 @@ export function encodeTestAllTypes(enc, msg, options) {
|
|
|
550
1825
|
enc.beginSubMsgArr(11);
|
|
551
1826
|
for (let i = 0; i < arr.length; i++) {
|
|
552
1827
|
enc.beginSubMsgElem();
|
|
553
|
-
|
|
1828
|
+
if (arr[i] !== null && arr[i] !== undefined)
|
|
1829
|
+
encodeAllTypesSubMsg(enc, arr[i], options);
|
|
554
1830
|
enc.endSubMsgElem();
|
|
555
1831
|
}
|
|
556
1832
|
enc.endSubMsgArr();
|
|
@@ -572,7 +1848,7 @@ export function encodeTestAllTypes(enc, msg, options) {
|
|
|
572
1848
|
}
|
|
573
1849
|
enc.writeFloat32(13, msg.f13Float32 ?? msg.f13_float32 ?? 0);
|
|
574
1850
|
enc.writeFloat64(14, msg.f14Float64 ?? msg.f14_float64 ?? 0);
|
|
575
|
-
enc.writeFixed32(15, msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0);
|
|
1851
|
+
enc.writeFixed32(15, Number(msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0) >>> 0);
|
|
576
1852
|
enc.writeFixed64(16, msg.f16Fixed64 ?? msg.f16_fixed64 ?? 0);
|
|
577
1853
|
enc.writeString(20, msg.f20OverflowStr ?? msg.f20_overflow_str ?? '');
|
|
578
1854
|
if (options?.writeUnknownFields && Array.isArray(msg.$unknown)) {
|
|
@@ -597,9 +1873,49 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
597
1873
|
throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
|
|
598
1874
|
}
|
|
599
1875
|
const out = target ?? new TestAllTypesMsg();
|
|
600
|
-
if (target !== undefined
|
|
601
|
-
|
|
602
|
-
|
|
1876
|
+
if (target !== undefined) {
|
|
1877
|
+
if (!(out instanceof TestAllTypesMsg)) {
|
|
1878
|
+
Object.setPrototypeOf(out, TestAllTypesMsg.prototype);
|
|
1879
|
+
}
|
|
1880
|
+
if (!options?.merge) {
|
|
1881
|
+
if (Object.hasOwn(out, 'f1_uint32'))
|
|
1882
|
+
delete out.f1_uint32;
|
|
1883
|
+
if (Object.hasOwn(out, 'f2_uint64'))
|
|
1884
|
+
delete out.f2_uint64;
|
|
1885
|
+
if (Object.hasOwn(out, 'f3_sint32'))
|
|
1886
|
+
delete out.f3_sint32;
|
|
1887
|
+
if (Object.hasOwn(out, 'f4_sint64'))
|
|
1888
|
+
delete out.f4_sint64;
|
|
1889
|
+
if (Object.hasOwn(out, 'f5_bool'))
|
|
1890
|
+
delete out.f5_bool;
|
|
1891
|
+
if (Object.hasOwn(out, 'f6_string'))
|
|
1892
|
+
delete out.f6_string;
|
|
1893
|
+
if (Object.hasOwn(out, 'f7_bytes'))
|
|
1894
|
+
delete out.f7_bytes;
|
|
1895
|
+
if (Object.hasOwn(out, 'f8_sub_msg'))
|
|
1896
|
+
delete out.f8_sub_msg;
|
|
1897
|
+
if (Object.hasOwn(out, 'f9_string_arr'))
|
|
1898
|
+
delete out.f9_string_arr;
|
|
1899
|
+
if (Object.hasOwn(out, 'f10_uint32_arr'))
|
|
1900
|
+
delete out.f10_uint32_arr;
|
|
1901
|
+
if (Object.hasOwn(out, 'f11_sub_msg_arr'))
|
|
1902
|
+
delete out.f11_sub_msg_arr;
|
|
1903
|
+
if (Object.hasOwn(out, 'f12_map_str_uint'))
|
|
1904
|
+
delete out.f12_map_str_uint;
|
|
1905
|
+
if (Object.hasOwn(out, 'f13_float32'))
|
|
1906
|
+
delete out.f13_float32;
|
|
1907
|
+
if (Object.hasOwn(out, 'f14_float64'))
|
|
1908
|
+
delete out.f14_float64;
|
|
1909
|
+
if (Object.hasOwn(out, 'f15_fixed32'))
|
|
1910
|
+
delete out.f15_fixed32;
|
|
1911
|
+
if (Object.hasOwn(out, 'f16_fixed64'))
|
|
1912
|
+
delete out.f16_fixed64;
|
|
1913
|
+
if (Object.hasOwn(out, 'f20_overflow_str'))
|
|
1914
|
+
delete out.f20_overflow_str;
|
|
1915
|
+
Object.assign(out, new TestAllTypesMsg());
|
|
1916
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
1917
|
+
delete out.$unknown;
|
|
1918
|
+
}
|
|
603
1919
|
}
|
|
604
1920
|
const n = endPos;
|
|
605
1921
|
let pos = startPos;
|
|
@@ -633,7 +1949,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
633
1949
|
if (wt !== 12)
|
|
634
1950
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
635
1951
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
636
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1952
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
637
1953
|
pos = nextPos;
|
|
638
1954
|
continue;
|
|
639
1955
|
}
|
|
@@ -793,7 +2109,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
793
2109
|
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
794
2110
|
if (vn === 0)
|
|
795
2111
|
throw new Error('omnibuf: truncated int32/enum');
|
|
796
|
-
i32Val =
|
|
2112
|
+
i32Val = decodeZigZag32(v);
|
|
797
2113
|
pos += vn;
|
|
798
2114
|
}
|
|
799
2115
|
out.f3Sint32 = i32Val;
|
|
@@ -960,6 +2276,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
960
2276
|
break;
|
|
961
2277
|
}
|
|
962
2278
|
seenMask |= bit;
|
|
2279
|
+
if (depth + 1 > maxDepth)
|
|
2280
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
963
2281
|
if (pos >= n)
|
|
964
2282
|
throw new Error('omnibuf: invalid string array');
|
|
965
2283
|
const lb = buf[pos];
|
|
@@ -1051,6 +2369,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1051
2369
|
break;
|
|
1052
2370
|
}
|
|
1053
2371
|
seenMask |= bit;
|
|
2372
|
+
if (depth + 1 > maxDepth)
|
|
2373
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
1054
2374
|
if (pos >= n)
|
|
1055
2375
|
throw new Error('omnibuf: invalid uint32 array');
|
|
1056
2376
|
const lb = buf[pos];
|
|
@@ -1148,6 +2468,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1148
2468
|
break;
|
|
1149
2469
|
}
|
|
1150
2470
|
seenMask |= bit;
|
|
2471
|
+
if (depth + 1 > maxDepth)
|
|
2472
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
1151
2473
|
if (pos >= n)
|
|
1152
2474
|
throw new Error('omnibuf: corrupt submsg array');
|
|
1153
2475
|
let arrLen = 0;
|
|
@@ -1173,7 +2495,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1173
2495
|
const [el, en] = decodeVarintBigInt(arrPayload, p);
|
|
1174
2496
|
p += en;
|
|
1175
2497
|
const elNum = Number(el);
|
|
1176
|
-
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth +
|
|
2498
|
+
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth + 2, options, p, p + elNum));
|
|
1177
2499
|
p += elNum;
|
|
1178
2500
|
}
|
|
1179
2501
|
out.f11SubMsgArr = elems;
|
|
@@ -1220,7 +2542,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1220
2542
|
}
|
|
1221
2543
|
if (p + elNum > arrEnd)
|
|
1222
2544
|
throw new Error('omnibuf: corrupt submsg array');
|
|
1223
|
-
elems.push(decodeAllTypesSubMsg(buf, undefined, depth +
|
|
2545
|
+
elems.push(decodeAllTypesSubMsg(buf, undefined, depth + 2, options, p, p + elNum));
|
|
1224
2546
|
p += elNum;
|
|
1225
2547
|
}
|
|
1226
2548
|
if (p !== arrEnd)
|
|
@@ -1238,7 +2560,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1238
2560
|
const [el, en] = decodeVarintBigInt(arrPayload, p);
|
|
1239
2561
|
p += en;
|
|
1240
2562
|
const elNum = Number(el);
|
|
1241
|
-
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth +
|
|
2563
|
+
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth + 2, options, p, p + elNum));
|
|
1242
2564
|
p += elNum;
|
|
1243
2565
|
}
|
|
1244
2566
|
out.f11SubMsgArr = elems;
|
|
@@ -1261,10 +2583,14 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1261
2583
|
break;
|
|
1262
2584
|
}
|
|
1263
2585
|
seenMask |= bit;
|
|
2586
|
+
if (depth + 1 > maxDepth)
|
|
2587
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
1264
2588
|
const [body, nextPos] = readLenSlice(buf, pos, 3, n);
|
|
1265
2589
|
const keyWT = body[0];
|
|
1266
2590
|
const valWT = body[1];
|
|
1267
2591
|
validateMapTypes(keyWT, valWT);
|
|
2592
|
+
if (keyWT !== 10 || valWT !== 0)
|
|
2593
|
+
throw new Error('omnibuf: WireMap header mismatch');
|
|
1268
2594
|
const [count, cn] = decodeVarintBigInt(body, 2);
|
|
1269
2595
|
if (cn === 0 || count > BigInt(Math.floor((body.length - (2 + cn)) / 2)))
|
|
1270
2596
|
throw new Error('omnibuf: invalid map count');
|
|
@@ -1496,7 +2822,7 @@ export class OpaqueTestAllTypes {
|
|
|
1496
2822
|
if ((this._dirtyMask & (1 << 1)) !== 0) {
|
|
1497
2823
|
return this._f1Uint32;
|
|
1498
2824
|
}
|
|
1499
|
-
return
|
|
2825
|
+
return readUint32(this._raw, 1)[0];
|
|
1500
2826
|
}
|
|
1501
2827
|
f1Uint32() {
|
|
1502
2828
|
return this.getF1Uint32();
|
|
@@ -1528,7 +2854,7 @@ export class OpaqueTestAllTypes {
|
|
|
1528
2854
|
if ((this._dirtyMask & (1 << 3)) !== 0) {
|
|
1529
2855
|
return this._f3Sint32;
|
|
1530
2856
|
}
|
|
1531
|
-
return
|
|
2857
|
+
return readInt32(this._raw, 3)[0];
|
|
1532
2858
|
}
|
|
1533
2859
|
f3Sint32() {
|
|
1534
2860
|
return this.getF3Sint32();
|
|
@@ -1795,7 +3121,7 @@ export class OpaqueTestAllTypes {
|
|
|
1795
3121
|
}
|
|
1796
3122
|
case 3: {
|
|
1797
3123
|
const msg = { f3Sint32: this._f3Sint32 };
|
|
1798
|
-
enc.writeInt(3, msg.f3Sint32 ?? msg.f3_sint32 ?? 0);
|
|
3124
|
+
enc.writeInt(3, Number(msg.f3Sint32 ?? msg.f3_sint32 ?? 0) | 0);
|
|
1799
3125
|
break;
|
|
1800
3126
|
}
|
|
1801
3127
|
case 4: {
|
|
@@ -1847,7 +3173,8 @@ export class OpaqueTestAllTypes {
|
|
|
1847
3173
|
enc.beginSubMsgArr(11);
|
|
1848
3174
|
for (let i = 0; i < arr.length; i++) {
|
|
1849
3175
|
enc.beginSubMsgElem();
|
|
1850
|
-
|
|
3176
|
+
if (arr[i] !== null && arr[i] !== undefined)
|
|
3177
|
+
encodeAllTypesSubMsg(enc, arr[i], options);
|
|
1851
3178
|
enc.endSubMsgElem();
|
|
1852
3179
|
}
|
|
1853
3180
|
enc.endSubMsgArr();
|
|
@@ -1885,7 +3212,7 @@ export class OpaqueTestAllTypes {
|
|
|
1885
3212
|
}
|
|
1886
3213
|
case 15: {
|
|
1887
3214
|
const msg = { f15Fixed32: this._f15Fixed32 };
|
|
1888
|
-
enc.writeFixed32(15, msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0);
|
|
3215
|
+
enc.writeFixed32(15, Number(msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0) >>> 0);
|
|
1889
3216
|
break;
|
|
1890
3217
|
}
|
|
1891
3218
|
case 16: {
|
|
@@ -1902,7 +3229,10 @@ export class OpaqueTestAllTypes {
|
|
|
1902
3229
|
});
|
|
1903
3230
|
this._dirtyMask = 0;
|
|
1904
3231
|
}
|
|
1905
|
-
|
|
3232
|
+
else {
|
|
3233
|
+
validateMessage(this._raw);
|
|
3234
|
+
}
|
|
3235
|
+
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
1906
3236
|
const f0 = encodeField0SchemaMeta(TestAllTypesSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
1907
3237
|
const out = new Uint8Array(f0.length + this._raw.length);
|
|
1908
3238
|
out.set(f0, 0);
|