@finos/legend-application-studio 28.13.12 → 28.13.14

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 (131) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +3 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +4 -2
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
  6. package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioNavigation.js +2 -0
  8. package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +10 -0
  10. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendStudioTelemetryHelper.js +10 -0
  12. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  13. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  14. package/lib/components/LegendStudioWebApplication.js +7 -1
  15. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  16. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  17. package/lib/components/editor/ActivityBar.js +23 -14
  18. package/lib/components/editor/ActivityBar.js.map +1 -1
  19. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  20. package/lib/components/editor/editor-group/GrammarTextEditor.js +3 -2
  21. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  22. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.d.ts.map +1 -1
  23. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js +4 -3
  24. package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js.map +1 -1
  25. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts +1 -1
  26. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js +6 -13
  28. package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js.map +1 -1
  29. package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.d.ts → legacy/DEPRECATED__MappingTestEditor.d.ts} +1 -1
  30. package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.d.ts.map +1 -0
  31. package/lib/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.js → legacy/DEPRECATED__MappingTestEditor.js} +9 -9
  32. package/lib/components/editor/editor-group/mapping-editor/legacy/DEPRECATED__MappingTestEditor.js.map +1 -0
  33. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts +24 -0
  34. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.d.ts.map +1 -0
  35. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js +42 -0
  36. package/lib/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.js.map +1 -0
  37. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts +18 -0
  38. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts.map +1 -0
  39. package/lib/components/lazy-text-editor/LazyTextEditor.js +170 -0
  40. package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -0
  41. package/lib/components/workspace-setup/WorkspaceSetup.js +6 -6
  42. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  43. package/lib/index.css +2 -2
  44. package/lib/index.css.map +1 -1
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/package.json +1 -1
  50. package/lib/stores/ShowcaseManagerState.d.ts +3 -1
  51. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  52. package/lib/stores/ShowcaseManagerState.js +29 -8
  53. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  54. package/lib/stores/editor/EditorConfig.d.ts +2 -1
  55. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  56. package/lib/stores/editor/EditorConfig.js +1 -0
  57. package/lib/stores/editor/EditorConfig.js.map +1 -1
  58. package/lib/stores/editor/EditorGraphState.d.ts +1 -0
  59. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  60. package/lib/stores/editor/EditorGraphState.js +17 -0
  61. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  62. package/lib/stores/editor/EditorStore.d.ts +4 -0
  63. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  64. package/lib/stores/editor/EditorStore.js +62 -5
  65. package/lib/stores/editor/EditorStore.js.map +1 -1
  66. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +6 -1
  67. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  68. package/lib/stores/editor/GraphEditGrammarModeState.js +6 -1
  69. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  70. package/lib/stores/editor/GraphEditorMode.d.ts +6 -1
  71. package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
  72. package/lib/stores/editor/GraphEditorMode.js +3 -0
  73. package/lib/stores/editor/GraphEditorMode.js.map +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +6 -1
  75. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
  76. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +24 -5
  77. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  78. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +9 -9
  79. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  80. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +4 -4
  81. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  82. package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.d.ts → legacy/DEPRECATED__MappingTestState.d.ts} +12 -12
  83. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.d.ts.map +1 -0
  84. package/lib/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.js → legacy/DEPRECATED__MappingTestState.js} +9 -9
  85. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js.map +1 -0
  86. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts +72 -0
  87. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.d.ts.map +1 -0
  88. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js +281 -0
  89. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js.map +1 -0
  90. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -5
  91. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
  92. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
  93. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +30 -0
  94. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -0
  95. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +66 -0
  96. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -0
  97. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
  98. package/lib/stores/showcase/ShowcaseViewerStore.js +3 -0
  99. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
  100. package/package.json +11 -11
  101. package/src/__lib__/LegendStudioEvent.ts +4 -2
  102. package/src/__lib__/LegendStudioNavigation.ts +8 -0
  103. package/src/__lib__/LegendStudioTelemetryHelper.ts +32 -0
  104. package/src/components/LegendStudioWebApplication.tsx +13 -1
  105. package/src/components/editor/ActivityBar.tsx +118 -111
  106. package/src/components/editor/editor-group/GrammarTextEditor.tsx +6 -3
  107. package/src/components/editor/editor-group/mapping-editor/MappingEditor.tsx +9 -2
  108. package/src/components/editor/editor-group/mapping-editor/MappingTestsExplorer.tsx +16 -26
  109. package/src/components/editor/editor-group/mapping-editor/{DEPRECATED__MappingTestEditor.tsx → legacy/DEPRECATED__MappingTestEditor.tsx} +9 -9
  110. package/src/components/editor/editor-group/mapping-editor/legacy/MappingTestMigrationTool.tsx +156 -0
  111. package/src/components/lazy-text-editor/LazyTextEditor.tsx +458 -0
  112. package/src/components/workspace-setup/WorkspaceSetup.tsx +6 -6
  113. package/src/index.ts +1 -1
  114. package/src/stores/ShowcaseManagerState.ts +41 -11
  115. package/src/stores/editor/EditorConfig.ts +1 -0
  116. package/src/stores/editor/EditorGraphState.ts +25 -0
  117. package/src/stores/editor/EditorStore.ts +108 -7
  118. package/src/stores/editor/GraphEditGrammarModeState.ts +14 -2
  119. package/src/stores/editor/GraphEditorMode.ts +9 -1
  120. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +37 -10
  121. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +14 -14
  122. package/src/stores/editor/editor-state/element-editor-state/mapping/{DEPRECATED__MappingTestState.ts → legacy/DEPRECATED__MappingTestState.ts} +23 -22
  123. package/src/stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.ts +383 -0
  124. package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +8 -8
  125. package/src/stores/lazy-text-editor/LazyTextEditorStore.ts +99 -0
  126. package/src/stores/showcase/ShowcaseViewerStore.ts +6 -0
  127. package/tsconfig.json +6 -2
  128. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +0 -1
  129. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +0 -1
  130. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +0 -1
  131. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +0 -1
@@ -491,6 +491,31 @@ export class EditorGraphState {
491
491
  }
492
492
  }
493
493
 
494
+ *buildGraphForLazyText(): GeneratorFn<void> {
495
+ this.isInitializingGraph = true;
496
+ const stopWatch = new StopWatch();
497
+ // reset
498
+ this.editorStore.graphManagerState.resetGraph();
499
+ // fetch and build dependencies
500
+ stopWatch.record();
501
+ const dependencyManager =
502
+ this.editorStore.graphManagerState.graphManager.createDependencyManager();
503
+ this.editorStore.graphManagerState.graph.dependencyManager =
504
+ dependencyManager;
505
+ this.editorStore.graphManagerState.dependenciesBuildState.setMessage(
506
+ `Fetching dependencies...`,
507
+ );
508
+ const dependencyEntitiesIndex = (yield flowResult(
509
+ this.getIndexedDependencyEntities(),
510
+ )) as Map<string, EntitiesWithOrigin>;
511
+ stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
512
+ dependencyManager.initialize(dependencyEntitiesIndex);
513
+ this.isInitializingGraph = false;
514
+ this.editorStore.graphManagerState.dependenciesBuildState.sync(
515
+ ActionState.create().pass(),
516
+ );
517
+ }
518
+
494
519
  private redirectToModelImporterForDebugging(error: Error): void {
495
520
  if (this.editorStore.isInConflictResolutionMode) {
496
521
  this.editorStore.applicationStore.alertService.setBlockingAlert({
@@ -110,6 +110,10 @@ import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.j
110
110
  import type { QuickInputState } from './QuickInputState.js';
111
111
  import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
112
112
  import { openShowcaseManager } from '../ShowcaseManagerState.js';
113
+ import {
114
+ GraphEditLazyGrammarModeState,
115
+ LazyTextEditorStore,
116
+ } from '../lazy-text-editor/LazyTextEditorStore.js';
113
117
 
114
118
  export abstract class EditorExtensionState {
115
119
  /**
@@ -195,6 +199,8 @@ export class EditorStore implements CommandRegistrar {
195
199
  readonly tabManagerState = new EditorTabManagerState(this);
196
200
  supportedElementTypesWithCategory: Map<string, string[]>;
197
201
 
202
+ lazyTextEditorStore = new LazyTextEditorStore(this);
203
+
198
204
  constructor(
199
205
  applicationStore: LegendStudioApplicationStore,
200
206
  sdlcServerClient: SDLCServerClient,
@@ -211,6 +217,7 @@ export class EditorStore implements CommandRegistrar {
211
217
  graphEditorMode: observable,
212
218
  showSearchElementCommand: observable,
213
219
  quickInputState: observable,
220
+ lazyTextEditorStore: observable,
214
221
 
215
222
  isInViewerMode: computed,
216
223
  disableGraphEditing: computed,
@@ -230,6 +237,7 @@ export class EditorStore implements CommandRegistrar {
230
237
  initialize: flow,
231
238
  initMode: flow,
232
239
  initStandardMode: flow,
240
+ initializeLazyTextMode: flow,
233
241
  initConflictResolutionMode: flow,
234
242
  buildGraph: flow,
235
243
  toggleTextMode: flow,
@@ -715,6 +723,7 @@ export class EditorStore implements CommandRegistrar {
715
723
  ),
716
724
  ]);
717
725
  yield this.graphManagerState.initializeSystem();
726
+
718
727
  yield flowResult(this.initMode());
719
728
 
720
729
  onLeave(true);
@@ -728,6 +737,9 @@ export class EditorStore implements CommandRegistrar {
728
737
  case EDITOR_MODE.CONFLICT_RESOLUTION:
729
738
  yield flowResult(this.initConflictResolutionMode());
730
739
  return;
740
+ case EDITOR_MODE.LAZY_TEXT_EDITOR:
741
+ yield flowResult(this.initializeLazyTextMode());
742
+ return;
731
743
  default:
732
744
  throw new UnsupportedOperationError(
733
745
  `Can't initialize editor for unsupported mode '${this.mode}'`,
@@ -766,6 +778,92 @@ export class EditorStore implements CommandRegistrar {
766
778
  ]);
767
779
  }
768
780
 
781
+ *initializeLazyTextMode(): GeneratorFn<void> {
782
+ // set up
783
+ const projectId = this.sdlcState.activeProject.projectId;
784
+ const activeWorkspace = this.sdlcState.activeWorkspace;
785
+ const projectConfiguration = (yield this.sdlcServerClient.getConfiguration(
786
+ projectId,
787
+ activeWorkspace,
788
+ )) as PlainObject<ProjectConfiguration>;
789
+ this.projectConfigurationEditorState.setProjectConfiguration(
790
+ ProjectConfiguration.serialization.fromJson(projectConfiguration),
791
+ );
792
+ // make sure we set the original project configuration to a different object
793
+ this.projectConfigurationEditorState.setOriginalProjectConfiguration(
794
+ ProjectConfiguration.serialization.fromJson(projectConfiguration),
795
+ );
796
+
797
+ const startTime = Date.now();
798
+ let entities: Entity[];
799
+
800
+ this.initState.setMessage(`Fetching entities...`);
801
+ try {
802
+ entities = (yield this.sdlcServerClient.getEntities(
803
+ projectId,
804
+ activeWorkspace,
805
+ )) as Entity[];
806
+ this.changeDetectionState.workspaceLocalLatestRevisionState.setEntities(
807
+ entities,
808
+ );
809
+ this.applicationStore.logService.info(
810
+ LogEvent.create(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS),
811
+ Date.now() - startTime,
812
+ 'ms',
813
+ );
814
+ } catch {
815
+ return;
816
+ } finally {
817
+ this.initState.setMessage(undefined);
818
+ }
819
+ this.initState.setMessage('Building entities hash...');
820
+ yield flowResult(
821
+ this.changeDetectionState.workspaceLocalLatestRevisionState.buildEntityHashesIndex(
822
+ entities,
823
+ LogEvent.create(
824
+ LEGEND_STUDIO_APP_EVENT.CHANGE_DETECTION_BUILD_LOCAL_HASHES_INDEX__SUCCESS,
825
+ ),
826
+ ),
827
+ );
828
+
829
+ this.initState.setMessage('Building strict lazy graph...');
830
+ (yield flowResult(
831
+ this.graphState.buildGraphForLazyText(),
832
+ )) as GraphBuilderResult;
833
+ this.graphManagerState.graphBuildState.sync(ActionState.create().pass());
834
+ this.graphManagerState.generationsBuildState.sync(
835
+ ActionState.create().pass(),
836
+ );
837
+ this.initState.setMessage(undefined);
838
+ // switch to text mode
839
+ const graphEditorMode = new GraphEditLazyGrammarModeState(this);
840
+ try {
841
+ const editorGrammar =
842
+ (yield this.graphManagerState.graphManager.entitiesToPureCode(
843
+ this.changeDetectionState.workspaceLocalLatestRevisionState.entities,
844
+ { pretty: true },
845
+ )) as string;
846
+ yield flowResult(
847
+ graphEditorMode.grammarTextEditorState.setGraphGrammarText(
848
+ editorGrammar,
849
+ ),
850
+ );
851
+ this.graphEditorMode = graphEditorMode;
852
+ yield flowResult(
853
+ this.graphEditorMode.initialize({
854
+ useStoredEntities: true,
855
+ }),
856
+ );
857
+ } catch (error) {
858
+ assertErrorThrown(error);
859
+ this.applicationStore.notificationService.notifyWarning(
860
+ `Can't initialize strict text mode. Issue converting entities to grammar: ${error.message}`,
861
+ );
862
+ this.applicationStore.alertService.setBlockingAlert(undefined);
863
+ return;
864
+ }
865
+ }
866
+
769
867
  private *initConflictResolutionMode(): GeneratorFn<void> {
770
868
  yield flowResult(
771
869
  this.conflictResolutionState.initProjectConfigurationInConflictResolutionMode(),
@@ -946,11 +1044,15 @@ export class EditorStore implements CommandRegistrar {
946
1044
  if (this.graphState.checkIfApplicationUpdateOperationIsRunning()) {
947
1045
  return;
948
1046
  }
949
- this.applicationStore.alertService.setBlockingAlert({
950
- message: 'Switching to text mode...',
951
- showLoading: true,
952
- });
1047
+ if (this.graphEditorMode.disableLeaveMode) {
1048
+ this.graphEditorMode.onLeave();
1049
+ return;
1050
+ }
953
1051
  if (this.graphEditorMode instanceof GraphEditFormModeState) {
1052
+ this.applicationStore.alertService.setBlockingAlert({
1053
+ message: 'Switching to text mode...',
1054
+ showLoading: true,
1055
+ });
954
1056
  yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.GRAMMAR_TEXT));
955
1057
  } else if (this.graphEditorMode instanceof GraphEditGrammarModeState) {
956
1058
  yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.FORM));
@@ -1136,6 +1238,7 @@ export class EditorStore implements CommandRegistrar {
1136
1238
  fallbackOptions?: {
1137
1239
  isCompilationFailure?: boolean;
1138
1240
  isGraphBuildFailure?: boolean;
1241
+ useStoredEntities?: boolean;
1139
1242
  },
1140
1243
  ): GeneratorFn<void> {
1141
1244
  switch (to) {
@@ -1147,9 +1250,7 @@ export class EditorStore implements CommandRegistrar {
1147
1250
  graphEditorMode.cleanupBeforeEntering(fallbackOptions),
1148
1251
  );
1149
1252
  this.graphEditorMode = graphEditorMode;
1150
- yield flowResult(
1151
- this.graphEditorMode.initialize(Boolean(fallbackOptions)),
1152
- );
1253
+ yield flowResult(this.graphEditorMode.initialize(fallbackOptions));
1153
1254
  } catch (error) {
1154
1255
  assertErrorThrown(error);
1155
1256
  this.applicationStore.notificationService.notifyWarning(
@@ -61,7 +61,15 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
61
61
  this.grammarTextEditorState = new GrammarTextEditorState(this.editorStore);
62
62
  }
63
63
 
64
- *initialize(isFallback?: boolean): GeneratorFn<void> {
64
+ get headerLabel(): string {
65
+ return 'Text Mode';
66
+ }
67
+
68
+ *initialize(isFallback?: {
69
+ isCompilationFailure?: boolean;
70
+ isGraphBuildFailure?: boolean;
71
+ useStoredEntities?: boolean;
72
+ }): GeneratorFn<void> {
65
73
  this.editorStore.localChangesState = new TextLocalChangesState(
66
74
  this.editorStore,
67
75
  this.editorStore.sdlcState,
@@ -93,7 +101,11 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
93
101
  error,
94
102
  );
95
103
  }
96
- if (isFallback) {
104
+ if (
105
+ isFallback?.isCompilationFailure ||
106
+ isFallback?.isGraphBuildFailure ||
107
+ isFallback?.useStoredEntities
108
+ ) {
97
109
  yield flowResult(
98
110
  this.globalCompile({
99
111
  ignoreBlocking: true,
@@ -42,7 +42,15 @@ export abstract class GraphEditorMode {
42
42
  this.editorStore = editorStore;
43
43
  }
44
44
 
45
- abstract initialize(isFallback?: boolean): GeneratorFn<void>;
45
+ get disableLeaveMode(): boolean {
46
+ return false;
47
+ }
48
+
49
+ abstract initialize(options?: {
50
+ isCompilationFailure?: boolean;
51
+ isGraphBuildFailure?: boolean;
52
+ useStoredEntities?: boolean;
53
+ }): GeneratorFn<void>;
46
54
  abstract addElement(
47
55
  element: PackageableElement,
48
56
  packagePath: string | undefined,
@@ -33,7 +33,7 @@ import {
33
33
  MAPPING_TEST_EDITOR_TAB_TYPE,
34
34
  DEPRECATED__MappingTestState,
35
35
  TEST_RESULT,
36
- } from './DEPRECATED__MappingTestState.js';
36
+ } from './legacy/DEPRECATED__MappingTestState.js';
37
37
  import { createMockDataForMappingElementSource } from '../../../utils/MockDataUtils.js';
38
38
  import {
39
39
  type GeneratorFn,
@@ -59,7 +59,7 @@ import { RootRelationalInstanceSetImplementationState } from './relational/Relat
59
59
  import {
60
60
  type CompilationError,
61
61
  type PackageableElement,
62
- type InputData,
62
+ type DEPRECATED__InputData,
63
63
  Type,
64
64
  type EmbeddedSetImplementation,
65
65
  type ExecutionResult,
@@ -74,8 +74,8 @@ import {
74
74
  EnumerationMapping,
75
75
  SetImplementation,
76
76
  PureInstanceSetImplementation,
77
- ExpectedOutputMappingTestAssert,
78
- ObjectInputData,
77
+ DEPRECATED__ExpectedOutputMappingTestAssert,
78
+ DEPRECATED__ObjectInputData,
79
79
  ObjectInputType,
80
80
  FlatDataInstanceSetImplementation,
81
81
  InstanceSetImplementation,
@@ -125,6 +125,7 @@ import { rootRelationalSetImp_setMainTableAlias } from '../../../../graph-modifi
125
125
  import { LambdaEditorState } from '@finos/legend-query-builder';
126
126
  import type { MappingEditorTabState } from './MappingTabManagerState.js';
127
127
  import { MappingTestableState } from './testable/MappingTestableState.js';
128
+ import { MappingTestMigrationState } from './legacy/MappingTestMigrationState.js';
128
129
 
129
130
  export interface MappingExplorerTreeNodeData extends TreeNodeData {
130
131
  mappingElement: MappingElement;
@@ -626,6 +627,7 @@ export class MappingEditorState extends ElementEditorState {
626
627
 
627
628
  // DEPREACTED legacy tests: TO REMOVE once mapping testable dev work is complete
628
629
  DEPRECATED_mappingTestStates: DEPRECATED__MappingTestState[] = [];
630
+ migrationState: MappingTestMigrationState | undefined;
629
631
  isRunningAllTests = false;
630
632
  allTestRunTime = 0;
631
633
 
@@ -640,11 +642,15 @@ export class MappingEditorState extends ElementEditorState {
640
642
  isRunningAllTests: observable,
641
643
  allTestRunTime: observable,
642
644
  selectedTab: observable,
645
+ migrationState: observable,
643
646
  mappingExplorerTreeData: observable.ref,
644
647
  mapping: computed,
645
648
  testSuiteResult: computed,
646
649
  setNewMappingElementSpec: action,
650
+ openMigrationTool: action,
651
+ closeMigrationTool: action,
647
652
  setMappingExplorerTreeNodeData: action,
653
+ buildLegacyTestsStates: action,
648
654
  openMappingElement: action,
649
655
  closeAllTabs: action,
650
656
  createMappingElement: action,
@@ -666,9 +672,7 @@ export class MappingEditorState extends ElementEditorState {
666
672
  deleteMappingElement: flow,
667
673
  });
668
674
 
669
- this.DEPRECATED_mappingTestStates = this.mapping.test.map(
670
- (t) => new DEPRECATED__MappingTestState(editorStore, t, this),
671
- );
675
+ this.DEPRECATED_mappingTestStates = this.buildLegacyTestsStates();
672
676
  this.mappingExplorerTreeData = getMappingElementTreeData(
673
677
  this.mapping,
674
678
  editorStore,
@@ -684,6 +688,12 @@ export class MappingEditorState extends ElementEditorState {
684
688
  );
685
689
  }
686
690
 
691
+ buildLegacyTestsStates(): DEPRECATED__MappingTestState[] {
692
+ return this.mapping.test.map(
693
+ (t) => new DEPRECATED__MappingTestState(this.editorStore, t, this),
694
+ );
695
+ }
696
+
687
697
  /**
688
698
  * This method is used to check if a target is being mapped multiple times, so we can make
689
699
  * decision on things like whether we enforce the user to provide an ID for those mapping elements.
@@ -1393,6 +1403,23 @@ export class MappingEditorState extends ElementEditorState {
1393
1403
 
1394
1404
  // -------------------------------------- Test ---------------------------------------
1395
1405
 
1406
+ openMigrationTool(): void {
1407
+ if (!this.mapping.test.length) {
1408
+ this.editorStore.applicationStore.notificationService.notifyError(
1409
+ 'No legacy tests to migrate',
1410
+ );
1411
+ return;
1412
+ }
1413
+ this.migrationState = MappingTestMigrationState.build(
1414
+ this.editorStore,
1415
+ this,
1416
+ );
1417
+ }
1418
+
1419
+ closeMigrationTool(): void {
1420
+ this.migrationState = undefined;
1421
+ }
1422
+
1396
1423
  *openTest(
1397
1424
  test: DEPRECATED__MappingTest,
1398
1425
  openTab?: MAPPING_TEST_EDITOR_TAB_TYPE,
@@ -1546,9 +1573,9 @@ export class MappingEditorState extends ElementEditorState {
1546
1573
  `Can't auto-generate input data for operation class mapping. Please pick a concrete class mapping instead`,
1547
1574
  );
1548
1575
  }
1549
- let inputData: InputData;
1576
+ let inputData: DEPRECATED__InputData;
1550
1577
  if (source === undefined || source instanceof Class) {
1551
- inputData = new ObjectInputData(
1578
+ inputData = new DEPRECATED__ObjectInputData(
1552
1579
  PackageableElementExplicitReference.create(source ?? stub_Class()),
1553
1580
  ObjectInputType.JSON,
1554
1581
  source
@@ -1578,7 +1605,7 @@ export class MappingEditorState extends ElementEditorState {
1578
1605
  generateMappingTestName(this.mapping),
1579
1606
  query,
1580
1607
  [inputData],
1581
- new ExpectedOutputMappingTestAssert('{}'),
1608
+ new DEPRECATED__ExpectedOutputMappingTestAssert('{}'),
1582
1609
  );
1583
1610
  mapping_addDEPRECATEDTest(
1584
1611
  this.mapping,
@@ -51,7 +51,7 @@ import {
51
51
  } from '@finos/legend-shared';
52
52
  import { createMockDataForMappingElementSource } from '../../../utils/MockDataUtils.js';
53
53
  import {
54
- type InputData,
54
+ type DEPRECATED__InputData,
55
55
  type Mapping,
56
56
  type Connection,
57
57
  type ExecutionResult,
@@ -69,9 +69,9 @@ import {
69
69
  LAMBDA_PIPE,
70
70
  GRAPH_MANAGER_EVENT,
71
71
  Class,
72
- ObjectInputData,
72
+ DEPRECATED__ObjectInputData,
73
73
  ObjectInputType,
74
- ExpectedOutputMappingTestAssert,
74
+ DEPRECATED__ExpectedOutputMappingTestAssert,
75
75
  IdentifiedConnection,
76
76
  EngineRuntime,
77
77
  JsonModelConnection,
@@ -209,12 +209,12 @@ abstract class MappingExecutionInputDataState {
209
209
  readonly uuid = uuid();
210
210
  editorStore: EditorStore;
211
211
  mapping: Mapping;
212
- inputData?: InputData | undefined;
212
+ inputData?: DEPRECATED__InputData | undefined;
213
213
 
214
214
  constructor(
215
215
  editorStore: EditorStore,
216
216
  mapping: Mapping,
217
- inputData: InputData | undefined,
217
+ inputData: DEPRECATED__InputData | undefined,
218
218
  ) {
219
219
  this.editorStore = editorStore;
220
220
  this.mapping = mapping;
@@ -232,7 +232,7 @@ abstract class MappingExecutionInputDataState {
232
232
  return undefined;
233
233
  }
234
234
 
235
- abstract buildInputDataForTest(): InputData;
235
+ abstract buildInputDataForTest(): DEPRECATED__InputData;
236
236
  }
237
237
 
238
238
  export const createRuntimeForExecution = (
@@ -267,7 +267,7 @@ export class MappingExecutionEmptyInputDataState extends MappingExecutionInputDa
267
267
  );
268
268
  }
269
269
 
270
- buildInputDataForTest(): InputData {
270
+ buildInputDataForTest(): DEPRECATED__InputData {
271
271
  throw new IllegalStateError(
272
272
  'Mapping execution runtime information is not specified',
273
273
  );
@@ -276,13 +276,13 @@ export class MappingExecutionEmptyInputDataState extends MappingExecutionInputDa
276
276
 
277
277
  // TODO?: handle XML
278
278
  export class MappingExecutionObjectInputDataState extends MappingExecutionInputDataState {
279
- declare inputData: ObjectInputData;
279
+ declare inputData: DEPRECATED__ObjectInputData;
280
280
 
281
281
  constructor(editorStore: EditorStore, mapping: Mapping, _class: Class) {
282
282
  super(
283
283
  editorStore,
284
284
  mapping,
285
- new ObjectInputData(
285
+ new DEPRECATED__ObjectInputData(
286
286
  PackageableElementExplicitReference.create(
287
287
  guaranteeNonNullable(_class),
288
288
  ),
@@ -344,8 +344,8 @@ export class MappingExecutionObjectInputDataState extends MappingExecutionInputD
344
344
  return jsonAssertion;
345
345
  }
346
346
 
347
- buildInputDataForTest(): InputData {
348
- return new ObjectInputData(
347
+ buildInputDataForTest(): DEPRECATED__InputData {
348
+ return new DEPRECATED__ObjectInputData(
349
349
  PackageableElementExplicitReference.create(
350
350
  guaranteeNonNullable(this.inputData.sourceClass.value),
351
351
  ),
@@ -402,7 +402,7 @@ export class MappingExecutionFlatDataInputDataState extends MappingExecutionInpu
402
402
  );
403
403
  }
404
404
 
405
- buildInputDataForTest(): InputData {
405
+ buildInputDataForTest(): DEPRECATED__InputData {
406
406
  return new FlatDataInputData(
407
407
  PackageableElementExplicitReference.create(
408
408
  guaranteeNonNullable(this.inputData.sourceFlatData.value),
@@ -474,7 +474,7 @@ export class MappingExecutionRelationalInputDataState extends MappingExecutionIn
474
474
  );
475
475
  }
476
476
 
477
- buildInputDataForTest(): InputData {
477
+ buildInputDataForTest(): DEPRECATED__InputData {
478
478
  return new RelationalInputData(
479
479
  PackageableElementExplicitReference.create(
480
480
  guaranteeNonNullable(this.inputData.database.value),
@@ -664,7 +664,7 @@ export class MappingExecutionState extends MappingEditorTabState {
664
664
  this.executionResultText
665
665
  ) {
666
666
  const inputData = this.inputDataState.buildInputDataForTest();
667
- const assert = new ExpectedOutputMappingTestAssert(
667
+ const assert = new DEPRECATED__ExpectedOutputMappingTestAssert(
668
668
  toGrammarString(this.executionResultText),
669
669
  );
670
670
  const mappingTest = new DEPRECATED__MappingTest(
@@ -17,7 +17,7 @@
17
17
  import type {
18
18
  MappingEditorState,
19
19
  MappingElementSource,
20
- } from './MappingEditorState.js';
20
+ } from '../MappingEditorState.js';
21
21
  import {
22
22
  type GeneratorFn,
23
23
  LogEvent,
@@ -39,22 +39,22 @@ import {
39
39
  ContentType,
40
40
  StopWatch,
41
41
  } from '@finos/legend-shared';
42
- import type { EditorStore } from '../../../EditorStore.js';
42
+ import type { EditorStore } from '../../../../EditorStore.js';
43
43
  import { observable, flow, action, makeObservable, flowResult } from 'mobx';
44
- import { createMockDataForMappingElementSource } from '../../../utils/MockDataUtils.js';
44
+ import { createMockDataForMappingElementSource } from '../../../../utils/MockDataUtils.js';
45
45
  import {
46
46
  type RawLambda,
47
47
  type Runtime,
48
- type InputData,
49
- type MappingTestAssert,
48
+ type DEPRECATED__InputData,
49
+ type DEPRECATED__MappingTestAssert,
50
50
  type Mapping,
51
51
  type ExecutionResult,
52
52
  extractExecutionResultValues,
53
53
  GRAPH_MANAGER_EVENT,
54
54
  LAMBDA_PIPE,
55
55
  Class,
56
- ExpectedOutputMappingTestAssert,
57
- ObjectInputData,
56
+ DEPRECATED__ExpectedOutputMappingTestAssert,
57
+ DEPRECATED__ObjectInputData,
58
58
  ObjectInputType,
59
59
  IdentifiedConnection,
60
60
  EngineRuntime,
@@ -81,7 +81,7 @@ import {
81
81
  reportGraphAnalytics,
82
82
  } from '@finos/legend-graph';
83
83
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
84
- import { flatData_setData } from '../../../../graph-modifier/STO_FlatData_GraphModifierHelper.js';
84
+ import { flatData_setData } from '../../../../../graph-modifier/STO_FlatData_GraphModifierHelper.js';
85
85
  import {
86
86
  expectedOutputMappingTestAssert_setExpectedOutput,
87
87
  mappingTest_setAssert,
@@ -89,19 +89,19 @@ import {
89
89
  objectInputData_setData,
90
90
  runtime_addIdentifiedConnection,
91
91
  runtime_addMapping,
92
- } from '../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
92
+ } from '../../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
93
93
  import {
94
94
  localH2DatasourceSpecification_setTestDataSetupCsv,
95
95
  localH2DatasourceSpecification_setTestDataSetupSqls,
96
96
  relationalInputData_setData,
97
- } from '../../../../graph-modifier/STO_Relational_GraphModifierHelper.js';
97
+ } from '../../../../../graph-modifier/STO_Relational_GraphModifierHelper.js';
98
98
  import {
99
99
  LambdaEditorState,
100
100
  QueryBuilderTelemetryHelper,
101
101
  QUERY_BUILDER_EVENT,
102
102
  ExecutionPlanState,
103
103
  } from '@finos/legend-query-builder';
104
- import { MappingEditorTabState } from './MappingTabManagerState.js';
104
+ import { MappingEditorTabState } from '../MappingTabManagerState.js';
105
105
 
106
106
  export enum TEST_RESULT {
107
107
  NONE = 'NONE', // test has not run yet
@@ -194,12 +194,12 @@ abstract class MappingTestInputDataState {
194
194
  readonly uuid = uuid();
195
195
  editorStore: EditorStore;
196
196
  mapping: Mapping;
197
- inputData: InputData;
197
+ inputData: DEPRECATED__InputData;
198
198
 
199
199
  constructor(
200
200
  editorStore: EditorStore,
201
201
  mapping: Mapping,
202
- inputData: InputData,
202
+ inputData: DEPRECATED__InputData,
203
203
  ) {
204
204
  this.editorStore = editorStore;
205
205
  this.mapping = mapping;
@@ -210,7 +210,7 @@ abstract class MappingTestInputDataState {
210
210
  }
211
211
 
212
212
  export class MappingTestObjectInputDataState extends MappingTestInputDataState {
213
- declare inputData: ObjectInputData;
213
+ declare inputData: DEPRECATED__ObjectInputData;
214
214
  /**
215
215
  * @workaround https://github.com/finos/legend-studio/issues/68
216
216
  */
@@ -219,7 +219,7 @@ export class MappingTestObjectInputDataState extends MappingTestInputDataState {
219
219
  constructor(
220
220
  editorStore: EditorStore,
221
221
  mapping: Mapping,
222
- inputData: ObjectInputData,
222
+ inputData: DEPRECATED__ObjectInputData,
223
223
  ) {
224
224
  super(editorStore, mapping, inputData);
225
225
 
@@ -353,21 +353,21 @@ export class MappingTestRelationalInputDataState extends MappingTestInputDataSta
353
353
 
354
354
  abstract class MappingTestAssertionState {
355
355
  readonly uuid = uuid();
356
- assert: MappingTestAssert;
356
+ assert: DEPRECATED__MappingTestAssert;
357
357
 
358
- constructor(assert: MappingTestAssert) {
358
+ constructor(assert: DEPRECATED__MappingTestAssert) {
359
359
  this.assert = assert;
360
360
  }
361
361
  }
362
362
 
363
363
  export class MappingTestExpectedOutputAssertionState extends MappingTestAssertionState {
364
- declare assert: ExpectedOutputMappingTestAssert;
364
+ declare assert: DEPRECATED__ExpectedOutputMappingTestAssert;
365
365
  /**
366
366
  * @workaround https://github.com/finos/legend-studio/issues/68
367
367
  */
368
368
  expectedResult: string;
369
369
 
370
- constructor(assert: ExpectedOutputMappingTestAssert) {
370
+ constructor(assert: DEPRECATED__ExpectedOutputMappingTestAssert) {
371
371
  super(assert);
372
372
 
373
373
  makeObservable(this, {
@@ -399,6 +399,7 @@ export enum MAPPING_TEST_EDITOR_TAB_TYPE {
399
399
  SETUP = 'Test Setup',
400
400
  RESULT = 'Test Result',
401
401
  }
402
+
402
403
  /**
403
404
  * TODO: Remove once migration from `MappingTest_Legacy` to `MappingTest` is complete
404
405
  * @deprecated
@@ -513,7 +514,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
513
514
  'Mapping test input data must contain at least one item',
514
515
  );
515
516
  const inputData = this.test.inputData[0];
516
- if (inputData instanceof ObjectInputData) {
517
+ if (inputData instanceof DEPRECATED__ObjectInputData) {
517
518
  return new MappingTestObjectInputDataState(
518
519
  this.editorStore,
519
520
  this.mappingEditorState.mapping,
@@ -540,7 +541,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
540
541
 
541
542
  buildAssertionState(): MappingTestAssertionState {
542
543
  const testAssertion = this.test.assert;
543
- if (testAssertion instanceof ExpectedOutputMappingTestAssert) {
544
+ if (testAssertion instanceof DEPRECATED__ExpectedOutputMappingTestAssert) {
544
545
  return new MappingTestExpectedOutputAssertionState(testAssertion);
545
546
  }
546
547
  throw new UnsupportedOperationError(
@@ -584,7 +585,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
584
585
  const newInputDataState = new MappingTestObjectInputDataState(
585
586
  this.editorStore,
586
587
  this.mappingEditorState.mapping,
587
- new ObjectInputData(
588
+ new DEPRECATED__ObjectInputData(
588
589
  PackageableElementExplicitReference.create(source ?? stub_Class()),
589
590
  ObjectInputType.JSON,
590
591
  tryToMinifyJSONString('{}'),