@adaas/a-concept 0.1.43 → 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 +55 -152
- package/dist/index.d.ts +55 -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-Feature/A-Feature.class.ts +12 -6
- 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/src/global/A-Stage/A-Stage.class.ts +0 -1
- package/tests/A-Container.test.ts +34 -1
- package/tests/A-Feature.test.ts +63 -2
- 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
|
*
|
|
@@ -1437,6 +1445,10 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1437
1445
|
* @returns
|
|
1438
1446
|
*/
|
|
1439
1447
|
get isDone(): boolean;
|
|
1448
|
+
/**
|
|
1449
|
+
* Indicates whether the feature has been processed (completed, failed, or interrupted)
|
|
1450
|
+
*/
|
|
1451
|
+
get isProcessed(): boolean;
|
|
1440
1452
|
/**
|
|
1441
1453
|
* Iterator to iterate over the steps of the feature
|
|
1442
1454
|
*
|
|
@@ -2217,7 +2229,7 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2217
2229
|
/**
|
|
2218
2230
|
* The primary Root scope of the concept.
|
|
2219
2231
|
*/
|
|
2220
|
-
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>[]>;
|
|
2221
2233
|
/**
|
|
2222
2234
|
* Register a class or value in the concept scope.
|
|
2223
2235
|
*/
|
|
@@ -2309,18 +2321,12 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2309
2321
|
* }
|
|
2310
2322
|
* ```
|
|
2311
2323
|
*/
|
|
2312
|
-
declare class A_Fragment<
|
|
2324
|
+
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
2313
2325
|
/**
|
|
2314
2326
|
* The unique identifier/name for this fragment instance.
|
|
2315
2327
|
* Used for identification and debugging purposes.
|
|
2316
2328
|
*/
|
|
2317
2329
|
protected _name: string;
|
|
2318
|
-
/**
|
|
2319
|
-
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2320
|
-
* This stores all the fragment's runtime data that can be accessed and modified
|
|
2321
|
-
* throughout the execution pipeline.
|
|
2322
|
-
*/
|
|
2323
|
-
protected _meta: A_Meta<_MetaItems>;
|
|
2324
2330
|
/**
|
|
2325
2331
|
* Creates a new A_Fragment instance.
|
|
2326
2332
|
*
|
|
@@ -2353,147 +2359,6 @@ declare class A_Fragment<_MetaItems extends Record<string, any> = any, _Serializ
|
|
|
2353
2359
|
* @returns The fragment name
|
|
2354
2360
|
*/
|
|
2355
2361
|
get name(): string;
|
|
2356
|
-
/**
|
|
2357
|
-
* Gets direct access to the underlying Meta object for advanced meta operations.
|
|
2358
|
-
*
|
|
2359
|
-
* Use this when you need to perform bulk operations or access Meta-specific methods.
|
|
2360
|
-
* For simple get/set operations, prefer using the direct methods on the fragment.
|
|
2361
|
-
*
|
|
2362
|
-
* @returns The Meta instance containing the fragment's meta
|
|
2363
|
-
*
|
|
2364
|
-
* @example
|
|
2365
|
-
* ```typescript
|
|
2366
|
-
* const fragment = new A_Fragment<{ users: string[], count: number }>();
|
|
2367
|
-
*
|
|
2368
|
-
* // Advanced operations using meta
|
|
2369
|
-
* fragment.meta.setMultiple({
|
|
2370
|
-
* users: ['alice', 'bob'],
|
|
2371
|
-
* count: 2
|
|
2372
|
-
* });
|
|
2373
|
-
*
|
|
2374
|
-
* // Get all keys
|
|
2375
|
-
* const keys = fragment.meta.keys();
|
|
2376
|
-
* ```
|
|
2377
|
-
*/
|
|
2378
|
-
get meta(): A_Meta<_MetaItems>;
|
|
2379
|
-
/**
|
|
2380
|
-
* Checks if a specific meta key exists in the fragment.
|
|
2381
|
-
*
|
|
2382
|
-
* @param param - The key to check for existence
|
|
2383
|
-
* @returns True if the key exists, false otherwise
|
|
2384
|
-
*
|
|
2385
|
-
* @example
|
|
2386
|
-
* ```typescript
|
|
2387
|
-
* if (fragment.has('userId')) {
|
|
2388
|
-
* console.log('User ID is set');
|
|
2389
|
-
* }
|
|
2390
|
-
* ```
|
|
2391
|
-
*/
|
|
2392
|
-
has(param: keyof _MetaItems): boolean;
|
|
2393
|
-
/**
|
|
2394
|
-
* Retrieves a value from the fragment's meta.
|
|
2395
|
-
*
|
|
2396
|
-
* @param param - The key to retrieve
|
|
2397
|
-
* @returns The value associated with the key, or undefined if not found
|
|
2398
|
-
*
|
|
2399
|
-
* @example
|
|
2400
|
-
* ```typescript
|
|
2401
|
-
* const userId = fragment.get('userId');
|
|
2402
|
-
* if (userId) {
|
|
2403
|
-
* console.log(`Current user: ${userId}`);
|
|
2404
|
-
* }
|
|
2405
|
-
* ```
|
|
2406
|
-
*/
|
|
2407
|
-
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2408
|
-
/**
|
|
2409
|
-
* Stores a value in the fragment's meta.
|
|
2410
|
-
*
|
|
2411
|
-
* @param param - The key to store the value under
|
|
2412
|
-
* @param value - The value to store
|
|
2413
|
-
*
|
|
2414
|
-
* @example
|
|
2415
|
-
* ```typescript
|
|
2416
|
-
* fragment.set('userId', '12345');
|
|
2417
|
-
* fragment.set('role', 'admin');
|
|
2418
|
-
* ```
|
|
2419
|
-
*/
|
|
2420
|
-
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2421
|
-
/**
|
|
2422
|
-
* Removes a specific key from the fragment's meta.
|
|
2423
|
-
*
|
|
2424
|
-
* @param param - The key to remove
|
|
2425
|
-
*
|
|
2426
|
-
* @example
|
|
2427
|
-
* ```typescript
|
|
2428
|
-
* fragment.drop('temporaryData');
|
|
2429
|
-
* ```
|
|
2430
|
-
*/
|
|
2431
|
-
drop(param: keyof _MetaItems): void;
|
|
2432
|
-
/**
|
|
2433
|
-
* Clears all data from the fragment's meta.
|
|
2434
|
-
*
|
|
2435
|
-
* Use with caution as this will remove all stored data in the fragment.
|
|
2436
|
-
*
|
|
2437
|
-
* @example
|
|
2438
|
-
* ```typescript
|
|
2439
|
-
* fragment.clear(); // All meta data is now gone
|
|
2440
|
-
* ```
|
|
2441
|
-
*/
|
|
2442
|
-
clear(): void;
|
|
2443
|
-
/**
|
|
2444
|
-
* Gets the number of items stored in the fragment's meta.
|
|
2445
|
-
*
|
|
2446
|
-
* @returns The count of stored meta items
|
|
2447
|
-
*
|
|
2448
|
-
* @example
|
|
2449
|
-
* ```typescript
|
|
2450
|
-
* console.log(`Fragment contains ${fragment.size()} items`);
|
|
2451
|
-
* ```
|
|
2452
|
-
*/
|
|
2453
|
-
size(): number;
|
|
2454
|
-
/**
|
|
2455
|
-
* Gets all keys currently stored in the fragment's meta.
|
|
2456
|
-
*
|
|
2457
|
-
* @returns Array of all meta keys
|
|
2458
|
-
*
|
|
2459
|
-
* @example
|
|
2460
|
-
* ```typescript
|
|
2461
|
-
* const keys = fragment.keys();
|
|
2462
|
-
* console.log('Stored keys:', keys);
|
|
2463
|
-
* ```
|
|
2464
|
-
*/
|
|
2465
|
-
keys(): (keyof _MetaItems)[];
|
|
2466
|
-
/**
|
|
2467
|
-
* Sets multiple values at once in the fragment's meta.
|
|
2468
|
-
*
|
|
2469
|
-
* @param data - Object containing key-value pairs to set
|
|
2470
|
-
*
|
|
2471
|
-
* @example
|
|
2472
|
-
* ```typescript
|
|
2473
|
-
* fragment.setMultiple({
|
|
2474
|
-
* userId: '12345',
|
|
2475
|
-
* role: 'admin',
|
|
2476
|
-
* lastLogin: new Date()
|
|
2477
|
-
* });
|
|
2478
|
-
* ```
|
|
2479
|
-
*/
|
|
2480
|
-
setMultiple(data: A_TYPES__DeepPartial<_MetaItems>): void;
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates a shallow copy of the fragment with the same meta data.
|
|
2483
|
-
*
|
|
2484
|
-
* @param newName - Optional new name for the cloned fragment
|
|
2485
|
-
* @returns A new fragment instance with copied meta
|
|
2486
|
-
*
|
|
2487
|
-
* @example
|
|
2488
|
-
* ```typescript
|
|
2489
|
-
* const original = new A_Fragment<{ data: string }>({ name: 'original' });
|
|
2490
|
-
* original.set('data', 'test');
|
|
2491
|
-
*
|
|
2492
|
-
* const clone = original.clone('cloned');
|
|
2493
|
-
* console.log(clone.get('data')); // 'test'
|
|
2494
|
-
* ```
|
|
2495
|
-
*/
|
|
2496
|
-
clone(newName?: string): A_Fragment<_MetaItems, _SerializedType>;
|
|
2497
2362
|
/**
|
|
2498
2363
|
* Serializes the fragment to a JSON-compatible object.
|
|
2499
2364
|
*
|
|
@@ -2730,7 +2595,7 @@ type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
|
2730
2595
|
from: 'start' | 'end';
|
|
2731
2596
|
};
|
|
2732
2597
|
|
|
2733
|
-
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[]> {
|
|
2734
2599
|
/**
|
|
2735
2600
|
* Scope Name uses for identification and logging purposes
|
|
2736
2601
|
*/
|
|
@@ -2739,6 +2604,12 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2739
2604
|
* Parent scope reference, used for inheritance of components, fragments, entities and commands
|
|
2740
2605
|
*/
|
|
2741
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>;
|
|
2742
2613
|
/**
|
|
2743
2614
|
* A set of allowed components, A set of constructors that are allowed in the scope
|
|
2744
2615
|
*
|
|
@@ -2776,6 +2647,10 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2776
2647
|
* Returns the name of the scope
|
|
2777
2648
|
*/
|
|
2778
2649
|
get name(): string;
|
|
2650
|
+
/**
|
|
2651
|
+
* Returns the meta object of the scope
|
|
2652
|
+
*/
|
|
2653
|
+
get meta(): A_Meta<_MetaItems, Record<string, any>>;
|
|
2779
2654
|
/**
|
|
2780
2655
|
* Returns a list of Constructors for A-Components that are available in the scope
|
|
2781
2656
|
*/
|
|
@@ -2899,6 +2774,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2899
2774
|
* [!] This method also clears all internal registries and collections
|
|
2900
2775
|
*/
|
|
2901
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;
|
|
2902
2805
|
/**
|
|
2903
2806
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2904
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
|
*
|
|
@@ -1437,6 +1445,10 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1437
1445
|
* @returns
|
|
1438
1446
|
*/
|
|
1439
1447
|
get isDone(): boolean;
|
|
1448
|
+
/**
|
|
1449
|
+
* Indicates whether the feature has been processed (completed, failed, or interrupted)
|
|
1450
|
+
*/
|
|
1451
|
+
get isProcessed(): boolean;
|
|
1440
1452
|
/**
|
|
1441
1453
|
* Iterator to iterate over the steps of the feature
|
|
1442
1454
|
*
|
|
@@ -2217,7 +2229,7 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2217
2229
|
/**
|
|
2218
2230
|
* The primary Root scope of the concept.
|
|
2219
2231
|
*/
|
|
2220
|
-
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>[]>;
|
|
2221
2233
|
/**
|
|
2222
2234
|
* Register a class or value in the concept scope.
|
|
2223
2235
|
*/
|
|
@@ -2309,18 +2321,12 @@ declare class A_Concept<_Imports extends A_Container[] = A_Container[]> {
|
|
|
2309
2321
|
* }
|
|
2310
2322
|
* ```
|
|
2311
2323
|
*/
|
|
2312
|
-
declare class A_Fragment<
|
|
2324
|
+
declare class A_Fragment<_SerializedType extends A_TYPES__Fragment_Serialized = A_TYPES__Fragment_Serialized> {
|
|
2313
2325
|
/**
|
|
2314
2326
|
* The unique identifier/name for this fragment instance.
|
|
2315
2327
|
* Used for identification and debugging purposes.
|
|
2316
2328
|
*/
|
|
2317
2329
|
protected _name: string;
|
|
2318
|
-
/**
|
|
2319
|
-
* Internal meta storage using A_Meta for type-safe key-value operations.
|
|
2320
|
-
* This stores all the fragment's runtime data that can be accessed and modified
|
|
2321
|
-
* throughout the execution pipeline.
|
|
2322
|
-
*/
|
|
2323
|
-
protected _meta: A_Meta<_MetaItems>;
|
|
2324
2330
|
/**
|
|
2325
2331
|
* Creates a new A_Fragment instance.
|
|
2326
2332
|
*
|
|
@@ -2353,147 +2359,6 @@ declare class A_Fragment<_MetaItems extends Record<string, any> = any, _Serializ
|
|
|
2353
2359
|
* @returns The fragment name
|
|
2354
2360
|
*/
|
|
2355
2361
|
get name(): string;
|
|
2356
|
-
/**
|
|
2357
|
-
* Gets direct access to the underlying Meta object for advanced meta operations.
|
|
2358
|
-
*
|
|
2359
|
-
* Use this when you need to perform bulk operations or access Meta-specific methods.
|
|
2360
|
-
* For simple get/set operations, prefer using the direct methods on the fragment.
|
|
2361
|
-
*
|
|
2362
|
-
* @returns The Meta instance containing the fragment's meta
|
|
2363
|
-
*
|
|
2364
|
-
* @example
|
|
2365
|
-
* ```typescript
|
|
2366
|
-
* const fragment = new A_Fragment<{ users: string[], count: number }>();
|
|
2367
|
-
*
|
|
2368
|
-
* // Advanced operations using meta
|
|
2369
|
-
* fragment.meta.setMultiple({
|
|
2370
|
-
* users: ['alice', 'bob'],
|
|
2371
|
-
* count: 2
|
|
2372
|
-
* });
|
|
2373
|
-
*
|
|
2374
|
-
* // Get all keys
|
|
2375
|
-
* const keys = fragment.meta.keys();
|
|
2376
|
-
* ```
|
|
2377
|
-
*/
|
|
2378
|
-
get meta(): A_Meta<_MetaItems>;
|
|
2379
|
-
/**
|
|
2380
|
-
* Checks if a specific meta key exists in the fragment.
|
|
2381
|
-
*
|
|
2382
|
-
* @param param - The key to check for existence
|
|
2383
|
-
* @returns True if the key exists, false otherwise
|
|
2384
|
-
*
|
|
2385
|
-
* @example
|
|
2386
|
-
* ```typescript
|
|
2387
|
-
* if (fragment.has('userId')) {
|
|
2388
|
-
* console.log('User ID is set');
|
|
2389
|
-
* }
|
|
2390
|
-
* ```
|
|
2391
|
-
*/
|
|
2392
|
-
has(param: keyof _MetaItems): boolean;
|
|
2393
|
-
/**
|
|
2394
|
-
* Retrieves a value from the fragment's meta.
|
|
2395
|
-
*
|
|
2396
|
-
* @param param - The key to retrieve
|
|
2397
|
-
* @returns The value associated with the key, or undefined if not found
|
|
2398
|
-
*
|
|
2399
|
-
* @example
|
|
2400
|
-
* ```typescript
|
|
2401
|
-
* const userId = fragment.get('userId');
|
|
2402
|
-
* if (userId) {
|
|
2403
|
-
* console.log(`Current user: ${userId}`);
|
|
2404
|
-
* }
|
|
2405
|
-
* ```
|
|
2406
|
-
*/
|
|
2407
|
-
get(param: keyof _MetaItems): _MetaItems[typeof param] | undefined;
|
|
2408
|
-
/**
|
|
2409
|
-
* Stores a value in the fragment's meta.
|
|
2410
|
-
*
|
|
2411
|
-
* @param param - The key to store the value under
|
|
2412
|
-
* @param value - The value to store
|
|
2413
|
-
*
|
|
2414
|
-
* @example
|
|
2415
|
-
* ```typescript
|
|
2416
|
-
* fragment.set('userId', '12345');
|
|
2417
|
-
* fragment.set('role', 'admin');
|
|
2418
|
-
* ```
|
|
2419
|
-
*/
|
|
2420
|
-
set(param: keyof _MetaItems, value: _MetaItems[typeof param]): void;
|
|
2421
|
-
/**
|
|
2422
|
-
* Removes a specific key from the fragment's meta.
|
|
2423
|
-
*
|
|
2424
|
-
* @param param - The key to remove
|
|
2425
|
-
*
|
|
2426
|
-
* @example
|
|
2427
|
-
* ```typescript
|
|
2428
|
-
* fragment.drop('temporaryData');
|
|
2429
|
-
* ```
|
|
2430
|
-
*/
|
|
2431
|
-
drop(param: keyof _MetaItems): void;
|
|
2432
|
-
/**
|
|
2433
|
-
* Clears all data from the fragment's meta.
|
|
2434
|
-
*
|
|
2435
|
-
* Use with caution as this will remove all stored data in the fragment.
|
|
2436
|
-
*
|
|
2437
|
-
* @example
|
|
2438
|
-
* ```typescript
|
|
2439
|
-
* fragment.clear(); // All meta data is now gone
|
|
2440
|
-
* ```
|
|
2441
|
-
*/
|
|
2442
|
-
clear(): void;
|
|
2443
|
-
/**
|
|
2444
|
-
* Gets the number of items stored in the fragment's meta.
|
|
2445
|
-
*
|
|
2446
|
-
* @returns The count of stored meta items
|
|
2447
|
-
*
|
|
2448
|
-
* @example
|
|
2449
|
-
* ```typescript
|
|
2450
|
-
* console.log(`Fragment contains ${fragment.size()} items`);
|
|
2451
|
-
* ```
|
|
2452
|
-
*/
|
|
2453
|
-
size(): number;
|
|
2454
|
-
/**
|
|
2455
|
-
* Gets all keys currently stored in the fragment's meta.
|
|
2456
|
-
*
|
|
2457
|
-
* @returns Array of all meta keys
|
|
2458
|
-
*
|
|
2459
|
-
* @example
|
|
2460
|
-
* ```typescript
|
|
2461
|
-
* const keys = fragment.keys();
|
|
2462
|
-
* console.log('Stored keys:', keys);
|
|
2463
|
-
* ```
|
|
2464
|
-
*/
|
|
2465
|
-
keys(): (keyof _MetaItems)[];
|
|
2466
|
-
/**
|
|
2467
|
-
* Sets multiple values at once in the fragment's meta.
|
|
2468
|
-
*
|
|
2469
|
-
* @param data - Object containing key-value pairs to set
|
|
2470
|
-
*
|
|
2471
|
-
* @example
|
|
2472
|
-
* ```typescript
|
|
2473
|
-
* fragment.setMultiple({
|
|
2474
|
-
* userId: '12345',
|
|
2475
|
-
* role: 'admin',
|
|
2476
|
-
* lastLogin: new Date()
|
|
2477
|
-
* });
|
|
2478
|
-
* ```
|
|
2479
|
-
*/
|
|
2480
|
-
setMultiple(data: A_TYPES__DeepPartial<_MetaItems>): void;
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates a shallow copy of the fragment with the same meta data.
|
|
2483
|
-
*
|
|
2484
|
-
* @param newName - Optional new name for the cloned fragment
|
|
2485
|
-
* @returns A new fragment instance with copied meta
|
|
2486
|
-
*
|
|
2487
|
-
* @example
|
|
2488
|
-
* ```typescript
|
|
2489
|
-
* const original = new A_Fragment<{ data: string }>({ name: 'original' });
|
|
2490
|
-
* original.set('data', 'test');
|
|
2491
|
-
*
|
|
2492
|
-
* const clone = original.clone('cloned');
|
|
2493
|
-
* console.log(clone.get('data')); // 'test'
|
|
2494
|
-
* ```
|
|
2495
|
-
*/
|
|
2496
|
-
clone(newName?: string): A_Fragment<_MetaItems, _SerializedType>;
|
|
2497
2362
|
/**
|
|
2498
2363
|
* Serializes the fragment to a JSON-compatible object.
|
|
2499
2364
|
*
|
|
@@ -2730,7 +2595,7 @@ type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
|
2730
2595
|
from: 'start' | 'end';
|
|
2731
2596
|
};
|
|
2732
2597
|
|
|
2733
|
-
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[]> {
|
|
2734
2599
|
/**
|
|
2735
2600
|
* Scope Name uses for identification and logging purposes
|
|
2736
2601
|
*/
|
|
@@ -2739,6 +2604,12 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2739
2604
|
* Parent scope reference, used for inheritance of components, fragments, entities and commands
|
|
2740
2605
|
*/
|
|
2741
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>;
|
|
2742
2613
|
/**
|
|
2743
2614
|
* A set of allowed components, A set of constructors that are allowed in the scope
|
|
2744
2615
|
*
|
|
@@ -2776,6 +2647,10 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2776
2647
|
* Returns the name of the scope
|
|
2777
2648
|
*/
|
|
2778
2649
|
get name(): string;
|
|
2650
|
+
/**
|
|
2651
|
+
* Returns the meta object of the scope
|
|
2652
|
+
*/
|
|
2653
|
+
get meta(): A_Meta<_MetaItems, Record<string, any>>;
|
|
2779
2654
|
/**
|
|
2780
2655
|
* Returns a list of Constructors for A-Components that are available in the scope
|
|
2781
2656
|
*/
|
|
@@ -2899,6 +2774,34 @@ declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] =
|
|
|
2899
2774
|
* [!] This method also clears all internal registries and collections
|
|
2900
2775
|
*/
|
|
2901
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;
|
|
2902
2805
|
/**
|
|
2903
2806
|
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
2904
2807
|
*
|