@finos/legend-application-query 13.7.1 → 13.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +1 -1
  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 +9 -9
  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
@@ -49,7 +49,6 @@ import {
49
49
  type ValueSpecification,
50
50
  type GraphInitializationReport,
51
51
  type PackageableRuntime,
52
- type QueryInfo,
53
52
  GraphManagerState,
54
53
  Query,
55
54
  PureExecution,
@@ -66,15 +65,12 @@ import {
66
65
  reportGraphAnalytics,
67
66
  cloneQueryStereotype,
68
67
  cloneQueryTaggedValue,
68
+ QueryDataSpaceExecutionContext,
69
+ QueryExplicitExecutionContext,
69
70
  QueryProjectCoordinates,
70
71
  buildLambdaVariableExpressions,
71
72
  VariableExpression,
72
73
  PrimitiveType,
73
- CORE_PURE_PATH,
74
- isValidFullPath,
75
- QUERY_PROFILE_PATH,
76
- QueryDataSpaceExecutionContextInfo,
77
- QueryExplicitExecutionContextInfo,
78
74
  } from '@finos/legend-graph';
79
75
  import {
80
76
  generateExistingQueryEditorRoute,
@@ -94,8 +90,6 @@ import {
94
90
  StoreProjectData,
95
91
  LATEST_VERSION_ALIAS,
96
92
  VersionedProjectData,
97
- retrieveProjectEntitiesWithDependencies,
98
- retrieveProjectEntitiesWithClassifier,
99
93
  } from '@finos/legend-server-depot';
100
94
  import {
101
95
  ActionAlertActionType,
@@ -125,12 +119,10 @@ import {
125
119
  type DataSpaceInfo,
126
120
  } from '@finos/legend-extension-dsl-data-space/application';
127
121
  import {
122
+ DSL_DataSpace_getGraphManagerExtension,
128
123
  type DataSpace,
129
124
  type DataSpaceExecutionContext,
130
- type DataSpaceAnalysisResult,
131
- DSL_DataSpace_getGraphManagerExtension,
132
125
  getOwnDataSpace,
133
- QUERY_PROFILE_TAG_DATA_SPACE,
134
126
  retrieveAnalyticsResultCache,
135
127
  } from '@finos/legend-extension-dsl-data-space/graph';
136
128
  import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
@@ -277,7 +269,6 @@ export abstract class QueryEditorStore {
277
269
  showRegisterServiceModal = false;
278
270
  showAppInfo = false;
279
271
  showDataspaceInfo = false;
280
- enableMinialGraphForDataSpaceLoadingPerformance = true;
281
272
 
282
273
  constructor(
283
274
  applicationStore: LegendQueryApplicationStore,
@@ -291,16 +282,13 @@ export abstract class QueryEditorStore {
291
282
  showAppInfo: observable,
292
283
  showDataspaceInfo: observable,
293
284
  queryBuilderState: observable,
294
- enableMinialGraphForDataSpaceLoadingPerformance: observable,
295
285
  isPerformingBlockingAction: computed,
296
286
  setExistingQueryName: action,
297
287
  setShowRegisterServiceModal: action,
298
288
  setShowAppInfo: action,
299
289
  setShowDataspaceInfo: action,
300
- setEnableMinialGraphForDataSpaceLoadingPerformance: action,
301
290
  initialize: flow,
302
291
  buildGraph: flow,
303
- buildFullGraph: flow,
304
292
  searchExistingQueryName: flow,
305
293
  });
306
294
 
@@ -402,10 +390,6 @@ export abstract class QueryEditorStore {
402
390
  this.showRegisterServiceModal = val;
403
391
  }
404
392
 
405
- setEnableMinialGraphForDataSpaceLoadingPerformance(val: boolean): void {
406
- this.enableMinialGraphForDataSpaceLoadingPerformance = val;
407
- }
408
-
409
393
  get isPerformingBlockingAction(): boolean {
410
394
  return this.queryCreatorState.createQueryState.isInProgress;
411
395
  }
@@ -496,10 +480,7 @@ export abstract class QueryEditorStore {
496
480
  ): QueryPersistConfiguration | undefined;
497
481
 
498
482
  *initialize(): GeneratorFn<void> {
499
- if (
500
- !this.initState.isInInitialState &&
501
- this.enableMinialGraphForDataSpaceLoadingPerformance
502
- ) {
483
+ if (!this.initState.isInInitialState) {
503
484
  return;
504
485
  }
505
486
 
@@ -582,7 +563,7 @@ export abstract class QueryEditorStore {
582
563
  );
583
564
  }
584
565
 
585
- *buildFullGraph(): GeneratorFn<void> {
566
+ *buildGraph(): GeneratorFn<void> {
586
567
  const stopWatch = new StopWatch();
587
568
 
588
569
  const projectInfo = this.getProjectInfo();
@@ -672,7 +653,6 @@ export abstract class QueryEditorStore {
672
653
  dependenciesCount:
673
654
  this.graphManagerState.graph.dependencyManager.numberOfDependencies,
674
655
  graph: graph_buildReport,
675
- isLightGraphEnabled: false,
676
656
  };
677
657
  this.logBuildGraphMetrics(graphBuilderReportData);
678
658
 
@@ -682,147 +662,6 @@ export abstract class QueryEditorStore {
682
662
  );
683
663
  }
684
664
  }
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
- }
826
665
  }
827
666
 
828
667
  export class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
@@ -1343,7 +1182,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1343
1182
  private queryId: string;
1344
1183
  private _lightQuery?: LightQuery | undefined;
1345
1184
  query: Query | undefined;
1346
- queryInfo: QueryInfo | undefined;
1347
1185
  urlQueryParamValues: Record<string, string> | undefined;
1348
1186
  updateState: ExistingQueryUpdateState;
1349
1187
 
@@ -1357,13 +1195,11 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1357
1195
 
1358
1196
  makeObservable<ExistingQueryEditorStore, '_lightQuery'>(this, {
1359
1197
  query: observable,
1360
- queryInfo: observable,
1361
1198
  updateState: observable,
1362
1199
  _lightQuery: observable,
1363
1200
  lightQuery: computed,
1364
1201
  setLightQuery: action,
1365
1202
  setQuery: action,
1366
- setQueryInfo: action,
1367
1203
  isPerformingBlockingAction: override,
1368
1204
  });
1369
1205
 
@@ -1410,10 +1246,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1410
1246
  this.query = val;
1411
1247
  }
1412
1248
 
1413
- setQueryInfo(val: QueryInfo): void {
1414
- this.queryInfo = val;
1415
- }
1416
-
1417
1249
  getProjectInfo(): ProjectGAVCoordinates {
1418
1250
  return {
1419
1251
  groupId: this.lightQuery.groupId,
@@ -1422,73 +1254,52 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1422
1254
  };
1423
1255
  }
1424
1256
 
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
-
1444
1257
  override async setUpEditorState(): Promise<void> {
1445
- const queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
1446
- this.queryId,
1447
- );
1448
1258
  this.setLightQuery(
1449
1259
  await this.graphManagerState.graphManager.getLightQuery(this.queryId),
1450
1260
  );
1451
- this.setQueryInfo(queryInfo);
1452
- LegendQueryUserDataHelper.addRecentlyViewedQuery(
1453
- this.applicationStore.userDataService,
1454
- queryInfo.id,
1455
- );
1456
1261
  }
1457
1262
 
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
- );
1263
+ async initQueryBuildStateFromQuery(query: Query): Promise<QueryBuilderState> {
1264
+ const exec = query.executionContext;
1265
+ if (exec instanceof QueryDataSpaceExecutionContext) {
1471
1266
  const dataSpace = getOwnDataSpace(
1472
1267
  exec.dataSpacePath,
1473
1268
  this.graphManagerState.graph,
1474
1269
  );
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;
1481
1270
  const matchingExecutionContext = resolveExecutionContext(
1482
1271
  dataSpace,
1483
1272
  exec.executionKey,
1484
- mapping,
1485
- runtime,
1273
+ query.mapping?.value,
1274
+ query.runtime?.value,
1486
1275
  );
1487
1276
  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
+ }
1488
1299
  const sourceInfo = {
1489
- groupId: queryInfo.groupId,
1490
- artifactId: queryInfo.artifactId,
1491
- versionId: queryInfo.versionId,
1300
+ groupId: query.groupId,
1301
+ artifactId: query.artifactId,
1302
+ versionId: query.versionId,
1492
1303
  dataSpace: dataSpace.path,
1493
1304
  };
1494
1305
  const visitedDataSpaces =
@@ -1502,16 +1313,15 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1502
1313
  new QueryBuilderActionConfig_QueryApplication(this),
1503
1314
  dataSpace,
1504
1315
  matchingExecutionContext,
1505
- isLightGraphEnabled,
1506
1316
  createDataSpaceDepoRepo(
1507
1317
  this,
1508
- queryInfo.groupId,
1509
- queryInfo.artifactId,
1510
- queryInfo.versionId,
1318
+ query.groupId,
1319
+ query.artifactId,
1320
+ query.versionId,
1511
1321
  (dataSpaceInfo: DataSpaceInfo) =>
1512
1322
  hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
1513
1323
  ),
1514
- async (dataSpaceInfo: DataSpaceInfo) => {
1324
+ (dataSpaceInfo: DataSpaceInfo) => {
1515
1325
  if (dataSpaceInfo.defaultExecutionContext) {
1516
1326
  const proceed = (): void =>
1517
1327
  this.applicationStore.navigationService.navigator.goToLocation(
@@ -1541,7 +1351,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1541
1351
  }
1542
1352
  };
1543
1353
  if (
1544
- !queryInfo.isCurrentUserQuery ||
1354
+ !query.isCurrentUserQuery ||
1545
1355
  !this.queryBuilderState?.changeDetectionState.hasChanged
1546
1356
  ) {
1547
1357
  proceed();
@@ -1605,7 +1415,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1605
1415
  `Unsupported execution context ${exec.executionKey}`,
1606
1416
  );
1607
1417
  }
1608
- } else if (exec instanceof QueryExplicitExecutionContextInfo) {
1418
+ } else if (exec instanceof QueryExplicitExecutionContext) {
1609
1419
  const projectInfo = this.getProjectInfo();
1610
1420
  const sourceInfo = {
1611
1421
  groupId: projectInfo.groupId,
@@ -1623,18 +1433,12 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1623
1433
  new QueryBuilderActionConfig_QueryApplication(this),
1624
1434
  );
1625
1435
  classQueryBuilderState.executionContextState.setMapping(
1626
- exec.mapping
1627
- ? this.graphManagerState.graph.getMapping(exec.mapping)
1628
- : undefined,
1436
+ exec.mapping.value,
1629
1437
  );
1630
1438
  classQueryBuilderState.executionContextState.setRuntimeValue(
1631
- exec.runtime
1632
- ? new RuntimePointer(
1633
- PackageableElementExplicitReference.create(
1634
- this.graphManagerState.graph.getRuntime(exec.runtime),
1635
- ),
1636
- )
1637
- : undefined,
1439
+ new RuntimePointer(
1440
+ PackageableElementExplicitReference.create(exec.runtime.value),
1441
+ ),
1638
1442
  );
1639
1443
  return classQueryBuilderState;
1640
1444
  }
@@ -1644,19 +1448,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1644
1448
  async initializeQueryBuilderState(
1645
1449
  stopWatch: StopWatch,
1646
1450
  ): 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
- );
1660
1451
  const query = await this.graphManagerState.graphManager.getQuery(
1661
1452
  this.queryId,
1662
1453
  this.graphManagerState.graph,
@@ -1666,6 +1457,14 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1666
1457
  this.applicationStore.userDataService,
1667
1458
  query.id,
1668
1459
  );
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
+ );
1669
1468
  const existingQueryLambda =
1670
1469
  await this.graphManagerState.graphManager.pureCodeToLambda(query.content);
1671
1470
 
@@ -25,6 +25,7 @@ import {
25
25
  } from '@finos/legend-graph';
26
26
  import {
27
27
  type DepotServerClient,
28
+ StoreProjectData,
28
29
  LATEST_VERSION_ALIAS,
29
30
  } from '@finos/legend-server-depot';
30
31
  import {
@@ -47,7 +48,9 @@ import {
47
48
  } from '@finos/legend-storage';
48
49
  import {
49
50
  type DataSpaceExecutionContext,
51
+ DSL_DataSpace_getGraphManagerExtension,
50
52
  getDataSpace,
53
+ retrieveAnalyticsResultCache,
51
54
  } from '@finos/legend-extension-dsl-data-space/graph';
52
55
  import {
53
56
  QueryBuilderActionConfig_QueryApplication,
@@ -56,17 +59,17 @@ import {
56
59
  } from '../QueryEditorStore.js';
57
60
  import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
58
61
  import {
59
- type DataSpaceInfo,
60
62
  DataSpaceQueryBuilderState,
61
63
  createQueryClassTaggedValue,
62
64
  createQueryDataSpaceTaggedValue,
65
+ type DataSpaceInfo,
63
66
  } from '@finos/legend-extension-dsl-data-space/application';
64
67
  import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
65
68
  import {
66
- type VisitedDataspace,
67
69
  createVisitedDataSpaceId,
68
70
  hasDataSpaceInfoBeenVisited,
69
71
  createSimpleVisitedDataspace,
72
+ type VisitedDataspace,
70
73
  } from '../../__lib__/LegendQueryUserDataSpaceHelper.js';
71
74
  import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
72
75
  import {
@@ -274,14 +277,6 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
274
277
  async initializeQueryBuilderStateWithQueryableDataSpace(
275
278
  queryableDataSpace: QueryableDataSpace,
276
279
  ): 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
- );
285
280
  const dataSpace = getDataSpace(
286
281
  queryableDataSpace.dataSpacePath,
287
282
  this.graphManagerState.graph,
@@ -292,6 +287,27 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
292
287
  ),
293
288
  `Can't find execution context '${queryableDataSpace.executionContext}'`,
294
289
  );
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
+ }
295
311
  const sourceInfo = {
296
312
  groupId: queryableDataSpace.groupId,
297
313
  artifactId: queryableDataSpace.artifactId,
@@ -309,7 +325,6 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
309
325
  new QueryBuilderActionConfig_QueryApplication(this),
310
326
  dataSpace,
311
327
  executionContext,
312
- isLightGraphEnabled,
313
328
  createDataSpaceDepoRepo(
314
329
  this,
315
330
  queryableDataSpace.groupId,
@@ -318,7 +333,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
318
333
  (dataSpaceInfo: DataSpaceInfo) =>
319
334
  hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
320
335
  ),
321
- async (dataSpaceInfo: DataSpaceInfo) => {
336
+ (dataSpaceInfo: DataSpaceInfo) => {
322
337
  flowResult(this.changeDataSpace(dataSpaceInfo)).catch(
323
338
  this.applicationStore.alertUnhandledError,
324
339
  );
@@ -346,7 +361,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
346
361
  );
347
362
  }
348
363
  queryBuilderState.setExecutionContext(executionContext);
349
- await queryBuilderState.propagateExecutionContextChange(true);
364
+ queryBuilderState.propagateExecutionContextChange(executionContext);
350
365
 
351
366
  // set runtime if already chosen
352
367
  if (queryableDataSpace.runtimePath) {
@@ -402,10 +417,6 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
402
417
  }
403
418
  }
404
419
 
405
- override *buildGraph(): GeneratorFn<void> {
406
- // do nothing
407
- }
408
-
409
420
  addVisitedDataSpace(queryableDataSpace: QueryableDataSpace): void {
410
421
  try {
411
422
  LegendQueryUserDataHelper.addVisitedDatspace(
@@ -67,7 +67,6 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
67
67
  dataSpaces: DataSpaceInfo[] = [];
68
68
  showRuntimeSelector = false;
69
69
  advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
70
- isLightGraphEnabled!: boolean;
71
70
 
72
71
  constructor(
73
72
  editorStore: QueryEditorStore,