@finos/legend-application-studio 15.0.0 → 15.2.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 (171) hide show
  1. package/lib/components/EditorComponentTestUtils.d.ts.map +1 -1
  2. package/lib/components/EditorComponentTestUtils.js +6 -6
  3. package/lib/components/EditorComponentTestUtils.js.map +1 -1
  4. package/lib/components/editor/StatusBar.d.ts.map +1 -1
  5. package/lib/components/editor/StatusBar.js +5 -3
  6. package/lib/components/editor/StatusBar.js.map +1 -1
  7. package/lib/components/editor/edit-panel/FunctionEditor.d.ts.map +1 -1
  8. package/lib/components/editor/edit-panel/FunctionEditor.js +3 -3
  9. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  10. package/lib/components/editor/edit-panel/UnsupportedElementEditor.js +1 -1
  11. package/lib/components/editor/edit-panel/UnsupportedElementEditor.js.map +1 -1
  12. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.d.ts.map +1 -1
  13. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js +2 -2
  14. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js.map +1 -1
  15. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js +1 -1
  16. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js.map +1 -1
  17. package/lib/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.d.ts +0 -0
  18. package/lib/components/editor/edit-panel/connection-editor/DatabaseEditorHelper.d.ts.map +1 -0
  19. package/lib/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.js +0 -0
  20. package/lib/components/editor/edit-panel/connection-editor/DatabaseEditorHelper.js.map +1 -0
  21. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts +3 -12
  22. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  23. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js +103 -41
  24. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  25. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.d.ts +26 -0
  26. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.d.ts.map +1 -0
  27. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.js +77 -0
  28. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.js.map +1 -0
  29. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
  30. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js +1 -1
  31. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js.map +1 -1
  32. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  33. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  35. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +2 -2
  36. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.d.ts.map +1 -1
  38. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +2 -5
  39. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.d.ts.map +1 -1
  41. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +4 -4
  42. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  43. package/lib/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.js +1 -1
  44. package/lib/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.js.map +1 -1
  45. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  46. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +2 -1
  47. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  48. package/lib/components/editor/edit-panel/service-editor/ServiceRegistrationEditor.d.ts.map +1 -1
  49. package/lib/components/editor/edit-panel/service-editor/ServiceRegistrationEditor.js +8 -1
  50. package/lib/components/editor/edit-panel/service-editor/ServiceRegistrationEditor.js.map +1 -1
  51. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  52. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +7 -5
  53. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  54. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  55. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -2
  56. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  57. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  58. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +9 -7
  59. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  60. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
  61. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +4 -1
  62. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  63. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  64. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +4 -1
  65. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  66. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  67. package/lib/components/editor/side-bar/CreateNewElementModal.js +7 -4
  68. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  69. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  70. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +8 -2
  71. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  72. package/lib/components/shared/StudioLambdaEditor.d.ts.map +1 -1
  73. package/lib/components/shared/StudioLambdaEditor.js +3 -1
  74. package/lib/components/shared/StudioLambdaEditor.js.map +1 -1
  75. package/lib/index.css +1 -1
  76. package/lib/index.d.ts +5 -3
  77. package/lib/index.d.ts.map +1 -1
  78. package/lib/index.js +5 -3
  79. package/lib/index.js.map +1 -1
  80. package/lib/package.json +9 -9
  81. package/lib/stores/EditorGraphState.d.ts +11 -3
  82. package/lib/stores/EditorGraphState.d.ts.map +1 -1
  83. package/lib/stores/EditorGraphState.js +17 -3
  84. package/lib/stores/EditorGraphState.js.map +1 -1
  85. package/lib/stores/EditorStore.d.ts +1 -9
  86. package/lib/stores/EditorStore.d.ts.map +1 -1
  87. package/lib/stores/EditorStore.js +3 -54
  88. package/lib/stores/EditorStore.js.map +1 -1
  89. package/lib/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.d.ts +28 -1
  90. package/lib/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  91. package/lib/stores/editor/NewElementState.d.ts +1 -1
  92. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  93. package/lib/stores/editor/NewElementState.js +5 -3
  94. package/lib/stores/editor/NewElementState.js.map +1 -1
  95. package/lib/stores/editor-state/ModelImporterState.d.ts +2 -2
  96. package/lib/stores/editor-state/ModelImporterState.d.ts.map +1 -1
  97. package/lib/stores/editor-state/ModelImporterState.js +13 -9
  98. package/lib/stores/editor-state/ModelImporterState.js.map +1 -1
  99. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +9 -2
  100. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
  101. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js +32 -2
  102. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
  103. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.d.ts +30 -0
  104. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.d.ts.map +1 -0
  105. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js +49 -0
  106. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js.map +1 -0
  107. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  108. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js +1 -1
  109. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  110. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
  111. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  112. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts +8 -5
  113. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  114. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js +25 -16
  115. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  116. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +2 -1
  117. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  118. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +6 -4
  119. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  120. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts +10 -1
  121. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts.map +1 -1
  122. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js +27 -1
  123. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js.map +1 -1
  124. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -3
  125. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
  126. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js +1 -4
  127. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  128. package/package.json +17 -17
  129. package/src/components/EditorComponentTestUtils.tsx +6 -12
  130. package/src/components/editor/StatusBar.tsx +5 -3
  131. package/src/components/editor/edit-panel/FunctionEditor.tsx +9 -2
  132. package/src/components/editor/edit-panel/UnsupportedElementEditor.tsx +1 -1
  133. package/src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx +6 -2
  134. package/src/components/editor/edit-panel/connection-editor/DatabaseBuilder.tsx +1 -1
  135. package/src/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.tsx +0 -0
  136. package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx +371 -172
  137. package/src/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.tsx +278 -0
  138. package/src/components/editor/edit-panel/data-editor/EmbeddedDataEditor.tsx +2 -1
  139. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +5 -1
  140. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +2 -2
  141. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +2 -9
  142. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +4 -3
  143. package/src/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.tsx +1 -1
  144. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +6 -2
  145. package/src/components/editor/edit-panel/service-editor/ServiceRegistrationEditor.tsx +36 -0
  146. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +12 -5
  147. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +3 -1
  148. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +21 -12
  149. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +7 -4
  150. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +7 -4
  151. package/src/components/editor/side-bar/CreateNewElementModal.tsx +9 -3
  152. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +13 -1
  153. package/src/components/shared/StudioLambdaEditor.tsx +5 -2
  154. package/src/index.ts +8 -7
  155. package/src/stores/EditorGraphState.ts +25 -6
  156. package/src/stores/EditorStore.ts +2 -81
  157. package/src/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.ts +55 -0
  158. package/src/stores/editor/NewElementState.ts +8 -7
  159. package/src/stores/editor-state/ModelImporterState.ts +18 -16
  160. package/src/stores/editor-state/element-editor-state/connection/ConnectionEditorState.ts +47 -1
  161. package/src/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.ts +73 -0
  162. package/src/stores/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -1
  163. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -1
  164. package/src/stores/editor-state/element-editor-state/service/ServiceRegistrationState.ts +30 -25
  165. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +14 -4
  166. package/src/stores/graphModifier/StoreRelational_GraphModifierHelper.ts +64 -0
  167. package/src/stores/sidebar-state/testable/GlobalTestRunnerState.ts +2 -9
  168. package/tsconfig.json +4 -2
  169. package/tsconfig.package.json +38 -0
  170. package/lib/stores/editor-state/element-editor-state/mapping/relational/DatabaseEditorHelper.d.ts.map +0 -1
  171. package/lib/stores/editor-state/element-editor-state/mapping/relational/DatabaseEditorHelper.js.map +0 -1
@@ -41,6 +41,7 @@ import {
41
41
  import type { FileGenerationTypeOption } from '../../../stores/editor-state/GraphGenerationState.js';
42
42
  import { flowResult } from 'mobx';
43
43
  import {
44
+ buildElementOption,
44
45
  getPackageableElementOptionFormatter,
45
46
  useApplicationStore,
46
47
  type PackageableElementOption,
@@ -164,7 +165,8 @@ const NewRuntimeDriverEditor = observer(() => {
164
165
  );
165
166
  // mapping
166
167
  const mapping = newRuntimeDriver.mapping;
167
- const mappingOptions = editorStore.mappingOptions;
168
+ const mappingOptions =
169
+ editorStore.graphManagerState.usableMappings.map(buildElementOption);
168
170
  const selectedMappingOption = { label: mapping?.path ?? '', value: mapping };
169
171
  const onMappingSelectionChange = (
170
172
  val: PackageableElementOption<Mapping>,
@@ -216,7 +218,10 @@ const NewPureModelConnectionDriverEditor = observer(
216
218
  }): void => newConnectionDriver.setStore(val.value);
217
219
  // class
218
220
  const _class = newConnectionValueDriver.class;
219
- const classOptions = editorStore.classOptions.slice().sort(compareLabelFn);
221
+ const classOptions = editorStore.graphManagerState.usableClasses
222
+ .map(buildElementOption)
223
+ .slice()
224
+ .sort(compareLabelFn);
220
225
  const selectedClassOption = _class
221
226
  ? { label: _class.path, value: _class }
222
227
  : null;
@@ -321,7 +326,8 @@ const NewServiceDriverEditor = observer(() => {
321
326
  editorStore.newElementState.getNewElementDriver(NewServiceDriver);
322
327
  // mapping
323
328
  const currentMappingOption = newServiceDriver.mappingOption;
324
- const mappingOptions = editorStore.mappingOptions;
329
+ const mappingOptions =
330
+ editorStore.graphManagerState.usableMappings.map(buildElementOption);
325
331
  const onMappingChange = (
326
332
  val: PackageableElementOption<Mapping> | null,
327
333
  ): void => {
@@ -38,6 +38,7 @@ import {
38
38
  import {
39
39
  AssertFail,
40
40
  EqualToJsonAssertFail,
41
+ PackageableElement,
41
42
  TestError,
42
43
  } from '@finos/legend-graph';
43
44
  import { type GeneratorFn, isNonNullable } from '@finos/legend-shared';
@@ -58,6 +59,7 @@ import {
58
59
  } from '../../../../stores/sidebar-state/testable/GlobalTestRunnerState.js';
59
60
  import { LEGEND_STUDIO_TEST_ID } from '../../../LegendStudioTestID.js';
60
61
  import { TextDiffView } from '../../../shared/DiffView.js';
62
+ import { getElementTypeIcon } from '../../../shared/ElementIconUtils.js';
61
63
  import { StudioTextInputEditor } from '../../../shared/StudioTextInputEditor.js';
62
64
  import { useEditorStore } from '../../EditorStoreProvider.js';
63
65
 
@@ -249,6 +251,7 @@ const TestableTreeNodeContainer: React.FC<
249
251
  > = (props) => {
250
252
  const { node, level, stepPaddingInRem, onNodeSelect } = props;
251
253
  const { treeData, testableState, globalTestRunnerState } = props.innerProps;
254
+ const editorStore = useEditorStore();
252
255
  const results = testableState.results;
253
256
  const expandIcon =
254
257
  node instanceof AssertionTestTreeNodeData ? (
@@ -259,7 +262,16 @@ const TestableTreeNodeContainer: React.FC<
259
262
  <ChevronRightIcon />
260
263
  );
261
264
  const nodeIcon =
262
- node instanceof TestableTreeNodeData ? node.testableMetadata.icon : null;
265
+ node instanceof TestableTreeNodeData
266
+ ? node.testableMetadata.testable instanceof PackageableElement
267
+ ? getElementTypeIcon(
268
+ editorStore,
269
+ editorStore.graphState.getPackageableElementType(
270
+ node.testableMetadata.testable,
271
+ ),
272
+ )
273
+ : null
274
+ : null;
263
275
  const resultIcon = getTestableResultIcon(
264
276
  getNodeTestableResult(
265
277
  node,
@@ -93,8 +93,11 @@ export const StudioLambdaEditor = observer(
93
93
  editorStore.graphState.checkLambdaParsingError(
94
94
  lambdaEditorState,
95
95
  !disabled,
96
- () =>
97
- flowResult(editorStore.graphState.globalCompileInFormMode()),
96
+ async () => {
97
+ await flowResult(
98
+ editorStore.graphState.globalCompileInFormMode(),
99
+ );
100
+ },
98
101
  ),
99
102
  ).catch(applicationStore.alertUnhandledError);
100
103
  },
package/src/index.ts CHANGED
@@ -23,14 +23,11 @@ export * from './application/LegendStudioPluginManager.js';
23
23
  export * from './stores/LegendStudioAppEvent.js';
24
24
 
25
25
  // stores
26
+ export { FormModeCompilationOutcome } from './stores/EditorGraphState.js';
26
27
  export * from './stores/LegendStudioApplicationPlugin.js';
27
28
  export * from './stores/EditorStore.js';
28
29
  export * from './stores/EditorConfig.js';
29
- export {
30
- ExtensionModelImportRendererState,
31
- ExtensionModelImporterEditorState,
32
- ModelImporterEditorState,
33
- } from './stores/editor-state/ModelImporterState.js';
30
+ export * from './stores/editor-state/ModelImporterState.js';
34
31
  export { ClassEditorState } from './stores/editor-state/element-editor-state/ClassEditorState.js';
35
32
  export { ElementEditorState } from './stores/editor-state/element-editor-state/ElementEditorState.js';
36
33
  export { UnsupportedElementEditorState } from './stores/editor-state/UnsupportedElementEditorState.js';
@@ -71,9 +68,13 @@ export {
71
68
  export * from './components/LegendStudioTestID.js';
72
69
  export * from './stores/EditorStoreTestUtils.js';
73
70
 
71
+ export { PostProcessorEditorState } from './stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js';
74
72
  export { MappingExecutionState } from './stores/editor-state/element-editor-state/mapping/MappingExecutionState.js';
75
73
  export { MappingTestState } from './stores/editor-state/element-editor-state/mapping/MappingTestState.js';
76
- export { ConnectionValueState } from './stores/editor-state/element-editor-state/connection/ConnectionEditorState.js';
74
+ export {
75
+ ConnectionValueState,
76
+ RelationalDatabaseConnectionValueState,
77
+ } from './stores/editor-state/element-editor-state/connection/ConnectionEditorState.js';
77
78
  export * from './stores/editor-state/element-editor-state/mapping/MappingEditorState.js';
78
79
  export { MappingElementState } from './stores/editor-state/element-editor-state/mapping/MappingElementState.js';
79
80
  export { UnsupportedInstanceSetImplementationState } from './stores/editor-state/element-editor-state/mapping/UnsupportedInstanceSetImplementationState.js';
@@ -92,7 +93,7 @@ export { WorkspaceSetupStore } from './stores/workspace-setup/WorkspaceSetupStor
92
93
  */
93
94
 
94
95
  export {
95
- ConnectionEditor_StringEditor,
96
+ ConnectionEditor_TextEditor,
96
97
  ConnectionEditor_BooleanEditor,
97
98
  ConnectionEditor_ArrayEditor,
98
99
  } from './components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js';
@@ -110,6 +110,14 @@ export enum GraphBuilderStatus {
110
110
  REDIRECTED_TO_TEXT_MODE = 'REDIRECTED_TO_TEXT_MODE',
111
111
  }
112
112
 
113
+ export enum FormModeCompilationOutcome {
114
+ SKIPPED = 'SKIPPED',
115
+ SUCCEEDED = 'SUCCEEDED',
116
+ FAILED = 'FAILED',
117
+ FAILED_WITH_ERROR_REVEALED = 'FAILED_WITH_ERROR_REVEALED',
118
+ FAILED_AND_FALLBACK_TO_TEXT_MODE = 'FAILED_AND_FALLBACK_TO_TEXTMODE',
119
+ }
120
+
113
121
  export interface GraphBuilderResult {
114
122
  status: GraphBuilderStatus;
115
123
  error?: Error;
@@ -461,13 +469,13 @@ export class EditorGraphState {
461
469
  message?: string;
462
470
  disableNotificationOnSuccess?: boolean;
463
471
  openConsole?: boolean;
464
- }): GeneratorFn<void> {
472
+ }): GeneratorFn<FormModeCompilationOutcome> {
465
473
  assertTrue(
466
474
  this.editorStore.isInFormMode,
467
475
  'Editor must be in form mode to call this method',
468
476
  );
469
477
  if (this.checkIfApplicationUpdateOperationIsRunning()) {
470
- return;
478
+ return FormModeCompilationOutcome.SKIPPED;
471
479
  }
472
480
  this.isRunningGlobalCompile = true;
473
481
  try {
@@ -490,6 +498,7 @@ export class EditorGraphState {
490
498
  'Compiled successfully',
491
499
  );
492
500
  }
501
+ return FormModeCompilationOutcome.SUCCEEDED;
493
502
  } catch (error) {
494
503
  assertErrorThrown(error);
495
504
  // TODO: we probably should make this pattern of error the handling for all other exceptions in the codebase
@@ -548,19 +557,22 @@ export class EditorGraphState {
548
557
  this.editorStore.applicationStore.notifyWarning(
549
558
  `Can't enter text mode. Transformation to grammar text failed: ${error2.message}`,
550
559
  );
551
- return;
560
+ return FormModeCompilationOutcome.FAILED;
552
561
  }
553
562
  this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.GRAMMAR_TEXT);
554
563
  yield flowResult(
555
564
  this.globalCompileInTextMode({
556
565
  ignoreBlocking: true,
557
566
  suppressCompilationFailureMessage: true,
567
+ disableNotificationOnSuccess: options?.disableNotificationOnSuccess,
558
568
  }),
559
569
  );
570
+ return FormModeCompilationOutcome.FAILED_AND_FALLBACK_TO_TEXT_MODE;
560
571
  } else {
561
572
  this.editorStore.applicationStore.notifyWarning(
562
573
  `Compilation failed: ${error.message}`,
563
574
  );
575
+ return FormModeCompilationOutcome.FAILED_WITH_ERROR_REVEALED;
564
576
  }
565
577
  } finally {
566
578
  this.isRunningGlobalCompile = false;
@@ -570,8 +582,9 @@ export class EditorGraphState {
570
582
  // TODO: when we support showing multiple notifications, we can take this `suppressCompilationFailureMessage` out as
571
583
  // we can show the transition between form mode and text mode warning and the compilation failure warning at the same time
572
584
  *globalCompileInTextMode(options?: {
573
- ignoreBlocking?: boolean;
574
- suppressCompilationFailureMessage?: boolean;
585
+ ignoreBlocking?: boolean | undefined;
586
+ suppressCompilationFailureMessage?: boolean | undefined;
587
+ disableNotificationOnSuccess?: boolean | undefined;
575
588
  openConsole?: boolean;
576
589
  }): GeneratorFn<void> {
577
590
  assertTrue(
@@ -595,7 +608,13 @@ export class EditorGraphState {
595
608
  this.editorStore.grammarTextEditorState.graphGrammarText,
596
609
  this.editorStore.graphManagerState.graph,
597
610
  )) as Entity[];
598
- this.editorStore.applicationStore.notifySuccess('Compiled successfully');
611
+
612
+ if (!options?.disableNotificationOnSuccess) {
613
+ this.editorStore.applicationStore.notifySuccess(
614
+ 'Compiled successfully',
615
+ );
616
+ }
617
+
599
618
  yield flowResult(this.updateGraphAndApplication(entities));
600
619
  } catch (error) {
601
620
  assertErrorThrown(error);
@@ -95,7 +95,6 @@ import {
95
95
  } from '@finos/legend-server-sdlc';
96
96
  import {
97
97
  type PackageableElement,
98
- type Type,
99
98
  type Store,
100
99
  type GraphManagerState,
101
100
  GRAPH_MANAGER_EVENT,
@@ -114,7 +113,6 @@ import {
114
113
  PackageableConnection,
115
114
  FileGenerationSpecification,
116
115
  GenerationSpecification,
117
- PRIMITIVE_TYPE,
118
116
  Package,
119
117
  DataElement,
120
118
  isElementReadOnly,
@@ -1344,89 +1342,12 @@ export class EditorStore {
1344
1342
  }
1345
1343
  }
1346
1344
 
1347
- get enumerationOptions(): PackageableElementOption<Enumeration>[] {
1348
- return this.graphManagerState.graph.ownEnumerations
1349
- .concat(this.graphManagerState.graph.dependencyManager.enumerations)
1350
- .map(buildElementOption);
1351
- }
1352
-
1353
- get classOptions(): PackageableElementOption<Class>[] {
1354
- return this.graphManagerState.graph.ownClasses
1355
- .concat(
1356
- this.graphManagerState.collectExposedSystemElements(
1357
- this.graphManagerState.graph.systemModel.ownClasses,
1358
- ),
1359
- )
1360
- .concat(this.graphManagerState.graph.dependencyManager.classes)
1361
- .map(buildElementOption);
1362
- }
1363
-
1364
- get associationOptions(): PackageableElementOption<Association>[] {
1365
- return this.graphManagerState.graph.ownAssociations
1366
- .concat(
1367
- this.graphManagerState.collectExposedSystemElements(
1368
- this.graphManagerState.graph.systemModel.ownAssociations,
1369
- ),
1370
- )
1371
- .concat(this.graphManagerState.graph.dependencyManager.associations)
1372
- .map(buildElementOption);
1373
- }
1374
-
1375
- get profileOptions(): PackageableElementOption<Profile>[] {
1376
- return this.graphManagerState.graph.ownProfiles
1377
- .concat(
1378
- this.graphManagerState.collectExposedSystemElements(
1379
- this.graphManagerState.graph.systemModel.ownProfiles,
1380
- ),
1381
- )
1382
- .concat(this.graphManagerState.graph.dependencyManager.profiles)
1383
- .map(buildElementOption);
1384
- }
1385
-
1386
- get classPropertyGenericTypeOptions(): PackageableElementOption<Type>[] {
1387
- return this.graphManagerState.graph.primitiveTypes
1388
- .filter((p) => p.path !== PRIMITIVE_TYPE.LATESTDATE)
1389
- .map(buildElementOption)
1390
- .concat(
1391
- this.graphManagerState.graph.ownTypes
1392
- .concat(
1393
- this.graphManagerState.collectExposedSystemElements(
1394
- this.graphManagerState.graph.systemModel.ownTypes,
1395
- ),
1396
- )
1397
- .concat(this.graphManagerState.graph.dependencyManager.types)
1398
- .map(buildElementOption),
1399
- );
1400
- }
1401
-
1402
- get mappingOptions(): PackageableElementOption<Mapping>[] {
1403
- return this.graphManagerState.graph.ownMappings
1404
- .concat(this.graphManagerState.graph.dependencyManager.mappings)
1405
- .map(buildElementOption);
1406
- }
1407
-
1408
- get runtimeOptions(): PackageableElementOption<PackageableRuntime>[] {
1409
- return this.graphManagerState.graph.ownRuntimes
1410
- .concat(this.graphManagerState.graph.dependencyManager.runtimes)
1411
- .map(buildElementOption);
1412
- }
1413
-
1414
- get serviceOptions(): PackageableElementOption<Service>[] {
1415
- return this.graphManagerState.graph.ownServices
1416
- .concat(this.graphManagerState.graph.dependencyManager.services)
1417
- .map(buildElementOption);
1418
- }
1419
-
1420
1345
  get storeOptions(): PackageableElementOption<Store>[] {
1421
- return this.graphManagerState.graph.ownStores
1422
- .concat(this.graphManagerState.graph.dependencyManager.stores)
1423
- .map(buildElementOption);
1346
+ return this.graphManagerState.usableStores.map(buildElementOption);
1424
1347
  }
1425
1348
 
1426
1349
  get dataOptions(): PackageableElementOption<DataElement>[] {
1427
- return this.graphManagerState.graph.ownDataElements
1428
- .concat(this.graphManagerState.graph.dependencyManager.dataElements)
1429
- .map(buildElementOption);
1350
+ return this.graphManagerState.usableDataElements.map(buildElementOption);
1430
1351
  }
1431
1352
 
1432
1353
  getSupportedElementTypes(): string[] {
@@ -18,7 +18,11 @@ import type { DSL_LegendStudioApplicationPlugin_Extension } from './LegendStudio
18
18
  import type {
19
19
  DatasourceSpecification,
20
20
  AuthenticationStrategy,
21
+ PostProcessor,
22
+ ObserverContext,
21
23
  } from '@finos/legend-graph';
24
+ import type { RelationalDatabaseConnectionValueState } from './editor-state/element-editor-state/connection/ConnectionEditorState.js';
25
+ import type { PostProcessorEditorState } from './editor-state/element-editor-state/connection/PostProcessorEditorState.js';
22
26
 
23
27
  // connection datasource specification
24
28
 
@@ -50,6 +54,29 @@ export type AuthenticationStrategyEditorRenderer = (
50
54
  isReadOnly: boolean,
51
55
  ) => React.ReactNode | undefined;
52
56
 
57
+ // connection post-processor
58
+
59
+ export type PostProcessorTypeGetter = (
60
+ metamodel: PostProcessor,
61
+ ) => string | undefined;
62
+
63
+ export type PostProcessorCreator = (
64
+ type: string,
65
+ connectionValueState: RelationalDatabaseConnectionValueState,
66
+ observerContext: ObserverContext,
67
+ ) => PostProcessor | undefined;
68
+
69
+ export type PostProcessorEditorRenderer = (
70
+ metamodel: PostProcessor,
71
+ connectionValueState: RelationalDatabaseConnectionValueState,
72
+ isReadOnly: boolean,
73
+ ) => React.ReactNode | undefined;
74
+
75
+ export type PostProcessorStateCreator = (
76
+ metamodel: PostProcessor,
77
+ connectionValueState: RelationalDatabaseConnectionValueState,
78
+ ) => PostProcessorEditorState | undefined;
79
+
53
80
  export interface StoreRelational_LegendStudioApplicationPlugin_Extension
54
81
  extends DSL_LegendStudioApplicationPlugin_Extension {
55
82
  // --------------------- relational database connection datasource specification ------------------
@@ -97,4 +124,32 @@ export interface StoreRelational_LegendStudioApplicationPlugin_Extension
97
124
  * Get the list of renderers for the editor for a relational database authentication strategy.
98
125
  */
99
126
  getExtraAuthenticationStrategyEditorRenderers?(): AuthenticationStrategyEditorRenderer[];
127
+
128
+ // --------------------- relational database connection post-processor ------------------
129
+
130
+ /**
131
+ * Get the list of the supported type for post-processors.
132
+ *
133
+ */
134
+ getExtraPostProcessorClassifiers?(): string[];
135
+
136
+ /**
137
+ * Get the list of classifiers for a post-processor.
138
+ */
139
+ getExtraPostProcessorClassifierGetters?(): PostProcessorTypeGetter[];
140
+
141
+ /**
142
+ * Get the list of creators for post-processor given the type specifier.
143
+ */
144
+ getExtraPostProcessorCreators?(): PostProcessorCreator[];
145
+
146
+ /**
147
+ * Get the list of state creators for a post-processor.
148
+ */
149
+ getExtraPostProcessorStateCreators?(): PostProcessorStateCreator[];
150
+
151
+ /**
152
+ * Get the list of renderers for the editor for a post-processor.
153
+ */
154
+ getExtraPostProcessorEditorRenderers?(): PostProcessorEditorRenderer[];
100
155
  }
@@ -92,7 +92,10 @@ import {
92
92
  import type { EmbeddedDataTypeOption } from '../editor-state/element-editor-state/data/DataEditorState.js';
93
93
  import { dataElement_setEmbeddedData } from '../graphModifier/DSLData_GraphModifierHelper.js';
94
94
  import { PACKAGEABLE_ELEMENT_TYPE } from '../shared/ModelUtil.js';
95
- import type { PackageableElementOption } from '@finos/legend-application';
95
+ import {
96
+ buildElementOption,
97
+ type PackageableElementOption,
98
+ } from '@finos/legend-application';
96
99
  import { EmbeddedDataType } from '../editor-state/ExternalFormatState.js';
97
100
  import { createEmbeddedData } from '../editor-state/element-editor-state/data/EmbeddedDataState.js';
98
101
 
@@ -302,7 +305,7 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
302
305
  if (store instanceof Database) {
303
306
  selectedStore = store;
304
307
  } else {
305
- const dbs = this.editorStore.graphManagerState.graph.databases;
308
+ const dbs = this.editorStore.graphManagerState.usableDatabases;
306
309
  selectedStore = dbs.length ? (dbs[0] as Database) : stub_Database();
307
310
  }
308
311
  return new RelationalDatabaseConnection(
@@ -431,7 +434,8 @@ export class NewServiceDriver extends NewElementDriver<Service> {
431
434
  isValid: computed,
432
435
  createElement: action,
433
436
  });
434
- this.mappingOption = editorStore.mappingOptions[0];
437
+ this.mappingOption =
438
+ editorStore.graphManagerState.usableMappings.map(buildElementOption)[0];
435
439
  }
436
440
 
437
441
  setMappingOption(val: PackageableElementOption<Mapping> | undefined): void {
@@ -447,10 +451,7 @@ export class NewServiceDriver extends NewElementDriver<Service> {
447
451
  const _mapping = mappingOption.value;
448
452
  const mapping = PackageableElementExplicitReference.create(_mapping);
449
453
  const service = new Service(name);
450
- const runtimes =
451
- this.editorStore.graphManagerState.graph.ownRuntimes.concat(
452
- this.editorStore.graphManagerState.graph.dependencyManager.runtimes,
453
- );
454
+ const runtimes = this.editorStore.graphManagerState.usableRuntimes;
454
455
  const compatibleRuntimes = runtimes.filter((runtime) =>
455
456
  runtime.runtimeValue.mappings.map((m) => m.value).includes(_mapping),
456
457
  );
@@ -270,12 +270,10 @@ export class NativeModelImporterEditorState extends ModelImporterEditorState {
270
270
  }
271
271
 
272
272
  export abstract class ExtensionModelImportRendererState {
273
- externalFormatModelImporterState: ExternalFormatModelImporterState;
273
+ importerState: ModelImporterState;
274
274
 
275
- constructor(
276
- externalFormatModelImporterState: ExternalFormatModelImporterState,
277
- ) {
278
- this.externalFormatModelImporterState = externalFormatModelImporterState;
275
+ constructor(importerState: ModelImporterState) {
276
+ this.importerState = importerState;
279
277
  }
280
278
  }
281
279
  export class ExtensionModelImporterEditorState extends ModelImporterEditorState {
@@ -501,16 +499,20 @@ export class ModelImporterState extends EditorState {
501
499
  setModelImporterExtension(
502
500
  extension: ModelImporterExtensionConfiguration,
503
501
  ): ExtensionModelImporterEditorState {
504
- const externalEditorState =
505
- this.modelImportEditorState instanceof ExtensionModelImporterEditorState
506
- ? this.modelImportEditorState
507
- : new ExtensionModelImporterEditorState(
508
- extension,
509
- extension.getExtensionModelImportRendererStateCreator(this),
510
- this,
511
- );
512
- externalEditorState.setExtension(extension);
513
- this.setImportEditorState(externalEditorState);
514
- return externalEditorState;
502
+ if (
503
+ this.modelImportEditorState instanceof
504
+ ExtensionModelImporterEditorState &&
505
+ this.modelImportEditorState.config === extension
506
+ ) {
507
+ return this.modelImportEditorState;
508
+ } else {
509
+ const modelImporterEditorState = new ExtensionModelImporterEditorState(
510
+ extension,
511
+ extension.getExtensionModelImportRendererStateCreator(this),
512
+ this,
513
+ );
514
+ this.setImportEditorState(modelImporterEditorState);
515
+ return modelImporterEditorState;
516
+ }
515
517
  }
516
518
  }
@@ -52,12 +52,18 @@ import {
52
52
  RedshiftDatasourceSpecification,
53
53
  createValidationError,
54
54
  isStubbed_PackageableElement,
55
+ type PostProcessor,
56
+ MapperPostProcessor,
55
57
  } from '@finos/legend-graph';
56
58
  import type { DSLMapping_LegendStudioApplicationPlugin_Extension } from '../../../DSLMapping_LegendStudioApplicationPlugin_Extension.js';
57
59
  import {
58
60
  relationDbConnection_setNewAuthenticationStrategy,
59
61
  relationDbConnection_setDatasourceSpecification,
60
62
  } from '../../../graphModifier/StoreRelational_GraphModifierHelper.js';
63
+ import {
64
+ MapperPostProcessorEditorState,
65
+ type PostProcessorEditorState,
66
+ } from './PostProcessorEditorState.js';
61
67
 
62
68
  export abstract class ConnectionValueState {
63
69
  editorStore: EditorStore;
@@ -74,6 +80,7 @@ export abstract class ConnectionValueState {
74
80
  export enum RELATIONAL_DATABASE_TAB_TYPE {
75
81
  GENERAL = 'GENERAL',
76
82
  STORE = 'STORE',
83
+ POST_PROCESSORS = 'POST-PROCESSORS',
77
84
  }
78
85
 
79
86
  export enum CORE_DATASOURCE_SPEC_TYPE {
@@ -86,6 +93,10 @@ export enum CORE_DATASOURCE_SPEC_TYPE {
86
93
  BIGQUERY = 'BIGQUERY',
87
94
  }
88
95
 
96
+ export enum POST_PROCESSOR_TYPE {
97
+ MAPPER = 'MAPPER',
98
+ }
99
+
89
100
  export enum CORE_AUTHENTICATION_STRATEGY_TYPE {
90
101
  DELEGATED_KERBEROS = 'DELEGATED_KERBEROS',
91
102
  H2_DEFAULT = 'H2_DEFAULT',
@@ -102,6 +113,7 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
102
113
  override connection: RelationalDatabaseConnection;
103
114
  selectedTab = RELATIONAL_DATABASE_TAB_TYPE.GENERAL;
104
115
  databaseBuilderState: DatabaseBuilderState;
116
+ postProcessorState: PostProcessorEditorState | undefined;
105
117
 
106
118
  constructor(
107
119
  editorStore: EditorStore,
@@ -109,17 +121,50 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
109
121
  ) {
110
122
  super(editorStore, connection);
111
123
  makeObservable(this, {
112
- setSelectedTab: action,
113
124
  databaseBuilderState: observable,
114
125
  selectedTab: observable,
126
+ postProcessorState: observable,
127
+ setSelectedTab: action,
128
+ selectPostProcessor: action,
115
129
  });
130
+
116
131
  this.connection = connection;
132
+
117
133
  this.databaseBuilderState = new DatabaseBuilderState(
118
134
  editorStore,
119
135
  connection,
120
136
  );
121
137
  }
122
138
 
139
+ selectPostProcessor = (postProcessor: PostProcessor | undefined): void => {
140
+ if (!this.postProcessorState && postProcessor) {
141
+ if (postProcessor instanceof MapperPostProcessor) {
142
+ this.postProcessorState = new MapperPostProcessorEditorState(
143
+ postProcessor,
144
+ this,
145
+ );
146
+ } else {
147
+ const extraPostProcessorStateCreators = this.editorStore.pluginManager
148
+ .getApplicationPlugins()
149
+ .flatMap(
150
+ (plugin) =>
151
+ (
152
+ plugin as StoreRelational_LegendStudioApplicationPlugin_Extension
153
+ ).getExtraPostProcessorStateCreators?.() ?? [],
154
+ );
155
+ for (const creator of extraPostProcessorStateCreators) {
156
+ const postProcessorState = creator(postProcessor, this);
157
+ if (postProcessorState) {
158
+ this.postProcessorState = postProcessorState;
159
+ }
160
+ }
161
+ }
162
+ }
163
+ if (this.postProcessorState) {
164
+ this.postProcessorState.setPostProcessorState(postProcessor);
165
+ }
166
+ };
167
+
123
168
  get storeValidationResult(): ValidationIssue | undefined {
124
169
  return isStubbed_PackageableElement(this.connection.store.value)
125
170
  ? createValidationError(['Connection database cannot be empty'])
@@ -480,6 +525,7 @@ export class PackageableConnectionEditorState extends ElementEditorState {
480
525
  editorStore,
481
526
  newElement,
482
527
  );
528
+
483
529
  return editorState;
484
530
  }
485
531
  }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type {
18
+ PostProcessor,
19
+ Mapper,
20
+ MapperPostProcessor,
21
+ } from '@finos/legend-graph';
22
+ import { makeObservable, observable, action } from 'mobx';
23
+ import type { RelationalDatabaseConnectionValueState } from './ConnectionEditorState.js';
24
+
25
+ export abstract class PostProcessorEditorState {
26
+ postProcessor: PostProcessor | undefined;
27
+ connectionValueState: RelationalDatabaseConnectionValueState;
28
+
29
+ constructor(
30
+ postProcessor: PostProcessor | undefined,
31
+ connectionValueState: RelationalDatabaseConnectionValueState,
32
+ ) {
33
+ makeObservable(this, {
34
+ postProcessor: observable,
35
+ connectionValueState: observable,
36
+ });
37
+
38
+ this.postProcessor = postProcessor;
39
+ this.connectionValueState = connectionValueState;
40
+ }
41
+
42
+ abstract setPostProcessorState(val: PostProcessor | undefined): void;
43
+ }
44
+
45
+ export class MapperPostProcessorEditorState extends PostProcessorEditorState {
46
+ selectedMapper: Mapper | undefined;
47
+
48
+ constructor(
49
+ postProcessor: MapperPostProcessor | undefined,
50
+ connectionValueState: RelationalDatabaseConnectionValueState,
51
+ ) {
52
+ super(postProcessor, connectionValueState);
53
+
54
+ makeObservable(this, {
55
+ selectedMapper: observable,
56
+ setSelectedMapper: action,
57
+ setPostProcessorState: action,
58
+ });
59
+
60
+ this.postProcessor = postProcessor;
61
+ this.connectionValueState = connectionValueState;
62
+ }
63
+
64
+ setPostProcessorState = (val: PostProcessor | undefined): void => {
65
+ this.postProcessor = val;
66
+
67
+ this.setSelectedMapper(undefined);
68
+ };
69
+
70
+ setSelectedMapper = (val: Mapper | undefined): void => {
71
+ this.selectedMapper = val;
72
+ };
73
+ }