protobufjs 8.7.0 → 8.7.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/README.md +1 -1
- package/dist/light/protobuf.js +16 -11
- 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 +14 -9
- 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 +72 -33
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/ext/protojson.js +5 -1
- package/google/api/annotations.json +3 -1
- package/google/api/http.json +2 -1
- package/google/protobuf/api.json +12 -6
- package/google/protobuf/descriptor.json +170 -87
- package/google/protobuf/descriptor.proto +0 -8
- package/google/protobuf/source_context.json +2 -1
- package/google/protobuf/type.json +14 -7
- package/package.json +4 -4
- package/src/common.js +12 -6
- package/src/converter.js +1 -1
- package/src/decoder.js +1 -1
- package/src/index-minimal.js +1 -0
- package/src/parse.js +44 -16
- package/src/util/longbits.js +10 -6
|
@@ -2,14 +2,6 @@ syntax = "proto2";
|
|
|
2
2
|
|
|
3
3
|
package google.protobuf;
|
|
4
4
|
|
|
5
|
-
option go_package = "google.golang.org/protobuf/types/descriptorpb";
|
|
6
|
-
option java_package = "com.google.protobuf";
|
|
7
|
-
option java_outer_classname = "DescriptorProtos";
|
|
8
|
-
option csharp_namespace = "Google.Protobuf.Reflection";
|
|
9
|
-
option objc_class_prefix = "GPB";
|
|
10
|
-
option cc_enable_arenas = true;
|
|
11
|
-
option optimize_for = "SPEED";
|
|
12
|
-
|
|
13
5
|
message FileDescriptorSet {
|
|
14
6
|
|
|
15
7
|
repeated FileDescriptorProto file = 1;
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"sourceContext": {
|
|
29
29
|
"type": "SourceContext",
|
|
30
|
-
"id": 5
|
|
30
|
+
"id": 5,
|
|
31
|
+
"protoName": "source_context"
|
|
31
32
|
},
|
|
32
33
|
"syntax": {
|
|
33
34
|
"type": "Syntax",
|
|
@@ -55,11 +56,13 @@
|
|
|
55
56
|
},
|
|
56
57
|
"typeUrl": {
|
|
57
58
|
"type": "string",
|
|
58
|
-
"id": 6
|
|
59
|
+
"id": 6,
|
|
60
|
+
"protoName": "type_url"
|
|
59
61
|
},
|
|
60
62
|
"oneofIndex": {
|
|
61
63
|
"type": "int32",
|
|
62
|
-
"id": 7
|
|
64
|
+
"id": 7,
|
|
65
|
+
"protoName": "oneof_index"
|
|
63
66
|
},
|
|
64
67
|
"packed": {
|
|
65
68
|
"type": "bool",
|
|
@@ -72,11 +75,13 @@
|
|
|
72
75
|
},
|
|
73
76
|
"jsonName": {
|
|
74
77
|
"type": "string",
|
|
75
|
-
"id": 10
|
|
78
|
+
"id": 10,
|
|
79
|
+
"protoName": "json_name"
|
|
76
80
|
},
|
|
77
81
|
"defaultValue": {
|
|
78
82
|
"type": "string",
|
|
79
|
-
"id": 11
|
|
83
|
+
"id": 11,
|
|
84
|
+
"protoName": "default_value"
|
|
80
85
|
}
|
|
81
86
|
},
|
|
82
87
|
"nested": {
|
|
@@ -131,7 +136,8 @@
|
|
|
131
136
|
},
|
|
132
137
|
"sourceContext": {
|
|
133
138
|
"type": "SourceContext",
|
|
134
|
-
"id": 4
|
|
139
|
+
"id": 4,
|
|
140
|
+
"protoName": "source_context"
|
|
135
141
|
},
|
|
136
142
|
"syntax": {
|
|
137
143
|
"type": "Syntax",
|
|
@@ -190,7 +196,8 @@
|
|
|
190
196
|
"fields": {
|
|
191
197
|
"fileName": {
|
|
192
198
|
"type": "string",
|
|
193
|
-
"id": 1
|
|
199
|
+
"id": 1,
|
|
200
|
+
"protoName": "file_name"
|
|
194
201
|
}
|
|
195
202
|
}
|
|
196
203
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "protobufjs",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Protocol Buffers for JavaScript & TypeScript.",
|
|
5
5
|
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^10.0.0",
|
|
52
|
-
"@types/node": "
|
|
52
|
+
"@types/node": "^18.19.130",
|
|
53
53
|
"browserify": "^17.0.0",
|
|
54
54
|
"browserify-wrap": "^1.0.2",
|
|
55
55
|
"bundle-collapser": "^1.3.0",
|
|
56
|
-
"escodegen": "^
|
|
56
|
+
"escodegen": "^2.0.0",
|
|
57
57
|
"eslint": "^10.0.0",
|
|
58
58
|
"eslint-plugin-jsdoc": "^63.0.0",
|
|
59
59
|
"espree": "^9.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"reflect-metadata": "^0.2.0",
|
|
72
72
|
"tape": "^5.0.0",
|
|
73
73
|
"tslint": "^6.0.0",
|
|
74
|
-
"typescript": "^
|
|
74
|
+
"typescript": "^4.9.5",
|
|
75
75
|
"vinyl-buffer": "^1.0.1",
|
|
76
76
|
"vinyl-fs": "^4.0.0",
|
|
77
77
|
"vinyl-source-stream": "^2.0.0"
|
package/src/common.js
CHANGED
|
@@ -163,27 +163,33 @@ common("struct", {
|
|
|
163
163
|
fields: {
|
|
164
164
|
nullValue: {
|
|
165
165
|
type: "NullValue",
|
|
166
|
-
id: 1
|
|
166
|
+
id: 1,
|
|
167
|
+
protoName: "null_value"
|
|
167
168
|
},
|
|
168
169
|
numberValue: {
|
|
169
170
|
type: "double",
|
|
170
|
-
id: 2
|
|
171
|
+
id: 2,
|
|
172
|
+
protoName: "number_value"
|
|
171
173
|
},
|
|
172
174
|
stringValue: {
|
|
173
175
|
type: "string",
|
|
174
|
-
id: 3
|
|
176
|
+
id: 3,
|
|
177
|
+
protoName: "string_value"
|
|
175
178
|
},
|
|
176
179
|
boolValue: {
|
|
177
180
|
type: "bool",
|
|
178
|
-
id: 4
|
|
181
|
+
id: 4,
|
|
182
|
+
protoName: "bool_value"
|
|
179
183
|
},
|
|
180
184
|
structValue: {
|
|
181
185
|
type: "Struct",
|
|
182
|
-
id: 5
|
|
186
|
+
id: 5,
|
|
187
|
+
protoName: "struct_value"
|
|
183
188
|
},
|
|
184
189
|
listValue: {
|
|
185
190
|
type: "ListValue",
|
|
186
|
-
id: 6
|
|
191
|
+
id: 6,
|
|
192
|
+
protoName: "list_value"
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
},
|
package/src/converter.js
CHANGED
|
@@ -298,7 +298,7 @@ converter.toObject = function toObject(mtype) {
|
|
|
298
298
|
else if (field.bytes) {
|
|
299
299
|
var arrayDefault = Array.prototype.slice.call(field.typeDefault);
|
|
300
300
|
gen
|
|
301
|
-
("if(o.bytes===String)d%s=%j", prop,
|
|
301
|
+
("if(o.bytes===String)d%s=%j", prop, util.base64.encode(field.typeDefault, 0, field.typeDefault.length))
|
|
302
302
|
("else{")
|
|
303
303
|
("d%s=%j", prop, arrayDefault)
|
|
304
304
|
("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop)
|
package/src/decoder.js
CHANGED
|
@@ -102,7 +102,7 @@ function decoder(mtype) {
|
|
|
102
102
|
("break");
|
|
103
103
|
|
|
104
104
|
if (types.basic[type] === undefined) gen
|
|
105
|
-
("v=types[%i].decode(r,r.uint32(),undefined,q+1)", i); // can't be groups
|
|
105
|
+
("v=types[%i].decode(r,r.uint32(),undefined,q+1,v)", i); // can't be groups
|
|
106
106
|
else gen
|
|
107
107
|
("v=r.%s()", type === "string" ? stringMethod(field) : type);
|
|
108
108
|
|
package/src/index-minimal.js
CHANGED
package/src/parse.js
CHANGED
|
@@ -559,6 +559,10 @@ function parse(source, root, options) {
|
|
|
559
559
|
case ";":
|
|
560
560
|
break;
|
|
561
561
|
|
|
562
|
+
case "map":
|
|
563
|
+
parseMapField(type);
|
|
564
|
+
break;
|
|
565
|
+
|
|
562
566
|
case "option":
|
|
563
567
|
parseOption(type, token);
|
|
564
568
|
skip(";");
|
|
@@ -688,7 +692,8 @@ function parse(source, root, options) {
|
|
|
688
692
|
if ((token = next()) === null || !nameRe.test(token))
|
|
689
693
|
throw illegal(token, "name");
|
|
690
694
|
|
|
691
|
-
var enm = new Enum(token)
|
|
695
|
+
var enm = new Enum(token),
|
|
696
|
+
values = [];
|
|
692
697
|
ifBlock(enm, function parseEnum_block(token) {
|
|
693
698
|
switch(token) {
|
|
694
699
|
case ";":
|
|
@@ -705,16 +710,18 @@ function parse(source, root, options) {
|
|
|
705
710
|
break;
|
|
706
711
|
|
|
707
712
|
default:
|
|
708
|
-
parseEnumValue(
|
|
713
|
+
values.push(parseEnumValue(token));
|
|
709
714
|
}
|
|
710
715
|
});
|
|
716
|
+
for (var i = 0; i < values.length; ++i)
|
|
717
|
+
enm.add(values[i].name, values[i].id, values[i].comment, values[i].options);
|
|
711
718
|
parent.add(enm);
|
|
712
719
|
if (parent === ptr) {
|
|
713
720
|
topLevelObjects.push(enm);
|
|
714
721
|
}
|
|
715
722
|
}
|
|
716
723
|
|
|
717
|
-
function parseEnumValue(
|
|
724
|
+
function parseEnumValue(token) {
|
|
718
725
|
|
|
719
726
|
/* istanbul ignore if */
|
|
720
727
|
if (!nameRe.test(token))
|
|
@@ -746,7 +753,12 @@ function parse(source, root, options) {
|
|
|
746
753
|
}, function parseEnumValue_line() {
|
|
747
754
|
parseInlineOptions(dummy); // skip
|
|
748
755
|
});
|
|
749
|
-
|
|
756
|
+
return {
|
|
757
|
+
name: token,
|
|
758
|
+
id: value,
|
|
759
|
+
comment: dummy.comment,
|
|
760
|
+
options: dummy.parsedOptions || dummy.options
|
|
761
|
+
};
|
|
750
762
|
}
|
|
751
763
|
|
|
752
764
|
function parseOption(parent, token) {
|
|
@@ -797,16 +809,27 @@ function parse(source, root, options) {
|
|
|
797
809
|
var objectResult = {};
|
|
798
810
|
|
|
799
811
|
while (!skip("}", true)) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
if (token ===
|
|
805
|
-
|
|
812
|
+
token = next();
|
|
813
|
+
var propName;
|
|
814
|
+
if (token === null)
|
|
815
|
+
throw illegal(token, "end of input");
|
|
816
|
+
if (token === "[") {
|
|
817
|
+
token = next();
|
|
818
|
+
// Extension name or, for Any, a type URL: "<prefix>/<fully.qualified.Type>".
|
|
819
|
+
var slash = token === null ? -1 : token.lastIndexOf("/");
|
|
820
|
+
if (token === null || !typeRefRe.test(slash < 0 ? token : token.slice(slash + 1)))
|
|
821
|
+
throw illegal(token, "name");
|
|
822
|
+
propName = "[" + token + "]";
|
|
823
|
+
skip("]");
|
|
824
|
+
} else {
|
|
825
|
+
/* istanbul ignore if */
|
|
826
|
+
if (!nameRe.test(token)) {
|
|
827
|
+
throw illegal(token, "name");
|
|
828
|
+
}
|
|
829
|
+
propName = token;
|
|
806
830
|
}
|
|
807
831
|
|
|
808
832
|
var value;
|
|
809
|
-
var propName = token;
|
|
810
833
|
|
|
811
834
|
skip(":", true);
|
|
812
835
|
|
|
@@ -814,25 +837,30 @@ function parse(source, root, options) {
|
|
|
814
837
|
// option (my_option) = {
|
|
815
838
|
// repeated_value: [ "foo", "bar" ]
|
|
816
839
|
// };
|
|
817
|
-
value = parseOptionValue(parent, name + "." +
|
|
840
|
+
value = parseOptionValue(parent, name + "." + propName, depth + 1);
|
|
818
841
|
} else if (peek() === "[") {
|
|
819
842
|
value = [];
|
|
820
|
-
var lastValue
|
|
843
|
+
var lastValue,
|
|
844
|
+
lastValueIsAggregate;
|
|
821
845
|
if (skip("[", true)) {
|
|
822
846
|
if (!skip("]", true)) {
|
|
823
847
|
do {
|
|
824
|
-
|
|
848
|
+
lastValueIsAggregate = peek() === "{";
|
|
849
|
+
lastValue = lastValueIsAggregate
|
|
850
|
+
? parseOptionValue(parent, name + "." + propName, depth + 1)
|
|
851
|
+
: readValue(true);
|
|
825
852
|
value.push(lastValue);
|
|
826
853
|
} while (skip(",", true));
|
|
827
854
|
skip("]");
|
|
828
855
|
if (typeof lastValue !== "undefined") {
|
|
829
|
-
|
|
856
|
+
if (!lastValueIsAggregate)
|
|
857
|
+
setOption(parent, name + "." + propName, lastValue);
|
|
830
858
|
}
|
|
831
859
|
}
|
|
832
860
|
}
|
|
833
861
|
} else {
|
|
834
862
|
value = readValue(true);
|
|
835
|
-
setOption(parent, name + "." +
|
|
863
|
+
setOption(parent, name + "." + propName, value);
|
|
836
864
|
}
|
|
837
865
|
|
|
838
866
|
var prevValue = Object.prototype.hasOwnProperty.call(objectResult, propName)
|
package/src/util/longbits.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
module.exports = LongBits;
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var Long;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Constructs new long bits.
|
|
@@ -80,10 +80,10 @@ LongBits.fromNumber = function fromNumber(value) {
|
|
|
80
80
|
LongBits.from = function from(value) {
|
|
81
81
|
if (typeof value === "number")
|
|
82
82
|
return LongBits.fromNumber(value);
|
|
83
|
-
if (
|
|
83
|
+
if (typeof value === "string" || value instanceof String) {
|
|
84
84
|
/* istanbul ignore else */
|
|
85
|
-
if (
|
|
86
|
-
value =
|
|
85
|
+
if (Long)
|
|
86
|
+
value = Long.fromString(value);
|
|
87
87
|
else
|
|
88
88
|
return LongBits.fromNumber(parseInt(value, 10));
|
|
89
89
|
}
|
|
@@ -112,8 +112,8 @@ LongBits.prototype.toNumber = function toNumber(unsigned) {
|
|
|
112
112
|
* @returns {Long} Long
|
|
113
113
|
*/
|
|
114
114
|
LongBits.prototype.toLong = function toLong(unsigned) {
|
|
115
|
-
return
|
|
116
|
-
? new
|
|
115
|
+
return Long
|
|
116
|
+
? new Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
|
|
117
117
|
/* istanbul ignore next */
|
|
118
118
|
: { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
|
|
119
119
|
};
|
|
@@ -198,3 +198,7 @@ LongBits.prototype.length = function length() {
|
|
|
198
198
|
: part1 < 2097152 ? 7 : 8
|
|
199
199
|
: part2 < 128 ? 9 : 10;
|
|
200
200
|
};
|
|
201
|
+
|
|
202
|
+
LongBits._configure = function(Long_) {
|
|
203
|
+
Long = Long_;
|
|
204
|
+
};
|