protobufjs 7.6.2 → 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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.6.2 (c) 2016, daniel wirtz
3
- * compiled sat, 30 may 2026 21:57:57 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
  */
@@ -1273,14 +1273,15 @@ converter.fromObject = function fromObject(mtype) {
1273
1273
  var fields = mtype.fieldsArray;
1274
1274
  var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")
1275
1275
  ("if(d instanceof this.ctor)")
1276
- ("return d")
1276
+ ("return d");
1277
+ if (!fields.length) return gen
1278
+ ("return new this.ctor");
1279
+ gen
1277
1280
  ("if(!util.isObject(d))")
1278
1281
  ("throw TypeError(%j)", mtype.fullName + ": object expected")
1279
1282
  ("if(n===undefined)n=0")
1280
1283
  ("if(n>util.recursionLimit)")
1281
1284
  ("throw Error(\"maximum nesting depth exceeded\")");
1282
- if (!fields.length) return gen
1283
- ("return new this.ctor");
1284
1285
  gen
1285
1286
  ("var m=new this.ctor");
1286
1287
  for (var i = 0; i < fields.length; ++i) {
@@ -1468,7 +1469,7 @@ converter.toObject = function toObject(mtype) {
1468
1469
  genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
1469
1470
  ("}");
1470
1471
  } else { gen
1471
- ("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
1472
+ ("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
1472
1473
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
1473
1474
  if (field.partOf) gen
1474
1475
  ("if(o.oneofs)")
@@ -1610,7 +1611,7 @@ function decoder(mtype) {
1610
1611
  for (i = 0; i < mtype._fieldsArray.length; ++i) {
1611
1612
  var rfield = mtype._fieldsArray[i];
1612
1613
  if (rfield.required) gen
1613
- ("if(!m.hasOwnProperty(%j))", rfield.name)
1614
+ ("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
1614
1615
  ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
1615
1616
  }
1616
1617
 
@@ -5263,8 +5264,6 @@ var Method = require(22),
5263
5264
  util = require(35),
5264
5265
  rpc = require(30);
5265
5266
 
5266
- var reservedRe = util.patterns.reservedRe;
5267
-
5268
5267
  /**
5269
5268
  * Constructs a new service instance.
5270
5269
  * @classdesc Reflected service.
@@ -5439,11 +5438,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
5439
5438
  var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
5440
5439
  for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
5441
5440
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
5442
- rpcService[methodName] = util.codegen(["r","c"], reservedRe.test(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
5443
- m: method,
5444
- q: method.resolvedRequestType.ctor,
5445
- s: method.resolvedResponseType.ctor
5446
- });
5441
+ rpcService[methodName] = (function(method, requestType, responseType) {
5442
+ return function rpcMethod(request, callback) {
5443
+ return rpc.Service.prototype.rpcCall.call(this, method, requestType, responseType, request, callback);
5444
+ };
5445
+ })(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
5447
5446
  }
5448
5447
  return rpcService;
5449
5448
  };
@@ -5824,7 +5823,7 @@ Type.prototype.add = function add(object) {
5824
5823
  throw Error("duplicate id " + object.id + " in " + this);
5825
5824
  if (this.isReservedId(object.id))
5826
5825
  throw Error("id " + object.id + " is reserved in " + this);
5827
- if (this.isReservedName(object.name))
5826
+ if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
5828
5827
  throw Error("name '" + object.name + "' is reserved in " + this);
5829
5828
  if (object.name === "__proto__")
5830
5829
  return this;
@@ -5837,6 +5836,8 @@ Type.prototype.add = function add(object) {
5837
5836
  return clearCache(this);
5838
5837
  }
5839
5838
  if (object instanceof OneOf) {
5839
+ if (object.name.charAt(0) === "$")
5840
+ throw Error("name '" + object.name + "' is reserved in " + this);
5840
5841
  if (object.name === "__proto__")
5841
5842
  return this;
5842
5843
  if (!this.oneofs)
@@ -6847,7 +6848,7 @@ util.isset =
6847
6848
  */
6848
6849
  util.isSet = function isSet(obj, prop) {
6849
6850
  var value = obj[prop];
6850
- if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
6851
+ if (value != null && Object.hasOwnProperty.call(obj, prop)) // eslint-disable-line eqeqeq
6851
6852
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
6852
6853
  return false;
6853
6854
  };
@@ -7371,7 +7372,7 @@ function verifier(mtype) {
7371
7372
  ref = "m" + util.safeProp(field.name);
7372
7373
 
7373
7374
  if (field.optional) gen
7374
- ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null
7375
+ ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name); // !== undefined && !== null
7375
7376
 
7376
7377
  // map fields
7377
7378
  if (field.map) { gen