@omnibuf/node 0.0.6 → 0.0.8

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.
@@ -1,7 +1,1239 @@
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, decodeZigZag, decodeZigZagAuto, defineMessage, encodeField0SchemaMeta, float32FromBits, parseArrayHeader, readBool, readBytes, readFixed32, readFixed64Auto, readFloat32, readFloat64, readFloat64At, readInt, readIntAuto, readLenSlice, readString, readStringArr, readSubMsgArrDecoded, readSubMsgMerged, readTypedMap, readUint, readUint32Arr, readUintAuto, roundFloat32Shortest, spliceFields, validateMapTypes, validateValue, writeField0SchemaMeta, } from '@omnibuf/core';
4
+ import { Encoder, MaxNestingDepth, appendStringArrBody, appendUint32ArrBody, countSubMsgArrElems, decodeSchemaMeta, decodeUTF8, decodeVarintAuto, decodeVarintBigInt, decodeZigZag, 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, 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, msg.tier ?? 0);
104
+ enc.writeInt(4, msg.requestedOutputFormat ?? msg.requested_output_format ?? 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
+ Object.assign(out, new ConformanceRequestMsg());
138
+ delete out.$unknown;
139
+ }
140
+ }
141
+ const n = endPos;
142
+ let pos = startPos;
143
+ let seenMask = 0;
144
+ let unknownFields = Array.isArray(out.$unknown)
145
+ ? out.$unknown
146
+ : null;
147
+ while (pos < n) {
148
+ let tag = 0;
149
+ const b0 = buf[pos];
150
+ if ((b0 & 1) !== 0) {
151
+ tag = b0 >>> 1;
152
+ pos += 1;
153
+ }
154
+ else if ((b0 & 2) !== 0) {
155
+ if (pos + 2 > n)
156
+ throw new Error('omnibuf: truncated tag');
157
+ tag = ((b0 | (buf[pos + 1] << 8)) >>> 2) >>> 0;
158
+ pos += 2;
159
+ }
160
+ else {
161
+ const [t64, tn] = decodeVarintBigInt(buf, pos, n);
162
+ if (tn === 0 || t64 >> 4n > 536870911n)
163
+ throw new Error('omnibuf: invalid tag');
164
+ tag = Number(t64);
165
+ pos += tn;
166
+ }
167
+ const fieldNum = tag <= 0x7fffffff ? tag >>> 4 : Math.floor(tag / 16);
168
+ const wt = tag & 0x0f;
169
+ if (fieldNum === 0) {
170
+ if (wt !== 12)
171
+ throw new Error('omnibuf: invalid Field #0 wire type');
172
+ const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
173
+ decodeSchemaMeta(meta, depth + 1, maxDepth);
174
+ pos = nextPos;
175
+ continue;
176
+ }
177
+ const bit = fieldNum <= 30 ? 1 << fieldNum : 0;
178
+ const alreadySeen = (seenMask & bit) !== 0 || Boolean(options?.merge);
179
+ switch (fieldNum) {
180
+ case 1: {
181
+ if (!(wt === 10)) {
182
+ const valStart = pos;
183
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
184
+ if (readUnknown) {
185
+ if (!unknownFields)
186
+ unknownFields = [];
187
+ unknownFields.push({
188
+ no: fieldNum,
189
+ wireType: wt,
190
+ data: buf.subarray(valStart, pos).slice(),
191
+ });
192
+ }
193
+ break;
194
+ }
195
+ seenMask |= bit;
196
+ if (pos >= n)
197
+ throw new Error('omnibuf: truncated string');
198
+ const sb = buf[pos];
199
+ if ((sb & 1) !== 0) {
200
+ const sLen = sb >>> 1;
201
+ pos += 1;
202
+ if (pos + sLen > n)
203
+ throw new Error('omnibuf: truncated string');
204
+ out.testName = decodeUTF8(buf, pos, pos + sLen);
205
+ pos += sLen;
206
+ }
207
+ else {
208
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
209
+ out.testName = decodeUTF8(s);
210
+ pos = nextPos;
211
+ }
212
+ break;
213
+ }
214
+ case 2: {
215
+ if (!(wt === 10)) {
216
+ const valStart = pos;
217
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
218
+ if (readUnknown) {
219
+ if (!unknownFields)
220
+ unknownFields = [];
221
+ unknownFields.push({
222
+ no: fieldNum,
223
+ wireType: wt,
224
+ data: buf.subarray(valStart, pos).slice(),
225
+ });
226
+ }
227
+ break;
228
+ }
229
+ seenMask |= bit;
230
+ if (pos >= n)
231
+ throw new Error('omnibuf: truncated string');
232
+ const sb = buf[pos];
233
+ if ((sb & 1) !== 0) {
234
+ const sLen = sb >>> 1;
235
+ pos += 1;
236
+ if (pos + sLen > n)
237
+ throw new Error('omnibuf: truncated string');
238
+ out.messageType = decodeUTF8(buf, pos, pos + sLen);
239
+ pos += sLen;
240
+ }
241
+ else {
242
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
243
+ out.messageType = decodeUTF8(s);
244
+ pos = nextPos;
245
+ }
246
+ break;
247
+ }
248
+ case 3: {
249
+ if (!(wt === 1)) {
250
+ const valStart = pos;
251
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
252
+ if (readUnknown) {
253
+ if (!unknownFields)
254
+ unknownFields = [];
255
+ unknownFields.push({
256
+ no: fieldNum,
257
+ wireType: wt,
258
+ data: buf.subarray(valStart, pos).slice(),
259
+ });
260
+ }
261
+ break;
262
+ }
263
+ seenMask |= bit;
264
+ if (pos >= n)
265
+ throw new Error('omnibuf: truncated int32/enum');
266
+ const vb = buf[pos];
267
+ let i32Val = 0;
268
+ if ((vb & 1) !== 0) {
269
+ const u = vb >>> 1;
270
+ i32Val = (u >>> 1) ^ -(u & 1);
271
+ pos += 1;
272
+ }
273
+ else if ((vb & 2) !== 0) {
274
+ if (pos + 2 > n)
275
+ throw new Error('omnibuf: truncated int32/enum');
276
+ const u = (vb | (buf[pos + 1] << 8)) >>> 2;
277
+ i32Val = (u >>> 1) ^ -(u & 1);
278
+ pos += 2;
279
+ }
280
+ else if ((vb & 4) !== 0) {
281
+ if (pos + 4 > n)
282
+ throw new Error('omnibuf: truncated int32/enum');
283
+ const u = ((vb | (buf[pos + 1] << 8) | (buf[pos + 2] << 16) | (buf[pos + 3] << 24)) >>> 3) >>>
284
+ 0;
285
+ i32Val = (u >>> 1) ^ -(u & 1);
286
+ pos += 4;
287
+ }
288
+ else {
289
+ const [v, vn] = decodeVarintBigInt(buf, pos, n);
290
+ if (vn === 0)
291
+ throw new Error('omnibuf: truncated int32/enum');
292
+ i32Val = decodeZigZag(v) | 0;
293
+ pos += vn;
294
+ }
295
+ out.tier = i32Val;
296
+ break;
297
+ }
298
+ case 4: {
299
+ if (!(wt === 1)) {
300
+ const valStart = pos;
301
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
302
+ if (readUnknown) {
303
+ if (!unknownFields)
304
+ unknownFields = [];
305
+ unknownFields.push({
306
+ no: fieldNum,
307
+ wireType: wt,
308
+ data: buf.subarray(valStart, pos).slice(),
309
+ });
310
+ }
311
+ break;
312
+ }
313
+ seenMask |= bit;
314
+ if (pos >= n)
315
+ throw new Error('omnibuf: truncated int32/enum');
316
+ const vb = buf[pos];
317
+ let i32Val = 0;
318
+ if ((vb & 1) !== 0) {
319
+ const u = vb >>> 1;
320
+ i32Val = (u >>> 1) ^ -(u & 1);
321
+ pos += 1;
322
+ }
323
+ else if ((vb & 2) !== 0) {
324
+ if (pos + 2 > n)
325
+ throw new Error('omnibuf: truncated int32/enum');
326
+ const u = (vb | (buf[pos + 1] << 8)) >>> 2;
327
+ i32Val = (u >>> 1) ^ -(u & 1);
328
+ pos += 2;
329
+ }
330
+ else if ((vb & 4) !== 0) {
331
+ if (pos + 4 > n)
332
+ throw new Error('omnibuf: truncated int32/enum');
333
+ const u = ((vb | (buf[pos + 1] << 8) | (buf[pos + 2] << 16) | (buf[pos + 3] << 24)) >>> 3) >>>
334
+ 0;
335
+ i32Val = (u >>> 1) ^ -(u & 1);
336
+ pos += 4;
337
+ }
338
+ else {
339
+ const [v, vn] = decodeVarintBigInt(buf, pos, n);
340
+ if (vn === 0)
341
+ throw new Error('omnibuf: truncated int32/enum');
342
+ i32Val = decodeZigZag(v) | 0;
343
+ pos += vn;
344
+ }
345
+ out.requestedOutputFormat = i32Val;
346
+ break;
347
+ }
348
+ case 5: {
349
+ if (!(wt === 11)) {
350
+ const valStart = pos;
351
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
352
+ if (readUnknown) {
353
+ if (!unknownFields)
354
+ unknownFields = [];
355
+ unknownFields.push({
356
+ no: fieldNum,
357
+ wireType: wt,
358
+ data: buf.subarray(valStart, pos).slice(),
359
+ });
360
+ }
361
+ break;
362
+ }
363
+ seenMask |= bit;
364
+ const [b, nextPos] = readLenSlice(buf, pos, 0, n);
365
+ out.omnibufPayload = b.slice();
366
+ pos = nextPos;
367
+ break;
368
+ }
369
+ case 6: {
370
+ if (!(wt === 10)) {
371
+ const valStart = pos;
372
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
373
+ if (readUnknown) {
374
+ if (!unknownFields)
375
+ unknownFields = [];
376
+ unknownFields.push({
377
+ no: fieldNum,
378
+ wireType: wt,
379
+ data: buf.subarray(valStart, pos).slice(),
380
+ });
381
+ }
382
+ break;
383
+ }
384
+ seenMask |= bit;
385
+ if (pos >= n)
386
+ throw new Error('omnibuf: truncated string');
387
+ const sb = buf[pos];
388
+ if ((sb & 1) !== 0) {
389
+ const sLen = sb >>> 1;
390
+ pos += 1;
391
+ if (pos + sLen > n)
392
+ throw new Error('omnibuf: truncated string');
393
+ out.jsonPayload = decodeUTF8(buf, pos, pos + sLen);
394
+ pos += sLen;
395
+ }
396
+ else {
397
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
398
+ out.jsonPayload = decodeUTF8(s);
399
+ pos = nextPos;
400
+ }
401
+ break;
402
+ }
403
+ case 7: {
404
+ if (!(wt === 2 || wt === 3)) {
405
+ const valStart = pos;
406
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
407
+ if (readUnknown) {
408
+ if (!unknownFields)
409
+ unknownFields = [];
410
+ unknownFields.push({
411
+ no: fieldNum,
412
+ wireType: wt,
413
+ data: buf.subarray(valStart, pos).slice(),
414
+ });
415
+ }
416
+ break;
417
+ }
418
+ seenMask |= bit;
419
+ out.selfDescribing = wt === 3;
420
+ break;
421
+ }
422
+ case 8: {
423
+ if (!(wt === 2 || wt === 3)) {
424
+ const valStart = pos;
425
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
426
+ if (readUnknown) {
427
+ if (!unknownFields)
428
+ unknownFields = [];
429
+ unknownFields.push({
430
+ no: fieldNum,
431
+ wireType: wt,
432
+ data: buf.subarray(valStart, pos).slice(),
433
+ });
434
+ }
435
+ break;
436
+ }
437
+ seenMask |= bit;
438
+ out.testOpaqueSplice = wt === 3;
439
+ break;
440
+ }
441
+ case 9: {
442
+ if (!(wt === 2 || wt === 3)) {
443
+ const valStart = pos;
444
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
445
+ if (readUnknown) {
446
+ if (!unknownFields)
447
+ unknownFields = [];
448
+ unknownFields.push({
449
+ no: fieldNum,
450
+ wireType: wt,
451
+ data: buf.subarray(valStart, pos).slice(),
452
+ });
453
+ }
454
+ break;
455
+ }
456
+ seenMask |= bit;
457
+ out.testOpaqueSpliceShrink = wt === 3;
458
+ break;
459
+ }
460
+ default: {
461
+ const valStart = pos;
462
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
463
+ if (readUnknown) {
464
+ if (!unknownFields)
465
+ unknownFields = [];
466
+ unknownFields.push({
467
+ no: fieldNum,
468
+ wireType: wt,
469
+ data: buf.subarray(valStart, pos).slice(),
470
+ });
471
+ }
472
+ break;
473
+ }
474
+ }
475
+ }
476
+ if (unknownFields && unknownFields.length > 0 && !('$unknown' in out)) {
477
+ Object.defineProperty(out, '$unknown', {
478
+ value: unknownFields,
479
+ enumerable: false,
480
+ writable: true,
481
+ configurable: true,
482
+ });
483
+ }
484
+ return out;
485
+ }
486
+ export function unmarshalConformanceRequestOmniBuf(buf, options) {
487
+ return decodeConformanceRequest(buf, undefined, 0, options);
488
+ }
489
+ ConformanceRequestSchema.setGeneratedCodec({
490
+ create: () => new ConformanceRequestMsg(),
491
+ encode: encodeConformanceRequest,
492
+ decode: decodeConformanceRequest,
493
+ });
494
+ export class OpaqueConformanceRequest {
495
+ _raw;
496
+ _dirtyMask = 0;
497
+ _testName;
498
+ _messageType;
499
+ _tier;
500
+ _requestedOutputFormat;
501
+ _omnibufPayload;
502
+ _jsonPayload;
503
+ _selfDescribing;
504
+ _testOpaqueSplice;
505
+ _testOpaqueSpliceShrink;
506
+ constructor(raw) {
507
+ this._raw = raw;
508
+ }
509
+ raw() {
510
+ return this._raw;
511
+ }
512
+ getTestName() {
513
+ if ((this._dirtyMask & (1 << 1)) !== 0) {
514
+ return this._testName;
515
+ }
516
+ return readString(this._raw, 1)[0];
517
+ }
518
+ testName() {
519
+ return this.getTestName();
520
+ }
521
+ test_name() {
522
+ return this.getTestName();
523
+ }
524
+ setTestName(val) {
525
+ this._testName = val;
526
+ this._dirtyMask |= 1 << 1;
527
+ }
528
+ getMessageType() {
529
+ if ((this._dirtyMask & (1 << 2)) !== 0) {
530
+ return this._messageType;
531
+ }
532
+ return readString(this._raw, 2)[0];
533
+ }
534
+ messageType() {
535
+ return this.getMessageType();
536
+ }
537
+ message_type() {
538
+ return this.getMessageType();
539
+ }
540
+ setMessageType(val) {
541
+ this._messageType = val;
542
+ this._dirtyMask |= 1 << 2;
543
+ }
544
+ getTier() {
545
+ if ((this._dirtyMask & (1 << 3)) !== 0) {
546
+ return this._tier;
547
+ }
548
+ return readEnum(this._raw, 3)[0];
549
+ }
550
+ tier() {
551
+ return this.getTier();
552
+ }
553
+ setTier(val) {
554
+ this._tier = val;
555
+ this._dirtyMask |= 1 << 3;
556
+ }
557
+ getRequestedOutputFormat() {
558
+ if ((this._dirtyMask & (1 << 4)) !== 0) {
559
+ return this._requestedOutputFormat;
560
+ }
561
+ return readEnum(this._raw, 4)[0];
562
+ }
563
+ requestedOutputFormat() {
564
+ return this.getRequestedOutputFormat();
565
+ }
566
+ requested_output_format() {
567
+ return this.getRequestedOutputFormat();
568
+ }
569
+ setRequestedOutputFormat(val) {
570
+ this._requestedOutputFormat = val;
571
+ this._dirtyMask |= 1 << 4;
572
+ }
573
+ getOmnibufPayload() {
574
+ if ((this._dirtyMask & (1 << 5)) !== 0) {
575
+ return this._omnibufPayload;
576
+ }
577
+ return readBytes(this._raw, 5)[0];
578
+ }
579
+ omnibufPayload() {
580
+ return this.getOmnibufPayload();
581
+ }
582
+ omnibuf_payload() {
583
+ return this.getOmnibufPayload();
584
+ }
585
+ setOmnibufPayload(val) {
586
+ this._omnibufPayload = val;
587
+ this._dirtyMask |= 1 << 5;
588
+ }
589
+ getJsonPayload() {
590
+ if ((this._dirtyMask & (1 << 6)) !== 0) {
591
+ return this._jsonPayload;
592
+ }
593
+ return readString(this._raw, 6)[0];
594
+ }
595
+ jsonPayload() {
596
+ return this.getJsonPayload();
597
+ }
598
+ json_payload() {
599
+ return this.getJsonPayload();
600
+ }
601
+ setJsonPayload(val) {
602
+ this._jsonPayload = val;
603
+ this._dirtyMask |= 1 << 6;
604
+ }
605
+ getSelfDescribing() {
606
+ if ((this._dirtyMask & (1 << 7)) !== 0) {
607
+ return this._selfDescribing;
608
+ }
609
+ return readBool(this._raw, 7)[0];
610
+ }
611
+ selfDescribing() {
612
+ return this.getSelfDescribing();
613
+ }
614
+ self_describing() {
615
+ return this.getSelfDescribing();
616
+ }
617
+ setSelfDescribing(val) {
618
+ this._selfDescribing = val;
619
+ this._dirtyMask |= 1 << 7;
620
+ }
621
+ getTestOpaqueSplice() {
622
+ if ((this._dirtyMask & (1 << 8)) !== 0) {
623
+ return this._testOpaqueSplice;
624
+ }
625
+ return readBool(this._raw, 8)[0];
626
+ }
627
+ testOpaqueSplice() {
628
+ return this.getTestOpaqueSplice();
629
+ }
630
+ test_opaque_splice() {
631
+ return this.getTestOpaqueSplice();
632
+ }
633
+ setTestOpaqueSplice(val) {
634
+ this._testOpaqueSplice = val;
635
+ this._dirtyMask |= 1 << 8;
636
+ }
637
+ getTestOpaqueSpliceShrink() {
638
+ if ((this._dirtyMask & (1 << 9)) !== 0) {
639
+ return this._testOpaqueSpliceShrink;
640
+ }
641
+ return readBool(this._raw, 9)[0];
642
+ }
643
+ testOpaqueSpliceShrink() {
644
+ return this.getTestOpaqueSpliceShrink();
645
+ }
646
+ test_opaque_splice_shrink() {
647
+ return this.getTestOpaqueSpliceShrink();
648
+ }
649
+ setTestOpaqueSpliceShrink(val) {
650
+ this._testOpaqueSpliceShrink = val;
651
+ this._dirtyMask |= 1 << 9;
652
+ }
653
+ marshal(options) {
654
+ if (this._dirtyMask !== 0) {
655
+ this._raw = spliceFields(this._raw, this._dirtyMask, 9, (enc, fnum) => {
656
+ switch (fnum) {
657
+ case 1: {
658
+ const msg = { testName: this._testName };
659
+ enc.writeString(1, msg.testName ?? msg.test_name ?? '');
660
+ break;
661
+ }
662
+ case 2: {
663
+ const msg = { messageType: this._messageType };
664
+ enc.writeString(2, msg.messageType ?? msg.message_type ?? '');
665
+ break;
666
+ }
667
+ case 3: {
668
+ const msg = { tier: this._tier };
669
+ enc.writeInt(3, msg.tier ?? 0);
670
+ break;
671
+ }
672
+ case 4: {
673
+ const msg = {
674
+ requestedOutputFormat: this._requestedOutputFormat,
675
+ };
676
+ enc.writeInt(4, msg.requestedOutputFormat ?? msg.requested_output_format ?? 0);
677
+ break;
678
+ }
679
+ case 5: {
680
+ const msg = { omnibufPayload: this._omnibufPayload };
681
+ enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
682
+ break;
683
+ }
684
+ case 6: {
685
+ const msg = { jsonPayload: this._jsonPayload };
686
+ enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
687
+ break;
688
+ }
689
+ case 7: {
690
+ const msg = { selfDescribing: this._selfDescribing };
691
+ enc.writeBool(7, Boolean(msg.selfDescribing ?? msg.self_describing));
692
+ break;
693
+ }
694
+ case 8: {
695
+ const msg = {
696
+ testOpaqueSplice: this._testOpaqueSplice,
697
+ };
698
+ enc.writeBool(8, Boolean(msg.testOpaqueSplice ?? msg.test_opaque_splice));
699
+ break;
700
+ }
701
+ case 9: {
702
+ const msg = {
703
+ testOpaqueSpliceShrink: this._testOpaqueSpliceShrink,
704
+ };
705
+ enc.writeBool(9, Boolean(msg.testOpaqueSpliceShrink ?? msg.test_opaque_splice_shrink));
706
+ break;
707
+ }
708
+ }
709
+ });
710
+ this._dirtyMask = 0;
711
+ }
712
+ if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
713
+ const f0 = encodeField0SchemaMeta(ConformanceRequestSchema.getSchemaMeta(0), Boolean(options.deterministic));
714
+ const out = new Uint8Array(f0.length + this._raw.length);
715
+ out.set(f0, 0);
716
+ out.set(this._raw, f0.length);
717
+ return out;
718
+ }
719
+ return this._raw;
720
+ }
721
+ }
722
+ export const ConformanceResponseSchema = defineMessage('omnibuf.conformance.ConformanceResponse', {
723
+ parseError: { fieldNum: 1, name: 'parse_error', type: 'string' },
724
+ serializeError: { fieldNum: 2, name: 'serialize_error', type: 'string' },
725
+ runtimeError: { fieldNum: 3, name: 'runtime_error', type: 'string' },
726
+ skipped: { fieldNum: 4, type: 'string' },
727
+ omnibufPayload: { fieldNum: 5, name: 'omnibuf_payload', type: 'bytes' },
728
+ jsonPayload: { fieldNum: 6, name: 'json_payload', type: 'string' },
729
+ });
730
+ class ConformanceResponseMsg {
731
+ parseError = '';
732
+ get parse_error() {
733
+ return this.parseError;
734
+ }
735
+ set parse_error(v) {
736
+ this.parseError = v;
737
+ }
738
+ serializeError = '';
739
+ get serialize_error() {
740
+ return this.serializeError;
741
+ }
742
+ set serialize_error(v) {
743
+ this.serializeError = v;
744
+ }
745
+ runtimeError = '';
746
+ get runtime_error() {
747
+ return this.runtimeError;
748
+ }
749
+ set runtime_error(v) {
750
+ this.runtimeError = v;
751
+ }
752
+ skipped = '';
753
+ omnibufPayload = new Uint8Array(0);
754
+ get omnibuf_payload() {
755
+ return this.omnibufPayload;
756
+ }
757
+ set omnibuf_payload(v) {
758
+ this.omnibufPayload = v;
759
+ }
760
+ jsonPayload = '';
761
+ get json_payload() {
762
+ return this.jsonPayload;
763
+ }
764
+ set json_payload(v) {
765
+ this.jsonPayload = v;
766
+ }
767
+ }
768
+ Object.defineProperty(ConformanceResponseMsg.prototype, '$typeName', {
769
+ value: 'omnibuf.conformance.ConformanceResponse',
770
+ enumerable: false,
771
+ writable: true,
772
+ configurable: true,
773
+ });
774
+ export function createConformanceResponse(init) {
775
+ if (init === undefined)
776
+ return new ConformanceResponseMsg();
777
+ return ConformanceResponseSchema.create(init);
778
+ }
779
+ export function encodeConformanceResponse(enc, msg, options) {
780
+ enc.writeString(1, msg.parseError ?? msg.parse_error ?? '');
781
+ enc.writeString(2, msg.serializeError ?? msg.serialize_error ?? '');
782
+ enc.writeString(3, msg.runtimeError ?? msg.runtime_error ?? '');
783
+ enc.writeString(4, msg.skipped ?? '');
784
+ enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
785
+ enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
786
+ if (options?.writeUnknownFields && Array.isArray(msg.$unknown)) {
787
+ for (const uf of msg.$unknown) {
788
+ enc.writeTag(uf.no, uf.wireType);
789
+ enc.writeRaw(uf.data);
790
+ }
791
+ }
792
+ }
793
+ export function marshalConformanceResponseOmniBuf(msg, options) {
794
+ const enc = new Encoder(256);
795
+ if (options?.selfDescribing) {
796
+ writeField0SchemaMeta(enc, ConformanceResponseSchema.getSchemaMeta(0, msg), Boolean(options.deterministic));
797
+ }
798
+ encodeConformanceResponse(enc, msg, options);
799
+ return enc.finish();
800
+ }
801
+ export function decodeConformanceResponse(buf, target, depth = 0, options, startPos = 0, endPos = buf.length) {
802
+ const maxDepth = options?.recursionLimit ?? MaxNestingDepth;
803
+ const readUnknown = options?.readUnknownFields ?? true;
804
+ if (depth > maxDepth) {
805
+ throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
806
+ }
807
+ const out = target ?? new ConformanceResponseMsg();
808
+ if (target !== undefined) {
809
+ if (!(out instanceof ConformanceResponseMsg)) {
810
+ Object.setPrototypeOf(out, ConformanceResponseMsg.prototype);
811
+ }
812
+ if (!options?.merge) {
813
+ Object.assign(out, new ConformanceResponseMsg());
814
+ delete out.$unknown;
815
+ }
816
+ }
817
+ const n = endPos;
818
+ let pos = startPos;
819
+ let seenMask = 0;
820
+ let unknownFields = Array.isArray(out.$unknown)
821
+ ? out.$unknown
822
+ : null;
823
+ while (pos < n) {
824
+ let tag = 0;
825
+ const b0 = buf[pos];
826
+ if ((b0 & 1) !== 0) {
827
+ tag = b0 >>> 1;
828
+ pos += 1;
829
+ }
830
+ else if ((b0 & 2) !== 0) {
831
+ if (pos + 2 > n)
832
+ throw new Error('omnibuf: truncated tag');
833
+ tag = ((b0 | (buf[pos + 1] << 8)) >>> 2) >>> 0;
834
+ pos += 2;
835
+ }
836
+ else {
837
+ const [t64, tn] = decodeVarintBigInt(buf, pos, n);
838
+ if (tn === 0 || t64 >> 4n > 536870911n)
839
+ throw new Error('omnibuf: invalid tag');
840
+ tag = Number(t64);
841
+ pos += tn;
842
+ }
843
+ const fieldNum = tag <= 0x7fffffff ? tag >>> 4 : Math.floor(tag / 16);
844
+ const wt = tag & 0x0f;
845
+ if (fieldNum === 0) {
846
+ if (wt !== 12)
847
+ throw new Error('omnibuf: invalid Field #0 wire type');
848
+ const [meta, nextPos] = readLenSlice(buf, pos, 0, n);
849
+ decodeSchemaMeta(meta, depth + 1, maxDepth);
850
+ pos = nextPos;
851
+ continue;
852
+ }
853
+ const bit = fieldNum <= 30 ? 1 << fieldNum : 0;
854
+ const alreadySeen = (seenMask & bit) !== 0 || Boolean(options?.merge);
855
+ switch (fieldNum) {
856
+ case 1: {
857
+ if (!(wt === 10)) {
858
+ const valStart = pos;
859
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
860
+ if (readUnknown) {
861
+ if (!unknownFields)
862
+ unknownFields = [];
863
+ unknownFields.push({
864
+ no: fieldNum,
865
+ wireType: wt,
866
+ data: buf.subarray(valStart, pos).slice(),
867
+ });
868
+ }
869
+ break;
870
+ }
871
+ seenMask |= bit;
872
+ if (pos >= n)
873
+ throw new Error('omnibuf: truncated string');
874
+ const sb = buf[pos];
875
+ if ((sb & 1) !== 0) {
876
+ const sLen = sb >>> 1;
877
+ pos += 1;
878
+ if (pos + sLen > n)
879
+ throw new Error('omnibuf: truncated string');
880
+ out.parseError = decodeUTF8(buf, pos, pos + sLen);
881
+ pos += sLen;
882
+ }
883
+ else {
884
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
885
+ out.parseError = decodeUTF8(s);
886
+ pos = nextPos;
887
+ }
888
+ break;
889
+ }
890
+ case 2: {
891
+ if (!(wt === 10)) {
892
+ const valStart = pos;
893
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
894
+ if (readUnknown) {
895
+ if (!unknownFields)
896
+ unknownFields = [];
897
+ unknownFields.push({
898
+ no: fieldNum,
899
+ wireType: wt,
900
+ data: buf.subarray(valStart, pos).slice(),
901
+ });
902
+ }
903
+ break;
904
+ }
905
+ seenMask |= bit;
906
+ if (pos >= n)
907
+ throw new Error('omnibuf: truncated string');
908
+ const sb = buf[pos];
909
+ if ((sb & 1) !== 0) {
910
+ const sLen = sb >>> 1;
911
+ pos += 1;
912
+ if (pos + sLen > n)
913
+ throw new Error('omnibuf: truncated string');
914
+ out.serializeError = decodeUTF8(buf, pos, pos + sLen);
915
+ pos += sLen;
916
+ }
917
+ else {
918
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
919
+ out.serializeError = decodeUTF8(s);
920
+ pos = nextPos;
921
+ }
922
+ break;
923
+ }
924
+ case 3: {
925
+ if (!(wt === 10)) {
926
+ const valStart = pos;
927
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
928
+ if (readUnknown) {
929
+ if (!unknownFields)
930
+ unknownFields = [];
931
+ unknownFields.push({
932
+ no: fieldNum,
933
+ wireType: wt,
934
+ data: buf.subarray(valStart, pos).slice(),
935
+ });
936
+ }
937
+ break;
938
+ }
939
+ seenMask |= bit;
940
+ if (pos >= n)
941
+ throw new Error('omnibuf: truncated string');
942
+ const sb = buf[pos];
943
+ if ((sb & 1) !== 0) {
944
+ const sLen = sb >>> 1;
945
+ pos += 1;
946
+ if (pos + sLen > n)
947
+ throw new Error('omnibuf: truncated string');
948
+ out.runtimeError = decodeUTF8(buf, pos, pos + sLen);
949
+ pos += sLen;
950
+ }
951
+ else {
952
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
953
+ out.runtimeError = decodeUTF8(s);
954
+ pos = nextPos;
955
+ }
956
+ break;
957
+ }
958
+ case 4: {
959
+ if (!(wt === 10)) {
960
+ const valStart = pos;
961
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
962
+ if (readUnknown) {
963
+ if (!unknownFields)
964
+ unknownFields = [];
965
+ unknownFields.push({
966
+ no: fieldNum,
967
+ wireType: wt,
968
+ data: buf.subarray(valStart, pos).slice(),
969
+ });
970
+ }
971
+ break;
972
+ }
973
+ seenMask |= bit;
974
+ if (pos >= n)
975
+ throw new Error('omnibuf: truncated string');
976
+ const sb = buf[pos];
977
+ if ((sb & 1) !== 0) {
978
+ const sLen = sb >>> 1;
979
+ pos += 1;
980
+ if (pos + sLen > n)
981
+ throw new Error('omnibuf: truncated string');
982
+ out.skipped = decodeUTF8(buf, pos, pos + sLen);
983
+ pos += sLen;
984
+ }
985
+ else {
986
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
987
+ out.skipped = decodeUTF8(s);
988
+ pos = nextPos;
989
+ }
990
+ break;
991
+ }
992
+ case 5: {
993
+ if (!(wt === 11)) {
994
+ const valStart = pos;
995
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
996
+ if (readUnknown) {
997
+ if (!unknownFields)
998
+ unknownFields = [];
999
+ unknownFields.push({
1000
+ no: fieldNum,
1001
+ wireType: wt,
1002
+ data: buf.subarray(valStart, pos).slice(),
1003
+ });
1004
+ }
1005
+ break;
1006
+ }
1007
+ seenMask |= bit;
1008
+ const [b, nextPos] = readLenSlice(buf, pos, 0, n);
1009
+ out.omnibufPayload = b.slice();
1010
+ pos = nextPos;
1011
+ break;
1012
+ }
1013
+ case 6: {
1014
+ if (!(wt === 10)) {
1015
+ const valStart = pos;
1016
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
1017
+ if (readUnknown) {
1018
+ if (!unknownFields)
1019
+ unknownFields = [];
1020
+ unknownFields.push({
1021
+ no: fieldNum,
1022
+ wireType: wt,
1023
+ data: buf.subarray(valStart, pos).slice(),
1024
+ });
1025
+ }
1026
+ break;
1027
+ }
1028
+ seenMask |= bit;
1029
+ if (pos >= n)
1030
+ throw new Error('omnibuf: truncated string');
1031
+ const sb = buf[pos];
1032
+ if ((sb & 1) !== 0) {
1033
+ const sLen = sb >>> 1;
1034
+ pos += 1;
1035
+ if (pos + sLen > n)
1036
+ throw new Error('omnibuf: truncated string');
1037
+ out.jsonPayload = decodeUTF8(buf, pos, pos + sLen);
1038
+ pos += sLen;
1039
+ }
1040
+ else {
1041
+ const [s, nextPos] = readLenSlice(buf, pos, 0, n);
1042
+ out.jsonPayload = decodeUTF8(s);
1043
+ pos = nextPos;
1044
+ }
1045
+ break;
1046
+ }
1047
+ default: {
1048
+ const valStart = pos;
1049
+ pos = validateValue(n < buf.length ? buf.subarray(0, n) : buf, pos, wt, depth, maxDepth);
1050
+ if (readUnknown) {
1051
+ if (!unknownFields)
1052
+ unknownFields = [];
1053
+ unknownFields.push({
1054
+ no: fieldNum,
1055
+ wireType: wt,
1056
+ data: buf.subarray(valStart, pos).slice(),
1057
+ });
1058
+ }
1059
+ break;
1060
+ }
1061
+ }
1062
+ }
1063
+ if (unknownFields && unknownFields.length > 0 && !('$unknown' in out)) {
1064
+ Object.defineProperty(out, '$unknown', {
1065
+ value: unknownFields,
1066
+ enumerable: false,
1067
+ writable: true,
1068
+ configurable: true,
1069
+ });
1070
+ }
1071
+ return out;
1072
+ }
1073
+ export function unmarshalConformanceResponseOmniBuf(buf, options) {
1074
+ return decodeConformanceResponse(buf, undefined, 0, options);
1075
+ }
1076
+ ConformanceResponseSchema.setGeneratedCodec({
1077
+ create: () => new ConformanceResponseMsg(),
1078
+ encode: encodeConformanceResponse,
1079
+ decode: decodeConformanceResponse,
1080
+ });
1081
+ export class OpaqueConformanceResponse {
1082
+ _raw;
1083
+ _dirtyMask = 0;
1084
+ _parseError;
1085
+ _serializeError;
1086
+ _runtimeError;
1087
+ _skipped;
1088
+ _omnibufPayload;
1089
+ _jsonPayload;
1090
+ constructor(raw) {
1091
+ this._raw = raw;
1092
+ }
1093
+ raw() {
1094
+ return this._raw;
1095
+ }
1096
+ getParseError() {
1097
+ if ((this._dirtyMask & (1 << 1)) !== 0) {
1098
+ return this._parseError;
1099
+ }
1100
+ return readString(this._raw, 1)[0];
1101
+ }
1102
+ parseError() {
1103
+ return this.getParseError();
1104
+ }
1105
+ parse_error() {
1106
+ return this.getParseError();
1107
+ }
1108
+ setParseError(val) {
1109
+ this._parseError = val;
1110
+ this._dirtyMask |= 1 << 1;
1111
+ }
1112
+ getSerializeError() {
1113
+ if ((this._dirtyMask & (1 << 2)) !== 0) {
1114
+ return this._serializeError;
1115
+ }
1116
+ return readString(this._raw, 2)[0];
1117
+ }
1118
+ serializeError() {
1119
+ return this.getSerializeError();
1120
+ }
1121
+ serialize_error() {
1122
+ return this.getSerializeError();
1123
+ }
1124
+ setSerializeError(val) {
1125
+ this._serializeError = val;
1126
+ this._dirtyMask |= 1 << 2;
1127
+ }
1128
+ getRuntimeError() {
1129
+ if ((this._dirtyMask & (1 << 3)) !== 0) {
1130
+ return this._runtimeError;
1131
+ }
1132
+ return readString(this._raw, 3)[0];
1133
+ }
1134
+ runtimeError() {
1135
+ return this.getRuntimeError();
1136
+ }
1137
+ runtime_error() {
1138
+ return this.getRuntimeError();
1139
+ }
1140
+ setRuntimeError(val) {
1141
+ this._runtimeError = val;
1142
+ this._dirtyMask |= 1 << 3;
1143
+ }
1144
+ getSkipped() {
1145
+ if ((this._dirtyMask & (1 << 4)) !== 0) {
1146
+ return this._skipped;
1147
+ }
1148
+ return readString(this._raw, 4)[0];
1149
+ }
1150
+ skipped() {
1151
+ return this.getSkipped();
1152
+ }
1153
+ setSkipped(val) {
1154
+ this._skipped = val;
1155
+ this._dirtyMask |= 1 << 4;
1156
+ }
1157
+ getOmnibufPayload() {
1158
+ if ((this._dirtyMask & (1 << 5)) !== 0) {
1159
+ return this._omnibufPayload;
1160
+ }
1161
+ return readBytes(this._raw, 5)[0];
1162
+ }
1163
+ omnibufPayload() {
1164
+ return this.getOmnibufPayload();
1165
+ }
1166
+ omnibuf_payload() {
1167
+ return this.getOmnibufPayload();
1168
+ }
1169
+ setOmnibufPayload(val) {
1170
+ this._omnibufPayload = val;
1171
+ this._dirtyMask |= 1 << 5;
1172
+ }
1173
+ getJsonPayload() {
1174
+ if ((this._dirtyMask & (1 << 6)) !== 0) {
1175
+ return this._jsonPayload;
1176
+ }
1177
+ return readString(this._raw, 6)[0];
1178
+ }
1179
+ jsonPayload() {
1180
+ return this.getJsonPayload();
1181
+ }
1182
+ json_payload() {
1183
+ return this.getJsonPayload();
1184
+ }
1185
+ setJsonPayload(val) {
1186
+ this._jsonPayload = val;
1187
+ this._dirtyMask |= 1 << 6;
1188
+ }
1189
+ marshal(options) {
1190
+ if (this._dirtyMask !== 0) {
1191
+ this._raw = spliceFields(this._raw, this._dirtyMask, 6, (enc, fnum) => {
1192
+ switch (fnum) {
1193
+ case 1: {
1194
+ const msg = { parseError: this._parseError };
1195
+ enc.writeString(1, msg.parseError ?? msg.parse_error ?? '');
1196
+ break;
1197
+ }
1198
+ case 2: {
1199
+ const msg = { serializeError: this._serializeError };
1200
+ enc.writeString(2, msg.serializeError ?? msg.serialize_error ?? '');
1201
+ break;
1202
+ }
1203
+ case 3: {
1204
+ const msg = { runtimeError: this._runtimeError };
1205
+ enc.writeString(3, msg.runtimeError ?? msg.runtime_error ?? '');
1206
+ break;
1207
+ }
1208
+ case 4: {
1209
+ const msg = { skipped: this._skipped };
1210
+ enc.writeString(4, msg.skipped ?? '');
1211
+ break;
1212
+ }
1213
+ case 5: {
1214
+ const msg = { omnibufPayload: this._omnibufPayload };
1215
+ enc.writeBytes(5, msg.omnibufPayload ?? msg.omnibuf_payload ?? new Uint8Array(0));
1216
+ break;
1217
+ }
1218
+ case 6: {
1219
+ const msg = { jsonPayload: this._jsonPayload };
1220
+ enc.writeString(6, msg.jsonPayload ?? msg.json_payload ?? '');
1221
+ break;
1222
+ }
1223
+ }
1224
+ });
1225
+ this._dirtyMask = 0;
1226
+ }
1227
+ if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
1228
+ const f0 = encodeField0SchemaMeta(ConformanceResponseSchema.getSchemaMeta(0), Boolean(options.deterministic));
1229
+ const out = new Uint8Array(f0.length + this._raw.length);
1230
+ out.set(f0, 0);
1231
+ out.set(this._raw, f0.length);
1232
+ return out;
1233
+ }
1234
+ return this._raw;
1235
+ }
1236
+ }
5
1237
  export const AllTypesSubMsgSchema = defineMessage('omnibuf.conformance.AllTypesSubMsg', {
6
1238
  id: { fieldNum: 1, type: 'uint32' },
7
1239
  label: { fieldNum: 2, type: 'string' },
@@ -52,9 +1284,14 @@ export function decodeAllTypesSubMsg(buf, target, depth = 0, options, startPos =
52
1284
  throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
53
1285
  }
54
1286
  const out = target ?? new AllTypesSubMsgMsg();
55
- if (target !== undefined && !options?.merge) {
56
- Object.assign(out, new AllTypesSubMsgMsg());
57
- delete out.$unknown;
1287
+ if (target !== undefined) {
1288
+ if (!(out instanceof AllTypesSubMsgMsg)) {
1289
+ Object.setPrototypeOf(out, AllTypesSubMsgMsg.prototype);
1290
+ }
1291
+ if (!options?.merge) {
1292
+ Object.assign(out, new AllTypesSubMsgMsg());
1293
+ delete out.$unknown;
1294
+ }
58
1295
  }
59
1296
  const n = endPos;
60
1297
  let pos = startPos;
@@ -274,7 +1511,7 @@ export class OpaqueAllTypesSubMsg {
274
1511
  if ((this._dirtyMask & (1 << 1)) !== 0) {
275
1512
  return this._id;
276
1513
  }
277
- return readUint(this._raw, 1)[0];
1514
+ return readUint32(this._raw, 1)[0];
278
1515
  }
279
1516
  id() {
280
1517
  return this.getId();
@@ -350,7 +1587,7 @@ export class OpaqueAllTypesSubMsg {
350
1587
  });
351
1588
  this._dirtyMask = 0;
352
1589
  }
353
- if (options?.selfDescribing && (this._raw.length === 0 || this._raw[0] !== 0x19)) {
1590
+ if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
354
1591
  const f0 = encodeField0SchemaMeta(AllTypesSubMsgSchema.getSchemaMeta(0), Boolean(options.deterministic));
355
1592
  const out = new Uint8Array(f0.length + this._raw.length);
356
1593
  out.set(f0, 0);
@@ -597,9 +1834,14 @@ export function decodeTestAllTypes(buf, target, depth = 0, options, startPos = 0
597
1834
  throw new Error(`omnibuf: nesting depth ${depth} exceeds MaxNestingDepth (${maxDepth})`);
598
1835
  }
599
1836
  const out = target ?? new TestAllTypesMsg();
600
- if (target !== undefined && !options?.merge) {
601
- Object.assign(out, new TestAllTypesMsg());
602
- delete out.$unknown;
1837
+ if (target !== undefined) {
1838
+ if (!(out instanceof TestAllTypesMsg)) {
1839
+ Object.setPrototypeOf(out, TestAllTypesMsg.prototype);
1840
+ }
1841
+ if (!options?.merge) {
1842
+ Object.assign(out, new TestAllTypesMsg());
1843
+ delete out.$unknown;
1844
+ }
603
1845
  }
604
1846
  const n = endPos;
605
1847
  let pos = startPos;
@@ -1496,7 +2738,7 @@ export class OpaqueTestAllTypes {
1496
2738
  if ((this._dirtyMask & (1 << 1)) !== 0) {
1497
2739
  return this._f1Uint32;
1498
2740
  }
1499
- return readUint(this._raw, 1)[0];
2741
+ return readUint32(this._raw, 1)[0];
1500
2742
  }
1501
2743
  f1Uint32() {
1502
2744
  return this.getF1Uint32();
@@ -1528,7 +2770,7 @@ export class OpaqueTestAllTypes {
1528
2770
  if ((this._dirtyMask & (1 << 3)) !== 0) {
1529
2771
  return this._f3Sint32;
1530
2772
  }
1531
- return readInt(this._raw, 3)[0];
2773
+ return readInt32(this._raw, 3)[0];
1532
2774
  }
1533
2775
  f3Sint32() {
1534
2776
  return this.getF3Sint32();
@@ -1902,7 +3144,7 @@ export class OpaqueTestAllTypes {
1902
3144
  });
1903
3145
  this._dirtyMask = 0;
1904
3146
  }
1905
- if (options?.selfDescribing && (this._raw.length === 0 || this._raw[0] !== 0x19)) {
3147
+ if (options?.selfDescribing && !readField0SchemaMeta(this._raw)[1]) {
1906
3148
  const f0 = encodeField0SchemaMeta(TestAllTypesSchema.getSchemaMeta(0), Boolean(options.deterministic));
1907
3149
  const out = new Uint8Array(f0.length + this._raw.length);
1908
3150
  out.set(f0, 0);