protobufjs 8.6.2 → 8.6.4

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 (105) hide show
  1. package/LICENSE +39 -39
  2. package/README.md +441 -441
  3. package/dist/light/protobuf.js +8582 -8454
  4. package/dist/light/protobuf.js.map +1 -1
  5. package/dist/light/protobuf.min.js +3 -3
  6. package/dist/light/protobuf.min.js.map +1 -1
  7. package/dist/minimal/protobuf.js +3071 -2999
  8. package/dist/minimal/protobuf.js.map +1 -1
  9. package/dist/minimal/protobuf.min.js +3 -3
  10. package/dist/minimal/protobuf.min.js.map +1 -1
  11. package/dist/protobuf.js +10486 -10358
  12. package/dist/protobuf.js.map +1 -1
  13. package/dist/protobuf.min.js +3 -3
  14. package/dist/protobuf.min.js.map +1 -1
  15. package/ext/README.md +70 -70
  16. package/ext/debug/README.md +4 -4
  17. package/ext/debug/index.js +71 -71
  18. package/ext/descriptor/README.md +5 -5
  19. package/ext/descriptor/index.d.ts +2 -2
  20. package/ext/descriptor/index.js +2 -2
  21. package/ext/descriptor.d.ts +87 -87
  22. package/ext/descriptor.js +1354 -1354
  23. package/ext/protojson.LICENSE +201 -201
  24. package/ext/protojson.d.ts +20 -20
  25. package/ext/protojson.js +945 -925
  26. package/ext/textformat.d.ts +19 -19
  27. package/ext/textformat.js +1256 -1256
  28. package/google/LICENSE +27 -27
  29. package/google/README.md +1 -1
  30. package/google/api/annotations.json +82 -82
  31. package/google/api/annotations.proto +10 -10
  32. package/google/api/http.json +85 -85
  33. package/google/api/http.proto +30 -30
  34. package/google/protobuf/api.json +117 -117
  35. package/google/protobuf/api.proto +33 -33
  36. package/google/protobuf/compiler/plugin.json +126 -126
  37. package/google/protobuf/compiler/plugin.proto +47 -47
  38. package/google/protobuf/descriptor.json +1381 -1381
  39. package/google/protobuf/descriptor.proto +534 -534
  40. package/google/protobuf/source_context.json +19 -19
  41. package/google/protobuf/source_context.proto +7 -7
  42. package/google/protobuf/type.json +201 -201
  43. package/google/protobuf/type.proto +89 -89
  44. package/index.d.ts +30 -0
  45. package/index.js +4 -4
  46. package/light.d.ts +2 -2
  47. package/light.js +3 -3
  48. package/minimal.d.ts +2 -2
  49. package/minimal.js +4 -4
  50. package/package.json +93 -93
  51. package/src/common.js +399 -399
  52. package/src/converter.js +344 -344
  53. package/src/decoder.js +214 -208
  54. package/src/encoder.js +111 -111
  55. package/src/enum.js +231 -231
  56. package/src/field.js +497 -497
  57. package/src/index-light.js +104 -104
  58. package/src/index-minimal.js +35 -36
  59. package/src/index.js +12 -12
  60. package/src/mapfield.js +136 -136
  61. package/src/message.js +137 -137
  62. package/src/method.js +175 -175
  63. package/src/namespace.js +566 -565
  64. package/src/object.js +382 -382
  65. package/src/oneof.js +225 -225
  66. package/src/parse.js +1068 -1068
  67. package/src/reader.js +558 -543
  68. package/src/reader_buffer.js +72 -72
  69. package/src/root.js +416 -416
  70. package/src/roots.js +18 -18
  71. package/src/rpc/service.js +148 -148
  72. package/src/rpc.js +36 -36
  73. package/src/service.js +198 -198
  74. package/src/tokenize.js +421 -421
  75. package/src/type.js +654 -655
  76. package/src/types.js +196 -196
  77. package/src/typescript.js +25 -25
  78. package/src/util/aspromise.d.ts +13 -13
  79. package/src/util/aspromise.js +52 -52
  80. package/src/util/base64.d.ts +32 -32
  81. package/src/util/base64.js +146 -146
  82. package/src/util/codegen.d.ts +31 -31
  83. package/src/util/codegen.js +113 -113
  84. package/src/util/eventemitter.d.ts +45 -45
  85. package/src/util/eventemitter.js +86 -86
  86. package/src/util/fetch.d.ts +56 -56
  87. package/src/util/fetch.js +112 -112
  88. package/src/util/float.d.ts +83 -83
  89. package/src/util/float.js +335 -335
  90. package/src/util/fs.js +11 -11
  91. package/src/util/longbits.js +200 -200
  92. package/src/util/minimal.js +515 -515
  93. package/src/util/path.d.ts +22 -22
  94. package/src/util/path.js +100 -72
  95. package/src/util/patterns.js +7 -7
  96. package/src/util/pool.d.ts +32 -32
  97. package/src/util/pool.js +48 -48
  98. package/src/util/utf8.d.ts +24 -24
  99. package/src/util/utf8.js +188 -130
  100. package/src/util.js +264 -242
  101. package/src/verifier.js +180 -180
  102. package/src/wrappers.js +106 -106
  103. package/src/writer.js +495 -495
  104. package/src/writer_buffer.js +102 -102
  105. package/tsconfig.json +6 -6
package/index.d.ts CHANGED
@@ -100,6 +100,11 @@ export namespace common {
100
100
  value?: Uint8Array;
101
101
  }
102
102
 
103
+ /** Properties of a google.protobuf.FieldMask message. */
104
+ interface IFieldMask {
105
+ paths?: string[];
106
+ }
107
+
103
108
  /**
104
109
  * Gets the root definition of the specified common proto file.
105
110
  *
@@ -1340,6 +1345,12 @@ export class Reader {
1340
1345
  */
1341
1346
  string(): string;
1342
1347
 
1348
+ /**
1349
+ * Reads a string preceeded by its byte length as a varint, rejecting invalid UTF8.
1350
+ * @returns Value read
1351
+ */
1352
+ stringVerify(): string;
1353
+
1343
1354
  /**
1344
1355
  * Skips the specified number of bytes if specified, otherwise skips a varint.
1345
1356
  * @param [length] Length if known, otherwise a varint is assumed
@@ -1711,6 +1722,7 @@ export class Type extends NamespaceBase {
1711
1722
  /**
1712
1723
  * The registered constructor, if any registered, otherwise a generic constructor.
1713
1724
  * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.
1725
+ * When assigning manually, add the type to its parent namespace/root first if fields reference other reflected types, because constructor setup resolves field defaults.
1714
1726
  */
1715
1727
  ctor: Constructor<{}>;
1716
1728
 
@@ -2633,6 +2645,15 @@ export namespace util {
2633
2645
  */
2634
2646
  function read(buffer: Uint8Array, start: number, end: number): string;
2635
2647
 
2648
+ /**
2649
+ * Reads UTF8 bytes as a string, rejecting invalid UTF8.
2650
+ * @param buffer Source buffer
2651
+ * @param start Source start
2652
+ * @param end Source end
2653
+ * @returns String read
2654
+ */
2655
+ function readStrict(buffer: Uint8Array, start: number, end: number): string;
2656
+
2636
2657
  /**
2637
2658
  * Writes a string as UTF8 bytes.
2638
2659
  * @param string Source string
@@ -2660,6 +2681,15 @@ export namespace util {
2660
2681
  */
2661
2682
  function toObject(array: any[]): { [k: string]: any };
2662
2683
 
2684
+ /**
2685
+ * Removes the first matching value from an object.
2686
+ * @param object Object to remove from
2687
+ * @param value Value to remove
2688
+ * @param [key] Optional key for fast path removal
2689
+ * @returns `true` if removed, otherwise `false`
2690
+ */
2691
+ function remove(object: ({ [k: string]: any }|undefined), value: any, key?: string): boolean;
2692
+
2663
2693
  /**
2664
2694
  * Tests whether the specified name is a reserved word in JS.
2665
2695
  * @param name Name to test
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // full library entry point.
2
-
3
- "use strict";
4
- module.exports = require("./src/index");
1
+ // full library entry point.
2
+
3
+ "use strict";
4
+ module.exports = require("./src/index");
package/light.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export as namespace protobuf;
2
- export * from "./index";
1
+ export as namespace protobuf;
2
+ export * from "./index";
package/light.js CHANGED
@@ -1,4 +1,4 @@
1
- // light library entry point.
2
-
3
- "use strict";
1
+ // light library entry point.
2
+
3
+ "use strict";
4
4
  module.exports = require("./src/index-light");
package/minimal.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export as namespace protobuf;
2
- export * from "./index";
1
+ export as namespace protobuf;
2
+ export * from "./index";
package/minimal.js CHANGED
@@ -1,4 +1,4 @@
1
- // minimal library entry point.
2
-
3
- "use strict";
4
- module.exports = require("./src/index-minimal");
1
+ // minimal library entry point.
2
+
3
+ "use strict";
4
+ module.exports = require("./src/index-minimal");
package/package.json CHANGED
@@ -1,93 +1,93 @@
1
- {
2
- "name": "protobufjs",
3
- "version": "8.6.2",
4
- "description": "Protocol Buffers for JavaScript & TypeScript.",
5
- "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
6
- "license": "BSD-3-Clause",
7
- "repository": "protobufjs/protobuf.js",
8
- "bugs": "https://github.com/protobufjs/protobuf.js/issues",
9
- "engines": {
10
- "node": ">=12.0.0"
11
- },
12
- "keywords": [
13
- "protobuf",
14
- "protocol-buffers",
15
- "serialization",
16
- "typescript"
17
- ],
18
- "main": "index.js",
19
- "type": "commonjs",
20
- "types": "index.d.ts",
21
- "browser": {
22
- "fs": false
23
- },
24
- "scripts": {
25
- "bench": "node bench",
26
- "build": "npm run build:bundle && npm run build:types",
27
- "build:bundle": "gulp --gulpfile scripts/gulpfile.js",
28
- "build:tests": "node ./scripts/gentests.js",
29
- "build:types": "node cli/bin/pbts --main --global protobuf --out index.d.ts src/ && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/descriptor.generated.d.ts ext/descriptor.js && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/textformat.generated.d.ts ext/textformat.js && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/protojson.generated.d.ts ext/protojson.js",
30
- "coverage": "npm run coverage:test && npm run coverage:report",
31
- "coverage:test": "nyc --silent tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
32
- "coverage:report": "nyc report --reporter=lcov --reporter=text",
33
- "docs": "npm run docs:build",
34
- "docs:build": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
35
- "docs:publish": "npm run docs:build && node scripts/pages",
36
- "lint": "npm run lint:sources && npm run lint:types",
37
- "lint:sources": "eslint \"**/*.js\"",
38
- "lint:types": "tslint \"**/*.d.ts\" -e \"**/node_modules/**\" -t stylish -c config/tslint.json",
39
- "prepublish": "cd cli && npm install && cd .. && npm run build",
40
- "prepublishOnly": "cd cli && npm install && cd .. && npm run build",
41
- "prof": "node bench/prof",
42
- "test": "npm run test:sources && npm run test:types",
43
- "test:sources": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
44
- "test:types": "tsc tests/comp_typescript.ts --target es2019 --module commonjs --types node --lib es2019 --esModuleInterop --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc -p tsconfig.test-types.json",
45
- "make": "npm run lint:sources && npm run build && npm run lint:types && npm run build:tests && npm test"
46
- },
47
- "dependencies": {
48
- "long": "^5.3.2"
49
- },
50
- "devDependencies": {
51
- "@eslint/js": "^10.0.0",
52
- "@types/node": ">=13.7.0",
53
- "browserify": "^17.0.0",
54
- "browserify-wrap": "^1.0.2",
55
- "bundle-collapser": "^1.3.0",
56
- "escodegen": "^1.13.0",
57
- "eslint": "^10.0.0",
58
- "eslint-plugin-jsdoc": "^62.9.0",
59
- "espree": "^9.0.0",
60
- "estraverse": "^5.1.0",
61
- "gh-pages": "^6.0.0",
62
- "globals": "^17.0.0",
63
- "gulp": "^5.0.0",
64
- "gulp-header": "^2.0.9",
65
- "gulp-if": "^3.0.0",
66
- "gulp-sourcemaps": "^3.0.0",
67
- "gulp-uglify": "^3.0.2",
68
- "jsdoc": "^4.0.0",
69
- "minimist": "^1.2.8",
70
- "nyc": "^18.0.0",
71
- "reflect-metadata": "^0.2.0",
72
- "tape": "^5.0.0",
73
- "tslint": "^6.0.0",
74
- "typescript": "^3.7.5",
75
- "vinyl-buffer": "^1.0.1",
76
- "vinyl-fs": "^4.0.0",
77
- "vinyl-source-stream": "^2.0.0"
78
- },
79
- "files": [
80
- "index.js",
81
- "index.d.ts",
82
- "light.d.ts",
83
- "light.js",
84
- "minimal.d.ts",
85
- "minimal.js",
86
- "package-lock.json",
87
- "tsconfig.json",
88
- "dist/**",
89
- "ext/**",
90
- "google/**",
91
- "src/**"
92
- ]
93
- }
1
+ {
2
+ "name": "protobufjs",
3
+ "version": "8.6.4",
4
+ "description": "Protocol Buffers for JavaScript & TypeScript.",
5
+ "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
6
+ "license": "BSD-3-Clause",
7
+ "repository": "protobufjs/protobuf.js",
8
+ "bugs": "https://github.com/protobufjs/protobuf.js/issues",
9
+ "engines": {
10
+ "node": ">=12.0.0"
11
+ },
12
+ "keywords": [
13
+ "protobuf",
14
+ "protocol-buffers",
15
+ "serialization",
16
+ "typescript"
17
+ ],
18
+ "main": "index.js",
19
+ "type": "commonjs",
20
+ "types": "index.d.ts",
21
+ "browser": {
22
+ "fs": false
23
+ },
24
+ "scripts": {
25
+ "bench": "node bench",
26
+ "build": "npm run build:bundle && npm run build:types",
27
+ "build:bundle": "gulp --gulpfile scripts/gulpfile.js",
28
+ "build:tests": "node ./scripts/gentests.js",
29
+ "build:types": "node cli/bin/pbts --main --global protobuf --out index.d.ts src/ && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/descriptor.generated.d.ts ext/descriptor.js && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/textformat.generated.d.ts ext/textformat.js && node cli/bin/pbts --main --import \"\\$protobuf=..\" --out ext/protojson.generated.d.ts ext/protojson.js",
30
+ "coverage": "npm run coverage:test && npm run coverage:report",
31
+ "coverage:test": "nyc --silent tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
32
+ "coverage:report": "nyc report --reporter=lcov --reporter=text",
33
+ "docs": "npm run docs:build",
34
+ "docs:build": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
35
+ "docs:publish": "npm run docs:build && node scripts/pages",
36
+ "lint": "npm run lint:sources && npm run lint:types",
37
+ "lint:sources": "eslint \"**/*.js\"",
38
+ "lint:types": "tslint \"**/*.d.ts\" -e \"**/node_modules/**\" -t stylish -c config/tslint.json",
39
+ "prepublish": "cd cli && npm install && cd .. && npm run build",
40
+ "prepublishOnly": "cd cli && npm install && cd .. && npm run build",
41
+ "prof": "node bench/prof",
42
+ "test": "npm run test:sources && npm run test:types",
43
+ "test:sources": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
44
+ "test:types": "tsc tests/comp_typescript.ts --target es2019 --module commonjs --types node --lib es2019 --esModuleInterop --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc -p tsconfig.test-types.json",
45
+ "make": "npm run lint:sources && npm run build && npm run lint:types && npm run build:tests && npm test"
46
+ },
47
+ "dependencies": {
48
+ "long": "^5.3.2"
49
+ },
50
+ "devDependencies": {
51
+ "@eslint/js": "^10.0.0",
52
+ "@types/node": ">=13.7.0",
53
+ "browserify": "^17.0.0",
54
+ "browserify-wrap": "^1.0.2",
55
+ "bundle-collapser": "^1.3.0",
56
+ "escodegen": "^1.13.0",
57
+ "eslint": "^10.0.0",
58
+ "eslint-plugin-jsdoc": "^62.9.0",
59
+ "espree": "^9.0.0",
60
+ "estraverse": "^5.1.0",
61
+ "gh-pages": "^6.0.0",
62
+ "globals": "^17.0.0",
63
+ "gulp": "^5.0.0",
64
+ "gulp-header": "^2.0.9",
65
+ "gulp-if": "^3.0.0",
66
+ "gulp-sourcemaps": "^3.0.0",
67
+ "gulp-uglify": "^3.0.2",
68
+ "jsdoc": "^4.0.0",
69
+ "minimist": "^1.2.8",
70
+ "nyc": "^18.0.0",
71
+ "reflect-metadata": "^0.2.0",
72
+ "tape": "^5.0.0",
73
+ "tslint": "^6.0.0",
74
+ "typescript": "^3.7.5",
75
+ "vinyl-buffer": "^1.0.1",
76
+ "vinyl-fs": "^4.0.0",
77
+ "vinyl-source-stream": "^2.0.0"
78
+ },
79
+ "files": [
80
+ "index.js",
81
+ "index.d.ts",
82
+ "light.d.ts",
83
+ "light.js",
84
+ "minimal.d.ts",
85
+ "minimal.js",
86
+ "package-lock.json",
87
+ "tsconfig.json",
88
+ "dist/**",
89
+ "ext/**",
90
+ "google/**",
91
+ "src/**"
92
+ ]
93
+ }