@finos/legend-query-builder 4.9.3 → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -265,24 +265,28 @@ const QueryBuilderDerivationProjectionColumnEditor = observer(
|
|
265
265
|
);
|
266
266
|
|
267
267
|
type CalendarFunctionOption = {
|
268
|
-
label: string
|
268
|
+
label: string;
|
269
269
|
value: QueryBuilderAggregateCalendarFunction;
|
270
270
|
};
|
271
271
|
|
272
|
+
const formatCalendarFunctionOptionLabel = (
|
273
|
+
option: CalendarFunctionOption,
|
274
|
+
): React.ReactNode => (
|
275
|
+
<div
|
276
|
+
className="query-builder__projection__calendar__function__label"
|
277
|
+
title={option.value.getLabel()}
|
278
|
+
>
|
279
|
+
<FunctionIcon className="query-builder__projection__calendar__function__label__icon" />
|
280
|
+
<div className="query-builder__projection__calendar__function__label__title">
|
281
|
+
{option.value.getLabel()}
|
282
|
+
</div>
|
283
|
+
</div>
|
284
|
+
);
|
285
|
+
|
272
286
|
const buildCalendarFunctionOption = (
|
273
287
|
calendarFunction: QueryBuilderAggregateCalendarFunction,
|
274
288
|
): CalendarFunctionOption => ({
|
275
|
-
label: (
|
276
|
-
<div
|
277
|
-
className="query-builder__projection__calendar__function__label"
|
278
|
-
title={calendarFunction.getLabel()}
|
279
|
-
>
|
280
|
-
<FunctionIcon className="query-builder__projection__calendar__function__label__icon" />
|
281
|
-
<div className="query-builder__projection__calendar__function__label__title">
|
282
|
-
{calendarFunction.getLabel()}
|
283
|
-
</div>
|
284
|
-
</div>
|
285
|
-
),
|
289
|
+
label: calendarFunction.getLabel(),
|
286
290
|
value: calendarFunction,
|
287
291
|
});
|
288
292
|
|
@@ -684,7 +688,6 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
684
688
|
}),
|
685
689
|
[handleDrop],
|
686
690
|
);
|
687
|
-
|
688
691
|
return (
|
689
692
|
<PanelDnDEntry
|
690
693
|
ref={ref}
|
@@ -728,7 +731,12 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
728
731
|
onOpen={onContextMenuOpen}
|
729
732
|
onClose={onContextMenuClose}
|
730
733
|
>
|
731
|
-
<div
|
734
|
+
<div
|
735
|
+
data-testid={
|
736
|
+
QUERY_BUILDER_TEST_ID.QUERY_BUILDER_TDS_PROJECTION_COLUMN
|
737
|
+
}
|
738
|
+
className="query-builder__projection__column__container"
|
739
|
+
>
|
732
740
|
<PanelEntryDragHandle
|
733
741
|
isDragging={false}
|
734
742
|
dragSourceConnector={dragHandleRef}
|
@@ -865,6 +873,7 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
865
873
|
options={calendarFunctionOptions}
|
866
874
|
onChange={onCalendarFunctionOptionChange}
|
867
875
|
value={selectedCalendarFunctionOption}
|
876
|
+
formatOptionLabel={formatCalendarFunctionOptionLabel}
|
868
877
|
placeholder="Select Calendar Function"
|
869
878
|
isClearable={true}
|
870
879
|
escapeClearsValue={true}
|
@@ -880,9 +889,7 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
880
889
|
defaultEndDate
|
881
890
|
}
|
882
891
|
setValueSpecification={(val: ValueSpecification): void => {
|
883
|
-
|
884
|
-
aggregateColumnState.calendarFunction?.setEndDate(val);
|
885
|
-
}
|
892
|
+
aggregateColumnState.calendarFunction?.setEndDate(val);
|
886
893
|
}}
|
887
894
|
graph={tdsState.queryBuilderState.graphManagerState.graph}
|
888
895
|
obseverContext={tdsState.queryBuilderState.observerContext}
|
@@ -26,7 +26,7 @@ import {
|
|
26
26
|
import {
|
27
27
|
type V1_GraphBuilderContext,
|
28
28
|
type V1_ProcessingContext,
|
29
|
-
|
29
|
+
V1_ValueSpecification,
|
30
30
|
type ValueSpecification,
|
31
31
|
type SimpleFunctionExpression,
|
32
32
|
type Type,
|
@@ -50,7 +50,6 @@ import {
|
|
50
50
|
VariableExpression,
|
51
51
|
Multiplicity,
|
52
52
|
PrimitiveType,
|
53
|
-
V1_CStrictDate,
|
54
53
|
V1_CString,
|
55
54
|
CORE_PURE_PATH,
|
56
55
|
FunctionType,
|
@@ -203,8 +202,8 @@ const buildCalendarFunctionExpression = (
|
|
203
202
|
);
|
204
203
|
guaranteeType(
|
205
204
|
currentPropertyExpression.parameters[2],
|
206
|
-
|
207
|
-
`Can't build calendar aggregation column: only support third parameter of calendar function as
|
205
|
+
V1_ValueSpecification,
|
206
|
+
`Can't build calendar aggregation column: only support third parameter of calendar function as Date`,
|
208
207
|
);
|
209
208
|
const dateColumn =
|
210
209
|
currentPropertyExpression.parameters[0].accept_ValueSpecificationVisitor(
|
@@ -24,6 +24,12 @@ import {
|
|
24
24
|
buildSourceInformationSourceId,
|
25
25
|
ParserError,
|
26
26
|
GRAPH_MANAGER_EVENT,
|
27
|
+
SimpleFunctionExpression,
|
28
|
+
PrimitiveInstanceValue,
|
29
|
+
PrimitiveType,
|
30
|
+
extractElementNameFromPath,
|
31
|
+
SUPPORTED_FUNCTIONS,
|
32
|
+
INTERNAL__UnknownValueSpecification,
|
27
33
|
} from '@finos/legend-graph';
|
28
34
|
import {
|
29
35
|
type Hashable,
|
@@ -70,6 +76,22 @@ export abstract class QueryBuilderConstantExpressionState implements Hashable {
|
|
70
76
|
this.variable.name,
|
71
77
|
]);
|
72
78
|
}
|
79
|
+
|
80
|
+
buildLetExpression(): SimpleFunctionExpression {
|
81
|
+
const leftSide = new PrimitiveInstanceValue(
|
82
|
+
GenericTypeExplicitReference.create(
|
83
|
+
new GenericType(PrimitiveType.STRING),
|
84
|
+
),
|
85
|
+
);
|
86
|
+
leftSide.values = [this.variable.name];
|
87
|
+
const letFunc = new SimpleFunctionExpression(
|
88
|
+
extractElementNameFromPath(SUPPORTED_FUNCTIONS.LET),
|
89
|
+
);
|
90
|
+
letFunc.parametersValues = [leftSide, this.buildLetAssignmentValue()];
|
91
|
+
return letFunc;
|
92
|
+
}
|
93
|
+
|
94
|
+
abstract buildLetAssignmentValue(): ValueSpecification;
|
73
95
|
}
|
74
96
|
|
75
97
|
export class QueryBuilderSimpleConstantExpressionState
|
@@ -141,6 +163,10 @@ export class QueryBuilderSimpleConstantExpressionState
|
|
141
163
|
}
|
142
164
|
}
|
143
165
|
|
166
|
+
override buildLetAssignmentValue(): ValueSpecification {
|
167
|
+
return this.value;
|
168
|
+
}
|
169
|
+
|
144
170
|
override get hashCode(): string {
|
145
171
|
return hashArray([
|
146
172
|
QUERY_BUILDER_STATE_HASH_STRUCTURE.CONSTANT_EXPRESSION_STATE,
|
@@ -272,6 +298,10 @@ export class QueryBuilderCalculatedConstantExpressionState
|
|
272
298
|
setValue(val: PlainObject): void {
|
273
299
|
this.value = val;
|
274
300
|
}
|
301
|
+
|
302
|
+
override buildLetAssignmentValue(): ValueSpecification {
|
303
|
+
return new INTERNAL__UnknownValueSpecification(this.value);
|
304
|
+
}
|
275
305
|
}
|
276
306
|
|
277
307
|
export class QueryBuilderConstantsState implements Hashable {
|
@@ -45,6 +45,8 @@ export enum QUERY_BUILDER_STATE_HASH_STRUCTURE {
|
|
45
45
|
POST_FILTER_TREE_CONDIITION_NODE_DATA = 'POST_FILTER_TREE_CONDITION_NODE_DATA',
|
46
46
|
POST_FILTER_TREE_BLANK_CONDITION_NODE_DATA = 'POST_FILTER_TREE_BLANK_CONDITION_NODE_DATA',
|
47
47
|
POST_FILTER_CONDITION_STATE = 'POST_FILTER_CONDITION_STATE',
|
48
|
+
POST_FILTER_CONDITION_RIGHT_VALUE = 'POST_FILTER_CONDITION_RIGHT_VALUE',
|
49
|
+
POST_FILTER_CONDITION_RIGHT_VALUE_SPEC = 'POST_FILTER_CONDITION_RIGHT_VALUE_SPEC',
|
48
50
|
POST_FILTER_OPERATOR_CONTAIN = 'POST_FILTER_OPERATOR_CONTAIN',
|
49
51
|
POST_FILTER_OPERATOR_NOT_CONTAIN = 'POST_FILTER_OPERATOR_NOT_CONTAIN',
|
50
52
|
POST_FILTER_OPERATOR_END_WITH = 'POST_FILTER_OPERATOR_END_WITH',
|
@@ -14,14 +14,9 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
18
|
-
UnsupportedOperationError,
|
19
|
-
guaranteeNonNullable,
|
20
|
-
guaranteeType,
|
21
|
-
} from '@finos/legend-shared';
|
17
|
+
import { guaranteeNonNullable, guaranteeType } from '@finos/legend-shared';
|
22
18
|
import {
|
23
19
|
type Class,
|
24
|
-
type ValueSpecification,
|
25
20
|
Multiplicity,
|
26
21
|
getMilestoneTemporalStereotype,
|
27
22
|
extractElementNameFromPath,
|
@@ -33,11 +28,8 @@ import {
|
|
33
28
|
GenericTypeExplicitReference,
|
34
29
|
LambdaFunction,
|
35
30
|
SimpleFunctionExpression,
|
36
|
-
PrimitiveInstanceValue,
|
37
|
-
PrimitiveType,
|
38
31
|
SUPPORTED_FUNCTIONS,
|
39
32
|
RuntimePointer,
|
40
|
-
INTERNAL__UnknownValueSpecification,
|
41
33
|
} from '@finos/legend-graph';
|
42
34
|
import type { QueryBuilderState } from './QueryBuilderState.js';
|
43
35
|
import { buildFilterExpression } from './filter/QueryBuilderFilterValueSpecificationBuilder.js';
|
@@ -46,11 +38,6 @@ import type { QueryBuilderFetchStructureState } from './fetch-structure/QueryBui
|
|
46
38
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../graph/QueryBuilderMetaModelConst.js';
|
47
39
|
import { buildWatermarkExpression } from './watermark/QueryBuilderWatermarkValueSpecificationBuilder.js';
|
48
40
|
import { buildExecutionQueryFromLambdaFunction } from './shared/LambdaParameterState.js';
|
49
|
-
import {
|
50
|
-
QueryBuilderSimpleConstantExpressionState,
|
51
|
-
type QueryBuilderConstantExpressionState,
|
52
|
-
QueryBuilderCalculatedConstantExpressionState,
|
53
|
-
} from './QueryBuilderConstantsState.js';
|
54
41
|
import {
|
55
42
|
QueryBuilderEmbeddedFromExecutionContextState,
|
56
43
|
type QueryBuilderExecutionContextState,
|
@@ -90,40 +77,6 @@ const buildGetAllVersionsFunction = (
|
|
90
77
|
return _func;
|
91
78
|
};
|
92
79
|
|
93
|
-
const buildLetExpression = (
|
94
|
-
constantExpressionState: QueryBuilderConstantExpressionState,
|
95
|
-
): SimpleFunctionExpression => {
|
96
|
-
const varName = constantExpressionState.variable.name;
|
97
|
-
const leftSide = new PrimitiveInstanceValue(
|
98
|
-
GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRING)),
|
99
|
-
);
|
100
|
-
leftSide.values = [varName];
|
101
|
-
const letFunc = new SimpleFunctionExpression(
|
102
|
-
extractElementNameFromPath(SUPPORTED_FUNCTIONS.LET),
|
103
|
-
);
|
104
|
-
let value: ValueSpecification;
|
105
|
-
if (
|
106
|
-
constantExpressionState instanceof QueryBuilderSimpleConstantExpressionState
|
107
|
-
) {
|
108
|
-
value = constantExpressionState.value;
|
109
|
-
} else if (
|
110
|
-
constantExpressionState instanceof
|
111
|
-
QueryBuilderCalculatedConstantExpressionState
|
112
|
-
) {
|
113
|
-
value = new INTERNAL__UnknownValueSpecification(
|
114
|
-
constantExpressionState.value,
|
115
|
-
);
|
116
|
-
} else {
|
117
|
-
throw new UnsupportedOperationError(
|
118
|
-
`Can't build let() expression: unsupported constant state`,
|
119
|
-
constantExpressionState,
|
120
|
-
);
|
121
|
-
}
|
122
|
-
|
123
|
-
letFunc.parametersValues = [leftSide, value];
|
124
|
-
return letFunc;
|
125
|
-
};
|
126
|
-
|
127
80
|
const buildExecutionContextState = (
|
128
81
|
executionState: QueryBuilderExecutionContextState,
|
129
82
|
lambdaFunction: LambdaFunction,
|
@@ -237,8 +190,9 @@ export const buildLambdaFunction = (
|
|
237
190
|
|
238
191
|
// build variable expressions
|
239
192
|
if (queryBuilderState.constantState.constants.length) {
|
240
|
-
const letExpressions =
|
241
|
-
|
193
|
+
const letExpressions = queryBuilderState.constantState.constants.map((e) =>
|
194
|
+
e.buildLetExpression(),
|
195
|
+
);
|
242
196
|
lambdaFunction.expressionSequence = [
|
243
197
|
...letExpressions,
|
244
198
|
...lambdaFunction.expressionSequence,
|
@@ -218,10 +218,11 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
218
218
|
let parentNode =
|
219
219
|
treeData.nodes.get(node.parentId) ??
|
220
220
|
propertySearchIndexedTreeNodes.find((n) => n.id === node.parentId);
|
221
|
-
let currentNode: QueryBuilderExplorerTreeNodeData = node;
|
221
|
+
let currentNode: QueryBuilderExplorerTreeNodeData | undefined = node;
|
222
222
|
while (
|
223
|
-
|
224
|
-
parentNode instanceof
|
223
|
+
currentNode &&
|
224
|
+
(parentNode instanceof QueryBuilderExplorerTreePropertyNodeData ||
|
225
|
+
parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData)
|
225
226
|
) {
|
226
227
|
// NOTE: here, we deliberately simplify subtypes chain
|
227
228
|
// $x.employees->subType(@Person)->subType(@Staff).department will be simplified to $x.employees->subType(@Staff).department
|
@@ -234,13 +235,28 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
234
235
|
}
|
235
236
|
|
236
237
|
let parentPropertyExpression;
|
237
|
-
if (
|
238
|
-
|
238
|
+
if (parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData) {
|
239
|
+
parentPropertyExpression = new SimpleFunctionExpression(
|
240
|
+
extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE),
|
241
|
+
);
|
242
|
+
} else if (
|
243
|
+
parentNode instanceof QueryBuilderExplorerTreePropertyNodeData &&
|
239
244
|
parentNode.mappingData.entityMappedProperty?.subType
|
240
245
|
) {
|
241
246
|
parentPropertyExpression = new SimpleFunctionExpression(
|
242
247
|
extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE),
|
243
248
|
);
|
249
|
+
currentExpression.parametersValues.push(parentPropertyExpression);
|
250
|
+
currentExpression = parentPropertyExpression;
|
251
|
+
parentPropertyExpression = new AbstractPropertyExpression('');
|
252
|
+
propertyExpression_setFunc(
|
253
|
+
parentPropertyExpression,
|
254
|
+
PropertyExplicitReference.create(
|
255
|
+
guaranteeNonNullable(parentNode.property),
|
256
|
+
),
|
257
|
+
);
|
258
|
+
currentNode = parentNode;
|
259
|
+
parentNode = treeData.nodes.get(parentNode.parentId);
|
244
260
|
} else {
|
245
261
|
parentPropertyExpression = new AbstractPropertyExpression('');
|
246
262
|
propertyExpression_setFunc(
|
@@ -266,7 +282,11 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
266
282
|
}
|
267
283
|
currentExpression = parentPropertyExpression;
|
268
284
|
currentNode = parentNode;
|
269
|
-
parentNode =
|
285
|
+
parentNode =
|
286
|
+
parentNode instanceof QueryBuilderExplorerTreePropertyNodeData ||
|
287
|
+
parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData
|
288
|
+
? treeData.nodes.get(parentNode.parentId)
|
289
|
+
: undefined;
|
270
290
|
if (
|
271
291
|
!parentNode &&
|
272
292
|
(currentNode instanceof QueryBuilderExplorerTreePropertyNodeData ||
|
@@ -281,7 +301,7 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
281
301
|
}
|
282
302
|
}
|
283
303
|
currentExpression.parametersValues.push(projectionColumnLambdaVariable);
|
284
|
-
if (currentExpression instanceof SimpleFunctionExpression) {
|
304
|
+
if (currentNode && currentExpression instanceof SimpleFunctionExpression) {
|
285
305
|
const subclass = new InstanceValue(
|
286
306
|
Multiplicity.ONE,
|
287
307
|
GenericTypeExplicitReference.create(new GenericType(currentNode.type)),
|
@@ -458,12 +478,22 @@ export const getQueryBuilderPropertyNodeData = (
|
|
458
478
|
)
|
459
479
|
: undefined;
|
460
480
|
const propertyNode = new QueryBuilderExplorerTreePropertyNodeData(
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
481
|
+
subClass
|
482
|
+
? generateExplorerTreeSubtypeNodeID(
|
483
|
+
generateExplorerTreePropertyNodeID(
|
484
|
+
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
485
|
+
? ''
|
486
|
+
: parentNode.id,
|
487
|
+
property.name,
|
488
|
+
),
|
489
|
+
subClass.path,
|
490
|
+
)
|
491
|
+
: generateExplorerTreePropertyNodeID(
|
492
|
+
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
493
|
+
? ''
|
494
|
+
: parentNode.id,
|
495
|
+
property.name,
|
496
|
+
),
|
467
497
|
property.name,
|
468
498
|
`${
|
469
499
|
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
@@ -302,6 +302,16 @@ export const addQueryBuilderPropertyNode = (
|
|
302
302
|
parentExplorerTreeNode.parentId,
|
303
303
|
);
|
304
304
|
}
|
305
|
+
if (
|
306
|
+
parentExplorerTreeNode instanceof
|
307
|
+
QueryBuilderExplorerTreePropertyNodeData &&
|
308
|
+
parentExplorerTreeNode.mappingData.entityMappedProperty?.subType &&
|
309
|
+
parentExplorerTreeNode.type instanceof Class
|
310
|
+
) {
|
311
|
+
subType = PackageableElementExplicitReference.create(
|
312
|
+
parentExplorerTreeNode.type,
|
313
|
+
);
|
314
|
+
}
|
305
315
|
if (
|
306
316
|
parentExplorerTreeNode instanceof QueryBuilderExplorerTreePropertyNodeData
|
307
317
|
) {
|
@@ -23,7 +23,6 @@ import {
|
|
23
23
|
AbstractPropertyExpression,
|
24
24
|
INTERNAL__UnknownValueSpecification,
|
25
25
|
LambdaFunctionInstanceValue,
|
26
|
-
type PrimitiveInstanceValue,
|
27
26
|
type SimpleFunctionExpression,
|
28
27
|
type ValueSpecification,
|
29
28
|
} from '@finos/legend-graph';
|
@@ -42,7 +41,7 @@ export abstract class QueryBuilderAggregateCalendarFunction
|
|
42
41
|
{
|
43
42
|
dateColumn?: AbstractPropertyExpression | undefined;
|
44
43
|
calendarType!: QUERY_BUILDER_CALENDAR_TYPE;
|
45
|
-
endDate!:
|
44
|
+
endDate!: ValueSpecification;
|
46
45
|
lambdaParameterName: string = DEFAULT_LAMBDA_VARIABLE_NAME;
|
47
46
|
|
48
47
|
constructor() {
|
@@ -122,7 +121,7 @@ export abstract class QueryBuilderAggregateCalendarFunction
|
|
122
121
|
this.calendarType = val;
|
123
122
|
}
|
124
123
|
|
125
|
-
setEndDate(val:
|
124
|
+
setEndDate(val: ValueSpecification): void {
|
126
125
|
this.endDate = val;
|
127
126
|
}
|
128
127
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import {
|
18
|
-
|
18
|
+
ValueSpecification,
|
19
19
|
SimpleFunctionExpression,
|
20
20
|
extractElementNameFromPath,
|
21
21
|
matchFunctionName,
|
@@ -44,7 +44,7 @@ export const buildCalendarFunctionExpression = (
|
|
44
44
|
calendarFunctionFullPath: string,
|
45
45
|
dateColumn: AbstractPropertyExpression | undefined,
|
46
46
|
calendarType: QUERY_BUILDER_CALENDAR_TYPE,
|
47
|
-
endDate:
|
47
|
+
endDate: ValueSpecification,
|
48
48
|
targetColumn:
|
49
49
|
| AbstractPropertyExpression
|
50
50
|
| INTERNAL__UnknownValueSpecification,
|
@@ -165,15 +165,16 @@ export const updateAggregateColumnState = (
|
|
165
165
|
|
166
166
|
const endDate = guaranteeType(
|
167
167
|
expression.parametersValues[2],
|
168
|
-
|
168
|
+
ValueSpecification,
|
169
169
|
`Can't process ${extractElementNameFromPath(
|
170
170
|
calendarFunctionFullPath,
|
171
171
|
)}() expression: only support ${extractElementNameFromPath(
|
172
172
|
calendarFunctionFullPath,
|
173
|
-
)}() with third parameter as
|
173
|
+
)}() with third parameter as ValueSpecification`,
|
174
174
|
);
|
175
175
|
assertTrue(
|
176
|
-
endDate.genericType
|
176
|
+
endDate.genericType?.value.rawType.name === PRIMITIVE_TYPE.STRICTDATE ||
|
177
|
+
endDate.genericType?.value.rawType.name === PRIMITIVE_TYPE.DATE ||
|
177
178
|
dateColumn.func.value.genericType.value.rawType.name ===
|
178
179
|
PRIMITIVE_TYPE.DATE,
|
179
180
|
|
@@ -181,7 +182,7 @@ export const updateAggregateColumnState = (
|
|
181
182
|
calendarFunctionFullPath,
|
182
183
|
)}() expression: only support ${extractElementNameFromPath(
|
183
184
|
calendarFunctionFullPath,
|
184
|
-
)}() with third parameter of type
|
185
|
+
)}() with third parameter of type Date`,
|
185
186
|
);
|
186
187
|
|
187
188
|
calendarFunction.calendarType = calendarTypeParameter
|
@@ -48,7 +48,7 @@ export abstract class QueryBuilderPostFilterOperator implements Hashable {
|
|
48
48
|
isCompatibleWithPostFilterColumn(
|
49
49
|
postFilterState: PostFilterConditionState,
|
50
50
|
): boolean {
|
51
|
-
const columnType = postFilterState.
|
51
|
+
const columnType = postFilterState.leftConditionValue.getColumnType();
|
52
52
|
if (columnType) {
|
53
53
|
return this.isCompatibleWithType(columnType);
|
54
54
|
}
|