@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,64 @@
|
|
|
1
|
+
import { inject, named, interfaces } from 'inversify';
|
|
2
|
+
import { ConfigUtil } from '../config/config-util';
|
|
3
|
+
import { AnnotationUtil } from '../utils';
|
|
4
|
+
import { ConfigProvider } from '../config/config-protocol';
|
|
5
|
+
|
|
6
|
+
export const VALUE = Symbol('Value');
|
|
7
|
+
|
|
8
|
+
export interface ValueOption {
|
|
9
|
+
el?: string,
|
|
10
|
+
detached?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ElOrValueOption = string | ValueOption;
|
|
14
|
+
|
|
15
|
+
export const Value = function (elOrOption?: ElOrValueOption): PropertyDecorator & ParameterDecorator {
|
|
16
|
+
return (target: any, targetKey: string, index?: number) => {
|
|
17
|
+
const option = parseValueOption(target, targetKey, index, elOrOption);
|
|
18
|
+
applyValueDecorator(option, target, targetKey, index);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const defaultValueOption: ValueOption = {
|
|
23
|
+
detached: false
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function parseValueOption(target: any, targetKey: string, index?: number, elOrOption?: ElOrValueOption) {
|
|
27
|
+
const option = AnnotationUtil.getValueOrOption<ValueOption>(elOrOption, 'el');
|
|
28
|
+
option.el = option.el || targetKey;
|
|
29
|
+
return { ...defaultValueOption, ...option };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function applyValueDecorator(option: ValueOption, target: any, targetKey: string, index?: number) {
|
|
33
|
+
if (option.detached) {
|
|
34
|
+
if (index !== undefined) {
|
|
35
|
+
throw new Error(`The ${target.constructor.name} itself is not injected into the container, so the parameter injection of the constructor is not supported.`);
|
|
36
|
+
}
|
|
37
|
+
createValueProperty(option, target, targetKey);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const el = option.el!;
|
|
42
|
+
inject(VALUE)(target, targetKey, index);
|
|
43
|
+
named(el)(target, targetKey, index);
|
|
44
|
+
return option;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function createValueProperty(option: ValueOption, target: any, property: string): void {
|
|
48
|
+
Object.defineProperty(target, property, {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get(): any {
|
|
51
|
+
const el = option.el!;
|
|
52
|
+
return ConfigUtil.get(el);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function bindValue(bind: interfaces.Bind): any {
|
|
58
|
+
bind(VALUE).toDynamicValue(ctx => {
|
|
59
|
+
const namedMetadata = ctx.currentRequest.target.getNamedTag();
|
|
60
|
+
const el = namedMetadata!.value.toString();
|
|
61
|
+
const configProvider = ctx.container.get<ConfigProvider>(ConfigProvider);
|
|
62
|
+
return configProvider.get(el);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentMetadata } from '../annotation';
|
|
2
|
+
import { Newable } from '../utils';
|
|
3
|
+
|
|
4
|
+
export const AOP_TAG = 'AOP_TAG';
|
|
5
|
+
|
|
6
|
+
export const MethodBeforeAdvice = Symbol('MethodBeforeAdvice');
|
|
7
|
+
export const AfterReturningAdvice = Symbol('AfterReturningAdvice');
|
|
8
|
+
export const AfterThrowsAdvice = Symbol('AfterThrowsAdvice');
|
|
9
|
+
export const AopProxyFactory = Symbol('AopProxyFactory');
|
|
10
|
+
export const ClassFilter = Symbol('ClassFilter');
|
|
11
|
+
export const MethodMatcher = Symbol('MethodMatcher');
|
|
12
|
+
|
|
13
|
+
export interface Advice { }
|
|
14
|
+
|
|
15
|
+
export interface BeforeAdvice extends Advice { }
|
|
16
|
+
|
|
17
|
+
export interface AfterAdvice extends Advice { }
|
|
18
|
+
|
|
19
|
+
export interface MethodBeforeAdvice extends BeforeAdvice {
|
|
20
|
+
|
|
21
|
+
before(method: string | number | symbol, args: any[], target: any): Promise<void>;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AfterReturningAdvice extends AfterAdvice {
|
|
26
|
+
|
|
27
|
+
afterReturning(returnValue: any, method: string | number | symbol, args: any[], target: any): Promise<void>;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface AfterThrowsAdvice extends AfterAdvice {
|
|
32
|
+
|
|
33
|
+
afterThrows(error: any, method: string | number | symbol, args: any[], target: any): Promise<void>;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AopProxy {
|
|
38
|
+
getProxy(): any
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ProxyConfig {
|
|
42
|
+
target: any;
|
|
43
|
+
metadata: ComponentMetadata;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AopProxyFactory {
|
|
47
|
+
create(config: ProxyConfig): AopProxy;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ClassFilter {
|
|
51
|
+
matches(clazz: Newable<any>, metadata: ComponentMetadata): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface MethodMatcher {
|
|
55
|
+
matches(method: string | number | symbol, clazz: Newable<any>, args: any[]): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { isResolveMode } from '../utils';
|
|
2
|
+
import { ContainerProvider } from '../container';
|
|
3
|
+
import { AfterReturningAdvice, AfterThrowsAdvice, AopProxy, AopProxyFactory, AOP_TAG, MethodBeforeAdvice, ProxyConfig } from './aop-protocol';
|
|
4
|
+
import { Component } from '../annotation';
|
|
5
|
+
import { interfaces } from 'inversify';
|
|
6
|
+
|
|
7
|
+
@Component({ id: AopProxyFactory, proxy: false })
|
|
8
|
+
export class AopProxyFactoryImpl implements AopProxyFactory {
|
|
9
|
+
|
|
10
|
+
protected getAdvices<T>(id: interfaces.ServiceIdentifier<T>, tagValues: string[]) {
|
|
11
|
+
const container = ContainerProvider.provide();
|
|
12
|
+
const advices: T[] = [];
|
|
13
|
+
for (const tagValue of tagValues) {
|
|
14
|
+
if (container.isBoundTagged(id, AOP_TAG, tagValue)) {
|
|
15
|
+
advices.push(...container.getAllTagged<T>(id, AOP_TAG, tagValue));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return advices;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
create(config: ProxyConfig): AopProxy {
|
|
22
|
+
const { metadata: { sysTags } } = config;
|
|
23
|
+
const proxy = new Proxy(config.target, {
|
|
24
|
+
get: (target, method, receiver) => {
|
|
25
|
+
if (isResolveMode()) {
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
const func = target[method];
|
|
29
|
+
if (typeof func === 'function') {
|
|
30
|
+
return async (...args: any[]) => {
|
|
31
|
+
try {
|
|
32
|
+
const beforeAdvices = this.getAdvices<MethodBeforeAdvice>(MethodBeforeAdvice, sysTags!);
|
|
33
|
+
for (const advice of beforeAdvices) {
|
|
34
|
+
await advice.before(method, args, target);
|
|
35
|
+
}
|
|
36
|
+
const returnValue = await func.apply(target, args);
|
|
37
|
+
const afterReturningAdvices = this.getAdvices<AfterReturningAdvice>(AfterReturningAdvice, sysTags!);
|
|
38
|
+
for (const advice of afterReturningAdvices) {
|
|
39
|
+
await advice.afterReturning(returnValue, method, args, target);
|
|
40
|
+
}
|
|
41
|
+
return returnValue;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
const afterThrowsAdvices = this.getAdvices<AfterThrowsAdvice>(AfterThrowsAdvice, sysTags!);
|
|
44
|
+
for (const advice of afterThrowsAdvices) {
|
|
45
|
+
await advice.afterThrows(error, method, args, target);
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return func;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
getProxy() {
|
|
56
|
+
return proxy;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Newable } from '../utils';
|
|
2
|
+
import { ContainerProvider } from '../container';
|
|
3
|
+
import { AfterReturningAdvice, AfterThrowsAdvice, AOP_TAG, ClassFilter, MethodBeforeAdvice } from './aop-protocol';
|
|
4
|
+
import { Component, ComponentMetadata } from '../annotation';
|
|
5
|
+
|
|
6
|
+
@Component({ id: ClassFilter, proxy: false })
|
|
7
|
+
export class ClassFilterImpl implements ClassFilter {
|
|
8
|
+
|
|
9
|
+
matches(clazz: Newable<any>, metadata: ComponentMetadata): boolean {
|
|
10
|
+
const container = ContainerProvider.provide();
|
|
11
|
+
const tagKeys = metadata.sysTags;
|
|
12
|
+
for (const tagValue of tagKeys) {
|
|
13
|
+
if (container.isBoundTagged(MethodBeforeAdvice, AOP_TAG, tagValue)
|
|
14
|
+
|| container.isBoundTagged(AfterThrowsAdvice, AOP_TAG, tagValue)
|
|
15
|
+
|| container.isBoundTagged(AfterReturningAdvice, AOP_TAG, tagValue)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { container } from '../container/dynamic-container';
|
|
2
|
+
import { Application } from './application-protocol';
|
|
3
|
+
import { ContainerProvider } from '../container';
|
|
4
|
+
container.then(c => {
|
|
5
|
+
ContainerProvider.set(c);
|
|
6
|
+
const application = c.get<Application>(Application);
|
|
7
|
+
application.start().catch(reason => {
|
|
8
|
+
console.error(`Failed to start the ${application.constructor.name}.`);
|
|
9
|
+
if (reason) {
|
|
10
|
+
console.error(reason);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface ApplicationError<C extends number, D> extends Error {
|
|
2
|
+
readonly code: C
|
|
3
|
+
readonly data: D
|
|
4
|
+
toJson(): ApplicationError.Literal<D>
|
|
5
|
+
}
|
|
6
|
+
export namespace ApplicationError {
|
|
7
|
+
export interface Literal<D> {
|
|
8
|
+
message: string
|
|
9
|
+
data: D
|
|
10
|
+
stack?: string
|
|
11
|
+
}
|
|
12
|
+
export interface Constructor<C extends number, D> {
|
|
13
|
+
(...args: any[]): ApplicationError<C, D>;
|
|
14
|
+
code: C;
|
|
15
|
+
is(arg: object | undefined): arg is ApplicationError<C, D>
|
|
16
|
+
}
|
|
17
|
+
const codes: number[] = [];
|
|
18
|
+
export function declare<C extends number, D>(code: C, factory: (...args: any[]) => Literal<D>): Constructor<C, D> {
|
|
19
|
+
if (codes.indexOf(code) !== -1) {
|
|
20
|
+
throw new Error(`An application error for '${code}' code is already declared`);
|
|
21
|
+
}
|
|
22
|
+
const constructorOpt = Object.assign((...args: any[]) => new Impl(code, factory(...args), constructorOpt), {
|
|
23
|
+
code,
|
|
24
|
+
is(arg: object | undefined): arg is ApplicationError<C, D> {
|
|
25
|
+
return arg instanceof Impl && arg.code === code;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return constructorOpt;
|
|
29
|
+
}
|
|
30
|
+
export function is<C extends number, D>(arg: object | undefined): arg is ApplicationError<C, D> {
|
|
31
|
+
return arg instanceof Impl;
|
|
32
|
+
}
|
|
33
|
+
export function fromJson<C extends number, D>(code: C, raw: Literal<D>): ApplicationError<C, D> {
|
|
34
|
+
return new Impl(code, raw);
|
|
35
|
+
}
|
|
36
|
+
class Impl<C extends number, D> extends Error implements ApplicationError<C, D> {
|
|
37
|
+
readonly data: D;
|
|
38
|
+
constructor(
|
|
39
|
+
readonly code: C,
|
|
40
|
+
raw: ApplicationError.Literal<D>,
|
|
41
|
+
constructorOpt?: Function
|
|
42
|
+
) {
|
|
43
|
+
super(raw.message);
|
|
44
|
+
this.data = raw.data;
|
|
45
|
+
Object.setPrototypeOf(this, Impl.prototype);
|
|
46
|
+
if (raw.stack) {
|
|
47
|
+
this.stack = raw.stack;
|
|
48
|
+
} else if (Error.captureStackTrace && constructorOpt) {
|
|
49
|
+
Error.captureStackTrace(this, constructorOpt);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
toJson(): ApplicationError.Literal<D> {
|
|
53
|
+
const { message, data, stack } = this;
|
|
54
|
+
return { message, data, stack };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require('reflect-metadata');
|
|
2
|
+
import { ContainerProvider } from '../container/container-provider';
|
|
3
|
+
import { Application, ApplicationProps } from './application-protocol';
|
|
4
|
+
import './application';
|
|
5
|
+
import './application-state';
|
|
6
|
+
import { autoBind } from '../container/auto-bind';
|
|
7
|
+
import commonModule from '../static-module';
|
|
8
|
+
import { currentThis } from '../utils';
|
|
9
|
+
import { ContainerModule } from 'inversify';
|
|
10
|
+
import { ContainerFactory } from '../container/container-factory';
|
|
11
|
+
|
|
12
|
+
export class ApplicationFactory {
|
|
13
|
+
static async create(applicationProps: ApplicationProps, ...modules: ContainerModule[]): Promise<Application> {
|
|
14
|
+
currentThis.cellProps = applicationProps;
|
|
15
|
+
const container = ContainerFactory.create(commonModule, autoBind(), ...modules);
|
|
16
|
+
ContainerProvider.set(container);
|
|
17
|
+
const application = container.get<Application>(Application);
|
|
18
|
+
return application;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { MaybePromise } from '../utils/prioritizeable';
|
|
2
|
+
import { Deferred } from '../utils/promise-util';
|
|
3
|
+
import { Event } from '../utils/event';
|
|
4
|
+
import { Emitter } from '../utils/emitter';
|
|
5
|
+
import { Logger } from '../logger/logger-protocol';
|
|
6
|
+
import { Autowired, Optional } from '../annotation';
|
|
7
|
+
|
|
8
|
+
export const ApplicationLifecycle = Symbol('ApplicationLifecycle');
|
|
9
|
+
export const Application = Symbol('Application');
|
|
10
|
+
export const ApplicationStateService = Symbol('ApplicationStateService');
|
|
11
|
+
export const ApplicationProps = Symbol('ApplicationProps');
|
|
12
|
+
|
|
13
|
+
export interface ApplicationProps extends Record<string, any> {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ApplicationLifecycle<T extends Application> {
|
|
18
|
+
|
|
19
|
+
initialize?(): void;
|
|
20
|
+
|
|
21
|
+
onStart?(app: T): MaybePromise<void>;
|
|
22
|
+
|
|
23
|
+
onStop?(app: T): void;
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Application {
|
|
28
|
+
|
|
29
|
+
start(): Promise<void>;
|
|
30
|
+
stop(): Promise<void>;
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export abstract class AbstractApplication implements Application {
|
|
35
|
+
|
|
36
|
+
@Autowired(ApplicationLifecycle) @Optional()
|
|
37
|
+
protected readonly lifecycles: ApplicationLifecycle<Application>[];
|
|
38
|
+
|
|
39
|
+
abstract start(): Promise<void>;
|
|
40
|
+
|
|
41
|
+
abstract stop(): Promise<void>;
|
|
42
|
+
|
|
43
|
+
@Autowired(Logger)
|
|
44
|
+
protected readonly logger: Logger;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Initialize and start the frontend application.
|
|
48
|
+
*/
|
|
49
|
+
protected async doStart(): Promise<void> {
|
|
50
|
+
for (const lifecycle of this.lifecycles) {
|
|
51
|
+
if (lifecycle.initialize) {
|
|
52
|
+
try {
|
|
53
|
+
lifecycle.initialize();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
this.logger.error('Could not initialize lifecycle', error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// TODO
|
|
61
|
+
|
|
62
|
+
for (const lifecycle of this.lifecycles) {
|
|
63
|
+
if (lifecycle.onStart) {
|
|
64
|
+
try {
|
|
65
|
+
await lifecycle.onStart(this);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
this.logger.error('Could not start lifecycle', error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Stop the frontend application lifecycle.
|
|
75
|
+
*/
|
|
76
|
+
protected doStop(): void {
|
|
77
|
+
for (const lifecycle of this.lifecycles) {
|
|
78
|
+
if (lifecycle.onStop) {
|
|
79
|
+
try {
|
|
80
|
+
lifecycle.onStop(this);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
this.logger.error('Could not stop lifecycle', error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type ApplicationState =
|
|
91
|
+
'init'
|
|
92
|
+
| 'started'
|
|
93
|
+
| 'ready'
|
|
94
|
+
| 'stoped';
|
|
95
|
+
|
|
96
|
+
export interface ApplicationStateService<T extends string> {
|
|
97
|
+
state: T;
|
|
98
|
+
readonly onStateChanged: Event<T>
|
|
99
|
+
|
|
100
|
+
reachedState(state: T): Promise<void>;
|
|
101
|
+
|
|
102
|
+
reachedAnyState(...states: T[]): Promise<void>;
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
export abstract class AbstractApplicationStateService<T extends string> implements ApplicationStateService<T> {
|
|
106
|
+
|
|
107
|
+
private _state = <T>'init';
|
|
108
|
+
|
|
109
|
+
protected deferred: { [state: string]: Deferred<void> } = {};
|
|
110
|
+
protected readonly stateChanged = new Emitter<T>();
|
|
111
|
+
|
|
112
|
+
get state(): T {
|
|
113
|
+
return this._state;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
set state(state: T) {
|
|
117
|
+
if (state !== this._state) {
|
|
118
|
+
this.deferred[this._state] = new Deferred();
|
|
119
|
+
this._state = state;
|
|
120
|
+
if (this.deferred[state] === undefined) {
|
|
121
|
+
this.deferred[state] = new Deferred();
|
|
122
|
+
}
|
|
123
|
+
this.deferred[state].resolve();
|
|
124
|
+
this.stateChanged.fire(state);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
get onStateChanged(): Event<T> {
|
|
129
|
+
return this.stateChanged.event;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
reachedState(state: T): Promise<void> {
|
|
133
|
+
if (this.deferred[state] === undefined) {
|
|
134
|
+
this.deferred[state] = new Deferred();
|
|
135
|
+
}
|
|
136
|
+
return this.deferred[state].promise;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
reachedAnyState(...states: T[]): Promise<void> {
|
|
140
|
+
return Promise.race(states.map(s => this.reachedState(s)));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Component } from '../annotation';
|
|
2
|
+
import { AbstractApplicationStateService, ApplicationState, ApplicationStateService } from './application-protocol';
|
|
3
|
+
|
|
4
|
+
@Component(ApplicationStateService)
|
|
5
|
+
export class CommonApplicationStateService extends AbstractApplicationStateService<ApplicationState> {
|
|
6
|
+
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, Autowired } from '../annotation';
|
|
2
|
+
import { AbstractApplication, Application, ApplicationState, ApplicationStateService } from './application-protocol';
|
|
3
|
+
|
|
4
|
+
@Component(Application)
|
|
5
|
+
export class CommonApplication extends AbstractApplication {
|
|
6
|
+
|
|
7
|
+
@Autowired(ApplicationStateService)
|
|
8
|
+
protected readonly stateService: ApplicationStateService<ApplicationState>;
|
|
9
|
+
|
|
10
|
+
async start(): Promise<void> {
|
|
11
|
+
await this.doStart();
|
|
12
|
+
this.stateService.state = 'started';
|
|
13
|
+
this.stateService.state = 'ready';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async stop(): Promise<void> {
|
|
17
|
+
this.doStop();
|
|
18
|
+
this.stateService.state = 'stoped';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConfigProvider } from './config-protocol';
|
|
2
|
+
import { Component, Autowired } from '../annotation';
|
|
3
|
+
import { ExpressionHandler } from '../el';
|
|
4
|
+
|
|
5
|
+
@Component(ConfigProvider)
|
|
6
|
+
export class ConfigProviderImpl implements ConfigProvider {
|
|
7
|
+
|
|
8
|
+
@Autowired(ExpressionHandler)
|
|
9
|
+
protected readonly expressionHandler: ExpressionHandler;
|
|
10
|
+
|
|
11
|
+
get<T>(key: string, defaultValue?: T): T {
|
|
12
|
+
return this.expressionHandler.handle(`\${${key}}`) || defaultValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfigProvider } from './config-protocol';
|
|
2
|
+
import { ContainerUtil } from '../container';
|
|
3
|
+
import { config } from './dynamic-config';
|
|
4
|
+
import { currentThis } from '../utils';
|
|
5
|
+
|
|
6
|
+
export namespace ConfigUtil {
|
|
7
|
+
export function get<T = any>(key: string, defaultValue?: T): T {
|
|
8
|
+
return ContainerUtil.get<ConfigProvider>(ConfigProvider).get(key, defaultValue);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getRaw() {
|
|
12
|
+
return currentThis.cellProps || config;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { interfaces, ContainerModule } from 'inversify';
|
|
2
|
+
import { METADATA_KEY } from '../constants';
|
|
3
|
+
import { ComponentMetadata, ConstantOption } from '../annotation';
|
|
4
|
+
import { ConfigUtil } from '../config/config-util';
|
|
5
|
+
import { AopProxyFactory, ClassFilter } from '../aop/aop-protocol';
|
|
6
|
+
import { ContainerUtil } from './container-util';
|
|
7
|
+
import { Scope } from './scope';
|
|
8
|
+
|
|
9
|
+
export function manualBind(registry?: interfaces.ContainerModuleCallBack): interfaces.ContainerModule {
|
|
10
|
+
return new ContainerModule((bind, unbind, isBound, rebind, ...rest) => {
|
|
11
|
+
if (registry) {
|
|
12
|
+
registry(bind, unbind, isBound, rebind, ...rest);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function autoBind(registry?: interfaces.ContainerModuleCallBack): interfaces.ContainerModule {
|
|
18
|
+
const metadatas: ComponentMetadata[] = Reflect.getMetadata(METADATA_KEY.component, Reflect) || [];
|
|
19
|
+
const constantMetadata: ConstantOption[] = Reflect.getMetadata(METADATA_KEY.constantValue, Reflect) || [];
|
|
20
|
+
Reflect.defineMetadata(METADATA_KEY.component, [], Reflect);
|
|
21
|
+
Reflect.defineMetadata(METADATA_KEY.constantValue, [], Reflect);
|
|
22
|
+
return new ContainerModule((bind, unbind, isBound, rebind, ...rest) => {
|
|
23
|
+
for (let index = metadatas!.length - 1; index >= 0; index--) {
|
|
24
|
+
const metadata = metadatas![index];
|
|
25
|
+
resolve(metadata, bind, rebind);
|
|
26
|
+
}
|
|
27
|
+
constantMetadata!.map(metadata => resolveConstant(metadata, bind, rebind));
|
|
28
|
+
|
|
29
|
+
if (registry) {
|
|
30
|
+
registry(bind, unbind, isBound, rebind, ...rest);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function doProxyIfNeed(metadata: ComponentMetadata, target: any) {
|
|
36
|
+
const enabled = ConfigUtil.getRaw().cell?.aop?.enabled;
|
|
37
|
+
if (enabled && metadata.proxy) {
|
|
38
|
+
const classFilter = ContainerUtil.get<ClassFilter>(ClassFilter);
|
|
39
|
+
if (target.constructor && classFilter.matches(target.constructor, metadata)) {
|
|
40
|
+
const aopProxyFactory = ContainerUtil.get<AopProxyFactory>(AopProxyFactory);
|
|
41
|
+
return aopProxyFactory.create({
|
|
42
|
+
target,
|
|
43
|
+
metadata
|
|
44
|
+
}).getProxy();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return target;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function resolve(metadata: ComponentMetadata, bind: interfaces.Bind, rebind: interfaces.Rebind): void {
|
|
52
|
+
let mid: any;
|
|
53
|
+
const { ids, scope, name, tag, when, proxy, onActivation, target } = metadata;
|
|
54
|
+
const _ids = [...ids];
|
|
55
|
+
const id = _ids.shift()!;
|
|
56
|
+
if (metadata.rebind) {
|
|
57
|
+
const id2 = _ids.shift();
|
|
58
|
+
mid = rebind(id2 || id).to(target);
|
|
59
|
+
} else {
|
|
60
|
+
mid = bind(id).to(target);
|
|
61
|
+
}
|
|
62
|
+
if (scope === Scope.Singleton) {
|
|
63
|
+
mid = mid.inSingletonScope();
|
|
64
|
+
} else if (scope === Scope.Transient) {
|
|
65
|
+
mid = mid.inTransientScope();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (name) {
|
|
69
|
+
mid = mid.whenTargetNamed(name);
|
|
70
|
+
} else if (tag) {
|
|
71
|
+
mid = mid.whenTargetTagged(tag.tag, tag.value);
|
|
72
|
+
} else if (metadata.default) {
|
|
73
|
+
mid = mid.whenTargetIsDefault();
|
|
74
|
+
} else if (when) {
|
|
75
|
+
mid = mid.when(when);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (onActivation) {
|
|
79
|
+
mid.onActivation(onActivation);
|
|
80
|
+
} else if (proxy) {
|
|
81
|
+
mid.onActivation((context: interfaces.Context, t: any) => doProxyIfNeed(metadata, t));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
for (const item of _ids) {
|
|
85
|
+
bind(item).toService(id);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function resolveConstant(metadata: ConstantOption, bind: interfaces.Bind, rebind: interfaces.Rebind): void {
|
|
90
|
+
const ids = Array.isArray(metadata.id) ? [...metadata.id] : [ metadata.id ];
|
|
91
|
+
const id = ids.shift();
|
|
92
|
+
if (metadata.rebind) {
|
|
93
|
+
rebind(id!).toConstantValue(metadata.constantValue);
|
|
94
|
+
} else {
|
|
95
|
+
bind(id!).toConstantValue(metadata.constantValue);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const item of ids) {
|
|
99
|
+
bind(item!).toService(id!);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Container, ContainerModule, interfaces } from 'inversify';
|
|
2
|
+
|
|
3
|
+
export class ContainerFactory {
|
|
4
|
+
static create(...modules: ContainerModule[]): interfaces.Container {
|
|
5
|
+
const container = new Container({ skipBaseClassChecks: true });
|
|
6
|
+
container.load(...modules);
|
|
7
|
+
return container;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { interfaces } from 'inversify';
|
|
2
|
+
import { Deferred } from '../utils';
|
|
3
|
+
|
|
4
|
+
let _container: interfaces.Container;
|
|
5
|
+
|
|
6
|
+
const _containerDeferred = new Deferred<interfaces.Container>();
|
|
7
|
+
|
|
8
|
+
export namespace ContainerProvider {
|
|
9
|
+
export function set(container: interfaces.Container): void {
|
|
10
|
+
_container = container;
|
|
11
|
+
_containerDeferred.resolve(container);
|
|
12
|
+
}
|
|
13
|
+
export function provide(): interfaces.Container {
|
|
14
|
+
if (!_container) {
|
|
15
|
+
throw new Error('Container is not ready yet, the timing is incorrect.');
|
|
16
|
+
}
|
|
17
|
+
return _container;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function asyncProvide(): Promise<interfaces.Container> {
|
|
21
|
+
return _containerDeferred.promise;
|
|
22
|
+
}
|
|
23
|
+
}
|