@finos/legend-query-builder 4.17.97 → 4.17.99
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/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +13 -11
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js +13 -11
- package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js.map +1 -1
- package/lib/data-access-overview.css +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +7 -0
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.js +31 -13
- package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +6 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +6 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +14 -12
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +12 -10
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +10 -8
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +4 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +12 -10
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +6 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +6 -6
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +6 -6
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +14 -12
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +12 -10
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +12 -10
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +17 -13
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js +3 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +12 -10
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +12 -10
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +6 -6
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +3 -2
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/package.json +6 -6
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +13 -10
- package/src/components/fetch-structure/QueryBuilderTDSComponentHelper.tsx +13 -10
- package/src/stores/QueryBuilderValueSpecificationHelper.ts +35 -10
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +5 -3
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +5 -3
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +16 -13
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +18 -11
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +12 -9
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +6 -1
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +18 -11
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +5 -3
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +9 -5
- package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +9 -5
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +16 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +18 -11
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +18 -11
- package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +23 -14
- package/src/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.ts +3 -1
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +18 -11
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +18 -11
- package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +9 -5
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +6 -2
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
isSubType,
|
|
48
48
|
type ObserverContext,
|
|
49
49
|
InstanceValue,
|
|
50
|
+
getCorrespondingStandardPrimitiveType,
|
|
50
51
|
} from '@finos/legend-graph';
|
|
51
52
|
import {
|
|
52
53
|
addUniqueEntry,
|
|
@@ -211,6 +212,21 @@ export const isPropertyExpressionChainOptional = (
|
|
|
211
212
|
return isOptional;
|
|
212
213
|
};
|
|
213
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Maps a type to its equivalent standard PRIMITIVE_TYPE for compatibility checks.
|
|
217
|
+
* For standard primitive types, returns their own enum value.
|
|
218
|
+
* For precise primitive types, returns their standard equivalent.
|
|
219
|
+
* Returns undefined for non-primitive types (e.g. Enumeration, Class).
|
|
220
|
+
*/
|
|
221
|
+
export const getStandardPrimitiveTypeEquivalent = (
|
|
222
|
+
type: Type,
|
|
223
|
+
): PRIMITIVE_TYPE | undefined => {
|
|
224
|
+
if (type instanceof PrimitiveType) {
|
|
225
|
+
return type.path as PRIMITIVE_TYPE;
|
|
226
|
+
}
|
|
227
|
+
return getCorrespondingStandardPrimitiveType(type.path);
|
|
228
|
+
};
|
|
229
|
+
|
|
214
230
|
export const isTypeCompatibleForAssignment = (
|
|
215
231
|
type: Type | undefined,
|
|
216
232
|
assignmentType: Type,
|
|
@@ -228,20 +244,29 @@ export const isTypeCompatibleForAssignment = (
|
|
|
228
244
|
PRIMITIVE_TYPE.LATESTDATE,
|
|
229
245
|
] as string[];
|
|
230
246
|
|
|
247
|
+
if (type === undefined) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Normalize precise primitive types to their standard equivalents
|
|
252
|
+
const normalizedTypePath =
|
|
253
|
+
getStandardPrimitiveTypeEquivalent(type) ?? type.path;
|
|
254
|
+
const normalizedAssignmentTypePath =
|
|
255
|
+
getStandardPrimitiveTypeEquivalent(assignmentType) ?? assignmentType.path;
|
|
256
|
+
|
|
231
257
|
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
|
232
258
|
return (
|
|
233
|
-
type !== undefined &&
|
|
234
259
|
// Numeric value is handled loosely because of autoboxing
|
|
235
260
|
// e.g. LHS (integer) = RHS (float) is acceptable
|
|
236
|
-
(
|
|
237
|
-
NUMERIC_PRIMITIVE_TYPES.includes(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
261
|
+
(NUMERIC_PRIMITIVE_TYPES.includes(normalizedTypePath) &&
|
|
262
|
+
NUMERIC_PRIMITIVE_TYPES.includes(normalizedAssignmentTypePath)) ||
|
|
263
|
+
// Date value is handled loosely as well if the LHS is of type DateTime
|
|
264
|
+
// This is because we would simulate auto-boxing for date by altering the
|
|
265
|
+
// Pure function used for the operation
|
|
266
|
+
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
|
267
|
+
DATE_PRIMITIVE_TYPES.includes(normalizedTypePath) ||
|
|
268
|
+
normalizedTypePath === normalizedAssignmentTypePath ||
|
|
269
|
+
isSuperType(assignmentType, type)
|
|
245
270
|
);
|
|
246
271
|
};
|
|
247
272
|
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
type LambdaFunction,
|
|
22
22
|
type FunctionExpression,
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
|
-
PrimitiveType,
|
|
25
24
|
} from '@finos/legend-graph';
|
|
26
25
|
import {
|
|
27
26
|
guaranteeNonNullable,
|
|
@@ -37,6 +36,7 @@ import type {
|
|
|
37
36
|
} from '../QueryBuilderPostFilterState.js';
|
|
38
37
|
import {
|
|
39
38
|
buildNotExpression,
|
|
39
|
+
getStandardPrimitiveTypeEquivalent,
|
|
40
40
|
unwrapNotExpression,
|
|
41
41
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
42
42
|
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -53,15 +53,17 @@ export class QueryBuilderPostFilterOperator_Contain
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
isCompatibleWithType(type: Type): boolean {
|
|
56
|
-
return type ===
|
|
56
|
+
return getStandardPrimitiveTypeEquivalent(type) === PRIMITIVE_TYPE.STRING;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
isCompatibleWithConditionValue(
|
|
60
60
|
postFilterConditionState: PostFilterConditionState,
|
|
61
61
|
): boolean {
|
|
62
|
+
const rhsType = postFilterConditionState.rightConditionValue.type;
|
|
62
63
|
return (
|
|
63
64
|
!postFilterConditionState.rightConditionValue.isCollection &&
|
|
64
|
-
|
|
65
|
+
rhsType !== undefined &&
|
|
66
|
+
getStandardPrimitiveTypeEquivalent(rhsType) === PRIMITIVE_TYPE.STRING
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
type FunctionExpression,
|
|
21
21
|
type LambdaFunction,
|
|
22
22
|
PRIMITIVE_TYPE,
|
|
23
|
-
PrimitiveType,
|
|
24
23
|
} from '@finos/legend-graph';
|
|
25
24
|
import {
|
|
26
25
|
type Hashable,
|
|
@@ -35,6 +34,7 @@ import type {
|
|
|
35
34
|
} from '../QueryBuilderPostFilterState.js';
|
|
36
35
|
import {
|
|
37
36
|
buildNotExpression,
|
|
37
|
+
getStandardPrimitiveTypeEquivalent,
|
|
38
38
|
unwrapNotExpression,
|
|
39
39
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
40
40
|
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -51,15 +51,17 @@ export class QueryBuilderPostFilterOperator_EndWith
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
isCompatibleWithType(type: Type): boolean {
|
|
54
|
-
return
|
|
54
|
+
return getStandardPrimitiveTypeEquivalent(type) === PRIMITIVE_TYPE.STRING;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
isCompatibleWithConditionValue(
|
|
58
58
|
postFilterConditionState: PostFilterConditionState,
|
|
59
59
|
): boolean {
|
|
60
|
+
const rhsType = postFilterConditionState.rightConditionValue.type;
|
|
60
61
|
return (
|
|
61
62
|
!postFilterConditionState.rightConditionValue.isCollection &&
|
|
62
|
-
|
|
63
|
+
rhsType !== undefined &&
|
|
64
|
+
getStandardPrimitiveTypeEquivalent(rhsType) === PRIMITIVE_TYPE.STRING
|
|
63
65
|
);
|
|
64
66
|
}
|
|
65
67
|
|
package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
} from '../QueryBuilderPostFilterState.js';
|
|
39
39
|
import {
|
|
40
40
|
buildNotExpression,
|
|
41
|
+
getStandardPrimitiveTypeEquivalent,
|
|
41
42
|
isTypeCompatibleForAssignment,
|
|
42
43
|
unwrapNotExpression,
|
|
43
44
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
@@ -55,20 +56,22 @@ export class QueryBuilderPostFilterOperator_Equal
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
isCompatibleWithType(type: Type): boolean {
|
|
59
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(type);
|
|
58
60
|
return (
|
|
59
|
-
(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
(normalizedType !== undefined &&
|
|
62
|
+
(
|
|
63
|
+
[
|
|
64
|
+
PRIMITIVE_TYPE.STRING,
|
|
65
|
+
PRIMITIVE_TYPE.BOOLEAN,
|
|
66
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
67
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
68
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
69
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
70
|
+
PRIMITIVE_TYPE.DATE,
|
|
71
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
72
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
73
|
+
] as string[]
|
|
74
|
+
).includes(normalizedType)) ||
|
|
72
75
|
// if the type is enumeration, make sure the enumeration has some value
|
|
73
76
|
(type instanceof Enumeration && type.values.length > 0)
|
|
74
77
|
);
|
|
@@ -35,7 +35,10 @@ import type {
|
|
|
35
35
|
PostFilterConditionState,
|
|
36
36
|
QueryBuilderPostFilterState,
|
|
37
37
|
} from '../QueryBuilderPostFilterState.js';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getStandardPrimitiveTypeEquivalent,
|
|
40
|
+
isTypeCompatibleForAssignment,
|
|
41
|
+
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
39
42
|
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
40
43
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
|
41
44
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
|
@@ -50,17 +53,21 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
isCompatibleWithType(type: Type): boolean {
|
|
56
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(type);
|
|
53
57
|
return (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
normalizedType !== undefined &&
|
|
59
|
+
(
|
|
60
|
+
[
|
|
61
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
62
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
63
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
64
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
65
|
+
PRIMITIVE_TYPE.DATE,
|
|
66
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
67
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
68
|
+
] as string[]
|
|
69
|
+
).includes(normalizedType)
|
|
70
|
+
);
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
isCompatibleWithConditionValue(
|
package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilt
|
|
|
44
44
|
import {
|
|
45
45
|
buildNotExpression,
|
|
46
46
|
getCollectionValueSpecificationType,
|
|
47
|
+
getStandardPrimitiveTypeEquivalent,
|
|
47
48
|
unwrapNotExpression,
|
|
48
49
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
49
50
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
|
@@ -58,16 +59,18 @@ export class QueryBuilderPostFilterOperator_In
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
isCompatibleWithType(type: Type): boolean {
|
|
62
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(type);
|
|
61
63
|
return (
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
(normalizedType !== undefined &&
|
|
65
|
+
(
|
|
66
|
+
[
|
|
67
|
+
PRIMITIVE_TYPE.STRING,
|
|
68
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
69
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
70
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
71
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
72
|
+
] as string[]
|
|
73
|
+
).includes(normalizedType)) ||
|
|
71
74
|
// TODO: do we care if the enumeration type has no value (like in the case of `==` operator)?
|
|
72
75
|
type instanceof Enumeration
|
|
73
76
|
);
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type LambdaFunction,
|
|
22
22
|
Enumeration,
|
|
23
23
|
PrimitiveType,
|
|
24
|
+
PrecisePrimitiveType,
|
|
24
25
|
} from '@finos/legend-graph';
|
|
25
26
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
|
26
27
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterStateBuilder.js';
|
|
@@ -49,7 +50,11 @@ export class QueryBuilderPostFilterOperator_IsEmpty
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
isCompatibleWithType(type: Type): boolean {
|
|
52
|
-
return
|
|
53
|
+
return (
|
|
54
|
+
type instanceof PrimitiveType ||
|
|
55
|
+
type instanceof PrecisePrimitiveType ||
|
|
56
|
+
type instanceof Enumeration
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
isCompatibleWithConditionValue(
|
|
@@ -35,7 +35,10 @@ import type {
|
|
|
35
35
|
PostFilterConditionState,
|
|
36
36
|
QueryBuilderPostFilterState,
|
|
37
37
|
} from '../QueryBuilderPostFilterState.js';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getStandardPrimitiveTypeEquivalent,
|
|
40
|
+
isTypeCompatibleForAssignment,
|
|
41
|
+
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
39
42
|
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
40
43
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
|
41
44
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
|
@@ -50,17 +53,21 @@ export class QueryBuilderPostFilterOperator_LessThan
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
isCompatibleWithType(type: Type): boolean {
|
|
56
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(type);
|
|
53
57
|
return (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
normalizedType !== undefined &&
|
|
59
|
+
(
|
|
60
|
+
[
|
|
61
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
62
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
63
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
64
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
65
|
+
PRIMITIVE_TYPE.DATE,
|
|
66
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
67
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
68
|
+
] as string[]
|
|
69
|
+
).includes(normalizedType)
|
|
70
|
+
);
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
isCompatibleWithConditionValue(
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
type FunctionExpression,
|
|
22
22
|
type LambdaFunction,
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
|
-
PrimitiveType,
|
|
25
24
|
} from '@finos/legend-graph';
|
|
26
25
|
import {
|
|
27
26
|
type Hashable,
|
|
@@ -36,6 +35,7 @@ import type {
|
|
|
36
35
|
} from '../QueryBuilderPostFilterState.js';
|
|
37
36
|
import {
|
|
38
37
|
buildNotExpression,
|
|
38
|
+
getStandardPrimitiveTypeEquivalent,
|
|
39
39
|
unwrapNotExpression,
|
|
40
40
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
41
41
|
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -52,15 +52,17 @@ export class QueryBuilderPostFilterOperator_StartWith
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
isCompatibleWithType(type: Type): boolean {
|
|
55
|
-
return
|
|
55
|
+
return getStandardPrimitiveTypeEquivalent(type) === PRIMITIVE_TYPE.STRING;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
isCompatibleWithConditionValue(
|
|
59
59
|
postFilterConditionState: PostFilterConditionState,
|
|
60
60
|
): boolean {
|
|
61
|
+
const rhsType = postFilterConditionState.rightConditionValue.type;
|
|
61
62
|
return (
|
|
62
63
|
!postFilterConditionState.rightConditionValue.isCollection &&
|
|
63
|
-
|
|
64
|
+
rhsType !== undefined &&
|
|
65
|
+
getStandardPrimitiveTypeEquivalent(rhsType) === PRIMITIVE_TYPE.STRING
|
|
64
66
|
);
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
24
|
type ValueSpecification,
|
|
25
25
|
type SimpleFunctionExpression,
|
|
26
|
-
PrimitiveType,
|
|
27
26
|
} from '@finos/legend-graph';
|
|
28
27
|
import {
|
|
29
28
|
type Hashable,
|
|
@@ -36,6 +35,7 @@ import {
|
|
|
36
35
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
36
|
import {
|
|
38
37
|
buildNotExpression,
|
|
38
|
+
getStandardPrimitiveTypeEquivalent,
|
|
39
39
|
unwrapNotExpression,
|
|
40
40
|
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
41
41
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
@@ -54,9 +54,10 @@ export class QueryBuilderFilterOperator_Contain
|
|
|
54
54
|
filterConditionState: FilterConditionState,
|
|
55
55
|
): boolean {
|
|
56
56
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
getStandardPrimitiveTypeEquivalent(
|
|
58
|
+
filterConditionState.propertyExpressionState.propertyExpression.func
|
|
59
|
+
.value.genericType.value.rawType,
|
|
60
|
+
) === PRIMITIVE_TYPE.STRING
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -68,7 +69,10 @@ export class QueryBuilderFilterOperator_Contain
|
|
|
68
69
|
!filterConditionState.rightConditionValue.isCollection
|
|
69
70
|
? filterConditionState.rightConditionValue.type
|
|
70
71
|
: undefined;
|
|
71
|
-
return
|
|
72
|
+
return (
|
|
73
|
+
type !== undefined &&
|
|
74
|
+
getStandardPrimitiveTypeEquivalent(type) === PRIMITIVE_TYPE.STRING
|
|
75
|
+
);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
getDefaultFilterConditionValue(
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
24
|
type ValueSpecification,
|
|
25
25
|
type SimpleFunctionExpression,
|
|
26
|
-
PrimitiveType,
|
|
27
26
|
} from '@finos/legend-graph';
|
|
28
27
|
import {
|
|
29
28
|
type Hashable,
|
|
@@ -36,6 +35,7 @@ import {
|
|
|
36
35
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
36
|
import {
|
|
38
37
|
buildNotExpression,
|
|
38
|
+
getStandardPrimitiveTypeEquivalent,
|
|
39
39
|
unwrapNotExpression,
|
|
40
40
|
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
41
41
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
@@ -54,9 +54,10 @@ export class QueryBuilderFilterOperator_EndWith
|
|
|
54
54
|
filterConditionState: FilterConditionState,
|
|
55
55
|
): boolean {
|
|
56
56
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
getStandardPrimitiveTypeEquivalent(
|
|
58
|
+
filterConditionState.propertyExpressionState.propertyExpression.func
|
|
59
|
+
.value.genericType.value.rawType,
|
|
60
|
+
) === PRIMITIVE_TYPE.STRING
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -68,7 +69,10 @@ export class QueryBuilderFilterOperator_EndWith
|
|
|
68
69
|
!filterConditionState.rightConditionValue.isCollection
|
|
69
70
|
? filterConditionState.rightConditionValue.type
|
|
70
71
|
: undefined;
|
|
71
|
-
return
|
|
72
|
+
return (
|
|
73
|
+
type !== undefined &&
|
|
74
|
+
getStandardPrimitiveTypeEquivalent(type) === PRIMITIVE_TYPE.STRING
|
|
75
|
+
);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
getDefaultFilterConditionValue(
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
35
35
|
import {
|
|
36
36
|
buildNotExpression,
|
|
37
|
+
getStandardPrimitiveTypeEquivalent,
|
|
37
38
|
isTypeCompatibleForAssignment,
|
|
38
39
|
unwrapNotExpression,
|
|
39
40
|
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
@@ -54,20 +55,22 @@ export class QueryBuilderFilterOperator_Equal
|
|
|
54
55
|
const propertyType =
|
|
55
56
|
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
56
57
|
.genericType.value.rawType;
|
|
58
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
57
59
|
return (
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
(normalizedType !== undefined &&
|
|
61
|
+
(
|
|
62
|
+
[
|
|
63
|
+
PRIMITIVE_TYPE.STRING,
|
|
64
|
+
PRIMITIVE_TYPE.BOOLEAN,
|
|
65
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
66
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
67
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
68
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
69
|
+
PRIMITIVE_TYPE.DATE,
|
|
70
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
71
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
72
|
+
] as string[]
|
|
73
|
+
).includes(normalizedType)) ||
|
|
71
74
|
// if the type is enumeration, make sure the enumeration has some value
|
|
72
75
|
(propertyType instanceof Enumeration && propertyType.values.length > 0)
|
|
73
76
|
);
|
|
@@ -35,7 +35,10 @@ import {
|
|
|
35
35
|
buildFilterConditionExpression,
|
|
36
36
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getStandardPrimitiveTypeEquivalent,
|
|
40
|
+
isTypeCompatibleForAssignment,
|
|
41
|
+
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
39
42
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../QueryBuilderStateHashUtils.js';
|
|
40
43
|
import { buildDefaultInstanceValue } from '../../shared/ValueSpecificationEditorHelper.js';
|
|
41
44
|
|
|
@@ -53,17 +56,21 @@ export class QueryBuilderFilterOperator_GreaterThan
|
|
|
53
56
|
const propertyType =
|
|
54
57
|
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
55
58
|
.genericType.value.rawType;
|
|
59
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
56
60
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
normalizedType !== undefined &&
|
|
62
|
+
(
|
|
63
|
+
[
|
|
64
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
65
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
66
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
67
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
68
|
+
PRIMITIVE_TYPE.DATE,
|
|
69
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
70
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
71
|
+
] as string[]
|
|
72
|
+
).includes(normalizedType)
|
|
73
|
+
);
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
isCompatibleWithFilterConditionValue(
|
|
@@ -35,7 +35,10 @@ import {
|
|
|
35
35
|
buildFilterConditionExpression,
|
|
36
36
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getStandardPrimitiveTypeEquivalent,
|
|
40
|
+
isTypeCompatibleForAssignment,
|
|
41
|
+
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
39
42
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../QueryBuilderStateHashUtils.js';
|
|
40
43
|
import { buildDefaultInstanceValue } from '../../shared/ValueSpecificationEditorHelper.js';
|
|
41
44
|
|
|
@@ -53,17 +56,21 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
|
|
|
53
56
|
const propertyType =
|
|
54
57
|
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
55
58
|
.genericType.value.rawType;
|
|
59
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
56
60
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
normalizedType !== undefined &&
|
|
62
|
+
(
|
|
63
|
+
[
|
|
64
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
65
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
66
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
67
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
68
|
+
PRIMITIVE_TYPE.DATE,
|
|
69
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
70
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
71
|
+
] as string[]
|
|
72
|
+
).includes(normalizedType)
|
|
73
|
+
);
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
isCompatibleWithFilterConditionValue(
|
|
@@ -39,6 +39,7 @@ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMe
|
|
|
39
39
|
import {
|
|
40
40
|
buildNotExpression,
|
|
41
41
|
getCollectionValueSpecificationType,
|
|
42
|
+
getStandardPrimitiveTypeEquivalent,
|
|
42
43
|
unwrapNotExpression,
|
|
43
44
|
} from '../../QueryBuilderValueSpecificationHelper.js';
|
|
44
45
|
import { type Hashable, hashArray } from '@finos/legend-shared';
|
|
@@ -58,19 +59,21 @@ export class QueryBuilderFilterOperator_In
|
|
|
58
59
|
const propertyType =
|
|
59
60
|
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
60
61
|
.genericType.value.rawType;
|
|
62
|
+
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
61
63
|
return (
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
(normalizedType !== undefined &&
|
|
65
|
+
(
|
|
66
|
+
[
|
|
67
|
+
PRIMITIVE_TYPE.STRING,
|
|
68
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
69
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
70
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
71
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
72
|
+
PRIMITIVE_TYPE.DATE,
|
|
73
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
74
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
75
|
+
] as string[]
|
|
76
|
+
).includes(normalizedType)) ||
|
|
74
77
|
// TODO: do we care if the enumeration type has no value (like in the case of `==` operator)?
|
|
75
78
|
propertyType instanceof Enumeration
|
|
76
79
|
);
|
|
@@ -109,7 +112,10 @@ export class QueryBuilderFilterOperator_In
|
|
|
109
112
|
PRIMITIVE_TYPE.STRICTDATE,
|
|
110
113
|
PRIMITIVE_TYPE.DATETIME,
|
|
111
114
|
] as string[]
|
|
112
|
-
).includes(
|
|
115
|
+
).includes(
|
|
116
|
+
getStandardPrimitiveTypeEquivalent(propertyType) ??
|
|
117
|
+
propertyType.path,
|
|
118
|
+
)
|
|
113
119
|
) {
|
|
114
120
|
return (
|
|
115
121
|
[
|
|
@@ -121,7 +127,10 @@ export class QueryBuilderFilterOperator_In
|
|
|
121
127
|
PRIMITIVE_TYPE.STRICTDATE,
|
|
122
128
|
PRIMITIVE_TYPE.DATETIME,
|
|
123
129
|
] as string[]
|
|
124
|
-
).includes(
|
|
130
|
+
).includes(
|
|
131
|
+
getStandardPrimitiveTypeEquivalent(collectionType) ??
|
|
132
|
+
collectionType.path,
|
|
133
|
+
);
|
|
125
134
|
}
|
|
126
135
|
return collectionType === propertyType;
|
|
127
136
|
} else if (valueSpec instanceof VariableExpression) {
|