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