@finos/legend-application-query 13.7.4 → 13.7.5

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 +1 -1
  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 +9 -9
  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
@@ -49,6 +49,7 @@ import {
49
49
  type ValueSpecification,
50
50
  type GraphInitializationReport,
51
51
  type PackageableRuntime,
52
+ type QueryInfo,
52
53
  GraphManagerState,
53
54
  Query,
54
55
  PureExecution,
@@ -65,12 +66,15 @@ import {
65
66
  reportGraphAnalytics,
66
67
  cloneQueryStereotype,
67
68
  cloneQueryTaggedValue,
68
- QueryDataSpaceExecutionContext,
69
- QueryExplicitExecutionContext,
70
69
  QueryProjectCoordinates,
71
70
  buildLambdaVariableExpressions,
72
71
  VariableExpression,
73
72
  PrimitiveType,
73
+ CORE_PURE_PATH,
74
+ isValidFullPath,
75
+ QUERY_PROFILE_PATH,
76
+ QueryDataSpaceExecutionContextInfo,
77
+ QueryExplicitExecutionContextInfo,
74
78
  } from '@finos/legend-graph';
75
79
  import {
76
80
  generateExistingQueryEditorRoute,
@@ -90,6 +94,7 @@ import {
90
94
  StoreProjectData,
91
95
  LATEST_VERSION_ALIAS,
92
96
  VersionedProjectData,
97
+ retrieveProjectEntitiesWithClassifier,
93
98
  } from '@finos/legend-server-depot';
94
99
  import {
95
100
  ActionAlertActionType,
@@ -119,11 +124,14 @@ import {
119
124
  type DataSpaceInfo,
120
125
  } from '@finos/legend-extension-dsl-data-space/application';
121
126
  import {
122
- DSL_DataSpace_getGraphManagerExtension,
123
127
  type DataSpace,
124
128
  type DataSpaceExecutionContext,
129
+ type DataSpaceAnalysisResult,
130
+ DSL_DataSpace_getGraphManagerExtension,
125
131
  getOwnDataSpace,
132
+ QUERY_PROFILE_TAG_DATA_SPACE,
126
133
  retrieveAnalyticsResultCache,
134
+ retrieveDataspaceArtifactsCache,
127
135
  } from '@finos/legend-extension-dsl-data-space/graph';
128
136
  import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
129
137
  import { hasDataSpaceInfoBeenVisited } from '../__lib__/LegendQueryUserDataSpaceHelper.js';
@@ -269,6 +277,7 @@ export abstract class QueryEditorStore {
269
277
  showRegisterServiceModal = false;
270
278
  showAppInfo = false;
271
279
  showDataspaceInfo = false;
280
+ enableMinialGraphForDataSpaceLoadingPerformance = true;
272
281
 
273
282
  constructor(
274
283
  applicationStore: LegendQueryApplicationStore,
@@ -282,13 +291,16 @@ export abstract class QueryEditorStore {
282
291
  showAppInfo: observable,
283
292
  showDataspaceInfo: observable,
284
293
  queryBuilderState: observable,
294
+ enableMinialGraphForDataSpaceLoadingPerformance: observable,
285
295
  isPerformingBlockingAction: computed,
286
296
  setExistingQueryName: action,
287
297
  setShowRegisterServiceModal: action,
288
298
  setShowAppInfo: action,
289
299
  setShowDataspaceInfo: action,
300
+ setEnableMinialGraphForDataSpaceLoadingPerformance: action,
290
301
  initialize: flow,
291
302
  buildGraph: flow,
303
+ buildFullGraph: flow,
292
304
  searchExistingQueryName: flow,
293
305
  });
294
306
 
@@ -390,6 +402,10 @@ export abstract class QueryEditorStore {
390
402
  this.showRegisterServiceModal = val;
391
403
  }
392
404
 
405
+ setEnableMinialGraphForDataSpaceLoadingPerformance(val: boolean): void {
406
+ this.enableMinialGraphForDataSpaceLoadingPerformance = val;
407
+ }
408
+
393
409
  get isPerformingBlockingAction(): boolean {
394
410
  return this.queryCreatorState.createQueryState.isInProgress;
395
411
  }
@@ -480,7 +496,10 @@ export abstract class QueryEditorStore {
480
496
  ): QueryPersistConfiguration | undefined;
481
497
 
482
498
  *initialize(): GeneratorFn<void> {
483
- if (!this.initState.isInInitialState) {
499
+ if (
500
+ !this.initState.isInInitialState &&
501
+ this.enableMinialGraphForDataSpaceLoadingPerformance
502
+ ) {
484
503
  return;
485
504
  }
486
505
 
@@ -563,7 +582,7 @@ export abstract class QueryEditorStore {
563
582
  );
564
583
  }
565
584
 
566
- *buildGraph(): GeneratorFn<void> {
585
+ *buildFullGraph(): GeneratorFn<void> {
567
586
  const stopWatch = new StopWatch();
568
587
 
569
588
  const projectInfo = this.getProjectInfo();
@@ -653,6 +672,7 @@ export abstract class QueryEditorStore {
653
672
  dependenciesCount:
654
673
  this.graphManagerState.graph.dependencyManager.numberOfDependencies,
655
674
  graph: graph_buildReport,
675
+ isLightGraphEnabled: false,
656
676
  };
657
677
  this.logBuildGraphMetrics(graphBuilderReportData);
658
678
 
@@ -662,6 +682,140 @@ export abstract class QueryEditorStore {
662
682
  );
663
683
  }
664
684
  }
685
+
686
+ *buildGraph(): GeneratorFn<void> {
687
+ yield flowResult(this.buildFullGraph());
688
+ }
689
+
690
+ async buildGraphAndDataspaceAnalyticsResult(
691
+ groupId: string,
692
+ artifactId: string,
693
+ versionId: string,
694
+ executionContext: string | undefined,
695
+ dataSpacePath: string,
696
+ templateQueryId?: string | undefined,
697
+ ): Promise<{
698
+ dataSpaceAnalysisResult: DataSpaceAnalysisResult | undefined;
699
+ isLightGraphEnabled: boolean;
700
+ }> {
701
+ let dataSpaceAnalysisResult;
702
+ let buildFullGraph = false;
703
+ let isLightGraphEnabled = true;
704
+ const supportBuildMinimalGraph =
705
+ this.applicationStore.config.options.TEMPORARY__enableMinimalGraph;
706
+ if (
707
+ this.enableMinialGraphForDataSpaceLoadingPerformance &&
708
+ supportBuildMinimalGraph
709
+ ) {
710
+ try {
711
+ this.initState.setMessage('Fetching dataspace analysis result...');
712
+ const project = StoreProjectData.serialization.fromJson(
713
+ await this.depotServerClient.getProject(groupId, artifactId),
714
+ );
715
+ const graph_buildReport = createGraphBuilderReport();
716
+ const stopWatch = new StopWatch();
717
+ // initialize system
718
+ stopWatch.record();
719
+ await this.graphManagerState.initializeSystem();
720
+ stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS);
721
+ const dependency_buildReport = createGraphBuilderReport();
722
+ dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
723
+ this.graphManagerState.graphManager,
724
+ ).analyzeDataSpaceCoverage(
725
+ dataSpacePath,
726
+ () =>
727
+ retrieveProjectEntitiesWithClassifier(
728
+ project,
729
+ versionId,
730
+ CORE_PURE_PATH.FUNCTION,
731
+ this.depotServerClient,
732
+ ),
733
+ () =>
734
+ retrieveDataspaceArtifactsCache(
735
+ project,
736
+ versionId,
737
+ this.depotServerClient,
738
+ ),
739
+ undefined,
740
+ graph_buildReport,
741
+ this.graphManagerState.graph,
742
+ executionContext,
743
+ undefined,
744
+ this.getProjectInfo(),
745
+ templateQueryId,
746
+ );
747
+ const mappingPath = executionContext
748
+ ? dataSpaceAnalysisResult.executionContextsIndex.get(executionContext)
749
+ ?.mapping.path
750
+ : undefined;
751
+ if (mappingPath) {
752
+ const pmcd =
753
+ dataSpaceAnalysisResult.mappingToMappingCoverageResult?.get(
754
+ mappingPath,
755
+ )?.entities;
756
+ if (pmcd) {
757
+ // report
758
+ stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
759
+ const graphBuilderReportData = {
760
+ timings:
761
+ this.applicationStore.timeService.finalizeTimingsRecord(
762
+ stopWatch,
763
+ ),
764
+ dependencies: dependency_buildReport,
765
+ dependenciesCount:
766
+ this.graphManagerState.graph.dependencyManager
767
+ .numberOfDependencies,
768
+ graph: graph_buildReport,
769
+ isLightGraphEnabled: true,
770
+ };
771
+ this.logBuildGraphMetrics(graphBuilderReportData);
772
+ this.applicationStore.logService.info(
773
+ LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS),
774
+ graphBuilderReportData,
775
+ );
776
+ } else {
777
+ buildFullGraph = true;
778
+ }
779
+ }
780
+ } catch (error) {
781
+ buildFullGraph = true;
782
+ this.applicationStore.logService.error(
783
+ LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
784
+ error,
785
+ );
786
+ }
787
+ }
788
+ if (
789
+ !this.enableMinialGraphForDataSpaceLoadingPerformance ||
790
+ buildFullGraph ||
791
+ !supportBuildMinimalGraph
792
+ ) {
793
+ this.graphManagerState.graph = this.graphManagerState.createNewGraph();
794
+ await flowResult(this.buildFullGraph());
795
+ try {
796
+ const project = StoreProjectData.serialization.fromJson(
797
+ await this.depotServerClient.getProject(groupId, artifactId),
798
+ );
799
+ dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
800
+ this.graphManagerState.graphManager,
801
+ ).retrieveDataSpaceAnalysisFromCache(() =>
802
+ retrieveAnalyticsResultCache(
803
+ project,
804
+ versionId,
805
+ dataSpacePath,
806
+ this.depotServerClient,
807
+ ),
808
+ );
809
+ } catch {
810
+ // do nothing
811
+ }
812
+ isLightGraphEnabled = false;
813
+ }
814
+ return {
815
+ dataSpaceAnalysisResult,
816
+ isLightGraphEnabled,
817
+ };
818
+ }
665
819
  }
666
820
 
667
821
  export class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
@@ -1182,6 +1336,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1182
1336
  private queryId: string;
1183
1337
  private _lightQuery?: LightQuery | undefined;
1184
1338
  query: Query | undefined;
1339
+ queryInfo: QueryInfo | undefined;
1185
1340
  urlQueryParamValues: Record<string, string> | undefined;
1186
1341
  updateState: ExistingQueryUpdateState;
1187
1342
 
@@ -1195,11 +1350,13 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1195
1350
 
1196
1351
  makeObservable<ExistingQueryEditorStore, '_lightQuery'>(this, {
1197
1352
  query: observable,
1353
+ queryInfo: observable,
1198
1354
  updateState: observable,
1199
1355
  _lightQuery: observable,
1200
1356
  lightQuery: computed,
1201
1357
  setLightQuery: action,
1202
1358
  setQuery: action,
1359
+ setQueryInfo: action,
1203
1360
  isPerformingBlockingAction: override,
1204
1361
  });
1205
1362
 
@@ -1246,6 +1403,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1246
1403
  this.query = val;
1247
1404
  }
1248
1405
 
1406
+ setQueryInfo(val: QueryInfo): void {
1407
+ this.queryInfo = val;
1408
+ }
1409
+
1249
1410
  getProjectInfo(): ProjectGAVCoordinates {
1250
1411
  return {
1251
1412
  groupId: this.lightQuery.groupId,
@@ -1254,52 +1415,73 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1254
1415
  };
1255
1416
  }
1256
1417
 
1418
+ override *buildGraph(): GeneratorFn<void> {
1419
+ const queryInfo = this.queryInfo;
1420
+ const dataSpaceTaggedValue = queryInfo?.taggedValues?.find(
1421
+ (taggedValue) =>
1422
+ taggedValue.profile === QUERY_PROFILE_PATH &&
1423
+ taggedValue.tag === QUERY_PROFILE_TAG_DATA_SPACE &&
1424
+ isValidFullPath(taggedValue.value),
1425
+ );
1426
+ if (
1427
+ !(
1428
+ dataSpaceTaggedValue !== undefined ||
1429
+ queryInfo?.executionContext instanceof
1430
+ QueryDataSpaceExecutionContextInfo
1431
+ )
1432
+ ) {
1433
+ yield flowResult(this.buildFullGraph());
1434
+ }
1435
+ }
1436
+
1257
1437
  override async setUpEditorState(): Promise<void> {
1438
+ const queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
1439
+ this.queryId,
1440
+ );
1258
1441
  this.setLightQuery(
1259
1442
  await this.graphManagerState.graphManager.getLightQuery(this.queryId),
1260
1443
  );
1444
+ this.setQueryInfo(queryInfo);
1445
+ LegendQueryUserDataHelper.addRecentlyViewedQuery(
1446
+ this.applicationStore.userDataService,
1447
+ queryInfo.id,
1448
+ );
1261
1449
  }
1262
1450
 
1263
- async initQueryBuildStateFromQuery(query: Query): Promise<QueryBuilderState> {
1264
- const exec = query.executionContext;
1265
- if (exec instanceof QueryDataSpaceExecutionContext) {
1451
+ async initQueryBuildStateFromQuery(
1452
+ queryInfo: QueryInfo,
1453
+ ): Promise<QueryBuilderState> {
1454
+ const exec = queryInfo.executionContext;
1455
+ if (exec instanceof QueryDataSpaceExecutionContextInfo) {
1456
+ const { dataSpaceAnalysisResult, isLightGraphEnabled } =
1457
+ await this.buildGraphAndDataspaceAnalyticsResult(
1458
+ queryInfo.groupId,
1459
+ queryInfo.artifactId,
1460
+ queryInfo.versionId,
1461
+ exec.executionKey,
1462
+ exec.dataSpacePath,
1463
+ );
1266
1464
  const dataSpace = getOwnDataSpace(
1267
1465
  exec.dataSpacePath,
1268
1466
  this.graphManagerState.graph,
1269
1467
  );
1468
+ const mapping = queryInfo.mapping
1469
+ ? this.graphManagerState.graph.getMapping(queryInfo.mapping)
1470
+ : undefined;
1471
+ const runtime = queryInfo.runtime
1472
+ ? this.graphManagerState.graph.getRuntime(queryInfo.runtime)
1473
+ : undefined;
1270
1474
  const matchingExecutionContext = resolveExecutionContext(
1271
1475
  dataSpace,
1272
1476
  exec.executionKey,
1273
- query.mapping?.value,
1274
- query.runtime?.value,
1477
+ mapping,
1478
+ runtime,
1275
1479
  );
1276
1480
  if (matchingExecutionContext) {
1277
- let dataSpaceAnalysisResult;
1278
- try {
1279
- const project = StoreProjectData.serialization.fromJson(
1280
- await this.depotServerClient.getProject(
1281
- query.groupId,
1282
- query.artifactId,
1283
- ),
1284
- );
1285
- dataSpaceAnalysisResult =
1286
- await DSL_DataSpace_getGraphManagerExtension(
1287
- this.graphManagerState.graphManager,
1288
- ).retrieveDataSpaceAnalysisFromCache(() =>
1289
- retrieveAnalyticsResultCache(
1290
- project,
1291
- query.versionId,
1292
- dataSpace.path,
1293
- this.depotServerClient,
1294
- ),
1295
- );
1296
- } catch {
1297
- // do nothing
1298
- }
1299
1481
  const sourceInfo = {
1300
- groupId: query.groupId,
1301
- artifactId: query.artifactId,
1302
- versionId: query.versionId,
1482
+ groupId: queryInfo.groupId,
1483
+ artifactId: queryInfo.artifactId,
1484
+ versionId: queryInfo.versionId,
1303
1485
  dataSpace: dataSpace.path,
1304
1486
  };
1305
1487
  const visitedDataSpaces =
@@ -1313,15 +1495,16 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1313
1495
  new QueryBuilderActionConfig_QueryApplication(this),
1314
1496
  dataSpace,
1315
1497
  matchingExecutionContext,
1498
+ isLightGraphEnabled,
1316
1499
  createDataSpaceDepoRepo(
1317
1500
  this,
1318
- query.groupId,
1319
- query.artifactId,
1320
- query.versionId,
1501
+ queryInfo.groupId,
1502
+ queryInfo.artifactId,
1503
+ queryInfo.versionId,
1321
1504
  (dataSpaceInfo: DataSpaceInfo) =>
1322
1505
  hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
1323
1506
  ),
1324
- (dataSpaceInfo: DataSpaceInfo) => {
1507
+ async (dataSpaceInfo: DataSpaceInfo) => {
1325
1508
  if (dataSpaceInfo.defaultExecutionContext) {
1326
1509
  const proceed = (): void =>
1327
1510
  this.applicationStore.navigationService.navigator.goToLocation(
@@ -1351,7 +1534,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1351
1534
  }
1352
1535
  };
1353
1536
  if (
1354
- !query.isCurrentUserQuery ||
1537
+ !queryInfo.isCurrentUserQuery ||
1355
1538
  !this.queryBuilderState?.changeDetectionState.hasChanged
1356
1539
  ) {
1357
1540
  proceed();
@@ -1415,7 +1598,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1415
1598
  `Unsupported execution context ${exec.executionKey}`,
1416
1599
  );
1417
1600
  }
1418
- } else if (exec instanceof QueryExplicitExecutionContext) {
1601
+ } else if (exec instanceof QueryExplicitExecutionContextInfo) {
1419
1602
  const projectInfo = this.getProjectInfo();
1420
1603
  const sourceInfo = {
1421
1604
  groupId: projectInfo.groupId,
@@ -1433,12 +1616,18 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1433
1616
  new QueryBuilderActionConfig_QueryApplication(this),
1434
1617
  );
1435
1618
  classQueryBuilderState.executionContextState.setMapping(
1436
- exec.mapping.value,
1619
+ exec.mapping
1620
+ ? this.graphManagerState.graph.getMapping(exec.mapping)
1621
+ : undefined,
1437
1622
  );
1438
1623
  classQueryBuilderState.executionContextState.setRuntimeValue(
1439
- new RuntimePointer(
1440
- PackageableElementExplicitReference.create(exec.runtime.value),
1441
- ),
1624
+ exec.runtime
1625
+ ? new RuntimePointer(
1626
+ PackageableElementExplicitReference.create(
1627
+ this.graphManagerState.graph.getRuntime(exec.runtime),
1628
+ ),
1629
+ )
1630
+ : undefined,
1442
1631
  );
1443
1632
  return classQueryBuilderState;
1444
1633
  }
@@ -1448,6 +1637,19 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1448
1637
  async initializeQueryBuilderState(
1449
1638
  stopWatch: StopWatch,
1450
1639
  ): Promise<QueryBuilderState> {
1640
+ // if no extension found, fall back to basic `class -> mapping -> runtime` mode
1641
+ let queryInfo = this.queryInfo;
1642
+ if (!queryInfo) {
1643
+ queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
1644
+ this.queryId,
1645
+ );
1646
+ }
1647
+ const queryBuilderState =
1648
+ await this.initQueryBuildStateFromQuery(queryInfo);
1649
+ const initailizeQueryStateStopWatch = new StopWatch();
1650
+ const initailizeQueryStateReport = reportGraphAnalytics(
1651
+ this.graphManagerState.graph,
1652
+ );
1451
1653
  const query = await this.graphManagerState.graphManager.getQuery(
1452
1654
  this.queryId,
1453
1655
  this.graphManagerState.graph,
@@ -1457,14 +1659,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1457
1659
  this.applicationStore.userDataService,
1458
1660
  query.id,
1459
1661
  );
1460
-
1461
- // if no extension found, fall back to basic `class -> mapping -> runtime` mode
1462
- const queryBuilderState = await this.initQueryBuildStateFromQuery(query);
1463
-
1464
- const initailizeQueryStateStopWatch = new StopWatch();
1465
- const initailizeQueryStateReport = reportGraphAnalytics(
1466
- this.graphManagerState.graph,
1467
- );
1468
1662
  const existingQueryLambda =
1469
1663
  await this.graphManagerState.graphManager.pureCodeToLambda(query.content);
1470
1664
 
@@ -25,7 +25,6 @@ import {
25
25
  } from '@finos/legend-graph';
26
26
  import {
27
27
  type DepotServerClient,
28
- StoreProjectData,
29
28
  LATEST_VERSION_ALIAS,
30
29
  } from '@finos/legend-server-depot';
31
30
  import {
@@ -48,9 +47,7 @@ import {
48
47
  } from '@finos/legend-storage';
49
48
  import {
50
49
  type DataSpaceExecutionContext,
51
- DSL_DataSpace_getGraphManagerExtension,
52
50
  getDataSpace,
53
- retrieveAnalyticsResultCache,
54
51
  } from '@finos/legend-extension-dsl-data-space/graph';
55
52
  import {
56
53
  QueryBuilderActionConfig_QueryApplication,
@@ -59,17 +56,17 @@ import {
59
56
  } from '../QueryEditorStore.js';
60
57
  import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
61
58
  import {
59
+ type DataSpaceInfo,
62
60
  DataSpaceQueryBuilderState,
63
61
  createQueryClassTaggedValue,
64
62
  createQueryDataSpaceTaggedValue,
65
- type DataSpaceInfo,
66
63
  } from '@finos/legend-extension-dsl-data-space/application';
67
64
  import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
68
65
  import {
66
+ type VisitedDataspace,
69
67
  createVisitedDataSpaceId,
70
68
  hasDataSpaceInfoBeenVisited,
71
69
  createSimpleVisitedDataspace,
72
- type VisitedDataspace,
73
70
  } from '../../__lib__/LegendQueryUserDataSpaceHelper.js';
74
71
  import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
75
72
  import {
@@ -277,6 +274,14 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
277
274
  async initializeQueryBuilderStateWithQueryableDataSpace(
278
275
  queryableDataSpace: QueryableDataSpace,
279
276
  ): Promise<QueryBuilderState> {
277
+ const { dataSpaceAnalysisResult, isLightGraphEnabled } =
278
+ await this.buildGraphAndDataspaceAnalyticsResult(
279
+ queryableDataSpace.groupId,
280
+ queryableDataSpace.artifactId,
281
+ queryableDataSpace.versionId,
282
+ queryableDataSpace.executionContext,
283
+ queryableDataSpace.dataSpacePath,
284
+ );
280
285
  const dataSpace = getDataSpace(
281
286
  queryableDataSpace.dataSpacePath,
282
287
  this.graphManagerState.graph,
@@ -287,27 +292,6 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
287
292
  ),
288
293
  `Can't find execution context '${queryableDataSpace.executionContext}'`,
289
294
  );
290
- let dataSpaceAnalysisResult;
291
- try {
292
- const project = StoreProjectData.serialization.fromJson(
293
- await this.depotServerClient.getProject(
294
- queryableDataSpace.groupId,
295
- queryableDataSpace.artifactId,
296
- ),
297
- );
298
- dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
299
- this.graphManagerState.graphManager,
300
- ).retrieveDataSpaceAnalysisFromCache(() =>
301
- retrieveAnalyticsResultCache(
302
- project,
303
- queryableDataSpace.versionId,
304
- dataSpace.path,
305
- this.depotServerClient,
306
- ),
307
- );
308
- } catch {
309
- // do nothing
310
- }
311
295
  const sourceInfo = {
312
296
  groupId: queryableDataSpace.groupId,
313
297
  artifactId: queryableDataSpace.artifactId,
@@ -325,6 +309,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
325
309
  new QueryBuilderActionConfig_QueryApplication(this),
326
310
  dataSpace,
327
311
  executionContext,
312
+ isLightGraphEnabled,
328
313
  createDataSpaceDepoRepo(
329
314
  this,
330
315
  queryableDataSpace.groupId,
@@ -333,7 +318,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
333
318
  (dataSpaceInfo: DataSpaceInfo) =>
334
319
  hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
335
320
  ),
336
- (dataSpaceInfo: DataSpaceInfo) => {
321
+ async (dataSpaceInfo: DataSpaceInfo) => {
337
322
  flowResult(this.changeDataSpace(dataSpaceInfo)).catch(
338
323
  this.applicationStore.alertUnhandledError,
339
324
  );
@@ -361,7 +346,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
361
346
  );
362
347
  }
363
348
  queryBuilderState.setExecutionContext(executionContext);
364
- queryBuilderState.propagateExecutionContextChange(executionContext);
349
+ await queryBuilderState.propagateExecutionContextChange(true);
365
350
 
366
351
  // set runtime if already chosen
367
352
  if (queryableDataSpace.runtimePath) {
@@ -417,6 +402,10 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
417
402
  }
418
403
  }
419
404
 
405
+ override *buildGraph(): GeneratorFn<void> {
406
+ // do nothing
407
+ }
408
+
420
409
  addVisitedDataSpace(queryableDataSpace: QueryableDataSpace): void {
421
410
  try {
422
411
  LegendQueryUserDataHelper.addVisitedDatspace(
@@ -67,6 +67,7 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
67
67
  dataSpaces: DataSpaceInfo[] = [];
68
68
  showRuntimeSelector = false;
69
69
  advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
70
+ isLightGraphEnabled!: boolean;
70
71
 
71
72
  constructor(
72
73
  editorStore: QueryEditorStore,