protobufjs 6.10.0-beta.1 → 6.10.1
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/CHANGELOG.md +27 -0
- package/cli/package.json +7 -1
- package/dist/light/protobuf.js +165 -33
- 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 +20 -13
- 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 +217 -53
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/index.d.ts +11 -8
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/util/minimal.js +18 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### [6.10.1](https://www.github.com/protobufjs/protobuf.js/compare/v6.10.0...v6.10.1) (2020-07-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* make node detection a bit more forgiving ([#1445](https://www.github.com/protobufjs/protobuf.js/issues/1445)) ([4e75f6d](https://www.github.com/protobufjs/protobuf.js/commit/4e75f6de4a2e49f28c24b59107f262d472b68977))
|
|
9
|
+
|
|
10
|
+
## [6.10.0](https://www.github.com/protobufjs/protobuf.js/compare/v6.9.0...v6.10.0) (2020-07-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add configurable Root.prototype.fetch ([ad3cffd](https://www.github.com/protobufjs/protobuf.js/commit/ad3cffdc5a54a7c94830674270d3386e1a2b58fc))
|
|
16
|
+
* better comment parse ([#1419](https://www.github.com/protobufjs/protobuf.js/issues/1419)) ([7fd2e18](https://www.github.com/protobufjs/protobuf.js/commit/7fd2e182150c9b6be9ba21e6450b6e4668ad9f82))
|
|
17
|
+
* parsed options ([#1256](https://www.github.com/protobufjs/protobuf.js/issues/1256)) ([7a25398](https://www.github.com/protobufjs/protobuf.js/commit/7a2539843055b6daecb9f369c67a6cf588dbb54c))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* allow Windows unc paths to be resolved and normalized ([#1351](https://www.github.com/protobufjs/protobuf.js/issues/1351)) ([cd4aeda](https://www.github.com/protobufjs/protobuf.js/commit/cd4aeda8036f80cfa3b9f1db4096d856b2fd05fb))
|
|
23
|
+
* do not fail if no process ([#1440](https://www.github.com/protobufjs/protobuf.js/issues/1440)) ([f2faa8c](https://www.github.com/protobufjs/protobuf.js/commit/f2faa8c32e918b3b843005f0419608b8e158998d))
|
|
24
|
+
* fix util.global ([#1441](https://www.github.com/protobufjs/protobuf.js/issues/1441)) ([742b8dc](https://www.github.com/protobufjs/protobuf.js/commit/742b8dcbc750f9c2659088cbd88ea61fd11b24a7))
|
|
25
|
+
* google.protobuf.Any type_url fixes ([#1068](https://www.github.com/protobufjs/protobuf.js/issues/1068)) ([192f5f1](https://www.github.com/protobufjs/protobuf.js/commit/192f5f12d071fa534ac625290d4666c839a46a9e))
|
|
26
|
+
* handling of map entries with omitted key or value ([#1348](https://www.github.com/protobufjs/protobuf.js/issues/1348)) ([b950877](https://www.github.com/protobufjs/protobuf.js/commit/b950877c86676399674821fca4cf444f046b5acb))
|
|
27
|
+
* properly parse empty messages in options ([#1429](https://www.github.com/protobufjs/protobuf.js/issues/1429)) ([7fbc79f](https://www.github.com/protobufjs/protobuf.js/commit/7fbc79f11d89b263dafc8f332ccba59a8d181fca))
|
|
28
|
+
* updated isNode check ([#1221](https://www.github.com/protobufjs/protobuf.js/issues/1221)) ([#1363](https://www.github.com/protobufjs/protobuf.js/issues/1363)) ([5564e7b](https://www.github.com/protobufjs/protobuf.js/commit/5564e7b5f07d3eab99762528e8ce88507af5a5a3))
|
|
29
|
+
|
|
3
30
|
## [6.9.0](https://www.github.com/protobufjs/protobuf.js/compare/6.8.8...v6.9.0) (2020-04-17)
|
|
4
31
|
|
|
5
32
|
|
package/cli/package.json
CHANGED
package/dist/light/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v6.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v6.10.0 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled wed, 15 jul 2020 23:34:13 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -1425,7 +1425,7 @@ function decoder(mtype) {
|
|
|
1425
1425
|
var gen = util.codegen(["r", "l"], mtype.name + "$decode")
|
|
1426
1426
|
("if(!(r instanceof Reader))")
|
|
1427
1427
|
("r=Reader.create(r)")
|
|
1428
|
-
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k" : ""))
|
|
1428
|
+
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
|
|
1429
1429
|
("while(r.pos<c){")
|
|
1430
1430
|
("var t=r.uint32()");
|
|
1431
1431
|
if (mtype.group) gen
|
|
@@ -1443,22 +1443,44 @@ function decoder(mtype) {
|
|
|
1443
1443
|
|
|
1444
1444
|
// Map fields
|
|
1445
1445
|
if (field.map) { gen
|
|
1446
|
-
("r.skip().pos++") // assumes id 1 + key wireType
|
|
1447
1446
|
("if(%s===util.emptyObject)", ref)
|
|
1448
1447
|
("%s={}", ref)
|
|
1449
|
-
("
|
|
1450
|
-
|
|
1451
|
-
if (types.
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1448
|
+
("var c2 = r.uint32()+r.pos");
|
|
1449
|
+
|
|
1450
|
+
if (types.defaults[field.keyType] !== undefined) gen
|
|
1451
|
+
("k=%j", types.defaults[field.keyType]);
|
|
1452
|
+
else gen
|
|
1453
|
+
("k=null");
|
|
1454
|
+
|
|
1455
|
+
if (types.defaults[type] !== undefined) gen
|
|
1456
|
+
("value=%j", types.defaults[type]);
|
|
1457
|
+
else gen
|
|
1458
|
+
("value=null");
|
|
1459
|
+
|
|
1460
|
+
gen
|
|
1461
|
+
("while(r.pos<c2){")
|
|
1462
|
+
("var tag2=r.uint32()")
|
|
1463
|
+
("switch(tag2>>>3){")
|
|
1464
|
+
("case 1: k=r.%s(); break", field.keyType)
|
|
1465
|
+
("case 2:");
|
|
1466
|
+
|
|
1467
|
+
if (types.basic[type] === undefined) gen
|
|
1468
|
+
("value=types[%i].decode(r,r.uint32())", i); // can't be groups
|
|
1469
|
+
else gen
|
|
1470
|
+
("value=r.%s()", type);
|
|
1471
|
+
|
|
1472
|
+
gen
|
|
1473
|
+
("break")
|
|
1474
|
+
("default:")
|
|
1475
|
+
("r.skipType(tag2&7)")
|
|
1476
|
+
("break")
|
|
1477
|
+
("}")
|
|
1478
|
+
("}");
|
|
1479
|
+
|
|
1480
|
+
if (types.long[field.keyType] !== undefined) gen
|
|
1481
|
+
("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref);
|
|
1482
|
+
else gen
|
|
1483
|
+
("%s[k]=value", ref);
|
|
1462
1484
|
|
|
1463
1485
|
// Repeated fields
|
|
1464
1486
|
} else if (field.repeated) { gen
|
|
@@ -3201,6 +3223,12 @@ function ReflectionObject(name, options) {
|
|
|
3201
3223
|
*/
|
|
3202
3224
|
this.options = options; // toJSON
|
|
3203
3225
|
|
|
3226
|
+
/**
|
|
3227
|
+
* Parsed Options.
|
|
3228
|
+
* @type {Array.<Object.<string,*>>|undefined}
|
|
3229
|
+
*/
|
|
3230
|
+
this.parsedOptions = null;
|
|
3231
|
+
|
|
3204
3232
|
/**
|
|
3205
3233
|
* Unique name within its namespace.
|
|
3206
3234
|
* @type {string}
|
|
@@ -3341,6 +3369,43 @@ ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet)
|
|
|
3341
3369
|
return this;
|
|
3342
3370
|
};
|
|
3343
3371
|
|
|
3372
|
+
/**
|
|
3373
|
+
* Sets a parsed option.
|
|
3374
|
+
* @param {string} name parsed Option name
|
|
3375
|
+
* @param {*} value Option value
|
|
3376
|
+
* @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value
|
|
3377
|
+
* @returns {ReflectionObject} `this`
|
|
3378
|
+
*/
|
|
3379
|
+
ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) {
|
|
3380
|
+
if (!this.parsedOptions) {
|
|
3381
|
+
this.parsedOptions = [];
|
|
3382
|
+
}
|
|
3383
|
+
var parsedOptions = this.parsedOptions;
|
|
3384
|
+
if (propName) {
|
|
3385
|
+
// If setting a sub property of an option then try to merge it
|
|
3386
|
+
// with an existing option
|
|
3387
|
+
var opt = parsedOptions.find(function (opt) {
|
|
3388
|
+
return Object.prototype.hasOwnProperty.call(opt, name);
|
|
3389
|
+
});
|
|
3390
|
+
if (opt) {
|
|
3391
|
+
// If we found an existing option - just merge the property value
|
|
3392
|
+
var newValue = opt[name];
|
|
3393
|
+
util.setProperty(newValue, propName, value);
|
|
3394
|
+
} else {
|
|
3395
|
+
// otherwise, create a new option, set it's property and add it to the list
|
|
3396
|
+
opt = {};
|
|
3397
|
+
opt[name] = util.setProperty({}, propName, value);
|
|
3398
|
+
parsedOptions.push(opt);
|
|
3399
|
+
}
|
|
3400
|
+
} else {
|
|
3401
|
+
// Always create a new option when setting the value of the option itself
|
|
3402
|
+
var newOpt = {};
|
|
3403
|
+
newOpt[name] = value;
|
|
3404
|
+
parsedOptions.push(newOpt);
|
|
3405
|
+
}
|
|
3406
|
+
return this;
|
|
3407
|
+
};
|
|
3408
|
+
|
|
3344
3409
|
/**
|
|
3345
3410
|
* Sets multiple options.
|
|
3346
3411
|
* @param {Object.<string,*>} options Options to set
|
|
@@ -4106,6 +4171,16 @@ Root.fromJSON = function fromJSON(json, root) {
|
|
|
4106
4171
|
*/
|
|
4107
4172
|
Root.prototype.resolvePath = util.path.resolve;
|
|
4108
4173
|
|
|
4174
|
+
/**
|
|
4175
|
+
* Fetch content from file path or url
|
|
4176
|
+
* This method exists so you can override it with your own logic.
|
|
4177
|
+
* @function
|
|
4178
|
+
* @param {string} path File path or url
|
|
4179
|
+
* @param {FetchCallback} callback Callback function
|
|
4180
|
+
* @returns {undefined}
|
|
4181
|
+
*/
|
|
4182
|
+
Root.prototype.fetch = util.fetch;
|
|
4183
|
+
|
|
4109
4184
|
// A symbol-like function to safely signal synchronous loading
|
|
4110
4185
|
/* istanbul ignore next */
|
|
4111
4186
|
function SYNC() {} // eslint-disable-line no-empty-function
|
|
@@ -4213,7 +4288,7 @@ Root.prototype.load = function load(filename, options, callback) {
|
|
|
4213
4288
|
process(filename, source);
|
|
4214
4289
|
} else {
|
|
4215
4290
|
++queued;
|
|
4216
|
-
|
|
4291
|
+
self.fetch(filename, function(err, source) {
|
|
4217
4292
|
--queued;
|
|
4218
4293
|
/* istanbul ignore if */
|
|
4219
4294
|
if (!callback)
|
|
@@ -5725,6 +5800,37 @@ util.decorateEnum = function decorateEnum(object) {
|
|
|
5725
5800
|
return enm;
|
|
5726
5801
|
};
|
|
5727
5802
|
|
|
5803
|
+
|
|
5804
|
+
/**
|
|
5805
|
+
* Sets the value of a property by property path. If a value already exists, it is turned to an array
|
|
5806
|
+
* @param {Object.<string,*>} dst Destination object
|
|
5807
|
+
* @param {string} path dot '.' delimited path of the property to set
|
|
5808
|
+
* @param {Object} value the value to set
|
|
5809
|
+
* @returns {Object.<string,*>} Destination object
|
|
5810
|
+
*/
|
|
5811
|
+
util.setProperty = function setProperty(dst, path, value) {
|
|
5812
|
+
function setProp(dst, path, value) {
|
|
5813
|
+
var part = path.shift();
|
|
5814
|
+
if (path.length > 0) {
|
|
5815
|
+
dst[part] = setProp(dst[part] || {}, path, value);
|
|
5816
|
+
} else {
|
|
5817
|
+
var prevValue = dst[part];
|
|
5818
|
+
if (prevValue)
|
|
5819
|
+
value = [].concat(prevValue).concat(value);
|
|
5820
|
+
dst[part] = value;
|
|
5821
|
+
}
|
|
5822
|
+
return dst;
|
|
5823
|
+
}
|
|
5824
|
+
|
|
5825
|
+
if (typeof dst !== "object")
|
|
5826
|
+
throw TypeError("dst must be an object");
|
|
5827
|
+
if (!path)
|
|
5828
|
+
throw TypeError("path must be specified");
|
|
5829
|
+
|
|
5830
|
+
path = path.split(".");
|
|
5831
|
+
return setProp(dst, path, value);
|
|
5832
|
+
};
|
|
5833
|
+
|
|
5728
5834
|
/**
|
|
5729
5835
|
* Decorator root (TypeScript).
|
|
5730
5836
|
* @name util.decorateRoot
|
|
@@ -5967,9 +6073,24 @@ util.pool = require(9);
|
|
|
5967
6073
|
// utility to work with the low and high bits of a 64 bit value
|
|
5968
6074
|
util.LongBits = require(34);
|
|
5969
6075
|
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
6076
|
+
/**
|
|
6077
|
+
* Whether running within node or not.
|
|
6078
|
+
* @memberof util
|
|
6079
|
+
* @type {boolean}
|
|
6080
|
+
*/
|
|
6081
|
+
util.isNode = Boolean(typeof global !== "undefined"
|
|
6082
|
+
&& global
|
|
6083
|
+
&& global.process
|
|
6084
|
+
&& global.process.versions
|
|
6085
|
+
&& global.process.versions.node);
|
|
6086
|
+
|
|
6087
|
+
/**
|
|
6088
|
+
* Global object reference.
|
|
6089
|
+
* @memberof util
|
|
6090
|
+
* @type {Object}
|
|
6091
|
+
*/
|
|
6092
|
+
util.global = util.isNode && global
|
|
6093
|
+
|| typeof window !== "undefined" && window
|
|
5973
6094
|
|| typeof self !== "undefined" && self
|
|
5974
6095
|
|| this; // eslint-disable-line no-invalid-this
|
|
5975
6096
|
|
|
@@ -5988,14 +6109,6 @@ util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */
|
|
|
5988
6109
|
*/
|
|
5989
6110
|
util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes
|
|
5990
6111
|
|
|
5991
|
-
/**
|
|
5992
|
-
* Whether running within node or not.
|
|
5993
|
-
* @memberof util
|
|
5994
|
-
* @type {boolean}
|
|
5995
|
-
* @const
|
|
5996
|
-
*/
|
|
5997
|
-
util.isNode = Boolean(util.global.process && util.global.process.versions && util.global.process.versions.node);
|
|
5998
|
-
|
|
5999
6112
|
/**
|
|
6000
6113
|
* Tests if the specified value is an integer.
|
|
6001
6114
|
* @function
|
|
@@ -6578,15 +6691,20 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
6578
6691
|
|
|
6579
6692
|
// unwrap value type if mapped
|
|
6580
6693
|
if (object && object["@type"]) {
|
|
6581
|
-
|
|
6694
|
+
// Only use fully qualified type name after the last '/'
|
|
6695
|
+
var name = object["@type"].substring(object["@type"].lastIndexOf("/") + 1);
|
|
6696
|
+
var type = this.lookup(name);
|
|
6582
6697
|
/* istanbul ignore else */
|
|
6583
6698
|
if (type) {
|
|
6584
6699
|
// type_url does not accept leading "."
|
|
6585
6700
|
var type_url = object["@type"].charAt(0) === "." ?
|
|
6586
6701
|
object["@type"].substr(1) : object["@type"];
|
|
6587
6702
|
// type_url prefix is optional, but path seperator is required
|
|
6703
|
+
if (type_url.indexOf("/") === -1) {
|
|
6704
|
+
type_url = "/" + type_url;
|
|
6705
|
+
}
|
|
6588
6706
|
return this.create({
|
|
6589
|
-
type_url:
|
|
6707
|
+
type_url: type_url,
|
|
6590
6708
|
value: type.encode(type.fromObject(object)).finish()
|
|
6591
6709
|
});
|
|
6592
6710
|
}
|
|
@@ -6597,10 +6715,17 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
6597
6715
|
|
|
6598
6716
|
toObject: function(message, options) {
|
|
6599
6717
|
|
|
6718
|
+
// Default prefix
|
|
6719
|
+
var googleApi = "type.googleapis.com/";
|
|
6720
|
+
var prefix = "";
|
|
6721
|
+
var name = "";
|
|
6722
|
+
|
|
6600
6723
|
// decode value if requested and unmapped
|
|
6601
6724
|
if (options && options.json && message.type_url && message.value) {
|
|
6602
6725
|
// Only use fully qualified type name after the last '/'
|
|
6603
|
-
|
|
6726
|
+
name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1);
|
|
6727
|
+
// Separate the prefix used
|
|
6728
|
+
prefix = message.type_url.substring(0, message.type_url.lastIndexOf("/") + 1);
|
|
6604
6729
|
var type = this.lookup(name);
|
|
6605
6730
|
/* istanbul ignore else */
|
|
6606
6731
|
if (type)
|
|
@@ -6610,7 +6735,14 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
6610
6735
|
// wrap value if unmapped
|
|
6611
6736
|
if (!(message instanceof this.ctor) && message instanceof Message) {
|
|
6612
6737
|
var object = message.$type.toObject(message, options);
|
|
6613
|
-
|
|
6738
|
+
var messageName = message.$type.fullName[0] === "." ?
|
|
6739
|
+
message.$type.fullName.substr(1) : message.$type.fullName;
|
|
6740
|
+
// Default to type.googleapis.com prefix if no prefix is used
|
|
6741
|
+
if (prefix === "") {
|
|
6742
|
+
prefix = googleApi;
|
|
6743
|
+
}
|
|
6744
|
+
name = prefix + messageName;
|
|
6745
|
+
object["@type"] = name;
|
|
6614
6746
|
return object;
|
|
6615
6747
|
}
|
|
6616
6748
|
|