@finos/legend-query-builder 4.14.88 → 4.14.89
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +2 -4
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +17 -3
- package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +4 -4
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +12 -2
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +32 -20
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +6 -6
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +4 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +4 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +4 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.d.ts +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +4 -4
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts +3 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +5 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuidler.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuidler.js +13 -3
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuidler.js.map +1 -1
- package/package.json +5 -5
- package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +4 -5
- package/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +23 -7
- package/src/index.ts +7 -0
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.ts +2 -0
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +14 -3
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +14 -11
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +9 -3
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +51 -27
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +7 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +7 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +7 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +5 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +5 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +7 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +5 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +5 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +5 -2
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +7 -2
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +0 -2
- package/src/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuidler.ts +30 -2
@@ -23,6 +23,7 @@ import {
|
|
23
23
|
guaranteeType,
|
24
24
|
isNonNullable,
|
25
25
|
returnUndefOnError,
|
26
|
+
UnsupportedOperationError,
|
26
27
|
} from '@finos/legend-shared';
|
27
28
|
import {
|
28
29
|
type V1_GraphBuilderContext,
|
@@ -62,6 +63,10 @@ import {
|
|
62
63
|
ColSpecArrayInstance,
|
63
64
|
ColSpecArray,
|
64
65
|
ColSpec,
|
66
|
+
Relation_RelationType,
|
67
|
+
Relation_RelationalColumn,
|
68
|
+
getValueSpecificationReturnType,
|
69
|
+
Relation_Relation,
|
65
70
|
} from '@finos/legend-graph';
|
66
71
|
import {
|
67
72
|
QUERY_BUILDER_PURE_PATH,
|
@@ -641,7 +646,7 @@ const V1_buildTypedProjectFunctionExpression = (
|
|
641
646
|
const processedExpression = new ColSpecArrayInstance(Multiplicity.ONE);
|
642
647
|
const processedColSpecArray = new ColSpecArray();
|
643
648
|
processedExpression.values = [processedColSpecArray];
|
644
|
-
|
649
|
+
const relationType = new Relation_RelationType(Relation_RelationType.ID);
|
645
650
|
processedColSpecArray.colSpecs = specArray.colSpecs.map((colSpec) => {
|
646
651
|
const pColSpec = new ColSpec();
|
647
652
|
let lambda: ValueSpecification;
|
@@ -667,6 +672,16 @@ const V1_buildTypedProjectFunctionExpression = (
|
|
667
672
|
}
|
668
673
|
pColSpec.function1 = lambda;
|
669
674
|
pColSpec.name = colSpec.name;
|
675
|
+
const returnType = getValueSpecificationReturnType(lambda);
|
676
|
+
if (returnType) {
|
677
|
+
relationType.columns.push(
|
678
|
+
new Relation_RelationalColumn(colSpec.name, returnType),
|
679
|
+
);
|
680
|
+
} else {
|
681
|
+
throw new UnsupportedOperationError(
|
682
|
+
'Unable to get return type for current lambda',
|
683
|
+
);
|
684
|
+
}
|
670
685
|
return pColSpec;
|
671
686
|
});
|
672
687
|
|
@@ -675,12 +690,13 @@ const V1_buildTypedProjectFunctionExpression = (
|
|
675
690
|
functionName,
|
676
691
|
compileContext,
|
677
692
|
);
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
),
|
682
|
-
|
683
|
-
|
693
|
+
const relationGenericType = new GenericType(Relation_Relation.INSTANCE);
|
694
|
+
const relationTypeGenericType = new GenericType(relationType);
|
695
|
+
relationGenericType.typeArguments = [
|
696
|
+
GenericTypeExplicitReference.create(relationTypeGenericType),
|
697
|
+
];
|
698
|
+
expression.genericType =
|
699
|
+
GenericTypeExplicitReference.create(relationGenericType);
|
684
700
|
return expression;
|
685
701
|
};
|
686
702
|
|
package/src/index.ts
CHANGED
@@ -35,6 +35,8 @@ export { QUERY_BUILDER_COMPONENT_ELEMENT_ID } from './components/QueryBuilderCom
|
|
35
35
|
export {
|
36
36
|
type QueryableSourceInfo as QuerySDLC,
|
37
37
|
QueryBuilderState,
|
38
|
+
QUERY_BUILDER_LAMBDA_WRITER_MODE,
|
39
|
+
INTERNAL__BasicQueryBuilderState,
|
38
40
|
} from './stores/QueryBuilderState.js';
|
39
41
|
export {
|
40
42
|
getTDSColumnDerivedProperyFromType,
|
@@ -59,6 +61,10 @@ export {
|
|
59
61
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS,
|
60
62
|
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
|
61
63
|
} from './graph/QueryBuilderMetaModelConst.js';
|
64
|
+
export {
|
65
|
+
TEST__LegendApplicationPluginManager,
|
66
|
+
TEST__getGenericApplicationConfig,
|
67
|
+
} from './stores/__test-utils__/QueryBuilderStateTestUtils.js';
|
62
68
|
export { getQueryBuilderGraphManagerExtension } from './graph-manager/protocol/pure/QueryBuilder_PureGraphManagerExtension.js';
|
63
69
|
export type { ServiceExecutionAnalysisResult } from './graph-manager/action/analytics/ServiceExecutionAnalysis.js';
|
64
70
|
export type { MappingRuntimeCompatibilityAnalysisResult } from './graph-manager/action/analytics/MappingRuntimeCompatibilityAnalysis.js';
|
@@ -87,6 +93,7 @@ export {
|
|
87
93
|
getQueryBuilderExplorerTreeNodeSortRank,
|
88
94
|
QueryBuilderSubclassInfoTooltip,
|
89
95
|
} from './components/explorer/QueryBuilderExplorerPanel.js';
|
96
|
+
export { QueryBuilderActionConfig } from './stores/query-workflow/QueryBuilderWorkFlowState.js';
|
90
97
|
// ------------------------------------------- Shared components -------------------------------------------
|
91
98
|
|
92
99
|
export * from './components/shared/LambdaEditor.js';
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
import type {
|
18
18
|
FunctionExpression,
|
19
|
+
LambdaFunction,
|
19
20
|
Type,
|
20
21
|
ValueSpecification,
|
21
22
|
} from '@finos/legend-graph';
|
@@ -57,6 +58,7 @@ export abstract class QueryBuilderPostFilterOperator implements Hashable {
|
|
57
58
|
|
58
59
|
abstract buildPostFilterConditionExpression(
|
59
60
|
postFilterConditionState: PostFilterConditionState,
|
61
|
+
parentExpression: LambdaFunction | undefined,
|
60
62
|
): ValueSpecification | undefined;
|
61
63
|
|
62
64
|
abstract buildPostFilterConditionState(
|
@@ -26,6 +26,7 @@ import {
|
|
26
26
|
PrimitiveType,
|
27
27
|
CollectionInstanceValue,
|
28
28
|
InstanceValue,
|
29
|
+
type LambdaFunction,
|
29
30
|
} from '@finos/legend-graph';
|
30
31
|
import {
|
31
32
|
type GeneratorFn,
|
@@ -298,7 +299,10 @@ export abstract class PostFilterConditionValueState implements Hashable {
|
|
298
299
|
]);
|
299
300
|
}
|
300
301
|
|
301
|
-
abstract appendConditionValue(
|
302
|
+
abstract appendConditionValue(
|
303
|
+
expressionVal: SimpleFunctionExpression,
|
304
|
+
parentExpression: LambdaFunction | undefined,
|
305
|
+
): void;
|
302
306
|
}
|
303
307
|
|
304
308
|
export class PostFilterValueSpecConditionValueState extends PostFilterConditionValueState {
|
@@ -341,7 +345,10 @@ export class PostFilterValueSpecConditionValueState extends PostFilterConditionV
|
|
341
345
|
: undefined;
|
342
346
|
return this.value;
|
343
347
|
}
|
344
|
-
override appendConditionValue(
|
348
|
+
override appendConditionValue(
|
349
|
+
expressionVal: SimpleFunctionExpression,
|
350
|
+
parentExpression: LambdaFunction | undefined,
|
351
|
+
): void {
|
345
352
|
if (this.value) {
|
346
353
|
expressionVal.parametersValues.push(this.value);
|
347
354
|
}
|
@@ -381,13 +388,17 @@ export class PostFilterTDSColumnValueConditionValueState extends PostFilterCondi
|
|
381
388
|
override get isCollection(): boolean {
|
382
389
|
return false;
|
383
390
|
}
|
384
|
-
override appendConditionValue(
|
391
|
+
override appendConditionValue(
|
392
|
+
expressionVal: SimpleFunctionExpression,
|
393
|
+
parentExpression: LambdaFunction | undefined,
|
394
|
+
): void {
|
385
395
|
const tdsPropertyExpression = buildtdsPropertyExpressionFromColState(
|
386
396
|
this.conditionState,
|
387
397
|
this.tdsColumn,
|
388
398
|
this.conditionState.postFilterState.tdsState.queryBuilderState
|
389
399
|
.graphManagerState.graph,
|
390
400
|
undefined,
|
401
|
+
parentExpression,
|
391
402
|
);
|
392
403
|
expressionVal.parametersValues.push(tdsPropertyExpression);
|
393
404
|
}
|
@@ -188,17 +188,20 @@ export const buildPostFilterConditionState = (
|
|
188
188
|
);
|
189
189
|
|
190
190
|
// get projection column
|
191
|
-
const
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
191
|
+
const paramValue = expression.parametersValues[0];
|
192
|
+
let columnState: QueryBuilderTDSColumnState;
|
193
|
+
if (paramValue instanceof AbstractPropertyExpression) {
|
194
|
+
columnState = findProjectionColumnState(paramValue, postFilterState);
|
195
|
+
} else if (paramValue instanceof FunctionExpression) {
|
196
|
+
const columnName = paramValue.functionName;
|
197
|
+
columnState = getTDSColumnState(postFilterState.tdsState, columnName);
|
198
|
+
} else {
|
199
|
+
throw new UnsupportedOperationError(
|
200
|
+
`Can't process ${extractElementNameFromPath(
|
201
|
+
operatorFunctionFullPath,
|
202
|
+
)}() expression: expects property expression in lambda body`,
|
203
|
+
);
|
204
|
+
}
|
202
205
|
|
203
206
|
// get operation value specification
|
204
207
|
const rightSide = expression.parametersValues[1];
|
@@ -34,10 +34,12 @@ import {
|
|
34
34
|
const buildPostFilterExpression = (
|
35
35
|
postFilterState: QueryBuilderPostFilterState,
|
36
36
|
node: QueryBuilderPostFilterTreeNodeData,
|
37
|
+
parentExpression: LambdaFunction | undefined,
|
37
38
|
): ValueSpecification | undefined => {
|
38
39
|
if (node instanceof QueryBuilderPostFilterTreeConditionNodeData) {
|
39
40
|
return node.condition.operator.buildPostFilterConditionExpression(
|
40
41
|
node.condition,
|
42
|
+
parentExpression,
|
41
43
|
);
|
42
44
|
} else if (node instanceof QueryBuilderPostFilterTreeGroupNodeData) {
|
43
45
|
const func = new SimpleFunctionExpression(
|
@@ -46,7 +48,9 @@ const buildPostFilterExpression = (
|
|
46
48
|
const clauses = node.childrenIds
|
47
49
|
.map((e) => postFilterState.nodes.get(e))
|
48
50
|
.filter(isNonNullable)
|
49
|
-
.map((e) =>
|
51
|
+
.map((e) =>
|
52
|
+
buildPostFilterExpression(postFilterState, e, parentExpression),
|
53
|
+
)
|
50
54
|
.filter(isNonNullable);
|
51
55
|
/**
|
52
56
|
* NOTE: Due to a limitation (or perhaps design decision) in the engine, group operations
|
@@ -84,8 +88,10 @@ export const appendPostFilter = (
|
|
84
88
|
lambdaFunction: LambdaFunction,
|
85
89
|
): LambdaFunction => {
|
86
90
|
const postFilterConditionExpressions = postFilterState.rootIds
|
87
|
-
.map((
|
88
|
-
.map((
|
91
|
+
.map((node) => guaranteeNonNullable(postFilterState.nodes.get(node)))
|
92
|
+
.map((_node) =>
|
93
|
+
buildPostFilterExpression(postFilterState, _node, lambdaFunction),
|
94
|
+
)
|
89
95
|
.filter(isNonNullable);
|
90
96
|
if (
|
91
97
|
!postFilterConditionExpressions.length ||
|
@@ -15,9 +15,9 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import {
|
18
|
-
type FunctionExpression,
|
19
18
|
AbstractPropertyExpression,
|
20
19
|
extractElementNameFromPath,
|
20
|
+
FunctionExpression,
|
21
21
|
GenericType,
|
22
22
|
GenericTypeExplicitReference,
|
23
23
|
PrimitiveInstanceValue,
|
@@ -28,6 +28,8 @@ import {
|
|
28
28
|
Multiplicity,
|
29
29
|
PrimitiveType,
|
30
30
|
type PureModel,
|
31
|
+
type LambdaFunction,
|
32
|
+
getRelationTypeGenericType,
|
31
33
|
} from '@finos/legend-graph';
|
32
34
|
import { guaranteeNonNullable } from '@finos/legend-shared';
|
33
35
|
import type { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
@@ -44,38 +46,55 @@ export const buildtdsPropertyExpressionFromColState = (
|
|
44
46
|
colState: QueryBuilderTDSColumnState,
|
45
47
|
graph: PureModel,
|
46
48
|
operator: QueryBuilderPostFilterOperator | undefined,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
? operator.getTDSColumnGetter()
|
49
|
+
parentExpression: LambdaFunction | undefined,
|
50
|
+
): FunctionExpression => {
|
51
|
+
const relationType = parentExpression?.expressionSequence[0]
|
52
|
+
? getRelationTypeGenericType(parentExpression.expressionSequence[0])
|
52
53
|
: undefined;
|
53
|
-
if (correspondingTDSDerivedProperty) {
|
54
|
-
tdsDerivedPropertyName = correspondingTDSDerivedProperty;
|
55
|
-
} else {
|
56
|
-
const type = guaranteeNonNullable(colState.getColumnType());
|
57
|
-
tdsDerivedPropertyName = getTDSColumnDerivedProperyFromType(type);
|
58
|
-
}
|
59
|
-
tdsPropertyExpression.func = PropertyExplicitReference.create(
|
60
|
-
guaranteeNonNullable(
|
61
|
-
getAllClassDerivedProperties(
|
62
|
-
graph.getClass(QUERY_BUILDER_PURE_PATH.TDS_ROW),
|
63
|
-
).find((p) => p.name === tdsDerivedPropertyName),
|
64
|
-
),
|
65
|
-
);
|
66
54
|
const variableName = new VariableExpression(
|
67
55
|
filterConditionState.postFilterState.lambdaParameterName,
|
68
56
|
Multiplicity.ONE,
|
69
57
|
);
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
58
|
+
if (relationType) {
|
59
|
+
const col = guaranteeNonNullable(
|
60
|
+
relationType.columns.find((e) => colState.columnName === e.name),
|
61
|
+
`Can't find property ${colState.columnName} in relation`,
|
62
|
+
);
|
63
|
+
const _funcExp = new FunctionExpression(col.name);
|
64
|
+
_funcExp.func = col;
|
65
|
+
_funcExp.parametersValues = [variableName];
|
66
|
+
return _funcExp;
|
67
|
+
} else {
|
68
|
+
const tdsPropertyExpression = new AbstractPropertyExpression('');
|
69
|
+
let tdsDerivedPropertyName: TDS_COLUMN_GETTER;
|
70
|
+
const correspondingTDSDerivedProperty = operator
|
71
|
+
? operator.getTDSColumnGetter()
|
72
|
+
: undefined;
|
73
|
+
if (correspondingTDSDerivedProperty) {
|
74
|
+
tdsDerivedPropertyName = correspondingTDSDerivedProperty;
|
75
|
+
} else {
|
76
|
+
const type = guaranteeNonNullable(colState.getColumnType());
|
77
|
+
tdsDerivedPropertyName = getTDSColumnDerivedProperyFromType(type);
|
78
|
+
}
|
79
|
+
tdsPropertyExpression.func = PropertyExplicitReference.create(
|
80
|
+
guaranteeNonNullable(
|
81
|
+
getAllClassDerivedProperties(
|
82
|
+
graph.getClass(QUERY_BUILDER_PURE_PATH.TDS_ROW),
|
83
|
+
).find((p) => p.name === tdsDerivedPropertyName),
|
84
|
+
),
|
85
|
+
);
|
86
|
+
const colInstanceValue = new PrimitiveInstanceValue(
|
87
|
+
GenericTypeExplicitReference.create(
|
88
|
+
new GenericType(PrimitiveType.STRING),
|
89
|
+
),
|
90
|
+
);
|
91
|
+
colInstanceValue.values = [colState.columnName];
|
92
|
+
tdsPropertyExpression.parametersValues = [variableName, colInstanceValue];
|
93
|
+
return tdsPropertyExpression;
|
94
|
+
}
|
76
95
|
};
|
77
96
|
|
78
|
-
export const
|
97
|
+
export const buildPostFilterConditionExpressionHelper = (
|
79
98
|
filterConditionState: PostFilterConditionState,
|
80
99
|
operator: QueryBuilderPostFilterOperator,
|
81
100
|
/**
|
@@ -85,6 +104,7 @@ export const buildPostFilterConditionExpression = (
|
|
85
104
|
* This is the case because with TDS, we are provided some filter-like operators, e.g. IS_NULL, IS_NOT_NULL, etc.
|
86
105
|
*/
|
87
106
|
operatorFunctionFullPath: string | undefined,
|
107
|
+
parentExpression: LambdaFunction | undefined,
|
88
108
|
): FunctionExpression => {
|
89
109
|
// primitives
|
90
110
|
const graph =
|
@@ -96,6 +116,7 @@ export const buildPostFilterConditionExpression = (
|
|
96
116
|
filterConditionState.leftConditionValue,
|
97
117
|
graph,
|
98
118
|
operator,
|
119
|
+
parentExpression,
|
99
120
|
);
|
100
121
|
|
101
122
|
if (operatorFunctionFullPath) {
|
@@ -103,7 +124,10 @@ export const buildPostFilterConditionExpression = (
|
|
103
124
|
extractElementNameFromPath(operatorFunctionFullPath),
|
104
125
|
);
|
105
126
|
expression.parametersValues.push(tdsPropertyExpression);
|
106
|
-
filterConditionState.rightConditionValue.appendConditionValue(
|
127
|
+
filterConditionState.rightConditionValue.appendConditionValue(
|
128
|
+
expression,
|
129
|
+
parentExpression,
|
130
|
+
);
|
107
131
|
return expression;
|
108
132
|
} else {
|
109
133
|
return tdsPropertyExpression;
|
@@ -18,6 +18,7 @@ import {
|
|
18
18
|
type SimpleFunctionExpression,
|
19
19
|
type Type,
|
20
20
|
type ValueSpecification,
|
21
|
+
type LambdaFunction,
|
21
22
|
type FunctionExpression,
|
22
23
|
PRIMITIVE_TYPE,
|
23
24
|
PrimitiveType,
|
@@ -38,7 +39,7 @@ import {
|
|
38
39
|
buildNotExpression,
|
39
40
|
unwrapNotExpression,
|
40
41
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
41
|
-
import {
|
42
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
42
43
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
43
44
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
44
45
|
import { buildDefaultInstanceValue } from '../../../../shared/ValueSpecificationEditorHelper.js';
|
@@ -93,11 +94,13 @@ export class QueryBuilderPostFilterOperator_Contain
|
|
93
94
|
|
94
95
|
buildPostFilterConditionExpression(
|
95
96
|
postFilterConditionState: PostFilterConditionState,
|
97
|
+
parentExpression: LambdaFunction | undefined,
|
96
98
|
): ValueSpecification | undefined {
|
97
|
-
return
|
99
|
+
return buildPostFilterConditionExpressionHelper(
|
98
100
|
postFilterConditionState,
|
99
101
|
this,
|
100
102
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.CONTAINS,
|
103
|
+
parentExpression,
|
101
104
|
);
|
102
105
|
}
|
103
106
|
|
@@ -126,9 +129,11 @@ export class QueryBuilderPostFilterOperator_NotContain extends QueryBuilderPostF
|
|
126
129
|
}
|
127
130
|
override buildPostFilterConditionExpression(
|
128
131
|
postFilterConditionState: PostFilterConditionState,
|
132
|
+
parentExpression: LambdaFunction | undefined,
|
129
133
|
): ValueSpecification | undefined {
|
130
134
|
const expression = super.buildPostFilterConditionExpression(
|
131
135
|
postFilterConditionState,
|
136
|
+
parentExpression,
|
132
137
|
);
|
133
138
|
return expression ? buildNotExpression(expression) : undefined;
|
134
139
|
}
|
@@ -18,6 +18,7 @@ import {
|
|
18
18
|
type Type,
|
19
19
|
type ValueSpecification,
|
20
20
|
type FunctionExpression,
|
21
|
+
type LambdaFunction,
|
21
22
|
PRIMITIVE_TYPE,
|
22
23
|
PrimitiveType,
|
23
24
|
} from '@finos/legend-graph';
|
@@ -36,7 +37,7 @@ import {
|
|
36
37
|
buildNotExpression,
|
37
38
|
unwrapNotExpression,
|
38
39
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
39
|
-
import {
|
40
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
40
41
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
41
42
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
42
43
|
import { buildDefaultInstanceValue } from '../../../../shared/ValueSpecificationEditorHelper.js';
|
@@ -88,11 +89,13 @@ export class QueryBuilderPostFilterOperator_EndWith
|
|
88
89
|
|
89
90
|
buildPostFilterConditionExpression(
|
90
91
|
postFilterConditionState: PostFilterConditionState,
|
92
|
+
parentExpression: LambdaFunction | undefined,
|
91
93
|
): ValueSpecification | undefined {
|
92
|
-
return
|
94
|
+
return buildPostFilterConditionExpressionHelper(
|
93
95
|
postFilterConditionState,
|
94
96
|
this,
|
95
97
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.ENDS_WITH,
|
98
|
+
parentExpression,
|
96
99
|
);
|
97
100
|
}
|
98
101
|
|
@@ -122,9 +125,11 @@ export class QueryBuilderPostFilterOperator_NotEndWith extends QueryBuilderPostF
|
|
122
125
|
|
123
126
|
override buildPostFilterConditionExpression(
|
124
127
|
postFilterConditionState: PostFilterConditionState,
|
128
|
+
parentExpression: LambdaFunction | undefined,
|
125
129
|
): ValueSpecification | undefined {
|
126
130
|
const expression = super.buildPostFilterConditionExpression(
|
127
131
|
postFilterConditionState,
|
132
|
+
parentExpression,
|
128
133
|
);
|
129
134
|
return expression ? buildNotExpression(expression) : undefined;
|
130
135
|
}
|
package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts
CHANGED
@@ -19,6 +19,7 @@ import {
|
|
19
19
|
type ValueSpecification,
|
20
20
|
type SimpleFunctionExpression,
|
21
21
|
type FunctionExpression,
|
22
|
+
type LambdaFunction,
|
22
23
|
AbstractPropertyExpression,
|
23
24
|
Enumeration,
|
24
25
|
PRIMITIVE_TYPE,
|
@@ -40,7 +41,7 @@ import {
|
|
40
41
|
isTypeCompatibleForAssignment,
|
41
42
|
unwrapNotExpression,
|
42
43
|
} from '../../../../QueryBuilderValueSpecificationHelper.js';
|
43
|
-
import {
|
44
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
44
45
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
45
46
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
46
47
|
import { buildDefaultInstanceValue } from '../../../../shared/ValueSpecificationEditorHelper.js';
|
@@ -106,8 +107,9 @@ export class QueryBuilderPostFilterOperator_Equal
|
|
106
107
|
|
107
108
|
buildPostFilterConditionExpression(
|
108
109
|
postFilterConditionState: PostFilterConditionState,
|
110
|
+
parentExpression: LambdaFunction | undefined,
|
109
111
|
): ValueSpecification | undefined {
|
110
|
-
return
|
112
|
+
return buildPostFilterConditionExpressionHelper(
|
111
113
|
postFilterConditionState,
|
112
114
|
this,
|
113
115
|
postFilterConditionState.leftConditionValue.getColumnType() ===
|
@@ -116,6 +118,7 @@ export class QueryBuilderPostFilterOperator_Equal
|
|
116
118
|
PrimitiveType.DATETIME
|
117
119
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_DAY
|
118
120
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.EQUAL,
|
121
|
+
parentExpression,
|
119
122
|
);
|
120
123
|
}
|
121
124
|
|
@@ -150,9 +153,11 @@ export class QueryBuilderPostFilterOperator_NotEqual extends QueryBuilderPostFil
|
|
150
153
|
|
151
154
|
override buildPostFilterConditionExpression(
|
152
155
|
postFilterConditionState: PostFilterConditionState,
|
156
|
+
parentExpression: LambdaFunction | undefined,
|
153
157
|
): ValueSpecification | undefined {
|
154
158
|
const expression = super.buildPostFilterConditionExpression(
|
155
159
|
postFilterConditionState,
|
160
|
+
parentExpression,
|
156
161
|
);
|
157
162
|
return expression ? buildNotExpression(expression) : undefined;
|
158
163
|
}
|
@@ -18,6 +18,7 @@ import {
|
|
18
18
|
type Type,
|
19
19
|
type ValueSpecification,
|
20
20
|
type FunctionExpression,
|
21
|
+
type LambdaFunction,
|
21
22
|
AbstractPropertyExpression,
|
22
23
|
PRIMITIVE_TYPE,
|
23
24
|
PrimitiveType,
|
@@ -35,7 +36,7 @@ import type {
|
|
35
36
|
QueryBuilderPostFilterState,
|
36
37
|
} from '../QueryBuilderPostFilterState.js';
|
37
38
|
import { isTypeCompatibleForAssignment } from '../../../../QueryBuilderValueSpecificationHelper.js';
|
38
|
-
import {
|
39
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
39
40
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
40
41
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
41
42
|
import { buildDefaultInstanceValue } from '../../../../shared/ValueSpecificationEditorHelper.js';
|
@@ -107,8 +108,9 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
107
108
|
|
108
109
|
buildPostFilterConditionExpression(
|
109
110
|
postFilterConditionState: PostFilterConditionState,
|
111
|
+
parentExpression: LambdaFunction | undefined,
|
110
112
|
): ValueSpecification | undefined {
|
111
|
-
return
|
113
|
+
return buildPostFilterConditionExpressionHelper(
|
112
114
|
postFilterConditionState,
|
113
115
|
this,
|
114
116
|
postFilterConditionState.leftConditionValue.getColumnType() ===
|
@@ -117,6 +119,7 @@ export class QueryBuilderPostFilterOperator_GreaterThan
|
|
117
119
|
PrimitiveType.DATETIME
|
118
120
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_AFTER_DAY
|
119
121
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.GREATER_THAN,
|
122
|
+
parentExpression,
|
120
123
|
);
|
121
124
|
}
|
122
125
|
|
@@ -17,6 +17,7 @@
|
|
17
17
|
import {
|
18
18
|
type FunctionExpression,
|
19
19
|
type ValueSpecification,
|
20
|
+
type LambdaFunction,
|
20
21
|
AbstractPropertyExpression,
|
21
22
|
PRIMITIVE_TYPE,
|
22
23
|
PrimitiveType,
|
@@ -26,7 +27,7 @@ import type {
|
|
26
27
|
PostFilterConditionState,
|
27
28
|
QueryBuilderPostFilterState,
|
28
29
|
} from '../QueryBuilderPostFilterState.js';
|
29
|
-
import {
|
30
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
30
31
|
import { QueryBuilderPostFilterOperator_GreaterThan } from './QueryBuilderPostFilterOperator_GreaterThan.js';
|
31
32
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../../graph/QueryBuilderMetaModelConst.js';
|
32
33
|
import { hashArray } from '@finos/legend-shared';
|
@@ -39,8 +40,9 @@ export class QueryBuilderPostFilterOperator_GreaterThanEqual extends QueryBuilde
|
|
39
40
|
|
40
41
|
override buildPostFilterConditionExpression(
|
41
42
|
postFilterConditionState: PostFilterConditionState,
|
43
|
+
parentExpression: LambdaFunction | undefined,
|
42
44
|
): ValueSpecification | undefined {
|
43
|
-
return
|
45
|
+
return buildPostFilterConditionExpressionHelper(
|
44
46
|
postFilterConditionState,
|
45
47
|
this,
|
46
48
|
postFilterConditionState.leftConditionValue.getColumnType() ===
|
@@ -49,6 +51,7 @@ export class QueryBuilderPostFilterOperator_GreaterThanEqual extends QueryBuilde
|
|
49
51
|
PrimitiveType.DATETIME
|
50
52
|
? QUERY_BUILDER_SUPPORTED_FUNCTIONS.IS_ON_OR_AFTER_DAY
|
51
53
|
: QUERY_BUILDER_SUPPORTED_FUNCTIONS.GREATER_THAN_EQUAL,
|
54
|
+
parentExpression,
|
52
55
|
);
|
53
56
|
}
|
54
57
|
|
package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts
CHANGED
@@ -19,6 +19,7 @@ import {
|
|
19
19
|
type ValueSpecification,
|
20
20
|
type SimpleFunctionExpression,
|
21
21
|
type FunctionExpression,
|
22
|
+
type LambdaFunction,
|
22
23
|
CollectionInstanceValue,
|
23
24
|
Enumeration,
|
24
25
|
PRIMITIVE_TYPE,
|
@@ -39,7 +40,7 @@ import {
|
|
39
40
|
type PostFilterConditionState,
|
40
41
|
type QueryBuilderPostFilterState,
|
41
42
|
} from '../QueryBuilderPostFilterState.js';
|
42
|
-
import {
|
43
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
43
44
|
import {
|
44
45
|
buildNotExpression,
|
45
46
|
getCollectionValueSpecificationType,
|
@@ -139,11 +140,13 @@ export class QueryBuilderPostFilterOperator_In
|
|
139
140
|
|
140
141
|
buildPostFilterConditionExpression(
|
141
142
|
postFilterConditionState: PostFilterConditionState,
|
143
|
+
parentExpression: LambdaFunction | undefined,
|
142
144
|
): ValueSpecification | undefined {
|
143
|
-
return
|
145
|
+
return buildPostFilterConditionExpressionHelper(
|
144
146
|
postFilterConditionState,
|
145
147
|
this,
|
146
148
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.IN,
|
149
|
+
parentExpression,
|
147
150
|
);
|
148
151
|
}
|
149
152
|
|
@@ -173,9 +176,11 @@ export class QueryBuilderPostFilterOperator_NotIn extends QueryBuilderPostFilter
|
|
173
176
|
|
174
177
|
override buildPostFilterConditionExpression(
|
175
178
|
postFilterConditionState: PostFilterConditionState,
|
179
|
+
parentExpression: LambdaFunction | undefined,
|
176
180
|
): ValueSpecification | undefined {
|
177
181
|
const expression = super.buildPostFilterConditionExpression(
|
178
182
|
postFilterConditionState,
|
183
|
+
parentExpression,
|
179
184
|
);
|
180
185
|
return expression ? buildNotExpression(expression) : undefined;
|
181
186
|
}
|
@@ -18,6 +18,7 @@ import {
|
|
18
18
|
type Type,
|
19
19
|
type ValueSpecification,
|
20
20
|
type FunctionExpression,
|
21
|
+
type LambdaFunction,
|
21
22
|
Enumeration,
|
22
23
|
PrimitiveType,
|
23
24
|
} from '@finos/legend-graph';
|
@@ -29,7 +30,7 @@ import {
|
|
29
30
|
PostFilterValueSpecConditionValueState,
|
30
31
|
} from '../QueryBuilderPostFilterState.js';
|
31
32
|
import { QueryBuilderSimpleProjectionColumnState } from '../../projection/QueryBuilderProjectionColumnState.js';
|
32
|
-
import {
|
33
|
+
import { buildPostFilterConditionExpressionHelper } from './QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
|
33
34
|
import { isPropertyExpressionChainOptional } from '../../../../QueryBuilderValueSpecificationHelper.js';
|
34
35
|
import { type Hashable, hashArray } from '@finos/legend-shared';
|
35
36
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../../../../QueryBuilderStateHashUtils.js';
|
@@ -91,11 +92,13 @@ export class QueryBuilderPostFilterOperator_IsEmpty
|
|
91
92
|
|
92
93
|
buildPostFilterConditionExpression(
|
93
94
|
postFilterConditionState: PostFilterConditionState,
|
95
|
+
parentExpression: LambdaFunction | undefined,
|
94
96
|
): ValueSpecification | undefined {
|
95
|
-
return
|
97
|
+
return buildPostFilterConditionExpressionHelper(
|
96
98
|
postFilterConditionState,
|
97
99
|
this,
|
98
100
|
undefined,
|
101
|
+
parentExpression,
|
99
102
|
);
|
100
103
|
}
|
101
104
|
|