@finos/legend-extension-dsl-data-space 9.2.3 → 9.2.5
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/DSL_DataSpace_LegendApplicationPlugin.d.ts +2 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +8 -0
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
- package/lib/components/DataSpaceDataAccess.js +70 -66
- package/lib/components/DataSpaceDataAccess.js.map +1 -1
- package/lib/components/DataSpaceDiagramViewer.js +1 -1
- package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.js +337 -34
- package/lib/components/DataSpaceModelsDocumentation.js.map +1 -1
- package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
- package/lib/components/DataSpaceQuickStart.js +33 -12
- package/lib/components/DataSpaceQuickStart.js.map +1 -1
- package/lib/components/DataSpaceViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceViewer.js +1 -1
- package/lib/components/DataSpaceViewer.js.map +1 -1
- package/lib/components/DataSpaceWiki.d.ts.map +1 -1
- package/lib/components/DataSpaceWiki.js +0 -1
- package/lib/components/DataSpaceWiki.js.map +1 -1
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts +45 -9
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.js +55 -12
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.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 +51 -8
- 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 +15 -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 +16 -2
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +7 -10
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts +93 -0
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts.map +1 -0
- package/lib/stores/DataSpaceModelsDocumentationState.js +396 -0
- package/lib/stores/DataSpaceModelsDocumentationState.js.map +1 -0
- package/lib/stores/DataSpaceViewerState.d.ts +5 -0
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
- package/lib/stores/DataSpaceViewerState.js +6 -1
- package/lib/stores/DataSpaceViewerState.js.map +1 -1
- package/package.json +18 -21
- package/src/components/DSL_DataSpace_LegendApplicationPlugin.ts +10 -0
- package/src/components/DataSpaceDataAccess.tsx +101 -96
- package/src/components/DataSpaceDiagramViewer.tsx +1 -1
- package/src/components/DataSpaceModelsDocumentation.tsx +1043 -46
- package/src/components/DataSpaceQuickStart.tsx +69 -15
- package/src/components/DataSpaceViewer.tsx +2 -4
- package/src/components/DataSpaceWiki.tsx +0 -2
- package/src/graphManager/action/analytics/DataSpaceAnalysis.ts +71 -19
- package/src/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +97 -29
- package/src/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +22 -3
- package/src/stores/DataSpaceModelsDocumentationState.ts +588 -0
- package/src/stores/DataSpaceViewerState.ts +14 -0
- package/tsconfig.json +1 -1
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.d.ts +0 -57
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.d.ts.map +0 -1
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.js +0 -209
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.js.map +0 -1
- package/src/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.ts +0 -313
|
@@ -19,27 +19,30 @@ import {
|
|
|
19
19
|
AnchorLinkIcon,
|
|
20
20
|
CodeIcon,
|
|
21
21
|
CopyIcon,
|
|
22
|
+
LegendLogo,
|
|
22
23
|
MoreVerticalIcon,
|
|
23
|
-
QueryIcon,
|
|
24
24
|
QuestionCircleIcon,
|
|
25
25
|
clsx,
|
|
26
26
|
} from '@finos/legend-art';
|
|
27
27
|
import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
|
|
28
|
-
import { AgGridReact } from '@ag-grid-community/react';
|
|
29
|
-
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
30
28
|
import {
|
|
31
|
-
|
|
32
|
-
TextInputEditor,
|
|
29
|
+
CODE_EDITOR_LANGUAGE,
|
|
33
30
|
useApplicationStore,
|
|
34
31
|
} from '@finos/legend-application';
|
|
35
32
|
import {
|
|
36
33
|
DataSpaceExecutableTDSResult,
|
|
37
34
|
type DataSpaceExecutableAnalysisResult,
|
|
35
|
+
type DataSpaceExecutableTDSResultColumn,
|
|
38
36
|
} from '../graphManager/action/analytics/DataSpaceAnalysis.js';
|
|
39
37
|
import { DataSpaceMarkdownTextViewer } from './DataSpaceMarkdownTextViewer.js';
|
|
40
38
|
import type { DSL_DataSpace_LegendApplicationPlugin_Extension } from '../stores/DSL_DataSpace_LegendApplicationPlugin_Extension.js';
|
|
41
39
|
import { useState } from 'react';
|
|
42
40
|
import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js';
|
|
41
|
+
import {
|
|
42
|
+
DataGrid,
|
|
43
|
+
type DataGridCellRendererParams,
|
|
44
|
+
} from '@finos/legend-lego/data-grid';
|
|
45
|
+
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
|
43
46
|
|
|
44
47
|
enum TDS_EXECUTABLE_ACTION_TAB {
|
|
45
48
|
COLUMN_SPECS = 'COLUMN_SPECS',
|
|
@@ -47,6 +50,40 @@ enum TDS_EXECUTABLE_ACTION_TAB {
|
|
|
47
50
|
QUERY_TEXT = 'QUERY_TEXT',
|
|
48
51
|
}
|
|
49
52
|
|
|
53
|
+
const MIN_NUMBER_OF_ROWS_FOR_AUTO_HEIGHT = 15;
|
|
54
|
+
|
|
55
|
+
const TDSColumnDocumentationCellRenderer = (
|
|
56
|
+
params: DataGridCellRendererParams<DataSpaceExecutableTDSResultColumn>,
|
|
57
|
+
): React.ReactNode => {
|
|
58
|
+
const data = params.data;
|
|
59
|
+
if (!data) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return data.documentation?.trim() ? (
|
|
63
|
+
data.documentation
|
|
64
|
+
) : (
|
|
65
|
+
<div className="data-space__viewer__grid__empty-cell">
|
|
66
|
+
No documentation provided
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const TDSColumnSampleValuesCellRenderer = (
|
|
72
|
+
params: DataGridCellRendererParams<DataSpaceExecutableTDSResultColumn>,
|
|
73
|
+
): React.ReactNode => {
|
|
74
|
+
const data = params.data;
|
|
75
|
+
if (!data) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return data.sampleValues?.trim() ? (
|
|
79
|
+
data.sampleValues
|
|
80
|
+
) : (
|
|
81
|
+
<div className="data-space__viewer__grid__empty-cell">
|
|
82
|
+
No sample values provided
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
50
87
|
const DataSpaceExecutableTDSResultView = observer(
|
|
51
88
|
(props: {
|
|
52
89
|
dataSpaceViewerState: DataSpaceViewerState;
|
|
@@ -61,6 +98,8 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
61
98
|
const queryText = executableAnalysisResult.info?.query;
|
|
62
99
|
|
|
63
100
|
const columnSpecifications = tdsResult.columns;
|
|
101
|
+
const autoHeight =
|
|
102
|
+
tdsResult.columns.length <= MIN_NUMBER_OF_ROWS_FOR_AUTO_HEIGHT;
|
|
64
103
|
const extractTDSExecutableActionConfigurations =
|
|
65
104
|
applicationStore.pluginManager
|
|
66
105
|
.getApplicationPlugins()
|
|
@@ -127,7 +166,7 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
127
166
|
onClick={() => setSelectedTab(TDS_EXECUTABLE_ACTION_TAB.QUERY)}
|
|
128
167
|
>
|
|
129
168
|
<div className="data-space__viewer__quickstart__item__content__tab__icon">
|
|
130
|
-
<
|
|
169
|
+
<LegendLogo className="data-space__viewer__quickstart__item__content__tab__icon--query" />
|
|
131
170
|
</div>
|
|
132
171
|
<div className="data-space__viewer__quickstart__item__content__tab__label">
|
|
133
172
|
Query
|
|
@@ -177,16 +216,24 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
177
216
|
</button>
|
|
178
217
|
)}
|
|
179
218
|
</div>
|
|
180
|
-
<div
|
|
219
|
+
<div
|
|
220
|
+
className={clsx(
|
|
221
|
+
'data-space__viewer__quickstart__item__content__tab__content',
|
|
222
|
+
{
|
|
223
|
+
'data-space__viewer__quickstart__item__content__tab__content':
|
|
224
|
+
autoHeight,
|
|
225
|
+
},
|
|
226
|
+
)}
|
|
227
|
+
>
|
|
181
228
|
{selectedTab === TDS_EXECUTABLE_ACTION_TAB.COLUMN_SPECS && (
|
|
182
229
|
<div className="data-space__viewer__quickstart__tds__column-specs data-space__viewer__grid ag-theme-balham-dark">
|
|
183
|
-
<
|
|
230
|
+
<DataGrid
|
|
231
|
+
domLayout={autoHeight ? 'autoHeight' : 'normal'}
|
|
184
232
|
rowData={columnSpecifications}
|
|
185
233
|
gridOptions={{
|
|
186
234
|
suppressScrollOnNewData: true,
|
|
187
235
|
getRowId: (rowData) => rowData.data.uuid,
|
|
188
236
|
}}
|
|
189
|
-
modules={[ClientSideRowModelModule]}
|
|
190
237
|
suppressFieldDotNotation={true}
|
|
191
238
|
columnDefs={[
|
|
192
239
|
{
|
|
@@ -194,14 +241,19 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
194
241
|
sortable: true,
|
|
195
242
|
resizable: true,
|
|
196
243
|
field: 'name',
|
|
197
|
-
|
|
244
|
+
headerValueGetter: () =>
|
|
245
|
+
`Column ${
|
|
246
|
+
columnSpecifications.length
|
|
247
|
+
? ` (${columnSpecifications.length})`
|
|
248
|
+
: ''
|
|
249
|
+
}`,
|
|
198
250
|
flex: 1,
|
|
199
251
|
},
|
|
200
252
|
{
|
|
201
253
|
minWidth: 50,
|
|
202
254
|
sortable: false,
|
|
203
255
|
resizable: true,
|
|
204
|
-
|
|
256
|
+
cellRenderer: TDSColumnDocumentationCellRenderer,
|
|
205
257
|
headerName: 'Documentation',
|
|
206
258
|
flex: 1,
|
|
207
259
|
wrapText: true,
|
|
@@ -210,8 +262,10 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
210
262
|
{
|
|
211
263
|
minWidth: 50,
|
|
212
264
|
sortable: false,
|
|
213
|
-
resizable:
|
|
214
|
-
|
|
265
|
+
resizable: false,
|
|
266
|
+
headerClass:
|
|
267
|
+
'data-space__viewer__grid__last-column-header',
|
|
268
|
+
cellRenderer: TDSColumnSampleValuesCellRenderer,
|
|
215
269
|
headerName: 'Sample Values',
|
|
216
270
|
flex: 1,
|
|
217
271
|
},
|
|
@@ -245,10 +299,10 @@ const DataSpaceExecutableTDSResultView = observer(
|
|
|
245
299
|
queryText !== undefined && (
|
|
246
300
|
<div className="data-space__viewer__quickstart__tds__query-text">
|
|
247
301
|
<div className="data-space__viewer__quickstart__tds__query-text__content">
|
|
248
|
-
<
|
|
302
|
+
<CodeEditor
|
|
249
303
|
inputValue={queryText}
|
|
250
304
|
isReadOnly={true}
|
|
251
|
-
language={
|
|
305
|
+
language={CODE_EDITOR_LANGUAGE.PURE}
|
|
252
306
|
showMiniMap={false}
|
|
253
307
|
hideGutter={true}
|
|
254
308
|
/>
|
|
@@ -49,12 +49,10 @@ const DataSpaceHeader = observer(
|
|
|
49
49
|
>
|
|
50
50
|
<div
|
|
51
51
|
className="data-space__viewer__header__title"
|
|
52
|
-
title={`${analysisResult.
|
|
53
|
-
analysisResult.path
|
|
54
|
-
}`}
|
|
52
|
+
title={`${analysisResult.displayName} - ${analysisResult.path}`}
|
|
55
53
|
>
|
|
56
54
|
<div className="data-space__viewer__header__title__label">
|
|
57
|
-
{analysisResult.
|
|
55
|
+
{analysisResult.displayName}
|
|
58
56
|
</div>
|
|
59
57
|
{dataSpaceViewerState.isVerified && (
|
|
60
58
|
<VerifiedIcon
|
|
@@ -26,8 +26,6 @@ export const DataSpaceWiki = observer(
|
|
|
26
26
|
(props: { dataSpaceViewerState: DataSpaceViewerState }) => {
|
|
27
27
|
const { dataSpaceViewerState } = props;
|
|
28
28
|
|
|
29
|
-
// const a = new IntersectionObserver(() => {});
|
|
30
|
-
|
|
31
29
|
return (
|
|
32
30
|
<div className="data-space__viewer__wiki">
|
|
33
31
|
<DataSpaceDescription dataSpaceViewerState={dataSpaceViewerState} />
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
import {
|
|
18
|
+
type Multiplicity,
|
|
19
|
+
type Mapping,
|
|
20
|
+
type PackageableRuntime,
|
|
21
|
+
type PureModel,
|
|
21
22
|
} from '@finos/legend-graph';
|
|
22
|
-
import { uuid } from '@finos/legend-shared';
|
|
23
|
+
import { prettyCONSTName, uuid } from '@finos/legend-shared';
|
|
23
24
|
import type { DataSpaceSupportInfo } from '../../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
|
24
25
|
import type { Diagram } from '@finos/legend-extension-dsl-diagram';
|
|
25
26
|
|
|
@@ -47,27 +48,74 @@ export class DataSpaceStereotypeInfo {
|
|
|
47
48
|
value!: string;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export class
|
|
51
|
+
export class NormalizedDataSpaceDocumentationEntry {
|
|
51
52
|
readonly uuid = uuid();
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
53
|
+
readonly text: string;
|
|
54
|
+
readonly documentation: string;
|
|
55
|
+
readonly elementEntry: DataSpaceModelDocumentationEntry;
|
|
56
|
+
readonly entry: DataSpaceBasicDocumentationEntry;
|
|
56
57
|
|
|
57
58
|
constructor(
|
|
58
|
-
|
|
59
|
-
subElementText: string | undefined,
|
|
59
|
+
text: string,
|
|
60
60
|
documentation: string,
|
|
61
|
-
|
|
61
|
+
elementEntry: DataSpaceModelDocumentationEntry,
|
|
62
|
+
entry: DataSpaceBasicDocumentationEntry,
|
|
62
63
|
) {
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
64
|
+
this.text = text;
|
|
65
|
+
this.documentation = documentation;
|
|
66
|
+
this.elementEntry = elementEntry;
|
|
67
|
+
this.entry = entry;
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
get humanizedText(): string {
|
|
71
|
+
return prettyCONSTName(this.text);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class DataSpaceBasicDocumentationEntry {
|
|
76
|
+
name!: string;
|
|
77
|
+
docs: string[] = [];
|
|
78
|
+
|
|
79
|
+
get humanizedName(): string {
|
|
80
|
+
return prettyCONSTName(this.name);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export class DataSpacePropertyDocumentationEntry extends DataSpaceBasicDocumentationEntry {
|
|
85
|
+
milestoning?: string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Make this optional for backward compatibility
|
|
88
|
+
*
|
|
89
|
+
* @backwardCompatibility
|
|
90
|
+
*/
|
|
91
|
+
type?: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Make this optional for backward compatibility
|
|
94
|
+
*
|
|
95
|
+
* @backwardCompatibility
|
|
96
|
+
*/
|
|
97
|
+
multiplicity?: Multiplicity | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export class DataSpaceModelDocumentationEntry extends DataSpaceBasicDocumentationEntry {
|
|
101
|
+
path!: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class DataSpaceClassDocumentationEntry extends DataSpaceModelDocumentationEntry {
|
|
105
|
+
properties: DataSpacePropertyDocumentationEntry[] = [];
|
|
106
|
+
milestoning?: string | undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class DataSpaceEnumerationDocumentationEntry extends DataSpaceModelDocumentationEntry {
|
|
110
|
+
enumValues: DataSpaceBasicDocumentationEntry[] = [];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export class DataSpaceAssociationDocumentationEntry extends DataSpaceModelDocumentationEntry {
|
|
114
|
+
properties: DataSpacePropertyDocumentationEntry[] = [];
|
|
68
115
|
}
|
|
69
116
|
|
|
70
117
|
export class DataSpaceDiagramAnalysisResult {
|
|
118
|
+
readonly uuid = uuid();
|
|
71
119
|
title!: string;
|
|
72
120
|
description?: string | undefined;
|
|
73
121
|
diagram!: Diagram;
|
|
@@ -95,7 +143,7 @@ export class DataSpaceExecutableTDSResultColumn {
|
|
|
95
143
|
|
|
96
144
|
// TODO: we need to think of how we want to support sample values, should we rely on the type here
|
|
97
145
|
// or should we rely on actual execution result on test data?
|
|
98
|
-
sampleValues
|
|
146
|
+
sampleValues?: string | undefined;
|
|
99
147
|
}
|
|
100
148
|
|
|
101
149
|
export class DataSpaceExecutableTDSResult extends DataSpaceExecutableResult {
|
|
@@ -128,11 +176,15 @@ export class DataSpaceAnalysisResult {
|
|
|
128
176
|
executionContextsIndex!: Map<string, DataSpaceExecutionContextAnalysisResult>;
|
|
129
177
|
defaultExecutionContext!: DataSpaceExecutionContextAnalysisResult;
|
|
130
178
|
|
|
131
|
-
elementDocs:
|
|
179
|
+
elementDocs: NormalizedDataSpaceDocumentationEntry[] = [];
|
|
132
180
|
|
|
133
181
|
diagrams: DataSpaceDiagramAnalysisResult[] = [];
|
|
134
182
|
|
|
135
183
|
executables: DataSpaceExecutableAnalysisResult[] = [];
|
|
136
184
|
|
|
137
185
|
supportInfo?: DataSpaceSupportInfo | undefined;
|
|
186
|
+
|
|
187
|
+
get displayName(): string {
|
|
188
|
+
return this.title ?? prettyCONSTName(this.name);
|
|
189
|
+
}
|
|
138
190
|
}
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
import {
|
|
53
53
|
DataSpaceAnalysisResult,
|
|
54
54
|
DataSpaceDiagramAnalysisResult,
|
|
55
|
-
|
|
55
|
+
NormalizedDataSpaceDocumentationEntry,
|
|
56
56
|
DataSpaceExecutableAnalysisResult,
|
|
57
57
|
DataSpaceExecutableTDSResultColumn,
|
|
58
58
|
DataSpaceExecutableTDSResult,
|
|
@@ -60,6 +60,11 @@ import {
|
|
|
60
60
|
DataSpaceServiceExecutableInfo,
|
|
61
61
|
DataSpaceStereotypeInfo,
|
|
62
62
|
DataSpaceTaggedValueInfo,
|
|
63
|
+
DataSpaceClassDocumentationEntry,
|
|
64
|
+
DataSpacePropertyDocumentationEntry,
|
|
65
|
+
DataSpaceEnumerationDocumentationEntry,
|
|
66
|
+
DataSpaceBasicDocumentationEntry,
|
|
67
|
+
DataSpaceAssociationDocumentationEntry,
|
|
63
68
|
} from '../../../action/analytics/DataSpaceAnalysis.js';
|
|
64
69
|
import { DSL_DataSpace_PureGraphManagerExtension } from '../DSL_DataSpace_PureGraphManagerExtension.js';
|
|
65
70
|
import {
|
|
@@ -73,6 +78,7 @@ import {
|
|
|
73
78
|
import { getDiagram } from '@finos/legend-extension-dsl-diagram';
|
|
74
79
|
|
|
75
80
|
const ANALYZE_DATA_SPACE_TRACE = 'analyze data space';
|
|
81
|
+
const TEMPORARY__TDS_SAMPLE_VALUES__DELIMETER = '-- e.g.';
|
|
76
82
|
|
|
77
83
|
export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_PureGraphManagerExtension {
|
|
78
84
|
declare graphManager: V1_PureGraphManager;
|
|
@@ -315,66 +321,107 @@ export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_Pu
|
|
|
315
321
|
|
|
316
322
|
// elements documentation
|
|
317
323
|
result.elementDocs = analysisResult.elementDocs.flatMap((docEntry) => {
|
|
318
|
-
const entries:
|
|
324
|
+
const entries: NormalizedDataSpaceDocumentationEntry[] = [];
|
|
319
325
|
if (docEntry instanceof V1_DataSpaceClassDocumentationEntry) {
|
|
326
|
+
const classData = new DataSpaceClassDocumentationEntry();
|
|
327
|
+
classData.name = docEntry.name;
|
|
328
|
+
classData.docs = docEntry.docs;
|
|
329
|
+
classData.path = docEntry.path;
|
|
330
|
+
classData.milestoning = docEntry.milestoning;
|
|
320
331
|
entries.push(
|
|
321
|
-
new
|
|
322
|
-
docEntry.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
332
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
333
|
+
docEntry.name,
|
|
334
|
+
docEntry.docs.join('\n').trim(),
|
|
335
|
+
classData,
|
|
336
|
+
classData,
|
|
326
337
|
),
|
|
327
338
|
);
|
|
339
|
+
|
|
328
340
|
docEntry.properties.forEach((property) => {
|
|
341
|
+
const propertyData = new DataSpacePropertyDocumentationEntry();
|
|
342
|
+
propertyData.name = property.name;
|
|
343
|
+
propertyData.docs = property.docs;
|
|
344
|
+
propertyData.type = property.type;
|
|
345
|
+
propertyData.milestoning = property.milestoning;
|
|
346
|
+
propertyData.multiplicity = property.multiplicity
|
|
347
|
+
? graph.getMultiplicity(
|
|
348
|
+
property.multiplicity.lowerBound,
|
|
349
|
+
property.multiplicity.upperBound,
|
|
350
|
+
)
|
|
351
|
+
: undefined;
|
|
352
|
+
classData.properties.push(propertyData);
|
|
329
353
|
entries.push(
|
|
330
|
-
new
|
|
331
|
-
docEntry.path,
|
|
354
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
332
355
|
property.name,
|
|
333
|
-
property.docs.join('\n'),
|
|
334
|
-
|
|
356
|
+
property.docs.join('\n').trim(),
|
|
357
|
+
classData,
|
|
358
|
+
propertyData,
|
|
335
359
|
),
|
|
336
360
|
);
|
|
337
361
|
});
|
|
338
|
-
// NOTE: we don't want to list inherited properties
|
|
339
362
|
} else if (
|
|
340
363
|
docEntry instanceof V1_DataSpaceEnumerationDocumentationEntry
|
|
341
364
|
) {
|
|
365
|
+
const enumerationData = new DataSpaceEnumerationDocumentationEntry();
|
|
366
|
+
enumerationData.name = docEntry.name;
|
|
367
|
+
enumerationData.docs = docEntry.docs;
|
|
368
|
+
enumerationData.path = docEntry.path;
|
|
342
369
|
entries.push(
|
|
343
|
-
new
|
|
344
|
-
docEntry.
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
370
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
371
|
+
docEntry.name,
|
|
372
|
+
docEntry.docs.join('\n').trim(),
|
|
373
|
+
enumerationData,
|
|
374
|
+
enumerationData,
|
|
348
375
|
),
|
|
349
376
|
);
|
|
350
377
|
docEntry.enumValues.forEach((enumValue) => {
|
|
378
|
+
const enumData = new DataSpaceBasicDocumentationEntry();
|
|
379
|
+
enumData.name = enumValue.name;
|
|
380
|
+
enumData.docs = enumValue.docs;
|
|
381
|
+
enumerationData.enumValues.push(enumData);
|
|
351
382
|
entries.push(
|
|
352
|
-
new
|
|
353
|
-
docEntry.path,
|
|
383
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
354
384
|
enumValue.name,
|
|
355
|
-
enumValue.docs.join('\n'),
|
|
356
|
-
|
|
385
|
+
enumValue.docs.join('\n').trim(),
|
|
386
|
+
enumerationData,
|
|
387
|
+
enumData,
|
|
357
388
|
),
|
|
358
389
|
);
|
|
359
390
|
});
|
|
360
391
|
} else if (
|
|
361
392
|
docEntry instanceof V1_DataSpaceAssociationDocumentationEntry
|
|
362
393
|
) {
|
|
394
|
+
const associationData = new DataSpaceAssociationDocumentationEntry();
|
|
395
|
+
associationData.name = docEntry.name;
|
|
396
|
+
associationData.docs = docEntry.docs;
|
|
397
|
+
associationData.path = docEntry.path;
|
|
363
398
|
entries.push(
|
|
364
|
-
new
|
|
365
|
-
docEntry.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
399
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
400
|
+
docEntry.name,
|
|
401
|
+
docEntry.docs.join('\n').trim(),
|
|
402
|
+
associationData,
|
|
403
|
+
associationData,
|
|
369
404
|
),
|
|
370
405
|
);
|
|
371
406
|
docEntry.properties.forEach((property) => {
|
|
407
|
+
const propertyData = new DataSpacePropertyDocumentationEntry();
|
|
408
|
+
propertyData.name = property.name;
|
|
409
|
+
propertyData.docs = property.docs;
|
|
410
|
+
propertyData.type = property.type;
|
|
411
|
+
propertyData.milestoning = property.milestoning;
|
|
412
|
+
propertyData.multiplicity = property.multiplicity
|
|
413
|
+
? graph.getMultiplicity(
|
|
414
|
+
property.multiplicity.lowerBound,
|
|
415
|
+
property.multiplicity.upperBound,
|
|
416
|
+
)
|
|
417
|
+
: undefined;
|
|
418
|
+
associationData.properties.push(propertyData);
|
|
372
419
|
entries.push(
|
|
373
|
-
new
|
|
374
|
-
docEntry.path,
|
|
420
|
+
new NormalizedDataSpaceDocumentationEntry(
|
|
375
421
|
property.name,
|
|
376
422
|
property.docs.join('\n'),
|
|
377
|
-
|
|
423
|
+
associationData,
|
|
424
|
+
propertyData,
|
|
378
425
|
),
|
|
379
426
|
);
|
|
380
427
|
});
|
|
@@ -419,6 +466,27 @@ export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_Pu
|
|
|
419
466
|
column.type = tdsColumn.type;
|
|
420
467
|
column.relationalType = tdsColumn.relationalType;
|
|
421
468
|
column.documentation = tdsColumn.documentation;
|
|
469
|
+
if (
|
|
470
|
+
tdsColumn.documentation?.includes(
|
|
471
|
+
TEMPORARY__TDS_SAMPLE_VALUES__DELIMETER,
|
|
472
|
+
)
|
|
473
|
+
) {
|
|
474
|
+
column.documentation = tdsColumn.documentation
|
|
475
|
+
.substring(
|
|
476
|
+
0,
|
|
477
|
+
tdsColumn.documentation.indexOf(
|
|
478
|
+
TEMPORARY__TDS_SAMPLE_VALUES__DELIMETER,
|
|
479
|
+
),
|
|
480
|
+
)
|
|
481
|
+
.trim();
|
|
482
|
+
column.sampleValues = tdsColumn.documentation
|
|
483
|
+
.substring(
|
|
484
|
+
tdsColumn.documentation.indexOf(
|
|
485
|
+
TEMPORARY__TDS_SAMPLE_VALUES__DELIMETER,
|
|
486
|
+
) + TEMPORARY__TDS_SAMPLE_VALUES__DELIMETER.length,
|
|
487
|
+
)
|
|
488
|
+
.trim();
|
|
489
|
+
}
|
|
422
490
|
return column;
|
|
423
491
|
},
|
|
424
492
|
);
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
type V1_Multiplicity,
|
|
19
|
+
V1_PureModelContextData,
|
|
20
|
+
V1_multiplicityModelSchema,
|
|
21
|
+
} from '@finos/legend-graph';
|
|
18
22
|
import {
|
|
19
23
|
SerializationFactory,
|
|
20
24
|
optionalCustom,
|
|
@@ -24,6 +28,7 @@ import {
|
|
|
24
28
|
usingConstantValueSchema,
|
|
25
29
|
isString,
|
|
26
30
|
isNonNullable,
|
|
31
|
+
optionalCustomUsingModelSchema,
|
|
27
32
|
} from '@finos/legend-shared';
|
|
28
33
|
import {
|
|
29
34
|
createModelSchema,
|
|
@@ -97,13 +102,27 @@ export class V1_DataSpaceBasicDocumentationEntry {
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
export class V1_DataSpacePropertyDocumentationEntry extends V1_DataSpaceBasicDocumentationEntry {
|
|
100
|
-
milestoning?: string;
|
|
105
|
+
milestoning?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Make this optional for backward compatibility
|
|
108
|
+
*
|
|
109
|
+
* @backwardCompatibility
|
|
110
|
+
*/
|
|
111
|
+
type?: string | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Make this optional for backward compatibility
|
|
114
|
+
*
|
|
115
|
+
* @backwardCompatibility
|
|
116
|
+
*/
|
|
117
|
+
multiplicity?: V1_Multiplicity | undefined;
|
|
101
118
|
|
|
102
119
|
static override readonly serialization = new SerializationFactory(
|
|
103
120
|
createModelSchema(V1_DataSpacePropertyDocumentationEntry, {
|
|
104
121
|
docs: list(primitive()),
|
|
105
122
|
milestoning: optional(primitive()),
|
|
123
|
+
multiplicity: optionalCustomUsingModelSchema(V1_multiplicityModelSchema),
|
|
106
124
|
name: primitive(),
|
|
125
|
+
type: optional(primitive()),
|
|
107
126
|
}),
|
|
108
127
|
);
|
|
109
128
|
}
|
|
@@ -122,7 +141,7 @@ export class V1_DataSpaceModelDocumentationEntry extends V1_DataSpaceBasicDocume
|
|
|
122
141
|
|
|
123
142
|
export class V1_DataSpaceClassDocumentationEntry extends V1_DataSpaceModelDocumentationEntry {
|
|
124
143
|
properties: V1_DataSpacePropertyDocumentationEntry[] = [];
|
|
125
|
-
milestoning?: string;
|
|
144
|
+
milestoning?: string | undefined;
|
|
126
145
|
|
|
127
146
|
static override readonly serialization = new SerializationFactory(
|
|
128
147
|
createModelSchema(V1_DataSpaceClassDocumentationEntry, {
|