protobufjs 8.4.2 → 8.6.0

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.2 (c) 2016, daniel wirtz
3
- * compiled fri, 22 may 2026 02:44:15 utc
2
+ * protobuf.js v8.6.0 (c) 2016, daniel wirtz
3
+ * compiled thu, 04 jun 2026 21:47:13 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -485,7 +485,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
485
485
  } gen
486
486
  ("}");
487
487
  } else gen
488
- ("if(typeof d%s!==\"object\")", prop)
488
+ ("if(!util.isObject(d%s))", prop)
489
489
  ("throw TypeError(%j)", field.fullName + ": object expected")
490
490
  ("m%s=types[%i].fromObject(d%s,q+1)", prop, fieldIndex, prop);
491
491
  } else {
@@ -549,9 +549,11 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
549
549
  converter.fromObject = function fromObject(mtype) {
550
550
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
551
551
  var fields = mtype.fieldsArray;
552
- var gen = util.codegen(["d", "q"], mtype.name + "$fromObject")
552
+ var gen = util.codegen(["d", "q"])
553
553
  ("if(d instanceof C)")
554
554
  ("return d")
555
+ ("if(!util.isObject(d))")
556
+ ("throw TypeError(%j)", mtype.fullName + ": object expected")
555
557
  ("if(q===undefined)q=0")
556
558
  ("if(q>util.recursionLimit)")
557
559
  ("throw Error(\"max depth exceeded\")");
@@ -568,7 +570,7 @@ converter.fromObject = function fromObject(mtype) {
568
570
  // Map fields
569
571
  if (field.map) { gen
570
572
  ("if(d%s){", prop)
571
- ("if(typeof d%s!==\"object\")", prop)
573
+ ("if(!util.isObject(d%s))", prop)
572
574
  ("throw TypeError(%j)", field.fullName + ": object expected")
573
575
  ("m%s={}", prop)
574
576
  ("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
@@ -681,7 +683,7 @@ converter.toObject = function toObject(mtype) {
681
683
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
682
684
  if (!fields.length)
683
685
  return util.codegen()("return {}");
684
- var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
686
+ var gen = util.codegen(["m", "o", "q"])
685
687
  ("if(!o)")
686
688
  ("o={}")
687
689
  ("if(q===undefined)q=0")
@@ -770,7 +772,7 @@ converter.toObject = function toObject(mtype) {
770
772
  genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
771
773
  ("}");
772
774
  } else { gen
773
- ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
775
+ ("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
774
776
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
775
777
  if (field.partOf && !field.partOf.isProto3Optional) gen
776
778
  ("if(o.oneofs)")
@@ -813,7 +815,7 @@ function decoder(mtype) {
813
815
  if (!pfield.repeated && !pfield.map && !pfield.hasPresence)
814
816
  hasImplicitPresenceField = true;
815
817
  }
816
- var gen = util.codegen(["r", "l", "z", "q", "g"], mtype.name + "$decode")
818
+ var gen = util.codegen(["r", "l", "z", "q", "g"])
817
819
  ("if(!(r instanceof Reader))")
818
820
  ("r=Reader.create(r)")
819
821
  ("if(q===undefined)q=0")
@@ -973,8 +975,10 @@ function decoder(mtype) {
973
975
  // Unknown fields
974
976
  gen
975
977
  ("r.skipType(%s,q,t)", i ? "u" : "t&7")
976
- ("util.makeProp(m,\"$unknowns\",false);")
977
- ("(m.$unknowns||(m.$unknowns=[])).push(r.raw(s,r.pos))")
978
+ ("if(!r.discardUnknown){")
979
+ ("util.makeProp(m,\"$unknowns\",false);")
980
+ ("(m.$unknowns||(m.$unknowns=[])).push(r.raw(s,r.pos))")
981
+ ("}")
978
982
  ("}")
979
983
  ("if(z!==undefined)")
980
984
  ("throw Error(\"missing end group\")");
@@ -983,7 +987,7 @@ function decoder(mtype) {
983
987
  for (i = 0; i < mtype._fieldsArray.length; ++i) {
984
988
  var rfield = mtype._fieldsArray[i];
985
989
  if (rfield.required) gen
986
- ("if(!m.hasOwnProperty(%j))", rfield.name)
990
+ ("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
987
991
  ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
988
992
  }
989
993
 
@@ -1022,7 +1026,7 @@ function genTypePartial(gen, field, fieldIndex, ref) {
1022
1026
  */
1023
1027
  function encoder(mtype) {
1024
1028
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
1025
- var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
1029
+ var gen = util.codegen(["m", "w", "q"])
1026
1030
  ("if(!w)")
1027
1031
  ("w=Writer.create()")
1028
1032
  ("if(q===undefined)q=0")
@@ -1379,6 +1383,12 @@ Field.fromJSON = function fromJSON(name, json) {
1379
1383
  var field = new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);
1380
1384
  if (json.edition)
1381
1385
  field._edition = json.edition;
1386
+ if (json.protoName)
1387
+ field.protoName = json.protoName;
1388
+ if (json.jsonName !== undefined)
1389
+ field.jsonName = json.jsonName;
1390
+ else if (json.options && json.options.json_name !== undefined)
1391
+ field.jsonName = json.options.json_name;
1382
1392
  field._defaultEdition = "proto3"; // For backwards-compatibility.
1383
1393
  return field;
1384
1394
  };
@@ -1518,6 +1528,18 @@ function Field(name, id, type, rule, extend, options, comment) {
1518
1528
  * @type {string|null}
1519
1529
  */
1520
1530
  this.comment = comment;
1531
+
1532
+ /**
1533
+ * Field name as declared in the .proto source, if different from `name`.
1534
+ * @type {string|undefined}
1535
+ */
1536
+ this.protoName = undefined;
1537
+
1538
+ /**
1539
+ * JSON name, if different from the derived default.
1540
+ * @type {string|undefined}
1541
+ */
1542
+ this.jsonName = undefined;
1521
1543
  }
1522
1544
 
1523
1545
  /**
@@ -1587,6 +1609,22 @@ Object.defineProperty(Field.prototype, "hasPresence", {
1587
1609
  }
1588
1610
  });
1589
1611
 
1612
+ /**
1613
+ * The field name as declared in the .proto source (snake_case). Populated on resolve,
1614
+ * falling back to `name`. Mirrors `FieldDescriptorProto.name`.
1615
+ * @name Field#protoName
1616
+ * @type {string}
1617
+ * @readonly
1618
+ */
1619
+
1620
+ /**
1621
+ * The JSON name of this field (lowerCamelCase per protoc's `ToJsonName`, or an
1622
+ * explicit `[json_name]`). Populated on resolve. This is the key used on ProtoJSON output.
1623
+ * @name Field#jsonName
1624
+ * @type {string}
1625
+ * @readonly
1626
+ */
1627
+
1590
1628
  /**
1591
1629
  * @override
1592
1630
  */
@@ -1620,13 +1658,15 @@ Field.prototype.setOption = function setOption(name, value, ifNotSet) {
1620
1658
  Field.prototype.toJSON = function toJSON(toJSONOptions) {
1621
1659
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
1622
1660
  return util.toObject([
1623
- "edition" , this._editionToJSON(),
1624
- "rule" , this.rule !== "optional" && this.rule || undefined,
1625
- "type" , this.type,
1626
- "id" , this.id,
1627
- "extend" , this.extend,
1628
- "options" , this.options,
1629
- "comment" , keepComments ? this.comment : undefined
1661
+ "edition" , this._editionToJSON(),
1662
+ "rule" , this.rule !== "optional" && this.rule || undefined,
1663
+ "type" , this.type,
1664
+ "id" , this.id,
1665
+ "extend" , this.extend,
1666
+ "protoName" , this.protoName !== this.name ? this.protoName : undefined,
1667
+ "jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
1668
+ "options" , this.options,
1669
+ "comment" , keepComments ? this.comment : undefined
1630
1670
  ]);
1631
1671
  };
1632
1672
 
@@ -1695,6 +1735,12 @@ Field.prototype.resolve = function resolve() {
1695
1735
  if (this.parent instanceof Type && this.parent._ctor)
1696
1736
  this.parent._ctor.prototype[this.name] = this.defaultValue;
1697
1737
 
1738
+ // derive the proto/JSON names
1739
+ if (this.protoName === undefined)
1740
+ this.protoName = this.name;
1741
+ if (this.jsonName === undefined)
1742
+ this.jsonName = util.jsonName(this.protoName);
1743
+
1698
1744
  return ReflectionObject.prototype.resolve.call(this);
1699
1745
  };
1700
1746
 
@@ -2021,7 +2067,14 @@ function MapField(name, id, keyType, type, options, comment) {
2021
2067
  * @throws {TypeError} If arguments are invalid
2022
2068
  */
2023
2069
  MapField.fromJSON = function fromJSON(name, json) {
2024
- return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
2070
+ var field = new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
2071
+ if (json.protoName)
2072
+ field.protoName = json.protoName;
2073
+ if (json.jsonName !== undefined)
2074
+ field.jsonName = json.jsonName;
2075
+ else if (json.options && json.options.json_name !== undefined)
2076
+ field.jsonName = json.options.json_name;
2077
+ return field;
2025
2078
  };
2026
2079
 
2027
2080
  /**
@@ -2032,12 +2085,14 @@ MapField.fromJSON = function fromJSON(name, json) {
2032
2085
  MapField.prototype.toJSON = function toJSON(toJSONOptions) {
2033
2086
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
2034
2087
  return util.toObject([
2035
- "keyType" , this.keyType,
2036
- "type" , this.type,
2037
- "id" , this.id,
2038
- "extend" , this.extend,
2039
- "options" , this.options,
2040
- "comment" , keepComments ? this.comment : undefined
2088
+ "keyType" , this.keyType,
2089
+ "type" , this.type,
2090
+ "id" , this.id,
2091
+ "extend" , this.extend,
2092
+ "protoName" , this.protoName !== this.name ? this.protoName : undefined,
2093
+ "jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
2094
+ "options" , this.options,
2095
+ "comment" , keepComments ? this.comment : undefined
2041
2096
  ]);
2042
2097
  };
2043
2098
 
@@ -2285,7 +2340,7 @@ function Method(name, type, requestType, responseType, requestStream, responseSt
2285
2340
 
2286
2341
  /**
2287
2342
  * Whether requests are streamed or not.
2288
- * @type {boolean|undefined}
2343
+ * @type {true|undefined}
2289
2344
  */
2290
2345
  this.requestStream = requestStream ? true : undefined; // toJSON
2291
2346
 
@@ -2297,10 +2352,16 @@ function Method(name, type, requestType, responseType, requestStream, responseSt
2297
2352
 
2298
2353
  /**
2299
2354
  * Whether responses are streamed or not.
2300
- * @type {boolean|undefined}
2355
+ * @type {true|undefined}
2301
2356
  */
2302
2357
  this.responseStream = responseStream ? true : undefined; // toJSON
2303
2358
 
2359
+ /**
2360
+ * gRPC-style method path.
2361
+ * @type {string}
2362
+ */
2363
+ this.path = "/" + this.name;
2364
+
2304
2365
  /**
2305
2366
  * Resolved request type.
2306
2367
  * @type {Type|null}
@@ -2378,6 +2439,14 @@ Method.prototype.resolve = function resolve() {
2378
2439
  if (this.resolved)
2379
2440
  return this;
2380
2441
 
2442
+ if (this.parent) {
2443
+ var serviceName = this.parent.fullName;
2444
+ if (serviceName.charAt(0) === ".")
2445
+ serviceName = serviceName.substring(1);
2446
+ this.path = "/" + serviceName + "/" + this.name;
2447
+ } else
2448
+ this.path = "/" + this.name;
2449
+
2381
2450
  this.resolvedRequestType = this.parent.lookupType(this.requestType);
2382
2451
  this.resolvedResponseType = this.parent.lookupType(this.responseType);
2383
2452
 
@@ -2813,14 +2882,14 @@ Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChe
2813
2882
  if (path[0] === "")
2814
2883
  return this.root.lookup(path.slice(1), filterTypes);
2815
2884
 
2816
- // Early bailout for objects with matching absolute paths
2817
- var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
2885
+ // Lookup at this namespace and below
2886
+ var found = this._lookupImpl(path, flatPath);
2818
2887
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
2819
2888
  return found;
2820
2889
  }
2821
2890
 
2822
- // Do a regular lookup at this namespace and below
2823
- found = this._lookupImpl(path, flatPath);
2891
+ // Fall back to respective absolute path once relative scope has been checked (non-standard)
2892
+ found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
2824
2893
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
2825
2894
  return found;
2826
2895
  }
@@ -4047,10 +4116,13 @@ function parse(source, root, options) {
4047
4116
  if (!nameRe.test(name))
4048
4117
  throw illegal(name, "name");
4049
4118
 
4119
+ var protoName = name;
4050
4120
  name = applyCase(name);
4051
4121
  skip("=");
4052
4122
 
4053
4123
  var field = new Field(name, parseId(next()), type, rule === "proto3_optional" ? "optional" : rule, extend);
4124
+ if (protoName !== name)
4125
+ field.protoName = protoName;
4054
4126
 
4055
4127
  ifBlock(field, function parseField_block(token) {
4056
4128
 
@@ -4192,7 +4264,11 @@ function parse(source, root, options) {
4192
4264
  throw illegal(name, "name");
4193
4265
 
4194
4266
  skip("=");
4195
- var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);
4267
+ var protoName = name;
4268
+ name = applyCase(name);
4269
+ var field = new MapField(name, parseId(next()), keyType, valueType);
4270
+ if (protoName !== name)
4271
+ field.protoName = protoName;
4196
4272
  ifBlock(field, function parseMapField_block(token) {
4197
4273
 
4198
4274
  /* istanbul ignore else */
@@ -4404,11 +4480,18 @@ function parse(source, root, options) {
4404
4480
  topLevelOptions[name] = value;
4405
4481
  return;
4406
4482
  }
4483
+ // lift json_name onto Field
4484
+ if (name === "json_name" && parent instanceof Field) {
4485
+ parent.jsonName = value;
4486
+ return;
4487
+ }
4407
4488
  if (parent.setOption)
4408
4489
  parent.setOption(name, value);
4409
4490
  }
4410
4491
 
4411
4492
  function setParsedOption(parent, name, value, propName) {
4493
+ if (name === "json_name" && parent instanceof Field)
4494
+ return; // lifted onto Field#jsonName above
4412
4495
  if (parent.setParsedOption)
4413
4496
  parent.setParsedOption(name, value, propName);
4414
4497
  }
@@ -4659,6 +4742,12 @@ function Reader(buffer) {
4659
4742
  * @type {number}
4660
4743
  */
4661
4744
  this.len = buffer.length;
4745
+
4746
+ /**
4747
+ * Whether to discard unknown fields while decoding.
4748
+ * @type {boolean}
4749
+ */
4750
+ this.discardUnknown = Reader.discardUnknown;
4662
4751
  }
4663
4752
 
4664
4753
  var create_array = typeof Uint8Array !== "undefined"
@@ -5071,6 +5160,12 @@ Reader.prototype.skip = function skip(length) {
5071
5160
  */
5072
5161
  Reader.recursionLimit = util.recursionLimit;
5073
5162
 
5163
+ /**
5164
+ * Whether readers discard unknown fields while decoding.
5165
+ * @type {boolean}
5166
+ */
5167
+ Reader.discardUnknown = false;
5168
+
5074
5169
  /**
5075
5170
  * Skips the next element of the specified wire type.
5076
5171
  * @param {number} wireType Wire type received
@@ -5645,7 +5740,7 @@ Root._configure = function(Type_, parse_, common_) {
5645
5740
 
5646
5741
  },{"14":14,"16":16,"28":28,"6":6,"7":7}],21:[function(require,module,exports){
5647
5742
  "use strict";
5648
- module.exports = {};
5743
+ module.exports = Object.create(null);
5649
5744
 
5650
5745
  /**
5651
5746
  * Named roots.
@@ -5727,10 +5822,16 @@ var util = require(38);
5727
5822
  * @typedef rpc.ServiceMethod
5728
5823
  * @template TReq extends Message<TReq>
5729
5824
  * @template TRes extends Message<TRes>
5730
- * @type {function}
5731
- * @param {TReq|Properties<TReq>} request Request message or plain object
5732
- * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message
5733
- * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`
5825
+ * @type {{
5826
+ * (request: TReq|Properties<TReq>, callback: rpc.ServiceMethodCallback<TRes>): void;
5827
+ * (request: TReq|Properties<TReq>): Promise<TRes>;
5828
+ * readonly name: string;
5829
+ * readonly path: string;
5830
+ * readonly requestType: string;
5831
+ * readonly responseType: string;
5832
+ * readonly requestStream: true|undefined;
5833
+ * readonly responseStream: true|undefined;
5834
+ * }}
5734
5835
  */
5735
5836
 
5736
5837
  /**
@@ -5857,8 +5958,6 @@ var Method = require(13),
5857
5958
  util = require(28),
5858
5959
  rpc = require(22);
5859
5960
 
5860
- var reservedRe = util.patterns.reservedRe;
5861
-
5862
5961
  /**
5863
5962
  * Constructs a new service instance.
5864
5963
  * @classdesc Reflected service.
@@ -6038,11 +6137,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
6038
6137
  var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
6039
6138
  for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
6040
6139
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
6041
- rpcService[methodName] = util.codegen(["r","c"], reservedRe.test(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
6042
- m: method,
6043
- q: method.resolvedRequestType.ctor,
6044
- s: method.resolvedResponseType.ctor
6045
- });
6140
+ rpcService[methodName] = (function(method, requestType, responseType) {
6141
+ return function rpcMethod(request, callback) {
6142
+ return rpc.Service.prototype.rpcCall.call(this, method, requestType, responseType, request, callback);
6143
+ };
6144
+ })(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
6046
6145
  }
6047
6146
  return rpcService;
6048
6147
  };
@@ -6562,6 +6661,13 @@ function Type(name, options) {
6562
6661
  * @private
6563
6662
  */
6564
6663
  this._ctor = null;
6664
+
6665
+ /**
6666
+ * Cached fields by JSON name.
6667
+ * @type {Object.<string,Field>|null}
6668
+ * @private
6669
+ */
6670
+ this._fieldsByJsonName = null; // used by ext/protojson
6565
6671
  }
6566
6672
 
6567
6673
  Object.defineProperties(Type.prototype, {
@@ -6674,7 +6780,7 @@ Object.defineProperties(Type.prototype, {
6674
6780
  */
6675
6781
  Type.generateConstructor = function generateConstructor(mtype) {
6676
6782
  /* eslint-disable no-unexpected-multiline */
6677
- var gen = util.codegen(["p"], mtype.name);
6783
+ var gen = util.codegen(["p"]);
6678
6784
  // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype
6679
6785
  for (var i = 0, field; i < mtype.fieldsArray.length; ++i)
6680
6786
  if ((field = mtype._fieldsArray[i]).map) gen
@@ -6688,7 +6794,7 @@ Type.generateConstructor = function generateConstructor(mtype) {
6688
6794
  };
6689
6795
 
6690
6796
  function clearCache(type) {
6691
- type._fieldsById = type._fieldsArray = type._oneofsArray = null;
6797
+ type._fieldsById = type._fieldsArray = type._oneofsArray = type._fieldsByJsonName = null;
6692
6798
  delete type.encode;
6693
6799
  delete type.decode;
6694
6800
  delete type.verify;
@@ -6852,7 +6958,7 @@ Type.prototype.add = function add(object) {
6852
6958
  throw Error("duplicate id " + object.id + " in " + this);
6853
6959
  if (this.isReservedId(object.id))
6854
6960
  throw Error("id " + object.id + " is reserved in " + this);
6855
- if (this.isReservedName(object.name))
6961
+ if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
6856
6962
  throw Error("name '" + object.name + "' is reserved in " + this);
6857
6963
  if (object.name === "__proto__")
6858
6964
  return this;
@@ -6865,6 +6971,8 @@ Type.prototype.add = function add(object) {
6865
6971
  return clearCache(this);
6866
6972
  }
6867
6973
  if (object instanceof OneOf) {
6974
+ if (object.name.charAt(0) === "$")
6975
+ throw Error("name '" + object.name + "' is reserved in " + this);
6868
6976
  if (object.name === "__proto__")
6869
6977
  return this;
6870
6978
  if (!this.oneofs)
@@ -7412,6 +7520,7 @@ var camelCaseRe = /_([a-z])/g;
7412
7520
  * Converts a string to camel case.
7413
7521
  * @param {string} str String to convert
7414
7522
  * @returns {string} Converted string
7523
+ * @deprecated Use {@link util.jsonName} for protobuf field JSON names.
7415
7524
  */
7416
7525
  util.camelCase = function camelCase(str) {
7417
7526
  return str.substring(0, 1)
@@ -7419,6 +7528,28 @@ util.camelCase = function camelCase(str) {
7419
7528
  .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });
7420
7529
  };
7421
7530
 
7531
+ /**
7532
+ * Converts a proto field name to its protoc-compatible JSON name.
7533
+ * @param {string} str Proto field name
7534
+ * @returns {string} JSON name
7535
+ */
7536
+ util.jsonName = function jsonName(str) {
7537
+ var result = "",
7538
+ upperNext = false,
7539
+ i = 0;
7540
+ for (; i < str.length; ++i) {
7541
+ var ch = str.charAt(i);
7542
+ if (ch === "_")
7543
+ upperNext = true;
7544
+ else if (upperNext) {
7545
+ result += ch.toUpperCase();
7546
+ upperNext = false;
7547
+ } else
7548
+ result += ch;
7549
+ }
7550
+ return result;
7551
+ };
7552
+
7422
7553
  /**
7423
7554
  * Compares reflected fields by id.
7424
7555
  * @param {Field} a First field
@@ -8770,7 +8901,7 @@ util.isset =
8770
8901
  */
8771
8902
  util.isSet = function isSet(obj, prop) {
8772
8903
  var value = obj[prop];
8773
- if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
8904
+ if (value != null && Object.hasOwnProperty.call(obj, prop)) // eslint-disable-line eqeqeq
8774
8905
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
8775
8906
  return false;
8776
8907
  };
@@ -9558,7 +9689,7 @@ function genVerifyKey(gen, field, ref) {
9558
9689
  function verifier(mtype) {
9559
9690
  /* eslint-disable no-unexpected-multiline */
9560
9691
 
9561
- var gen = util.codegen(["m", "q"], mtype.name + "$verify")
9692
+ var gen = util.codegen(["m", "q"])
9562
9693
  ("if(typeof m!==\"object\"||m===null)")
9563
9694
  ("return%j", "object expected")
9564
9695
  ("if(q===undefined)q=0")
@@ -9574,7 +9705,7 @@ function verifier(mtype) {
9574
9705
  ref = "m" + util.safeProp(field.name);
9575
9706
 
9576
9707
  if (field.optional) gen
9577
- ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null
9708
+ ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name); // !== undefined && !== null
9578
9709
 
9579
9710
  // map fields
9580
9711
  if (field.map) { gen