appium-mac2-driver 4.5.0 → 4.5.1

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 (295) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/lib/session-claim-handler.d.ts.map +1 -1
  3. package/build/lib/session-claim-handler.js +1 -2
  4. package/build/lib/session-claim-handler.js.map +1 -1
  5. package/build/lib/wda-mac.d.ts +0 -1
  6. package/build/lib/wda-mac.d.ts.map +1 -1
  7. package/build/lib/wda-mac.js +1 -1
  8. package/lib/session-claim-handler.ts +1 -2
  9. package/lib/wda-mac.ts +1 -2
  10. package/node_modules/@appium/support/build/lib/npm.d.ts.map +1 -1
  11. package/node_modules/@appium/support/build/lib/npm.js +2 -1
  12. package/node_modules/@appium/support/build/lib/npm.js.map +1 -1
  13. package/node_modules/@appium/support/build/lib/util.d.ts.map +1 -1
  14. package/node_modules/@appium/support/build/lib/util.js +13 -1
  15. package/node_modules/@appium/support/build/lib/util.js.map +1 -1
  16. package/node_modules/@appium/support/build/lib/zip.d.ts +2 -1
  17. package/node_modules/@appium/support/build/lib/zip.d.ts.map +1 -1
  18. package/node_modules/@appium/support/build/lib/zip.js +193 -64
  19. package/node_modules/@appium/support/build/lib/zip.js.map +1 -1
  20. package/node_modules/@appium/support/lib/npm.ts +2 -1
  21. package/node_modules/@appium/support/lib/util.ts +13 -1
  22. package/node_modules/@appium/support/lib/zip.ts +231 -71
  23. package/node_modules/@appium/support/node_modules/axios/CHANGELOG.md +1934 -0
  24. package/node_modules/@appium/support/node_modules/axios/LICENSE +7 -0
  25. package/node_modules/@appium/support/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  26. package/node_modules/@appium/support/node_modules/axios/README.md +2851 -0
  27. package/node_modules/@appium/support/node_modules/axios/dist/axios.js +5807 -0
  28. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js +5 -0
  29. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js.map +1 -0
  30. package/node_modules/@appium/support/node_modules/axios/dist/browser/axios.cjs +5829 -0
  31. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.js +5850 -0
  32. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js +3 -0
  33. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  34. package/node_modules/@appium/support/node_modules/axios/dist/node/axios.cjs +6808 -0
  35. package/node_modules/@appium/support/node_modules/axios/index.d.cts +766 -0
  36. package/node_modules/@appium/support/node_modules/axios/index.d.ts +787 -0
  37. package/node_modules/@appium/support/node_modules/axios/index.js +45 -0
  38. package/node_modules/@appium/support/node_modules/axios/lib/adapters/README.md +36 -0
  39. package/node_modules/@appium/support/node_modules/axios/lib/adapters/adapters.js +132 -0
  40. package/node_modules/@appium/support/node_modules/axios/lib/adapters/fetch.js +696 -0
  41. package/node_modules/@appium/support/node_modules/axios/lib/adapters/http.js +1490 -0
  42. package/node_modules/@appium/support/node_modules/axios/lib/adapters/xhr.js +277 -0
  43. package/node_modules/@appium/support/node_modules/axios/lib/axios.js +89 -0
  44. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  45. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  46. package/node_modules/@appium/support/node_modules/axios/lib/cancel/isCancel.js +5 -0
  47. package/node_modules/@appium/support/node_modules/axios/lib/core/Axios.js +306 -0
  48. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosError.js +219 -0
  49. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
  50. package/node_modules/@appium/support/node_modules/axios/lib/core/InterceptorManager.js +171 -0
  51. package/node_modules/@appium/support/node_modules/axios/lib/core/README.md +8 -0
  52. package/node_modules/@appium/support/node_modules/axios/lib/core/buildFullPath.js +76 -0
  53. package/node_modules/@appium/support/node_modules/axios/lib/core/dispatchRequest.js +95 -0
  54. package/node_modules/@appium/support/node_modules/axios/lib/core/mergeConfig.js +174 -0
  55. package/node_modules/@appium/support/node_modules/axios/lib/core/methodList.js +17 -0
  56. package/node_modules/@appium/support/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  57. package/node_modules/@appium/support/node_modules/axios/lib/core/settle.js +27 -0
  58. package/node_modules/@appium/support/node_modules/axios/lib/core/transformData.js +28 -0
  59. package/node_modules/@appium/support/node_modules/axios/lib/defaults/index.js +178 -0
  60. package/node_modules/@appium/support/node_modules/axios/lib/defaults/transitional.js +10 -0
  61. package/node_modules/@appium/support/node_modules/axios/lib/env/README.md +3 -0
  62. package/node_modules/@appium/support/node_modules/axios/lib/env/classes/FormData.js +2 -0
  63. package/node_modules/@appium/support/node_modules/axios/lib/env/data.js +1 -0
  64. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
  65. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  66. package/node_modules/@appium/support/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
  67. package/node_modules/@appium/support/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  68. package/node_modules/@appium/support/node_modules/axios/lib/helpers/README.md +7 -0
  69. package/node_modules/@appium/support/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  70. package/node_modules/@appium/support/node_modules/axios/lib/helpers/bind.js +14 -0
  71. package/node_modules/@appium/support/node_modules/axios/lib/helpers/buildURL.js +69 -0
  72. package/node_modules/@appium/support/node_modules/axios/lib/helpers/callbackify.js +18 -0
  73. package/node_modules/@appium/support/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  74. package/node_modules/@appium/support/node_modules/axios/lib/helpers/composeSignals.js +68 -0
  75. package/node_modules/@appium/support/node_modules/axios/lib/helpers/cookies.js +64 -0
  76. package/node_modules/@appium/support/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  77. package/node_modules/@appium/support/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
  78. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
  79. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  80. package/node_modules/@appium/support/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
  81. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  82. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  83. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
  84. package/node_modules/@appium/support/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  85. package/node_modules/@appium/support/node_modules/axios/lib/helpers/null.js +2 -0
  86. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
  87. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  88. package/node_modules/@appium/support/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  89. package/node_modules/@appium/support/node_modules/axios/lib/helpers/readBlob.js +15 -0
  90. package/node_modules/@appium/support/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
  91. package/node_modules/@appium/support/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  92. package/node_modules/@appium/support/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
  93. package/node_modules/@appium/support/node_modules/axios/lib/helpers/speedometer.js +55 -0
  94. package/node_modules/@appium/support/node_modules/axios/lib/helpers/spread.js +28 -0
  95. package/node_modules/@appium/support/node_modules/axios/lib/helpers/throttle.js +45 -0
  96. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toFormData.js +279 -0
  97. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  98. package/node_modules/@appium/support/node_modules/axios/lib/helpers/trackStream.js +89 -0
  99. package/node_modules/@appium/support/node_modules/axios/lib/helpers/validator.js +112 -0
  100. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  101. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  102. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  103. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/index.js +13 -0
  104. package/node_modules/@appium/support/node_modules/axios/lib/platform/common/utils.js +52 -0
  105. package/node_modules/@appium/support/node_modules/axios/lib/platform/index.js +7 -0
  106. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  107. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  108. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  109. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/index.js +37 -0
  110. package/node_modules/@appium/support/node_modules/axios/lib/utils.js +1150 -0
  111. package/node_modules/@appium/support/node_modules/axios/package.json +203 -0
  112. package/node_modules/@appium/support/package.json +6 -6
  113. package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts +6 -4
  114. package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts.map +1 -1
  115. package/node_modules/@appium/types/lib/commands/basedriver.ts +4 -4
  116. package/node_modules/@appium/types/package.json +2 -2
  117. package/node_modules/appium-xcode/CHANGELOG.md +7 -0
  118. package/node_modules/appium-xcode/package.json +4 -4
  119. package/node_modules/asyncbox/README.md +43 -0
  120. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts +9 -0
  121. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts.map +1 -0
  122. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js +35 -0
  123. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js.map +1 -0
  124. package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts +9 -0
  125. package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts.map +1 -0
  126. package/node_modules/asyncbox/build/cjs/lib/asyncmap.js +23 -0
  127. package/node_modules/asyncbox/build/cjs/lib/asyncmap.js.map +1 -0
  128. package/node_modules/asyncbox/build/cjs/lib/errors.d.ts +9 -0
  129. package/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -0
  130. package/node_modules/asyncbox/build/cjs/lib/errors.js +20 -0
  131. package/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -0
  132. package/node_modules/asyncbox/build/cjs/lib/index.d.ts +12 -0
  133. package/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -0
  134. package/node_modules/asyncbox/build/cjs/lib/index.js +24 -0
  135. package/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -0
  136. package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts +3 -0
  137. package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts.map +1 -0
  138. package/node_modules/asyncbox/build/cjs/lib/limit-function.js +15 -0
  139. package/node_modules/asyncbox/build/cjs/lib/limit-function.js.map +1 -0
  140. package/node_modules/asyncbox/build/cjs/lib/lock.d.ts +74 -0
  141. package/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -0
  142. package/node_modules/asyncbox/build/cjs/lib/lock.js +295 -0
  143. package/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -0
  144. package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts +15 -0
  145. package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts.map +1 -0
  146. package/node_modules/asyncbox/build/cjs/lib/long-sleep.js +36 -0
  147. package/node_modules/asyncbox/build/cjs/lib/long-sleep.js.map +1 -0
  148. package/node_modules/asyncbox/build/cjs/lib/retry.d.ts +17 -0
  149. package/node_modules/asyncbox/build/cjs/lib/retry.d.ts.map +1 -0
  150. package/node_modules/asyncbox/build/cjs/lib/retry.js +57 -0
  151. package/node_modules/asyncbox/build/cjs/lib/retry.js.map +1 -0
  152. package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts +20 -0
  153. package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts.map +1 -0
  154. package/node_modules/asyncbox/build/cjs/lib/sleep.js +61 -0
  155. package/node_modules/asyncbox/build/cjs/lib/sleep.js.map +1 -0
  156. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +18 -0
  157. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -0
  158. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +51 -0
  159. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -0
  160. package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts +16 -0
  161. package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts.map +1 -0
  162. package/node_modules/asyncbox/build/cjs/lib/with-timeout.js +45 -0
  163. package/node_modules/asyncbox/build/cjs/lib/with-timeout.js.map +1 -0
  164. package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts +9 -0
  165. package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts.map +1 -0
  166. package/node_modules/asyncbox/build/esm/lib/asyncfilter.js +32 -0
  167. package/node_modules/asyncbox/build/esm/lib/asyncfilter.js.map +1 -0
  168. package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts +9 -0
  169. package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts.map +1 -0
  170. package/node_modules/asyncbox/build/esm/lib/asyncmap.js +20 -0
  171. package/node_modules/asyncbox/build/esm/lib/asyncmap.js.map +1 -0
  172. package/node_modules/asyncbox/build/esm/lib/errors.d.ts +9 -0
  173. package/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -0
  174. package/node_modules/asyncbox/build/esm/lib/errors.js +15 -0
  175. package/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -0
  176. package/node_modules/asyncbox/build/esm/lib/index.d.ts +12 -0
  177. package/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -0
  178. package/node_modules/asyncbox/build/esm/lib/index.js +10 -0
  179. package/node_modules/asyncbox/build/esm/lib/index.js.map +1 -0
  180. package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts +3 -0
  181. package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts.map +1 -0
  182. package/node_modules/asyncbox/build/esm/lib/limit-function.js +12 -0
  183. package/node_modules/asyncbox/build/esm/lib/limit-function.js.map +1 -0
  184. package/node_modules/asyncbox/build/esm/lib/lock.d.ts +74 -0
  185. package/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -0
  186. package/node_modules/asyncbox/build/esm/lib/lock.js +291 -0
  187. package/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -0
  188. package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts +15 -0
  189. package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts.map +1 -0
  190. package/node_modules/asyncbox/build/esm/lib/long-sleep.js +33 -0
  191. package/node_modules/asyncbox/build/esm/lib/long-sleep.js.map +1 -0
  192. package/node_modules/asyncbox/build/esm/lib/retry.d.ts +17 -0
  193. package/node_modules/asyncbox/build/esm/lib/retry.d.ts.map +1 -0
  194. package/node_modules/asyncbox/build/esm/lib/retry.js +53 -0
  195. package/node_modules/asyncbox/build/esm/lib/retry.js.map +1 -0
  196. package/node_modules/asyncbox/build/esm/lib/sleep.d.ts +20 -0
  197. package/node_modules/asyncbox/build/esm/lib/sleep.d.ts.map +1 -0
  198. package/node_modules/asyncbox/build/esm/lib/sleep.js +58 -0
  199. package/node_modules/asyncbox/build/esm/lib/sleep.js.map +1 -0
  200. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +18 -0
  201. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -0
  202. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +48 -0
  203. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -0
  204. package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts +16 -0
  205. package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts.map +1 -0
  206. package/node_modules/asyncbox/build/esm/lib/with-timeout.js +42 -0
  207. package/node_modules/asyncbox/build/esm/lib/with-timeout.js.map +1 -0
  208. package/node_modules/asyncbox/lib/asyncfilter.ts +38 -0
  209. package/node_modules/asyncbox/lib/asyncmap.ts +29 -0
  210. package/node_modules/asyncbox/lib/errors.ts +15 -0
  211. package/node_modules/asyncbox/lib/index.ts +21 -0
  212. package/node_modules/asyncbox/lib/limit-function.ts +18 -0
  213. package/node_modules/asyncbox/lib/lock.ts +360 -0
  214. package/node_modules/asyncbox/lib/long-sleep.ts +38 -0
  215. package/node_modules/asyncbox/lib/retry.ts +61 -0
  216. package/node_modules/asyncbox/lib/sleep.ts +79 -0
  217. package/node_modules/asyncbox/lib/wait-for-condition.ts +52 -0
  218. package/node_modules/asyncbox/lib/with-timeout.ts +43 -0
  219. package/node_modules/asyncbox/package.json +8 -8
  220. package/node_modules/axios/README.md +41 -106
  221. package/node_modules/axios/dist/axios.js +931 -278
  222. package/node_modules/axios/dist/axios.min.js +2 -2
  223. package/node_modules/axios/dist/axios.min.js.map +1 -1
  224. package/node_modules/axios/dist/browser/axios.cjs +948 -268
  225. package/node_modules/axios/dist/esm/axios.js +948 -268
  226. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  227. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  228. package/node_modules/axios/dist/node/axios.cjs +925 -242
  229. package/node_modules/axios/index.d.cts +20 -1
  230. package/node_modules/axios/index.d.ts +18 -1
  231. package/node_modules/axios/lib/adapters/fetch.js +73 -20
  232. package/node_modules/axios/lib/adapters/http.js +145 -26
  233. package/node_modules/axios/lib/adapters/xhr.js +120 -13
  234. package/node_modules/axios/lib/core/Axios.js +67 -12
  235. package/node_modules/axios/lib/core/AxiosError.js +59 -0
  236. package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
  237. package/node_modules/axios/lib/core/InterceptorManager.js +13 -2
  238. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  239. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  240. package/node_modules/axios/lib/core/dispatchRequest.js +20 -0
  241. package/node_modules/axios/lib/core/mergeConfig.js +183 -120
  242. package/node_modules/axios/lib/defaults/transitional.js +1 -0
  243. package/node_modules/axios/lib/env/data.js +1 -1
  244. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
  245. package/node_modules/axios/lib/helpers/Http2Sessions.js +2 -1
  246. package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
  247. package/node_modules/axios/lib/helpers/cookies.js +30 -6
  248. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
  249. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  250. package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
  251. package/node_modules/axios/lib/helpers/fromDataURI.js +8 -2
  252. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
  253. package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
  254. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  255. package/node_modules/axios/lib/helpers/resolveConfig.js +16 -3
  256. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +16 -1
  257. package/node_modules/axios/lib/utils.js +61 -10
  258. package/node_modules/axios/package.json +1 -2
  259. package/node_modules/follow-redirects/README.md +27 -1
  260. package/node_modules/follow-redirects/index.js +1 -5
  261. package/node_modules/follow-redirects/package.json +1 -1
  262. package/node_modules/shell-quote/README.md +37 -4
  263. package/node_modules/shell-quote/package.json +10 -6
  264. package/node_modules/shell-quote/parse.d.ts +1 -1
  265. package/node_modules/shell-quote/parse.js +63 -11
  266. package/node_modules/shell-quote/quote.d.ts +2 -1
  267. package/node_modules/shell-quote/quote.js +23 -3
  268. package/node_modules/uuid/package.json +17 -17
  269. package/package.json +4 -6
  270. package/node_modules/async-lock/AUTHORS +0 -21
  271. package/node_modules/async-lock/History.md +0 -132
  272. package/node_modules/async-lock/LICENSE +0 -22
  273. package/node_modules/async-lock/README.md +0 -177
  274. package/node_modules/async-lock/index.js +0 -2
  275. package/node_modules/async-lock/lib/index.js +0 -312
  276. package/node_modules/async-lock/package.json +0 -48
  277. package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts +0 -103
  278. package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts.map +0 -1
  279. package/node_modules/asyncbox/build/cjs/lib/asyncbox.js +0 -311
  280. package/node_modules/asyncbox/build/cjs/lib/asyncbox.js.map +0 -1
  281. package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts +0 -103
  282. package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts.map +0 -1
  283. package/node_modules/asyncbox/build/esm/lib/asyncbox.js +0 -298
  284. package/node_modules/asyncbox/build/esm/lib/asyncbox.js.map +0 -1
  285. package/node_modules/asyncbox/lib/asyncbox.ts +0 -382
  286. package/node_modules/shell-quote/.nycrc +0 -14
  287. package/node_modules/shell-quote/eslint.config.mjs +0 -29
  288. package/node_modules/shell-quote/security.md +0 -11
  289. package/node_modules/shell-quote/test/comment.js +0 -16
  290. package/node_modules/shell-quote/test/env.js +0 -52
  291. package/node_modules/shell-quote/test/env_fn.js +0 -21
  292. package/node_modules/shell-quote/test/op.js +0 -102
  293. package/node_modules/shell-quote/test/parse.js +0 -149
  294. package/node_modules/shell-quote/test/quote.js +0 -145
  295. package/node_modules/shell-quote/test/set.js +0 -31
@@ -7,6 +7,7 @@ import normalizeURLForProtocolCheck from '../helpers/normalizeURLForProtocolChec
7
7
  import parseProtocol from '../helpers/parseProtocol.js';
8
8
  import platform from '../platform/index.js';
9
9
  import AxiosHeaders from '../core/AxiosHeaders.js';
10
+ import cookies from '../helpers/cookies.js';
10
11
  import { progressEventReducer } from '../helpers/progressEventReducer.js';
11
12
  import resolveConfig from '../helpers/resolveConfig.js';
12
13
  import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
@@ -16,17 +17,60 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
16
17
  export default isXHRAdapterSupported &&
17
18
  function (config) {
18
19
  return new Promise(function dispatchXhrRequest(resolve, reject) {
19
- const _config = resolveConfig(config);
20
+ let useAsyncXsrf;
21
+ try {
22
+ const store =
23
+ platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
24
+ useAsyncXsrf = store && utils.isFunction(store.get);
25
+ } catch (e) {
26
+ // A restricted Cookie Store getter must retain the synchronous fallback.
27
+ }
28
+ let xsrfCookieName;
29
+ const _config = resolveConfig(
30
+ config,
31
+ useAsyncXsrf
32
+ ? (name) => {
33
+ xsrfCookieName = name;
34
+ return null;
35
+ }
36
+ : undefined
37
+ );
20
38
  let requestData = _config.data;
21
39
  const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
22
40
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
23
41
  let onCanceled;
42
+ let timeoutId;
24
43
  let uploadThrottled, downloadThrottled;
25
44
  let flushUpload, flushDownload, flushDownloadWithEvent;
26
45
 
27
46
  function done() {
28
- flushUpload && flushUpload(); // flush events
29
- flushDownload && flushDownload(); // flush events
47
+ clearTimeout(timeoutId);
48
+ // A final progress callback must not prevent the remaining cleanup.
49
+ // Report errors asynchronously, as onloadend and the throttle timer do.
50
+ try {
51
+ flushUpload && flushUpload(); // flush events
52
+ } catch (err) {
53
+ setTimeout(() => {
54
+ throw err;
55
+ });
56
+ }
57
+ try {
58
+ flushDownload && flushDownload(); // flush events
59
+ } catch (err) {
60
+ setTimeout(() => {
61
+ throw err;
62
+ });
63
+ }
64
+
65
+ // A flush can synchronously cancel the request and reenter done().
66
+ // In that case the inner call has already detached these listeners.
67
+ if (request) {
68
+ downloadThrottled && request.removeEventListener('progress', downloadThrottled);
69
+ if (request.upload) {
70
+ uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
71
+ flushUpload && request.upload.removeEventListener('loadend', flushUpload);
72
+ }
73
+ }
30
74
 
31
75
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
32
76
 
@@ -177,6 +221,7 @@ export default isXHRAdapterSupported &&
177
221
 
178
222
  // Handle timeout
179
223
  request.ontimeout = function handleTimeout() {
224
+ if (!request) return;
180
225
  let timeoutErrorMessage = _config.timeout
181
226
  ? 'timeout of ' + _config.timeout + 'ms exceeded'
182
227
  : 'timeout exceeded';
@@ -201,13 +246,6 @@ export default isXHRAdapterSupported &&
201
246
  // Remove Content-Type if data is undefined
202
247
  requestData === undefined && requestHeaders.setContentType(null);
203
248
 
204
- // Add headers to the request
205
- if ('setRequestHeader' in request) {
206
- utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
207
- request.setRequestHeader(key, val);
208
- });
209
- }
210
-
211
249
  // Add withCredentials to request if needed
212
250
  if (!utils.isUndefined(_config.withCredentials)) {
213
251
  request.withCredentials = !!_config.withCredentials;
@@ -244,12 +282,14 @@ export default isXHRAdapterSupported &&
244
282
  return;
245
283
  }
246
284
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
247
- request.abort();
285
+ const xhr = request;
248
286
  done();
249
287
  request = null;
288
+ xhr.abort();
250
289
  };
251
290
 
252
291
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
292
+ if (!request) return;
253
293
  if (_config.signal) {
254
294
  _config.signal.aborted
255
295
  ? onCanceled()
@@ -257,6 +297,8 @@ export default isXHRAdapterSupported &&
257
297
  }
258
298
  }
259
299
 
300
+ if (!request) return;
301
+
260
302
  const protocol = parseProtocol(_config.url);
261
303
 
262
304
  if (protocol && !platform.protocols.includes(protocol)) {
@@ -271,7 +313,72 @@ export default isXHRAdapterSupported &&
271
313
  return;
272
314
  }
273
315
 
274
- // Send the request
275
- request.send(requestData || null);
316
+ const sendRequest = () => {
317
+ if (!request) return;
318
+ // Apply headers after an asynchronous XSRF read so existing headers are
319
+ // replaced through AxiosHeaders rather than appended by the native XHR.
320
+ if ('setRequestHeader' in request) {
321
+ utils.forEach(
322
+ toByteStringHeaderObject(requestHeaders),
323
+ function setRequestHeader(val, key) {
324
+ request.setRequestHeader(key, val);
325
+ }
326
+ );
327
+ }
328
+ request.send(requestData || null);
329
+ };
330
+
331
+ if (xsrfCookieName) {
332
+ // Native XHR timeout starts at send(). Cover cookie preparation and the
333
+ // subsequent request with the same budget and existing timeout handler.
334
+ const now =
335
+ typeof performance !== 'undefined' && utils.isFunction(performance.now)
336
+ ? () => performance.now()
337
+ : Date.now;
338
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
339
+ const abortOnTimeout = () => {
340
+ if (!request) return;
341
+ const xhr = request;
342
+ xhr.ontimeout();
343
+ xhr.abort();
344
+ };
345
+ if (deadline !== undefined) {
346
+ const scheduleTimeout = () => {
347
+ const remaining = deadline - now();
348
+ if (remaining > 0) {
349
+ // Browser timers overflow above the signed 32-bit delay limit.
350
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
351
+ } else {
352
+ abortOnTimeout();
353
+ }
354
+ };
355
+ scheduleTimeout();
356
+ }
357
+
358
+ cookies
359
+ .readAsync(xsrfCookieName)
360
+ .then((value) => {
361
+ if (!request) return;
362
+ // Promise callbacks may run before an overdue timer after a busy task.
363
+ if (deadline !== undefined && now() >= deadline) {
364
+ abortOnTimeout();
365
+ return;
366
+ }
367
+ if (value) {
368
+ const headerName =
369
+ utils.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
370
+ requestHeaders.set(headerName, value);
371
+ }
372
+ sendRequest();
373
+ })
374
+ .catch((error) => {
375
+ if (!request) return;
376
+ reject(AxiosError.from(error, null, config, request));
377
+ done();
378
+ request = null;
379
+ });
380
+ } else {
381
+ sendRequest();
382
+ }
276
383
  });
277
384
  };
@@ -10,9 +10,41 @@ import methodList from './methodList.js';
10
10
  import validator from '../helpers/validator.js';
11
11
  import AxiosHeaders from './AxiosHeaders.js';
12
12
  import transitionalDefaults from '../defaults/transitional.js';
13
+ import { getCauseStackIndex } from './AxiosError.js';
13
14
 
14
15
  const validators = validator.validators;
15
16
 
17
+ // Recognize header maps without consuming objects intended as literal values.
18
+ // AxiosHeaders from other builds share a brand and header-container interface,
19
+ // but not constructor identity. A tag and toJSON alone can describe a literal.
20
+ const isHeadersBucket = (value) => {
21
+ if (value == null || utils.isPlainObject(value) || value instanceof AxiosHeaders) {
22
+ return true;
23
+ }
24
+
25
+ try {
26
+ return (
27
+ utils.isObject(value) &&
28
+ utils.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' &&
29
+ [
30
+ 'toJSON',
31
+ 'set',
32
+ 'get',
33
+ 'has',
34
+ 'delete',
35
+ 'clear',
36
+ 'normalize',
37
+ 'concat',
38
+ 'toString',
39
+ Symbol.iterator,
40
+ ].every((method) => utils.isFunction(utils.getSafeProp(value, method)))
41
+ );
42
+ } catch (e) {
43
+ // A failed optional brand probe must not prevent literal header serialization.
44
+ return false;
45
+ }
46
+ };
47
+
16
48
  /**
17
49
  * Create a new instance of Axios
18
50
  *
@@ -59,16 +91,26 @@ class Axios {
59
91
 
60
92
  if (!err.stack) {
61
93
  err.stack = stack;
62
- // match without the 2 top stack lines
63
94
  } else if (stack) {
95
+ // Match a common suffix after the 2 top frames when available,
96
+ // otherwise compare the full reconstructed stack.
64
97
  const firstNewlineIndex = stack.indexOf('\n');
65
98
  const secondNewlineIndex =
66
99
  firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
67
- const stackWithoutTwoTopLines =
68
- secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
69
-
70
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
71
- err.stack += '\n' + stack;
100
+ const duplicateCheckSuffix =
101
+ secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
102
+
103
+ // `AxiosError.from()` may have already inlined the wrapped error's
104
+ // stack under a `Caused by:` marker. Keep the reconstructed caller
105
+ // frames ahead of that marker so stack-only reporters do not read
106
+ // them as part of the low-level cause.
107
+ const currentStack = String(err.stack);
108
+ const causeIndex = getCauseStackIndex(err, currentStack);
109
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
110
+ const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
111
+
112
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
113
+ err.stack = stackHead + '\n' + stack + causeSection;
72
114
  }
73
115
  }
74
116
  } catch (e) {
@@ -104,6 +146,7 @@ class Axios {
104
146
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
105
147
  advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
106
148
  validateStatusUndefinedResolves: validators.transitional(validators.boolean),
149
+ encodeBasicAuthUsername: validators.transitional(validators.boolean),
107
150
  },
108
151
  false
109
152
  );
@@ -129,7 +172,10 @@ class Axios {
129
172
  // Set config.allowAbsoluteUrls
130
173
  if (config.allowAbsoluteUrls !== undefined) {
131
174
  // do nothing
132
- } else if (this.defaults.allowAbsoluteUrls !== undefined) {
175
+ } else if (
176
+ utils.hasOwnProp(this.defaults, 'allowAbsoluteUrls') &&
177
+ this.defaults.allowAbsoluteUrls !== undefined
178
+ ) {
133
179
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
134
180
  } else {
135
181
  config.allowAbsoluteUrls = true;
@@ -151,12 +197,21 @@ class Axios {
151
197
  'get'
152
198
  ).toLowerCase();
153
199
 
154
- // Flatten headers
155
- let contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
200
+ // Flatten header defaults without consuming literal method-named headers.
201
+ const commonHeaders = utils.getSafeProp(headers, 'common');
202
+ const methodHeaders = utils.getSafeProp(headers, config.method);
203
+ const contextHeaders =
204
+ headers &&
205
+ utils.merge(
206
+ isHeadersBucket(commonHeaders) ? commonHeaders : undefined,
207
+ isHeadersBucket(methodHeaders) ? methodHeaders : undefined
208
+ );
156
209
 
157
210
  headers &&
158
211
  utils.forEach(methodList.concat('common'), (method) => {
159
- delete headers[method];
212
+ if (isHeadersBucket(utils.getSafeProp(headers, method))) {
213
+ delete headers[method];
214
+ }
160
215
  });
161
216
 
162
217
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
@@ -265,7 +320,7 @@ class Axios {
265
320
  // Provide aliases for supported request methods
266
321
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
267
322
  /*eslint func-names:0*/
268
- Axios.prototype[method] = function (url, config) {
323
+ Axios.prototype[method] = async function (url, config) {
269
324
  return this.request(
270
325
  mergeConfig(config || {}, {
271
326
  method,
@@ -278,7 +333,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
278
333
 
279
334
  utils.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
280
335
  function generateHTTPMethod(isForm) {
281
- return function httpMethod(url, data, config) {
336
+ return async function httpMethod(url, data, config) {
282
337
  return this.request(
283
338
  mergeConfig(config || {}, {
284
339
  method,
@@ -95,6 +95,61 @@ function aggregateErrorMessage(error) {
95
95
  return message || error.name || 'AggregateError';
96
96
  }
97
97
 
98
+ // Shared with `Axios.prototype.request`, which splices the reconstructed
99
+ // caller frames in ahead of this marker.
100
+ export const CAUSED_BY_SEPARATOR = '\nCaused by: ';
101
+ const $causeStack = Symbol('causeStack');
102
+
103
+ // Match the section we appended, not marker-like text in an error message or
104
+ // a replacement stack supplied by the caller. Do not re-read the cause's stack.
105
+ export function getCauseStackIndex(error, stack) {
106
+ const causeStack = utils.hasOwnProp(error, $causeStack) && error[$causeStack];
107
+
108
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
109
+ }
110
+
111
+ /**
112
+ * Append the stack of a wrapped error to `target.stack`.
113
+ *
114
+ * `cause` already exposes the original error for tooling that walks the standard
115
+ * cause chain, but many error reporters read `stack` and nothing else. Inlining
116
+ * the wrapped stack there means those reporters surface the underlying failure
117
+ * instead of the axios frames that normalized it (see #6670).
118
+ *
119
+ * Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
120
+ * without stack support, or a replaced `stack` property can leave the value
121
+ * missing, non-string, or read-only, and normalizing an error must not throw
122
+ * because of that.
123
+ *
124
+ * @param {Error} target The AxiosError being built.
125
+ * @param {Error} source The error being wrapped.
126
+ *
127
+ * @returns {void}
128
+ */
129
+ function appendCauseStack(target, source) {
130
+ try {
131
+ const sourceStack = source && source.stack;
132
+
133
+ if (typeof sourceStack !== 'string' || !sourceStack) {
134
+ return;
135
+ }
136
+
137
+ const targetStack = target.stack;
138
+
139
+ if (typeof targetStack !== 'string' || !targetStack) {
140
+ return;
141
+ }
142
+
143
+ // Each call to `from()` creates a fresh target. Re-wrapping includes the
144
+ // previous stack verbatim, adding one cause section per wrap.
145
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
146
+ target.stack = targetStack + causeStack;
147
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
148
+ } catch (e) {
149
+ // Ignore failures from custom stack hooks or un-writable stack properties.
150
+ }
151
+ }
152
+
98
153
  class AxiosError extends Error {
99
154
  static from(error, code, config, request, response, customProps) {
100
155
  // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
@@ -121,6 +176,10 @@ class AxiosError extends Error {
121
176
  });
122
177
  axiosError.name = error.name;
123
178
 
179
+ // Inline the wrapped stack for reporters that read only `stack`; the `cause`
180
+ // property above already covers cause-aware tooling.
181
+ appendCauseStack(axiosError, error);
182
+
124
183
  // Preserve status from the original error if not already set from response
125
184
  if (error.status != null && axiosError.status == null) {
126
185
  axiosError.status = error.status;
@@ -150,9 +150,22 @@ function parseParameters(value) {
150
150
 
151
151
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
152
152
 
153
+ // `__proto__` is a valid field name, and the one name the uppercase mapping at
154
+ // the bottom of this file cannot reach: it is inherited from Object.prototype
155
+ // instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
156
+ // runs the inherited setter. That silently discards the header, and an array
157
+ // value replaces the instance prototype, taking every method with it.
158
+ // Store it under the same kind of case variant that mapping uses for `set` and
159
+ // `constructor`. Header lookup is caseless, so it reads back under either
160
+ // spelling, and no own `__proto__` slot is ever created for a later
161
+ // `Object.assign` to copy onto a plain object through the same setter.
162
+ const PROTO_HEADER_SLOT = '__Proto__';
163
+
164
+ const headerSlot = (name) => (name === '__proto__' ? PROTO_HEADER_SLOT : name);
165
+
153
166
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
154
167
  if (utils.isFunction(filter)) {
155
- return filter.call(this, value, header);
168
+ return filter.call(context, value, header);
156
169
  }
157
170
 
158
171
  if (isHeaderNameFilter) {
@@ -218,7 +231,7 @@ class AxiosHeaders {
218
231
  _rewrite === true ||
219
232
  (_rewrite === undefined && self[key] !== false)
220
233
  ) {
221
- self[key || _header] = normalizeValue(_value);
234
+ self[headerSlot(key || _header)] = normalizeValue(_value);
222
235
  }
223
236
  }
224
237
 
@@ -347,7 +360,7 @@ class AxiosHeaders {
347
360
 
348
361
  normalize(format) {
349
362
  const self = this;
350
- const headers = {};
363
+ const headers = Object.create(null);
351
364
 
352
365
  utils.forEach(this, (value, header) => {
353
366
  const key = utils.findKey(headers, header);
@@ -358,7 +371,7 @@ class AxiosHeaders {
358
371
  return;
359
372
  }
360
373
 
361
- const normalized = format ? formatHeader(header) : String(header).trim();
374
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
362
375
 
363
376
  if (normalized !== header) {
364
377
  delete self[header];
@@ -21,6 +21,16 @@ function trimHandlers(handlers) {
21
21
  }
22
22
  }
23
23
 
24
+ // Preserve the array-key coercion used before IDs were stored in a Map, without
25
+ // treating null, empty strings, or noncanonical numeric strings as ID zero.
26
+ function normalizeHandlerId(id) {
27
+ if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
28
+ return Number(id);
29
+ }
30
+
31
+ return id;
32
+ }
33
+
24
34
  function syncHandlerEntries(manager, internals) {
25
35
  const handlers = manager.handlers;
26
36
  const length = countHandlers(handlers);
@@ -103,10 +113,11 @@ class InterceptorManager {
103
113
 
104
114
  syncHandlerEntries(this, internals);
105
115
 
106
- const entry = internals.handlerEntries.get(id);
116
+ const handlerId = normalizeHandlerId(id);
117
+ const entry = internals.handlerEntries.get(handlerId);
107
118
 
108
119
  if (entry) {
109
- internals.handlerEntries.delete(id);
120
+ internals.handlerEntries.delete(handlerId);
110
121
 
111
122
  // Ignore IDs invalidated by clear or direct replacement of handlers.
112
123
  if (this.handlers[entry.index] !== entry.handler) {
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ import utils from '../utils.js';
4
+ import AxiosError from './AxiosError.js';
5
+
6
+ export default function assertParamsAcyclic(params) {
7
+ const pending = [{ value: params }];
8
+ const active = new WeakSet();
9
+ const visited = new WeakSet();
10
+
11
+ while (pending.length) {
12
+ const { value, done } = pending.pop();
13
+ if (!utils.isPlainObject(value) && !utils.isArray(value)) continue;
14
+ if (done) {
15
+ active.delete(value);
16
+ continue;
17
+ }
18
+ if (active.has(value)) {
19
+ throw new AxiosError(
20
+ 'Circular reference detected in params',
21
+ AxiosError.ERR_BAD_OPTION_VALUE
22
+ );
23
+ }
24
+ if (visited.has(value)) continue;
25
+ visited.add(value);
26
+ active.add(value);
27
+ pending.push({ value, done: true });
28
+
29
+ const keys = Object.keys(value);
30
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
31
+ Object.getOwnPropertySymbols(value).forEach((key) => {
32
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
33
+ if (descriptor && descriptor.enumerable) keys.push(key);
34
+ });
35
+ }
36
+ // Shallow array elements retain fields filtered during plain-object merges.
37
+ // Inspect reserved data properties without evaluating their accessors.
38
+ keys.forEach((key) => {
39
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
40
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
41
+ if (descriptor && utils.hasOwnProp(descriptor, 'value')) {
42
+ pending.push({ value: descriptor.value });
43
+ }
44
+ } else {
45
+ pending.push({ value: value[key] });
46
+ }
47
+ });
48
+ }
49
+ }
@@ -0,0 +1,37 @@
1
+ import utils from '../utils.js';
2
+ import platform from '../platform/index.js';
3
+ import AxiosError from './AxiosError.js';
4
+ import formDataToBlob, { FormDataError } from '../helpers/formDataToBlob.js';
5
+
6
+ export default function createMultipartBody(form, Blob, limit, limitError, boundary) {
7
+ // Report missing Blob support before trying to select a random source.
8
+ if (!utils.isFunction(Blob)) {
9
+ throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
10
+ }
11
+
12
+ if (boundary === undefined) {
13
+ if (utils.isFunction(platform.generateString)) {
14
+ boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
15
+ } else {
16
+ const crypto = utils.global.crypto;
17
+ if (!crypto || !utils.isFunction(crypto.getRandomValues)) {
18
+ throw new AxiosError('Random byte generation is not supported', AxiosError.ERR_NOT_SUPPORT);
19
+ }
20
+ const random = new Uint8Array(18);
21
+ crypto.getRandomValues(random);
22
+ boundary =
23
+ 'axios-' + Array.from(random, (value) => ('0' + value.toString(16)).slice(-2)).join('');
24
+ }
25
+ }
26
+
27
+ try {
28
+ return formDataToBlob(form, Blob, limit, limitError, boundary);
29
+ } catch (error) {
30
+ if (error instanceof FormDataError) {
31
+ const code =
32
+ error.reason === 'boundary' ? AxiosError.ERR_BAD_OPTION_VALUE : AxiosError.ERR_BAD_REQUEST;
33
+ throw new AxiosError(error.message, code);
34
+ }
35
+ throw error;
36
+ }
37
+ }
@@ -25,6 +25,21 @@ function throwIfCancellationRequested(config) {
25
25
  }
26
26
  }
27
27
 
28
+ /**
29
+ * Milliseconds elapsed since `start`, floored at zero.
30
+ *
31
+ * Wall-clock, to match the rest of the codebase (speedometer, throttle,
32
+ * AxiosTransformStream). A backwards clock adjustment mid-request would
33
+ * otherwise produce a negative duration, so the result is clamped.
34
+ *
35
+ * @param {number} start Timestamp from `Date.now()`
36
+ *
37
+ * @returns {number} Non-negative elapsed milliseconds
38
+ */
39
+ function elapsedSince(start) {
40
+ return Math.max(0, Date.now() - start);
41
+ }
42
+
28
43
  /**
29
44
  * Dispatch a request to the server using the configured adapter.
30
45
  *
@@ -51,10 +66,14 @@ export default function dispatchRequest(_config) {
51
66
 
52
67
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
53
68
 
69
+ const start = Date.now();
70
+
54
71
  return adapter(config).then(
55
72
  function onAdapterResolution(response) {
56
73
  throwIfCancellationRequested(config);
57
74
 
75
+ response.duration = elapsedSince(start);
76
+
58
77
  // Expose the current response on config so that transformResponse can
59
78
  // attach it to any AxiosError it throws (e.g. on JSON parse failure).
60
79
  // We clean it up afterwards to avoid polluting the config object.
@@ -75,6 +94,7 @@ export default function dispatchRequest(_config) {
75
94
 
76
95
  // Transform response data
77
96
  if (reason && reason.response) {
97
+ reason.response.duration = elapsedSince(start);
78
98
  config.response = reason.response;
79
99
  try {
80
100
  reason.response.data = transformData.call(