@adaas/a-concept 0.0.56 → 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 -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.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 +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-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-Config.context.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAmE;AAEnE,0FAAiF;
|
|
1
|
+
{"version":3,"file":"A-Config.context.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAmE;AAEnE,0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F,EACtF,KAAW;;QAEX,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACjC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ;gBAC1B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBACvB,CAAC,CAAC,MAAM;qBACH,IAAI,CAAC,QAAQ,CAAC;qBACd,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACX,QAAQ,EAAE,GAAG;oBACb,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;iBACvB,CAAC,CAAC,CAAC;QAEhB,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;YAEtC,IAAI,WAAW,GAAG,KAAK;gBACnB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ;oBACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAa,CAAC;oBACrC,CAAC,CAAC,SAAS,CAAC;YAEpB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AA1GD,4BA0GC"}
|
|
@@ -34,10 +34,10 @@ let ConfigReader = class ConfigReader extends A_Component_class_1.A_Component {
|
|
|
34
34
|
}
|
|
35
35
|
inject(config) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const data = this.read(config.CONFIG_PROPERTIES);
|
|
37
|
+
const data = yield this.read(config.CONFIG_PROPERTIES);
|
|
38
38
|
config.set(data);
|
|
39
39
|
const rootDir = yield this.getProjectRoot();
|
|
40
|
-
config.set('
|
|
40
|
+
config.set('A_CONCEPT_ROOT_FOLDER', rootDir);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -65,16 +65,6 @@ let ConfigReader = class ConfigReader extends A_Component_class_1.A_Component {
|
|
|
65
65
|
*/
|
|
66
66
|
getProjectRoot() {
|
|
67
67
|
return __awaiter(this, arguments, void 0, function* (startPath = __dirname) {
|
|
68
|
-
// let currentPath = startPath;
|
|
69
|
-
// const fs = await A_Polyfills.fs();
|
|
70
|
-
// while (!fs.existsSync(`${currentPath}/package.json`)) {
|
|
71
|
-
// const parentPath = currentPath.substring(0, currentPath.lastIndexOf('/'));
|
|
72
|
-
// if (parentPath === currentPath || parentPath === '') {
|
|
73
|
-
// // Reached the root of the filesystem without finding package.json
|
|
74
|
-
// return null;
|
|
75
|
-
// }
|
|
76
|
-
// currentPath = parentPath;
|
|
77
|
-
// }
|
|
78
68
|
return process.cwd();
|
|
79
69
|
});
|
|
80
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/base/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,iFAAwE;AACxE,gGAAmF;AACnF,6FAAoF;AACpF,0DAA+C;AAC/C,uFAA8E;AAE9E;;GAEG;AACI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,+BAAW;IAEzC,YACiC,KAAc;QAE3C,KAAK,EAAE,CAAC;QAFqB,UAAK,GAAL,KAAK,CAAS;IAG/C,CAAC;IAIK,MAAM,CACY,MAAgB;;YAGpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/base/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,iFAAwE;AACxE,gGAAmF;AACnF,6FAAoF;AACpF,0DAA+C;AAC/C,uFAA8E;AAE9E;;GAEG;AACI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,+BAAW;IAEzC,YACiC,KAAc;QAE3C,KAAK,EAAE,CAAC;QAFqB,UAAK,GAAL,KAAK,CAAS;IAG/C,CAAC;IAIK,MAAM,CACY,MAAgB;;YAGpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAEvD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEjB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAE5C,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;KAAA;IAGD;;;OAGG;IACH,OAAO,CAAoB,QAAgB;QACvC,OAAO,QAAuB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,IAAI;6DACN,YAAsB,EAAE;YAExB,OAAO,EAAoB,CAAC;QAChC,CAAC;KAAA;IAGD;;;;;OAKG;IACa,cAAc;6DAAC,SAAS,GAAG,SAAS;YAChD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;KAAA;CACJ,CAAA;AArDY,oCAAY;AAUf;IADL,2BAAS,CAAC,IAAI,EAAE;IAEZ,WAAA,IAAA,6BAAQ,EAAC,2BAAQ,CAAC,CAAA;0CAUtB;uBArBQ,YAAY;IAGhB,WAAA,IAAA,6BAAQ,EAAC,uBAAO,CAAC,CAAA;GAHb,YAAY,CAqDxB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES: {
|
|
2
|
+
/**
|
|
3
|
+
* Namespace of the application
|
|
4
|
+
* [!] Provided name will be used for all aseids in the application by default
|
|
5
|
+
*/
|
|
6
|
+
readonly A_CONCEPT_NAMESPACE: "A_CONCEPT_NAMESPACE";
|
|
7
|
+
/**
|
|
8
|
+
* Default scope of the application
|
|
9
|
+
* [!] Provided name will be used for all aseids in the application by default
|
|
10
|
+
*/
|
|
11
|
+
readonly A_CONCEPT_DEFAULT_SCOPE: "A_CONCEPT_DEFAULT_SCOPE";
|
|
12
|
+
/**
|
|
13
|
+
* Environment of the application e.g. development, production, staging
|
|
14
|
+
*/
|
|
15
|
+
readonly A_CONCEPT_ENVIRONMENT: "A_CONCEPT_ENVIRONMENT";
|
|
16
|
+
/**
|
|
17
|
+
* Root folder of the application
|
|
18
|
+
* [!] Automatically set by A-Concept when the application starts
|
|
19
|
+
*/
|
|
20
|
+
readonly A_CONCEPT_ROOT_FOLDER: "A_CONCEPT_ROOT_FOLDER";
|
|
21
|
+
readonly CONFIG_SDK_VALIDATION: "CONFIG_SDK_VALIDATION";
|
|
22
|
+
readonly CONFIG_VERBOSE: "CONFIG_VERBOSE";
|
|
23
|
+
readonly CONFIG_IGNORE_ERRORS: "CONFIG_IGNORE_ERRORS";
|
|
24
|
+
};
|
|
25
|
+
export type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES];
|
|
26
|
+
export declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAMESPACE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "CONFIG_VERBOSE", "CONFIG_IGNORE_ERRORS"];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY = exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES = void 0;
|
|
4
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES = {
|
|
5
|
+
// ----------------------------------------------------------
|
|
6
|
+
// A-Concept Core Environment Variables
|
|
7
|
+
// ----------------------------------------------------------
|
|
8
|
+
// These environment variables are used by A-Concept core to configure the application
|
|
9
|
+
// ----------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* Namespace of the application
|
|
12
|
+
* [!] Provided name will be used for all aseids in the application by default
|
|
13
|
+
*/
|
|
14
|
+
A_CONCEPT_NAMESPACE: 'A_CONCEPT_NAMESPACE',
|
|
15
|
+
/**
|
|
16
|
+
* Default scope of the application
|
|
17
|
+
* [!] Provided name will be used for all aseids in the application by default
|
|
18
|
+
*/
|
|
19
|
+
A_CONCEPT_DEFAULT_SCOPE: 'A_CONCEPT_DEFAULT_SCOPE',
|
|
20
|
+
/**
|
|
21
|
+
* Environment of the application e.g. development, production, staging
|
|
22
|
+
*/
|
|
23
|
+
A_CONCEPT_ENVIRONMENT: 'A_CONCEPT_ENVIRONMENT',
|
|
24
|
+
/**
|
|
25
|
+
* Root folder of the application
|
|
26
|
+
* [!] Automatically set by A-Concept when the application starts
|
|
27
|
+
*/
|
|
28
|
+
A_CONCEPT_ROOT_FOLDER: 'A_CONCEPT_ROOT_FOLDER',
|
|
29
|
+
CONFIG_SDK_VALIDATION: 'CONFIG_SDK_VALIDATION',
|
|
30
|
+
CONFIG_VERBOSE: 'CONFIG_VERBOSE',
|
|
31
|
+
CONFIG_IGNORE_ERRORS: 'CONFIG_IGNORE_ERRORS',
|
|
32
|
+
};
|
|
33
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY = [
|
|
34
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_NAMESPACE,
|
|
35
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ENVIRONMENT,
|
|
36
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_CONCEPT_ROOT_FOLDER,
|
|
37
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES.CONFIG_VERBOSE,
|
|
38
|
+
exports.A_CONSTANTS__DEFAULT_ENV_VARIABLES.CONFIG_IGNORE_ERRORS,
|
|
39
|
+
];
|
|
40
|
+
//# sourceMappingURL=env.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.constants.js","sourceRoot":"","sources":["../../../src/constants/env.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kCAAkC,GAAG;IAC9C,6DAA6D;IAC7D,uCAAuC;IACvC,6DAA6D;IAC7D,sFAAsF;IACtF,6DAA6D;IAC7D;;;OAGG;IACH,mBAAmB,EAAE,qBAAqB;IAC1C;;;OAGG;IACH,uBAAuB,EAAE,yBAAyB;IAClD;;OAEG;IACH,qBAAqB,EAAE,uBAAuB;IAC9C;;;OAGG;IACH,qBAAqB,EAAE,uBAAuB;IAE9C,qBAAqB,EAAE,uBAAuB;IAC9C,cAAc,EAAE,gBAAgB;IAChC,oBAAoB,EAAE,sBAAsB;CACtC,CAAA;AAOG,QAAA,wCAAwC,GAAG;IACpD,0CAAkC,CAAC,mBAAmB;IACtD,0CAAkC,CAAC,qBAAqB;IACxD,0CAAkC,CAAC,qBAAqB;IACxD,0CAAkC,CAAC,cAAc;IACjD,0CAAkC,CAAC,oBAAoB;CACjD,CAAC"}
|
|
@@ -25,6 +25,6 @@ export declare function A_Inject(container: typeof A_FeatureCaller): A_TYPES__A_
|
|
|
25
25
|
export declare function A_Inject(fragment: {
|
|
26
26
|
new (...args: any[]): A_Fragment;
|
|
27
27
|
}): A_TYPES__A_InjectDecoratorReturn;
|
|
28
|
-
export declare function A_Inject(entity: {
|
|
29
|
-
new (...args: any[]):
|
|
30
|
-
}, config: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions
|
|
28
|
+
export declare function A_Inject<T extends A_Entity>(entity: {
|
|
29
|
+
new (...args: any[]): T;
|
|
30
|
+
}, config: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): A_TYPES__A_InjectDecoratorReturn;
|
|
@@ -2,9 +2,9 @@ import { A_Component } from "../../global/A-Component/A-Component.class";
|
|
|
2
2
|
import { A_Container } from "../../global/A-Container/A-Container.class";
|
|
3
3
|
import { A_Entity } from "../../global/A-Entity/A-Entity.class";
|
|
4
4
|
import { A_Feature } from "../../global/A-Feature/A-Feature.class";
|
|
5
|
+
import { A_FeatureCaller } from "../../global/A-Feature/A-FeatureCaller.class";
|
|
5
6
|
import { A_Fragment } from "../../global/A-Fragment/A-Fragment.class";
|
|
6
7
|
import { A_Scope } from "../../global/A-Scope/A-Scope.class";
|
|
7
|
-
import { ASEID } from "@adaas/a-utils";
|
|
8
8
|
export type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
|
|
9
9
|
export type A_TYPES__A_InjectDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
10
10
|
export type A_TYPES__A_InjectDecoratorStorageInstruction = Array<{
|
|
@@ -30,18 +30,17 @@ export type A_TYPES__A_InjectDecorator_Injectable = {
|
|
|
30
30
|
new (...args: any[]): A_Feature;
|
|
31
31
|
} | {
|
|
32
32
|
new (...args: any[]): A_Entity;
|
|
33
|
+
} | {
|
|
34
|
+
new (...args: any[]): A_FeatureCaller;
|
|
33
35
|
};
|
|
34
|
-
export type A_TYPES__A_InjectDecorator_EntityInjectionInstructions = {
|
|
35
|
-
query: Partial<A_TYPES__A_InjectDecorator_EntityInjectionQuery
|
|
36
|
+
export type A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T extends A_Entity = A_Entity> = {
|
|
37
|
+
query: Partial<A_TYPES__A_InjectDecorator_EntityInjectionQuery<T>>;
|
|
36
38
|
pagination: Partial<A_TYPES__A_InjectDecorator_EntityInjectionPagination>;
|
|
37
39
|
};
|
|
38
|
-
export type A_TYPES__A_InjectDecorator_EntityInjectionQuery = {
|
|
39
|
-
aseid: string
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
new (...args: any[]): A_Entity;
|
|
43
|
-
};
|
|
44
|
-
entity: string;
|
|
40
|
+
export type A_TYPES__A_InjectDecorator_EntityInjectionQuery<T extends A_Entity = A_Entity> = {
|
|
41
|
+
aseid: string;
|
|
42
|
+
} & {
|
|
43
|
+
[key in keyof T]?: any;
|
|
45
44
|
};
|
|
46
45
|
export type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
47
46
|
count: number;
|
|
@@ -2,6 +2,8 @@ import { A_Component } from "../A-Component/A-Component.class";
|
|
|
2
2
|
import { A_Container } from "../A-Container/A-Container.class";
|
|
3
3
|
import { A_TYPES__A_ChannelAggregated, A_TYPES__A_ChannelAggregateMethods, A_TYPES__A_ChannelCallParams, A_TYPES__A_ChannelConstructor } from "./A-Channel.types";
|
|
4
4
|
/**
|
|
5
|
+
* [!] DEPRECATED - use simply A_Component instead
|
|
6
|
+
*
|
|
5
7
|
* A_Channel is an abstraction over any Communication Type from event emitters to message queues, HTTP requests, etc.
|
|
6
8
|
*
|
|
7
9
|
* A_Channel uses to connect Containers between each other. When
|
|
@@ -11,6 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.A_Channel = void 0;
|
|
13
13
|
/**
|
|
14
|
+
* [!] DEPRECATED - use simply A_Component instead
|
|
15
|
+
*
|
|
14
16
|
* A_Channel is an abstraction over any Communication Type from event emitters to message queues, HTTP requests, etc.
|
|
15
17
|
*
|
|
16
18
|
* A_Channel uses to connect Containers between each other. When
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Channel.class.js","sourceRoot":"","sources":["../../../../src/global/A-Channel/A-Channel.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA
|
|
1
|
+
{"version":3,"file":"A-Channel.class.js","sourceRoot":"","sources":["../../../../src/global/A-Channel/A-Channel.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA;;;;;;;;GAQG;AACH,MAAa,SAAS;IAUlB,YAAY,MAAqC;QAC7C,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QAEpB,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CACpB,EAAqC,EACrC;YACI,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;gBAClB,OAAO,CAAO,GAAG,IAAW,EAAE,EAAE;oBAC5B,IAAI,CAAC,IAAI,CAAC,IAA6C,CAAC,CAAC;gBAC7D,CAAC,CAAA,CAAC;YACN,CAAC;SACJ,CAAC,CAAC;IACX,CAAC;IAGK,IAAI,CAAoB,IAA2C,EAAE,MAA8C;;YACrH,yDAAyD;YAEzD,OAAO,EAAW,CAAC;QACvB,CAAC;KAAA;CACJ;AA9BD,8BA8BC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A_TYPES__IConceptConstructor } from "./A_Concept.types";
|
|
1
|
+
import { A_TYPES__ConceptStage, A_TYPES__IConceptConstructor } from "./A_Concept.types";
|
|
2
2
|
import { A_Container } from "../A-Container/A-Container.class";
|
|
3
|
+
import { A_Abstraction } from "../A-Abstraction/A-Abstraction.class";
|
|
3
4
|
import { A_Abstraction_Extend } from "../../decorators/A-Abstraction/A-Abstraction-Extend.decorator";
|
|
4
5
|
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
5
6
|
/**
|
|
@@ -14,7 +15,7 @@ import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
|
14
15
|
*
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
|
-
export declare class A_Concept<_Imports extends A_Container[] =
|
|
18
|
+
export declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
18
19
|
protected props: A_TYPES__IConceptConstructor<_Imports>;
|
|
19
20
|
/**
|
|
20
21
|
* Load the concept. This step runs before any other steps to ensure that all components are loaded.
|
|
@@ -49,8 +50,8 @@ export declare class A_Concept<_Imports extends A_Container[] = any> {
|
|
|
49
50
|
* Stop the concept. Uses for servers or any other background services.
|
|
50
51
|
*/
|
|
51
52
|
static Stop(): (target: A_Container | import("../A-Component/A-Component.class").A_Component, propertyKey: string, descriptor: import("../../..").A_TYPES__A_AbstractionDecoratorDescriptor) => void;
|
|
52
|
-
private sharedBase;
|
|
53
53
|
private meta;
|
|
54
|
+
private _name;
|
|
54
55
|
protected containers: A_Container[];
|
|
55
56
|
constructor(props: A_TYPES__IConceptConstructor<_Imports>);
|
|
56
57
|
get namespace(): string;
|
|
@@ -99,4 +100,5 @@ export declare class A_Concept<_Imports extends A_Container[] = any> {
|
|
|
99
100
|
* Call the specific method of the concept or included modules.
|
|
100
101
|
*/
|
|
101
102
|
call<K extends Record<_Imports[number]['name'], string>>(container: K[keyof K]): Promise<void>;
|
|
103
|
+
protected abstraction(method: A_TYPES__ConceptStage, scope: A_Scope): A_Abstraction;
|
|
102
104
|
}
|
|
@@ -11,10 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.A_Concept = void 0;
|
|
13
13
|
const A_Concept_types_1 = require("./A_Concept.types");
|
|
14
|
-
const A_Container_class_1 = require("../A-Container/A-Container.class");
|
|
15
14
|
const A_Abstraction_class_1 = require("../A-Abstraction/A-Abstraction.class");
|
|
16
|
-
const
|
|
17
|
-
// export type RunParams<T> = T extends A_Container<any, infer Params> ? Params : never;
|
|
15
|
+
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
18
16
|
/**
|
|
19
17
|
* A_Concept is a placeholder for the concept of the ani program.
|
|
20
18
|
*
|
|
@@ -80,37 +78,32 @@ class A_Concept {
|
|
|
80
78
|
}
|
|
81
79
|
constructor(props) {
|
|
82
80
|
this.props = props;
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.containers = (props.containers || []).map(container => {
|
|
92
|
-
container.Scope.parent(this.Scope);
|
|
93
|
-
return container;
|
|
94
|
-
});
|
|
95
|
-
this.meta = new A_Concept_meta_1.A_ConceptMeta(this.containers, this.sharedBase);
|
|
81
|
+
this._name = props.name || A_Context_class_1.A_Context.root.name;
|
|
82
|
+
if (props.components && props.components.length)
|
|
83
|
+
props.components.forEach(component => this.Scope.register(component));
|
|
84
|
+
if (props.fragments && props.fragments.length)
|
|
85
|
+
props.fragments.forEach(fragment => this.Scope.register(fragment));
|
|
86
|
+
if (props.entities && props.entities.length)
|
|
87
|
+
props.entities.forEach(entity => this.Scope.register(entity));
|
|
88
|
+
this.containers = props.containers || [];
|
|
96
89
|
}
|
|
97
90
|
get namespace() {
|
|
98
|
-
return
|
|
91
|
+
return A_Context_class_1.A_Context.root.name;
|
|
99
92
|
}
|
|
100
93
|
get Scope() {
|
|
101
|
-
return
|
|
94
|
+
return A_Context_class_1.A_Context.root;
|
|
102
95
|
}
|
|
103
96
|
/**
|
|
104
97
|
* Register a class or value in the concept scope.
|
|
105
98
|
*/
|
|
106
99
|
get register() {
|
|
107
|
-
return this.
|
|
100
|
+
return this.Scope.register.bind(this.Scope);
|
|
108
101
|
}
|
|
109
102
|
/**
|
|
110
103
|
* Resolve a class or value from the concept scope.
|
|
111
104
|
*/
|
|
112
105
|
get resolve() {
|
|
113
|
-
return this.
|
|
106
|
+
return this.Scope.resolve.bind(this.Scope);
|
|
114
107
|
}
|
|
115
108
|
// =======================================================================
|
|
116
109
|
// ========================== LIFECYCLE ================================
|
|
@@ -121,7 +114,7 @@ class A_Concept {
|
|
|
121
114
|
load(scope) {
|
|
122
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
116
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
124
|
-
const abstraction = this.
|
|
117
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Load, scope);
|
|
125
118
|
yield abstraction.process();
|
|
126
119
|
});
|
|
127
120
|
}
|
|
@@ -131,7 +124,7 @@ class A_Concept {
|
|
|
131
124
|
run(scope) {
|
|
132
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
126
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
134
|
-
const abstraction = this.
|
|
127
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Run, scope);
|
|
135
128
|
yield abstraction.process();
|
|
136
129
|
});
|
|
137
130
|
}
|
|
@@ -143,7 +136,7 @@ class A_Concept {
|
|
|
143
136
|
start(scope) {
|
|
144
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
138
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
146
|
-
const abstraction = this.
|
|
139
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Start, scope);
|
|
147
140
|
yield abstraction.process();
|
|
148
141
|
});
|
|
149
142
|
}
|
|
@@ -155,7 +148,7 @@ class A_Concept {
|
|
|
155
148
|
stop(scope) {
|
|
156
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
150
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
158
|
-
const abstraction = this.
|
|
151
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Stop, scope);
|
|
159
152
|
yield abstraction.process();
|
|
160
153
|
});
|
|
161
154
|
}
|
|
@@ -165,7 +158,7 @@ class A_Concept {
|
|
|
165
158
|
build(scope) {
|
|
166
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
160
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
168
|
-
const abstraction = this.
|
|
161
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Build, scope);
|
|
169
162
|
yield abstraction.process();
|
|
170
163
|
});
|
|
171
164
|
}
|
|
@@ -175,7 +168,7 @@ class A_Concept {
|
|
|
175
168
|
deploy(scope) {
|
|
176
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
170
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
178
|
-
const abstraction = this.
|
|
171
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Deploy, scope);
|
|
179
172
|
yield abstraction.process();
|
|
180
173
|
});
|
|
181
174
|
}
|
|
@@ -185,7 +178,7 @@ class A_Concept {
|
|
|
185
178
|
publish(scope) {
|
|
186
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
180
|
scope = scope ? scope.inherit(this.Scope) : this.Scope;
|
|
188
|
-
const abstraction = this.
|
|
181
|
+
const abstraction = this.abstraction(A_Concept_types_1.A_TYPES__ConceptStage.Publish, scope);
|
|
189
182
|
yield abstraction.process();
|
|
190
183
|
});
|
|
191
184
|
}
|
|
@@ -205,6 +198,18 @@ class A_Concept {
|
|
|
205
198
|
// await feature.process();
|
|
206
199
|
});
|
|
207
200
|
}
|
|
201
|
+
abstraction(method, scope) {
|
|
202
|
+
const featureDefinitions = this.containers.map(container => {
|
|
203
|
+
const definition = A_Context_class_1.A_Context.abstractionDefinition(container, method, container.Scope);
|
|
204
|
+
return Object.assign(Object.assign({}, definition), { steps: definition.steps.map(step => (Object.assign(Object.assign({}, step), { component: step.component ? step.component : container }))) });
|
|
205
|
+
});
|
|
206
|
+
const definition = {
|
|
207
|
+
name: `${this.namespace}.${method}`,
|
|
208
|
+
features: featureDefinitions,
|
|
209
|
+
scope
|
|
210
|
+
};
|
|
211
|
+
return new A_Abstraction_class_1.A_Abstraction(definition);
|
|
212
|
+
}
|
|
208
213
|
}
|
|
209
214
|
exports.A_Concept = A_Concept;
|
|
210
215
|
//# sourceMappingURL=A_Concept.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A_Concept.class.js","sourceRoot":"","sources":["../../../../src/global/A-Concept/A_Concept.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"A_Concept.class.js","sourceRoot":"","sources":["../../../../src/global/A-Concept/A_Concept.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAwF;AAExF,8EAAqE;AAIrE,kEAAyD;AAGzD;;;;;;;;;;;GAWG;AACH,MAAa,SAAS;IAIlB,iFAAiF;IAC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AAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAG,CAAC,IAC7G;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG;YACf,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,EAAE;YACnC,QAAQ,EAAE,kBAAkB;YAC5B,KAAK;SACR,CAAC;QAEF,OAAO,IAAI,mCAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;CACJ;AA9QD,8BA8QC"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { A_Container } from "../A-Container/A-Container.class";
|
|
2
2
|
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
3
|
-
import { A_TYPES__ConceptStage } from "./A_Concept.types";
|
|
4
|
-
import { A_TYPES__A_AbstractionConstructor } from "../A-Abstraction/A-Abstraction.types";
|
|
5
|
-
import { A_Abstraction } from "../A-Abstraction/A-Abstraction.class";
|
|
6
|
-
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
7
3
|
export declare class A_ConceptMeta extends A_Meta<any> {
|
|
8
4
|
private containers;
|
|
9
|
-
|
|
10
|
-
constructor(containers: Array<A_Container>, base: A_Container);
|
|
11
|
-
abstractionDefinition(method: A_TYPES__ConceptStage, scope: A_Scope): A_TYPES__A_AbstractionConstructor;
|
|
12
|
-
abstraction(method: A_TYPES__ConceptStage, scope: A_Scope): A_Abstraction;
|
|
5
|
+
constructor(containers: Array<A_Container>);
|
|
13
6
|
}
|
|
@@ -2,35 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_ConceptMeta = void 0;
|
|
4
4
|
const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
|
|
5
|
-
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
6
|
-
const A_Abstraction_class_1 = require("../A-Abstraction/A-Abstraction.class");
|
|
7
5
|
// import { A_TYPES__ComponentMeta } from "./A-Component.types";
|
|
8
6
|
class A_ConceptMeta extends A_Meta_class_1.A_Meta {
|
|
9
|
-
constructor(containers
|
|
7
|
+
constructor(containers) {
|
|
10
8
|
super();
|
|
11
9
|
this.containers = containers;
|
|
12
|
-
this.base = base;
|
|
13
|
-
}
|
|
14
|
-
abstractionDefinition(method, scope) {
|
|
15
|
-
const featureDefinitions = this.containers.map(container => A_Context_class_1.A_Context.abstractionDefinition(container, method, scope));
|
|
16
|
-
const definition = {
|
|
17
|
-
name: `${this.base.name}.${method}`,
|
|
18
|
-
features: featureDefinitions,
|
|
19
|
-
scope
|
|
20
|
-
};
|
|
21
|
-
return definition;
|
|
22
|
-
}
|
|
23
|
-
abstraction(method, scope) {
|
|
24
|
-
const featureDefinitions = this.containers.map(container => {
|
|
25
|
-
const definition = A_Context_class_1.A_Context.abstractionDefinition(container, method, container.Scope);
|
|
26
|
-
return Object.assign(Object.assign({}, definition), { steps: definition.steps.map(step => (Object.assign(Object.assign({}, step), { component: step.component ? step.component : container }))) });
|
|
27
|
-
});
|
|
28
|
-
const definition = {
|
|
29
|
-
name: `${this.base.name}.${method}`,
|
|
30
|
-
features: featureDefinitions,
|
|
31
|
-
scope
|
|
32
|
-
};
|
|
33
|
-
return new A_Abstraction_class_1.A_Abstraction(definition);
|
|
34
10
|
}
|
|
35
11
|
}
|
|
36
12
|
exports.A_ConceptMeta = A_ConceptMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A_Concept.meta.js","sourceRoot":"","sources":["../../../../src/global/A-Concept/A_Concept.meta.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;
|
|
1
|
+
{"version":3,"file":"A_Concept.meta.js","sourceRoot":"","sources":["../../../../src/global/A-Concept/A_Concept.meta.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAWhD,gEAAgE;AAGhE,MAAa,aAAc,SAAQ,qBAAW;IAG1C,YACY,UAA8B;QAEtC,KAAK,EAAE,CAAC;QAFA,eAAU,GAAV,UAAU,CAAoB;IAG1C,CAAC;CAQJ;AAfD,sCAeC"}
|
|
@@ -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;
|
|
@@ -71,6 +71,9 @@ class A_Context {
|
|
|
71
71
|
static allocate(param1, param2) {
|
|
72
72
|
const instance = this.getInstance();
|
|
73
73
|
const newScope = param2 instanceof A_Scope_class_1.A_Scope ? param2 : new A_Scope_class_1.A_Scope(param2, param2);
|
|
74
|
+
if (!newScope.isInheritedFrom(A_Context.root)) {
|
|
75
|
+
newScope.inherit(A_Context.root);
|
|
76
|
+
}
|
|
74
77
|
switch (true) {
|
|
75
78
|
case param1 instanceof A_Container_class_1.A_Container:
|
|
76
79
|
instance.containers.set(param1, newScope);
|
|
@@ -89,42 +92,59 @@ class A_Context {
|
|
|
89
92
|
let property;
|
|
90
93
|
let metaType;
|
|
91
94
|
switch (true) {
|
|
95
|
+
// 1) If param1 is instance of A_Container
|
|
92
96
|
case param1 instanceof A_Container_class_1.A_Container: {
|
|
93
97
|
metaStorage = instance.containersMeta;
|
|
94
98
|
property = param1.constructor;
|
|
95
99
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
96
100
|
break;
|
|
97
101
|
}
|
|
102
|
+
// 2) If param1 is class of A_Container
|
|
98
103
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Container_class_1.A_Container): {
|
|
99
104
|
metaStorage = instance.containersMeta;
|
|
100
105
|
property = param1;
|
|
101
106
|
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
102
107
|
break;
|
|
103
108
|
}
|
|
109
|
+
// 3) If param1 is instance of A_Component
|
|
104
110
|
case param1 instanceof A_Component_class_1.A_Component: {
|
|
105
111
|
metaStorage = instance.componentsMeta;
|
|
106
112
|
property = param1.constructor;
|
|
107
113
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
108
114
|
break;
|
|
109
115
|
}
|
|
116
|
+
// 4) If param1 is class of A_Component
|
|
110
117
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Component_class_1.A_Component): {
|
|
111
118
|
metaStorage = instance.componentsMeta;
|
|
112
119
|
property = param1;
|
|
113
120
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
114
121
|
break;
|
|
115
122
|
}
|
|
123
|
+
// 5) If param1 is instance of A_Entity
|
|
116
124
|
case param1 instanceof A_Entity_class_1.A_Entity: {
|
|
117
125
|
metaStorage = instance.entitiesMeta;
|
|
118
126
|
property = param1.constructor;
|
|
119
127
|
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
120
128
|
break;
|
|
121
129
|
}
|
|
130
|
+
// 6) If param1 is class of A_Entity
|
|
122
131
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Entity_class_1.A_Entity): {
|
|
123
132
|
metaStorage = instance.entitiesMeta;
|
|
124
133
|
property = param1;
|
|
125
134
|
metaType = A_Entity_meta_1.A_EntityMeta;
|
|
126
135
|
break;
|
|
127
136
|
}
|
|
137
|
+
// 7) If param1 is string then we need to find the component by its name
|
|
138
|
+
case typeof param1 === 'string': {
|
|
139
|
+
metaStorage = instance.componentsMeta;
|
|
140
|
+
const found = Array.from(instance.componentsMeta).find(([c]) => c.name === param1);
|
|
141
|
+
if (!(found && found.length))
|
|
142
|
+
throw new a_utils_1.A_Error(`Component with name ${param1} not found`);
|
|
143
|
+
property = found[0];
|
|
144
|
+
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
// 8) If param1 is any other class or function
|
|
128
148
|
default: {
|
|
129
149
|
metaStorage = instance.customMeta;
|
|
130
150
|
property = typeof param1 === 'function' ? param1 : param1.constructor;
|