@finos/legend-application-query 5.0.0 → 5.1.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/components/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderExplorerPanel.js +3 -1
- package/lib/components/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFetchStructurePanel.js +39 -7
- package/lib/components/QueryBuilderFetchStructurePanel.js.map +1 -1
- package/lib/components/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFilterPanel.js +59 -15
- package/lib/components/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
- package/lib/components/QueryBuilderParameterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParameterPanel.js +3 -2
- package/lib/components/QueryBuilderParameterPanel.js.map +1 -1
- package/lib/components/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderPostFilterPanel.js +29 -7
- package/lib/components/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/QueryBuilderProjectionPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderProjectionPanel.js +6 -2
- package/lib/components/QueryBuilderProjectionPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderPropertySearchPanel.js +3 -2
- package/lib/components/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +13 -7
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/QueryBuilderSetupPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderSetupPanel.js +5 -3
- package/lib/components/QueryBuilderSetupPanel.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +2 -3
- package/lib/stores/QueryBuilderExplorerState.d.ts +1 -1
- package/lib/stores/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderExplorerState.js +13 -3
- package/lib/stores/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/QueryBuilderFetchStructureState.d.ts +2 -1
- package/lib/stores/QueryBuilderFetchStructureState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderFetchStructureState.js +2 -2
- package/lib/stores/QueryBuilderFetchStructureState.js.map +1 -1
- package/lib/stores/QueryBuilderFilterState.d.ts +11 -1
- package/lib/stores/QueryBuilderFilterState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderFilterState.js +33 -2
- package/lib/stores/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/QueryBuilderOperatorLoader.d.ts +47 -0
- package/lib/stores/QueryBuilderOperatorLoader.d.ts.map +1 -0
- package/lib/stores/QueryBuilderOperatorLoader.js +94 -0
- package/lib/stores/QueryBuilderOperatorLoader.js.map +1 -0
- package/lib/stores/QueryBuilderOperatorsHelper.d.ts +1 -0
- package/lib/stores/QueryBuilderOperatorsHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderOperatorsHelper.js +28 -1
- package/lib/stores/QueryBuilderOperatorsHelper.js.map +1 -1
- package/lib/stores/QueryBuilderPostFilterState.d.ts +5 -2
- package/lib/stores/QueryBuilderPostFilterState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPostFilterState.js +25 -1
- package/lib/stores/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/QueryBuilderPreviewDataHelper.d.ts +4 -3
- package/lib/stores/QueryBuilderPreviewDataHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPreviewDataHelper.js +77 -97
- package/lib/stores/QueryBuilderPreviewDataHelper.js.map +1 -1
- package/lib/stores/QueryBuilderProjectionState.d.ts +4 -2
- package/lib/stores/QueryBuilderProjectionState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderProjectionState.js +24 -28
- package/lib/stores/QueryBuilderProjectionState.js.map +1 -1
- package/lib/stores/QueryBuilderPropertySearchPanelState.js +1 -1
- package/lib/stores/QueryBuilderPropertySearchPanelState.js.map +1 -1
- package/lib/stores/QueryBuilderResultState.d.ts +5 -2
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +19 -7
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts +2 -0
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +11 -58
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderTestUtils.d.ts +24 -0
- package/lib/stores/QueryBuilderTestUtils.d.ts.map +1 -0
- package/lib/stores/QueryBuilderTestUtils.js +49 -0
- package/lib/stores/QueryBuilderTestUtils.js.map +1 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts +24 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.js +89 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -0
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +3 -7
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.js +5 -31
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.js +5 -31
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.js +5 -31
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.js +5 -32
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.js +5 -31
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.js +3 -29
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.js +4 -30
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.js +4 -30
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
- package/package.json +9 -10
- package/src/components/QueryBuilderExplorerPanel.tsx +3 -1
- package/src/components/QueryBuilderFetchStructurePanel.tsx +47 -7
- package/src/components/QueryBuilderFilterPanel.tsx +101 -21
- package/src/components/QueryBuilderFunctionsExplorerPanel.tsx +1 -0
- package/src/components/QueryBuilderParameterPanel.tsx +3 -2
- package/src/components/QueryBuilderPostFilterPanel.tsx +53 -7
- package/src/components/QueryBuilderProjectionPanel.tsx +19 -2
- package/src/components/QueryBuilderPropertySearchPanel.tsx +2 -1
- package/src/components/QueryBuilderResultPanel.tsx +75 -46
- package/src/components/QueryBuilderSetupPanel.tsx +5 -3
- package/src/index.ts +2 -4
- package/src/stores/QueryBuilderExplorerState.ts +17 -3
- package/src/stores/QueryBuilderFetchStructureState.ts +9 -2
- package/src/stores/QueryBuilderFilterState.ts +50 -0
- package/src/stores/QueryBuilderOperatorLoader.ts +133 -0
- package/src/stores/QueryBuilderOperatorsHelper.ts +35 -0
- package/src/stores/QueryBuilderPostFilterState.ts +40 -1
- package/src/stores/QueryBuilderPreviewDataHelper.ts +122 -217
- package/src/stores/QueryBuilderProjectionState.ts +40 -42
- package/src/stores/QueryBuilderPropertySearchPanelState.ts +1 -1
- package/src/stores/QueryBuilderResultState.ts +27 -9
- package/src/stores/QueryBuilderState.ts +27 -94
- package/src/stores/QueryBuilderTestUtils.ts +93 -0
- package/src/stores/QueryBuilderTypeaheadHelper.ts +149 -0
- package/src/stores/QueryEditorStore.ts +11 -12
- package/src/stores/filterOperators/QueryBuilderFilterOperator_Equal.ts +6 -35
- package/src/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.ts +9 -35
- package/src/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.ts +9 -35
- package/src/stores/filterOperators/QueryBuilderFilterOperator_LessThan.ts +9 -36
- package/src/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.ts +9 -35
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.ts +6 -33
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.ts +11 -36
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.ts +11 -36
- package/tsconfig.json +3 -0
@@ -31,7 +31,6 @@ import {
|
|
31
31
|
EnumValueExplicitReference,
|
32
32
|
Enumeration,
|
33
33
|
PRIMITIVE_TYPE,
|
34
|
-
isSuperType,
|
35
34
|
SUPPORTED_FUNCTIONS,
|
36
35
|
buildPrimitiveInstanceValue,
|
37
36
|
} from '@finos/legend-graph';
|
@@ -46,6 +45,7 @@ import {
|
|
46
45
|
buildNotExpression,
|
47
46
|
unwrapNotExpression,
|
48
47
|
getNonCollectionValueSpecificationType,
|
48
|
+
isTypeCompatibleWithConditionValueType,
|
49
49
|
} from '../QueryBuilderOperatorsHelper.js';
|
50
50
|
|
51
51
|
export class QueryBuilderFilterOperator_Equal extends QueryBuilderFilterOperator {
|
@@ -81,41 +81,12 @@ export class QueryBuilderFilterOperator_Equal extends QueryBuilderFilterOperator
|
|
81
81
|
isCompatibleWithFilterConditionValue(
|
82
82
|
filterConditionState: FilterConditionState,
|
83
83
|
): boolean {
|
84
|
-
|
84
|
+
return isTypeCompatibleWithConditionValueType(
|
85
|
+
filterConditionState.value
|
86
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
87
|
+
: undefined,
|
85
88
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
86
|
-
.genericType.value.rawType
|
87
|
-
const type = filterConditionState.value
|
88
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
89
|
-
: undefined;
|
90
|
-
|
91
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
92
|
-
PRIMITIVE_TYPE.NUMBER,
|
93
|
-
PRIMITIVE_TYPE.INTEGER,
|
94
|
-
PRIMITIVE_TYPE.DECIMAL,
|
95
|
-
PRIMITIVE_TYPE.FLOAT,
|
96
|
-
] as string[];
|
97
|
-
|
98
|
-
const DATE_PRIMITIVE_TYPES = [
|
99
|
-
PRIMITIVE_TYPE.DATE,
|
100
|
-
PRIMITIVE_TYPE.DATETIME,
|
101
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
102
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
103
|
-
] as string[];
|
104
|
-
|
105
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
106
|
-
return (
|
107
|
-
type !== undefined &&
|
108
|
-
// Numeric value is handled loosely because of autoboxing
|
109
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
110
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
111
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
112
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
113
|
-
// This is because we would simulate auto-boxing for date by altering the
|
114
|
-
// Pure function used for the operation
|
115
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
116
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
117
|
-
type === propertyType ||
|
118
|
-
isSuperType(propertyType, type))
|
89
|
+
.genericType.value.rawType,
|
119
90
|
);
|
120
91
|
}
|
121
92
|
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type SimpleFunctionExpression,
|
25
25
|
type AbstractPropertyExpression,
|
26
26
|
PRIMITIVE_TYPE,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOp
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFil
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,41 +66,12 @@ export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOpera
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
(propertyType.path === PRIMITIVE_TYPE.DATETIME &&
|
99
|
-
DATE_PRIMITIVE_TYPES.includes(type.path)) ||
|
100
|
-
type === propertyType ||
|
101
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
102
75
|
);
|
103
76
|
}
|
104
77
|
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilter
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -28,7 +28,6 @@ import {
|
|
28
28
|
GenericTypeExplicitReference,
|
29
29
|
PRIMITIVE_TYPE,
|
30
30
|
TYPICAL_MULTIPLICITY_TYPE,
|
31
|
-
isSuperType,
|
32
31
|
SUPPORTED_FUNCTIONS,
|
33
32
|
buildPrimitiveInstanceValue,
|
34
33
|
} from '@finos/legend-graph';
|
@@ -40,6 +39,7 @@ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
|
40
39
|
import {
|
41
40
|
buildNotExpression,
|
42
41
|
getNonCollectionValueSpecificationType,
|
42
|
+
isTypeCompatibleWithConditionValueType,
|
43
43
|
unwrapNotExpression,
|
44
44
|
} from '../QueryBuilderOperatorsHelper.js';
|
45
45
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
@@ -79,40 +79,13 @@ export class QueryBuilderPostFilterOperator_Equal extends QueryBuilderPostFilter
|
|
79
79
|
isCompatibleWithConditionValue(
|
80
80
|
postFilterConditionState: PostFilterConditionState,
|
81
81
|
): boolean {
|
82
|
-
const lhsType = guaranteeNonNullable(
|
83
|
-
postFilterConditionState.columnState.getReturnType(),
|
84
|
-
);
|
85
82
|
const valueSpecification = postFilterConditionState.value;
|
86
83
|
if (valueSpecification) {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
PRIMITIVE_TYPE.FLOAT,
|
93
|
-
] as string[];
|
94
|
-
|
95
|
-
const DATE_PRIMITIVE_TYPES = [
|
96
|
-
PRIMITIVE_TYPE.DATE,
|
97
|
-
PRIMITIVE_TYPE.DATETIME,
|
98
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
99
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
100
|
-
] as string[];
|
101
|
-
|
102
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
103
|
-
return (
|
104
|
-
type !== undefined &&
|
105
|
-
// Numeric value is handled loosely because of autoboxing
|
106
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
107
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
108
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
109
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
110
|
-
// This is because we would simulate auto-boxing for date by altering the
|
111
|
-
// Pure function used for the operation
|
112
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
113
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
114
|
-
type === lhsType ||
|
115
|
-
isSuperType(lhsType, type))
|
84
|
+
return isTypeCompatibleWithConditionValueType(
|
85
|
+
getNonCollectionValueSpecificationType(valueSpecification),
|
86
|
+
guaranteeNonNullable(
|
87
|
+
postFilterConditionState.columnState.getReturnType(),
|
88
|
+
),
|
116
89
|
);
|
117
90
|
}
|
118
91
|
return false;
|
@@ -20,7 +20,6 @@ import {
|
|
20
20
|
type FunctionExpression,
|
21
21
|
AbstractPropertyExpression,
|
22
22
|
PRIMITIVE_TYPE,
|
23
|
-
isSuperType,
|
24
23
|
SUPPORTED_FUNCTIONS,
|
25
24
|
buildPrimitiveInstanceValue,
|
26
25
|
} from '@finos/legend-graph';
|
@@ -29,7 +28,10 @@ import {
|
|
29
28
|
UnsupportedOperationError,
|
30
29
|
} from '@finos/legend-shared';
|
31
30
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
32
|
-
import {
|
31
|
+
import {
|
32
|
+
getNonCollectionValueSpecificationType,
|
33
|
+
isTypeCompatibleWithConditionValueType,
|
34
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
33
35
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
34
36
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterProcessor.js';
|
35
37
|
import type {
|
@@ -61,40 +63,13 @@ export class QueryBuilderPostFilterOperator_GreaterThan extends QueryBuilderPost
|
|
61
63
|
isCompatibleWithConditionValue(
|
62
64
|
postFilterConditionState: PostFilterConditionState,
|
63
65
|
): boolean {
|
64
|
-
|
65
|
-
postFilterConditionState.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
PRIMITIVE_TYPE.NUMBER,
|
72
|
-
PRIMITIVE_TYPE.INTEGER,
|
73
|
-
PRIMITIVE_TYPE.DECIMAL,
|
74
|
-
PRIMITIVE_TYPE.FLOAT,
|
75
|
-
] as string[];
|
76
|
-
|
77
|
-
const DATE_PRIMITIVE_TYPES = [
|
78
|
-
PRIMITIVE_TYPE.DATE,
|
79
|
-
PRIMITIVE_TYPE.DATETIME,
|
80
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
81
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
82
|
-
] as string[];
|
83
|
-
|
84
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
85
|
-
return (
|
86
|
-
type !== undefined &&
|
87
|
-
// Numeric value is handled loosely because of autoboxing
|
88
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
89
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
90
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
91
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
92
|
-
// This is because we would simulate auto-boxing for date by altering the
|
93
|
-
// Pure function used for the operation
|
94
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
95
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
96
|
-
type === lhsType ||
|
97
|
-
isSuperType(lhsType, type))
|
66
|
+
return isTypeCompatibleWithConditionValueType(
|
67
|
+
postFilterConditionState.value
|
68
|
+
? getNonCollectionValueSpecificationType(postFilterConditionState.value)
|
69
|
+
: undefined,
|
70
|
+
guaranteeNonNullable(
|
71
|
+
postFilterConditionState.columnState.getReturnType(),
|
72
|
+
),
|
98
73
|
);
|
99
74
|
}
|
100
75
|
|
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
type FunctionExpression,
|
22
22
|
PRIMITIVE_TYPE,
|
23
23
|
SUPPORTED_FUNCTIONS,
|
24
|
-
isSuperType,
|
25
24
|
buildPrimitiveInstanceValue,
|
26
25
|
} from '@finos/legend-graph';
|
27
26
|
import {
|
@@ -29,7 +28,10 @@ import {
|
|
29
28
|
UnsupportedOperationError,
|
30
29
|
} from '@finos/legend-shared';
|
31
30
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
32
|
-
import {
|
31
|
+
import {
|
32
|
+
getNonCollectionValueSpecificationType,
|
33
|
+
isTypeCompatibleWithConditionValueType,
|
34
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
33
35
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
34
36
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterProcessor.js';
|
35
37
|
import type {
|
@@ -61,40 +63,13 @@ export class QueryBuilderPostFilterOperator_LessThan extends QueryBuilderPostFil
|
|
61
63
|
isCompatibleWithConditionValue(
|
62
64
|
postFilterConditionState: PostFilterConditionState,
|
63
65
|
): boolean {
|
64
|
-
|
65
|
-
postFilterConditionState.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
PRIMITIVE_TYPE.NUMBER,
|
72
|
-
PRIMITIVE_TYPE.INTEGER,
|
73
|
-
PRIMITIVE_TYPE.DECIMAL,
|
74
|
-
PRIMITIVE_TYPE.FLOAT,
|
75
|
-
] as string[];
|
76
|
-
|
77
|
-
const DATE_PRIMITIVE_TYPES = [
|
78
|
-
PRIMITIVE_TYPE.DATE,
|
79
|
-
PRIMITIVE_TYPE.DATETIME,
|
80
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
81
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
82
|
-
] as string[];
|
83
|
-
|
84
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
85
|
-
return (
|
86
|
-
type !== undefined &&
|
87
|
-
// Numeric value is handled loosely because of autoboxing
|
88
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
89
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
90
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
91
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
92
|
-
// This is because we would simulate auto-boxing for date by altering the
|
93
|
-
// Pure function used for the operation
|
94
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
95
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
96
|
-
type === lhsType ||
|
97
|
-
isSuperType(lhsType, type))
|
66
|
+
return isTypeCompatibleWithConditionValueType(
|
67
|
+
postFilterConditionState.value
|
68
|
+
? getNonCollectionValueSpecificationType(postFilterConditionState.value)
|
69
|
+
: undefined,
|
70
|
+
guaranteeNonNullable(
|
71
|
+
postFilterConditionState.columnState.getReturnType(),
|
72
|
+
),
|
98
73
|
);
|
99
74
|
}
|
100
75
|
|
package/tsconfig.json
CHANGED
@@ -61,6 +61,7 @@
|
|
61
61
|
"./src/stores/QueryBuilderGraphFetchTreeUtil.ts",
|
62
62
|
"./src/stores/QueryBuilderLambdaBuilder.ts",
|
63
63
|
"./src/stores/QueryBuilderLambdaProcessor.ts",
|
64
|
+
"./src/stores/QueryBuilderOperatorLoader.ts",
|
64
65
|
"./src/stores/QueryBuilderOperatorsHelper.ts",
|
65
66
|
"./src/stores/QueryBuilderPostFilterOperator.ts",
|
66
67
|
"./src/stores/QueryBuilderPostFilterProcessor.ts",
|
@@ -72,6 +73,8 @@
|
|
72
73
|
"./src/stores/QueryBuilderResultState.ts",
|
73
74
|
"./src/stores/QueryBuilderSetupState.ts",
|
74
75
|
"./src/stores/QueryBuilderState.ts",
|
76
|
+
"./src/stores/QueryBuilderTestUtils.ts",
|
77
|
+
"./src/stores/QueryBuilderTypeaheadHelper.ts",
|
75
78
|
"./src/stores/QueryBuilderUnsupportedState.ts",
|
76
79
|
"./src/stores/QueryBuilderValueSpecificationBuilderHelper.ts",
|
77
80
|
"./src/stores/QueryEditorStore.ts",
|