@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
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A_TYPES__ASEID_Constructor,
|
|
3
|
+
A_TYPES__ASEID_JSON
|
|
4
|
+
} from "./ASEID.types";
|
|
5
|
+
import { A_IdentityHelper } from "@adaas/a-concept/helpers/A_Identity.helper";
|
|
6
|
+
import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
7
|
+
import { A_Context } from "../A-Context/A-Context.class";
|
|
8
|
+
import { ASEID_Error } from "./ASEID.error";
|
|
9
|
+
import { A_TYPES__Required } from "@adaas/a-concept/types/A_Common.types";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export class ASEID {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
//==========================================================================
|
|
17
|
+
//============================= STATIC METHODS ===========================
|
|
18
|
+
//==========================================================================
|
|
19
|
+
/**
|
|
20
|
+
* ASEID Regular Expression
|
|
21
|
+
*/
|
|
22
|
+
static readonly regexp: RegExp = new RegExp(`^[a-z|A-Z|0-9|-]+@[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|-|\\.]+(@v[0-9|\\.]+|@lts)?$`)
|
|
23
|
+
/**
|
|
24
|
+
* Tests if the identity string is an ASEID
|
|
25
|
+
*
|
|
26
|
+
* @param identity
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
static isASEID(identity: string): boolean {
|
|
30
|
+
return this.regexp.test(
|
|
31
|
+
identity
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// ====================================================================
|
|
38
|
+
// ==================== Hidden ASEID Information ======================
|
|
39
|
+
// ====================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Concept for the ASEID
|
|
42
|
+
* Generally it is the application name or code, should correspond to the concept where the entity is used
|
|
43
|
+
* Could be ID or ASEID
|
|
44
|
+
*/
|
|
45
|
+
private _concept!: string;
|
|
46
|
+
/**
|
|
47
|
+
* Entity Scope the primary location of the resource
|
|
48
|
+
* Organization, or organization Unit
|
|
49
|
+
* Could be ID or ASEID
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
private _scope!: string
|
|
53
|
+
/**
|
|
54
|
+
* Entity Type the type of the resource
|
|
55
|
+
*/
|
|
56
|
+
private _entity!: string
|
|
57
|
+
/**
|
|
58
|
+
* Entity ID the unique identifier of the resource
|
|
59
|
+
*/
|
|
60
|
+
private _id!: string
|
|
61
|
+
/**
|
|
62
|
+
* Version of the entity (optional)
|
|
63
|
+
*/
|
|
64
|
+
private _version?: string
|
|
65
|
+
/**
|
|
66
|
+
* Shard of the entity (optional)
|
|
67
|
+
*/
|
|
68
|
+
private _shard?: string
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* ASEID is a structured identifier for entities in the A-Concept system.
|
|
77
|
+
* using the format:
|
|
78
|
+
* A - A-Concept
|
|
79
|
+
* S - System
|
|
80
|
+
* E - Entity
|
|
81
|
+
* I - Identifier
|
|
82
|
+
* D - iDentifier
|
|
83
|
+
*
|
|
84
|
+
* Structure: CONCEPT_NAME + @ + SCOPE + : ENTITY_NAME + : + ID + @ + VERSION
|
|
85
|
+
*
|
|
86
|
+
* Example:
|
|
87
|
+
* - root@core:usr:0000000001
|
|
88
|
+
*
|
|
89
|
+
* [!] Concept is optional, if not provided will be used the current concept name
|
|
90
|
+
* [!] Scope is optional, if not provided will be used the root scope of the current concept
|
|
91
|
+
* [!] Version is optional, if not provided will be considered as latest version
|
|
92
|
+
*
|
|
93
|
+
* @param aseid - ASEID string representation or ASEID components as object
|
|
94
|
+
*/
|
|
95
|
+
constructor(
|
|
96
|
+
/**
|
|
97
|
+
* ASEID string representation
|
|
98
|
+
*/
|
|
99
|
+
aseid: string
|
|
100
|
+
)
|
|
101
|
+
constructor(
|
|
102
|
+
/**
|
|
103
|
+
* ASEID components as object
|
|
104
|
+
*/
|
|
105
|
+
props: A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>
|
|
106
|
+
)
|
|
107
|
+
constructor(param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>) {
|
|
108
|
+
this.verifyInput(param1);
|
|
109
|
+
|
|
110
|
+
const initializer = this.getInitializer(param1);
|
|
111
|
+
// the returned initializer is already bound to `this` (we used .bind(this)),
|
|
112
|
+
// so calling it will run the appropriate logic on this instance:
|
|
113
|
+
initializer.call(this, param1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Getters for ASEID components
|
|
118
|
+
*/
|
|
119
|
+
get concept(): string {
|
|
120
|
+
return this._concept || A_Context.concept;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the scope of the ASEID
|
|
124
|
+
*/
|
|
125
|
+
get scope(): string {
|
|
126
|
+
return this._scope || A_Context.root.name;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the entity of the ASEID
|
|
130
|
+
*/
|
|
131
|
+
get entity(): string {
|
|
132
|
+
return this._entity;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get the id of the ASEID
|
|
136
|
+
*/
|
|
137
|
+
get id(): string {
|
|
138
|
+
return this._id;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get the version of the ASEID (if any)
|
|
142
|
+
*/
|
|
143
|
+
get version(): string | undefined {
|
|
144
|
+
return this._version;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the shard of the ASEID (if any)
|
|
148
|
+
*/
|
|
149
|
+
get shard(): string | undefined {
|
|
150
|
+
return this._shard;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* get Internal Initializer based on the type of the parameter provided
|
|
155
|
+
*
|
|
156
|
+
* @param param1
|
|
157
|
+
* @returns
|
|
158
|
+
*/
|
|
159
|
+
private getInitializer(
|
|
160
|
+
param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>
|
|
161
|
+
): (param1: any) => void | (() => void) {
|
|
162
|
+
switch (true) {
|
|
163
|
+
case A_TypeGuards.isString(param1):
|
|
164
|
+
return this.fromString;
|
|
165
|
+
|
|
166
|
+
case A_TypeGuards.isObject<A_TYPES__ASEID_Constructor>(param1):
|
|
167
|
+
return this.fromObject;
|
|
168
|
+
|
|
169
|
+
default:
|
|
170
|
+
throw new ASEID_Error(
|
|
171
|
+
ASEID_Error.ASEIDInitializationError,
|
|
172
|
+
'Invalid parameters provided to ASEID constructor'
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Initialize ASEID from string
|
|
180
|
+
*
|
|
181
|
+
* @param param1
|
|
182
|
+
*/
|
|
183
|
+
private fromString(param1: string) {
|
|
184
|
+
const [concept, body, version] = param1.split('@');
|
|
185
|
+
const [scope, entity, idCandidate] = body.split(':');
|
|
186
|
+
|
|
187
|
+
const shard = idCandidate.includes('.') ? idCandidate.split('.')[0] : undefined;
|
|
188
|
+
const id = idCandidate.includes('.') ? idCandidate.split('.')[1] : idCandidate;
|
|
189
|
+
|
|
190
|
+
this._concept = concept || A_Context.root.name;
|
|
191
|
+
this._scope = scope || A_Context.root.name;
|
|
192
|
+
this._entity = entity;
|
|
193
|
+
this._id = id;
|
|
194
|
+
this._version = version;
|
|
195
|
+
this._shard = shard;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Initialize ASEID from object
|
|
199
|
+
*
|
|
200
|
+
* @param param1
|
|
201
|
+
*/
|
|
202
|
+
private fromObject(param1: A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>) {
|
|
203
|
+
this._concept = param1.concept
|
|
204
|
+
? ASEID.isASEID(param1.concept)
|
|
205
|
+
? new ASEID(param1.concept).id
|
|
206
|
+
: param1.concept
|
|
207
|
+
: A_Context.concept;
|
|
208
|
+
|
|
209
|
+
this._scope = param1.scope
|
|
210
|
+
? A_TypeGuards.isNumber(param1.scope)
|
|
211
|
+
? A_IdentityHelper.formatWithLeadingZeros(param1.scope) :
|
|
212
|
+
ASEID.isASEID(param1.scope)
|
|
213
|
+
? new ASEID(param1.scope).id
|
|
214
|
+
: param1.scope
|
|
215
|
+
: A_Context.root.name
|
|
216
|
+
|
|
217
|
+
this._entity = param1.entity;
|
|
218
|
+
|
|
219
|
+
this._id = A_TypeGuards.isNumber(param1.id)
|
|
220
|
+
? A_IdentityHelper.formatWithLeadingZeros(param1.id)
|
|
221
|
+
: param1.id;
|
|
222
|
+
|
|
223
|
+
this._version = param1.version;
|
|
224
|
+
this._shard = param1.shard;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* String representation of the ASEID
|
|
230
|
+
*
|
|
231
|
+
* @returns
|
|
232
|
+
*/
|
|
233
|
+
toString(): string {
|
|
234
|
+
return `${this.concept}@${this.scope}:${this.entity}:${this.shard ? (this.shard + '.' + this.id) : this.id}${this.version ? ('@' + this.version) : ''}`
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* JSON representation of the ASEID
|
|
239
|
+
*
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
242
|
+
toJSON(): A_TYPES__ASEID_JSON {
|
|
243
|
+
return {
|
|
244
|
+
concept: this._concept,
|
|
245
|
+
scope: this._scope,
|
|
246
|
+
entity: this._entity,
|
|
247
|
+
id: this._id,
|
|
248
|
+
version: this._version,
|
|
249
|
+
shard: this._shard
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// --------------------------------------------------------------------------
|
|
254
|
+
// ----------------------- PROTECTED HELPERS --------------------------------
|
|
255
|
+
// --------------------------------------------------------------------------
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
protected verifyInput(param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>) {
|
|
259
|
+
|
|
260
|
+
switch (true) {
|
|
261
|
+
// 1) check for string and validate it as ASEID
|
|
262
|
+
case A_TypeGuards.isString(param1) && !ASEID.isASEID(param1):
|
|
263
|
+
throw new ASEID_Error(ASEID_Error.ASEIDValidationError, 'Invalid ASEID format provided')
|
|
264
|
+
|
|
265
|
+
// 2) check for object and validate required fields
|
|
266
|
+
case A_TypeGuards.isObject<A_TYPES__ASEID_Constructor>(param1) && !param1.id:
|
|
267
|
+
throw new ASEID_Error(ASEID_Error.ASEIDValidationError, 'ASEID id is required')
|
|
268
|
+
|
|
269
|
+
// 3) check for object and validate required fields
|
|
270
|
+
case A_TypeGuards.isObject<A_TYPES__ASEID_Constructor>(param1) && !param1.entity:
|
|
271
|
+
throw new ASEID_Error(ASEID_Error.ASEIDValidationError, 'ASEID entity is required')
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A_Error } from "../A-Error/A_Error.class";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class ASEID_Error extends A_Error {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
static readonly ASEIDInitializationError = 'ASEID Initialization Error';
|
|
9
|
+
|
|
10
|
+
static readonly ASEIDValidationError = 'ASEID Validation Error';
|
|
11
|
+
|
|
12
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface A_TYPES__ASEID_Constructor {
|
|
2
|
+
/**
|
|
3
|
+
* Concept for the ASEID
|
|
4
|
+
* Generally it is the application name or code, should correspond to the concept where the entity is used
|
|
5
|
+
* Could be ID or ASEID
|
|
6
|
+
*/
|
|
7
|
+
concept?: string,
|
|
8
|
+
/**
|
|
9
|
+
* Entity Scope the primary location of the resource
|
|
10
|
+
* Organization, or organization Unit or Internal/External
|
|
11
|
+
* Could be ID or ASEID
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
scope: number | string
|
|
15
|
+
/**
|
|
16
|
+
* Entity Type the type of the resource
|
|
17
|
+
*/
|
|
18
|
+
entity: string
|
|
19
|
+
/**
|
|
20
|
+
* Entity ID the unique identifier of the resource
|
|
21
|
+
*/
|
|
22
|
+
id: number | string
|
|
23
|
+
/**
|
|
24
|
+
* Version of the entity (optional)
|
|
25
|
+
*/
|
|
26
|
+
version?: string
|
|
27
|
+
/**
|
|
28
|
+
* Shard of the entity (optional)
|
|
29
|
+
*/
|
|
30
|
+
shard?: string
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export interface A_TYPES__ASEID_ConstructorConfig {
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* If true, the entity ASEID will be distributed across multiple shards.
|
|
39
|
+
* In this case SHARD should be provided via Environment Variables (A_SHARD) or Configurations
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
sharding?: boolean
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export type A_TYPES__ASEID_JSON = {
|
|
49
|
+
/**
|
|
50
|
+
* Concept for the ASEID
|
|
51
|
+
*/
|
|
52
|
+
concept: string,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Entity Scope the primary location of the resource
|
|
56
|
+
*/
|
|
57
|
+
scope: string,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Entity Type the type of the resource
|
|
61
|
+
*/
|
|
62
|
+
entity: string,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Entity ID the unique identifier of the resource
|
|
66
|
+
*/
|
|
67
|
+
id: string,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Version of the entity (optional)
|
|
71
|
+
*/
|
|
72
|
+
version?: string,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Shard of the entity (optional)
|
|
76
|
+
*/
|
|
77
|
+
shard?: string
|
|
78
|
+
}
|
|
79
|
+
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { A_TYPES__DeepPartial } from "../types/A_Common.types";
|
|
2
|
+
|
|
3
|
+
export class A_CommonHelper {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A simple promise that resolves immediately.
|
|
7
|
+
* Can be used in async functions to create a resolved promise.
|
|
8
|
+
*/
|
|
9
|
+
static resolve() {
|
|
10
|
+
return new Promise<void>((resolve) => resolve());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Check if a class is inherited from another class
|
|
15
|
+
*
|
|
16
|
+
* @param childClass
|
|
17
|
+
* @param parentClass
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
static isInheritedFrom(childClass: any, parentClass: any): boolean {
|
|
21
|
+
let current = childClass;
|
|
22
|
+
|
|
23
|
+
// Traverse the prototype chain
|
|
24
|
+
while (current) {
|
|
25
|
+
if (current === parentClass) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
current = Object.getPrototypeOf(current);
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Omit properties from an object or array with nested objects
|
|
35
|
+
*
|
|
36
|
+
* @param input
|
|
37
|
+
* @param paths
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static omitProperties<T, S extends string>(
|
|
41
|
+
input: T,
|
|
42
|
+
paths: string[]
|
|
43
|
+
|
|
44
|
+
): Omit<T, S> {
|
|
45
|
+
|
|
46
|
+
// Deep clone the input object or array
|
|
47
|
+
const result = JSON.parse(JSON.stringify(input));
|
|
48
|
+
|
|
49
|
+
// Helper function to recursively remove properties
|
|
50
|
+
function removeProperties(target: Record<string, any> | any[], currPath: string[]) {
|
|
51
|
+
const currKey = currPath[0];
|
|
52
|
+
if (currPath.length === 1) {
|
|
53
|
+
// If current path has only one key, delete the property
|
|
54
|
+
delete target[currKey];
|
|
55
|
+
} else if (target[currKey] !== undefined && typeof target[currKey] === 'object') {
|
|
56
|
+
// If current key exists and is an object, recursively call removeProperties
|
|
57
|
+
removeProperties(target[currKey], currPath.slice(1));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Iterate through each path and remove corresponding properties from the result
|
|
62
|
+
paths.forEach(path => {
|
|
63
|
+
const pathKeys = path.split('.');
|
|
64
|
+
removeProperties(result, pathKeys);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return result as Omit<T, S>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
static isObject(item: unknown): item is Record<string, any> {
|
|
72
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static deepMerge<T = any>(target: any, source: any, visited = new Map<any, any>()): T {
|
|
76
|
+
if (this.isObject(target) && this.isObject(source)) {
|
|
77
|
+
for (const key in source) {
|
|
78
|
+
if (this.isObject(source[key])) {
|
|
79
|
+
if (!target[key]) {
|
|
80
|
+
target[key] = {};
|
|
81
|
+
}
|
|
82
|
+
// Check if the source object has already been visited
|
|
83
|
+
if (!visited.has(source[key])) {
|
|
84
|
+
visited.set(source[key], {});
|
|
85
|
+
this.deepMerge(target[key], source[key], visited);
|
|
86
|
+
} else {
|
|
87
|
+
target[key] = visited.get(source[key]);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
target[key] = source[key];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return target;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
static deepClone<T>(target: T): T {
|
|
99
|
+
// Check if the value is null or undefined
|
|
100
|
+
if (target === null || target === undefined) {
|
|
101
|
+
return target;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Handle primitive types (string, number, boolean, etc.)
|
|
105
|
+
if (typeof target !== 'object') {
|
|
106
|
+
return target;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Handle Date
|
|
110
|
+
if (target instanceof Date) {
|
|
111
|
+
return new Date(target.getTime()) as T;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Handle Array
|
|
115
|
+
if (Array.isArray(target)) {
|
|
116
|
+
return target.map(item => this.deepClone(item)) as unknown as T;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Handle Function
|
|
120
|
+
if (typeof target === 'function') {
|
|
121
|
+
return target;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Handle Object
|
|
125
|
+
if (target instanceof Object) {
|
|
126
|
+
const clone = {} as T;
|
|
127
|
+
for (const key in target) {
|
|
128
|
+
if (target.hasOwnProperty(key)) {
|
|
129
|
+
clone[key] = this.deepClone(target[key]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return clone;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// For any other cases
|
|
136
|
+
throw new Error('Unable to clone the object. Unsupported type.');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
static deepCloneAndMerge<T>(target: A_TYPES__DeepPartial<T>, source: T): T {
|
|
141
|
+
if (
|
|
142
|
+
(source === null || source === undefined) &&
|
|
143
|
+
(target === null || target === undefined))
|
|
144
|
+
return target;
|
|
145
|
+
|
|
146
|
+
// Check if the value is null or undefined
|
|
147
|
+
if ((target === null || target === undefined) &&
|
|
148
|
+
source
|
|
149
|
+
) {
|
|
150
|
+
return this.deepClone(source);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Handle primitive types (string, number, boolean, etc.)
|
|
154
|
+
if (typeof target !== 'object') {
|
|
155
|
+
return target
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
// Handle Date
|
|
160
|
+
if (target instanceof Date) {
|
|
161
|
+
return new Date(target.getTime()) as T;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Handle Array
|
|
165
|
+
if (Array.isArray(target)) {
|
|
166
|
+
return target.map(item => this.deepCloneAndMerge(item, source)) as unknown as T;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Handle Function
|
|
170
|
+
if (typeof target === 'function') {
|
|
171
|
+
return target;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Handle Object
|
|
175
|
+
if (target instanceof Object) {
|
|
176
|
+
const clone = {} as T;
|
|
177
|
+
for (const key in target) {
|
|
178
|
+
if (
|
|
179
|
+
source[key] !== null
|
|
180
|
+
&&
|
|
181
|
+
source[key] !== undefined
|
|
182
|
+
)
|
|
183
|
+
clone[key] = this.deepCloneAndMerge(target[key as any], source[key]);
|
|
184
|
+
else
|
|
185
|
+
clone[key as any] = this.deepClone(target[key]);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
for (const key in source) {
|
|
189
|
+
if (
|
|
190
|
+
target[key] !== undefined
|
|
191
|
+
&&
|
|
192
|
+
target[key] !== null
|
|
193
|
+
)
|
|
194
|
+
clone[key] = this.deepCloneAndMerge(target[key], source[key]);
|
|
195
|
+
else
|
|
196
|
+
clone[key] = this.deepClone(source[key]);
|
|
197
|
+
}
|
|
198
|
+
return clone;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// For any other cases
|
|
202
|
+
throw new Error('Unable to clone the object. Unsupported type.');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* A_FormatterHelper
|
|
4
|
+
*
|
|
5
|
+
* Helper class for formatting strings into different cases.
|
|
6
|
+
*/
|
|
7
|
+
export class A_FormatterHelper {
|
|
8
|
+
/**
|
|
9
|
+
* Convert string to UPPER_SNAKE_CASE
|
|
10
|
+
*
|
|
11
|
+
* @param str
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
static toUpperSnakeCase(str: string): string {
|
|
15
|
+
return str
|
|
16
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2') // Handle lowercase followed by uppercase
|
|
17
|
+
.replace(/[-\s]([A-Z])/g, '_$1') // Handle non-alphabetical followed by uppercase
|
|
18
|
+
.replace(/-/g, '_')
|
|
19
|
+
.toUpperCase();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert string to camelCase
|
|
23
|
+
*
|
|
24
|
+
* @param str
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
static toCamelCase(str: string): string {
|
|
28
|
+
return str.toLowerCase().replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convert string to PascalCase
|
|
32
|
+
*
|
|
33
|
+
* @param str
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
static toPascalCase(str: string): string {
|
|
37
|
+
const camelCase = this.toCamelCase(str);
|
|
38
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert string to kebab-case
|
|
42
|
+
*
|
|
43
|
+
* @param str
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
static toKebabCase(str: string): string {
|
|
47
|
+
return str
|
|
48
|
+
// 1. Replace all non-alphanumeric (underscore, dot, etc.) with a space
|
|
49
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
50
|
+
// 2. Insert space before any uppercase preceded by lowercase or digit
|
|
51
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
52
|
+
// 3. Trim spaces at both ends and replace remaining spaces with dashes
|
|
53
|
+
.trim()
|
|
54
|
+
.replace(/\s+/g, '-')
|
|
55
|
+
// 4. Lowercase everything
|
|
56
|
+
.toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
export type A_ID_TYPES__TimeId_Parts = {
|
|
3
|
+
timestamp: Date;
|
|
4
|
+
random: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class A_IdentityHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Generates a short, time-based unique ID.
|
|
11
|
+
* Encodes current time (ms since epoch) and random bits in base36.
|
|
12
|
+
* Example: "mb4f1g-7f9a1c"
|
|
13
|
+
*/
|
|
14
|
+
static generateTimeId(
|
|
15
|
+
parts: A_ID_TYPES__TimeId_Parts = { timestamp: new Date(), random: Math.random().toString(36).slice(2, 8) }
|
|
16
|
+
): string {
|
|
17
|
+
const time = parts.timestamp.getTime().toString(36); // base36-encoded timestamp
|
|
18
|
+
const random = parts.random; // use provided random string
|
|
19
|
+
return `${time}-${random}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Parses a short ID back into its parts.
|
|
24
|
+
* Returns an object with the original timestamp (as Date) and random string.
|
|
25
|
+
*/
|
|
26
|
+
static parseTimeId(id: string): A_ID_TYPES__TimeId_Parts {
|
|
27
|
+
const [timePart, randomPart] = id.split('-');
|
|
28
|
+
const timestamp = new Date(parseInt(timePart, 36));
|
|
29
|
+
return { timestamp, random: randomPart };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Format a number with leading zeros to a fixed length
|
|
35
|
+
*
|
|
36
|
+
* @param number
|
|
37
|
+
* @param maxZeros
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static formatWithLeadingZeros(number, maxZeros = 10) {
|
|
41
|
+
const formattedNumber = String(number).padStart(maxZeros + 1, '0');
|
|
42
|
+
return formattedNumber.slice(-maxZeros);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Remove leading zeros from a formatted number
|
|
47
|
+
*/
|
|
48
|
+
static removeLeadingZeros(formattedNumber) {
|
|
49
|
+
return String(Number(formattedNumber)); // Convert to number and back to string to remove leading zeros
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
}
|