@adaas/a-concept 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +64 -156
- package/dist/index.d.ts +64 -156
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/global/A-Context/A-Context.class.ts +0 -1
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +23 -4
- package/src/global/A-Fragment/A-Fragment.class.ts +4 -203
- package/src/global/A-Meta/A-Meta.class.ts +45 -2
- package/src/global/A-Scope/A-Scope.class.ts +68 -9
- package/src/global/A-Scope/A-Scope.types.ts +3 -0
- package/tests/A-Container.test.ts +34 -1
- package/tests/A-Fragment.test.ts +0 -305
- package/tests/A-Scope.test.ts +39 -0
package/dist/index.d.mts
CHANGED
|
@@ -73,7 +73,7 @@ type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__Uni
|
|
|
73
73
|
*
|
|
74
74
|
* [!] Meta can be different depending on the type of input data
|
|
75
75
|
*/
|
|
76
|
-
declare class A_Meta<_StorageItems extends Record<string, any> = any> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
76
|
+
declare class A_Meta<_StorageItems extends Record<string, any> = any, _SerializedType extends Record<string, any> = Record<string, any>> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
77
77
|
protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
|
|
78
78
|
/**
|
|
79
79
|
* Method to get the iterator for the meta object
|
|
@@ -164,6 +164,14 @@ declare class A_Meta<_StorageItems extends Record<string, any> = any> implements
|
|
|
164
164
|
*/
|
|
165
165
|
clear(): void;
|
|
166
166
|
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
167
|
+
protected recursiveToJSON(value: any): any;
|
|
168
|
+
/**
|
|
169
|
+
* Serializes the meta to a JSON object
|
|
170
|
+
* Uses internal storage to convert to JSON
|
|
171
|
+
*
|
|
172
|
+
* @returns
|
|
173
|
+
*/
|
|
174
|
+
toJSON(): _SerializedType;
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
declare enum A_TYPES__ContainerMetaKey {
|
|
@@ -1203,7 +1211,7 @@ declare class A_Stage {
|
|
|
1203
1211
|
* @param step
|
|
1204
1212
|
* @returns
|
|
1205
1213
|
*/
|
|
1206
|
-
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<(A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Scope<A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<
|
|
1214
|
+
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<(A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]> | A_Feature<A_TYPES__FeatureAvailableComponents> | A_Fragment<A_TYPES__Fragment_Serialized> | A_Error<A_TYPES__Error_Init, A_TYPES__Error_Serialized> | A_TYPES__ScopeResolvableComponents[] | undefined)[]>;
|
|
1207
1215
|
/**
|
|
1208
1216
|
* Resolves the component of the step
|
|
1209
1217
|
*
|
|
@@ -2221,7 +2229,7 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2221
2229
|
/**
|
|
2222
2230
|
* The primary Root scope of the concept.
|
|
2223
2231
|
*/
|
|
2224
|
-
get scope(): A_Scope<A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<
|
|
2232
|
+
get scope(): A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]>;
|
|
2225
2233
|
/**
|
|
2226
2234
|
* Register a class or value in the concept scope.
|
|
2227
2235
|
*/
|
|
@@ -2313,18 +2321,12 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2313
2321
|
* }
|
|
2314
2322
|
* ```
|
|
2315
2323
|
*/
|
|
2316
|
-
declare class A_Fragment<
|
|
2324
|
+
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
2317
2325
|
/**
|
|
2318
2326
|
* The unique identifier/name for this fragment instance.
|
|
2319
2327
|
* Used for identification and debugging purposes.
|
|
2320
2328
|
*/
|
|
2321
2329
|
protected _name: string;
|
|
2322
|
-
/**
|
|
2323
|
-
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2324
|
-
* This stores all the fragment's runtime data that can be accessed and modified
|
|
2325
|
-
* throughout the execution pipeline.
|
|
2326
|
-
*/
|
|
2327
|
-
protected _meta: A_Meta<_MetaItems>;
|
|
2328
2330
|
/**
|
|
2329
2331
|
* Creates a new A_Fragment instance.
|
|
2330
2332
|
*
|
|
@@ -2357,147 +2359,6 @@ declare class A_Fragment<_MetaItems extends Record<string, any> = any, _Serializ
|
|
|
2357
2359
|
* @returns The fragment name
|
|
2358
2360
|
*/
|
|
2359
2361
|
get name(): string;
|
|
2360
|
-
/**
|
|
2361
|
-
* Gets direct access to the underlying Meta object for advanced meta operations.
|
|
2362
|
-
*
|
|
2363
|
-
* Use this when you need to perform bulk operations or access Meta-specific methods.
|
|
2364
|
-
* For simple get/set operations, prefer using the direct methods on the fragment.
|
|
2365
|
-
*
|
|
2366
|
-
* @returns The Meta instance containing the fragment's meta
|
|
2367
|
-
*
|
|
2368
|
-
* @example
|
|
2369
|
-
* ```typescript
|
|
2370
|
-
* const fragment = new A_Fragment<{ users: string[], count: number }>();
|
|
2371
|
-
*
|
|
2372
|
-
* // Advanced operations using meta
|
|
2373
|
-
* fragment.meta.setMultiple({
|
|
2374
|
-
* users: ['alice', 'bob'],
|
|
2375
|
-
* count: 2
|
|
2376
|
-
* });
|
|
2377
|
-
*
|
|
2378
|
-
* // Get all keys
|
|
2379
|
-
* const keys = fragment.meta.keys();
|
|
2380
|
-
* ```
|
|
2381
|
-
*/
|
|
2382
|
-
get meta(): A_Meta<_MetaItems>;
|
|
2383
|
-
/**
|
|
2384
|
-
* Checks if a specific meta key exists in the fragment.
|
|
2385
|
-
*
|
|
2386
|
-
* @param param - The key to check for existence
|
|
2387
|
-
* @returns True if the key exists, false otherwise
|
|
2388
|
-
*
|
|
2389
|
-
* @example
|
|
2390
|
-
* ```typescript
|
|
2391
|
-
* if (fragment.has('userId')) {
|
|
2392
|
-
* console.log('User ID is set');
|
|
2393
|
-
* }
|
|
2394
|
-
* ```
|
|
2395
|
-
*/
|
|
2396
|
-
has(param: keyof _MetaItems): boolean;
|
|
2397
|
-
/**
|
|
2398
|
-
* Retrieves a value from the fragment's meta.
|
|
2399
|
-
*
|
|
2400
|
-
* @param param - The key to retrieve
|
|
2401
|
-
* @returns The value associated with the key, or undefined if not found
|
|
2402
|
-
*
|
|
2403
|
-
* @example
|
|
2404
|
-
* ```typescript
|
|
2405
|
-
* const userId = fragment.get('userId');
|
|
2406
|
-
* if (userId) {
|
|
2407
|
-
* console.log(`Current user: ${userId}`);
|
|
2408
|
-
* }
|
|
2409
|
-
* ```
|
|
2410
|
-
*/
|
|
2411
|
-
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2412
|
-
/**
|
|
2413
|
-
* Stores a value in the fragment's meta.
|
|
2414
|
-
*
|
|
2415
|
-
* @param param - The key to store the value under
|
|
2416
|
-
* @param value - The value to store
|
|
2417
|
-
*
|
|
2418
|
-
* @example
|
|
2419
|
-
* ```typescript
|
|
2420
|
-
* fragment.set('userId', '12345');
|
|
2421
|
-
* fragment.set('role', 'admin');
|
|
2422
|
-
* ```
|
|
2423
|
-
*/
|
|
2424
|
-
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2425
|
-
/**
|
|
2426
|
-
* Removes a specific key from the fragment's meta.
|
|
2427
|
-
*
|
|
2428
|
-
* @param param - The key to remove
|
|
2429
|
-
*
|
|
2430
|
-
* @example
|
|
2431
|
-
* ```typescript
|
|
2432
|
-
* fragment.drop('temporaryData');
|
|
2433
|
-
* ```
|
|
2434
|
-
*/
|
|
2435
|
-
drop(param: keyof _MetaItems): void;
|
|
2436
|
-
/**
|
|
2437
|
-
* Clears all data from the fragment's meta.
|
|
2438
|
-
*
|
|
2439
|
-
* Use with caution as this will remove all stored data in the fragment.
|
|
2440
|
-
*
|
|
2441
|
-
* @example
|
|
2442
|
-
* ```typescript
|
|
2443
|
-
* fragment.clear(); // All meta data is now gone
|
|
2444
|
-
* ```
|
|
2445
|
-
*/
|
|
2446
|
-
clear(): void;
|
|
2447
|
-
/**
|
|
2448
|
-
* Gets the number of items stored in the fragment's meta.
|
|
2449
|
-
*
|
|
2450
|
-
* @returns The count of stored meta items
|
|
2451
|
-
*
|
|
2452
|
-
* @example
|
|
2453
|
-
* ```typescript
|
|
2454
|
-
* console.log(`Fragment contains ${fragment.size()} items`);
|
|
2455
|
-
* ```
|
|
2456
|
-
*/
|
|
2457
|
-
size(): number;
|
|
2458
|
-
/**
|
|
2459
|
-
* Gets all keys currently stored in the fragment's meta.
|
|
2460
|
-
*
|
|
2461
|
-
* @returns Array of all meta keys
|
|
2462
|
-
*
|
|
2463
|
-
* @example
|
|
2464
|
-
* ```typescript
|
|
2465
|
-
* const keys = fragment.keys();
|
|
2466
|
-
* console.log('Stored keys:', keys);
|
|
2467
|
-
* ```
|
|
2468
|
-
*/
|
|
2469
|
-
keys(): (keyof _MetaItems)[];
|
|
2470
|
-
/**
|
|
2471
|
-
* Sets multiple values at once in the fragment's meta.
|
|
2472
|
-
*
|
|
2473
|
-
* @param data - Object containing key-value pairs to set
|
|
2474
|
-
*
|
|
2475
|
-
* @example
|
|
2476
|
-
* ```typescript
|
|
2477
|
-
* fragment.setMultiple({
|
|
2478
|
-
* userId: '12345',
|
|
2479
|
-
* role: 'admin',
|
|
2480
|
-
* lastLogin: new Date()
|
|
2481
|
-
* });
|
|
2482
|
-
* ```
|
|
2483
|
-
*/
|
|
2484
|
-
setMultiple(data: A_TYPES__DeepPartial<_MetaItems>): void;
|
|
2485
|
-
/**
|
|
2486
|
-
* Creates a shallow copy of the fragment with the same meta data.
|
|
2487
|
-
*
|
|
2488
|
-
* @param newName - Optional new name for the cloned fragment
|
|
2489
|
-
* @returns A new fragment instance with copied meta
|
|
2490
|
-
*
|
|
2491
|
-
* @example
|
|
2492
|
-
* ```typescript
|
|
2493
|
-
* const original = new A_Fragment<{ data: string }>({ name: 'original' });
|
|
2494
|
-
* original.set('data', 'test');
|
|
2495
|
-
*
|
|
2496
|
-
* const clone = original.clone('cloned');
|
|
2497
|
-
* console.log(clone.get('data')); // 'test'
|
|
2498
|
-
* ```
|
|
2499
|
-
*/
|
|
2500
|
-
clone(newName?: string): A_Fragment<_MetaItems, _SerializedType>;
|
|
2501
2362
|
/**
|
|
2502
2363
|
* Serializes the fragment to a JSON-compatible object.
|
|
2503
2364
|
*
|
|
@@ -2734,7 +2595,7 @@ type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
|
2734
2595
|
from: 'start' | 'end';
|
|
2735
2596
|
};
|
|
2736
2597
|
|
|
2737
|
-
declare class A_Scope<_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[]> {
|
|
2598
|
+
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[]> {
|
|
2738
2599
|
/**
|
|
2739
2600
|
* Scope Name uses for identification and logging purposes
|
|
2740
2601
|
*/
|
|
@@ -2743,6 +2604,12 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2743
2604
|
* Parent scope reference, used for inheritance of components, fragments, entities and commands
|
|
2744
2605
|
*/
|
|
2745
2606
|
protected _parent?: A_Scope;
|
|
2607
|
+
/**
|
|
2608
|
+
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2609
|
+
* This stores all the scope's runtime data that can be accessed and modified
|
|
2610
|
+
* throughout the execution pipeline or within running containers.
|
|
2611
|
+
*/
|
|
2612
|
+
protected _meta: A_Meta<_MetaItems>;
|
|
2746
2613
|
/**
|
|
2747
2614
|
* A set of allowed components, A set of constructors that are allowed in the scope
|
|
2748
2615
|
*
|
|
@@ -2780,6 +2647,10 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2780
2647
|
* Returns the name of the scope
|
|
2781
2648
|
*/
|
|
2782
2649
|
get name(): string;
|
|
2650
|
+
/**
|
|
2651
|
+
* Returns the meta object of the scope
|
|
2652
|
+
*/
|
|
2653
|
+
get meta(): A_Meta<_MetaItems, Record<string, any>>;
|
|
2783
2654
|
/**
|
|
2784
2655
|
* Returns a list of Constructors for A-Components that are available in the scope
|
|
2785
2656
|
*/
|
|
@@ -2847,7 +2718,7 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2847
2718
|
/**
|
|
2848
2719
|
* A set of constructors that are allowed in the scope
|
|
2849
2720
|
*/
|
|
2850
|
-
params: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
|
|
2721
|
+
params: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>,
|
|
2851
2722
|
/**
|
|
2852
2723
|
* Configuration options for the scope
|
|
2853
2724
|
*/
|
|
@@ -2858,8 +2729,8 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2858
2729
|
* @param param1
|
|
2859
2730
|
* @returns
|
|
2860
2731
|
*/
|
|
2861
|
-
protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
|
|
2862
|
-
protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
|
|
2732
|
+
protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
|
|
2733
|
+
protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
|
|
2863
2734
|
/**
|
|
2864
2735
|
* This method is used to initialize the components in the scope
|
|
2865
2736
|
* To save memory components are initialized only when they are requested
|
|
@@ -2896,6 +2767,14 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2896
2767
|
* @param _fragments
|
|
2897
2768
|
*/
|
|
2898
2769
|
protected initFragments(_fragments?: _FragmentType): void;
|
|
2770
|
+
/**
|
|
2771
|
+
* This method is used to initialize the meta in the scope
|
|
2772
|
+
*
|
|
2773
|
+
* This method only sets the meta values in the scope in case they are not set yet
|
|
2774
|
+
*
|
|
2775
|
+
* @param _meta
|
|
2776
|
+
*/
|
|
2777
|
+
protected initMeta(_meta?: Partial<_MetaItems>): void;
|
|
2899
2778
|
/**
|
|
2900
2779
|
* This method is used to destroy the scope and all its registered components, fragments and entities
|
|
2901
2780
|
*
|
|
@@ -2903,6 +2782,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2903
2782
|
* [!] This method also clears all internal registries and collections
|
|
2904
2783
|
*/
|
|
2905
2784
|
destroy(): void;
|
|
2785
|
+
/**
|
|
2786
|
+
* Retrieves a value from the scope's meta.
|
|
2787
|
+
*
|
|
2788
|
+
* @param param - The key to retrieve
|
|
2789
|
+
* @returns The value associated with the key, or undefined if not found
|
|
2790
|
+
*
|
|
2791
|
+
* @example
|
|
2792
|
+
* ```typescript
|
|
2793
|
+
* const userId = scope.get('userId');
|
|
2794
|
+
* if (userId) {
|
|
2795
|
+
* console.log(`Current user: ${userId}`);
|
|
2796
|
+
* }
|
|
2797
|
+
* ```
|
|
2798
|
+
*/
|
|
2799
|
+
get<K extends keyof _MetaItems>(param: K): _MetaItems[K] | undefined;
|
|
2800
|
+
/**
|
|
2801
|
+
* Stores a value in the scope's meta.
|
|
2802
|
+
*
|
|
2803
|
+
* @param param - The key to store the value under
|
|
2804
|
+
* @param value - The value to store
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
* ```typescript
|
|
2808
|
+
* scope.set('userId', '12345');
|
|
2809
|
+
* scope.set('role', 'admin');
|
|
2810
|
+
* ```
|
|
2811
|
+
*/
|
|
2812
|
+
set<K extends keyof _MetaItems>(param: K, value: _MetaItems[K]): void;
|
|
2906
2813
|
/**
|
|
2907
2814
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2908
2815
|
*
|
|
@@ -3310,7 +3217,7 @@ type A_TYPES__Scope_Constructor<T = A_Scope> = new (...args: any[]) => T;
|
|
|
3310
3217
|
/**
|
|
3311
3218
|
* Scope initialization type
|
|
3312
3219
|
*/
|
|
3313
|
-
type A_TYPES__Scope_Init<_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[]> = {
|
|
3220
|
+
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[]> = {
|
|
3314
3221
|
/**
|
|
3315
3222
|
* Scope Name
|
|
3316
3223
|
*/
|
|
@@ -3335,6 +3242,7 @@ type A_TYPES__Scope_Init<_ComponentType extends A_TYPES__Component_Constructor[]
|
|
|
3335
3242
|
..._EntityType,
|
|
3336
3243
|
...InstanceType<_EntityType[number]>[]
|
|
3337
3244
|
];
|
|
3245
|
+
meta: Partial<_MetaItems>;
|
|
3338
3246
|
};
|
|
3339
3247
|
/**
|
|
3340
3248
|
* Scope configuration type
|
package/dist/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__Uni
|
|
|
73
73
|
*
|
|
74
74
|
* [!] Meta can be different depending on the type of input data
|
|
75
75
|
*/
|
|
76
|
-
declare class A_Meta<_StorageItems extends Record<string, any> = any> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
76
|
+
declare class A_Meta<_StorageItems extends Record<string, any> = any, _SerializedType extends Record<string, any> = Record<string, any>> implements Iterable<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> {
|
|
77
77
|
protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]>;
|
|
78
78
|
/**
|
|
79
79
|
* Method to get the iterator for the meta object
|
|
@@ -164,6 +164,14 @@ declare class A_Meta<_StorageItems extends Record<string, any> = any> implements
|
|
|
164
164
|
*/
|
|
165
165
|
clear(): void;
|
|
166
166
|
toArray(): Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]>;
|
|
167
|
+
protected recursiveToJSON(value: any): any;
|
|
168
|
+
/**
|
|
169
|
+
* Serializes the meta to a JSON object
|
|
170
|
+
* Uses internal storage to convert to JSON
|
|
171
|
+
*
|
|
172
|
+
* @returns
|
|
173
|
+
*/
|
|
174
|
+
toJSON(): _SerializedType;
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
declare enum A_TYPES__ContainerMetaKey {
|
|
@@ -1203,7 +1211,7 @@ declare class A_Stage {
|
|
|
1203
1211
|
* @param step
|
|
1204
1212
|
* @returns
|
|
1205
1213
|
*/
|
|
1206
|
-
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<(A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Scope<A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<
|
|
1214
|
+
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): Promise<(A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]> | A_Feature<A_TYPES__FeatureAvailableComponents> | A_Fragment<A_TYPES__Fragment_Serialized> | A_Error<A_TYPES__Error_Init, A_TYPES__Error_Serialized> | A_TYPES__ScopeResolvableComponents[] | undefined)[]>;
|
|
1207
1215
|
/**
|
|
1208
1216
|
* Resolves the component of the step
|
|
1209
1217
|
*
|
|
@@ -2221,7 +2229,7 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2221
2229
|
/**
|
|
2222
2230
|
* The primary Root scope of the concept.
|
|
2223
2231
|
*/
|
|
2224
|
-
get scope(): A_Scope<A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<
|
|
2232
|
+
get scope(): A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]>;
|
|
2225
2233
|
/**
|
|
2226
2234
|
* Register a class or value in the concept scope.
|
|
2227
2235
|
*/
|
|
@@ -2313,18 +2321,12 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2313
2321
|
* }
|
|
2314
2322
|
* ```
|
|
2315
2323
|
*/
|
|
2316
|
-
declare class A_Fragment<
|
|
2324
|
+
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
2317
2325
|
/**
|
|
2318
2326
|
* The unique identifier/name for this fragment instance.
|
|
2319
2327
|
* Used for identification and debugging purposes.
|
|
2320
2328
|
*/
|
|
2321
2329
|
protected _name: string;
|
|
2322
|
-
/**
|
|
2323
|
-
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2324
|
-
* This stores all the fragment's runtime data that can be accessed and modified
|
|
2325
|
-
* throughout the execution pipeline.
|
|
2326
|
-
*/
|
|
2327
|
-
protected _meta: A_Meta<_MetaItems>;
|
|
2328
2330
|
/**
|
|
2329
2331
|
* Creates a new A_Fragment instance.
|
|
2330
2332
|
*
|
|
@@ -2357,147 +2359,6 @@ declare class A_Fragment<_MetaItems extends Record<string, any> = any, _Serializ
|
|
|
2357
2359
|
* @returns The fragment name
|
|
2358
2360
|
*/
|
|
2359
2361
|
get name(): string;
|
|
2360
|
-
/**
|
|
2361
|
-
* Gets direct access to the underlying Meta object for advanced meta operations.
|
|
2362
|
-
*
|
|
2363
|
-
* Use this when you need to perform bulk operations or access Meta-specific methods.
|
|
2364
|
-
* For simple get/set operations, prefer using the direct methods on the fragment.
|
|
2365
|
-
*
|
|
2366
|
-
* @returns The Meta instance containing the fragment's meta
|
|
2367
|
-
*
|
|
2368
|
-
* @example
|
|
2369
|
-
* ```typescript
|
|
2370
|
-
* const fragment = new A_Fragment<{ users: string[], count: number }>();
|
|
2371
|
-
*
|
|
2372
|
-
* // Advanced operations using meta
|
|
2373
|
-
* fragment.meta.setMultiple({
|
|
2374
|
-
* users: ['alice', 'bob'],
|
|
2375
|
-
* count: 2
|
|
2376
|
-
* });
|
|
2377
|
-
*
|
|
2378
|
-
* // Get all keys
|
|
2379
|
-
* const keys = fragment.meta.keys();
|
|
2380
|
-
* ```
|
|
2381
|
-
*/
|
|
2382
|
-
get meta(): A_Meta<_MetaItems>;
|
|
2383
|
-
/**
|
|
2384
|
-
* Checks if a specific meta key exists in the fragment.
|
|
2385
|
-
*
|
|
2386
|
-
* @param param - The key to check for existence
|
|
2387
|
-
* @returns True if the key exists, false otherwise
|
|
2388
|
-
*
|
|
2389
|
-
* @example
|
|
2390
|
-
* ```typescript
|
|
2391
|
-
* if (fragment.has('userId')) {
|
|
2392
|
-
* console.log('User ID is set');
|
|
2393
|
-
* }
|
|
2394
|
-
* ```
|
|
2395
|
-
*/
|
|
2396
|
-
has(param: keyof _MetaItems): boolean;
|
|
2397
|
-
/**
|
|
2398
|
-
* Retrieves a value from the fragment's meta.
|
|
2399
|
-
*
|
|
2400
|
-
* @param param - The key to retrieve
|
|
2401
|
-
* @returns The value associated with the key, or undefined if not found
|
|
2402
|
-
*
|
|
2403
|
-
* @example
|
|
2404
|
-
* ```typescript
|
|
2405
|
-
* const userId = fragment.get('userId');
|
|
2406
|
-
* if (userId) {
|
|
2407
|
-
* console.log(`Current user: ${userId}`);
|
|
2408
|
-
* }
|
|
2409
|
-
* ```
|
|
2410
|
-
*/
|
|
2411
|
-
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2412
|
-
/**
|
|
2413
|
-
* Stores a value in the fragment's meta.
|
|
2414
|
-
*
|
|
2415
|
-
* @param param - The key to store the value under
|
|
2416
|
-
* @param value - The value to store
|
|
2417
|
-
*
|
|
2418
|
-
* @example
|
|
2419
|
-
* ```typescript
|
|
2420
|
-
* fragment.set('userId', '12345');
|
|
2421
|
-
* fragment.set('role', 'admin');
|
|
2422
|
-
* ```
|
|
2423
|
-
*/
|
|
2424
|
-
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2425
|
-
/**
|
|
2426
|
-
* Removes a specific key from the fragment's meta.
|
|
2427
|
-
*
|
|
2428
|
-
* @param param - The key to remove
|
|
2429
|
-
*
|
|
2430
|
-
* @example
|
|
2431
|
-
* ```typescript
|
|
2432
|
-
* fragment.drop('temporaryData');
|
|
2433
|
-
* ```
|
|
2434
|
-
*/
|
|
2435
|
-
drop(param: keyof _MetaItems): void;
|
|
2436
|
-
/**
|
|
2437
|
-
* Clears all data from the fragment's meta.
|
|
2438
|
-
*
|
|
2439
|
-
* Use with caution as this will remove all stored data in the fragment.
|
|
2440
|
-
*
|
|
2441
|
-
* @example
|
|
2442
|
-
* ```typescript
|
|
2443
|
-
* fragment.clear(); // All meta data is now gone
|
|
2444
|
-
* ```
|
|
2445
|
-
*/
|
|
2446
|
-
clear(): void;
|
|
2447
|
-
/**
|
|
2448
|
-
* Gets the number of items stored in the fragment's meta.
|
|
2449
|
-
*
|
|
2450
|
-
* @returns The count of stored meta items
|
|
2451
|
-
*
|
|
2452
|
-
* @example
|
|
2453
|
-
* ```typescript
|
|
2454
|
-
* console.log(`Fragment contains ${fragment.size()} items`);
|
|
2455
|
-
* ```
|
|
2456
|
-
*/
|
|
2457
|
-
size(): number;
|
|
2458
|
-
/**
|
|
2459
|
-
* Gets all keys currently stored in the fragment's meta.
|
|
2460
|
-
*
|
|
2461
|
-
* @returns Array of all meta keys
|
|
2462
|
-
*
|
|
2463
|
-
* @example
|
|
2464
|
-
* ```typescript
|
|
2465
|
-
* const keys = fragment.keys();
|
|
2466
|
-
* console.log('Stored keys:', keys);
|
|
2467
|
-
* ```
|
|
2468
|
-
*/
|
|
2469
|
-
keys(): (keyof _MetaItems)[];
|
|
2470
|
-
/**
|
|
2471
|
-
* Sets multiple values at once in the fragment's meta.
|
|
2472
|
-
*
|
|
2473
|
-
* @param data - Object containing key-value pairs to set
|
|
2474
|
-
*
|
|
2475
|
-
* @example
|
|
2476
|
-
* ```typescript
|
|
2477
|
-
* fragment.setMultiple({
|
|
2478
|
-
* userId: '12345',
|
|
2479
|
-
* role: 'admin',
|
|
2480
|
-
* lastLogin: new Date()
|
|
2481
|
-
* });
|
|
2482
|
-
* ```
|
|
2483
|
-
*/
|
|
2484
|
-
setMultiple(data: A_TYPES__DeepPartial<_MetaItems>): void;
|
|
2485
|
-
/**
|
|
2486
|
-
* Creates a shallow copy of the fragment with the same meta data.
|
|
2487
|
-
*
|
|
2488
|
-
* @param newName - Optional new name for the cloned fragment
|
|
2489
|
-
* @returns A new fragment instance with copied meta
|
|
2490
|
-
*
|
|
2491
|
-
* @example
|
|
2492
|
-
* ```typescript
|
|
2493
|
-
* const original = new A_Fragment<{ data: string }>({ name: 'original' });
|
|
2494
|
-
* original.set('data', 'test');
|
|
2495
|
-
*
|
|
2496
|
-
* const clone = original.clone('cloned');
|
|
2497
|
-
* console.log(clone.get('data')); // 'test'
|
|
2498
|
-
* ```
|
|
2499
|
-
*/
|
|
2500
|
-
clone(newName?: string): A_Fragment<_MetaItems, _SerializedType>;
|
|
2501
2362
|
/**
|
|
2502
2363
|
* Serializes the fragment to a JSON-compatible object.
|
|
2503
2364
|
*
|
|
@@ -2734,7 +2595,7 @@ type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
|
2734
2595
|
from: 'start' | 'end';
|
|
2735
2596
|
};
|
|
2736
2597
|
|
|
2737
|
-
declare class A_Scope<_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[]> {
|
|
2598
|
+
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[]> {
|
|
2738
2599
|
/**
|
|
2739
2600
|
* Scope Name uses for identification and logging purposes
|
|
2740
2601
|
*/
|
|
@@ -2743,6 +2604,12 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2743
2604
|
* Parent scope reference, used for inheritance of components, fragments, entities and commands
|
|
2744
2605
|
*/
|
|
2745
2606
|
protected _parent?: A_Scope;
|
|
2607
|
+
/**
|
|
2608
|
+
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2609
|
+
* This stores all the scope's runtime data that can be accessed and modified
|
|
2610
|
+
* throughout the execution pipeline or within running containers.
|
|
2611
|
+
*/
|
|
2612
|
+
protected _meta: A_Meta<_MetaItems>;
|
|
2746
2613
|
/**
|
|
2747
2614
|
* A set of allowed components, A set of constructors that are allowed in the scope
|
|
2748
2615
|
*
|
|
@@ -2780,6 +2647,10 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2780
2647
|
* Returns the name of the scope
|
|
2781
2648
|
*/
|
|
2782
2649
|
get name(): string;
|
|
2650
|
+
/**
|
|
2651
|
+
* Returns the meta object of the scope
|
|
2652
|
+
*/
|
|
2653
|
+
get meta(): A_Meta<_MetaItems, Record<string, any>>;
|
|
2783
2654
|
/**
|
|
2784
2655
|
* Returns a list of Constructors for A-Components that are available in the scope
|
|
2785
2656
|
*/
|
|
@@ -2847,7 +2718,7 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2847
2718
|
/**
|
|
2848
2719
|
* A set of constructors that are allowed in the scope
|
|
2849
2720
|
*/
|
|
2850
|
-
params: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
|
|
2721
|
+
params: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>,
|
|
2851
2722
|
/**
|
|
2852
2723
|
* Configuration options for the scope
|
|
2853
2724
|
*/
|
|
@@ -2858,8 +2729,8 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2858
2729
|
* @param param1
|
|
2859
2730
|
* @returns
|
|
2860
2731
|
*/
|
|
2861
|
-
protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
|
|
2862
|
-
protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
|
|
2732
|
+
protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
|
|
2733
|
+
protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_MetaItems, _ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
|
|
2863
2734
|
/**
|
|
2864
2735
|
* This method is used to initialize the components in the scope
|
|
2865
2736
|
* To save memory components are initialized only when they are requested
|
|
@@ -2896,6 +2767,14 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2896
2767
|
* @param _fragments
|
|
2897
2768
|
*/
|
|
2898
2769
|
protected initFragments(_fragments?: _FragmentType): void;
|
|
2770
|
+
/**
|
|
2771
|
+
* This method is used to initialize the meta in the scope
|
|
2772
|
+
*
|
|
2773
|
+
* This method only sets the meta values in the scope in case they are not set yet
|
|
2774
|
+
*
|
|
2775
|
+
* @param _meta
|
|
2776
|
+
*/
|
|
2777
|
+
protected initMeta(_meta?: Partial<_MetaItems>): void;
|
|
2899
2778
|
/**
|
|
2900
2779
|
* This method is used to destroy the scope and all its registered components, fragments and entities
|
|
2901
2780
|
*
|
|
@@ -2903,6 +2782,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2903
2782
|
* [!] This method also clears all internal registries and collections
|
|
2904
2783
|
*/
|
|
2905
2784
|
destroy(): void;
|
|
2785
|
+
/**
|
|
2786
|
+
* Retrieves a value from the scope's meta.
|
|
2787
|
+
*
|
|
2788
|
+
* @param param - The key to retrieve
|
|
2789
|
+
* @returns The value associated with the key, or undefined if not found
|
|
2790
|
+
*
|
|
2791
|
+
* @example
|
|
2792
|
+
* ```typescript
|
|
2793
|
+
* const userId = scope.get('userId');
|
|
2794
|
+
* if (userId) {
|
|
2795
|
+
* console.log(`Current user: ${userId}`);
|
|
2796
|
+
* }
|
|
2797
|
+
* ```
|
|
2798
|
+
*/
|
|
2799
|
+
get<K extends keyof _MetaItems>(param: K): _MetaItems[K] | undefined;
|
|
2800
|
+
/**
|
|
2801
|
+
* Stores a value in the scope's meta.
|
|
2802
|
+
*
|
|
2803
|
+
* @param param - The key to store the value under
|
|
2804
|
+
* @param value - The value to store
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
* ```typescript
|
|
2808
|
+
* scope.set('userId', '12345');
|
|
2809
|
+
* scope.set('role', 'admin');
|
|
2810
|
+
* ```
|
|
2811
|
+
*/
|
|
2812
|
+
set<K extends keyof _MetaItems>(param: K, value: _MetaItems[K]): void;
|
|
2906
2813
|
/**
|
|
2907
2814
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2908
2815
|
*
|
|
@@ -3310,7 +3217,7 @@ type A_TYPES__Scope_Constructor<T = A_Scope> = new (...args: any[]) => T;
|
|
|
3310
3217
|
/**
|
|
3311
3218
|
* Scope initialization type
|
|
3312
3219
|
*/
|
|
3313
|
-
type A_TYPES__Scope_Init<_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[]> = {
|
|
3220
|
+
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[]> = {
|
|
3314
3221
|
/**
|
|
3315
3222
|
* Scope Name
|
|
3316
3223
|
*/
|
|
@@ -3335,6 +3242,7 @@ type A_TYPES__Scope_Init<_ComponentType extends A_TYPES__Component_Constructor[]
|
|
|
3335
3242
|
..._EntityType,
|
|
3336
3243
|
...InstanceType<_EntityType[number]>[]
|
|
3337
3244
|
];
|
|
3245
|
+
meta: Partial<_MetaItems>;
|
|
3338
3246
|
};
|
|
3339
3247
|
/**
|
|
3340
3248
|
* Scope configuration type
|