@finos/legend-application-studio 26.1.1 → 26.1.3

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 (188) hide show
  1. package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts +2 -1
  2. package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioApplicationNavigationContext.js +1 -0
  4. package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
  5. package/lib/__lib__/STO_Relational_LegendStudioCommand.d.ts +21 -0
  6. package/lib/__lib__/STO_Relational_LegendStudioCommand.d.ts.map +1 -0
  7. package/lib/__lib__/STO_Relational_LegendStudioCommand.js +28 -0
  8. package/lib/__lib__/STO_Relational_LegendStudioCommand.js.map +1 -0
  9. package/lib/application/LegendStudioApplicationConfig.d.ts +5 -0
  10. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  11. package/lib/application/LegendStudioApplicationConfig.js +6 -0
  12. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  13. package/lib/components/ElementIconUtils.d.ts +13 -2
  14. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  15. package/lib/components/ElementIconUtils.js +15 -6
  16. package/lib/components/ElementIconUtils.js.map +1 -1
  17. package/lib/components/editor/Editor.d.ts.map +1 -1
  18. package/lib/components/editor/Editor.js +2 -1
  19. package/lib/components/editor/Editor.js.map +1 -1
  20. package/lib/components/editor/QuickInput.d.ts +19 -0
  21. package/lib/components/editor/QuickInput.d.ts.map +1 -0
  22. package/lib/components/editor/QuickInput.js +51 -0
  23. package/lib/components/editor/QuickInput.js.map +1 -0
  24. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
  25. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +5 -1
  26. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
  27. package/lib/components/editor/command-center/ProjectSearchCommand.js +3 -3
  28. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  29. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  30. package/lib/components/editor/editor-group/EditorGroup.js +11 -4
  31. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  32. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  33. package/lib/components/editor/editor-group/FunctionEditor.js +30 -8
  34. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  35. package/lib/components/editor/editor-group/GenerationSpecificationEditor.js +1 -1
  36. package/lib/components/editor/editor-group/GenerationSpecificationEditor.js.map +1 -1
  37. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  38. package/lib/components/editor/editor-group/GrammarTextEditor.js +99 -100
  39. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  40. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.d.ts.map +1 -1
  41. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.js +5 -5
  42. package/lib/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.js.map +1 -1
  43. package/lib/components/editor/editor-group/RuntimeEditor.js +1 -1
  44. package/lib/components/editor/editor-group/RuntimeEditor.js.map +1 -1
  45. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +1 -1
  46. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +27 -19
  47. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +1 -1
  48. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +2 -2
  49. package/lib/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.d.ts.map +1 -1
  50. package/lib/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.js +5 -5
  51. package/lib/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.js.map +1 -1
  52. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js +2 -2
  53. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js.map +1 -1
  54. package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js +1 -1
  55. package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js.map +1 -1
  56. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.js +1 -1
  57. package/lib/components/editor/editor-group/mapping-editor/ClassMappingEditor.js.map +1 -1
  58. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js +2 -2
  59. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js.map +1 -1
  60. package/lib/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.js +1 -1
  61. package/lib/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.js.map +1 -1
  62. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  63. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +4 -6
  64. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  65. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js +2 -2
  66. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  67. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestableEditor.d.ts.map +1 -1
  68. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestableEditor.js +2 -2
  69. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  70. package/lib/components/editor/editor-group/uml-editor/AssociationEditor.js +2 -2
  71. package/lib/components/editor/editor-group/uml-editor/AssociationEditor.js.map +1 -1
  72. package/lib/components/editor/editor-group/uml-editor/ClassEditor.js +4 -4
  73. package/lib/components/editor/editor-group/uml-editor/ClassEditor.js.map +1 -1
  74. package/lib/components/editor/panel-group/PanelGroup.d.ts +2 -0
  75. package/lib/components/editor/panel-group/PanelGroup.d.ts.map +1 -1
  76. package/lib/components/editor/panel-group/PanelGroup.js +18 -3
  77. package/lib/components/editor/panel-group/PanelGroup.js.map +1 -1
  78. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts +26 -0
  79. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -0
  80. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +339 -0
  81. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -0
  82. package/lib/components/editor/side-bar/Explorer.js +5 -6
  83. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  84. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +1 -1
  85. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  86. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  87. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +5 -1
  88. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
  89. package/lib/index.css +2 -2
  90. package/lib/index.css.map +1 -1
  91. package/lib/package.json +2 -2
  92. package/lib/stores/editor/EditorConfig.d.ts +2 -1
  93. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  94. package/lib/stores/editor/EditorConfig.js +1 -0
  95. package/lib/stores/editor/EditorConfig.js.map +1 -1
  96. package/lib/stores/editor/EditorStore.d.ts +8 -2
  97. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  98. package/lib/stores/editor/EditorStore.js +19 -4
  99. package/lib/stores/editor/EditorStore.js.map +1 -1
  100. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  101. package/lib/stores/editor/GraphEditFormModeState.js +1 -0
  102. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  103. package/lib/stores/editor/QuickInputState.d.ts +28 -0
  104. package/lib/stores/editor/QuickInputState.d.ts.map +1 -0
  105. package/lib/stores/editor/QuickInputState.js +17 -0
  106. package/lib/stores/editor/QuickInputState.js.map +1 -0
  107. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +22 -2
  108. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  109. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +181 -4
  110. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  111. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.d.ts.map +1 -1
  112. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js +6 -2
  113. package/lib/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js.map +1 -1
  114. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +19 -18
  115. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  116. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +167 -157
  117. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  118. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.d.ts +3 -3
  119. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.d.ts.map +1 -1
  120. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js +2 -2
  121. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.js.map +1 -1
  122. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +8 -9
  123. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  124. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +9 -14
  125. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  126. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +4 -4
  127. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  128. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +7 -8
  129. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  130. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts +1 -1
  131. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
  132. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js +3 -1
  133. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
  134. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +82 -0
  135. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -0
  136. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +328 -0
  137. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -0
  138. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts +1 -1
  139. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
  140. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js +8 -2
  141. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
  142. package/package.json +12 -12
  143. package/src/__lib__/LegendStudioApplicationNavigationContext.ts +2 -0
  144. package/src/__lib__/STO_Relational_LegendStudioCommand.ts +30 -0
  145. package/src/application/LegendStudioApplicationConfig.ts +7 -0
  146. package/src/components/ElementIconUtils.tsx +23 -8
  147. package/src/components/editor/Editor.tsx +2 -0
  148. package/src/components/editor/QuickInput.tsx +91 -0
  149. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +5 -1
  150. package/src/components/editor/command-center/ProjectSearchCommand.tsx +4 -4
  151. package/src/components/editor/editor-group/EditorGroup.tsx +41 -1
  152. package/src/components/editor/editor-group/FunctionEditor.tsx +145 -5
  153. package/src/components/editor/editor-group/GenerationSpecificationEditor.tsx +1 -1
  154. package/src/components/editor/editor-group/GrammarTextEditor.tsx +134 -131
  155. package/src/components/editor/editor-group/INTERNAL__UnknownFunctionActivatorEdtior.tsx +26 -13
  156. package/src/components/editor/editor-group/RuntimeEditor.tsx +1 -1
  157. package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +193 -150
  158. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +2 -2
  159. package/src/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.tsx +6 -5
  160. package/src/components/editor/editor-group/element-generation-editor/FileGenerationEditor.tsx +1 -1
  161. package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.tsx +1 -1
  162. package/src/components/editor/editor-group/mapping-editor/ClassMappingEditor.tsx +1 -1
  163. package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
  164. package/src/components/editor/editor-group/mapping-editor/PropertyMappingsEditor.tsx +1 -1
  165. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +8 -10
  166. package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx +2 -2
  167. package/src/components/editor/editor-group/service-editor/testable/ServiceTestableEditor.tsx +9 -3
  168. package/src/components/editor/editor-group/uml-editor/AssociationEditor.tsx +2 -2
  169. package/src/components/editor/editor-group/uml-editor/ClassEditor.tsx +4 -4
  170. package/src/components/editor/panel-group/PanelGroup.tsx +35 -3
  171. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +730 -0
  172. package/src/components/editor/side-bar/Explorer.tsx +5 -5
  173. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +1 -1
  174. package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +9 -3
  175. package/src/stores/editor/EditorConfig.ts +1 -0
  176. package/src/stores/editor/EditorStore.ts +23 -4
  177. package/src/stores/editor/GraphEditFormModeState.ts +1 -0
  178. package/src/stores/editor/QuickInputState.ts +24 -0
  179. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +317 -3
  180. package/src/stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.ts +11 -2
  181. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +262 -249
  182. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingElementDecorator.ts +5 -5
  183. package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +19 -23
  184. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +9 -9
  185. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +4 -2
  186. package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +485 -0
  187. package/src/stores/graph-modifier/DSL_Service_GraphModifierHelper.ts +13 -1
  188. package/tsconfig.json +5 -0
@@ -100,6 +100,7 @@ import {
100
100
  type PackageableElement,
101
101
  PackageableConnection,
102
102
  RelationalDatabaseConnection,
103
+ guaranteeRelationalDatabaseConnection,
103
104
  } from '@finos/legend-graph';
104
105
  import { useApplicationStore } from '@finos/legend-application';
105
106
  import {
@@ -122,7 +123,6 @@ import {
122
123
  CODE_EDITOR_LANGUAGE,
123
124
  CodeEditor,
124
125
  } from '@finos/legend-lego/code-editor';
125
- import { guaranteeRelationalDatabaseConnection } from '../../../stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js';
126
126
  import { DatabaseBuilder } from '../editor-group/connection-editor/DatabaseBuilder.js';
127
127
 
128
128
  const ElementRenamer = observer(() => {
@@ -684,7 +684,7 @@ const ExplorerContextMenu = observer(
684
684
  {elementTypes.map((type) => (
685
685
  <MenuContentItem key={type} onClick={createNewElement(type)}>
686
686
  <MenuContentItemIcon>
687
- {getElementTypeIcon(editorStore, type)}
687
+ {getElementTypeIcon(type, editorStore)}
688
688
  </MenuContentItemIcon>
689
689
  <MenuContentItemLabel>
690
690
  New {toTitleCase(getElementTypeLabel(editorStore, type))}...
@@ -844,7 +844,7 @@ const PackageTreeNodeContainer = observer(
844
844
  </div>
845
845
  )
846
846
  ) : (
847
- getElementIcon(editorStore, node.packageableElement)
847
+ getElementIcon(node.packageableElement, editorStore)
848
848
  );
849
849
  const selectNode = (): void => onNodeSelect?.(node);
850
850
  const onContextMenuOpen = (): void => setIsSelectedFromContextMenu(true);
@@ -925,7 +925,7 @@ const ExplorerDropdownMenu = observer(() => {
925
925
  {elementTypes.map((type) => (
926
926
  <MenuContentItem key={type} onClick={createNewElement(type)}>
927
927
  <MenuContentItemIcon>
928
- {getElementTypeIcon(editorStore, type)}
928
+ {getElementTypeIcon(type, editorStore)}
929
929
  </MenuContentItemIcon>
930
930
  <MenuContentItemLabel>
931
931
  New {toTitleCase(getElementTypeLabel(editorStore, type))}...
@@ -1146,7 +1146,7 @@ const ProjectExplorerActionPanel = observer((props: { disabled: boolean }) => {
1146
1146
  const isInGrammarMode =
1147
1147
  editorStore.graphEditorMode.mode === GRAPH_EDITOR_MODE.GRAMMAR_TEXT;
1148
1148
  const showSearchModal = (): void =>
1149
- editorStore.searchElementCommandState.open();
1149
+ editorStore.setShowSearchElementCommand(true);
1150
1150
  // Explorer tree
1151
1151
  const selectedTreeNode = editorStore.explorerTreeState.selectedNode;
1152
1152
  const collapseTree = (): void => {
@@ -317,10 +317,10 @@ const TestableTreeNodeContainer: React.FC<
317
317
  node instanceof TestableTreeNodeData
318
318
  ? node.testableMetadata.testable instanceof PackageableElement
319
319
  ? getElementTypeIcon(
320
- editorStore,
321
320
  editorStore.graphState.getPackageableElementType(
322
321
  node.testableMetadata.testable,
323
322
  ),
323
+ editorStore,
324
324
  )
325
325
  : null
326
326
  : null;
@@ -39,6 +39,7 @@ import {
39
39
  configureCodeEditorComponent,
40
40
  setupPureLanguageService,
41
41
  } from '@finos/legend-lego/code-editor';
42
+ import { STO_RELATIONAL_LEGEND_STUDIO_COMMAND_CONFIG } from '../../__lib__/STO_Relational_LegendStudioCommand.js';
42
43
 
43
44
  export class Core_LegendStudioApplicationPlugin extends LegendStudioApplicationPlugin {
44
45
  static NAME = packageJson.extensions.applicationStudioPlugin;
@@ -66,9 +67,14 @@ export class Core_LegendStudioApplicationPlugin extends LegendStudioApplicationP
66
67
  }
67
68
 
68
69
  override getExtraKeyedCommandConfigEntries(): KeyedCommandConfigEntry[] {
69
- return collectKeyedCommandConfigEntriesFromConfig(
70
- LEGEND_STUDIO_COMMAND_CONFIG,
71
- );
70
+ return [
71
+ ...collectKeyedCommandConfigEntriesFromConfig(
72
+ LEGEND_STUDIO_COMMAND_CONFIG,
73
+ ),
74
+ ...collectKeyedCommandConfigEntriesFromConfig(
75
+ STO_RELATIONAL_LEGEND_STUDIO_COMMAND_CONFIG,
76
+ ),
77
+ ];
72
78
  }
73
79
 
74
80
  override getExtraRequiredDocumentationKeys(): string[] {
@@ -43,6 +43,7 @@ export enum PANEL_MODE {
43
43
  CONSOLE = 'COMPILE',
44
44
  DEV_TOOL = 'DEV_TOOL',
45
45
  PROBLEMS = 'PROBLEMS',
46
+ SQL_PLAYGROUND = 'SQL_PLAYGROUND',
46
47
  }
47
48
 
48
49
  export enum ELEMENT_NATIVE_VIEW_MODE {
@@ -68,7 +68,7 @@ import {
68
68
  generateViewProjectRoute,
69
69
  type WorkspaceEditorPathParams,
70
70
  } from '../../__lib__/LegendStudioNavigation.js';
71
- import { NonBlockingDialogState, PanelDisplayState } from '@finos/legend-art';
71
+ import { PanelDisplayState } from '@finos/legend-art';
72
72
  import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudioApplicationPlugin.js';
73
73
  import type { Entity } from '@finos/legend-storage';
74
74
  import {
@@ -101,6 +101,8 @@ import { GraphEditFormModeState } from './GraphEditFormModeState.js';
101
101
  import type { GraphEditorMode } from './GraphEditorMode.js';
102
102
  import { GraphEditGrammarModeState } from './GraphEditGrammarModeState.js';
103
103
  import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceRegistrationState.js';
104
+ import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.js';
105
+ import type { QuickInputState } from './QuickInputState.js';
104
106
 
105
107
  export abstract class EditorExtensionState {
106
108
  /**
@@ -149,6 +151,7 @@ export class EditorStore implements CommandRegistrar {
149
151
  conflictResolutionState: WorkspaceUpdateConflictResolutionState;
150
152
  globalBulkServiceRegistrationState: GlobalBulkServiceRegistrationState;
151
153
  devToolState: DevToolPanelState;
154
+ sqlPlaygroundState: SQLPlaygroundPanelState;
152
155
 
153
156
  modelImporterState: ModelImporterState;
154
157
  projectConfigurationEditorState: ProjectConfigurationEditorState;
@@ -159,7 +162,8 @@ export class EditorStore implements CommandRegistrar {
159
162
  * per file generation configuration type.
160
163
  */
161
164
  elementGenerationStates: ElementFileGenerationState[] = [];
162
- searchElementCommandState = new NonBlockingDialogState();
165
+ showSearchElementCommand = false;
166
+ quickInputState?: QuickInputState<unknown> | undefined;
163
167
 
164
168
  activePanelMode: PANEL_MODE = PANEL_MODE.CONSOLE;
165
169
  readonly panelGroupDisplayState = new PanelDisplayState({
@@ -189,6 +193,8 @@ export class EditorStore implements CommandRegistrar {
189
193
  activePanelMode: observable,
190
194
  activeActivity: observable,
191
195
  graphEditorMode: observable,
196
+ showSearchElementCommand: observable,
197
+ quickInputState: observable,
192
198
 
193
199
  isInViewerMode: computed,
194
200
  isInConflictResolutionMode: computed,
@@ -201,6 +207,8 @@ export class EditorStore implements CommandRegistrar {
201
207
  cleanUp: action,
202
208
  reset: action,
203
209
  setActiveActivity: action,
210
+ setShowSearchElementCommand: action,
211
+ setQuickInputState: action,
204
212
 
205
213
  initialize: flow,
206
214
  initMode: flow,
@@ -227,6 +235,7 @@ export class EditorStore implements CommandRegistrar {
227
235
  this.graphEditorMode = new GraphEditFormModeState(this);
228
236
  this.changeDetectionState = new ChangeDetectionState(this, this.graphState);
229
237
  this.devToolState = new DevToolPanelState(this);
238
+ this.sqlPlaygroundState = new SQLPlaygroundPanelState(this);
230
239
  this.embeddedQueryBuilderState = new EmbeddedQueryBuilderState(this);
231
240
  // side bar panels
232
241
  this.explorerTreeState = new ExplorerTreeState(this);
@@ -308,6 +317,14 @@ export class EditorStore implements CommandRegistrar {
308
317
  this.mode = val;
309
318
  }
310
319
 
320
+ setShowSearchElementCommand(val: boolean): void {
321
+ this.showSearchElementCommand = val;
322
+ }
323
+
324
+ setQuickInputState<T>(val: QuickInputState<T> | undefined): void {
325
+ this.quickInputState = val as QuickInputState<unknown> | undefined;
326
+ }
327
+
311
328
  cleanUp(): void {
312
329
  // dismiss all the alerts as these are parts of application, if we don't do this, we might
313
330
  // end up blocking other parts of the app
@@ -370,7 +387,8 @@ export class EditorStore implements CommandRegistrar {
370
387
  this.applicationStore.commandService.registerCommand({
371
388
  key: LEGEND_STUDIO_COMMAND_KEY.SEARCH_ELEMENT,
372
389
  trigger: this.createEditorCommandTrigger(),
373
- action: () => this.searchElementCommandState.open(),
390
+ action: () =>
391
+ this.setShowSearchElementCommand(!this.showSearchElementCommand),
374
392
  });
375
393
  this.applicationStore.commandService.registerCommand({
376
394
  key: LEGEND_STUDIO_COMMAND_KEY.TOGGLE_TEXT_MODE,
@@ -637,7 +655,6 @@ export class EditorStore implements CommandRegistrar {
637
655
  projectId,
638
656
  this.sdlcState.activeWorkspace,
639
657
  ),
640
- this.graphManagerState.initializeSystem(), // this can be moved inside of `setupEngine`
641
658
  this.graphManagerState.graphManager.initialize(
642
659
  {
643
660
  env: this.applicationStore.config.env,
@@ -653,6 +670,7 @@ export class EditorStore implements CommandRegistrar {
653
670
  },
654
671
  ),
655
672
  ]);
673
+ yield this.graphManagerState.initializeSystem();
656
674
  yield flowResult(this.initMode());
657
675
 
658
676
  onLeave(true);
@@ -937,6 +955,7 @@ export class EditorStore implements CommandRegistrar {
937
955
  case GRAPH_EDITOR_MODE.GRAMMAR_TEXT: {
938
956
  const graphEditorMode = new GraphEditGrammarModeState(this);
939
957
  try {
958
+ yield flowResult(this.graphEditorMode.onLeave(fallbackOptions));
940
959
  yield flowResult(
941
960
  graphEditorMode.cleanupBeforeEntering(fallbackOptions),
942
961
  );
@@ -577,6 +577,7 @@ export class GraphEditFormModeState extends GraphEditorMode {
577
577
  }
578
578
 
579
579
  *onLeave(): GeneratorFn<void> {
580
+ this.editorStore.sqlPlaygroundState.setConnection(undefined);
580
581
  return;
581
582
  }
582
583
 
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export type QuickInputOption<T> = { label: React.ReactNode; value: T };
18
+ export type QuickInputState<T> = {
19
+ title?: string | undefined;
20
+ placeholder?: string | undefined;
21
+ options: QuickInputOption<T>[];
22
+ getSearchValue: (option: QuickInputOption<T>) => string;
23
+ onSelect: (option: QuickInputOption<T>) => void;
24
+ };
@@ -14,7 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { computed, observable, action, makeObservable } from 'mobx';
17
+ import {
18
+ computed,
19
+ observable,
20
+ action,
21
+ makeObservable,
22
+ flow,
23
+ flowResult,
24
+ } from 'mobx';
18
25
  import type { EditorStore } from '../../EditorStore.js';
19
26
  import {
20
27
  type GeneratorFn,
@@ -22,6 +29,9 @@ import {
22
29
  LogEvent,
23
30
  guaranteeType,
24
31
  assertType,
32
+ StopWatch,
33
+ stringifyLosslessJSON,
34
+ filterByType,
25
35
  } from '@finos/legend-shared';
26
36
  import { ElementEditorState } from './ElementEditorState.js';
27
37
  import {
@@ -34,9 +44,26 @@ import {
34
44
  RawLambda,
35
45
  buildSourceInformationSourceId,
36
46
  isStubbed_PackageableElement,
47
+ type ExecutionResult,
48
+ type RawExecutionPlan,
49
+ reportGraphAnalytics,
50
+ buildLambdaVariableExpressions,
51
+ VariableExpression,
52
+ observe_ValueSpecification,
37
53
  } from '@finos/legend-graph';
38
- import { LambdaEditorState } from '@finos/legend-query-builder';
54
+ import {
55
+ ExecutionPlanState,
56
+ LambdaEditorState,
57
+ LambdaParameterState,
58
+ LambdaParametersState,
59
+ PARAMETER_SUBMIT_ACTION,
60
+ QUERY_BUILDER_EVENT,
61
+ QueryBuilderTelemetryHelper,
62
+ buildExecutionParameterValues,
63
+ getExecutionQueryFromRawLambda,
64
+ } from '@finos/legend-query-builder';
39
65
  import { FunctionActivatorBuilderState } from './FunctionActivatorBuilderState.js';
66
+ import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
40
67
 
41
68
  export enum FUNCTION_EDITOR_TAB {
42
69
  DEFINITION = 'DEFINITION',
@@ -105,7 +132,7 @@ export class FunctionDefinitionEditorState extends LambdaEditorState {
105
132
  const lambdas = new Map<string, RawLambda>();
106
133
  const functionLamba = new RawLambda(
107
134
  [],
108
- this.functionElement.expressionSequence as object,
135
+ this.functionElement.expressionSequence,
109
136
  );
110
137
  lambdas.set(this.lambdaId, functionLamba);
111
138
  const isolatedLambdas =
@@ -154,12 +181,74 @@ export class FunctionDefinitionEditorState extends LambdaEditorState {
154
181
  }
155
182
  }
156
183
 
184
+ export class FunctionParametersState extends LambdaParametersState {
185
+ readonly functionEditorState: FunctionEditorState;
186
+
187
+ constructor(functionEditorState: FunctionEditorState) {
188
+ super();
189
+ makeObservable(this, {
190
+ parameterValuesEditorState: observable,
191
+ parameterStates: observable,
192
+ addParameter: action,
193
+ removeParameter: action,
194
+ openModal: action,
195
+ build: action,
196
+ setParameters: action,
197
+ });
198
+ this.functionEditorState = functionEditorState;
199
+ }
200
+
201
+ openModal(query: RawLambda): void {
202
+ this.parameterStates = this.build(query);
203
+ this.parameterValuesEditorState.open(
204
+ (): Promise<void> =>
205
+ flowResult(this.functionEditorState.runQuery()).catch(
206
+ this.functionEditorState.editorStore.applicationStore
207
+ .alertUnhandledError,
208
+ ),
209
+ PARAMETER_SUBMIT_ACTION.RUN,
210
+ );
211
+ }
212
+
213
+ build(query: RawLambda): LambdaParameterState[] {
214
+ const parameters = buildLambdaVariableExpressions(
215
+ query,
216
+ this.functionEditorState.editorStore.graphManagerState,
217
+ )
218
+ .map((parameter) =>
219
+ observe_ValueSpecification(
220
+ parameter,
221
+ this.functionEditorState.editorStore.changeDetectionState
222
+ .observerContext,
223
+ ),
224
+ )
225
+ .filter(filterByType(VariableExpression));
226
+ const states = parameters.map((variable) => {
227
+ const parmeterState = new LambdaParameterState(
228
+ variable,
229
+ this.functionEditorState.editorStore.changeDetectionState.observerContext,
230
+ this.functionEditorState.editorStore.graphManagerState.graph,
231
+ );
232
+ parmeterState.mockParameterValue();
233
+ return parmeterState;
234
+ });
235
+ return states;
236
+ }
237
+ }
238
+
157
239
  export class FunctionEditorState extends ElementEditorState {
158
240
  readonly functionDefinitionEditorState: FunctionDefinitionEditorState;
159
241
  readonly activatorBuilderState: FunctionActivatorBuilderState;
160
242
 
161
243
  selectedTab: FUNCTION_EDITOR_TAB;
162
244
 
245
+ isRunningQuery = false;
246
+ isGeneratingPlan = false;
247
+ executionResultText?: string | undefined; // NOTE: stored as lossless JSON string
248
+ executionPlanState: ExecutionPlanState;
249
+ parametersState: FunctionParametersState;
250
+ queryRunPromise: Promise<ExecutionResult> | undefined = undefined;
251
+
163
252
  constructor(editorStore: EditorStore, element: PackageableElement) {
164
253
  super(editorStore, element);
165
254
 
@@ -168,6 +257,16 @@ export class FunctionEditorState extends ElementEditorState {
168
257
  functionElement: computed,
169
258
  setSelectedTab: action,
170
259
  reprocess: action,
260
+ isRunningQuery: observable,
261
+ isGeneratingPlan: observable,
262
+ executionResultText: observable,
263
+ executionPlanState: observable,
264
+ setExecutionResultText: action,
265
+ setIsRunningQuery: action,
266
+ runQuery: flow,
267
+ generatePlan: flow,
268
+ handleRunQuery: flow,
269
+ cancelQuery: flow,
171
270
  });
172
271
 
173
272
  assertType(
@@ -181,6 +280,11 @@ export class FunctionEditorState extends ElementEditorState {
181
280
  this.editorStore,
182
281
  );
183
282
  this.activatorBuilderState = new FunctionActivatorBuilderState(this);
283
+ this.executionPlanState = new ExecutionPlanState(
284
+ this.editorStore.applicationStore,
285
+ this.editorStore.graphManagerState,
286
+ );
287
+ this.parametersState = new FunctionParametersState(this);
184
288
  }
185
289
 
186
290
  get functionElement(): ConcreteFunctionDefinition {
@@ -231,4 +335,214 @@ export class FunctionEditorState extends ElementEditorState {
231
335
  functionEditorState.selectedTab = this.selectedTab;
232
336
  return functionEditorState;
233
337
  }
338
+
339
+ setIsRunningQuery(val: boolean): void {
340
+ this.isRunningQuery = val;
341
+ }
342
+
343
+ setExecutionResultText = (executionResult: string | undefined): void => {
344
+ this.executionResultText = executionResult;
345
+ };
346
+
347
+ setQueryRunPromise = (
348
+ promise: Promise<ExecutionResult> | undefined,
349
+ ): void => {
350
+ this.queryRunPromise = promise;
351
+ };
352
+
353
+ get query(): RawLambda {
354
+ return new RawLambda(
355
+ this.functionElement.parameters.map((parameter) =>
356
+ this.editorStore.graphManagerState.graphManager.serializeRawValueSpecification(
357
+ parameter,
358
+ ),
359
+ ),
360
+ this.functionElement.expressionSequence,
361
+ );
362
+ }
363
+
364
+ *generatePlan(debug: boolean): GeneratorFn<void> {
365
+ if (this.isGeneratingPlan) {
366
+ return;
367
+ }
368
+ try {
369
+ const query = this.query;
370
+ this.isGeneratingPlan = true;
371
+ let rawPlan: RawExecutionPlan;
372
+
373
+ const stopWatch = new StopWatch();
374
+ const report = reportGraphAnalytics(
375
+ this.editorStore.graphManagerState.graph,
376
+ );
377
+
378
+ if (debug) {
379
+ QueryBuilderTelemetryHelper.logEvent_ExecutionPlanDebugLaunched(
380
+ this.editorStore.applicationStore.telemetryService,
381
+ );
382
+ const debugResult =
383
+ (yield this.editorStore.graphManagerState.graphManager.debugExecutionPlanGeneration(
384
+ query,
385
+ undefined,
386
+ undefined,
387
+ this.editorStore.graphManagerState.graph,
388
+ report,
389
+ )) as { plan: RawExecutionPlan; debug: string };
390
+ rawPlan = debugResult.plan;
391
+ this.executionPlanState.setDebugText(debugResult.debug);
392
+ } else {
393
+ QueryBuilderTelemetryHelper.logEvent_ExecutionPlanGenerationLaunched(
394
+ this.editorStore.applicationStore.telemetryService,
395
+ );
396
+ rawPlan =
397
+ (yield this.editorStore.graphManagerState.graphManager.generateExecutionPlan(
398
+ query,
399
+ undefined,
400
+ undefined,
401
+ this.editorStore.graphManagerState.graph,
402
+ report,
403
+ )) as object;
404
+ }
405
+
406
+ stopWatch.record();
407
+ try {
408
+ this.executionPlanState.setRawPlan(rawPlan);
409
+ const plan =
410
+ this.editorStore.graphManagerState.graphManager.buildExecutionPlan(
411
+ rawPlan,
412
+ this.editorStore.graphManagerState.graph,
413
+ );
414
+ this.executionPlanState.setPlan(plan);
415
+ } catch {
416
+ // do nothing
417
+ }
418
+ stopWatch.record(QUERY_BUILDER_EVENT.BUILD_EXECUTION_PLAN__SUCCESS);
419
+
420
+ // report
421
+ report.timings =
422
+ this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
423
+ stopWatch,
424
+ report.timings,
425
+ );
426
+ if (debug) {
427
+ QueryBuilderTelemetryHelper.logEvent_ExecutionPlanDebugSucceeded(
428
+ this.editorStore.applicationStore.telemetryService,
429
+ report,
430
+ );
431
+ } else {
432
+ QueryBuilderTelemetryHelper.logEvent_ExecutionPlanGenerationSucceeded(
433
+ this.editorStore.applicationStore.telemetryService,
434
+ report,
435
+ );
436
+ }
437
+ } catch (error) {
438
+ assertErrorThrown(error);
439
+ this.editorStore.applicationStore.logService.error(
440
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
441
+ error,
442
+ );
443
+ this.editorStore.applicationStore.notificationService.notifyError(error);
444
+ } finally {
445
+ this.isGeneratingPlan = false;
446
+ }
447
+ }
448
+
449
+ *handleRunQuery(): GeneratorFn<void> {
450
+ if (this.isRunningQuery) {
451
+ return;
452
+ }
453
+ const query = this.query;
454
+ const parameters = (query.parameters ?? []) as object[];
455
+ if (parameters.length) {
456
+ this.parametersState.openModal(query);
457
+ } else {
458
+ this.runQuery();
459
+ }
460
+ }
461
+
462
+ *runQuery(): GeneratorFn<void> {
463
+ if (this.isRunningQuery) {
464
+ return;
465
+ }
466
+
467
+ QueryBuilderTelemetryHelper.logEvent_QueryRunLaunched(
468
+ this.editorStore.applicationStore.telemetryService,
469
+ );
470
+
471
+ let promise;
472
+ try {
473
+ this.isRunningQuery = true;
474
+ const stopWatch = new StopWatch();
475
+ const report = reportGraphAnalytics(
476
+ this.editorStore.graphManagerState.graph,
477
+ );
478
+ promise = this.editorStore.graphManagerState.graphManager.runQuery(
479
+ getExecutionQueryFromRawLambda(
480
+ this.query,
481
+ this.parametersState.parameterStates,
482
+ this.editorStore.graphManagerState,
483
+ ),
484
+ undefined,
485
+ undefined,
486
+ this.editorStore.graphManagerState.graph,
487
+ {
488
+ useLosslessParse: true,
489
+ parameterValues: buildExecutionParameterValues(
490
+ this.parametersState.parameterStates,
491
+ this.editorStore.graphManagerState,
492
+ ),
493
+ },
494
+ report,
495
+ );
496
+ this.setQueryRunPromise(promise);
497
+ const result = (yield promise) as ExecutionResult;
498
+ if (this.queryRunPromise === promise) {
499
+ this.setExecutionResultText(
500
+ stringifyLosslessJSON(result, undefined, DEFAULT_TAB_SIZE),
501
+ );
502
+ this.parametersState.setParameters([]);
503
+ // report
504
+ report.timings =
505
+ this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
506
+ stopWatch,
507
+ report.timings,
508
+ );
509
+ QueryBuilderTelemetryHelper.logEvent_QueryRunSucceeded(
510
+ this.editorStore.applicationStore.telemetryService,
511
+ report,
512
+ );
513
+ }
514
+ } catch (error) {
515
+ // When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
516
+ // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
517
+ // When cancelled the query, we set the queryRunPromise as undefined.
518
+ this.editorStore.applicationStore.logService.error(
519
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
520
+ error,
521
+ );
522
+ if (this.queryRunPromise === promise) {
523
+ assertErrorThrown(error);
524
+ this.editorStore.applicationStore.notificationService.notifyError(
525
+ error,
526
+ );
527
+ }
528
+ } finally {
529
+ this.isRunningQuery = false;
530
+ }
531
+ }
532
+
533
+ *cancelQuery(): GeneratorFn<void> {
534
+ this.setIsRunningQuery(false);
535
+ this.setQueryRunPromise(undefined);
536
+ try {
537
+ yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
538
+ true,
539
+ );
540
+ } catch (error) {
541
+ // Don't notify users about success or failure
542
+ this.editorStore.applicationStore.logService.error(
543
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
544
+ error,
545
+ );
546
+ }
547
+ }
234
548
  }
@@ -25,7 +25,12 @@ import {
25
25
  type Property,
26
26
  classHasCycle,
27
27
  } from '@finos/legend-graph';
28
- import { isString, uuid, type PlainObject } from '@finos/legend-shared';
28
+ import {
29
+ isString,
30
+ uuid,
31
+ type PlainObject,
32
+ prettyCONSTName,
33
+ } from '@finos/legend-shared';
29
34
  import type { TreeData, TreeNodeData } from '@finos/legend-art';
30
35
 
31
36
  export abstract class ProtocolValueFieldNode implements TreeNodeData {
@@ -331,7 +336,11 @@ export class ProtocolValueBuilderState {
331
336
  break;
332
337
  }
333
338
  case PRIMITIVE_TYPE.STRING: {
334
- value[property.name] = '';
339
+ // NOTE: this just provides some default value, and they are not necessarily sensible
340
+ // perhaps, we can create a mechanism for this class where we can inject value to fields
341
+ // but that might violate the generic usage principle of this builder as this builder's
342
+ // user should be relatively agnostic to the extension they are picking
343
+ value[property.name] = prettyCONSTName(property.name);
335
344
  break;
336
345
  }
337
346
  case PRIMITIVE_TYPE.DATE: