@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,142 @@
|
|
|
1
|
+
import { ApplicationShell } from '../shell';
|
|
2
|
+
import { FrontendApplicationStateService } from './frontend-application-state';
|
|
3
|
+
import { parseCssTime } from '../browser';
|
|
4
|
+
import { Component, Autowired, MaybePromise,
|
|
5
|
+
ApplicationStateService, AbstractApplication, Application, Value } from '../../common';
|
|
6
|
+
|
|
7
|
+
@Component(Application)
|
|
8
|
+
export class FrontendApplication extends AbstractApplication {
|
|
9
|
+
|
|
10
|
+
@Autowired(ApplicationShell)
|
|
11
|
+
protected readonly _shell: ApplicationShell;
|
|
12
|
+
|
|
13
|
+
@Autowired(ApplicationStateService)
|
|
14
|
+
protected readonly stateService: FrontendApplicationStateService;
|
|
15
|
+
|
|
16
|
+
@Value('cell.hostDomId')
|
|
17
|
+
protected readonly hostDomId: string;
|
|
18
|
+
|
|
19
|
+
get shell(): ApplicationShell {
|
|
20
|
+
return this._shell;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async start(): Promise<void> {
|
|
24
|
+
await this.doStart();
|
|
25
|
+
this.stateService.state = 'started';
|
|
26
|
+
|
|
27
|
+
const host = await this.getHost();
|
|
28
|
+
this._shell.attach(host);
|
|
29
|
+
await new Promise<void>(resolve => requestAnimationFrame(() => resolve()));
|
|
30
|
+
this.stateService.state = 'attached_shell';
|
|
31
|
+
|
|
32
|
+
await this.revealShell(host);
|
|
33
|
+
this.registerEventListeners();
|
|
34
|
+
this.stateService.state = 'ready';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Return a promise to the host element to which the application shell is attached.
|
|
39
|
+
*/
|
|
40
|
+
protected getHost(): Promise<HTMLElement> {
|
|
41
|
+
if (document.body) {
|
|
42
|
+
return Promise.resolve(document.getElementById(this.hostDomId) || document.body);
|
|
43
|
+
}
|
|
44
|
+
return new Promise<HTMLElement>(resolve =>
|
|
45
|
+
window.addEventListener('load', () => resolve(document.getElementById(this.hostDomId) || document.body), { once: true })
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Return an HTML element that indicates the startup phase, e.g. with an animation or a splash screen.
|
|
51
|
+
*/
|
|
52
|
+
protected getStartupIndicator(host: HTMLElement): HTMLElement | undefined {
|
|
53
|
+
const startupElements = host.getElementsByClassName('cell-preload');
|
|
54
|
+
return startupElements.length === 0 ? undefined : startupElements[0] as HTMLElement;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Register global event listeners.
|
|
59
|
+
*/
|
|
60
|
+
protected registerEventListeners(): void {
|
|
61
|
+
window.addEventListener('unload', () => {
|
|
62
|
+
this.stateService.state = 'closing_window';
|
|
63
|
+
this.doStop();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* If a startup indicator is present, it is first hidden with the `cell-hidden` CSS class and then
|
|
69
|
+
* removed after a while. The delay until removal is taken from the CSS transition duration.
|
|
70
|
+
*/
|
|
71
|
+
protected revealShell(host: HTMLElement): Promise<void> {
|
|
72
|
+
const startupElem = this.getStartupIndicator(host);
|
|
73
|
+
if (startupElem) {
|
|
74
|
+
return new Promise(resolve => {
|
|
75
|
+
window.requestAnimationFrame(() => {
|
|
76
|
+
startupElem.classList.add('cell-hidden');
|
|
77
|
+
const preloadStyle = window.getComputedStyle(startupElem);
|
|
78
|
+
const transitionDuration = parseCssTime(preloadStyle.transitionDuration, 0);
|
|
79
|
+
window.setTimeout(() => {
|
|
80
|
+
const parent = startupElem.parentElement;
|
|
81
|
+
if (parent) {
|
|
82
|
+
parent.removeChild(startupElem);
|
|
83
|
+
}
|
|
84
|
+
resolve();
|
|
85
|
+
}, transitionDuration);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
return Promise.resolve();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
protected override async doStart(): Promise<void> {
|
|
94
|
+
for (const lifecycle of this.lifecycles) {
|
|
95
|
+
if (lifecycle.initialize) {
|
|
96
|
+
try {
|
|
97
|
+
lifecycle.initialize();
|
|
98
|
+
} catch (error) {
|
|
99
|
+
this.logger.error('Could not initialize lifecycle', error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// TODO
|
|
105
|
+
|
|
106
|
+
for (const lifecycle of this.lifecycles) {
|
|
107
|
+
if (lifecycle.onStart) {
|
|
108
|
+
try {
|
|
109
|
+
await this.measure(lifecycle.constructor.name + '.onStart',
|
|
110
|
+
() => lifecycle.onStart!(this)
|
|
111
|
+
);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
this.logger.error('Could not start lifecycle', error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
protected async measure<T>(name: string, fn: () => MaybePromise<T>): Promise<T> {
|
|
120
|
+
const startMark = name + '-start';
|
|
121
|
+
const endMark = name + '-end';
|
|
122
|
+
performance.mark(startMark);
|
|
123
|
+
const result = await fn();
|
|
124
|
+
performance.mark(endMark);
|
|
125
|
+
performance.measure(name, startMark, endMark);
|
|
126
|
+
for (const item of performance.getEntriesByName(name)) {
|
|
127
|
+
if (item.duration > 100) {
|
|
128
|
+
console.warn(item.name + ' is slow, took: ' + item.duration + ' ms');
|
|
129
|
+
} else {
|
|
130
|
+
console.debug(item.name + ' took ' + item.duration + ' ms');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
performance.clearMeasures(name);
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async stop(): Promise<void> {
|
|
138
|
+
this.doStop();
|
|
139
|
+
this.stateService.state = 'stoped';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
|
|
2
|
+
|
|
3
|
+
export const isIE = (userAgent.indexOf('Trident') >= 0);
|
|
4
|
+
export const isEdge = (userAgent.indexOf('Edge/') >= 0);
|
|
5
|
+
export const isEdgeOrIE = isIE || isEdge;
|
|
6
|
+
|
|
7
|
+
export const isOpera = (userAgent.indexOf('Opera') >= 0);
|
|
8
|
+
export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
|
|
9
|
+
export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
|
|
10
|
+
export const isChrome = (userAgent.indexOf('Chrome') >= 0);
|
|
11
|
+
export const isSafari = (userAgent.indexOf('Chrome') === -1) && (userAgent.indexOf('Safari') >= 0);
|
|
12
|
+
export const isIPad = (userAgent.indexOf('iPad') >= 0);
|
|
13
|
+
// tslint:disable-next-line:no-any
|
|
14
|
+
export const isNative = typeof (window as any).process !== 'undefined';
|
|
15
|
+
// tslint:disable-next-line:no-any
|
|
16
|
+
export const isBasicWasmSupported = typeof (window as any).WebAssembly !== 'undefined';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parse a magnitude value (e.g. width, height, left, top) from a CSS attribute value.
|
|
20
|
+
* Returns the given default value (or undefined) if the value cannot be determined,
|
|
21
|
+
* e.g. because it is a relative value like `50%` or `auto`.
|
|
22
|
+
*/
|
|
23
|
+
export function parseCssMagnitude(value: string | null, defaultValue: number): number;
|
|
24
|
+
export function parseCssMagnitude(value: string | null, defaultValue?: number): number | undefined {
|
|
25
|
+
if (value) {
|
|
26
|
+
let parsed: number;
|
|
27
|
+
if (value.endsWith('px')) {
|
|
28
|
+
parsed = parseFloat(value.substring(0, value.length - 2));
|
|
29
|
+
} else {
|
|
30
|
+
parsed = parseFloat(value);
|
|
31
|
+
}
|
|
32
|
+
if (!isNaN(parsed)) {
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return defaultValue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Parse the number of milliseconds from a CSS time value.
|
|
41
|
+
* Returns the given default value (or undefined) if the value cannot be determined.
|
|
42
|
+
*/
|
|
43
|
+
export function parseCssTime(time: string | null, defaultValue: number): number;
|
|
44
|
+
export function parseCssTime(time: string | null, defaultValue?: number): number | undefined {
|
|
45
|
+
if (time) {
|
|
46
|
+
let parsed: number;
|
|
47
|
+
if (time.endsWith('ms')) {
|
|
48
|
+
parsed = parseFloat(time.substring(0, time.length - 2));
|
|
49
|
+
} else if (time.endsWith('s')) {
|
|
50
|
+
parsed = parseFloat(time.substring(0, time.length - 1)) * 1000;
|
|
51
|
+
} else {
|
|
52
|
+
parsed = parseFloat(time);
|
|
53
|
+
}
|
|
54
|
+
if (!isNaN(parsed)) {
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return defaultValue;
|
|
59
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component } from '../../common';
|
|
2
|
+
import { ApplicationShell } from './shell-protocol';
|
|
3
|
+
|
|
4
|
+
@Component(ApplicationShell)
|
|
5
|
+
export class ApplicationShellImpl implements ApplicationShell {
|
|
6
|
+
attach(host: HTMLElement): void {
|
|
7
|
+
host.textContent = 'Hello, Cell.';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AOP_TAG } from '../aop/aop-protocol';
|
|
2
|
+
import { ComponentOption, applyComponentDecorator, COMPONENT_TAG, ComponentId, parseComponentOption } from './component';
|
|
3
|
+
|
|
4
|
+
export interface AspectOption extends ComponentOption {
|
|
5
|
+
id: ComponentId;
|
|
6
|
+
pointcut?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type AdviceOrAspectOption = ComponentId | AspectOption;
|
|
10
|
+
|
|
11
|
+
export const Aspect = (adviceOrAspectOption: AdviceOrAspectOption): ClassDecorator => (target: any) => {
|
|
12
|
+
const option = <AspectOption>parseComponentOption(target, adviceOrAspectOption);
|
|
13
|
+
option.id = Array.isArray(option.id) ? option.id[1] : option.id;
|
|
14
|
+
option.pointcut = option.pointcut || COMPONENT_TAG;
|
|
15
|
+
option.tag = { tag: AOP_TAG, value: option.pointcut };
|
|
16
|
+
applyComponentDecorator({ proxy: false, ...option }, target);
|
|
17
|
+
};
|
|
18
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { interfaces } from 'inversify';
|
|
2
|
+
import { applyAutowiredDecorator, DoInject, parseAutowiredOption, IdOrAutowiredOptionWithoutMulti } from './autowired';
|
|
3
|
+
import { Inject } from './inject';
|
|
4
|
+
import { Tagged } from './tagged';
|
|
5
|
+
import { ProviderCreator } from '../provider/provider-protocol';
|
|
6
|
+
import { ComponentId } from './component';
|
|
7
|
+
|
|
8
|
+
export const PROVIDER = Symbol('PROVIDER');
|
|
9
|
+
export const ID_KEY = Symbol('ID_KEY');
|
|
10
|
+
|
|
11
|
+
export const AutowiredProvider = function (idOrOption?: IdOrAutowiredOptionWithoutMulti): PropertyDecorator & ParameterDecorator {
|
|
12
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
13
|
+
const option = parseAutowiredOption(target, targetKey, index, idOrOption);
|
|
14
|
+
applyAutowiredDecorator(option, target, targetKey, index, doInjectForAutowiredProvider);
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const doInjectForAutowiredProvider: DoInject = (option, t, k, i) => {
|
|
19
|
+
Inject(PROVIDER)(t, k, i);
|
|
20
|
+
Tagged(ID_KEY, option.id!)(t, k, i);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function bindAutowiredProvider(bind: interfaces.Bind): any {
|
|
24
|
+
bind(PROVIDER).toDynamicValue(ctx => {
|
|
25
|
+
const id = ctx.currentRequest.target.getCustomTags()?.find(m => m.key === ID_KEY)!.value as ComponentId;
|
|
26
|
+
const providerCreator = ctx.container.get<ProviderCreator<any>>(ProviderCreator);
|
|
27
|
+
|
|
28
|
+
return providerCreator.create(id, ctx.container);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { inject, multiInject } from 'inversify';
|
|
2
|
+
import { ContainerUtil } from '../container';
|
|
3
|
+
import { ComponentId } from './component';
|
|
4
|
+
import { AnnotationUtil } from '../utils';
|
|
5
|
+
|
|
6
|
+
export interface AutowiredOption {
|
|
7
|
+
id?: ComponentId,
|
|
8
|
+
multi?: boolean;
|
|
9
|
+
detached?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type IdOrAutowiredOption = ComponentId | AutowiredOption;
|
|
13
|
+
|
|
14
|
+
export type IdOrAutowiredOptionWithoutMulti = ComponentId | Omit<AutowiredOption, 'multi'>;
|
|
15
|
+
|
|
16
|
+
export const Autowired = function (idOrOption?: IdOrAutowiredOption): PropertyDecorator & ParameterDecorator {
|
|
17
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
18
|
+
const option = parseAutowiredOption(target, targetKey, index, idOrOption);
|
|
19
|
+
applyAutowiredDecorator(option, target, targetKey, index);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface DoGetValue {
|
|
24
|
+
(option: AutowiredOption, target: any, property: string): any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DoInject {
|
|
28
|
+
(option: AutowiredOption, t: any, k: string, i?: number): any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const defaultAutowiredOption: AutowiredOption = {
|
|
32
|
+
multi: false,
|
|
33
|
+
detached: false
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function parseAutowiredOption(target: any, targetKey: string, index?: number, idOrOption?: IdOrAutowiredOption, ) {
|
|
37
|
+
const option = AnnotationUtil.getValueOrOption<AutowiredOption>(idOrOption);
|
|
38
|
+
const type = AnnotationUtil.getType(target, targetKey, index);
|
|
39
|
+
if (type === Array) {
|
|
40
|
+
option.multi = true;
|
|
41
|
+
}
|
|
42
|
+
option.id = option.id || type;
|
|
43
|
+
|
|
44
|
+
return { ...defaultAutowiredOption, ...option };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function applyAutowiredDecorator(option: AutowiredOption, target: any, targetKey: string, index?: number,
|
|
48
|
+
doInject: DoInject = ({ id, multi }, t: any, k, i) => multi ? multiInject(id!)(t, k, i) : inject(id!)(t, k, i),
|
|
49
|
+
doGetValue: DoGetValue = ({ id, multi }, t, property) => multi ? ContainerUtil.getAll(id!) : ContainerUtil.get(id!)) {
|
|
50
|
+
|
|
51
|
+
if (option.detached) {
|
|
52
|
+
if (index !== undefined) {
|
|
53
|
+
throw new Error(`The ${target.constructor.name} itself is not injected into the container, so the parameter injection of the constructor is not supported.`);
|
|
54
|
+
}
|
|
55
|
+
createAutowiredProperty(option, doGetValue, target, targetKey);
|
|
56
|
+
} else {
|
|
57
|
+
doInject(option, target, targetKey, index);
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
return option;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function createAutowiredProperty(option: AutowiredOption, doGetValue: DoGetValue, target: any, property: string): void {
|
|
64
|
+
let value: any;
|
|
65
|
+
Object.defineProperty(target, property, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get(): any {
|
|
68
|
+
if (value !== undefined) {
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
value = doGetValue(option, target, property);
|
|
72
|
+
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { decorate, injectable, interfaces, METADATA_KEY as inversify_METADATA_KEY } from 'inversify';
|
|
2
|
+
import { METADATA_KEY } from '../constants';
|
|
3
|
+
import { ConfigUtil } from '../config/config-util';
|
|
4
|
+
import { AnnotationUtil } from '../utils';
|
|
5
|
+
import { Scope } from '../container/scope';
|
|
6
|
+
|
|
7
|
+
export type ComponentId<T = any> = interfaces.ServiceIdentifier<T>;
|
|
8
|
+
|
|
9
|
+
export const COMPONENT_TAG = 'Component';
|
|
10
|
+
|
|
11
|
+
export interface ComponentOption {
|
|
12
|
+
id?: ComponentId | ComponentId[];
|
|
13
|
+
scope?: Scope;
|
|
14
|
+
name?: string | number | symbol;
|
|
15
|
+
tag?: { tag: string | number | symbol, value: any };
|
|
16
|
+
default?: boolean;
|
|
17
|
+
when?: (request: interfaces.Request) => boolean;
|
|
18
|
+
rebind?: boolean;
|
|
19
|
+
proxy?: boolean;
|
|
20
|
+
sysTags?: string[];
|
|
21
|
+
onActivation?: (context: interfaces.Context, t: any) => any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ComponentMetadata {
|
|
25
|
+
ids: ComponentId[];
|
|
26
|
+
scope: Scope;
|
|
27
|
+
name?: string | number | symbol;
|
|
28
|
+
tag?: { tag: string | number | symbol, value: any },
|
|
29
|
+
default?: boolean;
|
|
30
|
+
when?: (request: interfaces.Request) => boolean
|
|
31
|
+
rebind: boolean;
|
|
32
|
+
proxy: boolean;
|
|
33
|
+
sysTags: string[]
|
|
34
|
+
onActivation?: (context: interfaces.Context, t: any) => any;
|
|
35
|
+
target: any;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type IdOrComponentOption = ComponentId | ComponentId[] | ComponentOption;
|
|
39
|
+
|
|
40
|
+
export interface ComponentDecorator {
|
|
41
|
+
(idOrOption?: IdOrComponentOption): ClassDecorator;
|
|
42
|
+
(...ids: ComponentId[]): ClassDecorator;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Component = <ComponentDecorator>function (...idOrOption: any): ClassDecorator {
|
|
46
|
+
return (t: any) => {
|
|
47
|
+
const option = parseComponentOption(t, idOrOption);
|
|
48
|
+
applyComponentDecorator(option, t);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const defaultComponentOption: ComponentOption = {
|
|
53
|
+
scope: Scope.Singleton,
|
|
54
|
+
rebind: false,
|
|
55
|
+
proxy: false,
|
|
56
|
+
...ConfigUtil.getRaw().cell?.annotation?.Component
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function parseComponentOption(target: any, idOrOption: any) {
|
|
60
|
+
if (Array.isArray(idOrOption)) {
|
|
61
|
+
if (idOrOption.length === 1) {
|
|
62
|
+
idOrOption = idOrOption[0];
|
|
63
|
+
} else if (idOrOption.length === 0) {
|
|
64
|
+
idOrOption = undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const option = AnnotationUtil.getValueOrOption<ComponentOption>(idOrOption);
|
|
68
|
+
|
|
69
|
+
const parsed = { ...defaultComponentOption, ...option };
|
|
70
|
+
let ids: ComponentId[];
|
|
71
|
+
if (Array.isArray(parsed.id)) {
|
|
72
|
+
ids = Array.from(new Set<ComponentId>([ target, ...parsed.id ]));
|
|
73
|
+
} else if (parsed.id && parsed.id !== target) {
|
|
74
|
+
ids = [ target, parsed.id ];
|
|
75
|
+
} else {
|
|
76
|
+
ids = [ target ];
|
|
77
|
+
}
|
|
78
|
+
parsed.id = ids;
|
|
79
|
+
parsed.sysTags = [ ...new Set<string>([ COMPONENT_TAG, ...parsed.sysTags || []]) ];
|
|
80
|
+
return parsed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function applyComponentDecorator(option: ComponentOption, target: any) {
|
|
84
|
+
|
|
85
|
+
const isAlreadyDecorated = Reflect.hasOwnMetadata(inversify_METADATA_KEY.PARAM_TYPES, target);
|
|
86
|
+
|
|
87
|
+
if (!isAlreadyDecorated) {
|
|
88
|
+
decorate(injectable(), target);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const metadata: ComponentMetadata = {
|
|
92
|
+
target,
|
|
93
|
+
ids: Array.isArray(option.id) ? option.id : [ option.id || target ],
|
|
94
|
+
sysTags: option.sysTags!,
|
|
95
|
+
rebind: option.rebind!,
|
|
96
|
+
proxy: option.proxy!,
|
|
97
|
+
scope: option.scope!,
|
|
98
|
+
name: option.name,
|
|
99
|
+
tag: option.tag,
|
|
100
|
+
default: option.default,
|
|
101
|
+
when: option.when,
|
|
102
|
+
onActivation: option.onActivation
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
let metadatas: ComponentMetadata[] = Reflect.getMetadata(
|
|
106
|
+
METADATA_KEY.component,
|
|
107
|
+
Reflect
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
if (!metadatas) {
|
|
111
|
+
metadatas = [];
|
|
112
|
+
Reflect.defineMetadata(
|
|
113
|
+
METADATA_KEY.component,
|
|
114
|
+
metadatas,
|
|
115
|
+
Reflect
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
metadatas.push(metadata);
|
|
119
|
+
return metadata;
|
|
120
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants';
|
|
2
|
+
import { ComponentId } from './component';
|
|
3
|
+
|
|
4
|
+
export interface ConstantOption {
|
|
5
|
+
id: ComponentId | ComponentId[];
|
|
6
|
+
rebind?: boolean;
|
|
7
|
+
constantValue?: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Constant = function (id: ComponentId | ComponentId[], constantValue: any, rebind = false): ClassDecorator {
|
|
11
|
+
return (t: any) => {
|
|
12
|
+
applyConstantDecorator({ id, constantValue, rebind }, t);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function applyConstantDecorator(option: ConstantOption, target: any): void {
|
|
17
|
+
const previousMetadata = Reflect.getMetadata(METADATA_KEY.constantValue, Reflect) || [];
|
|
18
|
+
const newMetadata = [option].concat(previousMetadata);
|
|
19
|
+
Reflect.defineMetadata(METADATA_KEY.constantValue, newMetadata, Reflect);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { decorate } from 'inversify';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContainerUtil } from '../../container/container-util';
|
|
2
|
+
import { applyAutowiredDecorator, DoGetValue, IdOrAutowiredOptionWithoutMulti, parseAutowiredOption } from '../autowired';
|
|
3
|
+
import { PROVIDER, ID_KEY, doInjectForAutowiredProvider } from '../autowired-provider';
|
|
4
|
+
|
|
5
|
+
export const AutowiredProvider = function (idOrOption?: IdOrAutowiredOptionWithoutMulti): PropertyDecorator & ParameterDecorator {
|
|
6
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
7
|
+
const option = parseAutowiredOption(target, targetKey, index, idOrOption);
|
|
8
|
+
option.detached = true;
|
|
9
|
+
applyAutowiredDecorator(option, target, targetKey, index, doInjectForAutowiredProvider, doGetValueForAutorpc);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const doGetValueForAutorpc: DoGetValue = (option, t, property) => ContainerUtil.getTagged(PROVIDER, ID_KEY, option.id!);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { applyAutowiredDecorator, parseAutowiredOption, IdOrAutowiredOption } from '../autowired';
|
|
2
|
+
|
|
3
|
+
export const Autowired = function (idOrOption?: IdOrAutowiredOption): PropertyDecorator & ParameterDecorator {
|
|
4
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
5
|
+
const option = parseAutowiredOption(target, targetKey, index, idOrOption);
|
|
6
|
+
option.detached = true;
|
|
7
|
+
applyAutowiredDecorator(option, target, targetKey, index);
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { applyValueDecorator, ElOrValueOption, parseValueOption } from '../value';
|
|
2
|
+
|
|
3
|
+
export const Value = function (elOrOption?: ElOrValueOption): PropertyDecorator & ParameterDecorator {
|
|
4
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
5
|
+
const option = parseValueOption(target, targetKey, index, elOrOption);
|
|
6
|
+
option.detached = true;
|
|
7
|
+
applyValueDecorator(option, target, targetKey, index);
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './autowired';
|
|
2
|
+
export * from './component';
|
|
3
|
+
export * from './value';
|
|
4
|
+
export * from './optional';
|
|
5
|
+
export * from './constant';
|
|
6
|
+
export * from './named';
|
|
7
|
+
export * from './tagged';
|
|
8
|
+
export * from './post-construct';
|
|
9
|
+
export * from './pre-destroy';
|
|
10
|
+
export * from './target-name';
|
|
11
|
+
export * from './injectable';
|
|
12
|
+
export * from './inject';
|
|
13
|
+
export * from './aspect';
|
|
14
|
+
export * from './service';
|
|
15
|
+
export * from './unmanaged';
|
|
16
|
+
export * from './decorate';
|
|
17
|
+
export * from './autowired-provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { inject as Inject } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { injectable as Injectable } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { named as Named } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { optional as Optional } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { postConstruct as PostConstruct } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { preDestroy as PreDestroy } from 'inversify';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentDecorator, ComponentOption, parseComponentOption, applyComponentDecorator } from './component';
|
|
2
|
+
|
|
3
|
+
export const SERVICE_TAG = 'Service';
|
|
4
|
+
|
|
5
|
+
export const Service = <ComponentDecorator>function (...idOrOption: any): ClassDecorator {
|
|
6
|
+
return (t: any) => {
|
|
7
|
+
const option = parseComponentOption(t, idOrOption);
|
|
8
|
+
applyServiceDecorator(option, t);
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function applyServiceDecorator(option: ComponentOption, target: any) {
|
|
13
|
+
option.sysTags = option.sysTags?.indexOf(SERVICE_TAG) ? option.sysTags : [SERVICE_TAG, ...(option.sysTags || [])];
|
|
14
|
+
return applyComponentDecorator(option, target);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { tagged as Tagged } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { targetName as TargetName } from 'inversify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { unmanaged as Unmanaged } from 'inversify';
|