@omnibuf/node 0.0.8 → 0.1.2
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/LICENSE +201 -21
- 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.map +1 -1
- package/dist/gen/conformance_omnibuf.pb.js +113 -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 +47 -15
- 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 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-omnibuf-es. DO NOT EDIT.
|
|
2
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
5
|
export var WireFormat;
|
|
6
6
|
(function (WireFormat) {
|
|
7
7
|
WireFormat[WireFormat["WIRE_FORMAT_UNSPECIFIED"] = 0] = "WIRE_FORMAT_UNSPECIFIED";
|
|
@@ -100,8 +100,8 @@ export function createConformanceRequest(init) {
|
|
|
100
100
|
export function encodeConformanceRequest(enc, msg, options) {
|
|
101
101
|
enc.writeString(1, msg.testName ?? msg.test_name ?? '');
|
|
102
102
|
enc.writeString(2, msg.messageType ?? msg.message_type ?? '');
|
|
103
|
-
enc.writeInt(3, msg.tier ?? 0);
|
|
104
|
-
enc.writeInt(4, msg.requestedOutputFormat ?? msg.requested_output_format ?? 0);
|
|
103
|
+
enc.writeInt(3, Number(msg.tier ?? 0) | 0);
|
|
104
|
+
enc.writeInt(4, Number(msg.requestedOutputFormat ?? msg.requested_output_format ?? 0) | 0);
|
|
105
105
|
enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
|
|
106
106
|
enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
|
|
107
107
|
enc.writeBool(7, Boolean(msg.selfDescribing ?? msg.self_describing));
|
|
@@ -134,8 +134,25 @@ export function decodeConformanceRequest(buf, target, depth = 0, options, startP
|
|
|
134
134
|
Object.setPrototypeOf(out, ConformanceRequestMsg.prototype);
|
|
135
135
|
}
|
|
136
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;
|
|
137
153
|
Object.assign(out, new ConformanceRequestMsg());
|
|
138
|
-
|
|
154
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
155
|
+
delete out.$unknown;
|
|
139
156
|
}
|
|
140
157
|
}
|
|
141
158
|
const n = endPos;
|
|
@@ -170,7 +187,7 @@ export function decodeConformanceRequest(buf, target, depth = 0, options, startP
|
|
|
170
187
|
if (wt !== 12)
|
|
171
188
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
172
189
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
173
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
190
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
174
191
|
pos = nextPos;
|
|
175
192
|
continue;
|
|
176
193
|
}
|
|
@@ -289,7 +306,7 @@ export function decodeConformanceRequest(buf, target, depth = 0, options, startP
|
|
|
289
306
|
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
290
307
|
if (vn === 0)
|
|
291
308
|
throw new Error('omnibuf: truncated int32/enum');
|
|
292
|
-
i32Val =
|
|
309
|
+
i32Val = decodeZigZag32(v);
|
|
293
310
|
pos += vn;
|
|
294
311
|
}
|
|
295
312
|
out.tier = i32Val;
|
|
@@ -339,7 +356,7 @@ export function decodeConformanceRequest(buf, target, depth = 0, options, startP
|
|
|
339
356
|
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
340
357
|
if (vn === 0)
|
|
341
358
|
throw new Error('omnibuf: truncated int32/enum');
|
|
342
|
-
i32Val =
|
|
359
|
+
i32Val = decodeZigZag32(v);
|
|
343
360
|
pos += vn;
|
|
344
361
|
}
|
|
345
362
|
out.requestedOutputFormat = i32Val;
|
|
@@ -666,14 +683,14 @@ export class OpaqueConformanceRequest {
|
|
|
666
683
|
}
|
|
667
684
|
case 3: {
|
|
668
685
|
const msg = { tier: this._tier };
|
|
669
|
-
enc.writeInt(3, msg.tier ?? 0);
|
|
686
|
+
enc.writeInt(3, Number(msg.tier ?? 0) | 0);
|
|
670
687
|
break;
|
|
671
688
|
}
|
|
672
689
|
case 4: {
|
|
673
690
|
const msg = {
|
|
674
691
|
requestedOutputFormat: this._requestedOutputFormat,
|
|
675
692
|
};
|
|
676
|
-
enc.writeInt(4, msg.requestedOutputFormat ?? msg.requested_output_format ?? 0);
|
|
693
|
+
enc.writeInt(4, Number(msg.requestedOutputFormat ?? msg.requested_output_format ?? 0) | 0);
|
|
677
694
|
break;
|
|
678
695
|
}
|
|
679
696
|
case 5: {
|
|
@@ -709,6 +726,9 @@ export class OpaqueConformanceRequest {
|
|
|
709
726
|
});
|
|
710
727
|
this._dirtyMask = 0;
|
|
711
728
|
}
|
|
729
|
+
else {
|
|
730
|
+
validateMessage(this._raw);
|
|
731
|
+
}
|
|
712
732
|
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
713
733
|
const f0 = encodeField0SchemaMeta(ConformanceRequestSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
714
734
|
const out = new Uint8Array(f0.length + this._raw.length);
|
|
@@ -810,8 +830,19 @@ export function decodeConformanceResponse(buf, target, depth = 0, options, start
|
|
|
810
830
|
Object.setPrototypeOf(out, ConformanceResponseMsg.prototype);
|
|
811
831
|
}
|
|
812
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;
|
|
813
843
|
Object.assign(out, new ConformanceResponseMsg());
|
|
814
|
-
|
|
844
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
845
|
+
delete out.$unknown;
|
|
815
846
|
}
|
|
816
847
|
}
|
|
817
848
|
const n = endPos;
|
|
@@ -846,7 +877,7 @@ export function decodeConformanceResponse(buf, target, depth = 0, options, start
|
|
|
846
877
|
if (wt !== 12)
|
|
847
878
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
848
879
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
849
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
880
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
850
881
|
pos = nextPos;
|
|
851
882
|
continue;
|
|
852
883
|
}
|
|
@@ -1224,6 +1255,9 @@ export class OpaqueConformanceResponse {
|
|
|
1224
1255
|
});
|
|
1225
1256
|
this._dirtyMask = 0;
|
|
1226
1257
|
}
|
|
1258
|
+
else {
|
|
1259
|
+
validateMessage(this._raw);
|
|
1260
|
+
}
|
|
1227
1261
|
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
1228
1262
|
const f0 = encodeField0SchemaMeta(ConformanceResponseSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
1229
1263
|
const out = new Uint8Array(f0.length + this._raw.length);
|
|
@@ -1290,7 +1324,8 @@ export function decodeAllTypesSubMsg(buf, target, depth = 0, options, startPos =
|
|
|
1290
1324
|
}
|
|
1291
1325
|
if (!options?.merge) {
|
|
1292
1326
|
Object.assign(out, new AllTypesSubMsgMsg());
|
|
1293
|
-
|
|
1327
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
1328
|
+
delete out.$unknown;
|
|
1294
1329
|
}
|
|
1295
1330
|
}
|
|
1296
1331
|
const n = endPos;
|
|
@@ -1325,7 +1360,7 @@ export function decodeAllTypesSubMsg(buf, target, depth = 0, options, startPos =
|
|
|
1325
1360
|
if (wt !== 12)
|
|
1326
1361
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
1327
1362
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
1328
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1363
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1329
1364
|
pos = nextPos;
|
|
1330
1365
|
continue;
|
|
1331
1366
|
}
|
|
@@ -1587,6 +1622,9 @@ export class OpaqueAllTypesSubMsg {
|
|
|
1587
1622
|
});
|
|
1588
1623
|
this._dirtyMask = 0;
|
|
1589
1624
|
}
|
|
1625
|
+
else {
|
|
1626
|
+
validateMessage(this._raw);
|
|
1627
|
+
}
|
|
1590
1628
|
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
1591
1629
|
const f0 = encodeField0SchemaMeta(AllTypesSubMsgSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
1592
1630
|
const out = new Uint8Array(f0.length + this._raw.length);
|
|
@@ -1767,7 +1805,7 @@ export function createTestAllTypes(init) {
|
|
|
1767
1805
|
export function encodeTestAllTypes(enc, msg, options) {
|
|
1768
1806
|
enc.writeUint(1, Number(msg.f1Uint32 ?? msg.f1_uint32 ?? 0) >>> 0);
|
|
1769
1807
|
enc.writeUint(2, msg.f2Uint64 ?? msg.f2_uint64 ?? 0);
|
|
1770
|
-
enc.writeInt(3, msg.f3Sint32 ?? msg.f3_sint32 ?? 0);
|
|
1808
|
+
enc.writeInt(3, Number(msg.f3Sint32 ?? msg.f3_sint32 ?? 0) | 0);
|
|
1771
1809
|
enc.writeInt(4, msg.f4Sint64 ?? msg.f4_sint64 ?? 0);
|
|
1772
1810
|
enc.writeBool(5, Boolean(msg.f5Bool ?? msg.f5_bool));
|
|
1773
1811
|
enc.writeString(6, msg.f6String ?? msg.f6_string ?? '');
|
|
@@ -1787,7 +1825,8 @@ export function encodeTestAllTypes(enc, msg, options) {
|
|
|
1787
1825
|
enc.beginSubMsgArr(11);
|
|
1788
1826
|
for (let i = 0; i < arr.length; i++) {
|
|
1789
1827
|
enc.beginSubMsgElem();
|
|
1790
|
-
|
|
1828
|
+
if (arr[i] !== null && arr[i] !== undefined)
|
|
1829
|
+
encodeAllTypesSubMsg(enc, arr[i], options);
|
|
1791
1830
|
enc.endSubMsgElem();
|
|
1792
1831
|
}
|
|
1793
1832
|
enc.endSubMsgArr();
|
|
@@ -1809,7 +1848,7 @@ export function encodeTestAllTypes(enc, msg, options) {
|
|
|
1809
1848
|
}
|
|
1810
1849
|
enc.writeFloat32(13, msg.f13Float32 ?? msg.f13_float32 ?? 0);
|
|
1811
1850
|
enc.writeFloat64(14, msg.f14Float64 ?? msg.f14_float64 ?? 0);
|
|
1812
|
-
enc.writeFixed32(15, msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0);
|
|
1851
|
+
enc.writeFixed32(15, Number(msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0) >>> 0);
|
|
1813
1852
|
enc.writeFixed64(16, msg.f16Fixed64 ?? msg.f16_fixed64 ?? 0);
|
|
1814
1853
|
enc.writeString(20, msg.f20OverflowStr ?? msg.f20_overflow_str ?? '');
|
|
1815
1854
|
if (options?.writeUnknownFields && Array.isArray(msg.$unknown)) {
|
|
@@ -1839,8 +1878,43 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1839
1878
|
Object.setPrototypeOf(out, TestAllTypesMsg.prototype);
|
|
1840
1879
|
}
|
|
1841
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;
|
|
1842
1915
|
Object.assign(out, new TestAllTypesMsg());
|
|
1843
|
-
|
|
1916
|
+
if (Object.hasOwn(out, '$unknown'))
|
|
1917
|
+
delete out.$unknown;
|
|
1844
1918
|
}
|
|
1845
1919
|
}
|
|
1846
1920
|
const n = endPos;
|
|
@@ -1875,7 +1949,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
1875
1949
|
if (wt !== 12)
|
|
1876
1950
|
throw new Error('omnibuf: invalid Field #0 wire type');
|
|
1877
1951
|
const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
|
|
1878
|
-
decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1952
|
+
$decodeSchemaMeta(meta, depth + 1, maxDepth);
|
|
1879
1953
|
pos = nextPos;
|
|
1880
1954
|
continue;
|
|
1881
1955
|
}
|
|
@@ -2035,7 +2109,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2035
2109
|
const [v, vn] = decodeVarintBigInt(buf, pos, n);
|
|
2036
2110
|
if (vn === 0)
|
|
2037
2111
|
throw new Error('omnibuf: truncated int32/enum');
|
|
2038
|
-
i32Val =
|
|
2112
|
+
i32Val = decodeZigZag32(v);
|
|
2039
2113
|
pos += vn;
|
|
2040
2114
|
}
|
|
2041
2115
|
out.f3Sint32 = i32Val;
|
|
@@ -2202,6 +2276,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2202
2276
|
break;
|
|
2203
2277
|
}
|
|
2204
2278
|
seenMask |= bit;
|
|
2279
|
+
if (depth + 1 > maxDepth)
|
|
2280
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
2205
2281
|
if (pos >= n)
|
|
2206
2282
|
throw new Error('omnibuf: invalid string array');
|
|
2207
2283
|
const lb = buf[pos];
|
|
@@ -2293,6 +2369,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2293
2369
|
break;
|
|
2294
2370
|
}
|
|
2295
2371
|
seenMask |= bit;
|
|
2372
|
+
if (depth + 1 > maxDepth)
|
|
2373
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
2296
2374
|
if (pos >= n)
|
|
2297
2375
|
throw new Error('omnibuf: invalid uint32 array');
|
|
2298
2376
|
const lb = buf[pos];
|
|
@@ -2390,6 +2468,8 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2390
2468
|
break;
|
|
2391
2469
|
}
|
|
2392
2470
|
seenMask |= bit;
|
|
2471
|
+
if (depth + 1 > maxDepth)
|
|
2472
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
2393
2473
|
if (pos >= n)
|
|
2394
2474
|
throw new Error('omnibuf: corrupt submsg array');
|
|
2395
2475
|
let arrLen = 0;
|
|
@@ -2415,7 +2495,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2415
2495
|
const [el, en] = decodeVarintBigInt(arrPayload, p);
|
|
2416
2496
|
p += en;
|
|
2417
2497
|
const elNum = Number(el);
|
|
2418
|
-
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth +
|
|
2498
|
+
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth + 2, options, p, p + elNum));
|
|
2419
2499
|
p += elNum;
|
|
2420
2500
|
}
|
|
2421
2501
|
out.f11SubMsgArr = elems;
|
|
@@ -2462,7 +2542,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2462
2542
|
}
|
|
2463
2543
|
if (p + elNum > arrEnd)
|
|
2464
2544
|
throw new Error('omnibuf: corrupt submsg array');
|
|
2465
|
-
elems.push(decodeAllTypesSubMsg(buf, undefined, depth +
|
|
2545
|
+
elems.push(decodeAllTypesSubMsg(buf, undefined, depth + 2, options, p, p + elNum));
|
|
2466
2546
|
p += elNum;
|
|
2467
2547
|
}
|
|
2468
2548
|
if (p !== arrEnd)
|
|
@@ -2480,7 +2560,7 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2480
2560
|
const [el, en] = decodeVarintBigInt(arrPayload, p);
|
|
2481
2561
|
p += en;
|
|
2482
2562
|
const elNum = Number(el);
|
|
2483
|
-
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth +
|
|
2563
|
+
elems.push(decodeAllTypesSubMsg(arrPayload, undefined, depth + 2, options, p, p + elNum));
|
|
2484
2564
|
p += elNum;
|
|
2485
2565
|
}
|
|
2486
2566
|
out.f11SubMsgArr = elems;
|
|
@@ -2503,10 +2583,14 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
|
|
|
2503
2583
|
break;
|
|
2504
2584
|
}
|
|
2505
2585
|
seenMask |= bit;
|
|
2586
|
+
if (depth + 1 > maxDepth)
|
|
2587
|
+
throw new Error(`omnibuf: nesting depth ${depth + 1} exceeds MaxNestingDepth (${maxDepth})`);
|
|
2506
2588
|
const [body, nextPos] = readLenSlice(buf, pos, 3, n);
|
|
2507
2589
|
const keyWT = body[0];
|
|
2508
2590
|
const valWT = body[1];
|
|
2509
2591
|
validateMapTypes(keyWT, valWT);
|
|
2592
|
+
if (keyWT !== 10 || valWT !== 0)
|
|
2593
|
+
throw new Error('omnibuf: WireMap header mismatch');
|
|
2510
2594
|
const [count, cn] = decodeVarintBigInt(body, 2);
|
|
2511
2595
|
if (cn === 0 || count > BigInt(Math.floor((body.length - (2 + cn)) / 2)))
|
|
2512
2596
|
throw new Error('omnibuf: invalid map count');
|
|
@@ -3037,7 +3121,7 @@ export class OpaqueTestAllTypes {
|
|
|
3037
3121
|
}
|
|
3038
3122
|
case 3: {
|
|
3039
3123
|
const msg = { f3Sint32: this._f3Sint32 };
|
|
3040
|
-
enc.writeInt(3, msg.f3Sint32 ?? msg.f3_sint32 ?? 0);
|
|
3124
|
+
enc.writeInt(3, Number(msg.f3Sint32 ?? msg.f3_sint32 ?? 0) | 0);
|
|
3041
3125
|
break;
|
|
3042
3126
|
}
|
|
3043
3127
|
case 4: {
|
|
@@ -3089,7 +3173,8 @@ export class OpaqueTestAllTypes {
|
|
|
3089
3173
|
enc.beginSubMsgArr(11);
|
|
3090
3174
|
for (let i = 0; i < arr.length; i++) {
|
|
3091
3175
|
enc.beginSubMsgElem();
|
|
3092
|
-
|
|
3176
|
+
if (arr[i] !== null && arr[i] !== undefined)
|
|
3177
|
+
encodeAllTypesSubMsg(enc, arr[i], options);
|
|
3093
3178
|
enc.endSubMsgElem();
|
|
3094
3179
|
}
|
|
3095
3180
|
enc.endSubMsgArr();
|
|
@@ -3127,7 +3212,7 @@ export class OpaqueTestAllTypes {
|
|
|
3127
3212
|
}
|
|
3128
3213
|
case 15: {
|
|
3129
3214
|
const msg = { f15Fixed32: this._f15Fixed32 };
|
|
3130
|
-
enc.writeFixed32(15, msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0);
|
|
3215
|
+
enc.writeFixed32(15, Number(msg.f15Fixed32 ?? msg.f15_fixed32 ?? 0) >>> 0);
|
|
3131
3216
|
break;
|
|
3132
3217
|
}
|
|
3133
3218
|
case 16: {
|
|
@@ -3144,6 +3229,9 @@ export class OpaqueTestAllTypes {
|
|
|
3144
3229
|
});
|
|
3145
3230
|
this._dirtyMask = 0;
|
|
3146
3231
|
}
|
|
3232
|
+
else {
|
|
3233
|
+
validateMessage(this._raw);
|
|
3234
|
+
}
|
|
3147
3235
|
if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
|
|
3148
3236
|
const f0 = encodeField0SchemaMeta(TestAllTypesSchema.getSchemaMeta(0), Boolean(options.deterministic));
|
|
3149
3237
|
const out = new Uint8Array(f0.length + this._raw.length);
|