appium-mac2-driver 4.4.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 (350) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/WebDriverAgentMac/IntegrationTests/AMWindowTests.m +427 -0
  3. package/WebDriverAgentMac/WebDriverAgentLib/Commands/AMWindowCommands.m +63 -0
  4. package/WebDriverAgentMac/WebDriverAgentLib/Commands/FBDebugCommands.m +2 -0
  5. package/WebDriverAgentMac/WebDriverAgentLib/Routing/FBCommandStatus.h +3 -0
  6. package/WebDriverAgentMac/WebDriverAgentLib/Routing/FBCommandStatus.m +13 -0
  7. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMScreenUtils.h +4 -0
  8. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMScreenUtils.m +23 -0
  9. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMSnapshotUtils.h +18 -0
  10. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMSnapshotUtils.m +43 -28
  11. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMWindowUtils.h +111 -0
  12. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMWindowUtils.m +780 -0
  13. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMXCTAccessibility.h +61 -0
  14. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMXCTAccessibility.m +108 -0
  15. package/WebDriverAgentMac/WebDriverAgentMac.xcodeproj/project.pbxproj +20 -0
  16. package/build/lib/commands/native-record-screen.d.ts +2 -0
  17. package/build/lib/commands/native-record-screen.d.ts.map +1 -1
  18. package/build/lib/commands/native-record-screen.js.map +1 -1
  19. package/build/lib/commands/windows.d.ts +22 -0
  20. package/build/lib/commands/windows.d.ts.map +1 -0
  21. package/build/lib/commands/windows.js +32 -0
  22. package/build/lib/commands/windows.js.map +1 -0
  23. package/build/lib/driver.d.ts +12 -0
  24. package/build/lib/driver.d.ts.map +1 -1
  25. package/build/lib/driver.js +3 -0
  26. package/build/lib/driver.js.map +1 -1
  27. package/build/lib/execute-method-map.d.ts +9 -0
  28. package/build/lib/execute-method-map.d.ts.map +1 -1
  29. package/build/lib/execute-method-map.js +9 -0
  30. package/build/lib/execute-method-map.js.map +1 -1
  31. package/build/lib/session-claim-handler.d.ts.map +1 -1
  32. package/build/lib/session-claim-handler.js +1 -2
  33. package/build/lib/session-claim-handler.js.map +1 -1
  34. package/build/lib/types.d.ts +26 -0
  35. package/build/lib/types.d.ts.map +1 -1
  36. package/build/lib/wda-mac.d.ts +0 -1
  37. package/build/lib/wda-mac.d.ts.map +1 -1
  38. package/build/lib/wda-mac.js +1 -1
  39. package/lib/commands/native-record-screen.ts +2 -0
  40. package/lib/commands/windows.ts +44 -0
  41. package/lib/driver.ts +4 -0
  42. package/lib/execute-method-map.ts +9 -0
  43. package/lib/session-claim-handler.ts +1 -2
  44. package/lib/types.ts +28 -0
  45. package/lib/wda-mac.ts +1 -2
  46. package/node_modules/@appium/support/build/lib/npm.d.ts.map +1 -1
  47. package/node_modules/@appium/support/build/lib/npm.js +2 -1
  48. package/node_modules/@appium/support/build/lib/npm.js.map +1 -1
  49. package/node_modules/@appium/support/build/lib/util.d.ts.map +1 -1
  50. package/node_modules/@appium/support/build/lib/util.js +13 -1
  51. package/node_modules/@appium/support/build/lib/util.js.map +1 -1
  52. package/node_modules/@appium/support/build/lib/zip.d.ts +2 -1
  53. package/node_modules/@appium/support/build/lib/zip.d.ts.map +1 -1
  54. package/node_modules/@appium/support/build/lib/zip.js +193 -64
  55. package/node_modules/@appium/support/build/lib/zip.js.map +1 -1
  56. package/node_modules/@appium/support/lib/npm.ts +2 -1
  57. package/node_modules/@appium/support/lib/util.ts +13 -1
  58. package/node_modules/@appium/support/lib/zip.ts +231 -71
  59. package/node_modules/@appium/support/node_modules/axios/CHANGELOG.md +1934 -0
  60. package/node_modules/@appium/support/node_modules/axios/LICENSE +7 -0
  61. package/node_modules/@appium/support/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  62. package/node_modules/@appium/support/node_modules/axios/README.md +2851 -0
  63. package/node_modules/@appium/support/node_modules/axios/dist/axios.js +5807 -0
  64. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js +5 -0
  65. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js.map +1 -0
  66. package/node_modules/@appium/support/node_modules/axios/dist/browser/axios.cjs +5829 -0
  67. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.js +5850 -0
  68. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js +3 -0
  69. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  70. package/node_modules/@appium/support/node_modules/axios/dist/node/axios.cjs +6808 -0
  71. package/node_modules/@appium/support/node_modules/axios/index.d.cts +766 -0
  72. package/node_modules/@appium/support/node_modules/axios/index.d.ts +787 -0
  73. package/node_modules/@appium/support/node_modules/axios/index.js +45 -0
  74. package/node_modules/@appium/support/node_modules/axios/lib/adapters/README.md +36 -0
  75. package/node_modules/@appium/support/node_modules/axios/lib/adapters/adapters.js +132 -0
  76. package/node_modules/@appium/support/node_modules/axios/lib/adapters/fetch.js +696 -0
  77. package/node_modules/@appium/support/node_modules/axios/lib/adapters/http.js +1490 -0
  78. package/node_modules/@appium/support/node_modules/axios/lib/adapters/xhr.js +277 -0
  79. package/node_modules/@appium/support/node_modules/axios/lib/axios.js +89 -0
  80. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  81. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  82. package/node_modules/@appium/support/node_modules/axios/lib/cancel/isCancel.js +5 -0
  83. package/node_modules/@appium/support/node_modules/axios/lib/core/Axios.js +306 -0
  84. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosError.js +219 -0
  85. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
  86. package/node_modules/@appium/support/node_modules/axios/lib/core/InterceptorManager.js +171 -0
  87. package/node_modules/@appium/support/node_modules/axios/lib/core/README.md +8 -0
  88. package/node_modules/@appium/support/node_modules/axios/lib/core/buildFullPath.js +76 -0
  89. package/node_modules/@appium/support/node_modules/axios/lib/core/dispatchRequest.js +95 -0
  90. package/node_modules/@appium/support/node_modules/axios/lib/core/mergeConfig.js +174 -0
  91. package/node_modules/@appium/support/node_modules/axios/lib/core/methodList.js +17 -0
  92. package/node_modules/@appium/support/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  93. package/node_modules/@appium/support/node_modules/axios/lib/core/settle.js +27 -0
  94. package/node_modules/@appium/support/node_modules/axios/lib/core/transformData.js +28 -0
  95. package/node_modules/@appium/support/node_modules/axios/lib/defaults/index.js +178 -0
  96. package/node_modules/@appium/support/node_modules/axios/lib/defaults/transitional.js +10 -0
  97. package/node_modules/@appium/support/node_modules/axios/lib/env/README.md +3 -0
  98. package/node_modules/@appium/support/node_modules/axios/lib/env/classes/FormData.js +2 -0
  99. package/node_modules/@appium/support/node_modules/axios/lib/env/data.js +1 -0
  100. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
  101. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  102. package/node_modules/@appium/support/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
  103. package/node_modules/@appium/support/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  104. package/node_modules/@appium/support/node_modules/axios/lib/helpers/README.md +7 -0
  105. package/node_modules/@appium/support/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  106. package/node_modules/@appium/support/node_modules/axios/lib/helpers/bind.js +14 -0
  107. package/node_modules/@appium/support/node_modules/axios/lib/helpers/buildURL.js +69 -0
  108. package/node_modules/@appium/support/node_modules/axios/lib/helpers/callbackify.js +18 -0
  109. package/node_modules/@appium/support/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  110. package/node_modules/@appium/support/node_modules/axios/lib/helpers/composeSignals.js +68 -0
  111. package/node_modules/@appium/support/node_modules/axios/lib/helpers/cookies.js +64 -0
  112. package/node_modules/@appium/support/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  113. package/node_modules/@appium/support/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
  114. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
  115. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  116. package/node_modules/@appium/support/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
  117. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  118. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  119. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
  120. package/node_modules/@appium/support/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  121. package/node_modules/@appium/support/node_modules/axios/lib/helpers/null.js +2 -0
  122. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
  123. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  124. package/node_modules/@appium/support/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  125. package/node_modules/@appium/support/node_modules/axios/lib/helpers/readBlob.js +15 -0
  126. package/node_modules/@appium/support/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
  127. package/node_modules/@appium/support/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  128. package/node_modules/@appium/support/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
  129. package/node_modules/@appium/support/node_modules/axios/lib/helpers/speedometer.js +55 -0
  130. package/node_modules/@appium/support/node_modules/axios/lib/helpers/spread.js +28 -0
  131. package/node_modules/@appium/support/node_modules/axios/lib/helpers/throttle.js +45 -0
  132. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toFormData.js +279 -0
  133. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  134. package/node_modules/@appium/support/node_modules/axios/lib/helpers/trackStream.js +89 -0
  135. package/node_modules/@appium/support/node_modules/axios/lib/helpers/validator.js +112 -0
  136. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  137. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  138. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  139. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/index.js +13 -0
  140. package/node_modules/@appium/support/node_modules/axios/lib/platform/common/utils.js +52 -0
  141. package/node_modules/@appium/support/node_modules/axios/lib/platform/index.js +7 -0
  142. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  143. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  144. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  145. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/index.js +37 -0
  146. package/node_modules/@appium/support/node_modules/axios/lib/utils.js +1150 -0
  147. package/node_modules/@appium/support/node_modules/axios/package.json +203 -0
  148. package/node_modules/@appium/support/package.json +6 -6
  149. package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts +6 -4
  150. package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts.map +1 -1
  151. package/node_modules/@appium/types/lib/commands/basedriver.ts +4 -4
  152. package/node_modules/@appium/types/package.json +2 -2
  153. package/node_modules/appium-xcode/CHANGELOG.md +7 -0
  154. package/node_modules/appium-xcode/package.json +4 -4
  155. package/node_modules/asyncbox/README.md +43 -0
  156. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts +9 -0
  157. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts.map +1 -0
  158. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js +35 -0
  159. package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js.map +1 -0
  160. package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts +9 -0
  161. package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts.map +1 -0
  162. package/node_modules/asyncbox/build/cjs/lib/asyncmap.js +23 -0
  163. package/node_modules/asyncbox/build/cjs/lib/asyncmap.js.map +1 -0
  164. package/node_modules/asyncbox/build/cjs/lib/errors.d.ts +9 -0
  165. package/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -0
  166. package/node_modules/asyncbox/build/cjs/lib/errors.js +20 -0
  167. package/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -0
  168. package/node_modules/asyncbox/build/cjs/lib/index.d.ts +12 -0
  169. package/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -0
  170. package/node_modules/asyncbox/build/cjs/lib/index.js +24 -0
  171. package/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -0
  172. package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts +3 -0
  173. package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts.map +1 -0
  174. package/node_modules/asyncbox/build/cjs/lib/limit-function.js +15 -0
  175. package/node_modules/asyncbox/build/cjs/lib/limit-function.js.map +1 -0
  176. package/node_modules/asyncbox/build/cjs/lib/lock.d.ts +74 -0
  177. package/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -0
  178. package/node_modules/asyncbox/build/cjs/lib/lock.js +295 -0
  179. package/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -0
  180. package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts +15 -0
  181. package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts.map +1 -0
  182. package/node_modules/asyncbox/build/cjs/lib/long-sleep.js +36 -0
  183. package/node_modules/asyncbox/build/cjs/lib/long-sleep.js.map +1 -0
  184. package/node_modules/asyncbox/build/cjs/lib/retry.d.ts +17 -0
  185. package/node_modules/asyncbox/build/cjs/lib/retry.d.ts.map +1 -0
  186. package/node_modules/asyncbox/build/cjs/lib/retry.js +57 -0
  187. package/node_modules/asyncbox/build/cjs/lib/retry.js.map +1 -0
  188. package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts +20 -0
  189. package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts.map +1 -0
  190. package/node_modules/asyncbox/build/cjs/lib/sleep.js +61 -0
  191. package/node_modules/asyncbox/build/cjs/lib/sleep.js.map +1 -0
  192. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +18 -0
  193. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -0
  194. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +51 -0
  195. package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -0
  196. package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts +16 -0
  197. package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts.map +1 -0
  198. package/node_modules/asyncbox/build/cjs/lib/with-timeout.js +45 -0
  199. package/node_modules/asyncbox/build/cjs/lib/with-timeout.js.map +1 -0
  200. package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts +9 -0
  201. package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts.map +1 -0
  202. package/node_modules/asyncbox/build/esm/lib/asyncfilter.js +32 -0
  203. package/node_modules/asyncbox/build/esm/lib/asyncfilter.js.map +1 -0
  204. package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts +9 -0
  205. package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts.map +1 -0
  206. package/node_modules/asyncbox/build/esm/lib/asyncmap.js +20 -0
  207. package/node_modules/asyncbox/build/esm/lib/asyncmap.js.map +1 -0
  208. package/node_modules/asyncbox/build/esm/lib/errors.d.ts +9 -0
  209. package/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -0
  210. package/node_modules/asyncbox/build/esm/lib/errors.js +15 -0
  211. package/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -0
  212. package/node_modules/asyncbox/build/esm/lib/index.d.ts +12 -0
  213. package/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -0
  214. package/node_modules/asyncbox/build/esm/lib/index.js +10 -0
  215. package/node_modules/asyncbox/build/esm/lib/index.js.map +1 -0
  216. package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts +3 -0
  217. package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts.map +1 -0
  218. package/node_modules/asyncbox/build/esm/lib/limit-function.js +12 -0
  219. package/node_modules/asyncbox/build/esm/lib/limit-function.js.map +1 -0
  220. package/node_modules/asyncbox/build/esm/lib/lock.d.ts +74 -0
  221. package/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -0
  222. package/node_modules/asyncbox/build/esm/lib/lock.js +291 -0
  223. package/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -0
  224. package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts +15 -0
  225. package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts.map +1 -0
  226. package/node_modules/asyncbox/build/esm/lib/long-sleep.js +33 -0
  227. package/node_modules/asyncbox/build/esm/lib/long-sleep.js.map +1 -0
  228. package/node_modules/asyncbox/build/esm/lib/retry.d.ts +17 -0
  229. package/node_modules/asyncbox/build/esm/lib/retry.d.ts.map +1 -0
  230. package/node_modules/asyncbox/build/esm/lib/retry.js +53 -0
  231. package/node_modules/asyncbox/build/esm/lib/retry.js.map +1 -0
  232. package/node_modules/asyncbox/build/esm/lib/sleep.d.ts +20 -0
  233. package/node_modules/asyncbox/build/esm/lib/sleep.d.ts.map +1 -0
  234. package/node_modules/asyncbox/build/esm/lib/sleep.js +58 -0
  235. package/node_modules/asyncbox/build/esm/lib/sleep.js.map +1 -0
  236. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +18 -0
  237. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -0
  238. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +48 -0
  239. package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -0
  240. package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts +16 -0
  241. package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts.map +1 -0
  242. package/node_modules/asyncbox/build/esm/lib/with-timeout.js +42 -0
  243. package/node_modules/asyncbox/build/esm/lib/with-timeout.js.map +1 -0
  244. package/node_modules/asyncbox/lib/asyncfilter.ts +38 -0
  245. package/node_modules/asyncbox/lib/asyncmap.ts +29 -0
  246. package/node_modules/asyncbox/lib/errors.ts +15 -0
  247. package/node_modules/asyncbox/lib/index.ts +21 -0
  248. package/node_modules/asyncbox/lib/limit-function.ts +18 -0
  249. package/node_modules/asyncbox/lib/lock.ts +360 -0
  250. package/node_modules/asyncbox/lib/long-sleep.ts +38 -0
  251. package/node_modules/asyncbox/lib/retry.ts +61 -0
  252. package/node_modules/asyncbox/lib/sleep.ts +79 -0
  253. package/node_modules/asyncbox/lib/wait-for-condition.ts +52 -0
  254. package/node_modules/asyncbox/lib/with-timeout.ts +43 -0
  255. package/node_modules/asyncbox/package.json +8 -8
  256. package/node_modules/axios/README.md +41 -106
  257. package/node_modules/axios/dist/axios.js +931 -278
  258. package/node_modules/axios/dist/axios.min.js +2 -2
  259. package/node_modules/axios/dist/axios.min.js.map +1 -1
  260. package/node_modules/axios/dist/browser/axios.cjs +948 -268
  261. package/node_modules/axios/dist/esm/axios.js +948 -268
  262. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  263. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  264. package/node_modules/axios/dist/node/axios.cjs +925 -242
  265. package/node_modules/axios/index.d.cts +20 -1
  266. package/node_modules/axios/index.d.ts +18 -1
  267. package/node_modules/axios/lib/adapters/fetch.js +73 -20
  268. package/node_modules/axios/lib/adapters/http.js +145 -26
  269. package/node_modules/axios/lib/adapters/xhr.js +120 -13
  270. package/node_modules/axios/lib/core/Axios.js +67 -12
  271. package/node_modules/axios/lib/core/AxiosError.js +59 -0
  272. package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
  273. package/node_modules/axios/lib/core/InterceptorManager.js +13 -2
  274. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  275. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  276. package/node_modules/axios/lib/core/dispatchRequest.js +20 -0
  277. package/node_modules/axios/lib/core/mergeConfig.js +183 -120
  278. package/node_modules/axios/lib/defaults/transitional.js +1 -0
  279. package/node_modules/axios/lib/env/data.js +1 -1
  280. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
  281. package/node_modules/axios/lib/helpers/Http2Sessions.js +2 -1
  282. package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
  283. package/node_modules/axios/lib/helpers/cookies.js +30 -6
  284. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
  285. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  286. package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
  287. package/node_modules/axios/lib/helpers/fromDataURI.js +8 -2
  288. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
  289. package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
  290. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  291. package/node_modules/axios/lib/helpers/resolveConfig.js +16 -3
  292. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +16 -1
  293. package/node_modules/axios/lib/utils.js +61 -10
  294. package/node_modules/axios/package.json +1 -2
  295. package/node_modules/bare-url/README.md +4 -0
  296. package/node_modules/bare-url/index.d.ts +3 -0
  297. package/node_modules/bare-url/index.js +42 -18
  298. package/node_modules/bare-url/lib/errors.js +4 -0
  299. package/node_modules/bare-url/package.json +1 -1
  300. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  301. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  302. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  303. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  304. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  305. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  306. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  307. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  308. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  309. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  310. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  311. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  312. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  313. package/node_modules/follow-redirects/README.md +27 -1
  314. package/node_modules/follow-redirects/index.js +1 -5
  315. package/node_modules/follow-redirects/package.json +1 -1
  316. package/node_modules/shell-quote/README.md +37 -4
  317. package/node_modules/shell-quote/package.json +10 -6
  318. package/node_modules/shell-quote/parse.d.ts +1 -1
  319. package/node_modules/shell-quote/parse.js +63 -11
  320. package/node_modules/shell-quote/quote.d.ts +2 -1
  321. package/node_modules/shell-quote/quote.js +23 -3
  322. package/node_modules/uuid/package.json +17 -17
  323. package/package.json +6 -7
  324. package/scripts/setup-accessibility.mjs +175 -0
  325. package/node_modules/async-lock/AUTHORS +0 -21
  326. package/node_modules/async-lock/History.md +0 -132
  327. package/node_modules/async-lock/LICENSE +0 -22
  328. package/node_modules/async-lock/README.md +0 -177
  329. package/node_modules/async-lock/index.js +0 -2
  330. package/node_modules/async-lock/lib/index.js +0 -312
  331. package/node_modules/async-lock/package.json +0 -48
  332. package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts +0 -103
  333. package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts.map +0 -1
  334. package/node_modules/asyncbox/build/cjs/lib/asyncbox.js +0 -311
  335. package/node_modules/asyncbox/build/cjs/lib/asyncbox.js.map +0 -1
  336. package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts +0 -103
  337. package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts.map +0 -1
  338. package/node_modules/asyncbox/build/esm/lib/asyncbox.js +0 -298
  339. package/node_modules/asyncbox/build/esm/lib/asyncbox.js.map +0 -1
  340. package/node_modules/asyncbox/lib/asyncbox.ts +0 -382
  341. package/node_modules/shell-quote/.nycrc +0 -14
  342. package/node_modules/shell-quote/eslint.config.mjs +0 -29
  343. package/node_modules/shell-quote/security.md +0 -11
  344. package/node_modules/shell-quote/test/comment.js +0 -16
  345. package/node_modules/shell-quote/test/env.js +0 -52
  346. package/node_modules/shell-quote/test/env_fn.js +0 -21
  347. package/node_modules/shell-quote/test/op.js +0 -102
  348. package/node_modules/shell-quote/test/parse.js +0 -149
  349. package/node_modules/shell-quote/test/quote.js +0 -145
  350. package/node_modules/shell-quote/test/set.js +0 -31
@@ -0,0 +1,156 @@
1
+ 'use strict';
2
+
3
+ import stream from 'stream';
4
+ import utils from '../utils.js';
5
+
6
+ const kInternals = Symbol('internals');
7
+
8
+ class AxiosTransformStream extends stream.Transform {
9
+ constructor(options) {
10
+ options = utils.toFlatObject(
11
+ options,
12
+ {
13
+ maxRate: 0,
14
+ chunkSize: 64 * 1024,
15
+ minChunkSize: 100,
16
+ timeWindow: 500,
17
+ ticksRate: 2,
18
+ samplesCount: 15,
19
+ },
20
+ null,
21
+ (prop, source) => {
22
+ return !utils.isUndefined(source[prop]);
23
+ }
24
+ );
25
+
26
+ super({
27
+ readableHighWaterMark: options.chunkSize,
28
+ });
29
+
30
+ const internals = (this[kInternals] = {
31
+ timeWindow: options.timeWindow,
32
+ chunkSize: options.chunkSize,
33
+ maxRate: options.maxRate,
34
+ minChunkSize: options.minChunkSize,
35
+ bytesSeen: 0,
36
+ isCaptured: false,
37
+ notifiedBytesLoaded: 0,
38
+ ts: Date.now(),
39
+ bytes: 0,
40
+ onReadCallback: null,
41
+ });
42
+
43
+ this.on('newListener', (event) => {
44
+ if (event === 'progress') {
45
+ if (!internals.isCaptured) {
46
+ internals.isCaptured = true;
47
+ }
48
+ }
49
+ });
50
+ }
51
+
52
+ _read(size) {
53
+ const internals = this[kInternals];
54
+
55
+ if (internals.onReadCallback) {
56
+ internals.onReadCallback();
57
+ }
58
+
59
+ return super._read(size);
60
+ }
61
+
62
+ _transform(chunk, encoding, callback) {
63
+ const internals = this[kInternals];
64
+ const maxRate = internals.maxRate;
65
+
66
+ const readableHighWaterMark = this.readableHighWaterMark;
67
+
68
+ const timeWindow = internals.timeWindow;
69
+
70
+ const divider = 1000 / timeWindow;
71
+ const bytesThreshold = maxRate / divider;
72
+ const minChunkSize =
73
+ internals.minChunkSize !== false
74
+ ? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
75
+ : 0;
76
+
77
+ const pushChunk = (_chunk, _callback) => {
78
+ const bytes = Buffer.byteLength(_chunk);
79
+ internals.bytesSeen += bytes;
80
+ internals.bytes += bytes;
81
+
82
+ internals.isCaptured && this.emit('progress', internals.bytesSeen);
83
+
84
+ if (this.push(_chunk)) {
85
+ process.nextTick(_callback);
86
+ } else {
87
+ internals.onReadCallback = () => {
88
+ internals.onReadCallback = null;
89
+ process.nextTick(_callback);
90
+ };
91
+ }
92
+ };
93
+
94
+ const transformChunk = (_chunk, _callback) => {
95
+ const chunkSize = Buffer.byteLength(_chunk);
96
+ let chunkRemainder = null;
97
+ let maxChunkSize = readableHighWaterMark;
98
+ let bytesLeft;
99
+ let passed = 0;
100
+
101
+ if (maxRate) {
102
+ const now = Date.now();
103
+
104
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
105
+ internals.ts = now;
106
+ bytesLeft = bytesThreshold - internals.bytes;
107
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
108
+ passed = 0;
109
+ }
110
+
111
+ bytesLeft = bytesThreshold - internals.bytes;
112
+ }
113
+
114
+ if (maxRate) {
115
+ if (bytesLeft <= 0) {
116
+ // next time window
117
+ return setTimeout(() => {
118
+ _callback(null, _chunk);
119
+ }, timeWindow - passed);
120
+ }
121
+
122
+ if (bytesLeft < maxChunkSize) {
123
+ maxChunkSize = bytesLeft;
124
+ }
125
+ }
126
+
127
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
128
+ chunkRemainder = _chunk.subarray(maxChunkSize);
129
+ _chunk = _chunk.subarray(0, maxChunkSize);
130
+ }
131
+
132
+ pushChunk(
133
+ _chunk,
134
+ chunkRemainder
135
+ ? () => {
136
+ process.nextTick(_callback, null, chunkRemainder);
137
+ }
138
+ : _callback
139
+ );
140
+ };
141
+
142
+ transformChunk(chunk, function transformNextChunk(err, _chunk) {
143
+ if (err) {
144
+ return callback(err);
145
+ }
146
+
147
+ if (_chunk) {
148
+ transformChunk(_chunk, transformNextChunk);
149
+ } else {
150
+ callback(null);
151
+ }
152
+ });
153
+ }
154
+ }
155
+
156
+ export default AxiosTransformStream;
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ import toFormData from './toFormData.js';
4
+
5
+ /**
6
+ * It encodes a string by replacing all characters that are not in the unreserved set with
7
+ * their percent-encoded equivalents
8
+ *
9
+ * @param {string} str - The string to encode.
10
+ *
11
+ * @returns {string} The encoded string.
12
+ */
13
+ function encode(str) {
14
+ const charMap = {
15
+ '!': '%21',
16
+ "'": '%27',
17
+ '(': '%28',
18
+ ')': '%29',
19
+ '~': '%7E',
20
+ '%20': '+',
21
+ };
22
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
23
+ return charMap[match];
24
+ });
25
+ }
26
+
27
+ /**
28
+ * It takes a params object and converts it to a FormData object
29
+ *
30
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
31
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
32
+ *
33
+ * @returns {void}
34
+ */
35
+ function AxiosURLSearchParams(params, options) {
36
+ this._pairs = [];
37
+
38
+ params && toFormData(params, this, options);
39
+ }
40
+
41
+ const prototype = AxiosURLSearchParams.prototype;
42
+
43
+ prototype.append = function append(name, value) {
44
+ this._pairs.push([name, value]);
45
+ };
46
+
47
+ prototype.toString = function toString(encoder) {
48
+ const _encode = encoder
49
+ ? (value) => encoder.call(this, value, encode)
50
+ : encode;
51
+
52
+ return this._pairs
53
+ .map(function each(pair) {
54
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
55
+ }, '')
56
+ .join('&');
57
+ };
58
+
59
+ export default AxiosURLSearchParams;
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+
3
+ // Node-only: relies on the built-in `http2` module. Browser/react-native
4
+ // builds replace `lib/adapters/http.js` (the sole importer) with `lib/helpers/null.js`
5
+ // via the `browser` package.json field, so this module is never reached in
6
+ // those environments. Do not import it from any browser-reachable code path.
7
+
8
+ import http2 from 'http2';
9
+ import util from 'util';
10
+
11
+ class Http2Sessions {
12
+ constructor() {
13
+ this.sessions = Object.create(null);
14
+ }
15
+
16
+ getSession(authority, options) {
17
+ options = Object.assign(
18
+ Object.create(null),
19
+ {
20
+ sessionTimeout: 1000,
21
+ },
22
+ options
23
+ );
24
+
25
+ let authoritySessions = this.sessions[authority];
26
+
27
+ if (authoritySessions) {
28
+ let len = authoritySessions.length;
29
+
30
+ for (let i = 0; i < len; i++) {
31
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
32
+ if (
33
+ !sessionHandle.destroyed &&
34
+ !sessionHandle.closed &&
35
+ util.isDeepStrictEqual(sessionOptions, options)
36
+ ) {
37
+ return sessionHandle;
38
+ }
39
+ }
40
+ }
41
+
42
+ const session = http2.connect(authority, options);
43
+
44
+ let removed;
45
+ let timer;
46
+
47
+ const removeSession = () => {
48
+ if (removed) {
49
+ return;
50
+ }
51
+
52
+ removed = true;
53
+
54
+ if (timer) {
55
+ clearTimeout(timer);
56
+ timer = null;
57
+ }
58
+
59
+ let entries = authoritySessions,
60
+ len = entries.length,
61
+ i = len;
62
+
63
+ while (i--) {
64
+ if (entries[i][0] === session) {
65
+ if (len === 1) {
66
+ delete this.sessions[authority];
67
+ } else {
68
+ entries.splice(i, 1);
69
+ }
70
+ if (!session.closed) {
71
+ session.close();
72
+ }
73
+ return;
74
+ }
75
+ }
76
+ };
77
+
78
+ const originalRequestFn = session.request;
79
+
80
+ const { sessionTimeout } = options;
81
+
82
+ if (sessionTimeout != null) {
83
+ let streamsCount = 0;
84
+
85
+ session.request = function () {
86
+ const stream = originalRequestFn.apply(this, arguments);
87
+
88
+ streamsCount++;
89
+
90
+ if (timer) {
91
+ clearTimeout(timer);
92
+ timer = null;
93
+ }
94
+
95
+ stream.once('close', () => {
96
+ if (!--streamsCount) {
97
+ timer = setTimeout(() => {
98
+ timer = null;
99
+ removeSession();
100
+ }, sessionTimeout);
101
+ }
102
+ });
103
+
104
+ return stream;
105
+ };
106
+ }
107
+
108
+ session.once('close', removeSession);
109
+ session.once('error', removeSession);
110
+
111
+ let entry = [session, options];
112
+
113
+ authoritySessions
114
+ ? authoritySessions.push(entry)
115
+ : (authoritySessions = this.sessions[authority] = [entry]);
116
+
117
+ return session;
118
+ }
119
+ }
120
+
121
+ export default Http2Sessions;
@@ -0,0 +1,88 @@
1
+ const HttpStatusCode = {
2
+ Continue: 100,
3
+ SwitchingProtocols: 101,
4
+ Processing: 102,
5
+ EarlyHints: 103,
6
+ Ok: 200,
7
+ Created: 201,
8
+ Accepted: 202,
9
+ NonAuthoritativeInformation: 203,
10
+ NoContent: 204,
11
+ ResetContent: 205,
12
+ PartialContent: 206,
13
+ MultiStatus: 207,
14
+ AlreadyReported: 208,
15
+ ImUsed: 226,
16
+ MultipleChoices: 300,
17
+ MovedPermanently: 301,
18
+ Found: 302,
19
+ SeeOther: 303,
20
+ NotModified: 304,
21
+ UseProxy: 305,
22
+ Unused: 306,
23
+ TemporaryRedirect: 307,
24
+ PermanentRedirect: 308,
25
+ BadRequest: 400,
26
+ Unauthorized: 401,
27
+ PaymentRequired: 402,
28
+ Forbidden: 403,
29
+ NotFound: 404,
30
+ MethodNotAllowed: 405,
31
+ NotAcceptable: 406,
32
+ ProxyAuthenticationRequired: 407,
33
+ RequestTimeout: 408,
34
+ Conflict: 409,
35
+ Gone: 410,
36
+ LengthRequired: 411,
37
+ PreconditionFailed: 412,
38
+ /**
39
+ * @deprecated Use `ContentTooLarge` instead.
40
+ */
41
+ PayloadTooLarge: 413,
42
+ ContentTooLarge: 413,
43
+ UriTooLong: 414,
44
+ UnsupportedMediaType: 415,
45
+ RangeNotSatisfiable: 416,
46
+ ExpectationFailed: 417,
47
+ ImATeapot: 418,
48
+ MisdirectedRequest: 421,
49
+ /**
50
+ * @deprecated Use `UnprocessableContent` instead.
51
+ */
52
+ UnprocessableEntity: 422,
53
+ UnprocessableContent: 422,
54
+ Locked: 423,
55
+ FailedDependency: 424,
56
+ TooEarly: 425,
57
+ UpgradeRequired: 426,
58
+ PreconditionRequired: 428,
59
+ TooManyRequests: 429,
60
+ RequestHeaderFieldsTooLarge: 431,
61
+ UnavailableForLegalReasons: 451,
62
+ InternalServerError: 500,
63
+ NotImplemented: 501,
64
+ BadGateway: 502,
65
+ ServiceUnavailable: 503,
66
+ GatewayTimeout: 504,
67
+ HttpVersionNotSupported: 505,
68
+ VariantAlsoNegotiates: 506,
69
+ InsufficientStorage: 507,
70
+ LoopDetected: 508,
71
+ NotExtended: 510,
72
+ NetworkAuthenticationRequired: 511,
73
+ WebServerReturnsAnUnknownError: 520,
74
+ WebServerIsDown: 521,
75
+ ConnectionTimedOut: 522,
76
+ OriginIsUnreachable: 523,
77
+ TimeoutOccurred: 524,
78
+ SslHandshakeFailed: 525,
79
+ InvalidSslCertificate: 526,
80
+ };
81
+
82
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
83
+ if (HttpStatusCode[value] === undefined) {
84
+ HttpStatusCode[value] = key;
85
+ }
86
+ });
87
+
88
+ export default HttpStatusCode;
@@ -0,0 +1,7 @@
1
+ # axios // helpers
2
+
3
+ The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
4
+
5
+ - Browser polyfills
6
+ - Managing cookies
7
+ - Parsing HTTP headers
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ import stream from 'stream';
4
+
5
+ class ZlibHeaderTransformStream extends stream.Transform {
6
+ __transform(chunk, encoding, callback) {
7
+ this.push(chunk);
8
+ callback();
9
+ }
10
+
11
+ _transform(chunk, encoding, callback) {
12
+ if (chunk.length !== 0) {
13
+ this._transform = this.__transform;
14
+
15
+ // Add Default Compression headers if no zlib headers are present
16
+ if (chunk[0] !== 120) {
17
+ // Hex: 78
18
+ const header = Buffer.alloc(2);
19
+ header[0] = 120; // Hex: 78
20
+ header[1] = 156; // Hex: 9C
21
+ this.push(header, encoding);
22
+ }
23
+ }
24
+
25
+ this.__transform(chunk, encoding, callback);
26
+ }
27
+ }
28
+
29
+ export default ZlibHeaderTransformStream;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Create a bound version of a function with a specified `this` context
5
+ *
6
+ * @param {Function} fn - The function to bind
7
+ * @param {*} thisArg - The value to be passed as the `this` parameter
8
+ * @returns {Function} A new function that will call the original function with the specified `this` context
9
+ */
10
+ export default function bind(fn, thisArg) {
11
+ return function wrap() {
12
+ return fn.apply(thisArg, arguments);
13
+ };
14
+ }
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ import utils from '../utils.js';
4
+ import AxiosURLSearchParams from './AxiosURLSearchParams.js';
5
+
6
+ /**
7
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
8
+ * their plain counterparts (`:`, `$`, `,`, `+`).
9
+ *
10
+ * @param {string} val The value to be encoded.
11
+ *
12
+ * @returns {string} The encoded value.
13
+ */
14
+ export function encode(val) {
15
+ return encodeURIComponent(val)
16
+ .replace(/%3A/gi, ':')
17
+ .replace(/%24/g, '$')
18
+ .replace(/%2C/gi, ',')
19
+ .replace(/%20/g, '+');
20
+ }
21
+
22
+ /**
23
+ * Build a URL by appending params to the end
24
+ *
25
+ * @param {string} url The base of the url (e.g., http://www.google.com)
26
+ * @param {object} [params] The params to be appended
27
+ * @param {?(object|Function)} options
28
+ *
29
+ * @returns {string} The formatted url
30
+ */
31
+ export default function buildURL(url, params, options) {
32
+ if (!params) {
33
+ return url;
34
+ }
35
+ url = url || '';
36
+
37
+ const _options = utils.isFunction(options)
38
+ ? {
39
+ serialize: options,
40
+ }
41
+ : options;
42
+
43
+ // Read serializer options pollution-safely: own properties and methods on a
44
+ // class/template prototype are honored, but values injected onto a polluted
45
+ // Object.prototype are ignored.
46
+ const _encode = utils.getSafeProp(_options, 'encode') || encode;
47
+ const serializeFn = utils.getSafeProp(_options, 'serialize');
48
+
49
+ let serializedParams;
50
+
51
+ if (serializeFn) {
52
+ serializedParams = serializeFn(params, _options);
53
+ } else {
54
+ serializedParams = utils.isURLSearchParams(params)
55
+ ? params.toString()
56
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
57
+ }
58
+
59
+ if (serializedParams) {
60
+ const hashmarkIndex = url.indexOf('#');
61
+
62
+ if (hashmarkIndex !== -1) {
63
+ url = url.slice(0, hashmarkIndex);
64
+ }
65
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
66
+ }
67
+
68
+ return url;
69
+ }
@@ -0,0 +1,18 @@
1
+ import utils from '../utils.js';
2
+
3
+ const callbackify = (fn, reducer) => {
4
+ return utils.isAsyncFn(fn)
5
+ ? function (...args) {
6
+ const cb = args.pop();
7
+ fn.apply(this, args).then((value) => {
8
+ try {
9
+ reducer ? cb(null, ...reducer(value)) : cb(null, value);
10
+ } catch (err) {
11
+ cb(err);
12
+ }
13
+ }, cb);
14
+ }
15
+ : fn;
16
+ };
17
+
18
+ export default callbackify;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Creates a new URL by combining the specified URLs
5
+ *
6
+ * @param {string} baseURL The base URL
7
+ * @param {string} relativeURL The relative URL
8
+ *
9
+ * @returns {string} The combined URL
10
+ */
11
+ export default function combineURLs(baseURL, relativeURL) {
12
+ if (!relativeURL) {
13
+ return baseURL;
14
+ }
15
+
16
+ let end = baseURL.length;
17
+
18
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
19
+ end--;
20
+ }
21
+
22
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
23
+ }
@@ -0,0 +1,68 @@
1
+ import CanceledError from '../cancel/CanceledError.js';
2
+ import AxiosError from '../core/AxiosError.js';
3
+ import utils from '../utils.js';
4
+
5
+ const composeSignals = (signals, timeout) => {
6
+ signals = signals ? signals.filter(Boolean) : [];
7
+
8
+ if (!timeout && !signals.length) {
9
+ return;
10
+ }
11
+
12
+ const controller = new AbortController();
13
+
14
+ let aborted = false;
15
+
16
+ const onabort = function (reason) {
17
+ if (!aborted) {
18
+ aborted = true;
19
+ unsubscribe();
20
+ const err = reason instanceof Error ? reason : this.reason;
21
+ controller.abort(
22
+ err instanceof AxiosError
23
+ ? err
24
+ : new CanceledError(err instanceof Error ? err.message : err)
25
+ );
26
+ }
27
+ };
28
+
29
+ let timer =
30
+ timeout &&
31
+ setTimeout(() => {
32
+ timer = null;
33
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
34
+ }, timeout);
35
+
36
+ const unsubscribe = () => {
37
+ if (!signals) { return; }
38
+ timer && clearTimeout(timer);
39
+ timer = null;
40
+ signals.forEach((signal) => {
41
+ signal.unsubscribe
42
+ ? signal.unsubscribe(onabort)
43
+ : signal.removeEventListener('abort', onabort);
44
+ });
45
+ signals = null;
46
+ };
47
+
48
+ signals.forEach((signal) => {
49
+ if (aborted) {
50
+ return;
51
+ }
52
+
53
+ if (signal.aborted) {
54
+ onabort.call(signal);
55
+ return;
56
+ }
57
+
58
+ signal.addEventListener('abort', onabort, { once: true });
59
+ });
60
+
61
+ const { signal } = controller;
62
+
63
+ signal.unsubscribe = () => utils.asap(unsubscribe);
64
+
65
+ return signal;
66
+ };
67
+
68
+ export default composeSignals;