@finos/legend-extension-dsl-data-space-studio 0.1.0

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.
Files changed (53) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.d.ts +17 -0
  4. package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.d.ts.map +1 -0
  5. package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.js +54 -0
  6. package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.js.map +1 -0
  7. package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts +21 -0
  8. package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts.map +1 -0
  9. package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js +22 -0
  10. package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js.map +1 -0
  11. package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +39 -0
  12. package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -0
  13. package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js +206 -0
  14. package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -0
  15. package/lib/components/DataSpacePreviewAction.d.ts +25 -0
  16. package/lib/components/DataSpacePreviewAction.d.ts.map +1 -0
  17. package/lib/components/DataSpacePreviewAction.js +53 -0
  18. package/lib/components/DataSpacePreviewAction.js.map +1 -0
  19. package/lib/components/DataSpaceQueryAction.d.ts +24 -0
  20. package/lib/components/DataSpaceQueryAction.d.ts.map +1 -0
  21. package/lib/components/DataSpaceQueryAction.js +52 -0
  22. package/lib/components/DataSpaceQueryAction.js.map +1 -0
  23. package/lib/components/DataSpaceTemplateQueryPromoteReview.d.ts +19 -0
  24. package/lib/components/DataSpaceTemplateQueryPromoteReview.d.ts.map +1 -0
  25. package/lib/components/DataSpaceTemplateQueryPromoteReview.js +81 -0
  26. package/lib/components/DataSpaceTemplateQueryPromoteReview.js.map +1 -0
  27. package/lib/index.css +17 -0
  28. package/lib/index.css.map +1 -0
  29. package/lib/index.d.ts +17 -0
  30. package/lib/index.d.ts.map +1 -0
  31. package/lib/index.js +17 -0
  32. package/lib/index.js.map +1 -0
  33. package/lib/package.json +75 -0
  34. package/lib/stores/DataSpacePreviewState.d.ts +33 -0
  35. package/lib/stores/DataSpacePreviewState.d.ts.map +1 -0
  36. package/lib/stores/DataSpacePreviewState.js +116 -0
  37. package/lib/stores/DataSpacePreviewState.js.map +1 -0
  38. package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +61 -0
  39. package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +1 -0
  40. package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.js +406 -0
  41. package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.js.map +1 -0
  42. package/package.json +75 -0
  43. package/src/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.ts +54 -0
  44. package/src/__lib__/DSL_DataSpace_LegendStudioDocumentation.ts +21 -0
  45. package/src/components/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +299 -0
  46. package/src/components/DataSpacePreviewAction.tsx +136 -0
  47. package/src/components/DataSpaceQueryAction.tsx +100 -0
  48. package/src/components/DataSpaceTemplateQueryPromoteReview.tsx +292 -0
  49. package/src/index.ts +17 -0
  50. package/src/stores/DataSpacePreviewState.ts +199 -0
  51. package/src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts +636 -0
  52. package/tsconfig.json +54 -0
  53. package/tsconfig.package.json +37 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ import { type LightQuery, type QueryInfo, GraphManagerState } from '@finos/legend-graph';
17
+ import { type DepotServerClient, StoreProjectData } from '@finos/legend-server-depot';
18
+ import { ActionState, type GeneratorFn } from '@finos/legend-shared';
19
+ import { type Entity } from '@finos/legend-storage';
20
+ import { type ProjectConfigurationStatus, type LegendStudioApplicationStore, EditorStore } from '@finos/legend-application-studio';
21
+ import { type SDLCServerClient, Project, Workspace, ProjectConfiguration } from '@finos/legend-server-sdlc';
22
+ import { type DSL_DataSpace_PureGraphManagerExtension } from '@finos/legend-extension-dsl-data-space/graph';
23
+ export declare class DataSpaceTemplateQueryPromotionReviewerStore {
24
+ readonly applicationStore: LegendStudioApplicationStore;
25
+ readonly sdlcServerClient: SDLCServerClient;
26
+ readonly depotServerClient: DepotServerClient;
27
+ readonly graphManagerState: GraphManagerState;
28
+ readonly initState: ActionState;
29
+ readonly promoteState: ActionState;
30
+ readonly loadQueryState: ActionState;
31
+ readonly loadWorkspacesState: ActionState;
32
+ editorStore: EditorStore;
33
+ graphManagerExtension: DSL_DataSpace_PureGraphManagerExtension;
34
+ currentQuery?: LightQuery | undefined;
35
+ currentQueryInfo?: QueryInfo | undefined;
36
+ currentQueryProject?: StoreProjectData | undefined;
37
+ currentProject?: Project | undefined;
38
+ currentProjectConfiguration?: ProjectConfiguration;
39
+ currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
40
+ currentProjectEntities: Entity[];
41
+ dependencyEntities: Entity[];
42
+ groupWorkspaces: Workspace[];
43
+ workspaceName: string;
44
+ dataSpacePath: string;
45
+ dataSpaceEntity: Entity | undefined;
46
+ templateQueryId: string;
47
+ templateQueryTitle: string;
48
+ templateQueryDescription: string;
49
+ constructor(applicationStore: LegendStudioApplicationStore, sdlcServerClient: SDLCServerClient, depotServerClient: DepotServerClient);
50
+ setWorkspaceName(val: string): void;
51
+ setTemplateQueryId(val: string): void;
52
+ setTemplateQueryTitle(val: string): void;
53
+ setTemplateQueryDescription(val: string): void;
54
+ get isWorkspaceNameValid(): boolean;
55
+ get isTemplateQueryIdValid(): boolean;
56
+ initialize(queryId: string | undefined, dataSpacePath: string): GeneratorFn<void>;
57
+ loadQuery(query: LightQuery): GeneratorFn<void>;
58
+ loadProject(project: Project): GeneratorFn<void>;
59
+ promoteAsTemplateQuery(): GeneratorFn<void>;
60
+ }
61
+ //# sourceMappingURL=DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSpaceTemplateQueryPromotionReviewerStore.d.ts","sourceRoot":"","sources":["../../src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,iBAAiB,EACtB,gBAAgB,EAGjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,WAAW,EAIX,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,0BAA0B,EAI/B,KAAK,4BAA4B,EACjC,WAAW,EAEZ,MAAM,kCAAkC,CAAC;AAc1C,OAAO,EACL,KAAK,gBAAgB,EAErB,OAAO,EAEP,SAAS,EACT,oBAAoB,EAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,uCAAuC,EAC7C,MAAM,8CAA8C,CAAC;AAiBtD,qBAAa,4CAA4C;IACvD,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAC;IACxD,QAAQ,CAAC,gBAA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I,sBAAsB,IAAI,OAAO,CAQpC;IAEA,UAAU,CACT,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,aAAa,EAAE,MAAM,GACpB,WAAW,CAAC,IAAI,CAAC;IAsGnB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC;IAwC/C,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IA+BhD,sBAAsB,IAAI,WAAW,CAAC,IAAI,CAAC;CAqQ7C"}
@@ -0,0 +1,406 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ import { GraphManagerState, } from '@finos/legend-graph';
17
+ import { StoreProjectData, ProjectDependencyCoordinates, ProjectVersionEntities, } from '@finos/legend-server-depot';
18
+ import { ActionState, assertErrorThrown, guaranteeNonNullable, LogEvent, } from '@finos/legend-shared';
19
+ import {} from '@finos/legend-storage';
20
+ import { fetchProjectConfigurationStatus, generateEditorRoute, LEGEND_STUDIO_APP_EVENT, EditorStore, generateReviewRoute, } from '@finos/legend-application-studio';
21
+ import { DEFAULT_TAB_SIZE, ActionAlertType, ActionAlertActionType, } from '@finos/legend-application';
22
+ import { makeObservable, observable, computed, action, flow, flowResult, } from 'mobx';
23
+ import { Project, WorkspaceType, Workspace, ProjectConfiguration, EntityChangeType, } from '@finos/legend-server-sdlc';
24
+ import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH, DSL_DataSpace_getGraphManagerExtension, } from '@finos/legend-extension-dsl-data-space/graph';
25
+ import { generateDataSpaceQuerySetupRoute, generateDataSpaceTemplateQueryPromotionRoute, } from '@finos/legend-extension-dsl-data-space/application';
26
+ const projectDependencyToProjectCoordinates = (projectDependency) => new ProjectDependencyCoordinates(guaranteeNonNullable(projectDependency.groupId), guaranteeNonNullable(projectDependency.artifactId), projectDependency.versionId);
27
+ const DEFAULT_WORKSPACE_NAME_PREFIX = 'promote-as-template-query';
28
+ export class DataSpaceTemplateQueryPromotionReviewerStore {
29
+ applicationStore;
30
+ sdlcServerClient;
31
+ depotServerClient;
32
+ graphManagerState;
33
+ initState = ActionState.create();
34
+ promoteState = ActionState.create();
35
+ loadQueryState = ActionState.create();
36
+ loadWorkspacesState = ActionState.create();
37
+ editorStore;
38
+ graphManagerExtension;
39
+ currentQuery;
40
+ currentQueryInfo;
41
+ currentQueryProject;
42
+ currentProject;
43
+ currentProjectConfiguration;
44
+ currentProjectConfigurationStatus;
45
+ currentProjectEntities = [];
46
+ dependencyEntities = [];
47
+ groupWorkspaces = [];
48
+ workspaceName = '';
49
+ dataSpacePath;
50
+ dataSpaceEntity;
51
+ templateQueryId = 'template_id';
52
+ templateQueryTitle = 'template_title';
53
+ templateQueryDescription = '';
54
+ constructor(applicationStore, sdlcServerClient, depotServerClient) {
55
+ makeObservable(this, {
56
+ editorStore: observable,
57
+ graphManagerExtension: observable,
58
+ currentQuery: observable,
59
+ currentQueryInfo: observable,
60
+ currentQueryProject: observable,
61
+ currentProject: observable,
62
+ currentProjectConfiguration: observable,
63
+ currentProjectConfigurationStatus: observable,
64
+ currentProjectEntities: observable,
65
+ dataSpaceEntity: observable,
66
+ groupWorkspaces: observable,
67
+ workspaceName: observable,
68
+ templateQueryId: observable,
69
+ templateQueryTitle: observable,
70
+ templateQueryDescription: observable,
71
+ isWorkspaceNameValid: computed,
72
+ isTemplateQueryIdValid: computed,
73
+ setWorkspaceName: action,
74
+ setTemplateQueryId: action,
75
+ setTemplateQueryTitle: action,
76
+ setTemplateQueryDescription: action,
77
+ initialize: flow,
78
+ loadQuery: flow,
79
+ loadProject: flow,
80
+ promoteAsTemplateQuery: flow,
81
+ });
82
+ this.applicationStore = applicationStore;
83
+ this.sdlcServerClient = sdlcServerClient;
84
+ this.depotServerClient = depotServerClient;
85
+ this.graphManagerState = new GraphManagerState(applicationStore.pluginManager, applicationStore.logService);
86
+ this.editorStore = new EditorStore(applicationStore, sdlcServerClient, depotServerClient);
87
+ this.graphManagerExtension = DSL_DataSpace_getGraphManagerExtension(this.editorStore.graphManagerState.graphManager);
88
+ }
89
+ setWorkspaceName(val) {
90
+ this.workspaceName = val;
91
+ }
92
+ setTemplateQueryId(val) {
93
+ this.templateQueryId = val;
94
+ }
95
+ setTemplateQueryTitle(val) {
96
+ this.templateQueryTitle = val;
97
+ }
98
+ setTemplateQueryDescription(val) {
99
+ this.templateQueryDescription = val;
100
+ }
101
+ get isWorkspaceNameValid() {
102
+ return !this.groupWorkspaces.some((ws) => ws.workspaceId === this.workspaceName);
103
+ }
104
+ get isTemplateQueryIdValid() {
105
+ if (this.dataSpaceEntity) {
106
+ return this.graphManagerExtension.IsTemplateQueryIdValid(this.dataSpaceEntity, this.templateQueryId);
107
+ }
108
+ return false;
109
+ }
110
+ *initialize(queryId, dataSpacePath) {
111
+ if (!this.initState.isInInitialState) {
112
+ return;
113
+ }
114
+ try {
115
+ this.initState.inProgress();
116
+ yield this.graphManagerState.graphManager.initialize({
117
+ env: this.applicationStore.config.env,
118
+ tabSize: DEFAULT_TAB_SIZE,
119
+ clientConfig: {
120
+ baseUrl: this.applicationStore.config.engineServerUrl,
121
+ queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
122
+ enableCompression: true,
123
+ },
124
+ }, {
125
+ tracerService: this.applicationStore.tracerService,
126
+ });
127
+ this.dataSpacePath = dataSpacePath;
128
+ if (queryId) {
129
+ let query;
130
+ try {
131
+ query = (yield this.graphManagerState.graphManager.getLightQuery(queryId));
132
+ }
133
+ catch {
134
+ query = undefined;
135
+ }
136
+ if (query) {
137
+ yield flowResult(this.loadQuery(query));
138
+ }
139
+ else {
140
+ this.applicationStore.navigationService.navigator.updateCurrentLocation(generateDataSpaceQuerySetupRoute());
141
+ }
142
+ }
143
+ if (this.currentQuery) {
144
+ this.currentQueryProject = StoreProjectData.serialization.fromJson((yield this.depotServerClient.getProject(this.currentQuery.groupId, this.currentQuery.artifactId)));
145
+ const projectData = (yield Promise.all([
146
+ this.depotServerClient.getVersionEntities(this.currentQuery.groupId, this.currentQuery.artifactId, this.currentQuery.versionId),
147
+ this.sdlcServerClient.getConfiguration(this.currentQueryProject.projectId, undefined),
148
+ ]));
149
+ const [currentProjectEntities, currentProjectConfiguration] = [
150
+ projectData[0],
151
+ ProjectConfiguration.serialization.fromJson(projectData[1]),
152
+ ];
153
+ this.currentProjectConfiguration = currentProjectConfiguration;
154
+ const dependencyEntities = (yield this.depotServerClient.collectDependencyEntities([
155
+ ...currentProjectConfiguration.projectDependencies,
156
+ ]
157
+ .map(projectDependencyToProjectCoordinates)
158
+ .map((p) => ProjectDependencyCoordinates.serialization.toJson(p)), true, true))
159
+ .map((p) => ProjectVersionEntities.serialization.fromJson(p))
160
+ .flatMap((info) => info.entities);
161
+ this.dependencyEntities = dependencyEntities;
162
+ this.currentProjectEntities = currentProjectEntities;
163
+ this.dataSpaceEntity = guaranteeNonNullable(currentProjectEntities.filter((entity) => entity.path === dataSpacePath &&
164
+ entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH)[0], `Can't find dataSpace entity with path ${this.dataSpaceEntity}`);
165
+ this.initState.pass();
166
+ }
167
+ }
168
+ catch (error) {
169
+ assertErrorThrown(error);
170
+ this.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.GENERIC_FAILURE), error);
171
+ this.applicationStore.alertService.setBlockingAlert({
172
+ message: `Can't initialize template query promotion reviewer store`,
173
+ });
174
+ this.initState.fail();
175
+ }
176
+ }
177
+ *loadQuery(query) {
178
+ this.currentQuery = query;
179
+ this.templateQueryTitle = query.name;
180
+ try {
181
+ this.loadQueryState.inProgress();
182
+ this.currentQueryInfo =
183
+ (yield this.graphManagerState.graphManager.getQueryInfo(query.id));
184
+ this.currentQueryProject = StoreProjectData.serialization.fromJson((yield this.depotServerClient.getProject(this.currentQuery.groupId, this.currentQuery.artifactId)));
185
+ this.setWorkspaceName(`${DEFAULT_WORKSPACE_NAME_PREFIX}-${query.name}`);
186
+ this.applicationStore.navigationService.navigator.updateCurrentLocation(generateDataSpaceTemplateQueryPromotionRoute(this.currentQuery.groupId, this.currentQuery.artifactId, this.currentQuery.versionId, this.dataSpacePath, query.id));
187
+ const currentProject = Project.serialization.fromJson((yield this.sdlcServerClient.getProject(this.currentQueryProject.projectId)));
188
+ yield flowResult(this.loadProject(currentProject));
189
+ }
190
+ catch (error) {
191
+ assertErrorThrown(error);
192
+ this.applicationStore.notificationService.notifyError(error);
193
+ }
194
+ finally {
195
+ this.loadQueryState.complete();
196
+ }
197
+ }
198
+ *loadProject(project) {
199
+ this.currentProject = project;
200
+ this.currentProjectConfigurationStatus = undefined;
201
+ this.loadWorkspacesState.inProgress();
202
+ try {
203
+ this.currentProjectConfigurationStatus =
204
+ (yield fetchProjectConfigurationStatus(project.projectId, undefined, this.applicationStore, this.sdlcServerClient));
205
+ this.groupWorkspaces = (yield this.sdlcServerClient.getGroupWorkspaces(project.projectId))
206
+ .map((v) => Workspace.serialization.fromJson(v))
207
+ .filter((workspace) => workspace.workspaceType === WorkspaceType.GROUP);
208
+ this.loadWorkspacesState.pass();
209
+ }
210
+ catch (error) {
211
+ assertErrorThrown(error);
212
+ this.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE), error);
213
+ this.applicationStore.notificationService.notifyError(error);
214
+ this.loadWorkspacesState.fail();
215
+ }
216
+ }
217
+ *promoteAsTemplateQuery() {
218
+ const query = this.currentQuery;
219
+ const project = this.currentProject;
220
+ if (this.promoteState.isInProgress ||
221
+ !query ||
222
+ !this.currentQueryInfo ||
223
+ !this.currentProjectConfiguration ||
224
+ !project ||
225
+ !this.workspaceName ||
226
+ !this.templateQueryTitle ||
227
+ !this.dataSpaceEntity ||
228
+ !this.isWorkspaceNameValid ||
229
+ !this.isTemplateQueryIdValid) {
230
+ return;
231
+ }
232
+ try {
233
+ this.promoteState.inProgress();
234
+ // 1. prepare project entities
235
+ this.applicationStore.alertService.setBlockingAlert({
236
+ message: `Fetching and updating project...`,
237
+ prompt: 'Please do not close the application',
238
+ showLoading: true,
239
+ });
240
+ // update datasapce entity
241
+ const updatedDataSpaceEntity = (yield this.graphManagerExtension.addNewExecutableToDataSpaceEntity(this.dataSpaceEntity, {
242
+ id: this.templateQueryId,
243
+ title: this.templateQueryTitle,
244
+ mapping: guaranteeNonNullable(this.currentQueryInfo).mapping,
245
+ runtime: guaranteeNonNullable(this.currentQueryInfo).runtime,
246
+ query: (yield this.graphManagerState.graphManager.pureCodeToLambda(this.currentQueryInfo.content)),
247
+ description: this.templateQueryDescription,
248
+ }));
249
+ guaranteeNonNullable(this.currentProjectEntities.filter((entity) => entity.path === this.dataSpacePath &&
250
+ entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH)[0]).content = updatedDataSpaceEntity.content;
251
+ // 2. check if the graph compiles properly
252
+ this.applicationStore.alertService.setBlockingAlert({
253
+ message: `Checking workspace compilation status...`,
254
+ prompt: 'Please do not close the application',
255
+ showLoading: true,
256
+ });
257
+ let compilationFailed = false;
258
+ try {
259
+ yield this.graphManagerState.graphManager.compileEntities([
260
+ ...this.dependencyEntities,
261
+ ...this.currentProjectEntities,
262
+ ]);
263
+ }
264
+ catch {
265
+ compilationFailed = true;
266
+ }
267
+ // 3. proceed to setup the workspace
268
+ const setupWorkspace = async () => {
269
+ let workspace;
270
+ try {
271
+ this.applicationStore.alertService.setBlockingAlert({
272
+ message: `Creating workspace...`,
273
+ prompt: 'Please do not close the application',
274
+ showLoading: true,
275
+ });
276
+ // i. create workspace
277
+ workspace = Workspace.serialization.fromJson(await this.sdlcServerClient.createWorkspace(project.projectId, undefined, this.workspaceName, WorkspaceType.GROUP));
278
+ // ii. update dataspace
279
+ this.applicationStore.alertService.setBlockingAlert({
280
+ message: `Generating code commit...`,
281
+ prompt: 'Please do not close the application',
282
+ showLoading: true,
283
+ });
284
+ await this.sdlcServerClient.performEntityChanges(project.projectId, workspace, {
285
+ message: 'promote-as-template-query: promote query as a template query to dataspace',
286
+ entityChanges: [
287
+ {
288
+ classifierPath: updatedDataSpaceEntity.classifierPath,
289
+ entityPath: updatedDataSpaceEntity.path,
290
+ content: updatedDataSpaceEntity.content,
291
+ type: EntityChangeType.MODIFY,
292
+ },
293
+ ],
294
+ });
295
+ // iii create review
296
+ this.applicationStore.alertService.setBlockingAlert({
297
+ message: `Generating code review...`,
298
+ prompt: 'Please do not close the application',
299
+ showLoading: true,
300
+ });
301
+ await flowResult(this.editorStore.initialize(project.projectId, undefined, workspace.workspaceId, workspace.workspaceType));
302
+ const workspaceReviewState = this.editorStore.workspaceReviewState;
303
+ const workspaceContainsSnapshotDependencies = this.editorStore.projectConfigurationEditorState
304
+ .containsSnapshotDependencies;
305
+ const isCreateReviewDisabled = Boolean(workspaceReviewState.workspaceReview) ||
306
+ workspaceContainsSnapshotDependencies ||
307
+ !workspaceReviewState.canCreateReview ||
308
+ workspaceReviewState.sdlcState.isActiveProjectSandbox;
309
+ workspaceReviewState.reviewTitle =
310
+ 'code review - promote query as a template query to dataspace';
311
+ if (!isCreateReviewDisabled) {
312
+ await flowResult(workspaceReviewState.createWorkspaceReview(workspaceReviewState.reviewTitle));
313
+ }
314
+ else {
315
+ this.applicationStore.notificationService.notifyError(`Can't create code review`);
316
+ }
317
+ // iv. complete, redirect user to the service query editor screen
318
+ this.applicationStore.alertService.setBlockingAlert(undefined);
319
+ this.promoteState.pass();
320
+ this.applicationStore.alertService.setActionAlertInfo({
321
+ message: `Successfully promoted query into dataspace '${this.dataSpacePath}'. Now your template query can be found in workspace '${this.workspaceName}' of project '${project.name}' (${project.projectId})`,
322
+ prompt: compilationFailed
323
+ ? `The workspace might not compile at the moment, please make sure to fix the issue and submit a review to make the dataspace part of the project to complete template query promotion`
324
+ : `Please make sure to get the generated code-review reviewed and approved`,
325
+ type: ActionAlertType.STANDARD,
326
+ actions: compilationFailed
327
+ ? [
328
+ {
329
+ label: 'Open Workspace',
330
+ type: ActionAlertActionType.PROCEED,
331
+ handler: () => {
332
+ this.applicationStore.navigationService.navigator.goToLocation(generateEditorRoute(project.projectId, undefined, this.workspaceName, WorkspaceType.GROUP));
333
+ },
334
+ default: true,
335
+ },
336
+ ]
337
+ : [
338
+ {
339
+ label: 'Open Code Review',
340
+ type: ActionAlertActionType.PROCEED,
341
+ handler: () => {
342
+ if (workspaceReviewState.workspaceReview) {
343
+ this.applicationStore.navigationService.navigator.visitAddress(this.applicationStore.navigationService.navigator.generateAddress(generateReviewRoute(workspaceReviewState.workspaceReview.projectId, workspaceReviewState.workspaceReview.id)));
344
+ }
345
+ },
346
+ default: true,
347
+ },
348
+ {
349
+ label: 'Open Workspace',
350
+ type: ActionAlertActionType.PROCEED,
351
+ handler: () => {
352
+ this.applicationStore.navigationService.navigator.goToLocation(generateEditorRoute(project.projectId, undefined, this.workspaceName, WorkspaceType.GROUP));
353
+ },
354
+ },
355
+ ],
356
+ });
357
+ }
358
+ catch (error) {
359
+ assertErrorThrown(error);
360
+ this.applicationStore.alertService.setBlockingAlert(undefined);
361
+ this.applicationStore.notificationService.notifyError(`Can't set up workspace: ${error.message}`);
362
+ if (workspace) {
363
+ await this.sdlcServerClient.deleteWorkspace(project.projectId, workspace);
364
+ }
365
+ this.promoteState.fail();
366
+ }
367
+ };
368
+ this.applicationStore.alertService.setBlockingAlert(undefined);
369
+ if (compilationFailed) {
370
+ this.applicationStore.alertService.setActionAlertInfo({
371
+ message: `We have found compilation issues with the workspace. Your query can still be promoted, but you would need to fix compilation issues afterwards`,
372
+ prompt: `Do you still want to proceed to promote the query as a template query?`,
373
+ type: ActionAlertType.STANDARD,
374
+ actions: [
375
+ {
376
+ label: `Proceed`,
377
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
378
+ handler: () => {
379
+ setupWorkspace().catch(this.applicationStore.alertUnhandledError);
380
+ },
381
+ },
382
+ {
383
+ label: 'Abort',
384
+ type: ActionAlertActionType.PROCEED,
385
+ handler: () => {
386
+ this.promoteState.fail();
387
+ },
388
+ default: true,
389
+ },
390
+ ],
391
+ });
392
+ }
393
+ else {
394
+ yield setupWorkspace();
395
+ }
396
+ this.promoteState.pass();
397
+ }
398
+ catch (error) {
399
+ assertErrorThrown(error);
400
+ this.applicationStore.alertService.setBlockingAlert(undefined);
401
+ this.applicationStore.notificationService.notifyError(error);
402
+ this.promoteState.fail();
403
+ }
404
+ }
405
+ }
406
+ //# sourceMappingURL=DataSpaceTemplateQueryPromotionReviewerStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSpaceTemplateQueryPromotionReviewerStore.js","sourceRoot":"","sources":["../../src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAIL,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,GAGT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAEL,+BAA+B,EAC/B,mBAAmB,EACnB,uBAAuB,EAEvB,WAAW,EACX,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,MAAM,EACN,IAAI,EAC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;oBACzJ,MAAM,EAAE,wEAAwE;oBAChF,IAAI,EAAE,eAAe,CAAC,QAAQ;oBAC9B,OAAO,EAAE;wBACP;4BACE,KAAK,EAAE,SAAS;4BAChB,IAAI,EAAE,qBAAqB,CAAC,oBAAoB;4BAChD,OAAO,EAAE,GAAS,EAAE;gCAClB,cAAc,EAAE,CAAC,KAAK,CACpB,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAC1C,CAAC;4BACJ,CAAC;yBACF;wBACD;4BACE,KAAK,EAAE,OAAO;4BACd,IAAI,EAAE,qBAAqB,CAAC,OAAO;4BACnC,OAAO,EAAE,GAAS,EAAE;gCAClB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;4BAC3B,CAAC;4BACD,OAAO,EAAE,IAAI;yBACd;qBACF;iBACF,CAAC,CAAC;aACJ;iBAAM;gBACL,MAAM,cAAc,EAAE,CAAC;aACxB;YAED,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;SAC1B;QAAC,OAAO,KAAK,EAAE;YACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAC/D,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC7D,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;SAC1B;IACH,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@finos/legend-extension-dsl-data-space-studio",
3
+ "version": "0.1.0",
4
+ "description": "Legend extension for Data Space DSL - Studio",
5
+ "keywords": [
6
+ "legend",
7
+ "legend-extension",
8
+ "dsl",
9
+ "dsl-data-space",
10
+ "studio"
11
+ ],
12
+ "homepage": "https://github.com/finos/legend-studio/tree/master/packages/legend-extension-dsl-data-space-studio",
13
+ "bugs": {
14
+ "url": "https://github.com/finos/legend-studio/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/finos/legend-studio.git",
19
+ "directory": "packages/legend-extension-dsl-data-space-studio"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "sideEffects": false,
23
+ "type": "module",
24
+ "exports": {
25
+ ".": "./lib/index.js",
26
+ "./lib/index.css": "./lib/index.css"
27
+ },
28
+ "scripts": {
29
+ "build": "yarn clean && yarn build:sass && yarn build:ts",
30
+ "build:sass": "cross-env INIT_CWD=$INIT_CWD node ../../scripts/workflow/buildSass.js",
31
+ "build:ts": "tsc --project ./tsconfig.build.json",
32
+ "clean": "npm-run-all clean:cache clean:lib",
33
+ "clean:cache": "rimraf \"build\"",
34
+ "clean:lib": "rimraf \"lib\"",
35
+ "dev": "npm-run-all --parallel dev:sass dev:ts",
36
+ "dev:sass": "sass style:lib --watch --load-path=../../node_modules/@finos/legend-art/scss",
37
+ "dev:ts": "tsc --watch --preserveWatchOutput",
38
+ "lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location ./build/.eslintcache --report-unused-disable-directives --parser-options=project:\"./tsconfig.json\" \"./src/**/*.{js,ts,tsx}\"",
39
+ "publish:prepare": "node ../../scripts/release/preparePublishContent.js",
40
+ "publish:snapshot": "node ../../scripts/release/publishDevSnapshot.js",
41
+ "test": "jest",
42
+ "test:watch": "jest --watch"
43
+ },
44
+ "dependencies": {
45
+ "@finos/legend-application": "15.0.74",
46
+ "@finos/legend-application-studio": "28.16.12",
47
+ "@finos/legend-art": "7.1.26",
48
+ "@finos/legend-extension-dsl-data-space": "10.3.0",
49
+ "@finos/legend-server-depot": "6.0.39",
50
+ "@finos/legend-server-sdlc": "5.3.10",
51
+ "@finos/legend-shared": "10.0.34",
52
+ "mobx": "6.10.2",
53
+ "mobx-react-lite": "4.0.5"
54
+ },
55
+ "devDependencies": {
56
+ "@finos/legend-dev-utils": "2.1.3",
57
+ "@jest/globals": "29.7.0",
58
+ "cross-env": "7.0.3",
59
+ "eslint": "8.52.0",
60
+ "jest": "29.7.0",
61
+ "npm-run-all": "4.1.5",
62
+ "rimraf": "5.0.5",
63
+ "sass": "1.69.4",
64
+ "typescript": "5.2.2"
65
+ },
66
+ "peerDependencies": {
67
+ "react": "^18.0.0"
68
+ },
69
+ "publishConfig": {
70
+ "directory": "build/publishContent"
71
+ },
72
+ "extensions": {
73
+ "applicationStudioPlugin": "@finos/legend-application-studio-plugin-dsl-data-space"
74
+ }
75
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ export const SIMPLE_DATA_SPACE_SNIPPET = `DataSpace \${1:model::NewDataSpace}
18
+ {
19
+ executionContexts:
20
+ [
21
+ {
22
+ name: '\${5:Some Context}';
23
+ title: 'New Execution Context';
24
+ description: 'some information about the execution context';
25
+ mapping: \${6:model::SomeMapping};
26
+ defaultRuntime: \${7:model::SomeRuntime};
27
+ }
28
+ ];
29
+ defaultExecutionContext: '\${5:Some Context}';
30
+ // description: 'description of the data models';
31
+ // diagrams:
32
+ // [
33
+ // {
34
+ // title: 'Some Diagram';
35
+ // description: 'some diagram';
36
+ // diagram: model::SomeDiagram;
37
+ // }
38
+ // ];
39
+ // elements:
40
+ // [
41
+ // model::SomeClass,
42
+ // ];
43
+ // executables:
44
+ // [
45
+ // {
46
+ // title: 'Some Executable';
47
+ // description: 'some executable';
48
+ // executable: model::SomeExecutable;
49
+ // }
50
+ // ];
51
+ // supportInfo: Email {
52
+ // address: 'someEmail@test.org';
53
+ // };
54
+ }`;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ export enum DSL_DATA_SPACE_LEGEND_STUDIO_DOCUMENTATION_KEY {
18
+ GRAMMAR_PARSER = 'dsl-dataspace.grammar.parser',
19
+ CONCEPT_ELEMENT_DATA_SPACE = 'dsl-dataspace.concept.element.data-space',
20
+ CURATED_TEMPLATE_QUERY = 'dsl-dataspace.curated-template-query',
21
+ }