protobufjs 8.1.6-experimental → 8.2.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.
Files changed (76) hide show
  1. package/README.md +219 -565
  2. package/dist/light/protobuf.js +1986 -1483
  3. package/dist/light/protobuf.js.map +1 -1
  4. package/dist/light/protobuf.min.js +3 -3
  5. package/dist/light/protobuf.min.js.map +1 -1
  6. package/dist/minimal/protobuf.js +1122 -861
  7. package/dist/minimal/protobuf.js.map +1 -1
  8. package/dist/minimal/protobuf.min.js +3 -3
  9. package/dist/minimal/protobuf.min.js.map +1 -1
  10. package/dist/protobuf.js +2089 -1513
  11. package/dist/protobuf.js.map +1 -1
  12. package/dist/protobuf.min.js +3 -3
  13. package/dist/protobuf.min.js.map +1 -1
  14. package/ext/README.md +81 -0
  15. package/ext/descriptor/README.md +3 -70
  16. package/ext/descriptor/index.d.ts +1 -191
  17. package/ext/descriptor/index.js +1 -1161
  18. package/ext/descriptor.d.ts +309 -0
  19. package/ext/descriptor.js +1236 -0
  20. package/ext/textformat.d.ts +30 -0
  21. package/ext/textformat.js +1249 -0
  22. package/google/protobuf/compiler/plugin.json +126 -0
  23. package/google/protobuf/compiler/plugin.proto +47 -0
  24. package/google/protobuf/descriptor.json +2 -2
  25. package/google/protobuf/descriptor.proto +2 -1
  26. package/index.d.ts +590 -476
  27. package/package.json +23 -38
  28. package/src/converter.js +60 -24
  29. package/src/decoder.js +122 -49
  30. package/src/encoder.js +10 -2
  31. package/src/enum.js +4 -1
  32. package/src/field.js +10 -7
  33. package/src/mapfield.js +1 -0
  34. package/src/message.js +7 -6
  35. package/src/method.js +4 -3
  36. package/src/namespace.js +23 -12
  37. package/src/object.js +24 -19
  38. package/src/oneof.js +2 -0
  39. package/src/parse.js +114 -46
  40. package/src/reader.js +145 -30
  41. package/src/reader_buffer.js +24 -3
  42. package/src/root.js +7 -4
  43. package/src/service.js +12 -6
  44. package/src/tokenize.js +6 -1
  45. package/src/type.js +48 -25
  46. package/src/types.js +1 -1
  47. package/src/util/aspromise.d.ts +13 -0
  48. package/src/util/aspromise.js +52 -0
  49. package/src/util/base64.d.ts +32 -0
  50. package/src/util/base64.js +146 -0
  51. package/src/util/codegen.d.ts +31 -0
  52. package/src/util/codegen.js +113 -0
  53. package/src/util/eventemitter.d.ts +45 -0
  54. package/src/util/eventemitter.js +84 -0
  55. package/src/util/fetch.d.ts +56 -0
  56. package/src/util/fetch.js +112 -0
  57. package/src/util/float.d.ts +83 -0
  58. package/src/util/float.js +335 -0
  59. package/src/util/fs.js +11 -0
  60. package/src/util/inquire.d.ts +10 -0
  61. package/src/util/inquire.js +38 -0
  62. package/src/util/minimal.js +67 -12
  63. package/src/util/path.d.ts +22 -0
  64. package/src/util/path.js +72 -0
  65. package/src/util/patterns.js +8 -0
  66. package/src/util/pool.d.ts +32 -0
  67. package/src/util/pool.js +48 -0
  68. package/src/util/utf8.d.ts +24 -0
  69. package/src/util/utf8.js +104 -0
  70. package/src/util.js +30 -13
  71. package/src/verifier.js +7 -4
  72. package/src/wrappers.js +4 -3
  73. package/src/writer.js +27 -4
  74. package/src/writer_buffer.js +12 -0
  75. package/tsconfig.json +2 -2
  76. package/ext/descriptor/test.js +0 -54
@@ -0,0 +1,309 @@
1
+ import * as $protobuf from "..";
2
+
3
+ type DescriptorInput<T> = T | $protobuf.Reader | Uint8Array;
4
+
5
+ declare module ".." {
6
+ namespace Root {
7
+ /** Creates a root from a descriptor set. */
8
+ function fromDescriptor(descriptor: DescriptorInput<IFileDescriptorSet>): $protobuf.Root;
9
+ }
10
+
11
+ interface Root {
12
+ /** Converts this root to a descriptor set. */
13
+ toDescriptor(edition?: string): $protobuf.Message<IFileDescriptorSet> & IFileDescriptorSet;
14
+ }
15
+
16
+ namespace Type {
17
+ /** Creates a type from a descriptor. */
18
+ function fromDescriptor(descriptor: DescriptorInput<IDescriptorProto>, edition?: string, nested?: boolean): $protobuf.Type;
19
+ }
20
+
21
+ interface Type {
22
+ /** Converts this type to a descriptor. */
23
+ toDescriptor(edition?: string): $protobuf.Message<IDescriptorProto> & IDescriptorProto;
24
+ }
25
+
26
+ namespace Field {
27
+ /** Creates a field from a descriptor. */
28
+ function fromDescriptor(descriptor: DescriptorInput<IFieldDescriptorProto>, edition?: string, nested?: boolean): $protobuf.Field;
29
+ }
30
+
31
+ interface Field {
32
+ /** Converts this field to a descriptor. */
33
+ toDescriptor(edition?: string): $protobuf.Message<IFieldDescriptorProto> & IFieldDescriptorProto;
34
+ }
35
+
36
+ namespace Enum {
37
+ /** Creates an enum from a descriptor. */
38
+ function fromDescriptor(descriptor: DescriptorInput<IEnumDescriptorProto>, edition?: string, nested?: boolean): $protobuf.Enum;
39
+ }
40
+
41
+ interface Enum {
42
+ /** Converts this enum to a descriptor. */
43
+ toDescriptor(): $protobuf.Message<IEnumDescriptorProto> & IEnumDescriptorProto;
44
+ }
45
+
46
+ namespace OneOf {
47
+ /** Creates a oneof from a descriptor. */
48
+ function fromDescriptor(descriptor: DescriptorInput<IOneofDescriptorProto>): $protobuf.OneOf;
49
+ }
50
+
51
+ interface OneOf {
52
+ /** Converts this oneof to a descriptor. */
53
+ toDescriptor(): $protobuf.Message<IOneofDescriptorProto> & IOneofDescriptorProto;
54
+ }
55
+
56
+ namespace Service {
57
+ /** Creates a service from a descriptor. */
58
+ function fromDescriptor(descriptor: DescriptorInput<IServiceDescriptorProto>, edition?: string, nested?: boolean): $protobuf.Service;
59
+ }
60
+
61
+ interface Service {
62
+ /** Converts this service to a descriptor. */
63
+ toDescriptor(): $protobuf.Message<IServiceDescriptorProto> & IServiceDescriptorProto;
64
+ }
65
+
66
+ namespace Method {
67
+ /** Creates a method from a descriptor. */
68
+ function fromDescriptor(descriptor: DescriptorInput<IMethodDescriptorProto>): $protobuf.Method;
69
+ }
70
+
71
+ interface Method {
72
+ /** Converts this method to a descriptor. */
73
+ toDescriptor(): $protobuf.Message<IMethodDescriptorProto> & IMethodDescriptorProto;
74
+ }
75
+ }
76
+
77
+ export const FileDescriptorSet: $protobuf.Type;
78
+
79
+ export const FileDescriptorProto: $protobuf.Type;
80
+
81
+ export const DescriptorProto: $protobuf.Type & {
82
+ ExtensionRange: $protobuf.Type,
83
+ ReservedRange: $protobuf.Type
84
+ };
85
+
86
+ export const FieldDescriptorProto: $protobuf.Type & {
87
+ Label: $protobuf.Enum,
88
+ Type: $protobuf.Enum
89
+ };
90
+
91
+ export const OneofDescriptorProto: $protobuf.Type;
92
+
93
+ export const EnumDescriptorProto: $protobuf.Type;
94
+
95
+ export const ServiceDescriptorProto: $protobuf.Type;
96
+
97
+ export const EnumValueDescriptorProto: $protobuf.Type;
98
+
99
+ export const MethodDescriptorProto: $protobuf.Type;
100
+
101
+ export const FileOptions: $protobuf.Type & {
102
+ OptimizeMode: $protobuf.Enum
103
+ };
104
+
105
+ export const MessageOptions: $protobuf.Type;
106
+
107
+ export const FieldOptions: $protobuf.Type & {
108
+ CType: $protobuf.Enum,
109
+ JSType: $protobuf.Enum
110
+ };
111
+
112
+ export const OneofOptions: $protobuf.Type;
113
+
114
+ export const EnumOptions: $protobuf.Type;
115
+
116
+ export const EnumValueOptions: $protobuf.Type;
117
+
118
+ export const ServiceOptions: $protobuf.Type;
119
+
120
+ export const MethodOptions: $protobuf.Type;
121
+
122
+ export const FeatureSet: $protobuf.Type & {
123
+ FieldPresence: $protobuf.Enum,
124
+ EnumType: $protobuf.Enum,
125
+ RepeatedFieldEncoding: $protobuf.Enum,
126
+ Utf8Validation: $protobuf.Enum,
127
+ MessageEncoding: $protobuf.Enum,
128
+ JsonFormat: $protobuf.Enum,
129
+ EnforceNamingStyle: $protobuf.Enum,
130
+ VisibilityFeature: $protobuf.Type
131
+ };
132
+
133
+ export const FeatureSetDefaults: $protobuf.Type & {
134
+ FeatureSetEditionDefault: $protobuf.Type
135
+ };
136
+
137
+ export const UninterpretedOption: $protobuf.Type & {
138
+ NamePart: $protobuf.Type
139
+ };
140
+
141
+ export const SourceCodeInfo: $protobuf.Type & {
142
+ Location: $protobuf.Type
143
+ };
144
+
145
+ export const GeneratedCodeInfo: $protobuf.Type & {
146
+ Annotation: $protobuf.Type
147
+ };
148
+
149
+ export interface IFileDescriptorSet {
150
+ file: IFileDescriptorProto[];
151
+ }
152
+
153
+ export interface IFileDescriptorProto {
154
+ name?: string;
155
+ package?: string;
156
+ dependency?: any;
157
+ publicDependency?: any;
158
+ weakDependency?: any;
159
+ messageType?: IDescriptorProto[];
160
+ enumType?: IEnumDescriptorProto[];
161
+ service?: IServiceDescriptorProto[];
162
+ extension?: IFieldDescriptorProto[];
163
+ options?: IFileOptions;
164
+ sourceCodeInfo?: any;
165
+ syntax?: string;
166
+ edition?: IEdition;
167
+ }
168
+
169
+ type IEdition = number;
170
+
171
+ export interface IFileOptions {
172
+ javaPackage?: string;
173
+ javaOuterClassname?: string;
174
+ javaMultipleFiles?: boolean;
175
+ javaGenerateEqualsAndHash?: boolean;
176
+ javaStringCheckUtf8?: boolean;
177
+ optimizeFor?: IFileOptionsOptimizeMode;
178
+ goPackage?: string;
179
+ ccGenericServices?: boolean;
180
+ javaGenericServices?: boolean;
181
+ pyGenericServices?: boolean;
182
+ deprecated?: boolean;
183
+ ccEnableArenas?: boolean;
184
+ objcClassPrefix?: string;
185
+ csharpNamespace?: string;
186
+ }
187
+
188
+ type IFileOptionsOptimizeMode = number;
189
+
190
+ export interface IDescriptorProto {
191
+ name?: string;
192
+ field?: IFieldDescriptorProto[];
193
+ extension?: IFieldDescriptorProto[];
194
+ nestedType?: IDescriptorProto[];
195
+ enumType?: IEnumDescriptorProto[];
196
+ extensionRange?: IDescriptorProtoExtensionRange[];
197
+ oneofDecl?: IOneofDescriptorProto[];
198
+ options?: IMessageOptions;
199
+ reservedRange?: IDescriptorProtoReservedRange[];
200
+ reservedName?: string[];
201
+ }
202
+
203
+ export interface IMessageOptions {
204
+ mapEntry?: boolean;
205
+ }
206
+
207
+ export interface IDescriptorProtoExtensionRange {
208
+ start?: number;
209
+ end?: number;
210
+ }
211
+
212
+ export interface IDescriptorProtoReservedRange {
213
+ start?: number;
214
+ end?: number;
215
+ }
216
+
217
+ export interface IFieldDescriptorProto {
218
+ name?: string;
219
+ number?: number;
220
+ label?: IFieldDescriptorProtoLabel;
221
+ type?: IFieldDescriptorProtoType;
222
+ typeName?: string;
223
+ extendee?: string;
224
+ defaultValue?: string;
225
+ oneofIndex?: number;
226
+ jsonName?: any;
227
+ options?: IFieldOptions;
228
+ proto3Optional?: boolean;
229
+ }
230
+
231
+ type IFieldDescriptorProtoLabel = number;
232
+
233
+ type IFieldDescriptorProtoType = number;
234
+
235
+ export interface IFieldOptions {
236
+ packed?: boolean;
237
+ jstype?: IFieldOptionsJSType;
238
+ }
239
+
240
+ type IFieldOptionsJSType = number;
241
+
242
+ export interface IEnumDescriptorProto {
243
+ name?: string;
244
+ value?: IEnumValueDescriptorProto[];
245
+ options?: IEnumOptions;
246
+ }
247
+
248
+ export interface IEnumValueDescriptorProto {
249
+ name?: string;
250
+ number?: number;
251
+ options?: IEnumValueOptions;
252
+ }
253
+
254
+ export interface IEnumOptions {
255
+ allowAlias?: boolean;
256
+ deprecated?: boolean;
257
+ }
258
+
259
+ export interface IOneofDescriptorProto {
260
+ name?: string;
261
+ options?: IOneofOptions;
262
+ }
263
+
264
+ export interface IOneofOptions {
265
+ features?: IFeatureSet;
266
+ uninterpretedOption?: any[];
267
+ }
268
+
269
+ export interface IEnumValueOptions {
270
+ deprecated?: boolean;
271
+ features?: IFeatureSet;
272
+ debugRedact?: boolean;
273
+ featureSupport?: any;
274
+ uninterpretedOption?: any[];
275
+ }
276
+
277
+ export interface IFeatureSet {
278
+ fieldPresence?: number;
279
+ enumType?: number;
280
+ repeatedFieldEncoding?: number;
281
+ utf8Validation?: number;
282
+ messageEncoding?: number;
283
+ jsonFormat?: number;
284
+ enforceNamingStyle?: number;
285
+ defaultSymbolVisibility?: number;
286
+ }
287
+
288
+ export interface IServiceDescriptorProto {
289
+ name?: string;
290
+ method?: IMethodDescriptorProto[];
291
+ options?: IServiceOptions;
292
+ }
293
+
294
+ export interface IServiceOptions {
295
+ deprecated?: boolean;
296
+ }
297
+
298
+ export interface IMethodDescriptorProto {
299
+ name?: string;
300
+ inputType?: string;
301
+ outputType?: string;
302
+ options?: IMethodOptions;
303
+ clientStreaming?: boolean;
304
+ serverStreaming?: boolean;
305
+ }
306
+
307
+ export interface IMethodOptions {
308
+ deprecated?: boolean;
309
+ }