@openclaw/feishu 2026.6.8 → 2026.6.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.
- package/dist/api.js +79 -24
- package/dist/{channel-DwygSth-.js → channel-DF8jqwhL.js} +4 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CrqKcXaU.js → channel.runtime-C4eAoxAR.js} +5 -5
- package/dist/{client-BhMNZBJD.js → client-BwgAJuvo.js} +14 -9
- package/dist/{drive-8o3Omlnd.js → drive-djUl8IRC.js} +16 -3
- package/dist/{monitor-_1eNsUVp.js → monitor-UZJ1bdoG.js} +2 -2
- package/dist/{monitor.account-BhoLA1Y0.js → monitor.account-Bc_8o_b6.js} +95 -51
- package/dist/{monitor.state-QV66eUNA.js → monitor.state-CGL1occz.js} +1 -1
- package/dist/{probe-BjKRV7em.js → probe-EyeJQb3C.js} +1 -1
- package/dist/{send-B3kteMF8.js → send-CMyK8JGr.js} +33 -25
- package/dist/setup-api.js +1 -1
- package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
- package/node_modules/@protobufjs/aspromise/README.md +13 -0
- package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
- package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
- package/node_modules/@protobufjs/aspromise/package.json +21 -0
- package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
- package/node_modules/@protobufjs/base64/LICENSE +26 -0
- package/node_modules/@protobufjs/base64/README.md +19 -0
- package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
- package/node_modules/@protobufjs/base64/package.json +21 -0
- package/node_modules/@protobufjs/base64/tests/index.js +46 -0
- package/node_modules/@protobufjs/codegen/LICENSE +26 -0
- package/node_modules/@protobufjs/codegen/README.md +49 -0
- package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
- package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
- package/node_modules/@protobufjs/codegen/package.json +13 -0
- package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
- package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
- package/node_modules/@protobufjs/eventemitter/README.md +22 -0
- package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
- package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
- package/node_modules/@protobufjs/eventemitter/package.json +21 -0
- package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/fetch/LICENSE +26 -0
- package/node_modules/@protobufjs/fetch/README.md +13 -0
- package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
- package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
- package/node_modules/@protobufjs/fetch/package.json +27 -0
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
- package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/@protobufjs/float/LICENSE +26 -0
- package/node_modules/@protobufjs/float/README.md +102 -0
- package/node_modules/@protobufjs/float/bench/index.js +87 -0
- package/node_modules/@protobufjs/float/bench/suite.js +46 -0
- package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
- package/node_modules/@protobufjs/float/package.json +26 -0
- package/node_modules/@protobufjs/float/tests/index.js +100 -0
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/inquire/LICENSE +26 -0
- package/node_modules/@protobufjs/inquire/README.md +13 -0
- package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
- package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
- package/node_modules/@protobufjs/inquire/package.json +21 -0
- package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
- package/node_modules/@protobufjs/path/LICENSE +26 -0
- package/node_modules/@protobufjs/path/README.md +19 -0
- package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
- package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
- package/node_modules/@protobufjs/path/package.json +21 -0
- package/node_modules/@protobufjs/path/tests/index.js +60 -0
- package/node_modules/@protobufjs/pool/.npmignore +3 -0
- package/node_modules/@protobufjs/pool/LICENSE +26 -0
- package/node_modules/@protobufjs/pool/README.md +13 -0
- package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
- package/node_modules/@protobufjs/pool/package.json +21 -0
- package/node_modules/@protobufjs/pool/tests/index.js +33 -0
- package/node_modules/@protobufjs/utf8/LICENSE +26 -0
- package/node_modules/@protobufjs/utf8/README.md +20 -0
- package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
- package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
- package/node_modules/@protobufjs/utf8/package.json +21 -0
- package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
- package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
- package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +59 -0
- package/node_modules/@types/node/assert.d.ts +950 -0
- package/node_modules/@types/node/async_hooks.d.ts +711 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/node_modules/@types/node/buffer.d.ts +1765 -0
- package/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +93 -0
- package/node_modules/@types/node/constants.d.ts +14 -0
- package/node_modules/@types/node/crypto.d.ts +4058 -0
- package/node_modules/@types/node/dgram.d.ts +537 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
- package/node_modules/@types/node/dns/promises.d.ts +497 -0
- package/node_modules/@types/node/dns.d.ts +876 -0
- package/node_modules/@types/node/domain.d.ts +150 -0
- package/node_modules/@types/node/events.d.ts +1008 -0
- package/node_modules/@types/node/fs/promises.d.ts +1468 -0
- package/node_modules/@types/node/fs.d.ts +4780 -0
- package/node_modules/@types/node/globals.d.ts +150 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/node_modules/@types/node/http.d.ts +2147 -0
- package/node_modules/@types/node/http2.d.ts +2485 -0
- package/node_modules/@types/node/https.d.ts +400 -0
- package/node_modules/@types/node/index.d.ts +117 -0
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +264 -0
- package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
- package/node_modules/@types/node/module.d.ts +755 -0
- package/node_modules/@types/node/net.d.ts +970 -0
- package/node_modules/@types/node/os.d.ts +498 -0
- package/node_modules/@types/node/package.json +155 -0
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +178 -0
- package/node_modules/@types/node/perf_hooks.d.ts +612 -0
- package/node_modules/@types/node/process.d.ts +2204 -0
- package/node_modules/@types/node/punycode.d.ts +89 -0
- package/node_modules/@types/node/querystring.d.ts +139 -0
- package/node_modules/@types/node/quic.d.ts +897 -0
- package/node_modules/@types/node/readline/promises.d.ts +158 -0
- package/node_modules/@types/node/readline.d.ts +507 -0
- package/node_modules/@types/node/repl.d.ts +420 -0
- package/node_modules/@types/node/sea.d.ts +47 -0
- package/node_modules/@types/node/sqlite.d.ts +1068 -0
- package/node_modules/@types/node/stream/consumers.d.ts +114 -0
- package/node_modules/@types/node/stream/iter.d.ts +301 -0
- package/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/node_modules/@types/node/stream/web.d.ts +300 -0
- package/node_modules/@types/node/stream.d.ts +1774 -0
- package/node_modules/@types/node/string_decoder.d.ts +27 -0
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +2279 -0
- package/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/timers.d.ts +149 -0
- package/node_modules/@types/node/tls.d.ts +1193 -0
- package/node_modules/@types/node/trace_events.d.ts +103 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
- package/node_modules/@types/node/tty.d.ts +225 -0
- package/node_modules/@types/node/url.d.ts +556 -0
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +1677 -0
- package/node_modules/@types/node/v8.d.ts +980 -0
- package/node_modules/@types/node/vm.d.ts +1136 -0
- package/node_modules/@types/node/wasi.d.ts +131 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +671 -0
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +589 -0
- package/node_modules/protobufjs/README.md +556 -263
- package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
- package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
- package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
- package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
- package/node_modules/protobufjs/index.d.ts +720 -834
- package/node_modules/protobufjs/package.json +44 -20
- package/node_modules/protobufjs/src/converter.js +36 -60
- package/node_modules/protobufjs/src/decoder.js +53 -124
- package/node_modules/protobufjs/src/encoder.js +2 -10
- package/node_modules/protobufjs/src/enum.js +3 -8
- package/node_modules/protobufjs/src/field.js +11 -13
- package/node_modules/protobufjs/src/index-light.js +1 -1
- package/node_modules/protobufjs/src/mapfield.js +0 -1
- package/node_modules/protobufjs/src/message.js +11 -5
- package/node_modules/protobufjs/src/method.js +4 -5
- package/node_modules/protobufjs/src/namespace.js +3 -10
- package/node_modules/protobufjs/src/object.js +20 -20
- package/node_modules/protobufjs/src/oneof.js +0 -3
- package/node_modules/protobufjs/src/parse.js +16 -78
- package/node_modules/protobufjs/src/reader.js +31 -136
- package/node_modules/protobufjs/src/reader_buffer.js +3 -24
- package/node_modules/protobufjs/src/root.js +3 -7
- package/node_modules/protobufjs/src/roots.js +1 -1
- package/node_modules/protobufjs/src/service.js +6 -13
- package/node_modules/protobufjs/src/tokenize.js +1 -6
- package/node_modules/protobufjs/src/type.js +30 -44
- package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
- package/node_modules/protobufjs/src/util/minimal.js +12 -36
- package/node_modules/protobufjs/src/util.js +17 -6
- package/node_modules/protobufjs/src/verifier.js +6 -6
- package/node_modules/protobufjs/src/wrappers.js +1 -0
- package/node_modules/protobufjs/src/writer.js +16 -42
- package/node_modules/protobufjs/src/writer_buffer.js +1 -18
- package/node_modules/protobufjs/tsconfig.json +5 -3
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +32 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +123 -0
- package/node_modules/undici-types/connector.d.ts +36 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +30 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici-types/dispatcher.d.ts +279 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +177 -0
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +211 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +160 -0
- package/node_modules/undici-types/index.d.ts +91 -0
- package/node_modules/undici-types/interceptors.d.ts +80 -0
- package/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +27 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +29 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +41 -0
- package/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/node_modules/undici-types/readable.d.ts +68 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +347 -0
- package/node_modules/undici-types/websocket.d.ts +188 -0
- package/npm-shrinkwrap.json +95 -6
- package/package.json +4 -4
- package/skills/feishu-wiki/SKILL.md +10 -1
- package/node_modules/protobufjs/ext/README.md +0 -81
- package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
- package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
- package/node_modules/protobufjs/ext/descriptor.js +0 -1266
- package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
- package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
- package/node_modules/protobufjs/ext/textformat.js +0 -1235
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
- package/node_modules/protobufjs/src/typescript.js +0 -25
- /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "protobufjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.6.3",
|
|
4
4
|
"versionScheme": "~",
|
|
5
|
-
"description": "Protocol Buffers for JavaScript & TypeScript.",
|
|
5
|
+
"description": "Protocol Buffers for JavaScript (& TypeScript).",
|
|
6
6
|
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
8
8
|
"repository": "protobufjs/protobuf.js",
|
|
9
9
|
"bugs": "https://github.com/protobufjs/protobuf.js/issues",
|
|
10
|
+
"homepage": "https://protobufjs.github.io/protobuf.js/",
|
|
10
11
|
"engines": {
|
|
11
12
|
"node": ">=12.0.0"
|
|
12
13
|
},
|
|
14
|
+
"eslintConfig": {
|
|
15
|
+
"env": {
|
|
16
|
+
"es6": true
|
|
17
|
+
},
|
|
18
|
+
"parserOptions": {
|
|
19
|
+
"ecmaVersion": 6
|
|
20
|
+
}
|
|
21
|
+
},
|
|
13
22
|
"keywords": [
|
|
14
23
|
"protobuf",
|
|
15
24
|
"protocol-buffers",
|
|
@@ -17,65 +26,80 @@
|
|
|
17
26
|
"typescript"
|
|
18
27
|
],
|
|
19
28
|
"main": "index.js",
|
|
20
|
-
"type": "commonjs",
|
|
21
29
|
"types": "index.d.ts",
|
|
22
30
|
"browser": {
|
|
23
31
|
"fs": false
|
|
24
32
|
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"tag": "latest-7"
|
|
35
|
+
},
|
|
25
36
|
"scripts": {
|
|
26
37
|
"bench": "node bench",
|
|
27
38
|
"build": "npm run build:bundle && npm run build:types",
|
|
28
39
|
"build:bundle": "gulp --gulpfile scripts/gulpfile.js",
|
|
29
|
-
"build:types": "node cli/bin/pbts --main --global protobuf --out index.d.ts src/
|
|
40
|
+
"build:types": "node cli/bin/pbts --main --global protobuf --out index.d.ts src/ lib/aspromise/index.js lib/base64/index.js lib/codegen/index.js lib/eventemitter/index.js lib/float/index.js lib/fetch/index.js lib/inquire/index.js lib/path/index.js lib/pool/index.js lib/utf8/index.js",
|
|
41
|
+
"changelog": "node scripts/changelog -w",
|
|
30
42
|
"coverage": "npm run coverage:test && npm run coverage:report",
|
|
31
43
|
"coverage:test": "nyc --silent tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
|
|
32
44
|
"coverage:report": "nyc report --reporter=lcov --reporter=text",
|
|
33
|
-
"docs": "
|
|
34
|
-
"docs:build": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
|
|
35
|
-
"docs:publish": "npm run docs:build && node scripts/pages",
|
|
45
|
+
"docs": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
|
|
36
46
|
"lint": "npm run lint:sources && npm run lint:types",
|
|
37
|
-
"lint:sources": "eslint \"**/*.js\"",
|
|
47
|
+
"lint:sources": "eslint \"**/*.js\" -c config/eslint.json",
|
|
38
48
|
"lint:types": "tslint \"**/*.d.ts\" -e \"**/node_modules/**\" -t stylish -c config/tslint.json",
|
|
49
|
+
"pages": "node scripts/pages",
|
|
39
50
|
"prepublish": "cd cli && npm install && cd .. && npm run build",
|
|
40
51
|
"prepublishOnly": "cd cli && npm install && cd .. && npm run build",
|
|
41
52
|
"postinstall": "node scripts/postinstall",
|
|
42
53
|
"prof": "node bench/prof",
|
|
43
54
|
"test": "npm run test:sources && npm run test:types",
|
|
44
55
|
"test:sources": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
|
|
45
|
-
"test:types": "tsc tests/comp_typescript.ts --
|
|
56
|
+
"test:types": "tsc tests/comp_typescript.ts --lib es2015 --esModuleInterop --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc tests/data/test.js.ts --lib es2015 --esModuleInterop --noEmit --strictNullChecks && tsc tests/data/*.ts --lib es2015 --esModuleInterop --noEmit --strictNullChecks",
|
|
46
57
|
"make": "npm run lint:sources && npm run build && npm run lint:types && node ./scripts/gentests.js && npm test"
|
|
47
58
|
},
|
|
48
59
|
"dependencies": {
|
|
60
|
+
"@protobufjs/aspromise": "^1.1.2",
|
|
61
|
+
"@protobufjs/base64": "^1.1.2",
|
|
62
|
+
"@protobufjs/codegen": "^2.0.5",
|
|
63
|
+
"@protobufjs/eventemitter": "^1.1.1",
|
|
64
|
+
"@protobufjs/fetch": "^1.1.1",
|
|
65
|
+
"@protobufjs/float": "^1.0.2",
|
|
66
|
+
"@protobufjs/inquire": "^1.1.2",
|
|
67
|
+
"@protobufjs/path": "^1.1.2",
|
|
68
|
+
"@protobufjs/pool": "^1.1.0",
|
|
69
|
+
"@protobufjs/utf8": "^1.1.1",
|
|
70
|
+
"@types/node": ">=13.7.0",
|
|
49
71
|
"long": "^5.3.2"
|
|
50
72
|
},
|
|
51
73
|
"devDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"@types/node": ">=13.7.0",
|
|
74
|
+
"benchmark": "^2.1.4",
|
|
54
75
|
"browserify": "^17.0.0",
|
|
55
76
|
"browserify-wrap": "^1.0.2",
|
|
56
77
|
"bundle-collapser": "^1.3.0",
|
|
78
|
+
"chalk": "^4.0.0",
|
|
57
79
|
"escodegen": "^1.13.0",
|
|
58
|
-
"eslint": "^
|
|
59
|
-
"eslint-plugin-jsdoc": "^62.9.0",
|
|
80
|
+
"eslint": "^8.15.0",
|
|
60
81
|
"espree": "^9.0.0",
|
|
61
82
|
"estraverse": "^5.1.0",
|
|
62
|
-
"gh-pages": "^
|
|
63
|
-
"
|
|
64
|
-
"
|
|
83
|
+
"gh-pages": "^4.0.0",
|
|
84
|
+
"git-raw-commits": "^2.0.3",
|
|
85
|
+
"git-semver-tags": "^4.0.0",
|
|
86
|
+
"google-protobuf": "^3.11.3",
|
|
87
|
+
"gulp": "^4.0.2",
|
|
65
88
|
"gulp-header": "^2.0.9",
|
|
66
89
|
"gulp-if": "^3.0.0",
|
|
67
90
|
"gulp-sourcemaps": "^3.0.0",
|
|
68
91
|
"gulp-uglify": "^3.0.2",
|
|
92
|
+
"jaguarjs-jsdoc": "github:dcodeIO/jaguarjs-jsdoc",
|
|
69
93
|
"jsdoc": "^4.0.0",
|
|
70
|
-
"minimist": "^1.2.
|
|
71
|
-
"nyc": "^
|
|
72
|
-
"reflect-metadata": "^0.
|
|
94
|
+
"minimist": "^1.2.0",
|
|
95
|
+
"nyc": "^15.0.0",
|
|
96
|
+
"reflect-metadata": "^0.1.13",
|
|
73
97
|
"tape": "^5.0.0",
|
|
74
98
|
"tslint": "^6.0.0",
|
|
75
99
|
"typescript": "^3.7.5",
|
|
76
100
|
"uglify-js": "^3.7.7",
|
|
77
101
|
"vinyl-buffer": "^1.0.1",
|
|
78
|
-
"vinyl-fs": "^
|
|
102
|
+
"vinyl-fs": "^3.0.3",
|
|
79
103
|
"vinyl-source-stream": "^2.0.0"
|
|
80
104
|
},
|
|
81
105
|
"files": [
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
var converter = exports;
|
|
7
7
|
|
|
8
|
-
var Enum
|
|
9
|
-
|
|
10
|
-
util = require("./util");
|
|
8
|
+
var Enum = require("./enum"),
|
|
9
|
+
util = require("./util");
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Generates a partial value fromObject conveter.
|
|
@@ -28,7 +27,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
28
27
|
// enum unknown values passthrough
|
|
29
28
|
if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen
|
|
30
29
|
("default:")
|
|
31
|
-
("if(typeof
|
|
30
|
+
("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
|
|
32
31
|
if (!field.repeated) gen // fallback to default value only for
|
|
33
32
|
// arrays, to avoid leaving holes.
|
|
34
33
|
("break"); // for non-repeated fields, just ignore
|
|
@@ -42,9 +41,9 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
42
41
|
} gen
|
|
43
42
|
("}");
|
|
44
43
|
} else gen
|
|
45
|
-
("if(
|
|
44
|
+
("if(!util.isObject(d%s))", prop)
|
|
46
45
|
("throw TypeError(%j)", field.fullName + ": object expected")
|
|
47
|
-
("m%s=types[%i].fromObject(d%s,
|
|
46
|
+
("m%s=types[%i].fromObject(d%s,n+1)", prop, fieldIndex, prop);
|
|
48
47
|
} else {
|
|
49
48
|
var isUnsigned = false;
|
|
50
49
|
switch (field.type) {
|
|
@@ -80,7 +79,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
80
79
|
case "bytes": gen
|
|
81
80
|
("if(typeof d%s===\"string\")", prop)
|
|
82
81
|
("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)
|
|
83
|
-
("else if(d%s.length>=0)", prop)
|
|
82
|
+
("else if(d%s.length >= 0)", prop)
|
|
84
83
|
("m%s=d%s", prop, prop);
|
|
85
84
|
break;
|
|
86
85
|
case "string": gen
|
|
@@ -106,26 +105,27 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
106
105
|
converter.fromObject = function fromObject(mtype) {
|
|
107
106
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
108
107
|
var fields = mtype.fieldsArray;
|
|
109
|
-
var gen = util.codegen(["d", "
|
|
110
|
-
("if(d instanceof
|
|
111
|
-
("return d")
|
|
112
|
-
("if(q===undefined)q=0")
|
|
113
|
-
("if(q>util.recursionLimit)")
|
|
114
|
-
("throw Error(\"max depth exceeded\")");
|
|
108
|
+
var gen = util.codegen(["d", "n"], mtype.name + "$fromObject")
|
|
109
|
+
("if(d instanceof this.ctor)")
|
|
110
|
+
("return d");
|
|
115
111
|
if (!fields.length) return gen
|
|
116
|
-
("return new
|
|
112
|
+
("return new this.ctor");
|
|
113
|
+
gen
|
|
114
|
+
("if(!util.isObject(d))")
|
|
115
|
+
("throw TypeError(%j)", mtype.fullName + ": object expected")
|
|
116
|
+
("if(n===undefined)n=0")
|
|
117
|
+
("if(n>util.recursionLimit)")
|
|
118
|
+
("throw Error(\"maximum nesting depth exceeded\")");
|
|
117
119
|
gen
|
|
118
|
-
("var m=new
|
|
120
|
+
("var m=new this.ctor");
|
|
119
121
|
for (var i = 0; i < fields.length; ++i) {
|
|
120
122
|
var field = fields[i].resolve(),
|
|
121
|
-
prop = util.safeProp(field.name)
|
|
122
|
-
implicitPresence = !field.hasPresence && !field.repeated && !field.map
|
|
123
|
-
&& (field.resolvedType instanceof Enum || types.basic[field.type] !== undefined);
|
|
123
|
+
prop = util.safeProp(field.name);
|
|
124
124
|
|
|
125
125
|
// Map fields
|
|
126
126
|
if (field.map) { gen
|
|
127
127
|
("if(d%s){", prop)
|
|
128
|
-
("if(
|
|
128
|
+
("if(!util.isObject(d%s))", prop)
|
|
129
129
|
("throw TypeError(%j)", field.fullName + ": object expected")
|
|
130
130
|
("m%s={}", prop)
|
|
131
131
|
("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
|
|
@@ -141,7 +141,7 @@ converter.fromObject = function fromObject(mtype) {
|
|
|
141
141
|
("if(d%s){", prop)
|
|
142
142
|
("if(!Array.isArray(d%s))", prop)
|
|
143
143
|
("throw TypeError(%j)", field.fullName + ": array expected")
|
|
144
|
-
("m%s=
|
|
144
|
+
("m%s=[]", prop)
|
|
145
145
|
("for(var i=0;i<d%s.length;++i){", prop);
|
|
146
146
|
genValuePartial_fromObject(gen, field, /* not sorted */ i, prop + "[i]")
|
|
147
147
|
("}")
|
|
@@ -151,23 +151,7 @@ converter.fromObject = function fromObject(mtype) {
|
|
|
151
151
|
} else {
|
|
152
152
|
if (!(field.resolvedType instanceof Enum)) gen // no need to test for null/undefined if an enum (uses switch)
|
|
153
153
|
("if(d%s!=null){", prop); // !== undefined && !== null
|
|
154
|
-
if (implicitPresence) {
|
|
155
|
-
if (field.resolvedType instanceof Enum) gen
|
|
156
|
-
("if(d%s!==%j&&(typeof d%s!==\"string\"||types[%i].values[d%s]!==%j)){", prop, field.typeDefault, prop, i, prop, field.typeDefault);
|
|
157
|
-
else if (field.type === "string") gen
|
|
158
|
-
("if(typeof d%s!==\"string\"||d%s.length){", prop, prop);
|
|
159
|
-
else if (field.type === "bytes") gen
|
|
160
|
-
("if(d%s.length){", prop);
|
|
161
|
-
else if (field.type === "bool") gen
|
|
162
|
-
("if(d%s){", prop);
|
|
163
|
-
else if (types.long[field.type] !== undefined) gen
|
|
164
|
-
("if(typeof d%s===\"object\"?d%s.low||d%s.high:Number(d%s)!==0){", prop, prop, prop, prop);
|
|
165
|
-
else gen
|
|
166
|
-
("if(Number(d%s)!==0){", prop);
|
|
167
|
-
}
|
|
168
154
|
genValuePartial_fromObject(gen, field, /* not sorted */ i, prop);
|
|
169
|
-
if (implicitPresence) gen
|
|
170
|
-
("}");
|
|
171
155
|
if (!(field.resolvedType instanceof Enum)) gen
|
|
172
156
|
("}");
|
|
173
157
|
}
|
|
@@ -181,26 +165,23 @@ converter.fromObject = function fromObject(mtype) {
|
|
|
181
165
|
* @param {Codegen} gen Codegen instance
|
|
182
166
|
* @param {Field} field Reflected field
|
|
183
167
|
* @param {number} fieldIndex Field index
|
|
184
|
-
* @param {string}
|
|
185
|
-
* @param {string} [srcProp] Source property reference
|
|
168
|
+
* @param {string} prop Property reference
|
|
186
169
|
* @returns {Codegen} Codegen instance
|
|
187
170
|
* @ignore
|
|
188
171
|
*/
|
|
189
|
-
function genValuePartial_toObject(gen, field, fieldIndex,
|
|
172
|
+
function genValuePartial_toObject(gen, field, fieldIndex, prop) {
|
|
190
173
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
191
|
-
if (!srcProp)
|
|
192
|
-
srcProp = dstProp;
|
|
193
174
|
if (field.resolvedType) {
|
|
194
175
|
if (field.resolvedType instanceof Enum) gen
|
|
195
|
-
("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",
|
|
176
|
+
("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", prop, fieldIndex, prop, prop, fieldIndex, prop, prop);
|
|
196
177
|
else gen
|
|
197
|
-
("d%s=types[%i].toObject(m%s,o,q+1)",
|
|
178
|
+
("d%s=types[%i].toObject(m%s,o,q+1)", prop, fieldIndex, prop);
|
|
198
179
|
} else {
|
|
199
180
|
var isUnsigned = false;
|
|
200
181
|
switch (field.type) {
|
|
201
182
|
case "double":
|
|
202
183
|
case "float": gen
|
|
203
|
-
("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",
|
|
184
|
+
("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", prop, prop, prop, prop);
|
|
204
185
|
break;
|
|
205
186
|
case "uint64":
|
|
206
187
|
case "fixed64":
|
|
@@ -210,17 +191,17 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
|
|
|
210
191
|
case "sint64":
|
|
211
192
|
case "sfixed64": gen
|
|
212
193
|
("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
|
|
213
|
-
("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()",
|
|
214
|
-
("else if(typeof m%s===\"number\")",
|
|
215
|
-
("d%s=o.longs===String?String(m%s):m%s",
|
|
194
|
+
("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", prop, prop, prop, prop, prop, isUnsigned)
|
|
195
|
+
("else if(typeof m%s===\"number\")", prop)
|
|
196
|
+
("d%s=o.longs===String?String(m%s):m%s", prop, prop, prop)
|
|
216
197
|
("else") // Long-like
|
|
217
|
-
("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",
|
|
198
|
+
("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop);
|
|
218
199
|
break;
|
|
219
200
|
case "bytes": gen
|
|
220
|
-
("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",
|
|
201
|
+
("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop);
|
|
221
202
|
break;
|
|
222
203
|
default: gen
|
|
223
|
-
("d%s=m%s",
|
|
204
|
+
("d%s=m%s", prop, prop);
|
|
224
205
|
break;
|
|
225
206
|
}
|
|
226
207
|
}
|
|
@@ -308,28 +289,23 @@ converter.toObject = function toObject(mtype) {
|
|
|
308
289
|
("var ks2");
|
|
309
290
|
} gen
|
|
310
291
|
("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop)
|
|
311
|
-
("d%s={}", prop)
|
|
312
|
-
var longKey = types.long[field.keyType] !== undefined,
|
|
313
|
-
srcProp = prop + "[ks2[j]]";
|
|
314
|
-
gen
|
|
292
|
+
("d%s={}", prop)
|
|
315
293
|
("for(var j=0;j<ks2.length;++j){");
|
|
316
|
-
if (longKey) gen
|
|
317
|
-
("var k2=util.longFromKey(ks2[j],%j).toString()", field.keyType === "uint64" || field.keyType === "fixed64");
|
|
318
294
|
gen
|
|
319
295
|
("if(ks2[j]===\"__proto__\")")
|
|
320
296
|
("util.makeProp(d%s,ks2[j])", prop);
|
|
321
|
-
genValuePartial_toObject(gen, field, /* sorted */ index,
|
|
297
|
+
genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[ks2[j]]")
|
|
322
298
|
("}");
|
|
323
299
|
} else if (field.repeated) { gen
|
|
324
300
|
("if(m%s&&m%s.length){", prop, prop)
|
|
325
|
-
("d%s=
|
|
301
|
+
("d%s=[]", prop)
|
|
326
302
|
("for(var j=0;j<m%s.length;++j){", prop);
|
|
327
303
|
genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
|
|
328
304
|
("}");
|
|
329
305
|
} else { gen
|
|
330
|
-
("if(m%s!=null&&
|
|
306
|
+
("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
|
|
331
307
|
genValuePartial_toObject(gen, field, /* sorted */ index, prop);
|
|
332
|
-
if (field.partOf
|
|
308
|
+
if (field.partOf) gen
|
|
333
309
|
("if(o.oneofs)")
|
|
334
310
|
("d%s=%j", util.safeProp(field.partOf.name), field.name);
|
|
335
311
|
}
|
|
@@ -16,187 +16,116 @@ function missing(field) {
|
|
|
16
16
|
*/
|
|
17
17
|
function decoder(mtype) {
|
|
18
18
|
/* eslint-disable no-unexpected-multiline */
|
|
19
|
-
var
|
|
20
|
-
hasImplicitPresenceField = false,
|
|
21
|
-
i = 0;
|
|
22
|
-
for (; i < mtype.fieldsArray.length; ++i) {
|
|
23
|
-
var pfield = mtype._fieldsArray[i];
|
|
24
|
-
if (pfield.map)
|
|
25
|
-
hasMapField = true;
|
|
26
|
-
if (!pfield.repeated && !pfield.map && !pfield.hasPresence)
|
|
27
|
-
hasImplicitPresenceField = true;
|
|
28
|
-
}
|
|
29
|
-
var gen = util.codegen(["r", "l", "z", "q", "g"], mtype.name + "$decode")
|
|
19
|
+
var gen = util.codegen(["r", "l", "e", "n"], mtype.name + "$decode")
|
|
30
20
|
("if(!(r instanceof Reader))")
|
|
31
21
|
("r=Reader.create(r)")
|
|
32
|
-
("if(
|
|
33
|
-
("if(
|
|
34
|
-
("throw Error(\"
|
|
35
|
-
("var c=l===undefined?r.len:r.pos+l,m=
|
|
22
|
+
("if(n===undefined)n=0")
|
|
23
|
+
("if(n>Reader.recursionLimit)")
|
|
24
|
+
("throw Error(\"maximum nesting depth exceeded\")")
|
|
25
|
+
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
|
|
36
26
|
("while(r.pos<c){")
|
|
37
|
-
("var
|
|
38
|
-
("
|
|
39
|
-
("if(t===z){")
|
|
40
|
-
("z=undefined")
|
|
27
|
+
("var t=r.uint32()")
|
|
28
|
+
("if(t===e)")
|
|
41
29
|
("break")
|
|
42
|
-
("
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {
|
|
30
|
+
("switch(t>>>3){");
|
|
31
|
+
|
|
32
|
+
var i = 0;
|
|
33
|
+
for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {
|
|
47
34
|
var field = mtype._fieldsArray[i].resolve(),
|
|
48
35
|
type = field.resolvedType instanceof Enum ? "int32" : field.type,
|
|
49
|
-
ref = "m" + util.safeProp(field.name);
|
|
36
|
+
ref = "m" + util.safeProp(field.name); gen
|
|
37
|
+
("case %i: {", field.id);
|
|
50
38
|
|
|
51
39
|
// Map fields
|
|
52
|
-
if (field.map) {
|
|
53
|
-
gen
|
|
54
|
-
("case %i:{", field.id)
|
|
55
|
-
("if(u!==2)")
|
|
56
|
-
("break")
|
|
40
|
+
if (field.map) { gen
|
|
57
41
|
("if(%s===util.emptyObject)", ref)
|
|
58
42
|
("%s={}", ref)
|
|
59
|
-
("var c2=r.uint32()+r.pos");
|
|
43
|
+
("var c2 = r.uint32()+r.pos");
|
|
60
44
|
|
|
61
45
|
if (types.defaults[field.keyType] !== undefined) gen
|
|
62
46
|
("k=%j", types.defaults[field.keyType]);
|
|
63
47
|
else gen
|
|
64
48
|
("k=null");
|
|
65
49
|
|
|
66
|
-
if (types.
|
|
67
|
-
("
|
|
68
|
-
else if (types.defaults[type] !== undefined) gen
|
|
69
|
-
("v=%j", types.defaults[type]);
|
|
50
|
+
if (types.defaults[type] !== undefined) gen
|
|
51
|
+
("value=%j", types.defaults[type]);
|
|
70
52
|
else gen
|
|
71
|
-
("
|
|
53
|
+
("value=null");
|
|
72
54
|
|
|
73
55
|
gen
|
|
74
56
|
("while(r.pos<c2){")
|
|
75
|
-
("var
|
|
76
|
-
("
|
|
77
|
-
|
|
78
|
-
("case
|
|
79
|
-
("if(u!==%i)", types.mapKey[field.keyType])
|
|
80
|
-
("break")
|
|
81
|
-
("k=r.%s()", field.keyType)
|
|
82
|
-
("continue")
|
|
83
|
-
("case 2:")
|
|
84
|
-
("if(u!==%i)", types.basic[type] === undefined ? 2 : types.basic[type])
|
|
85
|
-
("break");
|
|
57
|
+
("var tag2=r.uint32()")
|
|
58
|
+
("switch(tag2>>>3){")
|
|
59
|
+
("case 1: k=r.%s(); break", field.keyType)
|
|
60
|
+
("case 2:");
|
|
86
61
|
|
|
87
62
|
if (types.basic[type] === undefined) gen
|
|
88
|
-
("
|
|
63
|
+
("value=types[%i].decode(r,r.uint32(),undefined,n+1)", i); // can't be groups
|
|
89
64
|
else gen
|
|
90
|
-
("
|
|
65
|
+
("value=r.%s()", type);
|
|
91
66
|
|
|
92
67
|
gen
|
|
93
|
-
("
|
|
68
|
+
("break")
|
|
69
|
+
("default:")
|
|
70
|
+
("r.skipType(tag2&7,n)")
|
|
71
|
+
("break")
|
|
94
72
|
("}")
|
|
95
|
-
("r.skipType(u,q,t2)")
|
|
96
73
|
("}");
|
|
97
74
|
|
|
98
|
-
var val = types.basic[type] === undefined ? "v||new types[" + i + "].ctor" : "v";
|
|
99
75
|
if (types.long[field.keyType] !== undefined) gen
|
|
100
|
-
("%s[typeof k===\"object\"?util.longToHash(k):k]
|
|
76
|
+
("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref);
|
|
101
77
|
else {
|
|
102
78
|
if (field.keyType === "string") gen
|
|
103
79
|
("if(k===\"__proto__\")")
|
|
104
80
|
("util.makeProp(%s,k)", ref);
|
|
105
81
|
gen
|
|
106
|
-
("%s[k]
|
|
82
|
+
("%s[k]=value", ref);
|
|
107
83
|
}
|
|
108
84
|
|
|
109
85
|
// Repeated fields
|
|
110
86
|
} else if (field.repeated) { gen
|
|
111
|
-
|
|
112
|
-
|
|
87
|
+
|
|
88
|
+
("if(!(%s&&%s.length))", ref, ref)
|
|
89
|
+
("%s=[]", ref);
|
|
113
90
|
|
|
114
91
|
// Packable (always check for forward and backward compatiblity)
|
|
115
92
|
if (types.packed[type] !== undefined) gen
|
|
116
|
-
("if(
|
|
117
|
-
("if(!(%s&&%s.length))", ref, ref)
|
|
118
|
-
("%s=[]", ref)
|
|
93
|
+
("if((t&7)===2){")
|
|
119
94
|
("var c2=r.uint32()+r.pos")
|
|
120
95
|
("while(r.pos<c2)")
|
|
121
96
|
("%s.push(r.%s())", ref, type)
|
|
122
|
-
|
|
123
|
-
("}");
|
|
97
|
+
("}else");
|
|
124
98
|
|
|
125
99
|
// Non-packed
|
|
126
|
-
gen
|
|
127
|
-
|
|
128
|
-
("
|
|
129
|
-
|
|
130
|
-
("%s=[]", ref);
|
|
131
|
-
if (types.basic[type] === undefined) {
|
|
132
|
-
if (field.delimited) gen
|
|
133
|
-
("%s.push(types[%i].decode(r,undefined,%i,q+1))", ref, i, field.id * 8 + 4);
|
|
134
|
-
else gen
|
|
135
|
-
("%s.push(types[%i].decode(r,r.uint32(),undefined,q+1))", ref, i);
|
|
136
|
-
} else gen
|
|
100
|
+
if (types.basic[type] === undefined) gen(field.delimited
|
|
101
|
+
? "%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))"
|
|
102
|
+
: "%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))", ref, i);
|
|
103
|
+
else gen
|
|
137
104
|
("%s.push(r.%s())", ref, type);
|
|
138
105
|
|
|
139
106
|
// Non-repeated
|
|
140
|
-
} else if (types.basic[type] === undefined)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
("break");
|
|
145
|
-
if (field.delimited) gen
|
|
146
|
-
("%s=types[%i].decode(r,undefined,%i,q+1,%s)", ref, i, field.id * 8 + 4, ref);
|
|
147
|
-
else gen
|
|
148
|
-
("%s=types[%i].decode(r,r.uint32(),undefined,q+1,%s)", ref, i, ref);
|
|
149
|
-
}
|
|
150
|
-
else if (field.hasPresence) {
|
|
151
|
-
gen
|
|
152
|
-
("case %i:{", field.id)
|
|
153
|
-
("if(u!==%i)", types.basic[type])
|
|
154
|
-
("break")
|
|
107
|
+
} else if (types.basic[type] === undefined) gen(field.delimited
|
|
108
|
+
? "%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)"
|
|
109
|
+
: "%s=types[%i].decode(r,r.uint32(),undefined,n+1)", ref, i);
|
|
110
|
+
else gen
|
|
155
111
|
("%s=r.%s()", ref, type);
|
|
156
|
-
} else {
|
|
157
|
-
gen
|
|
158
|
-
("case %i:{", field.id)
|
|
159
|
-
("if(u!==%i)", types.basic[type])
|
|
160
|
-
("break");
|
|
161
|
-
if (field.resolvedType instanceof Enum && field.typeDefault !== 0) gen
|
|
162
|
-
// TODO: Protoc rejects open enums whose first value is not zero.
|
|
163
|
-
// We should do the same, but for v8 this would be a regression.
|
|
164
|
-
("if((v=r.%s())!==%j)", type, field.typeDefault);
|
|
165
|
-
else if (type === "string" || type === "bytes") gen
|
|
166
|
-
("if((v=r.%s()).length)", type);
|
|
167
|
-
else if (types.long[type] !== undefined) gen
|
|
168
|
-
("if(typeof(v=r.%s())===\"object\"?v.low||v.high:v!==0)", type);
|
|
169
|
-
else if (type === "double" || type === "float") gen
|
|
170
|
-
("if((v=r.%s())!==0)", type);
|
|
171
|
-
else gen
|
|
172
|
-
("if(v=r.%s())", type);
|
|
173
|
-
gen
|
|
174
|
-
("%s=v", ref)
|
|
175
|
-
("else")
|
|
176
|
-
("delete %s", ref); // rare/odd case: later default clears earlier non-default
|
|
177
|
-
}
|
|
178
|
-
if (field.partOf) gen
|
|
179
|
-
("m%s=%j", util.safeProp(field.partOf.name), field.name);
|
|
180
112
|
gen
|
|
181
|
-
("
|
|
113
|
+
("break")
|
|
182
114
|
("}");
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
("
|
|
190
|
-
|
|
191
|
-
("}")
|
|
192
|
-
("if(z!==undefined)")
|
|
193
|
-
("throw Error(\"missing end group\")");
|
|
115
|
+
// Unknown fields
|
|
116
|
+
} gen
|
|
117
|
+
("default:")
|
|
118
|
+
("r.skipType(t&7,n)")
|
|
119
|
+
("break")
|
|
120
|
+
|
|
121
|
+
("}")
|
|
122
|
+
("}");
|
|
194
123
|
|
|
195
124
|
// Field presence
|
|
196
125
|
for (i = 0; i < mtype._fieldsArray.length; ++i) {
|
|
197
126
|
var rfield = mtype._fieldsArray[i];
|
|
198
127
|
if (rfield.required) gen
|
|
199
|
-
|
|
128
|
+
("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
|
|
200
129
|
("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
|
|
201
130
|
}
|
|
202
131
|
|
|
@@ -50,12 +50,7 @@ function encoder(mtype) {
|
|
|
50
50
|
if (field.map) {
|
|
51
51
|
gen
|
|
52
52
|
("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name) // !== undefined && !== null
|
|
53
|
-
("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref)
|
|
54
|
-
if (field.keyType === "bool") gen
|
|
55
|
-
("w.uint32(%i).fork().uint32(%i).bool(util.boolFromKey(ks[i]))", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType]);
|
|
56
|
-
else if (types.long[field.keyType] !== undefined) gen
|
|
57
|
-
("w.uint32(%i).fork().uint32(%i).%s(util.longFromKey(ks[i],%j))", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType, field.keyType === "uint64" || field.keyType === "fixed64");
|
|
58
|
-
else gen
|
|
53
|
+
("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref)
|
|
59
54
|
("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
|
|
60
55
|
if (wireType === undefined) gen
|
|
61
56
|
("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()", index, ref); // can't be groups
|
|
@@ -91,7 +86,7 @@ function encoder(mtype) {
|
|
|
91
86
|
|
|
92
87
|
// Non-repeated
|
|
93
88
|
} else {
|
|
94
|
-
if (
|
|
89
|
+
if (field.optional) gen
|
|
95
90
|
("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); // !== undefined && !== null
|
|
96
91
|
|
|
97
92
|
if (wireType === undefined)
|
|
@@ -103,9 +98,6 @@ function encoder(mtype) {
|
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
return gen
|
|
106
|
-
("if(m.$unknowns!=null&&Object.hasOwnProperty.call(m,\"$unknowns\"))")
|
|
107
|
-
("for(var i=0;i<m.$unknowns.length;++i)")
|
|
108
|
-
("w.raw(m.$unknowns[i])")
|
|
109
101
|
("return w");
|
|
110
102
|
/* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
111
103
|
}
|
|
@@ -17,7 +17,7 @@ var Namespace = require("./namespace"),
|
|
|
17
17
|
* @param {Object.<string,number>} [values] Enum values as an object, by name
|
|
18
18
|
* @param {Object.<string,*>} [options] Declared options
|
|
19
19
|
* @param {string} [comment] The comment for this enum
|
|
20
|
-
* @param {Object.<string,string
|
|
20
|
+
* @param {Object.<string,string>} [comments] The value comments for this enum
|
|
21
21
|
* @param {Object.<string,Object<string,*>>|undefined} [valuesOptions] The value options for this enum
|
|
22
22
|
*/
|
|
23
23
|
function Enum(name, values, options, comment, comments, valuesOptions) {
|
|
@@ -46,7 +46,7 @@ function Enum(name, values, options, comment, comments, valuesOptions) {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Value comment texts, if any.
|
|
49
|
-
* @type {Object.<string,string
|
|
49
|
+
* @type {Object.<string,string>}
|
|
50
50
|
*/
|
|
51
51
|
this.comments = comments || {};
|
|
52
52
|
|
|
@@ -96,13 +96,8 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
|
|
|
96
96
|
/**
|
|
97
97
|
* Enum descriptor.
|
|
98
98
|
* @interface IEnum
|
|
99
|
-
* @property {string} [edition] Edition
|
|
100
99
|
* @property {Object.<string,number>} values Enum values
|
|
101
100
|
* @property {Object.<string,*>} [options] Enum options
|
|
102
|
-
* @property {Object.<string,Object.<string,*>>} [valuesOptions] Enum value options
|
|
103
|
-
* @property {Array.<number[]|string>} [reserved] Reserved ranges
|
|
104
|
-
* @property {string|null} [comment] Enum comment
|
|
105
|
-
* @property {Object.<string,string|null>} [comments] Value comments
|
|
106
101
|
*/
|
|
107
102
|
|
|
108
103
|
/**
|
|
@@ -113,7 +108,7 @@ Enum.prototype._resolveFeatures = function _resolveFeatures(edition) {
|
|
|
113
108
|
* @throws {TypeError} If arguments are invalid
|
|
114
109
|
*/
|
|
115
110
|
Enum.fromJSON = function fromJSON(name, json) {
|
|
116
|
-
var enm = new Enum(name, json.values, json.options, json.comment, json.comments
|
|
111
|
+
var enm = new Enum(name, json.values, json.options, json.comment, json.comments);
|
|
117
112
|
enm.reserved = json.reserved;
|
|
118
113
|
if (json.edition)
|
|
119
114
|
enm._edition = json.edition;
|