@adaas/a-concept 0.1.60 → 0.2.1
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1584 -1456
- package/dist/index.d.ts +1584 -1456
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/global/A-Abstraction/A-Abstraction.types.ts +2 -3
- package/src/global/A-Caller/A_Caller.types.ts +2 -1
- package/src/global/A-Component/A-Component.types.ts +2 -1
- package/src/global/A-Concept/A-Concept.types.ts +2 -1
- package/src/global/A-Container/A-Container.types.ts +2 -1
- package/src/global/A-Context/A-Context.class.ts +56 -25
- package/src/global/A-Dependency/A-Dependency-All.decorator.ts +77 -0
- package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +4 -4
- package/src/global/A-Dependency/A-Dependency-Flat.decorator.ts +3 -2
- package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +9 -13
- package/src/global/A-Dependency/A-Dependency-Parent.decorator.ts +2 -3
- package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +1 -2
- package/src/global/A-Dependency/A-Dependency.class.ts +144 -5
- package/src/global/A-Dependency/A-Dependency.error.ts +3 -0
- package/src/global/A-Dependency/A-Dependency.types.ts +124 -3
- package/src/global/A-Entity/A-Entity.types.ts +2 -1
- package/src/global/A-Error/A_Error.types.ts +2 -1
- package/src/global/A-Feature/A-Feature-Define.decorator.ts +0 -1
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +1 -5
- package/src/global/A-Feature/A-Feature.types.ts +3 -3
- package/src/global/A-Fragment/A-Fragment.types.ts +2 -1
- package/src/global/A-Inject/A-Inject.decorator.ts +70 -42
- package/src/global/A-Inject/A-Inject.types.ts +2 -42
- package/src/global/A-Meta/A-Meta.decorator.ts +5 -3
- package/src/global/A-Meta/A-Meta.types.ts +2 -1
- package/src/global/A-Scope/A-Scope.class.ts +409 -389
- package/src/global/A-Scope/A-Scope.error.ts +2 -0
- package/src/global/A-Scope/A-Scope.types.ts +4 -8
- package/src/global/A-Stage/A-Stage.class.ts +19 -86
- package/src/global/A-Stage/A-Stage.types.ts +3 -1
- package/src/global/A-StepManager/A-StepManager.class.ts +1 -1
- package/src/global/ASEID/ASEID.class.ts +20 -0
- package/src/helpers/A_Common.helper.ts +4 -0
- package/src/helpers/A_TypeGuards.helper.ts +28 -3
- package/src/types/A_Common.types.ts +4 -0
- package/tests/A-Abstraction.test.ts +2 -0
- package/tests/A-Dependency.test.ts +49 -5
- package/tests/A-Feature.test.ts +44 -19
- package/tests/A-Meta.test.ts +4 -0
- package/tests/A-Scope.test.ts +38 -9
- package/tests/A-StepManager.test.ts +40 -39
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[
|
|
|
33
33
|
declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAME", "A_CONCEPT_ROOT_SCOPE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "A_ERROR_DEFAULT_DESCRIPTION"];
|
|
34
34
|
|
|
35
35
|
type Decrement = [never, 0, 1, 2, 3, 4, 5];
|
|
36
|
+
type A_TYPES__Ctor<T> = new (...args: any[]) => T;
|
|
36
37
|
type A_TYPES__DeepPartial<T, D extends number = 5> = {
|
|
37
38
|
[P in keyof Required<T>]?: [
|
|
38
39
|
D
|
|
@@ -68,6 +69,177 @@ type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__Uni
|
|
|
68
69
|
[K in keyof P]: P[K] extends string ? A_TYPES__ExtractNested<T, P[K]> : never;
|
|
69
70
|
}[number]>;
|
|
70
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Fragment constructor type
|
|
74
|
+
* Uses the generic type T to specify the type of the fragment
|
|
75
|
+
*/
|
|
76
|
+
type A_TYPES__Fragment_Constructor<T = A_Fragment> = A_TYPES__Ctor<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Fragment initialization type
|
|
79
|
+
*/
|
|
80
|
+
type A_TYPES__Fragment_Init = {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Fragment serialized type
|
|
85
|
+
*/
|
|
86
|
+
type A_TYPES__Fragment_Serialized = {
|
|
87
|
+
/**
|
|
88
|
+
* The Name of the fragment
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* A_Fragment is a core architectural component that represents a singleton execution context
|
|
95
|
+
* within the A-Concept framework. It serves as a shared memory container that can be passed
|
|
96
|
+
* between Components, Entities, and Commands throughout the application pipeline.
|
|
97
|
+
*
|
|
98
|
+
* Key Features:
|
|
99
|
+
* - Singleton pattern: Only one instance per fragment type per scope
|
|
100
|
+
* - Meta storage: Built-in key-value storage for pipeline data
|
|
101
|
+
* - Type-safe: Full TypeScript generics support for meta items and serialization
|
|
102
|
+
* - Serializable: Can be converted to JSON for persistence or transmission
|
|
103
|
+
*
|
|
104
|
+
* @template _MetaItems - Type definition for the meta storage structure
|
|
105
|
+
* @template _SerializedType - Type definition for the serialized output format
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // Basic usage with typed meta
|
|
110
|
+
* class UserFragment extends A_Fragment<{ userId: string; role: string }> {
|
|
111
|
+
* constructor() {
|
|
112
|
+
* super({ name: 'UserFragment' });
|
|
113
|
+
* }
|
|
114
|
+
* }
|
|
115
|
+
*
|
|
116
|
+
* // Custom serialization
|
|
117
|
+
* class SessionFragment extends A_Fragment<
|
|
118
|
+
* { sessionId: string; timestamp: number },
|
|
119
|
+
* { name: string; sessionData: string }
|
|
120
|
+
* > {
|
|
121
|
+
* toJSON() {
|
|
122
|
+
* return {
|
|
123
|
+
* name: this.name,
|
|
124
|
+
* sessionData: `${this.get('sessionId')}-${this.get('timestamp')}`
|
|
125
|
+
* };
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
131
|
+
/**
|
|
132
|
+
* The unique identifier/name for this fragment instance.
|
|
133
|
+
* Used for identification and debugging purposes.
|
|
134
|
+
*/
|
|
135
|
+
protected _name: string;
|
|
136
|
+
/**
|
|
137
|
+
* Creates a new A_Fragment instance.
|
|
138
|
+
*
|
|
139
|
+
* A_Fragment implements the singleton pattern for execution contexts, allowing
|
|
140
|
+
* shared state management across different parts of the application pipeline.
|
|
141
|
+
* Each fragment serves as a memory container that can store typed data and be
|
|
142
|
+
* serialized for persistence or transmission.
|
|
143
|
+
*
|
|
144
|
+
* Key Benefits:
|
|
145
|
+
* - Centralized state management for related operations
|
|
146
|
+
* - Type-safe meta operations with full IntelliSense support
|
|
147
|
+
* - Serialization support for data persistence
|
|
148
|
+
* - Singleton pattern ensures consistent state within scope
|
|
149
|
+
*
|
|
150
|
+
* @param params - Initialization parameters
|
|
151
|
+
* @param params.name - Optional custom name for the fragment (defaults to class name)
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const fragment = new A_Fragment<{ userId: string }>({
|
|
156
|
+
* name: 'UserSessionFragment'
|
|
157
|
+
* });
|
|
158
|
+
* fragment.set('userId', '12345');
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
constructor(params?: Partial<A_TYPES__Fragment_Init>);
|
|
162
|
+
/**
|
|
163
|
+
* Gets the fragment's unique name/identifier.
|
|
164
|
+
*
|
|
165
|
+
* @returns The fragment name
|
|
166
|
+
*/
|
|
167
|
+
get name(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Serializes the fragment to a JSON-compatible object.
|
|
170
|
+
*
|
|
171
|
+
* This method combines the fragment's name with all meta data to create
|
|
172
|
+
* a serializable representation. The return type is determined by the
|
|
173
|
+
* _SerializedType generic parameter, allowing for custom serialization formats.
|
|
174
|
+
*
|
|
175
|
+
* @returns A serialized representation of the fragment
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const fragment = new A_Fragment<{ userId: string, role: string }>({
|
|
180
|
+
* name: 'UserFragment'
|
|
181
|
+
* });
|
|
182
|
+
* fragment.set('userId', '12345');
|
|
183
|
+
* fragment.set('role', 'admin');
|
|
184
|
+
*
|
|
185
|
+
* const json = fragment.toJSON();
|
|
186
|
+
* // Result: { name: 'UserFragment', userId: '12345', role: 'admin' }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
toJSON(): _SerializedType;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare class A_Container {
|
|
193
|
+
/**
|
|
194
|
+
* Configuration of the container that will be used to run it.
|
|
195
|
+
*/
|
|
196
|
+
protected readonly config: Partial<A_TYPES__Container_Init>;
|
|
197
|
+
/**
|
|
198
|
+
* Name of the container
|
|
199
|
+
*/
|
|
200
|
+
get name(): string;
|
|
201
|
+
/**
|
|
202
|
+
* Returns the scope where the container is registered
|
|
203
|
+
*/
|
|
204
|
+
get scope(): A_Scope;
|
|
205
|
+
/**
|
|
206
|
+
* This class should combine Components to achieve the goal withing Concept
|
|
207
|
+
*
|
|
208
|
+
* Container is a direct container that should be "run" to make Concept work.
|
|
209
|
+
* So because of that Container can be:
|
|
210
|
+
* - HTTP Server
|
|
211
|
+
* - BASH Script
|
|
212
|
+
* - Database Connection
|
|
213
|
+
* - Microservice
|
|
214
|
+
* - etc.
|
|
215
|
+
*
|
|
216
|
+
* @param config - Configuration of the container that will be used to run it.
|
|
217
|
+
*/
|
|
218
|
+
constructor(
|
|
219
|
+
/**
|
|
220
|
+
* Configuration of the container that will be used to run it.
|
|
221
|
+
*/
|
|
222
|
+
config?: Partial<A_TYPES__Container_Init>);
|
|
223
|
+
/**
|
|
224
|
+
* Calls the feature with the given name in the given scope
|
|
225
|
+
*
|
|
226
|
+
* [!] Note: This method creates a new instance of the feature every time it is called
|
|
227
|
+
*
|
|
228
|
+
* @param feature - the name of the feature to call
|
|
229
|
+
* @param scope - the scope in which to call the feature
|
|
230
|
+
* @returns - void
|
|
231
|
+
*/
|
|
232
|
+
call(
|
|
233
|
+
/**
|
|
234
|
+
* Name of the feature to call
|
|
235
|
+
*/
|
|
236
|
+
feature: string,
|
|
237
|
+
/**
|
|
238
|
+
* scope in which the feature will be executed
|
|
239
|
+
*/
|
|
240
|
+
scope?: A_Scope): Promise<void>;
|
|
241
|
+
}
|
|
242
|
+
|
|
71
243
|
declare enum A_TYPES__ConceptAbstractions {
|
|
72
244
|
/**
|
|
73
245
|
* Run the concept.
|
|
@@ -102,104 +274,129 @@ declare enum A_TYPES__ConceptMetaKey {
|
|
|
102
274
|
LIFECYCLE = "a-component-extensions"
|
|
103
275
|
}
|
|
104
276
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
277
|
+
/**
|
|
278
|
+
* This is a common class that uses to return an entity that initiates a feature call
|
|
279
|
+
*
|
|
280
|
+
* It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
|
|
281
|
+
*
|
|
282
|
+
* [!] the class itself may be retrieved, but may require additional processing inside the feature
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
declare class A_Caller<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
|
|
110
286
|
/**
|
|
111
|
-
* The
|
|
287
|
+
* The component that initiated the feature call
|
|
112
288
|
*/
|
|
113
|
-
|
|
289
|
+
protected _component: T;
|
|
114
290
|
/**
|
|
115
|
-
*
|
|
291
|
+
* A_Caller allows to get the component that initiated the feature call
|
|
292
|
+
*
|
|
293
|
+
* It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
|
|
294
|
+
*
|
|
295
|
+
* [!] If Scope is not provided, a new empty scope will be created and inherited from the global scope
|
|
296
|
+
*
|
|
297
|
+
* @param component
|
|
298
|
+
* @param scope
|
|
116
299
|
*/
|
|
117
|
-
|
|
300
|
+
constructor(component: T);
|
|
301
|
+
get component(): T;
|
|
118
302
|
/**
|
|
119
|
-
*
|
|
303
|
+
* Validates the provided parameters and Ensures that the component is of an allowed type
|
|
304
|
+
*
|
|
305
|
+
* @param component
|
|
120
306
|
*/
|
|
121
|
-
|
|
307
|
+
protected validateParams(component: T): void;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Entity constructor type
|
|
312
|
+
* Uses the generic type T to specify the type of the entity
|
|
313
|
+
*/
|
|
314
|
+
type A_TYPES__Error_Constructor<T = A_Error> = A_TYPES__Ctor<T>;
|
|
315
|
+
/**
|
|
316
|
+
* Error initialization type
|
|
317
|
+
*/
|
|
318
|
+
type A_TYPES__Error_Init = {
|
|
122
319
|
/**
|
|
123
|
-
*
|
|
320
|
+
* Error title
|
|
321
|
+
*
|
|
322
|
+
* A short description of the error
|
|
124
323
|
*/
|
|
324
|
+
title: string;
|
|
125
325
|
/**
|
|
126
|
-
*
|
|
326
|
+
* Error code representing the type of error
|
|
327
|
+
*
|
|
328
|
+
* Should be unique within the application or service
|
|
329
|
+
*
|
|
330
|
+
* Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
|
|
331
|
+
*
|
|
332
|
+
* [!] Note: It is recommended to use kebab-case for error codes
|
|
333
|
+
* [!] Note: If not provided would be used a kebab-case message of the error
|
|
127
334
|
*/
|
|
335
|
+
code?: string;
|
|
128
336
|
/**
|
|
129
|
-
*
|
|
337
|
+
* Possible Scope if needed to identify the error by it's execution environment
|
|
338
|
+
*
|
|
339
|
+
* For example, error of type 'validation' could happen in different scopes
|
|
340
|
+
* like 'user', 'admin', 'system' etc. This will help to identify the error context better
|
|
341
|
+
*
|
|
342
|
+
* Could be string or A_Scope instance
|
|
343
|
+
*
|
|
344
|
+
* [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
|
|
130
345
|
*/
|
|
346
|
+
scope?: string | A_Scope;
|
|
131
347
|
/**
|
|
132
|
-
*
|
|
348
|
+
* Detailed description of the error
|
|
133
349
|
*/
|
|
134
|
-
|
|
350
|
+
description?: string;
|
|
135
351
|
/**
|
|
136
|
-
*
|
|
352
|
+
* Link to the documentation or support page for the error
|
|
137
353
|
*/
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
type A_TYPES_StageExecutionBehavior = 'async' | 'sync';
|
|
141
|
-
type A_TYPES__A_StageStep = {
|
|
354
|
+
link?: string;
|
|
142
355
|
/**
|
|
143
|
-
*
|
|
356
|
+
* Original Error if any
|
|
144
357
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
358
|
+
originalError?: Error | unknown;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Error serialized type
|
|
362
|
+
*/
|
|
363
|
+
type A_TYPES__Error_Serialized = {
|
|
364
|
+
/**
|
|
365
|
+
* ASEID of the error
|
|
148
366
|
*/
|
|
149
|
-
|
|
367
|
+
aseid: string;
|
|
150
368
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* [!] could be string or regex
|
|
154
|
-
*
|
|
369
|
+
* A brief title of the error
|
|
155
370
|
*/
|
|
156
|
-
|
|
371
|
+
title: string;
|
|
157
372
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
|
|
161
|
-
*
|
|
373
|
+
* Error message
|
|
162
374
|
*/
|
|
163
|
-
|
|
375
|
+
message: string;
|
|
164
376
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* [!] In case the method has circular dependencies it will Throw an error.
|
|
168
|
-
*
|
|
377
|
+
* Type of the error
|
|
169
378
|
*/
|
|
170
|
-
|
|
379
|
+
type: string;
|
|
171
380
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* [!] In case the method has circular dependencies it will Throw an error.
|
|
175
|
-
*
|
|
381
|
+
* Error code
|
|
176
382
|
*/
|
|
177
|
-
|
|
383
|
+
code: string;
|
|
178
384
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* [!] By default is true
|
|
385
|
+
* Error description
|
|
182
386
|
*/
|
|
183
|
-
|
|
387
|
+
description: string;
|
|
184
388
|
/**
|
|
185
|
-
*
|
|
389
|
+
* Link to documentation or support page
|
|
186
390
|
*/
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
type A_TYPES__Stage_Serialized = {
|
|
391
|
+
link?: string;
|
|
190
392
|
/**
|
|
191
|
-
*
|
|
393
|
+
* Scope of the error
|
|
192
394
|
*/
|
|
193
|
-
|
|
395
|
+
scope: string;
|
|
194
396
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
397
|
+
* Original error message if any
|
|
197
398
|
*/
|
|
198
|
-
|
|
199
|
-
};
|
|
200
|
-
type A_TYPES__A_StageStepProcessingExtraParams = {
|
|
201
|
-
steps: A_TYPES__A_StageStep[];
|
|
202
|
-
filter: (step: A_TYPES__A_StageStep) => boolean;
|
|
399
|
+
originalError?: string;
|
|
203
400
|
};
|
|
204
401
|
|
|
205
402
|
interface A_TYPES__ASEID_Constructor {
|
|
@@ -280,6 +477,7 @@ declare class ASEID {
|
|
|
280
477
|
* @returns
|
|
281
478
|
*/
|
|
282
479
|
static isASEID(identity: string): boolean;
|
|
480
|
+
static compare(aseid1: ASEID | string | undefined, aseid2: ASEID | string | undefined): boolean;
|
|
283
481
|
/**
|
|
284
482
|
* Concept for the ASEID
|
|
285
483
|
* Generally it is the application name or code, should correspond to the concept where the entity is used
|
|
@@ -402,300 +600,243 @@ declare class ASEID {
|
|
|
402
600
|
protected verifyInput(param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>): void;
|
|
403
601
|
}
|
|
404
602
|
|
|
405
|
-
declare
|
|
406
|
-
EXTENSIONS = "a-component-extensions",
|
|
407
|
-
FEATURES = "a-component-features",
|
|
408
|
-
ABSTRACTIONS = "a-component-abstractions",
|
|
409
|
-
INJECTIONS = "a-component-injections"
|
|
410
|
-
}
|
|
411
|
-
declare enum A_TYPES__EntityFeatures {
|
|
412
|
-
SAVE = "save",
|
|
413
|
-
DESTROY = "destroy",
|
|
414
|
-
LOAD = "load"
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Entity interface
|
|
419
|
-
*/
|
|
420
|
-
interface A_TYPES__IEntity {
|
|
421
|
-
/**
|
|
422
|
-
* The ASEID of the entity
|
|
423
|
-
*/
|
|
424
|
-
aseid: ASEID;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Entity constructor type
|
|
428
|
-
* Uses the generic type T to specify the type of the entity
|
|
429
|
-
*/
|
|
430
|
-
type A_TYPES__Entity_Constructor<T = A_Entity> = new (...args: any[]) => T;
|
|
431
|
-
/**
|
|
432
|
-
* Entity initialization type
|
|
433
|
-
*/
|
|
434
|
-
type A_TYPES__Entity_Init = any;
|
|
435
|
-
/**
|
|
436
|
-
* Entity serialized type
|
|
437
|
-
*/
|
|
438
|
-
type A_TYPES__Entity_Serialized = {
|
|
439
|
-
/**
|
|
440
|
-
* The ASEID of the entity
|
|
441
|
-
*/
|
|
442
|
-
aseid: string;
|
|
443
|
-
};
|
|
444
|
-
/**
|
|
445
|
-
* Entity meta type
|
|
446
|
-
*/
|
|
447
|
-
type A_TYPES__EntityMeta = {
|
|
448
|
-
[A_TYPES__EntityMetaKey.EXTENSIONS]: A_Meta<{
|
|
449
|
-
/**
|
|
450
|
-
* Where Key the regexp for what to apply the extension
|
|
451
|
-
* A set of container names or a wildcard, or a regexp
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
* Where value is the extension instructions
|
|
455
|
-
*/
|
|
456
|
-
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
457
|
-
}>;
|
|
458
|
-
case: any;
|
|
459
|
-
[A_TYPES__EntityMetaKey.FEATURES]: A_Meta<{
|
|
460
|
-
/**
|
|
461
|
-
* Where Key is the name of the feature
|
|
462
|
-
*
|
|
463
|
-
* Where value is the list of features
|
|
464
|
-
*/
|
|
465
|
-
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
466
|
-
}>;
|
|
467
|
-
/**
|
|
468
|
-
* Injections defined on the component per handler
|
|
469
|
-
*/
|
|
470
|
-
[A_TYPES__EntityMetaKey.INJECTIONS]: A_Meta<{
|
|
471
|
-
/**
|
|
472
|
-
* Where Key is the name of the injection
|
|
473
|
-
*
|
|
474
|
-
* Where value is the list of injections
|
|
475
|
-
*/
|
|
476
|
-
[Key: string]: A_TYPES__A_InjectDecorator_Meta;
|
|
477
|
-
}>;
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
482
|
-
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
483
|
-
* However, entity may hide some of its responsibilities behind the interface to prevent overload.
|
|
484
|
-
*
|
|
485
|
-
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
486
|
-
*/
|
|
487
|
-
declare class A_Entity<_ConstructorType extends A_TYPES__Entity_Init = A_TYPES__Entity_Init, _SerializedType extends A_TYPES__Entity_Serialized = A_TYPES__Entity_Serialized> implements A_TYPES__IEntity {
|
|
603
|
+
declare class A_Error<_ConstructorType extends A_TYPES__Error_Init = A_TYPES__Error_Init, _SerializedType extends A_TYPES__Error_Serialized = A_TYPES__Error_Serialized> extends Error {
|
|
488
604
|
/**
|
|
489
|
-
*
|
|
605
|
+
* Error Identifier that corresponds to the class name
|
|
490
606
|
*/
|
|
491
607
|
static get entity(): string;
|
|
492
608
|
/**
|
|
493
|
-
* DEFAULT
|
|
609
|
+
* DEFAULT Namespace of the error from environment variable A_CONCEPT_NAMESPACE
|
|
610
|
+
*
|
|
494
611
|
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
495
612
|
*/
|
|
496
613
|
static get concept(): string;
|
|
497
614
|
/**
|
|
498
615
|
* DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
|
|
616
|
+
*
|
|
499
617
|
* [!] If environment variable is not set, it will default to 'core'
|
|
500
618
|
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
501
619
|
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
502
620
|
*/
|
|
503
621
|
static get scope(): string;
|
|
504
622
|
/**
|
|
505
|
-
* ASEID
|
|
506
|
-
* A - A_Concept or Application
|
|
507
|
-
* S - System or Scope
|
|
508
|
-
* E - Entity
|
|
509
|
-
* ID - Identifier
|
|
510
|
-
*
|
|
511
|
-
* [!] ASEID is immutable and should not be changed after the entity is created
|
|
512
|
-
*
|
|
513
|
-
* [!] ASEID is composed of the following parts:
|
|
514
|
-
* - concept: an application specific identifier from where the entity is coming from
|
|
515
|
-
* - scope: the scope of the entity from concept
|
|
516
|
-
* - entity: the name of the entity from concept
|
|
517
|
-
* - id: the unique identifier of the entity
|
|
518
|
-
*
|
|
519
|
-
* [!] For more information about ASEID, please refer to the ASEID class documentation]
|
|
623
|
+
* ASEID of the error instance
|
|
520
624
|
*/
|
|
521
|
-
|
|
625
|
+
protected _aseid: ASEID;
|
|
522
626
|
/**
|
|
523
|
-
*
|
|
524
|
-
* e.g. project@scope:entity:0000000001
|
|
525
|
-
*
|
|
526
|
-
* @param aseid
|
|
627
|
+
* Title of the error
|
|
527
628
|
*/
|
|
528
|
-
|
|
629
|
+
protected _title: string;
|
|
529
630
|
/**
|
|
530
|
-
*
|
|
631
|
+
* Possible Scope if needed to identify the error by it's execution environment
|
|
531
632
|
*/
|
|
532
|
-
|
|
633
|
+
protected _scope?: string;
|
|
533
634
|
/**
|
|
534
|
-
*
|
|
535
|
-
* e.g. new ASEID({concept: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
|
|
536
|
-
*
|
|
537
|
-
* @param aseid
|
|
635
|
+
* Unique code representing the type of error
|
|
538
636
|
*/
|
|
539
|
-
|
|
637
|
+
protected _code?: string;
|
|
540
638
|
/**
|
|
541
|
-
*
|
|
639
|
+
* Detailed description of the error
|
|
542
640
|
*/
|
|
543
|
-
|
|
641
|
+
protected _description?: string;
|
|
544
642
|
/**
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* @param serialized
|
|
643
|
+
* Original Error if any
|
|
548
644
|
*/
|
|
549
|
-
|
|
645
|
+
protected _originalError?: Error | any;
|
|
550
646
|
/**
|
|
551
|
-
*
|
|
647
|
+
* Link to the documentation or support page for the error
|
|
552
648
|
*/
|
|
553
|
-
|
|
649
|
+
protected _link?: string;
|
|
554
650
|
/**
|
|
555
|
-
*
|
|
651
|
+
* A_Error is a custom error class for A_Concept framework.
|
|
652
|
+
* This error allows to have more structured error handling.
|
|
653
|
+
* Each error has a unique code, description and a link to the documentation.
|
|
556
654
|
*
|
|
557
|
-
*
|
|
655
|
+
* Example of usage:
|
|
656
|
+
* ```typescript
|
|
657
|
+
*
|
|
658
|
+
* // 1) all parameters will be used as provided
|
|
659
|
+
* throw new A_Error({
|
|
660
|
+
* message: 'User not found',
|
|
661
|
+
* code: 'USER_NOT_FOUND',
|
|
662
|
+
* description: 'The user with the given ID was not found.',
|
|
663
|
+
* link: 'https://support.adaas.org/error/USER_NOT_FOUND'
|
|
664
|
+
* });
|
|
665
|
+
*
|
|
666
|
+
* // or
|
|
667
|
+
* // 2) only message is provided, other parameters will be set to default values:
|
|
668
|
+
* // - code: 'user-not-found' (kebab-case of the message)
|
|
669
|
+
* // - description: 'User not found' (same as message)
|
|
670
|
+
* // - link: Empty
|
|
671
|
+
* throw new A_Error('User not found');
|
|
672
|
+
*
|
|
673
|
+
* // or
|
|
674
|
+
* // 3) Provided Message and Description, other parameters will be set to default values:
|
|
675
|
+
* // - code: 'user-not-found' (kebab-case of the message)
|
|
676
|
+
* // - description: 'The user with the given ID was not found.' (as provided)
|
|
677
|
+
* // - link: Empty
|
|
678
|
+
* throw new A_Error('User not found', 'The user with the given ID was not found.');
|
|
679
|
+
*
|
|
680
|
+
*
|
|
681
|
+
* ```
|
|
682
|
+
* [!] Note: The behavior of A_Error is similar to the A_Entity however it cannot have own A_Features.
|
|
683
|
+
* [!] Note: This class can be inherited to create custom error classes.
|
|
684
|
+
*
|
|
685
|
+
* @param message
|
|
558
686
|
*/
|
|
559
687
|
constructor(
|
|
560
688
|
/**
|
|
561
|
-
* Constructor
|
|
689
|
+
* A_Error Constructor params
|
|
562
690
|
*/
|
|
563
|
-
|
|
691
|
+
params: _ConstructorType);
|
|
692
|
+
constructor(
|
|
564
693
|
/**
|
|
565
|
-
*
|
|
566
|
-
* ID is the unique identifier of the entity
|
|
694
|
+
* Error message
|
|
567
695
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
protected isASEIDInstance(x: unknown): x is ASEID;
|
|
696
|
+
message: string);
|
|
697
|
+
constructor(
|
|
571
698
|
/**
|
|
572
|
-
*
|
|
573
|
-
* and contains an "aseid" property (this mirrors your original check).
|
|
574
|
-
*
|
|
575
|
-
* @param x
|
|
576
|
-
* @returns
|
|
699
|
+
* Original JS Error
|
|
577
700
|
*/
|
|
578
|
-
|
|
701
|
+
error: Error);
|
|
702
|
+
constructor(
|
|
579
703
|
/**
|
|
580
|
-
*
|
|
581
|
-
* This is the "create from provided fields" case.
|
|
582
|
-
*
|
|
583
|
-
* @param x
|
|
584
|
-
* @returns
|
|
704
|
+
* Original JS Error
|
|
585
705
|
*/
|
|
586
|
-
|
|
706
|
+
error: unknown);
|
|
707
|
+
constructor(
|
|
587
708
|
/**
|
|
588
|
-
*
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
*
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
*
|
|
597
|
-
|
|
709
|
+
* Error message
|
|
710
|
+
*/
|
|
711
|
+
title: string,
|
|
712
|
+
/**
|
|
713
|
+
* Detailed description of the error
|
|
714
|
+
*/
|
|
715
|
+
description: string);
|
|
716
|
+
/**
|
|
717
|
+
* Returns the ASEID of the error instance
|
|
718
|
+
*/
|
|
719
|
+
get aseid(): ASEID;
|
|
720
|
+
/**
|
|
721
|
+
* Returns the title of the error
|
|
598
722
|
*
|
|
723
|
+
* Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
|
|
599
724
|
*
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* protected getInitializer(
|
|
604
|
-
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
605
|
-
* ): (props: any) => void | (() => void) {
|
|
606
|
-
* if('customField' in props) {
|
|
607
|
-
* return this.fromCustomField.bind(this);
|
|
608
|
-
* }
|
|
609
|
-
* return super.getInitializer(props);
|
|
610
|
-
* }
|
|
611
|
-
* ```
|
|
612
|
-
* @param props
|
|
613
|
-
* @returns The appropriate initializer method
|
|
725
|
+
* [!] Note: This title should be short and concise, less than 60 characters
|
|
726
|
+
* [!] Note: If title exceeds 60 characters, there would be an error thrown
|
|
727
|
+
* [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
|
|
614
728
|
*/
|
|
615
|
-
|
|
729
|
+
get title(): string;
|
|
616
730
|
/**
|
|
617
|
-
*
|
|
618
|
-
* It uses class definitions for concept, scope, and entity,
|
|
619
|
-
* and allows overriding any of these values.
|
|
731
|
+
* Returns an Error message what is a brief title of the error
|
|
620
732
|
*
|
|
621
|
-
* @param override
|
|
622
|
-
* @returns
|
|
623
733
|
*/
|
|
624
|
-
|
|
734
|
+
get message(): string;
|
|
625
735
|
/**
|
|
626
|
-
*
|
|
736
|
+
* Returns a unique code representing the type of error
|
|
627
737
|
*
|
|
628
|
-
*
|
|
738
|
+
* If code is not provided, it will generate a kebab-case of the message
|
|
629
739
|
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
740
|
+
* Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
|
|
741
|
+
*
|
|
742
|
+
* [!] Note: It is recommended to use kebab-case for error codes
|
|
743
|
+
* [!] Note: If not provided would be used a kebab-case message of the error
|
|
632
744
|
*/
|
|
633
|
-
|
|
745
|
+
get code(): string;
|
|
634
746
|
/**
|
|
635
|
-
*
|
|
747
|
+
* Returns the type of the error which corresponds to the static entity of the class
|
|
748
|
+
*
|
|
749
|
+
* Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
|
|
750
|
+
*
|
|
751
|
+
* Defaults to the kebab-case of the class name
|
|
752
|
+
*
|
|
753
|
+
* [!] Note: naming ad separation are fully dependent on the architecture of the application
|
|
754
|
+
* [!] Note: It is recommended to use kebab-case for error types
|
|
755
|
+
* [!] Note: This type is intended to group similar errors together
|
|
636
756
|
*/
|
|
637
|
-
|
|
757
|
+
get type(): string;
|
|
638
758
|
/**
|
|
639
|
-
*
|
|
759
|
+
* Returns a link with possible documentation or support page for the error
|
|
760
|
+
* If link is not provided, it will generate a link based on the ASEID of the error that points to the A-Concept support page
|
|
761
|
+
*
|
|
762
|
+
* Example: https://adaas.support/a-concept/errors/{ASEID}
|
|
763
|
+
*
|
|
764
|
+
* [!] Note: ASEID is generated based on the static properties of the class (concept, scope, entity) and the code of the error
|
|
640
765
|
*/
|
|
641
|
-
|
|
766
|
+
get link(): string;
|
|
642
767
|
/**
|
|
643
|
-
* The
|
|
768
|
+
* The scope name of the error instance
|
|
769
|
+
*
|
|
770
|
+
* If scope is not provided, it will use the static scope of the class
|
|
771
|
+
*
|
|
772
|
+
* [!] Note: Scope is an application specific identifier that can be used to group entities together
|
|
773
|
+
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
644
774
|
*/
|
|
645
|
-
|
|
775
|
+
get scope(): string;
|
|
646
776
|
/**
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
777
|
+
* A detailed description of the error
|
|
778
|
+
* If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
|
|
650
779
|
*
|
|
651
|
-
*
|
|
780
|
+
* Example: 'The user with the given ID was not found.', 'The provided data is invalid.', 'You do not have permission to access this resource.', etc.
|
|
781
|
+
*
|
|
782
|
+
* [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
|
|
652
783
|
*/
|
|
653
|
-
|
|
784
|
+
get description(): string;
|
|
654
785
|
/**
|
|
655
|
-
*
|
|
656
|
-
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
657
|
-
* By default, it does nothing.
|
|
786
|
+
* Returns the original error if any
|
|
658
787
|
*
|
|
788
|
+
* This can be useful for debugging purposes to see the original stack trace or error message
|
|
659
789
|
*
|
|
660
|
-
*
|
|
790
|
+
* [!] Note: Original error is optional and may not be present in all cases
|
|
661
791
|
*/
|
|
662
|
-
|
|
792
|
+
get originalError(): Error | any | undefined;
|
|
663
793
|
/**
|
|
664
|
-
*
|
|
665
|
-
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
666
|
-
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
794
|
+
* Determines which initializer method to use based on the type of the first parameter.
|
|
667
795
|
*
|
|
668
|
-
* @param
|
|
796
|
+
* @param param1
|
|
669
797
|
* @returns
|
|
670
798
|
*/
|
|
671
|
-
|
|
799
|
+
protected getInitializer(param1: _ConstructorType | Error | string | any, param2?: string): (param1: any, param2: any) => void | (() => void);
|
|
672
800
|
/**
|
|
673
|
-
*
|
|
801
|
+
* Initializes the A_Error instance from a standard Error object.
|
|
674
802
|
*
|
|
675
|
-
*
|
|
676
|
-
|
|
803
|
+
* @param error
|
|
804
|
+
*/
|
|
805
|
+
protected fromError(error: Error): void;
|
|
806
|
+
/**
|
|
807
|
+
* Initializes the A_Error instance from a message.
|
|
677
808
|
*
|
|
809
|
+
* @param title
|
|
810
|
+
* @param description
|
|
811
|
+
*/
|
|
812
|
+
protected fromMessage(message: string): void;
|
|
813
|
+
/**
|
|
814
|
+
* Initializes the A_Error instance from a serialized object.
|
|
678
815
|
*
|
|
679
816
|
* @param serialized
|
|
680
|
-
* @returns
|
|
681
817
|
*/
|
|
682
|
-
fromJSON(serialized: _SerializedType): void;
|
|
818
|
+
protected fromJSON(serialized: _SerializedType): void;
|
|
819
|
+
fromTitle(title: string, description: string): void;
|
|
683
820
|
/**
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
821
|
+
* Initializes the A_Error instance from a constructor parameters object.
|
|
822
|
+
*
|
|
823
|
+
* @param params
|
|
824
|
+
*/
|
|
825
|
+
protected fromConstructor(params: _ConstructorType): void;
|
|
826
|
+
/**
|
|
827
|
+
* Serializes the A_Error instance to a plain object.
|
|
687
828
|
*
|
|
688
829
|
*
|
|
689
830
|
* @returns
|
|
690
831
|
*/
|
|
691
832
|
toJSON(): _SerializedType;
|
|
692
833
|
/**
|
|
693
|
-
*
|
|
694
|
-
*
|
|
834
|
+
* Checks if the provided title exceeds 60 characters.
|
|
835
|
+
* If it does, throws a validation A_Error.
|
|
695
836
|
*
|
|
696
|
-
* @
|
|
837
|
+
* @param title
|
|
697
838
|
*/
|
|
698
|
-
|
|
839
|
+
protected validateTitle(title: string): void;
|
|
699
840
|
}
|
|
700
841
|
|
|
701
842
|
/**
|
|
@@ -759,752 +900,707 @@ config: Partial<A_TYPES__FeatureExtendDecoratorConfig>): any;
|
|
|
759
900
|
*/
|
|
760
901
|
declare function A_Feature_Extend(): any;
|
|
761
902
|
|
|
762
|
-
|
|
763
|
-
* Entity constructor type
|
|
764
|
-
* Uses the generic type T to specify the type of the entity
|
|
765
|
-
*/
|
|
766
|
-
type A_TYPES__Error_Constructor<T = A_Error> = new (...args: any[]) => T;
|
|
767
|
-
/**
|
|
768
|
-
* Error initialization type
|
|
769
|
-
*/
|
|
770
|
-
type A_TYPES__Error_Init = {
|
|
903
|
+
declare class A_Stage {
|
|
771
904
|
/**
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
* A short description of the error
|
|
905
|
+
* The feature that owns this stage
|
|
775
906
|
*/
|
|
776
|
-
|
|
907
|
+
private readonly _feature;
|
|
777
908
|
/**
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
* Should be unique within the application or service
|
|
781
|
-
*
|
|
782
|
-
* Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
|
|
783
|
-
*
|
|
784
|
-
* [!] Note: It is recommended to use kebab-case for error codes
|
|
785
|
-
* [!] Note: If not provided would be used a kebab-case message of the error
|
|
909
|
+
* Initial Instructions to process the stage
|
|
786
910
|
*/
|
|
787
|
-
|
|
911
|
+
private readonly _definition;
|
|
788
912
|
/**
|
|
789
|
-
* Possible
|
|
790
|
-
*
|
|
791
|
-
* For example, error of type 'validation' could happen in different scopes
|
|
792
|
-
* like 'user', 'admin', 'system' etc. This will help to identify the error context better
|
|
793
|
-
*
|
|
794
|
-
* Could be string or A_Scope instance
|
|
795
|
-
*
|
|
796
|
-
* [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
|
|
913
|
+
* Possible errors during stage processing
|
|
797
914
|
*/
|
|
798
|
-
|
|
915
|
+
private _error?;
|
|
799
916
|
/**
|
|
800
|
-
*
|
|
917
|
+
* Indicates the current status of the stage
|
|
801
918
|
*/
|
|
802
|
-
|
|
919
|
+
private _status;
|
|
803
920
|
/**
|
|
804
|
-
*
|
|
921
|
+
* Promise that will be resolved when the stage is Processed
|
|
805
922
|
*/
|
|
806
|
-
|
|
923
|
+
private _processed;
|
|
807
924
|
/**
|
|
808
|
-
*
|
|
925
|
+
* A_Stage is a callable A_Function within A_Feature that should be run with specific parameters.
|
|
926
|
+
* [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
|
|
927
|
+
*
|
|
928
|
+
* A-Stage is a common object that uses to simplify logic and re-use of A-Feature internals for better composition.
|
|
809
929
|
*/
|
|
810
|
-
|
|
811
|
-
};
|
|
812
|
-
/**
|
|
813
|
-
* Error serialized type
|
|
814
|
-
*/
|
|
815
|
-
type A_TYPES__Error_Serialized = {
|
|
930
|
+
constructor(
|
|
816
931
|
/**
|
|
817
|
-
*
|
|
932
|
+
* The feature that owns this stage
|
|
818
933
|
*/
|
|
819
|
-
|
|
934
|
+
feature: A_Feature,
|
|
820
935
|
/**
|
|
821
|
-
*
|
|
936
|
+
* The step definitions of the stage
|
|
822
937
|
*/
|
|
823
|
-
|
|
938
|
+
step: A_TYPES__A_StageStep);
|
|
824
939
|
/**
|
|
825
|
-
*
|
|
940
|
+
* Returns the name of the stage
|
|
826
941
|
*/
|
|
827
|
-
|
|
942
|
+
get name(): string;
|
|
828
943
|
/**
|
|
829
|
-
*
|
|
944
|
+
* Returns the definition of the stage
|
|
830
945
|
*/
|
|
831
|
-
|
|
946
|
+
get definition(): A_TYPES__A_StageStep;
|
|
832
947
|
/**
|
|
833
|
-
*
|
|
948
|
+
* Returns the current status of the stage
|
|
834
949
|
*/
|
|
835
|
-
|
|
950
|
+
get status(): A_TYPES__A_Stage_Status;
|
|
836
951
|
/**
|
|
837
|
-
*
|
|
952
|
+
* Returns the feature that owns this stage
|
|
838
953
|
*/
|
|
839
|
-
|
|
954
|
+
get feature(): A_Feature;
|
|
840
955
|
/**
|
|
841
|
-
*
|
|
956
|
+
* Returns true if the stage is processed (completed, failed, or skipped)
|
|
842
957
|
*/
|
|
843
|
-
|
|
958
|
+
get isProcessed(): boolean;
|
|
844
959
|
/**
|
|
845
|
-
*
|
|
960
|
+
* Returns the error of the stage
|
|
846
961
|
*/
|
|
847
|
-
|
|
962
|
+
get error(): A_Error | undefined;
|
|
848
963
|
/**
|
|
849
|
-
*
|
|
964
|
+
* Resolves the arguments of the step
|
|
965
|
+
*
|
|
966
|
+
* @param step
|
|
967
|
+
* @returns
|
|
850
968
|
*/
|
|
851
|
-
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
declare class A_Error<_ConstructorType extends A_TYPES__Error_Init = A_TYPES__Error_Init, _SerializedType extends A_TYPES__Error_Serialized = A_TYPES__Error_Serialized> extends Error {
|
|
969
|
+
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<(A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Fragment<A_TYPES__Fragment_Serialized> | A_Feature<A_TYPES__FeatureAvailableComponents> | A_Caller<A_TYPES__FeatureAvailableComponents> | A_Error<A_TYPES__Error_Init, A_TYPES__Error_Serialized> | A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]> | A_TYPES__A_DependencyInjectable[] | undefined)[]>;
|
|
855
970
|
/**
|
|
856
|
-
*
|
|
971
|
+
* Resolves the component of the step
|
|
972
|
+
*
|
|
973
|
+
* @param step
|
|
974
|
+
* @returns
|
|
857
975
|
*/
|
|
858
|
-
|
|
976
|
+
protected getStepComponent(scope: A_Scope, step: A_TYPES__A_StageStep): A_TYPES__A_DependencyInjectable;
|
|
859
977
|
/**
|
|
860
|
-
*
|
|
978
|
+
* Calls the handler of the step
|
|
861
979
|
*
|
|
862
|
-
*
|
|
980
|
+
* @param step
|
|
981
|
+
* @returns
|
|
863
982
|
*/
|
|
864
|
-
|
|
983
|
+
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): Promise<any>;
|
|
984
|
+
skip(): void;
|
|
865
985
|
/**
|
|
866
|
-
*
|
|
986
|
+
* This method processes the stage by executing all the steps
|
|
867
987
|
*
|
|
868
|
-
*
|
|
869
|
-
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
870
|
-
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
988
|
+
* @param scope - Scope to be used to resolve the steps dependencies
|
|
871
989
|
*/
|
|
872
|
-
|
|
990
|
+
process(
|
|
873
991
|
/**
|
|
874
|
-
*
|
|
992
|
+
* Scope to be used to resolve the steps dependencies
|
|
875
993
|
*/
|
|
876
|
-
|
|
994
|
+
scope?: A_Scope): Promise<void>;
|
|
995
|
+
protected completed(): void;
|
|
996
|
+
protected failed(error: Error | A_Error | any): void;
|
|
877
997
|
/**
|
|
878
|
-
*
|
|
998
|
+
* Serializes the stage to JSON
|
|
999
|
+
*
|
|
879
1000
|
*/
|
|
880
|
-
|
|
1001
|
+
toJSON(): A_TYPES__Stage_Serialized;
|
|
881
1002
|
/**
|
|
882
|
-
*
|
|
1003
|
+
* Returns a string representation of the stage
|
|
1004
|
+
*
|
|
1005
|
+
* @returns
|
|
883
1006
|
*/
|
|
884
|
-
|
|
1007
|
+
toString(): string;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
declare class A_StepsManager {
|
|
1011
|
+
entities: A_TYPES__A_StageStep[];
|
|
1012
|
+
graph: Map<string, Set<string>>;
|
|
1013
|
+
visited: Set<string>;
|
|
1014
|
+
tempMark: Set<string>;
|
|
1015
|
+
sortedEntities: string[];
|
|
1016
|
+
private _isBuilt;
|
|
1017
|
+
constructor(entities: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>);
|
|
1018
|
+
private prepareSteps;
|
|
1019
|
+
private ID;
|
|
1020
|
+
private buildGraph;
|
|
1021
|
+
private matchEntities;
|
|
1022
|
+
private visit;
|
|
1023
|
+
toSortedArray(): Array<string>;
|
|
1024
|
+
toStages(feature: A_Feature): Array<A_Stage>;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
declare class A_StageError extends A_Error {
|
|
1028
|
+
static readonly ArgumentsResolutionError = "A-Stage Arguments Resolution Error";
|
|
1029
|
+
static get CompileError(): string;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
declare class A_FeatureError extends A_Error<A_TYPES__FeatureError_Init> {
|
|
885
1033
|
/**
|
|
886
|
-
*
|
|
1034
|
+
* Indicates that the Feature has been interrupted
|
|
887
1035
|
*/
|
|
888
|
-
|
|
1036
|
+
static readonly Interruption = "Feature Interrupted";
|
|
889
1037
|
/**
|
|
890
|
-
*
|
|
1038
|
+
* Indicates that there was an error initializing the Feature
|
|
1039
|
+
*
|
|
1040
|
+
* Failed during the A-Feature initialization process
|
|
891
1041
|
*/
|
|
892
|
-
|
|
1042
|
+
static readonly FeatureInitializationError = "Unable to initialize A-Feature";
|
|
893
1043
|
/**
|
|
894
|
-
*
|
|
1044
|
+
* Indicates that there was an error processing the Feature
|
|
1045
|
+
*
|
|
1046
|
+
* Failed during the A-Feature processing
|
|
895
1047
|
*/
|
|
896
|
-
|
|
1048
|
+
static readonly FeatureProcessingError = "Error occurred during A-Feature processing";
|
|
897
1049
|
/**
|
|
898
|
-
*
|
|
1050
|
+
* Indicates that there was an error defining the Feature
|
|
1051
|
+
*
|
|
1052
|
+
* Failed during the @A_Feature.Define() decorator execution
|
|
899
1053
|
*/
|
|
900
|
-
|
|
1054
|
+
static readonly FeatureDefinitionError = "Unable to define A-Feature";
|
|
901
1055
|
/**
|
|
902
|
-
*
|
|
903
|
-
* This error allows to have more structured error handling.
|
|
904
|
-
* Each error has a unique code, description and a link to the documentation.
|
|
905
|
-
*
|
|
906
|
-
* Example of usage:
|
|
907
|
-
* ```typescript
|
|
908
|
-
*
|
|
909
|
-
* // 1) all parameters will be used as provided
|
|
910
|
-
* throw new A_Error({
|
|
911
|
-
* message: 'User not found',
|
|
912
|
-
* code: 'USER_NOT_FOUND',
|
|
913
|
-
* description: 'The user with the given ID was not found.',
|
|
914
|
-
* link: 'https://support.adaas.org/error/USER_NOT_FOUND'
|
|
915
|
-
* });
|
|
916
|
-
*
|
|
917
|
-
* // or
|
|
918
|
-
* // 2) only message is provided, other parameters will be set to default values:
|
|
919
|
-
* // - code: 'user-not-found' (kebab-case of the message)
|
|
920
|
-
* // - description: 'User not found' (same as message)
|
|
921
|
-
* // - link: Empty
|
|
922
|
-
* throw new A_Error('User not found');
|
|
923
|
-
*
|
|
924
|
-
* // or
|
|
925
|
-
* // 3) Provided Message and Description, other parameters will be set to default values:
|
|
926
|
-
* // - code: 'user-not-found' (kebab-case of the message)
|
|
927
|
-
* // - description: 'The user with the given ID was not found.' (as provided)
|
|
928
|
-
* // - link: Empty
|
|
929
|
-
* throw new A_Error('User not found', 'The user with the given ID was not found.');
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
* ```
|
|
933
|
-
* [!] Note: The behavior of A_Error is similar to the A_Entity however it cannot have own A_Features.
|
|
934
|
-
* [!] Note: This class can be inherited to create custom error classes.
|
|
1056
|
+
* Indicates that there was an error extending the Feature
|
|
935
1057
|
*
|
|
936
|
-
* @
|
|
1058
|
+
* Failed during the @A_Feature.Extend() decorator execution
|
|
937
1059
|
*/
|
|
938
|
-
|
|
1060
|
+
static readonly FeatureExtensionError = "Unable to extend A-Feature";
|
|
939
1061
|
/**
|
|
940
|
-
*
|
|
1062
|
+
* Stage where the error occurred
|
|
941
1063
|
*/
|
|
942
|
-
|
|
943
|
-
|
|
1064
|
+
stage?: A_Stage;
|
|
1065
|
+
protected fromConstructor(params: A_TYPES__FeatureError_Init): void;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* A_Feature is representing a feature that can be executed across multiple components
|
|
1070
|
+
* This class stores the steps of the feature and executes them in order of appearance
|
|
1071
|
+
*
|
|
1072
|
+
* Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
|
|
1073
|
+
* across the different, distributed components
|
|
1074
|
+
*
|
|
1075
|
+
*/
|
|
1076
|
+
declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
|
|
944
1077
|
/**
|
|
945
|
-
*
|
|
1078
|
+
* Define a new A-Feature
|
|
946
1079
|
*/
|
|
947
|
-
|
|
948
|
-
constructor(
|
|
1080
|
+
static get Define(): typeof A_Feature_Define;
|
|
949
1081
|
/**
|
|
950
|
-
*
|
|
1082
|
+
* Extend an existing A-Feature
|
|
951
1083
|
*/
|
|
952
|
-
|
|
953
|
-
constructor(
|
|
1084
|
+
static get Extend(): typeof A_Feature_Extend;
|
|
954
1085
|
/**
|
|
955
|
-
*
|
|
1086
|
+
* The name of the Feature
|
|
956
1087
|
*/
|
|
957
|
-
|
|
958
|
-
constructor(
|
|
1088
|
+
protected _name: string;
|
|
959
1089
|
/**
|
|
960
|
-
*
|
|
1090
|
+
* List of stages that are part of this Feature
|
|
961
1091
|
*/
|
|
962
|
-
|
|
1092
|
+
protected _stages: Array<A_Stage>;
|
|
963
1093
|
/**
|
|
964
|
-
*
|
|
1094
|
+
* The Stage currently being processed
|
|
965
1095
|
*/
|
|
966
|
-
|
|
1096
|
+
protected _current?: A_Stage;
|
|
967
1097
|
/**
|
|
968
|
-
*
|
|
1098
|
+
* Actual Index of the current Stage being processed
|
|
969
1099
|
*/
|
|
970
|
-
|
|
1100
|
+
protected _index: number;
|
|
971
1101
|
/**
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
* Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
|
|
975
|
-
*
|
|
976
|
-
* [!] Note: This title should be short and concise, less than 60 characters
|
|
977
|
-
* [!] Note: If title exceeds 60 characters, there would be an error thrown
|
|
978
|
-
* [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
|
|
1102
|
+
* Steps Manager to organize the steps into stages
|
|
979
1103
|
*/
|
|
980
|
-
|
|
1104
|
+
protected _SM: A_StepsManager;
|
|
981
1105
|
/**
|
|
982
|
-
*
|
|
983
|
-
*
|
|
1106
|
+
* The Caller that initiated the Feature call
|
|
984
1107
|
*/
|
|
985
|
-
|
|
1108
|
+
protected _caller: A_Caller<T>;
|
|
986
1109
|
/**
|
|
987
|
-
*
|
|
988
|
-
*
|
|
989
|
-
* If code is not provided, it will generate a kebab-case of the message
|
|
990
|
-
*
|
|
991
|
-
* Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
|
|
992
|
-
*
|
|
993
|
-
* [!] Note: It is recommended to use kebab-case for error codes
|
|
994
|
-
* [!] Note: If not provided would be used a kebab-case message of the error
|
|
1110
|
+
* The current state of the Feature
|
|
995
1111
|
*/
|
|
996
|
-
|
|
1112
|
+
protected _state: A_TYPES__FeatureState;
|
|
997
1113
|
/**
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
* Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
|
|
1001
|
-
*
|
|
1002
|
-
* Defaults to the kebab-case of the class name
|
|
1003
|
-
*
|
|
1004
|
-
* [!] Note: naming ad separation are fully dependent on the architecture of the application
|
|
1005
|
-
* [!] Note: It is recommended to use kebab-case for error types
|
|
1006
|
-
* [!] Note: This type is intended to group similar errors together
|
|
1114
|
+
* The error that caused the Feature to be interrupted
|
|
1007
1115
|
*/
|
|
1008
|
-
|
|
1116
|
+
protected _error?: A_FeatureError;
|
|
1009
1117
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1012
|
-
*
|
|
1013
|
-
* Example: https://adaas.support/a-concept/errors/{ASEID}
|
|
1118
|
+
* A-Feature is a pipeline distributed by multiple components that can be easily attached or detached from the scope.
|
|
1119
|
+
* Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
|
|
1014
1120
|
*
|
|
1015
|
-
*
|
|
1016
|
-
*/
|
|
1017
|
-
get link(): string;
|
|
1018
|
-
/**
|
|
1019
|
-
* The scope name of the error instance
|
|
1121
|
+
* Comparing to A-Command Feature does not store any state except statuses for better analysis.
|
|
1020
1122
|
*
|
|
1021
|
-
*
|
|
1123
|
+
* [!] Note: If A-Feature should have result use A-Fragment
|
|
1022
1124
|
*
|
|
1023
|
-
*
|
|
1024
|
-
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
1125
|
+
* @param params
|
|
1025
1126
|
*/
|
|
1026
|
-
|
|
1127
|
+
constructor(
|
|
1027
1128
|
/**
|
|
1028
|
-
*
|
|
1029
|
-
* If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
|
|
1030
|
-
*
|
|
1031
|
-
* Example: 'The user with the given ID was not found.', 'The provided data is invalid.', 'You do not have permission to access this resource.', etc.
|
|
1032
|
-
*
|
|
1033
|
-
* [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
|
|
1129
|
+
* Feature Initialization parameters
|
|
1034
1130
|
*/
|
|
1035
|
-
|
|
1131
|
+
params: A_TYPES__Feature_Init<T>);
|
|
1036
1132
|
/**
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
* This can be useful for debugging purposes to see the original stack trace or error message
|
|
1040
|
-
*
|
|
1041
|
-
* [!] Note: Original error is optional and may not be present in all cases
|
|
1133
|
+
* The name of the Feature
|
|
1042
1134
|
*/
|
|
1043
|
-
get
|
|
1135
|
+
get name(): string;
|
|
1044
1136
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
* @param param1
|
|
1048
|
-
* @returns
|
|
1137
|
+
* The error that caused the Feature to be interrupted
|
|
1049
1138
|
*/
|
|
1050
|
-
|
|
1139
|
+
get error(): A_FeatureError | undefined;
|
|
1051
1140
|
/**
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
* @param error
|
|
1141
|
+
* The current state of the Feature
|
|
1055
1142
|
*/
|
|
1056
|
-
|
|
1143
|
+
get state(): A_TYPES__FeatureState;
|
|
1057
1144
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
* @param title
|
|
1061
|
-
* @param description
|
|
1145
|
+
* Sets the current state of the Feature
|
|
1062
1146
|
*/
|
|
1063
|
-
|
|
1147
|
+
get index(): number;
|
|
1064
1148
|
/**
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
* @param serialized
|
|
1149
|
+
* Returns the current A-Feature Stage
|
|
1068
1150
|
*/
|
|
1069
|
-
|
|
1070
|
-
fromTitle(title: string, description: string): void;
|
|
1151
|
+
get stage(): A_Stage | undefined;
|
|
1071
1152
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
* @param params
|
|
1153
|
+
* The Caller that initiated the Feature call
|
|
1075
1154
|
*/
|
|
1076
|
-
|
|
1155
|
+
get caller(): A_Caller<T>;
|
|
1077
1156
|
/**
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1081
|
-
* @returns
|
|
1157
|
+
* The Scope allocated for the Feature Execution
|
|
1082
1158
|
*/
|
|
1083
|
-
|
|
1159
|
+
get scope(): A_Scope;
|
|
1084
1160
|
/**
|
|
1085
|
-
*
|
|
1086
|
-
* If it does, throws a validation A_Error.
|
|
1087
|
-
*
|
|
1088
|
-
* @param title
|
|
1161
|
+
* The number of stages in the feature
|
|
1089
1162
|
*/
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
declare class A_Stage {
|
|
1163
|
+
get size(): number;
|
|
1094
1164
|
/**
|
|
1095
|
-
*
|
|
1165
|
+
* This method checks if the A-Feature is done
|
|
1166
|
+
*
|
|
1167
|
+
* @returns
|
|
1096
1168
|
*/
|
|
1097
|
-
|
|
1169
|
+
get isDone(): boolean;
|
|
1098
1170
|
/**
|
|
1099
|
-
*
|
|
1171
|
+
* Indicates whether the feature has been processed (completed, failed, or interrupted)
|
|
1100
1172
|
*/
|
|
1101
|
-
|
|
1173
|
+
get isProcessed(): boolean;
|
|
1102
1174
|
/**
|
|
1103
|
-
*
|
|
1175
|
+
* Iterator to iterate over the steps of the feature
|
|
1176
|
+
*
|
|
1177
|
+
* @returns
|
|
1104
1178
|
*/
|
|
1105
|
-
|
|
1179
|
+
[Symbol.iterator](): Iterator<A_Stage, any>;
|
|
1106
1180
|
/**
|
|
1107
|
-
*
|
|
1181
|
+
* Validates the provided parameters for A-Feature initialization
|
|
1182
|
+
*
|
|
1183
|
+
* @param params
|
|
1108
1184
|
*/
|
|
1109
|
-
|
|
1185
|
+
protected validateParams(params: A_TYPES__Feature_Init<T>): void;
|
|
1110
1186
|
/**
|
|
1111
|
-
*
|
|
1187
|
+
* Returns the appropriate initializer method based on the provided parameters
|
|
1188
|
+
*
|
|
1189
|
+
* @param params
|
|
1190
|
+
* @returns
|
|
1112
1191
|
*/
|
|
1113
|
-
|
|
1192
|
+
protected getInitializer(params: A_TYPES__Feature_Init<T>): (param1: any) => void | (() => void);
|
|
1114
1193
|
/**
|
|
1115
|
-
*
|
|
1116
|
-
* [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
|
|
1194
|
+
* Initializes the A-Feature from the provided template
|
|
1117
1195
|
*
|
|
1118
|
-
*
|
|
1196
|
+
* @param params
|
|
1119
1197
|
*/
|
|
1120
|
-
|
|
1198
|
+
protected fromTemplate(params: A_TYPES__Feature_InitWithTemplate<T>): void;
|
|
1121
1199
|
/**
|
|
1122
|
-
*
|
|
1200
|
+
* Initializes the A-Feature from the provided component
|
|
1201
|
+
*
|
|
1202
|
+
* @param params
|
|
1123
1203
|
*/
|
|
1124
|
-
|
|
1204
|
+
protected fromComponent(params: A_TYPES__Feature_InitWithComponent<T>): void;
|
|
1125
1205
|
/**
|
|
1126
|
-
*
|
|
1206
|
+
* This method processes the feature by executing all the stages
|
|
1207
|
+
*
|
|
1127
1208
|
*/
|
|
1128
|
-
|
|
1209
|
+
process(
|
|
1129
1210
|
/**
|
|
1130
|
-
*
|
|
1211
|
+
* Optional scope to be used to resolve the steps dependencies
|
|
1212
|
+
* If not provided, the scope of the caller component will be used
|
|
1131
1213
|
*/
|
|
1132
|
-
|
|
1214
|
+
scope?: A_Scope): Promise<void>;
|
|
1133
1215
|
/**
|
|
1134
|
-
*
|
|
1216
|
+
* This method moves the feature to the next stage
|
|
1217
|
+
*
|
|
1218
|
+
* @param stage
|
|
1135
1219
|
*/
|
|
1136
|
-
|
|
1220
|
+
next(stage: any): void;
|
|
1137
1221
|
/**
|
|
1138
|
-
*
|
|
1222
|
+
* This method marks the feature as completed and returns the result
|
|
1223
|
+
* Uses to interrupt or end the feature processing
|
|
1224
|
+
*
|
|
1225
|
+
* @param result
|
|
1226
|
+
* @returns
|
|
1139
1227
|
*/
|
|
1140
|
-
|
|
1228
|
+
completed(): Promise<void>;
|
|
1141
1229
|
/**
|
|
1142
|
-
*
|
|
1230
|
+
* This method marks the feature as failed and throws an error
|
|
1231
|
+
* Uses to mark the feature as failed
|
|
1232
|
+
*
|
|
1233
|
+
* @param error
|
|
1143
1234
|
*/
|
|
1144
|
-
|
|
1235
|
+
failed(error: A_FeatureError): Promise<void>;
|
|
1145
1236
|
/**
|
|
1146
|
-
*
|
|
1237
|
+
* This method marks the feature as failed and throws an error
|
|
1238
|
+
* Uses to interrupt or end the feature processing
|
|
1239
|
+
*
|
|
1240
|
+
* @param error
|
|
1147
1241
|
*/
|
|
1148
|
-
|
|
1242
|
+
interrupt(
|
|
1149
1243
|
/**
|
|
1150
|
-
*
|
|
1244
|
+
* The reason of feature interruption
|
|
1151
1245
|
*/
|
|
1152
|
-
|
|
1246
|
+
reason?: string | A_StageError | Error): Promise<void>;
|
|
1153
1247
|
/**
|
|
1154
|
-
*
|
|
1248
|
+
* Allows to chain the feature to another feature.
|
|
1249
|
+
* In this case the parent feature scope (if new not provided), stages, caller will be used.
|
|
1155
1250
|
*
|
|
1156
|
-
*
|
|
1157
|
-
* @returns
|
|
1158
|
-
*/
|
|
1159
|
-
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<any[]>;
|
|
1160
|
-
/**
|
|
1161
|
-
* Resolves the component of the step
|
|
1251
|
+
* [!] Note: Chained feature will use the same caller as the parent feature.
|
|
1162
1252
|
*
|
|
1163
|
-
* @param
|
|
1164
|
-
* @returns
|
|
1253
|
+
* @param feature
|
|
1165
1254
|
*/
|
|
1166
|
-
|
|
1255
|
+
chain(
|
|
1167
1256
|
/**
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
* @param step
|
|
1171
|
-
* @returns
|
|
1257
|
+
* A Feature to be chained
|
|
1172
1258
|
*/
|
|
1173
|
-
|
|
1174
|
-
skip(): void;
|
|
1259
|
+
feature: A_Feature,
|
|
1175
1260
|
/**
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
* @param scope - Scope to be used to resolve the steps dependencies
|
|
1261
|
+
* Optional scope to be used for the chained feature.
|
|
1179
1262
|
*/
|
|
1180
|
-
|
|
1263
|
+
scope?: A_Scope): any;
|
|
1264
|
+
chain<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents>(
|
|
1181
1265
|
/**
|
|
1182
|
-
*
|
|
1266
|
+
* Component whose feature should be chained
|
|
1183
1267
|
*/
|
|
1184
|
-
|
|
1185
|
-
protected completed(): void;
|
|
1186
|
-
protected failed(error: Error | A_Error | any): void;
|
|
1268
|
+
component: A_TYPES__FeatureAvailableComponents,
|
|
1187
1269
|
/**
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1270
|
+
* A Feature Name to be chained
|
|
1190
1271
|
*/
|
|
1191
|
-
|
|
1272
|
+
feature: string,
|
|
1192
1273
|
/**
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
* @returns
|
|
1274
|
+
* Optional scope to be used for the chained feature.
|
|
1196
1275
|
*/
|
|
1276
|
+
scope?: A_Scope): any;
|
|
1197
1277
|
toString(): string;
|
|
1198
1278
|
}
|
|
1199
1279
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
tempMark: Set<string>;
|
|
1205
|
-
sortedEntities: string[];
|
|
1206
|
-
private _isBuilt;
|
|
1207
|
-
constructor(entities: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>);
|
|
1208
|
-
private prepareSteps;
|
|
1209
|
-
private ID;
|
|
1210
|
-
private buildGraph;
|
|
1211
|
-
private matchEntities;
|
|
1212
|
-
private visit;
|
|
1213
|
-
toSortedArray(): Array<string>;
|
|
1214
|
-
toStages(feature: A_Feature): Array<A_Stage>;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
declare class A_StageError extends A_Error {
|
|
1218
|
-
static readonly ArgumentsResolutionError = "A-Stage Arguments Resolution Error";
|
|
1219
|
-
static get CompileError(): string;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
declare class A_FeatureError extends A_Error<A_TYPES__FeatureError_Init> {
|
|
1280
|
+
type A_TYPES__A_DependencyConstructor<T extends A_Dependency> = A_TYPES__Ctor<T>;
|
|
1281
|
+
type A_TYPES__A_DependencyInjectable = A_Entity | A_Container | A_Component | A_Fragment | A_Feature | A_Caller | A_Error | A_Scope;
|
|
1282
|
+
type A_TYPES__A_DependencyResolutionType<T> = T extends string ? string : T extends A_TYPES__Ctor<infer R> ? R : never;
|
|
1283
|
+
type A_TYPES__A_DependencyResolutionStrategy<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
|
|
1223
1284
|
/**
|
|
1224
|
-
*
|
|
1225
|
-
*/
|
|
1226
|
-
static readonly Interruption = "Feature Interrupted";
|
|
1227
|
-
/**
|
|
1228
|
-
* Indicates that there was an error initializing the Feature
|
|
1229
|
-
*
|
|
1230
|
-
* Failed during the A-Feature initialization process
|
|
1285
|
+
* If tru will throw an error if the dependency is not found
|
|
1231
1286
|
*/
|
|
1232
|
-
|
|
1287
|
+
require: boolean;
|
|
1233
1288
|
/**
|
|
1234
|
-
* Indicates that
|
|
1235
|
-
*
|
|
1236
|
-
* Failed during the A-Feature processing
|
|
1289
|
+
* Indicates that dependency should be loaded from a specific path before resolution
|
|
1237
1290
|
*/
|
|
1238
|
-
|
|
1291
|
+
load: boolean;
|
|
1239
1292
|
/**
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
1242
|
-
* Failed during the @A_Feature.Define() decorator execution
|
|
1293
|
+
* Number of levels to go up in the parent chain when resolving the dependency
|
|
1243
1294
|
*/
|
|
1244
|
-
|
|
1295
|
+
parent: number;
|
|
1245
1296
|
/**
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
* Failed during the @A_Feature.Extend() decorator execution
|
|
1297
|
+
* If true, will only resolve the dependency in the current scope without going up to parent scopes
|
|
1249
1298
|
*/
|
|
1250
|
-
|
|
1299
|
+
flat: boolean;
|
|
1251
1300
|
/**
|
|
1252
|
-
*
|
|
1301
|
+
* If has any value indicates that entity should be created with default parameters provided
|
|
1253
1302
|
*/
|
|
1254
|
-
|
|
1255
|
-
protected fromConstructor(params: A_TYPES__FeatureError_Init): void;
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* This is a common class that uses to return an entity that initiates a feature call
|
|
1260
|
-
*
|
|
1261
|
-
* It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
|
|
1262
|
-
*
|
|
1263
|
-
* [!] the class itself may be retrieved, but may require additional processing inside the feature
|
|
1264
|
-
*
|
|
1265
|
-
*/
|
|
1266
|
-
declare class A_Caller<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
|
|
1303
|
+
create: boolean;
|
|
1267
1304
|
/**
|
|
1268
|
-
*
|
|
1305
|
+
* Default constructor arguments to use when creating the dependency
|
|
1269
1306
|
*/
|
|
1270
|
-
|
|
1307
|
+
args: any[];
|
|
1271
1308
|
/**
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
* It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
|
|
1275
|
-
*
|
|
1276
|
-
* [!] If Scope is not provided, a new empty scope will be created and inherited from the global scope
|
|
1277
|
-
*
|
|
1278
|
-
* @param component
|
|
1279
|
-
* @param scope
|
|
1309
|
+
* Allows to query by specific entity properties e.g. ASEID, name, type, custom properties, etc.
|
|
1280
1310
|
*/
|
|
1281
|
-
|
|
1282
|
-
get component(): T;
|
|
1311
|
+
query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T extends A_Entity ? T : A_Entity>>;
|
|
1283
1312
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @param component
|
|
1313
|
+
* Pagination settings for the entity search
|
|
1287
1314
|
*/
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1315
|
+
pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
|
|
1316
|
+
};
|
|
1317
|
+
type A_TYPES__A_Dependency_Serialized = {
|
|
1318
|
+
name: string;
|
|
1319
|
+
all: boolean;
|
|
1320
|
+
require: boolean;
|
|
1321
|
+
load: boolean;
|
|
1322
|
+
parent: number;
|
|
1323
|
+
flat: boolean;
|
|
1324
|
+
create: any;
|
|
1325
|
+
args: any[];
|
|
1326
|
+
query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery>;
|
|
1327
|
+
pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
|
|
1328
|
+
};
|
|
1329
|
+
type A_TYPES__A_Dependency_EntityResolutionConfig<T extends A_Entity = A_Entity> = {
|
|
1330
|
+
query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
|
|
1331
|
+
pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
|
|
1332
|
+
};
|
|
1333
|
+
type A_TYPES__A_Dependency_EntityInjectionQuery<T extends A_Entity = A_Entity> = {
|
|
1334
|
+
aseid: string;
|
|
1335
|
+
} & {
|
|
1336
|
+
[key in keyof T]?: any;
|
|
1337
|
+
};
|
|
1338
|
+
type A_TYPES__A_Dependency_EntityInjectionPagination = {
|
|
1339
|
+
count: number;
|
|
1340
|
+
from: 'start' | 'end';
|
|
1341
|
+
};
|
|
1342
|
+
/**
|
|
1343
|
+
* A-Dependency require decorator return type
|
|
1344
|
+
*/
|
|
1345
|
+
type A_TYPES__A_Dependency_RequireDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1346
|
+
/**
|
|
1347
|
+
* A-Dependency load decorator return type
|
|
1348
|
+
*/
|
|
1349
|
+
type A_TYPES__A_Dependency_LoadDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1350
|
+
/**
|
|
1351
|
+
* A-Dependency default decorator return type
|
|
1352
|
+
*/
|
|
1353
|
+
type A_TYPES__A_Dependency_DefaultDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1354
|
+
/**
|
|
1355
|
+
* A-Dependency parent decorator return type
|
|
1356
|
+
*/
|
|
1357
|
+
type A_TYPES__A_Dependency_ParentDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1358
|
+
/**
|
|
1359
|
+
* A-Dependency flat decorator return type
|
|
1360
|
+
*/
|
|
1361
|
+
type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1362
|
+
/**
|
|
1363
|
+
* A-Dependency All decorator return type
|
|
1364
|
+
*/
|
|
1365
|
+
type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Should indicate which Default is required
|
|
1369
|
+
*/
|
|
1370
|
+
declare function A_Dependency_Default(
|
|
1371
|
+
/**
|
|
1372
|
+
* Constructor Parameters that will be used to create the default instance
|
|
1373
|
+
*/
|
|
1374
|
+
...args: any[]): A_TYPES__A_Dependency_DefaultDecoratorReturn;
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Should indicate which dependency is required
|
|
1378
|
+
*/
|
|
1379
|
+
declare function A_Dependency_Flat(): A_TYPES__A_Dependency_FlatDecoratorReturn;
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Should indicate which Load is required
|
|
1383
|
+
*/
|
|
1384
|
+
declare function A_Dependency_Load(): A_TYPES__A_Dependency_LoadDecoratorReturn;
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Should indicate which dependency is required
|
|
1388
|
+
*/
|
|
1389
|
+
declare function A_Dependency_Parent(
|
|
1390
|
+
/**
|
|
1391
|
+
* Indicates how many layers up the parent dependency should be resolved from current dependency
|
|
1297
1392
|
*
|
|
1393
|
+
* Default: -1 (one layer up)
|
|
1298
1394
|
*/
|
|
1299
|
-
|
|
1395
|
+
layerOffset?: number): A_TYPES__A_Dependency_ParentDecoratorReturn;
|
|
1396
|
+
|
|
1397
|
+
/**
|
|
1398
|
+
* Should indicate which dependency is required
|
|
1399
|
+
*/
|
|
1400
|
+
declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorReturn;
|
|
1401
|
+
|
|
1402
|
+
declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> {
|
|
1300
1403
|
/**
|
|
1301
|
-
*
|
|
1404
|
+
* Allows to indicate which Injected parameter is required
|
|
1405
|
+
*
|
|
1406
|
+
* [!] If parameter marked as required is not provided, an error will be thrown
|
|
1407
|
+
*
|
|
1408
|
+
* @returns
|
|
1302
1409
|
*/
|
|
1303
|
-
static get
|
|
1410
|
+
static get Required(): typeof A_Dependency_Require;
|
|
1304
1411
|
/**
|
|
1305
|
-
*
|
|
1412
|
+
* Allows to indicate which dependency should be loaded from a specific path
|
|
1413
|
+
*
|
|
1414
|
+
* @returns
|
|
1306
1415
|
*/
|
|
1307
|
-
static get
|
|
1416
|
+
static get Loaded(): typeof A_Dependency_Load;
|
|
1308
1417
|
/**
|
|
1309
|
-
*
|
|
1418
|
+
* Allows to indicate which dependency default parameters should be used
|
|
1419
|
+
*
|
|
1420
|
+
* @returns
|
|
1310
1421
|
*/
|
|
1311
|
-
|
|
1422
|
+
static get Default(): typeof A_Dependency_Default;
|
|
1312
1423
|
/**
|
|
1313
|
-
*
|
|
1424
|
+
* Allows to indicate which parent dependency should be resolved
|
|
1425
|
+
* e.g. from which layer up the parent should be taken
|
|
1426
|
+
*
|
|
1427
|
+
* @returns
|
|
1314
1428
|
*/
|
|
1315
|
-
|
|
1429
|
+
static get Parent(): typeof A_Dependency_Parent;
|
|
1316
1430
|
/**
|
|
1317
|
-
*
|
|
1431
|
+
* Allows to indicate that the dependency should be resolved in a flat manner
|
|
1432
|
+
* Only in the same scope, without going up to parent scopes
|
|
1433
|
+
*
|
|
1434
|
+
* @returns
|
|
1318
1435
|
*/
|
|
1319
|
-
|
|
1436
|
+
static get Flat(): typeof A_Dependency_Flat;
|
|
1437
|
+
protected _name: string;
|
|
1438
|
+
protected _target?: A_TYPES__Ctor<T>;
|
|
1439
|
+
protected _resolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
|
|
1440
|
+
protected _defaultPagination: A_TYPES__A_DependencyResolutionStrategy['pagination'];
|
|
1441
|
+
protected _defaultResolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
|
|
1442
|
+
get flat(): boolean;
|
|
1443
|
+
get require(): boolean;
|
|
1444
|
+
get load(): boolean;
|
|
1320
1445
|
/**
|
|
1321
|
-
*
|
|
1446
|
+
* Indicates cases when it's necessary to search across all instances
|
|
1322
1447
|
*/
|
|
1323
|
-
|
|
1448
|
+
get all(): boolean;
|
|
1449
|
+
get parent(): number;
|
|
1450
|
+
get create(): any;
|
|
1451
|
+
get args(): any[];
|
|
1452
|
+
get query(): Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T extends A_Entity ? T : A_Entity>>;
|
|
1453
|
+
get pagination(): A_TYPES__A_Dependency_EntityInjectionPagination;
|
|
1324
1454
|
/**
|
|
1325
|
-
*
|
|
1455
|
+
* Class instances allows to identify dependencies by name and use them for better type checking
|
|
1456
|
+
*
|
|
1457
|
+
* @param name
|
|
1326
1458
|
*/
|
|
1327
|
-
|
|
1459
|
+
constructor(name: string | A_TYPES__Ctor<T>, resolutionStrategy?: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T extends A_Entity ? T : A_Entity>, 'pagination'> & {
|
|
1460
|
+
pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
|
|
1461
|
+
}>);
|
|
1328
1462
|
/**
|
|
1329
|
-
*
|
|
1463
|
+
* Gets the dependency name
|
|
1464
|
+
*
|
|
1465
|
+
* Can be identifier, url or any string value
|
|
1466
|
+
*
|
|
1467
|
+
* @returns
|
|
1330
1468
|
*/
|
|
1331
|
-
|
|
1469
|
+
get name(): string;
|
|
1332
1470
|
/**
|
|
1333
|
-
*
|
|
1471
|
+
* Returns the original class of the dependency if provided
|
|
1472
|
+
*
|
|
1334
1473
|
*/
|
|
1335
|
-
|
|
1474
|
+
get target(): A_TYPES__Ctor<T> | undefined;
|
|
1336
1475
|
/**
|
|
1337
|
-
*
|
|
1476
|
+
* Gets the dependency resolution strategy
|
|
1338
1477
|
*/
|
|
1339
|
-
|
|
1478
|
+
get resolutionStrategy(): A_TYPES__A_DependencyResolutionStrategy<T extends A_Entity ? T : A_Entity>;
|
|
1340
1479
|
/**
|
|
1341
|
-
*
|
|
1342
|
-
* Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
|
|
1343
|
-
*
|
|
1344
|
-
* Comparing to A-Command Feature does not store any state except statuses for better analysis.
|
|
1345
|
-
*
|
|
1346
|
-
* [!] Note: If A-Feature should have result use A-Fragment
|
|
1347
|
-
*
|
|
1348
|
-
* @param params
|
|
1480
|
+
* Sets the dependency resolution strategy
|
|
1349
1481
|
*/
|
|
1350
|
-
|
|
1482
|
+
set resolutionStrategy(strategy: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T extends A_Entity ? T : A_Entity>, 'pagination'> & {
|
|
1483
|
+
pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
|
|
1484
|
+
}>);
|
|
1351
1485
|
/**
|
|
1352
|
-
*
|
|
1486
|
+
* Method for the parameters check and all input data before usage
|
|
1487
|
+
*
|
|
1488
|
+
* @returns
|
|
1353
1489
|
*/
|
|
1354
|
-
|
|
1490
|
+
private initCheck;
|
|
1355
1491
|
/**
|
|
1356
|
-
*
|
|
1492
|
+
* Serializes the dependency to a JSON object
|
|
1493
|
+
*
|
|
1494
|
+
* @returns
|
|
1357
1495
|
*/
|
|
1358
|
-
|
|
1496
|
+
toJSON(): A_TYPES__A_Dependency_Serialized;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
declare enum A_TYPES__A_Stage_Status {
|
|
1359
1500
|
/**
|
|
1360
|
-
* The
|
|
1501
|
+
* The stage is currently being processed
|
|
1361
1502
|
*/
|
|
1362
|
-
|
|
1503
|
+
PROCESSING = "PROCESSING",
|
|
1363
1504
|
/**
|
|
1364
|
-
* The
|
|
1505
|
+
* The stage has been completed
|
|
1365
1506
|
*/
|
|
1366
|
-
|
|
1507
|
+
COMPLETED = "COMPLETED",
|
|
1367
1508
|
/**
|
|
1368
|
-
*
|
|
1509
|
+
* The stage has failed
|
|
1369
1510
|
*/
|
|
1370
|
-
|
|
1511
|
+
FAILED = "FAILED",
|
|
1371
1512
|
/**
|
|
1372
|
-
*
|
|
1513
|
+
* The stage has been skipped
|
|
1373
1514
|
*/
|
|
1374
|
-
|
|
1515
|
+
SKIPPED = "SKIPPED",
|
|
1375
1516
|
/**
|
|
1376
|
-
* The
|
|
1517
|
+
* The stage has been paused
|
|
1377
1518
|
*/
|
|
1378
|
-
get caller(): A_Caller<T>;
|
|
1379
1519
|
/**
|
|
1380
|
-
* The
|
|
1520
|
+
* The stage has been stopped
|
|
1381
1521
|
*/
|
|
1382
|
-
get scope(): A_Scope;
|
|
1383
1522
|
/**
|
|
1384
|
-
* The
|
|
1523
|
+
* The stage has been started
|
|
1385
1524
|
*/
|
|
1386
|
-
get size(): number;
|
|
1387
1525
|
/**
|
|
1388
|
-
*
|
|
1389
|
-
*
|
|
1390
|
-
* @returns
|
|
1526
|
+
* The stage has been initialized
|
|
1391
1527
|
*/
|
|
1392
|
-
|
|
1528
|
+
INITIALIZED = "INITIALIZED",
|
|
1393
1529
|
/**
|
|
1394
|
-
*
|
|
1530
|
+
* The stage has been aborted
|
|
1395
1531
|
*/
|
|
1396
|
-
|
|
1532
|
+
ABORTED = "ABORTED"
|
|
1533
|
+
}
|
|
1534
|
+
type A_TYPES_StageExecutionBehavior = 'async' | 'sync';
|
|
1535
|
+
type A_TYPES__A_StageStep = {
|
|
1397
1536
|
/**
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
* @returns
|
|
1537
|
+
* The component to be called
|
|
1401
1538
|
*/
|
|
1402
|
-
|
|
1539
|
+
dependency: A_Dependency;
|
|
1403
1540
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
* @param params
|
|
1541
|
+
* The method to be called on the component
|
|
1407
1542
|
*/
|
|
1408
|
-
|
|
1543
|
+
handler: string;
|
|
1409
1544
|
/**
|
|
1410
|
-
*
|
|
1545
|
+
* Original Feature Extension name
|
|
1411
1546
|
*
|
|
1412
|
-
*
|
|
1413
|
-
* @returns
|
|
1414
|
-
*/
|
|
1415
|
-
protected getInitializer(params: A_TYPES__Feature_Init<T>): (param1: any) => void | (() => void);
|
|
1416
|
-
/**
|
|
1417
|
-
* Initializes the A-Feature from the provided template
|
|
1547
|
+
* [!] could be string or regex
|
|
1418
1548
|
*
|
|
1419
|
-
* @param params
|
|
1420
1549
|
*/
|
|
1421
|
-
|
|
1550
|
+
name: string;
|
|
1422
1551
|
/**
|
|
1423
|
-
*
|
|
1552
|
+
* In case its async it will be executed independently from the main thread.
|
|
1424
1553
|
*
|
|
1425
|
-
*
|
|
1426
|
-
*/
|
|
1427
|
-
protected fromComponent(params: A_TYPES__Feature_InitWithComponent<T>): void;
|
|
1428
|
-
/**
|
|
1429
|
-
* This method processes the feature by executing all the stages
|
|
1554
|
+
* [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
|
|
1430
1555
|
*
|
|
1431
1556
|
*/
|
|
1432
|
-
|
|
1433
|
-
/**
|
|
1434
|
-
* Optional scope to be used to resolve the steps dependencies
|
|
1435
|
-
* If not provided, the scope of the caller component will be used
|
|
1436
|
-
*/
|
|
1437
|
-
scope?: A_Scope): Promise<void>;
|
|
1557
|
+
behavior: A_TYPES_StageExecutionBehavior;
|
|
1438
1558
|
/**
|
|
1439
|
-
*
|
|
1559
|
+
* Allows to define the order of the execution of the method.
|
|
1560
|
+
*
|
|
1561
|
+
* [!] In case the method has circular dependencies it will Throw an error.
|
|
1440
1562
|
*
|
|
1441
|
-
* @param stage
|
|
1442
1563
|
*/
|
|
1443
|
-
|
|
1564
|
+
before: string;
|
|
1444
1565
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1566
|
+
* Allows to define the order of the execution of the method.
|
|
1567
|
+
*
|
|
1568
|
+
* [!] In case the method has circular dependencies it will Throw an error.
|
|
1447
1569
|
*
|
|
1448
|
-
* @param result
|
|
1449
|
-
* @returns
|
|
1450
1570
|
*/
|
|
1451
|
-
|
|
1571
|
+
after: string;
|
|
1452
1572
|
/**
|
|
1453
|
-
*
|
|
1454
|
-
* Uses to mark the feature as failed
|
|
1573
|
+
* Indicates whether to throw an error if the step fails.
|
|
1455
1574
|
*
|
|
1456
|
-
*
|
|
1575
|
+
* [!] By default is true
|
|
1457
1576
|
*/
|
|
1458
|
-
|
|
1577
|
+
throwOnError: boolean;
|
|
1459
1578
|
/**
|
|
1460
|
-
* This method marks the feature as failed and throws an error
|
|
1461
|
-
* Uses to interrupt or end the feature processing
|
|
1462
1579
|
*
|
|
1463
|
-
* @param error
|
|
1464
1580
|
*/
|
|
1465
|
-
|
|
1581
|
+
override: string;
|
|
1582
|
+
};
|
|
1583
|
+
type A_TYPES__Stage_Serialized = {
|
|
1466
1584
|
/**
|
|
1467
|
-
* The
|
|
1585
|
+
* The name of the stage
|
|
1468
1586
|
*/
|
|
1469
|
-
|
|
1587
|
+
name: string;
|
|
1470
1588
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
* In this case the parent feature scope (if new not provided), stages, caller will be used.
|
|
1473
|
-
*
|
|
1474
|
-
* [!] Note: Chained feature will use the same caller as the parent feature.
|
|
1589
|
+
* The status of the stage
|
|
1475
1590
|
*
|
|
1476
|
-
* @param feature
|
|
1477
|
-
*/
|
|
1478
|
-
chain(
|
|
1479
|
-
/**
|
|
1480
|
-
* A Feature to be chained
|
|
1481
|
-
*/
|
|
1482
|
-
feature: A_Feature,
|
|
1483
|
-
/**
|
|
1484
|
-
* Optional scope to be used for the chained feature.
|
|
1485
|
-
*/
|
|
1486
|
-
scope?: A_Scope): any;
|
|
1487
|
-
chain<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents>(
|
|
1488
|
-
/**
|
|
1489
|
-
* Component whose feature should be chained
|
|
1490
1591
|
*/
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
* Optional scope to be used for the chained feature.
|
|
1498
|
-
*/
|
|
1499
|
-
scope?: A_Scope): any;
|
|
1500
|
-
toString(): string;
|
|
1501
|
-
}
|
|
1592
|
+
status: A_TYPES__A_Stage_Status;
|
|
1593
|
+
};
|
|
1594
|
+
type A_TYPES__A_StageStepProcessingExtraParams = {
|
|
1595
|
+
steps: A_TYPES__A_StageStep[];
|
|
1596
|
+
filter: (step: A_TYPES__A_StageStep) => boolean;
|
|
1597
|
+
};
|
|
1502
1598
|
|
|
1503
1599
|
/**
|
|
1504
1600
|
* Feature constructor type
|
|
1505
1601
|
* Uses the generic type T to specify the type of the feature
|
|
1506
1602
|
*/
|
|
1507
|
-
type A_TYPES__Feature_Constructor<T = A_Feature> =
|
|
1603
|
+
type A_TYPES__Feature_Constructor<T = A_Feature> = A_TYPES__Ctor<T>;
|
|
1508
1604
|
/**
|
|
1509
1605
|
* Feature initialization type
|
|
1510
1606
|
*/
|
|
@@ -1633,7 +1729,7 @@ type A_TYPES__FeatureDefineDecoratorConfig = {
|
|
|
1633
1729
|
/**
|
|
1634
1730
|
* Describes a single template item used in Feature Define decorator
|
|
1635
1731
|
*/
|
|
1636
|
-
type A_TYPES__FeatureDefineDecoratorTemplateItem = A_TYPES__Required<Partial<A_TYPES__A_StageStep>, ['name', 'handler', '
|
|
1732
|
+
type A_TYPES__FeatureDefineDecoratorTemplateItem = A_TYPES__Required<Partial<A_TYPES__A_StageStep>, ['name', 'handler', 'dependency']>;
|
|
1637
1733
|
/**
|
|
1638
1734
|
* Describes a target where Feature Define decorator can be applied
|
|
1639
1735
|
*
|
|
@@ -1929,7 +2025,7 @@ declare class A_Abstraction {
|
|
|
1929
2025
|
* Abstraction constructor type
|
|
1930
2026
|
* Uses the generic type T to specify the type of the abstraction
|
|
1931
2027
|
*/
|
|
1932
|
-
type A_TYPES__Abstraction_Constructor<T = A_Abstraction> =
|
|
2028
|
+
type A_TYPES__Abstraction_Constructor<T = A_Abstraction> = A_TYPES__Ctor<T>;
|
|
1933
2029
|
/**
|
|
1934
2030
|
* Abstraction initialization type
|
|
1935
2031
|
*/
|
|
@@ -2108,131 +2204,11 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2108
2204
|
container: _Imports[number]): Promise<void>;
|
|
2109
2205
|
}
|
|
2110
2206
|
|
|
2111
|
-
/**
|
|
2112
|
-
* A_Fragment is a core architectural component that represents a singleton execution context
|
|
2113
|
-
* within the A-Concept framework. It serves as a shared memory container that can be passed
|
|
2114
|
-
* between Components, Entities, and Commands throughout the application pipeline.
|
|
2115
|
-
*
|
|
2116
|
-
* Key Features:
|
|
2117
|
-
* - Singleton pattern: Only one instance per fragment type per scope
|
|
2118
|
-
* - Meta storage: Built-in key-value storage for pipeline data
|
|
2119
|
-
* - Type-safe: Full TypeScript generics support for meta items and serialization
|
|
2120
|
-
* - Serializable: Can be converted to JSON for persistence or transmission
|
|
2121
|
-
*
|
|
2122
|
-
* @template _MetaItems - Type definition for the meta storage structure
|
|
2123
|
-
* @template _SerializedType - Type definition for the serialized output format
|
|
2124
|
-
*
|
|
2125
|
-
* @example
|
|
2126
|
-
* ```typescript
|
|
2127
|
-
* // Basic usage with typed meta
|
|
2128
|
-
* class UserFragment extends A_Fragment<{ userId: string; role: string }> {
|
|
2129
|
-
* constructor() {
|
|
2130
|
-
* super({ name: 'UserFragment' });
|
|
2131
|
-
* }
|
|
2132
|
-
* }
|
|
2133
|
-
*
|
|
2134
|
-
* // Custom serialization
|
|
2135
|
-
* class SessionFragment extends A_Fragment<
|
|
2136
|
-
* { sessionId: string; timestamp: number },
|
|
2137
|
-
* { name: string; sessionData: string }
|
|
2138
|
-
* > {
|
|
2139
|
-
* toJSON() {
|
|
2140
|
-
* return {
|
|
2141
|
-
* name: this.name,
|
|
2142
|
-
* sessionData: `${this.get('sessionId')}-${this.get('timestamp')}`
|
|
2143
|
-
* };
|
|
2144
|
-
* }
|
|
2145
|
-
* }
|
|
2146
|
-
* ```
|
|
2147
|
-
*/
|
|
2148
|
-
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
2149
|
-
/**
|
|
2150
|
-
* The unique identifier/name for this fragment instance.
|
|
2151
|
-
* Used for identification and debugging purposes.
|
|
2152
|
-
*/
|
|
2153
|
-
protected _name: string;
|
|
2154
|
-
/**
|
|
2155
|
-
* Creates a new A_Fragment instance.
|
|
2156
|
-
*
|
|
2157
|
-
* A_Fragment implements the singleton pattern for execution contexts, allowing
|
|
2158
|
-
* shared state management across different parts of the application pipeline.
|
|
2159
|
-
* Each fragment serves as a memory container that can store typed data and be
|
|
2160
|
-
* serialized for persistence or transmission.
|
|
2161
|
-
*
|
|
2162
|
-
* Key Benefits:
|
|
2163
|
-
* - Centralized state management for related operations
|
|
2164
|
-
* - Type-safe meta operations with full IntelliSense support
|
|
2165
|
-
* - Serialization support for data persistence
|
|
2166
|
-
* - Singleton pattern ensures consistent state within scope
|
|
2167
|
-
*
|
|
2168
|
-
* @param params - Initialization parameters
|
|
2169
|
-
* @param params.name - Optional custom name for the fragment (defaults to class name)
|
|
2170
|
-
*
|
|
2171
|
-
* @example
|
|
2172
|
-
* ```typescript
|
|
2173
|
-
* const fragment = new A_Fragment<{ userId: string }>({
|
|
2174
|
-
* name: 'UserSessionFragment'
|
|
2175
|
-
* });
|
|
2176
|
-
* fragment.set('userId', '12345');
|
|
2177
|
-
* ```
|
|
2178
|
-
*/
|
|
2179
|
-
constructor(params?: Partial<A_TYPES__Fragment_Init>);
|
|
2180
|
-
/**
|
|
2181
|
-
* Gets the fragment's unique name/identifier.
|
|
2182
|
-
*
|
|
2183
|
-
* @returns The fragment name
|
|
2184
|
-
*/
|
|
2185
|
-
get name(): string;
|
|
2186
|
-
/**
|
|
2187
|
-
* Serializes the fragment to a JSON-compatible object.
|
|
2188
|
-
*
|
|
2189
|
-
* This method combines the fragment's name with all meta data to create
|
|
2190
|
-
* a serializable representation. The return type is determined by the
|
|
2191
|
-
* _SerializedType generic parameter, allowing for custom serialization formats.
|
|
2192
|
-
*
|
|
2193
|
-
* @returns A serialized representation of the fragment
|
|
2194
|
-
*
|
|
2195
|
-
* @example
|
|
2196
|
-
* ```typescript
|
|
2197
|
-
* const fragment = new A_Fragment<{ userId: string, role: string }>({
|
|
2198
|
-
* name: 'UserFragment'
|
|
2199
|
-
* });
|
|
2200
|
-
* fragment.set('userId', '12345');
|
|
2201
|
-
* fragment.set('role', 'admin');
|
|
2202
|
-
*
|
|
2203
|
-
* const json = fragment.toJSON();
|
|
2204
|
-
* // Result: { name: 'UserFragment', userId: '12345', role: 'admin' }
|
|
2205
|
-
* ```
|
|
2206
|
-
*/
|
|
2207
|
-
toJSON(): _SerializedType;
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
/**
|
|
2211
|
-
* Fragment constructor type
|
|
2212
|
-
* Uses the generic type T to specify the type of the fragment
|
|
2213
|
-
*/
|
|
2214
|
-
type A_TYPES__Fragment_Constructor<T = A_Fragment> = new (...args: any[]) => T;
|
|
2215
|
-
/**
|
|
2216
|
-
* Fragment initialization type
|
|
2217
|
-
*/
|
|
2218
|
-
type A_TYPES__Fragment_Init = {
|
|
2219
|
-
name: string;
|
|
2220
|
-
};
|
|
2221
|
-
/**
|
|
2222
|
-
* Fragment serialized type
|
|
2223
|
-
*/
|
|
2224
|
-
type A_TYPES__Fragment_Serialized = {
|
|
2225
|
-
/**
|
|
2226
|
-
* The Name of the fragment
|
|
2227
|
-
*/
|
|
2228
|
-
name: string;
|
|
2229
|
-
};
|
|
2230
|
-
|
|
2231
2207
|
/**
|
|
2232
2208
|
* Concept constructor type
|
|
2233
2209
|
* Uses the generic type T to specify the type of the concept
|
|
2234
2210
|
*/
|
|
2235
|
-
type A_TYPES__Concept_Constructor<T = A_Concept> =
|
|
2211
|
+
type A_TYPES__Concept_Constructor<T = A_Concept> = A_TYPES__Ctor<T>;
|
|
2236
2212
|
/**
|
|
2237
2213
|
* Concept initialization type
|
|
2238
2214
|
* Uses the generic type T to specify the type of containers that the concept will use
|
|
@@ -2279,53 +2255,355 @@ type A_TYPES__Concept_Serialized = {};
|
|
|
2279
2255
|
*/
|
|
2280
2256
|
type A_TYPES__ConceptAbstractionMeta = {
|
|
2281
2257
|
/**
|
|
2282
|
-
* The arguments that will be passed to the handler
|
|
2258
|
+
* The arguments that will be passed to the handler
|
|
2259
|
+
*/
|
|
2260
|
+
args: A_TYPES__A_InjectDecorator_Meta;
|
|
2261
|
+
} & A_TYPES__FeatureExtendDecoratorMeta;
|
|
2262
|
+
/**
|
|
2263
|
+
* Uses to define the extension that will be applied to the Concept
|
|
2264
|
+
*/
|
|
2265
|
+
type A_TYPES__ConceptAbstraction = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2266
|
+
|
|
2267
|
+
declare enum A_TYPES__ContainerMetaKey {
|
|
2268
|
+
FEATURES = "a-container-features",
|
|
2269
|
+
INJECTIONS = "a-container-injections",
|
|
2270
|
+
ABSTRACTIONS = "a-container-abstractions",
|
|
2271
|
+
EXTENSIONS = "a-container-extensions"
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
/**
|
|
2275
|
+
* Container constructor type
|
|
2276
|
+
* Uses the generic type T to specify the type of the container
|
|
2277
|
+
*/
|
|
2278
|
+
type A_TYPES__Container_Constructor<T = A_Container> = A_TYPES__Ctor<T>;
|
|
2279
|
+
/**
|
|
2280
|
+
* Container initialization type
|
|
2281
|
+
*/
|
|
2282
|
+
type A_TYPES__Container_Init = {
|
|
2283
|
+
/**
|
|
2284
|
+
* The extra name for the container (optional)
|
|
2285
|
+
*/
|
|
2286
|
+
name?: string;
|
|
2287
|
+
} & A_TYPES__Scope_Init;
|
|
2288
|
+
/**
|
|
2289
|
+
* Container serialized type
|
|
2290
|
+
*/
|
|
2291
|
+
type A_TYPES__Container_Serialized = {
|
|
2292
|
+
/**
|
|
2293
|
+
* The ASEID of the container
|
|
2294
|
+
*/
|
|
2295
|
+
aseid: string;
|
|
2296
|
+
};
|
|
2297
|
+
/**
|
|
2298
|
+
* Meta information stored in each Container
|
|
2299
|
+
*/
|
|
2300
|
+
type A_TYPES__ContainerMeta = {
|
|
2301
|
+
/**
|
|
2302
|
+
* Extensions applied to the component per handler
|
|
2303
|
+
*/
|
|
2304
|
+
[A_TYPES__ContainerMetaKey.EXTENSIONS]: A_Meta<{
|
|
2305
|
+
/**
|
|
2306
|
+
* Where Key the regexp for what to apply the extension
|
|
2307
|
+
* A set of container names or a wildcard, or a regexp
|
|
2308
|
+
*
|
|
2309
|
+
*
|
|
2310
|
+
* Where value is the extension instructions
|
|
2311
|
+
*/
|
|
2312
|
+
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
2313
|
+
}>;
|
|
2314
|
+
[A_TYPES__ContainerMetaKey.FEATURES]: A_Meta<{
|
|
2315
|
+
/**
|
|
2316
|
+
* Where Key is the name of the feature
|
|
2317
|
+
*
|
|
2318
|
+
* Where value is the list of features
|
|
2319
|
+
*/
|
|
2320
|
+
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
2321
|
+
}>;
|
|
2322
|
+
[A_TYPES__ContainerMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
2323
|
+
/**
|
|
2324
|
+
* Where Key the regexp for what to apply the extension
|
|
2325
|
+
* A set of container names or a wildcard, or a regexp
|
|
2326
|
+
*
|
|
2327
|
+
*
|
|
2328
|
+
* Where value is the extension instructions
|
|
2329
|
+
*/
|
|
2330
|
+
[Key: string]: A_TYPES__ConceptAbstraction[];
|
|
2331
|
+
}>;
|
|
2332
|
+
[A_TYPES__ContainerMetaKey.INJECTIONS]: A_Meta<{
|
|
2333
|
+
/**
|
|
2334
|
+
* Where Key is the name of the injection
|
|
2335
|
+
*
|
|
2336
|
+
* Where value is the list of injections
|
|
2337
|
+
*/
|
|
2338
|
+
[Key: string]: A_TYPES__A_InjectDecorator_Meta;
|
|
2339
|
+
}>;
|
|
2340
|
+
};
|
|
2341
|
+
type A_TYPES__ContainerMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* A-Inject decorator descriptor type
|
|
2345
|
+
* Indicates the type of the decorator function
|
|
2346
|
+
*/
|
|
2347
|
+
type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
|
|
2348
|
+
/**
|
|
2349
|
+
* A-Inject decorator return type
|
|
2350
|
+
* Indicates what the decorator function returns
|
|
2351
|
+
*/
|
|
2352
|
+
type A_TYPES__A_InjectDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2353
|
+
type A_TYPES__A_InjectDecorator_Meta = Array<A_Dependency>;
|
|
2354
|
+
/**
|
|
2355
|
+
* Targets that can be injected into Extended functions or constructors
|
|
2356
|
+
*/
|
|
2357
|
+
type A_TYPES__InjectableTargets = A_TYPES__Component_Constructor | InstanceType<A_TYPES__Component_Constructor> | InstanceType<A_TYPES__Container_Constructor>;
|
|
2358
|
+
|
|
2359
|
+
declare enum A_TYPES__ComponentMetaKey {
|
|
2360
|
+
EXTENSIONS = "a-component-extensions",
|
|
2361
|
+
FEATURES = "a-component-features",
|
|
2362
|
+
INJECTIONS = "a-component-injections",
|
|
2363
|
+
ABSTRACTIONS = "a-component-abstractions"
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* Component constructor type
|
|
2368
|
+
* Uses the generic type T to specify the type of the component
|
|
2369
|
+
*/
|
|
2370
|
+
type A_TYPES__Component_Constructor<T = A_Component> = A_TYPES__Ctor<T>;
|
|
2371
|
+
/**
|
|
2372
|
+
* Component initialization type
|
|
2373
|
+
*/
|
|
2374
|
+
type A_TYPES__Component_Init = any;
|
|
2375
|
+
/**
|
|
2376
|
+
* Component serialized type
|
|
2377
|
+
*/
|
|
2378
|
+
type A_TYPES__Component_Serialized = {
|
|
2379
|
+
/**
|
|
2380
|
+
* The ASEID of the component
|
|
2381
|
+
*/
|
|
2382
|
+
aseid: string;
|
|
2383
|
+
};
|
|
2384
|
+
/**
|
|
2385
|
+
* Component meta type
|
|
2386
|
+
*/
|
|
2387
|
+
type A_TYPES__ComponentMeta = {
|
|
2388
|
+
/**
|
|
2389
|
+
* Extensions applied to the component per handler
|
|
2390
|
+
*/
|
|
2391
|
+
[A_TYPES__ComponentMetaKey.EXTENSIONS]: A_Meta<{
|
|
2392
|
+
/**
|
|
2393
|
+
* Where Key the regexp for what to apply the extension
|
|
2394
|
+
* A set of container names or a wildcard, or a regexp
|
|
2395
|
+
*
|
|
2396
|
+
*
|
|
2397
|
+
* Where value is the extension instructions
|
|
2398
|
+
*/
|
|
2399
|
+
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
2400
|
+
}>;
|
|
2401
|
+
/**
|
|
2402
|
+
* Features defined on the component per handler
|
|
2403
|
+
*/
|
|
2404
|
+
[A_TYPES__ComponentMetaKey.FEATURES]: A_Meta<{
|
|
2405
|
+
/**
|
|
2406
|
+
* Where Key is the name of the feature
|
|
2407
|
+
*
|
|
2408
|
+
* Where value is the list of features
|
|
2409
|
+
*/
|
|
2410
|
+
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
2411
|
+
}>;
|
|
2412
|
+
/**
|
|
2413
|
+
* Injections defined on the component per handler
|
|
2414
|
+
*/
|
|
2415
|
+
[A_TYPES__ComponentMetaKey.INJECTIONS]: A_Meta<{
|
|
2416
|
+
/**
|
|
2417
|
+
* Where Key is the name of the injection
|
|
2418
|
+
*
|
|
2419
|
+
* Where value is the list of injections
|
|
2420
|
+
*/
|
|
2421
|
+
[Key: string]: A_TYPES__A_InjectDecorator_Meta;
|
|
2422
|
+
}>;
|
|
2423
|
+
/**
|
|
2424
|
+
* Abstractions extended by the component per handler
|
|
2425
|
+
*/
|
|
2426
|
+
[A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
2427
|
+
/**
|
|
2428
|
+
* Where Key is the name of the stage
|
|
2429
|
+
*
|
|
2430
|
+
* Where value is the list of injections
|
|
2431
|
+
*/
|
|
2432
|
+
[Key: string]: A_TYPES__ConceptAbstraction[];
|
|
2433
|
+
}>;
|
|
2434
|
+
};
|
|
2435
|
+
type A_TYPES__ComponentMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2436
|
+
|
|
2437
|
+
/**
|
|
2438
|
+
* Meta constructor type
|
|
2439
|
+
*/
|
|
2440
|
+
type A_TYPES__Meta_Constructor<T = A_Meta> = A_TYPES__Ctor<T>;
|
|
2441
|
+
/**
|
|
2442
|
+
* Components that can have Meta associated with them
|
|
2443
|
+
*/
|
|
2444
|
+
type A_TYPES__MetaLinkedComponents = A_Container | A_Component | A_Entity | A_Fragment;
|
|
2445
|
+
/**
|
|
2446
|
+
* Constructors of components that can have Meta associated with them
|
|
2447
|
+
*/
|
|
2448
|
+
type A_TYPES__MetaLinkedComponentConstructors = new (...args: any[]) => any | A_TYPES__Container_Constructor | A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor;
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* A Meta is an entity that stores all the metadata for the specific entity like container, component, feature, etc.
|
|
2452
|
+
*
|
|
2453
|
+
* [!] Meta can be different depending on the type of input data
|
|
2454
|
+
*/
|
|
2455
|
+
declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedType extends Record<string, any> = Record<string, any>> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
2456
|
+
/**
|
|
2457
|
+
* Allows to set a custom meta class for the Component or Container or Entity, or anything else.
|
|
2458
|
+
*
|
|
2459
|
+
* @param target
|
|
2460
|
+
* @returns
|
|
2461
|
+
*/
|
|
2462
|
+
static Define<T extends A_Meta>(target: A_TYPES__Meta_Constructor<T>): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: TTarget) => TTarget;
|
|
2463
|
+
protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
|
|
2464
|
+
/**
|
|
2465
|
+
* Method to get the iterator for the meta object
|
|
2466
|
+
*
|
|
2467
|
+
* @returns
|
|
2468
|
+
*/
|
|
2469
|
+
[Symbol.iterator](): Iterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2470
|
+
/**
|
|
2471
|
+
* Allows to replicate received meta object by replacing internal meta to the received one
|
|
2472
|
+
*
|
|
2473
|
+
* @param meta
|
|
2474
|
+
* @returns
|
|
2475
|
+
*/
|
|
2476
|
+
from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
|
|
2477
|
+
/**
|
|
2478
|
+
* Method to set values in the map
|
|
2479
|
+
*
|
|
2480
|
+
* @param key
|
|
2481
|
+
* @param value
|
|
2482
|
+
*/
|
|
2483
|
+
set<K extends keyof _StorageItems>(key: K, value: _StorageItems[K]): void;
|
|
2484
|
+
/**
|
|
2485
|
+
* Method to get values from the map
|
|
2486
|
+
*
|
|
2487
|
+
* @param key
|
|
2488
|
+
* @returns
|
|
2489
|
+
*/
|
|
2490
|
+
get<K extends keyof _StorageItems>(key: K): _StorageItems[K] | undefined;
|
|
2491
|
+
/**
|
|
2492
|
+
* Method to delete values from the map
|
|
2493
|
+
*
|
|
2494
|
+
* @param key
|
|
2495
|
+
* @returns
|
|
2496
|
+
*/
|
|
2497
|
+
delete(key: keyof _StorageItems): boolean;
|
|
2498
|
+
/**
|
|
2499
|
+
* Method to get the size of the map
|
|
2500
|
+
*
|
|
2501
|
+
* @returns
|
|
2502
|
+
*/
|
|
2503
|
+
size(): number;
|
|
2504
|
+
/**
|
|
2505
|
+
* This method is needed to convert the key to a regular expression and cover cases like:
|
|
2506
|
+
*
|
|
2507
|
+
* simple * e.g. "a*" instead of "a.*"
|
|
2508
|
+
*
|
|
2509
|
+
* simple ? e.g. "a?" instead of "a."
|
|
2510
|
+
*
|
|
2511
|
+
* etc.
|
|
2512
|
+
*
|
|
2513
|
+
* @param key
|
|
2514
|
+
* @returns
|
|
2515
|
+
*/
|
|
2516
|
+
private convertToRegExp;
|
|
2517
|
+
/**
|
|
2518
|
+
* Method to find values in the map by name.
|
|
2519
|
+
*
|
|
2520
|
+
* Converts the Key in Map to a regular expression and then compares to the name
|
|
2521
|
+
*
|
|
2522
|
+
* @param name
|
|
2523
|
+
* @returns
|
|
2524
|
+
*/
|
|
2525
|
+
find(name: string): [keyof _StorageItems, _StorageItems[keyof _StorageItems]][];
|
|
2526
|
+
/**
|
|
2527
|
+
* Method to find values in the map by regular expression
|
|
2528
|
+
*
|
|
2529
|
+
* Compares Map Key to the input regular expression
|
|
2530
|
+
*
|
|
2531
|
+
* @param regex
|
|
2532
|
+
* @returns
|
|
2533
|
+
*/
|
|
2534
|
+
findByRegex(regex: RegExp): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2535
|
+
/**
|
|
2536
|
+
* Method to check if the map has a specific key
|
|
2537
|
+
*
|
|
2538
|
+
* @param key
|
|
2539
|
+
* @returns
|
|
2540
|
+
*/
|
|
2541
|
+
has(key: keyof _StorageItems): boolean;
|
|
2542
|
+
/**
|
|
2543
|
+
* Method to get the size of the map
|
|
2544
|
+
*
|
|
2545
|
+
* @returns
|
|
2546
|
+
*/
|
|
2547
|
+
entries(): IterableIterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2548
|
+
/**
|
|
2549
|
+
* Method to clear the map
|
|
2550
|
+
*/
|
|
2551
|
+
clear(): void;
|
|
2552
|
+
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2553
|
+
protected recursiveToJSON(value: any): any;
|
|
2554
|
+
/**
|
|
2555
|
+
* Serializes the meta to a JSON object
|
|
2556
|
+
* Uses internal storage to convert to JSON
|
|
2557
|
+
*
|
|
2558
|
+
* @returns
|
|
2283
2559
|
*/
|
|
2284
|
-
|
|
2285
|
-
}
|
|
2286
|
-
/**
|
|
2287
|
-
* Uses to define the extension that will be applied to the Concept
|
|
2288
|
-
*/
|
|
2289
|
-
type A_TYPES__ConceptAbstraction = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2560
|
+
toJSON(): _SerializedType;
|
|
2561
|
+
}
|
|
2290
2562
|
|
|
2291
|
-
declare enum
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
ABSTRACTIONS = "a-
|
|
2295
|
-
|
|
2563
|
+
declare enum A_TYPES__EntityMetaKey {
|
|
2564
|
+
EXTENSIONS = "a-component-extensions",
|
|
2565
|
+
FEATURES = "a-component-features",
|
|
2566
|
+
ABSTRACTIONS = "a-component-abstractions",
|
|
2567
|
+
INJECTIONS = "a-component-injections"
|
|
2568
|
+
}
|
|
2569
|
+
declare enum A_TYPES__EntityFeatures {
|
|
2570
|
+
SAVE = "save",
|
|
2571
|
+
DESTROY = "destroy",
|
|
2572
|
+
LOAD = "load"
|
|
2296
2573
|
}
|
|
2297
2574
|
|
|
2298
2575
|
/**
|
|
2299
|
-
*
|
|
2300
|
-
* Uses the generic type T to specify the type of the container
|
|
2301
|
-
*/
|
|
2302
|
-
type A_TYPES__Container_Constructor<T = A_Container> = new (...args: any[]) => T;
|
|
2303
|
-
/**
|
|
2304
|
-
* Container initialization type
|
|
2576
|
+
* Entity interface
|
|
2305
2577
|
*/
|
|
2306
|
-
|
|
2578
|
+
interface A_TYPES__IEntity {
|
|
2307
2579
|
/**
|
|
2308
|
-
* The
|
|
2580
|
+
* The ASEID of the entity
|
|
2309
2581
|
*/
|
|
2310
|
-
|
|
2311
|
-
}
|
|
2582
|
+
aseid: ASEID;
|
|
2583
|
+
}
|
|
2312
2584
|
/**
|
|
2313
|
-
*
|
|
2585
|
+
* Entity constructor type
|
|
2586
|
+
* Uses the generic type T to specify the type of the entity
|
|
2314
2587
|
*/
|
|
2315
|
-
type
|
|
2588
|
+
type A_TYPES__Entity_Constructor<T = A_Entity> = A_TYPES__Ctor<T>;
|
|
2589
|
+
/**
|
|
2590
|
+
* Entity initialization type
|
|
2591
|
+
*/
|
|
2592
|
+
type A_TYPES__Entity_Init = any;
|
|
2593
|
+
/**
|
|
2594
|
+
* Entity serialized type
|
|
2595
|
+
*/
|
|
2596
|
+
type A_TYPES__Entity_Serialized = {
|
|
2316
2597
|
/**
|
|
2317
|
-
* The ASEID of the
|
|
2598
|
+
* The ASEID of the entity
|
|
2318
2599
|
*/
|
|
2319
2600
|
aseid: string;
|
|
2320
2601
|
};
|
|
2321
2602
|
/**
|
|
2322
|
-
*
|
|
2603
|
+
* Entity meta type
|
|
2323
2604
|
*/
|
|
2324
|
-
type
|
|
2325
|
-
|
|
2326
|
-
* Extensions applied to the component per handler
|
|
2327
|
-
*/
|
|
2328
|
-
[A_TYPES__ContainerMetaKey.EXTENSIONS]: A_Meta<{
|
|
2605
|
+
type A_TYPES__EntityMeta = {
|
|
2606
|
+
[A_TYPES__EntityMetaKey.EXTENSIONS]: A_Meta<{
|
|
2329
2607
|
/**
|
|
2330
2608
|
* Where Key the regexp for what to apply the extension
|
|
2331
2609
|
* A set of container names or a wildcard, or a regexp
|
|
@@ -2335,7 +2613,8 @@ type A_TYPES__ContainerMeta = {
|
|
|
2335
2613
|
*/
|
|
2336
2614
|
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
2337
2615
|
}>;
|
|
2338
|
-
|
|
2616
|
+
case: any;
|
|
2617
|
+
[A_TYPES__EntityMetaKey.FEATURES]: A_Meta<{
|
|
2339
2618
|
/**
|
|
2340
2619
|
* Where Key is the name of the feature
|
|
2341
2620
|
*
|
|
@@ -2343,17 +2622,10 @@ type A_TYPES__ContainerMeta = {
|
|
|
2343
2622
|
*/
|
|
2344
2623
|
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
2345
2624
|
}>;
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2352
|
-
* Where value is the extension instructions
|
|
2353
|
-
*/
|
|
2354
|
-
[Key: string]: A_TYPES__ConceptAbstraction[];
|
|
2355
|
-
}>;
|
|
2356
|
-
[A_TYPES__ContainerMetaKey.INJECTIONS]: A_Meta<{
|
|
2625
|
+
/**
|
|
2626
|
+
* Injections defined on the component per handler
|
|
2627
|
+
*/
|
|
2628
|
+
[A_TYPES__EntityMetaKey.INJECTIONS]: A_Meta<{
|
|
2357
2629
|
/**
|
|
2358
2630
|
* Where Key is the name of the injection
|
|
2359
2631
|
*
|
|
@@ -2362,320 +2634,228 @@ type A_TYPES__ContainerMeta = {
|
|
|
2362
2634
|
[Key: string]: A_TYPES__A_InjectDecorator_Meta;
|
|
2363
2635
|
}>;
|
|
2364
2636
|
};
|
|
2365
|
-
type A_TYPES__ContainerMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2366
2637
|
|
|
2367
|
-
|
|
2638
|
+
/**
|
|
2639
|
+
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
2640
|
+
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
2641
|
+
* However, entity may hide some of its responsibilities behind the interface to prevent overload.
|
|
2642
|
+
*
|
|
2643
|
+
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
2644
|
+
*/
|
|
2645
|
+
declare class A_Entity<_ConstructorType extends A_TYPES__Entity_Init = A_TYPES__Entity_Init, _SerializedType extends A_TYPES__Entity_Serialized = A_TYPES__Entity_Serialized> implements A_TYPES__IEntity {
|
|
2368
2646
|
/**
|
|
2369
|
-
*
|
|
2647
|
+
* Entity Identifier that corresponds to the class name
|
|
2370
2648
|
*/
|
|
2371
|
-
|
|
2649
|
+
static get entity(): string;
|
|
2372
2650
|
/**
|
|
2373
|
-
* Name of the
|
|
2651
|
+
* DEFAULT Concept Name (Application Name) of the entity from environment variable A_CONCEPT_NAME
|
|
2652
|
+
* [!] If environment variable is not set, it will default to 'a-concept'
|
|
2374
2653
|
*/
|
|
2375
|
-
get
|
|
2654
|
+
static get concept(): string;
|
|
2376
2655
|
/**
|
|
2377
|
-
*
|
|
2656
|
+
* DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
|
|
2657
|
+
* [!] If environment variable is not set, it will default to 'core'
|
|
2658
|
+
* [!] Scope is an application specific identifier that can be used to group entities together
|
|
2659
|
+
* [!] e.g. 'default', 'core', 'public', 'internal', etc
|
|
2378
2660
|
*/
|
|
2379
|
-
get scope():
|
|
2661
|
+
static get scope(): string;
|
|
2380
2662
|
/**
|
|
2381
|
-
*
|
|
2663
|
+
* ASEID is an entity identifier that is unique across the system
|
|
2664
|
+
* A - A_Concept or Application
|
|
2665
|
+
* S - System or Scope
|
|
2666
|
+
* E - Entity
|
|
2667
|
+
* ID - Identifier
|
|
2382
2668
|
*
|
|
2383
|
-
*
|
|
2384
|
-
* So because of that Container can be:
|
|
2385
|
-
* - HTTP Server
|
|
2386
|
-
* - BASH Script
|
|
2387
|
-
* - Database Connection
|
|
2388
|
-
* - Microservice
|
|
2389
|
-
* - etc.
|
|
2669
|
+
* [!] ASEID is immutable and should not be changed after the entity is created
|
|
2390
2670
|
*
|
|
2391
|
-
*
|
|
2671
|
+
* [!] ASEID is composed of the following parts:
|
|
2672
|
+
* - concept: an application specific identifier from where the entity is coming from
|
|
2673
|
+
* - scope: the scope of the entity from concept
|
|
2674
|
+
* - entity: the name of the entity from concept
|
|
2675
|
+
* - id: the unique identifier of the entity
|
|
2676
|
+
*
|
|
2677
|
+
* [!] For more information about ASEID, please refer to the ASEID class documentation]
|
|
2678
|
+
*/
|
|
2679
|
+
aseid: ASEID;
|
|
2680
|
+
/**
|
|
2681
|
+
* Create a new A_entity instance from Aseid String
|
|
2682
|
+
* e.g. project@scope:entity:0000000001
|
|
2683
|
+
*
|
|
2684
|
+
* @param aseid
|
|
2392
2685
|
*/
|
|
2393
2686
|
constructor(
|
|
2394
2687
|
/**
|
|
2395
|
-
*
|
|
2688
|
+
* ASEID string that represents the entity
|
|
2396
2689
|
*/
|
|
2397
|
-
|
|
2690
|
+
aseid?: string);
|
|
2398
2691
|
/**
|
|
2399
|
-
*
|
|
2692
|
+
* Create a new A_entity instance from Aseid instance
|
|
2693
|
+
* e.g. new ASEID({concept: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
|
|
2400
2694
|
*
|
|
2401
|
-
*
|
|
2695
|
+
* @param aseid
|
|
2696
|
+
*/
|
|
2697
|
+
constructor(
|
|
2698
|
+
/**
|
|
2699
|
+
* ASEID instance that represents the entity
|
|
2700
|
+
*/
|
|
2701
|
+
aseid: ASEID);
|
|
2702
|
+
/**
|
|
2703
|
+
* Create a new A_entity instance from serialized object
|
|
2402
2704
|
*
|
|
2403
|
-
* @param
|
|
2404
|
-
* @param scope - the scope in which to call the feature
|
|
2405
|
-
* @returns - void
|
|
2705
|
+
* @param serialized
|
|
2406
2706
|
*/
|
|
2407
|
-
|
|
2707
|
+
constructor(
|
|
2408
2708
|
/**
|
|
2409
|
-
*
|
|
2709
|
+
* Serialized object that represents the entity
|
|
2410
2710
|
*/
|
|
2411
|
-
|
|
2711
|
+
serialized: _SerializedType);
|
|
2412
2712
|
/**
|
|
2413
|
-
*
|
|
2713
|
+
* Create a new A_entity instance from constructor object
|
|
2714
|
+
*
|
|
2715
|
+
* @param newEntity
|
|
2414
2716
|
*/
|
|
2415
|
-
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
/**
|
|
2419
|
-
* Meta constructor type
|
|
2420
|
-
*/
|
|
2421
|
-
type A_TYPES__Meta_Constructor<T = A_Meta> = new (...args: any[]) => T;
|
|
2422
|
-
/**
|
|
2423
|
-
* Components that can have Meta associated with them
|
|
2424
|
-
*/
|
|
2425
|
-
type A_TYPES__MetaLinkedComponents = A_Container | A_Component | A_Entity | A_Fragment;
|
|
2426
|
-
/**
|
|
2427
|
-
* Constructors of components that can have Meta associated with them
|
|
2428
|
-
*/
|
|
2429
|
-
type A_TYPES__MetaLinkedComponentConstructors = new (...args: any[]) => any | A_TYPES__Container_Constructor | A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor;
|
|
2430
|
-
|
|
2431
|
-
/**
|
|
2432
|
-
* A Meta is an entity that stores all the metadata for the specific entity like container, component, feature, etc.
|
|
2433
|
-
*
|
|
2434
|
-
* [!] Meta can be different depending on the type of input data
|
|
2435
|
-
*/
|
|
2436
|
-
declare class A_Meta<_StorageItems extends Record<any, any> = any, _SerializedType extends Record<string, any> = Record<string, any>> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
2717
|
+
constructor(
|
|
2437
2718
|
/**
|
|
2438
|
-
*
|
|
2719
|
+
* Constructor object that represents the entity
|
|
2720
|
+
*/
|
|
2721
|
+
newEntity?: _ConstructorType);
|
|
2722
|
+
/**
|
|
2723
|
+
* Extracts the ID from the ASEID
|
|
2724
|
+
* ID is the unique identifier of the entity
|
|
2725
|
+
*/
|
|
2726
|
+
get id(): string | number;
|
|
2727
|
+
protected isStringASEID(x: unknown): x is string;
|
|
2728
|
+
protected isASEIDInstance(x: unknown): x is ASEID;
|
|
2729
|
+
/**
|
|
2730
|
+
* A "serialized" object is considered such if it is a non-null object
|
|
2731
|
+
* and contains an "aseid" property (this mirrors your original check).
|
|
2439
2732
|
*
|
|
2440
|
-
* @param
|
|
2733
|
+
* @param x
|
|
2441
2734
|
* @returns
|
|
2442
2735
|
*/
|
|
2443
|
-
|
|
2444
|
-
protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
|
|
2736
|
+
protected isSerializedObject(x: unknown): x is _SerializedType;
|
|
2445
2737
|
/**
|
|
2446
|
-
*
|
|
2738
|
+
* Constructor-style props = a plain object which does NOT contain "aseid".
|
|
2739
|
+
* This is the "create from provided fields" case.
|
|
2447
2740
|
*
|
|
2741
|
+
* @param x
|
|
2448
2742
|
* @returns
|
|
2449
2743
|
*/
|
|
2450
|
-
|
|
2744
|
+
protected isConstructorProps(x: unknown): x is _ConstructorType;
|
|
2451
2745
|
/**
|
|
2452
|
-
*
|
|
2746
|
+
* Determines the appropriate initializer method based on the type of `props`.
|
|
2747
|
+
* The method checks if `props` is:
|
|
2748
|
+
* 1) a string that matches ASEID format -> fromASEID
|
|
2749
|
+
* 2) an ASEID instance -> fromASEID
|
|
2750
|
+
* 3) a serialized object (has 'aseid') -> fromJSON
|
|
2751
|
+
* 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
|
|
2752
|
+
*
|
|
2753
|
+
* [!] If `props` is undefined, it will call fromUndefined method
|
|
2754
|
+
*
|
|
2755
|
+
* If none of the above, it throws an error indicating incorrect constructor usage.
|
|
2756
|
+
*
|
|
2757
|
+
*
|
|
2758
|
+
* To get a custom initializer, override this method in the child class.
|
|
2759
|
+
* Example:
|
|
2760
|
+
* ```typescript
|
|
2761
|
+
* protected getInitializer(
|
|
2762
|
+
* props?: string | ASEID | _SerializedType | _ConstructorType
|
|
2763
|
+
* ): (props: any) => void | (() => void) {
|
|
2764
|
+
* if('customField' in props) {
|
|
2765
|
+
* return this.fromCustomField.bind(this);
|
|
2766
|
+
* }
|
|
2767
|
+
* return super.getInitializer(props);
|
|
2768
|
+
* }
|
|
2769
|
+
* ```
|
|
2770
|
+
* @param props
|
|
2771
|
+
* @returns The appropriate initializer method
|
|
2772
|
+
*/
|
|
2773
|
+
protected getInitializer(props?: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void | (() => void);
|
|
2774
|
+
/**
|
|
2775
|
+
* Generates a new ASEID for the entity.
|
|
2776
|
+
* It uses class definitions for concept, scope, and entity,
|
|
2777
|
+
* and allows overriding any of these values.
|
|
2778
|
+
*
|
|
2779
|
+
* @param override
|
|
2780
|
+
* @returns
|
|
2781
|
+
*/
|
|
2782
|
+
protected generateASEID(override?: Partial<A_TYPES__ASEID_Constructor>): ASEID;
|
|
2783
|
+
/**
|
|
2784
|
+
* Call a feature of the component with the provided scope
|
|
2453
2785
|
*
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2786
|
+
* [!] If the provided scope is not inherited from the entity scope, it will be inherited
|
|
2787
|
+
*
|
|
2788
|
+
* @param lifecycleMethod
|
|
2789
|
+
* @param args
|
|
2456
2790
|
*/
|
|
2457
|
-
|
|
2791
|
+
call(feature: string, scope?: A_Scope): any;
|
|
2458
2792
|
/**
|
|
2459
|
-
*
|
|
2460
|
-
*
|
|
2461
|
-
* @param key
|
|
2462
|
-
* @param value
|
|
2793
|
+
* The default method that can be called and extended to load entity data.
|
|
2463
2794
|
*/
|
|
2464
|
-
|
|
2795
|
+
load(scope?: A_Scope): Promise<any>;
|
|
2465
2796
|
/**
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2468
|
-
* @param key
|
|
2469
|
-
* @returns
|
|
2797
|
+
* The default method that can be called and extended to destroy entity data.
|
|
2470
2798
|
*/
|
|
2471
|
-
|
|
2799
|
+
destroy(scope?: A_Scope): Promise<any>;
|
|
2472
2800
|
/**
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
2475
|
-
* @param key
|
|
2476
|
-
* @returns
|
|
2801
|
+
* The default method that can be called and extended to save entity data.
|
|
2477
2802
|
*/
|
|
2478
|
-
|
|
2803
|
+
save(scope?: A_Scope): Promise<any>;
|
|
2479
2804
|
/**
|
|
2480
|
-
*
|
|
2805
|
+
* Create a new entity from ASEID string or instance
|
|
2806
|
+
* [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
|
|
2807
|
+
* [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
|
|
2481
2808
|
*
|
|
2482
|
-
* @
|
|
2809
|
+
* @param aseid
|
|
2483
2810
|
*/
|
|
2484
|
-
|
|
2811
|
+
fromASEID(aseid: string | ASEID): void;
|
|
2485
2812
|
/**
|
|
2486
|
-
*
|
|
2487
|
-
*
|
|
2488
|
-
*
|
|
2489
|
-
*
|
|
2490
|
-
* simple ? e.g. "a?" instead of "a."
|
|
2813
|
+
* Handles the case when no props are provided to the constructor.
|
|
2814
|
+
* This method can be overridden in child classes to set default values or perform specific initialization logic.
|
|
2815
|
+
* By default, it does nothing.
|
|
2491
2816
|
*
|
|
2492
|
-
* etc.
|
|
2493
2817
|
*
|
|
2494
|
-
* @param key
|
|
2495
2818
|
* @returns
|
|
2496
2819
|
*/
|
|
2497
|
-
|
|
2820
|
+
fromUndefined(): void;
|
|
2498
2821
|
/**
|
|
2499
|
-
*
|
|
2500
|
-
*
|
|
2501
|
-
*
|
|
2822
|
+
* Create a new entity from constructor object
|
|
2823
|
+
* [!] Executed when the constructor is called with an object that does not contain "aseid" property
|
|
2824
|
+
* [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
|
|
2502
2825
|
*
|
|
2503
|
-
* @param
|
|
2826
|
+
* @param newEntity
|
|
2504
2827
|
* @returns
|
|
2505
2828
|
*/
|
|
2506
|
-
|
|
2829
|
+
fromNew(newEntity: _ConstructorType): void;
|
|
2507
2830
|
/**
|
|
2508
|
-
*
|
|
2831
|
+
* Creates a new entity from serialized object
|
|
2509
2832
|
*
|
|
2510
|
-
*
|
|
2833
|
+
* [!] Executed when the constructor is called with an object that contains "aseid" property
|
|
2834
|
+
* [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
|
|
2511
2835
|
*
|
|
2512
|
-
* @param regex
|
|
2513
|
-
* @returns
|
|
2514
|
-
*/
|
|
2515
|
-
findByRegex(regex: RegExp): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2516
|
-
/**
|
|
2517
|
-
* Method to check if the map has a specific key
|
|
2518
2836
|
*
|
|
2519
|
-
* @param
|
|
2837
|
+
* @param serialized
|
|
2520
2838
|
* @returns
|
|
2521
2839
|
*/
|
|
2522
|
-
|
|
2840
|
+
fromJSON(serialized: _SerializedType): void;
|
|
2523
2841
|
/**
|
|
2524
|
-
*
|
|
2842
|
+
* Converts the entity to a JSON object
|
|
2843
|
+
* [!] This method should be extended in the child classes to include all properties of the entity
|
|
2844
|
+
* [!] Includes aseid by default
|
|
2845
|
+
*
|
|
2525
2846
|
*
|
|
2526
2847
|
* @returns
|
|
2527
2848
|
*/
|
|
2528
|
-
|
|
2529
|
-
/**
|
|
2530
|
-
* Method to clear the map
|
|
2531
|
-
*/
|
|
2532
|
-
clear(): void;
|
|
2533
|
-
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
2534
|
-
protected recursiveToJSON(value: any): any;
|
|
2849
|
+
toJSON(): _SerializedType;
|
|
2535
2850
|
/**
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2851
|
+
* Returns the string representation of the entity
|
|
2852
|
+
* what is basically the ASEID string
|
|
2538
2853
|
*
|
|
2539
2854
|
* @returns
|
|
2540
2855
|
*/
|
|
2541
|
-
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
declare enum A_TYPES__ComponentMetaKey {
|
|
2545
|
-
EXTENSIONS = "a-component-extensions",
|
|
2546
|
-
FEATURES = "a-component-features",
|
|
2547
|
-
INJECTIONS = "a-component-injections",
|
|
2548
|
-
ABSTRACTIONS = "a-component-abstractions"
|
|
2856
|
+
toString(): string;
|
|
2549
2857
|
}
|
|
2550
2858
|
|
|
2551
|
-
/**
|
|
2552
|
-
* Component constructor type
|
|
2553
|
-
* Uses the generic type T to specify the type of the component
|
|
2554
|
-
*/
|
|
2555
|
-
type A_TYPES__Component_Constructor<T = A_Component> = new (...args: any[]) => T;
|
|
2556
|
-
/**
|
|
2557
|
-
* Component initialization type
|
|
2558
|
-
*/
|
|
2559
|
-
type A_TYPES__Component_Init = any;
|
|
2560
|
-
/**
|
|
2561
|
-
* Component serialized type
|
|
2562
|
-
*/
|
|
2563
|
-
type A_TYPES__Component_Serialized = {
|
|
2564
|
-
/**
|
|
2565
|
-
* The ASEID of the component
|
|
2566
|
-
*/
|
|
2567
|
-
aseid: string;
|
|
2568
|
-
};
|
|
2569
|
-
/**
|
|
2570
|
-
* Component meta type
|
|
2571
|
-
*/
|
|
2572
|
-
type A_TYPES__ComponentMeta = {
|
|
2573
|
-
/**
|
|
2574
|
-
* Extensions applied to the component per handler
|
|
2575
|
-
*/
|
|
2576
|
-
[A_TYPES__ComponentMetaKey.EXTENSIONS]: A_Meta<{
|
|
2577
|
-
/**
|
|
2578
|
-
* Where Key the regexp for what to apply the extension
|
|
2579
|
-
* A set of container names or a wildcard, or a regexp
|
|
2580
|
-
*
|
|
2581
|
-
*
|
|
2582
|
-
* Where value is the extension instructions
|
|
2583
|
-
*/
|
|
2584
|
-
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
2585
|
-
}>;
|
|
2586
|
-
/**
|
|
2587
|
-
* Features defined on the component per handler
|
|
2588
|
-
*/
|
|
2589
|
-
[A_TYPES__ComponentMetaKey.FEATURES]: A_Meta<{
|
|
2590
|
-
/**
|
|
2591
|
-
* Where Key is the name of the feature
|
|
2592
|
-
*
|
|
2593
|
-
* Where value is the list of features
|
|
2594
|
-
*/
|
|
2595
|
-
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
2596
|
-
}>;
|
|
2597
|
-
/**
|
|
2598
|
-
* Injections defined on the component per handler
|
|
2599
|
-
*/
|
|
2600
|
-
[A_TYPES__ComponentMetaKey.INJECTIONS]: A_Meta<{
|
|
2601
|
-
/**
|
|
2602
|
-
* Where Key is the name of the injection
|
|
2603
|
-
*
|
|
2604
|
-
* Where value is the list of injections
|
|
2605
|
-
*/
|
|
2606
|
-
[Key: string]: A_TYPES__A_InjectDecorator_Meta;
|
|
2607
|
-
}>;
|
|
2608
|
-
/**
|
|
2609
|
-
* Abstractions extended by the component per handler
|
|
2610
|
-
*/
|
|
2611
|
-
[A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
2612
|
-
/**
|
|
2613
|
-
* Where Key is the name of the stage
|
|
2614
|
-
*
|
|
2615
|
-
* Where value is the list of injections
|
|
2616
|
-
*/
|
|
2617
|
-
[Key: string]: A_TYPES__ConceptAbstraction[];
|
|
2618
|
-
}>;
|
|
2619
|
-
};
|
|
2620
|
-
type A_TYPES__ComponentMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
|
|
2621
|
-
|
|
2622
|
-
type A_TYPES__CallerComponent = A_Container | A_Component | A_Entity;
|
|
2623
|
-
/**
|
|
2624
|
-
* Caller constructor type
|
|
2625
|
-
* Uses the generic type T to specify the type of the caller component
|
|
2626
|
-
*/
|
|
2627
|
-
type A_TYPES__Caller_Constructor<T = A_Caller> = new (...args: any[]) => T;
|
|
2628
|
-
/**
|
|
2629
|
-
* Caller initialization type
|
|
2630
|
-
*/
|
|
2631
|
-
type A_TYPES__Caller_Init = {};
|
|
2632
|
-
/**
|
|
2633
|
-
* Caller serialized type
|
|
2634
|
-
*/
|
|
2635
|
-
type A_TYPES__Caller_Serialized = {};
|
|
2636
|
-
|
|
2637
|
-
/**
|
|
2638
|
-
* A-Inject decorator descriptor type
|
|
2639
|
-
* Indicates the type of the decorator function
|
|
2640
|
-
*/
|
|
2641
|
-
type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
|
|
2642
|
-
/**
|
|
2643
|
-
* A-Inject decorator return type
|
|
2644
|
-
* Indicates what the decorator function returns
|
|
2645
|
-
*/
|
|
2646
|
-
type A_TYPES__A_InjectDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
2647
|
-
type A_TYPES__A_InjectDecorator_Meta = Array<{
|
|
2648
|
-
target: A_TYPES__InjectableConstructors;
|
|
2649
|
-
require?: boolean;
|
|
2650
|
-
load?: string;
|
|
2651
|
-
defaultArgs?: any;
|
|
2652
|
-
parent?: {
|
|
2653
|
-
layerOffset?: number;
|
|
2654
|
-
};
|
|
2655
|
-
flat?: boolean;
|
|
2656
|
-
create?: boolean;
|
|
2657
|
-
instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>;
|
|
2658
|
-
}>;
|
|
2659
|
-
/**
|
|
2660
|
-
* Targets that can be injected into Extended functions or constructors
|
|
2661
|
-
*
|
|
2662
|
-
*/
|
|
2663
|
-
type A_TYPES__InjectableTargets = A_TYPES__Component_Constructor | InstanceType<A_TYPES__Component_Constructor> | InstanceType<A_TYPES__Container_Constructor>;
|
|
2664
|
-
type A_TYPES__InjectableConstructors = A_TYPES__Component_Constructor | A_TYPES__Container_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Feature_Constructor | A_TYPES__Caller_Constructor | A_TYPES__Fragment_Constructor | A_TYPES__Error_Constructor | string;
|
|
2665
|
-
type A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T extends A_Entity = A_Entity> = {
|
|
2666
|
-
query: Partial<A_TYPES__A_InjectDecorator_EntityInjectionQuery<T>>;
|
|
2667
|
-
pagination: Partial<A_TYPES__A_InjectDecorator_EntityInjectionPagination>;
|
|
2668
|
-
};
|
|
2669
|
-
type A_TYPES__A_InjectDecorator_EntityInjectionQuery<T extends A_Entity = A_Entity> = {
|
|
2670
|
-
aseid: string;
|
|
2671
|
-
} & {
|
|
2672
|
-
[key in keyof T]?: any;
|
|
2673
|
-
};
|
|
2674
|
-
type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
2675
|
-
count: number;
|
|
2676
|
-
from: 'start' | 'end';
|
|
2677
|
-
};
|
|
2678
|
-
|
|
2679
2859
|
declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentType extends A_TYPES__Component_Constructor[] = A_TYPES__Component_Constructor[], _ErrorType extends A_TYPES__Error_Constructor[] = A_TYPES__Error_Constructor[], _EntityType extends A_TYPES__Entity_Constructor[] = A_TYPES__Entity_Constructor[], _FragmentType extends A_Fragment[] = A_Fragment[]> {
|
|
2680
2860
|
/**
|
|
2681
2861
|
* Scope Name uses for identification and logging purposes
|
|
@@ -2724,6 +2904,10 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
2724
2904
|
* Storage for the fragments, should be weak as fragments are singletons per scope
|
|
2725
2905
|
*/
|
|
2726
2906
|
protected _fragments: Map<A_TYPES__Fragment_Constructor<_FragmentType[number]>, _FragmentType[number]>;
|
|
2907
|
+
/**
|
|
2908
|
+
* Storage for imported scopes
|
|
2909
|
+
*/
|
|
2910
|
+
protected _imports: Set<A_Scope>;
|
|
2727
2911
|
/**
|
|
2728
2912
|
* Returns the name of the scope
|
|
2729
2913
|
*/
|
|
@@ -2772,6 +2956,11 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
2772
2956
|
* [!] One error per code
|
|
2773
2957
|
*/
|
|
2774
2958
|
get errors(): Array<InstanceType<_ErrorType[number]>>;
|
|
2959
|
+
/**
|
|
2960
|
+
* Returns an Array of imported scopes
|
|
2961
|
+
* [!] Imported scopes are scopes that have been imported into the current scope using the import() method
|
|
2962
|
+
*/
|
|
2963
|
+
get imports(): Array<A_Scope>;
|
|
2775
2964
|
/**
|
|
2776
2965
|
* Returns the parent scope of the current scope
|
|
2777
2966
|
*
|
|
@@ -2817,16 +3006,16 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
2817
3006
|
* @param level
|
|
2818
3007
|
* @returns
|
|
2819
3008
|
*/
|
|
2820
|
-
parentOffset(
|
|
3009
|
+
parentOffset<T extends A_Scope>(
|
|
2821
3010
|
/**
|
|
2822
3011
|
* Level of the parent scope to retrieve
|
|
2823
3012
|
*
|
|
2824
3013
|
* Examples:
|
|
2825
|
-
* - level 0 -
|
|
2826
|
-
* - level -1 -
|
|
2827
|
-
* - level -2 -
|
|
3014
|
+
* - level 0 - this scope
|
|
3015
|
+
* - level -1 - parent
|
|
3016
|
+
* - level -2 - grandparent
|
|
2828
3017
|
*/
|
|
2829
|
-
layerOffset: number):
|
|
3018
|
+
layerOffset: number): T | undefined;
|
|
2830
3019
|
/**
|
|
2831
3020
|
* Determines which initializer method to use based on the type of the first parameter.
|
|
2832
3021
|
*
|
|
@@ -2935,6 +3124,24 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
2935
3124
|
* @returns
|
|
2936
3125
|
*/
|
|
2937
3126
|
inherit(parent: A_Scope): A_Scope;
|
|
3127
|
+
/**
|
|
3128
|
+
* This method allows to import other scopes, to make their dependencies available in the current scope
|
|
3129
|
+
*
|
|
3130
|
+
* [!] Import doesn't create a parent-child relationship between scopes, it just copies the dependencies from the imported scopes
|
|
3131
|
+
* [!] It doesn't change the entities ownership, so entities remain unique to their original scopes
|
|
3132
|
+
*
|
|
3133
|
+
* @param scopes
|
|
3134
|
+
* @returns
|
|
3135
|
+
*/
|
|
3136
|
+
import(...scopes: A_Scope[]): A_Scope;
|
|
3137
|
+
/**
|
|
3138
|
+
* This method allows to deimport other scopes, to remove their dependencies from the current scope
|
|
3139
|
+
*
|
|
3140
|
+
*
|
|
3141
|
+
* @param scopes
|
|
3142
|
+
* @returns
|
|
3143
|
+
*/
|
|
3144
|
+
deimport(...scopes: A_Scope[]): A_Scope;
|
|
2938
3145
|
/**
|
|
2939
3146
|
* This method is used to check if the component is available in the scope
|
|
2940
3147
|
*
|
|
@@ -2970,6 +3177,7 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
2970
3177
|
* Provide a string to check if a component, entity or fragment with the provided name is available in the scope
|
|
2971
3178
|
*/
|
|
2972
3179
|
constructor: string): boolean;
|
|
3180
|
+
has<T extends A_TYPES__A_DependencyInjectable>(ctor: A_TYPES__Ctor<T> | string): boolean;
|
|
2973
3181
|
/**
|
|
2974
3182
|
* This method is used to check if the component is available in the scope
|
|
2975
3183
|
*
|
|
@@ -3006,16 +3214,12 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3006
3214
|
*/
|
|
3007
3215
|
constructor: string): boolean;
|
|
3008
3216
|
/**
|
|
3009
|
-
*
|
|
3010
|
-
*
|
|
3011
|
-
* [!] Notes:
|
|
3012
|
-
* - this method does NOT modify the existing scopes
|
|
3013
|
-
* - parent of the new scope will be the parent of the current scope or the parent of anotherScope (if exists)
|
|
3217
|
+
* Allows to resolve a specific dependency
|
|
3014
3218
|
*
|
|
3015
|
-
* @param
|
|
3219
|
+
* @param dependency
|
|
3016
3220
|
* @returns
|
|
3017
3221
|
*/
|
|
3018
|
-
|
|
3222
|
+
resolveDependency<T extends A_TYPES__A_DependencyInjectable>(dependency: A_Dependency<T>): T | Array<T> | undefined;
|
|
3019
3223
|
/**
|
|
3020
3224
|
* Allows to retrieve the constructor of the component or entity by its name
|
|
3021
3225
|
*
|
|
@@ -3041,6 +3245,7 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3041
3245
|
* Provide the fragment name in PascalCase to retrieve its constructor
|
|
3042
3246
|
*/
|
|
3043
3247
|
name: string): A_TYPES__Fragment_Constructor<T>;
|
|
3248
|
+
resolveConstructor<T extends A_TYPES__A_DependencyInjectable>(name: string): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> | undefined;
|
|
3044
3249
|
/**
|
|
3045
3250
|
* This method should resolve all instances of the components, or entities within the scope, by provided parent class
|
|
3046
3251
|
* So in case of providing a base class it should return all instances that extends this base class
|
|
@@ -3064,7 +3269,16 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3064
3269
|
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3065
3270
|
*/
|
|
3066
3271
|
entity: A_TYPES__Entity_Constructor<T>): Array<T>;
|
|
3067
|
-
resolveAll<T extends
|
|
3272
|
+
resolveAll<T extends A_TYPES__A_DependencyInjectable>(
|
|
3273
|
+
/**
|
|
3274
|
+
* Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
|
|
3275
|
+
*/
|
|
3276
|
+
constructorName: string): Array<T>;
|
|
3277
|
+
resolveAll<T extends A_TYPES__A_DependencyInjectable>(
|
|
3278
|
+
/**
|
|
3279
|
+
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
3280
|
+
*/
|
|
3281
|
+
ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
|
|
3068
3282
|
/**
|
|
3069
3283
|
* This method should resolve all instances of the components, or entities within the scope, by provided parent class
|
|
3070
3284
|
* So in case of providing a base class it should return all instances that extends this base class
|
|
@@ -3073,22 +3287,58 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3073
3287
|
*
|
|
3074
3288
|
* @param component
|
|
3075
3289
|
*/
|
|
3076
|
-
resolveFlatAll<T extends A_Component>(
|
|
3290
|
+
resolveFlatAll<T extends A_Component>(
|
|
3291
|
+
/**
|
|
3292
|
+
* Provide a component constructor to resolve its instance from the scope
|
|
3293
|
+
*/
|
|
3294
|
+
component: A_TYPES__Component_Constructor<T>): Array<T>;
|
|
3295
|
+
resolveFlatAll<T extends A_Fragment>(
|
|
3296
|
+
/**
|
|
3297
|
+
* Provide a fragment constructor to resolve its instance from the scope
|
|
3298
|
+
*/
|
|
3299
|
+
fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
|
|
3300
|
+
resolveFlatAll<T extends A_Entity>(
|
|
3301
|
+
/**
|
|
3302
|
+
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3303
|
+
*/
|
|
3304
|
+
entity: A_TYPES__Entity_Constructor<T>): Array<T>;
|
|
3305
|
+
resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
|
|
3306
|
+
/**
|
|
3307
|
+
* Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
|
|
3308
|
+
*/
|
|
3309
|
+
constructorName: string): Array<T>;
|
|
3310
|
+
resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
|
|
3311
|
+
/**
|
|
3312
|
+
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
3313
|
+
*/
|
|
3314
|
+
ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
|
|
3315
|
+
/**
|
|
3316
|
+
* This method allows to resolve/inject a component, fragment or entity from the scope
|
|
3317
|
+
* Depending on the provided parameters it can resolve:
|
|
3318
|
+
* - A single component/fragment/entity by its constructor or name
|
|
3319
|
+
* - An array of components/fragments/entities by providing an array of constructors
|
|
3320
|
+
* - An entity or an array of entities by providing the entity constructor and query instructions
|
|
3321
|
+
*
|
|
3322
|
+
* @param component
|
|
3323
|
+
* @returns
|
|
3324
|
+
*/
|
|
3325
|
+
resolve<T extends A_TYPES__A_DependencyInjectable>(
|
|
3077
3326
|
/**
|
|
3078
3327
|
* Provide a component constructor to resolve its instance from the scope
|
|
3079
3328
|
*/
|
|
3080
|
-
component:
|
|
3081
|
-
|
|
3329
|
+
component: A_TYPES__Ctor<T>): T | undefined;
|
|
3330
|
+
resolve<T extends A_TYPES__A_DependencyInjectable>(
|
|
3082
3331
|
/**
|
|
3083
|
-
* Provide a
|
|
3332
|
+
* Provide a target dependency to resolve its instance from the scope
|
|
3333
|
+
*
|
|
3334
|
+
* [!] In this case its possible to provide a custom resolution strategy via A_Dependency options
|
|
3084
3335
|
*/
|
|
3085
|
-
|
|
3086
|
-
|
|
3336
|
+
dependency: A_Dependency<T>): T | Array<T> | undefined;
|
|
3337
|
+
resolve<T extends A_TYPES__A_DependencyInjectable>(
|
|
3087
3338
|
/**
|
|
3088
|
-
* Provide
|
|
3339
|
+
* Provide a component constructor to resolve its instance from the scope
|
|
3089
3340
|
*/
|
|
3090
|
-
|
|
3091
|
-
resolveFlatAll<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): Array<T>;
|
|
3341
|
+
component: string): T | Array<T> | undefined;
|
|
3092
3342
|
/**
|
|
3093
3343
|
* This method allows to resolve/inject a component, fragment or entity from the scope
|
|
3094
3344
|
* Depending on the provided parameters it can resolve:
|
|
@@ -3099,78 +3349,45 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3099
3349
|
* @param component
|
|
3100
3350
|
* @returns
|
|
3101
3351
|
*/
|
|
3102
|
-
|
|
3352
|
+
resolveOnce<T extends A_Component>(
|
|
3103
3353
|
/**
|
|
3104
3354
|
* Provide a component constructor to resolve its instance from the scope
|
|
3105
3355
|
*/
|
|
3106
3356
|
component: A_TYPES__Component_Constructor<T>): T | undefined;
|
|
3107
|
-
|
|
3108
|
-
/**
|
|
3109
|
-
* Provide an array of component constructors to resolve their instances from the scope
|
|
3110
|
-
*/
|
|
3111
|
-
components: [...T]): Array<InstanceType<T[number]>> | undefined;
|
|
3112
|
-
resolve<T extends A_Fragment>(
|
|
3357
|
+
resolveOnce<T extends A_Fragment>(
|
|
3113
3358
|
/**
|
|
3114
3359
|
* Provide a fragment constructor to resolve its instance from the scope
|
|
3115
3360
|
*/
|
|
3116
3361
|
fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
|
|
3117
|
-
|
|
3118
|
-
/**
|
|
3119
|
-
* Provide an array of fragment constructors to resolve their instances from the scope
|
|
3120
|
-
*/
|
|
3121
|
-
fragments: [...T]): Array<InstanceType<T[number]>> | undefined;
|
|
3122
|
-
resolve<T extends A_Entity>(
|
|
3362
|
+
resolveOnce<T extends A_Entity>(
|
|
3123
3363
|
/**
|
|
3124
3364
|
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3125
3365
|
*/
|
|
3126
3366
|
entity: A_TYPES__Entity_Constructor<T>): T | undefined;
|
|
3127
|
-
|
|
3128
|
-
/**
|
|
3129
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3130
|
-
*/
|
|
3131
|
-
entity: A_TYPES__Entity_Constructor<T>,
|
|
3132
|
-
/**
|
|
3133
|
-
* Only Aseid Provided, in this case one entity will be returned
|
|
3134
|
-
*/
|
|
3135
|
-
instructions: {
|
|
3136
|
-
query: {
|
|
3137
|
-
aseid: string | ASEID;
|
|
3138
|
-
};
|
|
3139
|
-
}): T | undefined;
|
|
3140
|
-
resolve<T extends A_Entity>(
|
|
3141
|
-
/**
|
|
3142
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3143
|
-
*/
|
|
3144
|
-
entity: A_TYPES__Entity_Constructor<T>,
|
|
3145
|
-
/**
|
|
3146
|
-
* Provide optional instructions to find a specific entity or a set of entities
|
|
3147
|
-
*/
|
|
3148
|
-
instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): Array<T>;
|
|
3149
|
-
resolve<T extends A_Scope>(
|
|
3367
|
+
resolveOnce<T extends A_Scope>(
|
|
3150
3368
|
/**
|
|
3151
3369
|
* Uses only in case of resolving a single entity
|
|
3152
3370
|
*
|
|
3153
3371
|
* Provide an entity constructor to resolve its instance from the scope
|
|
3154
3372
|
*/
|
|
3155
3373
|
scope: A_TYPES__Scope_Constructor<T>): T | undefined;
|
|
3156
|
-
|
|
3374
|
+
resolveOnce<T extends A_Error>(
|
|
3157
3375
|
/**
|
|
3158
3376
|
* Uses only in case of resolving a single entity
|
|
3159
3377
|
*
|
|
3160
3378
|
* Provide an entity constructor to resolve its instance from the scope
|
|
3161
3379
|
*/
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
resolve<T extends A_TYPES__ScopeResolvableComponents>(
|
|
3380
|
+
error: A_TYPES__Error_Constructor<T>): T | undefined;
|
|
3381
|
+
resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
|
|
3165
3382
|
/**
|
|
3166
|
-
* Provide a component, fragment or entity constructor
|
|
3383
|
+
* Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
|
|
3167
3384
|
*/
|
|
3168
|
-
|
|
3169
|
-
|
|
3385
|
+
constructorName: string): T | undefined;
|
|
3386
|
+
resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
|
|
3170
3387
|
/**
|
|
3171
3388
|
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
3172
3389
|
*/
|
|
3173
|
-
|
|
3390
|
+
ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
|
|
3174
3391
|
/**
|
|
3175
3392
|
* This polymorphic method allows to resolve/inject a component, fragment or entity from the scope
|
|
3176
3393
|
* Depending on the provided parameters it can resolve:
|
|
@@ -3187,48 +3404,16 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3187
3404
|
* Provide a component constructor to resolve its instance from the scope
|
|
3188
3405
|
*/
|
|
3189
3406
|
component: A_TYPES__Component_Constructor<T>): T | undefined;
|
|
3190
|
-
resolveFlat<T extends A_TYPES__Component_Constructor[]>(
|
|
3191
|
-
/**
|
|
3192
|
-
* Provide an array of component constructors to resolve their instances from the scope
|
|
3193
|
-
*/
|
|
3194
|
-
components: [...T]): Array<InstanceType<T[number]>> | undefined;
|
|
3195
3407
|
resolveFlat<T extends A_Fragment>(
|
|
3196
3408
|
/**
|
|
3197
3409
|
* Provide a fragment constructor to resolve its instance from the scope
|
|
3198
3410
|
*/
|
|
3199
3411
|
fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
|
|
3200
|
-
resolveFlat<T extends A_TYPES__Fragment_Constructor[]>(
|
|
3201
|
-
/**
|
|
3202
|
-
* Provide an array of fragment constructors to resolve their instances from the scope
|
|
3203
|
-
*/
|
|
3204
|
-
fragments: [...T]): Array<InstanceType<T[number]>> | undefined;
|
|
3205
3412
|
resolveFlat<T extends A_Entity>(
|
|
3206
3413
|
/**
|
|
3207
3414
|
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3208
3415
|
*/
|
|
3209
3416
|
entity: A_TYPES__Entity_Constructor<T>): T | undefined;
|
|
3210
|
-
resolveFlat<T extends A_Entity>(
|
|
3211
|
-
/**
|
|
3212
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3213
|
-
*/
|
|
3214
|
-
entity: A_TYPES__Entity_Constructor<T>,
|
|
3215
|
-
/**
|
|
3216
|
-
* Only Aseid Provided, in this case one entity will be returned
|
|
3217
|
-
*/
|
|
3218
|
-
instructions: {
|
|
3219
|
-
query: {
|
|
3220
|
-
aseid: string | ASEID;
|
|
3221
|
-
};
|
|
3222
|
-
}): T | undefined;
|
|
3223
|
-
resolveFlat<T extends A_Entity>(
|
|
3224
|
-
/**
|
|
3225
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
3226
|
-
*/
|
|
3227
|
-
entity: A_TYPES__Entity_Constructor<T>,
|
|
3228
|
-
/**
|
|
3229
|
-
* Provide optional instructions to find a specific entity or a set of entities
|
|
3230
|
-
*/
|
|
3231
|
-
instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): Array<T>;
|
|
3232
3417
|
resolveFlat<T extends A_Scope>(
|
|
3233
3418
|
/**
|
|
3234
3419
|
* Uses only in case of resolving a single entity
|
|
@@ -3242,43 +3427,34 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3242
3427
|
*
|
|
3243
3428
|
* Provide an entity constructor to resolve its instance from the scope
|
|
3244
3429
|
*/
|
|
3245
|
-
|
|
3246
|
-
resolveFlat<T extends
|
|
3247
|
-
resolveFlat<T extends A_TYPES__ScopeResolvableComponents>(
|
|
3430
|
+
error: A_TYPES__Error_Constructor<T>): T | undefined;
|
|
3431
|
+
resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
|
|
3248
3432
|
/**
|
|
3249
|
-
* Provide a component, fragment or entity constructor
|
|
3433
|
+
* Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
|
|
3250
3434
|
*/
|
|
3251
|
-
|
|
3252
|
-
resolveFlat<T extends
|
|
3435
|
+
constructorName: string): T | undefined;
|
|
3436
|
+
resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
|
|
3253
3437
|
/**
|
|
3254
3438
|
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
3255
3439
|
*/
|
|
3256
|
-
|
|
3257
|
-
/**
|
|
3258
|
-
* This method is used internally to resolve a component, fragment or entity by its constructor name
|
|
3259
|
-
*
|
|
3260
|
-
* [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
|
|
3261
|
-
* [!!] Note: No parent scopes are checked
|
|
3262
|
-
*
|
|
3263
|
-
* @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)
|
|
3264
|
-
* @returns
|
|
3265
|
-
*/
|
|
3266
|
-
private resolveByName;
|
|
3440
|
+
ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable>): T | undefined;
|
|
3267
3441
|
/**
|
|
3268
3442
|
* Resolves a component, fragment or entity from the scope without checking parent scopes
|
|
3269
3443
|
*
|
|
3270
3444
|
* @param component
|
|
3271
3445
|
* @param instructions
|
|
3272
3446
|
*/
|
|
3273
|
-
|
|
3447
|
+
resolveFlatOnce<T extends A_TYPES__A_DependencyInjectable>(component: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
|
|
3274
3448
|
/**
|
|
3275
|
-
* This method is used internally to resolve a
|
|
3449
|
+
* This method is used internally to resolve a component, fragment or entity by its constructor name
|
|
3276
3450
|
*
|
|
3277
|
-
*
|
|
3278
|
-
*
|
|
3451
|
+
* [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
|
|
3452
|
+
* [!!] Note: No parent scopes are checked
|
|
3453
|
+
*
|
|
3454
|
+
* @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)
|
|
3279
3455
|
* @returns
|
|
3280
3456
|
*/
|
|
3281
|
-
private
|
|
3457
|
+
private resolveByName;
|
|
3282
3458
|
/**
|
|
3283
3459
|
* Resolves the issuer of the scope by provided constructor
|
|
3284
3460
|
*
|
|
@@ -3381,6 +3557,11 @@ declare class A_Scope<_MetaItems extends Record<string, any> = any, _ComponentTy
|
|
|
3381
3557
|
* Provide an entity instance to register it in the scope
|
|
3382
3558
|
*/
|
|
3383
3559
|
entity: T): void;
|
|
3560
|
+
register<T extends A_TYPES__A_DependencyInjectable>(
|
|
3561
|
+
/**
|
|
3562
|
+
* Provide an entity instance to register it in the scope
|
|
3563
|
+
*/
|
|
3564
|
+
entity: T): void;
|
|
3384
3565
|
/**
|
|
3385
3566
|
* This method is used to deregister the component from the scope
|
|
3386
3567
|
*
|
|
@@ -3522,7 +3703,7 @@ declare class A_Component {
|
|
|
3522
3703
|
* Scope constructor type
|
|
3523
3704
|
* Uses the generic type T to specify the type of the Scope
|
|
3524
3705
|
*/
|
|
3525
|
-
type A_TYPES__Scope_Constructor<T = A_Scope> =
|
|
3706
|
+
type A_TYPES__Scope_Constructor<T = A_Scope> = A_TYPES__Ctor<T>;
|
|
3526
3707
|
/**
|
|
3527
3708
|
* Scope initialization type
|
|
3528
3709
|
*/
|
|
@@ -3567,17 +3748,13 @@ type A_TYPES__ScopeConfig = {
|
|
|
3567
3748
|
*/
|
|
3568
3749
|
type A_TYPES__Scope_Serialized = {};
|
|
3569
3750
|
/**
|
|
3570
|
-
*
|
|
3751
|
+
* A list of constructors that can have a scope associated with them
|
|
3571
3752
|
*/
|
|
3572
3753
|
type A_TYPES__ScopeLinkedConstructors = A_TYPES__Container_Constructor | A_TYPES__Feature_Constructor;
|
|
3573
3754
|
/**
|
|
3574
3755
|
* A list of components that can have a scope associated with them
|
|
3575
3756
|
*/
|
|
3576
3757
|
type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature;
|
|
3577
|
-
/**
|
|
3578
|
-
* A list of components that can be resolved by a scope
|
|
3579
|
-
*/
|
|
3580
|
-
type A_TYPES__ScopeResolvableComponents = A_Component | A_Fragment | A_Entity | A_Error | A_Scope;
|
|
3581
3758
|
/**
|
|
3582
3759
|
* A list of components that are dependent on a scope and do not have their own scope
|
|
3583
3760
|
*/
|
|
@@ -3870,12 +4047,12 @@ declare class A_Context {
|
|
|
3870
4047
|
/**
|
|
3871
4048
|
* Get meta for the specific class or instance
|
|
3872
4049
|
*/
|
|
3873
|
-
constructor:
|
|
4050
|
+
constructor: A_TYPES__Ctor<any>): T;
|
|
3874
4051
|
static meta<T extends Record<string, any>>(
|
|
3875
4052
|
/**
|
|
3876
4053
|
* Get meta for the specific class or instance
|
|
3877
4054
|
*/
|
|
3878
|
-
constructor:
|
|
4055
|
+
constructor: A_TYPES__Ctor<any>): A_Meta<T>;
|
|
3879
4056
|
/**
|
|
3880
4057
|
* Allows to set meta for the specific class or instance.
|
|
3881
4058
|
*
|
|
@@ -4109,6 +4286,21 @@ declare class A_CallerError extends A_Error {
|
|
|
4109
4286
|
static readonly CallerInitializationError = "Unable to initialize A-Caller";
|
|
4110
4287
|
}
|
|
4111
4288
|
|
|
4289
|
+
type A_TYPES__CallerComponent = A_Container | A_Component | A_Entity;
|
|
4290
|
+
/**
|
|
4291
|
+
* Caller constructor type
|
|
4292
|
+
* Uses the generic type T to specify the type of the caller component
|
|
4293
|
+
*/
|
|
4294
|
+
type A_TYPES__Caller_Constructor<T = A_Caller> = A_TYPES__Ctor<T>;
|
|
4295
|
+
/**
|
|
4296
|
+
* Caller initialization type
|
|
4297
|
+
*/
|
|
4298
|
+
type A_TYPES__Caller_Init = {};
|
|
4299
|
+
/**
|
|
4300
|
+
* Caller serialized type
|
|
4301
|
+
*/
|
|
4302
|
+
type A_TYPES__Caller_Serialized = {};
|
|
4303
|
+
|
|
4112
4304
|
declare const A_CONSTANTS__ERROR_CODES: {
|
|
4113
4305
|
readonly UNEXPECTED_ERROR: "A-Error Unexpected Error";
|
|
4114
4306
|
readonly VALIDATION_ERROR: "A-Error Validation Error";
|
|
@@ -4126,6 +4318,7 @@ declare class A_ScopeError extends A_Error {
|
|
|
4126
4318
|
static readonly ResolutionError = "A-Scope Resolution Error";
|
|
4127
4319
|
static readonly RegistrationError = "A-Scope Registration Error";
|
|
4128
4320
|
static readonly CircularInheritanceError = "A-Scope Circular Inheritance Error";
|
|
4321
|
+
static readonly CircularImportError = "A-Scope Circular Import Error";
|
|
4129
4322
|
static readonly DeregistrationError = "A-Scope Deregistration Error";
|
|
4130
4323
|
}
|
|
4131
4324
|
|
|
@@ -4136,119 +4329,14 @@ declare class A_ScopeError extends A_Error {
|
|
|
4136
4329
|
*
|
|
4137
4330
|
* @returns
|
|
4138
4331
|
*/
|
|
4139
|
-
declare function A_MetaDecorator<T extends A_Meta>(constructor:
|
|
4140
|
-
|
|
4141
|
-
/**
|
|
4142
|
-
* A-Dependency require decorator return type
|
|
4143
|
-
*/
|
|
4144
|
-
type A_TYPES__A_Dependency_RequireDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
4145
|
-
/**
|
|
4146
|
-
* A-Dependency load decorator return type
|
|
4147
|
-
*/
|
|
4148
|
-
type A_TYPES__A_Dependency_LoadDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
4149
|
-
/**
|
|
4150
|
-
* A-Dependency default decorator return type
|
|
4151
|
-
*/
|
|
4152
|
-
type A_TYPES__A_Dependency_DefaultDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
4153
|
-
type A_TYPES__A_Dependency_ParentDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
4154
|
-
type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
4155
|
-
|
|
4156
|
-
/**
|
|
4157
|
-
* Should indicate which Default is required
|
|
4158
|
-
*/
|
|
4159
|
-
declare function A_Dependency_Default(
|
|
4160
|
-
/**
|
|
4161
|
-
* Constructor Parameters that will be used to create the default instance
|
|
4162
|
-
*/
|
|
4163
|
-
...args: any[]): A_TYPES__A_Dependency_DefaultDecoratorReturn;
|
|
4164
|
-
|
|
4165
|
-
/**
|
|
4166
|
-
* Should indicate which dependency is required
|
|
4167
|
-
*/
|
|
4168
|
-
declare function A_Dependency_Flat(): A_TYPES__A_Dependency_FlatDecoratorReturn;
|
|
4169
|
-
|
|
4170
|
-
/**
|
|
4171
|
-
* Should indicate which Load is required
|
|
4172
|
-
*/
|
|
4173
|
-
declare function A_Dependency_Load(
|
|
4174
|
-
/**
|
|
4175
|
-
* Path to load the dependency from
|
|
4176
|
-
*/
|
|
4177
|
-
path: string): A_TYPES__A_Dependency_LoadDecoratorReturn;
|
|
4178
|
-
|
|
4179
|
-
/**
|
|
4180
|
-
* Should indicate which dependency is required
|
|
4181
|
-
*/
|
|
4182
|
-
declare function A_Dependency_Parent(
|
|
4183
|
-
/**
|
|
4184
|
-
* Indicates how many layers up the parent dependency should be resolved from current dependency
|
|
4185
|
-
*
|
|
4186
|
-
* Default: -1 (one layer up)
|
|
4187
|
-
*/
|
|
4188
|
-
layerOffset?: number): A_TYPES__A_Dependency_ParentDecoratorReturn;
|
|
4189
|
-
|
|
4190
|
-
/**
|
|
4191
|
-
* Should indicate which dependency is required
|
|
4192
|
-
*/
|
|
4193
|
-
declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorReturn;
|
|
4194
|
-
|
|
4195
|
-
declare class A_Dependency {
|
|
4196
|
-
/**
|
|
4197
|
-
* Allows to indicate which Injected parameter is required
|
|
4198
|
-
*
|
|
4199
|
-
* [!] If parameter marked as required is not provided, an error will be thrown
|
|
4200
|
-
*
|
|
4201
|
-
* @returns
|
|
4202
|
-
*/
|
|
4203
|
-
static get Required(): typeof A_Dependency_Require;
|
|
4204
|
-
/**
|
|
4205
|
-
* Allows to indicate which dependency should be loaded from a specific path
|
|
4206
|
-
*
|
|
4207
|
-
* @returns
|
|
4208
|
-
*/
|
|
4209
|
-
static get Loaded(): typeof A_Dependency_Load;
|
|
4210
|
-
/**
|
|
4211
|
-
* Allows to indicate which dependency default parameters should be used
|
|
4212
|
-
*
|
|
4213
|
-
* @returns
|
|
4214
|
-
*/
|
|
4215
|
-
static get Default(): typeof A_Dependency_Default;
|
|
4216
|
-
/**
|
|
4217
|
-
* Allows to indicate which parent dependency should be resolved
|
|
4218
|
-
* e.g. from which layer up the parent should be taken
|
|
4219
|
-
*
|
|
4220
|
-
* @returns
|
|
4221
|
-
*/
|
|
4222
|
-
static get Parent(): typeof A_Dependency_Parent;
|
|
4223
|
-
/**
|
|
4224
|
-
* Allows to indicate that the dependency should be resolved in a flat manner
|
|
4225
|
-
* Only in the same scope, without going up to parent scopes
|
|
4226
|
-
*
|
|
4227
|
-
* @returns
|
|
4228
|
-
*/
|
|
4229
|
-
static get Flat(): typeof A_Dependency_Flat;
|
|
4230
|
-
protected _name: string;
|
|
4231
|
-
/**
|
|
4232
|
-
* Class instances allows to indentify dependencies by name and use them for better type checking
|
|
4233
|
-
*
|
|
4234
|
-
* @param name
|
|
4235
|
-
*/
|
|
4236
|
-
constructor(name: string);
|
|
4237
|
-
/**
|
|
4238
|
-
* Gets the dependency name
|
|
4239
|
-
*
|
|
4240
|
-
* Can be identifier, url or any string value
|
|
4241
|
-
*
|
|
4242
|
-
* @returns
|
|
4243
|
-
*/
|
|
4244
|
-
get name(): string;
|
|
4245
|
-
}
|
|
4332
|
+
declare function A_MetaDecorator<T extends A_Meta>(constructor: A_TYPES__Ctor<T>): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: TTarget) => TTarget;
|
|
4246
4333
|
|
|
4247
4334
|
declare class A_DependencyError extends A_Error {
|
|
4248
4335
|
static readonly InvalidDependencyTarget = "Invalid Dependency Target";
|
|
4249
4336
|
static readonly InvalidLoadTarget = "Invalid Load Target";
|
|
4250
4337
|
static readonly InvalidLoadPath = "Invalid Load Path";
|
|
4251
4338
|
static readonly InvalidDefaultTarget = "Invalid Default Target";
|
|
4339
|
+
static readonly ResolutionParametersError = "Dependency Resolution Parameters Error";
|
|
4252
4340
|
}
|
|
4253
4341
|
|
|
4254
4342
|
declare class A_InjectError extends A_Error {
|
|
@@ -4267,48 +4355,32 @@ declare class A_InjectError extends A_Error {
|
|
|
4267
4355
|
* @param params - see overloads
|
|
4268
4356
|
* @returns - decorator function
|
|
4269
4357
|
*/
|
|
4270
|
-
declare function A_Inject<T extends A_Scope>(
|
|
4271
|
-
/***
|
|
4272
|
-
* Provide the Scope constructor that will be associated with the injection.
|
|
4273
|
-
*
|
|
4274
|
-
* [!] It returns an instance of the Scope where the Entity/Component/Container is defined.
|
|
4275
|
-
*/
|
|
4276
|
-
scope: A_TYPES__Scope_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4277
|
-
declare function A_Inject<T extends A_Error>(
|
|
4278
|
-
/***
|
|
4279
|
-
* Provide the Error constructor that will be associated with the injection.
|
|
4280
|
-
*
|
|
4281
|
-
* [!] It returns an Instance of the Error what is executed.
|
|
4282
|
-
*/
|
|
4283
|
-
error: A_TYPES__Error_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4284
|
-
declare function A_Inject<T extends A_Feature>(
|
|
4285
|
-
/**
|
|
4286
|
-
* Provide the Feature constructor that will be associated with the injection.
|
|
4287
|
-
*
|
|
4288
|
-
* [!] It returns an Instance of the Feature what is executed.
|
|
4289
|
-
*/
|
|
4290
|
-
feature: A_TYPES__Feature_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4291
4358
|
declare function A_Inject<T extends A_Component>(
|
|
4292
4359
|
/**
|
|
4293
4360
|
* Provide the Component constructor that will be associated with the injection.
|
|
4294
4361
|
*
|
|
4295
4362
|
* [!] It returns an Instance of the Component from current Scope or from Parent Scopes.
|
|
4296
4363
|
*/
|
|
4297
|
-
component: A_TYPES__Component_Constructor<T
|
|
4298
|
-
declare function A_Inject(
|
|
4364
|
+
component: A_TYPES__Component_Constructor<T>,
|
|
4299
4365
|
/**
|
|
4300
|
-
* Provide
|
|
4366
|
+
* Provide additional instructions on how to perform the injection
|
|
4301
4367
|
*
|
|
4302
|
-
* [!]
|
|
4368
|
+
* [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
|
|
4303
4369
|
*/
|
|
4304
|
-
|
|
4370
|
+
config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
|
|
4305
4371
|
declare function A_Inject<T extends A_Fragment>(
|
|
4306
4372
|
/**
|
|
4307
4373
|
* Provide the Fragment constructor to inject the Fragment instance
|
|
4308
4374
|
*
|
|
4309
4375
|
* [!] It returns the Fragment instance from current Scope or from Parent Scopes.
|
|
4310
4376
|
*/
|
|
4311
|
-
fragment: A_TYPES__Fragment_Constructor<T
|
|
4377
|
+
fragment: A_TYPES__Fragment_Constructor<T>,
|
|
4378
|
+
/**
|
|
4379
|
+
* Provide additional instructions on how to perform the injection
|
|
4380
|
+
*
|
|
4381
|
+
* [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
|
|
4382
|
+
*/
|
|
4383
|
+
config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
|
|
4312
4384
|
declare function A_Inject<T extends A_Entity>(
|
|
4313
4385
|
/**
|
|
4314
4386
|
* Provide the Entity constructor to inject the Entity instance
|
|
@@ -4323,7 +4395,7 @@ entity: A_TYPES__Entity_Constructor<T>,
|
|
|
4323
4395
|
*
|
|
4324
4396
|
* [!] Default Pagination is 1 if it's necessary to get multiple Entities please customize it in the instructions
|
|
4325
4397
|
*/
|
|
4326
|
-
config?: Partial<
|
|
4398
|
+
config?: Partial<A_TYPES__A_DependencyResolutionStrategy<T>>): A_TYPES__A_InjectDecoratorReturn<T>;
|
|
4327
4399
|
declare function A_Inject<T extends A_Component>(
|
|
4328
4400
|
/**
|
|
4329
4401
|
* Provide the name of Component constructor to inject the Component instance
|
|
@@ -4331,6 +4403,47 @@ declare function A_Inject<T extends A_Component>(
|
|
|
4331
4403
|
* [!] You can use both customized one or original depending on your overriding strategy
|
|
4332
4404
|
*/
|
|
4333
4405
|
ctor: string): A_TYPES__A_InjectDecoratorReturn;
|
|
4406
|
+
declare function A_Inject<T extends A_Caller>(
|
|
4407
|
+
/**
|
|
4408
|
+
* Provide the A_Caller constructor to inject the Caller instance
|
|
4409
|
+
*
|
|
4410
|
+
* [!] It returns initiator of the call, e.g. Container/Component/Command who called Feature
|
|
4411
|
+
*/
|
|
4412
|
+
caller: A_TYPES__Caller_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4413
|
+
declare function A_Inject<T extends A_Error>(
|
|
4414
|
+
/***
|
|
4415
|
+
* Provide the Error constructor that will be associated with the injection.
|
|
4416
|
+
*
|
|
4417
|
+
* [!] It returns an Instance of the Error what is executed.
|
|
4418
|
+
*/
|
|
4419
|
+
error: A_TYPES__Error_Constructor<T>,
|
|
4420
|
+
/**
|
|
4421
|
+
* Provide additional instructions on how to perform the injection
|
|
4422
|
+
*
|
|
4423
|
+
* [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
|
|
4424
|
+
*/
|
|
4425
|
+
config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
|
|
4426
|
+
declare function A_Inject<T extends A_Feature>(
|
|
4427
|
+
/**
|
|
4428
|
+
* Provide the Feature constructor that will be associated with the injection.
|
|
4429
|
+
*
|
|
4430
|
+
* [!] It returns an Instance of the Feature what is executed.
|
|
4431
|
+
*/
|
|
4432
|
+
feature: A_TYPES__Feature_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4433
|
+
declare function A_Inject<T extends A_Scope>(
|
|
4434
|
+
/***
|
|
4435
|
+
* Provide the Scope constructor that will be associated with the injection.
|
|
4436
|
+
*
|
|
4437
|
+
* [!] It returns an instance of the Scope where the Entity/Component/Container is defined.
|
|
4438
|
+
*/
|
|
4439
|
+
scope: A_TYPES__Scope_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4440
|
+
declare function A_Inject<T extends A_TYPES__A_DependencyInjectable>(
|
|
4441
|
+
/***
|
|
4442
|
+
* Provide the Scope constructor that will be associated with the injection.
|
|
4443
|
+
*
|
|
4444
|
+
* [!] It returns an instance of the Scope where the Entity/Component/Container is defined.
|
|
4445
|
+
*/
|
|
4446
|
+
dependency: A_Dependency<T>): A_TYPES__A_InjectDecoratorReturn;
|
|
4334
4447
|
|
|
4335
4448
|
declare class A_CommonHelper {
|
|
4336
4449
|
/**
|
|
@@ -4574,6 +4687,20 @@ declare class A_TypeGuards {
|
|
|
4574
4687
|
* @returns
|
|
4575
4688
|
*/
|
|
4576
4689
|
static isCallerConstructor(ctor: any): ctor is A_TYPES__Caller_Constructor;
|
|
4690
|
+
/**
|
|
4691
|
+
* Type guard to check if the constructor is of type A_Dependency
|
|
4692
|
+
*
|
|
4693
|
+
* @param ctor
|
|
4694
|
+
* @returns
|
|
4695
|
+
*/
|
|
4696
|
+
static isDependencyConstructor<T extends A_TYPES__A_DependencyInjectable>(ctor: any): ctor is A_Dependency<T>;
|
|
4697
|
+
/**
|
|
4698
|
+
* Type guard to check if the instance is of type A_Dependency
|
|
4699
|
+
*
|
|
4700
|
+
* @param instance
|
|
4701
|
+
* @returns
|
|
4702
|
+
*/
|
|
4703
|
+
static isDependencyInstance<T extends A_TYPES__A_DependencyInjectable>(instance: any): instance is A_Dependency<T>;
|
|
4577
4704
|
/**
|
|
4578
4705
|
* Type guard to check if the instance is of type A_Container
|
|
4579
4706
|
*
|
|
@@ -4644,6 +4771,7 @@ declare class A_TypeGuards {
|
|
|
4644
4771
|
* @returns
|
|
4645
4772
|
*/
|
|
4646
4773
|
static isEntityMetaInstance(instance: any): instance is A_EntityMeta;
|
|
4774
|
+
static hasASEID(value: any): value is A_Entity | A_Error;
|
|
4647
4775
|
static isConstructorAllowedForScopeAllocation(target: any): target is A_TYPES__ScopeLinkedConstructors;
|
|
4648
4776
|
static isInstanceAllowedForScopeAllocation(target: any): target is A_TYPES__ScopeLinkedComponents;
|
|
4649
4777
|
static isConstructorAvailableForAbstraction(target: any): target is A_TYPES__AbstractionAvailableComponents;
|
|
@@ -4652,7 +4780,7 @@ declare class A_TypeGuards {
|
|
|
4652
4780
|
static isAllowedForFeatureDefinition(param: any): param is A_TYPES__FeatureAvailableComponents;
|
|
4653
4781
|
static isAllowedForFeatureExtension(param: any): param is A_TYPES__FeatureExtendDecoratorTarget;
|
|
4654
4782
|
static isAllowedForAbstractionDefinition(param: any): param is A_TYPES__AbstractionAvailableComponents;
|
|
4655
|
-
static isAllowedForDependencyDefaultCreation(param: any): param is A_TYPES__Entity_Constructor |
|
|
4783
|
+
static isAllowedForDependencyDefaultCreation(param: any): param is A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor;
|
|
4656
4784
|
/**
|
|
4657
4785
|
* Allows to check if the provided param is of constructor type.
|
|
4658
4786
|
*
|
|
@@ -4663,4 +4791,4 @@ declare class A_TypeGuards {
|
|
|
4663
4791
|
static isErrorSerializedType<T extends A_TYPES__Error_Serialized>(param: any): param is T;
|
|
4664
4792
|
}
|
|
4665
4793
|
|
|
4666
|
-
export { ASEID, ASEID_Error, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, 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_Default, A_Dependency_Load, 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_Dependency_DefaultDecoratorReturn, type
|
|
4794
|
+
export { ASEID, ASEID_Error, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, 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_Default, A_Dependency_Load, 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 };
|