@adaas/a-concept 0.1.44 → 0.1.45
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 +51 -152
- package/dist/index.d.ts +51 -152
- 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 +48 -3
- package/tests/A-Container.test.ts +34 -1
- package/tests/A-Fragment.test.ts +0 -305
- package/tests/A-Scope.test.ts +12 -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
|
*/
|
|
@@ -2903,6 +2774,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2903
2774
|
* [!] This method also clears all internal registries and collections
|
|
2904
2775
|
*/
|
|
2905
2776
|
destroy(): void;
|
|
2777
|
+
/**
|
|
2778
|
+
* Retrieves a value from the scope's meta.
|
|
2779
|
+
*
|
|
2780
|
+
* @param param - The key to retrieve
|
|
2781
|
+
* @returns The value associated with the key, or undefined if not found
|
|
2782
|
+
*
|
|
2783
|
+
* @example
|
|
2784
|
+
* ```typescript
|
|
2785
|
+
* const userId = scope.get('userId');
|
|
2786
|
+
* if (userId) {
|
|
2787
|
+
* console.log(`Current user: ${userId}`);
|
|
2788
|
+
* }
|
|
2789
|
+
* ```
|
|
2790
|
+
*/
|
|
2791
|
+
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2792
|
+
/**
|
|
2793
|
+
* Stores a value in the scope's meta.
|
|
2794
|
+
*
|
|
2795
|
+
* @param param - The key to store the value under
|
|
2796
|
+
* @param value - The value to store
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* ```typescript
|
|
2800
|
+
* scope.set('userId', '12345');
|
|
2801
|
+
* scope.set('role', 'admin');
|
|
2802
|
+
* ```
|
|
2803
|
+
*/
|
|
2804
|
+
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2906
2805
|
/**
|
|
2907
2806
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2908
2807
|
*
|
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
|
*/
|
|
@@ -2903,6 +2774,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2903
2774
|
* [!] This method also clears all internal registries and collections
|
|
2904
2775
|
*/
|
|
2905
2776
|
destroy(): void;
|
|
2777
|
+
/**
|
|
2778
|
+
* Retrieves a value from the scope's meta.
|
|
2779
|
+
*
|
|
2780
|
+
* @param param - The key to retrieve
|
|
2781
|
+
* @returns The value associated with the key, or undefined if not found
|
|
2782
|
+
*
|
|
2783
|
+
* @example
|
|
2784
|
+
* ```typescript
|
|
2785
|
+
* const userId = scope.get('userId');
|
|
2786
|
+
* if (userId) {
|
|
2787
|
+
* console.log(`Current user: ${userId}`);
|
|
2788
|
+
* }
|
|
2789
|
+
* ```
|
|
2790
|
+
*/
|
|
2791
|
+
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2792
|
+
/**
|
|
2793
|
+
* Stores a value in the scope's meta.
|
|
2794
|
+
*
|
|
2795
|
+
* @param param - The key to store the value under
|
|
2796
|
+
* @param value - The value to store
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* ```typescript
|
|
2800
|
+
* scope.set('userId', '12345');
|
|
2801
|
+
* scope.set('role', 'admin');
|
|
2802
|
+
* ```
|
|
2803
|
+
*/
|
|
2804
|
+
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2906
2805
|
/**
|
|
2907
2806
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2908
2807
|
*
|