@fibery/expression-utils 10.0.0 → 10.0.2
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/{src/context-variables.js → context-variables.js} +1 -1
- package/lib/{src/filter-expression → filter-expression}/index.d.ts +1 -1
- package/lib/{src/filter-expression → filter-expression}/index.js +5 -4
- package/lib/{src/filter-expression → filter-expression}/operator-utils.d.ts +3 -7
- package/lib/{src/filter-expression → filter-expression}/operator-utils.js +12 -9
- package/lib/filter-expression/operators.d.ts +354 -0
- package/lib/{src/filter-expression → filter-expression}/operators.js +30 -26
- package/lib/filter-expression/pattern-match.d.ts +23 -0
- package/lib/filter-expression/pattern-match.js +116 -0
- package/lib/filter-expression/pattern-to-expression.d.ts +6 -0
- package/lib/filter-expression/pattern-to-expression.js +42 -0
- package/lib/filter-expression/types.d.ts +56 -0
- package/lib/index.d.ts +10 -181
- package/lib/index.js +8 -8
- package/lib/{src/params-placeholders.js → params-placeholders.js} +1 -1
- package/lib/{src/utils.js → utils.js} +2 -2
- package/lib/{src/visitors.js → visitors.js} +1 -1
- package/package.json +12 -38
- package/lib/src/filter-expression/operators.d.ts +0 -113
- package/lib/src/filter-expression/pattern-match.d.ts +0 -21
- package/lib/src/filter-expression/pattern-match.js +0 -126
- package/lib/src/filter-expression/pattern-to-expression.d.ts +0 -17
- package/lib/src/filter-expression/pattern-to-expression.js +0 -44
- package/lib/src/filter-expression/types.d.ts +0 -33
- package/lib/src/tsfixme.d.ts +0 -4
- package/lib/src/tsfixme.js +0 -0
- package/lib/test-data/schema-mock.d.ts +0 -73
- package/lib/test-data/schema-mock.js +0 -175
- /package/lib/{src/context-variables.d.ts → context-variables.d.ts} +0 -0
- /package/lib/{src/errors.d.ts → errors.d.ts} +0 -0
- /package/lib/{src/errors.js → errors.js} +0 -0
- /package/lib/{src/field-expression-visitor-type-aware.d.ts → field-expression-visitor-type-aware.d.ts} +0 -0
- /package/lib/{src/field-expression-visitor-type-aware.js → field-expression-visitor-type-aware.js} +0 -0
- /package/lib/{src/filter-expression → filter-expression}/pattern-match-placeholders.d.ts +0 -0
- /package/lib/{src/filter-expression → filter-expression}/pattern-match-placeholders.js +0 -0
- /package/lib/{src/filter-expression → filter-expression}/types.js +0 -0
- /package/lib/{src/params-placeholders.d.ts → params-placeholders.d.ts} +0 -0
- /package/lib/{src/types.d.ts → types.d.ts} +0 -0
- /package/lib/{src/types.js → types.js} +0 -0
- /package/lib/{src/utils.d.ts → utils.d.ts} +0 -0
- /package/lib/{src/visitors.d.ts → visitors.d.ts} +0 -0
|
@@ -4,7 +4,7 @@ import { Schema } from "@fibery/schema";
|
|
|
4
4
|
//#region src/filter-expression/index.d.ts
|
|
5
5
|
declare const findMatchedFilter: (filterExpression: Expression, params: Record<string, unknown>, operators: Array<Operator>, schema: Schema | null, type: string) => {
|
|
6
6
|
operator: Operator;
|
|
7
|
-
value:
|
|
7
|
+
value: unknown;
|
|
8
8
|
expression: Expression;
|
|
9
9
|
type: string;
|
|
10
10
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NotImplementedError } from "../errors.js";
|
|
2
|
-
import { doPatternMatch } from "./pattern-match.js";
|
|
2
|
+
import { doPatternMatch, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
3
3
|
import { v4 } from "uuid";
|
|
4
4
|
//#region src/filter-expression/index.ts
|
|
5
5
|
const findMatchedFilter = (filterExpression, params, operators, schema, type) => {
|
|
@@ -14,13 +14,14 @@ const findMatchedFilter = (filterExpression, params, operators, schema, type) =>
|
|
|
14
14
|
type,
|
|
15
15
|
id: v4()
|
|
16
16
|
};
|
|
17
|
-
} else {
|
|
17
|
+
} else if (operator.pattern) {
|
|
18
18
|
const { matchSuccess, matches } = doPatternMatch(filterExpression, params, operator.pattern, typeObject);
|
|
19
19
|
if (matchSuccess) {
|
|
20
|
-
const paramMatches = matches.filter(
|
|
21
|
-
const expressionMatches = matches.filter(
|
|
20
|
+
const paramMatches = matches.filter(isParamPatternMatch);
|
|
21
|
+
const expressionMatches = matches.filter(isExpressionPatternMatch);
|
|
22
22
|
if (paramMatches.length > 1) throw new NotImplementedError(`Operator pattern with several param placeholders`);
|
|
23
23
|
if (expressionMatches.length > 1) throw new NotImplementedError(`Operator pattern with several expression placeholders`);
|
|
24
|
+
if (expressionMatches.length === 0) throw new NotImplementedError(`Operator pattern without an expression placeholder`);
|
|
24
25
|
return {
|
|
25
26
|
operator,
|
|
26
27
|
value: paramMatches[0] && paramMatches[0].value,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { Expression } from "../types.js";
|
|
2
|
-
import {
|
|
3
|
-
import { CustomMatchFn, Operator } from "./types.js";
|
|
2
|
+
import { ConvertResult, CustomMatchFn, ExpressionPlaceholder, Operator } from "./types.js";
|
|
4
3
|
//#region src/filter-expression/operator-utils.d.ts
|
|
5
4
|
declare const isDateTime: (dateString: string) => boolean;
|
|
6
5
|
declare const NO_VALUE: undefined;
|
|
7
6
|
declare const isNoValue: (value: unknown) => boolean;
|
|
8
7
|
declare const getCompareOperatorForDateTime: (id: string, title: string, operator: string, compareByStartInterval: boolean, isNegative: boolean) => Operator;
|
|
9
|
-
declare const getWithinOperatorCustomConvertFn: (leftPartExcluded: boolean) => (expression: Expression, value:
|
|
10
|
-
|
|
11
|
-
withinRangeEnd: unknown;
|
|
12
|
-
} | null, getNextParamName: () => string) => $TSFixMe;
|
|
13
|
-
declare const getWithinOperatorCustomMatchFn: (fieldPlaceholder: $TSFixMe, leftPartExcluded: boolean) => CustomMatchFn;
|
|
8
|
+
declare const getWithinOperatorCustomConvertFn: (leftPartExcluded: boolean) => (expression: Expression, value: unknown, getNextParamName: () => string) => ConvertResult;
|
|
9
|
+
declare const getWithinOperatorCustomMatchFn: (fieldPlaceholder: ExpressionPlaceholder, leftPartExcluded: boolean) => CustomMatchFn;
|
|
14
10
|
//#endregion
|
|
15
11
|
export { NO_VALUE, getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { doPatternMatch } from "./pattern-match.js";
|
|
1
|
+
import { doPatternMatch, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
2
2
|
import { dateToDateTimeIntervalLookup, monthAgoDateParamPlaceholder, monthAgoStartDateTimeParamPlaceholder, monthFromNowDateParamPlaceholder, monthFromNowEndDateTimeParamPlaceholder, paramsPlaceholdersLookup, parseRelativeDatePlaceholder, toRelativeDatePlaceholder, todayDateParamPlaceholder, todayEndDateTimeParamPlaceholder, weekAgoDateParamPlaceholder, weekAgoStartDateTimeParamPlaceholder, weekFromNowDateParamPlaceholder, weekFromNowEndDateTimeParamPlaceholder, yearAgoDateParamPlaceholder, yearAgoStartDateTimeParamPlaceholder, yearFromNowDateParamPlaceholder, yearFromNowEndDateTimeParamPlaceholder } from "../params-placeholders.js";
|
|
3
3
|
import { dateTimeOrDateTimeRangeExpressionPlaceholder, getParamPlaceholder } from "./pattern-match-placeholders.js";
|
|
4
4
|
import { isRecord } from "@fibery/helpers/src/_";
|
|
@@ -23,7 +23,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
23
23
|
return isString(x) && Boolean(paramsPlaceholdersLookup[x]) || isString(x) && isDateTime(x) || Boolean(parseRelativeDatePlaceholder(x)) || isNoValue(x);
|
|
24
24
|
})
|
|
25
25
|
], typeObject);
|
|
26
|
-
if (matchSuccess) {
|
|
26
|
+
if (matchSuccess && isExpressionPatternMatch(fieldMatch) && isParamPatternMatch(paramMatch)) {
|
|
27
27
|
const paramValue = paramMatch.value;
|
|
28
28
|
const relativeDateInfo = parseRelativeDatePlaceholder(paramValue);
|
|
29
29
|
if (relativeDateInfo && relativeDateInfo.isStartOfInterval === compareByStartInterval) {
|
|
@@ -36,7 +36,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
36
36
|
expression: fieldMatch.value,
|
|
37
37
|
value
|
|
38
38
|
};
|
|
39
|
-
} else if (paramsPlaceholdersLookup[paramValue]) {
|
|
39
|
+
} else if (typeof paramValue === "string" && paramsPlaceholdersLookup[paramValue]) {
|
|
40
40
|
const value = findKey(dateToDateTimeIntervalLookup, (val) => compareByStartInterval ? val.start === paramValue : val.end === paramValue);
|
|
41
41
|
return {
|
|
42
42
|
matchSuccess,
|
|
@@ -52,7 +52,7 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
52
52
|
return { matchSuccess: false };
|
|
53
53
|
},
|
|
54
54
|
customConvertToWhereExpression: (expression, value, getNextParamName) => {
|
|
55
|
-
const dateTimePlaceholders = dateToDateTimeIntervalLookup[value];
|
|
55
|
+
const dateTimePlaceholders = typeof value === "string" ? dateToDateTimeIntervalLookup[value] : void 0;
|
|
56
56
|
let relativeDateInfo = null;
|
|
57
57
|
if (dateTimePlaceholders) {
|
|
58
58
|
const { start, end } = dateTimePlaceholders;
|
|
@@ -95,7 +95,8 @@ const getCompareOperatorForDateTime = (id, title, operator, compareByStartInterv
|
|
|
95
95
|
isNegative
|
|
96
96
|
});
|
|
97
97
|
const getWithinRangeParam = ({ withinRangeValue, getNextParamName }) => {
|
|
98
|
-
|
|
98
|
+
const withinRangeDateInfo = parseRelativeDatePlaceholder(withinRangeValue);
|
|
99
|
+
if (typeof withinRangeValue === "string" && withinRangeDateInfo) return {
|
|
99
100
|
key: withinRangeValue,
|
|
100
101
|
value: withinRangeValue
|
|
101
102
|
};
|
|
@@ -104,14 +105,16 @@ const getWithinRangeParam = ({ withinRangeValue, getNextParamName }) => {
|
|
|
104
105
|
value: withinRangeValue
|
|
105
106
|
};
|
|
106
107
|
};
|
|
108
|
+
const isWithinRangeValue = (value) => isRecord(value) && "withinRangeStart" in value && "withinRangeEnd" in value;
|
|
107
109
|
const getWithinOperatorCustomConvertFn = (leftPartExcluded) => {
|
|
108
110
|
return (expression, value, getNextParamName) => {
|
|
111
|
+
const withinRangeValue = isWithinRangeValue(value) ? value : null;
|
|
109
112
|
const { key: startParamKey, value: startParamValue } = getWithinRangeParam({
|
|
110
|
-
withinRangeValue:
|
|
113
|
+
withinRangeValue: withinRangeValue?.withinRangeStart,
|
|
111
114
|
getNextParamName
|
|
112
115
|
});
|
|
113
116
|
const { key: endParamKey, value: endParamValue } = getWithinRangeParam({
|
|
114
|
-
withinRangeValue:
|
|
117
|
+
withinRangeValue: withinRangeValue?.withinRangeEnd,
|
|
115
118
|
getNextParamName
|
|
116
119
|
});
|
|
117
120
|
return {
|
|
@@ -152,12 +155,12 @@ const oldWithinPlaceholderToRelativeDateLookup = {
|
|
|
152
155
|
[todayEndDateTimeParamPlaceholder]: "$end-of-day-0-day-before-now-date-time"
|
|
153
156
|
};
|
|
154
157
|
const getWithinRangeValue = (paramMatchValue) => {
|
|
155
|
-
if (Object.hasOwn(oldWithinPlaceholderToRelativeDateLookup, paramMatchValue)) return oldWithinPlaceholderToRelativeDateLookup[paramMatchValue];
|
|
158
|
+
if (typeof paramMatchValue === "string" && Object.hasOwn(oldWithinPlaceholderToRelativeDateLookup, paramMatchValue)) return oldWithinPlaceholderToRelativeDateLookup[paramMatchValue];
|
|
156
159
|
else return paramMatchValue;
|
|
157
160
|
};
|
|
158
161
|
const matchWithinOperator = (pattern, where, params, typeObject) => {
|
|
159
162
|
const { matchSuccess, matches: [firstFieldMatch, firstParamMatch, secondFieldMatch, secondParamMatch] } = doPatternMatch(where, params, pattern, typeObject);
|
|
160
|
-
if (matchSuccess) {
|
|
163
|
+
if (matchSuccess && isExpressionPatternMatch(firstFieldMatch) && isParamPatternMatch(firstParamMatch) && isExpressionPatternMatch(secondFieldMatch) && isParamPatternMatch(secondParamMatch)) {
|
|
161
164
|
const firstFieldValue = firstFieldMatch.value;
|
|
162
165
|
const secondFieldValue = secondFieldMatch.value;
|
|
163
166
|
if (isEqual(firstFieldValue, secondFieldValue)) return {
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { Expression } from "../types.js";
|
|
2
|
+
import { Operator } from "./types.js";
|
|
3
|
+
import { TypeObject } from "@fibery/schema";
|
|
4
|
+
declare namespace operators_d_exports {
|
|
5
|
+
export { hiddenValidOperators, operatorBoolIs, operatorCollectionContains, operatorCollectionContainsAnyOf, operatorCollectionContainsMe, operatorCollectionCountDoesNotEqual, operatorCollectionCountEquals, operatorCollectionCountGreaterThan, operatorCollectionCountGreaterThanOrEqual, operatorCollectionCountLessThan, operatorCollectionCountLessThanOrEqual, operatorCollectionDoesNotContain, operatorCollectionDoesNotContainAnyOf, operatorCollectionDoesNotContainMe, operatorCollectionIsEmpty, operatorCollectionIsNotEmpty, operatorDateIs, operatorDateIsAfter, operatorDateIsBefore, operatorDateIsEmptyV1, operatorDateIsEmptyV2, operatorDateIsNotEmptyV1, operatorDateIsNotEmptyV2, operatorDateIsOnOrAfter, operatorDateIsOnOrBefore, operatorDateIsWithin, operatorDateTimeIs, operatorDateTimeIsAfter, operatorDateTimeIsBefore, operatorDateTimeIsOnOrAfter, operatorDateTimeIsOnOrBefore, operatorDateTimeIsWithin, operatorGreaterThan, operatorGreaterThanOrEqual, operatorLessThan, operatorLessThanOrEqual, operatorLocationContains, operatorLocationDoesNotContain, operatorLocationIsEmpty, operatorLocationIsNotEmpty, operatorNumberDoesNotEqual, operatorNumberEquals, operatorNumberIsEmptyV1, operatorNumberIsEmptyV2, operatorNumberIsNotEmptyV1, operatorNumberIsNotEmptyV2, operatorReferenceIs, operatorReferenceIsAnyOf, operatorReferenceIsEmpty, operatorReferenceIsMe, operatorReferenceIsNoneOf, operatorReferenceIsNot, operatorReferenceIsNotEmpty, operatorReferenceIsNotMe, operatorTextContains, operatorTextDoesNotContain, operatorTextEndsWith, operatorTextExactlyIs, operatorTextIs, operatorTextIsEmptyV1, operatorTextIsEmptyV2, operatorTextIsNot, operatorTextIsNotEmptyV1, operatorTextIsNotEmptyV2, operatorTextStartsWith, operatorUserRoleIsAnyOf, operators, operatorsGroups, operatorsGroupsWithoutMe, withoutLastIdAccess };
|
|
6
|
+
}
|
|
7
|
+
declare const operatorReferenceIsMe: Operator;
|
|
8
|
+
declare const operatorReferenceIsNotMe: Operator;
|
|
9
|
+
declare const operatorReferenceIs: Operator;
|
|
10
|
+
declare const operatorReferenceIsAnyOf: Operator;
|
|
11
|
+
declare const operatorReferenceIsNot: Operator;
|
|
12
|
+
declare const operatorReferenceIsNoneOf: Operator;
|
|
13
|
+
declare const operatorReferenceIsEmpty: Operator;
|
|
14
|
+
declare const operatorReferenceIsNotEmpty: Operator;
|
|
15
|
+
declare const operatorUserRoleIsAnyOf: Operator;
|
|
16
|
+
declare const operatorTextIs: {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
pattern: (string | {
|
|
20
|
+
id: ":expression-pattern/expression-placeholder";
|
|
21
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
22
|
+
} | {
|
|
23
|
+
id: ":expression-pattern/param-placeholder";
|
|
24
|
+
matchFn: (_x: unknown) => boolean;
|
|
25
|
+
})[];
|
|
26
|
+
type: string;
|
|
27
|
+
isNegative: false;
|
|
28
|
+
};
|
|
29
|
+
declare const operatorTextExactlyIs: Operator;
|
|
30
|
+
declare const operatorTextIsNot: Operator;
|
|
31
|
+
declare const operatorTextContains: Operator;
|
|
32
|
+
declare const operatorTextDoesNotContain: Operator;
|
|
33
|
+
declare const operatorTextStartsWith: Operator;
|
|
34
|
+
declare const operatorTextEndsWith: Operator;
|
|
35
|
+
declare const operatorNumberEquals: Operator;
|
|
36
|
+
declare const operatorNumberDoesNotEqual: Operator;
|
|
37
|
+
declare const operatorGreaterThan: Operator;
|
|
38
|
+
declare const operatorLessThan: Operator;
|
|
39
|
+
declare const operatorGreaterThanOrEqual: Operator;
|
|
40
|
+
declare const operatorLessThanOrEqual: Operator;
|
|
41
|
+
declare const operatorCollectionCountEquals: Operator;
|
|
42
|
+
declare const operatorCollectionCountDoesNotEqual: Operator;
|
|
43
|
+
declare const operatorCollectionCountGreaterThan: Operator;
|
|
44
|
+
declare const operatorCollectionCountLessThan: Operator;
|
|
45
|
+
declare const operatorCollectionCountGreaterThanOrEqual: Operator;
|
|
46
|
+
declare const operatorCollectionCountLessThanOrEqual: Operator;
|
|
47
|
+
declare const operatorNumberIsEmptyV1: Operator;
|
|
48
|
+
declare const operatorNumberIsEmptyV2: Operator;
|
|
49
|
+
declare const operatorNumberIsNotEmptyV1: Operator;
|
|
50
|
+
declare const operatorNumberIsNotEmptyV2: Operator;
|
|
51
|
+
declare const operatorTextIsEmptyV1: Operator;
|
|
52
|
+
declare const operatorTextIsEmptyV2: Operator;
|
|
53
|
+
declare const operatorTextIsNotEmptyV1: Operator;
|
|
54
|
+
declare const operatorTextIsNotEmptyV2: Operator;
|
|
55
|
+
declare const operatorLocationContains: Operator;
|
|
56
|
+
declare const operatorLocationDoesNotContain: Operator;
|
|
57
|
+
declare const operatorLocationIsEmpty: Operator;
|
|
58
|
+
declare const operatorLocationIsNotEmpty: Operator;
|
|
59
|
+
declare const operatorCollectionContains: Operator;
|
|
60
|
+
declare const operatorCollectionContainsMe: Operator;
|
|
61
|
+
declare const withoutLastIdAccess: (expression: Expression) => Expression;
|
|
62
|
+
declare const operatorCollectionContainsAnyOf: Operator;
|
|
63
|
+
declare const operatorCollectionDoesNotContain: Operator;
|
|
64
|
+
declare const operatorCollectionDoesNotContainMe: Operator;
|
|
65
|
+
declare const operatorCollectionDoesNotContainAnyOf: Operator;
|
|
66
|
+
declare const operatorCollectionIsEmpty: Operator;
|
|
67
|
+
declare const operatorCollectionIsNotEmpty: Operator;
|
|
68
|
+
declare const operatorBoolIs: Operator;
|
|
69
|
+
declare const operatorDateIs: Operator;
|
|
70
|
+
declare const operatorDateIsEmptyV1: Operator;
|
|
71
|
+
declare const operatorDateIsEmptyV2: Operator;
|
|
72
|
+
declare const operatorDateIsNotEmptyV1: Operator;
|
|
73
|
+
declare const operatorDateIsNotEmptyV2: Operator;
|
|
74
|
+
declare const operatorDateIsWithin: Operator;
|
|
75
|
+
declare const operatorDateIsBefore: Operator;
|
|
76
|
+
declare const operatorDateIsOnOrBefore: Operator;
|
|
77
|
+
declare const operatorDateIsAfter: Operator;
|
|
78
|
+
declare const operatorDateIsOnOrAfter: Operator;
|
|
79
|
+
declare const operatorDateTimeIs: Operator;
|
|
80
|
+
declare const operatorDateTimeIsWithin: Operator;
|
|
81
|
+
declare const operatorDateTimeIsBefore: Operator;
|
|
82
|
+
declare const operatorDateTimeIsAfter: Operator;
|
|
83
|
+
declare const operatorDateTimeIsOnOrBefore: Operator;
|
|
84
|
+
declare const operatorDateTimeIsOnOrAfter: Operator;
|
|
85
|
+
declare const operatorsGroupsWithoutMe: {
|
|
86
|
+
":filter-type/comment-reference-collection": Operator[];
|
|
87
|
+
":filter-type/file-reference": Operator[];
|
|
88
|
+
":filter-type/file-reference-collection": Operator[];
|
|
89
|
+
":filter-type/reference": Operator[];
|
|
90
|
+
":filter-type/user-reference": Operator[];
|
|
91
|
+
":filter-type/single-select": Operator[];
|
|
92
|
+
":filter-type/multi-select": Operator[];
|
|
93
|
+
":filter-type/reference-collection": Operator[];
|
|
94
|
+
":filter-type/user-reference-collection": Operator[];
|
|
95
|
+
":filter-type/text": (Operator | {
|
|
96
|
+
id: string;
|
|
97
|
+
title: string;
|
|
98
|
+
pattern: (string | {
|
|
99
|
+
id: ":expression-pattern/expression-placeholder";
|
|
100
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
101
|
+
} | {
|
|
102
|
+
id: ":expression-pattern/param-placeholder";
|
|
103
|
+
matchFn: (_x: unknown) => boolean;
|
|
104
|
+
})[];
|
|
105
|
+
type: string;
|
|
106
|
+
isNegative: false;
|
|
107
|
+
})[];
|
|
108
|
+
":filter-type/number": Operator[];
|
|
109
|
+
":filter-type/bool": Operator[];
|
|
110
|
+
":filter-type/date": Operator[];
|
|
111
|
+
":filter-type/date-time": Operator[];
|
|
112
|
+
":filter-type/location": Operator[];
|
|
113
|
+
":filter-type/user-role": Operator[];
|
|
114
|
+
":filter-type/collection-count": Operator[];
|
|
115
|
+
};
|
|
116
|
+
declare const operatorsGroups: {
|
|
117
|
+
":filter-type/comment-reference-collection": (Operator | {
|
|
118
|
+
id: string;
|
|
119
|
+
title: string;
|
|
120
|
+
pattern: (string | {
|
|
121
|
+
id: ":expression-pattern/expression-placeholder";
|
|
122
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
123
|
+
} | {
|
|
124
|
+
id: ":expression-pattern/param-placeholder";
|
|
125
|
+
matchFn: (_x: unknown) => boolean;
|
|
126
|
+
})[];
|
|
127
|
+
type: string;
|
|
128
|
+
isNegative: false;
|
|
129
|
+
})[];
|
|
130
|
+
":filter-type/file-reference": (Operator | {
|
|
131
|
+
id: string;
|
|
132
|
+
title: string;
|
|
133
|
+
pattern: (string | {
|
|
134
|
+
id: ":expression-pattern/expression-placeholder";
|
|
135
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
136
|
+
} | {
|
|
137
|
+
id: ":expression-pattern/param-placeholder";
|
|
138
|
+
matchFn: (_x: unknown) => boolean;
|
|
139
|
+
})[];
|
|
140
|
+
type: string;
|
|
141
|
+
isNegative: false;
|
|
142
|
+
})[];
|
|
143
|
+
":filter-type/file-reference-collection": (Operator | {
|
|
144
|
+
id: string;
|
|
145
|
+
title: string;
|
|
146
|
+
pattern: (string | {
|
|
147
|
+
id: ":expression-pattern/expression-placeholder";
|
|
148
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
149
|
+
} | {
|
|
150
|
+
id: ":expression-pattern/param-placeholder";
|
|
151
|
+
matchFn: (_x: unknown) => boolean;
|
|
152
|
+
})[];
|
|
153
|
+
type: string;
|
|
154
|
+
isNegative: false;
|
|
155
|
+
})[];
|
|
156
|
+
":filter-type/reference": (Operator | {
|
|
157
|
+
id: string;
|
|
158
|
+
title: string;
|
|
159
|
+
pattern: (string | {
|
|
160
|
+
id: ":expression-pattern/expression-placeholder";
|
|
161
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
162
|
+
} | {
|
|
163
|
+
id: ":expression-pattern/param-placeholder";
|
|
164
|
+
matchFn: (_x: unknown) => boolean;
|
|
165
|
+
})[];
|
|
166
|
+
type: string;
|
|
167
|
+
isNegative: false;
|
|
168
|
+
})[];
|
|
169
|
+
":filter-type/user-reference": (Operator | {
|
|
170
|
+
id: string;
|
|
171
|
+
title: string;
|
|
172
|
+
pattern: (string | {
|
|
173
|
+
id: ":expression-pattern/expression-placeholder";
|
|
174
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
175
|
+
} | {
|
|
176
|
+
id: ":expression-pattern/param-placeholder";
|
|
177
|
+
matchFn: (_x: unknown) => boolean;
|
|
178
|
+
})[];
|
|
179
|
+
type: string;
|
|
180
|
+
isNegative: false;
|
|
181
|
+
})[];
|
|
182
|
+
":filter-type/single-select": (Operator | {
|
|
183
|
+
id: string;
|
|
184
|
+
title: string;
|
|
185
|
+
pattern: (string | {
|
|
186
|
+
id: ":expression-pattern/expression-placeholder";
|
|
187
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
188
|
+
} | {
|
|
189
|
+
id: ":expression-pattern/param-placeholder";
|
|
190
|
+
matchFn: (_x: unknown) => boolean;
|
|
191
|
+
})[];
|
|
192
|
+
type: string;
|
|
193
|
+
isNegative: false;
|
|
194
|
+
})[];
|
|
195
|
+
":filter-type/multi-select": (Operator | {
|
|
196
|
+
id: string;
|
|
197
|
+
title: string;
|
|
198
|
+
pattern: (string | {
|
|
199
|
+
id: ":expression-pattern/expression-placeholder";
|
|
200
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
201
|
+
} | {
|
|
202
|
+
id: ":expression-pattern/param-placeholder";
|
|
203
|
+
matchFn: (_x: unknown) => boolean;
|
|
204
|
+
})[];
|
|
205
|
+
type: string;
|
|
206
|
+
isNegative: false;
|
|
207
|
+
})[];
|
|
208
|
+
":filter-type/reference-collection": (Operator | {
|
|
209
|
+
id: string;
|
|
210
|
+
title: string;
|
|
211
|
+
pattern: (string | {
|
|
212
|
+
id: ":expression-pattern/expression-placeholder";
|
|
213
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
214
|
+
} | {
|
|
215
|
+
id: ":expression-pattern/param-placeholder";
|
|
216
|
+
matchFn: (_x: unknown) => boolean;
|
|
217
|
+
})[];
|
|
218
|
+
type: string;
|
|
219
|
+
isNegative: false;
|
|
220
|
+
})[];
|
|
221
|
+
":filter-type/user-reference-collection": (Operator | {
|
|
222
|
+
id: string;
|
|
223
|
+
title: string;
|
|
224
|
+
pattern: (string | {
|
|
225
|
+
id: ":expression-pattern/expression-placeholder";
|
|
226
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
227
|
+
} | {
|
|
228
|
+
id: ":expression-pattern/param-placeholder";
|
|
229
|
+
matchFn: (_x: unknown) => boolean;
|
|
230
|
+
})[];
|
|
231
|
+
type: string;
|
|
232
|
+
isNegative: false;
|
|
233
|
+
})[];
|
|
234
|
+
":filter-type/text": (Operator | {
|
|
235
|
+
id: string;
|
|
236
|
+
title: string;
|
|
237
|
+
pattern: (string | {
|
|
238
|
+
id: ":expression-pattern/expression-placeholder";
|
|
239
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
240
|
+
} | {
|
|
241
|
+
id: ":expression-pattern/param-placeholder";
|
|
242
|
+
matchFn: (_x: unknown) => boolean;
|
|
243
|
+
})[];
|
|
244
|
+
type: string;
|
|
245
|
+
isNegative: false;
|
|
246
|
+
})[];
|
|
247
|
+
":filter-type/number": (Operator | {
|
|
248
|
+
id: string;
|
|
249
|
+
title: string;
|
|
250
|
+
pattern: (string | {
|
|
251
|
+
id: ":expression-pattern/expression-placeholder";
|
|
252
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
253
|
+
} | {
|
|
254
|
+
id: ":expression-pattern/param-placeholder";
|
|
255
|
+
matchFn: (_x: unknown) => boolean;
|
|
256
|
+
})[];
|
|
257
|
+
type: string;
|
|
258
|
+
isNegative: false;
|
|
259
|
+
})[];
|
|
260
|
+
":filter-type/bool": (Operator | {
|
|
261
|
+
id: string;
|
|
262
|
+
title: string;
|
|
263
|
+
pattern: (string | {
|
|
264
|
+
id: ":expression-pattern/expression-placeholder";
|
|
265
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
266
|
+
} | {
|
|
267
|
+
id: ":expression-pattern/param-placeholder";
|
|
268
|
+
matchFn: (_x: unknown) => boolean;
|
|
269
|
+
})[];
|
|
270
|
+
type: string;
|
|
271
|
+
isNegative: false;
|
|
272
|
+
})[];
|
|
273
|
+
":filter-type/date": (Operator | {
|
|
274
|
+
id: string;
|
|
275
|
+
title: string;
|
|
276
|
+
pattern: (string | {
|
|
277
|
+
id: ":expression-pattern/expression-placeholder";
|
|
278
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
279
|
+
} | {
|
|
280
|
+
id: ":expression-pattern/param-placeholder";
|
|
281
|
+
matchFn: (_x: unknown) => boolean;
|
|
282
|
+
})[];
|
|
283
|
+
type: string;
|
|
284
|
+
isNegative: false;
|
|
285
|
+
})[];
|
|
286
|
+
":filter-type/date-time": (Operator | {
|
|
287
|
+
id: string;
|
|
288
|
+
title: string;
|
|
289
|
+
pattern: (string | {
|
|
290
|
+
id: ":expression-pattern/expression-placeholder";
|
|
291
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
292
|
+
} | {
|
|
293
|
+
id: ":expression-pattern/param-placeholder";
|
|
294
|
+
matchFn: (_x: unknown) => boolean;
|
|
295
|
+
})[];
|
|
296
|
+
type: string;
|
|
297
|
+
isNegative: false;
|
|
298
|
+
})[];
|
|
299
|
+
":filter-type/location": (Operator | {
|
|
300
|
+
id: string;
|
|
301
|
+
title: string;
|
|
302
|
+
pattern: (string | {
|
|
303
|
+
id: ":expression-pattern/expression-placeholder";
|
|
304
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
305
|
+
} | {
|
|
306
|
+
id: ":expression-pattern/param-placeholder";
|
|
307
|
+
matchFn: (_x: unknown) => boolean;
|
|
308
|
+
})[];
|
|
309
|
+
type: string;
|
|
310
|
+
isNegative: false;
|
|
311
|
+
})[];
|
|
312
|
+
":filter-type/user-role": (Operator | {
|
|
313
|
+
id: string;
|
|
314
|
+
title: string;
|
|
315
|
+
pattern: (string | {
|
|
316
|
+
id: ":expression-pattern/expression-placeholder";
|
|
317
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
318
|
+
} | {
|
|
319
|
+
id: ":expression-pattern/param-placeholder";
|
|
320
|
+
matchFn: (_x: unknown) => boolean;
|
|
321
|
+
})[];
|
|
322
|
+
type: string;
|
|
323
|
+
isNegative: false;
|
|
324
|
+
})[];
|
|
325
|
+
":filter-type/collection-count": (Operator | {
|
|
326
|
+
id: string;
|
|
327
|
+
title: string;
|
|
328
|
+
pattern: (string | {
|
|
329
|
+
id: ":expression-pattern/expression-placeholder";
|
|
330
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
331
|
+
} | {
|
|
332
|
+
id: ":expression-pattern/param-placeholder";
|
|
333
|
+
matchFn: (_x: unknown) => boolean;
|
|
334
|
+
})[];
|
|
335
|
+
type: string;
|
|
336
|
+
isNegative: false;
|
|
337
|
+
})[];
|
|
338
|
+
};
|
|
339
|
+
declare const operators: (Operator | {
|
|
340
|
+
id: string;
|
|
341
|
+
title: string;
|
|
342
|
+
pattern: (string | {
|
|
343
|
+
id: ":expression-pattern/expression-placeholder";
|
|
344
|
+
matchFn: (expression: Expression, typeObject: TypeObject) => boolean;
|
|
345
|
+
} | {
|
|
346
|
+
id: ":expression-pattern/param-placeholder";
|
|
347
|
+
matchFn: (_x: unknown) => boolean;
|
|
348
|
+
})[];
|
|
349
|
+
type: string;
|
|
350
|
+
isNegative: false;
|
|
351
|
+
})[];
|
|
352
|
+
declare const hiddenValidOperators: Operator[];
|
|
353
|
+
//#endregion
|
|
354
|
+
export { hiddenValidOperators, operatorBoolIs, operatorCollectionContains, operatorCollectionContainsAnyOf, operatorCollectionContainsMe, operatorCollectionCountDoesNotEqual, operatorCollectionCountEquals, operatorCollectionCountGreaterThan, operatorCollectionCountGreaterThanOrEqual, operatorCollectionCountLessThan, operatorCollectionCountLessThanOrEqual, operatorCollectionDoesNotContain, operatorCollectionDoesNotContainAnyOf, operatorCollectionDoesNotContainMe, operatorCollectionIsEmpty, operatorCollectionIsNotEmpty, operatorDateIs, operatorDateIsAfter, operatorDateIsBefore, operatorDateIsEmptyV1, operatorDateIsEmptyV2, operatorDateIsNotEmptyV1, operatorDateIsNotEmptyV2, operatorDateIsOnOrAfter, operatorDateIsOnOrBefore, operatorDateIsWithin, operatorDateTimeIs, operatorDateTimeIsAfter, operatorDateTimeIsBefore, operatorDateTimeIsOnOrAfter, operatorDateTimeIsOnOrBefore, operatorDateTimeIsWithin, operatorGreaterThan, operatorGreaterThanOrEqual, operatorLessThan, operatorLessThanOrEqual, operatorLocationContains, operatorLocationDoesNotContain, operatorLocationIsEmpty, operatorLocationIsNotEmpty, operatorNumberDoesNotEqual, operatorNumberEquals, operatorNumberIsEmptyV1, operatorNumberIsEmptyV2, operatorNumberIsNotEmptyV1, operatorNumberIsNotEmptyV2, operatorReferenceIs, operatorReferenceIsAnyOf, operatorReferenceIsEmpty, operatorReferenceIsMe, operatorReferenceIsNoneOf, operatorReferenceIsNot, operatorReferenceIsNotEmpty, operatorReferenceIsNotMe, operatorTextContains, operatorTextDoesNotContain, operatorTextEndsWith, operatorTextExactlyIs, operatorTextIs, operatorTextIsEmptyV1, operatorTextIsEmptyV2, operatorTextIsNot, operatorTextIsNotEmptyV1, operatorTextIsNotEmptyV2, operatorTextStartsWith, operatorUserRoleIsAnyOf, operators, operatorsGroups, operatorsGroupsWithoutMe, operators_d_exports, withoutLastIdAccess };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { __exportAll } from "
|
|
2
|
-
import { doPatternMatch } from "./pattern-match.js";
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { doPatternMatch, getExpressionArrayMatchValue, isExpressionPatternMatch, isParamPatternMatch } from "./pattern-match.js";
|
|
3
3
|
import { dateToDateTimeIntervalLookup, isDynamicFilterParam, paramsPlaceholdersLookup, parseRelativeDatePlaceholder, toRelativeDatePlaceholder } from "../params-placeholders.js";
|
|
4
4
|
import { anyDateExpressionPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, textFieldPlaceholder } from "./pattern-match-placeholders.js";
|
|
5
5
|
import { getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue } from "./operator-utils.js";
|
|
6
6
|
import { convertToExpression } from "./pattern-to-expression.js";
|
|
7
7
|
import flatten from "lodash/flatten.js";
|
|
8
|
-
import { validate } from "uuid";
|
|
9
8
|
import { mapValues } from "@fibery/helpers/src/_";
|
|
10
9
|
import isString from "lodash/isString.js";
|
|
11
10
|
import last from "lodash/last.js";
|
|
11
|
+
import { validate } from "uuid";
|
|
12
12
|
import findKey from "lodash/findKey.js";
|
|
13
13
|
import isEqual from "lodash/isEqual.js";
|
|
14
14
|
import uniq from "lodash/uniq.js";
|
|
@@ -102,13 +102,13 @@ const getReferenceMeOperator = ({ id, title, pattern, isNegative }) => {
|
|
|
102
102
|
title,
|
|
103
103
|
customMatch: (where, params, typeObject) => {
|
|
104
104
|
const { matchSuccess, matches } = doPatternMatch(where, params, pattern, typeObject);
|
|
105
|
-
if (matchSuccess) return {
|
|
105
|
+
if (matchSuccess && isExpressionPatternMatch(matches[0])) return {
|
|
106
106
|
matchSuccess,
|
|
107
107
|
expression: matches[0].value
|
|
108
108
|
};
|
|
109
109
|
return { matchSuccess: false };
|
|
110
110
|
},
|
|
111
|
-
customConvertToWhereExpression: (expression,
|
|
111
|
+
customConvertToWhereExpression: (expression, _value, getNextParamName) => {
|
|
112
112
|
return convertToExpression(pattern, expression, "$my-id", getNextParamName);
|
|
113
113
|
},
|
|
114
114
|
isNegative
|
|
@@ -127,7 +127,7 @@ const operatorReferenceIsNotMe = getReferenceMeOperator({
|
|
|
127
127
|
isNegative: true
|
|
128
128
|
});
|
|
129
129
|
function isValidReferenceUUID(val) {
|
|
130
|
-
return
|
|
130
|
+
return isString(val) && (validate(val) || isDynamicFilterParam(val));
|
|
131
131
|
}
|
|
132
132
|
const operatorReferenceIs = {
|
|
133
133
|
id: ":operator/reference-is",
|
|
@@ -602,9 +602,10 @@ const operatorCollectionContains = {
|
|
|
602
602
|
title: "contains",
|
|
603
603
|
customMatch: (where, params, typeObject) => {
|
|
604
604
|
const { matchSuccess, matches } = doPatternMatch(where, params, collectionContainsPattern, typeObject);
|
|
605
|
-
|
|
605
|
+
const expression = getExpressionArrayMatchValue(matches[0]);
|
|
606
|
+
if (matchSuccess && expression && isParamPatternMatch(matches[1])) return {
|
|
606
607
|
matchSuccess,
|
|
607
|
-
expression: [...
|
|
608
|
+
expression: [...expression, "fibery/id"],
|
|
608
609
|
value: matches[1].value
|
|
609
610
|
};
|
|
610
611
|
return { matchSuccess: false };
|
|
@@ -620,13 +621,14 @@ const getOperatorCollectionMe = ({ id, title, pattern, isNegative }) => ({
|
|
|
620
621
|
title,
|
|
621
622
|
customMatch: (where, params, typeObject) => {
|
|
622
623
|
const { matchSuccess, matches } = doPatternMatch(where, params, pattern, typeObject);
|
|
623
|
-
|
|
624
|
+
const expression = getExpressionArrayMatchValue(matches[0]);
|
|
625
|
+
if (matchSuccess && expression) return {
|
|
624
626
|
matchSuccess,
|
|
625
|
-
expression: [...
|
|
627
|
+
expression: [...expression, "fibery/id"]
|
|
626
628
|
};
|
|
627
629
|
return { matchSuccess: false };
|
|
628
630
|
},
|
|
629
|
-
customConvertToWhereExpression: (expression,
|
|
631
|
+
customConvertToWhereExpression: (expression, _value, getNextParamName) => {
|
|
630
632
|
return convertToExpression(pattern, withoutLastIdAccess(expression), "$my-id", getNextParamName);
|
|
631
633
|
},
|
|
632
634
|
type: ":operator-type/unary",
|
|
@@ -639,18 +641,18 @@ const operatorCollectionContainsMe = getOperatorCollectionMe({
|
|
|
639
641
|
isNegative: false
|
|
640
642
|
});
|
|
641
643
|
const withoutLastIdAccess = (expression) => {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return arr.slice(0, -1);
|
|
644
|
+
if (!Array.isArray(expression) || last(expression) !== "fibery/id") throw new Error("not supported");
|
|
645
|
+
return expression.slice(0, -1);
|
|
645
646
|
};
|
|
646
647
|
const operatorCollectionContainsAnyOf = {
|
|
647
648
|
id: ":operator/collection-contains-any-of",
|
|
648
649
|
title: "contains any of",
|
|
649
650
|
customMatch: (where, params, typeObject) => {
|
|
650
651
|
const { matchSuccess, matches } = doPatternMatch(where, params, collectionContainsAnyOfPattern, typeObject);
|
|
651
|
-
|
|
652
|
+
const expression = getExpressionArrayMatchValue(matches[0]);
|
|
653
|
+
if (matchSuccess && expression && isParamPatternMatch(matches[1])) return {
|
|
652
654
|
matchSuccess,
|
|
653
|
-
expression: [...
|
|
655
|
+
expression: [...expression, "fibery/id"],
|
|
654
656
|
value: matches[1].value
|
|
655
657
|
};
|
|
656
658
|
return { matchSuccess: false };
|
|
@@ -666,9 +668,10 @@ const operatorCollectionDoesNotContain = {
|
|
|
666
668
|
title: "does not contain",
|
|
667
669
|
customMatch: (where, params, typeObject) => {
|
|
668
670
|
const { matchSuccess, matches } = doPatternMatch(where, params, collectionDoesNotContainPattern, typeObject);
|
|
669
|
-
|
|
671
|
+
const expression = getExpressionArrayMatchValue(matches[0]);
|
|
672
|
+
if (matchSuccess && expression && isParamPatternMatch(matches[1])) return {
|
|
670
673
|
matchSuccess,
|
|
671
|
-
expression: [...
|
|
674
|
+
expression: [...expression, "fibery/id"],
|
|
672
675
|
value: matches[1].value
|
|
673
676
|
};
|
|
674
677
|
return { matchSuccess: false };
|
|
@@ -690,9 +693,10 @@ const operatorCollectionDoesNotContainAnyOf = {
|
|
|
690
693
|
title: "contains none of",
|
|
691
694
|
customMatch: (where, params, typeObject) => {
|
|
692
695
|
const { matchSuccess, matches } = doPatternMatch(where, params, collectionDoesNotContainAnyOfPattern, typeObject);
|
|
693
|
-
|
|
696
|
+
const expression = getExpressionArrayMatchValue(matches[0]);
|
|
697
|
+
if (matchSuccess && expression && isParamPatternMatch(matches[1])) return {
|
|
694
698
|
matchSuccess,
|
|
695
|
-
expression: [...
|
|
699
|
+
expression: [...expression, "fibery/id"],
|
|
696
700
|
value: matches[1].value
|
|
697
701
|
};
|
|
698
702
|
return { matchSuccess: false };
|
|
@@ -735,7 +739,7 @@ const operatorBoolIs = {
|
|
|
735
739
|
boolFieldPlaceholder,
|
|
736
740
|
getParamPlaceholder((x) => x === true || x === false)
|
|
737
741
|
], typeObject);
|
|
738
|
-
if (matchSuccess) return {
|
|
742
|
+
if (matchSuccess && isExpressionPatternMatch(matches[0]) && isParamPatternMatch(matches[1])) return {
|
|
739
743
|
matchSuccess,
|
|
740
744
|
expression: matches[0].value,
|
|
741
745
|
value: matches[1].value
|
|
@@ -755,7 +759,7 @@ const operatorBoolIs = {
|
|
|
755
759
|
getParamPlaceholder((x) => x === null)
|
|
756
760
|
]
|
|
757
761
|
], typeObject);
|
|
758
|
-
if (matchSuccess) return {
|
|
762
|
+
if (matchSuccess && isExpressionPatternMatch(matches[0])) return {
|
|
759
763
|
matchSuccess,
|
|
760
764
|
expression: matches[0].value,
|
|
761
765
|
value: false
|
|
@@ -902,10 +906,10 @@ const operatorDateTimeIs = {
|
|
|
902
906
|
getParamPlaceholder()
|
|
903
907
|
]
|
|
904
908
|
], typeObject);
|
|
905
|
-
if (matchSuccess && isEqual(firstFieldMatch.value, secondFieldMatch.value)) {
|
|
909
|
+
if (matchSuccess && isExpressionPatternMatch(firstFieldMatch) && isParamPatternMatch(firstParamMatch) && isExpressionPatternMatch(secondFieldMatch) && isParamPatternMatch(secondParamMatch) && isEqual(firstFieldMatch.value, secondFieldMatch.value)) {
|
|
906
910
|
const firstParamValue = firstParamMatch.value;
|
|
907
911
|
const secondParamValue = secondParamMatch.value;
|
|
908
|
-
if (paramsPlaceholdersLookup[firstParamValue] && paramsPlaceholdersLookup[secondParamValue]) {
|
|
912
|
+
if (typeof firstParamValue === "string" && typeof secondParamValue === "string" && paramsPlaceholdersLookup[firstParamValue] && paramsPlaceholdersLookup[secondParamValue]) {
|
|
909
913
|
const value = findKey(dateToDateTimeIntervalLookup, (val) => val.start === firstParamValue && val.end === secondParamValue);
|
|
910
914
|
return {
|
|
911
915
|
matchSuccess,
|
|
@@ -934,7 +938,7 @@ const operatorDateTimeIs = {
|
|
|
934
938
|
dateTimeOrDateTimeRangeExpressionPlaceholder,
|
|
935
939
|
getParamPlaceholder((x) => isString(x) && isDateTime(x) || isNoValue(x))
|
|
936
940
|
], typeObject);
|
|
937
|
-
if (matchSuccess) return {
|
|
941
|
+
if (matchSuccess && isExpressionPatternMatch(fieldMatch) && isParamPatternMatch(paramMatch)) return {
|
|
938
942
|
matchSuccess,
|
|
939
943
|
expression: fieldMatch.value,
|
|
940
944
|
value: paramMatch.value
|
|
@@ -943,7 +947,7 @@ const operatorDateTimeIs = {
|
|
|
943
947
|
return { matchSuccess: false };
|
|
944
948
|
},
|
|
945
949
|
customConvertToWhereExpression: (expression, value, getNextParamName) => {
|
|
946
|
-
const dateTimePlaceholders = dateToDateTimeIntervalLookup[value];
|
|
950
|
+
const dateTimePlaceholders = typeof value === "string" ? dateToDateTimeIntervalLookup[value] : void 0;
|
|
947
951
|
let relativeDateInfo = null;
|
|
948
952
|
if (dateTimePlaceholders) {
|
|
949
953
|
const { start, end } = dateTimePlaceholders;
|