@finos/legend-query-builder 4.9.3 → 4.10.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/__lib__/QueryBuilderTesting.d.ts +3 -1
- package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
- package/lib/__lib__/QueryBuilderTesting.js +4 -1
- package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +36 -33
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +1 -0
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +13 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +2 -2
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +42 -24
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +5 -6
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts +5 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.js +14 -1
- package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.d.ts +2 -0
- package/lib/stores/QueryBuilderStateHashUtils.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.js +2 -0
- package/lib/stores/QueryBuilderStateHashUtils.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js +3 -23
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +26 -8
- package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +6 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
- package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.js.map +1 -1
- package/lib/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.js +5 -4
- package/lib/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.js +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +31 -5
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +125 -30
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +21 -8
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts +3 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +20 -17
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.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 +4 -6
- 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 +4 -6
- 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 +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 +10 -10
- 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 +10 -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_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.d.ts +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 +32 -27
- 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 +10 -5
- 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 +10 -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_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.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 +4 -6
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +17 -3
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
- package/package.json +5 -5
- package/src/__lib__/QueryBuilderTesting.ts +4 -1
- package/src/components/QueryBuilderResultPanel.tsx +64 -59
- package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +25 -1
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +102 -49
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +24 -17
- package/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +3 -4
- package/src/stores/QueryBuilderConstantsState.ts +30 -0
- package/src/stores/QueryBuilderStateHashUtils.ts +2 -0
- package/src/stores/QueryBuilderValueSpecificationBuilder.ts +4 -50
- package/src/stores/explorer/QueryBuilderExplorerState.ts +43 -13
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +10 -0
- package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.ts +2 -3
- package/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.ts +7 -6
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.ts +1 -1
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +180 -34
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +38 -9
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +36 -20
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +5 -6
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +6 -6
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +12 -13
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +10 -9
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +5 -4
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +48 -43
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +12 -4
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +10 -9
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +5 -4
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +6 -6
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +26 -4
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type FunctionExpression,
|
|
21
21
|
AbstractPropertyExpression,
|
|
22
22
|
PRIMITIVE_TYPE,
|
|
23
|
+
PrimitiveType,
|
|
23
24
|
} from '@finos/legend-graph';
|
|
24
25
|
import {
|
|
25
26
|
guaranteeNonNullable,
|
|
@@ -35,7 +36,6 @@ import type {
|
|
|
35
36
|
} from '../QueryBuilderPostFilterState.js';
|
|
36
37
|
import {
|
|
37
38
|
generateDefaultValueForPrimitiveType,
|
|
38
|
-
getNonCollectionValueSpecificationType,
|
|
39
39
|
isTypeCompatibleForAssignment,
|
|
40
40
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
41
41
|
import { buildPostFilterConditionExpression } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -69,11 +69,11 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
|
69
69
|
postFilterConditionState: PostFilterConditionState,
|
|
70
70
|
): boolean {
|
|
71
71
|
return isTypeCompatibleForAssignment(
|
|
72
|
-
postFilterConditionState.
|
|
73
|
-
?
|
|
72
|
+
!postFilterConditionState.rightConditionValue.isCollection
|
|
73
|
+
? postFilterConditionState.rightConditionValue.type
|
|
74
74
|
: undefined,
|
|
75
75
|
guaranteeNonNullable(
|
|
76
|
-
postFilterConditionState.
|
|
76
|
+
postFilterConditionState.leftConditionValue.getColumnType(),
|
|
77
77
|
),
|
|
78
78
|
);
|
|
79
79
|
}
|
|
@@ -81,7 +81,8 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
|
81
81
|
getDefaultFilterConditionValue(
|
|
82
82
|
postFilterConditionState: PostFilterConditionState,
|
|
83
83
|
): ValueSpecification {
|
|
84
|
-
const propertyType =
|
|
84
|
+
const propertyType =
|
|
85
|
+
postFilterConditionState.leftConditionValue.getColumnType();
|
|
85
86
|
switch (propertyType?.path) {
|
|
86
87
|
case PRIMITIVE_TYPE.NUMBER:
|
|
87
88
|
case PRIMITIVE_TYPE.DECIMAL:
|
|
@@ -121,10 +122,10 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
|
121
122
|
return buildPostFilterConditionExpression(
|
|
122
123
|
postFilterConditionState,
|
|
123
124
|
this,
|
|
124
|
-
postFilterConditionState.
|
|
125
|
-
|
|
126
|
-
postFilterConditionState.
|
|
127
|
-
|
|
125
|
+
postFilterConditionState.leftConditionValue.getColumnType() ===
|
|
126
|
+
PrimitiveType.DATETIME &&
|
|
127
|
+
postFilterConditionState.rightConditionValue.type !==
|
|
128
|
+
PrimitiveType.DATETIME
|
|
128
129
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_AFTER_DAY
|
|
129
130
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.GREATER_THAN,
|
|
130
131
|
);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type ValueSpecification,
|
|
20
20
|
AbstractPropertyExpression,
|
|
21
21
|
PRIMITIVE_TYPE,
|
|
22
|
+
PrimitiveType,
|
|
22
23
|
} from '@finos/legend-graph';
|
|
23
24
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterStateBuilder.js';
|
|
24
25
|
import type {
|
|
@@ -42,10 +43,10 @@ export class QueryBuilderPostFilterOperator_GreaterThanEqual extends QueryBuilde
|
|
|
42
43
|
return buildPostFilterConditionExpression(
|
|
43
44
|
postFilterConditionState,
|
|
44
45
|
this,
|
|
45
|
-
postFilterConditionState.
|
|
46
|
-
|
|
47
|
-
postFilterConditionState.
|
|
48
|
-
|
|
46
|
+
postFilterConditionState.leftConditionValue.getColumnType() ===
|
|
47
|
+
PrimitiveType.DATETIME &&
|
|
48
|
+
postFilterConditionState.rightConditionValue.type !==
|
|
49
|
+
PrimitiveType.DATETIME
|
|
49
50
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_AFTER_DAY
|
|
50
51
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.GREATER_THAN_EQUAL,
|
|
51
52
|
);
|
package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts
CHANGED
|
@@ -34,9 +34,10 @@ import {
|
|
|
34
34
|
} from '@finos/legend-shared';
|
|
35
35
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
|
36
36
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterStateBuilder.js';
|
|
37
|
-
import
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
import {
|
|
38
|
+
PostFilterValueSpecConditionValueState,
|
|
39
|
+
type PostFilterConditionState,
|
|
40
|
+
type QueryBuilderPostFilterState,
|
|
40
41
|
} from '../QueryBuilderPostFilterState.js';
|
|
41
42
|
import { buildPostFilterConditionExpression } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
42
43
|
import {
|
|
@@ -75,47 +76,51 @@ export class QueryBuilderPostFilterOperator_In
|
|
|
75
76
|
postFilterConditionState: PostFilterConditionState,
|
|
76
77
|
): boolean {
|
|
77
78
|
const propertyType = guaranteeNonNullable(
|
|
78
|
-
postFilterConditionState.
|
|
79
|
+
postFilterConditionState.leftConditionValue.getColumnType(),
|
|
79
80
|
);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
81
|
+
const rightSide = postFilterConditionState.rightConditionValue;
|
|
82
|
+
// `in`/`not in` doest not support right hand value being column state as the multipliticy for columns are [0..1]
|
|
83
|
+
if (rightSide instanceof PostFilterValueSpecConditionValueState) {
|
|
84
|
+
const valueSpec = rightSide.value;
|
|
85
|
+
if (valueSpec instanceof CollectionInstanceValue) {
|
|
86
|
+
if (valueSpec.values.length === 0) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
const collectionType = getCollectionValueSpecificationType(
|
|
90
|
+
postFilterConditionState.postFilterState.tdsState.queryBuilderState
|
|
91
|
+
.graphManagerState.graph,
|
|
92
|
+
valueSpec.values,
|
|
93
|
+
);
|
|
94
|
+
if (!collectionType) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (
|
|
98
|
+
(
|
|
99
|
+
[
|
|
100
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
101
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
102
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
103
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
104
|
+
] as string[]
|
|
105
|
+
).includes(propertyType.path)
|
|
106
|
+
) {
|
|
107
|
+
return (
|
|
108
|
+
[
|
|
109
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
110
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
111
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
112
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
113
|
+
] as string[]
|
|
114
|
+
).includes(collectionType.path);
|
|
115
|
+
}
|
|
116
|
+
return collectionType === propertyType;
|
|
117
|
+
} else if (valueSpec instanceof VariableExpression) {
|
|
118
|
+
// check if not a single value
|
|
119
|
+
if (valueSpec.multiplicity.upperBound === 1) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return propertyType === valueSpec.genericType?.value.rawType;
|
|
117
123
|
}
|
|
118
|
-
return propertyType === valueSpec.genericType?.value.rawType;
|
|
119
124
|
}
|
|
120
125
|
return false;
|
|
121
126
|
}
|
|
@@ -124,7 +129,7 @@ export class QueryBuilderPostFilterOperator_In
|
|
|
124
129
|
postFilterConditionState: PostFilterConditionState,
|
|
125
130
|
): ValueSpecification {
|
|
126
131
|
const propertyType = guaranteeNonNullable(
|
|
127
|
-
postFilterConditionState.
|
|
132
|
+
postFilterConditionState.leftConditionValue.getColumnType(),
|
|
128
133
|
);
|
|
129
134
|
return new CollectionInstanceValue(
|
|
130
135
|
Multiplicity.ONE,
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type PostFilterConditionState,
|
|
28
28
|
type QueryBuilderPostFilterState,
|
|
29
29
|
TDS_COLUMN_GETTER,
|
|
30
|
+
PostFilterValueSpecConditionValueState,
|
|
30
31
|
} from '../QueryBuilderPostFilterState.js';
|
|
31
32
|
import { QueryBuilderSimpleProjectionColumnState } from '../../projection/QueryBuilderProjectionColumnState.js';
|
|
32
33
|
import { buildPostFilterConditionExpression } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -53,20 +54,27 @@ export class QueryBuilderPostFilterOperator_IsEmpty
|
|
|
53
54
|
isCompatibleWithConditionValue(
|
|
54
55
|
postFilterConditionState: PostFilterConditionState,
|
|
55
56
|
): boolean {
|
|
56
|
-
|
|
57
|
+
if (
|
|
58
|
+
postFilterConditionState.rightConditionValue instanceof
|
|
59
|
+
PostFilterValueSpecConditionValueState &&
|
|
60
|
+
postFilterConditionState.rightConditionValue.value === undefined
|
|
61
|
+
) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
override isCompatibleWithPostFilterColumn(
|
|
60
68
|
postFilterState: PostFilterConditionState,
|
|
61
69
|
): boolean {
|
|
62
|
-
const columnType = postFilterState.
|
|
70
|
+
const columnType = postFilterState.leftConditionValue.getColumnType();
|
|
63
71
|
if (columnType && this.isCompatibleWithType(columnType)) {
|
|
64
72
|
if (
|
|
65
|
-
postFilterState.
|
|
73
|
+
postFilterState.leftConditionValue instanceof
|
|
66
74
|
QueryBuilderSimpleProjectionColumnState
|
|
67
75
|
) {
|
|
68
76
|
return isPropertyExpressionChainOptional(
|
|
69
|
-
postFilterState.
|
|
77
|
+
postFilterState.leftConditionValue.propertyExpressionState
|
|
70
78
|
.propertyExpression,
|
|
71
79
|
);
|
|
72
80
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
AbstractPropertyExpression,
|
|
21
21
|
type FunctionExpression,
|
|
22
22
|
PRIMITIVE_TYPE,
|
|
23
|
+
PrimitiveType,
|
|
23
24
|
} from '@finos/legend-graph';
|
|
24
25
|
import {
|
|
25
26
|
guaranteeNonNullable,
|
|
@@ -35,7 +36,6 @@ import type {
|
|
|
35
36
|
} from '../QueryBuilderPostFilterState.js';
|
|
36
37
|
import {
|
|
37
38
|
generateDefaultValueForPrimitiveType,
|
|
38
|
-
getNonCollectionValueSpecificationType,
|
|
39
39
|
isTypeCompatibleForAssignment,
|
|
40
40
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
41
41
|
import { buildPostFilterConditionExpression } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -69,11 +69,11 @@ export class QueryBuilderPostFilterOperator_LessThan
|
|
|
69
69
|
postFilterConditionState: PostFilterConditionState,
|
|
70
70
|
): boolean {
|
|
71
71
|
return isTypeCompatibleForAssignment(
|
|
72
|
-
postFilterConditionState.
|
|
73
|
-
?
|
|
72
|
+
!postFilterConditionState.rightConditionValue.isCollection
|
|
73
|
+
? postFilterConditionState.rightConditionValue.type
|
|
74
74
|
: undefined,
|
|
75
75
|
guaranteeNonNullable(
|
|
76
|
-
postFilterConditionState.
|
|
76
|
+
postFilterConditionState.leftConditionValue.getColumnType(),
|
|
77
77
|
),
|
|
78
78
|
);
|
|
79
79
|
}
|
|
@@ -81,7 +81,8 @@ export class QueryBuilderPostFilterOperator_LessThan
|
|
|
81
81
|
getDefaultFilterConditionValue(
|
|
82
82
|
postFilterConditionState: PostFilterConditionState,
|
|
83
83
|
): ValueSpecification {
|
|
84
|
-
const propertyType =
|
|
84
|
+
const propertyType =
|
|
85
|
+
postFilterConditionState.leftConditionValue.getColumnType();
|
|
85
86
|
switch (propertyType?.path) {
|
|
86
87
|
case PRIMITIVE_TYPE.NUMBER:
|
|
87
88
|
case PRIMITIVE_TYPE.DECIMAL:
|
|
@@ -121,10 +122,10 @@ export class QueryBuilderPostFilterOperator_LessThan
|
|
|
121
122
|
return buildPostFilterConditionExpression(
|
|
122
123
|
postFilterConditionState,
|
|
123
124
|
this,
|
|
124
|
-
postFilterConditionState.
|
|
125
|
-
|
|
126
|
-
postFilterConditionState.
|
|
127
|
-
|
|
125
|
+
postFilterConditionState.leftConditionValue.getColumnType() ===
|
|
126
|
+
PrimitiveType.DATETIME &&
|
|
127
|
+
postFilterConditionState.rightConditionValue.type !==
|
|
128
|
+
PrimitiveType.DATETIME
|
|
128
129
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_BEFORE_DAY
|
|
129
130
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.LESS_THAN,
|
|
130
131
|
);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type ValueSpecification,
|
|
20
20
|
AbstractPropertyExpression,
|
|
21
21
|
PRIMITIVE_TYPE,
|
|
22
|
+
PrimitiveType,
|
|
22
23
|
} from '@finos/legend-graph';
|
|
23
24
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterStateBuilder.js';
|
|
24
25
|
import type {
|
|
@@ -45,10 +46,10 @@ export class QueryBuilderPostFilterOperator_LessThanEqual
|
|
|
45
46
|
return buildPostFilterConditionExpression(
|
|
46
47
|
postFilterConditionState,
|
|
47
48
|
this,
|
|
48
|
-
postFilterConditionState.
|
|
49
|
-
|
|
50
|
-
postFilterConditionState.
|
|
51
|
-
|
|
49
|
+
postFilterConditionState.leftConditionValue.getColumnType() ===
|
|
50
|
+
PrimitiveType.DATETIME &&
|
|
51
|
+
postFilterConditionState.rightConditionValue.type !==
|
|
52
|
+
PrimitiveType.DATETIME
|
|
52
53
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_BEFORE_DAY
|
|
53
54
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.LESS_THAN_EQUAL,
|
|
54
55
|
);
|
|
@@ -36,7 +36,6 @@ import type {
|
|
|
36
36
|
import {
|
|
37
37
|
buildNotExpression,
|
|
38
38
|
generateDefaultValueForPrimitiveType,
|
|
39
|
-
getNonCollectionValueSpecificationType,
|
|
40
39
|
unwrapNotExpression,
|
|
41
40
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
|
42
41
|
import { buildPostFilterConditionExpression } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
|
@@ -59,16 +58,17 @@ export class QueryBuilderPostFilterOperator_StartWith
|
|
|
59
58
|
isCompatibleWithConditionValue(
|
|
60
59
|
postFilterConditionState: PostFilterConditionState,
|
|
61
60
|
): boolean {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
return (
|
|
62
|
+
!postFilterConditionState.rightConditionValue.isCollection &&
|
|
63
|
+
PrimitiveType.STRING === postFilterConditionState.rightConditionValue.type
|
|
64
|
+
);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
getDefaultFilterConditionValue(
|
|
69
68
|
postFilterConditionState: PostFilterConditionState,
|
|
70
69
|
): ValueSpecification {
|
|
71
|
-
const propertyType =
|
|
70
|
+
const propertyType =
|
|
71
|
+
postFilterConditionState.leftConditionValue.getColumnType();
|
|
72
72
|
switch (propertyType?.path) {
|
|
73
73
|
case PRIMITIVE_TYPE.STRING: {
|
|
74
74
|
return buildPrimitiveInstanceValue(
|
|
@@ -372,20 +372,42 @@ export class QueryBuilderDerivationProjectionColumnState
|
|
|
372
372
|
const variable = projectionParameter[0] as VariableExpression;
|
|
373
373
|
assertNonEmptyString(variable.name);
|
|
374
374
|
// assign variable to query class
|
|
375
|
+
const queryBuilderState = this.tdsState.queryBuilderState;
|
|
375
376
|
const rawVariableExpression = new RawVariableExpression(
|
|
376
377
|
variable.name,
|
|
377
378
|
Multiplicity.ONE,
|
|
378
379
|
PackageableElementExplicitReference.create(
|
|
379
|
-
guaranteeNonNullable(
|
|
380
|
+
guaranteeNonNullable(queryBuilderState.class),
|
|
380
381
|
),
|
|
381
382
|
);
|
|
382
383
|
const _rawVariableExpression =
|
|
383
|
-
|
|
384
|
+
queryBuilderState.graphManagerState.graphManager.serializeRawValueSpecification(
|
|
384
385
|
rawVariableExpression,
|
|
385
386
|
);
|
|
387
|
+
const parameters = queryBuilderState.parametersState.parameterStates.map(
|
|
388
|
+
(_param) =>
|
|
389
|
+
queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(
|
|
390
|
+
_param.parameter,
|
|
391
|
+
),
|
|
392
|
+
);
|
|
393
|
+
const letExpressions = queryBuilderState.constantState.constants
|
|
394
|
+
.map((_const) => _const.buildLetExpression())
|
|
395
|
+
.map((expres) =>
|
|
396
|
+
queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(
|
|
397
|
+
expres,
|
|
398
|
+
),
|
|
399
|
+
);
|
|
400
|
+
let lambdaBody = this.lambda.body;
|
|
401
|
+
if (letExpressions.length) {
|
|
402
|
+
if (Array.isArray(this.lambda.body)) {
|
|
403
|
+
lambdaBody = [...letExpressions, ...(this.lambda.body as object[])];
|
|
404
|
+
} else {
|
|
405
|
+
lambdaBody = [...letExpressions, this.lambda.body];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
386
408
|
const isolatedLambda = new RawLambda(
|
|
387
|
-
[_rawVariableExpression],
|
|
388
|
-
|
|
409
|
+
[_rawVariableExpression, ...parameters],
|
|
410
|
+
lambdaBody,
|
|
389
411
|
);
|
|
390
412
|
return isolatedLambda;
|
|
391
413
|
}
|