@finos/legend-application-query 13.6.9 → 13.7.1

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 +2 -2
  13. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  14. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +38 -10
  15. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/package.json +4 -4
  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 +16 -16
  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 +62 -24
  43. package/src/stores/LegendQueryApplicationPlugin.tsx +6 -5
  44. package/src/stores/QueryEditorStore.ts +254 -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,8 @@ import {
90
94
  StoreProjectData,
91
95
  LATEST_VERSION_ALIAS,
92
96
  VersionedProjectData,
97
+ retrieveProjectEntitiesWithDependencies,
98
+ retrieveProjectEntitiesWithClassifier,
93
99
  } from '@finos/legend-server-depot';
94
100
  import {
95
101
  ActionAlertActionType,
@@ -119,10 +125,12 @@ import {
119
125
  type DataSpaceInfo,
120
126
  } from '@finos/legend-extension-dsl-data-space/application';
121
127
  import {
122
- DSL_DataSpace_getGraphManagerExtension,
123
128
  type DataSpace,
124
129
  type DataSpaceExecutionContext,
130
+ type DataSpaceAnalysisResult,
131
+ DSL_DataSpace_getGraphManagerExtension,
125
132
  getOwnDataSpace,
133
+ QUERY_PROFILE_TAG_DATA_SPACE,
126
134
  retrieveAnalyticsResultCache,
127
135
  } from '@finos/legend-extension-dsl-data-space/graph';
128
136
  import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.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,147 @@ 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
+ retrieveProjectEntitiesWithDependencies(
728
+ project,
729
+ versionId,
730
+ this.depotServerClient,
731
+ ),
732
+ () =>
733
+ retrieveProjectEntitiesWithClassifier(
734
+ project,
735
+ versionId,
736
+ CORE_PURE_PATH.FUNCTION,
737
+ this.depotServerClient,
738
+ ),
739
+ () =>
740
+ retrieveAnalyticsResultCache(
741
+ project,
742
+ versionId,
743
+ dataSpacePath,
744
+ this.depotServerClient,
745
+ ),
746
+ undefined,
747
+ graph_buildReport,
748
+ this.graphManagerState.graph,
749
+ executionContext,
750
+ undefined,
751
+ this.getProjectInfo(),
752
+ templateQueryId,
753
+ );
754
+ const mappingPath = executionContext
755
+ ? dataSpaceAnalysisResult.executionContextsIndex.get(executionContext)
756
+ ?.mapping.path
757
+ : undefined;
758
+ if (mappingPath) {
759
+ const pmcd =
760
+ dataSpaceAnalysisResult.mappingToMappingCoverageResult?.get(
761
+ mappingPath,
762
+ )?.entities;
763
+ if (pmcd) {
764
+ // report
765
+ stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
766
+ const graphBuilderReportData = {
767
+ timings:
768
+ this.applicationStore.timeService.finalizeTimingsRecord(
769
+ stopWatch,
770
+ ),
771
+ dependencies: dependency_buildReport,
772
+ dependenciesCount:
773
+ this.graphManagerState.graph.dependencyManager
774
+ .numberOfDependencies,
775
+ graph: graph_buildReport,
776
+ isLightGraphEnabled: true,
777
+ };
778
+ this.logBuildGraphMetrics(graphBuilderReportData);
779
+ this.applicationStore.logService.info(
780
+ LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS),
781
+ graphBuilderReportData,
782
+ );
783
+ } else {
784
+ buildFullGraph = true;
785
+ }
786
+ }
787
+ } catch (error) {
788
+ buildFullGraph = true;
789
+ this.applicationStore.logService.error(
790
+ LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
791
+ error,
792
+ );
793
+ }
794
+ }
795
+ if (
796
+ !this.enableMinialGraphForDataSpaceLoadingPerformance ||
797
+ buildFullGraph ||
798
+ !supportBuildMinimalGraph
799
+ ) {
800
+ this.graphManagerState.graph = this.graphManagerState.createNewGraph();
801
+ await flowResult(this.buildFullGraph());
802
+ try {
803
+ const project = StoreProjectData.serialization.fromJson(
804
+ await this.depotServerClient.getProject(groupId, artifactId),
805
+ );
806
+ dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
807
+ this.graphManagerState.graphManager,
808
+ ).retrieveDataSpaceAnalysisFromCache(() =>
809
+ retrieveAnalyticsResultCache(
810
+ project,
811
+ versionId,
812
+ dataSpacePath,
813
+ this.depotServerClient,
814
+ ),
815
+ );
816
+ } catch {
817
+ // do nothing
818
+ }
819
+ isLightGraphEnabled = false;
820
+ }
821
+ return {
822
+ dataSpaceAnalysisResult,
823
+ isLightGraphEnabled,
824
+ };
825
+ }
665
826
  }
666
827
 
667
828
  export class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
@@ -1182,6 +1343,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1182
1343
  private queryId: string;
1183
1344
  private _lightQuery?: LightQuery | undefined;
1184
1345
  query: Query | undefined;
1346
+ queryInfo: QueryInfo | undefined;
1185
1347
  urlQueryParamValues: Record<string, string> | undefined;
1186
1348
  updateState: ExistingQueryUpdateState;
1187
1349
 
@@ -1195,11 +1357,13 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1195
1357
 
1196
1358
  makeObservable<ExistingQueryEditorStore, '_lightQuery'>(this, {
1197
1359
  query: observable,
1360
+ queryInfo: observable,
1198
1361
  updateState: observable,
1199
1362
  _lightQuery: observable,
1200
1363
  lightQuery: computed,
1201
1364
  setLightQuery: action,
1202
1365
  setQuery: action,
1366
+ setQueryInfo: action,
1203
1367
  isPerformingBlockingAction: override,
1204
1368
  });
1205
1369
 
@@ -1246,6 +1410,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1246
1410
  this.query = val;
1247
1411
  }
1248
1412
 
1413
+ setQueryInfo(val: QueryInfo): void {
1414
+ this.queryInfo = val;
1415
+ }
1416
+
1249
1417
  getProjectInfo(): ProjectGAVCoordinates {
1250
1418
  return {
1251
1419
  groupId: this.lightQuery.groupId,
@@ -1254,52 +1422,73 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1254
1422
  };
1255
1423
  }
1256
1424
 
1425
+ override *buildGraph(): GeneratorFn<void> {
1426
+ const queryInfo = this.queryInfo;
1427
+ const dataSpaceTaggedValue = queryInfo?.taggedValues?.find(
1428
+ (taggedValue) =>
1429
+ taggedValue.profile === QUERY_PROFILE_PATH &&
1430
+ taggedValue.tag === QUERY_PROFILE_TAG_DATA_SPACE &&
1431
+ isValidFullPath(taggedValue.value),
1432
+ );
1433
+ if (
1434
+ !(
1435
+ dataSpaceTaggedValue ||
1436
+ queryInfo?.executionContext instanceof
1437
+ QueryDataSpaceExecutionContextInfo
1438
+ )
1439
+ ) {
1440
+ yield flowResult(this.buildFullGraph());
1441
+ }
1442
+ }
1443
+
1257
1444
  override async setUpEditorState(): Promise<void> {
1445
+ const queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
1446
+ this.queryId,
1447
+ );
1258
1448
  this.setLightQuery(
1259
1449
  await this.graphManagerState.graphManager.getLightQuery(this.queryId),
1260
1450
  );
1451
+ this.setQueryInfo(queryInfo);
1452
+ LegendQueryUserDataHelper.addRecentlyViewedQuery(
1453
+ this.applicationStore.userDataService,
1454
+ queryInfo.id,
1455
+ );
1261
1456
  }
1262
1457
 
1263
- async initQueryBuildStateFromQuery(query: Query): Promise<QueryBuilderState> {
1264
- const exec = query.executionContext;
1265
- if (exec instanceof QueryDataSpaceExecutionContext) {
1458
+ async initQueryBuildStateFromQuery(
1459
+ queryInfo: QueryInfo,
1460
+ ): Promise<QueryBuilderState> {
1461
+ const exec = queryInfo.executionContext;
1462
+ if (exec instanceof QueryDataSpaceExecutionContextInfo) {
1463
+ const { dataSpaceAnalysisResult, isLightGraphEnabled } =
1464
+ await this.buildGraphAndDataspaceAnalyticsResult(
1465
+ queryInfo.groupId,
1466
+ queryInfo.artifactId,
1467
+ queryInfo.versionId,
1468
+ exec.executionKey,
1469
+ exec.dataSpacePath,
1470
+ );
1266
1471
  const dataSpace = getOwnDataSpace(
1267
1472
  exec.dataSpacePath,
1268
1473
  this.graphManagerState.graph,
1269
1474
  );
1475
+ const mapping = queryInfo.mapping
1476
+ ? this.graphManagerState.graph.getMapping(queryInfo.mapping)
1477
+ : undefined;
1478
+ const runtime = queryInfo.runtime
1479
+ ? this.graphManagerState.graph.getRuntime(queryInfo.runtime)
1480
+ : undefined;
1270
1481
  const matchingExecutionContext = resolveExecutionContext(
1271
1482
  dataSpace,
1272
1483
  exec.executionKey,
1273
- query.mapping?.value,
1274
- query.runtime?.value,
1484
+ mapping,
1485
+ runtime,
1275
1486
  );
1276
1487
  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
1488
  const sourceInfo = {
1300
- groupId: query.groupId,
1301
- artifactId: query.artifactId,
1302
- versionId: query.versionId,
1489
+ groupId: queryInfo.groupId,
1490
+ artifactId: queryInfo.artifactId,
1491
+ versionId: queryInfo.versionId,
1303
1492
  dataSpace: dataSpace.path,
1304
1493
  };
1305
1494
  const visitedDataSpaces =
@@ -1313,15 +1502,16 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1313
1502
  new QueryBuilderActionConfig_QueryApplication(this),
1314
1503
  dataSpace,
1315
1504
  matchingExecutionContext,
1505
+ isLightGraphEnabled,
1316
1506
  createDataSpaceDepoRepo(
1317
1507
  this,
1318
- query.groupId,
1319
- query.artifactId,
1320
- query.versionId,
1508
+ queryInfo.groupId,
1509
+ queryInfo.artifactId,
1510
+ queryInfo.versionId,
1321
1511
  (dataSpaceInfo: DataSpaceInfo) =>
1322
1512
  hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
1323
1513
  ),
1324
- (dataSpaceInfo: DataSpaceInfo) => {
1514
+ async (dataSpaceInfo: DataSpaceInfo) => {
1325
1515
  if (dataSpaceInfo.defaultExecutionContext) {
1326
1516
  const proceed = (): void =>
1327
1517
  this.applicationStore.navigationService.navigator.goToLocation(
@@ -1351,7 +1541,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1351
1541
  }
1352
1542
  };
1353
1543
  if (
1354
- !query.isCurrentUserQuery ||
1544
+ !queryInfo.isCurrentUserQuery ||
1355
1545
  !this.queryBuilderState?.changeDetectionState.hasChanged
1356
1546
  ) {
1357
1547
  proceed();
@@ -1415,7 +1605,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1415
1605
  `Unsupported execution context ${exec.executionKey}`,
1416
1606
  );
1417
1607
  }
1418
- } else if (exec instanceof QueryExplicitExecutionContext) {
1608
+ } else if (exec instanceof QueryExplicitExecutionContextInfo) {
1419
1609
  const projectInfo = this.getProjectInfo();
1420
1610
  const sourceInfo = {
1421
1611
  groupId: projectInfo.groupId,
@@ -1433,12 +1623,18 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1433
1623
  new QueryBuilderActionConfig_QueryApplication(this),
1434
1624
  );
1435
1625
  classQueryBuilderState.executionContextState.setMapping(
1436
- exec.mapping.value,
1626
+ exec.mapping
1627
+ ? this.graphManagerState.graph.getMapping(exec.mapping)
1628
+ : undefined,
1437
1629
  );
1438
1630
  classQueryBuilderState.executionContextState.setRuntimeValue(
1439
- new RuntimePointer(
1440
- PackageableElementExplicitReference.create(exec.runtime.value),
1441
- ),
1631
+ exec.runtime
1632
+ ? new RuntimePointer(
1633
+ PackageableElementExplicitReference.create(
1634
+ this.graphManagerState.graph.getRuntime(exec.runtime),
1635
+ ),
1636
+ )
1637
+ : undefined,
1442
1638
  );
1443
1639
  return classQueryBuilderState;
1444
1640
  }
@@ -1448,6 +1644,19 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1448
1644
  async initializeQueryBuilderState(
1449
1645
  stopWatch: StopWatch,
1450
1646
  ): Promise<QueryBuilderState> {
1647
+ // if no extension found, fall back to basic `class -> mapping -> runtime` mode
1648
+ let queryInfo = this.queryInfo;
1649
+ if (!queryInfo) {
1650
+ queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
1651
+ this.queryId,
1652
+ );
1653
+ }
1654
+ const queryBuilderState =
1655
+ await this.initQueryBuildStateFromQuery(queryInfo);
1656
+ const initailizeQueryStateStopWatch = new StopWatch();
1657
+ const initailizeQueryStateReport = reportGraphAnalytics(
1658
+ this.graphManagerState.graph,
1659
+ );
1451
1660
  const query = await this.graphManagerState.graphManager.getQuery(
1452
1661
  this.queryId,
1453
1662
  this.graphManagerState.graph,
@@ -1457,14 +1666,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1457
1666
  this.applicationStore.userDataService,
1458
1667
  query.id,
1459
1668
  );
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
1669
  const existingQueryLambda =
1469
1670
  await this.graphManagerState.graphManager.pureCodeToLambda(query.content);
1470
1671
 
@@ -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,