@finos/legend-application-query 5.2.6 → 5.2.7
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 +1 -2
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +14 -16
- 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 +7 -7
- 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 +153 -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 +12 -11
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +53 -20
- 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 +3 -8
- 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 +10 -2
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +102 -39
- 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 +14 -14
- 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 +23 -38
- 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 +248 -0
- package/src/stores/QueryBuilderValueSpecificationHelper.ts +114 -0
- package/src/stores/explorer/QueryBuilderExplorerState.ts +73 -33
- 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 +10 -19
- 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 +172 -67
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +426 -0
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +266 -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
package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts
CHANGED
@@ -20,14 +20,31 @@ import {
|
|
20
20
|
extractElementNameFromPath,
|
21
21
|
GenericType,
|
22
22
|
GenericTypeExplicitReference,
|
23
|
-
matchFunctionName,
|
24
23
|
Multiplicity,
|
25
24
|
PrimitiveInstanceValue,
|
26
25
|
PRIMITIVE_TYPE,
|
27
26
|
SimpleFunctionExpression,
|
28
27
|
TYPICAL_MULTIPLICITY_TYPE,
|
28
|
+
type ValueSpecification,
|
29
|
+
INTERNAL__UnknownValueSpecification,
|
30
|
+
V1_serializeRawValueSpecification,
|
31
|
+
V1_transformRawLambda,
|
32
|
+
V1_GraphTransformerContextBuilder,
|
33
|
+
matchFunctionName,
|
29
34
|
} from '@finos/legend-graph';
|
35
|
+
import {
|
36
|
+
guaranteeNonNullable,
|
37
|
+
UnsupportedOperationError,
|
38
|
+
} from '@finos/legend-shared';
|
30
39
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../QueryBuilder_Const.js';
|
40
|
+
import { buildPropertyExpressionChain } from '../../QueryBuilderValueSpecificationBuilderHelper.js';
|
41
|
+
import { buildGenericLambdaFunctionInstanceValue } from '../../QueryBuilderValueSpecificationHelper.js';
|
42
|
+
import { appendPostFilter } from './post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js';
|
43
|
+
import {
|
44
|
+
QueryBuilderDerivationProjectionColumnState,
|
45
|
+
QueryBuilderSimpleProjectionColumnState,
|
46
|
+
} from './QueryBuilderProjectionColumnState.js';
|
47
|
+
import type { QueryBuilderProjectionState } from './QueryBuilderProjectionState.js';
|
31
48
|
import {
|
32
49
|
COLUMN_SORT_TYPE,
|
33
50
|
type QueryResultSetModifierState,
|
@@ -64,8 +81,8 @@ const buildSortExpression = (
|
|
64
81
|
return sortColumnFunction;
|
65
82
|
};
|
66
83
|
|
67
|
-
|
68
|
-
|
84
|
+
const appendResultSetModifier = (
|
85
|
+
resultModifierState: QueryResultSetModifierState,
|
69
86
|
lambda: LambdaFunction,
|
70
87
|
options?:
|
71
88
|
| {
|
@@ -74,30 +91,23 @@ export const appendResultSetModifiers = (
|
|
74
91
|
| undefined,
|
75
92
|
): LambdaFunction => {
|
76
93
|
const multiplicityOne =
|
77
|
-
|
94
|
+
resultModifierState.projectionState.queryBuilderState.graphManagerState.graph.getTypicalMultiplicity(
|
78
95
|
TYPICAL_MULTIPLICITY_TYPE.ONE,
|
79
96
|
);
|
80
97
|
if (lambda.expressionSequence.length === 1) {
|
81
98
|
const func = lambda.expressionSequence[0];
|
82
99
|
if (func instanceof SimpleFunctionExpression) {
|
83
100
|
if (
|
84
|
-
matchFunctionName(
|
85
|
-
func.functionName,
|
101
|
+
matchFunctionName(func.functionName, [
|
86
102
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
|
87
|
-
) ||
|
88
|
-
matchFunctionName(
|
89
|
-
func.functionName,
|
90
103
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
|
91
|
-
) ||
|
92
|
-
matchFunctionName(
|
93
|
-
func.functionName,
|
94
104
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
|
95
|
-
)
|
105
|
+
])
|
96
106
|
) {
|
97
107
|
let currentExpression = func;
|
98
108
|
|
99
109
|
// build distinct()
|
100
|
-
if (
|
110
|
+
if (resultModifierState.distinct) {
|
101
111
|
const distinctFunction = new SimpleFunctionExpression(
|
102
112
|
extractElementNameFromPath(
|
103
113
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_DISTINCT,
|
@@ -109,7 +119,7 @@ export const appendResultSetModifiers = (
|
|
109
119
|
}
|
110
120
|
|
111
121
|
// build sort()
|
112
|
-
if (
|
122
|
+
if (resultModifierState.sortColumns.length) {
|
113
123
|
const sortFunction = new SimpleFunctionExpression(
|
114
124
|
extractElementNameFromPath(
|
115
125
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_SORT,
|
@@ -117,26 +127,26 @@ export const appendResultSetModifiers = (
|
|
117
127
|
multiplicityOne,
|
118
128
|
);
|
119
129
|
const multiplicity = new Multiplicity(
|
120
|
-
|
121
|
-
|
130
|
+
resultModifierState.sortColumns.length,
|
131
|
+
resultModifierState.sortColumns.length,
|
122
132
|
);
|
123
133
|
const collection = new CollectionInstanceValue(
|
124
134
|
multiplicity,
|
125
135
|
undefined,
|
126
136
|
);
|
127
137
|
collection.values =
|
128
|
-
|
138
|
+
resultModifierState.sortColumns.map(buildSortExpression);
|
129
139
|
sortFunction.parametersValues[0] = currentExpression;
|
130
140
|
sortFunction.parametersValues[1] = collection;
|
131
141
|
currentExpression = sortFunction;
|
132
142
|
}
|
133
143
|
|
134
144
|
// build take()
|
135
|
-
if (
|
145
|
+
if (resultModifierState.limit || options?.overridingLimit) {
|
136
146
|
const limit = new PrimitiveInstanceValue(
|
137
147
|
GenericTypeExplicitReference.create(
|
138
148
|
new GenericType(
|
139
|
-
|
149
|
+
resultModifierState.projectionState.queryBuilderState.graphManagerState.graph.getPrimitiveType(
|
140
150
|
PRIMITIVE_TYPE.INTEGER,
|
141
151
|
),
|
142
152
|
),
|
@@ -145,7 +155,7 @@ export const appendResultSetModifiers = (
|
|
145
155
|
);
|
146
156
|
limit.values = [
|
147
157
|
Math.min(
|
148
|
-
|
158
|
+
resultModifierState.limit ?? Number.MAX_SAFE_INTEGER,
|
149
159
|
options?.overridingLimit ?? Number.MAX_SAFE_INTEGER,
|
150
160
|
),
|
151
161
|
];
|
@@ -168,3 +178,238 @@ export const appendResultSetModifiers = (
|
|
168
178
|
}
|
169
179
|
return lambda;
|
170
180
|
};
|
181
|
+
|
182
|
+
export const appendProjection = (
|
183
|
+
projectionState: QueryBuilderProjectionState,
|
184
|
+
lambdaFunction: LambdaFunction,
|
185
|
+
options?: {
|
186
|
+
/**
|
187
|
+
* Set queryBuilderState to `true` when we construct query for execution within the app.
|
188
|
+
* queryBuilderState will make the lambda function building process overrides several query values, such as the row limit.
|
189
|
+
*/
|
190
|
+
isBuildingExecutionQuery?: boolean | undefined;
|
191
|
+
keepSourceInformation?: boolean | undefined;
|
192
|
+
},
|
193
|
+
): void => {
|
194
|
+
const queryBuilderState = projectionState.queryBuilderState;
|
195
|
+
const precedingExpression = guaranteeNonNullable(
|
196
|
+
lambdaFunction.expressionSequence[0],
|
197
|
+
`Can't build projection expression: preceding expression is not defined`,
|
198
|
+
);
|
199
|
+
const multiplicityOne =
|
200
|
+
queryBuilderState.graphManagerState.graph.getTypicalMultiplicity(
|
201
|
+
TYPICAL_MULTIPLICITY_TYPE.ONE,
|
202
|
+
);
|
203
|
+
const typeString = queryBuilderState.graphManagerState.graph.getPrimitiveType(
|
204
|
+
PRIMITIVE_TYPE.STRING,
|
205
|
+
);
|
206
|
+
|
207
|
+
// build projection
|
208
|
+
if (projectionState.aggregationState.columns.length) {
|
209
|
+
// aggregation
|
210
|
+
const groupByFunction = new SimpleFunctionExpression(
|
211
|
+
extractElementNameFromPath(
|
212
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
|
213
|
+
),
|
214
|
+
multiplicityOne,
|
215
|
+
);
|
216
|
+
|
217
|
+
const colLambdas = new CollectionInstanceValue(
|
218
|
+
new Multiplicity(
|
219
|
+
projectionState.columns.length -
|
220
|
+
projectionState.aggregationState.columns.length,
|
221
|
+
projectionState.columns.length -
|
222
|
+
projectionState.aggregationState.columns.length,
|
223
|
+
),
|
224
|
+
);
|
225
|
+
const aggregateLambdas = new CollectionInstanceValue(
|
226
|
+
new Multiplicity(
|
227
|
+
projectionState.aggregationState.columns.length,
|
228
|
+
projectionState.aggregationState.columns.length,
|
229
|
+
),
|
230
|
+
);
|
231
|
+
const colAliases = new CollectionInstanceValue(
|
232
|
+
new Multiplicity(
|
233
|
+
projectionState.columns.length,
|
234
|
+
projectionState.columns.length,
|
235
|
+
),
|
236
|
+
);
|
237
|
+
projectionState.columns.forEach((projectionColumnState) => {
|
238
|
+
// column alias
|
239
|
+
const colAlias = new PrimitiveInstanceValue(
|
240
|
+
GenericTypeExplicitReference.create(new GenericType(typeString)),
|
241
|
+
multiplicityOne,
|
242
|
+
);
|
243
|
+
colAlias.values.push(projectionColumnState.columnName);
|
244
|
+
colAliases.values.push(colAlias);
|
245
|
+
|
246
|
+
const aggregateColumnState =
|
247
|
+
projectionState.aggregationState.columns.find(
|
248
|
+
(column) => column.projectionColumnState === projectionColumnState,
|
249
|
+
);
|
250
|
+
|
251
|
+
// column projection
|
252
|
+
let columnLambda: ValueSpecification;
|
253
|
+
if (
|
254
|
+
projectionColumnState instanceof QueryBuilderSimpleProjectionColumnState
|
255
|
+
) {
|
256
|
+
columnLambda = buildGenericLambdaFunctionInstanceValue(
|
257
|
+
projectionColumnState.lambdaParameterName,
|
258
|
+
[
|
259
|
+
buildPropertyExpressionChain(
|
260
|
+
projectionColumnState.propertyExpressionState.propertyExpression,
|
261
|
+
projectionColumnState.propertyExpressionState.queryBuilderState,
|
262
|
+
),
|
263
|
+
],
|
264
|
+
queryBuilderState.graphManagerState.graph,
|
265
|
+
);
|
266
|
+
} else if (
|
267
|
+
projectionColumnState instanceof
|
268
|
+
QueryBuilderDerivationProjectionColumnState
|
269
|
+
) {
|
270
|
+
columnLambda = new INTERNAL__UnknownValueSpecification(
|
271
|
+
V1_serializeRawValueSpecification(
|
272
|
+
V1_transformRawLambda(
|
273
|
+
projectionColumnState.lambda,
|
274
|
+
new V1_GraphTransformerContextBuilder(
|
275
|
+
// TODO?: do we need to include the plugins here?
|
276
|
+
[],
|
277
|
+
)
|
278
|
+
.withKeepSourceInformationFlag(
|
279
|
+
Boolean(options?.keepSourceInformation),
|
280
|
+
)
|
281
|
+
.build(),
|
282
|
+
),
|
283
|
+
),
|
284
|
+
);
|
285
|
+
} else {
|
286
|
+
throw new UnsupportedOperationError(
|
287
|
+
`Can't build project() column expression: unsupported projection column state`,
|
288
|
+
projectionColumnState,
|
289
|
+
);
|
290
|
+
}
|
291
|
+
|
292
|
+
// column aggregation
|
293
|
+
if (aggregateColumnState) {
|
294
|
+
const aggregateFunctionExpression = new SimpleFunctionExpression(
|
295
|
+
extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG),
|
296
|
+
multiplicityOne,
|
297
|
+
);
|
298
|
+
const aggregateLambda = buildGenericLambdaFunctionInstanceValue(
|
299
|
+
aggregateColumnState.lambdaParameterName,
|
300
|
+
[
|
301
|
+
aggregateColumnState.operator.buildAggregateExpressionFromState(
|
302
|
+
aggregateColumnState,
|
303
|
+
),
|
304
|
+
],
|
305
|
+
aggregateColumnState.aggregationState.projectionState
|
306
|
+
.queryBuilderState.graphManagerState.graph,
|
307
|
+
);
|
308
|
+
aggregateFunctionExpression.parametersValues = [
|
309
|
+
columnLambda,
|
310
|
+
aggregateLambda,
|
311
|
+
];
|
312
|
+
|
313
|
+
aggregateLambdas.values.push(aggregateFunctionExpression);
|
314
|
+
} else {
|
315
|
+
colLambdas.values.push(columnLambda);
|
316
|
+
}
|
317
|
+
});
|
318
|
+
groupByFunction.parametersValues = [
|
319
|
+
precedingExpression,
|
320
|
+
colLambdas,
|
321
|
+
aggregateLambdas,
|
322
|
+
colAliases,
|
323
|
+
];
|
324
|
+
lambdaFunction.expressionSequence[0] = groupByFunction;
|
325
|
+
} else if (projectionState.columns.length) {
|
326
|
+
// projection
|
327
|
+
const projectFunction = new SimpleFunctionExpression(
|
328
|
+
extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT),
|
329
|
+
multiplicityOne,
|
330
|
+
);
|
331
|
+
const colLambdas = new CollectionInstanceValue(
|
332
|
+
new Multiplicity(
|
333
|
+
projectionState.columns.length,
|
334
|
+
projectionState.columns.length,
|
335
|
+
),
|
336
|
+
);
|
337
|
+
const colAliases = new CollectionInstanceValue(
|
338
|
+
new Multiplicity(
|
339
|
+
projectionState.columns.length,
|
340
|
+
projectionState.columns.length,
|
341
|
+
),
|
342
|
+
);
|
343
|
+
projectionState.columns.forEach((projectionColumnState) => {
|
344
|
+
// column alias
|
345
|
+
const colAlias = new PrimitiveInstanceValue(
|
346
|
+
GenericTypeExplicitReference.create(new GenericType(typeString)),
|
347
|
+
multiplicityOne,
|
348
|
+
);
|
349
|
+
colAlias.values.push(projectionColumnState.columnName);
|
350
|
+
colAliases.values.push(colAlias);
|
351
|
+
|
352
|
+
// column projection
|
353
|
+
let columnLambda: ValueSpecification;
|
354
|
+
if (
|
355
|
+
projectionColumnState instanceof QueryBuilderSimpleProjectionColumnState
|
356
|
+
) {
|
357
|
+
columnLambda = buildGenericLambdaFunctionInstanceValue(
|
358
|
+
projectionColumnState.lambdaParameterName,
|
359
|
+
[
|
360
|
+
buildPropertyExpressionChain(
|
361
|
+
projectionColumnState.propertyExpressionState.propertyExpression,
|
362
|
+
projectionColumnState.propertyExpressionState.queryBuilderState,
|
363
|
+
),
|
364
|
+
],
|
365
|
+
queryBuilderState.graphManagerState.graph,
|
366
|
+
);
|
367
|
+
} else if (
|
368
|
+
projectionColumnState instanceof
|
369
|
+
QueryBuilderDerivationProjectionColumnState
|
370
|
+
) {
|
371
|
+
columnLambda = new INTERNAL__UnknownValueSpecification(
|
372
|
+
V1_serializeRawValueSpecification(
|
373
|
+
V1_transformRawLambda(
|
374
|
+
projectionColumnState.lambda,
|
375
|
+
new V1_GraphTransformerContextBuilder(
|
376
|
+
// TODO?: do we need to include the plugins here?
|
377
|
+
[],
|
378
|
+
)
|
379
|
+
.withKeepSourceInformationFlag(
|
380
|
+
Boolean(options?.keepSourceInformation),
|
381
|
+
)
|
382
|
+
.build(),
|
383
|
+
),
|
384
|
+
),
|
385
|
+
);
|
386
|
+
} else {
|
387
|
+
throw new UnsupportedOperationError(
|
388
|
+
`Can't build project() column expression: unsupported projection column state`,
|
389
|
+
projectionColumnState,
|
390
|
+
);
|
391
|
+
}
|
392
|
+
colLambdas.values.push(columnLambda);
|
393
|
+
});
|
394
|
+
projectFunction.parametersValues = [
|
395
|
+
precedingExpression,
|
396
|
+
colLambdas,
|
397
|
+
colAliases,
|
398
|
+
];
|
399
|
+
lambdaFunction.expressionSequence[0] = projectFunction;
|
400
|
+
}
|
401
|
+
|
402
|
+
// build post-filter
|
403
|
+
appendPostFilter(projectionState.postFilterState, lambdaFunction);
|
404
|
+
|
405
|
+
// build result set modifiers
|
406
|
+
appendResultSetModifier(
|
407
|
+
projectionState.resultSetModifierState,
|
408
|
+
lambdaFunction,
|
409
|
+
{
|
410
|
+
overridingLimit: options?.isBuildingExecutionQuery
|
411
|
+
? queryBuilderState.resultState.previewLimit
|
412
|
+
: undefined,
|
413
|
+
},
|
414
|
+
);
|
415
|
+
};
|
package/src/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.ts
ADDED
@@ -0,0 +1,228 @@
|
|
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
|
+
CollectionInstanceValue,
|
19
|
+
LambdaFunctionInstanceValue,
|
20
|
+
matchFunctionName,
|
21
|
+
SimpleFunctionExpression,
|
22
|
+
VariableExpression,
|
23
|
+
} from '@finos/legend-graph';
|
24
|
+
import {
|
25
|
+
assertTrue,
|
26
|
+
assertType,
|
27
|
+
guaranteeNonNullable,
|
28
|
+
guaranteeType,
|
29
|
+
isNonNullable,
|
30
|
+
returnUndefOnError,
|
31
|
+
UnsupportedOperationError,
|
32
|
+
} from '@finos/legend-shared';
|
33
|
+
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../QueryBuilder_Const.js';
|
34
|
+
import type { QueryBuilderState } from '../../../QueryBuilderState.js';
|
35
|
+
import { QueryBuilderValueSpecificationProcessor } from '../../../QueryBuilderStateBuilder.js';
|
36
|
+
import { extractNullableStringFromInstanceValue } from '../../../QueryBuilderValueSpecificationHelper.js';
|
37
|
+
import { FETCH_STRUCTURE_IMPLEMENTATION } from '../../QueryBuilderFetchStructureImplementationState.js';
|
38
|
+
import { QueryBuilderProjectionState } from '../QueryBuilderProjectionState.js';
|
39
|
+
|
40
|
+
export const processTDSAggregateExpression = (
|
41
|
+
expression: SimpleFunctionExpression,
|
42
|
+
parentExpression: SimpleFunctionExpression | undefined,
|
43
|
+
queryBuilderState: QueryBuilderState,
|
44
|
+
): void => {
|
45
|
+
// check parent expression
|
46
|
+
assertTrue(
|
47
|
+
Boolean(
|
48
|
+
parentExpression &&
|
49
|
+
matchFunctionName(
|
50
|
+
parentExpression.functionName,
|
51
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
|
52
|
+
),
|
53
|
+
),
|
54
|
+
`Can't process agg() expression: only support agg() used within a groupBy() expression`,
|
55
|
+
);
|
56
|
+
|
57
|
+
// check parameters
|
58
|
+
assertTrue(
|
59
|
+
expression.parametersValues.length === 2,
|
60
|
+
`Can't process agg() expression: agg() expects 2 arguments`,
|
61
|
+
);
|
62
|
+
|
63
|
+
// process column lambda
|
64
|
+
QueryBuilderValueSpecificationProcessor.processChild(
|
65
|
+
// TODO?: do we want to do more validation here for the shape of the column lambda?
|
66
|
+
guaranteeNonNullable(expression.parametersValues[0]),
|
67
|
+
expression,
|
68
|
+
queryBuilderState,
|
69
|
+
);
|
70
|
+
|
71
|
+
// build state
|
72
|
+
if (
|
73
|
+
queryBuilderState.fetchStructureState.implementation instanceof
|
74
|
+
QueryBuilderProjectionState
|
75
|
+
) {
|
76
|
+
const projectionState =
|
77
|
+
queryBuilderState.fetchStructureState.implementation;
|
78
|
+
const aggregationState = projectionState.aggregationState;
|
79
|
+
// NOTE: since we process agg() expressions one by one, we know that the current agg()
|
80
|
+
// always correspond to the last column projection state, based on our processing procedure
|
81
|
+
const projectionColumnState = guaranteeNonNullable(
|
82
|
+
projectionState.columns[projectionState.columns.length - 1],
|
83
|
+
);
|
84
|
+
const aggregateLambda = expression.parametersValues[1];
|
85
|
+
assertType(
|
86
|
+
aggregateLambda,
|
87
|
+
LambdaFunctionInstanceValue,
|
88
|
+
`Can't process agg() expression: agg() expects argument #1 to be a lambda function`,
|
89
|
+
);
|
90
|
+
|
91
|
+
const lambdaFunc = guaranteeNonNullable(
|
92
|
+
aggregateLambda.values[0],
|
93
|
+
`Can't process agg() lambda: agg() lambda function is missing`,
|
94
|
+
);
|
95
|
+
assertTrue(
|
96
|
+
lambdaFunc.expressionSequence.length === 1,
|
97
|
+
`Can't process agg() lambda: only support agg() lambda body with 1 expression`,
|
98
|
+
);
|
99
|
+
const aggregateColumnExpression = guaranteeType(
|
100
|
+
lambdaFunc.expressionSequence[0],
|
101
|
+
SimpleFunctionExpression,
|
102
|
+
`Can't process agg() lambda: only support agg() lambda body with 1 expression`,
|
103
|
+
);
|
104
|
+
|
105
|
+
assertTrue(
|
106
|
+
lambdaFunc.functionType.parameters.length === 1,
|
107
|
+
`Can't process agg() lambda: only support agg() lambda with 1 parameter`,
|
108
|
+
);
|
109
|
+
|
110
|
+
const lambdaParam = guaranteeType(
|
111
|
+
lambdaFunc.functionType.parameters[0],
|
112
|
+
VariableExpression,
|
113
|
+
`Can't process agg() lambda: only support agg() lambda with 1 parameter`,
|
114
|
+
);
|
115
|
+
|
116
|
+
for (const operator of aggregationState.operators) {
|
117
|
+
// NOTE: this allow plugin author to either return `undefined` or throw error
|
118
|
+
// if there is a problem with building the lambda. Either case, the plugin is
|
119
|
+
// considered as not supporting the lambda.
|
120
|
+
const aggregateColumnState = returnUndefOnError(() =>
|
121
|
+
operator.buildAggregateColumnState(
|
122
|
+
aggregateColumnExpression,
|
123
|
+
lambdaParam,
|
124
|
+
projectionColumnState,
|
125
|
+
),
|
126
|
+
);
|
127
|
+
if (aggregateColumnState) {
|
128
|
+
aggregationState.addColumn(aggregateColumnState);
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
throw new UnsupportedOperationError(
|
133
|
+
`Can't process aggregate expression function: no compatible aggregate operator processer available from plugins`,
|
134
|
+
);
|
135
|
+
}
|
136
|
+
};
|
137
|
+
|
138
|
+
export const processTDSGroupByExpression = (
|
139
|
+
expression: SimpleFunctionExpression,
|
140
|
+
queryBuilderState: QueryBuilderState,
|
141
|
+
): void => {
|
142
|
+
// update fetch-structure
|
143
|
+
queryBuilderState.fetchStructureState.changeImplementation(
|
144
|
+
FETCH_STRUCTURE_IMPLEMENTATION.PROJECTION,
|
145
|
+
);
|
146
|
+
|
147
|
+
// check parameters
|
148
|
+
assertTrue(
|
149
|
+
expression.parametersValues.length === 4,
|
150
|
+
`Can't process groupBy() expression: groupBy() expects 3 arguments`,
|
151
|
+
);
|
152
|
+
|
153
|
+
// check preceding expression
|
154
|
+
const precedingExpression = guaranteeType(
|
155
|
+
expression.parametersValues[0],
|
156
|
+
SimpleFunctionExpression,
|
157
|
+
`Can't process groupBy() expression: only support groupBy() immediately following an expression`,
|
158
|
+
);
|
159
|
+
assertTrue(
|
160
|
+
matchFunctionName(precedingExpression.functionName, [
|
161
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL,
|
162
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
|
163
|
+
]),
|
164
|
+
`Can't process groupBy() expression: only support groupBy() immediately following either getAll() or filter()`,
|
165
|
+
);
|
166
|
+
QueryBuilderValueSpecificationProcessor.process(
|
167
|
+
precedingExpression,
|
168
|
+
queryBuilderState,
|
169
|
+
);
|
170
|
+
|
171
|
+
// process columns
|
172
|
+
const columnExpressions = expression.parametersValues[1];
|
173
|
+
assertType(
|
174
|
+
columnExpressions,
|
175
|
+
CollectionInstanceValue,
|
176
|
+
`Can't process groupBy() expression: groupBy() expects argument #1 to be a collection`,
|
177
|
+
);
|
178
|
+
columnExpressions.values.map((value) =>
|
179
|
+
QueryBuilderValueSpecificationProcessor.processChild(
|
180
|
+
value,
|
181
|
+
expression,
|
182
|
+
queryBuilderState,
|
183
|
+
),
|
184
|
+
);
|
185
|
+
|
186
|
+
// process aggregations
|
187
|
+
const aggregateLambdas = expression.parametersValues[2];
|
188
|
+
assertType(
|
189
|
+
aggregateLambdas,
|
190
|
+
CollectionInstanceValue,
|
191
|
+
`Can't process groupBy() expression: groupBy() expects argument #2 to be a collection`,
|
192
|
+
);
|
193
|
+
aggregateLambdas.values.map((value) =>
|
194
|
+
QueryBuilderValueSpecificationProcessor.processChild(
|
195
|
+
value,
|
196
|
+
expression,
|
197
|
+
queryBuilderState,
|
198
|
+
),
|
199
|
+
);
|
200
|
+
|
201
|
+
// process column aliases
|
202
|
+
const columnAliases = expression.parametersValues[3];
|
203
|
+
assertType(
|
204
|
+
columnAliases,
|
205
|
+
CollectionInstanceValue,
|
206
|
+
`Can't process groupBy() expression: groupBy() expects argument #3 to be a collection`,
|
207
|
+
);
|
208
|
+
assertTrue(
|
209
|
+
columnAliases.values.length ===
|
210
|
+
columnExpressions.values.length + aggregateLambdas.values.length,
|
211
|
+
`Can't process groupBy() expression: number of aliases does not match the number of columns`,
|
212
|
+
);
|
213
|
+
const aliases = columnAliases.values
|
214
|
+
.map(extractNullableStringFromInstanceValue)
|
215
|
+
.filter(isNonNullable);
|
216
|
+
|
217
|
+
// build state
|
218
|
+
if (
|
219
|
+
queryBuilderState.fetchStructureState.implementation instanceof
|
220
|
+
QueryBuilderProjectionState
|
221
|
+
) {
|
222
|
+
const projectionState =
|
223
|
+
queryBuilderState.fetchStructureState.implementation;
|
224
|
+
projectionState.columns.forEach((column, idx) =>
|
225
|
+
column.setColumnName(aliases[idx] as string),
|
226
|
+
);
|
227
|
+
}
|
228
|
+
};
|
@@ -110,7 +110,7 @@ export class QueryBuilderAggregateOperator_DistinctCount extends QueryBuilderAgg
|
|
110
110
|
);
|
111
111
|
aggregateColumnState.setLambdaParameterName(lambdaParam.name);
|
112
112
|
|
113
|
-
// count expression
|
113
|
+
// process count expression
|
114
114
|
assertTrue(
|
115
115
|
expression.parametersValues.length === 1,
|
116
116
|
`Can't process count() expression: count() expects no argument`,
|