@finos/legend-application-studio 28.8.0 → 28.10.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 (170) hide show
  1. package/lib/__lib__/LegendStudioCommand.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioCommand.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioCommand.js +5 -0
  4. package/lib/__lib__/LegendStudioCommand.js.map +1 -1
  5. package/lib/__lib__/LegendStudioNavigation.d.ts +6 -0
  6. package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioNavigation.js +5 -0
  8. package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
  9. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  10. package/lib/components/LegendStudioWebApplication.js +4 -1
  11. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  12. package/lib/components/ShowcaseManager.d.ts.map +1 -1
  13. package/lib/components/ShowcaseManager.js +10 -2
  14. package/lib/components/ShowcaseManager.js.map +1 -1
  15. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  16. package/lib/components/editor/ActivityBar.js +20 -17
  17. package/lib/components/editor/ActivityBar.js.map +1 -1
  18. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  19. package/lib/components/editor/editor-group/EditorGroup.js +7 -1
  20. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  21. package/lib/components/editor/editor-group/GrammarTextEditor.js +1 -1
  22. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  23. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts +5 -0
  24. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -1
  25. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +28 -10
  26. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -1
  27. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts +11 -0
  28. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts.map +1 -1
  29. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js +22 -10
  30. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js.map +1 -1
  31. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts +7 -0
  32. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  33. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +3 -3
  34. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  35. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.d.ts +59 -0
  36. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.d.ts.map +1 -0
  37. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.js +145 -0
  38. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.js.map +1 -0
  39. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  40. package/lib/components/editor/side-bar/Explorer.js +3 -2
  41. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  42. package/lib/components/editor/side-bar/SideBar.d.ts.map +1 -1
  43. package/lib/components/editor/side-bar/SideBar.js +4 -1
  44. package/lib/components/editor/side-bar/SideBar.js.map +1 -1
  45. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts +23 -0
  46. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts.map +1 -0
  47. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js +41 -0
  48. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js.map +1 -0
  49. package/lib/components/project-view/ProjectViewer.d.ts.map +1 -1
  50. package/lib/components/project-view/ProjectViewer.js +37 -5
  51. package/lib/components/project-view/ProjectViewer.js.map +1 -1
  52. package/lib/components/showcase/ShowcaseViewer.d.ts +18 -0
  53. package/lib/components/showcase/ShowcaseViewer.d.ts.map +1 -0
  54. package/lib/components/showcase/ShowcaseViewer.js +147 -0
  55. package/lib/components/showcase/ShowcaseViewer.js.map +1 -0
  56. package/lib/components/showcase/ShowcaseViewerStoreProvider.d.ts +23 -0
  57. package/lib/components/showcase/ShowcaseViewerStoreProvider.d.ts.map +1 -0
  58. package/lib/components/showcase/ShowcaseViewerStoreProvider.js +36 -0
  59. package/lib/components/showcase/ShowcaseViewerStoreProvider.js.map +1 -0
  60. package/lib/index.css +2 -2
  61. package/lib/index.css.map +1 -1
  62. package/lib/package.json +1 -1
  63. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  64. package/lib/stores/LegendStudioBaseStore.js +1 -0
  65. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  66. package/lib/stores/ShowcaseManagerState.d.ts +1 -0
  67. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  68. package/lib/stores/ShowcaseManagerState.js +11 -1
  69. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  70. package/lib/stores/editor/EditorConfig.d.ts +3 -1
  71. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  72. package/lib/stores/editor/EditorConfig.js +4 -1
  73. package/lib/stores/editor/EditorConfig.js.map +1 -1
  74. package/lib/stores/editor/EditorMode.d.ts +4 -0
  75. package/lib/stores/editor/EditorMode.d.ts.map +1 -1
  76. package/lib/stores/editor/EditorMode.js +9 -0
  77. package/lib/stores/editor/EditorMode.js.map +1 -1
  78. package/lib/stores/editor/EditorStore.d.ts +2 -0
  79. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  80. package/lib/stores/editor/EditorStore.js +14 -3
  81. package/lib/stores/editor/EditorStore.js.map +1 -1
  82. package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
  83. package/lib/stores/editor/ExplorerTreeState.js +1 -1
  84. package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
  85. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  86. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  87. package/lib/stores/editor/NewElementState.d.ts +1 -0
  88. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  89. package/lib/stores/editor/NewElementState.js +1 -1
  90. package/lib/stores/editor/NewElementState.js.map +1 -1
  91. package/lib/stores/editor/StandardEditorMode.d.ts +1 -0
  92. package/lib/stores/editor/StandardEditorMode.d.ts.map +1 -1
  93. package/lib/stores/editor/StandardEditorMode.js +4 -0
  94. package/lib/stores/editor/StandardEditorMode.js.map +1 -1
  95. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +6 -2
  96. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  97. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +53 -34
  98. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  99. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -1
  100. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +1 -1
  101. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -1
  102. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts +3 -2
  103. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts.map +1 -1
  104. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js +8 -5
  105. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js.map +1 -1
  106. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  107. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +20 -4
  108. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  109. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +3 -0
  110. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -1
  111. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +17 -2
  112. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -1
  113. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts +22 -0
  114. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts.map +1 -0
  115. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js +25 -0
  116. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js.map +1 -0
  117. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts +113 -0
  118. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts.map +1 -0
  119. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js +494 -0
  120. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js.map +1 -0
  121. package/lib/stores/project-view/ProjectViewerEditorMode.d.ts +3 -0
  122. package/lib/stores/project-view/ProjectViewerEditorMode.d.ts.map +1 -1
  123. package/lib/stores/project-view/ProjectViewerEditorMode.js +10 -0
  124. package/lib/stores/project-view/ProjectViewerEditorMode.js.map +1 -1
  125. package/lib/stores/showcase/ShowcaseViewerEditorMode.d.ts +28 -0
  126. package/lib/stores/showcase/ShowcaseViewerEditorMode.d.ts.map +1 -0
  127. package/lib/stores/showcase/ShowcaseViewerEditorMode.js +40 -0
  128. package/lib/stores/showcase/ShowcaseViewerEditorMode.js.map +1 -0
  129. package/lib/stores/showcase/ShowcaseViewerStore.d.ts +32 -0
  130. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -0
  131. package/lib/stores/showcase/ShowcaseViewerStore.js +193 -0
  132. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -0
  133. package/package.json +7 -7
  134. package/src/__lib__/LegendStudioCommand.ts +5 -0
  135. package/src/__lib__/LegendStudioNavigation.ts +11 -0
  136. package/src/components/LegendStudioWebApplication.tsx +11 -1
  137. package/src/components/ShowcaseManager.tsx +44 -2
  138. package/src/components/editor/ActivityBar.tsx +56 -15
  139. package/src/components/editor/editor-group/EditorGroup.tsx +21 -1
  140. package/src/components/editor/editor-group/GrammarTextEditor.tsx +1 -1
  141. package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +135 -103
  142. package/src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx +97 -53
  143. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +4 -3
  144. package/src/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.tsx +478 -0
  145. package/src/components/editor/side-bar/Explorer.tsx +20 -12
  146. package/src/components/editor/side-bar/SideBar.tsx +13 -1
  147. package/src/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.tsx +101 -0
  148. package/src/components/project-view/ProjectViewer.tsx +139 -4
  149. package/src/components/showcase/ShowcaseViewer.tsx +418 -0
  150. package/src/components/showcase/ShowcaseViewerStoreProvider.tsx +56 -0
  151. package/src/stores/LegendStudioBaseStore.ts +1 -0
  152. package/src/stores/ShowcaseManagerState.ts +19 -1
  153. package/src/stores/editor/EditorConfig.ts +3 -0
  154. package/src/stores/editor/EditorMode.ts +14 -0
  155. package/src/stores/editor/EditorStore.ts +17 -8
  156. package/src/stores/editor/ExplorerTreeState.ts +1 -0
  157. package/src/stores/editor/GraphEditGrammarModeState.ts +3 -3
  158. package/src/stores/editor/NewElementState.ts +1 -1
  159. package/src/stores/editor/StandardEditorMode.ts +7 -0
  160. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +77 -49
  161. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +1 -2
  162. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts +12 -8
  163. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +31 -9
  164. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +23 -0
  165. package/src/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.ts +25 -0
  166. package/src/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.tsx +884 -0
  167. package/src/stores/project-view/ProjectViewerEditorMode.ts +17 -0
  168. package/src/stores/showcase/ShowcaseViewerEditorMode.ts +51 -0
  169. package/src/stores/showcase/ShowcaseViewerStore.ts +289 -0
  170. package/tsconfig.json +9 -1
@@ -39,6 +39,7 @@ import {
39
39
  } from '@finos/legend-application';
40
40
  import type { TreeData, TreeNodeData } from '@finos/legend-art';
41
41
  import { DIRECTORY_PATH_DELIMITER } from '@finos/legend-graph';
42
+ import { SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY } from '../components/extensions/Core_LegendStudioApplicationPlugin.js';
42
43
 
43
44
  export enum SHOWCASE_MANAGER_VIEW {
44
45
  EXPLORER = 'EXPLORER',
@@ -307,7 +308,9 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
307
308
  this.initState.inProgress();
308
309
 
309
310
  try {
310
- this.showcases = (yield this.client.getShowcases()) as ShowcaseMetadata[];
311
+ this.showcases = (
312
+ (yield this.client.getShowcases()) as ShowcaseMetadata[]
313
+ ).filter((showcase) => !showcase.development);
311
314
  this.explorerTreeData = buildShowcasesExplorerTreeData(this.showcases);
312
315
  // expand all the root nodes by default
313
316
  this.explorerTreeData.rootIds.forEach((rootId) => {
@@ -372,3 +375,18 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
372
375
  }
373
376
  }
374
377
  }
378
+
379
+ export const openShowcaseManager = (
380
+ applicationStore: LegendStudioApplicationStore,
381
+ ): void => {
382
+ const showcaseManagerState =
383
+ ShowcaseManagerState.retrieveNullableState(applicationStore);
384
+ if (showcaseManagerState?.isEnabled) {
385
+ applicationStore.assistantService.setIsHidden(false);
386
+ applicationStore.assistantService.setIsOpen(true);
387
+ applicationStore.assistantService.setIsPanelMaximized(true);
388
+ applicationStore.assistantService.setSelectedTab(
389
+ SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY,
390
+ );
391
+ }
392
+ };
@@ -37,6 +37,9 @@ export enum ACTIVITY_MODE {
37
37
  WORKFLOW_MANAGER = 'WORKFLOW_MANAGER',
38
38
  TEST_RUNNER = 'TEST_RUNNER',
39
39
  REGISTER_SERVICES = 'REGISTER_SERVICES',
40
+ }
41
+
42
+ export enum USER_JOURNEYS {
40
43
  END_TO_END_WORKFLOWS = 'END_TO_END_WORKFLOWS',
41
44
  }
42
45
 
@@ -29,4 +29,18 @@ export abstract class EditorMode {
29
29
  elementPath: string,
30
30
  dependencyProject: ProjectDependency,
31
31
  ): string;
32
+
33
+ abstract get isInitialized(): boolean;
34
+
35
+ get supportSdlcOperations(): boolean {
36
+ return true;
37
+ }
38
+
39
+ get disableEditing(): boolean {
40
+ return false;
41
+ }
42
+
43
+ get label(): string | undefined {
44
+ return undefined;
45
+ }
32
46
  }
@@ -102,13 +102,14 @@ import type { LegendStudioApplicationStore } from '../LegendStudioBaseStore.js';
102
102
  import { EmbeddedQueryBuilderState } from './EmbeddedQueryBuilderState.js';
103
103
  import { LEGEND_STUDIO_COMMAND_KEY } from '../../__lib__/LegendStudioCommand.js';
104
104
  import { EditorTabManagerState } from './EditorTabManagerState.js';
105
- import type { ProjectViewerEditorMode } from '../project-view/ProjectViewerEditorMode.js';
106
105
  import { GraphEditFormModeState } from './GraphEditFormModeState.js';
107
106
  import type { GraphEditorMode } from './GraphEditorMode.js';
108
107
  import { GraphEditGrammarModeState } from './GraphEditGrammarModeState.js';
109
108
  import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceRegistrationState.js';
110
109
  import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.js';
111
110
  import type { QuickInputState } from './QuickInputState.js';
111
+ import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
112
+ import { openShowcaseManager } from '../ShowcaseManagerState.js';
112
113
 
113
114
  export abstract class EditorExtensionState {
114
115
  /**
@@ -163,6 +164,7 @@ export class EditorStore implements CommandRegistrar {
163
164
  localChangesState: LocalChangesState;
164
165
  conflictResolutionState: WorkspaceUpdateConflictResolutionState;
165
166
  globalBulkServiceRegistrationState: GlobalBulkServiceRegistrationState;
167
+ globalEndToEndWorkflowState: GlobalEndToEndWorkflowState;
166
168
  devToolState: DevToolPanelState;
167
169
  sqlPlaygroundState: SQLPlaygroundPanelState;
168
170
 
@@ -258,6 +260,7 @@ export class EditorStore implements CommandRegistrar {
258
260
  this,
259
261
  this.sdlcState,
260
262
  );
263
+ this.globalEndToEndWorkflowState = new GlobalEndToEndWorkflowState(this);
261
264
  this.workspaceWorkflowManagerState = new WorkspaceWorkflowManagerState(
262
265
  this,
263
266
  this.sdlcState,
@@ -296,13 +299,7 @@ export class EditorStore implements CommandRegistrar {
296
299
  get isInitialized(): boolean {
297
300
  if (this.isInViewerMode) {
298
301
  return (
299
- (Boolean(
300
- this.sdlcState.currentProject && this.sdlcState.currentWorkspace,
301
- ) ||
302
- Boolean(
303
- (this.sdlcState.editorStore.editorMode as ProjectViewerEditorMode)
304
- .viewerStore.projectGAVCoordinates,
305
- )) &&
302
+ this.editorMode.isInitialized &&
306
303
  this.graphManagerState.systemBuildState.hasSucceeded
307
304
  );
308
305
  } else {
@@ -420,6 +417,18 @@ export class EditorStore implements CommandRegistrar {
420
417
  );
421
418
  },
422
419
  });
420
+ this.applicationStore.commandService.registerCommand({
421
+ key: LEGEND_STUDIO_COMMAND_KEY.OPEN_SHOWCASES,
422
+ trigger: this.createEditorCommandTrigger(
423
+ () =>
424
+ this.isInitialized &&
425
+ (!this.isInConflictResolutionMode ||
426
+ this.conflictResolutionState.hasResolvedAllConflicts),
427
+ ),
428
+ action: () => {
429
+ openShowcaseManager(this.applicationStore);
430
+ },
431
+ });
423
432
  this.applicationStore.commandService.registerCommand({
424
433
  key: LEGEND_STUDIO_COMMAND_KEY.TOGGLE_MODEL_LOADER,
425
434
  trigger: this.createEditorCommandTrigger(() => !this.isInViewerMode),
@@ -203,6 +203,7 @@ export class ExplorerTreeState {
203
203
  this.editorStore,
204
204
  val,
205
205
  isReadOnly,
206
+ this.editorStore.graphManagerState.graph,
206
207
  );
207
208
  dbBuilderState.setShowModal(true);
208
209
  this.setDatabaseModelBuilderState(dbBuilderState);
@@ -20,13 +20,13 @@ import {
20
20
  } from '@finos/legend-application';
21
21
  import {
22
22
  type PackageableElement,
23
- GRAPH_MANAGER_EVENT,
23
+ type SourceInformation,
24
24
  type TextCompilationResult,
25
+ type GraphManagerOperationReport,
26
+ GRAPH_MANAGER_EVENT,
25
27
  EngineError,
26
28
  GraphBuilderError,
27
- type GraphManagerOperationReport,
28
29
  reportGraphAnalytics,
29
- type SourceInformation,
30
30
  } from '@finos/legend-graph';
31
31
  import {
32
32
  type GeneratorFn,
@@ -317,7 +317,7 @@ export class NewFlatDataConnectionDriver extends NewConnectionValueDriver<FlatDa
317
317
  }
318
318
  }
319
319
 
320
- const DEFAULT_H2_SQL =
320
+ export const DEFAULT_H2_SQL =
321
321
  '-- loads sample data for getting started. See https://github.com/pthom/northwind_psql for more info\n call loadNorthwindData()';
322
322
  export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDriver<RelationalDatabaseConnection> {
323
323
  constructor(editorStore: EditorStore) {
@@ -58,4 +58,11 @@ export class StandardEditorMode extends EditorMode {
58
58
  elementPath,
59
59
  );
60
60
  }
61
+
62
+ override get isInitialized(): boolean {
63
+ return Boolean(
64
+ this.editorStore.sdlcState.currentProject &&
65
+ this.editorStore.sdlcState.currentWorkspace,
66
+ );
67
+ }
61
68
  }
@@ -72,6 +72,9 @@ import {
72
72
  EngineRuntime,
73
73
  StoreConnections,
74
74
  IdentifiedConnection,
75
+ getOrCreateGraphPackage,
76
+ extractElementNameFromPath,
77
+ extractPackagePathFromPath,
75
78
  } from '@finos/legend-graph';
76
79
  import { GraphEditFormModeState } from '../../../GraphEditFormModeState.js';
77
80
  import { connection_setStore } from '../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
@@ -301,13 +304,14 @@ export interface DatabaseExplorerTreeData
301
304
  database: Database;
302
305
  }
303
306
 
304
- const DEFAULT_DATABASE_PATH = 'store::MyDatabase';
307
+ export const DEFAULT_DATABASE_PATH = 'store::MyDatabase';
305
308
 
306
309
  export class DatabaseSchemaExplorerState {
307
310
  readonly editorStore: EditorStore;
308
311
  readonly connection: RelationalDatabaseConnection;
309
- readonly database: Database;
312
+ database: Database;
310
313
  targetDatabasePath: string;
314
+ makeTargetDatabasePathEditable?: boolean;
311
315
 
312
316
  isGeneratingDatabase = false;
313
317
  isUpdatingDatabase = false;
@@ -322,20 +326,24 @@ export class DatabaseSchemaExplorerState {
322
326
  makeObservable(this, {
323
327
  isGeneratingDatabase: observable,
324
328
  isUpdatingDatabase: observable,
329
+ database: observable,
325
330
  treeData: observable,
326
331
  targetDatabasePath: observable,
327
332
  previewer: observable,
328
333
  previewDataState: observable,
334
+ makeTargetDatabasePathEditable: observable,
329
335
  isCreatingNewDatabase: computed,
330
336
  resolveDatabasePackageAndName: computed,
331
337
  setTreeData: action,
332
338
  setTargetDatabasePath: action,
339
+ setMakeTargetDatabasePathEditable: action,
333
340
  onNodeSelect: flow,
334
341
  fetchDatabaseMetadata: flow,
335
342
  fetchSchemaMetadata: flow,
336
343
  fetchTableMetadata: flow,
337
344
  generateDatabase: flow,
338
345
  updateDatabase: flow,
346
+ updateDatabaseAndGraph: flow,
339
347
  previewData: flow,
340
348
  });
341
349
 
@@ -349,8 +357,12 @@ export class DatabaseSchemaExplorerState {
349
357
  return isStubbed_PackageableElement(this.connection.store.value);
350
358
  }
351
359
 
360
+ setMakeTargetDatabasePathEditable(val: boolean): void {
361
+ this.makeTargetDatabasePathEditable = val;
362
+ }
363
+
352
364
  get resolveDatabasePackageAndName(): [string, string] {
353
- if (!this.isCreatingNewDatabase) {
365
+ if (!this.isCreatingNewDatabase && !this.makeTargetDatabasePathEditable) {
354
366
  return [
355
367
  guaranteeNonNullable(this.database.package).path,
356
368
  this.database.name,
@@ -799,61 +811,77 @@ export class DatabaseSchemaExplorerState {
799
811
  }
800
812
  }
801
813
 
802
- *updateDatabase(): GeneratorFn<void> {
814
+ // this method just updates database
815
+ *updateDatabase(): GeneratorFn<Database> {
816
+ this.isUpdatingDatabase = true;
817
+ const graph = this.editorStore.graphManagerState.createNewGraph();
818
+ (yield this.editorStore.graphManagerState.graphManager.buildGraph(
819
+ graph,
820
+ [(yield flowResult(this.generateDatabase())) as Entity],
821
+ ActionState.create(),
822
+ )) as Entity[];
823
+ const database = getNonNullableEntry(
824
+ graph.ownDatabases,
825
+ 0,
826
+ 'Expected one database to be generated from input',
827
+ );
828
+ // remove undefined schemas
829
+ const schemas = Array.from(
830
+ guaranteeNonNullable(this.treeData).nodes.values(),
831
+ )
832
+ .map((schemaNode) => {
833
+ if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
834
+ return schemaNode.schema;
835
+ }
836
+ return undefined;
837
+ })
838
+ .filter(isNonNullable);
839
+
840
+ // update this.database packge and name
841
+ this.database.package = getOrCreateGraphPackage(
842
+ graph,
843
+ extractPackagePathFromPath(this.targetDatabasePath),
844
+ undefined,
845
+ );
846
+ this.database.name = extractElementNameFromPath(this.targetDatabasePath);
847
+ this.database.schemas = this.database.schemas.filter((schema) => {
848
+ if (
849
+ schemas.find((item) => item.name === schema.name) &&
850
+ !database.schemas.find((s) => s.name === schema.name)
851
+ ) {
852
+ return false;
853
+ }
854
+ return true;
855
+ });
856
+ // update existing schemas
857
+ database.schemas.forEach((schema) => {
858
+ (schema as Writable<Schema>)._OWNER = this.database;
859
+ const currentSchemaIndex = this.database.schemas.findIndex(
860
+ (item) => item.name === schema.name,
861
+ );
862
+ if (currentSchemaIndex !== -1) {
863
+ this.database.schemas[currentSchemaIndex] = schema;
864
+ } else {
865
+ this.database.schemas.push(schema);
866
+ }
867
+ });
868
+ this.isUpdatingDatabase = false;
869
+ return database;
870
+ }
871
+
872
+ // this method updates database and add database to the graph
873
+ *updateDatabaseAndGraph(): GeneratorFn<void> {
803
874
  if (!this.treeData) {
804
875
  return;
805
876
  }
806
-
807
877
  try {
808
- this.isUpdatingDatabase = true;
809
878
  const createDatabase =
810
879
  this.isCreatingNewDatabase &&
811
880
  !this.editorStore.graphManagerState.graph.databases.includes(
812
881
  this.database,
813
882
  );
814
- const graph = this.editorStore.graphManagerState.createNewGraph();
815
- (yield this.editorStore.graphManagerState.graphManager.buildGraph(
816
- graph,
817
- [(yield flowResult(this.generateDatabase())) as Entity],
818
- ActionState.create(),
819
- )) as Entity[];
820
- const database = getNonNullableEntry(
821
- graph.ownDatabases,
822
- 0,
823
- 'Expected one database to be generated from input',
824
- );
825
-
826
- // remove undefined schemas
827
- const schemas = Array.from(this.treeData.nodes.values())
828
- .map((schemaNode) => {
829
- if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
830
- return schemaNode.schema;
831
- }
832
- return undefined;
833
- })
834
- .filter(isNonNullable);
835
- this.database.schemas = this.database.schemas.filter((schema) => {
836
- if (
837
- schemas.find((item) => item.name === schema.name) &&
838
- !database.schemas.find((s) => s.name === schema.name)
839
- ) {
840
- return false;
841
- }
842
- return true;
843
- });
844
-
845
- // update existing schemas
846
- database.schemas.forEach((schema) => {
847
- (schema as Writable<Schema>)._OWNER = this.database;
848
- const currentSchemaIndex = this.database.schemas.findIndex(
849
- (item) => item.name === schema.name,
850
- );
851
- if (currentSchemaIndex !== -1) {
852
- this.database.schemas[currentSchemaIndex] = schema;
853
- } else {
854
- this.database.schemas.push(schema);
855
- }
856
- });
883
+ this.isUpdatingDatabase = true;
884
+ const database = (yield flowResult(this.updateDatabase())) as Database;
857
885
  if (createDatabase) {
858
886
  connection_setStore(
859
887
  this.connection,
@@ -95,8 +95,7 @@ export class DatabaseBuilderWizardState {
95
95
  if (!this.schemaExplorerState.treeData) {
96
96
  return;
97
97
  }
98
-
99
- yield flowResult(this.schemaExplorerState.updateDatabase());
98
+ yield flowResult(this.schemaExplorerState.updateDatabaseAndGraph());
100
99
  this.setShowModal(false);
101
100
  }
102
101
  }
@@ -25,7 +25,11 @@ import {
25
25
  import { observable, action, makeObservable, flow, flowResult } from 'mobx';
26
26
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
27
27
  import type { EditorStore } from '../../../EditorStore.js';
28
- import { type Database, DEFAULT_GENERATION_PACKAGE } from '@finos/legend-graph';
28
+ import {
29
+ type Database,
30
+ type PureModel,
31
+ DEFAULT_GENERATION_PACKAGE,
32
+ } from '@finos/legend-graph';
29
33
  import { EntityChangeType, type EntityChange } from '@finos/legend-server-sdlc';
30
34
 
31
35
  export class DatabaseModelBuilderState {
@@ -39,16 +43,19 @@ export class DatabaseModelBuilderState {
39
43
  generatedGrammarCode = '';
40
44
  entities: Entity[] | undefined;
41
45
  targetPackage: string;
46
+ graph: PureModel;
42
47
 
43
48
  constructor(
44
49
  editorStore: EditorStore,
45
50
  database: Database,
46
51
  isReadOnly: boolean,
52
+ graph: PureModel,
47
53
  ) {
48
54
  makeObservable(this, {
49
55
  showModal: observable,
50
56
  generatedGrammarCode: observable,
51
57
  generatingModelState: observable,
58
+ graph: observable,
52
59
  saveModelState: observable,
53
60
  targetPackage: observable,
54
61
  close: action,
@@ -63,6 +70,7 @@ export class DatabaseModelBuilderState {
63
70
  this.database = database;
64
71
  this.isReadOnly = isReadOnly;
65
72
  this.targetPackage = database.package?.path ?? DEFAULT_GENERATION_PACKAGE;
73
+ this.graph = graph;
66
74
  }
67
75
 
68
76
  setShowModal(val: boolean): void {
@@ -88,13 +96,13 @@ export class DatabaseModelBuilderState {
88
96
 
89
97
  *previewDatabaseModels(): GeneratorFn<void> {
90
98
  try {
91
- this.generatingModelState.isInProgress;
99
+ this.generatingModelState.inProgress();
92
100
  this.entities = [];
93
101
  const entities =
94
102
  (yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(
95
103
  this.database.path,
96
104
  this.targetPackage,
97
- this.editorStore.graphManagerState.graph,
105
+ this.graph,
98
106
  )) as Entity[];
99
107
  this.setEntities(entities);
100
108
  this.setDatabaseGrammarCode(
@@ -122,11 +130,7 @@ export class DatabaseModelBuilderState {
122
130
  const newEntities: EntityChange[] = [];
123
131
  for (const entity of entities) {
124
132
  let entityChangeType: EntityChangeType;
125
- if (
126
- this.editorStore.graphManagerState.graph.getNullableElement(
127
- entity.path,
128
- ) === undefined
129
- ) {
133
+ if (this.graph.getNullableElement(entity.path) === undefined) {
130
134
  entityChangeType = EntityChangeType.CREATE;
131
135
  } else {
132
136
  entityChangeType = EntityChangeType.MODIFY;
@@ -81,6 +81,7 @@ import {
81
81
  createBareMappingTest,
82
82
  createGraphFetchQueryFromMappingAnalysis,
83
83
  generateStoreTestDataFromSetImpl,
84
+ isRelationalMappingTestSuite,
84
85
  } from './MappingTestingHelper.js';
85
86
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../../../__lib__/LegendStudioEvent.js';
86
87
 
@@ -729,15 +730,36 @@ export class MappingTestableState {
729
730
  this.selectedTestSuite?.testStates.forEach((t) =>
730
731
  t.runningTestAction.inProgress(),
731
732
  );
732
- const input = new RunTestsTestableInput(this.mapping);
733
- suite.tests.forEach((t) =>
734
- input.unitTestIds.push(new UniqueTestId(suite, t)),
735
- );
736
- const testResults =
737
- (yield this.editorStore.graphManagerState.graphManager.runTests(
738
- [input],
739
- this.editorStore.graphManagerState.graph,
740
- )) as TestResult[];
733
+ let testResults: TestResult[];
734
+ if (isRelationalMappingTestSuite(suite)) {
735
+ // TEMPORARY RUN each test separately. This is done to help with performance
736
+ // specifically with running realtional mapping tests as we generate a plan during each test.
737
+ // with this change we would still do this but in parallel reducing the time to run the suite
738
+ const inputs = suite.tests.map((t) => {
739
+ const input = new RunTestsTestableInput(this.mapping);
740
+ input.unitTestIds.push(new UniqueTestId(suite, t));
741
+ return input;
742
+ });
743
+ const _testResults = (yield Promise.all(
744
+ inputs.map((i) =>
745
+ this.editorStore.graphManagerState.graphManager.runTests(
746
+ [i],
747
+ this.editorStore.graphManagerState.graph,
748
+ ),
749
+ ),
750
+ )) as TestResult[][];
751
+ testResults = _testResults.flat();
752
+ } else {
753
+ const input = new RunTestsTestableInput(this.mapping);
754
+ suite.tests.forEach((t) =>
755
+ input.unitTestIds.push(new UniqueTestId(suite, t)),
756
+ );
757
+ testResults =
758
+ (yield this.editorStore.graphManagerState.graphManager.runTests(
759
+ [input],
760
+ this.editorStore.graphManagerState.graph,
761
+ )) as TestResult[];
762
+ }
741
763
  this.handleNewResults(testResults);
742
764
  } catch (error) {
743
765
  assertErrorThrown(error);
@@ -45,6 +45,7 @@ import {
45
45
  PropertyGraphFetchTree,
46
46
  PropertyExplicitReference,
47
47
  type ObserverContext,
48
+ Database,
48
49
  } from '@finos/legend-graph';
49
50
  import {
50
51
  buildGetAllFunction,
@@ -61,6 +62,7 @@ import {
61
62
  import {
62
63
  assertErrorThrown,
63
64
  assertTrue,
65
+ filterByType,
64
66
  guaranteeNonNullable,
65
67
  } from '@finos/legend-shared';
66
68
  import type { DSL_Data_LegendStudioApplicationPlugin_Extension } from '../../../../../extensions/DSL_Data_LegendStudioApplicationPlugin_Extension.js';
@@ -103,6 +105,27 @@ export const createStoreBareModelStoreData = (
103
105
  return testData;
104
106
  };
105
107
 
108
+ export const isRelationalStoreTestData = (val: StoreTestData): boolean =>
109
+ val.store.value instanceof Database;
110
+
111
+ export const isRelationalMappingTest = (val: MappingTest): boolean => {
112
+ if (!val.storeTestData.length) {
113
+ return false;
114
+ }
115
+ return val.storeTestData.some((e) => isRelationalStoreTestData(e));
116
+ };
117
+
118
+ export const isRelationalMappingTestSuite = (
119
+ val: MappingTestSuite,
120
+ ): boolean => {
121
+ if (!val.tests.length) {
122
+ return false;
123
+ }
124
+ return val.tests
125
+ .filter(filterByType(MappingTest))
126
+ .some((e) => isRelationalMappingTest(e));
127
+ };
128
+
106
129
  export const generateStoreTestDataFromSetImpl = (
107
130
  setImpl: SetImplementation,
108
131
  editorStore: EditorStore,
@@ -0,0 +1,25 @@
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
+ import { EditorState } from '../../editor-state/EditorState.js';
18
+ import { SupportedEndToEndWorkflow } from '../../sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
19
+
20
+ export abstract class EndToEndWorkflowEditorState extends EditorState {}
21
+ export class QueryConnectionEndToEndWorkflowEditorState extends EndToEndWorkflowEditorState {
22
+ override get label(): string {
23
+ return SupportedEndToEndWorkflow.CREATE_QUERY_FROM_CONNECTION;
24
+ }
25
+ }