@finos/legend-extension-dsl-data-space 0.2.0 → 1.0.4

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 (79) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/lib/DSLDataSpace_Extension.d.ts +0 -10
  3. package/lib/DSLDataSpace_Extension.d.ts.map +1 -1
  4. package/lib/DSLDataSpace_Extension.js +0 -24
  5. package/lib/DSLDataSpace_Extension.js.map +1 -1
  6. package/lib/components/DataSpaceViewer.js +17 -17
  7. package/lib/components/DataSpaceViewer.js.map +1 -1
  8. package/lib/components/query/{DSLDataSpace_QueryPlugin.d.ts → DSLDataSpace_LegendQueryPlugin.d.ts} +4 -5
  9. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.d.ts.map +1 -0
  10. package/lib/components/query/{DSLDataSpace_QueryPlugin.js → DSLDataSpace_LegendQueryPlugin.js} +4 -7
  11. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.js.map +1 -0
  12. package/lib/components/query/DataSpaceQuerySetup.js +7 -7
  13. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  14. package/lib/components/studio/{DSLDataSpace_StudioPlugin.d.ts → DSLDataSpace_LegendStudioPlugin.d.ts} +4 -6
  15. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.d.ts.map +1 -0
  16. package/lib/components/studio/{DSLDataSpace_StudioPlugin.js → DSLDataSpace_LegendStudioPlugin.js} +4 -22
  17. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js.map +1 -0
  18. package/lib/graph/DSLDataSpace_PureGraphPlugin.d.ts +1 -2
  19. package/lib/graph/DSLDataSpace_PureGraphPlugin.d.ts.map +1 -1
  20. package/lib/graph/DSLDataSpace_PureGraphPlugin.js +0 -3
  21. package/lib/graph/DSLDataSpace_PureGraphPlugin.js.map +1 -1
  22. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts +1 -2
  23. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts.map +1 -1
  24. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js +0 -3
  25. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/index.d.ts +5 -0
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +5 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts +2 -3
  33. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  34. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js +5 -8
  35. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  36. package/lib/stores/query/DataSpaceQuerySetupState.d.ts +2 -0
  37. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
  38. package/lib/stores/query/DataSpaceQuerySetupState.js +15 -1
  39. package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
  40. package/package.json +19 -20
  41. package/src/DSLDataSpace_Extension.ts +0 -30
  42. package/src/components/query/{DSLDataSpace_QueryPlugin.tsx → DSLDataSpace_LegendQueryPlugin.tsx} +2 -7
  43. package/src/components/query/DataSpaceQuerySetup.tsx +2 -2
  44. package/src/components/studio/{DSLDataSpace_StudioPlugin.tsx → DSLDataSpace_LegendStudioPlugin.tsx} +5 -27
  45. package/src/graph/DSLDataSpace_PureGraphPlugin.ts +1 -8
  46. package/src/graphManager/DSLDataSpace_PureGraphManagerPlugin.ts +0 -5
  47. package/src/index.ts +12 -0
  48. package/src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts +5 -10
  49. package/src/stores/query/DataSpaceQuerySetupState.ts +31 -0
  50. package/tsconfig.json +2 -7
  51. package/lib/components/query/DSLDataSpace_QueryPlugin.d.ts.map +0 -1
  52. package/lib/components/query/DSLDataSpace_QueryPlugin.js.map +0 -1
  53. package/lib/components/studio/DSLDataSpace_StudioPlugin.d.ts.map +0 -1
  54. package/lib/components/studio/DSLDataSpace_StudioPlugin.js.map +0 -1
  55. package/lib/components/studio/EnterpriseModelExplorer.d.ts +0 -21
  56. package/lib/components/studio/EnterpriseModelExplorer.d.ts.map +0 -1
  57. package/lib/components/studio/EnterpriseModelExplorer.js +0 -70
  58. package/lib/components/studio/EnterpriseModelExplorer.js.map +0 -1
  59. package/lib/components/studio/EnterpriseModelExplorerStoreProvider.d.ts +0 -21
  60. package/lib/components/studio/EnterpriseModelExplorerStoreProvider.d.ts.map +0 -1
  61. package/lib/components/studio/EnterpriseModelExplorerStoreProvider.js +0 -35
  62. package/lib/components/studio/EnterpriseModelExplorerStoreProvider.js.map +0 -1
  63. package/lib/components/studio/TaxonomyTree.d.ts +0 -23
  64. package/lib/components/studio/TaxonomyTree.d.ts.map +0 -1
  65. package/lib/components/studio/TaxonomyTree.js +0 -78
  66. package/lib/components/studio/TaxonomyTree.js.map +0 -1
  67. package/lib/components/studio/TaxonomyViewer.d.ts +0 -22
  68. package/lib/components/studio/TaxonomyViewer.d.ts.map +0 -1
  69. package/lib/components/studio/TaxonomyViewer.js +0 -59
  70. package/lib/components/studio/TaxonomyViewer.js.map +0 -1
  71. package/lib/stores/studio/EnterpriseModelExplorerStore.d.ts +0 -93
  72. package/lib/stores/studio/EnterpriseModelExplorerStore.d.ts.map +0 -1
  73. package/lib/stores/studio/EnterpriseModelExplorerStore.js +0 -300
  74. package/lib/stores/studio/EnterpriseModelExplorerStore.js.map +0 -1
  75. package/src/components/studio/EnterpriseModelExplorer.tsx +0 -229
  76. package/src/components/studio/EnterpriseModelExplorerStoreProvider.tsx +0 -61
  77. package/src/components/studio/TaxonomyTree.tsx +0 -179
  78. package/src/components/studio/TaxonomyViewer.tsx +0 -187
  79. package/src/stores/studio/EnterpriseModelExplorerStore.tsx +0 -514
@@ -1,514 +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
-
17
- import type { ApplicationStore } from '@finos/legend-application';
18
- import { TAB_SIZE } from '@finos/legend-application';
19
- import type { TreeData, TreeNodeData } from '@finos/legend-art';
20
- import { PanelDisplayState } from '@finos/legend-art';
21
- import type { GraphManagerState } from '@finos/legend-graph';
22
- import type { Entity } from '@finos/legend-model-storage';
23
- import type {
24
- DepotServerClient,
25
- StoredEntity,
26
- } from '@finos/legend-server-depot';
27
- import {
28
- LATEST_VERSION_ALIAS,
29
- ProjectVersionEntities,
30
- ProjectData,
31
- generateGAVCoordinates,
32
- } from '@finos/legend-server-depot';
33
- import type { GeneratorFn, PlainObject } from '@finos/legend-shared';
34
- import {
35
- AssertionError,
36
- assertNonNullable,
37
- addUniqueEntry,
38
- guaranteeNonNullable,
39
- ActionState,
40
- assertErrorThrown,
41
- } from '@finos/legend-shared';
42
- import type { StudioConfig, StudioPluginManager } from '@finos/legend-studio';
43
- import { makeObservable, flow, observable, action, flowResult } from 'mobx';
44
- import { generatePath } from 'react-router';
45
- import {
46
- DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
47
- extractDataSpaceTaxonomyNodePaths,
48
- getResolvedDataSpace,
49
- } from '../../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin';
50
- import { DataSpaceViewerState } from '../DataSpaceViewerState';
51
-
52
- export enum ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN {
53
- TAXONOMY_PATH = 'taxonomyPath',
54
- GAV = 'gav',
55
- DATA_SPACE_PATH = 'dataSpacePath',
56
- }
57
-
58
- export const ENTERPRISE_MODEL_EXPLORER_ROUTE_PATTERN = Object.freeze({
59
- ENTERPRISE_VIEW: `/enterprise/`,
60
- ENTERPRISE_VIEW_BY_TAXONOMY_NODE: `/enterprise/:${ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.TAXONOMY_PATH}`,
61
- ENTERPRISE_VIEW_BY_DATA_SPACE: `/enterprise/:${ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.TAXONOMY_PATH}/:${ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.GAV}/:${ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.DATA_SPACE_PATH}`,
62
- });
63
-
64
- export interface EnterpriseModelExplorerPathParams {
65
- [ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.TAXONOMY_PATH]?: string;
66
- [ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.GAV]?: string;
67
- [ENTERPRISE_MODEL_EXPLORER_PARAM_TOKEN.DATA_SPACE_PATH]?: string;
68
- }
69
-
70
- export const generateTaxonomyNodeRoute = (taxonomyNodePath: string): string =>
71
- generatePath(
72
- ENTERPRISE_MODEL_EXPLORER_ROUTE_PATTERN.ENTERPRISE_VIEW_BY_TAXONOMY_NODE,
73
- {
74
- taxonomyPath: taxonomyNodePath,
75
- },
76
- );
77
-
78
- export const generateDataSpaceRoute = (
79
- taxonomyNodePath: string,
80
- GAVCoordinates: string,
81
- dataSpacePath: string,
82
- ): string =>
83
- generatePath(
84
- ENTERPRISE_MODEL_EXPLORER_ROUTE_PATTERN.ENTERPRISE_VIEW_BY_DATA_SPACE,
85
- {
86
- taxonomyPath: taxonomyNodePath,
87
- gav: GAVCoordinates,
88
- dataSpacePath,
89
- },
90
- );
91
-
92
- const DATA_SPACE_ID_DELIMITER = '@';
93
- const TAXONOMY_NODE_PATH_DELIMITER = '::';
94
-
95
- export class RawDataSpace {
96
- groupId: string;
97
- artifactId: string;
98
- versionId: string;
99
- path: string;
100
- json: Record<PropertyKey, unknown>;
101
- taxonomyNodePaths: string[] = [];
102
- taxonomyNodes: TaxonomyTreeNodeData[] = [];
103
-
104
- constructor(
105
- groupId: string,
106
- artifactId: string,
107
- versionId: string,
108
- path: string,
109
- json: Record<PropertyKey, unknown>,
110
- ) {
111
- this.groupId = groupId;
112
- this.artifactId = artifactId;
113
- this.versionId = versionId;
114
- this.path = path;
115
- this.json = json;
116
- this.taxonomyNodePaths = extractDataSpaceTaxonomyNodePaths(this.json);
117
- }
118
-
119
- get id(): string {
120
- return `${generateGAVCoordinates(
121
- this.groupId,
122
- this.artifactId,
123
- this.versionId,
124
- )}${DATA_SPACE_ID_DELIMITER}${this.path}`;
125
- }
126
- }
127
-
128
- export class TaxonomyTreeNodeData implements TreeNodeData {
129
- isSelected?: boolean | undefined;
130
- isOpen?: boolean | undefined;
131
- id: string;
132
- label: string;
133
- childrenIds: string[] = [];
134
- rawDataSpaces: RawDataSpace[] = [];
135
-
136
- constructor(id: string, label: string) {
137
- this.id = id;
138
- this.label = label;
139
- }
140
- }
141
-
142
- export class TaxonomyViewerState {
143
- enterpriseModelExplorerStore: EnterpriseModelExplorerStore;
144
- taxonomyNode: TaxonomyTreeNodeData;
145
- dataSpaceViewerState?: DataSpaceViewerState | undefined;
146
- currentDataSpace?: RawDataSpace | undefined;
147
- initDataSpaceViewerState = ActionState.create();
148
-
149
- constructor(
150
- enterpriseModelExplorerStore: EnterpriseModelExplorerStore,
151
- taxonomyNode: TaxonomyTreeNodeData,
152
- ) {
153
- makeObservable(this, {
154
- dataSpaceViewerState: observable,
155
- currentDataSpace: observable,
156
- clearDataSpaceViewerState: action,
157
- initializeDataSpaceViewer: flow,
158
- });
159
- this.enterpriseModelExplorerStore = enterpriseModelExplorerStore;
160
- this.taxonomyNode = taxonomyNode;
161
- }
162
-
163
- clearDataSpaceViewerState(): void {
164
- this.dataSpaceViewerState = undefined;
165
- this.currentDataSpace = undefined;
166
- }
167
-
168
- *initializeDataSpaceViewer(rawDataSpace: RawDataSpace): GeneratorFn<void> {
169
- try {
170
- this.initDataSpaceViewerState.inProgress();
171
- const groupId = guaranteeNonNullable(
172
- rawDataSpace.json.groupId,
173
- `Data space 'groupId' field is missing`,
174
- ) as string;
175
- const artifactId = guaranteeNonNullable(
176
- rawDataSpace.json.artifactId,
177
- `Data space 'artifactId' field is missing`,
178
- ) as string;
179
- const versionId = guaranteeNonNullable(
180
- rawDataSpace.json.versionId,
181
- `Data space 'versionId' field is missing`,
182
- ) as string;
183
-
184
- // build graph
185
- const projectData = ProjectData.serialization.fromJson(
186
- (yield flowResult(
187
- this.enterpriseModelExplorerStore.depotServerClient.getProject(
188
- groupId,
189
- artifactId,
190
- ),
191
- )) as PlainObject<ProjectData>,
192
- );
193
- const resolvedVersionId =
194
- versionId === LATEST_VERSION_ALIAS
195
- ? projectData.latestVersion
196
- : versionId;
197
- const entities =
198
- (yield this.enterpriseModelExplorerStore.depotServerClient.getVersionEntities(
199
- groupId,
200
- artifactId,
201
- resolvedVersionId,
202
- )) as Entity[];
203
- this.enterpriseModelExplorerStore.graphManagerState.resetGraph();
204
- // build dependencies
205
- const dependencyManager =
206
- this.enterpriseModelExplorerStore.graphManagerState.createEmptyDependencyManager();
207
- const dependencyEntitiesMap = new Map<string, Entity[]>();
208
- (
209
- (yield this.enterpriseModelExplorerStore.depotServerClient.getDependencyEntities(
210
- groupId,
211
- artifactId,
212
- resolvedVersionId,
213
- true,
214
- false,
215
- )) as PlainObject<ProjectVersionEntities>[]
216
- )
217
- .map((e) => ProjectVersionEntities.serialization.fromJson(e))
218
- .forEach((dependencyInfo) => {
219
- dependencyEntitiesMap.set(dependencyInfo.id, dependencyInfo.entities);
220
- });
221
- yield flowResult(
222
- this.enterpriseModelExplorerStore.graphManagerState.graphManager.buildDependencies(
223
- this.enterpriseModelExplorerStore.graphManagerState.coreModel,
224
- this.enterpriseModelExplorerStore.graphManagerState.systemModel,
225
- dependencyManager,
226
- dependencyEntitiesMap,
227
- ),
228
- );
229
- this.enterpriseModelExplorerStore.graphManagerState.graph.setDependencyManager(
230
- dependencyManager,
231
- );
232
- yield flowResult(
233
- this.enterpriseModelExplorerStore.graphManagerState.graphManager.buildGraph(
234
- this.enterpriseModelExplorerStore.graphManagerState.graph,
235
- entities,
236
- ),
237
- );
238
-
239
- // resolve data space
240
- const resolvedDataSpace = getResolvedDataSpace(
241
- rawDataSpace.json,
242
- this.enterpriseModelExplorerStore.graphManagerState.graph,
243
- );
244
- const dataSpaceViewerState = new DataSpaceViewerState(
245
- this.enterpriseModelExplorerStore.graphManagerState,
246
- rawDataSpace.groupId,
247
- rawDataSpace.artifactId,
248
- rawDataSpace.versionId,
249
- resolvedDataSpace,
250
- {
251
- viewProject: (
252
- groupId: string,
253
- artifactId: string,
254
- versionId: string,
255
- entityPath: string | undefined,
256
- ): void => {
257
- this.enterpriseModelExplorerStore.applicationStore.navigator.openNewWindow(
258
- this.enterpriseModelExplorerStore.applicationStore.navigator.generateLocation(
259
- `/view/${generateGAVCoordinates(
260
- groupId,
261
- artifactId,
262
- versionId,
263
- )}${entityPath ? `/entity/${entityPath}` : ''}`,
264
- ),
265
- );
266
- },
267
- },
268
- );
269
- this.dataSpaceViewerState = dataSpaceViewerState;
270
- this.currentDataSpace = rawDataSpace;
271
- } catch (error) {
272
- assertErrorThrown(error);
273
- this.enterpriseModelExplorerStore.applicationStore.notifyError(error);
274
- this.clearDataSpaceViewerState();
275
- } finally {
276
- this.initDataSpaceViewerState.complete();
277
- }
278
- }
279
- }
280
-
281
- export class EnterpriseModelExplorerStore {
282
- applicationStore: ApplicationStore<StudioConfig>;
283
- depotServerClient: DepotServerClient;
284
- graphManagerState: GraphManagerState;
285
- pluginManager: StudioPluginManager;
286
-
287
- sideBarDisplayState = new PanelDisplayState({
288
- initial: 300,
289
- default: 300,
290
- snap: 150,
291
- });
292
- isInExpandedMode = true;
293
-
294
- initState = ActionState.create();
295
-
296
- dataSpaceIndex = new Map<string, RawDataSpace>();
297
- treeData?: TreeData<TaxonomyTreeNodeData> | undefined;
298
-
299
- initialDataSpaceId?: string | undefined;
300
- currentTaxonomyViewerState?: TaxonomyViewerState | undefined;
301
-
302
- constructor(
303
- applicationStore: ApplicationStore<StudioConfig>,
304
- depotServerClient: DepotServerClient,
305
- graphManagerState: GraphManagerState,
306
- pluginManager: StudioPluginManager,
307
- ) {
308
- makeObservable(this, {
309
- isInExpandedMode: observable,
310
- treeData: observable.ref,
311
- currentTaxonomyViewerState: observable,
312
- initialize: flow,
313
- setExpandedMode: action,
314
- setTreeData: action,
315
- setCurrentTaxonomyViewerState: action,
316
- });
317
- this.applicationStore = applicationStore;
318
- this.depotServerClient = depotServerClient;
319
- this.graphManagerState = graphManagerState;
320
- this.pluginManager = pluginManager;
321
- }
322
-
323
- setExpandedMode(val: boolean): void {
324
- this.isInExpandedMode = val;
325
- }
326
-
327
- setTreeData(val: TreeData<TaxonomyTreeNodeData>): void {
328
- this.treeData = val;
329
- }
330
-
331
- setCurrentTaxonomyViewerState(val: TaxonomyViewerState | undefined): void {
332
- this.currentTaxonomyViewerState = val;
333
- }
334
-
335
- internalizeDataSpacePath(params: EnterpriseModelExplorerPathParams): void {
336
- const { gav, dataSpacePath } = params;
337
- if (gav && dataSpacePath) {
338
- this.initialDataSpaceId = `${gav}${DATA_SPACE_ID_DELIMITER}${dataSpacePath}`;
339
- this.applicationStore.navigator.goTo(
340
- ENTERPRISE_MODEL_EXPLORER_ROUTE_PATTERN.ENTERPRISE_VIEW,
341
- );
342
- }
343
- }
344
-
345
- private processTaxonomyTreeNodeData(
346
- treeData: TreeData<TaxonomyTreeNodeData>,
347
- rawDataSpace: RawDataSpace,
348
- taxonomyPath: string,
349
- parentNode: TaxonomyTreeNodeData | undefined,
350
- ): TaxonomyTreeNodeData {
351
- const idx = taxonomyPath.indexOf(TAXONOMY_NODE_PATH_DELIMITER);
352
- let taxonomy: string;
353
- let remainingTaxonomyNodePath: string | undefined = undefined;
354
- if (idx === -1) {
355
- taxonomy = taxonomyPath;
356
- } else {
357
- taxonomy = taxonomyPath.substring(0, idx);
358
- remainingTaxonomyNodePath = taxonomyPath.substring(
359
- idx + TAXONOMY_NODE_PATH_DELIMITER.length,
360
- );
361
- }
362
- const nodeId = parentNode
363
- ? `${parentNode.id}${TAXONOMY_NODE_PATH_DELIMITER}${taxonomy}`
364
- : taxonomy;
365
- if (!treeData.nodes.has(nodeId)) {
366
- const newNode = new TaxonomyTreeNodeData(nodeId, taxonomy);
367
- treeData.nodes.set(nodeId, newNode);
368
- }
369
- const node = guaranteeNonNullable(treeData.nodes.get(nodeId));
370
- addUniqueEntry(node.rawDataSpaces, rawDataSpace);
371
- addUniqueEntry(rawDataSpace.taxonomyNodes, node);
372
- if (remainingTaxonomyNodePath) {
373
- const childNode = this.processTaxonomyTreeNodeData(
374
- treeData,
375
- rawDataSpace,
376
- remainingTaxonomyNodePath,
377
- node,
378
- );
379
- addUniqueEntry(node.childrenIds, childNode.id);
380
- }
381
-
382
- return node;
383
- }
384
-
385
- private initializeTaxonomyTreeData(): void {
386
- const rootIds: string[] = [];
387
- const nodes = new Map<string, TaxonomyTreeNodeData>();
388
- const treeData = { rootIds, nodes };
389
- Array.from(this.dataSpaceIndex.values()).forEach((rawDataSpace) => {
390
- const taxonomyNodes = rawDataSpace.taxonomyNodePaths;
391
- taxonomyNodes.forEach((taxonomyPath) => {
392
- const rootNode = this.processTaxonomyTreeNodeData(
393
- treeData,
394
- rawDataSpace,
395
- taxonomyPath,
396
- undefined,
397
- );
398
- addUniqueEntry(rootIds, rootNode.id);
399
- });
400
- });
401
- this.setTreeData({ rootIds, nodes });
402
- }
403
-
404
- *initialize(params: EnterpriseModelExplorerPathParams): GeneratorFn<void> {
405
- if (!this.initState.isInInitialState) {
406
- return;
407
- }
408
- this.initState.inProgress();
409
- try {
410
- (
411
- (yield this.depotServerClient.getEntitiesByClassifierPath(
412
- DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
413
- )) as StoredEntity[]
414
- )
415
- .map(
416
- (storedEntity) =>
417
- new RawDataSpace(
418
- storedEntity.groupId,
419
- storedEntity.artifactId,
420
- storedEntity.versionId,
421
- storedEntity.entity.path,
422
- storedEntity.entity.content,
423
- ),
424
- )
425
- // NOTE: only care about data space tagged with taxonomy information
426
- .filter((rawDataSpace) => rawDataSpace.taxonomyNodePaths.length)
427
- .forEach((rawDataSpace) => {
428
- this.dataSpaceIndex.set(rawDataSpace.id, rawDataSpace);
429
- });
430
-
431
- yield flowResult(
432
- this.graphManagerState.graphManager.initialize(
433
- {
434
- env: this.applicationStore.config.env,
435
- tabSize: TAB_SIZE,
436
- clientConfig: {
437
- baseUrl: this.applicationStore.config.engineServerUrl,
438
- queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
439
- enableCompression: true,
440
- },
441
- },
442
- {
443
- tracerServicePlugins: this.pluginManager.getTracerServicePlugins(),
444
- },
445
- ),
446
- );
447
-
448
- yield flowResult(this.graphManagerState.initializeSystem());
449
-
450
- // NOTE: here we build the full tree, which might be expensive when we have a big
451
- // tree in the future, we might have to come up with a better algorithm then
452
- // to incrementally build the tree
453
- this.initializeTaxonomyTreeData();
454
-
455
- if (this.treeData) {
456
- const taxonomyPath = params.taxonomyPath;
457
- if (taxonomyPath) {
458
- const node = this.treeData.nodes.get(taxonomyPath);
459
- if (node) {
460
- node.isOpen = true;
461
- const taxonomyPathParts = taxonomyPath.split(
462
- TAXONOMY_NODE_PATH_DELIMITER,
463
- );
464
- let currentTaxonomyPath = '';
465
- for (let i = 0; i < taxonomyPathParts.length; ++i) {
466
- currentTaxonomyPath += `${
467
- i !== 0 ? TAXONOMY_NODE_PATH_DELIMITER : ''
468
- }${taxonomyPathParts[i]}`;
469
- const nodeToOpen = guaranteeNonNullable(
470
- this.treeData.nodes.get(currentTaxonomyPath),
471
- );
472
- nodeToOpen.isOpen = true;
473
- this.setTreeData({ ...this.treeData });
474
- }
475
- this.setCurrentTaxonomyViewerState(
476
- new TaxonomyViewerState(this, node),
477
- );
478
-
479
- // open data space if specified
480
- if (this.initialDataSpaceId) {
481
- const dataSpaceToOpen = node.rawDataSpaces.find(
482
- (rawDataSpace) => rawDataSpace.id === this.initialDataSpaceId,
483
- );
484
- const initialDataSpaceId = this.initialDataSpaceId;
485
- this.initialDataSpaceId = undefined;
486
- if (dataSpaceToOpen) {
487
- assertNonNullable(this.currentTaxonomyViewerState);
488
- yield flowResult(
489
- this.currentTaxonomyViewerState.initializeDataSpaceViewer(
490
- dataSpaceToOpen,
491
- ),
492
- );
493
- } else {
494
- throw new AssertionError(
495
- `Can't find data space with ID '${initialDataSpaceId}' in taxonomy node with path '${taxonomyPath}'`,
496
- );
497
- }
498
- }
499
- } else {
500
- throw new AssertionError(
501
- `Can't find taxonomy node with path '${taxonomyPath}'`,
502
- );
503
- }
504
- }
505
- }
506
-
507
- this.initState.pass();
508
- } catch (error) {
509
- assertErrorThrown(error);
510
- this.initState.fail();
511
- this.applicationStore.notifyError(error);
512
- }
513
- }
514
- }