@finos/legend-application-studio 26.1.10 → 26.1.11

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 (76) hide show
  1. package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
  2. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendStudioApplicationConfig.js +4 -0
  4. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  5. package/lib/components/editor/QuickInput.d.ts.map +1 -1
  6. package/lib/components/editor/QuickInput.js +4 -2
  7. package/lib/components/editor/QuickInput.js.map +1 -1
  8. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  9. package/lib/components/editor/editor-group/FunctionEditor.js +13 -6
  10. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  11. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
  12. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +1 -1
  13. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
  14. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.d.ts.map +1 -1
  15. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js +6 -10
  16. package/lib/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.js.map +1 -1
  17. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js +1 -1
  18. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  19. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  20. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js +13 -12
  21. package/lib/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  22. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js +2 -2
  23. package/lib/components/editor/editor-group/mapping-editor/MappingExplorer.js.map +1 -1
  24. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
  25. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +3 -7
  26. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
  27. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  28. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +10 -14
  29. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  30. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  31. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +1 -1
  32. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  33. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  34. package/lib/components/editor/side-bar/Explorer.js +36 -4
  35. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  36. package/lib/index.css +2 -2
  37. package/lib/index.css.map +1 -1
  38. package/lib/package.json +2 -2
  39. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  40. package/lib/stores/editor/EditorStore.js +2 -0
  41. package/lib/stores/editor/EditorStore.js.map +1 -1
  42. package/lib/stores/editor/QuickInputState.d.ts +3 -0
  43. package/lib/stores/editor/QuickInputState.d.ts.map +1 -1
  44. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
  45. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  46. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +14 -7
  47. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  48. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +2 -2
  49. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
  50. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +48 -48
  51. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
  52. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +4 -1
  53. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +37 -12
  55. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
  57. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  58. package/package.json +12 -12
  59. package/src/application/LegendStudioApplicationConfig.ts +5 -0
  60. package/src/components/editor/QuickInput.tsx +5 -1
  61. package/src/components/editor/editor-group/FunctionEditor.tsx +67 -55
  62. package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +1 -0
  63. package/src/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.tsx +63 -69
  64. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
  65. package/src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx +69 -48
  66. package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
  67. package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +8 -12
  68. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +91 -99
  69. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +3 -0
  70. package/src/components/editor/side-bar/Explorer.tsx +83 -1
  71. package/src/stores/editor/EditorStore.ts +3 -0
  72. package/src/stores/editor/QuickInputState.ts +3 -0
  73. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +18 -8
  74. package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +70 -69
  75. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +62 -36
  76. package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +5 -5
@@ -66,7 +66,6 @@ import {
66
66
  DEFAULT_TEST_PREFIX,
67
67
  EqualToJson,
68
68
  ServiceTest,
69
- extractExecutionResultValues,
70
69
  LAMBDA_PIPE,
71
70
  GRAPH_MANAGER_EVENT,
72
71
  Class,
@@ -498,6 +497,7 @@ export class MappingExecutionState extends MappingEditorTabState {
498
497
  isGeneratingPlan = false;
499
498
  executionPlanState: ExecutionPlanState;
500
499
  planGenerationDebugText?: string | undefined;
500
+ executionRunPromise: Promise<ExecutionResult> | undefined = undefined;
501
501
 
502
502
  constructor(
503
503
  editorStore: EditorStore,
@@ -515,6 +515,8 @@ export class MappingExecutionState extends MappingEditorTabState {
515
515
  isExecuting: observable,
516
516
  isGeneratingPlan: observable,
517
517
  planGenerationDebugText: observable,
518
+ executionRunPromise: observable,
519
+ setExecutionRunPromise: action,
518
520
  setQueryState: action,
519
521
  setInputDataState: action,
520
522
  setExecutionResultText: action,
@@ -524,6 +526,7 @@ export class MappingExecutionState extends MappingEditorTabState {
524
526
  reset: action,
525
527
  promoteToTest: flow,
526
528
  promoteToService: flow,
529
+ cancelExecution: flow,
527
530
  executeMapping: flow,
528
531
  generatePlan: flow,
529
532
  buildQueryWithClassMapping: flow,
@@ -550,6 +553,11 @@ export class MappingExecutionState extends MappingEditorTabState {
550
553
  get label(): string {
551
554
  return this.name;
552
555
  }
556
+
557
+ setExecutionRunPromise(promise: Promise<ExecutionResult> | undefined): void {
558
+ this.executionRunPromise = promise;
559
+ }
560
+
553
561
  setQueryState(val: MappingExecutionQueryState): void {
554
562
  this.queryState = val;
555
563
  }
@@ -759,7 +767,24 @@ export class MappingExecutionState extends MappingEditorTabState {
759
767
  }
760
768
  }
761
769
 
770
+ *cancelExecution(): GeneratorFn<void> {
771
+ this.isExecuting = false;
772
+ this.setExecutionRunPromise(undefined);
773
+ try {
774
+ yield this.editorStore.graphManagerState.graphManager.cancelUserExecutions(
775
+ true,
776
+ );
777
+ } catch (error) {
778
+ // don't notify users about success or failure
779
+ this.editorStore.applicationStore.logService.error(
780
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
781
+ error,
782
+ );
783
+ }
784
+ }
785
+
762
786
  *executeMapping(): GeneratorFn<void> {
787
+ let promise;
763
788
  try {
764
789
  const query = this.queryState.query;
765
790
  const runtime = this.inputDataState.runtime;
@@ -779,45 +804,46 @@ export class MappingExecutionState extends MappingEditorTabState {
779
804
  this.editorStore.graphManagerState.graph,
780
805
  );
781
806
 
782
- const result =
783
- (yield this.editorStore.graphManagerState.graphManager.runQuery(
784
- query,
785
- this.mappingEditorState.mapping,
786
- runtime,
787
- this.editorStore.graphManagerState.graph,
788
- {
789
- useLosslessParse: true,
790
- },
791
- report,
792
- )) as ExecutionResult;
793
-
794
- this.setExecutionResultText(
795
- stringifyLosslessJSON(
796
- extractExecutionResultValues(result),
797
- undefined,
798
- DEFAULT_TAB_SIZE,
799
- ),
800
- );
801
-
802
- // report
803
- report.timings =
804
- this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
805
- stopWatch,
806
- report.timings,
807
- );
808
- QueryBuilderTelemetryHelper.logEvent_QueryRunSucceeded(
809
- this.editorStore.applicationStore.telemetryService,
807
+ promise = this.editorStore.graphManagerState.graphManager.runQuery(
808
+ query,
809
+ this.mappingEditorState.mapping,
810
+ runtime,
811
+ this.editorStore.graphManagerState.graph,
812
+ {
813
+ useLosslessParse: true,
814
+ },
810
815
  report,
811
816
  );
817
+ this.setExecutionRunPromise(promise);
818
+ const result = (yield promise) as ExecutionResult;
819
+ if (this.executionRunPromise === promise) {
820
+ this.setExecutionResultText(
821
+ stringifyLosslessJSON(result, undefined, DEFAULT_TAB_SIZE),
822
+ );
823
+ // report
824
+ report.timings =
825
+ this.editorStore.applicationStore.timeService.finalizeTimingsRecord(
826
+ stopWatch,
827
+ report.timings,
828
+ );
829
+ QueryBuilderTelemetryHelper.logEvent_QueryRunSucceeded(
830
+ this.editorStore.applicationStore.telemetryService,
831
+ report,
832
+ );
833
+ }
812
834
  }
813
835
  } catch (error) {
814
- assertErrorThrown(error);
815
- this.editorStore.applicationStore.logService.error(
816
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
817
- error,
818
- );
819
- this.editorStore.applicationStore.notificationService.notifyError(error);
820
- this.setExecutionResultText('');
836
+ if (this.executionRunPromise === promise) {
837
+ assertErrorThrown(error);
838
+ this.editorStore.applicationStore.logService.error(
839
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
840
+ error,
841
+ );
842
+ this.editorStore.applicationStore.notificationService.notifyError(
843
+ error,
844
+ );
845
+ this.setExecutionResultText('');
846
+ }
821
847
  } finally {
822
848
  this.isExecuting = false;
823
849
  }
@@ -644,15 +644,15 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
644
644
  );
645
645
  }
646
646
  } catch (error) {
647
- // When user cancels the query by calling the cancelQuery api, it will throw an exeuction failure error.
647
+ // When user cancels the query by calling the cancelQuery api, it will throw an execution failure error.
648
648
  // For now, we don't want to notify users about this failure. Therefore we check to ensure the promise is still the same one.
649
649
  // When cancelled the query, we set the queryRunPromise as undefined.
650
- this.editorStore.applicationStore.logService.error(
651
- LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
652
- error,
653
- );
654
650
  if (this.queryRunPromise === promise) {
655
651
  assertErrorThrown(error);
652
+ this.editorStore.applicationStore.logService.error(
653
+ LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
654
+ error,
655
+ );
656
656
  this.editorStore.applicationStore.notificationService.notifyError(
657
657
  error,
658
658
  );