monitor-transfer-dsh 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +51 -2
  3. package/cordis.patch.yml +4 -0
  4. package/lib/client.js +381 -0
  5. package/lib/index.js +267 -0
  6. package/package.json +67 -3
  7. package/skill/SKILL.md +48 -0
  8. package/skill/tools/node_modules/.package-lock.json +163 -0
  9. package/skill/tools/node_modules/pg/LICENSE +21 -0
  10. package/skill/tools/node_modules/pg/README.md +96 -0
  11. package/skill/tools/node_modules/pg/esm/index.mjs +20 -0
  12. package/skill/tools/node_modules/pg/lib/client.js +846 -0
  13. package/skill/tools/node_modules/pg/lib/connection-parameters.js +184 -0
  14. package/skill/tools/node_modules/pg/lib/connection.js +250 -0
  15. package/skill/tools/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  16. package/skill/tools/node_modules/pg/lib/crypto/sasl.js +262 -0
  17. package/skill/tools/node_modules/pg/lib/crypto/utils.js +89 -0
  18. package/skill/tools/node_modules/pg/lib/defaults.js +94 -0
  19. package/skill/tools/node_modules/pg/lib/index.js +73 -0
  20. package/skill/tools/node_modules/pg/lib/native/client.js +428 -0
  21. package/skill/tools/node_modules/pg/lib/native/index.js +2 -0
  22. package/skill/tools/node_modules/pg/lib/native/query.js +167 -0
  23. package/skill/tools/node_modules/pg/lib/query.js +263 -0
  24. package/skill/tools/node_modules/pg/lib/result.js +109 -0
  25. package/skill/tools/node_modules/pg/lib/stream.js +83 -0
  26. package/skill/tools/node_modules/pg/lib/type-overrides.js +35 -0
  27. package/skill/tools/node_modules/pg/lib/utils.js +225 -0
  28. package/skill/tools/node_modules/pg/package.json +76 -0
  29. package/skill/tools/node_modules/pg-cloudflare/LICENSE +21 -0
  30. package/skill/tools/node_modules/pg-cloudflare/README.md +112 -0
  31. package/skill/tools/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
  32. package/skill/tools/node_modules/pg-cloudflare/dist/empty.js +6 -0
  33. package/skill/tools/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
  34. package/skill/tools/node_modules/pg-cloudflare/dist/index.d.ts +29 -0
  35. package/skill/tools/node_modules/pg-cloudflare/dist/index.js +171 -0
  36. package/skill/tools/node_modules/pg-cloudflare/dist/index.js.map +1 -0
  37. package/skill/tools/node_modules/pg-cloudflare/esm/index.mjs +3 -0
  38. package/skill/tools/node_modules/pg-cloudflare/package.json +39 -0
  39. package/skill/tools/node_modules/pg-cloudflare/src/empty.ts +3 -0
  40. package/skill/tools/node_modules/pg-cloudflare/src/index.ts +187 -0
  41. package/skill/tools/node_modules/pg-cloudflare/src/types.d.ts +25 -0
  42. package/skill/tools/node_modules/pg-connection-string/LICENSE +21 -0
  43. package/skill/tools/node_modules/pg-connection-string/README.md +105 -0
  44. package/skill/tools/node_modules/pg-connection-string/esm/index.mjs +8 -0
  45. package/skill/tools/node_modules/pg-connection-string/index.d.ts +37 -0
  46. package/skill/tools/node_modules/pg-connection-string/index.js +237 -0
  47. package/skill/tools/node_modules/pg-connection-string/package.json +51 -0
  48. package/skill/tools/node_modules/pg-int8/LICENSE +13 -0
  49. package/skill/tools/node_modules/pg-int8/README.md +16 -0
  50. package/skill/tools/node_modules/pg-int8/index.js +100 -0
  51. package/skill/tools/node_modules/pg-int8/package.json +24 -0
  52. package/skill/tools/node_modules/pg-pool/LICENSE +21 -0
  53. package/skill/tools/node_modules/pg-pool/README.md +357 -0
  54. package/skill/tools/node_modules/pg-pool/esm/index.mjs +5 -0
  55. package/skill/tools/node_modules/pg-pool/index.js +517 -0
  56. package/skill/tools/node_modules/pg-pool/package.json +51 -0
  57. package/skill/tools/node_modules/pg-protocol/LICENSE +21 -0
  58. package/skill/tools/node_modules/pg-protocol/README.md +3 -0
  59. package/skill/tools/node_modules/pg-protocol/dist/b.d.ts +1 -0
  60. package/skill/tools/node_modules/pg-protocol/dist/b.js +23 -0
  61. package/skill/tools/node_modules/pg-protocol/dist/b.js.map +1 -0
  62. package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.d.ts +14 -0
  63. package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
  64. package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
  65. package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.d.ts +21 -0
  66. package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.js +113 -0
  67. package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
  68. package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
  69. package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.js +538 -0
  70. package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
  71. package/skill/tools/node_modules/pg-protocol/dist/index.d.ts +5 -0
  72. package/skill/tools/node_modules/pg-protocol/dist/index.js +15 -0
  73. package/skill/tools/node_modules/pg-protocol/dist/index.js.map +1 -0
  74. package/skill/tools/node_modules/pg-protocol/dist/messages.d.ts +161 -0
  75. package/skill/tools/node_modules/pg-protocol/dist/messages.js +160 -0
  76. package/skill/tools/node_modules/pg-protocol/dist/messages.js.map +1 -0
  77. package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
  78. package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.js +325 -0
  79. package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
  80. package/skill/tools/node_modules/pg-protocol/dist/parser.d.ts +22 -0
  81. package/skill/tools/node_modules/pg-protocol/dist/parser.js +325 -0
  82. package/skill/tools/node_modules/pg-protocol/dist/parser.js.map +1 -0
  83. package/skill/tools/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
  84. package/skill/tools/node_modules/pg-protocol/dist/serializer.js +198 -0
  85. package/skill/tools/node_modules/pg-protocol/dist/serializer.js.map +1 -0
  86. package/skill/tools/node_modules/pg-protocol/esm/index.js +11 -0
  87. package/skill/tools/node_modules/pg-protocol/package.json +44 -0
  88. package/skill/tools/node_modules/pg-protocol/src/b.ts +25 -0
  89. package/skill/tools/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
  90. package/skill/tools/node_modules/pg-protocol/src/buffer-writer.ts +120 -0
  91. package/skill/tools/node_modules/pg-protocol/src/inbound-parser.test.ts +585 -0
  92. package/skill/tools/node_modules/pg-protocol/src/index.ts +11 -0
  93. package/skill/tools/node_modules/pg-protocol/src/messages.ts +262 -0
  94. package/skill/tools/node_modules/pg-protocol/src/outbound-serializer.test.ts +356 -0
  95. package/skill/tools/node_modules/pg-protocol/src/parser.ts +414 -0
  96. package/skill/tools/node_modules/pg-protocol/src/serializer.ts +286 -0
  97. package/skill/tools/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
  98. package/skill/tools/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
  99. package/skill/tools/node_modules/pg-types/.travis.yml +7 -0
  100. package/skill/tools/node_modules/pg-types/Makefile +14 -0
  101. package/skill/tools/node_modules/pg-types/README.md +75 -0
  102. package/skill/tools/node_modules/pg-types/index.d.ts +137 -0
  103. package/skill/tools/node_modules/pg-types/index.js +47 -0
  104. package/skill/tools/node_modules/pg-types/index.test-d.ts +21 -0
  105. package/skill/tools/node_modules/pg-types/lib/arrayParser.js +11 -0
  106. package/skill/tools/node_modules/pg-types/lib/binaryParsers.js +257 -0
  107. package/skill/tools/node_modules/pg-types/lib/builtins.js +73 -0
  108. package/skill/tools/node_modules/pg-types/lib/textParsers.js +215 -0
  109. package/skill/tools/node_modules/pg-types/package.json +42 -0
  110. package/skill/tools/node_modules/pg-types/test/index.js +24 -0
  111. package/skill/tools/node_modules/pg-types/test/types.js +597 -0
  112. package/skill/tools/node_modules/pgpass/README.md +74 -0
  113. package/skill/tools/node_modules/pgpass/lib/helper.js +233 -0
  114. package/skill/tools/node_modules/pgpass/lib/index.js +23 -0
  115. package/skill/tools/node_modules/pgpass/package.json +41 -0
  116. package/skill/tools/node_modules/postgres-array/index.d.ts +4 -0
  117. package/skill/tools/node_modules/postgres-array/index.js +97 -0
  118. package/skill/tools/node_modules/postgres-array/license +21 -0
  119. package/skill/tools/node_modules/postgres-array/package.json +35 -0
  120. package/skill/tools/node_modules/postgres-array/readme.md +43 -0
  121. package/skill/tools/node_modules/postgres-bytea/index.js +33 -0
  122. package/skill/tools/node_modules/postgres-bytea/license +21 -0
  123. package/skill/tools/node_modules/postgres-bytea/package.json +34 -0
  124. package/skill/tools/node_modules/postgres-bytea/readme.md +34 -0
  125. package/skill/tools/node_modules/postgres-date/index.js +116 -0
  126. package/skill/tools/node_modules/postgres-date/license +21 -0
  127. package/skill/tools/node_modules/postgres-date/package.json +33 -0
  128. package/skill/tools/node_modules/postgres-date/readme.md +49 -0
  129. package/skill/tools/node_modules/postgres-interval/index.d.ts +20 -0
  130. package/skill/tools/node_modules/postgres-interval/index.js +125 -0
  131. package/skill/tools/node_modules/postgres-interval/license +21 -0
  132. package/skill/tools/node_modules/postgres-interval/package.json +36 -0
  133. package/skill/tools/node_modules/postgres-interval/readme.md +48 -0
  134. package/skill/tools/node_modules/split2/LICENSE +13 -0
  135. package/skill/tools/node_modules/split2/README.md +85 -0
  136. package/skill/tools/node_modules/split2/bench.js +27 -0
  137. package/skill/tools/node_modules/split2/index.js +141 -0
  138. package/skill/tools/node_modules/split2/package.json +39 -0
  139. package/skill/tools/node_modules/split2/test.js +409 -0
  140. package/skill/tools/node_modules/undici/LICENSE +21 -0
  141. package/skill/tools/node_modules/undici/README.md +828 -0
  142. package/skill/tools/node_modules/undici/docs/docs/api/Agent.md +291 -0
  143. package/skill/tools/node_modules/undici/docs/docs/api/BalancedPool.md +297 -0
  144. package/skill/tools/node_modules/undici/docs/docs/api/CacheStorage.md +188 -0
  145. package/skill/tools/node_modules/undici/docs/docs/api/CacheStore.md +375 -0
  146. package/skill/tools/node_modules/undici/docs/docs/api/Client.md +538 -0
  147. package/skill/tools/node_modules/undici/docs/docs/api/ClientStats.md +93 -0
  148. package/skill/tools/node_modules/undici/docs/docs/api/Connector.md +198 -0
  149. package/skill/tools/node_modules/undici/docs/docs/api/ContentType.md +97 -0
  150. package/skill/tools/node_modules/undici/docs/docs/api/Cookies.md +179 -0
  151. package/skill/tools/node_modules/undici/docs/docs/api/Debug.md +78 -0
  152. package/skill/tools/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +518 -0
  153. package/skill/tools/node_modules/undici/docs/docs/api/Dispatcher.md +842 -0
  154. package/skill/tools/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +171 -0
  155. package/skill/tools/node_modules/undici/docs/docs/api/Errors.md +624 -0
  156. package/skill/tools/node_modules/undici/docs/docs/api/EventSource.md +358 -0
  157. package/skill/tools/node_modules/undici/docs/docs/api/Fetch.md +721 -0
  158. package/skill/tools/node_modules/undici/docs/docs/api/GlobalInstallation.md +121 -0
  159. package/skill/tools/node_modules/undici/docs/docs/api/H2CClient.md +386 -0
  160. package/skill/tools/node_modules/undici/docs/docs/api/Interceptors.md +439 -0
  161. package/skill/tools/node_modules/undici/docs/docs/api/MockAgent.md +622 -0
  162. package/skill/tools/node_modules/undici/docs/docs/api/MockCallHistory.md +371 -0
  163. package/skill/tools/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +206 -0
  164. package/skill/tools/node_modules/undici/docs/docs/api/MockClient.md +199 -0
  165. package/skill/tools/node_modules/undici/docs/docs/api/MockErrors.md +63 -0
  166. package/skill/tools/node_modules/undici/docs/docs/api/MockPool.md +618 -0
  167. package/skill/tools/node_modules/undici/docs/docs/api/Pool.md +278 -0
  168. package/skill/tools/node_modules/undici/docs/docs/api/PoolStats.md +141 -0
  169. package/skill/tools/node_modules/undici/docs/docs/api/ProxyAgent.md +248 -0
  170. package/skill/tools/node_modules/undici/docs/docs/api/RedirectHandler.md +279 -0
  171. package/skill/tools/node_modules/undici/docs/docs/api/RetryAgent.md +136 -0
  172. package/skill/tools/node_modules/undici/docs/docs/api/RetryHandler.md +200 -0
  173. package/skill/tools/node_modules/undici/docs/docs/api/RoundRobinPool.md +239 -0
  174. package/skill/tools/node_modules/undici/docs/docs/api/SnapshotAgent.md +361 -0
  175. package/skill/tools/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +256 -0
  176. package/skill/tools/node_modules/undici/docs/docs/api/Util.md +82 -0
  177. package/skill/tools/node_modules/undici/docs/docs/api/WebSocket.md +536 -0
  178. package/skill/tools/node_modules/undici/docs/docs/api/api-lifecycle.md +159 -0
  179. package/skill/tools/node_modules/undici/docs/docs/best-practices/client-certificate.md +66 -0
  180. package/skill/tools/node_modules/undici/docs/docs/best-practices/crawling.md +60 -0
  181. package/skill/tools/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +233 -0
  182. package/skill/tools/node_modules/undici/docs/docs/best-practices/mocking-request.md +192 -0
  183. package/skill/tools/node_modules/undici/docs/docs/best-practices/proxy.md +129 -0
  184. package/skill/tools/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +226 -0
  185. package/skill/tools/node_modules/undici/docs/docs/best-practices/writing-tests.md +65 -0
  186. package/skill/tools/node_modules/undici/docs/docs/getting-started.md +281 -0
  187. package/skill/tools/node_modules/undici/docs/docs/index.md +793 -0
  188. package/skill/tools/node_modules/undici/docs/docs/site.json +125 -0
  189. package/skill/tools/node_modules/undici/docs/docs/type-map.json +79 -0
  190. package/skill/tools/node_modules/undici/index-fetch.js +65 -0
  191. package/skill/tools/node_modules/undici/index.d.ts +3 -0
  192. package/skill/tools/node_modules/undici/index.js +236 -0
  193. package/skill/tools/node_modules/undici/lib/api/abort-signal.js +59 -0
  194. package/skill/tools/node_modules/undici/lib/api/api-connect.js +112 -0
  195. package/skill/tools/node_modules/undici/lib/api/api-pipeline.js +265 -0
  196. package/skill/tools/node_modules/undici/lib/api/api-request.js +244 -0
  197. package/skill/tools/node_modules/undici/lib/api/api-stream.js +270 -0
  198. package/skill/tools/node_modules/undici/lib/api/api-upgrade.js +121 -0
  199. package/skill/tools/node_modules/undici/lib/api/index.js +7 -0
  200. package/skill/tools/node_modules/undici/lib/api/readable.js +615 -0
  201. package/skill/tools/node_modules/undici/lib/cache/memory-cache-store.js +314 -0
  202. package/skill/tools/node_modules/undici/lib/cache/sqlite-cache-store.js +593 -0
  203. package/skill/tools/node_modules/undici/lib/core/connect.js +198 -0
  204. package/skill/tools/node_modules/undici/lib/core/constants.js +131 -0
  205. package/skill/tools/node_modules/undici/lib/core/diagnostics.js +227 -0
  206. package/skill/tools/node_modules/undici/lib/core/errors.js +534 -0
  207. package/skill/tools/node_modules/undici/lib/core/request.js +582 -0
  208. package/skill/tools/node_modules/undici/lib/core/socks5-client.js +422 -0
  209. package/skill/tools/node_modules/undici/lib/core/socks5-utils.js +212 -0
  210. package/skill/tools/node_modules/undici/lib/core/symbols.js +81 -0
  211. package/skill/tools/node_modules/undici/lib/core/tree.js +160 -0
  212. package/skill/tools/node_modules/undici/lib/core/util.js +1035 -0
  213. package/skill/tools/node_modules/undici/lib/dispatcher/agent.js +181 -0
  214. package/skill/tools/node_modules/undici/lib/dispatcher/balanced-pool.js +217 -0
  215. package/skill/tools/node_modules/undici/lib/dispatcher/client-h1.js +1846 -0
  216. package/skill/tools/node_modules/undici/lib/dispatcher/client-h2.js +1989 -0
  217. package/skill/tools/node_modules/undici/lib/dispatcher/client.js +749 -0
  218. package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher-base.js +198 -0
  219. package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher.js +58 -0
  220. package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +127 -0
  221. package/skill/tools/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +190 -0
  222. package/skill/tools/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  223. package/skill/tools/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  224. package/skill/tools/node_modules/undici/lib/dispatcher/parser-h1.js +1065 -0
  225. package/skill/tools/node_modules/undici/lib/dispatcher/pool-base.js +347 -0
  226. package/skill/tools/node_modules/undici/lib/dispatcher/pool.js +229 -0
  227. package/skill/tools/node_modules/undici/lib/dispatcher/proxy-agent.js +418 -0
  228. package/skill/tools/node_modules/undici/lib/dispatcher/retry-agent.js +48 -0
  229. package/skill/tools/node_modules/undici/lib/dispatcher/round-robin-pool.js +169 -0
  230. package/skill/tools/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +350 -0
  231. package/skill/tools/node_modules/undici/lib/encoding/index.js +33 -0
  232. package/skill/tools/node_modules/undici/lib/global.js +82 -0
  233. package/skill/tools/node_modules/undici/lib/handler/cache-handler.js +1222 -0
  234. package/skill/tools/node_modules/undici/lib/handler/cache-revalidation-handler.js +134 -0
  235. package/skill/tools/node_modules/undici/lib/handler/decorator-handler.js +76 -0
  236. package/skill/tools/node_modules/undici/lib/handler/deduplication-handler.js +540 -0
  237. package/skill/tools/node_modules/undici/lib/handler/redirect-handler.js +284 -0
  238. package/skill/tools/node_modules/undici/lib/handler/retry-handler.js +686 -0
  239. package/skill/tools/node_modules/undici/lib/interceptor/cache.js +771 -0
  240. package/skill/tools/node_modules/undici/lib/interceptor/decompress.js +574 -0
  241. package/skill/tools/node_modules/undici/lib/interceptor/deduplicate.js +118 -0
  242. package/skill/tools/node_modules/undici/lib/interceptor/dns.js +593 -0
  243. package/skill/tools/node_modules/undici/lib/interceptor/dump.js +99 -0
  244. package/skill/tools/node_modules/undici/lib/interceptor/redirect.js +21 -0
  245. package/skill/tools/node_modules/undici/lib/interceptor/response-error.js +139 -0
  246. package/skill/tools/node_modules/undici/lib/interceptor/retry.js +19 -0
  247. package/skill/tools/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
  248. package/skill/tools/node_modules/undici/lib/llhttp/constants.js +531 -0
  249. package/skill/tools/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  250. package/skill/tools/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  251. package/skill/tools/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
  252. package/skill/tools/node_modules/undici/lib/llhttp/utils.js +12 -0
  253. package/skill/tools/node_modules/undici/lib/milo/LICENSE.md +7 -0
  254. package/skill/tools/node_modules/undici/lib/milo/no-simd.js +1002 -0
  255. package/skill/tools/node_modules/undici/lib/milo/simd.js +1002 -0
  256. package/skill/tools/node_modules/undici/lib/mock/mock-agent.js +255 -0
  257. package/skill/tools/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  258. package/skill/tools/node_modules/undici/lib/mock/mock-client.js +68 -0
  259. package/skill/tools/node_modules/undici/lib/mock/mock-errors.js +29 -0
  260. package/skill/tools/node_modules/undici/lib/mock/mock-interceptor.js +227 -0
  261. package/skill/tools/node_modules/undici/lib/mock/mock-pool.js +68 -0
  262. package/skill/tools/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  263. package/skill/tools/node_modules/undici/lib/mock/mock-utils.js +730 -0
  264. package/skill/tools/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  265. package/skill/tools/node_modules/undici/lib/mock/snapshot-agent.js +371 -0
  266. package/skill/tools/node_modules/undici/lib/mock/snapshot-recorder.js +624 -0
  267. package/skill/tools/node_modules/undici/lib/mock/snapshot-utils.js +159 -0
  268. package/skill/tools/node_modules/undici/lib/util/cache.js +764 -0
  269. package/skill/tools/node_modules/undici/lib/util/date.js +670 -0
  270. package/skill/tools/node_modules/undici/lib/util/runtime-features.js +93 -0
  271. package/skill/tools/node_modules/undici/lib/util/stats.js +32 -0
  272. package/skill/tools/node_modules/undici/lib/util/timers.js +425 -0
  273. package/skill/tools/node_modules/undici/lib/web/cache/cache.js +871 -0
  274. package/skill/tools/node_modules/undici/lib/web/cache/cachestorage.js +158 -0
  275. package/skill/tools/node_modules/undici/lib/web/cache/util.js +45 -0
  276. package/skill/tools/node_modules/undici/lib/web/cookies/constants.js +12 -0
  277. package/skill/tools/node_modules/undici/lib/web/cookies/index.js +211 -0
  278. package/skill/tools/node_modules/undici/lib/web/cookies/parse.js +318 -0
  279. package/skill/tools/node_modules/undici/lib/web/cookies/util.js +371 -0
  280. package/skill/tools/node_modules/undici/lib/web/eventsource/eventsource-stream.js +575 -0
  281. package/skill/tools/node_modules/undici/lib/web/eventsource/eventsource.js +547 -0
  282. package/skill/tools/node_modules/undici/lib/web/eventsource/util.js +60 -0
  283. package/skill/tools/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  284. package/skill/tools/node_modules/undici/lib/web/fetch/body.js +583 -0
  285. package/skill/tools/node_modules/undici/lib/web/fetch/constants.js +131 -0
  286. package/skill/tools/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  287. package/skill/tools/node_modules/undici/lib/web/fetch/formdata-parser.js +594 -0
  288. package/skill/tools/node_modules/undici/lib/web/fetch/formdata.js +272 -0
  289. package/skill/tools/node_modules/undici/lib/web/fetch/global.js +40 -0
  290. package/skill/tools/node_modules/undici/lib/web/fetch/headers.js +722 -0
  291. package/skill/tools/node_modules/undici/lib/web/fetch/index.js +2451 -0
  292. package/skill/tools/node_modules/undici/lib/web/fetch/request.js +1117 -0
  293. package/skill/tools/node_modules/undici/lib/web/fetch/response.js +638 -0
  294. package/skill/tools/node_modules/undici/lib/web/fetch/util.js +1530 -0
  295. package/skill/tools/node_modules/undici/lib/web/infra/index.js +244 -0
  296. package/skill/tools/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  297. package/skill/tools/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  298. package/skill/tools/node_modules/undici/lib/web/webidl/index.js +992 -0
  299. package/skill/tools/node_modules/undici/lib/web/websocket/connection.js +350 -0
  300. package/skill/tools/node_modules/undici/lib/web/websocket/constants.js +126 -0
  301. package/skill/tools/node_modules/undici/lib/web/websocket/events.js +348 -0
  302. package/skill/tools/node_modules/undici/lib/web/websocket/frame.js +127 -0
  303. package/skill/tools/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
  304. package/skill/tools/node_modules/undici/lib/web/websocket/receiver.js +530 -0
  305. package/skill/tools/node_modules/undici/lib/web/websocket/sender.js +109 -0
  306. package/skill/tools/node_modules/undici/lib/web/websocket/stream/websocketerror.js +107 -0
  307. package/skill/tools/node_modules/undici/lib/web/websocket/stream/websocketstream.js +511 -0
  308. package/skill/tools/node_modules/undici/lib/web/websocket/util.js +347 -0
  309. package/skill/tools/node_modules/undici/lib/web/websocket/websocket.js +783 -0
  310. package/skill/tools/node_modules/undici/package.json +154 -0
  311. package/skill/tools/node_modules/undici/scripts/strip-comments.js +10 -0
  312. package/skill/tools/node_modules/undici/types/README.md +6 -0
  313. package/skill/tools/node_modules/undici/types/agent.d.ts +30 -0
  314. package/skill/tools/node_modules/undici/types/api.d.ts +43 -0
  315. package/skill/tools/node_modules/undici/types/balanced-pool.d.ts +30 -0
  316. package/skill/tools/node_modules/undici/types/cache-interceptor.d.ts +189 -0
  317. package/skill/tools/node_modules/undici/types/cache.d.ts +36 -0
  318. package/skill/tools/node_modules/undici/types/client-stats.d.ts +15 -0
  319. package/skill/tools/node_modules/undici/types/client.d.ts +190 -0
  320. package/skill/tools/node_modules/undici/types/connector.d.ts +37 -0
  321. package/skill/tools/node_modules/undici/types/content-type.d.ts +21 -0
  322. package/skill/tools/node_modules/undici/types/cookies.d.ts +30 -0
  323. package/skill/tools/node_modules/undici/types/diagnostics-channel.d.ts +75 -0
  324. package/skill/tools/node_modules/undici/types/dispatcher.d.ts +253 -0
  325. package/skill/tools/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
  326. package/skill/tools/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
  327. package/skill/tools/node_modules/undici/types/errors.d.ts +202 -0
  328. package/skill/tools/node_modules/undici/types/eventsource.d.ts +66 -0
  329. package/skill/tools/node_modules/undici/types/fetch.d.ts +235 -0
  330. package/skill/tools/node_modules/undici/types/formdata.d.ts +108 -0
  331. package/skill/tools/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  332. package/skill/tools/node_modules/undici/types/global-origin.d.ts +7 -0
  333. package/skill/tools/node_modules/undici/types/h2c-client.d.ts +73 -0
  334. package/skill/tools/node_modules/undici/types/handlers.d.ts +16 -0
  335. package/skill/tools/node_modules/undici/types/header.d.ts +165 -0
  336. package/skill/tools/node_modules/undici/types/index.d.ts +93 -0
  337. package/skill/tools/node_modules/undici/types/interceptors.d.ts +87 -0
  338. package/skill/tools/node_modules/undici/types/mock-agent.d.ts +69 -0
  339. package/skill/tools/node_modules/undici/types/mock-call-history.d.ts +111 -0
  340. package/skill/tools/node_modules/undici/types/mock-client.d.ts +27 -0
  341. package/skill/tools/node_modules/undici/types/mock-errors.d.ts +12 -0
  342. package/skill/tools/node_modules/undici/types/mock-interceptor.d.ts +98 -0
  343. package/skill/tools/node_modules/undici/types/mock-pool.d.ts +27 -0
  344. package/skill/tools/node_modules/undici/types/patch.d.ts +29 -0
  345. package/skill/tools/node_modules/undici/types/pool-stats.d.ts +19 -0
  346. package/skill/tools/node_modules/undici/types/pool.d.ts +39 -0
  347. package/skill/tools/node_modules/undici/types/proxy-agent.d.ts +36 -0
  348. package/skill/tools/node_modules/undici/types/readable.d.ts +68 -0
  349. package/skill/tools/node_modules/undici/types/retry-agent.d.ts +8 -0
  350. package/skill/tools/node_modules/undici/types/retry-handler.d.ts +125 -0
  351. package/skill/tools/node_modules/undici/types/round-robin-pool.d.ts +39 -0
  352. package/skill/tools/node_modules/undici/types/snapshot-agent.d.ts +113 -0
  353. package/skill/tools/node_modules/undici/types/socks5-proxy-agent.d.ts +27 -0
  354. package/skill/tools/node_modules/undici/types/util.d.ts +18 -0
  355. package/skill/tools/node_modules/undici/types/utility.d.ts +7 -0
  356. package/skill/tools/node_modules/undici/types/webidl.d.ts +352 -0
  357. package/skill/tools/node_modules/undici/types/websocket.d.ts +188 -0
  358. package/skill/tools/node_modules/xtend/.jshintrc +30 -0
  359. package/skill/tools/node_modules/xtend/LICENSE +20 -0
  360. package/skill/tools/node_modules/xtend/README.md +32 -0
  361. package/skill/tools/node_modules/xtend/immutable.js +19 -0
  362. package/skill/tools/node_modules/xtend/mutable.js +17 -0
  363. package/skill/tools/node_modules/xtend/package.json +55 -0
  364. package/skill/tools/node_modules/xtend/test.js +103 -0
  365. package/skill/tools/package-lock.json +172 -0
  366. package/skill/tools/package.json +9 -0
  367. package/skill/tools/transfer_core.js +414 -0
@@ -0,0 +1,536 @@
1
+ # WebSocket
2
+
3
+ <!--introduced_in=v5.15.0-->
4
+ <!--type=module-->
5
+ <!-- source_link=lib/web/websocket/websocket.js -->
6
+
7
+ > Stability: 2 - Stable
8
+
9
+ The `WebSocket` API provides a way to manage a WebSocket connection to a
10
+ server, allowing bidirectional communication. It follows the
11
+ [WHATWG WebSocket specification][] and [RFC 6455][], and is intended to be
12
+ interchangeable with the global `WebSocket` available in browsers.
13
+
14
+ ```mjs
15
+ import { WebSocket } from 'undici'
16
+
17
+ const ws = new WebSocket('wss://echo.websocket.events')
18
+
19
+ ws.addEventListener('open', () => {
20
+ ws.send('Hello, world!')
21
+ })
22
+
23
+ ws.addEventListener('message', (event) => {
24
+ console.log('received:', event.data)
25
+ })
26
+ ```
27
+
28
+ In addition to the standard `WebSocket` interface, this module exports the
29
+ streams-based [`WebSocketStream`][] and [`WebSocketError`][] APIs, as well as a
30
+ [`ping()`][] helper for sending ping frames.
31
+
32
+ ## Class: `WebSocket`
33
+
34
+ <!-- YAML
35
+ added: v5.15.0
36
+ -->
37
+
38
+ * Extends: {EventTarget}
39
+
40
+ The `WebSocket` object represents a single WebSocket connection. Constructing a
41
+ `WebSocket` immediately begins the opening handshake; the connection cannot be
42
+ reused once it has been closed.
43
+
44
+ ### `new WebSocket(url[, protocols])`
45
+
46
+ <!-- YAML
47
+ added: v5.15.0
48
+ -->
49
+
50
+ * `url` {URL|string} The URL of the server to connect to. Must use the `ws:`
51
+ or `wss:` scheme.
52
+ * `protocols` {string|string[]|WebSocketInit} A single subprotocol, a list of
53
+ subprotocols to negotiate with the server, or a `WebSocketInit` object.
54
+ **Default:** `[]`.
55
+ * `protocols` {string|string[]} Subprotocol(s) to request the server use.
56
+ **Default:** `[]`.
57
+ * `dispatcher` {Dispatcher} The dispatcher used to open the connection.
58
+ **Default:** the global dispatcher.
59
+ * `headers` {HeadersInit|null} Additional headers to send with the handshake
60
+ request. (optional)
61
+
62
+ Creates a new `WebSocket` and begins connecting to `url`. The second argument
63
+ may be a string or array of subprotocols, or a `WebSocketInit` object. The
64
+ object form is an undici extension and is not available in browsers; it allows a
65
+ custom `dispatcher` and additional `headers` to be supplied.
66
+
67
+ If a value in `protocols` is repeated or is not a valid subprotocol name, the
68
+ constructor throws a `SyntaxError` `DOMException`.
69
+
70
+ ```mjs
71
+ import { WebSocket } from 'undici'
72
+
73
+ const ws = new WebSocket('wss://echo.websocket.events', ['echo', 'chat'])
74
+ ```
75
+
76
+ To route the connection through a custom dispatcher, such as a
77
+ [`ProxyAgent`][], pass a `WebSocketInit` object:
78
+
79
+ ```mjs
80
+ import { WebSocket, ProxyAgent } from 'undici'
81
+
82
+ const dispatcher = new ProxyAgent('http://localhost:8080')
83
+
84
+ const ws = new WebSocket('wss://echo.websocket.events', {
85
+ dispatcher,
86
+ protocols: ['echo', 'chat']
87
+ })
88
+ ```
89
+
90
+ WebSocket over HTTP/2 is experimental and may change in the future. It can be
91
+ enabled by passing a dispatcher configured with `allowH2`:
92
+
93
+ ```mjs
94
+ import { WebSocket, Agent } from 'undici'
95
+
96
+ const dispatcher = new Agent({ allowH2: true })
97
+
98
+ const ws = new WebSocket('wss://echo.websocket.events', {
99
+ dispatcher,
100
+ protocols: ['echo', 'chat']
101
+ })
102
+ ```
103
+
104
+ ### `websocket.close([code[, reason]])`
105
+
106
+ <!-- YAML
107
+ added: v5.15.0
108
+ -->
109
+
110
+ * `code` {number} The status code explaining why the connection is being
111
+ closed. **Default:** `null`.
112
+ * `reason` {string} A human-readable string explaining why the connection is
113
+ being closed. **Default:** `''`.
114
+
115
+ Starts the closing handshake. The `code` is clamped to an unsigned 16-bit
116
+ integer; when omitted, no status code is sent. The `reason` is encoded as
117
+ UTF-8 and must not exceed 123 bytes.
118
+
119
+ ```mjs
120
+ ws.close(1000, 'Done')
121
+ ```
122
+
123
+ ### `websocket.send(data)`
124
+
125
+ <!-- YAML
126
+ added: v5.15.0
127
+ -->
128
+
129
+ * `data` {string|ArrayBuffer|TypedArray|DataView|Blob} The data to enqueue for
130
+ transmission.
131
+
132
+ Enqueues `data` to be transmitted to the server. String data is sent as a text
133
+ frame; `ArrayBuffer`, any `TypedArray`, `DataView`, and `Blob` values are sent
134
+ as binary frames. The number of bytes queued is added to
135
+ [`websocket.bufferedAmount`][].
136
+
137
+ If [`websocket.readyState`][] is `CONNECTING`, an `InvalidStateError`
138
+ `DOMException` is thrown. If the connection is closing or already closed, the
139
+ call is silently ignored.
140
+
141
+ ```mjs
142
+ ws.send('a text message')
143
+ ws.send(new Uint8Array([1, 2, 3]))
144
+ ```
145
+
146
+ ### `websocket.readyState`
147
+
148
+ <!-- YAML
149
+ added: v5.15.0
150
+ -->
151
+
152
+ * Type: {number}
153
+
154
+ The current state of the connection. One of the numeric constants
155
+ `WebSocket.CONNECTING` (`0`), `WebSocket.OPEN` (`1`),
156
+ `WebSocket.CLOSING` (`2`), or `WebSocket.CLOSED` (`3`). This property is
157
+ read-only.
158
+
159
+ ### `websocket.bufferedAmount`
160
+
161
+ <!-- YAML
162
+ added: v5.15.0
163
+ -->
164
+
165
+ * Type: {number}
166
+
167
+ The number of bytes of data that have been queued using
168
+ [`websocket.send()`][] but not yet transmitted to the network. This value
169
+ resets to `0` once all queued data is sent. This property is read-only.
170
+
171
+ ### `websocket.url`
172
+
173
+ <!-- YAML
174
+ added: v5.15.0
175
+ -->
176
+
177
+ * Type: {string}
178
+
179
+ The absolute URL of the WebSocket as resolved during construction. This
180
+ property is read-only.
181
+
182
+ ### `websocket.extensions`
183
+
184
+ <!-- YAML
185
+ added: v5.15.0
186
+ -->
187
+
188
+ * Type: {string}
189
+
190
+ The extensions negotiated by the server, taken from the
191
+ `Sec-WebSocket-Extensions` response header. Empty until the connection is
192
+ established. This property is read-only.
193
+
194
+ ### `websocket.protocol`
195
+
196
+ <!-- YAML
197
+ added: v5.15.0
198
+ -->
199
+
200
+ * Type: {string}
201
+
202
+ The subprotocol selected by the server, taken from the
203
+ `Sec-WebSocket-Protocol` response header. Empty until the connection is
204
+ established and only set when a subprotocol was negotiated. This property is
205
+ read-only.
206
+
207
+ ### `websocket.binaryType`
208
+
209
+ <!-- YAML
210
+ added: v5.15.0
211
+ -->
212
+
213
+ * Type: {string} **Default:** `'blob'`.
214
+
215
+ Controls the type used to represent binary data delivered by the
216
+ [`'message'`][] event. Must be either `'blob'` (binary frames are exposed as a
217
+ `Blob`) or `'arraybuffer'` (binary frames are exposed as an `ArrayBuffer`).
218
+ Assigning any other value resets it to `'blob'`.
219
+
220
+ ### `websocket.onopen`
221
+
222
+ <!-- YAML
223
+ added: v5.15.0
224
+ -->
225
+
226
+ * Type: {Function|null} **Default:** `null`.
227
+
228
+ An event handler for the [`'open'`][] event. Setting this property replaces any
229
+ previously registered `onopen` handler.
230
+
231
+ ### `websocket.onerror`
232
+
233
+ <!-- YAML
234
+ added: v5.15.0
235
+ -->
236
+
237
+ * Type: {Function|null} **Default:** `null`.
238
+
239
+ An event handler for the [`'error'`][] event. Setting this property replaces any
240
+ previously registered `onerror` handler.
241
+
242
+ ### `websocket.onclose`
243
+
244
+ <!-- YAML
245
+ added: v5.15.0
246
+ -->
247
+
248
+ * Type: {Function|null} **Default:** `null`.
249
+
250
+ An event handler for the [`'close'`][] event. Setting this property replaces any
251
+ previously registered `onclose` handler.
252
+
253
+ ### `websocket.onmessage`
254
+
255
+ <!-- YAML
256
+ added: v5.15.0
257
+ -->
258
+
259
+ * Type: {Function|null} **Default:** `null`.
260
+
261
+ An event handler for the [`'message'`][] event. Setting this property replaces
262
+ any previously registered `onmessage` handler.
263
+
264
+ ### Event: `'open'`
265
+
266
+ <!-- YAML
267
+ added: v5.21.0
268
+ -->
269
+
270
+ Emitted when the WebSocket connection is established. After this event,
271
+ [`websocket.readyState`][] is `OPEN` and data may be sent with
272
+ [`websocket.send()`][]. The listener receives an `Event`.
273
+
274
+ ### Event: `'message'`
275
+
276
+ <!-- YAML
277
+ added: v7.0.0
278
+ -->
279
+
280
+ Emitted when a message is received from the server. The listener receives a
281
+ `MessageEvent` whose `data` property is a `string` for text frames, and either a
282
+ `Blob` or an `ArrayBuffer` for binary frames depending on
283
+ [`websocket.binaryType`][]. The event's `origin` is the origin of
284
+ [`websocket.url`][].
285
+
286
+ ### Event: `'error'`
287
+
288
+ <!-- YAML
289
+ added: v7.0.0
290
+ -->
291
+
292
+ Emitted when the connection is terminated abnormally, for example when no close
293
+ frame was received before the underlying transport was lost. The listener
294
+ receives an `ErrorEvent`.
295
+
296
+ ### Event: `'close'`
297
+
298
+ <!-- YAML
299
+ added: v7.0.0
300
+ -->
301
+
302
+ Emitted when the connection is closed. The listener receives a `CloseEvent`
303
+ whose `code` and `reason` describe why the connection closed, and whose
304
+ `wasClean` property is `true` only when the closing handshake completed in both
305
+ directions.
306
+
307
+ ## `ping(websocket[, payload])`
308
+
309
+ <!-- YAML
310
+ added: v7.12.0
311
+ -->
312
+
313
+ * `websocket` {WebSocket} The WebSocket to send the ping frame on.
314
+ * `payload` {Buffer} Optional payload to include in the ping frame. Must not
315
+ exceed 125 bytes. **Default:** `undefined`.
316
+
317
+ Sends a ping control frame to the server. A conforming server replies with a
318
+ pong frame containing the same payload, which can be used to keep the connection
319
+ alive or to verify that it is still active.
320
+
321
+ The frame is only sent when the connection is open; if it is connecting,
322
+ closing, or closed, the call is a no-op. A `TypeError` is thrown if `payload`
323
+ is not a `Buffer` or is larger than 125 bytes.
324
+
325
+ ```mjs
326
+ import { WebSocket, ping } from 'undici'
327
+
328
+ const ws = new WebSocket('wss://echo.websocket.events')
329
+
330
+ ws.addEventListener('open', () => {
331
+ ping(ws)
332
+ ping(ws, Buffer.from('hello'))
333
+ })
334
+ ```
335
+
336
+ ## Class: `WebSocketStream`
337
+
338
+ <!-- YAML
339
+ added: v7.0.0
340
+ -->
341
+
342
+ > Stability: 1 - Experimental
343
+
344
+ `WebSocketStream` is a streams-based alternative to the event-based
345
+ [`WebSocket`][] interface, exposing a connection as a pair of `ReadableStream`
346
+ and `WritableStream` objects. See [MDN][MDN WebSocketStream] for background.
347
+
348
+ Constructing a `WebSocketStream` for the first time emits an
349
+ `ExperimentalWarning` with the code `UNDICI-WSS`.
350
+
351
+ ### `new WebSocketStream(url[, options])`
352
+
353
+ <!-- YAML
354
+ added: v7.0.0
355
+ -->
356
+
357
+ > Stability: 1 - Experimental
358
+
359
+ * `url` {URL|string} The URL of the server to connect to.
360
+ * `options` {WebSocketStreamOptions}
361
+ * `protocols` {string|string[]} Subprotocol(s) to request the server use.
362
+ **Default:** `[]`.
363
+ * `signal` {AbortSignal|null} An `AbortSignal` that aborts the opening
364
+ handshake and rejects [`webSocketStream.opened`][] and
365
+ [`webSocketStream.closed`][] when triggered. **Default:** `null`.
366
+
367
+ Creates a new `WebSocketStream` and begins connecting to `url`. As with
368
+ [`new WebSocket()`][], a repeated or invalid subprotocol causes a `SyntaxError`
369
+ `DOMException` to be thrown.
370
+
371
+ ```mjs
372
+ import { WebSocketStream } from 'undici'
373
+
374
+ const stream = new WebSocketStream('wss://echo.websocket.events')
375
+ const { readable, writable } = await stream.opened
376
+
377
+ const writer = writable.getWriter()
378
+ await writer.write('Hello, world!')
379
+ writer.releaseLock()
380
+
381
+ const reader = readable.getReader()
382
+ const { value } = await reader.read()
383
+ console.log('received:', value)
384
+ ```
385
+
386
+ ### `webSocketStream.url`
387
+
388
+ <!-- YAML
389
+ added: v5.15.0
390
+ -->
391
+
392
+ > Stability: 1 - Experimental
393
+
394
+ * Type: {string}
395
+
396
+ The serialized URL of the WebSocket. This property is read-only.
397
+
398
+ ### `webSocketStream.opened`
399
+
400
+ <!-- YAML
401
+ added: v5.15.0
402
+ -->
403
+
404
+ > Stability: 1 - Experimental
405
+
406
+ * Type: {Promise} Fulfills once the connection is established.
407
+
408
+ A promise that resolves with an object describing the open connection, or
409
+ rejects if the connection could not be established. The fulfillment value has
410
+ the following shape:
411
+
412
+ * `extensions` {string} The negotiated extensions.
413
+ * `protocol` {string} The negotiated subprotocol.
414
+ * `readable` {ReadableStream} A stream of incoming messages. Text frames are
415
+ delivered as strings and binary frames as `Uint8Array` chunks.
416
+ * `writable` {WritableStream} A stream for sending messages. Writing a string
417
+ sends a text frame; writing a `BufferSource` sends a binary frame.
418
+
419
+ ### `webSocketStream.closed`
420
+
421
+ <!-- YAML
422
+ added: v5.15.0
423
+ -->
424
+
425
+ > Stability: 1 - Experimental
426
+
427
+ * Type: {Promise} Fulfills once the connection is closed cleanly.
428
+
429
+ A promise that resolves with a `WebSocketCloseInfo` object when the connection
430
+ closes cleanly, or rejects with a [`WebSocketError`][] when it closes
431
+ abnormally. The fulfillment value has the following shape:
432
+
433
+ * `closeCode` {number} The status code the connection was closed with.
434
+ * `reason` {string} The reason the connection was closed with.
435
+
436
+ ### `webSocketStream.close([closeInfo])`
437
+
438
+ <!-- YAML
439
+ added: v5.15.0
440
+ -->
441
+
442
+ > Stability: 1 - Experimental
443
+
444
+ * `closeInfo` {Object}
445
+ * `closeCode` {number} The status code to close with.
446
+ * `reason` {string} The reason to close with. **Default:** `''`.
447
+
448
+ Starts the closing handshake. When `closeInfo` is omitted, the connection is
449
+ closed without a status code.
450
+
451
+ ## Class: `WebSocketError`
452
+
453
+ <!-- YAML
454
+ added: v7.0.0
455
+ -->
456
+
457
+ > Stability: 1 - Experimental
458
+
459
+ * Extends: {DOMException}
460
+
461
+ An error type used by [`WebSocketStream`][] to report close information. It is
462
+ used to reject [`webSocketStream.closed`][] when the connection closes
463
+ abnormally, and may be passed to a stream's abort or cancel operations to close
464
+ the connection with a specific code and reason.
465
+
466
+ ### `new WebSocketError([message[, init]])`
467
+
468
+ <!-- YAML
469
+ added: v7.0.0
470
+ -->
471
+
472
+ > Stability: 1 - Experimental
473
+
474
+ * `message` {string} A human-readable description of the error.
475
+ **Default:** `''`.
476
+ * `init` {Object}
477
+ * `closeCode` {number} The status code to associate with the error.
478
+ * `reason` {string} The reason to associate with the error.
479
+ **Default:** `''`.
480
+
481
+ Creates a new `WebSocketError`. If `reason` is non-empty but no `closeCode` is
482
+ given, `closeCode` defaults to `1000` ("Normal Closure"). The `closeCode` and
483
+ `reason` are validated, so an out-of-range code or an over-long reason throws.
484
+
485
+ ### `webSocketError.closeCode`
486
+
487
+ <!-- YAML
488
+ added: v5.15.0
489
+ -->
490
+
491
+ > Stability: 1 - Experimental
492
+
493
+ * Type: {number|null}
494
+
495
+ The status code associated with the error, or `null` if none was set. This
496
+ property is read-only.
497
+
498
+ ### `webSocketError.reason`
499
+
500
+ <!-- YAML
501
+ added: v5.15.0
502
+ -->
503
+
504
+ > Stability: 1 - Experimental
505
+
506
+ * Type: {string}
507
+
508
+ The reason associated with the error. This property is read-only.
509
+
510
+ ## Read more
511
+
512
+ * [MDN: WebSocket][]
513
+ * [RFC 6455][]
514
+ * [WHATWG WebSocket specification][]
515
+
516
+ [MDN WebSocketStream]: https://developer.mozilla.org/docs/Web/API/WebSocketStream
517
+ [MDN: WebSocket]: https://developer.mozilla.org/docs/Web/API/WebSocket
518
+ [RFC 6455]: https://www.rfc-editor.org/rfc/rfc6455
519
+ [WHATWG WebSocket specification]: https://websockets.spec.whatwg.org/
520
+ [`'close'`]: #event-close
521
+ [`'error'`]: #event-error
522
+ [`'message'`]: #event-message
523
+ [`'open'`]: #event-open
524
+ [`ProxyAgent`]: ProxyAgent.md#class-proxyagent
525
+ [`WebSocket`]: #class-websocket
526
+ [`WebSocketError`]: #class-websocketerror
527
+ [`WebSocketStream`]: #class-websocketstream
528
+ [`new WebSocket()`]: #new-websocketurl-protocols
529
+ [`ping()`]: #pingwebsocket-payload
530
+ [`webSocketStream.closed`]: #websocketstreamclosed
531
+ [`webSocketStream.opened`]: #websocketstreamopened
532
+ [`websocket.bufferedAmount`]: #websocketbufferedamount
533
+ [`websocket.binaryType`]: #websocketbinarytype
534
+ [`websocket.readyState`]: #websocketreadystate
535
+ [`websocket.send()`]: #websocketsenddata
536
+ [`websocket.url`]: #websocketurl
@@ -0,0 +1,159 @@
1
+ # Client Lifecycle
2
+
3
+ <!--type=misc-->
4
+
5
+ A {Client} can be understood as a state machine. As requests are dispatched,
6
+ processed, and drained, the client moves through a well-defined set of states
7
+ until it is eventually destroyed. This document describes those states and the
8
+ transitions between them.
9
+
10
+ The {Client} class is not literally implemented as a state machine, so the
11
+ actual execution may deviate slightly from what is described here. Treat this
12
+ guide as a conceptual model for reasoning about a client's behavior rather than
13
+ as a formal specification.
14
+
15
+ ## State transition overview
16
+
17
+ * A {Client} begins in the **idle** state with no socket connection and no
18
+ queued requests.
19
+ * The *connect* transition moves the {Client} to the **pending** state, where
20
+ requests can be queued before they are processed.
21
+ * Calling [`client.close()`][] or [`client.destroy()`][] moves the {Client}
22
+ to the **destroyed** state. Because there are no queued requests in this
23
+ state, *close* transitions straight to **destroyed**.
24
+ * The **pending** state indicates that the underlying socket connection has been
25
+ established and that requests are queueing.
26
+ * The *process* transition moves the {Client} to the **processing** state,
27
+ where requests are processed.
28
+ * If requests are queued, *close* transitions to **processing**; otherwise it
29
+ transitions to **destroyed**.
30
+ * The *destroy* transition moves the {Client} to **destroyed**.
31
+ * The **processing** state initializes to the **processing.running** sub-state.
32
+ * If the current request body requires draining, *needDrain* moves the
33
+ {Client} into the **processing.busy** sub-state, which returns to
34
+ **processing.running** once *drainComplete* fires.
35
+ * After all queued requests complete, *keepalive* moves the {Client} back to
36
+ the **pending** state. If no requests are queued before the socket times
37
+ out, the {Client} transitions to **idle**.
38
+ * If *close* is fired while the {Client} still has queued requests, the
39
+ {Client} transitions to **processing.closing**, where it completes all
40
+ outstanding requests before firing *done*.
41
+ * The *done* transition moves the {Client} gracefully to **destroyed**.
42
+ * At any time, *destroy* moves the {Client} from **processing** to
43
+ **destroyed**, aborting any queued requests.
44
+ * The **destroyed** state is final; the {Client} is no longer functional.
45
+
46
+ A state diagram representing a {Client} instance:
47
+
48
+ ```mermaid
49
+ stateDiagram-v2
50
+ [*] --> idle
51
+ idle --> pending : connect
52
+ idle --> destroyed : destroy/close
53
+
54
+ pending --> idle : timeout
55
+ pending --> destroyed : destroy
56
+
57
+ state close_fork <<fork>>
58
+ pending --> close_fork : close
59
+ close_fork --> processing
60
+ close_fork --> destroyed
61
+
62
+ pending --> processing : process
63
+
64
+ processing --> pending : keepalive
65
+ processing --> destroyed : done
66
+ processing --> destroyed : destroy
67
+
68
+ destroyed --> [*]
69
+
70
+ state processing {
71
+ [*] --> running
72
+ running --> closing : close
73
+ running --> busy : needDrain
74
+ busy --> running : drainComplete
75
+ running --> [*] : keepalive
76
+ closing --> [*] : done
77
+ }
78
+ ```
79
+
80
+ ## State details
81
+
82
+ ### idle
83
+
84
+ **idle** is the initial state of a {Client} instance. Although an `origin` is
85
+ required to construct a {Client}, the underlying socket connection is not
86
+ established until a request is queued through [`client.dispatch()`][]. Calling
87
+ `client.dispatch()` directly, or through one of its higher-level wrappers
88
+ ([`client.connect()`][], [`client.pipeline()`][], [`client.request()`][],
89
+ [`client.stream()`][], or [`client.upgrade()`][]), moves the {Client} from
90
+ **idle** to **pending**, and then usually directly on to **processing**.
91
+
92
+ Calling [`client.close()`][] or [`client.destroy()`][] in this state moves the
93
+ {Client} straight to **destroyed**, since there are no queued requests.
94
+
95
+ ### pending
96
+
97
+ **pending** signifies a connected but non-processing {Client}. On entering this
98
+ state, the {Client} establishes a socket connection and emits the
99
+ [`'connect'`][] event, signalling that a connection to the `origin` supplied at
100
+ construction time has been established. The internal queue starts empty, and
101
+ requests can begin queueing.
102
+
103
+ Calling [`client.close()`][] with queued requests moves the {Client} to the
104
+ **processing** state; without queued requests it moves to **destroyed**.
105
+
106
+ Calling [`client.destroy()`][] moves the {Client} directly to **destroyed**,
107
+ regardless of any queued requests.
108
+
109
+ ### processing
110
+
111
+ **processing** is itself a sub-state machine that initializes to the
112
+ **processing.running** sub-state. [`client.dispatch()`][], [`client.close()`][],
113
+ and [`client.destroy()`][] can all be called while the {Client} is in this
114
+ state. `client.dispatch()` queues additional requests while existing ones
115
+ continue to be processed, `client.close()` moves the {Client} to the
116
+ **processing.closing** sub-state, and `client.destroy()` moves it to
117
+ **destroyed**.
118
+
119
+ #### running
120
+
121
+ In **processing.running**, queued requests are processed in FIFO order. If a
122
+ request body requires draining, *needDrain* moves the {Client} to the
123
+ **processing.busy** sub-state. The *close* transition moves the {Client} to the
124
+ **processing.closing** sub-state. When all queued requests have completed and
125
+ neither [`client.close()`][] nor [`client.destroy()`][] has been called, the
126
+ *keepalive* transition moves the {Client} back to the **pending** state. There
127
+ the {Client} waits for the socket connection to time out; once it does, the
128
+ {Client} returns to the **idle** state.
129
+
130
+ #### busy
131
+
132
+ This sub-state is entered only when a request body is a {stream.Readable} that
133
+ requires draining. The {Client} cannot process additional requests while in
134
+ this state and waits until the current request body has been fully drained
135
+ before returning to **processing.running**.
136
+
137
+ #### closing
138
+
139
+ This sub-state is entered only when a {Client} has queued requests and
140
+ [`client.close()`][] is called. The {Client} continues to process requests as
141
+ usual, except that no additional requests may be queued. Once all queued
142
+ requests have been processed, *done* fires and the {Client} moves gracefully to
143
+ **destroyed** without an error.
144
+
145
+ ### destroyed
146
+
147
+ **destroyed** is the final state of a {Client} instance. Once in this state, the
148
+ {Client} is no longer functional, and calling any further {Client} method
149
+ rejects or fails with a {ClientDestroyedError}.
150
+
151
+ [`'connect'`]: Client.md#event-connect
152
+ [`client.close()`]: Client.md#clientclosecallback
153
+ [`client.connect()`]: Client.md#clientconnectoptions-callback
154
+ [`client.destroy()`]: Client.md#clientdestroyerror-callback
155
+ [`client.dispatch()`]: Client.md#clientdispatchoptions-handlers
156
+ [`client.pipeline()`]: Client.md#clientpipelineoptions-handler
157
+ [`client.request()`]: Client.md#clientrequestoptions-callback
158
+ [`client.stream()`]: Client.md#clientstreamoptions-factory-callback
159
+ [`client.upgrade()`]: Client.md#clientupgradeoptions-callback