node-red-contrib-tak-registration 0.11.6 → 0.12.1

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 (388) hide show
  1. package/node_modules/@types/node/README.md +2 -2
  2. package/node_modules/@types/node/assert.d.ts +88 -44
  3. package/node_modules/@types/node/async_hooks.d.ts +17 -15
  4. package/node_modules/@types/node/buffer.d.ts +29 -110
  5. package/node_modules/@types/node/child_process.d.ts +38 -34
  6. package/node_modules/@types/node/cluster.d.ts +165 -19
  7. package/node_modules/@types/node/console.d.ts +64 -27
  8. package/node_modules/@types/node/crypto.d.ts +106 -142
  9. package/node_modules/@types/node/dgram.d.ts +14 -14
  10. package/node_modules/@types/node/diagnostics_channel.d.ts +12 -3
  11. package/node_modules/@types/node/dns/promises.d.ts +79 -28
  12. package/node_modules/@types/node/dns.d.ts +124 -69
  13. package/node_modules/@types/node/dom-events.d.ts +2 -0
  14. package/node_modules/@types/node/domain.d.ts +4 -4
  15. package/node_modules/@types/node/events.d.ts +115 -63
  16. package/node_modules/@types/node/fs/promises.d.ts +34 -12
  17. package/node_modules/@types/node/fs.d.ts +104 -40
  18. package/node_modules/@types/node/globals.d.ts +1 -0
  19. package/node_modules/@types/node/http.d.ts +69 -48
  20. package/node_modules/@types/node/http2.d.ts +83 -47
  21. package/node_modules/@types/node/https.d.ts +3 -3
  22. package/node_modules/@types/node/index.d.ts +1 -0
  23. package/node_modules/@types/node/inspector.d.ts +5 -6
  24. package/node_modules/@types/node/module.d.ts +0 -14
  25. package/node_modules/@types/node/net.d.ts +58 -13
  26. package/node_modules/@types/node/os.d.ts +29 -12
  27. package/node_modules/@types/node/package.json +4 -16
  28. package/node_modules/@types/node/path.d.ts +1 -1
  29. package/node_modules/@types/node/perf_hooks.d.ts +308 -48
  30. package/node_modules/@types/node/process.d.ts +241 -48
  31. package/node_modules/@types/node/punycode.d.ts +4 -4
  32. package/node_modules/@types/node/querystring.d.ts +18 -6
  33. package/node_modules/@types/node/readline/promises.d.ts +9 -9
  34. package/node_modules/@types/node/readline.d.ts +23 -22
  35. package/node_modules/@types/node/repl.d.ts +21 -21
  36. package/node_modules/@types/node/sea.d.ts +153 -0
  37. package/node_modules/@types/node/stream/web.d.ts +3 -2
  38. package/node_modules/@types/node/stream.d.ts +63 -57
  39. package/node_modules/@types/node/string_decoder.d.ts +3 -3
  40. package/node_modules/@types/node/test.d.ts +363 -98
  41. package/node_modules/@types/node/timers/promises.d.ts +10 -6
  42. package/node_modules/@types/node/timers.d.ts +5 -5
  43. package/node_modules/@types/node/tls.d.ts +39 -32
  44. package/node_modules/@types/node/trace_events.d.ts +40 -25
  45. package/node_modules/@types/node/tty.d.ts +8 -8
  46. package/node_modules/@types/node/url.d.ts +15 -7
  47. package/node_modules/@types/node/util.d.ts +131 -22
  48. package/node_modules/@types/node/v8.d.ts +51 -7
  49. package/node_modules/@types/node/vm.d.ts +43 -24
  50. package/node_modules/@types/node/wasi.d.ts +12 -10
  51. package/node_modules/@types/node/worker_threads.d.ts +19 -16
  52. package/node_modules/@types/node/zlib.d.ts +16 -3
  53. package/node_modules/adm-zip/README.md +2 -1
  54. package/node_modules/adm-zip/adm-zip.js +46 -45
  55. package/node_modules/adm-zip/headers/entryHeader.js +14 -12
  56. package/node_modules/adm-zip/headers/mainHeader.js +1 -1
  57. package/node_modules/adm-zip/methods/inflater.js +6 -3
  58. package/node_modules/adm-zip/methods/zipcrypto.js +6 -2
  59. package/node_modules/adm-zip/package.json +2 -2
  60. package/node_modules/adm-zip/util/errors.js +1 -0
  61. package/node_modules/adm-zip/zipEntry.js +64 -43
  62. package/node_modules/adm-zip/zipFile.js +35 -35
  63. package/node_modules/axios/CHANGELOG.md +868 -759
  64. package/node_modules/axios/README.md +65 -17
  65. package/node_modules/axios/dist/axios.js +1330 -583
  66. package/node_modules/axios/dist/axios.js.map +1 -1
  67. package/node_modules/axios/dist/axios.min.js +1 -1
  68. package/node_modules/axios/dist/axios.min.js.map +1 -1
  69. package/node_modules/axios/dist/browser/axios.cjs +696 -316
  70. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  71. package/node_modules/axios/dist/esm/axios.js +696 -316
  72. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  73. package/node_modules/axios/dist/esm/axios.min.js +1 -1
  74. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  75. package/node_modules/axios/dist/node/axios.cjs +607 -257
  76. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  77. package/node_modules/axios/index.d.cts +5 -2
  78. package/node_modules/axios/index.d.ts +5 -2
  79. package/node_modules/axios/lib/adapters/adapters.js +3 -1
  80. package/node_modules/axios/lib/adapters/fetch.js +227 -0
  81. package/node_modules/axios/lib/adapters/http.js +1 -1
  82. package/node_modules/axios/lib/adapters/xhr.js +31 -101
  83. package/node_modules/axios/lib/core/Axios.js +17 -11
  84. package/node_modules/axios/lib/core/AxiosHeaders.js +4 -0
  85. package/node_modules/axios/lib/core/mergeConfig.js +1 -1
  86. package/node_modules/axios/lib/defaults/index.js +7 -5
  87. package/node_modules/axios/lib/env/data.js +1 -1
  88. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +9 -8
  89. package/node_modules/axios/lib/helpers/composeSignals.js +46 -0
  90. package/node_modules/axios/lib/helpers/progressEventReducer.js +32 -0
  91. package/node_modules/axios/lib/helpers/resolveConfig.js +57 -0
  92. package/node_modules/axios/lib/helpers/throttle.js +5 -3
  93. package/node_modules/axios/lib/helpers/trackStream.js +55 -0
  94. package/node_modules/axios/lib/platform/common/utils.js +4 -1
  95. package/node_modules/axios/lib/utils.js +7 -2
  96. package/node_modules/axios/package.json +27 -26
  97. package/node_modules/fast-xml-parser/CHANGELOG.md +14 -0
  98. package/node_modules/fast-xml-parser/README.md +7 -14
  99. package/node_modules/fast-xml-parser/package.json +1 -1
  100. package/node_modules/fast-xml-parser/src/fxp.d.ts +4 -4
  101. package/node_modules/fast-xml-parser/src/v5/CharsSymbol.js +16 -0
  102. package/node_modules/fast-xml-parser/src/v5/EntitiesParser.js +107 -0
  103. package/node_modules/fast-xml-parser/src/v5/OptionsBuilder.js +64 -0
  104. package/node_modules/fast-xml-parser/src/v5/OutputBuilders/BaseOutputBuilder.js +71 -0
  105. package/node_modules/fast-xml-parser/src/v5/OutputBuilders/JsArrBuilder.js +103 -0
  106. package/node_modules/fast-xml-parser/src/v5/OutputBuilders/JsMinArrBuilder.js +102 -0
  107. package/node_modules/fast-xml-parser/src/v5/OutputBuilders/JsObjBuilder.js +156 -0
  108. package/node_modules/fast-xml-parser/src/v5/OutputBuilders/ParserOptionsBuilder.js +96 -0
  109. package/node_modules/fast-xml-parser/src/v5/Report.js +0 -0
  110. package/node_modules/fast-xml-parser/src/v5/TagPath.js +81 -0
  111. package/node_modules/fast-xml-parser/src/v5/TagPathMatcher.js +15 -0
  112. package/node_modules/fast-xml-parser/src/v5/XMLParser.js +85 -0
  113. package/node_modules/fast-xml-parser/src/v5/Xml2JsParser.js +237 -0
  114. package/node_modules/fast-xml-parser/src/v5/XmlPartReader.js +212 -0
  115. package/node_modules/fast-xml-parser/src/v5/XmlSpecialTagsReader.js +118 -0
  116. package/node_modules/fast-xml-parser/src/v5/inputSource/BufferSource.js +118 -0
  117. package/node_modules/fast-xml-parser/src/v5/inputSource/StringSource.js +123 -0
  118. package/node_modules/fast-xml-parser/src/v5/valueParsers/EntitiesParser.js +107 -0
  119. package/node_modules/fast-xml-parser/src/v5/valueParsers/booleanParser.js +23 -0
  120. package/node_modules/fast-xml-parser/src/v5/valueParsers/booleanParserExt.js +20 -0
  121. package/node_modules/fast-xml-parser/src/v5/valueParsers/currency.js +31 -0
  122. package/node_modules/fast-xml-parser/src/v5/valueParsers/join.js +14 -0
  123. package/node_modules/fast-xml-parser/src/v5/valueParsers/number.js +16 -0
  124. package/node_modules/fast-xml-parser/src/v5/valueParsers/trim.js +8 -0
  125. package/node_modules/fast-xml-parser/src/validator.js +2 -0
  126. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +13 -4
  127. package/node_modules/follow-redirects/index.js +1 -1
  128. package/node_modules/follow-redirects/package.json +1 -1
  129. package/node_modules/hasown/CHANGELOG.md +12 -0
  130. package/node_modules/hasown/index.d.ts +2 -2
  131. package/node_modules/hasown/package.json +5 -2
  132. package/node_modules/hasown/tsconfig.json +3 -46
  133. package/node_modules/object-is/.eslintrc +1 -1
  134. package/node_modules/object-is/.nycrc +0 -4
  135. package/node_modules/object-is/CHANGELOG.md +25 -0
  136. package/node_modules/object-is/README.md +20 -20
  137. package/node_modules/object-is/package.json +23 -14
  138. package/node_modules/protobufjs/LICENSE +39 -39
  139. package/node_modules/protobufjs/README.md +727 -740
  140. package/node_modules/protobufjs/dist/light/protobuf.js +6264 -6264
  141. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  142. package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
  143. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  144. package/node_modules/protobufjs/dist/minimal/protobuf.js +1928 -1928
  145. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  146. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  147. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  148. package/node_modules/protobufjs/dist/protobuf.js +7978 -7961
  149. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  150. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  151. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  152. package/node_modules/protobufjs/ext/debug/README.md +4 -4
  153. package/node_modules/protobufjs/ext/debug/index.js +71 -71
  154. package/node_modules/protobufjs/ext/descriptor/README.md +72 -72
  155. package/node_modules/protobufjs/ext/descriptor/index.d.ts +191 -191
  156. package/node_modules/protobufjs/ext/descriptor/index.js +1052 -1052
  157. package/node_modules/protobufjs/ext/descriptor/test.js +54 -54
  158. package/node_modules/protobufjs/google/LICENSE +27 -27
  159. package/node_modules/protobufjs/google/README.md +1 -1
  160. package/node_modules/protobufjs/google/api/annotations.json +82 -82
  161. package/node_modules/protobufjs/google/api/annotations.proto +10 -10
  162. package/node_modules/protobufjs/google/api/http.json +85 -85
  163. package/node_modules/protobufjs/google/api/http.proto +30 -30
  164. package/node_modules/protobufjs/google/protobuf/api.json +117 -117
  165. package/node_modules/protobufjs/google/protobuf/api.proto +33 -33
  166. package/node_modules/protobufjs/google/protobuf/descriptor.json +738 -738
  167. package/node_modules/protobufjs/google/protobuf/descriptor.proto +286 -286
  168. package/node_modules/protobufjs/google/protobuf/source_context.json +19 -19
  169. package/node_modules/protobufjs/google/protobuf/source_context.proto +7 -7
  170. package/node_modules/protobufjs/google/protobuf/type.json +201 -201
  171. package/node_modules/protobufjs/google/protobuf/type.proto +89 -89
  172. package/node_modules/protobufjs/index.d.ts +2741 -2741
  173. package/node_modules/protobufjs/index.js +4 -4
  174. package/node_modules/protobufjs/light.d.ts +2 -2
  175. package/node_modules/protobufjs/light.js +3 -3
  176. package/node_modules/protobufjs/minimal.d.ts +2 -2
  177. package/node_modules/protobufjs/minimal.js +4 -4
  178. package/node_modules/protobufjs/package.json +111 -111
  179. package/node_modules/protobufjs/scripts/postinstall.js +32 -32
  180. package/node_modules/protobufjs/src/common.js +399 -399
  181. package/node_modules/protobufjs/src/converter.js +301 -301
  182. package/node_modules/protobufjs/src/decoder.js +129 -129
  183. package/node_modules/protobufjs/src/encoder.js +100 -100
  184. package/node_modules/protobufjs/src/enum.js +198 -198
  185. package/node_modules/protobufjs/src/field.js +377 -377
  186. package/node_modules/protobufjs/src/index-light.js +104 -104
  187. package/node_modules/protobufjs/src/index-minimal.js +36 -36
  188. package/node_modules/protobufjs/src/index.js +12 -12
  189. package/node_modules/protobufjs/src/mapfield.js +126 -126
  190. package/node_modules/protobufjs/src/message.js +138 -138
  191. package/node_modules/protobufjs/src/method.js +160 -160
  192. package/node_modules/protobufjs/src/namespace.js +433 -433
  193. package/node_modules/protobufjs/src/object.js +243 -243
  194. package/node_modules/protobufjs/src/oneof.js +203 -203
  195. package/node_modules/protobufjs/src/parse.js +889 -872
  196. package/node_modules/protobufjs/src/reader.js +416 -416
  197. package/node_modules/protobufjs/src/reader_buffer.js +51 -51
  198. package/node_modules/protobufjs/src/root.js +368 -368
  199. package/node_modules/protobufjs/src/roots.js +18 -18
  200. package/node_modules/protobufjs/src/rpc/service.js +142 -142
  201. package/node_modules/protobufjs/src/rpc.js +36 -36
  202. package/node_modules/protobufjs/src/service.js +167 -167
  203. package/node_modules/protobufjs/src/tokenize.js +416 -416
  204. package/node_modules/protobufjs/src/type.js +589 -589
  205. package/node_modules/protobufjs/src/types.js +196 -196
  206. package/node_modules/protobufjs/src/typescript.jsdoc +15 -15
  207. package/node_modules/protobufjs/src/util/longbits.js +200 -200
  208. package/node_modules/protobufjs/src/util/minimal.js +438 -438
  209. package/node_modules/protobufjs/src/util.js +212 -212
  210. package/node_modules/protobufjs/src/verifier.js +176 -176
  211. package/node_modules/protobufjs/src/wrappers.js +102 -102
  212. package/node_modules/protobufjs/src/writer.js +465 -465
  213. package/node_modules/protobufjs/src/writer_buffer.js +85 -85
  214. package/node_modules/protobufjs/tsconfig.json +7 -7
  215. package/node_modules/set-function-length/CHANGELOG.md +11 -0
  216. package/node_modules/set-function-length/env.d.ts +9 -6
  217. package/node_modules/set-function-length/env.js +1 -0
  218. package/node_modules/set-function-length/index.d.ts +6 -6
  219. package/node_modules/set-function-length/index.js +1 -3
  220. package/node_modules/set-function-length/package.json +11 -13
  221. package/node_modules/set-function-length/tsconfig.json +7 -57
  222. package/node_modules/undici-types/LICENSE +21 -0
  223. package/node_modules/undici-types/balanced-pool.d.ts +11 -0
  224. package/node_modules/undici-types/client.d.ts +12 -1
  225. package/node_modules/undici-types/diagnostics-channel.d.ts +1 -2
  226. package/node_modules/undici-types/dispatcher.d.ts +17 -3
  227. package/node_modules/undici-types/eventsource.d.ts +61 -0
  228. package/node_modules/undici-types/fetch.d.ts +22 -23
  229. package/node_modules/undici-types/handlers.d.ts +10 -4
  230. package/node_modules/undici-types/index.d.ts +6 -1
  231. package/node_modules/undici-types/package.json +1 -1
  232. package/node_modules/undici-types/pool.d.ts +11 -0
  233. package/node_modules/undici-types/proxy-agent.d.ts +0 -2
  234. package/node_modules/undici-types/readable.d.ts +2 -3
  235. package/node_modules/undici-types/retry-agent.d.ts +11 -0
  236. package/node_modules/undici-types/retry-handler.d.ts +116 -0
  237. package/node_modules/undici-types/util.d.ts +31 -0
  238. package/node_modules/undici-types/webidl.d.ts +6 -1
  239. package/node_modules/undici-types/websocket.d.ts +22 -1
  240. package/node_modules/uuid/CHANGELOG.md +18 -0
  241. package/node_modules/uuid/README.md +134 -16
  242. package/node_modules/uuid/dist/commonjs-browser/index.js +40 -15
  243. package/node_modules/uuid/dist/commonjs-browser/max.js +7 -0
  244. package/node_modules/uuid/dist/commonjs-browser/md5.js +30 -53
  245. package/node_modules/uuid/dist/commonjs-browser/native.js +3 -4
  246. package/node_modules/uuid/dist/commonjs-browser/nil.js +1 -2
  247. package/node_modules/uuid/dist/commonjs-browser/parse.js +14 -15
  248. package/node_modules/uuid/dist/commonjs-browser/regex.js +1 -2
  249. package/node_modules/uuid/dist/commonjs-browser/rng.js +2 -4
  250. package/node_modules/uuid/dist/commonjs-browser/sha1.js +27 -49
  251. package/node_modules/uuid/dist/commonjs-browser/stringify.js +10 -16
  252. package/node_modules/uuid/dist/commonjs-browser/v1.js +73 -49
  253. package/node_modules/uuid/dist/commonjs-browser/v1ToV6.js +26 -0
  254. package/node_modules/uuid/dist/commonjs-browser/v3.js +3 -8
  255. package/node_modules/uuid/dist/commonjs-browser/v35.js +15 -32
  256. package/node_modules/uuid/dist/commonjs-browser/v4.js +7 -18
  257. package/node_modules/uuid/dist/commonjs-browser/v5.js +3 -8
  258. package/node_modules/uuid/dist/commonjs-browser/v6.js +42 -0
  259. package/node_modules/uuid/dist/commonjs-browser/v6ToV1.js +26 -0
  260. package/node_modules/uuid/dist/commonjs-browser/v7.js +152 -0
  261. package/node_modules/uuid/dist/commonjs-browser/validate.js +2 -7
  262. package/node_modules/uuid/dist/commonjs-browser/version.js +2 -8
  263. package/node_modules/uuid/dist/esm-browser/index.js +9 -4
  264. package/node_modules/uuid/dist/esm-browser/max.js +1 -0
  265. package/node_modules/uuid/dist/esm-browser/md5.js +29 -50
  266. package/node_modules/uuid/dist/esm-browser/native.js +1 -1
  267. package/node_modules/uuid/dist/esm-browser/parse.js +12 -10
  268. package/node_modules/uuid/dist/esm-browser/regex.js +1 -1
  269. package/node_modules/uuid/dist/esm-browser/rng.js +3 -4
  270. package/node_modules/uuid/dist/esm-browser/sha1.js +26 -46
  271. package/node_modules/uuid/dist/esm-browser/stringify.js +9 -11
  272. package/node_modules/uuid/dist/esm-browser/v1.js +74 -44
  273. package/node_modules/uuid/dist/esm-browser/v1ToV6.js +20 -0
  274. package/node_modules/uuid/dist/esm-browser/v3.js +1 -1
  275. package/node_modules/uuid/dist/esm-browser/v35.js +14 -25
  276. package/node_modules/uuid/dist/esm-browser/v4.js +5 -9
  277. package/node_modules/uuid/dist/esm-browser/v5.js +1 -1
  278. package/node_modules/uuid/dist/esm-browser/v6.js +36 -0
  279. package/node_modules/uuid/dist/esm-browser/v6ToV1.js +20 -0
  280. package/node_modules/uuid/dist/esm-browser/v7.js +146 -0
  281. package/node_modules/uuid/dist/esm-browser/validate.js +0 -2
  282. package/node_modules/uuid/dist/esm-browser/version.js +0 -3
  283. package/node_modules/uuid/dist/esm-node/index.js +9 -4
  284. package/node_modules/uuid/dist/esm-node/max.js +1 -0
  285. package/node_modules/uuid/dist/esm-node/md5.js +1 -4
  286. package/node_modules/uuid/dist/esm-node/native.js +1 -1
  287. package/node_modules/uuid/dist/esm-node/parse.js +11 -9
  288. package/node_modules/uuid/dist/esm-node/regex.js +1 -1
  289. package/node_modules/uuid/dist/esm-node/rng.js +1 -3
  290. package/node_modules/uuid/dist/esm-node/sha1.js +1 -4
  291. package/node_modules/uuid/dist/esm-node/stringify.js +7 -9
  292. package/node_modules/uuid/dist/esm-node/v1.js +66 -36
  293. package/node_modules/uuid/dist/esm-node/v1ToV6.js +20 -0
  294. package/node_modules/uuid/dist/esm-node/v35.js +8 -19
  295. package/node_modules/uuid/dist/esm-node/v4.js +4 -8
  296. package/node_modules/uuid/dist/esm-node/v6.js +32 -0
  297. package/node_modules/uuid/dist/esm-node/v6ToV1.js +20 -0
  298. package/node_modules/uuid/dist/esm-node/v7.js +146 -0
  299. package/node_modules/uuid/dist/esm-node/validate.js +0 -2
  300. package/node_modules/uuid/dist/esm-node/version.js +0 -3
  301. package/node_modules/uuid/dist/index.js +40 -15
  302. package/node_modules/uuid/dist/max.js +7 -0
  303. package/node_modules/uuid/dist/md5-browser.js +8 -31
  304. package/node_modules/uuid/dist/md5.js +4 -10
  305. package/node_modules/uuid/dist/native-browser.js +2 -3
  306. package/node_modules/uuid/dist/native.js +5 -9
  307. package/node_modules/uuid/dist/nil.js +1 -2
  308. package/node_modules/uuid/dist/parse.js +13 -14
  309. package/node_modules/uuid/dist/regex.js +1 -2
  310. package/node_modules/uuid/dist/rng-browser.js +1 -3
  311. package/node_modules/uuid/dist/rng.js +3 -10
  312. package/node_modules/uuid/dist/sha1-browser.js +1 -23
  313. package/node_modules/uuid/dist/sha1.js +4 -10
  314. package/node_modules/uuid/dist/stringify.js +8 -14
  315. package/node_modules/uuid/dist/uuid-bin.js +12 -22
  316. package/node_modules/uuid/dist/v1.js +66 -42
  317. package/node_modules/uuid/dist/v1ToV6.js +26 -0
  318. package/node_modules/uuid/dist/v3.js +2 -7
  319. package/node_modules/uuid/dist/v35.js +11 -28
  320. package/node_modules/uuid/dist/v4.js +6 -17
  321. package/node_modules/uuid/dist/v5.js +2 -7
  322. package/node_modules/uuid/dist/v6.js +38 -0
  323. package/node_modules/uuid/dist/v6ToV1.js +26 -0
  324. package/node_modules/uuid/dist/v7.js +152 -0
  325. package/node_modules/uuid/dist/validate.js +2 -7
  326. package/node_modules/uuid/dist/version.js +2 -8
  327. package/node_modules/uuid/package.json +41 -34
  328. package/node_modules/uuid/wrapper.mjs +5 -0
  329. package/package.json +6 -6
  330. package/tak-ingest.js +1 -1
  331. package/tak-registration.js +8 -1
  332. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  333. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  334. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  335. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  336. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  337. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  338. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  339. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  340. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  341. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  342. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  343. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  344. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  345. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  346. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  347. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  348. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  349. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  350. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  351. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  352. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  353. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  354. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  355. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  356. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  357. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  358. package/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  359. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  360. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  361. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  362. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  363. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  364. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  365. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  366. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  367. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  368. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  369. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  370. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  371. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  372. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  373. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  374. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  375. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  376. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  377. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  378. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  379. package/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  380. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  381. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  382. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  383. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  384. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  385. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  386. package/node_modules/object-is/.eslintignore +0 -1
  387. package/node_modules/set-function-length/env.d.ts.map +0 -1
  388. package/node_modules/set-function-length/index.d.ts.map +0 -1
@@ -1,42 +1,42 @@
1
1
  /*!
2
- * protobuf.js v7.2.6 (c) 2016, daniel wirtz
3
- * compiled tue, 16 jan 2024 22:54:38 utc
2
+ * protobuf.js v7.3.2 (c) 2016, daniel wirtz
3
+ * compiled wed, 12 jun 2024 08:24:21 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
7
- (function(undefined){"use strict";(function prelude(modules, cache, entries) {
8
-
9
- // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS
10
- // sources through a conflict-free require shim and is again wrapped within an iife that
11
- // provides a minification-friendly `undefined` var plus a global "use strict" directive
12
- // so that minification can remove the directives of each module.
13
-
14
- function $require(name) {
15
- var $module = cache[name];
16
- if (!$module)
17
- modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
18
- return $module.exports;
19
- }
20
-
21
- var protobuf = $require(entries[0]);
22
-
23
- // Expose globally
24
- protobuf.util.global.protobuf = protobuf;
25
-
26
- // Be nice to AMD
27
- if (typeof define === "function" && define.amd)
28
- define(["long"], function(Long) {
29
- if (Long && Long.isLong) {
30
- protobuf.util.Long = Long;
31
- protobuf.configure();
32
- }
33
- return protobuf;
34
- });
35
-
36
- // Be nice to CommonJS
37
- if (typeof module === "object" && module && module.exports)
38
- module.exports = protobuf;
39
-
7
+ (function(undefined){"use strict";(function prelude(modules, cache, entries) {
8
+
9
+ // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS
10
+ // sources through a conflict-free require shim and is again wrapped within an iife that
11
+ // provides a minification-friendly `undefined` var plus a global "use strict" directive
12
+ // so that minification can remove the directives of each module.
13
+
14
+ function $require(name) {
15
+ var $module = cache[name];
16
+ if (!$module)
17
+ modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
18
+ return $module.exports;
19
+ }
20
+
21
+ var protobuf = $require(entries[0]);
22
+
23
+ // Expose globally
24
+ protobuf.util.global.protobuf = protobuf;
25
+
26
+ // Be nice to AMD
27
+ if (typeof define === "function" && define.amd)
28
+ define(["long"], function(Long) {
29
+ if (Long && Long.isLong) {
30
+ protobuf.util.Long = Long;
31
+ protobuf.configure();
32
+ }
33
+ return protobuf;
34
+ });
35
+
36
+ // Be nice to CommonJS
37
+ if (typeof module === "object" && module && module.exports)
38
+ module.exports = protobuf;
39
+
40
40
  })/* end of prelude */({1:[function(require,module,exports){
41
41
  "use strict";
42
42
  module.exports = asPromise;
@@ -824,1913 +824,1913 @@ utf8.write = function utf8_write(string, buffer, offset) {
824
824
  };
825
825
 
826
826
  },{}],8:[function(require,module,exports){
827
- "use strict";
828
- var protobuf = exports;
829
-
830
- /**
831
- * Build type, one of `"full"`, `"light"` or `"minimal"`.
832
- * @name build
833
- * @type {string}
834
- * @const
835
- */
836
- protobuf.build = "minimal";
837
-
838
- // Serialization
839
- protobuf.Writer = require(16);
840
- protobuf.BufferWriter = require(17);
841
- protobuf.Reader = require(9);
842
- protobuf.BufferReader = require(10);
843
-
844
- // Utility
845
- protobuf.util = require(15);
846
- protobuf.rpc = require(12);
847
- protobuf.roots = require(11);
848
- protobuf.configure = configure;
849
-
850
- /* istanbul ignore next */
851
- /**
852
- * Reconfigures the library according to the environment.
853
- * @returns {undefined}
854
- */
855
- function configure() {
856
- protobuf.util._configure();
857
- protobuf.Writer._configure(protobuf.BufferWriter);
858
- protobuf.Reader._configure(protobuf.BufferReader);
859
- }
860
-
861
- // Set up buffer utility according to the environment
862
- configure();
827
+ "use strict";
828
+ var protobuf = exports;
829
+
830
+ /**
831
+ * Build type, one of `"full"`, `"light"` or `"minimal"`.
832
+ * @name build
833
+ * @type {string}
834
+ * @const
835
+ */
836
+ protobuf.build = "minimal";
837
+
838
+ // Serialization
839
+ protobuf.Writer = require(16);
840
+ protobuf.BufferWriter = require(17);
841
+ protobuf.Reader = require(9);
842
+ protobuf.BufferReader = require(10);
843
+
844
+ // Utility
845
+ protobuf.util = require(15);
846
+ protobuf.rpc = require(12);
847
+ protobuf.roots = require(11);
848
+ protobuf.configure = configure;
849
+
850
+ /* istanbul ignore next */
851
+ /**
852
+ * Reconfigures the library according to the environment.
853
+ * @returns {undefined}
854
+ */
855
+ function configure() {
856
+ protobuf.util._configure();
857
+ protobuf.Writer._configure(protobuf.BufferWriter);
858
+ protobuf.Reader._configure(protobuf.BufferReader);
859
+ }
860
+
861
+ // Set up buffer utility according to the environment
862
+ configure();
863
863
 
864
864
  },{"10":10,"11":11,"12":12,"15":15,"16":16,"17":17,"9":9}],9:[function(require,module,exports){
865
- "use strict";
866
- module.exports = Reader;
867
-
868
- var util = require(15);
869
-
870
- var BufferReader; // cyclic
871
-
872
- var LongBits = util.LongBits,
873
- utf8 = util.utf8;
874
-
875
- /* istanbul ignore next */
876
- function indexOutOfRange(reader, writeLength) {
877
- return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
878
- }
879
-
880
- /**
881
- * Constructs a new reader instance using the specified buffer.
882
- * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.
883
- * @constructor
884
- * @param {Uint8Array} buffer Buffer to read from
885
- */
886
- function Reader(buffer) {
887
-
888
- /**
889
- * Read buffer.
890
- * @type {Uint8Array}
891
- */
892
- this.buf = buffer;
893
-
894
- /**
895
- * Read buffer position.
896
- * @type {number}
897
- */
898
- this.pos = 0;
899
-
900
- /**
901
- * Read buffer length.
902
- * @type {number}
903
- */
904
- this.len = buffer.length;
905
- }
906
-
907
- var create_array = typeof Uint8Array !== "undefined"
908
- ? function create_typed_array(buffer) {
909
- if (buffer instanceof Uint8Array || Array.isArray(buffer))
910
- return new Reader(buffer);
911
- throw Error("illegal buffer");
912
- }
913
- /* istanbul ignore next */
914
- : function create_array(buffer) {
915
- if (Array.isArray(buffer))
916
- return new Reader(buffer);
917
- throw Error("illegal buffer");
918
- };
919
-
920
- var create = function create() {
921
- return util.Buffer
922
- ? function create_buffer_setup(buffer) {
923
- return (Reader.create = function create_buffer(buffer) {
924
- return util.Buffer.isBuffer(buffer)
925
- ? new BufferReader(buffer)
926
- /* istanbul ignore next */
927
- : create_array(buffer);
928
- })(buffer);
929
- }
930
- /* istanbul ignore next */
931
- : create_array;
932
- };
933
-
934
- /**
935
- * Creates a new reader using the specified buffer.
936
- * @function
937
- * @param {Uint8Array|Buffer} buffer Buffer to read from
938
- * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}
939
- * @throws {Error} If `buffer` is not a valid buffer
940
- */
941
- Reader.create = create();
865
+ "use strict";
866
+ module.exports = Reader;
867
+
868
+ var util = require(15);
869
+
870
+ var BufferReader; // cyclic
871
+
872
+ var LongBits = util.LongBits,
873
+ utf8 = util.utf8;
874
+
875
+ /* istanbul ignore next */
876
+ function indexOutOfRange(reader, writeLength) {
877
+ return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
878
+ }
879
+
880
+ /**
881
+ * Constructs a new reader instance using the specified buffer.
882
+ * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.
883
+ * @constructor
884
+ * @param {Uint8Array} buffer Buffer to read from
885
+ */
886
+ function Reader(buffer) {
887
+
888
+ /**
889
+ * Read buffer.
890
+ * @type {Uint8Array}
891
+ */
892
+ this.buf = buffer;
893
+
894
+ /**
895
+ * Read buffer position.
896
+ * @type {number}
897
+ */
898
+ this.pos = 0;
899
+
900
+ /**
901
+ * Read buffer length.
902
+ * @type {number}
903
+ */
904
+ this.len = buffer.length;
905
+ }
906
+
907
+ var create_array = typeof Uint8Array !== "undefined"
908
+ ? function create_typed_array(buffer) {
909
+ if (buffer instanceof Uint8Array || Array.isArray(buffer))
910
+ return new Reader(buffer);
911
+ throw Error("illegal buffer");
912
+ }
913
+ /* istanbul ignore next */
914
+ : function create_array(buffer) {
915
+ if (Array.isArray(buffer))
916
+ return new Reader(buffer);
917
+ throw Error("illegal buffer");
918
+ };
919
+
920
+ var create = function create() {
921
+ return util.Buffer
922
+ ? function create_buffer_setup(buffer) {
923
+ return (Reader.create = function create_buffer(buffer) {
924
+ return util.Buffer.isBuffer(buffer)
925
+ ? new BufferReader(buffer)
926
+ /* istanbul ignore next */
927
+ : create_array(buffer);
928
+ })(buffer);
929
+ }
930
+ /* istanbul ignore next */
931
+ : create_array;
932
+ };
933
+
934
+ /**
935
+ * Creates a new reader using the specified buffer.
936
+ * @function
937
+ * @param {Uint8Array|Buffer} buffer Buffer to read from
938
+ * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}
939
+ * @throws {Error} If `buffer` is not a valid buffer
940
+ */
941
+ Reader.create = create();
942
+
943
+ Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;
944
+
945
+ /**
946
+ * Reads a varint as an unsigned 32 bit value.
947
+ * @function
948
+ * @returns {number} Value read
949
+ */
950
+ Reader.prototype.uint32 = (function read_uint32_setup() {
951
+ var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)
952
+ return function read_uint32() {
953
+ value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;
954
+ value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;
955
+ value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;
956
+ value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;
957
+ value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;
958
+
959
+ /* istanbul ignore if */
960
+ if ((this.pos += 5) > this.len) {
961
+ this.pos = this.len;
962
+ throw indexOutOfRange(this, 10);
963
+ }
964
+ return value;
965
+ };
966
+ })();
967
+
968
+ /**
969
+ * Reads a varint as a signed 32 bit value.
970
+ * @returns {number} Value read
971
+ */
972
+ Reader.prototype.int32 = function read_int32() {
973
+ return this.uint32() | 0;
974
+ };
975
+
976
+ /**
977
+ * Reads a zig-zag encoded varint as a signed 32 bit value.
978
+ * @returns {number} Value read
979
+ */
980
+ Reader.prototype.sint32 = function read_sint32() {
981
+ var value = this.uint32();
982
+ return value >>> 1 ^ -(value & 1) | 0;
983
+ };
984
+
985
+ /* eslint-disable no-invalid-this */
986
+
987
+ function readLongVarint() {
988
+ // tends to deopt with local vars for octet etc.
989
+ var bits = new LongBits(0, 0);
990
+ var i = 0;
991
+ if (this.len - this.pos > 4) { // fast route (lo)
992
+ for (; i < 4; ++i) {
993
+ // 1st..4th
994
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
995
+ if (this.buf[this.pos++] < 128)
996
+ return bits;
997
+ }
998
+ // 5th
999
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
1000
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
1001
+ if (this.buf[this.pos++] < 128)
1002
+ return bits;
1003
+ i = 0;
1004
+ } else {
1005
+ for (; i < 3; ++i) {
1006
+ /* istanbul ignore if */
1007
+ if (this.pos >= this.len)
1008
+ throw indexOutOfRange(this);
1009
+ // 1st..3th
1010
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
1011
+ if (this.buf[this.pos++] < 128)
1012
+ return bits;
1013
+ }
1014
+ // 4th
1015
+ bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
1016
+ return bits;
1017
+ }
1018
+ if (this.len - this.pos > 4) { // fast route (hi)
1019
+ for (; i < 5; ++i) {
1020
+ // 6th..10th
1021
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
1022
+ if (this.buf[this.pos++] < 128)
1023
+ return bits;
1024
+ }
1025
+ } else {
1026
+ for (; i < 5; ++i) {
1027
+ /* istanbul ignore if */
1028
+ if (this.pos >= this.len)
1029
+ throw indexOutOfRange(this);
1030
+ // 6th..10th
1031
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
1032
+ if (this.buf[this.pos++] < 128)
1033
+ return bits;
1034
+ }
1035
+ }
1036
+ /* istanbul ignore next */
1037
+ throw Error("invalid varint encoding");
1038
+ }
1039
+
1040
+ /* eslint-enable no-invalid-this */
1041
+
1042
+ /**
1043
+ * Reads a varint as a signed 64 bit value.
1044
+ * @name Reader#int64
1045
+ * @function
1046
+ * @returns {Long} Value read
1047
+ */
1048
+
1049
+ /**
1050
+ * Reads a varint as an unsigned 64 bit value.
1051
+ * @name Reader#uint64
1052
+ * @function
1053
+ * @returns {Long} Value read
1054
+ */
1055
+
1056
+ /**
1057
+ * Reads a zig-zag encoded varint as a signed 64 bit value.
1058
+ * @name Reader#sint64
1059
+ * @function
1060
+ * @returns {Long} Value read
1061
+ */
1062
+
1063
+ /**
1064
+ * Reads a varint as a boolean.
1065
+ * @returns {boolean} Value read
1066
+ */
1067
+ Reader.prototype.bool = function read_bool() {
1068
+ return this.uint32() !== 0;
1069
+ };
1070
+
1071
+ function readFixed32_end(buf, end) { // note that this uses `end`, not `pos`
1072
+ return (buf[end - 4]
1073
+ | buf[end - 3] << 8
1074
+ | buf[end - 2] << 16
1075
+ | buf[end - 1] << 24) >>> 0;
1076
+ }
1077
+
1078
+ /**
1079
+ * Reads fixed 32 bits as an unsigned 32 bit integer.
1080
+ * @returns {number} Value read
1081
+ */
1082
+ Reader.prototype.fixed32 = function read_fixed32() {
1083
+
1084
+ /* istanbul ignore if */
1085
+ if (this.pos + 4 > this.len)
1086
+ throw indexOutOfRange(this, 4);
1087
+
1088
+ return readFixed32_end(this.buf, this.pos += 4);
1089
+ };
1090
+
1091
+ /**
1092
+ * Reads fixed 32 bits as a signed 32 bit integer.
1093
+ * @returns {number} Value read
1094
+ */
1095
+ Reader.prototype.sfixed32 = function read_sfixed32() {
1096
+
1097
+ /* istanbul ignore if */
1098
+ if (this.pos + 4 > this.len)
1099
+ throw indexOutOfRange(this, 4);
1100
+
1101
+ return readFixed32_end(this.buf, this.pos += 4) | 0;
1102
+ };
1103
+
1104
+ /* eslint-disable no-invalid-this */
1105
+
1106
+ function readFixed64(/* this: Reader */) {
1107
+
1108
+ /* istanbul ignore if */
1109
+ if (this.pos + 8 > this.len)
1110
+ throw indexOutOfRange(this, 8);
1111
+
1112
+ return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
1113
+ }
1114
+
1115
+ /* eslint-enable no-invalid-this */
1116
+
1117
+ /**
1118
+ * Reads fixed 64 bits.
1119
+ * @name Reader#fixed64
1120
+ * @function
1121
+ * @returns {Long} Value read
1122
+ */
1123
+
1124
+ /**
1125
+ * Reads zig-zag encoded fixed 64 bits.
1126
+ * @name Reader#sfixed64
1127
+ * @function
1128
+ * @returns {Long} Value read
1129
+ */
1130
+
1131
+ /**
1132
+ * Reads a float (32 bit) as a number.
1133
+ * @function
1134
+ * @returns {number} Value read
1135
+ */
1136
+ Reader.prototype.float = function read_float() {
1137
+
1138
+ /* istanbul ignore if */
1139
+ if (this.pos + 4 > this.len)
1140
+ throw indexOutOfRange(this, 4);
1141
+
1142
+ var value = util.float.readFloatLE(this.buf, this.pos);
1143
+ this.pos += 4;
1144
+ return value;
1145
+ };
1146
+
1147
+ /**
1148
+ * Reads a double (64 bit float) as a number.
1149
+ * @function
1150
+ * @returns {number} Value read
1151
+ */
1152
+ Reader.prototype.double = function read_double() {
1153
+
1154
+ /* istanbul ignore if */
1155
+ if (this.pos + 8 > this.len)
1156
+ throw indexOutOfRange(this, 4);
1157
+
1158
+ var value = util.float.readDoubleLE(this.buf, this.pos);
1159
+ this.pos += 8;
1160
+ return value;
1161
+ };
1162
+
1163
+ /**
1164
+ * Reads a sequence of bytes preceeded by its length as a varint.
1165
+ * @returns {Uint8Array} Value read
1166
+ */
1167
+ Reader.prototype.bytes = function read_bytes() {
1168
+ var length = this.uint32(),
1169
+ start = this.pos,
1170
+ end = this.pos + length;
1171
+
1172
+ /* istanbul ignore if */
1173
+ if (end > this.len)
1174
+ throw indexOutOfRange(this, length);
1175
+
1176
+ this.pos += length;
1177
+ if (Array.isArray(this.buf)) // plain array
1178
+ return this.buf.slice(start, end);
1179
+
1180
+ if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1
1181
+ var nativeBuffer = util.Buffer;
1182
+ return nativeBuffer
1183
+ ? nativeBuffer.alloc(0)
1184
+ : new this.buf.constructor(0);
1185
+ }
1186
+ return this._slice.call(this.buf, start, end);
1187
+ };
1188
+
1189
+ /**
1190
+ * Reads a string preceeded by its byte length as a varint.
1191
+ * @returns {string} Value read
1192
+ */
1193
+ Reader.prototype.string = function read_string() {
1194
+ var bytes = this.bytes();
1195
+ return utf8.read(bytes, 0, bytes.length);
1196
+ };
1197
+
1198
+ /**
1199
+ * Skips the specified number of bytes if specified, otherwise skips a varint.
1200
+ * @param {number} [length] Length if known, otherwise a varint is assumed
1201
+ * @returns {Reader} `this`
1202
+ */
1203
+ Reader.prototype.skip = function skip(length) {
1204
+ if (typeof length === "number") {
1205
+ /* istanbul ignore if */
1206
+ if (this.pos + length > this.len)
1207
+ throw indexOutOfRange(this, length);
1208
+ this.pos += length;
1209
+ } else {
1210
+ do {
1211
+ /* istanbul ignore if */
1212
+ if (this.pos >= this.len)
1213
+ throw indexOutOfRange(this);
1214
+ } while (this.buf[this.pos++] & 128);
1215
+ }
1216
+ return this;
1217
+ };
1218
+
1219
+ /**
1220
+ * Skips the next element of the specified wire type.
1221
+ * @param {number} wireType Wire type received
1222
+ * @returns {Reader} `this`
1223
+ */
1224
+ Reader.prototype.skipType = function(wireType) {
1225
+ switch (wireType) {
1226
+ case 0:
1227
+ this.skip();
1228
+ break;
1229
+ case 1:
1230
+ this.skip(8);
1231
+ break;
1232
+ case 2:
1233
+ this.skip(this.uint32());
1234
+ break;
1235
+ case 3:
1236
+ while ((wireType = this.uint32() & 7) !== 4) {
1237
+ this.skipType(wireType);
1238
+ }
1239
+ break;
1240
+ case 5:
1241
+ this.skip(4);
1242
+ break;
1243
+
1244
+ /* istanbul ignore next */
1245
+ default:
1246
+ throw Error("invalid wire type " + wireType + " at offset " + this.pos);
1247
+ }
1248
+ return this;
1249
+ };
1250
+
1251
+ Reader._configure = function(BufferReader_) {
1252
+ BufferReader = BufferReader_;
1253
+ Reader.create = create();
1254
+ BufferReader._configure();
1255
+
1256
+ var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber";
1257
+ util.merge(Reader.prototype, {
1258
+
1259
+ int64: function read_int64() {
1260
+ return readLongVarint.call(this)[fn](false);
1261
+ },
1262
+
1263
+ uint64: function read_uint64() {
1264
+ return readLongVarint.call(this)[fn](true);
1265
+ },
1266
+
1267
+ sint64: function read_sint64() {
1268
+ return readLongVarint.call(this).zzDecode()[fn](false);
1269
+ },
1270
+
1271
+ fixed64: function read_fixed64() {
1272
+ return readFixed64.call(this)[fn](true);
1273
+ },
1274
+
1275
+ sfixed64: function read_sfixed64() {
1276
+ return readFixed64.call(this)[fn](false);
1277
+ }
1278
+
1279
+ });
1280
+ };
942
1281
 
943
- Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;
1282
+ },{"15":15}],10:[function(require,module,exports){
1283
+ "use strict";
1284
+ module.exports = BufferReader;
1285
+
1286
+ // extends Reader
1287
+ var Reader = require(9);
1288
+ (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
1289
+
1290
+ var util = require(15);
1291
+
1292
+ /**
1293
+ * Constructs a new buffer reader instance.
1294
+ * @classdesc Wire format reader using node buffers.
1295
+ * @extends Reader
1296
+ * @constructor
1297
+ * @param {Buffer} buffer Buffer to read from
1298
+ */
1299
+ function BufferReader(buffer) {
1300
+ Reader.call(this, buffer);
1301
+
1302
+ /**
1303
+ * Read buffer.
1304
+ * @name BufferReader#buf
1305
+ * @type {Buffer}
1306
+ */
1307
+ }
1308
+
1309
+ BufferReader._configure = function () {
1310
+ /* istanbul ignore else */
1311
+ if (util.Buffer)
1312
+ BufferReader.prototype._slice = util.Buffer.prototype.slice;
1313
+ };
1314
+
1315
+
1316
+ /**
1317
+ * @override
1318
+ */
1319
+ BufferReader.prototype.string = function read_string_buffer() {
1320
+ var len = this.uint32(); // modifies pos
1321
+ return this.buf.utf8Slice
1322
+ ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))
1323
+ : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len));
1324
+ };
1325
+
1326
+ /**
1327
+ * Reads a sequence of bytes preceeded by its length as a varint.
1328
+ * @name BufferReader#bytes
1329
+ * @function
1330
+ * @returns {Buffer} Value read
1331
+ */
1332
+
1333
+ BufferReader._configure();
944
1334
 
945
- /**
946
- * Reads a varint as an unsigned 32 bit value.
947
- * @function
948
- * @returns {number} Value read
949
- */
950
- Reader.prototype.uint32 = (function read_uint32_setup() {
951
- var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)
952
- return function read_uint32() {
953
- value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;
954
- value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;
955
- value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;
956
- value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;
957
- value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;
1335
+ },{"15":15,"9":9}],11:[function(require,module,exports){
1336
+ "use strict";
1337
+ module.exports = {};
1338
+
1339
+ /**
1340
+ * Named roots.
1341
+ * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).
1342
+ * Can also be used manually to make roots available across modules.
1343
+ * @name roots
1344
+ * @type {Object.<string,Root>}
1345
+ * @example
1346
+ * // pbjs -r myroot -o compiled.js ...
1347
+ *
1348
+ * // in another module:
1349
+ * require("./compiled.js");
1350
+ *
1351
+ * // in any subsequent module:
1352
+ * var root = protobuf.roots["myroot"];
1353
+ */
958
1354
 
959
- /* istanbul ignore if */
960
- if ((this.pos += 5) > this.len) {
961
- this.pos = this.len;
962
- throw indexOutOfRange(this, 10);
963
- }
964
- return value;
965
- };
966
- })();
967
-
968
- /**
969
- * Reads a varint as a signed 32 bit value.
970
- * @returns {number} Value read
971
- */
972
- Reader.prototype.int32 = function read_int32() {
973
- return this.uint32() | 0;
974
- };
975
-
976
- /**
977
- * Reads a zig-zag encoded varint as a signed 32 bit value.
978
- * @returns {number} Value read
979
- */
980
- Reader.prototype.sint32 = function read_sint32() {
981
- var value = this.uint32();
982
- return value >>> 1 ^ -(value & 1) | 0;
983
- };
984
-
985
- /* eslint-disable no-invalid-this */
986
-
987
- function readLongVarint() {
988
- // tends to deopt with local vars for octet etc.
989
- var bits = new LongBits(0, 0);
990
- var i = 0;
991
- if (this.len - this.pos > 4) { // fast route (lo)
992
- for (; i < 4; ++i) {
993
- // 1st..4th
994
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
995
- if (this.buf[this.pos++] < 128)
996
- return bits;
997
- }
998
- // 5th
999
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
1000
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
1001
- if (this.buf[this.pos++] < 128)
1002
- return bits;
1003
- i = 0;
1004
- } else {
1005
- for (; i < 3; ++i) {
1006
- /* istanbul ignore if */
1007
- if (this.pos >= this.len)
1008
- throw indexOutOfRange(this);
1009
- // 1st..3th
1010
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
1011
- if (this.buf[this.pos++] < 128)
1012
- return bits;
1013
- }
1014
- // 4th
1015
- bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
1016
- return bits;
1017
- }
1018
- if (this.len - this.pos > 4) { // fast route (hi)
1019
- for (; i < 5; ++i) {
1020
- // 6th..10th
1021
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
1022
- if (this.buf[this.pos++] < 128)
1023
- return bits;
1024
- }
1025
- } else {
1026
- for (; i < 5; ++i) {
1027
- /* istanbul ignore if */
1028
- if (this.pos >= this.len)
1029
- throw indexOutOfRange(this);
1030
- // 6th..10th
1031
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
1032
- if (this.buf[this.pos++] < 128)
1033
- return bits;
1034
- }
1035
- }
1036
- /* istanbul ignore next */
1037
- throw Error("invalid varint encoding");
1038
- }
1039
-
1040
- /* eslint-enable no-invalid-this */
1041
-
1042
- /**
1043
- * Reads a varint as a signed 64 bit value.
1044
- * @name Reader#int64
1045
- * @function
1046
- * @returns {Long} Value read
1047
- */
1048
-
1049
- /**
1050
- * Reads a varint as an unsigned 64 bit value.
1051
- * @name Reader#uint64
1052
- * @function
1053
- * @returns {Long} Value read
1054
- */
1055
-
1056
- /**
1057
- * Reads a zig-zag encoded varint as a signed 64 bit value.
1058
- * @name Reader#sint64
1059
- * @function
1060
- * @returns {Long} Value read
1061
- */
1062
-
1063
- /**
1064
- * Reads a varint as a boolean.
1065
- * @returns {boolean} Value read
1066
- */
1067
- Reader.prototype.bool = function read_bool() {
1068
- return this.uint32() !== 0;
1069
- };
1070
-
1071
- function readFixed32_end(buf, end) { // note that this uses `end`, not `pos`
1072
- return (buf[end - 4]
1073
- | buf[end - 3] << 8
1074
- | buf[end - 2] << 16
1075
- | buf[end - 1] << 24) >>> 0;
1076
- }
1077
-
1078
- /**
1079
- * Reads fixed 32 bits as an unsigned 32 bit integer.
1080
- * @returns {number} Value read
1081
- */
1082
- Reader.prototype.fixed32 = function read_fixed32() {
1083
-
1084
- /* istanbul ignore if */
1085
- if (this.pos + 4 > this.len)
1086
- throw indexOutOfRange(this, 4);
1087
-
1088
- return readFixed32_end(this.buf, this.pos += 4);
1089
- };
1090
-
1091
- /**
1092
- * Reads fixed 32 bits as a signed 32 bit integer.
1093
- * @returns {number} Value read
1094
- */
1095
- Reader.prototype.sfixed32 = function read_sfixed32() {
1096
-
1097
- /* istanbul ignore if */
1098
- if (this.pos + 4 > this.len)
1099
- throw indexOutOfRange(this, 4);
1100
-
1101
- return readFixed32_end(this.buf, this.pos += 4) | 0;
1102
- };
1103
-
1104
- /* eslint-disable no-invalid-this */
1105
-
1106
- function readFixed64(/* this: Reader */) {
1107
-
1108
- /* istanbul ignore if */
1109
- if (this.pos + 8 > this.len)
1110
- throw indexOutOfRange(this, 8);
1111
-
1112
- return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
1113
- }
1114
-
1115
- /* eslint-enable no-invalid-this */
1116
-
1117
- /**
1118
- * Reads fixed 64 bits.
1119
- * @name Reader#fixed64
1120
- * @function
1121
- * @returns {Long} Value read
1122
- */
1123
-
1124
- /**
1125
- * Reads zig-zag encoded fixed 64 bits.
1126
- * @name Reader#sfixed64
1127
- * @function
1128
- * @returns {Long} Value read
1129
- */
1130
-
1131
- /**
1132
- * Reads a float (32 bit) as a number.
1133
- * @function
1134
- * @returns {number} Value read
1135
- */
1136
- Reader.prototype.float = function read_float() {
1137
-
1138
- /* istanbul ignore if */
1139
- if (this.pos + 4 > this.len)
1140
- throw indexOutOfRange(this, 4);
1141
-
1142
- var value = util.float.readFloatLE(this.buf, this.pos);
1143
- this.pos += 4;
1144
- return value;
1145
- };
1146
-
1147
- /**
1148
- * Reads a double (64 bit float) as a number.
1149
- * @function
1150
- * @returns {number} Value read
1151
- */
1152
- Reader.prototype.double = function read_double() {
1153
-
1154
- /* istanbul ignore if */
1155
- if (this.pos + 8 > this.len)
1156
- throw indexOutOfRange(this, 4);
1157
-
1158
- var value = util.float.readDoubleLE(this.buf, this.pos);
1159
- this.pos += 8;
1160
- return value;
1161
- };
1162
-
1163
- /**
1164
- * Reads a sequence of bytes preceeded by its length as a varint.
1165
- * @returns {Uint8Array} Value read
1166
- */
1167
- Reader.prototype.bytes = function read_bytes() {
1168
- var length = this.uint32(),
1169
- start = this.pos,
1170
- end = this.pos + length;
1171
-
1172
- /* istanbul ignore if */
1173
- if (end > this.len)
1174
- throw indexOutOfRange(this, length);
1175
-
1176
- this.pos += length;
1177
- if (Array.isArray(this.buf)) // plain array
1178
- return this.buf.slice(start, end);
1179
-
1180
- if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1
1181
- var nativeBuffer = util.Buffer;
1182
- return nativeBuffer
1183
- ? nativeBuffer.alloc(0)
1184
- : new this.buf.constructor(0);
1185
- }
1186
- return this._slice.call(this.buf, start, end);
1187
- };
1188
-
1189
- /**
1190
- * Reads a string preceeded by its byte length as a varint.
1191
- * @returns {string} Value read
1192
- */
1193
- Reader.prototype.string = function read_string() {
1194
- var bytes = this.bytes();
1195
- return utf8.read(bytes, 0, bytes.length);
1196
- };
1197
-
1198
- /**
1199
- * Skips the specified number of bytes if specified, otherwise skips a varint.
1200
- * @param {number} [length] Length if known, otherwise a varint is assumed
1201
- * @returns {Reader} `this`
1202
- */
1203
- Reader.prototype.skip = function skip(length) {
1204
- if (typeof length === "number") {
1205
- /* istanbul ignore if */
1206
- if (this.pos + length > this.len)
1207
- throw indexOutOfRange(this, length);
1208
- this.pos += length;
1209
- } else {
1210
- do {
1211
- /* istanbul ignore if */
1212
- if (this.pos >= this.len)
1213
- throw indexOutOfRange(this);
1214
- } while (this.buf[this.pos++] & 128);
1215
- }
1216
- return this;
1217
- };
1218
-
1219
- /**
1220
- * Skips the next element of the specified wire type.
1221
- * @param {number} wireType Wire type received
1222
- * @returns {Reader} `this`
1223
- */
1224
- Reader.prototype.skipType = function(wireType) {
1225
- switch (wireType) {
1226
- case 0:
1227
- this.skip();
1228
- break;
1229
- case 1:
1230
- this.skip(8);
1231
- break;
1232
- case 2:
1233
- this.skip(this.uint32());
1234
- break;
1235
- case 3:
1236
- while ((wireType = this.uint32() & 7) !== 4) {
1237
- this.skipType(wireType);
1238
- }
1239
- break;
1240
- case 5:
1241
- this.skip(4);
1242
- break;
1243
-
1244
- /* istanbul ignore next */
1245
- default:
1246
- throw Error("invalid wire type " + wireType + " at offset " + this.pos);
1247
- }
1248
- return this;
1249
- };
1250
-
1251
- Reader._configure = function(BufferReader_) {
1252
- BufferReader = BufferReader_;
1253
- Reader.create = create();
1254
- BufferReader._configure();
1255
-
1256
- var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber";
1257
- util.merge(Reader.prototype, {
1258
-
1259
- int64: function read_int64() {
1260
- return readLongVarint.call(this)[fn](false);
1261
- },
1262
-
1263
- uint64: function read_uint64() {
1264
- return readLongVarint.call(this)[fn](true);
1265
- },
1266
-
1267
- sint64: function read_sint64() {
1268
- return readLongVarint.call(this).zzDecode()[fn](false);
1269
- },
1270
-
1271
- fixed64: function read_fixed64() {
1272
- return readFixed64.call(this)[fn](true);
1273
- },
1274
-
1275
- sfixed64: function read_sfixed64() {
1276
- return readFixed64.call(this)[fn](false);
1277
- }
1278
-
1279
- });
1280
- };
1281
-
1282
- },{"15":15}],10:[function(require,module,exports){
1283
- "use strict";
1284
- module.exports = BufferReader;
1285
-
1286
- // extends Reader
1287
- var Reader = require(9);
1288
- (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
1289
-
1290
- var util = require(15);
1291
-
1292
- /**
1293
- * Constructs a new buffer reader instance.
1294
- * @classdesc Wire format reader using node buffers.
1295
- * @extends Reader
1296
- * @constructor
1297
- * @param {Buffer} buffer Buffer to read from
1298
- */
1299
- function BufferReader(buffer) {
1300
- Reader.call(this, buffer);
1301
-
1302
- /**
1303
- * Read buffer.
1304
- * @name BufferReader#buf
1305
- * @type {Buffer}
1306
- */
1307
- }
1308
-
1309
- BufferReader._configure = function () {
1310
- /* istanbul ignore else */
1311
- if (util.Buffer)
1312
- BufferReader.prototype._slice = util.Buffer.prototype.slice;
1313
- };
1314
-
1315
-
1316
- /**
1317
- * @override
1318
- */
1319
- BufferReader.prototype.string = function read_string_buffer() {
1320
- var len = this.uint32(); // modifies pos
1321
- return this.buf.utf8Slice
1322
- ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))
1323
- : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len));
1324
- };
1325
-
1326
- /**
1327
- * Reads a sequence of bytes preceeded by its length as a varint.
1328
- * @name BufferReader#bytes
1329
- * @function
1330
- * @returns {Buffer} Value read
1331
- */
1332
-
1333
- BufferReader._configure();
1334
-
1335
- },{"15":15,"9":9}],11:[function(require,module,exports){
1336
- "use strict";
1337
- module.exports = {};
1338
-
1339
- /**
1340
- * Named roots.
1341
- * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).
1342
- * Can also be used manually to make roots available across modules.
1343
- * @name roots
1344
- * @type {Object.<string,Root>}
1345
- * @example
1346
- * // pbjs -r myroot -o compiled.js ...
1347
- *
1348
- * // in another module:
1349
- * require("./compiled.js");
1350
- *
1351
- * // in any subsequent module:
1352
- * var root = protobuf.roots["myroot"];
1353
- */
1354
-
1355
- },{}],12:[function(require,module,exports){
1356
- "use strict";
1357
-
1358
- /**
1359
- * Streaming RPC helpers.
1360
- * @namespace
1361
- */
1362
- var rpc = exports;
1363
-
1364
- /**
1365
- * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.
1366
- * @typedef RPCImpl
1367
- * @type {function}
1368
- * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called
1369
- * @param {Uint8Array} requestData Request data
1370
- * @param {RPCImplCallback} callback Callback function
1371
- * @returns {undefined}
1372
- * @example
1373
- * function rpcImpl(method, requestData, callback) {
1374
- * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code
1375
- * throw Error("no such method");
1376
- * asynchronouslyObtainAResponse(requestData, function(err, responseData) {
1377
- * callback(err, responseData);
1378
- * });
1379
- * }
1380
- */
1381
-
1382
- /**
1383
- * Node-style callback as used by {@link RPCImpl}.
1384
- * @typedef RPCImplCallback
1385
- * @type {function}
1386
- * @param {Error|null} error Error, if any, otherwise `null`
1387
- * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error
1388
- * @returns {undefined}
1389
- */
1390
-
1391
- rpc.Service = require(13);
1355
+ },{}],12:[function(require,module,exports){
1356
+ "use strict";
1357
+
1358
+ /**
1359
+ * Streaming RPC helpers.
1360
+ * @namespace
1361
+ */
1362
+ var rpc = exports;
1363
+
1364
+ /**
1365
+ * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.
1366
+ * @typedef RPCImpl
1367
+ * @type {function}
1368
+ * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called
1369
+ * @param {Uint8Array} requestData Request data
1370
+ * @param {RPCImplCallback} callback Callback function
1371
+ * @returns {undefined}
1372
+ * @example
1373
+ * function rpcImpl(method, requestData, callback) {
1374
+ * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code
1375
+ * throw Error("no such method");
1376
+ * asynchronouslyObtainAResponse(requestData, function(err, responseData) {
1377
+ * callback(err, responseData);
1378
+ * });
1379
+ * }
1380
+ */
1381
+
1382
+ /**
1383
+ * Node-style callback as used by {@link RPCImpl}.
1384
+ * @typedef RPCImplCallback
1385
+ * @type {function}
1386
+ * @param {Error|null} error Error, if any, otherwise `null`
1387
+ * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error
1388
+ * @returns {undefined}
1389
+ */
1390
+
1391
+ rpc.Service = require(13);
1392
1392
 
1393
1393
  },{"13":13}],13:[function(require,module,exports){
1394
- "use strict";
1395
- module.exports = Service;
1396
-
1397
- var util = require(15);
1398
-
1399
- // Extends EventEmitter
1400
- (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
1401
-
1402
- /**
1403
- * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.
1404
- *
1405
- * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.
1406
- * @typedef rpc.ServiceMethodCallback
1407
- * @template TRes extends Message<TRes>
1408
- * @type {function}
1409
- * @param {Error|null} error Error, if any
1410
- * @param {TRes} [response] Response message
1411
- * @returns {undefined}
1412
- */
1413
-
1414
- /**
1415
- * A service method part of a {@link rpc.Service} as created by {@link Service.create}.
1416
- * @typedef rpc.ServiceMethod
1417
- * @template TReq extends Message<TReq>
1418
- * @template TRes extends Message<TRes>
1419
- * @type {function}
1420
- * @param {TReq|Properties<TReq>} request Request message or plain object
1421
- * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message
1422
- * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`
1423
- */
1424
-
1425
- /**
1426
- * Constructs a new RPC service instance.
1427
- * @classdesc An RPC service as returned by {@link Service#create}.
1428
- * @exports rpc.Service
1429
- * @extends util.EventEmitter
1430
- * @constructor
1431
- * @param {RPCImpl} rpcImpl RPC implementation
1432
- * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
1433
- * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
1434
- */
1435
- function Service(rpcImpl, requestDelimited, responseDelimited) {
1436
-
1437
- if (typeof rpcImpl !== "function")
1438
- throw TypeError("rpcImpl must be a function");
1439
-
1440
- util.EventEmitter.call(this);
1441
-
1442
- /**
1443
- * RPC implementation. Becomes `null` once the service is ended.
1444
- * @type {RPCImpl|null}
1445
- */
1446
- this.rpcImpl = rpcImpl;
1447
-
1448
- /**
1449
- * Whether requests are length-delimited.
1450
- * @type {boolean}
1451
- */
1452
- this.requestDelimited = Boolean(requestDelimited);
1453
-
1454
- /**
1455
- * Whether responses are length-delimited.
1456
- * @type {boolean}
1457
- */
1458
- this.responseDelimited = Boolean(responseDelimited);
1459
- }
1460
-
1461
- /**
1462
- * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.
1463
- * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method
1464
- * @param {Constructor<TReq>} requestCtor Request constructor
1465
- * @param {Constructor<TRes>} responseCtor Response constructor
1466
- * @param {TReq|Properties<TReq>} request Request message or plain object
1467
- * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback
1468
- * @returns {undefined}
1469
- * @template TReq extends Message<TReq>
1470
- * @template TRes extends Message<TRes>
1471
- */
1472
- Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
1473
-
1474
- if (!request)
1475
- throw TypeError("request must be specified");
1476
-
1477
- var self = this;
1478
- if (!callback)
1479
- return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);
1480
-
1481
- if (!self.rpcImpl) {
1482
- setTimeout(function() { callback(Error("already ended")); }, 0);
1483
- return undefined;
1484
- }
1485
-
1486
- try {
1487
- return self.rpcImpl(
1488
- method,
1489
- requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
1490
- function rpcCallback(err, response) {
1491
-
1492
- if (err) {
1493
- self.emit("error", err, method);
1494
- return callback(err);
1495
- }
1496
-
1497
- if (response === null) {
1498
- self.end(/* endedByRPC */ true);
1499
- return undefined;
1500
- }
1501
-
1502
- if (!(response instanceof responseCtor)) {
1503
- try {
1504
- response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);
1505
- } catch (err) {
1506
- self.emit("error", err, method);
1507
- return callback(err);
1508
- }
1509
- }
1510
-
1511
- self.emit("data", response, method);
1512
- return callback(null, response);
1513
- }
1514
- );
1515
- } catch (err) {
1516
- self.emit("error", err, method);
1517
- setTimeout(function() { callback(err); }, 0);
1518
- return undefined;
1519
- }
1520
- };
1521
-
1522
- /**
1523
- * Ends this service and emits the `end` event.
1524
- * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.
1525
- * @returns {rpc.Service} `this`
1526
- */
1527
- Service.prototype.end = function end(endedByRPC) {
1528
- if (this.rpcImpl) {
1529
- if (!endedByRPC) // signal end to rpcImpl
1530
- this.rpcImpl(null, null, null);
1531
- this.rpcImpl = null;
1532
- this.emit("end").off();
1533
- }
1534
- return this;
1535
- };
1394
+ "use strict";
1395
+ module.exports = Service;
1396
+
1397
+ var util = require(15);
1398
+
1399
+ // Extends EventEmitter
1400
+ (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
1401
+
1402
+ /**
1403
+ * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.
1404
+ *
1405
+ * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.
1406
+ * @typedef rpc.ServiceMethodCallback
1407
+ * @template TRes extends Message<TRes>
1408
+ * @type {function}
1409
+ * @param {Error|null} error Error, if any
1410
+ * @param {TRes} [response] Response message
1411
+ * @returns {undefined}
1412
+ */
1413
+
1414
+ /**
1415
+ * A service method part of a {@link rpc.Service} as created by {@link Service.create}.
1416
+ * @typedef rpc.ServiceMethod
1417
+ * @template TReq extends Message<TReq>
1418
+ * @template TRes extends Message<TRes>
1419
+ * @type {function}
1420
+ * @param {TReq|Properties<TReq>} request Request message or plain object
1421
+ * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message
1422
+ * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`
1423
+ */
1424
+
1425
+ /**
1426
+ * Constructs a new RPC service instance.
1427
+ * @classdesc An RPC service as returned by {@link Service#create}.
1428
+ * @exports rpc.Service
1429
+ * @extends util.EventEmitter
1430
+ * @constructor
1431
+ * @param {RPCImpl} rpcImpl RPC implementation
1432
+ * @param {boolean} [requestDelimited=false] Whether requests are length-delimited
1433
+ * @param {boolean} [responseDelimited=false] Whether responses are length-delimited
1434
+ */
1435
+ function Service(rpcImpl, requestDelimited, responseDelimited) {
1436
+
1437
+ if (typeof rpcImpl !== "function")
1438
+ throw TypeError("rpcImpl must be a function");
1439
+
1440
+ util.EventEmitter.call(this);
1441
+
1442
+ /**
1443
+ * RPC implementation. Becomes `null` once the service is ended.
1444
+ * @type {RPCImpl|null}
1445
+ */
1446
+ this.rpcImpl = rpcImpl;
1447
+
1448
+ /**
1449
+ * Whether requests are length-delimited.
1450
+ * @type {boolean}
1451
+ */
1452
+ this.requestDelimited = Boolean(requestDelimited);
1453
+
1454
+ /**
1455
+ * Whether responses are length-delimited.
1456
+ * @type {boolean}
1457
+ */
1458
+ this.responseDelimited = Boolean(responseDelimited);
1459
+ }
1460
+
1461
+ /**
1462
+ * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.
1463
+ * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method
1464
+ * @param {Constructor<TReq>} requestCtor Request constructor
1465
+ * @param {Constructor<TRes>} responseCtor Response constructor
1466
+ * @param {TReq|Properties<TReq>} request Request message or plain object
1467
+ * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback
1468
+ * @returns {undefined}
1469
+ * @template TReq extends Message<TReq>
1470
+ * @template TRes extends Message<TRes>
1471
+ */
1472
+ Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
1473
+
1474
+ if (!request)
1475
+ throw TypeError("request must be specified");
1476
+
1477
+ var self = this;
1478
+ if (!callback)
1479
+ return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);
1480
+
1481
+ if (!self.rpcImpl) {
1482
+ setTimeout(function() { callback(Error("already ended")); }, 0);
1483
+ return undefined;
1484
+ }
1485
+
1486
+ try {
1487
+ return self.rpcImpl(
1488
+ method,
1489
+ requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
1490
+ function rpcCallback(err, response) {
1491
+
1492
+ if (err) {
1493
+ self.emit("error", err, method);
1494
+ return callback(err);
1495
+ }
1496
+
1497
+ if (response === null) {
1498
+ self.end(/* endedByRPC */ true);
1499
+ return undefined;
1500
+ }
1501
+
1502
+ if (!(response instanceof responseCtor)) {
1503
+ try {
1504
+ response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);
1505
+ } catch (err) {
1506
+ self.emit("error", err, method);
1507
+ return callback(err);
1508
+ }
1509
+ }
1510
+
1511
+ self.emit("data", response, method);
1512
+ return callback(null, response);
1513
+ }
1514
+ );
1515
+ } catch (err) {
1516
+ self.emit("error", err, method);
1517
+ setTimeout(function() { callback(err); }, 0);
1518
+ return undefined;
1519
+ }
1520
+ };
1521
+
1522
+ /**
1523
+ * Ends this service and emits the `end` event.
1524
+ * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.
1525
+ * @returns {rpc.Service} `this`
1526
+ */
1527
+ Service.prototype.end = function end(endedByRPC) {
1528
+ if (this.rpcImpl) {
1529
+ if (!endedByRPC) // signal end to rpcImpl
1530
+ this.rpcImpl(null, null, null);
1531
+ this.rpcImpl = null;
1532
+ this.emit("end").off();
1533
+ }
1534
+ return this;
1535
+ };
1536
1536
 
1537
1537
  },{"15":15}],14:[function(require,module,exports){
1538
- "use strict";
1539
- module.exports = LongBits;
1540
-
1541
- var util = require(15);
1542
-
1543
- /**
1544
- * Constructs new long bits.
1545
- * @classdesc Helper class for working with the low and high bits of a 64 bit value.
1546
- * @memberof util
1547
- * @constructor
1548
- * @param {number} lo Low 32 bits, unsigned
1549
- * @param {number} hi High 32 bits, unsigned
1550
- */
1551
- function LongBits(lo, hi) {
1552
-
1553
- // note that the casts below are theoretically unnecessary as of today, but older statically
1554
- // generated converter code might still call the ctor with signed 32bits. kept for compat.
1555
-
1556
- /**
1557
- * Low bits.
1558
- * @type {number}
1559
- */
1560
- this.lo = lo >>> 0;
1561
-
1562
- /**
1563
- * High bits.
1564
- * @type {number}
1565
- */
1566
- this.hi = hi >>> 0;
1567
- }
1568
-
1569
- /**
1570
- * Zero bits.
1571
- * @memberof util.LongBits
1572
- * @type {util.LongBits}
1573
- */
1574
- var zero = LongBits.zero = new LongBits(0, 0);
1575
-
1576
- zero.toNumber = function() { return 0; };
1577
- zero.zzEncode = zero.zzDecode = function() { return this; };
1578
- zero.length = function() { return 1; };
1579
-
1580
- /**
1581
- * Zero hash.
1582
- * @memberof util.LongBits
1583
- * @type {string}
1584
- */
1585
- var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
1586
-
1587
- /**
1588
- * Constructs new long bits from the specified number.
1589
- * @param {number} value Value
1590
- * @returns {util.LongBits} Instance
1591
- */
1592
- LongBits.fromNumber = function fromNumber(value) {
1593
- if (value === 0)
1594
- return zero;
1595
- var sign = value < 0;
1596
- if (sign)
1597
- value = -value;
1598
- var lo = value >>> 0,
1599
- hi = (value - lo) / 4294967296 >>> 0;
1600
- if (sign) {
1601
- hi = ~hi >>> 0;
1602
- lo = ~lo >>> 0;
1603
- if (++lo > 4294967295) {
1604
- lo = 0;
1605
- if (++hi > 4294967295)
1606
- hi = 0;
1607
- }
1608
- }
1609
- return new LongBits(lo, hi);
1610
- };
1611
-
1612
- /**
1613
- * Constructs new long bits from a number, long or string.
1614
- * @param {Long|number|string} value Value
1615
- * @returns {util.LongBits} Instance
1616
- */
1617
- LongBits.from = function from(value) {
1618
- if (typeof value === "number")
1619
- return LongBits.fromNumber(value);
1620
- if (util.isString(value)) {
1621
- /* istanbul ignore else */
1622
- if (util.Long)
1623
- value = util.Long.fromString(value);
1624
- else
1625
- return LongBits.fromNumber(parseInt(value, 10));
1626
- }
1627
- return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
1628
- };
1629
-
1630
- /**
1631
- * Converts this long bits to a possibly unsafe JavaScript number.
1632
- * @param {boolean} [unsigned=false] Whether unsigned or not
1633
- * @returns {number} Possibly unsafe number
1634
- */
1635
- LongBits.prototype.toNumber = function toNumber(unsigned) {
1636
- if (!unsigned && this.hi >>> 31) {
1637
- var lo = ~this.lo + 1 >>> 0,
1638
- hi = ~this.hi >>> 0;
1639
- if (!lo)
1640
- hi = hi + 1 >>> 0;
1641
- return -(lo + hi * 4294967296);
1642
- }
1643
- return this.lo + this.hi * 4294967296;
1644
- };
1645
-
1646
- /**
1647
- * Converts this long bits to a long.
1648
- * @param {boolean} [unsigned=false] Whether unsigned or not
1649
- * @returns {Long} Long
1650
- */
1651
- LongBits.prototype.toLong = function toLong(unsigned) {
1652
- return util.Long
1653
- ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
1654
- /* istanbul ignore next */
1655
- : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
1656
- };
1657
-
1658
- var charCodeAt = String.prototype.charCodeAt;
1659
-
1660
- /**
1661
- * Constructs new long bits from the specified 8 characters long hash.
1662
- * @param {string} hash Hash
1663
- * @returns {util.LongBits} Bits
1664
- */
1665
- LongBits.fromHash = function fromHash(hash) {
1666
- if (hash === zeroHash)
1667
- return zero;
1668
- return new LongBits(
1669
- ( charCodeAt.call(hash, 0)
1670
- | charCodeAt.call(hash, 1) << 8
1671
- | charCodeAt.call(hash, 2) << 16
1672
- | charCodeAt.call(hash, 3) << 24) >>> 0
1673
- ,
1674
- ( charCodeAt.call(hash, 4)
1675
- | charCodeAt.call(hash, 5) << 8
1676
- | charCodeAt.call(hash, 6) << 16
1677
- | charCodeAt.call(hash, 7) << 24) >>> 0
1678
- );
1679
- };
1680
-
1681
- /**
1682
- * Converts this long bits to a 8 characters long hash.
1683
- * @returns {string} Hash
1684
- */
1685
- LongBits.prototype.toHash = function toHash() {
1686
- return String.fromCharCode(
1687
- this.lo & 255,
1688
- this.lo >>> 8 & 255,
1689
- this.lo >>> 16 & 255,
1690
- this.lo >>> 24 ,
1691
- this.hi & 255,
1692
- this.hi >>> 8 & 255,
1693
- this.hi >>> 16 & 255,
1694
- this.hi >>> 24
1695
- );
1696
- };
1697
-
1698
- /**
1699
- * Zig-zag encodes this long bits.
1700
- * @returns {util.LongBits} `this`
1701
- */
1702
- LongBits.prototype.zzEncode = function zzEncode() {
1703
- var mask = this.hi >> 31;
1704
- this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
1705
- this.lo = ( this.lo << 1 ^ mask) >>> 0;
1706
- return this;
1707
- };
1708
-
1709
- /**
1710
- * Zig-zag decodes this long bits.
1711
- * @returns {util.LongBits} `this`
1712
- */
1713
- LongBits.prototype.zzDecode = function zzDecode() {
1714
- var mask = -(this.lo & 1);
1715
- this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
1716
- this.hi = ( this.hi >>> 1 ^ mask) >>> 0;
1717
- return this;
1718
- };
1719
-
1720
- /**
1721
- * Calculates the length of this longbits when encoded as a varint.
1722
- * @returns {number} Length
1723
- */
1724
- LongBits.prototype.length = function length() {
1725
- var part0 = this.lo,
1726
- part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
1727
- part2 = this.hi >>> 24;
1728
- return part2 === 0
1729
- ? part1 === 0
1730
- ? part0 < 16384
1731
- ? part0 < 128 ? 1 : 2
1732
- : part0 < 2097152 ? 3 : 4
1733
- : part1 < 16384
1734
- ? part1 < 128 ? 5 : 6
1735
- : part1 < 2097152 ? 7 : 8
1736
- : part2 < 128 ? 9 : 10;
1737
- };
1538
+ "use strict";
1539
+ module.exports = LongBits;
1540
+
1541
+ var util = require(15);
1542
+
1543
+ /**
1544
+ * Constructs new long bits.
1545
+ * @classdesc Helper class for working with the low and high bits of a 64 bit value.
1546
+ * @memberof util
1547
+ * @constructor
1548
+ * @param {number} lo Low 32 bits, unsigned
1549
+ * @param {number} hi High 32 bits, unsigned
1550
+ */
1551
+ function LongBits(lo, hi) {
1552
+
1553
+ // note that the casts below are theoretically unnecessary as of today, but older statically
1554
+ // generated converter code might still call the ctor with signed 32bits. kept for compat.
1555
+
1556
+ /**
1557
+ * Low bits.
1558
+ * @type {number}
1559
+ */
1560
+ this.lo = lo >>> 0;
1561
+
1562
+ /**
1563
+ * High bits.
1564
+ * @type {number}
1565
+ */
1566
+ this.hi = hi >>> 0;
1567
+ }
1568
+
1569
+ /**
1570
+ * Zero bits.
1571
+ * @memberof util.LongBits
1572
+ * @type {util.LongBits}
1573
+ */
1574
+ var zero = LongBits.zero = new LongBits(0, 0);
1575
+
1576
+ zero.toNumber = function() { return 0; };
1577
+ zero.zzEncode = zero.zzDecode = function() { return this; };
1578
+ zero.length = function() { return 1; };
1579
+
1580
+ /**
1581
+ * Zero hash.
1582
+ * @memberof util.LongBits
1583
+ * @type {string}
1584
+ */
1585
+ var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
1586
+
1587
+ /**
1588
+ * Constructs new long bits from the specified number.
1589
+ * @param {number} value Value
1590
+ * @returns {util.LongBits} Instance
1591
+ */
1592
+ LongBits.fromNumber = function fromNumber(value) {
1593
+ if (value === 0)
1594
+ return zero;
1595
+ var sign = value < 0;
1596
+ if (sign)
1597
+ value = -value;
1598
+ var lo = value >>> 0,
1599
+ hi = (value - lo) / 4294967296 >>> 0;
1600
+ if (sign) {
1601
+ hi = ~hi >>> 0;
1602
+ lo = ~lo >>> 0;
1603
+ if (++lo > 4294967295) {
1604
+ lo = 0;
1605
+ if (++hi > 4294967295)
1606
+ hi = 0;
1607
+ }
1608
+ }
1609
+ return new LongBits(lo, hi);
1610
+ };
1611
+
1612
+ /**
1613
+ * Constructs new long bits from a number, long or string.
1614
+ * @param {Long|number|string} value Value
1615
+ * @returns {util.LongBits} Instance
1616
+ */
1617
+ LongBits.from = function from(value) {
1618
+ if (typeof value === "number")
1619
+ return LongBits.fromNumber(value);
1620
+ if (util.isString(value)) {
1621
+ /* istanbul ignore else */
1622
+ if (util.Long)
1623
+ value = util.Long.fromString(value);
1624
+ else
1625
+ return LongBits.fromNumber(parseInt(value, 10));
1626
+ }
1627
+ return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
1628
+ };
1629
+
1630
+ /**
1631
+ * Converts this long bits to a possibly unsafe JavaScript number.
1632
+ * @param {boolean} [unsigned=false] Whether unsigned or not
1633
+ * @returns {number} Possibly unsafe number
1634
+ */
1635
+ LongBits.prototype.toNumber = function toNumber(unsigned) {
1636
+ if (!unsigned && this.hi >>> 31) {
1637
+ var lo = ~this.lo + 1 >>> 0,
1638
+ hi = ~this.hi >>> 0;
1639
+ if (!lo)
1640
+ hi = hi + 1 >>> 0;
1641
+ return -(lo + hi * 4294967296);
1642
+ }
1643
+ return this.lo + this.hi * 4294967296;
1644
+ };
1645
+
1646
+ /**
1647
+ * Converts this long bits to a long.
1648
+ * @param {boolean} [unsigned=false] Whether unsigned or not
1649
+ * @returns {Long} Long
1650
+ */
1651
+ LongBits.prototype.toLong = function toLong(unsigned) {
1652
+ return util.Long
1653
+ ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
1654
+ /* istanbul ignore next */
1655
+ : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
1656
+ };
1657
+
1658
+ var charCodeAt = String.prototype.charCodeAt;
1659
+
1660
+ /**
1661
+ * Constructs new long bits from the specified 8 characters long hash.
1662
+ * @param {string} hash Hash
1663
+ * @returns {util.LongBits} Bits
1664
+ */
1665
+ LongBits.fromHash = function fromHash(hash) {
1666
+ if (hash === zeroHash)
1667
+ return zero;
1668
+ return new LongBits(
1669
+ ( charCodeAt.call(hash, 0)
1670
+ | charCodeAt.call(hash, 1) << 8
1671
+ | charCodeAt.call(hash, 2) << 16
1672
+ | charCodeAt.call(hash, 3) << 24) >>> 0
1673
+ ,
1674
+ ( charCodeAt.call(hash, 4)
1675
+ | charCodeAt.call(hash, 5) << 8
1676
+ | charCodeAt.call(hash, 6) << 16
1677
+ | charCodeAt.call(hash, 7) << 24) >>> 0
1678
+ );
1679
+ };
1680
+
1681
+ /**
1682
+ * Converts this long bits to a 8 characters long hash.
1683
+ * @returns {string} Hash
1684
+ */
1685
+ LongBits.prototype.toHash = function toHash() {
1686
+ return String.fromCharCode(
1687
+ this.lo & 255,
1688
+ this.lo >>> 8 & 255,
1689
+ this.lo >>> 16 & 255,
1690
+ this.lo >>> 24 ,
1691
+ this.hi & 255,
1692
+ this.hi >>> 8 & 255,
1693
+ this.hi >>> 16 & 255,
1694
+ this.hi >>> 24
1695
+ );
1696
+ };
1697
+
1698
+ /**
1699
+ * Zig-zag encodes this long bits.
1700
+ * @returns {util.LongBits} `this`
1701
+ */
1702
+ LongBits.prototype.zzEncode = function zzEncode() {
1703
+ var mask = this.hi >> 31;
1704
+ this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
1705
+ this.lo = ( this.lo << 1 ^ mask) >>> 0;
1706
+ return this;
1707
+ };
1708
+
1709
+ /**
1710
+ * Zig-zag decodes this long bits.
1711
+ * @returns {util.LongBits} `this`
1712
+ */
1713
+ LongBits.prototype.zzDecode = function zzDecode() {
1714
+ var mask = -(this.lo & 1);
1715
+ this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
1716
+ this.hi = ( this.hi >>> 1 ^ mask) >>> 0;
1717
+ return this;
1718
+ };
1719
+
1720
+ /**
1721
+ * Calculates the length of this longbits when encoded as a varint.
1722
+ * @returns {number} Length
1723
+ */
1724
+ LongBits.prototype.length = function length() {
1725
+ var part0 = this.lo,
1726
+ part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
1727
+ part2 = this.hi >>> 24;
1728
+ return part2 === 0
1729
+ ? part1 === 0
1730
+ ? part0 < 16384
1731
+ ? part0 < 128 ? 1 : 2
1732
+ : part0 < 2097152 ? 3 : 4
1733
+ : part1 < 16384
1734
+ ? part1 < 128 ? 5 : 6
1735
+ : part1 < 2097152 ? 7 : 8
1736
+ : part2 < 128 ? 9 : 10;
1737
+ };
1738
1738
 
1739
1739
  },{"15":15}],15:[function(require,module,exports){
1740
- "use strict";
1741
- var util = exports;
1742
-
1743
- // used to return a Promise where callback is omitted
1744
- util.asPromise = require(1);
1745
-
1746
- // converts to / from base64 encoded strings
1747
- util.base64 = require(2);
1748
-
1749
- // base class of rpc.Service
1750
- util.EventEmitter = require(3);
1751
-
1752
- // float handling accross browsers
1753
- util.float = require(4);
1754
-
1755
- // requires modules optionally and hides the call from bundlers
1756
- util.inquire = require(5);
1757
-
1758
- // converts to / from utf8 encoded strings
1759
- util.utf8 = require(7);
1760
-
1761
- // provides a node-like buffer pool in the browser
1762
- util.pool = require(6);
1763
-
1764
- // utility to work with the low and high bits of a 64 bit value
1765
- util.LongBits = require(14);
1766
-
1767
- /**
1768
- * Whether running within node or not.
1769
- * @memberof util
1770
- * @type {boolean}
1771
- */
1772
- util.isNode = Boolean(typeof global !== "undefined"
1773
- && global
1774
- && global.process
1775
- && global.process.versions
1776
- && global.process.versions.node);
1777
-
1778
- /**
1779
- * Global object reference.
1780
- * @memberof util
1781
- * @type {Object}
1782
- */
1783
- util.global = util.isNode && global
1784
- || typeof window !== "undefined" && window
1785
- || typeof self !== "undefined" && self
1786
- || this; // eslint-disable-line no-invalid-this
1787
-
1788
- /**
1789
- * An immuable empty array.
1790
- * @memberof util
1791
- * @type {Array.<*>}
1792
- * @const
1793
- */
1794
- util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes
1795
-
1796
- /**
1797
- * An immutable empty object.
1798
- * @type {Object}
1799
- * @const
1800
- */
1801
- util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes
1802
-
1803
- /**
1804
- * Tests if the specified value is an integer.
1805
- * @function
1806
- * @param {*} value Value to test
1807
- * @returns {boolean} `true` if the value is an integer
1808
- */
1809
- util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {
1810
- return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
1811
- };
1812
-
1813
- /**
1814
- * Tests if the specified value is a string.
1815
- * @param {*} value Value to test
1816
- * @returns {boolean} `true` if the value is a string
1817
- */
1818
- util.isString = function isString(value) {
1819
- return typeof value === "string" || value instanceof String;
1820
- };
1821
-
1822
- /**
1823
- * Tests if the specified value is a non-null object.
1824
- * @param {*} value Value to test
1825
- * @returns {boolean} `true` if the value is a non-null object
1826
- */
1827
- util.isObject = function isObject(value) {
1828
- return value && typeof value === "object";
1829
- };
1830
-
1831
- /**
1832
- * Checks if a property on a message is considered to be present.
1833
- * This is an alias of {@link util.isSet}.
1834
- * @function
1835
- * @param {Object} obj Plain object or message instance
1836
- * @param {string} prop Property name
1837
- * @returns {boolean} `true` if considered to be present, otherwise `false`
1838
- */
1839
- util.isset =
1840
-
1841
- /**
1842
- * Checks if a property on a message is considered to be present.
1843
- * @param {Object} obj Plain object or message instance
1844
- * @param {string} prop Property name
1845
- * @returns {boolean} `true` if considered to be present, otherwise `false`
1846
- */
1847
- util.isSet = function isSet(obj, prop) {
1848
- var value = obj[prop];
1849
- if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
1850
- return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
1851
- return false;
1852
- };
1853
-
1854
- /**
1855
- * Any compatible Buffer instance.
1856
- * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
1857
- * @interface Buffer
1858
- * @extends Uint8Array
1859
- */
1860
-
1861
- /**
1862
- * Node's Buffer class if available.
1863
- * @type {Constructor<Buffer>}
1864
- */
1865
- util.Buffer = (function() {
1866
- try {
1867
- var Buffer = util.inquire("buffer").Buffer;
1868
- // refuse to use non-node buffers if not explicitly assigned (perf reasons):
1869
- return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;
1870
- } catch (e) {
1871
- /* istanbul ignore next */
1872
- return null;
1873
- }
1874
- })();
1875
-
1876
- // Internal alias of or polyfull for Buffer.from.
1877
- util._Buffer_from = null;
1878
-
1879
- // Internal alias of or polyfill for Buffer.allocUnsafe.
1880
- util._Buffer_allocUnsafe = null;
1881
-
1882
- /**
1883
- * Creates a new buffer of whatever type supported by the environment.
1884
- * @param {number|number[]} [sizeOrArray=0] Buffer size or number array
1885
- * @returns {Uint8Array|Buffer} Buffer
1886
- */
1887
- util.newBuffer = function newBuffer(sizeOrArray) {
1888
- /* istanbul ignore next */
1889
- return typeof sizeOrArray === "number"
1890
- ? util.Buffer
1891
- ? util._Buffer_allocUnsafe(sizeOrArray)
1892
- : new util.Array(sizeOrArray)
1893
- : util.Buffer
1894
- ? util._Buffer_from(sizeOrArray)
1895
- : typeof Uint8Array === "undefined"
1896
- ? sizeOrArray
1897
- : new Uint8Array(sizeOrArray);
1898
- };
1899
-
1900
- /**
1901
- * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
1902
- * @type {Constructor<Uint8Array>}
1903
- */
1904
- util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array;
1905
-
1906
- /**
1907
- * Any compatible Long instance.
1908
- * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.
1909
- * @interface Long
1910
- * @property {number} low Low bits
1911
- * @property {number} high High bits
1912
- * @property {boolean} unsigned Whether unsigned or not
1913
- */
1914
-
1915
- /**
1916
- * Long.js's Long class if available.
1917
- * @type {Constructor<Long>}
1918
- */
1919
- util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
1920
- || /* istanbul ignore next */ util.global.Long
1921
- || util.inquire("long");
1922
-
1923
- /**
1924
- * Regular expression used to verify 2 bit (`bool`) map keys.
1925
- * @type {RegExp}
1926
- * @const
1927
- */
1928
- util.key2Re = /^true|false|0|1$/;
1929
-
1930
- /**
1931
- * Regular expression used to verify 32 bit (`int32` etc.) map keys.
1932
- * @type {RegExp}
1933
- * @const
1934
- */
1935
- util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
1936
-
1937
- /**
1938
- * Regular expression used to verify 64 bit (`int64` etc.) map keys.
1939
- * @type {RegExp}
1940
- * @const
1941
- */
1942
- util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
1943
-
1944
- /**
1945
- * Converts a number or long to an 8 characters long hash string.
1946
- * @param {Long|number} value Value to convert
1947
- * @returns {string} Hash
1948
- */
1949
- util.longToHash = function longToHash(value) {
1950
- return value
1951
- ? util.LongBits.from(value).toHash()
1952
- : util.LongBits.zeroHash;
1953
- };
1954
-
1955
- /**
1956
- * Converts an 8 characters long hash string to a long or number.
1957
- * @param {string} hash Hash
1958
- * @param {boolean} [unsigned=false] Whether unsigned or not
1959
- * @returns {Long|number} Original value
1960
- */
1961
- util.longFromHash = function longFromHash(hash, unsigned) {
1962
- var bits = util.LongBits.fromHash(hash);
1963
- if (util.Long)
1964
- return util.Long.fromBits(bits.lo, bits.hi, unsigned);
1965
- return bits.toNumber(Boolean(unsigned));
1966
- };
1967
-
1968
- /**
1969
- * Merges the properties of the source object into the destination object.
1970
- * @memberof util
1971
- * @param {Object.<string,*>} dst Destination object
1972
- * @param {Object.<string,*>} src Source object
1973
- * @param {boolean} [ifNotSet=false] Merges only if the key is not already set
1974
- * @returns {Object.<string,*>} Destination object
1975
- */
1976
- function merge(dst, src, ifNotSet) { // used by converters
1977
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
1978
- if (dst[keys[i]] === undefined || !ifNotSet)
1979
- dst[keys[i]] = src[keys[i]];
1980
- return dst;
1981
- }
1982
-
1983
- util.merge = merge;
1984
-
1985
- /**
1986
- * Converts the first character of a string to lower case.
1987
- * @param {string} str String to convert
1988
- * @returns {string} Converted string
1989
- */
1990
- util.lcFirst = function lcFirst(str) {
1991
- return str.charAt(0).toLowerCase() + str.substring(1);
1992
- };
1993
-
1994
- /**
1995
- * Creates a custom error constructor.
1996
- * @memberof util
1997
- * @param {string} name Error name
1998
- * @returns {Constructor<Error>} Custom error constructor
1999
- */
2000
- function newError(name) {
2001
-
2002
- function CustomError(message, properties) {
2003
-
2004
- if (!(this instanceof CustomError))
2005
- return new CustomError(message, properties);
2006
-
2007
- // Error.call(this, message);
2008
- // ^ just returns a new error instance because the ctor can be called as a function
2009
-
2010
- Object.defineProperty(this, "message", { get: function() { return message; } });
2011
-
2012
- /* istanbul ignore next */
2013
- if (Error.captureStackTrace) // node
2014
- Error.captureStackTrace(this, CustomError);
2015
- else
2016
- Object.defineProperty(this, "stack", { value: new Error().stack || "" });
2017
-
2018
- if (properties)
2019
- merge(this, properties);
2020
- }
2021
-
2022
- CustomError.prototype = Object.create(Error.prototype, {
2023
- constructor: {
2024
- value: CustomError,
2025
- writable: true,
2026
- enumerable: false,
2027
- configurable: true,
2028
- },
2029
- name: {
2030
- get: function get() { return name; },
2031
- set: undefined,
2032
- enumerable: false,
2033
- // configurable: false would accurately preserve the behavior of
2034
- // the original, but I'm guessing that was not intentional.
2035
- // For an actual error subclass, this property would
2036
- // be configurable.
2037
- configurable: true,
2038
- },
2039
- toString: {
2040
- value: function value() { return this.name + ": " + this.message; },
2041
- writable: true,
2042
- enumerable: false,
2043
- configurable: true,
2044
- },
2045
- });
2046
-
2047
- return CustomError;
2048
- }
2049
-
2050
- util.newError = newError;
2051
-
2052
- /**
2053
- * Constructs a new protocol error.
2054
- * @classdesc Error subclass indicating a protocol specifc error.
2055
- * @memberof util
2056
- * @extends Error
2057
- * @template T extends Message<T>
2058
- * @constructor
2059
- * @param {string} message Error message
2060
- * @param {Object.<string,*>} [properties] Additional properties
2061
- * @example
2062
- * try {
2063
- * MyMessage.decode(someBuffer); // throws if required fields are missing
2064
- * } catch (e) {
2065
- * if (e instanceof ProtocolError && e.instance)
2066
- * console.log("decoded so far: " + JSON.stringify(e.instance));
2067
- * }
2068
- */
2069
- util.ProtocolError = newError("ProtocolError");
2070
-
2071
- /**
2072
- * So far decoded message instance.
2073
- * @name util.ProtocolError#instance
2074
- * @type {Message<T>}
2075
- */
2076
-
2077
- /**
2078
- * A OneOf getter as returned by {@link util.oneOfGetter}.
2079
- * @typedef OneOfGetter
2080
- * @type {function}
2081
- * @returns {string|undefined} Set field name, if any
2082
- */
2083
-
2084
- /**
2085
- * Builds a getter for a oneof's present field name.
2086
- * @param {string[]} fieldNames Field names
2087
- * @returns {OneOfGetter} Unbound getter
2088
- */
2089
- util.oneOfGetter = function getOneOf(fieldNames) {
2090
- var fieldMap = {};
2091
- for (var i = 0; i < fieldNames.length; ++i)
2092
- fieldMap[fieldNames[i]] = 1;
2093
-
2094
- /**
2095
- * @returns {string|undefined} Set field name, if any
2096
- * @this Object
2097
- * @ignore
2098
- */
2099
- return function() { // eslint-disable-line consistent-return
2100
- for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
2101
- if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
2102
- return keys[i];
2103
- };
2104
- };
2105
-
2106
- /**
2107
- * A OneOf setter as returned by {@link util.oneOfSetter}.
2108
- * @typedef OneOfSetter
2109
- * @type {function}
2110
- * @param {string|undefined} value Field name
2111
- * @returns {undefined}
2112
- */
2113
-
2114
- /**
2115
- * Builds a setter for a oneof's present field name.
2116
- * @param {string[]} fieldNames Field names
2117
- * @returns {OneOfSetter} Unbound setter
2118
- */
2119
- util.oneOfSetter = function setOneOf(fieldNames) {
2120
-
2121
- /**
2122
- * @param {string} name Field name
2123
- * @returns {undefined}
2124
- * @this Object
2125
- * @ignore
2126
- */
2127
- return function(name) {
2128
- for (var i = 0; i < fieldNames.length; ++i)
2129
- if (fieldNames[i] !== name)
2130
- delete this[fieldNames[i]];
2131
- };
2132
- };
2133
-
2134
- /**
2135
- * Default conversion options used for {@link Message#toJSON} implementations.
2136
- *
2137
- * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
2138
- *
2139
- * - Longs become strings
2140
- * - Enums become string keys
2141
- * - Bytes become base64 encoded strings
2142
- * - (Sub-)Messages become plain objects
2143
- * - Maps become plain objects with all string keys
2144
- * - Repeated fields become arrays
2145
- * - NaN and Infinity for float and double fields become strings
2146
- *
2147
- * @type {IConversionOptions}
2148
- * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
2149
- */
2150
- util.toJSONOptions = {
2151
- longs: String,
2152
- enums: String,
2153
- bytes: String,
2154
- json: true
2155
- };
2156
-
2157
- // Sets up buffer utility according to the environment (called in index-minimal)
2158
- util._configure = function() {
2159
- var Buffer = util.Buffer;
2160
- /* istanbul ignore if */
2161
- if (!Buffer) {
2162
- util._Buffer_from = util._Buffer_allocUnsafe = null;
2163
- return;
2164
- }
2165
- // because node 4.x buffers are incompatible & immutable
2166
- // see: https://github.com/dcodeIO/protobuf.js/pull/665
2167
- util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
2168
- /* istanbul ignore next */
2169
- function Buffer_from(value, encoding) {
2170
- return new Buffer(value, encoding);
2171
- };
2172
- util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
2173
- /* istanbul ignore next */
2174
- function Buffer_allocUnsafe(size) {
2175
- return new Buffer(size);
2176
- };
2177
- };
2178
-
2179
- },{"1":1,"14":14,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7}],16:[function(require,module,exports){
2180
- "use strict";
2181
- module.exports = Writer;
2182
-
2183
- var util = require(15);
2184
-
2185
- var BufferWriter; // cyclic
2186
-
2187
- var LongBits = util.LongBits,
2188
- base64 = util.base64,
2189
- utf8 = util.utf8;
2190
-
2191
- /**
2192
- * Constructs a new writer operation instance.
2193
- * @classdesc Scheduled writer operation.
2194
- * @constructor
2195
- * @param {function(*, Uint8Array, number)} fn Function to call
2196
- * @param {number} len Value byte length
2197
- * @param {*} val Value to write
2198
- * @ignore
2199
- */
2200
- function Op(fn, len, val) {
2201
-
2202
- /**
2203
- * Function to call.
2204
- * @type {function(Uint8Array, number, *)}
2205
- */
2206
- this.fn = fn;
2207
-
2208
- /**
2209
- * Value byte length.
2210
- * @type {number}
2211
- */
2212
- this.len = len;
2213
-
2214
- /**
2215
- * Next operation.
2216
- * @type {Writer.Op|undefined}
2217
- */
2218
- this.next = undefined;
2219
-
2220
- /**
2221
- * Value to write.
2222
- * @type {*}
2223
- */
2224
- this.val = val; // type varies
2225
- }
2226
-
2227
- /* istanbul ignore next */
2228
- function noop() {} // eslint-disable-line no-empty-function
2229
-
2230
- /**
2231
- * Constructs a new writer state instance.
2232
- * @classdesc Copied writer state.
2233
- * @memberof Writer
2234
- * @constructor
2235
- * @param {Writer} writer Writer to copy state from
2236
- * @ignore
2237
- */
2238
- function State(writer) {
2239
-
2240
- /**
2241
- * Current head.
2242
- * @type {Writer.Op}
2243
- */
2244
- this.head = writer.head;
2245
-
2246
- /**
2247
- * Current tail.
2248
- * @type {Writer.Op}
2249
- */
2250
- this.tail = writer.tail;
2251
-
2252
- /**
2253
- * Current buffer length.
2254
- * @type {number}
2255
- */
2256
- this.len = writer.len;
2257
-
2258
- /**
2259
- * Next state.
2260
- * @type {State|null}
2261
- */
2262
- this.next = writer.states;
2263
- }
2264
-
2265
- /**
2266
- * Constructs a new writer instance.
2267
- * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.
2268
- * @constructor
2269
- */
2270
- function Writer() {
2271
-
2272
- /**
2273
- * Current length.
2274
- * @type {number}
2275
- */
2276
- this.len = 0;
2277
-
2278
- /**
2279
- * Operations head.
2280
- * @type {Object}
2281
- */
2282
- this.head = new Op(noop, 0, 0);
2283
-
2284
- /**
2285
- * Operations tail
2286
- * @type {Object}
2287
- */
2288
- this.tail = this.head;
2289
-
2290
- /**
2291
- * Linked forked states.
2292
- * @type {Object|null}
2293
- */
2294
- this.states = null;
2295
-
2296
- // When a value is written, the writer calculates its byte length and puts it into a linked
2297
- // list of operations to perform when finish() is called. This both allows us to allocate
2298
- // buffers of the exact required size and reduces the amount of work we have to do compared
2299
- // to first calculating over objects and then encoding over objects. In our case, the encoding
2300
- // part is just a linked list walk calling operations with already prepared values.
2301
- }
2302
-
2303
- var create = function create() {
2304
- return util.Buffer
2305
- ? function create_buffer_setup() {
2306
- return (Writer.create = function create_buffer() {
2307
- return new BufferWriter();
2308
- })();
2309
- }
2310
- /* istanbul ignore next */
2311
- : function create_array() {
2312
- return new Writer();
2313
- };
2314
- };
2315
-
2316
- /**
2317
- * Creates a new writer.
2318
- * @function
2319
- * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}
2320
- */
2321
- Writer.create = create();
2322
-
2323
- /**
2324
- * Allocates a buffer of the specified size.
2325
- * @param {number} size Buffer size
2326
- * @returns {Uint8Array} Buffer
2327
- */
2328
- Writer.alloc = function alloc(size) {
2329
- return new util.Array(size);
2330
- };
2331
-
2332
- // Use Uint8Array buffer pool in the browser, just like node does with buffers
2333
- /* istanbul ignore else */
2334
- if (util.Array !== Array)
2335
- Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);
2336
-
2337
- /**
2338
- * Pushes a new operation to the queue.
2339
- * @param {function(Uint8Array, number, *)} fn Function to call
2340
- * @param {number} len Value byte length
2341
- * @param {number} val Value to write
2342
- * @returns {Writer} `this`
2343
- * @private
2344
- */
2345
- Writer.prototype._push = function push(fn, len, val) {
2346
- this.tail = this.tail.next = new Op(fn, len, val);
2347
- this.len += len;
2348
- return this;
2349
- };
2350
-
2351
- function writeByte(val, buf, pos) {
2352
- buf[pos] = val & 255;
2353
- }
2354
-
2355
- function writeVarint32(val, buf, pos) {
2356
- while (val > 127) {
2357
- buf[pos++] = val & 127 | 128;
2358
- val >>>= 7;
2359
- }
2360
- buf[pos] = val;
2361
- }
2362
-
2363
- /**
2364
- * Constructs a new varint writer operation instance.
2365
- * @classdesc Scheduled varint writer operation.
2366
- * @extends Op
2367
- * @constructor
2368
- * @param {number} len Value byte length
2369
- * @param {number} val Value to write
2370
- * @ignore
2371
- */
2372
- function VarintOp(len, val) {
2373
- this.len = len;
2374
- this.next = undefined;
2375
- this.val = val;
2376
- }
2377
-
2378
- VarintOp.prototype = Object.create(Op.prototype);
2379
- VarintOp.prototype.fn = writeVarint32;
2380
-
2381
- /**
2382
- * Writes an unsigned 32 bit value as a varint.
2383
- * @param {number} value Value to write
2384
- * @returns {Writer} `this`
2385
- */
2386
- Writer.prototype.uint32 = function write_uint32(value) {
2387
- // here, the call to this.push has been inlined and a varint specific Op subclass is used.
2388
- // uint32 is by far the most frequently used operation and benefits significantly from this.
2389
- this.len += (this.tail = this.tail.next = new VarintOp(
2390
- (value = value >>> 0)
2391
- < 128 ? 1
2392
- : value < 16384 ? 2
2393
- : value < 2097152 ? 3
2394
- : value < 268435456 ? 4
2395
- : 5,
2396
- value)).len;
2397
- return this;
2398
- };
2399
-
2400
- /**
2401
- * Writes a signed 32 bit value as a varint.
2402
- * @function
2403
- * @param {number} value Value to write
2404
- * @returns {Writer} `this`
2405
- */
2406
- Writer.prototype.int32 = function write_int32(value) {
2407
- return value < 0
2408
- ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
2409
- : this.uint32(value);
2410
- };
2411
-
2412
- /**
2413
- * Writes a 32 bit value as a varint, zig-zag encoded.
2414
- * @param {number} value Value to write
2415
- * @returns {Writer} `this`
2416
- */
2417
- Writer.prototype.sint32 = function write_sint32(value) {
2418
- return this.uint32((value << 1 ^ value >> 31) >>> 0);
2419
- };
2420
-
2421
- function writeVarint64(val, buf, pos) {
2422
- while (val.hi) {
2423
- buf[pos++] = val.lo & 127 | 128;
2424
- val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
2425
- val.hi >>>= 7;
2426
- }
2427
- while (val.lo > 127) {
2428
- buf[pos++] = val.lo & 127 | 128;
2429
- val.lo = val.lo >>> 7;
2430
- }
2431
- buf[pos++] = val.lo;
2432
- }
2433
-
2434
- /**
2435
- * Writes an unsigned 64 bit value as a varint.
2436
- * @param {Long|number|string} value Value to write
2437
- * @returns {Writer} `this`
2438
- * @throws {TypeError} If `value` is a string and no long library is present.
2439
- */
2440
- Writer.prototype.uint64 = function write_uint64(value) {
2441
- var bits = LongBits.from(value);
2442
- return this._push(writeVarint64, bits.length(), bits);
2443
- };
2444
-
2445
- /**
2446
- * Writes a signed 64 bit value as a varint.
2447
- * @function
2448
- * @param {Long|number|string} value Value to write
2449
- * @returns {Writer} `this`
2450
- * @throws {TypeError} If `value` is a string and no long library is present.
2451
- */
2452
- Writer.prototype.int64 = Writer.prototype.uint64;
2453
-
2454
- /**
2455
- * Writes a signed 64 bit value as a varint, zig-zag encoded.
2456
- * @param {Long|number|string} value Value to write
2457
- * @returns {Writer} `this`
2458
- * @throws {TypeError} If `value` is a string and no long library is present.
2459
- */
2460
- Writer.prototype.sint64 = function write_sint64(value) {
2461
- var bits = LongBits.from(value).zzEncode();
2462
- return this._push(writeVarint64, bits.length(), bits);
2463
- };
2464
-
2465
- /**
2466
- * Writes a boolish value as a varint.
2467
- * @param {boolean} value Value to write
2468
- * @returns {Writer} `this`
2469
- */
2470
- Writer.prototype.bool = function write_bool(value) {
2471
- return this._push(writeByte, 1, value ? 1 : 0);
2472
- };
2473
-
2474
- function writeFixed32(val, buf, pos) {
2475
- buf[pos ] = val & 255;
2476
- buf[pos + 1] = val >>> 8 & 255;
2477
- buf[pos + 2] = val >>> 16 & 255;
2478
- buf[pos + 3] = val >>> 24;
2479
- }
2480
-
2481
- /**
2482
- * Writes an unsigned 32 bit value as fixed 32 bits.
2483
- * @param {number} value Value to write
2484
- * @returns {Writer} `this`
2485
- */
2486
- Writer.prototype.fixed32 = function write_fixed32(value) {
2487
- return this._push(writeFixed32, 4, value >>> 0);
2488
- };
2489
-
2490
- /**
2491
- * Writes a signed 32 bit value as fixed 32 bits.
2492
- * @function
2493
- * @param {number} value Value to write
2494
- * @returns {Writer} `this`
2495
- */
2496
- Writer.prototype.sfixed32 = Writer.prototype.fixed32;
2497
-
2498
- /**
2499
- * Writes an unsigned 64 bit value as fixed 64 bits.
2500
- * @param {Long|number|string} value Value to write
2501
- * @returns {Writer} `this`
2502
- * @throws {TypeError} If `value` is a string and no long library is present.
2503
- */
2504
- Writer.prototype.fixed64 = function write_fixed64(value) {
2505
- var bits = LongBits.from(value);
2506
- return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);
2507
- };
2508
-
2509
- /**
2510
- * Writes a signed 64 bit value as fixed 64 bits.
2511
- * @function
2512
- * @param {Long|number|string} value Value to write
2513
- * @returns {Writer} `this`
2514
- * @throws {TypeError} If `value` is a string and no long library is present.
2515
- */
2516
- Writer.prototype.sfixed64 = Writer.prototype.fixed64;
2517
-
2518
- /**
2519
- * Writes a float (32 bit).
2520
- * @function
2521
- * @param {number} value Value to write
2522
- * @returns {Writer} `this`
2523
- */
2524
- Writer.prototype.float = function write_float(value) {
2525
- return this._push(util.float.writeFloatLE, 4, value);
2526
- };
2527
-
2528
- /**
2529
- * Writes a double (64 bit float).
2530
- * @function
2531
- * @param {number} value Value to write
2532
- * @returns {Writer} `this`
2533
- */
2534
- Writer.prototype.double = function write_double(value) {
2535
- return this._push(util.float.writeDoubleLE, 8, value);
2536
- };
2537
-
2538
- var writeBytes = util.Array.prototype.set
2539
- ? function writeBytes_set(val, buf, pos) {
2540
- buf.set(val, pos); // also works for plain array values
2541
- }
2542
- /* istanbul ignore next */
2543
- : function writeBytes_for(val, buf, pos) {
2544
- for (var i = 0; i < val.length; ++i)
2545
- buf[pos + i] = val[i];
2546
- };
2547
-
2548
- /**
2549
- * Writes a sequence of bytes.
2550
- * @param {Uint8Array|string} value Buffer or base64 encoded string to write
2551
- * @returns {Writer} `this`
2552
- */
2553
- Writer.prototype.bytes = function write_bytes(value) {
2554
- var len = value.length >>> 0;
2555
- if (!len)
2556
- return this._push(writeByte, 1, 0);
2557
- if (util.isString(value)) {
2558
- var buf = Writer.alloc(len = base64.length(value));
2559
- base64.decode(value, buf, 0);
2560
- value = buf;
2561
- }
2562
- return this.uint32(len)._push(writeBytes, len, value);
2563
- };
2564
-
2565
- /**
2566
- * Writes a string.
2567
- * @param {string} value Value to write
2568
- * @returns {Writer} `this`
2569
- */
2570
- Writer.prototype.string = function write_string(value) {
2571
- var len = utf8.length(value);
2572
- return len
2573
- ? this.uint32(len)._push(utf8.write, len, value)
2574
- : this._push(writeByte, 1, 0);
2575
- };
2576
-
2577
- /**
2578
- * Forks this writer's state by pushing it to a stack.
2579
- * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.
2580
- * @returns {Writer} `this`
2581
- */
2582
- Writer.prototype.fork = function fork() {
2583
- this.states = new State(this);
2584
- this.head = this.tail = new Op(noop, 0, 0);
2585
- this.len = 0;
2586
- return this;
2587
- };
2588
-
2589
- /**
2590
- * Resets this instance to the last state.
2591
- * @returns {Writer} `this`
2592
- */
2593
- Writer.prototype.reset = function reset() {
2594
- if (this.states) {
2595
- this.head = this.states.head;
2596
- this.tail = this.states.tail;
2597
- this.len = this.states.len;
2598
- this.states = this.states.next;
2599
- } else {
2600
- this.head = this.tail = new Op(noop, 0, 0);
2601
- this.len = 0;
2602
- }
2603
- return this;
2604
- };
2605
-
2606
- /**
2607
- * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.
2608
- * @returns {Writer} `this`
2609
- */
2610
- Writer.prototype.ldelim = function ldelim() {
2611
- var head = this.head,
2612
- tail = this.tail,
2613
- len = this.len;
2614
- this.reset().uint32(len);
2615
- if (len) {
2616
- this.tail.next = head.next; // skip noop
2617
- this.tail = tail;
2618
- this.len += len;
2619
- }
2620
- return this;
2621
- };
2622
-
2623
- /**
2624
- * Finishes the write operation.
2625
- * @returns {Uint8Array} Finished buffer
2626
- */
2627
- Writer.prototype.finish = function finish() {
2628
- var head = this.head.next, // skip noop
2629
- buf = this.constructor.alloc(this.len),
2630
- pos = 0;
2631
- while (head) {
2632
- head.fn(head.val, buf, pos);
2633
- pos += head.len;
2634
- head = head.next;
2635
- }
2636
- // this.head = this.tail = null;
2637
- return buf;
2638
- };
1740
+ "use strict";
1741
+ var util = exports;
1742
+
1743
+ // used to return a Promise where callback is omitted
1744
+ util.asPromise = require(1);
1745
+
1746
+ // converts to / from base64 encoded strings
1747
+ util.base64 = require(2);
1748
+
1749
+ // base class of rpc.Service
1750
+ util.EventEmitter = require(3);
1751
+
1752
+ // float handling accross browsers
1753
+ util.float = require(4);
1754
+
1755
+ // requires modules optionally and hides the call from bundlers
1756
+ util.inquire = require(5);
1757
+
1758
+ // converts to / from utf8 encoded strings
1759
+ util.utf8 = require(7);
1760
+
1761
+ // provides a node-like buffer pool in the browser
1762
+ util.pool = require(6);
1763
+
1764
+ // utility to work with the low and high bits of a 64 bit value
1765
+ util.LongBits = require(14);
1766
+
1767
+ /**
1768
+ * Whether running within node or not.
1769
+ * @memberof util
1770
+ * @type {boolean}
1771
+ */
1772
+ util.isNode = Boolean(typeof global !== "undefined"
1773
+ && global
1774
+ && global.process
1775
+ && global.process.versions
1776
+ && global.process.versions.node);
1777
+
1778
+ /**
1779
+ * Global object reference.
1780
+ * @memberof util
1781
+ * @type {Object}
1782
+ */
1783
+ util.global = util.isNode && global
1784
+ || typeof window !== "undefined" && window
1785
+ || typeof self !== "undefined" && self
1786
+ || this; // eslint-disable-line no-invalid-this
1787
+
1788
+ /**
1789
+ * An immuable empty array.
1790
+ * @memberof util
1791
+ * @type {Array.<*>}
1792
+ * @const
1793
+ */
1794
+ util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes
1795
+
1796
+ /**
1797
+ * An immutable empty object.
1798
+ * @type {Object}
1799
+ * @const
1800
+ */
1801
+ util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes
1802
+
1803
+ /**
1804
+ * Tests if the specified value is an integer.
1805
+ * @function
1806
+ * @param {*} value Value to test
1807
+ * @returns {boolean} `true` if the value is an integer
1808
+ */
1809
+ util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {
1810
+ return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
1811
+ };
1812
+
1813
+ /**
1814
+ * Tests if the specified value is a string.
1815
+ * @param {*} value Value to test
1816
+ * @returns {boolean} `true` if the value is a string
1817
+ */
1818
+ util.isString = function isString(value) {
1819
+ return typeof value === "string" || value instanceof String;
1820
+ };
1821
+
1822
+ /**
1823
+ * Tests if the specified value is a non-null object.
1824
+ * @param {*} value Value to test
1825
+ * @returns {boolean} `true` if the value is a non-null object
1826
+ */
1827
+ util.isObject = function isObject(value) {
1828
+ return value && typeof value === "object";
1829
+ };
1830
+
1831
+ /**
1832
+ * Checks if a property on a message is considered to be present.
1833
+ * This is an alias of {@link util.isSet}.
1834
+ * @function
1835
+ * @param {Object} obj Plain object or message instance
1836
+ * @param {string} prop Property name
1837
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
1838
+ */
1839
+ util.isset =
1840
+
1841
+ /**
1842
+ * Checks if a property on a message is considered to be present.
1843
+ * @param {Object} obj Plain object or message instance
1844
+ * @param {string} prop Property name
1845
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
1846
+ */
1847
+ util.isSet = function isSet(obj, prop) {
1848
+ var value = obj[prop];
1849
+ if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
1850
+ return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
1851
+ return false;
1852
+ };
1853
+
1854
+ /**
1855
+ * Any compatible Buffer instance.
1856
+ * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
1857
+ * @interface Buffer
1858
+ * @extends Uint8Array
1859
+ */
1860
+
1861
+ /**
1862
+ * Node's Buffer class if available.
1863
+ * @type {Constructor<Buffer>}
1864
+ */
1865
+ util.Buffer = (function() {
1866
+ try {
1867
+ var Buffer = util.inquire("buffer").Buffer;
1868
+ // refuse to use non-node buffers if not explicitly assigned (perf reasons):
1869
+ return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;
1870
+ } catch (e) {
1871
+ /* istanbul ignore next */
1872
+ return null;
1873
+ }
1874
+ })();
1875
+
1876
+ // Internal alias of or polyfull for Buffer.from.
1877
+ util._Buffer_from = null;
1878
+
1879
+ // Internal alias of or polyfill for Buffer.allocUnsafe.
1880
+ util._Buffer_allocUnsafe = null;
1881
+
1882
+ /**
1883
+ * Creates a new buffer of whatever type supported by the environment.
1884
+ * @param {number|number[]} [sizeOrArray=0] Buffer size or number array
1885
+ * @returns {Uint8Array|Buffer} Buffer
1886
+ */
1887
+ util.newBuffer = function newBuffer(sizeOrArray) {
1888
+ /* istanbul ignore next */
1889
+ return typeof sizeOrArray === "number"
1890
+ ? util.Buffer
1891
+ ? util._Buffer_allocUnsafe(sizeOrArray)
1892
+ : new util.Array(sizeOrArray)
1893
+ : util.Buffer
1894
+ ? util._Buffer_from(sizeOrArray)
1895
+ : typeof Uint8Array === "undefined"
1896
+ ? sizeOrArray
1897
+ : new Uint8Array(sizeOrArray);
1898
+ };
1899
+
1900
+ /**
1901
+ * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
1902
+ * @type {Constructor<Uint8Array>}
1903
+ */
1904
+ util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array;
1905
+
1906
+ /**
1907
+ * Any compatible Long instance.
1908
+ * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.
1909
+ * @interface Long
1910
+ * @property {number} low Low bits
1911
+ * @property {number} high High bits
1912
+ * @property {boolean} unsigned Whether unsigned or not
1913
+ */
1914
+
1915
+ /**
1916
+ * Long.js's Long class if available.
1917
+ * @type {Constructor<Long>}
1918
+ */
1919
+ util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
1920
+ || /* istanbul ignore next */ util.global.Long
1921
+ || util.inquire("long");
1922
+
1923
+ /**
1924
+ * Regular expression used to verify 2 bit (`bool`) map keys.
1925
+ * @type {RegExp}
1926
+ * @const
1927
+ */
1928
+ util.key2Re = /^true|false|0|1$/;
1929
+
1930
+ /**
1931
+ * Regular expression used to verify 32 bit (`int32` etc.) map keys.
1932
+ * @type {RegExp}
1933
+ * @const
1934
+ */
1935
+ util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
1936
+
1937
+ /**
1938
+ * Regular expression used to verify 64 bit (`int64` etc.) map keys.
1939
+ * @type {RegExp}
1940
+ * @const
1941
+ */
1942
+ util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
1943
+
1944
+ /**
1945
+ * Converts a number or long to an 8 characters long hash string.
1946
+ * @param {Long|number} value Value to convert
1947
+ * @returns {string} Hash
1948
+ */
1949
+ util.longToHash = function longToHash(value) {
1950
+ return value
1951
+ ? util.LongBits.from(value).toHash()
1952
+ : util.LongBits.zeroHash;
1953
+ };
1954
+
1955
+ /**
1956
+ * Converts an 8 characters long hash string to a long or number.
1957
+ * @param {string} hash Hash
1958
+ * @param {boolean} [unsigned=false] Whether unsigned or not
1959
+ * @returns {Long|number} Original value
1960
+ */
1961
+ util.longFromHash = function longFromHash(hash, unsigned) {
1962
+ var bits = util.LongBits.fromHash(hash);
1963
+ if (util.Long)
1964
+ return util.Long.fromBits(bits.lo, bits.hi, unsigned);
1965
+ return bits.toNumber(Boolean(unsigned));
1966
+ };
1967
+
1968
+ /**
1969
+ * Merges the properties of the source object into the destination object.
1970
+ * @memberof util
1971
+ * @param {Object.<string,*>} dst Destination object
1972
+ * @param {Object.<string,*>} src Source object
1973
+ * @param {boolean} [ifNotSet=false] Merges only if the key is not already set
1974
+ * @returns {Object.<string,*>} Destination object
1975
+ */
1976
+ function merge(dst, src, ifNotSet) { // used by converters
1977
+ for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
1978
+ if (dst[keys[i]] === undefined || !ifNotSet)
1979
+ dst[keys[i]] = src[keys[i]];
1980
+ return dst;
1981
+ }
1982
+
1983
+ util.merge = merge;
1984
+
1985
+ /**
1986
+ * Converts the first character of a string to lower case.
1987
+ * @param {string} str String to convert
1988
+ * @returns {string} Converted string
1989
+ */
1990
+ util.lcFirst = function lcFirst(str) {
1991
+ return str.charAt(0).toLowerCase() + str.substring(1);
1992
+ };
1993
+
1994
+ /**
1995
+ * Creates a custom error constructor.
1996
+ * @memberof util
1997
+ * @param {string} name Error name
1998
+ * @returns {Constructor<Error>} Custom error constructor
1999
+ */
2000
+ function newError(name) {
2001
+
2002
+ function CustomError(message, properties) {
2003
+
2004
+ if (!(this instanceof CustomError))
2005
+ return new CustomError(message, properties);
2006
+
2007
+ // Error.call(this, message);
2008
+ // ^ just returns a new error instance because the ctor can be called as a function
2009
+
2010
+ Object.defineProperty(this, "message", { get: function() { return message; } });
2011
+
2012
+ /* istanbul ignore next */
2013
+ if (Error.captureStackTrace) // node
2014
+ Error.captureStackTrace(this, CustomError);
2015
+ else
2016
+ Object.defineProperty(this, "stack", { value: new Error().stack || "" });
2017
+
2018
+ if (properties)
2019
+ merge(this, properties);
2020
+ }
2021
+
2022
+ CustomError.prototype = Object.create(Error.prototype, {
2023
+ constructor: {
2024
+ value: CustomError,
2025
+ writable: true,
2026
+ enumerable: false,
2027
+ configurable: true,
2028
+ },
2029
+ name: {
2030
+ get: function get() { return name; },
2031
+ set: undefined,
2032
+ enumerable: false,
2033
+ // configurable: false would accurately preserve the behavior of
2034
+ // the original, but I'm guessing that was not intentional.
2035
+ // For an actual error subclass, this property would
2036
+ // be configurable.
2037
+ configurable: true,
2038
+ },
2039
+ toString: {
2040
+ value: function value() { return this.name + ": " + this.message; },
2041
+ writable: true,
2042
+ enumerable: false,
2043
+ configurable: true,
2044
+ },
2045
+ });
2046
+
2047
+ return CustomError;
2048
+ }
2049
+
2050
+ util.newError = newError;
2051
+
2052
+ /**
2053
+ * Constructs a new protocol error.
2054
+ * @classdesc Error subclass indicating a protocol specifc error.
2055
+ * @memberof util
2056
+ * @extends Error
2057
+ * @template T extends Message<T>
2058
+ * @constructor
2059
+ * @param {string} message Error message
2060
+ * @param {Object.<string,*>} [properties] Additional properties
2061
+ * @example
2062
+ * try {
2063
+ * MyMessage.decode(someBuffer); // throws if required fields are missing
2064
+ * } catch (e) {
2065
+ * if (e instanceof ProtocolError && e.instance)
2066
+ * console.log("decoded so far: " + JSON.stringify(e.instance));
2067
+ * }
2068
+ */
2069
+ util.ProtocolError = newError("ProtocolError");
2070
+
2071
+ /**
2072
+ * So far decoded message instance.
2073
+ * @name util.ProtocolError#instance
2074
+ * @type {Message<T>}
2075
+ */
2076
+
2077
+ /**
2078
+ * A OneOf getter as returned by {@link util.oneOfGetter}.
2079
+ * @typedef OneOfGetter
2080
+ * @type {function}
2081
+ * @returns {string|undefined} Set field name, if any
2082
+ */
2083
+
2084
+ /**
2085
+ * Builds a getter for a oneof's present field name.
2086
+ * @param {string[]} fieldNames Field names
2087
+ * @returns {OneOfGetter} Unbound getter
2088
+ */
2089
+ util.oneOfGetter = function getOneOf(fieldNames) {
2090
+ var fieldMap = {};
2091
+ for (var i = 0; i < fieldNames.length; ++i)
2092
+ fieldMap[fieldNames[i]] = 1;
2093
+
2094
+ /**
2095
+ * @returns {string|undefined} Set field name, if any
2096
+ * @this Object
2097
+ * @ignore
2098
+ */
2099
+ return function() { // eslint-disable-line consistent-return
2100
+ for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
2101
+ if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
2102
+ return keys[i];
2103
+ };
2104
+ };
2105
+
2106
+ /**
2107
+ * A OneOf setter as returned by {@link util.oneOfSetter}.
2108
+ * @typedef OneOfSetter
2109
+ * @type {function}
2110
+ * @param {string|undefined} value Field name
2111
+ * @returns {undefined}
2112
+ */
2113
+
2114
+ /**
2115
+ * Builds a setter for a oneof's present field name.
2116
+ * @param {string[]} fieldNames Field names
2117
+ * @returns {OneOfSetter} Unbound setter
2118
+ */
2119
+ util.oneOfSetter = function setOneOf(fieldNames) {
2120
+
2121
+ /**
2122
+ * @param {string} name Field name
2123
+ * @returns {undefined}
2124
+ * @this Object
2125
+ * @ignore
2126
+ */
2127
+ return function(name) {
2128
+ for (var i = 0; i < fieldNames.length; ++i)
2129
+ if (fieldNames[i] !== name)
2130
+ delete this[fieldNames[i]];
2131
+ };
2132
+ };
2133
+
2134
+ /**
2135
+ * Default conversion options used for {@link Message#toJSON} implementations.
2136
+ *
2137
+ * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
2138
+ *
2139
+ * - Longs become strings
2140
+ * - Enums become string keys
2141
+ * - Bytes become base64 encoded strings
2142
+ * - (Sub-)Messages become plain objects
2143
+ * - Maps become plain objects with all string keys
2144
+ * - Repeated fields become arrays
2145
+ * - NaN and Infinity for float and double fields become strings
2146
+ *
2147
+ * @type {IConversionOptions}
2148
+ * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
2149
+ */
2150
+ util.toJSONOptions = {
2151
+ longs: String,
2152
+ enums: String,
2153
+ bytes: String,
2154
+ json: true
2155
+ };
2156
+
2157
+ // Sets up buffer utility according to the environment (called in index-minimal)
2158
+ util._configure = function() {
2159
+ var Buffer = util.Buffer;
2160
+ /* istanbul ignore if */
2161
+ if (!Buffer) {
2162
+ util._Buffer_from = util._Buffer_allocUnsafe = null;
2163
+ return;
2164
+ }
2165
+ // because node 4.x buffers are incompatible & immutable
2166
+ // see: https://github.com/dcodeIO/protobuf.js/pull/665
2167
+ util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
2168
+ /* istanbul ignore next */
2169
+ function Buffer_from(value, encoding) {
2170
+ return new Buffer(value, encoding);
2171
+ };
2172
+ util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
2173
+ /* istanbul ignore next */
2174
+ function Buffer_allocUnsafe(size) {
2175
+ return new Buffer(size);
2176
+ };
2177
+ };
2639
2178
 
2640
- Writer._configure = function(BufferWriter_) {
2641
- BufferWriter = BufferWriter_;
2642
- Writer.create = create();
2643
- BufferWriter._configure();
2644
- };
2179
+ },{"1":1,"14":14,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7}],16:[function(require,module,exports){
2180
+ "use strict";
2181
+ module.exports = Writer;
2182
+
2183
+ var util = require(15);
2184
+
2185
+ var BufferWriter; // cyclic
2186
+
2187
+ var LongBits = util.LongBits,
2188
+ base64 = util.base64,
2189
+ utf8 = util.utf8;
2190
+
2191
+ /**
2192
+ * Constructs a new writer operation instance.
2193
+ * @classdesc Scheduled writer operation.
2194
+ * @constructor
2195
+ * @param {function(*, Uint8Array, number)} fn Function to call
2196
+ * @param {number} len Value byte length
2197
+ * @param {*} val Value to write
2198
+ * @ignore
2199
+ */
2200
+ function Op(fn, len, val) {
2201
+
2202
+ /**
2203
+ * Function to call.
2204
+ * @type {function(Uint8Array, number, *)}
2205
+ */
2206
+ this.fn = fn;
2207
+
2208
+ /**
2209
+ * Value byte length.
2210
+ * @type {number}
2211
+ */
2212
+ this.len = len;
2213
+
2214
+ /**
2215
+ * Next operation.
2216
+ * @type {Writer.Op|undefined}
2217
+ */
2218
+ this.next = undefined;
2219
+
2220
+ /**
2221
+ * Value to write.
2222
+ * @type {*}
2223
+ */
2224
+ this.val = val; // type varies
2225
+ }
2226
+
2227
+ /* istanbul ignore next */
2228
+ function noop() {} // eslint-disable-line no-empty-function
2229
+
2230
+ /**
2231
+ * Constructs a new writer state instance.
2232
+ * @classdesc Copied writer state.
2233
+ * @memberof Writer
2234
+ * @constructor
2235
+ * @param {Writer} writer Writer to copy state from
2236
+ * @ignore
2237
+ */
2238
+ function State(writer) {
2239
+
2240
+ /**
2241
+ * Current head.
2242
+ * @type {Writer.Op}
2243
+ */
2244
+ this.head = writer.head;
2245
+
2246
+ /**
2247
+ * Current tail.
2248
+ * @type {Writer.Op}
2249
+ */
2250
+ this.tail = writer.tail;
2251
+
2252
+ /**
2253
+ * Current buffer length.
2254
+ * @type {number}
2255
+ */
2256
+ this.len = writer.len;
2257
+
2258
+ /**
2259
+ * Next state.
2260
+ * @type {State|null}
2261
+ */
2262
+ this.next = writer.states;
2263
+ }
2264
+
2265
+ /**
2266
+ * Constructs a new writer instance.
2267
+ * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.
2268
+ * @constructor
2269
+ */
2270
+ function Writer() {
2271
+
2272
+ /**
2273
+ * Current length.
2274
+ * @type {number}
2275
+ */
2276
+ this.len = 0;
2277
+
2278
+ /**
2279
+ * Operations head.
2280
+ * @type {Object}
2281
+ */
2282
+ this.head = new Op(noop, 0, 0);
2283
+
2284
+ /**
2285
+ * Operations tail
2286
+ * @type {Object}
2287
+ */
2288
+ this.tail = this.head;
2289
+
2290
+ /**
2291
+ * Linked forked states.
2292
+ * @type {Object|null}
2293
+ */
2294
+ this.states = null;
2295
+
2296
+ // When a value is written, the writer calculates its byte length and puts it into a linked
2297
+ // list of operations to perform when finish() is called. This both allows us to allocate
2298
+ // buffers of the exact required size and reduces the amount of work we have to do compared
2299
+ // to first calculating over objects and then encoding over objects. In our case, the encoding
2300
+ // part is just a linked list walk calling operations with already prepared values.
2301
+ }
2302
+
2303
+ var create = function create() {
2304
+ return util.Buffer
2305
+ ? function create_buffer_setup() {
2306
+ return (Writer.create = function create_buffer() {
2307
+ return new BufferWriter();
2308
+ })();
2309
+ }
2310
+ /* istanbul ignore next */
2311
+ : function create_array() {
2312
+ return new Writer();
2313
+ };
2314
+ };
2315
+
2316
+ /**
2317
+ * Creates a new writer.
2318
+ * @function
2319
+ * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}
2320
+ */
2321
+ Writer.create = create();
2322
+
2323
+ /**
2324
+ * Allocates a buffer of the specified size.
2325
+ * @param {number} size Buffer size
2326
+ * @returns {Uint8Array} Buffer
2327
+ */
2328
+ Writer.alloc = function alloc(size) {
2329
+ return new util.Array(size);
2330
+ };
2331
+
2332
+ // Use Uint8Array buffer pool in the browser, just like node does with buffers
2333
+ /* istanbul ignore else */
2334
+ if (util.Array !== Array)
2335
+ Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);
2336
+
2337
+ /**
2338
+ * Pushes a new operation to the queue.
2339
+ * @param {function(Uint8Array, number, *)} fn Function to call
2340
+ * @param {number} len Value byte length
2341
+ * @param {number} val Value to write
2342
+ * @returns {Writer} `this`
2343
+ * @private
2344
+ */
2345
+ Writer.prototype._push = function push(fn, len, val) {
2346
+ this.tail = this.tail.next = new Op(fn, len, val);
2347
+ this.len += len;
2348
+ return this;
2349
+ };
2350
+
2351
+ function writeByte(val, buf, pos) {
2352
+ buf[pos] = val & 255;
2353
+ }
2354
+
2355
+ function writeVarint32(val, buf, pos) {
2356
+ while (val > 127) {
2357
+ buf[pos++] = val & 127 | 128;
2358
+ val >>>= 7;
2359
+ }
2360
+ buf[pos] = val;
2361
+ }
2362
+
2363
+ /**
2364
+ * Constructs a new varint writer operation instance.
2365
+ * @classdesc Scheduled varint writer operation.
2366
+ * @extends Op
2367
+ * @constructor
2368
+ * @param {number} len Value byte length
2369
+ * @param {number} val Value to write
2370
+ * @ignore
2371
+ */
2372
+ function VarintOp(len, val) {
2373
+ this.len = len;
2374
+ this.next = undefined;
2375
+ this.val = val;
2376
+ }
2377
+
2378
+ VarintOp.prototype = Object.create(Op.prototype);
2379
+ VarintOp.prototype.fn = writeVarint32;
2380
+
2381
+ /**
2382
+ * Writes an unsigned 32 bit value as a varint.
2383
+ * @param {number} value Value to write
2384
+ * @returns {Writer} `this`
2385
+ */
2386
+ Writer.prototype.uint32 = function write_uint32(value) {
2387
+ // here, the call to this.push has been inlined and a varint specific Op subclass is used.
2388
+ // uint32 is by far the most frequently used operation and benefits significantly from this.
2389
+ this.len += (this.tail = this.tail.next = new VarintOp(
2390
+ (value = value >>> 0)
2391
+ < 128 ? 1
2392
+ : value < 16384 ? 2
2393
+ : value < 2097152 ? 3
2394
+ : value < 268435456 ? 4
2395
+ : 5,
2396
+ value)).len;
2397
+ return this;
2398
+ };
2399
+
2400
+ /**
2401
+ * Writes a signed 32 bit value as a varint.
2402
+ * @function
2403
+ * @param {number} value Value to write
2404
+ * @returns {Writer} `this`
2405
+ */
2406
+ Writer.prototype.int32 = function write_int32(value) {
2407
+ return value < 0
2408
+ ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
2409
+ : this.uint32(value);
2410
+ };
2411
+
2412
+ /**
2413
+ * Writes a 32 bit value as a varint, zig-zag encoded.
2414
+ * @param {number} value Value to write
2415
+ * @returns {Writer} `this`
2416
+ */
2417
+ Writer.prototype.sint32 = function write_sint32(value) {
2418
+ return this.uint32((value << 1 ^ value >> 31) >>> 0);
2419
+ };
2420
+
2421
+ function writeVarint64(val, buf, pos) {
2422
+ while (val.hi) {
2423
+ buf[pos++] = val.lo & 127 | 128;
2424
+ val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
2425
+ val.hi >>>= 7;
2426
+ }
2427
+ while (val.lo > 127) {
2428
+ buf[pos++] = val.lo & 127 | 128;
2429
+ val.lo = val.lo >>> 7;
2430
+ }
2431
+ buf[pos++] = val.lo;
2432
+ }
2433
+
2434
+ /**
2435
+ * Writes an unsigned 64 bit value as a varint.
2436
+ * @param {Long|number|string} value Value to write
2437
+ * @returns {Writer} `this`
2438
+ * @throws {TypeError} If `value` is a string and no long library is present.
2439
+ */
2440
+ Writer.prototype.uint64 = function write_uint64(value) {
2441
+ var bits = LongBits.from(value);
2442
+ return this._push(writeVarint64, bits.length(), bits);
2443
+ };
2444
+
2445
+ /**
2446
+ * Writes a signed 64 bit value as a varint.
2447
+ * @function
2448
+ * @param {Long|number|string} value Value to write
2449
+ * @returns {Writer} `this`
2450
+ * @throws {TypeError} If `value` is a string and no long library is present.
2451
+ */
2452
+ Writer.prototype.int64 = Writer.prototype.uint64;
2453
+
2454
+ /**
2455
+ * Writes a signed 64 bit value as a varint, zig-zag encoded.
2456
+ * @param {Long|number|string} value Value to write
2457
+ * @returns {Writer} `this`
2458
+ * @throws {TypeError} If `value` is a string and no long library is present.
2459
+ */
2460
+ Writer.prototype.sint64 = function write_sint64(value) {
2461
+ var bits = LongBits.from(value).zzEncode();
2462
+ return this._push(writeVarint64, bits.length(), bits);
2463
+ };
2464
+
2465
+ /**
2466
+ * Writes a boolish value as a varint.
2467
+ * @param {boolean} value Value to write
2468
+ * @returns {Writer} `this`
2469
+ */
2470
+ Writer.prototype.bool = function write_bool(value) {
2471
+ return this._push(writeByte, 1, value ? 1 : 0);
2472
+ };
2473
+
2474
+ function writeFixed32(val, buf, pos) {
2475
+ buf[pos ] = val & 255;
2476
+ buf[pos + 1] = val >>> 8 & 255;
2477
+ buf[pos + 2] = val >>> 16 & 255;
2478
+ buf[pos + 3] = val >>> 24;
2479
+ }
2480
+
2481
+ /**
2482
+ * Writes an unsigned 32 bit value as fixed 32 bits.
2483
+ * @param {number} value Value to write
2484
+ * @returns {Writer} `this`
2485
+ */
2486
+ Writer.prototype.fixed32 = function write_fixed32(value) {
2487
+ return this._push(writeFixed32, 4, value >>> 0);
2488
+ };
2489
+
2490
+ /**
2491
+ * Writes a signed 32 bit value as fixed 32 bits.
2492
+ * @function
2493
+ * @param {number} value Value to write
2494
+ * @returns {Writer} `this`
2495
+ */
2496
+ Writer.prototype.sfixed32 = Writer.prototype.fixed32;
2497
+
2498
+ /**
2499
+ * Writes an unsigned 64 bit value as fixed 64 bits.
2500
+ * @param {Long|number|string} value Value to write
2501
+ * @returns {Writer} `this`
2502
+ * @throws {TypeError} If `value` is a string and no long library is present.
2503
+ */
2504
+ Writer.prototype.fixed64 = function write_fixed64(value) {
2505
+ var bits = LongBits.from(value);
2506
+ return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);
2507
+ };
2508
+
2509
+ /**
2510
+ * Writes a signed 64 bit value as fixed 64 bits.
2511
+ * @function
2512
+ * @param {Long|number|string} value Value to write
2513
+ * @returns {Writer} `this`
2514
+ * @throws {TypeError} If `value` is a string and no long library is present.
2515
+ */
2516
+ Writer.prototype.sfixed64 = Writer.prototype.fixed64;
2517
+
2518
+ /**
2519
+ * Writes a float (32 bit).
2520
+ * @function
2521
+ * @param {number} value Value to write
2522
+ * @returns {Writer} `this`
2523
+ */
2524
+ Writer.prototype.float = function write_float(value) {
2525
+ return this._push(util.float.writeFloatLE, 4, value);
2526
+ };
2527
+
2528
+ /**
2529
+ * Writes a double (64 bit float).
2530
+ * @function
2531
+ * @param {number} value Value to write
2532
+ * @returns {Writer} `this`
2533
+ */
2534
+ Writer.prototype.double = function write_double(value) {
2535
+ return this._push(util.float.writeDoubleLE, 8, value);
2536
+ };
2537
+
2538
+ var writeBytes = util.Array.prototype.set
2539
+ ? function writeBytes_set(val, buf, pos) {
2540
+ buf.set(val, pos); // also works for plain array values
2541
+ }
2542
+ /* istanbul ignore next */
2543
+ : function writeBytes_for(val, buf, pos) {
2544
+ for (var i = 0; i < val.length; ++i)
2545
+ buf[pos + i] = val[i];
2546
+ };
2547
+
2548
+ /**
2549
+ * Writes a sequence of bytes.
2550
+ * @param {Uint8Array|string} value Buffer or base64 encoded string to write
2551
+ * @returns {Writer} `this`
2552
+ */
2553
+ Writer.prototype.bytes = function write_bytes(value) {
2554
+ var len = value.length >>> 0;
2555
+ if (!len)
2556
+ return this._push(writeByte, 1, 0);
2557
+ if (util.isString(value)) {
2558
+ var buf = Writer.alloc(len = base64.length(value));
2559
+ base64.decode(value, buf, 0);
2560
+ value = buf;
2561
+ }
2562
+ return this.uint32(len)._push(writeBytes, len, value);
2563
+ };
2564
+
2565
+ /**
2566
+ * Writes a string.
2567
+ * @param {string} value Value to write
2568
+ * @returns {Writer} `this`
2569
+ */
2570
+ Writer.prototype.string = function write_string(value) {
2571
+ var len = utf8.length(value);
2572
+ return len
2573
+ ? this.uint32(len)._push(utf8.write, len, value)
2574
+ : this._push(writeByte, 1, 0);
2575
+ };
2576
+
2577
+ /**
2578
+ * Forks this writer's state by pushing it to a stack.
2579
+ * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.
2580
+ * @returns {Writer} `this`
2581
+ */
2582
+ Writer.prototype.fork = function fork() {
2583
+ this.states = new State(this);
2584
+ this.head = this.tail = new Op(noop, 0, 0);
2585
+ this.len = 0;
2586
+ return this;
2587
+ };
2588
+
2589
+ /**
2590
+ * Resets this instance to the last state.
2591
+ * @returns {Writer} `this`
2592
+ */
2593
+ Writer.prototype.reset = function reset() {
2594
+ if (this.states) {
2595
+ this.head = this.states.head;
2596
+ this.tail = this.states.tail;
2597
+ this.len = this.states.len;
2598
+ this.states = this.states.next;
2599
+ } else {
2600
+ this.head = this.tail = new Op(noop, 0, 0);
2601
+ this.len = 0;
2602
+ }
2603
+ return this;
2604
+ };
2605
+
2606
+ /**
2607
+ * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.
2608
+ * @returns {Writer} `this`
2609
+ */
2610
+ Writer.prototype.ldelim = function ldelim() {
2611
+ var head = this.head,
2612
+ tail = this.tail,
2613
+ len = this.len;
2614
+ this.reset().uint32(len);
2615
+ if (len) {
2616
+ this.tail.next = head.next; // skip noop
2617
+ this.tail = tail;
2618
+ this.len += len;
2619
+ }
2620
+ return this;
2621
+ };
2622
+
2623
+ /**
2624
+ * Finishes the write operation.
2625
+ * @returns {Uint8Array} Finished buffer
2626
+ */
2627
+ Writer.prototype.finish = function finish() {
2628
+ var head = this.head.next, // skip noop
2629
+ buf = this.constructor.alloc(this.len),
2630
+ pos = 0;
2631
+ while (head) {
2632
+ head.fn(head.val, buf, pos);
2633
+ pos += head.len;
2634
+ head = head.next;
2635
+ }
2636
+ // this.head = this.tail = null;
2637
+ return buf;
2638
+ };
2639
+
2640
+ Writer._configure = function(BufferWriter_) {
2641
+ BufferWriter = BufferWriter_;
2642
+ Writer.create = create();
2643
+ BufferWriter._configure();
2644
+ };
2645
2645
 
2646
2646
  },{"15":15}],17:[function(require,module,exports){
2647
- "use strict";
2648
- module.exports = BufferWriter;
2649
-
2650
- // extends Writer
2651
- var Writer = require(16);
2652
- (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
2653
-
2654
- var util = require(15);
2655
-
2656
- /**
2657
- * Constructs a new buffer writer instance.
2658
- * @classdesc Wire format writer using node buffers.
2659
- * @extends Writer
2660
- * @constructor
2661
- */
2662
- function BufferWriter() {
2663
- Writer.call(this);
2664
- }
2665
-
2666
- BufferWriter._configure = function () {
2667
- /**
2668
- * Allocates a buffer of the specified size.
2669
- * @function
2670
- * @param {number} size Buffer size
2671
- * @returns {Buffer} Buffer
2672
- */
2673
- BufferWriter.alloc = util._Buffer_allocUnsafe;
2674
-
2675
- BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set"
2676
- ? function writeBytesBuffer_set(val, buf, pos) {
2677
- buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)
2678
- // also works for plain array values
2679
- }
2680
- /* istanbul ignore next */
2681
- : function writeBytesBuffer_copy(val, buf, pos) {
2682
- if (val.copy) // Buffer values
2683
- val.copy(buf, pos, 0, val.length);
2684
- else for (var i = 0; i < val.length;) // plain array values
2685
- buf[pos++] = val[i++];
2686
- };
2687
- };
2688
-
2689
-
2690
- /**
2691
- * @override
2692
- */
2693
- BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
2694
- if (util.isString(value))
2695
- value = util._Buffer_from(value, "base64");
2696
- var len = value.length >>> 0;
2697
- this.uint32(len);
2698
- if (len)
2699
- this._push(BufferWriter.writeBytesBuffer, len, value);
2700
- return this;
2701
- };
2702
-
2703
- function writeStringBuffer(val, buf, pos) {
2704
- if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)
2705
- util.utf8.write(val, buf, pos);
2706
- else if (buf.utf8Write)
2707
- buf.utf8Write(val, pos);
2708
- else
2709
- buf.write(val, pos);
2710
- }
2711
-
2712
- /**
2713
- * @override
2714
- */
2715
- BufferWriter.prototype.string = function write_string_buffer(value) {
2716
- var len = util.Buffer.byteLength(value);
2717
- this.uint32(len);
2718
- if (len)
2719
- this._push(writeStringBuffer, len, value);
2720
- return this;
2721
- };
2722
-
2723
-
2724
- /**
2725
- * Finishes the write operation.
2726
- * @name BufferWriter#finish
2727
- * @function
2728
- * @returns {Buffer} Finished buffer
2729
- */
2730
-
2731
- BufferWriter._configure();
2647
+ "use strict";
2648
+ module.exports = BufferWriter;
2649
+
2650
+ // extends Writer
2651
+ var Writer = require(16);
2652
+ (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
2653
+
2654
+ var util = require(15);
2655
+
2656
+ /**
2657
+ * Constructs a new buffer writer instance.
2658
+ * @classdesc Wire format writer using node buffers.
2659
+ * @extends Writer
2660
+ * @constructor
2661
+ */
2662
+ function BufferWriter() {
2663
+ Writer.call(this);
2664
+ }
2665
+
2666
+ BufferWriter._configure = function () {
2667
+ /**
2668
+ * Allocates a buffer of the specified size.
2669
+ * @function
2670
+ * @param {number} size Buffer size
2671
+ * @returns {Buffer} Buffer
2672
+ */
2673
+ BufferWriter.alloc = util._Buffer_allocUnsafe;
2674
+
2675
+ BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set"
2676
+ ? function writeBytesBuffer_set(val, buf, pos) {
2677
+ buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)
2678
+ // also works for plain array values
2679
+ }
2680
+ /* istanbul ignore next */
2681
+ : function writeBytesBuffer_copy(val, buf, pos) {
2682
+ if (val.copy) // Buffer values
2683
+ val.copy(buf, pos, 0, val.length);
2684
+ else for (var i = 0; i < val.length;) // plain array values
2685
+ buf[pos++] = val[i++];
2686
+ };
2687
+ };
2688
+
2689
+
2690
+ /**
2691
+ * @override
2692
+ */
2693
+ BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
2694
+ if (util.isString(value))
2695
+ value = util._Buffer_from(value, "base64");
2696
+ var len = value.length >>> 0;
2697
+ this.uint32(len);
2698
+ if (len)
2699
+ this._push(BufferWriter.writeBytesBuffer, len, value);
2700
+ return this;
2701
+ };
2702
+
2703
+ function writeStringBuffer(val, buf, pos) {
2704
+ if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)
2705
+ util.utf8.write(val, buf, pos);
2706
+ else if (buf.utf8Write)
2707
+ buf.utf8Write(val, pos);
2708
+ else
2709
+ buf.write(val, pos);
2710
+ }
2711
+
2712
+ /**
2713
+ * @override
2714
+ */
2715
+ BufferWriter.prototype.string = function write_string_buffer(value) {
2716
+ var len = util.Buffer.byteLength(value);
2717
+ this.uint32(len);
2718
+ if (len)
2719
+ this._push(writeStringBuffer, len, value);
2720
+ return this;
2721
+ };
2722
+
2723
+
2724
+ /**
2725
+ * Finishes the write operation.
2726
+ * @name BufferWriter#finish
2727
+ * @function
2728
+ * @returns {Buffer} Finished buffer
2729
+ */
2730
+
2731
+ BufferWriter._configure();
2732
2732
 
2733
2733
  },{"15":15,"16":16}]},{},[8])
2734
2734
 
2735
- })();
2736
- //# sourceMappingURL=protobuf.js.map
2735
+ })();
2736
+ //# sourceMappingURL=protobuf.js.map