@finos/legend-query-builder 4.14.31 → 4.14.33
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/QueryBuilderTesting.d.ts +3 -1
- package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
- package/lib/__lib__/QueryBuilderTesting.js +3 -1
- package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +3 -3
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +23 -15
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +7 -7
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +32 -25
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.d.ts +7 -0
- package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +7 -1
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +0 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +2 -27
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.d.ts +20 -0
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js +54 -0
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js.map +1 -0
- package/package.json +2 -2
- package/src/__lib__/QueryBuilderTesting.ts +3 -1
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +34 -20
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +9 -16
- package/src/components/filter/QueryBuilderFilterPanel.tsx +133 -126
- package/src/components/result/QueryBuilderResultPanel.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/stores/QueryBuilderStateBuilder.ts +18 -5
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +1 -68
- package/src/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.ts +103 -0
- package/tsconfig.json +1 -0
@@ -28,7 +28,6 @@ import {
|
|
28
28
|
V1_RawLambda,
|
29
29
|
VariableExpression,
|
30
30
|
PrimitiveInstanceValue,
|
31
|
-
ColSpecArrayInstance,
|
32
31
|
} from '@finos/legend-graph';
|
33
32
|
import {
|
34
33
|
assertNonNullable,
|
@@ -45,10 +44,7 @@ import {
|
|
45
44
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS,
|
46
45
|
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
|
47
46
|
} from '../../../../graph/QueryBuilderMetaModelConst.js';
|
48
|
-
import {
|
49
|
-
QUERY_BUILDER_LAMBDA_WRITER_MODE,
|
50
|
-
type QueryBuilderState,
|
51
|
-
} from '../../../QueryBuilderState.js';
|
47
|
+
import { type QueryBuilderState } from '../../../QueryBuilderState.js';
|
52
48
|
import { QueryBuilderValueSpecificationProcessor } from '../../../QueryBuilderStateBuilder.js';
|
53
49
|
import {
|
54
50
|
extractNullableNumberFromInstanceValue,
|
@@ -63,74 +59,11 @@ import {
|
|
63
59
|
import { QueryBuilderTDSState } from '../QueryBuilderTDSState.js';
|
64
60
|
import { SortColumnState } from '../QueryResultSetModifierState.js';
|
65
61
|
|
66
|
-
export const processTypedTDSProjectExpression = (
|
67
|
-
expression: SimpleFunctionExpression,
|
68
|
-
queryBuilderState: QueryBuilderState,
|
69
|
-
parentLambda: LambdaFunction,
|
70
|
-
): void => {
|
71
|
-
// check parameters
|
72
|
-
assertTrue(
|
73
|
-
expression.parametersValues.length === 2,
|
74
|
-
`Can't process project() expression: project() expects 2 arguments`,
|
75
|
-
);
|
76
|
-
// update fetch-structure
|
77
|
-
queryBuilderState.fetchStructureState.changeImplementation(
|
78
|
-
FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE,
|
79
|
-
);
|
80
|
-
|
81
|
-
// check preceding expression
|
82
|
-
const precedingExpression = guaranteeType(
|
83
|
-
expression.parametersValues[0],
|
84
|
-
SimpleFunctionExpression,
|
85
|
-
`Can't process project() expression: only support project() immediately following an expression`,
|
86
|
-
);
|
87
|
-
assertTrue(
|
88
|
-
matchFunctionName(precedingExpression.functionName, [
|
89
|
-
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
|
90
|
-
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
|
91
|
-
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
|
92
|
-
QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
|
93
|
-
QUERY_BUILDER_SUPPORTED_FUNCTIONS.WATERMARK,
|
94
|
-
]),
|
95
|
-
`Can't process project() expression: only support project() immediately following either getAll(), filter(), or forWatermark()`,
|
96
|
-
);
|
97
|
-
QueryBuilderValueSpecificationProcessor.process(
|
98
|
-
precedingExpression,
|
99
|
-
parentLambda,
|
100
|
-
queryBuilderState,
|
101
|
-
);
|
102
|
-
// check columns
|
103
|
-
const classInstance = expression.parametersValues[1];
|
104
|
-
assertType(
|
105
|
-
classInstance,
|
106
|
-
ColSpecArrayInstance,
|
107
|
-
`Can't process project() expression: project() expects argument #1 to be a ColSpecArrayInstance`,
|
108
|
-
);
|
109
|
-
queryBuilderState.setLambdaWriteMode(
|
110
|
-
QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
|
111
|
-
);
|
112
|
-
QueryBuilderValueSpecificationProcessor.processChild(
|
113
|
-
classInstance,
|
114
|
-
expression,
|
115
|
-
parentLambda,
|
116
|
-
queryBuilderState,
|
117
|
-
);
|
118
|
-
};
|
119
|
-
|
120
62
|
export const processTDSProjectExpression = (
|
121
63
|
expression: SimpleFunctionExpression,
|
122
64
|
queryBuilderState: QueryBuilderState,
|
123
65
|
parentLambda: LambdaFunction,
|
124
66
|
): void => {
|
125
|
-
if (expression.parametersValues.length === 2) {
|
126
|
-
processTypedTDSProjectExpression(
|
127
|
-
expression,
|
128
|
-
queryBuilderState,
|
129
|
-
parentLambda,
|
130
|
-
);
|
131
|
-
|
132
|
-
return;
|
133
|
-
}
|
134
67
|
// update fetch-structure
|
135
68
|
queryBuilderState.fetchStructureState.changeImplementation(
|
136
69
|
FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE,
|
@@ -0,0 +1,103 @@
|
|
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
|
+
type LambdaFunction,
|
19
|
+
SimpleFunctionExpression,
|
20
|
+
matchFunctionName,
|
21
|
+
ColSpecArrayInstance,
|
22
|
+
} from '@finos/legend-graph';
|
23
|
+
import { FETCH_STRUCTURE_IMPLEMENTATION } from '../../QueryBuilderFetchStructureImplementationState.js';
|
24
|
+
import { assertTrue, assertType, guaranteeType } from '@finos/legend-shared';
|
25
|
+
import {
|
26
|
+
QUERY_BUILDER_LAMBDA_WRITER_MODE,
|
27
|
+
type QueryBuilderState,
|
28
|
+
} from '../../../QueryBuilderState.js';
|
29
|
+
import {
|
30
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS,
|
31
|
+
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
|
32
|
+
} from '../../../../graph/QueryBuilderMetaModelConst.js';
|
33
|
+
import { QueryBuilderValueSpecificationProcessor } from '../../../QueryBuilderStateBuilder.js';
|
34
|
+
|
35
|
+
export const processTypedTDSProjectExpression = (
|
36
|
+
expression: SimpleFunctionExpression,
|
37
|
+
queryBuilderState: QueryBuilderState,
|
38
|
+
parentLambda: LambdaFunction,
|
39
|
+
): void => {
|
40
|
+
// check parameters
|
41
|
+
assertTrue(
|
42
|
+
expression.parametersValues.length === 2,
|
43
|
+
`Can't process typed project() expression: typed project() expects 2 arguments`,
|
44
|
+
);
|
45
|
+
// update fetch-structure
|
46
|
+
queryBuilderState.fetchStructureState.changeImplementation(
|
47
|
+
FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE,
|
48
|
+
);
|
49
|
+
|
50
|
+
// check preceding expression
|
51
|
+
const precedingExpression = guaranteeType(
|
52
|
+
expression.parametersValues[0],
|
53
|
+
SimpleFunctionExpression,
|
54
|
+
`Can't process typed project() expression: only support typed project() immediately following an expression`,
|
55
|
+
);
|
56
|
+
assertTrue(
|
57
|
+
matchFunctionName(precedingExpression.functionName, [
|
58
|
+
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
|
59
|
+
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
|
60
|
+
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
|
61
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
|
62
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.WATERMARK,
|
63
|
+
]),
|
64
|
+
`Can't process typed project() expression: only support typed project() immediately following either getAll(), filter(), or forWatermark()`,
|
65
|
+
);
|
66
|
+
QueryBuilderValueSpecificationProcessor.process(
|
67
|
+
precedingExpression,
|
68
|
+
parentLambda,
|
69
|
+
queryBuilderState,
|
70
|
+
);
|
71
|
+
// check columns
|
72
|
+
const classInstance = expression.parametersValues[1];
|
73
|
+
assertType(
|
74
|
+
classInstance,
|
75
|
+
ColSpecArrayInstance,
|
76
|
+
`Can't process typed project() expression: typed project() expects argument #1 to be a ColSpec Array Instance`,
|
77
|
+
);
|
78
|
+
queryBuilderState.setLambdaWriteMode(
|
79
|
+
QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
|
80
|
+
);
|
81
|
+
QueryBuilderValueSpecificationProcessor.processChild(
|
82
|
+
classInstance,
|
83
|
+
expression,
|
84
|
+
parentLambda,
|
85
|
+
queryBuilderState,
|
86
|
+
);
|
87
|
+
};
|
88
|
+
|
89
|
+
export const isTypedProjectionExpression = (
|
90
|
+
expression: SimpleFunctionExpression,
|
91
|
+
): boolean => {
|
92
|
+
if (
|
93
|
+
matchFunctionName(expression.functionName, [
|
94
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
|
95
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_PROJECT,
|
96
|
+
])
|
97
|
+
) {
|
98
|
+
if (expression.parametersValues.length === 2) {
|
99
|
+
return expression.parametersValues[1] instanceof ColSpecArrayInstance;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return false;
|
103
|
+
};
|
package/tsconfig.json
CHANGED
@@ -136,6 +136,7 @@
|
|
136
136
|
"./src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts",
|
137
137
|
"./src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts",
|
138
138
|
"./src/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuidler.ts",
|
139
|
+
"./src/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.ts",
|
139
140
|
"./src/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.ts",
|
140
141
|
"./src/stores/fetch-structure/tds/window/QueryBuilderWindowState.ts",
|
141
142
|
"./src/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.ts",
|