@adaas/a-concept 0.0.55 → 0.0.57
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.context.d.ts +7 -6
- package/dist/src/base/A-Config/A-Config.context.js +2 -6
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js +2 -12
- package/dist/src/base/A-Config/components/ConfigReader.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 +19 -1
- package/dist/src/global/A-Context/A-Context.class.js +20 -0
- 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 -21
- 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.context.ts +13 -17
- package/src/base/A-Config/components/ConfigReader.component.ts +2 -15
- package/src/constants/env.constants.ts +47 -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 +44 -7
- package/src/global/A-Entity/A-Entity.class.ts +203 -73
- package/src/global/A-Scope/A-Scope.class.ts +86 -43
- 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-Entity.test.ts +186 -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
|
@@ -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,wE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 +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
|
}
|
|
@@ -13,6 +13,7 @@ exports.A_Entity = void 0;
|
|
|
13
13
|
const a_utils_1 = require("@adaas/a-utils");
|
|
14
14
|
const errors_constants_1 = require("@adaas/a-utils/dist/src/constants/errors.constants");
|
|
15
15
|
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
16
|
+
const env_constants_1 = require("../../constants/env.constants");
|
|
16
17
|
/**
|
|
17
18
|
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
18
19
|
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
@@ -21,6 +22,9 @@ const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
|
21
22
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
22
23
|
*/
|
|
23
24
|
class A_Entity {
|
|
25
|
+
// ====================================================================
|
|
26
|
+
// ================== Static A-Entity Information ============================
|
|
27
|
+
// ====================================================================
|
|
24
28
|
/**
|
|
25
29
|
* Entity Identifier that corresponds to the class name
|
|
26
30
|
*/
|
|
@@ -30,12 +34,77 @@ class A_Entity {
|
|
|
30
34
|
.toLocaleLowerCase()
|
|
31
35
|
.replace(/_/g, '-');
|
|
32
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* DEFAULT Namespace of the entity from environment variable A_CONCEPT_NAMESPACE
|
|
39
|
+
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
40
|
+
*/
|
|
41
|
+
static get namespace() {
|
|
42
|
+
return process && process.env ? process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_NAMESPACE] || 'a-concept' : 'a-concept';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
|
|
46
|
+
* [!] If environment variable is not set, it will default to 'core'
|
|
47
|
+
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
48
|
+
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
49
|
+
*/
|
|
50
|
+
static get scope() {
|
|
51
|
+
return process && process.env ? process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_DEFAULT_SCOPE] || 'core' : 'core';
|
|
52
|
+
}
|
|
33
53
|
constructor(props) {
|
|
34
54
|
const initializer = this.getInitializer(props);
|
|
35
55
|
// the returned initializer is already bound to `this` (we used .bind(this)),
|
|
36
56
|
// so calling it will run the appropriate logic on this instance:
|
|
37
57
|
initializer.call(this, props);
|
|
38
58
|
}
|
|
59
|
+
// ====================================================================
|
|
60
|
+
// ================== DUPLICATED ASEID Getters ========================
|
|
61
|
+
// ====================================================================
|
|
62
|
+
/**
|
|
63
|
+
* Extracts the ID from the ASEID
|
|
64
|
+
* ID is the unique identifier of the entity
|
|
65
|
+
*/
|
|
66
|
+
get id() {
|
|
67
|
+
return this.aseid.id;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Extracts the namespace from the ASEID
|
|
71
|
+
* namespace is an application specific identifier from where the entity is coming from
|
|
72
|
+
*/
|
|
73
|
+
get namespace() {
|
|
74
|
+
return this.aseid.namespace;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extracts the scope from the ASEID
|
|
78
|
+
* scope is the scope of the entity from Application Namespace
|
|
79
|
+
*/
|
|
80
|
+
get scope() {
|
|
81
|
+
return this.aseid.scope;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Extracts the entity from the ASEID
|
|
85
|
+
* entity is the name of the entity from Application Namespace
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
get entity() {
|
|
89
|
+
return this.aseid.entity;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Extracts the version from the ASEID
|
|
93
|
+
* version is the version of the entity
|
|
94
|
+
*/
|
|
95
|
+
get version() {
|
|
96
|
+
return this.aseid.version;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Extracts the shard from the ASEID
|
|
100
|
+
* shard is the shard of the entity
|
|
101
|
+
*/
|
|
102
|
+
get shard() {
|
|
103
|
+
return this.aseid.shard;
|
|
104
|
+
}
|
|
105
|
+
// ====================================================================
|
|
106
|
+
// ================== Constructor Helpers =============================
|
|
107
|
+
// ====================================================================
|
|
39
108
|
// --- Type guards used to classify `props` properly ---
|
|
40
109
|
isStringASEID(x) {
|
|
41
110
|
return typeof x === "string" && a_utils_1.ASEID.isASEID(x);
|
|
@@ -63,8 +132,38 @@ class A_Entity {
|
|
|
63
132
|
isConstructorProps(x) {
|
|
64
133
|
return !!x && typeof x === "object" && !("aseid" in x);
|
|
65
134
|
}
|
|
66
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Determines the appropriate initializer method based on the type of `props`.
|
|
137
|
+
* The method checks if `props` is:
|
|
138
|
+
* 1) a string that matches ASEID format -> fromASEID
|
|
139
|
+
* 2) an ASEID instance -> fromASEID
|
|
140
|
+
* 3) a serialized object (has 'aseid') -> fromJSON
|
|
141
|
+
* 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
142
|
+
*
|
|
143
|
+
* [!] If `props` is undefined, it will call fromUndefined method
|
|
144
|
+
*
|
|
145
|
+
* If none of the above, it throws an error indicating incorrect constructor usage.
|
|
146
|
+
*
|
|
147
|
+
*
|
|
148
|
+
* To get a custom initializer, override this method in the child class.
|
|
149
|
+
* Example:
|
|
150
|
+
* ```typescript
|
|
151
|
+
* protected getInitializer(
|
|
152
|
+
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
153
|
+
* ): (props: any) => void | (() => void) {
|
|
154
|
+
* if('customField' in props) {
|
|
155
|
+
* return this.fromCustomField.bind(this);
|
|
156
|
+
* }
|
|
157
|
+
* return super.getInitializer(props);
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
* @param props
|
|
161
|
+
* @returns The appropriate initializer method
|
|
162
|
+
*/
|
|
67
163
|
getInitializer(props) {
|
|
164
|
+
if (!props) {
|
|
165
|
+
return this.fromUndefined;
|
|
166
|
+
}
|
|
68
167
|
// 1) string that matches ASEID format -> fromASEID
|
|
69
168
|
if (this.isStringASEID(props)) {
|
|
70
169
|
return this.fromASEID;
|
|
@@ -84,54 +183,10 @@ class A_Entity {
|
|
|
84
183
|
// none of the above -> throw consistent error
|
|
85
184
|
throw new a_utils_1.A_Error(errors_constants_1.A_CONSTANTS__DEFAULT_ERRORS.INCORRECT_A_ENTITY_CONSTRUCTOR);
|
|
86
185
|
}
|
|
87
|
-
// ====================================================================
|
|
88
|
-
// ================== DUPLICATED ASEID Getters ========================
|
|
89
|
-
// ====================================================================
|
|
90
|
-
/**
|
|
91
|
-
* Extracts the ID from the ASEID
|
|
92
|
-
* ID is the unique identifier of the entity
|
|
93
|
-
*/
|
|
94
|
-
get id() {
|
|
95
|
-
return this.aseid.id;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Extracts the namespace from the ASEID
|
|
99
|
-
* namespace is an application specific identifier from where the entity is coming from
|
|
100
|
-
*/
|
|
101
|
-
get namespace() {
|
|
102
|
-
return this.aseid.namespace;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Extracts the scope from the ASEID
|
|
106
|
-
* scope is the scope of the entity from Application Namespace
|
|
107
|
-
*/
|
|
108
|
-
get scope() {
|
|
109
|
-
return this.aseid.scope;
|
|
110
|
-
}
|
|
111
186
|
/**
|
|
112
|
-
*
|
|
113
|
-
* entity is the name of the entity from Application Namespace
|
|
187
|
+
* Call a feature of the component with the provided scope
|
|
114
188
|
*
|
|
115
|
-
|
|
116
|
-
get entity() {
|
|
117
|
-
return this.aseid.entity;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Extracts the version from the ASEID
|
|
121
|
-
* version is the version of the entity
|
|
122
|
-
*/
|
|
123
|
-
get version() {
|
|
124
|
-
return this.aseid.version;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Extracts the shard from the ASEID
|
|
128
|
-
* shard is the shard of the entity
|
|
129
|
-
*/
|
|
130
|
-
get shard() {
|
|
131
|
-
return this.aseid.shard;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Call a feature of the component
|
|
189
|
+
* [!] If the provided scope is not inherited from the entity scope, it will be inherited
|
|
135
190
|
*
|
|
136
191
|
* @param lifecycleMethod
|
|
137
192
|
* @param args
|
|
@@ -179,6 +234,13 @@ class A_Entity {
|
|
|
179
234
|
// ====================================================================
|
|
180
235
|
// ================== Entity Serialization ============================
|
|
181
236
|
// ====================================================================
|
|
237
|
+
/**
|
|
238
|
+
* Create a new entity from ASEID string or instance
|
|
239
|
+
* [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
|
|
240
|
+
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
241
|
+
*
|
|
242
|
+
* @param aseid
|
|
243
|
+
*/
|
|
182
244
|
fromASEID(aseid) {
|
|
183
245
|
if (typeof aseid === 'string' && a_utils_1.ASEID.isASEID(aseid)) {
|
|
184
246
|
this.aseid = new a_utils_1.ASEID(aseid);
|
|
@@ -190,16 +252,58 @@ class A_Entity {
|
|
|
190
252
|
throw new a_utils_1.A_Error(errors_constants_1.A_CONSTANTS__DEFAULT_ERRORS.INCORRECT_A_ENTITY_CONSTRUCTOR);
|
|
191
253
|
}
|
|
192
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Handles the case when no props are provided to the constructor.
|
|
257
|
+
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
258
|
+
* By default, it does nothing.
|
|
259
|
+
*
|
|
260
|
+
*
|
|
261
|
+
* @returns
|
|
262
|
+
*/
|
|
263
|
+
fromUndefined() {
|
|
264
|
+
this.aseid = new a_utils_1.ASEID({
|
|
265
|
+
namespace: this.constructor.namespace,
|
|
266
|
+
scope: this.constructor.scope,
|
|
267
|
+
entity: this.constructor.entity,
|
|
268
|
+
id: `${new Date().getTime().toString()}-${Math.floor(Math.random() * 10000000).toString()}`,
|
|
269
|
+
});
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Create a new entity from constructor object
|
|
274
|
+
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
275
|
+
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
276
|
+
*
|
|
277
|
+
* @param newEntity
|
|
278
|
+
* @returns
|
|
279
|
+
*/
|
|
193
280
|
fromNew(newEntity) {
|
|
194
|
-
|
|
281
|
+
this.aseid = new a_utils_1.ASEID({
|
|
282
|
+
namespace: this.constructor.namespace,
|
|
283
|
+
scope: this.constructor.scope,
|
|
284
|
+
entity: this.constructor.entity,
|
|
285
|
+
id: `${new Date().getTime().toString()}-${Math.floor(Math.random() * 10000000).toString()}`,
|
|
286
|
+
});
|
|
195
287
|
return;
|
|
196
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Creates a new entity from serialized object
|
|
291
|
+
*
|
|
292
|
+
* [!] Executed when the constructor is called with an object that contains "aseid" property
|
|
293
|
+
* [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
|
|
294
|
+
*
|
|
295
|
+
*
|
|
296
|
+
* @param serialized
|
|
297
|
+
* @returns
|
|
298
|
+
*/
|
|
197
299
|
fromJSON(serialized) {
|
|
198
|
-
this.aseid = new a_utils_1.ASEID(
|
|
300
|
+
this.aseid = new a_utils_1.ASEID(serialized.aseid);
|
|
199
301
|
return;
|
|
200
302
|
}
|
|
201
303
|
/**
|
|
202
304
|
* Converts the entity to a JSON object
|
|
305
|
+
* [!] This method should be extended in the child classes to include all properties of the entity
|
|
306
|
+
* [!] Includes aseid by default
|
|
203
307
|
*
|
|
204
308
|
*
|
|
205
309
|
* @returns
|
|
@@ -209,6 +313,12 @@ class A_Entity {
|
|
|
209
313
|
aseid: this.aseid.toString()
|
|
210
314
|
};
|
|
211
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Returns the string representation of the entity
|
|
318
|
+
* what is basically the ASEID string
|
|
319
|
+
*
|
|
320
|
+
* @returns
|
|
321
|
+
*/
|
|
212
322
|
toString() {
|
|
213
323
|
return this.aseid ? this.aseid.toString() : this.constructor.name;
|
|
214
324
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAIwB;AAKxB,yFAAiG;AACjG,kEAAyD;
|
|
1
|
+
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAIwB;AAKxB,yFAAiG;AACjG,kEAAyD;AAEzD,4EAAwI;AAIxI;;;;;;GAMG;AACH,MAAa,QAAQ;IAOjB,uEAAuE;IACvE,8EAA8E;IAC9E,uEAAuE;IAEvE;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,wBAAc;aAChB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;aAC3B,iBAAiB,EAAE;aAC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,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO;IACX,CAAC;IAID;;;;;;;OAOG;IACH,MAAM;QACF,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;SACZ,CAAC;IACzB,CAAC;IAGD;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtE,CAAC;CACJ;AAvaD,4BAuaC"}
|
|
@@ -48,9 +48,9 @@ export declare class A_Scope {
|
|
|
48
48
|
* @param component
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
has(component:
|
|
52
|
-
has(entity:
|
|
53
|
-
has(fragment:
|
|
51
|
+
has<T extends A_Component>(component: new (...args: any[]) => T): boolean;
|
|
52
|
+
has<T extends A_Entity>(entity: new (...args: any[]) => T): boolean;
|
|
53
|
+
has<T extends A_Fragment>(fragment: new (...args: any[]) => T): boolean;
|
|
54
54
|
has(constructor: string): boolean;
|
|
55
55
|
/**
|
|
56
56
|
* Merges two scopes into a new one
|
|
@@ -71,9 +71,9 @@ export declare class A_Scope {
|
|
|
71
71
|
*/
|
|
72
72
|
resolve<T extends A_TYPES__A_InjectDecorator_Injectable>(string: string): InstanceType<T>;
|
|
73
73
|
resolve<T extends A_TYPES__A_InjectDecorator_Injectable>(component: T): InstanceType<T>;
|
|
74
|
-
resolve<T extends {
|
|
75
|
-
new (...args: any[]):
|
|
76
|
-
}
|
|
74
|
+
resolve<T extends A_Entity>(entity: {
|
|
75
|
+
new (...args: any[]): T;
|
|
76
|
+
}, instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): T | Array<T>;
|
|
77
77
|
resolve<T extends A_TYPES__A_InjectDecorator_Injectable>(component: Array<T>): Array<InstanceType<T>>;
|
|
78
78
|
private resolveByName;
|
|
79
79
|
private resolveOnce;
|
|
@@ -86,6 +86,7 @@ export declare class A_Scope {
|
|
|
86
86
|
*
|
|
87
87
|
* @param fragment
|
|
88
88
|
*/
|
|
89
|
+
register<T extends A_Component>(component: new (...args: any[]) => T): void;
|
|
89
90
|
register(entity: A_Entity): void;
|
|
90
91
|
register(component: A_Component): void;
|
|
91
92
|
register(fragment: A_Fragment): void;
|