@xrkseek/harness 0.2.4 → 0.2.5

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 (306) hide show
  1. package/node_modules/@xrkseek/core-tools/dist/index.d.ts +1 -0
  2. package/node_modules/@xrkseek/core-tools/dist/index.d.ts.map +1 -1
  3. package/node_modules/@xrkseek/core-tools/dist/index.js +1 -0
  4. package/node_modules/@xrkseek/core-tools/dist/index.js.map +1 -1
  5. package/node_modules/@xrkseek/core-tools/dist/settings-tools.d.ts +37 -0
  6. package/node_modules/@xrkseek/core-tools/dist/settings-tools.d.ts.map +1 -0
  7. package/node_modules/@xrkseek/core-tools/dist/settings-tools.js +161 -0
  8. package/node_modules/@xrkseek/core-tools/dist/settings-tools.js.map +1 -0
  9. package/node_modules/@xrkseek/core-tools/dist/std-tools.d.ts +4 -1
  10. package/node_modules/@xrkseek/core-tools/dist/std-tools.d.ts.map +1 -1
  11. package/node_modules/@xrkseek/core-tools/dist/std-tools.js +6 -1
  12. package/node_modules/@xrkseek/core-tools/dist/std-tools.js.map +1 -1
  13. package/node_modules/@xrkseek/exec-fs/dist/read-image.d.ts.map +1 -1
  14. package/node_modules/@xrkseek/exec-fs/dist/read-image.js +20 -2
  15. package/node_modules/@xrkseek/exec-fs/dist/read-image.js.map +1 -1
  16. package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
  17. package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
  18. package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
  19. package/node_modules/@xrkseek/server-config/dist/index.d.ts +2 -2
  20. package/node_modules/@xrkseek/server-config/dist/index.d.ts.map +1 -1
  21. package/node_modules/@xrkseek/server-config/dist/index.js +3 -2
  22. package/node_modules/@xrkseek/server-config/dist/index.js.map +1 -1
  23. package/node_modules/@xrkseek/server-config/dist/mcp-servers.d.ts +12 -1
  24. package/node_modules/@xrkseek/server-config/dist/mcp-servers.d.ts.map +1 -1
  25. package/node_modules/@xrkseek/server-config/dist/mcp-servers.js +56 -1
  26. package/node_modules/@xrkseek/server-config/dist/mcp-servers.js.map +1 -1
  27. package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.d.ts.map +1 -1
  28. package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js +17 -1
  29. package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js.map +1 -1
  30. package/node_modules/@xrkseek/server-face/dist/context.d.ts +8 -0
  31. package/node_modules/@xrkseek/server-face/dist/context.d.ts.map +1 -1
  32. package/node_modules/@xrkseek/server-face/dist/dispatch.d.ts.map +1 -1
  33. package/node_modules/@xrkseek/server-face/dist/dispatch.js +4 -1
  34. package/node_modules/@xrkseek/server-face/dist/dispatch.js.map +1 -1
  35. package/node_modules/@xrkseek/server-face/dist/face-schema.d.ts.map +1 -1
  36. package/node_modules/@xrkseek/server-face/dist/face-schema.js +2 -0
  37. package/node_modules/@xrkseek/server-face/dist/face-schema.js.map +1 -1
  38. package/node_modules/@xrkseek/server-face/dist/handlers/host.d.ts.map +1 -1
  39. package/node_modules/@xrkseek/server-face/dist/handlers/host.js +2 -0
  40. package/node_modules/@xrkseek/server-face/dist/handlers/host.js.map +1 -1
  41. package/node_modules/@xrkseek/server-face/dist/handlers/remotes.d.ts +6 -0
  42. package/node_modules/@xrkseek/server-face/dist/handlers/remotes.d.ts.map +1 -1
  43. package/node_modules/@xrkseek/server-face/dist/handlers/remotes.js +89 -1
  44. package/node_modules/@xrkseek/server-face/dist/handlers/remotes.js.map +1 -1
  45. package/node_modules/@xrkseek/server-face/dist/handlers/session.d.ts.map +1 -1
  46. package/node_modules/@xrkseek/server-face/dist/handlers/session.js +11 -112
  47. package/node_modules/@xrkseek/server-face/dist/handlers/session.js.map +1 -1
  48. package/node_modules/@xrkseek/server-face/dist/index.d.ts +2 -1
  49. package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
  50. package/node_modules/@xrkseek/server-face/dist/index.js +2 -1
  51. package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
  52. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts +22 -3
  53. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts.map +1 -1
  54. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js +117 -6
  55. package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js.map +1 -1
  56. package/node_modules/@xrkseek/server-face/dist/presets-catalog.d.ts +9 -7
  57. package/node_modules/@xrkseek/server-face/dist/presets-catalog.d.ts.map +1 -1
  58. package/node_modules/@xrkseek/server-face/dist/presets-catalog.js +7 -17
  59. package/node_modules/@xrkseek/server-face/dist/presets-catalog.js.map +1 -1
  60. package/node_modules/@xrkseek/server-face/dist/runtime.d.ts +5 -0
  61. package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
  62. package/node_modules/@xrkseek/server-face/dist/runtime.js +5 -0
  63. package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
  64. package/node_modules/@xrkseek/server-face/dist/select-session-model.d.ts +15 -0
  65. package/node_modules/@xrkseek/server-face/dist/select-session-model.d.ts.map +1 -0
  66. package/node_modules/@xrkseek/server-face/dist/select-session-model.js +117 -0
  67. package/node_modules/@xrkseek/server-face/dist/select-session-model.js.map +1 -0
  68. package/node_modules/@xrkseek/server-face/dist/settings-agent-tools.d.ts +7 -0
  69. package/node_modules/@xrkseek/server-face/dist/settings-agent-tools.d.ts.map +1 -0
  70. package/node_modules/@xrkseek/server-face/dist/settings-agent-tools.js +91 -0
  71. package/node_modules/@xrkseek/server-face/dist/settings-agent-tools.js.map +1 -0
  72. package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts +7 -1
  73. package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
  74. package/node_modules/@xrkseek/server-face/dist/settings-credentials.js +85 -26
  75. package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
  76. package/node_modules/@xrkseek/server-face/dist/slash.d.ts +4 -3
  77. package/node_modules/@xrkseek/server-face/dist/slash.d.ts.map +1 -1
  78. package/node_modules/@xrkseek/server-face/dist/slash.js +191 -20
  79. package/node_modules/@xrkseek/server-face/dist/slash.js.map +1 -1
  80. package/node_modules/@xrkseek/server-host/dist/http-proxy.d.ts +11 -0
  81. package/node_modules/@xrkseek/server-host/dist/http-proxy.d.ts.map +1 -0
  82. package/node_modules/@xrkseek/server-host/dist/http-proxy.js +42 -0
  83. package/node_modules/@xrkseek/server-host/dist/http-proxy.js.map +1 -0
  84. package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
  85. package/node_modules/@xrkseek/server-host/dist/index.js +17 -1
  86. package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
  87. package/node_modules/@xrkseek/server-host/dist/mcp-wire.d.ts +4 -3
  88. package/node_modules/@xrkseek/server-host/dist/mcp-wire.d.ts.map +1 -1
  89. package/node_modules/@xrkseek/server-host/dist/mcp-wire.js +14 -10
  90. package/node_modules/@xrkseek/server-host/dist/mcp-wire.js.map +1 -1
  91. package/node_modules/@xrkseek/server-host/package.json +57 -56
  92. package/node_modules/@xrkseek/server-http/dist/index.d.ts +1 -0
  93. package/node_modules/@xrkseek/server-http/dist/index.d.ts.map +1 -1
  94. package/node_modules/@xrkseek/server-http/dist/index.js +1 -0
  95. package/node_modules/@xrkseek/server-http/dist/index.js.map +1 -1
  96. package/node_modules/undici/LICENSE +21 -0
  97. package/node_modules/undici/README.md +741 -0
  98. package/node_modules/undici/docs/docs/api/Agent.md +84 -0
  99. package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  100. package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  101. package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  102. package/node_modules/undici/docs/docs/api/Client.md +288 -0
  103. package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  104. package/node_modules/undici/docs/docs/api/Connector.md +115 -0
  105. package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  106. package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
  107. package/node_modules/undici/docs/docs/api/Debug.md +62 -0
  108. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  109. package/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
  110. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  111. package/node_modules/undici/docs/docs/api/Errors.md +49 -0
  112. package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  113. package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  114. package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
  115. package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  116. package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  117. package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  118. package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  119. package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  120. package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  121. package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  122. package/node_modules/undici/docs/docs/api/Pool.md +84 -0
  123. package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  124. package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  125. package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
  126. package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
  127. package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
  128. package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  129. package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
  130. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
  131. package/node_modules/undici/docs/docs/api/Util.md +25 -0
  132. package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  133. package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  134. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  135. package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  136. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  137. package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  138. package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  139. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  140. package/node_modules/undici/index-fetch.js +65 -0
  141. package/node_modules/undici/index.d.ts +3 -0
  142. package/node_modules/undici/index.js +234 -0
  143. package/node_modules/undici/lib/api/abort-signal.js +59 -0
  144. package/node_modules/undici/lib/api/api-connect.js +110 -0
  145. package/node_modules/undici/lib/api/api-pipeline.js +252 -0
  146. package/node_modules/undici/lib/api/api-request.js +214 -0
  147. package/node_modules/undici/lib/api/api-stream.js +209 -0
  148. package/node_modules/undici/lib/api/api-upgrade.js +111 -0
  149. package/node_modules/undici/lib/api/index.js +7 -0
  150. package/node_modules/undici/lib/api/readable.js +580 -0
  151. package/node_modules/undici/lib/cache/memory-cache-store.js +279 -0
  152. package/node_modules/undici/lib/cache/sqlite-cache-store.js +467 -0
  153. package/node_modules/undici/lib/core/connect.js +153 -0
  154. package/node_modules/undici/lib/core/constants.js +143 -0
  155. package/node_modules/undici/lib/core/diagnostics.js +227 -0
  156. package/node_modules/undici/lib/core/errors.js +477 -0
  157. package/node_modules/undici/lib/core/request.js +464 -0
  158. package/node_modules/undici/lib/core/socks5-client.js +422 -0
  159. package/node_modules/undici/lib/core/socks5-utils.js +212 -0
  160. package/node_modules/undici/lib/core/symbols.js +75 -0
  161. package/node_modules/undici/lib/core/tree.js +160 -0
  162. package/node_modules/undici/lib/core/util.js +992 -0
  163. package/node_modules/undici/lib/dispatcher/agent.js +158 -0
  164. package/node_modules/undici/lib/dispatcher/balanced-pool.js +221 -0
  165. package/node_modules/undici/lib/dispatcher/client-h1.js +1739 -0
  166. package/node_modules/undici/lib/dispatcher/client-h2.js +1051 -0
  167. package/node_modules/undici/lib/dispatcher/client.js +668 -0
  168. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
  169. package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
  170. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  171. package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  172. package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  173. package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
  174. package/node_modules/undici/lib/dispatcher/pool.js +118 -0
  175. package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
  176. package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  177. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
  178. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
  179. package/node_modules/undici/lib/encoding/index.js +33 -0
  180. package/node_modules/undici/lib/global.js +59 -0
  181. package/node_modules/undici/lib/handler/cache-handler.js +776 -0
  182. package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  183. package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
  184. package/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  185. package/node_modules/undici/lib/handler/redirect-handler.js +238 -0
  186. package/node_modules/undici/lib/handler/retry-handler.js +453 -0
  187. package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
  188. package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  189. package/node_modules/undici/lib/interceptor/cache.js +621 -0
  190. package/node_modules/undici/lib/interceptor/decompress.js +391 -0
  191. package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  192. package/node_modules/undici/lib/interceptor/dns.js +571 -0
  193. package/node_modules/undici/lib/interceptor/dump.js +99 -0
  194. package/node_modules/undici/lib/interceptor/redirect.js +21 -0
  195. package/node_modules/undici/lib/interceptor/response-error.js +95 -0
  196. package/node_modules/undici/lib/interceptor/retry.js +19 -0
  197. package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  198. package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
  199. package/node_modules/undici/lib/llhttp/constants.js +531 -0
  200. package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  201. package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  202. package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
  203. package/node_modules/undici/lib/llhttp/utils.js +12 -0
  204. package/node_modules/undici/lib/mock/mock-agent.js +232 -0
  205. package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  206. package/node_modules/undici/lib/mock/mock-client.js +68 -0
  207. package/node_modules/undici/lib/mock/mock-errors.js +29 -0
  208. package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  209. package/node_modules/undici/lib/mock/mock-pool.js +68 -0
  210. package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  211. package/node_modules/undici/lib/mock/mock-utils.js +486 -0
  212. package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  213. package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
  214. package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
  215. package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  216. package/node_modules/undici/lib/util/cache.js +676 -0
  217. package/node_modules/undici/lib/util/date.js +670 -0
  218. package/node_modules/undici/lib/util/promise.js +28 -0
  219. package/node_modules/undici/lib/util/runtime-features.js +124 -0
  220. package/node_modules/undici/lib/util/stats.js +32 -0
  221. package/node_modules/undici/lib/util/timers.js +425 -0
  222. package/node_modules/undici/lib/web/cache/cache.js +864 -0
  223. package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  224. package/node_modules/undici/lib/web/cache/util.js +45 -0
  225. package/node_modules/undici/lib/web/cookies/constants.js +12 -0
  226. package/node_modules/undici/lib/web/cookies/index.js +199 -0
  227. package/node_modules/undici/lib/web/cookies/parse.js +314 -0
  228. package/node_modules/undici/lib/web/cookies/util.js +352 -0
  229. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +494 -0
  230. package/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  231. package/node_modules/undici/lib/web/eventsource/util.js +29 -0
  232. package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  233. package/node_modules/undici/lib/web/fetch/body.js +509 -0
  234. package/node_modules/undici/lib/web/fetch/constants.js +131 -0
  235. package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  236. package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
  237. package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
  238. package/node_modules/undici/lib/web/fetch/global.js +40 -0
  239. package/node_modules/undici/lib/web/fetch/headers.js +719 -0
  240. package/node_modules/undici/lib/web/fetch/index.js +2413 -0
  241. package/node_modules/undici/lib/web/fetch/request.js +1115 -0
  242. package/node_modules/undici/lib/web/fetch/response.js +641 -0
  243. package/node_modules/undici/lib/web/fetch/util.js +1522 -0
  244. package/node_modules/undici/lib/web/infra/index.js +229 -0
  245. package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  246. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  247. package/node_modules/undici/lib/web/webidl/index.js +1006 -0
  248. package/node_modules/undici/lib/web/websocket/connection.js +329 -0
  249. package/node_modules/undici/lib/web/websocket/constants.js +126 -0
  250. package/node_modules/undici/lib/web/websocket/events.js +331 -0
  251. package/node_modules/undici/lib/web/websocket/frame.js +133 -0
  252. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
  253. package/node_modules/undici/lib/web/websocket/receiver.js +507 -0
  254. package/node_modules/undici/lib/web/websocket/sender.js +109 -0
  255. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  256. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +496 -0
  257. package/node_modules/undici/lib/web/websocket/util.js +347 -0
  258. package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
  259. package/node_modules/undici/package.json +152 -0
  260. package/node_modules/undici/scripts/strip-comments.js +10 -0
  261. package/node_modules/undici/types/README.md +6 -0
  262. package/node_modules/undici/types/agent.d.ts +32 -0
  263. package/node_modules/undici/types/api.d.ts +43 -0
  264. package/node_modules/undici/types/balanced-pool.d.ts +30 -0
  265. package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
  266. package/node_modules/undici/types/cache.d.ts +36 -0
  267. package/node_modules/undici/types/client-stats.d.ts +15 -0
  268. package/node_modules/undici/types/client.d.ts +139 -0
  269. package/node_modules/undici/types/connector.d.ts +36 -0
  270. package/node_modules/undici/types/content-type.d.ts +21 -0
  271. package/node_modules/undici/types/cookies.d.ts +30 -0
  272. package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
  273. package/node_modules/undici/types/dispatcher.d.ts +275 -0
  274. package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
  275. package/node_modules/undici/types/errors.d.ts +177 -0
  276. package/node_modules/undici/types/eventsource.d.ts +66 -0
  277. package/node_modules/undici/types/fetch.d.ts +231 -0
  278. package/node_modules/undici/types/formdata.d.ts +114 -0
  279. package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  280. package/node_modules/undici/types/global-origin.d.ts +7 -0
  281. package/node_modules/undici/types/h2c-client.d.ts +73 -0
  282. package/node_modules/undici/types/handlers.d.ts +14 -0
  283. package/node_modules/undici/types/header.d.ts +160 -0
  284. package/node_modules/undici/types/index.d.ts +91 -0
  285. package/node_modules/undici/types/interceptors.d.ts +82 -0
  286. package/node_modules/undici/types/mock-agent.d.ts +68 -0
  287. package/node_modules/undici/types/mock-call-history.d.ts +111 -0
  288. package/node_modules/undici/types/mock-client.d.ts +27 -0
  289. package/node_modules/undici/types/mock-errors.d.ts +12 -0
  290. package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
  291. package/node_modules/undici/types/mock-pool.d.ts +27 -0
  292. package/node_modules/undici/types/patch.d.ts +29 -0
  293. package/node_modules/undici/types/pool-stats.d.ts +19 -0
  294. package/node_modules/undici/types/pool.d.ts +41 -0
  295. package/node_modules/undici/types/proxy-agent.d.ts +29 -0
  296. package/node_modules/undici/types/readable.d.ts +68 -0
  297. package/node_modules/undici/types/retry-agent.d.ts +8 -0
  298. package/node_modules/undici/types/retry-handler.d.ts +125 -0
  299. package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
  300. package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
  301. package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
  302. package/node_modules/undici/types/util.d.ts +18 -0
  303. package/node_modules/undici/types/utility.d.ts +7 -0
  304. package/node_modules/undici/types/webidl.d.ts +347 -0
  305. package/node_modules/undici/types/websocket.d.ts +188 -0
  306. package/package.json +3 -1
@@ -0,0 +1,494 @@
1
+ 'use strict'
2
+ const { Transform } = require('node:stream')
3
+ const { isASCIINumber, isValidLastEventId } = require('./util')
4
+
5
+ /**
6
+ * @type {number[]} BOM
7
+ */
8
+ const BOM = [0xEF, 0xBB, 0xBF]
9
+ /**
10
+ * @type {10} LF
11
+ */
12
+ const LF = 0x0A
13
+ /**
14
+ * @type {13} CR
15
+ */
16
+ const CR = 0x0D
17
+ /**
18
+ * @type {58} COLON
19
+ */
20
+ const COLON = 0x3A
21
+ /**
22
+ * @type {32} SPACE
23
+ */
24
+ const SPACE = 0x20
25
+
26
+ const DATA = Buffer.from('data')
27
+ const EVENT = Buffer.from('event')
28
+ const ID = Buffer.from('id')
29
+ const RETRY = Buffer.from('retry')
30
+
31
+ function isASCIINumberBytes (buffer, start) {
32
+ if (start >= buffer.length) {
33
+ return false
34
+ }
35
+
36
+ for (let i = start; i < buffer.length; i++) {
37
+ if (buffer[i] < 0x30 || buffer[i] > 0x39) {
38
+ return false
39
+ }
40
+ }
41
+
42
+ return true
43
+ }
44
+
45
+ function isValidLastEventIdBytes (buffer, start) {
46
+ for (let i = start; i < buffer.length; i++) {
47
+ if (buffer[i] === 0x00) {
48
+ return false
49
+ }
50
+ }
51
+
52
+ return true
53
+ }
54
+
55
+ function isFieldName (line, length, field) {
56
+ if (length !== field.length) {
57
+ return false
58
+ }
59
+
60
+ for (let i = 0; i < length; i++) {
61
+ if (line[i] !== field[i]) {
62
+ return false
63
+ }
64
+ }
65
+
66
+ return true
67
+ }
68
+
69
+ /**
70
+ * @typedef {object} EventSourceStreamEvent
71
+ * @type {object}
72
+ * @property {string} [event] The event type.
73
+ * @property {string} [data] The data of the message.
74
+ * @property {string} [id] A unique ID for the event.
75
+ * @property {string} [retry] The reconnection time, in milliseconds.
76
+ */
77
+
78
+ /**
79
+ * @typedef eventSourceSettings
80
+ * @type {object}
81
+ * @property {string} [lastEventId] The last event ID received from the server.
82
+ * @property {string} [origin] The origin of the event source.
83
+ * @property {number} [reconnectionTime] The reconnection time, in milliseconds.
84
+ */
85
+
86
+ class EventSourceStream extends Transform {
87
+ /**
88
+ * @type {eventSourceSettings}
89
+ */
90
+ state
91
+
92
+ /**
93
+ * Leading byte-order-mark check.
94
+ * @type {boolean}
95
+ */
96
+ checkBOM = true
97
+
98
+ /**
99
+ * @type {boolean}
100
+ */
101
+ crlfCheck = false
102
+
103
+ /**
104
+ * @type {boolean}
105
+ */
106
+ eventEndCheck = false
107
+
108
+ /**
109
+ * @type {Buffer[]}
110
+ */
111
+ chunks = []
112
+
113
+ chunkIndex = 0
114
+ pos = 0
115
+ lineChunkIndex = 0
116
+ linePos = 0
117
+
118
+ event = {
119
+ data: undefined,
120
+ event: undefined,
121
+ id: undefined,
122
+ retry: undefined
123
+ }
124
+
125
+ /**
126
+ * @param {object} options
127
+ * @param {boolean} [options.readableObjectMode]
128
+ * @param {eventSourceSettings} [options.eventSourceSettings]
129
+ * @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
130
+ */
131
+ constructor (options = {}) {
132
+ // Enable object mode as EventSourceStream emits objects of shape
133
+ // EventSourceStreamEvent
134
+ options.readableObjectMode = true
135
+
136
+ super(options)
137
+
138
+ this.state = options.eventSourceSettings || {}
139
+ if (options.push) {
140
+ this.push = options.push
141
+ }
142
+ }
143
+
144
+ /**
145
+ * @param {Buffer} chunk
146
+ * @param {string} _encoding
147
+ * @param {Function} callback
148
+ * @returns {void}
149
+ */
150
+ _transform (chunk, _encoding, callback) {
151
+ if (chunk.length === 0) {
152
+ callback()
153
+ return
154
+ }
155
+
156
+ this.chunks.push(chunk)
157
+
158
+ // Strip leading byte-order-mark if we opened the stream and started
159
+ // the processing of the incoming data
160
+ if (this.checkBOM) {
161
+ if (this.handleBOM()) {
162
+ callback()
163
+ return
164
+ }
165
+ }
166
+
167
+ while (this.hasCurrentByte()) {
168
+ const byte = this.currentByte()
169
+
170
+ // If the previous line ended with an end-of-line, we need to check
171
+ // if the next character is also an end-of-line.
172
+ if (this.eventEndCheck) {
173
+ // If the the current character is an end-of-line, then the event
174
+ // is finished and we can process it
175
+
176
+ // If the previous line ended with a carriage return, we need to
177
+ // check if the current character is a line feed and remove it
178
+ // from the buffer.
179
+ if (this.crlfCheck) {
180
+ // If the current character is a line feed, we can remove it
181
+ // from the buffer and reset the crlfCheck flag
182
+ if (byte === LF) {
183
+ this.crlfCheck = false
184
+ this.consumeCurrentByte()
185
+
186
+ // It is possible that the line feed is not the end of the
187
+ // event. We need to check if the next character is an
188
+ // end-of-line character to determine if the event is
189
+ // finished. We simply continue the loop to check the next
190
+ // character.
191
+
192
+ // As we removed the line feed from the buffer and set the
193
+ // crlfCheck flag to false, we basically don't make any
194
+ // distinction between a line feed and a carriage return.
195
+ continue
196
+ }
197
+ this.crlfCheck = false
198
+ }
199
+
200
+ if (byte === LF || byte === CR) {
201
+ // If the current character is a carriage return, we need to
202
+ // set the crlfCheck flag to true, as we need to check if the
203
+ // next character is a line feed so we can remove it from the
204
+ // buffer
205
+ if (byte === CR) {
206
+ this.crlfCheck = true
207
+ }
208
+
209
+ this.consumeCurrentByte()
210
+ if (this.hasPendingEvent()) {
211
+ this.processEvent(this.event)
212
+ }
213
+ this.clearEvent()
214
+ continue
215
+ }
216
+ // If the current character is not an end-of-line, then the event
217
+ // is not finished and we have to reset the eventEndCheck flag
218
+ this.eventEndCheck = false
219
+ continue
220
+ }
221
+
222
+ // If the current character is an end-of-line, we can process the
223
+ // line
224
+ if (byte === LF || byte === CR) {
225
+ // If the current character is a carriage return, we need to
226
+ // set the crlfCheck flag to true, as we need to check if the
227
+ // next character is a line feed
228
+ if (byte === CR) {
229
+ this.crlfCheck = true
230
+ }
231
+
232
+ // In any case, we can process the line as we reached an
233
+ // end-of-line character
234
+ this.parseLine(this.readLine(), this.event)
235
+ this.consumeCurrentByte()
236
+ // A line was processed and this could be the end of the event. We need
237
+ // to check if the next line is empty to determine if the event is
238
+ // finished.
239
+ this.eventEndCheck = true
240
+ continue
241
+ }
242
+
243
+ this.advanceCursor()
244
+ }
245
+
246
+ callback()
247
+ }
248
+
249
+ /**
250
+ * @param {Buffer} line
251
+ * @param {EventSourceStreamEvent} event
252
+ */
253
+ parseLine (line, event) {
254
+ // If the line is empty (a blank line)
255
+ // Dispatch the event, as defined below.
256
+ // This will be handled in the _transform method
257
+ if (line.length === 0) {
258
+ return
259
+ }
260
+
261
+ // If the line starts with a U+003A COLON character (:)
262
+ // Ignore the line.
263
+ const colonPosition = line.indexOf(COLON)
264
+ if (colonPosition === 0) {
265
+ return
266
+ }
267
+
268
+ let fieldLength = line.length
269
+ let valueStart = line.length
270
+
271
+ // If the line contains a U+003A COLON character (:)
272
+ if (colonPosition !== -1) {
273
+ fieldLength = colonPosition
274
+
275
+ // Collect the characters on the line after the first U+003A COLON
276
+ // character (:), and let value be that string.
277
+ // If value starts with a U+0020 SPACE character, remove it from value.
278
+ valueStart = colonPosition + 1
279
+ if (line[valueStart] === SPACE) {
280
+ ++valueStart
281
+ }
282
+ }
283
+
284
+ if (isFieldName(line, fieldLength, DATA)) {
285
+ const value = line.toString('utf8', valueStart)
286
+
287
+ if (event.data === undefined) {
288
+ event.data = value
289
+ } else {
290
+ event.data += `\n${value}`
291
+ }
292
+ return
293
+ }
294
+
295
+ if (isFieldName(line, fieldLength, RETRY)) {
296
+ if (isASCIINumberBytes(line, valueStart)) {
297
+ event.retry = line.toString('utf8', valueStart)
298
+ }
299
+ return
300
+ }
301
+
302
+ if (isFieldName(line, fieldLength, ID)) {
303
+ if (isValidLastEventIdBytes(line, valueStart)) {
304
+ event.id = line.toString('utf8', valueStart)
305
+ }
306
+ return
307
+ }
308
+
309
+ if (isFieldName(line, fieldLength, EVENT)) {
310
+ const value = line.toString('utf8', valueStart)
311
+
312
+ if (value.length > 0) {
313
+ event.event = value
314
+ }
315
+ }
316
+ }
317
+
318
+ /**
319
+ * @param {EventSourceStreamEvent} event
320
+ */
321
+ processEvent (event) {
322
+ if (event.retry && isASCIINumber(event.retry)) {
323
+ this.state.reconnectionTime = parseInt(event.retry, 10)
324
+ }
325
+
326
+ if (event.id !== undefined && isValidLastEventId(event.id)) {
327
+ this.state.lastEventId = event.id
328
+ }
329
+
330
+ // only dispatch event, when data is provided
331
+ if (event.data !== undefined) {
332
+ this.push({
333
+ type: event.event || 'message',
334
+ options: {
335
+ data: event.data,
336
+ lastEventId: this.state.lastEventId,
337
+ origin: this.state.origin
338
+ }
339
+ })
340
+ }
341
+ }
342
+
343
+ clearEvent () {
344
+ this.event.data = undefined
345
+ this.event.event = undefined
346
+ this.event.id = undefined
347
+ this.event.retry = undefined
348
+ }
349
+
350
+ hasPendingEvent () {
351
+ return this.event.data !== undefined ||
352
+ this.event.event !== undefined ||
353
+ this.event.id !== undefined ||
354
+ this.event.retry !== undefined
355
+ }
356
+
357
+ hasCurrentByte () {
358
+ return this.chunkIndex < this.chunks.length &&
359
+ this.pos < this.chunks[this.chunkIndex].length
360
+ }
361
+
362
+ currentByte () {
363
+ return this.chunks[this.chunkIndex][this.pos]
364
+ }
365
+
366
+ consumeCurrentByte () {
367
+ this.advanceCursor()
368
+ this.syncLineStartToCursor()
369
+ }
370
+
371
+ advanceCursor () {
372
+ this.pos++
373
+
374
+ while (this.chunkIndex < this.chunks.length && this.pos >= this.chunks[this.chunkIndex].length) {
375
+ this.chunkIndex++
376
+ this.pos = 0
377
+ }
378
+ }
379
+
380
+ syncLineStartToCursor () {
381
+ this.lineChunkIndex = this.chunkIndex
382
+ this.linePos = this.pos
383
+ this.dropConsumedChunks()
384
+ }
385
+
386
+ dropConsumedChunks () {
387
+ while (this.lineChunkIndex > 0) {
388
+ this.chunks.shift()
389
+ this.lineChunkIndex--
390
+ this.chunkIndex--
391
+ }
392
+
393
+ if (this.chunkIndex === this.chunks.length) {
394
+ this.chunks.length = 0
395
+ this.chunkIndex = 0
396
+ this.pos = 0
397
+ this.lineChunkIndex = 0
398
+ this.linePos = 0
399
+ }
400
+ }
401
+
402
+ readLine () {
403
+ if (this.lineChunkIndex === this.chunkIndex) {
404
+ return this.chunks[this.chunkIndex].subarray(this.linePos, this.pos)
405
+ }
406
+
407
+ const chunks = []
408
+ let length = 0
409
+
410
+ for (let i = this.lineChunkIndex; i <= this.chunkIndex; i++) {
411
+ const chunk = this.chunks[i]
412
+ const start = i === this.lineChunkIndex ? this.linePos : 0
413
+ const end = i === this.chunkIndex ? this.pos : chunk.length
414
+ const slice = chunk.subarray(start, end)
415
+ length += slice.length
416
+ chunks.push(slice)
417
+ }
418
+
419
+ return Buffer.concat(chunks, length)
420
+ }
421
+
422
+ peekBufferedByte (offset) {
423
+ let chunkIndex = this.lineChunkIndex
424
+ let pos = this.linePos
425
+
426
+ while (chunkIndex < this.chunks.length) {
427
+ const chunk = this.chunks[chunkIndex]
428
+ const remaining = chunk.length - pos
429
+
430
+ if (offset < remaining) {
431
+ return chunk[pos + offset]
432
+ }
433
+
434
+ offset -= remaining
435
+ chunkIndex++
436
+ pos = 0
437
+ }
438
+ }
439
+
440
+ discardLeadingBytes (count) {
441
+ while (count > 0 && this.lineChunkIndex < this.chunks.length) {
442
+ const chunk = this.chunks[this.lineChunkIndex]
443
+ const remaining = chunk.length - this.linePos
444
+
445
+ if (count < remaining) {
446
+ this.linePos += count
447
+ count = 0
448
+ } else {
449
+ count -= remaining
450
+ this.lineChunkIndex++
451
+ this.linePos = 0
452
+ }
453
+ }
454
+
455
+ this.chunkIndex = this.lineChunkIndex
456
+ this.pos = this.linePos
457
+ this.dropConsumedChunks()
458
+ }
459
+
460
+ handleBOM () {
461
+ const first = this.peekBufferedByte(0)
462
+ const second = this.peekBufferedByte(1)
463
+ const third = this.peekBufferedByte(2)
464
+
465
+ if (second === undefined) {
466
+ if (first === BOM[0]) {
467
+ return true
468
+ }
469
+
470
+ this.checkBOM = false
471
+ return true
472
+ }
473
+
474
+ if (third === undefined) {
475
+ if (first === BOM[0] && second === BOM[1]) {
476
+ return true
477
+ }
478
+
479
+ this.checkBOM = false
480
+ return false
481
+ }
482
+
483
+ if (first === BOM[0] && second === BOM[1] && third === BOM[2]) {
484
+ this.discardLeadingBytes(3)
485
+ }
486
+
487
+ this.checkBOM = false
488
+ return !this.hasCurrentByte()
489
+ }
490
+ }
491
+
492
+ module.exports = {
493
+ EventSourceStream
494
+ }