@adaas/a-concept 0.1.23 → 0.1.25
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.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +3952 -0
- package/dist/index.d.ts +3952 -50
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -6
- package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +18 -13
- package/src/global/A-Component/A-Component.meta.ts +3 -2
- package/src/global/A-Container/A-Container.meta.ts +5 -8
- package/src/global/A-Context/A-Context.class.ts +81 -7
- package/src/global/A-Context/A-Context.error.ts +4 -0
- package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
- package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
- package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
- package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
- package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
- package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
- package/src/global/A-Entity/A-Entity.class.ts +2 -1
- package/src/global/A-Feature/A-Feature-Define.decorator.ts +7 -4
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +23 -17
- package/src/global/A-Feature/A-Feature.class.ts +12 -1
- package/src/global/A-Feature/A-Feature.types.ts +33 -8
- package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
- package/src/global/A-Inject/A-Inject.types.ts +5 -3
- package/src/global/A-Scope/A-Scope.class.ts +85 -57
- package/src/global/A-Stage/A-Stage.class.ts +22 -2
- package/src/global/A-Stage/A-Stage.error.ts +2 -0
- package/src/global/A-Stage/A-Stage.types.ts +7 -2
- package/src/global/A-StepManager/A-StepManager.class.ts +19 -13
- package/src/helpers/A_Common.helper.ts +101 -0
- package/src/helpers/A_TypeGuards.helper.ts +8 -0
- package/src/index.ts +88 -0
- package/tests/A-Component.test.ts +1 -1
- package/tests/A-Concept.test.ts +58 -10
- package/tests/A-Dependency.test.ts +93 -0
- package/tests/A-Feature.test.ts +11 -11
- package/tests/A-Scope.test.ts +10 -10
- package/tests/A-StepManager.test.ts +60 -11
- package/tsconfig.json +2 -2
- package/tsup.config.ts +32 -0
- package/dist/index.js +0 -112
- package/dist/index.js.map +0 -1
- package/dist/src/constants/env.constants.d.ts +0 -33
- package/dist/src/constants/env.constants.js +0 -47
- package/dist/src/constants/env.constants.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -89
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
- package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
- package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
- package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
- package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
- package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
- package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.class.js +0 -56
- package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
- package/dist/src/global/A-Component/A-Component.constants.js +0 -11
- package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.meta.js +0 -77
- package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
- package/dist/src/global/A-Component/A-Component.types.js +0 -4
- package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
- package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
- package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
- package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
- package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
- package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
- 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 -66
- package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
- package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
- package/dist/src/global/A-Container/A-Container.class.js +0 -78
- package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
- package/dist/src/global/A-Container/A-Container.constants.js +0 -11
- package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
- package/dist/src/global/A-Container/A-Container.meta.js +0 -83
- package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
- package/dist/src/global/A-Container/A-Container.types.js +0 -4
- package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
- package/dist/src/global/A-Context/A-Context.class.js +0 -603
- package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
- package/dist/src/global/A-Context/A-Context.error.js +0 -25
- package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
- package/dist/src/global/A-Context/A-Context.types.js +0 -3
- package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
- package/dist/src/global/A-Entity/A-Entity.class.js +0 -281
- package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
- package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
- package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
- package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
- package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
- package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
- package/dist/src/global/A-Error/A_Error.class.js +0 -296
- package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
- package/dist/src/global/A-Error/A_Error.constants.js +0 -9
- package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
- package/dist/src/global/A-Error/A_Error.types.js +0 -3
- package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -119
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
- package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
- package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
- package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
- package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -310
- package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
- package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
- package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
- package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
- package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
- package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
- package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
- package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
- package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
- package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
- package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
- package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
- package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
- package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
- package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
- package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
- package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
- package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
- package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
- package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
- package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
- package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
- package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
- package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -97
- package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
- package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
- package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -111
- package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
- package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
- package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
- package/dist/src/global/ASEID/ASEID.class.js +0 -167
- package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
- package/dist/src/global/ASEID/ASEID.constants.js +0 -2
- package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
- package/dist/src/global/ASEID/ASEID.error.js +0 -10
- package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
- package/dist/src/global/ASEID/ASEID.types.js +0 -5
- package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
- package/dist/src/helpers/A_Common.helper.d.ts +0 -28
- package/dist/src/helpers/A_Common.helper.js +0 -170
- package/dist/src/helpers/A_Common.helper.js.map +0 -1
- package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
- package/dist/src/helpers/A_Formatter.helper.js +0 -62
- package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
- package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
- package/dist/src/helpers/A_Identity.helper.js +0 -43
- package/dist/src/helpers/A_Identity.helper.js.map +0 -1
- package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
- package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
- package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
- package/dist/src/types/A_Common.types.d.ts +0 -36
- package/dist/src/types/A_Common.types.js +0 -3
- package/dist/src/types/A_Common.types.js.map +0 -1
- package/index.ts +0 -81
- package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
- package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
- package/trace-require.js +0 -46
- package/tsconfig.build.json +0 -58
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_ContextError = void 0;
|
|
4
|
-
const A_Error_class_1 = require("../A-Error/A_Error.class");
|
|
5
|
-
class A_ContextError extends A_Error_class_1.A_Error {
|
|
6
|
-
}
|
|
7
|
-
exports.A_ContextError = A_ContextError;
|
|
8
|
-
A_ContextError.NotAllowedForScopeAllocationError = 'Component is not allowed for scope allocation';
|
|
9
|
-
A_ContextError.ComponentAlreadyHasScopeAllocatedError = 'Component already has scope allocated';
|
|
10
|
-
A_ContextError.InvalidMetaParameterError = 'Invalid parameter provided to get meta';
|
|
11
|
-
A_ContextError.InvalidScopeParameterError = 'Invalid parameter provided to get scope';
|
|
12
|
-
A_ContextError.ScopeNotFoundError = 'Scope not found';
|
|
13
|
-
A_ContextError.InvalidFeatureParameterError = 'Invalid parameter provided to get feature';
|
|
14
|
-
A_ContextError.InvalidFeatureDefinitionParameterError = 'Invalid parameter provided to define feature';
|
|
15
|
-
A_ContextError.InvalidFeatureTemplateParameterError = 'Invalid parameter provided to get feature template';
|
|
16
|
-
A_ContextError.InvalidFeatureExtensionParameterError = 'Invalid parameter provided to extend feature';
|
|
17
|
-
A_ContextError.InvalidAbstractionParameterError = 'Invalid parameter provided to get abstraction';
|
|
18
|
-
A_ContextError.InvalidAbstractionDefinitionParameterError = 'Invalid parameter provided to define abstraction';
|
|
19
|
-
A_ContextError.InvalidAbstractionTemplateParameterError = 'Invalid parameter provided to get abstraction template';
|
|
20
|
-
A_ContextError.InvalidAbstractionExtensionParameterError = 'Invalid parameter provided to extend abstraction';
|
|
21
|
-
A_ContextError.InvalidInjectionParameterError = 'Invalid parameter provided to get injections';
|
|
22
|
-
A_ContextError.InvalidExtensionParameterError = 'Invalid parameter provided to get extensions';
|
|
23
|
-
A_ContextError.InvalidRegisterParameterError = 'Invalid parameter provided to register component';
|
|
24
|
-
A_ContextError.InvalidComponentParameterError = 'Invalid component provided';
|
|
25
|
-
//# sourceMappingURL=A-Context.error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Context.error.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.error.ts"],"names":[],"mappings":";;;AAAA,4DAAmD;AAInD,MAAa,cAAe,SAAQ,uBAAO;;AAA3C,wCAuCC;AApCU,gDAAiC,GAAG,+CAA+C,CAAC;AAEpF,qDAAsC,GAAG,uCAAuC,CAAC;AAEjF,wCAAyB,GAAG,wCAAwC,CAAC;AAErE,yCAA0B,GAAG,yCAAyC,CAAC;AAEvE,iCAAkB,GAAG,iBAAiB,CAAC;AAEvC,2CAA4B,GAAG,2CAA2C,CAAC;AAE3E,qDAAsC,GAAG,8CAA8C,CAAC;AAExF,mDAAoC,GAAG,oDAAoD,CAAC;AAE5F,oDAAqC,GAAG,8CAA8C,CAAC;AAGvF,+CAAgC,GAAG,+CAA+C,CAAC;AAEnF,yDAA0C,GAAG,kDAAkD,CAAC;AAEhG,uDAAwC,GAAG,wDAAwD,CAAC;AAEpG,wDAAyC,GAAG,kDAAkD,CAAC;AAE/F,6CAA8B,GAAG,8CAA8C,CAAC;AAEhF,6CAA8B,GAAG,8CAA8C,CAAC;AAGhF,4CAA6B,GAAG,kDAAkD,CAAC;AAGnF,6CAA8B,GAAG,4BAA4B,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { A_ComponentMeta } from "../A-Component/A-Component.meta";
|
|
2
|
-
import { A_ContainerMeta } from "../A-Container/A-Container.meta";
|
|
3
|
-
import { A_EntityMeta } from "../A-Entity/A-Entity.meta";
|
|
4
|
-
export type A_TYPES__ContextEnvironment = 'server' | 'browser' | 'mobile' | 'desktop' | 'embedded' | 'unknown';
|
|
5
|
-
export type A_TYPES__FeatureExtendableMeta = A_ContainerMeta | A_ComponentMeta | A_EntityMeta;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Context.types.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// class RealDependency {
|
|
3
|
-
// constructor(private name: string) { }
|
|
4
|
-
// getName() {
|
|
5
|
-
// return this.name;
|
|
6
|
-
// }
|
|
7
|
-
// performAction() {
|
|
8
|
-
// console.log(`${this.name} is performing an action.`);
|
|
9
|
-
// }
|
|
10
|
-
// }
|
|
11
|
-
// class DependencyReference<T> {
|
|
12
|
-
// private proxyInstance: T | null = null;
|
|
13
|
-
// private realInstance: T | null = null;
|
|
14
|
-
// constructor(private realClass: { new(...args: any[]): T }, private args: any[]) { }
|
|
15
|
-
// // Simulate async loading (e.g., dynamic imports, API calls, etc.)
|
|
16
|
-
// private async loadInstance(): Promise<T> {
|
|
17
|
-
// if (!this.realInstance) {
|
|
18
|
-
// console.log('Loading real dependency...');
|
|
19
|
-
// // Simulate async loading with a delay
|
|
20
|
-
// await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
21
|
-
// this.realInstance = new this.realClass(...this.args);
|
|
22
|
-
// }
|
|
23
|
-
// return this.realInstance;
|
|
24
|
-
// }
|
|
25
|
-
// public async resolve(): Promise<T> {
|
|
26
|
-
// if (!this.proxyInstance) {
|
|
27
|
-
// const realInstance = await this.loadInstance();
|
|
28
|
-
// this.proxyInstance = new Proxy({}, {
|
|
29
|
-
// get: (target, prop) => {
|
|
30
|
-
// const value = (realInstance as any)[prop];
|
|
31
|
-
// // If the property is a method, return a bound function
|
|
32
|
-
// if (typeof value === 'function') {
|
|
33
|
-
// return value.bind(realInstance);
|
|
34
|
-
// }
|
|
35
|
-
// return value;
|
|
36
|
-
// }
|
|
37
|
-
// }) as T;
|
|
38
|
-
// }
|
|
39
|
-
// return this.proxyInstance;
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
// // Example usage:
|
|
43
|
-
// (async () => {
|
|
44
|
-
// const lazyDependency = new DependencyReference(RealDependency, ['ComponentA']);
|
|
45
|
-
// const proxy = await lazyDependency.resolve(); // Loads the instance asynchronously
|
|
46
|
-
// proxy.performAction(); // Will call the method on the real instance
|
|
47
|
-
// console.log(proxy.getName()); // Calls method on the real instance
|
|
48
|
-
// })();
|
|
49
|
-
//# sourceMappingURL=A-DependencyReference.class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-DependencyReference.class.js","sourceRoot":"","sources":["../../../../src/global/A-Dependency/A-DependencyReference.class.ts"],"names":[],"mappings":";AAAA,yBAAyB;AACzB,4CAA4C;AAE5C,kBAAkB;AAClB,4BAA4B;AAC5B,QAAQ;AAER,wBAAwB;AACxB,gEAAgE;AAChE,QAAQ;AACR,IAAI;AAEJ,iCAAiC;AACjC,8CAA8C;AAC9C,6CAA6C;AAE7C,0FAA0F;AAE1F,yEAAyE;AACzE,iDAAiD;AACjD,oCAAoC;AACpC,yDAAyD;AACzD,qDAAqD;AACrD,yEAAyE;AACzE,oEAAoE;AACpE,YAAY;AACZ,oCAAoC;AACpC,QAAQ;AAER,2CAA2C;AAC3C,qCAAqC;AACrC,8DAA8D;AAE9D,mDAAmD;AACnD,2CAA2C;AAC3C,iEAAiE;AAEjE,8EAA8E;AAC9E,yDAAyD;AACzD,2DAA2D;AAC3D,wBAAwB;AACxB,oCAAoC;AACpC,oBAAoB;AACpB,uBAAuB;AACvB,YAAY;AAEZ,qCAAqC;AACrC,QAAQ;AACR,IAAI;AAGJ,oBAAoB;AACpB,iBAAiB;AACjB,sFAAsF;AAEtF,0FAA0F;AAE1F,2EAA2E;AAE3E,0EAA0E;AAC1E,QAAQ"}
|
|
File without changes
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class"
|
|
3
|
-
// export type A_TYPES__A_DependencyReferenceConstructor = {
|
|
4
|
-
// /**
|
|
5
|
-
// * The name of the dependency
|
|
6
|
-
// */
|
|
7
|
-
// name: string
|
|
8
|
-
// /**
|
|
9
|
-
// * The version of the module
|
|
10
|
-
// * By default it is 1.0.0
|
|
11
|
-
// */
|
|
12
|
-
// version: string
|
|
13
|
-
// /**
|
|
14
|
-
// * The dependencies of the module
|
|
15
|
-
// * Could be:
|
|
16
|
-
// * - other Modules
|
|
17
|
-
// * - other Contexts
|
|
18
|
-
// *
|
|
19
|
-
// */
|
|
20
|
-
// dependencies: Array<typeof A_Namespace>
|
|
21
|
-
// /**
|
|
22
|
-
// * The source of the dependency
|
|
23
|
-
// * Could be:
|
|
24
|
-
// * - a string representing the path to the module
|
|
25
|
-
// * - a module class (in case when config should be provided via the module constructor)
|
|
26
|
-
// * - a module class constructor
|
|
27
|
-
// * - a context class (in case when config should be provided via the context constructor)
|
|
28
|
-
// * - a context class constructor
|
|
29
|
-
// *
|
|
30
|
-
// */
|
|
31
|
-
// // source: A_Module | A_Context | typeof A_Module | typeof A_Context | string
|
|
32
|
-
// source: A_Namespace
|
|
33
|
-
// }
|
|
34
|
-
// export type A_TYPES__A_DependencyReferenceConstructorConfig = {
|
|
35
|
-
// /**
|
|
36
|
-
// * Sync - blocks A-Express Application initialization until module is ready
|
|
37
|
-
// * Async - allows to initialize module after A-Express Application initialization
|
|
38
|
-
// */
|
|
39
|
-
// behavior: 'async' | 'sync',
|
|
40
|
-
// /**
|
|
41
|
-
// * Allows to define a scheme of retries
|
|
42
|
-
// */
|
|
43
|
-
// retries: {
|
|
44
|
-
// /**
|
|
45
|
-
// * The number of retries
|
|
46
|
-
// * Default is 3
|
|
47
|
-
// */
|
|
48
|
-
// n: number,
|
|
49
|
-
// /**
|
|
50
|
-
// * The timeout between retries
|
|
51
|
-
// * Multiplied by the number of retries
|
|
52
|
-
// * So after each retry the timeout is increased e.g. 1000ms * 1, 1000ms * 2, 1000ms * 3
|
|
53
|
-
// * Default is 1000
|
|
54
|
-
// */
|
|
55
|
-
// timeout: number
|
|
56
|
-
// }
|
|
57
|
-
// }
|
|
58
|
-
//# sourceMappingURL=A-DependencyReference.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-DependencyReference.types.js","sourceRoot":"","sources":["../../../../src/global/A-Dependency/A-DependencyReference.types.ts"],"names":[],"mappings":";AAAA,sFAAsF;AAGtF,4DAA4D;AAC5D,UAAU;AACV,qCAAqC;AACrC,UAAU;AACV,mBAAmB;AACnB,UAAU;AACV,oCAAoC;AACpC,gCAAgC;AAChC,UAAU;AACV,sBAAsB;AACtB,UAAU;AACV,yCAAyC;AACzC,mBAAmB;AACnB,yBAAyB;AACzB,0BAA0B;AAC1B,UAAU;AACV,UAAU;AACV,8CAA8C;AAC9C,UAAU;AACV,uCAAuC;AACvC,mBAAmB;AACnB,wDAAwD;AACxD,+FAA+F;AAC/F,sCAAsC;AACtC,gGAAgG;AAChG,uCAAuC;AACvC,UAAU;AACV,UAAU;AACV,oFAAoF;AACpF,0BAA0B;AAC1B,IAAI;AAGJ,kEAAkE;AAClE,UAAU;AACV,oFAAoF;AACpF,wFAAwF;AACxF,UAAU;AACV,kCAAkC;AAElC,UAAU;AACV,8CAA8C;AAC9C,UAAU;AACV,iBAAiB;AACjB,cAAc;AACd,mCAAmC;AACnC,0BAA0B;AAC1B,cAAc;AACd,qBAAqB;AACrB,cAAc;AACd,yCAAyC;AACzC,kDAAkD;AAClD,kGAAkG;AAClG,6BAA6B;AAC7B,cAAc;AACd,0BAA0B;AAC1B,QAAQ;AACR,IAAI"}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__Entity_Serialized, A_TYPES__Entity_Init, A_TYPES__IEntity } from "./A-Entity.types";
|
|
2
|
-
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
3
|
-
import { ASEID } from "../ASEID/ASEID.class";
|
|
4
|
-
/**
|
|
5
|
-
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
6
|
-
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
7
|
-
* However, entity may hide some of its responsibilities behind the interface to prevent overload.
|
|
8
|
-
*
|
|
9
|
-
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
10
|
-
*/
|
|
11
|
-
export declare class A_Entity<_ConstructorType extends A_TYPES__Entity_Init = A_TYPES__Entity_Init, _SerializedType extends A_TYPES__Entity_Serialized = A_TYPES__Entity_Serialized> implements A_TYPES__IEntity {
|
|
12
|
-
/**
|
|
13
|
-
* Entity Identifier that corresponds to the class name
|
|
14
|
-
*/
|
|
15
|
-
static get entity(): string;
|
|
16
|
-
/**
|
|
17
|
-
* DEFAULT Concept Name (Application Name) of the entity from environment variable A_CONCEPT_NAME
|
|
18
|
-
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
19
|
-
*/
|
|
20
|
-
static get concept(): string;
|
|
21
|
-
/**
|
|
22
|
-
* DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
|
|
23
|
-
* [!] If environment variable is not set, it will default to 'core'
|
|
24
|
-
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
25
|
-
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
26
|
-
*/
|
|
27
|
-
static get scope(): string;
|
|
28
|
-
/**
|
|
29
|
-
* ASEID is an entity identifier that is unique across the system
|
|
30
|
-
* A - A_Concept or Application
|
|
31
|
-
* S - System or Scope
|
|
32
|
-
* E - Entity
|
|
33
|
-
* ID - Identifier
|
|
34
|
-
*
|
|
35
|
-
* [!] ASEID is immutable and should not be changed after the entity is created
|
|
36
|
-
*
|
|
37
|
-
* [!] ASEID is composed of the following parts:
|
|
38
|
-
* - concept: an application specific identifier from where the entity is coming from
|
|
39
|
-
* - scope: the scope of the entity from concept
|
|
40
|
-
* - entity: the name of the entity from concept
|
|
41
|
-
* - id: the unique identifier of the entity
|
|
42
|
-
*
|
|
43
|
-
* [!] For more information about ASEID, please refer to the ASEID class documentation]
|
|
44
|
-
*/
|
|
45
|
-
aseid: ASEID;
|
|
46
|
-
/**
|
|
47
|
-
* Create a new A_entity instance from Aseid String
|
|
48
|
-
* e.g. project@scope:entity:0000000001
|
|
49
|
-
*
|
|
50
|
-
* @param aseid
|
|
51
|
-
*/
|
|
52
|
-
constructor(
|
|
53
|
-
/**
|
|
54
|
-
* ASEID string that represents the entity
|
|
55
|
-
*/
|
|
56
|
-
aseid?: string);
|
|
57
|
-
/**
|
|
58
|
-
* Create a new A_entity instance from Aseid instance
|
|
59
|
-
* e.g. new ASEID({concept: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
|
|
60
|
-
*
|
|
61
|
-
* @param aseid
|
|
62
|
-
*/
|
|
63
|
-
constructor(
|
|
64
|
-
/**
|
|
65
|
-
* ASEID instance that represents the entity
|
|
66
|
-
*/
|
|
67
|
-
aseid: ASEID);
|
|
68
|
-
/**
|
|
69
|
-
* Create a new A_entity instance from serialized object
|
|
70
|
-
*
|
|
71
|
-
* @param serialized
|
|
72
|
-
*/
|
|
73
|
-
constructor(
|
|
74
|
-
/**
|
|
75
|
-
* Serialized object that represents the entity
|
|
76
|
-
*/
|
|
77
|
-
serialized: _SerializedType);
|
|
78
|
-
/**
|
|
79
|
-
* Create a new A_entity instance from constructor object
|
|
80
|
-
*
|
|
81
|
-
* @param newEntity
|
|
82
|
-
*/
|
|
83
|
-
constructor(
|
|
84
|
-
/**
|
|
85
|
-
* Constructor object that represents the entity
|
|
86
|
-
*/
|
|
87
|
-
newEntity?: _ConstructorType);
|
|
88
|
-
/**
|
|
89
|
-
* Extracts the ID from the ASEID
|
|
90
|
-
* ID is the unique identifier of the entity
|
|
91
|
-
*/
|
|
92
|
-
get id(): string | number;
|
|
93
|
-
protected isStringASEID(x: unknown): x is string;
|
|
94
|
-
protected isASEIDInstance(x: unknown): x is ASEID;
|
|
95
|
-
/**
|
|
96
|
-
* A "serialized" object is considered such if it is a non-null object
|
|
97
|
-
* and contains an "aseid" property (this mirrors your original check).
|
|
98
|
-
*
|
|
99
|
-
* @param x
|
|
100
|
-
* @returns
|
|
101
|
-
*/
|
|
102
|
-
protected isSerializedObject(x: unknown): x is _SerializedType;
|
|
103
|
-
/**
|
|
104
|
-
* Constructor-style props = a plain object which does NOT contain "aseid".
|
|
105
|
-
* This is the "create from provided fields" case.
|
|
106
|
-
*
|
|
107
|
-
* @param x
|
|
108
|
-
* @returns
|
|
109
|
-
*/
|
|
110
|
-
protected isConstructorProps(x: unknown): x is _ConstructorType;
|
|
111
|
-
/**
|
|
112
|
-
* Determines the appropriate initializer method based on the type of `props`.
|
|
113
|
-
* The method checks if `props` is:
|
|
114
|
-
* 1) a string that matches ASEID format -> fromASEID
|
|
115
|
-
* 2) an ASEID instance -> fromASEID
|
|
116
|
-
* 3) a serialized object (has 'aseid') -> fromJSON
|
|
117
|
-
* 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
118
|
-
*
|
|
119
|
-
* [!] If `props` is undefined, it will call fromUndefined method
|
|
120
|
-
*
|
|
121
|
-
* If none of the above, it throws an error indicating incorrect constructor usage.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* To get a custom initializer, override this method in the child class.
|
|
125
|
-
* Example:
|
|
126
|
-
* ```typescript
|
|
127
|
-
* protected getInitializer(
|
|
128
|
-
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
129
|
-
* ): (props: any) => void | (() => void) {
|
|
130
|
-
* if('customField' in props) {
|
|
131
|
-
* return this.fromCustomField.bind(this);
|
|
132
|
-
* }
|
|
133
|
-
* return super.getInitializer(props);
|
|
134
|
-
* }
|
|
135
|
-
* ```
|
|
136
|
-
* @param props
|
|
137
|
-
* @returns The appropriate initializer method
|
|
138
|
-
*/
|
|
139
|
-
protected getInitializer(props?: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void | (() => void);
|
|
140
|
-
/**
|
|
141
|
-
* Call a feature of the component with the provided scope
|
|
142
|
-
*
|
|
143
|
-
* [!] If the provided scope is not inherited from the entity scope, it will be inherited
|
|
144
|
-
*
|
|
145
|
-
* @param lifecycleMethod
|
|
146
|
-
* @param args
|
|
147
|
-
*/
|
|
148
|
-
call(feature: string, scope?: A_Scope): Promise<void>;
|
|
149
|
-
/**
|
|
150
|
-
* The default method that can be called and extended to load entity data.
|
|
151
|
-
*/
|
|
152
|
-
load(scope?: A_Scope): Promise<void>;
|
|
153
|
-
/**
|
|
154
|
-
* The default method that can be called and extended to destroy entity data.
|
|
155
|
-
*/
|
|
156
|
-
destroy(scope?: A_Scope): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* The default method that can be called and extended to save entity data.
|
|
159
|
-
*/
|
|
160
|
-
save(scope?: A_Scope): Promise<void>;
|
|
161
|
-
/**
|
|
162
|
-
* Create a new entity from ASEID string or instance
|
|
163
|
-
* [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
|
|
164
|
-
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
165
|
-
*
|
|
166
|
-
* @param aseid
|
|
167
|
-
*/
|
|
168
|
-
fromASEID(aseid: string | ASEID): void;
|
|
169
|
-
/**
|
|
170
|
-
* Handles the case when no props are provided to the constructor.
|
|
171
|
-
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
172
|
-
* By default, it does nothing.
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @returns
|
|
176
|
-
*/
|
|
177
|
-
fromUndefined(): void;
|
|
178
|
-
/**
|
|
179
|
-
* Create a new entity from constructor object
|
|
180
|
-
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
181
|
-
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
182
|
-
*
|
|
183
|
-
* @param newEntity
|
|
184
|
-
* @returns
|
|
185
|
-
*/
|
|
186
|
-
fromNew(newEntity: _ConstructorType): void;
|
|
187
|
-
/**
|
|
188
|
-
* Creates a new entity from serialized object
|
|
189
|
-
*
|
|
190
|
-
* [!] Executed when the constructor is called with an object that contains "aseid" property
|
|
191
|
-
* [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* @param serialized
|
|
195
|
-
* @returns
|
|
196
|
-
*/
|
|
197
|
-
fromJSON(serialized: _SerializedType): void;
|
|
198
|
-
/**
|
|
199
|
-
* Converts the entity to a JSON object
|
|
200
|
-
* [!] This method should be extended in the child classes to include all properties of the entity
|
|
201
|
-
* [!] Includes aseid by default
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* @returns
|
|
205
|
-
*/
|
|
206
|
-
toJSON(): _SerializedType;
|
|
207
|
-
/**
|
|
208
|
-
* Returns the string representation of the entity
|
|
209
|
-
* what is basically the ASEID string
|
|
210
|
-
*
|
|
211
|
-
* @returns
|
|
212
|
-
*/
|
|
213
|
-
toString(): string;
|
|
214
|
-
}
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.A_Entity = void 0;
|
|
13
|
-
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
14
|
-
const A_Formatter_helper_1 = require("../../helpers/A_Formatter.helper");
|
|
15
|
-
const ASEID_class_1 = require("../ASEID/ASEID.class");
|
|
16
|
-
const A_Identity_helper_1 = require("../../helpers/A_Identity.helper");
|
|
17
|
-
const A_Entity_error_1 = require("./A-Entity.error");
|
|
18
|
-
const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
19
|
-
/**
|
|
20
|
-
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
21
|
-
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
22
|
-
* However, entity may hide some of its responsibilities behind the interface to prevent overload.
|
|
23
|
-
*
|
|
24
|
-
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
25
|
-
*/
|
|
26
|
-
class A_Entity {
|
|
27
|
-
// ====================================================================
|
|
28
|
-
// ================== Static A-Entity Information ============================
|
|
29
|
-
// ====================================================================
|
|
30
|
-
/**
|
|
31
|
-
* Entity Identifier that corresponds to the class name
|
|
32
|
-
*/
|
|
33
|
-
static get entity() {
|
|
34
|
-
return A_Formatter_helper_1.A_FormatterHelper.toKebabCase(this.name);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* DEFAULT Concept Name (Application Name) of the entity from environment variable A_CONCEPT_NAME
|
|
38
|
-
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
39
|
-
*/
|
|
40
|
-
static get concept() {
|
|
41
|
-
return A_Context_class_1.A_Context.concept;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
|
|
45
|
-
* [!] If environment variable is not set, it will default to 'core'
|
|
46
|
-
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
47
|
-
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
48
|
-
*/
|
|
49
|
-
static get scope() {
|
|
50
|
-
return A_Context_class_1.A_Context.root.name;
|
|
51
|
-
}
|
|
52
|
-
constructor(props) {
|
|
53
|
-
const initializer = this.getInitializer(props);
|
|
54
|
-
// the returned initializer is already bound to `this` (we used .bind(this)),
|
|
55
|
-
// so calling it will run the appropriate logic on this instance:
|
|
56
|
-
initializer.call(this, props);
|
|
57
|
-
}
|
|
58
|
-
// ====================================================================
|
|
59
|
-
// ================== DUPLICATED ASEID Getters ========================
|
|
60
|
-
// ====================================================================
|
|
61
|
-
/**
|
|
62
|
-
* Extracts the ID from the ASEID
|
|
63
|
-
* ID is the unique identifier of the entity
|
|
64
|
-
*/
|
|
65
|
-
get id() {
|
|
66
|
-
return this.aseid.id;
|
|
67
|
-
}
|
|
68
|
-
// ====================================================================
|
|
69
|
-
// ================== Constructor Helpers =============================
|
|
70
|
-
// ====================================================================
|
|
71
|
-
// --- Type guards used to classify `props` properly ---
|
|
72
|
-
isStringASEID(x) {
|
|
73
|
-
return typeof x === "string" && ASEID_class_1.ASEID.isASEID(x);
|
|
74
|
-
}
|
|
75
|
-
isASEIDInstance(x) {
|
|
76
|
-
return x instanceof ASEID_class_1.ASEID;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A "serialized" object is considered such if it is a non-null object
|
|
80
|
-
* and contains an "aseid" property (this mirrors your original check).
|
|
81
|
-
*
|
|
82
|
-
* @param x
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
isSerializedObject(x) {
|
|
86
|
-
return !!x && typeof x === "object" && "aseid" in x;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Constructor-style props = a plain object which does NOT contain "aseid".
|
|
90
|
-
* This is the "create from provided fields" case.
|
|
91
|
-
*
|
|
92
|
-
* @param x
|
|
93
|
-
* @returns
|
|
94
|
-
*/
|
|
95
|
-
isConstructorProps(x) {
|
|
96
|
-
return !!x && typeof x === "object" && !("aseid" in x);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Determines the appropriate initializer method based on the type of `props`.
|
|
100
|
-
* The method checks if `props` is:
|
|
101
|
-
* 1) a string that matches ASEID format -> fromASEID
|
|
102
|
-
* 2) an ASEID instance -> fromASEID
|
|
103
|
-
* 3) a serialized object (has 'aseid') -> fromJSON
|
|
104
|
-
* 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
105
|
-
*
|
|
106
|
-
* [!] If `props` is undefined, it will call fromUndefined method
|
|
107
|
-
*
|
|
108
|
-
* If none of the above, it throws an error indicating incorrect constructor usage.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* To get a custom initializer, override this method in the child class.
|
|
112
|
-
* Example:
|
|
113
|
-
* ```typescript
|
|
114
|
-
* protected getInitializer(
|
|
115
|
-
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
116
|
-
* ): (props: any) => void | (() => void) {
|
|
117
|
-
* if('customField' in props) {
|
|
118
|
-
* return this.fromCustomField.bind(this);
|
|
119
|
-
* }
|
|
120
|
-
* return super.getInitializer(props);
|
|
121
|
-
* }
|
|
122
|
-
* ```
|
|
123
|
-
* @param props
|
|
124
|
-
* @returns The appropriate initializer method
|
|
125
|
-
*/
|
|
126
|
-
getInitializer(props) {
|
|
127
|
-
if (!props) {
|
|
128
|
-
return this.fromUndefined;
|
|
129
|
-
}
|
|
130
|
-
// 1) string that matches ASEID format -> fromASEID
|
|
131
|
-
if (this.isStringASEID(props)) {
|
|
132
|
-
return this.fromASEID;
|
|
133
|
-
}
|
|
134
|
-
// 2) ASEID instance -> fromASEID
|
|
135
|
-
if (this.isASEIDInstance(props)) {
|
|
136
|
-
return this.fromASEID;
|
|
137
|
-
}
|
|
138
|
-
// 3) serialized object (has 'aseid') -> fromJSON
|
|
139
|
-
if (this.isSerializedObject(props)) {
|
|
140
|
-
return this.fromJSON;
|
|
141
|
-
}
|
|
142
|
-
// 4) plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
143
|
-
if (this.isConstructorProps(props)) {
|
|
144
|
-
return this.fromNew;
|
|
145
|
-
}
|
|
146
|
-
// none of the above -> throw consistent error
|
|
147
|
-
throw new A_Entity_error_1.A_Entity_Error(A_Entity_error_1.A_Entity_Error.ValidationError, 'Unable to determine A-Entity constructor initialization method. Please check the provided parameters.');
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Call a feature of the component with the provided scope
|
|
151
|
-
*
|
|
152
|
-
* [!] If the provided scope is not inherited from the entity scope, it will be inherited
|
|
153
|
-
*
|
|
154
|
-
* @param lifecycleMethod
|
|
155
|
-
* @param args
|
|
156
|
-
*/
|
|
157
|
-
call(feature, scope) {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
const newFeature = new A_Feature_class_1.A_Feature({
|
|
160
|
-
name: feature,
|
|
161
|
-
component: this
|
|
162
|
-
});
|
|
163
|
-
return yield newFeature.process(scope);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
// ====================================================================
|
|
167
|
-
// ================== Entity Base Methods =============================
|
|
168
|
-
// ====================================================================
|
|
169
|
-
/**
|
|
170
|
-
* The default method that can be called and extended to load entity data.
|
|
171
|
-
*/
|
|
172
|
-
load(scope) {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
return this.call('load', scope);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* The default method that can be called and extended to destroy entity data.
|
|
179
|
-
*/
|
|
180
|
-
destroy(scope) {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
return this.call('destroy', scope);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* The default method that can be called and extended to save entity data.
|
|
187
|
-
*/
|
|
188
|
-
save(scope) {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
-
return this.call('save', scope);
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
// ====================================================================
|
|
194
|
-
// ================== Entity Serialization ============================
|
|
195
|
-
// ====================================================================
|
|
196
|
-
/**
|
|
197
|
-
* Create a new entity from ASEID string or instance
|
|
198
|
-
* [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
|
|
199
|
-
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
200
|
-
*
|
|
201
|
-
* @param aseid
|
|
202
|
-
*/
|
|
203
|
-
fromASEID(aseid) {
|
|
204
|
-
if (aseid instanceof ASEID_class_1.ASEID)
|
|
205
|
-
this.aseid = aseid;
|
|
206
|
-
else
|
|
207
|
-
this.aseid = new ASEID_class_1.ASEID(aseid);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Handles the case when no props are provided to the constructor.
|
|
211
|
-
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
212
|
-
* By default, it does nothing.
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* @returns
|
|
216
|
-
*/
|
|
217
|
-
fromUndefined() {
|
|
218
|
-
this.aseid = new ASEID_class_1.ASEID({
|
|
219
|
-
concept: this.constructor.concept,
|
|
220
|
-
scope: this.constructor.scope,
|
|
221
|
-
entity: this.constructor.entity,
|
|
222
|
-
id: A_Identity_helper_1.A_IdentityHelper.generateTimeId()
|
|
223
|
-
});
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Create a new entity from constructor object
|
|
228
|
-
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
229
|
-
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
230
|
-
*
|
|
231
|
-
* @param newEntity
|
|
232
|
-
* @returns
|
|
233
|
-
*/
|
|
234
|
-
fromNew(newEntity) {
|
|
235
|
-
this.aseid = new ASEID_class_1.ASEID({
|
|
236
|
-
concept: this.constructor.concept,
|
|
237
|
-
scope: this.constructor.scope,
|
|
238
|
-
entity: this.constructor.entity,
|
|
239
|
-
id: A_Identity_helper_1.A_IdentityHelper.generateTimeId()
|
|
240
|
-
});
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Creates a new entity from serialized object
|
|
245
|
-
*
|
|
246
|
-
* [!] Executed when the constructor is called with an object that contains "aseid" property
|
|
247
|
-
* [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @param serialized
|
|
251
|
-
* @returns
|
|
252
|
-
*/
|
|
253
|
-
fromJSON(serialized) {
|
|
254
|
-
this.aseid = new ASEID_class_1.ASEID(serialized.aseid);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Converts the entity to a JSON object
|
|
259
|
-
* [!] This method should be extended in the child classes to include all properties of the entity
|
|
260
|
-
* [!] Includes aseid by default
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @returns
|
|
264
|
-
*/
|
|
265
|
-
toJSON() {
|
|
266
|
-
return {
|
|
267
|
-
aseid: this.aseid.toString()
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Returns the string representation of the entity
|
|
272
|
-
* what is basically the ASEID string
|
|
273
|
-
*
|
|
274
|
-
* @returns
|
|
275
|
-
*/
|
|
276
|
-
toString() {
|
|
277
|
-
return this.aseid ? this.aseid.toString() : this.constructor.name;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
exports.A_Entity = A_Entity;
|
|
281
|
-
//# sourceMappingURL=A-Entity.class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,kEAAyD;AAEzD,oFAAgF;AAChF,sDAA6C;AAC7C,kFAA8E;AAC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