protobufjs 8.5.0 → 8.6.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v8.5.0 (c) 2016, daniel wirtz
3
- * compiled fri, 29 may 2026 22:57:25 utc
2
+ * protobuf.js v8.6.1 (c) 2016, daniel wirtz
3
+ * compiled sun, 07 jun 2026 00:06:12 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -148,7 +148,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
148
148
  converter.fromObject = function fromObject(mtype) {
149
149
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
150
150
  var fields = mtype.fieldsArray;
151
- var gen = util.codegen(["d", "q"], mtype.name + "$fromObject")
151
+ var gen = util.codegen(["d", "q"])
152
152
  ("if(d instanceof C)")
153
153
  ("return d")
154
154
  ("if(!util.isObject(d))")
@@ -282,7 +282,7 @@ converter.toObject = function toObject(mtype) {
282
282
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
283
283
  if (!fields.length)
284
284
  return util.codegen()("return {}");
285
- var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
285
+ var gen = util.codegen(["m", "o", "q"])
286
286
  ("if(!o)")
287
287
  ("o={}")
288
288
  ("if(q===undefined)q=0")
@@ -371,7 +371,7 @@ converter.toObject = function toObject(mtype) {
371
371
  genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
372
372
  ("}");
373
373
  } else { gen
374
- ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
374
+ ("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
375
375
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
376
376
  if (field.partOf && !field.partOf.isProto3Optional) gen
377
377
  ("if(o.oneofs)")
@@ -414,7 +414,7 @@ function decoder(mtype) {
414
414
  if (!pfield.repeated && !pfield.map && !pfield.hasPresence)
415
415
  hasImplicitPresenceField = true;
416
416
  }
417
- var gen = util.codegen(["r", "l", "z", "q", "g"], mtype.name + "$decode")
417
+ var gen = util.codegen(["r", "l", "z", "q", "g"])
418
418
  ("if(!(r instanceof Reader))")
419
419
  ("r=Reader.create(r)")
420
420
  ("if(q===undefined)q=0")
@@ -586,7 +586,7 @@ function decoder(mtype) {
586
586
  for (i = 0; i < mtype._fieldsArray.length; ++i) {
587
587
  var rfield = mtype._fieldsArray[i];
588
588
  if (rfield.required) gen
589
- ("if(!m.hasOwnProperty(%j))", rfield.name)
589
+ ("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
590
590
  ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
591
591
  }
592
592
 
@@ -625,7 +625,7 @@ function genTypePartial(gen, field, fieldIndex, ref) {
625
625
  */
626
626
  function encoder(mtype) {
627
627
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
628
- var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
628
+ var gen = util.codegen(["m", "w", "q"])
629
629
  ("if(!w)")
630
630
  ("w=Writer.create()")
631
631
  ("if(q===undefined)q=0")
@@ -982,6 +982,12 @@ Field.fromJSON = function fromJSON(name, json) {
982
982
  var field = new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);
983
983
  if (json.edition)
984
984
  field._edition = json.edition;
985
+ if (json.protoName)
986
+ field.protoName = json.protoName;
987
+ if (json.jsonName !== undefined)
988
+ field.jsonName = json.jsonName;
989
+ else if (json.options && json.options.json_name !== undefined)
990
+ field.jsonName = json.options.json_name;
985
991
  field._defaultEdition = "proto3"; // For backwards-compatibility.
986
992
  return field;
987
993
  };
@@ -1121,6 +1127,18 @@ function Field(name, id, type, rule, extend, options, comment) {
1121
1127
  * @type {string|null}
1122
1128
  */
1123
1129
  this.comment = comment;
1130
+
1131
+ /**
1132
+ * Field name as declared in the .proto source, if different from `name`.
1133
+ * @type {string|undefined}
1134
+ */
1135
+ this.protoName = undefined;
1136
+
1137
+ /**
1138
+ * JSON name, if different from the derived default.
1139
+ * @type {string|undefined}
1140
+ */
1141
+ this.jsonName = undefined;
1124
1142
  }
1125
1143
 
1126
1144
  /**
@@ -1190,6 +1208,22 @@ Object.defineProperty(Field.prototype, "hasPresence", {
1190
1208
  }
1191
1209
  });
1192
1210
 
1211
+ /**
1212
+ * The field name as declared in the .proto source (snake_case). Populated on resolve,
1213
+ * falling back to `name`. Mirrors `FieldDescriptorProto.name`.
1214
+ * @name Field#protoName
1215
+ * @type {string}
1216
+ * @readonly
1217
+ */
1218
+
1219
+ /**
1220
+ * The JSON name of this field (lowerCamelCase per protoc's `ToJsonName`, or an
1221
+ * explicit `[json_name]`). Populated on resolve. This is the key used on ProtoJSON output.
1222
+ * @name Field#jsonName
1223
+ * @type {string}
1224
+ * @readonly
1225
+ */
1226
+
1193
1227
  /**
1194
1228
  * @override
1195
1229
  */
@@ -1223,13 +1257,15 @@ Field.prototype.setOption = function setOption(name, value, ifNotSet) {
1223
1257
  Field.prototype.toJSON = function toJSON(toJSONOptions) {
1224
1258
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
1225
1259
  return util.toObject([
1226
- "edition" , this._editionToJSON(),
1227
- "rule" , this.rule !== "optional" && this.rule || undefined,
1228
- "type" , this.type,
1229
- "id" , this.id,
1230
- "extend" , this.extend,
1231
- "options" , this.options,
1232
- "comment" , keepComments ? this.comment : undefined
1260
+ "edition" , this._editionToJSON(),
1261
+ "rule" , this.rule !== "optional" && this.rule || undefined,
1262
+ "type" , this.type,
1263
+ "id" , this.id,
1264
+ "extend" , this.extend,
1265
+ "protoName" , this.protoName !== this.name ? this.protoName : undefined,
1266
+ "jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
1267
+ "options" , this.options,
1268
+ "comment" , keepComments ? this.comment : undefined
1233
1269
  ]);
1234
1270
  };
1235
1271
 
@@ -1298,6 +1334,12 @@ Field.prototype.resolve = function resolve() {
1298
1334
  if (this.parent instanceof Type && this.parent._ctor)
1299
1335
  this.parent._ctor.prototype[this.name] = this.defaultValue;
1300
1336
 
1337
+ // derive the proto/JSON names
1338
+ if (this.protoName === undefined)
1339
+ this.protoName = this.name;
1340
+ if (this.jsonName === undefined)
1341
+ this.jsonName = util.jsonName(this.protoName);
1342
+
1301
1343
  return ReflectionObject.prototype.resolve.call(this);
1302
1344
  };
1303
1345
 
@@ -1475,7 +1517,7 @@ protobuf.loadSync = loadSync;
1475
1517
  // Serialization
1476
1518
  protobuf.encoder = require(4);
1477
1519
  protobuf.decoder = require(3);
1478
- protobuf.verifier = require(39);
1520
+ protobuf.verifier = require(38);
1479
1521
  protobuf.converter = require(2);
1480
1522
 
1481
1523
  // Reflection
@@ -1492,7 +1534,7 @@ protobuf.Method = require(11);
1492
1534
 
1493
1535
  // Runtime
1494
1536
  protobuf.Message = require(10);
1495
- protobuf.wrappers = require(40);
1537
+ protobuf.wrappers = require(39);
1496
1538
 
1497
1539
  // Utility
1498
1540
  protobuf.types = require(23);
@@ -1504,7 +1546,7 @@ protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
1504
1546
  protobuf.Root._configure(protobuf.Type, undefined, {});
1505
1547
  protobuf.Field._configure(protobuf.Type);
1506
1548
 
1507
- },{"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){
1549
+ },{"10":10,"11":11,"12":12,"13":13,"14":14,"17":17,"2":2,"21":21,"22":22,"23":23,"24":24,"3":3,"38":38,"39":39,"4":4,"5":5,"6":6,"8":8,"9":9}],8:[function(require,module,exports){
1508
1550
  "use strict";
1509
1551
  var protobuf = exports;
1510
1552
 
@@ -1517,13 +1559,13 @@ var protobuf = exports;
1517
1559
  protobuf.build = "minimal";
1518
1560
 
1519
1561
  // Serialization
1520
- protobuf.Writer = require(41);
1521
- protobuf.BufferWriter = require(42);
1562
+ protobuf.Writer = require(40);
1563
+ protobuf.BufferWriter = require(41);
1522
1564
  protobuf.Reader = require(15);
1523
1565
  protobuf.BufferReader = require(16);
1524
1566
 
1525
1567
  // Utility
1526
- protobuf.util = require(34);
1568
+ protobuf.util = require(33);
1527
1569
  protobuf.rpc = require(19);
1528
1570
  protobuf.roots = require(18);
1529
1571
  protobuf.configure = configure;
@@ -1542,7 +1584,7 @@ function configure() {
1542
1584
  // Set up buffer utility according to the environment
1543
1585
  configure();
1544
1586
 
1545
- },{"15":15,"16":16,"18":18,"19":19,"34":34,"41":41,"42":42}],9:[function(require,module,exports){
1587
+ },{"15":15,"16":16,"18":18,"19":19,"33":33,"40":40,"41":41}],9:[function(require,module,exports){
1546
1588
  "use strict";
1547
1589
  module.exports = MapField;
1548
1590
 
@@ -1610,7 +1652,14 @@ function MapField(name, id, keyType, type, options, comment) {
1610
1652
  * @throws {TypeError} If arguments are invalid
1611
1653
  */
1612
1654
  MapField.fromJSON = function fromJSON(name, json) {
1613
- return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
1655
+ var field = new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
1656
+ if (json.protoName)
1657
+ field.protoName = json.protoName;
1658
+ if (json.jsonName !== undefined)
1659
+ field.jsonName = json.jsonName;
1660
+ else if (json.options && json.options.json_name !== undefined)
1661
+ field.jsonName = json.options.json_name;
1662
+ return field;
1614
1663
  };
1615
1664
 
1616
1665
  /**
@@ -1621,12 +1670,14 @@ MapField.fromJSON = function fromJSON(name, json) {
1621
1670
  MapField.prototype.toJSON = function toJSON(toJSONOptions) {
1622
1671
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
1623
1672
  return util.toObject([
1624
- "keyType" , this.keyType,
1625
- "type" , this.type,
1626
- "id" , this.id,
1627
- "extend" , this.extend,
1628
- "options" , this.options,
1629
- "comment" , keepComments ? this.comment : undefined
1673
+ "keyType" , this.keyType,
1674
+ "type" , this.type,
1675
+ "id" , this.id,
1676
+ "extend" , this.extend,
1677
+ "protoName" , this.protoName !== this.name ? this.protoName : undefined,
1678
+ "jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
1679
+ "options" , this.options,
1680
+ "comment" , keepComments ? this.comment : undefined
1630
1681
  ]);
1631
1682
  };
1632
1683
 
@@ -1675,7 +1726,7 @@ MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {
1675
1726
  "use strict";
1676
1727
  module.exports = Message;
1677
1728
 
1678
- var util = require(34);
1729
+ var util = require(33);
1679
1730
 
1680
1731
  /**
1681
1732
  * Constructs a new message instance.
@@ -1810,7 +1861,7 @@ Message.prototype.toJSON = function toJSON() {
1810
1861
  return this.$type.toObject(this, util.toJSONOptions);
1811
1862
  };
1812
1863
 
1813
- },{"34":34}],11:[function(require,module,exports){
1864
+ },{"33":33}],11:[function(require,module,exports){
1814
1865
  "use strict";
1815
1866
  module.exports = Method;
1816
1867
 
@@ -3169,7 +3220,7 @@ OneOf.d = function decorateOneOf() {
3169
3220
  "use strict";
3170
3221
  module.exports = Reader;
3171
3222
 
3172
- var util = require(34);
3223
+ var util = require(33);
3173
3224
 
3174
3225
  var BufferReader; // cyclic
3175
3226
 
@@ -3710,7 +3761,7 @@ Reader._configure = function(BufferReader_) {
3710
3761
  });
3711
3762
  };
3712
3763
 
3713
- },{"34":34}],16:[function(require,module,exports){
3764
+ },{"33":33}],16:[function(require,module,exports){
3714
3765
  "use strict";
3715
3766
  module.exports = BufferReader;
3716
3767
 
@@ -3718,7 +3769,7 @@ module.exports = BufferReader;
3718
3769
  var Reader = require(15);
3719
3770
  (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
3720
3771
 
3721
- var util = require(34);
3772
+ var util = require(33);
3722
3773
 
3723
3774
  /**
3724
3775
  * Constructs a new buffer reader instance.
@@ -3784,7 +3835,7 @@ BufferReader.prototype.string = function read_string_buffer() {
3784
3835
 
3785
3836
  BufferReader._configure();
3786
3837
 
3787
- },{"15":15,"34":34}],17:[function(require,module,exports){
3838
+ },{"15":15,"33":33}],17:[function(require,module,exports){
3788
3839
  "use strict";
3789
3840
  module.exports = Root;
3790
3841
 
@@ -4264,7 +4315,7 @@ rpc.Service = require(20);
4264
4315
  "use strict";
4265
4316
  module.exports = Service;
4266
4317
 
4267
- var util = require(34);
4318
+ var util = require(33);
4268
4319
 
4269
4320
  // Extends EventEmitter
4270
4321
  (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
@@ -4410,7 +4461,7 @@ Service.prototype.end = function end(endedByRPC) {
4410
4461
  return this;
4411
4462
  };
4412
4463
 
4413
- },{"34":34}],21:[function(require,module,exports){
4464
+ },{"33":33}],21:[function(require,module,exports){
4414
4465
  "use strict";
4415
4466
  module.exports = Service;
4416
4467
 
@@ -4422,8 +4473,6 @@ var Method = require(11),
4422
4473
  util = require(24),
4423
4474
  rpc = require(19);
4424
4475
 
4425
- var reservedRe = util.patterns.reservedRe;
4426
-
4427
4476
  /**
4428
4477
  * Constructs a new service instance.
4429
4478
  * @classdesc Reflected service.
@@ -4603,11 +4652,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
4603
4652
  var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
4604
4653
  for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
4605
4654
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
4606
- rpcService[methodName] = util.codegen(["r","c"], reservedRe.test(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
4607
- m: method,
4608
- q: method.resolvedRequestType.ctor,
4609
- s: method.resolvedResponseType.ctor
4610
- });
4655
+ rpcService[methodName] = (function(method, requestType, responseType) {
4656
+ return function rpcMethod(request, callback) {
4657
+ return rpc.Service.prototype.rpcCall.call(this, method, requestType, responseType, request, callback);
4658
+ };
4659
+ })(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
4611
4660
  }
4612
4661
  return rpcService;
4613
4662
  };
@@ -4627,13 +4676,13 @@ var Enum = require(5),
4627
4676
  Service = require(21),
4628
4677
  Message = require(10),
4629
4678
  Reader = require(15),
4630
- Writer = require(41),
4679
+ Writer = require(40),
4631
4680
  util = require(24),
4632
4681
  encoder = require(4),
4633
4682
  decoder = require(3),
4634
- verifier = require(39),
4683
+ verifier = require(38),
4635
4684
  converter = require(2),
4636
- wrappers = require(40);
4685
+ wrappers = require(39);
4637
4686
 
4638
4687
  /**
4639
4688
  * Constructs a new reflected message type instance.
@@ -4704,6 +4753,13 @@ function Type(name, options) {
4704
4753
  * @private
4705
4754
  */
4706
4755
  this._ctor = null;
4756
+
4757
+ /**
4758
+ * Cached fields by JSON name.
4759
+ * @type {Object.<string,Field>|null}
4760
+ * @private
4761
+ */
4762
+ this._fieldsByJsonName = null; // used by ext/protojson
4707
4763
  }
4708
4764
 
4709
4765
  Object.defineProperties(Type.prototype, {
@@ -4816,7 +4872,7 @@ Object.defineProperties(Type.prototype, {
4816
4872
  */
4817
4873
  Type.generateConstructor = function generateConstructor(mtype) {
4818
4874
  /* eslint-disable no-unexpected-multiline */
4819
- var gen = util.codegen(["p"], mtype.name);
4875
+ var gen = util.codegen(["p"]);
4820
4876
  // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype
4821
4877
  for (var i = 0, field; i < mtype.fieldsArray.length; ++i)
4822
4878
  if ((field = mtype._fieldsArray[i]).map) gen
@@ -4830,7 +4886,7 @@ Type.generateConstructor = function generateConstructor(mtype) {
4830
4886
  };
4831
4887
 
4832
4888
  function clearCache(type) {
4833
- type._fieldsById = type._fieldsArray = type._oneofsArray = null;
4889
+ type._fieldsById = type._fieldsArray = type._oneofsArray = type._fieldsByJsonName = null;
4834
4890
  delete type.encode;
4835
4891
  delete type.decode;
4836
4892
  delete type.verify;
@@ -4994,7 +5050,7 @@ Type.prototype.add = function add(object) {
4994
5050
  throw Error("duplicate id " + object.id + " in " + this);
4995
5051
  if (this.isReservedId(object.id))
4996
5052
  throw Error("id " + object.id + " is reserved in " + this);
4997
- if (this.isReservedName(object.name))
5053
+ if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
4998
5054
  throw Error("name '" + object.name + "' is reserved in " + this);
4999
5055
  if (object.name === "__proto__")
5000
5056
  return this;
@@ -5007,6 +5063,8 @@ Type.prototype.add = function add(object) {
5007
5063
  return clearCache(this);
5008
5064
  }
5009
5065
  if (object instanceof OneOf) {
5066
+ if (object.name.charAt(0) === "$")
5067
+ throw Error("name '" + object.name + "' is reserved in " + this);
5010
5068
  if (object.name === "__proto__")
5011
5069
  return this;
5012
5070
  if (!this.oneofs)
@@ -5260,7 +5318,7 @@ Type.d = function decorateType(typeName) {
5260
5318
  };
5261
5319
  };
5262
5320
 
5263
- },{"10":10,"12":12,"14":14,"15":15,"2":2,"21":21,"24":24,"3":3,"39":39,"4":4,"40":40,"41":41,"5":5,"6":6,"9":9}],23:[function(require,module,exports){
5321
+ },{"10":10,"12":12,"14":14,"15":15,"2":2,"21":21,"24":24,"3":3,"38":38,"39":39,"4":4,"40":40,"5":5,"6":6,"9":9}],23:[function(require,module,exports){
5264
5322
  "use strict";
5265
5323
 
5266
5324
  /**
@@ -5465,7 +5523,7 @@ types.packed = bake([
5465
5523
  * Various utility functions.
5466
5524
  * @namespace
5467
5525
  */
5468
- var util = module.exports = require(34);
5526
+ var util = module.exports = require(33);
5469
5527
 
5470
5528
  var roots = require(18);
5471
5529
 
@@ -5474,8 +5532,8 @@ var Type, // cyclic
5474
5532
 
5475
5533
  util.codegen = require(27);
5476
5534
  util.fetch = require(29);
5477
- util.path = require(35);
5478
- util.patterns = require(36);
5535
+ util.path = require(34);
5536
+ util.patterns = require(35);
5479
5537
 
5480
5538
  var reservedRe = util.patterns.reservedRe;
5481
5539
 
@@ -5554,6 +5612,7 @@ var camelCaseRe = /_([a-z])/g;
5554
5612
  * Converts a string to camel case.
5555
5613
  * @param {string} str String to convert
5556
5614
  * @returns {string} Converted string
5615
+ * @deprecated Use {@link util.jsonName} for protobuf field JSON names.
5557
5616
  */
5558
5617
  util.camelCase = function camelCase(str) {
5559
5618
  return str.substring(0, 1)
@@ -5561,6 +5620,28 @@ util.camelCase = function camelCase(str) {
5561
5620
  .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });
5562
5621
  };
5563
5622
 
5623
+ /**
5624
+ * Converts a proto field name to its protoc-compatible JSON name.
5625
+ * @param {string} str Proto field name
5626
+ * @returns {string} JSON name
5627
+ */
5628
+ util.jsonName = function jsonName(str) {
5629
+ var result = "",
5630
+ upperNext = false,
5631
+ i = 0;
5632
+ for (; i < str.length; ++i) {
5633
+ var ch = str.charAt(i);
5634
+ if (ch === "_")
5635
+ upperNext = true;
5636
+ else if (upperNext) {
5637
+ result += ch.toUpperCase();
5638
+ upperNext = false;
5639
+ } else
5640
+ result += ch;
5641
+ }
5642
+ return result;
5643
+ };
5644
+
5564
5645
  /**
5565
5646
  * Compares reflected fields by id.
5566
5647
  * @param {Field} a First field
@@ -5679,7 +5760,7 @@ Object.defineProperty(util, "decorateRoot", {
5679
5760
  }
5680
5761
  });
5681
5762
 
5682
- },{"17":17,"18":18,"22":22,"27":27,"29":29,"31":31,"34":34,"35":35,"36":36,"5":5}],25:[function(require,module,exports){
5763
+ },{"17":17,"18":18,"22":22,"27":27,"29":29,"31":31,"33":33,"34":34,"35":35,"5":5}],25:[function(require,module,exports){
5683
5764
  "use strict";
5684
5765
  module.exports = asPromise;
5685
5766
 
@@ -5885,7 +5966,7 @@ base64.test = function test(string) {
5885
5966
  "use strict";
5886
5967
  module.exports = codegen;
5887
5968
 
5888
- var patterns = require(36);
5969
+ var patterns = require(35);
5889
5970
  var reservedRe = patterns.reservedRe;
5890
5971
 
5891
5972
  /**
@@ -5996,7 +6077,7 @@ function safeFunctionName(name) {
5996
6077
  return reservedRe.test(name) ? name + "_" : name;
5997
6078
  }
5998
6079
 
5999
- },{"36":36}],28:[function(require,module,exports){
6080
+ },{"35":35}],28:[function(require,module,exports){
6000
6081
  "use strict";
6001
6082
  module.exports = EventEmitter;
6002
6083
 
@@ -6550,49 +6631,9 @@ module.exports = fs;
6550
6631
 
6551
6632
  },{"1":1}],32:[function(require,module,exports){
6552
6633
  "use strict";
6553
- module.exports = inquire;
6554
-
6555
- /**
6556
- * Requires a module only if available.
6557
- * @memberof util
6558
- * @param {string} moduleName Module to require
6559
- * @returns {?Object} Required module if available and not empty, otherwise `null`
6560
- * @deprecated Legacy optional require helper. Will be removed in a future release.
6561
- */
6562
- function inquire(moduleName) {
6563
- try {
6564
- if (typeof require !== "function") {
6565
- return null;
6566
- }
6567
- var mod = require(moduleName);
6568
- if (mod && (mod.length || Object.keys(mod).length)) return mod;
6569
- return null;
6570
- } catch (err) {
6571
- // ignore
6572
- return null;
6573
- }
6574
- }
6575
-
6576
- /*
6577
- // maybe worth a shot to prevent renaming issues:
6578
- // see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
6579
- // triggers on:
6580
- // - expression require.cache
6581
- // - expression require (???)
6582
- // - call require
6583
- // - call require:commonjs:item
6584
- // - call require:commonjs:context
6585
-
6586
- Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
6587
- var r = require.__self;
6588
- delete Function.prototype.__self;
6589
- */
6590
-
6591
- },{}],33:[function(require,module,exports){
6592
- "use strict";
6593
6634
  module.exports = LongBits;
6594
6635
 
6595
- var util = require(34);
6636
+ var util = require(33);
6596
6637
 
6597
6638
  /**
6598
6639
  * Constructs new long bits.
@@ -6790,7 +6831,7 @@ LongBits.prototype.length = function length() {
6790
6831
  : part2 < 128 ? 9 : 10;
6791
6832
  };
6792
6833
 
6793
- },{"34":34}],34:[function(require,module,exports){
6834
+ },{"33":33}],33:[function(require,module,exports){
6794
6835
  "use strict";
6795
6836
  var util = exports;
6796
6837
 
@@ -6806,17 +6847,14 @@ util.EventEmitter = require(28);
6806
6847
  // float handling accross browsers
6807
6848
  util.float = require(30);
6808
6849
 
6809
- // requires modules optionally and hides the call from bundlers
6810
- util.inquire = require(32);
6811
-
6812
6850
  // converts to / from utf8 encoded strings
6813
- util.utf8 = require(38);
6851
+ util.utf8 = require(37);
6814
6852
 
6815
6853
  // provides a node-like buffer pool in the browser
6816
- util.pool = require(37);
6854
+ util.pool = require(36);
6817
6855
 
6818
6856
  // utility to work with the low and high bits of a 64 bit value
6819
- util.LongBits = require(33);
6857
+ util.LongBits = require(32);
6820
6858
 
6821
6859
  /**
6822
6860
  * Tests if the specified key can affect object prototypes.
@@ -6912,7 +6950,7 @@ util.isset =
6912
6950
  */
6913
6951
  util.isSet = function isSet(obj, prop) {
6914
6952
  var value = obj[prop];
6915
- if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
6953
+ if (value != null && Object.hasOwnProperty.call(obj, prop)) // eslint-disable-line eqeqeq
6916
6954
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
6917
6955
  return false;
6918
6956
  };
@@ -7310,7 +7348,7 @@ util._configure = function() {
7310
7348
  };
7311
7349
  };
7312
7350
 
7313
- },{"25":25,"26":26,"28":28,"30":30,"32":32,"33":33,"37":37,"38":38,"long":"long"}],35:[function(require,module,exports){
7351
+ },{"25":25,"26":26,"28":28,"30":30,"32":32,"36":36,"37":37,"long":"long"}],34:[function(require,module,exports){
7314
7352
  "use strict";
7315
7353
 
7316
7354
  /**
@@ -7384,7 +7422,7 @@ path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
7384
7422
  return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
7385
7423
  };
7386
7424
 
7387
- },{}],36:[function(require,module,exports){
7425
+ },{}],35:[function(require,module,exports){
7388
7426
  "use strict";
7389
7427
 
7390
7428
  var patterns = exports;
@@ -7393,7 +7431,7 @@ patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
7393
7431
  patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
7394
7432
  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)$/;
7395
7433
 
7396
- },{}],37:[function(require,module,exports){
7434
+ },{}],36:[function(require,module,exports){
7397
7435
  "use strict";
7398
7436
  module.exports = pool;
7399
7437
 
@@ -7443,7 +7481,7 @@ function pool(alloc, slice, size) {
7443
7481
  };
7444
7482
  }
7445
7483
 
7446
- },{}],38:[function(require,module,exports){
7484
+ },{}],37:[function(require,module,exports){
7447
7485
  "use strict";
7448
7486
 
7449
7487
  /**
@@ -7575,7 +7613,7 @@ utf8.write = function utf8_write(string, buffer, offset) {
7575
7613
  return offset - start;
7576
7614
  };
7577
7615
 
7578
- },{}],39:[function(require,module,exports){
7616
+ },{}],38:[function(require,module,exports){
7579
7617
  "use strict";
7580
7618
  module.exports = verifier;
7581
7619
 
@@ -7700,7 +7738,7 @@ function genVerifyKey(gen, field, ref) {
7700
7738
  function verifier(mtype) {
7701
7739
  /* eslint-disable no-unexpected-multiline */
7702
7740
 
7703
- var gen = util.codegen(["m", "q"], mtype.name + "$verify")
7741
+ var gen = util.codegen(["m", "q"])
7704
7742
  ("if(typeof m!==\"object\"||m===null)")
7705
7743
  ("return%j", "object expected")
7706
7744
  ("if(q===undefined)q=0")
@@ -7716,7 +7754,7 @@ function verifier(mtype) {
7716
7754
  ref = "m" + util.safeProp(field.name);
7717
7755
 
7718
7756
  if (field.optional) gen
7719
- ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null
7757
+ ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name); // !== undefined && !== null
7720
7758
 
7721
7759
  // map fields
7722
7760
  if (field.map) { gen
@@ -7757,7 +7795,7 @@ function verifier(mtype) {
7757
7795
  /* eslint-enable no-unexpected-multiline */
7758
7796
  }
7759
7797
 
7760
- },{"24":24,"5":5}],40:[function(require,module,exports){
7798
+ },{"24":24,"5":5}],39:[function(require,module,exports){
7761
7799
  "use strict";
7762
7800
 
7763
7801
  /**
@@ -7768,7 +7806,7 @@ function verifier(mtype) {
7768
7806
  var wrappers = exports;
7769
7807
 
7770
7808
  var Message = require(10),
7771
- util = require(34);
7809
+ util = require(33);
7772
7810
 
7773
7811
  /**
7774
7812
  * From object converter part of an {@link IWrapper}.
@@ -7865,11 +7903,11 @@ wrappers[".google.protobuf.Any"] = {
7865
7903
  }
7866
7904
  };
7867
7905
 
7868
- },{"10":10,"34":34}],41:[function(require,module,exports){
7906
+ },{"10":10,"33":33}],40:[function(require,module,exports){
7869
7907
  "use strict";
7870
7908
  module.exports = Writer;
7871
7909
 
7872
- var util = require(34);
7910
+ var util = require(33);
7873
7911
 
7874
7912
  var BufferWriter; // cyclic
7875
7913
 
@@ -8362,15 +8400,15 @@ Writer._configure = function(BufferWriter_) {
8362
8400
  BufferWriter._configure();
8363
8401
  };
8364
8402
 
8365
- },{"34":34}],42:[function(require,module,exports){
8403
+ },{"33":33}],41:[function(require,module,exports){
8366
8404
  "use strict";
8367
8405
  module.exports = BufferWriter;
8368
8406
 
8369
8407
  // extends Writer
8370
- var Writer = require(41);
8408
+ var Writer = require(40);
8371
8409
  (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
8372
8410
 
8373
- var util = require(34);
8411
+ var util = require(33);
8374
8412
 
8375
8413
  /**
8376
8414
  * Constructs a new buffer writer instance.
@@ -8466,7 +8504,7 @@ BufferWriter.prototype.string = function write_string_buffer(value) {
8466
8504
 
8467
8505
  BufferWriter._configure();
8468
8506
 
8469
- },{"34":34,"41":41}]},{},[7])
8507
+ },{"33":33,"40":40}]},{},[7])
8470
8508
 
8471
8509
  })();
8472
8510
  //# sourceMappingURL=protobuf.js.map