@finos/legend-query-builder 4.18.2 → 4.18.4
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/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +0 -1
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +5 -3
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +74 -36
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSResultShared.js +5 -3
- package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
- package/lib/data-access-overview.css +1 -1
- package/lib/index.css +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 +1 -1
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +3 -4
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +10 -2
- package/lib/stores/QueryBuilderStateBuilder.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/__test-utils__/TEST_DATA__QueryBuilder_Accessors.d.ts +98 -0
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.d.ts.map +1 -1
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.js +156 -0
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.d.ts +50 -4
- package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.js +112 -11
- package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +17 -3
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts +6 -0
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js +35 -9
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +2 -4
- 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 +2 -4
- 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 +7 -11
- 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 +7 -11
- 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 +7 -11
- 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 +3 -6
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.d.ts +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js +5 -3
- 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 +7 -11
- 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 +7 -11
- 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 +2 -4
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js +9 -6
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts +3 -3
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js +12 -4
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts +2 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js +36 -6
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js.map +1 -1
- package/package.json +5 -5
- package/src/components/QueryBuilder.tsx +0 -1
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +7 -2
- package/src/components/filter/QueryBuilderFilterPanel.tsx +138 -69
- package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +4 -1
- package/src/index.ts +2 -1
- package/src/stores/QueryBuilderState.ts +3 -6
- package/src/stores/QueryBuilderStateBuilder.ts +15 -2
- package/src/stores/QueryBuilderStateHashUtils.ts +2 -0
- package/src/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.ts +157 -0
- package/src/stores/filter/QueryBuilderFilterState.ts +175 -14
- package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +24 -3
- package/src/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.ts +55 -24
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +2 -5
- package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +2 -5
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +7 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +7 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +7 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +3 -9
- package/src/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.ts +9 -6
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +7 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +7 -13
- package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +2 -5
- package/src/stores/milestoning/QueryBuilderMilestoningState.ts +13 -7
- package/src/stores/workflows/accessor/AccessorQueryBuilderState.ts +17 -3
- package/src/stores/workflows/dataProduct/DataProductQueryBuilderState.ts +84 -19
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
24
|
type ValueSpecification,
|
|
25
25
|
type SimpleFunctionExpression,
|
|
26
|
-
type AbstractPropertyExpression,
|
|
27
26
|
} from '@finos/legend-graph';
|
|
28
27
|
import {
|
|
29
28
|
type Hashable,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
import {
|
|
34
33
|
buildFilterConditionState,
|
|
35
34
|
buildFilterConditionExpression,
|
|
35
|
+
getFilterExpressionLeftSideTypePath,
|
|
36
36
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
38
38
|
import {
|
|
@@ -53,9 +53,7 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
|
|
|
53
53
|
isCompatibleWithFilterConditionProperty(
|
|
54
54
|
filterConditionState: FilterConditionState,
|
|
55
55
|
): boolean {
|
|
56
|
-
const propertyType =
|
|
57
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
58
|
-
.genericType.value.rawType;
|
|
56
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
59
57
|
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
60
58
|
return (
|
|
61
59
|
normalizedType !== undefined &&
|
|
@@ -81,17 +79,14 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
|
|
|
81
79
|
!filterConditionState.rightConditionValue.isCollection
|
|
82
80
|
? filterConditionState.rightConditionValue.type
|
|
83
81
|
: undefined,
|
|
84
|
-
filterConditionState.
|
|
85
|
-
.genericType.value.rawType,
|
|
82
|
+
filterConditionState.leftConditionType,
|
|
86
83
|
);
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
getDefaultFilterConditionValue(
|
|
90
87
|
filterConditionState: FilterConditionState,
|
|
91
88
|
): ValueSpecification | undefined {
|
|
92
|
-
const propertyType =
|
|
93
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
94
|
-
.genericType.value.rawType;
|
|
89
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
95
90
|
switch (propertyType.path) {
|
|
96
91
|
case PRIMITIVE_TYPE.NUMBER:
|
|
97
92
|
case PRIMITIVE_TYPE.DECIMAL:
|
|
@@ -122,8 +117,7 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
|
|
|
122
117
|
): ValueSpecification {
|
|
123
118
|
return buildFilterConditionExpression(
|
|
124
119
|
filterConditionState,
|
|
125
|
-
filterConditionState.
|
|
126
|
-
.genericType.value.rawType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
120
|
+
filterConditionState.leftConditionType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
127
121
|
filterConditionState.rightConditionValue?.type?.path !==
|
|
128
122
|
PRIMITIVE_TYPE.DATETIME
|
|
129
123
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_AFTER_DAY
|
|
@@ -139,8 +133,8 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
|
|
|
139
133
|
return buildFilterConditionState(
|
|
140
134
|
filterState,
|
|
141
135
|
expression,
|
|
142
|
-
(expression
|
|
143
|
-
|
|
136
|
+
getFilterExpressionLeftSideTypePath(expression) ===
|
|
137
|
+
PRIMITIVE_TYPE.DATETIME &&
|
|
144
138
|
expression.parametersValues[1]?.genericType?.value.rawType.path !==
|
|
145
139
|
PRIMITIVE_TYPE.DATETIME
|
|
146
140
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_AFTER_DAY
|
|
@@ -56,9 +56,7 @@ export class QueryBuilderFilterOperator_In
|
|
|
56
56
|
isCompatibleWithFilterConditionProperty(
|
|
57
57
|
filterConditionState: FilterConditionState,
|
|
58
58
|
): boolean {
|
|
59
|
-
const propertyType =
|
|
60
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
61
|
-
.genericType.value.rawType;
|
|
59
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
62
60
|
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
63
61
|
return (
|
|
64
62
|
(normalizedType !== undefined &&
|
|
@@ -82,9 +80,7 @@ export class QueryBuilderFilterOperator_In
|
|
|
82
80
|
isCompatibleWithFilterConditionValue(
|
|
83
81
|
filterConditionState: FilterConditionState,
|
|
84
82
|
): boolean {
|
|
85
|
-
const propertyType =
|
|
86
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
87
|
-
.genericType.value.rawType;
|
|
83
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
88
84
|
const rightSide = filterConditionState.rightConditionValue;
|
|
89
85
|
// `in`/`not in` does not support right hand value being column state as the multipliticy for columns are [0..1]
|
|
90
86
|
if (rightSide instanceof FilterValueSpecConditionValueState) {
|
|
@@ -147,9 +143,7 @@ export class QueryBuilderFilterOperator_In
|
|
|
147
143
|
getDefaultFilterConditionValue(
|
|
148
144
|
filterConditionState: FilterConditionState,
|
|
149
145
|
): ValueSpecification | undefined {
|
|
150
|
-
const propertyType =
|
|
151
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
152
|
-
.genericType.value.rawType;
|
|
146
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
153
147
|
return new CollectionInstanceValue(
|
|
154
148
|
Multiplicity.ONE,
|
|
155
149
|
GenericTypeExplicitReference.create(new GenericType(propertyType)),
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
QueryBuilderFilterState,
|
|
19
|
-
FilterConditionState,
|
|
17
|
+
import {
|
|
18
|
+
type QueryBuilderFilterState,
|
|
19
|
+
type FilterConditionState,
|
|
20
|
+
FilterPropertyExpressionSourceState,
|
|
20
21
|
} from '../QueryBuilderFilterState.js';
|
|
21
22
|
import { QueryBuilderFilterOperator } from '../QueryBuilderFilterOperator.js';
|
|
22
23
|
import {
|
|
@@ -50,11 +51,13 @@ export class QueryBuilderFilterOperator_IsEmpty
|
|
|
50
51
|
isCompatibleWithFilterConditionProperty(
|
|
51
52
|
filterConditionState: FilterConditionState,
|
|
52
53
|
): boolean {
|
|
53
|
-
const propertyType =
|
|
54
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
55
|
-
.genericType.value.rawType;
|
|
54
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
56
55
|
// First check if property is optional
|
|
57
56
|
if (
|
|
57
|
+
!(
|
|
58
|
+
filterConditionState.sourceState instanceof
|
|
59
|
+
FilterPropertyExpressionSourceState
|
|
60
|
+
) ||
|
|
58
61
|
!isPropertyExpressionChainOptional(
|
|
59
62
|
filterConditionState.propertyExpressionState.propertyExpression,
|
|
60
63
|
)
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
24
|
type ValueSpecification,
|
|
25
25
|
type SimpleFunctionExpression,
|
|
26
|
-
type AbstractPropertyExpression,
|
|
27
26
|
} from '@finos/legend-graph';
|
|
28
27
|
import {
|
|
29
28
|
type Hashable,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
import {
|
|
34
33
|
buildFilterConditionState,
|
|
35
34
|
buildFilterConditionExpression,
|
|
35
|
+
getFilterExpressionLeftSideTypePath,
|
|
36
36
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
38
38
|
import {
|
|
@@ -53,9 +53,7 @@ export class QueryBuilderFilterOperator_LessThan
|
|
|
53
53
|
isCompatibleWithFilterConditionProperty(
|
|
54
54
|
filterConditionState: FilterConditionState,
|
|
55
55
|
): boolean {
|
|
56
|
-
const propertyType =
|
|
57
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
58
|
-
.genericType.value.rawType;
|
|
56
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
59
57
|
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
60
58
|
return (
|
|
61
59
|
normalizedType !== undefined &&
|
|
@@ -81,17 +79,14 @@ export class QueryBuilderFilterOperator_LessThan
|
|
|
81
79
|
!filterConditionState.rightConditionValue.isCollection
|
|
82
80
|
? filterConditionState.rightConditionValue.type
|
|
83
81
|
: undefined,
|
|
84
|
-
filterConditionState.
|
|
85
|
-
.genericType.value.rawType,
|
|
82
|
+
filterConditionState.leftConditionType,
|
|
86
83
|
);
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
getDefaultFilterConditionValue(
|
|
90
87
|
filterConditionState: FilterConditionState,
|
|
91
88
|
): ValueSpecification | undefined {
|
|
92
|
-
const propertyType =
|
|
93
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
94
|
-
.genericType.value.rawType;
|
|
89
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
95
90
|
switch (propertyType.path) {
|
|
96
91
|
case PRIMITIVE_TYPE.NUMBER:
|
|
97
92
|
case PRIMITIVE_TYPE.DECIMAL:
|
|
@@ -122,8 +117,7 @@ export class QueryBuilderFilterOperator_LessThan
|
|
|
122
117
|
): ValueSpecification {
|
|
123
118
|
return buildFilterConditionExpression(
|
|
124
119
|
filterConditionState,
|
|
125
|
-
filterConditionState.
|
|
126
|
-
.genericType.value.rawType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
120
|
+
filterConditionState.leftConditionType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
127
121
|
filterConditionState.rightConditionValue?.type?.path !==
|
|
128
122
|
PRIMITIVE_TYPE.DATETIME
|
|
129
123
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_BEFORE_DAY
|
|
@@ -139,8 +133,8 @@ export class QueryBuilderFilterOperator_LessThan
|
|
|
139
133
|
return buildFilterConditionState(
|
|
140
134
|
filterState,
|
|
141
135
|
expression,
|
|
142
|
-
(expression
|
|
143
|
-
|
|
136
|
+
getFilterExpressionLeftSideTypePath(expression) ===
|
|
137
|
+
PRIMITIVE_TYPE.DATETIME &&
|
|
144
138
|
expression.parametersValues[1]?.genericType?.value.rawType.path !==
|
|
145
139
|
PRIMITIVE_TYPE.DATETIME
|
|
146
140
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_BEFORE_DAY
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
PRIMITIVE_TYPE,
|
|
24
24
|
type ValueSpecification,
|
|
25
25
|
type SimpleFunctionExpression,
|
|
26
|
-
type AbstractPropertyExpression,
|
|
27
26
|
} from '@finos/legend-graph';
|
|
28
27
|
import {
|
|
29
28
|
type Hashable,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
import {
|
|
34
33
|
buildFilterConditionState,
|
|
35
34
|
buildFilterConditionExpression,
|
|
35
|
+
getFilterExpressionLeftSideTypePath,
|
|
36
36
|
} from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
|
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graph/QueryBuilderMetaModelConst.js';
|
|
38
38
|
import {
|
|
@@ -53,9 +53,7 @@ export class QueryBuilderFilterOperator_LessThanEqual
|
|
|
53
53
|
isCompatibleWithFilterConditionProperty(
|
|
54
54
|
filterConditionState: FilterConditionState,
|
|
55
55
|
): boolean {
|
|
56
|
-
const propertyType =
|
|
57
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
58
|
-
.genericType.value.rawType;
|
|
56
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
59
57
|
const normalizedType = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
60
58
|
return (
|
|
61
59
|
normalizedType !== undefined &&
|
|
@@ -81,17 +79,14 @@ export class QueryBuilderFilterOperator_LessThanEqual
|
|
|
81
79
|
!filterConditionState.rightConditionValue.isCollection
|
|
82
80
|
? filterConditionState.rightConditionValue.type
|
|
83
81
|
: undefined,
|
|
84
|
-
filterConditionState.
|
|
85
|
-
.genericType.value.rawType,
|
|
82
|
+
filterConditionState.leftConditionType,
|
|
86
83
|
);
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
getDefaultFilterConditionValue(
|
|
90
87
|
filterConditionState: FilterConditionState,
|
|
91
88
|
): ValueSpecification | undefined {
|
|
92
|
-
const propertyType =
|
|
93
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
94
|
-
.genericType.value.rawType;
|
|
89
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
95
90
|
switch (propertyType.path) {
|
|
96
91
|
case PRIMITIVE_TYPE.NUMBER:
|
|
97
92
|
case PRIMITIVE_TYPE.DECIMAL:
|
|
@@ -122,8 +117,7 @@ export class QueryBuilderFilterOperator_LessThanEqual
|
|
|
122
117
|
): ValueSpecification {
|
|
123
118
|
return buildFilterConditionExpression(
|
|
124
119
|
filterConditionState,
|
|
125
|
-
filterConditionState.
|
|
126
|
-
.genericType.value.rawType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
120
|
+
filterConditionState.leftConditionType.path === PRIMITIVE_TYPE.DATETIME &&
|
|
127
121
|
filterConditionState.rightConditionValue?.type?.path !==
|
|
128
122
|
PRIMITIVE_TYPE.DATETIME
|
|
129
123
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_BEFORE_DAY
|
|
@@ -139,8 +133,8 @@ export class QueryBuilderFilterOperator_LessThanEqual
|
|
|
139
133
|
return buildFilterConditionState(
|
|
140
134
|
filterState,
|
|
141
135
|
expression,
|
|
142
|
-
(expression
|
|
143
|
-
|
|
136
|
+
getFilterExpressionLeftSideTypePath(expression) ===
|
|
137
|
+
PRIMITIVE_TYPE.DATETIME &&
|
|
144
138
|
expression.parametersValues[1]?.genericType?.value.rawType.path !==
|
|
145
139
|
PRIMITIVE_TYPE.DATETIME
|
|
146
140
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_BEFORE_DAY
|
|
@@ -55,8 +55,7 @@ export class QueryBuilderFilterOperator_StartWith
|
|
|
55
55
|
): boolean {
|
|
56
56
|
return (
|
|
57
57
|
getStandardPrimitiveTypeEquivalent(
|
|
58
|
-
filterConditionState.
|
|
59
|
-
.value.genericType.value.rawType,
|
|
58
|
+
filterConditionState.leftConditionType,
|
|
60
59
|
) === PRIMITIVE_TYPE.STRING
|
|
61
60
|
);
|
|
62
61
|
}
|
|
@@ -78,9 +77,7 @@ export class QueryBuilderFilterOperator_StartWith
|
|
|
78
77
|
getDefaultFilterConditionValue(
|
|
79
78
|
filterConditionState: FilterConditionState,
|
|
80
79
|
): ValueSpecification | undefined {
|
|
81
|
-
const propertyType =
|
|
82
|
-
filterConditionState.propertyExpressionState.propertyExpression.func.value
|
|
83
|
-
.genericType.value.rawType;
|
|
80
|
+
const propertyType = filterConditionState.leftConditionType;
|
|
84
81
|
switch (propertyType.path) {
|
|
85
82
|
case PRIMITIVE_TYPE.STRING: {
|
|
86
83
|
return buildDefaultInstanceValue(
|
|
@@ -51,6 +51,7 @@ import { QueryBuilderAggregateColumnState } from '../fetch-structure/tds/aggrega
|
|
|
51
51
|
import {
|
|
52
52
|
QueryBuilderFilterTreeConditionNodeData,
|
|
53
53
|
QueryBuilderFilterTreeExistsNodeData,
|
|
54
|
+
FilterPropertyExpressionSourceState,
|
|
54
55
|
} from '../filter/QueryBuilderFilterState.js';
|
|
55
56
|
|
|
56
57
|
export class QueryBuilderMilestoningState implements Hashable {
|
|
@@ -153,13 +154,18 @@ export class QueryBuilderMilestoningState implements Hashable {
|
|
|
153
154
|
}
|
|
154
155
|
this.queryBuilderState.filterState.nodes.forEach((node) => {
|
|
155
156
|
if (node instanceof QueryBuilderFilterTreeConditionNodeData) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
if (
|
|
158
|
+
node.condition.sourceState instanceof
|
|
159
|
+
FilterPropertyExpressionSourceState
|
|
160
|
+
) {
|
|
161
|
+
node.condition.sourceState.propertyExpressionState.derivedPropertyExpressionStates[0]?.parameterValues.forEach(
|
|
162
|
+
(p) => {
|
|
163
|
+
if (p instanceof INTERNAL__PropagatedValue) {
|
|
164
|
+
p.isPropagatedValue = false;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
}
|
|
163
169
|
} else if (node instanceof QueryBuilderFilterTreeExistsNodeData) {
|
|
164
170
|
if (
|
|
165
171
|
node.propertyExpressionState.derivedPropertyExpressionStates[0] &&
|
|
@@ -19,10 +19,12 @@ import {
|
|
|
19
19
|
type PackageableRuntime,
|
|
20
20
|
type AccessorOwner,
|
|
21
21
|
type Accessor,
|
|
22
|
+
type RawLambda,
|
|
22
23
|
IngestDefinition,
|
|
23
24
|
Database,
|
|
24
25
|
PackageableElementExplicitReference,
|
|
25
26
|
RuntimePointer,
|
|
27
|
+
buildRawLambdaFromLambdaFunction,
|
|
26
28
|
type TEMPORARY_IngestContent,
|
|
27
29
|
} from '@finos/legend-graph';
|
|
28
30
|
import { QueryBuilderState } from '../../QueryBuilderState.js';
|
|
@@ -39,6 +41,7 @@ import { buildElementOption } from '@finos/legend-lego/graph-editor';
|
|
|
39
41
|
import { getCompatibleRuntimesFromAccessorOwner } from './AccessorQueryBuilderHelper.js';
|
|
40
42
|
import { QueryBuilderEmbeddedFromExecutionContextState } from '../../QueryBuilderExecutionContextState.js';
|
|
41
43
|
import { QueryBuilderTDSState } from '../../fetch-structure/tds/QueryBuilderTDSState.js';
|
|
44
|
+
import { buildLambdaFunction } from '../../QueryBuilderValueSpecificationBuilder.js';
|
|
42
45
|
|
|
43
46
|
export interface AccessorOwnerOption {
|
|
44
47
|
label: string;
|
|
@@ -147,11 +150,9 @@ export class AccessorQueryBuilderState extends QueryBuilderState {
|
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
/**
|
|
150
|
-
* In accessor mode,
|
|
151
|
-
* so we hide it and show the post-filter panel instead.
|
|
153
|
+
* In accessor mode, configure both filter and post-filter panels to be visible.
|
|
152
154
|
*/
|
|
153
155
|
private configureFilterPanelsForAccessor(): void {
|
|
154
|
-
this.filterState.setShowPanel(false);
|
|
155
156
|
const tdsState = this.fetchStructureState.implementation;
|
|
156
157
|
if (tdsState instanceof QueryBuilderTDSState) {
|
|
157
158
|
tdsState.setShowPostFilterPanel(true);
|
|
@@ -197,4 +198,17 @@ export class AccessorQueryBuilderState extends QueryBuilderState {
|
|
|
197
198
|
new RuntimePointer(PackageableElementExplicitReference.create(val)),
|
|
198
199
|
);
|
|
199
200
|
}
|
|
201
|
+
|
|
202
|
+
override buildQueryForPersistence(): RawLambda {
|
|
203
|
+
if (!this.isQuerySupported) {
|
|
204
|
+
return this.buildQuery();
|
|
205
|
+
}
|
|
206
|
+
return buildRawLambdaFromLambdaFunction(
|
|
207
|
+
buildLambdaFunction(this, {
|
|
208
|
+
skipExecutionContext: true,
|
|
209
|
+
useTypedRelationFunctions: this.isFetchStructureTyped,
|
|
210
|
+
}),
|
|
211
|
+
this.graphManagerState,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
200
214
|
}
|
|
@@ -54,8 +54,10 @@ import {
|
|
|
54
54
|
GenericTypeExplicitReference,
|
|
55
55
|
findLakehouseAccessPointGroup,
|
|
56
56
|
type PureModel,
|
|
57
|
-
|
|
57
|
+
V1_RelationType,
|
|
58
|
+
V1_getGenericTypeFullPath,
|
|
58
59
|
LegendSDLC,
|
|
60
|
+
DataProductAccessType,
|
|
59
61
|
} from '@finos/legend-graph';
|
|
60
62
|
import { QueryBuilderState } from '../../QueryBuilderState.js';
|
|
61
63
|
|
|
@@ -83,22 +85,58 @@ import { compareLabelFn } from '@finos/legend-art';
|
|
|
83
85
|
import { QueryBuilderEmbeddedFromExecutionContextState } from '../../QueryBuilderExecutionContextState.js';
|
|
84
86
|
import { buildLambdaFunction } from '../../QueryBuilderValueSpecificationBuilder.js';
|
|
85
87
|
|
|
86
|
-
export const
|
|
87
|
-
relationMetadata: RelationTypeMetadata,
|
|
88
|
+
export const resolveDataProductAccessor = (
|
|
88
89
|
dataProduct: DataProduct,
|
|
89
90
|
accessPoint: LakehouseAccessPoint,
|
|
90
91
|
graph: PureModel,
|
|
92
|
+
artifact: V1_DataProductArtifact | undefined,
|
|
93
|
+
relationMetadata?: RelationTypeMetadata | undefined,
|
|
91
94
|
): DataProductAccessor => {
|
|
92
95
|
const relationType = new RelationType(accessPoint.title ?? accessPoint.id);
|
|
93
|
-
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
GenericTypeExplicitReference.create(
|
|
98
|
-
new GenericType(graph.getType(col.type)),
|
|
99
|
-
),
|
|
96
|
+
if (artifact) {
|
|
97
|
+
const artifactGroup = artifact.accessPointGroups.find((apg) =>
|
|
98
|
+
apg.accessPointImplementations.some(
|
|
99
|
+
(apImpl) => apImpl.id === accessPoint.id,
|
|
100
100
|
),
|
|
101
|
-
|
|
101
|
+
);
|
|
102
|
+
const artifactImpl = artifactGroup?.accessPointImplementations.find(
|
|
103
|
+
(apImpl) => apImpl.id === accessPoint.id,
|
|
104
|
+
);
|
|
105
|
+
const v1RelationType = artifactImpl?.lambdaGenericType?.typeArguments
|
|
106
|
+
.map((typeArg) => typeArg.rawType)
|
|
107
|
+
.find((rawType) => rawType instanceof V1_RelationType);
|
|
108
|
+
if (v1RelationType) {
|
|
109
|
+
relationType.columns = v1RelationType.columns.map(
|
|
110
|
+
(col) =>
|
|
111
|
+
new RelationColumn(
|
|
112
|
+
col.name,
|
|
113
|
+
GenericTypeExplicitReference.create(
|
|
114
|
+
new GenericType(
|
|
115
|
+
graph.getType(V1_getGenericTypeFullPath(col.genericType)),
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
),
|
|
119
|
+
);
|
|
120
|
+
return new DataProductAccessor(
|
|
121
|
+
dataProduct.path,
|
|
122
|
+
artifactGroup?.id,
|
|
123
|
+
accessPoint.id,
|
|
124
|
+
relationType,
|
|
125
|
+
dataProduct,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (relationMetadata) {
|
|
130
|
+
relationType.columns = relationMetadata.columns.map(
|
|
131
|
+
(col) =>
|
|
132
|
+
new RelationColumn(
|
|
133
|
+
col.name,
|
|
134
|
+
GenericTypeExplicitReference.create(
|
|
135
|
+
new GenericType(graph.getType(col.type)),
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
102
140
|
const groupResult = findLakehouseAccessPointGroup(
|
|
103
141
|
dataProduct,
|
|
104
142
|
accessPoint.id,
|
|
@@ -272,7 +310,9 @@ export class LakehouseDataProductExecutionState extends DataProductExecutionStat
|
|
|
272
310
|
queryBuilderState: DataProductQueryBuilderState,
|
|
273
311
|
) {
|
|
274
312
|
super(executionState, queryBuilderState);
|
|
275
|
-
makeObservable(this, {
|
|
313
|
+
makeObservable(this, {
|
|
314
|
+
withAdhocRuntime: observable,
|
|
315
|
+
});
|
|
276
316
|
this.selectedRuntime = this.compatibleRuntimes[0];
|
|
277
317
|
}
|
|
278
318
|
|
|
@@ -281,6 +321,11 @@ export class LakehouseDataProductExecutionState extends DataProductExecutionStat
|
|
|
281
321
|
this.queryBuilderState.changeRuntime(val);
|
|
282
322
|
}
|
|
283
323
|
|
|
324
|
+
withAdhocRuntime(): LakehouseDataProductExecutionState {
|
|
325
|
+
this.adhocRuntime = true;
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
|
|
284
329
|
override get label(): string {
|
|
285
330
|
return this.exectionValue.title ?? this.exectionValue.id;
|
|
286
331
|
}
|
|
@@ -413,6 +458,17 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
413
458
|
),
|
|
414
459
|
),
|
|
415
460
|
);
|
|
461
|
+
} else if (
|
|
462
|
+
this.executionState instanceof LakehouseDataProductExecutionState &&
|
|
463
|
+
this.executionState.selectedRuntime
|
|
464
|
+
) {
|
|
465
|
+
this.changeRuntime(
|
|
466
|
+
new RuntimePointer(
|
|
467
|
+
PackageableElementExplicitReference.create(
|
|
468
|
+
this.executionState.selectedRuntime,
|
|
469
|
+
),
|
|
470
|
+
),
|
|
471
|
+
);
|
|
416
472
|
}
|
|
417
473
|
}
|
|
418
474
|
|
|
@@ -614,7 +670,9 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
614
670
|
) {
|
|
615
671
|
const execContext = new QueryDataProductLakehouseExecutionContext();
|
|
616
672
|
execContext.dataProductPath = this.dataProduct.path;
|
|
673
|
+
execContext.accessGroupId = this.executionState.exectionValue.__owner.id;
|
|
617
674
|
execContext.accessPointId = this.executionState.exectionValue.id;
|
|
675
|
+
|
|
618
676
|
return execContext;
|
|
619
677
|
}
|
|
620
678
|
return super.getQueryExecutionContext();
|
|
@@ -765,16 +823,18 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
765
823
|
): Promise<void> {
|
|
766
824
|
this.setExecutionState(val);
|
|
767
825
|
if (val instanceof LakehouseAccessPoint) {
|
|
768
|
-
const relationMetadata =
|
|
769
|
-
await this.graphManagerState.graphManager.getLambdaRelationType(
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
826
|
+
const relationMetadata = !this.dataProductArtifact
|
|
827
|
+
? await this.graphManagerState.graphManager.getLambdaRelationType(
|
|
828
|
+
val.func,
|
|
829
|
+
this.graphManagerState.graph,
|
|
830
|
+
)
|
|
831
|
+
: undefined;
|
|
832
|
+
const accessor = resolveDataProductAccessor(
|
|
775
833
|
this.dataProduct,
|
|
776
834
|
val,
|
|
777
835
|
this.graphManagerState.graph,
|
|
836
|
+
this.dataProductArtifact,
|
|
837
|
+
relationMetadata,
|
|
778
838
|
);
|
|
779
839
|
this.setSourceElement(accessor);
|
|
780
840
|
}
|
|
@@ -942,6 +1002,11 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
942
1002
|
) {
|
|
943
1003
|
accessPointId = this.executionState.exectionValue.key;
|
|
944
1004
|
dataProductAccessType = DataProductAccessType.NATIVE;
|
|
1005
|
+
} else if (
|
|
1006
|
+
this.executionState instanceof LakehouseDataProductExecutionState
|
|
1007
|
+
) {
|
|
1008
|
+
accessPointId = this.executionState.exectionValue.id;
|
|
1009
|
+
dataProductAccessType = DataProductAccessType.LAKEHOUSE;
|
|
945
1010
|
} else {
|
|
946
1011
|
accessPointId = (
|
|
947
1012
|
this.executionState as ModelAccessPointDataProductExecutionState
|