protobufjs 8.4.0 → 8.4.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.4.0 (c) 2016, daniel wirtz
3
- * compiled mon, 18 may 2026 17:55:10 utc
2
+ * protobuf.js v8.4.1 (c) 2016, daniel wirtz
3
+ * compiled thu, 21 may 2026 18:52:08 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -505,14 +505,14 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
505
505
  ("m%s=d%s|0", prop, prop);
506
506
  break;
507
507
  case "uint64":
508
+ case "fixed64":
508
509
  isUnsigned = true;
509
510
  // eslint-disable-next-line no-fallthrough
510
511
  case "int64":
511
512
  case "sint64":
512
- case "fixed64":
513
513
  case "sfixed64": gen
514
514
  ("if(util.Long)")
515
- ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)
515
+ ("m%s=util.Long.fromValue(d%s,%j)", prop, prop, isUnsigned)
516
516
  ("else if(typeof d%s===\"string\")", prop)
517
517
  ("m%s=parseInt(d%s,10)", prop, prop)
518
518
  ("else if(typeof d%s===\"number\")", prop)
@@ -637,7 +637,7 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
637
637
  if (field.resolvedType instanceof Enum) gen
638
638
  ("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);
639
639
  else gen
640
- ("d%s=types[%i].toObject(m%s,o)", dstProp, fieldIndex, srcProp);
640
+ ("d%s=types[%i].toObject(m%s,o,q+1)", dstProp, fieldIndex, srcProp);
641
641
  } else {
642
642
  var isUnsigned = false;
643
643
  switch (field.type) {
@@ -646,11 +646,11 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
646
646
  ("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", dstProp, srcProp, srcProp, srcProp);
647
647
  break;
648
648
  case "uint64":
649
+ case "fixed64":
649
650
  isUnsigned = true;
650
651
  // eslint-disable-next-line no-fallthrough
651
652
  case "int64":
652
653
  case "sint64":
653
- case "fixed64":
654
654
  case "sfixed64": gen
655
655
  ("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
656
656
  ("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)
@@ -681,9 +681,12 @@ converter.toObject = function toObject(mtype) {
681
681
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
682
682
  if (!fields.length)
683
683
  return util.codegen()("return {}");
684
- var gen = util.codegen(["m", "o"], mtype.name + "$toObject")
684
+ var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
685
685
  ("if(!o)")
686
686
  ("o={}")
687
+ ("if(q===undefined)q=0")
688
+ ("if(q>util.recursionLimit)")
689
+ ("throw Error(\"max depth exceeded\")")
687
690
  ("var d={}");
688
691
 
689
692
  var repeatedFields = [],
@@ -769,7 +772,7 @@ converter.toObject = function toObject(mtype) {
769
772
  } else { gen
770
773
  ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
771
774
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
772
- if (field.partOf) gen
775
+ if (field.partOf && !field.partOf.isProto3Optional) gen
773
776
  ("if(o.oneofs)")
774
777
  ("d%s=%j", util.safeProp(field.partOf.name), field.name);
775
778
  }
@@ -847,7 +850,9 @@ function decoder(mtype) {
847
850
  else gen
848
851
  ("k=null");
849
852
 
850
- if (types.defaults[type] !== undefined) gen
853
+ if (types.long[type] !== undefined) gen
854
+ ("v=util.Long?util.Long.fromNumber(0,%j):0", type === "uint64" || type === "fixed64");
855
+ else if (types.defaults[type] !== undefined) gen
851
856
  ("v=%j", types.defaults[type]);
852
857
  else gen
853
858
  ("v=null");
@@ -1006,8 +1011,8 @@ var Enum = require(6),
1006
1011
  */
1007
1012
  function genTypePartial(gen, field, fieldIndex, ref) {
1008
1013
  return field.delimited
1009
- ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
1010
- : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
1014
+ ? gen("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
1015
+ : gen("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
1011
1016
  }
1012
1017
 
1013
1018
  /**
@@ -1017,9 +1022,12 @@ function genTypePartial(gen, field, fieldIndex, ref) {
1017
1022
  */
1018
1023
  function encoder(mtype) {
1019
1024
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
1020
- var gen = util.codegen(["m", "w"], mtype.name + "$encode")
1025
+ var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
1021
1026
  ("if(!w)")
1022
- ("w=Writer.create()");
1027
+ ("w=Writer.create()")
1028
+ ("if(q===undefined)q=0")
1029
+ ("if(q>util.recursionLimit)")
1030
+ ("throw Error(\"max depth exceeded\")");
1023
1031
 
1024
1032
  var i, ref;
1025
1033
 
@@ -1045,7 +1053,7 @@ function encoder(mtype) {
1045
1053
  else gen
1046
1054
  ("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
1047
1055
  if (wireType === undefined) gen
1048
- ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups
1056
+ ("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()", index, ref); // can't be groups
1049
1057
  else gen
1050
1058
  (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);
1051
1059
  gen
@@ -1186,8 +1194,8 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
1186
1194
  ReflectionObject.prototype._resolveFeatures.call(this, edition);
1187
1195
 
1188
1196
  Object.keys(this.values).forEach(key => {
1189
- var parentFeaturesCopy = Object.assign({}, this._features);
1190
- this._valuesFeatures[key] = Object.assign(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features);
1197
+ var parentFeaturesCopy = util.merge({}, this._features);
1198
+ this._valuesFeatures[key] = util.merge(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features || {});
1191
1199
  });
1192
1200
 
1193
1201
  return this;
@@ -1344,7 +1352,7 @@ var Enum = require(6),
1344
1352
 
1345
1353
  var Type; // cyclic
1346
1354
 
1347
- var ruleRe = /^required|optional|repeated$/;
1355
+ var ruleRe = /^(?:required|optional|repeated)$/;
1348
1356
 
1349
1357
  /**
1350
1358
  * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.
@@ -1419,9 +1427,6 @@ function Field(name, id, type, rule, extend, options, comment) {
1419
1427
  * Field rule, if any.
1420
1428
  * @type {string|undefined}
1421
1429
  */
1422
- if (rule === "proto3_optional") {
1423
- rule = "optional";
1424
- }
1425
1430
  this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON
1426
1431
 
1427
1432
  /**
@@ -1663,7 +1668,7 @@ Field.prototype.resolve = function resolve() {
1663
1668
 
1664
1669
  // convert to internal data type if necesssary
1665
1670
  if (this.long) {
1666
- this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u");
1671
+ this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type === "uint64" || this.type === "fixed64");
1667
1672
 
1668
1673
  /* istanbul ignore else */
1669
1674
  if (Object.freeze)
@@ -1893,7 +1898,7 @@ protobuf.util = require(28);
1893
1898
  // Set up possibly cyclic reflection dependencies
1894
1899
  protobuf.ReflectionObject._configure(protobuf.Root);
1895
1900
  protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
1896
- protobuf.Root._configure(protobuf.Type);
1901
+ protobuf.Root._configure(protobuf.Type, undefined, {});
1897
1902
  protobuf.Field._configure(protobuf.Type);
1898
1903
 
1899
1904
  },{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"24":24,"26":26,"27":27,"28":28,"3":3,"4":4,"43":43,"44":44,"5":5,"6":6,"7":7,"9":9}],9:[function(require,module,exports){
@@ -2116,7 +2121,7 @@ function Message(properties) {
2116
2121
  /**
2117
2122
  * Creates a new message of this type using the specified properties.
2118
2123
  * @param {Object.<string,*>} [properties] Properties to set
2119
- * @returns {Message<T>} Message instance
2124
+ * @returns {T} Message instance
2120
2125
  * @template T extends Message<T>
2121
2126
  * @this Constructor<T>
2122
2127
  */
@@ -3162,7 +3167,7 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
3162
3167
  throw new Error("Unknown edition for " + this.fullName);
3163
3168
  }
3164
3169
 
3165
- var protoFeatures = Object.assign(this.options ? Object.assign({}, this.options.features) : {},
3170
+ var protoFeatures = util.merge({}, this.options && this.options.features,
3166
3171
  this._inferLegacyProtoFeatures(edition));
3167
3172
 
3168
3173
  if (this._edition) {
@@ -3179,19 +3184,19 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
3179
3184
  } else {
3180
3185
  throw new Error("Unknown edition: " + edition);
3181
3186
  }
3182
- this._features = Object.assign(defaults, protoFeatures || {});
3187
+ this._features = util.merge(defaults, protoFeatures);
3183
3188
  } else {
3184
3189
  // fields in Oneofs aren't actually children of them, so we have to
3185
3190
  // special-case it
3186
3191
  /* istanbul ignore else */
3187
3192
  if (this.partOf instanceof OneOf) {
3188
- var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features);
3189
- this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {});
3193
+ var lexicalParentFeaturesCopy = util.merge({}, this.partOf._features);
3194
+ this._features = util.merge(lexicalParentFeaturesCopy, protoFeatures);
3190
3195
  } else if (this.declaringField) {
3191
3196
  // Skip feature resolution of sister fields.
3192
3197
  } else if (this.parent) {
3193
- var parentFeaturesCopy = Object.assign({}, this.parent._features);
3194
- this._features = Object.assign(parentFeaturesCopy, protoFeatures || {});
3198
+ var parentFeaturesCopy = util.merge({}, this.parent._features);
3199
+ this._features = util.merge(parentFeaturesCopy, protoFeatures);
3195
3200
  } else {
3196
3201
  throw new Error("Unable to find a parent for " + this.fullName);
3197
3202
  }
@@ -4042,7 +4047,7 @@ function parse(source, root, options) {
4042
4047
  name = applyCase(name);
4043
4048
  skip("=");
4044
4049
 
4045
- var field = new Field(name, parseId(next()), type, rule, extend);
4050
+ var field = new Field(name, parseId(next()), type, rule === "proto3_optional" ? "optional" : rule, extend);
4046
4051
 
4047
4052
  ifBlock(field, function parseField_block(token) {
4048
4053
 
@@ -5362,8 +5367,12 @@ Root.prototype.load = function load(filename, options, callback) {
5362
5367
  }
5363
5368
 
5364
5369
  // Processes a single file
5365
- function process(filename, source) {
5370
+ function process(filename, source, depth) {
5371
+ if (depth === undefined)
5372
+ depth = 0;
5366
5373
  try {
5374
+ if (depth > util.recursionLimit)
5375
+ throw Error("max depth exceeded");
5367
5376
  if (util.isString(source) && source.charAt(0) === "{")
5368
5377
  source = JSON.parse(source);
5369
5378
  if (!util.isString(source))
@@ -5376,11 +5385,11 @@ Root.prototype.load = function load(filename, options, callback) {
5376
5385
  if (parsed.imports)
5377
5386
  for (; i < parsed.imports.length; ++i)
5378
5387
  if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))
5379
- fetch(resolved);
5388
+ fetch(resolved, false, depth + 1);
5380
5389
  if (parsed.weakImports)
5381
5390
  for (i = 0; i < parsed.weakImports.length; ++i)
5382
5391
  if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))
5383
- fetch(resolved, true);
5392
+ fetch(resolved, true, depth + 1);
5384
5393
  }
5385
5394
  } catch (err) {
5386
5395
  finish(err);
@@ -5391,7 +5400,9 @@ Root.prototype.load = function load(filename, options, callback) {
5391
5400
  }
5392
5401
 
5393
5402
  // Fetches a single file
5394
- function fetch(filename, weak) {
5403
+ function fetch(filename, weak, depth) {
5404
+ if (depth === undefined)
5405
+ depth = 0;
5395
5406
  filename = getBundledFileName(filename) || filename;
5396
5407
 
5397
5408
  // Skip if already loaded / attempted
@@ -5403,12 +5414,12 @@ Root.prototype.load = function load(filename, options, callback) {
5403
5414
  // Shortcut bundled definitions
5404
5415
  if (Object.prototype.hasOwnProperty.call(common, filename)) {
5405
5416
  if (sync) {
5406
- process(filename, common[filename]);
5417
+ process(filename, common[filename], depth);
5407
5418
  } else {
5408
5419
  ++queued;
5409
5420
  setTimeout(function() {
5410
5421
  --queued;
5411
- process(filename, common[filename]);
5422
+ process(filename, common[filename], depth);
5412
5423
  });
5413
5424
  }
5414
5425
  return;
@@ -5424,7 +5435,7 @@ Root.prototype.load = function load(filename, options, callback) {
5424
5435
  finish(err);
5425
5436
  return;
5426
5437
  }
5427
- process(filename, source);
5438
+ process(filename, source, depth);
5428
5439
  } else {
5429
5440
  ++queued;
5430
5441
  self.fetch(filename, function(err, source) {
@@ -5441,7 +5452,7 @@ Root.prototype.load = function load(filename, options, callback) {
5441
5452
  finish(null, self);
5442
5453
  return;
5443
5454
  }
5444
- process(filename, source);
5455
+ process(filename, source, depth);
5445
5456
  });
5446
5457
  }
5447
5458
  }
@@ -6917,7 +6928,7 @@ Type.prototype.isReservedName = function isReservedName(name) {
6917
6928
  /**
6918
6929
  * Creates a new message of this type using the specified properties.
6919
6930
  * @param {Object.<string,*>} [properties] Properties to set
6920
- * @returns {Message<{}>} Message instance
6931
+ * @returns {ReflectedMessage} Message instance
6921
6932
  */
6922
6933
  Type.prototype.create = function create(properties) {
6923
6934
  return new this.ctor(properties);
@@ -6983,8 +6994,8 @@ Type.prototype.setup = function setup() {
6983
6994
  * @param {Writer} [writer] Writer to encode to
6984
6995
  * @returns {Writer} writer
6985
6996
  */
6986
- Type.prototype.encode = function encode_setup(message, writer) {
6987
- return this.setup().encode(message, writer); // overrides this method
6997
+ Type.prototype.encode = function encode_setup(message, writer) { // eslint-disable-line no-unused-vars
6998
+ return this.setup().encode.apply(this, arguments); // overrides this method
6988
6999
  };
6989
7000
 
6990
7001
  /**
@@ -7001,7 +7012,7 @@ Type.prototype.encodeDelimited = function encodeDelimited(message, writer) {
7001
7012
  * Decodes a message of this type.
7002
7013
  * @param {Reader|Uint8Array} reader Reader or buffer to decode from
7003
7014
  * @param {number} [length] Length of the message, if known beforehand
7004
- * @returns {Message<{}>} Decoded message
7015
+ * @returns {ReflectedMessage} Decoded message
7005
7016
  * @throws {Error} If the payload is not a reader or valid buffer
7006
7017
  * @throws {util.ProtocolError<{}>} If required fields are missing
7007
7018
  */
@@ -7012,7 +7023,7 @@ Type.prototype.decode = function decode_setup(reader, length) { // eslint-disabl
7012
7023
  /**
7013
7024
  * Decodes a message of this type preceeded by its byte length as a varint.
7014
7025
  * @param {Reader|Uint8Array} reader Reader or buffer to decode from
7015
- * @returns {Message<{}>} Decoded message
7026
+ * @returns {ReflectedMessage} Decoded message
7016
7027
  * @throws {Error} If the payload is not a reader or valid buffer
7017
7028
  * @throws {util.ProtocolError} If required fields are missing
7018
7029
  */
@@ -7034,7 +7045,7 @@ Type.prototype.verify = function verify_setup(message) { // eslint-disable-line
7034
7045
  /**
7035
7046
  * Creates a new message of this type from a plain object. Also converts values to their respective internal types.
7036
7047
  * @param {Object.<string,*>} object Plain object to convert
7037
- * @returns {Message<{}>} Message instance
7048
+ * @returns {ReflectedMessage} Message instance
7038
7049
  */
7039
7050
  Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line no-unused-vars
7040
7051
  return this.setup().fromObject.apply(this, arguments);
@@ -7065,8 +7076,8 @@ Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line
7065
7076
  * @param {IConversionOptions} [options] Conversion options
7066
7077
  * @returns {Object.<string,*>} Plain object
7067
7078
  */
7068
- Type.prototype.toObject = function toObject(message, options) {
7069
- return this.setup().toObject(message, options);
7079
+ Type.prototype.toObject = function toObject(message, options) { // eslint-disable-line no-unused-vars
7080
+ return this.setup().toObject.apply(this, arguments);
7070
7081
  };
7071
7082
 
7072
7083
  /**
@@ -7321,8 +7332,7 @@ util.fetch = require(33);
7321
7332
  util.path = require(39);
7322
7333
  util.patterns = require(40);
7323
7334
 
7324
- var reservedRe = util.patterns.reservedRe,
7325
- unsafePropertyRe = util.patterns.unsafePropertyRe;
7335
+ var reservedRe = util.patterns.reservedRe;
7326
7336
 
7327
7337
  /**
7328
7338
  * Node's fs module if available.
@@ -7485,7 +7495,7 @@ util.decorateEnum = function decorateEnum(object) {
7485
7495
  util.setProperty = function setProperty(dst, path, value, ifNotSet) {
7486
7496
  function setProp(dst, path, value) {
7487
7497
  var part = path.shift();
7488
- if (unsafePropertyRe.test(part))
7498
+ if (util.isUnsafeProperty(part))
7489
7499
  return dst;
7490
7500
  if (path.length > 0) {
7491
7501
  dst[part] = setProp(dst[part] || {}, path, value);
@@ -7858,7 +7868,7 @@ function EventEmitter() {
7858
7868
  * @type {Object.<string,*>}
7859
7869
  * @private
7860
7870
  */
7861
- this._listeners = {};
7871
+ this._listeners = Object.create(null);
7862
7872
  }
7863
7873
 
7864
7874
  /**
@@ -7892,12 +7902,14 @@ EventEmitter.prototype.on = function on(evt, fn, ctx) {
7892
7902
  */
7893
7903
  EventEmitter.prototype.off = function off(evt, fn) {
7894
7904
  if (evt === undefined)
7895
- this._listeners = {};
7905
+ this._listeners = Object.create(null);
7896
7906
  else {
7897
7907
  if (fn === undefined)
7898
7908
  this._listeners[evt] = [];
7899
7909
  else {
7900
7910
  var listeners = this._listeners[evt];
7911
+ if (!listeners)
7912
+ return this;
7901
7913
  for (var i = 0; i < listeners.length;)
7902
7914
  if (listeners[i].fn === fn)
7903
7915
  listeners.splice(i, 1);
@@ -8661,6 +8673,18 @@ util.pool = require(41);
8661
8673
  // utility to work with the low and high bits of a 64 bit value
8662
8674
  util.LongBits = require(37);
8663
8675
 
8676
+ /**
8677
+ * Tests if the specified key can affect object prototypes.
8678
+ * @memberof util
8679
+ * @param {string} key Key to test
8680
+ * @returns {boolean} `true` if the key is unsafe
8681
+ */
8682
+ function isUnsafeProperty(key) {
8683
+ return key === "__proto__" || key === "prototype" || key === "constructor";
8684
+ }
8685
+
8686
+ util.isUnsafeProperty = isUnsafeProperty;
8687
+
8664
8688
  /**
8665
8689
  * Whether running within node or not.
8666
8690
  * @memberof util
@@ -8895,15 +8919,21 @@ util.boolFromKey = function boolFromKey(key) {
8895
8919
  * Merges the properties of the source object into the destination object.
8896
8920
  * @memberof util
8897
8921
  * @param {Object.<string,*>} dst Destination object
8898
- * @param {Object.<string,*>} src Source object
8899
- * @param {boolean} [ifNotSet=false] Merges only if the key is not already set
8922
+ * @param {...(Object.<string,*>|boolean)} src Source objects, optionally followed by an `ifNotSet` flag
8900
8923
  * @returns {Object.<string,*>} Destination object
8901
8924
  */
8902
- function merge(dst, src, ifNotSet) { // used by converters
8903
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
8904
- if (dst[keys[i]] === undefined || !ifNotSet)
8905
- if (keys[i] !== "__proto__")
8925
+ function merge(dst) { // used by converters
8926
+ var ifNotSet = typeof arguments[arguments.length - 1] === "boolean",
8927
+ limit = ifNotSet ? arguments.length - 1 : arguments.length;
8928
+ ifNotSet = ifNotSet && arguments[arguments.length - 1];
8929
+ for (var a = 1; a < limit; ++a) {
8930
+ var src = arguments[a];
8931
+ if (!src)
8932
+ continue;
8933
+ for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
8934
+ if (!isUnsafeProperty(keys[i]) && (dst[keys[i]] === undefined || !ifNotSet))
8906
8935
  dst[keys[i]] = src[keys[i]];
8936
+ }
8907
8937
  return dst;
8908
8938
  }
8909
8939
 
@@ -9217,7 +9247,6 @@ var patterns = exports;
9217
9247
  patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
9218
9248
  patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
9219
9249
  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)$/;
9220
- patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
9221
9250
 
9222
9251
  },{}],41:[function(require,module,exports){
9223
9252
  "use strict";
@@ -9593,7 +9622,8 @@ function verifier(mtype) {
9593
9622
  */
9594
9623
  var wrappers = exports;
9595
9624
 
9596
- var Message = require(12);
9625
+ var Message = require(12),
9626
+ util = require(38);
9597
9627
 
9598
9628
  /**
9599
9629
  * From object converter part of an {@link IWrapper}.
@@ -9640,10 +9670,9 @@ wrappers[".google.protobuf.Any"] = {
9640
9670
  if (type_url.indexOf("/") === -1) {
9641
9671
  type_url = "/" + type_url;
9642
9672
  }
9643
- var nextDepth = depth === undefined ? 1 : depth + 1;
9644
9673
  return this.create({
9645
9674
  type_url: type_url,
9646
- value: type.encode(type.fromObject(object, nextDepth)).finish()
9675
+ value: type.encode(type.fromObject(object, depth === undefined ? 1 : depth + 1)).finish()
9647
9676
  });
9648
9677
  }
9649
9678
  }
@@ -9651,13 +9680,16 @@ wrappers[".google.protobuf.Any"] = {
9651
9680
  return this.fromObject(object, depth);
9652
9681
  },
9653
9682
 
9654
- toObject: function(message, options) {
9683
+ toObject: function(message, options, depth) {
9684
+ if (depth === undefined)
9685
+ depth = 0;
9686
+ if (depth > util.recursionLimit)
9687
+ throw Error("max depth exceeded");
9655
9688
 
9656
9689
  // Default prefix
9657
9690
  var googleApi = "type.googleapis.com/";
9658
9691
  var prefix = "";
9659
9692
  var name = "";
9660
-
9661
9693
  // decode value if requested and unmapped
9662
9694
  if (options && options.json && message.type_url && message.value) {
9663
9695
  // Only use fully qualified type name after the last '/'
@@ -9667,12 +9699,12 @@ wrappers[".google.protobuf.Any"] = {
9667
9699
  var type = this.lookup(name);
9668
9700
  /* istanbul ignore else */
9669
9701
  if (type)
9670
- message = type.decode(message.value);
9702
+ message = type.decode(message.value, undefined, undefined, depth + 1);
9671
9703
  }
9672
9704
 
9673
9705
  // wrap value if unmapped
9674
9706
  if (!(message instanceof this.ctor) && message instanceof Message) {
9675
- var object = message.$type.toObject(message, options);
9707
+ var object = message.$type.toObject(message, options, depth + 1);
9676
9708
  var messageName = message.$type.fullName[0] === "." ?
9677
9709
  message.$type.fullName.slice(1) : message.$type.fullName;
9678
9710
  // Default to type.googleapis.com prefix if no prefix is used
@@ -9684,11 +9716,11 @@ wrappers[".google.protobuf.Any"] = {
9684
9716
  return object;
9685
9717
  }
9686
9718
 
9687
- return this.toObject(message, options);
9719
+ return this.toObject(message, options, depth);
9688
9720
  }
9689
9721
  };
9690
9722
 
9691
- },{"12":12}],45:[function(require,module,exports){
9723
+ },{"12":12,"38":38}],45:[function(require,module,exports){
9692
9724
  "use strict";
9693
9725
  module.exports = Writer;
9694
9726