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
@@ -0,0 +1,85 @@
1
+ const { buildOptions} = require("./OptionsBuilder");
2
+ const Xml2JsParser = require("./Xml2JsParser");
3
+
4
+ class XMLParser{
5
+
6
+ constructor(options){
7
+ this.externalEntities = {};
8
+ this.options = buildOptions(options);
9
+ // console.log(this.options)
10
+ }
11
+ /**
12
+ * Parse XML data string to JS object
13
+ * @param {string|Buffer} xmlData
14
+ * @param {boolean|Object} validationOption
15
+ */
16
+ parse(xmlData){
17
+ if(Array.isArray(xmlData) && xmlData.byteLength !== undefined){
18
+ return this.parse(xmlData);
19
+ }else if( xmlData.toString){
20
+ xmlData = xmlData.toString();
21
+ }else{
22
+ throw new Error("XML data is accepted in String or Bytes[] form.")
23
+ }
24
+ // if( validationOption){
25
+ // if(validationOption === true) validationOption = {}; //validate with default options
26
+
27
+ // const result = validator.validate(xmlData, validationOption);
28
+ // if (result !== true) {
29
+ // throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
30
+ // }
31
+ // }
32
+ const parser = new Xml2JsParser(this.options);
33
+ parser.entityParser.addExternalEntities(this.externalEntities);
34
+ return parser.parse(xmlData);
35
+ }
36
+ /**
37
+ * Parse XML data buffer to JS object
38
+ * @param {string|Buffer} xmlData
39
+ * @param {boolean|Object} validationOption
40
+ */
41
+ parseBytesArr(xmlData){
42
+ if(Array.isArray(xmlData) && xmlData.byteLength !== undefined){
43
+ }else{
44
+ throw new Error("XML data is accepted in Bytes[] form.")
45
+ }
46
+ const parser = new Xml2JsParser(this.options);
47
+ parser.entityParser.addExternalEntities(this.externalEntities);
48
+ return parser.parseBytesArr(xmlData);
49
+ }
50
+ /**
51
+ * Parse XML data stream to JS object
52
+ * @param {fs.ReadableStream} xmlDataStream
53
+ */
54
+ parseStream(xmlDataStream){
55
+ if(!isStream(xmlDataStream)) throw new Error("FXP: Invalid stream input");
56
+
57
+ const orderedObjParser = new Xml2JsParser(this.options);
58
+ orderedObjParser.entityParser.addExternalEntities(this.externalEntities);
59
+ return orderedObjParser.parseStream(xmlDataStream);
60
+ }
61
+
62
+ /**
63
+ * Add Entity which is not by default supported by this library
64
+ * @param {string} key
65
+ * @param {string} value
66
+ */
67
+ addEntity(key, value){
68
+ if(value.indexOf("&") !== -1){
69
+ throw new Error("Entity value can't have '&'")
70
+ }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
71
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
72
+ }else if(value === "&"){
73
+ throw new Error("An entity with value '&' is not permitted");
74
+ }else{
75
+ this.externalEntities[key] = value;
76
+ }
77
+ }
78
+ }
79
+
80
+ function isStream(stream){
81
+ if(stream && typeof stream.read === "function" && typeof stream.on === "function" && typeof stream.readableEnded === "boolean") return true;
82
+ return false;
83
+ }
84
+
85
+ module.exports = XMLParser;
@@ -0,0 +1,237 @@
1
+ const StringSource = require("./inputSource/StringSource");
2
+ const BufferSource = require("./inputSource/BufferSource");
3
+ const {readTagExp,readClosingTagName} = require("./XmlPartReader");
4
+ const {readComment, readCdata,readDocType,readPiTag} = require("./XmlSpecialTagsReader");
5
+ const TagPath = require("./TagPath");
6
+ const TagPathMatcher = require("./TagPathMatcher");
7
+ const EntitiesParser = require('./EntitiesParser');
8
+
9
+ //To hold the data of current tag
10
+ //This is usually used to compare jpath expression against current tag
11
+ class TagDetail{
12
+ constructor(name){
13
+ this.name = name;
14
+ this.position = 0;
15
+ // this.attributes = {};
16
+ }
17
+ }
18
+
19
+ class Xml2JsParser {
20
+ constructor(options) {
21
+ this.options = options;
22
+
23
+ this.currentTagDetail = null;
24
+ this.tagTextData = "";
25
+ this.tagsStack = [];
26
+ this.entityParser = new EntitiesParser(options.htmlEntities);
27
+ this.stopNodes = [];
28
+ for (let i = 0; i < this.options.stopNodes.length; i++) {
29
+ this.stopNodes.push(new TagPath(this.options.stopNodes[i]));
30
+ }
31
+ }
32
+
33
+ parse(strData) {
34
+ this.source = new StringSource(strData);
35
+ this.parseXml();
36
+ return this.outputBuilder.getOutput();
37
+ }
38
+ parseBytesArr(data) {
39
+ this.source = new BufferSource(data );
40
+ this.parseXml();
41
+ return this.outputBuilder.getOutput();
42
+ }
43
+
44
+ parseXml() {
45
+ //TODO: Separate TagValueParser as separate class. So no scope issue in node builder class
46
+
47
+ //OutputBuilder should be set in XML Parser
48
+ this.outputBuilder = this.options.OutputBuilder.getInstance(this.options);
49
+ this.root = { root: true};
50
+ this.currentTagDetail = this.root;
51
+
52
+ while(this.source.canRead()){
53
+ let ch = this.source.readCh();
54
+ if (ch === "") break;
55
+
56
+ if(ch === "<"){//tagStart
57
+ let nextChar = this.source.readChAt(0);
58
+ if (nextChar === "" ) throw new Error("Unexpected end of source");
59
+
60
+
61
+ if(nextChar === "!" || nextChar === "?"){
62
+ this.source.updateBufferBoundary();
63
+ //previously collected text should be added to current node
64
+ this.addTextNode();
65
+
66
+ this.readSpecialTag(nextChar);// Read DOCTYPE, comment, CDATA, PI tag
67
+ }else if(nextChar === "/"){
68
+ this.source.updateBufferBoundary();
69
+ this.readClosingTag();
70
+ // console.log(this.source.buffer.length, this.source.readable);
71
+ // console.log(this.tagsStack.length);
72
+ }else{//opening tag
73
+ this.readOpeningTag();
74
+ }
75
+ }else{
76
+ this.tagTextData += ch;
77
+ }
78
+ }//End While loop
79
+ if(this.tagsStack.length > 0 || ( this.tagTextData !== "undefined" && this.tagTextData.trimEnd().length > 0) ) throw new Error("Unexpected data in the end of document");
80
+ }
81
+
82
+ /**
83
+ * read closing paired tag. Set parent tag in scope.
84
+ * skip a node on user's choice
85
+ */
86
+ readClosingTag(){
87
+ const tagName = this.processTagName(readClosingTagName(this.source));
88
+ // console.log(tagName, this.tagsStack.length);
89
+ this.validateClosingTag(tagName);
90
+ // All the text data collected, belongs to current tag.
91
+ if(!this.currentTagDetail.root) this.addTextNode();
92
+ this.outputBuilder.closeTag();
93
+ // Since the tag is closed now, parent tag comes in scope
94
+ this.currentTagDetail = this.tagsStack.pop();
95
+ }
96
+
97
+ validateClosingTag(tagName){
98
+ // This can't be unpaired tag, or a stop tag.
99
+ if(this.isUnpaired(tagName) || this.isStopNode(tagName)) throw new Error(`Unexpected closing tag '${tagName}'`);
100
+ // This must match with last opening tag
101
+ else if(tagName !== this.currentTagDetail.name)
102
+ throw new Error(`Unexpected closing tag '${tagName}' expecting '${this.currentTagDetail.name}'`)
103
+ }
104
+
105
+ /**
106
+ * Read paired, unpaired, self-closing, stop and special tags.
107
+ * Create a new node
108
+ * Push paired tag in stack.
109
+ */
110
+ readOpeningTag(){
111
+ //save previously collected text data to current node
112
+ this.addTextNode();
113
+
114
+ //create new tag
115
+ let tagExp = readTagExp(this, ">" );
116
+
117
+ // process and skip from tagsStack For unpaired tag, self closing tag, and stop node
118
+ const tagDetail = new TagDetail(tagExp.tagName);
119
+ if(this.isUnpaired(tagExp.tagName)) {
120
+ //TODO: this will lead 2 extra stack operation
121
+ this.outputBuilder.addTag(tagDetail);
122
+ this.outputBuilder.closeTag();
123
+ } else if(tagExp.selfClosing){
124
+ this.outputBuilder.addTag(tagDetail);
125
+ this.outputBuilder.closeTag();
126
+ } else if(this.isStopNode(this.currentTagDetail)){
127
+ // TODO: let's user set a stop node boundary detector for complex contents like script tag
128
+ //TODO: pass tag name only to avoid string operations
129
+ const content = source.readUptoCloseTag(`</${tagExp.tagName}`);
130
+ this.outputBuilder.addTag(tagDetail);
131
+ this.outputBuilder.addValue(content);
132
+ this.outputBuilder.closeTag();
133
+ }else{//paired tag
134
+ //set new nested tag in scope.
135
+ this.tagsStack.push(this.currentTagDetail);
136
+ this.outputBuilder.addTag(tagDetail);
137
+ this.currentTagDetail = tagDetail;
138
+ }
139
+ // console.log(tagExp.tagName,this.tagsStack.length);
140
+ // this.options.onClose()
141
+
142
+ }
143
+
144
+ readSpecialTag(startCh){
145
+ if(startCh == "!"){
146
+ let nextChar = this.source.readCh();
147
+ if (nextChar === null || nextChar === undefined) throw new Error("Unexpected ending of the source");
148
+
149
+ if(nextChar === "-"){//comment
150
+ readComment(this);
151
+ }else if(nextChar === "["){//CDATA
152
+ readCdata(this);
153
+ }else if(nextChar === "D"){//DOCTYPE
154
+ readDocType(this);
155
+ }
156
+ }else if(startCh === "?"){
157
+ readPiTag(this);
158
+ }else{
159
+ throw new Error(`Invalid tag '<${startCh}' at ${this.source.line}:${this.source.col}`)
160
+ }
161
+ }
162
+ addTextNode = function() {
163
+ // if(this.currentTagDetail){
164
+ //save text as child node
165
+ // if(this.currentTagDetail.tagname !== '!xml')
166
+ if (this.tagTextData !== undefined && this.tagTextData !== "") { //store previously collected data as textNode
167
+ if(this.tagTextData.trim().length > 0){
168
+ //TODO: shift parsing to output builder
169
+
170
+ this.outputBuilder.addValue(this.replaceEntities(this.tagTextData));
171
+ }
172
+ this.tagTextData = "";
173
+ }
174
+ // }
175
+ }
176
+
177
+ processAttrName(name){
178
+ if(name === "__proto__") name = "#__proto__";
179
+ name = resolveNameSpace(name, this.removeNSPrefix);
180
+ return name;
181
+ }
182
+
183
+ processTagName(name){
184
+ if(name === "__proto__") name = "#__proto__";
185
+ name = resolveNameSpace(name, this.removeNSPrefix);
186
+ return name;
187
+ }
188
+
189
+ /**
190
+ * Generate tags path from tagsStack
191
+ */
192
+ tagsPath(tagName){
193
+ //TODO: return TagPath Object. User can call match method with path
194
+ return "";
195
+ }
196
+
197
+ isUnpaired(tagName){
198
+ return this.options.tags.unpaired.indexOf(tagName) !== -1;
199
+ }
200
+
201
+ /**
202
+ * valid expressions are
203
+ * tag nested
204
+ * * nested
205
+ * tag nested[attribute]
206
+ * tag nested[attribute=""]
207
+ * tag nested[attribute!=""]
208
+ * tag nested:0 //for future
209
+ * @param {string} tagName
210
+ * @returns
211
+ */
212
+ isStopNode(node){
213
+ for (let i = 0; i < this.stopNodes.length; i++) {
214
+ const givenPath = this.stopNodes[i];
215
+ if(givenPath.match(this.tagsStack, node)) return true;
216
+ }
217
+ return false
218
+ }
219
+
220
+ replaceEntities(text){
221
+ //TODO: if option is set then replace entities
222
+ return this.entityParser.parse(text)
223
+ }
224
+ }
225
+
226
+ function resolveNameSpace(name, removeNSPrefix) {
227
+ if (removeNSPrefix) {
228
+ const parts = name.split(':');
229
+ if(parts.length === 2){
230
+ if (parts[0] === 'xmlns') return '';
231
+ else return parts[1];
232
+ }else reportError(`Multiple namespaces ${name}`)
233
+ }
234
+ return name;
235
+ }
236
+
237
+ module.exports = Xml2JsParser;
@@ -0,0 +1,212 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * find paired tag for a stop node
5
+ * @param {string} xmlDoc
6
+ * @param {string} tagName
7
+ * @param {number} i : start index
8
+ */
9
+ function readStopNode(xmlDoc, tagName, i){
10
+ const startIndex = i;
11
+ // Starting at 1 since we already have an open tag
12
+ let openTagCount = 1;
13
+
14
+ for (; i < xmlDoc.length; i++) {
15
+ if( xmlDoc[i] === "<"){
16
+ if (xmlDoc[i+1] === "/") {//close tag
17
+ const closeIndex = findSubStrIndex(xmlDoc, ">", i, `${tagName} is not closed`);
18
+ let closeTagName = xmlDoc.substring(i+2,closeIndex).trim();
19
+ if(closeTagName === tagName){
20
+ openTagCount--;
21
+ if (openTagCount === 0) {
22
+ return {
23
+ tagContent: xmlDoc.substring(startIndex, i),
24
+ i : closeIndex
25
+ }
26
+ }
27
+ }
28
+ i=closeIndex;
29
+ } else if(xmlDoc[i+1] === '?') {
30
+ const closeIndex = findSubStrIndex(xmlDoc, "?>", i+1, "StopNode is not closed.")
31
+ i=closeIndex;
32
+ } else if(xmlDoc.substr(i + 1, 3) === '!--') {
33
+ const closeIndex = findSubStrIndex(xmlDoc, "-->", i+3, "StopNode is not closed.")
34
+ i=closeIndex;
35
+ } else if(xmlDoc.substr(i + 1, 2) === '![') {
36
+ const closeIndex = findSubStrIndex(xmlDoc, "]]>", i, "StopNode is not closed.") - 2;
37
+ i=closeIndex;
38
+ } else {
39
+ const tagData = readTagExp(xmlDoc, i, '>')
40
+
41
+ if (tagData) {
42
+ const openTagName = tagData && tagData.tagName;
43
+ if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
44
+ openTagCount++;
45
+ }
46
+ i=tagData.closeIndex;
47
+ }
48
+ }
49
+ }
50
+ }//end for loop
51
+ }
52
+
53
+ /**
54
+ * Read closing tag name
55
+ * @param {Source} source
56
+ * @returns tag name
57
+ */
58
+ function readClosingTagName(source){
59
+ let text = ""; //temporary data
60
+ while(source.canRead()){
61
+ let ch = source.readCh();
62
+ // if (ch === null || ch === undefined) break;
63
+ // source.updateBuffer();
64
+
65
+ if (ch === ">") return text.trimEnd();
66
+ else text += ch;
67
+ }
68
+ throw new Error(`Unexpected end of source. Reading '${substr}'`);
69
+ }
70
+
71
+ /**
72
+ * Read XML tag and build attributes map
73
+ * This function can be used to read normal tag, pi tag.
74
+ * This function can't be used to read comment, CDATA, DOCTYPE.
75
+ * Eg <tag attr = ' some"' attr= ">" bool>
76
+ * @param {string} xmlDoc
77
+ * @param {number} startIndex starting index
78
+ * @returns tag expression includes tag name & attribute string
79
+ */
80
+ function readTagExp(parser) {
81
+ let inSingleQuotes = false;
82
+ let inDoubleQuotes = false;
83
+ let i;
84
+ let EOE = false;
85
+
86
+ for (i = 0; parser.source.canRead(i); i++) {
87
+ const char = parser.source.readChAt(i);
88
+
89
+ if (char === "'" && !inDoubleQuotes) {
90
+ inSingleQuotes = !inSingleQuotes;
91
+ } else if (char === '"' && !inSingleQuotes) {
92
+ inDoubleQuotes = !inDoubleQuotes;
93
+ } else if (char === '>' && !inSingleQuotes && !inDoubleQuotes) {
94
+ // If not inside quotes, stop reading at '>'
95
+ EOE = true;
96
+ break;
97
+ }
98
+
99
+ }
100
+ if(inSingleQuotes || inDoubleQuotes){
101
+ throw new Error("Invalid attribute expression. Quote is not properly closed");
102
+ }else if(!EOE) throw new Error("Unexpected closing of source. Waiting for '>'");
103
+
104
+
105
+ const exp = parser.source.readStr(i);
106
+ parser.source.updateBufferBoundary(i + 1);
107
+ return buildTagExpObj(exp, parser)
108
+ }
109
+
110
+ function readPiExp(parser) {
111
+ let inSingleQuotes = false;
112
+ let inDoubleQuotes = false;
113
+ let i;
114
+ let EOE = false;
115
+
116
+ for (i = 0; parser.source.canRead(i) ; i++) {
117
+ const currentChar = parser.source.readChAt(i);
118
+ const nextChar = parser.source.readChAt(i+1);
119
+
120
+ if (currentChar === "'" && !inDoubleQuotes) {
121
+ inSingleQuotes = !inSingleQuotes;
122
+ } else if (currentChar === '"' && !inSingleQuotes) {
123
+ inDoubleQuotes = !inDoubleQuotes;
124
+ }
125
+
126
+ if (!inSingleQuotes && !inDoubleQuotes) {
127
+ if (currentChar === '?' && nextChar === '>') {
128
+ EOE = true;
129
+ break; // Exit the loop when '?>' is found
130
+ }
131
+ }
132
+ }
133
+ if(inSingleQuotes || inDoubleQuotes){
134
+ throw new Error("Invalid attribute expression. Quote is not properly closed in PI tag expression");
135
+ }else if(!EOE) throw new Error("Unexpected closing of source. Waiting for '?>'");
136
+
137
+ if(!parser.options.attributes.ignore){
138
+ //TODO: use regex to verify attributes if not set to ignore
139
+ }
140
+
141
+ const exp = parser.source.readStr(i);
142
+ parser.source.updateBufferBoundary(i + 1);
143
+ return buildTagExpObj(exp, parser)
144
+ }
145
+
146
+ function buildTagExpObj(exp, parser){
147
+ const tagExp = {
148
+ tagName: "",
149
+ selfClosing: false
150
+ };
151
+ let attrsExp = "";
152
+
153
+ if(exp[exp.length -1] === "/") tagExp.selfClosing = true;
154
+
155
+ //separate tag name
156
+ let i = 0;
157
+ for (; i < exp.length; i++) {
158
+ const char = exp[i];
159
+ if(char === " "){
160
+ tagExp.tagName = exp.substring(0, i);
161
+ attrsExp = exp.substring(i + 1);
162
+ break;
163
+ }
164
+ }
165
+ //only tag
166
+ if(tagExp.tagName.length === 0 && i === exp.length)tagExp.tagName = exp;
167
+
168
+ tagExp.tagName = tagExp.tagName.trimEnd();
169
+
170
+ if(!parser.options.attributes.ignore && attrsExp.length > 0){
171
+ parseAttributesExp(attrsExp,parser)
172
+ }
173
+
174
+ return tagExp;
175
+ }
176
+
177
+ const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
178
+
179
+ function parseAttributesExp(attrStr, parser) {
180
+ const matches = getAllMatches(attrStr, attrsRegx);
181
+ const len = matches.length; //don't make it inline
182
+ for (let i = 0; i < len; i++) {
183
+ let attrName = parser.processAttrName(matches[i][1]);
184
+ let attrVal = parser.replaceEntities(matches[i][4] || true);
185
+
186
+ parser.outputBuilder.addAttribute(attrName, attrVal);
187
+ }
188
+ }
189
+
190
+
191
+ const getAllMatches = function(string, regex) {
192
+ const matches = [];
193
+ let match = regex.exec(string);
194
+ while (match) {
195
+ const allmatches = [];
196
+ allmatches.startIndex = regex.lastIndex - match[0].length;
197
+ const len = match.length;
198
+ for (let index = 0; index < len; index++) {
199
+ allmatches.push(match[index]);
200
+ }
201
+ matches.push(allmatches);
202
+ match = regex.exec(string);
203
+ }
204
+ return matches;
205
+ };
206
+
207
+ module.exports = {
208
+ readStopNode: readStopNode,
209
+ readClosingTagName: readClosingTagName,
210
+ readTagExp: readTagExp,
211
+ readPiExp: readPiExp,
212
+ }
@@ -0,0 +1,118 @@
1
+ const {readPiExp} = require("./XmlPartReader");
2
+
3
+ function readCdata(parser){
4
+ //<![ are already read till this point
5
+ let str = parser.source.readStr(6); //CDATA[
6
+ parser.source.updateBufferBoundary(6);
7
+
8
+ if(str !== "CDATA[") throw new Error(`Invalid CDATA expression at ${parser.source.line}:${parser.source.cols}`);
9
+
10
+ let text = parser.source.readUpto("]]>");
11
+ parser.outputBuilder.addCdata(text);
12
+ }
13
+ function readPiTag(parser){
14
+ //<? are already read till this point
15
+ let tagExp = readPiExp(parser, "?>");
16
+ if(!tagExp) throw new Error("Invalid Pi Tag expression.");
17
+
18
+ if (tagExp.tagName === "?xml") {//TODO: test if tagName is just xml
19
+ parser.outputBuilder.addDeclaration();
20
+ } else {
21
+ parser.outputBuilder.addPi("?"+tagExp.tagName);
22
+ }
23
+ }
24
+
25
+ function readComment(parser){
26
+ //<!- are already read till this point
27
+ let ch = parser.source.readCh();
28
+ if(ch !== "-") throw new Error(`Invalid comment expression at ${parser.source.line}:${parser.source.cols}`);
29
+
30
+ let text = parser.source.readUpto("-->");
31
+ parser.outputBuilder.addComment(text);
32
+ }
33
+
34
+ const DOCTYPE_tags = {
35
+ "EL":/^EMENT\s+([^\s>]+)\s+(ANY|EMPTY|\(.+\)\s*$)/m,
36
+ "AT":/^TLIST\s+[^\s]+\s+[^\s]+\s+[^\s]+\s+[^\s]+\s+$/m,
37
+ "NO":/^TATION.+$/m
38
+ }
39
+ function readDocType(parser){
40
+ //<!D are already read till this point
41
+ let str = parser.source.readStr(6); //OCTYPE
42
+ parser.source.updateBufferBoundary(6);
43
+
44
+ if(str !== "OCTYPE") throw new Error(`Invalid DOCTYPE expression at ${parser.source.line}:${parser.source.cols}`);
45
+
46
+ let hasBody = false, lastch = "";
47
+
48
+ while(parser.source.canRead()){
49
+ //TODO: use readChAt like used in partReader
50
+ let ch = parser.source.readCh();
51
+ if(hasBody){
52
+ if (ch === '<') { //Determine the tag type
53
+ let str = parser.source.readStr(2);
54
+ parser.source.updateBufferBoundary(2);
55
+ if(str === "EN"){ //ENTITY
56
+ let str = parser.source.readStr(4);
57
+ parser.source.updateBufferBoundary(4);
58
+ if(str !== "TITY") throw new Error("Invalid DOCTYPE ENTITY expression");
59
+
60
+ registerEntity(parser);
61
+ }else if(str === "!-") {//comment
62
+ readComment(parser);
63
+ }else{ //ELEMENT, ATTLIST, NOTATION
64
+ let dTagExp = parser.source.readUpto(">");
65
+ const regx = DOCTYPE_tags[str];
66
+ if(regx){
67
+ const match = dTagExp.match(regx);
68
+ if(!match) throw new Error("Invalid DOCTYPE");
69
+ }else throw new Error("Invalid DOCTYPE");
70
+ }
71
+ }else if( ch === '>' && lastch === "]"){//end of doctype
72
+ return;
73
+ }
74
+ }else if( ch === '>'){//end of doctype
75
+ return;
76
+ }else if( ch === '['){
77
+ hasBody = true;
78
+ }else{
79
+ lastch = ch;
80
+ }
81
+ }//End While loop
82
+
83
+ }
84
+
85
+ function registerEntity(parser){
86
+ //read Entity
87
+ let attrBoundary="";
88
+ let name ="", val ="";
89
+ while(source.canRead()){
90
+ let ch = source.readCh();
91
+
92
+ if(attrBoundary){
93
+ if (ch === attrBoundary){
94
+ val = text;
95
+ text = ""
96
+ }
97
+ }else if(ch === " " || ch === "\t"){
98
+ if(!name){
99
+ name = text.trimStart();
100
+ text = "";
101
+ }
102
+ }else if (ch === '"' || ch === "'") {//start of attrBoundary
103
+ attrBoundary = ch;
104
+ }else if(ch === ">"){
105
+ parser.entityParser.addExternalEntity(name,val);
106
+ return;
107
+ }else{
108
+ text+=ch;
109
+ }
110
+ }
111
+ }
112
+
113
+ module.exports = {
114
+ readCdata: readCdata,
115
+ readComment:readComment,
116
+ readDocType:readDocType,
117
+ readPiTag:readPiTag
118
+ }