@finos/legend-application-studio 13.0.1 → 13.1.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 (189) hide show
  1. package/lib/components/editor/command/project-search.css +1 -1
  2. package/lib/components/editor/command/project-search.css.map +1 -1
  3. package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
  4. package/lib/components/editor/command-center/ProjectSearchCommand.js +11 -3
  5. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  6. package/lib/components/editor/edit-panel/FunctionEditor.d.ts.map +1 -1
  7. package/lib/components/editor/edit-panel/FunctionEditor.js +41 -34
  8. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  9. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
  10. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +35 -54
  11. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
  12. package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
  13. package/lib/components/editor/edit-panel/GrammarTextEditor.js +2 -2
  14. package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
  15. package/lib/components/editor/edit-panel/RuntimeEditor.d.ts.map +1 -1
  16. package/lib/components/editor/edit-panel/RuntimeEditor.js +11 -20
  17. package/lib/components/editor/edit-panel/RuntimeEditor.js.map +1 -1
  18. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.d.ts.map +1 -1
  19. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js +4 -8
  20. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js.map +1 -1
  21. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js +1 -1
  22. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js.map +1 -1
  23. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  24. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +3 -7
  25. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
  26. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.d.ts.map +1 -1
  27. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js +2 -2
  28. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js.map +1 -1
  29. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +1 -1
  30. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
  31. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  32. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +2 -9
  33. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.d.ts.map +1 -1
  35. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js +3 -4
  36. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
  38. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +3 -10
  39. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  41. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js +4 -10
  42. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  43. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js +7 -9
  44. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js.map +1 -1
  45. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.d.ts.map +1 -1
  46. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js +9 -12
  47. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js.map +1 -1
  48. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
  49. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js +12 -10
  50. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js.map +1 -1
  51. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +2 -2
  52. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  53. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.d.ts.map +1 -1
  54. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js +5 -7
  55. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js.map +1 -1
  56. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.d.ts.map +1 -1
  57. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js +3 -4
  58. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js.map +1 -1
  59. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.d.ts.map +1 -1
  60. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js +1 -1
  61. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js.map +1 -1
  62. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  63. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +3 -5
  64. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  65. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  66. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +9 -6
  67. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  68. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +1 -1
  69. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  70. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  71. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +4 -8
  72. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  73. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  74. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +157 -57
  75. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  76. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.d.ts.map +1 -1
  77. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js +39 -21
  78. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js.map +1 -1
  79. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.d.ts.map +1 -1
  80. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js +62 -9
  81. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js.map +1 -1
  82. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.d.ts.map +1 -1
  83. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js +4 -8
  84. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js.map +1 -1
  85. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts +7 -1
  86. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
  87. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +33 -5
  88. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  89. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts +7 -1
  90. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  91. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +35 -7
  92. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  93. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  94. package/lib/components/editor/side-bar/CreateNewElementModal.js +4 -4
  95. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  96. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  97. package/lib/components/editor/side-bar/Explorer.js +8 -15
  98. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  99. package/lib/components/shared/StudioLambdaEditor.d.ts +1 -0
  100. package/lib/components/shared/StudioLambdaEditor.d.ts.map +1 -1
  101. package/lib/components/shared/StudioLambdaEditor.js +2 -2
  102. package/lib/components/shared/StudioLambdaEditor.js.map +1 -1
  103. package/lib/components/workspace-setup/WorkspaceSetup.js +1 -1
  104. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  105. package/lib/index.css +2 -2
  106. package/lib/index.css.map +1 -1
  107. package/lib/package.json +5 -5
  108. package/lib/stores/EditorStore.d.ts.map +1 -1
  109. package/lib/stores/EditorStore.js +7 -7
  110. package/lib/stores/EditorStore.js.map +1 -1
  111. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  112. package/lib/stores/editor/NewElementState.js +8 -2
  113. package/lib/stores/editor/NewElementState.js.map +1 -1
  114. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts +0 -2
  115. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts.map +1 -1
  116. package/lib/stores/editor-state/GenerationSpecificationEditorState.js +1 -8
  117. package/lib/stores/editor-state/GenerationSpecificationEditorState.js.map +1 -1
  118. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  119. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +2 -4
  120. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  121. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
  122. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  123. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
  124. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  125. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.d.ts +4 -1
  126. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.d.ts.map +1 -1
  127. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js +31 -15
  128. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js.map +1 -1
  129. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +6 -3
  130. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  131. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +30 -17
  132. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  133. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js +1 -1
  134. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  135. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts +10 -0
  136. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts.map +1 -1
  137. package/lib/stores/graphModifier/DomainGraphModifierHelper.js +31 -1
  138. package/lib/stores/graphModifier/DomainGraphModifierHelper.js.map +1 -1
  139. package/lib/stores/shared/DnDUtil.d.ts +1 -2
  140. package/lib/stores/shared/DnDUtil.d.ts.map +1 -1
  141. package/lib/stores/shared/DnDUtil.js +0 -2
  142. package/lib/stores/shared/DnDUtil.js.map +1 -1
  143. package/package.json +13 -13
  144. package/src/components/editor/command-center/ProjectSearchCommand.tsx +13 -2
  145. package/src/components/editor/edit-panel/FunctionEditor.tsx +220 -152
  146. package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +154 -184
  147. package/src/components/editor/edit-panel/GrammarTextEditor.tsx +4 -5
  148. package/src/components/editor/edit-panel/RuntimeEditor.tsx +89 -90
  149. package/src/components/editor/edit-panel/data-editor/DataElementEditor.tsx +57 -40
  150. package/src/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.tsx +1 -1
  151. package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +50 -45
  152. package/src/components/editor/edit-panel/external-format-editor/BindingElementEditor.tsx +36 -32
  153. package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +1 -1
  154. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +46 -41
  155. package/src/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.tsx +9 -7
  156. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +18 -21
  157. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.tsx +39 -29
  158. package/src/components/editor/edit-panel/mapping-editor/MappingExplorer.tsx +39 -39
  159. package/src/components/editor/edit-panel/mapping-editor/MappingTestEditor.tsx +82 -58
  160. package/src/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.tsx +66 -50
  161. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +2 -2
  162. package/src/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.tsx +48 -45
  163. package/src/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.tsx +12 -8
  164. package/src/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.tsx +2 -3
  165. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +75 -72
  166. package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +63 -43
  167. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +1 -1
  168. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +55 -38
  169. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +813 -499
  170. package/src/components/editor/edit-panel/uml-editor/EnumerationEditor.tsx +209 -113
  171. package/src/components/editor/edit-panel/uml-editor/ProfileEditor.tsx +184 -52
  172. package/src/components/editor/edit-panel/uml-editor/PropertyEditor.tsx +62 -39
  173. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +137 -52
  174. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +171 -88
  175. package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -2
  176. package/src/components/editor/side-bar/Explorer.tsx +13 -20
  177. package/src/components/shared/StudioLambdaEditor.tsx +3 -0
  178. package/src/components/workspace-setup/WorkspaceSetup.tsx +1 -1
  179. package/src/stores/EditorStore.ts +7 -6
  180. package/src/stores/editor/NewElementState.ts +8 -2
  181. package/src/stores/editor-state/GenerationSpecificationEditorState.ts +1 -15
  182. package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +2 -3
  183. package/src/stores/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -1
  184. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
  185. package/src/stores/editor-state/element-editor-state/mapping/MappingTestState.ts +46 -29
  186. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +39 -20
  187. package/src/stores/editor-state/element-editor-state/service/ServiceRegistrationState.ts +1 -1
  188. package/src/stores/graphModifier/DomainGraphModifierHelper.ts +92 -0
  189. package/src/stores/shared/DnDUtil.ts +0 -2
@@ -70,7 +70,7 @@ const CreateWorkspaceModal = observer(() => {
70
70
  setupStore.currentProjectId,
71
71
  );
72
72
  const [workspaceName, setWorkspaceName] = useState('');
73
- const [isGroupWorkspace, setIsGroupWorkspace] = useState<boolean>(false);
73
+ const [isGroupWorkspace, setIsGroupWorkspace] = useState<boolean>(true);
74
74
  const workspaceType = isGroupWorkspace
75
75
  ? WorkspaceType.GROUP
76
76
  : WorkspaceType.USER;
@@ -117,6 +117,7 @@ import {
117
117
  PRIMITIVE_TYPE,
118
118
  Package,
119
119
  DataElement,
120
+ isElementReadOnly,
120
121
  } from '@finos/legend-graph';
121
122
  import type { DepotServerClient } from '@finos/legend-server-depot';
122
123
  import type { LegendStudioPluginManager } from '../application/LegendStudioPluginManager.js';
@@ -1121,7 +1122,7 @@ export class EditorStore {
1121
1122
  *deleteElement(element: PackageableElement): GeneratorFn<void> {
1122
1123
  if (
1123
1124
  this.graphState.checkIfApplicationUpdateOperationIsRunning() ||
1124
- this.graphManagerState.isElementReadOnly(element)
1125
+ isElementReadOnly(element)
1125
1126
  ) {
1126
1127
  return;
1127
1128
  }
@@ -1187,7 +1188,7 @@ export class EditorStore {
1187
1188
  element: PackageableElement,
1188
1189
  newPath: string,
1189
1190
  ): GeneratorFn<void> {
1190
- if (this.graphManagerState.isElementReadOnly(element)) {
1191
+ if (isElementReadOnly(element)) {
1191
1192
  return;
1192
1193
  }
1193
1194
  graph_renameElement(
@@ -1354,7 +1355,7 @@ export class EditorStore {
1354
1355
  get classOptions(): PackageableElementOption<Class>[] {
1355
1356
  return this.graphManagerState.graph.ownClasses
1356
1357
  .concat(
1357
- this.graphManagerState.filterSystemElementOptions(
1358
+ this.graphManagerState.collectExposedSystemElements(
1358
1359
  this.graphManagerState.graph.systemModel.ownClasses,
1359
1360
  ),
1360
1361
  )
@@ -1365,7 +1366,7 @@ export class EditorStore {
1365
1366
  get associationOptions(): PackageableElementOption<Association>[] {
1366
1367
  return this.graphManagerState.graph.ownAssociations
1367
1368
  .concat(
1368
- this.graphManagerState.filterSystemElementOptions(
1369
+ this.graphManagerState.collectExposedSystemElements(
1369
1370
  this.graphManagerState.graph.systemModel.ownAssociations,
1370
1371
  ),
1371
1372
  )
@@ -1376,7 +1377,7 @@ export class EditorStore {
1376
1377
  get profileOptions(): PackageableElementOption<Profile>[] {
1377
1378
  return this.graphManagerState.graph.ownProfiles
1378
1379
  .concat(
1379
- this.graphManagerState.filterSystemElementOptions(
1380
+ this.graphManagerState.collectExposedSystemElements(
1380
1381
  this.graphManagerState.graph.systemModel.ownProfiles,
1381
1382
  ),
1382
1383
  )
@@ -1391,7 +1392,7 @@ export class EditorStore {
1391
1392
  .concat(
1392
1393
  this.graphManagerState.graph.ownTypes
1393
1394
  .concat(
1394
- this.graphManagerState.filterSystemElementOptions(
1395
+ this.graphManagerState.collectExposedSystemElements(
1395
1396
  this.graphManagerState.graph.systemModel.ownTypes,
1396
1397
  ),
1397
1398
  )
@@ -758,8 +758,8 @@ export class NewElementState {
758
758
  element = new Profile(name);
759
759
  break;
760
760
  // default for function -> return type: String, return Multiplicity 1
761
- case PACKAGEABLE_ELEMENT_TYPE.FUNCTION:
762
- element = new ConcreteFunctionDefinition(
761
+ case PACKAGEABLE_ELEMENT_TYPE.FUNCTION: {
762
+ const fn = new ConcreteFunctionDefinition(
763
763
  name,
764
764
  PackageableElementExplicitReference.create(
765
765
  this.editorStore.graphManagerState.graph.getPrimitiveType(
@@ -770,7 +770,13 @@ export class NewElementState {
770
770
  TYPICAL_MULTIPLICITY_TYPE.ONE,
771
771
  ),
772
772
  );
773
+ // default to empty string
774
+ fn.expressionSequence =
775
+ this.editorStore.graphManagerState.graphManager.createDefaultBasicRawLambda()
776
+ .body as object[];
777
+ element = fn;
773
778
  break;
779
+ }
774
780
  case PACKAGEABLE_ELEMENT_TYPE.MAPPING:
775
781
  element = new Mapping(name);
776
782
  break;
@@ -22,13 +22,7 @@ import {
22
22
  deleteEntry,
23
23
  guaranteeNonNullable,
24
24
  } from '@finos/legend-shared';
25
- import {
26
- computed,
27
- observable,
28
- makeObservable,
29
- makeAutoObservable,
30
- action,
31
- } from 'mobx';
25
+ import { computed, observable, makeObservable, action } from 'mobx';
32
26
  import type { EditorStore } from '../EditorStore.js';
33
27
  import {
34
28
  GenerationSpecification,
@@ -48,18 +42,10 @@ export type GenerationSpecNodeDropTarget = GenerationSpecNodeDragSource;
48
42
  export class GenerationTreeNodeState {
49
43
  readonly uuid = uuid();
50
44
  node: GenerationTreeNode;
51
- isBeingDragged = false;
52
45
 
53
46
  constructor(node: GenerationTreeNode) {
54
- makeAutoObservable(this, {
55
- setIsBeingDragged: action,
56
- });
57
47
  this.node = node;
58
48
  }
59
-
60
- setIsBeingDragged(val: boolean): void {
61
- this.isBeingDragged = val;
62
- }
63
49
  }
64
50
 
65
51
  export class GenerationSpecificationEditorState extends ElementEditorState {
@@ -27,6 +27,7 @@ import {
27
27
  type CompilationError,
28
28
  type PackageableElement,
29
29
  GRAPH_MANAGER_EVENT,
30
+ isElementReadOnly,
30
31
  } from '@finos/legend-graph';
31
32
  import { TAB_SIZE } from '@finos/legend-application';
32
33
 
@@ -61,9 +62,7 @@ export abstract class ElementEditorState extends EditorState {
61
62
  });
62
63
 
63
64
  this.element = element;
64
- this.isReadOnly =
65
- editorStore.graphManagerState.isElementReadOnly(element) ||
66
- editorStore.isInViewerMode;
65
+ this.isReadOnly = isElementReadOnly(element) || editorStore.isInViewerMode;
67
66
  }
68
67
 
69
68
  get headerName(): string {
@@ -1468,7 +1468,7 @@ export class MappingEditorState extends ElementEditorState {
1468
1468
 
1469
1469
  *createNewTest(setImplementation: SetImplementation): GeneratorFn<void> {
1470
1470
  const query =
1471
- this.editorStore.graphManagerState.graphManager.HACKY__createGetAllLambda(
1471
+ this.editorStore.graphManagerState.graphManager.createGetAllRawLambda(
1472
1472
  setImplementation.class.value,
1473
1473
  );
1474
1474
  const source = getMappingElementSource(
@@ -834,7 +834,7 @@ export class MappingExecutionState {
834
834
  yield flowResult(
835
835
  this.queryState.updateLamba(
836
836
  setImplementation
837
- ? this.editorStore.graphManagerState.graphManager.HACKY__createGetAllLambda(
837
+ ? this.editorStore.graphManagerState.graphManager.createGetAllRawLambda(
838
838
  guaranteeType(getMappingElementTarget(setImplementation), Class),
839
839
  )
840
840
  : stub_RawLambda(),
@@ -412,6 +412,7 @@ export class MappingTestState {
412
412
  assertionState: MappingTestAssertionState;
413
413
  isGeneratingPlan = false;
414
414
  executionPlanState: ExecutionPlanState;
415
+ testRunPromise: Promise<ExecutionResult> | undefined = undefined;
415
416
 
416
417
  constructor(
417
418
  editorStore: EditorStore,
@@ -423,6 +424,7 @@ export class MappingTestState {
423
424
  editorStore: false,
424
425
  mappingEditorState: false,
425
426
  executionPlanState: false,
427
+ setIsRunningTest: action,
426
428
  setSelectedTab: action,
427
429
  resetTestRunStatus: action,
428
430
  setResult: action,
@@ -447,10 +449,18 @@ export class MappingTestState {
447
449
  );
448
450
  }
449
451
 
452
+ setIsRunningTest(val: boolean): void {
453
+ this.isRunningTest = val;
454
+ }
455
+
450
456
  setSelectedTab(val: MAPPING_TEST_EDITOR_TAB_TYPE): void {
451
457
  this.selectedTab = val;
452
458
  }
453
459
 
460
+ setTestRunPromise = (promise: Promise<ExecutionResult> | undefined): void => {
461
+ this.testRunPromise = promise;
462
+ };
463
+
454
464
  buildQueryState(): MappingTestQueryState {
455
465
  const queryState = new MappingTestQueryState(
456
466
  this.editorStore,
@@ -674,52 +684,59 @@ export class MappingTestState {
674
684
  return;
675
685
  }
676
686
  const startTime = Date.now();
687
+ let promise;
677
688
  try {
678
689
  const runtime = this.inputDataState.runtime;
679
690
  this.isRunningTest = true;
680
- const result =
681
- (yield this.editorStore.graphManagerState.graphManager.executeMapping(
682
- this.test.query,
683
- this.mappingEditorState.mapping,
684
- runtime,
685
- this.editorStore.graphManagerState.graph,
686
- {
687
- useLosslessParse: true,
688
- },
689
- )) as ExecutionResult;
690
- this.testExecutionResultText = losslessStringify(
691
- extractExecutionResultValues(result),
692
- undefined,
693
- TAB_SIZE,
691
+ promise = this.editorStore.graphManagerState.graphManager.executeMapping(
692
+ this.test.query,
693
+ this.mappingEditorState.mapping,
694
+ runtime,
695
+ this.editorStore.graphManagerState.graph,
696
+ {
697
+ useLosslessParse: true,
698
+ },
694
699
  );
695
- let assertionMatched = false;
696
- if (
697
- this.assertionState instanceof MappingTestExpectedOutputAssertionState
698
- ) {
699
- // TODO: this logic should probably be better handled in by engine mapping test runner
700
- assertionMatched =
701
- hashObject(extractExecutionResultValues(result)) ===
702
- hashObject(losslessParse(this.assertionState.expectedResult));
703
- } else {
704
- throw new UnsupportedOperationError();
700
+ this.setTestRunPromise(promise);
701
+ const result = (yield promise) as ExecutionResult;
702
+ if (this.testRunPromise === promise) {
703
+ this.testExecutionResultText = losslessStringify(
704
+ extractExecutionResultValues(result),
705
+ undefined,
706
+ TAB_SIZE,
707
+ );
708
+ let assertionMatched = false;
709
+ if (
710
+ this.assertionState instanceof MappingTestExpectedOutputAssertionState
711
+ ) {
712
+ // TODO: this logic should probably be better handled in by engine mapping test runner
713
+ assertionMatched =
714
+ hashObject(extractExecutionResultValues(result)) ===
715
+ hashObject(losslessParse(this.assertionState.expectedResult));
716
+ } else {
717
+ throw new UnsupportedOperationError();
718
+ }
719
+ this.setResult(
720
+ assertionMatched ? TEST_RESULT.PASSED : TEST_RESULT.FAILED,
721
+ );
705
722
  }
706
- this.setResult(
707
- assertionMatched ? TEST_RESULT.PASSED : TEST_RESULT.FAILED,
708
- );
709
723
  } catch (error) {
710
724
  assertErrorThrown(error);
711
725
  this.editorStore.applicationStore.log.error(
712
726
  LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
713
727
  error,
714
728
  );
715
- this.errorRunningTest = error;
716
- this.setResult(TEST_RESULT.ERROR);
729
+ if (this.testRunPromise === promise) {
730
+ this.errorRunningTest = error;
731
+ this.setResult(TEST_RESULT.ERROR);
732
+ }
717
733
  } finally {
718
734
  this.isRunningTest = false;
719
735
  this.runTime = Date.now() - startTime;
720
736
  // if the test is currently opened and ran but did not pass, switch to the result tab
721
737
  if (
722
738
  [TEST_RESULT.FAILED, TEST_RESULT.ERROR].includes(this.result) &&
739
+ this.testRunPromise === promise &&
723
740
  this.mappingEditorState.currentTabState === this
724
741
  ) {
725
742
  this.setSelectedTab(MAPPING_TEST_EDITOR_TAB_TYPE.RESULT);
@@ -102,7 +102,7 @@ export class ServiceExecutionParameterState extends LambdaParametersState {
102
102
  this.parameterStates = this.build(query);
103
103
  this.parameterValuesEditorState.open(
104
104
  (): Promise<void> =>
105
- flowResult(this.executionState.execute()).catch(
105
+ flowResult(this.executionState.runQuery()).catch(
106
106
  this.executionState.editorStore.applicationStore.alertUnhandledError,
107
107
  ),
108
108
  PARAMETER_SUBMIT_ACTION.EXECUTE,
@@ -440,13 +440,14 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
440
440
  declare execution: PureExecution;
441
441
  selectedExecutionContextState: ServiceExecutionContextState | undefined;
442
442
  runtimeEditorState?: RuntimeEditorState | undefined;
443
- isExecuting = false;
443
+ isRunningQuery = false;
444
444
  isGeneratingPlan = false;
445
445
  isOpeningQueryEditor = false;
446
446
  executionResultText?: string | undefined; // NOTE: stored as lossless JSON string
447
447
  executionPlanState: ExecutionPlanState;
448
448
  parameterState: ServiceExecutionParameterState;
449
449
  showChangeExecModal = false;
450
+ queryRunPromise: Promise<ExecutionResult> | undefined = undefined;
450
451
 
451
452
  constructor(
452
453
  editorStore: EditorStore,
@@ -473,6 +474,10 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
473
474
  return false;
474
475
  }
475
476
 
477
+ setIsRunningQuery(val: boolean): void {
478
+ this.isRunningQuery = val;
479
+ }
480
+
476
481
  setShowChangeExecModal(val: boolean): void {
477
482
  this.showChangeExecModal = val;
478
483
  }
@@ -480,13 +485,21 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
480
485
  setOpeningQueryEditor(val: boolean): void {
481
486
  this.isOpeningQueryEditor = val;
482
487
  }
488
+
483
489
  setExecutionResultText = (executionResult: string | undefined): void => {
484
490
  this.executionResultText = executionResult;
485
491
  };
492
+
486
493
  setQueryState = (queryState: ServicePureExecutionQueryState): void => {
487
494
  this.queryState = queryState;
488
495
  };
489
496
 
497
+ setQueryRunPromise = (
498
+ promise: Promise<ExecutionResult> | undefined,
499
+ ): void => {
500
+ this.queryRunPromise = promise;
501
+ };
502
+
490
503
  *generatePlan(debug: boolean): GeneratorFn<void> {
491
504
  if (!this.selectedExecutionContextState || this.isGeneratingPlan) {
492
505
  return;
@@ -538,7 +551,7 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
538
551
  }
539
552
 
540
553
  *handleExecute(): GeneratorFn<void> {
541
- if (!this.selectedExecutionContextState || this.isExecuting) {
554
+ if (!this.selectedExecutionContextState || this.isRunningQuery) {
542
555
  return;
543
556
  }
544
557
  const query = this.queryState.query;
@@ -546,19 +559,19 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
546
559
  if (parameters.length) {
547
560
  this.parameterState.openModal(query);
548
561
  } else {
549
- this.execute();
562
+ this.runQuery();
550
563
  }
551
564
  }
552
565
 
553
- *execute(): GeneratorFn<void> {
554
- if (!this.selectedExecutionContextState || this.isExecuting) {
566
+ *runQuery(): GeneratorFn<void> {
567
+ if (!this.selectedExecutionContextState || this.isRunningQuery) {
555
568
  return;
556
569
  }
557
570
  try {
558
- this.isExecuting = true;
571
+ this.isRunningQuery = true;
559
572
  const query = this.getExecutionQuery();
560
- const result =
561
- (yield this.editorStore.graphManagerState.graphManager.executeMapping(
573
+ const promise =
574
+ this.editorStore.graphManagerState.graphManager.executeMapping(
562
575
  query,
563
576
  this.selectedExecutionContextState.executionContext.mapping.value,
564
577
  this.selectedExecutionContextState.executionContext.runtime,
@@ -566,11 +579,15 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
566
579
  {
567
580
  useLosslessParse: true,
568
581
  },
569
- )) as ExecutionResult;
570
- this.setExecutionResultText(
571
- losslessStringify(result, undefined, TAB_SIZE),
572
- );
573
- this.parameterState.setParameters([]);
582
+ );
583
+ this.setQueryRunPromise(promise);
584
+ const result = (yield promise) as ExecutionResult;
585
+ if (this.queryRunPromise === promise) {
586
+ this.setExecutionResultText(
587
+ losslessStringify(result, undefined, TAB_SIZE),
588
+ );
589
+ this.parameterState.setParameters([]);
590
+ }
574
591
  } catch (error) {
575
592
  assertErrorThrown(error);
576
593
  this.editorStore.applicationStore.log.error(
@@ -579,7 +596,7 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
579
596
  );
580
597
  this.editorStore.applicationStore.notifyError(error);
581
598
  } finally {
582
- this.isExecuting = false;
599
+ this.isRunningQuery = false;
583
600
  }
584
601
  }
585
602
 
@@ -611,7 +628,7 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
611
628
  get serviceExecutionParameters():
612
629
  | { query: RawLambda; mapping: Mapping; runtime: Runtime }
613
630
  | undefined {
614
- if (!this.selectedExecutionContextState || this.isExecuting) {
631
+ if (!this.selectedExecutionContextState || this.isRunningQuery) {
615
632
  return undefined;
616
633
  }
617
634
  const query = this.queryState.query;
@@ -701,7 +718,7 @@ export class SingleServicePureExecutionState extends ServicePureExecutionState {
701
718
  queryState: observable,
702
719
  getInitiallySelectedExecutionContextState: observable,
703
720
  runtimeEditorState: observable,
704
- isExecuting: observable,
721
+ isRunningQuery: observable,
705
722
  isGeneratingPlan: observable,
706
723
  isOpeningQueryEditor: observable,
707
724
  executionResultText: observable,
@@ -720,9 +737,10 @@ export class SingleServicePureExecutionState extends ServicePureExecutionState {
720
737
  changeExecution: action,
721
738
  setMultiExecutionKey: action,
722
739
  setShowChangeExecModal: action,
740
+ setIsRunningQuery: action,
723
741
  generatePlan: flow,
724
742
  handleExecute: flow,
725
- execute: flow,
743
+ runQuery: flow,
726
744
  });
727
745
  this.selectedExecutionContextState =
728
746
  this.getInitiallySelectedExecutionContextState();
@@ -778,7 +796,7 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
778
796
  queryState: observable,
779
797
  selectedExecutionContextState: observable,
780
798
  runtimeEditorState: observable,
781
- isExecuting: observable,
799
+ isRunningQuery: observable,
782
800
  isGeneratingPlan: observable,
783
801
  isOpeningQueryEditor: observable,
784
802
  executionResultText: observable,
@@ -804,9 +822,10 @@ export class MultiServicePureExecutionState extends ServicePureExecutionState {
804
822
  changeKeyValue: action,
805
823
  setSingleExecutionKey: action,
806
824
  setShowChangeExecModal: action,
825
+ setIsRunningQuery: action,
807
826
  changeExecution: action,
808
827
  generatePlan: flow,
809
- execute: flow,
828
+ runQuery: flow,
810
829
  });
811
830
 
812
831
  this.execution = execution;
@@ -237,7 +237,7 @@ export class ServiceRegistrationState {
237
237
  serviceRegistrationResult.pattern,
238
238
  'Service registration pattern is missing',
239
239
  );
240
- const message = `Service with patten ${
240
+ const message = `Service with pattern ${
241
241
  serviceRegistrationResult.pattern
242
242
  } registered ${this.activatePostRegistration ? 'and activated ' : ''}`;
243
243
  const encodedServicePattern =
@@ -19,6 +19,7 @@ import {
19
19
  assertTrue,
20
20
  deleteEntry,
21
21
  guaranteeType,
22
+ swapEntry,
22
23
  } from '@finos/legend-shared';
23
24
  import { action } from 'mobx';
24
25
  import {
@@ -90,6 +91,12 @@ export const class_addProperty = action(
90
91
  },
91
92
  );
92
93
 
94
+ export const class_swapProperties = action(
95
+ (_class: Class, sourceProperty: Property, targetProperty: Property): void => {
96
+ swapEntry(_class.properties, sourceProperty, targetProperty);
97
+ },
98
+ );
99
+
93
100
  export const class_deleteDerivedProperty = action(
94
101
  (_class: Class, val: DerivedProperty): void => {
95
102
  deleteEntry(_class.derivedProperties, val);
@@ -100,6 +107,17 @@ export const class_addDerivedProperty = action(
100
107
  addUniqueEntry(_class.derivedProperties, observe_DerivedProperty(val));
101
108
  },
102
109
  );
110
+
111
+ export const class_swapDerivedProperties = action(
112
+ (
113
+ _class: Class,
114
+ sourceProperty: DerivedProperty,
115
+ targetProperty: DerivedProperty,
116
+ ): void => {
117
+ swapEntry(_class.derivedProperties, sourceProperty, targetProperty);
118
+ },
119
+ );
120
+
103
121
  export const class_addContraint = action(
104
122
  (_class: Class, val: Constraint): void => {
105
123
  addUniqueEntry(_class.constraints, observe_Constraint(val));
@@ -110,6 +128,16 @@ export const class_deleteConstraint = action(
110
128
  deleteEntry(_class.constraints, val);
111
129
  },
112
130
  );
131
+ export const class_swapConstraints = action(
132
+ (
133
+ _class: Class,
134
+ sourceConstraint: Constraint,
135
+ targetConstraint: Constraint,
136
+ ): void => {
137
+ swapEntry(_class.constraints, sourceConstraint, targetConstraint);
138
+ },
139
+ );
140
+
113
141
  export const class_addSuperType = action(
114
142
  (_class: Class, val: GenericTypeReference): void => {
115
143
  addUniqueEntry(_class.generalizations, observe_GenericTypeReference(val));
@@ -120,6 +148,15 @@ export const class_deleteSuperType = action(
120
148
  deleteEntry(_class.generalizations, val);
121
149
  },
122
150
  );
151
+ export const class_swapSuperTypes = action(
152
+ (
153
+ _class: Class,
154
+ sourceSuperType: GenericTypeReference,
155
+ targetSuperType: GenericTypeReference,
156
+ ): void => {
157
+ swapEntry(_class.generalizations, sourceSuperType, targetSuperType);
158
+ },
159
+ );
123
160
  export const class_addSubclass = action((_class: Class, val: Class): void => {
124
161
  addUniqueEntry(_class._subclasses, val);
125
162
  });
@@ -211,6 +248,30 @@ export const tagStereotype_setValue = action(
211
248
  },
212
249
  );
213
250
 
251
+ export const annotatedElement_swapTaggedValues = action(
252
+ (
253
+ annotatedElement: AnnotatedElement,
254
+ sourceTaggedValue: TaggedValue,
255
+ targetTaggedValue: TaggedValue,
256
+ ): void => {
257
+ swapEntry(
258
+ annotatedElement.taggedValues,
259
+ sourceTaggedValue,
260
+ targetTaggedValue,
261
+ );
262
+ },
263
+ );
264
+
265
+ export const annotatedElement_swapStereotypes = action(
266
+ (
267
+ annotatedElement: AnnotatedElement,
268
+ sourceStereotype: StereotypeReference,
269
+ targetStereotype: StereotypeReference,
270
+ ): void => {
271
+ swapEntry(annotatedElement.stereotypes, sourceStereotype, targetStereotype);
272
+ },
273
+ );
274
+
214
275
  // --------------------------------------------- DerivedProperty -------------------------------------
215
276
 
216
277
  export const derivedProperty_setBody = (
@@ -260,6 +321,22 @@ export const profile_deleteStereotype = action(
260
321
  },
261
322
  );
262
323
 
324
+ export const profile_swapTags = action(
325
+ (profile: Profile, sourceTag: Tag, targetTag: Tag): void => {
326
+ swapEntry(profile.p_tags, sourceTag, targetTag);
327
+ },
328
+ );
329
+
330
+ export const profile_swapStereotypes = action(
331
+ (
332
+ profile: Profile,
333
+ sourceStereotype: Stereotype,
334
+ targetStereotype: Stereotype,
335
+ ): void => {
336
+ swapEntry(profile.p_stereotypes, sourceStereotype, targetStereotype);
337
+ },
338
+ );
339
+
263
340
  // --------------------------------------------- Function -------------------------------------
264
341
 
265
342
  export const function_deleteParameter = action(
@@ -283,6 +360,16 @@ export const function_setReturnMultiplicity = action(
283
360
  },
284
361
  );
285
362
 
363
+ export const function_swapParameters = action(
364
+ (
365
+ _func: ConcreteFunctionDefinition,
366
+ sourceParameter: RawVariableExpression,
367
+ targetParameter: RawVariableExpression,
368
+ ): void => {
369
+ swapEntry(_func.parameters, sourceParameter, targetParameter);
370
+ },
371
+ );
372
+
286
373
  // --------------------------------------------- Enumeration -------------------------------------
287
374
 
288
375
  export const enum_setName = action((val: Enum, value: string): void => {
@@ -298,6 +385,11 @@ export const enum_deleteValue = action(
298
385
  deleteEntry(enumeration.values, value);
299
386
  },
300
387
  );
388
+ export const enum_swapValues = action(
389
+ (enumeration: Enumeration, sourceEnum: Enum, targetEnum: Enum): void => {
390
+ swapEntry(enumeration.values, sourceEnum, targetEnum);
391
+ },
392
+ );
301
393
  export const enumValueReference_setValue = action(
302
394
  (ref: EnumValueReference, value: Enum): void => {
303
395
  ref.value = observe_Enum(value);
@@ -49,8 +49,6 @@ export enum CORE_DND_TYPE {
49
49
  MAPPING_EXPLORER_CLASS_MAPPING = 'MAPPING_EXPLORER_CLASS_MAPPING',
50
50
  MAPPING_EXPLORER_ENUMERATION_MAPPING = 'MAPPING_EXPLORER_ENUMERATION_MAPPING',
51
51
  MAPPING_EXPLORER_ASSOCIATION_MAPPING = 'MAPPING_EXPLORER_ASSOCIATION_MAPPING',
52
- // gen spec node
53
- GENERATION_SPEC_NODE = 'GENERATION_SPEC_NODE',
54
52
  }
55
53
 
56
54
  // React DnD uses Redux under the hood and also it champions the use of plain object over class instance