@finos/legend-query-builder 4.15.3 → 4.15.5

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 (50) hide show
  1. package/lib/__lib__/QueryBuilderTesting.d.ts +3 -1
  2. package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTesting.js +4 -0
  4. package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
  5. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  6. package/lib/components/QueryBuilderSideBar.js +1 -1
  7. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  8. package/lib/components/data-cube/QueryBuilderDataCube.d.ts.map +1 -1
  9. package/lib/components/data-cube/QueryBuilderDataCube.js +4 -6
  10. package/lib/components/data-cube/QueryBuilderDataCube.js.map +1 -1
  11. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
  12. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js +38 -33
  13. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
  14. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +12 -5
  16. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  17. package/lib/index.css +16 -0
  18. package/lib/index.d.ts +1 -2
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +0 -1
  21. package/lib/index.js.map +1 -1
  22. package/lib/package.json +1 -1
  23. package/lib/stores/QueryBuilderState.d.ts +6 -1
  24. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  25. package/lib/stores/QueryBuilderState.js +3 -0
  26. package/lib/stores/QueryBuilderState.js.map +1 -1
  27. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.d.ts +12 -21
  28. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.d.ts.map +1 -1
  29. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.js +39 -57
  30. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.js.map +1 -1
  31. package/lib/stores/explorer/QueryFunctionsExplorerState.d.ts +17 -6
  32. package/lib/stores/explorer/QueryFunctionsExplorerState.d.ts.map +1 -1
  33. package/lib/stores/explorer/QueryFunctionsExplorerState.js +142 -59
  34. package/lib/stores/explorer/QueryFunctionsExplorerState.js.map +1 -1
  35. package/package.json +8 -8
  36. package/src/__lib__/QueryBuilderTesting.ts +5 -0
  37. package/src/components/QueryBuilderSideBar.tsx +4 -1
  38. package/src/components/data-cube/QueryBuilderDataCube.tsx +5 -17
  39. package/src/components/explorer/QueryBuilderFunctionsExplorerPanel.tsx +63 -70
  40. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +23 -11
  41. package/src/index.ts +1 -1
  42. package/src/stores/QueryBuilderState.ts +12 -0
  43. package/src/stores/data-cube/QueryBuilderDataCubeEngine.ts +66 -86
  44. package/src/stores/explorer/QueryFunctionsExplorerState.ts +227 -94
  45. package/tsconfig.json +0 -1
  46. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.d.ts +0 -36
  47. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.d.ts.map +0 -1
  48. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.js +0 -65
  49. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.js.map +0 -1
  50. package/src/stores/data-cube/QueryBuilderDataCubeApplicationEngine.ts +0 -98
@@ -16,12 +16,16 @@
16
16
 
17
17
  import {
18
18
  type PackageableElement,
19
- ConcreteFunctionDefinition,
19
+ type FunctionAnalysisInfo,
20
+ type PureModel,
20
21
  Package,
21
22
  Unit,
22
23
  ROOT_PACKAGE_NAME,
24
+ buildFunctionAnalysisInfoFromConcreteFunctionDefinition,
25
+ getOrCreateGraphPackage,
23
26
  } from '@finos/legend-graph';
24
27
  import {
28
+ ActionState,
25
29
  addUniqueEntry,
26
30
  guaranteeNonNullable,
27
31
  isNonNullable,
@@ -47,16 +51,12 @@ export class QueryBuilderFunctionsExplorerTreeNodeData implements TreeNodeData {
47
51
  label: string;
48
52
  childrenIds: string[] = [];
49
53
  isOpen?: boolean | undefined;
50
- packageableElement: PackageableElement;
54
+ package?: PackageableElement;
55
+ functionAnalysisInfo?: FunctionAnalysisInfo | undefined;
51
56
 
52
- constructor(
53
- id: string,
54
- label: string,
55
- packageableElement: PackageableElement,
56
- ) {
57
+ constructor(id: string, label: string) {
57
58
  this.id = id;
58
59
  this.label = label;
59
- this.packageableElement = packageableElement;
60
60
  }
61
61
  }
62
62
 
@@ -73,29 +73,38 @@ const getValidDisplayablePackageSet = (
73
73
  }
74
74
  };
75
75
 
76
- export const generateFunctionsExplorerTreeNodeData = (
76
+ const generateFunctionsExplorerTreeNodeDataFromPackage = (
77
77
  queryBuilderState: QueryBuilderState,
78
- element: PackageableElement,
78
+ element: Package,
79
79
  rootPackageName: ROOT_PACKAGE_NAME,
80
80
  ): QueryBuilderFunctionsExplorerTreeNodeData => ({
81
81
  id: element.path,
82
82
  label: element.name,
83
- childrenIds:
84
- element instanceof Package
85
- ? element.children
86
- .filter((child) => !(child instanceof Unit))
87
- .filter(
88
- (child) =>
89
- (child instanceof Package &&
90
- getValidDisplayablePackageSet(
91
- queryBuilderState,
92
- rootPackageName,
93
- ).has(child)) ||
94
- child instanceof ConcreteFunctionDefinition,
95
- )
96
- .map((child) => child.path)
97
- : [],
98
- packageableElement: element,
83
+ childrenIds: element.children
84
+ .filter((child) => !(child instanceof Unit))
85
+ .filter(
86
+ (child) =>
87
+ child instanceof Package &&
88
+ getValidDisplayablePackageSet(queryBuilderState, rootPackageName).has(
89
+ child,
90
+ ),
91
+ )
92
+ .map((child) => child.path)
93
+ .concat(
94
+ queryBuilderState.functionsExplorerState.packagePathToFunctionInfoMap
95
+ ?.get(element.path)
96
+ ?.map((info) => info.functionPath) ?? [],
97
+ ),
98
+ package: element,
99
+ });
100
+
101
+ export const generateFunctionsExplorerTreeNodeDataFromFunctionAnalysisInfo = (
102
+ functionAnalysisInfo: FunctionAnalysisInfo,
103
+ ): QueryBuilderFunctionsExplorerTreeNodeData => ({
104
+ id: functionAnalysisInfo.functionPath,
105
+ label: functionAnalysisInfo.name,
106
+ childrenIds: [],
107
+ functionAnalysisInfo: functionAnalysisInfo,
99
108
  });
100
109
 
101
110
  const generateFunctionsExplorerTreeNodeChilrdren = (
@@ -104,34 +113,48 @@ const generateFunctionsExplorerTreeNodeChilrdren = (
104
113
  data: TreeData<QueryBuilderFunctionsExplorerTreeNodeData>,
105
114
  rootPackageName = ROOT_PACKAGE_NAME.MAIN,
106
115
  ): void => {
116
+ const functionInfoMap =
117
+ rootPackageName === ROOT_PACKAGE_NAME.MAIN
118
+ ? queryBuilderState.functionsExplorerState.functionInfoMap
119
+ : queryBuilderState.functionsExplorerState.dependencyFunctionInfoMap;
107
120
  const validDisplayablePackageSet = getValidDisplayablePackageSet(
108
121
  queryBuilderState,
109
122
  rootPackageName,
110
123
  );
111
- node.childrenIds = (node.packageableElement as Package).children
112
- .filter((child) => !(child instanceof Unit))
113
- .filter(
114
- (child) =>
115
- // avoid displaying empty packages
116
- (child instanceof Package && validDisplayablePackageSet.has(child)) ||
117
- child instanceof ConcreteFunctionDefinition,
118
- )
119
- .map((child) => child.path);
120
- (node.packageableElement as Package).children
121
- .filter((child) => !(child instanceof Unit))
124
+ const qualifiedExtraFunctionPaths =
125
+ queryBuilderState.functionsExplorerState.packagePathToFunctionInfoMap
126
+ ?.get(node.id)
127
+ ?.map((info) => info.functionPath);
128
+
129
+ const childrenPackages = (node.package as Package).children
122
130
  .filter(
123
131
  (child) =>
124
132
  // avoid displaying empty packages
125
- (child instanceof Package && validDisplayablePackageSet.has(child)) ||
126
- child instanceof ConcreteFunctionDefinition,
127
- )
128
- .map((child) =>
129
- generateFunctionsExplorerTreeNodeData(
130
- queryBuilderState,
131
- child,
132
- rootPackageName,
133
- ),
133
+ child instanceof Package && validDisplayablePackageSet.has(child),
134
134
  )
135
+ .map((child) => child as Package);
136
+
137
+ node.childrenIds = childrenPackages
138
+ .map((child) => child.path)
139
+ .concat(qualifiedExtraFunctionPaths ?? []);
140
+
141
+ const childNodesFromPackage = childrenPackages.map((child) =>
142
+ generateFunctionsExplorerTreeNodeDataFromPackage(
143
+ queryBuilderState,
144
+ child,
145
+ rootPackageName,
146
+ ),
147
+ );
148
+
149
+ const childNodesFromFunction = qualifiedExtraFunctionPaths
150
+ ?.map((path) => functionInfoMap?.get(path))
151
+ .filter(isNonNullable)
152
+ .map((info) =>
153
+ generateFunctionsExplorerTreeNodeDataFromFunctionAnalysisInfo(info),
154
+ );
155
+
156
+ childNodesFromPackage
157
+ .concat(childNodesFromFunction ?? [])
135
158
  .forEach((childNode) => {
136
159
  const currentNode = data.nodes.get(childNode.id);
137
160
  if (currentNode) {
@@ -157,14 +180,20 @@ export const getFunctionsExplorerTreeData = (
157
180
  switch (rootPackageName) {
158
181
  case ROOT_PACKAGE_NAME.PROJECT_DEPENDENCY_ROOT:
159
182
  if (
160
- queryBuilderState.graphManagerState.graph.dependencyManager.functions
161
- .length === 0
183
+ !queryBuilderState.functionsExplorerState.dependencyFunctionInfoMap ||
184
+ Array.from(
185
+ queryBuilderState.functionsExplorerState.dependencyFunctionInfoMap,
186
+ ).length === 0
162
187
  ) {
163
188
  return { rootIds, nodes };
164
189
  }
165
190
  break;
166
191
  default:
167
- if (queryBuilderState.graphManagerState.graph.ownFunctions.length === 0) {
192
+ if (
193
+ !queryBuilderState.functionsExplorerState.functionInfoMap ||
194
+ Array.from(queryBuilderState.functionsExplorerState.functionInfoMap)
195
+ .length === 0
196
+ ) {
168
197
  return { rootIds, nodes };
169
198
  }
170
199
  }
@@ -172,22 +201,19 @@ export const getFunctionsExplorerTreeData = (
172
201
  roots.forEach((root) => {
173
202
  root.children
174
203
  .slice()
175
- .filter((child) => !(child instanceof Unit))
176
204
  .filter(
177
205
  (child) =>
178
206
  child instanceof Package && validDisplayablePackageSet.has(child),
179
207
  )
208
+ .map((child) => child as Package)
180
209
  .sort((a, b) => a.name.localeCompare(b.name))
181
- .sort(
182
- (a, b) =>
183
- (b instanceof Package ? 1 : 0) - (a instanceof Package ? 1 : 0),
184
- )
185
210
  .forEach((childPackage) => {
186
- const childTreeNodeData = generateFunctionsExplorerTreeNodeData(
187
- queryBuilderState,
188
- childPackage,
189
- rootPackageName,
190
- );
211
+ const childTreeNodeData =
212
+ generateFunctionsExplorerTreeNodeDataFromPackage(
213
+ queryBuilderState,
214
+ childPackage,
215
+ rootPackageName,
216
+ );
191
217
  addUniqueEntry(rootIds, childTreeNodeData.id);
192
218
  nodes.set(childTreeNodeData.id, childTreeNodeData);
193
219
  });
@@ -211,16 +237,14 @@ export const getFunctionsExplorerTreeNodeChildren = (
211
237
  .map((id) => data.nodes.get(id))
212
238
  .filter(isNonNullable)
213
239
  .sort(compareLabelFn)
214
- .sort(
215
- (a, b) =>
216
- (b.packageableElement instanceof Package ? 1 : 0) -
217
- (a.packageableElement instanceof Package ? 1 : 0),
218
- );
240
+ .sort((a, b) => (b.package ? 1 : 0) - (a.package ? 1 : 0));
219
241
  };
220
242
 
221
243
  const getAllPackagesFromElement = (element: PackageableElement): Package[] => {
222
244
  if (element.package) {
223
- return [element.package].concat(getAllPackagesFromElement(element.package));
245
+ return (element instanceof Package ? [element] : []).concat(
246
+ [element.package].concat(getAllPackagesFromElement(element.package)),
247
+ );
224
248
  }
225
249
  return [];
226
250
  };
@@ -228,30 +252,36 @@ const getAllPackagesFromElement = (element: PackageableElement): Package[] => {
228
252
  export class QueryFunctionExplorerState {
229
253
  readonly uuid = uuid();
230
254
  queryFunctionsState: QueryFunctionsExplorerState;
231
- concreteFunctionDefinition: ConcreteFunctionDefinition;
255
+ functionAnalysisInfo: FunctionAnalysisInfo;
232
256
 
233
257
  constructor(
234
258
  queryFunctionsState: QueryFunctionsExplorerState,
235
- concreteFunctionDefinition: ConcreteFunctionDefinition,
259
+ functionAnalysisInfo: FunctionAnalysisInfo,
236
260
  ) {
237
261
  makeObservable(this, {
238
- concreteFunctionDefinition: observable,
262
+ functionAnalysisInfo: observable,
239
263
  });
240
264
  this.queryFunctionsState = queryFunctionsState;
241
- this.concreteFunctionDefinition = concreteFunctionDefinition;
265
+ this.functionAnalysisInfo = functionAnalysisInfo;
242
266
  }
243
267
  }
244
268
 
245
269
  export class QueryFunctionsExplorerState {
270
+ readonly initState = ActionState.create();
271
+
246
272
  queryBuilderState: QueryBuilderState;
247
273
  treeData?: TreeData<QueryBuilderFunctionsExplorerTreeNodeData> | undefined;
248
274
  dependencyTreeData?:
249
275
  | TreeData<QueryBuilderFunctionsExplorerTreeNodeData>
250
276
  | undefined;
277
+ _functionGraph: PureModel;
251
278
  functionExplorerStates: QueryFunctionExplorerState[] = [];
252
279
  dependencyFunctionExplorerStates: QueryFunctionExplorerState[] = [];
253
280
  displayablePackagesSet: Set<Package> = new Set<Package>();
254
281
  dependencyDisplayablePackagesSet: Set<Package> = new Set<Package>();
282
+ functionInfoMap?: Map<string, FunctionAnalysisInfo>;
283
+ dependencyFunctionInfoMap?: Map<string, FunctionAnalysisInfo>;
284
+ packagePathToFunctionInfoMap?: Map<string, FunctionAnalysisInfo[]>;
255
285
 
256
286
  constructor(queryBuilderState: QueryBuilderState) {
257
287
  makeObservable(this, {
@@ -259,13 +289,22 @@ export class QueryFunctionsExplorerState {
259
289
  dependencyFunctionExplorerStates: observable.ref,
260
290
  treeData: observable.ref,
261
291
  dependencyTreeData: observable.ref,
292
+ _functionGraph: observable,
293
+ functionInfoMap: observable,
294
+ dependencyFunctionInfoMap: observable,
295
+ packagePathToFunctionInfoMap: observable,
296
+ setFunctionInfoMap: action,
297
+ setDependencyFunctionInfoMap: action,
262
298
  setTreeData: action,
299
+ setPackagePathToFunctionInfoMap: action,
263
300
  setDependencyTreeData: action,
264
301
  refreshTree: action,
265
302
  onTreeNodeSelect: action,
303
+ initializeTreeData: action,
266
304
  });
267
305
  this.queryBuilderState = queryBuilderState;
268
- this.initializeTreeData();
306
+ this._functionGraph =
307
+ this.queryBuilderState.graphManagerState.createNewGraph();
269
308
  }
270
309
 
271
310
  getTreeData(
@@ -279,18 +318,48 @@ export class QueryFunctionsExplorerState {
279
318
  }
280
319
  }
281
320
 
321
+ setFunctionInfoMap(info: Map<string, FunctionAnalysisInfo>) {
322
+ this.functionInfoMap = info;
323
+ }
324
+
325
+ setDependencyFunctionInfoMap(info: Map<string, FunctionAnalysisInfo>) {
326
+ this.dependencyFunctionInfoMap = info;
327
+ }
328
+
329
+ setPackagePathToFunctionInfoMap(map: Map<string, FunctionAnalysisInfo[]>) {
330
+ this.packagePathToFunctionInfoMap = map;
331
+ }
332
+
282
333
  async initializeDisplayablePackagesSet(): Promise<void> {
283
- this.queryBuilderState.graphManagerState.graph.ownFunctions
284
- .map((f) => getAllPackagesFromElement(f))
285
- .flat()
286
- .forEach((pkg) => this.displayablePackagesSet.add(pkg));
334
+ if (this.functionInfoMap) {
335
+ Array.from(this.functionInfoMap.values())
336
+ .map((info) =>
337
+ getOrCreateGraphPackage(
338
+ this._functionGraph,
339
+ info.packagePath,
340
+ undefined,
341
+ ),
342
+ )
343
+ .map((f) => getAllPackagesFromElement(f))
344
+ .flat()
345
+ .forEach((pkg) => this.displayablePackagesSet.add(pkg));
346
+ }
287
347
  }
288
348
 
289
349
  async initializeDependencyDisplayablePackagesSet(): Promise<void> {
290
- this.queryBuilderState.graphManagerState.graph.dependencyManager.functions
291
- .map((f) => getAllPackagesFromElement(f))
292
- .flat()
293
- .forEach((pkg) => this.dependencyDisplayablePackagesSet.add(pkg));
350
+ if (this.dependencyFunctionInfoMap) {
351
+ Array.from(this.dependencyFunctionInfoMap.values())
352
+ .map((info) =>
353
+ getOrCreateGraphPackage(
354
+ this._functionGraph,
355
+ info.packagePath,
356
+ undefined,
357
+ ),
358
+ )
359
+ .map((f) => getAllPackagesFromElement(f))
360
+ .flat()
361
+ .forEach((pkg) => this.dependencyDisplayablePackagesSet.add(pkg));
362
+ }
294
363
  }
295
364
 
296
365
  setTreeData(
@@ -327,7 +396,7 @@ export class QueryFunctionsExplorerState {
327
396
  data: TreeData<QueryBuilderFunctionsExplorerTreeNodeData>,
328
397
  rootPackageName = ROOT_PACKAGE_NAME.MAIN,
329
398
  ): void => {
330
- if (node.packageableElement instanceof Package) {
399
+ if (node.package) {
331
400
  if (node.childrenIds.length) {
332
401
  node.isOpen = !node.isOpen;
333
402
  generateFunctionsExplorerTreeNodeChilrdren(
@@ -347,41 +416,105 @@ export class QueryFunctionsExplorerState {
347
416
  }
348
417
  };
349
418
 
419
+ initializeFunctionInfoMap(): void {
420
+ const functionInfoMap = new Map<string, FunctionAnalysisInfo>();
421
+ const dependencyFunctionInfoMap = new Map<string, FunctionAnalysisInfo>();
422
+ const functionInfos =
423
+ buildFunctionAnalysisInfoFromConcreteFunctionDefinition(
424
+ this.queryBuilderState.graphManagerState.graph.ownFunctions,
425
+ this._functionGraph,
426
+ );
427
+ functionInfos.forEach((info) =>
428
+ functionInfoMap.set(info.functionPath, info),
429
+ );
430
+ if (
431
+ this.queryBuilderState.graphManagerState.graph.dependencyManager
432
+ .hasDependencies
433
+ ) {
434
+ const dependencyFunctions =
435
+ this.queryBuilderState.graphManagerState.graph.dependencyManager
436
+ .functions;
437
+ const dependencyFunctionInfos =
438
+ buildFunctionAnalysisInfoFromConcreteFunctionDefinition(
439
+ dependencyFunctions,
440
+ this._functionGraph,
441
+ );
442
+ dependencyFunctionInfos.forEach((info) =>
443
+ dependencyFunctionInfoMap.set(info.functionPath, info),
444
+ );
445
+ }
446
+ const queryBuilderFunctionAnalysisInfo =
447
+ this.queryBuilderState.buildFunctionAnalysisInfo();
448
+ if (queryBuilderFunctionAnalysisInfo) {
449
+ Array.from(
450
+ queryBuilderFunctionAnalysisInfo.functionInfoMap.entries(),
451
+ ).forEach(([path, info]) => functionInfoMap.set(path, info));
452
+ Array.from(
453
+ queryBuilderFunctionAnalysisInfo.dependencyFunctionInfoMap.entries(),
454
+ ).forEach(([path, info]) => {
455
+ dependencyFunctionInfoMap.set(path, info);
456
+ });
457
+ }
458
+ const packagePathToFunctionInfoMap = new Map<
459
+ string,
460
+ FunctionAnalysisInfo[]
461
+ >();
462
+ Array.from(functionInfoMap.values())
463
+ .concat(Array.from(dependencyFunctionInfoMap.values()))
464
+ .forEach((info) => {
465
+ const curr = packagePathToFunctionInfoMap.get(info.packagePath);
466
+ if (curr) {
467
+ packagePathToFunctionInfoMap.set(info.packagePath, [...curr, info]);
468
+ } else {
469
+ packagePathToFunctionInfoMap.set(info.packagePath, [info]);
470
+ }
471
+ });
472
+ this.setPackagePathToFunctionInfoMap(packagePathToFunctionInfoMap);
473
+ this.setFunctionInfoMap(functionInfoMap);
474
+ this.setDependencyFunctionInfoMap(dependencyFunctionInfoMap);
475
+ }
476
+
350
477
  initializeTreeData(): void {
478
+ if (!this.initState.isInInitialState) {
479
+ return;
480
+ }
481
+
482
+ this.initState.inProgress();
483
+ this.initializeFunctionInfoMap();
351
484
  this.initializeDisplayablePackagesSet()
352
485
  .catch(noop())
353
486
  .finally(() => {
354
487
  this.setTreeData(
355
488
  getFunctionsExplorerTreeData(
356
- [this.queryBuilderState.graphManagerState.graph.root],
489
+ [this._functionGraph.root],
357
490
  this.queryBuilderState,
491
+ ROOT_PACKAGE_NAME.MAIN,
358
492
  ),
359
493
  );
360
- this.functionExplorerStates =
361
- this.queryBuilderState.graphManagerState.graph.ownFunctions.map(
362
- (f) => new QueryFunctionExplorerState(this, f),
363
- );
494
+ this.functionExplorerStates = this.functionInfoMap
495
+ ? Array.from(this.functionInfoMap.values()).map(
496
+ (info) => new QueryFunctionExplorerState(this, info),
497
+ )
498
+ : [];
364
499
  });
365
- if (
366
- this.queryBuilderState.graphManagerState.graph.dependencyManager
367
- .hasDependencies
368
- ) {
500
+ if (this.dependencyFunctionInfoMap) {
369
501
  this.initializeDependencyDisplayablePackagesSet()
370
502
  .catch(noop())
371
503
  .finally(() => {
372
504
  this.setDependencyTreeData(
373
505
  getFunctionsExplorerTreeData(
374
- this.queryBuilderState.graphManagerState.graph.dependencyManager
375
- .roots,
506
+ [this._functionGraph.root],
376
507
  this.queryBuilderState,
377
508
  ROOT_PACKAGE_NAME.PROJECT_DEPENDENCY_ROOT,
378
509
  ),
379
510
  );
380
- this.dependencyFunctionExplorerStates =
381
- this.queryBuilderState.graphManagerState.graph.dependencyManager.functions.map(
382
- (f) => new QueryFunctionExplorerState(this, f),
383
- );
511
+ this.dependencyFunctionExplorerStates = this.dependencyFunctionInfoMap
512
+ ? Array.from(this.dependencyFunctionInfoMap.values()).map(
513
+ (info) => new QueryFunctionExplorerState(this, info),
514
+ )
515
+ : [];
384
516
  });
385
517
  }
518
+ this.initState.pass();
386
519
  }
387
520
  }
package/tsconfig.json CHANGED
@@ -99,7 +99,6 @@
99
99
  "./src/stores/ServiceInfo.ts",
100
100
  "./src/stores/__test-utils__/QueryBuilderStateTestUtils.ts",
101
101
  "./src/stores/data-access/DataAccessState.ts",
102
- "./src/stores/data-cube/QueryBuilderDataCubeApplicationEngine.ts",
103
102
  "./src/stores/data-cube/QueryBuilderDataCubeEngine.ts",
104
103
  "./src/stores/data-cube/QueryBuilderDataCubeEngineHelper.ts",
105
104
  "./src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts",
@@ -1,36 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { type GenericLegendApplicationStore } from '@finos/legend-application';
17
- import { DataCubeApplicationEngine } from '@finos/legend-data-cube';
18
- import { LogEvent, type DocumentationEntry } from '@finos/legend-shared';
19
- export declare class QueryBuilderDataCubeApplicationEngine extends DataCubeApplicationEngine {
20
- private readonly application;
21
- constructor(application: GenericLegendApplicationStore);
22
- get documentationUrl(): string | undefined;
23
- getDocumentationEntry(key: string): DocumentationEntry | undefined;
24
- openDocumentationEntry(entry: DocumentationEntry): void;
25
- shouldDisplayDocumentationEntry(entry: DocumentationEntry): boolean;
26
- openLink(url: string): void;
27
- setWindowTitle(title: string): void;
28
- logDebug(message: string, ...data: unknown[]): void;
29
- debugProcess(processName: string, ...data: unknown[]): void;
30
- logInfo(event: LogEvent, ...data: unknown[]): void;
31
- logWarning(event: LogEvent, ...data: unknown[]): void;
32
- logError(event: LogEvent, ...data: unknown[]): void;
33
- logUnhandledError(error: Error): void;
34
- logIllegalStateError(message: string, error?: Error): void;
35
- }
36
- //# sourceMappingURL=QueryBuilderDataCubeApplicationEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryBuilderDataCubeApplicationEngine.d.ts","sourceRoot":"","sources":["../../../src/stores/data-cube/QueryBuilderDataCubeApplicationEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,qBAAa,qCAAsC,SAAQ,yBAAyB;IAClF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;gBAEhD,WAAW,EAAE,6BAA6B;IAMtD,IAAI,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED,qBAAqB,CAAC,GAAG,EAAE,MAAM;IAIjC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB;IAIhD,+BAA+B,CAAC,KAAK,EAAE,kBAAkB;IAIzD,QAAQ,CAAC,GAAG,EAAE,MAAM;IAIpB,cAAc,CAAC,KAAK,EAAE,MAAM;IAI5B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAQ5C,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IASpD,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI3C,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI9C,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAI9B,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAOpD"}
@@ -1,65 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { APPLICATION_EVENT, shouldDisplayVirtualAssistantDocumentationEntry, } from '@finos/legend-application';
17
- import { DataCubeApplicationEngine } from '@finos/legend-data-cube';
18
- import { LogEvent } from '@finos/legend-shared';
19
- export class QueryBuilderDataCubeApplicationEngine extends DataCubeApplicationEngine {
20
- application;
21
- constructor(application) {
22
- super();
23
- this.application = application;
24
- }
25
- get documentationUrl() {
26
- return this.application.documentationService.url;
27
- }
28
- getDocumentationEntry(key) {
29
- return this.application.documentationService.getDocEntry(key);
30
- }
31
- openDocumentationEntry(entry) {
32
- this.currentDocumentationEntry = entry;
33
- }
34
- shouldDisplayDocumentationEntry(entry) {
35
- return shouldDisplayVirtualAssistantDocumentationEntry(entry);
36
- }
37
- openLink(url) {
38
- this.application.navigationService.navigator.visitAddress(url);
39
- }
40
- setWindowTitle(title) {
41
- this.application.layoutService.setWindowTitle(title);
42
- }
43
- logDebug(message, ...data) {
44
- this.application.logService.debug(LogEvent.create(APPLICATION_EVENT.DEBUG), message, ...data);
45
- }
46
- debugProcess(processName, ...data) {
47
- this.application.logService.debug(LogEvent.create(APPLICATION_EVENT.DEBUG), `\n------ START DEBUG PROCESS: ${processName} ------\n`, ...data, `\n------- END DEBUG PROCESS: ${processName} -------\n`);
48
- }
49
- logInfo(event, ...data) {
50
- this.application.logService.info(event, ...data);
51
- }
52
- logWarning(event, ...data) {
53
- this.application.logService.warn(event, ...data);
54
- }
55
- logError(event, ...data) {
56
- this.application.logService.error(event, ...data);
57
- }
58
- logUnhandledError(error) {
59
- this.application.logUnhandledError(error);
60
- }
61
- logIllegalStateError(message, error) {
62
- this.logError(LogEvent.create(APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED), message, error);
63
- }
64
- }
65
- //# sourceMappingURL=QueryBuilderDataCubeApplicationEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryBuilderDataCubeApplicationEngine.js","sourceRoot":"","sources":["../../../src/stores/data-cube/QueryBuilderDataCubeApplicationEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,+CAA+C,GAEhD,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAA2B,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,qCAAsC,SAAQ,yBAAyB;IACjE,WAAW,CAAgC;IAE5D,YAAY,WAA0C;QACpD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC;IACnD,CAAC;IAED,qBAAqB,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,sBAAsB,CAAC,KAAyB;QAC9C,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC;IACzC,CAAC;IAED,+BAA+B,CAAC,KAAyB;QACvD,OAAO,+CAA+C,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,cAAc,CAAC,KAAa;QAC1B,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAC,OAAe,EAAE,GAAG,IAAe;QAC1C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAC/B,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,EACxC,OAAO,EACP,GAAG,IAAI,CACR,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,WAAmB,EAAE,GAAG,IAAe;QAClD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAC/B,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,EACxC,iCAAiC,WAAW,WAAW,EACvD,GAAG,IAAI,EACP,gCAAgC,WAAW,YAAY,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,KAAe,EAAE,GAAG,IAAe;QACzC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,UAAU,CAAC,KAAe,EAAE,GAAG,IAAe;QAC5C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,QAAQ,CAAC,KAAe,EAAE,GAAG,IAAe;QAC1C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,oBAAoB,CAAC,OAAe,EAAE,KAAa;QACjD,IAAI,CAAC,QAAQ,CACX,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,kCAAkC,CAAC,EACrE,OAAO,EACP,KAAK,CACN,CAAC;IACJ,CAAC;CACF"}