protobufjs 8.4.0 → 8.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v8.4.0 (c) 2016, daniel wirtz
3
- * compiled mon, 18 may 2026 17:55:10 utc
2
+ * protobuf.js v8.4.2 (c) 2016, daniel wirtz
3
+ * compiled fri, 22 may 2026 02:44:15 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -104,14 +104,14 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
104
104
  ("m%s=d%s|0", prop, prop);
105
105
  break;
106
106
  case "uint64":
107
+ case "fixed64":
107
108
  isUnsigned = true;
108
109
  // eslint-disable-next-line no-fallthrough
109
110
  case "int64":
110
111
  case "sint64":
111
- case "fixed64":
112
112
  case "sfixed64": gen
113
113
  ("if(util.Long)")
114
- ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)
114
+ ("m%s=util.Long.fromValue(d%s,%j)", prop, prop, isUnsigned)
115
115
  ("else if(typeof d%s===\"string\")", prop)
116
116
  ("m%s=parseInt(d%s,10)", prop, prop)
117
117
  ("else if(typeof d%s===\"number\")", prop)
@@ -236,7 +236,7 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
236
236
  if (field.resolvedType instanceof Enum) gen
237
237
  ("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", dstProp, fieldIndex, srcProp, srcProp, fieldIndex, srcProp, srcProp);
238
238
  else gen
239
- ("d%s=types[%i].toObject(m%s,o)", dstProp, fieldIndex, srcProp);
239
+ ("d%s=types[%i].toObject(m%s,o,q+1)", dstProp, fieldIndex, srcProp);
240
240
  } else {
241
241
  var isUnsigned = false;
242
242
  switch (field.type) {
@@ -245,11 +245,11 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
245
245
  ("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", dstProp, srcProp, srcProp, srcProp);
246
246
  break;
247
247
  case "uint64":
248
+ case "fixed64":
248
249
  isUnsigned = true;
249
250
  // eslint-disable-next-line no-fallthrough
250
251
  case "int64":
251
252
  case "sint64":
252
- case "fixed64":
253
253
  case "sfixed64": gen
254
254
  ("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
255
255
  ("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", dstProp, srcProp, srcProp, srcProp, srcProp, isUnsigned)
@@ -280,9 +280,12 @@ converter.toObject = function toObject(mtype) {
280
280
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
281
281
  if (!fields.length)
282
282
  return util.codegen()("return {}");
283
- var gen = util.codegen(["m", "o"], mtype.name + "$toObject")
283
+ var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
284
284
  ("if(!o)")
285
285
  ("o={}")
286
+ ("if(q===undefined)q=0")
287
+ ("if(q>util.recursionLimit)")
288
+ ("throw Error(\"max depth exceeded\")")
286
289
  ("var d={}");
287
290
 
288
291
  var repeatedFields = [],
@@ -368,7 +371,7 @@ converter.toObject = function toObject(mtype) {
368
371
  } else { gen
369
372
  ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
370
373
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
371
- if (field.partOf) gen
374
+ if (field.partOf && !field.partOf.isProto3Optional) gen
372
375
  ("if(o.oneofs)")
373
376
  ("d%s=%j", util.safeProp(field.partOf.name), field.name);
374
377
  }
@@ -446,7 +449,9 @@ function decoder(mtype) {
446
449
  else gen
447
450
  ("k=null");
448
451
 
449
- if (types.defaults[type] !== undefined) gen
452
+ if (types.long[type] !== undefined) gen
453
+ ("v=util.Long?util.Long.fromNumber(0,%j):0", type === "uint64" || type === "fixed64");
454
+ else if (types.defaults[type] !== undefined) gen
450
455
  ("v=%j", types.defaults[type]);
451
456
  else gen
452
457
  ("v=null");
@@ -605,8 +610,8 @@ var Enum = require(5),
605
610
  */
606
611
  function genTypePartial(gen, field, fieldIndex, ref) {
607
612
  return field.delimited
608
- ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
609
- : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
613
+ ? gen("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
614
+ : gen("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
610
615
  }
611
616
 
612
617
  /**
@@ -616,9 +621,12 @@ function genTypePartial(gen, field, fieldIndex, ref) {
616
621
  */
617
622
  function encoder(mtype) {
618
623
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
619
- var gen = util.codegen(["m", "w"], mtype.name + "$encode")
624
+ var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
620
625
  ("if(!w)")
621
- ("w=Writer.create()");
626
+ ("w=Writer.create()")
627
+ ("if(q===undefined)q=0")
628
+ ("if(q>util.recursionLimit)")
629
+ ("throw Error(\"max depth exceeded\")");
622
630
 
623
631
  var i, ref;
624
632
 
@@ -644,7 +652,7 @@ function encoder(mtype) {
644
652
  else gen
645
653
  ("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
646
654
  if (wireType === undefined) gen
647
- ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups
655
+ ("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()", index, ref); // can't be groups
648
656
  else gen
649
657
  (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);
650
658
  gen
@@ -785,8 +793,8 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
785
793
  ReflectionObject.prototype._resolveFeatures.call(this, edition);
786
794
 
787
795
  Object.keys(this.values).forEach(key => {
788
- var parentFeaturesCopy = Object.assign({}, this._features);
789
- this._valuesFeatures[key] = Object.assign(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features);
796
+ var parentFeaturesCopy = util.merge({}, this._features);
797
+ this._valuesFeatures[key] = util.merge(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features || {});
790
798
  });
791
799
 
792
800
  return this;
@@ -943,7 +951,7 @@ var Enum = require(5),
943
951
 
944
952
  var Type; // cyclic
945
953
 
946
- var ruleRe = /^required|optional|repeated$/;
954
+ var ruleRe = /^(?:required|optional|repeated)$/;
947
955
 
948
956
  /**
949
957
  * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.
@@ -1018,9 +1026,6 @@ function Field(name, id, type, rule, extend, options, comment) {
1018
1026
  * Field rule, if any.
1019
1027
  * @type {string|undefined}
1020
1028
  */
1021
- if (rule === "proto3_optional") {
1022
- rule = "optional";
1023
- }
1024
1029
  this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON
1025
1030
 
1026
1031
  /**
@@ -1262,7 +1267,7 @@ Field.prototype.resolve = function resolve() {
1262
1267
 
1263
1268
  // convert to internal data type if necesssary
1264
1269
  if (this.long) {
1265
- this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u");
1270
+ this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type === "uint64" || this.type === "fixed64");
1266
1271
 
1267
1272
  /* istanbul ignore else */
1268
1273
  if (Object.freeze)
@@ -1492,7 +1497,7 @@ protobuf.util = require(24);
1492
1497
  // Set up possibly cyclic reflection dependencies
1493
1498
  protobuf.ReflectionObject._configure(protobuf.Root);
1494
1499
  protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
1495
- protobuf.Root._configure(protobuf.Type);
1500
+ protobuf.Root._configure(protobuf.Type, undefined, {});
1496
1501
  protobuf.Field._configure(protobuf.Type);
1497
1502
 
1498
1503
  },{"10":10,"11":11,"12":12,"13":13,"14":14,"17":17,"2":2,"21":21,"22":22,"23":23,"24":24,"3":3,"39":39,"4":4,"40":40,"5":5,"6":6,"8":8,"9":9}],8:[function(require,module,exports){
@@ -1701,7 +1706,7 @@ function Message(properties) {
1701
1706
  /**
1702
1707
  * Creates a new message of this type using the specified properties.
1703
1708
  * @param {Object.<string,*>} [properties] Properties to set
1704
- * @returns {Message<T>} Message instance
1709
+ * @returns {T} Message instance
1705
1710
  * @template T extends Message<T>
1706
1711
  * @this Constructor<T>
1707
1712
  */
@@ -2035,7 +2040,7 @@ Namespace.arrayToJSON = arrayToJSON;
2035
2040
  Namespace.isReservedId = function isReservedId(reserved, id) {
2036
2041
  if (reserved)
2037
2042
  for (var i = 0; i < reserved.length; ++i)
2038
- if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id)
2043
+ if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] >= id)
2039
2044
  return true;
2040
2045
  return false;
2041
2046
  };
@@ -2747,7 +2752,7 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
2747
2752
  throw new Error("Unknown edition for " + this.fullName);
2748
2753
  }
2749
2754
 
2750
- var protoFeatures = Object.assign(this.options ? Object.assign({}, this.options.features) : {},
2755
+ var protoFeatures = util.merge({}, this.options && this.options.features,
2751
2756
  this._inferLegacyProtoFeatures(edition));
2752
2757
 
2753
2758
  if (this._edition) {
@@ -2764,19 +2769,19 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
2764
2769
  } else {
2765
2770
  throw new Error("Unknown edition: " + edition);
2766
2771
  }
2767
- this._features = Object.assign(defaults, protoFeatures || {});
2772
+ this._features = util.merge(defaults, protoFeatures);
2768
2773
  } else {
2769
2774
  // fields in Oneofs aren't actually children of them, so we have to
2770
2775
  // special-case it
2771
2776
  /* istanbul ignore else */
2772
2777
  if (this.partOf instanceof OneOf) {
2773
- var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features);
2774
- this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {});
2778
+ var lexicalParentFeaturesCopy = util.merge({}, this.partOf._features);
2779
+ this._features = util.merge(lexicalParentFeaturesCopy, protoFeatures);
2775
2780
  } else if (this.declaringField) {
2776
2781
  // Skip feature resolution of sister fields.
2777
2782
  } else if (this.parent) {
2778
- var parentFeaturesCopy = Object.assign({}, this.parent._features);
2779
- this._features = Object.assign(parentFeaturesCopy, protoFeatures || {});
2783
+ var parentFeaturesCopy = util.merge({}, this.parent._features);
2784
+ this._features = util.merge(parentFeaturesCopy, protoFeatures);
2780
2785
  } else {
2781
2786
  throw new Error("Unable to find a parent for " + this.fullName);
2782
2787
  }
@@ -3894,8 +3899,12 @@ Root.prototype.load = function load(filename, options, callback) {
3894
3899
  }
3895
3900
 
3896
3901
  // Processes a single file
3897
- function process(filename, source) {
3902
+ function process(filename, source, depth) {
3903
+ if (depth === undefined)
3904
+ depth = 0;
3898
3905
  try {
3906
+ if (depth > util.recursionLimit)
3907
+ throw Error("max depth exceeded");
3899
3908
  if (util.isString(source) && source.charAt(0) === "{")
3900
3909
  source = JSON.parse(source);
3901
3910
  if (!util.isString(source))
@@ -3908,11 +3917,11 @@ Root.prototype.load = function load(filename, options, callback) {
3908
3917
  if (parsed.imports)
3909
3918
  for (; i < parsed.imports.length; ++i)
3910
3919
  if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))
3911
- fetch(resolved);
3920
+ fetch(resolved, false, depth + 1);
3912
3921
  if (parsed.weakImports)
3913
3922
  for (i = 0; i < parsed.weakImports.length; ++i)
3914
3923
  if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))
3915
- fetch(resolved, true);
3924
+ fetch(resolved, true, depth + 1);
3916
3925
  }
3917
3926
  } catch (err) {
3918
3927
  finish(err);
@@ -3923,7 +3932,9 @@ Root.prototype.load = function load(filename, options, callback) {
3923
3932
  }
3924
3933
 
3925
3934
  // Fetches a single file
3926
- function fetch(filename, weak) {
3935
+ function fetch(filename, weak, depth) {
3936
+ if (depth === undefined)
3937
+ depth = 0;
3927
3938
  filename = getBundledFileName(filename) || filename;
3928
3939
 
3929
3940
  // Skip if already loaded / attempted
@@ -3935,12 +3946,12 @@ Root.prototype.load = function load(filename, options, callback) {
3935
3946
  // Shortcut bundled definitions
3936
3947
  if (Object.prototype.hasOwnProperty.call(common, filename)) {
3937
3948
  if (sync) {
3938
- process(filename, common[filename]);
3949
+ process(filename, common[filename], depth);
3939
3950
  } else {
3940
3951
  ++queued;
3941
3952
  setTimeout(function() {
3942
3953
  --queued;
3943
- process(filename, common[filename]);
3954
+ process(filename, common[filename], depth);
3944
3955
  });
3945
3956
  }
3946
3957
  return;
@@ -3956,7 +3967,7 @@ Root.prototype.load = function load(filename, options, callback) {
3956
3967
  finish(err);
3957
3968
  return;
3958
3969
  }
3959
- process(filename, source);
3970
+ process(filename, source, depth);
3960
3971
  } else {
3961
3972
  ++queued;
3962
3973
  self.fetch(filename, function(err, source) {
@@ -3973,7 +3984,7 @@ Root.prototype.load = function load(filename, options, callback) {
3973
3984
  finish(null, self);
3974
3985
  return;
3975
3986
  }
3976
- process(filename, source);
3987
+ process(filename, source, depth);
3977
3988
  });
3978
3989
  }
3979
3990
  }
@@ -5026,7 +5037,7 @@ Type.prototype.isReservedName = function isReservedName(name) {
5026
5037
  /**
5027
5038
  * Creates a new message of this type using the specified properties.
5028
5039
  * @param {Object.<string,*>} [properties] Properties to set
5029
- * @returns {Message<{}>} Message instance
5040
+ * @returns {ReflectedMessage} Message instance
5030
5041
  */
5031
5042
  Type.prototype.create = function create(properties) {
5032
5043
  return new this.ctor(properties);
@@ -5092,8 +5103,8 @@ Type.prototype.setup = function setup() {
5092
5103
  * @param {Writer} [writer] Writer to encode to
5093
5104
  * @returns {Writer} writer
5094
5105
  */
5095
- Type.prototype.encode = function encode_setup(message, writer) {
5096
- return this.setup().encode(message, writer); // overrides this method
5106
+ Type.prototype.encode = function encode_setup(message, writer) { // eslint-disable-line no-unused-vars
5107
+ return this.setup().encode.apply(this, arguments); // overrides this method
5097
5108
  };
5098
5109
 
5099
5110
  /**
@@ -5110,7 +5121,7 @@ Type.prototype.encodeDelimited = function encodeDelimited(message, writer) {
5110
5121
  * Decodes a message of this type.
5111
5122
  * @param {Reader|Uint8Array} reader Reader or buffer to decode from
5112
5123
  * @param {number} [length] Length of the message, if known beforehand
5113
- * @returns {Message<{}>} Decoded message
5124
+ * @returns {ReflectedMessage} Decoded message
5114
5125
  * @throws {Error} If the payload is not a reader or valid buffer
5115
5126
  * @throws {util.ProtocolError<{}>} If required fields are missing
5116
5127
  */
@@ -5121,7 +5132,7 @@ Type.prototype.decode = function decode_setup(reader, length) { // eslint-disabl
5121
5132
  /**
5122
5133
  * Decodes a message of this type preceeded by its byte length as a varint.
5123
5134
  * @param {Reader|Uint8Array} reader Reader or buffer to decode from
5124
- * @returns {Message<{}>} Decoded message
5135
+ * @returns {ReflectedMessage} Decoded message
5125
5136
  * @throws {Error} If the payload is not a reader or valid buffer
5126
5137
  * @throws {util.ProtocolError} If required fields are missing
5127
5138
  */
@@ -5143,7 +5154,7 @@ Type.prototype.verify = function verify_setup(message) { // eslint-disable-line
5143
5154
  /**
5144
5155
  * Creates a new message of this type from a plain object. Also converts values to their respective internal types.
5145
5156
  * @param {Object.<string,*>} object Plain object to convert
5146
- * @returns {Message<{}>} Message instance
5157
+ * @returns {ReflectedMessage} Message instance
5147
5158
  */
5148
5159
  Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line no-unused-vars
5149
5160
  return this.setup().fromObject.apply(this, arguments);
@@ -5174,8 +5185,8 @@ Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line
5174
5185
  * @param {IConversionOptions} [options] Conversion options
5175
5186
  * @returns {Object.<string,*>} Plain object
5176
5187
  */
5177
- Type.prototype.toObject = function toObject(message, options) {
5178
- return this.setup().toObject(message, options);
5188
+ Type.prototype.toObject = function toObject(message, options) { // eslint-disable-line no-unused-vars
5189
+ return this.setup().toObject.apply(this, arguments);
5179
5190
  };
5180
5191
 
5181
5192
  /**
@@ -5430,8 +5441,7 @@ util.fetch = require(29);
5430
5441
  util.path = require(35);
5431
5442
  util.patterns = require(36);
5432
5443
 
5433
- var reservedRe = util.patterns.reservedRe,
5434
- unsafePropertyRe = util.patterns.unsafePropertyRe;
5444
+ var reservedRe = util.patterns.reservedRe;
5435
5445
 
5436
5446
  /**
5437
5447
  * Node's fs module if available.
@@ -5594,7 +5604,7 @@ util.decorateEnum = function decorateEnum(object) {
5594
5604
  util.setProperty = function setProperty(dst, path, value, ifNotSet) {
5595
5605
  function setProp(dst, path, value) {
5596
5606
  var part = path.shift();
5597
- if (unsafePropertyRe.test(part))
5607
+ if (util.isUnsafeProperty(part))
5598
5608
  return dst;
5599
5609
  if (path.length > 0) {
5600
5610
  dst[part] = setProp(dst[part] || {}, path, value);
@@ -5967,7 +5977,7 @@ function EventEmitter() {
5967
5977
  * @type {Object.<string,*>}
5968
5978
  * @private
5969
5979
  */
5970
- this._listeners = {};
5980
+ this._listeners = Object.create(null);
5971
5981
  }
5972
5982
 
5973
5983
  /**
@@ -6001,12 +6011,14 @@ EventEmitter.prototype.on = function on(evt, fn, ctx) {
6001
6011
  */
6002
6012
  EventEmitter.prototype.off = function off(evt, fn) {
6003
6013
  if (evt === undefined)
6004
- this._listeners = {};
6014
+ this._listeners = Object.create(null);
6005
6015
  else {
6006
6016
  if (fn === undefined)
6007
6017
  this._listeners[evt] = [];
6008
6018
  else {
6009
6019
  var listeners = this._listeners[evt];
6020
+ if (!listeners)
6021
+ return this;
6010
6022
  for (var i = 0; i < listeners.length;)
6011
6023
  if (listeners[i].fn === fn)
6012
6024
  listeners.splice(i, 1);
@@ -6770,6 +6782,18 @@ util.pool = require(37);
6770
6782
  // utility to work with the low and high bits of a 64 bit value
6771
6783
  util.LongBits = require(33);
6772
6784
 
6785
+ /**
6786
+ * Tests if the specified key can affect object prototypes.
6787
+ * @memberof util
6788
+ * @param {string} key Key to test
6789
+ * @returns {boolean} `true` if the key is unsafe
6790
+ */
6791
+ function isUnsafeProperty(key) {
6792
+ return key === "__proto__" || key === "prototype" || key === "constructor";
6793
+ }
6794
+
6795
+ util.isUnsafeProperty = isUnsafeProperty;
6796
+
6773
6797
  /**
6774
6798
  * Whether running within node or not.
6775
6799
  * @memberof util
@@ -7004,15 +7028,21 @@ util.boolFromKey = function boolFromKey(key) {
7004
7028
  * Merges the properties of the source object into the destination object.
7005
7029
  * @memberof util
7006
7030
  * @param {Object.<string,*>} dst Destination object
7007
- * @param {Object.<string,*>} src Source object
7008
- * @param {boolean} [ifNotSet=false] Merges only if the key is not already set
7031
+ * @param {...(Object.<string,*>|boolean)} src Source objects, optionally followed by an `ifNotSet` flag
7009
7032
  * @returns {Object.<string,*>} Destination object
7010
7033
  */
7011
- function merge(dst, src, ifNotSet) { // used by converters
7012
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
7013
- if (dst[keys[i]] === undefined || !ifNotSet)
7014
- if (keys[i] !== "__proto__")
7034
+ function merge(dst) { // used by converters
7035
+ var ifNotSet = typeof arguments[arguments.length - 1] === "boolean",
7036
+ limit = ifNotSet ? arguments.length - 1 : arguments.length;
7037
+ ifNotSet = ifNotSet && arguments[arguments.length - 1];
7038
+ for (var a = 1; a < limit; ++a) {
7039
+ var src = arguments[a];
7040
+ if (!src)
7041
+ continue;
7042
+ for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
7043
+ if (!isUnsafeProperty(keys[i]) && (dst[keys[i]] === undefined || !ifNotSet))
7015
7044
  dst[keys[i]] = src[keys[i]];
7045
+ }
7016
7046
  return dst;
7017
7047
  }
7018
7048
 
@@ -7326,7 +7356,6 @@ var patterns = exports;
7326
7356
  patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
7327
7357
  patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
7328
7358
  patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
7329
- patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
7330
7359
 
7331
7360
  },{}],37:[function(require,module,exports){
7332
7361
  "use strict";
@@ -7702,7 +7731,8 @@ function verifier(mtype) {
7702
7731
  */
7703
7732
  var wrappers = exports;
7704
7733
 
7705
- var Message = require(10);
7734
+ var Message = require(10),
7735
+ util = require(34);
7706
7736
 
7707
7737
  /**
7708
7738
  * From object converter part of an {@link IWrapper}.
@@ -7749,10 +7779,9 @@ wrappers[".google.protobuf.Any"] = {
7749
7779
  if (type_url.indexOf("/") === -1) {
7750
7780
  type_url = "/" + type_url;
7751
7781
  }
7752
- var nextDepth = depth === undefined ? 1 : depth + 1;
7753
7782
  return this.create({
7754
7783
  type_url: type_url,
7755
- value: type.encode(type.fromObject(object, nextDepth)).finish()
7784
+ value: type.encode(type.fromObject(object, depth === undefined ? 1 : depth + 1)).finish()
7756
7785
  });
7757
7786
  }
7758
7787
  }
@@ -7760,13 +7789,16 @@ wrappers[".google.protobuf.Any"] = {
7760
7789
  return this.fromObject(object, depth);
7761
7790
  },
7762
7791
 
7763
- toObject: function(message, options) {
7792
+ toObject: function(message, options, depth) {
7793
+ if (depth === undefined)
7794
+ depth = 0;
7795
+ if (depth > util.recursionLimit)
7796
+ throw Error("max depth exceeded");
7764
7797
 
7765
7798
  // Default prefix
7766
7799
  var googleApi = "type.googleapis.com/";
7767
7800
  var prefix = "";
7768
7801
  var name = "";
7769
-
7770
7802
  // decode value if requested and unmapped
7771
7803
  if (options && options.json && message.type_url && message.value) {
7772
7804
  // Only use fully qualified type name after the last '/'
@@ -7776,12 +7808,12 @@ wrappers[".google.protobuf.Any"] = {
7776
7808
  var type = this.lookup(name);
7777
7809
  /* istanbul ignore else */
7778
7810
  if (type)
7779
- message = type.decode(message.value);
7811
+ message = type.decode(message.value, undefined, undefined, depth + 1);
7780
7812
  }
7781
7813
 
7782
7814
  // wrap value if unmapped
7783
7815
  if (!(message instanceof this.ctor) && message instanceof Message) {
7784
- var object = message.$type.toObject(message, options);
7816
+ var object = message.$type.toObject(message, options, depth + 1);
7785
7817
  var messageName = message.$type.fullName[0] === "." ?
7786
7818
  message.$type.fullName.slice(1) : message.$type.fullName;
7787
7819
  // Default to type.googleapis.com prefix if no prefix is used
@@ -7793,11 +7825,11 @@ wrappers[".google.protobuf.Any"] = {
7793
7825
  return object;
7794
7826
  }
7795
7827
 
7796
- return this.toObject(message, options);
7828
+ return this.toObject(message, options, depth);
7797
7829
  }
7798
7830
  };
7799
7831
 
7800
- },{"10":10}],41:[function(require,module,exports){
7832
+ },{"10":10,"34":34}],41:[function(require,module,exports){
7801
7833
  "use strict";
7802
7834
  module.exports = Writer;
7803
7835
 
@@ -8030,7 +8062,7 @@ Writer.prototype.uint32 = function write_uint32(value) {
8030
8062
  * @returns {Writer} `this`
8031
8063
  */
8032
8064
  Writer.prototype.int32 = function write_int32(value) {
8033
- return value < 0
8065
+ return (value |= 0) < 0
8034
8066
  ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
8035
8067
  : this.uint32(value);
8036
8068
  };
@@ -8045,16 +8077,18 @@ Writer.prototype.sint32 = function write_sint32(value) {
8045
8077
  };
8046
8078
 
8047
8079
  function writeVarint64(val, buf, pos) {
8048
- while (val.hi) {
8049
- buf[pos++] = val.lo & 127 | 128;
8050
- val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
8051
- val.hi >>>= 7;
8052
- }
8053
- while (val.lo > 127) {
8054
- buf[pos++] = val.lo & 127 | 128;
8055
- val.lo = val.lo >>> 7;
8056
- }
8057
- buf[pos++] = val.lo;
8080
+ var lo = val.lo,
8081
+ hi = val.hi;
8082
+ while (hi) {
8083
+ buf[pos++] = lo & 127 | 128;
8084
+ lo = (lo >>> 7 | hi << 25) >>> 0;
8085
+ hi >>>= 7;
8086
+ }
8087
+ while (lo > 127) {
8088
+ buf[pos++] = lo & 127 | 128;
8089
+ lo = lo >>> 7;
8090
+ }
8091
+ buf[pos++] = lo;
8058
8092
  }
8059
8093
 
8060
8094
  /**