@finos/legend-extension-dsl-data-space-studio 0.1.238 → 0.1.239
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/DataSpaceEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceEditor.js +10 -3
- package/lib/components/DataSpaceEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/DataSpaceEditorState.d.ts +1 -0
- package/lib/stores/DataSpaceEditorState.d.ts.map +1 -1
- package/lib/stores/DataSpaceEditorState.js +29 -4
- package/lib/stores/DataSpaceEditorState.js.map +1 -1
- package/lib/stores/DataSpaceToDataProductConverter.d.ts +26 -0
- package/lib/stores/DataSpaceToDataProductConverter.d.ts.map +1 -0
- package/lib/stores/DataSpaceToDataProductConverter.js +146 -0
- package/lib/stores/DataSpaceToDataProductConverter.js.map +1 -0
- package/package.json +8 -8
- package/src/components/DataSpaceEditor.tsx +34 -2
- package/src/stores/DataSpaceEditorState.ts +65 -2
- package/src/stores/DataSpaceToDataProductConverter.ts +253 -0
- package/tsconfig.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceEditor.d.ts","sourceRoot":"","sources":["../../src/components/DataSpaceEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"DataSpaceEditor.d.ts","sourceRoot":"","sources":["../../src/components/DataSpaceEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqBH,eAAO,MAAM,eAAe;;CAoF1B,CAAC"}
|
|
@@ -16,12 +16,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
16
16
|
*/
|
|
17
17
|
import { observer } from 'mobx-react-lite';
|
|
18
18
|
import { useEditorStore } from '@finos/legend-application-studio';
|
|
19
|
-
import { EyeIcon, Panel, PanelContent, PanelHeader } from '@finos/legend-art';
|
|
20
|
-
import { DataSpaceEditorState } from '../stores/DataSpaceEditorState.js';
|
|
19
|
+
import { EyeIcon, EnvelopeIcon, Panel, PanelContent, PanelHeader, } from '@finos/legend-art';
|
|
20
|
+
import { DataSpaceEditorState, onConvertDataSpaceToDataProduct, } from '../stores/DataSpaceEditorState.js';
|
|
21
21
|
import { DataSpaceGeneralEditor } from './DataSpaceGeneralEditor/DataSpaceGeneralEditor.js';
|
|
22
22
|
import { DataSpacePreviewState } from '../stores/DataSpacePreviewState.js';
|
|
23
23
|
import { flowResult } from 'mobx';
|
|
24
24
|
import { isStubbed_PackageableElement } from '@finos/legend-graph';
|
|
25
|
+
import { dataSpaceContainsOneMapping } from '../stores/DataSpaceToDataProductConverter.js';
|
|
25
26
|
export const DataSpaceEditor = observer(() => {
|
|
26
27
|
const editorStore = useEditorStore();
|
|
27
28
|
const dataSpaceState = editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
|
@@ -38,6 +39,12 @@ export const DataSpaceEditor = observer(() => {
|
|
|
38
39
|
const previewDataSpace = () => {
|
|
39
40
|
flowResult(dataSpacePreviewState.previewDataSpace(dataSpaceState.dataSpace)).catch(editorStore.applicationStore.alertUnhandledError);
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
const convertDataSpace = () => {
|
|
43
|
+
flowResult(onConvertDataSpaceToDataProduct(dataSpace, editorStore, dataSpaceState)).catch(editorStore.applicationStore.alertUnhandledError);
|
|
44
|
+
};
|
|
45
|
+
const canConvertDataSpace = () => {
|
|
46
|
+
return dataSpaceContainsOneMapping(dataSpace);
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs(Panel, { className: "dataSpace-editor", children: [_jsx(PanelHeader, { title: "Data Product", titleContent: dataSpaceState.dataSpace.name, darkMode: true, isReadOnly: dataSpaceState.isReadOnly }), _jsx(PanelHeader, { title: "General", darkMode: true, children: _jsxs("div", { className: "panel__header__actions", children: [_jsx("div", { className: "btn__dropdown-combo btn__dropdown-combo--primary", children: _jsxs("button", { className: "btn__dropdown-combo__label", onClick: convertDataSpace, title: "Convert Data Product", tabIndex: -1, disabled: !canConvertDataSpace, children: [_jsx(EnvelopeIcon, { className: "btn__dropdown-combo__label__icon" }), _jsx("div", { className: "btn__dropdown-combo__label__title", children: "Convert" })] }) }), _jsx("div", { className: "btn__dropdown-combo btn__dropdown-combo--primary", children: _jsxs("button", { className: "btn__dropdown-combo__label", onClick: previewDataSpace, title: "Preview Data Product", tabIndex: -1, disabled: !validPreviewState(), children: [_jsx(EyeIcon, { className: "btn__dropdown-combo__label__icon" }), _jsx("div", { className: "btn__dropdown-combo__label__title", children: "Preview" })] }) })] }) }), _jsx(PanelContent, { children: _jsx(DataSpaceGeneralEditor, {}) })] }));
|
|
42
49
|
});
|
|
43
50
|
//# sourceMappingURL=DataSpaceEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceEditor.js","sourceRoot":"","sources":["../../src/components/DataSpaceEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"DataSpaceEditor.js","sourceRoot":"","sources":["../../src/components/DataSpaceEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,E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;IAC5D,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,GAAY,EAAE;QACxC,OAAO,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,KAAK,IAAC,SAAS,EAAC,kBAAkB,aACjC,KAAC,WAAW,IACV,KAAK,EAAC,cAAc,EACpB,YAAY,EAAE,cAAc,CAAC,SAAS,CAAC,IAAI,EAC3C,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,cAAc,CAAC,UAAU,GACrC,EACF,KAAC,WAAW,IAAC,KAAK,EAAC,SAAS,EAAC,QAAQ,EAAE,IAAI,YACzC,eAAK,SAAS,EAAC,wBAAwB,aACrC,cAAK,SAAS,EAAC,kDAAkD,YAC/D,kBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAC,sBAAsB,EAC5B,QAAQ,EAAE,CAAC,CAAC,EACZ,QAAQ,EAAE,CAAC,mBAAmB,aAE9B,KAAC,YAAY,IAAC,SAAS,EAAC,kCAAkC,GAAG,EAC7D,cAAK,SAAS,EAAC,mCAAmC,wBAAc,IACzD,GACL,EACN,cAAK,SAAS,EAAC,kDAAkD,YAC/D,kBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAC,sBAAsB,EAC5B,QAAQ,EAAE,CAAC,CAAC,EACZ,QAAQ,EAAE,CAAC,iBAAiB,EAAE,aAE9B,KAAC,OAAO,IAAC,SAAS,EAAC,kCAAkC,GAAG,EACxD,cAAK,SAAS,EAAC,mCAAmC,wBAAc,IACzD,GACL,IACF,GACM,EAEd,KAAC,YAAY,cACX,KAAC,sBAAsB,KAAG,GACb,IACT,CACT,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.css
CHANGED
package/lib/package.json
CHANGED
|
@@ -18,6 +18,7 @@ import { type PackageableElement } from '@finos/legend-graph';
|
|
|
18
18
|
import { Diagram } from '@finos/legend-extension-dsl-diagram/graph';
|
|
19
19
|
import { DataSpace, type DataSpaceElement } from '@finos/legend-extension-dsl-data-space/graph';
|
|
20
20
|
import { DataSpaceExecutionContextState } from './DataSpaceExecutionContextState.js';
|
|
21
|
+
export declare const onConvertDataSpaceToDataProduct: (dataSpace: DataSpace, editorStore: EditorStore, dataSpaceEditorState: DataSpaceEditorState) => import("mobx/dist/internal.js").CancellablePromise<void>;
|
|
21
22
|
export declare class DataSpaceEditorState extends ElementEditorState {
|
|
22
23
|
executionContextState: DataSpaceExecutionContextState;
|
|
23
24
|
constructor(editorStore: EditorStore, element: PackageableElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceEditorState.d.ts","sourceRoot":"","sources":["../../src/stores/DataSpaceEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"DataSpaceEditorState.d.ts","sourceRoot":"","sources":["../../src/stores/DataSpaceEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EACL,KAAK,WAAW,EAEhB,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,kBAAkB,EAQxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EACL,SAAS,EAET,KAAK,gBAAgB,EACtB,MAAM,8CAA8C,CAAC;AAMtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAGrF,eAAO,MAAM,+BAA+B,0JA8C1C,CAAC;AAEH,qBAAa,oBAAqB,SAAQ,kBAAkB;IAC1D,qBAAqB,EAAE,8BAA8B,CAAC;gBAE1C,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB;IAgBjE,uBAAuB,CACrB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,IAAI,gBAAgB;IAS9B,0BAA0B,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAA;KAAE,EAAE;IAc1E,6BAA6B,IAAI;QAC/B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,kBAAkB,CAAC;KAC3B,EAAE;IAuBH,iBAAiB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE;IAcxD,IAAI,SAAS,IAAI,SAAS,CAMzB;IAEQ,SAAS,CAChB,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,WAAW,GACvB,kBAAkB;CAItB"}
|
|
@@ -13,13 +13,38 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { action, computed, makeObservable, observable } from 'mobx';
|
|
17
|
-
import { ElementEditorState, } from '@finos/legend-application-studio';
|
|
18
|
-
import { Package, Class, Enumeration, Association, Service, ConcreteFunctionDefinition, } from '@finos/legend-graph';
|
|
16
|
+
import { action, computed, flow, flowResult, makeObservable, observable, } from 'mobx';
|
|
17
|
+
import { DataProductEditorState, ElementEditorState, } from '@finos/legend-application-studio';
|
|
18
|
+
import { Package, Class, Enumeration, Association, Service, ConcreteFunctionDefinition, observe_DataProduct, } from '@finos/legend-graph';
|
|
19
19
|
import { Diagram } from '@finos/legend-extension-dsl-diagram/graph';
|
|
20
20
|
import { DataSpace, DataSpacePackageableElementExecutable, } from '@finos/legend-extension-dsl-data-space/graph';
|
|
21
|
-
import { guaranteeType } from '@finos/legend-shared';
|
|
21
|
+
import { assertErrorThrown, guaranteeType, } from '@finos/legend-shared';
|
|
22
22
|
import { DataSpaceExecutionContextState } from './DataSpaceExecutionContextState.js';
|
|
23
|
+
import { convertDataSpaceToDataProduct } from '../stores/DataSpaceToDataProductConverter.js';
|
|
24
|
+
export const onConvertDataSpaceToDataProduct = flow(function* (dataSpace, editorStore, dataSpaceEditorState) {
|
|
25
|
+
try {
|
|
26
|
+
const dataProduct = convertDataSpaceToDataProduct(dataSpace, editorStore.graphManagerState);
|
|
27
|
+
editorStore.graphManagerState.graph.addElement(dataProduct, dataSpace.package?.path.replace(/dataspace/, 'dataproduct'));
|
|
28
|
+
const addedElement = editorStore.graphManagerState.graph.getNullableElement(dataProduct.path);
|
|
29
|
+
if (addedElement) {
|
|
30
|
+
observe_DataProduct(addedElement);
|
|
31
|
+
}
|
|
32
|
+
const dataProductEditorState = new DataProductEditorState(editorStore, addedElement);
|
|
33
|
+
editorStore.graphManagerState.graph.deleteElement(dataSpace);
|
|
34
|
+
const dataSpacePackage = dataSpace.package;
|
|
35
|
+
if (dataSpacePackage && dataSpacePackage.children.length === 0) {
|
|
36
|
+
editorStore.graphManagerState.graph.deleteElement(dataSpacePackage);
|
|
37
|
+
}
|
|
38
|
+
editorStore.tabManagerState.closeTab(dataSpaceEditorState);
|
|
39
|
+
editorStore.tabManagerState.openTab(dataProductEditorState);
|
|
40
|
+
yield flowResult(editorStore.explorerTreeState.build());
|
|
41
|
+
editorStore.applicationStore.notificationService.notifySuccess(`Successfully converted DataSpace ${dataSpace.name} to Data Product`);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
assertErrorThrown(error);
|
|
45
|
+
editorStore.applicationStore.notificationService.notifyError(`Failed to convert DataSpace to Data Product: ${error.message}`);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
23
48
|
export class DataSpaceEditorState extends ElementEditorState {
|
|
24
49
|
executionContextState;
|
|
25
50
|
constructor(editorStore, element) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceEditorState.js","sourceRoot":"","sources":["../../src/stores/DataSpaceEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DataSpaceEditorState.js","sourceRoot":"","sources":["../../src/stores/DataSpaceEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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
* 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 DataSpace } from '@finos/legend-extension-dsl-data-space/graph';
|
|
17
|
+
import { type GraphManagerState, DataProduct } from '@finos/legend-graph';
|
|
18
|
+
export declare enum DATA_PRODUCT_SUPPORT_TYPE {
|
|
19
|
+
DOCUMENTATION = "Documentation",
|
|
20
|
+
SUPPORT = "Support",
|
|
21
|
+
WEBSITE = "Website",
|
|
22
|
+
FAQ = "FAQ"
|
|
23
|
+
}
|
|
24
|
+
export declare const dataSpaceContainsOneMapping: (dataSpace: DataSpace) => boolean;
|
|
25
|
+
export declare const convertDataSpaceToDataProduct: (dataSpace: DataSpace, graphManagerState: GraphManagerState) => DataProduct;
|
|
26
|
+
//# sourceMappingURL=DataSpaceToDataProductConverter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSpaceToDataProductConverter.d.ts","sourceRoot":"","sources":["../../src/stores/DataSpaceToDataProductConverter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,KAAK,iBAAiB,EAKtB,WAAW,EAWZ,MAAM,qBAAqB,CAAC;AAG7B,oBAAY,yBAAyB;IACnC,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,GAAG,QAAQ;CACZ;AAiBD,eAAO,MAAM,2BAA2B,GAAI,WAAW,SAAS,KAAG,OAQlE,CAAC;AA+JF,eAAO,MAAM,6BAA6B,GACxC,WAAW,SAAS,EACpB,mBAAmB,iBAAiB,KACnC,WAiBF,CAAC"}
|
|
@@ -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
|
+
import { DataSpaceSupportEmail, DataSpaceSupportCombinedInfo, getQueryFromDataspaceExecutable, } from '@finos/legend-extension-dsl-data-space/graph';
|
|
17
|
+
import { DataProductRuntimeInfo, ModelAccessPointGroup, DataProduct, FunctionAccessPoint, InternalDataProductType, DataProductDiagram, DataProductElementScope, SupportInfo, DataProductLink, Email, observe_DataProduct, observe_DataProductRuntimeInfo, observe_ModelAccessPointGroup, } from '@finos/legend-graph';
|
|
18
|
+
import { assertTrue, uniq, uuid } from '@finos/legend-shared';
|
|
19
|
+
export var DATA_PRODUCT_SUPPORT_TYPE;
|
|
20
|
+
(function (DATA_PRODUCT_SUPPORT_TYPE) {
|
|
21
|
+
DATA_PRODUCT_SUPPORT_TYPE["DOCUMENTATION"] = "Documentation";
|
|
22
|
+
DATA_PRODUCT_SUPPORT_TYPE["SUPPORT"] = "Support";
|
|
23
|
+
DATA_PRODUCT_SUPPORT_TYPE["WEBSITE"] = "Website";
|
|
24
|
+
DATA_PRODUCT_SUPPORT_TYPE["FAQ"] = "FAQ";
|
|
25
|
+
})(DATA_PRODUCT_SUPPORT_TYPE || (DATA_PRODUCT_SUPPORT_TYPE = {}));
|
|
26
|
+
const convertDataSpaceToDiagrams = (dataSpace) => {
|
|
27
|
+
if (!dataSpace.diagrams) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return dataSpace.diagrams.map((dataSpaceDiagram) => {
|
|
31
|
+
const dataProductDiagram = new DataProductDiagram();
|
|
32
|
+
dataProductDiagram.title = dataSpaceDiagram.title;
|
|
33
|
+
dataProductDiagram.description = dataSpaceDiagram.description;
|
|
34
|
+
dataProductDiagram.diagram = dataSpaceDiagram.diagram.value;
|
|
35
|
+
return dataProductDiagram;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export const dataSpaceContainsOneMapping = (dataSpace) => {
|
|
39
|
+
return (uniq(dataSpace.executionContexts.map((execContext) => execContext.mapping.value)).length === 1);
|
|
40
|
+
};
|
|
41
|
+
const convertDataSpaceToMapping = (dataSpace) => {
|
|
42
|
+
assertTrue(dataSpaceContainsOneMapping(dataSpace), 'DataSpace contains more than one unique mapping');
|
|
43
|
+
return dataSpace.defaultExecutionContext.mapping;
|
|
44
|
+
};
|
|
45
|
+
const convertDataSpaceToFeaturedElements = (dataSpace) => {
|
|
46
|
+
if (dataSpace.elements) {
|
|
47
|
+
const featuredElements = dataSpace.elements.map((element) => {
|
|
48
|
+
const scope = new DataProductElementScope();
|
|
49
|
+
scope.element = element.element;
|
|
50
|
+
scope.exclude = element.exclude;
|
|
51
|
+
return scope;
|
|
52
|
+
});
|
|
53
|
+
return featuredElements;
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
};
|
|
57
|
+
const convertDataSpaceToFunctionAccessPoints = (dataSpace, graphManagerState) => {
|
|
58
|
+
if (!dataSpace.executables) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
return dataSpace.executables.flatMap((executable) => {
|
|
62
|
+
const query = getQueryFromDataspaceExecutable(executable, graphManagerState);
|
|
63
|
+
if (query) {
|
|
64
|
+
const functionAccessPoint = new FunctionAccessPoint(executable.id ?? uuid(), query);
|
|
65
|
+
functionAccessPoint.description = executable.description;
|
|
66
|
+
return [functionAccessPoint];
|
|
67
|
+
}
|
|
68
|
+
return [];
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const convertDataSpaceToSupportInfo = (dataSpace) => {
|
|
72
|
+
if (!dataSpace.supportInfo) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const supportInfo = new SupportInfo();
|
|
76
|
+
if (dataSpace.supportInfo.documentationUrl) {
|
|
77
|
+
supportInfo.documentation = new DataProductLink(dataSpace.supportInfo.documentationUrl, DATA_PRODUCT_SUPPORT_TYPE.DOCUMENTATION);
|
|
78
|
+
}
|
|
79
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportEmail) {
|
|
80
|
+
supportInfo.emails = [
|
|
81
|
+
new Email(dataSpace.supportInfo.address, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
else if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
|
85
|
+
if (dataSpace.supportInfo.emails) {
|
|
86
|
+
supportInfo.emails = dataSpace.supportInfo.emails.map((email) => new Email(email, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT));
|
|
87
|
+
}
|
|
88
|
+
if (dataSpace.supportInfo.website) {
|
|
89
|
+
supportInfo.website = new DataProductLink(dataSpace.supportInfo.website, DATA_PRODUCT_SUPPORT_TYPE.WEBSITE);
|
|
90
|
+
}
|
|
91
|
+
if (dataSpace.supportInfo.faqUrl) {
|
|
92
|
+
supportInfo.faqUrl = new DataProductLink(dataSpace.supportInfo.faqUrl, DATA_PRODUCT_SUPPORT_TYPE.FAQ);
|
|
93
|
+
}
|
|
94
|
+
if (dataSpace.supportInfo.supportUrl) {
|
|
95
|
+
supportInfo.supportUrl = new DataProductLink(dataSpace.supportInfo.supportUrl, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return supportInfo;
|
|
99
|
+
};
|
|
100
|
+
const convertExecutionContextToRuntime = (executionContext) => {
|
|
101
|
+
const dataProductRuntime = new DataProductRuntimeInfo();
|
|
102
|
+
dataProductRuntime.id = executionContext.name;
|
|
103
|
+
dataProductRuntime.runtime = executionContext.defaultRuntime;
|
|
104
|
+
observe_DataProductRuntimeInfo(dataProductRuntime);
|
|
105
|
+
return dataProductRuntime;
|
|
106
|
+
};
|
|
107
|
+
const convertDataSpaceToModelAccessPointGroup = (dataSpace, graphManagerState) => {
|
|
108
|
+
const modelAccessPointGroup = new ModelAccessPointGroup();
|
|
109
|
+
const dataSpaceDefaultExecutionContext = dataSpace.defaultExecutionContext;
|
|
110
|
+
modelAccessPointGroup.id = dataSpaceDefaultExecutionContext.name;
|
|
111
|
+
modelAccessPointGroup.description =
|
|
112
|
+
dataSpaceDefaultExecutionContext.description;
|
|
113
|
+
modelAccessPointGroup.accessPoints = convertDataSpaceToFunctionAccessPoints(dataSpace, graphManagerState);
|
|
114
|
+
modelAccessPointGroup.mapping = convertDataSpaceToMapping(dataSpace);
|
|
115
|
+
modelAccessPointGroup.defaultRuntime = convertExecutionContextToRuntime(dataSpace.defaultExecutionContext);
|
|
116
|
+
modelAccessPointGroup.featuredElements =
|
|
117
|
+
convertDataSpaceToFeaturedElements(dataSpace);
|
|
118
|
+
const seenRuntimePaths = new Set();
|
|
119
|
+
modelAccessPointGroup.compatibleRuntimes = dataSpace.executionContexts
|
|
120
|
+
.filter((executionContext) => {
|
|
121
|
+
const runtimePath = executionContext.defaultRuntime.value.path;
|
|
122
|
+
if (runtimePath && !seenRuntimePaths.has(runtimePath)) {
|
|
123
|
+
seenRuntimePaths.add(runtimePath);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
})
|
|
128
|
+
.map((executionContext) => convertExecutionContextToRuntime(executionContext));
|
|
129
|
+
modelAccessPointGroup.diagrams = convertDataSpaceToDiagrams(dataSpace);
|
|
130
|
+
const observeModelAccessPointGroup = observe_ModelAccessPointGroup(modelAccessPointGroup);
|
|
131
|
+
return [observeModelAccessPointGroup];
|
|
132
|
+
};
|
|
133
|
+
export const convertDataSpaceToDataProduct = (dataSpace, graphManagerState) => {
|
|
134
|
+
const name = dataSpace.name.replace(/dataspace/i, 'DataProduct');
|
|
135
|
+
const dataProduct = new DataProduct(name);
|
|
136
|
+
dataProduct.package = dataSpace.package;
|
|
137
|
+
dataProduct.stereotypes = [...dataSpace.stereotypes];
|
|
138
|
+
dataProduct.taggedValues = [...dataSpace.taggedValues];
|
|
139
|
+
dataProduct.title = dataSpace.title;
|
|
140
|
+
dataProduct.description = dataSpace.description;
|
|
141
|
+
dataProduct.accessPointGroups = convertDataSpaceToModelAccessPointGroup(dataSpace, graphManagerState);
|
|
142
|
+
dataProduct.supportInfo = convertDataSpaceToSupportInfo(dataSpace);
|
|
143
|
+
dataProduct.type = new InternalDataProductType();
|
|
144
|
+
return observe_DataProduct(dataProduct);
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=DataSpaceToDataProductConverter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSpaceToDataProductConverter.js","sourceRoot":"","sources":["../../src/stores/DataSpaceToDataProductConverter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,qBAAqB,EACrB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAIL,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,KAAK,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAA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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-data-space-studio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.239",
|
|
4
4
|
"description": "Legend extension for Data Space DSL - Studio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"test:watch": "jest --watch"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@finos/legend-application": "16.0.
|
|
46
|
-
"@finos/legend-application-studio": "28.19.
|
|
47
|
-
"@finos/legend-art": "7.1.
|
|
48
|
-
"@finos/legend-code-editor": "2.0.
|
|
49
|
-
"@finos/legend-extension-dsl-data-space": "10.4.
|
|
50
|
-
"@finos/legend-graph": "32.3.
|
|
51
|
-
"@finos/legend-query-builder": "4.17.
|
|
45
|
+
"@finos/legend-application": "16.0.74",
|
|
46
|
+
"@finos/legend-application-studio": "28.19.49",
|
|
47
|
+
"@finos/legend-art": "7.1.125",
|
|
48
|
+
"@finos/legend-code-editor": "2.0.124",
|
|
49
|
+
"@finos/legend-extension-dsl-data-space": "10.4.151",
|
|
50
|
+
"@finos/legend-graph": "32.3.5",
|
|
51
|
+
"@finos/legend-query-builder": "4.17.47",
|
|
52
52
|
"@finos/legend-server-depot": "6.1.1",
|
|
53
53
|
"@finos/legend-server-sdlc": "5.3.65",
|
|
54
54
|
"@finos/legend-shared": "11.0.20",
|
|
@@ -16,12 +16,22 @@
|
|
|
16
16
|
|
|
17
17
|
import { observer } from 'mobx-react-lite';
|
|
18
18
|
import { useEditorStore } from '@finos/legend-application-studio';
|
|
19
|
-
import {
|
|
20
|
-
|
|
19
|
+
import {
|
|
20
|
+
EyeIcon,
|
|
21
|
+
EnvelopeIcon,
|
|
22
|
+
Panel,
|
|
23
|
+
PanelContent,
|
|
24
|
+
PanelHeader,
|
|
25
|
+
} from '@finos/legend-art';
|
|
26
|
+
import {
|
|
27
|
+
DataSpaceEditorState,
|
|
28
|
+
onConvertDataSpaceToDataProduct,
|
|
29
|
+
} from '../stores/DataSpaceEditorState.js';
|
|
21
30
|
import { DataSpaceGeneralEditor } from './DataSpaceGeneralEditor/DataSpaceGeneralEditor.js';
|
|
22
31
|
import { DataSpacePreviewState } from '../stores/DataSpacePreviewState.js';
|
|
23
32
|
import { flowResult } from 'mobx';
|
|
24
33
|
import { isStubbed_PackageableElement } from '@finos/legend-graph';
|
|
34
|
+
import { dataSpaceContainsOneMapping } from '../stores/DataSpaceToDataProductConverter.js';
|
|
25
35
|
|
|
26
36
|
export const DataSpaceEditor = observer(() => {
|
|
27
37
|
const editorStore = useEditorStore();
|
|
@@ -55,6 +65,16 @@ export const DataSpaceEditor = observer(() => {
|
|
|
55
65
|
).catch(editorStore.applicationStore.alertUnhandledError);
|
|
56
66
|
};
|
|
57
67
|
|
|
68
|
+
const convertDataSpace = (): void => {
|
|
69
|
+
flowResult(
|
|
70
|
+
onConvertDataSpaceToDataProduct(dataSpace, editorStore, dataSpaceState),
|
|
71
|
+
).catch(editorStore.applicationStore.alertUnhandledError);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const canConvertDataSpace = (): boolean => {
|
|
75
|
+
return dataSpaceContainsOneMapping(dataSpace);
|
|
76
|
+
};
|
|
77
|
+
|
|
58
78
|
return (
|
|
59
79
|
<Panel className="dataSpace-editor">
|
|
60
80
|
<PanelHeader
|
|
@@ -65,6 +85,18 @@ export const DataSpaceEditor = observer(() => {
|
|
|
65
85
|
/>
|
|
66
86
|
<PanelHeader title="General" darkMode={true}>
|
|
67
87
|
<div className="panel__header__actions">
|
|
88
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
|
89
|
+
<button
|
|
90
|
+
className="btn__dropdown-combo__label"
|
|
91
|
+
onClick={convertDataSpace}
|
|
92
|
+
title="Convert Data Product"
|
|
93
|
+
tabIndex={-1}
|
|
94
|
+
disabled={!canConvertDataSpace}
|
|
95
|
+
>
|
|
96
|
+
<EnvelopeIcon className="btn__dropdown-combo__label__icon" />
|
|
97
|
+
<div className="btn__dropdown-combo__label__title">Convert</div>
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
68
100
|
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
|
69
101
|
<button
|
|
70
102
|
className="btn__dropdown-combo__label"
|
|
@@ -14,12 +14,21 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
action,
|
|
19
|
+
computed,
|
|
20
|
+
flow,
|
|
21
|
+
flowResult,
|
|
22
|
+
makeObservable,
|
|
23
|
+
observable,
|
|
24
|
+
} from 'mobx';
|
|
18
25
|
import {
|
|
19
26
|
type EditorStore,
|
|
27
|
+
DataProductEditorState,
|
|
20
28
|
ElementEditorState,
|
|
21
29
|
} from '@finos/legend-application-studio';
|
|
22
30
|
import {
|
|
31
|
+
type DataProduct,
|
|
23
32
|
type PackageableElement,
|
|
24
33
|
Package,
|
|
25
34
|
Class,
|
|
@@ -27,6 +36,7 @@ import {
|
|
|
27
36
|
Association,
|
|
28
37
|
Service,
|
|
29
38
|
ConcreteFunctionDefinition,
|
|
39
|
+
observe_DataProduct,
|
|
30
40
|
} from '@finos/legend-graph';
|
|
31
41
|
import { Diagram } from '@finos/legend-extension-dsl-diagram/graph';
|
|
32
42
|
import {
|
|
@@ -34,8 +44,61 @@ import {
|
|
|
34
44
|
DataSpacePackageableElementExecutable,
|
|
35
45
|
type DataSpaceElement,
|
|
36
46
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
37
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
assertErrorThrown,
|
|
49
|
+
guaranteeType,
|
|
50
|
+
type GeneratorFn,
|
|
51
|
+
} from '@finos/legend-shared';
|
|
38
52
|
import { DataSpaceExecutionContextState } from './DataSpaceExecutionContextState.js';
|
|
53
|
+
import { convertDataSpaceToDataProduct } from '../stores/DataSpaceToDataProductConverter.js';
|
|
54
|
+
|
|
55
|
+
export const onConvertDataSpaceToDataProduct = flow(function* (
|
|
56
|
+
dataSpace: DataSpace,
|
|
57
|
+
editorStore: EditorStore,
|
|
58
|
+
dataSpaceEditorState: DataSpaceEditorState,
|
|
59
|
+
): GeneratorFn<void> {
|
|
60
|
+
try {
|
|
61
|
+
const dataProduct = convertDataSpaceToDataProduct(
|
|
62
|
+
dataSpace,
|
|
63
|
+
editorStore.graphManagerState,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
editorStore.graphManagerState.graph.addElement(
|
|
67
|
+
dataProduct,
|
|
68
|
+
dataSpace.package?.path.replace(/dataspace/, 'dataproduct'),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const addedElement = editorStore.graphManagerState.graph.getNullableElement(
|
|
72
|
+
dataProduct.path,
|
|
73
|
+
);
|
|
74
|
+
if (addedElement) {
|
|
75
|
+
observe_DataProduct(addedElement as DataProduct);
|
|
76
|
+
}
|
|
77
|
+
const dataProductEditorState = new DataProductEditorState(
|
|
78
|
+
editorStore,
|
|
79
|
+
addedElement as DataProduct,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
editorStore.graphManagerState.graph.deleteElement(dataSpace);
|
|
83
|
+
|
|
84
|
+
const dataSpacePackage = dataSpace.package;
|
|
85
|
+
if (dataSpacePackage && dataSpacePackage.children.length === 0) {
|
|
86
|
+
editorStore.graphManagerState.graph.deleteElement(dataSpacePackage);
|
|
87
|
+
}
|
|
88
|
+
editorStore.tabManagerState.closeTab(dataSpaceEditorState);
|
|
89
|
+
editorStore.tabManagerState.openTab(dataProductEditorState);
|
|
90
|
+
yield flowResult(editorStore.explorerTreeState.build());
|
|
91
|
+
|
|
92
|
+
editorStore.applicationStore.notificationService.notifySuccess(
|
|
93
|
+
`Successfully converted DataSpace ${dataSpace.name} to Data Product`,
|
|
94
|
+
);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
assertErrorThrown(error);
|
|
97
|
+
editorStore.applicationStore.notificationService.notifyError(
|
|
98
|
+
`Failed to convert DataSpace to Data Product: ${error.message}`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
39
102
|
|
|
40
103
|
export class DataSpaceEditorState extends ElementEditorState {
|
|
41
104
|
executionContextState: DataSpaceExecutionContextState;
|
|
@@ -0,0 +1,253 @@
|
|
|
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 DataSpace,
|
|
19
|
+
type DataSpaceExecutionContext,
|
|
20
|
+
DataSpaceSupportEmail,
|
|
21
|
+
DataSpaceSupportCombinedInfo,
|
|
22
|
+
getQueryFromDataspaceExecutable,
|
|
23
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
24
|
+
import {
|
|
25
|
+
type GraphManagerState,
|
|
26
|
+
type PackageableElementReference,
|
|
27
|
+
type Mapping,
|
|
28
|
+
DataProductRuntimeInfo,
|
|
29
|
+
ModelAccessPointGroup,
|
|
30
|
+
DataProduct,
|
|
31
|
+
FunctionAccessPoint,
|
|
32
|
+
InternalDataProductType,
|
|
33
|
+
DataProductDiagram,
|
|
34
|
+
DataProductElementScope,
|
|
35
|
+
SupportInfo,
|
|
36
|
+
DataProductLink,
|
|
37
|
+
Email,
|
|
38
|
+
observe_DataProduct,
|
|
39
|
+
observe_DataProductRuntimeInfo,
|
|
40
|
+
observe_ModelAccessPointGroup,
|
|
41
|
+
} from '@finos/legend-graph';
|
|
42
|
+
import { assertTrue, uniq, uuid } from '@finos/legend-shared';
|
|
43
|
+
|
|
44
|
+
export enum DATA_PRODUCT_SUPPORT_TYPE {
|
|
45
|
+
DOCUMENTATION = 'Documentation',
|
|
46
|
+
SUPPORT = 'Support',
|
|
47
|
+
WEBSITE = 'Website',
|
|
48
|
+
FAQ = 'FAQ',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const convertDataSpaceToDiagrams = (
|
|
52
|
+
dataSpace: DataSpace,
|
|
53
|
+
): DataProductDiagram[] => {
|
|
54
|
+
if (!dataSpace.diagrams) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
return dataSpace.diagrams.map((dataSpaceDiagram) => {
|
|
58
|
+
const dataProductDiagram = new DataProductDiagram();
|
|
59
|
+
dataProductDiagram.title = dataSpaceDiagram.title;
|
|
60
|
+
dataProductDiagram.description = dataSpaceDiagram.description;
|
|
61
|
+
dataProductDiagram.diagram = dataSpaceDiagram.diagram.value;
|
|
62
|
+
return dataProductDiagram;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const dataSpaceContainsOneMapping = (dataSpace: DataSpace): boolean => {
|
|
67
|
+
return (
|
|
68
|
+
uniq(
|
|
69
|
+
dataSpace.executionContexts.map(
|
|
70
|
+
(execContext) => execContext.mapping.value,
|
|
71
|
+
),
|
|
72
|
+
).length === 1
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const convertDataSpaceToMapping = (
|
|
77
|
+
dataSpace: DataSpace,
|
|
78
|
+
): PackageableElementReference<Mapping> => {
|
|
79
|
+
assertTrue(
|
|
80
|
+
dataSpaceContainsOneMapping(dataSpace),
|
|
81
|
+
'DataSpace contains more than one unique mapping',
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return dataSpace.defaultExecutionContext.mapping;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const convertDataSpaceToFeaturedElements = (
|
|
88
|
+
dataSpace: DataSpace,
|
|
89
|
+
): DataProductElementScope[] => {
|
|
90
|
+
if (dataSpace.elements) {
|
|
91
|
+
const featuredElements = dataSpace.elements.map((element) => {
|
|
92
|
+
const scope = new DataProductElementScope();
|
|
93
|
+
scope.element = element.element;
|
|
94
|
+
scope.exclude = element.exclude;
|
|
95
|
+
return scope;
|
|
96
|
+
});
|
|
97
|
+
return featuredElements;
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const convertDataSpaceToFunctionAccessPoints = (
|
|
103
|
+
dataSpace: DataSpace,
|
|
104
|
+
graphManagerState: GraphManagerState,
|
|
105
|
+
): FunctionAccessPoint[] => {
|
|
106
|
+
if (!dataSpace.executables) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
return dataSpace.executables.flatMap((executable) => {
|
|
110
|
+
const query = getQueryFromDataspaceExecutable(
|
|
111
|
+
executable,
|
|
112
|
+
graphManagerState,
|
|
113
|
+
);
|
|
114
|
+
if (query) {
|
|
115
|
+
const functionAccessPoint = new FunctionAccessPoint(
|
|
116
|
+
executable.id ?? uuid(),
|
|
117
|
+
query,
|
|
118
|
+
);
|
|
119
|
+
functionAccessPoint.description = executable.description;
|
|
120
|
+
return [functionAccessPoint];
|
|
121
|
+
}
|
|
122
|
+
return [];
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const convertDataSpaceToSupportInfo = (
|
|
127
|
+
dataSpace: DataSpace,
|
|
128
|
+
): SupportInfo | undefined => {
|
|
129
|
+
if (!dataSpace.supportInfo) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const supportInfo = new SupportInfo();
|
|
134
|
+
|
|
135
|
+
if (dataSpace.supportInfo.documentationUrl) {
|
|
136
|
+
supportInfo.documentation = new DataProductLink(
|
|
137
|
+
dataSpace.supportInfo.documentationUrl,
|
|
138
|
+
DATA_PRODUCT_SUPPORT_TYPE.DOCUMENTATION,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportEmail) {
|
|
143
|
+
supportInfo.emails = [
|
|
144
|
+
new Email(
|
|
145
|
+
dataSpace.supportInfo.address,
|
|
146
|
+
DATA_PRODUCT_SUPPORT_TYPE.SUPPORT,
|
|
147
|
+
),
|
|
148
|
+
];
|
|
149
|
+
} else if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
|
150
|
+
if (dataSpace.supportInfo.emails) {
|
|
151
|
+
supportInfo.emails = dataSpace.supportInfo.emails.map(
|
|
152
|
+
(email) => new Email(email, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (dataSpace.supportInfo.website) {
|
|
157
|
+
supportInfo.website = new DataProductLink(
|
|
158
|
+
dataSpace.supportInfo.website,
|
|
159
|
+
DATA_PRODUCT_SUPPORT_TYPE.WEBSITE,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (dataSpace.supportInfo.faqUrl) {
|
|
164
|
+
supportInfo.faqUrl = new DataProductLink(
|
|
165
|
+
dataSpace.supportInfo.faqUrl,
|
|
166
|
+
DATA_PRODUCT_SUPPORT_TYPE.FAQ,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (dataSpace.supportInfo.supportUrl) {
|
|
171
|
+
supportInfo.supportUrl = new DataProductLink(
|
|
172
|
+
dataSpace.supportInfo.supportUrl,
|
|
173
|
+
DATA_PRODUCT_SUPPORT_TYPE.SUPPORT,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return supportInfo;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const convertExecutionContextToRuntime = (
|
|
182
|
+
executionContext: DataSpaceExecutionContext,
|
|
183
|
+
): DataProductRuntimeInfo => {
|
|
184
|
+
const dataProductRuntime = new DataProductRuntimeInfo();
|
|
185
|
+
dataProductRuntime.id = executionContext.name;
|
|
186
|
+
dataProductRuntime.runtime = executionContext.defaultRuntime;
|
|
187
|
+
observe_DataProductRuntimeInfo(dataProductRuntime);
|
|
188
|
+
return dataProductRuntime;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const convertDataSpaceToModelAccessPointGroup = (
|
|
192
|
+
dataSpace: DataSpace,
|
|
193
|
+
graphManagerState: GraphManagerState,
|
|
194
|
+
): ModelAccessPointGroup[] => {
|
|
195
|
+
const modelAccessPointGroup = new ModelAccessPointGroup();
|
|
196
|
+
const dataSpaceDefaultExecutionContext = dataSpace.defaultExecutionContext;
|
|
197
|
+
|
|
198
|
+
modelAccessPointGroup.id = dataSpaceDefaultExecutionContext.name;
|
|
199
|
+
modelAccessPointGroup.description =
|
|
200
|
+
dataSpaceDefaultExecutionContext.description;
|
|
201
|
+
modelAccessPointGroup.accessPoints = convertDataSpaceToFunctionAccessPoints(
|
|
202
|
+
dataSpace,
|
|
203
|
+
graphManagerState,
|
|
204
|
+
);
|
|
205
|
+
modelAccessPointGroup.mapping = convertDataSpaceToMapping(dataSpace);
|
|
206
|
+
modelAccessPointGroup.defaultRuntime = convertExecutionContextToRuntime(
|
|
207
|
+
dataSpace.defaultExecutionContext,
|
|
208
|
+
);
|
|
209
|
+
modelAccessPointGroup.featuredElements =
|
|
210
|
+
convertDataSpaceToFeaturedElements(dataSpace);
|
|
211
|
+
|
|
212
|
+
const seenRuntimePaths = new Set<string>();
|
|
213
|
+
modelAccessPointGroup.compatibleRuntimes = dataSpace.executionContexts
|
|
214
|
+
.filter((executionContext) => {
|
|
215
|
+
const runtimePath = executionContext.defaultRuntime.value.path;
|
|
216
|
+
if (runtimePath && !seenRuntimePaths.has(runtimePath)) {
|
|
217
|
+
seenRuntimePaths.add(runtimePath);
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
})
|
|
222
|
+
.map((executionContext) =>
|
|
223
|
+
convertExecutionContextToRuntime(executionContext),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
modelAccessPointGroup.diagrams = convertDataSpaceToDiagrams(dataSpace);
|
|
227
|
+
const observeModelAccessPointGroup = observe_ModelAccessPointGroup(
|
|
228
|
+
modelAccessPointGroup,
|
|
229
|
+
);
|
|
230
|
+
return [observeModelAccessPointGroup];
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const convertDataSpaceToDataProduct = (
|
|
234
|
+
dataSpace: DataSpace,
|
|
235
|
+
graphManagerState: GraphManagerState,
|
|
236
|
+
): DataProduct => {
|
|
237
|
+
const name = dataSpace.name.replace(/dataspace/i, 'DataProduct');
|
|
238
|
+
const dataProduct = new DataProduct(name);
|
|
239
|
+
dataProduct.package = dataSpace.package;
|
|
240
|
+
dataProduct.stereotypes = [...dataSpace.stereotypes];
|
|
241
|
+
dataProduct.taggedValues = [...dataSpace.taggedValues];
|
|
242
|
+
|
|
243
|
+
dataProduct.title = dataSpace.title;
|
|
244
|
+
dataProduct.description = dataSpace.description;
|
|
245
|
+
dataProduct.accessPointGroups = convertDataSpaceToModelAccessPointGroup(
|
|
246
|
+
dataSpace,
|
|
247
|
+
graphManagerState,
|
|
248
|
+
);
|
|
249
|
+
dataProduct.supportInfo = convertDataSpaceToSupportInfo(dataSpace);
|
|
250
|
+
dataProduct.type = new InternalDataProductType();
|
|
251
|
+
|
|
252
|
+
return observe_DataProduct(dataProduct);
|
|
253
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"./src/stores/DataSpaceExecutionContextState.ts",
|
|
59
59
|
"./src/stores/DataSpacePreviewState.ts",
|
|
60
60
|
"./src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts",
|
|
61
|
+
"./src/stores/DataSpaceToDataProductConverter.ts",
|
|
61
62
|
"./src/stores/studio/DSL_DataSpace_GraphModifierHelper.ts",
|
|
62
63
|
"./src/components/DSL_DataProduct_ElementDriver.tsx",
|
|
63
64
|
"./src/components/DSL_DataSpace_LegendStudioApplicationPlugin.tsx",
|