@bufbuild/protobuf 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/descriptors.d.ts +12 -5
- package/dist/cjs/from-binary.js +7 -7
- package/dist/cjs/from-json.d.ts +1 -1
- package/dist/cjs/from-json.js +1 -1
- package/dist/cjs/reflect/path.d.ts +1 -1
- package/dist/cjs/registry.js +24 -1
- package/dist/cjs/to-json.d.ts +1 -1
- package/dist/cjs/to-json.js +9 -10
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/wire/binary-encoding.d.ts +9 -7
- package/dist/cjs/wire/binary-encoding.js +18 -8
- package/dist/cjs/wire/text-encoding.d.ts +4 -2
- package/dist/cjs/wire/text-encoding.js +8 -1
- package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +38 -2
- package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/dist/cjs/wkt/wrappers.d.ts +10 -0
- package/dist/cjs/wkt/wrappers.js +24 -0
- package/dist/esm/descriptors.d.ts +12 -5
- package/dist/esm/from-binary.js +7 -7
- package/dist/esm/from-json.d.ts +1 -1
- package/dist/esm/from-json.js +2 -2
- package/dist/esm/reflect/path.d.ts +1 -1
- package/dist/esm/registry.js +24 -1
- package/dist/esm/to-json.d.ts +1 -1
- package/dist/esm/to-json.js +10 -11
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/wire/binary-encoding.d.ts +9 -7
- package/dist/esm/wire/binary-encoding.js +18 -8
- package/dist/esm/wire/text-encoding.d.ts +4 -2
- package/dist/esm/wire/text-encoding.js +8 -1
- package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +37 -1
- package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/dist/esm/wkt/wrappers.d.ts +10 -0
- package/dist/esm/wkt/wrappers.js +23 -0
- package/package.json +1 -1
|
@@ -114,7 +114,7 @@ export interface DescEnum {
|
|
|
114
114
|
* A prefix shared by all enum values.
|
|
115
115
|
* For example, `my_enum_` for `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`
|
|
116
116
|
*/
|
|
117
|
-
readonly sharedPrefix?: string;
|
|
117
|
+
readonly sharedPrefix?: string | undefined;
|
|
118
118
|
/**
|
|
119
119
|
* Marked as deprecated in the protobuf source.
|
|
120
120
|
*/
|
|
@@ -192,8 +192,8 @@ export interface DescMessage {
|
|
|
192
192
|
*/
|
|
193
193
|
readonly oneofs: DescOneof[];
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
196
|
-
* protobuf source.
|
|
195
|
+
* Standalone fields and oneof groups for this message, ordered by
|
|
196
|
+
* their appearance in the protobuf source.
|
|
197
197
|
*/
|
|
198
198
|
readonly members: (DescField | DescOneof)[];
|
|
199
199
|
/**
|
|
@@ -283,6 +283,13 @@ interface descFieldAndExtensionShared {
|
|
|
283
283
|
* See https://protobuf.dev/programming-guides/field_presence/
|
|
284
284
|
*/
|
|
285
285
|
readonly presence: SupportedFieldPresence;
|
|
286
|
+
/**
|
|
287
|
+
* Whether to reject invalid UTF-8 when reading this field from the binary
|
|
288
|
+
* wire format. Reflects the resolved `utf8_validation` feature: true for
|
|
289
|
+
* VERIFY (proto3 and editions 2023+ default), false for NONE (proto2
|
|
290
|
+
* default).
|
|
291
|
+
*/
|
|
292
|
+
readonly utf8Validation: boolean;
|
|
286
293
|
/**
|
|
287
294
|
* The compiler-generated descriptor.
|
|
288
295
|
*/
|
|
@@ -620,8 +627,8 @@ export interface DescMethod {
|
|
|
620
627
|
*/
|
|
621
628
|
export interface DescComments {
|
|
622
629
|
readonly leadingDetached: readonly string[];
|
|
623
|
-
readonly leading?: string;
|
|
624
|
-
readonly trailing?: string;
|
|
630
|
+
readonly leading?: string | undefined;
|
|
631
|
+
readonly trailing?: string | undefined;
|
|
625
632
|
readonly sourcePath: readonly number[];
|
|
626
633
|
}
|
|
627
634
|
export {};
|
package/dist/cjs/from-binary.js
CHANGED
|
@@ -94,7 +94,7 @@ function readField(message, reader, field, wireType, options) {
|
|
|
94
94
|
var _a;
|
|
95
95
|
switch (field.fieldKind) {
|
|
96
96
|
case "scalar":
|
|
97
|
-
message.set(field, readScalar(reader, field.scalar));
|
|
97
|
+
message.set(field, readScalar(reader, field.scalar, field.utf8Validation));
|
|
98
98
|
break;
|
|
99
99
|
case "enum":
|
|
100
100
|
const val = readScalar(reader, descriptors_js_1.ScalarType.INT32);
|
|
@@ -144,12 +144,12 @@ function readMapEntry(reader, map, options) {
|
|
|
144
144
|
const [fieldNo] = reader.tag();
|
|
145
145
|
switch (fieldNo) {
|
|
146
146
|
case 1:
|
|
147
|
-
key = readScalar(reader, field.mapKey);
|
|
147
|
+
key = readScalar(reader, field.mapKey, field.utf8Validation);
|
|
148
148
|
break;
|
|
149
149
|
case 2:
|
|
150
150
|
switch (field.mapKind) {
|
|
151
151
|
case "scalar":
|
|
152
|
-
val = readScalar(reader, field.scalar);
|
|
152
|
+
val = readScalar(reader, field.scalar, field.utf8Validation);
|
|
153
153
|
break;
|
|
154
154
|
case "enum":
|
|
155
155
|
val = reader.int32();
|
|
@@ -191,12 +191,12 @@ function readListField(reader, wireType, list, options) {
|
|
|
191
191
|
scalarType != descriptors_js_1.ScalarType.STRING &&
|
|
192
192
|
scalarType != descriptors_js_1.ScalarType.BYTES;
|
|
193
193
|
if (!packed) {
|
|
194
|
-
list.add(readScalar(reader, scalarType));
|
|
194
|
+
list.add(readScalar(reader, scalarType, field.utf8Validation));
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
const e = reader.uint32() + reader.pos;
|
|
198
198
|
while (reader.pos < e) {
|
|
199
|
-
list.add(readScalar(reader, scalarType));
|
|
199
|
+
list.add(readScalar(reader, scalarType, field.utf8Validation));
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
function readMessageField(reader, options, field, mergeMessage) {
|
|
@@ -205,10 +205,10 @@ function readMessageField(reader, options, field, mergeMessage) {
|
|
|
205
205
|
readMessage(message, reader, options, delimited, delimited ? field.number : reader.uint32());
|
|
206
206
|
return message;
|
|
207
207
|
}
|
|
208
|
-
function readScalar(reader, type) {
|
|
208
|
+
function readScalar(reader, type, validateUtf8 = false) {
|
|
209
209
|
switch (type) {
|
|
210
210
|
case descriptors_js_1.ScalarType.STRING:
|
|
211
|
-
return reader.string();
|
|
211
|
+
return reader.string(validateUtf8);
|
|
212
212
|
case descriptors_js_1.ScalarType.BOOL:
|
|
213
213
|
return reader.bool();
|
|
214
214
|
case descriptors_js_1.ScalarType.DOUBLE:
|
package/dist/cjs/from-json.d.ts
CHANGED
package/dist/cjs/from-json.js
CHANGED
|
@@ -491,7 +491,7 @@ function anyFromJson(any, json, opts) {
|
|
|
491
491
|
throw new Error(`cannot decode message ${any.$typeName} from JSON: ${typeUrl} is not in the type registry`);
|
|
492
492
|
}
|
|
493
493
|
const msg = (0, reflect_js_1.reflect)(desc);
|
|
494
|
-
if (
|
|
494
|
+
if ((0, index_js_1.hasCustomJsonRepresentation)(desc) &&
|
|
495
495
|
Object.prototype.hasOwnProperty.call(json, "value")) {
|
|
496
496
|
const value = json.value;
|
|
497
497
|
readMessage(msg, value, opts);
|
|
@@ -89,7 +89,7 @@ export declare function buildPath(schema: DescMessage): PathBuilder;
|
|
|
89
89
|
* paths that refer to an extension.
|
|
90
90
|
*/
|
|
91
91
|
export declare function parsePath(schema: DescMessage, path: string, options?: {
|
|
92
|
-
registry?: Registry;
|
|
92
|
+
registry?: Registry | undefined;
|
|
93
93
|
}): Path;
|
|
94
94
|
/**
|
|
95
95
|
* Stringify a path.
|
package/dist/cjs/registry.js
CHANGED
|
@@ -197,6 +197,8 @@ function initBaseRegistry(inputs) {
|
|
|
197
197
|
const EDITION_PROTO2 = 998;
|
|
198
198
|
// bootstrap-inject google.protobuf.Edition.EDITION_PROTO3: const $name: Edition.$localName = $number;
|
|
199
199
|
const EDITION_PROTO3 = 999;
|
|
200
|
+
// bootstrap-inject google.protobuf.Edition.EDITION_UNSTABLE: const $name: Edition.$localName = $number;
|
|
201
|
+
const EDITION_UNSTABLE = 9999;
|
|
200
202
|
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_STRING: const $name: FieldDescriptorProto_Type.$localName = $number;
|
|
201
203
|
const TYPE_STRING = 9;
|
|
202
204
|
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_GROUP: const $name: FieldDescriptorProto_Type.$localName = $number;
|
|
@@ -227,9 +229,11 @@ const PACKED = 1;
|
|
|
227
229
|
const DELIMITED = 2;
|
|
228
230
|
// bootstrap-inject google.protobuf.FeatureSet.EnumType.OPEN: const $name: FeatureSet_EnumType.$localName = $number;
|
|
229
231
|
const OPEN = 1;
|
|
232
|
+
// bootstrap-inject google.protobuf.FeatureSet.Utf8Validation.VERIFY: const $name: FeatureSet_Utf8Validation.$localName = $number;
|
|
233
|
+
const VERIFY = 2;
|
|
230
234
|
// biome-ignore format: want this to read well
|
|
231
235
|
// bootstrap-inject defaults: EDITION_PROTO2 to EDITION_2024: export const minimumEdition: SupportedEdition = $minimumEdition, maximumEdition: SupportedEdition = $maximumEdition;
|
|
232
|
-
// generated from protoc
|
|
236
|
+
// generated from protoc v34.0
|
|
233
237
|
exports.minimumEdition = 998, exports.maximumEdition = 1001;
|
|
234
238
|
const featureDefaults = {
|
|
235
239
|
// EDITION_PROTO2
|
|
@@ -568,6 +572,7 @@ function newField(proto, parentOrFile, reg, oneof, mapEntries) {
|
|
|
568
572
|
message: undefined,
|
|
569
573
|
enum: undefined,
|
|
570
574
|
presence: getFieldPresence(proto, oneof, isExtension, parentOrFile),
|
|
575
|
+
utf8Validation: isUtf8Validated(proto, parentOrFile),
|
|
571
576
|
listKind: undefined,
|
|
572
577
|
mapKind: undefined,
|
|
573
578
|
mapKey: undefined,
|
|
@@ -696,6 +701,12 @@ function getFileEdition(proto) {
|
|
|
696
701
|
case "proto3":
|
|
697
702
|
return EDITION_PROTO3;
|
|
698
703
|
case "editions":
|
|
704
|
+
// EDITION_UNSTABLE is a sandbox for in-development features. Collapse
|
|
705
|
+
// it to maximumEdition so SupportedEdition and feature resolution do
|
|
706
|
+
// not leak the test-only edition to users.
|
|
707
|
+
if (proto.edition === EDITION_UNSTABLE) {
|
|
708
|
+
return exports.maximumEdition;
|
|
709
|
+
}
|
|
699
710
|
if (proto.edition in featureDefaults) {
|
|
700
711
|
return proto.edition;
|
|
701
712
|
}
|
|
@@ -891,6 +902,18 @@ function isDelimitedEncoding(proto, parent) {
|
|
|
891
902
|
parent,
|
|
892
903
|
}));
|
|
893
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* Reject invalid UTF-8 when reading string fields from the binary wire format?
|
|
907
|
+
* Driven by the resolved `utf8_validation` feature: VERIFY (proto3 / editions
|
|
908
|
+
* 2023+ default) enforces; NONE (proto2 default) does not.
|
|
909
|
+
*/
|
|
910
|
+
function isUtf8Validated(proto, parent) {
|
|
911
|
+
return (VERIFY ==
|
|
912
|
+
resolveFeature("utf8Validation", {
|
|
913
|
+
proto,
|
|
914
|
+
parent,
|
|
915
|
+
}));
|
|
916
|
+
}
|
|
894
917
|
function resolveFeature(name, ref) {
|
|
895
918
|
var _a, _b;
|
|
896
919
|
const featureSet = (_a = ref.proto.options) === null || _a === void 0 ? void 0 : _a.features;
|
package/dist/cjs/to-json.d.ts
CHANGED
package/dist/cjs/to-json.js
CHANGED
|
@@ -226,10 +226,12 @@ function scalarToJson(field, value) {
|
|
|
226
226
|
case descriptors_js_1.ScalarType.INT64:
|
|
227
227
|
case descriptors_js_1.ScalarType.SFIXED64:
|
|
228
228
|
case descriptors_js_1.ScalarType.SINT64:
|
|
229
|
-
if (typeof value
|
|
230
|
-
|
|
229
|
+
if (typeof value == "bigint" ||
|
|
230
|
+
typeof value == "string" ||
|
|
231
|
+
(typeof value == "number" && Number.isInteger(value))) {
|
|
232
|
+
return value.toString();
|
|
231
233
|
}
|
|
232
|
-
|
|
234
|
+
throw new Error(`cannot encode ${field} to JSON: ${(_e = (0, reflect_check_js_1.checkField)(field, value)) === null || _e === void 0 ? void 0 : _e.message}`);
|
|
233
235
|
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
|
234
236
|
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
|
235
237
|
case descriptors_js_1.ScalarType.BYTES:
|
|
@@ -286,13 +288,10 @@ function anyToJson(val, opts) {
|
|
|
286
288
|
if (!desc || !message) {
|
|
287
289
|
throw new Error(`cannot encode message ${val.$typeName} to JSON: "${val.typeUrl}" is not in the type registry`);
|
|
288
290
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
typeof json !== "object") {
|
|
294
|
-
json = { value: json };
|
|
295
|
-
}
|
|
291
|
+
const reflected = (0, reflect_js_1.reflect)(desc, message);
|
|
292
|
+
const json = (0, wrappers_js_1.hasCustomJsonRepresentation)(desc)
|
|
293
|
+
? { value: tryWktToJson(reflected, opts) }
|
|
294
|
+
: reflectToJson(reflected, opts);
|
|
296
295
|
json["@type"] = val.typeUrl;
|
|
297
296
|
return json;
|
|
298
297
|
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type Message<TypeName extends string = string> = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Unknown fields and extensions stored on the message.
|
|
17
17
|
*/
|
|
18
|
-
$unknown?: UnknownField[];
|
|
18
|
+
$unknown?: UnknownField[] | undefined;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Extract the message type from a message descriptor.
|
|
@@ -63,7 +63,7 @@ export declare class BinaryWriter {
|
|
|
63
63
|
private readonly encodeUtf8;
|
|
64
64
|
/**
|
|
65
65
|
* We cannot allocate a buffer for the entire output
|
|
66
|
-
* because we don't know
|
|
66
|
+
* because we don't know its size.
|
|
67
67
|
*
|
|
68
68
|
* So we collect smaller chunks of known size and
|
|
69
69
|
* concat them later.
|
|
@@ -120,7 +120,7 @@ export declare class BinaryWriter {
|
|
|
120
120
|
*/
|
|
121
121
|
int32(value: number): this;
|
|
122
122
|
/**
|
|
123
|
-
* Write a `bool` value, a
|
|
123
|
+
* Write a `bool` value, a varint.
|
|
124
124
|
*/
|
|
125
125
|
bool(value: boolean): this;
|
|
126
126
|
/**
|
|
@@ -152,7 +152,7 @@ export declare class BinaryWriter {
|
|
|
152
152
|
*/
|
|
153
153
|
sint32(value: number): this;
|
|
154
154
|
/**
|
|
155
|
-
* Write a `
|
|
155
|
+
* Write a `sfixed64` value, a signed, fixed-length 64-bit integer.
|
|
156
156
|
*/
|
|
157
157
|
sfixed64(value: string | number | bigint): this;
|
|
158
158
|
/**
|
|
@@ -184,9 +184,10 @@ export declare class BinaryReader {
|
|
|
184
184
|
readonly len: number;
|
|
185
185
|
protected readonly buf: Uint8Array;
|
|
186
186
|
private readonly view;
|
|
187
|
-
constructor(buf: Uint8Array, decodeUtf8?: (bytes: Uint8Array) => string);
|
|
187
|
+
constructor(buf: Uint8Array, decodeUtf8?: (bytes: Uint8Array, strict?: boolean) => string);
|
|
188
188
|
/**
|
|
189
|
-
* Reads a tag - field number and wire type.
|
|
189
|
+
* Reads a tag - field number and wire type. Tags are uint32 varints; values
|
|
190
|
+
* that do not fit in uint32 are rejected.
|
|
190
191
|
*/
|
|
191
192
|
tag(): [number, WireType];
|
|
192
193
|
/**
|
|
@@ -258,7 +259,8 @@ export declare class BinaryReader {
|
|
|
258
259
|
*/
|
|
259
260
|
bytes(): Uint8Array;
|
|
260
261
|
/**
|
|
261
|
-
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
|
262
|
+
* Read a `string` field, length-delimited data converted to UTF-8 text. If
|
|
263
|
+
* `strict` is true, throw on invalid UTF-8 instead of substituting U+FFFD.
|
|
262
264
|
*/
|
|
263
|
-
string(): string;
|
|
265
|
+
string(strict?: boolean): string;
|
|
264
266
|
}
|
|
@@ -181,7 +181,7 @@ class BinaryWriter {
|
|
|
181
181
|
return this;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* Write a `bool` value, a
|
|
184
|
+
* Write a `bool` value, a varint.
|
|
185
185
|
*/
|
|
186
186
|
bool(value) {
|
|
187
187
|
this.buf.push(value ? 1 : 0);
|
|
@@ -248,7 +248,7 @@ class BinaryWriter {
|
|
|
248
248
|
return this;
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
|
-
* Write a `
|
|
251
|
+
* Write a `sfixed64` value, a signed, fixed-length 64-bit integer.
|
|
252
252
|
*/
|
|
253
253
|
sfixed64(value) {
|
|
254
254
|
let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = proto_int64_js_1.protoInt64.enc(value);
|
|
@@ -307,12 +307,21 @@ class BinaryReader {
|
|
|
307
307
|
this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
|
-
* Reads a tag - field number and wire type.
|
|
310
|
+
* Reads a tag - field number and wire type. Tags are uint32 varints; values
|
|
311
|
+
* that do not fit in uint32 are rejected.
|
|
311
312
|
*/
|
|
312
313
|
tag() {
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
const start = this.pos;
|
|
315
|
+
const tag = this.uint32();
|
|
316
|
+
const bytesRead = this.pos - start;
|
|
317
|
+
if (bytesRead > 5 || (bytesRead == 5 && this.buf[this.pos - 1] > 0x0f)) {
|
|
318
|
+
throw new Error("illegal tag: varint overflows uint32");
|
|
319
|
+
}
|
|
320
|
+
const fieldNo = tag >>> 3;
|
|
321
|
+
const wireType = tag & 7;
|
|
322
|
+
if (fieldNo <= 0 || wireType > 5) {
|
|
315
323
|
throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
|
|
324
|
+
}
|
|
316
325
|
return [fieldNo, wireType];
|
|
317
326
|
}
|
|
318
327
|
/**
|
|
@@ -458,10 +467,11 @@ class BinaryReader {
|
|
|
458
467
|
return this.buf.subarray(start, start + len);
|
|
459
468
|
}
|
|
460
469
|
/**
|
|
461
|
-
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
|
470
|
+
* Read a `string` field, length-delimited data converted to UTF-8 text. If
|
|
471
|
+
* `strict` is true, throw on invalid UTF-8 instead of substituting U+FFFD.
|
|
462
472
|
*/
|
|
463
|
-
string() {
|
|
464
|
-
return this.decodeUtf8(this.bytes());
|
|
473
|
+
string(strict) {
|
|
474
|
+
return this.decodeUtf8(this.bytes(), strict);
|
|
465
475
|
}
|
|
466
476
|
}
|
|
467
477
|
exports.BinaryReader = BinaryReader;
|
|
@@ -8,9 +8,11 @@ interface TextEncoding {
|
|
|
8
8
|
*/
|
|
9
9
|
encodeUtf8: (text: string) => Uint8Array<ArrayBuffer>;
|
|
10
10
|
/**
|
|
11
|
-
* Decode UTF-8 text from binary.
|
|
11
|
+
* Decode UTF-8 text from binary. If `strict` is true, throw on invalid byte
|
|
12
|
+
* sequences instead of silently substituting U+FFFD. Implementations that
|
|
13
|
+
* do not support strict decoding may ignore the flag.
|
|
12
14
|
*/
|
|
13
|
-
decodeUtf8: (bytes: Uint8Array) => string;
|
|
15
|
+
decodeUtf8: (bytes: Uint8Array, strict?: boolean) => string;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Protobuf-ES requires the Text Encoding API to convert UTF-8 from and to
|
|
@@ -32,11 +32,18 @@ function getTextEncoding() {
|
|
|
32
32
|
if (globalThis[symbol] == undefined) {
|
|
33
33
|
const te = new globalThis.TextEncoder();
|
|
34
34
|
const td = new globalThis.TextDecoder();
|
|
35
|
+
let tdStrict;
|
|
35
36
|
globalThis[symbol] = {
|
|
36
37
|
encodeUtf8(text) {
|
|
37
38
|
return te.encode(text);
|
|
38
39
|
},
|
|
39
|
-
decodeUtf8(bytes) {
|
|
40
|
+
decodeUtf8(bytes, strict) {
|
|
41
|
+
if (strict) {
|
|
42
|
+
if (tdStrict === undefined) {
|
|
43
|
+
tdStrict = new globalThis.TextDecoder("utf-8", { fatal: true });
|
|
44
|
+
}
|
|
45
|
+
return tdStrict.decode(bytes);
|
|
46
|
+
}
|
|
40
47
|
return td.decode(bytes);
|
|
41
48
|
},
|
|
42
49
|
checkUtf8(text) {
|
|
@@ -75,7 +75,7 @@ export type Api = Message<"google.protobuf.Api"> & {
|
|
|
75
75
|
*
|
|
76
76
|
* @generated from field: google.protobuf.SourceContext source_context = 5;
|
|
77
77
|
*/
|
|
78
|
-
sourceContext?: SourceContext;
|
|
78
|
+
sourceContext?: SourceContext | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* Included interfaces. See [Mixin][].
|
|
81
81
|
*
|
|
@@ -121,7 +121,7 @@ export type CodeGeneratorRequest = Message<"google.protobuf.compiler.CodeGenerat
|
|
|
121
121
|
*
|
|
122
122
|
* @generated from field: optional google.protobuf.compiler.Version compiler_version = 3;
|
|
123
123
|
*/
|
|
124
|
-
compilerVersion?: Version;
|
|
124
|
+
compilerVersion?: Version | undefined;
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
127
|
* An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
|
@@ -371,7 +371,7 @@ export type CodeGeneratorResponse_File = Message<"google.protobuf.compiler.CodeG
|
|
|
371
371
|
*
|
|
372
372
|
* @generated from field: optional google.protobuf.GeneratedCodeInfo generated_code_info = 16;
|
|
373
373
|
*/
|
|
374
|
-
generatedCodeInfo?: GeneratedCodeInfo;
|
|
374
|
+
generatedCodeInfo?: GeneratedCodeInfo | undefined;
|
|
375
375
|
};
|
|
376
376
|
/**
|
|
377
377
|
* Represents a single generated file.
|
|
@@ -100,7 +100,7 @@ export type FileDescriptorProto = Message<"google.protobuf.FileDescriptorProto">
|
|
|
100
100
|
/**
|
|
101
101
|
* @generated from field: optional google.protobuf.FileOptions options = 8;
|
|
102
102
|
*/
|
|
103
|
-
options?: FileOptions;
|
|
103
|
+
options?: FileOptions | undefined;
|
|
104
104
|
/**
|
|
105
105
|
* This field contains optional information about the original source code.
|
|
106
106
|
* You may safely remove this entire field without harming runtime
|
|
@@ -109,7 +109,7 @@ export type FileDescriptorProto = Message<"google.protobuf.FileDescriptorProto">
|
|
|
109
109
|
*
|
|
110
110
|
* @generated from field: optional google.protobuf.SourceCodeInfo source_code_info = 9;
|
|
111
111
|
*/
|
|
112
|
-
sourceCodeInfo?: SourceCodeInfo;
|
|
112
|
+
sourceCodeInfo?: SourceCodeInfo | undefined;
|
|
113
113
|
/**
|
|
114
114
|
* The syntax of the proto file.
|
|
115
115
|
* The supported values are "proto2", "proto3", and "editions".
|
|
@@ -273,7 +273,7 @@ export type DescriptorProto = Message<"google.protobuf.DescriptorProto"> & {
|
|
|
273
273
|
/**
|
|
274
274
|
* @generated from field: optional google.protobuf.MessageOptions options = 7;
|
|
275
275
|
*/
|
|
276
|
-
options?: MessageOptions;
|
|
276
|
+
options?: MessageOptions | undefined;
|
|
277
277
|
/**
|
|
278
278
|
* @generated from field: repeated google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
|
|
279
279
|
*/
|
|
@@ -374,7 +374,7 @@ export type DescriptorProto_ExtensionRange = Message<"google.protobuf.Descriptor
|
|
|
374
374
|
/**
|
|
375
375
|
* @generated from field: optional google.protobuf.ExtensionRangeOptions options = 3;
|
|
376
376
|
*/
|
|
377
|
-
options?: ExtensionRangeOptions;
|
|
377
|
+
options?: ExtensionRangeOptions | undefined;
|
|
378
378
|
};
|
|
379
379
|
/**
|
|
380
380
|
* @generated from message google.protobuf.DescriptorProto.ExtensionRange
|
|
@@ -476,7 +476,7 @@ export type ExtensionRangeOptions = Message<"google.protobuf.ExtensionRangeOptio
|
|
|
476
476
|
*
|
|
477
477
|
* @generated from field: optional google.protobuf.FeatureSet features = 50;
|
|
478
478
|
*/
|
|
479
|
-
features?: FeatureSet;
|
|
479
|
+
features?: FeatureSet | undefined;
|
|
480
480
|
/**
|
|
481
481
|
* The verification state of the range.
|
|
482
482
|
* TODO: flip the default to DECLARATION once all empty ranges
|
|
@@ -712,7 +712,7 @@ export type FieldDescriptorProto = Message<"google.protobuf.FieldDescriptorProto
|
|
|
712
712
|
/**
|
|
713
713
|
* @generated from field: optional google.protobuf.FieldOptions options = 8;
|
|
714
714
|
*/
|
|
715
|
-
options?: FieldOptions;
|
|
715
|
+
options?: FieldOptions | undefined;
|
|
716
716
|
/**
|
|
717
717
|
* If true, this is a proto3 "optional". When a proto3 field is optional, it
|
|
718
718
|
* tracks presence regardless of field type.
|
|
@@ -997,7 +997,7 @@ export type OneofDescriptorProto = Message<"google.protobuf.OneofDescriptorProto
|
|
|
997
997
|
/**
|
|
998
998
|
* @generated from field: optional google.protobuf.OneofOptions options = 2;
|
|
999
999
|
*/
|
|
1000
|
-
options?: OneofOptions;
|
|
1000
|
+
options?: OneofOptions | undefined;
|
|
1001
1001
|
};
|
|
1002
1002
|
/**
|
|
1003
1003
|
* Describes a oneof.
|
|
@@ -1038,7 +1038,7 @@ export type EnumDescriptorProto = Message<"google.protobuf.EnumDescriptorProto">
|
|
|
1038
1038
|
/**
|
|
1039
1039
|
* @generated from field: optional google.protobuf.EnumOptions options = 3;
|
|
1040
1040
|
*/
|
|
1041
|
-
options?: EnumOptions;
|
|
1041
|
+
options?: EnumOptions | undefined;
|
|
1042
1042
|
/**
|
|
1043
1043
|
* Range of reserved numeric values. Reserved numeric values may not be used
|
|
1044
1044
|
* by enum values in the same enum declaration. Reserved ranges may not
|
|
@@ -1180,7 +1180,7 @@ export type EnumValueDescriptorProto = Message<"google.protobuf.EnumValueDescrip
|
|
|
1180
1180
|
/**
|
|
1181
1181
|
* @generated from field: optional google.protobuf.EnumValueOptions options = 3;
|
|
1182
1182
|
*/
|
|
1183
|
-
options?: EnumValueOptions;
|
|
1183
|
+
options?: EnumValueOptions | undefined;
|
|
1184
1184
|
};
|
|
1185
1185
|
/**
|
|
1186
1186
|
* Describes a value within an enum.
|
|
@@ -1225,7 +1225,7 @@ export type ServiceDescriptorProto = Message<"google.protobuf.ServiceDescriptorP
|
|
|
1225
1225
|
/**
|
|
1226
1226
|
* @generated from field: optional google.protobuf.ServiceOptions options = 3;
|
|
1227
1227
|
*/
|
|
1228
|
-
options?: ServiceOptions;
|
|
1228
|
+
options?: ServiceOptions | undefined;
|
|
1229
1229
|
};
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Describes a service.
|
|
@@ -1277,7 +1277,7 @@ export type MethodDescriptorProto = Message<"google.protobuf.MethodDescriptorPro
|
|
|
1277
1277
|
/**
|
|
1278
1278
|
* @generated from field: optional google.protobuf.MethodOptions options = 4;
|
|
1279
1279
|
*/
|
|
1280
|
-
options?: MethodOptions;
|
|
1280
|
+
options?: MethodOptions | undefined;
|
|
1281
1281
|
/**
|
|
1282
1282
|
* Identifies if client streams multiple client messages
|
|
1283
1283
|
*
|
|
@@ -1506,7 +1506,7 @@ export type FileOptions = Message<"google.protobuf.FileOptions"> & {
|
|
|
1506
1506
|
*
|
|
1507
1507
|
* @generated from field: optional google.protobuf.FeatureSet features = 50;
|
|
1508
1508
|
*/
|
|
1509
|
-
features?: FeatureSet;
|
|
1509
|
+
features?: FeatureSet | undefined;
|
|
1510
1510
|
/**
|
|
1511
1511
|
* The parser stores options it doesn't recognize here.
|
|
1512
1512
|
* See the documentation for the "Options" section above.
|
|
@@ -1832,7 +1832,7 @@ export type MessageOptions = Message<"google.protobuf.MessageOptions"> & {
|
|
|
1832
1832
|
*
|
|
1833
1833
|
* @generated from field: optional google.protobuf.FeatureSet features = 12;
|
|
1834
1834
|
*/
|
|
1835
|
-
features?: FeatureSet;
|
|
1835
|
+
features?: FeatureSet | undefined;
|
|
1836
1836
|
/**
|
|
1837
1837
|
* The parser stores options it doesn't recognize here. See above.
|
|
1838
1838
|
*
|
|
@@ -2072,11 +2072,11 @@ export type FieldOptions = Message<"google.protobuf.FieldOptions"> & {
|
|
|
2072
2072
|
*
|
|
2073
2073
|
* @generated from field: optional google.protobuf.FeatureSet features = 21;
|
|
2074
2074
|
*/
|
|
2075
|
-
features?: FeatureSet;
|
|
2075
|
+
features?: FeatureSet | undefined;
|
|
2076
2076
|
/**
|
|
2077
2077
|
* @generated from field: optional google.protobuf.FieldOptions.FeatureSupport feature_support = 22;
|
|
2078
2078
|
*/
|
|
2079
|
-
featureSupport?: FieldOptions_FeatureSupport;
|
|
2079
|
+
featureSupport?: FieldOptions_FeatureSupport | undefined;
|
|
2080
2080
|
/**
|
|
2081
2081
|
* The parser stores options it doesn't recognize here. See above.
|
|
2082
2082
|
*
|
|
@@ -2299,6 +2299,13 @@ export type FieldOptions_FeatureSupport = Message<"google.protobuf.FieldOptions.
|
|
|
2299
2299
|
* @generated from field: optional google.protobuf.Edition edition_removed = 4;
|
|
2300
2300
|
*/
|
|
2301
2301
|
editionRemoved: Edition;
|
|
2302
|
+
/**
|
|
2303
|
+
* The removal error text if this feature is used after the edition it was
|
|
2304
|
+
* removed in.
|
|
2305
|
+
*
|
|
2306
|
+
* @generated from field: optional string removal_error = 5;
|
|
2307
|
+
*/
|
|
2308
|
+
removalError: string;
|
|
2302
2309
|
};
|
|
2303
2310
|
/**
|
|
2304
2311
|
* Information about the support window of a feature.
|
|
@@ -2336,6 +2343,13 @@ export type FieldOptions_FeatureSupportJson = {
|
|
|
2336
2343
|
* @generated from field: optional google.protobuf.Edition edition_removed = 4;
|
|
2337
2344
|
*/
|
|
2338
2345
|
editionRemoved?: EditionJson;
|
|
2346
|
+
/**
|
|
2347
|
+
* The removal error text if this feature is used after the edition it was
|
|
2348
|
+
* removed in.
|
|
2349
|
+
*
|
|
2350
|
+
* @generated from field: optional string removal_error = 5;
|
|
2351
|
+
*/
|
|
2352
|
+
removalError?: string;
|
|
2339
2353
|
};
|
|
2340
2354
|
/**
|
|
2341
2355
|
* Describes the message google.protobuf.FieldOptions.FeatureSupport.
|
|
@@ -2511,7 +2525,7 @@ export type OneofOptions = Message<"google.protobuf.OneofOptions"> & {
|
|
|
2511
2525
|
*
|
|
2512
2526
|
* @generated from field: optional google.protobuf.FeatureSet features = 1;
|
|
2513
2527
|
*/
|
|
2514
|
-
features?: FeatureSet;
|
|
2528
|
+
features?: FeatureSet | undefined;
|
|
2515
2529
|
/**
|
|
2516
2530
|
* The parser stores options it doesn't recognize here. See above.
|
|
2517
2531
|
*
|
|
@@ -2586,7 +2600,7 @@ export type EnumOptions = Message<"google.protobuf.EnumOptions"> & {
|
|
|
2586
2600
|
*
|
|
2587
2601
|
* @generated from field: optional google.protobuf.FeatureSet features = 7;
|
|
2588
2602
|
*/
|
|
2589
|
-
features?: FeatureSet;
|
|
2603
|
+
features?: FeatureSet | undefined;
|
|
2590
2604
|
/**
|
|
2591
2605
|
* The parser stores options it doesn't recognize here. See above.
|
|
2592
2606
|
*
|
|
@@ -2670,7 +2684,7 @@ export type EnumValueOptions = Message<"google.protobuf.EnumValueOptions"> & {
|
|
|
2670
2684
|
*
|
|
2671
2685
|
* @generated from field: optional google.protobuf.FeatureSet features = 2;
|
|
2672
2686
|
*/
|
|
2673
|
-
features?: FeatureSet;
|
|
2687
|
+
features?: FeatureSet | undefined;
|
|
2674
2688
|
/**
|
|
2675
2689
|
* Indicate that fields annotated with this enum value should not be printed
|
|
2676
2690
|
* out when using debug formats, e.g. when the field contains sensitive
|
|
@@ -2684,7 +2698,7 @@ export type EnumValueOptions = Message<"google.protobuf.EnumValueOptions"> & {
|
|
|
2684
2698
|
*
|
|
2685
2699
|
* @generated from field: optional google.protobuf.FieldOptions.FeatureSupport feature_support = 4;
|
|
2686
2700
|
*/
|
|
2687
|
-
featureSupport?: FieldOptions_FeatureSupport;
|
|
2701
|
+
featureSupport?: FieldOptions_FeatureSupport | undefined;
|
|
2688
2702
|
/**
|
|
2689
2703
|
* The parser stores options it doesn't recognize here. See above.
|
|
2690
2704
|
*
|
|
@@ -2754,7 +2768,7 @@ export type ServiceOptions = Message<"google.protobuf.ServiceOptions"> & {
|
|
|
2754
2768
|
*
|
|
2755
2769
|
* @generated from field: optional google.protobuf.FeatureSet features = 34;
|
|
2756
2770
|
*/
|
|
2757
|
-
features?: FeatureSet;
|
|
2771
|
+
features?: FeatureSet | undefined;
|
|
2758
2772
|
/**
|
|
2759
2773
|
* Is this service deprecated?
|
|
2760
2774
|
* Depending on the target platform, this can emit Deprecated annotations
|
|
@@ -2832,7 +2846,7 @@ export type MethodOptions = Message<"google.protobuf.MethodOptions"> & {
|
|
|
2832
2846
|
*
|
|
2833
2847
|
* @generated from field: optional google.protobuf.FeatureSet features = 35;
|
|
2834
2848
|
*/
|
|
2835
|
-
features?: FeatureSet;
|
|
2849
|
+
features?: FeatureSet | undefined;
|
|
2836
2850
|
/**
|
|
2837
2851
|
* The parser stores options it doesn't recognize here. See above.
|
|
2838
2852
|
*
|
|
@@ -3468,13 +3482,13 @@ export type FeatureSetDefaults_FeatureSetEditionDefault = Message<"google.protob
|
|
|
3468
3482
|
*
|
|
3469
3483
|
* @generated from field: optional google.protobuf.FeatureSet overridable_features = 4;
|
|
3470
3484
|
*/
|
|
3471
|
-
overridableFeatures?: FeatureSet;
|
|
3485
|
+
overridableFeatures?: FeatureSet | undefined;
|
|
3472
3486
|
/**
|
|
3473
3487
|
* Defaults of features that can't be overridden in this edition.
|
|
3474
3488
|
*
|
|
3475
3489
|
* @generated from field: optional google.protobuf.FeatureSet fixed_features = 5;
|
|
3476
3490
|
*/
|
|
3477
|
-
fixedFeatures?: FeatureSet;
|
|
3491
|
+
fixedFeatures?: FeatureSet | undefined;
|
|
3478
3492
|
};
|
|
3479
3493
|
/**
|
|
3480
3494
|
* A map from every known edition with a unique set of defaults to its
|