@adaas/a-concept 0.3.1 → 0.3.3
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/browser/index.d.mts +65 -6
- package/dist/browser/index.mjs +2 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/index.cjs +100 -10
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.mts +65 -6
- package/dist/node/index.d.ts +65 -6
- package/dist/node/index.mjs +100 -11
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/env/env.base.ts +1 -1
- package/src/lib/A-Context/A-Context.class.ts +20 -17
- package/src/lib/A-Dependency/A-Dependency-Query.decorator.ts +90 -0
- package/src/lib/A-Dependency/A-Dependency.class.ts +11 -0
- package/src/lib/A-Dependency/A-Dependency.types.ts +12 -1
- package/src/lib/A-Dependency/index.ts +1 -0
- package/src/lib/A-Meta/A-Meta.class.ts +22 -26
- package/src/lib/A-Scope/A-Scope.class.ts +61 -6
- package/src/lib/A-Scope/A-Scope.types.ts +1 -1
- package/tests/A-Dependency.test.ts +67 -0
- package/tests/A-Entity.test.ts +101 -0
- package/tests/A-Meta.test.ts +44 -1
- package/tests/A-Scope.test.ts +17 -0
package/dist/node/index.d.mts
CHANGED
|
@@ -738,6 +738,12 @@ declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedTy
|
|
|
738
738
|
* @returns
|
|
739
739
|
*/
|
|
740
740
|
from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
|
|
741
|
+
/**
|
|
742
|
+
* Allows to create a copy of the meta object with the same values, this is needed to ensure that when we inherit meta from the parent component, we create a copy of it, not a reference to the same object. This allows us to modify the meta of the child component without affecting the meta of the parent component.
|
|
743
|
+
*
|
|
744
|
+
* @returns
|
|
745
|
+
*/
|
|
746
|
+
clone(): A_Meta<_StorageItems>;
|
|
741
747
|
/**
|
|
742
748
|
* Method to set values in the map
|
|
743
749
|
*
|
|
@@ -813,7 +819,18 @@ declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedTy
|
|
|
813
819
|
* Method to clear the map
|
|
814
820
|
*/
|
|
815
821
|
clear(): void;
|
|
822
|
+
/**
|
|
823
|
+
* Method to convert the meta to an array of key-value pairs
|
|
824
|
+
*
|
|
825
|
+
* @returns
|
|
826
|
+
*/
|
|
816
827
|
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
828
|
+
/**
|
|
829
|
+
* Helper method to recursively convert the meta object to a JSON-compatible format. It handles nested A_Meta instances, Maps, Arrays, and plain objects.
|
|
830
|
+
*
|
|
831
|
+
* @param value
|
|
832
|
+
* @returns
|
|
833
|
+
*/
|
|
817
834
|
protected recursiveToJSON(value: any): any;
|
|
818
835
|
/**
|
|
819
836
|
* Serializes the meta to a JSON object
|
|
@@ -2174,6 +2191,11 @@ type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKe
|
|
|
2174
2191
|
* A-Dependency All decorator return type
|
|
2175
2192
|
*/
|
|
2176
2193
|
type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2194
|
+
type A_TYPES__A_Dependency_QueryTarget<T extends A_Entity = A_Entity> = T | A_TYPES__Entity_Constructor<T>;
|
|
2195
|
+
/**
|
|
2196
|
+
* A-Dependency Query decorator return type
|
|
2197
|
+
*/
|
|
2198
|
+
type A_TYPES__A_Dependency_QueryDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2177
2199
|
|
|
2178
2200
|
/**
|
|
2179
2201
|
* Should indicate which Default is required
|
|
@@ -2215,6 +2237,15 @@ declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorR
|
|
|
2215
2237
|
*/
|
|
2216
2238
|
declare function A_Dependency_All(): A_TYPES__A_Dependency_AllDecoratorReturn;
|
|
2217
2239
|
|
|
2240
|
+
/**
|
|
2241
|
+
* 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.
|
|
2242
|
+
*
|
|
2243
|
+
*
|
|
2244
|
+
* @param query
|
|
2245
|
+
* @returns
|
|
2246
|
+
*/
|
|
2247
|
+
declare function A_Dependency_Query<T extends A_Entity = A_Entity>(query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>, pagination?: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>): A_TYPES__A_Dependency_QueryDecoratorReturn;
|
|
2248
|
+
|
|
2218
2249
|
declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> {
|
|
2219
2250
|
/**
|
|
2220
2251
|
* Allows to indicate which Injected parameter is required
|
|
@@ -2256,6 +2287,13 @@ declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__
|
|
|
2256
2287
|
* @returns
|
|
2257
2288
|
*/
|
|
2258
2289
|
static get All(): typeof A_Dependency_All;
|
|
2290
|
+
/**
|
|
2291
|
+
* Allows to indicate that the dependency should be resolved by specific query parameters
|
|
2292
|
+
* e.g. by ASEID, name, type, custom properties, etc.
|
|
2293
|
+
*
|
|
2294
|
+
* @returns
|
|
2295
|
+
*/
|
|
2296
|
+
static get Query(): typeof A_Dependency_Query;
|
|
2259
2297
|
protected _name: string;
|
|
2260
2298
|
protected _target?: A_TYPES__Ctor<T>;
|
|
2261
2299
|
protected _resolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
|
|
@@ -2908,7 +2946,7 @@ type A_TYPES__ScopeLinkedConstructors = A_TYPES__Container_Constructor | A_TYPES
|
|
|
2908
2946
|
/**
|
|
2909
2947
|
* A list of components that can have a scope associated with them
|
|
2910
2948
|
*/
|
|
2911
|
-
type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature;
|
|
2949
|
+
type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature | A_Entity;
|
|
2912
2950
|
/**
|
|
2913
2951
|
* A list of components that are dependent on a scope and do not have their own scope
|
|
2914
2952
|
*/
|
|
@@ -3032,7 +3070,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3032
3070
|
*/
|
|
3033
3071
|
get parent(): A_Scope | undefined;
|
|
3034
3072
|
/**
|
|
3035
|
-
* A_Scope
|
|
3073
|
+
* A_Scope is a unique A-Concept Structure that allows to operate with A-Concept Primitives and Models in a specific context and with specific rules.
|
|
3074
|
+
* It refers to the visibility and accessibility of :
|
|
3036
3075
|
* - variables,
|
|
3037
3076
|
* - Components,
|
|
3038
3077
|
* - Context Fragments
|
|
@@ -3308,7 +3347,27 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3308
3347
|
* Provide the fragment name in PascalCase to retrieve its constructor
|
|
3309
3348
|
*/
|
|
3310
3349
|
name: string): A_TYPES__Fragment_Constructor<T>;
|
|
3311
|
-
resolveConstructor<T extends
|
|
3350
|
+
resolveConstructor<T extends A_Component>(
|
|
3351
|
+
/**
|
|
3352
|
+
* Provide the component constructor or its name to retrieve its constructor
|
|
3353
|
+
*/
|
|
3354
|
+
component: A_TYPES__Ctor<T>): A_TYPES__Component_Constructor<T> | undefined;
|
|
3355
|
+
resolveConstructor<T extends A_Entity>(
|
|
3356
|
+
/**
|
|
3357
|
+
* Provide the entity constructor or its name to retrieve its constructor
|
|
3358
|
+
*/
|
|
3359
|
+
entity: A_TYPES__Ctor<T>): A_TYPES__Entity_Constructor<T> | undefined;
|
|
3360
|
+
resolveConstructor<T extends A_Fragment>(
|
|
3361
|
+
/**
|
|
3362
|
+
* Provide the fragment constructor or its name to retrieve its constructor
|
|
3363
|
+
*/
|
|
3364
|
+
fragment: A_TYPES__Ctor<T>): A_TYPES__Fragment_Constructor<T> | undefined;
|
|
3365
|
+
resolveConstructor<T extends A_Error>(
|
|
3366
|
+
/**
|
|
3367
|
+
* Provide the error constructor or its name to retrieve its constructor
|
|
3368
|
+
*/
|
|
3369
|
+
error: A_TYPES__Ctor<T>): A_TYPES__Error_Constructor<T> | undefined;
|
|
3370
|
+
resolveConstructor<T extends A_TYPES__A_DependencyInjectable>(name: string | A_TYPES__Ctor<T>): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> | undefined;
|
|
3312
3371
|
/**
|
|
3313
3372
|
* This method should resolve all instances of the components, or entities within the scope, by provided parent class
|
|
3314
3373
|
* So in case of providing a base class it should return all instances that extends this base class
|
|
@@ -4178,11 +4237,11 @@ declare class A_Context {
|
|
|
4178
4237
|
* Get meta for the specific entity class by constructor.
|
|
4179
4238
|
*/
|
|
4180
4239
|
entity: A_TYPES__Entity_Constructor): T;
|
|
4181
|
-
static meta<T extends A_EntityMeta>(
|
|
4240
|
+
static meta<T extends A_EntityMeta, E extends A_Entity>(
|
|
4182
4241
|
/**
|
|
4183
4242
|
* Get meta for the specific entity instance.
|
|
4184
4243
|
*/
|
|
4185
|
-
entity:
|
|
4244
|
+
entity: E): T;
|
|
4186
4245
|
static meta<T extends A_ComponentMeta>(
|
|
4187
4246
|
/**
|
|
4188
4247
|
* Get meta for the specific component class by constructor.
|
|
@@ -4968,4 +5027,4 @@ declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES: {
|
|
|
4968
5027
|
type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES][];
|
|
4969
5028
|
declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAME", "A_CONCEPT_ROOT_SCOPE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_RUNTIME_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "A_ERROR_DEFAULT_DESCRIPTION"];
|
|
4970
5029
|
|
|
4971
|
-
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
|
5030
|
+
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Query, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_QueryDecoratorReturn, type A_TYPES__A_Dependency_QueryTarget, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -738,6 +738,12 @@ declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedTy
|
|
|
738
738
|
* @returns
|
|
739
739
|
*/
|
|
740
740
|
from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
|
|
741
|
+
/**
|
|
742
|
+
* Allows to create a copy of the meta object with the same values, this is needed to ensure that when we inherit meta from the parent component, we create a copy of it, not a reference to the same object. This allows us to modify the meta of the child component without affecting the meta of the parent component.
|
|
743
|
+
*
|
|
744
|
+
* @returns
|
|
745
|
+
*/
|
|
746
|
+
clone(): A_Meta<_StorageItems>;
|
|
741
747
|
/**
|
|
742
748
|
* Method to set values in the map
|
|
743
749
|
*
|
|
@@ -813,7 +819,18 @@ declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedTy
|
|
|
813
819
|
* Method to clear the map
|
|
814
820
|
*/
|
|
815
821
|
clear(): void;
|
|
822
|
+
/**
|
|
823
|
+
* Method to convert the meta to an array of key-value pairs
|
|
824
|
+
*
|
|
825
|
+
* @returns
|
|
826
|
+
*/
|
|
816
827
|
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
828
|
+
/**
|
|
829
|
+
* Helper method to recursively convert the meta object to a JSON-compatible format. It handles nested A_Meta instances, Maps, Arrays, and plain objects.
|
|
830
|
+
*
|
|
831
|
+
* @param value
|
|
832
|
+
* @returns
|
|
833
|
+
*/
|
|
817
834
|
protected recursiveToJSON(value: any): any;
|
|
818
835
|
/**
|
|
819
836
|
* Serializes the meta to a JSON object
|
|
@@ -2174,6 +2191,11 @@ type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKe
|
|
|
2174
2191
|
* A-Dependency All decorator return type
|
|
2175
2192
|
*/
|
|
2176
2193
|
type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2194
|
+
type A_TYPES__A_Dependency_QueryTarget<T extends A_Entity = A_Entity> = T | A_TYPES__Entity_Constructor<T>;
|
|
2195
|
+
/**
|
|
2196
|
+
* A-Dependency Query decorator return type
|
|
2197
|
+
*/
|
|
2198
|
+
type A_TYPES__A_Dependency_QueryDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2177
2199
|
|
|
2178
2200
|
/**
|
|
2179
2201
|
* Should indicate which Default is required
|
|
@@ -2215,6 +2237,15 @@ declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorR
|
|
|
2215
2237
|
*/
|
|
2216
2238
|
declare function A_Dependency_All(): A_TYPES__A_Dependency_AllDecoratorReturn;
|
|
2217
2239
|
|
|
2240
|
+
/**
|
|
2241
|
+
* 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.
|
|
2242
|
+
*
|
|
2243
|
+
*
|
|
2244
|
+
* @param query
|
|
2245
|
+
* @returns
|
|
2246
|
+
*/
|
|
2247
|
+
declare function A_Dependency_Query<T extends A_Entity = A_Entity>(query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>, pagination?: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>): A_TYPES__A_Dependency_QueryDecoratorReturn;
|
|
2248
|
+
|
|
2218
2249
|
declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> {
|
|
2219
2250
|
/**
|
|
2220
2251
|
* Allows to indicate which Injected parameter is required
|
|
@@ -2256,6 +2287,13 @@ declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__
|
|
|
2256
2287
|
* @returns
|
|
2257
2288
|
*/
|
|
2258
2289
|
static get All(): typeof A_Dependency_All;
|
|
2290
|
+
/**
|
|
2291
|
+
* Allows to indicate that the dependency should be resolved by specific query parameters
|
|
2292
|
+
* e.g. by ASEID, name, type, custom properties, etc.
|
|
2293
|
+
*
|
|
2294
|
+
* @returns
|
|
2295
|
+
*/
|
|
2296
|
+
static get Query(): typeof A_Dependency_Query;
|
|
2259
2297
|
protected _name: string;
|
|
2260
2298
|
protected _target?: A_TYPES__Ctor<T>;
|
|
2261
2299
|
protected _resolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
|
|
@@ -2908,7 +2946,7 @@ type A_TYPES__ScopeLinkedConstructors = A_TYPES__Container_Constructor | A_TYPES
|
|
|
2908
2946
|
/**
|
|
2909
2947
|
* A list of components that can have a scope associated with them
|
|
2910
2948
|
*/
|
|
2911
|
-
type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature;
|
|
2949
|
+
type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature | A_Entity;
|
|
2912
2950
|
/**
|
|
2913
2951
|
* A list of components that are dependent on a scope and do not have their own scope
|
|
2914
2952
|
*/
|
|
@@ -3032,7 +3070,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3032
3070
|
*/
|
|
3033
3071
|
get parent(): A_Scope | undefined;
|
|
3034
3072
|
/**
|
|
3035
|
-
* A_Scope
|
|
3073
|
+
* A_Scope is a unique A-Concept Structure that allows to operate with A-Concept Primitives and Models in a specific context and with specific rules.
|
|
3074
|
+
* It refers to the visibility and accessibility of :
|
|
3036
3075
|
* - variables,
|
|
3037
3076
|
* - Components,
|
|
3038
3077
|
* - Context Fragments
|
|
@@ -3308,7 +3347,27 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3308
3347
|
* Provide the fragment name in PascalCase to retrieve its constructor
|
|
3309
3348
|
*/
|
|
3310
3349
|
name: string): A_TYPES__Fragment_Constructor<T>;
|
|
3311
|
-
resolveConstructor<T extends
|
|
3350
|
+
resolveConstructor<T extends A_Component>(
|
|
3351
|
+
/**
|
|
3352
|
+
* Provide the component constructor or its name to retrieve its constructor
|
|
3353
|
+
*/
|
|
3354
|
+
component: A_TYPES__Ctor<T>): A_TYPES__Component_Constructor<T> | undefined;
|
|
3355
|
+
resolveConstructor<T extends A_Entity>(
|
|
3356
|
+
/**
|
|
3357
|
+
* Provide the entity constructor or its name to retrieve its constructor
|
|
3358
|
+
*/
|
|
3359
|
+
entity: A_TYPES__Ctor<T>): A_TYPES__Entity_Constructor<T> | undefined;
|
|
3360
|
+
resolveConstructor<T extends A_Fragment>(
|
|
3361
|
+
/**
|
|
3362
|
+
* Provide the fragment constructor or its name to retrieve its constructor
|
|
3363
|
+
*/
|
|
3364
|
+
fragment: A_TYPES__Ctor<T>): A_TYPES__Fragment_Constructor<T> | undefined;
|
|
3365
|
+
resolveConstructor<T extends A_Error>(
|
|
3366
|
+
/**
|
|
3367
|
+
* Provide the error constructor or its name to retrieve its constructor
|
|
3368
|
+
*/
|
|
3369
|
+
error: A_TYPES__Ctor<T>): A_TYPES__Error_Constructor<T> | undefined;
|
|
3370
|
+
resolveConstructor<T extends A_TYPES__A_DependencyInjectable>(name: string | A_TYPES__Ctor<T>): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> | undefined;
|
|
3312
3371
|
/**
|
|
3313
3372
|
* This method should resolve all instances of the components, or entities within the scope, by provided parent class
|
|
3314
3373
|
* So in case of providing a base class it should return all instances that extends this base class
|
|
@@ -4178,11 +4237,11 @@ declare class A_Context {
|
|
|
4178
4237
|
* Get meta for the specific entity class by constructor.
|
|
4179
4238
|
*/
|
|
4180
4239
|
entity: A_TYPES__Entity_Constructor): T;
|
|
4181
|
-
static meta<T extends A_EntityMeta>(
|
|
4240
|
+
static meta<T extends A_EntityMeta, E extends A_Entity>(
|
|
4182
4241
|
/**
|
|
4183
4242
|
* Get meta for the specific entity instance.
|
|
4184
4243
|
*/
|
|
4185
|
-
entity:
|
|
4244
|
+
entity: E): T;
|
|
4186
4245
|
static meta<T extends A_ComponentMeta>(
|
|
4187
4246
|
/**
|
|
4188
4247
|
* Get meta for the specific component class by constructor.
|
|
@@ -4968,4 +5027,4 @@ declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES: {
|
|
|
4968
5027
|
type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES][];
|
|
4969
5028
|
declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAME", "A_CONCEPT_ROOT_SCOPE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_RUNTIME_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "A_ERROR_DEFAULT_DESCRIPTION"];
|
|
4970
5029
|
|
|
4971
|
-
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
|
5030
|
+
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Query, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_QueryDecoratorReturn, type A_TYPES__A_Dependency_QueryTarget, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
package/dist/node/index.mjs
CHANGED
|
@@ -505,7 +505,7 @@ var A_CONCEPT_BASE_ENV = class {
|
|
|
505
505
|
* Environment of the application e.g. development, production, staging
|
|
506
506
|
*/
|
|
507
507
|
static get A_CONCEPT_ENVIRONMENT() {
|
|
508
|
-
return "
|
|
508
|
+
return "development";
|
|
509
509
|
}
|
|
510
510
|
/**
|
|
511
511
|
* Runtime environment of the application e.g. browser, node
|
|
@@ -1256,6 +1256,17 @@ var A_Meta = class _A_Meta {
|
|
|
1256
1256
|
this.meta = new Map(meta.meta);
|
|
1257
1257
|
return this;
|
|
1258
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Allows to create a copy of the meta object with the same values, this is needed to ensure that when we inherit meta from the parent component, we create a copy of it, not a reference to the same object. This allows us to modify the meta of the child component without affecting the meta of the parent component.
|
|
1261
|
+
*
|
|
1262
|
+
* @returns
|
|
1263
|
+
*/
|
|
1264
|
+
clone() {
|
|
1265
|
+
const ctor = this.constructor;
|
|
1266
|
+
const copy = new ctor();
|
|
1267
|
+
copy.meta = new Map(this.meta);
|
|
1268
|
+
return copy;
|
|
1269
|
+
}
|
|
1259
1270
|
/**
|
|
1260
1271
|
* Method to set values in the map
|
|
1261
1272
|
*
|
|
@@ -1367,9 +1378,20 @@ var A_Meta = class _A_Meta {
|
|
|
1367
1378
|
clear() {
|
|
1368
1379
|
this.meta.clear();
|
|
1369
1380
|
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Method to convert the meta to an array of key-value pairs
|
|
1383
|
+
*
|
|
1384
|
+
* @returns
|
|
1385
|
+
*/
|
|
1370
1386
|
toArray() {
|
|
1371
1387
|
return Array.from(this.meta.entries());
|
|
1372
1388
|
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Helper method to recursively convert the meta object to a JSON-compatible format. It handles nested A_Meta instances, Maps, Arrays, and plain objects.
|
|
1391
|
+
*
|
|
1392
|
+
* @param value
|
|
1393
|
+
* @returns
|
|
1394
|
+
*/
|
|
1373
1395
|
recursiveToJSON(value) {
|
|
1374
1396
|
switch (true) {
|
|
1375
1397
|
case value instanceof _A_Meta:
|
|
@@ -2134,6 +2156,49 @@ function A_Dependency_All() {
|
|
|
2134
2156
|
};
|
|
2135
2157
|
}
|
|
2136
2158
|
|
|
2159
|
+
// src/lib/A-Dependency/A-Dependency-Query.decorator.ts
|
|
2160
|
+
function A_Dependency_Query(query, pagination) {
|
|
2161
|
+
return function(target, methodName, parameterIndex) {
|
|
2162
|
+
const componentName = A_CommonHelper.getComponentName(target);
|
|
2163
|
+
if (!A_TypeGuards.isTargetAvailableForInjection(target)) {
|
|
2164
|
+
throw new A_DependencyError(
|
|
2165
|
+
A_DependencyError.InvalidDependencyTarget,
|
|
2166
|
+
`A-All cannot be used on the target of type ${typeof target} (${componentName})`
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
const method = methodName ? String(methodName) : "constructor";
|
|
2170
|
+
let metaKey;
|
|
2171
|
+
switch (true) {
|
|
2172
|
+
case (A_TypeGuards.isComponentConstructor(target) || A_TypeGuards.isComponentInstance(target)):
|
|
2173
|
+
metaKey = "a-component-injections" /* INJECTIONS */;
|
|
2174
|
+
break;
|
|
2175
|
+
case A_TypeGuards.isContainerInstance(target):
|
|
2176
|
+
metaKey = "a-container-injections" /* INJECTIONS */;
|
|
2177
|
+
break;
|
|
2178
|
+
case A_TypeGuards.isEntityInstance(target):
|
|
2179
|
+
metaKey = "a-component-injections" /* INJECTIONS */;
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2182
|
+
const existedMeta = A_Context.meta(target).get(metaKey) || new A_Meta();
|
|
2183
|
+
const paramsArray = existedMeta.get(method) || [];
|
|
2184
|
+
paramsArray[parameterIndex].resolutionStrategy = {
|
|
2185
|
+
query: {
|
|
2186
|
+
...paramsArray[parameterIndex].resolutionStrategy.query,
|
|
2187
|
+
...query
|
|
2188
|
+
},
|
|
2189
|
+
pagination: {
|
|
2190
|
+
...paramsArray[parameterIndex].resolutionStrategy.pagination,
|
|
2191
|
+
...pagination
|
|
2192
|
+
}
|
|
2193
|
+
};
|
|
2194
|
+
existedMeta.set(method, paramsArray);
|
|
2195
|
+
A_Context.meta(target).set(
|
|
2196
|
+
metaKey,
|
|
2197
|
+
existedMeta
|
|
2198
|
+
);
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2137
2202
|
// src/lib/A-Dependency/A-Dependency.class.ts
|
|
2138
2203
|
var A_Dependency = class {
|
|
2139
2204
|
/**
|
|
@@ -2213,6 +2278,15 @@ var A_Dependency = class {
|
|
|
2213
2278
|
static get All() {
|
|
2214
2279
|
return A_Dependency_All;
|
|
2215
2280
|
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Allows to indicate that the dependency should be resolved by specific query parameters
|
|
2283
|
+
* e.g. by ASEID, name, type, custom properties, etc.
|
|
2284
|
+
*
|
|
2285
|
+
* @returns
|
|
2286
|
+
*/
|
|
2287
|
+
static get Query() {
|
|
2288
|
+
return A_Dependency_Query;
|
|
2289
|
+
}
|
|
2216
2290
|
get flat() {
|
|
2217
2291
|
return this._resolutionStrategy.flat;
|
|
2218
2292
|
}
|
|
@@ -4070,6 +4144,21 @@ var A_Scope = class {
|
|
|
4070
4144
|
return slice.length === 1 && count !== -1 ? slice[0] : slice.length ? slice : void 0;
|
|
4071
4145
|
}
|
|
4072
4146
|
resolveConstructor(name) {
|
|
4147
|
+
switch (true) {
|
|
4148
|
+
case A_TypeGuards.isComponentConstructor(name):
|
|
4149
|
+
return Array.from(this.allowedComponents).find((c) => A_CommonHelper.isInheritedFrom(c, name));
|
|
4150
|
+
case A_TypeGuards.isEntityConstructor(name):
|
|
4151
|
+
return Array.from(this.allowedEntities).find((e) => A_CommonHelper.isInheritedFrom(e, name));
|
|
4152
|
+
case A_TypeGuards.isFragmentConstructor(name):
|
|
4153
|
+
return Array.from(this.allowedFragments).find((f) => A_CommonHelper.isInheritedFrom(f, name));
|
|
4154
|
+
case A_TypeGuards.isErrorConstructor(name):
|
|
4155
|
+
return Array.from(this.allowedErrors).find((e) => A_CommonHelper.isInheritedFrom(e, name));
|
|
4156
|
+
}
|
|
4157
|
+
if (!A_TypeGuards.isString(name))
|
|
4158
|
+
throw new A_ScopeError(
|
|
4159
|
+
A_ScopeError.ResolutionError,
|
|
4160
|
+
`Invalid constructor name provided: ${name}`
|
|
4161
|
+
);
|
|
4073
4162
|
const component = Array.from(this.allowedComponents).find(
|
|
4074
4163
|
(c) => c.name === name || c.name === A_FormatterHelper.toPascalCase(name)
|
|
4075
4164
|
);
|
|
@@ -4972,7 +5061,7 @@ var A_Context = class _A_Context {
|
|
|
4972
5061
|
}
|
|
4973
5062
|
if (!inheritedMeta)
|
|
4974
5063
|
inheritedMeta = new metaType();
|
|
4975
|
-
instance._metaStorage.set(property,
|
|
5064
|
+
instance._metaStorage.set(property, inheritedMeta.clone());
|
|
4976
5065
|
}
|
|
4977
5066
|
return instance._metaStorage.get(property);
|
|
4978
5067
|
}
|
|
@@ -5004,13 +5093,6 @@ var A_Context = class _A_Context {
|
|
|
5004
5093
|
if (!this.isAllowedForScopeAllocation(param1) && !this.isAllowedToBeRegistered(param1))
|
|
5005
5094
|
throw new A_ContextError(A_ContextError.InvalidScopeParameterError, `Invalid parameter provided to get scope. Component of type ${name} is not allowed for scope allocation.`);
|
|
5006
5095
|
switch (true) {
|
|
5007
|
-
case this.isAllowedForScopeAllocation(param1):
|
|
5008
|
-
if (!instance._registry.has(param1))
|
|
5009
|
-
throw new A_ContextError(
|
|
5010
|
-
A_ContextError.ScopeNotFoundError,
|
|
5011
|
-
`Invalid parameter provided to get scope. Component of type ${name} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`
|
|
5012
|
-
);
|
|
5013
|
-
return instance._registry.get(param1);
|
|
5014
5096
|
case this.isAllowedToBeRegistered(param1):
|
|
5015
5097
|
if (!instance._scopeStorage.has(param1))
|
|
5016
5098
|
throw new A_ContextError(
|
|
@@ -5018,6 +5100,13 @@ var A_Context = class _A_Context {
|
|
|
5018
5100
|
`Invalid parameter provided to get scope. Component of type ${name} does not have a scope registered. Make sure to register the component using A_Context.register() method before trying to get the scope.`
|
|
5019
5101
|
);
|
|
5020
5102
|
return instance._scopeStorage.get(param1);
|
|
5103
|
+
case this.isAllowedForScopeAllocation(param1):
|
|
5104
|
+
if (!instance._registry.has(param1))
|
|
5105
|
+
throw new A_ContextError(
|
|
5106
|
+
A_ContextError.ScopeNotFoundError,
|
|
5107
|
+
`Invalid parameter provided to get scope. Component of type ${name} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`
|
|
5108
|
+
);
|
|
5109
|
+
return instance._registry.get(param1);
|
|
5021
5110
|
default:
|
|
5022
5111
|
throw new A_ContextError(A_ContextError.InvalidScopeParameterError, `Invalid parameter provided to get scope. Component of type ${name} is not allowed to be registered.`);
|
|
5023
5112
|
}
|
|
@@ -5235,7 +5324,7 @@ var A_Context = class _A_Context {
|
|
|
5235
5324
|
* @returns
|
|
5236
5325
|
*/
|
|
5237
5326
|
static isAllowedForScopeAllocation(param) {
|
|
5238
|
-
return A_TypeGuards.isContainerInstance(param) || A_TypeGuards.isFeatureInstance(param);
|
|
5327
|
+
return A_TypeGuards.isContainerInstance(param) || A_TypeGuards.isFeatureInstance(param) || A_TypeGuards.isEntityInstance(param);
|
|
5239
5328
|
}
|
|
5240
5329
|
/**
|
|
5241
5330
|
* Type guard to check if the param is allowed to be registered in the context.
|
|
@@ -5696,6 +5785,6 @@ function A_Inject(param1, param2) {
|
|
|
5696
5785
|
};
|
|
5697
5786
|
}
|
|
5698
5787
|
|
|
5699
|
-
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, A_TYPES__A_Stage_Status, A_TYPES__ComponentMetaKey, A_TYPES__ConceptAbstractions, A_TYPES__ConceptMetaKey, A_TYPES__ContainerMetaKey, A_TYPES__EntityFeatures, A_TYPES__EntityMetaKey, A_TYPES__FeatureState, A_TypeGuards };
|
|
5788
|
+
export { ASEID, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_BasicTypeGuards, A_CONCEPT_ENV, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_All, A_Dependency_Default, A_Dependency_Flat, A_Dependency_Load, A_Dependency_Parent, A_Dependency_Query, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, A_TYPES__A_Stage_Status, A_TYPES__ComponentMetaKey, A_TYPES__ConceptAbstractions, A_TYPES__ConceptMetaKey, A_TYPES__ContainerMetaKey, A_TYPES__EntityFeatures, A_TYPES__EntityMetaKey, A_TYPES__FeatureState, A_TypeGuards };
|
|
5700
5789
|
//# sourceMappingURL=index.mjs.map
|
|
5701
5790
|
//# sourceMappingURL=index.mjs.map
|