@finos/legend-application-query 13.7.2 → 13.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/lib/application/LegendQueryApplicationConfig.d.ts +0 -1
  2. package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendQueryApplicationConfig.js +0 -2
  4. package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
  5. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +2 -3
  6. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  7. package/lib/components/Core_LegendQueryApplicationPlugin.js +4 -157
  8. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  9. package/lib/components/QueryEditor.d.ts.map +1 -1
  10. package/lib/components/QueryEditor.js +2 -9
  11. package/lib/components/QueryEditor.js.map +1 -1
  12. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +2 -2
  13. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  14. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +10 -38
  15. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/package.json +3 -3
  18. package/lib/stores/LegendQueryApplicationPlugin.d.ts +3 -4
  19. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  20. package/lib/stores/LegendQueryApplicationPlugin.js +1 -0
  21. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  22. package/lib/stores/QueryEditorStore.d.ts +2 -13
  23. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  24. package/lib/stores/QueryEditorStore.js +30 -135
  25. package/lib/stores/QueryEditorStore.js.map +1 -1
  26. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +1 -2
  27. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  28. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +12 -8
  29. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
  30. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +0 -1
  31. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
  32. package/lib/stores/data-space/DataSpaceQuerySetupState.js +0 -1
  33. package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
  34. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +1 -3
  35. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  36. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +24 -41
  37. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  38. package/package.json +15 -15
  39. package/src/application/LegendQueryApplicationConfig.ts +0 -3
  40. package/src/components/Core_LegendQueryApplicationPlugin.tsx +7 -281
  41. package/src/components/QueryEditor.tsx +1 -25
  42. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +24 -62
  43. package/src/stores/LegendQueryApplicationPlugin.tsx +5 -6
  44. package/src/stores/QueryEditorStore.ts +53 -254
  45. package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +28 -17
  46. package/src/stores/data-space/DataSpaceQuerySetupState.ts +0 -1
  47. package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +51 -73
@@ -65,8 +65,6 @@ class LegendQueryApplicationCoreOptions {
65
65
  TEMPORARY__serviceRegistrationConfig: ServiceRegistrationEnvironmentConfig[] =
66
66
  [];
67
67
 
68
- TEMPORARY__enableMinimalGraph = false;
69
-
70
68
  /**
71
69
  * Config specific to query builder
72
70
  */
@@ -80,7 +78,6 @@ class LegendQueryApplicationCoreOptions {
80
78
  queryBuilderConfig: optional(
81
79
  usingModelSchema(QueryBuilderConfig.serialization.schema),
82
80
  ),
83
- TEMPORARY__enableMinimalGraph: optional(primitive()),
84
81
  }),
85
82
  );
86
83
 
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import {
18
- type QuerySetupActionConfiguration,
19
18
  LegendQueryApplicationPlugin,
20
19
  QuerySetupActionTag,
20
+ type QuerySetupActionConfiguration,
21
21
  } from '../stores/LegendQueryApplicationPlugin.js';
22
22
  import packageJson from '../../package.json' with { type: 'json' };
23
23
  import type { QuerySetupLandingPageStore } from '../stores/QuerySetupStore.js';
@@ -50,10 +50,10 @@ import {
50
50
  LEGEND_QUERY_ROUTE_PATTERN,
51
51
  } from '../__lib__/LegendQueryNavigation.js';
52
52
  import {
53
- type ApplicationPageEntry,
54
- type LegendApplicationSetup,
55
53
  ActionAlertActionType,
56
54
  ActionAlertType,
55
+ type ApplicationPageEntry,
56
+ type LegendApplicationSetup,
57
57
  } from '@finos/legend-application';
58
58
  import { CloneQueryServiceSetup } from './CloneQueryServiceSetup.js';
59
59
  import { QueryProductionizerSetup } from './QueryProductionizerSetup.js';
@@ -65,11 +65,9 @@ import {
65
65
  generateDataSpaceQuerySetupRoute,
66
66
  } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
67
67
  import {
68
- type QueryBuilderState,
68
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
69
69
  type QueryBuilderHeaderActionConfiguration,
70
70
  type QueryBuilderMenuActionConfiguration,
71
- type QueryBuilderPropagateExecutionContextChangeHelper,
72
- QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
73
71
  } from '@finos/legend-query-builder';
74
72
  import {
75
73
  ExistingQueryEditorStore,
@@ -77,48 +75,18 @@ import {
77
75
  } from '../stores/QueryEditorStore.js';
78
76
  import {
79
77
  DataSpaceQueryBuilderState,
80
- DataSpacesDepotRepository,
81
78
  generateDataSpaceTemplateQueryPromotionRoute,
82
79
  } from '@finos/legend-extension-dsl-data-space/application';
83
- import {
84
- createGraphBuilderReport,
85
- GRAPH_MANAGER_EVENT,
86
- LegendSDLC,
87
- PackageableElementPointerType,
88
- resolvePackagePathAndElementName,
89
- RuntimePointer,
90
- V1_EngineRuntime,
91
- V1_Mapping,
92
- V1_PackageableElementPointer,
93
- V1_PackageableRuntime,
94
- V1_PureGraphManager,
95
- } from '@finos/legend-graph';
80
+ import { RuntimePointer } from '@finos/legend-graph';
96
81
  import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
97
- import { resolveVersion, StoreProjectData } from '@finos/legend-server-depot';
98
- import {
99
- ActionState,
100
- assertErrorThrown,
101
- buildUrl,
102
- getNullableFirstEntry,
103
- guaranteeNonNullable,
104
- guaranteeType,
105
- LogEvent,
106
- StopWatch,
107
- uniq,
108
- } from '@finos/legend-shared';
82
+ import { StoreProjectData } from '@finos/legend-server-depot';
83
+ import { buildUrl } from '@finos/legend-shared';
109
84
  import { parseProjectIdentifier } from '@finos/legend-storage';
110
85
  import { QueryEditorExistingQueryHeader } from './QueryEditor.js';
111
86
  import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
112
87
  import { createViewSDLCProjectHandler } from '../stores/data-space/DataSpaceQueryBuilderHelper.js';
113
88
  import { DataSpaceQueryCreatorStore } from '../stores/data-space/DataSpaceQueryCreatorStore.js';
114
89
  import { configureCodeEditorComponent } from '@finos/legend-lego/code-editor';
115
- import {
116
- resolveUsableDataSpaceClasses,
117
- V1_DataSpace,
118
- V1_DataSpaceExecutionContext,
119
- } from '@finos/legend-extension-dsl-data-space/graph';
120
- import { flowResult } from 'mobx';
121
- import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
122
90
 
123
91
  export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
124
92
  static NAME = packageJson.extensions.applicationQueryPlugin;
@@ -757,246 +725,4 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
757
725
  },
758
726
  };
759
727
  }
760
-
761
- getExtraQueryBuilderPropagateExecutionContextChangeHelper?(): QueryBuilderPropagateExecutionContextChangeHelper[] {
762
- return [
763
- (
764
- queryBuilderState: QueryBuilderState,
765
- isGraphBuildingNotRequired?: boolean,
766
- ): (() => Promise<void>) | undefined => {
767
- /**
768
- * Propagation after changing the execution context:
769
- * - The mapping will be updated to the mapping of the execution context
770
- * - The runtime will be updated to the default runtime of the execution context
771
- * - If no class is chosen, try to choose a compatible class
772
- * - If the chosen class is compatible with the new selected execution context mapping, do nothing, otherwise, try to choose a compatible class
773
- */
774
- const propagateExecutionContextChange = async (): Promise<void> => {
775
- const dataSpaceQueryBuilderState = guaranteeType(
776
- queryBuilderState,
777
- DataSpaceQueryBuilderState,
778
- );
779
- const mapping =
780
- dataSpaceQueryBuilderState.executionContext.mapping.value;
781
- const mappingModelCoverageAnalysisResult =
782
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(
783
- mapping.path,
784
- );
785
- const editorStore = (
786
- queryBuilderState.workflowState
787
- .actionConfig as QueryBuilderActionConfig_QueryApplication
788
- ).editorStore;
789
- if (
790
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult &&
791
- mappingModelCoverageAnalysisResult
792
- ) {
793
- if (
794
- !isGraphBuildingNotRequired &&
795
- dataSpaceQueryBuilderState.isLightGraphEnabled
796
- ) {
797
- const supportBuildMinimalGraph =
798
- editorStore.applicationStore.config.options
799
- .TEMPORARY__enableMinimalGraph;
800
- if (
801
- editorStore.enableMinialGraphForDataSpaceLoadingPerformance &&
802
- supportBuildMinimalGraph
803
- ) {
804
- try {
805
- const stopWatch = new StopWatch();
806
- const graph =
807
- dataSpaceQueryBuilderState.graphManagerState.createNewGraph();
808
- const graph_buildReport = createGraphBuilderReport();
809
- const graphManager = guaranteeType(
810
- dataSpaceQueryBuilderState.graphManagerState.graphManager,
811
- V1_PureGraphManager,
812
- );
813
- // Create dummy mappings and runtimes
814
- // TODO?: these stubbed mappings and runtimes are not really useful that useful, so either we should
815
- // simplify the model here or potentially refactor the backend analytics endpoint to return these as model
816
- const mappingModels = uniq(
817
- Array.from(
818
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
819
- ).map((context) => context.mapping),
820
- ).map((m) => {
821
- const _mapping = new V1_Mapping();
822
- const [packagePath, name] =
823
- resolvePackagePathAndElementName(m.path);
824
- _mapping.package = packagePath;
825
- _mapping.name = name;
826
- return graphManager.elementProtocolToEntity(_mapping);
827
- });
828
- const runtimeModels = uniq(
829
- Array.from(
830
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
831
- )
832
- .map((context) => context.defaultRuntime)
833
- .concat(
834
- Array.from(
835
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
836
- ).flatMap((val) => val.compatibleRuntimes),
837
- ),
838
- ).map((r) => {
839
- const runtime = new V1_PackageableRuntime();
840
- const [packagePath, name] =
841
- resolvePackagePathAndElementName(r.path);
842
- runtime.package = packagePath;
843
- runtime.name = name;
844
- runtime.runtimeValue = new V1_EngineRuntime();
845
- return graphManager.elementProtocolToEntity(runtime);
846
- });
847
- // The DataSpace entity is excluded from AnalyticsResult.Json to reduce the JSON size
848
- // because all its information can be found in V1_DataSpaceAnalysisResult.
849
- // Therefore, we are building a simple v1_DataSpace entity based on V1_DataSpaceAnalysisResult.
850
- const dataspaceProtocol = new V1_DataSpace();
851
- dataspaceProtocol.name =
852
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.name;
853
- dataspaceProtocol.package =
854
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.package;
855
- dataspaceProtocol.supportInfo =
856
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.supportInfo;
857
- dataspaceProtocol.executionContexts = Array.from(
858
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult
859
- .executionContextsIndex,
860
- ).map(([key, execContext]) => {
861
- const contextProtocol = new V1_DataSpaceExecutionContext();
862
- contextProtocol.name = execContext.name;
863
- contextProtocol.title = execContext.title;
864
- contextProtocol.description = execContext.description;
865
- contextProtocol.mapping = new V1_PackageableElementPointer(
866
- PackageableElementPointerType.MAPPING,
867
- execContext.mapping.path,
868
- );
869
- contextProtocol.defaultRuntime =
870
- new V1_PackageableElementPointer(
871
- PackageableElementPointerType.RUNTIME,
872
- execContext.defaultRuntime.path,
873
- );
874
- return contextProtocol;
875
- });
876
- dataspaceProtocol.defaultExecutionContext =
877
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.defaultExecutionContext.name;
878
- dataspaceProtocol.title =
879
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.title;
880
- dataspaceProtocol.description =
881
- dataSpaceQueryBuilderState.dataSpaceAnalysisResult.description;
882
- const dataspaceEntity =
883
- graphManager.elementProtocolToEntity(dataspaceProtocol);
884
-
885
- const graphEntities = guaranteeNonNullable(
886
- mappingModelCoverageAnalysisResult.entities,
887
- )
888
- .concat(mappingModels)
889
- .concat(runtimeModels)
890
- .concat(dataspaceEntity)
891
- // NOTE: if an element could be found in the graph already it means it comes from system
892
- // so we could rid of it
893
- .filter(
894
- (el) =>
895
- !graph.getNullableElement(el.path, false) &&
896
- !el.path.startsWith('meta::'),
897
- );
898
- let option;
899
- if (
900
- dataSpaceQueryBuilderState.dataSpaceRepo instanceof
901
- DataSpacesDepotRepository
902
- ) {
903
- option = new LegendSDLC(
904
- dataSpaceQueryBuilderState.dataSpaceRepo.project.groupId,
905
- dataSpaceQueryBuilderState.dataSpaceRepo.project.artifactId,
906
- resolveVersion(
907
- dataSpaceQueryBuilderState.dataSpaceRepo.project
908
- .versionId,
909
- ),
910
- );
911
- }
912
- await dataSpaceQueryBuilderState.graphManagerState.graphManager.buildGraph(
913
- graph,
914
- graphEntities,
915
- ActionState.create(),
916
- option
917
- ? {
918
- origin: option,
919
- }
920
- : {},
921
- graph_buildReport,
922
- );
923
- dataSpaceQueryBuilderState.graphManagerState.graph = graph;
924
- const dependency_buildReport = createGraphBuilderReport();
925
- // report
926
- stopWatch.record(
927
- GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
928
- );
929
- const graphBuilderReportData = {
930
- timings:
931
- dataSpaceQueryBuilderState.applicationStore.timeService.finalizeTimingsRecord(
932
- stopWatch,
933
- ),
934
- dependencies: dependency_buildReport,
935
- dependenciesCount:
936
- dataSpaceQueryBuilderState.graphManagerState.graph
937
- .dependencyManager.numberOfDependencies,
938
- graph: graph_buildReport,
939
- };
940
- editorStore.logBuildGraphMetrics(graphBuilderReportData);
941
- dataSpaceQueryBuilderState.applicationStore.logService.info(
942
- LogEvent.create(
943
- GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
944
- ),
945
- graphBuilderReportData,
946
- );
947
- } catch (error) {
948
- assertErrorThrown(error);
949
- editorStore.applicationStore.logService.error(
950
- LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
951
- error,
952
- );
953
- editorStore.graphManagerState.graph =
954
- editorStore.graphManagerState.createNewGraph();
955
- await flowResult(editorStore.buildFullGraph());
956
- }
957
- } else {
958
- editorStore.graphManagerState.graph =
959
- editorStore.graphManagerState.createNewGraph();
960
- await flowResult(editorStore.buildFullGraph());
961
- }
962
- }
963
- dataSpaceQueryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
964
- mappingModelCoverageAnalysisResult;
965
- }
966
- const compatibleClasses = resolveUsableDataSpaceClasses(
967
- dataSpaceQueryBuilderState.dataSpace,
968
- mapping,
969
- dataSpaceQueryBuilderState.graphManagerState,
970
- dataSpaceQueryBuilderState,
971
- );
972
- dataSpaceQueryBuilderState.changeMapping(mapping);
973
- dataSpaceQueryBuilderState.changeRuntime(
974
- new RuntimePointer(
975
- dataSpaceQueryBuilderState.executionContext.defaultRuntime,
976
- ),
977
- );
978
- // if there is no chosen class or the chosen one is not compatible
979
- // with the mapping then pick a compatible class if possible
980
- if (
981
- !dataSpaceQueryBuilderState.class ||
982
- !compatibleClasses.includes(dataSpaceQueryBuilderState.class)
983
- ) {
984
- const possibleNewClass = getNullableFirstEntry(compatibleClasses);
985
- if (possibleNewClass) {
986
- dataSpaceQueryBuilderState.changeClass(possibleNewClass);
987
- }
988
- }
989
- dataSpaceQueryBuilderState.explorerState.refreshTreeData();
990
- };
991
- if (
992
- queryBuilderState instanceof DataSpaceQueryBuilderState &&
993
- queryBuilderState.workflowState.actionConfig instanceof
994
- QueryBuilderActionConfig_QueryApplication
995
- ) {
996
- return propagateExecutionContextChange;
997
- }
998
- return undefined;
999
- },
1000
- ];
1001
- }
1002
728
  }
@@ -605,12 +605,6 @@ export const QueryEditor = observer(() => {
605
605
  !engineConfig.useClientRequestPayloadCompression,
606
606
  );
607
607
 
608
- const toggleEnableMinialGraphForDataSpaceLoadingPerformance = (): void => {
609
- editorStore.setEnableMinialGraphForDataSpaceLoadingPerformance(
610
- !editorStore.enableMinialGraphForDataSpaceLoadingPerformance,
611
- );
612
- };
613
-
614
608
  const TEMPORARY__toggleLightDarkMode = (): void => {
615
609
  applicationStore.layoutService.setColorTheme(
616
610
  applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
@@ -635,11 +629,7 @@ export const QueryEditor = observer(() => {
635
629
  applicationStore.alertUnhandledError,
636
630
  );
637
631
  applicationStore.releaseNotesService.updateViewedVersion();
638
- }, [
639
- editorStore,
640
- applicationStore,
641
- editorStore.enableMinialGraphForDataSpaceLoadingPerformance,
642
- ]);
632
+ }, [editorStore, applicationStore]);
643
633
 
644
634
  return (
645
635
  <div className="query-editor">
@@ -686,20 +676,6 @@ export const QueryEditor = observer(() => {
686
676
  Compress request payload
687
677
  </MenuContentItemLabel>
688
678
  </MenuContentItem>
689
- <MenuContentItem
690
- onClick={
691
- toggleEnableMinialGraphForDataSpaceLoadingPerformance
692
- }
693
- >
694
- <MenuContentItemIcon>
695
- {editorStore.enableMinialGraphForDataSpaceLoadingPerformance ? (
696
- <CheckIcon />
697
- ) : null}
698
- </MenuContentItemIcon>
699
- <MenuContentItemLabel>
700
- Enable minimal graph
701
- </MenuContentItemLabel>
702
- </MenuContentItem>
703
679
  </MenuContent>
704
680
  }
705
681
  >
@@ -25,15 +25,12 @@ import { createMock, createSpy } from '@finos/legend-shared/test';
25
25
  import {
26
26
  type GraphManagerState,
27
27
  type RawMappingModelCoverageAnalysisResult,
28
- type QueryInfo,
29
28
  Query,
30
29
  LightQuery,
31
30
  RawLambda,
31
+ PackageableElementExplicitReference,
32
32
  QueryExplicitExecutionContext,
33
33
  QueryDataSpaceExecutionContext,
34
- PackageableElementExplicitReference,
35
- QueryDataSpaceExecutionContextInfo,
36
- QueryExplicitExecutionContextInfo,
37
34
  } from '@finos/legend-graph';
38
35
  import { DepotServerClient } from '@finos/legend-server-depot';
39
36
  import {
@@ -107,7 +104,7 @@ export const TEST__provideMockedQueryEditorStore = (customization?: {
107
104
 
108
105
  export const TEST__setUpQueryEditor = async (
109
106
  MOCK__editorStore: ExistingQueryEditorStore,
110
- entities: PlainObject<Entity>[],
107
+ entities: Entity[],
111
108
  lambda: RawLambda,
112
109
  mappingPath: string,
113
110
  runtimePath: string,
@@ -145,7 +142,7 @@ export const TEST__setUpQueryEditor = async (
145
142
  await graphManagerState.initializeSystem();
146
143
  await graphManagerState.graphManager.buildGraph(
147
144
  graphManagerState.graph,
148
- entities as unknown as Entity[],
145
+ entities,
149
146
  graphManagerState.graphBuildState,
150
147
  );
151
148
 
@@ -165,36 +162,13 @@ export const TEST__setUpQueryEditor = async (
165
162
  );
166
163
  query.executionContext = execContext;
167
164
  query.content = 'some content';
168
-
169
- const execContextInfo = new QueryExplicitExecutionContextInfo();
170
- execContextInfo.mapping = mappingPath;
171
- execContextInfo.runtime = runtimePath;
172
-
173
- const queryInfo: QueryInfo = {
174
- name: TEST_QUERY_NAME,
175
- id: TEST_QUERY_ID,
176
- versionId: '0.0.0',
177
- groupId: 'test.group',
178
- artifactId: 'test-artifact',
179
- executionContext: execContextInfo,
180
- content: 'some content',
181
- isCurrentUserQuery: true,
182
- };
183
-
184
165
  createSpy(
185
166
  MOCK__editorStore.depotServerClient,
186
167
  'getProject',
187
168
  ).mockResolvedValue(projectData);
188
- createSpy(
189
- MOCK__editorStore.depotServerClient,
190
- 'getEntities',
191
- ).mockResolvedValue(entities);
192
169
  createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
193
170
  lightQuery,
194
171
  );
195
- createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
196
- queryInfo,
197
- );
198
172
  createSpy(
199
173
  graphManagerState.graphManager,
200
174
  'pureCodeToLambda',
@@ -248,22 +222,16 @@ export const TEST__setUpQueryEditor = async (
248
222
 
249
223
  export const TEST__setUpDataSpaceExistingQueryEditor = async (
250
224
  MOCK__editorStore: ExistingQueryEditorStore,
251
- V1_dataspaceAnalyticsResult: PlainObject<V1_DataSpaceAnalysisResult>,
225
+ v1_dataspaceAnalyticsResult: PlainObject<V1_DataSpaceAnalysisResult>,
252
226
  dataSpacePath: string,
253
227
  executionContext: string,
254
228
  lambda: RawLambda,
255
229
  mappingPath: string,
256
- entities: PlainObject<Entity>[],
257
- buildWithMinimalGraph = false,
230
+ entities: Entity[],
258
231
  ): Promise<{
259
232
  renderResult: RenderResult;
260
233
  queryBuilderState: QueryBuilderState;
261
234
  }> => {
262
- if (buildWithMinimalGraph) {
263
- MOCK__editorStore.applicationStore.config.options.TEMPORARY__enableMinimalGraph =
264
- true;
265
- }
266
-
267
235
  const projectData = {
268
236
  id: 'test-id',
269
237
  groupId: 'test.group',
@@ -291,6 +259,11 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
291
259
  });
292
260
 
293
261
  await graphManagerState.initializeSystem();
262
+ await graphManagerState.graphManager.buildGraph(
263
+ graphManagerState.graph,
264
+ entities,
265
+ graphManagerState.graphBuildState,
266
+ );
294
267
 
295
268
  const query = new Query();
296
269
  query.name = lightQuery.name;
@@ -305,22 +278,6 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
305
278
  execContext.executionKey = executionContext;
306
279
  query.executionContext = execContext;
307
280
  query.content = 'some content';
308
-
309
- const execContextInfo = new QueryDataSpaceExecutionContextInfo();
310
- execContextInfo.dataSpacePath = dataSpacePath;
311
- execContextInfo.executionKey = executionContext;
312
-
313
- const queryInfo: QueryInfo = {
314
- name: TEST_QUERY_NAME,
315
- id: TEST_QUERY_ID,
316
- versionId: '0.0.0',
317
- groupId: 'test.group',
318
- artifactId: 'test-artifact',
319
- executionContext: execContextInfo,
320
- content: 'some content',
321
- isCurrentUserQuery: true,
322
- };
323
-
324
281
  createSpy(
325
282
  MOCK__editorStore.depotServerClient,
326
283
  'getProject',
@@ -328,7 +285,7 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
328
285
  createSpy(
329
286
  MOCK__editorStore.depotServerClient,
330
287
  'getEntities',
331
- ).mockResolvedValue(buildWithMinimalGraph ? [] : entities);
288
+ ).mockResolvedValue([]);
332
289
  createSpy(
333
290
  MOCK__editorStore.depotServerClient,
334
291
  'getIndexedDependencyEntities',
@@ -337,10 +294,6 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
337
294
  MOCK__editorStore.depotServerClient,
338
295
  'getEntitiesByClassifier',
339
296
  ).mockResolvedValue([]);
340
- createSpy(
341
- MOCK__editorStore.depotServerClient,
342
- 'getGenerationContentByPath',
343
- ).mockResolvedValue(JSON.stringify(V1_dataspaceAnalyticsResult));
344
297
  createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
345
298
  lightQuery,
346
299
  );
@@ -355,9 +308,10 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
355
308
  createSpy(graphManagerState.graphManager, 'getQuery').mockResolvedValue(
356
309
  query,
357
310
  );
358
- createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
359
- queryInfo,
360
- );
311
+ createSpy(
312
+ MOCK__editorStore.depotServerClient,
313
+ 'getGenerationContentByPath',
314
+ ).mockResolvedValue('');
361
315
  createSpy(graphManagerState.graphManager, 'surveyDatasets').mockResolvedValue(
362
316
  [],
363
317
  );
@@ -371,12 +325,20 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
371
325
  );
372
326
  const dataspaceAnalyticsResult =
373
327
  await graphManagerExtension.buildDataSpaceAnalytics(
374
- V1_dataspaceAnalyticsResult,
328
+ v1_dataspaceAnalyticsResult,
375
329
  graphManagerState.graphManager.pluginManager.getPureProtocolProcessorPlugins(),
376
330
  );
377
331
  createSpy(graphManagerExtension, 'analyzeDataSpace').mockResolvedValue(
378
332
  dataspaceAnalyticsResult,
379
333
  );
334
+ const mappingAnalyticsResult =
335
+ dataspaceAnalyticsResult.mappingToMappingCoverageResult?.get(mappingPath);
336
+ if (mappingAnalyticsResult) {
337
+ createSpy(
338
+ graphManagerState.graphManager,
339
+ 'analyzeMappingModelCoverage',
340
+ ).mockResolvedValue(mappingAnalyticsResult);
341
+ }
380
342
 
381
343
  MOCK__editorStore.buildGraph = createMock();
382
344
  graphManagerState.graphManager.initialize = createMock();
@@ -15,18 +15,17 @@
15
15
  */
16
16
 
17
17
  import { LegendApplicationPlugin } from '@finos/legend-application';
18
+ import type { Query } from '@finos/legend-graph';
18
19
  import type {
19
- QueryBuilder_LegendApplicationPlugin_Extension,
20
20
  QueryBuilderState,
21
+ QueryBuilder_LegendApplicationPlugin_Extension,
21
22
  } from '@finos/legend-query-builder';
22
- import type React from 'react';
23
23
  import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
24
- import type {
25
- ExistingQueryEditorStore,
26
- QueryEditorStore,
24
+ import {
25
+ type ExistingQueryEditorStore,
26
+ type QueryEditorStore,
27
27
  } from './QueryEditorStore.js';
28
28
  import type { QuerySetupLandingPageStore } from './QuerySetupStore.js';
29
- import type { Query } from '@finos/legend-graph';
30
29
 
31
30
  export enum QuerySetupActionTag {
32
31
  PRODUCTIONIZATION = 'Productionization',