@fibery/expression-utils 9.7.3 → 10.0.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/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/index.d.ts +191 -585
- package/lib/index.js +15 -50
- package/lib/src/context-variables.d.ts +27 -22
- package/lib/src/context-variables.js +106 -138
- package/lib/src/errors.d.ts +5 -2
- package/lib/src/errors.js +14 -14
- package/lib/src/field-expression-visitor-type-aware.d.ts +18 -16
- package/lib/src/field-expression-visitor-type-aware.js +116 -131
- package/lib/src/filter-expression/index.d.ts +12 -9
- package/lib/src/filter-expression/index.js +34 -47
- package/lib/src/filter-expression/operator-utils.d.ts +14 -11
- package/lib/src/filter-expression/operator-utils.js +191 -185
- package/lib/src/filter-expression/operators.d.ts +111 -106
- package/lib/src/filter-expression/operators.js +1130 -846
- package/lib/src/filter-expression/pattern-match-placeholders.d.ts +63 -61
- package/lib/src/filter-expression/pattern-match-placeholders.js +107 -138
- package/lib/src/filter-expression/pattern-match.d.ts +17 -15
- package/lib/src/filter-expression/pattern-match.js +118 -130
- package/lib/src/filter-expression/pattern-to-expression.d.ts +13 -11
- package/lib/src/filter-expression/pattern-to-expression.js +42 -45
- package/lib/src/filter-expression/types.d.ts +29 -26
- package/lib/src/filter-expression/types.js +0 -3
- package/lib/src/params-placeholders.d.ts +55 -51
- package/lib/src/params-placeholders.js +199 -192
- package/lib/src/tsfixme.d.ts +4 -1
- package/lib/src/tsfixme.js +0 -3
- package/lib/src/types.d.ts +47 -45
- package/lib/src/types.js +0 -3
- package/lib/src/utils.d.ts +53 -48
- package/lib/src/utils.js +276 -337
- package/lib/src/visitors.d.ts +43 -37
- package/lib/src/visitors.js +306 -365
- package/lib/test-data/schema-mock.d.ts +68 -751
- package/lib/test-data/schema-mock.js +175 -139
- package/package.json +17 -10
- package/lib/index.js.map +0 -1
- package/lib/src/context-variables.js.map +0 -1
- package/lib/src/errors.js.map +0 -1
- package/lib/src/field-expression-visitor-type-aware.js.map +0 -1
- package/lib/src/filter-expression/index.js.map +0 -1
- package/lib/src/filter-expression/operator-utils.js.map +0 -1
- package/lib/src/filter-expression/operators.js.map +0 -1
- package/lib/src/filter-expression/pattern-match-placeholders.js.map +0 -1
- package/lib/src/filter-expression/pattern-match.js.map +0 -1
- package/lib/src/filter-expression/pattern-to-expression.js.map +0 -1
- package/lib/src/filter-expression/types.js.map +0 -1
- package/lib/src/params-placeholders.js.map +0 -1
- package/lib/src/tsfixme.js.map +0 -1
- package/lib/src/types.js.map +0 -1
- package/lib/src/utils.js.map +0 -1
- package/lib/src/visitors.js.map +0 -1
- package/lib/test-data/schema-mock.js.map +0 -1
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Expression } from "../types.js";
|
|
2
|
+
import { TypeObject } from "@fibery/schema";
|
|
3
|
+
//#region src/filter-expression/pattern-match-placeholders.d.ts
|
|
3
4
|
type MatchFn = (expression: Expression, typeObject: TypeObject) => boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
declare const anyExpressionPlaceholder: {
|
|
6
|
+
id: ":expression-pattern/expression-placeholder";
|
|
7
|
+
matchFn: () => boolean;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare const idFieldPlaceholder: {
|
|
10
|
+
id: ":expression-pattern/expression-placeholder";
|
|
11
|
+
matchFn: MatchFn;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
declare const basicFieldPlaceholder: {
|
|
14
|
+
id: ":expression-pattern/expression-placeholder";
|
|
15
|
+
matchFn: MatchFn;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
declare const textFieldPlaceholder: {
|
|
18
|
+
id: ":expression-pattern/expression-placeholder";
|
|
19
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
declare const numberFieldPlaceholder: {
|
|
22
|
+
id: ":expression-pattern/expression-placeholder";
|
|
23
|
+
matchFn: MatchFn;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
declare const dateFieldPlaceholder: {
|
|
26
|
+
id: ":expression-pattern/expression-placeholder";
|
|
27
|
+
matchFn: MatchFn;
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
declare const dateTimeFieldPlaceholder: {
|
|
30
|
+
id: ":expression-pattern/expression-placeholder";
|
|
31
|
+
matchFn: MatchFn;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
declare const boolFieldPlaceholder: {
|
|
34
|
+
id: ":expression-pattern/expression-placeholder";
|
|
35
|
+
matchFn: MatchFn;
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
declare const locationFieldPlaceholder: {
|
|
38
|
+
id: ":expression-pattern/expression-placeholder";
|
|
39
|
+
matchFn: MatchFn;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
declare const referenceCollectionFieldPlaceholder: {
|
|
42
|
+
id: ":expression-pattern/expression-placeholder";
|
|
43
|
+
matchFn: MatchFn;
|
|
43
44
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
declare const referenceExpressionPlaceholder: {
|
|
46
|
+
id: ":expression-pattern/expression-placeholder";
|
|
47
|
+
matchFn: MatchFn;
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
declare const referenceCollectionExpressionPlaceholder: {
|
|
50
|
+
id: ":expression-pattern/expression-placeholder";
|
|
51
|
+
matchFn: MatchFn;
|
|
51
52
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
declare const collectionCountExpressionPlaceholder: {
|
|
54
|
+
id: ":expression-pattern/expression-placeholder";
|
|
55
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
declare const dateOrDateRangeExpressionPlaceholder: {
|
|
58
|
+
id: ":expression-pattern/expression-placeholder";
|
|
59
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
59
60
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
declare const dateTimeOrDateTimeRangeExpressionPlaceholder: {
|
|
62
|
+
id: ":expression-pattern/expression-placeholder";
|
|
63
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
declare const anyDateExpressionPlaceholder: {
|
|
66
|
+
id: ":expression-pattern/expression-placeholder";
|
|
67
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
67
68
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
declare const getParamPlaceholder: (matchFn?: (_x: unknown) => boolean) => {
|
|
70
|
+
id: ":expression-pattern/param-placeholder";
|
|
71
|
+
matchFn: (_x: unknown) => boolean;
|
|
71
72
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
declare const getConstantPlaceholder: (value: unknown) => {
|
|
74
|
+
id: ":expression-pattern/constant-placeholder";
|
|
75
|
+
value: unknown;
|
|
76
|
+
matchFn: (x: unknown) => boolean;
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
declare const referenceTitleOrRankExpressionPlaceholder: {
|
|
79
|
+
id: ":expression-pattern/expression-placeholder";
|
|
80
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
80
81
|
};
|
|
81
|
-
|
|
82
|
+
//#endregion
|
|
83
|
+
export { anyDateExpressionPlaceholder, anyExpressionPlaceholder, basicFieldPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateFieldPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeFieldPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, idFieldPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, referenceTitleOrRankExpressionPlaceholder, textFieldPlaceholder };
|
|
@@ -1,157 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const context_variables_1 = require("@fibery/expression-utils/src/context-variables");
|
|
8
|
-
const drop_1 = __importDefault(require("lodash/drop"));
|
|
9
|
-
const isString_1 = __importDefault(require("lodash/isString"));
|
|
10
|
-
const last_1 = __importDefault(require("lodash/last"));
|
|
11
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { getFieldObjectsByFieldExpression, isDateRangeFunctionExpression, isDateTimeType, isDateType, isFieldExpression, isFieldExpressionValid, isFunctionCallExpression } from "../utils.js";
|
|
2
|
+
import isString from "lodash/isString.js";
|
|
3
|
+
import last from "lodash/last.js";
|
|
4
|
+
import { previousTriggeredEntityContextVariableId } from "@fibery/expression-utils/src/context-variables";
|
|
5
|
+
import drop from "lodash/drop.js";
|
|
6
|
+
//#region src/filter-expression/pattern-match-placeholders.ts
|
|
12
7
|
const getFieldPlaceholder = (fieldObjectMatchFn) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (fieldObjects.length > 1 && fieldObjects[fieldObjects.length - 2].type === "Collaboration~Documents/Document") {
|
|
34
|
-
return fieldObjectMatchFn(fieldObjects[fieldObjects.length - 1], fieldObjects);
|
|
35
|
-
}
|
|
36
|
-
return fieldObjectMatchFn(fieldObjects[fieldObjects.length - 1], fieldObjects);
|
|
37
|
-
};
|
|
38
|
-
return { id: ":expression-pattern/expression-placeholder", matchFn };
|
|
8
|
+
const matchFn = (expression, typeObject) => {
|
|
9
|
+
if (isString(expression)) return Object.hasOwn(typeObject.fieldObjectsByName, expression) ? fieldObjectMatchFn(typeObject.fieldObjectsByName[expression], [typeObject.fieldObjectsByName[expression]]) : false;
|
|
10
|
+
if (!isFieldExpression(expression)) return false;
|
|
11
|
+
const expression1 = expression[0] === previousTriggeredEntityContextVariableId ? drop(expression, 1) : expression;
|
|
12
|
+
if (!isFieldExpressionValid({
|
|
13
|
+
typeObject,
|
|
14
|
+
expression: expression1
|
|
15
|
+
})) return false;
|
|
16
|
+
if (expression1.length === 0) return false;
|
|
17
|
+
const fieldObjects = getFieldObjectsByFieldExpression({
|
|
18
|
+
typeObject,
|
|
19
|
+
expression: expression1
|
|
20
|
+
});
|
|
21
|
+
if (fieldObjects.length > 1 && fieldObjects[fieldObjects.length - 2].type === "Collaboration~Documents/Document") return fieldObjectMatchFn(fieldObjects[fieldObjects.length - 1], fieldObjects);
|
|
22
|
+
return fieldObjectMatchFn(fieldObjects[fieldObjects.length - 1], fieldObjects);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
id: ":expression-pattern/expression-placeholder",
|
|
26
|
+
matchFn
|
|
27
|
+
};
|
|
39
28
|
};
|
|
40
29
|
const getReferenceExpressionPlaceholder = (isReferenceCollection) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
: !fieldObjects[fieldObjects.length - 2].isCollection;
|
|
62
|
-
return (!fieldObjects[fieldObjects.length - 2].typeObject.isPrimitive &&
|
|
63
|
-
matchesReferenceKind &&
|
|
64
|
-
fieldObjects[fieldObjects.length - 1].isId);
|
|
65
|
-
};
|
|
66
|
-
return { id: ":expression-pattern/expression-placeholder", matchFn };
|
|
30
|
+
const matchFn = (expression, typeObject) => {
|
|
31
|
+
if (!isFieldExpression(expression)) return false;
|
|
32
|
+
const expression1 = expression[0] === previousTriggeredEntityContextVariableId ? drop(expression, 1) : expression;
|
|
33
|
+
if (!isFieldExpressionValid({
|
|
34
|
+
typeObject,
|
|
35
|
+
expression: expression1
|
|
36
|
+
})) return false;
|
|
37
|
+
if (expression1.length < 2) return false;
|
|
38
|
+
const fieldObjects = getFieldObjectsByFieldExpression({
|
|
39
|
+
typeObject,
|
|
40
|
+
expression: expression1
|
|
41
|
+
});
|
|
42
|
+
if (fieldObjects.length < 2) return false;
|
|
43
|
+
const matchesReferenceKind = isReferenceCollection ? fieldObjects[fieldObjects.length - 2].isCollection : !fieldObjects[fieldObjects.length - 2].isCollection;
|
|
44
|
+
return !fieldObjects[fieldObjects.length - 2].typeObject.isPrimitive && matchesReferenceKind && fieldObjects[fieldObjects.length - 1].isId;
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
id: ":expression-pattern/expression-placeholder",
|
|
48
|
+
matchFn
|
|
49
|
+
};
|
|
67
50
|
};
|
|
68
51
|
const getDateExpressionPlaceholder = (dateFieldMatchFn) => ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
: dateFieldMatchFn(expression, typeObject);
|
|
74
|
-
},
|
|
52
|
+
id: ":expression-pattern/expression-placeholder",
|
|
53
|
+
matchFn: (expression, typeObject) => {
|
|
54
|
+
return isDateRangeFunctionExpression(expression) ? dateFieldMatchFn(expression[1], typeObject) : dateFieldMatchFn(expression, typeObject);
|
|
55
|
+
}
|
|
75
56
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
const anyExpressionPlaceholder = {
|
|
58
|
+
id: ":expression-pattern/expression-placeholder",
|
|
59
|
+
matchFn: () => true
|
|
79
60
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
const idFieldPlaceholder = getFieldPlaceholder((fieldObject, fieldObjects) => fieldObjects.length === 1 && fieldObject.isId);
|
|
62
|
+
const basicFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
63
|
+
return fieldObject.typeObject.isPrimitive;
|
|
83
64
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
const textFieldPlaceholder = {
|
|
66
|
+
id: ":expression-pattern/expression-placeholder",
|
|
67
|
+
matchFn: (expression, typeObject) => {
|
|
68
|
+
const isTextFieldObjectExpression = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/text" || fieldObject.type === "fibery/email" || fieldObject.type === "fibery/url").matchFn(expression, typeObject);
|
|
69
|
+
const isSnippetExpression = last(expression) === "Collaboration~Documents/Snippet";
|
|
70
|
+
return isTextFieldObjectExpression || isSnippetExpression;
|
|
71
|
+
}
|
|
91
72
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
const numberFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/int" || fieldObject.type === "fibery/decimal");
|
|
74
|
+
const dateFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
75
|
+
return isDateType(fieldObject.type);
|
|
95
76
|
});
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
const dateTimeFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
78
|
+
return isDateTimeType(fieldObject.type);
|
|
98
79
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
80
|
+
const boolFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/bool");
|
|
81
|
+
const locationFieldPlaceholder = getFieldPlaceholder((fieldObject) => fieldObject.type === "fibery/location");
|
|
82
|
+
const referenceCollectionFieldPlaceholder = getFieldPlaceholder((fieldObject) => {
|
|
83
|
+
return !fieldObject.typeObject.isPrimitive && fieldObject.isCollection;
|
|
103
84
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
exports.referenceCollectionExpressionPlaceholder.matchFn(expression[1], typeObject));
|
|
112
|
-
},
|
|
85
|
+
const referenceExpressionPlaceholder = getReferenceExpressionPlaceholder(false);
|
|
86
|
+
const referenceCollectionExpressionPlaceholder = getReferenceExpressionPlaceholder(true);
|
|
87
|
+
const collectionCountExpressionPlaceholder = {
|
|
88
|
+
id: ":expression-pattern/expression-placeholder",
|
|
89
|
+
matchFn: (expression, typeObject) => {
|
|
90
|
+
return isFunctionCallExpression(expression) && expression[0] === "q/count" && referenceCollectionExpressionPlaceholder.matchFn(expression[1], typeObject);
|
|
91
|
+
}
|
|
113
92
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
exports.dateTimeOrDateTimeRangeExpressionPlaceholder.matchFn(expression, typeObject),
|
|
93
|
+
const dateOrDateRangeExpressionPlaceholder = getDateExpressionPlaceholder(dateFieldPlaceholder.matchFn);
|
|
94
|
+
const dateTimeOrDateTimeRangeExpressionPlaceholder = getDateExpressionPlaceholder(dateTimeFieldPlaceholder.matchFn);
|
|
95
|
+
const anyDateExpressionPlaceholder = {
|
|
96
|
+
id: ":expression-pattern/expression-placeholder",
|
|
97
|
+
matchFn: (expression, typeObject) => dateOrDateRangeExpressionPlaceholder.matchFn(expression, typeObject) || dateTimeOrDateTimeRangeExpressionPlaceholder.matchFn(expression, typeObject)
|
|
120
98
|
};
|
|
121
99
|
const getParamPlaceholder = (matchFn = (_x) => true) => ({
|
|
122
|
-
|
|
123
|
-
|
|
100
|
+
id: ":expression-pattern/param-placeholder",
|
|
101
|
+
matchFn
|
|
124
102
|
});
|
|
125
|
-
exports.getParamPlaceholder = getParamPlaceholder;
|
|
126
103
|
const getConstantPlaceholder = (value) => ({
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
104
|
+
id: ":expression-pattern/constant-placeholder",
|
|
105
|
+
value,
|
|
106
|
+
matchFn: (x) => x === value
|
|
130
107
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
expression,
|
|
148
|
-
});
|
|
149
|
-
if (fieldObjects.length !== 2) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
return (!fieldObjects[0].typeObject.isPrimitive &&
|
|
153
|
-
!fieldObjects[0].isCollection &&
|
|
154
|
-
(fieldObjects[1].isTitle || fieldObjects[1] === fieldObjects[1].holderTypeObject.rankFieldObject));
|
|
155
|
-
},
|
|
108
|
+
const referenceTitleOrRankExpressionPlaceholder = {
|
|
109
|
+
id: ":expression-pattern/expression-placeholder",
|
|
110
|
+
matchFn: (expression, typeObject) => {
|
|
111
|
+
if (!isFieldExpression(expression)) return false;
|
|
112
|
+
if (!isFieldExpressionValid({
|
|
113
|
+
typeObject,
|
|
114
|
+
expression
|
|
115
|
+
})) return false;
|
|
116
|
+
if (expression.length !== 2) return false;
|
|
117
|
+
const fieldObjects = getFieldObjectsByFieldExpression({
|
|
118
|
+
typeObject,
|
|
119
|
+
expression
|
|
120
|
+
});
|
|
121
|
+
if (fieldObjects.length !== 2) return false;
|
|
122
|
+
return !fieldObjects[0].typeObject.isPrimitive && !fieldObjects[0].isCollection && (fieldObjects[1].isTitle || fieldObjects[1] === fieldObjects[1].holderTypeObject.rankFieldObject);
|
|
123
|
+
}
|
|
156
124
|
};
|
|
157
|
-
//#
|
|
125
|
+
//#endregion
|
|
126
|
+
export { anyDateExpressionPlaceholder, anyExpressionPlaceholder, basicFieldPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateFieldPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeFieldPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, idFieldPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, referenceTitleOrRankExpressionPlaceholder, textFieldPlaceholder };
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Expression, SubQuery } from "../types.js";
|
|
2
|
+
import { $TSFixMe } from "../tsfixme.js";
|
|
3
|
+
import { TypeObject } from "@fibery/schema";
|
|
4
|
+
//#region src/filter-expression/pattern-match.d.ts
|
|
4
5
|
type ExpressionToMatch = SubQuery | Record<string, Expression> | Expression | undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ParamPatternMatch = {
|
|
7
|
+
matchType: ":expression-match-type/param";
|
|
8
|
+
value: $TSFixMe;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type ExpressionPatternMatch = {
|
|
11
|
+
matchType: ":expression-match-type/expression";
|
|
12
|
+
value: Expression;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
type PatternMatches = ParamPatternMatch | ExpressionPatternMatch;
|
|
15
|
+
type PatternMatchResult = {
|
|
16
|
+
matchSuccess: boolean;
|
|
17
|
+
matches: Array<PatternMatches>;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
declare const doPatternMatch: (expression: ExpressionToMatch, params: Record<string, unknown>, pattern: $TSFixMe, typeObject: TypeObject) => PatternMatchResult;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ExpressionPatternMatch, ParamPatternMatch, PatternMatchResult, PatternMatches, doPatternMatch };
|