protobufjs 6.8.5 → 6.8.9

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 (103) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +39 -39
  3. package/README.md +879 -879
  4. package/cli/LICENSE +33 -33
  5. package/cli/README.md +11 -11
  6. package/cli/index.d.ts +3 -3
  7. package/cli/index.js +3 -3
  8. package/cli/lib/tsd-jsdoc/LICENSE +20 -20
  9. package/cli/lib/tsd-jsdoc/README.md +23 -23
  10. package/cli/lib/tsd-jsdoc/plugin.js +21 -21
  11. package/cli/lib/tsd-jsdoc/publish.js +693 -693
  12. package/cli/lib/tsd-jsdoc.json +18 -18
  13. package/cli/package.standalone.json +31 -31
  14. package/cli/pbjs.d.ts +9 -9
  15. package/cli/pbjs.js +329 -319
  16. package/cli/pbts.d.ts +9 -9
  17. package/cli/pbts.js +197 -168
  18. package/cli/targets/json-module.js +38 -38
  19. package/cli/targets/json.js +8 -8
  20. package/cli/targets/proto.js +326 -326
  21. package/cli/targets/proto2.js +10 -10
  22. package/cli/targets/proto3.js +10 -10
  23. package/cli/targets/static-module.js +29 -29
  24. package/cli/targets/static.js +702 -705
  25. package/cli/util.js +183 -183
  26. package/cli/wrappers/amd.js +7 -7
  27. package/cli/wrappers/closure.js +7 -7
  28. package/cli/wrappers/commonjs.js +7 -7
  29. package/cli/wrappers/default.js +15 -15
  30. package/cli/wrappers/es6.js +5 -5
  31. package/dist/README.md +31 -31
  32. package/dist/light/README.md +31 -31
  33. package/dist/light/protobuf.js +6031 -6011
  34. package/dist/light/protobuf.js.map +1 -1
  35. package/dist/light/protobuf.min.js +3 -3
  36. package/dist/light/protobuf.min.js.map +1 -1
  37. package/dist/minimal/README.md +31 -31
  38. package/dist/minimal/protobuf.js +1877 -1868
  39. package/dist/minimal/protobuf.js.map +1 -1
  40. package/dist/minimal/protobuf.min.js +3 -3
  41. package/dist/minimal/protobuf.min.js.map +1 -1
  42. package/dist/protobuf.js +7594 -7573
  43. package/dist/protobuf.js.map +1 -1
  44. package/dist/protobuf.min.js +3 -3
  45. package/dist/protobuf.min.js.map +1 -1
  46. package/ext/debug/README.md +4 -4
  47. package/ext/debug/index.js +71 -71
  48. package/ext/descriptor/README.md +72 -72
  49. package/ext/descriptor/index.d.ts +0 -1
  50. package/ext/descriptor/index.js +1052 -1049
  51. package/ext/descriptor/test.js +54 -54
  52. package/google/LICENSE +27 -27
  53. package/google/README.md +1 -1
  54. package/google/api/annotations.proto +10 -10
  55. package/google/protobuf/descriptor.proto +286 -286
  56. package/google/protobuf/source_context.proto +7 -7
  57. package/index.d.ts +3 -1
  58. package/index.js +4 -4
  59. package/light.d.ts +2 -2
  60. package/light.js +3 -3
  61. package/minimal.d.ts +2 -2
  62. package/minimal.js +4 -4
  63. package/package-lock.json +5810 -3344
  64. package/package.json +24 -30
  65. package/scripts/changelog.js +150 -150
  66. package/scripts/postinstall.js +35 -35
  67. package/src/common.js +399 -399
  68. package/src/converter.js +293 -287
  69. package/src/decoder.js +106 -106
  70. package/src/encoder.js +99 -99
  71. package/src/enum.js +181 -181
  72. package/src/field.js +371 -370
  73. package/src/index-light.js +104 -104
  74. package/src/index-minimal.js +36 -36
  75. package/src/index.js +12 -12
  76. package/src/mapfield.js +126 -126
  77. package/src/message.js +138 -138
  78. package/src/method.js +151 -151
  79. package/src/namespace.js +433 -431
  80. package/src/object.js +200 -199
  81. package/src/oneof.js +203 -203
  82. package/src/parse.js +758 -757
  83. package/src/reader.js +405 -407
  84. package/src/reader_buffer.js +44 -44
  85. package/src/root.js +351 -350
  86. package/src/roots.js +18 -18
  87. package/src/rpc/service.js +142 -142
  88. package/src/rpc.js +36 -36
  89. package/src/service.js +167 -167
  90. package/src/tokenize.js +397 -397
  91. package/src/type.js +589 -589
  92. package/src/types.js +196 -196
  93. package/src/typescript.jsdoc +15 -15
  94. package/src/util/longbits.js +200 -200
  95. package/src/util/minimal.js +414 -405
  96. package/src/util.js +178 -178
  97. package/src/verifier.js +176 -176
  98. package/src/wrappers.js +83 -83
  99. package/src/writer.js +459 -459
  100. package/src/writer_buffer.js +81 -81
  101. package/tsconfig.json +6 -6
  102. package/google/protobuf/field_mask.json +0 -21
  103. package/google/protobuf/field_mask.proto +0 -7
@@ -1,4 +1,4 @@
1
- protobufjs/ext/debug
2
- =========================
3
-
4
- Experimental debugging extension.
1
+ protobufjs/ext/debug
2
+ =========================
3
+
4
+ Experimental debugging extension.
@@ -1,71 +1,71 @@
1
- "use strict";
2
- var protobuf = require("../..");
3
-
4
- /**
5
- * Debugging utility functions. Only present in debug builds.
6
- * @namespace
7
- */
8
- var debug = protobuf.debug = module.exports = {};
9
-
10
- var codegen = protobuf.util.codegen;
11
-
12
- var debugFnRe = /function ([^(]+)\(([^)]*)\) {/g;
13
-
14
- // Counts number of calls to any generated function
15
- function codegen_debug() {
16
- codegen_debug.supported = codegen.supported;
17
- codegen_debug.verbose = codegen.verbose;
18
- var gen = codegen.apply(null, Array.prototype.slice.call(arguments));
19
- gen.str = (function(str) { return function str_debug() {
20
- return str.apply(null, Array.prototype.slice.call(arguments)).replace(debugFnRe, "function $1($2) {\n\t$1.calls=($1.calls|0)+1");
21
- };})(gen.str);
22
- return gen;
23
- }
24
-
25
- /**
26
- * Returns a list of unused types within the specified root.
27
- * @param {NamespaceBase} ns Namespace to search
28
- * @returns {Type[]} Unused types
29
- */
30
- debug.unusedTypes = function unusedTypes(ns) {
31
-
32
- /* istanbul ignore if */
33
- if (!(ns instanceof protobuf.Namespace))
34
- throw TypeError("ns must be a Namespace");
35
-
36
- /* istanbul ignore if */
37
- if (!ns.nested)
38
- return [];
39
-
40
- var unused = [];
41
- for (var names = Object.keys(ns.nested), i = 0; i < names.length; ++i) {
42
- var nested = ns.nested[names[i]];
43
- if (nested instanceof protobuf.Type) {
44
- var calls = (nested.encode.calls|0)
45
- + (nested.decode.calls|0)
46
- + (nested.verify.calls|0)
47
- + (nested.toObject.calls|0)
48
- + (nested.fromObject.calls|0);
49
- if (!calls)
50
- unused.push(nested);
51
- } else if (nested instanceof protobuf.Namespace)
52
- Array.prototype.push.apply(unused, unusedTypes(nested));
53
- }
54
- return unused;
55
- };
56
-
57
- /**
58
- * Enables debugging extensions.
59
- * @returns {undefined}
60
- */
61
- debug.enable = function enable() {
62
- protobuf.util.codegen = codegen_debug;
63
- };
64
-
65
- /**
66
- * Disables debugging extensions.
67
- * @returns {undefined}
68
- */
69
- debug.disable = function disable() {
70
- protobuf.util.codegen = codegen;
71
- };
1
+ "use strict";
2
+ var protobuf = require("../..");
3
+
4
+ /**
5
+ * Debugging utility functions. Only present in debug builds.
6
+ * @namespace
7
+ */
8
+ var debug = protobuf.debug = module.exports = {};
9
+
10
+ var codegen = protobuf.util.codegen;
11
+
12
+ var debugFnRe = /function ([^(]+)\(([^)]*)\) {/g;
13
+
14
+ // Counts number of calls to any generated function
15
+ function codegen_debug() {
16
+ codegen_debug.supported = codegen.supported;
17
+ codegen_debug.verbose = codegen.verbose;
18
+ var gen = codegen.apply(null, Array.prototype.slice.call(arguments));
19
+ gen.str = (function(str) { return function str_debug() {
20
+ return str.apply(null, Array.prototype.slice.call(arguments)).replace(debugFnRe, "function $1($2) {\n\t$1.calls=($1.calls|0)+1");
21
+ };})(gen.str);
22
+ return gen;
23
+ }
24
+
25
+ /**
26
+ * Returns a list of unused types within the specified root.
27
+ * @param {NamespaceBase} ns Namespace to search
28
+ * @returns {Type[]} Unused types
29
+ */
30
+ debug.unusedTypes = function unusedTypes(ns) {
31
+
32
+ /* istanbul ignore if */
33
+ if (!(ns instanceof protobuf.Namespace))
34
+ throw TypeError("ns must be a Namespace");
35
+
36
+ /* istanbul ignore if */
37
+ if (!ns.nested)
38
+ return [];
39
+
40
+ var unused = [];
41
+ for (var names = Object.keys(ns.nested), i = 0; i < names.length; ++i) {
42
+ var nested = ns.nested[names[i]];
43
+ if (nested instanceof protobuf.Type) {
44
+ var calls = (nested.encode.calls|0)
45
+ + (nested.decode.calls|0)
46
+ + (nested.verify.calls|0)
47
+ + (nested.toObject.calls|0)
48
+ + (nested.fromObject.calls|0);
49
+ if (!calls)
50
+ unused.push(nested);
51
+ } else if (nested instanceof protobuf.Namespace)
52
+ Array.prototype.push.apply(unused, unusedTypes(nested));
53
+ }
54
+ return unused;
55
+ };
56
+
57
+ /**
58
+ * Enables debugging extensions.
59
+ * @returns {undefined}
60
+ */
61
+ debug.enable = function enable() {
62
+ protobuf.util.codegen = codegen_debug;
63
+ };
64
+
65
+ /**
66
+ * Disables debugging extensions.
67
+ * @returns {undefined}
68
+ */
69
+ debug.disable = function disable() {
70
+ protobuf.util.codegen = codegen;
71
+ };
@@ -1,72 +1,72 @@
1
- protobufjs/ext/descriptor
2
- =========================
3
-
4
- Experimental extension for interoperability with [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) types.
5
-
6
- Usage
7
- -----
8
-
9
- ```js
10
- var protobuf = require("protobufjs"), // requires the full library
11
- descriptor = require("protobufjs/ext/descriptor");
12
-
13
- var root = ...;
14
-
15
- // convert any existing root instance to the corresponding descriptor type
16
- var descriptor = root.toDescriptor("proto2");
17
- // ^ returns a FileDescriptorSet message, see table below
18
-
19
- // encode to a descriptor buffer
20
- var buffer = descriptor.FileDescriptorSet.encode(descriptor).finish();
21
-
22
- // decode from a descriptor buffer
23
- var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer);
24
-
25
- // convert any existing descriptor to a root instance
26
- root = protobuf.Root.fromDescriptor(decodedDescriptor);
27
- // ^ expects a FileDescriptorSet message or buffer, see table below
28
-
29
- // and start all over again
30
- ```
31
-
32
- API
33
- ---
34
-
35
- The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto:
36
-
37
- | Descriptor type | protobuf.js type | Remarks
38
- |-------------------------------|------------------|---------
39
- | **FileDescriptorSet** | Root |
40
- | FileDescriptorProto | | dependencies are not supported
41
- | FileOptions | |
42
- | FileOptionsOptimizeMode | |
43
- | SourceCodeInfo | | not supported
44
- | SourceCodeInfoLocation | |
45
- | GeneratedCodeInfo | | not supported
46
- | GeneratedCodeInfoAnnotation | |
47
- | **DescriptorProto** | Type |
48
- | MessageOptions | |
49
- | DescriptorProtoExtensionRange | |
50
- | DescriptorProtoReservedRange | |
51
- | **FieldDescriptorProto** | Field |
52
- | FieldDescriptorProtoLabel | |
53
- | FieldDescriptorProtoType | |
54
- | FieldOptions | |
55
- | FieldOptionsCType | |
56
- | FieldOptionsJSType | |
57
- | **OneofDescriptorProto** | OneOf |
58
- | OneofOptions | |
59
- | **EnumDescriptorProto** | Enum |
60
- | EnumOptions | |
61
- | EnumValueDescriptorProto | |
62
- | EnumValueOptions | | not supported
63
- | **ServiceDescriptorProto** | Service |
64
- | ServiceOptions | |
65
- | **MethodDescriptorProto** | Method |
66
- | MethodOptions | |
67
- | UninterpretedOption | | not supported
68
- | UninterpretedOptionNamePart | |
69
-
70
- Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names.
71
-
72
- When using TypeScript, the respective interface types can be used to reference specific message instances (i.e. `protobuf.Message<IDescriptorProto>`).
1
+ protobufjs/ext/descriptor
2
+ =========================
3
+
4
+ Experimental extension for interoperability with [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) types.
5
+
6
+ Usage
7
+ -----
8
+
9
+ ```js
10
+ var protobuf = require("protobufjs"), // requires the full library
11
+ descriptor = require("protobufjs/ext/descriptor");
12
+
13
+ var root = ...;
14
+
15
+ // convert any existing root instance to the corresponding descriptor type
16
+ var descriptor = root.toDescriptor("proto2");
17
+ // ^ returns a FileDescriptorSet message, see table below
18
+
19
+ // encode to a descriptor buffer
20
+ var buffer = descriptor.FileDescriptorSet.encode(descriptor).finish();
21
+
22
+ // decode from a descriptor buffer
23
+ var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer);
24
+
25
+ // convert any existing descriptor to a root instance
26
+ root = protobuf.Root.fromDescriptor(decodedDescriptor);
27
+ // ^ expects a FileDescriptorSet message or buffer, see table below
28
+
29
+ // and start all over again
30
+ ```
31
+
32
+ API
33
+ ---
34
+
35
+ The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto:
36
+
37
+ | Descriptor type | protobuf.js type | Remarks
38
+ |-------------------------------|------------------|---------
39
+ | **FileDescriptorSet** | Root |
40
+ | FileDescriptorProto | | dependencies are not supported
41
+ | FileOptions | |
42
+ | FileOptionsOptimizeMode | |
43
+ | SourceCodeInfo | | not supported
44
+ | SourceCodeInfoLocation | |
45
+ | GeneratedCodeInfo | | not supported
46
+ | GeneratedCodeInfoAnnotation | |
47
+ | **DescriptorProto** | Type |
48
+ | MessageOptions | |
49
+ | DescriptorProtoExtensionRange | |
50
+ | DescriptorProtoReservedRange | |
51
+ | **FieldDescriptorProto** | Field |
52
+ | FieldDescriptorProtoLabel | |
53
+ | FieldDescriptorProtoType | |
54
+ | FieldOptions | |
55
+ | FieldOptionsCType | |
56
+ | FieldOptionsJSType | |
57
+ | **OneofDescriptorProto** | OneOf |
58
+ | OneofOptions | |
59
+ | **EnumDescriptorProto** | Enum |
60
+ | EnumOptions | |
61
+ | EnumValueDescriptorProto | |
62
+ | EnumValueOptions | | not supported
63
+ | **ServiceDescriptorProto** | Service |
64
+ | ServiceOptions | |
65
+ | **MethodDescriptorProto** | Method |
66
+ | MethodOptions | |
67
+ | UninterpretedOption | | not supported
68
+ | UninterpretedOptionNamePart | |
69
+
70
+ Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names.
71
+
72
+ When using TypeScript, the respective interface types can be used to reference specific message instances (i.e. `protobuf.Message<IDescriptorProto>`).
@@ -1,5 +1,4 @@
1
1
  import * as $protobuf from "../..";
2
-
3
2
  export const FileDescriptorSet: $protobuf.Type;
4
3
 
5
4
  export const FileDescriptorProto: $protobuf.Type;