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.
- package/CHANGELOG.md +16 -0
- package/WebDriverAgentMac/IntegrationTests/AMWindowTests.m +427 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Commands/AMWindowCommands.m +63 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Commands/FBDebugCommands.m +2 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Routing/FBCommandStatus.h +3 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Routing/FBCommandStatus.m +13 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMScreenUtils.h +4 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMScreenUtils.m +23 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMSnapshotUtils.h +18 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMSnapshotUtils.m +43 -28
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMWindowUtils.h +111 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMWindowUtils.m +780 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMXCTAccessibility.h +61 -0
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMXCTAccessibility.m +108 -0
- package/WebDriverAgentMac/WebDriverAgentMac.xcodeproj/project.pbxproj +20 -0
- package/build/lib/commands/native-record-screen.d.ts +2 -0
- package/build/lib/commands/native-record-screen.d.ts.map +1 -1
- package/build/lib/commands/native-record-screen.js.map +1 -1
- package/build/lib/commands/windows.d.ts +22 -0
- package/build/lib/commands/windows.d.ts.map +1 -0
- package/build/lib/commands/windows.js +32 -0
- package/build/lib/commands/windows.js.map +1 -0
- package/build/lib/driver.d.ts +12 -0
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +3 -0
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts +9 -0
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +9 -0
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/session-claim-handler.d.ts.map +1 -1
- package/build/lib/session-claim-handler.js +1 -2
- package/build/lib/session-claim-handler.js.map +1 -1
- package/build/lib/types.d.ts +26 -0
- package/build/lib/types.d.ts.map +1 -1
- package/build/lib/wda-mac.d.ts +0 -1
- package/build/lib/wda-mac.d.ts.map +1 -1
- package/build/lib/wda-mac.js +1 -1
- package/lib/commands/native-record-screen.ts +2 -0
- package/lib/commands/windows.ts +44 -0
- package/lib/driver.ts +4 -0
- package/lib/execute-method-map.ts +9 -0
- package/lib/session-claim-handler.ts +1 -2
- package/lib/types.ts +28 -0
- package/lib/wda-mac.ts +1 -2
- package/node_modules/@appium/support/build/lib/npm.d.ts.map +1 -1
- package/node_modules/@appium/support/build/lib/npm.js +2 -1
- package/node_modules/@appium/support/build/lib/npm.js.map +1 -1
- package/node_modules/@appium/support/build/lib/util.d.ts.map +1 -1
- package/node_modules/@appium/support/build/lib/util.js +13 -1
- package/node_modules/@appium/support/build/lib/util.js.map +1 -1
- package/node_modules/@appium/support/build/lib/zip.d.ts +2 -1
- package/node_modules/@appium/support/build/lib/zip.d.ts.map +1 -1
- package/node_modules/@appium/support/build/lib/zip.js +193 -64
- package/node_modules/@appium/support/build/lib/zip.js.map +1 -1
- package/node_modules/@appium/support/lib/npm.ts +2 -1
- package/node_modules/@appium/support/lib/util.ts +13 -1
- package/node_modules/@appium/support/lib/zip.ts +231 -71
- package/node_modules/@appium/support/node_modules/axios/CHANGELOG.md +1934 -0
- package/node_modules/@appium/support/node_modules/axios/LICENSE +7 -0
- package/node_modules/@appium/support/node_modules/axios/MIGRATION_GUIDE.md +877 -0
- package/node_modules/@appium/support/node_modules/axios/README.md +2851 -0
- package/node_modules/@appium/support/node_modules/axios/dist/axios.js +5807 -0
- package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js +5 -0
- package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js.map +1 -0
- package/node_modules/@appium/support/node_modules/axios/dist/browser/axios.cjs +5829 -0
- package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.js +5850 -0
- package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js +3 -0
- package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js.map +1 -0
- package/node_modules/@appium/support/node_modules/axios/dist/node/axios.cjs +6808 -0
- package/node_modules/@appium/support/node_modules/axios/index.d.cts +766 -0
- package/node_modules/@appium/support/node_modules/axios/index.d.ts +787 -0
- package/node_modules/@appium/support/node_modules/axios/index.js +45 -0
- package/node_modules/@appium/support/node_modules/axios/lib/adapters/README.md +36 -0
- package/node_modules/@appium/support/node_modules/axios/lib/adapters/adapters.js +132 -0
- package/node_modules/@appium/support/node_modules/axios/lib/adapters/fetch.js +696 -0
- package/node_modules/@appium/support/node_modules/axios/lib/adapters/http.js +1490 -0
- package/node_modules/@appium/support/node_modules/axios/lib/adapters/xhr.js +277 -0
- package/node_modules/@appium/support/node_modules/axios/lib/axios.js +89 -0
- package/node_modules/@appium/support/node_modules/axios/lib/cancel/CancelToken.js +135 -0
- package/node_modules/@appium/support/node_modules/axios/lib/cancel/CanceledError.js +22 -0
- package/node_modules/@appium/support/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/Axios.js +306 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosError.js +219 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/InterceptorManager.js +171 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/README.md +8 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/buildFullPath.js +76 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/dispatchRequest.js +95 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/mergeConfig.js +174 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/settle.js +27 -0
- package/node_modules/@appium/support/node_modules/axios/lib/core/transformData.js +28 -0
- package/node_modules/@appium/support/node_modules/axios/lib/defaults/index.js +178 -0
- package/node_modules/@appium/support/node_modules/axios/lib/defaults/transitional.js +10 -0
- package/node_modules/@appium/support/node_modules/axios/lib/env/README.md +3 -0
- package/node_modules/@appium/support/node_modules/axios/lib/env/classes/FormData.js +2 -0
- package/node_modules/@appium/support/node_modules/axios/lib/env/data.js +1 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/README.md +7 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/bind.js +14 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/buildURL.js +69 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/callbackify.js +18 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/combineURLs.js +23 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/composeSignals.js +68 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/cookies.js +64 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/null.js +2 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/readBlob.js +15 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/speedometer.js +55 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/spread.js +28 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/throttle.js +45 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/toFormData.js +279 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/trackStream.js +89 -0
- package/node_modules/@appium/support/node_modules/axios/lib/helpers/validator.js +112 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/index.js +13 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/common/utils.js +52 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/index.js +7 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/node_modules/@appium/support/node_modules/axios/lib/platform/node/index.js +37 -0
- package/node_modules/@appium/support/node_modules/axios/lib/utils.js +1150 -0
- package/node_modules/@appium/support/node_modules/axios/package.json +203 -0
- package/node_modules/@appium/support/package.json +6 -6
- package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts +6 -4
- package/node_modules/@appium/types/build/lib/commands/basedriver.d.ts.map +1 -1
- package/node_modules/@appium/types/lib/commands/basedriver.ts +4 -4
- package/node_modules/@appium/types/package.json +2 -2
- package/node_modules/appium-xcode/CHANGELOG.md +7 -0
- package/node_modules/appium-xcode/package.json +4 -4
- package/node_modules/asyncbox/README.md +43 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts +9 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js +35 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncfilter.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts +9 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncmap.js +23 -0
- package/node_modules/asyncbox/build/cjs/lib/asyncmap.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/errors.d.ts +9 -0
- package/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/errors.js +20 -0
- package/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/index.d.ts +12 -0
- package/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/index.js +24 -0
- package/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts +3 -0
- package/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/limit-function.js +15 -0
- package/node_modules/asyncbox/build/cjs/lib/limit-function.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/lock.d.ts +74 -0
- package/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/lock.js +295 -0
- package/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts +15 -0
- package/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/long-sleep.js +36 -0
- package/node_modules/asyncbox/build/cjs/lib/long-sleep.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/retry.d.ts +17 -0
- package/node_modules/asyncbox/build/cjs/lib/retry.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/retry.js +57 -0
- package/node_modules/asyncbox/build/cjs/lib/retry.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts +20 -0
- package/node_modules/asyncbox/build/cjs/lib/sleep.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/sleep.js +61 -0
- package/node_modules/asyncbox/build/cjs/lib/sleep.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +51 -0
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts +16 -0
- package/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/asyncbox/build/cjs/lib/with-timeout.js +45 -0
- package/node_modules/asyncbox/build/cjs/lib/with-timeout.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts +9 -0
- package/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/asyncfilter.js +32 -0
- package/node_modules/asyncbox/build/esm/lib/asyncfilter.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts +9 -0
- package/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/asyncmap.js +20 -0
- package/node_modules/asyncbox/build/esm/lib/asyncmap.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/errors.d.ts +9 -0
- package/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/errors.js +15 -0
- package/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/index.d.ts +12 -0
- package/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/index.js +10 -0
- package/node_modules/asyncbox/build/esm/lib/index.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts +3 -0
- package/node_modules/asyncbox/build/esm/lib/limit-function.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/limit-function.js +12 -0
- package/node_modules/asyncbox/build/esm/lib/limit-function.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/lock.d.ts +74 -0
- package/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/lock.js +291 -0
- package/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts +15 -0
- package/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/long-sleep.js +33 -0
- package/node_modules/asyncbox/build/esm/lib/long-sleep.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/retry.d.ts +17 -0
- package/node_modules/asyncbox/build/esm/lib/retry.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/retry.js +53 -0
- package/node_modules/asyncbox/build/esm/lib/retry.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/sleep.d.ts +20 -0
- package/node_modules/asyncbox/build/esm/lib/sleep.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/sleep.js +58 -0
- package/node_modules/asyncbox/build/esm/lib/sleep.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +48 -0
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts +16 -0
- package/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/asyncbox/build/esm/lib/with-timeout.js +42 -0
- package/node_modules/asyncbox/build/esm/lib/with-timeout.js.map +1 -0
- package/node_modules/asyncbox/lib/asyncfilter.ts +38 -0
- package/node_modules/asyncbox/lib/asyncmap.ts +29 -0
- package/node_modules/asyncbox/lib/errors.ts +15 -0
- package/node_modules/asyncbox/lib/index.ts +21 -0
- package/node_modules/asyncbox/lib/limit-function.ts +18 -0
- package/node_modules/asyncbox/lib/lock.ts +360 -0
- package/node_modules/asyncbox/lib/long-sleep.ts +38 -0
- package/node_modules/asyncbox/lib/retry.ts +61 -0
- package/node_modules/asyncbox/lib/sleep.ts +79 -0
- package/node_modules/asyncbox/lib/wait-for-condition.ts +52 -0
- package/node_modules/asyncbox/lib/with-timeout.ts +43 -0
- package/node_modules/asyncbox/package.json +8 -8
- package/node_modules/axios/README.md +41 -106
- package/node_modules/axios/dist/axios.js +931 -278
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +948 -268
- package/node_modules/axios/dist/esm/axios.js +948 -268
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +925 -242
- package/node_modules/axios/index.d.cts +20 -1
- package/node_modules/axios/index.d.ts +18 -1
- package/node_modules/axios/lib/adapters/fetch.js +73 -20
- package/node_modules/axios/lib/adapters/http.js +145 -26
- package/node_modules/axios/lib/adapters/xhr.js +120 -13
- package/node_modules/axios/lib/core/Axios.js +67 -12
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +13 -2
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +20 -0
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +2 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +8 -2
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +16 -3
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +16 -1
- package/node_modules/axios/lib/utils.js +61 -10
- package/node_modules/axios/package.json +1 -2
- package/node_modules/bare-url/README.md +4 -0
- package/node_modules/bare-url/index.d.ts +3 -0
- package/node_modules/bare-url/index.js +42 -18
- package/node_modules/bare-url/lib/errors.js +4 -0
- package/node_modules/bare-url/package.json +1 -1
- package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +1 -5
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/shell-quote/README.md +37 -4
- package/node_modules/shell-quote/package.json +10 -6
- package/node_modules/shell-quote/parse.d.ts +1 -1
- package/node_modules/shell-quote/parse.js +63 -11
- package/node_modules/shell-quote/quote.d.ts +2 -1
- package/node_modules/shell-quote/quote.js +23 -3
- package/node_modules/uuid/package.json +17 -17
- package/package.json +6 -7
- package/scripts/setup-accessibility.mjs +175 -0
- package/node_modules/async-lock/AUTHORS +0 -21
- package/node_modules/async-lock/History.md +0 -132
- package/node_modules/async-lock/LICENSE +0 -22
- package/node_modules/async-lock/README.md +0 -177
- package/node_modules/async-lock/index.js +0 -2
- package/node_modules/async-lock/lib/index.js +0 -312
- package/node_modules/async-lock/package.json +0 -48
- package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts +0 -103
- package/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts.map +0 -1
- package/node_modules/asyncbox/build/cjs/lib/asyncbox.js +0 -311
- package/node_modules/asyncbox/build/cjs/lib/asyncbox.js.map +0 -1
- package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts +0 -103
- package/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts.map +0 -1
- package/node_modules/asyncbox/build/esm/lib/asyncbox.js +0 -298
- package/node_modules/asyncbox/build/esm/lib/asyncbox.js.map +0 -1
- package/node_modules/asyncbox/lib/asyncbox.ts +0 -382
- package/node_modules/shell-quote/.nycrc +0 -14
- package/node_modules/shell-quote/eslint.config.mjs +0 -29
- package/node_modules/shell-quote/security.md +0 -11
- package/node_modules/shell-quote/test/comment.js +0 -16
- package/node_modules/shell-quote/test/env.js +0 -52
- package/node_modules/shell-quote/test/env_fn.js +0 -21
- package/node_modules/shell-quote/test/op.js +0 -102
- package/node_modules/shell-quote/test/parse.js +0 -149
- package/node_modules/shell-quote/test/quote.js +0 -145
- 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
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
|
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
|
-
|
|
275
|
-
|
|
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
|
|
68
|
-
secondNewlineIndex === -1 ?
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
|
116
|
+
const handlerId = normalizeHandlerId(id);
|
|
117
|
+
const entry = internals.handlerEntries.get(handlerId);
|
|
107
118
|
|
|
108
119
|
if (entry) {
|
|
109
|
-
internals.handlerEntries.delete(
|
|
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(
|