@adaas/a-concept 0.0.3 → 0.0.4
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/dist/examples/simple/components/A.component.d.ts +7 -0
- package/dist/examples/simple/components/A.component.js +57 -0
- package/dist/examples/simple/components/A.component.js.map +1 -0
- package/dist/examples/simple/components/B.component.d.ts +9 -0
- package/dist/examples/simple/components/B.component.js +77 -0
- package/dist/examples/simple/components/B.component.js.map +1 -0
- package/dist/examples/simple/concept.d.ts +1 -0
- package/dist/examples/simple/concept.js +53 -11
- package/dist/examples/simple/concept.js.map +1 -1
- package/dist/examples/simple/containers/Main.container.d.ts +11 -0
- package/dist/examples/simple/containers/Main.container.js +64 -0
- package/dist/examples/simple/containers/Main.container.js.map +1 -0
- package/dist/examples/simple/context/Fragment_A.context.d.ts +6 -0
- package/dist/examples/simple/context/Fragment_A.context.js +16 -0
- package/dist/examples/simple/context/Fragment_A.context.js.map +1 -0
- package/dist/examples/simple/context/Fragment_B.context.d.ts +6 -0
- package/dist/examples/simple/context/Fragment_B.context.js +16 -0
- package/dist/examples/simple/context/Fragment_B.context.js.map +1 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.d.ts +9 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.js +63 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.d.ts +2 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.js +7 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.js.map +1 -0
- package/dist/examples/simple-http-server/concept.js +21 -22
- package/dist/examples/simple-http-server/concept.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +8 -8
- package/dist/examples/simple-http-server/containers/http-server.container.js +34 -30
- package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.controller.js +1 -1
- package/dist/examples/simple-http-server/containers/http-server.router.js +2 -2
- package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -1
- package/dist/examples/simple-http-server/contexts/http-request.context.d.ts +13 -0
- package/dist/examples/simple-http-server/contexts/http-request.context.js +51 -0
- package/dist/examples/simple-http-server/contexts/http-request.context.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +0 -4
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js +0 -98
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -1
- package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +1 -1
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js +1 -1
- package/dist/examples/simple-http-server/controllers/users.controller.js +2 -2
- package/dist/examples/simple-http-server/test.d.ts +68 -0
- package/dist/examples/simple-http-server/test.js +162 -0
- package/dist/examples/simple-http-server/test.js.map +1 -0
- package/dist/index.d.ts +25 -19
- package/dist/index.js +55 -26
- package/dist/index.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.container.d.ts +8 -0
- package/dist/src/base/A-Config/A-Config.container.js +64 -0
- package/dist/src/base/A-Config/A-Config.container.js.map +1 -0
- package/dist/src/base/A-Config/A-Config.context.d.ts +30 -0
- package/dist/src/base/A-Config/A-Config.context.js +58 -0
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -0
- package/dist/src/base/A-Config/A-Config.types.d.ts +14 -0
- package/dist/src/base/A-Config/A-Config.types.js +3 -0
- package/dist/src/base/A-Config/A-Config.types.js.map +1 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +19 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.js +53 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.d.ts +10 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js +37 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.d.ts +11 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.js +47 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.component.d.ts +18 -0
- package/dist/src/base/A-Errors/A-Errors.component.js +85 -0
- package/dist/src/base/A-Errors/A-Errors.component.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.context.d.ts +27 -0
- package/dist/src/base/A-Errors/A-Errors.context.js +50 -0
- package/dist/src/base/A-Errors/A-Errors.context.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.types.d.ts +5 -0
- package/dist/src/base/A-Errors/A-Errors.types.js +3 -0
- package/dist/src/base/A-Errors/A-Errors.types.js.map +1 -0
- package/dist/src/base/A-Logger/A-Logger.component.d.ts +28 -0
- package/dist/src/base/A-Logger/A-Logger.component.js +142 -0
- package/dist/src/base/A-Logger/A-Logger.component.js.map +1 -0
- package/dist/src/base/A-Logger/A-Logger.types.js +2 -0
- package/dist/src/base/A-Logger/A-Logger.types.js.map +1 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +0 -2
- package/dist/src/constants/A_ConceptLifecycle.constants.js +9 -10
- package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -1
- package/dist/src/containers/A-Config/A-Config.container.js +1 -1
- package/dist/src/containers/A-Config/A-Config.namespace.d.ts +1 -1
- package/dist/src/containers/A-Config/A-Config.namespace.js +1 -1
- package/dist/src/containers/A-Config/A-Config.types.d.ts +1 -1
- package/dist/src/containers/A-Errors/A-Errors.container.js +1 -1
- package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +1 -1
- package/dist/src/containers/A-Errors/A-Errors.namespace.js +1 -1
- package/dist/src/containers/A-Errors/A-Errors.types.d.ts +1 -1
- package/dist/src/containers/A-Logger/A-Logger.container.js +1 -1
- package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +1 -1
- package/dist/src/containers/A-Logger/A-Logger.namespace.js +1 -1
- package/dist/src/containers/A-Logger/components/Logger.component.d.ts +1 -1
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -1
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.js +36 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.js.map +1 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js +3 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.d.ts +14 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js +24 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js.map +1 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js +3 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Define/index.d.ts +7 -0
- package/dist/src/decorators/A-Define/index.js +10 -0
- package/dist/src/decorators/A-Define/index.js.map +1 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.d.ts +18 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.js +37 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.js.map +1 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.d.ts +21 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js +3 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +37 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +42 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +20 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +12 -10
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +16 -26
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +4 -3
- package/dist/src/decorators/A-Stage/A-Stage.decorator.d.ts +12 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.js +35 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.js.map +1 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.d.ts +2 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js +3 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js.map +1 -0
- package/dist/src/global/A-Channel/A-Channel.class.d.ts +18 -0
- package/dist/src/global/A-Channel/A-Channel.class.js +54 -0
- package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -0
- package/dist/src/global/A-Channel/A-Channel.types.d.ts +35 -0
- package/dist/src/global/A-Channel/A-Channel.types.js +3 -0
- package/dist/src/global/A-Channel/A-Channel.types.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +1 -11
- package/dist/src/global/A-Component/A-Component.class.js +0 -7
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +4 -0
- package/dist/src/global/A-Component/A-Component.meta.js +8 -0
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.types.d.ts +18 -0
- package/dist/src/global/A-Component/A-Component.types.js +10 -0
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +41 -17
- package/dist/src/global/A-Concept/A_Concept.class.js +120 -43
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.meta.d.ts +3 -0
- package/dist/src/global/A-Concept/A_Concept.meta.js +9 -0
- package/dist/src/global/A-Concept/A_Concept.meta.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +31 -16
- package/dist/src/global/A-Concept/A_Concept.types.js +25 -0
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +72 -10
- package/dist/src/global/A-Container/A-Container.class.js +119 -9
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +7 -0
- package/dist/src/global/A-Container/A-Container.meta.js +54 -0
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.types.d.ts +31 -0
- package/dist/src/global/A-Container/A-Container.types.js +9 -0
- package/dist/src/global/A-Container/A-Container.types.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.class.d.ts +36 -54
- package/dist/src/global/A-Context/A-Context.class.js +127 -61
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +12 -0
- package/dist/src/global/A-Context/A-Context.types.js +1 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.d.ts +12 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.js +19 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -55
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +56 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +10 -0
- package/dist/src/global/A-Entity/A-Entity.class.js +16 -0
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.types.js +2 -0
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +44 -0
- package/dist/src/global/A-Feature/A-Feature.class.js +125 -0
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +17 -0
- package/dist/src/global/A-Feature/A-Feature.types.js +11 -0
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +38 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js +107 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +3 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.js +3 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +11 -0
- package/dist/src/global/A-Meta/A-Meta.class.js +43 -0
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -0
- package/dist/src/global/A-Meta/A-Meta.types.js +2 -0
- package/dist/src/global/A-Meta/A-Meta.types.js.map +1 -0
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +51 -0
- package/dist/src/global/A-Scope/A-Scope.class.js +133 -0
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -0
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +32 -0
- package/dist/src/global/A-Scope/A-Scope.types.js +3 -0
- package/dist/src/global/A-Scope/A-Scope.types.js.map +1 -0
- package/dist/src/storage/A_Component.storage.d.ts +10 -0
- package/dist/src/storage/A_Component.storage.js +17 -0
- package/dist/src/storage/A_Component.storage.js.map +1 -0
- package/dist/src/storage/A_Concept.storage.js +2 -2
- package/dist/src/storage/A_Concept.storage.js.map +1 -1
- package/dist/src/storage/A_Container.storage.d.ts +8 -0
- package/dist/src/storage/A_Container.storage.js +17 -0
- package/dist/src/storage/A_Container.storage.js.map +1 -0
- package/dist/src/storage/A_Inject.storage.d.ts +9 -0
- package/dist/src/storage/A_Inject.storage.js +13 -0
- package/dist/src/storage/A_Inject.storage.js.map +1 -0
- package/examples/simple/components/A.component.ts +35 -0
- package/examples/simple/components/B.component.ts +46 -0
- package/examples/simple/concept.ts +49 -12
- package/examples/simple/containers/Main.container.ts +41 -0
- package/examples/simple/context/Fragment_A.context.ts +25 -0
- package/examples/simple/context/Fragment_B.context.ts +19 -0
- package/examples/simple-http-server/components/http-error-handler.component.ts +44 -0
- package/examples/simple-http-server/components/http-request-handler.component.ts +9 -0
- package/examples/simple-http-server/concept.ts +22 -21
- package/examples/simple-http-server/containers/http-server.container.ts +23 -38
- package/examples/simple-http-server/contexts/http-request.context.ts +59 -0
- package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -108
- package/examples/simple-http-server/test.ts +290 -0
- package/index.ts +50 -22
- package/jest.config.ts +2 -0
- package/package.json +4 -7
- package/src/{containers → base}/A-Config/A-Config.container.ts +21 -20
- package/src/{containers/A-Config/A-Config.namespace.ts → base/A-Config/A-Config.context.ts} +12 -5
- package/src/{containers → base}/A-Config/A-Config.types.ts +10 -4
- package/src/{containers → base}/A-Config/components/ConfigReader.component.ts +7 -3
- package/src/{containers → base}/A-Config/components/ENVConfigReader.component.ts +1 -1
- package/src/{containers → base}/A-Config/components/FileConfigReader.component.ts +1 -1
- package/src/base/A-Errors/A-Errors.component.ts +102 -0
- package/src/{containers/A-Errors/A-Errors.namespace.ts → base/A-Errors/A-Errors.context.ts} +24 -39
- package/src/{containers → base}/A-Errors/A-Errors.types.ts +2 -2
- package/src/base/A-Logger/A-Logger.component.ts +169 -0
- package/src/base/A-Logger/A-Logger.types.ts +0 -0
- package/src/constants/A_ConceptLifecycle.constants.ts +9 -9
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +57 -0
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +57 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +56 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +65 -53
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +31 -4
- package/src/decorators/A-Stage/A-Stage.decorator.ts +57 -0
- package/src/decorators/A-Stage/A-Stage.decorator.types.ts +23 -0
- package/src/global/A-Channel/A-Channel.class.ts +48 -0
- package/src/global/A-Channel/A-Channel.types.ts +60 -0
- package/src/global/A-Component/A-Component.class.ts +1 -29
- package/src/global/A-Component/A-Component.meta.ts +9 -0
- package/src/global/A-Component/A-Component.types.ts +40 -0
- package/src/global/A-Concept/A_Concept.class.ts +160 -66
- package/src/global/A-Concept/A_Concept.meta.ts +9 -0
- package/src/global/A-Concept/A_Concept.types.ts +45 -10
- package/src/global/A-Container/A-Container.class.ts +177 -22
- package/src/global/A-Container/A-Container.meta.ts +80 -0
- package/src/global/A-Container/A-Container.types.ts +40 -0
- package/src/global/A-Context/A-Context.class.ts +231 -130
- package/src/global/A-Context/A-Context.types.ts +15 -0
- package/src/global/A-Dependency/A-DependencyReference.types.ts +56 -56
- package/src/global/A-Entity/A-Entity.class.ts +16 -0
- package/src/global/A-Entity/A-Entity.types.ts +0 -0
- package/src/global/A-Feature/A-Feature.class.ts +156 -0
- package/src/global/A-Feature/A-Feature.types.ts +20 -0
- package/src/global/{A-Namespace/A_Namespace.class.ts → A-Fragment/A-Fragment.class.ts} +24 -30
- package/src/global/A-Fragment/A-Fragment.types.ts +6 -0
- package/src/global/A-Meta/A-Meta.class.ts +60 -0
- package/src/global/A-Meta/A-Meta.types.ts +0 -0
- package/src/global/A-Scope/A-Scope.class.ts +208 -0
- package/src/global/A-Scope/A-Scope.types.ts +37 -0
- package/src/storage/A_Component.storage.ts +28 -0
- package/src/storage/A_Concept.storage.ts +5 -1
- package/src/storage/A_Container.storage.ts +21 -0
- package/src/storage/A_Inject.storage.ts +30 -0
- package/tsconfig.json +3 -1
- package/examples/sdk/concept.ts +0 -24
- package/examples/sdk/orders.api.ts +0 -21
- package/examples/sdk/users.api.ts +0 -21
- package/examples/simple-http-server/containers/http-server.controller.ts +0 -24
- package/examples/simple-http-server/containers/http-server.router.ts +0 -23
- package/examples/simple-http-server/contexts/http-server.namespace.ts +0 -36
- package/src/containers/A-Errors/A-Errors.container.ts +0 -14
- package/src/containers/A-Logger/A-Logger.container.ts +0 -22
- package/src/containers/A-Logger/A-Logger.namespace.ts +0 -26
- package/src/containers/A-Logger/components/Logger.component.ts +0 -169
- package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +0 -46
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +0 -55
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +0 -20
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +0 -62
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +0 -28
- package/src/decorators/A-ConceptLifecycle/index.ts +0 -9
- package/src/decorators/A-Feature/A-Feature.decorator.ts +0 -13
- package/src/decorators/A_Lazy.decorator.ts +0 -31
- package/src/global/A-Namespace/A_Namespace.types.ts +0 -24
- /package/{src/containers/A-Logger/A-Logger.types.ts → dist/src/base/A-Logger/A-Logger.types.d.ts} +0 -0
- /package/{src/decorators/A_ConceptMethods.decorator.ts → dist/src/global/A-Entity/A-Entity.types.d.ts} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_Scope = void 0;
|
|
4
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
5
|
+
const A_Inject_storage_1 = require("../../storage/A_Inject.storage");
|
|
6
|
+
const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* A_Scope refers to the visibility and accessibility of :
|
|
11
|
+
* - variables,
|
|
12
|
+
* - Components,
|
|
13
|
+
* - Context Fragments
|
|
14
|
+
* - and objects in different parts of your code.
|
|
15
|
+
* Scope determines where a particular piece of data (like a variable or function)
|
|
16
|
+
* can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
class A_Scope {
|
|
21
|
+
constructor(params, config = {}) {
|
|
22
|
+
this.name = '';
|
|
23
|
+
this._components = new WeakMap();
|
|
24
|
+
this._fragments = new WeakMap();
|
|
25
|
+
this.name = params.name || this.constructor.name;
|
|
26
|
+
// TODO: move to defaults
|
|
27
|
+
const defaultParams = {
|
|
28
|
+
name: '',
|
|
29
|
+
components: [],
|
|
30
|
+
fragments: [],
|
|
31
|
+
import: [],
|
|
32
|
+
export: [],
|
|
33
|
+
};
|
|
34
|
+
this.params = a_utils_1.A_CommonHelper.deepCloneAndMerge(params, defaultParams);
|
|
35
|
+
this.initComponents(params.components || []);
|
|
36
|
+
this.initFragments(params.fragments || []);
|
|
37
|
+
if (config.parent) {
|
|
38
|
+
this.parent = config.parent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
initComponents(_components) {
|
|
42
|
+
// _components.forEach(component => {
|
|
43
|
+
// this._components.set(component, new component());
|
|
44
|
+
// })
|
|
45
|
+
}
|
|
46
|
+
initFragments(_fragments) {
|
|
47
|
+
_fragments.forEach(this.register.bind(this));
|
|
48
|
+
}
|
|
49
|
+
get components() {
|
|
50
|
+
return this.params.components || [];
|
|
51
|
+
}
|
|
52
|
+
has(entity) {
|
|
53
|
+
switch (true) {
|
|
54
|
+
case entity instanceof A_Fragment_class_1.A_Fragment
|
|
55
|
+
&& this._fragments.has(entity.constructor):
|
|
56
|
+
{
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
case entity instanceof A_Fragment_class_1.A_Fragment
|
|
60
|
+
&& !this._fragments.has(entity.constructor)
|
|
61
|
+
&& !!this.parent:
|
|
62
|
+
{
|
|
63
|
+
return this.parent.has(entity);
|
|
64
|
+
}
|
|
65
|
+
case !(entity instanceof A_Fragment_class_1.A_Fragment)
|
|
66
|
+
&& this._components.has(entity):
|
|
67
|
+
{
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
case !(entity instanceof A_Fragment_class_1.A_Fragment)
|
|
71
|
+
&& !this._components.has(entity)
|
|
72
|
+
&& !!this.parent:
|
|
73
|
+
{
|
|
74
|
+
return this.parent.has(entity);
|
|
75
|
+
}
|
|
76
|
+
default: {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// base definition
|
|
82
|
+
resolve(param1, param2) {
|
|
83
|
+
switch (true) {
|
|
84
|
+
case Array.isArray(param1): {
|
|
85
|
+
return param1.map(c => this.resolveOnce(c));
|
|
86
|
+
}
|
|
87
|
+
case typeof param1 === 'function': {
|
|
88
|
+
return this.resolveOnce(param1);
|
|
89
|
+
}
|
|
90
|
+
default: {
|
|
91
|
+
throw new Error('Invalid arguments provided');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
resolveOnce(component) {
|
|
96
|
+
switch (true) {
|
|
97
|
+
case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Fragment_class_1.A_Fragment): {
|
|
98
|
+
return this.resolveFragment(component);
|
|
99
|
+
}
|
|
100
|
+
case this.components.includes(component) && this._components.has(component): {
|
|
101
|
+
return this._components.get(component);
|
|
102
|
+
}
|
|
103
|
+
case this.components.includes(component) && !this._components.has(component): {
|
|
104
|
+
const argsMeta = A_Inject_storage_1.A_STORAGE__A_Inject_Instructions.get(component);
|
|
105
|
+
let resolvedArgs = [];
|
|
106
|
+
if (argsMeta)
|
|
107
|
+
resolvedArgs = (argsMeta.get('constructor') || [])
|
|
108
|
+
.map(arg => this.resolve(arg));
|
|
109
|
+
this._components.set(component, new component());
|
|
110
|
+
return this._components.get(component);
|
|
111
|
+
}
|
|
112
|
+
case !this.components.includes(component) && !!this.parent: {
|
|
113
|
+
return this.parent.resolve(component);
|
|
114
|
+
}
|
|
115
|
+
default:
|
|
116
|
+
throw new Error(`Component ${component.name} not found in the scope`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
resolveFragment(fragment) {
|
|
120
|
+
if (this._fragments.has(fragment)) {
|
|
121
|
+
return this._fragments.get(fragment);
|
|
122
|
+
}
|
|
123
|
+
if (this.parent) {
|
|
124
|
+
return this.parent.resolveFragment(fragment);
|
|
125
|
+
}
|
|
126
|
+
throw new Error(`Fragment ${fragment.name} not found in the scope ${this.name}`);
|
|
127
|
+
}
|
|
128
|
+
register(fragment) {
|
|
129
|
+
this._fragments.set(fragment.constructor, fragment);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.A_Scope = A_Scope;
|
|
133
|
+
//# sourceMappingURL=A-Scope.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Scope.class.js","sourceRoot":"","sources":["../../../../src/global/A-Scope/A-Scope.class.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,gFAA6F;AAC7F,qEAA4D;AAE5D;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IAYhB,YACI,MAA0C,EAC1C,SAAwC,EAAE;QAZ9C,SAAI,GAAW,EAAE,CAAC;QAEV,gBAAW,GAA+C,IAAI,OAAO,EAAE,CAAC;QACxE,eAAU,GAAgD,IAAI,OAAO,EAAE,CAAC;QAW5E,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEjD,yBAAyB;QACzB,MAAM,aAAa,GAA8B;YAC7C,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACb,CAAC;QAGF,IAAI,CAAC,MAAM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;QAED,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,CAAC,IAAI,2BAA2B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACrF,CAAC;IAID,QAAQ,CAAC,QAAoB;QACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACJ;AA7LD,0BA6LC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
2
|
+
import { A_Scope } from "./A-Scope.class";
|
|
3
|
+
export type A_TYPES__ScopeConstructor = {
|
|
4
|
+
/**
|
|
5
|
+
* Scope Name
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* A list of Context Fragments available in the Scope
|
|
10
|
+
*/
|
|
11
|
+
fragments: Array<A_Fragment>;
|
|
12
|
+
/**
|
|
13
|
+
* A set of Components available in the Scope
|
|
14
|
+
*/
|
|
15
|
+
components: Array<{
|
|
16
|
+
new (...args: any[]): any;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* A list of Features/Lifecycle Hooks available in the Scope
|
|
20
|
+
*/
|
|
21
|
+
import: Array<string>;
|
|
22
|
+
/**
|
|
23
|
+
* A list of Features/Lifecycle Hooks available to be exported from the Scope
|
|
24
|
+
*/
|
|
25
|
+
export: Array<string>;
|
|
26
|
+
};
|
|
27
|
+
export type A_TYPES__ScopeConfig = {
|
|
28
|
+
/**
|
|
29
|
+
* Allows to define a parent to take dependencies from in case of the current scope does not have the required component
|
|
30
|
+
*/
|
|
31
|
+
parent: A_Scope;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Scope.types.js","sourceRoot":"","sources":["../../../../src/global/A-Scope/A-Scope.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { A_Component } from "../global/A-Component/A-Component.class";
|
|
2
|
+
export declare const A_COMPONENT_STORAGE__Definition__Extensions: unique symbol;
|
|
3
|
+
export declare const A_COMPONENT_STORAGE__Definition__Feature: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
7
|
+
*/
|
|
8
|
+
export declare const A_COMPONENT_Storage: Map<typeof A_Component | {
|
|
9
|
+
new (...args: any[]): any;
|
|
10
|
+
}, Map<Symbol | string, any>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =================================================================================================
|
|
3
|
+
// ========== Component Storage ====================================================================
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.A_COMPONENT_Storage = exports.A_COMPONENT_STORAGE__Definition__Feature = exports.A_COMPONENT_STORAGE__Definition__Extensions = void 0;
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
// ----- A Concept -> Component Declaration -> Symbol Declaration Keys ---------------
|
|
9
|
+
// -------------------------------------------------------------------------------
|
|
10
|
+
exports.A_COMPONENT_STORAGE__Definition__Extensions = Symbol('a-container-extensions');
|
|
11
|
+
exports.A_COMPONENT_STORAGE__Definition__Feature = Symbol('a-container-feature');
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
15
|
+
*/
|
|
16
|
+
exports.A_COMPONENT_Storage = new Map();
|
|
17
|
+
//# sourceMappingURL=A_Component.storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Component.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Component.storage.ts"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;;;AAKpG,kFAAkF;AAClF,uFAAuF;AACvF,kFAAkF;AACrE,QAAA,2CAA2C,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC/E,QAAA,wCAAwC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAItF;;;GAGG;AACU,QAAA,mBAAmB,GAM5B,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_CONCEPT_Storage = exports.A_CONCEPT_LifecycleDeclarationsStorage = exports.A_CONCEPT_ModulesDeclarationStorage = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = void 0;
|
|
4
2
|
// --------------------------------------------------------------
|
|
5
3
|
// ----- A Concept -> Module Declaration -> Main Config ---------
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.A_CONCEPT_Storage = exports.A_CONCEPT_LifecycleDeclarationsStorage = exports.A_CONCEPT_ModulesDeclarationStorage = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = void 0;
|
|
6
6
|
// --------------------------------------------------------------
|
|
7
7
|
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = Symbol('a-concept-modules-declaration');
|
|
8
8
|
// -------------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A_Concept.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Concept.storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"A_Concept.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Concept.storage.ts"],"names":[],"mappings":";AAEA,iEAAiE;AACjE,iEAAiE;;;AAIjE,iEAAiE;AACpD,QAAA,4CAA4C,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAIpG,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AACrE,QAAA,uDAAuD,GAAG,MAAM,CAAC,kDAAkD,CAAC,CAAC;AACrH,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AACvH,QAAA,yDAAyD,GAAG,MAAM,CAAC,oDAAoD,CAAC,CAAC;AACzH,QAAA,2DAA2D,GAAG,MAAM,CAAC,sDAAsD,CAAC,CAAC;AAC7H,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAKpI;;GAEG;AACU,QAAA,mCAAmC,GAG5C,IAAI,OAAO,EAAE,CAAC;AAIlB;;GAEG;AACU,QAAA,sCAAsC,GAAqB,IAAI,GAAG,EAAE,CAAC;AAMlF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A_Container } from "../global/A-Container/A-Container.class";
|
|
2
|
+
export declare const A_CONTAINER_STORAGE__Definition__Lifecycle: unique symbol;
|
|
3
|
+
export declare const A_CONTAINER_STORAGE__Definition__Feature: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const A_CONTAINER_Storage: WeakMap<typeof A_Container.constructor, Map<Symbol | string, any>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =================================================================================================
|
|
3
|
+
// ========== Container Storage ====================================================================
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.A_CONTAINER_Storage = exports.A_CONTAINER_STORAGE__Definition__Feature = exports.A_CONTAINER_STORAGE__Definition__Lifecycle = void 0;
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
// ----- A Concept -> Container Declaration -> Symbol Declaration Keys ---------------
|
|
9
|
+
// -------------------------------------------------------------------------------
|
|
10
|
+
exports.A_CONTAINER_STORAGE__Definition__Lifecycle = Symbol('a-container-lifecycle');
|
|
11
|
+
exports.A_CONTAINER_STORAGE__Definition__Feature = Symbol('a-container-feature');
|
|
12
|
+
/**
|
|
13
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
exports.A_CONTAINER_Storage = new WeakMap();
|
|
17
|
+
//# sourceMappingURL=A_Container.storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Container.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Container.storage.ts"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;;;AAIpG,kFAAkF;AAClF,uFAAuF;AACvF,kFAAkF;AACrE,QAAA,0CAA0C,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAC7E,QAAA,wCAAwC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAItF;;;GAGG;AACU,QAAA,mBAAmB,GAAuE,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { A_TYPES__A_InjectDecoratorStorageInstruction } from "../decorators/A-Inject/A-Inject.decorator.types";
|
|
2
|
+
export declare const A_STORAGE__A_Inject_MethodArgumentsKey: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare const A_STORAGE__A_Inject_Instructions: WeakMap<{
|
|
8
|
+
new (...args: any[]): any;
|
|
9
|
+
}, Map<Symbol | string, A_TYPES__A_InjectDecoratorStorageInstruction>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =================================================================================================
|
|
3
|
+
// ========== A-Inject Storage ====================================================================
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.A_STORAGE__A_Inject_Instructions = exports.A_STORAGE__A_Inject_MethodArgumentsKey = void 0;
|
|
7
|
+
exports.A_STORAGE__A_Inject_MethodArgumentsKey = Symbol('a-inject-method-arguments');
|
|
8
|
+
/**
|
|
9
|
+
* This storage is used to store the containers metadata, definitions and configurations
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
exports.A_STORAGE__A_Inject_Instructions = new WeakMap();
|
|
13
|
+
//# sourceMappingURL=A_Inject.storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Inject.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Inject.storage.ts"],"names":[],"mappings":";AAGA,oGAAoG;AACpG,mGAAmG;AACnG,oGAAoG;;;AAIvF,QAAA,sCAAsC,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAG1F;;;GAGG;AACU,QAAA,gCAAgC,GAWzC,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
2
|
+
import { ContextFragmentA } from "../context/Fragment_A.context";
|
|
3
|
+
import { ContextFragmentB } from "../context/Fragment_B.context";
|
|
4
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
5
|
+
|
|
6
|
+
export class ComponentA {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@A_Feature.Extend()
|
|
10
|
+
async load() { }
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@A_Feature.Extend()
|
|
15
|
+
async method_A(
|
|
16
|
+
@A_Inject(ContextFragmentA) fragmentA: ContextFragmentA
|
|
17
|
+
) {
|
|
18
|
+
console.log('Component A -> method_A()');
|
|
19
|
+
fragmentA.decrement();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@A_Feature.Extend({
|
|
25
|
+
name: 'method_A'
|
|
26
|
+
})
|
|
27
|
+
async someMethod(
|
|
28
|
+
@A_Inject(ContextFragmentB) fragmentB: ContextFragmentB
|
|
29
|
+
) {
|
|
30
|
+
console.log('Component A -> method_A() -> someMethod()');
|
|
31
|
+
|
|
32
|
+
fragmentB.increment();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
2
|
+
import { ContextFragmentB } from "../context/Fragment_B.context";
|
|
3
|
+
import { ContextFragmentA } from "../context/Fragment_A.context";
|
|
4
|
+
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export class ComponentB {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@A_Feature.Extend()
|
|
11
|
+
async load() {
|
|
12
|
+
console.log('Component B -> load()');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@A_Feature.Extend()
|
|
17
|
+
async method_B() {
|
|
18
|
+
console.log('Component B -> method_B()');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@A_Feature.Extend({
|
|
22
|
+
name: 'method_B'
|
|
23
|
+
})
|
|
24
|
+
async someMethod() {
|
|
25
|
+
console.log('Component B -> method_B() -> someMethod()');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@A_Feature.Extend({
|
|
30
|
+
name: 'method_B'
|
|
31
|
+
})
|
|
32
|
+
async someMethod2() {
|
|
33
|
+
console.log('Component B -> method_B() -> someMethod2()');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@A_Feature.Extend({
|
|
37
|
+
name: 'method_A'
|
|
38
|
+
})
|
|
39
|
+
async someMethod3(
|
|
40
|
+
@A_Inject(ContextFragmentB) context: ContextFragmentB,
|
|
41
|
+
@A_Inject(ContextFragmentA) context2: ContextFragmentA
|
|
42
|
+
) {
|
|
43
|
+
console.log('Component B -> method_A() -> someMethod3()');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -1,16 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
2
|
+
import { MainContainer } from "./containers/Main.container";
|
|
3
|
+
import { ComponentA } from "./components/A.component";
|
|
4
|
+
import { ComponentB } from "./components/B.component";
|
|
5
|
+
import { A_Config } from "@adaas/a-concept/base/A-Config/A-Config.context";
|
|
6
|
+
import { A_Errors } from "@adaas/a-concept/base/A-Errors/A-Errors.context";
|
|
7
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
2
8
|
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
// const simpleConcept = new A_Concept({
|
|
6
|
-
// name: 'simple-concept',
|
|
7
|
-
// modules: [
|
|
8
|
-
|
|
9
|
-
// ],
|
|
10
|
-
// context: [
|
|
11
|
-
// ]
|
|
12
|
-
// });
|
|
10
|
+
(async () => {
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
console.log('Start');
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
class foo extends A_Container<['f', 'f2']> {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const simpleConcept = new A_Concept({
|
|
20
|
+
name: 'simple-concept',
|
|
21
|
+
fragments: [
|
|
22
|
+
new A_Config({
|
|
23
|
+
variables: ['A', 'B', 'C'],
|
|
24
|
+
defaults: {
|
|
25
|
+
A: 1,
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
new A_Errors({
|
|
29
|
+
errors: [
|
|
30
|
+
{
|
|
31
|
+
code: 'some_error',
|
|
32
|
+
description: 'Error 1',
|
|
33
|
+
message: 'Error 1'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
],
|
|
38
|
+
containers: [
|
|
39
|
+
new MainContainer({
|
|
40
|
+
components: [
|
|
41
|
+
ComponentA,
|
|
42
|
+
ComponentB
|
|
43
|
+
]
|
|
44
|
+
}),
|
|
45
|
+
new foo({})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await simpleConcept.run()
|
|
50
|
+
|
|
51
|
+
simpleConcept.call('method_B');
|
|
52
|
+
|
|
53
|
+
})();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
2
|
+
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
3
|
+
import { ContextFragmentA } from "../context/Fragment_A.context";
|
|
4
|
+
import { ContextFragmentB } from "../context/Fragment_B.context";
|
|
5
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class MainContainer extends A_Container<
|
|
10
|
+
['method_A', 'method_B']
|
|
11
|
+
> {
|
|
12
|
+
|
|
13
|
+
@A_Concept.Load()
|
|
14
|
+
async load() {
|
|
15
|
+
console.log('Main container loaded');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@A_Concept.Start()
|
|
19
|
+
async start () {
|
|
20
|
+
console.log('Start');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@A_Feature.Define()
|
|
27
|
+
async method_A() {
|
|
28
|
+
console.log('Method A');
|
|
29
|
+
const feature = this.call('method_A', {
|
|
30
|
+
fragments: [new ContextFragmentA(), new ContextFragmentB()]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await feature.process();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@A_Feature.Define()
|
|
37
|
+
async method_B() {
|
|
38
|
+
console.log('Method B');
|
|
39
|
+
return this.call('method_B');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class ContextFragmentA extends A_Fragment {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
variable: number = 0;
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
decrement(): void {
|
|
19
|
+
this.variable--;
|
|
20
|
+
|
|
21
|
+
console.log('ContextFragmentA -> Variable decremented to: ', this.variable);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class ContextFragmentB extends A_Fragment {
|
|
5
|
+
|
|
6
|
+
variable: number = 0;
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
increment(): void {
|
|
14
|
+
this.variable++;
|
|
15
|
+
|
|
16
|
+
console.log('ContextFragmentB -> Variable incremented to: ', this.variable);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
2
|
+
import { HTTPRequest } from "../contexts/http-request.context";
|
|
3
|
+
import { A_Logger } from "@adaas/a-concept/base/A-Logger/A-Logger.component";
|
|
4
|
+
import { HttpServer } from "../containers/http-server.container";
|
|
5
|
+
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class HTTPErrorHandler {
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
@A_Inject(A_Logger) private logger: A_Logger
|
|
12
|
+
) { }
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@A_Feature.Extend({
|
|
17
|
+
name: 'onRequest',
|
|
18
|
+
container: HttpServer
|
|
19
|
+
})
|
|
20
|
+
async onErrorPage(
|
|
21
|
+
@A_Inject(HTTPRequest) request: HTTPRequest,
|
|
22
|
+
@A_Inject(A_Feature) feature: A_Feature
|
|
23
|
+
) {
|
|
24
|
+
this.logger.log('HTTP Error Handler -> onErrorPage()');
|
|
25
|
+
|
|
26
|
+
await feature.completed();
|
|
27
|
+
|
|
28
|
+
if (request.state !== 'end' && request.request.url === '/error')
|
|
29
|
+
request.end('Error Page');
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@A_Feature.Extend()
|
|
36
|
+
async onRequest(
|
|
37
|
+
@A_Inject(HTTPRequest) request: HTTPRequest
|
|
38
|
+
) {
|
|
39
|
+
this.logger.log('HTTP Error Handler -> onRequest()');
|
|
40
|
+
|
|
41
|
+
if (request.state !== 'end')
|
|
42
|
+
request.end('Error');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
2
|
-
import {
|
|
3
|
-
import { HttpServer } from "./contexts/http-server.namespace";
|
|
2
|
+
import { HttpServer } from "./containers/http-server.container";
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
(async () => {
|
|
7
|
-
const simpleConcept = new A_Concept({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
6
|
+
// const simpleConcept = new A_Concept({
|
|
7
|
+
// // name: 'test-server',
|
|
8
|
+
// // // import: [
|
|
9
|
+
// // // server1,
|
|
10
|
+
// // // server2
|
|
11
|
+
// // // ],
|
|
12
|
+
// // containers: [
|
|
13
|
+
// // new DefaultHttpServer({
|
|
14
|
+
// // components: []
|
|
15
|
+
// // })
|
|
16
|
+
// // ],
|
|
17
|
+
// // context: [
|
|
18
|
+
// // new HttpServer({
|
|
19
|
+
// // port: 3000
|
|
20
|
+
// // }),
|
|
21
|
+
// // new HttpServer({
|
|
22
|
+
// // port: 3001
|
|
23
|
+
// // })
|
|
24
|
+
// // ],
|
|
25
|
+
// })
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
await simpleConcept.run();
|
|
29
|
+
// await simpleConcept.run();
|
|
29
30
|
|
|
30
31
|
})();
|