@adaas/a-concept 0.1.55 → 0.1.56

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.d.mts CHANGED
@@ -2916,6 +2916,41 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2916
2916
  * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
2917
2917
  */
2918
2918
  constructor: string): boolean;
2919
+ /**
2920
+ * This method is used to check if the component is available in the scope
2921
+ *
2922
+ * [!] Note that this method checks for the component ONLY in the current scope
2923
+ *
2924
+ * @param component
2925
+ * @returns
2926
+ */
2927
+ hasFlat<T extends A_Component>(
2928
+ /**
2929
+ * Provide a component constructor to check if it's available in the scope
2930
+ */
2931
+ component: A_TYPES__Component_Constructor<T>): boolean;
2932
+ hasFlat<T extends A_Entity>(
2933
+ /**
2934
+ * Provide an entity constructor to check if it's available in the scope
2935
+ *
2936
+ * [!] Note that entities are unique per aseid, so this method checks if there's at least one entity of the provided type in the scope
2937
+ */
2938
+ entity: A_TYPES__Entity_Constructor<T>): boolean;
2939
+ hasFlat<T extends A_Fragment>(
2940
+ /**
2941
+ * Provide a fragment constructor to check if it's available in the scope
2942
+ */
2943
+ fragment: A_TYPES__Fragment_Constructor<T>): boolean;
2944
+ hasFlat<T extends A_Error>(
2945
+ /**
2946
+ * Provide an error constructor to check if it's available in the scope
2947
+ */
2948
+ error: A_TYPES__Error_Constructor<T>): boolean;
2949
+ hasFlat(
2950
+ /**
2951
+ * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
2952
+ */
2953
+ constructor: string): boolean;
2919
2954
  /**
2920
2955
  * Merges two scopes into a new one
2921
2956
  *
@@ -2956,6 +2991,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2956
2991
  * This method should resolve all instances of the components, or entities within the scope, by provided parent class
2957
2992
  * So in case of providing a base class it should return all instances that extends this base class
2958
2993
  *
2994
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
2995
+ *
2959
2996
  * @param component
2960
2997
  */
2961
2998
  resolveAll<T extends A_Component>(
@@ -2974,6 +3011,30 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2974
3011
  */
2975
3012
  entity: A_TYPES__Entity_Constructor<T>): Array<T>;
2976
3013
  resolveAll<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): Array<T>;
3014
+ /**
3015
+ * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3016
+ * So in case of providing a base class it should return all instances that extends this base class
3017
+ *
3018
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
3019
+ *
3020
+ * @param component
3021
+ */
3022
+ resolveFlatAll<T extends A_Component>(
3023
+ /**
3024
+ * Provide a component constructor to resolve its instance from the scope
3025
+ */
3026
+ component: A_TYPES__Component_Constructor<T>): Array<T>;
3027
+ resolveFlatAll<T extends A_Fragment>(
3028
+ /**
3029
+ * Provide a fragment constructor to resolve its instance from the scope
3030
+ */
3031
+ fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3032
+ resolveFlatAll<T extends A_Entity>(
3033
+ /**
3034
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3035
+ */
3036
+ entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3037
+ resolveFlatAll<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): Array<T>;
2977
3038
  /**
2978
3039
  * This method allows to resolve/inject a component, fragment or entity from the scope
2979
3040
  * Depending on the provided parameters it can resolve:
@@ -3043,15 +3104,93 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3043
3104
  * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3044
3105
  */
3045
3106
  param1: InstanceType<T>): T | Array<T> | undefined;
3107
+ /**
3108
+ * This polymorphic method allows to resolve/inject a component, fragment or entity from the scope
3109
+ * Depending on the provided parameters it can resolve:
3110
+ * - A single component/fragment/entity by its constructor or name
3111
+ * - An array of components/fragments/entities by providing an array of constructors
3112
+ * - An entity or an array of entities by providing the entity constructor and query instructions
3113
+ *
3114
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
3115
+ *
3116
+ * @param component
3117
+ */
3118
+ resolveFlat<T extends A_Component>(
3119
+ /**
3120
+ * Provide a component constructor to resolve its instance from the scope
3121
+ */
3122
+ component: A_TYPES__Component_Constructor<T>): T | undefined;
3123
+ resolveFlat<T extends A_TYPES__Component_Constructor[]>(
3124
+ /**
3125
+ * Provide an array of component constructors to resolve their instances from the scope
3126
+ */
3127
+ components: [...T]): Array<InstanceType<T[number]>> | undefined;
3128
+ resolveFlat<T extends A_Fragment>(
3129
+ /**
3130
+ * Provide a fragment constructor to resolve its instance from the scope
3131
+ */
3132
+ fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3133
+ resolveFlat<T extends A_TYPES__Fragment_Constructor[]>(
3134
+ /**
3135
+ * Provide an array of fragment constructors to resolve their instances from the scope
3136
+ */
3137
+ fragments: [...T]): Array<InstanceType<T[number]>> | undefined;
3138
+ resolveFlat<T extends A_Entity>(
3139
+ /**
3140
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3141
+ */
3142
+ entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3143
+ resolveFlat<T extends A_Entity>(
3144
+ /**
3145
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3146
+ */
3147
+ entity: A_TYPES__Entity_Constructor<T>,
3148
+ /**
3149
+ * Provide optional instructions to find a specific entity or a set of entities
3150
+ */
3151
+ instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): Array<T>;
3152
+ resolveFlat<T extends A_Scope>(
3153
+ /**
3154
+ * Uses only in case of resolving a single entity
3155
+ *
3156
+ * Provide an entity constructor to resolve its instance from the scope
3157
+ */
3158
+ scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3159
+ resolveFlat<T extends A_Error>(
3160
+ /**
3161
+ * Uses only in case of resolving a single entity
3162
+ *
3163
+ * Provide an entity constructor to resolve its instance from the scope
3164
+ */
3165
+ scope: A_TYPES__Error_Constructor<T>): T | undefined;
3166
+ resolveFlat<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): T | undefined;
3167
+ resolveFlat<T extends A_TYPES__ScopeResolvableComponents>(
3168
+ /**
3169
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3170
+ */
3171
+ param1: A_TYPES__InjectableConstructors): T | Array<T> | undefined;
3172
+ resolveFlat<T extends A_TYPES__ScopeLinkedConstructors>(
3173
+ /**
3174
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3175
+ */
3176
+ param1: InstanceType<T>): T | Array<T> | undefined;
3046
3177
  /**
3047
3178
  * This method is used internally to resolve a component, fragment or entity by its constructor name
3048
3179
  *
3049
3180
  * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
3181
+ * [!!] Note: No parent scopes are checked
3050
3182
  *
3051
3183
  * @param name - name of the component, fragment or entity to resolve (constructor name for components and fragments, static entity property for entities, static code property for commands)
3052
3184
  * @returns
3053
3185
  */
3054
3186
  private resolveByName;
3187
+ /**
3188
+ * Resolves a component, fragment or entity from the scope without checking parent scopes
3189
+ *
3190
+ * @param component
3191
+ * @param instructions
3192
+ */
3193
+ private resolveFlatOnce;
3055
3194
  /**
3056
3195
  * This method is used internally to resolve a single component, fragment or entity from the scope
3057
3196
  *
@@ -3060,11 +3199,22 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3060
3199
  * @returns
3061
3200
  */
3062
3201
  private resolveOnce;
3202
+ /**
3203
+ * Resolves the issuer of the scope by provided constructor
3204
+ *
3205
+ * [!] Note that this method checks ONLY for the direct issuer of the scope
3206
+ * [!!] No parent scopes are checked
3207
+ *
3208
+ *
3209
+ * @param ctor
3210
+ * @returns
3211
+ */
3063
3212
  private resolveIssuer;
3064
3213
  /**
3065
3214
  * This method is used internally to resolve a single entity from the scope based on the provided instructions
3066
3215
  *
3067
3216
  * [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
3217
+ * [!!] Note: No parent scopes are checked
3068
3218
  *
3069
3219
  * @param entity
3070
3220
  * @param instructions
@@ -3074,6 +3224,9 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3074
3224
  /**
3075
3225
  * This method is used internally to resolve a single error from the scope
3076
3226
  *
3227
+ * [!] Note that errors are singleton instances within the scope
3228
+ * [!!] No parent scopes are checked
3229
+ *
3077
3230
  * @param error
3078
3231
  * @returns
3079
3232
  */
@@ -3081,6 +3234,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3081
3234
  /**
3082
3235
  * This method is used internally to resolve a single fragment from the scope
3083
3236
  *
3237
+ * [!] Note that this method checks for the fragment in the current scope and all parent scopes
3238
+ *
3084
3239
  * @param fragment
3085
3240
  * @returns
3086
3241
  */
@@ -3095,6 +3250,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3095
3250
  /**
3096
3251
  * This method is used internally to resolve a single component from the scope
3097
3252
  *
3253
+ * [!!] Note: No parent scopes are checked
3254
+ *
3098
3255
  * @param component
3099
3256
  * @returns
3100
3257
  */
package/dist/index.d.ts CHANGED
@@ -2916,6 +2916,41 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2916
2916
  * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
2917
2917
  */
2918
2918
  constructor: string): boolean;
2919
+ /**
2920
+ * This method is used to check if the component is available in the scope
2921
+ *
2922
+ * [!] Note that this method checks for the component ONLY in the current scope
2923
+ *
2924
+ * @param component
2925
+ * @returns
2926
+ */
2927
+ hasFlat<T extends A_Component>(
2928
+ /**
2929
+ * Provide a component constructor to check if it's available in the scope
2930
+ */
2931
+ component: A_TYPES__Component_Constructor<T>): boolean;
2932
+ hasFlat<T extends A_Entity>(
2933
+ /**
2934
+ * Provide an entity constructor to check if it's available in the scope
2935
+ *
2936
+ * [!] Note that entities are unique per aseid, so this method checks if there's at least one entity of the provided type in the scope
2937
+ */
2938
+ entity: A_TYPES__Entity_Constructor<T>): boolean;
2939
+ hasFlat<T extends A_Fragment>(
2940
+ /**
2941
+ * Provide a fragment constructor to check if it's available in the scope
2942
+ */
2943
+ fragment: A_TYPES__Fragment_Constructor<T>): boolean;
2944
+ hasFlat<T extends A_Error>(
2945
+ /**
2946
+ * Provide an error constructor to check if it's available in the scope
2947
+ */
2948
+ error: A_TYPES__Error_Constructor<T>): boolean;
2949
+ hasFlat(
2950
+ /**
2951
+ * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
2952
+ */
2953
+ constructor: string): boolean;
2919
2954
  /**
2920
2955
  * Merges two scopes into a new one
2921
2956
  *
@@ -2956,6 +2991,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2956
2991
  * This method should resolve all instances of the components, or entities within the scope, by provided parent class
2957
2992
  * So in case of providing a base class it should return all instances that extends this base class
2958
2993
  *
2994
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
2995
+ *
2959
2996
  * @param component
2960
2997
  */
2961
2998
  resolveAll<T extends A_Component>(
@@ -2974,6 +3011,30 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
2974
3011
  */
2975
3012
  entity: A_TYPES__Entity_Constructor<T>): Array<T>;
2976
3013
  resolveAll<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): Array<T>;
3014
+ /**
3015
+ * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3016
+ * So in case of providing a base class it should return all instances that extends this base class
3017
+ *
3018
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
3019
+ *
3020
+ * @param component
3021
+ */
3022
+ resolveFlatAll<T extends A_Component>(
3023
+ /**
3024
+ * Provide a component constructor to resolve its instance from the scope
3025
+ */
3026
+ component: A_TYPES__Component_Constructor<T>): Array<T>;
3027
+ resolveFlatAll<T extends A_Fragment>(
3028
+ /**
3029
+ * Provide a fragment constructor to resolve its instance from the scope
3030
+ */
3031
+ fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3032
+ resolveFlatAll<T extends A_Entity>(
3033
+ /**
3034
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3035
+ */
3036
+ entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3037
+ resolveFlatAll<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): Array<T>;
2977
3038
  /**
2978
3039
  * This method allows to resolve/inject a component, fragment or entity from the scope
2979
3040
  * Depending on the provided parameters it can resolve:
@@ -3043,15 +3104,93 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3043
3104
  * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3044
3105
  */
3045
3106
  param1: InstanceType<T>): T | Array<T> | undefined;
3107
+ /**
3108
+ * This polymorphic method allows to resolve/inject a component, fragment or entity from the scope
3109
+ * Depending on the provided parameters it can resolve:
3110
+ * - A single component/fragment/entity by its constructor or name
3111
+ * - An array of components/fragments/entities by providing an array of constructors
3112
+ * - An entity or an array of entities by providing the entity constructor and query instructions
3113
+ *
3114
+ * [!] Applicable for the current scope ONLY, no parent scopes are checked
3115
+ *
3116
+ * @param component
3117
+ */
3118
+ resolveFlat<T extends A_Component>(
3119
+ /**
3120
+ * Provide a component constructor to resolve its instance from the scope
3121
+ */
3122
+ component: A_TYPES__Component_Constructor<T>): T | undefined;
3123
+ resolveFlat<T extends A_TYPES__Component_Constructor[]>(
3124
+ /**
3125
+ * Provide an array of component constructors to resolve their instances from the scope
3126
+ */
3127
+ components: [...T]): Array<InstanceType<T[number]>> | undefined;
3128
+ resolveFlat<T extends A_Fragment>(
3129
+ /**
3130
+ * Provide a fragment constructor to resolve its instance from the scope
3131
+ */
3132
+ fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3133
+ resolveFlat<T extends A_TYPES__Fragment_Constructor[]>(
3134
+ /**
3135
+ * Provide an array of fragment constructors to resolve their instances from the scope
3136
+ */
3137
+ fragments: [...T]): Array<InstanceType<T[number]>> | undefined;
3138
+ resolveFlat<T extends A_Entity>(
3139
+ /**
3140
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3141
+ */
3142
+ entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3143
+ resolveFlat<T extends A_Entity>(
3144
+ /**
3145
+ * Provide an entity constructor to resolve its instance or an array of instances from the scope
3146
+ */
3147
+ entity: A_TYPES__Entity_Constructor<T>,
3148
+ /**
3149
+ * Provide optional instructions to find a specific entity or a set of entities
3150
+ */
3151
+ instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): Array<T>;
3152
+ resolveFlat<T extends A_Scope>(
3153
+ /**
3154
+ * Uses only in case of resolving a single entity
3155
+ *
3156
+ * Provide an entity constructor to resolve its instance from the scope
3157
+ */
3158
+ scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3159
+ resolveFlat<T extends A_Error>(
3160
+ /**
3161
+ * Uses only in case of resolving a single entity
3162
+ *
3163
+ * Provide an entity constructor to resolve its instance from the scope
3164
+ */
3165
+ scope: A_TYPES__Error_Constructor<T>): T | undefined;
3166
+ resolveFlat<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): T | undefined;
3167
+ resolveFlat<T extends A_TYPES__ScopeResolvableComponents>(
3168
+ /**
3169
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3170
+ */
3171
+ param1: A_TYPES__InjectableConstructors): T | Array<T> | undefined;
3172
+ resolveFlat<T extends A_TYPES__ScopeLinkedConstructors>(
3173
+ /**
3174
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3175
+ */
3176
+ param1: InstanceType<T>): T | Array<T> | undefined;
3046
3177
  /**
3047
3178
  * This method is used internally to resolve a component, fragment or entity by its constructor name
3048
3179
  *
3049
3180
  * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
3181
+ * [!!] Note: No parent scopes are checked
3050
3182
  *
3051
3183
  * @param name - name of the component, fragment or entity to resolve (constructor name for components and fragments, static entity property for entities, static code property for commands)
3052
3184
  * @returns
3053
3185
  */
3054
3186
  private resolveByName;
3187
+ /**
3188
+ * Resolves a component, fragment or entity from the scope without checking parent scopes
3189
+ *
3190
+ * @param component
3191
+ * @param instructions
3192
+ */
3193
+ private resolveFlatOnce;
3055
3194
  /**
3056
3195
  * This method is used internally to resolve a single component, fragment or entity from the scope
3057
3196
  *
@@ -3060,11 +3199,22 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3060
3199
  * @returns
3061
3200
  */
3062
3201
  private resolveOnce;
3202
+ /**
3203
+ * Resolves the issuer of the scope by provided constructor
3204
+ *
3205
+ * [!] Note that this method checks ONLY for the direct issuer of the scope
3206
+ * [!!] No parent scopes are checked
3207
+ *
3208
+ *
3209
+ * @param ctor
3210
+ * @returns
3211
+ */
3063
3212
  private resolveIssuer;
3064
3213
  /**
3065
3214
  * This method is used internally to resolve a single entity from the scope based on the provided instructions
3066
3215
  *
3067
3216
  * [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
3217
+ * [!!] Note: No parent scopes are checked
3068
3218
  *
3069
3219
  * @param entity
3070
3220
  * @param instructions
@@ -3074,6 +3224,9 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3074
3224
  /**
3075
3225
  * This method is used internally to resolve a single error from the scope
3076
3226
  *
3227
+ * [!] Note that errors are singleton instances within the scope
3228
+ * [!!] No parent scopes are checked
3229
+ *
3077
3230
  * @param error
3078
3231
  * @returns
3079
3232
  */
@@ -3081,6 +3234,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3081
3234
  /**
3082
3235
  * This method is used internally to resolve a single fragment from the scope
3083
3236
  *
3237
+ * [!] Note that this method checks for the fragment in the current scope and all parent scopes
3238
+ *
3084
3239
  * @param fragment
3085
3240
  * @returns
3086
3241
  */
@@ -3095,6 +3250,8 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
3095
3250
  /**
3096
3251
  * This method is used internally to resolve a single component from the scope
3097
3252
  *
3253
+ * [!!] Note: No parent scopes are checked
3254
+ *
3098
3255
  * @param component
3099
3256
  * @returns
3100
3257
  */