@finos/legend-application-query 13.8.47 → 13.8.49
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/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +23 -6
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +11 -1
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.js +2 -1
- package/lib/components/data-space/DataSpaceInfo.js.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js +8 -6
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts +8 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +17 -11
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.d.ts +33 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.d.ts.map +1 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.js +74 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.js.map +1 -0
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.js +10 -4
- package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +8 -4
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +3 -3
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +39 -16
- package/src/components/QueryEditor.tsx +19 -3
- package/src/components/data-space/DataSpaceInfo.tsx +13 -2
- package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +13 -13
- package/src/stores/QueryEditorStore.ts +27 -15
- package/src/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.ts +138 -0
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +20 -6
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +12 -3
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +3 -9
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { ApplicationStore } from '@finos/legend-application';
|
|
18
|
+
import {
|
|
19
|
+
Core_GraphManagerPreset,
|
|
20
|
+
DataProduct,
|
|
21
|
+
Mapping,
|
|
22
|
+
ModelAccessPointGroup,
|
|
23
|
+
PackageableElementExplicitReference,
|
|
24
|
+
PackageableRuntime,
|
|
25
|
+
} from '@finos/legend-graph';
|
|
26
|
+
import { TEST__getTestGraphManagerState } from '@finos/legend-graph/test';
|
|
27
|
+
import {
|
|
28
|
+
QueryBuilderActionConfig,
|
|
29
|
+
QueryBuilderAdvancedWorkflowState,
|
|
30
|
+
QueryBuilder_GraphManagerPreset,
|
|
31
|
+
type QueryBuilderConfig,
|
|
32
|
+
TEST__LegendApplicationPluginManager,
|
|
33
|
+
} from '@finos/legend-query-builder';
|
|
34
|
+
import {
|
|
35
|
+
DataSpace,
|
|
36
|
+
DataSpaceExecutionContext,
|
|
37
|
+
DataSpaceMappingProvider,
|
|
38
|
+
DSL_DataSpace_GraphManagerPreset,
|
|
39
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
40
|
+
import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application';
|
|
41
|
+
import { TEST__getTestLegendQueryApplicationConfig } from './LegendQueryApplicationTestUtils.js';
|
|
42
|
+
|
|
43
|
+
export const TEST_DATA_SPACE_PATH = 'COVIDDatapace';
|
|
44
|
+
|
|
45
|
+
const DEFAULT_MAPG_ID = 'PureAlloyUsageMAPG';
|
|
46
|
+
|
|
47
|
+
export const buildRuntime = (name: string): PackageableRuntime =>
|
|
48
|
+
new PackageableRuntime(name);
|
|
49
|
+
|
|
50
|
+
export const buildMapping = (name: string): Mapping => new Mapping(name);
|
|
51
|
+
|
|
52
|
+
export const buildMappingProvider = (
|
|
53
|
+
mapping: Mapping,
|
|
54
|
+
groupId = DEFAULT_MAPG_ID,
|
|
55
|
+
dataProductName = 'Pure_Usage_Stats_Modeled',
|
|
56
|
+
): DataSpaceMappingProvider => {
|
|
57
|
+
const group = new ModelAccessPointGroup();
|
|
58
|
+
group.id = groupId;
|
|
59
|
+
group.mapping = PackageableElementExplicitReference.create(mapping);
|
|
60
|
+
const dataProduct = new DataProduct(dataProductName);
|
|
61
|
+
dataProduct.accessPointGroups = [group];
|
|
62
|
+
const provider = new DataSpaceMappingProvider();
|
|
63
|
+
provider.element = PackageableElementExplicitReference.create(dataProduct);
|
|
64
|
+
provider.keys = [groupId];
|
|
65
|
+
return provider;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const buildContext = (
|
|
69
|
+
name: string,
|
|
70
|
+
config: {
|
|
71
|
+
mapping?: Mapping | undefined;
|
|
72
|
+
mappingProvider?: DataSpaceMappingProvider | undefined;
|
|
73
|
+
defaultRuntime?: PackageableRuntime | undefined;
|
|
74
|
+
},
|
|
75
|
+
): DataSpaceExecutionContext => {
|
|
76
|
+
const context = new DataSpaceExecutionContext();
|
|
77
|
+
context.name = name;
|
|
78
|
+
context.mapping = config.mapping
|
|
79
|
+
? PackageableElementExplicitReference.create(config.mapping)
|
|
80
|
+
: undefined;
|
|
81
|
+
context.mappingProvider = config.mappingProvider;
|
|
82
|
+
context.defaultRuntime = config.defaultRuntime
|
|
83
|
+
? PackageableElementExplicitReference.create(config.defaultRuntime)
|
|
84
|
+
: undefined;
|
|
85
|
+
return context;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const buildDataSpace = (
|
|
89
|
+
name: string,
|
|
90
|
+
contexts: DataSpaceExecutionContext[] | undefined,
|
|
91
|
+
defaultContextName?: string | undefined,
|
|
92
|
+
): DataSpace => {
|
|
93
|
+
const dataSpace = new DataSpace(name);
|
|
94
|
+
dataSpace.package = undefined;
|
|
95
|
+
dataSpace.executionContexts = contexts;
|
|
96
|
+
dataSpace.defaultExecutionContext =
|
|
97
|
+
defaultContextName && contexts
|
|
98
|
+
? contexts.find((ctx) => ctx.name === defaultContextName)
|
|
99
|
+
: undefined;
|
|
100
|
+
return dataSpace;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const buildState = (
|
|
104
|
+
dataSpace: DataSpace,
|
|
105
|
+
executionContext: DataSpaceExecutionContext,
|
|
106
|
+
options?: { config?: QueryBuilderConfig },
|
|
107
|
+
): DataSpaceQueryBuilderState => {
|
|
108
|
+
const pluginManager = TEST__LegendApplicationPluginManager.create();
|
|
109
|
+
pluginManager
|
|
110
|
+
.usePresets([
|
|
111
|
+
new Core_GraphManagerPreset(),
|
|
112
|
+
new QueryBuilder_GraphManagerPreset(),
|
|
113
|
+
new DSL_DataSpace_GraphManagerPreset(),
|
|
114
|
+
])
|
|
115
|
+
.install();
|
|
116
|
+
const applicationStore = new ApplicationStore(
|
|
117
|
+
TEST__getTestLegendQueryApplicationConfig(),
|
|
118
|
+
pluginManager,
|
|
119
|
+
);
|
|
120
|
+
return new DataSpaceQueryBuilderState(
|
|
121
|
+
applicationStore,
|
|
122
|
+
TEST__getTestGraphManagerState(pluginManager),
|
|
123
|
+
QueryBuilderAdvancedWorkflowState.INSTANCE,
|
|
124
|
+
QueryBuilderActionConfig.INSTANCE,
|
|
125
|
+
dataSpace,
|
|
126
|
+
executionContext,
|
|
127
|
+
false,
|
|
128
|
+
undefined,
|
|
129
|
+
async () => {
|
|
130
|
+
/* no-op */
|
|
131
|
+
},
|
|
132
|
+
undefined,
|
|
133
|
+
undefined,
|
|
134
|
+
undefined,
|
|
135
|
+
undefined,
|
|
136
|
+
options?.config,
|
|
137
|
+
);
|
|
138
|
+
};
|
|
@@ -51,10 +51,12 @@ import {
|
|
|
51
51
|
import {
|
|
52
52
|
type DataSpaceExecutionContext,
|
|
53
53
|
getDataSpace,
|
|
54
|
+
resolveExecutionContextMapping,
|
|
54
55
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
55
56
|
import {
|
|
56
57
|
QueryBuilderActionConfig_QueryApplication,
|
|
57
58
|
QueryEditorStore,
|
|
59
|
+
resolveExecutionContext,
|
|
58
60
|
type QueryPersistConfiguration,
|
|
59
61
|
} from '../QueryEditorStore.js';
|
|
60
62
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
@@ -431,12 +433,25 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
431
433
|
queryableDataSpace.dataSpacePath,
|
|
432
434
|
this.graphManagerState.graph,
|
|
433
435
|
);
|
|
434
|
-
const executionContext =
|
|
435
|
-
dataSpace
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
const executionContext = resolveExecutionContext(
|
|
437
|
+
dataSpace,
|
|
438
|
+
queryableDataSpace.executionContext,
|
|
439
|
+
undefined,
|
|
440
|
+
undefined,
|
|
439
441
|
);
|
|
442
|
+
if (!executionContext) {
|
|
443
|
+
throw new Error(
|
|
444
|
+
`Execution context '${queryableDataSpace.executionContext}' does not exist in data space '${dataSpace.path}'.`,
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
if (
|
|
448
|
+
executionContext.mappingProvider &&
|
|
449
|
+
!resolveExecutionContextMapping(executionContext)
|
|
450
|
+
) {
|
|
451
|
+
throw new Error(
|
|
452
|
+
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
453
|
+
);
|
|
454
|
+
}
|
|
440
455
|
const sourceInfo = {
|
|
441
456
|
groupId: queryableDataSpace.groupId,
|
|
442
457
|
artifactId: queryableDataSpace.artifactId,
|
|
@@ -494,7 +509,6 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
494
509
|
this.productSelectorState.legacyDataProducts,
|
|
495
510
|
this.productSelectorState.dataProducts,
|
|
496
511
|
);
|
|
497
|
-
queryBuilderState.setExecutionContext(executionContext);
|
|
498
512
|
await queryBuilderState.propagateExecutionContextChange(true);
|
|
499
513
|
|
|
500
514
|
// set runtime if already chosen
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
getDataSpace,
|
|
29
29
|
getExecutionContextFromDataspaceExecutable,
|
|
30
30
|
getQueryFromDataspaceExecutable,
|
|
31
|
+
resolveExecutionContextMapping,
|
|
31
32
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
32
33
|
import {
|
|
33
34
|
type ResolvedDataSpaceEntityWithOrigin,
|
|
@@ -157,7 +158,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
157
158
|
}
|
|
158
159
|
if (!query) {
|
|
159
160
|
throw new IllegalStateError(
|
|
160
|
-
`Can't fetch query from data
|
|
161
|
+
`Can't fetch query from data space executable`,
|
|
161
162
|
);
|
|
162
163
|
}
|
|
163
164
|
if (!executionContext) {
|
|
@@ -165,6 +166,14 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
165
166
|
`Can't find a correpsonding execution context`,
|
|
166
167
|
);
|
|
167
168
|
}
|
|
169
|
+
if (
|
|
170
|
+
executionContext.mappingProvider &&
|
|
171
|
+
!resolveExecutionContextMapping(executionContext)
|
|
172
|
+
) {
|
|
173
|
+
throw new IllegalStateError(
|
|
174
|
+
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
168
177
|
const sourceInfo = {
|
|
169
178
|
groupId: this.groupId,
|
|
170
179
|
artifactId: this.artifactId,
|
|
@@ -188,7 +197,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
188
197
|
undefined,
|
|
189
198
|
async (dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) => {
|
|
190
199
|
this.applicationStore.notificationService.notifyWarning(
|
|
191
|
-
`Can't switch data
|
|
200
|
+
`Can't switch data space to visit current template query`,
|
|
192
201
|
);
|
|
193
202
|
},
|
|
194
203
|
new DataProductSelectorState(
|
|
@@ -197,7 +206,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
197
206
|
),
|
|
198
207
|
() => {
|
|
199
208
|
this.applicationStore.notificationService.notifyWarning(
|
|
200
|
-
`Can't switch data
|
|
209
|
+
`Can't switch data space to visit current template query`,
|
|
201
210
|
);
|
|
202
211
|
},
|
|
203
212
|
dataSpaceAnalysisResult,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
createViewProjectHandler,
|
|
60
60
|
createViewSDLCProjectHandler,
|
|
61
61
|
} from '../DataSpaceQueryBuilderHelper.js';
|
|
62
|
-
import {
|
|
62
|
+
import { type GeneratorFn } from '@finos/legend-shared';
|
|
63
63
|
import { flowResult } from 'mobx';
|
|
64
64
|
import type {
|
|
65
65
|
DepotEntityWithOrigin,
|
|
@@ -220,10 +220,7 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
220
220
|
this.dataSpace.title,
|
|
221
221
|
this.dataSpace.name,
|
|
222
222
|
this.dataSpace.path,
|
|
223
|
-
|
|
224
|
-
this.dataSpace.defaultExecutionContext,
|
|
225
|
-
`Data space '${this.dataSpace.path}' does not have a default execution context`,
|
|
226
|
-
).name,
|
|
223
|
+
this.dataSpace.defaultExecutionContext?.name,
|
|
227
224
|
),
|
|
228
225
|
};
|
|
229
226
|
}
|
|
@@ -296,10 +293,7 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
296
293
|
dataSpace.title,
|
|
297
294
|
dataSpace.name,
|
|
298
295
|
dataSpace.path,
|
|
299
|
-
|
|
300
|
-
dataSpace.defaultExecutionContext,
|
|
301
|
-
`Data space '${dataSpace.path}' does not have a default execution context`,
|
|
302
|
-
).name,
|
|
296
|
+
dataSpace.defaultExecutionContext?.name,
|
|
303
297
|
),
|
|
304
298
|
this.project.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
305
299
|
);
|
package/tsconfig.json
CHANGED
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"./src/stores/QueryProductionizerSetupStore.ts",
|
|
79
79
|
"./src/stores/QuerySetupStore.ts",
|
|
80
80
|
"./src/stores/UpdateExistingServiceQuerySetupStore.ts",
|
|
81
|
+
"./src/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.ts",
|
|
81
82
|
"./src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts",
|
|
82
83
|
"./src/stores/data-cube/ExistingQueryDataCubeViewer.ts",
|
|
83
84
|
"./src/stores/data-product/DataProductSampleQueryCreatorStore.ts",
|