@limetech/lime-web-components 6.14.0 → 6.15.0
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [6.15.0](https://github.com/Lundalogik/lime-web-components/compare/v6.14.0...v6.15.0) (2026-04-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **conditionregistry:** add support for metadata for conditions ([6199f5b](https://github.com/Lundalogik/lime-web-components/commit/6199f5b9c8de3a0f6c4b55345554d3a1a928bae1))
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* **conditionregistry:** improve typing of conditions ([c627b1c](https://github.com/Lundalogik/lime-web-components/commit/c627b1c1e9d6d0f571bde92cbf1f842235aed497))
|
|
13
|
+
* **conditionregistry:** make evaluate bivariant ([16c63a2](https://github.com/Lundalogik/lime-web-components/commit/16c63a2e6e57057288ed4e0b39e5cb08742d45e9))
|
|
14
|
+
|
|
1
15
|
## [6.14.0](https://github.com/Lundalogik/lime-web-components/compare/v6.13.1...v6.14.0) (2026-04-17)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Action } from '../action';
|
|
2
2
|
import { LimeObject } from '../limeobject';
|
|
3
|
+
import { ConfigMetadata } from '../core';
|
|
3
4
|
/**
|
|
4
5
|
* Represents a conditional evaluation rule that can be registered and used
|
|
5
6
|
* throughout the application.
|
|
@@ -64,7 +65,7 @@ export type Condition<T = unknown> = {
|
|
|
64
65
|
*
|
|
65
66
|
* Custom types can be defined for specialized evaluation contexts.
|
|
66
67
|
*/
|
|
67
|
-
type:
|
|
68
|
+
type: ConditionType;
|
|
68
69
|
/**
|
|
69
70
|
* The evaluation function that determines if the condition is met.
|
|
70
71
|
*
|
|
@@ -98,7 +99,7 @@ export type Condition<T = unknown> = {
|
|
|
98
99
|
* };
|
|
99
100
|
* ```
|
|
100
101
|
*/
|
|
101
|
-
evaluate
|
|
102
|
+
evaluate(subject: T, params?: unknown): boolean;
|
|
102
103
|
/**
|
|
103
104
|
* Unique identifier for this condition.
|
|
104
105
|
*
|
|
@@ -203,7 +204,7 @@ export type ActionCondition = Condition<Action> & {
|
|
|
203
204
|
* @beta
|
|
204
205
|
* @group Conditions
|
|
205
206
|
*/
|
|
206
|
-
export declare function isLimeObjectCondition(condition: Condition): condition is
|
|
207
|
+
export declare function isLimeObjectCondition(condition: Condition): condition is LimeObjectCondition;
|
|
207
208
|
/**
|
|
208
209
|
* Check if condition expects an action to be passed when it is evaluated
|
|
209
210
|
*
|
|
@@ -214,7 +215,7 @@ export declare function isLimeObjectCondition(condition: Condition): condition i
|
|
|
214
215
|
* @beta
|
|
215
216
|
* @group Conditions
|
|
216
217
|
*/
|
|
217
|
-
export declare function isActionCondition(condition: Condition): condition is
|
|
218
|
+
export declare function isActionCondition(condition: Condition): condition is ActionCondition;
|
|
218
219
|
/**
|
|
219
220
|
* Central registry for managing conditional evaluation rules across the application.
|
|
220
221
|
*
|
|
@@ -286,6 +287,7 @@ export interface ConditionRegistry {
|
|
|
286
287
|
* It's recommended to register conditions during application startup.
|
|
287
288
|
*
|
|
288
289
|
* @param condition - The condition to register. Must have a unique ID.
|
|
290
|
+
* @param metadata - Optional metadata associated with the condition.
|
|
289
291
|
* @throws Error if a condition with the same ID already exists in the registry.
|
|
290
292
|
*
|
|
291
293
|
* @example
|
|
@@ -299,7 +301,7 @@ export interface ConditionRegistry {
|
|
|
299
301
|
* registry.addCondition(isActive);
|
|
300
302
|
* ```
|
|
301
303
|
*/
|
|
302
|
-
addCondition(condition:
|
|
304
|
+
addCondition<T extends Condition = Condition>(condition: T, metadata?: ConfigMetadata): void;
|
|
303
305
|
/**
|
|
304
306
|
* Removes a condition from the registry.
|
|
305
307
|
*
|
|
@@ -323,7 +325,7 @@ export interface ConditionRegistry {
|
|
|
323
325
|
* }
|
|
324
326
|
* ```
|
|
325
327
|
*/
|
|
326
|
-
removeCondition(condition: Condition):
|
|
328
|
+
removeCondition(condition: Condition): void;
|
|
327
329
|
/**
|
|
328
330
|
* Checks whether a condition with the given ID exists in the registry.
|
|
329
331
|
*
|
|
@@ -388,5 +390,52 @@ export interface ConditionRegistry {
|
|
|
388
390
|
* ```
|
|
389
391
|
*/
|
|
390
392
|
getCondition(id: string): Condition;
|
|
393
|
+
/**
|
|
394
|
+
* Retrieves metadata for all conditions in the registry.
|
|
395
|
+
*
|
|
396
|
+
* This method returns an array of metadata objects containing information
|
|
397
|
+
* about all registered conditions, including their IDs, types, and configuration details.
|
|
398
|
+
*
|
|
399
|
+
* @returns An array of condition metadata objects, or undefined if not supported by the registry implementation.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* const allMetadata = registry.getAllMetadata();
|
|
404
|
+
* if (allMetadata) {
|
|
405
|
+
* allMetadata.forEach(meta => {
|
|
406
|
+
* console.log(`Condition: ${meta.id}, Type: ${meta.type}, Title: ${meta.title}`);
|
|
407
|
+
* });
|
|
408
|
+
* }
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
getAllMetadata?(): ConditionMetadata[];
|
|
391
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Metadata for a condition
|
|
415
|
+
*
|
|
416
|
+
* @group Conditions
|
|
417
|
+
* @beta
|
|
418
|
+
*/
|
|
419
|
+
export type ConditionMetadata = ConfigMetadata & {
|
|
420
|
+
/**
|
|
421
|
+
* Unique identifier of the condition
|
|
422
|
+
*/
|
|
423
|
+
id: string;
|
|
424
|
+
/**
|
|
425
|
+
* Type identifier indicating the kind of subject this condition evaluates
|
|
426
|
+
*/
|
|
427
|
+
type: ConditionType;
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Type identifier for a condition
|
|
431
|
+
*
|
|
432
|
+
* Specifies the kind of subject the condition evaluates.
|
|
433
|
+
* - `'limeobject'`: Condition evaluates LimeObject instances
|
|
434
|
+
* - `'action'`: Condition evaluates Action instances
|
|
435
|
+
* Custom string types can also be used for domain-specific conditions
|
|
436
|
+
*
|
|
437
|
+
* @group Conditions
|
|
438
|
+
* @beta
|
|
439
|
+
*/
|
|
440
|
+
export type ConditionType = 'limeobject' | 'action' | (string & {});
|
|
392
441
|
//# sourceMappingURL=conditionregistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditionregistry.d.ts","sourceRoot":"","sources":["../../src/conditionregistry/conditionregistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"conditionregistry.d.ts","sourceRoot":"","sources":["../../src/conditionregistry/conditionregistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC;;;;;;;;OAQG;IACH,IAAI,EAAE,aAAa,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEhD;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAC,UAAU,CA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