protobufjs 7.6.1 → 7.6.3

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 v7.6.1 (c) 2016, daniel wirtz
3
- * compiled fri, 22 may 2026 02:52:08 utc
2
+ * protobuf.js v7.6.3 (c) 2016, daniel wirtz
3
+ * compiled tue, 09 jun 2026 20:47:47 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -1608,7 +1608,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1608
1608
  } gen
1609
1609
  ("}");
1610
1610
  } else gen
1611
- ("if(typeof d%s!==\"object\")", prop)
1611
+ ("if(!util.isObject(d%s))", prop)
1612
1612
  ("throw TypeError(%j)", field.fullName + ": object expected")
1613
1613
  ("m%s=types[%i].fromObject(d%s,n+1)", prop, fieldIndex, prop);
1614
1614
  } else {
@@ -1674,12 +1674,15 @@ converter.fromObject = function fromObject(mtype) {
1674
1674
  var fields = mtype.fieldsArray;
1675
1675
  var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")
1676
1676
  ("if(d instanceof this.ctor)")
1677
- ("return d")
1677
+ ("return d");
1678
+ if (!fields.length) return gen
1679
+ ("return new this.ctor");
1680
+ gen
1681
+ ("if(!util.isObject(d))")
1682
+ ("throw TypeError(%j)", mtype.fullName + ": object expected")
1678
1683
  ("if(n===undefined)n=0")
1679
1684
  ("if(n>util.recursionLimit)")
1680
1685
  ("throw Error(\"maximum nesting depth exceeded\")");
1681
- if (!fields.length) return gen
1682
- ("return new this.ctor");
1683
1686
  gen
1684
1687
  ("var m=new this.ctor");
1685
1688
  for (var i = 0; i < fields.length; ++i) {
@@ -1689,7 +1692,7 @@ converter.fromObject = function fromObject(mtype) {
1689
1692
  // Map fields
1690
1693
  if (field.map) { gen
1691
1694
  ("if(d%s){", prop)
1692
- ("if(typeof d%s!==\"object\")", prop)
1695
+ ("if(!util.isObject(d%s))", prop)
1693
1696
  ("throw TypeError(%j)", field.fullName + ": object expected")
1694
1697
  ("m%s={}", prop)
1695
1698
  ("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
@@ -1867,7 +1870,7 @@ converter.toObject = function toObject(mtype) {
1867
1870
  genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
1868
1871
  ("}");
1869
1872
  } else { gen
1870
- ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
1873
+ ("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
1871
1874
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
1872
1875
  if (field.partOf) gen
1873
1876
  ("if(o.oneofs)")
@@ -2009,7 +2012,7 @@ function decoder(mtype) {
2009
2012
  for (i = 0; i < mtype._fieldsArray.length; ++i) {
2010
2013
  var rfield = mtype._fieldsArray[i];
2011
2014
  if (rfield.required) gen
2012
- ("if(!m.hasOwnProperty(%j))", rfield.name)
2015
+ ("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
2013
2016
  ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
2014
2017
  }
2015
2018
 
@@ -6455,7 +6458,7 @@ Root._configure = function(Type_, parse_, common_) {
6455
6458
 
6456
6459
  },{"17":17,"18":18,"25":25,"27":27,"39":39}],32:[function(require,module,exports){
6457
6460
  "use strict";
6458
- module.exports = {};
6461
+ module.exports = Object.create(null);
6459
6462
 
6460
6463
  /**
6461
6464
  * Named roots.
@@ -6667,8 +6670,6 @@ var Method = require(24),
6667
6670
  util = require(39),
6668
6671
  rpc = require(33);
6669
6672
 
6670
- var reservedRe = util.patterns.reservedRe;
6671
-
6672
6673
  /**
6673
6674
  * Constructs a new service instance.
6674
6675
  * @classdesc Reflected service.
@@ -6843,11 +6844,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
6843
6844
  var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
6844
6845
  for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
6845
6846
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
6846
- rpcService[methodName] = util.codegen(["r","c"], reservedRe.test(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
6847
- m: method,
6848
- q: method.resolvedRequestType.ctor,
6849
- s: method.resolvedResponseType.ctor
6850
- });
6847
+ rpcService[methodName] = (function(method, requestType, responseType) {
6848
+ return function rpcMethod(request, callback) {
6849
+ return rpc.Service.prototype.rpcCall.call(this, method, requestType, responseType, request, callback);
6850
+ };
6851
+ })(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
6851
6852
  }
6852
6853
  return rpcService;
6853
6854
  };
@@ -7646,7 +7647,7 @@ Type.prototype.add = function add(object) {
7646
7647
  throw Error("duplicate id " + object.id + " in " + this);
7647
7648
  if (this.isReservedId(object.id))
7648
7649
  throw Error("id " + object.id + " is reserved in " + this);
7649
- if (this.isReservedName(object.name))
7650
+ if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
7650
7651
  throw Error("name '" + object.name + "' is reserved in " + this);
7651
7652
  if (object.name === "__proto__")
7652
7653
  return this;
@@ -7659,6 +7660,8 @@ Type.prototype.add = function add(object) {
7659
7660
  return clearCache(this);
7660
7661
  }
7661
7662
  if (object instanceof OneOf) {
7663
+ if (object.name.charAt(0) === "$")
7664
+ throw Error("name '" + object.name + "' is reserved in " + this);
7662
7665
  if (object.name === "__proto__")
7663
7666
  return this;
7664
7667
  if (!this.oneofs)
@@ -8669,7 +8672,7 @@ util.isset =
8669
8672
  */
8670
8673
  util.isSet = function isSet(obj, prop) {
8671
8674
  var value = obj[prop];
8672
- if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
8675
+ if (value != null && Object.hasOwnProperty.call(obj, prop)) // eslint-disable-line eqeqeq
8673
8676
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
8674
8677
  return false;
8675
8678
  };
@@ -9193,7 +9196,7 @@ function verifier(mtype) {
9193
9196
  ref = "m" + util.safeProp(field.name);
9194
9197
 
9195
9198
  if (field.optional) gen
9196
- ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null
9199
+ ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name); // !== undefined && !== null
9197
9200
 
9198
9201
  // map fields
9199
9202
  if (field.map) { gen