protobufjs 8.4.0 → 8.4.2
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/README.md +45 -31
- package/dist/light/protobuf.js +112 -78
- package/dist/light/protobuf.js.map +1 -1
- package/dist/light/protobuf.min.js +3 -3
- package/dist/light/protobuf.min.js.map +1 -1
- package/dist/minimal/protobuf.js +41 -19
- package/dist/minimal/protobuf.js.map +1 -1
- package/dist/minimal/protobuf.min.js +3 -3
- package/dist/minimal/protobuf.min.js.map +1 -1
- package/dist/protobuf.js +121 -84
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/ext/descriptor.js +31 -9
- package/index.d.ts +20 -8
- package/package.json +1 -1
- package/src/converter.js +9 -6
- package/src/decoder.js +3 -1
- package/src/encoder.js +8 -5
- package/src/enum.js +2 -2
- package/src/field.js +2 -5
- package/src/index-light.js +1 -1
- package/src/message.js +1 -1
- package/src/namespace.js +1 -1
- package/src/object.js +6 -6
- package/src/parse.js +9 -6
- package/src/root.js +14 -8
- package/src/type.js +8 -8
- package/src/typescript.js +6 -0
- package/src/util/eventemitter.js +4 -2
- package/src/util/minimal.js +24 -6
- package/src/util/patterns.js +0 -1
- package/src/util.js +2 -3
- package/src/wrappers.js +11 -8
- package/src/writer.js +11 -9
package/dist/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.4.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.4.2 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled fri, 22 may 2026 02:44:15 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -505,14 +505,14 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
505
505
|
("m%s=d%s|0", prop, prop);
|
|
506
506
|
break;
|
|
507
507
|
case "uint64":
|
|
508
|
+
case "fixed64":
|
|
508
509
|
isUnsigned = true;
|
|
509
510
|
// eslint-disable-next-line no-fallthrough
|
|
510
511
|
case "int64":
|
|
511
512
|
case "sint64":
|
|
512
|
-
case "fixed64":
|
|
513
513
|
case "sfixed64": gen
|
|
514
514
|
("if(util.Long)")
|
|
515
|
-
("
|
|
515
|
+
("m%s=util.Long.fromValue(d%s,%j)", prop, prop, isUnsigned)
|
|
516
516
|
("else if(typeof d%s===\"string\")", prop)
|
|
517
517
|
("m%s=parseInt(d%s,10)", prop, prop)
|
|
518
518
|
("else if(typeof d%s===\"number\")", prop)
|
|
@@ -637,7 +637,7 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
|
|
|
637
637
|
if (field.resolvedType instanceof Enum) gen
|
|
638
638
|
("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", dstProp, fieldIndex, srcProp, srcProp, fieldIndex, srcProp, srcProp);
|
|
639
639
|
else gen
|
|
640
|
-
("d%s=types[%i].toObject(m%s,o)", dstProp, fieldIndex, srcProp);
|
|
640
|
+
("d%s=types[%i].toObject(m%s,o,q+1)", dstProp, fieldIndex, srcProp);
|
|
641
641
|
} else {
|
|
642
642
|
var isUnsigned = false;
|
|
643
643
|
switch (field.type) {
|
|
@@ -646,11 +646,11 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
|
|
|
646
646
|
("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", dstProp, srcProp, srcProp, srcProp);
|
|
647
647
|
break;
|
|
648
648
|
case "uint64":
|
|
649
|
+
case "fixed64":
|
|
649
650
|
isUnsigned = true;
|
|
650
651
|
// eslint-disable-next-line no-fallthrough
|
|
651
652
|
case "int64":
|
|
652
653
|
case "sint64":
|
|
653
|
-
case "fixed64":
|
|
654
654
|
case "sfixed64": gen
|
|
655
655
|
("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
|
|
656
656
|
("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", dstProp, srcProp, srcProp, srcProp, srcProp, isUnsigned)
|
|
@@ -681,9 +681,12 @@ converter.toObject = function toObject(mtype) {
|
|
|
681
681
|
var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
|
|
682
682
|
if (!fields.length)
|
|
683
683
|
return util.codegen()("return {}");
|
|
684
|
-
var gen = util.codegen(["m", "o"], mtype.name + "$toObject")
|
|
684
|
+
var gen = util.codegen(["m", "o", "q"], mtype.name + "$toObject")
|
|
685
685
|
("if(!o)")
|
|
686
686
|
("o={}")
|
|
687
|
+
("if(q===undefined)q=0")
|
|
688
|
+
("if(q>util.recursionLimit)")
|
|
689
|
+
("throw Error(\"max depth exceeded\")")
|
|
687
690
|
("var d={}");
|
|
688
691
|
|
|
689
692
|
var repeatedFields = [],
|
|
@@ -769,7 +772,7 @@ converter.toObject = function toObject(mtype) {
|
|
|
769
772
|
} else { gen
|
|
770
773
|
("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name); // !== undefined && !== null
|
|
771
774
|
genValuePartial_toObject(gen, field, /* sorted */ index, prop);
|
|
772
|
-
if (field.partOf) gen
|
|
775
|
+
if (field.partOf && !field.partOf.isProto3Optional) gen
|
|
773
776
|
("if(o.oneofs)")
|
|
774
777
|
("d%s=%j", util.safeProp(field.partOf.name), field.name);
|
|
775
778
|
}
|
|
@@ -847,7 +850,9 @@ function decoder(mtype) {
|
|
|
847
850
|
else gen
|
|
848
851
|
("k=null");
|
|
849
852
|
|
|
850
|
-
if (types.
|
|
853
|
+
if (types.long[type] !== undefined) gen
|
|
854
|
+
("v=util.Long?util.Long.fromNumber(0,%j):0", type === "uint64" || type === "fixed64");
|
|
855
|
+
else if (types.defaults[type] !== undefined) gen
|
|
851
856
|
("v=%j", types.defaults[type]);
|
|
852
857
|
else gen
|
|
853
858
|
("v=null");
|
|
@@ -1006,8 +1011,8 @@ var Enum = require(6),
|
|
|
1006
1011
|
*/
|
|
1007
1012
|
function genTypePartial(gen, field, fieldIndex, ref) {
|
|
1008
1013
|
return field.delimited
|
|
1009
|
-
? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
|
|
1010
|
-
: gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
|
|
1014
|
+
? gen("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0)
|
|
1015
|
+
: gen("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
|
|
1011
1016
|
}
|
|
1012
1017
|
|
|
1013
1018
|
/**
|
|
@@ -1017,9 +1022,12 @@ function genTypePartial(gen, field, fieldIndex, ref) {
|
|
|
1017
1022
|
*/
|
|
1018
1023
|
function encoder(mtype) {
|
|
1019
1024
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
1020
|
-
var gen = util.codegen(["m", "w"], mtype.name + "$encode")
|
|
1025
|
+
var gen = util.codegen(["m", "w", "q"], mtype.name + "$encode")
|
|
1021
1026
|
("if(!w)")
|
|
1022
|
-
("w=Writer.create()")
|
|
1027
|
+
("w=Writer.create()")
|
|
1028
|
+
("if(q===undefined)q=0")
|
|
1029
|
+
("if(q>util.recursionLimit)")
|
|
1030
|
+
("throw Error(\"max depth exceeded\")");
|
|
1023
1031
|
|
|
1024
1032
|
var i, ref;
|
|
1025
1033
|
|
|
@@ -1045,7 +1053,7 @@ function encoder(mtype) {
|
|
|
1045
1053
|
else gen
|
|
1046
1054
|
("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
|
|
1047
1055
|
if (wireType === undefined) gen
|
|
1048
|
-
("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups
|
|
1056
|
+
("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()", index, ref); // can't be groups
|
|
1049
1057
|
else gen
|
|
1050
1058
|
(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);
|
|
1051
1059
|
gen
|
|
@@ -1186,8 +1194,8 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
|
|
|
1186
1194
|
ReflectionObject.prototype._resolveFeatures.call(this, edition);
|
|
1187
1195
|
|
|
1188
1196
|
Object.keys(this.values).forEach(key => {
|
|
1189
|
-
var parentFeaturesCopy =
|
|
1190
|
-
this._valuesFeatures[key] =
|
|
1197
|
+
var parentFeaturesCopy = util.merge({}, this._features);
|
|
1198
|
+
this._valuesFeatures[key] = util.merge(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features || {});
|
|
1191
1199
|
});
|
|
1192
1200
|
|
|
1193
1201
|
return this;
|
|
@@ -1344,7 +1352,7 @@ var Enum = require(6),
|
|
|
1344
1352
|
|
|
1345
1353
|
var Type; // cyclic
|
|
1346
1354
|
|
|
1347
|
-
var ruleRe = /^required|optional|repeated$/;
|
|
1355
|
+
var ruleRe = /^(?:required|optional|repeated)$/;
|
|
1348
1356
|
|
|
1349
1357
|
/**
|
|
1350
1358
|
* Constructs a new message field instance. Note that {@link MapField|map fields} have their own class.
|
|
@@ -1419,9 +1427,6 @@ function Field(name, id, type, rule, extend, options, comment) {
|
|
|
1419
1427
|
* Field rule, if any.
|
|
1420
1428
|
* @type {string|undefined}
|
|
1421
1429
|
*/
|
|
1422
|
-
if (rule === "proto3_optional") {
|
|
1423
|
-
rule = "optional";
|
|
1424
|
-
}
|
|
1425
1430
|
this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON
|
|
1426
1431
|
|
|
1427
1432
|
/**
|
|
@@ -1663,7 +1668,7 @@ Field.prototype.resolve = function resolve() {
|
|
|
1663
1668
|
|
|
1664
1669
|
// convert to internal data type if necesssary
|
|
1665
1670
|
if (this.long) {
|
|
1666
|
-
this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.
|
|
1671
|
+
this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type === "uint64" || this.type === "fixed64");
|
|
1667
1672
|
|
|
1668
1673
|
/* istanbul ignore else */
|
|
1669
1674
|
if (Object.freeze)
|
|
@@ -1893,7 +1898,7 @@ protobuf.util = require(28);
|
|
|
1893
1898
|
// Set up possibly cyclic reflection dependencies
|
|
1894
1899
|
protobuf.ReflectionObject._configure(protobuf.Root);
|
|
1895
1900
|
protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
|
|
1896
|
-
protobuf.Root._configure(protobuf.Type);
|
|
1901
|
+
protobuf.Root._configure(protobuf.Type, undefined, {});
|
|
1897
1902
|
protobuf.Field._configure(protobuf.Type);
|
|
1898
1903
|
|
|
1899
1904
|
},{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"24":24,"26":26,"27":27,"28":28,"3":3,"4":4,"43":43,"44":44,"5":5,"6":6,"7":7,"9":9}],9:[function(require,module,exports){
|
|
@@ -2116,7 +2121,7 @@ function Message(properties) {
|
|
|
2116
2121
|
/**
|
|
2117
2122
|
* Creates a new message of this type using the specified properties.
|
|
2118
2123
|
* @param {Object.<string,*>} [properties] Properties to set
|
|
2119
|
-
* @returns {
|
|
2124
|
+
* @returns {T} Message instance
|
|
2120
2125
|
* @template T extends Message<T>
|
|
2121
2126
|
* @this Constructor<T>
|
|
2122
2127
|
*/
|
|
@@ -2450,7 +2455,7 @@ Namespace.arrayToJSON = arrayToJSON;
|
|
|
2450
2455
|
Namespace.isReservedId = function isReservedId(reserved, id) {
|
|
2451
2456
|
if (reserved)
|
|
2452
2457
|
for (var i = 0; i < reserved.length; ++i)
|
|
2453
|
-
if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1]
|
|
2458
|
+
if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] >= id)
|
|
2454
2459
|
return true;
|
|
2455
2460
|
return false;
|
|
2456
2461
|
};
|
|
@@ -3162,7 +3167,7 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
|
|
|
3162
3167
|
throw new Error("Unknown edition for " + this.fullName);
|
|
3163
3168
|
}
|
|
3164
3169
|
|
|
3165
|
-
var protoFeatures =
|
|
3170
|
+
var protoFeatures = util.merge({}, this.options && this.options.features,
|
|
3166
3171
|
this._inferLegacyProtoFeatures(edition));
|
|
3167
3172
|
|
|
3168
3173
|
if (this._edition) {
|
|
@@ -3179,19 +3184,19 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition)
|
|
|
3179
3184
|
} else {
|
|
3180
3185
|
throw new Error("Unknown edition: " + edition);
|
|
3181
3186
|
}
|
|
3182
|
-
this._features =
|
|
3187
|
+
this._features = util.merge(defaults, protoFeatures);
|
|
3183
3188
|
} else {
|
|
3184
3189
|
// fields in Oneofs aren't actually children of them, so we have to
|
|
3185
3190
|
// special-case it
|
|
3186
3191
|
/* istanbul ignore else */
|
|
3187
3192
|
if (this.partOf instanceof OneOf) {
|
|
3188
|
-
var lexicalParentFeaturesCopy =
|
|
3189
|
-
this._features =
|
|
3193
|
+
var lexicalParentFeaturesCopy = util.merge({}, this.partOf._features);
|
|
3194
|
+
this._features = util.merge(lexicalParentFeaturesCopy, protoFeatures);
|
|
3190
3195
|
} else if (this.declaringField) {
|
|
3191
3196
|
// Skip feature resolution of sister fields.
|
|
3192
3197
|
} else if (this.parent) {
|
|
3193
|
-
var parentFeaturesCopy =
|
|
3194
|
-
this._features =
|
|
3198
|
+
var parentFeaturesCopy = util.merge({}, this.parent._features);
|
|
3199
|
+
this._features = util.merge(parentFeaturesCopy, protoFeatures);
|
|
3195
3200
|
} else {
|
|
3196
3201
|
throw new Error("Unable to find a parent for " + this.fullName);
|
|
3197
3202
|
}
|
|
@@ -3587,6 +3592,9 @@ var base10Re = /^[1-9][0-9]*$/,
|
|
|
3587
3592
|
nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/,
|
|
3588
3593
|
typeRefRe = util.patterns.typeRefRe;
|
|
3589
3594
|
|
|
3595
|
+
var maxFieldId = 536870911, // 2^29 - 1
|
|
3596
|
+
maxEnumId = 2147483647; // 2^31 - 1
|
|
3597
|
+
|
|
3590
3598
|
/**
|
|
3591
3599
|
* Result object returned from {@link parse}.
|
|
3592
3600
|
* @interface IParserResult
|
|
@@ -3706,7 +3714,7 @@ function parse(source, root, options) {
|
|
|
3706
3714
|
}
|
|
3707
3715
|
}
|
|
3708
3716
|
|
|
3709
|
-
function readRanges(target, acceptStrings) {
|
|
3717
|
+
function readRanges(target, acceptStrings, max, acceptNegative) {
|
|
3710
3718
|
var token, start;
|
|
3711
3719
|
do {
|
|
3712
3720
|
if (acceptStrings && ((token = peek()) === "\"" || token === "'")) {
|
|
@@ -3717,7 +3725,7 @@ function parse(source, root, options) {
|
|
|
3717
3725
|
}
|
|
3718
3726
|
} else {
|
|
3719
3727
|
try {
|
|
3720
|
-
target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]);
|
|
3728
|
+
target.push([ start = parseId(next(), acceptNegative, max), skip("to", true) ? parseId(next(), acceptNegative, max) : start ]);
|
|
3721
3729
|
} catch (err) {
|
|
3722
3730
|
if (acceptStrings && typeRefRe.test(token) && edition >= 2023) {
|
|
3723
3731
|
target.push(token);
|
|
@@ -3776,10 +3784,10 @@ function parse(source, root, options) {
|
|
|
3776
3784
|
throw illegal(token, "number", insideTryCatch);
|
|
3777
3785
|
}
|
|
3778
3786
|
|
|
3779
|
-
function parseId(token, acceptNegative) {
|
|
3787
|
+
function parseId(token, acceptNegative, max) {
|
|
3780
3788
|
switch (token) {
|
|
3781
3789
|
case "max": case "MAX": case "Max":
|
|
3782
|
-
return
|
|
3790
|
+
return max || maxFieldId;
|
|
3783
3791
|
case "0":
|
|
3784
3792
|
return 0;
|
|
3785
3793
|
}
|
|
@@ -4042,7 +4050,7 @@ function parse(source, root, options) {
|
|
|
4042
4050
|
name = applyCase(name);
|
|
4043
4051
|
skip("=");
|
|
4044
4052
|
|
|
4045
|
-
var field = new Field(name, parseId(next()), type, rule, extend);
|
|
4053
|
+
var field = new Field(name, parseId(next()), type, rule === "proto3_optional" ? "optional" : rule, extend);
|
|
4046
4054
|
|
|
4047
4055
|
ifBlock(field, function parseField_block(token) {
|
|
4048
4056
|
|
|
@@ -4237,7 +4245,7 @@ function parse(source, root, options) {
|
|
|
4237
4245
|
break;
|
|
4238
4246
|
|
|
4239
4247
|
case "reserved":
|
|
4240
|
-
readRanges(enm.reserved || (enm.reserved = []), true);
|
|
4248
|
+
readRanges(enm.reserved || (enm.reserved = []), true, maxEnumId, true);
|
|
4241
4249
|
if(enm.reserved === undefined) enm.reserved = [];
|
|
4242
4250
|
break;
|
|
4243
4251
|
|
|
@@ -5362,8 +5370,12 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5362
5370
|
}
|
|
5363
5371
|
|
|
5364
5372
|
// Processes a single file
|
|
5365
|
-
function process(filename, source) {
|
|
5373
|
+
function process(filename, source, depth) {
|
|
5374
|
+
if (depth === undefined)
|
|
5375
|
+
depth = 0;
|
|
5366
5376
|
try {
|
|
5377
|
+
if (depth > util.recursionLimit)
|
|
5378
|
+
throw Error("max depth exceeded");
|
|
5367
5379
|
if (util.isString(source) && source.charAt(0) === "{")
|
|
5368
5380
|
source = JSON.parse(source);
|
|
5369
5381
|
if (!util.isString(source))
|
|
@@ -5376,11 +5388,11 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5376
5388
|
if (parsed.imports)
|
|
5377
5389
|
for (; i < parsed.imports.length; ++i)
|
|
5378
5390
|
if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))
|
|
5379
|
-
fetch(resolved);
|
|
5391
|
+
fetch(resolved, false, depth + 1);
|
|
5380
5392
|
if (parsed.weakImports)
|
|
5381
5393
|
for (i = 0; i < parsed.weakImports.length; ++i)
|
|
5382
5394
|
if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))
|
|
5383
|
-
fetch(resolved, true);
|
|
5395
|
+
fetch(resolved, true, depth + 1);
|
|
5384
5396
|
}
|
|
5385
5397
|
} catch (err) {
|
|
5386
5398
|
finish(err);
|
|
@@ -5391,7 +5403,9 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5391
5403
|
}
|
|
5392
5404
|
|
|
5393
5405
|
// Fetches a single file
|
|
5394
|
-
function fetch(filename, weak) {
|
|
5406
|
+
function fetch(filename, weak, depth) {
|
|
5407
|
+
if (depth === undefined)
|
|
5408
|
+
depth = 0;
|
|
5395
5409
|
filename = getBundledFileName(filename) || filename;
|
|
5396
5410
|
|
|
5397
5411
|
// Skip if already loaded / attempted
|
|
@@ -5403,12 +5417,12 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5403
5417
|
// Shortcut bundled definitions
|
|
5404
5418
|
if (Object.prototype.hasOwnProperty.call(common, filename)) {
|
|
5405
5419
|
if (sync) {
|
|
5406
|
-
process(filename, common[filename]);
|
|
5420
|
+
process(filename, common[filename], depth);
|
|
5407
5421
|
} else {
|
|
5408
5422
|
++queued;
|
|
5409
5423
|
setTimeout(function() {
|
|
5410
5424
|
--queued;
|
|
5411
|
-
process(filename, common[filename]);
|
|
5425
|
+
process(filename, common[filename], depth);
|
|
5412
5426
|
});
|
|
5413
5427
|
}
|
|
5414
5428
|
return;
|
|
@@ -5424,7 +5438,7 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5424
5438
|
finish(err);
|
|
5425
5439
|
return;
|
|
5426
5440
|
}
|
|
5427
|
-
process(filename, source);
|
|
5441
|
+
process(filename, source, depth);
|
|
5428
5442
|
} else {
|
|
5429
5443
|
++queued;
|
|
5430
5444
|
self.fetch(filename, function(err, source) {
|
|
@@ -5441,7 +5455,7 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
5441
5455
|
finish(null, self);
|
|
5442
5456
|
return;
|
|
5443
5457
|
}
|
|
5444
|
-
process(filename, source);
|
|
5458
|
+
process(filename, source, depth);
|
|
5445
5459
|
});
|
|
5446
5460
|
}
|
|
5447
5461
|
}
|
|
@@ -6917,7 +6931,7 @@ Type.prototype.isReservedName = function isReservedName(name) {
|
|
|
6917
6931
|
/**
|
|
6918
6932
|
* Creates a new message of this type using the specified properties.
|
|
6919
6933
|
* @param {Object.<string,*>} [properties] Properties to set
|
|
6920
|
-
* @returns {
|
|
6934
|
+
* @returns {ReflectedMessage} Message instance
|
|
6921
6935
|
*/
|
|
6922
6936
|
Type.prototype.create = function create(properties) {
|
|
6923
6937
|
return new this.ctor(properties);
|
|
@@ -6983,8 +6997,8 @@ Type.prototype.setup = function setup() {
|
|
|
6983
6997
|
* @param {Writer} [writer] Writer to encode to
|
|
6984
6998
|
* @returns {Writer} writer
|
|
6985
6999
|
*/
|
|
6986
|
-
Type.prototype.encode = function encode_setup(message, writer) {
|
|
6987
|
-
return this.setup().encode(
|
|
7000
|
+
Type.prototype.encode = function encode_setup(message, writer) { // eslint-disable-line no-unused-vars
|
|
7001
|
+
return this.setup().encode.apply(this, arguments); // overrides this method
|
|
6988
7002
|
};
|
|
6989
7003
|
|
|
6990
7004
|
/**
|
|
@@ -7001,7 +7015,7 @@ Type.prototype.encodeDelimited = function encodeDelimited(message, writer) {
|
|
|
7001
7015
|
* Decodes a message of this type.
|
|
7002
7016
|
* @param {Reader|Uint8Array} reader Reader or buffer to decode from
|
|
7003
7017
|
* @param {number} [length] Length of the message, if known beforehand
|
|
7004
|
-
* @returns {
|
|
7018
|
+
* @returns {ReflectedMessage} Decoded message
|
|
7005
7019
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
7006
7020
|
* @throws {util.ProtocolError<{}>} If required fields are missing
|
|
7007
7021
|
*/
|
|
@@ -7012,7 +7026,7 @@ Type.prototype.decode = function decode_setup(reader, length) { // eslint-disabl
|
|
|
7012
7026
|
/**
|
|
7013
7027
|
* Decodes a message of this type preceeded by its byte length as a varint.
|
|
7014
7028
|
* @param {Reader|Uint8Array} reader Reader or buffer to decode from
|
|
7015
|
-
* @returns {
|
|
7029
|
+
* @returns {ReflectedMessage} Decoded message
|
|
7016
7030
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
7017
7031
|
* @throws {util.ProtocolError} If required fields are missing
|
|
7018
7032
|
*/
|
|
@@ -7034,7 +7048,7 @@ Type.prototype.verify = function verify_setup(message) { // eslint-disable-line
|
|
|
7034
7048
|
/**
|
|
7035
7049
|
* Creates a new message of this type from a plain object. Also converts values to their respective internal types.
|
|
7036
7050
|
* @param {Object.<string,*>} object Plain object to convert
|
|
7037
|
-
* @returns {
|
|
7051
|
+
* @returns {ReflectedMessage} Message instance
|
|
7038
7052
|
*/
|
|
7039
7053
|
Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line no-unused-vars
|
|
7040
7054
|
return this.setup().fromObject.apply(this, arguments);
|
|
@@ -7065,8 +7079,8 @@ Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line
|
|
|
7065
7079
|
* @param {IConversionOptions} [options] Conversion options
|
|
7066
7080
|
* @returns {Object.<string,*>} Plain object
|
|
7067
7081
|
*/
|
|
7068
|
-
Type.prototype.toObject = function toObject(message, options) {
|
|
7069
|
-
return this.setup().toObject(
|
|
7082
|
+
Type.prototype.toObject = function toObject(message, options) { // eslint-disable-line no-unused-vars
|
|
7083
|
+
return this.setup().toObject.apply(this, arguments);
|
|
7070
7084
|
};
|
|
7071
7085
|
|
|
7072
7086
|
/**
|
|
@@ -7321,8 +7335,7 @@ util.fetch = require(33);
|
|
|
7321
7335
|
util.path = require(39);
|
|
7322
7336
|
util.patterns = require(40);
|
|
7323
7337
|
|
|
7324
|
-
var reservedRe = util.patterns.reservedRe
|
|
7325
|
-
unsafePropertyRe = util.patterns.unsafePropertyRe;
|
|
7338
|
+
var reservedRe = util.patterns.reservedRe;
|
|
7326
7339
|
|
|
7327
7340
|
/**
|
|
7328
7341
|
* Node's fs module if available.
|
|
@@ -7485,7 +7498,7 @@ util.decorateEnum = function decorateEnum(object) {
|
|
|
7485
7498
|
util.setProperty = function setProperty(dst, path, value, ifNotSet) {
|
|
7486
7499
|
function setProp(dst, path, value) {
|
|
7487
7500
|
var part = path.shift();
|
|
7488
|
-
if (
|
|
7501
|
+
if (util.isUnsafeProperty(part))
|
|
7489
7502
|
return dst;
|
|
7490
7503
|
if (path.length > 0) {
|
|
7491
7504
|
dst[part] = setProp(dst[part] || {}, path, value);
|
|
@@ -7858,7 +7871,7 @@ function EventEmitter() {
|
|
|
7858
7871
|
* @type {Object.<string,*>}
|
|
7859
7872
|
* @private
|
|
7860
7873
|
*/
|
|
7861
|
-
this._listeners =
|
|
7874
|
+
this._listeners = Object.create(null);
|
|
7862
7875
|
}
|
|
7863
7876
|
|
|
7864
7877
|
/**
|
|
@@ -7892,12 +7905,14 @@ EventEmitter.prototype.on = function on(evt, fn, ctx) {
|
|
|
7892
7905
|
*/
|
|
7893
7906
|
EventEmitter.prototype.off = function off(evt, fn) {
|
|
7894
7907
|
if (evt === undefined)
|
|
7895
|
-
this._listeners =
|
|
7908
|
+
this._listeners = Object.create(null);
|
|
7896
7909
|
else {
|
|
7897
7910
|
if (fn === undefined)
|
|
7898
7911
|
this._listeners[evt] = [];
|
|
7899
7912
|
else {
|
|
7900
7913
|
var listeners = this._listeners[evt];
|
|
7914
|
+
if (!listeners)
|
|
7915
|
+
return this;
|
|
7901
7916
|
for (var i = 0; i < listeners.length;)
|
|
7902
7917
|
if (listeners[i].fn === fn)
|
|
7903
7918
|
listeners.splice(i, 1);
|
|
@@ -8661,6 +8676,18 @@ util.pool = require(41);
|
|
|
8661
8676
|
// utility to work with the low and high bits of a 64 bit value
|
|
8662
8677
|
util.LongBits = require(37);
|
|
8663
8678
|
|
|
8679
|
+
/**
|
|
8680
|
+
* Tests if the specified key can affect object prototypes.
|
|
8681
|
+
* @memberof util
|
|
8682
|
+
* @param {string} key Key to test
|
|
8683
|
+
* @returns {boolean} `true` if the key is unsafe
|
|
8684
|
+
*/
|
|
8685
|
+
function isUnsafeProperty(key) {
|
|
8686
|
+
return key === "__proto__" || key === "prototype" || key === "constructor";
|
|
8687
|
+
}
|
|
8688
|
+
|
|
8689
|
+
util.isUnsafeProperty = isUnsafeProperty;
|
|
8690
|
+
|
|
8664
8691
|
/**
|
|
8665
8692
|
* Whether running within node or not.
|
|
8666
8693
|
* @memberof util
|
|
@@ -8895,15 +8922,21 @@ util.boolFromKey = function boolFromKey(key) {
|
|
|
8895
8922
|
* Merges the properties of the source object into the destination object.
|
|
8896
8923
|
* @memberof util
|
|
8897
8924
|
* @param {Object.<string,*>} dst Destination object
|
|
8898
|
-
* @param {Object.<string
|
|
8899
|
-
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set
|
|
8925
|
+
* @param {...(Object.<string,*>|boolean)} src Source objects, optionally followed by an `ifNotSet` flag
|
|
8900
8926
|
* @returns {Object.<string,*>} Destination object
|
|
8901
8927
|
*/
|
|
8902
|
-
function merge(dst
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8928
|
+
function merge(dst) { // used by converters
|
|
8929
|
+
var ifNotSet = typeof arguments[arguments.length - 1] === "boolean",
|
|
8930
|
+
limit = ifNotSet ? arguments.length - 1 : arguments.length;
|
|
8931
|
+
ifNotSet = ifNotSet && arguments[arguments.length - 1];
|
|
8932
|
+
for (var a = 1; a < limit; ++a) {
|
|
8933
|
+
var src = arguments[a];
|
|
8934
|
+
if (!src)
|
|
8935
|
+
continue;
|
|
8936
|
+
for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
|
|
8937
|
+
if (!isUnsafeProperty(keys[i]) && (dst[keys[i]] === undefined || !ifNotSet))
|
|
8906
8938
|
dst[keys[i]] = src[keys[i]];
|
|
8939
|
+
}
|
|
8907
8940
|
return dst;
|
|
8908
8941
|
}
|
|
8909
8942
|
|
|
@@ -9217,7 +9250,6 @@ var patterns = exports;
|
|
|
9217
9250
|
patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
|
|
9218
9251
|
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
9219
9252
|
patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
|
|
9220
|
-
patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
|
|
9221
9253
|
|
|
9222
9254
|
},{}],41:[function(require,module,exports){
|
|
9223
9255
|
"use strict";
|
|
@@ -9593,7 +9625,8 @@ function verifier(mtype) {
|
|
|
9593
9625
|
*/
|
|
9594
9626
|
var wrappers = exports;
|
|
9595
9627
|
|
|
9596
|
-
var Message = require(12)
|
|
9628
|
+
var Message = require(12),
|
|
9629
|
+
util = require(38);
|
|
9597
9630
|
|
|
9598
9631
|
/**
|
|
9599
9632
|
* From object converter part of an {@link IWrapper}.
|
|
@@ -9640,10 +9673,9 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9640
9673
|
if (type_url.indexOf("/") === -1) {
|
|
9641
9674
|
type_url = "/" + type_url;
|
|
9642
9675
|
}
|
|
9643
|
-
var nextDepth = depth === undefined ? 1 : depth + 1;
|
|
9644
9676
|
return this.create({
|
|
9645
9677
|
type_url: type_url,
|
|
9646
|
-
value: type.encode(type.fromObject(object,
|
|
9678
|
+
value: type.encode(type.fromObject(object, depth === undefined ? 1 : depth + 1)).finish()
|
|
9647
9679
|
});
|
|
9648
9680
|
}
|
|
9649
9681
|
}
|
|
@@ -9651,13 +9683,16 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9651
9683
|
return this.fromObject(object, depth);
|
|
9652
9684
|
},
|
|
9653
9685
|
|
|
9654
|
-
toObject: function(message, options) {
|
|
9686
|
+
toObject: function(message, options, depth) {
|
|
9687
|
+
if (depth === undefined)
|
|
9688
|
+
depth = 0;
|
|
9689
|
+
if (depth > util.recursionLimit)
|
|
9690
|
+
throw Error("max depth exceeded");
|
|
9655
9691
|
|
|
9656
9692
|
// Default prefix
|
|
9657
9693
|
var googleApi = "type.googleapis.com/";
|
|
9658
9694
|
var prefix = "";
|
|
9659
9695
|
var name = "";
|
|
9660
|
-
|
|
9661
9696
|
// decode value if requested and unmapped
|
|
9662
9697
|
if (options && options.json && message.type_url && message.value) {
|
|
9663
9698
|
// Only use fully qualified type name after the last '/'
|
|
@@ -9667,12 +9702,12 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9667
9702
|
var type = this.lookup(name);
|
|
9668
9703
|
/* istanbul ignore else */
|
|
9669
9704
|
if (type)
|
|
9670
|
-
message = type.decode(message.value);
|
|
9705
|
+
message = type.decode(message.value, undefined, undefined, depth + 1);
|
|
9671
9706
|
}
|
|
9672
9707
|
|
|
9673
9708
|
// wrap value if unmapped
|
|
9674
9709
|
if (!(message instanceof this.ctor) && message instanceof Message) {
|
|
9675
|
-
var object = message.$type.toObject(message, options);
|
|
9710
|
+
var object = message.$type.toObject(message, options, depth + 1);
|
|
9676
9711
|
var messageName = message.$type.fullName[0] === "." ?
|
|
9677
9712
|
message.$type.fullName.slice(1) : message.$type.fullName;
|
|
9678
9713
|
// Default to type.googleapis.com prefix if no prefix is used
|
|
@@ -9684,11 +9719,11 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9684
9719
|
return object;
|
|
9685
9720
|
}
|
|
9686
9721
|
|
|
9687
|
-
return this.toObject(message, options);
|
|
9722
|
+
return this.toObject(message, options, depth);
|
|
9688
9723
|
}
|
|
9689
9724
|
};
|
|
9690
9725
|
|
|
9691
|
-
},{"12":12}],45:[function(require,module,exports){
|
|
9726
|
+
},{"12":12,"38":38}],45:[function(require,module,exports){
|
|
9692
9727
|
"use strict";
|
|
9693
9728
|
module.exports = Writer;
|
|
9694
9729
|
|
|
@@ -9921,7 +9956,7 @@ Writer.prototype.uint32 = function write_uint32(value) {
|
|
|
9921
9956
|
* @returns {Writer} `this`
|
|
9922
9957
|
*/
|
|
9923
9958
|
Writer.prototype.int32 = function write_int32(value) {
|
|
9924
|
-
return value < 0
|
|
9959
|
+
return (value |= 0) < 0
|
|
9925
9960
|
? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
|
|
9926
9961
|
: this.uint32(value);
|
|
9927
9962
|
};
|
|
@@ -9936,16 +9971,18 @@ Writer.prototype.sint32 = function write_sint32(value) {
|
|
|
9936
9971
|
};
|
|
9937
9972
|
|
|
9938
9973
|
function writeVarint64(val, buf, pos) {
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9974
|
+
var lo = val.lo,
|
|
9975
|
+
hi = val.hi;
|
|
9976
|
+
while (hi) {
|
|
9977
|
+
buf[pos++] = lo & 127 | 128;
|
|
9978
|
+
lo = (lo >>> 7 | hi << 25) >>> 0;
|
|
9979
|
+
hi >>>= 7;
|
|
9980
|
+
}
|
|
9981
|
+
while (lo > 127) {
|
|
9982
|
+
buf[pos++] = lo & 127 | 128;
|
|
9983
|
+
lo = lo >>> 7;
|
|
9984
|
+
}
|
|
9985
|
+
buf[pos++] = lo;
|
|
9949
9986
|
}
|
|
9950
9987
|
|
|
9951
9988
|
/**
|