@finos/legend-query-builder 4.19.8 → 4.19.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/QueryBuilderSideBar.d.ts +3 -1
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderSideBar.js +27 -8
- package/lib/components/QueryBuilderSideBar.js.map +1 -1
- package/lib/data-access-overview.css +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderChangeDetectionState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderChangeDetectionState.js +11 -13
- package/lib/stores/QueryBuilderChangeDetectionState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts +5 -0
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +36 -3
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +6 -0
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/lib/stores/data-cube/QueryBuilderDataCubeHelper.d.ts.map +1 -1
- package/lib/stores/data-cube/QueryBuilderDataCubeHelper.js +4 -0
- package/lib/stores/data-cube/QueryBuilderDataCubeHelper.js.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts +1 -0
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js +3 -0
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts +1 -0
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js +6 -28
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js.map +1 -1
- package/package.json +5 -5
- package/src/components/QueryBuilderSideBar.tsx +34 -10
- package/src/index.ts +3 -0
- package/src/stores/QueryBuilderChangeDetectionState.ts +13 -18
- package/src/stores/QueryBuilderState.ts +46 -5
- package/src/stores/QueryBuilderStateBuilder.ts +13 -0
- package/src/stores/data-cube/QueryBuilderDataCubeHelper.ts +6 -0
- package/src/stores/workflows/accessor/AccessorQueryBuilderState.ts +4 -0
- package/src/stores/workflows/dataProduct/DataProductQueryBuilderState.ts +7 -46
|
@@ -304,6 +304,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
304
304
|
setLambdaWriteMode: action,
|
|
305
305
|
setINTERNAL__enableInitializingDefaultSimpleExpressionValue: action,
|
|
306
306
|
TEMPORARY_initializeExecContext: action,
|
|
307
|
+
reconcileExecutionContextState: action,
|
|
307
308
|
|
|
308
309
|
resetQueryResult: action,
|
|
309
310
|
resetQueryContent: action,
|
|
@@ -355,11 +356,9 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
355
356
|
isTypedTDS: boolean,
|
|
356
357
|
): QueryBuilderExecutionContextState {
|
|
357
358
|
if (isTypedTDS) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
);
|
|
362
|
-
return context;
|
|
359
|
+
this.lambdaWriteMode =
|
|
360
|
+
QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE;
|
|
361
|
+
return new QueryBuilderEmbeddedFromExecutionContextState(this);
|
|
363
362
|
}
|
|
364
363
|
return new QueryBuilderExternalExecutionContextState(this);
|
|
365
364
|
}
|
|
@@ -421,6 +420,12 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
421
420
|
);
|
|
422
421
|
}
|
|
423
422
|
|
|
423
|
+
get requiresEmbeddedExecutionContext(): boolean {
|
|
424
|
+
return (
|
|
425
|
+
this.isFetchStructureTyped && Boolean(this.executionContextState.mapping)
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
424
429
|
get forceFromExpressionForExec(): boolean {
|
|
425
430
|
return this.isFetchStructureTyped;
|
|
426
431
|
}
|
|
@@ -431,6 +436,29 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
431
436
|
|
|
432
437
|
setLambdaWriteMode(val: QUERY_BUILDER_LAMBDA_WRITER_MODE): void {
|
|
433
438
|
this.lambdaWriteMode = val;
|
|
439
|
+
this.reconcileExecutionContextState();
|
|
440
|
+
}
|
|
441
|
+
reconcileExecutionContextState(options?: {
|
|
442
|
+
allowDowngrade?: boolean | undefined;
|
|
443
|
+
}): void {
|
|
444
|
+
const requiresEmbedded = this.requiresEmbeddedExecutionContext;
|
|
445
|
+
const isEmbedded =
|
|
446
|
+
this.executionContextState instanceof
|
|
447
|
+
QueryBuilderEmbeddedFromExecutionContextState;
|
|
448
|
+
if (requiresEmbedded === isEmbedded) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (isEmbedded && !options?.allowDowngrade) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
const preservedMapping = this.executionContextState.mapping;
|
|
455
|
+
const preservedRuntime = this.executionContextState.runtimeValue;
|
|
456
|
+
const next = requiresEmbedded
|
|
457
|
+
? new QueryBuilderEmbeddedFromExecutionContextState(this)
|
|
458
|
+
: new QueryBuilderExternalExecutionContextState(this);
|
|
459
|
+
next.setMapping(preservedMapping);
|
|
460
|
+
next.setRuntimeValue(preservedRuntime);
|
|
461
|
+
this.setExecutionContextState(next);
|
|
434
462
|
}
|
|
435
463
|
|
|
436
464
|
getQueryExecutionContext(): QueryExecutionContext {
|
|
@@ -794,6 +822,19 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
794
822
|
return this.buildQuery();
|
|
795
823
|
}
|
|
796
824
|
|
|
825
|
+
protected buildQueryLambdaWithoutExecutionContext(): RawLambda {
|
|
826
|
+
if (!this.isQuerySupported) {
|
|
827
|
+
return this.buildQuery();
|
|
828
|
+
}
|
|
829
|
+
return buildRawLambdaFromLambdaFunction(
|
|
830
|
+
buildLambdaFunction(this, {
|
|
831
|
+
skipExecutionContext: true,
|
|
832
|
+
useTypedRelationFunctions: this.isFetchStructureTyped,
|
|
833
|
+
}),
|
|
834
|
+
this.graphManagerState,
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
797
838
|
buildFromQuery(): RawLambda {
|
|
798
839
|
assertTrue(
|
|
799
840
|
this.isQuerySupported,
|
|
@@ -895,6 +895,19 @@ export class QueryBuilderValueSpecificationProcessor
|
|
|
895
895
|
this.queryBuilderState,
|
|
896
896
|
);
|
|
897
897
|
return;
|
|
898
|
+
} else if (matchFunctionName(functionName, [SUPPORTED_FUNCTIONS.WITH])) {
|
|
899
|
+
const parameters = valueSpecification.parametersValues;
|
|
900
|
+
assertTrue(
|
|
901
|
+
parameters.length === 2,
|
|
902
|
+
'With function expects a body expression and a data product',
|
|
903
|
+
);
|
|
904
|
+
QueryBuilderValueSpecificationProcessor.processChild(
|
|
905
|
+
guaranteeNonNullable(parameters[0]),
|
|
906
|
+
valueSpecification,
|
|
907
|
+
this.parentLambda,
|
|
908
|
+
this.queryBuilderState,
|
|
909
|
+
);
|
|
910
|
+
return;
|
|
898
911
|
} else if (
|
|
899
912
|
matchFunctionName(
|
|
900
913
|
functionName,
|
|
@@ -37,6 +37,7 @@ export const createDataCubeViewerStateFromQueryBuilder = async (
|
|
|
37
37
|
}
|
|
38
38
|
const mappingPath = queryBuilderState.executionContextState.mapping?.path;
|
|
39
39
|
const currentLambdaWriterMode = queryBuilderState.lambdaWriteMode;
|
|
40
|
+
const currentExecutionContextState = queryBuilderState.executionContextState;
|
|
40
41
|
// ensure we write in new tds mode
|
|
41
42
|
queryBuilderState.setLambdaWriteMode(
|
|
42
43
|
QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
|
|
@@ -55,6 +56,11 @@ export const createDataCubeViewerStateFromQueryBuilder = async (
|
|
|
55
56
|
queryBuilderState,
|
|
56
57
|
);
|
|
57
58
|
queryBuilderState.setLambdaWriteMode(currentLambdaWriterMode);
|
|
59
|
+
if (
|
|
60
|
+
queryBuilderState.executionContextState !== currentExecutionContextState
|
|
61
|
+
) {
|
|
62
|
+
queryBuilderState.setExecutionContextState(currentExecutionContextState);
|
|
63
|
+
}
|
|
58
64
|
const query = await engine.generateInitialSpecification();
|
|
59
65
|
return new QueryBuilderDataCubeViewerState(query, engine);
|
|
60
66
|
};
|
|
@@ -149,6 +149,10 @@ export class AccessorQueryBuilderState extends QueryBuilderState {
|
|
|
149
149
|
return false;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
override get requiresEmbeddedExecutionContext(): boolean {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
/**
|
|
153
157
|
* In accessor mode, configure both filter and post-filter panels to be visible.
|
|
154
158
|
*/
|
|
@@ -29,12 +29,8 @@ import {
|
|
|
29
29
|
resolveUsableDataProductClasses,
|
|
30
30
|
LakehouseRuntime,
|
|
31
31
|
type LambdaFunction,
|
|
32
|
-
|
|
33
|
-
InstanceValue,
|
|
34
|
-
Multiplicity,
|
|
32
|
+
attachWithFromQuery,
|
|
35
33
|
type MappingModelCoverageAnalysisResult,
|
|
36
|
-
extractElementNameFromPath,
|
|
37
|
-
SUPPORTED_FUNCTIONS,
|
|
38
34
|
PackageableElementExplicitReference,
|
|
39
35
|
resolveDataProductExecutionState,
|
|
40
36
|
RuntimePointer,
|
|
@@ -44,7 +40,6 @@ import {
|
|
|
44
40
|
QueryDataProductLakehouseExecutionContext,
|
|
45
41
|
LakehouseAccessPoint,
|
|
46
42
|
type RawLambda,
|
|
47
|
-
buildRawLambdaFromLambdaFunction,
|
|
48
43
|
type Accessor,
|
|
49
44
|
type RelationTypeMetadata,
|
|
50
45
|
DataProductAccessor,
|
|
@@ -82,7 +77,6 @@ import {
|
|
|
82
77
|
} from '@finos/legend-storage';
|
|
83
78
|
import { compareLabelFn } from '@finos/legend-art';
|
|
84
79
|
import { QueryBuilderEmbeddedFromExecutionContextState } from '../../QueryBuilderExecutionContextState.js';
|
|
85
|
-
import { buildLambdaFunction } from '../../QueryBuilderValueSpecificationBuilder.js';
|
|
86
80
|
|
|
87
81
|
export const resolveDataProductAccessor = (
|
|
88
82
|
dataProduct: DataProduct,
|
|
@@ -624,6 +618,10 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
624
618
|
return true;
|
|
625
619
|
}
|
|
626
620
|
|
|
621
|
+
override get requiresEmbeddedExecutionContext(): boolean {
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
624
|
+
|
|
627
625
|
get selectedModelAccessPointGroupOption():
|
|
628
626
|
| ModelAccessPointGroupOption
|
|
629
627
|
| undefined {
|
|
@@ -646,19 +644,7 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
646
644
|
}
|
|
647
645
|
|
|
648
646
|
override buildQueryForPersistence(): RawLambda {
|
|
649
|
-
|
|
650
|
-
return this.buildQuery();
|
|
651
|
-
}
|
|
652
|
-
// Build without embedding execution context in the lambda body.
|
|
653
|
-
// The execution context (dataProductPath, executionKey/accessPointGroupId)
|
|
654
|
-
// is stored separately in query.executionContext via getQueryExecutionContext().
|
|
655
|
-
return buildRawLambdaFromLambdaFunction(
|
|
656
|
-
buildLambdaFunction(this, {
|
|
657
|
-
skipExecutionContext: true,
|
|
658
|
-
useTypedRelationFunctions: this.isFetchStructureTyped,
|
|
659
|
-
}),
|
|
660
|
-
this.graphManagerState,
|
|
661
|
-
);
|
|
647
|
+
return this.buildQueryLambdaWithoutExecutionContext();
|
|
662
648
|
}
|
|
663
649
|
|
|
664
650
|
override getQueryExecutionContext(): QueryExecutionContext {
|
|
@@ -905,34 +891,9 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
905
891
|
if (
|
|
906
892
|
this.executionState instanceof ModelAccessPointDataProductExecutionState
|
|
907
893
|
) {
|
|
908
|
-
// for model access point group with attached ->with(dataProduct)->from(runtime) to execute query
|
|
909
|
-
let precedingExpression = guaranteeNonNullable(
|
|
910
|
-
lambdaFunction.expressionSequence[0],
|
|
911
|
-
`Can't build from() expression: preceding expression is not defined`,
|
|
912
|
-
);
|
|
913
|
-
const withFunc = new SimpleFunctionExpression(
|
|
914
|
-
extractElementNameFromPath(SUPPORTED_FUNCTIONS.WITH),
|
|
915
|
-
);
|
|
916
|
-
const dataProductInstance = new InstanceValue(
|
|
917
|
-
Multiplicity.ONE,
|
|
918
|
-
undefined,
|
|
919
|
-
);
|
|
920
|
-
dataProductInstance.values = [
|
|
921
|
-
PackageableElementExplicitReference.create(this.dataProduct),
|
|
922
|
-
];
|
|
923
|
-
withFunc.parametersValues = [precedingExpression, dataProductInstance];
|
|
924
|
-
precedingExpression = withFunc;
|
|
925
|
-
const fromFunc = new SimpleFunctionExpression(
|
|
926
|
-
extractElementNameFromPath(SUPPORTED_FUNCTIONS.FROM),
|
|
927
|
-
);
|
|
928
894
|
const runtime = this.executionState.selectedRuntime;
|
|
929
895
|
if (runtime) {
|
|
930
|
-
|
|
931
|
-
runtimeInstance.values = [
|
|
932
|
-
PackageableElementExplicitReference.create(runtime),
|
|
933
|
-
];
|
|
934
|
-
fromFunc.parametersValues = [precedingExpression, runtimeInstance];
|
|
935
|
-
lambdaFunction.expressionSequence[0] = fromFunc;
|
|
896
|
+
return attachWithFromQuery(lambdaFunction, this.dataProduct, runtime);
|
|
936
897
|
}
|
|
937
898
|
return lambdaFunction;
|
|
938
899
|
}
|