@adaas/a-concept 0.0.56 → 0.0.58
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/.nvmrc +1 -1
- package/dist/src/base/A-Command/A_Command.constants.d.ts +12 -0
- package/dist/src/base/A-Command/A_Command.constants.js +17 -0
- package/dist/src/base/A-Command/A_Command.constants.js.map +1 -0
- package/dist/src/base/A-Command/A_Command.entity.d.ts +123 -0
- package/dist/src/base/A-Command/A_Command.entity.js +259 -0
- package/dist/src/base/A-Command/A_Command.entity.js.map +1 -0
- package/dist/src/base/A-Command/A_Command.types.d.ts +15 -0
- package/dist/src/base/A-Command/A_Command.types.js +3 -0
- package/dist/src/base/A-Command/A_Command.types.js.map +1 -0
- package/dist/src/base/A-Command/context/A_Command.context.d.ts +64 -0
- package/dist/src/base/A-Command/context/A_Command.context.js +85 -0
- package/dist/src/base/A-Command/context/A_Command.context.js.map +1 -0
- package/dist/src/base/A-Command/context/A_CommandFactory.context.js +2 -0
- package/dist/src/base/A-Command/context/A_CommandFactory.context.js.map +1 -0
- package/dist/src/base/A-Config/A-Config.container.d.ts +1 -2
- package/dist/src/base/A-Config/A-Config.container.js +2 -4
- package/dist/src/base/A-Config/A-Config.container.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.context.d.ts +10 -11
- package/dist/src/base/A-Config/A-Config.context.js +5 -24
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.types.d.ts +4 -4
- package/dist/src/base/A-Config/A-Config.types.js.map +1 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js +6 -12
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -1
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js +5 -1
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +1 -1
- package/dist/src/constants/env.constants.d.ts +26 -0
- package/dist/src/constants/env.constants.js +40 -0
- package/dist/src/constants/env.constants.js.map +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +3 -3
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +9 -10
- package/dist/src/global/A-Channel/A-Channel.class.d.ts +2 -0
- package/dist/src/global/A-Channel/A-Channel.class.js +2 -0
- package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +5 -3
- package/dist/src/global/A-Concept/A_Concept.class.js +32 -27
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.meta.d.ts +1 -8
- package/dist/src/global/A-Concept/A_Concept.meta.js +1 -25
- package/dist/src/global/A-Concept/A_Concept.meta.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +10 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +5 -0
- package/dist/src/global/A-Container/A-Container.class.js +5 -0
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +23 -1
- package/dist/src/global/A-Context/A-Context.class.js +38 -1
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +124 -23
- package/dist/src/global/A-Entity/A-Entity.class.js +159 -49
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +7 -6
- package/dist/src/global/A-Scope/A-Scope.class.js +57 -20
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +3 -2
- package/dist/src/global/A-Stage/A-Stage.class.js +9 -6
- package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +1 -1
- package/dist/src/helpers/StepsManager.class.js +1 -1
- package/dist/src/helpers/StepsManager.class.js.map +1 -1
- package/examples/simple/components/A.component.ts +9 -2
- package/examples/simple/concept.ts +6 -0
- package/examples/simple/entities/EntityA.entity.ts +18 -0
- package/jest.config.ts +1 -1
- package/package.json +3 -3
- package/src/base/A-Command/A_Command.constants.ts +20 -0
- package/src/base/A-Command/A_Command.entity.ts +287 -0
- package/src/base/A-Command/A_Command.types.ts +34 -0
- package/src/base/A-Command/context/A_Command.context.ts +114 -0
- package/src/base/A-Command/context/A_CommandFactory.context.ts +0 -0
- package/src/base/A-Config/A-Config.container.ts +0 -1
- package/src/base/A-Config/A-Config.context.ts +22 -28
- package/src/base/A-Config/A-Config.types.ts +5 -24
- package/src/base/A-Config/components/ConfigReader.component.ts +6 -15
- package/src/base/A-Config/components/ENVConfigReader.component.ts +6 -1
- package/src/constants/env.constants.ts +44 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +3 -3
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +10 -9
- package/src/global/A-Channel/A-Channel.class.ts +2 -0
- package/src/global/A-Concept/A_Concept.class.ts +49 -32
- package/src/global/A-Concept/A_Concept.meta.ts +3 -41
- package/src/global/A-Concept/A_Concept.types.ts +6 -4
- package/src/global/A-Container/A-Container.class.ts +5 -2
- package/src/global/A-Context/A-Context.class.ts +67 -8
- package/src/global/A-Entity/A-Entity.class.ts +203 -73
- package/src/global/A-Scope/A-Scope.class.ts +88 -39
- package/src/global/A-Stage/A-Stage.class.ts +11 -7
- package/src/global/A-Stage/A-Stage.types.ts +1 -1
- package/src/helpers/StepsManager.class.ts +2 -2
- package/tests/A-Command.test.ts +130 -0
- package/tests/A-Component.test.ts +25 -0
- package/tests/A-Config.test.ts +106 -0
- package/tests/A-Entity.test.ts +191 -0
- package/tests/A-Feature.test.ts +131 -0
- package/tests/A-Scope.test.ts +163 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.js +0 -11
- package/dist/src/constants/A_ConceptLifecycle.constants.js.map +0 -1
- package/src/constants/A_ConceptLifecycle.constants.ts +0 -12
- package/tests/channel.ts +0 -213
- package/tests/context.test.ts +0 -124
- package/tests/default.test.ts +0 -159
- package/tests/log.ts +0 -102
- package/tests/polyfill.test.ts +0 -37
- /package/dist/src/{constants/A_ConceptLifecycle.constants.d.ts → base/A-Command/context/A_CommandFactory.context.d.ts} +0 -0
|
@@ -17,7 +17,7 @@ export declare enum A_TYPES__ConceptMetaKey {
|
|
|
17
17
|
LIFECYCLE = "a-component-extensions"
|
|
18
18
|
}
|
|
19
19
|
export interface A_TYPES__IConceptConstructor<T extends Array<A_Container>> {
|
|
20
|
-
name
|
|
20
|
+
name?: string;
|
|
21
21
|
/**
|
|
22
22
|
* A set of Context Fragments to register globally for the concept.
|
|
23
23
|
* These fragments will be available in the global context.
|
|
@@ -34,6 +34,15 @@ export interface A_TYPES__IConceptConstructor<T extends Array<A_Container>> {
|
|
|
34
34
|
* These components will be used in the concept.
|
|
35
35
|
*/
|
|
36
36
|
entities?: Array<A_Entity>;
|
|
37
|
+
/**
|
|
38
|
+
* A set of Components available for all containers and fragments in the concept.
|
|
39
|
+
* These components will be registered in the root scope of the concept.
|
|
40
|
+
*
|
|
41
|
+
* [!] Note that these components will be available in all containers and fragments in the concept.
|
|
42
|
+
*/
|
|
43
|
+
components?: Array<{
|
|
44
|
+
new (...args: any[]): A_Component;
|
|
45
|
+
}>;
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
48
|
* Uses as a transfer object to pass configurations to Feature constructor
|
|
@@ -20,6 +20,11 @@ export declare class A_Container {
|
|
|
20
20
|
ready: Promise<void>;
|
|
21
21
|
get name(): string;
|
|
22
22
|
get Scope(): A_Scope;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new instance of A_Container
|
|
25
|
+
*
|
|
26
|
+
* @param config
|
|
27
|
+
*/
|
|
23
28
|
constructor(
|
|
24
29
|
/**
|
|
25
30
|
* Configuration of the container that will be used to run it.
|
|
@@ -29,6 +29,11 @@ class A_Container {
|
|
|
29
29
|
get Scope() {
|
|
30
30
|
return A_Context_class_1.A_Context.scope(this);
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new instance of A_Container
|
|
34
|
+
*
|
|
35
|
+
* @param config
|
|
36
|
+
*/
|
|
32
37
|
constructor(
|
|
33
38
|
/**
|
|
34
39
|
* Configuration of the container that will be used to run it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kEAAyD;AAMzD;;;;;;;;;;GAUG;AACH,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kEAAyD;AAMzD;;;;;;;;;;GAUG;AACH,MAAa,WAAW;IAQpB,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,IAAI,KAAK;QACL,OAAO,2BAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAGD;;;;OAIG;IACH;IACI;;OAEG;IACH,MAAmD;QAEnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,2BAAS,CAAC,QAAQ,CAAC,IAAI,kBACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IACZ,MAAM,EACX,CAAC;IACP,CAAC;IAGK,IAAI;6DACN,OAAe,EACf,QAAiB,IAAI,CAAC,KAAK;YAG3B,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;YAGD,MAAM,UAAU,GAAG,2BAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAE3D,OAAO,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;KAAA;IAGD;;;;OAIG;IACH,OAAO,CACH,OAAe,EACf,QAAiB,IAAI,CAAC,KAAK;QAG3B,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,2BAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAGD,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IAEjE;;;;OAIG;IACa,YAAY;;YACxB,OAAO;QACX,CAAC;KAAA;IAED;;OAEG;IACa,MAAM;;YAClB,OAAO;QACX,CAAC;KAAA;IAED;;;;OAIG;IACa,WAAW;;YACvB,OAAO;QACX,CAAC;KAAA;CAEJ;AApGD,kCAoGC"}
|
|
@@ -58,15 +58,33 @@ export declare class A_Context {
|
|
|
58
58
|
static allocate(feature: A_Feature, importing: Partial<A_TYPES__ScopeConstructor & A_TYPES__ScopeConfig> | A_Scope): A_Scope;
|
|
59
59
|
static allocate(container: A_Container, importing: Partial<A_TYPES__ScopeConstructor & A_TYPES__ScopeConfig>): A_Scope;
|
|
60
60
|
static allocate(container: A_Container, importing: A_Scope): A_Scope;
|
|
61
|
+
/**
|
|
62
|
+
* Get or Create Meta for the specific class or instance.
|
|
63
|
+
* This method will return the existing meta if it exists, or create a new one if it doesn't.
|
|
64
|
+
*
|
|
65
|
+
* Meta object contains custom metadata based on the class type.
|
|
66
|
+
*
|
|
67
|
+
* @param container
|
|
68
|
+
*/
|
|
61
69
|
static meta(container: typeof A_Container): A_ContainerMeta;
|
|
62
70
|
static meta(container: A_Container): A_ContainerMeta;
|
|
63
71
|
static meta(entity: A_Entity): A_ContainerMeta;
|
|
64
72
|
static meta(entity: typeof A_Entity): A_ContainerMeta;
|
|
73
|
+
static meta(component: string): A_ComponentMeta;
|
|
65
74
|
static meta(component: typeof A_Component): A_ComponentMeta;
|
|
66
75
|
static meta(component: A_Component): A_ComponentMeta;
|
|
67
76
|
static meta<T extends Record<string, any>>(constructor: typeof A_Component | typeof A_Container | A_Container | A_Component | A_Entity | typeof A_Entity | {
|
|
68
77
|
new (...args: any[]): any;
|
|
69
|
-
}): A_Meta<T>;
|
|
78
|
+
} | string): A_Meta<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Get the scope of the specific class or instance.
|
|
81
|
+
*
|
|
82
|
+
* Every execution in Concept has its own scope.
|
|
83
|
+
*
|
|
84
|
+
* This method will return the scope of the specific class or instance.
|
|
85
|
+
*
|
|
86
|
+
* @param entity
|
|
87
|
+
*/
|
|
70
88
|
static scope(entity: A_Entity): A_Scope;
|
|
71
89
|
static scope(component: A_Component): A_Scope;
|
|
72
90
|
static scope(container: A_Container): A_Scope;
|
|
@@ -108,4 +126,8 @@ export declare class A_Context {
|
|
|
108
126
|
static register(scope: A_Scope, entity: A_Entity): any;
|
|
109
127
|
static register(scope: A_Scope, component: A_Component): any;
|
|
110
128
|
static register(scope: A_Scope, fragment: A_Fragment): any;
|
|
129
|
+
/**
|
|
130
|
+
* Resets the Context to its initial state.
|
|
131
|
+
*/
|
|
132
|
+
static reset(): void;
|
|
111
133
|
}
|
|
@@ -15,6 +15,7 @@ const A_Entity_class_1 = require("../A-Entity/A-Entity.class");
|
|
|
15
15
|
const A_Entity_meta_1 = require("../A-Entity/A-Entity.meta");
|
|
16
16
|
const A_Container_types_1 = require("../A-Container/A-Container.types");
|
|
17
17
|
const A_Component_types_1 = require("../A-Component/A-Component.types");
|
|
18
|
+
const env_constants_1 = require("../../constants/env.constants");
|
|
18
19
|
/**
|
|
19
20
|
* Namespace Provider is responsible for providing the Namespace to the Containers and other Namespaces.
|
|
20
21
|
* This class stores all Namespaces across the Program.
|
|
@@ -45,7 +46,7 @@ class A_Context {
|
|
|
45
46
|
// uses to allow to store custom meta data
|
|
46
47
|
this.customMeta = new Map();
|
|
47
48
|
this._root = new A_Scope_class_1.A_Scope({
|
|
48
|
-
name: '
|
|
49
|
+
name: process && process.env ? process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_NAMESPACE] || 'a-concept' : 'a-concept'
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
// ===================================================================================================
|
|
@@ -71,6 +72,9 @@ class A_Context {
|
|
|
71
72
|
static allocate(param1, param2) {
|
|
72
73
|
const instance = this.getInstance();
|
|
73
74
|
const newScope = param2 instanceof A_Scope_class_1.A_Scope ? param2 : new A_Scope_class_1.A_Scope(param2, param2);
|
|
75
|
+
if (!newScope.isInheritedFrom(A_Context.root)) {
|
|
76
|
+
newScope.inherit(A_Context.root);
|
|
77
|
+
}
|
|
74
78
|
switch (true) {
|
|
75
79
|
case param1 instanceof A_Container_class_1.A_Container:
|
|
76
80
|
instance.containers.set(param1, newScope);
|
|
@@ -89,42 +93,59 @@ class A_Context {
|
|
|
89
93
|
let property;
|
|
90
94
|
let metaType;
|
|
91
95
|
switch (true) {
|
|
96
|
+
// 1) If param1 is instance of A_Container
|
|
92
97
|
case param1 instanceof A_Container_class_1.A_Container: {
|
|
93
98
|
metaStorage = instance.containersMeta;
|
|
94
99
|
property = param1.constructor;
|
|
95
100
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
96
101
|
break;
|
|
97
102
|
}
|
|
103
|
+
// 2) If param1 is class of A_Container
|
|
98
104
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Container_class_1.A_Container): {
|
|
99
105
|
metaStorage = instance.containersMeta;
|
|
100
106
|
property = param1;
|
|
101
107
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
102
108
|
break;
|
|
103
109
|
}
|
|
110
|
+
// 3) If param1 is instance of A_Component
|
|
104
111
|
case param1 instanceof A_Component_class_1.A_Component: {
|
|
105
112
|
metaStorage = instance.componentsMeta;
|
|
106
113
|
property = param1.constructor;
|
|
107
114
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
108
115
|
break;
|
|
109
116
|
}
|
|
117
|
+
// 4) If param1 is class of A_Component
|
|
110
118
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Component_class_1.A_Component): {
|
|
111
119
|
metaStorage = instance.componentsMeta;
|
|
112
120
|
property = param1;
|
|
113
121
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
114
122
|
break;
|
|
115
123
|
}
|
|
124
|
+
// 5) If param1 is instance of A_Entity
|
|
116
125
|
case param1 instanceof A_Entity_class_1.A_Entity: {
|
|
117
126
|
metaStorage = instance.entitiesMeta;
|
|
118
127
|
property = param1.constructor;
|
|
119
128
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
120
129
|
break;
|
|
121
130
|
}
|
|
131
|
+
// 6) If param1 is class of A_Entity
|
|
122
132
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Entity_class_1.A_Entity): {
|
|
123
133
|
metaStorage = instance.entitiesMeta;
|
|
124
134
|
property = param1;
|
|
125
135
|
metaType = A_Entity_meta_1.A_EntityMeta;
|
|
126
136
|
break;
|
|
127
137
|
}
|
|
138
|
+
// 7) If param1 is string then we need to find the component by its name
|
|
139
|
+
case typeof param1 === 'string': {
|
|
140
|
+
metaStorage = instance.componentsMeta;
|
|
141
|
+
const found = Array.from(instance.componentsMeta).find(([c]) => c.name === param1);
|
|
142
|
+
if (!(found && found.length))
|
|
143
|
+
throw new a_utils_1.A_Error(`Component with name ${param1} not found`);
|
|
144
|
+
property = found[0];
|
|
145
|
+
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
// 8) If param1 is any other class or function
|
|
128
149
|
default: {
|
|
129
150
|
metaStorage = instance.customMeta;
|
|
130
151
|
property = typeof param1 === 'function' ? param1 : param1.constructor;
|
|
@@ -336,6 +357,22 @@ class A_Context {
|
|
|
336
357
|
break;
|
|
337
358
|
}
|
|
338
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Resets the Context to its initial state.
|
|
362
|
+
*/
|
|
363
|
+
static reset() {
|
|
364
|
+
const instance = A_Context.getInstance();
|
|
365
|
+
instance.containers = new WeakMap();
|
|
366
|
+
instance.features = new WeakMap();
|
|
367
|
+
instance.registry = new WeakMap();
|
|
368
|
+
instance.containersMeta = new Map();
|
|
369
|
+
instance.componentsMeta = new Map();
|
|
370
|
+
instance.entitiesMeta = new Map();
|
|
371
|
+
instance.customMeta = new Map();
|
|
372
|
+
instance._root = new A_Scope_class_1.A_Scope({
|
|
373
|
+
name: process && process.env ? process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_NAMESPACE] || 'a-concept' : 'a-concept'
|
|
374
|
+
});
|
|
375
|
+
}
|
|
339
376
|
}
|
|
340
377
|
exports.A_Context = A_Context;
|
|
341
378
|
//# sourceMappingURL=A-Context.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Context.class.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.class.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"A-Context.class.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.class.ts"],"names":[],"mappings":";;;AAAA,4CAIwB;AACxB,wEAA+D;AAC/D,qEAA4D;AAC5D,kEAAyD;AACzD,wEAA+D;AAC/D,4DAAmD;AAEnD,yDAAgD;AAChD,sEAAkE;AAClE,sEAAkE;AAClE,+DAAoE;AACpE,+DAAsD;AACtD,6DAAyD;AAGzD,wEAA6E;AAC7E,wEAA6E;AAG7E,4EAA8F;AAI9F;;;;;;GAMG;AACH,MAAa,SAAS;IA+ClB;QA3CA;;WAEG;QACO,eAAU,GAAkC,IAAI,OAAO,EAAE,CAAC;QAEpE;;WAEG;QACO,aAAQ,GAAgC,IAAI,OAAO,EAAE,CAAC;QAGhE;;WAEG;QACO,aAAQ,GAOd,IAAI,OAAO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AE,CAAC;QAClC,QAAQ,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QACpC,QAAQ,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QACpC,QAAQ,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,QAAQ,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAEhC,QAAQ,CAAC,KAAK,GAAG,IAAI,uBAAO,CAAC;YACzB,IAAI,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kDAAkC,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW;SAClI,CAAC,CAAC;IAEP,CAAC;CACJ;AAxmBD,8BAwmBC"}
|
|
@@ -9,11 +9,40 @@ import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
|
9
9
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
10
10
|
*/
|
|
11
11
|
export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_TYPES__Entity_JSON = A_TYPES__Entity_JSON> implements A_TYPES__IEntity {
|
|
12
|
-
aseid: ASEID;
|
|
13
12
|
/**
|
|
14
13
|
* Entity Identifier that corresponds to the class name
|
|
15
14
|
*/
|
|
16
15
|
static get entity(): string;
|
|
16
|
+
/**
|
|
17
|
+
* DEFAULT Namespace of the entity from environment variable A_CONCEPT_NAMESPACE
|
|
18
|
+
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
19
|
+
*/
|
|
20
|
+
static get namespace(): 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
|
+
* - namespace: an application specific identifier from where the entity is coming from
|
|
39
|
+
* - scope: the scope of the entity from Application Namespace
|
|
40
|
+
* - entity: the name of the entity from Application Namespace
|
|
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;
|
|
17
46
|
/**
|
|
18
47
|
* Create a new A_entity instance from Aseid String
|
|
19
48
|
* e.g. project@scope:entity:0000000001
|
|
@@ -24,7 +53,7 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
24
53
|
/**
|
|
25
54
|
* ASEID string that represents the entity
|
|
26
55
|
*/
|
|
27
|
-
aseid
|
|
56
|
+
aseid?: string);
|
|
28
57
|
/**
|
|
29
58
|
* Create a new A_entity instance from Aseid instance
|
|
30
59
|
* e.g. new ASEID({namespace: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
|
|
@@ -55,26 +84,7 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
55
84
|
/**
|
|
56
85
|
* Constructor object that represents the entity
|
|
57
86
|
*/
|
|
58
|
-
newEntity
|
|
59
|
-
protected isStringASEID(x: unknown): x is string;
|
|
60
|
-
protected isASEIDInstance(x: unknown): x is ASEID;
|
|
61
|
-
/**
|
|
62
|
-
* A "serialized" object is considered such if it is a non-null object
|
|
63
|
-
* and contains an "aseid" property (this mirrors your original check).
|
|
64
|
-
*
|
|
65
|
-
* @param x
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
protected isSerializedObject(x: unknown): x is _SerializedType;
|
|
69
|
-
/**
|
|
70
|
-
* Constructor-style props = a plain object which does NOT contain "aseid".
|
|
71
|
-
* This is the "create from provided fields" case.
|
|
72
|
-
*
|
|
73
|
-
* @param x
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
protected isConstructorProps(x: unknown): x is _ConstructorType;
|
|
77
|
-
protected getInitializer(props: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void;
|
|
87
|
+
newEntity?: _ConstructorType);
|
|
78
88
|
/**
|
|
79
89
|
* Extracts the ID from the ASEID
|
|
80
90
|
* ID is the unique identifier of the entity
|
|
@@ -106,8 +116,57 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
106
116
|
* shard is the shard of the entity
|
|
107
117
|
*/
|
|
108
118
|
get shard(): string | undefined;
|
|
119
|
+
protected isStringASEID(x: unknown): x is string;
|
|
120
|
+
protected isASEIDInstance(x: unknown): x is ASEID;
|
|
109
121
|
/**
|
|
110
|
-
*
|
|
122
|
+
* A "serialized" object is considered such if it is a non-null object
|
|
123
|
+
* and contains an "aseid" property (this mirrors your original check).
|
|
124
|
+
*
|
|
125
|
+
* @param x
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
protected isSerializedObject(x: unknown): x is _SerializedType;
|
|
129
|
+
/**
|
|
130
|
+
* Constructor-style props = a plain object which does NOT contain "aseid".
|
|
131
|
+
* This is the "create from provided fields" case.
|
|
132
|
+
*
|
|
133
|
+
* @param x
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
protected isConstructorProps(x: unknown): x is _ConstructorType;
|
|
137
|
+
/**
|
|
138
|
+
* Determines the appropriate initializer method based on the type of `props`.
|
|
139
|
+
* The method checks if `props` is:
|
|
140
|
+
* 1) a string that matches ASEID format -> fromASEID
|
|
141
|
+
* 2) an ASEID instance -> fromASEID
|
|
142
|
+
* 3) a serialized object (has 'aseid') -> fromJSON
|
|
143
|
+
* 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
144
|
+
*
|
|
145
|
+
* [!] If `props` is undefined, it will call fromUndefined method
|
|
146
|
+
*
|
|
147
|
+
* If none of the above, it throws an error indicating incorrect constructor usage.
|
|
148
|
+
*
|
|
149
|
+
*
|
|
150
|
+
* To get a custom initializer, override this method in the child class.
|
|
151
|
+
* Example:
|
|
152
|
+
* ```typescript
|
|
153
|
+
* protected getInitializer(
|
|
154
|
+
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
155
|
+
* ): (props: any) => void | (() => void) {
|
|
156
|
+
* if('customField' in props) {
|
|
157
|
+
* return this.fromCustomField.bind(this);
|
|
158
|
+
* }
|
|
159
|
+
* return super.getInitializer(props);
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
* @param props
|
|
163
|
+
* @returns The appropriate initializer method
|
|
164
|
+
*/
|
|
165
|
+
protected getInitializer(props?: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void | (() => void);
|
|
166
|
+
/**
|
|
167
|
+
* Call a feature of the component with the provided scope
|
|
168
|
+
*
|
|
169
|
+
* [!] If the provided scope is not inherited from the entity scope, it will be inherited
|
|
111
170
|
*
|
|
112
171
|
* @param lifecycleMethod
|
|
113
172
|
* @param args
|
|
@@ -125,15 +184,57 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
125
184
|
* The default method that can be called and extended to save entity data.
|
|
126
185
|
*/
|
|
127
186
|
save(scope?: A_Scope): Promise<any>;
|
|
187
|
+
/**
|
|
188
|
+
* Create a new entity from ASEID string or instance
|
|
189
|
+
* [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
|
|
190
|
+
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
191
|
+
*
|
|
192
|
+
* @param aseid
|
|
193
|
+
*/
|
|
128
194
|
fromASEID(aseid: string | ASEID): void;
|
|
195
|
+
/**
|
|
196
|
+
* Handles the case when no props are provided to the constructor.
|
|
197
|
+
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
198
|
+
* By default, it does nothing.
|
|
199
|
+
*
|
|
200
|
+
*
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
fromUndefined(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Create a new entity from constructor object
|
|
206
|
+
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
207
|
+
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
208
|
+
*
|
|
209
|
+
* @param newEntity
|
|
210
|
+
* @returns
|
|
211
|
+
*/
|
|
129
212
|
fromNew(newEntity: _ConstructorType): void;
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new entity from serialized object
|
|
215
|
+
*
|
|
216
|
+
* [!] Executed when the constructor is called with an object that contains "aseid" property
|
|
217
|
+
* [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
|
|
218
|
+
*
|
|
219
|
+
*
|
|
220
|
+
* @param serialized
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
130
223
|
fromJSON(serialized: _SerializedType): void;
|
|
131
224
|
/**
|
|
132
225
|
* Converts the entity to a JSON object
|
|
226
|
+
* [!] This method should be extended in the child classes to include all properties of the entity
|
|
227
|
+
* [!] Includes aseid by default
|
|
133
228
|
*
|
|
134
229
|
*
|
|
135
230
|
* @returns
|
|
136
231
|
*/
|
|
137
232
|
toJSON(): _SerializedType;
|
|
233
|
+
/**
|
|
234
|
+
* Returns the string representation of the entity
|
|
235
|
+
* what is basically the ASEID string
|
|
236
|
+
*
|
|
237
|
+
* @returns
|
|
238
|
+
*/
|
|
138
239
|
toString(): string;
|
|
139
240
|
}
|