@finos/legend-application-query 5.2.5 → 5.2.8
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 +22 -11
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +12 -7
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/QueryBuilderSetupPanel.js +1 -1
- package/lib/components/QueryBuilderSetupPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts +2 -0
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +21 -5
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +2 -2
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js +22 -105
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -2
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +8 -10
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +23 -17
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts +2 -2
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js +15 -12
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +2 -2
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +23 -28
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +7 -7
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js +1 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js.map +1 -1
- package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +5 -3
- package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +8 -8
- package/lib/stores/QueryBuilderPreviewDataHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPreviewDataHelper.js +17 -14
- package/lib/stores/QueryBuilderPreviewDataHelper.js.map +1 -1
- package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPropertyEditorState.js +34 -24
- package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts +1 -2
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +17 -26
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts +124 -0
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -0
- package/lib/stores/QueryBuilderStateBuilder.js +310 -0
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -0
- package/lib/stores/{QueryBuilderTestUtils.d.ts → QueryBuilderStateTestUtils.d.ts} +2 -2
- package/lib/stores/QueryBuilderStateTestUtils.d.ts.map +1 -0
- package/lib/stores/{QueryBuilderTestUtils.js → QueryBuilderStateTestUtils.js} +2 -2
- package/lib/stores/QueryBuilderStateTestUtils.js.map +1 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.js +14 -12
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +3 -11
- package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js +10 -319
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts +27 -0
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -0
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +156 -0
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -0
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +37 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.js +79 -2
- package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +14 -9
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +62 -19
- package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts +1 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js +3 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +17 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +10 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts +3 -20
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js +31 -73
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +17 -4
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +110 -21
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +20 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +62 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts +2 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +4 -4
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts +9 -2
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js +28 -5
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js +2 -2
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts +11 -2
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +106 -5
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts +25 -0
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js +186 -0
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts +9 -4
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +129 -13
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts +20 -0
- package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js +96 -0
- package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js +1 -1
- package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.d.ts → QueryBuilderPostFilterStateBuilder.d.ts} +4 -3
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.js → QueryBuilderPostFilterStateBuilder.js} +30 -21
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +1 -4
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +1 -1
- package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts +19 -0
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -0
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +74 -0
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -0
- package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.d.ts → QueryBuilderFilterValueSpecificationBuilder.d.ts} +1 -1
- package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -0
- package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.js → QueryBuilderFilterValueSpecificationBuilder.js} +1 -1
- package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -0
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js +5 -5
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js.map +1 -1
- package/package.json +15 -15
- package/src/components/QueryBuilder.tsx +47 -28
- package/src/components/QueryBuilderResultPanel.tsx +21 -14
- package/src/components/QueryBuilderSetupPanel.tsx +1 -1
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +50 -10
- package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +2 -2
- package/src/components/fetch-structure/QueryBuilderFetchStructurePanel.tsx +41 -175
- package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +9 -12
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +62 -28
- package/src/components/fetch-structure/QueryBuilderProjectionPanel.tsx +74 -48
- package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +33 -41
- package/src/components/filter/QueryBuilderFilterPanel.tsx +7 -7
- package/src/components/shared/QueryBuilderPanelIssueCountBadge.tsx +3 -1
- package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +5 -8
- package/src/stores/QueryBuilderPreviewDataHelper.ts +27 -18
- package/src/stores/QueryBuilderPropertyEditorState.ts +40 -31
- package/src/stores/QueryBuilderState.ts +26 -32
- package/src/stores/QueryBuilderStateBuilder.ts +584 -0
- package/src/stores/{QueryBuilderTestUtils.ts → QueryBuilderStateTestUtils.ts} +1 -1
- package/src/stores/QueryBuilderTypeaheadHelper.ts +23 -16
- package/src/stores/QueryBuilderValueSpecificationBuilder.ts +24 -584
- package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +254 -0
- package/src/stores/QueryBuilderValueSpecificationHelper.ts +114 -0
- package/src/stores/explorer/QueryBuilderExplorerState.ts +93 -32
- package/src/stores/explorer/QueryBuilderPropertySearchPanelState.ts +3 -1
- package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +33 -2
- package/src/stores/fetch-structure/QueryBuilderFetchStructureState.ts +53 -118
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +166 -26
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +131 -0
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +7 -6
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.ts +68 -4
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.ts +2 -2
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionState.ts +182 -3
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +426 -0
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +267 -21
- package/src/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.ts +228 -0
- package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.ts → QueryBuilderPostFilterStateBuilder.ts} +68 -48
- package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +1 -11
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +1 -1
- package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -1
- package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +155 -0
- package/src/stores/filter/{QueryBuilderValueSpecificationBuilder.ts → QueryBuilderFilterValueSpecificationBuilder.ts} +0 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperatorHelper.ts +5 -5
- package/tsconfig.json +10 -5
- package/tsconfig.package.json +1 -1
- package/lib/stores/QueryBuilderTestUtils.d.ts.map +0 -1
- package/lib/stores/QueryBuilderTestUtils.js.map +0 -1
- package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts +0 -56
- package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts.map +0 -1
- package/lib/stores/QueryBuilderValueSpecificationProcessor.js +0 -548
- package/lib/stores/QueryBuilderValueSpecificationProcessor.js.map +0 -1
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.d.ts.map +0 -1
- package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.js.map +0 -1
- package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.d.ts.map +0 -1
- package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.js.map +0 -1
- package/src/stores/QueryBuilderValueSpecificationProcessor.ts +0 -1254
@@ -0,0 +1,254 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
functionExpression_setParametersValues,
|
19
|
+
propertyExpression_setParametersValue,
|
20
|
+
} from '@finos/legend-application';
|
21
|
+
import {
|
22
|
+
AbstractPropertyExpression,
|
23
|
+
Class,
|
24
|
+
DerivedProperty,
|
25
|
+
getMilestoneTemporalStereotype,
|
26
|
+
INTERNAL__PropagatedValue,
|
27
|
+
matchFunctionName,
|
28
|
+
MILESTONING_STEREOTYPE,
|
29
|
+
SimpleFunctionExpression,
|
30
|
+
TYPICAL_MULTIPLICITY_TYPE,
|
31
|
+
type ValueSpecification,
|
32
|
+
} from '@finos/legend-graph';
|
33
|
+
import {
|
34
|
+
getNullableFirstElement,
|
35
|
+
guaranteeNonNullable,
|
36
|
+
guaranteeType,
|
37
|
+
} from '@finos/legend-shared';
|
38
|
+
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../QueryBuilder_Const.js';
|
39
|
+
import { getDerivedPropertyMilestoningSteoreotype } from './QueryBuilderPropertyEditorState.js';
|
40
|
+
import type { QueryBuilderState } from './QueryBuilderState.js';
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Checks if the provided property expression match the criteria for default
|
44
|
+
* date propagation so we know whether we need to fill in values for the parameter
|
45
|
+
* or just propgate values from the parent's expression
|
46
|
+
*
|
47
|
+
* NOTE: this takes date propgation into account. See the table below for all
|
48
|
+
* the combination:
|
49
|
+
*
|
50
|
+
* | [source] | | | | |
|
51
|
+
* ----------------------------------------------------------------------
|
52
|
+
* [target] | | NONE | PR_TMP | BI_TMP | BU_TMP |
|
53
|
+
* ----------------------------------------------------------------------
|
54
|
+
* | NONE | N.A. | PRD | PRD,BUD | BUD |
|
55
|
+
* ----------------------------------------------------------------------
|
56
|
+
* | PR_TMP | N.A. | X | PRD,BUD | BUD |
|
57
|
+
* ----------------------------------------------------------------------
|
58
|
+
* | BI_TMP | N.A. | X | X | X |
|
59
|
+
* ----------------------------------------------------------------------
|
60
|
+
* | BU_TMP | N.A. | PRD | PRD,BUD | X |
|
61
|
+
* ----------------------------------------------------------------------
|
62
|
+
*
|
63
|
+
* Annotations:
|
64
|
+
*
|
65
|
+
* [source]: source temporal type
|
66
|
+
* [target]: target temporal type
|
67
|
+
*
|
68
|
+
* PR_TMP : processing temporal
|
69
|
+
* BI_TMP : bitemporal
|
70
|
+
* BU_TMP : business temporal
|
71
|
+
*
|
72
|
+
* X : no default date propagated
|
73
|
+
* PRD : default processing date is propagated
|
74
|
+
* BUD : default business date is propgated
|
75
|
+
*/
|
76
|
+
const isDefaultDatePropagationSupported = (
|
77
|
+
currentPropertyExpression: AbstractPropertyExpression,
|
78
|
+
queryBuilderState: QueryBuilderState,
|
79
|
+
prevPropertyExpression?: AbstractPropertyExpression | undefined,
|
80
|
+
isDatePropagationNotSupported?: boolean,
|
81
|
+
): boolean => {
|
82
|
+
if (isDatePropagationNotSupported) {
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
const property = currentPropertyExpression.func;
|
86
|
+
const graph = queryBuilderState.graphManagerState.graph;
|
87
|
+
// Default date propagation is not supported for current expression when the previous property expression is a derived property.
|
88
|
+
if (
|
89
|
+
prevPropertyExpression &&
|
90
|
+
prevPropertyExpression.func instanceof DerivedProperty &&
|
91
|
+
prevPropertyExpression.func._OWNER.derivedProperties.includes(
|
92
|
+
prevPropertyExpression.func,
|
93
|
+
)
|
94
|
+
) {
|
95
|
+
return false;
|
96
|
+
}
|
97
|
+
// Default date propagation is not supported for current expression when the milestonedParameterValues of
|
98
|
+
// the previous property expression doesn't match with the global milestonedParameterValues
|
99
|
+
if (
|
100
|
+
prevPropertyExpression &&
|
101
|
+
prevPropertyExpression.func.genericType.value.rawType instanceof Class
|
102
|
+
) {
|
103
|
+
const milestoningStereotype = getMilestoneTemporalStereotype(
|
104
|
+
prevPropertyExpression.func.genericType.value.rawType,
|
105
|
+
graph,
|
106
|
+
);
|
107
|
+
if (
|
108
|
+
milestoningStereotype &&
|
109
|
+
!prevPropertyExpression.parametersValues
|
110
|
+
.slice(1)
|
111
|
+
.every(
|
112
|
+
(parameterValue) =>
|
113
|
+
parameterValue instanceof INTERNAL__PropagatedValue,
|
114
|
+
)
|
115
|
+
) {
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
if (property.genericType.value.rawType instanceof Class) {
|
120
|
+
// the stereotype of source class of current property expression.
|
121
|
+
const sourceStereotype =
|
122
|
+
property instanceof DerivedProperty
|
123
|
+
? getDerivedPropertyMilestoningSteoreotype(property, graph)
|
124
|
+
: undefined;
|
125
|
+
// Default date propagation is always supported if the source is `bitemporal`
|
126
|
+
if (sourceStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
|
127
|
+
return true;
|
128
|
+
}
|
129
|
+
// the stereotype (if exists) of the generic type of current property expression.
|
130
|
+
const targetStereotype = getMilestoneTemporalStereotype(
|
131
|
+
property.genericType.value.rawType,
|
132
|
+
graph,
|
133
|
+
);
|
134
|
+
// Default date propagation is supported when stereotype of both source and target matches
|
135
|
+
if (sourceStereotype && targetStereotype) {
|
136
|
+
return sourceStereotype === targetStereotype;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
return false;
|
140
|
+
};
|
141
|
+
|
142
|
+
export const buildPropertyExpressionChain = (
|
143
|
+
propertyExpression: AbstractPropertyExpression,
|
144
|
+
queryBuilderState: QueryBuilderState,
|
145
|
+
isDatePropagationNotSupported?: boolean,
|
146
|
+
): ValueSpecification => {
|
147
|
+
const graph = queryBuilderState.graphManagerState.graph;
|
148
|
+
const newPropertyExpression = new AbstractPropertyExpression(
|
149
|
+
'',
|
150
|
+
graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE),
|
151
|
+
);
|
152
|
+
newPropertyExpression.func = propertyExpression.func;
|
153
|
+
newPropertyExpression.parametersValues = propertyExpression.parametersValues;
|
154
|
+
|
155
|
+
let nextExpression: ValueSpecification | undefined;
|
156
|
+
let currentExpression: ValueSpecification | undefined = newPropertyExpression;
|
157
|
+
while (currentExpression instanceof AbstractPropertyExpression) {
|
158
|
+
nextExpression = getNullableFirstElement(
|
159
|
+
currentExpression.parametersValues,
|
160
|
+
);
|
161
|
+
if (nextExpression instanceof AbstractPropertyExpression) {
|
162
|
+
const parameterValue = new AbstractPropertyExpression(
|
163
|
+
'',
|
164
|
+
graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE),
|
165
|
+
);
|
166
|
+
parameterValue.func = nextExpression.func;
|
167
|
+
parameterValue.parametersValues = nextExpression.parametersValues;
|
168
|
+
nextExpression = parameterValue;
|
169
|
+
currentExpression.parametersValues[0] = parameterValue;
|
170
|
+
}
|
171
|
+
if (currentExpression.func instanceof DerivedProperty) {
|
172
|
+
const parameterValues = currentExpression.parametersValues.slice(1);
|
173
|
+
parameterValues.forEach((parameterValue, index) => {
|
174
|
+
if (parameterValue instanceof INTERNAL__PropagatedValue) {
|
175
|
+
// Replace with argumentless derived property expression only when default date propagation is supported
|
176
|
+
if (
|
177
|
+
isDefaultDatePropagationSupported(
|
178
|
+
guaranteeType(currentExpression, AbstractPropertyExpression),
|
179
|
+
queryBuilderState,
|
180
|
+
nextExpression instanceof AbstractPropertyExpression
|
181
|
+
? nextExpression
|
182
|
+
: undefined,
|
183
|
+
isDatePropagationNotSupported,
|
184
|
+
)
|
185
|
+
) {
|
186
|
+
// NOTE: For `bitemporal` property check if the property expression has parameters which are not instance of
|
187
|
+
// `INTERNAL_PropagatedValue` then pass the parameters as user explicitly changed values of either of the parameters.
|
188
|
+
if (
|
189
|
+
(index === 1 &&
|
190
|
+
guaranteeType(currentExpression, AbstractPropertyExpression)
|
191
|
+
.parametersValues.length === 3) ||
|
192
|
+
(index === 0 &&
|
193
|
+
guaranteeType(currentExpression, AbstractPropertyExpression)
|
194
|
+
.parametersValues.length === 3 &&
|
195
|
+
!(
|
196
|
+
guaranteeType(currentExpression, AbstractPropertyExpression)
|
197
|
+
.parametersValues[2] instanceof INTERNAL__PropagatedValue
|
198
|
+
))
|
199
|
+
) {
|
200
|
+
propertyExpression_setParametersValue(
|
201
|
+
guaranteeType(currentExpression, AbstractPropertyExpression),
|
202
|
+
index + 1,
|
203
|
+
parameterValue.getValue(),
|
204
|
+
queryBuilderState.observableContext,
|
205
|
+
);
|
206
|
+
} else {
|
207
|
+
functionExpression_setParametersValues(
|
208
|
+
guaranteeType(currentExpression, AbstractPropertyExpression),
|
209
|
+
[
|
210
|
+
guaranteeNonNullable(
|
211
|
+
guaranteeType(currentExpression, AbstractPropertyExpression)
|
212
|
+
.parametersValues[0],
|
213
|
+
),
|
214
|
+
],
|
215
|
+
queryBuilderState.observableContext,
|
216
|
+
);
|
217
|
+
}
|
218
|
+
} else {
|
219
|
+
propertyExpression_setParametersValue(
|
220
|
+
guaranteeType(currentExpression, AbstractPropertyExpression),
|
221
|
+
index + 1,
|
222
|
+
parameterValue.getValue(),
|
223
|
+
queryBuilderState.observableContext,
|
224
|
+
);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
});
|
228
|
+
}
|
229
|
+
currentExpression = nextExpression;
|
230
|
+
// Take care of chains of subtype (a pattern that is not useful, but we want to support and rectify)
|
231
|
+
// $x.employees->subType(@Person)->subType(@Staff)
|
232
|
+
while (
|
233
|
+
currentExpression instanceof SimpleFunctionExpression &&
|
234
|
+
matchFunctionName(
|
235
|
+
currentExpression.functionName,
|
236
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE,
|
237
|
+
)
|
238
|
+
) {
|
239
|
+
currentExpression = getNullableFirstElement(
|
240
|
+
currentExpression.parametersValues,
|
241
|
+
);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
return newPropertyExpression;
|
245
|
+
};
|
246
|
+
|
247
|
+
export type LambdaFunctionBuilderOption = {
|
248
|
+
/**
|
249
|
+
* Set queryBuilderState to `true` when we construct query for execution within the app.
|
250
|
+
* queryBuilderState will make the lambda function building process overrides several query values, such as the row limit.
|
251
|
+
*/
|
252
|
+
isBuildingExecutionQuery?: boolean | undefined;
|
253
|
+
keepSourceInformation?: boolean | undefined;
|
254
|
+
};
|
@@ -36,15 +36,22 @@ import {
|
|
36
36
|
extractElementNameFromPath,
|
37
37
|
AbstractPropertyExpression,
|
38
38
|
isSuperType,
|
39
|
+
Class,
|
40
|
+
getMilestoneTemporalStereotype,
|
41
|
+
DerivedProperty,
|
42
|
+
MILESTONING_STEREOTYPE,
|
39
43
|
} from '@finos/legend-graph';
|
40
44
|
import {
|
41
45
|
addUniqueEntry,
|
42
46
|
guaranteeNonNullable,
|
43
47
|
guaranteeType,
|
48
|
+
isNumber,
|
49
|
+
isString,
|
44
50
|
UnsupportedOperationError,
|
45
51
|
} from '@finos/legend-shared';
|
46
52
|
import { format } from 'date-fns';
|
47
53
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../QueryBuilder_Const.js';
|
54
|
+
import { getDerivedPropertyMilestoningSteoreotype } from './QueryBuilderPropertyEditorState.js';
|
48
55
|
|
49
56
|
export const getNonCollectionValueSpecificationType = (
|
50
57
|
valueSpecification: ValueSpecification,
|
@@ -243,3 +250,110 @@ export const buildGenericLambdaFunctionInstanceValue = (
|
|
243
250
|
functionInstanceValue.values.push(lambdaFunction);
|
244
251
|
return functionInstanceValue;
|
245
252
|
};
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Checks if the milestoning property expression is valid in terms of number of parameter values provided
|
256
|
+
* in relation to its milestoning type.
|
257
|
+
*
|
258
|
+
* NOTE: this takes date propgation into account. See the table below for all
|
259
|
+
* the combination:
|
260
|
+
*
|
261
|
+
* | [source] | | | | |
|
262
|
+
* ----------------------------------------------------------------------
|
263
|
+
* [target] | | NONE | PR_TMP | BI_TMP | BU_TMP |
|
264
|
+
* ----------------------------------------------------------------------
|
265
|
+
* | NONE | N.A. | PRD | PRD,BUD | BUD |
|
266
|
+
* ----------------------------------------------------------------------
|
267
|
+
* | PR_TMP | N.A. | X | PRD,BUD | BUD |
|
268
|
+
* ----------------------------------------------------------------------
|
269
|
+
* | BI_TMP | N.A. | X | X | X |
|
270
|
+
* ----------------------------------------------------------------------
|
271
|
+
* | BU_TMP | N.A. | PRD | PRD,BUD | X |
|
272
|
+
* ----------------------------------------------------------------------
|
273
|
+
*
|
274
|
+
* Annotations:
|
275
|
+
*
|
276
|
+
* [source]: source temporal type
|
277
|
+
* [target]: target temporal type
|
278
|
+
*
|
279
|
+
* PR_TMP : processing temporal
|
280
|
+
* BI_TMP : bitemporal
|
281
|
+
* BU_TMP : business temporal
|
282
|
+
*
|
283
|
+
* X : no default date propagated
|
284
|
+
* PRD : default processing date is propagated
|
285
|
+
* BUD : default business date is propgated
|
286
|
+
*/
|
287
|
+
export const validatePropertyExpressionChain = (
|
288
|
+
propertyExpression: AbstractPropertyExpression,
|
289
|
+
graph: PureModel,
|
290
|
+
): void => {
|
291
|
+
if (
|
292
|
+
propertyExpression.func.genericType.value.rawType instanceof Class &&
|
293
|
+
propertyExpression.func._OWNER._generatedMilestonedProperties.length !== 0
|
294
|
+
) {
|
295
|
+
const name = propertyExpression.func.name;
|
296
|
+
const func =
|
297
|
+
propertyExpression.func._OWNER._generatedMilestonedProperties.find(
|
298
|
+
(e) => e.name === name,
|
299
|
+
);
|
300
|
+
if (func) {
|
301
|
+
const targetStereotype = getMilestoneTemporalStereotype(
|
302
|
+
propertyExpression.func.genericType.value.rawType,
|
303
|
+
graph,
|
304
|
+
);
|
305
|
+
|
306
|
+
if (targetStereotype) {
|
307
|
+
const sourceStereotype = getDerivedPropertyMilestoningSteoreotype(
|
308
|
+
guaranteeType(func, DerivedProperty),
|
309
|
+
graph,
|
310
|
+
);
|
311
|
+
if (
|
312
|
+
sourceStereotype !== MILESTONING_STEREOTYPE.BITEMPORAL &&
|
313
|
+
targetStereotype !== sourceStereotype
|
314
|
+
) {
|
315
|
+
if (targetStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
|
316
|
+
if (
|
317
|
+
propertyExpression.parametersValues.length !== 3 &&
|
318
|
+
!sourceStereotype
|
319
|
+
) {
|
320
|
+
throw new UnsupportedOperationError(
|
321
|
+
`Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have exactly two parameters`,
|
322
|
+
);
|
323
|
+
} else if (propertyExpression.parametersValues.length < 2) {
|
324
|
+
throw new UnsupportedOperationError(
|
325
|
+
`Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have at least one parameter`,
|
326
|
+
);
|
327
|
+
} else if (propertyExpression.parametersValues.length > 3) {
|
328
|
+
throw new UnsupportedOperationError(
|
329
|
+
`Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should not have more than two parameters`,
|
330
|
+
);
|
331
|
+
}
|
332
|
+
} else if (propertyExpression.parametersValues.length !== 2) {
|
333
|
+
throw new UnsupportedOperationError(
|
334
|
+
`Property of milestoning sterotype '${targetStereotype}' should have exactly one parameter`,
|
335
|
+
);
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
};
|
342
|
+
|
343
|
+
export const extractNullableStringFromInstanceValue = (
|
344
|
+
value: ValueSpecification,
|
345
|
+
): string | undefined => {
|
346
|
+
if (value instanceof PrimitiveInstanceValue && isString(value.values[0])) {
|
347
|
+
return value.values[0];
|
348
|
+
}
|
349
|
+
return undefined;
|
350
|
+
};
|
351
|
+
|
352
|
+
export const extractNullableNumberFromInstanceValue = (
|
353
|
+
value: ValueSpecification,
|
354
|
+
): number | undefined => {
|
355
|
+
if (value instanceof PrimitiveInstanceValue && isNumber(value.values[0])) {
|
356
|
+
return value.values[0];
|
357
|
+
}
|
358
|
+
return undefined;
|
359
|
+
};
|
@@ -57,6 +57,7 @@ import {
|
|
57
57
|
PRIMITIVE_TYPE,
|
58
58
|
TdsExecutionResult,
|
59
59
|
type ExecutionResult,
|
60
|
+
getAllSubclasses,
|
60
61
|
} from '@finos/legend-graph';
|
61
62
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
62
63
|
import {
|
@@ -76,7 +77,7 @@ import {
|
|
76
77
|
buildNumericPreviewDataQuery,
|
77
78
|
type QueryBuilderPreviewData,
|
78
79
|
} from '../QueryBuilderPreviewDataHelper.js';
|
79
|
-
import {
|
80
|
+
import { QueryBuilderPropertySearchState } from './QueryBuilderPropertySearchPanelState.js';
|
80
81
|
|
81
82
|
export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
|
82
83
|
ROOT = 'ROOT',
|
@@ -85,6 +86,16 @@ export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
|
|
85
86
|
PRIMITIVE_PROPERTY = 'PRIMITIVE_PROPERTY',
|
86
87
|
}
|
87
88
|
|
89
|
+
export const generateExplorerTreePropertyNodeID = (
|
90
|
+
parentId: string,
|
91
|
+
propertyName: string,
|
92
|
+
): string => `${parentId ? `${parentId}.` : ''}${propertyName}`;
|
93
|
+
|
94
|
+
export const generateExplorerTreeSubtypeNodeID = (
|
95
|
+
parentId: string,
|
96
|
+
subClassPath: string,
|
97
|
+
): string => `${parentId ? parentId : ''}${TYPE_CAST_TOKEN}${subClassPath}`;
|
98
|
+
|
88
99
|
export interface QueryBuilderExplorerTreeDragSource {
|
89
100
|
node: QueryBuilderExplorerTreePropertyNodeData;
|
90
101
|
}
|
@@ -98,7 +109,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
98
109
|
childrenIds: string[] = [];
|
99
110
|
isPartOfDerivedPropertyBranch: boolean;
|
100
111
|
type: Type;
|
101
|
-
mappingData:
|
112
|
+
mappingData: QueryBuilderExplorerTreeNodeMappingData;
|
102
113
|
|
103
114
|
constructor(
|
104
115
|
id: string,
|
@@ -106,7 +117,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
106
117
|
dndText: string,
|
107
118
|
isPartOfDerivedPropertyBranch: boolean,
|
108
119
|
type: Type,
|
109
|
-
mappingData:
|
120
|
+
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
110
121
|
) {
|
111
122
|
makeObservable(this, {
|
112
123
|
isSelected: observable,
|
@@ -126,7 +137,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
126
137
|
}
|
127
138
|
}
|
128
139
|
|
129
|
-
export type
|
140
|
+
export type QueryBuilderExplorerTreeNodeMappingData = {
|
130
141
|
mapped: boolean;
|
131
142
|
mappedEntity?: MappedEntity | undefined;
|
132
143
|
};
|
@@ -144,7 +155,7 @@ export class QueryBuilderExplorerTreePropertyNodeData extends QueryBuilderExplor
|
|
144
155
|
property: AbstractProperty,
|
145
156
|
parentId: string,
|
146
157
|
isPartOfDerivedPropertyBranch: boolean,
|
147
|
-
mappingData:
|
158
|
+
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
148
159
|
) {
|
149
160
|
super(
|
150
161
|
id,
|
@@ -171,7 +182,7 @@ export class QueryBuilderExplorerTreeSubTypeNodeData extends QueryBuilderExplore
|
|
171
182
|
subclass: Class,
|
172
183
|
parentId: string,
|
173
184
|
isPartOfDerivedPropertyBranch: boolean,
|
174
|
-
mappingData:
|
185
|
+
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
175
186
|
multiplicity: Multiplicity,
|
176
187
|
) {
|
177
188
|
super(
|
@@ -216,6 +227,16 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
216
227
|
parentNode instanceof QueryBuilderExplorerTreePropertyNodeData ||
|
217
228
|
parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData
|
218
229
|
) {
|
230
|
+
// NOTE: here, we deliverately simplify subtypes chain
|
231
|
+
// $x.employees->subType(@Person)->subType(@Staff).department will be simplified to $x.employees->subType(@Staff).department
|
232
|
+
if (
|
233
|
+
parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData &&
|
234
|
+
currentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData
|
235
|
+
) {
|
236
|
+
parentNode = treeData.nodes.get(parentNode.parentId);
|
237
|
+
continue;
|
238
|
+
}
|
239
|
+
|
219
240
|
let parentPropertyExpression;
|
220
241
|
if (parentNode instanceof QueryBuilderExplorerTreeSubTypeNodeData) {
|
221
242
|
parentPropertyExpression = new SimpleFunctionExpression(
|
@@ -272,11 +293,11 @@ export const buildPropertyExpressionFromExplorerTreeNodeData = (
|
|
272
293
|
|
273
294
|
export const generatePropertyNodeMappingData = (
|
274
295
|
property: AbstractProperty,
|
275
|
-
parentMappingData:
|
296
|
+
parentMappingData: QueryBuilderExplorerTreeNodeMappingData,
|
276
297
|
modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
|
277
|
-
):
|
278
|
-
// If
|
279
|
-
//
|
298
|
+
): QueryBuilderExplorerTreeNodeMappingData => {
|
299
|
+
// If the property node's parent node does not have a mapped entity,
|
300
|
+
// it means the owner class is not mapped, i.e. this property is not mapped.
|
280
301
|
if (parentMappingData.mappedEntity) {
|
281
302
|
const mappedProp = parentMappingData.mappedEntity.__PROPERTIES_INDEX.get(
|
282
303
|
property.name,
|
@@ -301,25 +322,57 @@ export const generatePropertyNodeMappingData = (
|
|
301
322
|
return { mapped: false };
|
302
323
|
};
|
303
324
|
|
304
|
-
const generateSubtypeNodeMappingData = (
|
325
|
+
export const generateSubtypeNodeMappingData = (
|
305
326
|
subclass: Class,
|
306
|
-
parentMappingData:
|
327
|
+
parentMappingData: QueryBuilderExplorerTreeNodeMappingData,
|
307
328
|
modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
|
308
|
-
):
|
309
|
-
//
|
310
|
-
//
|
329
|
+
): QueryBuilderExplorerTreeNodeMappingData => {
|
330
|
+
// NOTE: since we build subclass trees, there's a chance in a particular case,
|
331
|
+
// a _deep_ subclass is mapped, for example: A extends B extends C extends D ... extends Z
|
332
|
+
// and Z is mapped, when we build the mapping data for node A, B, C, we need to make sure
|
333
|
+
// we are aware of the fact that Z is mapped and pass the mapping data information properly
|
334
|
+
// until we process the node Z.
|
335
|
+
const allCompatibleTypePaths = getAllSubclasses(subclass)
|
336
|
+
.concat(subclass)
|
337
|
+
.map((_class) => _class.path);
|
338
|
+
// If the subtype node's parent node does not have a mapped entity,
|
339
|
+
// it means the superclass is not mapped, i.e. this subtype is not mapped
|
311
340
|
if (parentMappingData.mappedEntity) {
|
312
|
-
const
|
313
|
-
(
|
341
|
+
const mappedSubtype = parentMappingData.mappedEntity.properties.find(
|
342
|
+
(mappedProperty): mappedProperty is EntityMappedProperty =>
|
343
|
+
Boolean(
|
344
|
+
// NOTE: if `subType` is specified in `EntityMappedProperty` it means
|
345
|
+
// that subtype is mapped
|
346
|
+
mappedProperty instanceof EntityMappedProperty &&
|
347
|
+
mappedProperty.subType &&
|
348
|
+
allCompatibleTypePaths.includes(mappedProperty.subType),
|
349
|
+
),
|
314
350
|
);
|
315
|
-
if (
|
351
|
+
if (mappedSubtype) {
|
316
352
|
return {
|
317
353
|
mapped: true,
|
318
354
|
mappedEntity: modelCoverageAnalysisResult.__ENTITIES_INDEX.get(
|
319
|
-
|
355
|
+
mappedSubtype.entityPath,
|
320
356
|
),
|
321
357
|
};
|
322
|
-
} else if (
|
358
|
+
} else if (
|
359
|
+
allCompatibleTypePaths.includes(parentMappingData.mappedEntity.path)
|
360
|
+
) {
|
361
|
+
// This is to handle the case where the property mapping is pointing
|
362
|
+
// directly at the class mapping of a subtype of the type of that property
|
363
|
+
//
|
364
|
+
// For example: we have class `A` extends `B`, and we're looking at class `C` with property
|
365
|
+
// `b` of type B. However, the mapping we use has property mapping for `b` pointing at
|
366
|
+
// a class mapping for `A`.
|
367
|
+
//
|
368
|
+
// In this case, when building explorer tree node for property `b` of `C`, according to
|
369
|
+
// the mapping model coverage result, the mapped entity corresponding to this property
|
370
|
+
// will be mapped entity for `A`. However, as we build the explorer tree,
|
371
|
+
// so we will not immediately build the subtype node for `A`. As such, we have to propagate
|
372
|
+
// the mapped entity data downstream like the following. As a result, when building
|
373
|
+
// the mapping data for subtype node, we have to take this case into consideration
|
374
|
+
//
|
375
|
+
// See https://github.com/finos/legend-studio/issues/1437
|
323
376
|
return {
|
324
377
|
mapped: true,
|
325
378
|
mappedEntity: parentMappingData.mappedEntity,
|
@@ -332,7 +385,7 @@ const generateSubtypeNodeMappingData = (
|
|
332
385
|
export const getRootMappingData = (
|
333
386
|
_class: Class,
|
334
387
|
modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
|
335
|
-
):
|
388
|
+
): QueryBuilderExplorerTreeNodeMappingData => ({
|
336
389
|
mapped: true,
|
337
390
|
mappedEntity: modelCoverageAnalysisResult.__ENTITIES_INDEX.get(_class.path),
|
338
391
|
});
|
@@ -385,11 +438,12 @@ export const getQueryBuilderPropertyNodeData = (
|
|
385
438
|
return undefined;
|
386
439
|
}
|
387
440
|
const propertyNode = new QueryBuilderExplorerTreePropertyNodeData(
|
388
|
-
|
441
|
+
generateExplorerTreePropertyNodeID(
|
389
442
|
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
390
443
|
? ''
|
391
|
-
:
|
392
|
-
|
444
|
+
: parentNode.id,
|
445
|
+
property.name,
|
446
|
+
),
|
393
447
|
property.name,
|
394
448
|
`${
|
395
449
|
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
@@ -414,11 +468,12 @@ export const getQueryBuilderSubTypeNodeData = (
|
|
414
468
|
modelCoverageAnalysisResult: MappingModelCoverageAnalysisResult,
|
415
469
|
): QueryBuilderExplorerTreeSubTypeNodeData => {
|
416
470
|
const subTypeNode = new QueryBuilderExplorerTreeSubTypeNodeData(
|
417
|
-
|
471
|
+
generateExplorerTreeSubtypeNodeID(
|
418
472
|
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
419
|
-
?
|
420
|
-
:
|
421
|
-
|
473
|
+
? ''
|
474
|
+
: parentNode.id,
|
475
|
+
subclass.path,
|
476
|
+
),
|
422
477
|
subclass.name,
|
423
478
|
`${
|
424
479
|
parentNode instanceof QueryBuilderExplorerTreeRootNodeData
|
@@ -464,7 +519,6 @@ const getQueryBuilderTreeData = (
|
|
464
519
|
'@dummy_rootNode',
|
465
520
|
rootClass.name,
|
466
521
|
rootClass.path,
|
467
|
-
|
468
522
|
false,
|
469
523
|
rootClass,
|
470
524
|
mappingData,
|
@@ -536,7 +590,8 @@ export class QueryBuilderExplorerState {
|
|
536
590
|
treeData?: TreeData<QueryBuilderExplorerTreeNodeData> | undefined;
|
537
591
|
humanizePropertyName = true;
|
538
592
|
showUnmappedProperties = false;
|
539
|
-
|
593
|
+
highlightUsedProperties = true;
|
594
|
+
propertySearchState: QueryBuilderPropertySearchState;
|
540
595
|
mappingModelCoverageAnalysisResult?: MappingModelCoverageAnalysisResult;
|
541
596
|
mappingModelCoverageAnalysisState = ActionState.create();
|
542
597
|
|
@@ -545,17 +600,19 @@ export class QueryBuilderExplorerState {
|
|
545
600
|
queryBuilderState: false,
|
546
601
|
previewDataState: false,
|
547
602
|
treeData: observable.ref,
|
603
|
+
highlightUsedProperties: observable,
|
548
604
|
setTreeData: action,
|
549
605
|
refreshTree: action,
|
550
606
|
refreshTreeData: action,
|
551
607
|
setHumanizePropertyName: action,
|
552
608
|
setShowUnmappedProperties: action,
|
553
609
|
previewData: flow,
|
610
|
+
setHighlightUsedProperties: action,
|
554
611
|
analyzeMappingModelCoverage: flow,
|
555
612
|
});
|
556
613
|
|
557
614
|
this.queryBuilderState = queryBuilderState;
|
558
|
-
this.
|
615
|
+
this.propertySearchState = new QueryBuilderPropertySearchState(
|
559
616
|
this.queryBuilderState,
|
560
617
|
);
|
561
618
|
}
|
@@ -587,6 +644,10 @@ export class QueryBuilderExplorerState {
|
|
587
644
|
this.showUnmappedProperties = val;
|
588
645
|
}
|
589
646
|
|
647
|
+
setHighlightUsedProperties(val: boolean): void {
|
648
|
+
this.highlightUsedProperties = val;
|
649
|
+
}
|
650
|
+
|
590
651
|
refreshTreeData(): void {
|
591
652
|
const _class = this.queryBuilderState.querySetupState._class;
|
592
653
|
const _mapping = this.queryBuilderState.querySetupState.mapping;
|
@@ -658,7 +719,7 @@ export class QueryBuilderExplorerState {
|
|
658
719
|
this.queryBuilderState.explorerState.nonNullableTreeData,
|
659
720
|
node,
|
660
721
|
this.queryBuilderState.graphManagerState.graph,
|
661
|
-
this.queryBuilderState.explorerState.
|
722
|
+
this.queryBuilderState.explorerState.propertySearchState
|
662
723
|
.allMappedPropertyNodes,
|
663
724
|
);
|
664
725
|
const propertyType = node.property.genericType.value.rawType;
|
@@ -42,8 +42,10 @@ import {
|
|
42
42
|
} from './QueryBuilderExplorerState.js';
|
43
43
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
44
44
|
|
45
|
-
export class
|
45
|
+
export class QueryBuilderPropertySearchState {
|
46
46
|
queryBuilderState: QueryBuilderState;
|
47
|
+
// TODO: Check if we could clean this up as this seems quite complicated and its purpose is not clear to me
|
48
|
+
// See https://github.com/finos/legend-studio/pull/1212
|
47
49
|
allMappedPropertyNodes: QueryBuilderExplorerTreeNodeData[] = [];
|
48
50
|
searchedMappedPropertyNodes: QueryBuilderExplorerTreeNodeData[] = [];
|
49
51
|
isSearchPanelOpen = false;
|