@adaas/a-concept 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/simple/components/A.component.d.ts +4 -2
- package/dist/examples/simple/components/A.component.js +7 -4
- package/dist/examples/simple/components/A.component.js.map +1 -1
- package/dist/examples/simple/components/B.component.d.ts +6 -2
- package/dist/examples/simple/components/B.component.js +18 -7
- package/dist/examples/simple/components/B.component.js.map +1 -1
- package/dist/examples/simple/concept.js +59 -32
- package/dist/examples/simple/concept.js.map +1 -1
- package/dist/examples/simple/containers/Main.container.d.ts +1 -2
- package/dist/examples/simple/containers/Main.container.js +18 -5
- package/dist/examples/simple/containers/Main.container.js.map +1 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.d.ts +2 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.js +3 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.d.ts +2 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.js +2 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +1 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.container.d.ts +1 -3
- package/dist/src/base/A-Config/A-Config.container.js +6 -22
- package/dist/src/base/A-Config/A-Config.container.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.context.d.ts +1 -0
- package/dist/src/base/A-Config/A-Config.context.js +20 -2
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.types.d.ts +2 -2
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +2 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js +3 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -1
- package/dist/src/base/A-Errors/A-Errors.component.d.ts +2 -1
- package/dist/src/base/A-Errors/A-Errors.component.js +3 -1
- package/dist/src/base/A-Errors/A-Errors.component.js.map +1 -1
- package/dist/src/base/A-Logger/A-Logger.component.d.ts +4 -2
- package/dist/src/base/A-Logger/A-Logger.component.js +11 -3
- package/dist/src/base/A-Logger/A-Logger.component.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +9 -9
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +0 -2
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +4 -2
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +28 -1
- package/dist/src/global/A-Component/A-Component.class.js +22 -0
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +8 -1
- package/dist/src/global/A-Component/A-Component.meta.js +26 -0
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +43 -6
- package/dist/src/global/A-Component/A-Component.types.js +5 -0
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +7 -7
- package/dist/src/global/A-Concept/A_Concept.class.js +1 -2
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +5 -4
- package/dist/src/global/A-Container/A-Container.class.js +13 -24
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -3
- package/dist/src/global/A-Container/A-Container.meta.js +0 -46
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +34 -5
- package/dist/src/global/A-Context/A-Context.class.js +135 -53
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -12
- package/dist/src/global/A-Context/A-Context.types.js +0 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +28 -4
- package/dist/src/global/A-Entity/A-Entity.class.js +23 -3
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +4 -0
- package/dist/src/global/A-Entity/A-Entity.meta.js +8 -0
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +43 -0
- package/dist/src/global/A-Entity/A-Entity.types.js +13 -0
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +11 -1
- package/dist/src/global/A-Feature/A-Feature.class.js +48 -12
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +5 -4
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.js +1 -2
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +75 -1
- package/dist/src/global/A-Meta/A-Meta.class.js +100 -10
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +15 -6
- package/dist/src/global/A-Scope/A-Scope.class.js +59 -17
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/examples/simple/components/A.component.ts +6 -3
- package/examples/simple/components/B.component.ts +19 -6
- package/examples/simple/concept.ts +65 -33
- package/examples/simple/containers/Main.container.ts +28 -7
- package/examples/simple-http-server/components/http-error-handler.component.ts +5 -2
- package/examples/simple-http-server/components/http-request-handler.component.ts +3 -1
- package/index.ts +6 -1
- package/package.json +1 -1
- package/src/base/A-Config/A-Config.container.ts +5 -8
- package/src/base/A-Config/A-Config.context.ts +10 -2
- package/src/base/A-Config/A-Config.types.ts +2 -2
- package/src/base/A-Config/components/ConfigReader.component.ts +5 -2
- package/src/base/A-Errors/A-Errors.component.ts +3 -2
- package/src/base/A-Logger/A-Logger.component.ts +21 -3
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +0 -1
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +15 -10
- package/src/decorators/A-Inject/A-Inject.decorator.ts +13 -11
- package/src/global/A-Component/A-Component.class.ts +56 -1
- package/src/global/A-Component/A-Component.meta.ts +40 -1
- package/src/global/A-Component/A-Component.types.ts +51 -19
- package/src/global/A-Concept/A_Concept.class.ts +2 -2
- package/src/global/A-Container/A-Container.class.ts +22 -34
- package/src/global/A-Container/A-Container.meta.ts +0 -64
- package/src/global/A-Context/A-Context.class.ts +237 -79
- package/src/global/A-Context/A-Context.types.ts +0 -15
- package/src/global/A-Entity/A-Entity.class.ts +65 -8
- package/src/global/A-Entity/A-Entity.meta.ts +9 -0
- package/src/global/A-Entity/A-Entity.types.ts +58 -0
- package/src/global/A-Feature/A-Feature.class.ts +62 -20
- package/src/global/A-Feature/A-Feature.types.ts +8 -2
- package/src/global/A-Fragment/A-Fragment.class.ts +1 -5
- package/src/global/A-Meta/A-Meta.class.ts +114 -22
- package/src/global/A-Scope/A-Scope.class.ts +100 -33
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.A_Entity = void 0;
|
|
4
13
|
const a_utils_1 = require("@adaas/a-utils");
|
|
5
14
|
const errors_constants_1 = require("@adaas/a-utils/dist/src/constants/errors.constants");
|
|
6
|
-
const
|
|
15
|
+
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
7
16
|
/**
|
|
8
17
|
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
9
18
|
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
@@ -11,9 +20,8 @@ const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
|
|
|
11
20
|
*
|
|
12
21
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
13
22
|
*/
|
|
14
|
-
class A_Entity
|
|
23
|
+
class A_Entity {
|
|
15
24
|
constructor(props) {
|
|
16
|
-
super();
|
|
17
25
|
switch (true) {
|
|
18
26
|
case (typeof props === 'string' && a_utils_1.ASEID.isASEID(props)):
|
|
19
27
|
this.aseid = new a_utils_1.ASEID(props);
|
|
@@ -76,6 +84,18 @@ class A_Entity extends A_Fragment_class_1.A_Fragment {
|
|
|
76
84
|
get shard() {
|
|
77
85
|
return this.aseid.shard;
|
|
78
86
|
}
|
|
87
|
+
call(param1, param2) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const feature = typeof param1 === 'string'
|
|
90
|
+
? param1
|
|
91
|
+
: param1.name;
|
|
92
|
+
const params = typeof param1 === 'string'
|
|
93
|
+
? param2 || {}
|
|
94
|
+
: param1;
|
|
95
|
+
const newFeature = A_Context_class_1.A_Context.feature(this, feature, params);
|
|
96
|
+
return yield newFeature.process();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
79
99
|
fromNewEntity(newEntity) {
|
|
80
100
|
return;
|
|
81
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAGwB;AAOxB,yFAAiG;AACjG,kEAAyD;AAIzD;;;;;;GAMG;AACH,MAAa,QAAQ;IAsBjB,YAAY,KAA0D;QAElE,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,eAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM;YACV,KAAK,CAAC,KAAK,YAAY,eAAK,CAAC;gBACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,MAAM;YACV,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAK,KAAa,CAAC,KAAK,CAAC;gBACpD,IAAI,CAAC,cAAc,CAAC,KAAwB,CAAC,CAAC;gBAC9C,MAAM;YAEV,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;gBAC5B,IAAI,CAAC,aAAa,CAAC,KAAyB,CAAC,CAAC;gBAC9C,MAAK;YAET;gBACI,MAAM,IAAI,iBAAO,CAAC,8CAA2B,CAAC,8BAA8B,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;IAED,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IAEvE;;;OAGG;IACH,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACL,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ineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_EntityMeta = void 0;
|
|
4
|
+
const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
|
|
5
|
+
class A_EntityMeta extends A_Meta_class_1.A_Meta {
|
|
6
|
+
}
|
|
7
|
+
exports.A_EntityMeta = A_EntityMeta;
|
|
8
|
+
//# sourceMappingURL=A-Entity.meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Entity.meta.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.meta.ts"],"names":[],"mappings":";;;AAAA,yDAAgD;AAIhD,MAAa,YAAa,SAAQ,qBAA2B;CAI5D;AAJD,oCAIC"}
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { ASEID } from "@adaas/a-utils";
|
|
2
|
+
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
3
|
+
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
|
+
export type A_TYPES__EntityCallParams<T extends string> = {
|
|
5
|
+
name: T;
|
|
6
|
+
fragments: Array<A_Fragment>;
|
|
7
|
+
components: Array<{
|
|
8
|
+
new (...args: any[]): any;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export type A_TYPES__EntityBaseMethods = [
|
|
12
|
+
A_TYPES__EntityBaseMethod.SAVE,
|
|
13
|
+
A_TYPES__EntityBaseMethod.UPDATE,
|
|
14
|
+
A_TYPES__EntityBaseMethod.DESTROY,
|
|
15
|
+
A_TYPES__EntityBaseMethod.LOAD
|
|
16
|
+
];
|
|
17
|
+
export declare enum A_TYPES__EntityBaseMethod {
|
|
18
|
+
SAVE = "save",
|
|
19
|
+
UPDATE = "update",
|
|
20
|
+
DESTROY = "destroy",
|
|
21
|
+
LOAD = "load"
|
|
22
|
+
}
|
|
2
23
|
export interface A_TYPES__IEntity {
|
|
3
24
|
/**
|
|
4
25
|
* The ASEID of the entity
|
|
@@ -11,3 +32,25 @@ export type A_TYPES__Entity_JSON = {
|
|
|
11
32
|
*/
|
|
12
33
|
aseid: string;
|
|
13
34
|
};
|
|
35
|
+
export type A_TYPES__EntityMeta = {
|
|
36
|
+
[A_TYPES__EntityMetaKey.EXTENSIONS]: A_Meta<{
|
|
37
|
+
/**
|
|
38
|
+
* Where Key the regexp for what to apply the extension
|
|
39
|
+
* A set of container names or a wildcard, or a regexp
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* Where value is the extension instructions
|
|
43
|
+
*/
|
|
44
|
+
[Key: string]: A_TYPES__EntityMeta_ExtensionItem[];
|
|
45
|
+
}>;
|
|
46
|
+
case: any;
|
|
47
|
+
[A_TYPES__EntityMetaKey.FEATURES]: any[];
|
|
48
|
+
};
|
|
49
|
+
export declare enum A_TYPES__EntityMetaKey {
|
|
50
|
+
EXTENSIONS = "a-component-extensions",
|
|
51
|
+
FEATURES = "a-component-features"
|
|
52
|
+
}
|
|
53
|
+
export type A_TYPES__EntityMeta_ExtensionItem = {
|
|
54
|
+
name: string;
|
|
55
|
+
handler: string;
|
|
56
|
+
};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_TYPES__EntityMetaKey = exports.A_TYPES__EntityBaseMethod = void 0;
|
|
4
|
+
var A_TYPES__EntityBaseMethod;
|
|
5
|
+
(function (A_TYPES__EntityBaseMethod) {
|
|
6
|
+
A_TYPES__EntityBaseMethod["SAVE"] = "save";
|
|
7
|
+
A_TYPES__EntityBaseMethod["UPDATE"] = "update";
|
|
8
|
+
A_TYPES__EntityBaseMethod["DESTROY"] = "destroy";
|
|
9
|
+
A_TYPES__EntityBaseMethod["LOAD"] = "load";
|
|
10
|
+
})(A_TYPES__EntityBaseMethod || (exports.A_TYPES__EntityBaseMethod = A_TYPES__EntityBaseMethod = {}));
|
|
3
11
|
;
|
|
12
|
+
var A_TYPES__EntityMetaKey;
|
|
13
|
+
(function (A_TYPES__EntityMetaKey) {
|
|
14
|
+
A_TYPES__EntityMetaKey["EXTENSIONS"] = "a-component-extensions";
|
|
15
|
+
A_TYPES__EntityMetaKey["FEATURES"] = "a-component-features";
|
|
16
|
+
})(A_TYPES__EntityMetaKey || (exports.A_TYPES__EntityMetaKey = A_TYPES__EntityMetaKey = {}));
|
|
4
17
|
//# sourceMappingURL=A-Entity.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.types.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"A-Entity.types.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.types.ts"],"names":[],"mappings":";;;AAmBA,IAAY,yBAKX;AALD,WAAY,yBAAyB;IACjC,0CAAa,CAAA;IACb,8CAAiB,CAAA;IACjB,gDAAmB,CAAA;IACnB,0CAAa,CAAA;AACjB,CAAC,EALW,yBAAyB,yCAAzB,yBAAyB,QAKpC;AAOA,CAAC;AAgCF,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,+DAAqC,CAAA;IACrC,2DAAiC,CAAA;AACrC,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A_Feature_Define } from "../../decorators/A-Feature/A-Feature-Define.decorator";
|
|
2
2
|
import { A_Feature_Extend } from "../../decorators/A-Feature/A-Feature-Extend.decorator";
|
|
3
|
-
import { A_TYPES__FeatureConstructor, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
|
|
3
|
+
import { A_TYPES__FeatureConstructor, A_TYPES__FeatureIteratorReturn, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
|
|
4
4
|
import { A_Error, A_TYPES__Required } from "@adaas/a-utils";
|
|
5
5
|
/**
|
|
6
6
|
* A_Feature is representing a feature that can be executed across multiple components
|
|
@@ -20,10 +20,20 @@ export declare class A_Feature {
|
|
|
20
20
|
*/
|
|
21
21
|
static get Extend(): typeof A_Feature_Extend;
|
|
22
22
|
protected steps: A_TYPES__FeatureStep[];
|
|
23
|
+
protected _current?: A_TYPES__FeatureStep;
|
|
24
|
+
protected _index: number;
|
|
23
25
|
state: A_TYPES__FeatureState;
|
|
24
26
|
result?: any;
|
|
25
27
|
error?: A_Error;
|
|
26
28
|
constructor(params: A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps']>);
|
|
29
|
+
/**
|
|
30
|
+
* Custom iterator to iterate over the steps of the feature
|
|
31
|
+
*
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
[Symbol.iterator](): Iterator<A_TYPES__FeatureIteratorReturn, any>;
|
|
35
|
+
get current(): A_TYPES__FeatureStep | undefined;
|
|
36
|
+
isDone(): boolean;
|
|
27
37
|
/**
|
|
28
38
|
* This method marks the feature as completed and returns the result
|
|
29
39
|
* Uses to interrupt or end the feature processing
|
|
@@ -39,11 +39,56 @@ class A_Feature {
|
|
|
39
39
|
constructor(params) {
|
|
40
40
|
// protected scope: A_Scope
|
|
41
41
|
this.steps = [];
|
|
42
|
+
this._index = 0;
|
|
42
43
|
this.state = A_Feature_types_1.A_TYPES__FeatureState.INITIALIZED;
|
|
43
44
|
// this.scope = params.scope;
|
|
44
45
|
this.steps = params.steps;
|
|
45
46
|
A_Context_class_1.A_Context.allocate(this, params);
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Custom iterator to iterate over the steps of the feature
|
|
50
|
+
*
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
[Symbol.iterator]() {
|
|
54
|
+
return {
|
|
55
|
+
// Custom next method
|
|
56
|
+
next: () => {
|
|
57
|
+
if (this._index < this.steps.length) {
|
|
58
|
+
if (this.state === A_Feature_types_1.A_TYPES__FeatureState.FAILED
|
|
59
|
+
||
|
|
60
|
+
this.state === A_Feature_types_1.A_TYPES__FeatureState.COMPLETED) {
|
|
61
|
+
throw new Error('FEATURE_PROCESSING_INTERRUPTED');
|
|
62
|
+
}
|
|
63
|
+
this._current = this.steps[this._index];
|
|
64
|
+
const { component, handler, args } = this._current;
|
|
65
|
+
const instance = A_Context_class_1.A_Context.scope(this).resolve(component);
|
|
66
|
+
return {
|
|
67
|
+
value: () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
if (instance[handler]) {
|
|
69
|
+
const callArgs = A_Context_class_1.A_Context.scope(this).resolve(args);
|
|
70
|
+
yield instance[handler](...callArgs);
|
|
71
|
+
}
|
|
72
|
+
this._index++;
|
|
73
|
+
}),
|
|
74
|
+
done: false
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this._current = undefined; // Reset current on end
|
|
79
|
+
return { value: undefined, done: true };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Access the current element
|
|
85
|
+
get current() {
|
|
86
|
+
return this._current;
|
|
87
|
+
}
|
|
88
|
+
// Custom end strategy or stop condition (could be expanded if needed)
|
|
89
|
+
isDone() {
|
|
90
|
+
return this.current === null;
|
|
91
|
+
}
|
|
47
92
|
/**
|
|
48
93
|
* This method marks the feature as completed and returns the result
|
|
49
94
|
* Uses to interrupt or end the feature processing
|
|
@@ -75,22 +120,13 @@ class A_Feature {
|
|
|
75
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
121
|
try {
|
|
77
122
|
this.state = A_Feature_types_1.A_TYPES__FeatureState.PROCESSING;
|
|
78
|
-
for (const
|
|
79
|
-
|
|
80
|
-
||
|
|
81
|
-
this.state === A_Feature_types_1.A_TYPES__FeatureState.COMPLETED) {
|
|
82
|
-
throw new Error('FEATURE_PROCESSING_INTERRUPTED');
|
|
83
|
-
}
|
|
84
|
-
const instance = A_Context_class_1.A_Context.scope(this).resolve(component);
|
|
85
|
-
if (instance[handler]) {
|
|
86
|
-
const callArgs = A_Context_class_1.A_Context.scope(this).resolve(args);
|
|
87
|
-
yield instance[handler](...callArgs);
|
|
88
|
-
}
|
|
123
|
+
for (const step of this) {
|
|
124
|
+
yield step();
|
|
89
125
|
}
|
|
90
126
|
yield this.completed();
|
|
91
127
|
}
|
|
92
128
|
catch (error) {
|
|
93
|
-
console.log('Feature processing error:', error);
|
|
129
|
+
console.log('[!] Feature processing error:', error);
|
|
94
130
|
yield this.failed(error);
|
|
95
131
|
}
|
|
96
132
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature.class.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iHAAoG;AACpG,iHAAoG;AACpG,
|
|
1
|
+
{"version":3,"file":"A-Feature.class.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iHAAoG;AACpG,iHAAoG;AACpG,uDAA6I;AAC7I,4CAA4D;AAC5D,kEAAyD;AAIzD;;;;;;;GAOG;AACH,MAAa,SAAS;IAGlB;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAeD,YACI,MAA0E;QAX9E,2BAA2B;QACjB,UAAK,GAA2B,EAAE,CAAC;QAEnC,WAAM,GAAW,CAAC,CAAC;QAE7B,UAAK,GAA0B,uCAAqB,CAAC,WAAW,CAAC;QAQ7D,6BAA6B;QAC7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE1B,2BAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAErC,CAAC;IAGD;;;;OAIG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,OAAO;YACH,qBAAqB;YACrB,IAAI,EAAE,GAAwD,EAAE;gBAC5D,IAA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,IAAI;yBAChB;qBACJ,CAAC,CAAC;gBAGP,KAAK,KAAK,YAAY,KAAK;uBACpB,KAAK,CAAC,OAAO,KAAK,gCAAgC;uBAClD,IAAI,CAAC,KAAK,KAAK,uCAAqB,CAAC,SAAS;oBAEjD,aAAa;oBACb,MAAM;gBAEV;oBACI,MAAM,KAAK,CAAC;YACpB,CAAC;QACL,CAAC;KAAA;CAGJ;AArLD,8BAqLC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { A_Component } from "../A-Component/A-Component.class";
|
|
2
|
+
import { A_TYPES__ComponentMeta_InjectionParam } from "../A-Component/A-Component.types";
|
|
1
3
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "../A-Scope/A-Scope.types";
|
|
4
|
+
export type A_TYPES__FeatureIteratorReturn<T extends any = any> = () => Promise<T>;
|
|
2
5
|
export type A_TYPES__FeatureConstructor = {
|
|
3
6
|
steps: A_TYPES__FeatureStep[];
|
|
4
7
|
} & A_TYPES__ScopeConstructor & A_TYPES__ScopeConfig;
|
|
@@ -9,9 +12,7 @@ export declare enum A_TYPES__FeatureState {
|
|
|
9
12
|
FAILED = "FAILED"
|
|
10
13
|
}
|
|
11
14
|
export type A_TYPES__FeatureStep = {
|
|
12
|
-
component:
|
|
13
|
-
new (...args: any[]): any;
|
|
14
|
-
};
|
|
15
|
+
component: typeof A_Component;
|
|
15
16
|
handler: string;
|
|
16
|
-
args:
|
|
17
|
+
args: A_TYPES__ComponentMeta_InjectionParam[];
|
|
17
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature.types.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"A-Feature.types.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.types.ts"],"names":[],"mappings":";;;AAYA,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC7B,oDAA2B,CAAA;IAC3B,kDAAyB,CAAA;IAEzB,gDAAuB,CAAA;IACvB,0CAAiB,CAAA;AACrB,CAAC,EANW,qBAAqB,qCAArB,qBAAqB,QAMhC"}
|
|
@@ -25,8 +25,7 @@ class A_Fragment {
|
|
|
25
25
|
/**
|
|
26
26
|
* Register the Namespace in the global Namespace provider
|
|
27
27
|
*/
|
|
28
|
-
this.name =
|
|
29
|
-
.register(this, this.name);
|
|
28
|
+
this.name = params.name || this.constructor.name;
|
|
30
29
|
/**
|
|
31
30
|
* Run Async Initialization
|
|
32
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Fragment.class.js","sourceRoot":"","sources":["../../../../src/global/A-Fragment/A-Fragment.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAyD;AAIzD;;;;;;;GAOG;AACH,MAAa,UAAU;IAWnB,YAAY,SAAgD,EAAE;QAE1D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEjD;;WAEG;QACH,IAAI,CAAC,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"A-Fragment.class.js","sourceRoot":"","sources":["../../../../src/global/A-Fragment/A-Fragment.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAyD;AAIzD;;;;;;;GAOG;AACH,MAAa,UAAU;IAWnB,YAAY,SAAgD,EAAE;QAE1D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEjD;;WAEG;QACH,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEjD;;WAEG;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAKO,YAAY,CAAC,EAA2B;QAC5C,OAAO,IAAI,CAAC,WAAW,KAAK,EAAE;YAC1B,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,CAAA;IACd,CAAC;IAED;;OAEG;IACW,IAAI;;YACd,IAAI,CAAC,IAAI,CAAC,KAAK;gBACX,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC/C,IAAI,CAAC;wBACD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;wBAE1B,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;wBAEpB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;wBAEzB,OAAO,OAAO,EAAE,CAAC;oBACrB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACb,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;oBACzB,CAAC;gBACL,CAAC,CAAA,CAAC,CAAC;;gBAEH,MAAM,IAAI,CAAC,KAAK,CAAC;QACzB,CAAC;KAAA;IAQD,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IAEjE;;;;OAIG;IACa,YAAY;;YACxB,OAAO;QACX,CAAC;KAAA;IAED;;OAEG;IACa,MAAM;;YAClB,8BAA8B;YAC9B,IAAI,2BAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;gBACvE,gDAAgD;gBAChD,+CAA+C;gBAC/C,0CAA0C;gBAC1C,oCAAoC;gBACpC,oCAAoC;gBACpC,MAAM;gBACN,mDAAmD;gBACnD,gDAAgD;gBAChD,oCAAoC;gBACpC,oCAAoC;gBACpC,MAAM;YACV,CAAC;QACL,CAAC;KAAA;IAED;;;;OAIG;IACa,WAAW;;YACvB,OAAO;QACX,CAAC;KAAA;CAEJ;AAzGD,gCAyGC"}
|
|
@@ -3,14 +3,88 @@
|
|
|
3
3
|
*
|
|
4
4
|
* [!] Meta can be different depending on the type of input data
|
|
5
5
|
*/
|
|
6
|
-
export declare class A_Meta<_StorageItems extends Record<string, any>> {
|
|
6
|
+
export declare class A_Meta<_StorageItems extends Record<string, any>> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
7
7
|
protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
|
|
8
|
+
/**
|
|
9
|
+
* Method to get the iterator for the meta object
|
|
10
|
+
*
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
[Symbol.iterator](): Iterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
14
|
+
/**
|
|
15
|
+
* Allows to replicate received meta object by replacing internal meta to the received one
|
|
16
|
+
*
|
|
17
|
+
* @param meta
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
8
20
|
from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
|
|
21
|
+
/**
|
|
22
|
+
* Method to set values in the map
|
|
23
|
+
*
|
|
24
|
+
* @param key
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
9
27
|
set<K extends keyof _StorageItems>(key: K, value: _StorageItems[K]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Method to get values from the map
|
|
30
|
+
*
|
|
31
|
+
* @param key
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
10
34
|
get<K extends keyof _StorageItems>(key: K): _StorageItems[K] | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Method to delete values from the map
|
|
37
|
+
*
|
|
38
|
+
* @param key
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
11
41
|
delete(key: keyof _StorageItems): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* This method is needed to convert the key to a regular expression and cover cases like:
|
|
44
|
+
*
|
|
45
|
+
* simple * e.g. "a*" instead of "a.*"
|
|
46
|
+
*
|
|
47
|
+
* simple ? e.g. "a?" instead of "a."
|
|
48
|
+
*
|
|
49
|
+
* etc.
|
|
50
|
+
*
|
|
51
|
+
* @param key
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
private convertToRegExp;
|
|
55
|
+
/**
|
|
56
|
+
* Method to find values in the map by name.
|
|
57
|
+
*
|
|
58
|
+
* Converts the Key in Map to a regular expression and then compares to the name
|
|
59
|
+
*
|
|
60
|
+
* @param name
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
find(name: string): [keyof _StorageItems, _StorageItems[keyof _StorageItems]][];
|
|
64
|
+
/**
|
|
65
|
+
* Method to find values in the map by regular expression
|
|
66
|
+
*
|
|
67
|
+
* Compares Map Key to the input regular expression
|
|
68
|
+
*
|
|
69
|
+
* @param regex
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
12
72
|
findByRegex(regex: RegExp): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
73
|
+
/**
|
|
74
|
+
* Method to check if the map has a specific key
|
|
75
|
+
*
|
|
76
|
+
* @param key
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
13
79
|
has(key: keyof _StorageItems): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Method to get the size of the map
|
|
82
|
+
*
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
14
85
|
entries(): IterableIterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
86
|
+
/**
|
|
87
|
+
* Method to clear the map
|
|
88
|
+
*/
|
|
15
89
|
clear(): void;
|
|
16
90
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.A_Meta = void 0;
|
|
4
10
|
/**
|
|
@@ -10,14 +16,36 @@ class A_Meta {
|
|
|
10
16
|
constructor() {
|
|
11
17
|
this.meta = new Map();
|
|
12
18
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Method to get the iterator for the meta object
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
[Symbol.iterator]() {
|
|
25
|
+
const iterator = this.meta.entries();
|
|
26
|
+
return {
|
|
27
|
+
next: () => iterator.next()
|
|
28
|
+
};
|
|
16
29
|
}
|
|
17
30
|
// ===================================================================================================
|
|
18
31
|
// ================================ META OPERATIONS ==================================================
|
|
19
32
|
// ===================================================================================================
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Allows to replicate received meta object by replacing internal meta to the received one
|
|
35
|
+
*
|
|
36
|
+
* @param meta
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
from(meta) {
|
|
40
|
+
this.meta = new Map(meta.meta);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Method to set values in the map
|
|
45
|
+
*
|
|
46
|
+
* @param key
|
|
47
|
+
* @param value
|
|
48
|
+
*/
|
|
21
49
|
set(key, value) {
|
|
22
50
|
const inheritedValue = this.meta.get(key)
|
|
23
51
|
|| Array.isArray(value)
|
|
@@ -34,15 +62,66 @@ class A_Meta {
|
|
|
34
62
|
: Object.assign({}, inheritedValue);
|
|
35
63
|
this.meta.set(key, value);
|
|
36
64
|
}
|
|
37
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Method to get values from the map
|
|
67
|
+
*
|
|
68
|
+
* @param key
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
38
71
|
get(key) {
|
|
39
72
|
return this.meta.get(key);
|
|
40
73
|
}
|
|
41
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Method to delete values from the map
|
|
76
|
+
*
|
|
77
|
+
* @param key
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
42
80
|
delete(key) {
|
|
43
81
|
return this.meta.delete(key);
|
|
44
82
|
}
|
|
45
|
-
|
|
83
|
+
/**
|
|
84
|
+
* This method is needed to convert the key to a regular expression and cover cases like:
|
|
85
|
+
*
|
|
86
|
+
* simple * e.g. "a*" instead of "a.*"
|
|
87
|
+
*
|
|
88
|
+
* simple ? e.g. "a?" instead of "a."
|
|
89
|
+
*
|
|
90
|
+
* etc.
|
|
91
|
+
*
|
|
92
|
+
* @param key
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
convertToRegExp(key) {
|
|
96
|
+
return key instanceof RegExp
|
|
97
|
+
? key
|
|
98
|
+
: new RegExp(key);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Method to find values in the map by name.
|
|
102
|
+
*
|
|
103
|
+
* Converts the Key in Map to a regular expression and then compares to the name
|
|
104
|
+
*
|
|
105
|
+
* @param name
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
find(name) {
|
|
109
|
+
const results = [];
|
|
110
|
+
for (const [key, value] of this.meta.entries()) {
|
|
111
|
+
if (this.convertToRegExp(name).test(key)) {
|
|
112
|
+
results.push([key, value]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return results;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Method to find values in the map by regular expression
|
|
119
|
+
*
|
|
120
|
+
* Compares Map Key to the input regular expression
|
|
121
|
+
*
|
|
122
|
+
* @param regex
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
46
125
|
findByRegex(regex) {
|
|
47
126
|
const results = [];
|
|
48
127
|
for (const [key, value] of this.meta.entries()) {
|
|
@@ -52,15 +131,26 @@ class A_Meta {
|
|
|
52
131
|
}
|
|
53
132
|
return results;
|
|
54
133
|
}
|
|
55
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Method to check if the map has a specific key
|
|
136
|
+
*
|
|
137
|
+
* @param key
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
56
140
|
has(key) {
|
|
57
141
|
return this.meta.has(key);
|
|
58
142
|
}
|
|
59
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Method to get the size of the map
|
|
145
|
+
*
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
60
148
|
entries() {
|
|
61
149
|
return this.meta.entries();
|
|
62
150
|
}
|
|
63
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Method to clear the map
|
|
153
|
+
*/
|
|
64
154
|
clear() {
|
|
65
155
|
this.meta.clear();
|
|
66
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Meta.class.js","sourceRoot":"","sources":["../../../../src/global/A-Meta/A-Meta.class.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"A-Meta.class.js","sourceRoot":"","sources":["../../../../src/global/A-Meta/A-Meta.class.ts"],"names":[],"mappings":";AAAA,GAAG;AACH,GAAG;AACH,GAAG;AACH,GAAG;AACH,GAAG;AACH,GAAG;;;AAGH;;;;GAIG;AACH,MAAa,MAAM;IAAnB;QAKc,SAAI,GAAiE,IAAI,GAAG,EAAE,CAAC;IAyK7F,CAAC;IAtKG;;;;OAIG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO;YACH,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE;SAC9B,CAAC;IACN,CAAC;IAID,sGAAsG;IACtG,sGAAsG;IACtG,sGAAsG;IACtG;;;;;OAKG;IACH,IAAI,CACA,IAA2B;QAE3B,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAGD;;;;;OAKG;IACH,GAAG,CAAgC,GAAM,EAAE,KAAuB;QAE9D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;eAClC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACvB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAE,KAAa,YAAY,GAAG;gBAC3B,CAAC,CAAC,IAAI,GAAG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OAOG;IACH,WAAW,CAAC,KAAa;QACrB,MAAM,OAAO,GAAqE,EAAE,CAAC;QACrF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAGD;;;;;OAKG;IACH,GAAG,CAAC,GAAwB;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAGD;;;;OAIG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAGD;;OAEG;IACH,KAAK;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACJ;AA9KD,wBA8KC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "./A-Scope.types";
|
|
2
2
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
3
|
+
import { A_TYPES__ComponentMeta_InjectionParam } from "../A-Component/A-Component.types";
|
|
4
|
+
import { A_Component } from "../A-Component/A-Component.class";
|
|
5
|
+
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
3
6
|
/**
|
|
4
7
|
*
|
|
5
8
|
*
|
|
@@ -17,6 +20,7 @@ export declare class A_Scope {
|
|
|
17
20
|
name: string;
|
|
18
21
|
private _components;
|
|
19
22
|
private _fragments;
|
|
23
|
+
private _entities;
|
|
20
24
|
private parent?;
|
|
21
25
|
protected params: A_TYPES__ScopeConstructor;
|
|
22
26
|
constructor(params: Partial<A_TYPES__ScopeConstructor>, config?: Partial<A_TYPES__ScopeConfig>);
|
|
@@ -39,13 +43,18 @@ export declare class A_Scope {
|
|
|
39
43
|
* @param component
|
|
40
44
|
* @returns
|
|
41
45
|
*/
|
|
42
|
-
resolve<T extends
|
|
43
|
-
|
|
44
|
-
}>(component: T): InstanceType<T>;
|
|
45
|
-
resolve<T extends {
|
|
46
|
-
new (...args: any[]): any;
|
|
47
|
-
}>(component: Array<T>): Array<InstanceType<T>>;
|
|
46
|
+
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(component: T): InstanceType<T>;
|
|
47
|
+
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(component: Array<T>): Array<InstanceType<T>>;
|
|
48
48
|
private resolveOnce;
|
|
49
49
|
private resolveFragment;
|
|
50
|
+
private resolveScope;
|
|
51
|
+
private resolveComponent;
|
|
52
|
+
/**
|
|
53
|
+
* This method is used to register the component in the scope
|
|
54
|
+
*
|
|
55
|
+
* @param fragment
|
|
56
|
+
*/
|
|
57
|
+
register(fragment: A_Entity): void;
|
|
58
|
+
register(fragment: A_Component): void;
|
|
50
59
|
register(fragment: A_Fragment): void;
|
|
51
60
|
}
|