protobufjs 7.3.0 → 7.3.2

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 (77) hide show
  1. package/LICENSE +39 -39
  2. package/README.md +727 -740
  3. package/dist/light/protobuf.js +6264 -6264
  4. package/dist/light/protobuf.js.map +1 -1
  5. package/dist/light/protobuf.min.js +2 -2
  6. package/dist/light/protobuf.min.js.map +1 -1
  7. package/dist/minimal/protobuf.js +1928 -1928
  8. package/dist/minimal/protobuf.js.map +1 -1
  9. package/dist/minimal/protobuf.min.js +2 -2
  10. package/dist/minimal/protobuf.min.js.map +1 -1
  11. package/dist/protobuf.js +7978 -7978
  12. package/dist/protobuf.js.map +1 -1
  13. package/dist/protobuf.min.js +2 -2
  14. package/dist/protobuf.min.js.map +1 -1
  15. package/ext/debug/README.md +4 -4
  16. package/ext/debug/index.js +71 -71
  17. package/ext/descriptor/README.md +72 -72
  18. package/ext/descriptor/index.d.ts +191 -191
  19. package/ext/descriptor/index.js +1052 -1052
  20. package/ext/descriptor/test.js +54 -54
  21. package/google/LICENSE +27 -27
  22. package/google/README.md +1 -1
  23. package/google/api/annotations.json +82 -82
  24. package/google/api/annotations.proto +10 -10
  25. package/google/api/http.json +85 -85
  26. package/google/api/http.proto +30 -30
  27. package/google/protobuf/api.json +117 -117
  28. package/google/protobuf/api.proto +33 -33
  29. package/google/protobuf/descriptor.json +738 -738
  30. package/google/protobuf/descriptor.proto +286 -286
  31. package/google/protobuf/source_context.json +19 -19
  32. package/google/protobuf/source_context.proto +7 -7
  33. package/google/protobuf/type.json +201 -201
  34. package/google/protobuf/type.proto +89 -89
  35. package/index.d.ts +2741 -2741
  36. package/index.js +4 -4
  37. package/light.d.ts +2 -2
  38. package/light.js +3 -3
  39. package/minimal.d.ts +2 -2
  40. package/minimal.js +4 -4
  41. package/package.json +111 -111
  42. package/scripts/postinstall.js +32 -32
  43. package/src/common.js +399 -399
  44. package/src/converter.js +301 -301
  45. package/src/decoder.js +129 -129
  46. package/src/encoder.js +100 -100
  47. package/src/enum.js +198 -198
  48. package/src/field.js +377 -377
  49. package/src/index-light.js +104 -104
  50. package/src/index-minimal.js +36 -36
  51. package/src/index.js +12 -12
  52. package/src/mapfield.js +126 -126
  53. package/src/message.js +138 -138
  54. package/src/method.js +160 -160
  55. package/src/namespace.js +433 -433
  56. package/src/object.js +243 -243
  57. package/src/oneof.js +203 -203
  58. package/src/parse.js +889 -889
  59. package/src/reader.js +416 -416
  60. package/src/reader_buffer.js +51 -51
  61. package/src/root.js +368 -368
  62. package/src/roots.js +18 -18
  63. package/src/rpc/service.js +142 -142
  64. package/src/rpc.js +36 -36
  65. package/src/service.js +167 -167
  66. package/src/tokenize.js +416 -416
  67. package/src/type.js +589 -589
  68. package/src/types.js +196 -196
  69. package/src/typescript.jsdoc +15 -15
  70. package/src/util/longbits.js +200 -200
  71. package/src/util/minimal.js +438 -438
  72. package/src/util.js +212 -212
  73. package/src/verifier.js +176 -176
  74. package/src/wrappers.js +102 -102
  75. package/src/writer.js +465 -465
  76. package/src/writer_buffer.js +85 -85
  77. package/tsconfig.json +7 -7
@@ -1,54 +1,54 @@
1
- /*eslint-disable no-console*/
2
- "use strict";
3
- var protobuf = require("../../"),
4
- descriptor = require(".");
5
-
6
- /* var proto = {
7
- nested: {
8
- Message: {
9
- fields: {
10
- foo: {
11
- type: "string",
12
- id: 1
13
- }
14
- },
15
- nested: {
16
- SubMessage: {
17
- fields: {}
18
- }
19
- }
20
- },
21
- Enum: {
22
- values: {
23
- ONE: 1,
24
- TWO: 2
25
- }
26
- }
27
- }
28
- }; */
29
-
30
- // var root = protobuf.Root.fromJSON(proto).resolveAll();
31
- var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll();
32
-
33
- // console.log("Original proto", JSON.stringify(root, null, 2));
34
-
35
- var msg = root.toDescriptor();
36
-
37
- // console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2));
38
-
39
- var buf = descriptor.FileDescriptorSet.encode(msg).finish();
40
- var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll();
41
-
42
- // console.log("\nDecoded proto", JSON.stringify(root2, null, 2));
43
-
44
- var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON());
45
- if (diff) {
46
- diff.forEach(function(diff) {
47
- console.log(diff.kind + " @ " + diff.path.join("."));
48
- console.log("lhs:", typeof diff.lhs, diff.lhs);
49
- console.log("rhs:", typeof diff.rhs, diff.rhs);
50
- console.log();
51
- });
52
- process.exitCode = 1;
53
- } else
54
- console.log("no differences");
1
+ /*eslint-disable no-console*/
2
+ "use strict";
3
+ var protobuf = require("../../"),
4
+ descriptor = require(".");
5
+
6
+ /* var proto = {
7
+ nested: {
8
+ Message: {
9
+ fields: {
10
+ foo: {
11
+ type: "string",
12
+ id: 1
13
+ }
14
+ },
15
+ nested: {
16
+ SubMessage: {
17
+ fields: {}
18
+ }
19
+ }
20
+ },
21
+ Enum: {
22
+ values: {
23
+ ONE: 1,
24
+ TWO: 2
25
+ }
26
+ }
27
+ }
28
+ }; */
29
+
30
+ // var root = protobuf.Root.fromJSON(proto).resolveAll();
31
+ var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll();
32
+
33
+ // console.log("Original proto", JSON.stringify(root, null, 2));
34
+
35
+ var msg = root.toDescriptor();
36
+
37
+ // console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2));
38
+
39
+ var buf = descriptor.FileDescriptorSet.encode(msg).finish();
40
+ var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll();
41
+
42
+ // console.log("\nDecoded proto", JSON.stringify(root2, null, 2));
43
+
44
+ var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON());
45
+ if (diff) {
46
+ diff.forEach(function(diff) {
47
+ console.log(diff.kind + " @ " + diff.path.join("."));
48
+ console.log("lhs:", typeof diff.lhs, diff.lhs);
49
+ console.log("rhs:", typeof diff.rhs, diff.rhs);
50
+ console.log();
51
+ });
52
+ process.exitCode = 1;
53
+ } else
54
+ console.log("no differences");
package/google/LICENSE CHANGED
@@ -1,27 +1,27 @@
1
- Copyright 2014, Google Inc. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above
10
- copyright notice, this list of conditions and the following disclaimer
11
- in the documentation and/or other materials provided with the
12
- distribution.
13
- * Neither the name of Google Inc. nor the names of its
14
- contributors may be used to endorse or promote products derived from
15
- this software without specific prior written permission.
16
-
17
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright 2014, Google Inc. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above
10
+ copyright notice, this list of conditions and the following disclaimer
11
+ in the documentation and/or other materials provided with the
12
+ distribution.
13
+ * Neither the name of Google Inc. nor the names of its
14
+ contributors may be used to endorse or promote products derived from
15
+ this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/google/README.md CHANGED
@@ -1 +1 @@
1
- This folder contains stripped and pre-parsed definitions of common Google types. These files are not used by protobuf.js directly but are here so you can use or include them where required.
1
+ This folder contains stripped and pre-parsed definitions of common Google types. These files are not used by protobuf.js directly but are here so you can use or include them where required.
@@ -1,83 +1,83 @@
1
- {
2
- "nested": {
3
- "google": {
4
- "nested": {
5
- "api": {
6
- "nested": {
7
- "http": {
8
- "type": "HttpRule",
9
- "id": 72295728,
10
- "extend": "google.protobuf.MethodOptions"
11
- },
12
- "HttpRule": {
13
- "oneofs": {
14
- "pattern": {
15
- "oneof": [
16
- "get",
17
- "put",
18
- "post",
19
- "delete",
20
- "patch",
21
- "custom"
22
- ]
23
- }
24
- },
25
- "fields": {
26
- "get": {
27
- "type": "string",
28
- "id": 2
29
- },
30
- "put": {
31
- "type": "string",
32
- "id": 3
33
- },
34
- "post": {
35
- "type": "string",
36
- "id": 4
37
- },
38
- "delete": {
39
- "type": "string",
40
- "id": 5
41
- },
42
- "patch": {
43
- "type": "string",
44
- "id": 6
45
- },
46
- "custom": {
47
- "type": "CustomHttpPattern",
48
- "id": 8
49
- },
50
- "selector": {
51
- "type": "string",
52
- "id": 1
53
- },
54
- "body": {
55
- "type": "string",
56
- "id": 7
57
- },
58
- "additionalBindings": {
59
- "rule": "repeated",
60
- "type": "HttpRule",
61
- "id": 11
62
- }
63
- }
64
- }
65
- }
66
- },
67
- "protobuf": {
68
- "nested": {
69
- "MethodOptions": {
70
- "fields": {},
71
- "extensions": [
72
- [
73
- 1000,
74
- 536870911
75
- ]
76
- ]
77
- }
78
- }
79
- }
80
- }
81
- }
82
- }
1
+ {
2
+ "nested": {
3
+ "google": {
4
+ "nested": {
5
+ "api": {
6
+ "nested": {
7
+ "http": {
8
+ "type": "HttpRule",
9
+ "id": 72295728,
10
+ "extend": "google.protobuf.MethodOptions"
11
+ },
12
+ "HttpRule": {
13
+ "oneofs": {
14
+ "pattern": {
15
+ "oneof": [
16
+ "get",
17
+ "put",
18
+ "post",
19
+ "delete",
20
+ "patch",
21
+ "custom"
22
+ ]
23
+ }
24
+ },
25
+ "fields": {
26
+ "get": {
27
+ "type": "string",
28
+ "id": 2
29
+ },
30
+ "put": {
31
+ "type": "string",
32
+ "id": 3
33
+ },
34
+ "post": {
35
+ "type": "string",
36
+ "id": 4
37
+ },
38
+ "delete": {
39
+ "type": "string",
40
+ "id": 5
41
+ },
42
+ "patch": {
43
+ "type": "string",
44
+ "id": 6
45
+ },
46
+ "custom": {
47
+ "type": "CustomHttpPattern",
48
+ "id": 8
49
+ },
50
+ "selector": {
51
+ "type": "string",
52
+ "id": 1
53
+ },
54
+ "body": {
55
+ "type": "string",
56
+ "id": 7
57
+ },
58
+ "additionalBindings": {
59
+ "rule": "repeated",
60
+ "type": "HttpRule",
61
+ "id": 11
62
+ }
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "protobuf": {
68
+ "nested": {
69
+ "MethodOptions": {
70
+ "fields": {},
71
+ "extensions": [
72
+ [
73
+ 1000,
74
+ 536870911
75
+ ]
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
83
  }
@@ -1,11 +1,11 @@
1
- syntax = "proto3";
2
-
3
- package google.api;
4
-
5
- import "google/api/http.proto";
6
- import "google/protobuf/descriptor.proto";
7
-
8
- extend google.protobuf.MethodOptions {
9
-
10
- HttpRule http = 72295728;
1
+ syntax = "proto3";
2
+
3
+ package google.api;
4
+
5
+ import "google/api/http.proto";
6
+ import "google/protobuf/descriptor.proto";
7
+
8
+ extend google.protobuf.MethodOptions {
9
+
10
+ HttpRule http = 72295728;
11
11
  }
@@ -1,86 +1,86 @@
1
- {
2
- "nested": {
3
- "google": {
4
- "nested": {
5
- "api": {
6
- "nested": {
7
- "Http": {
8
- "fields": {
9
- "rules": {
10
- "rule": "repeated",
11
- "type": "HttpRule",
12
- "id": 1
13
- }
14
- }
15
- },
16
- "HttpRule": {
17
- "oneofs": {
18
- "pattern": {
19
- "oneof": [
20
- "get",
21
- "put",
22
- "post",
23
- "delete",
24
- "patch",
25
- "custom"
26
- ]
27
- }
28
- },
29
- "fields": {
30
- "get": {
31
- "type": "string",
32
- "id": 2
33
- },
34
- "put": {
35
- "type": "string",
36
- "id": 3
37
- },
38
- "post": {
39
- "type": "string",
40
- "id": 4
41
- },
42
- "delete": {
43
- "type": "string",
44
- "id": 5
45
- },
46
- "patch": {
47
- "type": "string",
48
- "id": 6
49
- },
50
- "custom": {
51
- "type": "CustomHttpPattern",
52
- "id": 8
53
- },
54
- "selector": {
55
- "type": "string",
56
- "id": 1
57
- },
58
- "body": {
59
- "type": "string",
60
- "id": 7
61
- },
62
- "additionalBindings": {
63
- "rule": "repeated",
64
- "type": "HttpRule",
65
- "id": 11
66
- }
67
- }
68
- },
69
- "CustomHttpPattern": {
70
- "fields": {
71
- "kind": {
72
- "type": "string",
73
- "id": 1
74
- },
75
- "path": {
76
- "type": "string",
77
- "id": 2
78
- }
79
- }
80
- }
81
- }
82
- }
83
- }
84
- }
85
- }
1
+ {
2
+ "nested": {
3
+ "google": {
4
+ "nested": {
5
+ "api": {
6
+ "nested": {
7
+ "Http": {
8
+ "fields": {
9
+ "rules": {
10
+ "rule": "repeated",
11
+ "type": "HttpRule",
12
+ "id": 1
13
+ }
14
+ }
15
+ },
16
+ "HttpRule": {
17
+ "oneofs": {
18
+ "pattern": {
19
+ "oneof": [
20
+ "get",
21
+ "put",
22
+ "post",
23
+ "delete",
24
+ "patch",
25
+ "custom"
26
+ ]
27
+ }
28
+ },
29
+ "fields": {
30
+ "get": {
31
+ "type": "string",
32
+ "id": 2
33
+ },
34
+ "put": {
35
+ "type": "string",
36
+ "id": 3
37
+ },
38
+ "post": {
39
+ "type": "string",
40
+ "id": 4
41
+ },
42
+ "delete": {
43
+ "type": "string",
44
+ "id": 5
45
+ },
46
+ "patch": {
47
+ "type": "string",
48
+ "id": 6
49
+ },
50
+ "custom": {
51
+ "type": "CustomHttpPattern",
52
+ "id": 8
53
+ },
54
+ "selector": {
55
+ "type": "string",
56
+ "id": 1
57
+ },
58
+ "body": {
59
+ "type": "string",
60
+ "id": 7
61
+ },
62
+ "additionalBindings": {
63
+ "rule": "repeated",
64
+ "type": "HttpRule",
65
+ "id": 11
66
+ }
67
+ }
68
+ },
69
+ "CustomHttpPattern": {
70
+ "fields": {
71
+ "kind": {
72
+ "type": "string",
73
+ "id": 1
74
+ },
75
+ "path": {
76
+ "type": "string",
77
+ "id": 2
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
86
  }
@@ -1,31 +1,31 @@
1
- syntax = "proto3";
2
-
3
- package google.api;
4
-
5
- message Http {
6
-
7
- repeated HttpRule rules = 1;
8
- }
9
-
10
- message HttpRule {
11
-
12
- oneof pattern {
13
-
14
- string get = 2;
15
- string put = 3;
16
- string post = 4;
17
- string delete = 5;
18
- string patch = 6;
19
- CustomHttpPattern custom = 8;
20
- }
21
-
22
- string selector = 1;
23
- string body = 7;
24
- repeated HttpRule additional_bindings = 11;
25
- }
26
-
27
- message CustomHttpPattern {
28
-
29
- string kind = 1;
30
- string path = 2;
1
+ syntax = "proto3";
2
+
3
+ package google.api;
4
+
5
+ message Http {
6
+
7
+ repeated HttpRule rules = 1;
8
+ }
9
+
10
+ message HttpRule {
11
+
12
+ oneof pattern {
13
+
14
+ string get = 2;
15
+ string put = 3;
16
+ string post = 4;
17
+ string delete = 5;
18
+ string patch = 6;
19
+ CustomHttpPattern custom = 8;
20
+ }
21
+
22
+ string selector = 1;
23
+ string body = 7;
24
+ repeated HttpRule additional_bindings = 11;
25
+ }
26
+
27
+ message CustomHttpPattern {
28
+
29
+ string kind = 1;
30
+ string path = 2;
31
31
  }