@finos/legend-extension-dsl-data-space 10.4.261 → 10.4.263

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 (65) hide show
  1. package/lib/components/DataSpaceRelatedDataSpaces.d.ts +22 -0
  2. package/lib/components/DataSpaceRelatedDataSpaces.d.ts.map +1 -0
  3. package/lib/components/DataSpaceRelatedDataSpaces.js +54 -0
  4. package/lib/components/DataSpaceRelatedDataSpaces.js.map +1 -0
  5. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  6. package/lib/components/DataSpaceViewer.js +2 -2
  7. package/lib/components/DataSpaceViewer.js.map +1 -1
  8. package/lib/components/DataSpaceWiki.d.ts.map +1 -1
  9. package/lib/components/DataSpaceWiki.js +2 -1
  10. package/lib/components/DataSpaceWiki.js.map +1 -1
  11. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.d.ts +3 -0
  12. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.d.ts.map +1 -1
  13. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.js +3 -1
  14. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.js.map +1 -1
  15. package/lib/components/index.d.ts +1 -0
  16. package/lib/components/index.d.ts.map +1 -1
  17. package/lib/components/index.js +1 -0
  18. package/lib/components/index.js.map +1 -1
  19. package/lib/graph-manager/DSL_DataSpace_PureGraphManagerPlugin.d.ts +4 -0
  20. package/lib/graph-manager/DSL_DataSpace_PureGraphManagerPlugin.d.ts.map +1 -1
  21. package/lib/graph-manager/DSL_DataSpace_PureGraphManagerPlugin.js +4 -0
  22. package/lib/graph-manager/DSL_DataSpace_PureGraphManagerPlugin.js.map +1 -1
  23. package/lib/graph-manager/action/changeDetection/DSL_DataSpace_ObserverHelper.d.ts.map +1 -1
  24. package/lib/graph-manager/action/changeDetection/DSL_DataSpace_ObserverHelper.js +2 -0
  25. package/lib/graph-manager/action/changeDetection/DSL_DataSpace_ObserverHelper.js.map +1 -1
  26. package/lib/graph-manager/index.d.ts +2 -1
  27. package/lib/graph-manager/index.d.ts.map +1 -1
  28. package/lib/graph-manager/index.js +2 -1
  29. package/lib/graph-manager/index.js.map +1 -1
  30. package/lib/index.css +2 -2
  31. package/lib/index.css.map +1 -1
  32. package/lib/package.json +1 -1
  33. package/lib/stores/DataSpaceLayoutState.d.ts.map +1 -1
  34. package/lib/stores/DataSpaceLayoutState.js +1 -0
  35. package/lib/stores/DataSpaceLayoutState.js.map +1 -1
  36. package/lib/stores/DataSpaceViewerNavigation.d.ts +19 -0
  37. package/lib/stores/DataSpaceViewerNavigation.d.ts.map +1 -1
  38. package/lib/stores/DataSpaceViewerNavigation.js +39 -0
  39. package/lib/stores/DataSpaceViewerNavigation.js.map +1 -1
  40. package/lib/stores/DataSpaceViewerState.d.ts +10 -3
  41. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  42. package/lib/stores/DataSpaceViewerState.js +49 -11
  43. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  44. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  45. package/lib/stores/query/DataSpaceAdvancedSearchState.js +1 -1
  46. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  47. package/lib/stores/shared/DataSpaceInfo.d.ts +2 -1
  48. package/lib/stores/shared/DataSpaceInfo.d.ts.map +1 -1
  49. package/lib/stores/shared/DataSpaceInfo.js +5 -0
  50. package/lib/stores/shared/DataSpaceInfo.js.map +1 -1
  51. package/package.json +15 -15
  52. package/src/components/DataSpaceRelatedDataSpaces.tsx +123 -0
  53. package/src/components/DataSpaceViewer.tsx +0 -9
  54. package/src/components/DataSpaceWiki.tsx +2 -0
  55. package/src/components/__test-utils__/DataSpaceViewerTestUtils.ts +5 -0
  56. package/src/components/index.ts +7 -0
  57. package/src/graph-manager/DSL_DataSpace_PureGraphManagerPlugin.ts +7 -0
  58. package/src/graph-manager/action/changeDetection/DSL_DataSpace_ObserverHelper.ts +2 -0
  59. package/src/graph-manager/index.ts +12 -1
  60. package/src/stores/DataSpaceLayoutState.ts +1 -0
  61. package/src/stores/DataSpaceViewerNavigation.ts +73 -0
  62. package/src/stores/DataSpaceViewerState.ts +78 -16
  63. package/src/stores/query/DataSpaceAdvancedSearchState.ts +1 -0
  64. package/src/stores/shared/DataSpaceInfo.ts +16 -0
  65. package/tsconfig.json +1 -0
@@ -15,6 +15,9 @@
15
15
  */
16
16
 
17
17
  import { NAVIGATION_ZONE_SEPARATOR } from '@finos/legend-application';
18
+ import { extractElementNameFromPath } from '@finos/legend-graph';
19
+ import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot';
20
+ import { isNonNullable } from '@finos/legend-shared';
18
21
  import type { DataSpaceExecutableAnalysisResult } from '../graph-manager/action/analytics/DataSpaceAnalysis.js';
19
22
  import type { DiagramAnalysisResult } from '@finos/legend-extension-dsl-diagram';
20
23
 
@@ -26,6 +29,7 @@ export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
26
29
  QUICK_START = 'quick-start',
27
30
  EXECUTION_CONTEXT = 'execution-context',
28
31
  DATA_ACCESS = 'data-access',
32
+ RELATED_DATA_SPACES = 'related-data-spaces',
29
33
 
30
34
  DATA_STORES = 'data-stores', // TODO: with test-data, also let user call TDS query on top of these
31
35
  DATA_AVAILABILITY = 'data-availability',
@@ -61,3 +65,72 @@ export const generateAnchorForDiagram = (
61
65
  DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
62
66
  generateAnchorChunk(diagram.title),
63
67
  ].join(NAVIGATION_ZONE_SEPARATOR);
68
+
69
+ const RELATED_DATA_SPACE_GAV_COORDINATE_SEPARATOR = ':';
70
+ const RELATED_DATA_SPACE_GAV_PATH_SEPARATOR = '|';
71
+ const RELATED_DATA_SPACE_ENTRY_SEPARATOR = ',';
72
+
73
+ export type DataSpaceWikiRelatedDataSpace = {
74
+ name: string;
75
+ groupId: string;
76
+ artifactId: string;
77
+ versionId: string;
78
+ path: string;
79
+ isInvalid?: boolean | undefined;
80
+ };
81
+
82
+ export const encodeRelatedDataSpaceGAV = (entry: {
83
+ groupId: string;
84
+ artifactId: string;
85
+ versionId: string;
86
+ path: string;
87
+ }): string =>
88
+ `${[entry.groupId, entry.artifactId, entry.versionId].join(
89
+ RELATED_DATA_SPACE_GAV_COORDINATE_SEPARATOR,
90
+ )}${RELATED_DATA_SPACE_GAV_PATH_SEPARATOR}${entry.path}`;
91
+
92
+ export const generateRelatedDataSpaceRedirectPath = (
93
+ relatedDataSpace: DataSpaceWikiRelatedDataSpace,
94
+ ): string =>
95
+ `${relatedDataSpace.groupId}:${relatedDataSpace.artifactId}:${LATEST_VERSION_ALIAS}/${relatedDataSpace.path}`;
96
+
97
+ export const parseRelatedDataSpaceGAV = (
98
+ value: string,
99
+ ): DataSpaceWikiRelatedDataSpace | undefined => {
100
+ const separatorIdx = value.indexOf(RELATED_DATA_SPACE_GAV_PATH_SEPARATOR);
101
+ if (separatorIdx === -1) {
102
+ return undefined;
103
+ }
104
+ const gavPart = value.slice(0, separatorIdx);
105
+ const path = value.slice(separatorIdx + 1);
106
+ const coordinates = gavPart.split(
107
+ RELATED_DATA_SPACE_GAV_COORDINATE_SEPARATOR,
108
+ );
109
+ if (coordinates.length !== 3) {
110
+ return undefined;
111
+ }
112
+ const [groupId, artifactId, versionId] = coordinates;
113
+ if (!groupId || !artifactId || !versionId || !path) {
114
+ return undefined;
115
+ }
116
+ return {
117
+ name: extractElementNameFromPath(path),
118
+ groupId,
119
+ artifactId,
120
+ versionId,
121
+ path,
122
+ };
123
+ };
124
+
125
+ export const splitRelatedDataSpaceEntries = (value: string): string[] =>
126
+ value
127
+ .split(RELATED_DATA_SPACE_ENTRY_SEPARATOR)
128
+ .map((entry) => entry.trim())
129
+ .filter((entry) => entry.length > 0);
130
+
131
+ export const parseRelatedDataSpaceGAVs = (
132
+ value: string,
133
+ ): DataSpaceWikiRelatedDataSpace[] =>
134
+ splitRelatedDataSpaceEntries(value)
135
+ .map((entry) => parseRelatedDataSpaceGAV(entry))
136
+ .filter(isNonNullable);
@@ -24,19 +24,27 @@ import {
24
24
  type GraphData,
25
25
  type GraphManagerState,
26
26
  type PackageableRuntime,
27
+ extractElementNameFromPath,
27
28
  } from '@finos/legend-graph';
28
- import { action, computed, flowResult, makeObservable, observable } from 'mobx';
29
+ import {
30
+ action,
31
+ computed,
32
+ flow,
33
+ flowResult,
34
+ makeObservable,
35
+ observable,
36
+ } from 'mobx';
29
37
  import {
30
38
  type DataSpaceAnalysisResult,
31
39
  type DataSpaceExecutionContextAnalysisResult,
32
40
  DataproductReferenceMetadata,
33
41
  LakehouseDataProductExecutableAccessorInfo,
34
42
  } from '../graph-manager/action/analytics/DataSpaceAnalysis.js';
35
- import { isSnapshotVersion } from '@finos/legend-server-depot';
36
43
  import {
37
- PURE_DATA_SPACE_INFO_PROFILE_PATH,
38
- PURE_DATA_SPACE_INFO_PROFILE_VERIFIED_STEREOTYPE,
39
- } from '../graph-manager/DSL_DataSpace_PureGraphManagerPlugin.js';
44
+ isSnapshotVersion,
45
+ resolveVersion,
46
+ type DepotServerClient,
47
+ } from '@finos/legend-server-depot';
40
48
  import { DataSpaceViewerModelsDocumentationState } from './DataSpaceModelsDocumentationState.js';
41
49
  import { DataSpaceViewerDiagramViewerState } from './DataSpaceViewerDiagramViewerState.js';
42
50
  import {
@@ -44,8 +52,10 @@ import {
44
52
  DataSpaceLayoutState,
45
53
  } from './DataSpaceLayoutState.js';
46
54
  import {
55
+ type DataSpaceWikiRelatedDataSpace,
47
56
  DATA_SPACE_VIEWER_ACTIVITY_MODE,
48
57
  generateAnchorForActivity,
58
+ parseRelatedDataSpaceGAVs,
49
59
  } from './DataSpaceViewerNavigation.js';
50
60
  import { DataAccessState } from '@finos/legend-query-builder';
51
61
  import {
@@ -63,6 +73,14 @@ import {
63
73
  type DataSpaceQualityResult,
64
74
  } from './DataSpaceQualityState.js';
65
75
  import { BaseViewerState } from '@finos/legend-extension-dsl-data-product';
76
+ import {
77
+ type GeneratorFn,
78
+ ActionState,
79
+ assertErrorThrown,
80
+ guaranteeNonNullable,
81
+ isString,
82
+ } from '@finos/legend-shared';
83
+ import { type Entity } from '@finos/legend-storage';
66
84
 
67
85
  export class DataSpaceViewerState extends BaseViewerState<
68
86
  DataSpaceAnalysisResult,
@@ -85,12 +103,14 @@ export class DataSpaceViewerState extends BaseViewerState<
85
103
  readonly viewDataProduct?:
86
104
  | ((dataProductPath: string, deploymentId: number) => void)
87
105
  | undefined;
106
+ readonly viewDataSpace?: ((gavPath: string) => void) | undefined;
88
107
  readonly mappingProviderAccessConfig?:
89
108
  | DataSpaceMappingProviderAccessConfig
90
109
  | undefined;
91
110
  readonly fetchDataSpaceQuality?:
92
111
  | (() => Promise<DataSpaceQualityResult>)
93
112
  | undefined;
113
+ readonly depotServerClient?: DepotServerClient | undefined;
94
114
 
95
115
  readonly diagramViewerState: DataSpaceViewerDiagramViewerState;
96
116
  readonly modelsDocumentationState: DataSpaceViewerModelsDocumentationState;
@@ -114,6 +134,9 @@ export class DataSpaceViewerState extends BaseViewerState<
114
134
  */
115
135
  dataProductAccessStates = new Map<string, DataSpaceDataProductAccessState>();
116
136
 
137
+ relatedDataSpaces: DataSpaceWikiRelatedDataSpace[] = [];
138
+ readonly fetchRelatedDataSpaceTitlesState = ActionState.create();
139
+
117
140
  constructor(
118
141
  applicationStore: GenericLegendApplicationStore,
119
142
  graphManagerState: GraphManagerState,
@@ -121,6 +144,7 @@ export class DataSpaceViewerState extends BaseViewerState<
121
144
  artifactId: string,
122
145
  versionId: string,
123
146
  dataSpaceAnalysisResult: DataSpaceAnalysisResult,
147
+ depotServerClient: DepotServerClient | undefined,
124
148
  actions: {
125
149
  retrieveGraphData: () => GraphData;
126
150
  queryDataSpace: (executionContextKey: string | undefined) => void;
@@ -135,6 +159,7 @@ export class DataSpaceViewerState extends BaseViewerState<
135
159
  viewDataProduct?:
136
160
  | ((dataProductPath: string, deploymentId: number) => void)
137
161
  | undefined;
162
+ viewDataSpace?: ((gavPath: string) => void) | undefined;
138
163
  mappingProviderAccessConfig?:
139
164
  | DataSpaceMappingProviderAccessConfig
140
165
  | undefined;
@@ -162,14 +187,15 @@ export class DataSpaceViewerState extends BaseViewerState<
162
187
  currentMappingProviderAccessState: computed,
163
188
  executableStates: observable,
164
189
  legendAIConfig: observable,
165
- isVerified: computed,
166
190
  isDataAccessAvailable: computed,
167
191
  referencedDataProductPaths: computed,
192
+ relatedDataSpaces: observable,
168
193
  setCurrentActivity: action,
169
194
  setCurrentExecutionContext: action,
170
195
  setCurrentRuntime: action,
171
196
  refreshCurrentMappingProviderAccessState: action,
172
197
  refreshDataProductAccessState: action,
198
+ fetchRelatedDataSpaceTitles: flow,
173
199
  });
174
200
 
175
201
  this.graphManagerState = graphManagerState;
@@ -188,8 +214,10 @@ export class DataSpaceViewerState extends BaseViewerState<
188
214
  this.openServiceQuery = actions.openServiceQuery;
189
215
  this.onQuickStartTabChange = actions.onQuickStartTabChange;
190
216
  this.viewDataProduct = actions.viewDataProduct;
217
+ this.viewDataSpace = actions.viewDataSpace;
191
218
  this.mappingProviderAccessConfig = actions.mappingProviderAccessConfig;
192
219
  this.fetchDataSpaceQuality = actions.fetchDataSpaceQuality;
220
+ this.depotServerClient = depotServerClient;
193
221
 
194
222
  this.currentExecutionContext =
195
223
  dataSpaceAnalysisResult.defaultExecutionContext ??
@@ -241,16 +269,6 @@ export class DataSpaceViewerState extends BaseViewerState<
241
269
  );
242
270
  }
243
271
 
244
- get isVerified(): boolean {
245
- return Boolean(
246
- this.dataSpaceAnalysisResult.stereotypes.find(
247
- (stereotype) =>
248
- stereotype.profile === PURE_DATA_SPACE_INFO_PROFILE_PATH &&
249
- stereotype.value === PURE_DATA_SPACE_INFO_PROFILE_VERIFIED_STEREOTYPE,
250
- ),
251
- );
252
- }
253
-
254
272
  override get documentationUrl(): string | undefined {
255
273
  return this.dataSpaceAnalysisResult.supportInfo?.documentationUrl;
256
274
  }
@@ -390,6 +408,50 @@ export class DataSpaceViewerState extends BaseViewerState<
390
408
  return paths;
391
409
  }
392
410
 
411
+ *fetchRelatedDataSpaceTitles(): GeneratorFn<void> {
412
+ if (!this.fetchRelatedDataSpaceTitlesState.isInInitialState) {
413
+ return;
414
+ }
415
+ const relatedDataSpaces = (
416
+ this.dataSpaceAnalysisResult.info?.relatedDataSpaces ?? []
417
+ ).flatMap((entry) => parseRelatedDataSpaceGAVs(entry));
418
+ this.fetchRelatedDataSpaceTitlesState.inProgress();
419
+ if (!this.depotServerClient) {
420
+ this.relatedDataSpaces = relatedDataSpaces;
421
+ this.fetchRelatedDataSpaceTitlesState.pass();
422
+ return;
423
+ }
424
+ const depotServerClient = this.depotServerClient;
425
+ const results = (yield Promise.allSettled(
426
+ relatedDataSpaces.map(async (relatedDataSpace) => {
427
+ const entity = await depotServerClient.getVersionEntity(
428
+ relatedDataSpace.groupId,
429
+ relatedDataSpace.artifactId,
430
+ resolveVersion(relatedDataSpace.versionId),
431
+ relatedDataSpace.path,
432
+ );
433
+ const content = entity.content as Entity['content'];
434
+ return {
435
+ ...relatedDataSpace,
436
+ name: isString(content.title) ? content.title : relatedDataSpace.name,
437
+ };
438
+ }),
439
+ )) as PromiseSettledResult<DataSpaceWikiRelatedDataSpace>[];
440
+ this.relatedDataSpaces = results.map((result, idx) => {
441
+ if (result.status === 'fulfilled') {
442
+ return result.value;
443
+ }
444
+ const relatedDataSpace = guaranteeNonNullable(relatedDataSpaces[idx]);
445
+ assertErrorThrown(result.reason);
446
+ return {
447
+ ...relatedDataSpace,
448
+ name: extractElementNameFromPath(relatedDataSpace.path),
449
+ isInvalid: true,
450
+ };
451
+ });
452
+ this.fetchRelatedDataSpaceTitlesState.pass();
453
+ }
454
+
393
455
  /**
394
456
  * Looks up the initialized access state for a Data Product path (may still
395
457
  * be initializing). Used by executable renderers to grab the state for a
@@ -206,6 +206,7 @@ export class DataSpaceAdvancedSearchState {
206
206
  artifactId,
207
207
  versionId,
208
208
  analysisResult,
209
+ this.depotServerClient,
209
210
  {
210
211
  retrieveGraphData: () =>
211
212
  new GraphDataWithOrigin(
@@ -17,6 +17,7 @@
17
17
  import {
18
18
  SNAPSHOT_VERSION_ALIAS,
19
19
  type StoredEntity,
20
+ type StoredSummaryEntity,
20
21
  } from '@finos/legend-server-depot';
21
22
  import { isString } from '@finos/legend-shared';
22
23
  import {
@@ -68,3 +69,18 @@ export const extractDataSpaceInfo = (
68
69
  ? storedEntity.entity.content.defaultExecutionContext
69
70
  : undefined,
70
71
  );
72
+
73
+ export const extractDataSpaceInfoFromSummary = (
74
+ storedSummaryEntity: StoredSummaryEntity,
75
+ ): ResolvedDataSpaceEntityWithOrigin =>
76
+ new ResolvedDataSpaceEntityWithOrigin(
77
+ {
78
+ groupId: storedSummaryEntity.groupId,
79
+ artifactId: storedSummaryEntity.artifactId,
80
+ versionId: storedSummaryEntity.versionId,
81
+ },
82
+ undefined,
83
+ extractEntityNameFromPath(storedSummaryEntity.path),
84
+ storedSummaryEntity.path,
85
+ undefined,
86
+ );
package/tsconfig.json CHANGED
@@ -109,6 +109,7 @@
109
109
  "./src/components/DataSpacePlaceholder.tsx",
110
110
  "./src/components/DataSpaceQualityEmote.tsx",
111
111
  "./src/components/DataSpaceQuickStart.tsx",
112
+ "./src/components/DataSpaceRelatedDataSpaces.tsx",
112
113
  "./src/components/DataSpaceSupportPanel.tsx",
113
114
  "./src/components/DataSpaceViewer.tsx",
114
115
  "./src/components/DataSpaceViewerActivityBar.tsx",