@finos/legend-query-builder 4.7.4 → 4.9.0
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 +27 -8
- package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +11 -5
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +5 -3
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +8 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/shared/LambdaEditor.d.ts +1 -11
- package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaEditor.js +11 -4
- package/lib/components/shared/LambdaEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts +3 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.js +27 -3
- package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +1 -0
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.js +190 -30
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +1 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts +1 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js +4 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +1 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +3 -0
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +2 -0
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +25 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +3 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +6 -0
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +9 -2
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +40 -6
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +1 -0
- package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +8 -1
- package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +1 -0
- package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +7 -1
- package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +4 -0
- package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +1 -0
- package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +7 -1
- package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -1
- package/package.json +3 -3
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +85 -24
- package/src/components/QueryBuilderResultPanel.tsx +17 -13
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +11 -1
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +12 -1
- package/src/components/shared/LambdaEditor.tsx +15 -2
- package/src/stores/QueryBuilderConstantsState.ts +44 -1
- package/src/stores/QueryBuilderState.ts +1 -0
- package/src/stores/QueryBuilderTypeaheadHelper.ts +382 -54
- package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +1 -0
- package/src/stores/fetch-structure/QueryBuilderFetchStructureState.ts +5 -0
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +4 -0
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +43 -1
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +11 -0
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +66 -9
- package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +14 -0
- package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +13 -0
- package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +7 -0
- package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +13 -0
@@ -14,7 +14,14 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
17
|
+
import {
|
18
|
+
action,
|
19
|
+
makeObservable,
|
20
|
+
observable,
|
21
|
+
flow,
|
22
|
+
computed,
|
23
|
+
flowResult,
|
24
|
+
} from 'mobx';
|
18
25
|
import {
|
19
26
|
type GeneratorFn,
|
20
27
|
LogEvent,
|
@@ -24,6 +31,7 @@ import {
|
|
24
31
|
assertNonEmptyString,
|
25
32
|
type Hashable,
|
26
33
|
hashArray,
|
34
|
+
ActionState,
|
27
35
|
} from '@finos/legend-shared';
|
28
36
|
import {
|
29
37
|
type QueryBuilderExplorerTreePropertyNodeData,
|
@@ -275,6 +283,7 @@ export class QueryBuilderDerivationProjectionColumnState
|
|
275
283
|
derivationLambdaEditorState: QueryBuilderDerivationProjectionLambdaState;
|
276
284
|
lambda: RawLambda;
|
277
285
|
returnType: Type | undefined;
|
286
|
+
fetchingLambdaReturnTypeState = ActionState.create();
|
278
287
|
|
279
288
|
constructor(tdsState: QueryBuilderTDSState, lambda: RawLambda) {
|
280
289
|
super(tdsState, '(derivation)');
|
@@ -282,8 +291,10 @@ export class QueryBuilderDerivationProjectionColumnState
|
|
282
291
|
makeObservable(this, {
|
283
292
|
lambda: observable,
|
284
293
|
returnType: observable,
|
294
|
+
fetchingLambdaReturnTypeState: observable,
|
285
295
|
setLambda: action,
|
286
296
|
fetchDerivationLambdaReturnType: flow,
|
297
|
+
setLambdaReturnType: action,
|
287
298
|
});
|
288
299
|
|
289
300
|
this.derivationLambdaEditorState =
|
@@ -307,10 +318,56 @@ export class QueryBuilderDerivationProjectionColumnState
|
|
307
318
|
* Throws error if unable to fetch type or if type is not primitive or an enumeration
|
308
319
|
* as expected by a projection column
|
309
320
|
*/
|
310
|
-
*fetchDerivationLambdaReturnType(
|
321
|
+
*fetchDerivationLambdaReturnType(options?: {
|
322
|
+
forceRefresh?: boolean;
|
323
|
+
forceConversionStringToLambda?: boolean;
|
324
|
+
isBeingDropped?: boolean;
|
325
|
+
}): GeneratorFn<void> {
|
326
|
+
if (!options?.forceRefresh && this.returnType !== undefined) {
|
327
|
+
return;
|
328
|
+
}
|
329
|
+
try {
|
330
|
+
assertTrue(
|
331
|
+
!this.fetchingLambdaReturnTypeState.isInProgress,
|
332
|
+
'Fetching lambda return type already in progress',
|
333
|
+
);
|
334
|
+
this.fetchingLambdaReturnTypeState.inProgress();
|
335
|
+
if (options?.isBeingDropped) {
|
336
|
+
this.tdsState.postFilterState.setDerivedColumnBeingDropped(this);
|
337
|
+
}
|
338
|
+
if (options?.forceConversionStringToLambda) {
|
339
|
+
yield flowResult(
|
340
|
+
this.derivationLambdaEditorState.convertLambdaGrammarStringToObject(),
|
341
|
+
).catch(
|
342
|
+
this.tdsState.queryBuilderState.applicationStore.alertUnhandledError,
|
343
|
+
);
|
344
|
+
}
|
345
|
+
assertTrue(Array.isArray(this.lambda.parameters));
|
346
|
+
const graph = this.tdsState.queryBuilderState.graphManagerState.graph;
|
347
|
+
const isolatedLambda = this.getIsolatedRawLambda();
|
348
|
+
const type =
|
349
|
+
(yield this.tdsState.queryBuilderState.graphManagerState.graphManager.getLambdaReturnType(
|
350
|
+
isolatedLambda,
|
351
|
+
graph,
|
352
|
+
)) as string;
|
353
|
+
this.setLambdaReturnType(type);
|
354
|
+
} catch (error) {
|
355
|
+
assertErrorThrown(error);
|
356
|
+
this.tdsState.queryBuilderState.applicationStore.logService.info(
|
357
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
|
358
|
+
error,
|
359
|
+
);
|
360
|
+
} finally {
|
361
|
+
this.fetchingLambdaReturnTypeState.complete();
|
362
|
+
if (options?.isBeingDropped) {
|
363
|
+
this.tdsState.postFilterState.setDerivedColumnBeingDropped(undefined);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
getIsolatedRawLambda(): RawLambda {
|
311
369
|
assertTrue(Array.isArray(this.lambda.parameters));
|
312
370
|
const projectionParameter = this.lambda.parameters as object[];
|
313
|
-
const graph = this.tdsState.queryBuilderState.graphManagerState.graph;
|
314
371
|
assertTrue(projectionParameter.length === 1);
|
315
372
|
const variable = projectionParameter[0] as VariableExpression;
|
316
373
|
assertNonEmptyString(variable.name);
|
@@ -330,12 +387,12 @@ export class QueryBuilderDerivationProjectionColumnState
|
|
330
387
|
[_rawVariableExpression],
|
331
388
|
this.lambda.body,
|
332
389
|
);
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
390
|
+
return isolatedLambda;
|
391
|
+
}
|
392
|
+
|
393
|
+
setLambdaReturnType(type: string): void {
|
394
|
+
const resolvedType =
|
395
|
+
this.tdsState.queryBuilderState.graphManagerState.graph.getType(type);
|
339
396
|
assertTrue(
|
340
397
|
resolvedType instanceof PrimitiveType ||
|
341
398
|
resolvedType instanceof Enumeration,
|
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
AbstractPropertyExpression,
|
23
23
|
MILESTONING_STEREOTYPE,
|
24
24
|
INTERNAL__PropagatedValue,
|
25
|
+
PrimitiveType,
|
25
26
|
} from '@finos/legend-graph';
|
26
27
|
import {
|
27
28
|
assertTrue,
|
@@ -29,7 +30,9 @@ import {
|
|
29
30
|
guaranteeType,
|
30
31
|
} from '@finos/legend-shared';
|
31
32
|
import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
|
33
|
+
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
|
32
34
|
import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
|
35
|
+
import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
|
33
36
|
import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
|
34
37
|
|
35
38
|
export class QueryBuilderBitemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
|
@@ -90,6 +93,17 @@ export class QueryBuilderBitemporalMilestoningImplementation extends QueryBuilde
|
|
90
93
|
);
|
91
94
|
}
|
92
95
|
|
96
|
+
buildGetAllWithDefaultParameters(
|
97
|
+
getAllFunction: SimpleFunctionExpression,
|
98
|
+
): void {
|
99
|
+
const parameterValue = createSupportedFunctionExpression(
|
100
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW,
|
101
|
+
PrimitiveType.DATETIME,
|
102
|
+
);
|
103
|
+
getAllFunction.parametersValues.push(parameterValue);
|
104
|
+
getAllFunction.parametersValues.push(parameterValue);
|
105
|
+
}
|
106
|
+
|
93
107
|
generateMilestoningDate(
|
94
108
|
isDatePropagationSupported: boolean,
|
95
109
|
hasDefaultMilestoningDate: boolean,
|
@@ -21,9 +21,12 @@ import {
|
|
21
21
|
type AbstractPropertyExpression,
|
22
22
|
MILESTONING_STEREOTYPE,
|
23
23
|
INTERNAL__PropagatedValue,
|
24
|
+
PrimitiveType,
|
24
25
|
} from '@finos/legend-graph';
|
25
26
|
import { assertTrue, guaranteeNonNullable } from '@finos/legend-shared';
|
26
27
|
import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
|
28
|
+
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
|
29
|
+
import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
|
27
30
|
import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
|
28
31
|
|
29
32
|
export class QueryBuilderBusinessTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
|
@@ -64,6 +67,16 @@ export class QueryBuilderBusinessTemporalMilestoningImplementation extends Query
|
|
64
67
|
);
|
65
68
|
}
|
66
69
|
|
70
|
+
buildGetAllWithDefaultParameters(
|
71
|
+
getAllFunction: SimpleFunctionExpression,
|
72
|
+
): void {
|
73
|
+
const parameterValue = createSupportedFunctionExpression(
|
74
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW,
|
75
|
+
PrimitiveType.DATETIME,
|
76
|
+
);
|
77
|
+
getAllFunction.parametersValues.push(parameterValue);
|
78
|
+
}
|
79
|
+
|
67
80
|
generateMilestoningDate(
|
68
81
|
isDatePropagationSupported: boolean,
|
69
82
|
hasDefaultMilestoningDate: boolean,
|
@@ -63,6 +63,13 @@ export abstract class QueryBuilderMilestoningImplementation {
|
|
63
63
|
getAllFunction: SimpleFunctionExpression,
|
64
64
|
): void;
|
65
65
|
|
66
|
+
/**
|
67
|
+
* Builds parameters for getAll() function with milestoned class
|
68
|
+
*/
|
69
|
+
abstract buildGetAllWithDefaultParameters(
|
70
|
+
getAllFunction: SimpleFunctionExpression,
|
71
|
+
): void;
|
72
|
+
|
66
73
|
/**
|
67
74
|
* Generates milestoning date for a propertyexpression based on its source and target stereotype
|
68
75
|
*/
|
@@ -20,9 +20,12 @@ import {
|
|
20
20
|
type SimpleFunctionExpression,
|
21
21
|
type AbstractPropertyExpression,
|
22
22
|
INTERNAL__PropagatedValue,
|
23
|
+
PrimitiveType,
|
23
24
|
} from '@finos/legend-graph';
|
24
25
|
import { assertTrue, guaranteeNonNullable } from '@finos/legend-shared';
|
25
26
|
import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
|
27
|
+
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
|
28
|
+
import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
|
26
29
|
import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
|
27
30
|
|
28
31
|
export class QueryBuilderProcessingTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
|
@@ -63,6 +66,16 @@ export class QueryBuilderProcessingTemporalMilestoningImplementation extends Que
|
|
63
66
|
);
|
64
67
|
}
|
65
68
|
|
69
|
+
buildGetAllWithDefaultParameters(
|
70
|
+
getAllFunction: SimpleFunctionExpression,
|
71
|
+
): void {
|
72
|
+
const parameterValue = createSupportedFunctionExpression(
|
73
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW,
|
74
|
+
PrimitiveType.DATETIME,
|
75
|
+
);
|
76
|
+
getAllFunction.parametersValues.push(parameterValue);
|
77
|
+
}
|
78
|
+
|
66
79
|
generateMilestoningDate(
|
67
80
|
isDatePropagationSupported: boolean,
|
68
81
|
hasDefaultMilestoningDate: boolean,
|