@finos/legend-application-studio 22.2.1 → 22.3.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 (200) hide show
  1. package/lib/components/editor/StatusBar.js +1 -1
  2. package/lib/components/editor/StatusBar.js.map +1 -1
  3. package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
  4. package/lib/components/editor/command-center/ProjectSearchCommand.js +1 -0
  5. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  6. package/lib/components/editor/edit-panel/EditPanel.d.ts.map +1 -1
  7. package/lib/components/editor/edit-panel/EditPanel.js +24 -11
  8. package/lib/components/editor/edit-panel/EditPanel.js.map +1 -1
  9. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
  10. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +2 -1
  11. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
  12. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.d.ts.map +1 -1
  13. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js +1 -0
  14. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js.map +1 -1
  15. package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.d.ts.map +1 -1
  16. package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.js +4 -3
  17. package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.js.map +1 -1
  18. package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.d.ts +32 -0
  19. package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.d.ts.map +1 -0
  20. package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.js +66 -0
  21. package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.js.map +1 -0
  22. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts +0 -23
  23. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  24. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +6 -58
  25. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
  26. package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.d.ts +41 -0
  27. package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.d.ts.map +1 -0
  28. package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.js +77 -0
  29. package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.js.map +1 -0
  30. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts +7 -0
  31. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts.map +1 -1
  32. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js +19 -14
  33. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js.map +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  35. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +3 -1
  36. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +3 -1
  38. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  39. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.d.ts.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js +3 -0
  41. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js.map +1 -1
  42. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.d.ts.map +1 -1
  43. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +3 -1
  44. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  45. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.d.ts.map +1 -1
  46. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js +51 -13
  47. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js.map +1 -1
  48. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  49. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +18 -10
  50. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  51. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts +1 -3
  52. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts.map +1 -1
  53. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +2 -20
  54. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  55. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  56. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +9 -3
  57. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  58. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  59. package/lib/components/editor/side-bar/CreateNewElementModal.js +1 -0
  60. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  61. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  62. package/lib/components/editor/side-bar/Explorer.js +29 -8
  63. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  64. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  65. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +17 -3
  66. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  67. package/lib/index.css +2 -2
  68. package/lib/index.css.map +1 -1
  69. package/lib/index.d.ts +2 -2
  70. package/lib/index.d.ts.map +1 -1
  71. package/lib/index.js +2 -2
  72. package/lib/index.js.map +1 -1
  73. package/lib/package.json +3 -3
  74. package/lib/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.d.ts +2 -2
  75. package/lib/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  76. package/lib/stores/DependencyProjectViewerHelper.d.ts +19 -0
  77. package/lib/stores/DependencyProjectViewerHelper.d.ts.map +1 -0
  78. package/lib/stores/DependencyProjectViewerHelper.js +23 -0
  79. package/lib/stores/DependencyProjectViewerHelper.js.map +1 -0
  80. package/lib/stores/EditorGraphState.d.ts +9 -2
  81. package/lib/stores/EditorGraphState.d.ts.map +1 -1
  82. package/lib/stores/EditorGraphState.js +35 -97
  83. package/lib/stores/EditorGraphState.js.map +1 -1
  84. package/lib/stores/EditorStore.d.ts.map +1 -1
  85. package/lib/stores/EditorStore.js +7 -1
  86. package/lib/stores/EditorStore.js.map +1 -1
  87. package/lib/stores/EditorTabManagerState.d.ts +1 -1
  88. package/lib/stores/EditorTabManagerState.d.ts.map +1 -1
  89. package/lib/stores/EditorTabManagerState.js +11 -13
  90. package/lib/stores/EditorTabManagerState.js.map +1 -1
  91. package/lib/stores/ExplorerTreeState.d.ts +4 -4
  92. package/lib/stores/ExplorerTreeState.d.ts.map +1 -1
  93. package/lib/stores/ExplorerTreeState.js +12 -13
  94. package/lib/stores/ExplorerTreeState.js.map +1 -1
  95. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  96. package/lib/stores/editor/NewElementState.js +0 -3
  97. package/lib/stores/editor/NewElementState.js.map +1 -1
  98. package/lib/stores/editor-state/ExternalFormatState.d.ts +2 -0
  99. package/lib/stores/editor-state/ExternalFormatState.d.ts.map +1 -1
  100. package/lib/stores/editor-state/ExternalFormatState.js +6 -0
  101. package/lib/stores/editor-state/ExternalFormatState.js.map +1 -1
  102. package/lib/stores/editor-state/FileGenerationState.d.ts +18 -18
  103. package/lib/stores/editor-state/FileGenerationState.d.ts.map +1 -1
  104. package/lib/stores/editor-state/FileGenerationState.js +86 -133
  105. package/lib/stores/editor-state/FileGenerationState.js.map +1 -1
  106. package/lib/stores/editor-state/FileGenerationViewerState.d.ts +3 -3
  107. package/lib/stores/editor-state/FileGenerationViewerState.d.ts.map +1 -1
  108. package/lib/stores/editor-state/FileGenerationViewerState.js.map +1 -1
  109. package/lib/stores/editor-state/FileSystemState.d.ts +30 -0
  110. package/lib/stores/editor-state/FileSystemState.d.ts.map +1 -0
  111. package/lib/stores/editor-state/FileSystemState.js +82 -0
  112. package/lib/stores/editor-state/FileSystemState.js.map +1 -0
  113. package/lib/stores/editor-state/GraphGenerationState.d.ts +9 -9
  114. package/lib/stores/editor-state/GraphGenerationState.d.ts.map +1 -1
  115. package/lib/stores/editor-state/GraphGenerationState.js +14 -15
  116. package/lib/stores/editor-state/GraphGenerationState.js.map +1 -1
  117. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts +25 -2
  118. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  119. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +50 -7
  120. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  121. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.d.ts +44 -0
  122. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.d.ts.map +1 -0
  123. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js +172 -0
  124. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js.map +1 -0
  125. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
  126. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  127. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js +2 -2
  128. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js.map +1 -1
  129. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts +3 -0
  130. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  131. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js +14 -2
  132. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  133. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +9 -6
  134. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  135. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +38 -28
  136. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  137. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  138. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +6 -3
  139. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  140. package/lib/stores/shared/FileSystemTreeUtils.d.ts +56 -0
  141. package/lib/stores/shared/FileSystemTreeUtils.d.ts.map +1 -0
  142. package/lib/stores/shared/{FileGenerationTreeUtils.js → FileSystemTreeUtils.js} +31 -32
  143. package/lib/stores/shared/FileSystemTreeUtils.js.map +1 -0
  144. package/lib/stores/shared/PackageTreeUtils.d.ts +6 -4
  145. package/lib/stores/shared/PackageTreeUtils.d.ts.map +1 -1
  146. package/lib/stores/shared/PackageTreeUtils.js +90 -11
  147. package/lib/stores/shared/PackageTreeUtils.js.map +1 -1
  148. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts +3 -3
  149. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
  150. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js +37 -1
  151. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  152. package/package.json +12 -12
  153. package/src/components/editor/StatusBar.tsx +1 -1
  154. package/src/components/editor/command-center/ProjectSearchCommand.tsx +1 -0
  155. package/src/components/editor/edit-panel/EditPanel.tsx +79 -25
  156. package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +2 -1
  157. package/src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx +1 -0
  158. package/src/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.tsx +5 -7
  159. package/src/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.tsx +194 -0
  160. package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +6 -270
  161. package/src/components/editor/edit-panel/element-generation-editor/FileSystemViewer.tsx +296 -0
  162. package/src/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.tsx +177 -155
  163. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +3 -1
  164. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +3 -3
  165. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.tsx +3 -0
  166. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +3 -1
  167. package/src/components/editor/edit-panel/service-editor/ServiceEditor.tsx +243 -184
  168. package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +42 -15
  169. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +2 -65
  170. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +9 -3
  171. package/src/components/editor/side-bar/CreateNewElementModal.tsx +1 -0
  172. package/src/components/editor/side-bar/Explorer.tsx +82 -13
  173. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +31 -9
  174. package/src/index.ts +5 -2
  175. package/src/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.ts +2 -2
  176. package/src/stores/DependencyProjectViewerHelper.ts +39 -0
  177. package/src/stores/EditorGraphState.ts +56 -155
  178. package/src/stores/EditorStore.ts +15 -5
  179. package/src/stores/EditorTabManagerState.ts +17 -20
  180. package/src/stores/ExplorerTreeState.ts +26 -18
  181. package/src/stores/editor/NewElementState.ts +0 -2
  182. package/src/stores/editor-state/ExternalFormatState.ts +9 -0
  183. package/src/stores/editor-state/FileGenerationState.ts +129 -180
  184. package/src/stores/editor-state/FileGenerationViewerState.ts +3 -3
  185. package/src/stores/editor-state/FileSystemState.ts +111 -0
  186. package/src/stores/editor-state/GraphGenerationState.ts +35 -31
  187. package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +91 -6
  188. package/src/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.ts +266 -0
  189. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
  190. package/src/stores/editor-state/element-editor-state/mapping/MappingTestState.ts +2 -2
  191. package/src/stores/editor-state/element-editor-state/service/ServiceEditorState.ts +23 -2
  192. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +60 -55
  193. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +6 -2
  194. package/src/stores/shared/{FileGenerationTreeUtils.ts → FileSystemTreeUtils.ts} +77 -76
  195. package/src/stores/shared/PackageTreeUtils.ts +144 -10
  196. package/src/stores/sidebar-state/testable/GlobalTestRunnerState.ts +42 -3
  197. package/tsconfig.json +6 -1
  198. package/lib/stores/shared/FileGenerationTreeUtils.d.ts +0 -56
  199. package/lib/stores/shared/FileGenerationTreeUtils.d.ts.map +0 -1
  200. package/lib/stores/shared/FileGenerationTreeUtils.js.map +0 -1
@@ -93,6 +93,7 @@ import {
93
93
  type CompilationWarning,
94
94
  type TextCompilationResult,
95
95
  type CompilationResult,
96
+ type PureModel,
96
97
  } from '@finos/legend-graph';
97
98
  import {
98
99
  ActionAlertActionType,
@@ -152,6 +153,7 @@ export class EditorGraphState {
152
153
  | 'updateGraphAndApplicationInTextMode'
153
154
  | 'mostRecentFormModeCompilationGraphHash'
154
155
  | 'mostRecentTextModeCompilationGraphHash'
156
+ | 'buildDependencies'
155
157
  >(this, {
156
158
  isInitializingGraph: observable,
157
159
  isRunningGlobalCompile: observable,
@@ -177,6 +179,7 @@ export class EditorGraphState {
177
179
  updateGraphAndApplicationInFormMode: flow,
178
180
  updateGraphAndApplicationInTextMode: flow,
179
181
  updateGenerationGraphAndApplication: flow,
182
+ buildDependencies: flow,
180
183
  });
181
184
 
182
185
  this.editorStore = editorStore;
@@ -898,12 +901,52 @@ export class EditorGraphState {
898
901
  }
899
902
 
900
903
  /**
901
- * It creates a new explorer tree state when we compile in text mode. It resets the explorer state properly
904
+ * NOTE: this can post memory-leak issue if we start having immutable elements referencing current graph elements:
905
+ * e.g. subclass analytics on the immutable class, etc.
906
+ *
907
+ * @risk memory-leak
908
+ */
909
+ private *buildDependencies(newGraph: PureModel): GeneratorFn<void> {
910
+ if (
911
+ this.editorStore.graphManagerState.dependenciesBuildState.hasSucceeded
912
+ ) {
913
+ newGraph.dependencyManager =
914
+ this.editorStore.graphManagerState.graph.dependencyManager;
915
+ } else {
916
+ this.editorStore.projectConfigurationEditorState.setProjectConfiguration(
917
+ ProjectConfiguration.serialization.fromJson(
918
+ (yield this.editorStore.sdlcServerClient.getConfiguration(
919
+ this.editorStore.sdlcState.activeProject.projectId,
920
+ this.editorStore.sdlcState.activeWorkspace,
921
+ )) as PlainObject<ProjectConfiguration>,
922
+ ),
923
+ );
924
+ const dependencyManager =
925
+ this.editorStore.graphManagerState.createEmptyDependencyManager();
926
+ newGraph.dependencyManager = dependencyManager;
927
+ const dependenciesBuildState = ActionState.create();
928
+ yield this.editorStore.graphManagerState.graphManager.buildDependencies(
929
+ this.editorStore.graphManagerState.coreModel,
930
+ this.editorStore.graphManagerState.systemModel,
931
+ dependencyManager,
932
+ (yield flowResult(this.getIndexedDependencyEntities())) as Map<
933
+ string,
934
+ Entity[]
935
+ >,
936
+ dependenciesBuildState,
937
+ );
938
+ this.editorStore.graphManagerState.dependenciesBuildState =
939
+ dependenciesBuildState;
940
+ }
941
+ }
942
+
943
+ /**
944
+ * Creates a new explorer tree state when compiling in text mode. It resets the explorer state properly
902
945
  * after the new graph is built. It tries to maintain the explorer state similar to what it was before compilation.
903
946
  * To achieve that we store node ids of the opened nodes before creating a new explorer state. After creating a
904
947
  * new state we open the nodes which were opened before so that user see the same explorer state as before.
905
948
  */
906
- updateExplorerTree(): void {
949
+ reprocessExplorerTreeInTextMode(): void {
907
950
  const mainTreeOpenedNodeIds = this.editorStore.explorerTreeState.treeData
908
951
  ? Array.from(this.editorStore.explorerTreeState.treeData.nodes.values())
909
952
  .filter((node) => node.isOpen)
@@ -981,43 +1024,7 @@ export class EditorGraphState {
981
1024
  this.isUpdatingGraph = true;
982
1025
  try {
983
1026
  const newGraph = this.editorStore.graphManagerState.createEmptyGraph();
984
- /**
985
- * NOTE: this can post memory-leak issue if we start having immutable elements referencing current graph elements:
986
- * e.g. subclass analytics on the immutable class, etc.
987
- *
988
- * @risk memory-leak
989
- */
990
- if (
991
- this.editorStore.graphManagerState.dependenciesBuildState.hasSucceeded
992
- ) {
993
- newGraph.dependencyManager =
994
- this.editorStore.graphManagerState.graph.dependencyManager;
995
- } else {
996
- this.editorStore.projectConfigurationEditorState.setProjectConfiguration(
997
- ProjectConfiguration.serialization.fromJson(
998
- (yield this.editorStore.sdlcServerClient.getConfiguration(
999
- this.editorStore.sdlcState.activeProject.projectId,
1000
- this.editorStore.sdlcState.activeWorkspace,
1001
- )) as PlainObject<ProjectConfiguration>,
1002
- ),
1003
- );
1004
- const dependencyManager =
1005
- this.editorStore.graphManagerState.createEmptyDependencyManager();
1006
- newGraph.dependencyManager = dependencyManager;
1007
- const dependenciesBuildState = ActionState.create();
1008
- yield this.editorStore.graphManagerState.graphManager.buildDependencies(
1009
- this.editorStore.graphManagerState.coreModel,
1010
- this.editorStore.graphManagerState.systemModel,
1011
- dependencyManager,
1012
- (yield flowResult(this.getIndexedDependencyEntities())) as Map<
1013
- string,
1014
- Entity[]
1015
- >,
1016
- dependenciesBuildState,
1017
- );
1018
- this.editorStore.graphManagerState.dependenciesBuildState =
1019
- dependenciesBuildState;
1020
- }
1027
+ yield flowResult(this.buildDependencies(newGraph));
1021
1028
 
1022
1029
  /**
1023
1030
  * Backup and editor states info before resetting. Here we store the element paths of the
@@ -1091,7 +1098,7 @@ export class EditorGraphState {
1091
1098
  this.editorStore.graphManagerState.generationsBuildState =
1092
1099
  generationsBuildState;
1093
1100
 
1094
- this.updateExplorerTree();
1101
+ this.editorStore.explorerTreeState.reprocess();
1095
1102
 
1096
1103
  /**
1097
1104
  * Re-build the editor states which were opened before from the information we have stored before
@@ -1101,7 +1108,6 @@ export class EditorGraphState {
1101
1108
  openedTabPaths,
1102
1109
  currentTabState,
1103
1110
  currentTabElementPath,
1104
- true,
1105
1111
  );
1106
1112
 
1107
1113
  this.editorStore.applicationStore.log.info(
@@ -1133,7 +1139,7 @@ export class EditorGraphState {
1133
1139
  this.isUpdatingGraph = false;
1134
1140
  // Note: in the future this function will probably be ideal to refactor when we have different classes for each mode
1135
1141
  // as we would handle this error differently in `text` mode and `form` mode.
1136
- if (error instanceof GraphBuilderError && this.editorStore.isInFormMode) {
1142
+ if (error instanceof GraphBuilderError) {
1137
1143
  this.editorStore.applicationStore.setBlockingAlert({
1138
1144
  message: `Can't build graph: ${error.message}`,
1139
1145
  prompt: 'Refreshing full application...',
@@ -1142,10 +1148,6 @@ export class EditorGraphState {
1142
1148
  this.editorStore.tabManagerState.closeAllTabs();
1143
1149
  this.editorStore.cleanUp();
1144
1150
  yield flowResult(this.editorStore.buildGraph(entities));
1145
- } else {
1146
- this.editorStore.applicationStore.notifyError(
1147
- `Can't build graph: ${error.message}`,
1148
- );
1149
1151
  }
1150
1152
  } finally {
1151
1153
  this.isUpdatingApplication = false;
@@ -1161,79 +1163,7 @@ export class EditorGraphState {
1161
1163
  this.isUpdatingGraph = true;
1162
1164
  try {
1163
1165
  const newGraph = this.editorStore.graphManagerState.createEmptyGraph();
1164
- /**
1165
- * NOTE: this can post memory-leak issue if we start having immutable elements referencing current graph elements:
1166
- * e.g. subclass analytics on the immutable class, etc.
1167
- *
1168
- * @risk memory-leak
1169
- */
1170
- if (
1171
- this.editorStore.graphManagerState.dependenciesBuildState.hasSucceeded
1172
- ) {
1173
- newGraph.dependencyManager =
1174
- this.editorStore.graphManagerState.graph.dependencyManager;
1175
- } else {
1176
- this.editorStore.projectConfigurationEditorState.setProjectConfiguration(
1177
- ProjectConfiguration.serialization.fromJson(
1178
- (yield this.editorStore.sdlcServerClient.getConfiguration(
1179
- this.editorStore.sdlcState.activeProject.projectId,
1180
- this.editorStore.sdlcState.activeWorkspace,
1181
- )) as PlainObject<ProjectConfiguration>,
1182
- ),
1183
- );
1184
- const dependencyManager =
1185
- this.editorStore.graphManagerState.createEmptyDependencyManager();
1186
- newGraph.dependencyManager = dependencyManager;
1187
- const dependenciesBuildState = ActionState.create();
1188
- yield this.editorStore.graphManagerState.graphManager.buildDependencies(
1189
- this.editorStore.graphManagerState.coreModel,
1190
- this.editorStore.graphManagerState.systemModel,
1191
- dependencyManager,
1192
- (yield flowResult(this.getIndexedDependencyEntities())) as Map<
1193
- string,
1194
- Entity[]
1195
- >,
1196
- dependenciesBuildState,
1197
- );
1198
- this.editorStore.graphManagerState.dependenciesBuildState =
1199
- dependenciesBuildState;
1200
- }
1201
-
1202
- /**
1203
- * Backup and editor states info before resetting. Here we store the element paths of the
1204
- * elements editors as element paths don't refer to the actual graph. We can find the element
1205
- * from the new graph that is built by using element path and can reprocess the element editor states.
1206
- * The other kind of editors we reprocess are file generation editors, we store them as is as they don't
1207
- * hold any reference to the actual graph.
1208
- */
1209
- const openedTabPaths: string[] = [];
1210
- this.editorStore.tabManagerState.tabs.forEach((state: TabState) => {
1211
- if (state instanceof ElementEditorState) {
1212
- openedTabPaths.push(state.elementPath);
1213
- }
1214
- });
1215
- // Only stores editor state for file generation editors as they don't hold any references to the
1216
- // actual graph.
1217
- const currentTabState =
1218
- this.editorStore.tabManagerState.currentTab instanceof
1219
- ElementEditorState
1220
- ? undefined
1221
- : this.editorStore.tabManagerState.currentTab;
1222
- const currentTabElementPath =
1223
- this.editorStore.tabManagerState.currentTab instanceof
1224
- ElementEditorState
1225
- ? this.editorStore.tabManagerState.currentTab.elementPath
1226
- : undefined;
1227
- /**
1228
- * We remove the current editor state so that we no longer let React displays the element that belongs to the old graph
1229
- * NOTE: this causes an UI flash, but this is in many way, acceptable since the user probably should know that we are
1230
- * refreshing the memory graph anyway.
1231
- *
1232
- * If this is really bothering, we can handle it by building mocked replica of the current editor state using stub element
1233
- * e.g. if the current editor is a class, we stub the class, create a new class editor state around it and copy over
1234
- * navigation information, etc.
1235
- */
1236
- this.editorStore.tabManagerState.closeAllTabs();
1166
+ yield flowResult(this.buildDependencies(newGraph));
1237
1167
  yield flowResult(graph_dispose(this.editorStore.graphManagerState.graph));
1238
1168
 
1239
1169
  const graphBuildState = ActionState.create();
@@ -1249,37 +1179,7 @@ export class EditorGraphState {
1249
1179
  },
1250
1180
  );
1251
1181
 
1252
- // Activity States
1253
- this.editorStore.globalTestRunnerState = new GlobalTestRunnerState(
1254
- this.editorStore,
1255
- this.editorStore.sdlcState,
1256
- );
1257
-
1258
- // NOTE: build model generation entities every-time we rebuild the graph - should we do this?
1259
- const generationsBuildState = ActionState.create();
1260
- yield this.editorStore.graphManagerState.graphManager.buildGenerations(
1261
- newGraph,
1262
- this.graphGenerationState.generatedEntities,
1263
- generationsBuildState,
1264
- );
1265
-
1266
- this.editorStore.graphManagerState.graph = newGraph;
1267
- this.editorStore.graphManagerState.graphBuildState = graphBuildState;
1268
- this.editorStore.graphManagerState.generationsBuildState =
1269
- generationsBuildState;
1270
-
1271
- this.updateExplorerTree();
1272
-
1273
- /**
1274
- * Re-build the editor states which were opened before from the information we have stored before
1275
- * creating the new graph
1276
- */
1277
- this.editorStore.tabManagerState.recoverTabs(
1278
- openedTabPaths,
1279
- currentTabState,
1280
- currentTabElementPath,
1281
- false,
1282
- );
1182
+ this.reprocessExplorerTreeInTextMode();
1283
1183
 
1284
1184
  this.editorStore.applicationStore.log.info(
1285
1185
  LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_UPDATED_AND_REBUILT),
@@ -1295,9 +1195,11 @@ export class EditorGraphState {
1295
1195
  error,
1296
1196
  );
1297
1197
  this.isUpdatingGraph = false;
1298
- this.editorStore.applicationStore.notifyError(
1299
- `Can't build graph: ${error.message}`,
1300
- );
1198
+ if (error instanceof GraphBuilderError) {
1199
+ this.editorStore.applicationStore.notifyError(
1200
+ `Can't build graph: ${error.message}`,
1201
+ );
1202
+ }
1301
1203
  } finally {
1302
1204
  this.isUpdatingApplication = false;
1303
1205
  this.editorStore.applicationStore.setBlockingAlert(undefined);
@@ -1348,12 +1250,11 @@ export class EditorGraphState {
1348
1250
  this.graphGenerationState.generatedEntities,
1349
1251
  this.editorStore.graphManagerState.generationsBuildState,
1350
1252
  );
1351
- this.updateExplorerTree();
1253
+ this.editorStore.explorerTreeState.reprocess();
1352
1254
  this.editorStore.tabManagerState.recoverTabs(
1353
1255
  openedTabEditorPaths,
1354
1256
  currentTabState,
1355
1257
  currentTabElementPath,
1356
- true,
1357
1258
  );
1358
1259
  } catch (error) {
1359
1260
  assertErrorThrown(error);
@@ -347,11 +347,21 @@ export class EditorStore implements CommandRegistrar {
347
347
  if (graphEditor === GRAPH_EDITOR_MODE.GRAMMAR_TEXT) {
348
348
  // Stop change detection as we don't need the actual change detection in text mode
349
349
  this.changeDetectionState.stop();
350
- this.changeDetectionState.computeLocalChangesInTextMode(
351
- (yield this.graphManagerState.graphManager.pureCodeToEntities(
352
- this.grammarTextEditorState.graphGrammarText,
353
- )) as Entity[],
354
- );
350
+ try {
351
+ yield flowResult(
352
+ this.changeDetectionState.computeLocalChangesInTextMode(
353
+ (yield this.graphManagerState.graphManager.pureCodeToEntities(
354
+ this.grammarTextEditorState.graphGrammarText,
355
+ )) as Entity[],
356
+ ),
357
+ );
358
+ } catch (error) {
359
+ assertErrorThrown(error);
360
+ this.applicationStore.log.warn(
361
+ LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
362
+ error,
363
+ );
364
+ }
355
365
  }
356
366
  }
357
367
 
@@ -95,27 +95,24 @@ export class EditorTabManagerState extends TabManagerState {
95
95
  openedTabEditorPaths: string[],
96
96
  currentTabState: EditorState | undefined,
97
97
  currentTabElementPath: string | undefined,
98
- shouldRecoverTabs: boolean,
99
98
  ): void => {
100
- if (shouldRecoverTabs) {
101
- this.tabs = openedTabEditorPaths
102
- .map((editorPath) => {
103
- const correspondingElement =
104
- this.editorStore.graphManagerState.graph.getNullableElement(
105
- editorPath,
106
- );
107
- if (correspondingElement) {
108
- return this.editorStore.createElementEditorState(
109
- correspondingElement,
110
- );
111
- }
112
- return undefined;
113
- })
114
- .filter(isNonNullable);
115
- this.setCurrentTab(
116
- this.findCurrentTab(currentTabState, currentTabElementPath),
117
- );
118
- }
99
+ this.tabs = openedTabEditorPaths
100
+ .map((editorPath) => {
101
+ const correspondingElement =
102
+ this.editorStore.graphManagerState.graph.getNullableElement(
103
+ editorPath,
104
+ );
105
+ if (correspondingElement) {
106
+ return this.editorStore.createElementEditorState(
107
+ correspondingElement,
108
+ );
109
+ }
110
+ return undefined;
111
+ })
112
+ .filter(isNonNullable);
113
+ this.setCurrentTab(
114
+ this.findCurrentTab(currentTabState, currentTabElementPath),
115
+ );
119
116
  };
120
117
 
121
118
  findCurrentTab = (
@@ -25,6 +25,7 @@ import {
25
25
  ActionState,
26
26
  } from '@finos/legend-shared';
27
27
  import {
28
+ getDependenciesPackableElementTreeData,
28
29
  getPackableElementTreeData,
29
30
  openNode,
30
31
  openNodeById,
@@ -35,9 +36,9 @@ import { LEGEND_STUDIO_APP_EVENT } from './LegendStudioAppEvent.js';
35
36
  import type { PackageTreeNodeData } from './shared/TreeUtils.js';
36
37
  import type { TreeData } from '@finos/legend-art';
37
38
  import {
38
- type GenerationTreeNodeData,
39
- getGenerationTreeData,
40
- } from './shared/FileGenerationTreeUtils.js';
39
+ type FileSystemTreeNodeData,
40
+ getFileSystemTreeData,
41
+ } from './shared/FileSystemTreeUtils.js';
41
42
  import {
42
43
  type PackageableElement,
43
44
  ROOT_PACKAGE_NAME,
@@ -45,6 +46,7 @@ import {
45
46
  Unit,
46
47
  PrimitiveType,
47
48
  getElementRootPackage,
49
+ isDependencyElement,
48
50
  } from '@finos/legend-graph';
49
51
  import { APPLICATION_EVENT } from '@finos/legend-application';
50
52
 
@@ -63,7 +65,7 @@ export class ExplorerTreeState {
63
65
  legalTreeData?: TreeData<PackageTreeNodeData> | undefined;
64
66
  dependencyTreeData?: TreeData<PackageTreeNodeData> | undefined;
65
67
  selectedNode?: PackageTreeNodeData | undefined;
66
- fileGenerationTreeData?: TreeData<GenerationTreeNodeData> | undefined;
68
+ fileGenerationTreeData?: TreeData<FileSystemTreeNodeData> | undefined;
67
69
  elementToRename?: PackageableElement | undefined;
68
70
  buildState = ActionState.create();
69
71
 
@@ -76,7 +78,6 @@ export class ExplorerTreeState {
76
78
  dependencyTreeData: observable.ref,
77
79
  selectedNode: observable.ref,
78
80
  fileGenerationTreeData: observable.ref,
79
- elementToRename: observable,
80
81
  setTreeData: action,
81
82
  setGenerationTreeData: action,
82
83
  setSystemTreeData: action,
@@ -151,7 +152,7 @@ export class ExplorerTreeState {
151
152
  setDependencyTreeData(data: TreeData<PackageTreeNodeData>): void {
152
153
  this.dependencyTreeData = data;
153
154
  }
154
- setFileGenerationTreeData(data: TreeData<GenerationTreeNodeData>): void {
155
+ setFileGenerationTreeData(data: TreeData<FileSystemTreeNodeData>): void {
155
156
  this.fileGenerationTreeData = data;
156
157
  }
157
158
  setElementToRename(val: PackageableElement | undefined): void {
@@ -180,7 +181,7 @@ export class ExplorerTreeState {
180
181
  this.editorStore.graphManagerState.graph.generationModel.root,
181
182
  ExplorerTreeRootPackageLabel.MODEL_GENERATION,
182
183
  );
183
- this.fileGenerationTreeData = getGenerationTreeData(
184
+ this.fileGenerationTreeData = getFileSystemTreeData(
184
185
  this.editorStore.graphState.graphGenerationState.rootFileDirectory,
185
186
  ExplorerTreeRootPackageLabel.FILE_GENERATION,
186
187
  );
@@ -198,9 +199,9 @@ export class ExplorerTreeState {
198
199
  );
199
200
  }
200
201
  if (!this.dependencyTreeData) {
201
- this.dependencyTreeData = getPackableElementTreeData(
202
+ this.dependencyTreeData = getDependenciesPackableElementTreeData(
202
203
  this.editorStore,
203
- this.editorStore.graphManagerState.graph.dependencyManager.root,
204
+ this.editorStore.graphManagerState.graph.dependencyManager.roots,
204
205
  ExplorerTreeRootPackageLabel.PROJECT_DEPENDENCY,
205
206
  );
206
207
  }
@@ -214,7 +215,7 @@ export class ExplorerTreeState {
214
215
  this.editorStore.graphManagerState.graph.generationModel.root,
215
216
  ExplorerTreeRootPackageLabel.MODEL_GENERATION,
216
217
  );
217
- this.fileGenerationTreeData = getGenerationTreeData(
218
+ this.fileGenerationTreeData = getFileSystemTreeData(
218
219
  this.editorStore.graphState.graphGenerationState.rootFileDirectory,
219
220
  ExplorerTreeRootPackageLabel.FILE_GENERATION,
220
221
  );
@@ -228,9 +229,9 @@ export class ExplorerTreeState {
228
229
  this.editorStore.graphManagerState.systemModel.root,
229
230
  ExplorerTreeRootPackageLabel.SYSTEM,
230
231
  );
231
- this.dependencyTreeData = getPackableElementTreeData(
232
+ this.dependencyTreeData = getDependenciesPackableElementTreeData(
232
233
  this.editorStore,
233
- this.editorStore.graphManagerState.graph.dependencyManager.root,
234
+ this.editorStore.graphManagerState.graph.dependencyManager.roots,
234
235
  ExplorerTreeRootPackageLabel.PROJECT_DEPENDENCY,
235
236
  );
236
237
  }
@@ -332,9 +333,9 @@ export class ExplorerTreeState {
332
333
  );
333
334
  }
334
335
  if (!this.dependencyTreeData) {
335
- this.dependencyTreeData = getPackableElementTreeData(
336
+ this.dependencyTreeData = getDependenciesPackableElementTreeData(
336
337
  this.editorStore,
337
- this.editorStore.graphManagerState.graph.dependencyManager.root,
338
+ this.editorStore.graphManagerState.graph.dependencyManager.roots,
338
339
  ExplorerTreeRootPackageLabel.PROJECT_DEPENDENCY,
339
340
  );
340
341
  }
@@ -404,7 +405,7 @@ export class ExplorerTreeState {
404
405
  }
405
406
  // File generation tree
406
407
  // TODO: fix this so it does proper reprocessing, right now it just rebuilds
407
- this.fileGenerationTreeData = getGenerationTreeData(
408
+ this.fileGenerationTreeData = getFileSystemTreeData(
408
409
  this.editorStore.graphState.graphGenerationState.rootFileDirectory,
409
410
  ExplorerTreeRootPackageLabel.FILE_GENERATION,
410
411
  );
@@ -445,7 +446,12 @@ export class ExplorerTreeState {
445
446
  if (node.childrenIds?.length) {
446
447
  node.isOpen = !node.isOpen;
447
448
  if (node.packageableElement instanceof Package) {
448
- populatePackageTreeNodeChildren(this.editorStore, node, treeData);
449
+ populatePackageTreeNodeChildren(
450
+ this.editorStore,
451
+ node,
452
+ treeData,
453
+ rootPackageName === ROOT_PACKAGE_NAME.PROJECT_DEPENDENCY_ROOT,
454
+ );
449
455
  }
450
456
  }
451
457
  this.setSelectedNode(node);
@@ -503,13 +509,15 @@ export class ExplorerTreeState {
503
509
  this.setSelectedNode(openingNode);
504
510
  opened = true;
505
511
  } else if (
506
- rootPackageName === ROOT_PACKAGE_NAME.PROJECT_DEPENDENCY_ROOT &&
512
+ isDependencyElement(element, this.editorStore.graphManagerState.graph) &&
507
513
  this.dependencyTreeData
508
514
  ) {
509
515
  const openingNode = openNode(
510
516
  this.editorStore,
511
517
  element,
512
518
  this.dependencyTreeData,
519
+ undefined,
520
+ true,
513
521
  );
514
522
  this.setSelectedNode(openingNode);
515
523
  opened = true;
@@ -522,7 +530,7 @@ export class ExplorerTreeState {
522
530
  }
523
531
  }
524
532
 
525
- getFileGenerationTreeData(): TreeData<GenerationTreeNodeData> {
533
+ getFileGenerationTreeData(): TreeData<FileSystemTreeNodeData> {
526
534
  return guaranteeNonNullable(
527
535
  this.fileGenerationTreeData,
528
536
  'File generation tree data has not been initialized',
@@ -406,8 +406,6 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
406
406
  return new NewPureModelConnectionDriver(this.editorStore);
407
407
  } else if (store instanceof FlatData) {
408
408
  return new NewFlatDataConnectionDriver(this.editorStore);
409
- } else if (store instanceof Database) {
410
- return new NewRelationalDatabaseConnectionDriver(this.editorStore);
411
409
  }
412
410
  const extraNewConnectionDriverCreators = this.editorStore.pluginManager
413
411
  .getApplicationPlugins()
@@ -24,6 +24,7 @@ import {
24
24
  import { flow, action, makeObservable, observable } from 'mobx';
25
25
  import type { EditorStore } from '../EditorStore.js';
26
26
  import { LEGEND_STUDIO_APP_EVENT } from '../LegendStudioAppEvent.js';
27
+ import { ElementXTSchemaGenerationState } from './element-editor-state/ElementExternalFormatGenerationState.js';
27
28
 
28
29
  export type ExternalFormatTypeOption = {
29
30
  value: string;
@@ -41,10 +42,12 @@ export class ExternalFormatState {
41
42
  fetchingDescriptionsState = ActionState.create();
42
43
  editorStore: EditorStore;
43
44
  externalFormatsDescriptions: ExternalFormatDescription[] = [];
45
+ schemaGenerationStates: ElementXTSchemaGenerationState[] = [];
44
46
 
45
47
  constructor(editorStore: EditorStore) {
46
48
  makeObservable<ExternalFormatState>(this, {
47
49
  externalFormatsDescriptions: observable,
50
+ schemaGenerationStates: observable,
48
51
  setExternalFormatsDescriptions: action,
49
52
  fetchExternalFormatsDescriptions: flow,
50
53
  });
@@ -92,6 +95,12 @@ export class ExternalFormatState {
92
95
  const externalFormatDescriptions =
93
96
  (yield this.editorStore.graphManagerState.graphManager.getAvailableExternalFormatsDescriptions()) as ExternalFormatDescription[];
94
97
  this.setExternalFormatsDescriptions(externalFormatDescriptions);
98
+ this.schemaGenerationStates = externalFormatDescriptions
99
+ .filter((s) => s.supportsSchemaGeneration)
100
+ .map(
101
+ (descr) =>
102
+ new ElementXTSchemaGenerationState(this.editorStore, descr),
103
+ );
95
104
  this.fetchingDescriptionsState.complete();
96
105
  } catch (error) {
97
106
  assertErrorThrown(error);