node-red-contrib-tak-registration 0.15.0 → 0.16.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 (374) hide show
  1. package/node_modules/@types/node/README.md +2 -2
  2. package/node_modules/@types/node/assert.d.ts +8 -6
  3. package/node_modules/@types/node/async_hooks.d.ts +26 -6
  4. package/node_modules/@types/node/buffer.d.ts +7 -3
  5. package/node_modules/@types/node/child_process.d.ts +28 -124
  6. package/node_modules/@types/node/cluster.d.ts +15 -15
  7. package/node_modules/@types/node/console.d.ts +17 -17
  8. package/node_modules/@types/node/crypto.d.ts +95 -38
  9. package/node_modules/@types/node/dgram.d.ts +1 -1
  10. package/node_modules/@types/node/diagnostics_channel.d.ts +18 -13
  11. package/node_modules/@types/node/dns/promises.d.ts +36 -9
  12. package/node_modules/@types/node/dns.d.ts +89 -36
  13. package/node_modules/@types/node/domain.d.ts +1 -1
  14. package/node_modules/@types/node/events.d.ts +1 -2
  15. package/node_modules/@types/node/fs/promises.d.ts +67 -40
  16. package/node_modules/@types/node/fs.d.ts +88 -52
  17. package/node_modules/@types/node/globals.d.ts +148 -351
  18. package/node_modules/@types/node/globals.typedarray.d.ts +1 -0
  19. package/node_modules/@types/node/http.d.ts +73 -7
  20. package/node_modules/@types/node/http2.d.ts +88 -15
  21. package/node_modules/@types/node/https.d.ts +1 -1
  22. package/node_modules/@types/node/index.d.ts +13 -6
  23. package/node_modules/@types/node/inspector.d.ts +222 -13
  24. package/node_modules/@types/node/module.d.ts +153 -31
  25. package/node_modules/@types/node/net.d.ts +3 -6
  26. package/node_modules/@types/node/os.d.ts +8 -7
  27. package/node_modules/@types/node/package.json +14 -84
  28. package/node_modules/@types/node/path.d.ts +1 -1
  29. package/node_modules/@types/node/perf_hooks.d.ts +24 -10
  30. package/node_modules/@types/node/process.d.ts +21 -11
  31. package/node_modules/@types/node/punycode.d.ts +1 -1
  32. package/node_modules/@types/node/querystring.d.ts +1 -1
  33. package/node_modules/@types/node/readline/promises.d.ts +0 -1
  34. package/node_modules/@types/node/readline.d.ts +13 -13
  35. package/node_modules/@types/node/repl.d.ts +25 -17
  36. package/node_modules/@types/node/sea.d.ts +1 -1
  37. package/node_modules/@types/node/sqlite.d.ts +209 -3
  38. package/node_modules/@types/node/stream/web.d.ts +8 -0
  39. package/node_modules/@types/node/stream.d.ts +30 -24
  40. package/node_modules/@types/node/string_decoder.d.ts +1 -1
  41. package/node_modules/@types/node/test.d.ts +2029 -1975
  42. package/node_modules/@types/node/timers/promises.d.ts +1 -1
  43. package/node_modules/@types/node/timers.d.ts +1 -3
  44. package/node_modules/@types/node/tls.d.ts +2 -48
  45. package/node_modules/@types/node/trace_events.d.ts +6 -6
  46. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  47. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +1 -0
  48. package/node_modules/@types/node/ts5.6/index.d.ts +15 -6
  49. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  50. package/node_modules/@types/node/ts5.7/index.d.ts +101 -0
  51. package/node_modules/@types/node/tty.d.ts +1 -1
  52. package/node_modules/@types/node/url.d.ts +73 -20
  53. package/node_modules/@types/node/util.d.ts +23 -298
  54. package/node_modules/@types/node/v8.d.ts +62 -32
  55. package/node_modules/@types/node/vm.d.ts +132 -24
  56. package/node_modules/@types/node/wasi.d.ts +22 -1
  57. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  58. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  59. package/node_modules/@types/node/web-globals/events.d.ts +94 -0
  60. package/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
  61. package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
  62. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  63. package/node_modules/@types/node/worker_threads.d.ts +85 -26
  64. package/node_modules/@types/node/zlib.d.ts +13 -9
  65. package/node_modules/axios/CHANGELOG.md +99 -0
  66. package/node_modules/axios/README.md +105 -28
  67. package/node_modules/axios/dist/axios.js +395 -292
  68. package/node_modules/axios/dist/axios.js.map +1 -1
  69. package/node_modules/axios/dist/axios.min.js +2 -2
  70. package/node_modules/axios/dist/axios.min.js.map +1 -1
  71. package/node_modules/axios/dist/browser/axios.cjs +333 -219
  72. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  73. package/node_modules/axios/dist/esm/axios.js +333 -219
  74. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  75. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  76. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  77. package/node_modules/axios/dist/node/axios.cjs +424 -219
  78. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  79. package/node_modules/axios/index.d.cts +26 -8
  80. package/node_modules/axios/index.d.ts +14 -5
  81. package/node_modules/axios/lib/adapters/adapters.js +6 -4
  82. package/node_modules/axios/lib/adapters/fetch.js +221 -162
  83. package/node_modules/axios/lib/adapters/http.js +18 -0
  84. package/node_modules/axios/lib/adapters/xhr.js +11 -8
  85. package/node_modules/axios/lib/core/Axios.js +2 -4
  86. package/node_modules/axios/lib/core/AxiosError.js +10 -3
  87. package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
  88. package/node_modules/axios/lib/core/mergeConfig.js +1 -1
  89. package/node_modules/axios/lib/defaults/index.js +1 -1
  90. package/node_modules/axios/lib/env/data.js +1 -1
  91. package/node_modules/axios/lib/helpers/buildURL.js +1 -3
  92. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
  93. package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
  94. package/node_modules/axios/lib/helpers/throttle.js +1 -1
  95. package/node_modules/axios/lib/helpers/toFormData.js +4 -0
  96. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
  97. package/node_modules/axios/lib/utils.js +40 -2
  98. package/node_modules/axios/package.json +30 -15
  99. package/node_modules/bignumber.js/CHANGELOG.md +6 -1
  100. package/node_modules/bignumber.js/README.md +5 -4
  101. package/node_modules/bignumber.js/bignumber.js +2 -2
  102. package/node_modules/bignumber.js/bignumber.mjs +2 -2
  103. package/node_modules/bignumber.js/package.json +1 -1
  104. package/node_modules/fast-xml-parser/CHANGELOG.md +7 -0
  105. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  106. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  107. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  108. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  109. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  110. package/node_modules/fast-xml-parser/package.json +1 -2
  111. package/node_modules/fast-xml-parser/src/cli/cli.js +4 -0
  112. package/node_modules/fast-xml-parser/src/fxp.d.ts +5 -5
  113. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +3 -3
  114. package/node_modules/follow-redirects/package.json +1 -1
  115. package/node_modules/form-data/CHANGELOG.md +601 -0
  116. package/node_modules/form-data/{Readme.md → README.md} +34 -37
  117. package/node_modules/form-data/lib/browser.js +3 -1
  118. package/node_modules/form-data/lib/form_data.js +126 -135
  119. package/node_modules/form-data/lib/populate.js +5 -5
  120. package/node_modules/form-data/package.json +24 -16
  121. package/node_modules/protobufjs/dist/light/protobuf.js +8 -7
  122. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  123. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  124. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  125. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  126. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  127. package/node_modules/protobufjs/dist/protobuf.js +8 -7
  128. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  129. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  130. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  131. package/node_modules/protobufjs/ext/descriptor/index.js +179 -69
  132. package/node_modules/protobufjs/google/protobuf/descriptor.json +660 -17
  133. package/node_modules/protobufjs/google/protobuf/descriptor.proto +255 -6
  134. package/node_modules/protobufjs/package.json +1 -1
  135. package/node_modules/protobufjs/src/namespace.js +3 -1
  136. package/node_modules/protobufjs/src/root.js +3 -4
  137. package/node_modules/undici-types/agent.d.ts +11 -7
  138. package/node_modules/undici-types/api.d.ts +24 -24
  139. package/node_modules/undici-types/balanced-pool.d.ts +11 -11
  140. package/node_modules/undici-types/cache-interceptor.d.ts +172 -0
  141. package/node_modules/undici-types/client-stats.d.ts +15 -0
  142. package/node_modules/undici-types/client.d.ts +18 -16
  143. package/node_modules/undici-types/cookies.d.ts +2 -0
  144. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -10
  145. package/node_modules/undici-types/dispatcher.d.ts +119 -93
  146. package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
  147. package/node_modules/undici-types/errors.d.ts +69 -47
  148. package/node_modules/undici-types/eventsource.d.ts +3 -3
  149. package/node_modules/undici-types/fetch.d.ts +18 -16
  150. package/node_modules/undici-types/formdata.d.ts +7 -7
  151. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  152. package/node_modules/undici-types/global-origin.d.ts +5 -5
  153. package/node_modules/undici-types/h2c-client.d.ts +75 -0
  154. package/node_modules/undici-types/handlers.d.ts +8 -8
  155. package/node_modules/undici-types/header.d.ts +157 -1
  156. package/node_modules/undici-types/index.d.ts +51 -47
  157. package/node_modules/undici-types/interceptors.d.ts +25 -8
  158. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  159. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  160. package/node_modules/undici-types/mock-client.d.ts +6 -4
  161. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  162. package/node_modules/undici-types/mock-interceptor.d.ts +21 -19
  163. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  164. package/node_modules/undici-types/package.json +1 -1
  165. package/node_modules/undici-types/patch.d.ts +0 -4
  166. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  167. package/node_modules/undici-types/pool.d.ts +14 -12
  168. package/node_modules/undici-types/proxy-agent.d.ts +5 -4
  169. package/node_modules/undici-types/readable.d.ts +18 -15
  170. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  171. package/node_modules/undici-types/retry-handler.d.ts +19 -10
  172. package/node_modules/undici-types/util.d.ts +3 -3
  173. package/node_modules/undici-types/utility.d.ts +7 -0
  174. package/node_modules/undici-types/webidl.d.ts +50 -8
  175. package/node_modules/undici-types/websocket.d.ts +36 -2
  176. package/node_modules/uuid/README.md +8 -19
  177. package/node_modules/uuid/dist/{esm-browser/uuid-bin.js → uuid-bin.js} +1 -1
  178. package/node_modules/uuid/dist/{esm-browser/v4.js → v4.js} +7 -4
  179. package/node_modules/uuid/{dist/esm → dist-node}/md5.js +1 -1
  180. package/node_modules/uuid/dist-node/native.js +2 -0
  181. package/node_modules/uuid/{dist/esm → dist-node}/rng.js +1 -1
  182. package/node_modules/uuid/{dist/esm → dist-node}/sha1.js +1 -1
  183. package/node_modules/uuid/{dist/esm → dist-node}/uuid-bin.js +1 -1
  184. package/node_modules/uuid/{dist/esm → dist-node}/v4.js +7 -4
  185. package/node_modules/uuid/package.json +28 -41
  186. package/package.json +6 -6
  187. package/tak-registration.bak +557 -0
  188. package/tak-registration.js +14 -12
  189. package/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  190. package/node_modules/@types/node/compatibility/index.d.ts +0 -9
  191. package/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  192. package/node_modules/@types/node/dom-events.d.ts +0 -124
  193. package/node_modules/undici-types/file.d.ts +0 -39
  194. package/node_modules/undici-types/filereader.d.ts +0 -54
  195. package/node_modules/uuid/dist/cjs/index.d.ts +0 -15
  196. package/node_modules/uuid/dist/cjs/index.js +0 -31
  197. package/node_modules/uuid/dist/cjs/max.d.ts +0 -2
  198. package/node_modules/uuid/dist/cjs/max.js +0 -3
  199. package/node_modules/uuid/dist/cjs/md5.d.ts +0 -4
  200. package/node_modules/uuid/dist/cjs/md5.js +0 -13
  201. package/node_modules/uuid/dist/cjs/native.d.ts +0 -6
  202. package/node_modules/uuid/dist/cjs/native.js +0 -4
  203. package/node_modules/uuid/dist/cjs/nil.d.ts +0 -2
  204. package/node_modules/uuid/dist/cjs/nil.js +0 -3
  205. package/node_modules/uuid/dist/cjs/package.json +0 -1
  206. package/node_modules/uuid/dist/cjs/parse.d.ts +0 -2
  207. package/node_modules/uuid/dist/cjs/parse.js +0 -11
  208. package/node_modules/uuid/dist/cjs/regex.d.ts +0 -2
  209. package/node_modules/uuid/dist/cjs/regex.js +0 -3
  210. package/node_modules/uuid/dist/cjs/rng.d.ts +0 -1
  211. package/node_modules/uuid/dist/cjs/rng.js +0 -13
  212. package/node_modules/uuid/dist/cjs/sha1.d.ts +0 -4
  213. package/node_modules/uuid/dist/cjs/sha1.js +0 -13
  214. package/node_modules/uuid/dist/cjs/stringify.d.ts +0 -3
  215. package/node_modules/uuid/dist/cjs/stringify.js +0 -39
  216. package/node_modules/uuid/dist/cjs/types.d.ts +0 -21
  217. package/node_modules/uuid/dist/cjs/types.js +0 -2
  218. package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +0 -1
  219. package/node_modules/uuid/dist/cjs/uuid-bin.js +0 -72
  220. package/node_modules/uuid/dist/cjs/v1.d.ts +0 -11
  221. package/node_modules/uuid/dist/cjs/v1.js +0 -87
  222. package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +0 -2
  223. package/node_modules/uuid/dist/cjs/v1ToV6.js +0 -13
  224. package/node_modules/uuid/dist/cjs/v3.d.ts +0 -9
  225. package/node_modules/uuid/dist/cjs/v3.js +0 -14
  226. package/node_modules/uuid/dist/cjs/v35.d.ts +0 -7
  227. package/node_modules/uuid/dist/cjs/v35.js +0 -41
  228. package/node_modules/uuid/dist/cjs/v4.d.ts +0 -4
  229. package/node_modules/uuid/dist/cjs/v4.js +0 -29
  230. package/node_modules/uuid/dist/cjs/v5.d.ts +0 -9
  231. package/node_modules/uuid/dist/cjs/v5.js +0 -14
  232. package/node_modules/uuid/dist/cjs/v6.d.ts +0 -4
  233. package/node_modules/uuid/dist/cjs/v6.js +0 -19
  234. package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +0 -2
  235. package/node_modules/uuid/dist/cjs/v6ToV1.js +0 -13
  236. package/node_modules/uuid/dist/cjs/v7.d.ts +0 -9
  237. package/node_modules/uuid/dist/cjs/v7.js +0 -69
  238. package/node_modules/uuid/dist/cjs/validate.d.ts +0 -2
  239. package/node_modules/uuid/dist/cjs/validate.js +0 -7
  240. package/node_modules/uuid/dist/cjs/version.d.ts +0 -2
  241. package/node_modules/uuid/dist/cjs/version.js +0 -10
  242. package/node_modules/uuid/dist/cjs-browser/index.js +0 -31
  243. package/node_modules/uuid/dist/cjs-browser/max.js +0 -3
  244. package/node_modules/uuid/dist/cjs-browser/md5.js +0 -137
  245. package/node_modules/uuid/dist/cjs-browser/native.js +0 -4
  246. package/node_modules/uuid/dist/cjs-browser/nil.js +0 -3
  247. package/node_modules/uuid/dist/cjs-browser/package.json +0 -1
  248. package/node_modules/uuid/dist/cjs-browser/parse.js +0 -11
  249. package/node_modules/uuid/dist/cjs-browser/regex.js +0 -3
  250. package/node_modules/uuid/dist/cjs-browser/rng.js +0 -14
  251. package/node_modules/uuid/dist/cjs-browser/sha1.js +0 -72
  252. package/node_modules/uuid/dist/cjs-browser/stringify.js +0 -39
  253. package/node_modules/uuid/dist/cjs-browser/types.js +0 -2
  254. package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +0 -72
  255. package/node_modules/uuid/dist/cjs-browser/v1.js +0 -87
  256. package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +0 -13
  257. package/node_modules/uuid/dist/cjs-browser/v3.js +0 -14
  258. package/node_modules/uuid/dist/cjs-browser/v35.js +0 -41
  259. package/node_modules/uuid/dist/cjs-browser/v4.js +0 -29
  260. package/node_modules/uuid/dist/cjs-browser/v5.js +0 -14
  261. package/node_modules/uuid/dist/cjs-browser/v6.js +0 -19
  262. package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +0 -13
  263. package/node_modules/uuid/dist/cjs-browser/v7.js +0 -69
  264. package/node_modules/uuid/dist/cjs-browser/validate.js +0 -7
  265. package/node_modules/uuid/dist/cjs-browser/version.js +0 -10
  266. package/node_modules/uuid/dist/esm/index.d.ts +0 -15
  267. package/node_modules/uuid/dist/esm/max.d.ts +0 -2
  268. package/node_modules/uuid/dist/esm/md5.d.ts +0 -4
  269. package/node_modules/uuid/dist/esm/native.d.ts +0 -6
  270. package/node_modules/uuid/dist/esm/native.js +0 -2
  271. package/node_modules/uuid/dist/esm/nil.d.ts +0 -2
  272. package/node_modules/uuid/dist/esm/parse.d.ts +0 -2
  273. package/node_modules/uuid/dist/esm/regex.d.ts +0 -2
  274. package/node_modules/uuid/dist/esm/rng.d.ts +0 -1
  275. package/node_modules/uuid/dist/esm/sha1.d.ts +0 -4
  276. package/node_modules/uuid/dist/esm/stringify.d.ts +0 -3
  277. package/node_modules/uuid/dist/esm/types.d.ts +0 -21
  278. package/node_modules/uuid/dist/esm/uuid-bin.d.ts +0 -1
  279. package/node_modules/uuid/dist/esm/v1.d.ts +0 -11
  280. package/node_modules/uuid/dist/esm/v1ToV6.d.ts +0 -2
  281. package/node_modules/uuid/dist/esm/v3.d.ts +0 -9
  282. package/node_modules/uuid/dist/esm/v35.d.ts +0 -7
  283. package/node_modules/uuid/dist/esm/v4.d.ts +0 -4
  284. package/node_modules/uuid/dist/esm/v5.d.ts +0 -9
  285. package/node_modules/uuid/dist/esm/v6.d.ts +0 -4
  286. package/node_modules/uuid/dist/esm/v6ToV1.d.ts +0 -2
  287. package/node_modules/uuid/dist/esm/v7.d.ts +0 -9
  288. package/node_modules/uuid/dist/esm/validate.d.ts +0 -2
  289. package/node_modules/uuid/dist/esm/version.d.ts +0 -2
  290. package/node_modules/uuid/dist/esm-browser/index.d.ts +0 -15
  291. package/node_modules/uuid/dist/esm-browser/max.d.ts +0 -2
  292. package/node_modules/uuid/dist/esm-browser/md5.d.ts +0 -2
  293. package/node_modules/uuid/dist/esm-browser/native.d.ts +0 -4
  294. package/node_modules/uuid/dist/esm-browser/nil.d.ts +0 -2
  295. package/node_modules/uuid/dist/esm-browser/parse.d.ts +0 -2
  296. package/node_modules/uuid/dist/esm-browser/regex.d.ts +0 -2
  297. package/node_modules/uuid/dist/esm-browser/rng.d.ts +0 -1
  298. package/node_modules/uuid/dist/esm-browser/sha1.d.ts +0 -2
  299. package/node_modules/uuid/dist/esm-browser/stringify.d.ts +0 -3
  300. package/node_modules/uuid/dist/esm-browser/types.d.ts +0 -21
  301. package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +0 -1
  302. package/node_modules/uuid/dist/esm-browser/v1.d.ts +0 -11
  303. package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +0 -2
  304. package/node_modules/uuid/dist/esm-browser/v3.d.ts +0 -9
  305. package/node_modules/uuid/dist/esm-browser/v35.d.ts +0 -7
  306. package/node_modules/uuid/dist/esm-browser/v4.d.ts +0 -4
  307. package/node_modules/uuid/dist/esm-browser/v5.d.ts +0 -9
  308. package/node_modules/uuid/dist/esm-browser/v6.d.ts +0 -4
  309. package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +0 -2
  310. package/node_modules/uuid/dist/esm-browser/v7.d.ts +0 -9
  311. package/node_modules/uuid/dist/esm-browser/validate.d.ts +0 -2
  312. package/node_modules/uuid/dist/esm-browser/version.d.ts +0 -2
  313. /package/node_modules/uuid/dist/{cjs-browser/index.d.ts → index.d.ts} +0 -0
  314. /package/node_modules/uuid/dist/{esm/index.js → index.js} +0 -0
  315. /package/node_modules/uuid/dist/{cjs-browser/max.d.ts → max.d.ts} +0 -0
  316. /package/node_modules/uuid/dist/{esm/max.js → max.js} +0 -0
  317. /package/node_modules/uuid/dist/{cjs-browser/md5.d.ts → md5.d.ts} +0 -0
  318. /package/node_modules/uuid/dist/{esm-browser/md5.js → md5.js} +0 -0
  319. /package/node_modules/uuid/dist/{cjs-browser/native.d.ts → native.d.ts} +0 -0
  320. /package/node_modules/uuid/dist/{esm-browser/native.js → native.js} +0 -0
  321. /package/node_modules/uuid/dist/{cjs-browser/nil.d.ts → nil.d.ts} +0 -0
  322. /package/node_modules/uuid/dist/{esm/nil.js → nil.js} +0 -0
  323. /package/node_modules/uuid/dist/{cjs-browser/parse.d.ts → parse.d.ts} +0 -0
  324. /package/node_modules/uuid/dist/{esm/parse.js → parse.js} +0 -0
  325. /package/node_modules/uuid/dist/{cjs-browser/regex.d.ts → regex.d.ts} +0 -0
  326. /package/node_modules/uuid/dist/{esm/regex.js → regex.js} +0 -0
  327. /package/node_modules/uuid/dist/{cjs-browser/rng.d.ts → rng.d.ts} +0 -0
  328. /package/node_modules/uuid/dist/{esm-browser/rng.js → rng.js} +0 -0
  329. /package/node_modules/uuid/dist/{cjs-browser/sha1.d.ts → sha1.d.ts} +0 -0
  330. /package/node_modules/uuid/dist/{esm-browser/sha1.js → sha1.js} +0 -0
  331. /package/node_modules/uuid/dist/{cjs-browser/stringify.d.ts → stringify.d.ts} +0 -0
  332. /package/node_modules/uuid/dist/{esm/stringify.js → stringify.js} +0 -0
  333. /package/node_modules/uuid/dist/{cjs-browser/types.d.ts → types.d.ts} +0 -0
  334. /package/node_modules/uuid/dist/{esm/types.js → types.js} +0 -0
  335. /package/node_modules/uuid/dist/{cjs-browser/uuid-bin.d.ts → uuid-bin.d.ts} +0 -0
  336. /package/node_modules/uuid/dist/{cjs-browser/v1.d.ts → v1.d.ts} +0 -0
  337. /package/node_modules/uuid/dist/{esm/v1.js → v1.js} +0 -0
  338. /package/node_modules/uuid/dist/{cjs-browser/v1ToV6.d.ts → v1ToV6.d.ts} +0 -0
  339. /package/node_modules/uuid/dist/{esm/v1ToV6.js → v1ToV6.js} +0 -0
  340. /package/node_modules/uuid/dist/{cjs-browser/v3.d.ts → v3.d.ts} +0 -0
  341. /package/node_modules/uuid/dist/{esm/v3.js → v3.js} +0 -0
  342. /package/node_modules/uuid/dist/{cjs-browser/v35.d.ts → v35.d.ts} +0 -0
  343. /package/node_modules/uuid/dist/{esm/v35.js → v35.js} +0 -0
  344. /package/node_modules/uuid/dist/{cjs-browser/v4.d.ts → v4.d.ts} +0 -0
  345. /package/node_modules/uuid/dist/{cjs-browser/v5.d.ts → v5.d.ts} +0 -0
  346. /package/node_modules/uuid/dist/{esm/v5.js → v5.js} +0 -0
  347. /package/node_modules/uuid/dist/{cjs-browser/v6.d.ts → v6.d.ts} +0 -0
  348. /package/node_modules/uuid/dist/{esm/v6.js → v6.js} +0 -0
  349. /package/node_modules/uuid/dist/{cjs-browser/v6ToV1.d.ts → v6ToV1.d.ts} +0 -0
  350. /package/node_modules/uuid/dist/{esm/v6ToV1.js → v6ToV1.js} +0 -0
  351. /package/node_modules/uuid/dist/{cjs-browser/v7.d.ts → v7.d.ts} +0 -0
  352. /package/node_modules/uuid/dist/{esm/v7.js → v7.js} +0 -0
  353. /package/node_modules/uuid/dist/{cjs-browser/validate.d.ts → validate.d.ts} +0 -0
  354. /package/node_modules/uuid/dist/{esm/validate.js → validate.js} +0 -0
  355. /package/node_modules/uuid/dist/{cjs-browser/version.d.ts → version.d.ts} +0 -0
  356. /package/node_modules/uuid/dist/{esm/version.js → version.js} +0 -0
  357. /package/node_modules/uuid/{dist/esm → dist-node}/bin/uuid +0 -0
  358. /package/node_modules/uuid/{dist/esm-browser → dist-node}/index.js +0 -0
  359. /package/node_modules/uuid/{dist/esm-browser → dist-node}/max.js +0 -0
  360. /package/node_modules/uuid/{dist/esm-browser → dist-node}/nil.js +0 -0
  361. /package/node_modules/uuid/{dist/esm-browser → dist-node}/parse.js +0 -0
  362. /package/node_modules/uuid/{dist/esm-browser → dist-node}/regex.js +0 -0
  363. /package/node_modules/uuid/{dist/esm-browser → dist-node}/stringify.js +0 -0
  364. /package/node_modules/uuid/{dist/esm-browser → dist-node}/types.js +0 -0
  365. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v1.js +0 -0
  366. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v1ToV6.js +0 -0
  367. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v3.js +0 -0
  368. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v35.js +0 -0
  369. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v5.js +0 -0
  370. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v6.js +0 -0
  371. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v6ToV1.js +0 -0
  372. /package/node_modules/uuid/{dist/esm-browser → dist-node}/v7.js +0 -0
  373. /package/node_modules/uuid/{dist/esm-browser → dist-node}/validate.js +0 -0
  374. /package/node_modules/uuid/{dist/esm-browser → dist-node}/version.js +0 -0
@@ -0,0 +1,557 @@
1
+ module.exports = function (RED) {
2
+ "use strict";
3
+ const os = require('os');
4
+ const AdmZip = require('adm-zip');
5
+ const axios = require('axios').default;
6
+ const crypto = require("crypto");
7
+ const FormData = require('form-data')
8
+ const { v4: uuidv4 } = require('uuid');
9
+ const uuid = require('uuid');
10
+ const turf = require("@turf/turf");
11
+ const ver = require('./package.json').version;
12
+ const teamList = ["Cyan", "Red", "Green", "Blue", "Magenta", "Yellow", "Orange", "Maroon", "Purple", "Dark Blue", "Dark Green", "Teal", "Brown"];
13
+
14
+ function TakRegistrationNode(n) {
15
+ RED.nodes.createNode(this, n);
16
+ const invalid = "9999999.0";
17
+ this.group = n.group;
18
+ this.role = n.role || "Gateway";
19
+ this.ntype = n.ntype || "a-f-G-I-B";
20
+ this.lat = n.latitude;
21
+ this.lon = n.longitude;
22
+ this.callsign = n.callsign;
23
+ this.repeat = n.repeat;
24
+ this.host = n.dphost;
25
+ this.uuid = "GATEWAY-" + (crypto.createHash('md5').update(Buffer.from(this.id)).digest('hex')).slice(0, 16);
26
+ var node = this;
27
+ node.alt = invalid;
28
+ var globalContext = this.context().global;
29
+ var g = {};
30
+ g[node.uuid] = node.callsign;
31
+ globalContext.set("_takgatewayid", g);
32
+ var gr = {};
33
+ gr[node.callsign] = node.uuid;
34
+ globalContext.set("_takgatewaycs", gr);
35
+ globalContext.set("_takdphost", node.host);
36
+
37
+ if (node.role !== "Gateway") { node.ntype = "a-f-G-U-C" }
38
+
39
+ if (node.repeat > 2147483) {
40
+ node.error("TAK Heartbeat interval is too long.");
41
+ delete node.repeat;
42
+ }
43
+
44
+ var convertWMtoKMLColour = function (colour, opacity) {
45
+ if (opacity == undefined) { opacity = 100; }
46
+ var alfa = parseInt(opacity * 255 / 100).toString(16);
47
+ return alfa + colour;
48
+ };
49
+
50
+ var convertWMtoCOTColour = function (colour, opacity) {
51
+ var c;
52
+ if (opacity != undefined) {
53
+ c = Buffer.from(parseInt(opacity * 255 / 100).toString(16) + colour, "hex");
54
+ }
55
+ else {
56
+ c = Buffer.from("FF" + colour, "hex");
57
+ }
58
+ return c.readInt32BE()
59
+ };
60
+
61
+ var findCentroidOfPoints = function (points) {
62
+ if (points.length < 4) { // pad if necessary (needs 4 points minimum)
63
+ points.push(points[2]);
64
+ points.unshift(points[0]);
65
+ }
66
+ var poly = turf.polygon([points]);
67
+ var centroid = turf.centroid(poly);
68
+ return centroid;
69
+ };
70
+
71
+ var sendIt = function () {
72
+ node.emit("input", {
73
+ time: new Date().toISOString(),
74
+ etime: new Date(Date.now() + (2 * node.repeat)).toISOString(),
75
+ lat: node.lat,
76
+ lon: node.lon,
77
+ alt: node.alt,
78
+ callsign: node.callsign,
79
+ group: node.group,
80
+ role: node.role,
81
+ type: node.ntype,
82
+ heartbeat: true
83
+ });
84
+ };
85
+
86
+ node.repeaterSetup = function () {
87
+ node.repeat = node.repeat * 1000;
88
+ if (RED.settings.verbose) {
89
+ node.log(RED._("inject.repeat", node));
90
+ }
91
+ node.interval_id = setInterval(sendIt, node.repeat);
92
+ };
93
+
94
+ node.repeaterSetup();
95
+ setTimeout(sendIt, 2500);
96
+
97
+ node.on("input", function (msg) {
98
+ if (msg.heartbeat) { // Register gateway and do the heartbeats
99
+ var template = `<event version="2.0" uid="${node.uuid}" type="${msg.type}" how="h-e" time="${msg.time}" start="${msg.time}" stale="${msg.etime}"><point lat="${msg.lat}" lon="${msg.lon}" hae="${msg.alt}" ce="9999999" le="9999999"/><detail><takv device="${os.hostname()}" os="${os.platform()}" platform="NRedTAK" version="${ver}"/><contact endpoint="*:-1:stcp" callsign="${msg.callsign}"/><uid Droid="${msg.callsign}"/><__group name="${msg.group}" role="${msg.role}"/><status battery="99"/><track course="9999999.0" speed="0"/></detail></event>`;
100
+ node.send({ payload: template, topic: "TAKreg" });
101
+ node.status({ fill: "green", shape: "dot", text: node.repeat / 1000 + "s - " + node.callsign });
102
+ return;
103
+ }
104
+ // if it's just a simple filename and buffer payload then make it look like an attachment etc...
105
+ if (msg.hasOwnProperty("filename") && Buffer.isBuffer(msg.payload) && !msg.hasOwnProperty("attachments")) {
106
+ msg.attachments = [{
107
+ filename: msg.filename.split('/').pop(),
108
+ content: msg.payload
109
+ }]
110
+ if (!msg.hasOwnProperty("topic")) { msg.topic = "File - " + msg.filename.split('/').pop(); }
111
+ delete msg.filename;
112
+ delete msg.payload;
113
+ }
114
+ // If there are attachments handle them first. (Datapackage)
115
+ if (msg.hasOwnProperty("attachments") && Array.isArray(msg.attachments) && msg.attachments.length > 0) {
116
+ if (!msg.sendTo) { node.error("Missing 'sendTo' user TAK callsign property.", msg); return; }
117
+ var UUID = uuid.v5(msg.topic, 'd5d4a57d-48fb-58b6-93b8-d9fde658481a');
118
+ var fnam = msg.topic || msg.attachments[0].filename.split('.')[0];
119
+ var fname = fnam + '.zip';
120
+ var da = new Date();
121
+ var dn = da.toISOString().split('-')[2].split('.')[0];
122
+ var calls = msg.from || node.callsign;
123
+ calls = calls + '.' + dn.split('T')[0] + '.' + dn.split('T')[1].split(':').join('');
124
+ var mf = `<MissionPackageManifest version="2"><Configuration>
125
+ <Parameter name="uid" value="${UUID}"/>
126
+ <Parameter name="name" value="${msg.topic}"/>
127
+ <Parameter name="onReceiveImport" value="true"/>
128
+ <Parameter name="callsign" value="${calls}"/>
129
+ </Configuration><Contents>\n`;
130
+ var zip = new AdmZip();
131
+ for (var i = 0; i < msg.attachments.length; i++) {
132
+ var data;
133
+ if (Buffer.isBuffer(msg.attachments[i].content)) {
134
+ data = msg.attachments[i].content;
135
+ }
136
+ else if (Array.isArray(msg.attachments[i].content)) {
137
+ data = Buffer.from(msg.attachments[i].content);
138
+ }
139
+ else if (!Array.isArray(msg.attachments[i].content) && msg.attachments[i].content.hasOwnProperty("data")) {
140
+ data = Buffer.from(msg.attachments[i].content.data);
141
+ }
142
+ var hash = crypto.createHash('md5').update(data).digest('hex');
143
+ var fhash = hash + '/' + msg.attachments[i].filename;
144
+ zip.addFile(fhash, data, "Added by Node-RED");
145
+ mf += `<Content ignore="false" zipEntry="${fhash}"><Parameter name="uid" value="${UUID}"/></Content>\n`;
146
+ }
147
+
148
+ if (msg.hasOwnProperty("lat") && msg.hasOwnProperty("lon")) {
149
+ var timeo = new Date(Date.now() + (1000*60*60*4)).toISOString(); // stale time to 4 hours
150
+ var cott = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
151
+ <event version="2.0" uid="${UUID}" type="b-i-x-i" time="${da.toISOString()}" start="${da.toISOString()}" stale="${timeo}" how="h-g-i-g-o">
152
+ <point lat="${msg.lat}" lon="${msg.lon}" hae="${msg.alt || "9999999.0"}" ce="9999999.0" le="9999999.0" />
153
+ <detail>
154
+ <status readiness="true" />
155
+ <contact callsign="${calls}" />
156
+ <remarks>${msg.remarks || ''}</remarks>
157
+ <color argb="-1" />
158
+ <link uid="${node.uuid}" production_time="${da.toISOString()}" type="a-f-G-U-C" parent_callsign="${msg.from || node.callsign}" relation="p-p" />
159
+ <archive />
160
+ </detail>
161
+ </event>`
162
+
163
+ cott = cott.replace(/>\s+</g, "><");
164
+ var hsh = crypto.createHash('md5').update(cott).digest('hex');
165
+ zip.addFile(hsh+'/'+hsh+'.cot', cott, "Added by Node-RED");
166
+ mf += `<Content ignore="false" zipEntry="${hsh+'/'+hsh+'.cot'}"><Parameter name="uid" value="${UUID}"/></Content>\n`;
167
+ }
168
+
169
+ mf += `</Contents></MissionPackageManifest>`;
170
+ mf = mf.replace(/>\s+</g, "><");
171
+ zip.addFile('MANIFEST/manifest.xml', Buffer.from(mf, 'utf8'), msg.topic);
172
+ var zipbuff = zip.toBuffer();
173
+
174
+ msg = {
175
+ from: msg.from || node.callsign || "Anonymous",
176
+ sendTo: msg.sendTo,
177
+ lat: msg.lat || node.lat || 0,
178
+ lon: msg.lon || node.lon || 0,
179
+ assetfile: fname,
180
+ len: zipbuff.length,
181
+ uid: node.uuid,
182
+ hash: crypto.createHash('sha256').update(zipbuff).digest('hex')
183
+ }
184
+
185
+ let formData = new FormData();
186
+ const opts = { filename: fname, contentType: 'application/x-zip-compressed' };
187
+ formData.append('assetfile', zipbuff, opts);
188
+
189
+ const url = encodeURI(node.host + '/Marti/sync/missionupload?hash=' + msg.hash + '&filename=' + fname + '&creatorUid=' + node.uuid);
190
+ axios({
191
+ method: 'post',
192
+ url: url,
193
+ headers: formData.getHeaders(),
194
+ data: formData
195
+ })
196
+ .then(function (response) {
197
+ const urlp = encodeURI(node.host + '/Marti/api/sync/metadata/' + msg.hash + '/tool');
198
+ var priv = (msg.sendTo === "public") ? "public" : "private";
199
+ axios({
200
+ method: 'put',
201
+ url: urlp,
202
+ data: priv
203
+ })
204
+ .then(function (response) {
205
+ if (priv === "private") {
206
+ const start = new Date().toISOString();
207
+ const stale = new Date(new Date().getTime() + (10000)).toISOString();
208
+
209
+ var m = `<event version="2.0" uid="${uuidv4()}" type="b-f-t-r" how="h-e" time="${start}" start="${start}" stale="${stale}">
210
+ <point lat="${msg.lat}" lon="${msg.lon}" hae="${msg.alt || 9999999.0}" ce="9999999.0" le="9999999.0" />
211
+ <detail>
212
+ <fileshare filename="${fname}" senderUrl="${node.host}/Marti/sync/content?hash=${msg.hash}" sizeInBytes="${msg.len}" sha256="${msg.hash}" senderUid="${msg.uid}" senderCallsign="${msg.from}" name="${fnam}" />`
213
+ if (msg.sendTo !== "broadcast") {
214
+ var t = msg.sendTo;
215
+ if (!Array.isArray(t)) { t = [t]; }
216
+ m += '<marti>' + t.map(v => '<dest callsign="' + v + '"/>') + '</marti>';
217
+ }
218
+ m += '</detail></event>';
219
+ node.log("DP: " + node.host + "/Marti/sync/content?hash=" + msg.hash);
220
+ msg.payload = m.replace(/>\s+</g, "><");
221
+ msg.topic = "b-f-t-r";
222
+ node.send(msg);
223
+ }
224
+ })
225
+ .catch(function (error) {
226
+ node.error(error.message, error);
227
+ })
228
+ })
229
+ .catch(function (error) {
230
+ node.error(error.message, error);
231
+ })
232
+ }
233
+ // Otherwise if it's a string maybe it's raw cot xml - or NMEA from GPS - or maybe a simple chat message
234
+ else if (typeof msg.payload === "string") {
235
+ if (msg.payload.trim().startsWith('<') && msg.payload.trim().endsWith('>')) { // Assume it's proper XML event so pass straight through
236
+ msg.topic = msg.payload.split('type="')[1].split('"')[0];
237
+ node.send(msg);
238
+ }
239
+ else if (msg.payload.trim().startsWith('$GPGGA')) { // maybe it's an NMEA string
240
+ // console.log("It's NMEA",msg.payload);
241
+ var nm = msg.payload.trim().split(',');
242
+ if (nm[0] === '$GPGGA' && nm[6] > 0) {
243
+ const la = parseInt(nm[2].substr(0, 2)) + parseFloat(nm[2].substr(2)) / 60;
244
+ node.lat = ((nm[3] === "N") ? la : -la).toFixed(6);
245
+ const lo = parseInt(nm[4].substr(0, 3)) + parseFloat(nm[4].substr(3)) / 60;
246
+ node.lon = ((nm[5] === "E") ? lo : -lo).toFixed(6);
247
+ node.alt = nm[9];
248
+ }
249
+ }
250
+ else if (msg.hasOwnProperty("sendTo")) {
251
+ // simple text payload and no attachments so guess it's a chat message...
252
+ // node.log("Geochat to " + msg.sendTo);
253
+ if (!Array.isArray(msg.sendTo)) { msg.sendTo = msg.sendTo.split(','); }
254
+ const start = new Date().toISOString();
255
+ const stale = new Date(new Date().getTime() + (10000)).toISOString();
256
+ const mid = uuidv4();
257
+ const type = "a-f-G-I-B";
258
+ var par = '';
259
+
260
+ for (var t = 0; t < msg.sendTo.length; t++) {
261
+ var m = RED.util.cloneMessage(msg);
262
+ const to = m.sendTo[t];
263
+ m.sendTo = to;
264
+ const toid = globalContext.get("_takgatewaycs")[m.sendTo] || m.sendTo;
265
+ var ma = `<marti><dest callsign="${m.sendTo}"/></marti>`;
266
+ if (m.sendTo === "broadcast") { m.sendTo = "All Chat Rooms"; }
267
+ if (m.sendTo === "All Chat Rooms") { ma = ""; }
268
+ if (teamList.includes(m.sendTo)) { par = 'parent="TeamGroups"'; }
269
+
270
+ var xm = `<event version="2.0" uid="GeoChat.${node.uuid}.${toid}.${mid}" type="b-t-f" time="${start}" start="${start}" stale="${stale}" how="h-g-i-g-o">
271
+ <point lat="${node.lat}" lon="${node.lon}" hae="9999999.0" ce="9999999.0" le="9999999.0"/>
272
+ <detail>
273
+ <__chat ${par} groupOwner="false" messageId="${mid}" chatroom="${m.sendTo}" id="${toid}" senderCallsign="${node.callsign}">
274
+ <chatgrp uid0="${node.uuid}" uid1="${toid}" id="${toid}"/>
275
+ </__chat>
276
+ <link uid="${node.uuid}" type="${type}" relation="p-p"/>
277
+ <remarks source="BAO.F.ATAK.${node.uuid}" to="${toid}" time="${start}">${msg.payload}</remarks>
278
+ ${ma}
279
+ <track speed="0.0" course="0.0"/>
280
+ </detail>
281
+ </event>`;
282
+ // console.log(xm);
283
+ m.payload = xm.replace(/>\s+</g, "><");
284
+ m.topic = "b-t-f";
285
+ node.send(m);
286
+ }
287
+ }
288
+ }
289
+ // Just has lat, lon (and alt) but no name - assume it's our local position we're updating
290
+ else if (typeof msg.payload === "object" && !msg.payload.hasOwnProperty("name") && msg.payload.hasOwnProperty("lat") && msg.payload.hasOwnProperty("lon")) {
291
+ node.lat = msg.payload.lat;
292
+ node.lon = msg.payload.lon;
293
+ if (msg.payload.hasOwnProperty("altft")) { node.alt = parseInt(msg.payload.alt * 0.3048); }
294
+ if (msg.payload.hasOwnProperty("alt")) { node.alt = parseInt(msg.payload.alt); }
295
+ }
296
+ // Handle a generic worldmap style object
297
+ else if (typeof msg.payload === "object" && msg.payload.hasOwnProperty("name")) {
298
+ var shapeXML = ``;
299
+ var linkXML = ``;
300
+ var userIcon = ``;
301
+ var d = new Date();
302
+ var st = d.toISOString();
303
+ var ttl = ((msg.payload.ttl || 0) * 1000) || 60000;
304
+ var tag = msg.payload.remarks || "";
305
+ if (msg.payload.tag) { tag += " " + msg.payload.tag }
306
+ if (msg.payload.layer) { tag += " #" + msg.payload.layer }
307
+ else { tag += " #Worldmap"; }
308
+ if (!msg.payload?.alt && msg.payload?.altft) { msg.payload.alt = msg.payload.altft * 0.3048}
309
+
310
+ // Handle simple markers
311
+ if (msg.payload.hasOwnProperty("lat") && msg.payload.hasOwnProperty("lon")) {
312
+ var type = msg.payload.cottype || "a-u-g-u";
313
+ if (!msg.payload.cottype && !msg.payload.SIDC && msg.payload.aistype) {
314
+ msg.payload.SIDC = ais2sidc(msg.payload.aistype);
315
+ }
316
+ if (!msg.payload.cottype && msg.payload.SIDC) {
317
+ var s = msg.payload.SIDC.split('-')[0].toUpperCase();
318
+ var t = s.substr(2,1);
319
+ var r = s.substr(4);
320
+ s = s.substr(1,1).toLowerCase();
321
+ type = 'a-' + s + '-' + t + '-' + r.split('').join('-');
322
+ userIcon = '<__milsym id="'+msg.payload.SIDC+'"/>';
323
+ }
324
+ if (msg.payload.hasOwnProperty("icon")) {
325
+ if (msg.payload.icon === 'fa-circle fa-fw') {
326
+ type = 'b-m-p-s-m';
327
+ shapeXML = '<color argb="' + convertWMtoCOTColour(msg.payload.iconColor.replace('#', '')) + '"/>';
328
+ shapeXML = shapeXML + '<usericon iconsetpath="COT_MAPPING_SPOTMAP/b-m-p-s-m/-16711681"/>';
329
+ }
330
+ else {
331
+ userIcon = `<usericon iconsetpath="${msg.payload.icon}"/>`;
332
+ }
333
+ }
334
+ }
335
+
336
+ // for markers that aren't us, then need to add a link tag
337
+ if (msg.payload.hasOwnProperty("name")) {
338
+ linkXML = `<link uid="${node.uuid}" production_time="${st}" type="${node.ntype}" parent_callsign="${node.callsign}" relation="p-p"/>`;
339
+ }
340
+
341
+ // Handle Worldmap drawing shapes
342
+ if (msg.payload.hasOwnProperty("action") && msg.payload.action === "draw") {
343
+ ttl = 24 * 60 * 60 * 1000; /// set TTL to 1 day for shapes...
344
+
345
+ var shape = {
346
+ "strokeColor": (msg.payload.options.color || "910000").replace('#', ''),
347
+ "fillColor": (msg.payload.options.color || "910000").replace('#', ''),
348
+ "fillOpacity": msg.payload.options.opacity * 100 || 50,
349
+ "strokeWeight": msg.payload.options.weight || 2
350
+ };
351
+
352
+ if ("radius" in msg.payload) {
353
+ // Ellipse
354
+ shape.type = "ellipse";
355
+ shape.radius = {
356
+ "major": msg.payload.radius,
357
+ "minor": msg.payload.radius
358
+ };
359
+ }
360
+ else if ("line" in msg.payload) {
361
+ // Line
362
+ delete shape.fillColor;
363
+ delete shape.fillOpacity;
364
+ shape.type = "line";
365
+ shape.points = [];
366
+ var lineCentPoints = [];
367
+
368
+ for (var p = 0; p < msg.payload.line.length; p++) {
369
+ shape.points.push({
370
+ lat: msg.payload.line[p].lat,
371
+ lon: msg.payload.line[p].lng
372
+ });
373
+ lineCentPoints.push([msg.payload.line[p].lat, msg.payload.line[p].lng]);
374
+ }
375
+ // Find the Centroid of the object.
376
+ lineCentPoints.push([msg.payload.line[0].lat, msg.payload.line[0].lng]);
377
+ var lineCent = findCentroidOfPoints(lineCentPoints);
378
+ msg.payload.lat = lineCent.geometry.coordinates[0];
379
+ msg.payload.lon = lineCent.geometry.coordinates[1];
380
+ }
381
+ else if ("area" in msg.payload) {
382
+ // Polygon / Rectangle
383
+ shape.type = "poly";
384
+ shape.points = [];
385
+ var polyCentPoints = [];
386
+ for (var a = 0; a < msg.payload.area.length; a++) {
387
+ shape.points.push({
388
+ lat: msg.payload.area[a].lat,
389
+ lon: msg.payload.area[a].lng
390
+ });
391
+ polyCentPoints.push([msg.payload.area[a].lat, msg.payload.area[a].lng]);
392
+ }
393
+ shape.points.push({
394
+ lat: msg.payload.area[0].lat,
395
+ lon: msg.payload.area[0].lng
396
+ });
397
+ // Find the Centroid of the object.
398
+ polyCentPoints.push([msg.payload.area[0].lat, msg.payload.area[0].lng]);
399
+ var polyCent = findCentroidOfPoints(polyCentPoints);
400
+ msg.payload.lat = polyCent.geometry.coordinates[0];
401
+ msg.payload.lon = polyCent.geometry.coordinates[1];
402
+ }
403
+ // console.log("SHAPE",shape)
404
+ if (shape.type === 'ellipse') {
405
+ type = "u-d-c-c";
406
+
407
+ shapeXML = `
408
+ <shape>
409
+ <ellipse major="${shape.radius.major}" minor="${shape.radius.minor}" angle="360" />
410
+ <link relation="p-c" uid="${msg.payload.name}.Style" type="b-x-KmlStyle">
411
+ <Style>
412
+ <LineStyle>
413
+ <color>${convertWMtoKMLColour(shape.strokeColor)}</color>
414
+ <width>${shape.weight || 2.0}</width>
415
+ </LineStyle>
416
+ <PolyStyle>
417
+ <color>${convertWMtoKMLColour(shape.fillColor, shape.fillOpacity)}</color>
418
+ </PolyStyle>
419
+ </Style>
420
+ </link>
421
+ </shape>`;
422
+ }
423
+ else if (shape.type === 'line' || shape.type === 'poly') {
424
+ var linkArrayXML = "";
425
+
426
+ for (var l = 0; l < shape.points.length; l++) {
427
+ // linkArrayXML += `<link uid="${msg.payload.name}.l" point="${shape.points[l].lat},${shape.points[l].lon},${shape.points[l].alt || invalid}"/>\n`;
428
+ linkArrayXML += `<link point="${shape.points[l].lat},${shape.points[l].lon}"/>\n`;
429
+ }
430
+
431
+ shapeXML = `
432
+ ${linkArrayXML}
433
+ <strokeColor value="${convertWMtoCOTColour(shape.strokeColor)}"/>
434
+ <strokeWeight value="${shape.weight || 2.0}"/>
435
+ <strokeStyle value="solid"/>
436
+ <color value="${convertWMtoCOTColour(shape.strokeColor)}"/>
437
+ <labels_on value="false"/>`;
438
+
439
+ if (shape.type === 'line') {
440
+ type = "u-d-f";
441
+ }
442
+
443
+ if (shape.type === 'poly') {
444
+ shapeXML += `<fillColor value="${convertWMtoCOTColour(shape.fillColor, shape.fillOpacity)}"/>`;
445
+ type = "u-d-f";
446
+ if (shape.points.length === 4) {
447
+ type = "u-d-r";
448
+ }
449
+ }
450
+ }
451
+ }
452
+
453
+ var et = Date.now() + ttl;
454
+ et = (new Date(et)).toISOString();
455
+
456
+ msg.payload = `<event version="2.0" uid="NRC-${msg.payload.name}" type="${type}" time="${st}" start="${st}" stale="${et}" how="h-e">
457
+ <point lat="${msg.payload.lat || 0}" lon="${msg.payload.lon || 0}" hae="${parseInt(msg.payload.alt || invalid)}" le="9999999.0" ce="9999999.0"/>
458
+ <detail>
459
+ <takv device="${os.hostname()}" os="${os.platform()}" platform="NodeRedTAK" version="${ver}"/>
460
+ <track course="${msg.payload.bearing || 9999999.0}" speed="${parseInt(msg.payload.speed) || 0}"/>
461
+ <contact callsign="${msg.payload.name}"/>
462
+ ${linkXML}
463
+ <remarks source="${node.callsign}">${tag}</remarks>
464
+ ${userIcon}
465
+ ${shapeXML}
466
+ </detail>
467
+ </event>`
468
+ msg.payload = msg.payload.replace(/>\s+</g, "><");
469
+ msg.topic = type;
470
+ node.send(msg);
471
+ }
472
+
473
+ // Maybe a simple event json update (eg from an ingest - tweak and send back)
474
+ // Note this is not 100% reverse of the ingest... but seems to work mostly...
475
+ else if (typeof msg.payload === "object" && msg.payload.hasOwnProperty("event")) {
476
+ const ev = msg.payload.event;
477
+ msg.topic = ev.type;
478
+ msg.payload = `<event version="${ev.version}" uid="${ev.uid}" type="${ev.type}" time="${ev.time}" start="${ev.start}" stale="${ev.stale}" how="${ev.how}">
479
+ <point lat="${ev.point.lat || 0}" lon="${ev.point.lon || 0}" hae="${ev.detail?.height?.value || ev.point.hae || 9999999.0}" le="${ev.point.le}" ce="${ev.point.ce}"/>
480
+ <detail>
481
+ <takv device="${os.hostname()}" os="${os.platform()}" platform="NRedTAK" version="${ver}"/>`
482
+ if (ev.detail?.track) {
483
+ msg.payload += `<track speed="${ev.detail.track.speed}" course="${ev.detail.track.course}"/>`;
484
+ }
485
+ if (ev.detail?.color) {
486
+ msg.payload += `<color argb="${ev.detail.color.argb}"/>`;
487
+ }
488
+ msg.payload += `<contact callsign="${ev.detail?.contact?.callsign}"/>
489
+ <remarks source="${node.callsign}">${msg.remarks || ev.detail?.remarks}</remarks>
490
+ </detail>
491
+ </event>`
492
+ msg.payload = msg.payload.replace(/>\s+</g, "><");
493
+ node.send(msg);
494
+ }
495
+
496
+ // Drop anything we don't handle yet.
497
+ else {
498
+ node.log("Dropped: " + JSON.stringify(msg.payload));
499
+ }
500
+ });
501
+
502
+ node.on("close", function() {
503
+ // var tim = new Date().toISOString();
504
+ // var template = `<?xml version="1.0" encoding="utf-8" standalone="yes"?><event version="2.0" uid="${node.uuid}" type="t-x-d-d" how="h-g-i-g-o" time="${tim}" start="${tim}" stale="${tim}"><detail><link uid="${node.uuid}" relation="p-p" type="a-f-G-I-B" /></detail><point le="9999999.0" ce="9999999.0" hae="9999999.0" lon="0" lat="0" /></event>"`;
505
+ // node.send({payload:template}); // This never happens in time so not useful
506
+ clearInterval(this.interval_id);
507
+ if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
508
+ });
509
+ }
510
+
511
+ var aisToSidc1 = {
512
+ 4: "SFSPXA------",
513
+ 5: "SFSPXM------",
514
+ 6: "SFSPXMP-----",
515
+ 7: "SFSPXMC-----",
516
+ 8: "SFSPXMO-----",
517
+ 9: "SFSPXM------"
518
+ }
519
+
520
+ var aisToSidc2 = {
521
+ 30: "SFSPXF------",
522
+ 31: "SFSPXMTO----",
523
+ 32: "SFSPXMTO--NS",
524
+ 33: "SFSPXFDR----",
525
+ 34: "SFUPND------",
526
+ 35: "SFSP--------",
527
+ 36: "SFSPXR------",
528
+ 37: "SFSPXA------",
529
+ 40: "SFSPXA------", //-
530
+ 50: "SFSPXM------", //-
531
+ 52: "SFSPXMTU----",
532
+ 53: "SFSPNS------",
533
+ 55: "SFSPXL------",
534
+ 58: "SFSPNM------",
535
+ 60: "SFSPXMP-----", //-
536
+ 70: "SFSPXMC-----", //-
537
+ 71: "SFSPXMH-----",
538
+ 72: "SFSPXMH-----",
539
+ 73: "SFSPXMH-----",
540
+ 74: "SFSPXMH-----",
541
+ 80: "SFSPXMO-----", //-
542
+ 90: "SFSPXM------", //-
543
+ }
544
+
545
+ var ais2sidc = function (aisType) {
546
+ //aisType = Number(aisType);
547
+ if (aisType >= 100) { return "GNMPOHTH----"; }
548
+ aisType = aisToSidc2[aisType];
549
+ if (aisType && isNaN(aisType)) { return aisType; }
550
+ aisType = parseInt(aisType / 10);
551
+ aisType = aisToSidc1[aisType];
552
+ if (aisType && isNaN(aisType)) { return aisType; }
553
+ return "SFSPXM------";
554
+ }
555
+
556
+ RED.nodes.registerType("tak registration", TakRegistrationNode);
557
+ };
@@ -95,14 +95,14 @@ module.exports = function (RED) {
95
95
  setTimeout(sendIt, 2500);
96
96
 
97
97
  node.on("input", function (msg) {
98
- if (msg.heartbeat) { // Register gateway and do the heartbeats
98
+ if (msg?.heartbeat) { // Register gateway and do the heartbeats
99
99
  var template = `<event version="2.0" uid="${node.uuid}" type="${msg.type}" how="h-e" time="${msg.time}" start="${msg.time}" stale="${msg.etime}"><point lat="${msg.lat}" lon="${msg.lon}" hae="${msg.alt}" ce="9999999" le="9999999"/><detail><takv device="${os.hostname()}" os="${os.platform()}" platform="NRedTAK" version="${ver}"/><contact endpoint="*:-1:stcp" callsign="${msg.callsign}"/><uid Droid="${msg.callsign}"/><__group name="${msg.group}" role="${msg.role}"/><status battery="99"/><track course="9999999.0" speed="0"/></detail></event>`;
100
100
  node.send({ payload: template, topic: "TAKreg" });
101
101
  node.status({ fill: "green", shape: "dot", text: node.repeat / 1000 + "s - " + node.callsign });
102
102
  return;
103
103
  }
104
104
  // if it's just a simple filename and buffer payload then make it look like an attachment etc...
105
- if (msg.hasOwnProperty("filename") && Buffer.isBuffer(msg.payload) && !msg.hasOwnProperty("attachments")) {
105
+ if (msg?.payload && msg.hasOwnProperty("filename") && Buffer.isBuffer(msg.payload) && !msg.hasOwnProperty("attachments")) {
106
106
  msg.attachments = [{
107
107
  filename: msg.filename.split('/').pop(),
108
108
  content: msg.payload
@@ -112,7 +112,7 @@ module.exports = function (RED) {
112
112
  delete msg.payload;
113
113
  }
114
114
  // If there are attachments handle them first. (Datapackage)
115
- if (msg.hasOwnProperty("attachments") && Array.isArray(msg.attachments) && msg.attachments.length > 0) {
115
+ if (msg?.attachments && Array.isArray(msg.attachments) && msg.attachments.length > 0) {
116
116
  if (!msg.sendTo) { node.error("Missing 'sendTo' user TAK callsign property.", msg); return; }
117
117
  var UUID = uuid.v5(msg.topic, 'd5d4a57d-48fb-58b6-93b8-d9fde658481a');
118
118
  var fnam = msg.topic || msg.attachments[0].filename.split('.')[0];
@@ -231,7 +231,7 @@ module.exports = function (RED) {
231
231
  })
232
232
  }
233
233
  // Otherwise if it's a string maybe it's raw cot xml - or NMEA from GPS - or maybe a simple chat message
234
- else if (typeof msg.payload === "string") {
234
+ else if (msg?.payload && typeof msg.payload === "string") {
235
235
  if (msg.payload.trim().startsWith('<') && msg.payload.trim().endsWith('>')) { // Assume it's proper XML event so pass straight through
236
236
  msg.topic = msg.payload.split('type="')[1].split('"')[0];
237
237
  node.send(msg);
@@ -287,14 +287,14 @@ module.exports = function (RED) {
287
287
  }
288
288
  }
289
289
  // Just has lat, lon (and alt) but no name - assume it's our local position we're updating
290
- else if (typeof msg.payload === "object" && !msg.payload.hasOwnProperty("name") && msg.payload.hasOwnProperty("lat") && msg.payload.hasOwnProperty("lon")) {
290
+ else if (msg?.payload && typeof msg.payload === "object" && !msg.payload.hasOwnProperty("name") && msg.payload.hasOwnProperty("lat") && msg.payload.hasOwnProperty("lon")) {
291
291
  node.lat = msg.payload.lat;
292
292
  node.lon = msg.payload.lon;
293
293
  if (msg.payload.hasOwnProperty("altft")) { node.alt = parseInt(msg.payload.alt * 0.3048); }
294
294
  if (msg.payload.hasOwnProperty("alt")) { node.alt = parseInt(msg.payload.alt); }
295
295
  }
296
296
  // Handle a generic worldmap style object
297
- else if (typeof msg.payload === "object" && msg.payload.hasOwnProperty("name")) {
297
+ else if (msg?.payload && typeof msg.payload === "object" && msg.payload.hasOwnProperty("name")) {
298
298
  var shapeXML = ``;
299
299
  var linkXML = ``;
300
300
  var userIcon = ``;
@@ -314,10 +314,12 @@ module.exports = function (RED) {
314
314
  msg.payload.SIDC = ais2sidc(msg.payload.aistype);
315
315
  }
316
316
  if (!msg.payload.cottype && msg.payload.SIDC) {
317
- var s = msg.payload.SIDC.split('-')[0].toLowerCase();
318
- if (s.startsWith('s')) {
319
- type = s.split('').join('-').replace('s-', 'a-').replace('-p-', '-');
320
- }
317
+ var s = msg.payload.SIDC.split('-')[0].toUpperCase();
318
+ var t = s.substr(2,1);
319
+ var r = s.substr(4);
320
+ s = s.substr(1,1).toLowerCase();
321
+ type = 'a-' + s + '-' + t + '-' + r.split('').join('-');
322
+ userIcon = '<__milsym id="'+msg.payload.SIDC+'"/>';
321
323
  }
322
324
  if (msg.payload.hasOwnProperty("icon")) {
323
325
  if (msg.payload.icon === 'fa-circle fa-fw') {
@@ -470,7 +472,7 @@ module.exports = function (RED) {
470
472
 
471
473
  // Maybe a simple event json update (eg from an ingest - tweak and send back)
472
474
  // Note this is not 100% reverse of the ingest... but seems to work mostly...
473
- else if (typeof msg.payload === "object" && msg.payload.hasOwnProperty("event")) {
475
+ else if (msg?.payload && typeof msg.payload === "object" && msg.payload.hasOwnProperty("event")) {
474
476
  const ev = msg.payload.event;
475
477
  msg.topic = ev.type;
476
478
  msg.payload = `<event version="${ev.version}" uid="${ev.uid}" type="${ev.type}" time="${ev.time}" start="${ev.start}" stale="${ev.stale}" how="${ev.how}">
@@ -493,7 +495,7 @@ module.exports = function (RED) {
493
495
 
494
496
  // Drop anything we don't handle yet.
495
497
  else {
496
- node.log("Dropped: " + JSON.stringify(msg.payload));
498
+ node.log("Dropped: " + JSON.stringify(msg?.payload || "msg"));
497
499
  }
498
500
  });
499
501