@adaas/a-concept 0.2.13 → 0.3.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.
Files changed (141) hide show
  1. package/.conf/tsconfig.base.json +91 -0
  2. package/.conf/tsconfig.browser.json +36 -0
  3. package/.conf/tsconfig.node.json +40 -0
  4. package/dist/browser/index.d.mts +4166 -212
  5. package/dist/browser/index.mjs +2 -67
  6. package/dist/browser/index.mjs.map +1 -1
  7. package/dist/node/index.cjs +5761 -0
  8. package/dist/node/index.cjs.map +1 -0
  9. package/dist/node/index.d.mts +4193 -212
  10. package/dist/node/index.d.ts +4193 -212
  11. package/dist/node/index.mjs +5699 -66
  12. package/dist/node/index.mjs.map +1 -1
  13. package/jest.config.ts +30 -15
  14. package/package.json +19 -18
  15. package/src/env/env-browser.ts +38 -1
  16. package/src/env/env-node.ts +26 -2
  17. package/src/env/env.base.ts +20 -1
  18. package/src/env/global.browser.d.ts +1 -1
  19. package/src/helpers/A_BasicTypeGuards.helper.ts +81 -0
  20. package/src/helpers/A_Common.helper.ts +2 -2
  21. package/src/helpers/A_Identity.helper.ts +2 -4
  22. package/src/helpers/A_TypeGuards.helper.ts +45 -30
  23. package/src/helpers/index.ts +5 -0
  24. package/src/index.ts +21 -94
  25. package/src/{global → lib}/A-Abstraction/A-Abstraction-Extend.decorator.ts +18 -13
  26. package/src/{global → lib}/A-Abstraction/A-Abstraction.class.ts +5 -5
  27. package/src/{global → lib}/A-Abstraction/A-Abstraction.error.ts +1 -1
  28. package/src/{global → lib}/A-Abstraction/A-Abstraction.types.ts +5 -5
  29. package/src/lib/A-Abstraction/index.ts +8 -0
  30. package/src/{global → lib}/A-Caller/A_Caller.class.ts +3 -4
  31. package/src/{global → lib}/A-Caller/A_Caller.error.ts +1 -4
  32. package/src/{global → lib}/A-Caller/A_Caller.types.ts +4 -4
  33. package/src/lib/A-Caller/index.ts +3 -0
  34. package/src/{global → lib}/A-Component/A-Component.class.ts +2 -3
  35. package/src/{global → lib}/A-Component/A-Component.meta.ts +5 -5
  36. package/src/{global → lib}/A-Component/A-Component.types.ts +5 -5
  37. package/src/lib/A-Component/index.ts +5 -0
  38. package/src/{global → lib}/A-Concept/A-Concept.class.ts +9 -7
  39. package/src/{global → lib}/A-Concept/A-Concept.meta.ts +2 -2
  40. package/src/{global → lib}/A-Concept/A-Concept.types.ts +7 -7
  41. package/src/lib/A-Concept/index.ts +4 -0
  42. package/src/{global → lib}/A-Container/A-Container.class.ts +3 -3
  43. package/src/{global → lib}/A-Container/A-Container.meta.ts +11 -6
  44. package/src/{global → lib}/A-Container/A-Container.types.ts +9 -6
  45. package/src/lib/A-Container/index.ts +5 -0
  46. package/src/{global → lib}/A-Context/A-Context.class.ts +41 -33
  47. package/src/{global → lib}/A-Context/A-Context.error.ts +1 -1
  48. package/src/lib/A-Context/A-Context.types.ts +14 -0
  49. package/src/lib/A-Context/index.ts +5 -0
  50. package/src/{global → lib}/A-Dependency/A-Dependency-All.decorator.ts +11 -11
  51. package/src/{global → lib}/A-Dependency/A-Dependency-Default.decorator.ts +11 -9
  52. package/src/{global → lib}/A-Dependency/A-Dependency-Flat.decorator.ts +11 -8
  53. package/src/{global → lib}/A-Dependency/A-Dependency-Load.decorator.ts +11 -9
  54. package/src/{global → lib}/A-Dependency/A-Dependency-Parent.decorator.ts +11 -9
  55. package/src/{global → lib}/A-Dependency/A-Dependency-Require.decorator.ts +11 -9
  56. package/src/{global → lib}/A-Dependency/A-Dependency.class.ts +9 -3
  57. package/src/{global → lib}/A-Dependency/A-Dependency.error.ts +1 -1
  58. package/src/{global → lib}/A-Dependency/A-Dependency.types.ts +9 -9
  59. package/src/lib/A-Dependency/index.ts +17 -0
  60. package/src/{global → lib}/A-Entity/A-Entity.class.ts +11 -9
  61. package/src/{global → lib}/A-Entity/A-Entity.error.ts +1 -1
  62. package/src/{global → lib}/A-Entity/A-Entity.meta.ts +3 -3
  63. package/src/{global → lib}/A-Entity/A-Entity.types.ts +5 -5
  64. package/src/lib/A-Entity/index.ts +5 -0
  65. package/src/{global → lib}/A-Error/A_Error.class.ts +13 -13
  66. package/src/{global → lib}/A-Error/A_Error.types.ts +2 -2
  67. package/src/lib/A-Error/index.ts +3 -0
  68. package/src/{global → lib}/A-Feature/A-Feature-Define.decorator.ts +16 -10
  69. package/src/{global → lib}/A-Feature/A-Feature-Extend.decorator.ts +13 -9
  70. package/src/{global → lib}/A-Feature/A-Feature.class.ts +15 -13
  71. package/src/{global → lib}/A-Feature/A-Feature.error.ts +2 -2
  72. package/src/{global → lib}/A-Feature/A-Feature.types.ts +21 -12
  73. package/src/lib/A-Feature/index.ts +13 -0
  74. package/src/{global → lib}/A-Fragment/A-Fragment.class.ts +0 -2
  75. package/src/{global → lib}/A-Fragment/A-Fragment.types.ts +1 -1
  76. package/src/lib/A-Fragment/index.ts +5 -0
  77. package/src/{global → lib}/A-Inject/A-Inject.decorator.ts +42 -24
  78. package/src/{global → lib}/A-Inject/A-Inject.error.ts +1 -1
  79. package/src/{global → lib}/A-Inject/A-Inject.types.ts +3 -9
  80. package/src/lib/A-Inject/index.ts +3 -0
  81. package/src/{global → lib}/A-Meta/A-Meta.decorator.ts +2 -2
  82. package/src/{global → lib}/A-Meta/A-Meta.types.ts +18 -10
  83. package/src/lib/A-Meta/index.ts +11 -0
  84. package/src/{global → lib}/A-Scope/A-Scope.class.ts +34 -24
  85. package/src/{global → lib}/A-Scope/A-Scope.error.ts +1 -1
  86. package/src/{global → lib}/A-Scope/A-Scope.types.ts +22 -14
  87. package/src/lib/A-Scope/index.ts +5 -0
  88. package/src/{global → lib}/A-Stage/A-Stage.class.ts +9 -10
  89. package/src/{global → lib}/A-Stage/A-Stage.error.ts +1 -1
  90. package/src/{global → lib}/A-Stage/A-Stage.types.ts +1 -4
  91. package/src/lib/A-Stage/index.ts +5 -0
  92. package/src/{global → lib}/A-StepManager/A-StepManager.class.ts +8 -4
  93. package/src/{global → lib}/A-StepManager/A-StepManager.error.ts +1 -1
  94. package/src/lib/A-StepManager/index.ts +4 -0
  95. package/src/{global → lib}/ASEID/ASEID.class.ts +20 -23
  96. package/src/lib/ASEID/ASEID.error.ts +12 -0
  97. package/src/lib/ASEID/index.ts +4 -0
  98. package/src/types/A_identity.types.ts +4 -0
  99. package/src/types/index.ts +2 -0
  100. package/tests/A-Abstraction.test.ts +6 -6
  101. package/tests/A-Common.test.ts +6 -4
  102. package/tests/A-Component.test.ts +7 -5
  103. package/tests/A-Concept.test.ts +13 -11
  104. package/tests/A-Container.test.ts +4 -3
  105. package/tests/A-Dependency.test.ts +6 -1
  106. package/tests/A-Entity.test.ts +7 -5
  107. package/tests/A-Error.test.ts +7 -4
  108. package/tests/A-Feature.test.ts +12 -8
  109. package/tests/A-Fragment.test.ts +1 -2
  110. package/tests/A-Inject.test.ts +4 -1
  111. package/tests/A-Meta.test.ts +12 -10
  112. package/tests/A-Scope.test.ts +11 -10
  113. package/tests/A-StepManager.test.ts +3 -3
  114. package/tests/ASEID.test.ts +2 -2
  115. package/tests/jest.setup.ts +23 -23
  116. package/tsconfig.json +59 -97
  117. package/tsup.config.ts +25 -13
  118. package/dist/browser/A-Context.types-BtR_HJ0j.d.mts +0 -3828
  119. package/dist/browser/env.d.mts +0 -64
  120. package/dist/browser/env.mjs +0 -3
  121. package/dist/browser/env.mjs.map +0 -1
  122. package/dist/node/A-Context.types-BtR_HJ0j.d.mts +0 -3828
  123. package/dist/node/A-Context.types-BtR_HJ0j.d.ts +0 -3828
  124. package/dist/node/env.d.mts +0 -91
  125. package/dist/node/env.d.ts +0 -91
  126. package/dist/node/env.js +0 -12
  127. package/dist/node/env.js.map +0 -1
  128. package/dist/node/env.mjs +0 -3
  129. package/dist/node/env.mjs.map +0 -1
  130. package/dist/node/index.js +0 -387
  131. package/dist/node/index.js.map +0 -1
  132. package/src/global/A-Context/A-Context.types.ts +0 -14
  133. package/src/global/ASEID/ASEID.error.ts +0 -12
  134. /package/src/{global → lib}/A-Component/A-Component.constants.ts +0 -0
  135. /package/src/{global → lib}/A-Concept/A-Concept.constants.ts +0 -0
  136. /package/src/{global → lib}/A-Container/A-Container.constants.ts +0 -0
  137. /package/src/{global → lib}/A-Entity/A-Entity.constants.ts +0 -0
  138. /package/src/{global → lib}/A-Error/A_Error.constants.ts +0 -0
  139. /package/src/{global → lib}/A-Meta/A-Meta.class.ts +0 -0
  140. /package/src/{global → lib}/ASEID/ASEID.constants.ts +0 -0
  141. /package/src/{global → lib}/ASEID/ASEID.types.ts +0 -0
@@ -1,3828 +0,0 @@
1
- type Decrement = [never, 0, 1, 2, 3, 4, 5];
2
- type A_TYPES__Ctor<T> = new (...args: any[]) => T;
3
- type A_TYPES__DeepPartial<T, D extends number = 5> = {
4
- [P in keyof Required<T>]?: [
5
- D
6
- ] extends [never] ? any : Required<T>[P] extends Array<infer U> ? Array<A_TYPES__DeepPartial<U, Decrement[D]>> : Required<T>[P] extends Function ? Required<T>[P] : Required<T>[P] extends object ? A_TYPES__DeepPartial<T[P], Decrement[D]> : T[P];
7
- };
8
- type A_TYPES__ObjectKeyEnum<T, E> = {
9
- [P in keyof Required<T>]?: T[P] extends object ? A_TYPES__ObjectKeyEnum<T[P], E> : E;
10
- };
11
- type A_TYPES__Dictionary<T> = {
12
- [Key: string]: T;
13
- };
14
- type A_TYPES__NonObjectPaths<T> = T extends object ? {
15
- [K in keyof T]: `${Exclude<K, symbol>}${""}`;
16
- }[keyof T] : never;
17
- type A_TYPES__Paths<T, D extends number = 5> = [D] extends [never] ? never : (T extends object ? {
18
- [K in keyof T]: `${Exclude<K, symbol>}${"" | `.${A_TYPES__Paths<T[K], Decrement[D]>}`}`;
19
- }[keyof T] : never);
20
- type A_TYPES__UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
21
- type A_TYPES__PathsToObject<_Obj, T extends readonly string[]> = A_TYPES__UnionToIntersection<{
22
- [K in keyof T]: T[K] extends `${infer Key}.${infer Rest}` ? {
23
- [P in Key]: P extends keyof _Obj ? A_TYPES__PathsToObject<Required<_Obj>[P], [Rest]> : any;
24
- } : {
25
- [P in T[K]]: `${T[K]}` extends keyof Required<_Obj> ? Required<_Obj>[`${T[K]}`] : never;
26
- };
27
- }[number]>;
28
- type A_TYPES__Required<T, arr extends (A_TYPES__Paths<T>)[] = (A_TYPES__Paths<T>)[]> = A_TYPES__PathsToObject<T, arr> & T;
29
- type A_TYPES__ExtractNested<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? {
30
- [Key in K]: A_TYPES__ExtractNested<T[K], Rest>;
31
- } : never : P extends keyof T ? {
32
- [Key in P]: T[P];
33
- } : never;
34
- type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__UnionToIntersection<{
35
- [K in keyof P]: P[K] extends string ? A_TYPES__ExtractNested<T, P[K]> : never;
36
- }[number]>;
37
-
38
- /**
39
- * Fragment constructor type
40
- * Uses the generic type T to specify the type of the fragment
41
- */
42
- type A_TYPES__Fragment_Constructor<T = A_Fragment> = A_TYPES__Ctor<T>;
43
- /**
44
- * Fragment initialization type
45
- */
46
- type A_TYPES__Fragment_Init = {
47
- name: string;
48
- };
49
- /**
50
- * Fragment serialized type
51
- */
52
- type A_TYPES__Fragment_Serialized = {
53
- /**
54
- * The Name of the fragment
55
- */
56
- name: string;
57
- };
58
-
59
- /**
60
- * A_Fragment is a core architectural component that represents a singleton execution context
61
- * within the A-Concept framework. It serves as a shared memory container that can be passed
62
- * between Components, Entities, and Commands throughout the application pipeline.
63
- *
64
- * Key Features:
65
- * - Singleton pattern: Only one instance per fragment type per scope
66
- * - Meta storage: Built-in key-value storage for pipeline data
67
- * - Type-safe: Full TypeScript generics support for meta items and serialization
68
- * - Serializable: Can be converted to JSON for persistence or transmission
69
- *
70
- * @template _MetaItems - Type definition for the meta storage structure
71
- * @template _SerializedType - Type definition for the serialized output format
72
- *
73
- * @example
74
- * ```typescript
75
- * // Basic usage with typed meta
76
- * class UserFragment extends A_Fragment<{ userId: string; role: string }> {
77
- * constructor() {
78
- * super({ name: 'UserFragment' });
79
- * }
80
- * }
81
- *
82
- * // Custom serialization
83
- * class SessionFragment extends A_Fragment<
84
- * { sessionId: string; timestamp: number },
85
- * { name: string; sessionData: string }
86
- * > {
87
- * toJSON() {
88
- * return {
89
- * name: this.name,
90
- * sessionData: `${this.get('sessionId')}-${this.get('timestamp')}`
91
- * };
92
- * }
93
- * }
94
- * ```
95
- */
96
- declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
97
- /**
98
- * The unique identifier/name for this fragment instance.
99
- * Used for identification and debugging purposes.
100
- */
101
- protected _name: string;
102
- /**
103
- * Creates a new A_Fragment instance.
104
- *
105
- * A_Fragment implements the singleton pattern for execution contexts, allowing
106
- * shared state management across different parts of the application pipeline.
107
- * Each fragment serves as a memory container that can store typed data and be
108
- * serialized for persistence or transmission.
109
- *
110
- * Key Benefits:
111
- * - Centralized state management for related operations
112
- * - Type-safe meta operations with full IntelliSense support
113
- * - Serialization support for data persistence
114
- * - Singleton pattern ensures consistent state within scope
115
- *
116
- * @param params - Initialization parameters
117
- * @param params.name - Optional custom name for the fragment (defaults to class name)
118
- *
119
- * @example
120
- * ```typescript
121
- * const fragment = new A_Fragment<{ userId: string }>({
122
- * name: 'UserSessionFragment'
123
- * });
124
- * fragment.set('userId', '12345');
125
- * ```
126
- */
127
- constructor(params?: Partial<A_TYPES__Fragment_Init>);
128
- /**
129
- * Gets the fragment's unique name/identifier.
130
- *
131
- * @returns The fragment name
132
- */
133
- get name(): string;
134
- /**
135
- * Serializes the fragment to a JSON-compatible object.
136
- *
137
- * This method combines the fragment's name with all meta data to create
138
- * a serializable representation. The return type is determined by the
139
- * _SerializedType generic parameter, allowing for custom serialization formats.
140
- *
141
- * @returns A serialized representation of the fragment
142
- *
143
- * @example
144
- * ```typescript
145
- * const fragment = new A_Fragment<{ userId: string, role: string }>({
146
- * name: 'UserFragment'
147
- * });
148
- * fragment.set('userId', '12345');
149
- * fragment.set('role', 'admin');
150
- *
151
- * const json = fragment.toJSON();
152
- * // Result: { name: 'UserFragment', userId: '12345', role: 'admin' }
153
- * ```
154
- */
155
- toJSON(): _SerializedType;
156
- }
157
-
158
- declare class A_Container {
159
- /**
160
- * Configuration of the container that will be used to run it.
161
- */
162
- protected readonly config: Partial<A_TYPES__Container_Init>;
163
- /**
164
- * Name of the container
165
- */
166
- get name(): string;
167
- /**
168
- * Returns the scope where the container is registered
169
- */
170
- get scope(): A_Scope;
171
- /**
172
- * This class should combine Components to achieve the goal withing Concept
173
- *
174
- * Container is a direct container that should be "run" to make Concept work.
175
- * So because of that Container can be:
176
- * - HTTP Server
177
- * - BASH Script
178
- * - Database Connection
179
- * - Microservice
180
- * - etc.
181
- *
182
- * @param config - Configuration of the container that will be used to run it.
183
- */
184
- constructor(
185
- /**
186
- * Configuration of the container that will be used to run it.
187
- */
188
- config?: Partial<A_TYPES__Container_Init>);
189
- /**
190
- * Calls the feature with the given name in the given scope
191
- *
192
- * [!] Note: This method creates a new instance of the feature every time it is called
193
- *
194
- * @param feature - the name of the feature to call
195
- * @param scope - the scope in which to call the feature
196
- * @returns - void
197
- */
198
- call(
199
- /**
200
- * Name of the feature to call
201
- */
202
- feature: string,
203
- /**
204
- * scope in which the feature will be executed
205
- */
206
- scope?: A_Scope): Promise<void>;
207
- }
208
-
209
- declare enum A_TYPES__ConceptAbstractions {
210
- /**
211
- * Run the concept.
212
- */
213
- Run = "run",
214
- /**
215
- * Build the concept.
216
- */
217
- Build = "build",
218
- /**
219
- * Publish the concept.
220
- */
221
- Publish = "publish",
222
- /**
223
- * Deploy the concept.
224
- */
225
- Deploy = "deploy",
226
- /**
227
- * Load the concept.
228
- */
229
- Load = "load",
230
- /**
231
- * Start the concept.
232
- */
233
- Start = "start",
234
- /**
235
- * Stop the concept.
236
- */
237
- Stop = "stop"
238
- }
239
- declare enum A_TYPES__ConceptMetaKey {
240
- LIFECYCLE = "a-component-extensions"
241
- }
242
-
243
- /**
244
- * This is a common class that uses to return an entity that initiates a feature call
245
- *
246
- * It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
247
- *
248
- * [!] the class itself may be retrieved, but may require additional processing inside the feature
249
- *
250
- */
251
- declare class A_Caller<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
252
- /**
253
- * The component that initiated the feature call
254
- */
255
- protected _component: T;
256
- /**
257
- * A_Caller allows to get the component that initiated the feature call
258
- *
259
- * It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
260
- *
261
- * [!] If Scope is not provided, a new empty scope will be created and inherited from the global scope
262
- *
263
- * @param component
264
- * @param scope
265
- */
266
- constructor(component: T);
267
- get component(): T;
268
- /**
269
- * Validates the provided parameters and Ensures that the component is of an allowed type
270
- *
271
- * @param component
272
- */
273
- protected validateParams(component: T): void;
274
- }
275
-
276
- /**
277
- * Entity constructor type
278
- * Uses the generic type T to specify the type of the entity
279
- */
280
- type A_TYPES__Error_Constructor<T = A_Error> = A_TYPES__Ctor<T>;
281
- /**
282
- * Error initialization type
283
- */
284
- type A_TYPES__Error_Init = {
285
- /**
286
- * Error title
287
- *
288
- * A short description of the error
289
- */
290
- title: string;
291
- /**
292
- * Error code representing the type of error
293
- *
294
- * Should be unique within the application or service
295
- *
296
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
297
- *
298
- * [!] Note: It is recommended to use kebab-case for error codes
299
- * [!] Note: If not provided would be used a kebab-case message of the error
300
- */
301
- code?: string;
302
- /**
303
- * Possible Scope if needed to identify the error by it's execution environment
304
- *
305
- * For example, error of type 'validation' could happen in different scopes
306
- * like 'user', 'admin', 'system' etc. This will help to identify the error context better
307
- *
308
- * Could be string or A_Scope instance
309
- *
310
- * [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
311
- */
312
- scope?: string | A_Scope;
313
- /**
314
- * Detailed description of the error
315
- */
316
- description?: string;
317
- /**
318
- * Link to the documentation or support page for the error
319
- */
320
- link?: string;
321
- /**
322
- * Original Error if any
323
- */
324
- originalError?: Error | unknown;
325
- };
326
- /**
327
- * Error serialized type
328
- */
329
- type A_TYPES__Error_Serialized = {
330
- /**
331
- * ASEID of the error
332
- */
333
- aseid: string;
334
- /**
335
- * A brief title of the error
336
- */
337
- title: string;
338
- /**
339
- * Error message
340
- */
341
- message: string;
342
- /**
343
- * Type of the error
344
- */
345
- type: string;
346
- /**
347
- * Error code
348
- */
349
- code: string;
350
- /**
351
- * Error description
352
- */
353
- description: string;
354
- /**
355
- * Link to documentation or support page
356
- */
357
- link?: string;
358
- /**
359
- * Scope of the error
360
- */
361
- scope: string;
362
- /**
363
- * Original error message if any
364
- */
365
- originalError?: string;
366
- };
367
-
368
- interface A_TYPES__ASEID_Constructor {
369
- /**
370
- * Concept for the ASEID
371
- * Generally it is the application name or code, should correspond to the concept where the entity is used
372
- * Could be ID or ASEID
373
- */
374
- concept?: string;
375
- /**
376
- * Entity Scope the primary location of the resource
377
- * Organization, or organization Unit or Internal/External
378
- * Could be ID or ASEID
379
- *
380
- */
381
- scope: number | string;
382
- /**
383
- * Entity Type the type of the resource
384
- */
385
- entity: string;
386
- /**
387
- * Entity ID the unique identifier of the resource
388
- */
389
- id: number | string;
390
- /**
391
- * Version of the entity (optional)
392
- */
393
- version?: string;
394
- /**
395
- * Shard of the entity (optional)
396
- */
397
- shard?: string;
398
- }
399
- interface A_TYPES__ASEID_ConstructorConfig {
400
- /**
401
- * If true, the entity ASEID will be distributed across multiple shards.
402
- * In this case SHARD should be provided via Environment Variables (A_SHARD) or Configurations
403
- *
404
- */
405
- sharding?: boolean;
406
- }
407
- type A_TYPES__ASEID_JSON = {
408
- /**
409
- * Concept for the ASEID
410
- */
411
- concept: string;
412
- /**
413
- * Entity Scope the primary location of the resource
414
- */
415
- scope: string;
416
- /**
417
- * Entity Type the type of the resource
418
- */
419
- entity: string;
420
- /**
421
- * Entity ID the unique identifier of the resource
422
- */
423
- id: string;
424
- /**
425
- * Version of the entity (optional)
426
- */
427
- version?: string;
428
- /**
429
- * Shard of the entity (optional)
430
- */
431
- shard?: string;
432
- };
433
-
434
- declare class ASEID {
435
- /**
436
- * ASEID Regular Expression
437
- */
438
- static readonly regexp: RegExp;
439
- /**
440
- * Tests if the identity string is an ASEID
441
- *
442
- * @param identity
443
- * @returns
444
- */
445
- static isASEID(identity: string): boolean;
446
- static compare(aseid1: ASEID | string | undefined, aseid2: ASEID | string | undefined): boolean;
447
- /**
448
- * Concept for the ASEID
449
- * Generally it is the application name or code, should correspond to the concept where the entity is used
450
- * Could be ID or ASEID
451
- */
452
- private _concept;
453
- /**
454
- * Entity Scope the primary location of the resource
455
- * Organization, or organization Unit
456
- * Could be ID or ASEID
457
- *
458
- */
459
- private _scope;
460
- /**
461
- * Entity Type the type of the resource
462
- */
463
- private _entity;
464
- /**
465
- * Entity ID the unique identifier of the resource
466
- */
467
- private _id;
468
- /**
469
- * Version of the entity (optional)
470
- */
471
- private _version?;
472
- /**
473
- * Shard of the entity (optional)
474
- */
475
- private _shard?;
476
- /**
477
- * ASEID is a structured identifier for entities in the A-Concept system.
478
- * using the format:
479
- * A - A-Concept
480
- * S - System
481
- * E - Entity
482
- * I - Identifier
483
- * D - iDentifier
484
- *
485
- * Structure: CONCEPT_NAME + @ + SCOPE + : ENTITY_NAME + : + ID + @ + VERSION
486
- *
487
- * Example:
488
- * - root@core:usr:0000000001
489
- *
490
- * [!] Concept is optional, if not provided will be used the current concept name
491
- * [!] Scope is optional, if not provided will be used the root scope of the current concept
492
- * [!] Version is optional, if not provided will be considered as latest version
493
- *
494
- * @param aseid - ASEID string representation or ASEID components as object
495
- */
496
- constructor(
497
- /**
498
- * ASEID string representation
499
- */
500
- aseid: string);
501
- constructor(
502
- /**
503
- * ASEID components as object
504
- */
505
- props: A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>);
506
- /**
507
- * Getters for ASEID components
508
- */
509
- get concept(): string;
510
- /**
511
- * Get the scope of the ASEID
512
- */
513
- get scope(): string;
514
- /**
515
- * Get the entity of the ASEID
516
- */
517
- get entity(): string;
518
- /**
519
- * Get the id of the ASEID
520
- */
521
- get id(): string;
522
- /**
523
- * Get the version of the ASEID (if any)
524
- */
525
- get version(): string | undefined;
526
- /**
527
- * Get the shard of the ASEID (if any)
528
- */
529
- get shard(): string | undefined;
530
- /**
531
- * Get the hash of the ASEID, Unique identifier based on the ASEID string
532
- * Useful when aseid details should not be exposed directly
533
- */
534
- get hash(): string;
535
- /**
536
- * get Internal Initializer based on the type of the parameter provided
537
- *
538
- * @param param1
539
- * @returns
540
- */
541
- private getInitializer;
542
- /**
543
- * Initialize ASEID from string
544
- *
545
- * @param param1
546
- */
547
- private fromString;
548
- /**
549
- * Initialize ASEID from object
550
- *
551
- * @param param1
552
- */
553
- private fromObject;
554
- /**
555
- * String representation of the ASEID
556
- *
557
- * @returns
558
- */
559
- toString(): string;
560
- /**
561
- * JSON representation of the ASEID
562
- *
563
- * @returns
564
- */
565
- toJSON(): A_TYPES__ASEID_JSON;
566
- protected verifyInput(param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>): void;
567
- }
568
-
569
- 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 {
570
- /**
571
- * Error Identifier that corresponds to the class name
572
- */
573
- static get entity(): string;
574
- /**
575
- * DEFAULT Namespace of the error from environment variable A_CONCEPT_NAMESPACE
576
- *
577
- * [!] If environment variable is not set, it will default to 'a-concept'
578
- */
579
- static get concept(): string;
580
- /**
581
- * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
582
- *
583
- * [!] If environment variable is not set, it will default to 'core'
584
- * [!] Scope is an application specific identifier that can be used to group entities together
585
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
586
- */
587
- static get scope(): string;
588
- /**
589
- * ASEID of the error instance
590
- */
591
- protected _aseid: ASEID;
592
- /**
593
- * Title of the error
594
- */
595
- protected _title: string;
596
- /**
597
- * Possible Scope if needed to identify the error by it's execution environment
598
- */
599
- protected _scope?: string;
600
- /**
601
- * Unique code representing the type of error
602
- */
603
- protected _code?: string;
604
- /**
605
- * Detailed description of the error
606
- */
607
- protected _description?: string;
608
- /**
609
- * Original Error if any
610
- */
611
- protected _originalError?: Error | any;
612
- /**
613
- * Link to the documentation or support page for the error
614
- */
615
- protected _link?: string;
616
- /**
617
- * A_Error is a custom error class for A_Concept framework.
618
- * This error allows to have more structured error handling.
619
- * Each error has a unique code, description and a link to the documentation.
620
- *
621
- * Example of usage:
622
- * ```typescript
623
- *
624
- * // 1) all parameters will be used as provided
625
- * throw new A_Error({
626
- * message: 'User not found',
627
- * code: 'USER_NOT_FOUND',
628
- * description: 'The user with the given ID was not found.',
629
- * link: 'https://support.adaas.org/error/USER_NOT_FOUND'
630
- * });
631
- *
632
- * // or
633
- * // 2) only message is provided, other parameters will be set to default values:
634
- * // - code: 'user-not-found' (kebab-case of the message)
635
- * // - description: 'User not found' (same as message)
636
- * // - link: Empty
637
- * throw new A_Error('User not found');
638
- *
639
- * // or
640
- * // 3) Provided Message and Description, other parameters will be set to default values:
641
- * // - code: 'user-not-found' (kebab-case of the message)
642
- * // - description: 'The user with the given ID was not found.' (as provided)
643
- * // - link: Empty
644
- * throw new A_Error('User not found', 'The user with the given ID was not found.');
645
- *
646
- *
647
- * ```
648
- * [!] Note: The behavior of A_Error is similar to the A_Entity however it cannot have own A_Features.
649
- * [!] Note: This class can be inherited to create custom error classes.
650
- *
651
- * @param message
652
- */
653
- constructor(
654
- /**
655
- * A_Error Constructor params
656
- */
657
- params: _ConstructorType);
658
- constructor(
659
- /**
660
- * Error message
661
- */
662
- message: string);
663
- constructor(
664
- /**
665
- * Original JS Error
666
- */
667
- error: Error);
668
- constructor(
669
- /**
670
- * Original JS Error
671
- */
672
- error: unknown);
673
- constructor(
674
- /**
675
- * Error message
676
- */
677
- title: string,
678
- /**
679
- * Detailed description of the error
680
- */
681
- description: string);
682
- /**
683
- * Returns the ASEID of the error instance
684
- */
685
- get aseid(): ASEID;
686
- /**
687
- * Returns the title of the error
688
- *
689
- * Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
690
- *
691
- * [!] Note: This title should be short and concise, less than 60 characters
692
- * [!] Note: If title exceeds 60 characters, there would be an error thrown
693
- * [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
694
- */
695
- get title(): string;
696
- /**
697
- * Returns an Error message what is a brief title of the error
698
- *
699
- */
700
- get message(): string;
701
- /**
702
- * Returns a unique code representing the type of error
703
- *
704
- * If code is not provided, it will generate a kebab-case of the message
705
- *
706
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
707
- *
708
- * [!] Note: It is recommended to use kebab-case for error codes
709
- * [!] Note: If not provided would be used a kebab-case message of the error
710
- */
711
- get code(): string;
712
- /**
713
- * Returns the type of the error which corresponds to the static entity of the class
714
- *
715
- * Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
716
- *
717
- * Defaults to the kebab-case of the class name
718
- *
719
- * [!] Note: naming ad separation are fully dependent on the architecture of the application
720
- * [!] Note: It is recommended to use kebab-case for error types
721
- * [!] Note: This type is intended to group similar errors together
722
- */
723
- get type(): string;
724
- /**
725
- * Returns a link with possible documentation or support page for the error
726
- * 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
727
- *
728
- * Example: https://adaas.support/a-concept/errors/{ASEID}
729
- *
730
- * [!] Note: ASEID is generated based on the static properties of the class (concept, scope, entity) and the code of the error
731
- */
732
- get link(): string;
733
- /**
734
- * The scope name of the error instance
735
- *
736
- * If scope is not provided, it will use the static scope of the class
737
- *
738
- * [!] Note: Scope is an application specific identifier that can be used to group entities together
739
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
740
- */
741
- get scope(): string;
742
- /**
743
- * A detailed description of the error
744
- * If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
745
- *
746
- * 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.
747
- *
748
- * [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
749
- */
750
- get description(): string;
751
- /**
752
- * Returns the original error if any
753
- *
754
- * This can be useful for debugging purposes to see the original stack trace or error message
755
- *
756
- * [!] Note: Original error is optional and may not be present in all cases
757
- */
758
- get originalError(): Error | any | undefined;
759
- /**
760
- * Determines which initializer method to use based on the type of the first parameter.
761
- *
762
- * @param param1
763
- * @returns
764
- */
765
- protected getInitializer(param1: _ConstructorType | Error | string | any, param2?: string): (param1: any, param2: any) => void | (() => void);
766
- /**
767
- * Initializes the A_Error instance from a standard Error object.
768
- *
769
- * @param error
770
- */
771
- protected fromError(error: Error): void;
772
- /**
773
- * Initializes the A_Error instance from a message.
774
- *
775
- * @param title
776
- * @param description
777
- */
778
- protected fromMessage(message: string): void;
779
- /**
780
- * Initializes the A_Error instance from a serialized object.
781
- *
782
- * @param serialized
783
- */
784
- protected fromJSON(serialized: _SerializedType): void;
785
- fromTitle(title: string, description: string): void;
786
- /**
787
- * Initializes the A_Error instance from a constructor parameters object.
788
- *
789
- * @param params
790
- */
791
- protected fromConstructor(params: _ConstructorType): void;
792
- /**
793
- * Serializes the A_Error instance to a plain object.
794
- *
795
- *
796
- * @returns
797
- */
798
- toJSON(): _SerializedType;
799
- /**
800
- * Checks if the provided title exceeds 60 characters.
801
- * If it does, throws a validation A_Error.
802
- *
803
- * @param title
804
- */
805
- protected validateTitle(title: string): void;
806
- }
807
-
808
- /**
809
- * A-Feature decorator
810
- *
811
- * This decorator allows to define a custom lifecycle stage for the Container.
812
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
813
- * This approach allows to create a flexible and extendable architecture for the application.
814
- *
815
- * The main difference between the A-Feature and A-Feature decorators is that A-Feature methods can be inherited and overridden by child classes.
816
- *
817
- *
818
- * @param params
819
- * @returns
820
- */
821
- declare function A_Feature_Define(config?: Partial<A_TYPES__FeatureDefineDecoratorConfig>): (target: A_TYPES__FeatureDefineDecoratorTarget, propertyKey: string, descriptor: A_TYPES__FeatureDefineDecoratorDescriptor) => A_TYPES__FeatureDefineDecoratorDescriptor;
822
-
823
- /**
824
- * A-Extend decorator
825
- *
826
- * This decorator allows to define a custom Extend stage for the Container.
827
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
828
- * This approach allows to create a flexible and extendable architecture for the application.
829
- *
830
- * The main difference between the A-Extend and A-Extend decorators is that A-Extend methods can be inherited and overridden by child classes.
831
- *
832
- *
833
- * @param params
834
- * @returns
835
- */
836
- /**
837
- * Use regexp in case if you need more flexibility and control over the name of the method
838
- *
839
- * @param regexp
840
- */
841
- declare function A_Feature_Extend(
842
- /**
843
- * The regular expression to match the name of the Feature method to be extended
844
- *
845
- * Example:
846
- *
847
- * ```ts
848
- * @A_Feature.Extend(/.*\.load/)
849
- * ```
850
- */
851
- regexp: RegExp): any;
852
- /**
853
- * In this case the name configurations will be used as an input to get scope and name of target function
854
- * [!] Not that for all SCOPE will be used OR operator
855
- *
856
- * @param config
857
- */
858
- declare function A_Feature_Extend(
859
- /**
860
- * Configuration for the A-Feature-Extend decorator
861
- */
862
- config: Partial<A_TYPES__FeatureExtendDecoratorConfig>): any;
863
- /**
864
- * In this case the name of function will be used as a name of the Feature.
865
- * [!] AND it will be applicable for ANY element where the name is the same as the name of the function
866
- */
867
- declare function A_Feature_Extend(): any;
868
-
869
- declare class A_Stage {
870
- /**
871
- * The feature that owns this stage
872
- */
873
- private readonly _feature;
874
- /**
875
- * Initial Instructions to process the stage
876
- */
877
- private readonly _definition;
878
- /**
879
- * Possible errors during stage processing
880
- */
881
- private _error?;
882
- /**
883
- * Indicates the current status of the stage
884
- */
885
- private _status;
886
- /**
887
- * A_Stage is a callable A_Function within A_Feature that should be run with specific parameters.
888
- * [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
889
- *
890
- * A-Stage is a common object that uses to simplify logic and re-use of A-Feature internals for better composition.
891
- */
892
- constructor(
893
- /**
894
- * The feature that owns this stage
895
- */
896
- feature: A_Feature,
897
- /**
898
- * The step definitions of the stage
899
- */
900
- step: A_TYPES__A_StageStep);
901
- /**
902
- * Returns the name of the stage
903
- */
904
- get name(): string;
905
- /**
906
- * Returns the definition of the stage
907
- */
908
- get definition(): A_TYPES__A_StageStep;
909
- /**
910
- * Returns the current status of the stage
911
- */
912
- get status(): A_TYPES__A_Stage_Status;
913
- /**
914
- * Returns the feature that owns this stage
915
- */
916
- get feature(): A_Feature;
917
- /**
918
- * Returns true if the stage is processed (completed, failed, or skipped)
919
- */
920
- get isProcessed(): boolean;
921
- /**
922
- * Returns the error of the stage
923
- */
924
- get error(): A_Error | undefined;
925
- /**
926
- * Resolves the arguments of the step
927
- *
928
- * @param step
929
- * @returns
930
- */
931
- protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): (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)[];
932
- /**
933
- * Resolves the component of the step
934
- *
935
- * @param step
936
- * @returns
937
- */
938
- protected getStepComponent(scope: A_Scope, step: A_TYPES__A_StageStep): A_TYPES__A_DependencyInjectable;
939
- /**
940
- * Calls the handler of the step
941
- *
942
- * @param step
943
- * @returns
944
- */
945
- protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): {
946
- handler: Function;
947
- params: any[];
948
- };
949
- skip(): void;
950
- /**
951
- * This method processes the stage by executing all the steps
952
- *
953
- * @param scope - Scope to be used to resolve the steps dependencies
954
- */
955
- process(
956
- /**
957
- * Scope to be used to resolve the steps dependencies
958
- */
959
- scope?: A_Scope): Promise<void> | void;
960
- protected completed(): void;
961
- protected failed(error: Error | A_Error | any): void;
962
- /**
963
- * Serializes the stage to JSON
964
- *
965
- */
966
- toJSON(): A_TYPES__Stage_Serialized;
967
- /**
968
- * Returns a string representation of the stage
969
- *
970
- * @returns
971
- */
972
- toString(): string;
973
- }
974
-
975
- declare class A_StepsManager {
976
- entities: A_TYPES__A_StageStep[];
977
- graph: Map<string, Set<string>>;
978
- visited: Set<string>;
979
- tempMark: Set<string>;
980
- sortedEntities: string[];
981
- private _isBuilt;
982
- constructor(entities: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>);
983
- private prepareSteps;
984
- private ID;
985
- private buildGraph;
986
- private matchEntities;
987
- private visit;
988
- toSortedArray(): Array<string>;
989
- toStages(feature: A_Feature): Array<A_Stage>;
990
- }
991
-
992
- declare class A_StageError extends A_Error {
993
- static readonly ArgumentsResolutionError = "A-Stage Arguments Resolution Error";
994
- static get CompileError(): string;
995
- }
996
-
997
- declare class A_FeatureError extends A_Error<A_TYPES__FeatureError_Init> {
998
- /**
999
- * Indicates that the Feature has been interrupted
1000
- */
1001
- static readonly Interruption = "Feature Interrupted";
1002
- /**
1003
- * Indicates that there was an error initializing the Feature
1004
- *
1005
- * Failed during the A-Feature initialization process
1006
- */
1007
- static readonly FeatureInitializationError = "Unable to initialize A-Feature";
1008
- /**
1009
- * Indicates that there was an error processing the Feature
1010
- *
1011
- * Failed during the A-Feature processing
1012
- */
1013
- static readonly FeatureProcessingError = "Error occurred during A-Feature processing";
1014
- /**
1015
- * Indicates that there was an error defining the Feature
1016
- *
1017
- * Failed during the @A_Feature.Define() decorator execution
1018
- */
1019
- static readonly FeatureDefinitionError = "Unable to define A-Feature";
1020
- /**
1021
- * Indicates that there was an error extending the Feature
1022
- *
1023
- * Failed during the @A_Feature.Extend() decorator execution
1024
- */
1025
- static readonly FeatureExtensionError = "Unable to extend A-Feature";
1026
- /**
1027
- * Stage where the error occurred
1028
- */
1029
- stage?: A_Stage;
1030
- protected fromConstructor(params: A_TYPES__FeatureError_Init): void;
1031
- }
1032
-
1033
- /**
1034
- * A_Feature is representing a feature that can be executed across multiple components
1035
- * This class stores the steps of the feature and executes them in order of appearance
1036
- *
1037
- * Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
1038
- * across the different, distributed components
1039
- *
1040
- */
1041
- declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
1042
- /**
1043
- * Define a new A-Feature
1044
- */
1045
- static get Define(): typeof A_Feature_Define;
1046
- /**
1047
- * Extend an existing A-Feature
1048
- */
1049
- static get Extend(): typeof A_Feature_Extend;
1050
- /**
1051
- * The name of the Feature
1052
- */
1053
- protected _name: string;
1054
- /**
1055
- * List of stages that are part of this Feature
1056
- */
1057
- protected _stages: Array<A_Stage>;
1058
- /**
1059
- * The Stage currently being processed
1060
- */
1061
- protected _current?: A_Stage;
1062
- /**
1063
- * Actual Index of the current Stage being processed
1064
- */
1065
- protected _index: number;
1066
- /**
1067
- * Steps Manager to organize the steps into stages
1068
- */
1069
- protected _SM: A_StepsManager;
1070
- /**
1071
- * The Caller that initiated the Feature call
1072
- */
1073
- protected _caller: A_Caller<T>;
1074
- /**
1075
- * The current state of the Feature
1076
- */
1077
- protected _state: A_TYPES__FeatureState;
1078
- /**
1079
- * The error that caused the Feature to be interrupted
1080
- */
1081
- protected _error?: A_FeatureError;
1082
- /**
1083
- * A-Feature is a pipeline distributed by multiple components that can be easily attached or detached from the scope.
1084
- * Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
1085
- *
1086
- * Comparing to A-Command Feature does not store any state except statuses for better analysis.
1087
- *
1088
- * [!] Note: If A-Feature should have result use A-Fragment
1089
- *
1090
- * @param params
1091
- */
1092
- constructor(
1093
- /**
1094
- * Feature Initialization parameters
1095
- */
1096
- params: A_TYPES__Feature_Init<T>);
1097
- /**
1098
- * The name of the Feature
1099
- */
1100
- get name(): string;
1101
- /**
1102
- * The error that caused the Feature to be interrupted
1103
- */
1104
- get error(): A_FeatureError | undefined;
1105
- /**
1106
- * The current state of the Feature
1107
- */
1108
- get state(): A_TYPES__FeatureState;
1109
- /**
1110
- * Sets the current state of the Feature
1111
- */
1112
- get index(): number;
1113
- /**
1114
- * Returns the current A-Feature Stage
1115
- */
1116
- get stage(): A_Stage | undefined;
1117
- /**
1118
- * The Caller that initiated the Feature call
1119
- */
1120
- get caller(): A_Caller<T>;
1121
- /**
1122
- * The Scope allocated for the Feature Execution
1123
- */
1124
- get scope(): A_Scope;
1125
- /**
1126
- * The number of stages in the feature
1127
- */
1128
- get size(): number;
1129
- /**
1130
- * This method checks if the A-Feature is done
1131
- *
1132
- * @returns
1133
- */
1134
- get isDone(): boolean;
1135
- /**
1136
- * Indicates whether the feature has been processed (completed, failed, or interrupted)
1137
- */
1138
- get isProcessed(): boolean;
1139
- /**
1140
- * Iterator to iterate over the steps of the feature
1141
- *
1142
- * @returns
1143
- */
1144
- [Symbol.iterator](): Iterator<A_Stage, any>;
1145
- /**
1146
- * Validates the provided parameters for A-Feature initialization
1147
- *
1148
- * @param params
1149
- */
1150
- protected validateParams(params: A_TYPES__Feature_Init<T>): void;
1151
- /**
1152
- * Returns the appropriate initializer method based on the provided parameters
1153
- *
1154
- * @param params
1155
- * @returns
1156
- */
1157
- protected getInitializer(params: A_TYPES__Feature_Init<T>): (param1: any) => void | (() => void);
1158
- /**
1159
- * Initializes the A-Feature from the provided template
1160
- *
1161
- * @param params
1162
- */
1163
- protected fromTemplate(params: A_TYPES__Feature_InitWithTemplate<T>): void;
1164
- /**
1165
- * Initializes the A-Feature from the provided component
1166
- *
1167
- * @param params
1168
- */
1169
- protected fromComponent(params: A_TYPES__Feature_InitWithComponent<T>): void;
1170
- /**
1171
- * This method processes the feature by executing all the stages
1172
- *
1173
- */
1174
- process(
1175
- /**
1176
- * Optional scope to be used to resolve the steps dependencies
1177
- * If not provided, the scope of the caller component will be used
1178
- */
1179
- scope?: A_Scope): Promise<void> | void;
1180
- /**
1181
- * Process stages one by one, ensuring each stage completes before starting the next
1182
- */
1183
- private processStagesSequentially;
1184
- /**
1185
- * This method moves the feature to the next stage
1186
- *
1187
- * @param stage
1188
- */
1189
- next(stage: any): void;
1190
- /**
1191
- * This method marks the feature as completed and returns the result
1192
- * Uses to interrupt or end the feature processing
1193
- *
1194
- * @param result
1195
- * @returns
1196
- */
1197
- completed(): void;
1198
- /**
1199
- * This method marks the feature as failed and returns the error
1200
- * Uses to mark the feature as failed
1201
- *
1202
- * @param error
1203
- * @returns The error that caused the failure
1204
- */
1205
- failed(error: A_FeatureError): A_FeatureError;
1206
- /**
1207
- * This method marks the feature as interrupted and throws an error
1208
- * Uses to interrupt or end the feature processing
1209
- *
1210
- * @param error
1211
- */
1212
- interrupt(
1213
- /**
1214
- * The reason of feature interruption
1215
- */
1216
- reason?: string | A_StageError | Error): A_FeatureError;
1217
- /**
1218
- * Allows to chain the feature to another feature.
1219
- * In this case the parent feature scope (if new not provided), stages, caller will be used.
1220
- *
1221
- * [!] Note: Chained feature will use the same caller as the parent feature.
1222
- *
1223
- * @param feature
1224
- */
1225
- chain(
1226
- /**
1227
- * A Feature to be chained
1228
- */
1229
- feature: A_Feature,
1230
- /**
1231
- * Optional scope to be used for the chained feature.
1232
- */
1233
- scope?: A_Scope): any;
1234
- chain<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents>(
1235
- /**
1236
- * Component whose feature should be chained
1237
- */
1238
- component: A_TYPES__FeatureAvailableComponents,
1239
- /**
1240
- * A Feature Name to be chained
1241
- */
1242
- feature: string,
1243
- /**
1244
- * Optional scope to be used for the chained feature.
1245
- */
1246
- scope?: A_Scope): any;
1247
- toString(): string;
1248
- }
1249
-
1250
- type A_TYPES__A_DependencyConstructor<T extends A_Dependency> = A_TYPES__Ctor<T>;
1251
- type A_TYPES__A_DependencyInjectable = A_Entity | A_Container | A_Component | A_Fragment | A_Feature | A_Caller | A_Error | A_Scope;
1252
- type A_TYPES__A_DependencyResolutionType<T> = T extends string ? string : T extends A_TYPES__Ctor<infer R> ? R : never;
1253
- type A_TYPES__A_DependencyResolutionStrategy<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1254
- /**
1255
- * If tru will throw an error if the dependency is not found
1256
- */
1257
- require: boolean;
1258
- /**
1259
- * Indicates that dependency should be loaded from a specific path before resolution
1260
- */
1261
- load: boolean;
1262
- /**
1263
- * Number of levels to go up in the parent chain when resolving the dependency
1264
- */
1265
- parent: number;
1266
- /**
1267
- * If true, will only resolve the dependency in the current scope without going up to parent scopes
1268
- */
1269
- flat: boolean;
1270
- /**
1271
- * If has any value indicates that entity should be created with default parameters provided
1272
- */
1273
- create: boolean;
1274
- /**
1275
- * Default constructor arguments to use when creating the dependency
1276
- */
1277
- args: any[];
1278
- /**
1279
- * Allows to query by specific entity properties e.g. ASEID, name, type, custom properties, etc.
1280
- */
1281
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1282
- /**
1283
- * Pagination settings for the entity search
1284
- */
1285
- pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
1286
- };
1287
- type A_TYPES__A_Dependency_Serialized<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1288
- name: string;
1289
- all: boolean;
1290
- require: boolean;
1291
- load: boolean;
1292
- parent: number;
1293
- flat: boolean;
1294
- create: any;
1295
- args: any[];
1296
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1297
- pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
1298
- };
1299
- type A_TYPES__A_Dependency_EntityResolutionConfig<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1300
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1301
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1302
- };
1303
- type A_TYPES__A_Dependency_EntityInjectionQuery<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = T extends A_Entity ? {
1304
- aseid: string;
1305
- } & {
1306
- [key in keyof T]?: any;
1307
- } : never;
1308
- type A_TYPES__A_Dependency_EntityInjectionPagination = {
1309
- count: number;
1310
- from: 'start' | 'end';
1311
- };
1312
- /**
1313
- * A-Dependency require decorator return type
1314
- */
1315
- type A_TYPES__A_Dependency_RequireDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1316
- /**
1317
- * A-Dependency load decorator return type
1318
- */
1319
- type A_TYPES__A_Dependency_LoadDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1320
- /**
1321
- * A-Dependency default decorator return type
1322
- */
1323
- type A_TYPES__A_Dependency_DefaultDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1324
- /**
1325
- * A-Dependency parent decorator return type
1326
- */
1327
- type A_TYPES__A_Dependency_ParentDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1328
- /**
1329
- * A-Dependency flat decorator return type
1330
- */
1331
- type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1332
- /**
1333
- * A-Dependency All decorator return type
1334
- */
1335
- type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1336
-
1337
- /**
1338
- * Should indicate which Default is required
1339
- */
1340
- declare function A_Dependency_Default(
1341
- /**
1342
- * Constructor Parameters that will be used to create the default instance
1343
- */
1344
- ...args: any[]): A_TYPES__A_Dependency_DefaultDecoratorReturn;
1345
-
1346
- /**
1347
- * Should indicate which dependency is required
1348
- */
1349
- declare function A_Dependency_Flat(): A_TYPES__A_Dependency_FlatDecoratorReturn;
1350
-
1351
- /**
1352
- * Should indicate which Load is required
1353
- */
1354
- declare function A_Dependency_Load(): A_TYPES__A_Dependency_LoadDecoratorReturn;
1355
-
1356
- /**
1357
- * Should indicate which dependency is required
1358
- */
1359
- declare function A_Dependency_Parent(
1360
- /**
1361
- * Indicates how many layers up the parent dependency should be resolved from current dependency
1362
- *
1363
- * Default: -1 (one layer up)
1364
- */
1365
- layerOffset?: number): A_TYPES__A_Dependency_ParentDecoratorReturn;
1366
-
1367
- /**
1368
- * Should indicate which dependency is required
1369
- */
1370
- declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorReturn;
1371
-
1372
- /**
1373
- * Should indicate which All is required
1374
- */
1375
- declare function A_Dependency_All(): A_TYPES__A_Dependency_AllDecoratorReturn;
1376
-
1377
- declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> {
1378
- /**
1379
- * Allows to indicate which Injected parameter is required
1380
- *
1381
- * [!] If parameter marked as required is not provided, an error will be thrown
1382
- *
1383
- * @returns
1384
- */
1385
- static get Required(): typeof A_Dependency_Require;
1386
- /**
1387
- * Allows to indicate which dependency should be loaded from a specific path
1388
- *
1389
- * @returns
1390
- */
1391
- static get Loaded(): typeof A_Dependency_Load;
1392
- /**
1393
- * Allows to indicate which dependency default parameters should be used
1394
- *
1395
- * @returns
1396
- */
1397
- static get Default(): typeof A_Dependency_Default;
1398
- /**
1399
- * Allows to indicate which parent dependency should be resolved
1400
- * e.g. from which layer up the parent should be taken
1401
- *
1402
- * @returns
1403
- */
1404
- static get Parent(): typeof A_Dependency_Parent;
1405
- /**
1406
- * Allows to indicate that the dependency should be resolved in a flat manner
1407
- * Only in the same scope, without going up to parent scopes
1408
- *
1409
- * @returns
1410
- */
1411
- static get Flat(): typeof A_Dependency_Flat;
1412
- /**
1413
- * Allows to indicate that all instances of the dependency should be resolved
1414
- *
1415
- * @returns
1416
- */
1417
- static get All(): typeof A_Dependency_All;
1418
- protected _name: string;
1419
- protected _target?: A_TYPES__Ctor<T>;
1420
- protected _resolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
1421
- protected _defaultPagination: A_TYPES__A_DependencyResolutionStrategy['pagination'];
1422
- protected _defaultResolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
1423
- get flat(): boolean;
1424
- get require(): boolean;
1425
- get load(): boolean;
1426
- /**
1427
- * Indicates cases when it's necessary to search across all instances
1428
- */
1429
- get all(): boolean;
1430
- get parent(): number;
1431
- get create(): any;
1432
- get args(): any[];
1433
- get query(): Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1434
- get pagination(): A_TYPES__A_Dependency_EntityInjectionPagination;
1435
- /**
1436
- * Class instances allows to identify dependencies by name and use them for better type checking
1437
- *
1438
- * @param name
1439
- */
1440
- constructor(name: string | A_TYPES__Ctor<T>, resolutionStrategy?: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T>, 'pagination'> & {
1441
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1442
- }>);
1443
- /**
1444
- * Gets the dependency name
1445
- *
1446
- * Can be identifier, url or any string value
1447
- *
1448
- * @returns
1449
- */
1450
- get name(): string;
1451
- /**
1452
- * Returns the original class of the dependency if provided
1453
- *
1454
- */
1455
- get target(): A_TYPES__Ctor<T> | undefined;
1456
- /**
1457
- * Gets the dependency resolution strategy
1458
- */
1459
- get resolutionStrategy(): A_TYPES__A_DependencyResolutionStrategy<T>;
1460
- /**
1461
- * Sets the dependency resolution strategy
1462
- */
1463
- set resolutionStrategy(strategy: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T>, 'pagination'> & {
1464
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1465
- }>);
1466
- /**
1467
- * Method for the parameters check and all input data before usage
1468
- *
1469
- * @returns
1470
- */
1471
- private initCheck;
1472
- /**
1473
- * Serializes the dependency to a JSON object
1474
- *
1475
- * @returns
1476
- */
1477
- toJSON(): A_TYPES__A_Dependency_Serialized<T>;
1478
- }
1479
-
1480
- declare enum A_TYPES__A_Stage_Status {
1481
- /**
1482
- * The stage is currently being processed
1483
- */
1484
- PROCESSING = "PROCESSING",
1485
- /**
1486
- * The stage has been completed
1487
- */
1488
- COMPLETED = "COMPLETED",
1489
- /**
1490
- * The stage has failed
1491
- */
1492
- FAILED = "FAILED",
1493
- /**
1494
- * The stage has been skipped
1495
- */
1496
- SKIPPED = "SKIPPED",
1497
- /**
1498
- * The stage has been paused
1499
- */
1500
- /**
1501
- * The stage has been stopped
1502
- */
1503
- /**
1504
- * The stage has been started
1505
- */
1506
- /**
1507
- * The stage has been initialized
1508
- */
1509
- INITIALIZED = "INITIALIZED",
1510
- /**
1511
- * The stage has been aborted
1512
- */
1513
- ABORTED = "ABORTED"
1514
- }
1515
- type A_TYPES_StageExecutionBehavior = 'async' | 'sync';
1516
- type A_TYPES__A_StageStep = {
1517
- /**
1518
- * The component to be called
1519
- */
1520
- dependency: A_Dependency;
1521
- /**
1522
- * The method to be called on the component
1523
- */
1524
- handler: string;
1525
- /**
1526
- * Original Feature Extension name
1527
- *
1528
- * [!] could be string or regex
1529
- *
1530
- */
1531
- name: string;
1532
- /**
1533
- * In case its async it will be executed independently from the main thread.
1534
- *
1535
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1536
- *
1537
- */
1538
- behavior: A_TYPES_StageExecutionBehavior;
1539
- /**
1540
- * Allows to define the order of the execution of the method.
1541
- *
1542
- * [!] In case the method has circular dependencies it will Throw an error.
1543
- *
1544
- */
1545
- before: string;
1546
- /**
1547
- * Allows to define the order of the execution of the method.
1548
- *
1549
- * [!] In case the method has circular dependencies it will Throw an error.
1550
- *
1551
- */
1552
- after: string;
1553
- /**
1554
- * Indicates whether to throw an error if the step fails.
1555
- *
1556
- * [!] By default is true
1557
- */
1558
- throwOnError: boolean;
1559
- /**
1560
- *
1561
- */
1562
- override: string;
1563
- };
1564
- type A_TYPES__Stage_Serialized = {
1565
- /**
1566
- * The name of the stage
1567
- */
1568
- name: string;
1569
- /**
1570
- * The status of the stage
1571
- *
1572
- */
1573
- status: A_TYPES__A_Stage_Status;
1574
- };
1575
- type A_TYPES__A_StageStepProcessingExtraParams = {
1576
- steps: A_TYPES__A_StageStep[];
1577
- filter: (step: A_TYPES__A_StageStep) => boolean;
1578
- };
1579
-
1580
- /**
1581
- * Feature constructor type
1582
- * Uses the generic type T to specify the type of the feature
1583
- */
1584
- type A_TYPES__Feature_Constructor<T = A_Feature> = A_TYPES__Ctor<T>;
1585
- /**
1586
- * Feature initialization type
1587
- */
1588
- type A_TYPES__Feature_Init<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = A_TYPES__Feature_InitWithComponent<T> | A_TYPES__Feature_InitWithTemplate<T>;
1589
- /**
1590
- * Feature initialization type using component
1591
- */
1592
- type A_TYPES__Feature_InitWithComponent<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = {
1593
- /**
1594
- * Feature Name
1595
- */
1596
- name: string;
1597
- /**
1598
- * The component from where the feature is calling. It's important for proper scoping.
1599
- * Based on the component would be retrieved connected components, entities and containers.
1600
- *
1601
- * [!] Could be Container, Entity, Component or Command
1602
- */
1603
- component: T;
1604
- /**
1605
- * In case when Entity is not attached to the scope can be used to transparently show dependencies
1606
- *
1607
- *
1608
- */
1609
- scope?: A_Scope;
1610
- };
1611
- /**
1612
- * Feature initialization type using template
1613
- */
1614
- type A_TYPES__Feature_InitWithTemplate<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = {
1615
- /**
1616
- * Feature Name
1617
- */
1618
- name: string;
1619
- /**
1620
- * The scope from where to retrieve dependent components, entities and containers.
1621
- *
1622
- * [!] Important for proper scoping.
1623
- */
1624
- scope: A_Scope;
1625
- /**
1626
- * The component from where the feature is calling. It's important for proper scoping.
1627
- * Based on the component would be retrieved connected components, entities and containers.
1628
- *
1629
- * [!] Could be Container, Entity, Component or Command
1630
- */
1631
- component?: T;
1632
- /**
1633
- * Optional Feature template to be used instead of building it from decorators
1634
- */
1635
- template: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>;
1636
- };
1637
- /**
1638
- * Feature serialized type
1639
- */
1640
- type A_TYPES__Feature_Serialized = {};
1641
- /**
1642
- * Feature lifecycle states
1643
- */
1644
- declare enum A_TYPES__FeatureState {
1645
- /**
1646
- * The feature has been initialized
1647
- */
1648
- INITIALIZED = "INITIALIZED",
1649
- /**
1650
- * The feature is currently being processed
1651
- */
1652
- PROCESSING = "PROCESSING",
1653
- /**
1654
- * The feature has been completed
1655
- */
1656
- COMPLETED = "COMPLETED",
1657
- /**
1658
- * The feature has been interrupted
1659
- */
1660
- INTERRUPTED = "INTERRUPTED",
1661
- /**
1662
- * The feature has failed
1663
- */
1664
- FAILED = "FAILED"
1665
- }
1666
- type A_TYPES__FeatureError_Init = {
1667
- /**
1668
- * Stage where the error occurred
1669
- */
1670
- stage?: A_Stage;
1671
- } & A_TYPES__Error_Init;
1672
- /**
1673
- * A list of component where features can be Defined
1674
- *
1675
- * [!] On this component Feature Definition is Available
1676
- */
1677
- type A_TYPES__FeatureAvailableComponents = InstanceType<A_TYPES__FeatureAvailableConstructors>;
1678
- /**
1679
- * A list of constructors where features can be Defined
1680
- *
1681
- * [!] On this component Feature Definition is Available
1682
- */
1683
- type A_TYPES__FeatureAvailableConstructors = A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Container_Constructor;
1684
- /**
1685
- * Indicates a type of Feature Define decorator
1686
- */
1687
- type A_TYPES__FeatureDefineDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>>;
1688
- /**
1689
- * Describes additional configuration properties to be used in Feature Define decorator
1690
- */
1691
- type A_TYPES__FeatureDefineDecoratorConfig = {
1692
- /**
1693
- * Feature name
1694
- *
1695
- * [!] By default uses the method name
1696
- */
1697
- name: string;
1698
- /**
1699
- * Indicates a default behavior of the feature. If true the feature will be automatically attached to the execution.
1700
- *
1701
- * [!] Before feature execution the method itself will be called to prepare the feature template
1702
- * [!] Default is false
1703
- */
1704
- invoke: boolean;
1705
- /**
1706
- * Allows to add a default behavior or number of steps that will be part of the feature
1707
- */
1708
- template: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>;
1709
- };
1710
- /**
1711
- * Describes a single template item used in Feature Define decorator
1712
- */
1713
- type A_TYPES__FeatureDefineDecoratorTemplateItem = A_TYPES__Required<Partial<A_TYPES__A_StageStep>, ['name', 'handler', 'dependency']>;
1714
- /**
1715
- * Describes a target where Feature Define decorator can be applied
1716
- *
1717
- * [!] The feature can be defined on Container, Entity, Component or Command
1718
- */
1719
- type A_TYPES__FeatureDefineDecoratorTarget = A_Container | A_Entity | A_Component;
1720
- /**
1721
- * A type of Meta information stored by Feature Define decorator
1722
- * This information then uses by A-Context to build a proper feature template
1723
- */
1724
- type A_TYPES__FeatureDefineDecoratorMeta = {
1725
- /**
1726
- * Feature name
1727
- * mainly it's a unique combination of the class name and method name
1728
- */
1729
- name: string;
1730
- /**
1731
- * Actual method name in the class
1732
- */
1733
- handler: string;
1734
- /**
1735
- * Indicates a default behavior of the feature. If true the feature will be automatically attached to the execution.
1736
- *
1737
- * [!] Before feature execution the method itself will be called to prepare the feature template
1738
- * [!] Default is false
1739
- */
1740
- invoke: boolean;
1741
- /**
1742
- * Allows to add a default behavior or number of steps that will be part of the feature
1743
- */
1744
- template: Array<A_TYPES__A_StageStep>;
1745
- };
1746
- /**
1747
- * Descriptor type for A_Extend decorator
1748
- */
1749
- type A_TYPES__FeatureExtendDecoratorDescriptor = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<() => Promise<any>>;
1750
- /**
1751
- * Target type for A_Extend decorator
1752
- *
1753
- * [!] Can be applied only on A-Components
1754
- */
1755
- type A_TYPES__FeatureExtendDecoratorTarget = A_Component | A_Container | A_Entity;
1756
- /**
1757
- * Configuration type for A_Extend decorator
1758
- *
1759
- * This is an INPUT parameter provided by the user
1760
- */
1761
- type A_TYPES__FeatureExtendDecoratorConfig = {
1762
- /**
1763
- * Name of the container Lifecycle method to be extended.
1764
- *
1765
- * [!] If not provided will be used the name of the method.
1766
- * [!!] If name contains "." dot it will be considered as a path to the method.
1767
- */
1768
- name: string;
1769
- /**
1770
- * Container class or container name uses to identify the proper container in case when the name is not unique.
1771
- *
1772
- * [!] If not provided will be applied to all containers with the same name.
1773
- * [!!] By default uses OR to join all provided items. If you need more complex Logic, please use Regexp instead
1774
- *
1775
- * [!!!] In case if you need to exclude some containers, entities or components, please use "exclude" property
1776
- *
1777
- * Example:
1778
- *
1779
- * ```ts
1780
- * @A_Feature.Extend({
1781
- * name: 'load',
1782
- * scope: {
1783
- * include: [A_Container1, A_Entity1],
1784
- * exclude: [A_Component1]
1785
- * }
1786
- * })
1787
- * ```
1788
- */
1789
- scope: Array<A_TYPES__FeatureExtendDecoratorScopeItem> | Partial<A_TYPES__FeatureExtendDecoratorScopeConfig>;
1790
- /**
1791
- * The behavior of the method.
1792
- * In case its async it will be executed independently from the main thread.
1793
- *
1794
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1795
- *
1796
- */
1797
- behavior: A_TYPES_StageExecutionBehavior;
1798
- /**
1799
- * Allows to define the order of the execution of the method.
1800
- *
1801
- * [!] It applies for the following structure :'Component.methodName'
1802
- * [!] In case the method has circular dependencies it will Throw an error.
1803
- *
1804
- * Example:
1805
- * ```ts
1806
- * @A_Feature.Extend({
1807
- * name: 'load',
1808
- * before: ['Component1.methodName', 'Component2.methodName2']
1809
- * })
1810
- * // OR
1811
- * @A_Feature.Extend({
1812
- * name: 'load',
1813
- * before: /Component2\..+/
1814
- * })
1815
- * ```
1816
- */
1817
- before: Array<string> | RegExp;
1818
- /**
1819
- * Allows to define the order of the execution of the method.
1820
- *
1821
- * [!] It applies for the following structure :'Component.methodName'
1822
- * [!] In case the method has circular dependencies it will Throw an error.
1823
- *
1824
- * Example:
1825
- * ```ts
1826
- * @A_Feature.Extend({
1827
- * name: 'load',
1828
- * after: ['Component1.methodName', 'Component2.methodName2']
1829
- * })
1830
- * // OR
1831
- * @A_Feature.Extend({
1832
- * name: 'load',
1833
- * after: /Component2\..+/
1834
- * })
1835
- * ```
1836
- *
1837
- */
1838
- after: Array<string> | RegExp;
1839
- /**
1840
- * Indicates whether to throw an error if the step fails.
1841
- *
1842
- * [!] By default is true
1843
- */
1844
- throwOnError: boolean;
1845
- /**
1846
- * Allows to override particular steps in the feature sequence by provided names [Component].[Method] or by regexp
1847
- */
1848
- override: Array<string> | RegExp;
1849
- };
1850
- /**
1851
- * Scope item that can be used in A_Extend decorator configuration
1852
- */
1853
- type A_TYPES__FeatureExtendDecoratorScopeConfig = {
1854
- /**
1855
- * A list of components, entities or containers to include in the scope of the extension
1856
- */
1857
- include?: Array<A_TYPES__FeatureExtendDecoratorScopeItem>;
1858
- /**
1859
- * A list of components, entities or containers to exclude from the scope of the extension
1860
- */
1861
- exclude?: Array<A_TYPES__FeatureExtendDecoratorScopeItem>;
1862
- };
1863
- /**
1864
- * A single item that can be used in scope configuration
1865
- */
1866
- type A_TYPES__FeatureExtendDecoratorScopeItem = A_TYPES__Container_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Component_Constructor;
1867
- /**
1868
- * Meta type for A_Extend decorator
1869
- */
1870
- type A_TYPES__FeatureExtendDecoratorMeta = {
1871
- /**
1872
- * Original Feature Extension name
1873
- *
1874
- * [!] could be string or regex
1875
- */
1876
- name: string;
1877
- /**
1878
- * Actual method name in the class
1879
- */
1880
- handler: string;
1881
- /**
1882
- * The behavior of the method.
1883
- * In case its async it will be executed independently from the main thread.
1884
- *
1885
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1886
- *
1887
- */
1888
- behavior: A_TYPES_StageExecutionBehavior;
1889
- /**
1890
- * Allows to define the order of the execution of the method.
1891
- *
1892
- * [!] In case the method has circular dependencies it will Throw an error.
1893
- *
1894
- */
1895
- before: string;
1896
- /**
1897
- * Allows to define the order of the execution of the method.
1898
- *
1899
- * [!] In case the method has circular dependencies it will Throw an error.
1900
- *
1901
- */
1902
- after: string;
1903
- /**
1904
- * Indicates whether to throw an error if the step fails.
1905
- *
1906
- * [!] By default is true
1907
- */
1908
- throwOnError: boolean;
1909
- /**
1910
- * Allows to override particular steps in the feature sequence by provided names [Component].[Method] or by regexp
1911
- */
1912
- override: string;
1913
- };
1914
-
1915
- /**
1916
- * A-Abstraction Extend decorator allows to extends behavior of each concept abstraction execution.
1917
- * In case some components or containers requires to extend the behavior of the abstraction like 'start', 'build' or 'deploy'
1918
- * for example, this decorator allows to do so.
1919
- *
1920
- * @param name - abstraction name
1921
- * @param config - configuration of the abstraction extension
1922
- * @returns
1923
- */
1924
- declare function A_Abstraction_Extend(
1925
- /**
1926
- * Name of the Concept Abstraction to extend
1927
- */
1928
- name: A_TYPES__ConceptAbstractions,
1929
- /**
1930
- * Configuration of the Abstraction Extension
1931
- *
1932
- */
1933
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
1934
-
1935
- declare class A_Abstraction {
1936
- /**
1937
- * The name of the Abstraction e.g. 'deploy', 'start', 'test', etc.
1938
- */
1939
- protected _name: A_TYPES__ConceptAbstractions;
1940
- /**
1941
- * List of features that are part of this Abstraction
1942
- */
1943
- protected _features: A_Feature[];
1944
- /**
1945
- * The Feature currently being processed
1946
- */
1947
- protected _current?: A_Feature;
1948
- /**
1949
- * Actual Index of the current Feature being processed
1950
- */
1951
- protected _index: number;
1952
- /**
1953
- * Allows to extends A-Abstraction with additional methods
1954
- */
1955
- static get Extend(): typeof A_Abstraction_Extend;
1956
- /**
1957
- * A-Abstraction is an object that is common for any application.
1958
- * By providing components and creating abstraction extensions it's possible to create a unique behavior of the whole solution.
1959
- *
1960
- * Every application has basic abstractions like 'start', 'stop', 'deploy', 'test', etc.
1961
- * They can be easily extended with additional logic from both containers and components.
1962
- *
1963
- *
1964
- * @param params
1965
- */
1966
- constructor(
1967
- /**
1968
- * Parameters to define the A-Abstraction
1969
- */
1970
- params: A_TYPES__Abstraction_Init);
1971
- /**
1972
- * Returns the name of the Abstraction
1973
- */
1974
- get name(): string;
1975
- /**
1976
- * Returns the current Feature being processed
1977
- */
1978
- get feature(): A_Feature | undefined;
1979
- /**
1980
- * This method checks if the A-Feature is done
1981
- *
1982
- * @returns
1983
- */
1984
- get isDone(): boolean;
1985
- [Symbol.iterator](): Iterator<A_Feature, any>;
1986
- /**
1987
- * This method moves the Abstraction processing to the next Feature in the list
1988
- *
1989
- * @param stage
1990
- */
1991
- next(stage: any): void;
1992
- /**
1993
- * Allows to process all stages of the Abstraction
1994
- *
1995
- * @returns
1996
- */
1997
- process(
1998
- /**
1999
- * Allows to override the scope in which the Abstraction will be processed
2000
- *
2001
- */
2002
- scope?: A_Scope): Promise<void>;
2003
- }
2004
-
2005
- /**
2006
- * Abstraction constructor type
2007
- * Uses the generic type T to specify the type of the abstraction
2008
- */
2009
- type A_TYPES__Abstraction_Constructor<T = A_Abstraction> = A_TYPES__Ctor<T>;
2010
- /**
2011
- * Abstraction initialization type
2012
- */
2013
- type A_TYPES__Abstraction_Init = {
2014
- /**
2015
- * Name of the A-Abstraction
2016
- */
2017
- name: A_TYPES__ConceptAbstractions;
2018
- /**
2019
- * Features that compose the A-Abstraction
2020
- */
2021
- containers: Array<A_Container>;
2022
- };
2023
- /**
2024
- * Abstraction serialized type
2025
- */
2026
- type A_TYPES__Abstraction_Serialized = {
2027
- /**
2028
- * The ASEID of the abstraction
2029
- */
2030
- aseid: string;
2031
- };
2032
- /**
2033
- * Components that can extend Abstractions
2034
- */
2035
- type A_TYPES__AbstractionAvailableComponents = A_Component | A_Container;
2036
- type A_TYPES__AbstractionDecoratorDescriptor = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<() => Promise<any>>;
2037
- type A_TYPES__AbstractionDecoratorConfig = A_TYPES__FeatureExtendDecoratorConfig;
2038
-
2039
- declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
2040
- protected props: A_TYPES__Concept_Init<_Imports>;
2041
- /**
2042
- * Load the concept. This step runs before any other steps to ensure that all components are loaded.
2043
- */
2044
- static Load(
2045
- /**
2046
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2047
- */
2048
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): ReturnType<typeof A_Abstraction_Extend>;
2049
- /**
2050
- * Publish the concept to ADAAS platform. (Or any other place defined in the concept)
2051
- *
2052
- * [!] To extend the logic just create a custom containers and override the default behavior.
2053
- */
2054
- static Publish(
2055
- /**
2056
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2057
- */
2058
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): ReturnType<typeof A_Abstraction_Extend>;
2059
- /**
2060
- * Deploy the concept to the environment.
2061
- */
2062
- static Deploy(
2063
- /**
2064
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2065
- */
2066
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2067
- /**
2068
- * Compiles the Concept in case there are some containers that require that.
2069
- *
2070
- * Can be used for static websites or any other concept that requires a build step.
2071
- *
2072
- */
2073
- static Build(
2074
- /**
2075
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2076
- */
2077
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2078
- /**
2079
- * Main execution of the concept.
2080
- */
2081
- static Run(
2082
- /**
2083
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2084
- */
2085
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2086
- /**
2087
- * Start the concept. Uses for servers or any other background services.
2088
- */
2089
- static Start(
2090
- /**
2091
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2092
- */
2093
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2094
- /**
2095
- * Stop the concept. Uses for servers or any other background services.
2096
- */
2097
- static Stop(
2098
- /**
2099
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2100
- */
2101
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2102
- /**
2103
- * Name of the concept
2104
- *
2105
- * By default, the name of the Concept is 'a-concept'
2106
- */
2107
- private _name;
2108
- /**
2109
- * A list of internally defined containers that the concept uses.
2110
- */
2111
- protected _containers: A_Container[];
2112
- /**
2113
- * A-Concept is a placeholder for the concept of the any program.
2114
- *
2115
- * Concept - could be any Program regardless environment and it's goal.
2116
- * It could be mobile, web or simple html page.
2117
- * All depends on Containers and Components installed and provided in the Concept.
2118
- *
2119
- *
2120
- * [!] Concept operates ONLY with all Components and Containers provided to achieve the goal.
2121
- *
2122
- *
2123
- * @param props - Initialization properties for the Concept
2124
- */
2125
- constructor(props: A_TYPES__Concept_Init<_Imports>);
2126
- /**
2127
- * Name of the concept
2128
- */
2129
- get name(): string;
2130
- /**
2131
- * The primary Root scope of the concept.
2132
- */
2133
- get scope(): A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]>;
2134
- /**
2135
- * Register a class or value in the concept scope.
2136
- */
2137
- get register(): A_Scope['register'];
2138
- /**
2139
- * Resolve a class or value from the concept scope.
2140
- */
2141
- get resolve(): A_Scope['resolve'];
2142
- /**
2143
- * Load the concept.
2144
- */
2145
- load(scope?: A_Scope): Promise<void>;
2146
- /**
2147
- * Run the concept.
2148
- */
2149
- run(scope?: A_Scope): Promise<void>;
2150
- /**
2151
- * Start the concept.
2152
- *
2153
- * @param params
2154
- */
2155
- start(scope?: A_Scope): Promise<void>;
2156
- /**
2157
- * Stop the concept.
2158
- *
2159
- * @param params
2160
- */
2161
- stop(scope?: A_Scope): Promise<void>;
2162
- /**
2163
- * Build the concept.
2164
- */
2165
- build(scope?: A_Scope): Promise<void>;
2166
- /**
2167
- * Deploy the concept.
2168
- */
2169
- deploy(scope?: A_Scope): Promise<void>;
2170
- /**
2171
- * Publish the concept.
2172
- */
2173
- publish(scope?: A_Scope): Promise<void>;
2174
- /**
2175
- * Call the specific method of the concept or included modules.
2176
- */
2177
- call<K extends Record<_Imports[number]['name'], string>>(
2178
- /**
2179
- * Name of the method to call
2180
- */
2181
- method: K[keyof K],
2182
- /**
2183
- * Container in which the method is located
2184
- */
2185
- container: _Imports[number]): Promise<void>;
2186
- }
2187
-
2188
- /**
2189
- * Concept constructor type
2190
- * Uses the generic type T to specify the type of the concept
2191
- */
2192
- type A_TYPES__Concept_Constructor<T = A_Concept> = A_TYPES__Ctor<T>;
2193
- /**
2194
- * Concept initialization type
2195
- * Uses the generic type T to specify the type of containers that the concept will use
2196
- */
2197
- type A_TYPES__Concept_Init<T extends Array<A_Container>> = {
2198
- /**
2199
- * The name of the Concept
2200
- * If name is not provided, will be used from environment variable A_CONCEPT_NAME
2201
- *
2202
- * By default, the name of the Concept is 'a-concept'
2203
- *
2204
- */
2205
- name?: string;
2206
- /**
2207
- * A set of Context Fragments to register globally for the concept.
2208
- * These fragments will be available in the global context.
2209
- *
2210
- */
2211
- fragments?: Array<InstanceType<A_TYPES__Fragment_Constructor>>;
2212
- /**
2213
- * A set of Containers that the concept depends on.
2214
- * These containers will create a new Container for the concept.
2215
- */
2216
- containers?: T;
2217
- /**
2218
- * A set of Entities that the concept can use.
2219
- * These components will be used in the concept.
2220
- */
2221
- entities?: Array<InstanceType<A_TYPES__Entity_Constructor> | A_TYPES__Entity_Constructor>;
2222
- /**
2223
- * A set of Components available for all containers and fragments in the concept.
2224
- * These components will be registered in the root scope of the concept.
2225
- *
2226
- * [!] Note that these components will be available in all containers and fragments in the concept.
2227
- */
2228
- components?: Array<A_TYPES__Component_Constructor>;
2229
- };
2230
- /**
2231
- * Concept serialized type
2232
- */
2233
- type A_TYPES__Concept_Serialized = {};
2234
- /**
2235
- * Uses as a transfer object to pass configurations to Feature constructor
2236
- */
2237
- type A_TYPES__ConceptAbstractionMeta = {
2238
- /**
2239
- * The arguments that will be passed to the handler
2240
- */
2241
- args: A_TYPES__A_InjectDecorator_Meta;
2242
- } & A_TYPES__FeatureExtendDecoratorMeta;
2243
- /**
2244
- * Uses to define the extension that will be applied to the Concept
2245
- */
2246
- type A_TYPES__ConceptAbstraction = A_TYPES__FeatureExtendDecoratorMeta;
2247
-
2248
- declare enum A_TYPES__ContainerMetaKey {
2249
- FEATURES = "a-container-features",
2250
- INJECTIONS = "a-container-injections",
2251
- ABSTRACTIONS = "a-container-abstractions",
2252
- EXTENSIONS = "a-container-extensions"
2253
- }
2254
-
2255
- /**
2256
- * Container constructor type
2257
- * Uses the generic type T to specify the type of the container
2258
- */
2259
- type A_TYPES__Container_Constructor<T = A_Container> = A_TYPES__Ctor<T>;
2260
- /**
2261
- * Container initialization type
2262
- */
2263
- type A_TYPES__Container_Init = {
2264
- /**
2265
- * The extra name for the container (optional)
2266
- */
2267
- name?: string;
2268
- } & A_TYPES__Scope_Init;
2269
- /**
2270
- * Container serialized type
2271
- */
2272
- type A_TYPES__Container_Serialized = {
2273
- /**
2274
- * The ASEID of the container
2275
- */
2276
- aseid: string;
2277
- };
2278
- /**
2279
- * Meta information stored in each Container
2280
- */
2281
- type A_TYPES__ContainerMeta = {
2282
- /**
2283
- * Extensions applied to the component per handler
2284
- */
2285
- [A_TYPES__ContainerMetaKey.EXTENSIONS]: A_Meta<{
2286
- /**
2287
- * Where Key the regexp for what to apply the extension
2288
- * A set of container names or a wildcard, or a regexp
2289
- *
2290
- *
2291
- * Where value is the extension instructions
2292
- */
2293
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2294
- }>;
2295
- [A_TYPES__ContainerMetaKey.FEATURES]: A_Meta<{
2296
- /**
2297
- * Where Key is the name of the feature
2298
- *
2299
- * Where value is the list of features
2300
- */
2301
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2302
- }>;
2303
- [A_TYPES__ContainerMetaKey.ABSTRACTIONS]: A_Meta<{
2304
- /**
2305
- * Where Key the regexp for what to apply the extension
2306
- * A set of container names or a wildcard, or a regexp
2307
- *
2308
- *
2309
- * Where value is the extension instructions
2310
- */
2311
- [Key: string]: A_TYPES__ConceptAbstraction[];
2312
- }>;
2313
- [A_TYPES__ContainerMetaKey.INJECTIONS]: A_Meta<{
2314
- /**
2315
- * Where Key is the name of the injection
2316
- *
2317
- * Where value is the list of injections
2318
- */
2319
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2320
- }>;
2321
- };
2322
- type A_TYPES__ContainerMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
2323
-
2324
- /**
2325
- * A-Inject decorator descriptor type
2326
- * Indicates the type of the decorator function
2327
- */
2328
- type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
2329
- /**
2330
- * A-Inject decorator return type
2331
- * Indicates what the decorator function returns
2332
- */
2333
- type A_TYPES__A_InjectDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
2334
- type A_TYPES__A_InjectDecorator_Meta = Array<A_Dependency>;
2335
- /**
2336
- * Targets that can be injected into Extended functions or constructors
2337
- */
2338
- type A_TYPES__InjectableTargets = A_TYPES__Component_Constructor | InstanceType<A_TYPES__Component_Constructor> | InstanceType<A_TYPES__Container_Constructor>;
2339
-
2340
- declare enum A_TYPES__ComponentMetaKey {
2341
- EXTENSIONS = "a-component-extensions",
2342
- FEATURES = "a-component-features",
2343
- INJECTIONS = "a-component-injections",
2344
- ABSTRACTIONS = "a-component-abstractions"
2345
- }
2346
-
2347
- /**
2348
- * Component constructor type
2349
- * Uses the generic type T to specify the type of the component
2350
- */
2351
- type A_TYPES__Component_Constructor<T = A_Component> = A_TYPES__Ctor<T>;
2352
- /**
2353
- * Component initialization type
2354
- */
2355
- type A_TYPES__Component_Init = any;
2356
- /**
2357
- * Component serialized type
2358
- */
2359
- type A_TYPES__Component_Serialized = {
2360
- /**
2361
- * The ASEID of the component
2362
- */
2363
- aseid: string;
2364
- };
2365
- /**
2366
- * Component meta type
2367
- */
2368
- type A_TYPES__ComponentMeta = {
2369
- /**
2370
- * Extensions applied to the component per handler
2371
- */
2372
- [A_TYPES__ComponentMetaKey.EXTENSIONS]: A_Meta<{
2373
- /**
2374
- * Where Key the regexp for what to apply the extension
2375
- * A set of container names or a wildcard, or a regexp
2376
- *
2377
- *
2378
- * Where value is the extension instructions
2379
- */
2380
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2381
- }>;
2382
- /**
2383
- * Features defined on the component per handler
2384
- */
2385
- [A_TYPES__ComponentMetaKey.FEATURES]: A_Meta<{
2386
- /**
2387
- * Where Key is the name of the feature
2388
- *
2389
- * Where value is the list of features
2390
- */
2391
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2392
- }>;
2393
- /**
2394
- * Injections defined on the component per handler
2395
- */
2396
- [A_TYPES__ComponentMetaKey.INJECTIONS]: A_Meta<{
2397
- /**
2398
- * Where Key is the name of the injection
2399
- *
2400
- * Where value is the list of injections
2401
- */
2402
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2403
- }>;
2404
- /**
2405
- * Abstractions extended by the component per handler
2406
- */
2407
- [A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
2408
- /**
2409
- * Where Key is the name of the stage
2410
- *
2411
- * Where value is the list of injections
2412
- */
2413
- [Key: string]: A_TYPES__ConceptAbstraction[];
2414
- }>;
2415
- };
2416
- type A_TYPES__ComponentMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
2417
-
2418
- /**
2419
- * Meta constructor type
2420
- */
2421
- type A_TYPES__Meta_Constructor<T = A_Meta> = A_TYPES__Ctor<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]]> {
2437
- /**
2438
- * Allows to set a custom meta class for the Component or Container or Entity, or anything else.
2439
- *
2440
- * @param target
2441
- * @returns
2442
- */
2443
- static Define<T extends A_Meta>(target: A_TYPES__Meta_Constructor<T>): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: TTarget) => TTarget;
2444
- protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
2445
- /**
2446
- * Method to get the iterator for the meta object
2447
- *
2448
- * @returns
2449
- */
2450
- [Symbol.iterator](): Iterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
2451
- /**
2452
- * Allows to replicate received meta object by replacing internal meta to the received one
2453
- *
2454
- * @param meta
2455
- * @returns
2456
- */
2457
- from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
2458
- /**
2459
- * Method to set values in the map
2460
- *
2461
- * @param key
2462
- * @param value
2463
- */
2464
- set<K extends keyof _StorageItems>(key: K, value: _StorageItems[K]): void;
2465
- /**
2466
- * Method to get values from the map
2467
- *
2468
- * @param key
2469
- * @returns
2470
- */
2471
- get<K extends keyof _StorageItems>(key: K): _StorageItems[K] | undefined;
2472
- /**
2473
- * Method to delete values from the map
2474
- *
2475
- * @param key
2476
- * @returns
2477
- */
2478
- delete(key: keyof _StorageItems): boolean;
2479
- /**
2480
- * Method to get the size of the map
2481
- *
2482
- * @returns
2483
- */
2484
- size(): number;
2485
- /**
2486
- * This method is needed to convert the key to a regular expression and cover cases like:
2487
- *
2488
- * simple * e.g. "a*" instead of "a.*"
2489
- *
2490
- * simple ? e.g. "a?" instead of "a."
2491
- *
2492
- * etc.
2493
- *
2494
- * @param key
2495
- * @returns
2496
- */
2497
- private convertToRegExp;
2498
- /**
2499
- * Method to find values in the map by name.
2500
- *
2501
- * Converts the Key in Map to a regular expression and then compares to the name
2502
- *
2503
- * @param name
2504
- * @returns
2505
- */
2506
- find(name: string): [keyof _StorageItems, _StorageItems[keyof _StorageItems]][];
2507
- /**
2508
- * Method to find values in the map by regular expression
2509
- *
2510
- * Compares Map Key to the input regular expression
2511
- *
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
- *
2519
- * @param key
2520
- * @returns
2521
- */
2522
- has(key: keyof _StorageItems): boolean;
2523
- /**
2524
- * Method to get the size of the map
2525
- *
2526
- * @returns
2527
- */
2528
- entries(): IterableIterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
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;
2535
- /**
2536
- * Serializes the meta to a JSON object
2537
- * Uses internal storage to convert to JSON
2538
- *
2539
- * @returns
2540
- */
2541
- toJSON(): _SerializedType;
2542
- }
2543
-
2544
- declare enum A_TYPES__EntityMetaKey {
2545
- EXTENSIONS = "a-component-extensions",
2546
- FEATURES = "a-component-features",
2547
- ABSTRACTIONS = "a-component-abstractions",
2548
- INJECTIONS = "a-component-injections"
2549
- }
2550
- declare enum A_TYPES__EntityFeatures {
2551
- SAVE = "save",
2552
- DESTROY = "destroy",
2553
- LOAD = "load"
2554
- }
2555
-
2556
- /**
2557
- * Entity interface
2558
- */
2559
- interface A_TYPES__IEntity {
2560
- /**
2561
- * The ASEID of the entity
2562
- */
2563
- aseid: ASEID;
2564
- }
2565
- /**
2566
- * Entity constructor type
2567
- * Uses the generic type T to specify the type of the entity
2568
- */
2569
- type A_TYPES__Entity_Constructor<T = A_Entity> = A_TYPES__Ctor<T>;
2570
- /**
2571
- * Entity initialization type
2572
- */
2573
- type A_TYPES__Entity_Init = any;
2574
- /**
2575
- * Entity serialized type
2576
- */
2577
- type A_TYPES__Entity_Serialized = {
2578
- /**
2579
- * The ASEID of the entity
2580
- */
2581
- aseid: string;
2582
- };
2583
- /**
2584
- * Entity meta type
2585
- */
2586
- type A_TYPES__EntityMeta = {
2587
- [A_TYPES__EntityMetaKey.EXTENSIONS]: A_Meta<{
2588
- /**
2589
- * Where Key the regexp for what to apply the extension
2590
- * A set of container names or a wildcard, or a regexp
2591
- *
2592
- *
2593
- * Where value is the extension instructions
2594
- */
2595
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2596
- }>;
2597
- case: any;
2598
- [A_TYPES__EntityMetaKey.FEATURES]: A_Meta<{
2599
- /**
2600
- * Where Key is the name of the feature
2601
- *
2602
- * Where value is the list of features
2603
- */
2604
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2605
- }>;
2606
- /**
2607
- * Injections defined on the component per handler
2608
- */
2609
- [A_TYPES__EntityMetaKey.INJECTIONS]: A_Meta<{
2610
- /**
2611
- * Where Key is the name of the injection
2612
- *
2613
- * Where value is the list of injections
2614
- */
2615
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2616
- }>;
2617
- };
2618
-
2619
- /**
2620
- * A_Entity is another abstraction that describes all major participants in the system business logic.
2621
- * Each Entity should have a clear definition and a clear set of responsibilities.
2622
- * However, entity may hide some of its responsibilities behind the interface to prevent overload.
2623
- *
2624
- * Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
2625
- */
2626
- 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 {
2627
- /**
2628
- * Entity Identifier that corresponds to the class name
2629
- */
2630
- static get entity(): string;
2631
- /**
2632
- * DEFAULT Concept Name (Application Name) of the entity from environment variable A_CONCEPT_NAME
2633
- * [!] If environment variable is not set, it will default to 'a-concept'
2634
- */
2635
- static get concept(): string;
2636
- /**
2637
- * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
2638
- * [!] If environment variable is not set, it will default to 'core'
2639
- * [!] Scope is an application specific identifier that can be used to group entities together
2640
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
2641
- */
2642
- static get scope(): string;
2643
- /**
2644
- * ASEID is an entity identifier that is unique across the system
2645
- * A - A_Concept or Application
2646
- * S - System or Scope
2647
- * E - Entity
2648
- * ID - Identifier
2649
- *
2650
- * [!] ASEID is immutable and should not be changed after the entity is created
2651
- *
2652
- * [!] ASEID is composed of the following parts:
2653
- * - concept: an application specific identifier from where the entity is coming from
2654
- * - scope: the scope of the entity from concept
2655
- * - entity: the name of the entity from concept
2656
- * - id: the unique identifier of the entity
2657
- *
2658
- * [!] For more information about ASEID, please refer to the ASEID class documentation]
2659
- */
2660
- aseid: ASEID;
2661
- /**
2662
- * Create a new A_entity instance from Aseid String
2663
- * e.g. project@scope:entity:0000000001
2664
- *
2665
- * @param aseid
2666
- */
2667
- constructor(
2668
- /**
2669
- * ASEID string that represents the entity
2670
- */
2671
- aseid?: string);
2672
- /**
2673
- * Create a new A_entity instance from Aseid instance
2674
- * e.g. new ASEID({concept: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
2675
- *
2676
- * @param aseid
2677
- */
2678
- constructor(
2679
- /**
2680
- * ASEID instance that represents the entity
2681
- */
2682
- aseid: ASEID);
2683
- /**
2684
- * Create a new A_entity instance from serialized object
2685
- *
2686
- * @param serialized
2687
- */
2688
- constructor(
2689
- /**
2690
- * Serialized object that represents the entity
2691
- */
2692
- serialized: _SerializedType);
2693
- /**
2694
- * Create a new A_entity instance from constructor object
2695
- *
2696
- * @param newEntity
2697
- */
2698
- constructor(
2699
- /**
2700
- * Constructor object that represents the entity
2701
- */
2702
- newEntity?: _ConstructorType);
2703
- /**
2704
- * Extracts the ID from the ASEID
2705
- * ID is the unique identifier of the entity
2706
- */
2707
- get id(): string | number;
2708
- protected isStringASEID(x: unknown): x is string;
2709
- protected isASEIDInstance(x: unknown): x is ASEID;
2710
- /**
2711
- * A "serialized" object is considered such if it is a non-null object
2712
- * and contains an "aseid" property (this mirrors your original check).
2713
- *
2714
- * @param x
2715
- * @returns
2716
- */
2717
- protected isSerializedObject(x: unknown): x is _SerializedType;
2718
- /**
2719
- * Constructor-style props = a plain object which does NOT contain "aseid".
2720
- * This is the "create from provided fields" case.
2721
- *
2722
- * @param x
2723
- * @returns
2724
- */
2725
- protected isConstructorProps(x: unknown): x is _ConstructorType;
2726
- /**
2727
- * Determines the appropriate initializer method based on the type of `props`.
2728
- * The method checks if `props` is:
2729
- * 1) a string that matches ASEID format -> fromASEID
2730
- * 2) an ASEID instance -> fromASEID
2731
- * 3) a serialized object (has 'aseid') -> fromJSON
2732
- * 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
2733
- *
2734
- * [!] If `props` is undefined, it will call fromUndefined method
2735
- *
2736
- * If none of the above, it throws an error indicating incorrect constructor usage.
2737
- *
2738
- *
2739
- * To get a custom initializer, override this method in the child class.
2740
- * Example:
2741
- * ```typescript
2742
- * protected getInitializer(
2743
- * props?: string | ASEID | _SerializedType | _ConstructorType
2744
- * ): (props: any) => void | (() => void) {
2745
- * if('customField' in props) {
2746
- * return this.fromCustomField.bind(this);
2747
- * }
2748
- * return super.getInitializer(props);
2749
- * }
2750
- * ```
2751
- * @param props
2752
- * @returns The appropriate initializer method
2753
- */
2754
- protected getInitializer(props?: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void | (() => void);
2755
- /**
2756
- * Generates a new ASEID for the entity.
2757
- * It uses class definitions for concept, scope, and entity,
2758
- * and allows overriding any of these values.
2759
- *
2760
- * @param override
2761
- * @returns
2762
- */
2763
- protected generateASEID(override?: Partial<A_TYPES__ASEID_Constructor>): ASEID;
2764
- /**
2765
- * Call a feature of the component with the provided scope
2766
- *
2767
- * [!] If the provided scope is not inherited from the entity scope, it will be inherited
2768
- *
2769
- * @param lifecycleMethod
2770
- * @param args
2771
- */
2772
- call(feature: string, scope?: A_Scope): any;
2773
- /**
2774
- * The default method that can be called and extended to load entity data.
2775
- */
2776
- load(scope?: A_Scope): Promise<any>;
2777
- /**
2778
- * The default method that can be called and extended to destroy entity data.
2779
- */
2780
- destroy(scope?: A_Scope): Promise<any>;
2781
- /**
2782
- * The default method that can be called and extended to save entity data.
2783
- */
2784
- save(scope?: A_Scope): Promise<any>;
2785
- /**
2786
- * Create a new entity from ASEID string or instance
2787
- * [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
2788
- * [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
2789
- *
2790
- * @param aseid
2791
- */
2792
- fromASEID(aseid: string | ASEID): void;
2793
- /**
2794
- * Handles the case when no props are provided to the constructor.
2795
- * This method can be overridden in child classes to set default values or perform specific initialization logic.
2796
- * By default, it does nothing.
2797
- *
2798
- *
2799
- * @returns
2800
- */
2801
- fromUndefined(): void;
2802
- /**
2803
- * Create a new entity from constructor object
2804
- * [!] Executed when the constructor is called with an object that does not contain "aseid" property
2805
- * [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
2806
- *
2807
- * @param newEntity
2808
- * @returns
2809
- */
2810
- fromNew(newEntity: _ConstructorType): void;
2811
- /**
2812
- * Creates a new entity from serialized object
2813
- *
2814
- * [!] Executed when the constructor is called with an object that contains "aseid" property
2815
- * [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
2816
- *
2817
- *
2818
- * @param serialized
2819
- * @returns
2820
- */
2821
- fromJSON(serialized: _SerializedType): void;
2822
- /**
2823
- * Converts the entity to a JSON object
2824
- * [!] This method should be extended in the child classes to include all properties of the entity
2825
- * [!] Includes aseid by default
2826
- *
2827
- *
2828
- * @returns
2829
- */
2830
- toJSON(): _SerializedType;
2831
- /**
2832
- * Returns the string representation of the entity
2833
- * what is basically the ASEID string
2834
- *
2835
- * @returns
2836
- */
2837
- toString(): string;
2838
- }
2839
-
2840
- 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[]> {
2841
- /**
2842
- * Scope Name uses for identification and logging purposes
2843
- */
2844
- protected _name: string;
2845
- /**
2846
- * Parent scope reference, used for inheritance of components, fragments, entities and commands
2847
- */
2848
- protected _parent?: A_Scope;
2849
- /**
2850
- * Internal meta storage using A_Meta for type-safe key-value operations.
2851
- * This stores all the scope's runtime data that can be accessed and modified
2852
- * throughout the execution pipeline or within running containers.
2853
- */
2854
- protected _meta: A_Meta<_MetaItems>;
2855
- /**
2856
- * A set of allowed components, A set of constructors that are allowed in the scope
2857
- *
2858
- */
2859
- protected _allowedComponents: Set<_ComponentType[number]>;
2860
- /**
2861
- * A set of allowed errors, A set of constructors that are allowed in the scope
2862
- */
2863
- protected _allowedErrors: Set<_ErrorType[number]>;
2864
- /**
2865
- * A set of allowed entities, A set of constructors that are allowed in the scope
2866
- */
2867
- protected _allowedEntities: Set<_EntityType[number]>;
2868
- /**
2869
- * A set of allowed fragments, A set of constructors that are allowed in the scope
2870
- */
2871
- protected _allowedFragments: Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
2872
- /**
2873
- * Storage for the components, should be strong as components are unique per scope
2874
- */
2875
- protected _components: Map<_ComponentType[number], InstanceType<_ComponentType[number]>>;
2876
- /**
2877
- * Storage for the errors, should be strong as errors are unique per code
2878
- */
2879
- protected _errors: Map<string, InstanceType<_ErrorType[number]>>;
2880
- /**
2881
- * Storage for the entities, should be strong as entities are unique per aseid
2882
- */
2883
- protected _entities: Map<string, InstanceType<_EntityType[number]>>;
2884
- /**
2885
- * Storage for the fragments, should be weak as fragments are singletons per scope
2886
- */
2887
- protected _fragments: Map<A_TYPES__Fragment_Constructor<_FragmentType[number]>, _FragmentType[number]>;
2888
- /**
2889
- * Storage for imported scopes
2890
- */
2891
- protected _imports: Set<A_Scope>;
2892
- /**
2893
- * Returns the name of the scope
2894
- */
2895
- get name(): string;
2896
- /**
2897
- * Returns the meta object of the scope
2898
- */
2899
- get meta(): A_Meta<_MetaItems, Record<string, any>>;
2900
- /**
2901
- * Returns a list of Constructors for A-Components that are available in the scope
2902
- */
2903
- get allowedComponents(): Set<_ComponentType[number]>;
2904
- /**
2905
- * Returns a list of Constructors for A-Entities that are available in the scope
2906
- */
2907
- get allowedEntities(): Set<_EntityType[number]>;
2908
- /**
2909
- * Returns a list of Constructors for A-Fragments that are available in the scope
2910
- */
2911
- get allowedFragments(): Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
2912
- /**
2913
- * Returns a list of Constructors for A-Errors that are available in the scope
2914
- */
2915
- get allowedErrors(): Set<_ErrorType[number]>;
2916
- /**
2917
- * Returns an Array of entities registered in the scope
2918
- *
2919
- * [!] One entity per aseid
2920
- */
2921
- get entities(): Array<InstanceType<_EntityType[number]>>;
2922
- /**
2923
- * Returns an Array of fragments registered in the scope
2924
- *
2925
- * [!] One fragment per scope
2926
- */
2927
- get fragments(): Array<_FragmentType[number]>;
2928
- /**
2929
- * Returns an Array of components registered in the scope
2930
- *
2931
- * [!] One component instance per scope
2932
- */
2933
- get components(): Array<InstanceType<_ComponentType[number]>>;
2934
- /**
2935
- * Returns an Array of errors registered in the scope
2936
- *
2937
- * [!] One error per code
2938
- */
2939
- get errors(): Array<InstanceType<_ErrorType[number]>>;
2940
- /**
2941
- * Returns an Array of imported scopes
2942
- * [!] Imported scopes are scopes that have been imported into the current scope using the import() method
2943
- */
2944
- get imports(): Array<A_Scope>;
2945
- /**
2946
- * Returns the parent scope of the current scope
2947
- *
2948
- * @param setValue
2949
- * @returns
2950
- */
2951
- get parent(): A_Scope | undefined;
2952
- /**
2953
- * A_Scope refers to the visibility and accessibility of :
2954
- * - variables,
2955
- * - Components,
2956
- * - Context Fragments
2957
- * - Entities
2958
- * - and objects in different parts of your code.
2959
- * Scope determines where a particular piece of data (like a variable or function)
2960
- * can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
2961
- *
2962
- * [!] The scope behavior is similar to tree structure where each scope can have a parent scope and inherit its components, fragments, entities and errors
2963
- *
2964
- * @param params
2965
- * @param config
2966
- */
2967
- constructor();
2968
- constructor(
2969
- /**
2970
- * A set of constructors that are allowed in the scope
2971
- */
2972
- params: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>,
2973
- /**
2974
- * Configuration options for the scope
2975
- */
2976
- config?: Partial<A_TYPES__ScopeConfig>);
2977
- /**
2978
- * Generator to iterate through all parent scopes
2979
- */
2980
- parents(): Generator<A_Scope>;
2981
- /**
2982
- * This method is used to retrieve a parent scope at a specific level
2983
- *
2984
- * [!] Note that if the level is out of bounds, undefined is returned
2985
- * [!!] Uses negative values for levels (e.g. -1 for immediate parent, -2 for grandparent, etc.)
2986
- *
2987
- * @param level
2988
- * @returns
2989
- */
2990
- parentOffset<T extends A_Scope>(
2991
- /**
2992
- * Level of the parent scope to retrieve
2993
- *
2994
- * Examples:
2995
- * - level 0 - this scope
2996
- * - level -1 - parent
2997
- * - level -2 - grandparent
2998
- */
2999
- layerOffset: number): T | undefined;
3000
- /**
3001
- * Determines which initializer method to use based on the type of the first parameter.
3002
- *
3003
- * @param param1
3004
- * @returns
3005
- */
3006
- protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
3007
- protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
3008
- /**
3009
- * This method is used to initialize the components in the scope
3010
- * To save memory components are initialized only when they are requested
3011
- *
3012
- * This method only registers the component in the scope in case they are not registered yet
3013
- *
3014
- * @param _components
3015
- */
3016
- protected initComponents(_components?: _ComponentType): void;
3017
- /**
3018
- * This method is used to initialize the errors in the scope
3019
- *
3020
- * This method only registers the errors in the scope in case they are not registered yet
3021
- *
3022
- * @param _errors
3023
- */
3024
- protected initErrors(_errors?: _ErrorType): void;
3025
- /**
3026
- * This method is used to initialize the entities in the scope
3027
- *
3028
- * This method only registers the entities in the scope in case they are not registered yet
3029
- *
3030
- * @param _entities
3031
- */
3032
- protected initEntities(_entities?: [
3033
- ..._EntityType,
3034
- ...InstanceType<_EntityType[number]>[]
3035
- ]): void;
3036
- /**
3037
- * This method is used to initialize the fragments in the scope
3038
- *
3039
- * This method only registers the fragments in the scope in case they are not registered yet
3040
- *
3041
- * @param _fragments
3042
- */
3043
- protected initFragments(_fragments?: _FragmentType): void;
3044
- /**
3045
- * This method is used to initialize the meta in the scope
3046
- *
3047
- * This method only sets the meta values in the scope in case they are not set yet
3048
- *
3049
- * @param _meta
3050
- */
3051
- protected initMeta(_meta?: Partial<_MetaItems>): void;
3052
- /**
3053
- * This method is used to destroy the scope and all its registered components, fragments and entities
3054
- *
3055
- * [!] This method deregisters all components, fragments and entities from the A-Context
3056
- * [!] This method also clears all internal registries and collections
3057
- */
3058
- destroy(): void;
3059
- /**
3060
- * Retrieves a value from the scope's meta.
3061
- *
3062
- * @param param - The key to retrieve
3063
- * @returns The value associated with the key, or undefined if not found
3064
- *
3065
- * @example
3066
- * ```typescript
3067
- * const userId = scope.get('userId');
3068
- * if (userId) {
3069
- * console.log(`Current user: ${userId}`);
3070
- * }
3071
- * ```
3072
- */
3073
- get<K extends keyof _MetaItems>(param: K): _MetaItems[K] | undefined;
3074
- /**
3075
- * Stores a value in the scope's meta.
3076
- *
3077
- * @param param - The key to store the value under
3078
- * @param value - The value to store
3079
- *
3080
- * @example
3081
- * ```typescript
3082
- * scope.set('userId', '12345');
3083
- * scope.set('role', 'admin');
3084
- * ```
3085
- */
3086
- set<K extends keyof _MetaItems>(param: K, value: _MetaItems[K]): void;
3087
- /**
3088
- * Returns the issuer of the scope, useful for debugging and tracking purposes
3089
- *
3090
- * Issuer can be:
3091
- * - A Container that allocated the scope
3092
- * - A Feature that allocated the scope
3093
- *
3094
- * [!] Note that the issuer is the direct allocator of the scope, so if a Container allocated a Feature that allocated the scope, the issuer will be the Feature
3095
- *
3096
- * @returns
3097
- */
3098
- issuer<T extends A_TYPES__ScopeLinkedComponents>(): T | undefined;
3099
- /**
3100
- * This method is used to inherit from a parent scope
3101
- *
3102
- * [!] This method checks for circular inheritance and throws an error if detected
3103
- *
3104
- * @param parent
3105
- * @returns
3106
- */
3107
- inherit(parent: A_Scope): A_Scope;
3108
- /**
3109
- * This method allows to import other scopes, to make their dependencies available in the current scope
3110
- *
3111
- * [!] Import doesn't create a parent-child relationship between scopes, it just copies the dependencies from the imported scopes
3112
- * [!] It doesn't change the entities ownership, so entities remain unique to their original scopes
3113
- *
3114
- * @param scopes
3115
- * @returns
3116
- */
3117
- import(...scopes: A_Scope[]): A_Scope;
3118
- /**
3119
- * This method allows to deimport other scopes, to remove their dependencies from the current scope
3120
- *
3121
- *
3122
- * @param scopes
3123
- * @returns
3124
- */
3125
- deimport(...scopes: A_Scope[]): A_Scope;
3126
- /**
3127
- * This method is used to check if the component is available in the scope
3128
- *
3129
- * [!] Note that this method checks for the component in the current scope and all parent scopes
3130
- *
3131
- * @param component
3132
- * @returns
3133
- */
3134
- has<T extends A_Component>(
3135
- /**
3136
- * Provide a component constructor to check if it's available in the scope
3137
- */
3138
- component: A_TYPES__Component_Constructor<T>): boolean;
3139
- has<T extends A_Entity>(
3140
- /**
3141
- * Provide an entity constructor to check if it's available in the scope
3142
- *
3143
- * [!] Note that entities are unique per aseid, so this method checks if there's at least one entity of the provided type in the scope
3144
- */
3145
- entity: A_TYPES__Entity_Constructor<T>): boolean;
3146
- has<T extends A_Fragment>(
3147
- /**
3148
- * Provide a fragment constructor to check if it's available in the scope
3149
- */
3150
- fragment: A_TYPES__Fragment_Constructor<T>): boolean;
3151
- has<T extends A_Error>(
3152
- /**
3153
- * Provide an error constructor to check if it's available in the scope
3154
- */
3155
- error: A_TYPES__Error_Constructor<T>): boolean;
3156
- has(
3157
- /**
3158
- * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
3159
- */
3160
- constructor: string): boolean;
3161
- has<T extends A_TYPES__A_DependencyInjectable>(ctor: A_TYPES__Ctor<T> | string): boolean;
3162
- /**
3163
- * This method is used to check if the component is available in the scope
3164
- *
3165
- * [!] Note that this method checks for the component ONLY in the current scope
3166
- *
3167
- * @param component
3168
- * @returns
3169
- */
3170
- hasFlat<T extends A_Component>(
3171
- /**
3172
- * Provide a component constructor to check if it's available in the scope
3173
- */
3174
- component: A_TYPES__Component_Constructor<T>): boolean;
3175
- hasFlat<T extends A_Entity>(
3176
- /**
3177
- * Provide an entity constructor to check if it's available in the scope
3178
- *
3179
- * [!] Note that entities are unique per aseid, so this method checks if there's at least one entity of the provided type in the scope
3180
- */
3181
- entity: A_TYPES__Entity_Constructor<T>): boolean;
3182
- hasFlat<T extends A_Fragment>(
3183
- /**
3184
- * Provide a fragment constructor to check if it's available in the scope
3185
- */
3186
- fragment: A_TYPES__Fragment_Constructor<T>): boolean;
3187
- hasFlat<T extends A_Error>(
3188
- /**
3189
- * Provide an error constructor to check if it's available in the scope
3190
- */
3191
- error: A_TYPES__Error_Constructor<T>): boolean;
3192
- hasFlat(
3193
- /**
3194
- * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
3195
- */
3196
- constructor: string): boolean;
3197
- /**
3198
- * Allows to resolve a specific dependency
3199
- *
3200
- * @param dependency
3201
- * @returns
3202
- */
3203
- resolveDependency<T extends A_TYPES__A_DependencyInjectable>(dependency: A_Dependency<T>): T | Array<T> | undefined;
3204
- /**
3205
- * Allows to retrieve the constructor of the component or entity by its name
3206
- *
3207
- * [!] Notes:
3208
- * - In case of search for A-Entity please ensure that provided string corresponds to the static entity property of the class. [!] By default it's the kebab-case of the class name
3209
- * - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
3210
- *
3211
- * @param name
3212
- * @returns
3213
- */
3214
- resolveConstructor<T extends A_Entity>(
3215
- /**
3216
- * Provide the entity name or static entity property to retrieve its constructor
3217
- */
3218
- name: string): A_TYPES__Entity_Constructor<T>;
3219
- resolveConstructor<T extends A_Component>(
3220
- /**
3221
- * Provide the component name in PascalCase to retrieve its constructor
3222
- */
3223
- name: string): A_TYPES__Component_Constructor<T>;
3224
- resolveConstructor<T extends A_Fragment>(
3225
- /**
3226
- * Provide the fragment name in PascalCase to retrieve its constructor
3227
- */
3228
- name: string): A_TYPES__Fragment_Constructor<T>;
3229
- 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;
3230
- /**
3231
- * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3232
- * So in case of providing a base class it should return all instances that extends this base class
3233
- *
3234
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3235
- *
3236
- * @param component
3237
- */
3238
- resolveAll<T extends A_Component>(
3239
- /**
3240
- * Provide a component constructor to resolve its instance from the scope
3241
- */
3242
- component: A_TYPES__Component_Constructor<T>): Array<T>;
3243
- resolveAll<T extends A_Fragment>(
3244
- /**
3245
- * Provide a fragment constructor to resolve its instance from the scope
3246
- */
3247
- fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3248
- resolveAll<T extends A_Entity>(
3249
- /**
3250
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3251
- */
3252
- entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3253
- resolveAll<T extends A_TYPES__A_DependencyInjectable>(
3254
- /**
3255
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3256
- */
3257
- constructorName: string): Array<T>;
3258
- resolveAll<T extends A_TYPES__A_DependencyInjectable>(
3259
- /**
3260
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3261
- */
3262
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
3263
- /**
3264
- * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3265
- * So in case of providing a base class it should return all instances that extends this base class
3266
- *
3267
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3268
- *
3269
- * @param component
3270
- */
3271
- resolveFlatAll<T extends A_Component>(
3272
- /**
3273
- * Provide a component constructor to resolve its instance from the scope
3274
- */
3275
- component: A_TYPES__Component_Constructor<T>): Array<T>;
3276
- resolveFlatAll<T extends A_Fragment>(
3277
- /**
3278
- * Provide a fragment constructor to resolve its instance from the scope
3279
- */
3280
- fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3281
- resolveFlatAll<T extends A_Entity>(
3282
- /**
3283
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3284
- */
3285
- entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3286
- resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
3287
- /**
3288
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3289
- */
3290
- constructorName: string): Array<T>;
3291
- resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
3292
- /**
3293
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3294
- */
3295
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
3296
- /**
3297
- * This method allows to resolve/inject a component, fragment or entity from the scope
3298
- * Depending on the provided parameters it can resolve:
3299
- * - A single component/fragment/entity by its constructor or name
3300
- * - An array of components/fragments/entities by providing an array of constructors
3301
- * - An entity or an array of entities by providing the entity constructor and query instructions
3302
- *
3303
- * @param component
3304
- * @returns
3305
- */
3306
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3307
- /**
3308
- * Provide a component constructor to resolve its instance from the scope
3309
- */
3310
- component: A_TYPES__Ctor<T>): T | undefined;
3311
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3312
- /**
3313
- * Provide a target dependency to resolve its instance from the scope
3314
- *
3315
- * [!] In this case its possible to provide a custom resolution strategy via A_Dependency options
3316
- */
3317
- dependency: A_Dependency<T>): T | Array<T> | undefined;
3318
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3319
- /**
3320
- * Provide a component constructor to resolve its instance from the scope
3321
- */
3322
- component: string): T | Array<T> | undefined;
3323
- /**
3324
- * This method allows to resolve/inject a component, fragment or entity from the scope
3325
- * Depending on the provided parameters it can resolve:
3326
- * - A single component/fragment/entity by its constructor or name
3327
- * - An array of components/fragments/entities by providing an array of constructors
3328
- * - An entity or an array of entities by providing the entity constructor and query instructions
3329
- *
3330
- * @param component
3331
- * @returns
3332
- */
3333
- resolveOnce<T extends A_Component>(
3334
- /**
3335
- * Provide a component constructor to resolve its instance from the scope
3336
- */
3337
- component: A_TYPES__Component_Constructor<T>): T | undefined;
3338
- resolveOnce<T extends A_Fragment>(
3339
- /**
3340
- * Provide a fragment constructor to resolve its instance from the scope
3341
- */
3342
- fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3343
- resolveOnce<T extends A_Entity>(
3344
- /**
3345
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3346
- */
3347
- entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3348
- resolveOnce<T extends A_Scope>(
3349
- /**
3350
- * Uses only in case of resolving a single entity
3351
- *
3352
- * Provide an entity constructor to resolve its instance from the scope
3353
- */
3354
- scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3355
- resolveOnce<T extends A_Error>(
3356
- /**
3357
- * Uses only in case of resolving a single entity
3358
- *
3359
- * Provide an entity constructor to resolve its instance from the scope
3360
- */
3361
- error: A_TYPES__Error_Constructor<T>): T | undefined;
3362
- resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
3363
- /**
3364
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3365
- */
3366
- constructorName: string): T | undefined;
3367
- resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
3368
- /**
3369
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3370
- */
3371
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
3372
- /**
3373
- * This polymorphic method allows to resolve/inject a component, fragment or entity from the scope
3374
- * Depending on the provided parameters it can resolve:
3375
- * - A single component/fragment/entity by its constructor or name
3376
- * - An array of components/fragments/entities by providing an array of constructors
3377
- * - An entity or an array of entities by providing the entity constructor and query instructions
3378
- *
3379
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3380
- *
3381
- * @param component
3382
- */
3383
- resolveFlat<T extends A_Component>(
3384
- /**
3385
- * Provide a component constructor to resolve its instance from the scope
3386
- */
3387
- component: A_TYPES__Component_Constructor<T>): T | undefined;
3388
- resolveFlat<T extends A_Fragment>(
3389
- /**
3390
- * Provide a fragment constructor to resolve its instance from the scope
3391
- */
3392
- fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3393
- resolveFlat<T extends A_Entity>(
3394
- /**
3395
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3396
- */
3397
- entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3398
- resolveFlat<T extends A_Scope>(
3399
- /**
3400
- * Uses only in case of resolving a single entity
3401
- *
3402
- * Provide an entity constructor to resolve its instance from the scope
3403
- */
3404
- scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3405
- resolveFlat<T extends A_Error>(
3406
- /**
3407
- * Uses only in case of resolving a single entity
3408
- *
3409
- * Provide an entity constructor to resolve its instance from the scope
3410
- */
3411
- error: A_TYPES__Error_Constructor<T>): T | undefined;
3412
- resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
3413
- /**
3414
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3415
- */
3416
- constructorName: string): T | undefined;
3417
- resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
3418
- /**
3419
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3420
- */
3421
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable>): T | undefined;
3422
- /**
3423
- * Resolves a component, fragment or entity from the scope without checking parent scopes
3424
- *
3425
- * @param component
3426
- * @param instructions
3427
- */
3428
- resolveFlatOnce<T extends A_TYPES__A_DependencyInjectable>(component: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
3429
- /**
3430
- * This method is used internally to resolve a component, fragment or entity by its constructor name
3431
- *
3432
- * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
3433
- * [!!] Note: No parent scopes are checked
3434
- *
3435
- * @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)
3436
- * @returns
3437
- */
3438
- private resolveByName;
3439
- /**
3440
- * Resolves the issuer of the scope by provided constructor
3441
- *
3442
- * [!] Note that this method checks ONLY for the direct issuer of the scope
3443
- * [!!] No parent scopes are checked
3444
- *
3445
- *
3446
- * @param ctor
3447
- * @returns
3448
- */
3449
- private resolveIssuer;
3450
- /**
3451
- * This method is used internally to resolve a single entity from the scope based on the provided instructions
3452
- *
3453
- * [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
3454
- * [!!] Note: No parent scopes are checked
3455
- *
3456
- * @param entity
3457
- * @param instructions
3458
- * @returns
3459
- */
3460
- private resolveEntity;
3461
- /**
3462
- * This method is used internally to resolve a single error from the scope
3463
- *
3464
- * [!] Note that errors are singleton instances within the scope
3465
- * [!!] No parent scopes are checked
3466
- *
3467
- * @param error
3468
- * @returns
3469
- */
3470
- private resolveError;
3471
- /**
3472
- * This method is used internally to resolve a single fragment from the scope
3473
- *
3474
- * [!] Note that this method checks for the fragment in the current scope and all parent scopes
3475
- *
3476
- * @param fragment
3477
- * @returns
3478
- */
3479
- private resolveFragment;
3480
- /**
3481
- * This method is used internally to resolve a single scope from the current scope
3482
- *
3483
- * @param scope
3484
- * @returns
3485
- */
3486
- private resolveScope;
3487
- /**
3488
- * This method is used internally to resolve a single component from the scope
3489
- *
3490
- * [!!] Note: No parent scopes are checked
3491
- *
3492
- * @param component
3493
- * @returns
3494
- */
3495
- private resolveComponent;
3496
- /**
3497
- * This method is used to register the component in the scope
3498
- *
3499
- * @param fragment
3500
- */
3501
- register<T extends A_Component>(
3502
- /**
3503
- * Provide a component constructor to register it in the scope
3504
- */
3505
- component: A_TYPES__Component_Constructor<T>): void;
3506
- register<T extends A_Component>(
3507
- /**
3508
- * Provide a command instance to register it in the scope
3509
- */
3510
- component: T): void;
3511
- register<T extends A_Error>(
3512
- /**
3513
- * Provide an error constructor to register it in the scope
3514
- */
3515
- error: A_TYPES__Error_Constructor<T>): void;
3516
- register<T extends A_Error>(
3517
- /**
3518
- * Provide an error instance to register it in the scope
3519
- */
3520
- error: T): void;
3521
- register<T extends A_Fragment>(
3522
- /**
3523
- * Provide a command instance to register it in the scope
3524
- */
3525
- fragment: A_TYPES__Fragment_Constructor<T>): void;
3526
- register<T extends A_Fragment>(
3527
- /**
3528
- * Provide a fragment instance to register it in the scope
3529
- */
3530
- fragment: T): void;
3531
- register<T extends A_Entity>(
3532
- /**
3533
- * Provide an entity constructor to register it in the scope
3534
- */
3535
- entity: A_TYPES__Entity_Constructor<T>): void;
3536
- register<T extends A_Entity>(
3537
- /**
3538
- * Provide an entity instance to register it in the scope
3539
- */
3540
- entity: T): void;
3541
- register<T extends A_TYPES__A_DependencyInjectable>(
3542
- /**
3543
- * Provide an entity instance to register it in the scope
3544
- */
3545
- entity: T): void;
3546
- /**
3547
- * This method is used to deregister the component from the scope
3548
- *
3549
- * @param fragment
3550
- */
3551
- deregister<T extends A_Component>(
3552
- /**
3553
- * Provide a component constructor to deregister it in the scope
3554
- */
3555
- component: A_TYPES__Component_Constructor<T>): void;
3556
- deregister(
3557
- /**
3558
- * Provide a command instance to deregister it in the scope
3559
- */
3560
- component: A_Component): void;
3561
- deregister<T extends A_Error>(
3562
- /**
3563
- * Provide an error constructor to deregister it in the scope
3564
- */
3565
- error: A_TYPES__Error_Constructor<T>): void;
3566
- deregister(
3567
- /**
3568
- * Provide an error instance to deregister it in the scope
3569
- */
3570
- error: A_Error): void;
3571
- deregister<T extends A_Fragment>(
3572
- /**
3573
- * Provide a command instance to deregister it in the scope
3574
- */
3575
- fragment: A_TYPES__Fragment_Constructor<T>): void;
3576
- deregister(
3577
- /**
3578
- * Provide a fragment instance to deregister it in the scope
3579
- */
3580
- fragment: A_Fragment): void;
3581
- deregister<T extends A_Entity>(
3582
- /**
3583
- * Provide an entity constructor to deregister it in the scope
3584
- */
3585
- entity: A_TYPES__Entity_Constructor<T>): void;
3586
- deregister(
3587
- /**
3588
- * Provide an entity instance to deregister it in the scope
3589
- */
3590
- entity: A_Entity): void;
3591
- /**
3592
- * This method is useful when you want to serialize the scope to JSON
3593
- *
3594
- * [!] Note this is not a deep serialization, only the fragments are serialized
3595
- * [!] Fragments are a storage for information which is relevant to the scope
3596
- *
3597
- * @returns
3598
- */
3599
- toJSON(): Record<string, any>;
3600
- /**
3601
- * Type guard to check if the constructor is of type A_Component and is allowed in the scope
3602
- *
3603
- * @param ctor
3604
- * @returns
3605
- */
3606
- protected isAllowedComponent(ctor: unknown): ctor is _ComponentType[number];
3607
- /**
3608
- * Type guard to check if the constructor is of type A_Entity and is allowed in the scope
3609
- *
3610
- * @param ctor
3611
- * @returns
3612
- */
3613
- protected isAllowedEntity(ctor: unknown): ctor is A_TYPES__Entity_Constructor<_EntityType[number]>;
3614
- /**
3615
- * Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
3616
- *
3617
- * @param ctor
3618
- * @returns
3619
- */
3620
- protected isAllowedFragment(ctor: unknown): ctor is A_TYPES__Fragment_Constructor<_FragmentType[number]>;
3621
- /**
3622
- * Type guard to check if the constructor is of type A_Error and is allowed in the scope
3623
- *
3624
- * @param ctor
3625
- * @returns
3626
- */
3627
- protected isAllowedError(ctor: unknown): ctor is A_TYPES__Error_Constructor<_ErrorType[number]>;
3628
- /**
3629
- * This method is used to check if the scope is inherited from another scope
3630
- *
3631
- * @param scope
3632
- * @returns
3633
- */
3634
- isInheritedFrom(scope: A_Scope): boolean;
3635
- /**
3636
- * Helper method to check circular inheritance
3637
- * Should return a full sequence of inheritance for logging purposes
3638
- *
3639
- * @param scope
3640
- * @returns
3641
- */
3642
- checkCircularInheritance(scope: A_Scope): Array<string> | false;
3643
- /**
3644
- * Helper method to print the inheritance chain of the scope
3645
- */
3646
- printInheritanceChain(): void;
3647
- }
3648
-
3649
- /**
3650
- * A-Component is a primary "extendable" object in the system
3651
- * A unique combination of Components creates completely new functionality
3652
- *
3653
- * The most important thing is that A-Component is STATELESS, it means that it doesn't store any state in itself
3654
- *
3655
- *
3656
- * [!] Every A-Component is a singleton, so if you need to create multiple instances of the same logic - use A-Container
3657
- * [!] So one scope can have only one instance of the same A-Component
3658
- * [!] Every A-Component can be extended by features and extensions
3659
- * [!] ONLY A-Component can have A-Feature extensions
3660
- *
3661
- */
3662
- declare class A_Component {
3663
- /**
3664
- * Calls the feature with the given name in the given scope
3665
- *
3666
- * [!] Note: This method creates a new instance of the feature every time it is called
3667
- *
3668
- * @param feature - the name of the feature to call
3669
- * @param scope - the scope in which to call the feature
3670
- * @returns - void
3671
- */
3672
- call(
3673
- /**
3674
- * Name of the feature to call
3675
- */
3676
- feature: string,
3677
- /**
3678
- * Scope in which the feature will be executed
3679
- */
3680
- scope?: A_Scope): Promise<any> | void;
3681
- }
3682
-
3683
- /**
3684
- * Scope constructor type
3685
- * Uses the generic type T to specify the type of the Scope
3686
- */
3687
- type A_TYPES__Scope_Constructor<T = A_Scope> = A_TYPES__Ctor<T>;
3688
- /**
3689
- * Scope initialization type
3690
- */
3691
- type A_TYPES__Scope_Init<_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[]> = {
3692
- /**
3693
- * Scope Name
3694
- */
3695
- name: string;
3696
- /**
3697
- * A list of Context Fragments available in the Scope
3698
- */
3699
- fragments: [..._FragmentType];
3700
- /**
3701
- * A set of Components available in the Scope
3702
- */
3703
- components: [..._ComponentType];
3704
- /**
3705
- * A set of Errors available in the Scope
3706
- */
3707
- errors: [..._ErrorType];
3708
- /**
3709
- * A set of Entities available in the Scope
3710
- *
3711
- */
3712
- entities: [
3713
- ..._EntityType,
3714
- ...InstanceType<_EntityType[number]>[]
3715
- ];
3716
- meta: Partial<_MetaItems>;
3717
- };
3718
- /**
3719
- * Scope configuration type
3720
- */
3721
- type A_TYPES__ScopeConfig = {
3722
- /**
3723
- * Allows to define a parent to take dependencies from in case of the current scope does not have the required component
3724
- */
3725
- parent: A_Scope;
3726
- };
3727
- /**
3728
- * Scope serialized type
3729
- */
3730
- type A_TYPES__Scope_Serialized = {};
3731
- /**
3732
- * A list of constructors that can have a scope associated with them
3733
- */
3734
- type A_TYPES__ScopeLinkedConstructors = A_TYPES__Container_Constructor | A_TYPES__Feature_Constructor;
3735
- /**
3736
- * A list of components that can have a scope associated with them
3737
- */
3738
- type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature;
3739
- /**
3740
- * A list of components that are dependent on a scope and do not have their own scope
3741
- */
3742
- type A_TYPES_ScopeDependentComponents = A_Component | A_Entity | A_Fragment | A_Error;
3743
- /**
3744
- * A list of components that are independent of a scope. They don't need a scope to be resolved
3745
- * Those components haven't scope dependent features.
3746
- */
3747
- type A_TYPES_ScopeIndependentComponents = A_Error | A_Scope | A_Caller;
3748
-
3749
- declare class A_ComponentMeta<T extends A_TYPES__ComponentMeta = A_TYPES__ComponentMeta> extends A_Meta<T> {
3750
- /**
3751
- * Allows to get all the injections for a given handler
3752
- *
3753
- * @param handler
3754
- * @returns
3755
- */
3756
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3757
- /**
3758
- * Allows to get all the extensions for a given feature
3759
- *
3760
- * @param feature
3761
- * @returns
3762
- */
3763
- extensions(feature: string): A_TYPES__ComponentMetaExtension[];
3764
- /**
3765
- * Returns all features defined in the Component
3766
- *
3767
- * @returns
3768
- */
3769
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3770
- /**
3771
- * Returns a set of instructions to run proper methods in Component during A-Concept Stage
3772
- *
3773
- * @param stage
3774
- * @returns
3775
- */
3776
- abstractions(abstraction: any): A_TYPES__ConceptAbstractionMeta[];
3777
- }
3778
-
3779
- declare class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
3780
- /**
3781
- * Allows to get all the injections for a given handler
3782
- *
3783
- * @param handler
3784
- * @returns
3785
- */
3786
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3787
- /**
3788
- * Returns all features defined in the Container
3789
- *
3790
- * @returns
3791
- */
3792
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3793
- /**
3794
- * Returns a set of instructions to run proper methods in Container during A-Concept Stage
3795
- *
3796
- * @param stage
3797
- * @returns
3798
- */
3799
- abstractions(abstraction: A_TYPES__ConceptAbstractions): A_TYPES__ConceptAbstractionMeta[];
3800
- /**
3801
- * Allows to get all the extensions for a given feature
3802
- *
3803
- * @param feature
3804
- * @returns
3805
- */
3806
- extensions(feature: string): A_TYPES__ContainerMetaExtension[];
3807
- }
3808
-
3809
- declare class A_EntityMeta extends A_Meta<A_TYPES__EntityMeta> {
3810
- /**
3811
- * Returns all features defined in the Container
3812
- *
3813
- * @returns
3814
- */
3815
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3816
- /**
3817
- * Allows to get all the injections for a given handler
3818
- *
3819
- * @param handler
3820
- * @returns
3821
- */
3822
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3823
- }
3824
-
3825
- type A_TYPES__ContextEnvironment = 'server' | 'browser' | 'mobile' | 'desktop' | 'embedded' | 'unknown';
3826
- type A_TYPES__FeatureExtendableMeta = A_ContainerMeta | A_ComponentMeta | A_EntityMeta;
3827
-
3828
- export { A_StepsManager as $, A_Scope as A, type A_TYPES__A_DependencyResolutionStrategy as B, type A_TYPES__A_InjectDecoratorReturn as C, type A_TYPES__Error_Constructor as D, type A_TYPES__Feature_Constructor as E, type A_TYPES__Scope_Constructor as F, type A_TYPES__A_DependencyInjectable as G, A_Dependency as H, type A_TYPES__DeepPartial as I, type A_TYPES__ScopeLinkedConstructors as J, type A_TYPES__AbstractionAvailableComponents as K, type A_TYPES__InjectableTargets as L, type A_TYPES__FeatureExtendDecoratorTarget as M, type A_TYPES__Error_Init as N, type A_TYPES__Error_Serialized as O, A_Concept as P, A_Abstraction as Q, A_Abstraction_Extend as R, ASEID as S, A_FeatureError as T, A_Feature_Define as U, A_Feature_Extend as V, A_Stage as W, A_StageError as X, A_Dependency_Require as Y, A_Dependency_Load as Z, A_Dependency_Default as _, type A_TYPES__ContextEnvironment as a, type A_TYPES__Meta_Constructor as a$, type A_TYPES__ObjectKeyEnum as a0, type A_TYPES__Dictionary as a1, type A_TYPES__NonObjectPaths as a2, type A_TYPES__Paths as a3, type A_TYPES__UnionToIntersection as a4, type A_TYPES__PathsToObject as a5, type A_TYPES__Required as a6, type A_TYPES__ExtractNested as a7, type A_TYPES__ExtractProperties as a8, type A_TYPES__FeatureExtendableMeta as a9, type A_TYPES__AbstractionDecoratorConfig as aA, type A_TYPES__ASEID_Constructor as aB, type A_TYPES__ASEID_ConstructorConfig as aC, type A_TYPES__ASEID_JSON as aD, type A_TYPES__Feature_Init as aE, type A_TYPES__Feature_InitWithComponent as aF, type A_TYPES__Feature_InitWithTemplate as aG, type A_TYPES__Feature_Serialized as aH, A_TYPES__FeatureState as aI, type A_TYPES__FeatureError_Init as aJ, type A_TYPES__FeatureAvailableConstructors as aK, type A_TYPES__FeatureDefineDecoratorDescriptor as aL, type A_TYPES__FeatureDefineDecoratorConfig as aM, type A_TYPES__FeatureDefineDecoratorTemplateItem as aN, type A_TYPES__FeatureDefineDecoratorTarget as aO, type A_TYPES__FeatureDefineDecoratorMeta as aP, type A_TYPES__FeatureExtendDecoratorDescriptor as aQ, type A_TYPES__FeatureExtendDecoratorConfig as aR, type A_TYPES__FeatureExtendDecoratorScopeConfig as aS, type A_TYPES__FeatureExtendDecoratorScopeItem as aT, type A_TYPES__FeatureExtendDecoratorMeta as aU, A_TYPES__A_Stage_Status as aV, type A_TYPES_StageExecutionBehavior as aW, type A_TYPES__Stage_Serialized as aX, type A_TYPES__A_StageStepProcessingExtraParams as aY, type A_TYPES__Scope_Serialized as aZ, type A_TYPES_ScopeIndependentComponents as a_, type A_TYPES__Concept_Constructor as aa, type A_TYPES__Concept_Init as ab, type A_TYPES__Concept_Serialized as ac, type A_TYPES__ConceptAbstractionMeta as ad, type A_TYPES__ConceptAbstraction as ae, A_TYPES__ConceptMetaKey as af, type A_TYPES__Container_Init as ag, type A_TYPES__Container_Serialized as ah, type A_TYPES__ContainerMeta as ai, type A_TYPES__ContainerMetaExtension as aj, A_TYPES__ContainerMetaKey as ak, type A_TYPES__Component_Init as al, type A_TYPES__Component_Serialized as am, type A_TYPES__ComponentMeta as an, type A_TYPES__ComponentMetaExtension as ao, A_TYPES__ComponentMetaKey as ap, type A_TYPES__IEntity as aq, type A_TYPES__Entity_Init as ar, type A_TYPES__Entity_Serialized as as, type A_TYPES__EntityMeta as at, A_TYPES__EntityMetaKey as au, A_TYPES__EntityFeatures as av, type A_TYPES__Abstraction_Constructor as aw, type A_TYPES__Abstraction_Init as ax, type A_TYPES__Abstraction_Serialized as ay, type A_TYPES__AbstractionDecoratorDescriptor as az, type A_TYPES__ScopeLinkedComponents as b, type A_TYPES__Fragment_Init as b0, type A_TYPES__Fragment_Serialized as b1, type A_TYPES__A_DependencyConstructor as b2, type A_TYPES__A_DependencyResolutionType as b3, type A_TYPES__A_Dependency_Serialized as b4, type A_TYPES__A_Dependency_EntityResolutionConfig as b5, type A_TYPES__A_Dependency_EntityInjectionQuery as b6, type A_TYPES__A_Dependency_EntityInjectionPagination as b7, type A_TYPES__A_Dependency_RequireDecoratorReturn as b8, type A_TYPES__A_Dependency_LoadDecoratorReturn as b9, type A_TYPES__A_Dependency_DefaultDecoratorReturn as ba, type A_TYPES__A_Dependency_ParentDecoratorReturn as bb, type A_TYPES__A_Dependency_FlatDecoratorReturn as bc, type A_TYPES__A_Dependency_AllDecoratorReturn as bd, type A_TYPES__A_InjectDecoratorDescriptor as be, type A_TYPES__A_InjectDecorator_Meta as bf, type A_TYPES_ScopeDependentComponents as c, type A_TYPES__MetaLinkedComponentConstructors as d, A_Meta as e, type A_TYPES__Scope_Init as f, type A_TYPES__ScopeConfig as g, A_ContainerMeta as h, type A_TYPES__Container_Constructor as i, A_Container as j, A_EntityMeta as k, type A_TYPES__Entity_Constructor as l, A_Entity as m, A_ComponentMeta as n, type A_TYPES__Component_Constructor as o, A_Component as p, type A_TYPES__Fragment_Constructor as q, A_Fragment as r, type A_TYPES__MetaLinkedComponents as s, type A_TYPES__Ctor as t, A_Feature as u, type A_TYPES__FeatureAvailableComponents as v, type A_TYPES__A_StageStep as w, A_TYPES__ConceptAbstractions as x, A_Error as y, A_Caller as z };