@finos/legend-application-query 13.6.8 → 13.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/application/LegendQueryApplicationConfig.d.ts +1 -0
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +2 -0
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +157 -4
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +9 -2
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +2 -2
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +38 -10
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -3
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js +0 -1
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +13 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +135 -30
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +2 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +8 -12
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +1 -0
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +1 -0
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +3 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +41 -24
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/package.json +8 -8
- package/src/application/LegendQueryApplicationConfig.ts +3 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +281 -7
- package/src/components/QueryEditor.tsx +25 -1
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +62 -24
- package/src/stores/LegendQueryApplicationPlugin.tsx +6 -5
- package/src/stores/QueryEditorStore.ts +254 -53
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +17 -28
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +1 -0
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +73 -51
@@ -21,11 +21,12 @@ import {
|
|
21
21
|
QueryProjectCoordinates,
|
22
22
|
extractElementNameFromPath,
|
23
23
|
} from '@finos/legend-graph';
|
24
|
+
import { type DepotServerClient } from '@finos/legend-server-depot';
|
24
25
|
import {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
IllegalStateError,
|
27
|
+
uuid,
|
28
|
+
type GeneratorFn,
|
29
|
+
} from '@finos/legend-shared';
|
29
30
|
import {
|
30
31
|
type QueryBuilderState,
|
31
32
|
QueryBuilderDataBrowserWorkflow,
|
@@ -35,18 +36,16 @@ import {
|
|
35
36
|
parseGACoordinates,
|
36
37
|
} from '@finos/legend-storage';
|
37
38
|
import {
|
39
|
+
type QueryPersistConfiguration,
|
38
40
|
QueryBuilderActionConfig_QueryApplication,
|
39
41
|
QueryEditorStore,
|
40
|
-
type QueryPersistConfiguration,
|
41
42
|
} from '../QueryEditorStore.js';
|
42
43
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
43
44
|
import {
|
44
|
-
|
45
|
+
DataSpacePackageableElementExecutable,
|
45
46
|
getDataSpace,
|
46
|
-
retrieveAnalyticsResultCache,
|
47
47
|
getExecutionContextFromDataspaceExecutable,
|
48
48
|
getQueryFromDataspaceExecutable,
|
49
|
-
DataSpacePackageableElementExecutable,
|
50
49
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
51
50
|
import {
|
52
51
|
type DataSpaceInfo,
|
@@ -90,62 +89,84 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
90
89
|
};
|
91
90
|
}
|
92
91
|
|
92
|
+
override *buildGraph(): GeneratorFn<void> {
|
93
|
+
// do nothing
|
94
|
+
}
|
95
|
+
|
93
96
|
async initializeQueryBuilderState(): Promise<QueryBuilderState> {
|
97
|
+
const { dataSpaceAnalysisResult, isLightGraphEnabled } =
|
98
|
+
await this.buildGraphAndDataspaceAnalyticsResult(
|
99
|
+
this.groupId,
|
100
|
+
this.artifactId,
|
101
|
+
this.versionId,
|
102
|
+
undefined,
|
103
|
+
this.dataSpacePath,
|
104
|
+
this.templateQueryId,
|
105
|
+
);
|
94
106
|
const dataSpace = getDataSpace(
|
95
107
|
this.dataSpacePath,
|
96
108
|
this.graphManagerState.graph,
|
97
109
|
);
|
98
|
-
let
|
99
|
-
|
100
|
-
)
|
101
|
-
|
102
|
-
|
103
|
-
(executable) =>
|
104
|
-
executable instanceof DataSpacePackageableElementExecutable &&
|
105
|
-
executable.executable.value.path === this.templateQueryId,
|
110
|
+
let query;
|
111
|
+
let executionContext;
|
112
|
+
if (dataSpace.executables && dataSpace.executables.length > 0) {
|
113
|
+
let template = dataSpace.executables.find(
|
114
|
+
(ex) => ex.id === this.templateQueryId,
|
106
115
|
);
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
116
|
+
if (!template) {
|
117
|
+
template = dataSpace.executables.find(
|
118
|
+
(executable) =>
|
119
|
+
executable instanceof DataSpacePackageableElementExecutable &&
|
120
|
+
executable.executable.value.path === this.templateQueryId,
|
121
|
+
);
|
122
|
+
}
|
123
|
+
if (!template) {
|
124
|
+
throw new IllegalStateError(
|
125
|
+
`Can't find template query with id '${this.templateQueryId}'`,
|
126
|
+
);
|
127
|
+
}
|
128
|
+
executionContext = getExecutionContextFromDataspaceExecutable(
|
129
|
+
dataSpace,
|
130
|
+
template,
|
111
131
|
);
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
template
|
116
|
-
|
117
|
-
if (!executionContext) {
|
118
|
-
throw new IllegalStateError(
|
119
|
-
`Can't find a correpsonding execution context`,
|
132
|
+
query = getQueryFromDataspaceExecutable(template, this.graphManagerState);
|
133
|
+
this.templateQueryTitle = template.title;
|
134
|
+
} else {
|
135
|
+
let template = dataSpaceAnalysisResult?.executables.find(
|
136
|
+
(executable) => executable.info?.id === this.templateQueryId,
|
120
137
|
);
|
138
|
+
if (!template) {
|
139
|
+
template = dataSpaceAnalysisResult?.executables.find(
|
140
|
+
(executable) => executable.executable === this.templateQueryId,
|
141
|
+
);
|
142
|
+
}
|
143
|
+
if (!template) {
|
144
|
+
throw new IllegalStateError(
|
145
|
+
`Can't find template query with id '${this.templateQueryId}'`,
|
146
|
+
);
|
147
|
+
}
|
148
|
+
executionContext =
|
149
|
+
template.info?.executionContextKey === undefined
|
150
|
+
? dataSpace.defaultExecutionContext
|
151
|
+
: dataSpace.executionContexts.find(
|
152
|
+
(ex) => ex.name === template.info?.executionContextKey,
|
153
|
+
);
|
154
|
+
if (template.info) {
|
155
|
+
query = await this.graphManagerState.graphManager.pureCodeToLambda(
|
156
|
+
template.info.query,
|
157
|
+
);
|
158
|
+
}
|
159
|
+
this.templateQueryTitle = template.title;
|
121
160
|
}
|
122
|
-
const query = getQueryFromDataspaceExecutable(
|
123
|
-
template,
|
124
|
-
this.graphManagerState,
|
125
|
-
);
|
126
161
|
if (!query) {
|
127
162
|
throw new IllegalStateError(
|
128
163
|
`Can't fetch query from dataspace executable`,
|
129
164
|
);
|
130
165
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
const project = StoreProjectData.serialization.fromJson(
|
135
|
-
await this.depotServerClient.getProject(this.groupId, this.artifactId),
|
136
|
-
);
|
137
|
-
dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
|
138
|
-
this.graphManagerState.graphManager,
|
139
|
-
).retrieveDataSpaceAnalysisFromCache(() =>
|
140
|
-
retrieveAnalyticsResultCache(
|
141
|
-
project,
|
142
|
-
this.versionId,
|
143
|
-
dataSpace.path,
|
144
|
-
this.depotServerClient,
|
145
|
-
),
|
166
|
+
if (!executionContext) {
|
167
|
+
throw new IllegalStateError(
|
168
|
+
`Can't find a correpsonding execution context`,
|
146
169
|
);
|
147
|
-
} catch {
|
148
|
-
// do nothing
|
149
170
|
}
|
150
171
|
const sourceInfo = {
|
151
172
|
groupId: this.groupId,
|
@@ -160,6 +181,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
160
181
|
new QueryBuilderActionConfig_QueryApplication(this),
|
161
182
|
dataSpace,
|
162
183
|
executionContext,
|
184
|
+
isLightGraphEnabled,
|
163
185
|
createDataSpaceDepoRepo(
|
164
186
|
this,
|
165
187
|
this.groupId,
|
@@ -167,7 +189,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
167
189
|
this.versionId,
|
168
190
|
undefined,
|
169
191
|
),
|
170
|
-
(dataSpaceInfo: DataSpaceInfo) => {
|
192
|
+
async (dataSpaceInfo: DataSpaceInfo) => {
|
171
193
|
this.applicationStore.notificationService.notifyWarning(
|
172
194
|
`Can't switch data space to visit current template query`,
|
173
195
|
);
|
@@ -180,7 +202,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
180
202
|
sourceInfo,
|
181
203
|
);
|
182
204
|
queryBuilderState.setExecutionContext(executionContext);
|
183
|
-
queryBuilderState.propagateExecutionContextChange(
|
205
|
+
await queryBuilderState.propagateExecutionContextChange(true);
|
184
206
|
queryBuilderState.initializeWithQuery(query);
|
185
207
|
return queryBuilderState;
|
186
208
|
}
|