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
@@ -2,20 +2,191 @@
2
2
 
3
3
  import utils from '../utils.js';
4
4
  import AxiosHeaders from './AxiosHeaders.js';
5
+ import assertParamsAcyclic from './assertParamsAcyclic.js';
5
6
 
6
7
  const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
7
8
 
8
9
  const ownEnumerableKeys = (thing) => {
9
10
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
10
11
  return Object.keys(thing).concat(
11
- Object.getOwnPropertySymbols(thing).filter(
12
- (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
13
- )
12
+ Object.getOwnPropertySymbols(thing).filter((symbol) => {
13
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
14
+ return descriptor && descriptor.enumerable;
15
+ })
14
16
  );
15
17
  }
16
18
  return Object.keys(thing);
17
19
  };
18
20
 
21
+ // Copy params without recursive merges so the serializer remains responsible
22
+ // for its depth policy. Only visit defaults that contribute to the result.
23
+ function mergeParams(a, b) {
24
+ const pending = [];
25
+ const copies = new WeakMap();
26
+ const empty = {};
27
+
28
+ function copy(target, source) {
29
+ if (!utils.isPlainObject(source)) {
30
+ return utils.isArray(source) ? source.slice() : source;
31
+ }
32
+
33
+ const base = utils.isPlainObject(target) ? target : empty;
34
+ let bases = copies.get(source);
35
+ if (!bases) {
36
+ bases = new WeakMap();
37
+ copies.set(source, bases);
38
+ }
39
+ if (bases.has(base)) return bases.get(base);
40
+
41
+ const result = {};
42
+ bases.set(base, result);
43
+ pending.push({ base, source, result });
44
+ return result;
45
+ }
46
+
47
+ const result = utils.isUndefined(b) ? copy(undefined, a) : copy(a, b);
48
+ while (pending.length) {
49
+ const { base, source, result: target } = pending.pop();
50
+ const baseKeys = new Set(ownEnumerableKeys(base));
51
+ const sourceKeys = new Set(ownEnumerableKeys(source));
52
+ const keys = new Set([...baseKeys, ...sourceKeys]);
53
+
54
+ keys.forEach((key) => {
55
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
56
+ const hasSource = sourceKeys.has(key);
57
+ const value = hasSource ? source[key] : undefined;
58
+ const previous =
59
+ (!hasSource || utils.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
60
+ target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
61
+ });
62
+ }
63
+
64
+ assertParamsAcyclic(result);
65
+ return result;
66
+ }
67
+
68
+ function getMergedValue(target, source, prop, caseless) {
69
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
70
+ return utils.merge.call({ caseless }, target, source);
71
+ } else if (utils.isPlainObject(source)) {
72
+ return utils.merge({}, source);
73
+ } else if (utils.isArray(source)) {
74
+ return source.slice();
75
+ }
76
+ return source;
77
+ }
78
+
79
+ function mergeDeepProperties(a, b, prop, caseless) {
80
+ if (!utils.isUndefined(b)) {
81
+ return getMergedValue(a, b, prop, caseless);
82
+ } else if (!utils.isUndefined(a)) {
83
+ return getMergedValue(undefined, a, prop, caseless);
84
+ }
85
+ }
86
+
87
+ // eslint-disable-next-line consistent-return
88
+ function valueFromConfig2(a, b) {
89
+ if (!utils.isUndefined(b)) {
90
+ return getMergedValue(undefined, b);
91
+ }
92
+ }
93
+
94
+ // eslint-disable-next-line consistent-return
95
+ function defaultToConfig2(a, b) {
96
+ if (!utils.isUndefined(b)) {
97
+ return getMergedValue(undefined, b);
98
+ } else if (!utils.isUndefined(a)) {
99
+ return getMergedValue(undefined, a);
100
+ }
101
+ }
102
+
103
+ function getMergedTransitionalOption(config1, config2, prop) {
104
+ const transitional2 = utils.hasOwnProp(config2, 'transitional')
105
+ ? config2.transitional
106
+ : undefined;
107
+
108
+ if (!utils.isUndefined(transitional2)) {
109
+ if (utils.isPlainObject(transitional2)) {
110
+ if (utils.hasOwnProp(transitional2, prop)) {
111
+ return transitional2[prop];
112
+ }
113
+ } else {
114
+ return undefined;
115
+ }
116
+ }
117
+
118
+ const transitional1 = utils.hasOwnProp(config1, 'transitional')
119
+ ? config1.transitional
120
+ : undefined;
121
+
122
+ if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {
123
+ return transitional1[prop];
124
+ }
125
+
126
+ return undefined;
127
+ }
128
+
129
+ // eslint-disable-next-line consistent-return
130
+ function mergeDirectKeys(a, b, prop, config1, config2) {
131
+ if (utils.hasOwnProp(config2, prop)) {
132
+ return getMergedValue(a, b);
133
+ } else if (utils.hasOwnProp(config1, prop)) {
134
+ return getMergedValue(undefined, a);
135
+ }
136
+ }
137
+
138
+ function mergeHeaders(a, b, prop) {
139
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
140
+ }
141
+
142
+ // Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
143
+ // this data descriptor into an accessor descriptor on the way in.
144
+ // defineProperty only reads it, so one shared instance serves every call.
145
+ const hasOwnPropertyDescriptor = Object.freeze({
146
+ __proto__: null,
147
+ value: Object.prototype.hasOwnProperty,
148
+ enumerable: false,
149
+ writable: true,
150
+ configurable: true,
151
+ });
152
+
153
+ // The strategy table and the strategies above are stateless, so they are
154
+ // built once at module load instead of on every call: mergeConfig runs at
155
+ // most twice per request (once from a method alias, once from `_request`).
156
+ const mergeMap = {
157
+ url: valueFromConfig2,
158
+ method: valueFromConfig2,
159
+ data: valueFromConfig2,
160
+ baseURL: defaultToConfig2,
161
+ transformRequest: defaultToConfig2,
162
+ transformResponse: defaultToConfig2,
163
+ params: mergeParams,
164
+ paramsSerializer: defaultToConfig2,
165
+ timeout: defaultToConfig2,
166
+ timeoutErrorMessage: defaultToConfig2,
167
+ withCredentials: defaultToConfig2,
168
+ withXSRFToken: defaultToConfig2,
169
+ adapter: defaultToConfig2,
170
+ responseType: defaultToConfig2,
171
+ xsrfCookieName: defaultToConfig2,
172
+ xsrfHeaderName: defaultToConfig2,
173
+ onUploadProgress: defaultToConfig2,
174
+ onDownloadProgress: defaultToConfig2,
175
+ decompress: defaultToConfig2,
176
+ maxContentLength: defaultToConfig2,
177
+ maxBodyLength: defaultToConfig2,
178
+ beforeRedirect: defaultToConfig2,
179
+ transport: defaultToConfig2,
180
+ httpAgent: defaultToConfig2,
181
+ httpsAgent: defaultToConfig2,
182
+ cancelToken: defaultToConfig2,
183
+ socketPath: defaultToConfig2,
184
+ allowedSocketPaths: defaultToConfig2,
185
+ responseEncoding: defaultToConfig2,
186
+ validateStatus: mergeDirectKeys,
187
+ headers: mergeHeaders,
188
+ };
189
+
19
190
  /**
20
191
  * Config-specific merge-function which creates a new config-object
21
192
  * by merging two configuration objects together.
@@ -35,133 +206,25 @@ export default function mergeConfig(config1, config2) {
35
206
  // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
36
207
  // ergonomics for user code that relies on it.
37
208
  const config = Object.create(null);
38
- Object.defineProperty(config, 'hasOwnProperty', {
39
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
40
- // this data descriptor into an accessor descriptor on the way in.
41
- __proto__: null,
42
- value: Object.prototype.hasOwnProperty,
43
- enumerable: false,
44
- writable: true,
45
- configurable: true,
46
- });
47
-
48
- function getMergedValue(target, source, prop, caseless) {
49
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
50
- return utils.merge.call({ caseless }, target, source);
51
- } else if (utils.isPlainObject(source)) {
52
- return utils.merge({}, source);
53
- } else if (utils.isArray(source)) {
54
- return source.slice();
55
- }
56
- return source;
57
- }
58
-
59
- function mergeDeepProperties(a, b, prop, caseless) {
60
- if (!utils.isUndefined(b)) {
61
- return getMergedValue(a, b, prop, caseless);
62
- } else if (!utils.isUndefined(a)) {
63
- return getMergedValue(undefined, a, prop, caseless);
64
- }
65
- }
209
+ Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
66
210
 
67
- // eslint-disable-next-line consistent-return
68
- function valueFromConfig2(a, b) {
69
- if (!utils.isUndefined(b)) {
70
- return getMergedValue(undefined, b);
71
- }
72
- }
211
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
73
212
 
74
- // eslint-disable-next-line consistent-return
75
- function defaultToConfig2(a, b) {
76
- if (!utils.isUndefined(b)) {
77
- return getMergedValue(undefined, b);
78
- } else if (!utils.isUndefined(a)) {
79
- return getMergedValue(undefined, a);
80
- }
81
- }
82
-
83
- function getMergedTransitionalOption(prop) {
84
- const transitional2 = utils.hasOwnProp(config2, 'transitional')
85
- ? config2.transitional
86
- : undefined;
87
-
88
- if (!utils.isUndefined(transitional2)) {
89
- if (utils.isPlainObject(transitional2)) {
90
- if (utils.hasOwnProp(transitional2, prop)) {
91
- return transitional2[prop];
92
- }
93
- } else {
94
- return undefined;
95
- }
96
- }
97
-
98
- const transitional1 = utils.hasOwnProp(config1, 'transitional')
99
- ? config1.transitional
100
- : undefined;
101
-
102
- if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {
103
- return transitional1[prop];
104
- }
105
-
106
- return undefined;
107
- }
108
-
109
- // eslint-disable-next-line consistent-return
110
- function mergeDirectKeys(a, b, prop) {
111
- if (utils.hasOwnProp(config2, prop)) {
112
- return getMergedValue(a, b);
113
- } else if (utils.hasOwnProp(config1, prop)) {
114
- return getMergedValue(undefined, a);
115
- }
116
- }
117
-
118
- const mergeMap = {
119
- url: valueFromConfig2,
120
- method: valueFromConfig2,
121
- data: valueFromConfig2,
122
- baseURL: defaultToConfig2,
123
- transformRequest: defaultToConfig2,
124
- transformResponse: defaultToConfig2,
125
- paramsSerializer: defaultToConfig2,
126
- timeout: defaultToConfig2,
127
- timeoutErrorMessage: defaultToConfig2,
128
- withCredentials: defaultToConfig2,
129
- withXSRFToken: defaultToConfig2,
130
- adapter: defaultToConfig2,
131
- responseType: defaultToConfig2,
132
- xsrfCookieName: defaultToConfig2,
133
- xsrfHeaderName: defaultToConfig2,
134
- onUploadProgress: defaultToConfig2,
135
- onDownloadProgress: defaultToConfig2,
136
- decompress: defaultToConfig2,
137
- maxContentLength: defaultToConfig2,
138
- maxBodyLength: defaultToConfig2,
139
- beforeRedirect: defaultToConfig2,
140
- transport: defaultToConfig2,
141
- httpAgent: defaultToConfig2,
142
- httpsAgent: defaultToConfig2,
143
- cancelToken: defaultToConfig2,
144
- socketPath: defaultToConfig2,
145
- allowedSocketPaths: defaultToConfig2,
146
- responseEncoding: defaultToConfig2,
147
- validateStatus: mergeDirectKeys,
148
- headers: (a, b, prop) =>
149
- mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
150
- };
151
-
152
- utils.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
153
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
213
+ for (let i = 0, len = keys.length; i < len; i++) {
214
+ const prop = keys[i];
215
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
154
216
  const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
155
217
  const a = utils.hasOwnProp(config1, prop) ? config1[prop] : undefined;
156
218
  const b = utils.hasOwnProp(config2, prop) ? config2[prop] : undefined;
157
- const configValue = merge(a, b, prop);
219
+ const configValue =
220
+ merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
158
221
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
159
- });
222
+ }
160
223
 
161
224
  if (
162
225
  utils.hasOwnProp(config2, 'validateStatus') &&
163
226
  utils.isUndefined(config2.validateStatus) &&
164
- getMergedTransitionalOption('validateStatusUndefinedResolves') === false
227
+ getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false
165
228
  ) {
166
229
  if (utils.hasOwnProp(config1, 'validateStatus')) {
167
230
  config.validateStatus = getMergedValue(undefined, config1.validateStatus);
@@ -7,4 +7,5 @@ export default {
7
7
  legacyInterceptorReqResOrdering: true,
8
8
  advertiseZstdAcceptEncoding: false,
9
9
  validateStatusUndefinedResolves: true,
10
+ encodeBasicAuthUsername: false,
10
11
  };
@@ -1 +1 @@
1
- export const VERSION = "1.20.0";
1
+ export const VERSION = "1.21.0";
@@ -69,11 +69,15 @@ class AxiosTransformStream extends stream.Transform {
69
69
 
70
70
  const divider = 1000 / timeWindow;
71
71
  const bytesThreshold = maxRate / divider;
72
- const minChunkSize =
72
+ let minChunkSize =
73
73
  internals.minChunkSize !== false
74
74
  ? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
75
75
  : 0;
76
76
 
77
+ if (maxRate) {
78
+ minChunkSize = Math.min(bytesThreshold, minChunkSize);
79
+ }
80
+
77
81
  const pushChunk = (_chunk, _callback) => {
78
82
  const bytes = Buffer.byteLength(_chunk);
79
83
  internals.bytesSeen += bytes;
@@ -92,6 +96,9 @@ class AxiosTransformStream extends stream.Transform {
92
96
  };
93
97
 
94
98
  const transformChunk = (_chunk, _callback) => {
99
+ if (this.destroyed) {
100
+ return _callback();
101
+ }
95
102
  const chunkSize = Buffer.byteLength(_chunk);
96
103
  let chunkRemainder = null;
97
104
  let maxChunkSize = readableHighWaterMark;
@@ -120,7 +127,9 @@ class AxiosTransformStream extends stream.Transform {
120
127
  }
121
128
 
122
129
  if (bytesLeft < maxChunkSize) {
123
- maxChunkSize = bytesLeft;
130
+ // A buffer boundary must consume at least one byte. Carry any
131
+ // fractional allowance forward in the next accounting window.
132
+ maxChunkSize = Math.max(1, Math.floor(bytesLeft));
124
133
  }
125
134
  }
126
135
 
@@ -93,7 +93,7 @@ class Http2Sessions {
93
93
  }
94
94
 
95
95
  stream.once('close', () => {
96
- if (!--streamsCount) {
96
+ if (!--streamsCount && !removed) {
97
97
  timer = setTimeout(() => {
98
98
  timer = null;
99
99
  removeSession();
@@ -107,6 +107,7 @@ class Http2Sessions {
107
107
 
108
108
  session.once('close', removeSession);
109
109
  session.once('error', removeSession);
110
+ session.once('goaway', removeSession);
110
111
 
111
112
  let entry = [session, options];
112
113
 
@@ -34,12 +34,15 @@ const composeSignals = (signals, timeout) => {
34
34
  }, timeout);
35
35
 
36
36
  const unsubscribe = () => {
37
- if (!signals) { return; }
37
+ if (!signals) {
38
+ return;
39
+ }
38
40
  timer && clearTimeout(timer);
39
41
  timer = null;
40
42
  signals.forEach((signal) => {
41
- signal.unsubscribe
42
- ? signal.unsubscribe(onabort)
43
+ const unsubscribeSignal = utils.getSafeProp(signal, 'unsubscribe');
44
+ utils.isFunction(unsubscribeSignal)
45
+ ? unsubscribeSignal.call(signal, onabort)
43
46
  : signal.removeEventListener('abort', onabort);
44
47
  });
45
48
  signals = null;
@@ -1,6 +1,14 @@
1
1
  import utils from '../utils.js';
2
2
  import platform from '../platform/index.js';
3
3
 
4
+ const decodeCookieValue = (value) => {
5
+ try {
6
+ return decodeURIComponent(value);
7
+ } catch (e) {
8
+ return value;
9
+ }
10
+ };
11
+
4
12
  export default platform.hasStandardBrowserEnv
5
13
  ? // Standard browser envs support document.cookie
6
14
  {
@@ -30,26 +38,39 @@ export default platform.hasStandardBrowserEnv
30
38
 
31
39
  read(name) {
32
40
  if (typeof document === 'undefined') return null;
41
+ const cookieString = document.cookie;
42
+ if (!cookieString) return null;
33
43
  // Match name=value by splitting on the semicolon separator instead of building a
34
44
  // RegExp from `name` — interpolating an unescaped string into a RegExp would let
35
45
  // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
36
46
  // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
37
47
  // "; ", so ignore optional whitespace before each cookie name.
38
- const cookies = document.cookie.split(';');
48
+ const cookies = cookieString.split(';');
39
49
  for (let i = 0; i < cookies.length; i++) {
40
50
  const cookie = cookies[i].replace(/^\s+/, '');
41
51
  const eq = cookie.indexOf('=');
42
52
  if (eq !== -1 && cookie.slice(0, eq) === name) {
43
- try {
44
- return decodeURIComponent(cookie.slice(eq + 1));
45
- } catch (e) {
46
- return cookie.slice(eq + 1);
47
- }
53
+ return decodeCookieValue(cookie.slice(eq + 1));
48
54
  }
49
55
  }
50
56
  return null;
51
57
  },
52
58
 
59
+ async readAsync(name) {
60
+ try {
61
+ const store = typeof window !== 'undefined' && window.cookieStore;
62
+ if (store && utils.isFunction(store.get)) {
63
+ const cookie = await store.get(name);
64
+ // Both APIs expose stored bytes; preserve Axios's existing URI decoding.
65
+ return cookie ? decodeCookieValue(cookie.value) : null;
66
+ }
67
+ } catch (e) {
68
+ // Restricted or unavailable storage retains the synchronous fallback.
69
+ }
70
+
71
+ return this.read(name);
72
+ },
73
+
53
74
  remove(name) {
54
75
  this.write(name, '', Date.now() - 86400000, '/');
55
76
  },
@@ -60,5 +81,8 @@ export default platform.hasStandardBrowserEnv
60
81
  read() {
61
82
  return null;
62
83
  },
84
+ async readAsync() {
85
+ return null;
86
+ },
63
87
  remove() {},
64
88
  };
@@ -2,7 +2,7 @@
2
2
  * Estimate data: URL byte lengths *without* allocating large buffers.
3
3
  * - Fetch percent-decodes a base64 body before decoding it.
4
4
  * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
5
- * raw body, including ignored characters and content after padding.
5
+ * percent-decoded body, including ignored characters and content after padding.
6
6
  * - Non-base64 data is percent-decoded and then encoded as UTF-8.
7
7
  */
8
8
  const isHexDigit = (charCode) =>
@@ -50,6 +50,31 @@ const estimateBase64BufferAllocation = (body) => {
50
50
  return Math.floor(((len - padding) * 3) / 4);
51
51
  };
52
52
 
53
+ const estimatePercentDecodedBase64BufferAllocation = (body) => {
54
+ // Ordinary Base64 needs only its length and trailing padding.
55
+ if (body.indexOf('%') === -1) {
56
+ return estimateBase64BufferAllocation(body);
57
+ }
58
+
59
+ let length = 0;
60
+ let previous = 0;
61
+ let last = 0;
62
+
63
+ for (let i = 0, len = body.length; i < len; i++) {
64
+ let code = body.charCodeAt(i);
65
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
66
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
67
+ i += 2;
68
+ }
69
+ length++;
70
+ previous = last;
71
+ last = code;
72
+ }
73
+
74
+ const padding = last === 61 ? (previous === 61 ? 2 : 1) : 0;
75
+ return Math.floor(((length - padding) * 3) / 4);
76
+ };
77
+
53
78
  const estimatePercentDecodedBase64Bytes = (body) => {
54
79
  const len = body.length;
55
80
  let significant = 0;
@@ -95,16 +120,16 @@ const estimatePercentDecodedBase64Bytes = (body) => {
95
120
  return base64Bytes(significant);
96
121
  };
97
122
 
98
- const estimateDataURLBytes = (url, estimateBase64) => {
123
+ const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
99
124
  if (!url || typeof url !== 'string') return 0;
100
- if (!url.startsWith('data:')) return 0;
125
+ if (!/^data:/i.test(url)) return 0;
101
126
 
102
127
  const comma = url.indexOf(',');
103
128
  if (comma < 0) return 0;
104
129
 
105
130
  const meta = url.slice(5, comma);
106
131
  const body = url.slice(comma + 1);
107
- const isBase64 = /;base64/i.test(meta);
132
+ const isBase64 = base64Pattern.test(meta);
108
133
 
109
134
  if (isBase64) {
110
135
  return estimateBase64(body);
@@ -151,16 +176,18 @@ export default function estimateDataURLDecodedBytes(url) {
151
176
 
152
177
  return estimateDataURLBytes(
153
178
  fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
154
- estimatePercentDecodedBase64Bytes
179
+ estimatePercentDecodedBase64Bytes,
180
+ /; *base64[\t\n\f\r ]*$/i
155
181
  );
156
182
  }
157
183
 
158
184
  /**
159
- * Estimate the Buffer backing allocation used by Node's raw base64 decoder.
185
+ * Estimate the Buffer backing allocation used after Node's percent-decoding step.
160
186
  *
161
187
  * @param {string} url
162
188
  * @returns {number}
163
189
  */
164
190
  export function estimateDataURLBufferAllocation(url) {
165
- return estimateDataURLBytes(url, estimateBase64BufferAllocation);
191
+ // Match fromDataURI's case-insensitive protocol and encoding suffix.
192
+ return estimateDataURLBytes(url, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
166
193
  }
@@ -0,0 +1,113 @@
1
+ import utils from '../utils.js';
2
+
3
+ const CRLF = '\r\n';
4
+ const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
5
+ const escapeName = (value) =>
6
+ String(value).replace(/[\r\n"]/g, (char) =>
7
+ char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22'
8
+ );
9
+
10
+ // Count UTF-8 bytes without allocating an encoded copy of a field. FormData
11
+ // string values normalize line endings; Blob/File contents remain unchanged.
12
+ const stringBytes = (value, normalize) => {
13
+ let length = 0;
14
+ for (let i = 0; i < value.length; i++) {
15
+ const code = value.charCodeAt(i);
16
+ if (normalize && (code === 13 || code === 10)) {
17
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
18
+ length += 2;
19
+ } else if (code < 0x80) {
20
+ length++;
21
+ } else if (code < 0x800) {
22
+ length += 2;
23
+ } else if (
24
+ code >= 0xd800 &&
25
+ code <= 0xdbff &&
26
+ value.charCodeAt(i + 1) >= 0xdc00 &&
27
+ value.charCodeAt(i + 1) <= 0xdfff
28
+ ) {
29
+ length += 4;
30
+ i++;
31
+ } else {
32
+ length += 3;
33
+ }
34
+ }
35
+ return length;
36
+ };
37
+
38
+ // Describe serialization failures independently of any request library.
39
+ export class FormDataError extends TypeError {
40
+ constructor(message, reason) {
41
+ super(message);
42
+ this.name = 'FormDataError';
43
+ this.reason = reason;
44
+ }
45
+ }
46
+
47
+ // The caller supplies the boundary, Blob implementation, and limit error.
48
+ export default function formDataToBlob(form, Blob, limit, limitError, boundary) {
49
+ if (!utils.isFunction(Blob)) {
50
+ throw new FormDataError('Blob is not supported', 'blob');
51
+ }
52
+
53
+ if (
54
+ !utils.isString(boundary) ||
55
+ !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) ||
56
+ / $/.test(boundary)
57
+ ) {
58
+ throw new FormDataError('Invalid multipart boundary', 'boundary');
59
+ }
60
+ const footer = '--' + boundary + '--' + CRLF;
61
+ let length = footer.length;
62
+ const parts = [];
63
+ const checkLength = (extra) => {
64
+ if (length + extra > limit) throw limitError();
65
+ };
66
+ checkLength(0);
67
+
68
+ for (const [name, value] of form) {
69
+ const isString = utils.isString(value);
70
+ const valueLength = isString ? stringBytes(value, true) : value.size;
71
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
72
+ throw new FormDataError('Unsupported FormData part size', 'part');
73
+ }
74
+ // Reject large values and names before building normalized header strings.
75
+ checkLength(
76
+ valueLength +
77
+ stringBytes(name, true) +
78
+ (!isString && value.name ? stringBytes(value.name, false) : 0) +
79
+ (!isString && value.type ? stringBytes(value.type, false) : 0)
80
+ );
81
+
82
+ let header =
83
+ '--' +
84
+ boundary +
85
+ CRLF +
86
+ 'Content-Disposition: form-data; name="' +
87
+ escapeName(normalizeLines(name)) +
88
+ '"';
89
+ if (!isString) {
90
+ header +=
91
+ '; filename="' +
92
+ escapeName(utils.isString(value.name) ? value.name : 'blob') +
93
+ '"' +
94
+ CRLF +
95
+ 'Content-Type: ' +
96
+ String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
97
+ }
98
+ header += CRLF + CRLF;
99
+ const partLength = stringBytes(header, false) + valueLength + CRLF.length;
100
+ checkLength(partLength);
101
+ length += partLength;
102
+ parts.push({ header, value, isString });
103
+ }
104
+
105
+ // Native Blob composition retains existing Blob/File data. No file is read
106
+ // and no complete multipart ArrayBuffer is created to determine its length.
107
+ const blobParts = [];
108
+ for (const part of parts) {
109
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
110
+ }
111
+ blobParts.push(footer);
112
+ return new Blob(blobParts, { type: 'multipart/form-data; boundary=' + boundary });
113
+ }