@adaas/a-concept 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts DELETED
@@ -1,4810 +0,0 @@
1
- declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES: {
2
- /**
3
- * Name of the application
4
- *
5
- * DEFAULT value is 'a-concept'
6
- *
7
- * [!] Provided name will be used for all aseids in the application by default
8
- */
9
- readonly A_CONCEPT_NAME: "A_CONCEPT_NAME";
10
- /**
11
- * Root scope of the application
12
- *
13
- * DEFAULT value is 'root'
14
- *
15
- * [!] Provided name will be used for all aseids in the application by default
16
- */
17
- readonly A_CONCEPT_ROOT_SCOPE: "A_CONCEPT_ROOT_SCOPE";
18
- /**
19
- * Environment of the application e.g. development, production, staging
20
- */
21
- readonly A_CONCEPT_ENVIRONMENT: "A_CONCEPT_ENVIRONMENT";
22
- /**
23
- * Root folder of the application
24
- * [!] Automatically set by A-Concept when the application starts
25
- */
26
- readonly A_CONCEPT_ROOT_FOLDER: "A_CONCEPT_ROOT_FOLDER";
27
- /**
28
- * Allows to define a default error description for errors thrown without a description
29
- */
30
- readonly A_ERROR_DEFAULT_DESCRIPTION: "A_ERROR_DEFAULT_DESCRIPTION";
31
- };
32
- type A_TYPES__ConceptENVVariables = (typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_CONSTANTS__DEFAULT_ENV_VARIABLES][];
33
- declare const A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_CONCEPT_NAME", "A_CONCEPT_ROOT_SCOPE", "A_CONCEPT_ENVIRONMENT", "A_CONCEPT_ROOT_FOLDER", "A_ERROR_DEFAULT_DESCRIPTION"];
34
-
35
- type Decrement = [never, 0, 1, 2, 3, 4, 5];
36
- type A_TYPES__Ctor<T> = new (...args: any[]) => T;
37
- type A_TYPES__DeepPartial<T, D extends number = 5> = {
38
- [P in keyof Required<T>]?: [
39
- D
40
- ] 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];
41
- };
42
- type A_TYPES__ObjectKeyEnum<T, E> = {
43
- [P in keyof Required<T>]?: T[P] extends object ? A_TYPES__ObjectKeyEnum<T[P], E> : E;
44
- };
45
- type A_TYPES__Dictionary<T> = {
46
- [Key: string]: T;
47
- };
48
- type A_TYPES__NonObjectPaths<T> = T extends object ? {
49
- [K in keyof T]: `${Exclude<K, symbol>}${""}`;
50
- }[keyof T] : never;
51
- type A_TYPES__Paths<T, D extends number = 5> = [D] extends [never] ? never : (T extends object ? {
52
- [K in keyof T]: `${Exclude<K, symbol>}${"" | `.${A_TYPES__Paths<T[K], Decrement[D]>}`}`;
53
- }[keyof T] : never);
54
- type A_TYPES__UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
55
- type A_TYPES__PathsToObject<_Obj, T extends readonly string[]> = A_TYPES__UnionToIntersection<{
56
- [K in keyof T]: T[K] extends `${infer Key}.${infer Rest}` ? {
57
- [P in Key]: P extends keyof _Obj ? A_TYPES__PathsToObject<Required<_Obj>[P], [Rest]> : any;
58
- } : {
59
- [P in T[K]]: `${T[K]}` extends keyof Required<_Obj> ? Required<_Obj>[`${T[K]}`] : never;
60
- };
61
- }[number]>;
62
- type A_TYPES__Required<T, arr extends (A_TYPES__Paths<T>)[] = (A_TYPES__Paths<T>)[]> = A_TYPES__PathsToObject<T, arr> & T;
63
- type A_TYPES__ExtractNested<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? {
64
- [Key in K]: A_TYPES__ExtractNested<T[K], Rest>;
65
- } : never : P extends keyof T ? {
66
- [Key in P]: T[P];
67
- } : never;
68
- type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__UnionToIntersection<{
69
- [K in keyof P]: P[K] extends string ? A_TYPES__ExtractNested<T, P[K]> : never;
70
- }[number]>;
71
-
72
- /**
73
- * Fragment constructor type
74
- * Uses the generic type T to specify the type of the fragment
75
- */
76
- type A_TYPES__Fragment_Constructor<T = A_Fragment> = A_TYPES__Ctor<T>;
77
- /**
78
- * Fragment initialization type
79
- */
80
- type A_TYPES__Fragment_Init = {
81
- name: string;
82
- };
83
- /**
84
- * Fragment serialized type
85
- */
86
- type A_TYPES__Fragment_Serialized = {
87
- /**
88
- * The Name of the fragment
89
- */
90
- name: string;
91
- };
92
-
93
- /**
94
- * A_Fragment is a core architectural component that represents a singleton execution context
95
- * within the A-Concept framework. It serves as a shared memory container that can be passed
96
- * between Components, Entities, and Commands throughout the application pipeline.
97
- *
98
- * Key Features:
99
- * - Singleton pattern: Only one instance per fragment type per scope
100
- * - Meta storage: Built-in key-value storage for pipeline data
101
- * - Type-safe: Full TypeScript generics support for meta items and serialization
102
- * - Serializable: Can be converted to JSON for persistence or transmission
103
- *
104
- * @template _MetaItems - Type definition for the meta storage structure
105
- * @template _SerializedType - Type definition for the serialized output format
106
- *
107
- * @example
108
- * ```typescript
109
- * // Basic usage with typed meta
110
- * class UserFragment extends A_Fragment<{ userId: string; role: string }> {
111
- * constructor() {
112
- * super({ name: 'UserFragment' });
113
- * }
114
- * }
115
- *
116
- * // Custom serialization
117
- * class SessionFragment extends A_Fragment<
118
- * { sessionId: string; timestamp: number },
119
- * { name: string; sessionData: string }
120
- * > {
121
- * toJSON() {
122
- * return {
123
- * name: this.name,
124
- * sessionData: `${this.get('sessionId')}-${this.get('timestamp')}`
125
- * };
126
- * }
127
- * }
128
- * ```
129
- */
130
- declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
131
- /**
132
- * The unique identifier/name for this fragment instance.
133
- * Used for identification and debugging purposes.
134
- */
135
- protected _name: string;
136
- /**
137
- * Creates a new A_Fragment instance.
138
- *
139
- * A_Fragment implements the singleton pattern for execution contexts, allowing
140
- * shared state management across different parts of the application pipeline.
141
- * Each fragment serves as a memory container that can store typed data and be
142
- * serialized for persistence or transmission.
143
- *
144
- * Key Benefits:
145
- * - Centralized state management for related operations
146
- * - Type-safe meta operations with full IntelliSense support
147
- * - Serialization support for data persistence
148
- * - Singleton pattern ensures consistent state within scope
149
- *
150
- * @param params - Initialization parameters
151
- * @param params.name - Optional custom name for the fragment (defaults to class name)
152
- *
153
- * @example
154
- * ```typescript
155
- * const fragment = new A_Fragment<{ userId: string }>({
156
- * name: 'UserSessionFragment'
157
- * });
158
- * fragment.set('userId', '12345');
159
- * ```
160
- */
161
- constructor(params?: Partial<A_TYPES__Fragment_Init>);
162
- /**
163
- * Gets the fragment's unique name/identifier.
164
- *
165
- * @returns The fragment name
166
- */
167
- get name(): string;
168
- /**
169
- * Serializes the fragment to a JSON-compatible object.
170
- *
171
- * This method combines the fragment's name with all meta data to create
172
- * a serializable representation. The return type is determined by the
173
- * _SerializedType generic parameter, allowing for custom serialization formats.
174
- *
175
- * @returns A serialized representation of the fragment
176
- *
177
- * @example
178
- * ```typescript
179
- * const fragment = new A_Fragment<{ userId: string, role: string }>({
180
- * name: 'UserFragment'
181
- * });
182
- * fragment.set('userId', '12345');
183
- * fragment.set('role', 'admin');
184
- *
185
- * const json = fragment.toJSON();
186
- * // Result: { name: 'UserFragment', userId: '12345', role: 'admin' }
187
- * ```
188
- */
189
- toJSON(): _SerializedType;
190
- }
191
-
192
- declare class A_Container {
193
- /**
194
- * Configuration of the container that will be used to run it.
195
- */
196
- protected readonly config: Partial<A_TYPES__Container_Init>;
197
- /**
198
- * Name of the container
199
- */
200
- get name(): string;
201
- /**
202
- * Returns the scope where the container is registered
203
- */
204
- get scope(): A_Scope;
205
- /**
206
- * This class should combine Components to achieve the goal withing Concept
207
- *
208
- * Container is a direct container that should be "run" to make Concept work.
209
- * So because of that Container can be:
210
- * - HTTP Server
211
- * - BASH Script
212
- * - Database Connection
213
- * - Microservice
214
- * - etc.
215
- *
216
- * @param config - Configuration of the container that will be used to run it.
217
- */
218
- constructor(
219
- /**
220
- * Configuration of the container that will be used to run it.
221
- */
222
- config?: Partial<A_TYPES__Container_Init>);
223
- /**
224
- * Calls the feature with the given name in the given scope
225
- *
226
- * [!] Note: This method creates a new instance of the feature every time it is called
227
- *
228
- * @param feature - the name of the feature to call
229
- * @param scope - the scope in which to call the feature
230
- * @returns - void
231
- */
232
- call(
233
- /**
234
- * Name of the feature to call
235
- */
236
- feature: string,
237
- /**
238
- * scope in which the feature will be executed
239
- */
240
- scope?: A_Scope): Promise<void>;
241
- }
242
-
243
- declare enum A_TYPES__ConceptAbstractions {
244
- /**
245
- * Run the concept.
246
- */
247
- Run = "run",
248
- /**
249
- * Build the concept.
250
- */
251
- Build = "build",
252
- /**
253
- * Publish the concept.
254
- */
255
- Publish = "publish",
256
- /**
257
- * Deploy the concept.
258
- */
259
- Deploy = "deploy",
260
- /**
261
- * Load the concept.
262
- */
263
- Load = "load",
264
- /**
265
- * Start the concept.
266
- */
267
- Start = "start",
268
- /**
269
- * Stop the concept.
270
- */
271
- Stop = "stop"
272
- }
273
- declare enum A_TYPES__ConceptMetaKey {
274
- LIFECYCLE = "a-component-extensions"
275
- }
276
-
277
- /**
278
- * This is a common class that uses to return an entity that initiates a feature call
279
- *
280
- * It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
281
- *
282
- * [!] the class itself may be retrieved, but may require additional processing inside the feature
283
- *
284
- */
285
- declare class A_Caller<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
286
- /**
287
- * The component that initiated the feature call
288
- */
289
- protected _component: T;
290
- /**
291
- * A_Caller allows to get the component that initiated the feature call
292
- *
293
- * It can be used then in @A_Inject(A_Caller) to get the entity that initiated the feature call
294
- *
295
- * [!] If Scope is not provided, a new empty scope will be created and inherited from the global scope
296
- *
297
- * @param component
298
- * @param scope
299
- */
300
- constructor(component: T);
301
- get component(): T;
302
- /**
303
- * Validates the provided parameters and Ensures that the component is of an allowed type
304
- *
305
- * @param component
306
- */
307
- protected validateParams(component: T): void;
308
- }
309
-
310
- /**
311
- * Entity constructor type
312
- * Uses the generic type T to specify the type of the entity
313
- */
314
- type A_TYPES__Error_Constructor<T = A_Error> = A_TYPES__Ctor<T>;
315
- /**
316
- * Error initialization type
317
- */
318
- type A_TYPES__Error_Init = {
319
- /**
320
- * Error title
321
- *
322
- * A short description of the error
323
- */
324
- title: string;
325
- /**
326
- * Error code representing the type of error
327
- *
328
- * Should be unique within the application or service
329
- *
330
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
331
- *
332
- * [!] Note: It is recommended to use kebab-case for error codes
333
- * [!] Note: If not provided would be used a kebab-case message of the error
334
- */
335
- code?: string;
336
- /**
337
- * Possible Scope if needed to identify the error by it's execution environment
338
- *
339
- * For example, error of type 'validation' could happen in different scopes
340
- * like 'user', 'admin', 'system' etc. This will help to identify the error context better
341
- *
342
- * Could be string or A_Scope instance
343
- *
344
- * [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
345
- */
346
- scope?: string | A_Scope;
347
- /**
348
- * Detailed description of the error
349
- */
350
- description?: string;
351
- /**
352
- * Link to the documentation or support page for the error
353
- */
354
- link?: string;
355
- /**
356
- * Original Error if any
357
- */
358
- originalError?: Error | unknown;
359
- };
360
- /**
361
- * Error serialized type
362
- */
363
- type A_TYPES__Error_Serialized = {
364
- /**
365
- * ASEID of the error
366
- */
367
- aseid: string;
368
- /**
369
- * A brief title of the error
370
- */
371
- title: string;
372
- /**
373
- * Error message
374
- */
375
- message: string;
376
- /**
377
- * Type of the error
378
- */
379
- type: string;
380
- /**
381
- * Error code
382
- */
383
- code: string;
384
- /**
385
- * Error description
386
- */
387
- description: string;
388
- /**
389
- * Link to documentation or support page
390
- */
391
- link?: string;
392
- /**
393
- * Scope of the error
394
- */
395
- scope: string;
396
- /**
397
- * Original error message if any
398
- */
399
- originalError?: string;
400
- };
401
-
402
- interface A_TYPES__ASEID_Constructor {
403
- /**
404
- * Concept for the ASEID
405
- * Generally it is the application name or code, should correspond to the concept where the entity is used
406
- * Could be ID or ASEID
407
- */
408
- concept?: string;
409
- /**
410
- * Entity Scope the primary location of the resource
411
- * Organization, or organization Unit or Internal/External
412
- * Could be ID or ASEID
413
- *
414
- */
415
- scope: number | 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: number | 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
- interface A_TYPES__ASEID_ConstructorConfig {
434
- /**
435
- * If true, the entity ASEID will be distributed across multiple shards.
436
- * In this case SHARD should be provided via Environment Variables (A_SHARD) or Configurations
437
- *
438
- */
439
- sharding?: boolean;
440
- }
441
- type A_TYPES__ASEID_JSON = {
442
- /**
443
- * Concept for the ASEID
444
- */
445
- concept: string;
446
- /**
447
- * Entity Scope the primary location of the resource
448
- */
449
- scope: string;
450
- /**
451
- * Entity Type the type of the resource
452
- */
453
- entity: string;
454
- /**
455
- * Entity ID the unique identifier of the resource
456
- */
457
- id: string;
458
- /**
459
- * Version of the entity (optional)
460
- */
461
- version?: string;
462
- /**
463
- * Shard of the entity (optional)
464
- */
465
- shard?: string;
466
- };
467
-
468
- declare class ASEID {
469
- /**
470
- * ASEID Regular Expression
471
- */
472
- static readonly regexp: RegExp;
473
- /**
474
- * Tests if the identity string is an ASEID
475
- *
476
- * @param identity
477
- * @returns
478
- */
479
- static isASEID(identity: string): boolean;
480
- static compare(aseid1: ASEID | string | undefined, aseid2: ASEID | string | undefined): boolean;
481
- /**
482
- * Concept for the ASEID
483
- * Generally it is the application name or code, should correspond to the concept where the entity is used
484
- * Could be ID or ASEID
485
- */
486
- private _concept;
487
- /**
488
- * Entity Scope the primary location of the resource
489
- * Organization, or organization Unit
490
- * Could be ID or ASEID
491
- *
492
- */
493
- private _scope;
494
- /**
495
- * Entity Type the type of the resource
496
- */
497
- private _entity;
498
- /**
499
- * Entity ID the unique identifier of the resource
500
- */
501
- private _id;
502
- /**
503
- * Version of the entity (optional)
504
- */
505
- private _version?;
506
- /**
507
- * Shard of the entity (optional)
508
- */
509
- private _shard?;
510
- /**
511
- * ASEID is a structured identifier for entities in the A-Concept system.
512
- * using the format:
513
- * A - A-Concept
514
- * S - System
515
- * E - Entity
516
- * I - Identifier
517
- * D - iDentifier
518
- *
519
- * Structure: CONCEPT_NAME + @ + SCOPE + : ENTITY_NAME + : + ID + @ + VERSION
520
- *
521
- * Example:
522
- * - root@core:usr:0000000001
523
- *
524
- * [!] Concept is optional, if not provided will be used the current concept name
525
- * [!] Scope is optional, if not provided will be used the root scope of the current concept
526
- * [!] Version is optional, if not provided will be considered as latest version
527
- *
528
- * @param aseid - ASEID string representation or ASEID components as object
529
- */
530
- constructor(
531
- /**
532
- * ASEID string representation
533
- */
534
- aseid: string);
535
- constructor(
536
- /**
537
- * ASEID components as object
538
- */
539
- props: A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>);
540
- /**
541
- * Getters for ASEID components
542
- */
543
- get concept(): string;
544
- /**
545
- * Get the scope of the ASEID
546
- */
547
- get scope(): string;
548
- /**
549
- * Get the entity of the ASEID
550
- */
551
- get entity(): string;
552
- /**
553
- * Get the id of the ASEID
554
- */
555
- get id(): string;
556
- /**
557
- * Get the version of the ASEID (if any)
558
- */
559
- get version(): string | undefined;
560
- /**
561
- * Get the shard of the ASEID (if any)
562
- */
563
- get shard(): string | undefined;
564
- /**
565
- * Get the hash of the ASEID, Unique identifier based on the ASEID string
566
- * Useful when aseid details should not be exposed directly
567
- */
568
- get hash(): string;
569
- /**
570
- * get Internal Initializer based on the type of the parameter provided
571
- *
572
- * @param param1
573
- * @returns
574
- */
575
- private getInitializer;
576
- /**
577
- * Initialize ASEID from string
578
- *
579
- * @param param1
580
- */
581
- private fromString;
582
- /**
583
- * Initialize ASEID from object
584
- *
585
- * @param param1
586
- */
587
- private fromObject;
588
- /**
589
- * String representation of the ASEID
590
- *
591
- * @returns
592
- */
593
- toString(): string;
594
- /**
595
- * JSON representation of the ASEID
596
- *
597
- * @returns
598
- */
599
- toJSON(): A_TYPES__ASEID_JSON;
600
- protected verifyInput(param1: string | A_TYPES__Required<Partial<A_TYPES__ASEID_Constructor>, ['id', 'entity']>): void;
601
- }
602
-
603
- declare class A_Error<_ConstructorType extends A_TYPES__Error_Init = A_TYPES__Error_Init, _SerializedType extends A_TYPES__Error_Serialized = A_TYPES__Error_Serialized> extends Error {
604
- /**
605
- * Error Identifier that corresponds to the class name
606
- */
607
- static get entity(): string;
608
- /**
609
- * DEFAULT Namespace of the error from environment variable A_CONCEPT_NAMESPACE
610
- *
611
- * [!] If environment variable is not set, it will default to 'a-concept'
612
- */
613
- static get concept(): string;
614
- /**
615
- * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
616
- *
617
- * [!] If environment variable is not set, it will default to 'core'
618
- * [!] Scope is an application specific identifier that can be used to group entities together
619
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
620
- */
621
- static get scope(): string;
622
- /**
623
- * ASEID of the error instance
624
- */
625
- protected _aseid: ASEID;
626
- /**
627
- * Title of the error
628
- */
629
- protected _title: string;
630
- /**
631
- * Possible Scope if needed to identify the error by it's execution environment
632
- */
633
- protected _scope?: string;
634
- /**
635
- * Unique code representing the type of error
636
- */
637
- protected _code?: string;
638
- /**
639
- * Detailed description of the error
640
- */
641
- protected _description?: string;
642
- /**
643
- * Original Error if any
644
- */
645
- protected _originalError?: Error | any;
646
- /**
647
- * Link to the documentation or support page for the error
648
- */
649
- protected _link?: string;
650
- /**
651
- * A_Error is a custom error class for A_Concept framework.
652
- * This error allows to have more structured error handling.
653
- * Each error has a unique code, description and a link to the documentation.
654
- *
655
- * Example of usage:
656
- * ```typescript
657
- *
658
- * // 1) all parameters will be used as provided
659
- * throw new A_Error({
660
- * message: 'User not found',
661
- * code: 'USER_NOT_FOUND',
662
- * description: 'The user with the given ID was not found.',
663
- * link: 'https://support.adaas.org/error/USER_NOT_FOUND'
664
- * });
665
- *
666
- * // or
667
- * // 2) only message is provided, other parameters will be set to default values:
668
- * // - code: 'user-not-found' (kebab-case of the message)
669
- * // - description: 'User not found' (same as message)
670
- * // - link: Empty
671
- * throw new A_Error('User not found');
672
- *
673
- * // or
674
- * // 3) Provided Message and Description, other parameters will be set to default values:
675
- * // - code: 'user-not-found' (kebab-case of the message)
676
- * // - description: 'The user with the given ID was not found.' (as provided)
677
- * // - link: Empty
678
- * throw new A_Error('User not found', 'The user with the given ID was not found.');
679
- *
680
- *
681
- * ```
682
- * [!] Note: The behavior of A_Error is similar to the A_Entity however it cannot have own A_Features.
683
- * [!] Note: This class can be inherited to create custom error classes.
684
- *
685
- * @param message
686
- */
687
- constructor(
688
- /**
689
- * A_Error Constructor params
690
- */
691
- params: _ConstructorType);
692
- constructor(
693
- /**
694
- * Error message
695
- */
696
- message: string);
697
- constructor(
698
- /**
699
- * Original JS Error
700
- */
701
- error: Error);
702
- constructor(
703
- /**
704
- * Original JS Error
705
- */
706
- error: unknown);
707
- constructor(
708
- /**
709
- * Error message
710
- */
711
- title: string,
712
- /**
713
- * Detailed description of the error
714
- */
715
- description: string);
716
- /**
717
- * Returns the ASEID of the error instance
718
- */
719
- get aseid(): ASEID;
720
- /**
721
- * Returns the title of the error
722
- *
723
- * Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
724
- *
725
- * [!] Note: This title should be short and concise, less than 60 characters
726
- * [!] Note: If title exceeds 60 characters, there would be an error thrown
727
- * [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
728
- */
729
- get title(): string;
730
- /**
731
- * Returns an Error message what is a brief title of the error
732
- *
733
- */
734
- get message(): string;
735
- /**
736
- * Returns a unique code representing the type of error
737
- *
738
- * If code is not provided, it will generate a kebab-case of the message
739
- *
740
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
741
- *
742
- * [!] Note: It is recommended to use kebab-case for error codes
743
- * [!] Note: If not provided would be used a kebab-case message of the error
744
- */
745
- get code(): string;
746
- /**
747
- * Returns the type of the error which corresponds to the static entity of the class
748
- *
749
- * Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
750
- *
751
- * Defaults to the kebab-case of the class name
752
- *
753
- * [!] Note: naming ad separation are fully dependent on the architecture of the application
754
- * [!] Note: It is recommended to use kebab-case for error types
755
- * [!] Note: This type is intended to group similar errors together
756
- */
757
- get type(): string;
758
- /**
759
- * Returns a link with possible documentation or support page for the error
760
- * If link is not provided, it will generate a link based on the ASEID of the error that points to the A-Concept support page
761
- *
762
- * Example: https://adaas.support/a-concept/errors/{ASEID}
763
- *
764
- * [!] Note: ASEID is generated based on the static properties of the class (concept, scope, entity) and the code of the error
765
- */
766
- get link(): string;
767
- /**
768
- * The scope name of the error instance
769
- *
770
- * If scope is not provided, it will use the static scope of the class
771
- *
772
- * [!] Note: Scope is an application specific identifier that can be used to group entities together
773
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
774
- */
775
- get scope(): string;
776
- /**
777
- * A detailed description of the error
778
- * If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
779
- *
780
- * Example: 'The user with the given ID was not found.', 'The provided data is invalid.', 'You do not have permission to access this resource.', etc.
781
- *
782
- * [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
783
- */
784
- get description(): string;
785
- /**
786
- * Returns the original error if any
787
- *
788
- * This can be useful for debugging purposes to see the original stack trace or error message
789
- *
790
- * [!] Note: Original error is optional and may not be present in all cases
791
- */
792
- get originalError(): Error | any | undefined;
793
- /**
794
- * Determines which initializer method to use based on the type of the first parameter.
795
- *
796
- * @param param1
797
- * @returns
798
- */
799
- protected getInitializer(param1: _ConstructorType | Error | string | any, param2?: string): (param1: any, param2: any) => void | (() => void);
800
- /**
801
- * Initializes the A_Error instance from a standard Error object.
802
- *
803
- * @param error
804
- */
805
- protected fromError(error: Error): void;
806
- /**
807
- * Initializes the A_Error instance from a message.
808
- *
809
- * @param title
810
- * @param description
811
- */
812
- protected fromMessage(message: string): void;
813
- /**
814
- * Initializes the A_Error instance from a serialized object.
815
- *
816
- * @param serialized
817
- */
818
- protected fromJSON(serialized: _SerializedType): void;
819
- fromTitle(title: string, description: string): void;
820
- /**
821
- * Initializes the A_Error instance from a constructor parameters object.
822
- *
823
- * @param params
824
- */
825
- protected fromConstructor(params: _ConstructorType): void;
826
- /**
827
- * Serializes the A_Error instance to a plain object.
828
- *
829
- *
830
- * @returns
831
- */
832
- toJSON(): _SerializedType;
833
- /**
834
- * Checks if the provided title exceeds 60 characters.
835
- * If it does, throws a validation A_Error.
836
- *
837
- * @param title
838
- */
839
- protected validateTitle(title: string): void;
840
- }
841
-
842
- /**
843
- * A-Feature decorator
844
- *
845
- * This decorator allows to define a custom lifecycle stage for the Container.
846
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
847
- * This approach allows to create a flexible and extendable architecture for the application.
848
- *
849
- * The main difference between the A-Feature and A-Feature decorators is that A-Feature methods can be inherited and overridden by child classes.
850
- *
851
- *
852
- * @param params
853
- * @returns
854
- */
855
- declare function A_Feature_Define(config?: Partial<A_TYPES__FeatureDefineDecoratorConfig>): (target: A_TYPES__FeatureDefineDecoratorTarget, propertyKey: string, descriptor: A_TYPES__FeatureDefineDecoratorDescriptor) => A_TYPES__FeatureDefineDecoratorDescriptor;
856
-
857
- /**
858
- * A-Extend decorator
859
- *
860
- * This decorator allows to define a custom Extend stage for the Container.
861
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
862
- * This approach allows to create a flexible and extendable architecture for the application.
863
- *
864
- * The main difference between the A-Extend and A-Extend decorators is that A-Extend methods can be inherited and overridden by child classes.
865
- *
866
- *
867
- * @param params
868
- * @returns
869
- */
870
- /**
871
- * Use regexp in case if you need more flexibility and control over the name of the method
872
- *
873
- * @param regexp
874
- */
875
- declare function A_Feature_Extend(
876
- /**
877
- * The regular expression to match the name of the Feature method to be extended
878
- *
879
- * Example:
880
- *
881
- * ```ts
882
- * @A_Feature.Extend(/.*\.load/)
883
- * ```
884
- */
885
- regexp: RegExp): any;
886
- /**
887
- * In this case the name configurations will be used as an input to get scope and name of target function
888
- * [!] Not that for all SCOPE will be used OR operator
889
- *
890
- * @param config
891
- */
892
- declare function A_Feature_Extend(
893
- /**
894
- * Configuration for the A-Feature-Extend decorator
895
- */
896
- config: Partial<A_TYPES__FeatureExtendDecoratorConfig>): any;
897
- /**
898
- * In this case the name of function will be used as a name of the Feature.
899
- * [!] AND it will be applicable for ANY element where the name is the same as the name of the function
900
- */
901
- declare function A_Feature_Extend(): any;
902
-
903
- declare class A_Stage {
904
- /**
905
- * The feature that owns this stage
906
- */
907
- private readonly _feature;
908
- /**
909
- * Initial Instructions to process the stage
910
- */
911
- private readonly _definition;
912
- /**
913
- * Possible errors during stage processing
914
- */
915
- private _error?;
916
- /**
917
- * Indicates the current status of the stage
918
- */
919
- private _status;
920
- /**
921
- * A_Stage is a callable A_Function within A_Feature that should be run with specific parameters.
922
- * [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
923
- *
924
- * A-Stage is a common object that uses to simplify logic and re-use of A-Feature internals for better composition.
925
- */
926
- constructor(
927
- /**
928
- * The feature that owns this stage
929
- */
930
- feature: A_Feature,
931
- /**
932
- * The step definitions of the stage
933
- */
934
- step: A_TYPES__A_StageStep);
935
- /**
936
- * Returns the name of the stage
937
- */
938
- get name(): string;
939
- /**
940
- * Returns the definition of the stage
941
- */
942
- get definition(): A_TYPES__A_StageStep;
943
- /**
944
- * Returns the current status of the stage
945
- */
946
- get status(): A_TYPES__A_Stage_Status;
947
- /**
948
- * Returns the feature that owns this stage
949
- */
950
- get feature(): A_Feature;
951
- /**
952
- * Returns true if the stage is processed (completed, failed, or skipped)
953
- */
954
- get isProcessed(): boolean;
955
- /**
956
- * Returns the error of the stage
957
- */
958
- get error(): A_Error | undefined;
959
- /**
960
- * Resolves the arguments of the step
961
- *
962
- * @param step
963
- * @returns
964
- */
965
- 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)[];
966
- /**
967
- * Resolves the component of the step
968
- *
969
- * @param step
970
- * @returns
971
- */
972
- protected getStepComponent(scope: A_Scope, step: A_TYPES__A_StageStep): A_TYPES__A_DependencyInjectable;
973
- /**
974
- * Calls the handler of the step
975
- *
976
- * @param step
977
- * @returns
978
- */
979
- protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): {
980
- handler: Function;
981
- params: any[];
982
- };
983
- skip(): void;
984
- /**
985
- * This method processes the stage by executing all the steps
986
- *
987
- * @param scope - Scope to be used to resolve the steps dependencies
988
- */
989
- process(
990
- /**
991
- * Scope to be used to resolve the steps dependencies
992
- */
993
- scope?: A_Scope): Promise<void> | void;
994
- protected completed(): void;
995
- protected failed(error: Error | A_Error | any): void;
996
- /**
997
- * Serializes the stage to JSON
998
- *
999
- */
1000
- toJSON(): A_TYPES__Stage_Serialized;
1001
- /**
1002
- * Returns a string representation of the stage
1003
- *
1004
- * @returns
1005
- */
1006
- toString(): string;
1007
- }
1008
-
1009
- declare class A_StepsManager {
1010
- entities: A_TYPES__A_StageStep[];
1011
- graph: Map<string, Set<string>>;
1012
- visited: Set<string>;
1013
- tempMark: Set<string>;
1014
- sortedEntities: string[];
1015
- private _isBuilt;
1016
- constructor(entities: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>);
1017
- private prepareSteps;
1018
- private ID;
1019
- private buildGraph;
1020
- private matchEntities;
1021
- private visit;
1022
- toSortedArray(): Array<string>;
1023
- toStages(feature: A_Feature): Array<A_Stage>;
1024
- }
1025
-
1026
- declare class A_StageError extends A_Error {
1027
- static readonly ArgumentsResolutionError = "A-Stage Arguments Resolution Error";
1028
- static get CompileError(): string;
1029
- }
1030
-
1031
- declare class A_FeatureError extends A_Error<A_TYPES__FeatureError_Init> {
1032
- /**
1033
- * Indicates that the Feature has been interrupted
1034
- */
1035
- static readonly Interruption = "Feature Interrupted";
1036
- /**
1037
- * Indicates that there was an error initializing the Feature
1038
- *
1039
- * Failed during the A-Feature initialization process
1040
- */
1041
- static readonly FeatureInitializationError = "Unable to initialize A-Feature";
1042
- /**
1043
- * Indicates that there was an error processing the Feature
1044
- *
1045
- * Failed during the A-Feature processing
1046
- */
1047
- static readonly FeatureProcessingError = "Error occurred during A-Feature processing";
1048
- /**
1049
- * Indicates that there was an error defining the Feature
1050
- *
1051
- * Failed during the @A_Feature.Define() decorator execution
1052
- */
1053
- static readonly FeatureDefinitionError = "Unable to define A-Feature";
1054
- /**
1055
- * Indicates that there was an error extending the Feature
1056
- *
1057
- * Failed during the @A_Feature.Extend() decorator execution
1058
- */
1059
- static readonly FeatureExtensionError = "Unable to extend A-Feature";
1060
- /**
1061
- * Stage where the error occurred
1062
- */
1063
- stage?: A_Stage;
1064
- protected fromConstructor(params: A_TYPES__FeatureError_Init): void;
1065
- }
1066
-
1067
- /**
1068
- * A_Feature is representing a feature that can be executed across multiple components
1069
- * This class stores the steps of the feature and executes them in order of appearance
1070
- *
1071
- * Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
1072
- * across the different, distributed components
1073
- *
1074
- */
1075
- declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
1076
- /**
1077
- * Define a new A-Feature
1078
- */
1079
- static get Define(): typeof A_Feature_Define;
1080
- /**
1081
- * Extend an existing A-Feature
1082
- */
1083
- static get Extend(): typeof A_Feature_Extend;
1084
- /**
1085
- * The name of the Feature
1086
- */
1087
- protected _name: string;
1088
- /**
1089
- * List of stages that are part of this Feature
1090
- */
1091
- protected _stages: Array<A_Stage>;
1092
- /**
1093
- * The Stage currently being processed
1094
- */
1095
- protected _current?: A_Stage;
1096
- /**
1097
- * Actual Index of the current Stage being processed
1098
- */
1099
- protected _index: number;
1100
- /**
1101
- * Steps Manager to organize the steps into stages
1102
- */
1103
- protected _SM: A_StepsManager;
1104
- /**
1105
- * The Caller that initiated the Feature call
1106
- */
1107
- protected _caller: A_Caller<T>;
1108
- /**
1109
- * The current state of the Feature
1110
- */
1111
- protected _state: A_TYPES__FeatureState;
1112
- /**
1113
- * The error that caused the Feature to be interrupted
1114
- */
1115
- protected _error?: A_FeatureError;
1116
- /**
1117
- * A-Feature is a pipeline distributed by multiple components that can be easily attached or detached from the scope.
1118
- * Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
1119
- *
1120
- * Comparing to A-Command Feature does not store any state except statuses for better analysis.
1121
- *
1122
- * [!] Note: If A-Feature should have result use A-Fragment
1123
- *
1124
- * @param params
1125
- */
1126
- constructor(
1127
- /**
1128
- * Feature Initialization parameters
1129
- */
1130
- params: A_TYPES__Feature_Init<T>);
1131
- /**
1132
- * The name of the Feature
1133
- */
1134
- get name(): string;
1135
- /**
1136
- * The error that caused the Feature to be interrupted
1137
- */
1138
- get error(): A_FeatureError | undefined;
1139
- /**
1140
- * The current state of the Feature
1141
- */
1142
- get state(): A_TYPES__FeatureState;
1143
- /**
1144
- * Sets the current state of the Feature
1145
- */
1146
- get index(): number;
1147
- /**
1148
- * Returns the current A-Feature Stage
1149
- */
1150
- get stage(): A_Stage | undefined;
1151
- /**
1152
- * The Caller that initiated the Feature call
1153
- */
1154
- get caller(): A_Caller<T>;
1155
- /**
1156
- * The Scope allocated for the Feature Execution
1157
- */
1158
- get scope(): A_Scope;
1159
- /**
1160
- * The number of stages in the feature
1161
- */
1162
- get size(): number;
1163
- /**
1164
- * This method checks if the A-Feature is done
1165
- *
1166
- * @returns
1167
- */
1168
- get isDone(): boolean;
1169
- /**
1170
- * Indicates whether the feature has been processed (completed, failed, or interrupted)
1171
- */
1172
- get isProcessed(): boolean;
1173
- /**
1174
- * Iterator to iterate over the steps of the feature
1175
- *
1176
- * @returns
1177
- */
1178
- [Symbol.iterator](): Iterator<A_Stage, any>;
1179
- /**
1180
- * Validates the provided parameters for A-Feature initialization
1181
- *
1182
- * @param params
1183
- */
1184
- protected validateParams(params: A_TYPES__Feature_Init<T>): void;
1185
- /**
1186
- * Returns the appropriate initializer method based on the provided parameters
1187
- *
1188
- * @param params
1189
- * @returns
1190
- */
1191
- protected getInitializer(params: A_TYPES__Feature_Init<T>): (param1: any) => void | (() => void);
1192
- /**
1193
- * Initializes the A-Feature from the provided template
1194
- *
1195
- * @param params
1196
- */
1197
- protected fromTemplate(params: A_TYPES__Feature_InitWithTemplate<T>): void;
1198
- /**
1199
- * Initializes the A-Feature from the provided component
1200
- *
1201
- * @param params
1202
- */
1203
- protected fromComponent(params: A_TYPES__Feature_InitWithComponent<T>): void;
1204
- /**
1205
- * This method processes the feature by executing all the stages
1206
- *
1207
- */
1208
- process(
1209
- /**
1210
- * Optional scope to be used to resolve the steps dependencies
1211
- * If not provided, the scope of the caller component will be used
1212
- */
1213
- scope?: A_Scope): Promise<void> | void;
1214
- /**
1215
- * Process stages one by one, ensuring each stage completes before starting the next
1216
- */
1217
- private processStagesSequentially;
1218
- /**
1219
- * This method moves the feature to the next stage
1220
- *
1221
- * @param stage
1222
- */
1223
- next(stage: any): void;
1224
- /**
1225
- * This method marks the feature as completed and returns the result
1226
- * Uses to interrupt or end the feature processing
1227
- *
1228
- * @param result
1229
- * @returns
1230
- */
1231
- completed(): void;
1232
- /**
1233
- * This method marks the feature as failed and returns the error
1234
- * Uses to mark the feature as failed
1235
- *
1236
- * @param error
1237
- * @returns The error that caused the failure
1238
- */
1239
- failed(error: A_FeatureError): A_FeatureError;
1240
- /**
1241
- * This method marks the feature as interrupted and throws an error
1242
- * Uses to interrupt or end the feature processing
1243
- *
1244
- * @param error
1245
- */
1246
- interrupt(
1247
- /**
1248
- * The reason of feature interruption
1249
- */
1250
- reason?: string | A_StageError | Error): A_FeatureError;
1251
- /**
1252
- * Allows to chain the feature to another feature.
1253
- * In this case the parent feature scope (if new not provided), stages, caller will be used.
1254
- *
1255
- * [!] Note: Chained feature will use the same caller as the parent feature.
1256
- *
1257
- * @param feature
1258
- */
1259
- chain(
1260
- /**
1261
- * A Feature to be chained
1262
- */
1263
- feature: A_Feature,
1264
- /**
1265
- * Optional scope to be used for the chained feature.
1266
- */
1267
- scope?: A_Scope): any;
1268
- chain<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents>(
1269
- /**
1270
- * Component whose feature should be chained
1271
- */
1272
- component: A_TYPES__FeatureAvailableComponents,
1273
- /**
1274
- * A Feature Name to be chained
1275
- */
1276
- feature: string,
1277
- /**
1278
- * Optional scope to be used for the chained feature.
1279
- */
1280
- scope?: A_Scope): any;
1281
- toString(): string;
1282
- }
1283
-
1284
- type A_TYPES__A_DependencyConstructor<T extends A_Dependency> = A_TYPES__Ctor<T>;
1285
- type A_TYPES__A_DependencyInjectable = A_Entity | A_Container | A_Component | A_Fragment | A_Feature | A_Caller | A_Error | A_Scope;
1286
- type A_TYPES__A_DependencyResolutionType<T> = T extends string ? string : T extends A_TYPES__Ctor<infer R> ? R : never;
1287
- type A_TYPES__A_DependencyResolutionStrategy<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1288
- /**
1289
- * If tru will throw an error if the dependency is not found
1290
- */
1291
- require: boolean;
1292
- /**
1293
- * Indicates that dependency should be loaded from a specific path before resolution
1294
- */
1295
- load: boolean;
1296
- /**
1297
- * Number of levels to go up in the parent chain when resolving the dependency
1298
- */
1299
- parent: number;
1300
- /**
1301
- * If true, will only resolve the dependency in the current scope without going up to parent scopes
1302
- */
1303
- flat: boolean;
1304
- /**
1305
- * If has any value indicates that entity should be created with default parameters provided
1306
- */
1307
- create: boolean;
1308
- /**
1309
- * Default constructor arguments to use when creating the dependency
1310
- */
1311
- args: any[];
1312
- /**
1313
- * Allows to query by specific entity properties e.g. ASEID, name, type, custom properties, etc.
1314
- */
1315
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1316
- /**
1317
- * Pagination settings for the entity search
1318
- */
1319
- pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
1320
- };
1321
- type A_TYPES__A_Dependency_Serialized<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1322
- name: string;
1323
- all: boolean;
1324
- require: boolean;
1325
- load: boolean;
1326
- parent: number;
1327
- flat: boolean;
1328
- create: any;
1329
- args: any[];
1330
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1331
- pagination: A_TYPES__A_Dependency_EntityInjectionPagination;
1332
- };
1333
- type A_TYPES__A_Dependency_EntityResolutionConfig<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = {
1334
- query: Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1335
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1336
- };
1337
- type A_TYPES__A_Dependency_EntityInjectionQuery<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> = T extends A_Entity ? {
1338
- aseid: string;
1339
- } & {
1340
- [key in keyof T]?: any;
1341
- } : never;
1342
- type A_TYPES__A_Dependency_EntityInjectionPagination = {
1343
- count: number;
1344
- from: 'start' | 'end';
1345
- };
1346
- /**
1347
- * A-Dependency require decorator return type
1348
- */
1349
- type A_TYPES__A_Dependency_RequireDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1350
- /**
1351
- * A-Dependency load decorator return type
1352
- */
1353
- type A_TYPES__A_Dependency_LoadDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1354
- /**
1355
- * A-Dependency default decorator return type
1356
- */
1357
- type A_TYPES__A_Dependency_DefaultDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1358
- /**
1359
- * A-Dependency parent decorator return type
1360
- */
1361
- type A_TYPES__A_Dependency_ParentDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1362
- /**
1363
- * A-Dependency flat decorator return type
1364
- */
1365
- type A_TYPES__A_Dependency_FlatDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1366
- /**
1367
- * A-Dependency All decorator return type
1368
- */
1369
- type A_TYPES__A_Dependency_AllDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
1370
-
1371
- /**
1372
- * Should indicate which Default is required
1373
- */
1374
- declare function A_Dependency_Default(
1375
- /**
1376
- * Constructor Parameters that will be used to create the default instance
1377
- */
1378
- ...args: any[]): A_TYPES__A_Dependency_DefaultDecoratorReturn;
1379
-
1380
- /**
1381
- * Should indicate which dependency is required
1382
- */
1383
- declare function A_Dependency_Flat(): A_TYPES__A_Dependency_FlatDecoratorReturn;
1384
-
1385
- /**
1386
- * Should indicate which Load is required
1387
- */
1388
- declare function A_Dependency_Load(): A_TYPES__A_Dependency_LoadDecoratorReturn;
1389
-
1390
- /**
1391
- * Should indicate which dependency is required
1392
- */
1393
- declare function A_Dependency_Parent(
1394
- /**
1395
- * Indicates how many layers up the parent dependency should be resolved from current dependency
1396
- *
1397
- * Default: -1 (one layer up)
1398
- */
1399
- layerOffset?: number): A_TYPES__A_Dependency_ParentDecoratorReturn;
1400
-
1401
- /**
1402
- * Should indicate which dependency is required
1403
- */
1404
- declare function A_Dependency_Require(): A_TYPES__A_Dependency_RequireDecoratorReturn;
1405
-
1406
- /**
1407
- * Should indicate which All is required
1408
- */
1409
- declare function A_Dependency_All(): A_TYPES__A_Dependency_AllDecoratorReturn;
1410
-
1411
- declare class A_Dependency<T extends A_TYPES__A_DependencyInjectable = A_TYPES__A_DependencyInjectable> {
1412
- /**
1413
- * Allows to indicate which Injected parameter is required
1414
- *
1415
- * [!] If parameter marked as required is not provided, an error will be thrown
1416
- *
1417
- * @returns
1418
- */
1419
- static get Required(): typeof A_Dependency_Require;
1420
- /**
1421
- * Allows to indicate which dependency should be loaded from a specific path
1422
- *
1423
- * @returns
1424
- */
1425
- static get Loaded(): typeof A_Dependency_Load;
1426
- /**
1427
- * Allows to indicate which dependency default parameters should be used
1428
- *
1429
- * @returns
1430
- */
1431
- static get Default(): typeof A_Dependency_Default;
1432
- /**
1433
- * Allows to indicate which parent dependency should be resolved
1434
- * e.g. from which layer up the parent should be taken
1435
- *
1436
- * @returns
1437
- */
1438
- static get Parent(): typeof A_Dependency_Parent;
1439
- /**
1440
- * Allows to indicate that the dependency should be resolved in a flat manner
1441
- * Only in the same scope, without going up to parent scopes
1442
- *
1443
- * @returns
1444
- */
1445
- static get Flat(): typeof A_Dependency_Flat;
1446
- /**
1447
- * Allows to indicate that all instances of the dependency should be resolved
1448
- *
1449
- * @returns
1450
- */
1451
- static get All(): typeof A_Dependency_All;
1452
- protected _name: string;
1453
- protected _target?: A_TYPES__Ctor<T>;
1454
- protected _resolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
1455
- protected _defaultPagination: A_TYPES__A_DependencyResolutionStrategy['pagination'];
1456
- protected _defaultResolutionStrategy: A_TYPES__A_DependencyResolutionStrategy;
1457
- get flat(): boolean;
1458
- get require(): boolean;
1459
- get load(): boolean;
1460
- /**
1461
- * Indicates cases when it's necessary to search across all instances
1462
- */
1463
- get all(): boolean;
1464
- get parent(): number;
1465
- get create(): any;
1466
- get args(): any[];
1467
- get query(): Partial<A_TYPES__A_Dependency_EntityInjectionQuery<T>>;
1468
- get pagination(): A_TYPES__A_Dependency_EntityInjectionPagination;
1469
- /**
1470
- * Class instances allows to identify dependencies by name and use them for better type checking
1471
- *
1472
- * @param name
1473
- */
1474
- constructor(name: string | A_TYPES__Ctor<T>, resolutionStrategy?: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T>, 'pagination'> & {
1475
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1476
- }>);
1477
- /**
1478
- * Gets the dependency name
1479
- *
1480
- * Can be identifier, url or any string value
1481
- *
1482
- * @returns
1483
- */
1484
- get name(): string;
1485
- /**
1486
- * Returns the original class of the dependency if provided
1487
- *
1488
- */
1489
- get target(): A_TYPES__Ctor<T> | undefined;
1490
- /**
1491
- * Gets the dependency resolution strategy
1492
- */
1493
- get resolutionStrategy(): A_TYPES__A_DependencyResolutionStrategy<T>;
1494
- /**
1495
- * Sets the dependency resolution strategy
1496
- */
1497
- set resolutionStrategy(strategy: Partial<Omit<A_TYPES__A_DependencyResolutionStrategy<T>, 'pagination'> & {
1498
- pagination: Partial<A_TYPES__A_Dependency_EntityInjectionPagination>;
1499
- }>);
1500
- /**
1501
- * Method for the parameters check and all input data before usage
1502
- *
1503
- * @returns
1504
- */
1505
- private initCheck;
1506
- /**
1507
- * Serializes the dependency to a JSON object
1508
- *
1509
- * @returns
1510
- */
1511
- toJSON(): A_TYPES__A_Dependency_Serialized<T>;
1512
- }
1513
-
1514
- declare enum A_TYPES__A_Stage_Status {
1515
- /**
1516
- * The stage is currently being processed
1517
- */
1518
- PROCESSING = "PROCESSING",
1519
- /**
1520
- * The stage has been completed
1521
- */
1522
- COMPLETED = "COMPLETED",
1523
- /**
1524
- * The stage has failed
1525
- */
1526
- FAILED = "FAILED",
1527
- /**
1528
- * The stage has been skipped
1529
- */
1530
- SKIPPED = "SKIPPED",
1531
- /**
1532
- * The stage has been paused
1533
- */
1534
- /**
1535
- * The stage has been stopped
1536
- */
1537
- /**
1538
- * The stage has been started
1539
- */
1540
- /**
1541
- * The stage has been initialized
1542
- */
1543
- INITIALIZED = "INITIALIZED",
1544
- /**
1545
- * The stage has been aborted
1546
- */
1547
- ABORTED = "ABORTED"
1548
- }
1549
- type A_TYPES_StageExecutionBehavior = 'async' | 'sync';
1550
- type A_TYPES__A_StageStep = {
1551
- /**
1552
- * The component to be called
1553
- */
1554
- dependency: A_Dependency;
1555
- /**
1556
- * The method to be called on the component
1557
- */
1558
- handler: string;
1559
- /**
1560
- * Original Feature Extension name
1561
- *
1562
- * [!] could be string or regex
1563
- *
1564
- */
1565
- name: string;
1566
- /**
1567
- * In case its async it will be executed independently from the main thread.
1568
- *
1569
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1570
- *
1571
- */
1572
- behavior: A_TYPES_StageExecutionBehavior;
1573
- /**
1574
- * Allows to define the order of the execution of the method.
1575
- *
1576
- * [!] In case the method has circular dependencies it will Throw an error.
1577
- *
1578
- */
1579
- before: string;
1580
- /**
1581
- * Allows to define the order of the execution of the method.
1582
- *
1583
- * [!] In case the method has circular dependencies it will Throw an error.
1584
- *
1585
- */
1586
- after: string;
1587
- /**
1588
- * Indicates whether to throw an error if the step fails.
1589
- *
1590
- * [!] By default is true
1591
- */
1592
- throwOnError: boolean;
1593
- /**
1594
- *
1595
- */
1596
- override: string;
1597
- };
1598
- type A_TYPES__Stage_Serialized = {
1599
- /**
1600
- * The name of the stage
1601
- */
1602
- name: string;
1603
- /**
1604
- * The status of the stage
1605
- *
1606
- */
1607
- status: A_TYPES__A_Stage_Status;
1608
- };
1609
- type A_TYPES__A_StageStepProcessingExtraParams = {
1610
- steps: A_TYPES__A_StageStep[];
1611
- filter: (step: A_TYPES__A_StageStep) => boolean;
1612
- };
1613
-
1614
- /**
1615
- * Feature constructor type
1616
- * Uses the generic type T to specify the type of the feature
1617
- */
1618
- type A_TYPES__Feature_Constructor<T = A_Feature> = A_TYPES__Ctor<T>;
1619
- /**
1620
- * Feature initialization type
1621
- */
1622
- type A_TYPES__Feature_Init<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = A_TYPES__Feature_InitWithComponent<T> | A_TYPES__Feature_InitWithTemplate<T>;
1623
- /**
1624
- * Feature initialization type using component
1625
- */
1626
- type A_TYPES__Feature_InitWithComponent<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = {
1627
- /**
1628
- * Feature Name
1629
- */
1630
- name: string;
1631
- /**
1632
- * The component from where the feature is calling. It's important for proper scoping.
1633
- * Based on the component would be retrieved connected components, entities and containers.
1634
- *
1635
- * [!] Could be Container, Entity, Component or Command
1636
- */
1637
- component: T;
1638
- /**
1639
- * In case when Entity is not attached to the scope can be used to transparently show dependencies
1640
- *
1641
- *
1642
- */
1643
- scope?: A_Scope;
1644
- };
1645
- /**
1646
- * Feature initialization type using template
1647
- */
1648
- type A_TYPES__Feature_InitWithTemplate<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> = {
1649
- /**
1650
- * Feature Name
1651
- */
1652
- name: string;
1653
- /**
1654
- * The scope from where to retrieve dependent components, entities and containers.
1655
- *
1656
- * [!] Important for proper scoping.
1657
- */
1658
- scope: A_Scope;
1659
- /**
1660
- * The component from where the feature is calling. It's important for proper scoping.
1661
- * Based on the component would be retrieved connected components, entities and containers.
1662
- *
1663
- * [!] Could be Container, Entity, Component or Command
1664
- */
1665
- component?: T;
1666
- /**
1667
- * Optional Feature template to be used instead of building it from decorators
1668
- */
1669
- template: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>;
1670
- };
1671
- /**
1672
- * Feature serialized type
1673
- */
1674
- type A_TYPES__Feature_Serialized = {};
1675
- /**
1676
- * Feature lifecycle states
1677
- */
1678
- declare enum A_TYPES__FeatureState {
1679
- /**
1680
- * The feature has been initialized
1681
- */
1682
- INITIALIZED = "INITIALIZED",
1683
- /**
1684
- * The feature is currently being processed
1685
- */
1686
- PROCESSING = "PROCESSING",
1687
- /**
1688
- * The feature has been completed
1689
- */
1690
- COMPLETED = "COMPLETED",
1691
- /**
1692
- * The feature has been interrupted
1693
- */
1694
- INTERRUPTED = "INTERRUPTED",
1695
- /**
1696
- * The feature has failed
1697
- */
1698
- FAILED = "FAILED"
1699
- }
1700
- type A_TYPES__FeatureError_Init = {
1701
- /**
1702
- * Stage where the error occurred
1703
- */
1704
- stage?: A_Stage;
1705
- } & A_TYPES__Error_Init;
1706
- /**
1707
- * A list of component where features can be Defined
1708
- *
1709
- * [!] On this component Feature Definition is Available
1710
- */
1711
- type A_TYPES__FeatureAvailableComponents = InstanceType<A_TYPES__FeatureAvailableConstructors>;
1712
- /**
1713
- * A list of constructors where features can be Defined
1714
- *
1715
- * [!] On this component Feature Definition is Available
1716
- */
1717
- type A_TYPES__FeatureAvailableConstructors = A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Container_Constructor;
1718
- /**
1719
- * Indicates a type of Feature Define decorator
1720
- */
1721
- type A_TYPES__FeatureDefineDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>>;
1722
- /**
1723
- * Describes additional configuration properties to be used in Feature Define decorator
1724
- */
1725
- type A_TYPES__FeatureDefineDecoratorConfig = {
1726
- /**
1727
- * Feature name
1728
- *
1729
- * [!] By default uses the method name
1730
- */
1731
- name: string;
1732
- /**
1733
- * Indicates a default behavior of the feature. If true the feature will be automatically attached to the execution.
1734
- *
1735
- * [!] Before feature execution the method itself will be called to prepare the feature template
1736
- * [!] Default is false
1737
- */
1738
- invoke: boolean;
1739
- /**
1740
- * Allows to add a default behavior or number of steps that will be part of the feature
1741
- */
1742
- template: Array<A_TYPES__FeatureDefineDecoratorTemplateItem>;
1743
- };
1744
- /**
1745
- * Describes a single template item used in Feature Define decorator
1746
- */
1747
- type A_TYPES__FeatureDefineDecoratorTemplateItem = A_TYPES__Required<Partial<A_TYPES__A_StageStep>, ['name', 'handler', 'dependency']>;
1748
- /**
1749
- * Describes a target where Feature Define decorator can be applied
1750
- *
1751
- * [!] The feature can be defined on Container, Entity, Component or Command
1752
- */
1753
- type A_TYPES__FeatureDefineDecoratorTarget = A_Container | A_Entity | A_Component;
1754
- /**
1755
- * A type of Meta information stored by Feature Define decorator
1756
- * This information then uses by A-Context to build a proper feature template
1757
- */
1758
- type A_TYPES__FeatureDefineDecoratorMeta = {
1759
- /**
1760
- * Feature name
1761
- * mainly it's a unique combination of the class name and method name
1762
- */
1763
- name: string;
1764
- /**
1765
- * Actual method name in the class
1766
- */
1767
- handler: string;
1768
- /**
1769
- * Indicates a default behavior of the feature. If true the feature will be automatically attached to the execution.
1770
- *
1771
- * [!] Before feature execution the method itself will be called to prepare the feature template
1772
- * [!] Default is false
1773
- */
1774
- invoke: boolean;
1775
- /**
1776
- * Allows to add a default behavior or number of steps that will be part of the feature
1777
- */
1778
- template: Array<A_TYPES__A_StageStep>;
1779
- };
1780
- /**
1781
- * Descriptor type for A_Extend decorator
1782
- */
1783
- type A_TYPES__FeatureExtendDecoratorDescriptor = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<() => Promise<any>>;
1784
- /**
1785
- * Target type for A_Extend decorator
1786
- *
1787
- * [!] Can be applied only on A-Components
1788
- */
1789
- type A_TYPES__FeatureExtendDecoratorTarget = A_Component | A_Container | A_Entity;
1790
- /**
1791
- * Configuration type for A_Extend decorator
1792
- *
1793
- * This is an INPUT parameter provided by the user
1794
- */
1795
- type A_TYPES__FeatureExtendDecoratorConfig = {
1796
- /**
1797
- * Name of the container Lifecycle method to be extended.
1798
- *
1799
- * [!] If not provided will be used the name of the method.
1800
- * [!!] If name contains "." dot it will be considered as a path to the method.
1801
- */
1802
- name: string;
1803
- /**
1804
- * Container class or container name uses to identify the proper container in case when the name is not unique.
1805
- *
1806
- * [!] If not provided will be applied to all containers with the same name.
1807
- * [!!] By default uses OR to join all provided items. If you need more complex Logic, please use Regexp instead
1808
- *
1809
- * [!!!] In case if you need to exclude some containers, entities or components, please use "exclude" property
1810
- *
1811
- * Example:
1812
- *
1813
- * ```ts
1814
- * @A_Feature.Extend({
1815
- * name: 'load',
1816
- * scope: {
1817
- * include: [A_Container1, A_Entity1],
1818
- * exclude: [A_Component1]
1819
- * }
1820
- * })
1821
- * ```
1822
- */
1823
- scope: Array<A_TYPES__FeatureExtendDecoratorScopeItem> | Partial<A_TYPES__FeatureExtendDecoratorScopeConfig>;
1824
- /**
1825
- * The behavior of the method.
1826
- * In case its async it will be executed independently from the main thread.
1827
- *
1828
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1829
- *
1830
- */
1831
- behavior: A_TYPES_StageExecutionBehavior;
1832
- /**
1833
- * Allows to define the order of the execution of the method.
1834
- *
1835
- * [!] It applies for the following structure :'Component.methodName'
1836
- * [!] In case the method has circular dependencies it will Throw an error.
1837
- *
1838
- * Example:
1839
- * ```ts
1840
- * @A_Feature.Extend({
1841
- * name: 'load',
1842
- * before: ['Component1.methodName', 'Component2.methodName2']
1843
- * })
1844
- * // OR
1845
- * @A_Feature.Extend({
1846
- * name: 'load',
1847
- * before: /Component2\..+/
1848
- * })
1849
- * ```
1850
- */
1851
- before: Array<string> | RegExp;
1852
- /**
1853
- * Allows to define the order of the execution of the method.
1854
- *
1855
- * [!] It applies for the following structure :'Component.methodName'
1856
- * [!] In case the method has circular dependencies it will Throw an error.
1857
- *
1858
- * Example:
1859
- * ```ts
1860
- * @A_Feature.Extend({
1861
- * name: 'load',
1862
- * after: ['Component1.methodName', 'Component2.methodName2']
1863
- * })
1864
- * // OR
1865
- * @A_Feature.Extend({
1866
- * name: 'load',
1867
- * after: /Component2\..+/
1868
- * })
1869
- * ```
1870
- *
1871
- */
1872
- after: Array<string> | RegExp;
1873
- /**
1874
- * Indicates whether to throw an error if the step fails.
1875
- *
1876
- * [!] By default is true
1877
- */
1878
- throwOnError: boolean;
1879
- /**
1880
- * Allows to override particular steps in the feature sequence by provided names [Component].[Method] or by regexp
1881
- */
1882
- override: Array<string> | RegExp;
1883
- };
1884
- /**
1885
- * Scope item that can be used in A_Extend decorator configuration
1886
- */
1887
- type A_TYPES__FeatureExtendDecoratorScopeConfig = {
1888
- /**
1889
- * A list of components, entities or containers to include in the scope of the extension
1890
- */
1891
- include?: Array<A_TYPES__FeatureExtendDecoratorScopeItem>;
1892
- /**
1893
- * A list of components, entities or containers to exclude from the scope of the extension
1894
- */
1895
- exclude?: Array<A_TYPES__FeatureExtendDecoratorScopeItem>;
1896
- };
1897
- /**
1898
- * A single item that can be used in scope configuration
1899
- */
1900
- type A_TYPES__FeatureExtendDecoratorScopeItem = A_TYPES__Container_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Component_Constructor;
1901
- /**
1902
- * Meta type for A_Extend decorator
1903
- */
1904
- type A_TYPES__FeatureExtendDecoratorMeta = {
1905
- /**
1906
- * Original Feature Extension name
1907
- *
1908
- * [!] could be string or regex
1909
- */
1910
- name: string;
1911
- /**
1912
- * Actual method name in the class
1913
- */
1914
- handler: string;
1915
- /**
1916
- * The behavior of the method.
1917
- * In case its async it will be executed independently from the main thread.
1918
- *
1919
- * [!] However, in case of sync, it will be executed in the main thread.in the order of the declaration.
1920
- *
1921
- */
1922
- behavior: A_TYPES_StageExecutionBehavior;
1923
- /**
1924
- * Allows to define the order of the execution of the method.
1925
- *
1926
- * [!] In case the method has circular dependencies it will Throw an error.
1927
- *
1928
- */
1929
- before: string;
1930
- /**
1931
- * Allows to define the order of the execution of the method.
1932
- *
1933
- * [!] In case the method has circular dependencies it will Throw an error.
1934
- *
1935
- */
1936
- after: string;
1937
- /**
1938
- * Indicates whether to throw an error if the step fails.
1939
- *
1940
- * [!] By default is true
1941
- */
1942
- throwOnError: boolean;
1943
- /**
1944
- * Allows to override particular steps in the feature sequence by provided names [Component].[Method] or by regexp
1945
- */
1946
- override: string;
1947
- };
1948
-
1949
- /**
1950
- * A-Abstraction Extend decorator allows to extends behavior of each concept abstraction execution.
1951
- * In case some components or containers requires to extend the behavior of the abstraction like 'start', 'build' or 'deploy'
1952
- * for example, this decorator allows to do so.
1953
- *
1954
- * @param name - abstraction name
1955
- * @param config - configuration of the abstraction extension
1956
- * @returns
1957
- */
1958
- declare function A_Abstraction_Extend(
1959
- /**
1960
- * Name of the Concept Abstraction to extend
1961
- */
1962
- name: A_TYPES__ConceptAbstractions,
1963
- /**
1964
- * Configuration of the Abstraction Extension
1965
- *
1966
- */
1967
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
1968
-
1969
- declare class A_Abstraction {
1970
- /**
1971
- * The name of the Abstraction e.g. 'deploy', 'start', 'test', etc.
1972
- */
1973
- protected _name: A_TYPES__ConceptAbstractions;
1974
- /**
1975
- * List of features that are part of this Abstraction
1976
- */
1977
- protected _features: A_Feature[];
1978
- /**
1979
- * The Feature currently being processed
1980
- */
1981
- protected _current?: A_Feature;
1982
- /**
1983
- * Actual Index of the current Feature being processed
1984
- */
1985
- protected _index: number;
1986
- /**
1987
- * Allows to extends A-Abstraction with additional methods
1988
- */
1989
- static get Extend(): typeof A_Abstraction_Extend;
1990
- /**
1991
- * A-Abstraction is an object that is common for any application.
1992
- * By providing components and creating abstraction extensions it's possible to create a unique behavior of the whole solution.
1993
- *
1994
- * Every application has basic abstractions like 'start', 'stop', 'deploy', 'test', etc.
1995
- * They can be easily extended with additional logic from both containers and components.
1996
- *
1997
- *
1998
- * @param params
1999
- */
2000
- constructor(
2001
- /**
2002
- * Parameters to define the A-Abstraction
2003
- */
2004
- params: A_TYPES__Abstraction_Init);
2005
- /**
2006
- * Returns the name of the Abstraction
2007
- */
2008
- get name(): string;
2009
- /**
2010
- * Returns the current Feature being processed
2011
- */
2012
- get feature(): A_Feature | undefined;
2013
- /**
2014
- * This method checks if the A-Feature is done
2015
- *
2016
- * @returns
2017
- */
2018
- get isDone(): boolean;
2019
- [Symbol.iterator](): Iterator<A_Feature, any>;
2020
- /**
2021
- * This method moves the Abstraction processing to the next Feature in the list
2022
- *
2023
- * @param stage
2024
- */
2025
- next(stage: any): void;
2026
- /**
2027
- * Allows to process all stages of the Abstraction
2028
- *
2029
- * @returns
2030
- */
2031
- process(
2032
- /**
2033
- * Allows to override the scope in which the Abstraction will be processed
2034
- *
2035
- */
2036
- scope?: A_Scope): Promise<void>;
2037
- }
2038
-
2039
- /**
2040
- * Abstraction constructor type
2041
- * Uses the generic type T to specify the type of the abstraction
2042
- */
2043
- type A_TYPES__Abstraction_Constructor<T = A_Abstraction> = A_TYPES__Ctor<T>;
2044
- /**
2045
- * Abstraction initialization type
2046
- */
2047
- type A_TYPES__Abstraction_Init = {
2048
- /**
2049
- * Name of the A-Abstraction
2050
- */
2051
- name: A_TYPES__ConceptAbstractions;
2052
- /**
2053
- * Features that compose the A-Abstraction
2054
- */
2055
- containers: Array<A_Container>;
2056
- };
2057
- /**
2058
- * Abstraction serialized type
2059
- */
2060
- type A_TYPES__Abstraction_Serialized = {
2061
- /**
2062
- * The ASEID of the abstraction
2063
- */
2064
- aseid: string;
2065
- };
2066
- /**
2067
- * Components that can extend Abstractions
2068
- */
2069
- type A_TYPES__AbstractionAvailableComponents = A_Component | A_Container;
2070
- type A_TYPES__AbstractionDecoratorDescriptor = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<() => Promise<any>>;
2071
- type A_TYPES__AbstractionDecoratorConfig = A_TYPES__FeatureExtendDecoratorConfig;
2072
-
2073
- declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
2074
- protected props: A_TYPES__Concept_Init<_Imports>;
2075
- /**
2076
- * Load the concept. This step runs before any other steps to ensure that all components are loaded.
2077
- */
2078
- static Load(
2079
- /**
2080
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2081
- */
2082
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): ReturnType<typeof A_Abstraction_Extend>;
2083
- /**
2084
- * Publish the concept to ADAAS platform. (Or any other place defined in the concept)
2085
- *
2086
- * [!] To extend the logic just create a custom containers and override the default behavior.
2087
- */
2088
- static Publish(
2089
- /**
2090
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2091
- */
2092
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): ReturnType<typeof A_Abstraction_Extend>;
2093
- /**
2094
- * Deploy the concept to the environment.
2095
- */
2096
- static Deploy(
2097
- /**
2098
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2099
- */
2100
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2101
- /**
2102
- * Compiles the Concept in case there are some containers that require that.
2103
- *
2104
- * Can be used for static websites or any other concept that requires a build step.
2105
- *
2106
- */
2107
- static Build(
2108
- /**
2109
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2110
- */
2111
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2112
- /**
2113
- * Main execution of the concept.
2114
- */
2115
- static Run(
2116
- /**
2117
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2118
- */
2119
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2120
- /**
2121
- * Start the concept. Uses for servers or any other background services.
2122
- */
2123
- static Start(
2124
- /**
2125
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2126
- */
2127
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2128
- /**
2129
- * Stop the concept. Uses for servers or any other background services.
2130
- */
2131
- static Stop(
2132
- /**
2133
- * provide additional configuration for the abstraction extension to make it dependent on other factors
2134
- */
2135
- config?: Partial<A_TYPES__AbstractionDecoratorConfig>): (target: A_Container | A_Component, propertyKey: string, descriptor: A_TYPES__AbstractionDecoratorDescriptor) => void;
2136
- /**
2137
- * Name of the concept
2138
- *
2139
- * By default, the name of the Concept is 'a-concept'
2140
- */
2141
- private _name;
2142
- /**
2143
- * A list of internally defined containers that the concept uses.
2144
- */
2145
- protected _containers: A_Container[];
2146
- /**
2147
- * A-Concept is a placeholder for the concept of the any program.
2148
- *
2149
- * Concept - could be any Program regardless environment and it's goal.
2150
- * It could be mobile, web or simple html page.
2151
- * All depends on Containers and Components installed and provided in the Concept.
2152
- *
2153
- *
2154
- * [!] Concept operates ONLY with all Components and Containers provided to achieve the goal.
2155
- *
2156
- *
2157
- * @param props - Initialization properties for the Concept
2158
- */
2159
- constructor(props: A_TYPES__Concept_Init<_Imports>);
2160
- /**
2161
- * Name of the concept
2162
- */
2163
- get name(): string;
2164
- /**
2165
- * The primary Root scope of the concept.
2166
- */
2167
- get scope(): A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]>;
2168
- /**
2169
- * Register a class or value in the concept scope.
2170
- */
2171
- get register(): A_Scope['register'];
2172
- /**
2173
- * Resolve a class or value from the concept scope.
2174
- */
2175
- get resolve(): A_Scope['resolve'];
2176
- /**
2177
- * Load the concept.
2178
- */
2179
- load(scope?: A_Scope): Promise<void>;
2180
- /**
2181
- * Run the concept.
2182
- */
2183
- run(scope?: A_Scope): Promise<void>;
2184
- /**
2185
- * Start the concept.
2186
- *
2187
- * @param params
2188
- */
2189
- start(scope?: A_Scope): Promise<void>;
2190
- /**
2191
- * Stop the concept.
2192
- *
2193
- * @param params
2194
- */
2195
- stop(scope?: A_Scope): Promise<void>;
2196
- /**
2197
- * Build the concept.
2198
- */
2199
- build(scope?: A_Scope): Promise<void>;
2200
- /**
2201
- * Deploy the concept.
2202
- */
2203
- deploy(scope?: A_Scope): Promise<void>;
2204
- /**
2205
- * Publish the concept.
2206
- */
2207
- publish(scope?: A_Scope): Promise<void>;
2208
- /**
2209
- * Call the specific method of the concept or included modules.
2210
- */
2211
- call<K extends Record<_Imports[number]['name'], string>>(
2212
- /**
2213
- * Name of the method to call
2214
- */
2215
- method: K[keyof K],
2216
- /**
2217
- * Container in which the method is located
2218
- */
2219
- container: _Imports[number]): Promise<void>;
2220
- }
2221
-
2222
- /**
2223
- * Concept constructor type
2224
- * Uses the generic type T to specify the type of the concept
2225
- */
2226
- type A_TYPES__Concept_Constructor<T = A_Concept> = A_TYPES__Ctor<T>;
2227
- /**
2228
- * Concept initialization type
2229
- * Uses the generic type T to specify the type of containers that the concept will use
2230
- */
2231
- type A_TYPES__Concept_Init<T extends Array<A_Container>> = {
2232
- /**
2233
- * The name of the Concept
2234
- * If name is not provided, will be used from environment variable A_CONCEPT_NAME
2235
- *
2236
- * By default, the name of the Concept is 'a-concept'
2237
- *
2238
- */
2239
- name?: string;
2240
- /**
2241
- * A set of Context Fragments to register globally for the concept.
2242
- * These fragments will be available in the global context.
2243
- *
2244
- */
2245
- fragments?: Array<InstanceType<A_TYPES__Fragment_Constructor>>;
2246
- /**
2247
- * A set of Containers that the concept depends on.
2248
- * These containers will create a new Container for the concept.
2249
- */
2250
- containers?: T;
2251
- /**
2252
- * A set of Entities that the concept can use.
2253
- * These components will be used in the concept.
2254
- */
2255
- entities?: Array<InstanceType<A_TYPES__Entity_Constructor> | A_TYPES__Entity_Constructor>;
2256
- /**
2257
- * A set of Components available for all containers and fragments in the concept.
2258
- * These components will be registered in the root scope of the concept.
2259
- *
2260
- * [!] Note that these components will be available in all containers and fragments in the concept.
2261
- */
2262
- components?: Array<A_TYPES__Component_Constructor>;
2263
- };
2264
- /**
2265
- * Concept serialized type
2266
- */
2267
- type A_TYPES__Concept_Serialized = {};
2268
- /**
2269
- * Uses as a transfer object to pass configurations to Feature constructor
2270
- */
2271
- type A_TYPES__ConceptAbstractionMeta = {
2272
- /**
2273
- * The arguments that will be passed to the handler
2274
- */
2275
- args: A_TYPES__A_InjectDecorator_Meta;
2276
- } & A_TYPES__FeatureExtendDecoratorMeta;
2277
- /**
2278
- * Uses to define the extension that will be applied to the Concept
2279
- */
2280
- type A_TYPES__ConceptAbstraction = A_TYPES__FeatureExtendDecoratorMeta;
2281
-
2282
- declare enum A_TYPES__ContainerMetaKey {
2283
- FEATURES = "a-container-features",
2284
- INJECTIONS = "a-container-injections",
2285
- ABSTRACTIONS = "a-container-abstractions",
2286
- EXTENSIONS = "a-container-extensions"
2287
- }
2288
-
2289
- /**
2290
- * Container constructor type
2291
- * Uses the generic type T to specify the type of the container
2292
- */
2293
- type A_TYPES__Container_Constructor<T = A_Container> = A_TYPES__Ctor<T>;
2294
- /**
2295
- * Container initialization type
2296
- */
2297
- type A_TYPES__Container_Init = {
2298
- /**
2299
- * The extra name for the container (optional)
2300
- */
2301
- name?: string;
2302
- } & A_TYPES__Scope_Init;
2303
- /**
2304
- * Container serialized type
2305
- */
2306
- type A_TYPES__Container_Serialized = {
2307
- /**
2308
- * The ASEID of the container
2309
- */
2310
- aseid: string;
2311
- };
2312
- /**
2313
- * Meta information stored in each Container
2314
- */
2315
- type A_TYPES__ContainerMeta = {
2316
- /**
2317
- * Extensions applied to the component per handler
2318
- */
2319
- [A_TYPES__ContainerMetaKey.EXTENSIONS]: A_Meta<{
2320
- /**
2321
- * Where Key the regexp for what to apply the extension
2322
- * A set of container names or a wildcard, or a regexp
2323
- *
2324
- *
2325
- * Where value is the extension instructions
2326
- */
2327
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2328
- }>;
2329
- [A_TYPES__ContainerMetaKey.FEATURES]: A_Meta<{
2330
- /**
2331
- * Where Key is the name of the feature
2332
- *
2333
- * Where value is the list of features
2334
- */
2335
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2336
- }>;
2337
- [A_TYPES__ContainerMetaKey.ABSTRACTIONS]: A_Meta<{
2338
- /**
2339
- * Where Key the regexp for what to apply the extension
2340
- * A set of container names or a wildcard, or a regexp
2341
- *
2342
- *
2343
- * Where value is the extension instructions
2344
- */
2345
- [Key: string]: A_TYPES__ConceptAbstraction[];
2346
- }>;
2347
- [A_TYPES__ContainerMetaKey.INJECTIONS]: A_Meta<{
2348
- /**
2349
- * Where Key is the name of the injection
2350
- *
2351
- * Where value is the list of injections
2352
- */
2353
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2354
- }>;
2355
- };
2356
- type A_TYPES__ContainerMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
2357
-
2358
- /**
2359
- * A-Inject decorator descriptor type
2360
- * Indicates the type of the decorator function
2361
- */
2362
- type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
2363
- /**
2364
- * A-Inject decorator return type
2365
- * Indicates what the decorator function returns
2366
- */
2367
- type A_TYPES__A_InjectDecoratorReturn<T = any> = (target: T, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
2368
- type A_TYPES__A_InjectDecorator_Meta = Array<A_Dependency>;
2369
- /**
2370
- * Targets that can be injected into Extended functions or constructors
2371
- */
2372
- type A_TYPES__InjectableTargets = A_TYPES__Component_Constructor | InstanceType<A_TYPES__Component_Constructor> | InstanceType<A_TYPES__Container_Constructor>;
2373
-
2374
- declare enum A_TYPES__ComponentMetaKey {
2375
- EXTENSIONS = "a-component-extensions",
2376
- FEATURES = "a-component-features",
2377
- INJECTIONS = "a-component-injections",
2378
- ABSTRACTIONS = "a-component-abstractions"
2379
- }
2380
-
2381
- /**
2382
- * Component constructor type
2383
- * Uses the generic type T to specify the type of the component
2384
- */
2385
- type A_TYPES__Component_Constructor<T = A_Component> = A_TYPES__Ctor<T>;
2386
- /**
2387
- * Component initialization type
2388
- */
2389
- type A_TYPES__Component_Init = any;
2390
- /**
2391
- * Component serialized type
2392
- */
2393
- type A_TYPES__Component_Serialized = {
2394
- /**
2395
- * The ASEID of the component
2396
- */
2397
- aseid: string;
2398
- };
2399
- /**
2400
- * Component meta type
2401
- */
2402
- type A_TYPES__ComponentMeta = {
2403
- /**
2404
- * Extensions applied to the component per handler
2405
- */
2406
- [A_TYPES__ComponentMetaKey.EXTENSIONS]: A_Meta<{
2407
- /**
2408
- * Where Key the regexp for what to apply the extension
2409
- * A set of container names or a wildcard, or a regexp
2410
- *
2411
- *
2412
- * Where value is the extension instructions
2413
- */
2414
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2415
- }>;
2416
- /**
2417
- * Features defined on the component per handler
2418
- */
2419
- [A_TYPES__ComponentMetaKey.FEATURES]: A_Meta<{
2420
- /**
2421
- * Where Key is the name of the feature
2422
- *
2423
- * Where value is the list of features
2424
- */
2425
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2426
- }>;
2427
- /**
2428
- * Injections defined on the component per handler
2429
- */
2430
- [A_TYPES__ComponentMetaKey.INJECTIONS]: A_Meta<{
2431
- /**
2432
- * Where Key is the name of the injection
2433
- *
2434
- * Where value is the list of injections
2435
- */
2436
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2437
- }>;
2438
- /**
2439
- * Abstractions extended by the component per handler
2440
- */
2441
- [A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
2442
- /**
2443
- * Where Key is the name of the stage
2444
- *
2445
- * Where value is the list of injections
2446
- */
2447
- [Key: string]: A_TYPES__ConceptAbstraction[];
2448
- }>;
2449
- };
2450
- type A_TYPES__ComponentMetaExtension = A_TYPES__FeatureExtendDecoratorMeta;
2451
-
2452
- /**
2453
- * Meta constructor type
2454
- */
2455
- type A_TYPES__Meta_Constructor<T = A_Meta> = A_TYPES__Ctor<T>;
2456
- /**
2457
- * Components that can have Meta associated with them
2458
- */
2459
- type A_TYPES__MetaLinkedComponents = A_Container | A_Component | A_Entity | A_Fragment;
2460
- /**
2461
- * Constructors of components that can have Meta associated with them
2462
- */
2463
- type A_TYPES__MetaLinkedComponentConstructors = new (...args: any[]) => any | A_TYPES__Container_Constructor | A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor;
2464
-
2465
- /**
2466
- * A Meta is an entity that stores all the metadata for the specific entity like container, component, feature, etc.
2467
- *
2468
- * [!] Meta can be different depending on the type of input data
2469
- */
2470
- 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]]> {
2471
- /**
2472
- * Allows to set a custom meta class for the Component or Container or Entity, or anything else.
2473
- *
2474
- * @param target
2475
- * @returns
2476
- */
2477
- static Define<T extends A_Meta>(target: A_TYPES__Meta_Constructor<T>): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: TTarget) => TTarget;
2478
- protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
2479
- /**
2480
- * Method to get the iterator for the meta object
2481
- *
2482
- * @returns
2483
- */
2484
- [Symbol.iterator](): Iterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
2485
- /**
2486
- * Allows to replicate received meta object by replacing internal meta to the received one
2487
- *
2488
- * @param meta
2489
- * @returns
2490
- */
2491
- from(meta: A_Meta<_StorageItems>): A_Meta<_StorageItems>;
2492
- /**
2493
- * Method to set values in the map
2494
- *
2495
- * @param key
2496
- * @param value
2497
- */
2498
- set<K extends keyof _StorageItems>(key: K, value: _StorageItems[K]): void;
2499
- /**
2500
- * Method to get values from the map
2501
- *
2502
- * @param key
2503
- * @returns
2504
- */
2505
- get<K extends keyof _StorageItems>(key: K): _StorageItems[K] | undefined;
2506
- /**
2507
- * Method to delete values from the map
2508
- *
2509
- * @param key
2510
- * @returns
2511
- */
2512
- delete(key: keyof _StorageItems): boolean;
2513
- /**
2514
- * Method to get the size of the map
2515
- *
2516
- * @returns
2517
- */
2518
- size(): number;
2519
- /**
2520
- * This method is needed to convert the key to a regular expression and cover cases like:
2521
- *
2522
- * simple * e.g. "a*" instead of "a.*"
2523
- *
2524
- * simple ? e.g. "a?" instead of "a."
2525
- *
2526
- * etc.
2527
- *
2528
- * @param key
2529
- * @returns
2530
- */
2531
- private convertToRegExp;
2532
- /**
2533
- * Method to find values in the map by name.
2534
- *
2535
- * Converts the Key in Map to a regular expression and then compares to the name
2536
- *
2537
- * @param name
2538
- * @returns
2539
- */
2540
- find(name: string): [keyof _StorageItems, _StorageItems[keyof _StorageItems]][];
2541
- /**
2542
- * Method to find values in the map by regular expression
2543
- *
2544
- * Compares Map Key to the input regular expression
2545
- *
2546
- * @param regex
2547
- * @returns
2548
- */
2549
- findByRegex(regex: RegExp): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
2550
- /**
2551
- * Method to check if the map has a specific key
2552
- *
2553
- * @param key
2554
- * @returns
2555
- */
2556
- has(key: keyof _StorageItems): boolean;
2557
- /**
2558
- * Method to get the size of the map
2559
- *
2560
- * @returns
2561
- */
2562
- entries(): IterableIterator<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
2563
- /**
2564
- * Method to clear the map
2565
- */
2566
- clear(): void;
2567
- toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
2568
- protected recursiveToJSON(value: any): any;
2569
- /**
2570
- * Serializes the meta to a JSON object
2571
- * Uses internal storage to convert to JSON
2572
- *
2573
- * @returns
2574
- */
2575
- toJSON(): _SerializedType;
2576
- }
2577
-
2578
- declare enum A_TYPES__EntityMetaKey {
2579
- EXTENSIONS = "a-component-extensions",
2580
- FEATURES = "a-component-features",
2581
- ABSTRACTIONS = "a-component-abstractions",
2582
- INJECTIONS = "a-component-injections"
2583
- }
2584
- declare enum A_TYPES__EntityFeatures {
2585
- SAVE = "save",
2586
- DESTROY = "destroy",
2587
- LOAD = "load"
2588
- }
2589
-
2590
- /**
2591
- * Entity interface
2592
- */
2593
- interface A_TYPES__IEntity {
2594
- /**
2595
- * The ASEID of the entity
2596
- */
2597
- aseid: ASEID;
2598
- }
2599
- /**
2600
- * Entity constructor type
2601
- * Uses the generic type T to specify the type of the entity
2602
- */
2603
- type A_TYPES__Entity_Constructor<T = A_Entity> = A_TYPES__Ctor<T>;
2604
- /**
2605
- * Entity initialization type
2606
- */
2607
- type A_TYPES__Entity_Init = any;
2608
- /**
2609
- * Entity serialized type
2610
- */
2611
- type A_TYPES__Entity_Serialized = {
2612
- /**
2613
- * The ASEID of the entity
2614
- */
2615
- aseid: string;
2616
- };
2617
- /**
2618
- * Entity meta type
2619
- */
2620
- type A_TYPES__EntityMeta = {
2621
- [A_TYPES__EntityMetaKey.EXTENSIONS]: A_Meta<{
2622
- /**
2623
- * Where Key the regexp for what to apply the extension
2624
- * A set of container names or a wildcard, or a regexp
2625
- *
2626
- *
2627
- * Where value is the extension instructions
2628
- */
2629
- [Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
2630
- }>;
2631
- case: any;
2632
- [A_TYPES__EntityMetaKey.FEATURES]: A_Meta<{
2633
- /**
2634
- * Where Key is the name of the feature
2635
- *
2636
- * Where value is the list of features
2637
- */
2638
- [Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
2639
- }>;
2640
- /**
2641
- * Injections defined on the component per handler
2642
- */
2643
- [A_TYPES__EntityMetaKey.INJECTIONS]: A_Meta<{
2644
- /**
2645
- * Where Key is the name of the injection
2646
- *
2647
- * Where value is the list of injections
2648
- */
2649
- [Key: string]: A_TYPES__A_InjectDecorator_Meta;
2650
- }>;
2651
- };
2652
-
2653
- /**
2654
- * A_Entity is another abstraction that describes all major participants in the system business logic.
2655
- * Each Entity should have a clear definition and a clear set of responsibilities.
2656
- * However, entity may hide some of its responsibilities behind the interface to prevent overload.
2657
- *
2658
- * Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
2659
- */
2660
- 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 {
2661
- /**
2662
- * Entity Identifier that corresponds to the class name
2663
- */
2664
- static get entity(): string;
2665
- /**
2666
- * DEFAULT Concept Name (Application Name) of the entity from environment variable A_CONCEPT_NAME
2667
- * [!] If environment variable is not set, it will default to 'a-concept'
2668
- */
2669
- static get concept(): string;
2670
- /**
2671
- * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
2672
- * [!] If environment variable is not set, it will default to 'core'
2673
- * [!] Scope is an application specific identifier that can be used to group entities together
2674
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
2675
- */
2676
- static get scope(): string;
2677
- /**
2678
- * ASEID is an entity identifier that is unique across the system
2679
- * A - A_Concept or Application
2680
- * S - System or Scope
2681
- * E - Entity
2682
- * ID - Identifier
2683
- *
2684
- * [!] ASEID is immutable and should not be changed after the entity is created
2685
- *
2686
- * [!] ASEID is composed of the following parts:
2687
- * - concept: an application specific identifier from where the entity is coming from
2688
- * - scope: the scope of the entity from concept
2689
- * - entity: the name of the entity from concept
2690
- * - id: the unique identifier of the entity
2691
- *
2692
- * [!] For more information about ASEID, please refer to the ASEID class documentation]
2693
- */
2694
- aseid: ASEID;
2695
- /**
2696
- * Create a new A_entity instance from Aseid String
2697
- * e.g. project@scope:entity:0000000001
2698
- *
2699
- * @param aseid
2700
- */
2701
- constructor(
2702
- /**
2703
- * ASEID string that represents the entity
2704
- */
2705
- aseid?: string);
2706
- /**
2707
- * Create a new A_entity instance from Aseid instance
2708
- * e.g. new ASEID({concept: 'project', scope: 'default', entity: 'entity', id: '0000000001'})
2709
- *
2710
- * @param aseid
2711
- */
2712
- constructor(
2713
- /**
2714
- * ASEID instance that represents the entity
2715
- */
2716
- aseid: ASEID);
2717
- /**
2718
- * Create a new A_entity instance from serialized object
2719
- *
2720
- * @param serialized
2721
- */
2722
- constructor(
2723
- /**
2724
- * Serialized object that represents the entity
2725
- */
2726
- serialized: _SerializedType);
2727
- /**
2728
- * Create a new A_entity instance from constructor object
2729
- *
2730
- * @param newEntity
2731
- */
2732
- constructor(
2733
- /**
2734
- * Constructor object that represents the entity
2735
- */
2736
- newEntity?: _ConstructorType);
2737
- /**
2738
- * Extracts the ID from the ASEID
2739
- * ID is the unique identifier of the entity
2740
- */
2741
- get id(): string | number;
2742
- protected isStringASEID(x: unknown): x is string;
2743
- protected isASEIDInstance(x: unknown): x is ASEID;
2744
- /**
2745
- * A "serialized" object is considered such if it is a non-null object
2746
- * and contains an "aseid" property (this mirrors your original check).
2747
- *
2748
- * @param x
2749
- * @returns
2750
- */
2751
- protected isSerializedObject(x: unknown): x is _SerializedType;
2752
- /**
2753
- * Constructor-style props = a plain object which does NOT contain "aseid".
2754
- * This is the "create from provided fields" case.
2755
- *
2756
- * @param x
2757
- * @returns
2758
- */
2759
- protected isConstructorProps(x: unknown): x is _ConstructorType;
2760
- /**
2761
- * Determines the appropriate initializer method based on the type of `props`.
2762
- * The method checks if `props` is:
2763
- * 1) a string that matches ASEID format -> fromASEID
2764
- * 2) an ASEID instance -> fromASEID
2765
- * 3) a serialized object (has 'aseid') -> fromJSON
2766
- * 4) a plain object with no 'aseid' -> treat as constructor props -> fromNew
2767
- *
2768
- * [!] If `props` is undefined, it will call fromUndefined method
2769
- *
2770
- * If none of the above, it throws an error indicating incorrect constructor usage.
2771
- *
2772
- *
2773
- * To get a custom initializer, override this method in the child class.
2774
- * Example:
2775
- * ```typescript
2776
- * protected getInitializer(
2777
- * props?: string | ASEID | _SerializedType | _ConstructorType
2778
- * ): (props: any) => void | (() => void) {
2779
- * if('customField' in props) {
2780
- * return this.fromCustomField.bind(this);
2781
- * }
2782
- * return super.getInitializer(props);
2783
- * }
2784
- * ```
2785
- * @param props
2786
- * @returns The appropriate initializer method
2787
- */
2788
- protected getInitializer(props?: string | ASEID | _SerializedType | _ConstructorType): (props: any) => void | (() => void);
2789
- /**
2790
- * Generates a new ASEID for the entity.
2791
- * It uses class definitions for concept, scope, and entity,
2792
- * and allows overriding any of these values.
2793
- *
2794
- * @param override
2795
- * @returns
2796
- */
2797
- protected generateASEID(override?: Partial<A_TYPES__ASEID_Constructor>): ASEID;
2798
- /**
2799
- * Call a feature of the component with the provided scope
2800
- *
2801
- * [!] If the provided scope is not inherited from the entity scope, it will be inherited
2802
- *
2803
- * @param lifecycleMethod
2804
- * @param args
2805
- */
2806
- call(feature: string, scope?: A_Scope): any;
2807
- /**
2808
- * The default method that can be called and extended to load entity data.
2809
- */
2810
- load(scope?: A_Scope): Promise<any>;
2811
- /**
2812
- * The default method that can be called and extended to destroy entity data.
2813
- */
2814
- destroy(scope?: A_Scope): Promise<any>;
2815
- /**
2816
- * The default method that can be called and extended to save entity data.
2817
- */
2818
- save(scope?: A_Scope): Promise<any>;
2819
- /**
2820
- * Create a new entity from ASEID string or instance
2821
- * [!] Executed when the constructor is called with a string or ASEID instance that represents the ASEID
2822
- * [!] Executes By Default with new A_Entity('aseid-string') or new A_Entity(new ASEID(...)) if getInitializer has not been overridden
2823
- *
2824
- * @param aseid
2825
- */
2826
- fromASEID(aseid: string | ASEID): void;
2827
- /**
2828
- * Handles the case when no props are provided to the constructor.
2829
- * This method can be overridden in child classes to set default values or perform specific initialization logic.
2830
- * By default, it does nothing.
2831
- *
2832
- *
2833
- * @returns
2834
- */
2835
- fromUndefined(): void;
2836
- /**
2837
- * Create a new entity from constructor object
2838
- * [!] Executed when the constructor is called with an object that does not contain "aseid" property
2839
- * [!] Executes By Default with new A_Entity({}) if getInitializer has not been overridden
2840
- *
2841
- * @param newEntity
2842
- * @returns
2843
- */
2844
- fromNew(newEntity: _ConstructorType): void;
2845
- /**
2846
- * Creates a new entity from serialized object
2847
- *
2848
- * [!] Executed when the constructor is called with an object that contains "aseid" property
2849
- * [!] Executes By Default with new A_Entity({ aseid: '...' }) if getInitializer has not been overridden
2850
- *
2851
- *
2852
- * @param serialized
2853
- * @returns
2854
- */
2855
- fromJSON(serialized: _SerializedType): void;
2856
- /**
2857
- * Converts the entity to a JSON object
2858
- * [!] This method should be extended in the child classes to include all properties of the entity
2859
- * [!] Includes aseid by default
2860
- *
2861
- *
2862
- * @returns
2863
- */
2864
- toJSON(): _SerializedType;
2865
- /**
2866
- * Returns the string representation of the entity
2867
- * what is basically the ASEID string
2868
- *
2869
- * @returns
2870
- */
2871
- toString(): string;
2872
- }
2873
-
2874
- 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[]> {
2875
- /**
2876
- * Scope Name uses for identification and logging purposes
2877
- */
2878
- protected _name: string;
2879
- /**
2880
- * Parent scope reference, used for inheritance of components, fragments, entities and commands
2881
- */
2882
- protected _parent?: A_Scope;
2883
- /**
2884
- * Internal meta storage using A_Meta for type-safe key-value operations.
2885
- * This stores all the scope's runtime data that can be accessed and modified
2886
- * throughout the execution pipeline or within running containers.
2887
- */
2888
- protected _meta: A_Meta<_MetaItems>;
2889
- /**
2890
- * A set of allowed components, A set of constructors that are allowed in the scope
2891
- *
2892
- */
2893
- protected _allowedComponents: Set<_ComponentType[number]>;
2894
- /**
2895
- * A set of allowed errors, A set of constructors that are allowed in the scope
2896
- */
2897
- protected _allowedErrors: Set<_ErrorType[number]>;
2898
- /**
2899
- * A set of allowed entities, A set of constructors that are allowed in the scope
2900
- */
2901
- protected _allowedEntities: Set<_EntityType[number]>;
2902
- /**
2903
- * A set of allowed fragments, A set of constructors that are allowed in the scope
2904
- */
2905
- protected _allowedFragments: Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
2906
- /**
2907
- * Storage for the components, should be strong as components are unique per scope
2908
- */
2909
- protected _components: Map<_ComponentType[number], InstanceType<_ComponentType[number]>>;
2910
- /**
2911
- * Storage for the errors, should be strong as errors are unique per code
2912
- */
2913
- protected _errors: Map<string, InstanceType<_ErrorType[number]>>;
2914
- /**
2915
- * Storage for the entities, should be strong as entities are unique per aseid
2916
- */
2917
- protected _entities: Map<string, InstanceType<_EntityType[number]>>;
2918
- /**
2919
- * Storage for the fragments, should be weak as fragments are singletons per scope
2920
- */
2921
- protected _fragments: Map<A_TYPES__Fragment_Constructor<_FragmentType[number]>, _FragmentType[number]>;
2922
- /**
2923
- * Storage for imported scopes
2924
- */
2925
- protected _imports: Set<A_Scope>;
2926
- /**
2927
- * Returns the name of the scope
2928
- */
2929
- get name(): string;
2930
- /**
2931
- * Returns the meta object of the scope
2932
- */
2933
- get meta(): A_Meta<_MetaItems, Record<string, any>>;
2934
- /**
2935
- * Returns a list of Constructors for A-Components that are available in the scope
2936
- */
2937
- get allowedComponents(): Set<_ComponentType[number]>;
2938
- /**
2939
- * Returns a list of Constructors for A-Entities that are available in the scope
2940
- */
2941
- get allowedEntities(): Set<_EntityType[number]>;
2942
- /**
2943
- * Returns a list of Constructors for A-Fragments that are available in the scope
2944
- */
2945
- get allowedFragments(): Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
2946
- /**
2947
- * Returns a list of Constructors for A-Errors that are available in the scope
2948
- */
2949
- get allowedErrors(): Set<_ErrorType[number]>;
2950
- /**
2951
- * Returns an Array of entities registered in the scope
2952
- *
2953
- * [!] One entity per aseid
2954
- */
2955
- get entities(): Array<InstanceType<_EntityType[number]>>;
2956
- /**
2957
- * Returns an Array of fragments registered in the scope
2958
- *
2959
- * [!] One fragment per scope
2960
- */
2961
- get fragments(): Array<_FragmentType[number]>;
2962
- /**
2963
- * Returns an Array of components registered in the scope
2964
- *
2965
- * [!] One component instance per scope
2966
- */
2967
- get components(): Array<InstanceType<_ComponentType[number]>>;
2968
- /**
2969
- * Returns an Array of errors registered in the scope
2970
- *
2971
- * [!] One error per code
2972
- */
2973
- get errors(): Array<InstanceType<_ErrorType[number]>>;
2974
- /**
2975
- * Returns an Array of imported scopes
2976
- * [!] Imported scopes are scopes that have been imported into the current scope using the import() method
2977
- */
2978
- get imports(): Array<A_Scope>;
2979
- /**
2980
- * Returns the parent scope of the current scope
2981
- *
2982
- * @param setValue
2983
- * @returns
2984
- */
2985
- get parent(): A_Scope | undefined;
2986
- /**
2987
- * A_Scope refers to the visibility and accessibility of :
2988
- * - variables,
2989
- * - Components,
2990
- * - Context Fragments
2991
- * - Entities
2992
- * - and objects in different parts of your code.
2993
- * Scope determines where a particular piece of data (like a variable or function)
2994
- * can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
2995
- *
2996
- * [!] The scope behavior is similar to tree structure where each scope can have a parent scope and inherit its components, fragments, entities and errors
2997
- *
2998
- * @param params
2999
- * @param config
3000
- */
3001
- constructor();
3002
- constructor(
3003
- /**
3004
- * A set of constructors that are allowed in the scope
3005
- */
3006
- params: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>,
3007
- /**
3008
- * Configuration options for the scope
3009
- */
3010
- config?: Partial<A_TYPES__ScopeConfig>);
3011
- /**
3012
- * Generator to iterate through all parent scopes
3013
- */
3014
- parents(): Generator<A_Scope>;
3015
- /**
3016
- * This method is used to retrieve a parent scope at a specific level
3017
- *
3018
- * [!] Note that if the level is out of bounds, undefined is returned
3019
- * [!!] Uses negative values for levels (e.g. -1 for immediate parent, -2 for grandparent, etc.)
3020
- *
3021
- * @param level
3022
- * @returns
3023
- */
3024
- parentOffset<T extends A_Scope>(
3025
- /**
3026
- * Level of the parent scope to retrieve
3027
- *
3028
- * Examples:
3029
- * - level 0 - this scope
3030
- * - level -1 - parent
3031
- * - level -2 - grandparent
3032
- */
3033
- layerOffset: number): T | undefined;
3034
- /**
3035
- * Determines which initializer method to use based on the type of the first parameter.
3036
- *
3037
- * @param param1
3038
- * @returns
3039
- */
3040
- protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
3041
- protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
3042
- /**
3043
- * This method is used to initialize the components in the scope
3044
- * To save memory components are initialized only when they are requested
3045
- *
3046
- * This method only registers the component in the scope in case they are not registered yet
3047
- *
3048
- * @param _components
3049
- */
3050
- protected initComponents(_components?: _ComponentType): void;
3051
- /**
3052
- * This method is used to initialize the errors in the scope
3053
- *
3054
- * This method only registers the errors in the scope in case they are not registered yet
3055
- *
3056
- * @param _errors
3057
- */
3058
- protected initErrors(_errors?: _ErrorType): void;
3059
- /**
3060
- * This method is used to initialize the entities in the scope
3061
- *
3062
- * This method only registers the entities in the scope in case they are not registered yet
3063
- *
3064
- * @param _entities
3065
- */
3066
- protected initEntities(_entities?: [
3067
- ..._EntityType,
3068
- ...InstanceType<_EntityType[number]>[]
3069
- ]): void;
3070
- /**
3071
- * This method is used to initialize the fragments in the scope
3072
- *
3073
- * This method only registers the fragments in the scope in case they are not registered yet
3074
- *
3075
- * @param _fragments
3076
- */
3077
- protected initFragments(_fragments?: _FragmentType): void;
3078
- /**
3079
- * This method is used to initialize the meta in the scope
3080
- *
3081
- * This method only sets the meta values in the scope in case they are not set yet
3082
- *
3083
- * @param _meta
3084
- */
3085
- protected initMeta(_meta?: Partial<_MetaItems>): void;
3086
- /**
3087
- * This method is used to destroy the scope and all its registered components, fragments and entities
3088
- *
3089
- * [!] This method deregisters all components, fragments and entities from the A-Context
3090
- * [!] This method also clears all internal registries and collections
3091
- */
3092
- destroy(): void;
3093
- /**
3094
- * Retrieves a value from the scope's meta.
3095
- *
3096
- * @param param - The key to retrieve
3097
- * @returns The value associated with the key, or undefined if not found
3098
- *
3099
- * @example
3100
- * ```typescript
3101
- * const userId = scope.get('userId');
3102
- * if (userId) {
3103
- * console.log(`Current user: ${userId}`);
3104
- * }
3105
- * ```
3106
- */
3107
- get<K extends keyof _MetaItems>(param: K): _MetaItems[K] | undefined;
3108
- /**
3109
- * Stores a value in the scope's meta.
3110
- *
3111
- * @param param - The key to store the value under
3112
- * @param value - The value to store
3113
- *
3114
- * @example
3115
- * ```typescript
3116
- * scope.set('userId', '12345');
3117
- * scope.set('role', 'admin');
3118
- * ```
3119
- */
3120
- set<K extends keyof _MetaItems>(param: K, value: _MetaItems[K]): void;
3121
- /**
3122
- * Returns the issuer of the scope, useful for debugging and tracking purposes
3123
- *
3124
- * Issuer can be:
3125
- * - A Container that allocated the scope
3126
- * - A Feature that allocated the scope
3127
- *
3128
- * [!] 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
3129
- *
3130
- * @returns
3131
- */
3132
- issuer<T extends A_TYPES__ScopeLinkedComponents>(): T | undefined;
3133
- /**
3134
- * This method is used to inherit from a parent scope
3135
- *
3136
- * [!] This method checks for circular inheritance and throws an error if detected
3137
- *
3138
- * @param parent
3139
- * @returns
3140
- */
3141
- inherit(parent: A_Scope): A_Scope;
3142
- /**
3143
- * This method allows to import other scopes, to make their dependencies available in the current scope
3144
- *
3145
- * [!] Import doesn't create a parent-child relationship between scopes, it just copies the dependencies from the imported scopes
3146
- * [!] It doesn't change the entities ownership, so entities remain unique to their original scopes
3147
- *
3148
- * @param scopes
3149
- * @returns
3150
- */
3151
- import(...scopes: A_Scope[]): A_Scope;
3152
- /**
3153
- * This method allows to deimport other scopes, to remove their dependencies from the current scope
3154
- *
3155
- *
3156
- * @param scopes
3157
- * @returns
3158
- */
3159
- deimport(...scopes: A_Scope[]): A_Scope;
3160
- /**
3161
- * This method is used to check if the component is available in the scope
3162
- *
3163
- * [!] Note that this method checks for the component in the current scope and all parent scopes
3164
- *
3165
- * @param component
3166
- * @returns
3167
- */
3168
- has<T extends A_Component>(
3169
- /**
3170
- * Provide a component constructor to check if it's available in the scope
3171
- */
3172
- component: A_TYPES__Component_Constructor<T>): boolean;
3173
- has<T extends A_Entity>(
3174
- /**
3175
- * Provide an entity constructor to check if it's available in the scope
3176
- *
3177
- * [!] 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
3178
- */
3179
- entity: A_TYPES__Entity_Constructor<T>): boolean;
3180
- has<T extends A_Fragment>(
3181
- /**
3182
- * Provide a fragment constructor to check if it's available in the scope
3183
- */
3184
- fragment: A_TYPES__Fragment_Constructor<T>): boolean;
3185
- has<T extends A_Error>(
3186
- /**
3187
- * Provide an error constructor to check if it's available in the scope
3188
- */
3189
- error: A_TYPES__Error_Constructor<T>): boolean;
3190
- has(
3191
- /**
3192
- * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
3193
- */
3194
- constructor: string): boolean;
3195
- has<T extends A_TYPES__A_DependencyInjectable>(ctor: A_TYPES__Ctor<T> | string): boolean;
3196
- /**
3197
- * This method is used to check if the component is available in the scope
3198
- *
3199
- * [!] Note that this method checks for the component ONLY in the current scope
3200
- *
3201
- * @param component
3202
- * @returns
3203
- */
3204
- hasFlat<T extends A_Component>(
3205
- /**
3206
- * Provide a component constructor to check if it's available in the scope
3207
- */
3208
- component: A_TYPES__Component_Constructor<T>): boolean;
3209
- hasFlat<T extends A_Entity>(
3210
- /**
3211
- * Provide an entity constructor to check if it's available in the scope
3212
- *
3213
- * [!] 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
3214
- */
3215
- entity: A_TYPES__Entity_Constructor<T>): boolean;
3216
- hasFlat<T extends A_Fragment>(
3217
- /**
3218
- * Provide a fragment constructor to check if it's available in the scope
3219
- */
3220
- fragment: A_TYPES__Fragment_Constructor<T>): boolean;
3221
- hasFlat<T extends A_Error>(
3222
- /**
3223
- * Provide an error constructor to check if it's available in the scope
3224
- */
3225
- error: A_TYPES__Error_Constructor<T>): boolean;
3226
- hasFlat(
3227
- /**
3228
- * Provide a string to check if a component, entity or fragment with the provided name is available in the scope
3229
- */
3230
- constructor: string): boolean;
3231
- /**
3232
- * Allows to resolve a specific dependency
3233
- *
3234
- * @param dependency
3235
- * @returns
3236
- */
3237
- resolveDependency<T extends A_TYPES__A_DependencyInjectable>(dependency: A_Dependency<T>): T | Array<T> | undefined;
3238
- /**
3239
- * Allows to retrieve the constructor of the component or entity by its name
3240
- *
3241
- * [!] Notes:
3242
- * - 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
3243
- * - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
3244
- *
3245
- * @param name
3246
- * @returns
3247
- */
3248
- resolveConstructor<T extends A_Entity>(
3249
- /**
3250
- * Provide the entity name or static entity property to retrieve its constructor
3251
- */
3252
- name: string): A_TYPES__Entity_Constructor<T>;
3253
- resolveConstructor<T extends A_Component>(
3254
- /**
3255
- * Provide the component name in PascalCase to retrieve its constructor
3256
- */
3257
- name: string): A_TYPES__Component_Constructor<T>;
3258
- resolveConstructor<T extends A_Fragment>(
3259
- /**
3260
- * Provide the fragment name in PascalCase to retrieve its constructor
3261
- */
3262
- name: string): A_TYPES__Fragment_Constructor<T>;
3263
- 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;
3264
- /**
3265
- * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3266
- * So in case of providing a base class it should return all instances that extends this base class
3267
- *
3268
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3269
- *
3270
- * @param component
3271
- */
3272
- resolveAll<T extends A_Component>(
3273
- /**
3274
- * Provide a component constructor to resolve its instance from the scope
3275
- */
3276
- component: A_TYPES__Component_Constructor<T>): Array<T>;
3277
- resolveAll<T extends A_Fragment>(
3278
- /**
3279
- * Provide a fragment constructor to resolve its instance from the scope
3280
- */
3281
- fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3282
- resolveAll<T extends A_Entity>(
3283
- /**
3284
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3285
- */
3286
- entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3287
- resolveAll<T extends A_TYPES__A_DependencyInjectable>(
3288
- /**
3289
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3290
- */
3291
- constructorName: string): Array<T>;
3292
- resolveAll<T extends A_TYPES__A_DependencyInjectable>(
3293
- /**
3294
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3295
- */
3296
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
3297
- /**
3298
- * This method should resolve all instances of the components, or entities within the scope, by provided parent class
3299
- * So in case of providing a base class it should return all instances that extends this base class
3300
- *
3301
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3302
- *
3303
- * @param component
3304
- */
3305
- resolveFlatAll<T extends A_Component>(
3306
- /**
3307
- * Provide a component constructor to resolve its instance from the scope
3308
- */
3309
- component: A_TYPES__Component_Constructor<T>): Array<T>;
3310
- resolveFlatAll<T extends A_Fragment>(
3311
- /**
3312
- * Provide a fragment constructor to resolve its instance from the scope
3313
- */
3314
- fragment: A_TYPES__Fragment_Constructor<T>): Array<T>;
3315
- resolveFlatAll<T extends A_Entity>(
3316
- /**
3317
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3318
- */
3319
- entity: A_TYPES__Entity_Constructor<T>): Array<T>;
3320
- resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
3321
- /**
3322
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3323
- */
3324
- constructorName: string): Array<T>;
3325
- resolveFlatAll<T extends A_TYPES__A_DependencyInjectable>(
3326
- /**
3327
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3328
- */
3329
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): Array<T>;
3330
- /**
3331
- * This method allows to resolve/inject a component, fragment or entity from the scope
3332
- * Depending on the provided parameters it can resolve:
3333
- * - A single component/fragment/entity by its constructor or name
3334
- * - An array of components/fragments/entities by providing an array of constructors
3335
- * - An entity or an array of entities by providing the entity constructor and query instructions
3336
- *
3337
- * @param component
3338
- * @returns
3339
- */
3340
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3341
- /**
3342
- * Provide a component constructor to resolve its instance from the scope
3343
- */
3344
- component: A_TYPES__Ctor<T>): T | undefined;
3345
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3346
- /**
3347
- * Provide a target dependency to resolve its instance from the scope
3348
- *
3349
- * [!] In this case its possible to provide a custom resolution strategy via A_Dependency options
3350
- */
3351
- dependency: A_Dependency<T>): T | Array<T> | undefined;
3352
- resolve<T extends A_TYPES__A_DependencyInjectable>(
3353
- /**
3354
- * Provide a component constructor to resolve its instance from the scope
3355
- */
3356
- component: string): T | Array<T> | undefined;
3357
- /**
3358
- * This method allows to resolve/inject a component, fragment or entity from the scope
3359
- * Depending on the provided parameters it can resolve:
3360
- * - A single component/fragment/entity by its constructor or name
3361
- * - An array of components/fragments/entities by providing an array of constructors
3362
- * - An entity or an array of entities by providing the entity constructor and query instructions
3363
- *
3364
- * @param component
3365
- * @returns
3366
- */
3367
- resolveOnce<T extends A_Component>(
3368
- /**
3369
- * Provide a component constructor to resolve its instance from the scope
3370
- */
3371
- component: A_TYPES__Component_Constructor<T>): T | undefined;
3372
- resolveOnce<T extends A_Fragment>(
3373
- /**
3374
- * Provide a fragment constructor to resolve its instance from the scope
3375
- */
3376
- fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3377
- resolveOnce<T extends A_Entity>(
3378
- /**
3379
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3380
- */
3381
- entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3382
- resolveOnce<T extends A_Scope>(
3383
- /**
3384
- * Uses only in case of resolving a single entity
3385
- *
3386
- * Provide an entity constructor to resolve its instance from the scope
3387
- */
3388
- scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3389
- resolveOnce<T extends A_Error>(
3390
- /**
3391
- * Uses only in case of resolving a single entity
3392
- *
3393
- * Provide an entity constructor to resolve its instance from the scope
3394
- */
3395
- error: A_TYPES__Error_Constructor<T>): T | undefined;
3396
- resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
3397
- /**
3398
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3399
- */
3400
- constructorName: string): T | undefined;
3401
- resolveOnce<T extends A_TYPES__A_DependencyInjectable>(
3402
- /**
3403
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3404
- */
3405
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
3406
- /**
3407
- * This polymorphic method allows to resolve/inject a component, fragment or entity from the scope
3408
- * Depending on the provided parameters it can resolve:
3409
- * - A single component/fragment/entity by its constructor or name
3410
- * - An array of components/fragments/entities by providing an array of constructors
3411
- * - An entity or an array of entities by providing the entity constructor and query instructions
3412
- *
3413
- * [!] Applicable for the current scope ONLY, no parent scopes are checked
3414
- *
3415
- * @param component
3416
- */
3417
- resolveFlat<T extends A_Component>(
3418
- /**
3419
- * Provide a component constructor to resolve its instance from the scope
3420
- */
3421
- component: A_TYPES__Component_Constructor<T>): T | undefined;
3422
- resolveFlat<T extends A_Fragment>(
3423
- /**
3424
- * Provide a fragment constructor to resolve its instance from the scope
3425
- */
3426
- fragment: A_TYPES__Fragment_Constructor<T>): T | undefined;
3427
- resolveFlat<T extends A_Entity>(
3428
- /**
3429
- * Provide an entity constructor to resolve its instance or an array of instances from the scope
3430
- */
3431
- entity: A_TYPES__Entity_Constructor<T>): T | undefined;
3432
- resolveFlat<T extends A_Scope>(
3433
- /**
3434
- * Uses only in case of resolving a single entity
3435
- *
3436
- * Provide an entity constructor to resolve its instance from the scope
3437
- */
3438
- scope: A_TYPES__Scope_Constructor<T>): T | undefined;
3439
- resolveFlat<T extends A_Error>(
3440
- /**
3441
- * Uses only in case of resolving a single entity
3442
- *
3443
- * Provide an entity constructor to resolve its instance from the scope
3444
- */
3445
- error: A_TYPES__Error_Constructor<T>): T | undefined;
3446
- resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
3447
- /**
3448
- * Provide a component, fragment or entity constructor to resolve its instance(s) from the scope
3449
- */
3450
- constructorName: string): T | undefined;
3451
- resolveFlat<T extends A_TYPES__A_DependencyInjectable>(
3452
- /**
3453
- * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
3454
- */
3455
- ctor: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable>): T | undefined;
3456
- /**
3457
- * Resolves a component, fragment or entity from the scope without checking parent scopes
3458
- *
3459
- * @param component
3460
- * @param instructions
3461
- */
3462
- resolveFlatOnce<T extends A_TYPES__A_DependencyInjectable>(component: A_TYPES__Ctor<A_TYPES__A_DependencyInjectable> | string): T | undefined;
3463
- /**
3464
- * This method is used internally to resolve a component, fragment or entity by its constructor name
3465
- *
3466
- * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
3467
- * [!!] Note: No parent scopes are checked
3468
- *
3469
- * @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)
3470
- * @returns
3471
- */
3472
- private resolveByName;
3473
- /**
3474
- * Resolves the issuer of the scope by provided constructor
3475
- *
3476
- * [!] Note that this method checks ONLY for the direct issuer of the scope
3477
- * [!!] No parent scopes are checked
3478
- *
3479
- *
3480
- * @param ctor
3481
- * @returns
3482
- */
3483
- private resolveIssuer;
3484
- /**
3485
- * This method is used internally to resolve a single entity from the scope based on the provided instructions
3486
- *
3487
- * [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
3488
- * [!!] Note: No parent scopes are checked
3489
- *
3490
- * @param entity
3491
- * @param instructions
3492
- * @returns
3493
- */
3494
- private resolveEntity;
3495
- /**
3496
- * This method is used internally to resolve a single error from the scope
3497
- *
3498
- * [!] Note that errors are singleton instances within the scope
3499
- * [!!] No parent scopes are checked
3500
- *
3501
- * @param error
3502
- * @returns
3503
- */
3504
- private resolveError;
3505
- /**
3506
- * This method is used internally to resolve a single fragment from the scope
3507
- *
3508
- * [!] Note that this method checks for the fragment in the current scope and all parent scopes
3509
- *
3510
- * @param fragment
3511
- * @returns
3512
- */
3513
- private resolveFragment;
3514
- /**
3515
- * This method is used internally to resolve a single scope from the current scope
3516
- *
3517
- * @param scope
3518
- * @returns
3519
- */
3520
- private resolveScope;
3521
- /**
3522
- * This method is used internally to resolve a single component from the scope
3523
- *
3524
- * [!!] Note: No parent scopes are checked
3525
- *
3526
- * @param component
3527
- * @returns
3528
- */
3529
- private resolveComponent;
3530
- /**
3531
- * This method is used to register the component in the scope
3532
- *
3533
- * @param fragment
3534
- */
3535
- register<T extends A_Component>(
3536
- /**
3537
- * Provide a component constructor to register it in the scope
3538
- */
3539
- component: A_TYPES__Component_Constructor<T>): void;
3540
- register<T extends A_Component>(
3541
- /**
3542
- * Provide a command instance to register it in the scope
3543
- */
3544
- component: T): void;
3545
- register<T extends A_Error>(
3546
- /**
3547
- * Provide an error constructor to register it in the scope
3548
- */
3549
- error: A_TYPES__Error_Constructor<T>): void;
3550
- register<T extends A_Error>(
3551
- /**
3552
- * Provide an error instance to register it in the scope
3553
- */
3554
- error: T): void;
3555
- register<T extends A_Fragment>(
3556
- /**
3557
- * Provide a command instance to register it in the scope
3558
- */
3559
- fragment: A_TYPES__Fragment_Constructor<T>): void;
3560
- register<T extends A_Fragment>(
3561
- /**
3562
- * Provide a fragment instance to register it in the scope
3563
- */
3564
- fragment: T): void;
3565
- register<T extends A_Entity>(
3566
- /**
3567
- * Provide an entity constructor to register it in the scope
3568
- */
3569
- entity: A_TYPES__Entity_Constructor<T>): void;
3570
- register<T extends A_Entity>(
3571
- /**
3572
- * Provide an entity instance to register it in the scope
3573
- */
3574
- entity: T): void;
3575
- register<T extends A_TYPES__A_DependencyInjectable>(
3576
- /**
3577
- * Provide an entity instance to register it in the scope
3578
- */
3579
- entity: T): void;
3580
- /**
3581
- * This method is used to deregister the component from the scope
3582
- *
3583
- * @param fragment
3584
- */
3585
- deregister<T extends A_Component>(
3586
- /**
3587
- * Provide a component constructor to deregister it in the scope
3588
- */
3589
- component: A_TYPES__Component_Constructor<T>): void;
3590
- deregister(
3591
- /**
3592
- * Provide a command instance to deregister it in the scope
3593
- */
3594
- component: A_Component): void;
3595
- deregister<T extends A_Error>(
3596
- /**
3597
- * Provide an error constructor to deregister it in the scope
3598
- */
3599
- error: A_TYPES__Error_Constructor<T>): void;
3600
- deregister(
3601
- /**
3602
- * Provide an error instance to deregister it in the scope
3603
- */
3604
- error: A_Error): void;
3605
- deregister<T extends A_Fragment>(
3606
- /**
3607
- * Provide a command instance to deregister it in the scope
3608
- */
3609
- fragment: A_TYPES__Fragment_Constructor<T>): void;
3610
- deregister(
3611
- /**
3612
- * Provide a fragment instance to deregister it in the scope
3613
- */
3614
- fragment: A_Fragment): void;
3615
- deregister<T extends A_Entity>(
3616
- /**
3617
- * Provide an entity constructor to deregister it in the scope
3618
- */
3619
- entity: A_TYPES__Entity_Constructor<T>): void;
3620
- deregister(
3621
- /**
3622
- * Provide an entity instance to deregister it in the scope
3623
- */
3624
- entity: A_Entity): void;
3625
- /**
3626
- * This method is useful when you want to serialize the scope to JSON
3627
- *
3628
- * [!] Note this is not a deep serialization, only the fragments are serialized
3629
- * [!] Fragments are a storage for information which is relevant to the scope
3630
- *
3631
- * @returns
3632
- */
3633
- toJSON(): Record<string, any>;
3634
- /**
3635
- * Type guard to check if the constructor is of type A_Component and is allowed in the scope
3636
- *
3637
- * @param ctor
3638
- * @returns
3639
- */
3640
- protected isAllowedComponent(ctor: unknown): ctor is _ComponentType[number];
3641
- /**
3642
- * Type guard to check if the constructor is of type A_Entity and is allowed in the scope
3643
- *
3644
- * @param ctor
3645
- * @returns
3646
- */
3647
- protected isAllowedEntity(ctor: unknown): ctor is A_TYPES__Entity_Constructor<_EntityType[number]>;
3648
- /**
3649
- * Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
3650
- *
3651
- * @param ctor
3652
- * @returns
3653
- */
3654
- protected isAllowedFragment(ctor: unknown): ctor is A_TYPES__Fragment_Constructor<_FragmentType[number]>;
3655
- /**
3656
- * Type guard to check if the constructor is of type A_Error and is allowed in the scope
3657
- *
3658
- * @param ctor
3659
- * @returns
3660
- */
3661
- protected isAllowedError(ctor: unknown): ctor is A_TYPES__Error_Constructor<_ErrorType[number]>;
3662
- /**
3663
- * This method is used to check if the scope is inherited from another scope
3664
- *
3665
- * @param scope
3666
- * @returns
3667
- */
3668
- isInheritedFrom(scope: A_Scope): boolean;
3669
- /**
3670
- * Helper method to check circular inheritance
3671
- * Should return a full sequence of inheritance for logging purposes
3672
- *
3673
- * @param scope
3674
- * @returns
3675
- */
3676
- checkCircularInheritance(scope: A_Scope): Array<string> | false;
3677
- /**
3678
- * Helper method to print the inheritance chain of the scope
3679
- */
3680
- printInheritanceChain(): void;
3681
- }
3682
-
3683
- /**
3684
- * A-Component is a primary "extendable" object in the system
3685
- * A unique combination of Components creates completely new functionality
3686
- *
3687
- * The most important thing is that A-Component is STATELESS, it means that it doesn't store any state in itself
3688
- *
3689
- *
3690
- * [!] Every A-Component is a singleton, so if you need to create multiple instances of the same logic - use A-Container
3691
- * [!] So one scope can have only one instance of the same A-Component
3692
- * [!] Every A-Component can be extended by features and extensions
3693
- * [!] ONLY A-Component can have A-Feature extensions
3694
- *
3695
- */
3696
- declare class A_Component {
3697
- /**
3698
- * Calls the feature with the given name in the given scope
3699
- *
3700
- * [!] Note: This method creates a new instance of the feature every time it is called
3701
- *
3702
- * @param feature - the name of the feature to call
3703
- * @param scope - the scope in which to call the feature
3704
- * @returns - void
3705
- */
3706
- call(
3707
- /**
3708
- * Name of the feature to call
3709
- */
3710
- feature: string,
3711
- /**
3712
- * Scope in which the feature will be executed
3713
- */
3714
- scope?: A_Scope): Promise<any> | void;
3715
- }
3716
-
3717
- /**
3718
- * Scope constructor type
3719
- * Uses the generic type T to specify the type of the Scope
3720
- */
3721
- type A_TYPES__Scope_Constructor<T = A_Scope> = A_TYPES__Ctor<T>;
3722
- /**
3723
- * Scope initialization type
3724
- */
3725
- 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[]> = {
3726
- /**
3727
- * Scope Name
3728
- */
3729
- name: string;
3730
- /**
3731
- * A list of Context Fragments available in the Scope
3732
- */
3733
- fragments: [..._FragmentType];
3734
- /**
3735
- * A set of Components available in the Scope
3736
- */
3737
- components: [..._ComponentType];
3738
- /**
3739
- * A set of Errors available in the Scope
3740
- */
3741
- errors: [..._ErrorType];
3742
- /**
3743
- * A set of Entities available in the Scope
3744
- *
3745
- */
3746
- entities: [
3747
- ..._EntityType,
3748
- ...InstanceType<_EntityType[number]>[]
3749
- ];
3750
- meta: Partial<_MetaItems>;
3751
- };
3752
- /**
3753
- * Scope configuration type
3754
- */
3755
- type A_TYPES__ScopeConfig = {
3756
- /**
3757
- * Allows to define a parent to take dependencies from in case of the current scope does not have the required component
3758
- */
3759
- parent: A_Scope;
3760
- };
3761
- /**
3762
- * Scope serialized type
3763
- */
3764
- type A_TYPES__Scope_Serialized = {};
3765
- /**
3766
- * A list of constructors that can have a scope associated with them
3767
- */
3768
- type A_TYPES__ScopeLinkedConstructors = A_TYPES__Container_Constructor | A_TYPES__Feature_Constructor;
3769
- /**
3770
- * A list of components that can have a scope associated with them
3771
- */
3772
- type A_TYPES__ScopeLinkedComponents = A_Container | A_Feature;
3773
- /**
3774
- * A list of components that are dependent on a scope and do not have their own scope
3775
- */
3776
- type A_TYPES_ScopeDependentComponents = A_Component | A_Entity | A_Fragment | A_Error;
3777
- /**
3778
- * A list of components that are independent of a scope. They don't need a scope to be resolved
3779
- * Those components haven't scope dependent features.
3780
- */
3781
- type A_TYPES_ScopeIndependentComponents = A_Error | A_Scope | A_Caller;
3782
-
3783
- declare class A_ComponentMeta<T extends A_TYPES__ComponentMeta = A_TYPES__ComponentMeta> extends A_Meta<T> {
3784
- /**
3785
- * Allows to get all the injections for a given handler
3786
- *
3787
- * @param handler
3788
- * @returns
3789
- */
3790
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3791
- /**
3792
- * Allows to get all the extensions for a given feature
3793
- *
3794
- * @param feature
3795
- * @returns
3796
- */
3797
- extensions(feature: string): A_TYPES__ComponentMetaExtension[];
3798
- /**
3799
- * Returns all features defined in the Component
3800
- *
3801
- * @returns
3802
- */
3803
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3804
- /**
3805
- * Returns a set of instructions to run proper methods in Component during A-Concept Stage
3806
- *
3807
- * @param stage
3808
- * @returns
3809
- */
3810
- abstractions(abstraction: any): A_TYPES__ConceptAbstractionMeta[];
3811
- }
3812
-
3813
- declare class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
3814
- /**
3815
- * Allows to get all the injections for a given handler
3816
- *
3817
- * @param handler
3818
- * @returns
3819
- */
3820
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3821
- /**
3822
- * Returns all features defined in the Container
3823
- *
3824
- * @returns
3825
- */
3826
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3827
- /**
3828
- * Returns a set of instructions to run proper methods in Container during A-Concept Stage
3829
- *
3830
- * @param stage
3831
- * @returns
3832
- */
3833
- abstractions(abstraction: A_TYPES__ConceptAbstractions): A_TYPES__ConceptAbstractionMeta[];
3834
- /**
3835
- * Allows to get all the extensions for a given feature
3836
- *
3837
- * @param feature
3838
- * @returns
3839
- */
3840
- extensions(feature: string): A_TYPES__ContainerMetaExtension[];
3841
- }
3842
-
3843
- declare class A_EntityMeta extends A_Meta<A_TYPES__EntityMeta> {
3844
- /**
3845
- * Returns all features defined in the Container
3846
- *
3847
- * @returns
3848
- */
3849
- features(): Array<A_TYPES__FeatureDefineDecoratorMeta>;
3850
- /**
3851
- * Allows to get all the injections for a given handler
3852
- *
3853
- * @param handler
3854
- * @returns
3855
- */
3856
- injections(handler: string): A_TYPES__A_InjectDecorator_Meta;
3857
- }
3858
-
3859
- type A_TYPES__ContextEnvironment = 'server' | 'browser' | 'mobile' | 'desktop' | 'embedded' | 'unknown';
3860
- type A_TYPES__FeatureExtendableMeta = A_ContainerMeta | A_ComponentMeta | A_EntityMeta;
3861
-
3862
- declare class A_Context {
3863
- /**
3864
- * Default name of the application from environment variable A_CONCEPT_NAME
3865
- *
3866
- * [!] If environment variable is not set, it will default to 'a-concept'
3867
- */
3868
- static get concept(): string;
3869
- /**
3870
- * Root scope of the application from environment variable A_CONCEPT_ROOT_SCOPE
3871
- *
3872
- * [!] If environment variable is not set, it will default to 'root'
3873
- */
3874
- static get root(): A_Scope;
3875
- /**
3876
- * Environment the application is running in.
3877
- * Can be either 'server' or 'browser'.
3878
- * [!] Determined by checking if 'window' object is available.
3879
- */
3880
- static get environment(): A_TYPES__ContextEnvironment;
3881
- /**
3882
- * Singleton instance of the Context
3883
- */
3884
- private static _instance;
3885
- /**
3886
- * Root Scope of the Concept and Environment
3887
- *
3888
- * Root scope is the top-level scope that all other scopes inherit from.
3889
- * It stores global configurations and settings and ALL SHAREABLE RESOURCES.
3890
- *
3891
- * [!] Root scope is created automatically when the Context is initialized.
3892
- * [!] Root scope name can be configured using environment variable A_CONCEPT_ROOT_SCOPE
3893
- */
3894
- private _root;
3895
- /**
3896
- * A registry that keeps track of scopes for all components (Containers, Features, Commands)
3897
- * Which can issue a scope allocation.
3898
- */
3899
- protected _registry: WeakMap<A_TYPES__ScopeLinkedComponents, A_Scope>;
3900
- /**
3901
- * This is a registry that stores an issuer of each scope allocation.
3902
- * It helps to track which component (Container, Feature, Command) allocated a specific scope.
3903
- */
3904
- protected _scopeIssuers: WeakMap<A_Scope, A_TYPES__ScopeLinkedComponents>;
3905
- /**
3906
- * Stores a context associated with a specific component that depends on a scope.
3907
- * uses for quick retrieval of the scope for the component.
3908
- */
3909
- protected _scopeStorage: WeakMap<A_TYPES_ScopeDependentComponents, A_Scope>;
3910
- /**
3911
- * Stores meta information for different component types by their constructors.
3912
- * Meta provides to store extra information about the class behavior and configuration.
3913
- */
3914
- protected _metaStorage: Map<A_TYPES__MetaLinkedComponentConstructors, A_Meta>;
3915
- protected _globals: Map<string, any>;
3916
- /**
3917
- * Private constructor to enforce singleton pattern.
3918
- *
3919
- * [!] This class should not be instantiated directly. Use A_Context.getInstance() instead.
3920
- */
3921
- private constructor();
3922
- /**
3923
- * Get the instance of the Namespace Provider.
3924
- *
3925
- * If the instance does not exist, it will be created.
3926
- *
3927
- * @returns
3928
- */
3929
- static getInstance(): A_Context;
3930
- /**
3931
- * Register method allows to register a component with a specific scope in the context.
3932
- *
3933
- * @param component - Component to register with a specific scope. Can be either A_Container, A_Feature.
3934
- * @param scope - Scope to associate the component with.
3935
- * @returns
3936
- */
3937
- static register(
3938
- /**
3939
- * Provide the scope that will be associated with the component.
3940
- */
3941
- scope: A_Scope,
3942
- /**
3943
- * Provide a component that needs to be registered with a specific scope.
3944
- */
3945
- component: A_TYPES_ScopeDependentComponents): A_Scope;
3946
- /**
3947
- * Deregister method allows to deregister a component from the context.
3948
- *
3949
- * @param component - Component to deregister from the context.
3950
- */
3951
- static deregister(
3952
- /**
3953
- * Provide a component that needs to be deregistered from the context.
3954
- */
3955
- component: A_TYPES_ScopeDependentComponents): void;
3956
- /**
3957
- * Allocate method instantiates a new scope for the given component and registers it in the context.
3958
- * It bounds the component (Container, Feature) to a new scope that can be configured and used independently.
3959
- *
3960
- *
3961
- * @param component - Component to allocate the scope for. Can be either A_Container, A_Feature.
3962
- * @param importing - Configuration of the scope that will be created for the component.
3963
- */
3964
- static allocate(
3965
- /**
3966
- * Provide a component that needs a scope allocation.
3967
- */
3968
- component: A_TYPES__ScopeLinkedComponents): A_Scope;
3969
- static allocate(
3970
- /**
3971
- * Provide a component that needs a scope allocation.
3972
- */
3973
- component: A_TYPES__ScopeLinkedComponents,
3974
- /**
3975
- * Provide the scope that will be used as a base for the new scope.
3976
- */
3977
- importing: A_Scope): A_Scope;
3978
- static allocate(
3979
- /**
3980
- * Provide a component that needs a scope allocation.
3981
- */
3982
- component: A_TYPES__ScopeLinkedComponents,
3983
- /**
3984
- * Provide configuration for the scope that will be created for the component.
3985
- */
3986
- config: Partial<A_TYPES__Scope_Init & A_TYPES__ScopeConfig>): A_Scope;
3987
- /**
3988
- * Deallocate method removes the scope allocation for the given component from the context.
3989
- *
3990
- * @param component
3991
- * @returns
3992
- */
3993
- static deallocate(
3994
- /**
3995
- * A Scope that needs to be deallocated.
3996
- */
3997
- scope: A_Scope): any;
3998
- static deallocate(
3999
- /**
4000
- * Provide a component that needs to have its scope deallocated.
4001
- */
4002
- component: A_TYPES__ScopeLinkedComponents): any;
4003
- /**
4004
- * Get or Create Meta for the specific class or instance.
4005
- * This method will return the existing meta if it exists, or create a new one if it doesn't.
4006
- *
4007
- * Meta object contains custom metadata based on the class type.
4008
- *
4009
- * @param container
4010
- */
4011
- static meta<T extends A_ContainerMeta>(
4012
- /**
4013
- * Get meta for the specific container class by constructor.
4014
- */
4015
- container: A_TYPES__Container_Constructor): T;
4016
- static meta<T extends A_ContainerMeta>(
4017
- /**
4018
- * Get meta for the specific container instance.
4019
- */
4020
- container: A_Container): T;
4021
- static meta<T extends A_EntityMeta>(
4022
- /**
4023
- * Get meta for the specific entity class by constructor.
4024
- */
4025
- entity: A_TYPES__Entity_Constructor): T;
4026
- static meta<T extends A_EntityMeta>(
4027
- /**
4028
- * Get meta for the specific entity instance.
4029
- */
4030
- entity: A_Entity): T;
4031
- static meta<T extends A_ComponentMeta>(
4032
- /**
4033
- * Get meta for the specific component class by constructor.
4034
- */
4035
- component: A_TYPES__Component_Constructor): T;
4036
- static meta<T extends A_ComponentMeta>(
4037
- /**
4038
- * Get meta for the specific component instance.
4039
- */
4040
- component: A_Component): T;
4041
- static meta<T extends A_Meta>(
4042
- /**
4043
- * Get meta for the specific component class by constructor.
4044
- */
4045
- fragment: A_TYPES__Fragment_Constructor): T;
4046
- static meta<T extends A_Meta>(
4047
- /**
4048
- * Get meta for the specific component instance.
4049
- */
4050
- fragment: A_Fragment): T;
4051
- static meta<T extends A_ComponentMeta>(
4052
- /**
4053
- * Get meta for the specific component by its name.
4054
- */
4055
- component: string): T;
4056
- static meta(
4057
- /**
4058
- * Get meta for the specific meta linked component (class or instance).
4059
- */
4060
- target: A_TYPES__MetaLinkedComponentConstructors | A_TYPES__MetaLinkedComponents): A_ComponentMeta;
4061
- static meta<T extends A_Meta>(
4062
- /**
4063
- * Get meta for the specific class or instance
4064
- */
4065
- constructor: A_TYPES__Ctor<any>): T;
4066
- static meta<T extends Record<string, any>>(
4067
- /**
4068
- * Get meta for the specific class or instance
4069
- */
4070
- constructor: A_TYPES__Ctor<any>): A_Meta<T>;
4071
- /**
4072
- * Allows to set meta for the specific class or instance.
4073
- *
4074
- * @param param1
4075
- * @param meta
4076
- */
4077
- static setMeta<T extends A_ContainerMeta, S extends A_Container>(param1: S, meta: T): any;
4078
- static setMeta<T extends A_EntityMeta, S extends A_Entity>(param1: S, meta: T): any;
4079
- static setMeta<T extends A_ComponentMeta, S extends A_Component>(param1: S, meta: T): any;
4080
- static setMeta<T extends A_Meta>(param1: new (...args: any[]) => any, meta: T): any;
4081
- /**
4082
- *
4083
- * This method allows to get the issuer of a specific scope.
4084
- *
4085
- * @param scope - Scope to get the issuer for.
4086
- * @returns - Component that issued the scope.
4087
- */
4088
- static issuer(
4089
- /**
4090
- * Provide the scope to get its issuer.
4091
- */
4092
- scope: A_Scope): A_TYPES__ScopeLinkedComponents | undefined;
4093
- /**
4094
- * Get the scope of the specific class or instance.
4095
- *
4096
- * Every execution in Concept has its own scope.
4097
- *
4098
- * This method will return the scope of the specific class or instance.
4099
- *
4100
- * @param entity
4101
- */
4102
- static scope<T extends A_Entity>(
4103
- /**
4104
- * Provide an entity to get its scope.
4105
- */
4106
- entity: T): A_Scope;
4107
- static scope<T extends A_Component>(
4108
- /**
4109
- * Provide a component to get its scope.
4110
- */
4111
- component: T): A_Scope;
4112
- static scope<T extends A_Container>(
4113
- /**
4114
- * Provide a container to get its scope.
4115
- */
4116
- container: T): A_Scope;
4117
- static scope<T extends A_Feature>(
4118
- /**
4119
- * Provide a feature to get its scope.
4120
- */
4121
- feature: T): A_Scope;
4122
- static scope<T extends A_Fragment>(
4123
- /**
4124
- * Provide a fragment to get its scope.
4125
- */
4126
- fragment: T): A_Scope;
4127
- /**
4128
- * Returns a template of the feature that can be then used to create a new A-Feature Instance
4129
- *
4130
- * [!] Note: Steps/Stages included are fully dependent on the scope provided since it dictates which components are active and can provide extensions for the feature.
4131
- *
4132
- * @param name
4133
- */
4134
- static featureTemplate(
4135
- /**
4136
- * Provide the name of the feature to get the template for. Regular expressions are also supported to match multiple features.
4137
- */
4138
- name: string | RegExp,
4139
- /**
4140
- * Provide the component to get the feature template from.
4141
- */
4142
- component: A_TYPES__FeatureAvailableComponents,
4143
- /**
4144
- * Provide the scope that dictates which components are active and can provide extensions for the feature.
4145
- */
4146
- scope?: A_Scope): Array<A_TYPES__A_StageStep>;
4147
- /**
4148
- * Returns all extensions for the specific feature in the specific component within the provided scope.
4149
- * Scope dictates which components are active and can provide extensions for the feature.
4150
- *
4151
- * [!] This method only returns extensions, not the base feature definition.
4152
- *
4153
- * @param scope
4154
- * @returns
4155
- */
4156
- static featureExtensions(
4157
- /**
4158
- * Provide the name of the feature to get the template for. Regular expressions are also supported to match multiple features.
4159
- */
4160
- name: string | RegExp,
4161
- /**
4162
- * Provide the component to get the feature template from.
4163
- */
4164
- component: A_TYPES__FeatureAvailableComponents,
4165
- /**
4166
- * Provide the scope that dictates which components are active and can provide extensions for the feature.
4167
- */
4168
- scope: A_Scope): Array<A_TYPES__A_StageStep>;
4169
- /**
4170
- * method helps to filter steps in a way that only the most derived classes are kept.
4171
- *
4172
- * @param scope
4173
- * @param items
4174
- * @returns
4175
- */
4176
- private filterToMostDerived;
4177
- /**
4178
- * This method returns the feature template definition without any extensions.
4179
- * It can be used to retrieve the base template for a feature before any modifications are applied.
4180
- *
4181
- * [!] This method does not consider extensions from other components.
4182
- *
4183
- * @param feature
4184
- * @param component
4185
- * @returns
4186
- */
4187
- static featureDefinition(
4188
- /**
4189
- * Name of the feature to get the template for.
4190
- * Regular expressions are also supported to match multiple features.
4191
- */
4192
- feature: string | RegExp,
4193
- /**
4194
- * Component to get the feature template from.
4195
- */
4196
- component: A_TYPES__FeatureAvailableComponents): Array<A_TYPES__A_StageStep>;
4197
- /**
4198
- * Returns a definition of the abstraction that can be then used to create a new A-Feature Instance
4199
- *
4200
- * [!] Note: Steps/Stages included are fully dependent on the scope provided since it dictates which components are active and can provide extensions for the abstraction.
4201
- *
4202
- * @param abstraction
4203
- */
4204
- static abstractionTemplate(
4205
- /**
4206
- * Provide the abstraction stage to get the definition for.
4207
- */
4208
- abstraction: A_TYPES__ConceptAbstractions,
4209
- /**
4210
- * Provide the component to get the abstraction definition from.
4211
- */
4212
- component: A_TYPES__FeatureAvailableComponents): Array<A_TYPES__A_StageStep>;
4213
- static abstractionExtensions(
4214
- /**
4215
- * Provide the abstraction name to get the definition for.
4216
- */
4217
- abstraction: A_TYPES__ConceptAbstractions,
4218
- /**
4219
- * Provide the component to get the abstraction definition from.
4220
- */
4221
- component: A_TYPES__FeatureAvailableComponents): Array<A_TYPES__A_StageStep>;
4222
- /**
4223
- * Resets the Context to its initial state.
4224
- */
4225
- static reset(): void;
4226
- /**
4227
- * Type guard to check if the param is allowed for scope allocation.
4228
- *
4229
- * @param param
4230
- * @returns
4231
- */
4232
- static isAllowedForScopeAllocation(param: any): param is A_TYPES__ScopeLinkedComponents;
4233
- /**
4234
- * Type guard to check if the param is allowed to be registered in the context.
4235
- *
4236
- * @param param
4237
- * @returns
4238
- */
4239
- static isAllowedToBeRegistered(param: any): param is A_TYPES_ScopeDependentComponents;
4240
- /**
4241
- * Type guard to check if the param is allowed for meta storage.
4242
- *
4243
- * @param param
4244
- * @returns
4245
- */
4246
- static isAllowedForMeta(param: any): param is A_TYPES__MetaLinkedComponents;
4247
- /**
4248
- * Type guard to check if the param is allowed for meta storage by constructor.
4249
- *
4250
- * @param param
4251
- * @returns
4252
- */
4253
- static isAllowedForMetaConstructor(param: any): param is A_TYPES__MetaLinkedComponentConstructors;
4254
- }
4255
-
4256
- declare class A_ContextError extends A_Error {
4257
- static NotAllowedForScopeAllocationError: string;
4258
- static ComponentAlreadyHasScopeAllocatedError: string;
4259
- static InvalidMetaParameterError: string;
4260
- static InvalidScopeParameterError: string;
4261
- static ScopeNotFoundError: string;
4262
- static InvalidFeatureParameterError: string;
4263
- static InvalidFeatureDefinitionParameterError: string;
4264
- static InvalidFeatureTemplateParameterError: string;
4265
- static InvalidFeatureExtensionParameterError: string;
4266
- static InvalidAbstractionParameterError: string;
4267
- static InvalidAbstractionDefinitionParameterError: string;
4268
- static InvalidAbstractionTemplateParameterError: string;
4269
- static InvalidAbstractionExtensionParameterError: string;
4270
- static InvalidInjectionParameterError: string;
4271
- static InvalidExtensionParameterError: string;
4272
- static InvalidRegisterParameterError: string;
4273
- static InvalidComponentParameterError: string;
4274
- static ComponentNotRegisteredError: string;
4275
- static InvalidDeregisterParameterError: string;
4276
- }
4277
-
4278
- declare class A_ConceptMeta extends A_Meta<any> {
4279
- private containers;
4280
- constructor(containers: Array<A_Container>);
4281
- }
4282
-
4283
- declare class A_EntityError extends A_Error {
4284
- /**
4285
- * Error code for validation errors.
4286
- */
4287
- static readonly ValidationError = "A-Entity Validation Error";
4288
- }
4289
-
4290
- declare class A_AbstractionError extends A_Error {
4291
- /**
4292
- * This error code indicates that there was an issue extending the abstraction execution
4293
- */
4294
- static readonly AbstractionExtensionError = "Unable to extend abstraction execution";
4295
- }
4296
-
4297
- declare class A_CallerError extends A_Error {
4298
- /**
4299
- * This error code indicates that there was an issue initializing the A-Caller
4300
- */
4301
- static readonly CallerInitializationError = "Unable to initialize A-Caller";
4302
- }
4303
-
4304
- type A_TYPES__CallerComponent = A_Container | A_Component | A_Entity;
4305
- /**
4306
- * Caller constructor type
4307
- * Uses the generic type T to specify the type of the caller component
4308
- */
4309
- type A_TYPES__Caller_Constructor<T = A_Caller> = A_TYPES__Ctor<T>;
4310
- /**
4311
- * Caller initialization type
4312
- */
4313
- type A_TYPES__Caller_Init = {};
4314
- /**
4315
- * Caller serialized type
4316
- */
4317
- type A_TYPES__Caller_Serialized = {};
4318
-
4319
- declare const A_CONSTANTS__ERROR_CODES: {
4320
- readonly UNEXPECTED_ERROR: "A-Error Unexpected Error";
4321
- readonly VALIDATION_ERROR: "A-Error Validation Error";
4322
- };
4323
- declare const A_CONSTANTS__ERROR_DESCRIPTION = "If you see this error please let us know.";
4324
-
4325
- declare class ASEID_Error extends A_Error {
4326
- static readonly ASEIDInitializationError = "ASEID Initialization Error";
4327
- static readonly ASEIDValidationError = "ASEID Validation Error";
4328
- }
4329
-
4330
- declare class A_ScopeError extends A_Error {
4331
- static readonly InitializationError = "A-Scope Initialization Error";
4332
- static readonly ConstructorError = "Unable to construct A-Scope instance";
4333
- static readonly ResolutionError = "A-Scope Resolution Error";
4334
- static readonly RegistrationError = "A-Scope Registration Error";
4335
- static readonly CircularInheritanceError = "A-Scope Circular Inheritance Error";
4336
- static readonly CircularImportError = "A-Scope Circular Import Error";
4337
- static readonly DeregistrationError = "A-Scope Deregistration Error";
4338
- }
4339
-
4340
- /**
4341
- *
4342
- * This decorator should allow to set a default meta type for the class, this helps to avoid
4343
- * the need to create custom meta classes for each class.
4344
- *
4345
- * @returns
4346
- */
4347
- declare function A_MetaDecorator<T extends A_Meta>(constructor: A_TYPES__Ctor<T>): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: TTarget) => TTarget;
4348
-
4349
- declare class A_DependencyError extends A_Error {
4350
- static readonly InvalidDependencyTarget = "Invalid Dependency Target";
4351
- static readonly InvalidLoadTarget = "Invalid Load Target";
4352
- static readonly InvalidLoadPath = "Invalid Load Path";
4353
- static readonly InvalidDefaultTarget = "Invalid Default Target";
4354
- static readonly ResolutionParametersError = "Dependency Resolution Parameters Error";
4355
- }
4356
-
4357
- declare class A_InjectError extends A_Error {
4358
- static readonly InvalidInjectionTarget = "Invalid target for A-Inject decorator";
4359
- static readonly MissingInjectionTarget = "Missing target for A-Inject decorator";
4360
- }
4361
-
4362
- /**
4363
- * A-Inject decorator
4364
- *
4365
- * This Decorator allows to inject dependencies into the module like
4366
- * - Namespaces
4367
- * - Other Concepts
4368
- * - or maybe Components
4369
- *
4370
- * @param params - see overloads
4371
- * @returns - decorator function
4372
- */
4373
- declare function A_Inject<T extends A_Component>(
4374
- /**
4375
- * Provide the Component constructor that will be associated with the injection.
4376
- *
4377
- * [!] It returns an Instance of the Component from current Scope or from Parent Scopes.
4378
- */
4379
- component: A_TYPES__Component_Constructor<T>,
4380
- /**
4381
- * Provide additional instructions on how to perform the injection
4382
- *
4383
- * [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
4384
- */
4385
- config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
4386
- declare function A_Inject<T extends A_Fragment>(
4387
- /**
4388
- * Provide the Fragment constructor to inject the Fragment instance
4389
- *
4390
- * [!] It returns the Fragment instance from current Scope or from Parent Scopes.
4391
- */
4392
- fragment: A_TYPES__Fragment_Constructor<T>,
4393
- /**
4394
- * Provide additional instructions on how to perform the injection
4395
- *
4396
- * [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
4397
- */
4398
- config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
4399
- declare function A_Inject<T extends A_Entity>(
4400
- /**
4401
- * Provide the Entity constructor to inject the Entity instance
4402
- *
4403
- * [!] Note: It returns the Entity instance from current Scope or from Parent Scopes.
4404
- * [!] Note: If instance has more than one Entity of the same type It returns FIRST found Entity
4405
- * [!] Note: Use 'config' to specify to inject specific one or even Array of Entities
4406
- */
4407
- entity: A_TYPES__Entity_Constructor<T>,
4408
- /**
4409
- * Provide additional instructions on how to perform the injection
4410
- *
4411
- * [!] Default Pagination is 1 if it's necessary to get multiple Entities please customize it in the instructions
4412
- */
4413
- config?: Partial<A_TYPES__A_DependencyResolutionStrategy<T>>): A_TYPES__A_InjectDecoratorReturn<T>;
4414
- declare function A_Inject<T extends A_Component>(
4415
- /**
4416
- * Provide the name of Component constructor to inject the Component instance
4417
- *
4418
- * [!] You can use both customized one or original depending on your overriding strategy
4419
- */
4420
- ctor: string): A_TYPES__A_InjectDecoratorReturn;
4421
- declare function A_Inject<T extends A_Caller>(
4422
- /**
4423
- * Provide the A_Caller constructor to inject the Caller instance
4424
- *
4425
- * [!] It returns initiator of the call, e.g. Container/Component/Command who called Feature
4426
- */
4427
- caller: A_TYPES__Caller_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
4428
- declare function A_Inject<T extends A_Error>(
4429
- /***
4430
- * Provide the Error constructor that will be associated with the injection.
4431
- *
4432
- * [!] It returns an Instance of the Error what is executed.
4433
- */
4434
- error: A_TYPES__Error_Constructor<T>,
4435
- /**
4436
- * Provide additional instructions on how to perform the injection
4437
- *
4438
- * [!] Default Pagination is 1 if it's necessary to get multiple Fragments please customize it in the instructions
4439
- */
4440
- config?: Omit<Partial<A_TYPES__A_DependencyResolutionStrategy<T>>, 'query' | 'pagination'>): A_TYPES__A_InjectDecoratorReturn;
4441
- declare function A_Inject<T extends A_Feature>(
4442
- /**
4443
- * Provide the Feature constructor that will be associated with the injection.
4444
- *
4445
- * [!] It returns an Instance of the Feature what is executed.
4446
- */
4447
- feature: A_TYPES__Feature_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
4448
- declare function A_Inject<T extends A_Scope>(
4449
- /***
4450
- * Provide the Scope constructor that will be associated with the injection.
4451
- *
4452
- * [!] It returns an instance of the Scope where the Entity/Component/Container is defined.
4453
- */
4454
- scope: A_TYPES__Scope_Constructor<T>): A_TYPES__A_InjectDecoratorReturn;
4455
- declare function A_Inject<T extends A_TYPES__A_DependencyInjectable>(
4456
- /***
4457
- * Provide the Scope constructor that will be associated with the injection.
4458
- *
4459
- * [!] It returns an instance of the Scope where the Entity/Component/Container is defined.
4460
- */
4461
- dependency: A_Dependency<T>): A_TYPES__A_InjectDecoratorReturn;
4462
-
4463
- declare class A_CommonHelper {
4464
- /**
4465
- * A simple promise that resolves immediately.
4466
- * Can be used in async functions to create a resolved promise.
4467
- */
4468
- static resolve(): Promise<void>;
4469
- /**
4470
- * Check if a class is inherited from another class
4471
- *
4472
- * @param childClass
4473
- * @param parentClass
4474
- * @returns
4475
- */
4476
- static isInheritedFrom(childClass: any, parentClass: any): boolean;
4477
- /**
4478
- * Get all parent classes of a given class
4479
- *
4480
- * @param childClass
4481
- * @returns
4482
- */
4483
- static getParentClasses(childClass: any): any[];
4484
- /**
4485
- * Get the class inheritance chain as an array of class names
4486
- *
4487
- * @param childClass
4488
- * @returns
4489
- */
4490
- static getClassInheritanceChain(childClass: any): any[];
4491
- /**
4492
- * Get the parent class of a given class
4493
- *
4494
- * @param childClass
4495
- * @returns
4496
- */
4497
- static getParentClass(childClass: any): any;
4498
- /**
4499
- * Omit properties from an object or array with nested objects
4500
- *
4501
- * @param input
4502
- * @param paths
4503
- * @returns
4504
- */
4505
- static omitProperties<T, S extends string>(input: T, paths: string[]): Omit<T, S>;
4506
- static isObject(item: unknown): item is Record<string, any>;
4507
- static deepMerge<T = any>(target: any, source: any, visited?: Map<any, any>): T;
4508
- static deepClone<T>(target: T): T;
4509
- static deepCloneAndMerge<T>(target: A_TYPES__DeepPartial<T>, source: T): T;
4510
- /**
4511
- * Get a readable name for a component (string, class, function, React element, instance, etc.)
4512
- *
4513
- * Covers:
4514
- * - string tags ("div")
4515
- * - symbols (Symbol.for('xxx'))
4516
- * - functions and classes (with name or displayName)
4517
- * - React elements (object with `type`)
4518
- * - component instances (constructor.name)
4519
- * - objects with custom toString returning meaningful info
4520
- *
4521
- * Falls back to sensible defaults ("Unknown" / "Anonymous").
4522
- */
4523
- static getComponentName(component: any): string;
4524
- }
4525
-
4526
- /**
4527
- * A_FormatterHelper
4528
- *
4529
- * Helper class for formatting strings into different cases.
4530
- */
4531
- declare class A_FormatterHelper {
4532
- /**
4533
- * Convert string to UPPER_SNAKE_CASE
4534
- *
4535
- * @param str
4536
- * @returns
4537
- */
4538
- static toUpperSnakeCase(str: string): string;
4539
- /**
4540
- * Convert string to camelCase
4541
- *
4542
- * @param str
4543
- * @returns
4544
- */
4545
- static toCamelCase(str: string): string;
4546
- /**
4547
- * Convert string to PascalCase
4548
- *
4549
- * @param str
4550
- * @returns
4551
- */
4552
- static toPascalCase(str: string): string;
4553
- /**
4554
- * Convert string to kebab-case
4555
- *
4556
- * @param str
4557
- * @returns
4558
- */
4559
- static toKebabCase(str: string): string;
4560
- }
4561
-
4562
- type A_ID_TYPES__TimeId_Parts = {
4563
- timestamp: Date;
4564
- random: string;
4565
- };
4566
- declare class A_IdentityHelper {
4567
- /**
4568
- * Generates a short, time-based unique ID.
4569
- * Encodes current time (ms since epoch) and random bits in base36.
4570
- * Example: "mb4f1g-7f9a1c"
4571
- */
4572
- static generateTimeId(parts?: A_ID_TYPES__TimeId_Parts): string;
4573
- /**
4574
- * Parses a short ID back into its parts.
4575
- * Returns an object with the original timestamp (as Date) and random string.
4576
- */
4577
- static parseTimeId(id: string): A_ID_TYPES__TimeId_Parts;
4578
- /**
4579
- * Format a number with leading zeros to a fixed length
4580
- *
4581
- * @param number
4582
- * @param maxZeros
4583
- * @returns
4584
- */
4585
- static formatWithLeadingZeros(number: any, maxZeros?: number): string;
4586
- /**
4587
- * Remove leading zeros from a formatted number
4588
- */
4589
- static removeLeadingZeros(formattedNumber: any): string;
4590
- /**
4591
- * Generates a simple hash string from the input string.
4592
- *
4593
- *
4594
- * @param input
4595
- * @returns
4596
- */
4597
- static hashString(input: string): string;
4598
- }
4599
-
4600
- declare class A_StepManagerError extends A_Error {
4601
- static readonly CircularDependencyError = "A-StepManager Circular Dependency Error";
4602
- }
4603
-
4604
- declare class A_TypeGuards {
4605
- /**
4606
- * Check if value is a string
4607
- *
4608
- * @param value
4609
- * @returns
4610
- */
4611
- static isString(value: any): value is string;
4612
- /**
4613
- * Check if value is a number
4614
- *
4615
- * @param value
4616
- * @returns
4617
- */
4618
- static isNumber(value: any): value is number;
4619
- /**
4620
- * Check if value is a boolean
4621
- *
4622
- * @param value
4623
- * @returns
4624
- */
4625
- static isBoolean(value: any): value is boolean;
4626
- /**
4627
- * Check if value is an array
4628
- *
4629
- * @param value
4630
- * @returns
4631
- */
4632
- static isArray(value: any): value is Array<any>;
4633
- /**
4634
- * Check if value is an object
4635
- *
4636
- * @param value
4637
- * @returns
4638
- */
4639
- static isObject<T extends Object = Object>(value: any): value is T;
4640
- /**
4641
- * Check if value is a function
4642
- *
4643
- * @param value
4644
- * @returns
4645
- */
4646
- static isFunction(value: any): value is Function;
4647
- static isUndefined(value: any): value is undefined;
4648
- static isRegExp(value: any): value is RegExp;
4649
- /**
4650
- * Type guard to check if the constructor is of type A_Container
4651
- *
4652
- * @param ctor
4653
- * @returns
4654
- */
4655
- static isContainerConstructor(ctor: any): ctor is A_TYPES__Container_Constructor;
4656
- /**
4657
- * Type guard to check if the constructor is of type A_Component
4658
- *
4659
- * @param ctor
4660
- * @returns
4661
- */
4662
- static isComponentConstructor(ctor: any): ctor is A_TYPES__Component_Constructor;
4663
- /**
4664
- * Type guard to check if the constructor is of type A_Fragment
4665
- *
4666
- * @param ctor
4667
- * @returns
4668
- */
4669
- static isFragmentConstructor(ctor: any): ctor is A_TYPES__Fragment_Constructor;
4670
- /**
4671
- * Type guard to check if the constructor is of type A_Entity
4672
- *
4673
- * @param ctor
4674
- * @returns
4675
- */
4676
- static isEntityConstructor(ctor: any): ctor is A_TYPES__Entity_Constructor;
4677
- /**
4678
- * Type guard to check if the constructor is of type A_Scope
4679
- *
4680
- * @param ctor
4681
- * @returns
4682
- */
4683
- static isScopeConstructor(ctor: any): ctor is A_TYPES__Scope_Constructor;
4684
- /**
4685
- * Type guard to check if the constructor is of type A_Scope
4686
- *
4687
- * @param ctor
4688
- * @returns
4689
- */
4690
- static isErrorConstructor(ctor: any): ctor is A_TYPES__Error_Constructor;
4691
- /**
4692
- * Type guard to check if the constructor is of type A_Feature
4693
- *
4694
- * @param ctor
4695
- * @returns
4696
- */
4697
- static isFeatureConstructor(ctor: any): ctor is A_TYPES__Feature_Constructor;
4698
- /**
4699
- * Type guard to check if the constructor is of type A_Caller
4700
- *
4701
- * @param ctor
4702
- * @returns
4703
- */
4704
- static isCallerConstructor(ctor: any): ctor is A_TYPES__Caller_Constructor;
4705
- /**
4706
- * Type guard to check if the constructor is of type A_Dependency
4707
- *
4708
- * @param ctor
4709
- * @returns
4710
- */
4711
- static isDependencyConstructor<T extends A_TYPES__A_DependencyInjectable>(ctor: any): ctor is A_Dependency<T>;
4712
- /**
4713
- * Type guard to check if the instance is of type A_Dependency
4714
- *
4715
- * @param instance
4716
- * @returns
4717
- */
4718
- static isDependencyInstance<T extends A_TYPES__A_DependencyInjectable>(instance: any): instance is A_Dependency<T>;
4719
- /**
4720
- * Type guard to check if the instance is of type A_Container
4721
- *
4722
- * @param instance
4723
- * @returns
4724
- */
4725
- static isContainerInstance(instance: any): instance is A_Container;
4726
- /**
4727
- * Type guard to check if the instance is of type A_Component
4728
- *
4729
- * @param instance
4730
- * @returns
4731
- */
4732
- static isComponentInstance(instance: any): instance is A_Component;
4733
- /**
4734
- * Type guard to check if the instance is of type A_Feature
4735
- *
4736
- * @param instance
4737
- * @returns
4738
- */
4739
- static isFeatureInstance(instance: any): instance is A_Feature;
4740
- /**
4741
- * Type guard to check if the instance is of type A_Fragment
4742
- *
4743
- * @param instance
4744
- * @returns
4745
- */
4746
- static isFragmentInstance(instance: any): instance is A_Fragment;
4747
- /**
4748
- * Type guard to check if the instance is of type A_Entity
4749
- *
4750
- * @param instance
4751
- * @returns
4752
- */
4753
- static isEntityInstance(instance: any): instance is A_Entity;
4754
- /**
4755
- * Type guard to check if the instance is of type A_Scope
4756
- *
4757
- * @param instance
4758
- * @returns
4759
- */
4760
- static isScopeInstance(instance: any): instance is A_Scope;
4761
- /**
4762
- * Type guard to check if the instance is of type A_Error
4763
- *
4764
- * @param instance
4765
- * @returns
4766
- */
4767
- static isErrorInstance(instance: any): instance is A_Error;
4768
- /**
4769
- * Type guard to check if the instance is of type A_ComponentMeta
4770
- *
4771
- * @param instance
4772
- * @returns
4773
- */
4774
- static isComponentMetaInstance(instance: any): instance is A_ComponentMeta;
4775
- /**
4776
- * Type guard to check if the instance is of type A_ContainerMeta
4777
- *
4778
- * @param instance
4779
- * @returns
4780
- */
4781
- static isContainerMetaInstance(instance: any): instance is A_ContainerMeta;
4782
- /**
4783
- * Type guard to check if the instance is of type A_EntityMeta
4784
- *
4785
- * @param instance
4786
- * @returns
4787
- */
4788
- static isEntityMetaInstance(instance: any): instance is A_EntityMeta;
4789
- static hasASEID(value: any): value is A_Entity | A_Error;
4790
- static isConstructorAllowedForScopeAllocation(target: any): target is A_TYPES__ScopeLinkedConstructors;
4791
- static isInstanceAllowedForScopeAllocation(target: any): target is A_TYPES__ScopeLinkedComponents;
4792
- static isConstructorAvailableForAbstraction(target: any): target is A_TYPES__AbstractionAvailableComponents;
4793
- static isTargetAvailableForInjection(target: any): target is A_TYPES__InjectableTargets;
4794
- static isAllowedForFeatureCall(param: any): param is A_TYPES__FeatureAvailableComponents;
4795
- static isAllowedForFeatureDefinition(param: any): param is A_TYPES__FeatureAvailableComponents;
4796
- static isAllowedForFeatureExtension(param: any): param is A_TYPES__FeatureExtendDecoratorTarget;
4797
- static isAllowedForAbstractionDefinition(param: any): param is A_TYPES__AbstractionAvailableComponents;
4798
- static isAllowedForDependencyDefaultCreation(param: any): param is A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor;
4799
- /**
4800
- * Allows to check if the provided param is of constructor type.
4801
- *
4802
- * @param param
4803
- * @returns
4804
- */
4805
- static isErrorConstructorType<T extends A_TYPES__Error_Init>(param: any): param is T;
4806
- static isErrorSerializedType<T extends A_TYPES__Error_Serialized>(param: any): param is T;
4807
- static isPromiseInstance<T>(value: any): value is Promise<T>;
4808
- }
4809
-
4810
- export { ASEID, ASEID_Error, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_Default, A_Dependency_Load, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };