protobufjs 8.7.0 → 8.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/protobuf.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v8.7.0 (c) 2016, daniel wirtz
3
- * compiled mon, 06 jul 2026 13:50:00 utc
2
+ * protobuf.js v8.7.1 (c) 2016, daniel wirtz
3
+ * compiled mon, 13 jul 2026 11:04:12 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -205,27 +205,33 @@ common("struct", {
205
205
  fields: {
206
206
  nullValue: {
207
207
  type: "NullValue",
208
- id: 1
208
+ id: 1,
209
+ protoName: "null_value"
209
210
  },
210
211
  numberValue: {
211
212
  type: "double",
212
- id: 2
213
+ id: 2,
214
+ protoName: "number_value"
213
215
  },
214
216
  stringValue: {
215
217
  type: "string",
216
- id: 3
218
+ id: 3,
219
+ protoName: "string_value"
217
220
  },
218
221
  boolValue: {
219
222
  type: "bool",
220
- id: 4
223
+ id: 4,
224
+ protoName: "bool_value"
221
225
  },
222
226
  structValue: {
223
227
  type: "Struct",
224
- id: 5
228
+ id: 5,
229
+ protoName: "struct_value"
225
230
  },
226
231
  listValue: {
227
232
  type: "ListValue",
228
- id: 6
233
+ id: 6,
234
+ protoName: "list_value"
229
235
  }
230
236
  }
231
237
  },
@@ -741,7 +747,7 @@ converter.toObject = function toObject(mtype) {
741
747
  else if (field.bytes) {
742
748
  var arrayDefault = Array.prototype.slice.call(field.typeDefault);
743
749
  gen
744
- ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault))
750
+ ("if(o.bytes===String)d%s=%j", prop, util.base64.encode(field.typeDefault, 0, field.typeDefault.length))
745
751
  ("else{")
746
752
  ("d%s=%j", prop, arrayDefault)
747
753
  ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop)
@@ -899,7 +905,7 @@ function decoder(mtype) {
899
905
  ("break");
900
906
 
901
907
  if (types.basic[type] === undefined) gen
902
- ("v=types[%i].decode(r,r.uint32(),undefined,q+1)", i); // can't be groups
908
+ ("v=types[%i].decode(r,r.uint32(),undefined,q+1,v)", i); // can't be groups
903
909
  else gen
904
910
  ("v=r.%s()", type === "string" ? stringMethod(field) : type);
905
911
 
@@ -2083,6 +2089,7 @@ exports.configure = configure;
2083
2089
  * @returns {undefined}
2084
2090
  */
2085
2091
  function configure() {
2092
+ exports.util.LongBits._configure(exports.util.Long);
2086
2093
  exports.Writer._configure(exports.BufferWriter);
2087
2094
  exports.Reader._configure(exports.BufferReader);
2088
2095
  }
@@ -4341,6 +4348,10 @@ function parse(source, root, options) {
4341
4348
  case ";":
4342
4349
  break;
4343
4350
 
4351
+ case "map":
4352
+ parseMapField(type);
4353
+ break;
4354
+
4344
4355
  case "option":
4345
4356
  parseOption(type, token);
4346
4357
  skip(";");
@@ -4470,7 +4481,8 @@ function parse(source, root, options) {
4470
4481
  if ((token = next()) === null || !nameRe.test(token))
4471
4482
  throw illegal(token, "name");
4472
4483
 
4473
- var enm = new Enum(token);
4484
+ var enm = new Enum(token),
4485
+ values = [];
4474
4486
  ifBlock(enm, function parseEnum_block(token) {
4475
4487
  switch(token) {
4476
4488
  case ";":
@@ -4487,16 +4499,18 @@ function parse(source, root, options) {
4487
4499
  break;
4488
4500
 
4489
4501
  default:
4490
- parseEnumValue(enm, token);
4502
+ values.push(parseEnumValue(token));
4491
4503
  }
4492
4504
  });
4505
+ for (var i = 0; i < values.length; ++i)
4506
+ enm.add(values[i].name, values[i].id, values[i].comment, values[i].options);
4493
4507
  parent.add(enm);
4494
4508
  if (parent === ptr) {
4495
4509
  topLevelObjects.push(enm);
4496
4510
  }
4497
4511
  }
4498
4512
 
4499
- function parseEnumValue(parent, token) {
4513
+ function parseEnumValue(token) {
4500
4514
 
4501
4515
  /* istanbul ignore if */
4502
4516
  if (!nameRe.test(token))
@@ -4528,7 +4542,12 @@ function parse(source, root, options) {
4528
4542
  }, function parseEnumValue_line() {
4529
4543
  parseInlineOptions(dummy); // skip
4530
4544
  });
4531
- parent.add(token, value, dummy.comment, dummy.parsedOptions || dummy.options);
4545
+ return {
4546
+ name: token,
4547
+ id: value,
4548
+ comment: dummy.comment,
4549
+ options: dummy.parsedOptions || dummy.options
4550
+ };
4532
4551
  }
4533
4552
 
4534
4553
  function parseOption(parent, token) {
@@ -4579,16 +4598,27 @@ function parse(source, root, options) {
4579
4598
  var objectResult = {};
4580
4599
 
4581
4600
  while (!skip("}", true)) {
4582
- /* istanbul ignore if */
4583
- if (!nameRe.test(token = next())) {
4584
- throw illegal(token, "name");
4585
- }
4586
- if (token === null) {
4587
- throw illegal(token, "end of input");
4601
+ token = next();
4602
+ var propName;
4603
+ if (token === null)
4604
+ throw illegal(token, "end of input");
4605
+ if (token === "[") {
4606
+ token = next();
4607
+ // Extension name or, for Any, a type URL: "<prefix>/<fully.qualified.Type>".
4608
+ var slash = token === null ? -1 : token.lastIndexOf("/");
4609
+ if (token === null || !typeRefRe.test(slash < 0 ? token : token.slice(slash + 1)))
4610
+ throw illegal(token, "name");
4611
+ propName = "[" + token + "]";
4612
+ skip("]");
4613
+ } else {
4614
+ /* istanbul ignore if */
4615
+ if (!nameRe.test(token)) {
4616
+ throw illegal(token, "name");
4617
+ }
4618
+ propName = token;
4588
4619
  }
4589
4620
 
4590
4621
  var value;
4591
- var propName = token;
4592
4622
 
4593
4623
  skip(":", true);
4594
4624
 
@@ -4596,25 +4626,30 @@ function parse(source, root, options) {
4596
4626
  // option (my_option) = {
4597
4627
  // repeated_value: [ "foo", "bar" ]
4598
4628
  // };
4599
- value = parseOptionValue(parent, name + "." + token, depth + 1);
4629
+ value = parseOptionValue(parent, name + "." + propName, depth + 1);
4600
4630
  } else if (peek() === "[") {
4601
4631
  value = [];
4602
- var lastValue;
4632
+ var lastValue,
4633
+ lastValueIsAggregate;
4603
4634
  if (skip("[", true)) {
4604
4635
  if (!skip("]", true)) {
4605
4636
  do {
4606
- lastValue = readValue(true);
4637
+ lastValueIsAggregate = peek() === "{";
4638
+ lastValue = lastValueIsAggregate
4639
+ ? parseOptionValue(parent, name + "." + propName, depth + 1)
4640
+ : readValue(true);
4607
4641
  value.push(lastValue);
4608
4642
  } while (skip(",", true));
4609
4643
  skip("]");
4610
4644
  if (typeof lastValue !== "undefined") {
4611
- setOption(parent, name + "." + token, lastValue);
4645
+ if (!lastValueIsAggregate)
4646
+ setOption(parent, name + "." + propName, lastValue);
4612
4647
  }
4613
4648
  }
4614
4649
  }
4615
4650
  } else {
4616
4651
  value = readValue(true);
4617
- setOption(parent, name + "." + token, value);
4652
+ setOption(parent, name + "." + propName, value);
4618
4653
  }
4619
4654
 
4620
4655
  var prevValue = Object.prototype.hasOwnProperty.call(objectResult, propName)
@@ -9025,7 +9060,7 @@ module.exports = fs;
9025
9060
  "use strict";
9026
9061
  module.exports = LongBits;
9027
9062
 
9028
- var util = require(37);
9063
+ var Long;
9029
9064
 
9030
9065
  /**
9031
9066
  * Constructs new long bits.
@@ -9104,10 +9139,10 @@ LongBits.fromNumber = function fromNumber(value) {
9104
9139
  LongBits.from = function from(value) {
9105
9140
  if (typeof value === "number")
9106
9141
  return LongBits.fromNumber(value);
9107
- if (util.isString(value)) {
9142
+ if (typeof value === "string" || value instanceof String) {
9108
9143
  /* istanbul ignore else */
9109
- if (util.Long)
9110
- value = util.Long.fromString(value);
9144
+ if (Long)
9145
+ value = Long.fromString(value);
9111
9146
  else
9112
9147
  return LongBits.fromNumber(parseInt(value, 10));
9113
9148
  }
@@ -9136,8 +9171,8 @@ LongBits.prototype.toNumber = function toNumber(unsigned) {
9136
9171
  * @returns {Long} Long
9137
9172
  */
9138
9173
  LongBits.prototype.toLong = function toLong(unsigned) {
9139
- return util.Long
9140
- ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
9174
+ return Long
9175
+ ? new Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
9141
9176
  /* istanbul ignore next */
9142
9177
  : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
9143
9178
  };
@@ -9223,7 +9258,11 @@ LongBits.prototype.length = function length() {
9223
9258
  : part2 < 128 ? 9 : 10;
9224
9259
  };
9225
9260
 
9226
- },{"37":37}],37:[function(require,module,exports){
9261
+ LongBits._configure = function(Long_) {
9262
+ Long = Long_;
9263
+ };
9264
+
9265
+ },{}],37:[function(require,module,exports){
9227
9266
  "use strict";
9228
9267
  /* global globalThis */
9229
9268
  var util = exports;