nexus-agents 14.0.1 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/dist/{ast-rule-runner-3DNARGI6.js → ast-rule-runner-2PEUHSHO.js} +5 -5
  2. package/dist/{child-mcp-config-JDA622RX.js → child-mcp-config-AYVMLJDV.js} +4 -4
  3. package/dist/{chunk-IXL2W6E3.js → chunk-236T3AOZ.js} +4 -4
  4. package/dist/{chunk-OVVJGCB7.js → chunk-5QNWRC7B.js} +2 -2
  5. package/dist/{chunk-P4L4CEJX.js → chunk-B5RDZLU3.js} +4 -4
  6. package/dist/{chunk-IMRAE2LB.js → chunk-CZSEUZFE.js} +2 -2
  7. package/dist/{chunk-OAX3TSGU.js → chunk-DCPN7F5J.js} +2 -2
  8. package/dist/{chunk-O3D6HEXJ.js → chunk-DXDKAVWV.js} +5 -5
  9. package/dist/{chunk-O6SI3EVF.js → chunk-FEAWCZ7E.js} +2 -2
  10. package/dist/{chunk-L2JOGUR3.js → chunk-GDCIDLUF.js} +13 -12
  11. package/dist/{chunk-L2JOGUR3.js.map → chunk-GDCIDLUF.js.map} +1 -1
  12. package/dist/{chunk-RTO52ZBC.js → chunk-GPZQVYKV.js} +2 -2
  13. package/dist/{chunk-IIUEAOTT.js → chunk-GR4BMQAS.js} +9 -7
  14. package/dist/chunk-GR4BMQAS.js.map +1 -0
  15. package/dist/{chunk-NZDRN4NL.js → chunk-H6SGSQJM.js} +2 -2
  16. package/dist/{chunk-TKF3X3RI.js → chunk-HJJRUYNR.js} +7 -6
  17. package/dist/chunk-HJJRUYNR.js.map +1 -0
  18. package/dist/{chunk-2FOPXY3L.js → chunk-IZSJWIHK.js} +39 -9
  19. package/dist/chunk-IZSJWIHK.js.map +1 -0
  20. package/dist/{chunk-V3X7QGN3.js → chunk-JV3UBRRA.js} +2 -2
  21. package/dist/{chunk-2UWQ2GEG.js → chunk-KXWLZDQR.js} +5 -5
  22. package/dist/{chunk-QSABRS3I.js → chunk-LBVPKHHU.js} +3 -3
  23. package/dist/{chunk-UZ3KUNPN.js → chunk-LC34UPDQ.js} +2 -2
  24. package/dist/{chunk-UW54ACTR.js → chunk-LE6TQVXF.js} +2 -2
  25. package/dist/{chunk-SVGX2YBK.js → chunk-MFUJU7RO.js} +3 -3
  26. package/dist/{chunk-MO7WRW77.js → chunk-MQSSTTZU.js} +4 -4
  27. package/dist/{chunk-K7JTBFP3.js → chunk-OQR2C64M.js} +5 -5
  28. package/dist/{chunk-OFC642UR.js → chunk-P3CFDAW5.js} +2 -2
  29. package/dist/{chunk-TG23XP5G.js → chunk-PG6NTUTS.js} +8 -8
  30. package/dist/{chunk-MWPS5QGR.js → chunk-PQ3V2SYP.js} +2 -2
  31. package/dist/{chunk-IUQWX4N2.js → chunk-Q6R3JTXH.js} +3 -3
  32. package/dist/{chunk-2AWX7DYU.js → chunk-SNSV6GGV.js} +10 -10
  33. package/dist/{chunk-IT5TIGRD.js → chunk-SQPFJLCI.js} +3 -3
  34. package/dist/{chunk-CZVV33JI.js → chunk-TV6RX3ZL.js} +4 -4
  35. package/dist/{chunk-HFYXNFXG.js → chunk-TYIIAIXA.js} +7 -7
  36. package/dist/{chunk-VSVDAN2A.js → chunk-VH4T4O5L.js} +2 -2
  37. package/dist/{chunk-FSCDQZ2A.js → chunk-WWBYNWYB.js} +4 -4
  38. package/dist/{chunk-4IKJME6O.js → chunk-YE3T4X2U.js} +4 -4
  39. package/dist/{chunk-PEVU52PM.js → chunk-YSEMHACQ.js} +36 -36
  40. package/dist/{cli-circuit-breaker-KBPM3UE7.js → cli-circuit-breaker-HWMTEEYI.js} +5 -5
  41. package/dist/{cli-readiness-5WZ4ASF5.js → cli-readiness-6C6E2T2O.js} +9 -9
  42. package/dist/{cli-server-gateway-J6SKTZVM.js → cli-server-gateway-HHRF22EB.js} +14 -14
  43. package/dist/cli.js +505 -409
  44. package/dist/cli.js.map +1 -1
  45. package/dist/{composite-router-H75KI2RS.js → composite-router-CX2W7RVA.js} +4 -4
  46. package/dist/{consensus-vote-YO6MOHVG.js → consensus-vote-CQGIWMYY.js} +17 -17
  47. package/dist/{context-retriever-R3YJAG7F.js → context-retriever-G4LMWEN5.js} +10 -10
  48. package/dist/{doctor-deep-IGFWT3TZ.js → doctor-deep-VOX7KVGK.js} +5 -5
  49. package/dist/{doctor-gateway-report-DPTKEJA7.js → doctor-gateway-report-GMYX62JU.js} +7 -7
  50. package/dist/{doctor-live-BE6JTA3J.js → doctor-live-AES3PON5.js} +14 -14
  51. package/dist/{expert-bridge-2FHVYPMM.js → expert-bridge-WEZXYIGA.js} +6 -6
  52. package/dist/{factory-AEKU72IJ.js → factory-L2DIM3PM.js} +7 -7
  53. package/dist/{factory-FOQWD6AW.js → factory-L6CLXVPW.js} +13 -13
  54. package/dist/{gemini-adapter-MSTCCLDO.js → gemini-adapter-CL7YW7UZ.js} +8 -8
  55. package/dist/{improvement-review-3I2L2PBA.js → improvement-review-EBC3I55P.js} +6 -6
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +27 -27
  58. package/dist/{init-opencode-5CFNILZP.js → init-opencode-F6FV63VR.js} +6 -6
  59. package/dist/{issue-triage-ZO7YSQ5O.js → issue-triage-3EJ5DSGG.js} +7 -7
  60. package/dist/{model-config-helpers-253O7ABU.js → model-config-helpers-27GO3OEU.js} +3 -3
  61. package/dist/{openai-compat-adapter-HZGCBWE5.js → openai-compat-adapter-JJD7VWZC.js} +6 -6
  62. package/dist/{pr-reviewer-helpers-NQ3YK7PL.js → pr-reviewer-helpers-KGGKESLT.js} +5 -5
  63. package/dist/{registry-command-7U5HC6NB.js → registry-command-SQQNXDGS.js} +2 -2
  64. package/dist/{repo-security-plan-3BD76WQZ.js → repo-security-plan-CIGD7QBY.js} +4 -4
  65. package/dist/{research-helpers-synthesize-ZSCC5GNR.js → research-helpers-synthesize-HAQSK2RL.js} +6 -6
  66. package/dist/{routing-memory-BZF7JDET.js → routing-memory-AFHV5NDT.js} +4 -4
  67. package/dist/{session-memory-MF5D2MXZ.js → session-memory-RBY5SHFK.js} +5 -5
  68. package/dist/{setup-config-E3TNM4HV.js → setup-config-47NNRD4E.js} +5 -5
  69. package/dist/{setup-custom-api-6X6FUHNV.js → setup-custom-api-H74QY7EM.js} +5 -5
  70. package/dist/{tool-memory-A6XPMC7X.js → tool-memory-QESESDGS.js} +7 -7
  71. package/dist/{unified-registry-VMT3VCHF.js → unified-registry-HWZRXFQ6.js} +13 -13
  72. package/dist/{weather-report-5AUOIJSP.js → weather-report-QZLXDT5L.js} +4 -4
  73. package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  74. package/node_modules/@protobufjs/aspromise/README.md +13 -0
  75. package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
  76. package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
  77. package/node_modules/@protobufjs/aspromise/package.json +21 -0
  78. package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  79. package/node_modules/@protobufjs/base64/LICENSE +26 -0
  80. package/node_modules/@protobufjs/base64/README.md +19 -0
  81. package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
  82. package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
  83. package/node_modules/@protobufjs/base64/package.json +21 -0
  84. package/node_modules/@protobufjs/base64/tests/index.js +46 -0
  85. package/node_modules/@protobufjs/codegen/LICENSE +26 -0
  86. package/node_modules/@protobufjs/codegen/README.md +49 -0
  87. package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
  88. package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -120
  89. package/node_modules/@protobufjs/codegen/package.json +13 -0
  90. package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  91. package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
  92. package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  93. package/node_modules/@protobufjs/eventemitter/README.md +22 -0
  94. package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
  95. package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
  96. package/node_modules/@protobufjs/eventemitter/package.json +21 -0
  97. package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
  98. package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  99. package/node_modules/@protobufjs/fetch/LICENSE +26 -0
  100. package/node_modules/@protobufjs/fetch/README.md +13 -0
  101. package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
  102. package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
  103. package/node_modules/@protobufjs/fetch/package.json +27 -0
  104. package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  105. package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
  106. package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  107. package/node_modules/@protobufjs/float/LICENSE +26 -0
  108. package/node_modules/@protobufjs/float/README.md +102 -0
  109. package/node_modules/@protobufjs/float/bench/index.js +87 -0
  110. package/node_modules/@protobufjs/float/bench/suite.js +46 -0
  111. package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
  112. package/node_modules/@protobufjs/float/package.json +26 -0
  113. package/node_modules/@protobufjs/float/tests/index.js +100 -0
  114. package/node_modules/@protobufjs/path/LICENSE +26 -0
  115. package/node_modules/@protobufjs/path/README.md +19 -0
  116. package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
  117. package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -100
  118. package/node_modules/@protobufjs/path/package.json +21 -0
  119. package/node_modules/@protobufjs/path/tests/index.js +60 -0
  120. package/node_modules/@protobufjs/pool/.npmignore +3 -0
  121. package/node_modules/@protobufjs/pool/LICENSE +26 -0
  122. package/node_modules/@protobufjs/pool/README.md +13 -0
  123. package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
  124. package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
  125. package/node_modules/@protobufjs/pool/package.json +21 -0
  126. package/node_modules/@protobufjs/pool/tests/index.js +33 -0
  127. package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
  128. package/node_modules/@protobufjs/utf8/LICENSE +26 -0
  129. package/node_modules/@protobufjs/utf8/README.md +20 -0
  130. package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
  131. package/node_modules/@protobufjs/utf8/index.js +115 -0
  132. package/node_modules/@protobufjs/utf8/package.json +21 -0
  133. package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
  134. package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  135. package/node_modules/@protobufjs/utf8/tests/index.js +79 -0
  136. package/node_modules/@types/node/LICENSE +21 -0
  137. package/node_modules/@types/node/README.md +15 -0
  138. package/node_modules/@types/node/assert/strict.d.ts +68 -0
  139. package/node_modules/@types/node/assert.d.ts +1077 -0
  140. package/node_modules/@types/node/async_hooks.d.ts +711 -0
  141. package/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  142. package/node_modules/@types/node/buffer.d.ts +1800 -0
  143. package/node_modules/@types/node/child_process.d.ts +1361 -0
  144. package/node_modules/@types/node/cluster.d.ts +432 -0
  145. package/node_modules/@types/node/console.d.ts +93 -0
  146. package/node_modules/@types/node/constants.d.ts +14 -0
  147. package/node_modules/@types/node/crypto.d.ts +3964 -0
  148. package/node_modules/@types/node/dgram.d.ts +652 -0
  149. package/node_modules/@types/node/diagnostics_channel.d.ts +794 -0
  150. package/node_modules/@types/node/dns/promises.d.ts +497 -0
  151. package/node_modules/@types/node/dns.d.ts +876 -0
  152. package/node_modules/@types/node/domain.d.ts +150 -0
  153. package/node_modules/@types/node/events.d.ts +1008 -0
  154. package/node_modules/@types/node/ffi.d.ts +500 -0
  155. package/node_modules/@types/node/fs/promises.d.ts +1477 -0
  156. package/node_modules/@types/node/fs.d.ts +4803 -0
  157. package/node_modules/@types/node/globals.d.ts +150 -0
  158. package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  159. package/node_modules/@types/node/http.d.ts +2218 -0
  160. package/node_modules/@types/node/http2.d.ts +2498 -0
  161. package/node_modules/@types/node/https.d.ts +400 -0
  162. package/node_modules/@types/node/index.d.ts +116 -0
  163. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  164. package/node_modules/@types/node/inspector.d.ts +265 -0
  165. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  166. package/node_modules/@types/node/module.d.ts +726 -0
  167. package/node_modules/@types/node/net.d.ts +1074 -0
  168. package/node_modules/@types/node/os.d.ts +498 -0
  169. package/node_modules/@types/node/package.json +140 -0
  170. package/node_modules/@types/node/path/posix.d.ts +8 -0
  171. package/node_modules/@types/node/path/win32.d.ts +8 -0
  172. package/node_modules/@types/node/path.d.ts +178 -0
  173. package/node_modules/@types/node/perf_hooks.d.ts +617 -0
  174. package/node_modules/@types/node/process.d.ts +2269 -0
  175. package/node_modules/@types/node/punycode.d.ts +89 -0
  176. package/node_modules/@types/node/querystring.d.ts +139 -0
  177. package/node_modules/@types/node/quic.d.ts +2191 -0
  178. package/node_modules/@types/node/readline/promises.d.ts +158 -0
  179. package/node_modules/@types/node/readline.d.ts +508 -0
  180. package/node_modules/@types/node/repl.d.ts +420 -0
  181. package/node_modules/@types/node/sea.d.ts +47 -0
  182. package/node_modules/@types/node/sqlite.d.ts +1140 -0
  183. package/node_modules/@types/node/stream/consumers.d.ts +114 -0
  184. package/node_modules/@types/node/stream/iter.d.ts +449 -0
  185. package/node_modules/@types/node/stream/promises.d.ts +211 -0
  186. package/node_modules/@types/node/stream/web.d.ts +320 -0
  187. package/node_modules/@types/node/stream.d.ts +1806 -0
  188. package/node_modules/@types/node/string_decoder.d.ts +27 -0
  189. package/node_modules/@types/node/test/reporters.d.ts +60 -0
  190. package/node_modules/@types/node/test.d.ts +2558 -0
  191. package/node_modules/@types/node/timers/promises.d.ts +93 -0
  192. package/node_modules/@types/node/timers.d.ts +149 -0
  193. package/node_modules/@types/node/tls.d.ts +1232 -0
  194. package/node_modules/@types/node/trace_events.d.ts +103 -0
  195. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +467 -0
  196. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  197. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  198. package/node_modules/@types/node/ts5.6/index.d.ts +118 -0
  199. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  200. package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  201. package/node_modules/@types/node/tty.d.ts +226 -0
  202. package/node_modules/@types/node/url.d.ts +556 -0
  203. package/node_modules/@types/node/util/types.d.ts +558 -0
  204. package/node_modules/@types/node/util.d.ts +1680 -0
  205. package/node_modules/@types/node/v8.d.ts +1059 -0
  206. package/node_modules/@types/node/vfs.d.ts +211 -0
  207. package/node_modules/@types/node/vm.d.ts +1137 -0
  208. package/node_modules/@types/node/wasi.d.ts +131 -0
  209. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  210. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  211. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  212. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  213. package/node_modules/@types/node/web-globals/domexception.d.ts +83 -0
  214. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  215. package/node_modules/@types/node/web-globals/events.d.ts +106 -0
  216. package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  217. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  218. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  219. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  220. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  221. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  222. package/node_modules/@types/node/web-globals/streams.d.ts +119 -0
  223. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  224. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  225. package/node_modules/@types/node/worker_threads.d.ts +672 -0
  226. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  227. package/node_modules/@types/node/zlib.d.ts +612 -0
  228. package/node_modules/fast-uri/.github/dependabot.yml +2 -42
  229. package/node_modules/fast-uri/.github/workflows/ci.yml +6 -54
  230. package/node_modules/fast-uri/.github/workflows/lock-threads.yml +1 -1
  231. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
  232. package/node_modules/fast-uri/.github/workflows/release.yml +2 -1
  233. package/node_modules/fast-uri/README.md +10 -12
  234. package/node_modules/fast-uri/benchmark/benchmark.mjs +0 -71
  235. package/node_modules/fast-uri/index.js +20 -94
  236. package/node_modules/fast-uri/lib/schemes.js +4 -439
  237. package/node_modules/fast-uri/lib/utils.js +113 -230
  238. package/node_modules/fast-uri/package.json +5 -5
  239. package/node_modules/fast-uri/test/equal.test.js +0 -63
  240. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +1 -23
  241. package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +1 -23
  242. package/node_modules/fast-uri/test/ipv6-validation.test.js +0 -160
  243. package/node_modules/fast-uri/test/parse.test.js +5 -150
  244. package/node_modules/fast-uri/test/relative-normalization-security.test.js +4 -0
  245. package/node_modules/fast-uri/test/scheme-validation.test.js +5 -3
  246. package/node_modules/fast-uri/test/security.test.js +2 -2
  247. package/node_modules/fast-uri/test/serialize.test.js +0 -144
  248. package/node_modules/fast-uri/test/uri-js-compatibility.test.js +3 -0
  249. package/node_modules/fast-uri/test/uri-js.test.js +9 -11
  250. package/node_modules/fast-uri/test/urn-full-input.test.js +0 -18
  251. package/node_modules/fast-uri/test/util.test.js +0 -9
  252. package/node_modules/fast-uri/tsconfig.json +7 -8
  253. package/node_modules/fast-uri/types/index.d.ts +9 -20
  254. package/node_modules/fast-uri/types/index.test-d.ts +17 -0
  255. package/node_modules/hono/README.md +2 -3
  256. package/node_modules/hono/dist/cjs/helper/css/common.js +8 -3
  257. package/node_modules/hono/dist/cjs/helper/css/index.js +1 -1
  258. package/node_modules/hono/dist/cjs/helper/route/index.js +3 -1
  259. package/node_modules/hono/dist/cjs/jsx/base.js +1 -1
  260. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +8 -0
  261. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +3 -1
  262. package/node_modules/hono/dist/cjs/router/trie-router/node.js +2 -2
  263. package/node_modules/hono/dist/cjs/utils/url.js +11 -6
  264. package/node_modules/hono/dist/helper/css/common.js +8 -3
  265. package/node_modules/hono/dist/helper/css/index.js +1 -1
  266. package/node_modules/hono/dist/helper/route/index.js +3 -1
  267. package/node_modules/hono/dist/jsx/base.js +1 -1
  268. package/node_modules/hono/dist/middleware/bearer-auth/index.js +8 -0
  269. package/node_modules/hono/dist/middleware/serve-static/index.js +3 -1
  270. package/node_modules/hono/dist/router/trie-router/node.js +2 -2
  271. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +1 -1
  272. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +1 -1
  273. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +1 -1
  274. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +1 -1
  275. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +1 -1
  276. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +1 -1
  277. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +1 -1
  278. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +1 -1
  279. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +1 -1
  280. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +1 -1
  281. package/node_modules/hono/dist/types/helper/testing/index.d.ts +2 -1
  282. package/node_modules/hono/dist/types/hono-base.d.ts +21 -9
  283. package/node_modules/hono/dist/types/index.d.ts +1 -1
  284. package/node_modules/hono/dist/types/jsx/components.d.ts +2 -2
  285. package/node_modules/hono/dist/types/jsx/context.d.ts +2 -2
  286. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +2 -2
  287. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +2 -2
  288. package/node_modules/hono/dist/types/jsx/streaming.d.ts +4 -3
  289. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +2 -1
  290. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +3 -3
  291. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +3 -3
  292. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +1 -1
  293. package/node_modules/hono/dist/utils/url.js +11 -6
  294. package/node_modules/hono/package.json +1 -1
  295. package/node_modules/path-to-regexp/Readme.md +7 -1
  296. package/node_modules/path-to-regexp/dist/index.d.ts +12 -7
  297. package/node_modules/path-to-regexp/dist/index.js +99 -99
  298. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  299. package/node_modules/path-to-regexp/package.json +8 -9
  300. package/node_modules/protobufjs/README.md +562 -259
  301. package/node_modules/protobufjs/dist/light/protobuf.js +1915 -3267
  302. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  303. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  304. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  305. package/node_modules/protobufjs/dist/minimal/protobuf.js +1173 -2018
  306. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  307. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  308. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  309. package/node_modules/protobufjs/dist/protobuf.js +1982 -3483
  310. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  311. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  312. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  313. package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
  314. package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
  315. package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
  316. package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  317. package/node_modules/protobufjs/google/api/annotations.json +1 -3
  318. package/node_modules/protobufjs/google/api/http.json +1 -2
  319. package/node_modules/protobufjs/google/protobuf/api.json +6 -12
  320. package/node_modules/protobufjs/google/protobuf/descriptor.json +88 -194
  321. package/node_modules/protobufjs/google/protobuf/descriptor.proto +9 -15
  322. package/node_modules/protobufjs/google/protobuf/source_context.json +1 -2
  323. package/node_modules/protobufjs/google/protobuf/type.json +7 -14
  324. package/node_modules/protobufjs/index.d.ts +685 -1077
  325. package/node_modules/protobufjs/package.json +51 -25
  326. package/node_modules/protobufjs/scripts/postinstall.js +32 -0
  327. package/node_modules/protobufjs/src/common.js +8 -14
  328. package/node_modules/protobufjs/src/converter.js +52 -90
  329. package/node_modules/protobufjs/src/decoder.js +67 -211
  330. package/node_modules/protobufjs/src/encoder.js +7 -27
  331. package/node_modules/protobufjs/src/enum.js +7 -33
  332. package/node_modules/protobufjs/src/field.js +20 -77
  333. package/node_modules/protobufjs/src/index-light.js +29 -29
  334. package/node_modules/protobufjs/src/index-minimal.js +13 -12
  335. package/node_modules/protobufjs/src/index.js +6 -6
  336. package/node_modules/protobufjs/src/mapfield.js +8 -26
  337. package/node_modules/protobufjs/src/message.js +11 -5
  338. package/node_modules/protobufjs/src/method.js +7 -30
  339. package/node_modules/protobufjs/src/namespace.js +10 -26
  340. package/node_modules/protobufjs/src/object.js +31 -44
  341. package/node_modules/protobufjs/src/oneof.js +1 -12
  342. package/node_modules/protobufjs/src/parse.js +67 -194
  343. package/node_modules/protobufjs/src/reader.js +58 -520
  344. package/node_modules/protobufjs/src/reader_buffer.js +5 -31
  345. package/node_modules/protobufjs/src/root.js +4 -16
  346. package/node_modules/protobufjs/src/rpc/service.js +5 -18
  347. package/node_modules/protobufjs/src/service.js +2 -15
  348. package/node_modules/protobufjs/src/tokenize.js +4 -20
  349. package/node_modules/protobufjs/src/type.js +37 -91
  350. package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  351. package/node_modules/protobufjs/src/util/longbits.js +6 -10
  352. package/node_modules/protobufjs/src/util/minimal.js +51 -71
  353. package/node_modules/protobufjs/src/util.js +17 -51
  354. package/node_modules/protobufjs/src/verifier.js +14 -19
  355. package/node_modules/protobufjs/src/wrappers.js +3 -2
  356. package/node_modules/protobufjs/src/writer.js +189 -428
  357. package/node_modules/protobufjs/src/writer_buffer.js +26 -41
  358. package/node_modules/protobufjs/tsconfig.json +5 -3
  359. package/node_modules/undici-types/LICENSE +21 -0
  360. package/node_modules/undici-types/README.md +6 -0
  361. package/node_modules/undici-types/agent.d.ts +30 -0
  362. package/node_modules/undici-types/api.d.ts +43 -0
  363. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  364. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  365. package/node_modules/undici-types/cache.d.ts +36 -0
  366. package/node_modules/undici-types/client-stats.d.ts +15 -0
  367. package/node_modules/undici-types/client.d.ts +134 -0
  368. package/node_modules/undici-types/connector.d.ts +37 -0
  369. package/node_modules/undici-types/content-type.d.ts +21 -0
  370. package/node_modules/undici-types/cookies.d.ts +30 -0
  371. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  372. package/node_modules/undici-types/dispatcher.d.ts +253 -0
  373. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  374. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  375. package/node_modules/undici-types/errors.d.ts +187 -0
  376. package/node_modules/undici-types/eventsource.d.ts +66 -0
  377. package/node_modules/undici-types/fetch.d.ts +235 -0
  378. package/node_modules/undici-types/formdata.d.ts +108 -0
  379. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  380. package/node_modules/undici-types/global-origin.d.ts +7 -0
  381. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  382. package/node_modules/undici-types/handlers.d.ts +16 -0
  383. package/node_modules/undici-types/header.d.ts +165 -0
  384. package/node_modules/undici-types/index.d.ts +93 -0
  385. package/node_modules/undici-types/interceptors.d.ts +80 -0
  386. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  387. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  388. package/node_modules/undici-types/mock-client.d.ts +27 -0
  389. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  390. package/node_modules/undici-types/mock-interceptor.d.ts +98 -0
  391. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  392. package/node_modules/undici-types/package.json +55 -0
  393. package/node_modules/undici-types/patch.d.ts +29 -0
  394. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  395. package/node_modules/undici-types/pool.d.ts +39 -0
  396. package/node_modules/undici-types/proxy-agent.d.ts +36 -0
  397. package/node_modules/undici-types/readable.d.ts +68 -0
  398. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  399. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  400. package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  401. package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  402. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  403. package/node_modules/undici-types/util.d.ts +18 -0
  404. package/node_modules/undici-types/utility.d.ts +7 -0
  405. package/node_modules/undici-types/webidl.d.ts +346 -0
  406. package/node_modules/undici-types/websocket.d.ts +188 -0
  407. package/package.json +16 -4
  408. package/dist/chunk-2FOPXY3L.js.map +0 -1
  409. package/dist/chunk-IIUEAOTT.js.map +0 -1
  410. package/dist/chunk-TKF3X3RI.js.map +0 -1
  411. package/node_modules/fast-uri/.github/workflows/ossf-scorecard.yml +0 -45
  412. package/node_modules/fast-uri/SECURITY.md +0 -222
  413. package/node_modules/fast-uri/benchmark/encoder.mjs +0 -54
  414. package/node_modules/fast-uri/test/c0-reference-security.test.js +0 -137
  415. package/node_modules/fast-uri/test/host-encoding.test.js +0 -60
  416. package/node_modules/fast-uri/test/mailto-authority-security.test.js +0 -125
  417. package/node_modules/fast-uri/test/mailto-field-name-security.test.js +0 -151
  418. package/node_modules/fast-uri/test/scheme-normalization.test.js +0 -16
  419. package/node_modules/fast-uri/test/security-utf8-encoding.test.js +0 -0
  420. package/node_modules/fast-uri/types/index.tst.ts +0 -31
  421. package/node_modules/protobufjs/ext/README.md +0 -70
  422. package/node_modules/protobufjs/ext/descriptor.d.ts +0 -87
  423. package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -424
  424. package/node_modules/protobufjs/ext/descriptor.js +0 -1405
  425. package/node_modules/protobufjs/ext/protojson.LICENSE +0 -201
  426. package/node_modules/protobufjs/ext/protojson.d.ts +0 -20
  427. package/node_modules/protobufjs/ext/protojson.generated.d.ts +0 -49
  428. package/node_modules/protobufjs/ext/protojson.js +0 -972
  429. package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
  430. package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -33
  431. package/node_modules/protobufjs/ext/textformat.js +0 -1280
  432. package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
  433. package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
  434. package/node_modules/protobufjs/google/protobuf/json_enumvalue_options.json +0 -56
  435. package/node_modules/protobufjs/google/protobuf/json_enumvalue_options.proto +0 -31
  436. package/node_modules/protobufjs/src/typescript.js +0 -25
  437. package/node_modules/protobufjs/src/util/utf8.js +0 -164
  438. /package/dist/{ast-rule-runner-3DNARGI6.js.map → ast-rule-runner-2PEUHSHO.js.map} +0 -0
  439. /package/dist/{child-mcp-config-JDA622RX.js.map → child-mcp-config-AYVMLJDV.js.map} +0 -0
  440. /package/dist/{chunk-IXL2W6E3.js.map → chunk-236T3AOZ.js.map} +0 -0
  441. /package/dist/{chunk-OVVJGCB7.js.map → chunk-5QNWRC7B.js.map} +0 -0
  442. /package/dist/{chunk-P4L4CEJX.js.map → chunk-B5RDZLU3.js.map} +0 -0
  443. /package/dist/{chunk-IMRAE2LB.js.map → chunk-CZSEUZFE.js.map} +0 -0
  444. /package/dist/{chunk-OAX3TSGU.js.map → chunk-DCPN7F5J.js.map} +0 -0
  445. /package/dist/{chunk-O3D6HEXJ.js.map → chunk-DXDKAVWV.js.map} +0 -0
  446. /package/dist/{chunk-O6SI3EVF.js.map → chunk-FEAWCZ7E.js.map} +0 -0
  447. /package/dist/{chunk-RTO52ZBC.js.map → chunk-GPZQVYKV.js.map} +0 -0
  448. /package/dist/{chunk-NZDRN4NL.js.map → chunk-H6SGSQJM.js.map} +0 -0
  449. /package/dist/{chunk-V3X7QGN3.js.map → chunk-JV3UBRRA.js.map} +0 -0
  450. /package/dist/{chunk-2UWQ2GEG.js.map → chunk-KXWLZDQR.js.map} +0 -0
  451. /package/dist/{chunk-QSABRS3I.js.map → chunk-LBVPKHHU.js.map} +0 -0
  452. /package/dist/{chunk-UZ3KUNPN.js.map → chunk-LC34UPDQ.js.map} +0 -0
  453. /package/dist/{chunk-UW54ACTR.js.map → chunk-LE6TQVXF.js.map} +0 -0
  454. /package/dist/{chunk-SVGX2YBK.js.map → chunk-MFUJU7RO.js.map} +0 -0
  455. /package/dist/{chunk-MO7WRW77.js.map → chunk-MQSSTTZU.js.map} +0 -0
  456. /package/dist/{chunk-K7JTBFP3.js.map → chunk-OQR2C64M.js.map} +0 -0
  457. /package/dist/{chunk-OFC642UR.js.map → chunk-P3CFDAW5.js.map} +0 -0
  458. /package/dist/{chunk-TG23XP5G.js.map → chunk-PG6NTUTS.js.map} +0 -0
  459. /package/dist/{chunk-MWPS5QGR.js.map → chunk-PQ3V2SYP.js.map} +0 -0
  460. /package/dist/{chunk-IUQWX4N2.js.map → chunk-Q6R3JTXH.js.map} +0 -0
  461. /package/dist/{chunk-2AWX7DYU.js.map → chunk-SNSV6GGV.js.map} +0 -0
  462. /package/dist/{chunk-IT5TIGRD.js.map → chunk-SQPFJLCI.js.map} +0 -0
  463. /package/dist/{chunk-CZVV33JI.js.map → chunk-TV6RX3ZL.js.map} +0 -0
  464. /package/dist/{chunk-HFYXNFXG.js.map → chunk-TYIIAIXA.js.map} +0 -0
  465. /package/dist/{chunk-VSVDAN2A.js.map → chunk-VH4T4O5L.js.map} +0 -0
  466. /package/dist/{chunk-FSCDQZ2A.js.map → chunk-WWBYNWYB.js.map} +0 -0
  467. /package/dist/{chunk-4IKJME6O.js.map → chunk-YE3T4X2U.js.map} +0 -0
  468. /package/dist/{chunk-PEVU52PM.js.map → chunk-YSEMHACQ.js.map} +0 -0
  469. /package/dist/{cli-circuit-breaker-KBPM3UE7.js.map → cli-circuit-breaker-HWMTEEYI.js.map} +0 -0
  470. /package/dist/{cli-readiness-5WZ4ASF5.js.map → cli-readiness-6C6E2T2O.js.map} +0 -0
  471. /package/dist/{cli-server-gateway-J6SKTZVM.js.map → cli-server-gateway-HHRF22EB.js.map} +0 -0
  472. /package/dist/{composite-router-H75KI2RS.js.map → composite-router-CX2W7RVA.js.map} +0 -0
  473. /package/dist/{consensus-vote-YO6MOHVG.js.map → consensus-vote-CQGIWMYY.js.map} +0 -0
  474. /package/dist/{context-retriever-R3YJAG7F.js.map → context-retriever-G4LMWEN5.js.map} +0 -0
  475. /package/dist/{doctor-deep-IGFWT3TZ.js.map → doctor-deep-VOX7KVGK.js.map} +0 -0
  476. /package/dist/{doctor-gateway-report-DPTKEJA7.js.map → doctor-gateway-report-GMYX62JU.js.map} +0 -0
  477. /package/dist/{doctor-live-BE6JTA3J.js.map → doctor-live-AES3PON5.js.map} +0 -0
  478. /package/dist/{expert-bridge-2FHVYPMM.js.map → expert-bridge-WEZXYIGA.js.map} +0 -0
  479. /package/dist/{factory-AEKU72IJ.js.map → factory-L2DIM3PM.js.map} +0 -0
  480. /package/dist/{factory-FOQWD6AW.js.map → factory-L6CLXVPW.js.map} +0 -0
  481. /package/dist/{gemini-adapter-MSTCCLDO.js.map → gemini-adapter-CL7YW7UZ.js.map} +0 -0
  482. /package/dist/{improvement-review-3I2L2PBA.js.map → improvement-review-EBC3I55P.js.map} +0 -0
  483. /package/dist/{init-opencode-5CFNILZP.js.map → init-opencode-F6FV63VR.js.map} +0 -0
  484. /package/dist/{issue-triage-ZO7YSQ5O.js.map → issue-triage-3EJ5DSGG.js.map} +0 -0
  485. /package/dist/{model-config-helpers-253O7ABU.js.map → model-config-helpers-27GO3OEU.js.map} +0 -0
  486. /package/dist/{openai-compat-adapter-HZGCBWE5.js.map → openai-compat-adapter-JJD7VWZC.js.map} +0 -0
  487. /package/dist/{pr-reviewer-helpers-NQ3YK7PL.js.map → pr-reviewer-helpers-KGGKESLT.js.map} +0 -0
  488. /package/dist/{registry-command-7U5HC6NB.js.map → registry-command-SQQNXDGS.js.map} +0 -0
  489. /package/dist/{repo-security-plan-3BD76WQZ.js.map → repo-security-plan-CIGD7QBY.js.map} +0 -0
  490. /package/dist/{research-helpers-synthesize-ZSCC5GNR.js.map → research-helpers-synthesize-HAQSK2RL.js.map} +0 -0
  491. /package/dist/{routing-memory-BZF7JDET.js.map → routing-memory-AFHV5NDT.js.map} +0 -0
  492. /package/dist/{session-memory-MF5D2MXZ.js.map → session-memory-RBY5SHFK.js.map} +0 -0
  493. /package/dist/{setup-config-E3TNM4HV.js.map → setup-config-47NNRD4E.js.map} +0 -0
  494. /package/dist/{setup-custom-api-6X6FUHNV.js.map → setup-custom-api-H74QY7EM.js.map} +0 -0
  495. /package/dist/{tool-memory-A6XPMC7X.js.map → tool-memory-QESESDGS.js.map} +0 -0
  496. /package/dist/{unified-registry-VMT3VCHF.js.map → unified-registry-HWZRXFQ6.js.map} +0 -0
  497. /package/dist/{weather-report-5AUOIJSP.js.map → weather-report-QZLXDT5L.js.map} +0 -0
  498. /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 source file instead and regenerate.
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
 
@@ -100,11 +100,6 @@ export namespace common {
100
100
  value?: Uint8Array;
101
101
  }
102
102
 
103
- /** Properties of a google.protobuf.FieldMask message. */
104
- interface IFieldMask {
105
- paths?: string[];
106
- }
107
-
108
103
  /**
109
104
  * Gets the root definition of the specified common proto file.
110
105
  *
@@ -167,31 +162,28 @@ export class Enum extends ReflectionObject {
167
162
  * @param [comments] The value comments for this enum
168
163
  * @param [valuesOptions] The value options for this enum
169
164
  */
170
- constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }, comment?: string, comments?: { [k: string]: (string|null) }, valuesOptions?: ({ [k: string]: { [k: string]: any } }|undefined));
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));
171
166
 
172
167
  /** Enum values by id. */
173
- valuesById: { [k: number]: string };
168
+ public valuesById: { [k: number]: string };
174
169
 
175
170
  /** Enum values by name. */
176
- values: { [k: string]: number };
171
+ public values: { [k: string]: number };
177
172
 
178
173
  /** Enum comment text. */
179
- comment: (string|null);
174
+ public comment: (string|null);
180
175
 
181
176
  /** Value comment texts, if any. */
182
- comments: { [k: string]: (string|null) };
177
+ public comments: { [k: string]: string };
183
178
 
184
179
  /** Values options, if any */
185
- valuesOptions?: { [k: string]: { [k: string]: any } };
180
+ public valuesOptions?: { [k: string]: { [k: string]: any } };
186
181
 
187
182
  /** Resolved values features, if any */
188
- _valuesFeatures?: { [k: string]: { [k: string]: any } };
183
+ public _valuesFeatures?: { [k: string]: { [k: string]: any } };
189
184
 
190
185
  /** Reserved ranges, if any. */
191
- reserved: (number[]|string)[];
192
-
193
- /** Declared symbol visibility, if any. */
194
- visibility?: ("local"|"export");
186
+ public reserved: (number[]|string)[];
195
187
 
196
188
  /**
197
189
  * Constructs an enum from an enum descriptor.
@@ -200,14 +192,14 @@ export class Enum extends ReflectionObject {
200
192
  * @returns Created enum
201
193
  * @throws {TypeError} If arguments are invalid
202
194
  */
203
- static fromJSON(name: string, json: IEnum): Enum;
195
+ public static fromJSON(name: string, json: IEnum): Enum;
204
196
 
205
197
  /**
206
198
  * Converts this enum to an enum descriptor.
207
199
  * @param [toJSONOptions] JSON conversion options
208
200
  * @returns Enum descriptor
209
201
  */
210
- toJSON(toJSONOptions?: IToJSONOptions): IEnum;
202
+ public toJSON(toJSONOptions?: IToJSONOptions): IEnum;
211
203
 
212
204
  /**
213
205
  * Adds a value to this enum.
@@ -219,7 +211,7 @@ export class Enum extends ReflectionObject {
219
211
  * @throws {TypeError} If arguments are invalid
220
212
  * @throws {Error} If there is already a value with this name or id
221
213
  */
222
- 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;
223
215
 
224
216
  /**
225
217
  * Removes a value from this enum
@@ -228,49 +220,31 @@ export class Enum extends ReflectionObject {
228
220
  * @throws {TypeError} If arguments are invalid
229
221
  * @throws {Error} If `name` is not a name of this enum
230
222
  */
231
- remove(name: string): Enum;
223
+ public remove(name: string): Enum;
232
224
 
233
225
  /**
234
226
  * Tests if the specified id is reserved.
235
227
  * @param id Id to test
236
228
  * @returns `true` if reserved, otherwise `false`
237
229
  */
238
- isReservedId(id: number): boolean;
230
+ public isReservedId(id: number): boolean;
239
231
 
240
232
  /**
241
233
  * Tests if the specified name is reserved.
242
234
  * @param name Name to test
243
235
  * @returns `true` if reserved, otherwise `false`
244
236
  */
245
- isReservedName(name: string): boolean;
237
+ public isReservedName(name: string): boolean;
246
238
  }
247
239
 
248
240
  /** Enum descriptor. */
249
241
  export interface IEnum {
250
242
 
251
- /** Edition */
252
- edition?: string;
253
-
254
243
  /** Enum values */
255
244
  values: { [k: string]: number };
256
245
 
257
246
  /** Enum options */
258
247
  options?: { [k: string]: any };
259
-
260
- /** Enum value options */
261
- valuesOptions?: { [k: string]: { [k: string]: any } };
262
-
263
- /** Reserved ranges */
264
- reserved?: (number[]|string)[];
265
-
266
- /** Declared symbol visibility */
267
- visibility?: ("local"|"export");
268
-
269
- /** Enum comment */
270
- comment?: (string|null);
271
-
272
- /** Value comments */
273
- comments?: { [k: string]: (string|null) };
274
248
  }
275
249
 
276
250
  /** Reflected message field. */
@@ -287,16 +261,6 @@ export class Field extends FieldBase {
287
261
  */
288
262
  constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any });
289
263
 
290
- /**
291
- * Field decorator (TypeScript).
292
- * @param fieldId Field id
293
- * @param fieldType Field type
294
- * @param [fieldRule="optional"] Field rule
295
- * @returns Decorator function
296
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
297
- */
298
- static d<T extends Message<T>>(fieldId: number, fieldType: (Constructor<T>|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator;
299
-
300
264
  /**
301
265
  * Constructs a field from a field descriptor.
302
266
  * @param name Field name
@@ -304,48 +268,44 @@ export class Field extends FieldBase {
304
268
  * @returns Created field
305
269
  * @throws {TypeError} If arguments are invalid
306
270
  */
307
- static fromJSON(name: string, json: IField): Field;
271
+ public static fromJSON(name: string, json: IField): Field;
308
272
 
309
273
  /** Determines whether this field is required. */
310
- readonly required: boolean;
274
+ public readonly required: boolean;
311
275
 
312
276
  /** Determines whether this field is not required. */
313
- readonly optional: boolean;
277
+ public readonly optional: boolean;
314
278
 
315
279
  /**
316
280
  * Determines whether this field uses tag-delimited encoding. In proto2 this
317
281
  * corresponded to group syntax.
318
282
  */
319
- readonly delimited: boolean;
283
+ public readonly delimited: boolean;
320
284
 
321
285
  /** Determines whether this field is packed. Only relevant when repeated. */
322
- readonly packed: boolean;
286
+ public readonly packed: boolean;
323
287
 
324
288
  /** Determines whether this field tracks presence. */
325
- readonly hasPresence: boolean;
289
+ public readonly hasPresence: boolean;
326
290
 
327
291
  /**
328
- * The field name as declared in the .proto source (snake_case). Populated on resolve,
329
- * falling back to `name`. Mirrors `FieldDescriptorProto.name`.
330
- */
331
- readonly protoName: string;
332
-
333
- /**
334
- * The JSON name of this field (lowerCamelCase per protoc's `ToJsonName`, or an
335
- * explicit `[json_name]`). Populated on resolve. This is the key used on ProtoJSON output.
292
+ * Field decorator (TypeScript).
293
+ * @param fieldId Field id
294
+ * @param fieldType Field type
295
+ * @param [fieldRule="optional"] Field rule
296
+ * @param [defaultValue] Default value
297
+ * @returns Decorator function
336
298
  */
337
- readonly jsonName: string;
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;
338
300
 
339
301
  /**
340
302
  * Field decorator (TypeScript).
341
303
  * @param fieldId Field id
342
304
  * @param fieldType Field type
343
305
  * @param [fieldRule="optional"] Field rule
344
- * @param [defaultValue] Default value
345
306
  * @returns Decorator function
346
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
347
307
  */
348
- 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;
308
+ public static d<T extends Message<T>>(fieldId: number, fieldType: (Constructor<T>|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator;
349
309
  }
350
310
 
351
311
  /** Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. */
@@ -363,73 +323,64 @@ export class FieldBase extends ReflectionObject {
363
323
  */
364
324
  constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string);
365
325
 
366
- /** Field rule, if any. */
367
- rule?: string;
368
-
369
326
  /** Field type. */
370
- type: string;
327
+ public type: string;
371
328
 
372
329
  /** Unique field id. */
373
- id: number;
330
+ public id: number;
374
331
 
375
332
  /** Extended type if different from parent. */
376
- extend?: string;
333
+ public extend?: string;
377
334
 
378
335
  /** Whether this field is repeated. */
379
- repeated: boolean;
336
+ public repeated: boolean;
380
337
 
381
338
  /** Whether this field is a map or not. */
382
- map: boolean;
339
+ public map: boolean;
383
340
 
384
341
  /** Message this field belongs to. */
385
- message: (Type|null);
342
+ public message: (Type|null);
386
343
 
387
344
  /** OneOf this field belongs to, if any, */
388
- partOf: (OneOf|null);
345
+ public partOf: (OneOf|null);
389
346
 
390
347
  /** The field type's default value. */
391
- typeDefault: any;
348
+ public typeDefault: any;
392
349
 
393
350
  /** The field's default value on prototypes. */
394
- defaultValue: any;
351
+ public defaultValue: any;
395
352
 
396
353
  /** Whether this field's value should be treated as a long. */
397
- long: boolean;
354
+ public long: boolean;
398
355
 
399
356
  /** Whether this field's value is a buffer. */
400
- bytes: boolean;
357
+ public bytes: boolean;
401
358
 
402
359
  /** Resolved type if not a basic type. */
403
- resolvedType: (Type|Enum|null);
360
+ public resolvedType: (Type|Enum|null);
404
361
 
405
362
  /** Sister-field within the extended type if a declaring extension field. */
406
- extensionField: (Field|null);
363
+ public extensionField: (Field|null);
407
364
 
408
365
  /** Sister-field within the declaring namespace if an extended field. */
409
- declaringField: (Field|null);
366
+ public declaringField: (Field|null);
410
367
 
411
368
  /** Comment for this field. */
412
- comment: (string|null);
413
-
414
- /** Field name as declared in the .proto source, if different from `name`. */
415
- protoName?: string;
416
-
417
- /** JSON name, if different from the derived default. */
418
- jsonName?: string;
369
+ public comment: (string|null);
419
370
 
420
371
  /**
421
372
  * Converts this field to a field descriptor.
422
373
  * @param [toJSONOptions] JSON conversion options
423
374
  * @returns Field descriptor
424
375
  */
425
- toJSON(toJSONOptions?: IToJSONOptions): IField;
376
+ public toJSON(toJSONOptions?: IToJSONOptions): IField;
426
377
 
427
378
  /**
428
379
  * Resolves this field's type references.
429
380
  * @returns `this`
430
381
  * @throws {Error} If any reference cannot be resolved
431
382
  */
432
- resolve(): Field;
383
+ public resolve(): Field;
433
384
 
434
385
  /**
435
386
  * Infers field features from legacy syntax that may have been specified differently.
@@ -437,15 +388,12 @@ export class FieldBase extends ReflectionObject {
437
388
  * @param edition The edition this proto is on, or undefined if pre-editions
438
389
  * @returns The feature values to override
439
390
  */
440
- _inferLegacyProtoFeatures(edition: (string|undefined)): object;
391
+ public _inferLegacyProtoFeatures(edition: (string|undefined)): object;
441
392
  }
442
393
 
443
394
  /** Field descriptor. */
444
395
  export interface IField {
445
396
 
446
- /** Edition */
447
- edition?: string;
448
-
449
397
  /** Field rule */
450
398
  rule?: string;
451
399
 
@@ -457,9 +405,6 @@ export interface IField {
457
405
 
458
406
  /** Field options */
459
407
  options?: { [k: string]: any };
460
-
461
- /** Field comment */
462
- comment?: (string|null);
463
408
  }
464
409
 
465
410
  /** Extension field descriptor. */
@@ -473,16 +418,15 @@ export interface IExtensionField extends IField {
473
418
  * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript).
474
419
  * @param prototype Target prototype
475
420
  * @param fieldName Field name
476
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
477
421
  */
478
- export type FieldDecorator = (prototype: object, fieldName: string) => void;
422
+ type FieldDecorator = (prototype: object, fieldName: string) => void;
479
423
 
480
424
  /**
481
425
  * A node-style callback as used by {@link load} and {@link Root#load}.
482
426
  * @param error Error, if any, otherwise `null`
483
427
  * @param [root] Root, if there hasn't been an error
484
428
  */
485
- export type LoadCallback = (error: (Error|null), root?: Root) => void;
429
+ type LoadCallback = (error: (Error|null), root?: Root) => void;
486
430
 
487
431
  /**
488
432
  * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback.
@@ -541,10 +485,10 @@ export class MapField extends FieldBase {
541
485
  constructor(name: string, id: number, keyType: string, type: string, options?: { [k: string]: any }, comment?: string);
542
486
 
543
487
  /** Key type. */
544
- keyType: string;
488
+ public keyType: string;
545
489
 
546
490
  /** Resolved key type if not a basic type. */
547
- resolvedKeyType: (ReflectionObject|null);
491
+ public resolvedKeyType: (ReflectionObject|null);
548
492
 
549
493
  /**
550
494
  * Constructs a map field from a map field descriptor.
@@ -553,14 +497,14 @@ export class MapField extends FieldBase {
553
497
  * @returns Created map field
554
498
  * @throws {TypeError} If arguments are invalid
555
499
  */
556
- static fromJSON(name: string, json: IMapField): MapField;
500
+ public static fromJSON(name: string, json: IMapField): MapField;
557
501
 
558
502
  /**
559
503
  * Converts this map field to a map field descriptor.
560
504
  * @param [toJSONOptions] JSON conversion options
561
505
  * @returns Map field descriptor
562
506
  */
563
- toJSON(toJSONOptions?: IToJSONOptions): IMapField;
507
+ public toJSON(toJSONOptions?: IToJSONOptions): IMapField;
564
508
 
565
509
  /**
566
510
  * Map field decorator (TypeScript).
@@ -568,9 +512,8 @@ export class MapField extends FieldBase {
568
512
  * @param fieldKeyType Field key type
569
513
  * @param fieldValueType Field value type
570
514
  * @returns Decorator function
571
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
572
515
  */
573
- 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;
574
517
  }
575
518
 
576
519
  /** Map field descriptor. */
@@ -596,21 +539,18 @@ export class Message<T extends object = object> {
596
539
  */
597
540
  constructor(properties?: Properties<T>);
598
541
 
599
- /** Unknown fields preserved while decoding when enabled */
600
- $unknowns?: Uint8Array[];
601
-
602
542
  /** Reference to the reflected type. */
603
- static readonly $type: Type;
543
+ public static readonly $type: Type;
604
544
 
605
545
  /** Reference to the reflected type. */
606
- readonly $type: Type;
546
+ public readonly $type: Type;
607
547
 
608
548
  /**
609
549
  * Creates a new message of this type using the specified properties.
610
550
  * @param [properties] Properties to set
611
551
  * @returns Message instance
612
552
  */
613
- 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>;
614
554
 
615
555
  /**
616
556
  * Encodes a message of this type.
@@ -618,7 +558,7 @@ export class Message<T extends object = object> {
618
558
  * @param [writer] Writer to use
619
559
  * @returns Writer
620
560
  */
621
- 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;
622
562
 
623
563
  /**
624
564
  * Encodes a message of this type preceeded by its length as a varint.
@@ -626,35 +566,35 @@ export class Message<T extends object = object> {
626
566
  * @param [writer] Writer to use
627
567
  * @returns Writer
628
568
  */
629
- 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;
630
570
 
631
571
  /**
632
572
  * Decodes a message of this type.
633
573
  * @param reader Reader or buffer to decode
634
574
  * @returns Decoded message
635
575
  */
636
- 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;
637
577
 
638
578
  /**
639
579
  * Decodes a message of this type preceeded by its length as a varint.
640
580
  * @param reader Reader or buffer to decode
641
581
  * @returns Decoded message
642
582
  */
643
- 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;
644
584
 
645
585
  /**
646
586
  * Verifies a message of this type.
647
587
  * @param message Plain object to verify
648
588
  * @returns `null` if valid, otherwise the reason why it is not
649
589
  */
650
- static verify(message: { [k: string]: any }): (string|null);
590
+ public static verify(message: { [k: string]: any }): (string|null);
651
591
 
652
592
  /**
653
593
  * Creates a new message of this type from a plain object. Also converts values to their respective internal types.
654
594
  * @param object Plain object
655
595
  * @returns Message instance
656
596
  */
657
- 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;
658
598
 
659
599
  /**
660
600
  * Creates a plain object from a message of this type. Also converts values to other types if specified.
@@ -662,13 +602,13 @@ export class Message<T extends object = object> {
662
602
  * @param [options] Conversion options
663
603
  * @returns Plain object
664
604
  */
665
- 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 };
666
606
 
667
607
  /**
668
608
  * Converts this message to JSON.
669
609
  * @returns JSON object
670
610
  */
671
- toJSON(): { [k: string]: any };
611
+ public toJSON(): { [k: string]: any };
672
612
  }
673
613
 
674
614
  /** Reflected service method. */
@@ -684,39 +624,36 @@ export class Method extends ReflectionObject {
684
624
  * @param [responseStream] Whether the response is streamed
685
625
  * @param [options] Declared options
686
626
  * @param [comment] The comment for this method
687
- * @param [parsedOptions] Declared options, properly parsed into objects
627
+ * @param [parsedOptions] Declared options, properly parsed into an object
688
628
  */
689
- 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 });
690
630
 
691
631
  /** Method type. */
692
- type: string;
632
+ public type: string;
693
633
 
694
634
  /** Request type. */
695
- requestType: string;
635
+ public requestType: string;
696
636
 
697
637
  /** Whether requests are streamed or not. */
698
- requestStream?: true;
638
+ public requestStream?: boolean;
699
639
 
700
640
  /** Response type. */
701
- responseType: string;
641
+ public responseType: string;
702
642
 
703
643
  /** Whether responses are streamed or not. */
704
- responseStream?: true;
705
-
706
- /** gRPC-style method path. */
707
- path: string;
644
+ public responseStream?: boolean;
708
645
 
709
646
  /** Resolved request type. */
710
- resolvedRequestType: (Type|null);
647
+ public resolvedRequestType: (Type|null);
711
648
 
712
649
  /** Resolved response type. */
713
- resolvedResponseType: (Type|null);
650
+ public resolvedResponseType: (Type|null);
714
651
 
715
652
  /** Comment for this method */
716
- comment: (string|null);
653
+ public comment: (string|null);
717
654
 
718
- /** Options properly parsed into objects */
719
- parsedOptions?: { [k: string]: any }[];
655
+ /** Options properly parsed into an object */
656
+ public parsedOptions: any;
720
657
 
721
658
  /**
722
659
  * Constructs a method from a method descriptor.
@@ -725,14 +662,14 @@ export class Method extends ReflectionObject {
725
662
  * @returns Created method
726
663
  * @throws {TypeError} If arguments are invalid
727
664
  */
728
- static fromJSON(name: string, json: IMethod): Method;
665
+ public static fromJSON(name: string, json: IMethod): Method;
729
666
 
730
667
  /**
731
668
  * Converts this method to a method descriptor.
732
669
  * @param [toJSONOptions] JSON conversion options
733
670
  * @returns Method descriptor
734
671
  */
735
- toJSON(toJSONOptions?: IToJSONOptions): IMethod;
672
+ public toJSON(toJSONOptions?: IToJSONOptions): IMethod;
736
673
  }
737
674
 
738
675
  /** Method descriptor. */
@@ -756,11 +693,11 @@ export interface IMethod {
756
693
  /** Method options */
757
694
  options?: { [k: string]: any };
758
695
 
759
- /** Method comment */
760
- comment?: (string|null);
696
+ /** Method comments */
697
+ comment: string;
761
698
 
762
- /** Method options properly parsed into objects */
763
- parsedOptions?: { [k: string]: any }[];
699
+ /** Method options properly parsed into an object */
700
+ parsedOptions?: { [k: string]: any };
764
701
  }
765
702
 
766
703
  /** Reflected namespace. */
@@ -781,7 +718,7 @@ export class Namespace extends NamespaceBase {
781
718
  * @returns Created namespace
782
719
  * @throws {TypeError} If arguments are invalid
783
720
  */
784
- static fromJSON(name: string, json: { [k: string]: any }, depth?: number): Namespace;
721
+ public static fromJSON(name: string, json: { [k: string]: any }, depth?: number): Namespace;
785
722
 
786
723
  /**
787
724
  * Converts an array of reflection objects to JSON.
@@ -789,7 +726,7 @@ export class Namespace extends NamespaceBase {
789
726
  * @param [toJSONOptions] JSON conversion options
790
727
  * @returns JSON object or `undefined` when array is empty
791
728
  */
792
- static arrayToJSON(array: ReflectionObject[], toJSONOptions?: IToJSONOptions): ({ [k: string]: any }|undefined);
729
+ public static arrayToJSON(array: ReflectionObject[], toJSONOptions?: IToJSONOptions): ({ [k: string]: any }|undefined);
793
730
 
794
731
  /**
795
732
  * Tests if the specified id is reserved.
@@ -797,7 +734,7 @@ export class Namespace extends NamespaceBase {
797
734
  * @param id Id to test
798
735
  * @returns `true` if reserved, otherwise `false`
799
736
  */
800
- static isReservedId(reserved: ((number[]|string)[]|undefined), id: number): boolean;
737
+ public static isReservedId(reserved: ((number[]|string)[]|undefined), id: number): boolean;
801
738
 
802
739
  /**
803
740
  * Tests if the specified name is reserved.
@@ -805,14 +742,14 @@ export class Namespace extends NamespaceBase {
805
742
  * @param name Name to test
806
743
  * @returns `true` if reserved, otherwise `false`
807
744
  */
808
- static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean;
745
+ public static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean;
809
746
  }
810
747
 
811
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. */
812
749
  export abstract class NamespaceBase extends ReflectionObject {
813
750
 
814
751
  /** Nested objects by name. */
815
- nested?: { [k: string]: ReflectionObject };
752
+ public nested?: { [k: string]: ReflectionObject };
816
753
 
817
754
  /** Whether or not objects contained in this namespace need feature resolution. */
818
755
  protected _needsRecursiveFeatureResolution: boolean;
@@ -821,14 +758,14 @@ export abstract class NamespaceBase extends ReflectionObject {
821
758
  protected _needsRecursiveResolve: boolean;
822
759
 
823
760
  /** Nested objects of this namespace as an array for iteration. */
824
- readonly nestedArray: ReflectionObject[];
761
+ public readonly nestedArray: ReflectionObject[];
825
762
 
826
763
  /**
827
764
  * Converts this namespace to a namespace descriptor.
828
765
  * @param [toJSONOptions] JSON conversion options
829
766
  * @returns Namespace descriptor
830
767
  */
831
- toJSON(toJSONOptions?: IToJSONOptions): INamespace;
768
+ public toJSON(toJSONOptions?: IToJSONOptions): INamespace;
832
769
 
833
770
  /**
834
771
  * Adds nested objects to this namespace from nested object descriptors.
@@ -836,14 +773,14 @@ export abstract class NamespaceBase extends ReflectionObject {
836
773
  * @param [depth] Current nesting depth, defaults to `0`
837
774
  * @returns `this`
838
775
  */
839
- addJSON(nestedJson: { [k: string]: AnyNestedObject }, depth?: number): Namespace;
776
+ public addJSON(nestedJson: { [k: string]: AnyNestedObject }, depth?: number): Namespace;
840
777
 
841
778
  /**
842
779
  * Gets the nested object of the specified name.
843
780
  * @param name Nested object name
844
781
  * @returns The reflection object or `null` if it doesn't exist
845
782
  */
846
- get(name: string): (ReflectionObject|null);
783
+ public get(name: string): (ReflectionObject|null);
847
784
 
848
785
  /**
849
786
  * Gets the values of the nested {@link Enum|enum} of the specified name.
@@ -852,7 +789,7 @@ export abstract class NamespaceBase extends ReflectionObject {
852
789
  * @returns Enum values
853
790
  * @throws {Error} If there is no such enum
854
791
  */
855
- getEnum(name: string): { [k: string]: number };
792
+ public getEnum(name: string): { [k: string]: number };
856
793
 
857
794
  /**
858
795
  * Adds a nested object to this namespace.
@@ -861,7 +798,7 @@ export abstract class NamespaceBase extends ReflectionObject {
861
798
  * @throws {TypeError} If arguments are invalid
862
799
  * @throws {Error} If there is already a nested object with this name
863
800
  */
864
- add(object: ReflectionObject): Namespace;
801
+ public add(object: ReflectionObject): Namespace;
865
802
 
866
803
  /**
867
804
  * Removes a nested object from this namespace.
@@ -870,7 +807,7 @@ export abstract class NamespaceBase extends ReflectionObject {
870
807
  * @throws {TypeError} If arguments are invalid
871
808
  * @throws {Error} If `object` is not a member of this namespace
872
809
  */
873
- remove(object: ReflectionObject): Namespace;
810
+ public remove(object: ReflectionObject): Namespace;
874
811
 
875
812
  /**
876
813
  * Defines additial namespaces within this one if not yet existing.
@@ -878,13 +815,13 @@ export abstract class NamespaceBase extends ReflectionObject {
878
815
  * @param [json] Nested types to create from JSON
879
816
  * @returns Pointer to the last namespace created or `this` if path is empty
880
817
  */
881
- define(path: (string|string[]), json?: any): Namespace;
818
+ public define(path: (string|string[]), json?: any): Namespace;
882
819
 
883
820
  /**
884
821
  * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost.
885
822
  * @returns `this`
886
823
  */
887
- resolveAll(): Namespace;
824
+ public resolveAll(): Namespace;
888
825
 
889
826
  /**
890
827
  * Recursively looks up the reflection object matching the specified path in the scope of this namespace.
@@ -893,7 +830,7 @@ export abstract class NamespaceBase extends ReflectionObject {
893
830
  * @param [parentAlreadyChecked=false] If known, whether the parent has already been checked
894
831
  * @returns Looked up object or `null` if none could be found
895
832
  */
896
- lookup(path: (string|string[]), filterTypes: (any|any[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
833
+ public lookup(path: (string|string[]), filterTypes: (any|any[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
897
834
 
898
835
  /**
899
836
  * Looks up the reflection object at the specified path, relative to this namespace.
@@ -901,7 +838,7 @@ export abstract class NamespaceBase extends ReflectionObject {
901
838
  * @param [parentAlreadyChecked=false] Whether the parent has already been checked
902
839
  * @returns Looked up object or `null` if none could be found
903
840
  */
904
- lookup(path: (string|string[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
841
+ public lookup(path: (string|string[]), parentAlreadyChecked?: boolean): (ReflectionObject|null);
905
842
 
906
843
  /**
907
844
  * Looks up the {@link Type|type} at the specified path, relative to this namespace.
@@ -910,7 +847,7 @@ export abstract class NamespaceBase extends ReflectionObject {
910
847
  * @returns Looked up type
911
848
  * @throws {Error} If `path` does not point to a type
912
849
  */
913
- lookupType(path: (string|string[])): Type;
850
+ public lookupType(path: (string|string[])): Type;
914
851
 
915
852
  /**
916
853
  * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.
@@ -919,7 +856,7 @@ export abstract class NamespaceBase extends ReflectionObject {
919
856
  * @returns Looked up enum
920
857
  * @throws {Error} If `path` does not point to an enum
921
858
  */
922
- lookupEnum(path: (string|string[])): Enum;
859
+ public lookupEnum(path: (string|string[])): Enum;
923
860
 
924
861
  /**
925
862
  * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace.
@@ -928,7 +865,7 @@ export abstract class NamespaceBase extends ReflectionObject {
928
865
  * @returns Looked up type or enum
929
866
  * @throws {Error} If `path` does not point to a type or enum
930
867
  */
931
- lookupTypeOrEnum(path: (string|string[])): Type;
868
+ public lookupTypeOrEnum(path: (string|string[])): Type;
932
869
 
933
870
  /**
934
871
  * Looks up the {@link Service|service} at the specified path, relative to this namespace.
@@ -937,7 +874,7 @@ export abstract class NamespaceBase extends ReflectionObject {
937
874
  * @returns Looked up service
938
875
  * @throws {Error} If `path` does not point to a service
939
876
  */
940
- lookupService(path: (string|string[])): Service;
877
+ public lookupService(path: (string|string[])): Service;
941
878
  }
942
879
 
943
880
  /** Namespace descriptor. */
@@ -951,77 +888,77 @@ export interface INamespace {
951
888
  }
952
889
 
953
890
  /** Any extension field descriptor. */
954
- export type AnyExtensionField = (IExtensionField|IExtensionMapField);
891
+ type AnyExtensionField = (IExtensionField|IExtensionMapField);
955
892
 
956
893
  /** Any nested object descriptor. */
957
- export type AnyNestedObject = (IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf);
894
+ type AnyNestedObject = (IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf);
958
895
 
959
896
  /** Base class of all reflection objects. */
960
897
  export abstract class ReflectionObject {
961
898
 
962
899
  /** Options. */
963
- options?: { [k: string]: any };
900
+ public options?: { [k: string]: any };
964
901
 
965
902
  /** Parsed Options. */
966
- parsedOptions?: { [k: string]: any }[];
903
+ public parsedOptions?: { [k: string]: any[] };
967
904
 
968
905
  /** Unique name within its namespace. */
969
- name: string;
906
+ public name: string;
970
907
 
971
908
  /** Parent namespace. */
972
- parent: (Namespace|null);
909
+ public parent: (Namespace|null);
973
910
 
974
911
  /** Whether already resolved or not. */
975
- resolved: boolean;
912
+ public resolved: boolean;
976
913
 
977
914
  /** Comment text, if any. */
978
- comment: (string|null);
915
+ public comment: (string|null);
979
916
 
980
917
  /** Defining file name. */
981
- filename: (string|null);
918
+ public filename: (string|null);
982
919
 
983
920
  /** Reference to the root namespace. */
984
- readonly root: Root;
921
+ public readonly root: Root;
985
922
 
986
923
  /** Full name including leading dot. */
987
- readonly fullName: string;
924
+ public readonly fullName: string;
988
925
 
989
926
  /**
990
927
  * Converts this reflection object to its descriptor representation.
991
928
  * @returns Descriptor
992
929
  */
993
- toJSON(): { [k: string]: any };
930
+ public toJSON(): { [k: string]: any };
994
931
 
995
932
  /**
996
933
  * Called when this object is added to a parent.
997
934
  * @param parent Parent added to
998
935
  */
999
- onAdd(parent: ReflectionObject): void;
936
+ public onAdd(parent: ReflectionObject): void;
1000
937
 
1001
938
  /**
1002
939
  * Called when this object is removed from a parent.
1003
940
  * @param parent Parent removed from
1004
941
  */
1005
- onRemove(parent: ReflectionObject): void;
942
+ public onRemove(parent: ReflectionObject): void;
1006
943
 
1007
944
  /**
1008
945
  * Resolves this objects type references.
1009
946
  * @returns `this`
1010
947
  */
1011
- resolve(): ReflectionObject;
948
+ public resolve(): ReflectionObject;
1012
949
 
1013
950
  /**
1014
951
  * Resolves this objects editions features.
1015
952
  * @param edition The edition we're currently resolving for.
1016
953
  * @returns `this`
1017
954
  */
1018
- _resolveFeaturesRecursive(edition: string): ReflectionObject;
955
+ public _resolveFeaturesRecursive(edition: string): ReflectionObject;
1019
956
 
1020
957
  /**
1021
958
  * Resolves child features from parent features
1022
959
  * @param edition The edition we're currently resolving for.
1023
960
  */
1024
- _resolveFeatures(edition: string): void;
961
+ public _resolveFeatures(edition: string): void;
1025
962
 
1026
963
  /**
1027
964
  * Infers features from legacy syntax that may have been specified differently.
@@ -1029,14 +966,14 @@ export abstract class ReflectionObject {
1029
966
  * @param edition The edition this proto is on, or undefined if pre-editions
1030
967
  * @returns The feature values to override
1031
968
  */
1032
- _inferLegacyProtoFeatures(edition: (string|undefined)): object;
969
+ public _inferLegacyProtoFeatures(edition: (string|undefined)): object;
1033
970
 
1034
971
  /**
1035
972
  * Gets an option value.
1036
973
  * @param name Option name
1037
974
  * @returns Option value or `undefined` if not set
1038
975
  */
1039
- getOption(name: string): any;
976
+ public getOption(name: string): any;
1040
977
 
1041
978
  /**
1042
979
  * Sets an option.
@@ -1045,7 +982,7 @@ export abstract class ReflectionObject {
1045
982
  * @param [ifNotSet] Sets the option only if it isn't currently set
1046
983
  * @returns `this`
1047
984
  */
1048
- setOption(name: string, value: any, ifNotSet?: (boolean|undefined)): ReflectionObject;
985
+ public setOption(name: string, value: any, ifNotSet?: (boolean|undefined)): ReflectionObject;
1049
986
 
1050
987
  /**
1051
988
  * Sets a parsed option.
@@ -1054,7 +991,7 @@ export abstract class ReflectionObject {
1054
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
1055
992
  * @returns `this`
1056
993
  */
1057
- setParsedOption(name: string, value: any, propName: string): ReflectionObject;
994
+ public setParsedOption(name: string, value: any, propName: string): ReflectionObject;
1058
995
 
1059
996
  /**
1060
997
  * Sets multiple options.
@@ -1062,19 +999,19 @@ export abstract class ReflectionObject {
1062
999
  * @param [ifNotSet] Sets an option only if it isn't currently set
1063
1000
  * @returns `this`
1064
1001
  */
1065
- setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject;
1002
+ public setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject;
1066
1003
 
1067
1004
  /**
1068
1005
  * Converts this instance to its string representation.
1069
1006
  * @returns Class name[, space, full name]
1070
1007
  */
1071
- toString(): string;
1008
+ public toString(): string;
1072
1009
 
1073
1010
  /**
1074
1011
  * Converts the edition this object is pinned to for JSON format.
1075
1012
  * @returns The edition string for JSON representation
1076
1013
  */
1077
- _editionToJSON(): (string|undefined);
1014
+ public _editionToJSON(): (string|undefined);
1078
1015
  }
1079
1016
 
1080
1017
  /** Reflected oneof. */
@@ -1090,13 +1027,13 @@ export class OneOf extends ReflectionObject {
1090
1027
  constructor(name: string, fieldNames?: (string[]|{ [k: string]: any }), options?: { [k: string]: any }, comment?: string);
1091
1028
 
1092
1029
  /** Field names that belong to this oneof. */
1093
- oneof: string[];
1030
+ public oneof: string[];
1094
1031
 
1095
1032
  /** Fields that belong to this oneof as an array for iteration. */
1096
- readonly fieldsArray: Field[];
1033
+ public readonly fieldsArray: Field[];
1097
1034
 
1098
1035
  /** Comment for this field. */
1099
- comment: (string|null);
1036
+ public comment: (string|null);
1100
1037
 
1101
1038
  /**
1102
1039
  * Constructs a oneof from a oneof descriptor.
@@ -1105,43 +1042,42 @@ export class OneOf extends ReflectionObject {
1105
1042
  * @returns Created oneof
1106
1043
  * @throws {TypeError} If arguments are invalid
1107
1044
  */
1108
- static fromJSON(name: string, json: IOneOf): OneOf;
1045
+ public static fromJSON(name: string, json: IOneOf): OneOf;
1109
1046
 
1110
1047
  /**
1111
1048
  * Converts this oneof to a oneof descriptor.
1112
1049
  * @param [toJSONOptions] JSON conversion options
1113
1050
  * @returns Oneof descriptor
1114
1051
  */
1115
- toJSON(toJSONOptions?: IToJSONOptions): IOneOf;
1052
+ public toJSON(toJSONOptions?: IToJSONOptions): IOneOf;
1116
1053
 
1117
1054
  /**
1118
1055
  * Adds a field to this oneof and removes it from its current parent, if any.
1119
1056
  * @param field Field to add
1120
1057
  * @returns `this`
1121
1058
  */
1122
- add(field: Field): OneOf;
1059
+ public add(field: Field): OneOf;
1123
1060
 
1124
1061
  /**
1125
1062
  * Removes a field from this oneof and puts it back to the oneof's parent.
1126
1063
  * @param field Field to remove
1127
1064
  * @returns `this`
1128
1065
  */
1129
- remove(field: Field): OneOf;
1066
+ public remove(field: Field): OneOf;
1130
1067
 
1131
1068
  /**
1132
1069
  * Determines whether this field corresponds to a synthetic oneof created for
1133
1070
  * a proto3 optional field. No behavioral logic should depend on this, but it
1134
1071
  * can be relevant for reflection.
1135
1072
  */
1136
- readonly isProto3Optional: boolean;
1073
+ public readonly isProto3Optional: boolean;
1137
1074
 
1138
1075
  /**
1139
1076
  * OneOf decorator (TypeScript).
1140
1077
  * @param fieldNames Field names
1141
1078
  * @returns Decorator function
1142
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
1143
1079
  */
1144
- static d<T extends string>(...fieldNames: string[]): OneOfDecorator;
1080
+ public static d<T extends string>(...fieldNames: string[]): OneOfDecorator;
1145
1081
  }
1146
1082
 
1147
1083
  /** Oneof descriptor. */
@@ -1152,18 +1088,14 @@ export interface IOneOf {
1152
1088
 
1153
1089
  /** Oneof options */
1154
1090
  options?: { [k: string]: any };
1155
-
1156
- /** Oneof comment */
1157
- comment?: (string|null);
1158
1091
  }
1159
1092
 
1160
1093
  /**
1161
1094
  * Decorator function as returned by {@link OneOf.d} (TypeScript).
1162
1095
  * @param prototype Target prototype
1163
1096
  * @param oneofName OneOf name
1164
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
1165
1097
  */
1166
- export type OneOfDecorator = (prototype: object, oneofName: string) => void;
1098
+ type OneOfDecorator = (prototype: object, oneofName: string) => void;
1167
1099
 
1168
1100
  /**
1169
1101
  * Parses the given .proto source and returns an object with the parsed contents.
@@ -1218,7 +1150,7 @@ export interface IToJSONOptions {
1218
1150
  */
1219
1151
  export function parse(source: string, root: Root, options?: IParseOptions): IParserResult;
1220
1152
 
1221
- /** Wire format reader using `Uint8Array`. */
1153
+ /** Wire format reader using `Uint8Array` if available, otherwise `Array`. */
1222
1154
  export class Reader {
1223
1155
 
1224
1156
  /**
@@ -1228,19 +1160,13 @@ export class Reader {
1228
1160
  constructor(buffer: Uint8Array);
1229
1161
 
1230
1162
  /** Read buffer. */
1231
- buf: Uint8Array;
1163
+ public buf: Uint8Array;
1232
1164
 
1233
1165
  /** Read buffer position. */
1234
- pos: number;
1166
+ public pos: number;
1235
1167
 
1236
1168
  /** Read buffer length. */
1237
- len: number;
1238
-
1239
- /** Cached DataView for packed reads. */
1240
- view: (DataView|null);
1241
-
1242
- /** Whether to discard unknown fields while decoding. */
1243
- discardUnknown: boolean;
1169
+ public len: number;
1244
1170
 
1245
1171
  /**
1246
1172
  * Creates a new reader using the specified buffer.
@@ -1248,236 +1174,115 @@ export class Reader {
1248
1174
  * @returns A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}
1249
1175
  * @throws {Error} If `buffer` is not a valid buffer
1250
1176
  */
1251
- static create(buffer: (Uint8Array|Buffer)): (Reader|BufferReader);
1252
-
1253
- /**
1254
- * Returns raw bytes from the backing buffer without advancing the reader.
1255
- * @param start Start offset
1256
- * @param end End offset
1257
- * @returns Raw bytes
1258
- */
1259
- raw(start: number, end: number): Uint8Array;
1177
+ public static create(buffer: (Uint8Array|Buffer)): (Reader|BufferReader);
1260
1178
 
1261
1179
  /**
1262
1180
  * Reads a varint as an unsigned 32 bit value.
1263
1181
  * @returns Value read
1264
1182
  */
1265
- uint32(): number;
1266
-
1267
- /**
1268
- * Reads a field tag.
1269
- * @returns Tag read
1270
- */
1271
- tag(): number;
1272
-
1273
- /**
1274
- * Reads a varint length prefix within signed 32 bit range.
1275
- * @returns Length read
1276
- */
1277
- size(): number;
1183
+ public uint32(): number;
1278
1184
 
1279
1185
  /**
1280
1186
  * Reads a varint as a signed 32 bit value.
1281
1187
  * @returns Value read
1282
1188
  */
1283
- int32(): number;
1189
+ public int32(): number;
1284
1190
 
1285
1191
  /**
1286
1192
  * Reads a zig-zag encoded varint as a signed 32 bit value.
1287
1193
  * @returns Value read
1288
1194
  */
1289
- sint32(): number;
1195
+ public sint32(): number;
1290
1196
 
1291
1197
  /**
1292
1198
  * Reads a varint as a signed 64 bit value.
1293
1199
  * @returns Value read
1294
1200
  */
1295
- int64(): Long;
1201
+ public int64(): Long;
1296
1202
 
1297
1203
  /**
1298
1204
  * Reads a varint as an unsigned 64 bit value.
1299
1205
  * @returns Value read
1300
1206
  */
1301
- uint64(): Long;
1207
+ public uint64(): Long;
1302
1208
 
1303
1209
  /**
1304
1210
  * Reads a zig-zag encoded varint as a signed 64 bit value.
1305
1211
  * @returns Value read
1306
1212
  */
1307
- sint64(): Long;
1213
+ public sint64(): Long;
1308
1214
 
1309
1215
  /**
1310
1216
  * Reads a varint as a boolean.
1311
1217
  * @returns Value read
1312
1218
  */
1313
- bool(): boolean;
1219
+ public bool(): boolean;
1314
1220
 
1315
1221
  /**
1316
1222
  * Reads fixed 32 bits as an unsigned 32 bit integer.
1317
1223
  * @returns Value read
1318
1224
  */
1319
- fixed32(): number;
1225
+ public fixed32(): number;
1320
1226
 
1321
1227
  /**
1322
1228
  * Reads fixed 32 bits as a signed 32 bit integer.
1323
1229
  * @returns Value read
1324
1230
  */
1325
- sfixed32(): number;
1231
+ public sfixed32(): number;
1326
1232
 
1327
1233
  /**
1328
1234
  * Reads fixed 64 bits.
1329
1235
  * @returns Value read
1330
1236
  */
1331
- fixed64(): Long;
1237
+ public fixed64(): Long;
1332
1238
 
1333
1239
  /**
1334
1240
  * Reads zig-zag encoded fixed 64 bits.
1335
1241
  * @returns Value read
1336
1242
  */
1337
- sfixed64(): Long;
1243
+ public sfixed64(): Long;
1338
1244
 
1339
1245
  /**
1340
1246
  * Reads a float (32 bit) as a number.
1341
1247
  * @returns Value read
1342
1248
  */
1343
- float(): number;
1249
+ public float(): number;
1344
1250
 
1345
1251
  /**
1346
1252
  * Reads a double (64 bit float) as a number.
1347
1253
  * @returns Value read
1348
1254
  */
1349
- double(): number;
1350
-
1351
- /**
1352
- * Reads a packed repeated field of unsigned 32 bit varints.
1353
- * @param [array] Array to read into; a new one is created if omitted
1354
- * @returns Array read into
1355
- */
1356
- uint32s(array?: number[]): number[];
1357
-
1358
- /**
1359
- * Reads a packed repeated field of signed 32 bit varints.
1360
- * @param [array] Array to read into; a new one is created if omitted
1361
- * @returns Array read into
1362
- */
1363
- int32s(array?: number[]): number[];
1364
-
1365
- /**
1366
- * Reads a packed repeated field of zig-zag encoded signed 32 bit varints.
1367
- * @param [array] Array to read into; a new one is created if omitted
1368
- * @returns Array read into
1369
- */
1370
- sint32s(array?: number[]): number[];
1371
-
1372
- /**
1373
- * Reads a packed repeated field of booleans.
1374
- * @param [array] Array to read into; a new one is created if omitted
1375
- * @returns Array read into
1376
- */
1377
- bools(array?: boolean[]): boolean[];
1378
-
1379
- /**
1380
- * Reads a packed repeated field of unsigned 32 bit fixed values.
1381
- * @param [array] Array to read into; a new one is created if omitted
1382
- * @returns Array read into
1383
- */
1384
- fixed32s(array?: number[]): number[];
1385
-
1386
- /**
1387
- * Reads a packed repeated field of signed 32 bit fixed values.
1388
- * @param [array] Array to read into; a new one is created if omitted
1389
- * @returns Array read into
1390
- */
1391
- sfixed32s(array?: number[]): number[];
1392
-
1393
- /**
1394
- * Reads a packed repeated field of floats (32 bit).
1395
- * @param [array] Array to read into; a new one is created if omitted
1396
- * @returns Array read into
1397
- */
1398
- floats(array?: number[]): number[];
1399
-
1400
- /**
1401
- * Reads a packed repeated field of doubles (64 bit float).
1402
- * @param [array] Array to read into; a new one is created if omitted
1403
- * @returns Array read into
1404
- */
1405
- doubles(array?: number[]): number[];
1406
-
1407
- /**
1408
- * Reads a packed repeated field of unsigned 64 bit varints.
1409
- * @param [array] Array to read into; a new one is created if omitted
1410
- * @returns Array read into
1411
- */
1412
- uint64s(array?: (Long|number)[]): (Long|number)[];
1413
-
1414
- /**
1415
- * Reads a packed repeated field of signed 64 bit varints.
1416
- * @param [array] Array to read into; a new one is created if omitted
1417
- * @returns Array read into
1418
- */
1419
- int64s(array?: (Long|number)[]): (Long|number)[];
1420
-
1421
- /**
1422
- * Reads a packed repeated field of zig-zag encoded signed 64 bit varints.
1423
- * @param [array] Array to read into; a new one is created if omitted
1424
- * @returns Array read into
1425
- */
1426
- sint64s(array?: (Long|number)[]): (Long|number)[];
1427
-
1428
- /**
1429
- * Reads a packed repeated field of unsigned 64 bit fixed values.
1430
- * @param [array] Array to read into; a new one is created if omitted
1431
- * @returns Array read into
1432
- */
1433
- fixed64s(array?: (Long|number)[]): (Long|number)[];
1434
-
1435
- /**
1436
- * Reads a packed repeated field of signed 64 bit fixed values.
1437
- * @param [array] Array to read into; a new one is created if omitted
1438
- * @returns Array read into
1439
- */
1440
- sfixed64s(array?: (Long|number)[]): (Long|number)[];
1255
+ public double(): number;
1441
1256
 
1442
1257
  /**
1443
1258
  * Reads a sequence of bytes preceeded by its length as a varint.
1444
1259
  * @returns Value read
1445
1260
  */
1446
- bytes(): Uint8Array;
1261
+ public bytes(): Uint8Array;
1447
1262
 
1448
1263
  /**
1449
1264
  * Reads a string preceeded by its byte length as a varint.
1450
1265
  * @returns Value read
1451
1266
  */
1452
- string(): string;
1453
-
1454
- /**
1455
- * Reads a string preceeded by its byte length as a varint, rejecting invalid UTF8.
1456
- * @returns Value read
1457
- */
1458
- stringVerify(): string;
1267
+ public string(): string;
1459
1268
 
1460
1269
  /**
1461
1270
  * Skips the specified number of bytes if specified, otherwise skips a varint.
1462
1271
  * @param [length] Length if known, otherwise a varint is assumed
1463
1272
  * @returns `this`
1464
1273
  */
1465
- skip(length?: number): Reader;
1274
+ public skip(length?: number): Reader;
1466
1275
 
1467
1276
  /** Recursion limit. */
1468
- static recursionLimit: number;
1469
-
1470
- /** Whether readers discard unknown fields while decoding. */
1471
- static discardUnknown: boolean;
1277
+ public static recursionLimit: number;
1472
1278
 
1473
1279
  /**
1474
1280
  * Skips the next element of the specified wire type.
1475
1281
  * @param wireType Wire type received
1476
1282
  * @param [depth] Depth of recursion to control nested calls; 0 if omitted
1477
- * @param [fieldNumber] Field number for validating group end tags
1478
1283
  * @returns `this`
1479
1284
  */
1480
- skipType(wireType: number, depth?: number, fieldNumber?: number): Reader;
1285
+ public skipType(wireType: number, depth?: number): Reader;
1481
1286
  }
1482
1287
 
1483
1288
  /** Wire format reader using node buffers. */
@@ -1489,19 +1294,11 @@ export class BufferReader extends Reader {
1489
1294
  */
1490
1295
  constructor(buffer: Buffer);
1491
1296
 
1492
- /**
1493
- * Returns raw bytes from the backing buffer without advancing the reader.
1494
- * @param start Start offset
1495
- * @param end End offset
1496
- * @returns Raw bytes
1497
- */
1498
- raw(start: number, end: number): Buffer;
1499
-
1500
1297
  /**
1501
1298
  * Reads a sequence of bytes preceeded by its length as a varint.
1502
1299
  * @returns Value read
1503
1300
  */
1504
- bytes(): Buffer;
1301
+ public bytes(): Buffer;
1505
1302
  }
1506
1303
 
1507
1304
  /** Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. */
@@ -1514,10 +1311,10 @@ export class Root extends NamespaceBase {
1514
1311
  constructor(options?: { [k: string]: any });
1515
1312
 
1516
1313
  /** Deferred extension fields. */
1517
- deferred: Field[];
1314
+ public deferred: Field[];
1518
1315
 
1519
1316
  /** Resolved file names of loaded files. */
1520
- files: string[];
1317
+ public files: string[];
1521
1318
 
1522
1319
  /**
1523
1320
  * Loads a namespace descriptor into a root namespace.
@@ -1526,7 +1323,7 @@ export class Root extends NamespaceBase {
1526
1323
  * @param [depth] Current nesting depth, defaults to `0`
1527
1324
  * @returns Root namespace
1528
1325
  */
1529
- static fromJSON(json: INamespace, root?: Root, depth?: number): Root;
1326
+ public static fromJSON(json: INamespace, root?: Root, depth?: number): Root;
1530
1327
 
1531
1328
  /**
1532
1329
  * Resolves the path of an imported file, relative to the importing origin.
@@ -1535,7 +1332,7 @@ export class Root extends NamespaceBase {
1535
1332
  * @param target The file name being imported
1536
1333
  * @returns Resolved path to `target` or `null` to skip the file
1537
1334
  */
1538
- resolvePath(origin: string, target: string): (string|null);
1335
+ public resolvePath(origin: string, target: string): (string|null);
1539
1336
 
1540
1337
  /**
1541
1338
  * Fetch content from file path or url
@@ -1543,7 +1340,7 @@ export class Root extends NamespaceBase {
1543
1340
  * @param path File path or url
1544
1341
  * @param callback Callback function
1545
1342
  */
1546
- fetch(path: string, callback: FetchCallback): void;
1343
+ public fetch(path: string, callback: FetchCallback): void;
1547
1344
 
1548
1345
  /**
1549
1346
  * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.
@@ -1551,14 +1348,14 @@ export class Root extends NamespaceBase {
1551
1348
  * @param options Parse options
1552
1349
  * @param callback Callback function
1553
1350
  */
1554
- load(filename: (string|string[]), options: IParseOptions, callback: LoadCallback): void;
1351
+ public load(filename: (string|string[]), options: IParseOptions, callback: LoadCallback): void;
1555
1352
 
1556
1353
  /**
1557
1354
  * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback.
1558
1355
  * @param filename Names of one or multiple files to load
1559
1356
  * @param callback Callback function
1560
1357
  */
1561
- load(filename: (string|string[]), callback: LoadCallback): void;
1358
+ public load(filename: (string|string[]), callback: LoadCallback): void;
1562
1359
 
1563
1360
  /**
1564
1361
  * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise.
@@ -1566,7 +1363,7 @@ export class Root extends NamespaceBase {
1566
1363
  * @param [options] Parse options. Defaults to {@link parse.defaults} when omitted.
1567
1364
  * @returns Promise
1568
1365
  */
1569
- load(filename: (string|string[]), options?: IParseOptions): Promise<Root>;
1366
+ public load(filename: (string|string[]), options?: IParseOptions): Promise<Root>;
1570
1367
 
1571
1368
  /**
1572
1369
  * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only).
@@ -1575,7 +1372,7 @@ export class Root extends NamespaceBase {
1575
1372
  * @returns Root namespace
1576
1373
  * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid
1577
1374
  */
1578
- loadSync(filename: (string|string[]), options?: IParseOptions): Root;
1375
+ public loadSync(filename: (string|string[]), options?: IParseOptions): Root;
1579
1376
  }
1580
1377
 
1581
1378
  /**
@@ -1597,17 +1394,13 @@ export namespace rpc {
1597
1394
  */
1598
1395
  type ServiceMethodCallback<TRes extends Message<TRes>> = (error: (Error|null), response?: TRes) => void;
1599
1396
 
1600
- /** A service method part of a {@link rpc.Service} as created by {@link Service.create}. */
1601
- type ServiceMethod<TReq extends Message<TReq>, TRes extends Message<TRes>> = {
1602
- (request: TReq|Properties<TReq>, callback: rpc.ServiceMethodCallback<TRes>): void;
1603
- (request: TReq|Properties<TReq>): Promise<TRes>;
1604
- readonly name: string;
1605
- readonly path: string;
1606
- readonly requestType: string;
1607
- readonly responseType: string;
1608
- readonly requestStream: true|undefined;
1609
- readonly responseStream: true|undefined;
1610
- };
1397
+ /**
1398
+ * A service method part of a {@link rpc.Service} as created by {@link Service.create}.
1399
+ * @param request Request message or plain object
1400
+ * @param [callback] Node-style callback called with the error, if any, and the response message
1401
+ * @returns Promise if `callback` has been omitted, otherwise `undefined`
1402
+ */
1403
+ type ServiceMethod<TReq extends Message<TReq>, TRes extends Message<TRes>> = (request: (TReq|Properties<TReq>), callback?: rpc.ServiceMethodCallback<TRes>) => Promise<Message<TRes>>;
1611
1404
 
1612
1405
  /** An RPC service as returned by {@link Service#create}. */
1613
1406
  class Service extends util.EventEmitter {
@@ -1621,13 +1414,13 @@ export namespace rpc {
1621
1414
  constructor(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
1622
1415
 
1623
1416
  /** RPC implementation. Becomes `null` once the service is ended. */
1624
- rpcImpl: (RPCImpl|null);
1417
+ public rpcImpl: (RPCImpl|null);
1625
1418
 
1626
1419
  /** Whether requests are length-delimited. */
1627
- requestDelimited: boolean;
1420
+ public requestDelimited: boolean;
1628
1421
 
1629
1422
  /** Whether responses are length-delimited. */
1630
- responseDelimited: boolean;
1423
+ public responseDelimited: boolean;
1631
1424
 
1632
1425
  /**
1633
1426
  * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.
@@ -1637,14 +1430,14 @@ export namespace rpc {
1637
1430
  * @param request Request message or plain object
1638
1431
  * @param callback Service callback
1639
1432
  */
1640
- 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;
1641
1434
 
1642
1435
  /**
1643
1436
  * Ends this service and emits the `end` event.
1644
1437
  * @param [endedByRPC=false] Whether the service has been ended by the RPC implementation.
1645
1438
  * @returns `this`
1646
1439
  */
1647
- end(endedByRPC?: boolean): rpc.Service;
1440
+ public end(endedByRPC?: boolean): rpc.Service;
1648
1441
  }
1649
1442
  }
1650
1443
 
@@ -1654,14 +1447,14 @@ export namespace rpc {
1654
1447
  * @param requestData Request data
1655
1448
  * @param callback Callback function
1656
1449
  */
1657
- export type RPCImpl = (method: (Method|rpc.ServiceMethod<Message<{}>, Message<{}>>), requestData: Uint8Array, callback: RPCImplCallback) => void;
1450
+ type RPCImpl = (method: (Method|rpc.ServiceMethod<Message<{}>, Message<{}>>), requestData: Uint8Array, callback: RPCImplCallback) => void;
1658
1451
 
1659
1452
  /**
1660
1453
  * Node-style callback as used by {@link RPCImpl}.
1661
1454
  * @param error Error, if any, otherwise `null`
1662
1455
  * @param [response] Response data or `null` to signal end of stream, if there hasn't been an error
1663
1456
  */
1664
- export type RPCImplCallback = (error: (Error|null), response?: (Uint8Array|null)) => void;
1457
+ type RPCImplCallback = (error: (Error|null), response?: (Uint8Array|null)) => void;
1665
1458
 
1666
1459
  /** Reflected service. */
1667
1460
  export class Service extends NamespaceBase {
@@ -1675,7 +1468,7 @@ export class Service extends NamespaceBase {
1675
1468
  constructor(name: string, options?: { [k: string]: any });
1676
1469
 
1677
1470
  /** Service methods. */
1678
- methods: { [k: string]: Method };
1471
+ public methods: { [k: string]: Method };
1679
1472
 
1680
1473
  /**
1681
1474
  * Constructs a service from a service descriptor.
@@ -1685,17 +1478,17 @@ export class Service extends NamespaceBase {
1685
1478
  * @returns Created service
1686
1479
  * @throws {TypeError} If arguments are invalid
1687
1480
  */
1688
- static fromJSON(name: string, json: IService, depth?: number): Service;
1481
+ public static fromJSON(name: string, json: IService, depth?: number): Service;
1689
1482
 
1690
1483
  /**
1691
1484
  * Converts this service to a service descriptor.
1692
1485
  * @param [toJSONOptions] JSON conversion options
1693
1486
  * @returns Service descriptor
1694
1487
  */
1695
- toJSON(toJSONOptions?: IToJSONOptions): IService;
1488
+ public toJSON(toJSONOptions?: IToJSONOptions): IService;
1696
1489
 
1697
1490
  /** Methods of this service as an array for iteration. */
1698
- readonly methodsArray: Method[];
1491
+ public readonly methodsArray: Method[];
1699
1492
 
1700
1493
  /**
1701
1494
  * Creates a runtime service using the specified rpc implementation.
@@ -1704,39 +1497,33 @@ export class Service extends NamespaceBase {
1704
1497
  * @param [responseDelimited=false] Whether responses are length-delimited
1705
1498
  * @returns RPC service. Useful where requests and/or responses are streamed.
1706
1499
  */
1707
- create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service;
1500
+ public create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service;
1708
1501
  }
1709
1502
 
1710
1503
  /** Service descriptor. */
1711
1504
  export interface IService extends INamespace {
1712
1505
 
1713
- /** Edition */
1714
- edition?: string;
1715
-
1716
1506
  /** Method descriptors */
1717
1507
  methods: { [k: string]: IMethod };
1718
-
1719
- /** Service comment */
1720
- comment?: (string|null);
1721
1508
  }
1722
1509
 
1723
1510
  /**
1724
1511
  * Gets the next token and advances.
1725
1512
  * @returns Next token or `null` on eof
1726
1513
  */
1727
- export type TokenizerHandleNext = () => (string|null);
1514
+ type TokenizerHandleNext = () => (string|null);
1728
1515
 
1729
1516
  /**
1730
1517
  * Peeks for the next token.
1731
1518
  * @returns Next token or `null` on eof
1732
1519
  */
1733
- export type TokenizerHandlePeek = () => (string|null);
1520
+ type TokenizerHandlePeek = () => (string|null);
1734
1521
 
1735
1522
  /**
1736
1523
  * Pushes a token back to the stack.
1737
1524
  * @param token Token
1738
1525
  */
1739
- export type TokenizerHandlePush = (token: string) => void;
1526
+ type TokenizerHandlePush = (token: string) => void;
1740
1527
 
1741
1528
  /**
1742
1529
  * Skips the next token.
@@ -1745,14 +1532,14 @@ export type TokenizerHandlePush = (token: string) => void;
1745
1532
  * @returns Whether the token matched
1746
1533
  * @throws {Error} If the token didn't match and is not optional
1747
1534
  */
1748
- export type TokenizerHandleSkip = (expected: string, optional?: boolean) => boolean;
1535
+ type TokenizerHandleSkip = (expected: string, optional?: boolean) => boolean;
1749
1536
 
1750
1537
  /**
1751
1538
  * Gets the comment on the previous line or, alternatively, the line comment on the specified line.
1752
1539
  * @param [line] Line number
1753
1540
  * @returns Comment text or `null` if none
1754
1541
  */
1755
- export type TokenizerHandleCmnt = (line?: number) => (string|null);
1542
+ type TokenizerHandleCmnt = (line?: number) => (string|null);
1756
1543
 
1757
1544
  /** Handle object returned from {@link tokenize}. */
1758
1545
  export interface ITokenizerHandle {
@@ -1805,42 +1592,38 @@ export class Type extends NamespaceBase {
1805
1592
  constructor(name: string, options?: { [k: string]: any });
1806
1593
 
1807
1594
  /** Message fields. */
1808
- fields: { [k: string]: Field };
1595
+ public fields: { [k: string]: Field };
1809
1596
 
1810
1597
  /** Oneofs declared within this namespace, if any. */
1811
- oneofs: { [k: string]: OneOf };
1598
+ public oneofs: { [k: string]: OneOf };
1812
1599
 
1813
1600
  /** Extension ranges, if any. */
1814
- extensions: number[][];
1601
+ public extensions: number[][];
1815
1602
 
1816
1603
  /** Reserved ranges, if any. */
1817
- reserved: (number[]|string)[];
1818
-
1819
- /** Declared symbol visibility, if any. */
1820
- visibility?: ("local"|"export");
1604
+ public reserved: (number[]|string)[];
1821
1605
 
1822
1606
  /** Message fields by id. */
1823
- readonly fieldsById: { [k: number]: Field };
1607
+ public readonly fieldsById: { [k: number]: Field };
1824
1608
 
1825
1609
  /** Fields of this message as an array for iteration. */
1826
- readonly fieldsArray: Field[];
1610
+ public readonly fieldsArray: Field[];
1827
1611
 
1828
1612
  /** Oneofs of this message as an array for iteration. */
1829
- readonly oneofsArray: OneOf[];
1613
+ public readonly oneofsArray: OneOf[];
1830
1614
 
1831
1615
  /**
1832
1616
  * The registered constructor, if any registered, otherwise a generic constructor.
1833
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.
1834
- * When assigning manually, add the type to its parent namespace/root first if fields reference other reflected types, because constructor setup resolves field defaults.
1835
1618
  */
1836
- ctor: Constructor<{}>;
1619
+ public ctor: Constructor<{}>;
1837
1620
 
1838
1621
  /**
1839
1622
  * Generates a constructor function for the specified type.
1840
1623
  * @param mtype Message type
1841
1624
  * @returns Codegen instance
1842
1625
  */
1843
- static generateConstructor(mtype: Type): Codegen;
1626
+ public static generateConstructor(mtype: Type): Codegen;
1844
1627
 
1845
1628
  /**
1846
1629
  * Creates a message type from a message type descriptor.
@@ -1849,14 +1632,14 @@ export class Type extends NamespaceBase {
1849
1632
  * @param [depth] Current nesting depth, defaults to `0`
1850
1633
  * @returns Created message type
1851
1634
  */
1852
- static fromJSON(name: string, json: IType, depth?: number): Type;
1635
+ public static fromJSON(name: string, json: IType, depth?: number): Type;
1853
1636
 
1854
1637
  /**
1855
1638
  * Converts this message type to a message type descriptor.
1856
1639
  * @param [toJSONOptions] JSON conversion options
1857
1640
  * @returns Message type descriptor
1858
1641
  */
1859
- toJSON(toJSONOptions?: IToJSONOptions): IType;
1642
+ public toJSON(toJSONOptions?: IToJSONOptions): IType;
1860
1643
 
1861
1644
  /**
1862
1645
  * Adds a nested object to this type.
@@ -1865,7 +1648,7 @@ export class Type extends NamespaceBase {
1865
1648
  * @throws {TypeError} If arguments are invalid
1866
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
1867
1650
  */
1868
- add(object: ReflectionObject): Type;
1651
+ public add(object: ReflectionObject): Type;
1869
1652
 
1870
1653
  /**
1871
1654
  * Removes a nested object from this type.
@@ -1874,34 +1657,34 @@ export class Type extends NamespaceBase {
1874
1657
  * @throws {TypeError} If arguments are invalid
1875
1658
  * @throws {Error} If `object` is not a member of this type
1876
1659
  */
1877
- remove(object: ReflectionObject): Type;
1660
+ public remove(object: ReflectionObject): Type;
1878
1661
 
1879
1662
  /**
1880
1663
  * Tests if the specified id is reserved.
1881
1664
  * @param id Id to test
1882
1665
  * @returns `true` if reserved, otherwise `false`
1883
1666
  */
1884
- isReservedId(id: number): boolean;
1667
+ public isReservedId(id: number): boolean;
1885
1668
 
1886
1669
  /**
1887
1670
  * Tests if the specified name is reserved.
1888
1671
  * @param name Name to test
1889
1672
  * @returns `true` if reserved, otherwise `false`
1890
1673
  */
1891
- isReservedName(name: string): boolean;
1674
+ public isReservedName(name: string): boolean;
1892
1675
 
1893
1676
  /**
1894
1677
  * Creates a new message of this type using the specified properties.
1895
1678
  * @param [properties] Properties to set
1896
1679
  * @returns Message instance
1897
1680
  */
1898
- create(properties?: { [k: string]: any }): ReflectedMessage;
1681
+ public create(properties?: { [k: string]: any }): Message<{}>;
1899
1682
 
1900
1683
  /**
1901
1684
  * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}.
1902
1685
  * @returns `this`
1903
1686
  */
1904
- setup(): Type;
1687
+ public setup(): Type;
1905
1688
 
1906
1689
  /**
1907
1690
  * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages.
@@ -1909,7 +1692,7 @@ export class Type extends NamespaceBase {
1909
1692
  * @param [writer] Writer to encode to
1910
1693
  * @returns writer
1911
1694
  */
1912
- encode(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
1695
+ public encode(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
1913
1696
 
1914
1697
  /**
1915
1698
  * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages.
@@ -1917,17 +1700,19 @@ export class Type extends NamespaceBase {
1917
1700
  * @param [writer] Writer to encode to
1918
1701
  * @returns writer
1919
1702
  */
1920
- encodeDelimited(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
1703
+ public encodeDelimited(message: (Message<{}>|{ [k: string]: any }), writer?: Writer): Writer;
1921
1704
 
1922
1705
  /**
1923
1706
  * Decodes a message of this type.
1924
1707
  * @param reader Reader or buffer to decode from
1925
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
1926
1711
  * @returns Decoded message
1927
1712
  * @throws {Error} If the payload is not a reader or valid buffer
1928
1713
  * @throws {util.ProtocolError<{}>} If required fields are missing
1929
1714
  */
1930
- decode(reader: (Reader|Uint8Array), length?: number): ReflectedMessage;
1715
+ public decode(reader: (Reader|Uint8Array), length?: number, end?: number, depth?: number): Message<{}>;
1931
1716
 
1932
1717
  /**
1933
1718
  * Decodes a message of this type preceeded by its byte length as a varint.
@@ -1936,21 +1721,23 @@ export class Type extends NamespaceBase {
1936
1721
  * @throws {Error} If the payload is not a reader or valid buffer
1937
1722
  * @throws {util.ProtocolError} If required fields are missing
1938
1723
  */
1939
- decodeDelimited(reader: (Reader|Uint8Array)): ReflectedMessage;
1724
+ public decodeDelimited(reader: (Reader|Uint8Array)): Message<{}>;
1940
1725
 
1941
1726
  /**
1942
1727
  * Verifies that field values are valid and that required fields are present.
1943
1728
  * @param message Plain object to verify
1729
+ * @param [depth] Current nesting depth
1944
1730
  * @returns `null` if valid, otherwise the reason why it is not
1945
1731
  */
1946
- verify(message: { [k: string]: any }): (null|string);
1732
+ public verify(message: { [k: string]: any }, depth?: number): (null|string);
1947
1733
 
1948
1734
  /**
1949
1735
  * Creates a new message of this type from a plain object. Also converts values to their respective internal types.
1950
1736
  * @param object Plain object to convert
1737
+ * @param [depth] Current nesting depth
1951
1738
  * @returns Message instance
1952
1739
  */
1953
- fromObject(object: { [k: string]: any }): ReflectedMessage;
1740
+ public fromObject(object: { [k: string]: any }, depth?: number): Message<{}>;
1954
1741
 
1955
1742
  /**
1956
1743
  * Creates a plain object from a message of this type. Also converts values to other types if specified.
@@ -1958,30 +1745,19 @@ export class Type extends NamespaceBase {
1958
1745
  * @param [options] Conversion options
1959
1746
  * @returns Plain object
1960
1747
  */
1961
- toObject(message: Message<{}>, options?: IConversionOptions): { [k: string]: any };
1962
-
1963
- /**
1964
- * Gets the type url for this type.
1965
- * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"`
1966
- * @returns The type url
1967
- */
1968
- getTypeUrl(prefix?: string): string;
1748
+ public toObject(message: Message<{}>, options?: IConversionOptions): { [k: string]: any };
1969
1749
 
1970
1750
  /**
1971
1751
  * Type decorator (TypeScript).
1972
1752
  * @param [typeName] Type name, defaults to the constructor's name
1973
1753
  * @returns Decorator function
1974
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
1975
1754
  */
1976
- static d<T extends Message<T>>(typeName?: string): TypeDecorator<T>;
1755
+ public static d<T extends Message<T>>(typeName?: string): TypeDecorator<T>;
1977
1756
  }
1978
1757
 
1979
1758
  /** Message type descriptor. */
1980
1759
  export interface IType extends INamespace {
1981
1760
 
1982
- /** Edition */
1983
- edition?: string;
1984
-
1985
1761
  /** Oneof descriptors */
1986
1762
  oneofs?: { [k: string]: IOneOf };
1987
1763
 
@@ -1996,12 +1772,6 @@ export interface IType extends INamespace {
1996
1772
 
1997
1773
  /** Whether a legacy group or not */
1998
1774
  group?: boolean;
1999
-
2000
- /** Declared symbol visibility */
2001
- visibility?: ("local"|"export");
2002
-
2003
- /** Message type comment */
2004
- comment?: (string|null);
2005
1775
  }
2006
1776
 
2007
1777
  /** Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. */
@@ -2047,9 +1817,8 @@ export interface IConversionOptions {
2047
1817
  /**
2048
1818
  * Decorator function as returned by {@link Type.d} (TypeScript).
2049
1819
  * @param target Target constructor
2050
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
2051
1820
  */
2052
- export type TypeDecorator<T extends Message<T>> = (target: Constructor<T>) => void;
1821
+ type TypeDecorator<T extends Message<T>> = (target: Constructor<T>) => void;
2053
1822
 
2054
1823
  /** Common type constants. */
2055
1824
  export namespace types {
@@ -2137,52 +1906,12 @@ export namespace types {
2137
1906
  }
2138
1907
 
2139
1908
  /** Constructor type. */
2140
- export type Constructor<T> = Function & { new(...params: any[]): T; prototype: T };
1909
+ export interface Constructor<T> extends Function {
1910
+ new(...params: any[]): T; prototype: T;
1911
+ }
2141
1912
 
2142
1913
  /** Properties type. */
2143
- export type Properties<T> = { [P in keyof T]?: T[P] };
2144
-
2145
- /** Dynamically reflected message type. */
2146
- export type ReflectedMessage = Message<{}> & { [k: string]: any };
2147
-
2148
- /**
2149
- * Callback as used by {@link util.asPromise}.
2150
- * @param error Error, if any
2151
- * @param params Additional arguments
2152
- */
2153
- export type asPromiseCallback = (error: (Error|null), ...params: any[]) => void;
2154
-
2155
- /**
2156
- * Appends code to the function's body or finishes generation.
2157
- * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
2158
- * @param [formatParams] Format parameters
2159
- * @returns Itself or the generated function if finished
2160
- * @throws {Error} If format parameter counts do not match
2161
- */
2162
- export type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
2163
-
2164
- /**
2165
- * Event listener as used by {@link util.EventEmitter}.
2166
- * @param args Arguments
2167
- */
2168
- export type EventEmitterListener = (...args: any[]) => void;
2169
-
2170
- /**
2171
- * Node-style callback as used by {@link util.fetch}.
2172
- * @param error Error, if any, otherwise `null`
2173
- * @param [contents] File contents, if there hasn't been an error
2174
- */
2175
- export type FetchCallback = (error: Error, contents?: string) => void;
2176
-
2177
- /** Options as used by {@link util.fetch}. */
2178
- export interface IFetchOptions {
2179
-
2180
- /** Whether expecting a binary response */
2181
- binary?: boolean;
2182
-
2183
- /** If `true`, forces the use of XMLHttpRequest */
2184
- xhr?: boolean;
2185
- }
1914
+ type Properties<T> = { [P in keyof T]?: T[P] };
2186
1915
 
2187
1916
  /**
2188
1917
  * Any compatible Buffer instance.
@@ -2211,302 +1940,97 @@ export interface Long {
2211
1940
  * A OneOf getter as returned by {@link util.oneOfGetter}.
2212
1941
  * @returns Set field name, if any
2213
1942
  */
2214
- export type OneOfGetter = () => (string|undefined);
1943
+ type OneOfGetter = () => (string|undefined);
2215
1944
 
2216
1945
  /**
2217
1946
  * A OneOf setter as returned by {@link util.oneOfSetter}.
2218
1947
  * @param value Field name
2219
1948
  */
2220
- export type OneOfSetter = (value: (string|undefined)) => void;
2221
-
2222
- /**
2223
- * An allocator as used by {@link util.pool}.
2224
- * @param size Buffer size
2225
- * @returns Buffer
2226
- */
2227
- export type PoolAllocator = (size: number) => Uint8Array;
2228
-
2229
- /**
2230
- * A slicer as used by {@link util.pool}.
2231
- * @param start Start offset
2232
- * @param end End offset
2233
- * @returns Buffer slice
2234
- */
2235
- export type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
1949
+ type OneOfSetter = (value: (string|undefined)) => void;
2236
1950
 
2237
1951
  /** Various utility functions. */
2238
1952
  export namespace util {
2239
1953
 
2240
- /**
2241
- * Returns a promise from a node-style callback function.
2242
- * @param fn Function to call
2243
- * @param ctx Function context
2244
- * @param params Function arguments
2245
- * @returns Promisified function
2246
- */
2247
- function asPromise(fn: asPromiseCallback, ctx: any, ...params: any[]): Promise<any>;
1954
+ /** Helper class for working with the low and high bits of a 64 bit value. */
1955
+ class LongBits {
2248
1956
 
2249
- /** A minimal base64 implementation for number arrays. */
2250
- namespace base64 {
1957
+ /**
1958
+ * Constructs new long bits.
1959
+ * @param lo Low 32 bits, unsigned
1960
+ * @param hi High 32 bits, unsigned
1961
+ */
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;
2251
1975
 
2252
1976
  /**
2253
- * Calculates the byte length of a base64 encoded string.
2254
- * @param string Base64 encoded string
2255
- * @returns Byte length
1977
+ * Constructs new long bits from the specified number.
1978
+ * @param value Value
1979
+ * @returns Instance
2256
1980
  */
2257
- function length(string: string): number;
1981
+ public static fromNumber(value: number): util.LongBits;
2258
1982
 
2259
1983
  /**
2260
- * Encodes a buffer to a base64 encoded string.
2261
- * @param buffer Source buffer
2262
- * @param start Source start
2263
- * @param end Source end
2264
- * @returns Base64 encoded string
1984
+ * Constructs new long bits from a number, long or string.
1985
+ * @param value Value
1986
+ * @returns Instance
2265
1987
  */
2266
- function encode(buffer: Uint8Array, start: number, end: number): string;
1988
+ public static from(value: (Long|number|string)): util.LongBits;
2267
1989
 
2268
1990
  /**
2269
- * Decodes a base64 encoded string to a buffer.
2270
- * @param string Source string
2271
- * @param buffer Destination buffer
2272
- * @param offset Destination offset
2273
- * @returns Number of bytes written
2274
- * @throws {Error} If encoding is invalid
1991
+ * Converts this long bits to a possibly unsafe JavaScript number.
1992
+ * @param [unsigned=false] Whether unsigned or not
1993
+ * @returns Possibly unsafe number
2275
1994
  */
2276
- function decode(string: string, buffer: Uint8Array, offset: number): number;
1995
+ public toNumber(unsigned?: boolean): number;
2277
1996
 
2278
1997
  /**
2279
- * Tests if the specified string appears to be base64 encoded.
2280
- * @param string String to test
2281
- * @returns `true` if probably base64 encoded, otherwise false
1998
+ * Converts this long bits to a long.
1999
+ * @param [unsigned=false] Whether unsigned or not
2000
+ * @returns Long
2282
2001
  */
2283
- function test(string: string): boolean;
2284
- }
2002
+ public toLong(unsigned?: boolean): Long;
2285
2003
 
2286
- /**
2287
- * Begins generating a function.
2288
- * @param functionParams Function parameter names
2289
- * @param [functionName] Function name if not anonymous
2290
- * @returns Appender that appends code to the function's body
2291
- */
2292
- function codegen(functionParams: string[], functionName?: string): Codegen;
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;
2293
2010
 
2294
- namespace codegen {
2011
+ /**
2012
+ * Converts this long bits to a 8 characters long hash.
2013
+ * @returns Hash
2014
+ */
2015
+ public toHash(): string;
2295
2016
 
2296
- /** When set to `true`, codegen will log generated code to console. Useful for debugging. */
2297
- let verbose: boolean;
2298
- }
2299
-
2300
- /**
2301
- * Begins generating a function.
2302
- * @param [functionName] Function name if not anonymous
2303
- * @returns Appender that appends code to the function's body
2304
- */
2305
- function codegen(functionName?: string): Codegen;
2306
-
2307
- /** A minimal event emitter. */
2308
- class EventEmitter {
2309
-
2310
- /** Constructs a new event emitter instance. */
2311
- constructor();
2312
-
2313
- /**
2314
- * Registers an event listener.
2315
- * @param evt Event name
2316
- * @param fn Listener
2317
- * @param [ctx] Listener context
2318
- * @returns `this`
2319
- */
2320
- on(evt: string, fn: EventEmitterListener, ctx?: any): this;
2321
-
2322
- /**
2323
- * Removes an event listener or any matching listeners if arguments are omitted.
2324
- * @param [evt] Event name. Removes all listeners if omitted.
2325
- * @param [fn] Listener to remove. Removes all listeners of `evt` if omitted.
2326
- * @returns `this`
2327
- */
2328
- off(evt?: string, fn?: EventEmitterListener): this;
2329
-
2330
- /**
2331
- * Emits an event by calling its listeners with the specified arguments.
2332
- * @param evt Event name
2333
- * @param args Arguments
2334
- * @returns `this`
2335
- */
2336
- emit(evt: string, ...args: any[]): this;
2337
- }
2338
-
2339
- /**
2340
- * Fetches the contents of a file.
2341
- * @param filename File path or url
2342
- * @param options Fetch options
2343
- * @param callback Callback function
2344
- */
2345
- function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void;
2346
-
2347
- /**
2348
- * Fetches the contents of a file.
2349
- * @param path File path or url
2350
- * @param callback Callback function
2351
- */
2352
- function fetch(path: string, callback: FetchCallback): void;
2353
-
2354
- /**
2355
- * Fetches the contents of a file.
2356
- * @param path File path or url
2357
- * @param [options] Fetch options
2358
- * @returns Promise
2359
- */
2360
- function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>;
2361
-
2362
- /** Reads / writes floats / doubles from / to buffers. */
2363
- namespace float {
2364
-
2365
- /**
2366
- * Writes a 32 bit float to a buffer using little endian byte order.
2367
- * @param val Value to write
2368
- * @param buf Target buffer
2369
- * @param pos Target buffer offset
2370
- */
2371
- function writeFloatLE(val: number, buf: Uint8Array, pos: number): void;
2372
-
2373
- /**
2374
- * Writes a 32 bit float to a buffer using big endian byte order.
2375
- * @param val Value to write
2376
- * @param buf Target buffer
2377
- * @param pos Target buffer offset
2378
- */
2379
- function writeFloatBE(val: number, buf: Uint8Array, pos: number): void;
2380
-
2381
- /**
2382
- * Reads a 32 bit float from a buffer using little endian byte order.
2383
- * @param buf Source buffer
2384
- * @param pos Source buffer offset
2385
- * @returns Value read
2386
- */
2387
- function readFloatLE(buf: Uint8Array, pos: number): number;
2388
-
2389
- /**
2390
- * Reads a 32 bit float from a buffer using big endian byte order.
2391
- * @param buf Source buffer
2392
- * @param pos Source buffer offset
2393
- * @returns Value read
2394
- */
2395
- function readFloatBE(buf: Uint8Array, pos: number): number;
2396
-
2397
- /**
2398
- * Writes a 64 bit double to a buffer using little endian byte order.
2399
- * @param val Value to write
2400
- * @param buf Target buffer
2401
- * @param pos Target buffer offset
2402
- */
2403
- function writeDoubleLE(val: number, buf: Uint8Array, pos: number): void;
2404
-
2405
- /**
2406
- * Writes a 64 bit double to a buffer using big endian byte order.
2407
- * @param val Value to write
2408
- * @param buf Target buffer
2409
- * @param pos Target buffer offset
2410
- */
2411
- function writeDoubleBE(val: number, buf: Uint8Array, pos: number): void;
2412
-
2413
- /**
2414
- * Reads a 64 bit double from a buffer using little endian byte order.
2415
- * @param buf Source buffer
2416
- * @param pos Source buffer offset
2417
- * @returns Value read
2418
- */
2419
- function readDoubleLE(buf: Uint8Array, pos: number): number;
2420
-
2421
- /**
2422
- * Reads a 64 bit double from a buffer using big endian byte order.
2423
- * @param buf Source buffer
2424
- * @param pos Source buffer offset
2425
- * @returns Value read
2426
- */
2427
- function readDoubleBE(buf: Uint8Array, pos: number): number;
2428
- }
2429
-
2430
- /** Helper class for working with the low and high bits of a 64 bit value. */
2431
- class LongBits {
2432
-
2433
- /**
2434
- * Constructs new long bits.
2435
- * @param lo Low 32 bits, unsigned
2436
- * @param hi High 32 bits, unsigned
2437
- */
2438
- constructor(lo: number, hi: number);
2439
-
2440
- /** Low bits. */
2441
- lo: number;
2442
-
2443
- /** High bits. */
2444
- hi: number;
2445
-
2446
- /** Zero bits. */
2447
- static zero: util.LongBits;
2448
-
2449
- /** Zero hash. */
2450
- static zeroHash: string;
2451
-
2452
- /**
2453
- * Constructs new long bits from the specified number.
2454
- * @param value Value
2455
- * @returns Instance
2456
- */
2457
- static fromNumber(value: number): util.LongBits;
2458
-
2459
- /**
2460
- * Constructs new long bits from a number, long or string.
2461
- * @param value Value
2462
- * @returns Instance
2463
- */
2464
- static from(value: (Long|number|string)): util.LongBits;
2465
-
2466
- /**
2467
- * Converts this long bits to a possibly unsafe JavaScript number.
2468
- * @param [unsigned=false] Whether unsigned or not
2469
- * @returns Possibly unsafe number
2470
- */
2471
- toNumber(unsigned?: boolean): number;
2472
-
2473
- /**
2474
- * Converts this long bits to a long.
2475
- * @param [unsigned=false] Whether unsigned or not
2476
- * @returns Long
2477
- */
2478
- toLong(unsigned?: boolean): Long;
2479
-
2480
- /**
2481
- * Constructs new long bits from the specified 8 characters long hash.
2482
- * @param hash Hash
2483
- * @returns Bits
2484
- */
2485
- static fromHash(hash: string): util.LongBits;
2486
-
2487
- /**
2488
- * Converts this long bits to a 8 characters long hash.
2489
- * @returns Hash
2490
- */
2491
- toHash(): string;
2492
-
2493
- /**
2494
- * Zig-zag encodes this long bits.
2495
- * @returns `this`
2496
- */
2497
- zzEncode(): util.LongBits;
2017
+ /**
2018
+ * Zig-zag encodes this long bits.
2019
+ * @returns `this`
2020
+ */
2021
+ public zzEncode(): util.LongBits;
2498
2022
 
2499
2023
  /**
2500
2024
  * Zig-zag decodes this long bits.
2501
2025
  * @returns `this`
2502
2026
  */
2503
- zzDecode(): util.LongBits;
2027
+ public zzDecode(): util.LongBits;
2504
2028
 
2505
2029
  /**
2506
2030
  * Calculates the length of this longbits when encoded as a varint.
2507
2031
  * @returns Length
2508
2032
  */
2509
- length(): number;
2033
+ public length(): number;
2510
2034
  }
2511
2035
 
2512
2036
  /**
@@ -2576,10 +2100,7 @@ export namespace util {
2576
2100
  */
2577
2101
  function newBuffer(sizeOrArray?: (number|number[])): (Uint8Array|Buffer);
2578
2102
 
2579
- /**
2580
- * Array implementation used in the browser.
2581
- * @deprecated Use `Uint8Array` instead.
2582
- */
2103
+ /** Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. */
2583
2104
  let Array: Constructor<Uint8Array>;
2584
2105
 
2585
2106
  /** Long.js's Long class if available. */
@@ -2609,21 +2130,6 @@ export namespace util {
2609
2130
  */
2610
2131
  function longFromHash(hash: string, unsigned?: boolean): (Long|number);
2611
2132
 
2612
- /**
2613
- * Converts a 64 bit key to a long or number if it is an 8 characters long hash string.
2614
- * @param key Map key
2615
- * @param [unsigned=false] Whether unsigned or not
2616
- * @returns Original value
2617
- */
2618
- function longFromKey(key: string, unsigned?: boolean): (Long|number|string);
2619
-
2620
- /**
2621
- * Converts a boolean key to a boolean value.
2622
- * @param key Map key
2623
- * @returns Boolean value
2624
- */
2625
- function boolFromKey(key: string): boolean;
2626
-
2627
2133
  /**
2628
2134
  * Merges the properties of the source object into the destination object.
2629
2135
  * @param dst Destination object
@@ -2642,9 +2148,8 @@ export namespace util {
2642
2148
  * Makes a property safe for assignment as an own property.
2643
2149
  * @param obj Object
2644
2150
  * @param key Property key
2645
- * @param [enumerable=true] Whether the property should be enumerable
2646
2151
  */
2647
- function makeProp(obj: { [k: string]: any }, key: string, enumerable?: boolean): void;
2152
+ function makeProp(obj: { [k: string]: any }, key: string): void;
2648
2153
 
2649
2154
  /**
2650
2155
  * Converts the first character of a string to lower case.
@@ -2664,46 +2169,325 @@ export namespace util {
2664
2169
  class ProtocolError<T extends Message<T>> extends Error {
2665
2170
 
2666
2171
  /**
2667
- * Constructs a new protocol error.
2668
- * @param message Error message
2669
- * @param [properties] Additional properties
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;
2427
+
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;
2435
+
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;
2443
+
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;
2451
+
2452
+ /**
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
2457
+ */
2458
+ function readDoubleLE(buf: Uint8Array, pos: number): number;
2459
+
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
2670
2465
  */
2671
- constructor(message: string, properties?: { [k: string]: any });
2672
-
2673
- /** So far decoded message instance. */
2674
- instance: Message<T>;
2466
+ function readDoubleBE(buf: Uint8Array, pos: number): number;
2675
2467
  }
2676
2468
 
2677
2469
  /**
2678
- * Builds a getter for a oneof's present field name.
2679
- * @param fieldNames Field names
2680
- * @returns Unbound getter
2470
+ * Fetches the contents of a file.
2471
+ * @param filename File path or url
2472
+ * @param options Fetch options
2473
+ * @param callback Callback function
2681
2474
  */
2682
- function oneOfGetter(fieldNames: string[]): OneOfGetter;
2475
+ function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void;
2683
2476
 
2684
2477
  /**
2685
- * Builds a setter for a oneof's present field name.
2686
- * @param fieldNames Field names
2687
- * @returns Unbound setter
2478
+ * Fetches the contents of a file.
2479
+ * @param path File path or url
2480
+ * @param callback Callback function
2688
2481
  */
2689
- function oneOfSetter(fieldNames: string[]): OneOfSetter;
2482
+ function fetch(path: string, callback: FetchCallback): void;
2690
2483
 
2691
2484
  /**
2692
- * Default conversion options used for {@link Message#toJSON} implementations.
2693
- *
2694
- * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
2695
- *
2696
- * - Longs become strings
2697
- * - Enums become string keys
2698
- * - Bytes become base64 encoded strings
2699
- * - (Sub-)Messages become plain objects
2700
- * - Maps become plain objects with all string keys
2701
- * - Repeated fields become arrays
2702
- * - NaN and Infinity for float and double fields become strings
2703
- *
2704
- * @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
2705
2489
  */
2706
- let toJSONOptions: IConversionOptions;
2490
+ function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>;
2707
2491
 
2708
2492
  /** A minimal path module to resolve Unix, Windows and URL paths alike. */
2709
2493
  namespace path {
@@ -2741,7 +2525,7 @@ export namespace util {
2741
2525
  */
2742
2526
  function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
2743
2527
 
2744
- /** A minimal UTF8 implementation. */
2528
+ /** A minimal UTF8 implementation for number arrays. */
2745
2529
  namespace utf8 {
2746
2530
 
2747
2531
  /**
@@ -2760,15 +2544,6 @@ export namespace util {
2760
2544
  */
2761
2545
  function read(buffer: Uint8Array, start: number, end: number): string;
2762
2546
 
2763
- /**
2764
- * Reads UTF8 bytes as a string, rejecting invalid UTF8.
2765
- * @param buffer Source buffer
2766
- * @param start Source start
2767
- * @param end Source end
2768
- * @returns String read
2769
- */
2770
- function readStrict(buffer: Uint8Array, start: number, end: number): string;
2771
-
2772
2547
  /**
2773
2548
  * Writes a string as UTF8 bytes.
2774
2549
  * @param string Source string
@@ -2778,109 +2553,6 @@ export namespace util {
2778
2553
  */
2779
2554
  function write(string: string, buffer: Uint8Array, offset: number): number;
2780
2555
  }
2781
-
2782
- /** Node's fs module if available. */
2783
- let fs: { [k: string]: any };
2784
-
2785
- /**
2786
- * Converts an object's values to an array.
2787
- * @param object Object to convert
2788
- * @returns Converted array
2789
- */
2790
- function toArray(object: { [k: string]: any }): any[];
2791
-
2792
- /**
2793
- * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.
2794
- * @param array Array to convert
2795
- * @returns Converted object
2796
- */
2797
- function toObject(array: any[]): { [k: string]: any };
2798
-
2799
- /**
2800
- * Removes the first matching value from an object.
2801
- * @param object Object to remove from
2802
- * @param value Value to remove
2803
- * @param [key] Optional key for fast path removal
2804
- * @returns `true` if removed, otherwise `false`
2805
- */
2806
- function remove(object: ({ [k: string]: any }|undefined), value: any, key?: string): boolean;
2807
-
2808
- /**
2809
- * Tests whether the specified name is a reserved word in JS.
2810
- * @param name Name to test
2811
- * @returns `true` if reserved, otherwise `false`
2812
- */
2813
- function isReserved(name: string): boolean;
2814
-
2815
- /**
2816
- * Returns a safe property accessor for the specified property name.
2817
- * @param prop Property name
2818
- * @returns Safe accessor
2819
- */
2820
- function safeProp(prop: string): string;
2821
-
2822
- /**
2823
- * Converts the first character of a string to upper case.
2824
- * @param str String to convert
2825
- * @returns Converted string
2826
- */
2827
- function ucFirst(str: string): string;
2828
-
2829
- /**
2830
- * Converts a string to camel case.
2831
- * @param str String to convert
2832
- * @returns Converted string
2833
- * @deprecated Use {@link util.jsonName} for protobuf field JSON names.
2834
- */
2835
- function camelCase(str: string): string;
2836
-
2837
- /**
2838
- * Converts a proto field name to its protoc-compatible JSON name.
2839
- * @param str Proto field name
2840
- * @returns JSON name
2841
- */
2842
- function jsonName(str: string): string;
2843
-
2844
- /**
2845
- * Compares reflected fields by id.
2846
- * @param a First field
2847
- * @param b Second field
2848
- * @returns Comparison value
2849
- */
2850
- function compareFieldsById(a: Field, b: Field): number;
2851
-
2852
- /**
2853
- * Decorator helper for types (TypeScript).
2854
- * @param ctor Constructor function
2855
- * @param [typeName] Type name, defaults to the constructor's name
2856
- * @returns Reflected type
2857
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
2858
- */
2859
- function decorateType<T extends Message<T>>(ctor: Constructor<T>, typeName?: string): Type;
2860
-
2861
- /**
2862
- * Decorator helper for enums (TypeScript).
2863
- * @param object Enum object
2864
- * @returns Reflected enum
2865
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
2866
- */
2867
- function decorateEnum(object: object): Enum;
2868
-
2869
- /**
2870
- * Sets the value of a property by property path. If a value already exists, it is turned to an array
2871
- * @param dst Destination object
2872
- * @param path dot '.' delimited path of the property to set
2873
- * @param value the value to set
2874
- * @param [ifNotSet] Sets the option only if it isn't currently set
2875
- * @returns Destination object
2876
- */
2877
- function setProperty(dst: { [k: string]: any }, path: string, value: object, ifNotSet?: (boolean|undefined)): { [k: string]: any };
2878
-
2879
- /**
2880
- * Decorator root (TypeScript).
2881
- * @deprecated Legacy TypeScript decorator support. Will be removed in a future release.
2882
- */
2883
- let decorateRoot: Root;
2884
2556
  }
2885
2557
 
2886
2558
  /**
@@ -2898,7 +2570,7 @@ export const wrappers: { [k: string]: IWrapper };
2898
2570
  * @param object Plain object
2899
2571
  * @returns Message instance
2900
2572
  */
2901
- export type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any }) => Message<{}>;
2573
+ type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any }) => Message<{}>;
2902
2574
 
2903
2575
  /**
2904
2576
  * To object converter part of an {@link IWrapper}.
@@ -2906,7 +2578,7 @@ export type WrapperFromObjectConverter = (this: Type, object: { [k: string]: any
2906
2578
  * @param [options] Conversion options
2907
2579
  * @returns Plain object
2908
2580
  */
2909
- export type WrapperToObjectConverter = (this: Type, message: Message<{}>, options?: IConversionOptions) => { [k: string]: any };
2581
+ type WrapperToObjectConverter = (this: Type, message: Message<{}>, options?: IConversionOptions) => { [k: string]: any };
2910
2582
 
2911
2583
  /** Common type wrapper part of {@link wrappers}. */
2912
2584
  export interface IWrapper {
@@ -2918,66 +2590,57 @@ export interface IWrapper {
2918
2590
  toObject?: WrapperToObjectConverter;
2919
2591
  }
2920
2592
 
2921
- /** Wire format writer using `Uint8Array`. */
2593
+ /** Wire format writer using `Uint8Array` if available, otherwise `Array`. */
2922
2594
  export class Writer {
2923
2595
 
2924
2596
  /** Constructs a new writer instance. */
2925
2597
  constructor();
2926
2598
 
2927
- /** Write cursor into {@link Writer#buf}. */
2928
- pos: number;
2929
-
2930
- /** Backing buffer. */
2931
- buf: Uint8Array;
2599
+ /** Current length. */
2600
+ public len: number;
2932
2601
 
2933
- /** Cached DataView over {@link Writer#buf}. */
2934
- view: (DataView|null);
2602
+ /** Operations head. */
2603
+ public head: object;
2935
2604
 
2936
- /** Stack of forked length-prefix positions. */
2937
- states: (number[]|null);
2605
+ /** Operations tail */
2606
+ public tail: object;
2938
2607
 
2939
- /** Initial backing buffer size in bytes. Defaults to 128. */
2940
- static initialBufferSize: number;
2941
-
2942
- /**
2943
- * Current write position.
2944
- * @deprecated Use {@link Writer#pos} instead.
2945
- */
2946
- len: number;
2608
+ /** Linked forked states. */
2609
+ public states: (object|null);
2947
2610
 
2948
2611
  /**
2949
2612
  * Creates a new writer.
2950
2613
  * @returns A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}
2951
2614
  */
2952
- static create(): (BufferWriter|Writer);
2615
+ public static create(): (BufferWriter|Writer);
2953
2616
 
2954
2617
  /**
2955
2618
  * Allocates a buffer of the specified size.
2956
2619
  * @param size Buffer size
2957
2620
  * @returns Buffer
2958
2621
  */
2959
- static alloc(size: number): Uint8Array;
2622
+ public static alloc(size: number): Uint8Array;
2960
2623
 
2961
2624
  /**
2962
2625
  * Writes an unsigned 32 bit value as a varint.
2963
2626
  * @param value Value to write
2964
2627
  * @returns `this`
2965
2628
  */
2966
- uint32(value: number): Writer;
2629
+ public uint32(value: number): Writer;
2967
2630
 
2968
2631
  /**
2969
2632
  * Writes a signed 32 bit value as a varint.
2970
2633
  * @param value Value to write
2971
2634
  * @returns `this`
2972
2635
  */
2973
- int32(value: number): Writer;
2636
+ public int32(value: number): Writer;
2974
2637
 
2975
2638
  /**
2976
2639
  * Writes a 32 bit value as a varint, zig-zag encoded.
2977
2640
  * @param value Value to write
2978
2641
  * @returns `this`
2979
2642
  */
2980
- sint32(value: number): Writer;
2643
+ public sint32(value: number): Writer;
2981
2644
 
2982
2645
  /**
2983
2646
  * Writes an unsigned 64 bit value as a varint.
@@ -2985,7 +2648,7 @@ export class Writer {
2985
2648
  * @returns `this`
2986
2649
  * @throws {TypeError} If `value` is a string and no long library is present.
2987
2650
  */
2988
- uint64(value: (Long|number|string)): Writer;
2651
+ public uint64(value: (Long|number|string)): Writer;
2989
2652
 
2990
2653
  /**
2991
2654
  * Writes a signed 64 bit value as a varint.
@@ -2993,7 +2656,7 @@ export class Writer {
2993
2656
  * @returns `this`
2994
2657
  * @throws {TypeError} If `value` is a string and no long library is present.
2995
2658
  */
2996
- int64(value: (Long|number|string)): Writer;
2659
+ public int64(value: (Long|number|string)): Writer;
2997
2660
 
2998
2661
  /**
2999
2662
  * Writes a signed 64 bit value as a varint, zig-zag encoded.
@@ -3001,28 +2664,28 @@ export class Writer {
3001
2664
  * @returns `this`
3002
2665
  * @throws {TypeError} If `value` is a string and no long library is present.
3003
2666
  */
3004
- sint64(value: (Long|number|string)): Writer;
2667
+ public sint64(value: (Long|number|string)): Writer;
3005
2668
 
3006
2669
  /**
3007
2670
  * Writes a boolish value as a varint.
3008
2671
  * @param value Value to write
3009
2672
  * @returns `this`
3010
2673
  */
3011
- bool(value: boolean): Writer;
2674
+ public bool(value: boolean): Writer;
3012
2675
 
3013
2676
  /**
3014
2677
  * Writes an unsigned 32 bit value as fixed 32 bits.
3015
2678
  * @param value Value to write
3016
2679
  * @returns `this`
3017
2680
  */
3018
- fixed32(value: number): Writer;
2681
+ public fixed32(value: number): Writer;
3019
2682
 
3020
2683
  /**
3021
2684
  * Writes a signed 32 bit value as fixed 32 bits.
3022
2685
  * @param value Value to write
3023
2686
  * @returns `this`
3024
2687
  */
3025
- sfixed32(value: number): Writer;
2688
+ public sfixed32(value: number): Writer;
3026
2689
 
3027
2690
  /**
3028
2691
  * Writes an unsigned 64 bit value as fixed 64 bits.
@@ -3030,7 +2693,7 @@ export class Writer {
3030
2693
  * @returns `this`
3031
2694
  * @throws {TypeError} If `value` is a string and no long library is present.
3032
2695
  */
3033
- fixed64(value: (Long|number|string)): Writer;
2696
+ public fixed64(value: (Long|number|string)): Writer;
3034
2697
 
3035
2698
  /**
3036
2699
  * Writes a signed 64 bit value as fixed 64 bits.
@@ -3038,169 +2701,60 @@ export class Writer {
3038
2701
  * @returns `this`
3039
2702
  * @throws {TypeError} If `value` is a string and no long library is present.
3040
2703
  */
3041
- sfixed64(value: (Long|number|string)): Writer;
2704
+ public sfixed64(value: (Long|number|string)): Writer;
3042
2705
 
3043
2706
  /**
3044
2707
  * Writes a float (32 bit).
3045
2708
  * @param value Value to write
3046
2709
  * @returns `this`
3047
2710
  */
3048
- float(value: number): Writer;
2711
+ public float(value: number): Writer;
3049
2712
 
3050
2713
  /**
3051
2714
  * Writes a double (64 bit float).
3052
2715
  * @param value Value to write
3053
2716
  * @returns `this`
3054
2717
  */
3055
- double(value: number): Writer;
2718
+ public double(value: number): Writer;
3056
2719
 
3057
2720
  /**
3058
2721
  * Writes a sequence of bytes.
3059
2722
  * @param value Buffer or base64 encoded string to write
3060
2723
  * @returns `this`
3061
2724
  */
3062
- bytes(value: (Uint8Array|string)): Writer;
3063
-
3064
- /**
3065
- * Writes raw bytes without a tag or length prefix.
3066
- * @param value Raw bytes
3067
- * @returns `this`
3068
- */
3069
- raw(value: Uint8Array): Writer;
2725
+ public bytes(value: (Uint8Array|string)): Writer;
3070
2726
 
3071
2727
  /**
3072
2728
  * Writes a string.
3073
2729
  * @param value Value to write
3074
2730
  * @returns `this`
3075
2731
  */
3076
- string(value: string): Writer;
3077
-
3078
- /**
3079
- * Writes an array of unsigned 32 bit values as a packed repeated field.
3080
- * @param value Values to write
3081
- * @returns `this`
3082
- */
3083
- uint32s(value: number[]): Writer;
3084
-
3085
- /**
3086
- * Writes an array of signed 32 bit values as a packed repeated field.
3087
- * @param value Values to write
3088
- * @returns `this`
3089
- */
3090
- int32s(value: number[]): Writer;
3091
-
3092
- /**
3093
- * Writes an array of 32 bit values as packed, zig-zag encoded varints.
3094
- * @param value Values to write
3095
- * @returns `this`
3096
- */
3097
- sint32s(value: number[]): Writer;
3098
-
3099
- /**
3100
- * Writes an array of unsigned 64 bit values as a packed repeated field.
3101
- * @param value Values to write
3102
- * @returns `this`
3103
- */
3104
- uint64s(value: (Long|number|string)[]): Writer;
3105
-
3106
- /**
3107
- * Writes an array of signed 64 bit values as a packed repeated field.
3108
- * @param value Values to write
3109
- * @returns `this`
3110
- */
3111
- int64s(value: (Long|number|string)[]): Writer;
3112
-
3113
- /**
3114
- * Writes an array of 64 bit values as packed, zig-zag encoded varints.
3115
- * @param value Values to write
3116
- * @returns `this`
3117
- */
3118
- sint64s(value: (Long|number|string)[]): Writer;
3119
-
3120
- /**
3121
- * Writes an array of boolish values as a packed repeated field.
3122
- * @param value Values to write
3123
- * @returns `this`
3124
- */
3125
- bools(value: boolean[]): Writer;
3126
-
3127
- /**
3128
- * Writes an array of unsigned 32 bit values as packed, fixed 32 bits.
3129
- * @param value Values to write
3130
- * @returns `this`
3131
- */
3132
- fixed32s(value: number[]): Writer;
3133
-
3134
- /**
3135
- * Writes an array of signed 32 bit values as packed, fixed 32 bits.
3136
- * @param value Values to write
3137
- * @returns `this`
3138
- */
3139
- sfixed32s(value: number[]): Writer;
3140
-
3141
- /**
3142
- * Writes an array of unsigned 64 bit values as packed, fixed 64 bits.
3143
- * @param value Values to write
3144
- * @returns `this`
3145
- */
3146
- fixed64s(value: (Long|number|string)[]): Writer;
3147
-
3148
- /**
3149
- * Writes an array of signed 64 bit values as packed, fixed 64 bits.
3150
- * @param value Values to write
3151
- * @returns `this`
3152
- */
3153
- sfixed64s(value: (Long|number|string)[]): Writer;
3154
-
3155
- /**
3156
- * Writes an array of floats (32 bit) as a packed repeated field.
3157
- * @param value Values to write
3158
- * @returns `this`
3159
- */
3160
- floats(value: number[]): Writer;
3161
-
3162
- /**
3163
- * Writes an array of doubles (64 bit float) as a packed repeated field.
3164
- * @param value Values to write
3165
- * @returns `this`
3166
- */
3167
- doubles(value: number[]): Writer;
2732
+ public string(value: string): Writer;
3168
2733
 
3169
2734
  /**
3170
2735
  * Forks this writer's state by pushing it to a stack.
2736
+ * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.
3171
2737
  * @returns `this`
3172
2738
  */
3173
- fork(): Writer;
2739
+ public fork(): Writer;
3174
2740
 
3175
2741
  /**
3176
2742
  * Resets this instance to the last state.
3177
2743
  * @returns `this`
3178
2744
  */
3179
- reset(): Writer;
2745
+ public reset(): Writer;
3180
2746
 
3181
2747
  /**
3182
- * Resets to the last state and prepends the fork state's current write length as a varint.
2748
+ * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.
3183
2749
  * @returns `this`
3184
2750
  */
3185
- ldelim(): Writer;
2751
+ public ldelim(): Writer;
3186
2752
 
3187
2753
  /**
3188
2754
  * Finishes the write operation.
3189
- * Returns a buffer sized to the written data by default.
3190
- * @param [shared=false] Whether to return a shared view instead of a unique copy
3191
2755
  * @returns Finished buffer
3192
2756
  */
3193
- finish(shared?: boolean): Uint8Array;
3194
-
3195
- /**
3196
- * Finishes the write operation, writing into the provided buffer.
3197
- * The caller must ensure that `buf` has enough space starting at `offset`
3198
- * to hold {@link Writer#pos} bytes.
3199
- * @param buf Target buffer
3200
- * @param [offset=0] Offset to start writing at
3201
- * @returns The provided buffer
3202
- */
3203
- finishInto<T extends Uint8Array>(buf: T, offset?: number): T;
2757
+ public finish(): Uint8Array;
3204
2758
  }
3205
2759
 
3206
2760
  /** Wire format writer using node buffers. */
@@ -3214,11 +2768,65 @@ export class BufferWriter extends Writer {
3214
2768
  * @param size Buffer size
3215
2769
  * @returns Buffer
3216
2770
  */
3217
- static alloc(size: number): Buffer;
2771
+ public static alloc(size: number): Buffer;
3218
2772
 
3219
2773
  /**
3220
2774
  * Finishes the write operation.
3221
2775
  * @returns Finished buffer
3222
2776
  */
3223
- finish(): Buffer;
2777
+ public finish(): Buffer;
2778
+ }
2779
+
2780
+ /**
2781
+ * Callback as used by {@link util.asPromise}.
2782
+ * @param error Error, if any
2783
+ * @param params Additional arguments
2784
+ */
2785
+ type asPromiseCallback = (error: (Error|null), ...params: any[]) => void;
2786
+
2787
+ /**
2788
+ * Appends code to the function's body or finishes generation.
2789
+ * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
2790
+ * @param [formatParams] Format parameters
2791
+ * @returns Itself or the generated function if finished
2792
+ * @throws {Error} If format parameter counts do not match
2793
+ */
2794
+ type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
2795
+
2796
+ /**
2797
+ * Event listener as used by {@link util.EventEmitter}.
2798
+ * @param args Arguments
2799
+ */
2800
+ type EventEmitterListener = (...args: any[]) => void;
2801
+
2802
+ /**
2803
+ * Node-style callback as used by {@link util.fetch}.
2804
+ * @param error Error, if any, otherwise `null`
2805
+ * @param [contents] File contents, if there hasn't been an error
2806
+ */
2807
+ type FetchCallback = (error: Error, contents?: string) => void;
2808
+
2809
+ /** Options as used by {@link util.fetch}. */
2810
+ export interface IFetchOptions {
2811
+
2812
+ /** Whether expecting a binary response */
2813
+ binary?: boolean;
2814
+
2815
+ /** If `true`, forces the use of XMLHttpRequest */
2816
+ xhr?: boolean;
3224
2817
  }
2818
+
2819
+ /**
2820
+ * An allocator as used by {@link util.pool}.
2821
+ * @param size Buffer size
2822
+ * @returns Buffer
2823
+ */
2824
+ type PoolAllocator = (size: number) => Uint8Array;
2825
+
2826
+ /**
2827
+ * A slicer as used by {@link util.pool}.
2828
+ * @param start Start offset
2829
+ * @param end End offset
2830
+ * @returns Buffer slice
2831
+ */
2832
+ type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;