@praxisui/specification 1.0.0-beta.4 → 1.0.0-beta.41
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/README.md +7 -0
- package/fesm2022/praxisui-specification.mjs +482 -34
- package/fesm2022/praxisui-specification.mjs.map +1 -1
- package/index.d.ts +36 -2
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -11,7 +11,14 @@ declare enum ComparisonOperator {
|
|
|
11
11
|
CONTAINS = "contains",
|
|
12
12
|
STARTS_WITH = "startsWith",
|
|
13
13
|
ENDS_WITH = "endsWith",
|
|
14
|
-
IN = "in"
|
|
14
|
+
IN = "in",
|
|
15
|
+
NOT_IN = "notIn",
|
|
16
|
+
MATCHES = "matches",
|
|
17
|
+
NOT_MATCHES = "notMatches",
|
|
18
|
+
IS_NULL = "isNull",
|
|
19
|
+
IS_NOT_NULL = "isNotNull",
|
|
20
|
+
IS_EMPTY = "isEmpty",
|
|
21
|
+
IS_NOT_EMPTY = "isNotEmpty"
|
|
15
22
|
}
|
|
16
23
|
declare const OPERATOR_SYMBOLS: Record<ComparisonOperator, string>;
|
|
17
24
|
|
|
@@ -28,6 +35,10 @@ declare class FieldSpecification<T extends object = any> extends Specification<T
|
|
|
28
35
|
getField(): keyof T;
|
|
29
36
|
getOperator(): ComparisonOperator;
|
|
30
37
|
getValue(): any;
|
|
38
|
+
private toRegExp;
|
|
39
|
+
private isEmpty;
|
|
40
|
+
private isNotEmpty;
|
|
41
|
+
private formatMatchesValue;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
declare class AndSpecification<T extends object = any> extends Specification<T> {
|
|
@@ -122,6 +133,9 @@ declare class FunctionSpecification<T extends object = any> extends Specificatio
|
|
|
122
133
|
getArgs(): any[];
|
|
123
134
|
getRegistry(): FunctionRegistry<T> | undefined;
|
|
124
135
|
clone(): FunctionSpecification<T>;
|
|
136
|
+
private resolveArg;
|
|
137
|
+
private isFieldArg;
|
|
138
|
+
private getPathValue;
|
|
125
139
|
}
|
|
126
140
|
|
|
127
141
|
declare class AtLeastSpecification<T extends object = any> extends Specification<T> {
|
|
@@ -187,6 +201,9 @@ declare class FieldToFieldSpecification<T extends object = any> extends Specific
|
|
|
187
201
|
getTransformA(): string[] | undefined;
|
|
188
202
|
getTransformB(): string[] | undefined;
|
|
189
203
|
clone(): FieldToFieldSpecification<T>;
|
|
204
|
+
private toRegExp;
|
|
205
|
+
private isEmpty;
|
|
206
|
+
private isNotEmpty;
|
|
190
207
|
}
|
|
191
208
|
|
|
192
209
|
interface ContextProvider {
|
|
@@ -553,6 +570,7 @@ declare enum TokenType {
|
|
|
553
570
|
NUMBER = "NUMBER",
|
|
554
571
|
BOOLEAN = "BOOLEAN",
|
|
555
572
|
NULL = "NULL",
|
|
573
|
+
REGEX = "REGEX",
|
|
556
574
|
AND = "AND",
|
|
557
575
|
OR = "OR",
|
|
558
576
|
NOT = "NOT",
|
|
@@ -565,6 +583,13 @@ declare enum TokenType {
|
|
|
565
583
|
GREATER_THAN = "GREATER_THAN",
|
|
566
584
|
GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL",
|
|
567
585
|
IN = "IN",
|
|
586
|
+
NOT_IN = "NOT_IN",
|
|
587
|
+
MATCHES = "MATCHES",
|
|
588
|
+
NOT_MATCHES = "NOT_MATCHES",
|
|
589
|
+
IS_NULL = "IS_NULL",
|
|
590
|
+
IS_NOT_NULL = "IS_NOT_NULL",
|
|
591
|
+
IS_EMPTY = "IS_EMPTY",
|
|
592
|
+
IS_NOT_EMPTY = "IS_NOT_EMPTY",
|
|
568
593
|
CONTAINS = "CONTAINS",
|
|
569
594
|
STARTS_WITH = "STARTS_WITH",
|
|
570
595
|
ENDS_WITH = "ENDS_WITH",
|
|
@@ -600,8 +625,10 @@ declare class DslTokenizer {
|
|
|
600
625
|
private nextToken;
|
|
601
626
|
private readFieldReference;
|
|
602
627
|
private readString;
|
|
628
|
+
private readRegex;
|
|
603
629
|
private readNumber;
|
|
604
630
|
private readIdentifier;
|
|
631
|
+
private readMultiWordOperator;
|
|
605
632
|
private skipWhitespace;
|
|
606
633
|
private createToken;
|
|
607
634
|
private createTokenAndAdvance;
|
|
@@ -617,6 +644,7 @@ declare class DslParser<T extends object = any> {
|
|
|
617
644
|
private functionRegistry?;
|
|
618
645
|
private tokens;
|
|
619
646
|
private current;
|
|
647
|
+
private lastArgumentTokenType;
|
|
620
648
|
constructor(functionRegistry?: FunctionRegistry<T> | undefined);
|
|
621
649
|
parse(input: string): Specification<T>;
|
|
622
650
|
private parseExpression;
|
|
@@ -632,7 +660,11 @@ declare class DslParser<T extends object = any> {
|
|
|
632
660
|
private matchComparison;
|
|
633
661
|
private tokenTypeToComparisonOperator;
|
|
634
662
|
private functionNameToOperator;
|
|
663
|
+
private normalizeFunctionName;
|
|
635
664
|
private extractValue;
|
|
665
|
+
private operatorRequiresValue;
|
|
666
|
+
private defaultValueForOperator;
|
|
667
|
+
private parseRegexLiteral;
|
|
636
668
|
private match;
|
|
637
669
|
private check;
|
|
638
670
|
private advance;
|
|
@@ -808,6 +840,8 @@ declare class DslValidator {
|
|
|
808
840
|
private validateFunctionArguments;
|
|
809
841
|
private validateComplexity;
|
|
810
842
|
private getExpectedArgumentCount;
|
|
843
|
+
private isFunctionToken;
|
|
844
|
+
private normalizeFunctionTokenName;
|
|
811
845
|
private isOperatorToken;
|
|
812
846
|
private isBinaryOperatorToken;
|
|
813
847
|
private suggestSimilarField;
|
|
@@ -828,7 +862,7 @@ declare class SpecificationFactory {
|
|
|
828
862
|
static func<T extends object = any>(name: string, args: any[], registry?: FunctionRegistry<T>): FunctionSpecification<T>;
|
|
829
863
|
static atLeast<T extends object = any>(minimum: number, specs: Specification<T>[]): AtLeastSpecification<T>;
|
|
830
864
|
static exactly<T extends object = any>(exact: number, specs: Specification<T>[]): ExactlySpecification<T>;
|
|
831
|
-
static fieldToField<T extends object = any>(fieldA: keyof T, operator: ComparisonOperator, fieldB: keyof T, transformA?: string[], transformB?: string[], registry?: TransformRegistry): FieldToFieldSpecification<T>;
|
|
865
|
+
static fieldToField<T extends object = any>(fieldA: keyof T, operator: ComparisonOperator, fieldB: keyof T, transformA?: string[], transformB?: string[], registry?: TransformRegistry, metadata?: SpecificationMetadata): FieldToFieldSpecification<T>;
|
|
832
866
|
static contextual<T extends object = any>(template: string, provider?: ContextProvider): ContextualSpecification<T>;
|
|
833
867
|
static equals<T extends object = any>(field: keyof T, value: any): FieldSpecification<T>;
|
|
834
868
|
static notEquals<T extends object = any>(field: keyof T, value: any): FieldSpecification<T>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/specification",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.41",
|
|
4
4
|
"description": "Praxis UI specification engine: logical composition (and/or/not/xor/implies), validation and DSL helpers.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^20.0.0",
|
|
7
7
|
"@angular/core": "^20.0.0",
|
|
8
|
-
"@praxisui/specification-core": "^1.0.0-beta.
|
|
8
|
+
"@praxisui/specification-core": "^1.0.0-beta.41"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"tslib": "^2.3.0"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/codexrodrigues/praxis"
|
|
19
|
+
"url": "https://github.com/codexrodrigues/praxis-ui-angular"
|
|
20
20
|
},
|
|
21
|
-
"homepage": "https://github.com/codexrodrigues/praxis#readme",
|
|
21
|
+
"homepage": "https://github.com/codexrodrigues/praxis-ui-angular#readme",
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/codexrodrigues/praxis/issues"
|
|
23
|
+
"url": "https://github.com/codexrodrigues/praxis-ui-angular/issues"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"angular",
|