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,198 @@
1
+ 'use strict'
2
+
3
+ const buffer = require('node:buffer')
4
+ const Dispatcher = require('./dispatcher')
5
+ const {
6
+ ClientDestroyedError,
7
+ ClientClosedError,
8
+ InvalidArgumentError
9
+ } = require('../core/errors')
10
+ const { kDestroy, kClose, kClosed, kDestroyed, kDispatch } = require('../core/symbols')
11
+ const { defaultWebSocketMaxFragments, defaultWebSocketMaxPayloadSize } = require('../core/constants')
12
+
13
+ const kOnDestroyed = Symbol('onDestroyed')
14
+ const kOnClosed = Symbol('onClosed')
15
+ const kWebSocketOptions = Symbol('webSocketOptions')
16
+ const kEventSourceOptions = Symbol('eventSourceOptions')
17
+
18
+ class DispatcherBase extends Dispatcher {
19
+ /** @type {boolean} */
20
+ [kDestroyed] = false;
21
+
22
+ /** @type {Array<Function|null} */
23
+ [kOnDestroyed] = null;
24
+
25
+ /** @type {boolean} */
26
+ [kClosed] = false;
27
+
28
+ /** @type {Array<Function>|null} */
29
+ [kOnClosed] = null
30
+
31
+ /**
32
+ * @param {import('../../types/dispatcher').DispatcherOptions} [opts]
33
+ */
34
+ constructor (opts) {
35
+ super()
36
+ this[kWebSocketOptions] = opts?.webSocket ?? {}
37
+ this[kEventSourceOptions] = opts?.eventSource ?? {}
38
+ }
39
+
40
+ /**
41
+ * @returns {import('../../types/client').Client.WebSocketOptions}
42
+ */
43
+ get webSocketOptions () {
44
+ return {
45
+ maxFragments: this[kWebSocketOptions].maxFragments ?? defaultWebSocketMaxFragments,
46
+ maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? defaultWebSocketMaxPayloadSize
47
+ }
48
+ }
49
+
50
+ /**
51
+ * @returns {import('../../types/client').Client.EventSourceOptions}
52
+ */
53
+ get eventSourceOptions () {
54
+ return {
55
+ maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
56
+ }
57
+ }
58
+
59
+ /** @returns {boolean} */
60
+ get destroyed () {
61
+ return this[kDestroyed]
62
+ }
63
+
64
+ /** @returns {boolean} */
65
+ get closed () {
66
+ return this[kClosed]
67
+ }
68
+
69
+ close (callback) {
70
+ if (callback === undefined) {
71
+ return new Promise((resolve, reject) => {
72
+ this.close((err, data) => {
73
+ return err ? reject(err) : resolve(data)
74
+ })
75
+ })
76
+ }
77
+
78
+ if (typeof callback !== 'function') {
79
+ throw new InvalidArgumentError('invalid callback')
80
+ }
81
+
82
+ if (this[kDestroyed]) {
83
+ const err = new ClientDestroyedError()
84
+ queueMicrotask(() => callback(err, null))
85
+ return
86
+ }
87
+
88
+ if (this[kClosed]) {
89
+ if (this[kOnClosed]) {
90
+ this[kOnClosed].push(callback)
91
+ } else {
92
+ queueMicrotask(() => callback(null, null))
93
+ }
94
+ return
95
+ }
96
+
97
+ this[kClosed] = true
98
+ this[kOnClosed] ??= []
99
+ this[kOnClosed].push(callback)
100
+
101
+ const onClosed = () => {
102
+ const callbacks = this[kOnClosed]
103
+ this[kOnClosed] = null
104
+ for (let i = 0; i < callbacks.length; i++) {
105
+ callbacks[i](null, null)
106
+ }
107
+ }
108
+
109
+ // Should not error.
110
+ this[kClose]()
111
+ .then(() => this.destroy())
112
+ .then(() => queueMicrotask(onClosed))
113
+ }
114
+
115
+ destroy (err, callback) {
116
+ if (typeof err === 'function') {
117
+ callback = err
118
+ err = null
119
+ }
120
+
121
+ if (callback === undefined) {
122
+ return new Promise((resolve, reject) => {
123
+ this.destroy(err, (err, data) => {
124
+ return err ? reject(err) : resolve(data)
125
+ })
126
+ })
127
+ }
128
+
129
+ if (typeof callback !== 'function') {
130
+ throw new InvalidArgumentError('invalid callback')
131
+ }
132
+
133
+ if (this[kDestroyed]) {
134
+ if (this[kOnDestroyed]) {
135
+ this[kOnDestroyed].push(callback)
136
+ } else {
137
+ queueMicrotask(() => callback(null, null))
138
+ }
139
+ return
140
+ }
141
+
142
+ if (!err) {
143
+ err = new ClientDestroyedError()
144
+ }
145
+
146
+ this[kDestroyed] = true
147
+ this[kOnDestroyed] ??= []
148
+ this[kOnDestroyed].push(callback)
149
+
150
+ const onDestroyed = () => {
151
+ const callbacks = this[kOnDestroyed]
152
+ this[kOnDestroyed] = null
153
+ for (let i = 0; i < callbacks.length; i++) {
154
+ callbacks[i](null, null)
155
+ }
156
+ }
157
+
158
+ // Should not error.
159
+ this[kDestroy](err)
160
+ .then(() => queueMicrotask(onDestroyed))
161
+ }
162
+
163
+ dispatch (opts, handler) {
164
+ if (!handler || typeof handler !== 'object') {
165
+ throw new InvalidArgumentError('handler must be an object')
166
+ }
167
+
168
+ try {
169
+ if (!opts || typeof opts !== 'object') {
170
+ throw new InvalidArgumentError('opts must be an object.')
171
+ }
172
+
173
+ if (opts.dispatcher) {
174
+ throw new InvalidArgumentError('opts.dispatcher is not supported by instance methods. Pass opts.dispatcher to the top-level undici functions or call the dispatcher instance method directly.')
175
+ }
176
+
177
+ if (this[kDestroyed] || this[kOnDestroyed]) {
178
+ throw new ClientDestroyedError()
179
+ }
180
+
181
+ if (this[kClosed]) {
182
+ throw new ClientClosedError()
183
+ }
184
+
185
+ return this[kDispatch](opts, handler)
186
+ } catch (err) {
187
+ if (typeof handler.onResponseError !== 'function') {
188
+ throw err
189
+ }
190
+
191
+ handler.onResponseError(null, err)
192
+
193
+ return false
194
+ }
195
+ }
196
+ }
197
+
198
+ module.exports = DispatcherBase
@@ -0,0 +1,58 @@
1
+ 'use strict'
2
+ const EventEmitter = require('node:events')
3
+ const { kOriginless, kUrl } = require('../core/symbols')
4
+
5
+ class Dispatcher extends EventEmitter {
6
+ dispatch () {
7
+ throw new Error('not implemented')
8
+ }
9
+
10
+ close () {
11
+ throw new Error('not implemented')
12
+ }
13
+
14
+ destroy () {
15
+ throw new Error('not implemented')
16
+ }
17
+
18
+ compose (...args) {
19
+ // So we handle [interceptor1, interceptor2] or interceptor1, interceptor2, ...
20
+ const interceptors = Array.isArray(args[0]) ? args[0] : args
21
+ // null disables origin-dependent interceptors; undefined uses opts.origin.
22
+ const interceptorOrigin = this[kOriginless] === true
23
+ ? null
24
+ : this[kUrl]?.origin
25
+ let dispatch = this.dispatch.bind(this)
26
+
27
+ for (const interceptor of interceptors) {
28
+ if (interceptor == null) {
29
+ continue
30
+ }
31
+
32
+ if (typeof interceptor !== 'function') {
33
+ throw new TypeError(`invalid interceptor, expected function received ${typeof interceptor}`)
34
+ }
35
+
36
+ dispatch = interceptor(dispatch, interceptorOrigin)
37
+
38
+ if (dispatch == null || typeof dispatch !== 'function' || dispatch.length !== 2) {
39
+ throw new TypeError('invalid interceptor')
40
+ }
41
+ }
42
+
43
+ const originalDispatch = dispatch
44
+ const self = this
45
+ dispatch = function (opts, handler) {
46
+ if (opts && typeof opts === 'object' && !opts.origin && self[kUrl]) {
47
+ opts = Object.assign({}, opts, { origin: self[kUrl].origin })
48
+ }
49
+ return originalDispatch(opts, handler)
50
+ }
51
+
52
+ return new Proxy(this, {
53
+ get: (target, key) => key === 'dispatch' ? dispatch : target[key]
54
+ })
55
+ }
56
+ }
57
+
58
+ module.exports = Dispatcher
@@ -0,0 +1,127 @@
1
+ 'use strict'
2
+
3
+ const Dispatcher = require('./dispatcher')
4
+ const { InvalidArgumentError } = require('../core/errors')
5
+ const { toRawHeaders } = require('../core/util')
6
+ const { kOriginless, kUrl } = require('../core/symbols')
7
+
8
+ class LegacyHandlerWrapper {
9
+ #handler
10
+
11
+ constructor (handler) {
12
+ this.#handler = handler
13
+ }
14
+
15
+ onRequestStart (controller, context) {
16
+ this.#handler.onConnect?.((reason) => controller.abort(reason), context)
17
+ }
18
+
19
+ onRequestUpgrade (controller, statusCode, headers, socket) {
20
+ const rawHeaders = Array.isArray(controller?.rawHeaders)
21
+ ? controller.rawHeaders
22
+ : toRawHeaders(controller?.rawHeaders ?? headers ?? {})
23
+ this.#handler.onUpgrade?.(statusCode, rawHeaders, socket)
24
+ }
25
+
26
+ onResponseStart (controller, statusCode, headers, statusMessage) {
27
+ const rawHeaders = Array.isArray(controller?.rawHeaders)
28
+ ? controller.rawHeaders
29
+ : toRawHeaders(controller?.rawHeaders ?? headers ?? {})
30
+
31
+ if (this.#handler.onHeaders?.(statusCode, rawHeaders, () => controller.resume(), statusMessage) === false) {
32
+ controller.pause()
33
+ }
34
+ }
35
+
36
+ onResponseData (controller, chunk) {
37
+ if (this.#handler.onData?.(chunk) === false) {
38
+ controller.pause()
39
+ }
40
+ }
41
+
42
+ onResponseEnd (controller, trailers) {
43
+ const rawTrailers = Array.isArray(controller?.rawTrailers)
44
+ ? controller.rawTrailers
45
+ : toRawHeaders(controller?.rawTrailers ?? trailers ?? {})
46
+ this.#handler.onComplete?.(rawTrailers)
47
+ }
48
+
49
+ onResponseError (_controller, err) {
50
+ if (!this.#handler.onError) {
51
+ throw err
52
+ }
53
+
54
+ this.#handler.onError(err)
55
+ }
56
+
57
+ onBodySent (chunk) {
58
+ this.#handler.onBodySent?.(chunk)
59
+ }
60
+
61
+ onRequestSent () {
62
+ this.#handler.onRequestSent?.()
63
+ }
64
+
65
+ onResponseStarted () {
66
+ this.#handler.onResponseStarted?.()
67
+ }
68
+ }
69
+
70
+ class Dispatcher1Wrapper extends Dispatcher {
71
+ #dispatcher
72
+
73
+ constructor (dispatcher) {
74
+ super()
75
+
76
+ if (!dispatcher || typeof dispatcher.dispatch !== 'function') {
77
+ throw new InvalidArgumentError('Argument dispatcher must implement dispatch')
78
+ }
79
+
80
+ this.#dispatcher = dispatcher
81
+ this[kUrl] = dispatcher[kUrl]
82
+ this[kOriginless] = dispatcher[kOriginless]
83
+ }
84
+
85
+ static wrapHandler (handler) {
86
+ if (!handler || typeof handler !== 'object') {
87
+ throw new InvalidArgumentError('handler must be an object')
88
+ }
89
+
90
+ if (typeof handler.onRequestStart === 'function') {
91
+ return handler
92
+ }
93
+
94
+ return new LegacyHandlerWrapper(handler)
95
+ }
96
+
97
+ dispatch (opts, handler) {
98
+ // Legacy (v1) consumers do not support HTTP/2, so force HTTP/1.1.
99
+ // See https://github.com/nodejs/undici/issues/4989
100
+ if (opts.allowH2 !== false) {
101
+ opts = { ...opts, allowH2: false }
102
+ }
103
+
104
+ return this.#dispatcher.dispatch(opts, Dispatcher1Wrapper.wrapHandler(handler))
105
+ }
106
+
107
+ // Older undici versions read WebSocket and EventSource receive limits from
108
+ // the (legacy) global dispatcher, which is this wrapper, so report the
109
+ // wrapped dispatcher's settings.
110
+ get webSocketOptions () {
111
+ return this.#dispatcher.webSocketOptions
112
+ }
113
+
114
+ get eventSourceOptions () {
115
+ return this.#dispatcher.eventSourceOptions
116
+ }
117
+
118
+ close (...args) {
119
+ return this.#dispatcher.close(...args)
120
+ }
121
+
122
+ destroy (...args) {
123
+ return this.#dispatcher.destroy(...args)
124
+ }
125
+ }
126
+
127
+ module.exports = Dispatcher1Wrapper
@@ -0,0 +1,190 @@
1
+ 'use strict'
2
+
3
+ const DispatcherBase = require('./dispatcher-base')
4
+ const { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = require('../core/symbols')
5
+ const ProxyAgent = require('./proxy-agent')
6
+ const Agent = require('./agent')
7
+
8
+ const DEFAULT_PORTS = {
9
+ 'http:': 80,
10
+ 'https:': 443
11
+ }
12
+
13
+ class EnvHttpProxyAgent extends DispatcherBase {
14
+ #noProxyValue = null
15
+ #noProxyEntries = null
16
+ #opts = null
17
+
18
+ constructor (opts = {}) {
19
+ super(opts)
20
+ this.#opts = opts
21
+
22
+ const { httpProxy, httpsProxy, noProxy, ...agentOpts } = opts
23
+
24
+ this[kNoProxyAgent] = new Agent(agentOpts)
25
+
26
+ const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY
27
+ if (HTTP_PROXY) {
28
+ this[kHttpProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTP_PROXY })
29
+ } else {
30
+ this[kHttpProxyAgent] = this[kNoProxyAgent]
31
+ }
32
+
33
+ const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY
34
+ if (HTTPS_PROXY) {
35
+ this[kHttpsProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTPS_PROXY })
36
+ } else {
37
+ this[kHttpsProxyAgent] = this[kHttpProxyAgent]
38
+ }
39
+
40
+ this.#parseNoProxy()
41
+ }
42
+
43
+ [kDispatch] (opts, handler) {
44
+ const url = new URL(opts.origin)
45
+ const agent = this.#getProxyAgentForUrl(url)
46
+ return agent.dispatch(opts, handler)
47
+ }
48
+
49
+ [kClose] () {
50
+ return Promise.all([
51
+ this[kNoProxyAgent].close(),
52
+ !this[kHttpProxyAgent][kClosed] && this[kHttpProxyAgent].close(),
53
+ !this[kHttpsProxyAgent][kClosed] && this[kHttpsProxyAgent].close()
54
+ ])
55
+ }
56
+
57
+ [kDestroy] (err) {
58
+ return Promise.all([
59
+ this[kNoProxyAgent].destroy(err),
60
+ !this[kHttpProxyAgent][kDestroyed] && this[kHttpProxyAgent].destroy(err),
61
+ !this[kHttpsProxyAgent][kDestroyed] && this[kHttpsProxyAgent].destroy(err)
62
+ ])
63
+ }
64
+
65
+ #getProxyAgentForUrl (url) {
66
+ let { protocol, host: hostname, port } = url
67
+
68
+ // Remove the port suffix (e.g. ":8080") and then strip surrounding
69
+ // brackets from IPv6 literals (e.g. "[::1]" -> "::1") so that the
70
+ // result matches the unbracketed form stored by #parseNoProxy.
71
+ hostname = hostname.replace(/:\d*$/, '').replace(/^\[(.+)\]$/, '$1').toLowerCase()
72
+ // Drop a trailing dot: it only marks the fully qualified form of a domain
73
+ // name ("example.com." and "example.com" are the same name, RFC 1034 root
74
+ // label). This runs on every dispatch, so it is a charCode check rather
75
+ // than a third regex. `length > 1` leaves the degenerate host "." alone.
76
+ if (hostname.length > 1 && hostname.charCodeAt(hostname.length - 1) === 46) {
77
+ hostname = hostname.slice(0, -1)
78
+ }
79
+ port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0
80
+ if (!this.#shouldProxy(hostname, port)) {
81
+ return this[kNoProxyAgent]
82
+ }
83
+ if (protocol === 'https:') {
84
+ return this[kHttpsProxyAgent]
85
+ }
86
+ return this[kHttpProxyAgent]
87
+ }
88
+
89
+ #shouldProxy (hostname, port) {
90
+ if (this.#noProxyChanged) {
91
+ this.#parseNoProxy()
92
+ }
93
+
94
+ if (this.#noProxyEntries.length === 0) {
95
+ return true // Always proxy if NO_PROXY is not set or empty.
96
+ }
97
+
98
+ for (let i = 0; i < this.#noProxyEntries.length; i++) {
99
+ const entry = this.#noProxyEntries[i]
100
+ // A bare `*` entry matches all hosts regardless of its position or the
101
+ // surrounding whitespace (e.g. ` * ` or `none.invalid,*`). If a port is
102
+ // attached (`*:80`) it only bypasses that port.
103
+ if (entry.hostname === '*') {
104
+ if (entry.port && entry.port !== port) {
105
+ continue
106
+ }
107
+ return false // Never proxy if a wildcard entry is present.
108
+ }
109
+ if (entry.port && entry.port !== port) {
110
+ continue // Skip if ports don't match.
111
+ }
112
+ // Don't proxy if the hostname is equal with the no_proxy host. A
113
+ // `*.example.com` wildcard matches subdomains only, not the apex
114
+ // `example.com`, so exact matches are skipped for wildcard entries.
115
+ if (!entry.wildcard && hostname === entry.hostname) {
116
+ return false
117
+ }
118
+ // Don't proxy if the hostname is the subdomain of the no_proxy host.
119
+ // Reference - https://github.com/denoland/deno/blob/6fbce91e40cc07fc6da74068e5cc56fdd40f7b4c/ext/fetch/proxy.rs#L485
120
+ if (hostname.slice(-(entry.hostname.length + 1)) === `.${entry.hostname}`) {
121
+ return false
122
+ }
123
+ }
124
+
125
+ return true
126
+ }
127
+
128
+ #parseNoProxy () {
129
+ const noProxyValue = this.#opts.noProxy ?? this.#noProxyEnv
130
+ const noProxySplit = noProxyValue.split(/[,\s]/)
131
+ const noProxyEntries = []
132
+
133
+ for (let i = 0; i < noProxySplit.length; i++) {
134
+ const entry = noProxySplit[i]
135
+ if (!entry) {
136
+ continue
137
+ }
138
+
139
+ // An IPv6 entry with a port must be bracketed: [::1]:443.
140
+ // A bare IPv6 address like ::1 contains colons that must not be
141
+ // confused with a host:port separator, so we handle it separately.
142
+ let hostname, port
143
+ const ipv6WithPort = entry.match(/^\[(.+)\]:(\d+)$/)
144
+ if (ipv6WithPort) {
145
+ hostname = ipv6WithPort[1]
146
+ port = Number.parseInt(ipv6WithPort[2], 10)
147
+ } else {
148
+ // Bracketed IPv6 without port, or plain hostname[:port], or bare IPv6.
149
+ // Strip optional brackets first.
150
+ const unbracketed = entry.replace(/^\[(.+)\]$/, '$1')
151
+ // A bare IPv6 address contains multiple colons; a hostname:port entry
152
+ // has exactly one colon followed by digits. Only attempt host:port
153
+ // splitting when that is unambiguously the case.
154
+ const colonCount = (unbracketed.match(/:/g) || []).length
155
+ const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/)
156
+ hostname = parsed ? parsed[1] : unbracketed
157
+ port = parsed ? Number.parseInt(parsed[2], 10) : 0
158
+ }
159
+
160
+ // A leading `*` marks a subdomain wildcard (`*.example.com`), distinct
161
+ // from a plain or leading-dot suffix (`example.com` / `.example.com`)
162
+ // which also matches the apex. `*.example.com` must only match
163
+ // subdomains, never the apex `example.com` itself.
164
+ const wildcard = entry.charCodeAt(0) === 42 /* '*' */
165
+
166
+ noProxyEntries.push({
167
+ // strip leading dot or asterisk with dot, and any trailing dot
168
+ hostname: hostname.replace(/^\*?\./, '').replace(/^(.+)\.$/, '$1').toLowerCase(),
169
+ port,
170
+ wildcard
171
+ })
172
+ }
173
+
174
+ this.#noProxyValue = noProxyValue
175
+ this.#noProxyEntries = noProxyEntries
176
+ }
177
+
178
+ get #noProxyChanged () {
179
+ if (this.#opts.noProxy !== undefined) {
180
+ return false
181
+ }
182
+ return this.#noProxyValue !== this.#noProxyEnv
183
+ }
184
+
185
+ get #noProxyEnv () {
186
+ return process.env.no_proxy ?? process.env.NO_PROXY ?? ''
187
+ }
188
+ }
189
+
190
+ module.exports = EnvHttpProxyAgent
@@ -0,0 +1,135 @@
1
+ 'use strict'
2
+
3
+ // Extracted from node/lib/internal/fixed_queue.js
4
+
5
+ // Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two.
6
+ const kSize = 2048
7
+ const kMask = kSize - 1
8
+
9
+ // The FixedQueue is implemented as a singly-linked list of fixed-size
10
+ // circular buffers. It looks something like this:
11
+ //
12
+ // head tail
13
+ // | |
14
+ // v v
15
+ // +-----------+ <-----\ +-----------+ <------\ +-----------+
16
+ // | [null] | \----- | next | \------- | next |
17
+ // +-----------+ +-----------+ +-----------+
18
+ // | item | <-- bottom | item | <-- bottom | undefined |
19
+ // | item | | item | | undefined |
20
+ // | item | | item | | undefined |
21
+ // | item | | item | | undefined |
22
+ // | item | | item | bottom --> | item |
23
+ // | item | | item | | item |
24
+ // | ... | | ... | | ... |
25
+ // | item | | item | | item |
26
+ // | item | | item | | item |
27
+ // | undefined | <-- top | item | | item |
28
+ // | undefined | | item | | item |
29
+ // | undefined | | undefined | <-- top top --> | undefined |
30
+ // +-----------+ +-----------+ +-----------+
31
+ //
32
+ // Or, if there is only one circular buffer, it looks something
33
+ // like either of these:
34
+ //
35
+ // head tail head tail
36
+ // | | | |
37
+ // v v v v
38
+ // +-----------+ +-----------+
39
+ // | [null] | | [null] |
40
+ // +-----------+ +-----------+
41
+ // | undefined | | item |
42
+ // | undefined | | item |
43
+ // | item | <-- bottom top --> | undefined |
44
+ // | item | | undefined |
45
+ // | undefined | <-- top bottom --> | item |
46
+ // | undefined | | item |
47
+ // +-----------+ +-----------+
48
+ //
49
+ // Adding a value means moving `top` forward by one, removing means
50
+ // moving `bottom` forward by one. After reaching the end, the queue
51
+ // wraps around.
52
+ //
53
+ // When `top === bottom` the current queue is empty and when
54
+ // `top + 1 === bottom` it's full. This wastes a single space of storage
55
+ // but allows much quicker checks.
56
+
57
+ /**
58
+ * @type {FixedCircularBuffer}
59
+ * @template T
60
+ */
61
+ class FixedCircularBuffer {
62
+ /** @type {number} */
63
+ bottom = 0
64
+ /** @type {number} */
65
+ top = 0
66
+ /** @type {Array<T|undefined>} */
67
+ list = new Array(kSize).fill(undefined)
68
+ /** @type {T|null} */
69
+ next = null
70
+
71
+ /** @returns {boolean} */
72
+ isEmpty () {
73
+ return this.top === this.bottom
74
+ }
75
+
76
+ /** @returns {boolean} */
77
+ isFull () {
78
+ return ((this.top + 1) & kMask) === this.bottom
79
+ }
80
+
81
+ /**
82
+ * @param {T} data
83
+ * @returns {void}
84
+ */
85
+ push (data) {
86
+ this.list[this.top] = data
87
+ this.top = (this.top + 1) & kMask
88
+ }
89
+
90
+ /** @returns {T|null} */
91
+ shift () {
92
+ const nextItem = this.list[this.bottom]
93
+ if (nextItem === undefined) { return null }
94
+ this.list[this.bottom] = undefined
95
+ this.bottom = (this.bottom + 1) & kMask
96
+ return nextItem
97
+ }
98
+ }
99
+
100
+ /**
101
+ * @template T
102
+ */
103
+ module.exports = class FixedQueue {
104
+ constructor () {
105
+ /** @type {FixedCircularBuffer<T>} */
106
+ this.head = this.tail = new FixedCircularBuffer()
107
+ }
108
+
109
+ /** @returns {boolean} */
110
+ isEmpty () {
111
+ return this.head.isEmpty()
112
+ }
113
+
114
+ /** @param {T} data */
115
+ push (data) {
116
+ if (this.head.isFull()) {
117
+ // Head is full: Creates a new queue, sets the old queue's `.next` to it,
118
+ // and sets it as the new main queue.
119
+ this.head = this.head.next = new FixedCircularBuffer()
120
+ }
121
+ this.head.push(data)
122
+ }
123
+
124
+ /** @returns {T|null} */
125
+ shift () {
126
+ const tail = this.tail
127
+ const next = tail.shift()
128
+ if (tail.isEmpty() && tail.next !== null) {
129
+ // If there is another queue, it forms the new tail.
130
+ this.tail = tail.next
131
+ tail.next = null
132
+ }
133
+ return next
134
+ }
135
+ }