@adaas/a-concept 0.2.14 → 0.3.2
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/.conf/tsconfig.base.json +91 -0
- package/.conf/tsconfig.browser.json +36 -0
- package/.conf/tsconfig.node.json +40 -0
- package/dist/browser/index.d.mts +4188 -212
- package/dist/browser/index.mjs +2 -67
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/index.cjs +5810 -383
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.mts +4215 -212
- package/dist/node/index.d.ts +4215 -212
- package/dist/node/index.mjs +5751 -66
- package/dist/node/index.mjs.map +1 -1
- package/jest.config.ts +30 -15
- package/package.json +19 -16
- package/src/env/env-browser.ts +38 -1
- package/src/env/env-node.ts +26 -2
- package/src/env/env.base.ts +21 -2
- package/src/env/global.browser.d.ts +1 -1
- package/src/helpers/A_BasicTypeGuards.helper.ts +81 -0
- package/src/helpers/A_Common.helper.ts +2 -2
- package/src/helpers/A_Identity.helper.ts +2 -4
- package/src/helpers/A_TypeGuards.helper.ts +45 -30
- package/src/helpers/index.ts +5 -0
- package/src/index.ts +21 -94
- package/src/{global → lib}/A-Abstraction/A-Abstraction-Extend.decorator.ts +18 -13
- package/src/{global → lib}/A-Abstraction/A-Abstraction.class.ts +5 -5
- package/src/{global → lib}/A-Abstraction/A-Abstraction.error.ts +1 -1
- package/src/{global → lib}/A-Abstraction/A-Abstraction.types.ts +5 -5
- package/src/lib/A-Abstraction/index.ts +8 -0
- package/src/{global → lib}/A-Caller/A_Caller.class.ts +3 -4
- package/src/{global → lib}/A-Caller/A_Caller.error.ts +1 -4
- package/src/{global → lib}/A-Caller/A_Caller.types.ts +4 -4
- package/src/lib/A-Caller/index.ts +3 -0
- package/src/{global → lib}/A-Component/A-Component.class.ts +2 -3
- package/src/{global → lib}/A-Component/A-Component.meta.ts +5 -5
- package/src/{global → lib}/A-Component/A-Component.types.ts +5 -5
- package/src/lib/A-Component/index.ts +5 -0
- package/src/{global → lib}/A-Concept/A-Concept.class.ts +9 -7
- package/src/{global → lib}/A-Concept/A-Concept.meta.ts +2 -2
- package/src/{global → lib}/A-Concept/A-Concept.types.ts +7 -7
- package/src/lib/A-Concept/index.ts +4 -0
- package/src/{global → lib}/A-Container/A-Container.class.ts +3 -3
- package/src/{global → lib}/A-Container/A-Container.meta.ts +11 -6
- package/src/{global → lib}/A-Container/A-Container.types.ts +9 -6
- package/src/lib/A-Container/index.ts +5 -0
- package/src/{global → lib}/A-Context/A-Context.class.ts +53 -42
- package/src/{global → lib}/A-Context/A-Context.error.ts +1 -1
- package/src/lib/A-Context/A-Context.types.ts +14 -0
- package/src/lib/A-Context/index.ts +5 -0
- package/src/{global → lib}/A-Dependency/A-Dependency-All.decorator.ts +11 -11
- package/src/{global → lib}/A-Dependency/A-Dependency-Default.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency-Flat.decorator.ts +11 -8
- package/src/{global → lib}/A-Dependency/A-Dependency-Load.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency-Parent.decorator.ts +11 -9
- package/src/lib/A-Dependency/A-Dependency-Query.decorator.ts +90 -0
- package/src/{global → lib}/A-Dependency/A-Dependency-Require.decorator.ts +11 -9
- package/src/{global → lib}/A-Dependency/A-Dependency.class.ts +20 -3
- package/src/{global → lib}/A-Dependency/A-Dependency.error.ts +1 -1
- package/src/{global → lib}/A-Dependency/A-Dependency.types.ts +20 -9
- package/src/lib/A-Dependency/index.ts +18 -0
- package/src/{global → lib}/A-Entity/A-Entity.class.ts +11 -9
- package/src/{global → lib}/A-Entity/A-Entity.error.ts +1 -1
- package/src/{global → lib}/A-Entity/A-Entity.meta.ts +3 -3
- package/src/{global → lib}/A-Entity/A-Entity.types.ts +5 -5
- package/src/lib/A-Entity/index.ts +5 -0
- package/src/{global → lib}/A-Error/A_Error.class.ts +13 -13
- package/src/{global → lib}/A-Error/A_Error.types.ts +2 -2
- package/src/lib/A-Error/index.ts +3 -0
- package/src/{global → lib}/A-Feature/A-Feature-Define.decorator.ts +16 -10
- package/src/{global → lib}/A-Feature/A-Feature-Extend.decorator.ts +13 -9
- package/src/{global → lib}/A-Feature/A-Feature.class.ts +15 -13
- package/src/{global → lib}/A-Feature/A-Feature.error.ts +2 -2
- package/src/{global → lib}/A-Feature/A-Feature.types.ts +21 -12
- package/src/lib/A-Feature/index.ts +13 -0
- package/src/{global → lib}/A-Fragment/A-Fragment.class.ts +0 -2
- package/src/{global → lib}/A-Fragment/A-Fragment.types.ts +1 -1
- package/src/lib/A-Fragment/index.ts +5 -0
- package/src/{global → lib}/A-Inject/A-Inject.decorator.ts +42 -24
- package/src/{global → lib}/A-Inject/A-Inject.error.ts +1 -1
- package/src/{global → lib}/A-Inject/A-Inject.types.ts +3 -9
- package/src/lib/A-Inject/index.ts +3 -0
- package/src/{global → lib}/A-Meta/A-Meta.decorator.ts +2 -2
- package/src/{global → lib}/A-Meta/A-Meta.types.ts +18 -10
- package/src/lib/A-Meta/index.ts +11 -0
- package/src/{global → lib}/A-Scope/A-Scope.class.ts +37 -25
- package/src/{global → lib}/A-Scope/A-Scope.error.ts +1 -1
- package/src/{global → lib}/A-Scope/A-Scope.types.ts +23 -15
- package/src/lib/A-Scope/index.ts +5 -0
- package/src/{global → lib}/A-Stage/A-Stage.class.ts +9 -10
- package/src/{global → lib}/A-Stage/A-Stage.error.ts +1 -1
- package/src/{global → lib}/A-Stage/A-Stage.types.ts +1 -4
- package/src/lib/A-Stage/index.ts +5 -0
- package/src/{global → lib}/A-StepManager/A-StepManager.class.ts +8 -4
- package/src/{global → lib}/A-StepManager/A-StepManager.error.ts +1 -1
- package/src/lib/A-StepManager/index.ts +4 -0
- package/src/{global → lib}/ASEID/ASEID.class.ts +20 -23
- package/src/lib/ASEID/ASEID.error.ts +12 -0
- package/src/lib/ASEID/index.ts +4 -0
- package/src/types/A_identity.types.ts +4 -0
- package/src/types/index.ts +2 -0
- package/tests/A-Abstraction.test.ts +6 -6
- package/tests/A-Common.test.ts +6 -4
- package/tests/A-Component.test.ts +7 -5
- package/tests/A-Concept.test.ts +13 -11
- package/tests/A-Container.test.ts +4 -3
- package/tests/A-Dependency.test.ts +73 -1
- package/tests/A-Entity.test.ts +108 -5
- package/tests/A-Error.test.ts +7 -4
- package/tests/A-Feature.test.ts +12 -8
- package/tests/A-Fragment.test.ts +1 -2
- package/tests/A-Inject.test.ts +4 -1
- package/tests/A-Meta.test.ts +12 -10
- package/tests/A-Scope.test.ts +11 -10
- package/tests/A-StepManager.test.ts +3 -3
- package/tests/ASEID.test.ts +2 -2
- package/tests/jest.setup.ts +23 -23
- package/tsconfig.json +59 -97
- package/tsup.config.ts +18 -13
- package/dist/browser/A-Context.types-BtR_HJ0j.d.mts +0 -3828
- package/dist/browser/env.d.mts +0 -64
- package/dist/browser/env.mjs +0 -3
- package/dist/browser/env.mjs.map +0 -1
- package/dist/node/A-Context.types-BtR_HJ0j.d.mts +0 -3828
- package/dist/node/A-Context.types-BtR_HJ0j.d.ts +0 -3828
- package/dist/node/env.cjs +0 -12
- package/dist/node/env.cjs.map +0 -1
- package/dist/node/env.d.mts +0 -91
- package/dist/node/env.d.ts +0 -91
- package/dist/node/env.js +0 -12
- package/dist/node/env.js.map +0 -1
- package/dist/node/env.mjs +0 -3
- package/dist/node/env.mjs.map +0 -1
- package/dist/node/index.js +0 -387
- package/dist/node/index.js.map +0 -1
- package/src/global/A-Context/A-Context.types.ts +0 -14
- package/src/global/ASEID/ASEID.error.ts +0 -12
- /package/src/{global → lib}/A-Component/A-Component.constants.ts +0 -0
- /package/src/{global → lib}/A-Concept/A-Concept.constants.ts +0 -0
- /package/src/{global → lib}/A-Container/A-Container.constants.ts +0 -0
- /package/src/{global → lib}/A-Entity/A-Entity.constants.ts +0 -0
- /package/src/{global → lib}/A-Error/A_Error.constants.ts +0 -0
- /package/src/{global → lib}/A-Meta/A-Meta.class.ts +0 -0
- /package/src/{global → lib}/ASEID/ASEID.constants.ts +0 -0
- /package/src/{global → lib}/ASEID/ASEID.types.ts +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
3
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
4
|
+
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/a-component";
|
|
5
|
+
import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/a-container";
|
|
6
|
+
import { A_TYPES__A_Dependency_EntityInjectionPagination, A_TYPES__A_Dependency_EntityInjectionQuery, A_TYPES__A_Dependency_EntityResolutionConfig, A_TYPES__A_Dependency_QueryDecoratorReturn } from "./A-Dependency.types";
|
|
7
|
+
import { A_DependencyError } from "./A-Dependency.error";
|
|
8
|
+
import type { A_Entity } from "@adaas/a-concept/a-entity";
|
|
9
|
+
import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/a-entity";
|
|
10
|
+
import {
|
|
11
|
+
A_TYPES__A_InjectDecorator_Meta,
|
|
12
|
+
A_TYPES__InjectableTargets
|
|
13
|
+
} from "@adaas/a-concept/a-inject";
|
|
14
|
+
import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
15
|
+
import { A_CommonHelper } from "@adaas/a-concept/helpers/A_Common.helper";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Query Decorator is only applicable for Entities since Scope instance may have multiple entities but only one component or container, so there is no need for such complex resolution strategies for them, but for entities it is a common case to have multiple instances and need to specify which one(s) to inject.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @param query
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function A_Dependency_Query<T extends A_Entity = A_Entity>(
|
|
25
|
+
query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>,
|
|
26
|
+
pagination?: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>
|
|
27
|
+
): A_TYPES__A_Dependency_QueryDecoratorReturn {
|
|
28
|
+
|
|
29
|
+
return function (
|
|
30
|
+
target: A_TYPES__InjectableTargets,
|
|
31
|
+
methodName: string | symbol | undefined,
|
|
32
|
+
parameterIndex: number
|
|
33
|
+
) {
|
|
34
|
+
// for Error handling purposes
|
|
35
|
+
const componentName = A_CommonHelper.getComponentName(target)
|
|
36
|
+
|
|
37
|
+
if (!A_TypeGuards.isTargetAvailableForInjection(target)) {
|
|
38
|
+
throw new A_DependencyError(
|
|
39
|
+
A_DependencyError.InvalidDependencyTarget,
|
|
40
|
+
`A-All cannot be used on the target of type ${typeof target} (${componentName})`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// determine the method name or 'constructor' for constructor injections
|
|
45
|
+
const method = methodName ? String(methodName) : 'constructor';
|
|
46
|
+
let metaKey;
|
|
47
|
+
|
|
48
|
+
switch (true) {
|
|
49
|
+
case A_TypeGuards.isComponentConstructor(target) || A_TypeGuards.isComponentInstance(target):
|
|
50
|
+
metaKey = A_TYPES__ComponentMetaKey.INJECTIONS;
|
|
51
|
+
break;
|
|
52
|
+
|
|
53
|
+
case A_TypeGuards.isContainerInstance(target):
|
|
54
|
+
metaKey = A_TYPES__ContainerMetaKey.INJECTIONS;
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case A_TypeGuards.isEntityInstance(target):
|
|
58
|
+
metaKey = A_TYPES__EntityMetaKey.INJECTIONS;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// get existing meta or create a new one
|
|
63
|
+
const existedMeta = A_Context.meta(target).get(metaKey) || new A_Meta();
|
|
64
|
+
// get existing injections for the method or create a new array
|
|
65
|
+
const paramsArray: A_TYPES__A_InjectDecorator_Meta = existedMeta.get(method) || [];
|
|
66
|
+
|
|
67
|
+
// set the parameter injection info
|
|
68
|
+
paramsArray[parameterIndex].resolutionStrategy = {
|
|
69
|
+
query: {
|
|
70
|
+
...paramsArray[parameterIndex].resolutionStrategy.query,
|
|
71
|
+
...query
|
|
72
|
+
},
|
|
73
|
+
pagination: {
|
|
74
|
+
...paramsArray[parameterIndex].resolutionStrategy.pagination,
|
|
75
|
+
...pagination
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// save back the updated injections array
|
|
80
|
+
existedMeta.set(method, paramsArray);
|
|
81
|
+
|
|
82
|
+
// save back the updated meta info
|
|
83
|
+
A_Context
|
|
84
|
+
.meta(target)
|
|
85
|
+
.set(
|
|
86
|
+
metaKey,
|
|
87
|
+
existedMeta
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.constants";
|
|
6
|
-
import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
7
|
-
import { A_TYPES__A_InjectDecorator_Meta, A_TYPES__InjectableTargets } from "../A-Inject/A-Inject.types";
|
|
1
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
2
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
3
|
+
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/a-component";
|
|
4
|
+
import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/a-container";
|
|
8
5
|
import { A_TYPES__A_Dependency_RequireDecoratorReturn } from "./A-Dependency.types";
|
|
9
6
|
import { A_DependencyError } from "./A-Dependency.error";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/a-entity";
|
|
8
|
+
import {
|
|
9
|
+
A_TYPES__A_InjectDecorator_Meta,
|
|
10
|
+
A_TYPES__InjectableTargets
|
|
11
|
+
} from "@adaas/a-concept/a-inject";
|
|
12
|
+
import { A_TypeGuards} from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
13
|
+
import { A_CommonHelper} from "@adaas/a-concept/helpers/A_Common.helper";
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { A_CommonHelper
|
|
1
|
+
import { A_CommonHelper} from "@adaas/a-concept/helpers/A_Common.helper";
|
|
2
2
|
import { A_Dependency_Default } from "./A-Dependency-Default.decorator";
|
|
3
3
|
import { A_Dependency_Flat } from "./A-Dependency-Flat.decorator";
|
|
4
4
|
import { A_Dependency_Load } from "./A-Dependency-Load.decorator";
|
|
5
5
|
import { A_Dependency_Parent } from "./A-Dependency-Parent.decorator";
|
|
6
6
|
import { A_Dependency_Require } from "./A-Dependency-Require.decorator";
|
|
7
7
|
import { A_DependencyError } from "./A-Dependency.error";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
A_TYPES__A_Dependency_EntityInjectionPagination,
|
|
10
|
+
A_TYPES__A_Dependency_EntityInjectionQuery,
|
|
11
|
+
A_TYPES__A_Dependency_Serialized,
|
|
12
|
+
A_TYPES__A_DependencyInjectable,
|
|
13
|
+
A_TYPES__A_DependencyResolutionStrategy
|
|
14
|
+
} from "./A-Dependency.types";
|
|
15
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
10
16
|
import { A_Dependency_All } from "./A-Dependency-All.decorator";
|
|
17
|
+
import { A_Dependency_Query } from "./A-Dependency-Query.decorator";
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
export class A_Dependency<
|
|
@@ -68,6 +75,16 @@ export class A_Dependency<
|
|
|
68
75
|
return A_Dependency_All;
|
|
69
76
|
}
|
|
70
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Allows to indicate that the dependency should be resolved by specific query parameters
|
|
80
|
+
* e.g. by ASEID, name, type, custom properties, etc.
|
|
81
|
+
*
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
84
|
+
static get Query(): typeof A_Dependency_Query {
|
|
85
|
+
return A_Dependency_Query;
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
protected _name: string;
|
|
72
89
|
protected _target?: A_TYPES__Ctor<T>;
|
|
73
90
|
protected _resolutionStrategy!: A_TYPES__A_DependencyResolutionStrategy;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// ==================================== A-Dependency types ==================================== //
|
|
2
2
|
|
|
3
|
-
import { A_TYPES__Ctor } from "@adaas/a-concept/types
|
|
4
|
-
import { A_Caller } from "
|
|
5
|
-
import { A_Component } from "
|
|
6
|
-
import { A_Container } from "
|
|
7
|
-
import { A_Entity } from "
|
|
8
|
-
import { A_Error } from "
|
|
9
|
-
import { A_Feature } from "
|
|
10
|
-
import { A_Fragment } from "
|
|
3
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
4
|
+
import { A_Caller } from "@adaas/a-concept/a-caller";
|
|
5
|
+
import { A_Component } from "@adaas/a-concept/a-component";
|
|
6
|
+
import { A_Container } from "@adaas/a-concept/a-container";
|
|
7
|
+
import { A_Entity, A_TYPES__Entity_Constructor } from "@adaas/a-concept/a-entity"
|
|
8
|
+
import { A_Error } from "@adaas/a-concept/a-error";
|
|
9
|
+
import { A_Feature } from "@adaas/a-concept/a-feature";
|
|
10
|
+
import { A_Fragment } from "@adaas/a-concept/a-fragment";
|
|
11
|
+
import { A_Scope } from "@adaas/a-concept/a-scope";
|
|
11
12
|
import { A_Dependency } from "./A-Dependency.class";
|
|
12
|
-
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// ===========================================================================================
|
|
@@ -163,3 +163,14 @@ export type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (
|
|
|
163
163
|
propertyKey: string | symbol | undefined,
|
|
164
164
|
parameterIndex: number
|
|
165
165
|
) => void
|
|
166
|
+
|
|
167
|
+
export type A_TYPES__A_Dependency_QueryTarget<T extends A_Entity = A_Entity> = T
|
|
168
|
+
| A_TYPES__Entity_Constructor<T>
|
|
169
|
+
/**
|
|
170
|
+
* A-Dependency Query decorator return type
|
|
171
|
+
*/
|
|
172
|
+
export type A_TYPES__A_Dependency_QueryDecoratorReturn<T = any> = (
|
|
173
|
+
target: T,
|
|
174
|
+
propertyKey: string | symbol | undefined,
|
|
175
|
+
parameterIndex: number
|
|
176
|
+
) => void
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { A_Dependency } from './A-Dependency.class'
|
|
2
|
+
// export {A_DependencyMeta} from './A-Dependency.meta'
|
|
3
|
+
export { A_DependencyError } from './A-Dependency.error'
|
|
4
|
+
export * from './A-Dependency.types'
|
|
5
|
+
// export * from './A-Dependency.constants'
|
|
6
|
+
|
|
7
|
+
// --------------------------------------------------------
|
|
8
|
+
// -----------------------Decorators-----------------------
|
|
9
|
+
// --------------------------------------------------------
|
|
10
|
+
export { A_Dependency_All } from './A-Dependency-All.decorator';
|
|
11
|
+
export { A_Dependency_Default } from './A-Dependency-Default.decorator';
|
|
12
|
+
export { A_Dependency_Flat } from './A-Dependency-Flat.decorator';
|
|
13
|
+
export { A_Dependency_Load } from './A-Dependency-Load.decorator';
|
|
14
|
+
export { A_Dependency_Parent } from './A-Dependency-Parent.decorator';
|
|
15
|
+
export { A_Dependency_Require } from './A-Dependency-Require.decorator';
|
|
16
|
+
export { A_Dependency_Query } from './A-Dependency-Query.decorator';
|
|
17
|
+
|
|
18
|
+
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
1
2
|
import {
|
|
2
3
|
A_TYPES__Entity_Serialized,
|
|
3
4
|
A_TYPES__Entity_Init,
|
|
4
5
|
A_TYPES__IEntity,
|
|
5
6
|
} from "./A-Entity.types";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { A_Scope } from "@adaas/a-concept/a-scope";
|
|
8
|
+
import { A_FormatterHelper} from "@adaas/a-concept/helpers/A_Formatter.helper";
|
|
9
|
+
import { A_IdentityHelper} from "@adaas/a-concept/helpers/A_Identity.helper";
|
|
10
|
+
import {
|
|
11
|
+
ASEID,
|
|
12
|
+
A_TYPES__ASEID_Constructor
|
|
13
|
+
} from "@adaas/a-concept/aseid";
|
|
11
14
|
import { A_EntityError } from "./A-Entity.error";
|
|
12
|
-
import { A_Feature } from "
|
|
13
|
-
import { A_TYPES__ASEID_Constructor } from "../ASEID/ASEID.types";
|
|
15
|
+
import { A_Feature } from "@adaas/a-concept/a-feature";
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -337,7 +339,7 @@ export class A_Entity<
|
|
|
337
339
|
*/
|
|
338
340
|
fromUndefined(): void {
|
|
339
341
|
this.aseid = this.generateASEID();
|
|
340
|
-
|
|
342
|
+
|
|
341
343
|
return;
|
|
342
344
|
}
|
|
343
345
|
|
|
@@ -350,7 +352,7 @@ export class A_Entity<
|
|
|
350
352
|
* @returns
|
|
351
353
|
*/
|
|
352
354
|
fromNew(newEntity: _ConstructorType): void {
|
|
353
|
-
this.aseid =
|
|
355
|
+
this.aseid = this.generateASEID();
|
|
354
356
|
|
|
355
357
|
return;
|
|
356
358
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A_Meta } from "
|
|
1
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
2
2
|
import { A_TYPES__EntityMeta } from "./A-Entity.types";
|
|
3
3
|
import { A_TYPES__EntityMetaKey } from "./A-Entity.constants";
|
|
4
|
-
import { A_TYPES__FeatureDefineDecoratorMeta } from "
|
|
5
|
-
import { A_TYPES__A_InjectDecorator_Meta } from "
|
|
4
|
+
import { A_TYPES__FeatureDefineDecoratorMeta } from "@adaas/a-concept/a-feature";
|
|
5
|
+
import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/a-inject";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export class A_EntityMeta extends A_Meta<A_TYPES__EntityMeta> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A_Meta } from "
|
|
1
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
2
2
|
import { A_Entity } from "./A-Entity.class";
|
|
3
|
-
import { ASEID } from "
|
|
3
|
+
import { ASEID } from "@adaas/a-concept/aseid";
|
|
4
4
|
import { A_TYPES__EntityMetaKey } from "./A-Entity.constants";
|
|
5
|
-
import { A_TYPES__FeatureDefineDecoratorMeta, A_TYPES__FeatureExtendDecoratorMeta } from "
|
|
6
|
-
import { A_TYPES__A_InjectDecorator_Meta } from "
|
|
7
|
-
import { A_TYPES__Ctor } from "@adaas/a-concept/types
|
|
5
|
+
import { A_TYPES__FeatureDefineDecoratorMeta, A_TYPES__FeatureExtendDecoratorMeta } from "@adaas/a-concept/a-feature";
|
|
6
|
+
import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/a-inject";
|
|
7
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { A_Context } from '@adaas/a-concept/a-context';
|
|
1
2
|
import {
|
|
2
3
|
A_TYPES__Error_Init,
|
|
3
4
|
A_TYPES__Error_Serialized
|
|
@@ -7,9 +8,8 @@ import {
|
|
|
7
8
|
A_CONSTANTS__ERROR_DESCRIPTION
|
|
8
9
|
} from './A_Error.constants';
|
|
9
10
|
import { A_FormatterHelper } from '@adaas/a-concept/helpers/A_Formatter.helper';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ASEID } from '../ASEID/ASEID.class';
|
|
11
|
+
import { A_BasicTypeGuards } from '@adaas/a-concept/helpers/A_BasicTypeGuards.helper';
|
|
12
|
+
import { ASEID } from '@adaas/a-concept/aseid';
|
|
13
13
|
import { A_CONCEPT_ENV } from '@adaas/a-concept/env';
|
|
14
14
|
|
|
15
15
|
|
|
@@ -163,23 +163,23 @@ export class A_Error<
|
|
|
163
163
|
super(param1.message);
|
|
164
164
|
break;
|
|
165
165
|
|
|
166
|
-
case
|
|
166
|
+
case A_BasicTypeGuards.isErrorSerializedType<_SerializedType>(param1):
|
|
167
167
|
super(param1.message);
|
|
168
168
|
break;
|
|
169
169
|
|
|
170
|
-
case
|
|
170
|
+
case A_BasicTypeGuards.isErrorConstructorType<_ConstructorType>(param1) && 'description' in param1:
|
|
171
171
|
super(`[${param1.title}]: ${param1.description}`);
|
|
172
172
|
break;
|
|
173
173
|
|
|
174
|
-
case
|
|
174
|
+
case A_BasicTypeGuards.isErrorConstructorType<_ConstructorType>(param1) && !('description' in param1):
|
|
175
175
|
super(param1.title);
|
|
176
176
|
break;
|
|
177
177
|
|
|
178
|
-
case
|
|
178
|
+
case A_BasicTypeGuards.isString(param1) && !param2:
|
|
179
179
|
super(param1);
|
|
180
180
|
break;
|
|
181
181
|
|
|
182
|
-
case
|
|
182
|
+
case A_BasicTypeGuards.isString(param1) && !!param2:
|
|
183
183
|
super(`[${param1}]: ${param2}`);
|
|
184
184
|
break;
|
|
185
185
|
|
|
@@ -313,19 +313,19 @@ export class A_Error<
|
|
|
313
313
|
): (param1: any, param2: any) => void | (() => void) {
|
|
314
314
|
switch (true) {
|
|
315
315
|
|
|
316
|
-
case
|
|
316
|
+
case A_BasicTypeGuards.isString(param1) && !param2:
|
|
317
317
|
return this.fromMessage;
|
|
318
318
|
|
|
319
|
-
case
|
|
319
|
+
case A_BasicTypeGuards.isString(param1) && !!param2:
|
|
320
320
|
return this.fromTitle;
|
|
321
321
|
|
|
322
322
|
case param1 instanceof Error:
|
|
323
323
|
return this.fromError;
|
|
324
324
|
|
|
325
|
-
case
|
|
325
|
+
case A_BasicTypeGuards.isErrorSerializedType<_SerializedType>(param1):
|
|
326
326
|
return this.fromJSON;
|
|
327
327
|
|
|
328
|
-
case
|
|
328
|
+
case A_BasicTypeGuards.isErrorConstructorType<_ConstructorType>(param1):
|
|
329
329
|
return this.fromConstructor;
|
|
330
330
|
|
|
331
331
|
default: {
|
|
@@ -418,7 +418,7 @@ export class A_Error<
|
|
|
418
418
|
|
|
419
419
|
this._title = params.title;
|
|
420
420
|
this._code = params.code;
|
|
421
|
-
this._scope = params.scope ? (
|
|
421
|
+
this._scope = params.scope ? (A_BasicTypeGuards.isScopeInstance(params.scope) ? (params.scope as any).name : params.scope) : undefined;
|
|
422
422
|
|
|
423
423
|
this._aseid = new ASEID({
|
|
424
424
|
concept: (this.constructor as typeof A_Error).concept,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A_TYPES__Ctor } from "@adaas/a-concept/types
|
|
2
|
-
import { A_Scope } from "
|
|
1
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
2
|
+
import { A_Scope } from "@adaas/a-concept/a-scope";
|
|
3
3
|
import { A_Error } from "./A_Error.class";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -4,17 +4,23 @@ import {
|
|
|
4
4
|
A_TYPES__FeatureDefineDecoratorMeta,
|
|
5
5
|
A_TYPES__FeatureDefineDecoratorTarget
|
|
6
6
|
} from "./A-Feature.types";
|
|
7
|
-
import { A_Context } from "@adaas/a-concept/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
8
|
+
import {
|
|
9
|
+
A_EntityMeta,
|
|
10
|
+
A_TYPES__EntityMetaKey
|
|
11
|
+
} from "@adaas/a-concept/a-entity";
|
|
12
|
+
import {
|
|
13
|
+
A_ContainerMeta,
|
|
14
|
+
A_TYPES__ContainerMetaKey
|
|
15
|
+
} from "@adaas/a-concept/a-container";
|
|
16
|
+
import {
|
|
17
|
+
A_ComponentMeta,
|
|
18
|
+
A_TYPES__ComponentMetaKey
|
|
19
|
+
} from "@adaas/a-concept/a-component";
|
|
20
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
16
21
|
import { A_FeatureError } from "./A-Feature.error";
|
|
17
|
-
import {
|
|
22
|
+
import { A_TypeGuards} from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
23
|
+
import { A_CommonHelper} from "@adaas/a-concept/helpers/A_Common.helper";
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* A-Feature decorator
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { A_Context } from "@adaas/a-concept/
|
|
2
|
-
import { A_Meta } from "@adaas/a-concept/
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
2
|
+
import { A_Meta } from "@adaas/a-concept/a-meta";
|
|
3
|
+
import {
|
|
4
|
+
A_TYPES__FeatureExtendDecoratorConfig,
|
|
5
|
+
A_TYPES__FeatureExtendDecoratorDescriptor,
|
|
6
|
+
A_TYPES__FeatureExtendDecoratorScopeItem,
|
|
7
|
+
A_TYPES__FeatureExtendDecoratorTarget
|
|
8
|
+
} from "./A-Feature.types";
|
|
9
|
+
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/a-component";
|
|
6
10
|
import { A_FeatureError } from "./A-Feature.error";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { A_TypeGuards} from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
12
|
+
import { A_CommonHelper} from "@adaas/a-concept/helpers/A_Common.helper";
|
|
13
|
+
import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/a-entity";
|
|
14
|
+
import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/a-container";
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
|
|
@@ -5,17 +5,19 @@ import {
|
|
|
5
5
|
A_TYPES__FeatureAvailableComponents,
|
|
6
6
|
A_TYPES__FeatureState,
|
|
7
7
|
} from "./A-Feature.types";
|
|
8
|
-
import { A_Feature_Define } from "
|
|
9
|
-
import { A_Feature_Extend } from "
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { A_Feature_Define } from "./A-Feature-Define.decorator";
|
|
9
|
+
import { A_Feature_Extend } from "./A-Feature-Extend.decorator";
|
|
10
|
+
import {
|
|
11
|
+
A_Stage,
|
|
12
|
+
A_StageError
|
|
13
|
+
} from "@adaas/a-concept/a-stage";
|
|
14
|
+
import { A_StepsManager } from "@adaas/a-concept/a-step-manager";
|
|
15
|
+
import { A_TypeGuards} from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
14
16
|
import { A_FeatureError } from "./A-Feature.error";
|
|
15
|
-
import { A_Context } from "
|
|
16
|
-
import { A_Caller } from "
|
|
17
|
-
import { A_Scope } from "
|
|
18
|
-
import { A_Component } from "
|
|
17
|
+
import { A_Context } from "@adaas/a-concept/a-context";
|
|
18
|
+
import { A_Caller } from "@adaas/a-concept/a-caller";
|
|
19
|
+
import { A_Scope } from "@adaas/a-concept/a-scope";
|
|
20
|
+
import { A_Component } from "@adaas/a-concept/a-component";
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -530,7 +532,7 @@ export class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__
|
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
this.scope.destroy();
|
|
533
|
-
|
|
535
|
+
|
|
534
536
|
return this._error;
|
|
535
537
|
}
|
|
536
538
|
|
|
@@ -592,7 +594,7 @@ export class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__
|
|
|
592
594
|
feature._caller = this._caller;
|
|
593
595
|
|
|
594
596
|
const result = feature.process(featureScope);
|
|
595
|
-
|
|
597
|
+
|
|
596
598
|
// If the chained feature processing returns a promise, ensure errors are propagated
|
|
597
599
|
if (A_TypeGuards.isPromiseInstance(result)) {
|
|
598
600
|
return result.catch(error => {
|
|
@@ -600,7 +602,7 @@ export class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__
|
|
|
600
602
|
throw error;
|
|
601
603
|
});
|
|
602
604
|
}
|
|
603
|
-
|
|
605
|
+
|
|
604
606
|
return result;
|
|
605
607
|
}
|
|
606
608
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A_Error } from "
|
|
2
|
-
import { A_Stage } from "
|
|
1
|
+
import { A_Error } from "@adaas/a-concept/a-error";
|
|
2
|
+
import { A_Stage } from "@adaas/a-concept/a-stage";
|
|
3
3
|
import { A_TYPES__FeatureError_Init } from "./A-Feature.types";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import {
|
|
2
|
+
A_Stage,
|
|
3
|
+
A_TYPES__A_StageStep,
|
|
4
|
+
A_TYPES_StageExecutionBehavior
|
|
5
|
+
} from "@adaas/a-concept/a-stage"
|
|
6
|
+
import { A_Entity } from "@adaas/a-concept/a-entity"
|
|
7
|
+
import {
|
|
8
|
+
A_Container,
|
|
9
|
+
A_TYPES__Container_Constructor
|
|
10
|
+
} from "@adaas/a-concept/a-container"
|
|
11
|
+
import {
|
|
12
|
+
A_Component,
|
|
13
|
+
A_TYPES__Component_Constructor
|
|
14
|
+
} from "@adaas/a-concept/a-component"
|
|
15
|
+
import { A_TYPES__Entity_Constructor } from "@adaas/a-concept/a-entity"
|
|
9
16
|
import { A_Feature } from "./A-Feature.class"
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
import {
|
|
18
|
+
A_TYPES__Ctor,
|
|
19
|
+
A_TYPES__Required
|
|
20
|
+
} from "@adaas/a-concept/types";
|
|
21
|
+
import { A_Scope } from "@adaas/a-concept/a-scope"
|
|
22
|
+
import { A_TYPES__Error_Init } from "@adaas/a-concept/a-error"
|
|
14
23
|
|
|
15
24
|
|
|
16
25
|
// ============================================================================
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { A_Feature } from './A-Feature.class';
|
|
2
|
+
// export { A_FeatureMeta } from './A-Feature.meta';
|
|
3
|
+
export { A_FeatureError } from './A-Feature.error';
|
|
4
|
+
export * from './A-Feature.types';
|
|
5
|
+
// export * from './A-Feature.constants';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// --------------------------------------------------------
|
|
10
|
+
// -----------------------Decorators-----------------------
|
|
11
|
+
// --------------------------------------------------------
|
|
12
|
+
export { A_Feature_Extend } from './A-Feature-Extend.decorator';
|
|
13
|
+
export { A_Feature_Define } from './A-Feature-Define.decorator';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// --------------------------- Primary Types ----------------------------------
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
|
-
import { A_TYPES__Ctor } from "@adaas/a-concept/types
|
|
5
|
+
import { A_TYPES__Ctor } from "@adaas/a-concept/types";
|
|
6
6
|
import { A_Fragment } from "./A-Fragment.class";
|
|
7
7
|
|
|
8
8
|
/**
|