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.
@@ -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
  */
@@ -1207,7 +1207,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1207
1207
  } gen
1208
1208
  ("}");
1209
1209
  } else gen
1210
- ("if(typeof d%s!==\"object\")", prop)
1210
+ ("if(!util.isObject(d%s))", prop)
1211
1211
  ("throw TypeError(%j)", field.fullName + ": object expected")
1212
1212
  ("m%s=types[%i].fromObject(d%s,n+1)", prop, fieldIndex, prop);
1213
1213
  } else {
@@ -1273,12 +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
1280
+ ("if(!util.isObject(d))")
1281
+ ("throw TypeError(%j)", mtype.fullName + ": object expected")
1277
1282
  ("if(n===undefined)n=0")
1278
1283
  ("if(n>util.recursionLimit)")
1279
1284
  ("throw Error(\"maximum nesting depth exceeded\")");
1280
- if (!fields.length) return gen
1281
- ("return new this.ctor");
1282
1285
  gen
1283
1286
  ("var m=new this.ctor");
1284
1287
  for (var i = 0; i < fields.length; ++i) {
@@ -1288,7 +1291,7 @@ converter.fromObject = function fromObject(mtype) {
1288
1291
  // Map fields
1289
1292
  if (field.map) { gen
1290
1293
  ("if(d%s){", prop)
1291
- ("if(typeof d%s!==\"object\")", prop)
1294
+ ("if(!util.isObject(d%s))", prop)
1292
1295
  ("throw TypeError(%j)", field.fullName + ": object expected")
1293
1296
  ("m%s={}", prop)
1294
1297
  ("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
@@ -1466,7 +1469,7 @@ converter.toObject = function toObject(mtype) {
1466
1469
  genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
1467
1470
  ("}");
1468
1471
  } else { gen
1469
- ("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
1470
1473
  genValuePartial_toObject(gen, field, /* sorted */ index, prop);
1471
1474
  if (field.partOf) gen
1472
1475
  ("if(o.oneofs)")
@@ -1608,7 +1611,7 @@ function decoder(mtype) {
1608
1611
  for (i = 0; i < mtype._fieldsArray.length; ++i) {
1609
1612
  var rfield = mtype._fieldsArray[i];
1610
1613
  if (rfield.required) gen
1611
- ("if(!m.hasOwnProperty(%j))", rfield.name)
1614
+ ("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
1612
1615
  ("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
1613
1616
  }
1614
1617
 
@@ -5049,7 +5052,7 @@ Root._configure = function(Type_, parse_, common_) {
5049
5052
 
5050
5053
  },{"16":16,"17":17,"23":23,"25":25,"35":35}],29:[function(require,module,exports){
5051
5054
  "use strict";
5052
- module.exports = {};
5055
+ module.exports = Object.create(null);
5053
5056
 
5054
5057
  /**
5055
5058
  * Named roots.
@@ -5261,8 +5264,6 @@ var Method = require(22),
5261
5264
  util = require(35),
5262
5265
  rpc = require(30);
5263
5266
 
5264
- var reservedRe = util.patterns.reservedRe;
5265
-
5266
5267
  /**
5267
5268
  * Constructs a new service instance.
5268
5269
  * @classdesc Reflected service.
@@ -5437,11 +5438,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
5437
5438
  var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
5438
5439
  for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
5439
5440
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
5440
- rpcService[methodName] = util.codegen(["r","c"], reservedRe.test(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
5441
- m: method,
5442
- q: method.resolvedRequestType.ctor,
5443
- s: method.resolvedResponseType.ctor
5444
- });
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);
5445
5446
  }
5446
5447
  return rpcService;
5447
5448
  };
@@ -5822,7 +5823,7 @@ Type.prototype.add = function add(object) {
5822
5823
  throw Error("duplicate id " + object.id + " in " + this);
5823
5824
  if (this.isReservedId(object.id))
5824
5825
  throw Error("id " + object.id + " is reserved in " + this);
5825
- if (this.isReservedName(object.name))
5826
+ if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
5826
5827
  throw Error("name '" + object.name + "' is reserved in " + this);
5827
5828
  if (object.name === "__proto__")
5828
5829
  return this;
@@ -5835,6 +5836,8 @@ Type.prototype.add = function add(object) {
5835
5836
  return clearCache(this);
5836
5837
  }
5837
5838
  if (object instanceof OneOf) {
5839
+ if (object.name.charAt(0) === "$")
5840
+ throw Error("name '" + object.name + "' is reserved in " + this);
5838
5841
  if (object.name === "__proto__")
5839
5842
  return this;
5840
5843
  if (!this.oneofs)
@@ -6845,7 +6848,7 @@ util.isset =
6845
6848
  */
6846
6849
  util.isSet = function isSet(obj, prop) {
6847
6850
  var value = obj[prop];
6848
- 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
6849
6852
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
6850
6853
  return false;
6851
6854
  };
@@ -7369,7 +7372,7 @@ function verifier(mtype) {
7369
7372
  ref = "m" + util.safeProp(field.name);
7370
7373
 
7371
7374
  if (field.optional) gen
7372
- ("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
7373
7376
 
7374
7377
  // map fields
7375
7378
  if (field.map) { gen