@adaas/a-concept 0.1.24 → 0.1.25
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/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +3952 -0
- package/dist/index.d.ts +3952 -50
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -6
- package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +2 -1
- package/src/global/A-Context/A-Context.class.ts +81 -7
- package/src/global/A-Context/A-Context.error.ts +4 -0
- package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
- package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
- package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
- package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
- package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
- package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
- package/src/global/A-Feature/A-Feature-Define.decorator.ts +2 -1
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +2 -1
- package/src/global/A-Feature/A-Feature.class.ts +11 -0
- package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
- package/src/global/A-Inject/A-Inject.types.ts +5 -3
- package/src/global/A-Scope/A-Scope.class.ts +85 -57
- package/src/global/A-Stage/A-Stage.class.ts +22 -2
- package/src/global/A-Stage/A-Stage.error.ts +2 -0
- package/src/helpers/A_Common.helper.ts +101 -0
- package/src/helpers/A_TypeGuards.helper.ts +8 -0
- package/src/index.ts +88 -0
- package/tests/A-Component.test.ts +1 -1
- package/tests/A-Concept.test.ts +5 -6
- package/tests/A-Dependency.test.ts +93 -0
- package/tests/A-Feature.test.ts +7 -7
- package/tests/A-Scope.test.ts +10 -10
- package/tsconfig.json +2 -2
- package/tsup.config.ts +32 -0
- package/dist/index.js +0 -112
- package/dist/index.js.map +0 -1
- package/dist/src/constants/env.constants.d.ts +0 -33
- package/dist/src/constants/env.constants.js +0 -47
- package/dist/src/constants/env.constants.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -96
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
- package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
- package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
- package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
- package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
- package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
- package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.class.js +0 -56
- package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
- package/dist/src/global/A-Component/A-Component.constants.js +0 -11
- package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.meta.js +0 -78
- package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
- package/dist/src/global/A-Component/A-Component.types.js +0 -4
- package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
- package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
- package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
- package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
- package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
- package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
- package/dist/src/global/A-Concept/A-Concept.meta.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.types.d.ts +0 -66
- package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
- package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
- package/dist/src/global/A-Container/A-Container.class.js +0 -78
- package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
- package/dist/src/global/A-Container/A-Container.constants.js +0 -11
- package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
- package/dist/src/global/A-Container/A-Container.meta.js +0 -76
- package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
- package/dist/src/global/A-Container/A-Container.types.js +0 -4
- package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
- package/dist/src/global/A-Context/A-Context.class.js +0 -603
- package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
- package/dist/src/global/A-Context/A-Context.error.js +0 -25
- package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
- package/dist/src/global/A-Context/A-Context.types.js +0 -3
- package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
- package/dist/src/global/A-Entity/A-Entity.class.js +0 -282
- package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
- package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
- package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
- package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
- package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
- package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
- package/dist/src/global/A-Error/A_Error.class.js +0 -296
- package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
- package/dist/src/global/A-Error/A_Error.constants.js +0 -9
- package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
- package/dist/src/global/A-Error/A_Error.types.js +0 -3
- package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -128
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
- package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
- package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
- package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
- package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -334
- package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
- package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
- package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
- package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
- package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
- package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
- package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
- package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
- package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
- package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
- package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
- package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
- package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
- package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
- package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
- package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
- package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
- package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
- package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
- package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
- package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
- package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
- package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
- package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -101
- package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
- package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
- package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -112
- package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
- package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
- package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
- package/dist/src/global/ASEID/ASEID.class.js +0 -167
- package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
- package/dist/src/global/ASEID/ASEID.constants.js +0 -2
- package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
- package/dist/src/global/ASEID/ASEID.error.js +0 -10
- package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
- package/dist/src/global/ASEID/ASEID.types.js +0 -5
- package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
- package/dist/src/helpers/A_Common.helper.d.ts +0 -28
- package/dist/src/helpers/A_Common.helper.js +0 -170
- package/dist/src/helpers/A_Common.helper.js.map +0 -1
- package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
- package/dist/src/helpers/A_Formatter.helper.js +0 -62
- package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
- package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
- package/dist/src/helpers/A_Identity.helper.js +0 -43
- package/dist/src/helpers/A_Identity.helper.js.map +0 -1
- package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
- package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
- package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
- package/dist/src/types/A_Common.types.d.ts +0 -36
- package/dist/src/types/A_Common.types.js +0 -3
- package/dist/src/types/A_Common.types.js.map +0 -1
- package/index.ts +0 -81
- package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
- package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
- package/trace-require.js +0 -46
- package/tsconfig.build.json +0 -58
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
A_TYPES__A_InjectDecorator_EntityInjectionInstructions,
|
|
11
11
|
A_TYPES__A_InjectDecorator_EntityInjectionQuery,
|
|
12
12
|
A_TYPES__InjectableConstructors,
|
|
13
|
+
A_TYPES__InjectableTargets,
|
|
13
14
|
} from "@adaas/a-concept/global/A-Inject/A-Inject.types";
|
|
14
15
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
15
16
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
@@ -267,6 +268,31 @@ export class A_Scope<
|
|
|
267
268
|
protected initFragments(_fragments?: _FragmentType) { _fragments?.forEach(this.register.bind(this)); }
|
|
268
269
|
|
|
269
270
|
|
|
271
|
+
// ==========================================================================
|
|
272
|
+
// --------------------Scope Public Methods-----------------------------------
|
|
273
|
+
// ==========================================================================
|
|
274
|
+
/**
|
|
275
|
+
* This method is used to destroy the scope and all its registered components, fragments and entities
|
|
276
|
+
*
|
|
277
|
+
* [!] This method deregisters all components, fragments and entities from the A-Context
|
|
278
|
+
* [!] This method also clears all internal registries and collections
|
|
279
|
+
*/
|
|
280
|
+
destroy() {
|
|
281
|
+
this._components.forEach(component => A_Context.deregister(component));
|
|
282
|
+
this._fragments.forEach(fragment => A_Context.deregister(fragment));
|
|
283
|
+
this._entities.forEach(entity => A_Context.deregister(entity));
|
|
284
|
+
|
|
285
|
+
this._components.clear();
|
|
286
|
+
this._errors.clear();
|
|
287
|
+
this._fragments.clear();
|
|
288
|
+
this._entities.clear();
|
|
289
|
+
|
|
290
|
+
if (this.issuer()) {
|
|
291
|
+
A_Context.deallocate(this);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
270
296
|
/**
|
|
271
297
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
272
298
|
*
|
|
@@ -499,7 +525,7 @@ export class A_Scope<
|
|
|
499
525
|
*/
|
|
500
526
|
name: string
|
|
501
527
|
): A_TYPES__Fragment_Constructor<T>
|
|
502
|
-
resolveConstructor<T extends A_TYPES__ScopeResolvableComponents>(name: string): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> {
|
|
528
|
+
resolveConstructor<T extends A_TYPES__ScopeResolvableComponents>(name: string): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> | undefined {
|
|
503
529
|
// 1) Check components
|
|
504
530
|
const component = Array.from(this.allowedComponents).find(
|
|
505
531
|
c => c.name === name
|
|
@@ -527,10 +553,7 @@ export class A_Scope<
|
|
|
527
553
|
return this._parent.resolveConstructor(name) as any;
|
|
528
554
|
}
|
|
529
555
|
|
|
530
|
-
|
|
531
|
-
A_ScopeError.ResolutionError,
|
|
532
|
-
`Component or Entity with name ${name} not found in the scope ${this.name}`
|
|
533
|
-
);
|
|
556
|
+
return undefined;
|
|
534
557
|
}
|
|
535
558
|
|
|
536
559
|
|
|
@@ -550,25 +573,25 @@ export class A_Scope<
|
|
|
550
573
|
* Provide a component constructor to resolve its instance from the scope
|
|
551
574
|
*/
|
|
552
575
|
component: A_TYPES__Component_Constructor<T>
|
|
553
|
-
): T
|
|
576
|
+
): T | undefined
|
|
554
577
|
resolve<T extends A_TYPES__Component_Constructor[]>(
|
|
555
578
|
/**
|
|
556
579
|
* Provide an array of component constructors to resolve their instances from the scope
|
|
557
580
|
*/
|
|
558
581
|
components: [...T]
|
|
559
|
-
): Array<InstanceType<T[number]>>
|
|
582
|
+
): Array<InstanceType<T[number]>> | undefined
|
|
560
583
|
resolve<T extends A_Fragment>(
|
|
561
584
|
/**
|
|
562
585
|
* Provide a fragment constructor to resolve its instance from the scope
|
|
563
586
|
*/
|
|
564
587
|
fragment: A_TYPES__Fragment_Constructor<T>
|
|
565
|
-
): T
|
|
588
|
+
): T | undefined
|
|
566
589
|
resolve<T extends A_TYPES__Fragment_Constructor[]>(
|
|
567
590
|
/**
|
|
568
591
|
* Provide an array of fragment constructors to resolve their instances from the scope
|
|
569
592
|
*/
|
|
570
593
|
fragments: [...T]
|
|
571
|
-
): Array<InstanceType<T[number]>>
|
|
594
|
+
): Array<InstanceType<T[number]>> | undefined
|
|
572
595
|
resolve<T extends A_Entity>(
|
|
573
596
|
/**
|
|
574
597
|
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
@@ -582,7 +605,7 @@ export class A_Scope<
|
|
|
582
605
|
* Provide an entity constructor to resolve its instance from the scope
|
|
583
606
|
*/
|
|
584
607
|
scope: new (...args: any[]) => T
|
|
585
|
-
): T
|
|
608
|
+
): T | undefined
|
|
586
609
|
resolve<T extends A_Entity>(
|
|
587
610
|
/**
|
|
588
611
|
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
@@ -595,7 +618,7 @@ export class A_Scope<
|
|
|
595
618
|
): Array<T>
|
|
596
619
|
resolve<T extends A_TYPES__ScopeResolvableComponents>(
|
|
597
620
|
constructorName: string
|
|
598
|
-
): T
|
|
621
|
+
): T | undefined
|
|
599
622
|
// base definition
|
|
600
623
|
resolve<T extends A_TYPES__ScopeResolvableComponents>(
|
|
601
624
|
/**
|
|
@@ -603,21 +626,21 @@ export class A_Scope<
|
|
|
603
626
|
*/
|
|
604
627
|
param1: A_TYPES__InjectableConstructors,
|
|
605
628
|
|
|
606
|
-
): T | Array<T>
|
|
629
|
+
): T | Array<T> | undefined
|
|
607
630
|
resolve<T extends A_TYPES__ScopeLinkedConstructors>(
|
|
608
631
|
/**
|
|
609
632
|
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
610
633
|
*/
|
|
611
634
|
param1: InstanceType<T>,
|
|
612
635
|
|
|
613
|
-
): T | Array<T>
|
|
636
|
+
): T | Array<T> | undefined
|
|
614
637
|
resolve<T extends A_TYPES__ScopeResolvableComponents>(
|
|
615
638
|
/**
|
|
616
639
|
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
617
640
|
*/
|
|
618
641
|
param1: A_TYPES__InjectableConstructors | Array<A_TYPES__InjectableConstructors>,
|
|
619
642
|
param2?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
|
|
620
|
-
): T | Array<T> {
|
|
643
|
+
): T | Array<T> | undefined {
|
|
621
644
|
switch (true) {
|
|
622
645
|
case A_TypeGuards.isArray(param1): {
|
|
623
646
|
return param1.map(c => {
|
|
@@ -637,7 +660,9 @@ export class A_Scope<
|
|
|
637
660
|
}
|
|
638
661
|
|
|
639
662
|
default: {
|
|
640
|
-
throw new
|
|
663
|
+
throw new A_ScopeError(
|
|
664
|
+
A_ScopeError.ResolutionError,
|
|
665
|
+
`Invalid parameter provided to resolve method: ${param1} in scope ${this.name}`);
|
|
641
666
|
}
|
|
642
667
|
}
|
|
643
668
|
}
|
|
@@ -663,7 +688,7 @@ export class A_Scope<
|
|
|
663
688
|
* Provide the name of the component, fragment or entity to resolve
|
|
664
689
|
*/
|
|
665
690
|
name: string
|
|
666
|
-
): _EntityType[number] | InstanceType<_ComponentType[number]> | _FragmentType[number] {
|
|
691
|
+
): _EntityType[number] | InstanceType<_ComponentType[number]> | _FragmentType[number] | undefined {
|
|
667
692
|
// 1) Check components
|
|
668
693
|
const component = Array.from(this.allowedComponents).find(
|
|
669
694
|
c => c.name === name
|
|
@@ -691,10 +716,7 @@ export class A_Scope<
|
|
|
691
716
|
return this._parent.resolveByName(name) as any;
|
|
692
717
|
}
|
|
693
718
|
|
|
694
|
-
|
|
695
|
-
A_ScopeError.ResolutionError,
|
|
696
|
-
`Component or Entity with name ${name} not found in the scope ${this.name}`
|
|
697
|
-
);
|
|
719
|
+
return undefined;
|
|
698
720
|
}
|
|
699
721
|
|
|
700
722
|
/**
|
|
@@ -707,22 +729,12 @@ export class A_Scope<
|
|
|
707
729
|
private resolveOnce(
|
|
708
730
|
component: any,
|
|
709
731
|
instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
|
|
710
|
-
): A_TYPES__ScopeResolvableComponents | A_Scope | A_TYPES__ScopeLinkedComponents | Array<A_TYPES__ScopeResolvableComponents> {
|
|
711
|
-
|
|
712
|
-
const componentName = A_TypeGuards.isFunction(component) ? component.name : component.constructor.name || String(component);
|
|
732
|
+
): A_TYPES__ScopeResolvableComponents | A_Scope | A_TYPES__ScopeLinkedComponents | Array<A_TYPES__ScopeResolvableComponents> | undefined {
|
|
713
733
|
|
|
734
|
+
const componentName = A_CommonHelper.getComponentName(component);
|
|
714
735
|
|
|
715
736
|
if (!component || !this.has(component))
|
|
716
|
-
|
|
717
|
-
A_ScopeError.ResolutionError,
|
|
718
|
-
`Injected Component ${componentName} not found in the scope`
|
|
719
|
-
);
|
|
720
|
-
|
|
721
|
-
if (A_TypeGuards.isScopeConstructor(component))
|
|
722
|
-
component
|
|
723
|
-
|
|
724
|
-
if (typeof component == 'function' && component.name === 'A_Scope')
|
|
725
|
-
component
|
|
737
|
+
return undefined;
|
|
726
738
|
|
|
727
739
|
switch (true) {
|
|
728
740
|
case A_TypeGuards.isConstructorAllowedForScopeAllocation(component): {
|
|
@@ -750,7 +762,7 @@ export class A_Scope<
|
|
|
750
762
|
|
|
751
763
|
private resolveIssuer(
|
|
752
764
|
ctor: A_TYPES__ScopeLinkedConstructors
|
|
753
|
-
): A_TYPES__ScopeLinkedComponents {
|
|
765
|
+
): A_TYPES__ScopeLinkedComponents | undefined {
|
|
754
766
|
|
|
755
767
|
const issuer = this.issuer();
|
|
756
768
|
|
|
@@ -765,10 +777,7 @@ export class A_Scope<
|
|
|
765
777
|
return this._parent.resolveIssuer(ctor);
|
|
766
778
|
}
|
|
767
779
|
|
|
768
|
-
|
|
769
|
-
A_ScopeError.ResolutionError,
|
|
770
|
-
`Issuer ${ctor.name} not found in the scope ${this.name}`
|
|
771
|
-
);
|
|
780
|
+
return undefined;
|
|
772
781
|
}
|
|
773
782
|
|
|
774
783
|
/**
|
|
@@ -783,7 +792,7 @@ export class A_Scope<
|
|
|
783
792
|
private resolveEntity<T extends A_Entity>(
|
|
784
793
|
entity: A_TYPES__Entity_Constructor<T>,
|
|
785
794
|
instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>
|
|
786
|
-
): T | Array<T> {
|
|
795
|
+
): T | Array<T> | undefined {
|
|
787
796
|
|
|
788
797
|
const query = instructions?.query || {} as Partial<A_TYPES__A_InjectDecorator_EntityInjectionQuery<T>>;
|
|
789
798
|
const count = instructions?.pagination?.count || 1;
|
|
@@ -806,10 +815,7 @@ export class A_Scope<
|
|
|
806
815
|
return this._parent.resolveEntity(entity, instructions);
|
|
807
816
|
|
|
808
817
|
default:
|
|
809
|
-
|
|
810
|
-
A_ScopeError.ResolutionError,
|
|
811
|
-
`Entity ${entity.name} not found in the scope ${this.name}`
|
|
812
|
-
);
|
|
818
|
+
return undefined;
|
|
813
819
|
}
|
|
814
820
|
}
|
|
815
821
|
/**
|
|
@@ -884,7 +890,7 @@ export class A_Scope<
|
|
|
884
890
|
* @param fragment
|
|
885
891
|
* @returns
|
|
886
892
|
*/
|
|
887
|
-
private resolveFragment<T extends A_Fragment>(fragment: A_TYPES__Fragment_Constructor<T>): _FragmentType[number] {
|
|
893
|
+
private resolveFragment<T extends A_Fragment>(fragment: A_TYPES__Fragment_Constructor<T>): _FragmentType[number] | undefined {
|
|
888
894
|
const fragmentInstancePresented = this._fragments.get(fragment);
|
|
889
895
|
|
|
890
896
|
switch (true) {
|
|
@@ -895,10 +901,7 @@ export class A_Scope<
|
|
|
895
901
|
return this._parent.resolveFragment(fragment);
|
|
896
902
|
|
|
897
903
|
default:
|
|
898
|
-
|
|
899
|
-
A_ScopeError.ResolutionError,
|
|
900
|
-
`Fragment ${fragment.name} not found in the scope ${this.name}`
|
|
901
|
-
);
|
|
904
|
+
return undefined;
|
|
902
905
|
}
|
|
903
906
|
}
|
|
904
907
|
/**
|
|
@@ -916,7 +919,7 @@ export class A_Scope<
|
|
|
916
919
|
* @param component
|
|
917
920
|
* @returns
|
|
918
921
|
*/
|
|
919
|
-
private resolveComponent<T extends A_Component>(component: A_TYPES__Component_Constructor<T>): InstanceType<_ComponentType[number]> {
|
|
922
|
+
private resolveComponent<T extends A_Component>(component: A_TYPES__Component_Constructor<T>): InstanceType<_ComponentType[number]> | undefined {
|
|
920
923
|
|
|
921
924
|
// The idea here that in case when Scope has no exact component we have to resolve it from the _parent
|
|
922
925
|
// BUT: if it's not presented in _parent we have to check for inheritance
|
|
@@ -935,15 +938,40 @@ export class A_Scope<
|
|
|
935
938
|
|
|
936
939
|
const resolvedArgs = (argsMeta?.get('constructor') || [])
|
|
937
940
|
.map(arg => {
|
|
938
|
-
|
|
941
|
+
// for Error handling purposes
|
|
942
|
+
const componentName = A_CommonHelper.getComponentName(arg.target)
|
|
943
|
+
|
|
944
|
+
if ('instructions' in arg && !!arg.instructions) {
|
|
939
945
|
const { target, instructions } = arg
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
946
|
+
const dependency = this.resolve(target as any, instructions);
|
|
947
|
+
if (!dependency)
|
|
948
|
+
throw new A_ScopeError(
|
|
949
|
+
A_ScopeError.ResolutionError,
|
|
950
|
+
`Unable to resolve dependency ${componentName} for component ${component.name} in scope ${this.name}`
|
|
951
|
+
);
|
|
952
|
+
|
|
953
|
+
return dependency;
|
|
954
|
+
} else {
|
|
955
|
+
const { target, require, create, defaultArgs } = arg;
|
|
956
|
+
|
|
957
|
+
let dependency = this.resolve(target as any);
|
|
958
|
+
|
|
959
|
+
if (create && !dependency && A_TypeGuards.isAllowedForDependencyDefaultCreation(target)) {
|
|
960
|
+
const newDependency = new target(...defaultArgs);
|
|
961
|
+
|
|
962
|
+
this.register(newDependency);
|
|
963
|
+
return newDependency;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
if (require && !dependency) {
|
|
967
|
+
throw new A_ScopeError(
|
|
968
|
+
A_ScopeError.ResolutionError,
|
|
969
|
+
`Unable to resolve required dependency ${componentName} for component ${component.name} in scope ${this.name}`
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
return dependency;
|
|
944
974
|
}
|
|
945
|
-
// TODO: Fix types mismatch here
|
|
946
|
-
return this.resolve<T>(arg.target as any);
|
|
947
975
|
});
|
|
948
976
|
|
|
949
977
|
const newComponent = new component(...resolvedArgs)
|
|
@@ -1128,7 +1156,7 @@ export class A_Scope<
|
|
|
1128
1156
|
`Fragment ${param1.constructor.name} is already registered in the scope ${this.name}`
|
|
1129
1157
|
);
|
|
1130
1158
|
else {
|
|
1131
|
-
const componentName =
|
|
1159
|
+
const componentName = A_CommonHelper.getComponentName(param1);
|
|
1132
1160
|
|
|
1133
1161
|
throw new A_ScopeError(
|
|
1134
1162
|
A_ScopeError.RegistrationError,
|
|
@@ -12,6 +12,7 @@ import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
|
|
|
12
12
|
import { A_TYPES__ScopeResolvableComponents } from "../A-Scope/A-Scope.types";
|
|
13
13
|
import { A_TYPES__Container_Constructor } from "../A-Container/A-Container.types";
|
|
14
14
|
import { A_TYPES__Component_Constructor } from "../A-Component/A-Component.types";
|
|
15
|
+
import { A_CommonHelper } from "@adaas/a-concept/helpers/A_Common.helper";
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
@@ -141,11 +142,30 @@ export class A_Stage {
|
|
|
141
142
|
case A_TypeGuards.isFeatureConstructor(arg.target):
|
|
142
143
|
return this._feature;
|
|
143
144
|
|
|
144
|
-
case A_TypeGuards.isEntityConstructor(arg.target) && 'instructions' in arg:
|
|
145
|
+
case A_TypeGuards.isEntityConstructor(arg.target) && 'instructions' in arg && !!arg.instructions:
|
|
145
146
|
return scope.resolve(arg.target, arg.instructions)
|
|
146
147
|
|
|
147
|
-
default:
|
|
148
|
+
default: {
|
|
149
|
+
const { target, require, create, defaultArgs } = arg;
|
|
150
|
+
|
|
151
|
+
let dependency = scope.resolve(target as any);
|
|
152
|
+
|
|
153
|
+
if (create && !dependency && A_TypeGuards.isAllowedForDependencyDefaultCreation(target)) {
|
|
154
|
+
const newDependency = new target(...defaultArgs);
|
|
155
|
+
|
|
156
|
+
scope.register(newDependency);
|
|
157
|
+
return newDependency;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (require && !dependency) {
|
|
161
|
+
throw new A_StageError(
|
|
162
|
+
A_StageError.ArgumentsResolutionError,
|
|
163
|
+
`Unable to resolve required argument ${A_CommonHelper.getComponentName(arg.target)} for stage ${this.name} in scope ${scope.name}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
148
167
|
return scope.resolve(arg.target)
|
|
168
|
+
}
|
|
149
169
|
}
|
|
150
170
|
})
|
|
151
171
|
)
|
|
@@ -201,4 +201,105 @@ export class A_CommonHelper {
|
|
|
201
201
|
// For any other cases
|
|
202
202
|
throw new Error('Unable to clone the object. Unsupported type.');
|
|
203
203
|
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Get a readable name for a component (string, class, function, React element, instance, etc.)
|
|
207
|
+
*
|
|
208
|
+
* Covers:
|
|
209
|
+
* - string tags ("div")
|
|
210
|
+
* - symbols (Symbol.for('xxx'))
|
|
211
|
+
* - functions and classes (with name or displayName)
|
|
212
|
+
* - React elements (object with `type`)
|
|
213
|
+
* - component instances (constructor.name)
|
|
214
|
+
* - objects with custom toString returning meaningful info
|
|
215
|
+
*
|
|
216
|
+
* Falls back to sensible defaults ("Unknown" / "Anonymous").
|
|
217
|
+
*/
|
|
218
|
+
static getComponentName(component: any): string {
|
|
219
|
+
const UNKNOWN = 'Unknown';
|
|
220
|
+
const ANONYMOUS = 'Anonymous';
|
|
221
|
+
|
|
222
|
+
if (component === null || component === undefined) {
|
|
223
|
+
return UNKNOWN;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Strings (HTML tags or explicit names)
|
|
227
|
+
if (typeof component === 'string') {
|
|
228
|
+
return component || UNKNOWN;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Symbols
|
|
232
|
+
if (typeof component === 'symbol') {
|
|
233
|
+
try {
|
|
234
|
+
return component.toString();
|
|
235
|
+
} catch {
|
|
236
|
+
return UNKNOWN;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Arrays - try to derive from first element
|
|
241
|
+
if (Array.isArray(component)) {
|
|
242
|
+
if (component.length === 0) return UNKNOWN;
|
|
243
|
+
return this.getComponentName(component[0]);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Functions and classes
|
|
247
|
+
if (typeof component === 'function') {
|
|
248
|
+
const fnAny = component as any;
|
|
249
|
+
// Common React convention
|
|
250
|
+
if (fnAny.displayName) return String(fnAny.displayName);
|
|
251
|
+
if (fnAny.name) return String(fnAny.name);
|
|
252
|
+
|
|
253
|
+
// Try to extract a name from source if possible
|
|
254
|
+
try {
|
|
255
|
+
const src = Function.prototype.toString.call(component);
|
|
256
|
+
// class Foo { ... } or function foo() { ... } or foo => ...
|
|
257
|
+
const match = src.match(/^(?:class\s+([A-Za-z0-9_$]+)|function\s+([A-Za-z0-9_$]+)|([A-Za-z0-9_$]+)\s*=>)/);
|
|
258
|
+
if (match) {
|
|
259
|
+
return match[1] || match[2] || match[3] || ANONYMOUS;
|
|
260
|
+
}
|
|
261
|
+
} catch {
|
|
262
|
+
// fallthrough
|
|
263
|
+
}
|
|
264
|
+
return ANONYMOUS;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Objects (instances, React elements, plain objects)
|
|
268
|
+
if (typeof component === 'object') {
|
|
269
|
+
const objAny = component as any;
|
|
270
|
+
|
|
271
|
+
// React element: { type: ComponentOrString, props: ... }
|
|
272
|
+
if (objAny.type) {
|
|
273
|
+
return this.getComponentName(objAny.type);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// React forwardRef / memo wrappers often expose displayName
|
|
277
|
+
if (objAny.displayName) return String(objAny.displayName);
|
|
278
|
+
if (objAny.name) return String(objAny.name);
|
|
279
|
+
|
|
280
|
+
// Instance: use constructor name if available and not Object
|
|
281
|
+
if (objAny.constructor && objAny.constructor.name && objAny.constructor.name !== 'Object') {
|
|
282
|
+
return String(objAny.constructor.name);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// If object implements a meaningful toString, try it
|
|
286
|
+
try {
|
|
287
|
+
const s = objAny.toString();
|
|
288
|
+
if (typeof s === 'string' && s !== '[object Object]') {
|
|
289
|
+
return s;
|
|
290
|
+
}
|
|
291
|
+
} catch {
|
|
292
|
+
// ignore
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return ANONYMOUS;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Fallback for other types
|
|
299
|
+
try {
|
|
300
|
+
return String(component);
|
|
301
|
+
} catch {
|
|
302
|
+
return UNKNOWN;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
204
305
|
}
|
|
@@ -315,6 +315,14 @@ export class A_TypeGuards {
|
|
|
315
315
|
|| A_TypeGuards.isComponentInstance(param);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
static isAllowedForDependencyDefaultCreation(param: any): param is A_TYPES__Entity_Constructor | A_TYPES__Component_Constructor {
|
|
319
|
+
return A_TypeGuards.isComponentConstructor(param)
|
|
320
|
+
|| A_CommonHelper.isInheritedFrom(param, A_Component)
|
|
321
|
+
|| A_TypeGuards.isEntityConstructor(param)
|
|
322
|
+
|| A_CommonHelper.isInheritedFrom(param, A_Entity)
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
318
326
|
/**
|
|
319
327
|
* Allows to check if the provided param is of constructor type.
|
|
320
328
|
*
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// =================================================================================================
|
|
2
|
+
// ============================= Export Framework Components =======================================
|
|
3
|
+
// =================================================================================================
|
|
4
|
+
export * from './constants/env.constants';
|
|
5
|
+
export * from './types/A_Common.types';
|
|
6
|
+
|
|
7
|
+
// ---------------------- Major Components ----------------------
|
|
8
|
+
export { A_Context } from './global/A-Context/A-Context.class';
|
|
9
|
+
export * from './global/A-Context/A-Context.types';
|
|
10
|
+
|
|
11
|
+
export { A_Concept } from './global/A-Concept/A-Concept.class';
|
|
12
|
+
export { A_ConceptMeta } from './global/A-Concept/A-Concept.meta';
|
|
13
|
+
export * from './global/A-Concept/A-Concept.types';
|
|
14
|
+
|
|
15
|
+
export { A_Container } from './global/A-Container/A-Container.class';
|
|
16
|
+
export { A_ContainerMeta } from './global/A-Container/A-Container.meta';
|
|
17
|
+
export * from './global/A-Container/A-Container.class';
|
|
18
|
+
|
|
19
|
+
export { A_Component } from './global/A-Component/A-Component.class';
|
|
20
|
+
export { A_ComponentMeta } from './global/A-Component/A-Component.meta';
|
|
21
|
+
export * from './global/A-Component/A-Component.types';
|
|
22
|
+
|
|
23
|
+
export { A_Entity } from './global/A-Entity/A-Entity.class';
|
|
24
|
+
export * from './global/A-Entity/A-Entity.types';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// ---------------------- Common Components ----------------------
|
|
28
|
+
export { A_Abstraction } from './global/A-Abstraction/A-Abstraction.class';
|
|
29
|
+
export { A_AbstractionError } from './global/A-Abstraction/A-Abstraction.error';
|
|
30
|
+
export * from './global/A-Abstraction/A-Abstraction.types';
|
|
31
|
+
|
|
32
|
+
export { A_Caller } from './global/A-Caller/A_Caller.class';
|
|
33
|
+
export { A_CallerError } from './global/A-Caller/A_Caller.error';
|
|
34
|
+
export * from './global/A-Caller/A_Caller.types';
|
|
35
|
+
|
|
36
|
+
export { A_Error } from './global/A-Error/A_Error.class';
|
|
37
|
+
export * from './global/A-Error/A_Error.types';
|
|
38
|
+
|
|
39
|
+
export { ASEID } from './global/ASEID/ASEID.class';
|
|
40
|
+
export { ASEID_Error } from './global/ASEID/ASEID.error';
|
|
41
|
+
export * from './global/ASEID/ASEID.types';
|
|
42
|
+
|
|
43
|
+
export { A_Feature } from './global/A-Feature/A-Feature.class';
|
|
44
|
+
export { A_FeatureError } from './global/A-Feature/A-Feature.error';
|
|
45
|
+
export * from './global/A-Feature/A-Feature.types';
|
|
46
|
+
|
|
47
|
+
export { A_Stage } from './global/A-Stage/A-Stage.class';
|
|
48
|
+
export { A_StageError } from './global/A-Stage/A-Stage.error';
|
|
49
|
+
export * from './global/A-Stage/A-Stage.types';
|
|
50
|
+
|
|
51
|
+
export { A_Scope } from './global/A-Scope/A-Scope.class';
|
|
52
|
+
export { A_ScopeError } from './global/A-Scope/A-Scope.error';
|
|
53
|
+
export * from './global/A-Scope/A-Scope.types';
|
|
54
|
+
|
|
55
|
+
export { A_Meta } from './global/A-Meta/A-Meta.class';
|
|
56
|
+
export * from './global/A-Meta/A-Meta.types';
|
|
57
|
+
|
|
58
|
+
export { A_Fragment } from './global/A-Fragment/A-Fragment.class';
|
|
59
|
+
export * from './global/A-Fragment/A-Fragment.types';
|
|
60
|
+
|
|
61
|
+
export { A_Dependency } from './global/A-Dependency/A-Dependency.class';
|
|
62
|
+
export { A_DependencyError } from './global/A-Dependency/A-Dependency.error';
|
|
63
|
+
export * from './global/A-Dependency/A-Dependency.types';
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// =================================================================================================
|
|
67
|
+
// =============================== Export Decorators ===============================================
|
|
68
|
+
// =================================================================================================
|
|
69
|
+
export { A_Inject } from './global/A-Inject/A-Inject.decorator';
|
|
70
|
+
export * from './global/A-Inject/A-Inject.types';
|
|
71
|
+
export { A_Feature_Define } from './global/A-Feature/A-Feature-Define.decorator';
|
|
72
|
+
export { A_Feature_Extend } from './global/A-Feature/A-Feature-Extend.decorator';
|
|
73
|
+
export { A_Abstraction_Extend } from './global/A-Abstraction/A-Abstraction-Extend.decorator';
|
|
74
|
+
export { A_Dependency_Require } from './global/A-Dependency/A-Dependency-Require.decorator';
|
|
75
|
+
export { A_Dependency_Load } from './global/A-Dependency/A-Dependency-Load.decorator';
|
|
76
|
+
export { A_Dependency_Default } from './global/A-Dependency/A-Dependency-Default.decorator';
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// =================================================================================================
|
|
80
|
+
// =============================== Export Helpers ================================================
|
|
81
|
+
// =================================================================================================
|
|
82
|
+
export { A_CommonHelper } from './helpers/A_Common.helper';
|
|
83
|
+
export { A_FormatterHelper } from './helpers/A_Formatter.helper';
|
|
84
|
+
export { A_IdentityHelper, A_ID_TYPES__TimeId_Parts } from './helpers/A_Identity.helper';
|
|
85
|
+
export { A_StepsManager } from './global/A-StepManager/A-StepManager.class';
|
|
86
|
+
export { A_StepManagerError } from './global/A-StepManager/A-StepManager.error';
|
|
87
|
+
export { A_TypeGuards } from './helpers/A_TypeGuards.helper';
|
|
88
|
+
|
|
@@ -27,7 +27,7 @@ describe('A-Component tests', () => {
|
|
|
27
27
|
A_Context.root.register(MyComponent);
|
|
28
28
|
A_Context.root.register(DependentComponent);
|
|
29
29
|
|
|
30
|
-
const dependentComponent = A_Context.root.resolve(DependentComponent)
|
|
30
|
+
const dependentComponent = A_Context.root.resolve(DependentComponent)!;
|
|
31
31
|
|
|
32
32
|
expect(dependentComponent.dependency).toBeInstanceOf(MyComponent);
|
|
33
33
|
});
|
package/tests/A-Concept.test.ts
CHANGED
|
@@ -98,14 +98,13 @@ describe('A-Concept tests', () => {
|
|
|
98
98
|
const containerBScope = A_Context.scope(containerB)
|
|
99
99
|
|
|
100
100
|
expect(containerAScope.resolveConstructor('MyEntityA')).toBe(MyEntityA);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}).toThrow();
|
|
101
|
+
const undefinedMyEntityB = containerAScope.resolveConstructor('MyEntityB');
|
|
102
|
+
expect(undefinedMyEntityB).toBeUndefined();
|
|
104
103
|
|
|
105
104
|
expect(containerBScope.resolveConstructor('MyEntityB')).toBe(MyEntityB);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
const undefinedMyEntityA = containerBScope.resolveConstructor('MyEntityA');
|
|
106
|
+
|
|
107
|
+
expect(undefinedMyEntityA).toBeUndefined();
|
|
109
108
|
|
|
110
109
|
expect(concept.scope.resolve(MyContext)).toEqual(sharedContext);
|
|
111
110
|
expect(concept.scope.resolve(MyContext)).toEqual(sharedContext);
|