@celljs/core 4.0.0 → 4.2.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/README.md +49 -68
- package/esm/browser/static-module.d.ts +1 -1
- package/esm/common/annotation/aspect.d.ts +2 -1
- package/esm/common/annotation/aspect.js.map +1 -1
- package/esm/common/annotation/autowired-provider.d.ts +0 -2
- package/esm/common/annotation/autowired-provider.js +4 -13
- package/esm/common/annotation/autowired-provider.js.map +1 -1
- package/esm/common/annotation/autowired.d.ts +1 -1
- package/esm/common/annotation/autowired.js +11 -3
- package/esm/common/annotation/autowired.js.map +1 -1
- package/esm/common/annotation/component.d.ts +4 -8
- package/esm/common/annotation/component.js +0 -6
- package/esm/common/annotation/component.js.map +1 -1
- package/esm/common/annotation/constant.d.ts +1 -1
- package/esm/common/annotation/constant.js +6 -3
- package/esm/common/annotation/constant.js.map +1 -1
- package/esm/common/annotation/detached/autowired-provider.js +2 -2
- package/esm/common/annotation/detached/autowired-provider.js.map +1 -1
- package/esm/common/annotation/index.d.ts +0 -6
- package/esm/common/annotation/index.js +0 -6
- package/esm/common/annotation/index.js.map +1 -1
- package/esm/common/annotation/named.d.ts +2 -1
- package/esm/common/annotation/named.js +5 -1
- package/esm/common/annotation/named.js.map +1 -1
- package/esm/common/annotation/optional.d.ts +2 -1
- package/esm/common/annotation/optional.js +5 -1
- package/esm/common/annotation/optional.js.map +1 -1
- package/esm/common/annotation/post-construct.d.ts +2 -1
- package/esm/common/annotation/post-construct.js +5 -1
- package/esm/common/annotation/post-construct.js.map +1 -1
- package/esm/common/annotation/tagged.d.ts +2 -1
- package/esm/common/annotation/tagged.js +6 -1
- package/esm/common/annotation/tagged.js.map +1 -1
- package/esm/common/annotation/value.d.ts +3 -2
- package/esm/common/annotation/value.js +7 -10
- package/esm/common/annotation/value.js.map +1 -1
- package/esm/common/aop/aop-proxy-factory.d.ts +6 -2
- package/esm/common/aop/aop-proxy-factory.js +44 -28
- package/esm/common/aop/aop-proxy-factory.js.map +1 -1
- package/esm/common/aop/class-filter.js +6 -6
- package/esm/common/aop/class-filter.js.map +1 -1
- package/esm/common/application/application-factory.d.ts +1 -1
- package/esm/common/application/application-factory.js +4 -4
- package/esm/common/application/application-factory.js.map +1 -1
- package/esm/common/application/application-protocol.js +1 -1
- package/esm/common/application/application-protocol.js.map +1 -1
- package/esm/common/config/config-provider.js +2 -1
- package/esm/common/config/config-provider.js.map +1 -1
- package/esm/common/container/auto-bind.d.ts +7 -3
- package/esm/common/container/auto-bind.js +54 -71
- package/esm/common/container/auto-bind.js.map +1 -1
- package/esm/common/container/container-error.d.ts +21 -0
- package/esm/common/container/container-error.js +22 -0
- package/esm/common/container/container-error.js.map +1 -0
- package/esm/common/container/container-provider.d.ts +5 -4
- package/esm/common/container/container-provider.js +2 -1
- package/esm/common/container/container-provider.js.map +1 -1
- package/esm/common/container/container-util.d.ts +5 -7
- package/esm/common/container/container-util.js +8 -19
- package/esm/common/container/container-util.js.map +1 -1
- package/esm/common/container/container.d.ts +104 -0
- package/esm/common/container/container.js +299 -0
- package/esm/common/container/container.js.map +1 -0
- package/esm/common/container/dynamic-container.d.ts +1 -1
- package/esm/common/container/dynamic-container.js +2 -2
- package/esm/common/container/dynamic-container.js.map +1 -1
- package/esm/common/container/index.d.ts +5 -6
- package/esm/common/container/index.js +5 -3
- package/esm/common/container/index.js.map +1 -1
- package/esm/common/container/injection.d.ts +40 -0
- package/esm/common/container/injection.js +109 -0
- package/esm/common/container/injection.js.map +1 -0
- package/esm/common/container/scope.d.ts +2 -3
- package/esm/common/container/scope.js +2 -3
- package/esm/common/container/scope.js.map +1 -1
- package/esm/common/el/application-expression-engine.d.ts +7 -0
- package/esm/common/{provider/provider-creator.js → el/application-expression-engine.js} +11 -11
- package/esm/common/el/application-expression-engine.js.map +1 -0
- package/esm/common/el/core-context-initializer.d.ts +3 -2
- package/esm/common/el/core-context-initializer.js +10 -8
- package/esm/common/el/core-context-initializer.js.map +1 -1
- package/esm/common/el/expression-compiler.d.ts +7 -17
- package/esm/common/el/expression-compiler.js +10 -166
- package/esm/common/el/expression-compiler.js.map +1 -1
- package/esm/common/el/expression-engine.d.ts +61 -0
- package/esm/common/el/expression-engine.js +459 -0
- package/esm/common/el/expression-engine.js.map +1 -0
- package/esm/common/el/expression-handler.d.ts +8 -4
- package/esm/common/el/expression-handler.js +15 -58
- package/esm/common/el/expression-handler.js.map +1 -1
- package/esm/common/el/expression-protocol.d.ts +3 -5
- package/esm/common/el/expression-protocol.js +0 -1
- package/esm/common/el/expression-protocol.js.map +1 -1
- package/esm/common/el/expression-util.d.ts +69 -0
- package/esm/common/el/expression-util.js +346 -0
- package/esm/common/el/expression-util.js.map +1 -0
- package/esm/common/el/index.d.ts +3 -1
- package/esm/common/el/index.js +3 -1
- package/esm/common/el/index.js.map +1 -1
- package/esm/common/logger/abstract-logger.d.ts +4 -2
- package/esm/common/logger/abstract-logger.js +11 -6
- package/esm/common/logger/abstract-logger.js.map +1 -1
- package/esm/common/logger/logger-protocol.d.ts +4 -0
- package/esm/common/logger/logger-protocol.js +2 -0
- package/esm/common/logger/logger-protocol.js.map +1 -1
- package/esm/common/logger/logger.js +7 -7
- package/esm/common/logger/logger.js.map +1 -1
- package/esm/common/provider/index.d.ts +0 -1
- package/esm/common/provider/index.js +0 -1
- package/esm/common/provider/index.js.map +1 -1
- package/esm/common/provider/provider-protocol.d.ts +5 -9
- package/esm/common/provider/provider-protocol.js +0 -1
- package/esm/common/provider/provider-protocol.js.map +1 -1
- package/esm/common/provider/provider-util.d.ts +1 -1
- package/esm/common/provider/provider-util.js +2 -2
- package/esm/common/provider/provider-util.js.map +1 -1
- package/esm/common/provider/provider.d.ts +7 -6
- package/esm/common/provider/provider.js +15 -26
- package/esm/common/provider/provider.js.map +1 -1
- package/esm/common/static-module.d.ts +1 -1
- package/esm/common/static-module.js +1 -1
- package/esm/common/static-module.js.map +1 -1
- package/esm/common/test/mock-logger.d.ts +1 -0
- package/esm/common/test/mock-logger.js +5 -13
- package/esm/common/test/mock-logger.js.map +1 -1
- package/esm/common/test/test-module.d.ts +1 -1
- package/esm/common/test/test-module.js +1 -1
- package/esm/common/test/test-module.js.map +1 -1
- package/esm/common/utils/annotation-util.js +2 -1
- package/esm/common/utils/annotation-util.js.map +1 -1
- package/esm/common/utils/emitter.d.ts +1 -10
- package/esm/common/utils/emitter.js +0 -56
- package/esm/common/utils/emitter.js.map +1 -1
- package/esm/common/utils/mime-type-util.js +1 -1
- package/esm/common/utils/mime-type-util.js.map +1 -1
- package/esm/common/utils/mime-type.js +1 -1
- package/esm/common/utils/mime-type.js.map +1 -1
- package/esm/common/utils/proxy-util.d.ts +5 -2
- package/esm/common/utils/proxy-util.js +10 -28
- package/esm/common/utils/proxy-util.js.map +1 -1
- package/esm/node/context/context.d.ts +11 -2
- package/esm/node/context/context.js +36 -12
- package/esm/node/context/context.js.map +1 -1
- package/esm/node/index.d.ts +0 -1
- package/esm/node/index.js +0 -1
- package/esm/node/index.js.map +1 -1
- package/esm/node/static-module.d.ts +1 -1
- package/lib/browser/static-module.d.ts +1 -1
- package/lib/common/annotation/aspect.d.ts +2 -1
- package/lib/common/annotation/aspect.d.ts.map +1 -1
- package/lib/common/annotation/aspect.js.map +1 -1
- package/lib/common/annotation/autowired-provider.d.ts +0 -2
- package/lib/common/annotation/autowired-provider.d.ts.map +1 -1
- package/lib/common/annotation/autowired-provider.js +4 -14
- package/lib/common/annotation/autowired-provider.js.map +1 -1
- package/lib/common/annotation/autowired.d.ts +1 -1
- package/lib/common/annotation/autowired.d.ts.map +1 -1
- package/lib/common/annotation/autowired.js +11 -3
- package/lib/common/annotation/autowired.js.map +1 -1
- package/lib/common/annotation/component.d.ts +4 -8
- package/lib/common/annotation/component.d.ts.map +1 -1
- package/lib/common/annotation/component.js +0 -6
- package/lib/common/annotation/component.js.map +1 -1
- package/lib/common/annotation/constant.d.ts +1 -1
- package/lib/common/annotation/constant.d.ts.map +1 -1
- package/lib/common/annotation/constant.js +6 -3
- package/lib/common/annotation/constant.js.map +1 -1
- package/lib/common/annotation/detached/autowired-provider.js +2 -2
- package/lib/common/annotation/detached/autowired-provider.js.map +1 -1
- package/lib/common/annotation/index.d.ts +0 -6
- package/lib/common/annotation/index.d.ts.map +1 -1
- package/lib/common/annotation/index.js +0 -6
- package/lib/common/annotation/index.js.map +1 -1
- package/lib/common/annotation/named.d.ts +2 -1
- package/lib/common/annotation/named.d.ts.map +1 -1
- package/lib/common/annotation/named.js +6 -2
- package/lib/common/annotation/named.js.map +1 -1
- package/lib/common/annotation/optional.d.ts +2 -1
- package/lib/common/annotation/optional.d.ts.map +1 -1
- package/lib/common/annotation/optional.js +6 -2
- package/lib/common/annotation/optional.js.map +1 -1
- package/lib/common/annotation/post-construct.d.ts +2 -1
- package/lib/common/annotation/post-construct.d.ts.map +1 -1
- package/lib/common/annotation/post-construct.js +6 -2
- package/lib/common/annotation/post-construct.js.map +1 -1
- package/lib/common/annotation/tagged.d.ts +2 -1
- package/lib/common/annotation/tagged.d.ts.map +1 -1
- package/lib/common/annotation/tagged.js +7 -2
- package/lib/common/annotation/tagged.js.map +1 -1
- package/lib/common/annotation/value.d.ts +3 -2
- package/lib/common/annotation/value.d.ts.map +1 -1
- package/lib/common/annotation/value.js +7 -10
- package/lib/common/annotation/value.js.map +1 -1
- package/lib/common/aop/aop-proxy-factory.d.ts +6 -2
- package/lib/common/aop/aop-proxy-factory.d.ts.map +1 -1
- package/lib/common/aop/aop-proxy-factory.js +45 -29
- package/lib/common/aop/aop-proxy-factory.js.map +1 -1
- package/lib/common/aop/aop.spec.d.ts +2 -0
- package/lib/common/aop/aop.spec.d.ts.map +1 -0
- package/lib/common/aop/aop.spec.js +170 -0
- package/lib/common/aop/aop.spec.js.map +1 -0
- package/lib/common/aop/class-filter.js +7 -7
- package/lib/common/aop/class-filter.js.map +1 -1
- package/lib/common/application/application-factory.d.ts +1 -1
- package/lib/common/application/application-factory.d.ts.map +1 -1
- package/lib/common/application/application-factory.js +4 -4
- package/lib/common/application/application-factory.js.map +1 -1
- package/lib/common/application/application-protocol.js +1 -1
- package/lib/common/application/application-protocol.js.map +1 -1
- package/lib/common/application/lifecycle.spec.d.ts +2 -0
- package/lib/common/application/lifecycle.spec.d.ts.map +1 -0
- package/lib/common/application/lifecycle.spec.js +155 -0
- package/lib/common/application/lifecycle.spec.js.map +1 -0
- package/lib/common/config/config-provider.js +2 -1
- package/lib/common/config/config-provider.js.map +1 -1
- package/lib/common/container/assembly.spec.d.ts +2 -0
- package/lib/common/container/assembly.spec.d.ts.map +1 -0
- package/lib/common/container/assembly.spec.js +464 -0
- package/lib/common/container/assembly.spec.js.map +1 -0
- package/lib/common/container/auto-bind.d.ts +7 -3
- package/lib/common/container/auto-bind.d.ts.map +1 -1
- package/lib/common/container/auto-bind.js +54 -72
- package/lib/common/container/auto-bind.js.map +1 -1
- package/lib/common/container/container-error.d.ts +22 -0
- package/lib/common/container/container-error.d.ts.map +1 -0
- package/lib/common/container/container-error.js +26 -0
- package/lib/common/container/container-error.js.map +1 -0
- package/lib/common/container/container-provider.d.ts +5 -4
- package/lib/common/container/container-provider.d.ts.map +1 -1
- package/lib/common/container/container-provider.js +3 -2
- package/lib/common/container/container-provider.js.map +1 -1
- package/lib/common/container/container-util.d.ts +5 -7
- package/lib/common/container/container-util.d.ts.map +1 -1
- package/lib/common/container/container-util.js +8 -19
- package/lib/common/container/container-util.js.map +1 -1
- package/lib/common/container/container.d.ts +105 -0
- package/lib/common/container/container.d.ts.map +1 -0
- package/lib/common/container/container.js +305 -0
- package/lib/common/container/container.js.map +1 -0
- package/lib/common/container/container.spec.d.ts +2 -0
- package/lib/common/container/container.spec.d.ts.map +1 -0
- package/lib/common/container/container.spec.js +334 -0
- package/lib/common/container/container.spec.js.map +1 -0
- package/lib/common/container/dynamic-container.d.ts +1 -1
- package/lib/common/container/dynamic-container.d.ts.map +1 -1
- package/lib/common/container/dynamic-container.js +3 -3
- package/lib/common/container/dynamic-container.js.map +1 -1
- package/lib/common/container/index.d.ts +5 -6
- package/lib/common/container/index.d.ts.map +1 -1
- package/lib/common/container/index.js +5 -3
- package/lib/common/container/index.js.map +1 -1
- package/lib/common/container/injection.d.ts +41 -0
- package/lib/common/container/injection.d.ts.map +1 -0
- package/lib/common/container/injection.js +112 -0
- package/lib/common/container/injection.js.map +1 -0
- package/lib/common/container/scope.d.ts +2 -3
- package/lib/common/container/scope.d.ts.map +1 -1
- package/lib/common/container/scope.js +2 -3
- package/lib/common/container/scope.js.map +1 -1
- package/lib/common/el/application-expression-engine.d.ts +8 -0
- package/lib/common/el/application-expression-engine.d.ts.map +1 -0
- package/lib/common/el/application-expression-engine.js +22 -0
- package/lib/common/el/application-expression-engine.js.map +1 -0
- package/lib/common/el/core-context-initializer.d.ts +3 -2
- package/lib/common/el/core-context-initializer.d.ts.map +1 -1
- package/lib/common/el/core-context-initializer.js +9 -7
- package/lib/common/el/core-context-initializer.js.map +1 -1
- package/lib/common/el/expression-compiler.d.ts +7 -17
- package/lib/common/el/expression-compiler.d.ts.map +1 -1
- package/lib/common/el/expression-compiler.js +10 -166
- package/lib/common/el/expression-compiler.js.map +1 -1
- package/lib/common/el/expression-engine.d.ts +62 -0
- package/lib/common/el/expression-engine.d.ts.map +1 -0
- package/lib/common/el/expression-engine.js +465 -0
- package/lib/common/el/expression-engine.js.map +1 -0
- package/lib/common/el/expression-engine.spec.d.ts +2 -0
- package/lib/common/el/expression-engine.spec.d.ts.map +1 -0
- package/lib/common/el/expression-engine.spec.js +100 -0
- package/lib/common/el/expression-engine.spec.js.map +1 -0
- package/lib/common/el/expression-handler.d.ts +8 -4
- package/lib/common/el/expression-handler.d.ts.map +1 -1
- package/lib/common/el/expression-handler.js +14 -60
- package/lib/common/el/expression-handler.js.map +1 -1
- package/lib/common/el/expression-handler.spec.d.ts +2 -0
- package/lib/common/el/expression-handler.spec.d.ts.map +1 -0
- package/lib/common/el/expression-handler.spec.js +98 -0
- package/lib/common/el/expression-handler.spec.js.map +1 -0
- package/lib/common/el/expression-protocol.d.ts +3 -5
- package/lib/common/el/expression-protocol.d.ts.map +1 -1
- package/lib/common/el/expression-protocol.js +1 -2
- package/lib/common/el/expression-protocol.js.map +1 -1
- package/lib/common/el/expression-util.d.ts +70 -0
- package/lib/common/el/expression-util.d.ts.map +1 -0
- package/lib/common/el/expression-util.js +351 -0
- package/lib/common/el/expression-util.js.map +1 -0
- package/lib/common/el/expression-util.spec.d.ts +2 -0
- package/lib/common/el/expression-util.spec.d.ts.map +1 -0
- package/lib/common/el/expression-util.spec.js +45 -0
- package/lib/common/el/expression-util.spec.js.map +1 -0
- package/lib/common/el/index.d.ts +3 -1
- package/lib/common/el/index.d.ts.map +1 -1
- package/lib/common/el/index.js +3 -1
- package/lib/common/el/index.js.map +1 -1
- package/lib/common/el/value-and-el.spec.d.ts +2 -0
- package/lib/common/el/value-and-el.spec.d.ts.map +1 -0
- package/lib/common/el/value-and-el.spec.js +216 -0
- package/lib/common/el/value-and-el.spec.js.map +1 -0
- package/lib/common/logger/abstract-logger.d.ts +4 -2
- package/lib/common/logger/abstract-logger.d.ts.map +1 -1
- package/lib/common/logger/abstract-logger.js +10 -5
- package/lib/common/logger/abstract-logger.js.map +1 -1
- package/lib/common/logger/logger-protocol.d.ts +4 -0
- package/lib/common/logger/logger-protocol.d.ts.map +1 -1
- package/lib/common/logger/logger-protocol.js +3 -1
- package/lib/common/logger/logger-protocol.js.map +1 -1
- package/lib/common/logger/logger.js +7 -7
- package/lib/common/logger/logger.js.map +1 -1
- package/lib/common/logger/logger.spec.d.ts +2 -0
- package/lib/common/logger/logger.spec.d.ts.map +1 -0
- package/lib/common/logger/logger.spec.js +57 -0
- package/lib/common/logger/logger.spec.js.map +1 -0
- package/lib/common/provider/index.d.ts +0 -1
- package/lib/common/provider/index.d.ts.map +1 -1
- package/lib/common/provider/index.js +0 -1
- package/lib/common/provider/index.js.map +1 -1
- package/lib/common/provider/provider-protocol.d.ts +5 -9
- package/lib/common/provider/provider-protocol.d.ts.map +1 -1
- package/lib/common/provider/provider-protocol.js +1 -2
- package/lib/common/provider/provider-protocol.js.map +1 -1
- package/lib/common/provider/provider-util.d.ts +1 -1
- package/lib/common/provider/provider-util.d.ts.map +1 -1
- package/lib/common/provider/provider-util.js +2 -2
- package/lib/common/provider/provider-util.js.map +1 -1
- package/lib/common/provider/provider.d.ts +7 -6
- package/lib/common/provider/provider.d.ts.map +1 -1
- package/lib/common/provider/provider.js +16 -26
- package/lib/common/provider/provider.js.map +1 -1
- package/lib/common/static-module.d.ts +1 -1
- package/lib/common/static-module.js +2 -2
- package/lib/common/static-module.js.map +1 -1
- package/lib/common/test/mock-logger.d.ts +1 -0
- package/lib/common/test/mock-logger.d.ts.map +1 -1
- package/lib/common/test/mock-logger.js +5 -12
- package/lib/common/test/mock-logger.js.map +1 -1
- package/lib/common/test/test-module.d.ts +1 -1
- package/lib/common/test/test-module.d.ts.map +1 -1
- package/lib/common/test/test-module.js +2 -2
- package/lib/common/test/test-module.js.map +1 -1
- package/lib/common/utils/annotation-util.js +2 -1
- package/lib/common/utils/annotation-util.js.map +1 -1
- package/lib/common/utils/emitter.d.ts +1 -10
- package/lib/common/utils/emitter.d.ts.map +1 -1
- package/lib/common/utils/emitter.js +1 -58
- package/lib/common/utils/emitter.js.map +1 -1
- package/lib/common/utils/mime-type-util.js +1 -1
- package/lib/common/utils/mime-type-util.js.map +1 -1
- package/lib/common/utils/mime-type.js +1 -1
- package/lib/common/utils/mime-type.js.map +1 -1
- package/lib/common/utils/proxy-util.d.ts +5 -2
- package/lib/common/utils/proxy-util.d.ts.map +1 -1
- package/lib/common/utils/proxy-util.js +12 -30
- package/lib/common/utils/proxy-util.js.map +1 -1
- package/lib/common/utils/utils-behavior.spec.d.ts +2 -0
- package/lib/common/utils/utils-behavior.spec.d.ts.map +1 -0
- package/lib/common/utils/utils-behavior.spec.js +232 -0
- package/lib/common/utils/utils-behavior.spec.js.map +1 -0
- package/lib/node/context/context.d.ts +11 -2
- package/lib/node/context/context.d.ts.map +1 -1
- package/lib/node/context/context.js +36 -10
- package/lib/node/context/context.js.map +1 -1
- package/lib/node/context/context.spec.d.ts +2 -0
- package/lib/node/context/context.spec.d.ts.map +1 -0
- package/lib/node/context/context.spec.js +202 -0
- package/lib/node/context/context.spec.js.map +1 -0
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +0 -1
- package/lib/node/index.js.map +1 -1
- package/lib/node/static-module.d.ts +1 -1
- package/package.json +9 -21
- package/src/common/annotation/aspect.ts +2 -1
- package/src/common/annotation/autowired-provider.ts +4 -17
- package/src/common/annotation/autowired.ts +14 -6
- package/src/common/annotation/component.ts +6 -26
- package/src/common/annotation/constant.ts +10 -7
- package/src/common/annotation/detached/autowired-provider.ts +2 -2
- package/src/common/annotation/index.ts +0 -6
- package/src/common/annotation/named.ts +7 -1
- package/src/common/annotation/optional.ts +6 -1
- package/src/common/annotation/post-construct.ts +6 -1
- package/src/common/annotation/tagged.ts +8 -1
- package/src/common/annotation/value.ts +9 -11
- package/src/common/aop/aop-proxy-factory.ts +52 -30
- package/src/common/aop/aop.spec.ts +145 -0
- package/src/common/aop/class-filter.ts +6 -6
- package/src/common/application/application-factory.ts +4 -5
- package/src/common/application/application-protocol.ts +1 -1
- package/src/common/application/lifecycle.spec.ts +148 -0
- package/src/common/config/config-provider.ts +1 -1
- package/src/common/container/assembly.spec.ts +288 -0
- package/src/common/container/auto-bind.ts +56 -74
- package/src/common/container/container-error.ts +31 -0
- package/src/common/container/container-provider.ts +9 -7
- package/src/common/container/container-util.ts +8 -19
- package/src/common/container/container.spec.ts +262 -0
- package/src/common/container/container.ts +363 -0
- package/src/common/container/dynamic-container.ts +2 -2
- package/src/common/container/index.ts +5 -7
- package/src/common/container/injection.ts +135 -0
- package/src/common/container/scope.ts +2 -1
- package/src/common/el/application-expression-engine.ts +9 -0
- package/src/common/el/core-context-initializer.ts +9 -8
- package/src/common/el/expression-compiler.ts +9 -168
- package/src/common/el/expression-engine.spec.ts +107 -0
- package/src/common/el/expression-engine.ts +487 -0
- package/src/common/el/expression-handler.spec.ts +109 -0
- package/src/common/el/expression-handler.ts +17 -57
- package/src/common/el/expression-protocol.ts +4 -8
- package/src/common/el/expression-util.spec.ts +45 -0
- package/src/common/el/expression-util.ts +362 -0
- package/src/common/el/index.ts +3 -1
- package/src/common/el/value-and-el.spec.ts +186 -0
- package/src/common/logger/abstract-logger.ts +12 -6
- package/src/common/logger/logger-protocol.ts +5 -0
- package/src/common/logger/logger.spec.ts +61 -0
- package/src/common/logger/logger.ts +7 -7
- package/src/common/provider/index.ts +0 -2
- package/src/common/provider/provider-protocol.ts +5 -11
- package/src/common/provider/provider-util.ts +3 -3
- package/src/common/provider/provider.ts +17 -29
- package/src/common/static-module.ts +1 -1
- package/src/common/test/mock-logger.ts +3 -2
- package/src/common/test/test-module.ts +1 -1
- package/src/common/utils/annotation-util.ts +2 -2
- package/src/common/utils/emitter.ts +1 -63
- package/src/common/utils/mime-type-util.ts +1 -1
- package/src/common/utils/mime-type.ts +1 -1
- package/src/common/utils/proxy-util.ts +8 -28
- package/src/common/utils/utils-behavior.spec.ts +259 -0
- package/src/node/context/context.spec.ts +219 -0
- package/src/node/context/context.ts +35 -10
- package/src/node/index.ts +0 -1
- package/esm/common/annotation/decorate.d.ts +0 -1
- package/esm/common/annotation/decorate.js +0 -2
- package/esm/common/annotation/decorate.js.map +0 -1
- package/esm/common/annotation/inject.d.ts +0 -1
- package/esm/common/annotation/inject.js +0 -2
- package/esm/common/annotation/inject.js.map +0 -1
- package/esm/common/annotation/injectable.d.ts +0 -1
- package/esm/common/annotation/injectable.js +0 -2
- package/esm/common/annotation/injectable.js.map +0 -1
- package/esm/common/annotation/pre-destroy.d.ts +0 -1
- package/esm/common/annotation/pre-destroy.js +0 -2
- package/esm/common/annotation/pre-destroy.js.map +0 -1
- package/esm/common/annotation/target-name.d.ts +0 -1
- package/esm/common/annotation/target-name.js +0 -2
- package/esm/common/annotation/target-name.js.map +0 -1
- package/esm/common/annotation/unmanaged.d.ts +0 -1
- package/esm/common/annotation/unmanaged.js +0 -2
- package/esm/common/annotation/unmanaged.js.map +0 -1
- package/esm/common/container/container-factory.d.ts +0 -4
- package/esm/common/container/container-factory.js +0 -9
- package/esm/common/container/container-factory.js.map +0 -1
- package/esm/common/el/jexl-engine-provider.d.ts +0 -5
- package/esm/common/el/jexl-engine-provider.js +0 -22
- package/esm/common/el/jexl-engine-provider.js.map +0 -1
- package/esm/common/provider/provider-creator.d.ts +0 -6
- package/esm/common/provider/provider-creator.js.map +0 -1
- package/esm/node/utils/crc.d.ts +0 -1
- package/esm/node/utils/crc.js +0 -7
- package/esm/node/utils/crc.js.map +0 -1
- package/esm/node/utils/index.d.ts +0 -1
- package/esm/node/utils/index.js +0 -2
- package/esm/node/utils/index.js.map +0 -1
- package/lib/common/annotation/decorate.d.ts +0 -2
- package/lib/common/annotation/decorate.d.ts.map +0 -1
- package/lib/common/annotation/decorate.js +0 -6
- package/lib/common/annotation/decorate.js.map +0 -1
- package/lib/common/annotation/inject.d.ts +0 -2
- package/lib/common/annotation/inject.d.ts.map +0 -1
- package/lib/common/annotation/inject.js +0 -6
- package/lib/common/annotation/inject.js.map +0 -1
- package/lib/common/annotation/injectable.d.ts +0 -2
- package/lib/common/annotation/injectable.d.ts.map +0 -1
- package/lib/common/annotation/injectable.js +0 -6
- package/lib/common/annotation/injectable.js.map +0 -1
- package/lib/common/annotation/pre-destroy.d.ts +0 -2
- package/lib/common/annotation/pre-destroy.d.ts.map +0 -1
- package/lib/common/annotation/pre-destroy.js +0 -6
- package/lib/common/annotation/pre-destroy.js.map +0 -1
- package/lib/common/annotation/target-name.d.ts +0 -2
- package/lib/common/annotation/target-name.d.ts.map +0 -1
- package/lib/common/annotation/target-name.js +0 -6
- package/lib/common/annotation/target-name.js.map +0 -1
- package/lib/common/annotation/unmanaged.d.ts +0 -2
- package/lib/common/annotation/unmanaged.d.ts.map +0 -1
- package/lib/common/annotation/unmanaged.js +0 -6
- package/lib/common/annotation/unmanaged.js.map +0 -1
- package/lib/common/container/container-factory.d.ts +0 -5
- package/lib/common/container/container-factory.d.ts.map +0 -1
- package/lib/common/container/container-factory.js +0 -13
- package/lib/common/container/container-factory.js.map +0 -1
- package/lib/common/el/jexl-engine-provider.d.ts +0 -6
- package/lib/common/el/jexl-engine-provider.d.ts.map +0 -1
- package/lib/common/el/jexl-engine-provider.js +0 -25
- package/lib/common/el/jexl-engine-provider.js.map +0 -1
- package/lib/common/provider/provider-creator.d.ts +0 -7
- package/lib/common/provider/provider-creator.d.ts.map +0 -1
- package/lib/common/provider/provider-creator.js +0 -22
- package/lib/common/provider/provider-creator.js.map +0 -1
- package/lib/node/utils/crc.d.ts +0 -2
- package/lib/node/utils/crc.d.ts.map +0 -1
- package/lib/node/utils/crc.js +0 -10
- package/lib/node/utils/crc.js.map +0 -1
- package/lib/node/utils/index.d.ts +0 -2
- package/lib/node/utils/index.d.ts.map +0 -1
- package/lib/node/utils/index.js +0 -18
- package/lib/node/utils/index.js.map +0 -1
- package/src/common/annotation/decorate.ts +0 -1
- package/src/common/annotation/inject.ts +0 -1
- package/src/common/annotation/injectable.ts +0 -1
- package/src/common/annotation/pre-destroy.ts +0 -1
- package/src/common/annotation/target-name.ts +0 -1
- package/src/common/annotation/unmanaged.ts +0 -1
- package/src/common/container/container-factory.ts +0 -9
- package/src/common/el/jexl-engine-provider.ts +0 -18
- package/src/common/provider/provider-creator.ts +0 -12
- package/src/node/utils/crc.ts +0 -7
- package/src/node/utils/index.ts +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ContainerError } from './container-error.js';
|
|
2
|
+
const PARAMETERS = 'cell:di:parameters';
|
|
3
|
+
const PROPERTIES = 'cell:di:properties';
|
|
4
|
+
const POST_CONSTRUCT = 'cell:di:post-construct';
|
|
5
|
+
/** What TypeScript writes for parameters whose type is an interface, a union or a primitive. */
|
|
6
|
+
const NOT_AN_ID = [Object, Function, Array, String, Number, Boolean, Symbol, BigInt, Promise];
|
|
7
|
+
export var InjectionUtil;
|
|
8
|
+
(function (InjectionUtil) {
|
|
9
|
+
const plans = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* The injection point of a parameter or property decorator (`@Autowired`, `@Optional`, `@Named`...):
|
|
12
|
+
* the first decorator creates it, the others complete it. Subclasses inherit the properties.
|
|
13
|
+
*/
|
|
14
|
+
function point(target, key, index) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (index !== undefined) {
|
|
17
|
+
if (key !== undefined) {
|
|
18
|
+
throw new Error(`${target.constructor.name}.${String(key)}: only constructor parameters and properties can be injected.`);
|
|
19
|
+
}
|
|
20
|
+
let parameters = Reflect.getOwnMetadata(PARAMETERS, target);
|
|
21
|
+
if (!parameters) {
|
|
22
|
+
parameters = [];
|
|
23
|
+
Reflect.defineMetadata(PARAMETERS, parameters, target);
|
|
24
|
+
}
|
|
25
|
+
return (_a = parameters[index]) !== null && _a !== void 0 ? _a : (parameters[index] = { owner: target, key: index });
|
|
26
|
+
}
|
|
27
|
+
const owner = target.constructor;
|
|
28
|
+
let properties = Reflect.getOwnMetadata(PROPERTIES, owner);
|
|
29
|
+
if (!properties) {
|
|
30
|
+
properties = new Map(Reflect.getMetadata(PROPERTIES, owner));
|
|
31
|
+
Reflect.defineMetadata(PROPERTIES, properties, owner);
|
|
32
|
+
}
|
|
33
|
+
let point = properties.get(key);
|
|
34
|
+
if (!point || point.owner !== owner) {
|
|
35
|
+
point = { owner, key };
|
|
36
|
+
properties.set(key, point);
|
|
37
|
+
}
|
|
38
|
+
return point;
|
|
39
|
+
}
|
|
40
|
+
InjectionUtil.point = point;
|
|
41
|
+
/** Forgets a property: its value does not come from the container (`detached` injections). */
|
|
42
|
+
function remove(target, key) {
|
|
43
|
+
const properties = Reflect.getOwnMetadata(PROPERTIES, target.constructor);
|
|
44
|
+
properties === null || properties === void 0 ? void 0 : properties.delete(key);
|
|
45
|
+
}
|
|
46
|
+
InjectionUtil.remove = remove;
|
|
47
|
+
function setPostConstruct(target, key) {
|
|
48
|
+
Reflect.defineMetadata(POST_CONSTRUCT, key, target.constructor);
|
|
49
|
+
}
|
|
50
|
+
InjectionUtil.setPostConstruct = setPostConstruct;
|
|
51
|
+
function plan(type) {
|
|
52
|
+
var _a;
|
|
53
|
+
var _b;
|
|
54
|
+
let plan = plans.get(type);
|
|
55
|
+
if (!plan) {
|
|
56
|
+
plan = {
|
|
57
|
+
parameters: parameters(type),
|
|
58
|
+
properties: [...(_b = (_a = Reflect.getMetadata(PROPERTIES, type)) === null || _a === void 0 ? void 0 : _a.values()) !== null && _b !== void 0 ? _b : []].map(complete),
|
|
59
|
+
postConstruct: Reflect.getMetadata(POST_CONSTRUCT, type)
|
|
60
|
+
};
|
|
61
|
+
plans.set(type, plan);
|
|
62
|
+
}
|
|
63
|
+
return plan;
|
|
64
|
+
}
|
|
65
|
+
InjectionUtil.plan = plan;
|
|
66
|
+
/** The parameters of the nearest constructor in the class hierarchy that TypeScript or a decorator described. */
|
|
67
|
+
function parameters(type) {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
for (let c = type; c && c !== Function.prototype; c = Object.getPrototypeOf(c)) {
|
|
70
|
+
const points = Reflect.getOwnMetadata(PARAMETERS, c);
|
|
71
|
+
const types = Reflect.getOwnMetadata('design:paramtypes', c);
|
|
72
|
+
if (points || types) {
|
|
73
|
+
const count = Math.max((_a = points === null || points === void 0 ? void 0 : points.length) !== null && _a !== void 0 ? _a : 0, (_b = types === null || types === void 0 ? void 0 : types.length) !== null && _b !== void 0 ? _b : 0);
|
|
74
|
+
const result = [];
|
|
75
|
+
for (let i = 0; i < count; i++) {
|
|
76
|
+
const point = (_c = points === null || points === void 0 ? void 0 : points[i]) !== null && _c !== void 0 ? _c : { owner: c, key: i };
|
|
77
|
+
const declared = types === null || types === void 0 ? void 0 : types[i];
|
|
78
|
+
result.push(complete(point.id === undefined && typeof declared === 'function' && !NOT_AN_ID.includes(declared)
|
|
79
|
+
? { ...point, id: declared } : point));
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
function complete(point) {
|
|
87
|
+
if (point.id === undefined) {
|
|
88
|
+
throw missing(point);
|
|
89
|
+
}
|
|
90
|
+
return point;
|
|
91
|
+
}
|
|
92
|
+
function missing(point) {
|
|
93
|
+
const where = describe(point);
|
|
94
|
+
return new ContainerError({
|
|
95
|
+
code: 'CELL_DI_MISSING_INJECT',
|
|
96
|
+
message: `${where} has no @Autowired (or @Value), so the container does not know what to inject.`,
|
|
97
|
+
hint: 'Add @Autowired(<id>) to the constructor parameter or property; an interface type needs the id explicitly.',
|
|
98
|
+
path: [where]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** `UserService.repository` or `UserService constructor parameter #0`. */
|
|
102
|
+
function describe(target) {
|
|
103
|
+
var _a;
|
|
104
|
+
const owner = ((_a = target.owner) === null || _a === void 0 ? void 0 : _a.name) || '(anonymous class)';
|
|
105
|
+
return typeof target.key === 'number' ? `${owner} constructor parameter #${target.key}` : `${owner}.${String(target.key)}`;
|
|
106
|
+
}
|
|
107
|
+
InjectionUtil.describe = describe;
|
|
108
|
+
})(InjectionUtil || (InjectionUtil = {}));
|
|
109
|
+
//# sourceMappingURL=injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injection.js","sourceRoot":"","sources":["../../../src/common/container/injection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4BnD,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,gGAAgG;AAChG,MAAM,SAAS,GAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,O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D,OAAO,MAAM,CAAC;YAClB,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,SAAS,QAAQ,CAAC,KAAY;QAC1B,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,KAAwB,CAAC;IACpC,CAAC;IAED,SAAS,OAAO,CAAC,KAAY;QACzB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,IAAI,cAAc,CAAC;YACtB,IAAI,EAAE,wBAAwB;YAC9B,OAAO,EAAE,GAAG,KAAK,gFAAgF;YACjG,IAAI,EAAE,2GAA2G;YACjH,IAAI,EAAE,CAAC,KAAK,CAAC;SAChB,CAAC,CAAC;IACP,CAAC;IAED,0EAA0E;IAC1E,SAAgB,QAAQ,CAAC,MAAgC;;QACrD,MAAM,KAAK,GAAG,CAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,IAAI,KAAI,mBAAmB,CAAC;QACxD,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,2BAA2B,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IAC/H,CAAC;IAHe,cAAA,QAAQ,WAGvB,CAAA;AACL,CAAC,EAnGgB,aAAa,KAAb,aAAa,QAmG7B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export var Scope;
|
|
2
2
|
(function (Scope) {
|
|
3
|
-
Scope[
|
|
4
|
-
Scope[
|
|
5
|
-
Scope[Scope["Transient"] = 2] = "Transient";
|
|
3
|
+
Scope["Singleton"] = "Singleton";
|
|
4
|
+
Scope["Transient"] = "Transient";
|
|
6
5
|
})(Scope || (Scope = {}));
|
|
7
6
|
//# sourceMappingURL=scope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/common/container/scope.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/common/container/scope.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACb,gCAAuB,CAAA;IACvB,gCAAuB,CAAA;AAC3B,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExpressionEngine } from './expression-engine.js';
|
|
2
|
+
/**
|
|
3
|
+
* The expression engine of the application, `@Autowired(ExpressionEngine)`: CoreContextInitializer adds
|
|
4
|
+
* the `replace`, `regexp` and `eval` transforms to it; add your own transforms and functions the same way.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ApplicationExpressionEngine extends ExpressionEngine {
|
|
7
|
+
}
|
|
@@ -5,15 +5,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Component } from '../annotation/component.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { ExpressionEngine } from './expression-engine.js';
|
|
9
|
+
/**
|
|
10
|
+
* The expression engine of the application, `@Autowired(ExpressionEngine)`: CoreContextInitializer adds
|
|
11
|
+
* the `replace`, `regexp` and `eval` transforms to it; add your own transforms and functions the same way.
|
|
12
|
+
*/
|
|
13
|
+
let ApplicationExpressionEngine = class ApplicationExpressionEngine extends ExpressionEngine {
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
Component(
|
|
17
|
-
],
|
|
18
|
-
export {
|
|
19
|
-
//# sourceMappingURL=
|
|
15
|
+
ApplicationExpressionEngine = __decorate([
|
|
16
|
+
Component(ExpressionEngine)
|
|
17
|
+
], ApplicationExpressionEngine);
|
|
18
|
+
export { ApplicationExpressionEngine };
|
|
19
|
+
//# sourceMappingURL=application-expression-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-expression-engine.js","sourceRoot":"","sources":["../../../src/common/el/application-expression-engine.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;GAGG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,gBAAgB;CAAI,CAAA;AAAxD,2BAA2B;IADvC,SAAS,CAAC,gBAAgB,CAAC;GACf,2BAA2B,CAA6B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ContextInitializer, ExpressionContext
|
|
1
|
+
import { ContextInitializer, ExpressionContext } from './expression-protocol.js';
|
|
2
|
+
import { ExpressionEngine } from './expression-engine.js';
|
|
2
3
|
export declare class CoreContextInitializer implements ContextInitializer {
|
|
3
|
-
protected readonly
|
|
4
|
+
protected readonly engine: ExpressionEngine;
|
|
4
5
|
initialize(ctx: ExpressionContext): void;
|
|
5
6
|
priority: number;
|
|
6
7
|
}
|
|
@@ -9,7 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Component, Autowired } from '../annotation/index.js';
|
|
11
11
|
import { ContainerUtil } from '../container/index.js';
|
|
12
|
-
import { ContextInitializer,
|
|
12
|
+
import { ContextInitializer, ExpressionHandler } from './expression-protocol.js';
|
|
13
|
+
import { ExpressionEngine } from './expression-engine.js';
|
|
13
14
|
let CoreContextInitializer = class CoreContextInitializer {
|
|
14
15
|
constructor() {
|
|
15
16
|
this.priority = 500;
|
|
@@ -18,17 +19,18 @@ let CoreContextInitializer = class CoreContextInitializer {
|
|
|
18
19
|
if (typeof process !== 'undefined') {
|
|
19
20
|
ctx.env = { ...process.env, _ignoreEl: true };
|
|
20
21
|
}
|
|
21
|
-
const jexlEngine = this.jexlEngineProvider.provide();
|
|
22
|
-
jexlEngine.addTransform('replace', (val, searchValue, replaceValue) => val && val.replace(new RegExp(searchValue, 'g'), replaceValue));
|
|
23
|
-
jexlEngine.addTransform('regexp', (pattern, flags) => new RegExp(pattern, flags));
|
|
24
22
|
const expressionHandler = ContainerUtil.get(ExpressionHandler);
|
|
25
|
-
|
|
23
|
+
this.engine.addTransforms({
|
|
24
|
+
replace: (val, searchValue, replaceValue) => val && val.replace(new RegExp(searchValue, 'g'), replaceValue),
|
|
25
|
+
regexp: (pattern, flags) => new RegExp(pattern, flags),
|
|
26
|
+
eval: (text) => expressionHandler.handle(text)
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
__decorate([
|
|
29
|
-
Autowired(
|
|
30
|
-
__metadata("design:type",
|
|
31
|
-
], CoreContextInitializer.prototype, "
|
|
31
|
+
Autowired(ExpressionEngine),
|
|
32
|
+
__metadata("design:type", ExpressionEngine)
|
|
33
|
+
], CoreContextInitializer.prototype, "engine", void 0);
|
|
32
34
|
CoreContextInitializer = __decorate([
|
|
33
35
|
Component(ContextInitializer)
|
|
34
36
|
], CoreContextInitializer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-context-initializer.js","sourceRoot":"","sources":["../../../src/common/el/core-context-initializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAqB,
|
|
1
|
+
{"version":3,"file":"core-context-initializer.js","sourceRoot":"","sources":["../../../src/common/el/core-context-initializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OA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ionCompiler, ExpressionCompilerOptions } from './expression-protocol.js';
|
|
2
|
+
import { Expression, ExpressionEngine } from './expression-engine.js';
|
|
3
|
+
import { ExpressionSectionCompiler } from './expression-util.js';
|
|
4
|
+
/** The {@link ExpressionSectionCompiler} on the expression engine of the container (with its transforms). */
|
|
6
5
|
export declare class ExpressionCompilerImpl implements ExpressionCompiler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private BRACKET_END;
|
|
11
|
-
protected readonly jexlEngineProvider: JexlEngineProvider<any>;
|
|
12
|
-
protected getSpecialChar(opitons: Required<ExpressionCompilerOptions>): string;
|
|
13
|
-
protected equalsSpecialChar(opitons: Required<ExpressionCompilerOptions>, char: string): boolean;
|
|
14
|
-
compileSections(text: string, options: ExpressionCompilerOptions): any[];
|
|
15
|
-
protected middleCompile(text: string, options: Required<ExpressionCompilerOptions>): MiddleExpression | undefined;
|
|
16
|
-
protected nextMiddleExpression(text: string, bracketBeginCharNum: number | undefined, options: Required<ExpressionCompilerOptions>): MiddleExpression | undefined;
|
|
17
|
-
protected nextString(text: string, options: Required<ExpressionCompilerOptions>): MiddleExpression;
|
|
6
|
+
protected readonly engine: ExpressionEngine;
|
|
7
|
+
protected readonly sectionCompiler: ExpressionSectionCompiler;
|
|
8
|
+
compileSections(text: string, options?: ExpressionCompilerOptions): (string | Expression)[];
|
|
18
9
|
}
|
|
19
|
-
export {};
|
|
@@ -7,179 +7,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { ExpressionCompiler, JexlEngineProvider } from './expression-protocol.js';
|
|
11
10
|
import { Component, Autowired } from '../annotation/index.js';
|
|
11
|
+
import { ExpressionCompiler } from './expression-protocol.js';
|
|
12
|
+
import { ExpressionEngine } from './expression-engine.js';
|
|
13
|
+
import { ExpressionSectionCompiler } from './expression-util.js';
|
|
14
|
+
/** The {@link ExpressionSectionCompiler} on the expression engine of the container (with its transforms). */
|
|
12
15
|
let ExpressionCompilerImpl = class ExpressionCompilerImpl {
|
|
13
16
|
constructor() {
|
|
14
|
-
this.
|
|
15
|
-
this.SPECIAL_CHAR = '$';
|
|
16
|
-
this.BRACKET_BEGIN = '{';
|
|
17
|
-
this.BRACKET_END = '}';
|
|
17
|
+
this.sectionCompiler = new ExpressionSectionCompiler(() => this.engine);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
return opitons.specialChar;
|
|
24
|
-
}
|
|
25
|
-
equalsSpecialChar(opitons, char) {
|
|
26
|
-
if (opitons.ignoreSpecialChar) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return char === opitons.specialChar;
|
|
30
|
-
}
|
|
31
|
-
compileSections(text, options) {
|
|
32
|
-
const merged = {
|
|
33
|
-
...{ escapeChar: this.ESCAPE_CHAR, specialChar: this.SPECIAL_CHAR, bracketBegin: this.BRACKET_BEGIN, bracketEnd: this.BRACKET_END, ...options }
|
|
34
|
-
};
|
|
35
|
-
if (!text || text.indexOf(`${this.getSpecialChar(merged)}${merged.bracketBegin}`) < 0) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
const sections = [];
|
|
39
|
-
let middleText = text;
|
|
40
|
-
while (middleText) {
|
|
41
|
-
const me = this.middleCompile(middleText, merged);
|
|
42
|
-
if (!me) {
|
|
43
|
-
sections.push(middleText);
|
|
44
|
-
middleText = undefined;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
sections.push(me.expression);
|
|
48
|
-
middleText = me.nextText;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return sections;
|
|
52
|
-
}
|
|
53
|
-
middleCompile(text, options) {
|
|
54
|
-
let me;
|
|
55
|
-
const prefix = `${this.getSpecialChar(options)}${options.bracketBegin}`;
|
|
56
|
-
const prefix2 = `${prefix}${options.bracketBegin}`;
|
|
57
|
-
if (text.startsWith(prefix2)) {
|
|
58
|
-
me = this.nextMiddleExpression(text.substring(prefix2.length), 2, options);
|
|
59
|
-
}
|
|
60
|
-
else if (text.startsWith(prefix)) {
|
|
61
|
-
me = this.nextMiddleExpression(text.substring(prefix.length), undefined, options);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
me = this.nextString(text, options);
|
|
65
|
-
}
|
|
66
|
-
return me;
|
|
67
|
-
}
|
|
68
|
-
nextMiddleExpression(text, bracketBeginCharNum = 1, options) {
|
|
69
|
-
let stringed = false;
|
|
70
|
-
let escaped = false;
|
|
71
|
-
let bracketBeginCharFound = 0;
|
|
72
|
-
const section = [];
|
|
73
|
-
for (let i = 0; i < text.length; i++) {
|
|
74
|
-
const c = text[i];
|
|
75
|
-
if (!escaped) {
|
|
76
|
-
if ('\'' === c || '"' === c) {
|
|
77
|
-
stringed = !stringed;
|
|
78
|
-
section.push(c);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
else if (c === options.escapeChar) {
|
|
82
|
-
escaped = true;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (stringed) {
|
|
87
|
-
section.push(c);
|
|
88
|
-
escaped = false;
|
|
89
|
-
}
|
|
90
|
-
else if (escaped) {
|
|
91
|
-
if (this.equalsSpecialChar(options, c) || options.bracketBegin === c || options.bracketEnd === c) {
|
|
92
|
-
section.push(c);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
section.push(options.escapeChar);
|
|
96
|
-
section.push(c);
|
|
97
|
-
}
|
|
98
|
-
escaped = false;
|
|
99
|
-
}
|
|
100
|
-
else if (options.bracketBegin === c) {
|
|
101
|
-
bracketBeginCharFound++;
|
|
102
|
-
section.push(c);
|
|
103
|
-
}
|
|
104
|
-
else if (options.bracketEnd === c) {
|
|
105
|
-
if (bracketBeginCharFound === 0 && bracketBeginCharNum === 1) {
|
|
106
|
-
const jexlEngine = this.jexlEngineProvider.provide();
|
|
107
|
-
const expression = jexlEngine.createExpression(section.join(''));
|
|
108
|
-
let nextText;
|
|
109
|
-
if (i !== text.length - 1) {
|
|
110
|
-
nextText = text.substring(i + 1);
|
|
111
|
-
}
|
|
112
|
-
return { expression, nextText };
|
|
113
|
-
}
|
|
114
|
-
else if (bracketBeginCharFound > 0) {
|
|
115
|
-
bracketBeginCharFound--;
|
|
116
|
-
section.push(c);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
bracketBeginCharNum--;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
section.push(c);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
nextString(text, options) {
|
|
128
|
-
let escaped = false;
|
|
129
|
-
let specialCharFound = false;
|
|
130
|
-
const section = [];
|
|
131
|
-
for (let i = 0; i < text.length; i++) {
|
|
132
|
-
const c = text[i];
|
|
133
|
-
if (!escaped) {
|
|
134
|
-
if ('\'' === c || '"' === c) {
|
|
135
|
-
section.push(c);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
else if (c === options.escapeChar) {
|
|
139
|
-
escaped = true;
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (escaped) {
|
|
144
|
-
if (this.equalsSpecialChar(options, c) || options.bracketBegin === c || options.bracketEnd === c) {
|
|
145
|
-
section.push(c);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
section.push(options.escapeChar);
|
|
149
|
-
section.push(c);
|
|
150
|
-
}
|
|
151
|
-
escaped = false;
|
|
152
|
-
}
|
|
153
|
-
else if (specialCharFound || options.ignoreSpecialChar) {
|
|
154
|
-
if (options.bracketBegin === c) {
|
|
155
|
-
const expression = section.join('');
|
|
156
|
-
const nextText = options.ignoreSpecialChar ? text.substring(i) : text.substring(i - 1);
|
|
157
|
-
return { expression, nextText };
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
if (!options.ignoreSpecialChar) {
|
|
161
|
-
specialCharFound = false;
|
|
162
|
-
section.push(options.specialChar);
|
|
163
|
-
}
|
|
164
|
-
section.push(c);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
if (this.equalsSpecialChar(options, c)) {
|
|
169
|
-
specialCharFound = true;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
section.push(c);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return { expression: section.join('') };
|
|
19
|
+
compileSections(text, options = {}) {
|
|
20
|
+
return this.sectionCompiler.compileSections(text, options);
|
|
177
21
|
}
|
|
178
22
|
};
|
|
179
23
|
__decorate([
|
|
180
|
-
Autowired(
|
|
181
|
-
__metadata("design:type",
|
|
182
|
-
], ExpressionCompilerImpl.prototype, "
|
|
24
|
+
Autowired(ExpressionEngine),
|
|
25
|
+
__metadata("design:type", ExpressionEngine)
|
|
26
|
+
], ExpressionCompilerImpl.prototype, "engine", void 0);
|
|
183
27
|
ExpressionCompilerImpl = __decorate([
|
|
184
28
|
Component(ExpressionCompiler)
|
|
185
29
|
], ExpressionCompilerImpl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-compiler.js","sourceRoot":"","sources":["../../../src/common/el/expression-compiler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"expression-compiler.js","sourceRoot":"","sources":["../../../src/common/el/expression-compiler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAc,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,6GAA6G;AAEtG,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QAKgB,oBAAe,GAAG,IAAI,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAM1F,CAAC;IAJG,eAAe,CAAC,IAAY,EAAE,OAAO,GAA8B,EAAE;QACjE,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;CAEJ,CAAA;AARsB;IADlB,SAAS,CAAC,gBAAgB,CAAC;8BACD,gBAAgB;sDAAC;AAHnC,sBAAsB;IADlC,SAAS,CAAC,kBAAkB,CAAC;GACjB,sBAAsB,CAWlC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The expression language of Cell: what `${...}` in the configuration, `@Value` and the security
|
|
3
|
+
* policies evaluate. Its grammar is the one of jexl 2, which Cell used before:
|
|
4
|
+
*
|
|
5
|
+
* - literals: `'text'`, `"text"`, `42`, `1.5`, `true`, `false`, `[a, b]`, `{ key: value }`;
|
|
6
|
+
* - names: `cell.server.port`, `list[0]`, `map['key']`, filters `users[.age > 18]` (`.age` is a
|
|
7
|
+
* property of each element); a missing property is `undefined`, never an error; a property of an
|
|
8
|
+
* array is the property of its first element;
|
|
9
|
+
* - operators, loosest first: `a ? b : c` and `a ?: b` (`b` when `a` is falsy), `||` and `&&` (same
|
|
10
|
+
* precedence, left to right), `== != > >= < <= in`, `+ -`, `* / //` (`//` rounds down), `% ^`
|
|
11
|
+
* (`^` is power), then `!` and `-` in front;
|
|
12
|
+
* - transforms `value|name(args)` and functions `name(args)`: only the ones added to the engine.
|
|
13
|
+
*
|
|
14
|
+
* Evaluation is synchronous. Expressions cannot call methods, so they only read what the context gives.
|
|
15
|
+
*/
|
|
16
|
+
/** The code of an {@link ExpressionSyntaxError}. */
|
|
17
|
+
export type ExpressionErrorCode = 'CELL_EL_SYNTAX' | 'CELL_EL_UNKNOWN_TRANSFORM' | 'CELL_EL_UNKNOWN_FUNCTION';
|
|
18
|
+
/** An expression that cannot be parsed, or that uses a transform or function the engine does not have. */
|
|
19
|
+
export declare class ExpressionSyntaxError extends Error {
|
|
20
|
+
readonly name = "ExpressionSyntaxError";
|
|
21
|
+
readonly code: ExpressionErrorCode;
|
|
22
|
+
readonly hint: string;
|
|
23
|
+
readonly expression: string;
|
|
24
|
+
/** Where in `expression` parsing failed. */
|
|
25
|
+
readonly position?: number;
|
|
26
|
+
constructor(options: {
|
|
27
|
+
code: ExpressionErrorCode;
|
|
28
|
+
message: string;
|
|
29
|
+
hint: string;
|
|
30
|
+
expression: string;
|
|
31
|
+
position?: number;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
type Evaluate = (context: any, element: any) => any;
|
|
35
|
+
/** A compiled expression; evaluate it as many times as needed. */
|
|
36
|
+
export declare class Expression {
|
|
37
|
+
readonly source: string;
|
|
38
|
+
protected readonly run: Evaluate;
|
|
39
|
+
constructor(source: string, run: Evaluate);
|
|
40
|
+
/** The value of the expression; names are properties of `context`. */
|
|
41
|
+
evaluate(context?: object): any;
|
|
42
|
+
}
|
|
43
|
+
/** Compiles and evaluates expressions; holds the transforms and functions they may call. */
|
|
44
|
+
export declare class ExpressionEngine {
|
|
45
|
+
protected static readonly CACHE_SIZE = 1000;
|
|
46
|
+
protected readonly transforms: Map<string, Function>;
|
|
47
|
+
protected readonly functions: Map<string, Function>;
|
|
48
|
+
protected readonly cache: Map<string, Expression>;
|
|
49
|
+
/** `value|name(a, b)` calls `transform(value, a, b)`. */
|
|
50
|
+
addTransform(name: string, transform: (value: any, ...args: any[]) => any): this;
|
|
51
|
+
addTransforms(transforms: Record<string, (value: any, ...args: any[]) => any>): this;
|
|
52
|
+
/** `name(a, b)` calls `fn(a, b)`. */
|
|
53
|
+
addFunction(name: string, fn: (...args: any[]) => any): this;
|
|
54
|
+
addFunctions(functions: Record<string, (...args: any[]) => any>): this;
|
|
55
|
+
/** Compiles once per source text (the latest ones are kept). Throws an {@link ExpressionSyntaxError}. */
|
|
56
|
+
compile(source: string): Expression;
|
|
57
|
+
evaluate(source: string, context?: object): any;
|
|
58
|
+
/** @internal what the compiled expressions call */
|
|
59
|
+
call(pool: 'transform' | 'function', name: string, args: any[], source: string): any;
|
|
60
|
+
}
|
|
61
|
+
export {};
|