@finos/legend-application-studio 26.1.10 → 27.0.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 (122) 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/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  28. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +6 -6
  29. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  30. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  31. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +10 -14
  32. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  33. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  34. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +9 -3
  35. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  36. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  37. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +1 -1
  38. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  39. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  40. package/lib/components/editor/side-bar/Explorer.js +36 -4
  41. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  42. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  43. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +15 -14
  44. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  45. package/lib/index.css +2 -2
  46. package/lib/index.css.map +1 -1
  47. package/lib/package.json +5 -5
  48. package/lib/stores/LegendStudioApplicationPlugin.d.ts +7 -7
  49. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  50. package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
  51. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  52. package/lib/stores/editor/EditorStore.js +2 -0
  53. package/lib/stores/editor/EditorStore.js.map +1 -1
  54. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  55. package/lib/stores/editor/GraphEditFormModeState.js +0 -1
  56. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  57. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  58. package/lib/stores/editor/NewElementState.js +5 -3
  59. package/lib/stores/editor/NewElementState.js.map +1 -1
  60. package/lib/stores/editor/QuickInputState.d.ts +3 -0
  61. package/lib/stores/editor/QuickInputState.d.ts.map +1 -1
  62. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
  63. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +14 -7
  65. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +2 -2
  67. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
  68. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +48 -48
  69. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +4 -1
  71. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  72. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +37 -12
  73. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
  75. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  76. package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js +1 -1
  77. package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js.map +1 -1
  78. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  79. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -1
  80. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  81. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts +1 -1
  82. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts.map +1 -1
  83. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js +2 -2
  84. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js.map +1 -1
  85. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +1 -1
  86. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  87. package/lib/stores/editor/utils/MockDataUtils.d.ts +1 -1
  88. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  89. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  90. package/lib/stores/editor/utils/PackageTreeUtils.js +3 -3
  91. package/lib/stores/editor/utils/PackageTreeUtils.js.map +1 -1
  92. package/package.json +15 -15
  93. package/src/application/LegendStudioApplicationConfig.ts +5 -0
  94. package/src/components/editor/QuickInput.tsx +5 -1
  95. package/src/components/editor/editor-group/FunctionEditor.tsx +67 -55
  96. package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +1 -0
  97. package/src/components/editor/editor-group/mapping-editor/DEPRECATED__MappingTestEditor.tsx +63 -69
  98. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
  99. package/src/components/editor/editor-group/mapping-editor/MappingExecutionBuilder.tsx +69 -48
  100. package/src/components/editor/editor-group/mapping-editor/MappingExplorer.tsx +2 -2
  101. package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +8 -12
  102. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +6 -10
  103. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +91 -99
  104. package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +13 -5
  105. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +3 -0
  106. package/src/components/editor/side-bar/Explorer.tsx +83 -1
  107. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +21 -23
  108. package/src/stores/LegendStudioApplicationPlugin.ts +7 -11
  109. package/src/stores/editor/EditorStore.ts +3 -0
  110. package/src/stores/editor/GraphEditFormModeState.ts +0 -1
  111. package/src/stores/editor/NewElementState.ts +6 -3
  112. package/src/stores/editor/QuickInputState.ts +3 -0
  113. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +18 -8
  114. package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +70 -69
  115. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +62 -36
  116. package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +5 -5
  117. package/src/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.ts +1 -1
  118. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -2
  119. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts +2 -2
  120. package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +1 -1
  121. package/src/stores/editor/utils/MockDataUtils.ts +1 -1
  122. package/src/stores/editor/utils/PackageTreeUtils.ts +3 -3
@@ -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
  );
@@ -411,7 +411,7 @@ export class PostValidationState {
411
411
  );
412
412
  serviceValidation_deleteAssertion(this.validation, assertion);
413
413
  this.assertionStates = this.assertionStates.filter(
414
- (e) => !(e === _assertionState),
414
+ (e) => e !== _assertionState,
415
415
  );
416
416
  }
417
417
  }
@@ -254,10 +254,20 @@ export class ServiceTestSetupState {
254
254
  ),
255
255
  this.editorStore.graphManagerState.graph,
256
256
  );
257
-
258
257
  if (valueSpec instanceof LambdaFunctionInstanceValue) {
259
258
  return this.getBindingWithParamRecursively(
260
- valueSpec.values[0]?.expressionSequence[0],
259
+ valueSpec.values[0]?.expressionSequence.find(
260
+ (exp) =>
261
+ exp instanceof SimpleFunctionExpression &&
262
+ (matchFunctionName(
263
+ exp.functionName,
264
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.SERIALIZE,
265
+ ) ||
266
+ matchFunctionName(
267
+ exp.functionName,
268
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.EXTERNALIZE,
269
+ )),
270
+ ),
261
271
  );
262
272
  }
263
273
  } catch (error) {
@@ -316,7 +316,7 @@ export class ProjectDependencyEditorState {
316
316
  reportTab: observable,
317
317
  expandConflictsState: observable,
318
318
  buildConflictPathState: observable,
319
- setDependencyReport: action,
319
+ setReportTab: action,
320
320
  expandAllConflicts: action,
321
321
  setFlattenDependencyTreeData: action,
322
322
  clearTrees: action,
@@ -356,7 +356,7 @@ export class ProjectDependencyEditorState {
356
356
  }
357
357
  }
358
358
 
359
- setDependencyReport(tab: DEPENDENCY_REPORT_TAB | undefined): void {
359
+ setReportTab(tab: DEPENDENCY_REPORT_TAB | undefined): void {
360
360
  this.reportTab = tab;
361
361
  }
362
362
 
@@ -152,7 +152,7 @@ export class GlobalBulkServiceRegistrationState {
152
152
  }
153
153
 
154
154
  setSelectAll(val: boolean): void {
155
- this.bulkServiceRegistrationStates.map(
155
+ this.bulkServiceRegistrationStates.forEach(
156
156
  (serviceRegistrationState) => (serviceRegistrationState.isSelected = val),
157
157
  );
158
158
  }
@@ -242,7 +242,7 @@ export const getPrimitiveTypeFromRelationalType = (
242
242
  export const createMockDataForColumn = (
243
243
  col: Column,
244
244
  isPrimaryKey: boolean,
245
- idx?: number | number,
245
+ idx?: number | undefined,
246
246
  ): string | undefined => {
247
247
  const type = col.type;
248
248
 
@@ -367,7 +367,7 @@ export const openNode = (
367
367
  let currentElement: PackageableElement | undefined = element;
368
368
  let openingNode: PackageTreeNodeData | undefined;
369
369
  while (currentElement.package) {
370
- const node: PackageTreeNodeData =
370
+ const currentNode: PackageTreeNodeData =
371
371
  treeData.nodes.get(currentElement.path) ??
372
372
  addNode(
373
373
  editorStore,
@@ -376,8 +376,8 @@ export const openNode = (
376
376
  childFilter,
377
377
  isDependencyElement,
378
378
  );
379
- node.isOpen = currentElement instanceof Package;
380
- openingNode = !openingNode ? node : openingNode;
379
+ currentNode.isOpen = currentElement instanceof Package;
380
+ openingNode = !openingNode ? currentNode : openingNode;
381
381
  currentElement = currentElement.package;
382
382
  }
383
383
  // Open the dependency root