@finos/legend-application-studio 22.6.0 → 23.0.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 (450) hide show
  1. package/lib/application/LegendStudio.d.ts.map +1 -1
  2. package/lib/application/LegendStudio.js +8 -5
  3. package/lib/application/LegendStudio.js.map +1 -1
  4. package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
  5. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  6. package/lib/application/LegendStudioApplicationConfig.js +7 -1
  7. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  8. package/lib/application/LegendStudioApplicationNavigationContext.d.ts.map +1 -0
  9. package/lib/application/LegendStudioApplicationNavigationContext.js.map +1 -0
  10. package/lib/application/LegendStudioCommand.d.ts.map +1 -0
  11. package/lib/application/LegendStudioCommand.js.map +1 -0
  12. package/lib/application/LegendStudioDocumentation.d.ts.map +1 -0
  13. package/lib/application/LegendStudioDocumentation.js.map +1 -0
  14. package/lib/{stores/LegendStudioAppEvent.d.ts → application/LegendStudioEvent.d.ts} +1 -1
  15. package/lib/application/LegendStudioEvent.d.ts.map +1 -0
  16. package/lib/{stores/LegendStudioAppEvent.js → application/LegendStudioEvent.js} +1 -1
  17. package/lib/application/LegendStudioEvent.js.map +1 -0
  18. package/{src/stores/LegendStudioStorage.ts → lib/application/LegendStudioEventHelper.d.ts} +4 -4
  19. package/lib/application/LegendStudioEventHelper.d.ts.map +1 -0
  20. package/lib/{stores/LegendStudioEventService.d.ts → application/LegendStudioEventHelper.js} +6 -7
  21. package/lib/application/LegendStudioEventHelper.js.map +1 -0
  22. package/lib/{stores/LegendStudioRouter.d.ts → application/LegendStudioNavigation.d.ts} +24 -24
  23. package/lib/application/LegendStudioNavigation.d.ts.map +1 -0
  24. package/lib/{stores/LegendStudioRouter.js → application/LegendStudioNavigation.js} +28 -28
  25. package/lib/application/LegendStudioNavigation.js.map +1 -0
  26. package/lib/{stores/LegendStudioStorage.d.ts → application/LegendStudioSetting.d.ts} +4 -2
  27. package/lib/application/LegendStudioSetting.d.ts.map +1 -0
  28. package/lib/{stores/LegendStudioEventService.js → application/LegendStudioSetting.js} +14 -14
  29. package/lib/application/LegendStudioSetting.js.map +1 -0
  30. package/lib/{stores/LegendStudioTelemetry.d.ts → application/LegendStudioTelemetryHelper.d.ts} +8 -8
  31. package/lib/application/LegendStudioTelemetryHelper.d.ts.map +1 -0
  32. package/lib/application/LegendStudioTelemetryHelper.js +37 -0
  33. package/lib/application/LegendStudioTelemetryHelper.js.map +1 -0
  34. package/lib/components/Core_LegendStudioApplicationPlugin.d.ts +2 -1
  35. package/lib/components/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  36. package/lib/components/Core_LegendStudioApplicationPlugin.js +11 -6
  37. package/lib/components/Core_LegendStudioApplicationPlugin.js.map +1 -1
  38. package/lib/components/EditorComponentTestUtils.d.ts.map +1 -1
  39. package/lib/components/EditorComponentTestUtils.js +4 -5
  40. package/lib/components/EditorComponentTestUtils.js.map +1 -1
  41. package/lib/components/EmbeddedQueryBuilder.js +1 -1
  42. package/lib/components/EmbeddedQueryBuilder.js.map +1 -1
  43. package/lib/components/LegendStudioAppInfo.d.ts.map +1 -1
  44. package/lib/components/LegendStudioAppInfo.js +0 -1
  45. package/lib/components/LegendStudioAppInfo.js.map +1 -1
  46. package/lib/components/LegendStudioApplication.d.ts +0 -2
  47. package/lib/components/LegendStudioApplication.d.ts.map +1 -1
  48. package/lib/components/LegendStudioApplication.js +8 -8
  49. package/lib/components/LegendStudioApplication.js.map +1 -1
  50. package/lib/components/editor/ActivityBar.js +6 -6
  51. package/lib/components/editor/ActivityBar.js.map +1 -1
  52. package/lib/components/editor/Editor.d.ts.map +1 -1
  53. package/lib/components/editor/Editor.js +6 -2
  54. package/lib/components/editor/Editor.js.map +1 -1
  55. package/lib/components/editor/EditorStoreProvider.d.ts.map +1 -1
  56. package/lib/components/editor/EditorStoreProvider.js +1 -3
  57. package/lib/components/editor/EditorStoreProvider.js.map +1 -1
  58. package/lib/components/editor/StatusBar.d.ts.map +1 -1
  59. package/lib/components/editor/StatusBar.js +5 -8
  60. package/lib/components/editor/StatusBar.js.map +1 -1
  61. package/lib/components/editor/aux-panel/DevTool.js +2 -2
  62. package/lib/components/editor/aux-panel/DevTool.js.map +1 -1
  63. package/lib/components/editor/aux-panel/Problems.d.ts.map +1 -1
  64. package/lib/components/editor/aux-panel/Problems.js +4 -10
  65. package/lib/components/editor/aux-panel/Problems.js.map +1 -1
  66. package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
  67. package/lib/components/editor/command-center/ProjectSearchCommand.js +1 -1
  68. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  69. package/lib/components/editor/edit-panel/FileGenerationViewer.js +1 -1
  70. package/lib/components/editor/edit-panel/FileGenerationViewer.js.map +1 -1
  71. package/lib/components/editor/edit-panel/FunctionEditor.js +3 -3
  72. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  73. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +2 -2
  74. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
  75. package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
  76. package/lib/components/editor/edit-panel/GrammarTextEditor.js +8 -7
  77. package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
  78. package/lib/components/editor/edit-panel/ModelImporter.js +1 -1
  79. package/lib/components/editor/edit-panel/ModelImporter.js.map +1 -1
  80. package/lib/components/editor/edit-panel/RuntimeEditor.js +3 -3
  81. package/lib/components/editor/edit-panel/RuntimeEditor.js.map +1 -1
  82. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js +1 -1
  83. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js.map +1 -1
  84. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js +1 -1
  85. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js.map +1 -1
  86. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js +1 -1
  87. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js.map +1 -1
  88. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js +1 -1
  89. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js.map +1 -1
  90. package/lib/components/editor/edit-panel/diff-editor/EntityDiffView.js +1 -1
  91. package/lib/components/editor/edit-panel/diff-editor/EntityDiffView.js.map +1 -1
  92. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.d.ts.map +1 -1
  93. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js +1 -1
  94. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js.map +1 -1
  95. package/lib/components/editor/edit-panel/mapping-editor/MappingEditor.js +1 -1
  96. package/lib/components/editor/edit-panel/mapping-editor/MappingEditor.js.map +1 -1
  97. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  98. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js +1 -3
  99. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  100. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.d.ts.map +1 -1
  101. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js +3 -2
  102. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js.map +1 -1
  103. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js +1 -1
  104. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js.map +1 -1
  105. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.d.ts.map +1 -1
  106. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js +1 -3
  107. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js.map +1 -1
  108. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js +1 -1
  109. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js.map +1 -1
  110. package/lib/components/editor/edit-panel/mapping-editor/PropertyMappingsEditor.js +1 -1
  111. package/lib/components/editor/edit-panel/mapping-editor/PropertyMappingsEditor.js.map +1 -1
  112. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.js +2 -2
  113. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.js.map +1 -1
  114. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js +2 -2
  115. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  116. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js +2 -2
  117. package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js.map +1 -1
  118. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +2 -2
  119. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  120. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  121. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +0 -2
  122. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  123. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +1 -1
  124. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  125. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -2
  126. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  127. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +8 -8
  128. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  129. package/lib/components/editor/edit-panel/uml-editor/ClassQueryBuilder.d.ts.map +1 -1
  130. package/lib/components/editor/edit-panel/uml-editor/ClassQueryBuilder.js +1 -3
  131. package/lib/components/editor/edit-panel/uml-editor/ClassQueryBuilder.js.map +1 -1
  132. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js +2 -2
  133. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js.map +1 -1
  134. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js +1 -1
  135. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js.map +1 -1
  136. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +1 -1
  137. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  138. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +1 -1
  139. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  140. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  141. package/lib/components/editor/side-bar/CreateNewElementModal.js +4 -0
  142. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  143. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  144. package/lib/components/editor/side-bar/Explorer.js +18 -10
  145. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  146. package/lib/components/editor/side-bar/LocalChanges.d.ts.map +1 -1
  147. package/lib/components/editor/side-bar/LocalChanges.js +4 -3
  148. package/lib/components/editor/side-bar/LocalChanges.js.map +1 -1
  149. package/lib/components/editor/side-bar/ProjectDependantsEditor.js +1 -1
  150. package/lib/components/editor/side-bar/ProjectDependantsEditor.js.map +1 -1
  151. package/lib/components/editor/side-bar/ProjectOverview.js +1 -1
  152. package/lib/components/editor/side-bar/ProjectOverview.js.map +1 -1
  153. package/lib/components/editor/side-bar/WorkspaceReview.js +1 -1
  154. package/lib/components/editor/side-bar/WorkspaceReview.js.map +1 -1
  155. package/lib/components/editor/side-bar/WorkspaceUpdater.js +1 -1
  156. package/lib/components/editor/side-bar/WorkspaceUpdater.js.map +1 -1
  157. package/lib/components/project-viewer/ProjectViewer.d.ts.map +1 -1
  158. package/lib/components/project-viewer/ProjectViewer.js +7 -4
  159. package/lib/components/project-viewer/ProjectViewer.js.map +1 -1
  160. package/lib/components/shared/ProjectSelectorUtils.js +1 -1
  161. package/lib/components/shared/ProjectSelectorUtils.js.map +1 -1
  162. package/lib/components/workspace-review/WorkspaceReview.js +1 -1
  163. package/lib/components/workspace-review/WorkspaceReview.js.map +1 -1
  164. package/lib/components/workspace-setup/CreateProjectModal.js +2 -2
  165. package/lib/components/workspace-setup/CreateProjectModal.js.map +1 -1
  166. package/lib/components/workspace-setup/CreateWorkspaceModal.js +1 -1
  167. package/lib/components/workspace-setup/CreateWorkspaceModal.js.map +1 -1
  168. package/lib/components/workspace-setup/WorkspaceSetup.js +6 -6
  169. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  170. package/lib/index.css +2 -2
  171. package/lib/index.css.map +1 -1
  172. package/lib/index.d.ts +6 -5
  173. package/lib/index.d.ts.map +1 -1
  174. package/lib/index.js +5 -5
  175. package/lib/index.js.map +1 -1
  176. package/lib/package.json +4 -4
  177. package/lib/stores/{LegendStudioCodeSnippets.d.ts → Core_CodeSnippets.d.ts} +1 -1
  178. package/lib/stores/Core_CodeSnippets.d.ts.map +1 -0
  179. package/lib/stores/{LegendStudioCodeSnippets.js → Core_CodeSnippets.js} +1 -1
  180. package/lib/stores/Core_CodeSnippets.js.map +1 -0
  181. package/lib/stores/DependencyProjectViewerHelper.js +1 -1
  182. package/lib/stores/DependencyProjectViewerHelper.js.map +1 -1
  183. package/lib/stores/EditorGraphState.d.ts +10 -71
  184. package/lib/stores/EditorGraphState.d.ts.map +1 -1
  185. package/lib/stores/EditorGraphState.js +46 -540
  186. package/lib/stores/EditorGraphState.js.map +1 -1
  187. package/lib/stores/EditorSDLCState.js +1 -1
  188. package/lib/stores/EditorSDLCState.js.map +1 -1
  189. package/lib/stores/EditorStore.d.ts +11 -16
  190. package/lib/stores/EditorStore.d.ts.map +1 -1
  191. package/lib/stores/EditorStore.js +73 -215
  192. package/lib/stores/EditorStore.js.map +1 -1
  193. package/lib/stores/EditorStoreTestUtils.d.ts.map +1 -1
  194. package/lib/stores/EditorStoreTestUtils.js +1 -2
  195. package/lib/stores/EditorStoreTestUtils.js.map +1 -1
  196. package/lib/stores/EditorTabManagerState.d.ts +2 -1
  197. package/lib/stores/EditorTabManagerState.d.ts.map +1 -1
  198. package/lib/stores/EditorTabManagerState.js +63 -19
  199. package/lib/stores/EditorTabManagerState.js.map +1 -1
  200. package/lib/stores/EmbeddedQueryBuilderState.d.ts +0 -1
  201. package/lib/stores/EmbeddedQueryBuilderState.d.ts.map +1 -1
  202. package/lib/stores/EmbeddedQueryBuilderState.js +10 -9
  203. package/lib/stores/EmbeddedQueryBuilderState.js.map +1 -1
  204. package/lib/stores/ExplorerTreeState.d.ts.map +1 -1
  205. package/lib/stores/ExplorerTreeState.js +2 -2
  206. package/lib/stores/ExplorerTreeState.js.map +1 -1
  207. package/lib/stores/GraphEditFormModeState.d.ts +81 -0
  208. package/lib/stores/GraphEditFormModeState.d.ts.map +1 -0
  209. package/lib/stores/GraphEditFormModeState.js +370 -0
  210. package/lib/stores/GraphEditFormModeState.js.map +1 -0
  211. package/lib/stores/GraphEditGrammarModeState.d.ts +65 -0
  212. package/lib/stores/GraphEditGrammarModeState.d.ts.map +1 -0
  213. package/lib/stores/GraphEditGrammarModeState.js +315 -0
  214. package/lib/stores/GraphEditGrammarModeState.js.map +1 -0
  215. package/lib/stores/GraphEditorMode.d.ts +51 -0
  216. package/lib/stores/GraphEditorMode.d.ts.map +1 -0
  217. package/lib/stores/GraphEditorMode.js +35 -0
  218. package/lib/stores/GraphEditorMode.js.map +1 -0
  219. package/lib/stores/LegendStudioApplicationPlugin.d.ts +12 -5
  220. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  221. package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
  222. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  223. package/lib/stores/LegendStudioBaseStore.js +25 -9
  224. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  225. package/lib/stores/editor/NewElementState.d.ts +2 -2
  226. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  227. package/lib/stores/editor/NewElementState.js +19 -10
  228. package/lib/stores/editor/NewElementState.js.map +1 -1
  229. package/lib/stores/editor/StandardEditorMode.js +1 -1
  230. package/lib/stores/editor/StandardEditorMode.js.map +1 -1
  231. package/lib/stores/editor-state/ExternalFormatState.js +1 -1
  232. package/lib/stores/editor-state/ExternalFormatState.js.map +1 -1
  233. package/lib/stores/editor-state/FileGenerationState.js +1 -1
  234. package/lib/stores/editor-state/FileGenerationState.js.map +1 -1
  235. package/lib/stores/editor-state/GrammarTextEditorState.d.ts.map +1 -1
  236. package/lib/stores/editor-state/GrammarTextEditorState.js +2 -2
  237. package/lib/stores/editor-state/GrammarTextEditorState.js.map +1 -1
  238. package/lib/stores/editor-state/GraphGenerationState.d.ts.map +1 -1
  239. package/lib/stores/editor-state/GraphGenerationState.js +2 -2
  240. package/lib/stores/editor-state/GraphGenerationState.js.map +1 -1
  241. package/lib/stores/editor-state/ModelImporterState.js +1 -1
  242. package/lib/stores/editor-state/ModelImporterState.js.map +1 -1
  243. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js +1 -1
  244. package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js.map +1 -1
  245. package/lib/stores/editor-state/element-editor-state/ElementFileGenerationState.d.ts.map +1 -1
  246. package/lib/stores/editor-state/element-editor-state/ElementFileGenerationState.js +1 -1
  247. package/lib/stores/editor-state/element-editor-state/ElementFileGenerationState.js.map +1 -1
  248. package/lib/stores/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  249. package/lib/stores/editor-state/element-editor-state/connection/DatabaseBuilderState.js +6 -3
  250. package/lib/stores/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  251. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js +1 -1
  252. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js.map +1 -1
  253. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
  254. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
  255. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  256. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.d.ts +1 -1
  257. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.d.ts.map +1 -1
  258. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js +1 -1
  259. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js.map +1 -1
  260. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  261. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +8 -15
  262. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  263. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.d.ts.map +1 -1
  264. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js +6 -11
  265. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js.map +1 -1
  266. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  267. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +7 -14
  268. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  269. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js +1 -1
  270. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  271. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +3 -3
  272. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  273. package/lib/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.js +1 -1
  274. package/lib/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.js.map +1 -1
  275. package/lib/stores/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +1 -1
  276. package/lib/stores/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
  277. package/lib/stores/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js +1 -1
  278. package/lib/stores/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js.map +1 -1
  279. package/lib/stores/project-viewer/ProjectViewerEditorMode.js +1 -1
  280. package/lib/stores/project-viewer/ProjectViewerEditorMode.js.map +1 -1
  281. package/lib/stores/project-viewer/ProjectViewerStore.d.ts +1 -1
  282. package/lib/stores/project-viewer/ProjectViewerStore.d.ts.map +1 -1
  283. package/lib/stores/project-viewer/ProjectViewerStore.js +9 -15
  284. package/lib/stores/project-viewer/ProjectViewerStore.js.map +1 -1
  285. package/lib/stores/sidebar-state/BulkServiceRegistrationState.js +1 -1
  286. package/lib/stores/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  287. package/lib/stores/sidebar-state/LocalChangesState.d.ts +6 -3
  288. package/lib/stores/sidebar-state/LocalChangesState.d.ts.map +1 -1
  289. package/lib/stores/sidebar-state/LocalChangesState.js +45 -12
  290. package/lib/stores/sidebar-state/LocalChangesState.js.map +1 -1
  291. package/lib/stores/sidebar-state/ProjectOverviewState.js +2 -2
  292. package/lib/stores/sidebar-state/ProjectOverviewState.js.map +1 -1
  293. package/lib/stores/sidebar-state/WorkflowManagerState.js +1 -1
  294. package/lib/stores/sidebar-state/WorkflowManagerState.js.map +1 -1
  295. package/lib/stores/sidebar-state/WorkspaceReviewState.js +2 -2
  296. package/lib/stores/sidebar-state/WorkspaceReviewState.js.map +1 -1
  297. package/lib/stores/sidebar-state/WorkspaceSyncState.d.ts.map +1 -1
  298. package/lib/stores/sidebar-state/WorkspaceSyncState.js +2 -2
  299. package/lib/stores/sidebar-state/WorkspaceSyncState.js.map +1 -1
  300. package/lib/stores/sidebar-state/WorkspaceUpdateConflictResolutionState.js +2 -2
  301. package/lib/stores/sidebar-state/WorkspaceUpdateConflictResolutionState.js.map +1 -1
  302. package/lib/stores/sidebar-state/WorkspaceUpdaterState.js +1 -1
  303. package/lib/stores/sidebar-state/WorkspaceUpdaterState.js.map +1 -1
  304. package/lib/stores/workspace-review/WorkspaceReviewStore.js +1 -1
  305. package/lib/stores/workspace-review/WorkspaceReviewStore.js.map +1 -1
  306. package/lib/stores/workspace-setup/WorkspaceSetupStore.js +2 -2
  307. package/lib/stores/workspace-setup/WorkspaceSetupStore.js.map +1 -1
  308. package/package.json +13 -13
  309. package/src/application/LegendStudio.tsx +8 -7
  310. package/src/application/LegendStudioApplicationConfig.ts +7 -0
  311. package/src/{stores/LegendStudioEventService.ts → application/LegendStudioEventHelper.ts} +3 -13
  312. package/src/{stores/LegendStudioRouter.ts → application/LegendStudioNavigation.ts} +40 -39
  313. package/{lib/stores/LegendStudioStorage.js → src/application/LegendStudioSetting.ts} +16 -6
  314. package/src/{stores/LegendStudioTelemetry.ts → application/LegendStudioTelemetryHelper.ts} +14 -26
  315. package/src/components/Core_LegendStudioApplicationPlugin.tsx +14 -5
  316. package/src/components/EditorComponentTestUtils.tsx +8 -14
  317. package/src/components/EmbeddedQueryBuilder.tsx +1 -1
  318. package/src/components/LegendStudioAppInfo.tsx +0 -1
  319. package/src/components/LegendStudioApplication.tsx +24 -21
  320. package/src/components/editor/ActivityBar.tsx +6 -6
  321. package/src/components/editor/Editor.tsx +10 -6
  322. package/src/components/editor/EditorStoreProvider.tsx +1 -8
  323. package/src/components/editor/StatusBar.tsx +10 -9
  324. package/src/components/editor/aux-panel/DevTool.tsx +3 -3
  325. package/src/components/editor/aux-panel/Problems.tsx +5 -10
  326. package/src/components/editor/command-center/ProjectSearchCommand.tsx +1 -4
  327. package/src/components/editor/edit-panel/FileGenerationViewer.tsx +1 -1
  328. package/src/components/editor/edit-panel/FunctionEditor.tsx +3 -3
  329. package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +2 -2
  330. package/src/components/editor/edit-panel/GrammarTextEditor.tsx +13 -8
  331. package/src/components/editor/edit-panel/ModelImporter.tsx +1 -1
  332. package/src/components/editor/edit-panel/RuntimeEditor.tsx +3 -3
  333. package/src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx +1 -1
  334. package/src/components/editor/edit-panel/connection-editor/DatabaseBuilder.tsx +1 -1
  335. package/src/components/editor/edit-panel/data-editor/DataElementEditor.tsx +1 -1
  336. package/src/components/editor/edit-panel/data-editor/EmbeddedDataEditor.tsx +1 -1
  337. package/src/components/editor/edit-panel/diff-editor/EntityDiffView.tsx +1 -1
  338. package/src/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx +0 -1
  339. package/src/components/editor/edit-panel/mapping-editor/MappingEditor.tsx +1 -1
  340. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.tsx +1 -4
  341. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.tsx +3 -2
  342. package/src/components/editor/edit-panel/mapping-editor/MappingExplorer.tsx +1 -1
  343. package/src/components/editor/edit-panel/mapping-editor/MappingTestEditor.tsx +1 -4
  344. package/src/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.tsx +1 -1
  345. package/src/components/editor/edit-panel/mapping-editor/PropertyMappingsEditor.tsx +1 -1
  346. package/src/components/editor/edit-panel/project-configuration-editor/ProjectConfigurationEditor.tsx +3 -3
  347. package/src/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.tsx +2 -2
  348. package/src/components/editor/edit-panel/service-editor/ServiceEditor.tsx +2 -2
  349. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +2 -2
  350. package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +0 -3
  351. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +1 -1
  352. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +2 -2
  353. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +8 -8
  354. package/src/components/editor/edit-panel/uml-editor/ClassQueryBuilder.tsx +3 -4
  355. package/src/components/editor/edit-panel/uml-editor/EnumerationEditor.tsx +2 -2
  356. package/src/components/editor/edit-panel/uml-editor/ProfileEditor.tsx +1 -1
  357. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +1 -1
  358. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +1 -1
  359. package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -0
  360. package/src/components/editor/side-bar/Explorer.tsx +25 -15
  361. package/src/components/editor/side-bar/LocalChanges.tsx +4 -8
  362. package/src/components/editor/side-bar/ProjectDependantsEditor.tsx +1 -1
  363. package/src/components/editor/side-bar/ProjectOverview.tsx +1 -1
  364. package/src/components/editor/side-bar/WorkspaceReview.tsx +1 -1
  365. package/src/components/editor/side-bar/WorkspaceUpdater.tsx +1 -1
  366. package/src/components/project-viewer/ProjectViewer.tsx +8 -5
  367. package/src/components/shared/ProjectSelectorUtils.tsx +1 -1
  368. package/src/components/workspace-review/WorkspaceReview.tsx +1 -1
  369. package/src/components/workspace-setup/CreateProjectModal.tsx +2 -2
  370. package/src/components/workspace-setup/CreateWorkspaceModal.tsx +1 -1
  371. package/src/components/workspace-setup/WorkspaceSetup.tsx +7 -7
  372. package/src/index.ts +9 -5
  373. package/src/stores/DependencyProjectViewerHelper.ts +1 -1
  374. package/src/stores/EditorGraphState.ts +49 -798
  375. package/src/stores/EditorSDLCState.ts +1 -1
  376. package/src/stores/EditorStore.ts +98 -323
  377. package/src/stores/EditorStoreTestUtils.ts +0 -2
  378. package/src/stores/EditorTabManagerState.ts +90 -25
  379. package/src/stores/EmbeddedQueryBuilderState.ts +11 -11
  380. package/src/stores/ExplorerTreeState.ts +2 -4
  381. package/src/stores/GraphEditFormModeState.ts +605 -0
  382. package/src/stores/GraphEditGrammarModeState.ts +512 -0
  383. package/src/stores/GraphEditorMode.ts +77 -0
  384. package/src/stores/LegendStudioApplicationPlugin.ts +14 -4
  385. package/src/stores/LegendStudioBaseStore.ts +35 -11
  386. package/src/stores/editor/NewElementState.ts +36 -20
  387. package/src/stores/editor/StandardEditorMode.ts +1 -1
  388. package/src/stores/editor-state/ExternalFormatState.ts +1 -1
  389. package/src/stores/editor-state/FileGenerationState.ts +1 -1
  390. package/src/stores/editor-state/GrammarTextEditorState.ts +4 -5
  391. package/src/stores/editor-state/GraphGenerationState.ts +6 -2
  392. package/src/stores/editor-state/ModelImporterState.ts +1 -1
  393. package/src/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.ts +1 -1
  394. package/src/stores/editor-state/element-editor-state/ElementFileGenerationState.ts +5 -1
  395. package/src/stores/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +12 -5
  396. package/src/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts +1 -1
  397. package/src/stores/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -3
  398. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.ts +1 -1
  399. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +12 -21
  400. package/src/stores/editor-state/element-editor-state/mapping/MappingTestState.ts +6 -15
  401. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +7 -20
  402. package/src/stores/editor-state/element-editor-state/service/ServiceRegistrationState.ts +1 -1
  403. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +3 -3
  404. package/src/stores/editor-state/entity-diff-editor-state/EntityDiffViewState.ts +1 -1
  405. package/src/stores/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +1 -1
  406. package/src/stores/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts +1 -1
  407. package/src/stores/project-viewer/ProjectViewerEditorMode.ts +1 -1
  408. package/src/stores/project-viewer/ProjectViewerStore.ts +14 -25
  409. package/src/stores/sidebar-state/BulkServiceRegistrationState.ts +1 -1
  410. package/src/stores/sidebar-state/LocalChangesState.ts +57 -16
  411. package/src/stores/sidebar-state/ProjectOverviewState.ts +2 -2
  412. package/src/stores/sidebar-state/WorkflowManagerState.ts +1 -1
  413. package/src/stores/sidebar-state/WorkspaceReviewState.ts +2 -2
  414. package/src/stores/sidebar-state/WorkspaceSyncState.ts +3 -2
  415. package/src/stores/sidebar-state/WorkspaceUpdateConflictResolutionState.ts +2 -2
  416. package/src/stores/sidebar-state/WorkspaceUpdaterState.ts +1 -1
  417. package/src/stores/workspace-review/WorkspaceReviewStore.ts +1 -1
  418. package/src/stores/workspace-setup/WorkspaceSetupStore.ts +2 -2
  419. package/tsconfig.json +13 -11
  420. package/tsconfig.package.json +1 -2
  421. package/lib/stores/LegendStudioAppEvent.d.ts.map +0 -1
  422. package/lib/stores/LegendStudioAppEvent.js.map +0 -1
  423. package/lib/stores/LegendStudioApplicationNavigationContext.d.ts.map +0 -1
  424. package/lib/stores/LegendStudioApplicationNavigationContext.js.map +0 -1
  425. package/lib/stores/LegendStudioCodeSnippets.d.ts.map +0 -1
  426. package/lib/stores/LegendStudioCodeSnippets.js.map +0 -1
  427. package/lib/stores/LegendStudioCommand.d.ts.map +0 -1
  428. package/lib/stores/LegendStudioCommand.js.map +0 -1
  429. package/lib/stores/LegendStudioDocumentation.d.ts.map +0 -1
  430. package/lib/stores/LegendStudioDocumentation.js.map +0 -1
  431. package/lib/stores/LegendStudioEventService.d.ts.map +0 -1
  432. package/lib/stores/LegendStudioEventService.js.map +0 -1
  433. package/lib/stores/LegendStudioRouter.d.ts.map +0 -1
  434. package/lib/stores/LegendStudioRouter.js.map +0 -1
  435. package/lib/stores/LegendStudioStorage.d.ts.map +0 -1
  436. package/lib/stores/LegendStudioStorage.js.map +0 -1
  437. package/lib/stores/LegendStudioTelemetry.d.ts.map +0 -1
  438. package/lib/stores/LegendStudioTelemetry.js +0 -37
  439. package/lib/stores/LegendStudioTelemetry.js.map +0 -1
  440. /package/lib/{stores → application}/LegendStudioApplicationNavigationContext.d.ts +0 -0
  441. /package/lib/{stores → application}/LegendStudioApplicationNavigationContext.js +0 -0
  442. /package/lib/{stores → application}/LegendStudioCommand.d.ts +0 -0
  443. /package/lib/{stores → application}/LegendStudioCommand.js +0 -0
  444. /package/lib/{stores → application}/LegendStudioDocumentation.d.ts +0 -0
  445. /package/lib/{stores → application}/LegendStudioDocumentation.js +0 -0
  446. /package/src/{stores → application}/LegendStudioApplicationNavigationContext.ts +0 -0
  447. /package/src/{stores → application}/LegendStudioCommand.ts +0 -0
  448. /package/src/{stores → application}/LegendStudioDocumentation.ts +0 -0
  449. /package/src/{stores/LegendStudioAppEvent.ts → application/LegendStudioEvent.ts} +0 -0
  450. /package/src/stores/{LegendStudioCodeSnippets.ts → Core_CodeSnippets.ts} +0 -0
@@ -22,13 +22,11 @@ import {
22
22
  makeObservable,
23
23
  observable,
24
24
  } from 'mobx';
25
- import { CHANGE_DETECTION_EVENT } from './ChangeDetectionEvent.js';
26
- import { GRAPH_EDITOR_MODE, AUX_PANEL_MODE } from './EditorConfig.js';
25
+ import { GRAPH_EDITOR_MODE } from './EditorConfig.js';
27
26
  import {
28
27
  type GeneratorFn,
29
28
  type PlainObject,
30
29
  LogEvent,
31
- assertType,
32
30
  UnsupportedOperationError,
33
31
  assertErrorThrown,
34
32
  assertTrue,
@@ -52,7 +50,6 @@ import {
52
50
  import {
53
51
  type EntityChange,
54
52
  type ProjectDependency,
55
- EntityChangeType,
56
53
  ProjectConfiguration,
57
54
  applyEntityChanges,
58
55
  } from '@finos/legend-server-sdlc';
@@ -66,9 +63,7 @@ import {
66
63
  } from '@finos/legend-server-depot';
67
64
  import {
68
65
  GRAPH_MANAGER_EVENT,
69
- CompilationError,
70
- EngineError,
71
- extractSourceInformationCoordinates,
66
+ type EngineError,
72
67
  Package,
73
68
  Profile,
74
69
  PrimitiveType,
@@ -89,30 +84,20 @@ import {
89
84
  SectionIndex,
90
85
  DependencyGraphBuilderError,
91
86
  GraphDataDeserializationError,
92
- GraphBuilderError,
93
87
  DataElement,
94
88
  type PackageableElement,
95
89
  type CompilationWarning,
96
- type TextCompilationResult,
97
- type CompilationResult,
98
90
  type PureModel,
99
91
  createGraphBuilderReport,
100
- reportGraphAnalytics,
101
92
  } from '@finos/legend-graph';
102
93
  import {
103
- ActionAlertActionType,
104
- ActionAlertType,
105
- ApplicationTelemetry,
94
+ LegendApplicationTelemetryHelper,
106
95
  type TabState,
107
96
  } from '@finos/legend-application';
108
97
  import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
109
- import { graph_dispose } from './shared/modifier/GraphModifierHelper.js';
110
98
  import { PACKAGEABLE_ELEMENT_TYPE } from './shared/ModelClassifierUtils.js';
111
- import { GlobalTestRunnerState } from './sidebar-state/testable/GlobalTestRunnerState.js';
112
- import { LEGEND_STUDIO_APP_EVENT } from './LegendStudioAppEvent.js';
113
- import { ExplorerTreeState } from './ExplorerTreeState.js';
114
- import { LegendStudioTelemetry } from './LegendStudioTelemetry.js';
115
- import { LEGEND_STUDIO_SETTINGS_KEY } from './LegendStudioStorage.js';
99
+ import { LEGEND_STUDIO_APP_EVENT } from '../application/LegendStudioEvent.js';
100
+ import { LEGEND_STUDIO_SETTING_KEY } from '../application/LegendStudioSetting.js';
116
101
 
117
102
  export enum GraphBuilderStatus {
118
103
  SUCCEEDED = 'SUCCEEDED',
@@ -120,12 +105,10 @@ export enum GraphBuilderStatus {
120
105
  REDIRECTED_TO_TEXT_MODE = 'REDIRECTED_TO_TEXT_MODE',
121
106
  }
122
107
 
123
- export enum FormModeCompilationOutcome {
108
+ export enum GraphCompilationOutcome {
124
109
  SKIPPED = 'SKIPPED',
125
110
  SUCCEEDED = 'SUCCEEDED',
126
111
  FAILED = 'FAILED',
127
- FAILED_WITH_ERROR_REVEALED = 'FAILED_WITH_ERROR_REVEALED',
128
- FAILED_AND_FALLBACK_TO_TEXT_MODE = 'FAILED_AND_FALLBACK_TO_TEXTMODE',
129
112
  }
130
113
 
131
114
  export interface GraphBuilderResult {
@@ -142,49 +125,39 @@ export class EditorGraphState {
142
125
  isInitializingGraph = false;
143
126
  isRunningGlobalCompile = false;
144
127
  isRunningGlobalGenerate = false;
145
- isApplicationLeavingTextMode = false;
128
+ isApplicationLeavingGraphEditMode = false;
146
129
  isUpdatingGraph = false; // critical synchronous update to refresh the graph
147
130
  isUpdatingApplication = false; // including graph update and async operations such as change detection
148
131
 
149
132
  warnings: CompilationWarning[] = [];
150
133
  error: EngineError | undefined;
151
- private mostRecentTextModeCompilationGraphHash: string | undefined;
152
- private mostRecentFormModeCompilationGraphHash: string | undefined;
134
+ compilationResultEntities: Entity[] = [];
153
135
 
154
136
  enableStrictMode: boolean;
137
+ mostRecentCompilationGraphHash: string | undefined = undefined;
138
+ mostRecentCompilationOutcome: GraphCompilationOutcome | undefined = undefined;
155
139
 
156
140
  constructor(editorStore: EditorStore) {
157
- makeObservable<
158
- EditorGraphState,
159
- | 'updateGraphAndApplicationInFormMode'
160
- | 'updateGraphAndApplicationInTextMode'
161
- | 'mostRecentFormModeCompilationGraphHash'
162
- | 'mostRecentTextModeCompilationGraphHash'
163
- | 'rebuildDependencies'
164
- >(this, {
141
+ makeObservable(this, {
165
142
  isInitializingGraph: observable,
166
143
  isRunningGlobalCompile: observable,
167
144
  isRunningGlobalGenerate: observable,
168
- isApplicationLeavingTextMode: observable,
145
+ isApplicationLeavingGraphEditMode: observable,
169
146
  isUpdatingGraph: observable,
170
147
  isUpdatingApplication: observable,
148
+ mostRecentCompilationGraphHash: observable,
149
+ mostRecentCompilationOutcome: observable,
171
150
  warnings: observable,
172
151
  error: observable,
173
- mostRecentFormModeCompilationGraphHash: observable,
174
- mostRecentTextModeCompilationGraphHash: observable,
175
152
  enableStrictMode: observable,
176
153
  problems: computed,
177
154
  areProblemsStale: computed,
178
155
  isApplicationUpdateOperationIsRunning: computed,
179
156
  clearProblems: action,
180
157
  setEnableStrictMode: action,
158
+ setMostRecentCompilationGraphHash: action,
181
159
  buildGraph: flow,
182
160
  loadEntityChangesToGraph: flow,
183
- globalCompileInFormMode: flow,
184
- globalCompileInTextMode: flow,
185
- leaveTextMode: flow,
186
- updateGraphAndApplicationInFormMode: flow,
187
- updateGraphAndApplicationInTextMode: flow,
188
161
  updateGenerationGraphAndApplication: flow,
189
162
  rebuildDependencies: flow,
190
163
  });
@@ -192,10 +165,9 @@ export class EditorGraphState {
192
165
  this.editorStore = editorStore;
193
166
  this.graphGenerationState = new GraphGenerationState(this.editorStore);
194
167
  this.enableStrictMode =
195
- this.editorStore.applicationStore.storageService.settingsStore.getBooleanValue(
196
- LEGEND_STUDIO_SETTINGS_KEY.EDITOR_STRICT_MODE,
197
- false,
198
- );
168
+ this.editorStore.applicationStore.settingService.getBooleanValue(
169
+ LEGEND_STUDIO_SETTING_KEY.EDITOR_STRICT_MODE,
170
+ ) ?? false;
199
171
  }
200
172
 
201
173
  get problems(): Problem[] {
@@ -224,14 +196,20 @@ export class EditorGraphState {
224
196
  });
225
197
  }
226
198
 
199
+ setMostRecentCompilationGraphHash(val: string | undefined): void {
200
+ this.mostRecentCompilationGraphHash = val;
201
+ }
202
+
203
+ setMostRecentCompilationOutcome(
204
+ val: GraphCompilationOutcome | undefined,
205
+ ): void {
206
+ this.mostRecentCompilationOutcome = val;
207
+ }
208
+
227
209
  get areProblemsStale(): boolean {
228
210
  return (
229
- (this.editorStore.isInFormMode &&
230
- this.mostRecentFormModeCompilationGraphHash !==
231
- this.editorStore.changeDetectionState.currentGraphHash) ||
232
- (this.editorStore.isInGrammarTextMode &&
233
- this.mostRecentTextModeCompilationGraphHash !==
234
- this.editorStore.grammarTextEditorState.currentTextGraphHash)
211
+ this.mostRecentCompilationGraphHash !==
212
+ this.editorStore.graphEditorMode.getCurrentGraphHash()
235
213
  );
236
214
  }
237
215
 
@@ -239,7 +217,7 @@ export class EditorGraphState {
239
217
  return (
240
218
  this.isRunningGlobalCompile ||
241
219
  this.isRunningGlobalGenerate ||
242
- this.isApplicationLeavingTextMode ||
220
+ this.isApplicationLeavingGraphEditMode ||
243
221
  this.isUpdatingApplication ||
244
222
  this.isInitializingGraph
245
223
  );
@@ -258,9 +236,9 @@ export class EditorGraphState {
258
236
  );
259
237
  return true;
260
238
  }
261
- if (this.isApplicationLeavingTextMode) {
239
+ if (this.isApplicationLeavingGraphEditMode) {
262
240
  this.editorStore.applicationStore.notificationService.notifyWarning(
263
- 'Please wait for editor to leave text mode completely',
241
+ 'Please wait for editor to leave edit mode completely',
264
242
  );
265
243
  return true;
266
244
  }
@@ -279,57 +257,12 @@ export class EditorGraphState {
279
257
  return false;
280
258
  }
281
259
 
282
- /**
283
- * Get entitiy changes to prepare for syncing
284
- */
285
- computeLocalEntityChanges(): EntityChange[] {
286
- const baseHashesIndex = this.editorStore.isInConflictResolutionMode
287
- ? this.editorStore.changeDetectionState
288
- .conflictResolutionHeadRevisionState.entityHashesIndex
289
- : this.editorStore.changeDetectionState.workspaceLocalLatestRevisionState
290
- .entityHashesIndex;
291
- const originalPaths = new Set(Array.from(baseHashesIndex.keys()));
292
- const entityChanges: EntityChange[] = [];
293
- this.editorStore.graphManagerState.graph.allOwnElements.forEach(
294
- (element) => {
295
- const elementPath = element.path;
296
- if (baseHashesIndex.get(elementPath) !== element.hashCode) {
297
- const entity =
298
- this.editorStore.graphManagerState.graphManager.elementToEntity(
299
- element,
300
- {
301
- pruneSourceInformation: true,
302
- },
303
- );
304
- entityChanges.push({
305
- classifierPath: entity.classifierPath,
306
- entityPath: element.path,
307
- content: entity.content,
308
- type:
309
- baseHashesIndex.get(elementPath) !== undefined
310
- ? EntityChangeType.MODIFY
311
- : EntityChangeType.CREATE,
312
- });
313
- }
314
- originalPaths.delete(elementPath);
315
- },
316
- );
317
- Array.from(originalPaths).forEach((path) => {
318
- entityChanges.push({
319
- type: EntityChangeType.DELETE,
320
- entityPath: path,
321
- });
322
- });
323
- return entityChanges;
324
- }
325
-
326
260
  clearProblems(): void {
327
261
  this.error = undefined;
328
262
  this.editorStore.tabManagerState.tabs
329
263
  .filter(filterByType(ElementEditorState))
330
264
  .forEach((editorState) => editorState.clearCompilationError());
331
- this.mostRecentFormModeCompilationGraphHash = undefined;
332
- this.mostRecentTextModeCompilationGraphHash = undefined;
265
+ this.mostRecentCompilationGraphHash = undefined;
333
266
  this.warnings = [];
334
267
  }
335
268
 
@@ -415,7 +348,7 @@ export class EditorGraphState {
415
348
  generations: generation_buildReport,
416
349
  generationsCount: this.graphGenerationState.generatedEntities.size,
417
350
  };
418
- ApplicationTelemetry.logEvent_GraphInitializationSucceeded(
351
+ LegendApplicationTelemetryHelper.logEvent_GraphInitializationSucceeded(
419
352
  this.editorStore.applicationStore.telemetryService,
420
353
  graphBuilderReportData,
421
354
  );
@@ -468,14 +401,10 @@ export class EditorGraphState {
468
401
  `Can't build graph. Redirected to text mode for debugging. Error: ${error.message}`,
469
402
  );
470
403
  try {
471
- const editorGrammar =
472
- (yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
473
- entities,
474
- )) as string;
475
404
  yield flowResult(
476
- this.editorStore.grammarTextEditorState.setGraphGrammarText(
477
- editorGrammar,
478
- ),
405
+ this.editorStore.switchModes(GRAPH_EDITOR_MODE.GRAMMAR_TEXT, {
406
+ isGraphBuildFailure: true,
407
+ }),
479
408
  );
480
409
  } catch (error2) {
481
410
  assertErrorThrown(error2);
@@ -491,16 +420,13 @@ export class EditorGraphState {
491
420
  error: error2,
492
421
  };
493
422
  }
423
+ if (error2 instanceof Error) {
424
+ return {
425
+ status: GraphBuilderStatus.FAILED,
426
+ error: error2,
427
+ };
428
+ }
494
429
  }
495
- yield flowResult(
496
- this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.GRAMMAR_TEXT),
497
- );
498
- yield flowResult(
499
- this.globalCompileInTextMode({
500
- ignoreBlocking: true,
501
- suppressCompilationFailureMessage: true,
502
- }),
503
- );
504
430
  return {
505
431
  status: GraphBuilderStatus.REDIRECTED_TO_TEXT_MODE,
506
432
  error,
@@ -546,7 +472,7 @@ export class EditorGraphState {
546
472
  ): GeneratorFn<void> {
547
473
  try {
548
474
  assertTrue(
549
- this.editorStore.isInFormMode,
475
+ this.editorStore.graphEditorMode.mode === GRAPH_EDITOR_MODE.FORM,
550
476
  `Can't apply entity changes: operation only supported in form mode`,
551
477
  );
552
478
  const entities =
@@ -558,7 +484,9 @@ export class EditorGraphState {
558
484
  );
559
485
  const modifiedEntities = applyEntityChanges(entities, changes);
560
486
  yield flowResult(
561
- this.updateGraphAndApplicationInFormMode(modifiedEntities),
487
+ this.editorStore.graphEditorMode.updateGraphAndApplication(
488
+ modifiedEntities,
489
+ ),
562
490
  );
563
491
  } catch (error) {
564
492
  assertErrorThrown(error);
@@ -568,411 +496,13 @@ export class EditorGraphState {
568
496
  }
569
497
  }
570
498
 
571
- // TODO: when we support showing multiple notifications, we can take this options out as the only users of this
572
- // is delete element flow, where we want to say `re-compiling graph after deletion`, but because sometimes, compilation
573
- // is so fast, the message flashes, so we want to combine with the message in this method
574
- *globalCompileInFormMode(options?: {
575
- message?: string;
576
- disableNotificationOnSuccess?: boolean;
577
- openConsole?: boolean;
578
- }): GeneratorFn<FormModeCompilationOutcome> {
579
- assertTrue(
580
- this.editorStore.isInFormMode,
581
- 'Editor must be in form mode to call this method',
582
- );
583
-
584
- if (this.checkIfApplicationUpdateOperationIsRunning()) {
585
- return FormModeCompilationOutcome.SKIPPED;
586
- }
587
-
588
- const stopWatch = new StopWatch();
589
- const report = reportGraphAnalytics(
590
- this.editorStore.graphManagerState.graph,
591
- );
592
- LegendStudioTelemetry.logEvent_GraphCompilationLaunched(
593
- this.editorStore.applicationStore.telemetryService,
594
- );
595
-
596
- const currentGraphHash =
597
- this.editorStore.changeDetectionState.currentGraphHash;
598
-
599
- try {
600
- this.isRunningGlobalCompile = true;
601
- this.clearProblems();
602
- if (options?.openConsole) {
603
- this.editorStore.setActiveAuxPanelMode(AUX_PANEL_MODE.CONSOLE);
604
- }
605
-
606
- // NOTE: here we always keep the source information while compiling in form mode
607
- // so that the form parts where the user interacted with (i.e. where the lamdbas source
608
- // information are populated), can reveal compilation error. If compilation errors
609
- // show up in other parts, the user will get redirected to text-mode
610
- const compilationResult =
611
- (yield this.editorStore.graphManagerState.graphManager.compileGraph(
612
- this.editorStore.graphManagerState.graph,
613
- {
614
- keepSourceInformation: true,
615
- },
616
- report,
617
- )) as CompilationResult;
618
-
619
- this.warnings = compilationResult.warnings
620
- ? this.TEMPORARY__removeDependencyProblems(compilationResult.warnings)
621
- : [];
622
-
623
- this.mostRecentFormModeCompilationGraphHash = currentGraphHash;
624
-
625
- if (!options?.disableNotificationOnSuccess) {
626
- if (this.warnings.length) {
627
- this.editorStore.applicationStore.notificationService.notifyWarning(
628
- `Compilation suceeded with warnings`,
629
- );
630
- } else {
631
- if (!options?.disableNotificationOnSuccess) {
632
- this.editorStore.applicationStore.notificationService.notifySuccess(
633
- 'Compiled successfully',
634
- );
635
- }
636
- }
637
- }
638
-
639
- report.timings =
640
- this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
641
- stopWatch,
642
- report.timings,
643
- );
644
- LegendStudioTelemetry.logEvent_GraphCompilationSucceeded(
645
- this.editorStore.applicationStore.telemetryService,
646
- report,
647
- );
648
-
649
- return FormModeCompilationOutcome.SUCCEEDED;
650
- } catch (error) {
651
- assertErrorThrown(error);
652
- // TODO: we probably should make this pattern of error the handling for all other exceptions in the codebase
653
- // i.e. there should be a catch-all handler (we can use if-else construct to check error types)
654
- assertType(error, EngineError, `Unhandled exception:\n${error}`);
655
- this.editorStore.applicationStore.logService.error(
656
- LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
657
- error,
658
- );
659
- this.mostRecentFormModeCompilationGraphHash = currentGraphHash;
660
- let fallbackToTextModeForDebugging = true;
661
- // if compilation failed, we try to reveal the error in form mode,
662
- // if even this fail, we will fall back to show it in text mode
663
- if (error instanceof CompilationError) {
664
- const errorCoordinates = extractSourceInformationCoordinates(
665
- error.sourceInformation,
666
- );
667
- if (errorCoordinates) {
668
- const element =
669
- this.editorStore.graphManagerState.graph.getNullableElement(
670
- guaranteeNonNullable(
671
- errorCoordinates[0],
672
- `Can't reveal compilation error: element path is missing`,
673
- ),
674
- false,
675
- );
676
- if (element) {
677
- this.editorStore.tabManagerState.openElementEditor(element);
678
- if (
679
- this.editorStore.tabManagerState.currentTab instanceof
680
- ElementEditorState
681
- ) {
682
- // check if we can reveal the error in the element editor state
683
- fallbackToTextModeForDebugging =
684
- !this.editorStore.tabManagerState.currentTab.revealCompilationError(
685
- error,
686
- );
687
- }
688
- }
689
- }
690
- }
691
-
692
- // decide if we need to fall back to text mode for debugging
693
- if (fallbackToTextModeForDebugging) {
694
- // TODO: when we support showing multiple notifications, we can split this into 2
695
- this.editorStore.applicationStore.notificationService.notifyWarning(
696
- options?.message ??
697
- 'Compilation failed and error cannot be located in form mode. Redirected to text mode for debugging.',
698
- );
699
- try {
700
- const code =
701
- (yield this.editorStore.graphManagerState.graphManager.graphToPureCode(
702
- this.editorStore.graphManagerState.graph,
703
- )) as string;
704
- this.editorStore.grammarTextEditorState.setGraphGrammarText(code);
705
- } catch (error2) {
706
- assertErrorThrown(error2);
707
- this.editorStore.applicationStore.notificationService.notifyWarning(
708
- `Can't enter text mode. Transformation to grammar text failed: ${error2.message}`,
709
- );
710
- return FormModeCompilationOutcome.FAILED;
711
- }
712
- yield flowResult(
713
- this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.GRAMMAR_TEXT),
714
- );
715
- yield flowResult(
716
- this.globalCompileInTextMode({
717
- ignoreBlocking: true,
718
- suppressCompilationFailureMessage: true,
719
- disableNotificationOnSuccess: options?.disableNotificationOnSuccess,
720
- }),
721
- );
722
- return FormModeCompilationOutcome.FAILED_AND_FALLBACK_TO_TEXT_MODE;
723
- } else {
724
- this.error = error;
725
- this.editorStore.applicationStore.notificationService.notifyWarning(
726
- `Compilation failed: ${error.message}`,
727
- );
728
- return FormModeCompilationOutcome.FAILED_WITH_ERROR_REVEALED;
729
- }
730
- } finally {
731
- this.isRunningGlobalCompile = false;
732
- }
733
- }
734
-
735
- // TODO: when we support showing multiple notifications, we can take this `suppressCompilationFailureMessage` out as
736
- // we can show the transition between form mode and text mode warning and the compilation failure warning at the same time
737
- *globalCompileInTextMode(options?: {
738
- ignoreBlocking?: boolean | undefined;
739
- suppressCompilationFailureMessage?: boolean | undefined;
740
- disableNotificationOnSuccess?: boolean | undefined;
741
- openConsole?: boolean;
742
- }): GeneratorFn<void> {
743
- assertTrue(
744
- this.editorStore.isInGrammarTextMode,
745
- 'Editor must be in text mode to call this method',
746
- );
747
-
748
- if (
749
- !options?.ignoreBlocking &&
750
- this.checkIfApplicationUpdateOperationIsRunning()
751
- ) {
752
- return;
753
- }
754
-
755
- const stopWatch = new StopWatch();
756
- const report = reportGraphAnalytics(
757
- this.editorStore.graphManagerState.graph,
758
- );
759
- LegendStudioTelemetry.logEvent_TextCompilationLaunched(
760
- this.editorStore.applicationStore.telemetryService,
761
- );
762
-
763
- const currentGraphHash =
764
- this.editorStore.grammarTextEditorState.currentTextGraphHash;
765
-
766
- try {
767
- this.isRunningGlobalCompile = true;
768
- this.clearProblems();
769
- if (options?.openConsole) {
770
- this.editorStore.setActiveAuxPanelMode(AUX_PANEL_MODE.CONSOLE);
771
- }
772
-
773
- const compilationResult =
774
- (yield this.editorStore.graphManagerState.graphManager.compileText(
775
- this.editorStore.grammarTextEditorState.graphGrammarText,
776
- this.editorStore.graphManagerState.graph,
777
- {},
778
- report,
779
- )) as TextCompilationResult;
780
-
781
- const entities = compilationResult.entities;
782
- this.mostRecentTextModeCompilationGraphHash = currentGraphHash;
783
- this.warnings = compilationResult.warnings
784
- ? this.TEMPORARY__removeDependencyProblems(compilationResult.warnings)
785
- : [];
786
-
787
- if (!options?.disableNotificationOnSuccess) {
788
- if (this.warnings.length) {
789
- this.editorStore.applicationStore.notificationService.notifyWarning(
790
- `Compilation suceeded with warnings`,
791
- );
792
- } else {
793
- if (!options?.disableNotificationOnSuccess) {
794
- this.editorStore.applicationStore.notificationService.notifySuccess(
795
- 'Compiled successfully',
796
- );
797
- }
798
- }
799
- }
800
-
801
- stopWatch.record();
802
- yield flowResult(this.updateGraphAndApplicationInTextMode(entities));
803
- stopWatch.record(GRAPH_MANAGER_EVENT.UPDATE_AND_REBUILD_GRAPH__SUCCESS);
804
-
805
- // Remove `SectionIndex when computing changes in text mode as engine after
806
- // transforming grammarToJson would return `SectionIndex` which is not
807
- // required to do change detection.
808
- yield flowResult(
809
- this.editorStore.changeDetectionState.computeLocalChangesInTextMode(
810
- this.editorStore.graphManagerState.graphManager.getElementEntities(
811
- entities,
812
- ),
813
- ),
814
- );
815
-
816
- report.timings =
817
- this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
818
- stopWatch,
819
- report.timings,
820
- );
821
- LegendStudioTelemetry.logEvent_TextCompilationSucceeded(
822
- this.editorStore.applicationStore.telemetryService,
823
- report,
824
- );
825
- } catch (error) {
826
- assertErrorThrown(error);
827
- this.mostRecentTextModeCompilationGraphHash = currentGraphHash;
828
- if (error instanceof EngineError) {
829
- this.error = error;
830
- if (error.sourceInformation) {
831
- this.editorStore.grammarTextEditorState.setForcedCursorPosition({
832
- lineNumber: error.sourceInformation.startLine,
833
- column: error.sourceInformation.startColumn,
834
- });
835
- }
836
- }
837
- if (
838
- !this.editorStore.applicationStore.notificationService.notification ||
839
- !options?.suppressCompilationFailureMessage
840
- ) {
841
- this.editorStore.applicationStore.notificationService.notifyWarning(
842
- `Compilation failed: ${error.message}`,
843
- );
844
- }
845
- } finally {
846
- this.isRunningGlobalCompile = false;
847
- }
848
- }
849
-
850
- *leaveTextMode(): GeneratorFn<void> {
851
- assertTrue(
852
- this.editorStore.isInGrammarTextMode,
853
- 'Editor must be in text mode to call this method',
854
- );
855
- if (this.checkIfApplicationUpdateOperationIsRunning()) {
856
- return;
857
- }
858
- try {
859
- this.isApplicationLeavingTextMode = true;
860
- this.clearProblems();
861
- this.editorStore.applicationStore.alertService.setBlockingAlert({
862
- message: 'Compiling graph before leaving text mode...',
863
- showLoading: true,
864
- });
865
- try {
866
- const compilationResult =
867
- (yield this.editorStore.graphManagerState.graphManager.compileText(
868
- this.editorStore.grammarTextEditorState.graphGrammarText,
869
- this.editorStore.graphManagerState.graph,
870
- // surpress the modal to reveal error properly in the text editor
871
- // if the blocking modal is not dismissed, the edior will not be able to gain focus as modal has a focus trap
872
- // therefore, the editor will not be able to get the focus
873
- {
874
- onError: () =>
875
- this.editorStore.applicationStore.alertService.setBlockingAlert(
876
- undefined,
877
- ),
878
- },
879
- )) as TextCompilationResult;
880
-
881
- this.warnings = compilationResult.warnings
882
- ? this.TEMPORARY__removeDependencyProblems(compilationResult.warnings)
883
- : [];
884
- this.editorStore.applicationStore.alertService.setBlockingAlert({
885
- message: 'Leaving text mode and rebuilding graph...',
886
- showLoading: true,
887
- });
888
- yield flowResult(
889
- this.updateGraphAndApplicationInFormMode(compilationResult.entities),
890
- );
891
- this.mostRecentFormModeCompilationGraphHash =
892
- this.editorStore.changeDetectionState.getCurrentGraphHash();
893
- this.editorStore.grammarTextEditorState.setGraphGrammarText('');
894
- this.editorStore.grammarTextEditorState.resetCurrentElementLabelRegexString();
895
- yield flowResult(
896
- this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.FORM),
897
- );
898
- if (this.editorStore.tabManagerState.currentTab) {
899
- this.editorStore.tabManagerState.openTab(
900
- this.editorStore.tabManagerState.currentTab,
901
- );
902
- }
903
- } catch (error) {
904
- assertErrorThrown(error);
905
- this.mostRecentFormModeCompilationGraphHash =
906
- this.editorStore.changeDetectionState.getCurrentGraphHash();
907
- if (error instanceof EngineError && error.sourceInformation) {
908
- this.editorStore.grammarTextEditorState.setForcedCursorPosition({
909
- lineNumber: error.sourceInformation.startLine,
910
- column: error.sourceInformation.startColumn,
911
- });
912
- }
913
- this.editorStore.applicationStore.logService.error(
914
- LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
915
- 'Compilation failed:',
916
- error,
917
- );
918
- if (this.editorStore.graphManagerState.graphBuildState.hasFailed) {
919
- // TODO: when we support showing multiple notification, we can split this into 2 messages
920
- this.editorStore.applicationStore.notificationService.notifyWarning(
921
- `Can't build graph, please resolve compilation error before leaving text mode. Compilation failed with error: ${error.message}`,
922
- );
923
- } else {
924
- this.editorStore.applicationStore.notificationService.notifyWarning(
925
- `Compilation failed: ${error.message}`,
926
- );
927
- this.editorStore.applicationStore.alertService.setActionAlertInfo({
928
- message: 'Project is not in a compiled state',
929
- prompt:
930
- 'All changes made since the last time the graph was built successfully will be lost',
931
- type: ActionAlertType.CAUTION,
932
- actions: [
933
- {
934
- label: 'Discard Changes',
935
- handler: () => {
936
- flowResult(
937
- this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.FORM),
938
- ).catch(
939
- this.editorStore.applicationStore.alertUnhandledError,
940
- );
941
- },
942
- type: ActionAlertActionType.PROCEED_WITH_CAUTION,
943
- },
944
- {
945
- label: 'Stay',
946
- default: true,
947
- type: ActionAlertActionType.PROCEED,
948
- },
949
- ],
950
- });
951
- }
952
- }
953
- } catch (error) {
954
- assertErrorThrown(error);
955
- this.editorStore.applicationStore.logService.error(
956
- LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
957
- error,
958
- );
959
- } finally {
960
- this.isApplicationLeavingTextMode = false;
961
- this.editorStore.applicationStore.alertService.setBlockingAlert(
962
- undefined,
963
- );
964
- this.editorStore.changeDetectionState.workspaceLocalLatestRevisionState.currentEntityHashesIndex =
965
- new Map<string, string>();
966
- }
967
- }
968
-
969
499
  /**
970
500
  * NOTE: this can post memory-leak issue if we start having immutable elements referencing current graph elements:
971
501
  * e.g. subclass analytics on the immutable class, etc.
972
502
  *
973
503
  * @risk memory-leak
974
504
  */
975
- private *rebuildDependencies(newGraph: PureModel): GeneratorFn<void> {
505
+ *rebuildDependencies(newGraph: PureModel): GeneratorFn<void> {
976
506
  if (
977
507
  this.editorStore.graphManagerState.dependenciesBuildState.hasSucceeded
978
508
  ) {
@@ -1009,285 +539,6 @@ export class EditorGraphState {
1009
539
  }
1010
540
  }
1011
541
 
1012
- /**
1013
- * Creates a new explorer tree state when compiling in text mode. It resets the explorer state properly
1014
- * after the new graph is built. It tries to maintain the explorer state similar to what it was before compilation.
1015
- * To achieve that we store node ids of the opened nodes before creating a new explorer state. After creating a
1016
- * new state we open the nodes which were opened before so that user see the same explorer state as before.
1017
- */
1018
- reprocessExplorerTreeInTextMode(): void {
1019
- const mainTreeOpenedNodeIds = this.editorStore.explorerTreeState.treeData
1020
- ? Array.from(this.editorStore.explorerTreeState.treeData.nodes.values())
1021
- .filter((node) => node.isOpen)
1022
- .map((node) => node.id)
1023
- : [];
1024
- const generationTreeOpenedNodeIds = this.editorStore.explorerTreeState
1025
- .generationTreeData
1026
- ? Array.from(
1027
- this.editorStore.explorerTreeState.generationTreeData.nodes.values(),
1028
- )
1029
- .filter((node) => node.isOpen)
1030
- .map((node) => node.id)
1031
- : [];
1032
- // Storing dependencyTree, filegenerationTree, systemTree as is as they don't
1033
- // hold any reference to actual graph
1034
- const systemTreeData = this.editorStore.explorerTreeState.systemTreeData;
1035
- const dependencyTreeData =
1036
- this.editorStore.explorerTreeState.dependencyTreeData;
1037
- const selectedNodeId = this.editorStore.explorerTreeState.selectedNode?.id;
1038
- this.editorStore.explorerTreeState = new ExplorerTreeState(
1039
- this.editorStore,
1040
- );
1041
- this.editorStore.explorerTreeState.systemTreeData = systemTreeData;
1042
- this.editorStore.explorerTreeState.dependencyTreeData = dependencyTreeData;
1043
- this.editorStore.explorerTreeState.buildTreeInTextMode();
1044
- this.editorStore.explorerTreeState.openExplorerTreeNodes(
1045
- mainTreeOpenedNodeIds,
1046
- generationTreeOpenedNodeIds,
1047
- selectedNodeId,
1048
- );
1049
- }
1050
-
1051
- /**
1052
- * NOTE: IMPORTANT! This method is both a savior and a sinner. It helps reprocessing the graph state to use a new graph
1053
- * built from the new model context data, it resets the graph properly. The bane here is that resetting the graph properly is
1054
- * not trivial, for example, in the cleanup phase, there are things we want to re-use, such as the one-time processed system
1055
- * metamodels or the `reusable` metamodels from project dependencies. There are also explorer states like the package tree,
1056
- * opened tabs, change detection, etc. to take care of. There are a lot of potential pitfalls. For these, we will add the
1057
- * marker:
1058
- *
1059
- * @risk memory-leak
1060
- *
1061
- * to indicate we should check carefully these pieces when we detect memory issue as it might still
1062
- * be referring to the old graph
1063
- *
1064
- * In the past, we have found that there are a few potential root causes for memory leak:
1065
- * 1. State management Mobx allows references, as such, it is sometimes hard to trace down which references can cause problem
1066
- * We have to understand that the behind this updater is very simple (replace), yet to do it cleanly is not easy, since
1067
- * so far it is tempting to refer to elements in the graph from various editor state. On top of that, change detection
1068
- * sometimes obfuscate the investigation but we have cleared it out with explicit disposing of reaction
1069
- * 2. Reusable models, at this point in time, we haven't completed stabilize the logic for handling generated models, as well
1070
- * as dependencies, we intended to save computation time by reusing these while updating the graph. This can pose potential
1071
- * danger as well. Beware the way when we start to make system/project dependencies references elements of current graph
1072
- * e.g. when we have a computed value in a immutable class that get all subclasses, etc.
1073
- * 3. We reprocess editor states to ensure good UX, e.g. find tabs to keep open, find tree nodes to expand, etc.
1074
- * after updating the graph. These in our experience is the **MOST COMMON** source of memory leak. It is actually
1075
- * quite predictable since structures like tabs and tree node embeds graph data, which are references to the old graph
1076
- *
1077
- * NOTE: One big obfuscating factor is overlapping graph refresh. Sometimes, we observed that calling this update graph
1078
- * method multiple times can throws Mobx off and causes reusing change detection state to cause memory-leak. As such,
1079
- * we have blocked the possibility of calling compilation/graph-update/generation simultaneously
1080
- *
1081
- * A note on how to debug memory-leak issue:
1082
- * 1. Open browser Memory monitor
1083
- * 2. Go to text mode and compile multiple times (triggering graph update)
1084
- * 3. Try to force garbage collection, if we see memory goes up after while, it's pretty clear that this is memory-leak
1085
- * (note that since we disallow stacking multiple compilation and graph update, we have simplify the detection a lot)
1086
- * See https://auth0.com/blog/four-types-of-leaks-in-your-javascript-code-and-how-to-get-rid-of-them/
1087
- */
1088
- private *updateGraphAndApplicationInFormMode(
1089
- entities: Entity[],
1090
- ): GeneratorFn<void> {
1091
- const startTime = Date.now();
1092
- this.isUpdatingApplication = true;
1093
- this.isUpdatingGraph = true;
1094
- try {
1095
- const newGraph = this.editorStore.graphManagerState.createEmptyGraph();
1096
- yield flowResult(this.rebuildDependencies(newGraph));
1097
-
1098
- /**
1099
- * Backup and editor states info before resetting. Here we store the element paths of the
1100
- * elements editors as element paths don't refer to the actual graph. We can find the element
1101
- * from the new graph that is built by using element path and can reprocess the element editor states.
1102
- * The other kind of editors we reprocess are file generation editors, we store them as is as they don't
1103
- * hold any reference to the actual graph.
1104
- */
1105
- const openedTabPaths: string[] = [];
1106
- this.editorStore.tabManagerState.tabs.forEach((state: TabState) => {
1107
- if (state instanceof ElementEditorState) {
1108
- openedTabPaths.push(state.elementPath);
1109
- }
1110
- });
1111
- // Only stores editor state for file generation editors as they don't hold any references to the
1112
- // actual graph.
1113
- const currentTabState =
1114
- this.editorStore.tabManagerState.currentTab instanceof
1115
- ElementEditorState
1116
- ? undefined
1117
- : this.editorStore.tabManagerState.currentTab;
1118
- const currentTabElementPath =
1119
- this.editorStore.tabManagerState.currentTab instanceof
1120
- ElementEditorState
1121
- ? this.editorStore.tabManagerState.currentTab.elementPath
1122
- : undefined;
1123
- /**
1124
- * We remove the current editor state so that we no longer let React displays the element that belongs to the old graph
1125
- * NOTE: this causes an UI flash, but this is in many way, acceptable since the user probably should know that we are
1126
- * refreshing the memory graph anyway.
1127
- *
1128
- * If this is really bothering, we can handle it by building mocked replica of the current editor state using stub element
1129
- * e.g. if the current editor is a class, we stub the class, create a new class editor state around it and copy over
1130
- * navigation information, etc.
1131
- */
1132
- this.editorStore.tabManagerState.closeAllTabs();
1133
-
1134
- this.editorStore.changeDetectionState.stop(); // stop change detection before disposing hash
1135
-
1136
- yield flowResult(graph_dispose(this.editorStore.graphManagerState.graph));
1137
-
1138
- const graphBuildState = ActionState.create();
1139
- yield this.editorStore.graphManagerState.graphManager.buildGraph(
1140
- newGraph,
1141
- entities,
1142
- graphBuildState,
1143
- {
1144
- TEMPORARY__preserveSectionIndex:
1145
- this.editorStore.applicationStore.config.options
1146
- .TEMPORARY__preserveSectionIndex,
1147
- strict: this.enableStrictMode,
1148
- },
1149
- );
1150
-
1151
- // Activity States
1152
- this.editorStore.globalTestRunnerState = new GlobalTestRunnerState(
1153
- this.editorStore,
1154
- this.editorStore.sdlcState,
1155
- );
1156
-
1157
- // NOTE: build model generation entities every-time we rebuild the graph - should we do this?
1158
- const generationsBuildState = ActionState.create();
1159
- yield this.editorStore.graphManagerState.graphManager.buildGenerations(
1160
- newGraph,
1161
- this.graphGenerationState.generatedEntities,
1162
- generationsBuildState,
1163
- );
1164
-
1165
- this.editorStore.graphManagerState.graph = newGraph;
1166
- // NOTE: here we don't want to modify the current graph build state directly
1167
- // instead, we quietly run this in the background and then sync it with the current build state
1168
- this.editorStore.graphManagerState.graphBuildState.sync(graphBuildState);
1169
- this.editorStore.graphManagerState.generationsBuildState.sync(
1170
- generationsBuildState,
1171
- );
1172
-
1173
- this.editorStore.explorerTreeState.reprocess();
1174
-
1175
- /**
1176
- * Re-build the editor states which were opened before from the information we have stored before
1177
- * creating the new graph
1178
- */
1179
- this.editorStore.tabManagerState.recoverTabs(
1180
- openedTabPaths,
1181
- currentTabState,
1182
- currentTabElementPath,
1183
- );
1184
-
1185
- this.editorStore.applicationStore.logService.info(
1186
- LogEvent.create(GRAPH_MANAGER_EVENT.UPDATE_AND_REBUILD_GRAPH__SUCCESS),
1187
- '[TOTAL]',
1188
- Date.now() - startTime,
1189
- 'ms',
1190
- );
1191
- this.isUpdatingGraph = false;
1192
-
1193
- // ======= (RE)START CHANGE DETECTION =======
1194
-
1195
- yield flowResult(this.editorStore.changeDetectionState.observeGraph());
1196
- yield this.editorStore.changeDetectionState.preComputeGraphElementHashes();
1197
- this.editorStore.changeDetectionState.start();
1198
- this.editorStore.applicationStore.logService.info(
1199
- LogEvent.create(
1200
- CHANGE_DETECTION_EVENT.CHANGE_DETECTION_RESTART__SUCCESS,
1201
- ),
1202
- '[ASYNC]',
1203
- );
1204
-
1205
- // ======= FINISHED (RE)START CHANGE DETECTION =======
1206
- } catch (error) {
1207
- assertErrorThrown(error);
1208
- this.editorStore.applicationStore.logService.error(
1209
- LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
1210
- error,
1211
- );
1212
- this.editorStore.changeDetectionState.stop(true); // force stop change detection
1213
- this.isUpdatingGraph = false;
1214
- // Note: in the future this function will probably be ideal to refactor when we have different classes for each mode
1215
- // as we would handle this error differently in `text` mode and `form` mode.
1216
- if (error instanceof GraphBuilderError) {
1217
- this.editorStore.applicationStore.alertService.setBlockingAlert({
1218
- message: `Can't build graph: ${error.message}`,
1219
- prompt: 'Refreshing full application...',
1220
- showLoading: true,
1221
- });
1222
- this.editorStore.tabManagerState.closeAllTabs();
1223
- this.editorStore.cleanUp();
1224
- yield flowResult(this.editorStore.buildGraph(entities));
1225
- }
1226
- } finally {
1227
- this.isUpdatingApplication = false;
1228
- this.editorStore.applicationStore.alertService.setBlockingAlert(
1229
- undefined,
1230
- );
1231
- }
1232
- }
1233
-
1234
- private *updateGraphAndApplicationInTextMode(
1235
- entities: Entity[],
1236
- ): GeneratorFn<void> {
1237
- const startTime = Date.now();
1238
- this.isUpdatingApplication = true;
1239
- this.isUpdatingGraph = true;
1240
- try {
1241
- const newGraph = this.editorStore.graphManagerState.createEmptyGraph();
1242
- yield flowResult(this.rebuildDependencies(newGraph));
1243
- yield flowResult(graph_dispose(this.editorStore.graphManagerState.graph));
1244
-
1245
- const graphBuildState = ActionState.create();
1246
- yield this.editorStore.graphManagerState.graphManager.buildLightGraph(
1247
- newGraph,
1248
- entities,
1249
- graphBuildState,
1250
- {
1251
- TEMPORARY__preserveSectionIndex:
1252
- this.editorStore.applicationStore.config.options
1253
- .TEMPORARY__preserveSectionIndex,
1254
- strict: this.enableStrictMode,
1255
- },
1256
- );
1257
-
1258
- this.editorStore.graphManagerState.graph = newGraph;
1259
- // NOTE: here we don't want to modify the current graph build state directly
1260
- // instead, we quietly run this in the background and then sync it with the current build state
1261
- this.editorStore.graphManagerState.graphBuildState.sync(graphBuildState);
1262
- this.reprocessExplorerTreeInTextMode();
1263
-
1264
- this.editorStore.applicationStore.logService.info(
1265
- LogEvent.create(GRAPH_MANAGER_EVENT.UPDATE_AND_REBUILD_GRAPH__SUCCESS),
1266
- '[TOTAL]',
1267
- Date.now() - startTime,
1268
- 'ms',
1269
- );
1270
- this.isUpdatingGraph = false;
1271
- } catch (error) {
1272
- assertErrorThrown(error);
1273
- this.editorStore.applicationStore.logService.error(
1274
- LogEvent.create(GRAPH_MANAGER_EVENT.GRAPH_BUILDER_FAILURE),
1275
- error,
1276
- );
1277
- this.isUpdatingGraph = false;
1278
- if (error instanceof GraphBuilderError) {
1279
- this.editorStore.applicationStore.notificationService.notifyError(
1280
- `Can't build graph: ${error.message}`,
1281
- );
1282
- }
1283
- } finally {
1284
- this.isUpdatingApplication = false;
1285
- this.editorStore.applicationStore.alertService.setBlockingAlert(
1286
- undefined,
1287
- );
1288
- }
1289
- }
1290
-
1291
542
  /**
1292
543
  * Used to update generation model and generation graph using the generated entities
1293
544
  * does not alter the main or dependency model