@finos/legend-application-studio 15.1.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 (144) 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/edit-panel/FunctionEditor.d.ts.map +1 -1
  5. package/lib/components/editor/edit-panel/FunctionEditor.js +3 -3
  6. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  7. package/lib/components/editor/edit-panel/UnsupportedElementEditor.js +1 -1
  8. package/lib/components/editor/edit-panel/UnsupportedElementEditor.js.map +1 -1
  9. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.d.ts.map +1 -1
  10. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js +2 -2
  11. package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js.map +1 -1
  12. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js +1 -1
  13. package/lib/components/editor/edit-panel/connection-editor/DatabaseBuilder.js.map +1 -1
  14. package/lib/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.d.ts +0 -0
  15. package/lib/components/editor/edit-panel/connection-editor/DatabaseEditorHelper.d.ts.map +1 -0
  16. package/lib/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.js +0 -0
  17. package/lib/components/editor/edit-panel/connection-editor/DatabaseEditorHelper.js.map +1 -0
  18. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts +3 -12
  19. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  20. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js +103 -41
  21. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  22. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.d.ts +26 -0
  23. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.d.ts.map +1 -0
  24. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.js +77 -0
  25. package/lib/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.js.map +1 -0
  26. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
  27. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js +1 -1
  28. package/lib/components/editor/edit-panel/data-editor/EmbeddedDataEditor.js.map +1 -1
  29. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  30. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +1 -1
  31. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  32. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +2 -2
  33. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.d.ts.map +1 -1
  35. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +2 -5
  36. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.d.ts.map +1 -1
  38. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +4 -4
  39. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.js +1 -1
  41. package/lib/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.js.map +1 -1
  42. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  43. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +2 -1
  44. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  45. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  46. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +7 -5
  47. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  48. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  49. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -2
  50. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  51. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  52. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +9 -7
  53. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  54. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
  55. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +4 -1
  56. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  57. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  58. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +4 -1
  59. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  60. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  61. package/lib/components/editor/side-bar/CreateNewElementModal.js +7 -4
  62. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  63. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  64. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +8 -2
  65. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  66. package/lib/index.css +1 -1
  67. package/lib/index.d.ts +3 -2
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/index.js +3 -2
  70. package/lib/index.js.map +1 -1
  71. package/lib/package.json +6 -6
  72. package/lib/stores/EditorStore.d.ts +1 -9
  73. package/lib/stores/EditorStore.d.ts.map +1 -1
  74. package/lib/stores/EditorStore.js +3 -54
  75. package/lib/stores/EditorStore.js.map +1 -1
  76. package/lib/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.d.ts +28 -1
  77. package/lib/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  78. package/lib/stores/editor/NewElementState.d.ts +1 -1
  79. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  80. package/lib/stores/editor/NewElementState.js +5 -3
  81. package/lib/stores/editor/NewElementState.js.map +1 -1
  82. package/lib/stores/editor-state/ModelImporterState.d.ts.map +1 -1
  83. package/lib/stores/editor-state/ModelImporterState.js +10 -6
  84. package/lib/stores/editor-state/ModelImporterState.js.map +1 -1
  85. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +9 -2
  86. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
  87. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js +32 -2
  88. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
  89. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.d.ts +30 -0
  90. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.d.ts.map +1 -0
  91. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js +49 -0
  92. package/lib/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js.map +1 -0
  93. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
  94. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  95. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +2 -1
  96. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  97. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +6 -4
  98. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  99. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts +10 -1
  100. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts.map +1 -1
  101. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js +27 -1
  102. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js.map +1 -1
  103. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -3
  104. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
  105. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js +1 -4
  106. package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  107. package/package.json +14 -14
  108. package/src/components/EditorComponentTestUtils.tsx +6 -12
  109. package/src/components/editor/edit-panel/FunctionEditor.tsx +9 -2
  110. package/src/components/editor/edit-panel/UnsupportedElementEditor.tsx +1 -1
  111. package/src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx +6 -2
  112. package/src/components/editor/edit-panel/connection-editor/DatabaseBuilder.tsx +1 -1
  113. package/src/{stores/editor-state/element-editor-state/mapping/relational → components/editor/edit-panel/connection-editor}/DatabaseEditorHelper.tsx +0 -0
  114. package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx +371 -172
  115. package/src/components/editor/edit-panel/connection-editor/post-processor-editor/MapperPostProcessorEditor.tsx +278 -0
  116. package/src/components/editor/edit-panel/data-editor/EmbeddedDataEditor.tsx +2 -1
  117. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +5 -1
  118. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +2 -2
  119. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +2 -9
  120. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +4 -3
  121. package/src/components/editor/edit-panel/mapping-editor/relational/TableOrViewSourceTree.tsx +1 -1
  122. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +6 -2
  123. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +12 -5
  124. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +3 -1
  125. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +21 -12
  126. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +7 -4
  127. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +7 -4
  128. package/src/components/editor/side-bar/CreateNewElementModal.tsx +9 -3
  129. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +13 -1
  130. package/src/index.ts +6 -2
  131. package/src/stores/EditorStore.ts +2 -81
  132. package/src/stores/StoreRelational_LegendStudioApplicationPlugin_Extension.ts +55 -0
  133. package/src/stores/editor/NewElementState.ts +8 -7
  134. package/src/stores/editor-state/ModelImporterState.ts +15 -11
  135. package/src/stores/editor-state/element-editor-state/connection/ConnectionEditorState.ts +47 -1
  136. package/src/stores/editor-state/element-editor-state/connection/PostProcessorEditorState.ts +73 -0
  137. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -1
  138. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +14 -4
  139. package/src/stores/graphModifier/StoreRelational_GraphModifierHelper.ts +64 -0
  140. package/src/stores/sidebar-state/testable/GlobalTestRunnerState.ts +2 -9
  141. package/tsconfig.json +5 -3
  142. package/tsconfig.package.json +38 -0
  143. package/lib/stores/editor-state/element-editor-state/mapping/relational/DatabaseEditorHelper.d.ts.map +0 -1
  144. package/lib/stores/editor-state/element-editor-state/mapping/relational/DatabaseEditorHelper.js.map +0 -1
package/src/index.ts CHANGED
@@ -68,9 +68,13 @@ export {
68
68
  export * from './components/LegendStudioTestID.js';
69
69
  export * from './stores/EditorStoreTestUtils.js';
70
70
 
71
+ export { PostProcessorEditorState } from './stores/editor-state/element-editor-state/connection/PostProcessorEditorState.js';
71
72
  export { MappingExecutionState } from './stores/editor-state/element-editor-state/mapping/MappingExecutionState.js';
72
73
  export { MappingTestState } from './stores/editor-state/element-editor-state/mapping/MappingTestState.js';
73
- 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';
74
78
  export * from './stores/editor-state/element-editor-state/mapping/MappingEditorState.js';
75
79
  export { MappingElementState } from './stores/editor-state/element-editor-state/mapping/MappingElementState.js';
76
80
  export { UnsupportedInstanceSetImplementationState } from './stores/editor-state/element-editor-state/mapping/UnsupportedInstanceSetImplementationState.js';
@@ -89,7 +93,7 @@ export { WorkspaceSetupStore } from './stores/workspace-setup/WorkspaceSetupStor
89
93
  */
90
94
 
91
95
  export {
92
- ConnectionEditor_StringEditor,
96
+ ConnectionEditor_TextEditor,
93
97
  ConnectionEditor_BooleanEditor,
94
98
  ConnectionEditor_ArrayEditor,
95
99
  } from './components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js';
@@ -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
  );
@@ -499,16 +499,20 @@ export class ModelImporterState extends EditorState {
499
499
  setModelImporterExtension(
500
500
  extension: ModelImporterExtensionConfiguration,
501
501
  ): ExtensionModelImporterEditorState {
502
- const externalEditorState =
503
- this.modelImportEditorState instanceof ExtensionModelImporterEditorState
504
- ? this.modelImportEditorState
505
- : new ExtensionModelImporterEditorState(
506
- extension,
507
- extension.getExtensionModelImportRendererStateCreator(this),
508
- this,
509
- );
510
- externalEditorState.setExtension(extension);
511
- this.setImportEditorState(externalEditorState);
512
- 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
+ }
513
517
  }
514
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
+ }
@@ -904,7 +904,7 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
904
904
 
905
905
  addExecutionParameter(value: string): void {
906
906
  const _mapping =
907
- this.editorStore.mappingOptions[0]?.value ?? stub_Mapping();
907
+ this.editorStore.graphManagerState.usableMappings[0] ?? stub_Mapping();
908
908
  const _key = new KeyedExecutionParameter(
909
909
  value,
910
910
  PackageableElementExplicitReference.create(_mapping),
@@ -206,13 +206,17 @@ export class ConnectionTestDataState {
206
206
  }
207
207
 
208
208
  export class NewConnectionDataState {
209
+ readonly editorStore: EditorStore;
209
210
  readonly testSuiteState: ServiceTestDataState;
210
211
  showModal = false;
211
212
  connection: IdentifiedConnection | undefined;
212
213
  embeddedDataType: EmbeddedDataTypeOption | undefined;
213
214
  dataElement: DataElement | undefined;
214
215
 
215
- constructor(suite: ServiceTestDataState) {
216
+ constructor(
217
+ editorStore: EditorStore,
218
+ serviceTestDataState: ServiceTestDataState,
219
+ ) {
216
220
  makeObservable(this, {
217
221
  showModal: observable,
218
222
  connection: observable,
@@ -224,8 +228,10 @@ export class NewConnectionDataState {
224
228
  handleConnectionChange: action,
225
229
  setDataElement: action,
226
230
  });
227
- this.testSuiteState = suite;
228
- this.dataElement = this.testSuiteState.editorStore.dataOptions[0]?.value;
231
+
232
+ this.editorStore = editorStore;
233
+ this.testSuiteState = serviceTestDataState;
234
+ this.dataElement = editorStore.graphManagerState.usableDataElements[0];
229
235
  }
230
236
 
231
237
  setModal(val: boolean): void {
@@ -303,6 +309,7 @@ export class ServiceTestDataState {
303
309
  newConnectionDataState: observable,
304
310
  selectedDataState: observable,
305
311
  });
312
+
306
313
  this.testData = testData;
307
314
  this.testSuiteState = testSuiteState;
308
315
  this.editorStore = testSuiteState.editorStore;
@@ -315,7 +322,10 @@ export class ServiceTestDataState {
315
322
  connectionData,
316
323
  );
317
324
  }
318
- this.newConnectionDataState = new NewConnectionDataState(this);
325
+ this.newConnectionDataState = new NewConnectionDataState(
326
+ this.editorStore,
327
+ this,
328
+ );
319
329
  }
320
330
 
321
331
  createConnectionTestData(): void {
@@ -42,6 +42,8 @@ import {
42
42
  type ObserverContext,
43
43
  type EnumerationMappingReference,
44
44
  type TableAlias,
45
+ type Mapper,
46
+ type PostProcessor,
45
47
  getRelationalInputType,
46
48
  observe_DatasourceSpecification,
47
49
  observe_AuthenticationStrategy,
@@ -49,8 +51,14 @@ import {
49
51
  observe_PropertyMapping,
50
52
  observe_EnumerationMappingReference,
51
53
  observe_TableAlias,
54
+ type SchemaNameMapper,
55
+ type MapperPostProcessor,
56
+ observe_PostProcessor,
57
+ observe_Mapper,
52
58
  } from '@finos/legend-graph';
59
+ import { addUniqueEntry, deleteEntry } from '@finos/legend-shared';
53
60
  import { action } from 'mobx';
61
+ import type { RelationalDatabaseConnectionValueState } from '../editor-state/element-editor-state/connection/ConnectionEditorState.js';
54
62
 
55
63
  // --------------------------------------------- DB Connection -------------------------------------
56
64
 
@@ -421,3 +429,59 @@ export const rootRelationalSetImp_setPropertyMappings = action(
421
429
  );
422
430
  },
423
431
  );
432
+
433
+ // --------------------------------------------- Post-Processor -------------------------------------
434
+
435
+ export const relationalDatabaseConnection_addPostProcessor = action(
436
+ (
437
+ connectionValueState: RelationalDatabaseConnectionValueState,
438
+ postProcessor: PostProcessor,
439
+ observerContext: ObserverContext,
440
+ ): void => {
441
+ addUniqueEntry(
442
+ connectionValueState.connection.postProcessors,
443
+ observe_PostProcessor(postProcessor, observerContext),
444
+ );
445
+ },
446
+ );
447
+
448
+ export const relationalDatabaseConnection_deletePostProcessor = action(
449
+ (
450
+ connectionValueState: RelationalDatabaseConnectionValueState,
451
+ postProcessor: PostProcessor,
452
+ ): void => {
453
+ deleteEntry(connectionValueState.connection.postProcessors, postProcessor);
454
+ },
455
+ );
456
+
457
+ export const mapperPostProcessor_addMapper = action(
458
+ (mapperPostProcessor: MapperPostProcessor, mapper: Mapper): void => {
459
+ addUniqueEntry(mapperPostProcessor.mappers, observe_Mapper(mapper));
460
+ },
461
+ );
462
+
463
+ export const mapper_setFrom = action((mapper: Mapper, val: string): void => {
464
+ mapper.from = val;
465
+ });
466
+
467
+ export const mapper_setTo = action((mapper: Mapper, val: string): void => {
468
+ mapper.to = val;
469
+ });
470
+
471
+ export const schemaNameMapper_setTo = action(
472
+ (schemaNameMapper: SchemaNameMapper, val: string): void => {
473
+ schemaNameMapper.to = val;
474
+ },
475
+ );
476
+
477
+ export const schemaNameMapper_setFrom = action(
478
+ (schemaNameMapper: SchemaNameMapper, val: string): void => {
479
+ schemaNameMapper.from = val;
480
+ },
481
+ );
482
+
483
+ export const mapperPostProcessor_deleteMapper = action(
484
+ (mapperPostProcessor: MapperPostProcessor, val: Mapper): void => {
485
+ deleteEntry(mapperPostProcessor.mappers, val);
486
+ },
487
+ );
@@ -46,7 +46,6 @@ import {
46
46
  filterByType,
47
47
  } from '@finos/legend-shared';
48
48
  import { action, flow, makeObservable, observable } from 'mobx';
49
- import { getElementTypeIcon } from '../../../components/shared/ElementIconUtils.js';
50
49
  import type { EditorSDLCState } from '../../EditorSDLCState.js';
51
50
  import type { EditorStore } from '../../EditorStore.js';
52
51
  import type {
@@ -56,10 +55,9 @@ import type {
56
55
 
57
56
  // Testable Metadata
58
57
  export interface TestableMetadata {
59
- testable: Testable;
60
58
  id: string;
61
59
  name: string;
62
- icon: React.ReactNode;
60
+ testable: Testable;
63
61
  }
64
62
 
65
63
  export const getTestableMetadata = (
@@ -69,7 +67,7 @@ export const getTestableMetadata = (
69
67
  ): TestableMetadata => {
70
68
  if (testable instanceof PackageableElement) {
71
69
  return {
72
- testable: testable,
70
+ testable,
73
71
  id:
74
72
  getNullableIDFromTestable(
75
73
  testable,
@@ -77,10 +75,6 @@ export const getTestableMetadata = (
77
75
  editorStore.graphManagerState.pluginManager.getPureGraphManagerPlugins(),
78
76
  ) ?? uuid(),
79
77
  name: testable.name,
80
- icon: getElementTypeIcon(
81
- editorStore,
82
- editorStore.graphState.getPackageableElementType(testable),
83
- ),
84
78
  };
85
79
  }
86
80
  const extraTestables = extraTestableMetadataGetters
@@ -91,7 +85,6 @@ export const getTestableMetadata = (
91
85
  testable,
92
86
  id: uuid(),
93
87
  name: '(unknown)',
94
- icon: null,
95
88
  }
96
89
  );
97
90
  };