@finos/legend-query-builder 3.2.1 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +11 -23
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts +0 -1
  5. package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/QueryBuilder_LegendApplicationPlugin.js +7 -6
  7. package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
  8. package/lib/components/data-access/DataAccessOverview.js +2 -2
  9. package/lib/components/data-access/DataAccessOverview.js.map +1 -1
  10. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  11. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +2 -2
  12. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  13. package/lib/index.css +17 -1
  14. package/lib/index.css.map +1 -1
  15. package/lib/package.json +5 -5
  16. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +2 -2
  17. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -1
  18. package/lib/stores/data-access/DataAccessState.d.ts +9 -5
  19. package/lib/stores/data-access/DataAccessState.d.ts.map +1 -1
  20. package/lib/stores/data-access/DataAccessState.js +10 -6
  21. package/lib/stores/data-access/DataAccessState.js.map +1 -1
  22. package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.d.ts.map +1 -1
  23. package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js +5 -5
  24. package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js.map +1 -1
  25. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts.map +1 -1
  26. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js +2 -0
  27. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js.map +1 -1
  28. package/package.json +9 -9
  29. package/src/components/QueryBuilder.tsx +43 -70
  30. package/src/components/QueryBuilder_LegendApplicationPlugin.ts +10 -7
  31. package/src/components/data-access/DataAccessOverview.tsx +2 -2
  32. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +2 -3
  33. package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +8 -2
  34. package/src/stores/data-access/DataAccessState.ts +30 -15
  35. package/src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts +8 -30
  36. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowState.ts +4 -0
@@ -24,6 +24,8 @@ import {
24
24
  DatasetEntitlementAccessRequestedReport,
25
25
  DatasetEntitlementAccessNotGrantedReport,
26
26
  DatasetEntitlementUnsupportedReport,
27
+ type RawLambda,
28
+ type GraphData,
27
29
  } from '@finos/legend-graph';
28
30
  import {
29
31
  ActionState,
@@ -71,12 +73,12 @@ export class DataAccessState {
71
73
  readonly applicationStore: GenericLegendApplicationStore;
72
74
  readonly graphManagerState: BasicGraphManagerState;
73
75
 
74
- readonly surveyDatasets: () => Promise<DatasetSpecification[]>;
75
- readonly checkDatasetEntitlements: (
76
- datasets: DatasetSpecification[],
77
- ) => Promise<DatasetEntitlementReport[]>;
78
-
79
76
  readonly initialDatasets?: DatasetSpecification[] | undefined;
77
+ readonly mapping: string;
78
+ readonly runtime: string;
79
+ readonly graphData: GraphData;
80
+ readonly getQuery: () => Promise<RawLambda | undefined>;
81
+
80
82
  readonly surveyDatasetsState = ActionState.create();
81
83
  readonly checkEntitlementsState = ActionState.create();
82
84
 
@@ -87,10 +89,10 @@ export class DataAccessState {
87
89
  graphManagerState: BasicGraphManagerState,
88
90
  options: {
89
91
  initialDatasets?: DatasetSpecification[] | undefined;
90
- surveyDatasets: () => Promise<DatasetSpecification[]>;
91
- checkDatasetEntitlements: (
92
- datasets: DatasetSpecification[],
93
- ) => Promise<DatasetEntitlementReport[]>;
92
+ mapping: string;
93
+ runtime: string;
94
+ graphData: GraphData;
95
+ getQuery: () => Promise<RawLambda | undefined>;
94
96
  },
95
97
  ) {
96
98
  makeObservable(this, {
@@ -106,8 +108,10 @@ export class DataAccessState {
106
108
  this.datasets = (options.initialDatasets ?? []).map(
107
109
  (dataset) => new DatasetAccessInfo(dataset),
108
110
  );
109
- this.surveyDatasets = options.surveyDatasets;
110
- this.checkDatasetEntitlements = options.checkDatasetEntitlements;
111
+ this.mapping = options.mapping;
112
+ this.runtime = options.runtime;
113
+ this.graphData = options.graphData;
114
+ this.getQuery = options.getQuery;
111
115
  }
112
116
 
113
117
  get entitlementCheckInfo(): EntitlementCheckInfo {
@@ -249,7 +253,13 @@ export class DataAccessState {
249
253
  this.surveyDatasetsState.inProgress();
250
254
 
251
255
  try {
252
- const datasets = (yield this.surveyDatasets()) as DatasetSpecification[];
256
+ const datasets =
257
+ (yield this.graphManagerState.graphManager.surveyDatasets(
258
+ this.mapping,
259
+ this.runtime,
260
+ (yield this.getQuery()) as RawLambda | undefined,
261
+ this.graphData,
262
+ )) as DatasetSpecification[];
253
263
  this.datasets = datasets.map((dataset) => {
254
264
  const existingDataset = this.datasets.find(
255
265
  (ds) => ds.specification.hashCode === dataset.hashCode,
@@ -271,9 +281,14 @@ export class DataAccessState {
271
281
  this.checkEntitlementsState.inProgress();
272
282
 
273
283
  try {
274
- const reports = (yield this.checkDatasetEntitlements(
275
- this.datasets.map((dataset) => dataset.specification),
276
- )) as DatasetEntitlementReport[];
284
+ const reports =
285
+ (yield this.graphManagerState.graphManager.checkDatasetEntitlements(
286
+ this.datasets.map((dataset) => dataset.specification),
287
+ this.mapping,
288
+ this.runtime,
289
+ (yield this.getQuery()) as RawLambda | undefined,
290
+ this.graphData,
291
+ )) as DatasetEntitlementReport[];
277
292
  this.datasets.forEach((dataset) => {
278
293
  const matchingReport = reports.find(
279
294
  (report) =>
@@ -19,12 +19,7 @@ import { makeObservable, observable, action, computed } from 'mobx';
19
19
  import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtils.js';
20
20
  import type { QueryBuilderState } from '../QueryBuilderState.js';
21
21
  import { DataAccessState } from '../data-access/DataAccessState.js';
22
- import {
23
- RuntimePointer,
24
- type DatasetEntitlementReport,
25
- type DatasetSpecification,
26
- InMemoryGraphData,
27
- } from '@finos/legend-graph';
22
+ import { RuntimePointer, InMemoryGraphData } from '@finos/legend-graph';
28
23
 
29
24
  export class QueryBuilderCheckEntitlementsState implements Hashable {
30
25
  readonly queryBuilderState: QueryBuilderState;
@@ -51,34 +46,17 @@ export class QueryBuilderCheckEntitlementsState implements Hashable {
51
46
  this.queryBuilderState.mapping &&
52
47
  this.queryBuilderState.runtimeValue instanceof RuntimePointer
53
48
  ) {
54
- const mappingPath = this.queryBuilderState.mapping.path;
55
- const runtimePath =
56
- this.queryBuilderState.runtimeValue.packageableRuntime.value.path;
57
49
  this.dataAccessState = new DataAccessState(
58
50
  this.queryBuilderState.applicationStore,
59
51
  this.queryBuilderState.graphManagerState,
60
52
  {
61
- surveyDatasets: async (): Promise<DatasetSpecification[]> =>
62
- this.queryBuilderState.graphManagerState.graphManager.surveyDatasets(
63
- mappingPath,
64
- runtimePath,
65
- this.queryBuilderState.buildQuery(),
66
- new InMemoryGraphData(
67
- this.queryBuilderState.graphManagerState.graph,
68
- ),
69
- ),
70
- checkDatasetEntitlements: async (
71
- datasets: DatasetSpecification[],
72
- ): Promise<DatasetEntitlementReport[]> =>
73
- this.queryBuilderState.graphManagerState.graphManager.checkDatasetEntitlements(
74
- datasets,
75
- mappingPath,
76
- runtimePath,
77
- this.queryBuilderState.buildQuery(),
78
- new InMemoryGraphData(
79
- this.queryBuilderState.graphManagerState.graph,
80
- ),
81
- ),
53
+ mapping: this.queryBuilderState.mapping.path,
54
+ runtime:
55
+ this.queryBuilderState.runtimeValue.packageableRuntime.value.path,
56
+ getQuery: async () => this.queryBuilderState.buildQuery(),
57
+ graphData: new InMemoryGraphData(
58
+ this.queryBuilderState.graphManagerState.graph,
59
+ ),
82
60
  },
83
61
  );
84
62
  }
@@ -284,6 +284,9 @@ export class QueryBuilderWindowColumnState
284
284
  compatibleAggCol,
285
285
  ),
286
286
  );
287
+ this.setColumnName(
288
+ `${windowOp.getLabel()} of ${compatibleAggCol.columnName}`,
289
+ );
287
290
  }
288
291
  } else {
289
292
  this.setOperatorState(
@@ -292,6 +295,7 @@ export class QueryBuilderWindowColumnState
292
295
  windowOp,
293
296
  ),
294
297
  );
298
+ this.setColumnName(`${windowOp.getLabel()}`);
295
299
  }
296
300
  }
297
301
  }