appium-mac2-driver 4.6.0 → 4.6.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 +6 -0
- package/WebDriverAgentMac/WebDriverAgentRunner/WebDriverAgentRunner.m +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/README.md +258 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncfilter.js +35 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncfilter.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncmap.js +23 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/asyncmap.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/errors.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/errors.js +20 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/index.d.ts +12 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/index.js +24 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/limit-function.js +15 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/limit-function.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/lock.d.ts +74 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/lock.js +295 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts +15 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/long-sleep.js +36 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/long-sleep.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/retry.d.ts +17 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/retry.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/retry.js +57 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/retry.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/sleep.d.ts +20 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/sleep.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/sleep.js +61 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/sleep.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/types.d.ts +84 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/types.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/types.js +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/types.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +51 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts +16 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/with-timeout.js +45 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/lib/with-timeout.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/cjs/package.json +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncfilter.js +32 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncfilter.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncmap.js +20 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/asyncmap.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/errors.d.ts +9 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/errors.js +15 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/index.d.ts +12 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/index.js +10 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/index.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/limit-function.d.ts +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/limit-function.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/limit-function.js +12 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/limit-function.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/lock.d.ts +74 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/lock.js +291 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts +15 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/long-sleep.js +33 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/long-sleep.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/retry.d.ts +17 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/retry.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/retry.js +53 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/retry.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/sleep.d.ts +20 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/sleep.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/sleep.js +58 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/sleep.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/types.d.ts +84 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/types.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/types.js +2 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/types.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +48 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts +16 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/with-timeout.js +42 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/lib/with-timeout.js.map +1 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/build/esm/package.json +3 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/asyncfilter.ts +38 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/asyncmap.ts +29 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/errors.ts +15 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/index.ts +21 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/limit-function.ts +18 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/lock.ts +360 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/long-sleep.ts +38 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/retry.ts +61 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/sleep.ts +79 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/types.ts +88 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/wait-for-condition.ts +52 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/lib/with-timeout.ts +43 -0
- package/node_modules/@appium/base-driver/node_modules/asyncbox/package.json +74 -0
- package/node_modules/@appium/support/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/@appium/support/node_modules/asyncbox/README.md +258 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncfilter.js +35 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncfilter.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncmap.js +23 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncmap.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/errors.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/errors.js +20 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/index.d.ts +12 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/index.js +24 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts +3 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/limit-function.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/limit-function.js +15 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/limit-function.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/lock.d.ts +74 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/lock.js +295 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts +15 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/long-sleep.js +36 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/long-sleep.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/retry.d.ts +17 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/retry.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/retry.js +57 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/retry.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/sleep.d.ts +20 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/sleep.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/sleep.js +61 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/sleep.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.d.ts +84 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.js +3 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +51 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts +16 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/with-timeout.js +45 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/with-timeout.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/package.json +3 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncfilter.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncfilter.js +32 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncfilter.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncmap.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncmap.js +20 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncmap.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/errors.d.ts +9 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/errors.js +15 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/index.d.ts +12 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/index.js +10 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/index.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/limit-function.d.ts +3 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/limit-function.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/limit-function.js +12 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/limit-function.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/lock.d.ts +74 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/lock.js +291 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts +15 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/long-sleep.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/long-sleep.js +33 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/long-sleep.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/retry.d.ts +17 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/retry.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/retry.js +53 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/retry.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/sleep.d.ts +20 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/sleep.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/sleep.js +58 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/sleep.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.d.ts +84 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.js +2 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +18 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +48 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts +16 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/with-timeout.d.ts.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/with-timeout.js +42 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/with-timeout.js.map +1 -0
- package/node_modules/@appium/support/node_modules/asyncbox/build/esm/package.json +3 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/asyncfilter.ts +38 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/asyncmap.ts +29 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/errors.ts +15 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/index.ts +21 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/limit-function.ts +18 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/lock.ts +360 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/long-sleep.ts +38 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/retry.ts +61 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/sleep.ts +79 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/types.ts +88 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/wait-for-condition.ts +52 -0
- package/node_modules/@appium/support/node_modules/asyncbox/lib/with-timeout.ts +43 -0
- package/node_modules/@appium/support/node_modules/asyncbox/package.json +74 -0
- package/node_modules/asyncbox/README.md +18 -4
- package/node_modules/asyncbox/build/cjs/lib/errors.d.ts +20 -2
- package/node_modules/asyncbox/build/cjs/lib/errors.d.ts.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/errors.js +41 -6
- package/node_modules/asyncbox/build/cjs/lib/errors.js.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/index.d.ts +1 -1
- package/node_modules/asyncbox/build/cjs/lib/index.d.ts.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/index.js +5 -1
- package/node_modules/asyncbox/build/cjs/lib/index.js.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/lock.d.ts.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/lock.js +6 -5
- package/node_modules/asyncbox/build/cjs/lib/lock.js.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts +1 -1
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.d.ts.map +1 -1
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js +4 -3
- package/node_modules/asyncbox/build/cjs/lib/wait-for-condition.js.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/errors.d.ts +20 -2
- package/node_modules/asyncbox/build/esm/lib/errors.d.ts.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/errors.js +36 -5
- package/node_modules/asyncbox/build/esm/lib/errors.js.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/index.d.ts +1 -1
- package/node_modules/asyncbox/build/esm/lib/index.d.ts.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/index.js +1 -1
- package/node_modules/asyncbox/build/esm/lib/index.js.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/lock.d.ts.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/lock.js +6 -5
- package/node_modules/asyncbox/build/esm/lib/lock.js.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts +1 -1
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.d.ts.map +1 -1
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js +4 -3
- package/node_modules/asyncbox/build/esm/lib/wait-for-condition.js.map +1 -1
- package/node_modules/asyncbox/lib/errors.ts +41 -5
- package/node_modules/asyncbox/lib/index.ts +8 -1
- package/node_modules/asyncbox/lib/lock.ts +7 -5
- package/node_modules/asyncbox/lib/wait-for-condition.ts +4 -3
- package/node_modules/asyncbox/package.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {sleep} from './sleep.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An async/await way of running a method until it doesn't throw an error
|
|
5
|
+
* @param times - The maximum number of times to retry the function
|
|
6
|
+
* @param fn - The async function to retry
|
|
7
|
+
* @param args - Arguments to pass to the function
|
|
8
|
+
*/
|
|
9
|
+
export async function retry<T = any>(
|
|
10
|
+
times: number,
|
|
11
|
+
fn: (...args: any[]) => Promise<T>,
|
|
12
|
+
...args: any[]
|
|
13
|
+
): Promise<T | null> {
|
|
14
|
+
let tries = 0;
|
|
15
|
+
let done = false;
|
|
16
|
+
let res: T | null = null;
|
|
17
|
+
while (!done && tries < times) {
|
|
18
|
+
tries++;
|
|
19
|
+
try {
|
|
20
|
+
res = await fn(...args);
|
|
21
|
+
done = true;
|
|
22
|
+
} catch (err) {
|
|
23
|
+
if (tries >= times) {
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* You can also use `retryInterval` to add a sleep in between retries. This can
|
|
33
|
+
* be useful if you want to throttle how fast we retry.
|
|
34
|
+
* @param times - The maximum number of times to retry the function
|
|
35
|
+
* @param sleepMs - The number of milliseconds to wait between retries
|
|
36
|
+
* @param fn - The async function to retry
|
|
37
|
+
* @param args - Arguments to pass to the function
|
|
38
|
+
*/
|
|
39
|
+
export async function retryInterval<T = any>(
|
|
40
|
+
times: number,
|
|
41
|
+
sleepMs: number,
|
|
42
|
+
fn: (...args: any[]) => Promise<T>,
|
|
43
|
+
...args: any[]
|
|
44
|
+
): Promise<T | null> {
|
|
45
|
+
let count = 0;
|
|
46
|
+
const wrapped = async (): Promise<T> => {
|
|
47
|
+
count++;
|
|
48
|
+
let res: T;
|
|
49
|
+
try {
|
|
50
|
+
res = await fn(...args);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
// do not pause when finished the last retry
|
|
53
|
+
if (count !== times) {
|
|
54
|
+
await sleep(sleepMs);
|
|
55
|
+
}
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
return res;
|
|
59
|
+
};
|
|
60
|
+
return await retry(times, wrapped);
|
|
61
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {PromiseCancellationError} from './errors.js';
|
|
2
|
+
import type {CancellablePromise, SleepArg, SleepOptions} from './types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An async/await version of `setTimeout`. The returned promise has a `cancel()` method that clears
|
|
6
|
+
* the timer and usually rejects with {@link PromiseCancellationError} unless you use the object form with
|
|
7
|
+
* `cancelError: null` to resolve on cancel.
|
|
8
|
+
*
|
|
9
|
+
* @param ms - Milliseconds to wait
|
|
10
|
+
* @returns A thenable you can `await`; call `.cancel()` to abort early.
|
|
11
|
+
*/
|
|
12
|
+
export function sleep(ms: number): CancellablePromise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Object form: `ms` plus optional `cancelError` (non-empty string or `Error`, `null` to resolve on
|
|
15
|
+
* cancel, or omitted / `undefined` / `''` for default {@link PromiseCancellationError}). Any non-array
|
|
16
|
+
* object with a finite `ms` is accepted at runtime (including class instances), matching structural typing.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Duration and optional cancellation behavior
|
|
19
|
+
* @returns A thenable you can `await`; call `.cancel()` to abort early.
|
|
20
|
+
*/
|
|
21
|
+
export function sleep(options: SleepOptions): CancellablePromise<void>;
|
|
22
|
+
export function sleep(arg: SleepArg): CancellablePromise<void> {
|
|
23
|
+
const {ms, cancelError} = parseSleepArg(arg);
|
|
24
|
+
let timeoutId: NodeJS.Timeout | undefined;
|
|
25
|
+
let resolveFn: ((value: void) => void) | undefined;
|
|
26
|
+
let rejectFn: ((error: Error) => void) | undefined;
|
|
27
|
+
|
|
28
|
+
const promise = new Promise<void>((resolve, reject) => {
|
|
29
|
+
resolveFn = resolve;
|
|
30
|
+
rejectFn = reject;
|
|
31
|
+
timeoutId = setTimeout(resolve, ms);
|
|
32
|
+
}) as CancellablePromise<void>;
|
|
33
|
+
|
|
34
|
+
promise.cancel = () => {
|
|
35
|
+
if (timeoutId) {
|
|
36
|
+
clearTimeout(timeoutId);
|
|
37
|
+
timeoutId = undefined;
|
|
38
|
+
}
|
|
39
|
+
if (cancelError === null) {
|
|
40
|
+
resolveFn?.(undefined);
|
|
41
|
+
} else {
|
|
42
|
+
let err: Error;
|
|
43
|
+
if (typeof cancelError === 'string' && cancelError) {
|
|
44
|
+
err = new PromiseCancellationError(cancelError);
|
|
45
|
+
} else if (cancelError instanceof Error) {
|
|
46
|
+
err = cancelError;
|
|
47
|
+
} else {
|
|
48
|
+
err = new PromiseCancellationError();
|
|
49
|
+
}
|
|
50
|
+
rejectFn?.(err);
|
|
51
|
+
}
|
|
52
|
+
resolveFn = undefined;
|
|
53
|
+
rejectFn = undefined;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return promise;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Non-array object values (including class instances); excludes `null` and arrays. */
|
|
60
|
+
function isSleepArgObject(value: unknown): value is Record<PropertyKey, unknown> {
|
|
61
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseSleepArg(arg: SleepArg): {ms: number; cancelError?: string | Error | null} {
|
|
65
|
+
if (typeof arg === 'number') {
|
|
66
|
+
if (!Number.isFinite(arg)) {
|
|
67
|
+
throw new TypeError('sleep: expected a finite number or an object with ms');
|
|
68
|
+
}
|
|
69
|
+
return {ms: arg};
|
|
70
|
+
}
|
|
71
|
+
if (isSleepArgObject(arg)) {
|
|
72
|
+
const ms = arg.ms;
|
|
73
|
+
if (typeof ms !== 'number' || !Number.isFinite(ms)) {
|
|
74
|
+
throw new TypeError('sleep: options.ms must be a finite number');
|
|
75
|
+
}
|
|
76
|
+
return {ms, cancelError: arg.cancelError as string | Error | null | undefined};
|
|
77
|
+
}
|
|
78
|
+
throw new TypeError('sleep: expected a finite number or an object with ms');
|
|
79
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter provided to a progress callback
|
|
3
|
+
*/
|
|
4
|
+
export interface Progress {
|
|
5
|
+
/** Elapsed time in milliseconds since the operation started */
|
|
6
|
+
elapsedMs: number;
|
|
7
|
+
/** Remaining time in milliseconds until the operation completes */
|
|
8
|
+
timeLeft: number;
|
|
9
|
+
/** Progress as a number between 0 and 1 (0 = not started, 1 = complete) */
|
|
10
|
+
progress: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Progress callback for {@link longSleep}
|
|
15
|
+
*/
|
|
16
|
+
export type ProgressCallback = (progress: Progress) => void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Options for {@link longSleep}
|
|
20
|
+
*/
|
|
21
|
+
export interface LongSleepOptions {
|
|
22
|
+
/** Minimum duration in milliseconds before using long sleep behavior.
|
|
23
|
+
* @default 5000
|
|
24
|
+
*/
|
|
25
|
+
thresholdMs?: number;
|
|
26
|
+
/** Interval in milliseconds between progress callbacks.
|
|
27
|
+
* @default 1000
|
|
28
|
+
*/
|
|
29
|
+
intervalMs?: number;
|
|
30
|
+
/** Optional callback function to receive progress updates during the sleep */
|
|
31
|
+
progressCb?: ProgressCallback | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options for {@link asyncmap} and {@link asyncfilter}
|
|
36
|
+
*/
|
|
37
|
+
export type MapFilterOptions = boolean | {concurrency: number};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Object form of {@link sleep}'s argument: duration plus optional cancellation rejection override.
|
|
41
|
+
* Structural typing allows class instances; {@link sleep} accepts any non-array object with a finite `ms`.
|
|
42
|
+
*/
|
|
43
|
+
export interface SleepOptions {
|
|
44
|
+
/** Duration in milliseconds */
|
|
45
|
+
ms: number;
|
|
46
|
+
/**
|
|
47
|
+
* When {@link sleep}'s `cancel` runs: a non-empty string becomes {@link PromiseCancellationError}
|
|
48
|
+
* with that message; an `Error` rejects with that same instance; `null` resolves the promise
|
|
49
|
+
* instead of rejecting; omitted, `undefined`, or `''` use the default {@link PromiseCancellationError}.
|
|
50
|
+
*/
|
|
51
|
+
cancelError?: string | Error | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Argument to {@link sleep}: either milliseconds or an options object (see {@link SleepOptions}).
|
|
56
|
+
*/
|
|
57
|
+
export type SleepArg = number | SleepOptions;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A promise with a {@linkcode cancel} method (e.g. from {@link sleep}).
|
|
61
|
+
*
|
|
62
|
+
* @typeParam T - Resolved value type; {@link sleep} uses `void`.
|
|
63
|
+
*/
|
|
64
|
+
export type CancellablePromise<T = void> = Promise<T> & {
|
|
65
|
+
cancel: () => void;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Options for {@link waitForCondition}
|
|
70
|
+
*/
|
|
71
|
+
export interface WaitForConditionOptions {
|
|
72
|
+
/** Maximum time to wait in milliseconds.
|
|
73
|
+
* @default 5000
|
|
74
|
+
*/
|
|
75
|
+
waitMs?: number;
|
|
76
|
+
/** Interval in milliseconds between condition checks.
|
|
77
|
+
* @default 500
|
|
78
|
+
*/
|
|
79
|
+
intervalMs?: number;
|
|
80
|
+
/** Optional logger object with a debug method for logging wait progress */
|
|
81
|
+
logger?: {
|
|
82
|
+
debug: (...args: any[]) => void;
|
|
83
|
+
};
|
|
84
|
+
/** Custom error message (string) or Error object to throw if condition is not met.
|
|
85
|
+
* If not provided, a default error is thrown
|
|
86
|
+
*/
|
|
87
|
+
error?: string | Error;
|
|
88
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {sleep} from './sleep.js';
|
|
2
|
+
import type {WaitForConditionOptions} from './types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Takes a condition (a function returning a boolean or boolean promise), and
|
|
6
|
+
* waits until the condition is true.
|
|
7
|
+
*
|
|
8
|
+
* Throws a `/Condition unmet/` error if the condition has not been satisfied
|
|
9
|
+
* within the allocated time, unless an error is provided in the options, as the
|
|
10
|
+
* `error` property, which is either thrown itself, or used as the message.
|
|
11
|
+
*
|
|
12
|
+
* The condition result is returned if it is not falsy. If the condition throws an
|
|
13
|
+
* error then this exception will be immediately passed through.
|
|
14
|
+
*
|
|
15
|
+
* The default options are: `{ waitMs: 5000, intervalMs: 500 }`
|
|
16
|
+
* @param condFn - The condition function to evaluate
|
|
17
|
+
* @param options - Options for controlling the wait behavior
|
|
18
|
+
*/
|
|
19
|
+
export async function waitForCondition<T>(
|
|
20
|
+
condFn: () => Promise<T> | T,
|
|
21
|
+
options: WaitForConditionOptions = {},
|
|
22
|
+
): Promise<T> {
|
|
23
|
+
const opts: WaitForConditionOptions & {waitMs: number; intervalMs: number} = {
|
|
24
|
+
...options,
|
|
25
|
+
waitMs: typeof options.waitMs === 'number' ? options.waitMs : 5000,
|
|
26
|
+
intervalMs: typeof options.intervalMs === 'number' ? options.intervalMs : 500,
|
|
27
|
+
};
|
|
28
|
+
const debug = opts.logger ? opts.logger.debug.bind(opts.logger) : () => undefined;
|
|
29
|
+
const error = opts.error;
|
|
30
|
+
const begunAt = performance.now();
|
|
31
|
+
const endAt = begunAt + opts.waitMs;
|
|
32
|
+
const spin = async function spin(): Promise<T> {
|
|
33
|
+
const result = await condFn();
|
|
34
|
+
if (result) {
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
const now = performance.now();
|
|
38
|
+
const waited = Math.round(now - begunAt);
|
|
39
|
+
const remainingTime = endAt - now;
|
|
40
|
+
if (now < endAt) {
|
|
41
|
+
debug(`Waited for ${waited} ms so far`);
|
|
42
|
+
await sleep(Math.min(opts.intervalMs, remainingTime));
|
|
43
|
+
return await spin();
|
|
44
|
+
}
|
|
45
|
+
// if there is an error option, it is either a string message or an error itself
|
|
46
|
+
if (error) {
|
|
47
|
+
throw typeof error === 'string' ? new Error(error) : error;
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`Condition unmet after ${waited} ms. Timing out.`);
|
|
50
|
+
};
|
|
51
|
+
return await spin();
|
|
52
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {TimeoutError} from './errors.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolves with `promise` or rejects if it does not settle before `timeoutMs`.
|
|
5
|
+
*
|
|
6
|
+
* If the deadline passes first: with no third argument (or a falsy non-error value), rejects
|
|
7
|
+
* with {@link TimeoutError} whose message includes `timeoutMs`; with a non-empty string,
|
|
8
|
+
* rejects with {@link TimeoutError} using that message; with an `Error` instance, rejects
|
|
9
|
+
* with that same instance.
|
|
10
|
+
*
|
|
11
|
+
* @param promise - Promise to race against the timeout.
|
|
12
|
+
* @param timeoutMs - Maximum time in milliseconds before rejecting if `promise` has not settled.
|
|
13
|
+
* @param messageOrError - Optional override for the timeout rejection: custom {@link TimeoutError}
|
|
14
|
+
* message when the string is non-empty, or an existing `Error` to reject with verbatim.
|
|
15
|
+
* Omitted, `undefined`, or other falsy non-error values use the default timeout message (includes `timeoutMs`).
|
|
16
|
+
*/
|
|
17
|
+
export async function withTimeout<T>(
|
|
18
|
+
promise: Promise<T>,
|
|
19
|
+
timeoutMs: number,
|
|
20
|
+
messageOrError?: string | Error,
|
|
21
|
+
): Promise<T> {
|
|
22
|
+
let timer: NodeJS.Timeout | null = null;
|
|
23
|
+
try {
|
|
24
|
+
return await Promise.race([
|
|
25
|
+
promise,
|
|
26
|
+
new Promise<T>((_resolve, reject) => {
|
|
27
|
+
timer = setTimeout(() => {
|
|
28
|
+
if (typeof messageOrError === 'string' && messageOrError) {
|
|
29
|
+
reject(new TimeoutError(messageOrError));
|
|
30
|
+
} else if (!messageOrError) {
|
|
31
|
+
reject(new TimeoutError(`Operation timed out after ${timeoutMs}ms`));
|
|
32
|
+
} else {
|
|
33
|
+
reject(messageOrError);
|
|
34
|
+
}
|
|
35
|
+
}, timeoutMs);
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
38
|
+
} finally {
|
|
39
|
+
if (timer) {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "asyncbox",
|
|
3
|
+
"version": "6.5.0",
|
|
4
|
+
"description": "A collection of small async/await utilities",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"async",
|
|
7
|
+
"async/await",
|
|
8
|
+
"es7"
|
|
9
|
+
],
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/appium/asyncbox/issues"
|
|
12
|
+
},
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"author": "jlipps@gmail.com",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/appium/asyncbox.git"
|
|
18
|
+
},
|
|
19
|
+
"bin": {},
|
|
20
|
+
"directories": {
|
|
21
|
+
"lib": "./lib"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/**/*",
|
|
25
|
+
"build/cjs/lib/**/*",
|
|
26
|
+
"build/cjs/package.json",
|
|
27
|
+
"build/esm/lib/**/*",
|
|
28
|
+
"build/esm/package.json"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "./build/cjs/lib/index.js",
|
|
32
|
+
"module": "./build/esm/lib/index.js",
|
|
33
|
+
"types": "./build/cjs/lib/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./build/esm/lib/index.d.ts",
|
|
38
|
+
"default": "./build/esm/lib/index.js"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./build/cjs/lib/index.d.ts",
|
|
42
|
+
"default": "./build/cjs/lib/index.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -b tsconfig.esm.json tsconfig.cjs.json",
|
|
49
|
+
"postbuild": "node scripts/postbuild.mjs",
|
|
50
|
+
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
|
|
51
|
+
"rebuild": "npm run clean; npm run build",
|
|
52
|
+
"dev": "npm run build -- --watch",
|
|
53
|
+
"prepare": "npm run rebuild",
|
|
54
|
+
"test": "node --test --enable-source-maps --test-force-exit --test-timeout=60000 \"./build/esm/test/**/*.spec.js\" \"./test/*.spec.cjs\"",
|
|
55
|
+
"lint": "oxlint -c oxlint.config.mjs .",
|
|
56
|
+
"lint:fix": "oxlint -c oxlint.config.mjs --fix .",
|
|
57
|
+
"format": "oxfmt -c oxfmt.config.mjs .",
|
|
58
|
+
"format:check": "oxfmt -c oxfmt.config.mjs --check .",
|
|
59
|
+
"watch": "npm run dev"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"p-limit": "^7.2.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@appium/oxc-config": "^1.1.0",
|
|
66
|
+
"@appium/semantic-release-config": "^1.1.0",
|
|
67
|
+
"@appium/tsconfig": "^1.2.0",
|
|
68
|
+
"@types/node": "^26.1.0"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
72
|
+
"npm": ">=10"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -158,10 +158,10 @@ const newItemsMaxTwo = await asyncmap(items, slowSquare, {concurrency: 2});
|
|
|
158
158
|
Takes a condition (a function returning a boolean or boolean promise),
|
|
159
159
|
and waits until the condition is true.
|
|
160
160
|
|
|
161
|
-
Throws a `/Condition unmet/`
|
|
162
|
-
satisfied within the allocated time, unless an error is
|
|
163
|
-
the options, as the `error` property, which is either thrown itself,
|
|
164
|
-
used as the message
|
|
161
|
+
Throws a `ConditionUnmetError` (message matches `/Condition unmet/`) if the
|
|
162
|
+
condition has not been satisfied within the allocated time, unless an error is
|
|
163
|
+
provided in the options, as the `error` property, which is either thrown itself,
|
|
164
|
+
or used as the message of a `ConditionUnmetError`.
|
|
165
165
|
|
|
166
166
|
The condition result is returned if it is not falsy. If the condition
|
|
167
167
|
throws an error then this exception will be immediately passed through.
|
|
@@ -251,6 +251,20 @@ Times are in ms, up to 2147483647, and `0` means no limit.
|
|
|
251
251
|
- `maxPending` (default `1000`) - max tasks waiting per key; further ones are rejected right away, so `0` rejects every task that would have to wait
|
|
252
252
|
- `skipQueue` (default `false`, per call only) - put the task at the front of the queue
|
|
253
253
|
|
|
254
|
+
### Errors
|
|
255
|
+
|
|
256
|
+
The built-in errors of this package extend `AsyncboxError` and carry a stable `code`,
|
|
257
|
+
so match them by `instanceof` or `err.code` instead of the message text. Caller-supplied
|
|
258
|
+
errors (e.g. the `error` option of `waitForCondition`) are passed through as is:
|
|
259
|
+
|
|
260
|
+
| Class | `code` | Thrown by |
|
|
261
|
+
| --- | --- | --- |
|
|
262
|
+
| `TimeoutError` | `ERR_ASYNCBOX_TIMEOUT` | `withTimeout` |
|
|
263
|
+
| `ConditionUnmetError` (extends `TimeoutError`) | `ERR_ASYNCBOX_CONDITION_UNMET` | `waitForCondition` |
|
|
264
|
+
| `LockTimeoutError` (extends `TimeoutError`) | `ERR_ASYNCBOX_LOCK_TIMEOUT` | `AsyncLock` (queue, execution or occupation time exceeded) |
|
|
265
|
+
| `LockQueueFullError` | `ERR_ASYNCBOX_LOCK_QUEUE_FULL` | `AsyncLock` (`maxPending` reached) |
|
|
266
|
+
| `PromiseCancellationError` | `ERR_ASYNCBOX_CANCELLED` | `sleep` cancellation |
|
|
267
|
+
|
|
254
268
|
### Run the tests
|
|
255
269
|
|
|
256
270
|
```
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
+
/** Base class of the built-in typed errors of this package; match by `instanceof` or {@link AsyncboxError.code}. */
|
|
2
|
+
export declare class AsyncboxError extends Error {
|
|
3
|
+
/** Stable machine-readable identifier, e.g. `ERR_ASYNCBOX_TIMEOUT` */
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(message: string, code?: string);
|
|
6
|
+
}
|
|
1
7
|
/** Error thrown by {@link withTimeout} when the deadline is exceeded. */
|
|
2
|
-
export declare class TimeoutError extends
|
|
8
|
+
export declare class TimeoutError extends AsyncboxError {
|
|
9
|
+
constructor(message?: string, code?: string);
|
|
10
|
+
}
|
|
11
|
+
/** Thrown by {@link waitForCondition} when the condition is not met in time. */
|
|
12
|
+
export declare class ConditionUnmetError extends TimeoutError {
|
|
13
|
+
constructor(message?: string);
|
|
14
|
+
}
|
|
15
|
+
/** Thrown by {@link AsyncLock} when a queue, execution or occupation time limit is exceeded. */
|
|
16
|
+
export declare class LockTimeoutError extends TimeoutError {
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
/** Thrown by {@link AsyncLock} when the queue of a key already holds `maxPending` tasks. */
|
|
20
|
+
export declare class LockQueueFullError extends AsyncboxError {
|
|
3
21
|
constructor(message?: string);
|
|
4
22
|
}
|
|
5
23
|
/** Thrown when a promise is cancelled via `cancel`. */
|
|
6
|
-
export declare class PromiseCancellationError extends
|
|
24
|
+
export declare class PromiseCancellationError extends AsyncboxError {
|
|
7
25
|
constructor(message?: string);
|
|
8
26
|
}
|
|
9
27
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../lib/errors.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../lib/errors.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,qBAAa,aAAc,SAAQ,KAAK;IACtC,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAuB;CAK3D;AAED,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B;CAIpE;AAED,gFAAgF;AAChF,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED,gGAAgG;AAChG,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED,4FAA4F;AAC5F,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED,uDAAuD;AACvD,qBAAa,wBAAyB,SAAQ,aAAa;gBAC7C,OAAO,GAAE,MAA4B;CAIlD"}
|
|
@@ -1,18 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PromiseCancellationError = exports.TimeoutError = void 0;
|
|
3
|
+
exports.PromiseCancellationError = exports.LockQueueFullError = exports.LockTimeoutError = exports.ConditionUnmetError = exports.TimeoutError = exports.AsyncboxError = void 0;
|
|
4
|
+
/** Base class of the built-in typed errors of this package; match by `instanceof` or {@link AsyncboxError.code}. */
|
|
5
|
+
class AsyncboxError extends Error {
|
|
6
|
+
/** Stable machine-readable identifier, e.g. `ERR_ASYNCBOX_TIMEOUT` */
|
|
7
|
+
code;
|
|
8
|
+
constructor(message, code = 'ERR_ASYNCBOX') {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'AsyncboxError';
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.AsyncboxError = AsyncboxError;
|
|
4
15
|
/** Error thrown by {@link withTimeout} when the deadline is exceeded. */
|
|
5
|
-
class TimeoutError extends
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message ?? 'Operation timed out');
|
|
16
|
+
class TimeoutError extends AsyncboxError {
|
|
17
|
+
constructor(message, code = 'ERR_ASYNCBOX_TIMEOUT') {
|
|
18
|
+
super(message ?? 'Operation timed out', code);
|
|
8
19
|
this.name = 'TimeoutError';
|
|
9
20
|
}
|
|
10
21
|
}
|
|
11
22
|
exports.TimeoutError = TimeoutError;
|
|
23
|
+
/** Thrown by {@link waitForCondition} when the condition is not met in time. */
|
|
24
|
+
class ConditionUnmetError extends TimeoutError {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message ?? 'Condition unmet', 'ERR_ASYNCBOX_CONDITION_UNMET');
|
|
27
|
+
this.name = 'ConditionUnmetError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ConditionUnmetError = ConditionUnmetError;
|
|
31
|
+
/** Thrown by {@link AsyncLock} when a queue, execution or occupation time limit is exceeded. */
|
|
32
|
+
class LockTimeoutError extends TimeoutError {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message ?? 'Lock timed out', 'ERR_ASYNCBOX_LOCK_TIMEOUT');
|
|
35
|
+
this.name = 'LockTimeoutError';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.LockTimeoutError = LockTimeoutError;
|
|
39
|
+
/** Thrown by {@link AsyncLock} when the queue of a key already holds `maxPending` tasks. */
|
|
40
|
+
class LockQueueFullError extends AsyncboxError {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(message ?? 'Too many pending tasks in queue', 'ERR_ASYNCBOX_LOCK_QUEUE_FULL');
|
|
43
|
+
this.name = 'LockQueueFullError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.LockQueueFullError = LockQueueFullError;
|
|
12
47
|
/** Thrown when a promise is cancelled via `cancel`. */
|
|
13
|
-
class PromiseCancellationError extends
|
|
48
|
+
class PromiseCancellationError extends AsyncboxError {
|
|
14
49
|
constructor(message = 'Promise cancelled') {
|
|
15
|
-
super(message);
|
|
50
|
+
super(message, 'ERR_ASYNCBOX_CANCELLED');
|
|
16
51
|
this.name = 'PromiseCancellationError';
|
|
17
52
|
}
|
|
18
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../lib/errors.ts"],"names":[],"mappings":";;;AAAA,yEAAyE;AACzE,MAAa,YAAa,SAAQ,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../lib/errors.ts"],"names":[],"mappings":";;;AAAA,oHAAoH;AACpH,MAAa,aAAc,SAAQ,KAAK;IACtC,sEAAsE;IAC7D,IAAI,CAAS;IAEtB,YAAY,OAAe,EAAE,OAAe,cAAc;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AATD,sCASC;AAED,yEAAyE;AACzE,MAAa,YAAa,SAAQ,aAAa;IAC7C,YAAY,OAAgB,EAAE,OAAe,sBAAsB;QACjE,KAAK,CAAC,OAAO,IAAI,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,gFAAgF;AAChF,MAAa,mBAAoB,SAAQ,YAAY;IACnD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,gGAAgG;AAChG,MAAa,gBAAiB,SAAQ,YAAY;IAChD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED,4FAA4F;AAC5F,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,iCAAiC,EAAE,8BAA8B,CAAC,CAAC;QACpF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC;AAED,uDAAuD;AACvD,MAAa,wBAAyB,SAAQ,aAAa;IACzD,YAAY,UAAkB,mBAAmB;QAC/C,KAAK,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,4DAKC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { TimeoutError, PromiseCancellationError } from './errors.js';
|
|
1
|
+
export { AsyncboxError, TimeoutError, ConditionUnmetError, LockTimeoutError, LockQueueFullError, PromiseCancellationError, } from './errors.js';
|
|
2
2
|
export { sleep } from './sleep.js';
|
|
3
3
|
export { withTimeout } from './with-timeout.js';
|
|
4
4
|
export { longSleep } from './long-sleep.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAEpC,YAAY,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncLock = exports.waitForCondition = exports.asyncfilter = exports.asyncmap = exports.retryInterval = exports.retry = exports.longSleep = exports.withTimeout = exports.sleep = exports.PromiseCancellationError = exports.TimeoutError = void 0;
|
|
3
|
+
exports.AsyncLock = exports.waitForCondition = exports.asyncfilter = exports.asyncmap = exports.retryInterval = exports.retry = exports.longSleep = exports.withTimeout = exports.sleep = exports.PromiseCancellationError = exports.LockQueueFullError = exports.LockTimeoutError = exports.ConditionUnmetError = exports.TimeoutError = exports.AsyncboxError = void 0;
|
|
4
4
|
var errors_js_1 = require("./errors.js");
|
|
5
|
+
Object.defineProperty(exports, "AsyncboxError", { enumerable: true, get: function () { return errors_js_1.AsyncboxError; } });
|
|
5
6
|
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_js_1.TimeoutError; } });
|
|
7
|
+
Object.defineProperty(exports, "ConditionUnmetError", { enumerable: true, get: function () { return errors_js_1.ConditionUnmetError; } });
|
|
8
|
+
Object.defineProperty(exports, "LockTimeoutError", { enumerable: true, get: function () { return errors_js_1.LockTimeoutError; } });
|
|
9
|
+
Object.defineProperty(exports, "LockQueueFullError", { enumerable: true, get: function () { return errors_js_1.LockQueueFullError; } });
|
|
6
10
|
Object.defineProperty(exports, "PromiseCancellationError", { enumerable: true, get: function () { return errors_js_1.PromiseCancellationError; } });
|
|
7
11
|
var sleep_js_1 = require("./sleep.js");
|
|
8
12
|
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_js_1.sleep; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":";;;AAAA,yCAOqB;AANnB,0GAAA,aAAa,OAAA;AACb,yGAAA,YAAY,OAAA;AACZ,gHAAA,mBAAmB,OAAA;AACnB,6GAAA,gBAAgB,OAAA;AAChB,+GAAA,kBAAkB,OAAA;AAClB,qHAAA,wBAAwB,OAAA;AAE1B,uCAAiC;AAAzB,iGAAA,KAAK,OAAA;AACb,qDAA8C;AAAtC,8GAAA,WAAW,OAAA;AACnB,iDAA0C;AAAlC,0GAAA,SAAS,OAAA;AACjB,uCAAgD;AAAxC,iGAAA,KAAK,OAAA;AAAE,yGAAA,aAAa,OAAA;AAC5B,6CAAuC;AAA/B,uGAAA,QAAQ,OAAA;AAChB,mDAA6C;AAArC,6GAAA,WAAW,OAAA;AACnB,iEAAyD;AAAjD,yHAAA,gBAAgB,OAAA;AACxB,qCAAoC;AAA5B,oGAAA,SAAS,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../lib/lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../lib/lock.ts"],"names":[],"mappings":"AAQA,yFAAyF;AACzF,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,oFAAoF;AACpF,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAMxC;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;gBAE1C,IAAI,GAAE,gBAAqB;IAWvC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAkB/F;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAInC;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;CAG9B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AsyncLock = void 0;
|
|
4
4
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
5
6
|
const DEFAULT_MAX_PENDING = 1000;
|
|
6
7
|
// setTimeout fires after 1 ms for anything above this
|
|
7
8
|
const MAX_TIMER_MS = 2 ** 31 - 1;
|
|
@@ -104,7 +105,7 @@ class KeyClaim {
|
|
|
104
105
|
return true;
|
|
105
106
|
}
|
|
106
107
|
if (queue.length >= maxPending) {
|
|
107
|
-
this.onDenied(new
|
|
108
|
+
this.onDenied(new errors_js_1.LockQueueFullError(`Too many pending tasks in queue ${this.key}`));
|
|
108
109
|
}
|
|
109
110
|
else {
|
|
110
111
|
if (skipQueue) {
|
|
@@ -114,7 +115,7 @@ class KeyClaim {
|
|
|
114
115
|
queue.push(this.grant);
|
|
115
116
|
}
|
|
116
117
|
if (timeout) {
|
|
117
|
-
this.queueTimer = setTimeout(() => this.onDenied(new
|
|
118
|
+
this.queueTimer = setTimeout(() => this.onDenied(new errors_js_1.LockTimeoutError(`async-lock timed out in queue ${this.key}`)), timeout);
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
return false;
|
|
@@ -223,7 +224,7 @@ class Acquisition {
|
|
|
223
224
|
const { maxExecutionTime } = this.opts;
|
|
224
225
|
this.running = true;
|
|
225
226
|
if (maxExecutionTime) {
|
|
226
|
-
this.executionTimer = setTimeout(() => this.abort(new
|
|
227
|
+
this.executionTimer = setTimeout(() => this.abort(new errors_js_1.LockTimeoutError(`Maximum execution time is exceeded ${this.keys.join(', ')}`)), maxExecutionTime);
|
|
227
228
|
}
|
|
228
229
|
new Promise((resolve) => resolve(this.task())).then((value) => this.finish({ value }), (error) => this.finish({ error }));
|
|
229
230
|
}
|
|
@@ -240,10 +241,10 @@ class Acquisition {
|
|
|
240
241
|
expire() {
|
|
241
242
|
const keys = this.keys.join(', ');
|
|
242
243
|
if (this.running) {
|
|
243
|
-
this.settle({ error: new
|
|
244
|
+
this.settle({ error: new errors_js_1.LockTimeoutError(`Maximum occupation time is exceeded while executing ${keys}`) });
|
|
244
245
|
}
|
|
245
246
|
else {
|
|
246
|
-
this.abort(new
|
|
247
|
+
this.abort(new errors_js_1.LockTimeoutError(`Maximum occupation time is exceeded in queue ${keys}`));
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
settle(outcome) {
|