@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,4 +1,4 @@
|
|
|
1
|
-
// DO NOT EDIT! This is a generated file. Edit the
|
|
1
|
+
// DO NOT EDIT! This is a generated file. Edit the JSDoc in src/*.js instead and run 'npm run build:types'.
|
|
2
2
|
|
|
3
3
|
export as namespace protobuf;
|
|
4
4
|
|
|
@@ -162,28 +162,28 @@ export class Enum extends ReflectionObject {
|
|
|
162
162
|
* @param [comments] The value comments for this enum
|
|
163
163
|
* @param [valuesOptions] The value options for this enum
|
|
164
164
|
*/
|
|
165
|
-
constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }, comment?: string, comments?: { [k: string]:
|
|
165
|
+
constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }, comment?: string, comments?: { [k: string]: string }, valuesOptions?: ({ [k: string]: { [k: string]: any } }|undefined));
|
|
166
166
|
|
|
167
167
|
/** Enum values by id. */
|
|
168
|
-
valuesById: { [k: number]: string };
|
|
168
|
+
public valuesById: { [k: number]: string };
|
|
169
169
|
|
|
170
170
|
/** Enum values by name. */
|
|
171
|
-
values: { [k: string]: number };
|
|
171
|
+
public values: { [k: string]: number };
|
|
172
172
|
|
|
173
173
|
/** Enum comment text. */
|
|
174
|
-
comment: (string|null);
|
|
174
|
+
public comment: (string|null);
|
|
175
175
|
|
|
176
176
|
/** Value comment texts, if any. */
|
|
177
|
-
comments: { [k: string]:
|
|
177
|
+
public comments: { [k: string]: string };
|
|
178
178
|
|
|
179
179
|
/** Values options, if any */
|
|
180
|
-
valuesOptions?: { [k: string]: { [k: string]: any } };
|
|
180
|
+
public valuesOptions?: { [k: string]: { [k: string]: any } };
|
|
181
181
|
|
|
182
182
|
/** Resolved values features, if any */
|
|
183
|
-
_valuesFeatures?: { [k: string]: { [k: string]: any } };
|
|
183
|
+
public _valuesFeatures?: { [k: string]: { [k: string]: any } };
|
|
184
184
|
|
|
185
185
|
/** Reserved ranges, if any. */
|
|
186
|
-
reserved: (number[]|string)[];
|
|
186
|
+
public reserved: (number[]|string)[];
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* Constructs an enum from an enum descriptor.
|
|
@@ -192,14 +192,14 @@ export class Enum extends ReflectionObject {
|
|
|
192
192
|
* @returns Created enum
|
|
193
193
|
* @throws {TypeError} If arguments are invalid
|
|
194
194
|
*/
|
|
195
|
-
static fromJSON(name: string, json: IEnum): Enum;
|
|
195
|
+
public static fromJSON(name: string, json: IEnum): Enum;
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Converts this enum to an enum descriptor.
|
|
199
199
|
* @param [toJSONOptions] JSON conversion options
|
|
200
200
|
* @returns Enum descriptor
|
|
201
201
|
*/
|
|
202
|
-
toJSON(toJSONOptions?: IToJSONOptions): IEnum;
|
|
202
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IEnum;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Adds a value to this enum.
|
|
@@ -211,7 +211,7 @@ export class Enum extends ReflectionObject {
|
|
|
211
211
|
* @throws {TypeError} If arguments are invalid
|
|
212
212
|
* @throws {Error} If there is already a value with this name or id
|
|
213
213
|
*/
|
|
214
|
-
add(name: string, id: number, comment?: string, options?: ({ [k: string]: any }|undefined)): Enum;
|
|
214
|
+
public add(name: string, id: number, comment?: string, options?: ({ [k: string]: any }|undefined)): Enum;
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
217
|
* Removes a value from this enum
|
|
@@ -220,46 +220,31 @@ export class Enum extends ReflectionObject {
|
|
|
220
220
|
* @throws {TypeError} If arguments are invalid
|
|
221
221
|
* @throws {Error} If `name` is not a name of this enum
|
|
222
222
|
*/
|
|
223
|
-
remove(name: string): Enum;
|
|
223
|
+
public remove(name: string): Enum;
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Tests if the specified id is reserved.
|
|
227
227
|
* @param id Id to test
|
|
228
228
|
* @returns `true` if reserved, otherwise `false`
|
|
229
229
|
*/
|
|
230
|
-
isReservedId(id: number): boolean;
|
|
230
|
+
public isReservedId(id: number): boolean;
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* Tests if the specified name is reserved.
|
|
234
234
|
* @param name Name to test
|
|
235
235
|
* @returns `true` if reserved, otherwise `false`
|
|
236
236
|
*/
|
|
237
|
-
isReservedName(name: string): boolean;
|
|
237
|
+
public isReservedName(name: string): boolean;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
/** Enum descriptor. */
|
|
241
241
|
export interface IEnum {
|
|
242
242
|
|
|
243
|
-
/** Edition */
|
|
244
|
-
edition?: string;
|
|
245
|
-
|
|
246
243
|
/** Enum values */
|
|
247
244
|
values: { [k: string]: number };
|
|
248
245
|
|
|
249
246
|
/** Enum options */
|
|
250
247
|
options?: { [k: string]: any };
|
|
251
|
-
|
|
252
|
-
/** Enum value options */
|
|
253
|
-
valuesOptions?: { [k: string]: { [k: string]: any } };
|
|
254
|
-
|
|
255
|
-
/** Reserved ranges */
|
|
256
|
-
reserved?: (number[]|string)[];
|
|
257
|
-
|
|
258
|
-
/** Enum comment */
|
|
259
|
-
comment?: (string|null);
|
|
260
|
-
|
|
261
|
-
/** Value comments */
|
|
262
|
-
comments?: { [k: string]: (string|null) };
|
|
263
248
|
}
|
|
264
249
|
|
|
265
250
|
/** Reflected message field. */
|
|
@@ -276,16 +261,6 @@ export class Field extends FieldBase {
|
|
|
276
261
|
*/
|
|
277
262
|
constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any });
|
|
278
263
|
|
|
279
|
-
/**
|
|
280
|
-
* Field decorator (TypeScript).
|
|
281
|
-
* @param fieldId Field id
|
|
282
|
-
* @param fieldType Field type
|
|
283
|
-
* @param [fieldRule="optional"] Field rule
|
|
284
|
-
* @returns Decorator function
|
|
285
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
286
|
-
*/
|
|
287
|
-
static d<T extends Message<T>>(fieldId: number, fieldType: (Constructor<T>|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator;
|
|
288
|
-
|
|
289
264
|
/**
|
|
290
265
|
* Constructs a field from a field descriptor.
|
|
291
266
|
* @param name Field name
|
|
@@ -293,25 +268,25 @@ export class Field extends FieldBase {
|
|
|
293
268
|
* @returns Created field
|
|
294
269
|
* @throws {TypeError} If arguments are invalid
|
|
295
270
|
*/
|
|
296
|
-
static fromJSON(name: string, json: IField): Field;
|
|
271
|
+
public static fromJSON(name: string, json: IField): Field;
|
|
297
272
|
|
|
298
273
|
/** Determines whether this field is required. */
|
|
299
|
-
readonly required: boolean;
|
|
274
|
+
public readonly required: boolean;
|
|
300
275
|
|
|
301
276
|
/** Determines whether this field is not required. */
|
|
302
|
-
readonly optional: boolean;
|
|
277
|
+
public readonly optional: boolean;
|
|
303
278
|
|
|
304
279
|
/**
|
|
305
280
|
* Determines whether this field uses tag-delimited encoding. In proto2 this
|
|
306
281
|
* corresponded to group syntax.
|
|
307
282
|
*/
|
|
308
|
-
readonly delimited: boolean;
|
|
283
|
+
public readonly delimited: boolean;
|
|
309
284
|
|
|
310
285
|
/** Determines whether this field is packed. Only relevant when repeated. */
|
|
311
|
-
readonly packed: boolean;
|
|
286
|
+
public readonly packed: boolean;
|
|
312
287
|
|
|
313
288
|
/** Determines whether this field tracks presence. */
|
|
314
|
-
readonly hasPresence: boolean;
|
|
289
|
+
public readonly hasPresence: boolean;
|
|
315
290
|
|
|
316
291
|
/**
|
|
317
292
|
* Field decorator (TypeScript).
|
|
@@ -320,9 +295,17 @@ export class Field extends FieldBase {
|
|
|
320
295
|
* @param [fieldRule="optional"] Field rule
|
|
321
296
|
* @param [defaultValue] Default value
|
|
322
297
|
* @returns Decorator function
|
|
323
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
324
298
|
*/
|
|
325
|
-
static d<T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]>(fieldId: number, fieldType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|object), fieldRule?: ("optional"|"required"|"repeated"), defaultValue?: T): FieldDecorator;
|
|
299
|
+
public static d<T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[]>(fieldId: number, fieldType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|object), fieldRule?: ("optional"|"required"|"repeated"), defaultValue?: T): FieldDecorator;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Field decorator (TypeScript).
|
|
303
|
+
* @param fieldId Field id
|
|
304
|
+
* @param fieldType Field type
|
|
305
|
+
* @param [fieldRule="optional"] Field rule
|
|
306
|
+
* @returns Decorator function
|
|
307
|
+
*/
|
|
308
|
+
public static d<T extends Message<T>>(fieldId: number, fieldType: (Constructor<T>|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator;
|
|
326
309
|
}
|
|
327
310
|
|
|
328
311
|
/** Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. */
|
|
@@ -340,67 +323,64 @@ export class FieldBase extends ReflectionObject {
|
|
|
340
323
|
*/
|
|
341
324
|
constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string);
|
|
342
325
|
|
|
343
|
-
/** Field rule, if any. */
|
|
344
|
-
rule?: string;
|
|
345
|
-
|
|
346
326
|
/** Field type. */
|
|
347
|
-
type: string;
|
|
327
|
+
public type: string;
|
|
348
328
|
|
|
349
329
|
/** Unique field id. */
|
|
350
|
-
id: number;
|
|
330
|
+
public id: number;
|
|
351
331
|
|
|
352
332
|
/** Extended type if different from parent. */
|
|
353
|
-
extend?: string;
|
|
333
|
+
public extend?: string;
|
|
354
334
|
|
|
355
335
|
/** Whether this field is repeated. */
|
|
356
|
-
repeated: boolean;
|
|
336
|
+
public repeated: boolean;
|
|
357
337
|
|
|
358
338
|
/** Whether this field is a map or not. */
|
|
359
|
-
map: boolean;
|
|
339
|
+
public map: boolean;
|
|
360
340
|
|
|
361
341
|
/** Message this field belongs to. */
|
|
362
|
-
message: (Type|null);
|
|
342
|
+
public message: (Type|null);
|
|
363
343
|
|
|
364
344
|
/** OneOf this field belongs to, if any, */
|
|
365
|
-
partOf: (OneOf|null);
|
|
345
|
+
public partOf: (OneOf|null);
|
|
366
346
|
|
|
367
347
|
/** The field type's default value. */
|
|
368
|
-
typeDefault: any;
|
|
348
|
+
public typeDefault: any;
|
|
369
349
|
|
|
370
350
|
/** The field's default value on prototypes. */
|
|
371
|
-
defaultValue: any;
|
|
351
|
+
public defaultValue: any;
|
|
372
352
|
|
|
373
353
|
/** Whether this field's value should be treated as a long. */
|
|
374
|
-
long: boolean;
|
|
354
|
+
public long: boolean;
|
|
375
355
|
|
|
376
356
|
/** Whether this field's value is a buffer. */
|
|
377
|
-
bytes: boolean;
|
|
357
|
+
public bytes: boolean;
|
|
378
358
|
|
|
379
359
|
/** Resolved type if not a basic type. */
|
|
380
|
-
resolvedType: (Type|Enum|null);
|
|
360
|
+
public resolvedType: (Type|Enum|null);
|
|
381
361
|
|
|
382
362
|
/** Sister-field within the extended type if a declaring extension field. */
|
|
383
|
-
extensionField: (Field|null);
|
|
363
|
+
public extensionField: (Field|null);
|
|
384
364
|
|
|
385
365
|
/** Sister-field within the declaring namespace if an extended field. */
|
|
386
|
-
declaringField: (Field|null);
|
|
366
|
+
public declaringField: (Field|null);
|
|
387
367
|
|
|
388
368
|
/** Comment for this field. */
|
|
389
|
-
comment: (string|null);
|
|
369
|
+
public comment: (string|null);
|
|
390
370
|
|
|
391
371
|
/**
|
|
392
372
|
* Converts this field to a field descriptor.
|
|
393
373
|
* @param [toJSONOptions] JSON conversion options
|
|
394
374
|
* @returns Field descriptor
|
|
395
375
|
*/
|
|
396
|
-
toJSON(toJSONOptions?: IToJSONOptions): IField;
|
|
376
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IField;
|
|
397
377
|
|
|
398
378
|
/**
|
|
399
379
|
* Resolves this field's type references.
|
|
400
380
|
* @returns `this`
|
|
401
381
|
* @throws {Error} If any reference cannot be resolved
|
|
402
382
|
*/
|
|
403
|
-
resolve(): Field;
|
|
383
|
+
public resolve(): Field;
|
|
404
384
|
|
|
405
385
|
/**
|
|
406
386
|
* Infers field features from legacy syntax that may have been specified differently.
|
|
@@ -408,15 +388,12 @@ export class FieldBase extends ReflectionObject {
|
|
|
408
388
|
* @param edition The edition this proto is on, or undefined if pre-editions
|
|
409
389
|
* @returns The feature values to override
|
|
410
390
|
*/
|
|
411
|
-
_inferLegacyProtoFeatures(edition: (string|undefined)): object;
|
|
391
|
+
public _inferLegacyProtoFeatures(edition: (string|undefined)): object;
|
|
412
392
|
}
|
|
413
393
|
|
|
414
394
|
/** Field descriptor. */
|
|
415
395
|
export interface IField {
|
|
416
396
|
|
|
417
|
-
/** Edition */
|
|
418
|
-
edition?: string;
|
|
419
|
-
|
|
420
397
|
/** Field rule */
|
|
421
398
|
rule?: string;
|
|
422
399
|
|
|
@@ -428,9 +405,6 @@ export interface IField {
|
|
|
428
405
|
|
|
429
406
|
/** Field options */
|
|
430
407
|
options?: { [k: string]: any };
|
|
431
|
-
|
|
432
|
-
/** Field comment */
|
|
433
|
-
comment?: (string|null);
|
|
434
408
|
}
|
|
435
409
|
|
|
436
410
|
/** Extension field descriptor. */
|
|
@@ -444,16 +418,15 @@ export interface IExtensionField extends IField {
|
|
|
444
418
|
* Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).
|
|
445
419
|
* @param prototype Target prototype
|
|
446
420
|
* @param fieldName Field name
|
|
447
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
448
421
|
*/
|
|
449
|
-
|
|
422
|
+
type FieldDecorator = (prototype: object, fieldName: string) => void;
|
|
450
423
|
|
|
451
424
|
/**
|
|
452
425
|
* A node-style callback as used by {@link load} and {@link Root#load}.
|
|
453
426
|
* @param error Error, if any, otherwise `null`
|
|
454
427
|
* @param [root] Root, if there hasn't been an error
|
|
455
428
|
*/
|
|
456
|
-
|
|
429
|
+
type LoadCallback = (error: (Error|null), root?: Root) => void;
|
|
457
430
|
|
|
458
431
|
/**
|
|
459
432
|
* Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.
|
|
@@ -512,10 +485,10 @@ export class MapField extends FieldBase {
|
|
|
512
485
|
constructor(name: string, id: number, keyType: string, type: string, options?: { [k: string]: any }, comment?: string);
|
|
513
486
|
|
|
514
487
|
/** Key type. */
|
|
515
|
-
keyType: string;
|
|
488
|
+
public keyType: string;
|
|
516
489
|
|
|
517
490
|
/** Resolved key type if not a basic type. */
|
|
518
|
-
resolvedKeyType: (ReflectionObject|null);
|
|
491
|
+
public resolvedKeyType: (ReflectionObject|null);
|
|
519
492
|
|
|
520
493
|
/**
|
|
521
494
|
* Constructs a map field from a map field descriptor.
|
|
@@ -524,14 +497,14 @@ export class MapField extends FieldBase {
|
|
|
524
497
|
* @returns Created map field
|
|
525
498
|
* @throws {TypeError} If arguments are invalid
|
|
526
499
|
*/
|
|
527
|
-
static fromJSON(name: string, json: IMapField): MapField;
|
|
500
|
+
public static fromJSON(name: string, json: IMapField): MapField;
|
|
528
501
|
|
|
529
502
|
/**
|
|
530
503
|
* Converts this map field to a map field descriptor.
|
|
531
504
|
* @param [toJSONOptions] JSON conversion options
|
|
532
505
|
* @returns Map field descriptor
|
|
533
506
|
*/
|
|
534
|
-
toJSON(toJSONOptions?: IToJSONOptions): IMapField;
|
|
507
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IMapField;
|
|
535
508
|
|
|
536
509
|
/**
|
|
537
510
|
* Map field decorator (TypeScript).
|
|
@@ -539,9 +512,8 @@ export class MapField extends FieldBase {
|
|
|
539
512
|
* @param fieldKeyType Field key type
|
|
540
513
|
* @param fieldValueType Field value type
|
|
541
514
|
* @returns Decorator function
|
|
542
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
543
515
|
*/
|
|
544
|
-
static d<T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }>(fieldId: number, fieldKeyType: ("int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"), fieldValueType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|object|Constructor<{}>)): FieldDecorator;
|
|
516
|
+
public static d<T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }>(fieldId: number, fieldKeyType: ("int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"), fieldValueType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|object|Constructor<{}>)): FieldDecorator;
|
|
545
517
|
}
|
|
546
518
|
|
|
547
519
|
/** Map field descriptor. */
|
|
@@ -567,21 +539,18 @@ export class Message<T extends object = object> {
|
|
|
567
539
|
*/
|
|
568
540
|
constructor(properties?: Properties<T>);
|
|
569
541
|
|
|
570
|
-
/** Unknown fields preserved while decoding */
|
|
571
|
-
$unknowns?: Uint8Array[];
|
|
572
|
-
|
|
573
542
|
/** Reference to the reflected type. */
|
|
574
|
-
static readonly $type: Type;
|
|
543
|
+
public static readonly $type: Type;
|
|
575
544
|
|
|
576
545
|
/** Reference to the reflected type. */
|
|
577
|
-
readonly $type: Type;
|
|
546
|
+
public readonly $type: Type;
|
|
578
547
|
|
|
579
548
|
/**
|
|
580
549
|
* Creates a new message of this type using the specified properties.
|
|
581
550
|
* @param [properties] Properties to set
|
|
582
551
|
* @returns Message instance
|
|
583
552
|
*/
|
|
584
|
-
static create<T extends Message<T>>(this: Constructor<T>, properties?: { [k: string]: any }): T
|
|
553
|
+
public static create<T extends Message<T>>(this: Constructor<T>, properties?: { [k: string]: any }): Message<T>;
|
|
585
554
|
|
|
586
555
|
/**
|
|
587
556
|
* Encodes a message of this type.
|
|
@@ -589,7 +558,7 @@ export class Message<T extends object = object> {
|
|
|
589
558
|
* @param [writer] Writer to use
|
|
590
559
|
* @returns Writer
|
|
591
560
|
*/
|
|
592
|
-
static encode<T extends Message<T>>(this: Constructor<T>, message: (T|{ [k: string]: any }), writer?: Writer): Writer;
|
|
561
|
+
public static encode<T extends Message<T>>(this: Constructor<T>, message: (T|{ [k: string]: any }), writer?: Writer): Writer;
|
|
593
562
|
|
|
594
563
|
/**
|
|
595
564
|
* Encodes a message of this type preceeded by its length as a varint.
|
|
@@ -597,35 +566,35 @@ export class Message<T extends object = object> {
|
|
|
597
566
|
* @param [writer] Writer to use
|
|
598
567
|
* @returns Writer
|
|
599
568
|
*/
|
|
600
|
-
static encodeDelimited<T extends Message<T>>(this: Constructor<T>, message: (T|{ [k: string]: any }), writer?: Writer): Writer;
|
|
569
|
+
public static encodeDelimited<T extends Message<T>>(this: Constructor<T>, message: (T|{ [k: string]: any }), writer?: Writer): Writer;
|
|
601
570
|
|
|
602
571
|
/**
|
|
603
572
|
* Decodes a message of this type.
|
|
604
573
|
* @param reader Reader or buffer to decode
|
|
605
574
|
* @returns Decoded message
|
|
606
575
|
*/
|
|
607
|
-
static decode<T extends Message<T>>(this: Constructor<T>, reader: (Reader|Uint8Array)): T;
|
|
576
|
+
public static decode<T extends Message<T>>(this: Constructor<T>, reader: (Reader|Uint8Array)): T;
|
|
608
577
|
|
|
609
578
|
/**
|
|
610
579
|
* Decodes a message of this type preceeded by its length as a varint.
|
|
611
580
|
* @param reader Reader or buffer to decode
|
|
612
581
|
* @returns Decoded message
|
|
613
582
|
*/
|
|
614
|
-
static decodeDelimited<T extends Message<T>>(this: Constructor<T>, reader: (Reader|Uint8Array)): T;
|
|
583
|
+
public static decodeDelimited<T extends Message<T>>(this: Constructor<T>, reader: (Reader|Uint8Array)): T;
|
|
615
584
|
|
|
616
585
|
/**
|
|
617
586
|
* Verifies a message of this type.
|
|
618
587
|
* @param message Plain object to verify
|
|
619
588
|
* @returns `null` if valid, otherwise the reason why it is not
|
|
620
589
|
*/
|
|
621
|
-
static verify(message: { [k: string]: any }): (string|null);
|
|
590
|
+
public static verify(message: { [k: string]: any }): (string|null);
|
|
622
591
|
|
|
623
592
|
/**
|
|
624
593
|
* Creates a new message of this type from a plain object. Also converts values to their respective internal types.
|
|
625
594
|
* @param object Plain object
|
|
626
595
|
* @returns Message instance
|
|
627
596
|
*/
|
|
628
|
-
static fromObject<T extends Message<T>>(this: Constructor<T>, object: { [k: string]: any }): T;
|
|
597
|
+
public static fromObject<T extends Message<T>>(this: Constructor<T>, object: { [k: string]: any }): T;
|
|
629
598
|
|
|
630
599
|
/**
|
|
631
600
|
* Creates a plain object from a message of this type. Also converts values to other types if specified.
|
|
@@ -633,13 +602,13 @@ export class Message<T extends object = object> {
|
|
|
633
602
|
* @param [options] Conversion options
|
|
634
603
|
* @returns Plain object
|
|
635
604
|
*/
|
|
636
|
-
static toObject<T extends Message<T>>(this: Constructor<T>, message: T, options?: IConversionOptions): { [k: string]: any };
|
|
605
|
+
public static toObject<T extends Message<T>>(this: Constructor<T>, message: T, options?: IConversionOptions): { [k: string]: any };
|
|
637
606
|
|
|
638
607
|
/**
|
|
639
608
|
* Converts this message to JSON.
|
|
640
609
|
* @returns JSON object
|
|
641
610
|
*/
|
|
642
|
-
toJSON(): { [k: string]: any };
|
|
611
|
+
public toJSON(): { [k: string]: any };
|
|
643
612
|
}
|
|
644
613
|
|
|
645
614
|
/** Reflected service method. */
|
|
@@ -655,36 +624,36 @@ export class Method extends ReflectionObject {
|
|
|
655
624
|
* @param [responseStream] Whether the response is streamed
|
|
656
625
|
* @param [options] Declared options
|
|
657
626
|
* @param [comment] The comment for this method
|
|
658
|
-
* @param [parsedOptions] Declared options, properly parsed into
|
|
627
|
+
* @param [parsedOptions] Declared options, properly parsed into an object
|
|
659
628
|
*/
|
|
660
|
-
constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|{ [k: string]: any }), responseStream?: (boolean|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string, parsedOptions?: { [k: string]: any }
|
|
629
|
+
constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|{ [k: string]: any }), responseStream?: (boolean|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string, parsedOptions?: { [k: string]: any });
|
|
661
630
|
|
|
662
631
|
/** Method type. */
|
|
663
|
-
type: string;
|
|
632
|
+
public type: string;
|
|
664
633
|
|
|
665
634
|
/** Request type. */
|
|
666
|
-
requestType: string;
|
|
635
|
+
public requestType: string;
|
|
667
636
|
|
|
668
637
|
/** Whether requests are streamed or not. */
|
|
669
|
-
requestStream?: boolean;
|
|
638
|
+
public requestStream?: boolean;
|
|
670
639
|
|
|
671
640
|
/** Response type. */
|
|
672
|
-
responseType: string;
|
|
641
|
+
public responseType: string;
|
|
673
642
|
|
|
674
643
|
/** Whether responses are streamed or not. */
|
|
675
|
-
responseStream?: boolean;
|
|
644
|
+
public responseStream?: boolean;
|
|
676
645
|
|
|
677
646
|
/** Resolved request type. */
|
|
678
|
-
resolvedRequestType: (Type|null);
|
|
647
|
+
public resolvedRequestType: (Type|null);
|
|
679
648
|
|
|
680
649
|
/** Resolved response type. */
|
|
681
|
-
resolvedResponseType: (Type|null);
|
|
650
|
+
public resolvedResponseType: (Type|null);
|
|
682
651
|
|
|
683
652
|
/** Comment for this method */
|
|
684
|
-
comment: (string|null);
|
|
653
|
+
public comment: (string|null);
|
|
685
654
|
|
|
686
|
-
/** Options properly parsed into
|
|
687
|
-
parsedOptions
|
|
655
|
+
/** Options properly parsed into an object */
|
|
656
|
+
public parsedOptions: any;
|
|
688
657
|
|
|
689
658
|
/**
|
|
690
659
|
* Constructs a method from a method descriptor.
|
|
@@ -693,14 +662,14 @@ export class Method extends ReflectionObject {
|
|
|
693
662
|
* @returns Created method
|
|
694
663
|
* @throws {TypeError} If arguments are invalid
|
|
695
664
|
*/
|
|
696
|
-
static fromJSON(name: string, json: IMethod): Method;
|
|
665
|
+
public static fromJSON(name: string, json: IMethod): Method;
|
|
697
666
|
|
|
698
667
|
/**
|
|
699
668
|
* Converts this method to a method descriptor.
|
|
700
669
|
* @param [toJSONOptions] JSON conversion options
|
|
701
670
|
* @returns Method descriptor
|
|
702
671
|
*/
|
|
703
|
-
toJSON(toJSONOptions?: IToJSONOptions): IMethod;
|
|
672
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IMethod;
|
|
704
673
|
}
|
|
705
674
|
|
|
706
675
|
/** Method descriptor. */
|
|
@@ -724,11 +693,11 @@ export interface IMethod {
|
|
|
724
693
|
/** Method options */
|
|
725
694
|
options?: { [k: string]: any };
|
|
726
695
|
|
|
727
|
-
/** Method
|
|
728
|
-
comment
|
|
696
|
+
/** Method comments */
|
|
697
|
+
comment: string;
|
|
729
698
|
|
|
730
|
-
/** Method options properly parsed into
|
|
731
|
-
parsedOptions?: { [k: string]: any }
|
|
699
|
+
/** Method options properly parsed into an object */
|
|
700
|
+
parsedOptions?: { [k: string]: any };
|
|
732
701
|
}
|
|
733
702
|
|
|
734
703
|
/** Reflected namespace. */
|
|
@@ -749,7 +718,7 @@ export class Namespace extends NamespaceBase {
|
|
|
749
718
|
* @returns Created namespace
|
|
750
719
|
* @throws {TypeError} If arguments are invalid
|
|
751
720
|
*/
|
|
752
|
-
static fromJSON(name: string, json: { [k: string]: any }, depth?: number): Namespace;
|
|
721
|
+
public static fromJSON(name: string, json: { [k: string]: any }, depth?: number): Namespace;
|
|
753
722
|
|
|
754
723
|
/**
|
|
755
724
|
* Converts an array of reflection objects to JSON.
|
|
@@ -757,7 +726,7 @@ export class Namespace extends NamespaceBase {
|
|
|
757
726
|
* @param [toJSONOptions] JSON conversion options
|
|
758
727
|
* @returns JSON object or `undefined` when array is empty
|
|
759
728
|
*/
|
|
760
|
-
static arrayToJSON(array: ReflectionObject[], toJSONOptions?: IToJSONOptions): ({ [k: string]: any }|undefined);
|
|
729
|
+
public static arrayToJSON(array: ReflectionObject[], toJSONOptions?: IToJSONOptions): ({ [k: string]: any }|undefined);
|
|
761
730
|
|
|
762
731
|
/**
|
|
763
732
|
* Tests if the specified id is reserved.
|
|
@@ -765,7 +734,7 @@ export class Namespace extends NamespaceBase {
|
|
|
765
734
|
* @param id Id to test
|
|
766
735
|
* @returns `true` if reserved, otherwise `false`
|
|
767
736
|
*/
|
|
768
|
-
static isReservedId(reserved: ((number[]|string)[]|undefined), id: number): boolean;
|
|
737
|
+
public static isReservedId(reserved: ((number[]|string)[]|undefined), id: number): boolean;
|
|
769
738
|
|
|
770
739
|
/**
|
|
771
740
|
* Tests if the specified name is reserved.
|
|
@@ -773,14 +742,14 @@ export class Namespace extends NamespaceBase {
|
|
|
773
742
|
* @param name Name to test
|
|
774
743
|
* @returns `true` if reserved, otherwise `false`
|
|
775
744
|
*/
|
|
776
|
-
static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean;
|
|
745
|
+
public static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean;
|
|
777
746
|
}
|
|
778
747
|
|
|
779
748
|
/** Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. */
|
|
780
749
|
export abstract class NamespaceBase extends ReflectionObject {
|
|
781
750
|
|
|
782
751
|
/** Nested objects by name. */
|
|
783
|
-
nested?: { [k: string]: ReflectionObject };
|
|
752
|
+
public nested?: { [k: string]: ReflectionObject };
|
|
784
753
|
|
|
785
754
|
/** Whether or not objects contained in this namespace need feature resolution. */
|
|
786
755
|
protected _needsRecursiveFeatureResolution: boolean;
|
|
@@ -789,14 +758,14 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
789
758
|
protected _needsRecursiveResolve: boolean;
|
|
790
759
|
|
|
791
760
|
/** Nested objects of this namespace as an array for iteration. */
|
|
792
|
-
readonly nestedArray: ReflectionObject[];
|
|
761
|
+
public readonly nestedArray: ReflectionObject[];
|
|
793
762
|
|
|
794
763
|
/**
|
|
795
764
|
* Converts this namespace to a namespace descriptor.
|
|
796
765
|
* @param [toJSONOptions] JSON conversion options
|
|
797
766
|
* @returns Namespace descriptor
|
|
798
767
|
*/
|
|
799
|
-
toJSON(toJSONOptions?: IToJSONOptions): INamespace;
|
|
768
|
+
public toJSON(toJSONOptions?: IToJSONOptions): INamespace;
|
|
800
769
|
|
|
801
770
|
/**
|
|
802
771
|
* Adds nested objects to this namespace from nested object descriptors.
|
|
@@ -804,14 +773,14 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
804
773
|
* @param [depth] Current nesting depth, defaults to `0`
|
|
805
774
|
* @returns `this`
|
|
806
775
|
*/
|
|
807
|
-
addJSON(nestedJson: { [k: string]: AnyNestedObject }, depth?: number): Namespace;
|
|
776
|
+
public addJSON(nestedJson: { [k: string]: AnyNestedObject }, depth?: number): Namespace;
|
|
808
777
|
|
|
809
778
|
/**
|
|
810
779
|
* Gets the nested object of the specified name.
|
|
811
780
|
* @param name Nested object name
|
|
812
781
|
* @returns The reflection object or `null` if it doesn't exist
|
|
813
782
|
*/
|
|
814
|
-
get(name: string): (ReflectionObject|null);
|
|
783
|
+
public get(name: string): (ReflectionObject|null);
|
|
815
784
|
|
|
816
785
|
/**
|
|
817
786
|
* Gets the values of the nested {@link Enum|enum} of the specified name.
|
|
@@ -820,7 +789,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
820
789
|
* @returns Enum values
|
|
821
790
|
* @throws {Error} If there is no such enum
|
|
822
791
|
*/
|
|
823
|
-
getEnum(name: string): { [k: string]: number };
|
|
792
|
+
public getEnum(name: string): { [k: string]: number };
|
|
824
793
|
|
|
825
794
|
/**
|
|
826
795
|
* Adds a nested object to this namespace.
|
|
@@ -829,7 +798,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
829
798
|
* @throws {TypeError} If arguments are invalid
|
|
830
799
|
* @throws {Error} If there is already a nested object with this name
|
|
831
800
|
*/
|
|
832
|
-
add(object: ReflectionObject): Namespace;
|
|
801
|
+
public add(object: ReflectionObject): Namespace;
|
|
833
802
|
|
|
834
803
|
/**
|
|
835
804
|
* Removes a nested object from this namespace.
|
|
@@ -838,7 +807,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
838
807
|
* @throws {TypeError} If arguments are invalid
|
|
839
808
|
* @throws {Error} If `object` is not a member of this namespace
|
|
840
809
|
*/
|
|
841
|
-
remove(object: ReflectionObject): Namespace;
|
|
810
|
+
public remove(object: ReflectionObject): Namespace;
|
|
842
811
|
|
|
843
812
|
/**
|
|
844
813
|
* Defines additial namespaces within this one if not yet existing.
|
|
@@ -846,13 +815,13 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
846
815
|
* @param [json] Nested types to create from JSON
|
|
847
816
|
* @returns Pointer to the last namespace created or `this` if path is empty
|
|
848
817
|
*/
|
|
849
|
-
define(path: (string|string[]), json?: any): Namespace;
|
|
818
|
+
public define(path: (string|string[]), json?: any): Namespace;
|
|
850
819
|
|
|
851
820
|
/**
|
|
852
821
|
* Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.
|
|
853
822
|
* @returns `this`
|
|
854
823
|
*/
|
|
855
|
-
resolveAll(): Namespace;
|
|
824
|
+
public resolveAll(): Namespace;
|
|
856
825
|
|
|
857
826
|
/**
|
|
858
827
|
* Recursively looks up the reflection object matching the specified path in the scope of this namespace.
|
|
@@ -861,7 +830,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
861
830
|
* @param [parentAlreadyChecked=false] If known, whether the parent has already been checked
|
|
862
831
|
* @returns Looked up object or `null` if none could be found
|
|
863
832
|
*/
|
|
864
|
-
lookup(path: (string|string[]), filterTypes: (any|any[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
|
|
833
|
+
public lookup(path: (string|string[]), filterTypes: (any|any[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
|
|
865
834
|
|
|
866
835
|
/**
|
|
867
836
|
* Looks up the reflection object at the specified path, relative to this namespace.
|
|
@@ -869,7 +838,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
869
838
|
* @param [parentAlreadyChecked=false] Whether the parent has already been checked
|
|
870
839
|
* @returns Looked up object or `null` if none could be found
|
|
871
840
|
*/
|
|
872
|
-
lookup(path: (string|string[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
|
|
841
|
+
public lookup(path: (string|string[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
|
|
873
842
|
|
|
874
843
|
/**
|
|
875
844
|
* Looks up the {@link Type|type} at the specified path, relative to this namespace.
|
|
@@ -878,7 +847,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
878
847
|
* @returns Looked up type
|
|
879
848
|
* @throws {Error} If `path` does not point to a type
|
|
880
849
|
*/
|
|
881
|
-
lookupType(path: (string|string[])): Type;
|
|
850
|
+
public lookupType(path: (string|string[])): Type;
|
|
882
851
|
|
|
883
852
|
/**
|
|
884
853
|
* Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.
|
|
@@ -887,7 +856,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
887
856
|
* @returns Looked up enum
|
|
888
857
|
* @throws {Error} If `path` does not point to an enum
|
|
889
858
|
*/
|
|
890
|
-
lookupEnum(path: (string|string[])): Enum;
|
|
859
|
+
public lookupEnum(path: (string|string[])): Enum;
|
|
891
860
|
|
|
892
861
|
/**
|
|
893
862
|
* Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.
|
|
@@ -896,7 +865,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
896
865
|
* @returns Looked up type or enum
|
|
897
866
|
* @throws {Error} If `path` does not point to a type or enum
|
|
898
867
|
*/
|
|
899
|
-
lookupTypeOrEnum(path: (string|string[])): Type;
|
|
868
|
+
public lookupTypeOrEnum(path: (string|string[])): Type;
|
|
900
869
|
|
|
901
870
|
/**
|
|
902
871
|
* Looks up the {@link Service|service} at the specified path, relative to this namespace.
|
|
@@ -905,7 +874,7 @@ export abstract class NamespaceBase extends ReflectionObject {
|
|
|
905
874
|
* @returns Looked up service
|
|
906
875
|
* @throws {Error} If `path` does not point to a service
|
|
907
876
|
*/
|
|
908
|
-
lookupService(path: (string|string[])): Service;
|
|
877
|
+
public lookupService(path: (string|string[])): Service;
|
|
909
878
|
}
|
|
910
879
|
|
|
911
880
|
/** Namespace descriptor. */
|
|
@@ -919,77 +888,77 @@ export interface INamespace {
|
|
|
919
888
|
}
|
|
920
889
|
|
|
921
890
|
/** Any extension field descriptor. */
|
|
922
|
-
|
|
891
|
+
type AnyExtensionField = (IExtensionField|IExtensionMapField);
|
|
923
892
|
|
|
924
893
|
/** Any nested object descriptor. */
|
|
925
|
-
|
|
894
|
+
type AnyNestedObject = (IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf);
|
|
926
895
|
|
|
927
896
|
/** Base class of all reflection objects. */
|
|
928
897
|
export abstract class ReflectionObject {
|
|
929
898
|
|
|
930
899
|
/** Options. */
|
|
931
|
-
options?: { [k: string]: any };
|
|
900
|
+
public options?: { [k: string]: any };
|
|
932
901
|
|
|
933
902
|
/** Parsed Options. */
|
|
934
|
-
parsedOptions?: { [k: string]: any }
|
|
903
|
+
public parsedOptions?: { [k: string]: any[] };
|
|
935
904
|
|
|
936
905
|
/** Unique name within its namespace. */
|
|
937
|
-
name: string;
|
|
906
|
+
public name: string;
|
|
938
907
|
|
|
939
908
|
/** Parent namespace. */
|
|
940
|
-
parent: (Namespace|null);
|
|
909
|
+
public parent: (Namespace|null);
|
|
941
910
|
|
|
942
911
|
/** Whether already resolved or not. */
|
|
943
|
-
resolved: boolean;
|
|
912
|
+
public resolved: boolean;
|
|
944
913
|
|
|
945
914
|
/** Comment text, if any. */
|
|
946
|
-
comment: (string|null);
|
|
915
|
+
public comment: (string|null);
|
|
947
916
|
|
|
948
917
|
/** Defining file name. */
|
|
949
|
-
filename: (string|null);
|
|
918
|
+
public filename: (string|null);
|
|
950
919
|
|
|
951
920
|
/** Reference to the root namespace. */
|
|
952
|
-
readonly root: Root;
|
|
921
|
+
public readonly root: Root;
|
|
953
922
|
|
|
954
923
|
/** Full name including leading dot. */
|
|
955
|
-
readonly fullName: string;
|
|
924
|
+
public readonly fullName: string;
|
|
956
925
|
|
|
957
926
|
/**
|
|
958
927
|
* Converts this reflection object to its descriptor representation.
|
|
959
928
|
* @returns Descriptor
|
|
960
929
|
*/
|
|
961
|
-
toJSON(): { [k: string]: any };
|
|
930
|
+
public toJSON(): { [k: string]: any };
|
|
962
931
|
|
|
963
932
|
/**
|
|
964
933
|
* Called when this object is added to a parent.
|
|
965
934
|
* @param parent Parent added to
|
|
966
935
|
*/
|
|
967
|
-
onAdd(parent: ReflectionObject): void;
|
|
936
|
+
public onAdd(parent: ReflectionObject): void;
|
|
968
937
|
|
|
969
938
|
/**
|
|
970
939
|
* Called when this object is removed from a parent.
|
|
971
940
|
* @param parent Parent removed from
|
|
972
941
|
*/
|
|
973
|
-
onRemove(parent: ReflectionObject): void;
|
|
942
|
+
public onRemove(parent: ReflectionObject): void;
|
|
974
943
|
|
|
975
944
|
/**
|
|
976
945
|
* Resolves this objects type references.
|
|
977
946
|
* @returns `this`
|
|
978
947
|
*/
|
|
979
|
-
resolve(): ReflectionObject;
|
|
948
|
+
public resolve(): ReflectionObject;
|
|
980
949
|
|
|
981
950
|
/**
|
|
982
951
|
* Resolves this objects editions features.
|
|
983
952
|
* @param edition The edition we're currently resolving for.
|
|
984
953
|
* @returns `this`
|
|
985
954
|
*/
|
|
986
|
-
_resolveFeaturesRecursive(edition: string): ReflectionObject;
|
|
955
|
+
public _resolveFeaturesRecursive(edition: string): ReflectionObject;
|
|
987
956
|
|
|
988
957
|
/**
|
|
989
958
|
* Resolves child features from parent features
|
|
990
959
|
* @param edition The edition we're currently resolving for.
|
|
991
960
|
*/
|
|
992
|
-
_resolveFeatures(edition: string): void;
|
|
961
|
+
public _resolveFeatures(edition: string): void;
|
|
993
962
|
|
|
994
963
|
/**
|
|
995
964
|
* Infers features from legacy syntax that may have been specified differently.
|
|
@@ -997,14 +966,14 @@ export abstract class ReflectionObject {
|
|
|
997
966
|
* @param edition The edition this proto is on, or undefined if pre-editions
|
|
998
967
|
* @returns The feature values to override
|
|
999
968
|
*/
|
|
1000
|
-
_inferLegacyProtoFeatures(edition: (string|undefined)): object;
|
|
969
|
+
public _inferLegacyProtoFeatures(edition: (string|undefined)): object;
|
|
1001
970
|
|
|
1002
971
|
/**
|
|
1003
972
|
* Gets an option value.
|
|
1004
973
|
* @param name Option name
|
|
1005
974
|
* @returns Option value or `undefined` if not set
|
|
1006
975
|
*/
|
|
1007
|
-
getOption(name: string): any;
|
|
976
|
+
public getOption(name: string): any;
|
|
1008
977
|
|
|
1009
978
|
/**
|
|
1010
979
|
* Sets an option.
|
|
@@ -1013,7 +982,7 @@ export abstract class ReflectionObject {
|
|
|
1013
982
|
* @param [ifNotSet] Sets the option only if it isn't currently set
|
|
1014
983
|
* @returns `this`
|
|
1015
984
|
*/
|
|
1016
|
-
setOption(name: string, value: any, ifNotSet?: (boolean|undefined)): ReflectionObject;
|
|
985
|
+
public setOption(name: string, value: any, ifNotSet?: (boolean|undefined)): ReflectionObject;
|
|
1017
986
|
|
|
1018
987
|
/**
|
|
1019
988
|
* Sets a parsed option.
|
|
@@ -1022,7 +991,7 @@ export abstract class ReflectionObject {
|
|
|
1022
991
|
* @param propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value
|
|
1023
992
|
* @returns `this`
|
|
1024
993
|
*/
|
|
1025
|
-
setParsedOption(name: string, value: any, propName: string): ReflectionObject;
|
|
994
|
+
public setParsedOption(name: string, value: any, propName: string): ReflectionObject;
|
|
1026
995
|
|
|
1027
996
|
/**
|
|
1028
997
|
* Sets multiple options.
|
|
@@ -1030,19 +999,19 @@ export abstract class ReflectionObject {
|
|
|
1030
999
|
* @param [ifNotSet] Sets an option only if it isn't currently set
|
|
1031
1000
|
* @returns `this`
|
|
1032
1001
|
*/
|
|
1033
|
-
setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject;
|
|
1002
|
+
public setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject;
|
|
1034
1003
|
|
|
1035
1004
|
/**
|
|
1036
1005
|
* Converts this instance to its string representation.
|
|
1037
1006
|
* @returns Class name[, space, full name]
|
|
1038
1007
|
*/
|
|
1039
|
-
toString(): string;
|
|
1008
|
+
public toString(): string;
|
|
1040
1009
|
|
|
1041
1010
|
/**
|
|
1042
1011
|
* Converts the edition this object is pinned to for JSON format.
|
|
1043
1012
|
* @returns The edition string for JSON representation
|
|
1044
1013
|
*/
|
|
1045
|
-
_editionToJSON(): (string|undefined);
|
|
1014
|
+
public _editionToJSON(): (string|undefined);
|
|
1046
1015
|
}
|
|
1047
1016
|
|
|
1048
1017
|
/** Reflected oneof. */
|
|
@@ -1058,13 +1027,13 @@ export class OneOf extends ReflectionObject {
|
|
|
1058
1027
|
constructor(name: string, fieldNames?: (string[]|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string);
|
|
1059
1028
|
|
|
1060
1029
|
/** Field names that belong to this oneof. */
|
|
1061
|
-
oneof: string[];
|
|
1030
|
+
public oneof: string[];
|
|
1062
1031
|
|
|
1063
1032
|
/** Fields that belong to this oneof as an array for iteration. */
|
|
1064
|
-
readonly fieldsArray: Field[];
|
|
1033
|
+
public readonly fieldsArray: Field[];
|
|
1065
1034
|
|
|
1066
1035
|
/** Comment for this field. */
|
|
1067
|
-
comment: (string|null);
|
|
1036
|
+
public comment: (string|null);
|
|
1068
1037
|
|
|
1069
1038
|
/**
|
|
1070
1039
|
* Constructs a oneof from a oneof descriptor.
|
|
@@ -1073,43 +1042,42 @@ export class OneOf extends ReflectionObject {
|
|
|
1073
1042
|
* @returns Created oneof
|
|
1074
1043
|
* @throws {TypeError} If arguments are invalid
|
|
1075
1044
|
*/
|
|
1076
|
-
static fromJSON(name: string, json: IOneOf): OneOf;
|
|
1045
|
+
public static fromJSON(name: string, json: IOneOf): OneOf;
|
|
1077
1046
|
|
|
1078
1047
|
/**
|
|
1079
1048
|
* Converts this oneof to a oneof descriptor.
|
|
1080
1049
|
* @param [toJSONOptions] JSON conversion options
|
|
1081
1050
|
* @returns Oneof descriptor
|
|
1082
1051
|
*/
|
|
1083
|
-
toJSON(toJSONOptions?: IToJSONOptions): IOneOf;
|
|
1052
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IOneOf;
|
|
1084
1053
|
|
|
1085
1054
|
/**
|
|
1086
1055
|
* Adds a field to this oneof and removes it from its current parent, if any.
|
|
1087
1056
|
* @param field Field to add
|
|
1088
1057
|
* @returns `this`
|
|
1089
1058
|
*/
|
|
1090
|
-
add(field: Field): OneOf;
|
|
1059
|
+
public add(field: Field): OneOf;
|
|
1091
1060
|
|
|
1092
1061
|
/**
|
|
1093
1062
|
* Removes a field from this oneof and puts it back to the oneof's parent.
|
|
1094
1063
|
* @param field Field to remove
|
|
1095
1064
|
* @returns `this`
|
|
1096
1065
|
*/
|
|
1097
|
-
remove(field: Field): OneOf;
|
|
1066
|
+
public remove(field: Field): OneOf;
|
|
1098
1067
|
|
|
1099
1068
|
/**
|
|
1100
1069
|
* Determines whether this field corresponds to a synthetic oneof created for
|
|
1101
1070
|
* a proto3 optional field. No behavioral logic should depend on this, but it
|
|
1102
1071
|
* can be relevant for reflection.
|
|
1103
1072
|
*/
|
|
1104
|
-
readonly isProto3Optional: boolean;
|
|
1073
|
+
public readonly isProto3Optional: boolean;
|
|
1105
1074
|
|
|
1106
1075
|
/**
|
|
1107
1076
|
* OneOf decorator (TypeScript).
|
|
1108
1077
|
* @param fieldNames Field names
|
|
1109
1078
|
* @returns Decorator function
|
|
1110
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
1111
1079
|
*/
|
|
1112
|
-
static d<T extends string>(...fieldNames: string[]): OneOfDecorator;
|
|
1080
|
+
public static d<T extends string>(...fieldNames: string[]): OneOfDecorator;
|
|
1113
1081
|
}
|
|
1114
1082
|
|
|
1115
1083
|
/** Oneof descriptor. */
|
|
@@ -1120,18 +1088,14 @@ export interface IOneOf {
|
|
|
1120
1088
|
|
|
1121
1089
|
/** Oneof options */
|
|
1122
1090
|
options?: { [k: string]: any };
|
|
1123
|
-
|
|
1124
|
-
/** Oneof comment */
|
|
1125
|
-
comment?: (string|null);
|
|
1126
1091
|
}
|
|
1127
1092
|
|
|
1128
1093
|
/**
|
|
1129
1094
|
* Decorator function as returned by {@link OneOf.d} (TypeScript).
|
|
1130
1095
|
* @param prototype Target prototype
|
|
1131
1096
|
* @param oneofName OneOf name
|
|
1132
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
1133
1097
|
*/
|
|
1134
|
-
|
|
1098
|
+
type OneOfDecorator = (prototype: object, oneofName: string) => void;
|
|
1135
1099
|
|
|
1136
1100
|
/**
|
|
1137
1101
|
* Parses the given .proto source and returns an object with the parsed contents.
|
|
@@ -1196,13 +1160,13 @@ export class Reader {
|
|
|
1196
1160
|
constructor(buffer: Uint8Array);
|
|
1197
1161
|
|
|
1198
1162
|
/** Read buffer. */
|
|
1199
|
-
buf: Uint8Array;
|
|
1163
|
+
public buf: Uint8Array;
|
|
1200
1164
|
|
|
1201
1165
|
/** Read buffer position. */
|
|
1202
|
-
pos: number;
|
|
1166
|
+
public pos: number;
|
|
1203
1167
|
|
|
1204
1168
|
/** Read buffer length. */
|
|
1205
|
-
len: number;
|
|
1169
|
+
public len: number;
|
|
1206
1170
|
|
|
1207
1171
|
/**
|
|
1208
1172
|
* Creates a new reader using the specified buffer.
|
|
@@ -1210,130 +1174,115 @@ export class Reader {
|
|
|
1210
1174
|
* @returns A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}
|
|
1211
1175
|
* @throws {Error} If `buffer` is not a valid buffer
|
|
1212
1176
|
*/
|
|
1213
|
-
static create(buffer: (Uint8Array|Buffer)): (Reader|BufferReader);
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* Returns raw bytes from the backing buffer without advancing the reader.
|
|
1217
|
-
* @param start Start offset
|
|
1218
|
-
* @param end End offset
|
|
1219
|
-
* @returns Raw bytes
|
|
1220
|
-
*/
|
|
1221
|
-
raw(start: number, end: number): Uint8Array;
|
|
1177
|
+
public static create(buffer: (Uint8Array|Buffer)): (Reader|BufferReader);
|
|
1222
1178
|
|
|
1223
1179
|
/**
|
|
1224
1180
|
* Reads a varint as an unsigned 32 bit value.
|
|
1225
1181
|
* @returns Value read
|
|
1226
1182
|
*/
|
|
1227
|
-
uint32(): number;
|
|
1228
|
-
|
|
1229
|
-
/**
|
|
1230
|
-
* Reads a field tag.
|
|
1231
|
-
* @returns Tag read
|
|
1232
|
-
*/
|
|
1233
|
-
tag(): number;
|
|
1183
|
+
public uint32(): number;
|
|
1234
1184
|
|
|
1235
1185
|
/**
|
|
1236
1186
|
* Reads a varint as a signed 32 bit value.
|
|
1237
1187
|
* @returns Value read
|
|
1238
1188
|
*/
|
|
1239
|
-
int32(): number;
|
|
1189
|
+
public int32(): number;
|
|
1240
1190
|
|
|
1241
1191
|
/**
|
|
1242
1192
|
* Reads a zig-zag encoded varint as a signed 32 bit value.
|
|
1243
1193
|
* @returns Value read
|
|
1244
1194
|
*/
|
|
1245
|
-
sint32(): number;
|
|
1195
|
+
public sint32(): number;
|
|
1246
1196
|
|
|
1247
1197
|
/**
|
|
1248
1198
|
* Reads a varint as a signed 64 bit value.
|
|
1249
1199
|
* @returns Value read
|
|
1250
1200
|
*/
|
|
1251
|
-
int64(): Long;
|
|
1201
|
+
public int64(): Long;
|
|
1252
1202
|
|
|
1253
1203
|
/**
|
|
1254
1204
|
* Reads a varint as an unsigned 64 bit value.
|
|
1255
1205
|
* @returns Value read
|
|
1256
1206
|
*/
|
|
1257
|
-
uint64(): Long;
|
|
1207
|
+
public uint64(): Long;
|
|
1258
1208
|
|
|
1259
1209
|
/**
|
|
1260
1210
|
* Reads a zig-zag encoded varint as a signed 64 bit value.
|
|
1261
1211
|
* @returns Value read
|
|
1262
1212
|
*/
|
|
1263
|
-
sint64(): Long;
|
|
1213
|
+
public sint64(): Long;
|
|
1264
1214
|
|
|
1265
1215
|
/**
|
|
1266
1216
|
* Reads a varint as a boolean.
|
|
1267
1217
|
* @returns Value read
|
|
1268
1218
|
*/
|
|
1269
|
-
bool(): boolean;
|
|
1219
|
+
public bool(): boolean;
|
|
1270
1220
|
|
|
1271
1221
|
/**
|
|
1272
1222
|
* Reads fixed 32 bits as an unsigned 32 bit integer.
|
|
1273
1223
|
* @returns Value read
|
|
1274
1224
|
*/
|
|
1275
|
-
fixed32(): number;
|
|
1225
|
+
public fixed32(): number;
|
|
1276
1226
|
|
|
1277
1227
|
/**
|
|
1278
1228
|
* Reads fixed 32 bits as a signed 32 bit integer.
|
|
1279
1229
|
* @returns Value read
|
|
1280
1230
|
*/
|
|
1281
|
-
sfixed32(): number;
|
|
1231
|
+
public sfixed32(): number;
|
|
1282
1232
|
|
|
1283
1233
|
/**
|
|
1284
1234
|
* Reads fixed 64 bits.
|
|
1285
1235
|
* @returns Value read
|
|
1286
1236
|
*/
|
|
1287
|
-
fixed64(): Long;
|
|
1237
|
+
public fixed64(): Long;
|
|
1288
1238
|
|
|
1289
1239
|
/**
|
|
1290
1240
|
* Reads zig-zag encoded fixed 64 bits.
|
|
1291
1241
|
* @returns Value read
|
|
1292
1242
|
*/
|
|
1293
|
-
sfixed64(): Long;
|
|
1243
|
+
public sfixed64(): Long;
|
|
1294
1244
|
|
|
1295
1245
|
/**
|
|
1296
1246
|
* Reads a float (32 bit) as a number.
|
|
1297
1247
|
* @returns Value read
|
|
1298
1248
|
*/
|
|
1299
|
-
float(): number;
|
|
1249
|
+
public float(): number;
|
|
1300
1250
|
|
|
1301
1251
|
/**
|
|
1302
1252
|
* Reads a double (64 bit float) as a number.
|
|
1303
1253
|
* @returns Value read
|
|
1304
1254
|
*/
|
|
1305
|
-
double(): number;
|
|
1255
|
+
public double(): number;
|
|
1306
1256
|
|
|
1307
1257
|
/**
|
|
1308
1258
|
* Reads a sequence of bytes preceeded by its length as a varint.
|
|
1309
1259
|
* @returns Value read
|
|
1310
1260
|
*/
|
|
1311
|
-
bytes(): Uint8Array;
|
|
1261
|
+
public bytes(): Uint8Array;
|
|
1312
1262
|
|
|
1313
1263
|
/**
|
|
1314
1264
|
* Reads a string preceeded by its byte length as a varint.
|
|
1315
1265
|
* @returns Value read
|
|
1316
1266
|
*/
|
|
1317
|
-
string(): string;
|
|
1267
|
+
public string(): string;
|
|
1318
1268
|
|
|
1319
1269
|
/**
|
|
1320
1270
|
* Skips the specified number of bytes if specified, otherwise skips a varint.
|
|
1321
1271
|
* @param [length] Length if known, otherwise a varint is assumed
|
|
1322
1272
|
* @returns `this`
|
|
1323
1273
|
*/
|
|
1324
|
-
skip(length?: number): Reader;
|
|
1274
|
+
public skip(length?: number): Reader;
|
|
1325
1275
|
|
|
1326
1276
|
/** Recursion limit. */
|
|
1327
|
-
static recursionLimit: number;
|
|
1277
|
+
public static recursionLimit: number;
|
|
1328
1278
|
|
|
1329
1279
|
/**
|
|
1330
1280
|
* Skips the next element of the specified wire type.
|
|
1331
1281
|
* @param wireType Wire type received
|
|
1332
1282
|
* @param [depth] Depth of recursion to control nested calls; 0 if omitted
|
|
1333
|
-
* @param [fieldNumber] Field number for validating group end tags
|
|
1334
1283
|
* @returns `this`
|
|
1335
1284
|
*/
|
|
1336
|
-
skipType(wireType: number, depth?: number
|
|
1285
|
+
public skipType(wireType: number, depth?: number): Reader;
|
|
1337
1286
|
}
|
|
1338
1287
|
|
|
1339
1288
|
/** Wire format reader using node buffers. */
|
|
@@ -1345,19 +1294,11 @@ export class BufferReader extends Reader {
|
|
|
1345
1294
|
*/
|
|
1346
1295
|
constructor(buffer: Buffer);
|
|
1347
1296
|
|
|
1348
|
-
/**
|
|
1349
|
-
* Returns raw bytes from the backing buffer without advancing the reader.
|
|
1350
|
-
* @param start Start offset
|
|
1351
|
-
* @param end End offset
|
|
1352
|
-
* @returns Raw bytes
|
|
1353
|
-
*/
|
|
1354
|
-
raw(start: number, end: number): Buffer;
|
|
1355
|
-
|
|
1356
1297
|
/**
|
|
1357
1298
|
* Reads a sequence of bytes preceeded by its length as a varint.
|
|
1358
1299
|
* @returns Value read
|
|
1359
1300
|
*/
|
|
1360
|
-
bytes(): Buffer;
|
|
1301
|
+
public bytes(): Buffer;
|
|
1361
1302
|
}
|
|
1362
1303
|
|
|
1363
1304
|
/** Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. */
|
|
@@ -1370,10 +1311,10 @@ export class Root extends NamespaceBase {
|
|
|
1370
1311
|
constructor(options?: { [k: string]: any });
|
|
1371
1312
|
|
|
1372
1313
|
/** Deferred extension fields. */
|
|
1373
|
-
deferred: Field[];
|
|
1314
|
+
public deferred: Field[];
|
|
1374
1315
|
|
|
1375
1316
|
/** Resolved file names of loaded files. */
|
|
1376
|
-
files: string[];
|
|
1317
|
+
public files: string[];
|
|
1377
1318
|
|
|
1378
1319
|
/**
|
|
1379
1320
|
* Loads a namespace descriptor into a root namespace.
|
|
@@ -1382,7 +1323,7 @@ export class Root extends NamespaceBase {
|
|
|
1382
1323
|
* @param [depth] Current nesting depth, defaults to `0`
|
|
1383
1324
|
* @returns Root namespace
|
|
1384
1325
|
*/
|
|
1385
|
-
static fromJSON(json: INamespace, root?: Root, depth?: number): Root;
|
|
1326
|
+
public static fromJSON(json: INamespace, root?: Root, depth?: number): Root;
|
|
1386
1327
|
|
|
1387
1328
|
/**
|
|
1388
1329
|
* Resolves the path of an imported file, relative to the importing origin.
|
|
@@ -1391,7 +1332,7 @@ export class Root extends NamespaceBase {
|
|
|
1391
1332
|
* @param target The file name being imported
|
|
1392
1333
|
* @returns Resolved path to `target` or `null` to skip the file
|
|
1393
1334
|
*/
|
|
1394
|
-
resolvePath(origin: string, target: string): (string|null);
|
|
1335
|
+
public resolvePath(origin: string, target: string): (string|null);
|
|
1395
1336
|
|
|
1396
1337
|
/**
|
|
1397
1338
|
* Fetch content from file path or url
|
|
@@ -1399,7 +1340,7 @@ export class Root extends NamespaceBase {
|
|
|
1399
1340
|
* @param path File path or url
|
|
1400
1341
|
* @param callback Callback function
|
|
1401
1342
|
*/
|
|
1402
|
-
fetch(path: string, callback: FetchCallback): void;
|
|
1343
|
+
public fetch(path: string, callback: FetchCallback): void;
|
|
1403
1344
|
|
|
1404
1345
|
/**
|
|
1405
1346
|
* Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.
|
|
@@ -1407,14 +1348,14 @@ export class Root extends NamespaceBase {
|
|
|
1407
1348
|
* @param options Parse options
|
|
1408
1349
|
* @param callback Callback function
|
|
1409
1350
|
*/
|
|
1410
|
-
load(filename: (string|string[]), options: IParseOptions, callback: LoadCallback): void;
|
|
1351
|
+
public load(filename: (string|string[]), options: IParseOptions, callback: LoadCallback): void;
|
|
1411
1352
|
|
|
1412
1353
|
/**
|
|
1413
1354
|
* Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.
|
|
1414
1355
|
* @param filename Names of one or multiple files to load
|
|
1415
1356
|
* @param callback Callback function
|
|
1416
1357
|
*/
|
|
1417
|
-
load(filename: (string|string[]), callback: LoadCallback): void;
|
|
1358
|
+
public load(filename: (string|string[]), callback: LoadCallback): void;
|
|
1418
1359
|
|
|
1419
1360
|
/**
|
|
1420
1361
|
* Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.
|
|
@@ -1422,7 +1363,7 @@ export class Root extends NamespaceBase {
|
|
|
1422
1363
|
* @param [options] Parse options. Defaults to {@link parse.defaults} when omitted.
|
|
1423
1364
|
* @returns Promise
|
|
1424
1365
|
*/
|
|
1425
|
-
load(filename: (string|string[]), options?: IParseOptions): Promise<Root>;
|
|
1366
|
+
public load(filename: (string|string[]), options?: IParseOptions): Promise<Root>;
|
|
1426
1367
|
|
|
1427
1368
|
/**
|
|
1428
1369
|
* Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).
|
|
@@ -1431,7 +1372,7 @@ export class Root extends NamespaceBase {
|
|
|
1431
1372
|
* @returns Root namespace
|
|
1432
1373
|
* @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid
|
|
1433
1374
|
*/
|
|
1434
|
-
loadSync(filename: (string|string[]), options?: IParseOptions): Root;
|
|
1375
|
+
public loadSync(filename: (string|string[]), options?: IParseOptions): Root;
|
|
1435
1376
|
}
|
|
1436
1377
|
|
|
1437
1378
|
/**
|
|
@@ -1473,13 +1414,13 @@ export namespace rpc {
|
|
|
1473
1414
|
constructor(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
|
|
1474
1415
|
|
|
1475
1416
|
/** RPC implementation. Becomes `null` once the service is ended. */
|
|
1476
|
-
rpcImpl: (RPCImpl|null);
|
|
1417
|
+
public rpcImpl: (RPCImpl|null);
|
|
1477
1418
|
|
|
1478
1419
|
/** Whether requests are length-delimited. */
|
|
1479
|
-
requestDelimited: boolean;
|
|
1420
|
+
public requestDelimited: boolean;
|
|
1480
1421
|
|
|
1481
1422
|
/** Whether responses are length-delimited. */
|
|
1482
|
-
responseDelimited: boolean;
|
|
1423
|
+
public responseDelimited: boolean;
|
|
1483
1424
|
|
|
1484
1425
|
/**
|
|
1485
1426
|
* Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.
|
|
@@ -1489,14 +1430,14 @@ export namespace rpc {
|
|
|
1489
1430
|
* @param request Request message or plain object
|
|
1490
1431
|
* @param callback Service callback
|
|
1491
1432
|
*/
|
|
1492
|
-
rpcCall<TReq extends Message<TReq>, TRes extends Message<TRes>>(method: (Method|rpc.ServiceMethod<TReq, TRes>), requestCtor: Constructor<TReq>, responseCtor: Constructor<TRes>, request: (TReq|Properties<TReq>), callback: rpc.ServiceMethodCallback<TRes>): void;
|
|
1433
|
+
public rpcCall<TReq extends Message<TReq>, TRes extends Message<TRes>>(method: (Method|rpc.ServiceMethod<TReq, TRes>), requestCtor: Constructor<TReq>, responseCtor: Constructor<TRes>, request: (TReq|Properties<TReq>), callback: rpc.ServiceMethodCallback<TRes>): void;
|
|
1493
1434
|
|
|
1494
1435
|
/**
|
|
1495
1436
|
* Ends this service and emits the `end` event.
|
|
1496
1437
|
* @param [endedByRPC=false] Whether the service has been ended by the RPC implementation.
|
|
1497
1438
|
* @returns `this`
|
|
1498
1439
|
*/
|
|
1499
|
-
end(endedByRPC?: boolean): rpc.Service;
|
|
1440
|
+
public end(endedByRPC?: boolean): rpc.Service;
|
|
1500
1441
|
}
|
|
1501
1442
|
}
|
|
1502
1443
|
|
|
@@ -1506,14 +1447,14 @@ export namespace rpc {
|
|
|
1506
1447
|
* @param requestData Request data
|
|
1507
1448
|
* @param callback Callback function
|
|
1508
1449
|
*/
|
|
1509
|
-
|
|
1450
|
+
type RPCImpl = (method: (Method|rpc.ServiceMethod<Message<{}>, Message<{}>>), requestData: Uint8Array, callback: RPCImplCallback) => void;
|
|
1510
1451
|
|
|
1511
1452
|
/**
|
|
1512
1453
|
* Node-style callback as used by {@link RPCImpl}.
|
|
1513
1454
|
* @param error Error, if any, otherwise `null`
|
|
1514
1455
|
* @param [response] Response data or `null` to signal end of stream, if there hasn't been an error
|
|
1515
1456
|
*/
|
|
1516
|
-
|
|
1457
|
+
type RPCImplCallback = (error: (Error|null), response?: (Uint8Array|null)) => void;
|
|
1517
1458
|
|
|
1518
1459
|
/** Reflected service. */
|
|
1519
1460
|
export class Service extends NamespaceBase {
|
|
@@ -1527,7 +1468,7 @@ export class Service extends NamespaceBase {
|
|
|
1527
1468
|
constructor(name: string, options?: { [k: string]: any });
|
|
1528
1469
|
|
|
1529
1470
|
/** Service methods. */
|
|
1530
|
-
methods: { [k: string]: Method };
|
|
1471
|
+
public methods: { [k: string]: Method };
|
|
1531
1472
|
|
|
1532
1473
|
/**
|
|
1533
1474
|
* Constructs a service from a service descriptor.
|
|
@@ -1537,17 +1478,17 @@ export class Service extends NamespaceBase {
|
|
|
1537
1478
|
* @returns Created service
|
|
1538
1479
|
* @throws {TypeError} If arguments are invalid
|
|
1539
1480
|
*/
|
|
1540
|
-
static fromJSON(name: string, json: IService, depth?: number): Service;
|
|
1481
|
+
public static fromJSON(name: string, json: IService, depth?: number): Service;
|
|
1541
1482
|
|
|
1542
1483
|
/**
|
|
1543
1484
|
* Converts this service to a service descriptor.
|
|
1544
1485
|
* @param [toJSONOptions] JSON conversion options
|
|
1545
1486
|
* @returns Service descriptor
|
|
1546
1487
|
*/
|
|
1547
|
-
toJSON(toJSONOptions?: IToJSONOptions): IService;
|
|
1488
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IService;
|
|
1548
1489
|
|
|
1549
1490
|
/** Methods of this service as an array for iteration. */
|
|
1550
|
-
readonly methodsArray: Method[];
|
|
1491
|
+
public readonly methodsArray: Method[];
|
|
1551
1492
|
|
|
1552
1493
|
/**
|
|
1553
1494
|
* Creates a runtime service using the specified rpc implementation.
|
|
@@ -1556,39 +1497,33 @@ export class Service extends NamespaceBase {
|
|
|
1556
1497
|
* @param [responseDelimited=false] Whether responses are length-delimited
|
|
1557
1498
|
* @returns RPC service. Useful where requests and/or responses are streamed.
|
|
1558
1499
|
*/
|
|
1559
|
-
create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service;
|
|
1500
|
+
public create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service;
|
|
1560
1501
|
}
|
|
1561
1502
|
|
|
1562
1503
|
/** Service descriptor. */
|
|
1563
1504
|
export interface IService extends INamespace {
|
|
1564
1505
|
|
|
1565
|
-
/** Edition */
|
|
1566
|
-
edition?: string;
|
|
1567
|
-
|
|
1568
1506
|
/** Method descriptors */
|
|
1569
1507
|
methods: { [k: string]: IMethod };
|
|
1570
|
-
|
|
1571
|
-
/** Service comment */
|
|
1572
|
-
comment?: (string|null);
|
|
1573
1508
|
}
|
|
1574
1509
|
|
|
1575
1510
|
/**
|
|
1576
1511
|
* Gets the next token and advances.
|
|
1577
1512
|
* @returns Next token or `null` on eof
|
|
1578
1513
|
*/
|
|
1579
|
-
|
|
1514
|
+
type TokenizerHandleNext = () => (string|null);
|
|
1580
1515
|
|
|
1581
1516
|
/**
|
|
1582
1517
|
* Peeks for the next token.
|
|
1583
1518
|
* @returns Next token or `null` on eof
|
|
1584
1519
|
*/
|
|
1585
|
-
|
|
1520
|
+
type TokenizerHandlePeek = () => (string|null);
|
|
1586
1521
|
|
|
1587
1522
|
/**
|
|
1588
1523
|
* Pushes a token back to the stack.
|
|
1589
1524
|
* @param token Token
|
|
1590
1525
|
*/
|
|
1591
|
-
|
|
1526
|
+
type TokenizerHandlePush = (token: string) => void;
|
|
1592
1527
|
|
|
1593
1528
|
/**
|
|
1594
1529
|
* Skips the next token.
|
|
@@ -1597,14 +1532,14 @@ export type TokenizerHandlePush = (token: string) => void;
|
|
|
1597
1532
|
* @returns Whether the token matched
|
|
1598
1533
|
* @throws {Error} If the token didn't match and is not optional
|
|
1599
1534
|
*/
|
|
1600
|
-
|
|
1535
|
+
type TokenizerHandleSkip = (expected: string, optional?: boolean) => boolean;
|
|
1601
1536
|
|
|
1602
1537
|
/**
|
|
1603
1538
|
* Gets the comment on the previous line or, alternatively, the line comment on the specified line.
|
|
1604
1539
|
* @param [line] Line number
|
|
1605
1540
|
* @returns Comment text or `null` if none
|
|
1606
1541
|
*/
|
|
1607
|
-
|
|
1542
|
+
type TokenizerHandleCmnt = (line?: number) => (string|null);
|
|
1608
1543
|
|
|
1609
1544
|
/** Handle object returned from {@link tokenize}. */
|
|
1610
1545
|
export interface ITokenizerHandle {
|
|
@@ -1657,38 +1592,38 @@ export class Type extends NamespaceBase {
|
|
|
1657
1592
|
constructor(name: string, options?: { [k: string]: any });
|
|
1658
1593
|
|
|
1659
1594
|
/** Message fields. */
|
|
1660
|
-
fields: { [k: string]: Field };
|
|
1595
|
+
public fields: { [k: string]: Field };
|
|
1661
1596
|
|
|
1662
1597
|
/** Oneofs declared within this namespace, if any. */
|
|
1663
|
-
oneofs: { [k: string]: OneOf };
|
|
1598
|
+
public oneofs: { [k: string]: OneOf };
|
|
1664
1599
|
|
|
1665
1600
|
/** Extension ranges, if any. */
|
|
1666
|
-
extensions: number[][];
|
|
1601
|
+
public extensions: number[][];
|
|
1667
1602
|
|
|
1668
1603
|
/** Reserved ranges, if any. */
|
|
1669
|
-
reserved: (number[]|string)[];
|
|
1604
|
+
public reserved: (number[]|string)[];
|
|
1670
1605
|
|
|
1671
1606
|
/** Message fields by id. */
|
|
1672
|
-
readonly fieldsById: { [k: number]: Field };
|
|
1607
|
+
public readonly fieldsById: { [k: number]: Field };
|
|
1673
1608
|
|
|
1674
1609
|
/** Fields of this message as an array for iteration. */
|
|
1675
|
-
readonly fieldsArray: Field[];
|
|
1610
|
+
public readonly fieldsArray: Field[];
|
|
1676
1611
|
|
|
1677
1612
|
/** Oneofs of this message as an array for iteration. */
|
|
1678
|
-
readonly oneofsArray: OneOf[];
|
|
1613
|
+
public readonly oneofsArray: OneOf[];
|
|
1679
1614
|
|
|
1680
1615
|
/**
|
|
1681
1616
|
* The registered constructor, if any registered, otherwise a generic constructor.
|
|
1682
1617
|
* 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.
|
|
1683
1618
|
*/
|
|
1684
|
-
ctor: Constructor<{}>;
|
|
1619
|
+
public ctor: Constructor<{}>;
|
|
1685
1620
|
|
|
1686
1621
|
/**
|
|
1687
1622
|
* Generates a constructor function for the specified type.
|
|
1688
1623
|
* @param mtype Message type
|
|
1689
1624
|
* @returns Codegen instance
|
|
1690
1625
|
*/
|
|
1691
|
-
static generateConstructor(mtype: Type): Codegen;
|
|
1626
|
+
public static generateConstructor(mtype: Type): Codegen;
|
|
1692
1627
|
|
|
1693
1628
|
/**
|
|
1694
1629
|
* Creates a message type from a message type descriptor.
|
|
@@ -1697,14 +1632,14 @@ export class Type extends NamespaceBase {
|
|
|
1697
1632
|
* @param [depth] Current nesting depth, defaults to `0`
|
|
1698
1633
|
* @returns Created message type
|
|
1699
1634
|
*/
|
|
1700
|
-
static fromJSON(name: string, json: IType, depth?: number): Type;
|
|
1635
|
+
public static fromJSON(name: string, json: IType, depth?: number): Type;
|
|
1701
1636
|
|
|
1702
1637
|
/**
|
|
1703
1638
|
* Converts this message type to a message type descriptor.
|
|
1704
1639
|
* @param [toJSONOptions] JSON conversion options
|
|
1705
1640
|
* @returns Message type descriptor
|
|
1706
1641
|
*/
|
|
1707
|
-
toJSON(toJSONOptions?: IToJSONOptions): IType;
|
|
1642
|
+
public toJSON(toJSONOptions?: IToJSONOptions): IType;
|
|
1708
1643
|
|
|
1709
1644
|
/**
|
|
1710
1645
|
* Adds a nested object to this type.
|
|
@@ -1713,7 +1648,7 @@ export class Type extends NamespaceBase {
|
|
|
1713
1648
|
* @throws {TypeError} If arguments are invalid
|
|
1714
1649
|
* @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id
|
|
1715
1650
|
*/
|
|
1716
|
-
add(object: ReflectionObject): Type;
|
|
1651
|
+
public add(object: ReflectionObject): Type;
|
|
1717
1652
|
|
|
1718
1653
|
/**
|
|
1719
1654
|
* Removes a nested object from this type.
|
|
@@ -1722,34 +1657,34 @@ export class Type extends NamespaceBase {
|
|
|
1722
1657
|
* @throws {TypeError} If arguments are invalid
|
|
1723
1658
|
* @throws {Error} If `object` is not a member of this type
|
|
1724
1659
|
*/
|
|
1725
|
-
remove(object: ReflectionObject): Type;
|
|
1660
|
+
public remove(object: ReflectionObject): Type;
|
|
1726
1661
|
|
|
1727
1662
|
/**
|
|
1728
1663
|
* Tests if the specified id is reserved.
|
|
1729
1664
|
* @param id Id to test
|
|
1730
1665
|
* @returns `true` if reserved, otherwise `false`
|
|
1731
1666
|
*/
|
|
1732
|
-
isReservedId(id: number): boolean;
|
|
1667
|
+
public isReservedId(id: number): boolean;
|
|
1733
1668
|
|
|
1734
1669
|
/**
|
|
1735
1670
|
* Tests if the specified name is reserved.
|
|
1736
1671
|
* @param name Name to test
|
|
1737
1672
|
* @returns `true` if reserved, otherwise `false`
|
|
1738
1673
|
*/
|
|
1739
|
-
isReservedName(name: string): boolean;
|
|
1674
|
+
public isReservedName(name: string): boolean;
|
|
1740
1675
|
|
|
1741
1676
|
/**
|
|
1742
1677
|
* Creates a new message of this type using the specified properties.
|
|
1743
1678
|
* @param [properties] Properties to set
|
|
1744
1679
|
* @returns Message instance
|
|
1745
1680
|
*/
|
|
1746
|
-
create(properties?: { [k: string]: any }):
|
|
1681
|
+
public create(properties?: { [k: string]: any }): Message<{}>;
|
|
1747
1682
|
|
|
1748
1683
|
/**
|
|
1749
1684
|
* Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.
|
|
1750
1685
|
* @returns `this`
|
|
1751
1686
|
*/
|
|
1752
|
-
setup(): Type;
|
|
1687
|
+
public setup(): Type;
|
|
1753
1688
|
|
|
1754
1689
|
/**
|
|
1755
1690
|
* Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.
|
|
@@ -1757,7 +1692,7 @@ export class Type extends NamespaceBase {
|
|
|
1757
1692
|
* @param [writer] Writer to encode to
|
|
1758
1693
|
* @returns writer
|
|
1759
1694
|
*/
|
|
1760
|
-
encode(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
|
|
1695
|
+
public encode(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
|
|
1761
1696
|
|
|
1762
1697
|
/**
|
|
1763
1698
|
* Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.
|
|
@@ -1765,17 +1700,19 @@ export class Type extends NamespaceBase {
|
|
|
1765
1700
|
* @param [writer] Writer to encode to
|
|
1766
1701
|
* @returns writer
|
|
1767
1702
|
*/
|
|
1768
|
-
encodeDelimited(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
|
|
1703
|
+
public encodeDelimited(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
|
|
1769
1704
|
|
|
1770
1705
|
/**
|
|
1771
1706
|
* Decodes a message of this type.
|
|
1772
1707
|
* @param reader Reader or buffer to decode from
|
|
1773
1708
|
* @param [length] Length of the message, if known beforehand
|
|
1709
|
+
* @param [end] Expected group end tag, if decoding a group
|
|
1710
|
+
* @param [depth] Current nesting depth
|
|
1774
1711
|
* @returns Decoded message
|
|
1775
1712
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1776
1713
|
* @throws {util.ProtocolError<{}>} If required fields are missing
|
|
1777
1714
|
*/
|
|
1778
|
-
decode(reader: (Reader|Uint8Array), length?: number):
|
|
1715
|
+
public decode(reader: (Reader|Uint8Array), length?: number, end?: number, depth?: number): Message<{}>;
|
|
1779
1716
|
|
|
1780
1717
|
/**
|
|
1781
1718
|
* Decodes a message of this type preceeded by its byte length as a varint.
|
|
@@ -1784,21 +1721,23 @@ export class Type extends NamespaceBase {
|
|
|
1784
1721
|
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1785
1722
|
* @throws {util.ProtocolError} If required fields are missing
|
|
1786
1723
|
*/
|
|
1787
|
-
decodeDelimited(reader: (Reader|Uint8Array)):
|
|
1724
|
+
public decodeDelimited(reader: (Reader|Uint8Array)): Message<{}>;
|
|
1788
1725
|
|
|
1789
1726
|
/**
|
|
1790
1727
|
* Verifies that field values are valid and that required fields are present.
|
|
1791
1728
|
* @param message Plain object to verify
|
|
1729
|
+
* @param [depth] Current nesting depth
|
|
1792
1730
|
* @returns `null` if valid, otherwise the reason why it is not
|
|
1793
1731
|
*/
|
|
1794
|
-
verify(message: { [k: string]: any }): (null|string);
|
|
1732
|
+
public verify(message: { [k: string]: any }, depth?: number): (null|string);
|
|
1795
1733
|
|
|
1796
1734
|
/**
|
|
1797
1735
|
* Creates a new message of this type from a plain object. Also converts values to their respective internal types.
|
|
1798
1736
|
* @param object Plain object to convert
|
|
1737
|
+
* @param [depth] Current nesting depth
|
|
1799
1738
|
* @returns Message instance
|
|
1800
1739
|
*/
|
|
1801
|
-
fromObject(object: { [k: string]: any }):
|
|
1740
|
+
public fromObject(object: { [k: string]: any }, depth?: number): Message<{}>;
|
|
1802
1741
|
|
|
1803
1742
|
/**
|
|
1804
1743
|
* Creates a plain object from a message of this type. Also converts values to other types if specified.
|
|
@@ -1806,30 +1745,19 @@ export class Type extends NamespaceBase {
|
|
|
1806
1745
|
* @param [options] Conversion options
|
|
1807
1746
|
* @returns Plain object
|
|
1808
1747
|
*/
|
|
1809
|
-
toObject(message: Message<{}>, options?: IConversionOptions): { [k: string]: any };
|
|
1810
|
-
|
|
1811
|
-
/**
|
|
1812
|
-
* Gets the type url for this type.
|
|
1813
|
-
* @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"`
|
|
1814
|
-
* @returns The type url
|
|
1815
|
-
*/
|
|
1816
|
-
getTypeUrl(prefix?: string): string;
|
|
1748
|
+
public toObject(message: Message<{}>, options?: IConversionOptions): { [k: string]: any };
|
|
1817
1749
|
|
|
1818
1750
|
/**
|
|
1819
1751
|
* Type decorator (TypeScript).
|
|
1820
1752
|
* @param [typeName] Type name, defaults to the constructor's name
|
|
1821
1753
|
* @returns Decorator function
|
|
1822
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
1823
1754
|
*/
|
|
1824
|
-
static d<T extends Message<T>>(typeName?: string): TypeDecorator<T>;
|
|
1755
|
+
public static d<T extends Message<T>>(typeName?: string): TypeDecorator<T>;
|
|
1825
1756
|
}
|
|
1826
1757
|
|
|
1827
1758
|
/** Message type descriptor. */
|
|
1828
1759
|
export interface IType extends INamespace {
|
|
1829
1760
|
|
|
1830
|
-
/** Edition */
|
|
1831
|
-
edition?: string;
|
|
1832
|
-
|
|
1833
1761
|
/** Oneof descriptors */
|
|
1834
1762
|
oneofs?: { [k: string]: IOneOf };
|
|
1835
1763
|
|
|
@@ -1844,9 +1772,6 @@ export interface IType extends INamespace {
|
|
|
1844
1772
|
|
|
1845
1773
|
/** Whether a legacy group or not */
|
|
1846
1774
|
group?: boolean;
|
|
1847
|
-
|
|
1848
|
-
/** Message type comment */
|
|
1849
|
-
comment?: (string|null);
|
|
1850
1775
|
}
|
|
1851
1776
|
|
|
1852
1777
|
/** Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. */
|
|
@@ -1892,9 +1817,8 @@ export interface IConversionOptions {
|
|
|
1892
1817
|
/**
|
|
1893
1818
|
* Decorator function as returned by {@link Type.d} (TypeScript).
|
|
1894
1819
|
* @param target Target constructor
|
|
1895
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
1896
1820
|
*/
|
|
1897
|
-
|
|
1821
|
+
type TypeDecorator<T extends Message<T>> = (target: Constructor<T>) => void;
|
|
1898
1822
|
|
|
1899
1823
|
/** Common type constants. */
|
|
1900
1824
|
export namespace types {
|
|
@@ -1982,52 +1906,12 @@ export namespace types {
|
|
|
1982
1906
|
}
|
|
1983
1907
|
|
|
1984
1908
|
/** Constructor type. */
|
|
1985
|
-
export
|
|
1909
|
+
export interface Constructor<T> extends Function {
|
|
1910
|
+
new(...params: any[]): T; prototype: T;
|
|
1911
|
+
}
|
|
1986
1912
|
|
|
1987
1913
|
/** Properties type. */
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
/** Dynamically reflected message type. */
|
|
1991
|
-
export type ReflectedMessage = Message<{}> & { [k: string]: any };
|
|
1992
|
-
|
|
1993
|
-
/**
|
|
1994
|
-
* Callback as used by {@link util.asPromise}.
|
|
1995
|
-
* @param error Error, if any
|
|
1996
|
-
* @param params Additional arguments
|
|
1997
|
-
*/
|
|
1998
|
-
export type asPromiseCallback = (error: (Error|null), ...params: any[]) => void;
|
|
1999
|
-
|
|
2000
|
-
/**
|
|
2001
|
-
* Appends code to the function's body or finishes generation.
|
|
2002
|
-
* @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
2003
|
-
* @param [formatParams] Format parameters
|
|
2004
|
-
* @returns Itself or the generated function if finished
|
|
2005
|
-
* @throws {Error} If format parameter counts do not match
|
|
2006
|
-
*/
|
|
2007
|
-
export type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
|
|
2008
|
-
|
|
2009
|
-
/**
|
|
2010
|
-
* Event listener as used by {@link util.EventEmitter}.
|
|
2011
|
-
* @param args Arguments
|
|
2012
|
-
*/
|
|
2013
|
-
export type EventEmitterListener = (...args: any[]) => void;
|
|
2014
|
-
|
|
2015
|
-
/**
|
|
2016
|
-
* Node-style callback as used by {@link util.fetch}.
|
|
2017
|
-
* @param error Error, if any, otherwise `null`
|
|
2018
|
-
* @param [contents] File contents, if there hasn't been an error
|
|
2019
|
-
*/
|
|
2020
|
-
export type FetchCallback = (error: Error, contents?: string) => void;
|
|
2021
|
-
|
|
2022
|
-
/** Options as used by {@link util.fetch}. */
|
|
2023
|
-
export interface IFetchOptions {
|
|
2024
|
-
|
|
2025
|
-
/** Whether expecting a binary response */
|
|
2026
|
-
binary?: boolean;
|
|
2027
|
-
|
|
2028
|
-
/** If `true`, forces the use of XMLHttpRequest */
|
|
2029
|
-
xhr?: boolean;
|
|
2030
|
-
}
|
|
1914
|
+
type Properties<T> = { [P in keyof T]?: T[P] };
|
|
2031
1915
|
|
|
2032
1916
|
/**
|
|
2033
1917
|
* Any compatible Buffer instance.
|
|
@@ -2056,344 +1940,131 @@ export interface Long {
|
|
|
2056
1940
|
* A OneOf getter as returned by {@link util.oneOfGetter}.
|
|
2057
1941
|
* @returns Set field name, if any
|
|
2058
1942
|
*/
|
|
2059
|
-
|
|
1943
|
+
type OneOfGetter = () => (string|undefined);
|
|
2060
1944
|
|
|
2061
1945
|
/**
|
|
2062
1946
|
* A OneOf setter as returned by {@link util.oneOfSetter}.
|
|
2063
1947
|
* @param value Field name
|
|
2064
1948
|
*/
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* An allocator as used by {@link util.pool}.
|
|
2069
|
-
* @param size Buffer size
|
|
2070
|
-
* @returns Buffer
|
|
2071
|
-
*/
|
|
2072
|
-
export type PoolAllocator = (size: number) => Uint8Array;
|
|
2073
|
-
|
|
2074
|
-
/**
|
|
2075
|
-
* A slicer as used by {@link util.pool}.
|
|
2076
|
-
* @param start Start offset
|
|
2077
|
-
* @param end End offset
|
|
2078
|
-
* @returns Buffer slice
|
|
2079
|
-
*/
|
|
2080
|
-
export type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
|
|
1949
|
+
type OneOfSetter = (value: (string|undefined)) => void;
|
|
2081
1950
|
|
|
2082
1951
|
/** Various utility functions. */
|
|
2083
1952
|
export namespace util {
|
|
2084
1953
|
|
|
2085
|
-
/**
|
|
2086
|
-
|
|
2087
|
-
* @param fn Function to call
|
|
2088
|
-
* @param ctx Function context
|
|
2089
|
-
* @param params Function arguments
|
|
2090
|
-
* @returns Promisified function
|
|
2091
|
-
*/
|
|
2092
|
-
function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise<any>;
|
|
2093
|
-
|
|
2094
|
-
/** A minimal base64 implementation for number arrays. */
|
|
2095
|
-
namespace base64 {
|
|
1954
|
+
/** Helper class for working with the low and high bits of a 64 bit value. */
|
|
1955
|
+
class LongBits {
|
|
2096
1956
|
|
|
2097
1957
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
* @param
|
|
2100
|
-
* @
|
|
1958
|
+
* Constructs new long bits.
|
|
1959
|
+
* @param lo Low 32 bits, unsigned
|
|
1960
|
+
* @param hi High 32 bits, unsigned
|
|
2101
1961
|
*/
|
|
2102
|
-
|
|
1962
|
+
constructor(lo: number, hi: number);
|
|
1963
|
+
|
|
1964
|
+
/** Low bits. */
|
|
1965
|
+
public lo: number;
|
|
1966
|
+
|
|
1967
|
+
/** High bits. */
|
|
1968
|
+
public hi: number;
|
|
1969
|
+
|
|
1970
|
+
/** Zero bits. */
|
|
1971
|
+
public static zero: util.LongBits;
|
|
1972
|
+
|
|
1973
|
+
/** Zero hash. */
|
|
1974
|
+
public static zeroHash: string;
|
|
2103
1975
|
|
|
2104
1976
|
/**
|
|
2105
|
-
*
|
|
2106
|
-
* @param
|
|
2107
|
-
* @
|
|
2108
|
-
* @param end Source end
|
|
2109
|
-
* @returns Base64 encoded string
|
|
1977
|
+
* Constructs new long bits from the specified number.
|
|
1978
|
+
* @param value Value
|
|
1979
|
+
* @returns Instance
|
|
2110
1980
|
*/
|
|
2111
|
-
|
|
1981
|
+
public static fromNumber(value: number): util.LongBits;
|
|
2112
1982
|
|
|
2113
1983
|
/**
|
|
2114
|
-
*
|
|
2115
|
-
* @param
|
|
2116
|
-
* @
|
|
2117
|
-
* @param offset Destination offset
|
|
2118
|
-
* @returns Number of bytes written
|
|
2119
|
-
* @throws {Error} If encoding is invalid
|
|
1984
|
+
* Constructs new long bits from a number, long or string.
|
|
1985
|
+
* @param value Value
|
|
1986
|
+
* @returns Instance
|
|
2120
1987
|
*/
|
|
2121
|
-
|
|
1988
|
+
public static from(value: (Long|number|string)): util.LongBits;
|
|
2122
1989
|
|
|
2123
1990
|
/**
|
|
2124
|
-
*
|
|
2125
|
-
* @param
|
|
2126
|
-
* @returns
|
|
1991
|
+
* Converts this long bits to a possibly unsafe JavaScript number.
|
|
1992
|
+
* @param [unsigned=false] Whether unsigned or not
|
|
1993
|
+
* @returns Possibly unsafe number
|
|
2127
1994
|
*/
|
|
2128
|
-
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
/**
|
|
2132
|
-
* Begins generating a function.
|
|
2133
|
-
* @param functionParams Function parameter names
|
|
2134
|
-
* @param [functionName] Function name if not anonymous
|
|
2135
|
-
* @returns Appender that appends code to the function's body
|
|
2136
|
-
*/
|
|
2137
|
-
function codegen(functionParams: string[], functionName?: string): Codegen;
|
|
2138
|
-
|
|
2139
|
-
namespace codegen {
|
|
2140
|
-
|
|
2141
|
-
/** When set to `true`, codegen will log generated code to console. Useful for debugging. */
|
|
2142
|
-
let verbose: boolean;
|
|
2143
|
-
}
|
|
1995
|
+
public toNumber(unsigned?: boolean): number;
|
|
2144
1996
|
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
1997
|
+
/**
|
|
1998
|
+
* Converts this long bits to a long.
|
|
1999
|
+
* @param [unsigned=false] Whether unsigned or not
|
|
2000
|
+
* @returns Long
|
|
2001
|
+
*/
|
|
2002
|
+
public toLong(unsigned?: boolean): Long;
|
|
2151
2003
|
|
|
2152
|
-
|
|
2153
|
-
|
|
2004
|
+
/**
|
|
2005
|
+
* Constructs new long bits from the specified 8 characters long hash.
|
|
2006
|
+
* @param hash Hash
|
|
2007
|
+
* @returns Bits
|
|
2008
|
+
*/
|
|
2009
|
+
public static fromHash(hash: string): util.LongBits;
|
|
2154
2010
|
|
|
2155
|
-
/**
|
|
2156
|
-
|
|
2011
|
+
/**
|
|
2012
|
+
* Converts this long bits to a 8 characters long hash.
|
|
2013
|
+
* @returns Hash
|
|
2014
|
+
*/
|
|
2015
|
+
public toHash(): string;
|
|
2157
2016
|
|
|
2158
2017
|
/**
|
|
2159
|
-
*
|
|
2160
|
-
* @param evt Event name
|
|
2161
|
-
* @param fn Listener
|
|
2162
|
-
* @param [ctx] Listener context
|
|
2018
|
+
* Zig-zag encodes this long bits.
|
|
2163
2019
|
* @returns `this`
|
|
2164
2020
|
*/
|
|
2165
|
-
|
|
2021
|
+
public zzEncode(): util.LongBits;
|
|
2166
2022
|
|
|
2167
2023
|
/**
|
|
2168
|
-
*
|
|
2169
|
-
* @param [evt] Event name. Removes all listeners if omitted.
|
|
2170
|
-
* @param [fn] Listener to remove. Removes all listeners of `evt` if omitted.
|
|
2024
|
+
* Zig-zag decodes this long bits.
|
|
2171
2025
|
* @returns `this`
|
|
2172
2026
|
*/
|
|
2173
|
-
|
|
2027
|
+
public zzDecode(): util.LongBits;
|
|
2174
2028
|
|
|
2175
2029
|
/**
|
|
2176
|
-
*
|
|
2177
|
-
* @
|
|
2178
|
-
* @param args Arguments
|
|
2179
|
-
* @returns `this`
|
|
2030
|
+
* Calculates the length of this longbits when encoded as a varint.
|
|
2031
|
+
* @returns Length
|
|
2180
2032
|
*/
|
|
2181
|
-
|
|
2033
|
+
public length(): number;
|
|
2182
2034
|
}
|
|
2183
2035
|
|
|
2184
2036
|
/**
|
|
2185
|
-
*
|
|
2186
|
-
* @param
|
|
2187
|
-
* @
|
|
2188
|
-
* @param callback Callback function
|
|
2037
|
+
* Tests if the specified key can affect object prototypes.
|
|
2038
|
+
* @param key Key to test
|
|
2039
|
+
* @returns `true` if the key is unsafe
|
|
2189
2040
|
*/
|
|
2190
|
-
function
|
|
2041
|
+
function isUnsafeProperty(key: string): boolean;
|
|
2042
|
+
|
|
2043
|
+
/** Whether running within node or not. */
|
|
2044
|
+
let isNode: boolean;
|
|
2045
|
+
|
|
2046
|
+
/** Global object reference. */
|
|
2047
|
+
let global: object;
|
|
2048
|
+
|
|
2049
|
+
/** An immuable empty array. */
|
|
2050
|
+
const emptyArray: any[];
|
|
2051
|
+
|
|
2052
|
+
/** An immutable empty object. */
|
|
2053
|
+
const emptyObject: object;
|
|
2191
2054
|
|
|
2192
2055
|
/**
|
|
2193
|
-
*
|
|
2194
|
-
* @param
|
|
2195
|
-
* @
|
|
2056
|
+
* Tests if the specified value is an integer.
|
|
2057
|
+
* @param value Value to test
|
|
2058
|
+
* @returns `true` if the value is an integer
|
|
2196
2059
|
*/
|
|
2197
|
-
function
|
|
2060
|
+
function isInteger(value: any): boolean;
|
|
2198
2061
|
|
|
2199
2062
|
/**
|
|
2200
|
-
*
|
|
2201
|
-
* @param
|
|
2202
|
-
* @
|
|
2203
|
-
* @returns Promise
|
|
2063
|
+
* Tests if the specified value is a string.
|
|
2064
|
+
* @param value Value to test
|
|
2065
|
+
* @returns `true` if the value is a string
|
|
2204
2066
|
*/
|
|
2205
|
-
function
|
|
2206
|
-
|
|
2207
|
-
/** Reads / writes floats / doubles from / to buffers. */
|
|
2208
|
-
namespace float {
|
|
2209
|
-
|
|
2210
|
-
/**
|
|
2211
|
-
* Writes a 32 bit float to a buffer using little endian byte order.
|
|
2212
|
-
* @param val Value to write
|
|
2213
|
-
* @param buf Target buffer
|
|
2214
|
-
* @param pos Target buffer offset
|
|
2215
|
-
*/
|
|
2216
|
-
function writeFloatLE(val: number, buf: Uint8Array, pos: number): void;
|
|
2217
|
-
|
|
2218
|
-
/**
|
|
2219
|
-
* Writes a 32 bit float to a buffer using big endian byte order.
|
|
2220
|
-
* @param val Value to write
|
|
2221
|
-
* @param buf Target buffer
|
|
2222
|
-
* @param pos Target buffer offset
|
|
2223
|
-
*/
|
|
2224
|
-
function writeFloatBE(val: number, buf: Uint8Array, pos: number): void;
|
|
2225
|
-
|
|
2226
|
-
/**
|
|
2227
|
-
* Reads a 32 bit float from a buffer using little endian byte order.
|
|
2228
|
-
* @param buf Source buffer
|
|
2229
|
-
* @param pos Source buffer offset
|
|
2230
|
-
* @returns Value read
|
|
2231
|
-
*/
|
|
2232
|
-
function readFloatLE(buf: Uint8Array, pos: number): number;
|
|
2233
|
-
|
|
2234
|
-
/**
|
|
2235
|
-
* Reads a 32 bit float from a buffer using big endian byte order.
|
|
2236
|
-
* @param buf Source buffer
|
|
2237
|
-
* @param pos Source buffer offset
|
|
2238
|
-
* @returns Value read
|
|
2239
|
-
*/
|
|
2240
|
-
function readFloatBE(buf: Uint8Array, pos: number): number;
|
|
2241
|
-
|
|
2242
|
-
/**
|
|
2243
|
-
* Writes a 64 bit double to a buffer using little endian byte order.
|
|
2244
|
-
* @param val Value to write
|
|
2245
|
-
* @param buf Target buffer
|
|
2246
|
-
* @param pos Target buffer offset
|
|
2247
|
-
*/
|
|
2248
|
-
function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void;
|
|
2249
|
-
|
|
2250
|
-
/**
|
|
2251
|
-
* Writes a 64 bit double to a buffer using big endian byte order.
|
|
2252
|
-
* @param val Value to write
|
|
2253
|
-
* @param buf Target buffer
|
|
2254
|
-
* @param pos Target buffer offset
|
|
2255
|
-
*/
|
|
2256
|
-
function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void;
|
|
2257
|
-
|
|
2258
|
-
/**
|
|
2259
|
-
* Reads a 64 bit double from a buffer using little endian byte order.
|
|
2260
|
-
* @param buf Source buffer
|
|
2261
|
-
* @param pos Source buffer offset
|
|
2262
|
-
* @returns Value read
|
|
2263
|
-
*/
|
|
2264
|
-
function readDoubleLE(buf: Uint8Array, pos: number): number;
|
|
2265
|
-
|
|
2266
|
-
/**
|
|
2267
|
-
* Reads a 64 bit double from a buffer using big endian byte order.
|
|
2268
|
-
* @param buf Source buffer
|
|
2269
|
-
* @param pos Source buffer offset
|
|
2270
|
-
* @returns Value read
|
|
2271
|
-
*/
|
|
2272
|
-
function readDoubleBE(buf: Uint8Array, pos: number): number;
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
/**
|
|
2276
|
-
* Requires a module only if available.
|
|
2277
|
-
* @param moduleName Module to require
|
|
2278
|
-
* @returns Required module if available and not empty, otherwise `null`
|
|
2279
|
-
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
2280
|
-
*/
|
|
2281
|
-
function inquire(moduleName: string): object;
|
|
2282
|
-
|
|
2283
|
-
/** Helper class for working with the low and high bits of a 64 bit value. */
|
|
2284
|
-
class LongBits {
|
|
2285
|
-
|
|
2286
|
-
/**
|
|
2287
|
-
* Constructs new long bits.
|
|
2288
|
-
* @param lo Low 32 bits, unsigned
|
|
2289
|
-
* @param hi High 32 bits, unsigned
|
|
2290
|
-
*/
|
|
2291
|
-
constructor(lo: number, hi: number);
|
|
2292
|
-
|
|
2293
|
-
/** Low bits. */
|
|
2294
|
-
lo: number;
|
|
2295
|
-
|
|
2296
|
-
/** High bits. */
|
|
2297
|
-
hi: number;
|
|
2298
|
-
|
|
2299
|
-
/** Zero bits. */
|
|
2300
|
-
static zero: util.LongBits;
|
|
2301
|
-
|
|
2302
|
-
/** Zero hash. */
|
|
2303
|
-
static zeroHash: string;
|
|
2304
|
-
|
|
2305
|
-
/**
|
|
2306
|
-
* Constructs new long bits from the specified number.
|
|
2307
|
-
* @param value Value
|
|
2308
|
-
* @returns Instance
|
|
2309
|
-
*/
|
|
2310
|
-
static fromNumber(value: number): util.LongBits;
|
|
2311
|
-
|
|
2312
|
-
/**
|
|
2313
|
-
* Constructs new long bits from a number, long or string.
|
|
2314
|
-
* @param value Value
|
|
2315
|
-
* @returns Instance
|
|
2316
|
-
*/
|
|
2317
|
-
static from(value: (Long|number|string)): util.LongBits;
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* Converts this long bits to a possibly unsafe JavaScript number.
|
|
2321
|
-
* @param [unsigned=false] Whether unsigned or not
|
|
2322
|
-
* @returns Possibly unsafe number
|
|
2323
|
-
*/
|
|
2324
|
-
toNumber(unsigned?: boolean): number;
|
|
2325
|
-
|
|
2326
|
-
/**
|
|
2327
|
-
* Converts this long bits to a long.
|
|
2328
|
-
* @param [unsigned=false] Whether unsigned or not
|
|
2329
|
-
* @returns Long
|
|
2330
|
-
*/
|
|
2331
|
-
toLong(unsigned?: boolean): Long;
|
|
2332
|
-
|
|
2333
|
-
/**
|
|
2334
|
-
* Constructs new long bits from the specified 8 characters long hash.
|
|
2335
|
-
* @param hash Hash
|
|
2336
|
-
* @returns Bits
|
|
2337
|
-
*/
|
|
2338
|
-
static fromHash(hash: string): util.LongBits;
|
|
2339
|
-
|
|
2340
|
-
/**
|
|
2341
|
-
* Converts this long bits to a 8 characters long hash.
|
|
2342
|
-
* @returns Hash
|
|
2343
|
-
*/
|
|
2344
|
-
toHash(): string;
|
|
2345
|
-
|
|
2346
|
-
/**
|
|
2347
|
-
* Zig-zag encodes this long bits.
|
|
2348
|
-
* @returns `this`
|
|
2349
|
-
*/
|
|
2350
|
-
zzEncode(): util.LongBits;
|
|
2351
|
-
|
|
2352
|
-
/**
|
|
2353
|
-
* Zig-zag decodes this long bits.
|
|
2354
|
-
* @returns `this`
|
|
2355
|
-
*/
|
|
2356
|
-
zzDecode(): util.LongBits;
|
|
2357
|
-
|
|
2358
|
-
/**
|
|
2359
|
-
* Calculates the length of this longbits when encoded as a varint.
|
|
2360
|
-
* @returns Length
|
|
2361
|
-
*/
|
|
2362
|
-
length(): number;
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
/**
|
|
2366
|
-
* Tests if the specified key can affect object prototypes.
|
|
2367
|
-
* @param key Key to test
|
|
2368
|
-
* @returns `true` if the key is unsafe
|
|
2369
|
-
*/
|
|
2370
|
-
function isUnsafeProperty(key: string): boolean;
|
|
2371
|
-
|
|
2372
|
-
/** Whether running within node or not. */
|
|
2373
|
-
let isNode: boolean;
|
|
2374
|
-
|
|
2375
|
-
/** Global object reference. */
|
|
2376
|
-
let global: object;
|
|
2377
|
-
|
|
2378
|
-
/** An immuable empty array. */
|
|
2379
|
-
const emptyArray: any[];
|
|
2380
|
-
|
|
2381
|
-
/** An immutable empty object. */
|
|
2382
|
-
const emptyObject: object;
|
|
2383
|
-
|
|
2384
|
-
/**
|
|
2385
|
-
* Tests if the specified value is an integer.
|
|
2386
|
-
* @param value Value to test
|
|
2387
|
-
* @returns `true` if the value is an integer
|
|
2388
|
-
*/
|
|
2389
|
-
function isInteger(value: any): boolean;
|
|
2390
|
-
|
|
2391
|
-
/**
|
|
2392
|
-
* Tests if the specified value is a string.
|
|
2393
|
-
* @param value Value to test
|
|
2394
|
-
* @returns `true` if the value is a string
|
|
2395
|
-
*/
|
|
2396
|
-
function isString(value: any): boolean;
|
|
2067
|
+
function isString(value: any): boolean;
|
|
2397
2068
|
|
|
2398
2069
|
/**
|
|
2399
2070
|
* Tests if the specified value is a non-null object.
|
|
@@ -2459,21 +2130,6 @@ export namespace util {
|
|
|
2459
2130
|
*/
|
|
2460
2131
|
function longFromHash(hash: string, unsigned?: boolean): (Long|number);
|
|
2461
2132
|
|
|
2462
|
-
/**
|
|
2463
|
-
* Converts a 64 bit key to a long or number if it is an 8 characters long hash string.
|
|
2464
|
-
* @param key Map key
|
|
2465
|
-
* @param [unsigned=false] Whether unsigned or not
|
|
2466
|
-
* @returns Original value
|
|
2467
|
-
*/
|
|
2468
|
-
function longFromKey(key: string, unsigned?: boolean): (Long|number|string);
|
|
2469
|
-
|
|
2470
|
-
/**
|
|
2471
|
-
* Converts a boolean key to a boolean value.
|
|
2472
|
-
* @param key Map key
|
|
2473
|
-
* @returns Boolean value
|
|
2474
|
-
*/
|
|
2475
|
-
function boolFromKey(key: string): boolean;
|
|
2476
|
-
|
|
2477
2133
|
/**
|
|
2478
2134
|
* Merges the properties of the source object into the destination object.
|
|
2479
2135
|
* @param dst Destination object
|
|
@@ -2488,72 +2144,358 @@ export namespace util {
|
|
|
2488
2144
|
/** Recursion limit. */
|
|
2489
2145
|
let recursionLimit: number;
|
|
2490
2146
|
|
|
2491
|
-
/**
|
|
2492
|
-
* Makes a property safe for assignment as an own property.
|
|
2493
|
-
* @param obj Object
|
|
2494
|
-
* @param key Property key
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2147
|
+
/**
|
|
2148
|
+
* Makes a property safe for assignment as an own property.
|
|
2149
|
+
* @param obj Object
|
|
2150
|
+
* @param key Property key
|
|
2151
|
+
*/
|
|
2152
|
+
function makeProp(obj: { [k: string]: any }, key: string): void;
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* Converts the first character of a string to lower case.
|
|
2156
|
+
* @param str String to convert
|
|
2157
|
+
* @returns Converted string
|
|
2158
|
+
*/
|
|
2159
|
+
function lcFirst(str: string): string;
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* Creates a custom error constructor.
|
|
2163
|
+
* @param name Error name
|
|
2164
|
+
* @returns Custom error constructor
|
|
2165
|
+
*/
|
|
2166
|
+
function newError(name: string): Constructor<Error>;
|
|
2167
|
+
|
|
2168
|
+
/** Error subclass indicating a protocol specifc error. */
|
|
2169
|
+
class ProtocolError<T extends Message<T>> extends Error {
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Constructs a new protocol error.
|
|
2173
|
+
* @param message Error message
|
|
2174
|
+
* @param [properties] Additional properties
|
|
2175
|
+
*/
|
|
2176
|
+
constructor(message: string, properties?: { [k: string]: any });
|
|
2177
|
+
|
|
2178
|
+
/** So far decoded message instance. */
|
|
2179
|
+
public instance: Message<T>;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* Builds a getter for a oneof's present field name.
|
|
2184
|
+
* @param fieldNames Field names
|
|
2185
|
+
* @returns Unbound getter
|
|
2186
|
+
*/
|
|
2187
|
+
function oneOfGetter(fieldNames: string[]): OneOfGetter;
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Builds a setter for a oneof's present field name.
|
|
2191
|
+
* @param fieldNames Field names
|
|
2192
|
+
* @returns Unbound setter
|
|
2193
|
+
*/
|
|
2194
|
+
function oneOfSetter(fieldNames: string[]): OneOfSetter;
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* Default conversion options used for {@link Message#toJSON} implementations.
|
|
2198
|
+
*
|
|
2199
|
+
* These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
|
|
2200
|
+
*
|
|
2201
|
+
* - Longs become strings
|
|
2202
|
+
* - Enums become string keys
|
|
2203
|
+
* - Bytes become base64 encoded strings
|
|
2204
|
+
* - (Sub-)Messages become plain objects
|
|
2205
|
+
* - Maps become plain objects with all string keys
|
|
2206
|
+
* - Repeated fields become arrays
|
|
2207
|
+
* - NaN and Infinity for float and double fields become strings
|
|
2208
|
+
*
|
|
2209
|
+
* @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
|
|
2210
|
+
*/
|
|
2211
|
+
let toJSONOptions: IConversionOptions;
|
|
2212
|
+
|
|
2213
|
+
/** Node's fs module if available. */
|
|
2214
|
+
let fs: { [k: string]: any };
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Checks a recursion depth.
|
|
2218
|
+
* @param depth Depth of recursion
|
|
2219
|
+
* @returns Depth of recursion
|
|
2220
|
+
* @throws {Error} If depth exceeds util.recursionLimit
|
|
2221
|
+
*/
|
|
2222
|
+
function checkDepth(depth: (number|undefined)): number;
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Converts an object's values to an array.
|
|
2226
|
+
* @param object Object to convert
|
|
2227
|
+
* @returns Converted array
|
|
2228
|
+
*/
|
|
2229
|
+
function toArray(object: { [k: string]: any }): any[];
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.
|
|
2233
|
+
* @param array Array to convert
|
|
2234
|
+
* @returns Converted object
|
|
2235
|
+
*/
|
|
2236
|
+
function toObject(array: any[]): { [k: string]: any };
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Tests whether the specified name is a reserved word in JS.
|
|
2240
|
+
* @param name Name to test
|
|
2241
|
+
* @returns `true` if reserved, otherwise `false`
|
|
2242
|
+
*/
|
|
2243
|
+
function isReserved(name: string): boolean;
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Returns a safe property accessor for the specified property name.
|
|
2247
|
+
* @param prop Property name
|
|
2248
|
+
* @returns Safe accessor
|
|
2249
|
+
*/
|
|
2250
|
+
function safeProp(prop: string): string;
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Converts the first character of a string to upper case.
|
|
2254
|
+
* @param str String to convert
|
|
2255
|
+
* @returns Converted string
|
|
2256
|
+
*/
|
|
2257
|
+
function ucFirst(str: string): string;
|
|
2258
|
+
|
|
2259
|
+
/**
|
|
2260
|
+
* Converts a string to camel case.
|
|
2261
|
+
* @param str String to convert
|
|
2262
|
+
* @returns Converted string
|
|
2263
|
+
*/
|
|
2264
|
+
function camelCase(str: string): string;
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* Compares reflected fields by id.
|
|
2268
|
+
* @param a First field
|
|
2269
|
+
* @param b Second field
|
|
2270
|
+
* @returns Comparison value
|
|
2271
|
+
*/
|
|
2272
|
+
function compareFieldsById(a: Field, b: Field): number;
|
|
2273
|
+
|
|
2274
|
+
/**
|
|
2275
|
+
* Decorator helper for types (TypeScript).
|
|
2276
|
+
* @param ctor Constructor function
|
|
2277
|
+
* @param [typeName] Type name, defaults to the constructor's name
|
|
2278
|
+
* @returns Reflected type
|
|
2279
|
+
*/
|
|
2280
|
+
function decorateType<T extends Message<T>>(ctor: Constructor<T>, typeName?: string): Type;
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* Decorator helper for enums (TypeScript).
|
|
2284
|
+
* @param object Enum object
|
|
2285
|
+
* @returns Reflected enum
|
|
2286
|
+
*/
|
|
2287
|
+
function decorateEnum(object: object): Enum;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Sets the value of a property by property path. If a value already exists, it is turned to an array
|
|
2291
|
+
* @param dst Destination object
|
|
2292
|
+
* @param path dot '.' delimited path of the property to set
|
|
2293
|
+
* @param value the value to set
|
|
2294
|
+
* @param [ifNotSet] Sets the option only if it isn't currently set
|
|
2295
|
+
* @returns Destination object
|
|
2296
|
+
*/
|
|
2297
|
+
function setProperty(dst: { [k: string]: any }, path: string, value: object, ifNotSet?: (boolean|undefined)): { [k: string]: any };
|
|
2298
|
+
|
|
2299
|
+
/** Decorator root (TypeScript). */
|
|
2300
|
+
let decorateRoot: Root;
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Returns a promise from a node-style callback function.
|
|
2304
|
+
* @param fn Function to call
|
|
2305
|
+
* @param ctx Function context
|
|
2306
|
+
* @param params Function arguments
|
|
2307
|
+
* @returns Promisified function
|
|
2308
|
+
*/
|
|
2309
|
+
function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise<any>;
|
|
2310
|
+
|
|
2311
|
+
/** A minimal base64 implementation for number arrays. */
|
|
2312
|
+
namespace base64 {
|
|
2313
|
+
|
|
2314
|
+
/**
|
|
2315
|
+
* Calculates the byte length of a base64 encoded string.
|
|
2316
|
+
* @param string Base64 encoded string
|
|
2317
|
+
* @returns Byte length
|
|
2318
|
+
*/
|
|
2319
|
+
function length(string: string): number;
|
|
2320
|
+
|
|
2321
|
+
/**
|
|
2322
|
+
* Encodes a buffer to a base64 encoded string.
|
|
2323
|
+
* @param buffer Source buffer
|
|
2324
|
+
* @param start Source start
|
|
2325
|
+
* @param end Source end
|
|
2326
|
+
* @returns Base64 encoded string
|
|
2327
|
+
*/
|
|
2328
|
+
function encode(buffer: Uint8Array, start: number, end: number): string;
|
|
2329
|
+
|
|
2330
|
+
/**
|
|
2331
|
+
* Decodes a base64 encoded string to a buffer.
|
|
2332
|
+
* @param string Source string
|
|
2333
|
+
* @param buffer Destination buffer
|
|
2334
|
+
* @param offset Destination offset
|
|
2335
|
+
* @returns Number of bytes written
|
|
2336
|
+
* @throws {Error} If encoding is invalid
|
|
2337
|
+
*/
|
|
2338
|
+
function decode(string: string, buffer: Uint8Array, offset: number): number;
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Tests if the specified string appears to be base64 encoded.
|
|
2342
|
+
* @param string String to test
|
|
2343
|
+
* @returns `true` if probably base64 encoded, otherwise false
|
|
2344
|
+
*/
|
|
2345
|
+
function test(string: string): boolean;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* Begins generating a function.
|
|
2350
|
+
* @param functionParams Function parameter names
|
|
2351
|
+
* @param [functionName] Function name if not anonymous
|
|
2352
|
+
* @returns Appender that appends code to the function's body
|
|
2353
|
+
*/
|
|
2354
|
+
function codegen(functionParams: string[], functionName?: string): Codegen;
|
|
2355
|
+
|
|
2356
|
+
namespace codegen {
|
|
2357
|
+
|
|
2358
|
+
/** When set to `true`, codegen will log generated code to console. Useful for debugging. */
|
|
2359
|
+
let verbose: boolean;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
/**
|
|
2363
|
+
* Begins generating a function.
|
|
2364
|
+
* @param [functionName] Function name if not anonymous
|
|
2365
|
+
* @returns Appender that appends code to the function's body
|
|
2366
|
+
*/
|
|
2367
|
+
function codegen(functionName?: string): Codegen;
|
|
2368
|
+
|
|
2369
|
+
/** A minimal event emitter. */
|
|
2370
|
+
class EventEmitter {
|
|
2371
|
+
|
|
2372
|
+
/** Constructs a new event emitter instance. */
|
|
2373
|
+
constructor();
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* Registers an event listener.
|
|
2377
|
+
* @param evt Event name
|
|
2378
|
+
* @param fn Listener
|
|
2379
|
+
* @param [ctx] Listener context
|
|
2380
|
+
* @returns `this`
|
|
2381
|
+
*/
|
|
2382
|
+
public on(evt: string, fn: EventEmitterListener, ctx?: any): this;
|
|
2383
|
+
|
|
2384
|
+
/**
|
|
2385
|
+
* Removes an event listener or any matching listeners if arguments are omitted.
|
|
2386
|
+
* @param [evt] Event name. Removes all listeners if omitted.
|
|
2387
|
+
* @param [fn] Listener to remove. Removes all listeners of `evt` if omitted.
|
|
2388
|
+
* @returns `this`
|
|
2389
|
+
*/
|
|
2390
|
+
public off(evt?: string, fn?: EventEmitterListener): this;
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* Emits an event by calling its listeners with the specified arguments.
|
|
2394
|
+
* @param evt Event name
|
|
2395
|
+
* @param args Arguments
|
|
2396
|
+
* @returns `this`
|
|
2397
|
+
*/
|
|
2398
|
+
public emit(evt: string, ...args: any[]): this;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
/** Reads / writes floats / doubles from / to buffers. */
|
|
2402
|
+
namespace float {
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Writes a 32 bit float to a buffer using little endian byte order.
|
|
2406
|
+
* @param val Value to write
|
|
2407
|
+
* @param buf Target buffer
|
|
2408
|
+
* @param pos Target buffer offset
|
|
2409
|
+
*/
|
|
2410
|
+
function writeFloatLE(val: number, buf: Uint8Array, pos: number): void;
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* Writes a 32 bit float to a buffer using big endian byte order.
|
|
2414
|
+
* @param val Value to write
|
|
2415
|
+
* @param buf Target buffer
|
|
2416
|
+
* @param pos Target buffer offset
|
|
2417
|
+
*/
|
|
2418
|
+
function writeFloatBE(val: number, buf: Uint8Array, pos: number): void;
|
|
2419
|
+
|
|
2420
|
+
/**
|
|
2421
|
+
* Reads a 32 bit float from a buffer using little endian byte order.
|
|
2422
|
+
* @param buf Source buffer
|
|
2423
|
+
* @param pos Source buffer offset
|
|
2424
|
+
* @returns Value read
|
|
2425
|
+
*/
|
|
2426
|
+
function readFloatLE(buf: Uint8Array, pos: number): number;
|
|
2498
2427
|
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2428
|
+
/**
|
|
2429
|
+
* Reads a 32 bit float from a buffer using big endian byte order.
|
|
2430
|
+
* @param buf Source buffer
|
|
2431
|
+
* @param pos Source buffer offset
|
|
2432
|
+
* @returns Value read
|
|
2433
|
+
*/
|
|
2434
|
+
function readFloatBE(buf: Uint8Array, pos: number): number;
|
|
2505
2435
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2436
|
+
/**
|
|
2437
|
+
* Writes a 64 bit double to a buffer using little endian byte order.
|
|
2438
|
+
* @param val Value to write
|
|
2439
|
+
* @param buf Target buffer
|
|
2440
|
+
* @param pos Target buffer offset
|
|
2441
|
+
*/
|
|
2442
|
+
function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void;
|
|
2512
2443
|
|
|
2513
|
-
|
|
2514
|
-
|
|
2444
|
+
/**
|
|
2445
|
+
* Writes a 64 bit double to a buffer using big endian byte order.
|
|
2446
|
+
* @param val Value to write
|
|
2447
|
+
* @param buf Target buffer
|
|
2448
|
+
* @param pos Target buffer offset
|
|
2449
|
+
*/
|
|
2450
|
+
function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void;
|
|
2515
2451
|
|
|
2516
2452
|
/**
|
|
2517
|
-
*
|
|
2518
|
-
* @param
|
|
2519
|
-
* @param
|
|
2453
|
+
* Reads a 64 bit double from a buffer using little endian byte order.
|
|
2454
|
+
* @param buf Source buffer
|
|
2455
|
+
* @param pos Source buffer offset
|
|
2456
|
+
* @returns Value read
|
|
2520
2457
|
*/
|
|
2521
|
-
|
|
2458
|
+
function readDoubleLE(buf: Uint8Array, pos: number): number;
|
|
2522
2459
|
|
|
2523
|
-
/**
|
|
2524
|
-
|
|
2460
|
+
/**
|
|
2461
|
+
* Reads a 64 bit double from a buffer using big endian byte order.
|
|
2462
|
+
* @param buf Source buffer
|
|
2463
|
+
* @param pos Source buffer offset
|
|
2464
|
+
* @returns Value read
|
|
2465
|
+
*/
|
|
2466
|
+
function readDoubleBE(buf: Uint8Array, pos: number): number;
|
|
2525
2467
|
}
|
|
2526
2468
|
|
|
2527
2469
|
/**
|
|
2528
|
-
*
|
|
2529
|
-
* @param
|
|
2530
|
-
* @
|
|
2470
|
+
* Fetches the contents of a file.
|
|
2471
|
+
* @param filename File path or url
|
|
2472
|
+
* @param options Fetch options
|
|
2473
|
+
* @param callback Callback function
|
|
2531
2474
|
*/
|
|
2532
|
-
function
|
|
2475
|
+
function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void;
|
|
2533
2476
|
|
|
2534
2477
|
/**
|
|
2535
|
-
*
|
|
2536
|
-
* @param
|
|
2537
|
-
* @
|
|
2478
|
+
* Fetches the contents of a file.
|
|
2479
|
+
* @param path File path or url
|
|
2480
|
+
* @param callback Callback function
|
|
2538
2481
|
*/
|
|
2539
|
-
function
|
|
2482
|
+
function fetch(path: string, callback: FetchCallback): void;
|
|
2540
2483
|
|
|
2541
2484
|
/**
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
2545
|
-
*
|
|
2546
|
-
* - Longs become strings
|
|
2547
|
-
* - Enums become string keys
|
|
2548
|
-
* - Bytes become base64 encoded strings
|
|
2549
|
-
* - (Sub-)Messages become plain objects
|
|
2550
|
-
* - Maps become plain objects with all string keys
|
|
2551
|
-
* - Repeated fields become arrays
|
|
2552
|
-
* - NaN and Infinity for float and double fields become strings
|
|
2553
|
-
*
|
|
2554
|
-
* @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
|
|
2485
|
+
* Fetches the contents of a file.
|
|
2486
|
+
* @param path File path or url
|
|
2487
|
+
* @param [options] Fetch options
|
|
2488
|
+
* @returns Promise
|
|
2555
2489
|
*/
|
|
2556
|
-
|
|
2490
|
+
function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>;
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* Requires a module only if available.
|
|
2494
|
+
* @param moduleName Module to require
|
|
2495
|
+
* @returns Required module if available and not empty, otherwise `null`
|
|
2496
|
+
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
2497
|
+
*/
|
|
2498
|
+
function inquire(moduleName: string): object;
|
|
2557
2499
|
|
|
2558
2500
|
/** A minimal path module to resolve Unix, Windows and URL paths alike. */
|
|
2559
2501
|
namespace path {
|
|
@@ -2619,92 +2561,6 @@ export namespace util {
|
|
|
2619
2561
|
*/
|
|
2620
2562
|
function write(string: string, buffer: Uint8Array, offset: number): number;
|
|
2621
2563
|
}
|
|
2622
|
-
|
|
2623
|
-
/** Node's fs module if available. */
|
|
2624
|
-
let fs: { [k: string]: any };
|
|
2625
|
-
|
|
2626
|
-
/**
|
|
2627
|
-
* Converts an object's values to an array.
|
|
2628
|
-
* @param object Object to convert
|
|
2629
|
-
* @returns Converted array
|
|
2630
|
-
*/
|
|
2631
|
-
function toArray(object: { [k: string]: any }): any[];
|
|
2632
|
-
|
|
2633
|
-
/**
|
|
2634
|
-
* Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.
|
|
2635
|
-
* @param array Array to convert
|
|
2636
|
-
* @returns Converted object
|
|
2637
|
-
*/
|
|
2638
|
-
function toObject(array: any[]): { [k: string]: any };
|
|
2639
|
-
|
|
2640
|
-
/**
|
|
2641
|
-
* Tests whether the specified name is a reserved word in JS.
|
|
2642
|
-
* @param name Name to test
|
|
2643
|
-
* @returns `true` if reserved, otherwise `false`
|
|
2644
|
-
*/
|
|
2645
|
-
function isReserved(name: string): boolean;
|
|
2646
|
-
|
|
2647
|
-
/**
|
|
2648
|
-
* Returns a safe property accessor for the specified property name.
|
|
2649
|
-
* @param prop Property name
|
|
2650
|
-
* @returns Safe accessor
|
|
2651
|
-
*/
|
|
2652
|
-
function safeProp(prop: string): string;
|
|
2653
|
-
|
|
2654
|
-
/**
|
|
2655
|
-
* Converts the first character of a string to upper case.
|
|
2656
|
-
* @param str String to convert
|
|
2657
|
-
* @returns Converted string
|
|
2658
|
-
*/
|
|
2659
|
-
function ucFirst(str: string): string;
|
|
2660
|
-
|
|
2661
|
-
/**
|
|
2662
|
-
* Converts a string to camel case.
|
|
2663
|
-
* @param str String to convert
|
|
2664
|
-
* @returns Converted string
|
|
2665
|
-
*/
|
|
2666
|
-
function camelCase(str: string): string;
|
|
2667
|
-
|
|
2668
|
-
/**
|
|
2669
|
-
* Compares reflected fields by id.
|
|
2670
|
-
* @param a First field
|
|
2671
|
-
* @param b Second field
|
|
2672
|
-
* @returns Comparison value
|
|
2673
|
-
*/
|
|
2674
|
-
function compareFieldsById(a: Field, b: Field): number;
|
|
2675
|
-
|
|
2676
|
-
/**
|
|
2677
|
-
* Decorator helper for types (TypeScript).
|
|
2678
|
-
* @param ctor Constructor function
|
|
2679
|
-
* @param [typeName] Type name, defaults to the constructor's name
|
|
2680
|
-
* @returns Reflected type
|
|
2681
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
2682
|
-
*/
|
|
2683
|
-
function decorateType<T extends Message<T>>(ctor: Constructor<T>, typeName?: string): Type;
|
|
2684
|
-
|
|
2685
|
-
/**
|
|
2686
|
-
* Decorator helper for enums (TypeScript).
|
|
2687
|
-
* @param object Enum object
|
|
2688
|
-
* @returns Reflected enum
|
|
2689
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
2690
|
-
*/
|
|
2691
|
-
function decorateEnum(object: object): Enum;
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* Sets the value of a property by property path. If a value already exists, it is turned to an array
|
|
2695
|
-
* @param dst Destination object
|
|
2696
|
-
* @param path dot '.' delimited path of the property to set
|
|
2697
|
-
* @param value the value to set
|
|
2698
|
-
* @param [ifNotSet] Sets the option only if it isn't currently set
|
|
2699
|
-
* @returns Destination object
|
|
2700
|
-
*/
|
|
2701
|
-
function setProperty(dst: { [k: string]: any }, path: string, value: object, ifNotSet?: (boolean|undefined)): { [k: string]: any };
|
|
2702
|
-
|
|
2703
|
-
/**
|
|
2704
|
-
* Decorator root (TypeScript).
|
|
2705
|
-
* @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
|
|
2706
|
-
*/
|
|
2707
|
-
let decorateRoot: Root;
|
|
2708
2564
|
}
|
|
2709
2565
|
|
|
2710
2566
|
/**
|
|
@@ -2722,7 +2578,7 @@ export const wrappers: { [k: string]: IWrapper };
|
|
|
2722
2578
|
* @param object Plain object
|
|
2723
2579
|
* @returns Message instance
|
|
2724
2580
|
*/
|
|
2725
|
-
|
|
2581
|
+
type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any }) => Message<{}>;
|
|
2726
2582
|
|
|
2727
2583
|
/**
|
|
2728
2584
|
* To object converter part of an {@link IWrapper}.
|
|
@@ -2730,7 +2586,7 @@ export type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any
|
|
|
2730
2586
|
* @param [options] Conversion options
|
|
2731
2587
|
* @returns Plain object
|
|
2732
2588
|
*/
|
|
2733
|
-
|
|
2589
|
+
type WrapperToObjectConverter = (this: Type, message: Message<{}>, options?: IConversionOptions) => { [k: string]: any };
|
|
2734
2590
|
|
|
2735
2591
|
/** Common type wrapper part of {@link wrappers}. */
|
|
2736
2592
|
export interface IWrapper {
|
|
@@ -2749,50 +2605,50 @@ export class Writer {
|
|
|
2749
2605
|
constructor();
|
|
2750
2606
|
|
|
2751
2607
|
/** Current length. */
|
|
2752
|
-
len: number;
|
|
2608
|
+
public len: number;
|
|
2753
2609
|
|
|
2754
2610
|
/** Operations head. */
|
|
2755
|
-
head: object;
|
|
2611
|
+
public head: object;
|
|
2756
2612
|
|
|
2757
2613
|
/** Operations tail */
|
|
2758
|
-
tail: object;
|
|
2614
|
+
public tail: object;
|
|
2759
2615
|
|
|
2760
2616
|
/** Linked forked states. */
|
|
2761
|
-
states: (object|null);
|
|
2617
|
+
public states: (object|null);
|
|
2762
2618
|
|
|
2763
2619
|
/**
|
|
2764
2620
|
* Creates a new writer.
|
|
2765
2621
|
* @returns A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}
|
|
2766
2622
|
*/
|
|
2767
|
-
static create(): (BufferWriter|Writer);
|
|
2623
|
+
public static create(): (BufferWriter|Writer);
|
|
2768
2624
|
|
|
2769
2625
|
/**
|
|
2770
2626
|
* Allocates a buffer of the specified size.
|
|
2771
2627
|
* @param size Buffer size
|
|
2772
2628
|
* @returns Buffer
|
|
2773
2629
|
*/
|
|
2774
|
-
static alloc(size: number): Uint8Array;
|
|
2630
|
+
public static alloc(size: number): Uint8Array;
|
|
2775
2631
|
|
|
2776
2632
|
/**
|
|
2777
2633
|
* Writes an unsigned 32 bit value as a varint.
|
|
2778
2634
|
* @param value Value to write
|
|
2779
2635
|
* @returns `this`
|
|
2780
2636
|
*/
|
|
2781
|
-
uint32(value: number): Writer;
|
|
2637
|
+
public uint32(value: number): Writer;
|
|
2782
2638
|
|
|
2783
2639
|
/**
|
|
2784
2640
|
* Writes a signed 32 bit value as a varint.
|
|
2785
2641
|
* @param value Value to write
|
|
2786
2642
|
* @returns `this`
|
|
2787
2643
|
*/
|
|
2788
|
-
int32(value: number): Writer;
|
|
2644
|
+
public int32(value: number): Writer;
|
|
2789
2645
|
|
|
2790
2646
|
/**
|
|
2791
2647
|
* Writes a 32 bit value as a varint, zig-zag encoded.
|
|
2792
2648
|
* @param value Value to write
|
|
2793
2649
|
* @returns `this`
|
|
2794
2650
|
*/
|
|
2795
|
-
sint32(value: number): Writer;
|
|
2651
|
+
public sint32(value: number): Writer;
|
|
2796
2652
|
|
|
2797
2653
|
/**
|
|
2798
2654
|
* Writes an unsigned 64 bit value as a varint.
|
|
@@ -2800,7 +2656,7 @@ export class Writer {
|
|
|
2800
2656
|
* @returns `this`
|
|
2801
2657
|
* @throws {TypeError} If `value` is a string and no long library is present.
|
|
2802
2658
|
*/
|
|
2803
|
-
uint64(value: (Long|number|string)): Writer;
|
|
2659
|
+
public uint64(value: (Long|number|string)): Writer;
|
|
2804
2660
|
|
|
2805
2661
|
/**
|
|
2806
2662
|
* Writes a signed 64 bit value as a varint.
|
|
@@ -2808,7 +2664,7 @@ export class Writer {
|
|
|
2808
2664
|
* @returns `this`
|
|
2809
2665
|
* @throws {TypeError} If `value` is a string and no long library is present.
|
|
2810
2666
|
*/
|
|
2811
|
-
int64(value: (Long|number|string)): Writer;
|
|
2667
|
+
public int64(value: (Long|number|string)): Writer;
|
|
2812
2668
|
|
|
2813
2669
|
/**
|
|
2814
2670
|
* Writes a signed 64 bit value as a varint, zig-zag encoded.
|
|
@@ -2816,28 +2672,28 @@ export class Writer {
|
|
|
2816
2672
|
* @returns `this`
|
|
2817
2673
|
* @throws {TypeError} If `value` is a string and no long library is present.
|
|
2818
2674
|
*/
|
|
2819
|
-
sint64(value: (Long|number|string)): Writer;
|
|
2675
|
+
public sint64(value: (Long|number|string)): Writer;
|
|
2820
2676
|
|
|
2821
2677
|
/**
|
|
2822
2678
|
* Writes a boolish value as a varint.
|
|
2823
2679
|
* @param value Value to write
|
|
2824
2680
|
* @returns `this`
|
|
2825
2681
|
*/
|
|
2826
|
-
bool(value: boolean): Writer;
|
|
2682
|
+
public bool(value: boolean): Writer;
|
|
2827
2683
|
|
|
2828
2684
|
/**
|
|
2829
2685
|
* Writes an unsigned 32 bit value as fixed 32 bits.
|
|
2830
2686
|
* @param value Value to write
|
|
2831
2687
|
* @returns `this`
|
|
2832
2688
|
*/
|
|
2833
|
-
fixed32(value: number): Writer;
|
|
2689
|
+
public fixed32(value: number): Writer;
|
|
2834
2690
|
|
|
2835
2691
|
/**
|
|
2836
2692
|
* Writes a signed 32 bit value as fixed 32 bits.
|
|
2837
2693
|
* @param value Value to write
|
|
2838
2694
|
* @returns `this`
|
|
2839
2695
|
*/
|
|
2840
|
-
sfixed32(value: number): Writer;
|
|
2696
|
+
public sfixed32(value: number): Writer;
|
|
2841
2697
|
|
|
2842
2698
|
/**
|
|
2843
2699
|
* Writes an unsigned 64 bit value as fixed 64 bits.
|
|
@@ -2845,7 +2701,7 @@ export class Writer {
|
|
|
2845
2701
|
* @returns `this`
|
|
2846
2702
|
* @throws {TypeError} If `value` is a string and no long library is present.
|
|
2847
2703
|
*/
|
|
2848
|
-
fixed64(value: (Long|number|string)): Writer;
|
|
2704
|
+
public fixed64(value: (Long|number|string)): Writer;
|
|
2849
2705
|
|
|
2850
2706
|
/**
|
|
2851
2707
|
* Writes a signed 64 bit value as fixed 64 bits.
|
|
@@ -2853,77 +2709,60 @@ export class Writer {
|
|
|
2853
2709
|
* @returns `this`
|
|
2854
2710
|
* @throws {TypeError} If `value` is a string and no long library is present.
|
|
2855
2711
|
*/
|
|
2856
|
-
sfixed64(value: (Long|number|string)): Writer;
|
|
2712
|
+
public sfixed64(value: (Long|number|string)): Writer;
|
|
2857
2713
|
|
|
2858
2714
|
/**
|
|
2859
2715
|
* Writes a float (32 bit).
|
|
2860
2716
|
* @param value Value to write
|
|
2861
2717
|
* @returns `this`
|
|
2862
2718
|
*/
|
|
2863
|
-
float(value: number): Writer;
|
|
2719
|
+
public float(value: number): Writer;
|
|
2864
2720
|
|
|
2865
2721
|
/**
|
|
2866
2722
|
* Writes a double (64 bit float).
|
|
2867
2723
|
* @param value Value to write
|
|
2868
2724
|
* @returns `this`
|
|
2869
2725
|
*/
|
|
2870
|
-
double(value: number): Writer;
|
|
2726
|
+
public double(value: number): Writer;
|
|
2871
2727
|
|
|
2872
2728
|
/**
|
|
2873
2729
|
* Writes a sequence of bytes.
|
|
2874
2730
|
* @param value Buffer or base64 encoded string to write
|
|
2875
2731
|
* @returns `this`
|
|
2876
2732
|
*/
|
|
2877
|
-
bytes(value: (Uint8Array|string)): Writer;
|
|
2878
|
-
|
|
2879
|
-
/**
|
|
2880
|
-
* Writes raw bytes without a tag or length prefix.
|
|
2881
|
-
* @param value Raw bytes
|
|
2882
|
-
* @returns `this`
|
|
2883
|
-
*/
|
|
2884
|
-
raw(value: Uint8Array): Writer;
|
|
2733
|
+
public bytes(value: (Uint8Array|string)): Writer;
|
|
2885
2734
|
|
|
2886
2735
|
/**
|
|
2887
2736
|
* Writes a string.
|
|
2888
2737
|
* @param value Value to write
|
|
2889
2738
|
* @returns `this`
|
|
2890
2739
|
*/
|
|
2891
|
-
string(value: string): Writer;
|
|
2740
|
+
public string(value: string): Writer;
|
|
2892
2741
|
|
|
2893
2742
|
/**
|
|
2894
2743
|
* Forks this writer's state by pushing it to a stack.
|
|
2895
2744
|
* Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.
|
|
2896
2745
|
* @returns `this`
|
|
2897
2746
|
*/
|
|
2898
|
-
fork(): Writer;
|
|
2747
|
+
public fork(): Writer;
|
|
2899
2748
|
|
|
2900
2749
|
/**
|
|
2901
2750
|
* Resets this instance to the last state.
|
|
2902
2751
|
* @returns `this`
|
|
2903
2752
|
*/
|
|
2904
|
-
reset(): Writer;
|
|
2753
|
+
public reset(): Writer;
|
|
2905
2754
|
|
|
2906
2755
|
/**
|
|
2907
2756
|
* Resets to the last state and appends the fork state's current write length as a varint followed by its operations.
|
|
2908
2757
|
* @returns `this`
|
|
2909
2758
|
*/
|
|
2910
|
-
ldelim(): Writer;
|
|
2759
|
+
public ldelim(): Writer;
|
|
2911
2760
|
|
|
2912
2761
|
/**
|
|
2913
2762
|
* Finishes the write operation.
|
|
2914
2763
|
* @returns Finished buffer
|
|
2915
2764
|
*/
|
|
2916
|
-
finish(): Uint8Array;
|
|
2917
|
-
|
|
2918
|
-
/**
|
|
2919
|
-
* Finishes the write operation, writing into the provided buffer.
|
|
2920
|
-
* The caller must ensure that `buf` has enough space starting at `offset`
|
|
2921
|
-
* to hold {@link Writer#len} bytes.
|
|
2922
|
-
* @param buf Target buffer
|
|
2923
|
-
* @param [offset=0] Offset to start writing at
|
|
2924
|
-
* @returns The provided buffer
|
|
2925
|
-
*/
|
|
2926
|
-
finishInto<T extends Uint8Array>(buf: T, offset?: number): T;
|
|
2765
|
+
public finish(): Uint8Array;
|
|
2927
2766
|
}
|
|
2928
2767
|
|
|
2929
2768
|
/** Wire format writer using node buffers. */
|
|
@@ -2937,18 +2776,65 @@ export class BufferWriter extends Writer {
|
|
|
2937
2776
|
* @param size Buffer size
|
|
2938
2777
|
* @returns Buffer
|
|
2939
2778
|
*/
|
|
2940
|
-
static alloc(size: number): Buffer;
|
|
2941
|
-
|
|
2942
|
-
/**
|
|
2943
|
-
* Writes raw bytes without a tag or length prefix.
|
|
2944
|
-
* @param value Raw bytes
|
|
2945
|
-
* @returns `this`
|
|
2946
|
-
*/
|
|
2947
|
-
raw(value: Uint8Array): BufferWriter;
|
|
2779
|
+
public static alloc(size: number): Buffer;
|
|
2948
2780
|
|
|
2949
2781
|
/**
|
|
2950
2782
|
* Finishes the write operation.
|
|
2951
2783
|
* @returns Finished buffer
|
|
2952
2784
|
*/
|
|
2953
|
-
finish(): Buffer;
|
|
2785
|
+
public finish(): Buffer;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
/**
|
|
2789
|
+
* Callback as used by {@link util.asPromise}.
|
|
2790
|
+
* @param error Error, if any
|
|
2791
|
+
* @param params Additional arguments
|
|
2792
|
+
*/
|
|
2793
|
+
type asPromiseCallback = (error: (Error|null), ...params: any[]) => void;
|
|
2794
|
+
|
|
2795
|
+
/**
|
|
2796
|
+
* Appends code to the function's body or finishes generation.
|
|
2797
|
+
* @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
2798
|
+
* @param [formatParams] Format parameters
|
|
2799
|
+
* @returns Itself or the generated function if finished
|
|
2800
|
+
* @throws {Error} If format parameter counts do not match
|
|
2801
|
+
*/
|
|
2802
|
+
type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
|
|
2803
|
+
|
|
2804
|
+
/**
|
|
2805
|
+
* Event listener as used by {@link util.EventEmitter}.
|
|
2806
|
+
* @param args Arguments
|
|
2807
|
+
*/
|
|
2808
|
+
type EventEmitterListener = (...args: any[]) => void;
|
|
2809
|
+
|
|
2810
|
+
/**
|
|
2811
|
+
* Node-style callback as used by {@link util.fetch}.
|
|
2812
|
+
* @param error Error, if any, otherwise `null`
|
|
2813
|
+
* @param [contents] File contents, if there hasn't been an error
|
|
2814
|
+
*/
|
|
2815
|
+
type FetchCallback = (error: Error, contents?: string) => void;
|
|
2816
|
+
|
|
2817
|
+
/** Options as used by {@link util.fetch}. */
|
|
2818
|
+
export interface IFetchOptions {
|
|
2819
|
+
|
|
2820
|
+
/** Whether expecting a binary response */
|
|
2821
|
+
binary?: boolean;
|
|
2822
|
+
|
|
2823
|
+
/** If `true`, forces the use of XMLHttpRequest */
|
|
2824
|
+
xhr?: boolean;
|
|
2954
2825
|
}
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* An allocator as used by {@link util.pool}.
|
|
2829
|
+
* @param size Buffer size
|
|
2830
|
+
* @returns Buffer
|
|
2831
|
+
*/
|
|
2832
|
+
type PoolAllocator = (size: number) => Uint8Array;
|
|
2833
|
+
|
|
2834
|
+
/**
|
|
2835
|
+
* A slicer as used by {@link util.pool}.
|
|
2836
|
+
* @param start Start offset
|
|
2837
|
+
* @param end End offset
|
|
2838
|
+
* @returns Buffer slice
|
|
2839
|
+
*/
|
|
2840
|
+
type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
|