@nocobase/plugin-ai-gigachat 2.2.16 → 2.2.18

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