@bufbuild/protobuf 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/codegen-info.js +2 -0
  2. package/dist/cjs/google/protobuf/any_pb.js +4 -4
  3. package/dist/cjs/google/protobuf/api_pb.js +4 -4
  4. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +4 -4
  5. package/dist/cjs/google/protobuf/descriptor_pb.js +106 -28
  6. package/dist/cjs/google/protobuf/duration_pb.js +1 -1
  7. package/dist/cjs/google/protobuf/empty_pb.js +1 -1
  8. package/dist/cjs/google/protobuf/field_mask_pb.js +2 -2
  9. package/dist/cjs/google/protobuf/source_context_pb.js +1 -1
  10. package/dist/cjs/google/protobuf/struct_pb.js +5 -5
  11. package/dist/cjs/google/protobuf/timestamp_pb.js +2 -2
  12. package/dist/cjs/google/protobuf/type_pb.js +27 -6
  13. package/dist/cjs/google/protobuf/wrappers_pb.js +9 -9
  14. package/dist/cjs/index.js +0 -3
  15. package/dist/cjs/private/binary-format-common.js +44 -6
  16. package/dist/cjs/private/names.js +128 -97
  17. package/dist/cjs/proto-base64.js +2 -10
  18. package/dist/esm/codegen-info.js +3 -1
  19. package/dist/esm/create-descriptor-set.js +1 -1
  20. package/dist/esm/google/protobuf/any_pb.js +5 -4
  21. package/dist/esm/google/protobuf/api_pb.js +7 -4
  22. package/dist/esm/google/protobuf/compiler/plugin_pb.js +8 -4
  23. package/dist/esm/google/protobuf/descriptor_pb.js +132 -27
  24. package/dist/esm/google/protobuf/duration_pb.js +2 -1
  25. package/dist/esm/google/protobuf/empty_pb.js +2 -1
  26. package/dist/esm/google/protobuf/field_mask_pb.js +3 -2
  27. package/dist/esm/google/protobuf/source_context_pb.js +2 -1
  28. package/dist/esm/google/protobuf/struct_pb.js +8 -5
  29. package/dist/esm/google/protobuf/timestamp_pb.js +3 -2
  30. package/dist/esm/google/protobuf/type_pb.js +32 -6
  31. package/dist/esm/google/protobuf/wrappers_pb.js +18 -9
  32. package/dist/esm/index.js +1 -4
  33. package/dist/esm/private/binary-format-common.js +45 -7
  34. package/dist/esm/private/message-type.js +1 -1
  35. package/dist/esm/private/names.js +125 -96
  36. package/dist/esm/private/util-common.js +1 -1
  37. package/dist/esm/proto-base64.js +2 -10
  38. package/dist/types/codegen-info.d.ts +3 -1
  39. package/dist/types/google/protobuf/any_pb.d.ts +3 -3
  40. package/dist/types/google/protobuf/api_pb.d.ts +1 -1
  41. package/dist/types/google/protobuf/descriptor_pb.d.ts +107 -3
  42. package/dist/types/google/protobuf/struct_pb.d.ts +1 -1
  43. package/dist/types/google/protobuf/timestamp_pb.d.ts +1 -1
  44. package/dist/types/google/protobuf/type_pb.d.ts +19 -1
  45. package/dist/types/index.d.ts +5 -4
  46. package/dist/types/private/binary-format-common.d.ts +3 -2
  47. package/dist/types/private/json-format-common.d.ts +2 -1
  48. package/dist/types/private/message-type.d.ts +2 -1
  49. package/dist/types/private/names.d.ts +9 -0
  50. package/dist/types/private/scalars.d.ts +2 -1
  51. package/dist/types/proto-base64.d.ts +1 -9
  52. package/package.json +2 -2
@@ -160,10 +160,10 @@ class Duration extends message_js_1.Message {
160
160
  return proto3_js_1.proto3.util.equals(Duration, a, b);
161
161
  }
162
162
  }
163
- exports.Duration = Duration;
164
163
  Duration.runtime = proto3_js_1.proto3;
165
164
  Duration.typeName = "google.protobuf.Duration";
166
165
  Duration.fields = proto3_js_1.proto3.util.newFieldList(() => [
167
166
  { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
168
167
  { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
169
168
  ]);
169
+ exports.Duration = Duration;
@@ -46,7 +46,7 @@ class Empty extends message_js_1.Message {
46
46
  return proto3_js_1.proto3.util.equals(Empty, a, b);
47
47
  }
48
48
  }
49
- exports.Empty = Empty;
50
49
  Empty.runtime = proto3_js_1.proto3;
51
50
  Empty.typeName = "google.protobuf.Empty";
52
51
  Empty.fields = proto3_js_1.proto3.util.newFieldList(() => []);
52
+ exports.Empty = Empty;
@@ -268,7 +268,7 @@ class FieldMask extends message_js_1.Message {
268
268
  }
269
269
  return this.paths.map(p => {
270
270
  if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
271
- throw new Error("cannot decode google.protobuf.FieldMask from JSON: lowerCamelCase of path name \"" + p + "\" is irreversible");
271
+ throw new Error("cannot encode google.protobuf.FieldMask to JSON: lowerCamelCase of path name \"" + p + "\" is irreversible");
272
272
  }
273
273
  return protoCamelCase(p);
274
274
  }).join(",");
@@ -303,9 +303,9 @@ class FieldMask extends message_js_1.Message {
303
303
  return proto3_js_1.proto3.util.equals(FieldMask, a, b);
304
304
  }
305
305
  }
306
- exports.FieldMask = FieldMask;
307
306
  FieldMask.runtime = proto3_js_1.proto3;
308
307
  FieldMask.typeName = "google.protobuf.FieldMask";
309
308
  FieldMask.fields = proto3_js_1.proto3.util.newFieldList(() => [
310
309
  { no: 1, name: "paths", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
311
310
  ]);
311
+ exports.FieldMask = FieldMask;
@@ -47,9 +47,9 @@ class SourceContext extends message_js_1.Message {
47
47
  return proto3_js_1.proto3.util.equals(SourceContext, a, b);
48
48
  }
49
49
  }
50
- exports.SourceContext = SourceContext;
51
50
  SourceContext.runtime = proto3_js_1.proto3;
52
51
  SourceContext.typeName = "google.protobuf.SourceContext";
53
52
  SourceContext.fields = proto3_js_1.proto3.util.newFieldList(() => [
54
53
  { no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
55
54
  ]);
55
+ exports.SourceContext = SourceContext;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
17
- // @generated by protoc-gen-es v1.1.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.2.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -23,7 +23,7 @@ const message_js_1 = require("../../message.js");
23
23
  * `NullValue` is a singleton enumeration to represent the null value for the
24
24
  * `Value` type union.
25
25
  *
26
- * The JSON representation for `NullValue` is JSON `null`.
26
+ * The JSON representation for `NullValue` is JSON `null`.
27
27
  *
28
28
  * @generated from enum google.protobuf.NullValue
29
29
  */
@@ -92,12 +92,12 @@ class Struct extends message_js_1.Message {
92
92
  return proto3_js_1.proto3.util.equals(Struct, a, b);
93
93
  }
94
94
  }
95
- exports.Struct = Struct;
96
95
  Struct.runtime = proto3_js_1.proto3;
97
96
  Struct.typeName = "google.protobuf.Struct";
98
97
  Struct.fields = proto3_js_1.proto3.util.newFieldList(() => [
99
98
  { no: 1, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: { kind: "message", T: Value } },
100
99
  ]);
100
+ exports.Struct = Struct;
101
101
  /**
102
102
  * `Value` represents a dynamically typed value which can be either
103
103
  * null, a number, a string, a boolean, a recursive struct value, or a
@@ -178,7 +178,6 @@ class Value extends message_js_1.Message {
178
178
  return proto3_js_1.proto3.util.equals(Value, a, b);
179
179
  }
180
180
  }
181
- exports.Value = Value;
182
181
  Value.runtime = proto3_js_1.proto3;
183
182
  Value.typeName = "google.protobuf.Value";
184
183
  Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -189,6 +188,7 @@ Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
189
188
  { no: 5, name: "struct_value", kind: "message", T: Struct, oneof: "kind" },
190
189
  { no: 6, name: "list_value", kind: "message", T: ListValue, oneof: "kind" },
191
190
  ]);
191
+ exports.Value = Value;
192
192
  /**
193
193
  * `ListValue` is a wrapper around a repeated field of values.
194
194
  *
@@ -232,9 +232,9 @@ class ListValue extends message_js_1.Message {
232
232
  return proto3_js_1.proto3.util.equals(ListValue, a, b);
233
233
  }
234
234
  }
235
- exports.ListValue = ListValue;
236
235
  ListValue.runtime = proto3_js_1.proto3;
237
236
  ListValue.typeName = "google.protobuf.ListValue";
238
237
  ListValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
239
238
  { no: 1, name: "values", kind: "message", T: Value, repeated: true },
240
239
  ]);
240
+ exports.ListValue = ListValue;
@@ -105,7 +105,7 @@ const proto3_js_1 = require("../../proto3.js");
105
105
  * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
106
106
  * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
107
107
  * the Joda Time's [`ISODateTimeFormat.dateTime()`](
108
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
108
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
109
109
  * ) to obtain a formatter capable of generating timestamps in this format.
110
110
  *
111
111
  *
@@ -204,10 +204,10 @@ class Timestamp extends message_js_1.Message {
204
204
  return proto3_js_1.proto3.util.equals(Timestamp, a, b);
205
205
  }
206
206
  }
207
- exports.Timestamp = Timestamp;
208
207
  Timestamp.runtime = proto3_js_1.proto3;
209
208
  Timestamp.typeName = "google.protobuf.Timestamp";
210
209
  Timestamp.fields = proto3_js_1.proto3.util.newFieldList(() => [
211
210
  { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
212
211
  { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
213
212
  ]);
213
+ exports.Timestamp = Timestamp;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
17
- // @generated by protoc-gen-es v1.1.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.2.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -40,11 +40,18 @@ var Syntax;
40
40
  * @generated from enum value: SYNTAX_PROTO3 = 1;
41
41
  */
42
42
  Syntax[Syntax["PROTO3"] = 1] = "PROTO3";
43
+ /**
44
+ * Syntax `editions`.
45
+ *
46
+ * @generated from enum value: SYNTAX_EDITIONS = 2;
47
+ */
48
+ Syntax[Syntax["EDITIONS"] = 2] = "EDITIONS";
43
49
  })(Syntax = exports.Syntax || (exports.Syntax = {}));
44
50
  // Retrieve enum metadata with: proto3.getEnumType(Syntax)
45
51
  proto3_js_1.proto3.util.setEnumType(Syntax, "google.protobuf.Syntax", [
46
52
  { no: 0, name: "SYNTAX_PROTO2" },
47
53
  { no: 1, name: "SYNTAX_PROTO3" },
54
+ { no: 2, name: "SYNTAX_EDITIONS" },
48
55
  ]);
49
56
  /**
50
57
  * A protocol buffer message type.
@@ -84,6 +91,12 @@ class Type extends message_js_1.Message {
84
91
  * @generated from field: google.protobuf.Syntax syntax = 6;
85
92
  */
86
93
  this.syntax = Syntax.PROTO2;
94
+ /**
95
+ * The source edition string, only valid when syntax is SYNTAX_EDITIONS.
96
+ *
97
+ * @generated from field: string edition = 7;
98
+ */
99
+ this.edition = "";
87
100
  proto3_js_1.proto3.util.initPartial(data, this);
88
101
  }
89
102
  static fromBinary(bytes, options) {
@@ -99,7 +112,6 @@ class Type extends message_js_1.Message {
99
112
  return proto3_js_1.proto3.util.equals(Type, a, b);
100
113
  }
101
114
  }
102
- exports.Type = Type;
103
115
  Type.runtime = proto3_js_1.proto3;
104
116
  Type.typeName = "google.protobuf.Type";
105
117
  Type.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -109,7 +121,9 @@ Type.fields = proto3_js_1.proto3.util.newFieldList(() => [
109
121
  { no: 4, name: "options", kind: "message", T: Option, repeated: true },
110
122
  { no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
111
123
  { no: 6, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
124
+ { no: 7, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
112
125
  ]);
126
+ exports.Type = Type;
113
127
  /**
114
128
  * A single field of a message type.
115
129
  *
@@ -195,7 +209,6 @@ class Field extends message_js_1.Message {
195
209
  return proto3_js_1.proto3.util.equals(Field, a, b);
196
210
  }
197
211
  }
198
- exports.Field = Field;
199
212
  Field.runtime = proto3_js_1.proto3;
200
213
  Field.typeName = "google.protobuf.Field";
201
214
  Field.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -210,6 +223,7 @@ Field.fields = proto3_js_1.proto3.util.newFieldList(() => [
210
223
  { no: 10, name: "json_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
211
224
  { no: 11, name: "default_value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
212
225
  ]);
226
+ exports.Field = Field;
213
227
  /**
214
228
  * Basic field types.
215
229
  *
@@ -425,6 +439,12 @@ class Enum extends message_js_1.Message {
425
439
  * @generated from field: google.protobuf.Syntax syntax = 5;
426
440
  */
427
441
  this.syntax = Syntax.PROTO2;
442
+ /**
443
+ * The source edition string, only valid when syntax is SYNTAX_EDITIONS.
444
+ *
445
+ * @generated from field: string edition = 6;
446
+ */
447
+ this.edition = "";
428
448
  proto3_js_1.proto3.util.initPartial(data, this);
429
449
  }
430
450
  static fromBinary(bytes, options) {
@@ -440,7 +460,6 @@ class Enum extends message_js_1.Message {
440
460
  return proto3_js_1.proto3.util.equals(Enum, a, b);
441
461
  }
442
462
  }
443
- exports.Enum = Enum;
444
463
  Enum.runtime = proto3_js_1.proto3;
445
464
  Enum.typeName = "google.protobuf.Enum";
446
465
  Enum.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -449,7 +468,9 @@ Enum.fields = proto3_js_1.proto3.util.newFieldList(() => [
449
468
  { no: 3, name: "options", kind: "message", T: Option, repeated: true },
450
469
  { no: 4, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
451
470
  { no: 5, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
471
+ { no: 6, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
452
472
  ]);
473
+ exports.Enum = Enum;
453
474
  /**
454
475
  * Enum value definition.
455
476
  *
@@ -491,7 +512,6 @@ class EnumValue extends message_js_1.Message {
491
512
  return proto3_js_1.proto3.util.equals(EnumValue, a, b);
492
513
  }
493
514
  }
494
- exports.EnumValue = EnumValue;
495
515
  EnumValue.runtime = proto3_js_1.proto3;
496
516
  EnumValue.typeName = "google.protobuf.EnumValue";
497
517
  EnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -499,6 +519,7 @@ EnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
499
519
  { no: 2, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
500
520
  { no: 3, name: "options", kind: "message", T: Option, repeated: true },
501
521
  ]);
522
+ exports.EnumValue = EnumValue;
502
523
  /**
503
524
  * A protocol buffer option, which can be attached to a message, field,
504
525
  * enumeration, etc.
@@ -532,10 +553,10 @@ class Option extends message_js_1.Message {
532
553
  return proto3_js_1.proto3.util.equals(Option, a, b);
533
554
  }
534
555
  }
535
- exports.Option = Option;
536
556
  Option.runtime = proto3_js_1.proto3;
537
557
  Option.typeName = "google.protobuf.Option";
538
558
  Option.fields = proto3_js_1.proto3.util.newFieldList(() => [
539
559
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
540
560
  { no: 2, name: "value", kind: "message", T: any_pb_js_1.Any },
541
561
  ]);
562
+ exports.Option = Option;
@@ -65,7 +65,6 @@ class DoubleValue extends message_js_1.Message {
65
65
  return proto3_js_1.proto3.util.equals(DoubleValue, a, b);
66
66
  }
67
67
  }
68
- exports.DoubleValue = DoubleValue;
69
68
  DoubleValue.runtime = proto3_js_1.proto3;
70
69
  DoubleValue.typeName = "google.protobuf.DoubleValue";
71
70
  DoubleValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -79,6 +78,7 @@ DoubleValue.fieldWrapper = {
79
78
  return value.value;
80
79
  }
81
80
  };
81
+ exports.DoubleValue = DoubleValue;
82
82
  /**
83
83
  * Wrapper message for `float`.
84
84
  *
@@ -126,7 +126,6 @@ class FloatValue extends message_js_1.Message {
126
126
  return proto3_js_1.proto3.util.equals(FloatValue, a, b);
127
127
  }
128
128
  }
129
- exports.FloatValue = FloatValue;
130
129
  FloatValue.runtime = proto3_js_1.proto3;
131
130
  FloatValue.typeName = "google.protobuf.FloatValue";
132
131
  FloatValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -140,6 +139,7 @@ FloatValue.fieldWrapper = {
140
139
  return value.value;
141
140
  }
142
141
  };
142
+ exports.FloatValue = FloatValue;
143
143
  /**
144
144
  * Wrapper message for `int64`.
145
145
  *
@@ -187,7 +187,6 @@ class Int64Value extends message_js_1.Message {
187
187
  return proto3_js_1.proto3.util.equals(Int64Value, a, b);
188
188
  }
189
189
  }
190
- exports.Int64Value = Int64Value;
191
190
  Int64Value.runtime = proto3_js_1.proto3;
192
191
  Int64Value.typeName = "google.protobuf.Int64Value";
193
192
  Int64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -201,6 +200,7 @@ Int64Value.fieldWrapper = {
201
200
  return value.value;
202
201
  }
203
202
  };
203
+ exports.Int64Value = Int64Value;
204
204
  /**
205
205
  * Wrapper message for `uint64`.
206
206
  *
@@ -248,7 +248,6 @@ class UInt64Value extends message_js_1.Message {
248
248
  return proto3_js_1.proto3.util.equals(UInt64Value, a, b);
249
249
  }
250
250
  }
251
- exports.UInt64Value = UInt64Value;
252
251
  UInt64Value.runtime = proto3_js_1.proto3;
253
252
  UInt64Value.typeName = "google.protobuf.UInt64Value";
254
253
  UInt64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -262,6 +261,7 @@ UInt64Value.fieldWrapper = {
262
261
  return value.value;
263
262
  }
264
263
  };
264
+ exports.UInt64Value = UInt64Value;
265
265
  /**
266
266
  * Wrapper message for `int32`.
267
267
  *
@@ -309,7 +309,6 @@ class Int32Value extends message_js_1.Message {
309
309
  return proto3_js_1.proto3.util.equals(Int32Value, a, b);
310
310
  }
311
311
  }
312
- exports.Int32Value = Int32Value;
313
312
  Int32Value.runtime = proto3_js_1.proto3;
314
313
  Int32Value.typeName = "google.protobuf.Int32Value";
315
314
  Int32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -323,6 +322,7 @@ Int32Value.fieldWrapper = {
323
322
  return value.value;
324
323
  }
325
324
  };
325
+ exports.Int32Value = Int32Value;
326
326
  /**
327
327
  * Wrapper message for `uint32`.
328
328
  *
@@ -370,7 +370,6 @@ class UInt32Value extends message_js_1.Message {
370
370
  return proto3_js_1.proto3.util.equals(UInt32Value, a, b);
371
371
  }
372
372
  }
373
- exports.UInt32Value = UInt32Value;
374
373
  UInt32Value.runtime = proto3_js_1.proto3;
375
374
  UInt32Value.typeName = "google.protobuf.UInt32Value";
376
375
  UInt32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -384,6 +383,7 @@ UInt32Value.fieldWrapper = {
384
383
  return value.value;
385
384
  }
386
385
  };
386
+ exports.UInt32Value = UInt32Value;
387
387
  /**
388
388
  * Wrapper message for `bool`.
389
389
  *
@@ -431,7 +431,6 @@ class BoolValue extends message_js_1.Message {
431
431
  return proto3_js_1.proto3.util.equals(BoolValue, a, b);
432
432
  }
433
433
  }
434
- exports.BoolValue = BoolValue;
435
434
  BoolValue.runtime = proto3_js_1.proto3;
436
435
  BoolValue.typeName = "google.protobuf.BoolValue";
437
436
  BoolValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -445,6 +444,7 @@ BoolValue.fieldWrapper = {
445
444
  return value.value;
446
445
  }
447
446
  };
447
+ exports.BoolValue = BoolValue;
448
448
  /**
449
449
  * Wrapper message for `string`.
450
450
  *
@@ -492,7 +492,6 @@ class StringValue extends message_js_1.Message {
492
492
  return proto3_js_1.proto3.util.equals(StringValue, a, b);
493
493
  }
494
494
  }
495
- exports.StringValue = StringValue;
496
495
  StringValue.runtime = proto3_js_1.proto3;
497
496
  StringValue.typeName = "google.protobuf.StringValue";
498
497
  StringValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -506,6 +505,7 @@ StringValue.fieldWrapper = {
506
505
  return value.value;
507
506
  }
508
507
  };
508
+ exports.StringValue = StringValue;
509
509
  /**
510
510
  * Wrapper message for `bytes`.
511
511
  *
@@ -553,7 +553,6 @@ class BytesValue extends message_js_1.Message {
553
553
  return proto3_js_1.proto3.util.equals(BytesValue, a, b);
554
554
  }
555
555
  }
556
- exports.BytesValue = BytesValue;
557
556
  BytesValue.runtime = proto3_js_1.proto3;
558
557
  BytesValue.typeName = "google.protobuf.BytesValue";
559
558
  BytesValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -567,3 +566,4 @@ BytesValue.fieldWrapper = {
567
566
  return value.value;
568
567
  }
569
568
  };
569
+ exports.BytesValue = BytesValue;
package/dist/cjs/index.js CHANGED
@@ -51,11 +51,8 @@ var binary_encoding_js_1 = require("./binary-encoding.js");
51
51
  Object.defineProperty(exports, "WireType", { enumerable: true, get: function () { return binary_encoding_js_1.WireType; } });
52
52
  Object.defineProperty(exports, "BinaryWriter", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryWriter; } });
53
53
  Object.defineProperty(exports, "BinaryReader", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryReader; } });
54
- var json_format_js_1 = require("./json-format.js");
55
- var descriptor_set_js_1 = require("./descriptor-set.js");
56
54
  var create_descriptor_set_js_1 = require("./create-descriptor-set.js");
57
55
  Object.defineProperty(exports, "createDescriptorSet", { enumerable: true, get: function () { return create_descriptor_set_js_1.createDescriptorSet; } });
58
- var type_registry_js_1 = require("./type-registry.js");
59
56
  var create_registry_js_1 = require("./create-registry.js");
60
57
  Object.defineProperty(exports, "createRegistry", { enumerable: true, get: function () { return create_registry_js_1.createRegistry; } });
61
58
  var create_registry_from_desc_js_1 = require("./create-registry-from-desc.js");
@@ -112,14 +112,14 @@ function makeBinaryFormatCommon() {
112
112
  const messageType = field.T;
113
113
  if (repeated) {
114
114
  // safe to assume presence of array, oneof cannot contain repeated values
115
- target[localName].push(messageType.fromBinary(reader.bytes(), options));
115
+ target[localName].push(readMessageField(reader, new messageType(), options));
116
116
  }
117
117
  else {
118
118
  if (target[localName] instanceof message_js_1.Message) {
119
- target[localName].fromBinary(reader.bytes(), options);
119
+ readMessageField(reader, target[localName], options);
120
120
  }
121
121
  else {
122
- target[localName] = messageType.fromBinary(reader.bytes(), options);
122
+ target[localName] = readMessageField(reader, new messageType(), options);
123
123
  if (messageType.fieldWrapper &&
124
124
  !field.oneof &&
125
125
  !field.repeated) {
@@ -139,6 +139,13 @@ function makeBinaryFormatCommon() {
139
139
  };
140
140
  }
141
141
  exports.makeBinaryFormatCommon = makeBinaryFormatCommon;
142
+ // Read a message, avoiding MessageType.fromBinary() to re-use the
143
+ // BinaryReadOptions and the IBinaryReader.
144
+ function readMessageField(reader, message, options) {
145
+ const format = message.getType().runtime.bin;
146
+ format.readMessage(message, reader, reader.uint32(), options);
147
+ return message;
148
+ }
142
149
  // Read a map field, expecting key field = 1, value field = 2
143
150
  function readMapEntry(field, reader, options) {
144
151
  const length = reader.uint32(), end = reader.pos + length;
@@ -158,7 +165,7 @@ function readMapEntry(field, reader, options) {
158
165
  val = reader.int32();
159
166
  break;
160
167
  case "message":
161
- val = field.V.T.fromBinary(reader.bytes(), options);
168
+ val = readMessageField(reader, new field.V.T(), options);
162
169
  break;
163
170
  }
164
171
  break;
@@ -189,9 +196,40 @@ function readMapEntry(field, reader, options) {
189
196
  }
190
197
  return [key, val];
191
198
  }
199
+ // Does not use scalarTypeInfo() for better performance.
192
200
  function readScalar(reader, type) {
193
- let [, method] = (0, scalars_js_1.scalarTypeInfo)(type);
194
- return reader[method]();
201
+ switch (type) {
202
+ case field_js_1.ScalarType.STRING:
203
+ return reader.string();
204
+ case field_js_1.ScalarType.BOOL:
205
+ return reader.bool();
206
+ case field_js_1.ScalarType.DOUBLE:
207
+ return reader.double();
208
+ case field_js_1.ScalarType.FLOAT:
209
+ return reader.float();
210
+ case field_js_1.ScalarType.INT32:
211
+ return reader.int32();
212
+ case field_js_1.ScalarType.INT64:
213
+ return reader.int64();
214
+ case field_js_1.ScalarType.UINT64:
215
+ return reader.uint64();
216
+ case field_js_1.ScalarType.FIXED64:
217
+ return reader.fixed64();
218
+ case field_js_1.ScalarType.BYTES:
219
+ return reader.bytes();
220
+ case field_js_1.ScalarType.FIXED32:
221
+ return reader.fixed32();
222
+ case field_js_1.ScalarType.SFIXED32:
223
+ return reader.sfixed32();
224
+ case field_js_1.ScalarType.SFIXED64:
225
+ return reader.sfixed64();
226
+ case field_js_1.ScalarType.SINT64:
227
+ return reader.sint64();
228
+ case field_js_1.ScalarType.UINT32:
229
+ return reader.uint32();
230
+ case field_js_1.ScalarType.SINT32:
231
+ return reader.sint32();
232
+ }
195
233
  }
196
234
  function writeMapEntry(writer, options, field, key, value) {
197
235
  writer.tag(field.no, binary_encoding_js_1.WireType.LengthDelimited);