@celljs/core 3.8.0 → 4.0.0
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/cell.remote.yml +8 -0
- package/cell.yml +0 -3
- package/esm/browser/application/frontend-application-state.d.ts +4 -0
- package/esm/browser/application/frontend-application-state.js +14 -0
- package/esm/browser/application/frontend-application-state.js.map +1 -0
- package/esm/browser/application/frontend-application.d.ts +30 -0
- package/esm/browser/application/frontend-application.js +142 -0
- package/esm/browser/application/frontend-application.js.map +1 -0
- package/esm/browser/application/index.d.ts +2 -0
- package/esm/browser/application/index.js +3 -0
- package/esm/browser/application/index.js.map +1 -0
- package/esm/browser/browser.d.ts +22 -0
- package/esm/browser/browser.js +48 -0
- package/esm/browser/browser.js.map +1 -0
- package/esm/browser/index.d.ts +3 -0
- package/esm/browser/index.js +4 -0
- package/esm/browser/index.js.map +1 -0
- package/esm/browser/shell/application-shell.d.ts +4 -0
- package/esm/browser/shell/application-shell.js +18 -0
- package/esm/browser/shell/application-shell.js.map +1 -0
- package/esm/browser/shell/index.d.ts +2 -0
- package/esm/browser/shell/index.js +3 -0
- package/esm/browser/shell/index.js.map +1 -0
- package/esm/browser/shell/shell-protocol.d.ts +4 -0
- package/esm/browser/shell/shell-protocol.js +2 -0
- package/esm/browser/shell/shell-protocol.js.map +1 -0
- package/esm/browser/static-module.d.ts +3 -0
- package/esm/browser/static-module.js +4 -0
- package/esm/browser/static-module.js.map +1 -0
- package/esm/common/annotation/aspect.d.ts +7 -0
- package/esm/common/annotation/aspect.js +10 -0
- package/esm/common/annotation/aspect.js.map +1 -0
- package/esm/common/annotation/autowired-provider.d.ts +7 -0
- package/esm/common/annotation/autowired-provider.js +25 -0
- package/esm/common/annotation/autowired-provider.js.map +1 -0
- package/esm/common/annotation/autowired.d.ts +22 -0
- package/esm/common/annotation/autowired.js +48 -0
- package/esm/common/annotation/autowired.js.map +1 -0
- package/esm/common/annotation/component.d.ts +57 -0
- package/esm/common/annotation/component.js +71 -0
- package/esm/common/annotation/component.js.map +1 -0
- package/esm/common/annotation/constant.d.ts +8 -0
- package/esm/common/annotation/constant.js +12 -0
- package/esm/common/annotation/constant.js.map +1 -0
- package/esm/common/annotation/decorate.d.ts +1 -0
- package/esm/common/annotation/decorate.js +2 -0
- package/esm/common/annotation/decorate.js.map +1 -0
- package/esm/common/annotation/detached/autowired-provider.d.ts +2 -0
- package/esm/common/annotation/detached/autowired-provider.js +12 -0
- package/esm/common/annotation/detached/autowired-provider.js.map +1 -0
- package/esm/common/annotation/detached/autowired.d.ts +2 -0
- package/esm/common/annotation/detached/autowired.js +9 -0
- package/esm/common/annotation/detached/autowired.js.map +1 -0
- package/esm/common/annotation/detached/index.d.ts +3 -0
- package/esm/common/annotation/detached/index.js +4 -0
- package/esm/common/annotation/detached/index.js.map +1 -0
- package/esm/common/annotation/detached/value.d.ts +2 -0
- package/esm/common/annotation/detached/value.js +9 -0
- package/esm/common/annotation/detached/value.js.map +1 -0
- package/esm/common/annotation/index.d.ts +17 -0
- package/esm/common/annotation/index.js +18 -0
- package/esm/common/annotation/index.js.map +1 -0
- package/esm/common/annotation/inject.d.ts +1 -0
- package/esm/common/annotation/inject.js +2 -0
- package/esm/common/annotation/inject.js.map +1 -0
- package/esm/common/annotation/injectable.d.ts +1 -0
- package/esm/common/annotation/injectable.js +2 -0
- package/esm/common/annotation/injectable.js.map +1 -0
- package/esm/common/annotation/named.d.ts +1 -0
- package/esm/common/annotation/named.js +2 -0
- package/esm/common/annotation/named.js.map +1 -0
- package/esm/common/annotation/optional.d.ts +1 -0
- package/esm/common/annotation/optional.js +2 -0
- package/esm/common/annotation/optional.js.map +1 -0
- package/esm/common/annotation/post-construct.d.ts +1 -0
- package/esm/common/annotation/post-construct.js +2 -0
- package/esm/common/annotation/post-construct.js.map +1 -0
- package/esm/common/annotation/pre-destroy.d.ts +1 -0
- package/esm/common/annotation/pre-destroy.js +2 -0
- package/esm/common/annotation/pre-destroy.js.map +1 -0
- package/esm/common/annotation/service.d.ts +4 -0
- package/esm/common/annotation/service.js +14 -0
- package/esm/common/annotation/service.js.map +1 -0
- package/esm/common/annotation/tagged.d.ts +1 -0
- package/esm/common/annotation/tagged.js +2 -0
- package/esm/common/annotation/tagged.js.map +1 -0
- package/esm/common/annotation/target-name.d.ts +1 -0
- package/esm/common/annotation/target-name.js +2 -0
- package/esm/common/annotation/target-name.js.map +1 -0
- package/esm/common/annotation/unmanaged.d.ts +1 -0
- package/esm/common/annotation/unmanaged.js +2 -0
- package/esm/common/annotation/unmanaged.js.map +1 -0
- package/esm/common/annotation/value.d.ts +15 -0
- package/esm/common/annotation/value.js +50 -0
- package/esm/common/annotation/value.js.map +1 -0
- package/esm/common/aop/aop-protocol.d.ts +38 -0
- package/esm/common/aop/aop-protocol.js +8 -0
- package/esm/common/aop/aop-protocol.js.map +1 -0
- package/esm/common/aop/aop-proxy-factory.d.ts +6 -0
- package/esm/common/aop/aop-proxy-factory.js +67 -0
- package/esm/common/aop/aop-proxy-factory.js.map +1 -0
- package/esm/common/aop/class-filter.d.ts +6 -0
- package/esm/common/aop/class-filter.js +28 -0
- package/esm/common/aop/class-filter.js.map +1 -0
- package/esm/common/aop/index.d.ts +3 -0
- package/esm/common/aop/index.js +4 -0
- package/esm/common/aop/index.js.map +1 -0
- package/esm/common/application/application-entry.d.ts +1 -0
- package/esm/common/application/application-entry.js +41 -0
- package/esm/common/application/application-entry.js.map +1 -0
- package/esm/common/application/application-error.d.ts +20 -0
- package/esm/common/application/application-error.js +44 -0
- package/esm/common/application/application-error.js.map +1 -0
- package/esm/common/application/application-factory.d.ts +8 -0
- package/esm/common/application/application-factory.js +19 -0
- package/esm/common/application/application-factory.js.map +1 -0
- package/esm/common/application/application-host.d.ts +38 -0
- package/esm/common/application/application-host.js +17 -0
- package/esm/common/application/application-host.js.map +1 -0
- package/esm/common/application/application-protocol.d.ts +52 -0
- package/esm/common/application/application-protocol.js +103 -0
- package/esm/common/application/application-protocol.js.map +1 -0
- package/esm/common/application/application-state.d.ts +3 -0
- package/esm/common/application/application-state.js +15 -0
- package/esm/common/application/application-state.js.map +1 -0
- package/esm/common/application/application.d.ts +6 -0
- package/esm/common/application/application.js +31 -0
- package/esm/common/application/application.js.map +1 -0
- package/esm/common/application/index.d.ts +3 -0
- package/esm/common/application/index.js +4 -0
- package/esm/common/application/index.js.map +1 -0
- package/esm/common/config/config-protocol.d.ts +4 -0
- package/esm/common/config/config-protocol.js +2 -0
- package/esm/common/config/config-protocol.js.map +1 -0
- package/esm/common/config/config-provider.d.ts +6 -0
- package/esm/common/config/config-provider.js +26 -0
- package/esm/common/config/config-provider.js.map +1 -0
- package/esm/common/config/config-util.d.ts +4 -0
- package/esm/common/config/config-util.js +16 -0
- package/esm/common/config/config-util.js.map +1 -0
- package/esm/common/config/dynamic-config.d.ts +3 -0
- package/esm/common/config/dynamic-config.js +3 -0
- package/esm/common/config/dynamic-config.js.map +1 -0
- package/esm/common/config/env-config-util.d.ts +48 -0
- package/esm/common/config/env-config-util.js +185 -0
- package/esm/common/config/env-config-util.js.map +1 -0
- package/esm/common/config/index.d.ts +4 -0
- package/esm/common/config/index.js +5 -0
- package/esm/common/config/index.js.map +1 -0
- package/esm/common/constants.d.ts +5 -0
- package/esm/common/constants.js +6 -0
- package/esm/common/constants.js.map +1 -0
- package/esm/common/container/auto-bind.d.ts +3 -0
- package/esm/common/container/auto-bind.js +98 -0
- package/esm/common/container/auto-bind.js.map +1 -0
- package/esm/common/container/container-factory.d.ts +4 -0
- package/esm/common/container/container-factory.js +9 -0
- package/esm/common/container/container-factory.js.map +1 -0
- package/esm/common/container/container-provider.d.ts +6 -0
- package/esm/common/container/container-provider.js +23 -0
- package/esm/common/container/container-provider.js.map +1 -0
- package/esm/common/container/container-util.d.ts +9 -0
- package/esm/common/container/container-util.js +29 -0
- package/esm/common/container/container-util.js.map +1 -0
- package/esm/common/container/dynamic-container.d.ts +2 -0
- package/esm/common/container/dynamic-container.js +4 -0
- package/esm/common/container/dynamic-container.js.map +1 -0
- package/esm/common/container/index.d.ts +8 -0
- package/esm/common/container/index.js +6 -0
- package/esm/common/container/index.js.map +1 -0
- package/esm/common/container/scope.d.ts +5 -0
- package/esm/common/container/scope.js +7 -0
- package/esm/common/container/scope.js.map +1 -0
- package/esm/common/el/core-context-initializer.d.ts +6 -0
- package/esm/common/el/core-context-initializer.js +36 -0
- package/esm/common/el/core-context-initializer.js.map +1 -0
- package/esm/common/el/expression-compiler.d.ts +19 -0
- package/esm/common/el/expression-compiler.js +187 -0
- package/esm/common/el/expression-compiler.js.map +1 -0
- package/esm/common/el/expression-context-provider.d.ts +9 -0
- package/esm/common/el/expression-context-provider.js +43 -0
- package/esm/common/el/expression-context-provider.js.map +1 -0
- package/esm/common/el/expression-handler.d.ts +11 -0
- package/esm/common/el/expression-handler.js +95 -0
- package/esm/common/el/expression-handler.js.map +1 -0
- package/esm/common/el/expression-protocol.d.ts +32 -0
- package/esm/common/el/expression-protocol.js +6 -0
- package/esm/common/el/expression-protocol.js.map +1 -0
- package/esm/common/el/index.d.ts +6 -0
- package/esm/common/el/index.js +7 -0
- package/esm/common/el/index.js.map +1 -0
- package/esm/common/el/jexl-engine-provider.d.ts +5 -0
- package/esm/common/el/jexl-engine-provider.js +22 -0
- package/esm/common/el/jexl-engine-provider.js.map +1 -0
- package/esm/common/error/custom-error.d.ts +26 -0
- package/esm/common/error/custom-error.js +40 -0
- package/esm/common/error/custom-error.js.map +1 -0
- package/esm/common/error/error-protocol.d.ts +3 -0
- package/esm/common/error/error-protocol.js +2 -0
- package/esm/common/error/error-protocol.js.map +1 -0
- package/esm/common/error/illegal-argument-error.d.ts +3 -0
- package/esm/common/error/illegal-argument-error.js +4 -0
- package/esm/common/error/illegal-argument-error.js.map +1 -0
- package/esm/common/error/illegal-state-error.d.ts +3 -0
- package/esm/common/error/illegal-state-error.js +4 -0
- package/esm/common/error/illegal-state-error.js.map +1 -0
- package/esm/common/error/index.d.ts +5 -0
- package/esm/common/error/index.js +6 -0
- package/esm/common/error/index.js.map +1 -0
- package/esm/common/error/invalid-mime-type-error.d.ts +5 -0
- package/esm/common/error/invalid-mime-type-error.js +8 -0
- package/esm/common/error/invalid-mime-type-error.js.map +1 -0
- package/esm/common/index.d.ts +12 -0
- package/esm/common/index.js +13 -0
- package/esm/common/index.js.map +1 -0
- package/esm/common/logger/abstract-logger.d.ts +18 -0
- package/esm/common/logger/abstract-logger.js +69 -0
- package/esm/common/logger/abstract-logger.js.map +1 -0
- package/esm/common/logger/index.d.ts +4 -0
- package/esm/common/logger/index.js +5 -0
- package/esm/common/logger/index.js.map +1 -0
- package/esm/common/logger/logger-protocol.d.ts +30 -0
- package/esm/common/logger/logger-protocol.js +8 -0
- package/esm/common/logger/logger-protocol.js.map +1 -0
- package/esm/common/logger/logger-service.d.ts +4 -0
- package/esm/common/logger/logger-service.js +18 -0
- package/esm/common/logger/logger-service.js.map +1 -0
- package/esm/common/logger/logger.d.ts +7 -0
- package/esm/common/logger/logger.js +35 -0
- package/esm/common/logger/logger.js.map +1 -0
- package/esm/common/provider/component-filter-registry.d.ts +11 -0
- package/esm/common/provider/component-filter-registry.js +66 -0
- package/esm/common/provider/component-filter-registry.js.map +1 -0
- package/esm/common/provider/index.d.ts +5 -0
- package/esm/common/provider/index.js +6 -0
- package/esm/common/provider/index.js.map +1 -0
- package/esm/common/provider/provider-creator.d.ts +6 -0
- package/esm/common/provider/provider-creator.js +19 -0
- package/esm/common/provider/provider-creator.js.map +1 -0
- package/esm/common/provider/provider-protocol.d.ts +48 -0
- package/esm/common/provider/provider-protocol.js +5 -0
- package/esm/common/provider/provider-protocol.js.map +1 -0
- package/esm/common/provider/provider-util.d.ts +5 -0
- package/esm/common/provider/provider-util.js +10 -0
- package/esm/common/provider/provider-util.js.map +1 -0
- package/esm/common/provider/provider.d.ts +13 -0
- package/esm/common/provider/provider.js +54 -0
- package/esm/common/provider/provider.js.map +1 -0
- package/esm/common/static-module.d.ts +3 -0
- package/esm/common/static-module.js +9 -0
- package/esm/common/static-module.js.map +1 -0
- package/esm/common/test/index.d.ts +1 -0
- package/esm/common/test/index.js +2 -0
- package/esm/common/test/index.js.map +1 -0
- package/esm/common/test/mock-logger.d.ts +14 -0
- package/esm/common/test/mock-logger.js +41 -0
- package/esm/common/test/mock-logger.js.map +1 -0
- package/esm/common/test/test-module.d.ts +2 -0
- package/esm/common/test/test-module.js +12 -0
- package/esm/common/test/test-module.js.map +1 -0
- package/esm/common/utils/annotation-util.d.ts +4 -0
- package/esm/common/utils/annotation-util.js +24 -0
- package/esm/common/utils/annotation-util.js.map +1 -0
- package/esm/common/utils/assert.d.ts +173 -0
- package/esm/common/utils/assert.js +283 -0
- package/esm/common/utils/assert.js.map +1 -0
- package/esm/common/utils/async.d.ts +367 -0
- package/esm/common/utils/async.js +935 -0
- package/esm/common/utils/async.js.map +1 -0
- package/esm/common/utils/byte-util.d.ts +11 -0
- package/esm/common/utils/byte-util.js +75 -0
- package/esm/common/utils/byte-util.js.map +1 -0
- package/esm/common/utils/cancellation.d.ts +21 -0
- package/esm/common/utils/cancellation.js +89 -0
- package/esm/common/utils/cancellation.js.map +1 -0
- package/esm/common/utils/class-util.d.ts +2 -0
- package/esm/common/utils/class-util.js +19 -0
- package/esm/common/utils/class-util.js.map +1 -0
- package/esm/common/utils/disposable.d.ts +29 -0
- package/esm/common/utils/disposable.js +78 -0
- package/esm/common/utils/disposable.js.map +1 -0
- package/esm/common/utils/emitter.d.ts +63 -0
- package/esm/common/utils/emitter.js +221 -0
- package/esm/common/utils/emitter.js.map +1 -0
- package/esm/common/utils/error-util.d.ts +19 -0
- package/esm/common/utils/error-util.js +35 -0
- package/esm/common/utils/error-util.js.map +1 -0
- package/esm/common/utils/event.d.ts +40 -0
- package/esm/common/utils/event.js +90 -0
- package/esm/common/utils/event.js.map +1 -0
- package/esm/common/utils/global-util.d.ts +1 -0
- package/esm/common/utils/global-util.js +16 -0
- package/esm/common/utils/global-util.js.map +1 -0
- package/esm/common/utils/index.d.ts +21 -0
- package/esm/common/utils/index.js +22 -0
- package/esm/common/utils/index.js.map +1 -0
- package/esm/common/utils/metadata-util.d.ts +1 -0
- package/esm/common/utils/metadata-util.js +25 -0
- package/esm/common/utils/metadata-util.js.map +1 -0
- package/esm/common/utils/mime-type-util.d.ts +36 -0
- package/esm/common/utils/mime-type-util.js +168 -0
- package/esm/common/utils/mime-type-util.js.map +1 -0
- package/esm/common/utils/mime-type.d.ts +36 -0
- package/esm/common/utils/mime-type.js +284 -0
- package/esm/common/utils/mime-type.js.map +1 -0
- package/esm/common/utils/os.d.ts +19 -0
- package/esm/common/utils/os.js +46 -0
- package/esm/common/utils/os.js.map +1 -0
- package/esm/common/utils/prioritizeable.d.ts +17 -0
- package/esm/common/utils/prioritizeable.js +38 -0
- package/esm/common/utils/prioritizeable.js.map +1 -0
- package/esm/common/utils/promise-util.d.ts +5 -0
- package/esm/common/utils/promise-util.js +9 -0
- package/esm/common/utils/promise-util.js.map +1 -0
- package/esm/common/utils/proxy-util.d.ts +4 -0
- package/esm/common/utils/proxy-util.js +34 -0
- package/esm/common/utils/proxy-util.js.map +1 -0
- package/esm/common/utils/types.d.ts +16 -0
- package/esm/common/utils/types.js +2 -0
- package/esm/common/utils/types.js.map +1 -0
- package/esm/common/utils/url-util.d.ts +3 -0
- package/esm/common/utils/url-util.js +56 -0
- package/esm/common/utils/url-util.js.map +1 -0
- package/esm/common/utils/uuid.d.ts +2 -0
- package/esm/common/utils/uuid.js +61 -0
- package/esm/common/utils/uuid.js.map +1 -0
- package/esm/node/application/backend-application-state.d.ts +4 -0
- package/esm/node/application/backend-application-state.js +14 -0
- package/esm/node/application/backend-application-state.js.map +1 -0
- package/esm/node/application/backend-application.d.ts +10 -0
- package/esm/node/application/backend-application.js +52 -0
- package/esm/node/application/backend-application.js.map +1 -0
- package/esm/node/application/index.d.ts +2 -0
- package/esm/node/application/index.js +3 -0
- package/esm/node/application/index.js.map +1 -0
- package/esm/node/constants.d.ts +15 -0
- package/esm/node/constants.js +16 -0
- package/esm/node/constants.js.map +1 -0
- package/esm/node/context/context.d.ts +15 -0
- package/esm/node/context/context.js +58 -0
- package/esm/node/context/context.js.map +1 -0
- package/esm/node/context/index.d.ts +1 -0
- package/esm/node/context/index.js +2 -0
- package/esm/node/context/index.js.map +1 -0
- package/esm/node/index.d.ts +3 -0
- package/esm/node/index.js +4 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/static-module.d.ts +3 -0
- package/esm/node/static-module.js +4 -0
- package/esm/node/static-module.js.map +1 -0
- package/esm/node/utils/crc.d.ts +1 -0
- package/esm/node/utils/crc.js +7 -0
- package/esm/node/utils/crc.js.map +1 -0
- package/esm/node/utils/index.d.ts +1 -0
- package/esm/node/utils/index.js +2 -0
- package/esm/node/utils/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/lib/common/application/application-entry.d.ts.map +1 -1
- package/lib/common/application/application-entry.js +21 -3
- package/lib/common/application/application-entry.js.map +1 -1
- package/lib/common/application/application-factory.d.ts +1 -0
- package/lib/common/application/application-factory.d.ts.map +1 -1
- package/lib/common/application/application-factory.js +1 -1
- package/lib/common/application/application-factory.js.map +1 -1
- package/lib/common/application/application-host.d.ts +39 -0
- package/lib/common/application/application-host.d.ts.map +1 -0
- package/lib/common/application/application-host.js +20 -0
- package/lib/common/application/application-host.js.map +1 -0
- package/lib/common/application/index.d.ts +1 -0
- package/lib/common/application/index.d.ts.map +1 -1
- package/lib/common/application/index.js +1 -0
- package/lib/common/application/index.js.map +1 -1
- package/lib/common/config/env-config-util.d.ts +49 -0
- package/lib/common/config/env-config-util.d.ts.map +1 -0
- package/lib/common/config/env-config-util.js +188 -0
- package/lib/common/config/env-config-util.js.map +1 -0
- package/lib/common/config/env-config-util.spec.d.ts +2 -0
- package/lib/common/config/env-config-util.spec.d.ts.map +1 -0
- package/lib/common/config/env-config-util.spec.js +314 -0
- package/lib/common/config/env-config-util.spec.js.map +1 -0
- package/lib/common/config/index.d.ts +1 -0
- package/lib/common/config/index.d.ts.map +1 -1
- package/lib/common/config/index.js +1 -0
- package/lib/common/config/index.js.map +1 -1
- package/package.json +114 -5
- package/src/common/application/application-entry.ts +20 -4
- package/src/common/application/application-factory.ts +1 -1
- package/src/common/application/application-host.ts +46 -0
- package/src/common/application/index.ts +1 -0
- package/src/common/config/env-config-util.spec.ts +341 -0
- package/src/common/config/env-config-util.ts +225 -0
- package/src/common/config/index.ts +1 -0
- package/cell-remote.yml +0 -3
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { CancellationToken } from './cancellation.js';
|
|
2
|
+
import { Disposable } from './disposable.js';
|
|
3
|
+
import { Event } from './event.js';
|
|
4
|
+
interface Thenable<T> {
|
|
5
|
+
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
|
|
6
|
+
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare function isThenable<T>(obj: unknown): obj is Promise<T>;
|
|
9
|
+
export interface CancelablePromise<T> extends Promise<T> {
|
|
10
|
+
cancel(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A function to allow a promise resolution to be delayed by a number of milliseconds. Usage is as follows:
|
|
14
|
+
*
|
|
15
|
+
* `const stringValue = await myPromise.then(delay(600)).then(value => value.toString());`
|
|
16
|
+
*
|
|
17
|
+
* @param ms the number of millisecond to delay
|
|
18
|
+
* @returns a function that returns a promise that returns the given value, but delayed
|
|
19
|
+
*/
|
|
20
|
+
export declare function delay<T>(ms: number): (value: T) => Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a promise that will resolve after a given delay.
|
|
23
|
+
* @param ms the number of milliseconds to wait
|
|
24
|
+
*/
|
|
25
|
+
export declare function wait(ms: number): Promise<void>;
|
|
26
|
+
export declare function waitForEvent<T>(event: Event<T>, ms: number, thisArg?: any, disposables?: Disposable[]): Promise<T>;
|
|
27
|
+
export declare function createCancelablePromise<T>(callback: (token: CancellationToken) => Promise<T>): CancelablePromise<T>;
|
|
28
|
+
export declare function raceCancellation<T>(promise: Promise<T>, token: CancellationToken): Promise<T | undefined>;
|
|
29
|
+
export declare function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue: T): Promise<T>;
|
|
30
|
+
export declare function raceCancellationError<T>(promise: Promise<T>, token: CancellationToken): Promise<T>;
|
|
31
|
+
export declare function raceCancellablePromises<T>(cancellablePromises: CancelablePromise<T>[]): Promise<T>;
|
|
32
|
+
export declare function raceTimeout<T>(promise: Promise<T>, timeout: number, onTimeout?: () => void): Promise<T | undefined>;
|
|
33
|
+
export declare function asPromise<T>(callback: () => T | Thenable<T>): Promise<T>;
|
|
34
|
+
export interface ITask<T> {
|
|
35
|
+
(): T;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A helper to prevent accumulation of sequential async tasks.
|
|
39
|
+
*
|
|
40
|
+
* Imagine a mail man with the sole task of delivering letters. As soon as
|
|
41
|
+
* a letter submitted for delivery, he drives to the destination, delivers it
|
|
42
|
+
* and returns to his base. Imagine that during the trip, N more letters were submitted.
|
|
43
|
+
* When the mail man returns, he picks those N letters and delivers them all in a
|
|
44
|
+
* single trip. Even though N+1 submissions occurred, only 2 deliveries were made.
|
|
45
|
+
*
|
|
46
|
+
* The throttler implements this via the queue() method, by providing it a task
|
|
47
|
+
* factory. Following the example:
|
|
48
|
+
*
|
|
49
|
+
* const throttler = new Throttler();
|
|
50
|
+
* const letters = [];
|
|
51
|
+
*
|
|
52
|
+
* function deliver() {
|
|
53
|
+
* const lettersToDeliver = letters;
|
|
54
|
+
* letters = [];
|
|
55
|
+
* return makeTheTrip(lettersToDeliver);
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* function onLetterReceived(l) {
|
|
59
|
+
* letters.push(l);
|
|
60
|
+
* throttler.queue(deliver);
|
|
61
|
+
* }
|
|
62
|
+
*/
|
|
63
|
+
export declare class Throttler {
|
|
64
|
+
private activePromise;
|
|
65
|
+
private queuedPromise;
|
|
66
|
+
private queuedPromiseFactory;
|
|
67
|
+
constructor();
|
|
68
|
+
queue<T>(promiseFactory: ITask<Promise<T>>): Promise<T>;
|
|
69
|
+
}
|
|
70
|
+
export declare class Sequencer {
|
|
71
|
+
private current;
|
|
72
|
+
queue<T>(promiseTask: ITask<Promise<T>>): Promise<T>;
|
|
73
|
+
}
|
|
74
|
+
export declare class SequencerByKey<TKey> {
|
|
75
|
+
private promiseMap;
|
|
76
|
+
queue<T>(key: TKey, promiseTask: ITask<Promise<T>>): Promise<T>;
|
|
77
|
+
}
|
|
78
|
+
/** Can be passed into the Delayed to defer using a microtask */
|
|
79
|
+
export declare const MicrotaskDelay: unique symbol;
|
|
80
|
+
/**
|
|
81
|
+
* A helper to delay (debounce) execution of a task that is being requested often.
|
|
82
|
+
*
|
|
83
|
+
* Following the throttler, now imagine the mail man wants to optimize the number of
|
|
84
|
+
* trips proactively. The trip itself can be long, so he decides not to make the trip
|
|
85
|
+
* as soon as a letter is submitted. Instead he waits a while, in case more
|
|
86
|
+
* letters are submitted. After said waiting period, if no letters were submitted, he
|
|
87
|
+
* decides to make the trip. Imagine that N more letters were submitted after the first
|
|
88
|
+
* one, all within a short period of time between each other. Even though N+1
|
|
89
|
+
* submissions occurred, only 1 delivery was made.
|
|
90
|
+
*
|
|
91
|
+
* The delayer offers this behavior via the trigger() method, into which both the task
|
|
92
|
+
* to be executed and the waiting period (delay) must be passed in as arguments. Following
|
|
93
|
+
* the example:
|
|
94
|
+
*
|
|
95
|
+
* const delayer = new Delayer(WAITING_PERIOD);
|
|
96
|
+
* const letters = [];
|
|
97
|
+
*
|
|
98
|
+
* function letterReceived(l) {
|
|
99
|
+
* letters.push(l);
|
|
100
|
+
* delayer.trigger(() => { return makeTheTrip(); });
|
|
101
|
+
* }
|
|
102
|
+
*/
|
|
103
|
+
export declare class Delayer<T> implements Disposable {
|
|
104
|
+
defaultDelay: number | typeof MicrotaskDelay;
|
|
105
|
+
private deferred;
|
|
106
|
+
private completionPromise;
|
|
107
|
+
private doResolve;
|
|
108
|
+
private doReject;
|
|
109
|
+
private task;
|
|
110
|
+
constructor(defaultDelay: number | typeof MicrotaskDelay);
|
|
111
|
+
trigger(task: ITask<T | Promise<T>>, delay?: number | typeof MicrotaskDelay): Promise<T>;
|
|
112
|
+
isTriggered(): boolean;
|
|
113
|
+
cancel(): void;
|
|
114
|
+
private cancelTimeout;
|
|
115
|
+
dispose(): void;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A helper to delay execution of a task that is being requested often, while
|
|
119
|
+
* preventing accumulation of consecutive executions, while the task runs.
|
|
120
|
+
*
|
|
121
|
+
* The mail man is clever and waits for a certain amount of time, before going
|
|
122
|
+
* out to deliver letters. While the mail man is going out, more letters arrive
|
|
123
|
+
* and can only be delivered once he is back. Once he is back the mail man will
|
|
124
|
+
* do one more trip to deliver the letters that have accumulated while he was out.
|
|
125
|
+
*/
|
|
126
|
+
export declare class ThrottledDelayer<T> {
|
|
127
|
+
private delayer;
|
|
128
|
+
private throttler;
|
|
129
|
+
constructor(defaultDelay: number);
|
|
130
|
+
trigger(promiseFactory: ITask<Promise<T>>, delay?: number): Promise<T>;
|
|
131
|
+
isTriggered(): boolean;
|
|
132
|
+
cancel(): void;
|
|
133
|
+
dispose(): void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A barrier that is initially closed and then becomes opened permanently.
|
|
137
|
+
*/
|
|
138
|
+
export declare class Barrier {
|
|
139
|
+
private _isOpen;
|
|
140
|
+
private _promise;
|
|
141
|
+
private _completePromise;
|
|
142
|
+
constructor();
|
|
143
|
+
isOpen(): boolean;
|
|
144
|
+
open(): void;
|
|
145
|
+
wait(): Promise<boolean>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A barrier that is initially closed and then becomes opened permanently after a certain period of
|
|
149
|
+
* time or when open is called explicitly
|
|
150
|
+
*/
|
|
151
|
+
export declare class AutoOpenBarrier extends Barrier {
|
|
152
|
+
private readonly _timeout;
|
|
153
|
+
constructor(autoOpenTimeMs: number);
|
|
154
|
+
open(): void;
|
|
155
|
+
}
|
|
156
|
+
export declare function timeout(millis: number): CancelablePromise<void>;
|
|
157
|
+
export declare function timeout(millis: number, token: CancellationToken): Promise<void>;
|
|
158
|
+
export declare function disposableTimeout(handler: () => void, timeout?: number): Disposable;
|
|
159
|
+
/**
|
|
160
|
+
* Runs the provided list of promise factories in sequential order. The returned
|
|
161
|
+
* promise will complete to an array of results from each promise.
|
|
162
|
+
*/
|
|
163
|
+
export declare function sequence<T>(promiseFactories: ITask<Promise<T>>[]): Promise<T[]>;
|
|
164
|
+
export declare function first<T>(promiseFactories: ITask<Promise<T>>[], shouldStop?: (t: T) => boolean, defaultValue?: T | undefined): Promise<T | undefined>;
|
|
165
|
+
/**
|
|
166
|
+
* Returns the result of the first promise that matches the "shouldStop",
|
|
167
|
+
* running all promises in parallel. Supports cancelable promises.
|
|
168
|
+
*/
|
|
169
|
+
export declare function firstParallel<T>(promiseList: Promise<T>[], shouldStop?: (t: T) => boolean, defaultValue?: T | undefined): Promise<T | undefined>;
|
|
170
|
+
export declare function firstParallel<T, R extends T>(promiseList: Promise<T>[], shouldStop: (t: T) => t is R, defaultValue?: R | undefined): Promise<R | undefined>;
|
|
171
|
+
export interface ILimiter<T> {
|
|
172
|
+
readonly size: number;
|
|
173
|
+
queue(factory: ITask<Promise<T>>): Promise<T>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A helper to queue N promises and run them all with a max degree of parallelism. The helper
|
|
177
|
+
* ensures that at any time no more than M promises are running at the same time.
|
|
178
|
+
*/
|
|
179
|
+
export declare class Limiter<T> implements ILimiter<T> {
|
|
180
|
+
private _size;
|
|
181
|
+
private runningPromises;
|
|
182
|
+
private readonly maxDegreeOfParalellism;
|
|
183
|
+
private readonly outstandingPromises;
|
|
184
|
+
private readonly _onDrained;
|
|
185
|
+
constructor(maxDegreeOfParalellism: number);
|
|
186
|
+
/**
|
|
187
|
+
* An event that fires when every promise in the queue
|
|
188
|
+
* has started to execute. In other words: no work is
|
|
189
|
+
* pending to be scheduled.
|
|
190
|
+
*
|
|
191
|
+
* This is NOT an event that signals when all promises
|
|
192
|
+
* have finished though.
|
|
193
|
+
*/
|
|
194
|
+
get onDrained(): Event<void>;
|
|
195
|
+
get size(): number;
|
|
196
|
+
queue(factory: ITask<Promise<T>>): Promise<T>;
|
|
197
|
+
private consume;
|
|
198
|
+
private consumed;
|
|
199
|
+
dispose(): void;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A queue is handles one promise at a time and guarantees that at any time only one promise is executing.
|
|
203
|
+
*/
|
|
204
|
+
export declare class Queue<T> extends Limiter<T> {
|
|
205
|
+
constructor();
|
|
206
|
+
}
|
|
207
|
+
export declare class TimeoutTimer implements Disposable {
|
|
208
|
+
private _token;
|
|
209
|
+
constructor();
|
|
210
|
+
constructor(runner: () => void, timeout: number);
|
|
211
|
+
dispose(): void;
|
|
212
|
+
cancel(): void;
|
|
213
|
+
cancelAndSet(runner: () => void, timeout: number): void;
|
|
214
|
+
setIfNotSet(runner: () => void, timeout: number): void;
|
|
215
|
+
}
|
|
216
|
+
export declare class IntervalTimer implements Disposable {
|
|
217
|
+
private _token;
|
|
218
|
+
constructor();
|
|
219
|
+
dispose(): void;
|
|
220
|
+
cancel(): void;
|
|
221
|
+
cancelAndSet(runner: () => void, interval: number): void;
|
|
222
|
+
}
|
|
223
|
+
export declare class RunOnceScheduler {
|
|
224
|
+
protected runner: ((...args: unknown[]) => void) | undefined;
|
|
225
|
+
private timeoutToken;
|
|
226
|
+
private timeout;
|
|
227
|
+
private timeoutHandler;
|
|
228
|
+
constructor(runner: (...args: any[]) => void, delay: number);
|
|
229
|
+
/**
|
|
230
|
+
* Dispose RunOnceScheduler
|
|
231
|
+
*/
|
|
232
|
+
dispose(): void;
|
|
233
|
+
/**
|
|
234
|
+
* Cancel current scheduled runner (if any).
|
|
235
|
+
*/
|
|
236
|
+
cancel(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Cancel previous runner (if any) & schedule a new runner.
|
|
239
|
+
*/
|
|
240
|
+
schedule(delay?: number): void;
|
|
241
|
+
get delay(): number;
|
|
242
|
+
set delay(value: number);
|
|
243
|
+
/**
|
|
244
|
+
* Returns true if scheduled.
|
|
245
|
+
*/
|
|
246
|
+
isScheduled(): boolean;
|
|
247
|
+
private onTimeout;
|
|
248
|
+
protected doRun(): void;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.
|
|
252
|
+
* > **NOTE**: Only offers 1s resolution.
|
|
253
|
+
*
|
|
254
|
+
* When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep
|
|
255
|
+
* for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But
|
|
256
|
+
* this scheduler will execute 3hrs **after waking the computer from sleep**.
|
|
257
|
+
*/
|
|
258
|
+
export declare class ProcessTimeRunOnceScheduler {
|
|
259
|
+
private runner;
|
|
260
|
+
private timeout;
|
|
261
|
+
private counter;
|
|
262
|
+
private intervalToken;
|
|
263
|
+
private intervalHandler;
|
|
264
|
+
constructor(runner: () => void, delay: number);
|
|
265
|
+
dispose(): void;
|
|
266
|
+
cancel(): void;
|
|
267
|
+
/**
|
|
268
|
+
* Cancel previous runner (if any) & schedule a new runner.
|
|
269
|
+
*/
|
|
270
|
+
schedule(delay?: number): void;
|
|
271
|
+
/**
|
|
272
|
+
* Returns true if scheduled.
|
|
273
|
+
*/
|
|
274
|
+
isScheduled(): boolean;
|
|
275
|
+
private onInterval;
|
|
276
|
+
}
|
|
277
|
+
export declare class RunOnceWorker<T> extends RunOnceScheduler {
|
|
278
|
+
private units;
|
|
279
|
+
constructor(runner: (units: T[]) => void, timeout: number);
|
|
280
|
+
work(unit: T): void;
|
|
281
|
+
protected doRun(): void;
|
|
282
|
+
dispose(): void;
|
|
283
|
+
}
|
|
284
|
+
export interface IThrottledWorkerOptions {
|
|
285
|
+
/**
|
|
286
|
+
* maximum of units the worker will pass onto handler at once
|
|
287
|
+
*/
|
|
288
|
+
maxWorkChunkSize: number;
|
|
289
|
+
/**
|
|
290
|
+
* maximum of units the worker will keep in memory for processing
|
|
291
|
+
*/
|
|
292
|
+
maxBufferedWork: number | undefined;
|
|
293
|
+
/**
|
|
294
|
+
* delay before processing the next round of chunks when chunk size exceeds limits
|
|
295
|
+
*/
|
|
296
|
+
throttleDelay: number;
|
|
297
|
+
}
|
|
298
|
+
export declare function retry<T>(task: ITask<Promise<T>>, delay: number, retries: number): Promise<T>;
|
|
299
|
+
export interface ITaskSequentializerWithPendingTask {
|
|
300
|
+
readonly pending: Promise<void>;
|
|
301
|
+
}
|
|
302
|
+
export declare class TaskSequentializer {
|
|
303
|
+
private _pending?;
|
|
304
|
+
private _next?;
|
|
305
|
+
hasPending(taskId?: number): this is ITaskSequentializerWithPendingTask;
|
|
306
|
+
get pending(): Promise<void> | undefined;
|
|
307
|
+
cancelPending(): void;
|
|
308
|
+
setPending(taskId: number, promise: Promise<void>, onCancel?: () => void): Promise<void>;
|
|
309
|
+
private donePending;
|
|
310
|
+
private triggerNext;
|
|
311
|
+
setNext(run: () => Promise<void>): Promise<void>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* The `IntervalCounter` allows to count the number
|
|
315
|
+
* of calls to `increment()` over a duration of
|
|
316
|
+
* `interval`. This utility can be used to conditionally
|
|
317
|
+
* throttle a frequent task when a certain threshold
|
|
318
|
+
* is reached.
|
|
319
|
+
*/
|
|
320
|
+
export declare class IntervalCounter {
|
|
321
|
+
private readonly interval;
|
|
322
|
+
private readonly nowFn;
|
|
323
|
+
private lastIncrementTime;
|
|
324
|
+
private value;
|
|
325
|
+
constructor(interval: number, nowFn?: () => number);
|
|
326
|
+
increment(): number;
|
|
327
|
+
}
|
|
328
|
+
export type ValueCallback<T = unknown> = (value: T | Promise<T>) => void;
|
|
329
|
+
/**
|
|
330
|
+
* Creates a promise whose resolution or rejection can be controlled imperatively.
|
|
331
|
+
*/
|
|
332
|
+
export declare class DeferredPromise<T> {
|
|
333
|
+
private completeCallback;
|
|
334
|
+
private errorCallback;
|
|
335
|
+
private rejected;
|
|
336
|
+
private resolved;
|
|
337
|
+
get isRejected(): boolean;
|
|
338
|
+
get isResolved(): boolean;
|
|
339
|
+
get isSettled(): boolean;
|
|
340
|
+
p: Promise<T>;
|
|
341
|
+
constructor();
|
|
342
|
+
complete(value: T): Promise<void>;
|
|
343
|
+
error(err: unknown): Promise<void>;
|
|
344
|
+
cancel(): void;
|
|
345
|
+
}
|
|
346
|
+
export declare namespace Promises {
|
|
347
|
+
/**
|
|
348
|
+
* A drop-in replacement for `Promise.all` with the only difference
|
|
349
|
+
* that the method awaits every promise to either fulfill or reject.
|
|
350
|
+
*
|
|
351
|
+
* Similar to `Promise.all`, only the first error will be returned
|
|
352
|
+
* if any.
|
|
353
|
+
*/
|
|
354
|
+
function settled<T>(promises: Promise<T>[]): Promise<T[]>;
|
|
355
|
+
/**
|
|
356
|
+
* A helper to create a new `Promise<T>` with a body that is a promise
|
|
357
|
+
* itself. By default, an error that raises from the async body will
|
|
358
|
+
* end up as a unhandled rejection, so this utility properly awaits the
|
|
359
|
+
* body and rejects the promise as a normal promise does without async
|
|
360
|
+
* body.
|
|
361
|
+
*
|
|
362
|
+
* This method should only be used in rare cases where otherwise `async`
|
|
363
|
+
* cannot be used (e.g. when callbacks are involved that require this).
|
|
364
|
+
*/
|
|
365
|
+
function withAsyncBody<T, E = Error>(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise<unknown>): Promise<T>;
|
|
366
|
+
}
|
|
367
|
+
export {};
|