protobufjs 8.2.1 → 8.4.0
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 +61 -23
- package/dist/light/protobuf.js +28 -18
- 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 +3 -3
- package/dist/minimal/protobuf.js.map +1 -1
- package/dist/minimal/protobuf.min.js +2 -2
- package/dist/minimal/protobuf.min.js.map +1 -1
- package/dist/protobuf.js +28 -18
- 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.d.ts +11 -234
- package/ext/descriptor.generated.d.ts +409 -0
- package/ext/descriptor.js +89 -64
- package/ext/textformat.d.ts +2 -7
- package/ext/textformat.generated.d.ts +11 -0
- package/ext/textformat.js +11 -3
- package/index.d.ts +302 -268
- package/package.json +5 -5
- package/src/converter.js +5 -3
- package/src/enum.js +8 -3
- package/src/field.js +2 -0
- package/src/message.js +3 -6
- package/src/method.js +1 -1
- package/src/object.js +0 -1
- package/src/oneof.js +1 -0
- package/src/service.js +2 -0
- package/src/type.js +3 -1
- package/src/typescript.js +19 -0
- package/src/util/pool.js +1 -1
- package/tsconfig.json +2 -4
- package/src/typescript.jsdoc +0 -15
package/dist/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.4.0 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled mon, 18 may 2026 17:55:10 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -652,7 +652,9 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
|
|
|
652
652
|
case "sint64":
|
|
653
653
|
case "fixed64":
|
|
654
654
|
case "sfixed64": gen
|
|
655
|
-
("if(typeof
|
|
655
|
+
("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
|
|
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)
|
|
657
|
+
("else if(typeof m%s===\"number\")", srcProp)
|
|
656
658
|
("d%s=o.longs===String?String(m%s):m%s", dstProp, srcProp, srcProp)
|
|
657
659
|
("else") // Long-like
|
|
658
660
|
("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", dstProp, srcProp, srcProp, srcProp, isUnsigned ? "true": "", srcProp);
|
|
@@ -720,9 +722,9 @@ converter.toObject = function toObject(mtype) {
|
|
|
720
722
|
else if (field.long) gen
|
|
721
723
|
("if(util.Long){")
|
|
722
724
|
("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)
|
|
723
|
-
("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)
|
|
725
|
+
("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!==\"undefined\"&&o.longs===BigInt?n.toBigInt():n", prop)
|
|
724
726
|
("}else")
|
|
725
|
-
("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());
|
|
727
|
+
("d%s=o.longs===String?%j:typeof BigInt!==\"undefined\"&&o.longs===BigInt?BigInt(%j):%i", prop, field.typeDefault.toString(), field.typeDefault.toString(), field.typeDefault.toNumber());
|
|
726
728
|
else if (field.bytes) {
|
|
727
729
|
var arrayDefault = Array.prototype.slice.call(field.typeDefault);
|
|
728
730
|
gen
|
|
@@ -1115,7 +1117,7 @@ var Namespace = require(14),
|
|
|
1115
1117
|
* @param {Object.<string,number>} [values] Enum values as an object, by name
|
|
1116
1118
|
* @param {Object.<string,*>} [options] Declared options
|
|
1117
1119
|
* @param {string} [comment] The comment for this enum
|
|
1118
|
-
* @param {Object.<string,string>} [comments] The value comments for this enum
|
|
1120
|
+
* @param {Object.<string,string|null>} [comments] The value comments for this enum
|
|
1119
1121
|
* @param {Object.<string,Object<string,*>>|undefined} [valuesOptions] The value options for this enum
|
|
1120
1122
|
*/
|
|
1121
1123
|
function Enum(name, values, options, comment, comments, valuesOptions) {
|
|
@@ -1144,7 +1146,7 @@ function Enum(name, values, options, comment, comments, valuesOptions) {
|
|
|
1144
1146
|
|
|
1145
1147
|
/**
|
|
1146
1148
|
* Value comment texts, if any.
|
|
1147
|
-
* @type {Object.<string,string>}
|
|
1149
|
+
* @type {Object.<string,string|null>}
|
|
1148
1150
|
*/
|
|
1149
1151
|
this.comments = comments || {};
|
|
1150
1152
|
|
|
@@ -1194,8 +1196,13 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
|
|
|
1194
1196
|
/**
|
|
1195
1197
|
* Enum descriptor.
|
|
1196
1198
|
* @interface IEnum
|
|
1199
|
+
* @property {string} [edition] Edition
|
|
1197
1200
|
* @property {Object.<string,number>} values Enum values
|
|
1198
1201
|
* @property {Object.<string,*>} [options] Enum options
|
|
1202
|
+
* @property {Object.<string,Object.<string,*>>} [valuesOptions] Enum value options
|
|
1203
|
+
* @property {Array.<number[]|string>} [reserved] Reserved ranges
|
|
1204
|
+
* @property {string|null} [comment] Enum comment
|
|
1205
|
+
* @property {Object.<string,string|null>} [comments] Value comments
|
|
1199
1206
|
*/
|
|
1200
1207
|
|
|
1201
1208
|
/**
|
|
@@ -1206,7 +1213,7 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
|
|
|
1206
1213
|
* @throws {TypeError} If arguments are invalid
|
|
1207
1214
|
*/
|
|
1208
1215
|
Enum.fromJSON = function fromJSON(name, json) {
|
|
1209
|
-
var enm = new Enum(name, json.values, json.options, json.comment, json.comments);
|
|
1216
|
+
var enm = new Enum(name, json.values, json.options, json.comment, json.comments, json.valuesOptions);
|
|
1210
1217
|
enm.reserved = json.reserved;
|
|
1211
1218
|
if (json.edition)
|
|
1212
1219
|
enm._edition = json.edition;
|
|
@@ -1585,10 +1592,12 @@ Field.prototype.setOption = function setOption(name, value, ifNotSet) {
|
|
|
1585
1592
|
/**
|
|
1586
1593
|
* Field descriptor.
|
|
1587
1594
|
* @interface IField
|
|
1595
|
+
* @property {string} [edition] Edition
|
|
1588
1596
|
* @property {string} [rule="optional"] Field rule
|
|
1589
1597
|
* @property {string} type Field type
|
|
1590
1598
|
* @property {number} id Field id
|
|
1591
1599
|
* @property {Object.<string,*>} [options] Field options
|
|
1600
|
+
* @property {string|null} [comment] Field comment
|
|
1592
1601
|
*/
|
|
1593
1602
|
|
|
1594
1603
|
/**
|
|
@@ -2085,12 +2094,9 @@ var util = require(38);
|
|
|
2085
2094
|
function Message(properties) {
|
|
2086
2095
|
// not used internally
|
|
2087
2096
|
if (properties)
|
|
2088
|
-
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
continue;
|
|
2092
|
-
this[key] = properties[key];
|
|
2093
|
-
}
|
|
2097
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
2098
|
+
if (properties[keys[i]] != null && keys[i] !== "__proto__")
|
|
2099
|
+
this[keys[i]] = properties[keys[i]];
|
|
2094
2100
|
}
|
|
2095
2101
|
|
|
2096
2102
|
/**
|
|
@@ -2324,7 +2330,7 @@ function Method(name, type, requestType, responseType, requestStream, responseSt
|
|
|
2324
2330
|
* @property {boolean} [requestStream=false] Whether requests are streamed
|
|
2325
2331
|
* @property {boolean} [responseStream=false] Whether responses are streamed
|
|
2326
2332
|
* @property {Object.<string,*>} [options] Method options
|
|
2327
|
-
* @property {string} comment Method
|
|
2333
|
+
* @property {string|null} [comment] Method comment
|
|
2328
2334
|
* @property {Array.<Object.<string,*>>} [parsedOptions] Method options properly parsed into objects
|
|
2329
2335
|
*/
|
|
2330
2336
|
|
|
@@ -3085,7 +3091,6 @@ Object.defineProperties(ReflectionObject.prototype, {
|
|
|
3085
3091
|
/**
|
|
3086
3092
|
* Converts this reflection object to its descriptor representation.
|
|
3087
3093
|
* @returns {Object.<string,*>} Descriptor
|
|
3088
|
-
* @abstract
|
|
3089
3094
|
*/
|
|
3090
3095
|
ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() {
|
|
3091
3096
|
throw Error(); // not implemented, shouldn't happen
|
|
@@ -3382,6 +3387,7 @@ function OneOf(name, fieldNames, options, comment) {
|
|
|
3382
3387
|
* @interface IOneOf
|
|
3383
3388
|
* @property {Array.<string>} oneof Oneof field names
|
|
3384
3389
|
* @property {Object.<string,*>} [options] Oneof options
|
|
3390
|
+
* @property {string|null} [comment] Oneof comment
|
|
3385
3391
|
*/
|
|
3386
3392
|
|
|
3387
3393
|
/**
|
|
@@ -5869,7 +5875,9 @@ function Service(name, options) {
|
|
|
5869
5875
|
* Service descriptor.
|
|
5870
5876
|
* @interface IService
|
|
5871
5877
|
* @extends INamespace
|
|
5878
|
+
* @property {string} [edition] Edition
|
|
5872
5879
|
* @property {Object.<string,IMethod>} methods Method descriptors
|
|
5880
|
+
* @property {string|null} [comment] Service comment
|
|
5873
5881
|
*/
|
|
5874
5882
|
|
|
5875
5883
|
/**
|
|
@@ -6677,11 +6685,13 @@ function clearCache(type) {
|
|
|
6677
6685
|
* Message type descriptor.
|
|
6678
6686
|
* @interface IType
|
|
6679
6687
|
* @extends INamespace
|
|
6688
|
+
* @property {string} [edition] Edition
|
|
6680
6689
|
* @property {Object.<string,IOneOf>} [oneofs] Oneof descriptors
|
|
6681
6690
|
* @property {Object.<string,IField>} fields Field descriptors
|
|
6682
6691
|
* @property {number[][]} [extensions] Extension ranges
|
|
6683
6692
|
* @property {Array.<number[]|string>} [reserved] Reserved ranges
|
|
6684
6693
|
* @property {boolean} [group=false] Whether a legacy group or not
|
|
6694
|
+
* @property {string|null} [comment] Message type comment
|
|
6685
6695
|
*/
|
|
6686
6696
|
|
|
6687
6697
|
/**
|
|
@@ -7034,7 +7044,7 @@ Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line
|
|
|
7034
7044
|
* Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.
|
|
7035
7045
|
* @interface IConversionOptions
|
|
7036
7046
|
* @property {Function} [longs] Long conversion type.
|
|
7037
|
-
* Valid values are `String` and `Number` (the global types).
|
|
7047
|
+
* Valid values are `BigInt`, `String` and `Number` (the global types).
|
|
7038
7048
|
* Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.
|
|
7039
7049
|
* @property {Function} [enums] Enum value conversion type.
|
|
7040
7050
|
* Only valid value is `String` (the global type).
|
|
@@ -9228,7 +9238,7 @@ module.exports = pool;
|
|
|
9228
9238
|
* @param {number} start Start offset
|
|
9229
9239
|
* @param {number} end End offset
|
|
9230
9240
|
* @returns {Uint8Array} Buffer slice
|
|
9231
|
-
* @this
|
|
9241
|
+
* @this Uint8Array
|
|
9232
9242
|
*/
|
|
9233
9243
|
|
|
9234
9244
|
/**
|