@finos/legend-extension-dsl-data-space 9.1.7 → 9.2.1
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.
- package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
- package/lib/components/DataSpaceDataAccess.js +71 -3
- package/lib/components/DataSpaceDataAccess.js.map +1 -1
- package/lib/components/DataSpaceDescription.d.ts.map +1 -1
- package/lib/components/DataSpaceDescription.js +6 -1
- package/lib/components/DataSpaceDescription.js.map +1 -1
- package/lib/components/DataSpaceDiagramViewer.js +3 -3
- package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
- package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
- package/lib/components/DataSpaceQuickStart.js +3 -2
- package/lib/components/DataSpaceQuickStart.js.map +1 -1
- package/lib/components/DataSpaceViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceViewer.js +3 -2
- package/lib/components/DataSpaceViewer.js.map +1 -1
- package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -1
- package/lib/components/DataSpaceViewerActivityBar.js +13 -4
- package/lib/components/DataSpaceViewerActivityBar.js.map +1 -1
- package/lib/components/DataSpaceWiki.d.ts.map +1 -1
- package/lib/components/DataSpaceWiki.js +1 -0
- package/lib/components/DataSpaceWiki.js.map +1 -1
- package/lib/components/query/DataSpaceQueryCreator.js +1 -1
- package/lib/components/query/DataSpaceQueryCreator.js.map +1 -1
- package/lib/graph/DSL_DataSpace_HashUtils.d.ts +1 -0
- package/lib/graph/DSL_DataSpace_HashUtils.d.ts.map +1 -1
- package/lib/graph/DSL_DataSpace_HashUtils.js +1 -0
- package/lib/graph/DSL_DataSpace_HashUtils.js.map +1 -1
- package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts +23 -19
- package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js +41 -32
- package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js.map +1 -1
- package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js +23 -17
- package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +4 -11
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +3 -3
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +25 -2
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts +21 -17
- package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js +41 -32
- package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts +2 -1
- package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js +44 -10
- package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +5 -5
- package/lib/stores/DataSpaceViewerDataAccessState.d.ts +35 -0
- package/lib/stores/DataSpaceViewerDataAccessState.d.ts.map +1 -0
- package/lib/stores/DataSpaceViewerDataAccessState.js +100 -0
- package/lib/stores/DataSpaceViewerDataAccessState.js.map +1 -0
- package/lib/stores/DataSpaceViewerState.d.ts +34 -20
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
- package/lib/stores/DataSpaceViewerState.js +100 -29
- package/lib/stores/DataSpaceViewerState.js.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +2 -0
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/studio/DataSpacePreviewState.d.ts.map +1 -1
- package/lib/stores/studio/DataSpacePreviewState.js +2 -0
- package/lib/stores/studio/DataSpacePreviewState.js.map +1 -1
- package/package.json +16 -16
- package/src/components/DataSpaceDataAccess.tsx +116 -2
- package/src/components/DataSpaceDescription.tsx +7 -1
- package/src/components/DataSpaceDiagramViewer.tsx +3 -3
- package/src/components/DataSpaceQuickStart.tsx +5 -1
- package/src/components/DataSpaceViewer.tsx +6 -2
- package/src/components/DataSpaceViewerActivityBar.tsx +14 -5
- package/src/components/DataSpaceWiki.tsx +2 -0
- package/src/components/query/DataSpaceQueryCreator.tsx +1 -1
- package/src/graph/DSL_DataSpace_HashUtils.ts +1 -0
- package/src/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.ts +59 -55
- package/src/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.ts +23 -30
- package/src/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +9 -18
- package/src/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +34 -3
- package/src/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.ts +57 -46
- package/src/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts +59 -14
- package/src/stores/DataSpaceViewerDataAccessState.ts +146 -0
- package/src/stores/DataSpaceViewerState.ts +126 -33
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +14 -1
- package/src/stores/studio/DataSpacePreviewState.ts +3 -0
- package/tsconfig.json +1 -0
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
UnsupportedOperationError,
|
|
23
23
|
customListWithSchema,
|
|
24
24
|
usingConstantValueSchema,
|
|
25
|
+
isString,
|
|
26
|
+
isNonNullable,
|
|
25
27
|
} from '@finos/legend-shared';
|
|
26
28
|
import {
|
|
27
29
|
createModelSchema,
|
|
@@ -317,15 +319,13 @@ export class V1_DataSpaceAnalysisResult {
|
|
|
317
319
|
executionContexts: V1_DataSpaceExecutionContextAnalysisResult[] = [];
|
|
318
320
|
defaultExecutionContext!: string;
|
|
319
321
|
|
|
320
|
-
featuredDiagrams: string[] = [];
|
|
321
|
-
|
|
322
322
|
elements: string[] = [];
|
|
323
323
|
elementDocs: V1_DataSpaceModelDocumentationEntry[] = [];
|
|
324
324
|
|
|
325
325
|
executables: V1_DataSpaceExecutableAnalysisResult[] = [];
|
|
326
326
|
diagrams: V1_DataSpaceDiagramAnalysisResult[] = [];
|
|
327
327
|
|
|
328
|
-
static readonly serialization = new SerializationFactory(
|
|
328
|
+
private static readonly serialization = new SerializationFactory(
|
|
329
329
|
createModelSchema(V1_DataSpaceAnalysisResult, {
|
|
330
330
|
name: primitive(),
|
|
331
331
|
package: primitive(),
|
|
@@ -363,4 +363,35 @@ export class V1_DataSpaceAnalysisResult {
|
|
|
363
363
|
),
|
|
364
364
|
}),
|
|
365
365
|
);
|
|
366
|
+
|
|
367
|
+
static deserialize(
|
|
368
|
+
json: PlainObject<V1_DataSpaceAnalysisResult>,
|
|
369
|
+
): V1_DataSpaceAnalysisResult {
|
|
370
|
+
const result = deserialize(
|
|
371
|
+
V1_DataSpaceAnalysisResult.serialization.schema,
|
|
372
|
+
json,
|
|
373
|
+
);
|
|
374
|
+
/**
|
|
375
|
+
* Featured diagrams will be transformed to diagrams, so here we nicely
|
|
376
|
+
* auto-transform it for backward compatibility
|
|
377
|
+
*
|
|
378
|
+
* @backwardCompatibility
|
|
379
|
+
*/
|
|
380
|
+
if (json.featuredDiagrams && Array.isArray(json.featuredDiagrams)) {
|
|
381
|
+
const diagramResults = json.featuredDiagrams
|
|
382
|
+
.map((featuredDiagram) => {
|
|
383
|
+
if (isString(featuredDiagram)) {
|
|
384
|
+
const diagramAnalysisResult =
|
|
385
|
+
new V1_DataSpaceDiagramAnalysisResult();
|
|
386
|
+
diagramAnalysisResult.title = '';
|
|
387
|
+
diagramAnalysisResult.diagram = featuredDiagram;
|
|
388
|
+
return diagramAnalysisResult;
|
|
389
|
+
}
|
|
390
|
+
return undefined;
|
|
391
|
+
})
|
|
392
|
+
.filter(isNonNullable);
|
|
393
|
+
result.diagrams = result.diagrams.concat(diagramResults);
|
|
394
|
+
}
|
|
395
|
+
return result;
|
|
396
|
+
}
|
|
366
397
|
}
|
|
@@ -24,48 +24,6 @@ import {
|
|
|
24
24
|
type V1_TaggedValue,
|
|
25
25
|
} from '@finos/legend-graph';
|
|
26
26
|
|
|
27
|
-
export abstract class V1_DataSpaceSupportInfo implements Hashable {
|
|
28
|
-
documentationUrl?: string | undefined;
|
|
29
|
-
|
|
30
|
-
abstract get hashCode(): string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class V1_DataSpaceSupportEmail
|
|
34
|
-
extends V1_DataSpaceSupportInfo
|
|
35
|
-
implements Hashable
|
|
36
|
-
{
|
|
37
|
-
address!: string;
|
|
38
|
-
|
|
39
|
-
get hashCode(): string {
|
|
40
|
-
return hashArray([
|
|
41
|
-
DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_SUPPORT_EMAIL,
|
|
42
|
-
this.documentationUrl ?? '',
|
|
43
|
-
this.address,
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export class V1_DataSpaceSupportCombinedInfo
|
|
49
|
-
extends V1_DataSpaceSupportInfo
|
|
50
|
-
implements Hashable
|
|
51
|
-
{
|
|
52
|
-
emails?: string[] | undefined;
|
|
53
|
-
website?: string | undefined;
|
|
54
|
-
faqUrl?: string | undefined;
|
|
55
|
-
supportUrl?: string | undefined;
|
|
56
|
-
|
|
57
|
-
get hashCode(): string {
|
|
58
|
-
return hashArray([
|
|
59
|
-
DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_SUPPORT_COMBINED_INFO,
|
|
60
|
-
this.documentationUrl ?? '',
|
|
61
|
-
hashArray(this.emails ?? []),
|
|
62
|
-
this.website ?? '',
|
|
63
|
-
this.faqUrl ?? '',
|
|
64
|
-
this.supportUrl ?? '',
|
|
65
|
-
]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
27
|
export class V1_DataSpaceExecutionContext implements Hashable {
|
|
70
28
|
name!: string;
|
|
71
29
|
title?: string | undefined;
|
|
@@ -85,6 +43,19 @@ export class V1_DataSpaceExecutionContext implements Hashable {
|
|
|
85
43
|
}
|
|
86
44
|
}
|
|
87
45
|
|
|
46
|
+
export class V1_DataSpaceElementPointer implements Hashable {
|
|
47
|
+
path!: string;
|
|
48
|
+
exclude?: boolean | undefined;
|
|
49
|
+
|
|
50
|
+
get hashCode(): string {
|
|
51
|
+
return hashArray([
|
|
52
|
+
DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_ELEMENT_POINTER,
|
|
53
|
+
this.path,
|
|
54
|
+
this.exclude ?? '',
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
88
59
|
export class V1_DataSpaceExecutable implements Hashable {
|
|
89
60
|
title!: string;
|
|
90
61
|
description?: string | undefined;
|
|
@@ -115,6 +86,48 @@ export class V1_DataSpaceDiagram implements Hashable {
|
|
|
115
86
|
}
|
|
116
87
|
}
|
|
117
88
|
|
|
89
|
+
export abstract class V1_DataSpaceSupportInfo implements Hashable {
|
|
90
|
+
documentationUrl?: string | undefined;
|
|
91
|
+
|
|
92
|
+
abstract get hashCode(): string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export class V1_DataSpaceSupportEmail
|
|
96
|
+
extends V1_DataSpaceSupportInfo
|
|
97
|
+
implements Hashable
|
|
98
|
+
{
|
|
99
|
+
address!: string;
|
|
100
|
+
|
|
101
|
+
get hashCode(): string {
|
|
102
|
+
return hashArray([
|
|
103
|
+
DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_SUPPORT_EMAIL,
|
|
104
|
+
this.documentationUrl ?? '',
|
|
105
|
+
this.address,
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export class V1_DataSpaceSupportCombinedInfo
|
|
111
|
+
extends V1_DataSpaceSupportInfo
|
|
112
|
+
implements Hashable
|
|
113
|
+
{
|
|
114
|
+
emails?: string[] | undefined;
|
|
115
|
+
website?: string | undefined;
|
|
116
|
+
faqUrl?: string | undefined;
|
|
117
|
+
supportUrl?: string | undefined;
|
|
118
|
+
|
|
119
|
+
get hashCode(): string {
|
|
120
|
+
return hashArray([
|
|
121
|
+
DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_SUPPORT_COMBINED_INFO,
|
|
122
|
+
this.documentationUrl ?? '',
|
|
123
|
+
hashArray(this.emails ?? []),
|
|
124
|
+
this.website ?? '',
|
|
125
|
+
this.faqUrl ?? '',
|
|
126
|
+
this.supportUrl ?? '',
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
export class V1_DataSpace extends V1_PackageableElement implements Hashable {
|
|
119
132
|
stereotypes: V1_StereotypePtr[] = [];
|
|
120
133
|
taggedValues: V1_TaggedValue[] = [];
|
|
@@ -122,8 +135,7 @@ export class V1_DataSpace extends V1_PackageableElement implements Hashable {
|
|
|
122
135
|
description?: string | undefined;
|
|
123
136
|
executionContexts!: V1_DataSpaceExecutionContext[];
|
|
124
137
|
defaultExecutionContext!: string;
|
|
125
|
-
|
|
126
|
-
elements?: V1_PackageableElementPointer[] | undefined;
|
|
138
|
+
elements?: V1_DataSpaceElementPointer[] | undefined;
|
|
127
139
|
executables?: V1_DataSpaceExecutable[] | undefined;
|
|
128
140
|
diagrams?: V1_DataSpaceDiagram[] | undefined;
|
|
129
141
|
supportInfo?: V1_DataSpaceSupportInfo | undefined;
|
|
@@ -137,8 +149,7 @@ export class V1_DataSpace extends V1_PackageableElement implements Hashable {
|
|
|
137
149
|
this.description ?? '',
|
|
138
150
|
hashArray(this.executionContexts),
|
|
139
151
|
this.defaultExecutionContext,
|
|
140
|
-
hashArray(
|
|
141
|
-
hashArray((this.elements ?? []).map((pointer) => pointer.path)),
|
|
152
|
+
hashArray(this.elements ?? []),
|
|
142
153
|
hashArray(this.executables ?? []),
|
|
143
154
|
hashArray(this.diagrams ?? []),
|
|
144
155
|
this.supportInfo ?? '',
|
|
@@ -28,7 +28,8 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
V1_stereotypePtrSchema,
|
|
30
30
|
V1_taggedValueSchema,
|
|
31
|
-
|
|
31
|
+
V1_packageableElementPointerModelSchema,
|
|
32
|
+
V1_PackageableElementPointer,
|
|
32
33
|
} from '@finos/legend-graph';
|
|
33
34
|
import {
|
|
34
35
|
type PlainObject,
|
|
@@ -37,6 +38,8 @@ import {
|
|
|
37
38
|
usingModelSchema,
|
|
38
39
|
optionalCustomListWithSchema,
|
|
39
40
|
customListWithSchema,
|
|
41
|
+
isString,
|
|
42
|
+
isNonNullable,
|
|
40
43
|
} from '@finos/legend-shared';
|
|
41
44
|
import {
|
|
42
45
|
type V1_DataSpaceSupportInfo,
|
|
@@ -46,6 +49,7 @@ import {
|
|
|
46
49
|
V1_DataSpaceSupportCombinedInfo,
|
|
47
50
|
V1_DataSpaceExecutable,
|
|
48
51
|
V1_DataSpaceDiagram,
|
|
52
|
+
V1_DataSpaceElementPointer,
|
|
49
53
|
} from '../../model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js';
|
|
50
54
|
|
|
51
55
|
export const V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE = 'dataSpace';
|
|
@@ -55,11 +59,9 @@ const V1_DATA_SPACE_SUPPORT_COMBINED_INFO_TYPE = 'combined';
|
|
|
55
59
|
const V1_dataSpaceExecutionContextModelSchema = createModelSchema(
|
|
56
60
|
V1_DataSpaceExecutionContext,
|
|
57
61
|
{
|
|
58
|
-
defaultRuntime: usingModelSchema(
|
|
59
|
-
V1_packageableElementPointerDeserializerSchema,
|
|
60
|
-
),
|
|
62
|
+
defaultRuntime: usingModelSchema(V1_packageableElementPointerModelSchema),
|
|
61
63
|
description: optional(primitive()),
|
|
62
|
-
mapping: usingModelSchema(
|
|
64
|
+
mapping: usingModelSchema(V1_packageableElementPointerModelSchema),
|
|
63
65
|
name: primitive(),
|
|
64
66
|
title: optional(primitive()),
|
|
65
67
|
},
|
|
@@ -119,35 +121,39 @@ export const V1_deserializeSupportInfo = (
|
|
|
119
121
|
}
|
|
120
122
|
};
|
|
121
123
|
|
|
124
|
+
const V1_dataSpaceElementPointerModelSchema = createModelSchema(
|
|
125
|
+
V1_DataSpaceElementPointer,
|
|
126
|
+
{
|
|
127
|
+
exclude: optional(primitive()),
|
|
128
|
+
path: primitive(),
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
122
132
|
const V1_dataSpaceExecutableModelSchema = createModelSchema(
|
|
123
133
|
V1_DataSpaceExecutable,
|
|
124
134
|
{
|
|
125
135
|
description: optional(primitive()),
|
|
126
|
-
executable: usingModelSchema(
|
|
127
|
-
V1_packageableElementPointerDeserializerSchema,
|
|
128
|
-
),
|
|
136
|
+
executable: usingModelSchema(V1_packageableElementPointerModelSchema),
|
|
129
137
|
title: primitive(),
|
|
130
138
|
},
|
|
131
139
|
);
|
|
132
140
|
|
|
133
141
|
const V1_dataSpaceDiagramModelSchema = createModelSchema(V1_DataSpaceDiagram, {
|
|
134
142
|
description: optional(primitive()),
|
|
135
|
-
diagram: usingModelSchema(
|
|
143
|
+
diagram: usingModelSchema(V1_packageableElementPointerModelSchema),
|
|
136
144
|
title: primitive(),
|
|
137
145
|
});
|
|
138
146
|
|
|
139
|
-
|
|
147
|
+
const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
|
|
140
148
|
_type: usingConstantValueSchema(V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE),
|
|
141
149
|
defaultExecutionContext: primitive(),
|
|
142
150
|
description: optional(primitive()),
|
|
143
151
|
diagrams: list(object(V1_dataSpaceDiagramModelSchema)),
|
|
144
|
-
elements: optionalCustomListWithSchema(
|
|
145
|
-
V1_packageableElementPointerDeserializerSchema,
|
|
146
|
-
),
|
|
152
|
+
elements: optionalCustomListWithSchema(V1_dataSpaceElementPointerModelSchema),
|
|
147
153
|
executables: list(object(V1_dataSpaceExecutableModelSchema)),
|
|
148
154
|
executionContexts: list(object(V1_dataSpaceExecutionContextModelSchema)),
|
|
149
155
|
featuredDiagrams: optionalCustomListWithSchema(
|
|
150
|
-
|
|
156
|
+
V1_packageableElementPointerModelSchema,
|
|
151
157
|
),
|
|
152
158
|
name: primitive(),
|
|
153
159
|
package: primitive(),
|
|
@@ -163,3 +169,42 @@ export const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
|
|
|
163
169
|
}),
|
|
164
170
|
title: optional(primitive()),
|
|
165
171
|
});
|
|
172
|
+
|
|
173
|
+
export const V1_serializeDataSpace = (
|
|
174
|
+
protocol: V1_DataSpace,
|
|
175
|
+
): PlainObject<V1_DataSpace> => serialize(V1_dataSpaceModelSchema, protocol);
|
|
176
|
+
|
|
177
|
+
export const V1_deserializeDataSpace = (
|
|
178
|
+
json: PlainObject<V1_DataSpace>,
|
|
179
|
+
): V1_DataSpace => {
|
|
180
|
+
const dataSpace = deserialize(V1_dataSpaceModelSchema, json);
|
|
181
|
+
/**
|
|
182
|
+
* Featured diagrams will be transformed to diagrams, so here we nicely
|
|
183
|
+
* auto-transform it for backward compatibility
|
|
184
|
+
*
|
|
185
|
+
* @backwardCompatibility
|
|
186
|
+
*/
|
|
187
|
+
if (json.featuredDiagrams && Array.isArray(json.featuredDiagrams)) {
|
|
188
|
+
const diagrams = json.featuredDiagrams
|
|
189
|
+
.map((featuredDiagram) => {
|
|
190
|
+
if (isString(featuredDiagram.path)) {
|
|
191
|
+
const diagram = new V1_DataSpaceDiagram();
|
|
192
|
+
diagram.title = '';
|
|
193
|
+
diagram.diagram = new V1_PackageableElementPointer(
|
|
194
|
+
undefined,
|
|
195
|
+
featuredDiagram.path,
|
|
196
|
+
);
|
|
197
|
+
return diagram;
|
|
198
|
+
}
|
|
199
|
+
return undefined;
|
|
200
|
+
})
|
|
201
|
+
.filter(isNonNullable);
|
|
202
|
+
if (diagrams.length) {
|
|
203
|
+
dataSpace.diagrams =
|
|
204
|
+
dataSpace.diagrams !== undefined
|
|
205
|
+
? dataSpace.diagrams.concat(diagrams)
|
|
206
|
+
: diagrams;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return dataSpace;
|
|
210
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
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 {
|
|
18
|
+
type GeneratorFn,
|
|
19
|
+
ActionState,
|
|
20
|
+
assertErrorThrown,
|
|
21
|
+
uuid,
|
|
22
|
+
} from '@finos/legend-shared';
|
|
23
|
+
import { action, flow, makeObservable, observable } from 'mobx';
|
|
24
|
+
import type { DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
25
|
+
import type {
|
|
26
|
+
DatasetSpecification,
|
|
27
|
+
DatasetEntitlementReport,
|
|
28
|
+
} from '@finos/legend-graph';
|
|
29
|
+
|
|
30
|
+
export class DataSpaceDatasetInfo {
|
|
31
|
+
readonly uuid = uuid();
|
|
32
|
+
readonly specification!: DatasetSpecification;
|
|
33
|
+
|
|
34
|
+
entitlementReport?: DatasetEntitlementReport | undefined;
|
|
35
|
+
|
|
36
|
+
constructor(specification: DatasetSpecification) {
|
|
37
|
+
makeObservable(this, {
|
|
38
|
+
entitlementReport: observable,
|
|
39
|
+
setEntitlementReport: action,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.specification = specification;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
setEntitlementReport(val: DatasetEntitlementReport | undefined): void {
|
|
46
|
+
this.entitlementReport = val;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class DataSpaceViewerDataAccessState {
|
|
51
|
+
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
52
|
+
|
|
53
|
+
readonly fetchDatasetSpecificationsState = ActionState.create();
|
|
54
|
+
readonly fetchDatasetEntitlementReportsState = ActionState.create();
|
|
55
|
+
|
|
56
|
+
datasets: DataSpaceDatasetInfo[] = [];
|
|
57
|
+
|
|
58
|
+
constructor(dataSpaceViewerState: DataSpaceViewerState) {
|
|
59
|
+
makeObservable(this, {
|
|
60
|
+
datasets: observable,
|
|
61
|
+
fetchDatasetSpecifications: flow,
|
|
62
|
+
fetchDatasetEntitlementReports: flow,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.dataSpaceViewerState = dataSpaceViewerState;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
*fetchDatasetSpecifications(): GeneratorFn<void> {
|
|
69
|
+
this.fetchDatasetSpecificationsState.inProgress();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const datasets =
|
|
73
|
+
(yield this.dataSpaceViewerState.graphManagerState.graphManager.surveyDatasets(
|
|
74
|
+
this.dataSpaceViewerState.currentExecutionContext.mapping,
|
|
75
|
+
this.dataSpaceViewerState.currentExecutionContext.defaultRuntime,
|
|
76
|
+
undefined,
|
|
77
|
+
this.dataSpaceViewerState.retriveGraphData(),
|
|
78
|
+
)) as DatasetSpecification[];
|
|
79
|
+
this.datasets = datasets.map((dataset) => {
|
|
80
|
+
const existingDataset = this.datasets.find(
|
|
81
|
+
(ds) => ds.specification.hashCode === dataset.hashCode,
|
|
82
|
+
);
|
|
83
|
+
if (existingDataset) {
|
|
84
|
+
return existingDataset;
|
|
85
|
+
}
|
|
86
|
+
return new DataSpaceDatasetInfo(dataset);
|
|
87
|
+
});
|
|
88
|
+
} catch (error) {
|
|
89
|
+
assertErrorThrown(error);
|
|
90
|
+
this.dataSpaceViewerState.applicationStore.notificationService.notifyError(
|
|
91
|
+
error,
|
|
92
|
+
);
|
|
93
|
+
} finally {
|
|
94
|
+
this.fetchDatasetSpecificationsState.complete();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
*fetchDatasetEntitlementReports(): GeneratorFn<void> {
|
|
99
|
+
this.fetchDatasetEntitlementReportsState.inProgress();
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const reports =
|
|
103
|
+
(yield this.dataSpaceViewerState.graphManagerState.graphManager.checkEntitlements(
|
|
104
|
+
this.dataSpaceViewerState.currentExecutionContext.mapping,
|
|
105
|
+
this.dataSpaceViewerState.currentExecutionContext.defaultRuntime,
|
|
106
|
+
undefined,
|
|
107
|
+
this.dataSpaceViewerState.retriveGraphData(),
|
|
108
|
+
)) as DatasetEntitlementReport[];
|
|
109
|
+
this.datasets.forEach((dataset) => {
|
|
110
|
+
const matchingReport = reports.find(
|
|
111
|
+
(report) =>
|
|
112
|
+
report.storeSpecification.hashCode ===
|
|
113
|
+
dataset.specification.hashCode,
|
|
114
|
+
);
|
|
115
|
+
if (matchingReport) {
|
|
116
|
+
dataset.setEntitlementReport(matchingReport);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
dataset.setEntitlementReport(undefined);
|
|
120
|
+
});
|
|
121
|
+
const newDatasets: DataSpaceDatasetInfo[] = [];
|
|
122
|
+
reports.forEach((report) => {
|
|
123
|
+
const matchingDataset = this.datasets.find(
|
|
124
|
+
(dataset) =>
|
|
125
|
+
dataset.specification.hashCode ===
|
|
126
|
+
report.storeSpecification.hashCode,
|
|
127
|
+
);
|
|
128
|
+
if (!matchingDataset) {
|
|
129
|
+
const newDataset = new DataSpaceDatasetInfo(
|
|
130
|
+
report.storeSpecification,
|
|
131
|
+
);
|
|
132
|
+
newDataset.setEntitlementReport(report);
|
|
133
|
+
newDatasets.push(newDataset);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
this.datasets = this.datasets.concat(newDatasets);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
assertErrorThrown(error);
|
|
139
|
+
this.dataSpaceViewerState.applicationStore.notificationService.notifyError(
|
|
140
|
+
error,
|
|
141
|
+
);
|
|
142
|
+
} finally {
|
|
143
|
+
this.fetchDatasetEntitlementReportsState.complete();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|