protobufjs 7.4.0 → 8.0.0-experimental

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.4.0 (c) 2016, daniel wirtz
3
- * compiled thu, 22 aug 2024 20:30:39 utc
2
+ * protobuf.js v8.0.0-experimental (c) 2016, daniel wirtz
3
+ * compiled fri, 21 mar 2025 17:14:14 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -1430,16 +1430,14 @@ function missing(field) {
1430
1430
  */
1431
1431
  function decoder(mtype) {
1432
1432
  /* eslint-disable no-unexpected-multiline */
1433
- var gen = util.codegen(["r", "l"], mtype.name + "$decode")
1433
+ var gen = util.codegen(["r", "l", "e"], mtype.name + "$decode")
1434
1434
  ("if(!(r instanceof Reader))")
1435
1435
  ("r=Reader.create(r)")
1436
1436
  ("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
1437
1437
  ("while(r.pos<c){")
1438
- ("var t=r.uint32()");
1439
- if (mtype.group) gen
1440
- ("if((t&7)===4)")
1441
- ("break");
1442
- gen
1438
+ ("var t=r.uint32()")
1439
+ ("if(t===e)")
1440
+ ("break")
1443
1441
  ("switch(t>>>3){");
1444
1442
 
1445
1443
  var i = 0;
@@ -1505,15 +1503,15 @@ function decoder(mtype) {
1505
1503
  ("}else");
1506
1504
 
1507
1505
  // Non-packed
1508
- if (types.basic[type] === undefined) gen(field.resolvedType.group
1509
- ? "%s.push(types[%i].decode(r))"
1506
+ if (types.basic[type] === undefined) gen(field.delimited
1507
+ ? "%s.push(types[%i].decode(r,undefined,((t&~7)|4)))"
1510
1508
  : "%s.push(types[%i].decode(r,r.uint32()))", ref, i);
1511
1509
  else gen
1512
1510
  ("%s.push(r.%s())", ref, type);
1513
1511
 
1514
1512
  // Non-repeated
1515
- } else if (types.basic[type] === undefined) gen(field.resolvedType.group
1516
- ? "%s=types[%i].decode(r)"
1513
+ } else if (types.basic[type] === undefined) gen(field.delimited
1514
+ ? "%s=types[%i].decode(r,undefined,((t&~7)|4))"
1517
1515
  : "%s=types[%i].decode(r,r.uint32())", ref, i);
1518
1516
  else gen
1519
1517
  ("%s=r.%s()", ref, type);
@@ -1560,7 +1558,7 @@ var Enum = require(14),
1560
1558
  * @ignore
1561
1559
  */
1562
1560
  function genTypePartial(gen, field, fieldIndex, ref) {
1563
- return field.resolvedType.group
1561
+ return field.delimited
1564
1562
  ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
1565
1563
  : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
1566
1564
  }
@@ -1703,6 +1701,18 @@ function Enum(name, values, options, comment, comments, valuesOptions) {
1703
1701
  */
1704
1702
  this.valuesOptions = valuesOptions;
1705
1703
 
1704
+ /**
1705
+ * Resolved values features, if any
1706
+ * @type {Object<string, Object<string, *>>|undefined}
1707
+ */
1708
+ this._valuesFeatures = {};
1709
+
1710
+ /**
1711
+ * Unresolved values features, if any
1712
+ * @type {Object<string, Object<string, *>>|undefined}
1713
+ */
1714
+ this._valuesProtoFeatures = {};
1715
+
1706
1716
  /**
1707
1717
  * Reserved ranges, if any.
1708
1718
  * @type {Array.<number[]|string>}
@@ -1719,6 +1729,22 @@ function Enum(name, values, options, comment, comments, valuesOptions) {
1719
1729
  this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i];
1720
1730
  }
1721
1731
 
1732
+ /**
1733
+ * Resolves value features
1734
+ * @returns {Enum} `this`
1735
+ */
1736
+ Enum.prototype.resolve = function resolve() {
1737
+ ReflectionObject.prototype.resolve.call(this);
1738
+
1739
+ for (var key of Object.keys(this._valuesProtoFeatures)) {
1740
+ var parentFeaturesCopy = Object.assign({}, this._features);
1741
+ this._valuesFeatures[key] = Object.assign(parentFeaturesCopy, this._valuesProtoFeatures[key] || {});
1742
+ }
1743
+
1744
+ return this;
1745
+ };
1746
+
1747
+
1722
1748
  /**
1723
1749
  * Enum descriptor.
1724
1750
  * @interface IEnum
@@ -1795,6 +1821,21 @@ Enum.prototype.add = function add(name, id, comment, options) {
1795
1821
  if (this.valuesOptions === undefined)
1796
1822
  this.valuesOptions = {};
1797
1823
  this.valuesOptions[name] = options || null;
1824
+
1825
+ for (var key of Object.keys(this.valuesOptions)) {
1826
+ var features = Array.isArray(this.valuesOptions[key]) ? this.valuesOptions[key].find(x => {return Object.prototype.hasOwnProperty.call(x, "features");}) : this.valuesOptions[key] === "features";
1827
+ if (features) {
1828
+ this._valuesProtoFeatures[key] = features.features;
1829
+ } else {
1830
+ this._valuesProtoFeatures[key] = {};
1831
+ }
1832
+ }
1833
+ }
1834
+
1835
+ for (var enumValue of Object.keys(this.values)) {
1836
+ if (!this._valuesProtoFeatures[enumValue]) {
1837
+ this._valuesProtoFeatures[enumValue] = {};
1838
+ }
1798
1839
  }
1799
1840
 
1800
1841
  this.comments[name] = comment || null;
@@ -1952,18 +1993,6 @@ function Field(name, id, type, rule, extend, options, comment) {
1952
1993
  */
1953
1994
  this.extend = extend || undefined; // toJSON
1954
1995
 
1955
- /**
1956
- * Whether this field is required.
1957
- * @type {boolean}
1958
- */
1959
- this.required = rule === "required";
1960
-
1961
- /**
1962
- * Whether this field is optional.
1963
- * @type {boolean}
1964
- */
1965
- this.optional = !this.required;
1966
-
1967
1996
  /**
1968
1997
  * Whether this field is repeated.
1969
1998
  * @type {boolean}
@@ -2030,13 +2059,6 @@ function Field(name, id, type, rule, extend, options, comment) {
2030
2059
  */
2031
2060
  this.declaringField = null;
2032
2061
 
2033
- /**
2034
- * Internally remembers whether this field is packed.
2035
- * @type {boolean|null}
2036
- * @private
2037
- */
2038
- this._packed = null;
2039
-
2040
2062
  /**
2041
2063
  * Comment for this field.
2042
2064
  * @type {string|null}
@@ -2045,17 +2067,69 @@ function Field(name, id, type, rule, extend, options, comment) {
2045
2067
  }
2046
2068
 
2047
2069
  /**
2048
- * Determines whether this field is packed. Only relevant when repeated and working with proto2.
2070
+ * Determines whether this field is required.
2071
+ * @name Field#required
2072
+ * @type {boolean}
2073
+ * @readonly
2074
+ */
2075
+ Object.defineProperty(Field.prototype, "required", {
2076
+ get: function() {
2077
+ return this._features.field_presence === "LEGACY_REQUIRED";
2078
+ }
2079
+ });
2080
+
2081
+ /**
2082
+ * Determines whether this field is not required.
2083
+ * @name Field#optional
2084
+ * @type {boolean}
2085
+ * @readonly
2086
+ */
2087
+ Object.defineProperty(Field.prototype, "optional", {
2088
+ get: function() {
2089
+ return !this.required;
2090
+ }
2091
+ });
2092
+
2093
+ /**
2094
+ * Determines whether this field uses tag-delimited encoding. In proto2 this
2095
+ * corresponded to group syntax.
2096
+ * @name Field#delimited
2097
+ * @type {boolean}
2098
+ * @readonly
2099
+ */
2100
+ Object.defineProperty(Field.prototype, "delimited", {
2101
+ get: function() {
2102
+ return this.resolvedType instanceof Type &&
2103
+ this._features.message_encoding === "DELIMITED";
2104
+ }
2105
+ });
2106
+
2107
+ /**
2108
+ * Determines whether this field is packed. Only relevant when repeated.
2049
2109
  * @name Field#packed
2050
2110
  * @type {boolean}
2051
2111
  * @readonly
2052
2112
  */
2053
2113
  Object.defineProperty(Field.prototype, "packed", {
2054
2114
  get: function() {
2055
- // defaults to packed=true if not explicity set to false
2056
- if (this._packed === null)
2057
- this._packed = this.getOption("packed") !== false;
2058
- return this._packed;
2115
+ return this._features.repeated_field_encoding === "PACKED";
2116
+ }
2117
+ });
2118
+
2119
+ /**
2120
+ * Determines whether this field tracks presence.
2121
+ * @name Field#hasPresence
2122
+ * @type {boolean}
2123
+ * @readonly
2124
+ */
2125
+ Object.defineProperty(Field.prototype, "hasPresence", {
2126
+ get: function() {
2127
+ if (this.repeated || this.map) {
2128
+ return false;
2129
+ }
2130
+ return this.partOf || // oneofs
2131
+ this.declaringField || this.extensionField || // extensions
2132
+ this._features.field_presence !== "IMPLICIT";
2059
2133
  }
2060
2134
  });
2061
2135
 
@@ -2063,8 +2137,6 @@ Object.defineProperty(Field.prototype, "packed", {
2063
2137
  * @override
2064
2138
  */
2065
2139
  Field.prototype.setOption = function setOption(name, value, ifNotSet) {
2066
- if (name === "packed") // clear cached before setting
2067
- this._packed = null;
2068
2140
  return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);
2069
2141
  };
2070
2142
 
@@ -2131,7 +2203,7 @@ Field.prototype.resolve = function resolve() {
2131
2203
 
2132
2204
  // remove unnecessary options
2133
2205
  if (this.options) {
2134
- if (this.options.packed === true || this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))
2206
+ if (this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum))
2135
2207
  delete this.options.packed;
2136
2208
  if (!Object.keys(this.options).length)
2137
2209
  this.options = undefined;
@@ -2169,6 +2241,30 @@ Field.prototype.resolve = function resolve() {
2169
2241
  return ReflectionObject.prototype.resolve.call(this);
2170
2242
  };
2171
2243
 
2244
+ /**
2245
+ * Infers field features from legacy syntax that may have been specified differently.
2246
+ * in older editions.
2247
+ * @param {string|undefined} edition The edition this proto is on, or undefined if pre-editions
2248
+ * @returns {object} The feature values to override
2249
+ */
2250
+ Field.prototype._inferLegacyProtoFeatures = function _inferLegacyProtoFeatures(edition) {
2251
+ if (edition) return {};
2252
+
2253
+ var features = {};
2254
+ if (this.rule === "required") {
2255
+ features.field_presence = "LEGACY_REQUIRED";
2256
+ }
2257
+ if (this.resolvedType instanceof Type && this.resolvedType.group) {
2258
+ features.message_encoding = "DELIMITED";
2259
+ }
2260
+ if (this.getOption("packed") === true) {
2261
+ features.repeated_field_encoding = "PACKED";
2262
+ } else if (this.getOption("packed") === false) {
2263
+ features.repeated_field_encoding = "EXPANDED";
2264
+ }
2265
+ return features;
2266
+ };
2267
+
2172
2268
  /**
2173
2269
  * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).
2174
2270
  * @typedef FieldDecorator
@@ -3102,12 +3198,13 @@ Namespace.prototype.define = function define(path, json) {
3102
3198
  */
3103
3199
  Namespace.prototype.resolveAll = function resolveAll() {
3104
3200
  var nested = this.nestedArray, i = 0;
3201
+ this.resolve();
3105
3202
  while (i < nested.length)
3106
3203
  if (nested[i] instanceof Namespace)
3107
3204
  nested[i++].resolveAll();
3108
3205
  else
3109
3206
  nested[i++].resolve();
3110
- return this.resolve();
3207
+ return this;
3111
3208
  };
3112
3209
 
3113
3210
  /**
@@ -3238,10 +3335,17 @@ module.exports = ReflectionObject;
3238
3335
 
3239
3336
  ReflectionObject.className = "ReflectionObject";
3240
3337
 
3338
+ const OneOf = require(23);
3241
3339
  var util = require(33);
3242
3340
 
3243
3341
  var Root; // cyclic
3244
3342
 
3343
+ /* eslint-disable no-warning-comments */
3344
+ // TODO: Replace with embedded proto.
3345
+ var editions2023Defaults = {enum_type: "OPEN", field_presence: "EXPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY"};
3346
+ var proto2Defaults = {enum_type: "CLOSED", field_presence: "EXPLICIT", json_format: "LEGACY_BEST_EFFORT", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "EXPANDED", utf8_validation: "NONE"};
3347
+ var proto3Defaults = {enum_type: "OPEN", field_presence: "IMPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY"};
3348
+
3245
3349
  /**
3246
3350
  * Constructs a new reflection object instance.
3247
3351
  * @classdesc Base class of all reflection objects.
@@ -3276,6 +3380,16 @@ function ReflectionObject(name, options) {
3276
3380
  */
3277
3381
  this.name = name;
3278
3382
 
3383
+ /**
3384
+ * Resolved Features.
3385
+ */
3386
+ this._features = {};
3387
+
3388
+ /**
3389
+ * Unresolved Features.
3390
+ */
3391
+ this._protoFeatures = null;
3392
+
3279
3393
  /**
3280
3394
  * Parent namespace.
3281
3395
  * @type {Namespace|null}
@@ -3381,11 +3495,65 @@ ReflectionObject.prototype.onRemove = function onRemove(parent) {
3381
3495
  ReflectionObject.prototype.resolve = function resolve() {
3382
3496
  if (this.resolved)
3383
3497
  return this;
3384
- if (this.root instanceof Root)
3385
- this.resolved = true; // only if part of a root
3498
+ if (this instanceof Root || this.parent && this.parent.resolved) {
3499
+ this._resolveFeatures();
3500
+ this.resolved = true;
3501
+ }
3386
3502
  return this;
3387
3503
  };
3388
3504
 
3505
+ /**
3506
+ * Resolves child features from parent features
3507
+ * @returns {undefined}
3508
+ */
3509
+ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures() {
3510
+ var defaults = {};
3511
+
3512
+ var edition = this.root.getOption("edition");
3513
+ if (this instanceof Root) {
3514
+ if (this.root.getOption("syntax") === "proto3") {
3515
+ defaults = Object.assign({}, proto3Defaults);
3516
+ } else if (edition === "2023") {
3517
+ defaults = Object.assign({}, editions2023Defaults);
3518
+ } else {
3519
+ defaults = Object.assign({}, proto2Defaults);
3520
+ }
3521
+ }
3522
+
3523
+ var protoFeatures = Object.assign(Object.assign({}, this._protoFeatures), this._inferLegacyProtoFeatures(edition));
3524
+
3525
+ if (this instanceof Root) {
3526
+ this._features = Object.assign(defaults, protoFeatures || {});
3527
+ // fields in Oneofs aren't actually children of them, so we have to
3528
+ // special-case it
3529
+ } else if (this.partOf instanceof OneOf) {
3530
+ var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features);
3531
+ this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {});
3532
+ } else if (this.declaringField) {
3533
+ // Skip feature resolution of sister fields.
3534
+ } else if (this.parent) {
3535
+ var parentFeaturesCopy = Object.assign({}, this.parent._features);
3536
+ this._features = Object.assign(parentFeaturesCopy, protoFeatures || {});
3537
+ } else {
3538
+ this._features = Object.assign({}, protoFeatures);
3539
+ }
3540
+ if (this.extensionField) {
3541
+ // Sister fields should have the same features as their extensions.
3542
+ this.extensionField._features = this._features;
3543
+ }
3544
+ };
3545
+
3546
+ /**
3547
+ * Infers features from legacy syntax that may have been specified differently.
3548
+ * in older editions.
3549
+ * @param {string|undefined} edition The edition this proto is on, or undefined if pre-editions
3550
+ * @returns {object} The feature values to override
3551
+ * @abstract
3552
+ */
3553
+ ReflectionObject.prototype._inferLegacyProtoFeatures = function _inferLegacyProtoFeatures(/*edition*/) {
3554
+ return {};
3555
+ };
3556
+
3389
3557
  /**
3390
3558
  * Gets an option value.
3391
3559
  * @param {string} name Option name
@@ -3421,6 +3589,7 @@ ReflectionObject.prototype.setParsedOption = function setParsedOption(name, valu
3421
3589
  if (!this.parsedOptions) {
3422
3590
  this.parsedOptions = [];
3423
3591
  }
3592
+ var isFeature = /^features$/.test(name);
3424
3593
  var parsedOptions = this.parsedOptions;
3425
3594
  if (propName) {
3426
3595
  // If setting a sub property of an option then try to merge it
@@ -3430,10 +3599,11 @@ ReflectionObject.prototype.setParsedOption = function setParsedOption(name, valu
3430
3599
  });
3431
3600
  if (opt) {
3432
3601
  // If we found an existing option - just merge the property value
3602
+ // (If it's a feature, will just write over)
3433
3603
  var newValue = opt[name];
3434
3604
  util.setProperty(newValue, propName, value);
3435
3605
  } else {
3436
- // otherwise, create a new option, set it's property and add it to the list
3606
+ // otherwise, create a new option, set its property and add it to the list
3437
3607
  opt = {};
3438
3608
  opt[name] = util.setProperty({}, propName, value);
3439
3609
  parsedOptions.push(opt);
@@ -3444,6 +3614,13 @@ ReflectionObject.prototype.setParsedOption = function setParsedOption(name, valu
3444
3614
  newOpt[name] = value;
3445
3615
  parsedOptions.push(newOpt);
3446
3616
  }
3617
+
3618
+
3619
+ if (isFeature) {
3620
+ var features = parsedOptions.find(x => {return Object.prototype.hasOwnProperty.call(x, "features");});
3621
+ this._protoFeatures = features.features || {};
3622
+ }
3623
+
3447
3624
  return this;
3448
3625
  };
3449
3626
 
@@ -3477,7 +3654,7 @@ ReflectionObject._configure = function(Root_) {
3477
3654
  Root = Root_;
3478
3655
  };
3479
3656
 
3480
- },{"33":33}],23:[function(require,module,exports){
3657
+ },{"23":23,"33":33}],23:[function(require,module,exports){
3481
3658
  "use strict";
3482
3659
  module.exports = OneOf;
3483
3660
 
@@ -3651,6 +3828,25 @@ OneOf.prototype.onRemove = function onRemove(parent) {
3651
3828
  ReflectionObject.prototype.onRemove.call(this, parent);
3652
3829
  };
3653
3830
 
3831
+ /**
3832
+ * Determines whether this field corresponds to a synthetic oneof created for
3833
+ * a proto3 optional field. No behavioral logic should depend on this, but it
3834
+ * can be relevant for reflection.
3835
+ * @name OneOf#isProto3Optional
3836
+ * @type {boolean}
3837
+ * @readonly
3838
+ */
3839
+ Object.defineProperty(OneOf.prototype, "isProto3Optional", {
3840
+ get: function() {
3841
+ if (this.fieldsArray == null || this.fieldsArray.length !== 1) {
3842
+ return false;
3843
+ }
3844
+
3845
+ var field = this.fieldsArray[0];
3846
+ return field.options != null && field.options["proto3_optional"] === true;
3847
+ }
3848
+ });
3849
+
3654
3850
  /**
3655
3851
  * Decorator function as returned by {@link OneOf.d} (TypeScript).
3656
3852
  * @typedef OneOfDecorator
@@ -4195,7 +4391,7 @@ function Root(options) {
4195
4391
 
4196
4392
  /**
4197
4393
  * Loads a namespace descriptor into a root namespace.
4198
- * @param {INamespace} json Nameespace descriptor
4394
+ * @param {INamespace} json Namespace descriptor
4199
4395
  * @param {Root} [root] Root namespace, defaults to create a new one if omitted
4200
4396
  * @returns {Root} Root namespace
4201
4397
  */
@@ -4244,20 +4440,26 @@ Root.prototype.load = function load(filename, options, callback) {
4244
4440
  options = undefined;
4245
4441
  }
4246
4442
  var self = this;
4247
- if (!callback)
4443
+ if (!callback) {
4248
4444
  return util.asPromise(load, self, filename, options);
4445
+ }
4249
4446
 
4250
4447
  var sync = callback === SYNC; // undocumented
4251
4448
 
4252
4449
  // Finishes loading by calling the callback (exactly once)
4253
4450
  function finish(err, root) {
4254
4451
  /* istanbul ignore if */
4255
- if (!callback)
4452
+ if (!callback) {
4256
4453
  return;
4257
- if (sync)
4454
+ }
4455
+ if (sync) {
4258
4456
  throw err;
4457
+ }
4259
4458
  var cb = callback;
4260
4459
  callback = null;
4460
+ if (root) {
4461
+ root.resolveAll();
4462
+ }
4261
4463
  cb(err, root);
4262
4464
  }
4263
4465
 
@@ -4295,8 +4497,9 @@ Root.prototype.load = function load(filename, options, callback) {
4295
4497
  } catch (err) {
4296
4498
  finish(err);
4297
4499
  }
4298
- if (!sync && !queued)
4500
+ if (!sync && !queued) {
4299
4501
  finish(null, self); // only once anyway
4502
+ }
4300
4503
  }
4301
4504
 
4302
4505
  // Fetches a single file
@@ -4304,15 +4507,16 @@ Root.prototype.load = function load(filename, options, callback) {
4304
4507
  filename = getBundledFileName(filename) || filename;
4305
4508
 
4306
4509
  // Skip if already loaded / attempted
4307
- if (self.files.indexOf(filename) > -1)
4510
+ if (self.files.indexOf(filename) > -1) {
4308
4511
  return;
4512
+ }
4309
4513
  self.files.push(filename);
4310
4514
 
4311
4515
  // Shortcut bundled definitions
4312
4516
  if (filename in common) {
4313
- if (sync)
4517
+ if (sync) {
4314
4518
  process(filename, common[filename]);
4315
- else {
4519
+ } else {
4316
4520
  ++queued;
4317
4521
  setTimeout(function() {
4318
4522
  --queued;
@@ -4338,8 +4542,9 @@ Root.prototype.load = function load(filename, options, callback) {
4338
4542
  self.fetch(filename, function(err, source) {
4339
4543
  --queued;
4340
4544
  /* istanbul ignore if */
4341
- if (!callback)
4545
+ if (!callback) {
4342
4546
  return; // terminated meanwhile
4547
+ }
4343
4548
  if (err) {
4344
4549
  /* istanbul ignore else */
4345
4550
  if (!weak)
@@ -4356,17 +4561,21 @@ Root.prototype.load = function load(filename, options, callback) {
4356
4561
 
4357
4562
  // Assembling the root namespace doesn't require working type
4358
4563
  // references anymore, so we can load everything in parallel
4359
- if (util.isString(filename))
4564
+ if (util.isString(filename)) {
4360
4565
  filename = [ filename ];
4566
+ }
4361
4567
  for (var i = 0, resolved; i < filename.length; ++i)
4362
4568
  if (resolved = self.resolvePath("", filename[i]))
4363
4569
  fetch(resolved);
4364
-
4365
- if (sync)
4570
+ self.resolveAll();
4571
+ if (sync) {
4366
4572
  return self;
4367
- if (!queued)
4573
+ }
4574
+ if (!queued) {
4368
4575
  finish(null, self);
4369
- return undefined;
4576
+ }
4577
+
4578
+ return self;
4370
4579
  };
4371
4580
  // function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined
4372
4581
 
@@ -4834,10 +5043,11 @@ Service.prototype.get = function get(name) {
4834
5043
  * @override
4835
5044
  */
4836
5045
  Service.prototype.resolveAll = function resolveAll() {
5046
+ Namespace.prototype.resolve.call(this);
4837
5047
  var methods = this.methodsArray;
4838
5048
  for (var i = 0; i < methods.length; ++i)
4839
5049
  methods[i].resolve();
4840
- return Namespace.prototype.resolve.call(this);
5050
+ return this;
4841
5051
  };
4842
5052
 
4843
5053
  /**
@@ -5196,13 +5406,14 @@ Type.prototype.toJSON = function toJSON(toJSONOptions) {
5196
5406
  * @override
5197
5407
  */
5198
5408
  Type.prototype.resolveAll = function resolveAll() {
5199
- var fields = this.fieldsArray, i = 0;
5200
- while (i < fields.length)
5201
- fields[i++].resolve();
5409
+ Namespace.prototype.resolveAll.call(this);
5202
5410
  var oneofs = this.oneofsArray; i = 0;
5203
5411
  while (i < oneofs.length)
5204
5412
  oneofs[i++].resolve();
5205
- return Namespace.prototype.resolveAll.call(this);
5413
+ var fields = this.fieldsArray, i = 0;
5414
+ while (i < fields.length)
5415
+ fields[i++].resolve();
5416
+ return this;
5206
5417
  };
5207
5418
 
5208
5419
  /**
@@ -5857,6 +6068,7 @@ util.decorateEnum = function decorateEnum(object) {
5857
6068
  * @param {Object.<string,*>} dst Destination object
5858
6069
  * @param {string} path dot '.' delimited path of the property to set
5859
6070
  * @param {Object} value the value to set
6071
+ * @param {boolean} overWrite whether or not to concatenate the values into an array or overwrite; defaults to false.
5860
6072
  * @returns {Object.<string,*>} Destination object
5861
6073
  */
5862
6074
  util.setProperty = function setProperty(dst, path, value) {