@adaas/a-concept 0.0.64 → 0.1.2
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/index.d.ts +24 -32
- package/dist/index.js +35 -52
- package/dist/index.js.map +1 -1
- package/dist/src/constants/env.constants.d.ts +15 -8
- package/dist/src/constants/env.constants.js +17 -10
- package/dist/src/constants/env.constants.js.map +1 -1
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +23 -0
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +69 -0
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +1 -0
- package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +47 -20
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js +55 -48
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +1 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +7 -0
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js +12 -0
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +1 -0
- package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +27 -12
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -8
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +1 -1
- package/dist/src/global/A-Caller/A_Caller.class.d.ts +33 -0
- package/dist/src/global/A-Caller/A_Caller.class.js +44 -0
- package/dist/src/global/A-Caller/A_Caller.class.js.map +1 -0
- package/dist/src/global/A-Caller/A_Caller.error.d.ts +7 -0
- package/dist/src/global/A-Caller/A_Caller.error.js +12 -0
- package/dist/src/global/A-Caller/A_Caller.error.js.map +1 -0
- package/dist/src/global/A-Caller/A_Caller.types.d.ts +18 -0
- package/dist/src/{base/A-Errors/A-Errors.types.js → global/A-Caller/A_Caller.types.js} +1 -1
- package/dist/src/global/A-Caller/A_Caller.types.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +20 -3
- package/dist/src/global/A-Component/A-Component.class.js +35 -19
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.constants.d.ts +6 -0
- package/dist/src/global/A-Component/A-Component.constants.js +11 -0
- package/dist/src/global/A-Component/A-Component.constants.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.meta.d.ts +4 -4
- package/dist/src/global/A-Component/A-Component.meta.js +6 -8
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +40 -22
- package/dist/src/global/A-Component/A-Component.types.js +1 -8
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
- package/dist/src/global/A-Concept/A-Concept.class.d.ts +153 -0
- package/dist/src/global/A-Concept/A-Concept.class.js +260 -0
- package/dist/src/global/A-Concept/A-Concept.class.js.map +1 -0
- package/dist/src/global/A-Concept/A-Concept.constants.d.ts +33 -0
- package/dist/src/global/A-Concept/A-Concept.constants.js +39 -0
- package/dist/src/global/A-Concept/A-Concept.constants.js.map +1 -0
- package/dist/src/global/A-Concept/{A_Concept.meta.js → A-Concept.meta.js} +1 -2
- package/dist/src/global/A-Concept/A-Concept.meta.js.map +1 -0
- package/dist/src/global/A-Concept/A-Concept.types.d.ts +83 -0
- package/dist/src/global/{A-Channel/A-Channel.types.js → A-Concept/A-Concept.types.js} +1 -1
- package/dist/src/global/A-Concept/A-Concept.types.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.class.d.ts +31 -35
- package/dist/src/global/A-Container/A-Container.class.js +34 -55
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.constants.d.ts +5 -0
- package/dist/src/global/A-Container/A-Container.constants.js +10 -0
- package/dist/src/global/A-Container/A-Container.constants.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.meta.d.ts +6 -6
- package/dist/src/global/A-Container/A-Container.meta.js +5 -6
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.types.d.ts +31 -25
- package/dist/src/global/A-Container/A-Container.types.js +1 -7
- package/dist/src/global/A-Container/A-Container.types.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +302 -76
- package/dist/src/global/A-Context/A-Context.class.js +436 -244
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.error.d.ts +20 -0
- package/dist/src/global/A-Context/A-Context.error.js +25 -0
- package/dist/src/global/A-Context/A-Context.error.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.types.d.ts +5 -0
- package/dist/src/global/A-Context/A-Context.types.js +1 -0
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +13 -39
- package/dist/src/global/A-Entity/A-Entity.class.js +30 -73
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.constants.d.ts +11 -0
- package/dist/src/global/A-Entity/A-Entity.constants.js +17 -0
- package/dist/src/global/A-Entity/A-Entity.constants.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.error.d.ts +7 -0
- package/dist/src/global/A-Entity/A-Entity.error.js +12 -0
- package/dist/src/global/A-Entity/A-Entity.error.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +2 -2
- package/dist/src/global/A-Entity/A-Entity.meta.js +2 -2
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +24 -29
- package/dist/src/global/A-Entity/A-Entity.types.js +1 -13
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
- package/dist/src/global/A-Error/A_Error.class.d.ts +219 -0
- package/dist/src/global/A-Error/A_Error.class.js +267 -0
- package/dist/src/global/A-Error/A_Error.class.js.map +1 -0
- package/dist/src/global/A-Error/A_Error.constants.d.ts +5 -0
- package/dist/src/global/A-Error/A_Error.constants.js +9 -0
- package/dist/src/global/A-Error/A_Error.constants.js.map +1 -0
- package/dist/src/global/A-Error/A_Error.types.d.ts +89 -0
- package/dist/src/{decorators/A-Inject/A-Inject.decorator.types.js → global/A-Error/A_Error.types.js} +1 -1
- package/dist/src/global/A-Error/A_Error.types.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +15 -0
- package/dist/src/{decorators → global}/A-Feature/A-Feature-Define.decorator.js +21 -27
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +1 -0
- package/dist/src/{decorators → global}/A-Feature/A-Feature-Extend.decorator.d.ts +26 -3
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +97 -0
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +120 -30
- package/dist/src/global/A-Feature/A-Feature.class.js +205 -73
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.error.d.ts +25 -0
- package/dist/src/global/A-Feature/A-Feature.error.js +33 -0
- package/dist/src/global/A-Feature/A-Feature.error.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +241 -18
- package/dist/src/global/A-Feature/A-Feature.types.js +16 -22
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +19 -27
- package/dist/src/global/A-Fragment/A-Fragment.class.js +21 -91
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +19 -1
- package/dist/src/global/A-Fragment/A-Fragment.types.js +3 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +1 -1
- package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +80 -0
- package/dist/src/global/A-Inject/A-Inject.decorator.js +49 -0
- package/dist/src/global/A-Inject/A-Inject.decorator.js.map +1 -0
- package/dist/src/global/A-Inject/A-Inject.error.d.ts +5 -0
- package/dist/src/global/A-Inject/A-Inject.error.js +10 -0
- package/dist/src/global/A-Inject/A-Inject.error.js.map +1 -0
- package/dist/src/global/A-Inject/A-Inject.types.d.ts +42 -0
- package/dist/src/{decorators/A-Entity/A-Entity.decorator.types.js → global/A-Inject/A-Inject.types.js} +1 -1
- package/dist/src/global/A-Inject/A-Inject.types.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +1 -1
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +14 -0
- package/dist/src/global/A-Meta/A-Meta.types.js +1 -0
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +124 -142
- package/dist/src/global/A-Scope/A-Scope.class.js +163 -209
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.error.d.ts +6 -0
- package/dist/src/global/A-Scope/A-Scope.error.js +11 -0
- package/dist/src/global/A-Scope/A-Scope.error.js.map +1 -0
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +48 -13
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +31 -23
- package/dist/src/global/A-Stage/A-Stage.class.js +100 -68
- package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.error.d.ts +2 -1
- package/dist/src/global/A-Stage/A-Stage.error.js +5 -2
- package/dist/src/global/A-Stage/A-Stage.error.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +4 -16
- package/dist/src/global/A-Stage/A-Stage.types.js +0 -16
- package/dist/src/global/A-Stage/A-Stage.types.js.map +1 -1
- package/dist/src/global/ASEID/ASEID.class.d.ts +130 -0
- package/dist/src/global/ASEID/ASEID.class.js +167 -0
- package/dist/src/global/ASEID/ASEID.class.js.map +1 -0
- package/dist/src/global/ASEID/ASEID.constants.js +2 -0
- package/dist/src/global/ASEID/ASEID.constants.js.map +1 -0
- package/dist/src/global/ASEID/ASEID.error.d.ts +5 -0
- package/dist/src/global/ASEID/ASEID.error.js +10 -0
- package/dist/src/global/ASEID/ASEID.error.js.map +1 -0
- package/dist/src/global/ASEID/ASEID.types.d.ts +65 -0
- package/dist/src/global/ASEID/ASEID.types.js +5 -0
- package/dist/src/global/ASEID/ASEID.types.js.map +1 -0
- package/dist/src/helpers/A_Common.helper.d.ts +28 -0
- package/dist/src/helpers/A_Common.helper.js +170 -0
- package/dist/src/helpers/A_Common.helper.js.map +1 -0
- package/dist/src/helpers/A_Formatter.helper.d.ts +35 -0
- package/dist/src/helpers/A_Formatter.helper.js +62 -0
- package/dist/src/helpers/A_Formatter.helper.js.map +1 -0
- package/dist/src/helpers/A_Identity.helper.d.ts +29 -0
- package/dist/src/helpers/A_Identity.helper.js +43 -0
- package/dist/src/helpers/A_Identity.helper.js.map +1 -0
- package/dist/src/helpers/{StepsManager.class.d.ts → A_StepsManager.class.d.ts} +4 -2
- package/dist/src/helpers/{StepsManager.class.js → A_StepsManager.class.js} +10 -5
- package/dist/src/helpers/A_StepsManager.class.js.map +1 -0
- package/dist/src/helpers/A_TypeGuards.helper.d.ts +205 -0
- package/dist/src/helpers/A_TypeGuards.helper.js +288 -0
- package/dist/src/helpers/A_TypeGuards.helper.js.map +1 -0
- package/dist/src/types/A_Common.types.d.ts +36 -0
- package/dist/src/types/A_Common.types.js +3 -0
- package/dist/src/types/A_Common.types.js.map +1 -0
- package/index.ts +27 -51
- package/jest.config.ts +1 -0
- package/package.json +1 -2
- package/src/constants/env.constants.ts +18 -11
- package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +103 -0
- package/src/global/A-Abstraction/A-Abstraction.class.ts +71 -65
- package/src/global/A-Abstraction/A-Abstraction.error.ts +9 -0
- package/src/global/A-Abstraction/A-Abstraction.types.ts +52 -13
- package/src/global/A-Caller/A_Caller.class.ts +61 -0
- package/src/global/A-Caller/A_Caller.error.ts +10 -0
- package/src/global/A-Caller/A_Caller.types.ts +25 -0
- package/src/global/A-Component/A-Component.class.ts +26 -15
- package/src/global/A-Component/A-Component.constants.ts +9 -0
- package/src/global/A-Component/A-Component.meta.ts +6 -16
- package/src/global/A-Component/A-Component.types.ts +53 -28
- package/src/global/A-Concept/A-Concept.class.ts +316 -0
- package/src/global/A-Concept/A-Concept.constants.ts +36 -0
- package/src/global/A-Concept/A-Concept.meta.ts +17 -0
- package/src/global/A-Concept/A-Concept.types.ts +100 -0
- package/src/global/A-Container/A-Container.class.ts +42 -83
- package/src/global/A-Container/A-Container.constants.ts +5 -0
- package/src/global/A-Container/A-Container.meta.ts +7 -11
- package/src/global/A-Container/A-Container.types.ts +38 -34
- package/src/global/A-Context/A-Context.class.ts +648 -412
- package/src/global/A-Context/A-Context.error.ts +44 -0
- package/src/global/A-Context/A-Context.types.ts +14 -0
- package/src/global/A-Entity/A-Entity.class.ts +33 -88
- package/src/global/A-Entity/A-Entity.constants.ts +12 -0
- package/src/global/A-Entity/A-Entity.error.ts +12 -0
- package/src/global/A-Entity/A-Entity.meta.ts +4 -4
- package/src/global/A-Entity/A-Entity.types.ts +31 -36
- package/src/global/A-Error/A_Error.class.ts +408 -0
- package/src/global/A-Error/A_Error.constants.ts +11 -0
- package/src/global/A-Error/A_Error.types.ts +96 -0
- package/src/{decorators → global}/A-Feature/A-Feature-Define.decorator.ts +31 -37
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +187 -0
- package/src/global/A-Feature/A-Feature.class.ts +279 -122
- package/src/global/A-Feature/A-Feature.error.ts +33 -0
- package/src/global/A-Feature/A-Feature.types.ts +278 -40
- package/src/global/A-Fragment/A-Fragment.class.ts +29 -100
- package/src/global/A-Fragment/A-Fragment.types.ts +25 -3
- package/src/global/A-Inject/A-Inject.decorator.ts +167 -0
- package/src/global/A-Inject/A-Inject.error.ts +8 -0
- package/src/global/A-Inject/A-Inject.types.ts +75 -0
- package/src/global/A-Meta/A-Meta.class.ts +1 -1
- package/src/global/A-Meta/A-Meta.types.ts +21 -0
- package/src/global/A-Scope/A-Scope.class.ts +288 -299
- package/src/global/A-Scope/A-Scope.error.ts +13 -0
- package/src/global/A-Scope/A-Scope.types.ts +61 -27
- package/src/global/A-Stage/A-Stage.class.ts +142 -80
- package/src/global/A-Stage/A-Stage.error.ts +4 -2
- package/src/global/A-Stage/A-Stage.types.ts +4 -25
- package/src/global/ASEID/ASEID.class.ts +275 -0
- package/src/global/ASEID/ASEID.error.ts +12 -0
- package/src/global/ASEID/ASEID.types.ts +79 -0
- package/src/helpers/A_Common.helper.ts +204 -0
- package/src/helpers/A_Formatter.helper.ts +58 -0
- package/src/helpers/A_Identity.helper.ts +53 -0
- package/src/helpers/{StepsManager.class.ts → A_StepsManager.class.ts} +19 -3
- package/src/helpers/A_TypeGuards.helper.ts +318 -0
- package/src/types/A_Common.types.ts +79 -0
- package/tests/A-Common.test.ts +117 -0
- package/tests/A-Component.test.ts +11 -6
- package/tests/A-Concept.test.ts +19 -22
- package/tests/A-Entity.test.ts +24 -24
- package/tests/A-Error.test.ts +129 -0
- package/tests/A-Feature.test.ts +34 -25
- package/tests/A-Scope.test.ts +50 -22
- package/tests/ASEID.test.ts +74 -0
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +3 -2
- package/dist/src/base/A-Config/A-Config.container.d.ts +0 -9
- package/dist/src/base/A-Config/A-Config.container.js +0 -69
- package/dist/src/base/A-Config/A-Config.container.js.map +0 -1
- package/dist/src/base/A-Config/A-Config.context.d.ts +0 -30
- package/dist/src/base/A-Config/A-Config.context.js +0 -60
- package/dist/src/base/A-Config/A-Config.context.js.map +0 -1
- package/dist/src/base/A-Config/A-Config.types.d.ts +0 -20
- package/dist/src/base/A-Config/A-Config.types.js +0 -7
- package/dist/src/base/A-Config/A-Config.types.js.map +0 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +0 -29
- package/dist/src/base/A-Config/components/ConfigReader.component.js +0 -84
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +0 -1
- package/dist/src/base/A-Config/components/ENVConfigReader.component.d.ts +0 -10
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js +0 -37
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +0 -1
- package/dist/src/base/A-Config/components/FileConfigReader.component.d.ts +0 -11
- package/dist/src/base/A-Config/components/FileConfigReader.component.js +0 -48
- package/dist/src/base/A-Config/components/FileConfigReader.component.js.map +0 -1
- package/dist/src/base/A-Errors/A-Error.entity.d.ts +0 -3
- package/dist/src/base/A-Errors/A-Error.entity.js +0 -8
- package/dist/src/base/A-Errors/A-Error.entity.js.map +0 -1
- package/dist/src/base/A-Errors/A-Errors.component.d.ts +0 -19
- package/dist/src/base/A-Errors/A-Errors.component.js +0 -87
- package/dist/src/base/A-Errors/A-Errors.component.js.map +0 -1
- package/dist/src/base/A-Errors/A-Errors.context.d.ts +0 -27
- package/dist/src/base/A-Errors/A-Errors.context.js +0 -50
- package/dist/src/base/A-Errors/A-Errors.context.js.map +0 -1
- package/dist/src/base/A-Errors/A-Errors.types.d.ts +0 -5
- package/dist/src/base/A-Errors/A-Errors.types.js.map +0 -1
- package/dist/src/base/A-Logger/A-Logger.component.d.ts +0 -31
- package/dist/src/base/A-Logger/A-Logger.component.js +0 -155
- package/dist/src/base/A-Logger/A-Logger.component.js.map +0 -1
- package/dist/src/base/A-Logger/A-Logger.types.js +0 -2
- package/dist/src/base/A-Logger/A-Logger.types.js.map +0 -1
- package/dist/src/base/A-Polyfill/A-Polyfill.component.d.ts +0 -5
- package/dist/src/base/A-Polyfill/A-Polyfill.component.js +0 -34
- package/dist/src/base/A-Polyfill/A-Polyfill.component.js.map +0 -1
- package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -14
- package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -53
- package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.d.ts +0 -2
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js +0 -3
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js.map +0 -1
- package/dist/src/decorators/A-Connect/A-Connect.decorator.d.ts +0 -19
- package/dist/src/decorators/A-Connect/A-Connect.decorator.js +0 -31
- package/dist/src/decorators/A-Connect/A-Connect.decorator.js.map +0 -1
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.d.ts +0 -1
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js +0 -3
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js.map +0 -1
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.d.ts +0 -1
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js +0 -8
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js.map +0 -1
- package/dist/src/decorators/A-Entity/A-Entity.decorator.types.d.ts +0 -14
- package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js.map +0 -1
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +0 -19
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +0 -1
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +0 -81
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +0 -96
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +0 -3
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js.map +0 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +0 -30
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +0 -47
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +0 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +0 -48
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js.map +0 -1
- package/dist/src/global/A-Channel/A-Channel.class.d.ts +0 -16
- package/dist/src/global/A-Channel/A-Channel.class.js +0 -59
- package/dist/src/global/A-Channel/A-Channel.class.js.map +0 -1
- package/dist/src/global/A-Channel/A-Channel.types.d.ts +0 -68
- package/dist/src/global/A-Channel/A-Channel.types.js.map +0 -1
- package/dist/src/global/A-Command/A-Command.class.d.ts +0 -187
- package/dist/src/global/A-Command/A-Command.class.js +0 -349
- package/dist/src/global/A-Command/A-Command.class.js.map +0 -1
- package/dist/src/global/A-Command/A-Command.constants.d.ts +0 -17
- package/dist/src/global/A-Command/A-Command.constants.js +0 -22
- package/dist/src/global/A-Command/A-Command.constants.js.map +0 -1
- package/dist/src/global/A-Command/A-Command.meta.d.ts +0 -11
- package/dist/src/global/A-Command/A-Command.meta.js +0 -18
- package/dist/src/global/A-Command/A-Command.meta.js.map +0 -1
- package/dist/src/global/A-Command/A-Command.types.d.ts +0 -43
- package/dist/src/global/A-Command/A-Command.types.js +0 -10
- package/dist/src/global/A-Command/A-Command.types.js.map +0 -1
- package/dist/src/global/A-Command/context/A_Command.context.d.ts +0 -64
- package/dist/src/global/A-Command/context/A_Command.context.js +0 -85
- package/dist/src/global/A-Command/context/A_Command.context.js.map +0 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +0 -104
- package/dist/src/global/A-Concept/A_Concept.class.js +0 -217
- package/dist/src/global/A-Concept/A_Concept.class.js.map +0 -1
- package/dist/src/global/A-Concept/A_Concept.meta.js.map +0 -1
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +0 -103
- package/dist/src/global/A-Concept/A_Concept.types.js +0 -28
- package/dist/src/global/A-Concept/A_Concept.types.js.map +0 -1
- package/dist/src/global/A-Feature/A-FeatureCaller.class.d.ts +0 -22
- package/dist/src/global/A-Feature/A-FeatureCaller.class.js +0 -26
- package/dist/src/global/A-Feature/A-FeatureCaller.class.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.constants.d.ts +0 -2
- package/dist/src/global/A-Scope/A-Scope.constants.js +0 -11
- package/dist/src/global/A-Scope/A-Scope.constants.js.map +0 -1
- package/dist/src/helpers/StepsManager.class.js.map +0 -1
- package/dist/src/types/A_Module.types.d.ts +0 -17
- package/dist/src/types/A_Module.types.js +0 -22
- package/dist/src/types/A_Module.types.js.map +0 -1
- package/examples/entity/concept.ts +0 -68
- package/examples/entity/entities/Task.entity.ts +0 -110
- package/examples/entity/entities/User.entity.ts +0 -62
- package/examples/fe-be/channels/Test.channel.ts +0 -27
- package/examples/fe-be/components/BE-Controller.component.ts +0 -20
- package/examples/fe-be/components/FE.component.ts +0 -13
- package/examples/fe-be/containers/ServerApp.container.ts +0 -8
- package/examples/fe-be/containers/WebApp.container.ts +0 -13
- package/examples/multi-container/channels/Direct.channel.ts +0 -39
- package/examples/multi-container/concept.ts +0 -0
- package/examples/multi-container/containers/Command.container.ts +0 -41
- package/examples/multi-container/containers/Schedule.container.ts +0 -52
- package/examples/simple/components/A.component.ts +0 -71
- package/examples/simple/components/B.component.ts +0 -68
- package/examples/simple/concept.ts +0 -87
- package/examples/simple/containers/Main.container.ts +0 -88
- package/examples/simple/containers/Secondary.container.ts +0 -26
- package/examples/simple/context/Fragment_A.context.ts +0 -25
- package/examples/simple/context/Fragment_B.context.ts +0 -19
- package/examples/simple/entities/EntityA.entity.ts +0 -32
- package/examples/simple-http-server/components/http-error-handler.component.ts +0 -47
- package/examples/simple-http-server/components/http-request-handler.component.ts +0 -13
- package/examples/simple-http-server/concept.ts +0 -35
- package/examples/simple-http-server/containers/http-server.container.ts +0 -57
- package/examples/simple-http-server/contexts/http-request.context.ts +0 -59
- package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -0
- package/examples/simple-http-server/controllers/orders.controller.ts +0 -20
- package/examples/simple-http-server/controllers/users.controller.ts +0 -104
- package/examples/simple-http-server/test.ts +0 -290
- package/src/base/A-Config/A-Config.container.ts +0 -68
- package/src/base/A-Config/A-Config.context.ts +0 -114
- package/src/base/A-Config/A-Config.types.ts +0 -28
- package/src/base/A-Config/components/ConfigReader.component.ts +0 -68
- package/src/base/A-Config/components/ENVConfigReader.component.ts +0 -31
- package/src/base/A-Config/components/FileConfigReader.component.ts +0 -41
- package/src/base/A-Errors/A-Error.entity.ts +0 -10
- package/src/base/A-Errors/A-Errors.component.ts +0 -103
- package/src/base/A-Errors/A-Errors.context.ts +0 -90
- package/src/base/A-Errors/A-Errors.types.ts +0 -6
- package/src/base/A-Logger/A-Logger.component.ts +0 -192
- package/src/base/A-Logger/A-Logger.types.ts +0 -0
- package/src/base/A-Polyfill/A-Polyfill.component.ts +0 -18
- package/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.ts +0 -81
- package/src/decorators/A-Abstraction/A-Abstraction.decorator.types.ts +0 -21
- package/src/decorators/A-Connect/A-Connect.decorator.ts +0 -71
- package/src/decorators/A-Connect/A-Connect.decorator.types.ts +0 -6
- package/src/decorators/A-Entity/A-Entity-List.decorator.ts +0 -12
- package/src/decorators/A-Entity/A-Entity.decorator.types.ts +0 -18
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +0 -151
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -142
- package/src/decorators/A-Inject/A-Inject.decorator.ts +0 -119
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +0 -85
- package/src/global/A-Channel/A-Channel.class.ts +0 -111
- package/src/global/A-Channel/A-Channel.types.ts +0 -114
- package/src/global/A-Command/A-Command.class.ts +0 -419
- package/src/global/A-Command/A-Command.constants.ts +0 -27
- package/src/global/A-Command/A-Command.meta.ts +0 -22
- package/src/global/A-Command/A-Command.types.ts +0 -73
- package/src/global/A-Command/context/A_Command.context.ts +0 -114
- package/src/global/A-Concept/A_Concept.class.ts +0 -298
- package/src/global/A-Concept/A_Concept.meta.ts +0 -32
- package/src/global/A-Concept/A_Concept.types.ts +0 -143
- package/src/global/A-Feature/A-FeatureCaller.class.ts +0 -38
- package/src/global/A-Scope/A-Scope.constants.ts +0 -9
- package/src/types/A_Module.types.ts +0 -23
- package/tests/A-Command.test.ts +0 -133
- package/tests/A-Config.test.ts +0 -172
- /package/dist/src/global/A-Concept/{A_Concept.meta.d.ts → A-Concept.meta.d.ts} +0 -0
- /package/dist/src/{base/A-Logger/A-Logger.types.d.ts → global/ASEID/ASEID.constants.d.ts} +0 -0
- /package/{examples/fe-be/concept.ts → src/global/ASEID/ASEID.constants.ts} +0 -0
|
@@ -1,387 +1,579 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_Context = void 0;
|
|
4
|
-
const a_utils_1 = require("@adaas/a-utils");
|
|
5
4
|
const A_Component_class_1 = require("../A-Component/A-Component.class");
|
|
6
|
-
const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
|
|
7
|
-
const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
8
5
|
const A_Container_class_1 = require("../A-Container/A-Container.class");
|
|
9
6
|
const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
|
|
10
7
|
const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
|
|
11
8
|
const A_Component_meta_1 = require("../A-Component/A-Component.meta");
|
|
12
9
|
const A_Container_meta_1 = require("../A-Container/A-Container.meta");
|
|
13
|
-
const A_Entity_types_1 = require("../A-Entity/A-Entity.types");
|
|
14
10
|
const A_Entity_class_1 = require("../A-Entity/A-Entity.class");
|
|
15
11
|
const A_Entity_meta_1 = require("../A-Entity/A-Entity.meta");
|
|
16
|
-
const A_Container_types_1 = require("../A-Container/A-Container.types");
|
|
17
|
-
const A_Component_types_1 = require("../A-Component/A-Component.types");
|
|
18
12
|
const env_constants_1 = require("../../constants/env.constants");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Namespace provider is a singleton class that is used to store all the Namespaces in the program.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
13
|
+
const A_Entity_constants_1 = require("../A-Entity/A-Entity.constants");
|
|
14
|
+
const A_Container_constants_1 = require("../A-Container/A-Container.constants");
|
|
15
|
+
const A_Component_constants_1 = require("../A-Component/A-Component.constants");
|
|
16
|
+
const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
|
|
17
|
+
const A_Context_error_1 = require("./A-Context.error");
|
|
18
|
+
const A_Formatter_helper_1 = require("../../helpers/A_Formatter.helper");
|
|
28
19
|
class A_Context {
|
|
20
|
+
// ====================================================================================================
|
|
21
|
+
// ================================ STATIC PROPERTIES =================================================
|
|
22
|
+
// ====================================================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Default name of the application from environment variable A_CONCEPT_NAME
|
|
25
|
+
*
|
|
26
|
+
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
27
|
+
*/
|
|
28
|
+
static get concept() {
|
|
29
|
+
return process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_NAME] || 'a-concept';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Root scope of the application from environment variable A_CONCEPT_ROOT_SCOPE
|
|
33
|
+
*
|
|
34
|
+
* [!] If environment variable is not set, it will default to 'root'
|
|
35
|
+
*/
|
|
36
|
+
static get root() {
|
|
37
|
+
return this.getInstance()._root;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Environment the application is running in.
|
|
41
|
+
* Can be either 'server' or 'browser'.
|
|
42
|
+
* [!] Determined by checking if 'window' object is available.
|
|
43
|
+
*/
|
|
44
|
+
static get environment() {
|
|
45
|
+
let testEnvironment = 'browser';
|
|
46
|
+
try {
|
|
47
|
+
testEnvironment = window.location ? 'browser' : 'server';
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
testEnvironment = 'server';
|
|
51
|
+
}
|
|
52
|
+
return testEnvironment;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Private constructor to enforce singleton pattern.
|
|
56
|
+
*
|
|
57
|
+
* [!] This class should not be instantiated directly. Use A_Context.getInstance() instead.
|
|
58
|
+
*/
|
|
29
59
|
constructor() {
|
|
30
60
|
/**
|
|
31
|
-
* A
|
|
61
|
+
* A registry that keeps track of scopes for all components (Containers, Features, Commands)
|
|
62
|
+
* Which can issue a scope allocation.
|
|
32
63
|
*/
|
|
33
|
-
this.
|
|
64
|
+
this._registry = new WeakMap();
|
|
34
65
|
/**
|
|
35
|
-
*
|
|
66
|
+
* This is a registry that stores an issuer of each scope allocation.
|
|
67
|
+
* It helps to track which component (Container, Feature, Command) allocated a specific scope.
|
|
36
68
|
*/
|
|
37
|
-
this.
|
|
38
|
-
this.commands = new WeakMap();
|
|
69
|
+
this._scopeIssuers = new WeakMap();
|
|
39
70
|
/**
|
|
40
|
-
*
|
|
71
|
+
* Stores a context associated with a specific component that depends on a scope.
|
|
72
|
+
* uses for quick retrieval of the scope for the component.
|
|
41
73
|
*/
|
|
42
|
-
this.
|
|
74
|
+
this._scopeStorage = new WeakMap();
|
|
43
75
|
/**
|
|
44
|
-
*
|
|
76
|
+
* Stores meta information for different component types by their constructors.
|
|
77
|
+
* Meta provides to store extra information about the class behavior and configuration.
|
|
45
78
|
*/
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
79
|
+
this._metaStorage = new Map();
|
|
80
|
+
let name = 'root';
|
|
81
|
+
if (A_Context.environment === 'server')
|
|
82
|
+
name = process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_SCOPE] || 'root';
|
|
83
|
+
if (A_Context.environment === 'browser')
|
|
84
|
+
name = window[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_SCOPE] || 'root';
|
|
85
|
+
this._root = new A_Scope_class_1.A_Scope({ name });
|
|
54
86
|
}
|
|
55
|
-
// ===================================================================================================
|
|
56
|
-
// ================================ META OPERATIONS ==================================================
|
|
57
|
-
// ===================================================================================================
|
|
58
87
|
/**
|
|
59
88
|
* Get the instance of the Namespace Provider.
|
|
60
89
|
*
|
|
90
|
+
* If the instance does not exist, it will be created.
|
|
91
|
+
*
|
|
61
92
|
* @returns
|
|
62
93
|
*/
|
|
63
94
|
static getInstance() {
|
|
64
|
-
if (!A_Context.
|
|
65
|
-
A_Context.
|
|
95
|
+
if (!A_Context._instance) {
|
|
96
|
+
A_Context._instance = new A_Context();
|
|
66
97
|
}
|
|
67
|
-
return A_Context.
|
|
98
|
+
return A_Context._instance;
|
|
68
99
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Register method allows to register a component with a specific scope in the context.
|
|
102
|
+
*
|
|
103
|
+
* @param component - Component to register with a specific scope. Can be either A_Container, A_Feature.
|
|
104
|
+
* @param scope - Scope to associate the component with.
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
static register(
|
|
108
|
+
/**
|
|
109
|
+
* Provide the scope that will be associated with the component.
|
|
110
|
+
*/
|
|
111
|
+
scope,
|
|
112
|
+
/**
|
|
113
|
+
* Provide a component that needs to be registered with a specific scope.
|
|
114
|
+
*/
|
|
115
|
+
component) {
|
|
116
|
+
var _a;
|
|
117
|
+
// uses only for error messages
|
|
118
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
119
|
+
const instance = this.getInstance();
|
|
120
|
+
if (!component)
|
|
121
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidRegisterParameterError, `Unable to register component. Component cannot be null or undefined.`);
|
|
122
|
+
if (!scope)
|
|
123
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidRegisterParameterError, `Unable to register component. Scope cannot be null or undefined.`);
|
|
124
|
+
if (!this.isAllowedToBeRegistered(component))
|
|
125
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.NotAllowedForScopeAllocationError, `Component ${componentName} is not allowed for scope allocation.`);
|
|
126
|
+
instance._scopeStorage.set(component, scope);
|
|
127
|
+
return scope;
|
|
74
128
|
}
|
|
75
|
-
static allocate(
|
|
129
|
+
static allocate(component, importing) {
|
|
130
|
+
var _a;
|
|
131
|
+
// uses only for error messages
|
|
132
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
133
|
+
// ---------------------------------------------------------------------
|
|
134
|
+
// ----------------------Input Validation-------------------------------
|
|
135
|
+
// ---------------------------------------------------------------------
|
|
136
|
+
// 1) check if component is valid
|
|
137
|
+
if (!this.isAllowedForScopeAllocation(component))
|
|
138
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.NotAllowedForScopeAllocationError, `Component of type ${componentName} is not allowed for scope allocation. Only A_Container, A_Feature are allowed.`);
|
|
76
139
|
const instance = this.getInstance();
|
|
77
|
-
|
|
78
|
-
if (
|
|
140
|
+
// 2) check if component already has a scope allocated
|
|
141
|
+
if (instance._registry.has(component))
|
|
142
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.ComponentAlreadyHasScopeAllocatedError, `Component ${componentName} already has a scope allocated.`);
|
|
143
|
+
// 3) Create a new scope for the component
|
|
144
|
+
const newScope = A_TypeGuards_helper_1.A_TypeGuards.isScopeInstance(importing)
|
|
145
|
+
? importing
|
|
146
|
+
: new A_Scope_class_1.A_Scope(importing || {
|
|
147
|
+
name: componentName + '-scope'
|
|
148
|
+
}, importing);
|
|
149
|
+
// 4) Make sure that the new scope inherits from the root scope
|
|
150
|
+
if (!newScope.isInheritedFrom(A_Context.root))
|
|
79
151
|
newScope.inherit(A_Context.root);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
case param1 instanceof A_Feature_class_1.A_Feature:
|
|
86
|
-
instance.features.set(param1, newScope);
|
|
87
|
-
break;
|
|
88
|
-
case param1 instanceof A_Command_class_1.A_Command:
|
|
89
|
-
instance.commands.set(param1, newScope);
|
|
90
|
-
break;
|
|
91
|
-
default:
|
|
92
|
-
throw new Error(`[!] A-Concept Context: Unknown type of the parameter.`);
|
|
93
|
-
}
|
|
152
|
+
// 5) Register the component in the appropriate storage
|
|
153
|
+
instance._registry.set(component, newScope);
|
|
154
|
+
// Also register the issuer of the scope for faster tracking
|
|
155
|
+
instance._scopeIssuers.set(newScope, component);
|
|
156
|
+
// 6) Return the newly created scope
|
|
94
157
|
return newScope;
|
|
95
158
|
}
|
|
96
159
|
static meta(param1) {
|
|
160
|
+
var _a;
|
|
161
|
+
// Get the component name for error messages
|
|
162
|
+
const componentName = ((_a = param1 === null || param1 === void 0 ? void 0 : param1.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(param1);
|
|
163
|
+
// Get the instance of the context
|
|
97
164
|
const instance = this.getInstance();
|
|
98
|
-
|
|
165
|
+
if (!param1)
|
|
166
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidMetaParameterError, `Invalid parameter provided to get meta. Parameter cannot be null or undefined.`);
|
|
167
|
+
// Check if the parameter is allowed for meta storage
|
|
168
|
+
if (!(this.isAllowedForMeta(param1)
|
|
169
|
+
|| this.isAllowedForMetaConstructor(param1)
|
|
170
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isString(param1)
|
|
171
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isFunction(param1)))
|
|
172
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidMetaParameterError, `Invalid parameter provided to get meta. Component of type ${componentName} is not allowed for meta storage. Only A_Container, A_Component and A_Entity are allowed.`);
|
|
99
173
|
let property;
|
|
100
174
|
let metaType;
|
|
101
175
|
switch (true) {
|
|
102
176
|
// 1) If param1 is instance of A_Container
|
|
103
|
-
case param1
|
|
104
|
-
metaStorage = instance.containersMeta;
|
|
177
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isContainerInstance(param1): {
|
|
105
178
|
property = param1.constructor;
|
|
106
179
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
107
180
|
break;
|
|
108
181
|
}
|
|
109
182
|
// 2) If param1 is class of A_Container
|
|
110
|
-
case
|
|
111
|
-
metaStorage = instance.containersMeta;
|
|
183
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isContainerConstructor(param1): {
|
|
112
184
|
property = param1;
|
|
113
185
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
114
186
|
break;
|
|
115
187
|
}
|
|
116
188
|
// 3) If param1 is instance of A_Component
|
|
117
|
-
case param1
|
|
118
|
-
metaStorage = instance.componentsMeta;
|
|
189
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isComponentInstance(param1): {
|
|
119
190
|
property = param1.constructor;
|
|
120
191
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
121
192
|
break;
|
|
122
193
|
}
|
|
123
194
|
// 4) If param1 is class of A_Component
|
|
124
|
-
case
|
|
125
|
-
metaStorage = instance.componentsMeta;
|
|
195
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(param1): {
|
|
126
196
|
property = param1;
|
|
127
197
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
128
198
|
break;
|
|
129
199
|
}
|
|
130
200
|
// 5) If param1 is instance of A_Entity
|
|
131
|
-
case param1
|
|
132
|
-
metaStorage = instance.entitiesMeta;
|
|
201
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isEntityInstance(param1): {
|
|
133
202
|
property = param1.constructor;
|
|
134
203
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
135
204
|
break;
|
|
136
205
|
}
|
|
137
206
|
// 6) If param1 is class of A_Entity
|
|
138
|
-
case
|
|
139
|
-
metaStorage = instance.entitiesMeta;
|
|
207
|
+
case A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(param1): {
|
|
140
208
|
property = param1;
|
|
141
209
|
metaType = A_Entity_meta_1.A_EntityMeta;
|
|
142
210
|
break;
|
|
143
211
|
}
|
|
144
212
|
// 7) If param1 is string then we need to find the component by its name
|
|
145
213
|
case typeof param1 === 'string': {
|
|
146
|
-
|
|
147
|
-
|
|
214
|
+
const found = Array.from(instance._metaStorage)
|
|
215
|
+
.find(([c]) => c.name === param1
|
|
216
|
+
|| c.name === A_Formatter_helper_1.A_FormatterHelper.toKebabCase(param1)
|
|
217
|
+
|| c.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(param1));
|
|
148
218
|
if (!(found && found.length))
|
|
149
|
-
throw new
|
|
219
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidMetaParameterError, `Invalid parameter provided to get meta. Component with name ${param1} not found in the meta storage.`);
|
|
150
220
|
property = found[0];
|
|
151
221
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
152
222
|
break;
|
|
153
223
|
}
|
|
154
224
|
// 8) If param1 is any other class or function
|
|
155
225
|
default: {
|
|
156
|
-
|
|
157
|
-
property = typeof param1 === 'function' ? param1 : param1.constructor;
|
|
226
|
+
property = param1;
|
|
158
227
|
metaType = A_Meta_class_1.A_Meta;
|
|
159
228
|
break;
|
|
160
229
|
}
|
|
161
230
|
}
|
|
162
|
-
if
|
|
163
|
-
|
|
164
|
-
|
|
231
|
+
// Check if the meta already exists for the property, if not create a new one
|
|
232
|
+
if (!instance._metaStorage.has(property)) {
|
|
233
|
+
const inheritMeta = instance._metaStorage.get(Object.getPrototypeOf(property)) || new metaType();
|
|
234
|
+
instance._metaStorage.set(property, new metaType().from(inheritMeta));
|
|
165
235
|
}
|
|
166
|
-
|
|
236
|
+
// Return the meta for the property
|
|
237
|
+
return instance._metaStorage.get(property);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
*
|
|
241
|
+
* This method allows to get the issuer of a specific scope.
|
|
242
|
+
*
|
|
243
|
+
* @param scope - Scope to get the issuer for.
|
|
244
|
+
* @returns - Component that issued the scope.
|
|
245
|
+
*/
|
|
246
|
+
static issuer(
|
|
247
|
+
/**
|
|
248
|
+
* Provide the scope to get its issuer.
|
|
249
|
+
*/
|
|
250
|
+
scope) {
|
|
251
|
+
const instance = this.getInstance();
|
|
252
|
+
if (!scope)
|
|
253
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidComponentParameterError, `Invalid parameter provided to get scope issuer. Parameter cannot be null or undefined.`);
|
|
254
|
+
if (!instance._scopeIssuers.has(scope))
|
|
255
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.ScopeNotFoundError, `Invalid parameter provided to get scope issuer. Provided scope does not have an issuer registered.`);
|
|
256
|
+
return instance._scopeIssuers.get(scope);
|
|
167
257
|
}
|
|
168
258
|
static scope(param1) {
|
|
259
|
+
var _a;
|
|
260
|
+
// for error messages
|
|
261
|
+
const name = ((_a = param1 === null || param1 === void 0 ? void 0 : param1.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(param1);
|
|
262
|
+
// Get the instance of the context
|
|
169
263
|
const instance = this.getInstance();
|
|
264
|
+
// Input validation
|
|
265
|
+
if (!param1)
|
|
266
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidScopeParameterError, `Invalid parameter provided to get scope. Parameter cannot be null or undefined.`);
|
|
267
|
+
// Check if the parameter is allowed for scope allocation
|
|
268
|
+
if (!this.isAllowedForScopeAllocation(param1)
|
|
269
|
+
&& !this.isAllowedToBeRegistered(param1))
|
|
270
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidScopeParameterError, `Invalid parameter provided to get scope. Component of type ${name} is not allowed for scope allocation.`);
|
|
170
271
|
switch (true) {
|
|
171
|
-
case param1
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return instance.
|
|
177
|
-
case param1
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return instance.
|
|
272
|
+
case this.isAllowedForScopeAllocation(param1):
|
|
273
|
+
// Check if the parameter has a scope allocated
|
|
274
|
+
if (!instance._registry.has(param1))
|
|
275
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.ScopeNotFoundError, `Invalid parameter provided to get scope. Component of type ${name} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`);
|
|
276
|
+
// If the parameter is allowed for scope allocation, return the scope
|
|
277
|
+
return instance._registry.get(param1);
|
|
278
|
+
case this.isAllowedToBeRegistered(param1):
|
|
279
|
+
// Check if the parameter has a scope registered
|
|
280
|
+
if (!instance._scopeStorage.has(param1))
|
|
281
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.ScopeNotFoundError, `Invalid parameter provided to get scope. Component of type ${name} does not have a scope registered. Make sure to register the component using A_Context.register() method before trying to get the scope.`);
|
|
282
|
+
// If the parameter is allowed to be registered, return the scope from the storage
|
|
283
|
+
return instance._scopeStorage.get(param1);
|
|
183
284
|
default:
|
|
184
|
-
throw new
|
|
285
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidScopeParameterError, `Invalid parameter provided to get scope. Component of type ${name} is not allowed to be registered.`);
|
|
185
286
|
}
|
|
186
287
|
}
|
|
288
|
+
// ==========================================================================================================
|
|
289
|
+
// ================================== FEATURE MANAGEMENT ====================================================
|
|
290
|
+
// ==========================================================================================================
|
|
291
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
292
|
+
// -----------------------------------Primary Methods -------------------------------------------------------
|
|
293
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
187
294
|
/**
|
|
188
|
-
*
|
|
295
|
+
* Returns a template of the feature that can be then used to create a new A-Feature Instance
|
|
189
296
|
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
297
|
+
* [!] Note: Steps/Stages included are fully dependent on the scope provided since it dictates which components are active and can provide extensions for the feature.
|
|
298
|
+
*
|
|
299
|
+
* @param name
|
|
192
300
|
*/
|
|
193
|
-
static
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
301
|
+
static featureTemplate(
|
|
302
|
+
/**
|
|
303
|
+
* Provide the name of the feature to get the template for. Regular expressions are also supported to match multiple features.
|
|
304
|
+
*/
|
|
305
|
+
name,
|
|
306
|
+
/**
|
|
307
|
+
* Provide the component to get the feature template from.
|
|
308
|
+
*/
|
|
309
|
+
component,
|
|
310
|
+
/**
|
|
311
|
+
* Provide the scope that dictates which components are active and can provide extensions for the feature.
|
|
312
|
+
*/
|
|
313
|
+
scope) {
|
|
314
|
+
var _a;
|
|
315
|
+
// name for error messages
|
|
316
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
317
|
+
// Input validation
|
|
318
|
+
if (!component)
|
|
319
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
|
|
320
|
+
if (!name)
|
|
321
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Feature name cannot be null or undefined.`);
|
|
322
|
+
// Check if the parameter is allowed for feature definition
|
|
323
|
+
if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForFeatureDefinition(component))
|
|
324
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
|
|
325
|
+
const steps = [
|
|
326
|
+
// 1) Get the base feature definition from the component
|
|
327
|
+
...this.featureDefinition(name, component),
|
|
328
|
+
// 2) Get all extensions for the feature from other components in the scope
|
|
329
|
+
...this.featureExtensions(name, component, scope)
|
|
330
|
+
];
|
|
331
|
+
return steps;
|
|
205
332
|
}
|
|
333
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
334
|
+
// -----------------------------------Helper Methods --------------------------------------------------------
|
|
335
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
206
336
|
/**
|
|
207
|
-
*
|
|
337
|
+
* Returns all extensions for the specific feature in the specific component within the provided scope.
|
|
338
|
+
* Scope dictates which components are active and can provide extensions for the feature.
|
|
339
|
+
*
|
|
340
|
+
* [!] This method only returns extensions, not the base feature definition.
|
|
208
341
|
*
|
|
209
342
|
* @param scope
|
|
210
343
|
* @returns
|
|
211
344
|
*/
|
|
212
|
-
static
|
|
213
|
-
|
|
345
|
+
static featureExtensions(
|
|
346
|
+
/**
|
|
347
|
+
* Provide the name of the feature to get the template for. Regular expressions are also supported to match multiple features.
|
|
348
|
+
*/
|
|
349
|
+
name,
|
|
350
|
+
/**
|
|
351
|
+
* Provide the component to get the feature template from.
|
|
352
|
+
*/
|
|
353
|
+
component,
|
|
354
|
+
/**
|
|
355
|
+
* Provide the scope that dictates which components are active and can provide extensions for the feature.
|
|
356
|
+
*/
|
|
357
|
+
scope) {
|
|
358
|
+
var _a;
|
|
214
359
|
const instance = this.getInstance();
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
*
|
|
228
|
-
* ------------------------------Execution-----------------------------------------------------------
|
|
229
|
-
* ContainerA -> FeatureA -> ComponentA -> FeatureB -> ComponentB
|
|
230
|
-
* - Scope:ScopeA -> - Scope: FeatA -> - Scope: ScopeA -> - Scope: FeatB -> - Scope: ScopeA
|
|
231
|
-
* - Parent: ScopeA -> - Parent: ROOT -> - Parent: FeatA -> - Parent: ROOT
|
|
232
|
-
* --------------------------------------------------------------------------------------------------
|
|
233
|
-
*
|
|
234
|
-
* So ComponentA and ComponentB are registered in the SAME scope of ContainerA.
|
|
235
|
-
* But Each Feature has its own Scope and Parent Scope.
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* Component AND Entity DO [!] NOT HAVE THEIR OWN SCOPE.
|
|
239
|
-
*
|
|
240
|
-
* Feature AND Container HAVE OWN SCOPE.
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* So Parent can come from the Container or from the Feature.
|
|
244
|
-
* While Scope we use just to store the scope where the component registered.
|
|
245
|
-
*
|
|
246
|
-
*/
|
|
247
|
-
let metaKey;
|
|
248
|
-
switch (true) {
|
|
249
|
-
case component instanceof A_Entity_class_1.A_Entity:
|
|
250
|
-
metaKey = A_Entity_types_1.A_TYPES__EntityMetaKey.FEATURES;
|
|
251
|
-
break;
|
|
252
|
-
case component instanceof A_Container_class_1.A_Container:
|
|
253
|
-
metaKey = A_Container_types_1.A_TYPES__ContainerMetaKey.FEATURES;
|
|
254
|
-
break;
|
|
255
|
-
case component instanceof A_Component_class_1.A_Component:
|
|
256
|
-
metaKey = A_Component_types_1.A_TYPES__ComponentMetaKey.FEATURES;
|
|
257
|
-
break;
|
|
258
|
-
case component instanceof A_Command_class_1.A_Command:
|
|
259
|
-
metaKey = A_Command_types_1.A_TYPES__CommandMetaKey.FEATURES;
|
|
260
|
-
break;
|
|
261
|
-
default:
|
|
262
|
-
throw new Error(`A-Feature cannot be defined on the ${component} level`);
|
|
263
|
-
}
|
|
264
|
-
const featureDefinition = (_b = (_a = this
|
|
265
|
-
.meta(component)) === null || _a === void 0 ? void 0 : _a.get(metaKey)) === null || _b === void 0 ? void 0 : _b.get(feature);
|
|
266
|
-
const steps = [
|
|
267
|
-
...((featureDefinition === null || featureDefinition === void 0 ? void 0 : featureDefinition.template) || [])
|
|
268
|
-
];
|
|
269
|
-
// const feature: string = new ASEID({
|
|
270
|
-
// id: `${param2}-${Math.random()}`,
|
|
271
|
-
// entity: 'a-feature',
|
|
272
|
-
// namespace: component.constructor.name,
|
|
273
|
-
// scope: scope.name
|
|
274
|
-
// }).toString();
|
|
275
|
-
// Now we need to resolve the method from all registered components
|
|
360
|
+
// name for error messages
|
|
361
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
362
|
+
// Input validation
|
|
363
|
+
if (!component)
|
|
364
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
|
|
365
|
+
if (!name)
|
|
366
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Feature name cannot be null or undefined.`);
|
|
367
|
+
// Check if the parameter is allowed for feature definition
|
|
368
|
+
if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForFeatureDefinition(component))
|
|
369
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
|
|
370
|
+
const callName = `${component.constructor.name}.${name}`;
|
|
371
|
+
const steps = [];
|
|
276
372
|
// We need to get all components that has extensions for the feature in component
|
|
277
|
-
instance.
|
|
278
|
-
.forEach((meta, constructor) => {
|
|
373
|
+
for (const [component, meta] of instance._metaStorage) {
|
|
279
374
|
// Just try to make sure that component not only Indexed but also presented in scope
|
|
280
|
-
if (scope.has(
|
|
375
|
+
if (scope.has(component) && A_TypeGuards_helper_1.A_TypeGuards.isComponentMetaInstance(meta))
|
|
281
376
|
// Get all extensions for the feature
|
|
282
377
|
meta
|
|
283
|
-
.extensions(
|
|
378
|
+
.extensions(callName)
|
|
284
379
|
.forEach((declaration) => {
|
|
285
|
-
steps.push(Object.assign({ component
|
|
380
|
+
steps.push(Object.assign({ component }, declaration));
|
|
286
381
|
});
|
|
287
|
-
}
|
|
288
|
-
return
|
|
382
|
+
}
|
|
383
|
+
return steps;
|
|
289
384
|
}
|
|
290
385
|
/**
|
|
291
|
-
* This method returns
|
|
386
|
+
* This method returns the feature template definition without any extensions.
|
|
387
|
+
* It can be used to retrieve the base template for a feature before any modifications are applied.
|
|
292
388
|
*
|
|
293
|
-
*
|
|
389
|
+
* [!] This method does not consider extensions from other components.
|
|
390
|
+
*
|
|
391
|
+
* @param feature
|
|
392
|
+
* @param component
|
|
294
393
|
* @returns
|
|
295
394
|
*/
|
|
296
|
-
static
|
|
297
|
-
|
|
298
|
-
|
|
395
|
+
static featureDefinition(
|
|
396
|
+
/**
|
|
397
|
+
* Name of the feature to get the template for.
|
|
398
|
+
* Regular expressions are also supported to match multiple features.
|
|
399
|
+
*/
|
|
400
|
+
feature,
|
|
401
|
+
/**
|
|
402
|
+
* Component to get the feature template from.
|
|
403
|
+
*/
|
|
404
|
+
component) {
|
|
405
|
+
var _a, _b;
|
|
299
406
|
let metaKey;
|
|
407
|
+
if (!feature)
|
|
408
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Feature name cannot be null or undefined.`);
|
|
409
|
+
if (!component)
|
|
410
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
|
|
300
411
|
switch (true) {
|
|
301
412
|
case component instanceof A_Entity_class_1.A_Entity:
|
|
302
|
-
metaKey =
|
|
413
|
+
metaKey = A_Entity_constants_1.A_TYPES__EntityMetaKey.FEATURES;
|
|
303
414
|
break;
|
|
304
415
|
case component instanceof A_Container_class_1.A_Container:
|
|
305
|
-
metaKey =
|
|
416
|
+
metaKey = A_Container_constants_1.A_TYPES__ContainerMetaKey.FEATURES;
|
|
306
417
|
break;
|
|
307
418
|
case component instanceof A_Component_class_1.A_Component:
|
|
308
|
-
metaKey =
|
|
309
|
-
break;
|
|
310
|
-
case component instanceof A_Command_class_1.A_Command:
|
|
311
|
-
metaKey = A_Command_types_1.A_TYPES__CommandMetaKey.ABSTRACTIONS;
|
|
419
|
+
metaKey = A_Component_constants_1.A_TYPES__ComponentMetaKey.FEATURES;
|
|
312
420
|
break;
|
|
313
421
|
default:
|
|
314
|
-
throw new
|
|
422
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidFeatureTemplateParameterError, `A-Feature cannot be defined on the ${component} level`);
|
|
315
423
|
}
|
|
316
|
-
const featureDefinition = this.meta(component)
|
|
317
|
-
|
|
318
|
-
.
|
|
424
|
+
const featureDefinition = (_b = (_a = this.meta(component)) === null || _a === void 0 ? void 0 : _a.get(metaKey)) === null || _b === void 0 ? void 0 : _b.get(feature);
|
|
425
|
+
return [
|
|
426
|
+
...((featureDefinition === null || featureDefinition === void 0 ? void 0 : featureDefinition.template) || [])
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
// ==========================================================================================================
|
|
430
|
+
// ================================== ABSTRACTION MANAGEMENT =================================================
|
|
431
|
+
// ==========================================================================================================
|
|
432
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
433
|
+
// -----------------------------------Primary Methods -------------------------------------------------------
|
|
434
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
435
|
+
/**
|
|
436
|
+
* Returns a definition of the abstraction that can be then used to create a new A-Feature Instance
|
|
437
|
+
*
|
|
438
|
+
* [!] Note: Steps/Stages included are fully dependent on the scope provided since it dictates which components are active and can provide extensions for the abstraction.
|
|
439
|
+
*
|
|
440
|
+
* @param abstraction
|
|
441
|
+
*/
|
|
442
|
+
static abstractionTemplate(
|
|
443
|
+
/**
|
|
444
|
+
* Provide the abstraction stage to get the definition for.
|
|
445
|
+
*/
|
|
446
|
+
abstraction,
|
|
447
|
+
/**
|
|
448
|
+
* Provide the component to get the abstraction definition from.
|
|
449
|
+
*/
|
|
450
|
+
component,
|
|
451
|
+
/**
|
|
452
|
+
* Provide the scope that dictates which components are active and can provide extensions for the abstraction.
|
|
453
|
+
*/
|
|
454
|
+
scope) {
|
|
455
|
+
var _a;
|
|
456
|
+
// name for error messages
|
|
457
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
458
|
+
// Input validation
|
|
459
|
+
if (!component)
|
|
460
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionTemplateParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
|
|
461
|
+
if (!abstraction)
|
|
462
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionTemplateParameterError, `Unable to get feature template. Abstraction stage cannot be null or undefined.`);
|
|
463
|
+
// Check if the parameter is allowed for feature definition
|
|
464
|
+
if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForAbstractionDefinition(component))
|
|
465
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionTemplateParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
|
|
319
466
|
const steps = [
|
|
320
|
-
|
|
467
|
+
// 1) Get the base abstraction definition from the component
|
|
468
|
+
// [!] No abstraction Definitions -> They are limited to Concept Abstractions ONLY
|
|
469
|
+
// ...this.abstractionDefinition(abstraction, component),
|
|
470
|
+
// 2) Get all extensions for the abstraction from other components in the scope
|
|
471
|
+
...this.abstractionExtensions(abstraction, component, scope)
|
|
321
472
|
];
|
|
473
|
+
return steps;
|
|
474
|
+
}
|
|
475
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
476
|
+
// -----------------------------------Helper Methods --------------------------------------------------------
|
|
477
|
+
// ----------------------------------------------------------------------------------------------------------
|
|
478
|
+
static abstractionExtensions(
|
|
479
|
+
/**
|
|
480
|
+
* Provide the abstraction name to get the definition for.
|
|
481
|
+
*/
|
|
482
|
+
abstraction,
|
|
483
|
+
/**
|
|
484
|
+
* Provide the component to get the abstraction definition from.
|
|
485
|
+
*/
|
|
486
|
+
component,
|
|
487
|
+
/**
|
|
488
|
+
* Provide the scope that dictates which components are active and can provide extensions for the abstraction.
|
|
489
|
+
*/
|
|
490
|
+
scope) {
|
|
491
|
+
var _a;
|
|
492
|
+
const instance = this.getInstance();
|
|
493
|
+
// name for error messages
|
|
494
|
+
const componentName = ((_a = component === null || component === void 0 ? void 0 : component.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(component);
|
|
495
|
+
// Input validation
|
|
496
|
+
if (!component)
|
|
497
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionExtensionParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
|
|
498
|
+
if (!abstraction)
|
|
499
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionExtensionParameterError, `Unable to get feature template. Abstraction stage cannot be null or undefined.`);
|
|
500
|
+
// Check if the parameter is allowed for feature definition
|
|
501
|
+
if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForAbstractionDefinition(component))
|
|
502
|
+
throw new A_Context_error_1.A_ContextError(A_Context_error_1.A_ContextError.InvalidAbstractionExtensionParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
|
|
503
|
+
const callName = `${component.constructor.name}.${abstraction}`;
|
|
504
|
+
const steps = [];
|
|
322
505
|
// We need to get all components that has extensions for the feature in component
|
|
323
|
-
instance.
|
|
324
|
-
.forEach((meta, constructor) => {
|
|
506
|
+
for (const [component, meta] of instance._metaStorage) {
|
|
325
507
|
// Just try to make sure that component not only Indexed but also presented in scope
|
|
326
|
-
if (scope.has(
|
|
508
|
+
if (scope.has(component) && A_TypeGuards_helper_1.A_TypeGuards.isComponentMetaInstance(meta))
|
|
327
509
|
// Get all extensions for the feature
|
|
328
510
|
meta
|
|
329
|
-
.abstractions(
|
|
511
|
+
.abstractions(callName)
|
|
330
512
|
.forEach((declaration) => {
|
|
331
|
-
steps.push(Object.assign({ component
|
|
513
|
+
steps.push(Object.assign({ component }, declaration));
|
|
332
514
|
});
|
|
333
|
-
}
|
|
334
|
-
return
|
|
515
|
+
}
|
|
516
|
+
return steps;
|
|
335
517
|
}
|
|
336
518
|
/**
|
|
337
|
-
*
|
|
519
|
+
* Resets the Context to its initial state.
|
|
520
|
+
*/
|
|
521
|
+
static reset() {
|
|
522
|
+
const instance = A_Context.getInstance();
|
|
523
|
+
instance._registry = new WeakMap();
|
|
524
|
+
instance._metaStorage = new Map();
|
|
525
|
+
let name = 'root';
|
|
526
|
+
if (A_Context.environment === 'server')
|
|
527
|
+
name = process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_SCOPE] || 'root';
|
|
528
|
+
if (A_Context.environment === 'browser')
|
|
529
|
+
name = window[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_SCOPE] || 'root';
|
|
530
|
+
instance._root = new A_Scope_class_1.A_Scope({ name });
|
|
531
|
+
}
|
|
532
|
+
// ====================================================================================================================
|
|
533
|
+
// ====================================== HELPERS & GUARDS ============================================================
|
|
534
|
+
// ====================================================================================================================
|
|
535
|
+
/**
|
|
536
|
+
* Type guard to check if the param is allowed for scope allocation.
|
|
338
537
|
*
|
|
339
|
-
* @param
|
|
538
|
+
* @param param
|
|
340
539
|
* @returns
|
|
341
540
|
*/
|
|
342
|
-
static
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return newFeature;
|
|
541
|
+
static isAllowedForScopeAllocation(param) {
|
|
542
|
+
return A_TypeGuards_helper_1.A_TypeGuards.isContainerInstance(param)
|
|
543
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isFeatureInstance(param);
|
|
346
544
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
break;
|
|
358
|
-
case param1 instanceof A_Entity_class_1.A_Entity:
|
|
359
|
-
instance.registry.set(param1, scope);
|
|
360
|
-
break;
|
|
361
|
-
case param1 instanceof A_Fragment_class_1.A_Fragment && !instance.registry.has(param1):
|
|
362
|
-
instance.registry.set(param1, scope);
|
|
363
|
-
break;
|
|
364
|
-
default:
|
|
365
|
-
if (!instance.registry.has(param1))
|
|
366
|
-
instance.registry.set(param1, scope);
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
545
|
+
/**
|
|
546
|
+
* Type guard to check if the param is allowed to be registered in the context.
|
|
547
|
+
*
|
|
548
|
+
* @param param
|
|
549
|
+
* @returns
|
|
550
|
+
*/
|
|
551
|
+
static isAllowedToBeRegistered(param) {
|
|
552
|
+
return A_TypeGuards_helper_1.A_TypeGuards.isEntityInstance(param)
|
|
553
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isComponentInstance(param)
|
|
554
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isFragmentInstance(param);
|
|
369
555
|
}
|
|
370
556
|
/**
|
|
371
|
-
*
|
|
557
|
+
* Type guard to check if the param is allowed for meta storage.
|
|
558
|
+
*
|
|
559
|
+
* @param param
|
|
560
|
+
* @returns
|
|
372
561
|
*/
|
|
373
|
-
static
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
562
|
+
static isAllowedForMeta(param) {
|
|
563
|
+
return A_TypeGuards_helper_1.A_TypeGuards.isContainerInstance(param)
|
|
564
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isComponentInstance(param)
|
|
565
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isEntityInstance(param);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Type guard to check if the param is allowed for meta storage by constructor.
|
|
569
|
+
*
|
|
570
|
+
* @param param
|
|
571
|
+
* @returns
|
|
572
|
+
*/
|
|
573
|
+
static isAllowedForMetaConstructor(param) {
|
|
574
|
+
return A_TypeGuards_helper_1.A_TypeGuards.isContainerConstructor(param)
|
|
575
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(param)
|
|
576
|
+
|| A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(param);
|
|
385
577
|
}
|
|
386
578
|
}
|
|
387
579
|
exports.A_Context = A_Context;
|