@teammy/server 0.1.4 → 0.1.6

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 (585) hide show
  1. package/dist/main.js +11646 -7952
  2. package/dist/native-pi-entry.js +14 -1
  3. package/dist/project-pi-entry.js +46 -8
  4. package/dist/runtime/workflows/task-bootstrap/prompt.md +2 -0
  5. package/dist/web/assets/{Assistant-B3h2yQF3.css → Assistant-4yZWjYm-.css} +1 -1
  6. package/dist/web/assets/Assistant-BNVXOHQZ.js +1 -0
  7. package/dist/web/assets/Dashboard-zKTK6EZD.js +1 -0
  8. package/dist/web/assets/Files-DI98WkdW.js +1 -0
  9. package/dist/web/assets/{Markdown-Bq8P_NBV.js → Markdown-D3cU0ani.js} +4 -4
  10. package/dist/web/assets/Materials-CK-mbNmo.css +1 -0
  11. package/dist/web/assets/Materials-CWptgAHz.js +6 -0
  12. package/dist/web/assets/Sessions-DiDwqXLI.js +1 -0
  13. package/dist/web/assets/WorkspaceTree-DeAA1QtV.js +1 -0
  14. package/dist/web/assets/{file-links-CFCIacLV.js → file-links-GfCXWkEh.js} +1 -1
  15. package/dist/web/assets/index-BwEl1PIa.js +66 -0
  16. package/dist/web/assets/{index-B-MqU_88.css → index-CTIAGUGG.css} +1 -1
  17. package/dist/web/downloads/teammy-skill.zip +0 -0
  18. package/dist/web/index.html +2 -2
  19. package/node_modules/@isaacs/nonrecursive-glob-match/LICENSE.md +55 -0
  20. package/node_modules/@isaacs/nonrecursive-glob-match/README.md +333 -0
  21. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts +114 -0
  22. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts.map +1 -0
  23. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js +762 -0
  24. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js.map +1 -0
  25. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js +3 -0
  26. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js.map +7 -0
  27. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/package.json +3 -0
  28. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts +4 -0
  29. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts.map +1 -0
  30. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js +142 -0
  31. package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js.map +1 -0
  32. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts +114 -0
  33. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts.map +1 -0
  34. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js +758 -0
  35. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js.map +1 -0
  36. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js +3 -0
  37. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js.map +7 -0
  38. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/package.json +3 -0
  39. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts +4 -0
  40. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts.map +1 -0
  41. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js +138 -0
  42. package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js.map +1 -0
  43. package/node_modules/@isaacs/nonrecursive-glob-match/package.json +56 -0
  44. package/node_modules/@isaacs/nonrecursive-glob-match/src/index.ts +900 -0
  45. package/node_modules/@isaacs/nonrecursive-glob-match/src/parse-class.ts +158 -0
  46. package/node_modules/@wecom/aibot-node-sdk/README.md +786 -0
  47. package/node_modules/@wecom/aibot-node-sdk/dist/api.d.ts +17 -0
  48. package/node_modules/@wecom/aibot-node-sdk/dist/client.d.ts +217 -0
  49. package/node_modules/@wecom/aibot-node-sdk/dist/crypto.d.ts +12 -0
  50. package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js +1563 -0
  51. package/node_modules/@wecom/aibot-node-sdk/dist/index.cjs.js.map +1 -0
  52. package/node_modules/@wecom/aibot-node-sdk/dist/index.d.ts +1324 -0
  53. package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js +1544 -0
  54. package/node_modules/@wecom/aibot-node-sdk/dist/index.esm.js.map +1 -0
  55. package/node_modules/@wecom/aibot-node-sdk/dist/logger.d.ts +14 -0
  56. package/node_modules/@wecom/aibot-node-sdk/dist/message-handler.d.ts +29 -0
  57. package/node_modules/@wecom/aibot-node-sdk/dist/types/api.d.ts +466 -0
  58. package/node_modules/@wecom/aibot-node-sdk/dist/types/common.d.ts +30 -0
  59. package/node_modules/@wecom/aibot-node-sdk/dist/types/config.d.ts +34 -0
  60. package/node_modules/@wecom/aibot-node-sdk/dist/types/event.d.ts +109 -0
  61. package/node_modules/@wecom/aibot-node-sdk/dist/types/index.d.ts +10 -0
  62. package/node_modules/@wecom/aibot-node-sdk/dist/types/message.d.ts +158 -0
  63. package/node_modules/@wecom/aibot-node-sdk/dist/utils.d.ts +19 -0
  64. package/node_modules/@wecom/aibot-node-sdk/dist/wecom-crypto/index.d.ts +46 -0
  65. package/node_modules/@wecom/aibot-node-sdk/dist/ws.d.ts +161 -0
  66. package/node_modules/@wecom/aibot-node-sdk/package.json +43 -0
  67. package/node_modules/asynckit/LICENSE +21 -0
  68. package/node_modules/asynckit/README.md +233 -0
  69. package/node_modules/asynckit/bench.js +76 -0
  70. package/node_modules/asynckit/index.js +6 -0
  71. package/node_modules/asynckit/lib/abort.js +29 -0
  72. package/node_modules/asynckit/lib/async.js +34 -0
  73. package/node_modules/asynckit/lib/defer.js +26 -0
  74. package/node_modules/asynckit/lib/iterate.js +75 -0
  75. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  76. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  77. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  78. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  79. package/node_modules/asynckit/lib/state.js +37 -0
  80. package/node_modules/asynckit/lib/streamify.js +141 -0
  81. package/node_modules/asynckit/lib/terminator.js +29 -0
  82. package/node_modules/asynckit/package.json +63 -0
  83. package/node_modules/asynckit/parallel.js +43 -0
  84. package/node_modules/asynckit/serial.js +17 -0
  85. package/node_modules/asynckit/serialOrdered.js +75 -0
  86. package/node_modules/asynckit/stream.js +21 -0
  87. package/node_modules/axios/CHANGELOG.md +1934 -0
  88. package/node_modules/axios/LICENSE +7 -0
  89. package/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  90. package/node_modules/axios/README.md +2786 -0
  91. package/node_modules/axios/dist/axios.js +6460 -0
  92. package/node_modules/axios/dist/axios.min.js +5 -0
  93. package/node_modules/axios/dist/axios.min.js.map +1 -0
  94. package/node_modules/axios/dist/browser/axios.cjs +6509 -0
  95. package/node_modules/axios/dist/esm/axios.js +6530 -0
  96. package/node_modules/axios/dist/esm/axios.min.js +3 -0
  97. package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  98. package/node_modules/axios/dist/node/axios.cjs +7491 -0
  99. package/node_modules/axios/index.d.cts +785 -0
  100. package/node_modules/axios/index.d.ts +804 -0
  101. package/node_modules/axios/index.js +45 -0
  102. package/node_modules/axios/lib/adapters/README.md +36 -0
  103. package/node_modules/axios/lib/adapters/adapters.js +132 -0
  104. package/node_modules/axios/lib/adapters/fetch.js +749 -0
  105. package/node_modules/axios/lib/adapters/http.js +1609 -0
  106. package/node_modules/axios/lib/adapters/xhr.js +384 -0
  107. package/node_modules/axios/lib/axios.js +89 -0
  108. package/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  109. package/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  110. package/node_modules/axios/lib/cancel/isCancel.js +5 -0
  111. package/node_modules/axios/lib/core/Axios.js +361 -0
  112. package/node_modules/axios/lib/core/AxiosError.js +278 -0
  113. package/node_modules/axios/lib/core/AxiosHeaders.js +487 -0
  114. package/node_modules/axios/lib/core/InterceptorManager.js +182 -0
  115. package/node_modules/axios/lib/core/README.md +8 -0
  116. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  117. package/node_modules/axios/lib/core/buildFullPath.js +76 -0
  118. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  119. package/node_modules/axios/lib/core/dispatchRequest.js +115 -0
  120. package/node_modules/axios/lib/core/mergeConfig.js +237 -0
  121. package/node_modules/axios/lib/core/methodList.js +17 -0
  122. package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  123. package/node_modules/axios/lib/core/settle.js +27 -0
  124. package/node_modules/axios/lib/core/transformData.js +28 -0
  125. package/node_modules/axios/lib/defaults/index.js +178 -0
  126. package/node_modules/axios/lib/defaults/transitional.js +11 -0
  127. package/node_modules/axios/lib/env/README.md +3 -0
  128. package/node_modules/axios/lib/env/classes/FormData.js +2 -0
  129. package/node_modules/axios/lib/env/data.js +1 -0
  130. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +165 -0
  131. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  132. package/node_modules/axios/lib/helpers/Http2Sessions.js +122 -0
  133. package/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  134. package/node_modules/axios/lib/helpers/README.md +7 -0
  135. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  136. package/node_modules/axios/lib/helpers/bind.js +14 -0
  137. package/node_modules/axios/lib/helpers/buildURL.js +69 -0
  138. package/node_modules/axios/lib/helpers/callbackify.js +18 -0
  139. package/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  140. package/node_modules/axios/lib/helpers/composeSignals.js +71 -0
  141. package/node_modules/axios/lib/helpers/cookies.js +88 -0
  142. package/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  143. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +193 -0
  144. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  145. package/node_modules/axios/lib/helpers/formDataToJSON.js +149 -0
  146. package/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  147. package/node_modules/axios/lib/helpers/fromDataURI.js +75 -0
  148. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  149. package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  150. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
  151. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  152. package/node_modules/axios/lib/helpers/null.js +2 -0
  153. package/node_modules/axios/lib/helpers/parseHeaders.js +72 -0
  154. package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  155. package/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  156. package/node_modules/axios/lib/helpers/readBlob.js +15 -0
  157. package/node_modules/axios/lib/helpers/resolveConfig.js +120 -0
  158. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  159. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +520 -0
  160. package/node_modules/axios/lib/helpers/speedometer.js +55 -0
  161. package/node_modules/axios/lib/helpers/spread.js +28 -0
  162. package/node_modules/axios/lib/helpers/throttle.js +45 -0
  163. package/node_modules/axios/lib/helpers/toFormData.js +279 -0
  164. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  165. package/node_modules/axios/lib/helpers/trackStream.js +89 -0
  166. package/node_modules/axios/lib/helpers/validator.js +112 -0
  167. package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  168. package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  169. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  170. package/node_modules/axios/lib/platform/browser/index.js +13 -0
  171. package/node_modules/axios/lib/platform/common/utils.js +52 -0
  172. package/node_modules/axios/lib/platform/index.js +7 -0
  173. package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  174. package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  175. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  176. package/node_modules/axios/lib/platform/node/index.js +37 -0
  177. package/node_modules/axios/lib/utils.js +1201 -0
  178. package/node_modules/axios/node_modules/agent-base/README.md +145 -0
  179. package/node_modules/axios/node_modules/agent-base/dist/src/index.d.ts +78 -0
  180. package/node_modules/axios/node_modules/agent-base/dist/src/index.js +203 -0
  181. package/node_modules/axios/node_modules/agent-base/dist/src/index.js.map +1 -0
  182. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  183. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js +18 -0
  184. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  185. package/node_modules/axios/node_modules/agent-base/package.json +64 -0
  186. package/node_modules/axios/node_modules/agent-base/src/index.ts +345 -0
  187. package/node_modules/axios/node_modules/agent-base/src/promisify.ts +33 -0
  188. package/node_modules/axios/node_modules/https-proxy-agent/README.md +137 -0
  189. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  190. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js +177 -0
  191. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  192. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  193. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js +14 -0
  194. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  195. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  196. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  197. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  198. package/node_modules/axios/node_modules/https-proxy-agent/package.json +56 -0
  199. package/node_modules/axios/package.json +202 -0
  200. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  201. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  202. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  203. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  204. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  205. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  206. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  207. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  208. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  209. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  210. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  211. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  212. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  213. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  214. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  215. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  216. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  217. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  218. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  219. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  220. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  221. package/node_modules/combined-stream/License +19 -0
  222. package/node_modules/combined-stream/Readme.md +138 -0
  223. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  224. package/node_modules/combined-stream/package.json +25 -0
  225. package/node_modules/delayed-stream/.npmignore +1 -0
  226. package/node_modules/delayed-stream/License +19 -0
  227. package/node_modules/delayed-stream/Makefile +7 -0
  228. package/node_modules/delayed-stream/Readme.md +141 -0
  229. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  230. package/node_modules/delayed-stream/package.json +27 -0
  231. package/node_modules/dunder-proto/.eslintrc +5 -0
  232. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  233. package/node_modules/dunder-proto/.nycrc +13 -0
  234. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  235. package/node_modules/dunder-proto/LICENSE +21 -0
  236. package/node_modules/dunder-proto/README.md +54 -0
  237. package/node_modules/dunder-proto/get.d.ts +5 -0
  238. package/node_modules/dunder-proto/get.js +30 -0
  239. package/node_modules/dunder-proto/package.json +76 -0
  240. package/node_modules/dunder-proto/set.d.ts +5 -0
  241. package/node_modules/dunder-proto/set.js +35 -0
  242. package/node_modules/dunder-proto/test/get.js +34 -0
  243. package/node_modules/dunder-proto/test/index.js +4 -0
  244. package/node_modules/dunder-proto/test/set.js +50 -0
  245. package/node_modules/dunder-proto/tsconfig.json +9 -0
  246. package/node_modules/es-define-property/.eslintrc +13 -0
  247. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  248. package/node_modules/es-define-property/.nycrc +9 -0
  249. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  250. package/node_modules/es-define-property/LICENSE +21 -0
  251. package/node_modules/es-define-property/README.md +49 -0
  252. package/node_modules/es-define-property/index.d.ts +3 -0
  253. package/node_modules/es-define-property/index.js +14 -0
  254. package/node_modules/es-define-property/package.json +81 -0
  255. package/node_modules/es-define-property/test/index.js +56 -0
  256. package/node_modules/es-define-property/tsconfig.json +10 -0
  257. package/node_modules/es-errors/.eslintrc +5 -0
  258. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  259. package/node_modules/es-errors/CHANGELOG.md +40 -0
  260. package/node_modules/es-errors/LICENSE +21 -0
  261. package/node_modules/es-errors/README.md +55 -0
  262. package/node_modules/es-errors/eval.d.ts +3 -0
  263. package/node_modules/es-errors/eval.js +4 -0
  264. package/node_modules/es-errors/index.d.ts +3 -0
  265. package/node_modules/es-errors/index.js +4 -0
  266. package/node_modules/es-errors/package.json +80 -0
  267. package/node_modules/es-errors/range.d.ts +3 -0
  268. package/node_modules/es-errors/range.js +4 -0
  269. package/node_modules/es-errors/ref.d.ts +3 -0
  270. package/node_modules/es-errors/ref.js +4 -0
  271. package/node_modules/es-errors/syntax.d.ts +3 -0
  272. package/node_modules/es-errors/syntax.js +4 -0
  273. package/node_modules/es-errors/test/index.js +19 -0
  274. package/node_modules/es-errors/tsconfig.json +49 -0
  275. package/node_modules/es-errors/type.d.ts +3 -0
  276. package/node_modules/es-errors/type.js +4 -0
  277. package/node_modules/es-errors/uri.d.ts +3 -0
  278. package/node_modules/es-errors/uri.js +4 -0
  279. package/node_modules/es-object-atoms/.eslintrc +16 -0
  280. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  281. package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
  282. package/node_modules/es-object-atoms/LICENSE +21 -0
  283. package/node_modules/es-object-atoms/README.md +63 -0
  284. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  285. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  286. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  287. package/node_modules/es-object-atoms/ToObject.js +10 -0
  288. package/node_modules/es-object-atoms/index.d.ts +3 -0
  289. package/node_modules/es-object-atoms/index.js +4 -0
  290. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  291. package/node_modules/es-object-atoms/isObject.js +6 -0
  292. package/node_modules/es-object-atoms/package.json +79 -0
  293. package/node_modules/es-object-atoms/test/index.js +38 -0
  294. package/node_modules/es-object-atoms/tsconfig.json +7 -0
  295. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  296. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  297. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  298. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  299. package/node_modules/es-set-tostringtag/README.md +53 -0
  300. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  301. package/node_modules/es-set-tostringtag/index.js +35 -0
  302. package/node_modules/es-set-tostringtag/package.json +78 -0
  303. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  304. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  305. package/node_modules/eventemitter3/LICENSE +21 -0
  306. package/node_modules/eventemitter3/README.md +85 -0
  307. package/node_modules/eventemitter3/dist/eventemitter3.esm.js +355 -0
  308. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +1 -0
  309. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +1 -0
  310. package/node_modules/eventemitter3/dist/eventemitter3.umd.js +363 -0
  311. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +1 -0
  312. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +1 -0
  313. package/node_modules/eventemitter3/index.d.ts +135 -0
  314. package/node_modules/eventemitter3/index.js +336 -0
  315. package/node_modules/eventemitter3/index.mjs +4 -0
  316. package/node_modules/eventemitter3/package.json +62 -0
  317. package/node_modules/follow-redirects/LICENSE +18 -0
  318. package/node_modules/follow-redirects/README.md +183 -0
  319. package/node_modules/follow-redirects/debug.js +15 -0
  320. package/node_modules/follow-redirects/http.js +1 -0
  321. package/node_modules/follow-redirects/https.js +1 -0
  322. package/node_modules/follow-redirects/index.js +714 -0
  323. package/node_modules/follow-redirects/package.json +58 -0
  324. package/node_modules/form-data/CHANGELOG.md +686 -0
  325. package/node_modules/form-data/License +19 -0
  326. package/node_modules/form-data/README.md +355 -0
  327. package/node_modules/form-data/index.d.ts +62 -0
  328. package/node_modules/form-data/lib/browser.js +4 -0
  329. package/node_modules/form-data/lib/form_data.js +506 -0
  330. package/node_modules/form-data/lib/populate.js +10 -0
  331. package/node_modules/form-data/package.json +82 -0
  332. package/node_modules/function-bind/.eslintrc +21 -0
  333. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  334. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  335. package/node_modules/function-bind/.nycrc +13 -0
  336. package/node_modules/function-bind/CHANGELOG.md +136 -0
  337. package/node_modules/function-bind/LICENSE +20 -0
  338. package/node_modules/function-bind/README.md +46 -0
  339. package/node_modules/function-bind/implementation.js +84 -0
  340. package/node_modules/function-bind/index.js +5 -0
  341. package/node_modules/function-bind/package.json +87 -0
  342. package/node_modules/function-bind/test/.eslintrc +9 -0
  343. package/node_modules/function-bind/test/index.js +252 -0
  344. package/node_modules/get-intrinsic/.eslintrc +42 -0
  345. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  346. package/node_modules/get-intrinsic/.nycrc +9 -0
  347. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  348. package/node_modules/get-intrinsic/LICENSE +21 -0
  349. package/node_modules/get-intrinsic/README.md +71 -0
  350. package/node_modules/get-intrinsic/index.js +378 -0
  351. package/node_modules/get-intrinsic/package.json +97 -0
  352. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  353. package/node_modules/get-proto/.eslintrc +10 -0
  354. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  355. package/node_modules/get-proto/.nycrc +9 -0
  356. package/node_modules/get-proto/CHANGELOG.md +21 -0
  357. package/node_modules/get-proto/LICENSE +21 -0
  358. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  359. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  360. package/node_modules/get-proto/README.md +50 -0
  361. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  362. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  363. package/node_modules/get-proto/index.d.ts +5 -0
  364. package/node_modules/get-proto/index.js +27 -0
  365. package/node_modules/get-proto/package.json +81 -0
  366. package/node_modules/get-proto/test/index.js +68 -0
  367. package/node_modules/get-proto/tsconfig.json +9 -0
  368. package/node_modules/glob/README.md +388 -214
  369. package/node_modules/glob/dist/commonjs/glob.d.ts +20 -11
  370. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -1
  371. package/node_modules/glob/dist/commonjs/glob.js +22 -29
  372. package/node_modules/glob/dist/commonjs/glob.js.map +1 -1
  373. package/node_modules/glob/dist/commonjs/has-magic.d.ts +1 -1
  374. package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -1
  375. package/node_modules/glob/dist/commonjs/has-magic.js +1 -4
  376. package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -1
  377. package/node_modules/glob/dist/commonjs/ignore.d.ts +16 -4
  378. package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -1
  379. package/node_modules/glob/dist/commonjs/ignore.js +24 -4
  380. package/node_modules/glob/dist/commonjs/ignore.js.map +1 -1
  381. package/node_modules/glob/dist/commonjs/index.d.ts +3 -2
  382. package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -1
  383. package/node_modules/glob/dist/commonjs/index.js.map +1 -1
  384. package/node_modules/glob/dist/commonjs/index.min.js +2 -3
  385. package/node_modules/glob/dist/commonjs/index.min.js.map +4 -4
  386. package/node_modules/glob/dist/commonjs/pattern.d.ts +10 -3
  387. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -1
  388. package/node_modules/glob/dist/commonjs/pattern.js +27 -15
  389. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -1
  390. package/node_modules/glob/dist/commonjs/processor.d.ts +23 -10
  391. package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -1
  392. package/node_modules/glob/dist/commonjs/processor.js +36 -23
  393. package/node_modules/glob/dist/commonjs/processor.js.map +1 -1
  394. package/node_modules/glob/dist/commonjs/walker.d.ts +19 -17
  395. package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -1
  396. package/node_modules/glob/dist/commonjs/walker.js +50 -35
  397. package/node_modules/glob/dist/commonjs/walker.js.map +1 -1
  398. package/node_modules/glob/dist/esm/glob.d.ts +20 -11
  399. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -1
  400. package/node_modules/glob/dist/esm/glob.js +22 -29
  401. package/node_modules/glob/dist/esm/glob.js.map +1 -1
  402. package/node_modules/glob/dist/esm/has-magic.d.ts +1 -1
  403. package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -1
  404. package/node_modules/glob/dist/esm/has-magic.js +1 -4
  405. package/node_modules/glob/dist/esm/has-magic.js.map +1 -1
  406. package/node_modules/glob/dist/esm/ignore.d.ts +16 -4
  407. package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -1
  408. package/node_modules/glob/dist/esm/ignore.js +25 -5
  409. package/node_modules/glob/dist/esm/ignore.js.map +1 -1
  410. package/node_modules/glob/dist/esm/index.d.ts +3 -2
  411. package/node_modules/glob/dist/esm/index.d.ts.map +1 -1
  412. package/node_modules/glob/dist/esm/index.js.map +1 -1
  413. package/node_modules/glob/dist/esm/index.min.js +2 -3
  414. package/node_modules/glob/dist/esm/index.min.js.map +4 -4
  415. package/node_modules/glob/dist/esm/pattern.d.ts +10 -3
  416. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -1
  417. package/node_modules/glob/dist/esm/pattern.js +27 -15
  418. package/node_modules/glob/dist/esm/pattern.js.map +1 -1
  419. package/node_modules/glob/dist/esm/processor.d.ts +23 -10
  420. package/node_modules/glob/dist/esm/processor.d.ts.map +1 -1
  421. package/node_modules/glob/dist/esm/processor.js +36 -23
  422. package/node_modules/glob/dist/esm/processor.js.map +1 -1
  423. package/node_modules/glob/dist/esm/walker.d.ts +19 -17
  424. package/node_modules/glob/dist/esm/walker.d.ts.map +1 -1
  425. package/node_modules/glob/dist/esm/walker.js +51 -36
  426. package/node_modules/glob/dist/esm/walker.js.map +1 -1
  427. package/node_modules/glob/package.json +28 -12
  428. package/node_modules/glob/src/glob.ts +655 -0
  429. package/node_modules/glob/src/has-magic.ts +23 -0
  430. package/node_modules/glob/src/ignore.ts +162 -0
  431. package/node_modules/glob/src/index.ts +225 -0
  432. package/node_modules/glob/src/pattern.ts +286 -0
  433. package/node_modules/glob/src/processor.ts +333 -0
  434. package/node_modules/glob/src/walker.ts +523 -0
  435. package/node_modules/gopd/.eslintrc +16 -0
  436. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  437. package/node_modules/gopd/CHANGELOG.md +45 -0
  438. package/node_modules/gopd/LICENSE +21 -0
  439. package/node_modules/gopd/README.md +40 -0
  440. package/node_modules/gopd/gOPD.d.ts +1 -0
  441. package/node_modules/gopd/gOPD.js +4 -0
  442. package/node_modules/gopd/index.d.ts +5 -0
  443. package/node_modules/gopd/index.js +15 -0
  444. package/node_modules/gopd/package.json +77 -0
  445. package/node_modules/gopd/test/index.js +36 -0
  446. package/node_modules/gopd/tsconfig.json +9 -0
  447. package/node_modules/has-symbols/.eslintrc +11 -0
  448. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  449. package/node_modules/has-symbols/.nycrc +9 -0
  450. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  451. package/node_modules/has-symbols/LICENSE +21 -0
  452. package/node_modules/has-symbols/README.md +46 -0
  453. package/node_modules/has-symbols/index.d.ts +3 -0
  454. package/node_modules/has-symbols/index.js +14 -0
  455. package/node_modules/has-symbols/package.json +111 -0
  456. package/node_modules/has-symbols/shams.d.ts +3 -0
  457. package/node_modules/has-symbols/shams.js +45 -0
  458. package/node_modules/has-symbols/test/index.js +22 -0
  459. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  460. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  461. package/node_modules/has-symbols/test/tests.js +58 -0
  462. package/node_modules/has-symbols/tsconfig.json +10 -0
  463. package/node_modules/has-tostringtag/.eslintrc +5 -0
  464. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  465. package/node_modules/has-tostringtag/.nycrc +13 -0
  466. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  467. package/node_modules/has-tostringtag/LICENSE +21 -0
  468. package/node_modules/has-tostringtag/README.md +46 -0
  469. package/node_modules/has-tostringtag/index.d.ts +3 -0
  470. package/node_modules/has-tostringtag/index.js +8 -0
  471. package/node_modules/has-tostringtag/package.json +108 -0
  472. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  473. package/node_modules/has-tostringtag/shams.js +8 -0
  474. package/node_modules/has-tostringtag/test/index.js +21 -0
  475. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  476. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  477. package/node_modules/has-tostringtag/test/tests.js +15 -0
  478. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  479. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  480. package/node_modules/hasown/.nycrc +13 -0
  481. package/node_modules/hasown/CHANGELOG.md +58 -0
  482. package/node_modules/hasown/LICENSE +21 -0
  483. package/node_modules/hasown/README.md +40 -0
  484. package/node_modules/hasown/eslint.config.mjs +6 -0
  485. package/node_modules/hasown/index.d.ts +3 -0
  486. package/node_modules/hasown/index.js +8 -0
  487. package/node_modules/hasown/package.json +91 -0
  488. package/node_modules/hasown/tsconfig.json +6 -0
  489. package/node_modules/math-intrinsics/.eslintrc +16 -0
  490. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  491. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  492. package/node_modules/math-intrinsics/LICENSE +21 -0
  493. package/node_modules/math-intrinsics/README.md +50 -0
  494. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  495. package/node_modules/math-intrinsics/abs.js +4 -0
  496. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  497. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  498. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  499. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  500. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  501. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  502. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  503. package/node_modules/math-intrinsics/floor.js +4 -0
  504. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  505. package/node_modules/math-intrinsics/isFinite.js +12 -0
  506. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  507. package/node_modules/math-intrinsics/isInteger.js +16 -0
  508. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  509. package/node_modules/math-intrinsics/isNaN.js +6 -0
  510. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  511. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  512. package/node_modules/math-intrinsics/max.d.ts +1 -0
  513. package/node_modules/math-intrinsics/max.js +4 -0
  514. package/node_modules/math-intrinsics/min.d.ts +1 -0
  515. package/node_modules/math-intrinsics/min.js +4 -0
  516. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  517. package/node_modules/math-intrinsics/mod.js +9 -0
  518. package/node_modules/math-intrinsics/package.json +86 -0
  519. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  520. package/node_modules/math-intrinsics/pow.js +4 -0
  521. package/node_modules/math-intrinsics/round.d.ts +1 -0
  522. package/node_modules/math-intrinsics/round.js +4 -0
  523. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  524. package/node_modules/math-intrinsics/sign.js +11 -0
  525. package/node_modules/math-intrinsics/test/index.js +192 -0
  526. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  527. package/node_modules/mime-db/HISTORY.md +507 -0
  528. package/node_modules/mime-db/LICENSE +23 -0
  529. package/node_modules/mime-db/README.md +100 -0
  530. package/node_modules/mime-db/db.json +8519 -0
  531. package/node_modules/mime-db/index.js +12 -0
  532. package/node_modules/mime-db/package.json +60 -0
  533. package/node_modules/mime-types/HISTORY.md +397 -0
  534. package/node_modules/mime-types/LICENSE +23 -0
  535. package/node_modules/mime-types/README.md +113 -0
  536. package/node_modules/mime-types/index.js +188 -0
  537. package/node_modules/mime-types/package.json +44 -0
  538. package/node_modules/minimatch/README.md +125 -107
  539. package/node_modules/minimatch/dist/commonjs/index.d.ts +49 -38
  540. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -1
  541. package/node_modules/minimatch/dist/commonjs/index.js +782 -359
  542. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -1
  543. package/node_modules/minimatch/dist/esm/index.d.ts +49 -38
  544. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -1
  545. package/node_modules/minimatch/dist/esm/index.js +781 -356
  546. package/node_modules/minimatch/dist/esm/index.js.map +1 -1
  547. package/node_modules/minimatch/package.json +5 -4
  548. package/node_modules/path-scurry/README.md +0 -1
  549. package/node_modules/path-scurry/dist/commonjs/index.d.ts +7 -0
  550. package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -1
  551. package/node_modules/path-scurry/dist/commonjs/index.js +59 -21
  552. package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -1
  553. package/node_modules/path-scurry/dist/esm/index.d.ts +7 -0
  554. package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -1
  555. package/node_modules/path-scurry/dist/esm/index.js +42 -14
  556. package/node_modules/path-scurry/dist/esm/index.js.map +1 -1
  557. package/node_modules/path-scurry/package.json +4 -4
  558. package/node_modules/proxy-from-env/LICENSE +20 -0
  559. package/node_modules/proxy-from-env/README.md +163 -0
  560. package/node_modules/proxy-from-env/index.cjs +105 -0
  561. package/node_modules/proxy-from-env/index.js +103 -0
  562. package/node_modules/proxy-from-env/package.json +43 -0
  563. package/package.json +3 -1
  564. package/dist/web/assets/Assistant-DSQAdSiW.js +0 -1
  565. package/dist/web/assets/Dashboard-dCu2Cdxd.js +0 -1
  566. package/dist/web/assets/Files-cRhoWviM.js +0 -1
  567. package/dist/web/assets/Sessions-BxHsX1C5.js +0 -1
  568. package/dist/web/assets/WorkspaceTree-CD94JsaJ.js +0 -1
  569. package/dist/web/assets/index-BXpTaAUz.js +0 -66
  570. package/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -22
  571. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +0 -1
  572. package/node_modules/minimatch/dist/commonjs/ast.js +0 -845
  573. package/node_modules/minimatch/dist/commonjs/ast.js.map +0 -1
  574. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
  575. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +0 -1
  576. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -150
  577. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +0 -1
  578. package/node_modules/minimatch/dist/esm/ast.d.ts +0 -22
  579. package/node_modules/minimatch/dist/esm/ast.d.ts.map +0 -1
  580. package/node_modules/minimatch/dist/esm/ast.js +0 -841
  581. package/node_modules/minimatch/dist/esm/ast.js.map +0 -1
  582. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
  583. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +0 -1
  584. package/node_modules/minimatch/dist/esm/brace-expressions.js +0 -146
  585. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
@@ -0,0 +1,1609 @@
1
+ import utils from '../utils.js';
2
+ import settle from '../core/settle.js';
3
+ import buildFullPath from '../core/buildFullPath.js';
4
+ import buildURL from '../helpers/buildURL.js';
5
+ import { getProxyForUrl } from 'proxy-from-env';
6
+ import HttpsProxyAgent from 'https-proxy-agent';
7
+ import http from 'http';
8
+ import https from 'https';
9
+ import http2 from 'http2';
10
+ import util from 'util';
11
+ import { resolve as resolvePath } from 'path';
12
+ import followRedirects from 'follow-redirects';
13
+ import zlib from 'zlib';
14
+ import { VERSION } from '../env/data.js';
15
+ import transitionalDefaults from '../defaults/transitional.js';
16
+ import AxiosError from '../core/AxiosError.js';
17
+ import CanceledError from '../cancel/CanceledError.js';
18
+ import platform from '../platform/index.js';
19
+ import fromDataURI from '../helpers/fromDataURI.js';
20
+ import stream from 'stream';
21
+ import AxiosHeaders from '../core/AxiosHeaders.js';
22
+ import setFormDataHeaders from '../core/setFormDataHeaders.js';
23
+ import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
24
+ import { EventEmitter } from 'events';
25
+ import formDataToStream from '../helpers/formDataToStream.js';
26
+ import readBlob from '../helpers/readBlob.js';
27
+ import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
28
+ import Http2Sessions from '../helpers/Http2Sessions.js';
29
+ import callbackify from '../helpers/callbackify.js';
30
+ import shouldBypassProxy from '../helpers/shouldBypassProxy.js';
31
+ import bind from '../helpers/bind.js';
32
+ import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
33
+ import {
34
+ progressEventReducer,
35
+ progressEventDecorator,
36
+ asyncDecorator,
37
+ } from '../helpers/progressEventReducer.js';
38
+ import { estimateDataURLBufferAllocation } from '../helpers/estimateDataURLDecodedBytes.js';
39
+
40
+ const zlibOptions = {
41
+ flush: zlib.constants.Z_SYNC_FLUSH,
42
+ finishFlush: zlib.constants.Z_SYNC_FLUSH,
43
+ };
44
+
45
+ const brotliOptions = {
46
+ flush: zlib.constants.BROTLI_OPERATION_FLUSH,
47
+ finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
48
+ };
49
+
50
+ const zstdOptions = {
51
+ flush: zlib.constants.ZSTD_e_flush,
52
+ finishFlush: zlib.constants.ZSTD_e_flush,
53
+ };
54
+
55
+ const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
56
+ const isZstdSupported = utils.isFunction(zlib.createZstdDecompress);
57
+ const ACCEPT_ENCODING = 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : '');
58
+ const ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ', zstd' : '');
59
+ const scheduleProgress =
60
+ typeof process !== 'undefined' && process.nextTick ? process.nextTick.bind(process) : utils.asap;
61
+
62
+ const { http: httpFollow, https: httpsFollow } = followRedirects;
63
+
64
+ const isHttps = /https:?/;
65
+
66
+ // Symbols used to bind a single 'error' listener to a pooled socket and track
67
+ // the request currently owning that socket across keep-alive reuse (issue #10780).
68
+ const kAxiosSocketListener = Symbol('axios.http.socketListener');
69
+ const kAxiosCurrentReq = Symbol('axios.http.currentReq');
70
+
71
+ // A shared listener avoids retaining an adapter context for the lifetime of a
72
+ // pooled socket. EventEmitter invokes listeners with `this` set to the emitter.
73
+ function handleSocketError(err) {
74
+ const current = this[kAxiosCurrentReq];
75
+ if (current && !current.destroyed) {
76
+ current.destroy(err);
77
+ }
78
+ }
79
+
80
+ // Tags HttpsProxyAgent instances installed by setProxy() so the redirect path
81
+ // can strip them without clobbering a user-supplied agent that happens to be
82
+ // an HttpsProxyAgent.
83
+ const kAxiosInstalledTunnel = Symbol('axios.http.installedTunnel');
84
+
85
+ // Cache of CONNECT-tunneling agents keyed by proxy config so repeat requests
86
+ // through the same proxy reuse a single agent (and its socket pool). The
87
+ // keyspace is bounded by the set of distinct proxy configs the process uses,
88
+ // so unbounded growth is not a concern in practice.
89
+ const tunnelingAgentCache = new Map();
90
+ const tunnelingAgentCacheUser = new WeakMap();
91
+ const directAgents = new WeakMap();
92
+ const directAgentHooks = ['createConnection', 'getName'];
93
+ const nativeAgentPoolHooks = [
94
+ 'addRequest',
95
+ 'createSocket',
96
+ 'removeSocket',
97
+ 'keepSocketAlive',
98
+ 'reuseSocket',
99
+ '_getSession',
100
+ '_cacheSession',
101
+ '_evictSession',
102
+ ];
103
+ // Minimum minor versions where Node's HTTP Agent supports native proxyEnv
104
+ // handling. Checking the selected agent below also covers startup modes such
105
+ // as NODE_OPTIONS=--use-env-proxy and --no-use-env-proxy precedence.
106
+ const NODE_NATIVE_ENV_PROXY_SUPPORT = {
107
+ 22: 21,
108
+ 24: 5,
109
+ };
110
+
111
+ function isNodeNativeEnvProxySupported(nodeVersion = process.versions && process.versions.node) {
112
+ if (!nodeVersion) {
113
+ return false;
114
+ }
115
+
116
+ const [major, minor] = nodeVersion.split('.').map((part) => Number(part));
117
+
118
+ if (!Number.isInteger(major) || !Number.isInteger(minor)) {
119
+ return false;
120
+ }
121
+
122
+ if (major > 24) {
123
+ return true;
124
+ }
125
+
126
+ return (
127
+ NODE_NATIVE_ENV_PROXY_SUPPORT[major] != null && minor >= NODE_NATIVE_ENV_PROXY_SUPPORT[major]
128
+ );
129
+ }
130
+
131
+ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.versions.node) {
132
+ if (!isNodeNativeEnvProxySupported(nodeVersion)) {
133
+ return false;
134
+ }
135
+
136
+ const agentOptions = agent && agent.options;
137
+
138
+ return Boolean(
139
+ agentOptions && utils.hasOwnProp(agentOptions, 'proxyEnv') && agentOptions.proxyEnv != null
140
+ );
141
+ }
142
+
143
+ function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
144
+ return isHttps.test(options.protocol)
145
+ ? configHttpsAgent || https.globalAgent
146
+ : configHttpAgent || http.globalAgent;
147
+ }
148
+
149
+ function getDirectAgent(configuredAgent, transport) {
150
+ if (
151
+ !process.allowedNodeEnvironmentFlags ||
152
+ !process.allowedNodeEnvironmentFlags.has('--use-env-proxy')
153
+ ) {
154
+ return configuredAgent;
155
+ }
156
+
157
+ const agent = configuredAgent || transport.globalAgent;
158
+ const options = agent && agent.options;
159
+ if (
160
+ !(agent instanceof transport.Agent) ||
161
+ agent.protocol !== transport.globalAgent.protocol ||
162
+ !options ||
163
+ !utils.hasOwnProp(options, 'proxyEnv') ||
164
+ typeof options.proxyEnv !== 'object' ||
165
+ options.proxyEnv === null
166
+ ) {
167
+ return configuredAgent;
168
+ }
169
+
170
+ // These hooks own pool queues or TLS session state. Neither binding them to
171
+ // the source agent nor copying them without subclass state preserves their
172
+ // behavior on a separate direct pool.
173
+ for (const hook of nativeAgentPoolHooks) {
174
+ if (
175
+ utils.isFunction(transport.Agent.prototype[hook]) &&
176
+ agent[hook] !== transport.Agent.prototype[hook]
177
+ ) {
178
+ throw new AxiosError(
179
+ 'proxy: false cannot adapt an agent overriding ' +
180
+ hook +
181
+ '; use an agent constructed without proxyEnv',
182
+ AxiosError.ERR_BAD_OPTION_VALUE
183
+ );
184
+ }
185
+ }
186
+
187
+ // Node snapshots proxyEnv when constructing the agent. Keep this check
188
+ // conservative even when the caller later removes protocol-specific entries.
189
+ let direct = directAgents.get(agent);
190
+ if (!direct) {
191
+ direct = new transport.Agent({ ...options, proxyEnv: undefined });
192
+
193
+ // Agent.destroy() does not emit an event. Keep the associated pool under
194
+ // the configured agent's lifetime, including agents reused after destroy().
195
+ const destroy = agent.destroy;
196
+ agent.destroy = function destroyWithDirectAgent() {
197
+ try {
198
+ return destroy.apply(this, arguments);
199
+ } finally {
200
+ direct.destroy();
201
+ }
202
+ };
203
+ directAgents.set(agent, direct);
204
+ }
205
+
206
+ // Connections and pool keys do not own the direct pool's queues. Preserve
207
+ // their configured receiver and refresh hooks that change between requests.
208
+ for (const hook of directAgentHooks) {
209
+ direct[hook] =
210
+ agent[hook] === transport.Agent.prototype[hook]
211
+ ? transport.Agent.prototype[hook]
212
+ : bind(agent[hook], agent);
213
+ }
214
+ return direct;
215
+ }
216
+
217
+ function setDirectAgent(options, configHttpAgent, configHttpsAgent) {
218
+ const secure = isHttps.test(options.protocol);
219
+ const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https : http);
220
+ options.agent = agent;
221
+ if (options.agents) {
222
+ options.agents[secure ? 'https' : 'http'] = agent;
223
+ }
224
+ }
225
+
226
+ function getTunnelingAgent(agentOptions, userHttpsAgent) {
227
+ const key =
228
+ agentOptions.protocol +
229
+ '//' +
230
+ agentOptions.hostname +
231
+ ':' +
232
+ (agentOptions.port || '') +
233
+ '#' +
234
+ (agentOptions.auth || '');
235
+ const cache = userHttpsAgent
236
+ ? tunnelingAgentCacheUser.get(userHttpsAgent) ||
237
+ tunnelingAgentCacheUser.set(userHttpsAgent, new Map()).get(userHttpsAgent)
238
+ : tunnelingAgentCache;
239
+ let agent = cache.get(key);
240
+ if (agent) return agent;
241
+ // Preserve per-request TLS options for the proxy connection, with our proxy
242
+ // fields taking precedence. Global-agent options belong only to the origin
243
+ // TLS upgrade in the callback below.
244
+ const merged =
245
+ userHttpsAgent && userHttpsAgent.options
246
+ ? { ...userHttpsAgent.options, ...agentOptions }
247
+ : agentOptions;
248
+ agent = new HttpsProxyAgent(merged);
249
+ const callback = agent.callback;
250
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
251
+ // Without a proxy the origin TLS connection would be made by https.globalAgent,
252
+ // so its options have to reach the tunneled origin too. Resolved per request
253
+ // because the tunneling agent outlives any one of them.
254
+ const originTLSAgent = userHttpsAgent || https.globalAgent;
255
+ const originTLSOptions = originTLSAgent && originTLSAgent.options;
256
+ // HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
257
+ return callback.call(this, req, { ...originTLSOptions, ...opts });
258
+ };
259
+ agent[kAxiosInstalledTunnel] = true;
260
+ cache.set(key, agent);
261
+ return agent;
262
+ }
263
+
264
+ const supportedProtocols = platform.protocols.map((protocol) => {
265
+ return protocol + ':';
266
+ });
267
+
268
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
269
+ // Decode before composing the `auth` option so credentials such as
270
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
271
+ // original value for malformed input so a bad encoding never throws.
272
+ const decodeURIComponentSafe = (value) => {
273
+ if (!utils.isString(value)) {
274
+ return value;
275
+ }
276
+
277
+ try {
278
+ return decodeURIComponent(value);
279
+ } catch (error) {
280
+ return value;
281
+ }
282
+ };
283
+
284
+ const flushOnFinish = (stream, [throttled, flush]) => {
285
+ stream.on('end', flush).on('error', flush);
286
+
287
+ return throttled;
288
+ };
289
+
290
+ const http2Sessions = new Http2Sessions();
291
+
292
+ /**
293
+ * If the proxy, auth, sensitive header, or config beforeRedirects functions are defined,
294
+ * call them with the options object.
295
+ *
296
+ * @param {Object<string, any>} options - The options object that was passed to the request.
297
+ *
298
+ * @returns {Object<string, any>}
299
+ */
300
+ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
301
+ if (!isSameOriginRedirect(options, requestDetails)) {
302
+ stripMatchingHeaders(options.headers, new Set(['authorization', 'cookie']));
303
+ delete options.auth;
304
+ }
305
+ if (options.beforeRedirects.proxy) {
306
+ options.beforeRedirects.proxy(options);
307
+ }
308
+ if (options.beforeRedirects.auth) {
309
+ options.beforeRedirects.auth(options);
310
+ }
311
+ if (options.beforeRedirects.sensitiveHeaders) {
312
+ options.beforeRedirects.sensitiveHeaders(options, requestDetails);
313
+ }
314
+ if (options.beforeRedirects.direct) {
315
+ options.beforeRedirects.direct(options);
316
+ }
317
+ if (options.beforeRedirects.config) {
318
+ options.beforeRedirects.config(options, responseDetails, requestDetails);
319
+ }
320
+ }
321
+
322
+ function stripMatchingHeaders(headers, sensitiveSet) {
323
+ if (!headers) {
324
+ return;
325
+ }
326
+
327
+ Object.keys(headers).forEach((header) => {
328
+ if (sensitiveSet.has(header.toLowerCase())) {
329
+ delete headers[header];
330
+ }
331
+ });
332
+ }
333
+
334
+ function isSameOriginRedirect(redirectOptions, requestDetails) {
335
+ if (!requestDetails) {
336
+ return false;
337
+ }
338
+
339
+ try {
340
+ return new URL(requestDetails.url).origin === new URL(redirectOptions.href).origin;
341
+ } catch (e) {
342
+ // If origin comparison fails, treat the redirect as unsafe.
343
+ return false;
344
+ }
345
+ }
346
+
347
+ /**
348
+ * If the proxy or config afterRedirects functions are defined, call them with the options
349
+ *
350
+ * @param {http.ClientRequestArgs} options
351
+ * @param {AxiosProxyConfig} configProxy configuration from Axios options object
352
+ * @param {string} location
353
+ * @param {boolean} [allowEnvProxy=true] whether environment proxy configuration can be used
354
+ *
355
+ * @returns {boolean} whether a proxy applies to the selected transport
356
+ */
357
+ function setProxy(
358
+ options,
359
+ configProxy,
360
+ location,
361
+ isRedirect,
362
+ configHttpsAgent,
363
+ configHttpAgent,
364
+ allowEnvProxy = true
365
+ ) {
366
+ let proxy = configProxy;
367
+ const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
368
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
369
+ const proxyUrl = getProxyForUrl(location);
370
+ if (proxyUrl) {
371
+ if (!shouldBypassProxy(location)) {
372
+ proxy = new URL(proxyUrl);
373
+ }
374
+ }
375
+ }
376
+ // On redirect re-invocation, strip any stale Proxy-Authorization header carried
377
+ // over from the prior request (e.g. new target no longer uses a proxy, or uses
378
+ // a different proxy). Skip on the initial request so user-supplied headers are
379
+ // preserved. Header names are case-insensitive, so remove every case variant.
380
+ if (isRedirect && options.headers) {
381
+ for (const name of Object.keys(options.headers)) {
382
+ if (name.toLowerCase() === 'proxy-authorization') {
383
+ delete options.headers[name];
384
+ }
385
+ }
386
+ }
387
+ // Strip any tunneling agent we installed for the previous hop so a redirect
388
+ // that drops the proxy or crosses an HTTPS↔HTTP boundary doesn't reuse a
389
+ // stale one. Match on our Symbol marker so a user-supplied HttpsProxyAgent
390
+ // (which won't carry the marker) is left alone.
391
+ if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
392
+ options.agent = undefined;
393
+ }
394
+ if (
395
+ isRedirect &&
396
+ options.agents &&
397
+ options.agents.https &&
398
+ options.agents.https[kAxiosInstalledTunnel]
399
+ ) {
400
+ options.agents.https = configHttpsAgent;
401
+ }
402
+ if (proxy) {
403
+ // Read proxy fields without traversing the prototype chain. URL instances expose
404
+ // username/password/hostname/host/port/protocol via getters on URL.prototype (so
405
+ // direct reads are shielded), but plain object proxies — and the `auth` field
406
+ // (which URL does not expose) — must be guarded so a polluted Object.prototype
407
+ // (e.g. Object.prototype.auth = { username, password }) cannot inject
408
+ // attacker-controlled credentials into the Proxy-Authorization header or
409
+ // redirect proxying to an attacker-controlled host.
410
+ const isProxyURL = proxy instanceof URL;
411
+ const readProxyField = (key) =>
412
+ isProxyURL || utils.hasOwnProp(proxy, key) ? proxy[key] : undefined;
413
+
414
+ const proxyUsername = readProxyField('username');
415
+ const proxyPassword = readProxyField('password');
416
+ let proxyAuth = utils.hasOwnProp(proxy, 'auth') ? proxy.auth : undefined;
417
+
418
+ // Basic proxy authorization
419
+ if (proxyUsername) {
420
+ proxyAuth = (proxyUsername || '') + ':' + (proxyPassword || '');
421
+ }
422
+
423
+ if (proxyAuth) {
424
+ // Support proxy auth object form. Read sub-fields via own-prop checks so a
425
+ // plain object inheriting from polluted Object.prototype cannot leak creds.
426
+ const authIsObject = typeof proxyAuth === 'object';
427
+ const authUsername =
428
+ authIsObject && utils.hasOwnProp(proxyAuth, 'username') ? proxyAuth.username : undefined;
429
+ const authPassword =
430
+ authIsObject && utils.hasOwnProp(proxyAuth, 'password') ? proxyAuth.password : undefined;
431
+ const validProxyAuth = Boolean(authUsername || authPassword);
432
+
433
+ if (validProxyAuth) {
434
+ proxyAuth = (authUsername || '') + ':' + (authPassword || '');
435
+ } else if (authIsObject) {
436
+ throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
437
+ }
438
+ }
439
+
440
+ const targetIsHttps = isHttps.test(options.protocol);
441
+
442
+ if (targetIsHttps) {
443
+ // CONNECT-tunneling path for HTTPS targets. Preserves end-to-end TLS to
444
+ // the origin so the proxy cannot inspect the URL, headers, or body — the
445
+ // behavior already promised by THREATMODEL.md (T-R9). HttpsProxyAgent
446
+ // sends Proxy-Authorization on the CONNECT request only, never on the
447
+ // wrapped TLS request, which is why we don't stamp it onto
448
+ // options.headers here. If the user already supplied an HttpsProxyAgent,
449
+ // they own tunneling end-to-end and we leave them alone; otherwise we
450
+ // install our own tunneling agent and forward their TLS options (if any)
451
+ // so a custom httpsAgent for cert pinning / rejectUnauthorized still
452
+ // applies to the origin TLS upgrade.
453
+ if (!(configHttpsAgent instanceof HttpsProxyAgent)) {
454
+ const proxyHost = readProxyField('hostname') || readProxyField('host');
455
+ const proxyPort = readProxyField('port');
456
+ const rawProxyProtocol = readProxyField('protocol');
457
+ const normalizedProtocol = rawProxyProtocol
458
+ ? rawProxyProtocol.includes(':')
459
+ ? rawProxyProtocol
460
+ : `${rawProxyProtocol}:`
461
+ : 'http:';
462
+ // Bracket IPv6 literals for URL parsing; URL.hostname strips the
463
+ // brackets again on read so the agent receives the raw form.
464
+ const proxyHostForURL =
465
+ proxyHost && proxyHost.includes(':') && !proxyHost.startsWith('[')
466
+ ? `[${proxyHost}]`
467
+ : proxyHost;
468
+ const proxyURL = new URL(
469
+ `${normalizedProtocol}//${proxyHostForURL}${proxyPort ? ':' + proxyPort : ''}`
470
+ );
471
+ const agentOptions = {
472
+ protocol: proxyURL.protocol,
473
+ hostname: proxyURL.hostname.replace(/^\[|\]$/g, ''),
474
+ port: proxyURL.port,
475
+ auth: proxyAuth && typeof proxyAuth === 'string' ? proxyAuth : undefined,
476
+ };
477
+ if (proxyURL.protocol === 'https:') {
478
+ agentOptions.ALPNProtocols = ['http/1.1'];
479
+ }
480
+ const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
481
+ // Set both: `options.agent` is consumed by the native https.request path
482
+ // (maxRedirects === 0); `options.agents.https` is consumed by
483
+ // follow-redirects, which ignores `options.agent` when `options.agents`
484
+ // is present.
485
+ options.agent = tunnelingAgent;
486
+ if (options.agents) {
487
+ options.agents.https = tunnelingAgent;
488
+ }
489
+ }
490
+ } else {
491
+ // Forward-proxy mode for plaintext HTTP targets. The request line carries
492
+ // the absolute URL and the proxy sees everything — acceptable for plain
493
+ // HTTP since the wire was already plaintext.
494
+ if (proxyAuth) {
495
+ const base64 = Buffer.from(proxyAuth, 'utf8').toString('base64');
496
+ options.headers['Proxy-Authorization'] = 'Basic ' + base64;
497
+ }
498
+
499
+ // Preserve a user-supplied Host header (case-insensitive) so callers can override
500
+ // the value forwarded to the proxy; otherwise default to the request URL's host.
501
+ let hasUserHostHeader = false;
502
+ for (const name of Object.keys(options.headers)) {
503
+ if (name.toLowerCase() === 'host') {
504
+ hasUserHostHeader = true;
505
+ break;
506
+ }
507
+ }
508
+ if (!hasUserHostHeader) {
509
+ options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
510
+ }
511
+ const proxyHost = readProxyField('hostname') || readProxyField('host');
512
+ options.hostname = proxyHost;
513
+ // Replace 'host' since options is not a URL object
514
+ options.host = proxyHost;
515
+ options.port = readProxyField('port');
516
+ options.path = location;
517
+ const proxyProtocol = readProxyField('protocol');
518
+ if (proxyProtocol) {
519
+ options.protocol = proxyProtocol.includes(':') ? proxyProtocol : `${proxyProtocol}:`;
520
+ }
521
+ }
522
+ }
523
+
524
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
525
+ // Configure proxy for redirected request, passing the original config proxy to apply
526
+ // the exact same logic as if the redirected request was performed by axios directly.
527
+ setProxy(
528
+ redirectOptions,
529
+ configProxy,
530
+ redirectOptions.href,
531
+ true,
532
+ configHttpsAgent,
533
+ configHttpAgent,
534
+ allowEnvProxy
535
+ );
536
+ };
537
+
538
+ return Boolean(
539
+ proxy || (configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent))
540
+ );
541
+ }
542
+
543
+ const isHttpAdapterSupported =
544
+ typeof process !== 'undefined' && utils.kindOf(process) === 'process';
545
+
546
+ // temporary hotfix
547
+
548
+ const wrapAsync = (asyncExecutor) => {
549
+ return new Promise((resolve, reject) => {
550
+ let onDone;
551
+ let isDone;
552
+
553
+ const done = (value, isRejected) => {
554
+ if (isDone) return;
555
+ isDone = true;
556
+ onDone && onDone(value, isRejected);
557
+ };
558
+
559
+ const _resolve = (value) => {
560
+ done(value);
561
+ resolve(value);
562
+ };
563
+
564
+ const _reject = (reason) => {
565
+ done(reason, true);
566
+ reject(reason);
567
+ };
568
+
569
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
570
+ });
571
+ };
572
+
573
+ const resolveFamily = ({ address, family }) => {
574
+ if (!utils.isString(address)) {
575
+ throw new AxiosError('address must be a string', AxiosError.ERR_BAD_OPTION_VALUE);
576
+ }
577
+ return {
578
+ address,
579
+ family: family || (address.indexOf('.') < 0 ? 6 : 4),
580
+ };
581
+ };
582
+
583
+ const buildAddressEntry = (address, family) =>
584
+ resolveFamily(utils.isObject(address) ? address : { address, family });
585
+
586
+ const normalizedLookupCache = new WeakMap();
587
+
588
+ const normalizeLookup = (lookup) => {
589
+ let normalized = normalizedLookupCache.get(lookup);
590
+
591
+ if (normalized) {
592
+ return normalized;
593
+ }
594
+
595
+ const callbackLookup = callbackify(lookup, (value) => (utils.isArray(value) ? value : [value]));
596
+
597
+ // Support opt.all, which is required by current Node.js releases.
598
+ normalized = (hostname, opt, cb) => {
599
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
600
+ if (err) {
601
+ return cb(err);
602
+ }
603
+
604
+ let addresses;
605
+
606
+ try {
607
+ addresses = utils.isArray(arg0)
608
+ ? arg0.map((addr) => buildAddressEntry(addr))
609
+ : [buildAddressEntry(arg0, arg1)];
610
+ } catch (error) {
611
+ return cb(error);
612
+ }
613
+
614
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
615
+ });
616
+ };
617
+
618
+ normalizedLookupCache.set(lookup, normalized);
619
+
620
+ return normalized;
621
+ };
622
+
623
+ const http2Transport = {
624
+ request(options, cb) {
625
+ const authority =
626
+ options.protocol +
627
+ '//' +
628
+ options.hostname +
629
+ ':' +
630
+ (options.port || (options.protocol === 'https:' ? 443 : 80));
631
+
632
+ const { http2Options, headers } = options;
633
+
634
+ const session = http2Sessions.getSession(authority, http2Options);
635
+
636
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } =
637
+ http2.constants;
638
+
639
+ const http2Headers = {
640
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
641
+ [HTTP2_HEADER_METHOD]: options.method,
642
+ [HTTP2_HEADER_PATH]: options.path,
643
+ };
644
+
645
+ utils.forEach(headers, (header, name) => {
646
+ name.charAt(0) !== ':' && (http2Headers[name] = header);
647
+ });
648
+
649
+ const req = session.request(http2Headers);
650
+
651
+ req.once('response', (responseHeaders) => {
652
+ const response = req; //duplex
653
+
654
+ responseHeaders = Object.assign({}, responseHeaders);
655
+
656
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
657
+
658
+ delete responseHeaders[HTTP2_HEADER_STATUS];
659
+
660
+ response.headers = responseHeaders;
661
+
662
+ response.statusCode = +status;
663
+
664
+ cb(response);
665
+ });
666
+
667
+ return req;
668
+ },
669
+ };
670
+
671
+ /*eslint consistent-return:0*/
672
+ export default isHttpAdapterSupported &&
673
+ function httpAdapter(config) {
674
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
675
+ // Read config pollution-safely: own properties and members inherited from
676
+ // a non-Object.prototype source (e.g. an Object.create(defaults) template)
677
+ // are honored, but values injected onto a polluted Object.prototype are
678
+ // ignored. All behavior-affecting reads in this adapter go through own()
679
+ // so the protection boundary stays consistent.
680
+ const own = (key) => utils.getSafeProp(config, key);
681
+ const transitional = own('transitional') || transitionalDefaults;
682
+ let data = own('data');
683
+ let lookup = own('lookup');
684
+ let family = own('family');
685
+ let httpVersion = own('httpVersion');
686
+ if (httpVersion === undefined) httpVersion = 1;
687
+ const rawHttpVersion = httpVersion;
688
+ let http2Options = own('http2Options');
689
+ const configProxy = own('proxy');
690
+ const httpAgent = own('httpAgent');
691
+ const httpsAgent = own('httpsAgent');
692
+ const responseType = own('responseType');
693
+ const responseEncoding = own('responseEncoding');
694
+ const socketPath = own('socketPath');
695
+ const method = own('method').toUpperCase();
696
+ const maxRedirects = own('maxRedirects');
697
+ const maxBodyLength = own('maxBodyLength');
698
+ const maxContentLength = own('maxContentLength');
699
+ const decompress = own('decompress');
700
+ let isDone;
701
+ let rejected = false;
702
+ let req;
703
+ let connectPhaseTimer;
704
+
705
+ try {
706
+ httpVersion = +httpVersion;
707
+ } catch (err) {
708
+ throw new AxiosError(
709
+ 'Invalid protocol version: value is not a number',
710
+ AxiosError.ERR_BAD_OPTION_VALUE,
711
+ config
712
+ );
713
+ }
714
+
715
+ if (Number.isNaN(httpVersion)) {
716
+ throw new AxiosError(
717
+ `Invalid protocol version: '${rawHttpVersion}' is not a number`,
718
+ AxiosError.ERR_BAD_OPTION_VALUE,
719
+ config
720
+ );
721
+ }
722
+
723
+ if (httpVersion !== 1 && httpVersion !== 2) {
724
+ throw new AxiosError(
725
+ `Unsupported protocol version '${httpVersion}'`,
726
+ AxiosError.ERR_BAD_OPTION_VALUE,
727
+ config
728
+ );
729
+ }
730
+
731
+ const isHttp2 = httpVersion === 2;
732
+
733
+ if (lookup) {
734
+ lookup = normalizeLookup(lookup);
735
+ }
736
+
737
+ const abortEmitter = new EventEmitter();
738
+
739
+ function abort(reason) {
740
+ try {
741
+ abortEmitter.emit(
742
+ 'abort',
743
+ !reason || reason.type ? new CanceledError(null, config, req) : reason
744
+ );
745
+ } catch (err) {
746
+ // ignore emit errors
747
+ }
748
+ }
749
+
750
+ function clearConnectPhaseTimer() {
751
+ if (connectPhaseTimer) {
752
+ clearTimeout(connectPhaseTimer);
753
+ connectPhaseTimer = null;
754
+ }
755
+ }
756
+
757
+ function createTimeoutError() {
758
+ const configTimeout = own('timeout');
759
+ let timeoutErrorMessage = configTimeout
760
+ ? 'timeout of ' + configTimeout + 'ms exceeded'
761
+ : 'timeout exceeded';
762
+ const configTimeoutErrorMessage = own('timeoutErrorMessage');
763
+ if (configTimeoutErrorMessage) {
764
+ timeoutErrorMessage = configTimeoutErrorMessage;
765
+ }
766
+ return new AxiosError(
767
+ timeoutErrorMessage,
768
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
769
+ config,
770
+ req
771
+ );
772
+ }
773
+
774
+ abortEmitter.once('abort', reject);
775
+
776
+ const onFinished = () => {
777
+ clearConnectPhaseTimer();
778
+
779
+ if (config.cancelToken) {
780
+ config.cancelToken.unsubscribe(abort);
781
+ }
782
+
783
+ if (config.signal) {
784
+ config.signal.removeEventListener('abort', abort);
785
+ }
786
+
787
+ abortEmitter.removeAllListeners();
788
+ };
789
+
790
+ if (config.cancelToken || config.signal) {
791
+ config.cancelToken && config.cancelToken.subscribe(abort);
792
+ if (config.signal) {
793
+ config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
794
+ }
795
+ }
796
+
797
+ onDone((response, isRejected) => {
798
+ isDone = true;
799
+ clearConnectPhaseTimer();
800
+
801
+ if (isRejected) {
802
+ rejected = true;
803
+ onFinished();
804
+ return;
805
+ }
806
+
807
+ const { data } = response;
808
+
809
+ if (data instanceof stream.Readable || data instanceof stream.Duplex) {
810
+ const offListeners = stream.finished(data, () => {
811
+ offListeners();
812
+ onFinished();
813
+ });
814
+ } else {
815
+ onFinished();
816
+ }
817
+ });
818
+
819
+ // Parse url
820
+ const fullPath = buildFullPath(own('baseURL'), own('url'), own('allowAbsoluteUrls'), config);
821
+ // Unix-socket requests (own socketPath) commonly pass a path-only url
822
+ // like '/foo'; supply a synthetic base so new URL() can still parse it.
823
+ // Use the own-property value (not config.socketPath) so a polluted
824
+ // prototype cannot influence URL base selection.
825
+ const urlBase = socketPath
826
+ ? 'http://localhost'
827
+ : platform.hasBrowserEnv
828
+ ? platform.origin
829
+ : undefined;
830
+ const parsed = new URL(fullPath, urlBase);
831
+ const protocol = parsed.protocol || supportedProtocols[0];
832
+
833
+ if (protocol === 'data:') {
834
+ // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
835
+ if (maxContentLength > -1) {
836
+ // Use the exact string passed to fromDataURI (the configured url); fall back to fullPath if needed.
837
+ const dataUrl = String(own('url') || fullPath || '');
838
+ const estimated = estimateDataURLBufferAllocation(dataUrl);
839
+
840
+ if (estimated > maxContentLength) {
841
+ return reject(
842
+ new AxiosError(
843
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
844
+ AxiosError.ERR_BAD_RESPONSE,
845
+ config
846
+ )
847
+ );
848
+ }
849
+ }
850
+
851
+ let convertedData;
852
+
853
+ if (method !== 'GET') {
854
+ return settle(resolve, reject, {
855
+ status: 405,
856
+ statusText: 'method not allowed',
857
+ headers: {},
858
+ config,
859
+ });
860
+ }
861
+
862
+ try {
863
+ convertedData = fromDataURI(own('url'), responseType === 'blob', {
864
+ Blob: config.env && config.env.Blob,
865
+ });
866
+ } catch (err) {
867
+ throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
868
+ }
869
+
870
+ // Check bytes before converting the result to text or a stream.
871
+ if (
872
+ maxContentLength > -1 &&
873
+ (responseType === 'blob' ? convertedData.size : convertedData.length) > maxContentLength
874
+ ) {
875
+ return reject(
876
+ new AxiosError(
877
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
878
+ AxiosError.ERR_BAD_RESPONSE,
879
+ config
880
+ )
881
+ );
882
+ }
883
+
884
+ if (responseType === 'text') {
885
+ convertedData = convertedData.toString(responseEncoding);
886
+
887
+ if (!responseEncoding || responseEncoding === 'utf8') {
888
+ convertedData = utils.stripBOM(convertedData);
889
+ }
890
+ } else if (responseType === 'stream') {
891
+ convertedData = stream.Readable.from(convertedData);
892
+ }
893
+
894
+ return settle(resolve, reject, {
895
+ data: convertedData,
896
+ status: 200,
897
+ statusText: 'OK',
898
+ headers: new AxiosHeaders(),
899
+ config,
900
+ });
901
+ }
902
+
903
+ if (supportedProtocols.indexOf(protocol) === -1) {
904
+ return reject(
905
+ new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config)
906
+ );
907
+ }
908
+
909
+ const headers = AxiosHeaders.from(config.headers).normalize();
910
+
911
+ // Set User-Agent (required by some servers)
912
+ // See https://github.com/axios/axios/issues/69
913
+ // User-Agent is specified; handle case where no UA header is desired
914
+ // Only set header if it hasn't been set in config
915
+ headers.set('User-Agent', 'axios/' + VERSION, false);
916
+
917
+ const { onUploadProgress, onDownloadProgress } = config;
918
+ const maxRate = config.maxRate;
919
+ let maxUploadRate = undefined;
920
+ let maxDownloadRate = undefined;
921
+
922
+ // support for spec compliant FormData objects
923
+ if (utils.isSpecCompliantForm(data)) {
924
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
925
+
926
+ data = formDataToStream(
927
+ data,
928
+ (formHeaders) => {
929
+ headers.set(formHeaders);
930
+ },
931
+ {
932
+ tag: `axios-${VERSION}-boundary`,
933
+ boundary: (userBoundary && userBoundary[1]) || undefined,
934
+ }
935
+ );
936
+ // support for https://www.npmjs.com/package/form-data api
937
+ } else if (
938
+ utils.isFormData(data) &&
939
+ utils.isFunction(data.getHeaders) &&
940
+ data.getHeaders !== Object.prototype.getHeaders
941
+ ) {
942
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
943
+
944
+ if (!headers.hasContentLength()) {
945
+ try {
946
+ const knownLength = await util.promisify(data.getLength).call(data);
947
+ Number.isFinite(knownLength) &&
948
+ knownLength >= 0 &&
949
+ headers.setContentLength(knownLength);
950
+ /*eslint no-empty:0*/
951
+ } catch (e) {}
952
+ }
953
+ } else if (utils.isBlob(data) || utils.isFile(data)) {
954
+ data.size && headers.setContentType(data.type || 'application/octet-stream');
955
+ headers.setContentLength(data.size || 0);
956
+ data = stream.Readable.from(readBlob(data));
957
+ } else if (data && !utils.isStream(data)) {
958
+ if (Buffer.isBuffer(data)) {
959
+ // Nothing to do...
960
+ } else if (utils.isArrayBuffer(data)) {
961
+ data = Buffer.from(new Uint8Array(data));
962
+ } else if (utils.isString(data)) {
963
+ data = Buffer.from(data, 'utf-8');
964
+ } else {
965
+ return reject(
966
+ new AxiosError(
967
+ 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
968
+ AxiosError.ERR_BAD_REQUEST,
969
+ config
970
+ )
971
+ );
972
+ }
973
+
974
+ // Add Content-Length header if data exists
975
+ headers.setContentLength(data.length, false);
976
+
977
+ if (maxBodyLength > -1 && data.length > maxBodyLength) {
978
+ return reject(
979
+ new AxiosError(
980
+ 'Request body larger than maxBodyLength limit',
981
+ AxiosError.ERR_BAD_REQUEST,
982
+ config
983
+ )
984
+ );
985
+ }
986
+ }
987
+
988
+ const contentLength = utils.toFiniteNumber(headers.getContentLength());
989
+
990
+ if (utils.isArray(maxRate)) {
991
+ maxUploadRate = maxRate[0];
992
+ maxDownloadRate = maxRate[1];
993
+ } else {
994
+ maxUploadRate = maxDownloadRate = maxRate;
995
+ }
996
+
997
+ if (data && (onUploadProgress || maxUploadRate)) {
998
+ if (!utils.isStream(data)) {
999
+ data = stream.Readable.from(data, { objectMode: false });
1000
+ }
1001
+
1002
+ data = stream.pipeline(
1003
+ [
1004
+ data,
1005
+ new AxiosTransformStream({
1006
+ maxRate: utils.toFiniteNumber(maxUploadRate),
1007
+ }),
1008
+ ],
1009
+ utils.noop
1010
+ );
1011
+
1012
+ onUploadProgress &&
1013
+ data.on(
1014
+ 'progress',
1015
+ flushOnFinish(
1016
+ data,
1017
+ progressEventDecorator(
1018
+ contentLength,
1019
+ progressEventReducer(asyncDecorator(onUploadProgress, scheduleProgress), false, 3)
1020
+ )
1021
+ )
1022
+ );
1023
+ }
1024
+
1025
+ // HTTP basic authentication
1026
+ let auth = undefined;
1027
+ const configAuth = own('auth');
1028
+ if (configAuth) {
1029
+ const username = utils.getSafeProp(configAuth, 'username') || '';
1030
+ const password = utils.getSafeProp(configAuth, 'password') || '';
1031
+ auth = username + ':' + password;
1032
+ }
1033
+
1034
+ if (!auth && (parsed.username || parsed.password)) {
1035
+ const urlUsername = decodeURIComponentSafe(parsed.username);
1036
+ const urlPassword = decodeURIComponentSafe(parsed.password);
1037
+ auth = urlUsername + ':' + urlPassword;
1038
+ }
1039
+
1040
+ auth && headers.delete('authorization');
1041
+
1042
+ let path;
1043
+
1044
+ try {
1045
+ path = buildURL(
1046
+ parsed.pathname + parsed.search,
1047
+ own('params'),
1048
+ own('paramsSerializer')
1049
+ ).replace(/^\?/, '');
1050
+ } catch (err) {
1051
+ return reject(
1052
+ AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config, null, null, {
1053
+ url: own('url'),
1054
+ exists: true,
1055
+ })
1056
+ );
1057
+ }
1058
+
1059
+ headers.set(
1060
+ 'Accept-Encoding',
1061
+ utils.hasOwnProp(transitional, 'advertiseZstdAcceptEncoding') &&
1062
+ transitional.advertiseZstdAcceptEncoding === true
1063
+ ? ACCEPT_ENCODING_WITH_ZSTD
1064
+ : ACCEPT_ENCODING,
1065
+ false
1066
+ );
1067
+
1068
+ if (isHttp2 && lookup) {
1069
+ http2Options = Object.assign(Object.create(null), http2Options, { lookup });
1070
+ }
1071
+
1072
+ // Null-prototype to block prototype pollution gadgets on properties read
1073
+ // directly by Node's http.request (e.g. insecureHTTPParser, lookup).
1074
+ const options = Object.assign(Object.create(null), {
1075
+ path,
1076
+ method: method,
1077
+ headers: toByteStringHeaderObject(headers),
1078
+ agents: { http: httpAgent, https: httpsAgent },
1079
+ auth,
1080
+ protocol,
1081
+ family,
1082
+ beforeRedirect: dispatchBeforeRedirect,
1083
+ beforeRedirects: Object.create(null),
1084
+ http2Options,
1085
+ createConnection: undefined,
1086
+ });
1087
+
1088
+ // cacheable-lookup integration hotfix
1089
+ !utils.isUndefined(lookup) && (options.lookup = lookup);
1090
+
1091
+ let proxyApplied = false;
1092
+
1093
+ if (socketPath) {
1094
+ if (typeof socketPath !== 'string') {
1095
+ return reject(
1096
+ new AxiosError('socketPath must be a string', AxiosError.ERR_BAD_OPTION_VALUE, config)
1097
+ );
1098
+ }
1099
+
1100
+ const allowedSocketPaths = own('allowedSocketPaths');
1101
+ if (allowedSocketPaths != null) {
1102
+ const allowed = Array.isArray(allowedSocketPaths)
1103
+ ? allowedSocketPaths
1104
+ : [allowedSocketPaths];
1105
+
1106
+ const resolvedSocket = resolvePath(socketPath);
1107
+ const isAllowed = allowed.some(
1108
+ (entry) => typeof entry === 'string' && resolvePath(entry) === resolvedSocket
1109
+ );
1110
+
1111
+ if (!isAllowed) {
1112
+ return reject(
1113
+ new AxiosError(
1114
+ `socketPath "${socketPath}" is not permitted by allowedSocketPaths`,
1115
+ AxiosError.ERR_BAD_OPTION_VALUE,
1116
+ config
1117
+ )
1118
+ );
1119
+ }
1120
+ }
1121
+
1122
+ options.socketPath = socketPath;
1123
+ } else {
1124
+ options.hostname = parsed.hostname.startsWith('[')
1125
+ ? parsed.hostname.slice(1, -1)
1126
+ : parsed.hostname;
1127
+ options.port = parsed.port;
1128
+ proxyApplied = setProxy(
1129
+ options,
1130
+ configProxy,
1131
+ protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path,
1132
+ false,
1133
+ httpsAgent,
1134
+ httpAgent,
1135
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
1136
+ // cannot apply either axios-resolved or agent-local environment proxies.
1137
+ // Explicit proxy config is still processed and rejected below.
1138
+ !isHttp2
1139
+ );
1140
+ }
1141
+ let transport;
1142
+ let isNativeTransport = false;
1143
+ const isHttpsRequest = isHttps.test(options.protocol);
1144
+ // Don't clobber a CONNECT-tunneling agent installed by setProxy() for an
1145
+ // HTTPS target.
1146
+ if (!isHttp2 && configProxy === false) {
1147
+ setDirectAgent(options, httpAgent, httpsAgent);
1148
+ options.beforeRedirects.direct = (redirectOptions) => {
1149
+ setDirectAgent(redirectOptions, httpAgent, httpsAgent);
1150
+ };
1151
+ } else if (options.agent == null) {
1152
+ options.agent = isHttpsRequest ? httpsAgent : httpAgent;
1153
+ }
1154
+
1155
+ if (isHttp2) {
1156
+ if (proxyApplied) {
1157
+ return reject(
1158
+ new AxiosError(
1159
+ 'HTTP/2 requests with a proxy are not supported',
1160
+ AxiosError.ERR_NOT_SUPPORT,
1161
+ config
1162
+ )
1163
+ );
1164
+ }
1165
+
1166
+ transport = http2Transport;
1167
+ } else {
1168
+ const configTransport = own('transport');
1169
+ if (configTransport) {
1170
+ transport = configTransport;
1171
+ } else if (maxRedirects === 0) {
1172
+ transport = isHttpsRequest ? https : http;
1173
+ isNativeTransport = true;
1174
+ } else {
1175
+ options.sensitiveHeaders = [];
1176
+ if (maxRedirects) {
1177
+ options.maxRedirects = maxRedirects;
1178
+ }
1179
+ const configBeforeRedirect = own('beforeRedirect');
1180
+ if (configBeforeRedirect) {
1181
+ options.beforeRedirects.config = configBeforeRedirect;
1182
+ }
1183
+ if (auth) {
1184
+ // Restore HTTP Basic credentials on same-origin redirects only.
1185
+ // follow-redirects >= 1.15.8 strips Authorization on every redirect (see #6929);
1186
+ // cross-origin stripping is the documented mitigation for T-R2 in THREATMODEL.md
1187
+ // and is preserved by deliberately not restoring on origin change.
1188
+ const requestOrigin = parsed.origin;
1189
+ const authToRestore = auth;
1190
+ options.beforeRedirects.auth = function beforeRedirectAuth(redirectOptions) {
1191
+ try {
1192
+ if (new URL(redirectOptions.href).origin === requestOrigin) {
1193
+ redirectOptions.auth = authToRestore;
1194
+ }
1195
+ } catch (e) {
1196
+ // ignore malformed URL: leaving auth stripped is fail-safe
1197
+ }
1198
+ };
1199
+ }
1200
+ const sensitiveHeaders = own('sensitiveHeaders');
1201
+ if (sensitiveHeaders != null) {
1202
+ if (!utils.isArray(sensitiveHeaders)) {
1203
+ return reject(
1204
+ new AxiosError(
1205
+ 'sensitiveHeaders must be an array of strings',
1206
+ AxiosError.ERR_BAD_OPTION_VALUE,
1207
+ config
1208
+ )
1209
+ );
1210
+ }
1211
+
1212
+ const sensitiveSet = new Set();
1213
+ for (const header of sensitiveHeaders) {
1214
+ if (!utils.isString(header)) {
1215
+ return reject(
1216
+ new AxiosError(
1217
+ 'sensitiveHeaders must be an array of strings',
1218
+ AxiosError.ERR_BAD_OPTION_VALUE,
1219
+ config
1220
+ )
1221
+ );
1222
+ }
1223
+
1224
+ sensitiveSet.add(header.toLowerCase());
1225
+ }
1226
+
1227
+ if (sensitiveSet.size) {
1228
+ options.sensitiveHeaders = Array.from(sensitiveSet);
1229
+ options.beforeRedirects.sensitiveHeaders = function beforeRedirectSensitiveHeaders(
1230
+ redirectOptions,
1231
+ requestDetails
1232
+ ) {
1233
+ if (!isSameOriginRedirect(redirectOptions, requestDetails)) {
1234
+ stripMatchingHeaders(redirectOptions.headers, sensitiveSet);
1235
+ }
1236
+ };
1237
+ }
1238
+ }
1239
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
1240
+ }
1241
+ }
1242
+
1243
+ // Set an explicit maxBodyLength option for transports that inspect it.
1244
+ // When maxBodyLength is -1 (default/unlimited), use Infinity so
1245
+ // follow-redirects does not fall back to its own 10MB default.
1246
+ if (maxBodyLength > -1) {
1247
+ options.maxBodyLength = maxBodyLength;
1248
+ } else {
1249
+ options.maxBodyLength = Infinity;
1250
+ }
1251
+
1252
+ // Always set an explicit own value so a polluted
1253
+ // Object.prototype.insecureHTTPParser cannot enable the lenient parser
1254
+ // through Node's internal options copy
1255
+ options.insecureHTTPParser = Boolean(own('insecureHTTPParser'));
1256
+
1257
+ // Create the request
1258
+ req = transport.request(options, function handleResponse(res) {
1259
+ clearConnectPhaseTimer();
1260
+
1261
+ if (req.destroyed) return;
1262
+
1263
+ const streams = [res];
1264
+
1265
+ const responseLength = utils.toFiniteNumber(res.headers['content-length']);
1266
+
1267
+ if (onDownloadProgress || maxDownloadRate) {
1268
+ const transformStream = new AxiosTransformStream({
1269
+ maxRate: utils.toFiniteNumber(maxDownloadRate),
1270
+ });
1271
+
1272
+ onDownloadProgress &&
1273
+ transformStream.on(
1274
+ 'progress',
1275
+ flushOnFinish(
1276
+ transformStream,
1277
+ progressEventDecorator(
1278
+ responseLength,
1279
+ progressEventReducer(
1280
+ asyncDecorator(onDownloadProgress, scheduleProgress),
1281
+ true,
1282
+ 3
1283
+ )
1284
+ )
1285
+ )
1286
+ );
1287
+
1288
+ streams.push(transformStream);
1289
+ }
1290
+
1291
+ // decompress the response body transparently if required
1292
+ let responseStream = res;
1293
+
1294
+ // return the last request in case of redirects
1295
+ const lastRequest = res.req || req;
1296
+
1297
+ // if decompress disabled we should not decompress
1298
+ if (decompress !== false && res.headers['content-encoding']) {
1299
+ // if no content, but headers still say that it is encoded,
1300
+ // remove the header not confuse downstream operations
1301
+ if (method === 'HEAD' || res.statusCode === 204) {
1302
+ delete res.headers['content-encoding'];
1303
+ }
1304
+
1305
+ switch ((res.headers['content-encoding'] || '').toLowerCase()) {
1306
+ /*eslint default-case:0*/
1307
+ case 'gzip':
1308
+ case 'x-gzip':
1309
+ case 'compress':
1310
+ case 'x-compress':
1311
+ // add the unzipper to the body stream processing pipeline
1312
+ streams.push(zlib.createUnzip(zlibOptions));
1313
+
1314
+ // remove the content-encoding in order to not confuse downstream operations
1315
+ delete res.headers['content-encoding'];
1316
+ break;
1317
+ case 'deflate':
1318
+ streams.push(new ZlibHeaderTransformStream());
1319
+
1320
+ // add the unzipper to the body stream processing pipeline
1321
+ streams.push(zlib.createUnzip(zlibOptions));
1322
+
1323
+ // remove the content-encoding in order to not confuse downstream operations
1324
+ delete res.headers['content-encoding'];
1325
+ break;
1326
+ case 'br':
1327
+ if (isBrotliSupported) {
1328
+ streams.push(zlib.createBrotliDecompress(brotliOptions));
1329
+ delete res.headers['content-encoding'];
1330
+ }
1331
+ break;
1332
+ case 'zstd':
1333
+ if (isZstdSupported) {
1334
+ streams.push(zlib.createZstdDecompress(zstdOptions));
1335
+ delete res.headers['content-encoding'];
1336
+ }
1337
+ break;
1338
+ }
1339
+ }
1340
+
1341
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
1342
+
1343
+ const response = {
1344
+ status: res.statusCode,
1345
+ statusText: res.statusMessage,
1346
+ headers: new AxiosHeaders(res.headers),
1347
+ config,
1348
+ request: lastRequest,
1349
+ };
1350
+
1351
+ if (responseType === 'stream') {
1352
+ // Enforce maxContentLength on streamed responses; previously this
1353
+ // was applied only to buffered responses.
1354
+ if (maxContentLength > -1) {
1355
+ const limit = maxContentLength;
1356
+ const source = responseStream;
1357
+ async function* enforceMaxContentLength() {
1358
+ let totalResponseBytes = 0;
1359
+ for await (const chunk of source) {
1360
+ totalResponseBytes += chunk.length;
1361
+ if (totalResponseBytes > limit) {
1362
+ throw new AxiosError(
1363
+ 'maxContentLength size of ' + limit + ' exceeded',
1364
+ AxiosError.ERR_BAD_RESPONSE,
1365
+ config,
1366
+ lastRequest
1367
+ );
1368
+ }
1369
+ yield chunk;
1370
+ }
1371
+ }
1372
+ responseStream = stream.Readable.from(enforceMaxContentLength(), {
1373
+ objectMode: false,
1374
+ });
1375
+ }
1376
+ response.data = responseStream;
1377
+ settle(resolve, reject, response);
1378
+ } else {
1379
+ const responseBuffer = [];
1380
+ let totalResponseBytes = 0;
1381
+
1382
+ responseStream.on('data', function handleStreamData(chunk) {
1383
+ responseBuffer.push(chunk);
1384
+ totalResponseBytes += chunk.length;
1385
+
1386
+ // make sure the content length is not over the maxContentLength if specified
1387
+ if (maxContentLength > -1 && totalResponseBytes > maxContentLength) {
1388
+ // stream.destroy() emit aborted event before calling reject() on Node.js v16
1389
+ rejected = true;
1390
+ responseStream.destroy();
1391
+ abort(
1392
+ new AxiosError(
1393
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
1394
+ AxiosError.ERR_BAD_RESPONSE,
1395
+ config,
1396
+ lastRequest
1397
+ )
1398
+ );
1399
+ }
1400
+ });
1401
+
1402
+ responseStream.on('aborted', function handlerStreamAborted() {
1403
+ if (rejected) {
1404
+ return;
1405
+ }
1406
+
1407
+ const err = new AxiosError(
1408
+ 'stream has been aborted',
1409
+ AxiosError.ERR_BAD_RESPONSE,
1410
+ config,
1411
+ lastRequest,
1412
+ response
1413
+ );
1414
+ responseStream.destroy(err);
1415
+ reject(err);
1416
+ });
1417
+
1418
+ responseStream.on('error', function handleStreamError(err) {
1419
+ if (rejected) return;
1420
+ reject(AxiosError.from(err, null, config, lastRequest, response));
1421
+ });
1422
+
1423
+ responseStream.on('end', function handleStreamEnd() {
1424
+ try {
1425
+ let responseData =
1426
+ responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
1427
+ if (responseType !== 'arraybuffer') {
1428
+ responseData = responseData.toString(responseEncoding);
1429
+ if (!responseEncoding || responseEncoding === 'utf8') {
1430
+ responseData = utils.stripBOM(responseData);
1431
+ }
1432
+ }
1433
+ response.data = responseData;
1434
+ } catch (err) {
1435
+ return reject(AxiosError.from(err, null, config, response.request, response));
1436
+ }
1437
+ settle(resolve, reject, response);
1438
+ });
1439
+ }
1440
+
1441
+ abortEmitter.once('abort', (err) => {
1442
+ if (!responseStream.destroyed) {
1443
+ responseStream.emit('error', err);
1444
+ responseStream.destroy();
1445
+ }
1446
+ });
1447
+ });
1448
+
1449
+ abortEmitter.once('abort', (err) => {
1450
+ if (req.close) {
1451
+ req.close();
1452
+ } else {
1453
+ req.destroy(err);
1454
+ }
1455
+ });
1456
+
1457
+ // Handle errors
1458
+ req.on('error', function handleRequestError(err) {
1459
+ reject(AxiosError.from(err, null, config, req));
1460
+ });
1461
+
1462
+ // set tcp keep alive to prevent drop connection by peer
1463
+ // Track every socket bound to this outer RedirectableRequest so a single
1464
+ // 'close' listener can release ownership on all of them. follow-redirects
1465
+ // re-emits the 'socket' event for each hop's native request onto the same
1466
+ // outer request, so attaching per-request listeners inside this handler
1467
+ // would accumulate across hops and trigger MaxListenersExceededWarning at
1468
+ // >= 11 redirects. Clearing only the last-bound socket would leave stale
1469
+ // kAxiosCurrentReq refs on earlier hop sockets returned to the keep-alive
1470
+ // pool, causing an idle-pool 'error' to be attributed to a closed req.
1471
+ const boundSockets = new Set();
1472
+
1473
+ req.on('socket', function handleRequestSocket(socket) {
1474
+ // default interval of sending ack packet is 1 minute
1475
+ // proxy agents (e.g. agent-base) may return a generic Duplex stream
1476
+ // that doesn't have setKeepAlive, so guard before calling
1477
+ if (typeof socket.setKeepAlive === 'function') {
1478
+ socket.setKeepAlive(true, 1000 * 60);
1479
+ }
1480
+
1481
+ // Install one shared 'error' listener per socket. The symbol follows the
1482
+ // currently-active request as pooled sockets are reassigned (issue #10780).
1483
+ if (!socket[kAxiosSocketListener]) {
1484
+ socket.on('error', handleSocketError);
1485
+ socket[kAxiosSocketListener] = true;
1486
+ }
1487
+
1488
+ socket[kAxiosCurrentReq] = req;
1489
+ boundSockets.add(socket);
1490
+ });
1491
+
1492
+ req.once('close', function clearCurrentReq() {
1493
+ clearConnectPhaseTimer();
1494
+
1495
+ for (const socket of boundSockets) {
1496
+ if (socket[kAxiosCurrentReq] === req) {
1497
+ socket[kAxiosCurrentReq] = null;
1498
+ }
1499
+ }
1500
+ boundSockets.clear();
1501
+ });
1502
+
1503
+ // Handle request timeout
1504
+ if (own('timeout')) {
1505
+ // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
1506
+ const timeout = parseInt(own('timeout'), 10);
1507
+
1508
+ if (Number.isNaN(timeout)) {
1509
+ abort(
1510
+ new AxiosError(
1511
+ 'error trying to parse `config.timeout` to int',
1512
+ AxiosError.ERR_BAD_OPTION_VALUE,
1513
+ config,
1514
+ req
1515
+ )
1516
+ );
1517
+
1518
+ return;
1519
+ }
1520
+
1521
+ const handleTimeout = function handleTimeout() {
1522
+ if (isDone) return;
1523
+ abort(createTimeoutError());
1524
+ };
1525
+
1526
+ if (isNativeTransport && timeout > 0) {
1527
+ // Native ClientRequest#setTimeout starts from the socket lifecycle and
1528
+ // may not fire while TCP connect is still pending. Mirror the
1529
+ // follow-redirects wall-clock timer for the maxRedirects === 0 path.
1530
+ connectPhaseTimer = setTimeout(handleTimeout, timeout);
1531
+ }
1532
+
1533
+ // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
1534
+ // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
1535
+ // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
1536
+ // And then these socket which be hang up will devouring CPU little by little.
1537
+ // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
1538
+ req.setTimeout(timeout, handleTimeout);
1539
+ } else {
1540
+ // explicitly reset the socket timeout value for a possible `keep-alive` request
1541
+ req.setTimeout(0);
1542
+ }
1543
+
1544
+ // Send the request
1545
+ if (utils.isStream(data)) {
1546
+ let ended = false;
1547
+ let errored = false;
1548
+
1549
+ data.on('end', () => {
1550
+ ended = true;
1551
+ });
1552
+
1553
+ data.once('error', (err) => {
1554
+ errored = true;
1555
+ req.destroy(err);
1556
+ });
1557
+
1558
+ data.on('close', () => {
1559
+ if (!ended && !errored) {
1560
+ abort(new CanceledError('Request stream has been aborted', config, req));
1561
+ }
1562
+ });
1563
+
1564
+ // Transform decodes string chunks to Buffers before counting, so every
1565
+ // transport receives at most maxBodyLength encoded bytes.
1566
+ let uploadStream = data;
1567
+ if (maxBodyLength > -1) {
1568
+ const limit = maxBodyLength;
1569
+ let bytesSent = 0;
1570
+ uploadStream = stream.pipeline(
1571
+ [
1572
+ data,
1573
+ new stream.Transform({
1574
+ transform(chunk, _enc, cb) {
1575
+ bytesSent += chunk.length;
1576
+ if (bytesSent > limit) {
1577
+ return cb(
1578
+ new AxiosError(
1579
+ 'Request body larger than maxBodyLength limit',
1580
+ AxiosError.ERR_BAD_REQUEST,
1581
+ config,
1582
+ req
1583
+ )
1584
+ );
1585
+ }
1586
+ cb(null, chunk);
1587
+ },
1588
+ }),
1589
+ ],
1590
+ utils.noop
1591
+ );
1592
+ uploadStream.on('error', (err) => {
1593
+ if (!req.destroyed) req.destroy(err);
1594
+ });
1595
+ }
1596
+
1597
+ uploadStream.pipe(req);
1598
+ } else {
1599
+ data && req.write(data);
1600
+ req.end();
1601
+ }
1602
+ });
1603
+ };
1604
+
1605
+ export const __setProxy = setProxy;
1606
+ export const __getDirectAgent = getDirectAgent;
1607
+ export const __isNodeNativeEnvProxySupported = isNodeNativeEnvProxySupported;
1608
+ export const __isNodeEnvProxyEnabled = isNodeEnvProxyEnabled;
1609
+ export const __isSameOriginRedirect = isSameOriginRedirect;