@celljs/core 3.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/LICENSE +21 -0
- package/README.md +1 -0
- package/cell-remote.yml +3 -0
- package/cell.yml +15 -0
- package/lib/browser/application/frontend-application-state.d.ts +5 -0
- package/lib/browser/application/frontend-application-state.d.ts.map +1 -0
- package/lib/browser/application/frontend-application-state.js +17 -0
- package/lib/browser/application/frontend-application-state.js.map +1 -0
- package/lib/browser/application/frontend-application.d.ts +31 -0
- package/lib/browser/application/frontend-application.d.ts.map +1 -0
- package/lib/browser/application/frontend-application.js +145 -0
- package/lib/browser/application/frontend-application.js.map +1 -0
- package/lib/browser/application/index.d.ts +3 -0
- package/lib/browser/application/index.d.ts.map +1 -0
- package/lib/browser/application/index.js +19 -0
- package/lib/browser/application/index.js.map +1 -0
- package/lib/browser/browser.d.ts +23 -0
- package/lib/browser/browser.d.ts.map +1 -0
- package/lib/browser/browser.js +53 -0
- package/lib/browser/browser.js.map +1 -0
- package/lib/browser/index.d.ts +4 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +20 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/shell/application-shell.d.ts +5 -0
- package/lib/browser/shell/application-shell.d.ts.map +1 -0
- package/lib/browser/shell/application-shell.js +21 -0
- package/lib/browser/shell/application-shell.js.map +1 -0
- package/lib/browser/shell/index.d.ts +3 -0
- package/lib/browser/shell/index.d.ts.map +1 -0
- package/lib/browser/shell/index.js +19 -0
- package/lib/browser/shell/index.js.map +1 -0
- package/lib/browser/shell/shell-protocol.d.ts +5 -0
- package/lib/browser/shell/shell-protocol.d.ts.map +1 -0
- package/lib/browser/shell/shell-protocol.js +5 -0
- package/lib/browser/shell/shell-protocol.js.map +1 -0
- package/lib/browser/static-module.d.ts +4 -0
- package/lib/browser/static-module.d.ts.map +1 -0
- package/lib/browser/static-module.js +6 -0
- package/lib/browser/static-module.js.map +1 -0
- package/lib/common/annotation/aspect.d.ts +8 -0
- package/lib/common/annotation/aspect.d.ts.map +1 -0
- package/lib/common/annotation/aspect.js +14 -0
- package/lib/common/annotation/aspect.js.map +1 -0
- package/lib/common/annotation/autowired-provider.d.ts +8 -0
- package/lib/common/annotation/autowired-provider.d.ts.map +1 -0
- package/lib/common/annotation/autowired-provider.js +31 -0
- package/lib/common/annotation/autowired-provider.js.map +1 -0
- package/lib/common/annotation/autowired.d.ts +23 -0
- package/lib/common/annotation/autowired.d.ts.map +1 -0
- package/lib/common/annotation/autowired.js +55 -0
- package/lib/common/annotation/autowired.js.map +1 -0
- package/lib/common/annotation/component.d.ts +58 -0
- package/lib/common/annotation/component.d.ts.map +1 -0
- package/lib/common/annotation/component.js +71 -0
- package/lib/common/annotation/component.js.map +1 -0
- package/lib/common/annotation/constant.d.ts +9 -0
- package/lib/common/annotation/constant.d.ts.map +1 -0
- package/lib/common/annotation/constant.js +17 -0
- package/lib/common/annotation/constant.js.map +1 -0
- package/lib/common/annotation/decorate.d.ts +2 -0
- package/lib/common/annotation/decorate.d.ts.map +1 -0
- package/lib/common/annotation/decorate.js +6 -0
- package/lib/common/annotation/decorate.js.map +1 -0
- package/lib/common/annotation/detached/autowired-provider.d.ts +3 -0
- package/lib/common/annotation/detached/autowired-provider.d.ts.map +1 -0
- package/lib/common/annotation/detached/autowired-provider.js +16 -0
- package/lib/common/annotation/detached/autowired-provider.js.map +1 -0
- package/lib/common/annotation/detached/autowired.d.ts +3 -0
- package/lib/common/annotation/detached/autowired.d.ts.map +1 -0
- package/lib/common/annotation/detached/autowired.js +13 -0
- package/lib/common/annotation/detached/autowired.js.map +1 -0
- package/lib/common/annotation/detached/index.d.ts +4 -0
- package/lib/common/annotation/detached/index.d.ts.map +1 -0
- package/lib/common/annotation/detached/index.js +20 -0
- package/lib/common/annotation/detached/index.js.map +1 -0
- package/lib/common/annotation/detached/value.d.ts +3 -0
- package/lib/common/annotation/detached/value.d.ts.map +1 -0
- package/lib/common/annotation/detached/value.js +13 -0
- package/lib/common/annotation/detached/value.js.map +1 -0
- package/lib/common/annotation/index.d.ts +18 -0
- package/lib/common/annotation/index.d.ts.map +1 -0
- package/lib/common/annotation/index.js +34 -0
- package/lib/common/annotation/index.js.map +1 -0
- package/lib/common/annotation/inject.d.ts +2 -0
- package/lib/common/annotation/inject.d.ts.map +1 -0
- package/lib/common/annotation/inject.js +6 -0
- package/lib/common/annotation/inject.js.map +1 -0
- package/lib/common/annotation/injectable.d.ts +2 -0
- package/lib/common/annotation/injectable.d.ts.map +1 -0
- package/lib/common/annotation/injectable.js +6 -0
- package/lib/common/annotation/injectable.js.map +1 -0
- package/lib/common/annotation/named.d.ts +2 -0
- package/lib/common/annotation/named.d.ts.map +1 -0
- package/lib/common/annotation/named.js +6 -0
- package/lib/common/annotation/named.js.map +1 -0
- package/lib/common/annotation/optional.d.ts +2 -0
- package/lib/common/annotation/optional.d.ts.map +1 -0
- package/lib/common/annotation/optional.js +6 -0
- package/lib/common/annotation/optional.js.map +1 -0
- package/lib/common/annotation/post-construct.d.ts +2 -0
- package/lib/common/annotation/post-construct.d.ts.map +1 -0
- package/lib/common/annotation/post-construct.js +6 -0
- package/lib/common/annotation/post-construct.js.map +1 -0
- package/lib/common/annotation/pre-destroy.d.ts +2 -0
- package/lib/common/annotation/pre-destroy.d.ts.map +1 -0
- package/lib/common/annotation/pre-destroy.js +6 -0
- package/lib/common/annotation/pre-destroy.js.map +1 -0
- package/lib/common/annotation/service.d.ts +5 -0
- package/lib/common/annotation/service.d.ts.map +1 -0
- package/lib/common/annotation/service.js +18 -0
- package/lib/common/annotation/service.js.map +1 -0
- package/lib/common/annotation/tagged.d.ts +2 -0
- package/lib/common/annotation/tagged.d.ts.map +1 -0
- package/lib/common/annotation/tagged.js +6 -0
- package/lib/common/annotation/tagged.js.map +1 -0
- package/lib/common/annotation/target-name.d.ts +2 -0
- package/lib/common/annotation/target-name.d.ts.map +1 -0
- package/lib/common/annotation/target-name.js +6 -0
- package/lib/common/annotation/target-name.js.map +1 -0
- package/lib/common/annotation/unmanaged.d.ts +2 -0
- package/lib/common/annotation/unmanaged.d.ts.map +1 -0
- package/lib/common/annotation/unmanaged.js +6 -0
- package/lib/common/annotation/unmanaged.js.map +1 -0
- package/lib/common/annotation/value.d.ts +16 -0
- package/lib/common/annotation/value.d.ts.map +1 -0
- package/lib/common/annotation/value.js +58 -0
- package/lib/common/annotation/value.js.map +1 -0
- package/lib/common/aop/aop-protocol.d.ts +41 -0
- package/lib/common/aop/aop-protocol.d.ts.map +1 -0
- package/lib/common/aop/aop-protocol.js +11 -0
- package/lib/common/aop/aop-protocol.js.map +1 -0
- package/lib/common/aop/aop-proxy-factory.d.ts +7 -0
- package/lib/common/aop/aop-proxy-factory.d.ts.map +1 -0
- package/lib/common/aop/aop-proxy-factory.js +70 -0
- package/lib/common/aop/aop-proxy-factory.js.map +1 -0
- package/lib/common/aop/class-filter.d.ts +7 -0
- package/lib/common/aop/class-filter.d.ts.map +1 -0
- package/lib/common/aop/class-filter.js +31 -0
- package/lib/common/aop/class-filter.js.map +1 -0
- package/lib/common/aop/index.d.ts +4 -0
- package/lib/common/aop/index.d.ts.map +1 -0
- package/lib/common/aop/index.js +20 -0
- package/lib/common/aop/index.js.map +1 -0
- package/lib/common/application/application-entry.d.ts +2 -0
- package/lib/common/application/application-entry.d.ts.map +1 -0
- package/lib/common/application/application-entry.js +16 -0
- package/lib/common/application/application-entry.js.map +1 -0
- package/lib/common/application/application-error.d.ts +21 -0
- package/lib/common/application/application-error.d.ts.map +1 -0
- package/lib/common/application/application-error.js +47 -0
- package/lib/common/application/application-error.js.map +1 -0
- package/lib/common/application/application-factory.d.ts +8 -0
- package/lib/common/application/application-factory.d.ts.map +1 -0
- package/lib/common/application/application-factory.js +23 -0
- package/lib/common/application/application-factory.js.map +1 -0
- package/lib/common/application/application-protocol.d.ts +54 -0
- package/lib/common/application/application-protocol.d.ts.map +1 -0
- package/lib/common/application/application-protocol.js +108 -0
- package/lib/common/application/application-protocol.js.map +1 -0
- package/lib/common/application/application-state.d.ts +4 -0
- package/lib/common/application/application-state.d.ts.map +1 -0
- package/lib/common/application/application-state.js +18 -0
- package/lib/common/application/application-state.js.map +1 -0
- package/lib/common/application/application.d.ts +7 -0
- package/lib/common/application/application.d.ts.map +1 -0
- package/lib/common/application/application.js +34 -0
- package/lib/common/application/application.js.map +1 -0
- package/lib/common/application/index.d.ts +3 -0
- package/lib/common/application/index.d.ts.map +1 -0
- package/lib/common/application/index.js +19 -0
- package/lib/common/application/index.js.map +1 -0
- package/lib/common/config/config-protocol.d.ts +5 -0
- package/lib/common/config/config-protocol.d.ts.map +1 -0
- package/lib/common/config/config-protocol.js +5 -0
- package/lib/common/config/config-protocol.js.map +1 -0
- package/lib/common/config/config-provider.d.ts +7 -0
- package/lib/common/config/config-provider.d.ts.map +1 -0
- package/lib/common/config/config-provider.js +29 -0
- package/lib/common/config/config-provider.js.map +1 -0
- package/lib/common/config/config-util.d.ts +5 -0
- package/lib/common/config/config-util.d.ts.map +1 -0
- package/lib/common/config/config-util.js +19 -0
- package/lib/common/config/config-util.js.map +1 -0
- package/lib/common/config/dynamic-config.d.ts +4 -0
- package/lib/common/config/dynamic-config.d.ts.map +1 -0
- package/lib/common/config/dynamic-config.js +6 -0
- package/lib/common/config/dynamic-config.js.map +1 -0
- package/lib/common/config/index.d.ts +4 -0
- package/lib/common/config/index.d.ts.map +1 -0
- package/lib/common/config/index.js +20 -0
- package/lib/common/config/index.js.map +1 -0
- package/lib/common/constants.d.ts +6 -0
- package/lib/common/constants.d.ts.map +1 -0
- package/lib/common/constants.js +9 -0
- package/lib/common/constants.js.map +1 -0
- package/lib/common/container/auto-bind.d.ts +4 -0
- package/lib/common/container/auto-bind.d.ts.map +1 -0
- package/lib/common/container/auto-bind.js +103 -0
- package/lib/common/container/auto-bind.js.map +1 -0
- package/lib/common/container/container-factory.d.ts +5 -0
- package/lib/common/container/container-factory.d.ts.map +1 -0
- package/lib/common/container/container-factory.js +13 -0
- package/lib/common/container/container-factory.js.map +1 -0
- package/lib/common/container/container-provider.d.ts +7 -0
- package/lib/common/container/container-provider.d.ts.map +1 -0
- package/lib/common/container/container-provider.js +26 -0
- package/lib/common/container/container-provider.js.map +1 -0
- package/lib/common/container/container-util.d.ts +10 -0
- package/lib/common/container/container-util.d.ts.map +1 -0
- package/lib/common/container/container-util.js +32 -0
- package/lib/common/container/container-util.js.map +1 -0
- package/lib/common/container/dynamic-container.d.ts +3 -0
- package/lib/common/container/dynamic-container.d.ts.map +1 -0
- package/lib/common/container/dynamic-container.js +7 -0
- package/lib/common/container/dynamic-container.js.map +1 -0
- package/lib/common/container/index.d.ts +9 -0
- package/lib/common/container/index.d.ts.map +1 -0
- package/lib/common/container/index.js +22 -0
- package/lib/common/container/index.js.map +1 -0
- package/lib/common/container/scope.d.ts +6 -0
- package/lib/common/container/scope.d.ts.map +1 -0
- package/lib/common/container/scope.js +10 -0
- package/lib/common/container/scope.js.map +1 -0
- package/lib/common/el/core-context-initializer.d.ts +7 -0
- package/lib/common/el/core-context-initializer.d.ts.map +1 -0
- package/lib/common/el/core-context-initializer.js +39 -0
- package/lib/common/el/core-context-initializer.js.map +1 -0
- package/lib/common/el/expression-compiler.d.ts +18 -0
- package/lib/common/el/expression-compiler.d.ts.map +1 -0
- package/lib/common/el/expression-compiler.js +171 -0
- package/lib/common/el/expression-compiler.js.map +1 -0
- package/lib/common/el/expression-context-provider.d.ts +10 -0
- package/lib/common/el/expression-context-provider.d.ts.map +1 -0
- package/lib/common/el/expression-context-provider.js +46 -0
- package/lib/common/el/expression-context-provider.js.map +1 -0
- package/lib/common/el/expression-handler.d.ts +12 -0
- package/lib/common/el/expression-handler.d.ts.map +1 -0
- package/lib/common/el/expression-handler.js +97 -0
- package/lib/common/el/expression-handler.js.map +1 -0
- package/lib/common/el/expression-protocol.d.ts +25 -0
- package/lib/common/el/expression-protocol.d.ts.map +1 -0
- package/lib/common/el/expression-protocol.js +9 -0
- package/lib/common/el/expression-protocol.js.map +1 -0
- package/lib/common/el/index.d.ts +7 -0
- package/lib/common/el/index.d.ts.map +1 -0
- package/lib/common/el/index.js +23 -0
- package/lib/common/el/index.js.map +1 -0
- package/lib/common/el/jexl-engine-provider.d.ts +6 -0
- package/lib/common/el/jexl-engine-provider.d.ts.map +1 -0
- package/lib/common/el/jexl-engine-provider.js +25 -0
- package/lib/common/el/jexl-engine-provider.js.map +1 -0
- package/lib/common/error/cutom-error.d.ts +4 -0
- package/lib/common/error/cutom-error.d.ts.map +1 -0
- package/lib/common/error/cutom-error.js +8 -0
- package/lib/common/error/cutom-error.js.map +1 -0
- package/lib/common/error/error-protocol.d.ts +4 -0
- package/lib/common/error/error-protocol.d.ts.map +1 -0
- package/lib/common/error/error-protocol.js +3 -0
- package/lib/common/error/error-protocol.js.map +1 -0
- package/lib/common/error/illegal-argument-error.d.ts +4 -0
- package/lib/common/error/illegal-argument-error.d.ts.map +1 -0
- package/lib/common/error/illegal-argument-error.js +8 -0
- package/lib/common/error/illegal-argument-error.js.map +1 -0
- package/lib/common/error/index.d.ts +4 -0
- package/lib/common/error/index.d.ts.map +1 -0
- package/lib/common/error/index.js +20 -0
- package/lib/common/error/index.js.map +1 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +29 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/logger/abstract-logger.d.ts +14 -0
- package/lib/common/logger/abstract-logger.d.ts.map +1 -0
- package/lib/common/logger/abstract-logger.js +39 -0
- package/lib/common/logger/abstract-logger.js.map +1 -0
- package/lib/common/logger/index.d.ts +4 -0
- package/lib/common/logger/index.d.ts.map +1 -0
- package/lib/common/logger/index.js +20 -0
- package/lib/common/logger/index.js.map +1 -0
- package/lib/common/logger/logger-protocol.d.ts +16 -0
- package/lib/common/logger/logger-protocol.d.ts.map +1 -0
- package/lib/common/logger/logger-protocol.js +8 -0
- package/lib/common/logger/logger-protocol.js.map +1 -0
- package/lib/common/logger/logger.d.ts +8 -0
- package/lib/common/logger/logger.d.ts.map +1 -0
- package/lib/common/logger/logger.js +38 -0
- package/lib/common/logger/logger.js.map +1 -0
- package/lib/common/provider/component-filter-registry.d.ts +12 -0
- package/lib/common/provider/component-filter-registry.d.ts.map +1 -0
- package/lib/common/provider/component-filter-registry.js +69 -0
- package/lib/common/provider/component-filter-registry.js.map +1 -0
- package/lib/common/provider/index.d.ts +6 -0
- package/lib/common/provider/index.d.ts.map +1 -0
- package/lib/common/provider/index.js +22 -0
- package/lib/common/provider/index.js.map +1 -0
- package/lib/common/provider/provider-creator.d.ts +7 -0
- package/lib/common/provider/provider-creator.d.ts.map +1 -0
- package/lib/common/provider/provider-creator.js +22 -0
- package/lib/common/provider/provider-creator.js.map +1 -0
- package/lib/common/provider/provider-protocol.d.ts +49 -0
- package/lib/common/provider/provider-protocol.d.ts.map +1 -0
- package/lib/common/provider/provider-protocol.js +8 -0
- package/lib/common/provider/provider-protocol.js.map +1 -0
- package/lib/common/provider/provider-util.d.ts +6 -0
- package/lib/common/provider/provider-util.d.ts.map +1 -0
- package/lib/common/provider/provider-util.js +13 -0
- package/lib/common/provider/provider-util.js.map +1 -0
- package/lib/common/provider/provider.d.ts +14 -0
- package/lib/common/provider/provider.d.ts.map +1 -0
- package/lib/common/provider/provider.js +58 -0
- package/lib/common/provider/provider.js.map +1 -0
- package/lib/common/static-module.d.ts +4 -0
- package/lib/common/static-module.d.ts.map +1 -0
- package/lib/common/static-module.js +11 -0
- package/lib/common/static-module.js.map +1 -0
- package/lib/common/test/index.d.ts +2 -0
- package/lib/common/test/index.d.ts.map +1 -0
- package/lib/common/test/index.js +18 -0
- package/lib/common/test/index.js.map +1 -0
- package/lib/common/test/mock-logger.d.ts +9 -0
- package/lib/common/test/mock-logger.d.ts.map +1 -0
- package/lib/common/test/mock-logger.js +32 -0
- package/lib/common/test/mock-logger.js.map +1 -0
- package/lib/common/test/test-module.d.ts +3 -0
- package/lib/common/test/test-module.d.ts.map +1 -0
- package/lib/common/test/test-module.js +15 -0
- package/lib/common/test/test-module.js.map +1 -0
- package/lib/common/utils/annotation-util.d.ts +5 -0
- package/lib/common/utils/annotation-util.d.ts.map +1 -0
- package/lib/common/utils/annotation-util.js +27 -0
- package/lib/common/utils/annotation-util.js.map +1 -0
- package/lib/common/utils/async.d.ts +368 -0
- package/lib/common/utils/async.d.ts.map +1 -0
- package/lib/common/utils/async.js +964 -0
- package/lib/common/utils/async.js.map +1 -0
- package/lib/common/utils/cancellation.d.ts +22 -0
- package/lib/common/utils/cancellation.d.ts.map +1 -0
- package/lib/common/utils/cancellation.js +95 -0
- package/lib/common/utils/cancellation.js.map +1 -0
- package/lib/common/utils/class-util.d.ts +3 -0
- package/lib/common/utils/class-util.d.ts.map +1 -0
- package/lib/common/utils/class-util.js +24 -0
- package/lib/common/utils/class-util.js.map +1 -0
- package/lib/common/utils/disposable.d.ts +30 -0
- package/lib/common/utils/disposable.d.ts.map +1 -0
- package/lib/common/utils/disposable.js +82 -0
- package/lib/common/utils/disposable.js.map +1 -0
- package/lib/common/utils/emitter.d.ts +64 -0
- package/lib/common/utils/emitter.d.ts.map +1 -0
- package/lib/common/utils/emitter.js +226 -0
- package/lib/common/utils/emitter.js.map +1 -0
- package/lib/common/utils/event.d.ts +41 -0
- package/lib/common/utils/event.d.ts.map +1 -0
- package/lib/common/utils/event.js +90 -0
- package/lib/common/utils/event.js.map +1 -0
- package/lib/common/utils/global-util.d.ts +2 -0
- package/lib/common/utils/global-util.d.ts.map +1 -0
- package/lib/common/utils/global-util.js +19 -0
- package/lib/common/utils/global-util.js.map +1 -0
- package/lib/common/utils/index.d.ts +17 -0
- package/lib/common/utils/index.d.ts.map +1 -0
- package/lib/common/utils/index.js +33 -0
- package/lib/common/utils/index.js.map +1 -0
- package/lib/common/utils/metadata-util.d.ts +2 -0
- package/lib/common/utils/metadata-util.d.ts.map +1 -0
- package/lib/common/utils/metadata-util.js +29 -0
- package/lib/common/utils/metadata-util.js.map +1 -0
- package/lib/common/utils/os.d.ts +20 -0
- package/lib/common/utils/os.d.ts.map +1 -0
- package/lib/common/utils/os.js +50 -0
- package/lib/common/utils/os.js.map +1 -0
- package/lib/common/utils/prioritizeable.d.ts +18 -0
- package/lib/common/utils/prioritizeable.d.ts.map +1 -0
- package/lib/common/utils/prioritizeable.js +41 -0
- package/lib/common/utils/prioritizeable.js.map +1 -0
- package/lib/common/utils/promise-util.d.ts +6 -0
- package/lib/common/utils/promise-util.d.ts.map +1 -0
- package/lib/common/utils/promise-util.js +13 -0
- package/lib/common/utils/promise-util.js.map +1 -0
- package/lib/common/utils/proxy-util.d.ts +5 -0
- package/lib/common/utils/proxy-util.d.ts.map +1 -0
- package/lib/common/utils/proxy-util.js +41 -0
- package/lib/common/utils/proxy-util.js.map +1 -0
- package/lib/common/utils/types.d.ts +13 -0
- package/lib/common/utils/types.d.ts.map +1 -0
- package/lib/common/utils/types.js +3 -0
- package/lib/common/utils/types.js.map +1 -0
- package/lib/common/utils/url-util.d.ts +4 -0
- package/lib/common/utils/url-util.d.ts.map +1 -0
- package/lib/common/utils/url-util.js +58 -0
- package/lib/common/utils/url-util.js.map +1 -0
- package/lib/common/utils/uuid.d.ts +3 -0
- package/lib/common/utils/uuid.d.ts.map +1 -0
- package/lib/common/utils/uuid.js +65 -0
- package/lib/common/utils/uuid.js.map +1 -0
- package/lib/node/application/backend-application-state.d.ts +5 -0
- package/lib/node/application/backend-application-state.d.ts.map +1 -0
- package/lib/node/application/backend-application-state.js +17 -0
- package/lib/node/application/backend-application-state.js.map +1 -0
- package/lib/node/application/backend-application.d.ts +12 -0
- package/lib/node/application/backend-application.d.ts.map +1 -0
- package/lib/node/application/backend-application.js +55 -0
- package/lib/node/application/backend-application.js.map +1 -0
- package/lib/node/application/index.d.ts +3 -0
- package/lib/node/application/index.d.ts.map +1 -0
- package/lib/node/application/index.js +19 -0
- package/lib/node/application/index.js.map +1 -0
- package/lib/node/constants.d.ts +16 -0
- package/lib/node/constants.d.ts.map +1 -0
- package/lib/node/constants.js +19 -0
- package/lib/node/constants.js.map +1 -0
- package/lib/node/context/context.d.ts +16 -0
- package/lib/node/context/context.d.ts.map +1 -0
- package/lib/node/context/context.js +60 -0
- package/lib/node/context/context.js.map +1 -0
- package/lib/node/context/index.d.ts +2 -0
- package/lib/node/context/index.d.ts.map +1 -0
- package/lib/node/context/index.js +18 -0
- package/lib/node/context/index.js.map +1 -0
- package/lib/node/index.d.ts +4 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +20 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/static-module.d.ts +4 -0
- package/lib/node/static-module.d.ts.map +1 -0
- package/lib/node/static-module.js +6 -0
- package/lib/node/static-module.js.map +1 -0
- package/lib/node/utils/crc.d.ts +2 -0
- package/lib/node/utils/crc.d.ts.map +1 -0
- package/lib/node/utils/crc.js +11 -0
- package/lib/node/utils/crc.js.map +1 -0
- package/lib/node/utils/index.d.ts +2 -0
- package/lib/node/utils/index.d.ts.map +1 -0
- package/lib/node/utils/index.js +18 -0
- package/lib/node/utils/index.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +55 -0
- package/src/browser/application/frontend-application-state.ts +11 -0
- package/src/browser/application/frontend-application.ts +142 -0
- package/src/browser/application/index.ts +2 -0
- package/src/browser/browser.ts +59 -0
- package/src/browser/index.ts +3 -0
- package/src/browser/shell/application-shell.ts +10 -0
- package/src/browser/shell/index.ts +2 -0
- package/src/browser/shell/shell-protocol.ts +5 -0
- package/src/browser/static-module.ts +4 -0
- package/src/common/annotation/aspect.ts +18 -0
- package/src/common/annotation/autowired-provider.ts +31 -0
- package/src/common/annotation/autowired.ts +76 -0
- package/src/common/annotation/component.ts +120 -0
- package/src/common/annotation/constant.ts +20 -0
- package/src/common/annotation/decorate.ts +1 -0
- package/src/common/annotation/detached/autowired-provider.ts +13 -0
- package/src/common/annotation/detached/autowired.ts +9 -0
- package/src/common/annotation/detached/index.ts +3 -0
- package/src/common/annotation/detached/value.ts +9 -0
- package/src/common/annotation/index.ts +17 -0
- package/src/common/annotation/inject.ts +1 -0
- package/src/common/annotation/injectable.ts +1 -0
- package/src/common/annotation/named.ts +1 -0
- package/src/common/annotation/optional.ts +1 -0
- package/src/common/annotation/post-construct.ts +1 -0
- package/src/common/annotation/pre-destroy.ts +1 -0
- package/src/common/annotation/service.ts +15 -0
- package/src/common/annotation/tagged.ts +1 -0
- package/src/common/annotation/target-name.ts +1 -0
- package/src/common/annotation/unmanaged.ts +1 -0
- package/src/common/annotation/value.ts +64 -0
- package/src/common/aop/aop-protocol.ts +57 -0
- package/src/common/aop/aop-proxy-factory.ts +61 -0
- package/src/common/aop/class-filter.ts +22 -0
- package/src/common/aop/index.ts +3 -0
- package/src/common/application/application-entry.ts +14 -0
- package/src/common/application/application-error.ts +57 -0
- package/src/common/application/application-factory.ts +20 -0
- package/src/common/application/application-protocol.ts +143 -0
- package/src/common/application/application-state.ts +7 -0
- package/src/common/application/application.ts +20 -0
- package/src/common/application/index.ts +2 -0
- package/src/common/config/config-protocol.ts +5 -0
- package/src/common/config/config-provider.ts +15 -0
- package/src/common/config/config-util.ts +14 -0
- package/src/common/config/dynamic-config.ts +2 -0
- package/src/common/config/index.ts +3 -0
- package/src/common/constants.ts +6 -0
- package/src/common/container/auto-bind.ts +101 -0
- package/src/common/container/container-factory.ts +9 -0
- package/src/common/container/container-provider.ts +23 -0
- package/src/common/container/container-util.ts +28 -0
- package/src/common/container/dynamic-container.ts +4 -0
- package/src/common/container/index.ts +9 -0
- package/src/common/container/scope.ts +3 -0
- package/src/common/el/core-context-initializer.ts +25 -0
- package/src/common/el/expression-compiler.ts +157 -0
- package/src/common/el/expression-context-provider.ts +34 -0
- package/src/common/el/expression-handler.ts +84 -0
- package/src/common/el/expression-protocol.ts +36 -0
- package/src/common/el/index.ts +6 -0
- package/src/common/el/jexl-engine-provider.ts +18 -0
- package/src/common/error/cutom-error.ts +5 -0
- package/src/common/error/error-protocol.ts +4 -0
- package/src/common/error/illegal-argument-error.ts +5 -0
- package/src/common/error/index.ts +3 -0
- package/src/common/index.ts +12 -0
- package/src/common/logger/abstract-logger.ts +32 -0
- package/src/common/logger/index.ts +3 -0
- package/src/common/logger/logger-protocol.ts +23 -0
- package/src/common/logger/logger.ts +31 -0
- package/src/common/provider/component-filter-registry.ts +56 -0
- package/src/common/provider/index.ts +6 -0
- package/src/common/provider/provider-creator.ts +12 -0
- package/src/common/provider/provider-protocol.ts +59 -0
- package/src/common/provider/provider-util.ts +10 -0
- package/src/common/provider/provider.ts +63 -0
- package/src/common/static-module.ts +9 -0
- package/src/common/test/index.ts +1 -0
- package/src/common/test/mock-logger.ts +21 -0
- package/src/common/test/test-module.ts +12 -0
- package/src/common/utils/annotation-util.ts +21 -0
- package/src/common/utils/async.ts +1222 -0
- package/src/common/utils/cancellation.ts +112 -0
- package/src/common/utils/class-util.ts +20 -0
- package/src/common/utils/disposable.ts +94 -0
- package/src/common/utils/emitter.ts +268 -0
- package/src/common/utils/event.ts +124 -0
- package/src/common/utils/global-util.ts +16 -0
- package/src/common/utils/index.ts +16 -0
- package/src/common/utils/metadata-util.ts +24 -0
- package/src/common/utils/os.ts +49 -0
- package/src/common/utils/prioritizeable.ts +44 -0
- package/src/common/utils/promise-util.ts +9 -0
- package/src/common/utils/proxy-util.ts +36 -0
- package/src/common/utils/types.ts +13 -0
- package/src/common/utils/url-util.ts +64 -0
- package/src/common/utils/uuid.ts +75 -0
- package/src/node/application/backend-application-state.ts +9 -0
- package/src/node/application/backend-application.ts +43 -0
- package/src/node/application/index.ts +2 -0
- package/src/node/constants.ts +16 -0
- package/src/node/context/context.ts +58 -0
- package/src/node/context/index.ts +1 -0
- package/src/node/index.ts +3 -0
- package/src/node/static-module.ts +4 -0
- package/src/node/utils/crc.ts +7 -0
- package/src/node/utils/index.ts +1 -0
- package/src/package.spec.ts +4 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Event } from './event';
|
|
2
|
+
import { Emitter } from './emitter';
|
|
3
|
+
|
|
4
|
+
export class CancellationError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Canceled');
|
|
7
|
+
this.name = this.message;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CancellationToken {
|
|
12
|
+
readonly isCancellationRequested: boolean;
|
|
13
|
+
/*
|
|
14
|
+
* An event emitted when cancellation is requested
|
|
15
|
+
* @event
|
|
16
|
+
*/
|
|
17
|
+
readonly onCancellationRequested: Event<void>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
const shortcutEvent: Event<void> = Object.freeze(Object.assign(function (callback: any, context?: any): any {
|
|
22
|
+
const handle = setTimeout(callback.bind(context), 0);
|
|
23
|
+
return { dispose(): void { clearTimeout(handle); } };
|
|
24
|
+
}, { maxListeners: 0 }));
|
|
25
|
+
|
|
26
|
+
export namespace CancellationToken {
|
|
27
|
+
|
|
28
|
+
export const None: CancellationToken = Object.freeze({
|
|
29
|
+
isCancellationRequested: false,
|
|
30
|
+
onCancellationRequested: Event.None
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Cancelled: CancellationToken = Object.freeze({
|
|
34
|
+
isCancellationRequested: true,
|
|
35
|
+
onCancellationRequested: shortcutEvent
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class MutableToken implements CancellationToken {
|
|
40
|
+
|
|
41
|
+
private _isCancelled: boolean = false;
|
|
42
|
+
private _emitter: Emitter<void> | undefined;
|
|
43
|
+
|
|
44
|
+
public cancel(): void {
|
|
45
|
+
if (!this._isCancelled) {
|
|
46
|
+
this._isCancelled = true;
|
|
47
|
+
if (this._emitter) {
|
|
48
|
+
this._emitter.fire(undefined);
|
|
49
|
+
this._emitter = undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get isCancellationRequested(): boolean {
|
|
55
|
+
return this._isCancelled;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get onCancellationRequested(): Event<void> {
|
|
59
|
+
if (this._isCancelled) {
|
|
60
|
+
return shortcutEvent;
|
|
61
|
+
}
|
|
62
|
+
if (!this._emitter) {
|
|
63
|
+
this._emitter = new Emitter<void>();
|
|
64
|
+
}
|
|
65
|
+
return this._emitter.event;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class CancellationTokenSource {
|
|
70
|
+
|
|
71
|
+
private _token: CancellationToken;
|
|
72
|
+
|
|
73
|
+
get token(): CancellationToken {
|
|
74
|
+
if (!this._token) {
|
|
75
|
+
// be lazy and create the token only when
|
|
76
|
+
// actually needed
|
|
77
|
+
this._token = new MutableToken();
|
|
78
|
+
}
|
|
79
|
+
return this._token;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
cancel(): void {
|
|
83
|
+
if (!this._token) {
|
|
84
|
+
// save an object by returning the default
|
|
85
|
+
// cancelled token when cancellation happens
|
|
86
|
+
// before someone asks for the token
|
|
87
|
+
this._token = CancellationToken.Cancelled;
|
|
88
|
+
} else if (this._token !== CancellationToken.Cancelled) {
|
|
89
|
+
(<MutableToken>this._token).cancel();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
dispose(): void {
|
|
94
|
+
this.cancel();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const cancelledMessage = 'Cancelled';
|
|
99
|
+
|
|
100
|
+
export function cancelled(): Error {
|
|
101
|
+
return new Error(cancelledMessage);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function isCancelled(err: Error | undefined): boolean {
|
|
105
|
+
return !!err && err.message === cancelledMessage;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function checkCancelled(token?: CancellationToken): void {
|
|
109
|
+
if (!!token && token.isCancellationRequested) {
|
|
110
|
+
throw cancelled();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function getSuperClasses(constructor: any): any[] {
|
|
2
|
+
const constructors = [];
|
|
3
|
+
let current = constructor;
|
|
4
|
+
while (Object.getPrototypeOf(current)) {
|
|
5
|
+
current = Object.getPrototypeOf(current);
|
|
6
|
+
constructors.push(current);
|
|
7
|
+
}
|
|
8
|
+
return constructors;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getPropertyNames(obj: any) {
|
|
12
|
+
const propertyNames: string[] = [];
|
|
13
|
+
do {
|
|
14
|
+
propertyNames.push(...Object.getOwnPropertyNames(obj));
|
|
15
|
+
obj = Object.getPrototypeOf(obj);
|
|
16
|
+
} while (obj);
|
|
17
|
+
// get unique property names
|
|
18
|
+
|
|
19
|
+
return Array.from(new Set<string>(propertyNames));
|
|
20
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Event } from './event';
|
|
2
|
+
import { Emitter } from './emitter';
|
|
3
|
+
|
|
4
|
+
export interface Disposable {
|
|
5
|
+
/**
|
|
6
|
+
* Dispose this object.
|
|
7
|
+
*/
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export namespace Disposable {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
export function is(arg: any): arg is Disposable {
|
|
14
|
+
return !!arg && typeof arg === 'object' && 'dispose' in arg && typeof arg['dispose'] === 'function';
|
|
15
|
+
}
|
|
16
|
+
export function create(func: () => void): Disposable {
|
|
17
|
+
return {
|
|
18
|
+
dispose: func
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export const NULL = create(() => { });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class DisposableCollection implements Disposable {
|
|
25
|
+
|
|
26
|
+
protected readonly disposables: Disposable[] = [];
|
|
27
|
+
protected readonly onDisposeEmitter = new Emitter<void>();
|
|
28
|
+
|
|
29
|
+
constructor(...toDispose: Disposable[]) {
|
|
30
|
+
toDispose.forEach(d => this.push(d));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This event is fired only once
|
|
35
|
+
* on first dispose of not empty collection.
|
|
36
|
+
*/
|
|
37
|
+
get onDispose(): Event<void> {
|
|
38
|
+
return this.onDisposeEmitter.event;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected checkDisposed(): void {
|
|
42
|
+
if (this.disposed && !this.disposingElements) {
|
|
43
|
+
this.onDisposeEmitter.fire(undefined);
|
|
44
|
+
this.onDisposeEmitter.dispose();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get disposed(): boolean {
|
|
49
|
+
return this.disposables.length === 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private disposingElements = false;
|
|
53
|
+
dispose(): void {
|
|
54
|
+
if (this.disposed || this.disposingElements) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.disposingElements = true;
|
|
58
|
+
while (!this.disposed) {
|
|
59
|
+
try {
|
|
60
|
+
this.disposables.pop()!.dispose();
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.error(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.disposingElements = false;
|
|
66
|
+
this.checkDisposed();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
push(disposable: Disposable): Disposable {
|
|
70
|
+
const disposables = this.disposables;
|
|
71
|
+
disposables.push(disposable);
|
|
72
|
+
const originalDispose = disposable.dispose.bind(disposable);
|
|
73
|
+
const toRemove = Disposable.create(() => {
|
|
74
|
+
const index = disposables.indexOf(disposable);
|
|
75
|
+
if (index !== -1) {
|
|
76
|
+
disposables.splice(index, 1);
|
|
77
|
+
}
|
|
78
|
+
this.checkDisposed();
|
|
79
|
+
});
|
|
80
|
+
disposable.dispose = () => {
|
|
81
|
+
toRemove.dispose();
|
|
82
|
+
disposable.dispose = originalDispose;
|
|
83
|
+
originalDispose();
|
|
84
|
+
};
|
|
85
|
+
return toRemove;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pushAll(disposables: Disposable[]): Disposable[] {
|
|
89
|
+
return disposables.map(disposable =>
|
|
90
|
+
this.push(disposable)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Event, Callback, CallbackList } from './event';
|
|
2
|
+
import { Disposable } from './disposable';
|
|
3
|
+
import { MaybePromise } from './prioritizeable';
|
|
4
|
+
|
|
5
|
+
export interface EmitterOptions {
|
|
6
|
+
onFirstListenerAdd?: Function;
|
|
7
|
+
onLastListenerRemove?: Function;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class Emitter<T = any> {
|
|
11
|
+
|
|
12
|
+
private static LEAK_WARNING_THRESHHOLD = 175;
|
|
13
|
+
|
|
14
|
+
private static _noop = function (): void { };
|
|
15
|
+
|
|
16
|
+
private _event: Event<T>;
|
|
17
|
+
protected _callbacks: CallbackList | undefined;
|
|
18
|
+
private _disposed = false;
|
|
19
|
+
|
|
20
|
+
private _leakingStacks: Map<string, number> | undefined;
|
|
21
|
+
private _leakWarnCountdown = 0;
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
private _options?: EmitterOptions
|
|
25
|
+
) { }
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* For the public to allow to subscribe
|
|
29
|
+
* to events from this Emitter
|
|
30
|
+
*/
|
|
31
|
+
get event(): Event<T> {
|
|
32
|
+
if (!this._event) {
|
|
33
|
+
this._event = Object.assign((listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => {
|
|
34
|
+
if (!this._callbacks) {
|
|
35
|
+
this._callbacks = new CallbackList();
|
|
36
|
+
}
|
|
37
|
+
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
|
38
|
+
this._options.onFirstListenerAdd(this);
|
|
39
|
+
}
|
|
40
|
+
this._callbacks.add(listener, thisArgs);
|
|
41
|
+
const removeMaxListenersCheck = this.checkMaxListeners(this._event.maxListeners);
|
|
42
|
+
|
|
43
|
+
const result: Disposable = {
|
|
44
|
+
dispose: () => {
|
|
45
|
+
if (removeMaxListenersCheck) {
|
|
46
|
+
removeMaxListenersCheck();
|
|
47
|
+
}
|
|
48
|
+
result.dispose = Emitter._noop;
|
|
49
|
+
if (!this._disposed) {
|
|
50
|
+
this._callbacks!.remove(listener, thisArgs);
|
|
51
|
+
result.dispose = Emitter._noop;
|
|
52
|
+
if (this._options && this._options.onLastListenerRemove && this._callbacks!.isEmpty()) {
|
|
53
|
+
this._options.onLastListenerRemove(this);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (Array.isArray(disposables)) {
|
|
59
|
+
disposables.push(result);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
}, {
|
|
64
|
+
maxListeners: Emitter.LEAK_WARNING_THRESHHOLD
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return this._event;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected checkMaxListeners(maxListeners: number): (() => void) | undefined {
|
|
72
|
+
if (maxListeners === 0 || !this._callbacks) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const listenerCount = this._callbacks.length;
|
|
76
|
+
if (listenerCount <= maxListeners) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const popStack = this.pushLeakingStack();
|
|
81
|
+
|
|
82
|
+
this._leakWarnCountdown -= 1;
|
|
83
|
+
if (this._leakWarnCountdown <= 0) {
|
|
84
|
+
// only warn on first exceed and then every time the limit
|
|
85
|
+
// is exceeded by 50% again
|
|
86
|
+
this._leakWarnCountdown = maxListeners * 0.5;
|
|
87
|
+
|
|
88
|
+
let topStack: string;
|
|
89
|
+
let topCount = 0;
|
|
90
|
+
this._leakingStacks!.forEach((stackCount, stack) => {
|
|
91
|
+
if (!topStack || topCount < stackCount) {
|
|
92
|
+
topStack = stack;
|
|
93
|
+
topCount = stackCount;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// eslint-disable-next-line max-len
|
|
98
|
+
console.warn(`Possible Emitter memory leak detected. ${listenerCount} listeners added. Use event.maxListeners to increase the limit (${maxListeners}). MOST frequent listener (${topCount}):`);
|
|
99
|
+
console.warn(topStack!);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return popStack;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
protected pushLeakingStack(): () => void {
|
|
106
|
+
if (!this._leakingStacks) {
|
|
107
|
+
this._leakingStacks = new Map();
|
|
108
|
+
}
|
|
109
|
+
const stack = new Error().stack!.split('\n').slice(3).join('\n');
|
|
110
|
+
const count = (this._leakingStacks.get(stack) || 0);
|
|
111
|
+
this._leakingStacks.set(stack, count + 1);
|
|
112
|
+
return () => this.popLeakingStack(stack);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
protected popLeakingStack(stack: string): void {
|
|
116
|
+
if (!this._leakingStacks) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const count = (this._leakingStacks.get(stack) || 0);
|
|
120
|
+
this._leakingStacks.set(stack, count - 1);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* To be kept private to fire an event to
|
|
125
|
+
* subscribers
|
|
126
|
+
*/
|
|
127
|
+
fire(event: T): any {
|
|
128
|
+
if (this._callbacks) {
|
|
129
|
+
this._callbacks.invoke(event);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Process each listener one by one.
|
|
135
|
+
* Return `false` to stop iterating over the listeners, `true` to continue.
|
|
136
|
+
*/
|
|
137
|
+
async sequence(processor: (listener: (e: T) => any) => MaybePromise<boolean>): Promise<void> {
|
|
138
|
+
if (this._callbacks) {
|
|
139
|
+
for (const listener of this._callbacks) {
|
|
140
|
+
if (!await processor(listener)) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
dispose(): void {
|
|
148
|
+
if (this._leakingStacks) {
|
|
149
|
+
this._leakingStacks.clear();
|
|
150
|
+
this._leakingStacks = undefined;
|
|
151
|
+
}
|
|
152
|
+
if (this._callbacks) {
|
|
153
|
+
this._callbacks.dispose();
|
|
154
|
+
this._callbacks = undefined;
|
|
155
|
+
}
|
|
156
|
+
this._disposed = true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface WaitUntilEvent {
|
|
161
|
+
/**
|
|
162
|
+
* Allows to pause the event loop until the provided thenable resolved.
|
|
163
|
+
*
|
|
164
|
+
* *Note:* It can only be called during event dispatch and not in an asynchronous manner
|
|
165
|
+
*
|
|
166
|
+
* @param thenable A thenable that delays execution.
|
|
167
|
+
*/
|
|
168
|
+
waitUntil(thenable: Promise<any>): void;
|
|
169
|
+
}
|
|
170
|
+
export namespace WaitUntilEvent {
|
|
171
|
+
/**
|
|
172
|
+
* Fire all listeners in the same tick.
|
|
173
|
+
*
|
|
174
|
+
* Use `AsyncEmitter.fire` to fire listeners async one after another.
|
|
175
|
+
*/
|
|
176
|
+
export async function fire<T extends WaitUntilEvent>(
|
|
177
|
+
emitter: Emitter<T>,
|
|
178
|
+
event: Omit<T, 'waitUntil'>,
|
|
179
|
+
timeout: number | undefined = undefined
|
|
180
|
+
): Promise<void> {
|
|
181
|
+
const waitables: Promise<void>[] = [];
|
|
182
|
+
const asyncEvent = Object.assign(event, {
|
|
183
|
+
waitUntil: (thenable: Promise<any>) => {
|
|
184
|
+
if (Object.isFrozen(waitables)) {
|
|
185
|
+
throw new Error('waitUntil cannot be called asynchronously.');
|
|
186
|
+
}
|
|
187
|
+
waitables.push(thenable);
|
|
188
|
+
}
|
|
189
|
+
}) as T;
|
|
190
|
+
try {
|
|
191
|
+
emitter.fire(asyncEvent);
|
|
192
|
+
// Asynchronous calls to `waitUntil` should fail.
|
|
193
|
+
Object.freeze(waitables);
|
|
194
|
+
} finally {
|
|
195
|
+
delete (asyncEvent as any)['waitUntil'];
|
|
196
|
+
}
|
|
197
|
+
if (!waitables.length) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (timeout !== undefined) {
|
|
201
|
+
await Promise.race([Promise.all(waitables), new Promise(resolve => setTimeout(resolve, timeout))]);
|
|
202
|
+
} else {
|
|
203
|
+
await Promise.all(waitables);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
import { CancellationToken } from './cancellation';
|
|
209
|
+
|
|
210
|
+
export class AsyncEmitter<T extends WaitUntilEvent> extends Emitter<T> {
|
|
211
|
+
|
|
212
|
+
protected deliveryQueue: Promise<void> | undefined;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Fire listeners async one after another.
|
|
216
|
+
*/
|
|
217
|
+
override fire(event: Omit<T, 'waitUntil'>, token: CancellationToken = CancellationToken.None,
|
|
218
|
+
promiseJoin?: (p: Promise<any>, listener: Function) => Promise<any>): Promise<void> {
|
|
219
|
+
const callbacks = this._callbacks;
|
|
220
|
+
if (!callbacks) {
|
|
221
|
+
return Promise.resolve();
|
|
222
|
+
}
|
|
223
|
+
const listeners = [...callbacks];
|
|
224
|
+
if (this.deliveryQueue) {
|
|
225
|
+
return this.deliveryQueue = this.deliveryQueue.then(() => this.deliver(listeners, event, token, promiseJoin));
|
|
226
|
+
}
|
|
227
|
+
return this.deliveryQueue = this.deliver(listeners, event, token, promiseJoin);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
protected async deliver(listeners: Callback[], event: Omit<T, 'waitUntil'>, token: CancellationToken,
|
|
231
|
+
promiseJoin?: (p: Promise<any>, listener: Function) => Promise<any>): Promise<void> {
|
|
232
|
+
for (const listener of listeners) {
|
|
233
|
+
if (token.isCancellationRequested) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const waitables: Promise<void>[] = [];
|
|
237
|
+
const asyncEvent = Object.assign(event, {
|
|
238
|
+
waitUntil: (thenable: Promise<any>) => {
|
|
239
|
+
if (Object.isFrozen(waitables)) {
|
|
240
|
+
throw new Error('waitUntil cannot be called asynchronously.');
|
|
241
|
+
}
|
|
242
|
+
if (promiseJoin) {
|
|
243
|
+
thenable = promiseJoin(thenable, listener);
|
|
244
|
+
}
|
|
245
|
+
waitables.push(thenable);
|
|
246
|
+
}
|
|
247
|
+
}) as T;
|
|
248
|
+
try {
|
|
249
|
+
listener(event);
|
|
250
|
+
// Asynchronous calls to `waitUntil` should fail.
|
|
251
|
+
Object.freeze(waitables);
|
|
252
|
+
} catch (e) {
|
|
253
|
+
console.error(e);
|
|
254
|
+
} finally {
|
|
255
|
+
delete (asyncEvent as any)['waitUntil'];
|
|
256
|
+
}
|
|
257
|
+
if (!waitables.length) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
await Promise.all(waitables);
|
|
262
|
+
} catch (e) {
|
|
263
|
+
console.error(e);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import { Disposable } from './disposable';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a typed event.
|
|
7
|
+
*/
|
|
8
|
+
export interface Event<T> {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param listener The listener function will be call when the event happens.
|
|
13
|
+
* @param thisArgs The 'this' which will be used when calling the event listener.
|
|
14
|
+
* @param disposables An array to which a {{IDisposable}} will be added.
|
|
15
|
+
* @return a disposable to remove the listener again.
|
|
16
|
+
*/
|
|
17
|
+
(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
|
|
18
|
+
/**
|
|
19
|
+
* An emitter will print a warning if more listeners are added for this event.
|
|
20
|
+
* The event.maxListeners allows the limit to be modified for this specific event.
|
|
21
|
+
* The value can be set to 0 to indicate an unlimited number of listener.
|
|
22
|
+
*/
|
|
23
|
+
maxListeners: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export namespace Event {
|
|
27
|
+
const _disposable = { dispose(): void { } };
|
|
28
|
+
export const None: Event<any> = Object.assign(function (): { dispose(): void } { return _disposable; }, {
|
|
29
|
+
get maxListeners(): number { return 0; },
|
|
30
|
+
set maxListeners(maxListeners: number) { }
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Given an event and a `map` function, returns another event which maps each element
|
|
35
|
+
* through the mapping function.
|
|
36
|
+
*/
|
|
37
|
+
export function map<I, O>(event: Event<I>, mapFunc: (i: I) => O): Event<O> {
|
|
38
|
+
return Object.assign((listener: (e: O) => any, thisArgs?: any, disposables?: Disposable[]) => event(i => listener.call(thisArgs, mapFunc(i)), undefined, disposables), {
|
|
39
|
+
maxListeners: 0,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type Callback = (...args: any[]) => any;
|
|
45
|
+
export class CallbackList implements Iterable<Callback> {
|
|
46
|
+
|
|
47
|
+
private _callbacks: Function[] | undefined;
|
|
48
|
+
private _contexts: any[] | undefined;
|
|
49
|
+
|
|
50
|
+
get length(): number {
|
|
51
|
+
return this._callbacks && this._callbacks.length || 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public add(callback: Function, context: any = undefined, bucket?: Disposable[]): void {
|
|
55
|
+
if (!this._callbacks) {
|
|
56
|
+
this._callbacks = [];
|
|
57
|
+
this._contexts = [];
|
|
58
|
+
}
|
|
59
|
+
this._callbacks.push(callback);
|
|
60
|
+
this._contexts!.push(context);
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(bucket)) {
|
|
63
|
+
bucket.push({ dispose: () => this.remove(callback, context) });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public remove(callback: Function, context: any = undefined): void {
|
|
68
|
+
if (!this._callbacks) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let foundCallbackWithDifferentContext = false;
|
|
73
|
+
for (let i = 0; i < this._callbacks.length; i++) {
|
|
74
|
+
if (this._callbacks[i] === callback) {
|
|
75
|
+
if (this._contexts![i] === context) {
|
|
76
|
+
// callback & context match => remove it
|
|
77
|
+
this._callbacks.splice(i, 1);
|
|
78
|
+
this._contexts!.splice(i, 1);
|
|
79
|
+
return;
|
|
80
|
+
} else {
|
|
81
|
+
foundCallbackWithDifferentContext = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (foundCallbackWithDifferentContext) {
|
|
87
|
+
throw new Error('When adding a listener with a context, you should remove it with the same context');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// tslint:disable-next-line:typedef
|
|
92
|
+
public [Symbol.iterator]() {
|
|
93
|
+
if (!this._callbacks) {
|
|
94
|
+
return [][Symbol.iterator]();
|
|
95
|
+
}
|
|
96
|
+
const callbacks = this._callbacks.slice(0);
|
|
97
|
+
const contexts = this._contexts!.slice(0);
|
|
98
|
+
|
|
99
|
+
return callbacks.map((callback, i) =>
|
|
100
|
+
(...args: any[]) => callback.apply(contexts[i], args)
|
|
101
|
+
)[Symbol.iterator]();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public invoke(...args: any[]): any[] {
|
|
105
|
+
const ret: any[] = [];
|
|
106
|
+
for (const callback of this) {
|
|
107
|
+
try {
|
|
108
|
+
ret.push(callback(...args));
|
|
109
|
+
} catch (e) {
|
|
110
|
+
console.error(e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return ret;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public isEmpty(): boolean {
|
|
117
|
+
return !this._callbacks || this._callbacks.length === 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public dispose(): void {
|
|
121
|
+
this._callbacks = undefined;
|
|
122
|
+
this._contexts = undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function getGlobalThis() {
|
|
2
|
+
if (typeof globalThis !== 'undefined') {
|
|
3
|
+
return globalThis;
|
|
4
|
+
}
|
|
5
|
+
if (typeof global !== 'undefined') {
|
|
6
|
+
return global;
|
|
7
|
+
}
|
|
8
|
+
if (typeof window !== 'undefined') {
|
|
9
|
+
return window;
|
|
10
|
+
}
|
|
11
|
+
if (typeof self !== 'undefined') {
|
|
12
|
+
return self;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const currentThis: any = getGlobalThis();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './prioritizeable';
|
|
2
|
+
export * from './promise-util';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './class-util';
|
|
5
|
+
export * from './metadata-util';
|
|
6
|
+
export * from './disposable';
|
|
7
|
+
export * from './os';
|
|
8
|
+
export * from './proxy-util';
|
|
9
|
+
export * from './annotation-util';
|
|
10
|
+
export * from './cancellation';
|
|
11
|
+
export * from './event';
|
|
12
|
+
export * from './emitter';
|
|
13
|
+
export * from './global-util';
|
|
14
|
+
export * from './async';
|
|
15
|
+
export * from './url-util';
|
|
16
|
+
export * from './uuid';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getSuperClasses } from './class-util';
|
|
2
|
+
|
|
3
|
+
export function getOwnMetadata(metadataKey: string, constructor: Object, propertyKey?: string | symbol): any {
|
|
4
|
+
const constructors = [ constructor, ...getSuperClasses(constructor) ];
|
|
5
|
+
let result: any[] = [];
|
|
6
|
+
for (let index = 0; index < constructors.length; index++) {
|
|
7
|
+
const c = constructors[constructors.length - index - 1];
|
|
8
|
+
let metadata: any[];
|
|
9
|
+
if (propertyKey) {
|
|
10
|
+
metadata = Reflect.getOwnMetadata(metadataKey, c, propertyKey);
|
|
11
|
+
} else {
|
|
12
|
+
metadata = Reflect.getOwnMetadata(metadataKey, c);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (metadata) {
|
|
16
|
+
if (Array.isArray(metadata)) {
|
|
17
|
+
result = [ ...result, ...metadata ];
|
|
18
|
+
} else {
|
|
19
|
+
return [ metadata ];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|