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/ext/descriptor.js
CHANGED
|
@@ -609,6 +609,16 @@ Field.prototype.toDescriptor = function toDescriptor(edition) {
|
|
|
609
609
|
* @property {IEnumValueOptions} [options] Enum value options
|
|
610
610
|
*/
|
|
611
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Properties of an EnumValueOptions message.
|
|
614
|
+
* @interface IEnumValueOptions
|
|
615
|
+
* @property {boolean} [deprecated]
|
|
616
|
+
* @property {IFeatureSet} [features]
|
|
617
|
+
* @property {boolean} [debugRedact]
|
|
618
|
+
* @property {*} [featureSupport]
|
|
619
|
+
* @property {Array.<*>} [uninterpretedOption]
|
|
620
|
+
*/
|
|
621
|
+
|
|
612
622
|
/**
|
|
613
623
|
* Properties of an EnumOptions message.
|
|
614
624
|
* @interface IEnumOptions
|
|
@@ -616,6 +626,19 @@ Field.prototype.toDescriptor = function toDescriptor(edition) {
|
|
|
616
626
|
* @property {boolean} [deprecated]
|
|
617
627
|
*/
|
|
618
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Properties of a FeatureSet message.
|
|
631
|
+
* @interface IFeatureSet
|
|
632
|
+
* @property {number} [fieldPresence]
|
|
633
|
+
* @property {number} [enumType]
|
|
634
|
+
* @property {number} [repeatedFieldEncoding]
|
|
635
|
+
* @property {number} [utf8Validation]
|
|
636
|
+
* @property {number} [messageEncoding]
|
|
637
|
+
* @property {number} [jsonFormat]
|
|
638
|
+
* @property {number} [enforceNamingStyle]
|
|
639
|
+
* @property {number} [defaultSymbolVisibility]
|
|
640
|
+
*/
|
|
641
|
+
|
|
619
642
|
var unnamedEnumIndex = 0;
|
|
620
643
|
|
|
621
644
|
/**
|
|
@@ -692,6 +715,13 @@ Enum.prototype.toDescriptor = function toDescriptor() {
|
|
|
692
715
|
* @property {IOneofOptions} [options] Oneof options
|
|
693
716
|
*/
|
|
694
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Properties of a OneofOptions message.
|
|
720
|
+
* @interface IOneofOptions
|
|
721
|
+
* @property {IFeatureSet} [features]
|
|
722
|
+
* @property {Array.<*>} [uninterpretedOption]
|
|
723
|
+
*/
|
|
724
|
+
|
|
695
725
|
var unnamedOneofIndex = 0;
|
|
696
726
|
|
|
697
727
|
/**
|
|
@@ -1056,186 +1086,181 @@ function editionToDescriptor(edition, fileDescriptor) {
|
|
|
1056
1086
|
/**
|
|
1057
1087
|
* Reflected file descriptor set.
|
|
1058
1088
|
* @name FileDescriptorSet
|
|
1059
|
-
* @type {Type}
|
|
1089
|
+
* @type {$protobuf.Type}
|
|
1060
1090
|
* @const
|
|
1061
|
-
* @tstype $protobuf.Type
|
|
1062
1091
|
*/
|
|
1063
1092
|
|
|
1064
1093
|
/**
|
|
1065
1094
|
* Reflected file descriptor proto.
|
|
1066
1095
|
* @name FileDescriptorProto
|
|
1067
|
-
* @type {Type}
|
|
1096
|
+
* @type {$protobuf.Type}
|
|
1068
1097
|
* @const
|
|
1069
|
-
* @tstype $protobuf.Type
|
|
1070
1098
|
*/
|
|
1071
1099
|
|
|
1072
1100
|
/**
|
|
1073
1101
|
* Reflected descriptor proto.
|
|
1074
1102
|
* @name DescriptorProto
|
|
1075
|
-
* @type {Type
|
|
1076
|
-
* @property {Type} ExtensionRange
|
|
1077
|
-
* @property {Type} ReservedRange
|
|
1078
|
-
* @const
|
|
1079
|
-
* @tstype $protobuf.Type & {
|
|
1103
|
+
* @type {$protobuf.Type & {
|
|
1080
1104
|
* ExtensionRange: $protobuf.Type,
|
|
1081
1105
|
* ReservedRange: $protobuf.Type
|
|
1082
|
-
* }
|
|
1106
|
+
* }}
|
|
1107
|
+
* @const
|
|
1083
1108
|
*/
|
|
1084
1109
|
|
|
1085
1110
|
/**
|
|
1086
1111
|
* Reflected field descriptor proto.
|
|
1087
1112
|
* @name FieldDescriptorProto
|
|
1088
|
-
* @type {Type
|
|
1089
|
-
* @property {Enum} Label
|
|
1090
|
-
* @property {Enum} Type
|
|
1091
|
-
* @const
|
|
1092
|
-
* @tstype $protobuf.Type & {
|
|
1113
|
+
* @type {$protobuf.Type & {
|
|
1093
1114
|
* Label: $protobuf.Enum,
|
|
1094
1115
|
* Type: $protobuf.Enum
|
|
1095
|
-
* }
|
|
1116
|
+
* }}
|
|
1117
|
+
* @const
|
|
1096
1118
|
*/
|
|
1097
1119
|
|
|
1098
1120
|
/**
|
|
1099
1121
|
* Reflected oneof descriptor proto.
|
|
1100
1122
|
* @name OneofDescriptorProto
|
|
1101
|
-
* @type {Type}
|
|
1123
|
+
* @type {$protobuf.Type}
|
|
1102
1124
|
* @const
|
|
1103
|
-
* @tstype $protobuf.Type
|
|
1104
1125
|
*/
|
|
1105
1126
|
|
|
1106
1127
|
/**
|
|
1107
1128
|
* Reflected enum descriptor proto.
|
|
1108
1129
|
* @name EnumDescriptorProto
|
|
1109
|
-
* @type {Type}
|
|
1130
|
+
* @type {$protobuf.Type}
|
|
1110
1131
|
* @const
|
|
1111
|
-
* @tstype $protobuf.Type
|
|
1112
1132
|
*/
|
|
1113
1133
|
|
|
1114
1134
|
/**
|
|
1115
1135
|
* Reflected service descriptor proto.
|
|
1116
1136
|
* @name ServiceDescriptorProto
|
|
1117
|
-
* @type {Type}
|
|
1137
|
+
* @type {$protobuf.Type}
|
|
1118
1138
|
* @const
|
|
1119
|
-
* @tstype $protobuf.Type
|
|
1120
1139
|
*/
|
|
1121
1140
|
|
|
1122
1141
|
/**
|
|
1123
1142
|
* Reflected enum value descriptor proto.
|
|
1124
1143
|
* @name EnumValueDescriptorProto
|
|
1125
|
-
* @type {Type}
|
|
1144
|
+
* @type {$protobuf.Type}
|
|
1126
1145
|
* @const
|
|
1127
|
-
* @tstype $protobuf.Type
|
|
1128
1146
|
*/
|
|
1129
1147
|
|
|
1130
1148
|
/**
|
|
1131
1149
|
* Reflected method descriptor proto.
|
|
1132
1150
|
* @name MethodDescriptorProto
|
|
1133
|
-
* @type {Type}
|
|
1151
|
+
* @type {$protobuf.Type}
|
|
1134
1152
|
* @const
|
|
1135
|
-
* @tstype $protobuf.Type
|
|
1136
1153
|
*/
|
|
1137
1154
|
|
|
1138
1155
|
/**
|
|
1139
1156
|
* Reflected file options.
|
|
1140
1157
|
* @name FileOptions
|
|
1141
|
-
* @type {Type
|
|
1142
|
-
* @property {Enum} OptimizeMode
|
|
1143
|
-
* @const
|
|
1144
|
-
* @tstype $protobuf.Type & {
|
|
1158
|
+
* @type {$protobuf.Type & {
|
|
1145
1159
|
* OptimizeMode: $protobuf.Enum
|
|
1146
|
-
* }
|
|
1160
|
+
* }}
|
|
1161
|
+
* @const
|
|
1147
1162
|
*/
|
|
1148
1163
|
|
|
1149
1164
|
/**
|
|
1150
1165
|
* Reflected message options.
|
|
1151
1166
|
* @name MessageOptions
|
|
1152
|
-
* @type {Type}
|
|
1167
|
+
* @type {$protobuf.Type}
|
|
1153
1168
|
* @const
|
|
1154
|
-
* @tstype $protobuf.Type
|
|
1155
1169
|
*/
|
|
1156
1170
|
|
|
1157
1171
|
/**
|
|
1158
1172
|
* Reflected field options.
|
|
1159
1173
|
* @name FieldOptions
|
|
1160
|
-
* @type {Type
|
|
1161
|
-
* @property {Enum} CType
|
|
1162
|
-
* @property {Enum} JSType
|
|
1163
|
-
* @const
|
|
1164
|
-
* @tstype $protobuf.Type & {
|
|
1174
|
+
* @type {$protobuf.Type & {
|
|
1165
1175
|
* CType: $protobuf.Enum,
|
|
1166
1176
|
* JSType: $protobuf.Enum
|
|
1167
|
-
* }
|
|
1177
|
+
* }}
|
|
1178
|
+
* @const
|
|
1168
1179
|
*/
|
|
1169
1180
|
|
|
1170
1181
|
/**
|
|
1171
1182
|
* Reflected oneof options.
|
|
1172
1183
|
* @name OneofOptions
|
|
1173
|
-
* @type {Type}
|
|
1184
|
+
* @type {$protobuf.Type}
|
|
1174
1185
|
* @const
|
|
1175
|
-
* @tstype $protobuf.Type
|
|
1176
1186
|
*/
|
|
1177
1187
|
|
|
1178
1188
|
/**
|
|
1179
1189
|
* Reflected enum options.
|
|
1180
1190
|
* @name EnumOptions
|
|
1181
|
-
* @type {Type}
|
|
1191
|
+
* @type {$protobuf.Type}
|
|
1182
1192
|
* @const
|
|
1183
|
-
* @tstype $protobuf.Type
|
|
1184
1193
|
*/
|
|
1185
1194
|
|
|
1186
1195
|
/**
|
|
1187
1196
|
* Reflected enum value options.
|
|
1188
1197
|
* @name EnumValueOptions
|
|
1189
|
-
* @type {Type}
|
|
1198
|
+
* @type {$protobuf.Type}
|
|
1190
1199
|
* @const
|
|
1191
|
-
* @tstype $protobuf.Type
|
|
1192
1200
|
*/
|
|
1193
1201
|
|
|
1194
1202
|
/**
|
|
1195
1203
|
* Reflected service options.
|
|
1196
1204
|
* @name ServiceOptions
|
|
1197
|
-
* @type {Type}
|
|
1205
|
+
* @type {$protobuf.Type}
|
|
1198
1206
|
* @const
|
|
1199
|
-
* @tstype $protobuf.Type
|
|
1200
1207
|
*/
|
|
1201
1208
|
|
|
1202
1209
|
/**
|
|
1203
1210
|
* Reflected method options.
|
|
1204
1211
|
* @name MethodOptions
|
|
1205
|
-
* @type {Type}
|
|
1212
|
+
* @type {$protobuf.Type}
|
|
1213
|
+
* @const
|
|
1214
|
+
*/
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* Reflected feature set.
|
|
1218
|
+
* @name FeatureSet
|
|
1219
|
+
* @type {$protobuf.Type & {
|
|
1220
|
+
* FieldPresence: $protobuf.Enum,
|
|
1221
|
+
* EnumType: $protobuf.Enum,
|
|
1222
|
+
* RepeatedFieldEncoding: $protobuf.Enum,
|
|
1223
|
+
* Utf8Validation: $protobuf.Enum,
|
|
1224
|
+
* MessageEncoding: $protobuf.Enum,
|
|
1225
|
+
* JsonFormat: $protobuf.Enum,
|
|
1226
|
+
* EnforceNamingStyle: $protobuf.Enum,
|
|
1227
|
+
* VisibilityFeature: $protobuf.Type
|
|
1228
|
+
* }}
|
|
1229
|
+
* @const
|
|
1230
|
+
*/
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Reflected feature set defaults.
|
|
1234
|
+
* @name FeatureSetDefaults
|
|
1235
|
+
* @type {$protobuf.Type & {
|
|
1236
|
+
* FeatureSetEditionDefault: $protobuf.Type
|
|
1237
|
+
* }}
|
|
1206
1238
|
* @const
|
|
1207
|
-
* @tstype $protobuf.Type
|
|
1208
1239
|
*/
|
|
1209
1240
|
|
|
1210
1241
|
/**
|
|
1211
1242
|
* Reflected uninterpretet option.
|
|
1212
1243
|
* @name UninterpretedOption
|
|
1213
|
-
* @type {Type
|
|
1214
|
-
* @property {Type} NamePart
|
|
1215
|
-
* @const
|
|
1216
|
-
* @tstype $protobuf.Type & {
|
|
1244
|
+
* @type {$protobuf.Type & {
|
|
1217
1245
|
* NamePart: $protobuf.Type
|
|
1218
|
-
* }
|
|
1246
|
+
* }}
|
|
1247
|
+
* @const
|
|
1219
1248
|
*/
|
|
1220
1249
|
|
|
1221
1250
|
/**
|
|
1222
1251
|
* Reflected source code info.
|
|
1223
1252
|
* @name SourceCodeInfo
|
|
1224
|
-
* @type {Type
|
|
1225
|
-
* @property {Type} Location
|
|
1226
|
-
* @const
|
|
1227
|
-
* @tstype $protobuf.Type & {
|
|
1253
|
+
* @type {$protobuf.Type & {
|
|
1228
1254
|
* Location: $protobuf.Type
|
|
1229
|
-
* }
|
|
1255
|
+
* }}
|
|
1256
|
+
* @const
|
|
1230
1257
|
*/
|
|
1231
1258
|
|
|
1232
1259
|
/**
|
|
1233
1260
|
* Reflected generated code info.
|
|
1234
1261
|
* @name GeneratedCodeInfo
|
|
1235
|
-
* @type {Type
|
|
1236
|
-
* @property {Type} Annotation
|
|
1237
|
-
* @const
|
|
1238
|
-
* @tstype $protobuf.Type & {
|
|
1262
|
+
* @type {$protobuf.Type & {
|
|
1239
1263
|
* Annotation: $protobuf.Type
|
|
1240
|
-
* }
|
|
1264
|
+
* }}
|
|
1265
|
+
* @const
|
|
1241
1266
|
*/
|
package/ext/textformat.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import * as $protobuf from "..";
|
|
2
|
+
import { ITextFormatOptions } from "./textformat.generated";
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
/** Also includes and formats unknown fields. */
|
|
5
|
-
unknowns?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** Maximum recursion depth for formatting length-delimited unknown fields. */
|
|
9
|
-
export let unknownRecursionLimit: number;
|
|
4
|
+
export * from "./textformat.generated";
|
|
10
5
|
|
|
11
6
|
declare module ".." {
|
|
12
7
|
namespace textformat {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// DO NOT EDIT! This is a generated file. Edit the source file instead and regenerate.
|
|
2
|
+
|
|
3
|
+
/** Maximum recursion depth for formatting length-delimited unknown fields. */
|
|
4
|
+
export let unknownRecursionLimit: number;
|
|
5
|
+
|
|
6
|
+
/** Text format options. */
|
|
7
|
+
export interface ITextFormatOptions {
|
|
8
|
+
|
|
9
|
+
/** Also includes and formats unknown fields. */
|
|
10
|
+
unknowns?: boolean;
|
|
11
|
+
}
|
package/ext/textformat.js
CHANGED
|
@@ -12,6 +12,7 @@ var textformat = protobuf.textformat = module.exports = {};
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Maximum recursion depth for formatting length-delimited unknown fields.
|
|
15
|
+
* @name unknownRecursionLimit
|
|
15
16
|
* @type {number}
|
|
16
17
|
*/
|
|
17
18
|
textformat.unknownRecursionLimit = 10;
|
|
@@ -44,6 +45,7 @@ var identRe = /^[A-Za-z_][A-Za-z0-9_]*$/,
|
|
|
44
45
|
* @param {Type} type Reflected message type
|
|
45
46
|
* @param {string} text Text format input
|
|
46
47
|
* @returns {Message<{}>} Message instance
|
|
48
|
+
* @private
|
|
47
49
|
*/
|
|
48
50
|
function parseText(type, text) {
|
|
49
51
|
if (!(type instanceof Type))
|
|
@@ -60,13 +62,19 @@ function parseText(type, text) {
|
|
|
60
62
|
return message;
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Text format options.
|
|
67
|
+
* @interface ITextFormatOptions
|
|
68
|
+
* @property {boolean} [unknowns=false] Also includes and formats unknown fields.
|
|
69
|
+
*/
|
|
70
|
+
|
|
63
71
|
/**
|
|
64
72
|
* Formats a message as protobuf text format using the specified reflected type.
|
|
65
73
|
* @param {Type} type Reflected message type
|
|
66
74
|
* @param {Message<{}>|Object.<string,*>} message Message instance or plain object
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {boolean} [options.unknowns=false] Includes and formats unknown fields
|
|
75
|
+
* @param {ITextFormatOptions} [options] Text format options
|
|
69
76
|
* @returns {string} Text format output
|
|
77
|
+
* @private
|
|
70
78
|
*/
|
|
71
79
|
function formatText(type, message, options) {
|
|
72
80
|
if (!(type instanceof Type))
|
|
@@ -89,7 +97,7 @@ Type.prototype.fromText = function fromText(text) {
|
|
|
89
97
|
/**
|
|
90
98
|
* Formats a message of this type as protobuf text format.
|
|
91
99
|
* @param {Message<{}>|Object.<string,*>} message Message instance or plain object
|
|
92
|
-
* @param {
|
|
100
|
+
* @param {ITextFormatOptions} [options] Text format options
|
|
93
101
|
* @returns {string} Text format output
|
|
94
102
|
*/
|
|
95
103
|
Type.prototype.toText = function toText(message, options) {
|