@finos/legend-query-builder 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.js +3 -3
- package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +2 -2
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +5 -6
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +7 -12
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +6 -6
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -5
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +5 -6
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +87 -76
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +13 -14
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.js +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
- package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts +1 -0
- package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts.map +1 -1
- package/lib/graphManager/QueryBuilderSupportedFunctions.js +1 -0
- package/lib/graphManager/QueryBuilderSupportedFunctions.js.map +1 -1
- package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +8 -8
- package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +17 -26
- package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +11 -10
- package/lib/stores/QueryBuilderChangeDetectionState.d.ts +4 -4
- package/lib/stores/QueryBuilderChangeDetectionState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderChangeDetectionState.js +9 -9
- package/lib/stores/QueryBuilderChangeDetectionState.js.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.js +4 -4
- package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
- package/lib/stores/QueryBuilderPropertyEditorState.d.ts +2 -3
- package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPropertyEditorState.js +9 -12
- package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts +4 -2
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +7 -7
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -2
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +10 -12
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +9 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.js +22 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +2 -2
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts +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 +22 -15
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +2 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +2 -1
- 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.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +6 -3
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +4 -2
- 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_LessThan.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +4 -2
- 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_StartWith.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +2 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.js +2 -2
- package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +1 -14
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js +9 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +4 -3
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +2 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +2 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +2 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +2 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js +3 -3
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
- package/lib/stores/shared/LambdaParameterState.d.ts +2 -2
- package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
- package/lib/stores/shared/LambdaParameterState.js +5 -5
- package/lib/stores/shared/LambdaParameterState.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +4 -4
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +11 -15
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts +8 -8
- package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationModifierHelper.js +20 -17
- package/lib/stores/shared/ValueSpecificationModifierHelper.js.map +1 -1
- package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
- package/lib/stores/watermark/QueryBuilderWatermarkState.js +1 -1
- package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
- package/package.json +18 -17
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +3 -1
- package/src/components/QueryBuilderParametersPanel.tsx +2 -2
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +6 -6
- package/src/components/QueryBuilderResultPanel.tsx +18 -14
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +10 -11
- package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +7 -5
- package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +9 -6
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -1
- package/src/components/filter/QueryBuilderFilterPanel.tsx +1 -1
- package/src/components/shared/BasicValueSpecificationEditor.tsx +180 -106
- package/src/components/shared/CustomDatePicker.tsx +54 -26
- package/src/components/watermark/QueryBuilderWatermark.tsx +1 -3
- package/src/graphManager/QueryBuilderSupportedFunctions.ts +4 -0
- package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +1 -1
- package/src/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +67 -68
- package/src/stores/QueryBuilderChangeDetectionState.ts +13 -11
- package/src/stores/QueryBuilderConstantsState.ts +4 -3
- package/src/stores/QueryBuilderPropertyEditorState.ts +17 -13
- package/src/stores/QueryBuilderState.ts +7 -9
- package/src/stores/QueryBuilderStateBuilder.ts +10 -12
- package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +1 -1
- package/src/stores/QueryBuilderValueSpecificationHelper.ts +36 -0
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +10 -2
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +1 -1
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +26 -20
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +2 -0
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +2 -0
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +14 -3
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +4 -0
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +4 -0
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +2 -0
- package/src/stores/filter/QueryBuilderFilterState.ts +2 -2
- package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +0 -20
- package/src/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.ts +17 -4
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +1 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +1 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +12 -3
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +2 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +2 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +2 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +2 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +1 -0
- package/src/stores/milestoning/QueryBuilderMilestoningState.ts +3 -9
- package/src/stores/shared/LambdaParameterState.ts +9 -5
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +24 -9
- package/src/stores/shared/ValueSpecificationModifierHelper.ts +42 -20
- package/src/stores/watermark/QueryBuilderWatermarkState.ts +1 -4
@@ -24,6 +24,7 @@ export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
|
|
24
24
|
OR = 'meta::pure::functions::boolean::or',
|
25
25
|
TAKE = 'meta::pure::functions::collection::take',
|
26
26
|
SUBTYPE = 'meta::pure::functions::lang::subType',
|
27
|
+
MINUS = 'meta::pure::functions::math::minus',
|
27
28
|
|
28
29
|
// graph-fetch
|
29
30
|
GRAPH_FETCH = 'meta::pure::graphFetch::execution::graphFetch',
|
@@ -53,6 +54,7 @@ export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
|
|
53
54
|
LESS_THAN = 'meta::pure::functions::lang::tests::lessThan',
|
54
55
|
LESS_THAN_EQUAL = 'meta::pure::functions::lang::tests::lessThanEqual',
|
55
56
|
STARTS_WITH = 'meta::pure::functions::string::startsWith',
|
57
|
+
|
56
58
|
// aggregation
|
57
59
|
AVERAGE = 'meta::pure::functions::math::average',
|
58
60
|
COUNT = 'meta::pure::functions::collection::count',
|
@@ -66,8 +68,10 @@ export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
|
|
66
68
|
STD_DEV_SAMPLE = 'meta::pure::functions::math::stdDevSample',
|
67
69
|
SUM = 'meta::pure::functions::math::sum',
|
68
70
|
UNIQUE_VALUE_ONLY = 'meta::pure::functions::collection::uniqueValueOnly',
|
71
|
+
|
69
72
|
// watermark
|
70
73
|
WATERMARK = 'meta::datalake::functions::forWatermark',
|
74
|
+
|
71
75
|
// OLAP
|
72
76
|
OLAP_GROUPBY = 'meta::pure::tds::olapGroupBy',
|
73
77
|
OLAP_RANK = 'meta::pure::functions::math::olap::rank',
|
@@ -57,7 +57,7 @@ export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProces
|
|
57
57
|
openVariables: string[],
|
58
58
|
compileContext: V1_GraphBuilderContext,
|
59
59
|
processingContext: V1_ProcessingContext,
|
60
|
-
):
|
60
|
+
): SimpleFunctionExpression | undefined => {
|
61
61
|
if (
|
62
62
|
matchFunctionName(
|
63
63
|
functionName,
|
@@ -201,8 +201,8 @@ export const V1_buildGetAllFunctionExpression = (
|
|
201
201
|
openVariables: string[],
|
202
202
|
compileContext: V1_GraphBuilderContext,
|
203
203
|
processingContext: V1_ProcessingContext,
|
204
|
-
):
|
205
|
-
const
|
204
|
+
): SimpleFunctionExpression => {
|
205
|
+
const expression = V1_buildGenericFunctionExpression(
|
206
206
|
functionName,
|
207
207
|
parameters,
|
208
208
|
openVariables,
|
@@ -218,7 +218,8 @@ export const V1_buildGetAllFunctionExpression = (
|
|
218
218
|
);
|
219
219
|
expression.genericType = precedingExpression.genericType;
|
220
220
|
expression.multiplicity = precedingExpression.multiplicity;
|
221
|
-
|
221
|
+
|
222
|
+
return expression;
|
222
223
|
};
|
223
224
|
|
224
225
|
export const V1_buildExistsFunctionExpression = (
|
@@ -227,7 +228,7 @@ export const V1_buildExistsFunctionExpression = (
|
|
227
228
|
openVariables: string[],
|
228
229
|
compileContext: V1_GraphBuilderContext,
|
229
230
|
processingContext: V1_ProcessingContext,
|
230
|
-
):
|
231
|
+
): SimpleFunctionExpression => {
|
231
232
|
assertTrue(
|
232
233
|
parameters.length === 2,
|
233
234
|
`Can't build exists() expression: exists() expects 1 argument`,
|
@@ -262,22 +263,21 @@ export const V1_buildExistsFunctionExpression = (
|
|
262
263
|
}
|
263
264
|
});
|
264
265
|
}
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
266
|
+
|
267
|
+
return V1_buildBaseSimpleFunctionExpression(
|
268
|
+
[
|
269
|
+
precedingExpression,
|
270
|
+
(parameters[1] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
271
|
+
new V1_ValueSpecificationBuilder(
|
272
|
+
compileContext,
|
273
|
+
processingContext,
|
274
|
+
openVariables,
|
275
|
+
),
|
272
276
|
),
|
273
|
-
|
274
|
-
];
|
275
|
-
const expression = V1_buildBaseSimpleFunctionExpression(
|
276
|
-
processedParameters,
|
277
|
+
],
|
277
278
|
functionName,
|
278
279
|
compileContext,
|
279
280
|
);
|
280
|
-
return [expression, processedParameters];
|
281
281
|
};
|
282
282
|
|
283
283
|
export const V1_buildFilterFunctionExpression = (
|
@@ -286,7 +286,7 @@ export const V1_buildFilterFunctionExpression = (
|
|
286
286
|
openVariables: string[],
|
287
287
|
compileContext: V1_GraphBuilderContext,
|
288
288
|
processingContext: V1_ProcessingContext,
|
289
|
-
):
|
289
|
+
): SimpleFunctionExpression => {
|
290
290
|
assertTrue(
|
291
291
|
parameters.length === 2,
|
292
292
|
`Can't build filter() expression: filter() expects 1 argument`,
|
@@ -318,19 +318,18 @@ export const V1_buildFilterFunctionExpression = (
|
|
318
318
|
});
|
319
319
|
}
|
320
320
|
}
|
321
|
-
const processedParams = [
|
322
|
-
precedingExpression,
|
323
|
-
(parameters[1] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
324
|
-
new V1_ValueSpecificationBuilder(
|
325
|
-
compileContext,
|
326
|
-
processingContext,
|
327
|
-
openVariables,
|
328
|
-
),
|
329
|
-
),
|
330
|
-
];
|
331
321
|
|
332
322
|
const expression = V1_buildBaseSimpleFunctionExpression(
|
333
|
-
|
323
|
+
[
|
324
|
+
precedingExpression,
|
325
|
+
(parameters[1] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
326
|
+
new V1_ValueSpecificationBuilder(
|
327
|
+
compileContext,
|
328
|
+
processingContext,
|
329
|
+
openVariables,
|
330
|
+
),
|
331
|
+
),
|
332
|
+
],
|
334
333
|
functionName,
|
335
334
|
compileContext,
|
336
335
|
);
|
@@ -338,7 +337,8 @@ export const V1_buildFilterFunctionExpression = (
|
|
338
337
|
// return type of filter() is the same as that of the function precedes it
|
339
338
|
expression.genericType = precedingExpression.genericType;
|
340
339
|
expression.multiplicity = precedingExpression.multiplicity;
|
341
|
-
|
340
|
+
|
341
|
+
return expression;
|
342
342
|
};
|
343
343
|
|
344
344
|
export const V1_buildProjectFunctionExpression = (
|
@@ -347,7 +347,7 @@ export const V1_buildProjectFunctionExpression = (
|
|
347
347
|
openVariables: string[],
|
348
348
|
compileContext: V1_GraphBuilderContext,
|
349
349
|
processingContext: V1_ProcessingContext,
|
350
|
-
):
|
350
|
+
): SimpleFunctionExpression => {
|
351
351
|
assertTrue(
|
352
352
|
parameters.length === 3,
|
353
353
|
`Can't build project() expression: project() expects 2 arguments`,
|
@@ -417,26 +417,26 @@ export const V1_buildProjectFunctionExpression = (
|
|
417
417
|
}
|
418
418
|
});
|
419
419
|
|
420
|
-
const processedParams = [
|
421
|
-
precedingExperession,
|
422
|
-
processedColumnExpressions,
|
423
|
-
(parameters[2] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
424
|
-
new V1_ValueSpecificationBuilder(
|
425
|
-
compileContext,
|
426
|
-
processingContext,
|
427
|
-
openVariables,
|
428
|
-
),
|
429
|
-
),
|
430
|
-
];
|
431
420
|
const expression = V1_buildBaseSimpleFunctionExpression(
|
432
|
-
|
421
|
+
[
|
422
|
+
precedingExperession,
|
423
|
+
processedColumnExpressions,
|
424
|
+
(parameters[2] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
425
|
+
new V1_ValueSpecificationBuilder(
|
426
|
+
compileContext,
|
427
|
+
processingContext,
|
428
|
+
openVariables,
|
429
|
+
),
|
430
|
+
),
|
431
|
+
],
|
433
432
|
functionName,
|
434
433
|
compileContext,
|
435
434
|
);
|
436
435
|
expression.genericType = GenericTypeExplicitReference.create(
|
437
436
|
new GenericType(compileContext.resolveType(CORE_PURE_PATH.TDS_ROW).value),
|
438
437
|
);
|
439
|
-
|
438
|
+
|
439
|
+
return expression;
|
440
440
|
};
|
441
441
|
|
442
442
|
export const V1_buildGroupByFunctionExpression = (
|
@@ -445,7 +445,7 @@ export const V1_buildGroupByFunctionExpression = (
|
|
445
445
|
openVariables: string[],
|
446
446
|
compileContext: V1_GraphBuilderContext,
|
447
447
|
processingContext: V1_ProcessingContext,
|
448
|
-
):
|
448
|
+
): SimpleFunctionExpression => {
|
449
449
|
let topLevelLambdaParameters: V1_Variable[] = [];
|
450
450
|
assertTrue(
|
451
451
|
parameters.length === 4,
|
@@ -557,27 +557,27 @@ export const V1_buildGroupByFunctionExpression = (
|
|
557
557
|
),
|
558
558
|
);
|
559
559
|
|
560
|
-
const processedParams = [
|
561
|
-
precedingExperession,
|
562
|
-
processedColumnExpressions,
|
563
|
-
processedAggregationExpressions,
|
564
|
-
(parameters[3] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
565
|
-
new V1_ValueSpecificationBuilder(
|
566
|
-
compileContext,
|
567
|
-
processingContext,
|
568
|
-
openVariables,
|
569
|
-
),
|
570
|
-
),
|
571
|
-
];
|
572
560
|
const expression = V1_buildBaseSimpleFunctionExpression(
|
573
|
-
|
561
|
+
[
|
562
|
+
precedingExperession,
|
563
|
+
processedColumnExpressions,
|
564
|
+
processedAggregationExpressions,
|
565
|
+
(parameters[3] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
566
|
+
new V1_ValueSpecificationBuilder(
|
567
|
+
compileContext,
|
568
|
+
processingContext,
|
569
|
+
openVariables,
|
570
|
+
),
|
571
|
+
),
|
572
|
+
],
|
574
573
|
functionName,
|
575
574
|
compileContext,
|
576
575
|
);
|
577
576
|
expression.genericType = GenericTypeExplicitReference.create(
|
578
577
|
new GenericType(compileContext.resolveType(CORE_PURE_PATH.TDS_ROW).value),
|
579
578
|
);
|
580
|
-
|
579
|
+
|
580
|
+
return expression;
|
581
581
|
};
|
582
582
|
|
583
583
|
export const V1_buildWatermarkFunctionExpression = (
|
@@ -586,7 +586,7 @@ export const V1_buildWatermarkFunctionExpression = (
|
|
586
586
|
openVariables: string[],
|
587
587
|
compileContext: V1_GraphBuilderContext,
|
588
588
|
processingContext: V1_ProcessingContext,
|
589
|
-
):
|
589
|
+
): SimpleFunctionExpression | undefined => {
|
590
590
|
assertTrue(
|
591
591
|
parameters.length === 2,
|
592
592
|
`Can't build forWatermark() expression: forWatermark() expects 1 argument`,
|
@@ -622,8 +622,7 @@ export const V1_buildWatermarkFunctionExpression = (
|
|
622
622
|
});
|
623
623
|
}
|
624
624
|
|
625
|
-
const
|
626
|
-
precedingExpression,
|
625
|
+
const watermarkValueParam = guaranteeNonNullable(
|
627
626
|
(parameters[1] as V1_ValueSpecification).accept_ValueSpecificationVisitor(
|
628
627
|
new V1_ValueSpecificationBuilder(
|
629
628
|
compileContext,
|
@@ -631,9 +630,7 @@ export const V1_buildWatermarkFunctionExpression = (
|
|
631
630
|
openVariables,
|
632
631
|
),
|
633
632
|
),
|
634
|
-
|
635
|
-
|
636
|
-
const watermarkValueParam = guaranteeNonNullable(processedParams[1]);
|
633
|
+
);
|
637
634
|
const watermarkValueParamType =
|
638
635
|
watermarkValueParam.genericType?.value.rawType;
|
639
636
|
assertTrue(
|
@@ -642,14 +639,15 @@ export const V1_buildWatermarkFunctionExpression = (
|
|
642
639
|
);
|
643
640
|
|
644
641
|
const expression = V1_buildBaseSimpleFunctionExpression(
|
645
|
-
|
642
|
+
[precedingExpression, watermarkValueParam],
|
646
643
|
functionName,
|
647
644
|
compileContext,
|
648
645
|
);
|
649
646
|
|
650
647
|
expression.genericType = precedingExpression.genericType;
|
651
648
|
expression.multiplicity = precedingExpression.multiplicity;
|
652
|
-
|
649
|
+
|
650
|
+
return expression;
|
653
651
|
};
|
654
652
|
|
655
653
|
export const V1_buildOLAPGroupByFunctionExpression = (
|
@@ -658,7 +656,7 @@ export const V1_buildOLAPGroupByFunctionExpression = (
|
|
658
656
|
openVariables: string[],
|
659
657
|
compileContext: V1_GraphBuilderContext,
|
660
658
|
processingContext: V1_ProcessingContext,
|
661
|
-
):
|
659
|
+
): SimpleFunctionExpression | undefined => {
|
662
660
|
const processedParams: ValueSpecification[] = [];
|
663
661
|
assertTrue(
|
664
662
|
parameters.length === 5 || parameters.length === 4,
|
@@ -778,7 +776,8 @@ export const V1_buildOLAPGroupByFunctionExpression = (
|
|
778
776
|
expression.genericType = GenericTypeExplicitReference.create(
|
779
777
|
new GenericType(compileContext.resolveType(CORE_PURE_PATH.TDS_ROW).value),
|
780
778
|
);
|
781
|
-
|
779
|
+
|
780
|
+
return expression;
|
782
781
|
};
|
783
782
|
|
784
783
|
export const V1_buildSubTypePropertyExpressionTypeInference = (
|
@@ -91,17 +91,19 @@ export class QueryBuilderDiffViewState {
|
|
91
91
|
}
|
92
92
|
|
93
93
|
export class QueryBuilderChangeDetectionState {
|
94
|
-
querybuilderState: QueryBuilderState;
|
95
|
-
|
94
|
+
readonly querybuilderState: QueryBuilderState;
|
95
|
+
|
96
|
+
readonly initState = ActionState.create();
|
97
|
+
|
98
|
+
querySnapshot?: RawLambda | undefined;
|
99
|
+
hashCodeSnapshot?: string | undefined;
|
96
100
|
diffViewState?: QueryBuilderDiffViewState | undefined;
|
97
|
-
initialQuery?: RawLambda | undefined;
|
98
|
-
initialHashCode?: string | undefined;
|
99
101
|
|
100
102
|
constructor(queryBuilderState: QueryBuilderState) {
|
101
103
|
makeObservable(this, {
|
102
104
|
diffViewState: observable,
|
103
|
-
|
104
|
-
|
105
|
+
querySnapshot: observable,
|
106
|
+
hashCodeSnapshot: observable,
|
105
107
|
hasChanged: computed,
|
106
108
|
initialize: action,
|
107
109
|
showDiffViewPanel: action,
|
@@ -113,12 +115,12 @@ export class QueryBuilderChangeDetectionState {
|
|
113
115
|
|
114
116
|
showDiffViewPanel(): void {
|
115
117
|
assertNonNullable(
|
116
|
-
this.
|
118
|
+
this.querySnapshot,
|
117
119
|
`Can't show changes: change detection is not properly initialized`,
|
118
120
|
);
|
119
121
|
this.diffViewState = new QueryBuilderDiffViewState(
|
120
122
|
this,
|
121
|
-
this.
|
123
|
+
this.querySnapshot,
|
122
124
|
this.querybuilderState.buildQuery(),
|
123
125
|
);
|
124
126
|
}
|
@@ -131,13 +133,13 @@ export class QueryBuilderChangeDetectionState {
|
|
131
133
|
if (!this.initState.hasCompleted) {
|
132
134
|
return false;
|
133
135
|
}
|
134
|
-
return this.querybuilderState.hashCode !== this.
|
136
|
+
return this.querybuilderState.hashCode !== this.hashCodeSnapshot;
|
135
137
|
}
|
136
138
|
|
137
139
|
initialize(initialQuery: RawLambda): void {
|
138
140
|
this.initState.inProgress();
|
139
|
-
this.
|
140
|
-
this.
|
141
|
+
this.hashCodeSnapshot = this.querybuilderState.hashCode;
|
142
|
+
this.querySnapshot = initialQuery;
|
141
143
|
this.initState.complete();
|
142
144
|
}
|
143
145
|
|
@@ -57,11 +57,11 @@ export class QueryBuilderConstantExpressionState implements Hashable {
|
|
57
57
|
this.queryBuilderState = queryBuilderState;
|
58
58
|
this.value = observe_ValueSpecification(
|
59
59
|
value,
|
60
|
-
this.queryBuilderState.
|
60
|
+
this.queryBuilderState.observerContext,
|
61
61
|
);
|
62
62
|
observe_ValueSpecification(
|
63
63
|
variable,
|
64
|
-
this.queryBuilderState.
|
64
|
+
this.queryBuilderState.observerContext,
|
65
65
|
);
|
66
66
|
this.variable = variable;
|
67
67
|
}
|
@@ -73,6 +73,7 @@ export class QueryBuilderConstantExpressionState implements Hashable {
|
|
73
73
|
const valSpec = buildDefaultInstanceValue(
|
74
74
|
this.queryBuilderState.graphManagerState.graph,
|
75
75
|
type,
|
76
|
+
this.queryBuilderState.observerContext,
|
76
77
|
);
|
77
78
|
this.setValueSpec(valSpec);
|
78
79
|
} catch (error) {
|
@@ -92,7 +93,7 @@ export class QueryBuilderConstantExpressionState implements Hashable {
|
|
92
93
|
}
|
93
94
|
this.value = observe_ValueSpecification(
|
94
95
|
value,
|
95
|
-
this.queryBuilderState.
|
96
|
+
this.queryBuilderState.observerContext,
|
96
97
|
);
|
97
98
|
const valueSpecType = value.genericType?.value.rawType;
|
98
99
|
if (
|
@@ -21,8 +21,6 @@ import {
|
|
21
21
|
guaranteeType,
|
22
22
|
type Hashable,
|
23
23
|
hashArray,
|
24
|
-
isCamelCase,
|
25
|
-
prettyCamelCase,
|
26
24
|
prettyCONSTName,
|
27
25
|
} from '@finos/legend-shared';
|
28
26
|
import {
|
@@ -48,6 +46,7 @@ import {
|
|
48
46
|
GenericType,
|
49
47
|
PropertyExplicitReference,
|
50
48
|
PrimitiveType,
|
49
|
+
type ObserverContext,
|
51
50
|
} from '@finos/legend-graph';
|
52
51
|
import {
|
53
52
|
createNullishValue,
|
@@ -63,15 +62,12 @@ import {
|
|
63
62
|
} from './shared/ValueSpecificationModifierHelper.js';
|
64
63
|
import { generateMilestonedPropertyParameterValue } from './milestoning/QueryBuilderMilestoningHelper.js';
|
65
64
|
|
66
|
-
export const prettyPropertyName = (value: string): string =>
|
67
|
-
isCamelCase(value) ? prettyCamelCase(value) : prettyCONSTName(value);
|
68
|
-
|
69
65
|
export const getPropertyChainName = (
|
70
66
|
propertyExpression: AbstractPropertyExpression,
|
71
67
|
humanizePropertyName: boolean,
|
72
68
|
): string => {
|
73
69
|
const propertyNameDecorator = humanizePropertyName
|
74
|
-
?
|
70
|
+
? prettyCONSTName
|
75
71
|
: (val: string): string => val;
|
76
72
|
const chunks = [propertyNameDecorator(propertyExpression.func.value.name)];
|
77
73
|
let currentExpression: ValueSpecification | undefined = propertyExpression;
|
@@ -146,6 +142,7 @@ export const getPropertyPath = (
|
|
146
142
|
export const generateValueSpecificationForParameter = (
|
147
143
|
parameter: VariableExpression,
|
148
144
|
graph: PureModel,
|
145
|
+
observerContext: ObserverContext,
|
149
146
|
): ValueSpecification => {
|
150
147
|
if (parameter.genericType) {
|
151
148
|
const type = parameter.genericType.value.rawType;
|
@@ -161,9 +158,11 @@ export const generateValueSpecificationForParameter = (
|
|
161
158
|
),
|
162
159
|
);
|
163
160
|
if (type !== PrimitiveType.LATESTDATE) {
|
164
|
-
instanceValue_setValues(
|
165
|
-
|
166
|
-
|
161
|
+
instanceValue_setValues(
|
162
|
+
primitiveInstanceValue,
|
163
|
+
[generateDefaultValueForPrimitiveType(type.name as PRIMITIVE_TYPE)],
|
164
|
+
observerContext,
|
165
|
+
);
|
167
166
|
}
|
168
167
|
return primitiveInstanceValue;
|
169
168
|
} else if (type instanceof Enumeration) {
|
@@ -174,7 +173,11 @@ export const generateValueSpecificationForParameter = (
|
|
174
173
|
const enumValueRef = EnumValueExplicitReference.create(
|
175
174
|
type.values[0] as Enum,
|
176
175
|
);
|
177
|
-
instanceValue_setValues(
|
176
|
+
instanceValue_setValues(
|
177
|
+
enumValueInstanceValue,
|
178
|
+
[enumValueRef],
|
179
|
+
observerContext,
|
180
|
+
);
|
178
181
|
}
|
179
182
|
return enumValueInstanceValue;
|
180
183
|
}
|
@@ -213,6 +216,7 @@ const fillDerivedPropertyParameterValues = (
|
|
213
216
|
parameter,
|
214
217
|
derivedPropertyExpressionState.queryBuilderState.graphManagerState
|
215
218
|
.graph,
|
219
|
+
derivedPropertyExpressionState.queryBuilderState.observerContext,
|
216
220
|
),
|
217
221
|
);
|
218
222
|
});
|
@@ -224,7 +228,7 @@ const fillDerivedPropertyParameterValues = (
|
|
224
228
|
),
|
225
229
|
...parameterValues,
|
226
230
|
],
|
227
|
-
derivedPropertyExpressionState.queryBuilderState.
|
231
|
+
derivedPropertyExpressionState.queryBuilderState.observerContext,
|
228
232
|
);
|
229
233
|
};
|
230
234
|
|
@@ -246,7 +250,7 @@ export class QueryBuilderDerivedPropertyExpressionState {
|
|
246
250
|
this.title = getPropertyChainName(propertyExpression, true);
|
247
251
|
this.propertyExpression = observe_AbstractPropertyExpression(
|
248
252
|
propertyExpression,
|
249
|
-
queryBuilderState.
|
253
|
+
queryBuilderState.observerContext,
|
250
254
|
);
|
251
255
|
this.queryBuilderState = queryBuilderState;
|
252
256
|
this.derivedProperty = guaranteeType(
|
@@ -341,7 +345,7 @@ export class QueryBuilderPropertyExpressionState implements Hashable {
|
|
341
345
|
this.queryBuilderState = queryBuilderState;
|
342
346
|
this.propertyExpression = observe_AbstractPropertyExpression(
|
343
347
|
propertyExpression,
|
344
|
-
queryBuilderState.
|
348
|
+
queryBuilderState.observerContext,
|
345
349
|
);
|
346
350
|
this.path = getPropertyPath(propertyExpression);
|
347
351
|
this.title = getPropertyChainName(propertyExpression, true);
|
@@ -86,7 +86,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
86
86
|
|
87
87
|
readonly changeDetectionState: QueryBuilderChangeDetectionState;
|
88
88
|
readonly queryCompileState = ActionState.create();
|
89
|
-
readonly
|
89
|
+
readonly observerContext: ObserverContext;
|
90
90
|
|
91
91
|
explorerState: QueryBuilderExplorerState;
|
92
92
|
functionsExplorerState: QueryFunctionsExplorerState;
|
@@ -183,7 +183,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
183
183
|
this.resultState = new QueryBuilderResultState(this);
|
184
184
|
this.textEditorState = new QueryBuilderTextEditorState(this);
|
185
185
|
this.unsupportedQueryState = new QueryBuilderUnsupportedQueryState(this);
|
186
|
-
this.
|
186
|
+
this.observerContext = new ObserverContext(
|
187
187
|
this.graphManagerState.pluginManager.getPureGraphManagerPlugins(),
|
188
188
|
);
|
189
189
|
this.changeDetectionState = new QueryBuilderChangeDetectionState(this);
|
@@ -295,10 +295,10 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
295
295
|
);
|
296
296
|
}
|
297
297
|
|
298
|
-
resetQueryResult(preserveResult?: boolean): void {
|
298
|
+
resetQueryResult(options?: { preserveResult?: boolean | undefined }): void {
|
299
299
|
const resultState = new QueryBuilderResultState(this);
|
300
300
|
resultState.setPreviewLimit(this.resultState.previewLimit);
|
301
|
-
if (preserveResult) {
|
301
|
+
if (options?.preserveResult) {
|
302
302
|
resultState.setExecutionResult(this.resultState.executionResult);
|
303
303
|
resultState.setExecutionDuration(this.resultState.executionDuration);
|
304
304
|
resultState.latestRunHashCode = this.resultState.latestRunHashCode;
|
@@ -408,7 +408,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
408
408
|
previousStateParameterValues.set(ps.parameter, ps.value);
|
409
409
|
});
|
410
410
|
}
|
411
|
-
this.resetQueryResult(options?.preserveResult);
|
411
|
+
this.resetQueryResult({ preserveResult: options?.preserveResult });
|
412
412
|
this.resetQueryContent();
|
413
413
|
|
414
414
|
if (!isStubbed_RawLambda(query)) {
|
@@ -419,7 +419,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
419
419
|
),
|
420
420
|
this.graphManagerState.graph,
|
421
421
|
),
|
422
|
-
this.
|
422
|
+
this.observerContext,
|
423
423
|
);
|
424
424
|
const compiledValueSpecification = guaranteeType(
|
425
425
|
valueSpec,
|
@@ -446,9 +446,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
446
446
|
query,
|
447
447
|
this.graphManagerState,
|
448
448
|
)
|
449
|
-
.map((param) =>
|
450
|
-
observe_ValueSpecification(param, this.observableContext),
|
451
|
-
)
|
449
|
+
.map((param) => observe_ValueSpecification(param, this.observerContext))
|
452
450
|
.filter(filterByType(VariableExpression));
|
453
451
|
processParameters(parameters, this);
|
454
452
|
}
|
@@ -607,27 +607,25 @@ export class QueryBuilderValueSpecificationProcessor
|
|
607
607
|
export const processParameters = (
|
608
608
|
parameters: VariableExpression[],
|
609
609
|
queryBuilderState: QueryBuilderState,
|
610
|
-
|
610
|
+
parameterValues?: Map<VariableExpression, ValueSpecification | undefined>,
|
611
611
|
): void => {
|
612
612
|
const queryParameterState = queryBuilderState.parametersState;
|
613
|
-
// Here we won't mock the values for parameters which are present in the previous state
|
614
|
-
// because we don't want to lose the parameter value
|
615
613
|
parameters.forEach((parameter) => {
|
616
|
-
let
|
617
|
-
if (
|
618
|
-
Array.from(
|
614
|
+
let matchingParameterValue: ValueSpecification | undefined;
|
615
|
+
if (parameterValues) {
|
616
|
+
Array.from(parameterValues.entries()).forEach(([key, value]) => {
|
619
617
|
if (checkIfEquivalent(key, parameter)) {
|
620
|
-
|
618
|
+
matchingParameterValue = value;
|
621
619
|
}
|
622
620
|
});
|
623
621
|
}
|
624
622
|
const parameterState = new LambdaParameterState(
|
625
623
|
parameter,
|
626
|
-
queryBuilderState.
|
624
|
+
queryBuilderState.observerContext,
|
627
625
|
queryBuilderState.graphManagerState.graph,
|
628
626
|
);
|
629
|
-
if (
|
630
|
-
parameterState.setValue(
|
627
|
+
if (matchingParameterValue) {
|
628
|
+
parameterState.setValue(matchingParameterValue);
|
631
629
|
} else {
|
632
630
|
parameterState.mockParameterValue();
|
633
631
|
}
|
@@ -639,13 +637,13 @@ export const processParameters = (
|
|
639
637
|
export const processQueryLambdaFunction = (
|
640
638
|
lambdaFunction: LambdaFunction,
|
641
639
|
queryBuilderState: QueryBuilderState,
|
642
|
-
|
640
|
+
parameterValues?: Map<VariableExpression, ValueSpecification | undefined>,
|
643
641
|
): void => {
|
644
642
|
if (lambdaFunction.functionType.parameters.length) {
|
645
643
|
processParameters(
|
646
644
|
lambdaFunction.functionType.parameters,
|
647
645
|
queryBuilderState,
|
648
|
-
|
646
|
+
parameterValues,
|
649
647
|
);
|
650
648
|
}
|
651
649
|
lambdaFunction.expressionSequence.map((expression) =>
|
@@ -114,7 +114,7 @@ export const buildPropertyExpressionChain = (
|
|
114
114
|
functionExpression_setParametersValues(
|
115
115
|
currentExpression,
|
116
116
|
[guaranteeNonNullable(currentExpression.parametersValues[0])],
|
117
|
-
queryBuilderState.
|
117
|
+
queryBuilderState.observerContext,
|
118
118
|
);
|
119
119
|
}
|
120
120
|
} else {
|
@@ -44,6 +44,8 @@ import {
|
|
44
44
|
GenericTypeExplicitReference,
|
45
45
|
GenericType,
|
46
46
|
INTERNAL__PropagatedValue,
|
47
|
+
isSubType,
|
48
|
+
type ObserverContext,
|
47
49
|
} from '@finos/legend-graph';
|
48
50
|
import {
|
49
51
|
addUniqueEntry,
|
@@ -59,6 +61,7 @@ import {
|
|
59
61
|
getDerivedPropertyMilestoningSteoreotype,
|
60
62
|
validateMilestoningPropertyExpressionChain,
|
61
63
|
} from './milestoning/QueryBuilderMilestoningHelper.js';
|
64
|
+
import { instanceValue_setValues } from './shared/ValueSpecificationModifierHelper.js';
|
62
65
|
|
63
66
|
export const getNonCollectionValueSpecificationType = (
|
64
67
|
valueSpecification: ValueSpecification,
|
@@ -355,3 +358,36 @@ export const isValueExpressionReferencedInValue = (
|
|
355
358
|
}
|
356
359
|
return false;
|
357
360
|
};
|
361
|
+
|
362
|
+
/**
|
363
|
+
* Some expression which represents a value and can be simplified to make
|
364
|
+
* editing experience easier
|
365
|
+
*
|
366
|
+
* e.g. -5 is often represented as minus(5), which is a function expression
|
367
|
+
* but we want to simplify it to a primitive instance value with value -5
|
368
|
+
*/
|
369
|
+
export const simplifyValueExpression = (
|
370
|
+
value: ValueSpecification,
|
371
|
+
observerContext: ObserverContext,
|
372
|
+
): ValueSpecification => {
|
373
|
+
if (
|
374
|
+
value instanceof SimpleFunctionExpression &&
|
375
|
+
matchFunctionName(
|
376
|
+
value.functionName,
|
377
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.MINUS,
|
378
|
+
) &&
|
379
|
+
value.parametersValues.length === 1 &&
|
380
|
+
value.parametersValues[0] instanceof PrimitiveInstanceValue
|
381
|
+
) {
|
382
|
+
const val = value.parametersValues[0];
|
383
|
+
if (isSubType(val.genericType.value.rawType, PrimitiveType.NUMBER)) {
|
384
|
+
instanceValue_setValues(
|
385
|
+
val,
|
386
|
+
[(val.values[0] as number) * -1],
|
387
|
+
observerContext,
|
388
|
+
);
|
389
|
+
}
|
390
|
+
return val;
|
391
|
+
}
|
392
|
+
return value;
|
393
|
+
};
|