@finos/legend-extension-dsl-data-space-studio 0.1.337 → 0.1.339
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/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts +0 -3
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts.map +1 -1
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js +0 -4
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js.map +1 -1
- package/lib/components/DataSpaceEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceEditor.js +4 -51
- package/lib/components/DataSpaceEditor.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js +63 -3
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/DataSpaceEditorState.d.ts +1 -3
- package/lib/stores/DataSpaceEditorState.d.ts.map +1 -1
- package/lib/stores/DataSpaceEditorState.js +4 -55
- package/lib/stores/DataSpaceEditorState.js.map +1 -1
- package/package.json +8 -8
- package/src/__lib__/DSL_DataSpace_LegendStudioDocumentation.ts +0 -4
- package/src/components/DataSpaceEditor.tsx +3 -158
- package/src/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.tsx +163 -8
- package/src/stores/DataSpaceEditorState.ts +2 -117
- package/tsconfig.json +0 -1
- package/lib/stores/DataSpaceToDataProductConverter.d.ts +0 -29
- package/lib/stores/DataSpaceToDataProductConverter.d.ts.map +0 -1
- package/lib/stores/DataSpaceToDataProductConverter.js +0 -153
- package/lib/stores/DataSpaceToDataProductConverter.js.map +0 -1
- package/src/stores/DataSpaceToDataProductConverter.ts +0 -239
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { DataSpaceSupportEmail, DataSpaceSupportCombinedInfo, DataSpacePackageableElementExecutable, DataSpaceExecutableTemplate, } from '@finos/legend-extension-dsl-data-space/graph';
|
|
17
|
-
import { DataProduct, InternalDataProductType, DataProductDiagram, DataProductElementScope, SupportInfo, DataProductLink, Email, observe_DataProduct, InLineSampleQuery, NativeModelAccess, NativeModelExecutionContext, PackageableElementSampleQuery, ObserverContext, } from '@finos/legend-graph';
|
|
18
|
-
import { guaranteeNonNullable, UnsupportedOperationError, } 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
|
-
export const DATA_PRODUCT_DEFAULT_TITLE = 'DataProduct Auto Generated title: Please update';
|
|
27
|
-
export const DATA_PRODUCT_DEFAULT_DESCRIPTION_PREFIX = 'Migrated using studio converter from dataspace: ';
|
|
28
|
-
export const DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID_PREFIX = 'DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID';
|
|
29
|
-
const convertDataSpaceToDiagrams = (dataSpace) => {
|
|
30
|
-
if (!dataSpace.diagrams) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
return dataSpace.diagrams.map((dataSpaceDiagram) => {
|
|
34
|
-
const dataProductDiagram = new DataProductDiagram();
|
|
35
|
-
dataProductDiagram.title = dataSpaceDiagram.title;
|
|
36
|
-
dataProductDiagram.description = dataSpaceDiagram.description;
|
|
37
|
-
dataProductDiagram.diagram = dataSpaceDiagram.diagram.value;
|
|
38
|
-
return dataProductDiagram;
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
const convertDataSpaceToFeaturedElements = (dataSpace) => {
|
|
42
|
-
if (dataSpace.elements) {
|
|
43
|
-
const featuredElements = dataSpace.elements.map((element) => {
|
|
44
|
-
const scope = new DataProductElementScope();
|
|
45
|
-
scope.element = element.element;
|
|
46
|
-
scope.exclude = element.exclude;
|
|
47
|
-
return scope;
|
|
48
|
-
});
|
|
49
|
-
return featuredElements;
|
|
50
|
-
}
|
|
51
|
-
return [];
|
|
52
|
-
};
|
|
53
|
-
const convertDataSpaceToSupportInfo = (dataSpace) => {
|
|
54
|
-
if (!dataSpace.supportInfo) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
const supportInfo = new SupportInfo();
|
|
58
|
-
if (dataSpace.supportInfo.documentationUrl) {
|
|
59
|
-
supportInfo.documentation = new DataProductLink(dataSpace.supportInfo.documentationUrl, DATA_PRODUCT_SUPPORT_TYPE.DOCUMENTATION);
|
|
60
|
-
}
|
|
61
|
-
if (dataSpace.supportInfo instanceof DataSpaceSupportEmail) {
|
|
62
|
-
supportInfo.emails = [
|
|
63
|
-
new Email(dataSpace.supportInfo.address, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT),
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
else if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
|
67
|
-
if (dataSpace.supportInfo.emails) {
|
|
68
|
-
supportInfo.emails = dataSpace.supportInfo.emails.map((email) => new Email(email, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT));
|
|
69
|
-
}
|
|
70
|
-
if (dataSpace.supportInfo.website) {
|
|
71
|
-
supportInfo.website = new DataProductLink(dataSpace.supportInfo.website, DATA_PRODUCT_SUPPORT_TYPE.WEBSITE);
|
|
72
|
-
}
|
|
73
|
-
if (dataSpace.supportInfo.faqUrl) {
|
|
74
|
-
supportInfo.faqUrl = new DataProductLink(dataSpace.supportInfo.faqUrl, DATA_PRODUCT_SUPPORT_TYPE.FAQ);
|
|
75
|
-
}
|
|
76
|
-
if (dataSpace.supportInfo.supportUrl) {
|
|
77
|
-
supportInfo.supportUrl = new DataProductLink(dataSpace.supportInfo.supportUrl, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return supportInfo;
|
|
81
|
-
};
|
|
82
|
-
const convertDataSpaceExecutablesToSampleQueries = (dataSpace) => {
|
|
83
|
-
if (!dataSpace.executables) {
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
let idCounter = 0;
|
|
87
|
-
return dataSpace.executables.map((executable) => {
|
|
88
|
-
let sampleQuery;
|
|
89
|
-
if (executable instanceof DataSpacePackageableElementExecutable) {
|
|
90
|
-
const packageableElementSampleQuery = new PackageableElementSampleQuery();
|
|
91
|
-
packageableElementSampleQuery.query = executable.executable;
|
|
92
|
-
sampleQuery = packageableElementSampleQuery;
|
|
93
|
-
}
|
|
94
|
-
else if (executable instanceof DataSpaceExecutableTemplate) {
|
|
95
|
-
const inLineSampleQuery = new InLineSampleQuery();
|
|
96
|
-
inLineSampleQuery.query = executable.query;
|
|
97
|
-
sampleQuery = inLineSampleQuery;
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
throw new UnsupportedOperationError(`Can't convert to DataProduct nativeModelAccess sample query: Unsupported DataSpace executable`);
|
|
101
|
-
}
|
|
102
|
-
sampleQuery.description = executable.description;
|
|
103
|
-
sampleQuery.executionContextKey =
|
|
104
|
-
executable.executionContextKey ?? dataSpace.defaultExecutionContext.name;
|
|
105
|
-
sampleQuery.title = executable.title;
|
|
106
|
-
if (executable.id) {
|
|
107
|
-
sampleQuery.id = executable.id;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
sampleQuery.id = `${DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID_PREFIX}_${idCounter}`;
|
|
111
|
-
idCounter++;
|
|
112
|
-
}
|
|
113
|
-
return sampleQuery;
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
const convertDataSpaceExecutionContextsToNativeModelExecutionContexts = (dataSpace, owner) => {
|
|
117
|
-
return dataSpace.executionContexts.map((context) => {
|
|
118
|
-
const nativeModelExecutionContext = new NativeModelExecutionContext();
|
|
119
|
-
nativeModelExecutionContext.key = context.name;
|
|
120
|
-
nativeModelExecutionContext.mapping = context.mapping;
|
|
121
|
-
nativeModelExecutionContext.runtime = context.defaultRuntime;
|
|
122
|
-
nativeModelExecutionContext.__owner = owner;
|
|
123
|
-
return nativeModelExecutionContext;
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
export const convertDataSpaceToNativeModelAccess = (dataSpace) => {
|
|
127
|
-
const nativeModelAccess = new NativeModelAccess();
|
|
128
|
-
nativeModelAccess.featuredElements =
|
|
129
|
-
convertDataSpaceToFeaturedElements(dataSpace);
|
|
130
|
-
nativeModelAccess.diagrams = convertDataSpaceToDiagrams(dataSpace);
|
|
131
|
-
nativeModelAccess.nativeModelExecutionContexts =
|
|
132
|
-
convertDataSpaceExecutionContextsToNativeModelExecutionContexts(dataSpace, nativeModelAccess);
|
|
133
|
-
nativeModelAccess.defaultExecutionContext = guaranteeNonNullable(nativeModelAccess.nativeModelExecutionContexts.find((e) => e.key === dataSpace.defaultExecutionContext.name), `Unable to resolve default execution context '${dataSpace.defaultExecutionContext.name}' from nativeModelExecutionContexts`);
|
|
134
|
-
nativeModelAccess.sampleQueries =
|
|
135
|
-
convertDataSpaceExecutablesToSampleQueries(dataSpace);
|
|
136
|
-
return nativeModelAccess;
|
|
137
|
-
};
|
|
138
|
-
export const convertDataSpaceToDataProduct = (dataSpace, observerContext = new ObserverContext([])) => {
|
|
139
|
-
const name = dataSpace.name.replace(/dataspace/i, 'DataProduct');
|
|
140
|
-
const dataProduct = new DataProduct(name);
|
|
141
|
-
dataProduct.stereotypes = [...dataSpace.stereotypes];
|
|
142
|
-
dataProduct.taggedValues = [...dataSpace.taggedValues];
|
|
143
|
-
dataProduct.title = dataSpace.title ?? DATA_PRODUCT_DEFAULT_TITLE;
|
|
144
|
-
dataProduct.description =
|
|
145
|
-
dataSpace.description ??
|
|
146
|
-
`${DATA_PRODUCT_DEFAULT_DESCRIPTION_PREFIX}${dataSpace.path}`;
|
|
147
|
-
dataProduct.nativeModelAccess =
|
|
148
|
-
convertDataSpaceToNativeModelAccess(dataSpace);
|
|
149
|
-
dataProduct.supportInfo = convertDataSpaceToSupportInfo(dataSpace);
|
|
150
|
-
dataProduct.type = new InternalDataProductType();
|
|
151
|
-
return observe_DataProduct(dataProduct, observerContext);
|
|
152
|
-
};
|
|
153
|
-
//# sourceMappingURL=DataSpaceToDataProductConverter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceToDataProductConverter.js","sourceRoot":"","sources":["../../src/stores/DataSpaceToDataProductConverter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,qBAAqB,EACrB,4BAA4B,EAC5B,qCAAqC,EACrC,2BAA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SAAS,CAAC,CAAC;IACjD,WAAW,CAAC,WAAW,GAAG,6BAA6B,CAAC,SAAS,CAAC,CAAC;IACnE,WAAW,CAAC,IAAI,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAEjD,OAAO,mBAAmB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|
|
@@ -1,239 +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 {
|
|
18
|
-
type DataSpace,
|
|
19
|
-
DataSpaceSupportEmail,
|
|
20
|
-
DataSpaceSupportCombinedInfo,
|
|
21
|
-
DataSpacePackageableElementExecutable,
|
|
22
|
-
DataSpaceExecutableTemplate,
|
|
23
|
-
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
24
|
-
import {
|
|
25
|
-
DataProduct,
|
|
26
|
-
InternalDataProductType,
|
|
27
|
-
DataProductDiagram,
|
|
28
|
-
DataProductElementScope,
|
|
29
|
-
SupportInfo,
|
|
30
|
-
DataProductLink,
|
|
31
|
-
Email,
|
|
32
|
-
observe_DataProduct,
|
|
33
|
-
type SampleQuery,
|
|
34
|
-
InLineSampleQuery,
|
|
35
|
-
NativeModelAccess,
|
|
36
|
-
NativeModelExecutionContext,
|
|
37
|
-
PackageableElementSampleQuery,
|
|
38
|
-
ObserverContext,
|
|
39
|
-
} from '@finos/legend-graph';
|
|
40
|
-
import {
|
|
41
|
-
guaranteeNonNullable,
|
|
42
|
-
UnsupportedOperationError,
|
|
43
|
-
} from '@finos/legend-shared';
|
|
44
|
-
|
|
45
|
-
export enum DATA_PRODUCT_SUPPORT_TYPE {
|
|
46
|
-
DOCUMENTATION = 'Documentation',
|
|
47
|
-
SUPPORT = 'Support',
|
|
48
|
-
WEBSITE = 'Website',
|
|
49
|
-
FAQ = 'FAQ',
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const DATA_PRODUCT_DEFAULT_TITLE =
|
|
53
|
-
'DataProduct Auto Generated title: Please update';
|
|
54
|
-
export const DATA_PRODUCT_DEFAULT_DESCRIPTION_PREFIX =
|
|
55
|
-
'Migrated using studio converter from dataspace: ';
|
|
56
|
-
export const DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID_PREFIX =
|
|
57
|
-
'DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID';
|
|
58
|
-
|
|
59
|
-
const convertDataSpaceToDiagrams = (
|
|
60
|
-
dataSpace: DataSpace,
|
|
61
|
-
): DataProductDiagram[] => {
|
|
62
|
-
if (!dataSpace.diagrams) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
return dataSpace.diagrams.map((dataSpaceDiagram) => {
|
|
66
|
-
const dataProductDiagram = new DataProductDiagram();
|
|
67
|
-
dataProductDiagram.title = dataSpaceDiagram.title;
|
|
68
|
-
dataProductDiagram.description = dataSpaceDiagram.description;
|
|
69
|
-
dataProductDiagram.diagram = dataSpaceDiagram.diagram.value;
|
|
70
|
-
return dataProductDiagram;
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const convertDataSpaceToFeaturedElements = (
|
|
75
|
-
dataSpace: DataSpace,
|
|
76
|
-
): DataProductElementScope[] => {
|
|
77
|
-
if (dataSpace.elements) {
|
|
78
|
-
const featuredElements = dataSpace.elements.map((element) => {
|
|
79
|
-
const scope = new DataProductElementScope();
|
|
80
|
-
scope.element = element.element;
|
|
81
|
-
scope.exclude = element.exclude;
|
|
82
|
-
return scope;
|
|
83
|
-
});
|
|
84
|
-
return featuredElements;
|
|
85
|
-
}
|
|
86
|
-
return [];
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const convertDataSpaceToSupportInfo = (
|
|
90
|
-
dataSpace: DataSpace,
|
|
91
|
-
): SupportInfo | undefined => {
|
|
92
|
-
if (!dataSpace.supportInfo) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const supportInfo = new SupportInfo();
|
|
97
|
-
|
|
98
|
-
if (dataSpace.supportInfo.documentationUrl) {
|
|
99
|
-
supportInfo.documentation = new DataProductLink(
|
|
100
|
-
dataSpace.supportInfo.documentationUrl,
|
|
101
|
-
DATA_PRODUCT_SUPPORT_TYPE.DOCUMENTATION,
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (dataSpace.supportInfo instanceof DataSpaceSupportEmail) {
|
|
106
|
-
supportInfo.emails = [
|
|
107
|
-
new Email(
|
|
108
|
-
dataSpace.supportInfo.address,
|
|
109
|
-
DATA_PRODUCT_SUPPORT_TYPE.SUPPORT,
|
|
110
|
-
),
|
|
111
|
-
];
|
|
112
|
-
} else if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
|
113
|
-
if (dataSpace.supportInfo.emails) {
|
|
114
|
-
supportInfo.emails = dataSpace.supportInfo.emails.map(
|
|
115
|
-
(email) => new Email(email, DATA_PRODUCT_SUPPORT_TYPE.SUPPORT),
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (dataSpace.supportInfo.website) {
|
|
120
|
-
supportInfo.website = new DataProductLink(
|
|
121
|
-
dataSpace.supportInfo.website,
|
|
122
|
-
DATA_PRODUCT_SUPPORT_TYPE.WEBSITE,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (dataSpace.supportInfo.faqUrl) {
|
|
127
|
-
supportInfo.faqUrl = new DataProductLink(
|
|
128
|
-
dataSpace.supportInfo.faqUrl,
|
|
129
|
-
DATA_PRODUCT_SUPPORT_TYPE.FAQ,
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (dataSpace.supportInfo.supportUrl) {
|
|
134
|
-
supportInfo.supportUrl = new DataProductLink(
|
|
135
|
-
dataSpace.supportInfo.supportUrl,
|
|
136
|
-
DATA_PRODUCT_SUPPORT_TYPE.SUPPORT,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return supportInfo;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const convertDataSpaceExecutablesToSampleQueries = (
|
|
145
|
-
dataSpace: DataSpace,
|
|
146
|
-
): SampleQuery[] => {
|
|
147
|
-
if (!dataSpace.executables) {
|
|
148
|
-
return [];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
let idCounter = 0;
|
|
152
|
-
|
|
153
|
-
return dataSpace.executables.map((executable) => {
|
|
154
|
-
let sampleQuery: SampleQuery;
|
|
155
|
-
if (executable instanceof DataSpacePackageableElementExecutable) {
|
|
156
|
-
const packageableElementSampleQuery = new PackageableElementSampleQuery();
|
|
157
|
-
packageableElementSampleQuery.query = executable.executable;
|
|
158
|
-
sampleQuery = packageableElementSampleQuery;
|
|
159
|
-
} else if (executable instanceof DataSpaceExecutableTemplate) {
|
|
160
|
-
const inLineSampleQuery = new InLineSampleQuery();
|
|
161
|
-
inLineSampleQuery.query = executable.query;
|
|
162
|
-
sampleQuery = inLineSampleQuery;
|
|
163
|
-
} else {
|
|
164
|
-
throw new UnsupportedOperationError(
|
|
165
|
-
`Can't convert to DataProduct nativeModelAccess sample query: Unsupported DataSpace executable`,
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
sampleQuery.description = executable.description;
|
|
169
|
-
sampleQuery.executionContextKey =
|
|
170
|
-
executable.executionContextKey ?? dataSpace.defaultExecutionContext.name;
|
|
171
|
-
sampleQuery.title = executable.title;
|
|
172
|
-
if (executable.id) {
|
|
173
|
-
sampleQuery.id = executable.id;
|
|
174
|
-
} else {
|
|
175
|
-
sampleQuery.id = `${DATA_PRODUCT_NATIVE_MODEL_ACCESS_SAMPLE_QUERY_ID_PREFIX}_${idCounter}`;
|
|
176
|
-
idCounter++;
|
|
177
|
-
}
|
|
178
|
-
return sampleQuery;
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const convertDataSpaceExecutionContextsToNativeModelExecutionContexts = (
|
|
183
|
-
dataSpace: DataSpace,
|
|
184
|
-
owner: NativeModelAccess,
|
|
185
|
-
): NativeModelExecutionContext[] => {
|
|
186
|
-
return dataSpace.executionContexts.map((context) => {
|
|
187
|
-
const nativeModelExecutionContext = new NativeModelExecutionContext();
|
|
188
|
-
nativeModelExecutionContext.key = context.name;
|
|
189
|
-
nativeModelExecutionContext.mapping = context.mapping;
|
|
190
|
-
nativeModelExecutionContext.runtime = context.defaultRuntime;
|
|
191
|
-
nativeModelExecutionContext.__owner = owner;
|
|
192
|
-
return nativeModelExecutionContext;
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const convertDataSpaceToNativeModelAccess = (
|
|
197
|
-
dataSpace: DataSpace,
|
|
198
|
-
): NativeModelAccess => {
|
|
199
|
-
const nativeModelAccess = new NativeModelAccess();
|
|
200
|
-
|
|
201
|
-
nativeModelAccess.featuredElements =
|
|
202
|
-
convertDataSpaceToFeaturedElements(dataSpace);
|
|
203
|
-
nativeModelAccess.diagrams = convertDataSpaceToDiagrams(dataSpace);
|
|
204
|
-
nativeModelAccess.nativeModelExecutionContexts =
|
|
205
|
-
convertDataSpaceExecutionContextsToNativeModelExecutionContexts(
|
|
206
|
-
dataSpace,
|
|
207
|
-
nativeModelAccess,
|
|
208
|
-
);
|
|
209
|
-
nativeModelAccess.defaultExecutionContext = guaranteeNonNullable(
|
|
210
|
-
nativeModelAccess.nativeModelExecutionContexts.find(
|
|
211
|
-
(e) => e.key === dataSpace.defaultExecutionContext.name,
|
|
212
|
-
),
|
|
213
|
-
`Unable to resolve default execution context '${dataSpace.defaultExecutionContext.name}' from nativeModelExecutionContexts`,
|
|
214
|
-
);
|
|
215
|
-
nativeModelAccess.sampleQueries =
|
|
216
|
-
convertDataSpaceExecutablesToSampleQueries(dataSpace);
|
|
217
|
-
return nativeModelAccess;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export const convertDataSpaceToDataProduct = (
|
|
221
|
-
dataSpace: DataSpace,
|
|
222
|
-
observerContext: ObserverContext = new ObserverContext([]),
|
|
223
|
-
): DataProduct => {
|
|
224
|
-
const name = dataSpace.name.replace(/dataspace/i, 'DataProduct');
|
|
225
|
-
const dataProduct = new DataProduct(name);
|
|
226
|
-
dataProduct.stereotypes = [...dataSpace.stereotypes];
|
|
227
|
-
dataProduct.taggedValues = [...dataSpace.taggedValues];
|
|
228
|
-
|
|
229
|
-
dataProduct.title = dataSpace.title ?? DATA_PRODUCT_DEFAULT_TITLE;
|
|
230
|
-
dataProduct.description =
|
|
231
|
-
dataSpace.description ??
|
|
232
|
-
`${DATA_PRODUCT_DEFAULT_DESCRIPTION_PREFIX}${dataSpace.path}`;
|
|
233
|
-
dataProduct.nativeModelAccess =
|
|
234
|
-
convertDataSpaceToNativeModelAccess(dataSpace);
|
|
235
|
-
dataProduct.supportInfo = convertDataSpaceToSupportInfo(dataSpace);
|
|
236
|
-
dataProduct.type = new InternalDataProductType();
|
|
237
|
-
|
|
238
|
-
return observe_DataProduct(dataProduct, observerContext);
|
|
239
|
-
};
|