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
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# async-lock
|
|
2
|
-
|
|
3
|
-
Lock on asynchronous code
|
|
4
|
-
|
|
5
|
-
[](https://travis-ci.org/rogierschouten/async-lock)
|
|
6
|
-
|
|
7
|
-
* ES6 promise supported
|
|
8
|
-
* Multiple keys lock supported
|
|
9
|
-
* Timeout supported
|
|
10
|
-
* Occupation time limit supported
|
|
11
|
-
* Execution time limit supported
|
|
12
|
-
* Pending task limit supported
|
|
13
|
-
* Domain reentrant supported
|
|
14
|
-
* 100% code coverage
|
|
15
|
-
|
|
16
|
-
## Disclaimer
|
|
17
|
-
|
|
18
|
-
I did not create this package, and I will not add any features to it myself. I was granted the ownership because it was no longer being
|
|
19
|
-
maintained, and I volunteered to fix a bug.
|
|
20
|
-
|
|
21
|
-
If you have a new feature you would like to have incorporated, please send me a PR and I will be happy to work with you and get it merged.
|
|
22
|
-
For any bugs, PRs are most welcome but when possible I will try to get them resolved as soon as possible.
|
|
23
|
-
|
|
24
|
-
## Why do you need locking on single threaded nodejs?
|
|
25
|
-
|
|
26
|
-
Nodejs is single threaded, and the code execution never gets interrupted inside an event loop, so locking is unnecessary? This is true ONLY IF your critical section can be executed inside a single event loop.
|
|
27
|
-
However, if you have any async code inside your critical section (it can be simply triggered by any I/O operation, or timer), your critical logic will across multiple event loops, therefore it's not concurrency safe!
|
|
28
|
-
|
|
29
|
-
Consider the following code
|
|
30
|
-
```js
|
|
31
|
-
redis.get('key', function(err, value) {
|
|
32
|
-
redis.set('key', value * 2);
|
|
33
|
-
});
|
|
34
|
-
```
|
|
35
|
-
The above code simply multiply a redis key by 2.
|
|
36
|
-
However, if two users run concurrently, the execution order may like this
|
|
37
|
-
```
|
|
38
|
-
user1: redis.get('key') -> 1
|
|
39
|
-
user2: redis.get('key') -> 1
|
|
40
|
-
user1: redis.set('key', 1 x 2) -> 2
|
|
41
|
-
user2: redis.set('key', 1 x 2) -> 2
|
|
42
|
-
```
|
|
43
|
-
Obviously it's not what you expected
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
With asyncLock, you can easily write your async critical section
|
|
47
|
-
```js
|
|
48
|
-
lock.acquire('key', function(cb) {
|
|
49
|
-
// Concurrency safe
|
|
50
|
-
redis.get('key', function(err, value) {
|
|
51
|
-
redis.set('key', value * 2, cb);
|
|
52
|
-
});
|
|
53
|
-
}, function(err, ret) {
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Get Started
|
|
58
|
-
|
|
59
|
-
```js
|
|
60
|
-
var AsyncLock = require('async-lock');
|
|
61
|
-
var lock = new AsyncLock();
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @param {String|Array} key resource key or keys to lock
|
|
65
|
-
* @param {function} fn execute function
|
|
66
|
-
* @param {function} cb (optional) callback function, otherwise will return a promise
|
|
67
|
-
* @param {Object} opts (optional) options
|
|
68
|
-
*/
|
|
69
|
-
lock.acquire(key, function(done) {
|
|
70
|
-
// async work
|
|
71
|
-
done(err, ret);
|
|
72
|
-
}, function(err, ret) {
|
|
73
|
-
// lock released
|
|
74
|
-
}, opts);
|
|
75
|
-
|
|
76
|
-
// Promise mode
|
|
77
|
-
lock.acquire(key, function() {
|
|
78
|
-
// return value or promise
|
|
79
|
-
}, opts).then(function() {
|
|
80
|
-
// lock released
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Error Handling
|
|
85
|
-
|
|
86
|
-
```js
|
|
87
|
-
// Callback mode
|
|
88
|
-
lock.acquire(key, function(done) {
|
|
89
|
-
done(new Error('error'));
|
|
90
|
-
}, function(err, ret) {
|
|
91
|
-
console.log(err.message) // output: error
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Promise mode
|
|
95
|
-
lock.acquire(key, function() {
|
|
96
|
-
throw new Error('error');
|
|
97
|
-
}).catch(function(err) {
|
|
98
|
-
console.log(err.message) // output: error
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Acquire multiple keys
|
|
103
|
-
|
|
104
|
-
```js
|
|
105
|
-
lock.acquire([key1, key2], fn, cb);
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Domain reentrant lock
|
|
109
|
-
|
|
110
|
-
Lock is reentrant in the same domain
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
var domain = require('domain');
|
|
114
|
-
var lock = new AsyncLock({domainReentrant : true});
|
|
115
|
-
|
|
116
|
-
var d = domain.create();
|
|
117
|
-
d.run(function() {
|
|
118
|
-
lock.acquire('key', function() {
|
|
119
|
-
//Enter lock
|
|
120
|
-
return lock.acquire('key', function() {
|
|
121
|
-
//Enter same lock twice
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Options
|
|
128
|
-
|
|
129
|
-
```js
|
|
130
|
-
// Specify timeout - max amount of time an item can remain in the queue before acquiring the lock
|
|
131
|
-
var lock = new AsyncLock({timeout: 5000});
|
|
132
|
-
lock.acquire(key, fn, function(err, ret) {
|
|
133
|
-
// timed out error will be returned here if lock not acquired in given time
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// Specify max occupation time - max amount of time allowed between entering the queue and completing execution
|
|
137
|
-
var lock = new AsyncLock({maxOccupationTime: 3000});
|
|
138
|
-
lock.acquire(key, fn, function(err, ret) {
|
|
139
|
-
// occupation time exceeded error will be returned here if job not completed in given time
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// Specify max execution time - max amount of time allowed between acquiring the lock and completing execution
|
|
143
|
-
var lock = new AsyncLock({maxExecutionTime: 3000});
|
|
144
|
-
lock.acquire(key, fn, function(err, ret) {
|
|
145
|
-
// execution time exceeded error will be returned here if job not completed in given time
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Set max pending tasks - max number of tasks allowed in the queue at a time
|
|
149
|
-
var lock = new AsyncLock({maxPending: 1000});
|
|
150
|
-
lock.acquire(key, fn, function(err, ret) {
|
|
151
|
-
// Handle too much pending error
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
// Whether there is any running or pending async function
|
|
155
|
-
lock.isBusy();
|
|
156
|
-
|
|
157
|
-
// Use your own promise library instead of the global Promise variable
|
|
158
|
-
var lock = new AsyncLock({Promise: require('bluebird')}); // Bluebird
|
|
159
|
-
var lock = new AsyncLock({Promise: require('q')}); // Q
|
|
160
|
-
|
|
161
|
-
// Add a task to the front of the queue waiting for a given lock
|
|
162
|
-
lock.acquire(key, fn1, cb); // runs immediately
|
|
163
|
-
lock.acquire(key, fn2, cb); // added to queue
|
|
164
|
-
lock.acquire(key, priorityFn, cb, {skipQueue: true}); // jumps queue and runs before fn2
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Changelog
|
|
168
|
-
|
|
169
|
-
See [Changelog](./History.md)
|
|
170
|
-
|
|
171
|
-
## Issues
|
|
172
|
-
|
|
173
|
-
See [issue tracker](https://github.com/rogierschouten/async-lock/issues).
|
|
174
|
-
|
|
175
|
-
## License
|
|
176
|
-
|
|
177
|
-
MIT, see [LICENSE](./LICENSE)
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var AsyncLock = function (opts) {
|
|
4
|
-
opts = opts || {};
|
|
5
|
-
|
|
6
|
-
this.Promise = opts.Promise || Promise;
|
|
7
|
-
|
|
8
|
-
// format: {key : [fn, fn]}
|
|
9
|
-
// queues[key] = null indicates no job running for key
|
|
10
|
-
this.queues = Object.create(null);
|
|
11
|
-
|
|
12
|
-
// lock is reentrant for same domain
|
|
13
|
-
this.domainReentrant = opts.domainReentrant || false;
|
|
14
|
-
if (this.domainReentrant) {
|
|
15
|
-
if (typeof process === 'undefined' || typeof process.domain === 'undefined') {
|
|
16
|
-
throw new Error(
|
|
17
|
-
'Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, ' +
|
|
18
|
-
'use a NodeJS version that still implements Domain, or install a browser polyfill.');
|
|
19
|
-
}
|
|
20
|
-
// domain of current running func {key : fn}
|
|
21
|
-
this.domains = Object.create(null);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this.timeout = opts.timeout || AsyncLock.DEFAULT_TIMEOUT;
|
|
25
|
-
this.maxOccupationTime = opts.maxOccupationTime || AsyncLock.DEFAULT_MAX_OCCUPATION_TIME;
|
|
26
|
-
this.maxExecutionTime = opts.maxExecutionTime || AsyncLock.DEFAULT_MAX_EXECUTION_TIME;
|
|
27
|
-
if (opts.maxPending === Infinity || (Number.isInteger(opts.maxPending) && opts.maxPending >= 0)) {
|
|
28
|
-
this.maxPending = opts.maxPending;
|
|
29
|
-
} else {
|
|
30
|
-
this.maxPending = AsyncLock.DEFAULT_MAX_PENDING;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
AsyncLock.DEFAULT_TIMEOUT = 0; //Never
|
|
35
|
-
AsyncLock.DEFAULT_MAX_OCCUPATION_TIME = 0; //Never
|
|
36
|
-
AsyncLock.DEFAULT_MAX_EXECUTION_TIME = 0; //Never
|
|
37
|
-
AsyncLock.DEFAULT_MAX_PENDING = 1000;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Acquire Locks
|
|
41
|
-
*
|
|
42
|
-
* @param {String|Array} key resource key or keys to lock
|
|
43
|
-
* @param {function} fn async function
|
|
44
|
-
* @param {function} cb callback function, otherwise will return a promise
|
|
45
|
-
* @param {Object} opts options
|
|
46
|
-
*/
|
|
47
|
-
AsyncLock.prototype.acquire = function (key, fn, cb, opts) {
|
|
48
|
-
if (Array.isArray(key)) {
|
|
49
|
-
return this._acquireBatch(key, fn, cb, opts);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (typeof (fn) !== 'function') {
|
|
53
|
-
throw new Error('You must pass a function to execute');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// faux-deferred promise using new Promise() (as Promise.defer is deprecated)
|
|
57
|
-
var deferredResolve = null;
|
|
58
|
-
var deferredReject = null;
|
|
59
|
-
var deferred = null;
|
|
60
|
-
|
|
61
|
-
if (typeof (cb) !== 'function') {
|
|
62
|
-
opts = cb;
|
|
63
|
-
cb = null;
|
|
64
|
-
|
|
65
|
-
// will return a promise
|
|
66
|
-
deferred = new this.Promise(function(resolve, reject) {
|
|
67
|
-
deferredResolve = resolve;
|
|
68
|
-
deferredReject = reject;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
opts = opts || {};
|
|
73
|
-
|
|
74
|
-
var resolved = false;
|
|
75
|
-
var timer = null;
|
|
76
|
-
var occupationTimer = null;
|
|
77
|
-
var executionTimer = null;
|
|
78
|
-
var self = this;
|
|
79
|
-
|
|
80
|
-
var done = function (locked, err, ret) {
|
|
81
|
-
|
|
82
|
-
if (occupationTimer) {
|
|
83
|
-
clearTimeout(occupationTimer);
|
|
84
|
-
occupationTimer = null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (executionTimer) {
|
|
88
|
-
clearTimeout(executionTimer);
|
|
89
|
-
executionTimer = null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (locked) {
|
|
93
|
-
if (!!self.queues[key] && self.queues[key].length === 0) {
|
|
94
|
-
delete self.queues[key];
|
|
95
|
-
}
|
|
96
|
-
if (self.domainReentrant) {
|
|
97
|
-
delete self.domains[key];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!resolved) {
|
|
102
|
-
if (!deferred) {
|
|
103
|
-
if (typeof (cb) === 'function') {
|
|
104
|
-
cb(err, ret);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
//promise mode
|
|
109
|
-
if (err) {
|
|
110
|
-
deferredReject(err);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
deferredResolve(ret);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
resolved = true;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (locked) {
|
|
120
|
-
//run next func
|
|
121
|
-
if (!!self.queues[key] && self.queues[key].length > 0) {
|
|
122
|
-
self.queues[key].shift()();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
var exec = function (locked) {
|
|
128
|
-
if (resolved) { // may due to timed out
|
|
129
|
-
return done(locked);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (timer) {
|
|
133
|
-
clearTimeout(timer);
|
|
134
|
-
timer = null;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (self.domainReentrant && locked) {
|
|
138
|
-
self.domains[key] = process.domain;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
var maxExecutionTime = opts.maxExecutionTime || self.maxExecutionTime;
|
|
142
|
-
if (maxExecutionTime) {
|
|
143
|
-
executionTimer = setTimeout(function () {
|
|
144
|
-
if (!!self.queues[key]) {
|
|
145
|
-
done(locked, new Error('Maximum execution time is exceeded ' + key));
|
|
146
|
-
}
|
|
147
|
-
}, maxExecutionTime);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Callback mode
|
|
151
|
-
if (fn.length === 1) {
|
|
152
|
-
var called = false;
|
|
153
|
-
try {
|
|
154
|
-
fn(function (err, ret) {
|
|
155
|
-
if (!called) {
|
|
156
|
-
called = true;
|
|
157
|
-
done(locked, err, ret);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
} catch (err) {
|
|
161
|
-
// catching error thrown in user function fn
|
|
162
|
-
if (!called) {
|
|
163
|
-
called = true;
|
|
164
|
-
done(locked, err);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// Promise mode
|
|
170
|
-
self._promiseTry(function () {
|
|
171
|
-
return fn();
|
|
172
|
-
})
|
|
173
|
-
.then(function(ret){
|
|
174
|
-
done(locked, undefined, ret);
|
|
175
|
-
}, function(error){
|
|
176
|
-
done(locked, error);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
if (self.domainReentrant && !!process.domain) {
|
|
182
|
-
exec = process.domain.bind(exec);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
var maxPending = opts.maxPending || self.maxPending;
|
|
186
|
-
|
|
187
|
-
if (!self.queues[key]) {
|
|
188
|
-
self.queues[key] = [];
|
|
189
|
-
exec(true);
|
|
190
|
-
}
|
|
191
|
-
else if (self.domainReentrant && !!process.domain && process.domain === self.domains[key]) {
|
|
192
|
-
// If code is in the same domain of current running task, run it directly
|
|
193
|
-
// Since lock is re-enterable
|
|
194
|
-
exec(false);
|
|
195
|
-
}
|
|
196
|
-
else if (self.queues[key].length >= maxPending) {
|
|
197
|
-
done(false, new Error('Too many pending tasks in queue ' + key));
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
var taskFn = function () {
|
|
201
|
-
exec(true);
|
|
202
|
-
};
|
|
203
|
-
if (opts.skipQueue) {
|
|
204
|
-
self.queues[key].unshift(taskFn);
|
|
205
|
-
} else {
|
|
206
|
-
self.queues[key].push(taskFn);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
var timeout = opts.timeout || self.timeout;
|
|
210
|
-
if (timeout) {
|
|
211
|
-
timer = setTimeout(function () {
|
|
212
|
-
timer = null;
|
|
213
|
-
done(false, new Error('async-lock timed out in queue ' + key));
|
|
214
|
-
}, timeout);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
var maxOccupationTime = opts.maxOccupationTime || self.maxOccupationTime;
|
|
219
|
-
if (maxOccupationTime) {
|
|
220
|
-
occupationTimer = setTimeout(function () {
|
|
221
|
-
if (!!self.queues[key]) {
|
|
222
|
-
done(false, new Error('Maximum occupation time is exceeded in queue ' + key));
|
|
223
|
-
}
|
|
224
|
-
}, maxOccupationTime);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (deferred) {
|
|
228
|
-
return deferred;
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
/*
|
|
233
|
-
* Below is how this function works:
|
|
234
|
-
*
|
|
235
|
-
* Equivalent code:
|
|
236
|
-
* self.acquire(key1, function(cb){
|
|
237
|
-
* self.acquire(key2, function(cb){
|
|
238
|
-
* self.acquire(key3, fn, cb);
|
|
239
|
-
* }, cb);
|
|
240
|
-
* }, cb);
|
|
241
|
-
*
|
|
242
|
-
* Equivalent code:
|
|
243
|
-
* var fn3 = getFn(key3, fn);
|
|
244
|
-
* var fn2 = getFn(key2, fn3);
|
|
245
|
-
* var fn1 = getFn(key1, fn2);
|
|
246
|
-
* fn1(cb);
|
|
247
|
-
*/
|
|
248
|
-
AsyncLock.prototype._acquireBatch = function (keys, fn, cb, opts) {
|
|
249
|
-
if (typeof (cb) !== 'function') {
|
|
250
|
-
opts = cb;
|
|
251
|
-
cb = null;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var self = this;
|
|
255
|
-
var getFn = function (key, fn) {
|
|
256
|
-
return function (cb) {
|
|
257
|
-
self.acquire(key, fn, cb, opts);
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
var fnx = keys.reduceRight(function (prev, key) {
|
|
262
|
-
return getFn(key, prev);
|
|
263
|
-
}, fn);
|
|
264
|
-
|
|
265
|
-
if (typeof (cb) === 'function') {
|
|
266
|
-
fnx(cb);
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
return new this.Promise(function (resolve, reject) {
|
|
270
|
-
// check for promise mode in case keys is empty array
|
|
271
|
-
if (fnx.length === 1) {
|
|
272
|
-
fnx(function (err, ret) {
|
|
273
|
-
if (err) {
|
|
274
|
-
reject(err);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
resolve(ret);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
} else {
|
|
281
|
-
resolve(fnx());
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
/*
|
|
288
|
-
* Whether there is any running or pending asyncFunc
|
|
289
|
-
*
|
|
290
|
-
* @param {String} key
|
|
291
|
-
*/
|
|
292
|
-
AsyncLock.prototype.isBusy = function (key) {
|
|
293
|
-
if (!key) {
|
|
294
|
-
return Object.keys(this.queues).length > 0;
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
return !!this.queues[key];
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Promise.try() implementation to become independent of Q-specific methods
|
|
303
|
-
*/
|
|
304
|
-
AsyncLock.prototype._promiseTry = function(fn) {
|
|
305
|
-
try {
|
|
306
|
-
return this.Promise.resolve(fn());
|
|
307
|
-
} catch (e) {
|
|
308
|
-
return this.Promise.reject(e);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
module.exports = AsyncLock;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "async-lock",
|
|
3
|
-
"description": "Lock on asynchronous code",
|
|
4
|
-
"version": "1.4.1",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Rogier Schouten",
|
|
7
|
-
"url": "https://github.com/rogierschouten/",
|
|
8
|
-
"email": "github@workingcode.ninja"
|
|
9
|
-
},
|
|
10
|
-
"private": false,
|
|
11
|
-
"homepage": "https://github.com/rogierschouten/async-lock",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/rogierschouten/async-lock.git"
|
|
15
|
-
},
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/rogierschouten/async-lock/issues"
|
|
18
|
-
},
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"keywords": [
|
|
21
|
-
"lock",
|
|
22
|
-
"async",
|
|
23
|
-
"concurrency",
|
|
24
|
-
"critical",
|
|
25
|
-
"section",
|
|
26
|
-
"mutex"
|
|
27
|
-
],
|
|
28
|
-
"engines": {},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"start": "grunt",
|
|
31
|
-
"test": "grunt test"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"bluebird": "^3.5.1",
|
|
35
|
-
"grunt": "^1.0.4",
|
|
36
|
-
"grunt-cli": "^1.2.0",
|
|
37
|
-
"grunt-contrib-clean": "^1.1.0",
|
|
38
|
-
"grunt-contrib-jshint": "^3.2.0",
|
|
39
|
-
"grunt-contrib-watch": "^1.1.0",
|
|
40
|
-
"grunt-env": "^1.0.1",
|
|
41
|
-
"grunt-mocha-test": "^0.13.3",
|
|
42
|
-
"load-grunt-tasks": "^4.0.0",
|
|
43
|
-
"lodash": "^4.17.20",
|
|
44
|
-
"mocha": "^10.2.0",
|
|
45
|
-
"q": "^1.5.1",
|
|
46
|
-
"should": "^13.2.1"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { CancellablePromise, LongSleepOptions, MapFilterOptions, SleepOptions, WaitForConditionOptions } from './types.js';
|
|
2
|
-
/** Error thrown by {@link withTimeout} when the deadline is exceeded. */
|
|
3
|
-
export declare class TimeoutError extends Error {
|
|
4
|
-
constructor(message?: string);
|
|
5
|
-
}
|
|
6
|
-
/** Thrown when a promise is cancelled via `cancel`. */
|
|
7
|
-
export declare class PromiseCancellationError extends Error {
|
|
8
|
-
constructor(message?: string);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* An async/await version of `setTimeout`. The returned promise has a `cancel()` method that clears
|
|
12
|
-
* the timer and usually rejects with {@link PromiseCancellationError} unless you use the object form with
|
|
13
|
-
* `cancelError: null` to resolve on cancel.
|
|
14
|
-
*
|
|
15
|
-
* @param ms - Milliseconds to wait
|
|
16
|
-
* @returns A thenable you can `await`; call `.cancel()` to abort early.
|
|
17
|
-
*/
|
|
18
|
-
export declare function sleep(ms: number): CancellablePromise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Object form: `ms` plus optional `cancelError` (non-empty string or `Error`, `null` to resolve on
|
|
21
|
-
* cancel, or omitted / `undefined` / `''` for default {@link PromiseCancellationError}). Any non-array
|
|
22
|
-
* object with a finite `ms` is accepted at runtime (including class instances), matching structural typing.
|
|
23
|
-
*
|
|
24
|
-
* @param options - Duration and optional cancellation behavior
|
|
25
|
-
* @returns A thenable you can `await`; call `.cancel()` to abort early.
|
|
26
|
-
*/
|
|
27
|
-
export declare function sleep(options: SleepOptions): CancellablePromise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Resolves with `promise` or rejects if it does not settle before `timeoutMs`.
|
|
30
|
-
*
|
|
31
|
-
* If the deadline passes first: with no third argument (or a falsy non-error value), rejects
|
|
32
|
-
* with {@link TimeoutError} whose message includes `timeoutMs`; with a non-empty string,
|
|
33
|
-
* rejects with {@link TimeoutError} using that message; with an `Error` instance, rejects
|
|
34
|
-
* with that same instance.
|
|
35
|
-
*
|
|
36
|
-
* @param promise - Promise to race against the timeout.
|
|
37
|
-
* @param timeoutMs - Maximum time in milliseconds before rejecting if `promise` has not settled.
|
|
38
|
-
* @param messageOrError - Optional override for the timeout rejection: custom {@link TimeoutError}
|
|
39
|
-
* message when the string is non-empty, or an existing `Error` to reject with verbatim.
|
|
40
|
-
* Omitted, `undefined`, or other falsy non-error values use the default timeout message (includes `timeoutMs`).
|
|
41
|
-
*/
|
|
42
|
-
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, messageOrError?: string | Error): Promise<T>;
|
|
43
|
-
/**
|
|
44
|
-
* Sometimes `Promise.delay` or `setTimeout` are inaccurate for large wait
|
|
45
|
-
* times. To safely wait for these long times (e.g. in the 5+ minute range), you
|
|
46
|
-
* can use `longSleep`.
|
|
47
|
-
*
|
|
48
|
-
* You can also pass a `progressCb` option which is a callback function that
|
|
49
|
-
* receives an object with the properties `elapsedMs`, `timeLeft`, and
|
|
50
|
-
* `progress`. This will be called on every wait interval so you can do your
|
|
51
|
-
* wait logging or whatever.
|
|
52
|
-
* @param ms - The number of milliseconds to wait
|
|
53
|
-
* @param options - Options for controlling the long sleep behavior
|
|
54
|
-
*/
|
|
55
|
-
export declare function longSleep(ms: number, { thresholdMs, intervalMs, progressCb }?: LongSleepOptions): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* An async/await way of running a method until it doesn't throw an error
|
|
58
|
-
* @param times - The maximum number of times to retry the function
|
|
59
|
-
* @param fn - The async function to retry
|
|
60
|
-
* @param args - Arguments to pass to the function
|
|
61
|
-
*/
|
|
62
|
-
export declare function retry<T = any>(times: number, fn: (...args: any[]) => Promise<T>, ...args: any[]): Promise<T | null>;
|
|
63
|
-
/**
|
|
64
|
-
* You can also use `retryInterval` to add a sleep in between retries. This can
|
|
65
|
-
* be useful if you want to throttle how fast we retry.
|
|
66
|
-
* @param times - The maximum number of times to retry the function
|
|
67
|
-
* @param sleepMs - The number of milliseconds to wait between retries
|
|
68
|
-
* @param fn - The async function to retry
|
|
69
|
-
* @param args - Arguments to pass to the function
|
|
70
|
-
*/
|
|
71
|
-
export declare function retryInterval<T = any>(times: number, sleepMs: number, fn: (...args: any[]) => Promise<T>, ...args: any[]): Promise<T | null>;
|
|
72
|
-
/**
|
|
73
|
-
* Similar to `Array.prototype.map`; runs in parallel, serial, or with custom concurrency pool
|
|
74
|
-
* @param coll - The collection to map over
|
|
75
|
-
* @param mapper - The function to apply to each element
|
|
76
|
-
* @param options - Options for controlling parallelism (default: true - fully parallel)
|
|
77
|
-
*/
|
|
78
|
-
export declare function asyncmap<T, R>(coll: T[], mapper: (value: T) => R | Promise<R>, options?: MapFilterOptions): Promise<R[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Similar to `Array.prototype.filter`; runs in parallel, serial, or with custom concurrency pool
|
|
81
|
-
* @param coll - The collection to filter
|
|
82
|
-
* @param filter - The function to test each element
|
|
83
|
-
* @param options - Options for controlling parallelism (default: true - fully parallel)
|
|
84
|
-
*/
|
|
85
|
-
export declare function asyncfilter<T>(coll: T[], filter: (value: T) => boolean | Promise<boolean>, options?: MapFilterOptions): Promise<T[]>;
|
|
86
|
-
/**
|
|
87
|
-
* Takes a condition (a function returning a boolean or boolean promise), and
|
|
88
|
-
* waits until the condition is true.
|
|
89
|
-
*
|
|
90
|
-
* Throws a `/Condition unmet/` error if the condition has not been satisfied
|
|
91
|
-
* within the allocated time, unless an error is provided in the options, as the
|
|
92
|
-
* `error` property, which is either thrown itself, or used as the message.
|
|
93
|
-
*
|
|
94
|
-
* The condition result is returned if it is not falsy. If the condition throws an
|
|
95
|
-
* error then this exception will be immediately passed through.
|
|
96
|
-
*
|
|
97
|
-
* The default options are: `{ waitMs: 5000, intervalMs: 500 }`
|
|
98
|
-
* @param condFn - The condition function to evaluate
|
|
99
|
-
* @param options - Options for controlling the wait behavior
|
|
100
|
-
*/
|
|
101
|
-
export declare function waitForCondition<T>(condFn: () => Promise<T> | T, options?: WaitForConditionOptions): Promise<T>;
|
|
102
|
-
export type { CancellablePromise, Progress, ProgressCallback, LongSleepOptions, SleepArg, SleepOptions, WaitForConditionOptions, } from './types.js';
|
|
103
|
-
//# sourceMappingURL=asyncbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asyncbox.d.ts","sourceRoot":"","sources":["../../../lib/asyncbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAEhB,YAAY,EACZ,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAepB,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED,uDAAuD;AACvD,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,GAAE,MAA4B;CAIlD;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC5D;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAsCvE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,GAC9B,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAC7B,EAAE,EAAE,MAAM,EACV,EAAC,WAAkC,EAAE,UAAiB,EAAE,UAAiB,EAAC,GAAE,gBAAqB,GAChG,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,CAAC,GAAG,GAAG,EACjC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAClC,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAgBnB;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,CAAC,GAAG,GAAG,EACzC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAClC,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAiBnB;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EACjC,IAAI,EAAE,CAAC,EAAE,EACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACpC,OAAO,GAAE,gBAAuB,GAC/B,OAAO,CAAC,CAAC,EAAE,CAAC,CAed;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,CAAC,EAAE,EACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAChD,OAAO,GAAE,gBAAuB,GAC/B,OAAO,CAAC,CAAC,EAAE,CAAC,CAwBd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC5B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CA8BZ;AAGD,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|