@finos/legend-application-query 13.7.4 → 13.7.6

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 +1 -0
  2. package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendQueryApplicationConfig.js +2 -0
  4. package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
  5. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -2
  6. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  7. package/lib/components/Core_LegendQueryApplicationPlugin.js +157 -4
  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 +9 -2
  11. package/lib/components/QueryEditor.js.map +1 -1
  12. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +3 -3
  13. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  14. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +39 -10
  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 +4 -3
  19. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  20. package/lib/stores/LegendQueryApplicationPlugin.js +0 -1
  21. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  22. package/lib/stores/QueryEditorStore.d.ts +13 -2
  23. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  24. package/lib/stores/QueryEditorStore.js +135 -30
  25. package/lib/stores/QueryEditorStore.js.map +1 -1
  26. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +2 -1
  27. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  28. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +8 -12
  29. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
  30. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +1 -0
  31. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
  32. package/lib/stores/data-space/DataSpaceQuerySetupState.js +1 -0
  33. package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
  34. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +3 -1
  35. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  36. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +41 -24
  37. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  38. package/package.json +15 -15
  39. package/src/application/LegendQueryApplicationConfig.ts +3 -0
  40. package/src/components/Core_LegendQueryApplicationPlugin.tsx +281 -7
  41. package/src/components/QueryEditor.tsx +25 -1
  42. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +72 -25
  43. package/src/stores/LegendQueryApplicationPlugin.tsx +6 -5
  44. package/src/stores/QueryEditorStore.ts +247 -53
  45. package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +17 -28
  46. package/src/stores/data-space/DataSpaceQuerySetupState.ts +1 -0
  47. package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +73 -51
@@ -65,6 +65,8 @@ class LegendQueryApplicationCoreOptions {
65
65
  TEMPORARY__serviceRegistrationConfig: ServiceRegistrationEnvironmentConfig[] =
66
66
  [];
67
67
 
68
+ TEMPORARY__enableMinimalGraph = false;
69
+
68
70
  /**
69
71
  * Config specific to query builder
70
72
  */
@@ -78,6 +80,7 @@ class LegendQueryApplicationCoreOptions {
78
80
  queryBuilderConfig: optional(
79
81
  usingModelSchema(QueryBuilderConfig.serialization.schema),
80
82
  ),
83
+ TEMPORARY__enableMinimalGraph: optional(primitive()),
81
84
  }),
82
85
  );
83
86
 
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import {
18
+ type QuerySetupActionConfiguration,
18
19
  LegendQueryApplicationPlugin,
19
20
  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
- ActionAlertActionType,
54
- ActionAlertType,
55
53
  type ApplicationPageEntry,
56
54
  type LegendApplicationSetup,
55
+ ActionAlertActionType,
56
+ ActionAlertType,
57
57
  } from '@finos/legend-application';
58
58
  import { CloneQueryServiceSetup } from './CloneQueryServiceSetup.js';
59
59
  import { QueryProductionizerSetup } from './QueryProductionizerSetup.js';
@@ -65,9 +65,11 @@ import {
65
65
  generateDataSpaceQuerySetupRoute,
66
66
  } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
67
67
  import {
68
- QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
68
+ type QueryBuilderState,
69
69
  type QueryBuilderHeaderActionConfiguration,
70
70
  type QueryBuilderMenuActionConfiguration,
71
+ type QueryBuilderPropagateExecutionContextChangeHelper,
72
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
71
73
  } from '@finos/legend-query-builder';
72
74
  import {
73
75
  ExistingQueryEditorStore,
@@ -75,18 +77,48 @@ import {
75
77
  } from '../stores/QueryEditorStore.js';
76
78
  import {
77
79
  DataSpaceQueryBuilderState,
80
+ DataSpacesDepotRepository,
78
81
  generateDataSpaceTemplateQueryPromotionRoute,
79
82
  } from '@finos/legend-extension-dsl-data-space/application';
80
- import { RuntimePointer } from '@finos/legend-graph';
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';
81
96
  import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
82
- import { StoreProjectData } from '@finos/legend-server-depot';
83
- import { buildUrl } from '@finos/legend-shared';
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';
84
109
  import { parseProjectIdentifier } from '@finos/legend-storage';
85
110
  import { QueryEditorExistingQueryHeader } from './QueryEditor.js';
86
111
  import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
87
112
  import { createViewSDLCProjectHandler } from '../stores/data-space/DataSpaceQueryBuilderHelper.js';
88
113
  import { DataSpaceQueryCreatorStore } from '../stores/data-space/DataSpaceQueryCreatorStore.js';
89
114
  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';
90
122
 
91
123
  export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
92
124
  static NAME = packageJson.extensions.applicationQueryPlugin;
@@ -725,4 +757,246 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
725
757
  },
726
758
  };
727
759
  }
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
+ }
728
1002
  }
@@ -605,6 +605,12 @@ 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
+
608
614
  const TEMPORARY__toggleLightDarkMode = (): void => {
609
615
  applicationStore.layoutService.setColorTheme(
610
616
  applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
@@ -629,7 +635,11 @@ export const QueryEditor = observer(() => {
629
635
  applicationStore.alertUnhandledError,
630
636
  );
631
637
  applicationStore.releaseNotesService.updateViewedVersion();
632
- }, [editorStore, applicationStore]);
638
+ }, [
639
+ editorStore,
640
+ applicationStore,
641
+ editorStore.enableMinialGraphForDataSpaceLoadingPerformance,
642
+ ]);
633
643
 
634
644
  return (
635
645
  <div className="query-editor">
@@ -676,6 +686,20 @@ export const QueryEditor = observer(() => {
676
686
  Compress request payload
677
687
  </MenuContentItemLabel>
678
688
  </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>
679
703
  </MenuContent>
680
704
  }
681
705
  >
@@ -25,12 +25,15 @@ import { createMock, createSpy } from '@finos/legend-shared/test';
25
25
  import {
26
26
  type GraphManagerState,
27
27
  type RawMappingModelCoverageAnalysisResult,
28
+ type QueryInfo,
28
29
  Query,
29
30
  LightQuery,
30
31
  RawLambda,
31
- PackageableElementExplicitReference,
32
32
  QueryExplicitExecutionContext,
33
33
  QueryDataSpaceExecutionContext,
34
+ PackageableElementExplicitReference,
35
+ QueryDataSpaceExecutionContextInfo,
36
+ QueryExplicitExecutionContextInfo,
34
37
  } from '@finos/legend-graph';
35
38
  import { DepotServerClient } from '@finos/legend-server-depot';
36
39
  import {
@@ -40,7 +43,11 @@ import {
40
43
  import { TEST__getTestLegendQueryApplicationConfig } from '../../stores/__test-utils__/LegendQueryApplicationTestUtils.js';
41
44
  import { LegendQueryPluginManager } from '../../application/LegendQueryPluginManager.js';
42
45
  import { ExistingQueryEditor } from '../QueryEditor.js';
43
- import type { EntitiesWithOrigin, Entity } from '@finos/legend-storage';
46
+ import type {
47
+ EntitiesWithOrigin,
48
+ Entity,
49
+ StoredFileGeneration,
50
+ } from '@finos/legend-storage';
44
51
  import { ExistingQueryEditorStore } from '../../stores/QueryEditorStore.js';
45
52
  import type { LegendQueryApplicationStore } from '../../stores/LegendQueryBaseStore.js';
46
53
  import {
@@ -104,7 +111,7 @@ export const TEST__provideMockedQueryEditorStore = (customization?: {
104
111
 
105
112
  export const TEST__setUpQueryEditor = async (
106
113
  MOCK__editorStore: ExistingQueryEditorStore,
107
- entities: Entity[],
114
+ entities: PlainObject<Entity>[],
108
115
  lambda: RawLambda,
109
116
  mappingPath: string,
110
117
  runtimePath: string,
@@ -142,7 +149,7 @@ export const TEST__setUpQueryEditor = async (
142
149
  await graphManagerState.initializeSystem();
143
150
  await graphManagerState.graphManager.buildGraph(
144
151
  graphManagerState.graph,
145
- entities,
152
+ entities as unknown as Entity[],
146
153
  graphManagerState.graphBuildState,
147
154
  );
148
155
 
@@ -162,13 +169,36 @@ export const TEST__setUpQueryEditor = async (
162
169
  );
163
170
  query.executionContext = execContext;
164
171
  query.content = 'some content';
172
+
173
+ const execContextInfo = new QueryExplicitExecutionContextInfo();
174
+ execContextInfo.mapping = mappingPath;
175
+ execContextInfo.runtime = runtimePath;
176
+
177
+ const queryInfo: QueryInfo = {
178
+ name: TEST_QUERY_NAME,
179
+ id: TEST_QUERY_ID,
180
+ versionId: '0.0.0',
181
+ groupId: 'test.group',
182
+ artifactId: 'test-artifact',
183
+ executionContext: execContextInfo,
184
+ content: 'some content',
185
+ isCurrentUserQuery: true,
186
+ };
187
+
165
188
  createSpy(
166
189
  MOCK__editorStore.depotServerClient,
167
190
  'getProject',
168
191
  ).mockResolvedValue(projectData);
192
+ createSpy(
193
+ MOCK__editorStore.depotServerClient,
194
+ 'getEntities',
195
+ ).mockResolvedValue(entities);
169
196
  createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
170
197
  lightQuery,
171
198
  );
199
+ createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
200
+ queryInfo,
201
+ );
172
202
  createSpy(
173
203
  graphManagerState.graphManager,
174
204
  'pureCodeToLambda',
@@ -222,16 +252,23 @@ export const TEST__setUpQueryEditor = async (
222
252
 
223
253
  export const TEST__setUpDataSpaceExistingQueryEditor = async (
224
254
  MOCK__editorStore: ExistingQueryEditorStore,
225
- v1_dataspaceAnalyticsResult: PlainObject<V1_DataSpaceAnalysisResult>,
255
+ V1_dataspaceAnalyticsResult: PlainObject<V1_DataSpaceAnalysisResult>,
226
256
  dataSpacePath: string,
227
257
  executionContext: string,
228
258
  lambda: RawLambda,
229
259
  mappingPath: string,
230
- entities: Entity[],
260
+ entities: PlainObject<Entity>[],
261
+ buildWithMinimalGraph = false,
262
+ V1_dataspaceArtifacts: PlainObject<StoredFileGeneration>[] = [],
231
263
  ): Promise<{
232
264
  renderResult: RenderResult;
233
265
  queryBuilderState: QueryBuilderState;
234
266
  }> => {
267
+ if (buildWithMinimalGraph) {
268
+ MOCK__editorStore.applicationStore.config.options.TEMPORARY__enableMinimalGraph =
269
+ true;
270
+ }
271
+
235
272
  const projectData = {
236
273
  id: 'test-id',
237
274
  groupId: 'test.group',
@@ -259,11 +296,6 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
259
296
  });
260
297
 
261
298
  await graphManagerState.initializeSystem();
262
- await graphManagerState.graphManager.buildGraph(
263
- graphManagerState.graph,
264
- entities,
265
- graphManagerState.graphBuildState,
266
- );
267
299
 
268
300
  const query = new Query();
269
301
  query.name = lightQuery.name;
@@ -278,6 +310,22 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
278
310
  execContext.executionKey = executionContext;
279
311
  query.executionContext = execContext;
280
312
  query.content = 'some content';
313
+
314
+ const execContextInfo = new QueryDataSpaceExecutionContextInfo();
315
+ execContextInfo.dataSpacePath = dataSpacePath;
316
+ execContextInfo.executionKey = executionContext;
317
+
318
+ const queryInfo: QueryInfo = {
319
+ name: TEST_QUERY_NAME,
320
+ id: TEST_QUERY_ID,
321
+ versionId: '0.0.0',
322
+ groupId: 'test.group',
323
+ artifactId: 'test-artifact',
324
+ executionContext: execContextInfo,
325
+ content: 'some content',
326
+ isCurrentUserQuery: true,
327
+ };
328
+
281
329
  createSpy(
282
330
  MOCK__editorStore.depotServerClient,
283
331
  'getProject',
@@ -285,7 +333,7 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
285
333
  createSpy(
286
334
  MOCK__editorStore.depotServerClient,
287
335
  'getEntities',
288
- ).mockResolvedValue([]);
336
+ ).mockResolvedValue(buildWithMinimalGraph ? [] : entities);
289
337
  createSpy(
290
338
  MOCK__editorStore.depotServerClient,
291
339
  'getIndexedDependencyEntities',
@@ -294,6 +342,14 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
294
342
  MOCK__editorStore.depotServerClient,
295
343
  'getEntitiesByClassifier',
296
344
  ).mockResolvedValue([]);
345
+ createSpy(
346
+ MOCK__editorStore.depotServerClient,
347
+ 'getGenerationContentByPath',
348
+ ).mockResolvedValue(JSON.stringify(V1_dataspaceAnalyticsResult));
349
+ createSpy(
350
+ MOCK__editorStore.depotServerClient,
351
+ 'getGenerationFilesByType',
352
+ ).mockResolvedValue(V1_dataspaceArtifacts);
297
353
  createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
298
354
  lightQuery,
299
355
  );
@@ -308,10 +364,9 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
308
364
  createSpy(graphManagerState.graphManager, 'getQuery').mockResolvedValue(
309
365
  query,
310
366
  );
311
- createSpy(
312
- MOCK__editorStore.depotServerClient,
313
- 'getGenerationContentByPath',
314
- ).mockResolvedValue('');
367
+ createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
368
+ queryInfo,
369
+ );
315
370
  createSpy(graphManagerState.graphManager, 'surveyDatasets').mockResolvedValue(
316
371
  [],
317
372
  );
@@ -325,20 +380,12 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
325
380
  );
326
381
  const dataspaceAnalyticsResult =
327
382
  await graphManagerExtension.buildDataSpaceAnalytics(
328
- v1_dataspaceAnalyticsResult,
383
+ V1_dataspaceAnalyticsResult,
329
384
  graphManagerState.graphManager.pluginManager.getPureProtocolProcessorPlugins(),
330
385
  );
331
386
  createSpy(graphManagerExtension, 'analyzeDataSpace').mockResolvedValue(
332
387
  dataspaceAnalyticsResult,
333
388
  );
334
- const mappingAnalyticsResult =
335
- dataspaceAnalyticsResult.mappingToMappingCoverageResult?.get(mappingPath);
336
- if (mappingAnalyticsResult) {
337
- createSpy(
338
- graphManagerState.graphManager,
339
- 'analyzeMappingModelCoverage',
340
- ).mockResolvedValue(mappingAnalyticsResult);
341
- }
342
389
 
343
390
  MOCK__editorStore.buildGraph = createMock();
344
391
  graphManagerState.graphManager.initialize = createMock();
@@ -15,17 +15,18 @@
15
15
  */
16
16
 
17
17
  import { LegendApplicationPlugin } from '@finos/legend-application';
18
- import type { Query } from '@finos/legend-graph';
19
18
  import type {
20
- QueryBuilderState,
21
19
  QueryBuilder_LegendApplicationPlugin_Extension,
20
+ QueryBuilderState,
22
21
  } from '@finos/legend-query-builder';
22
+ import type React from 'react';
23
23
  import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
24
- import {
25
- type ExistingQueryEditorStore,
26
- type QueryEditorStore,
24
+ import type {
25
+ ExistingQueryEditorStore,
26
+ QueryEditorStore,
27
27
  } from './QueryEditorStore.js';
28
28
  import type { QuerySetupLandingPageStore } from './QuerySetupStore.js';
29
+ import type { Query } from '@finos/legend-graph';
29
30
 
30
31
  export enum QuerySetupActionTag {
31
32
  PRODUCTIONIZATION = 'Productionization',