@finos/legend-extension-dsl-data-space 4.0.3 → 5.0.0
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/DSLDataSpace_Const.d.ts +18 -0
- package/lib/DSLDataSpace_Const.d.ts.map +1 -0
- package/lib/DSLDataSpace_Const.js +20 -0
- package/lib/DSLDataSpace_Const.js.map +1 -0
- package/lib/components/DataSpaceViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceViewer.js +30 -27
- package/lib/components/DataSpaceViewer.js.map +1 -1
- package/lib/components/query/{DSLDataSpace_LegendQueryPlugin.d.ts → DSLDataSpace_LegendQueryApplicationPlugin.d.ts} +6 -3
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -0
- package/lib/components/query/{DSLDataSpace_LegendQueryPlugin.js → DSLDataSpace_LegendQueryApplicationPlugin.js} +27 -3
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js.map +1 -0
- package/lib/components/query/DataSpaceQueryEditor.d.ts +20 -0
- package/lib/components/query/DataSpaceQueryEditor.d.ts.map +1 -0
- package/lib/components/query/DataSpaceQueryEditor.js +43 -0
- package/lib/components/query/DataSpaceQueryEditor.js.map +1 -0
- package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/query/DataSpaceQuerySetup.js +4 -17
- package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/studio/{DSLDataSpace_LegendStudioPlugin.d.ts → DSLDataSpace_LegendStudioApplicationPlugin.d.ts} +3 -3
- package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -0
- package/lib/components/studio/{DSLDataSpace_LegendStudioPlugin.js → DSLDataSpace_LegendStudioApplicationPlugin.js} +3 -3
- package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js.map +1 -0
- package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts +2 -1
- package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js +4 -0
- package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js.map +1 -1
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts +50 -0
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -0
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.js +48 -0
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.js.map +1 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.d.ts +23 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.d.ts.map +1 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.js +21 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.js.map +1 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtensionBuilder.d.ts +18 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtensionBuilder.d.ts.map +1 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtensionBuilder.js +20 -0
- package/lib/graphManager/protocol/DSLDataSpace_PureGraphManagerExtensionBuilder.js.map +1 -0
- package/lib/graphManager/protocol/v1/V1_DSLDataSpace_PureGraphManagerExtension.d.ts +26 -0
- package/lib/graphManager/protocol/v1/V1_DSLDataSpace_PureGraphManagerExtension.d.ts.map +1 -0
- package/lib/graphManager/protocol/v1/V1_DSLDataSpace_PureGraphManagerExtension.js +131 -0
- package/lib/graphManager/protocol/v1/V1_DSLDataSpace_PureGraphManagerExtension.js.map +1 -0
- package/lib/graphManager/protocol/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +53 -0
- package/lib/graphManager/protocol/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -0
- package/lib/graphManager/protocol/v1/engine/analytics/V1_DataSpaceAnalysis.js +78 -0
- package/lib/graphManager/protocol/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts +3 -1
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js.map +1 -1
- package/lib/package.json +6 -5
- package/lib/stores/DataSpaceViewerState.d.ts +7 -11
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
- package/lib/stores/DataSpaceViewerState.js +10 -32
- package/lib/stores/DataSpaceViewerState.js.map +1 -1
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts +32 -0
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts.map +1 -0
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js +34 -0
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js.map +1 -0
- package/lib/stores/query/DataSpaceQueryEditorStore.d.ts +31 -0
- package/lib/stores/query/DataSpaceQueryEditorStore.d.ts.map +1 -0
- package/lib/stores/query/DataSpaceQueryEditorStore.js +87 -0
- package/lib/stores/query/DataSpaceQueryEditorStore.js.map +1 -0
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts +3 -4
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupState.js +34 -44
- package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
- package/package.json +16 -15
- package/src/DSLDataSpace_Const.ts +20 -0
- package/src/components/DataSpaceViewer.tsx +56 -66
- package/src/components/query/{DSLDataSpace_LegendQueryPlugin.tsx → DSLDataSpace_LegendQueryApplicationPlugin.tsx} +39 -2
- package/src/components/query/DataSpaceQueryEditor.tsx +106 -0
- package/src/components/query/DataSpaceQuerySetup.tsx +23 -32
- package/src/components/studio/{DSLDataSpace_LegendStudioPlugin.tsx → DSLDataSpace_LegendStudioApplicationPlugin.tsx} +8 -8
- package/src/graphManager/DSLDataSpace_PureGraphManagerPlugin.ts +6 -0
- package/src/graphManager/action/analytics/DataSpaceAnalysis.ts +64 -0
- package/src/graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.ts +42 -0
- package/src/graphManager/protocol/DSLDataSpace_PureGraphManagerExtensionBuilder.ts +27 -0
- package/src/graphManager/protocol/v1/V1_DSLDataSpace_PureGraphManagerExtension.ts +228 -0
- package/src/graphManager/protocol/v1/engine/analytics/V1_DataSpaceAnalysis.ts +117 -0
- package/src/index.ts +4 -2
- package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts +1 -1
- package/src/stores/DataSpaceViewerState.ts +23 -54
- package/src/stores/query/DSLDataSpace_LegendQueryRouter.ts +69 -0
- package/src/stores/query/DataSpaceQueryEditorStore.ts +141 -0
- package/src/stores/query/DataSpaceQuerySetupState.ts +65 -73
- package/tsconfig.json +11 -2
- package/lib/components/query/DSLDataSpace_LegendQueryPlugin.d.ts.map +0 -1
- package/lib/components/query/DSLDataSpace_LegendQueryPlugin.js.map +0 -1
- package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.d.ts.map +0 -1
- package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
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 { V1_PureModelContextData } from '@finos/legend-graph';
|
|
18
|
+
import { SerializationFactory, optionalCustom } from '@finos/legend-shared';
|
|
19
|
+
import {
|
|
20
|
+
createModelSchema,
|
|
21
|
+
list,
|
|
22
|
+
object,
|
|
23
|
+
optional,
|
|
24
|
+
primitive,
|
|
25
|
+
SKIP,
|
|
26
|
+
} from 'serializr';
|
|
27
|
+
import type { V1_DataSpaceSupportInfo } from '../../../../../models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.js';
|
|
28
|
+
import { V1_deserializeSupportInfo } from '../../../../../models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js';
|
|
29
|
+
|
|
30
|
+
class V1_DataSpaceTaggedValueInfo {
|
|
31
|
+
profile!: string;
|
|
32
|
+
tag!: string;
|
|
33
|
+
value!: string;
|
|
34
|
+
|
|
35
|
+
static readonly serialization = new SerializationFactory(
|
|
36
|
+
createModelSchema(V1_DataSpaceTaggedValueInfo, {
|
|
37
|
+
profile: primitive(),
|
|
38
|
+
tag: primitive(),
|
|
39
|
+
value: primitive(),
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class V1_DataSpaceStereotypeInfo {
|
|
45
|
+
profile!: string;
|
|
46
|
+
value!: string;
|
|
47
|
+
|
|
48
|
+
static readonly serialization = new SerializationFactory(
|
|
49
|
+
createModelSchema(V1_DataSpaceStereotypeInfo, {
|
|
50
|
+
profile: primitive(),
|
|
51
|
+
value: primitive(),
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class V1_DataSpaceExecutionContextAnalysisResult {
|
|
57
|
+
name!: string;
|
|
58
|
+
description?: string | undefined;
|
|
59
|
+
mapping!: string;
|
|
60
|
+
defaultRuntime!: string;
|
|
61
|
+
compatibleRuntimes!: string[];
|
|
62
|
+
|
|
63
|
+
static readonly serialization = new SerializationFactory(
|
|
64
|
+
createModelSchema(V1_DataSpaceExecutionContextAnalysisResult, {
|
|
65
|
+
name: primitive(),
|
|
66
|
+
description: optional(primitive()),
|
|
67
|
+
mapping: primitive(),
|
|
68
|
+
defaultRuntime: primitive(),
|
|
69
|
+
compatibleRuntimes: list(primitive()),
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export class V1_DataSpaceAnalysisResult {
|
|
75
|
+
name!: string;
|
|
76
|
+
package!: string;
|
|
77
|
+
path!: string;
|
|
78
|
+
|
|
79
|
+
taggedValues: V1_DataSpaceTaggedValueInfo[] = [];
|
|
80
|
+
stereotypes: V1_DataSpaceStereotypeInfo[] = [];
|
|
81
|
+
|
|
82
|
+
description?: string | undefined;
|
|
83
|
+
supportInfo?: V1_DataSpaceSupportInfo | undefined;
|
|
84
|
+
|
|
85
|
+
model!: V1_PureModelContextData;
|
|
86
|
+
|
|
87
|
+
executionContexts: V1_DataSpaceExecutionContextAnalysisResult[] = [];
|
|
88
|
+
defaultExecutionContext!: string;
|
|
89
|
+
|
|
90
|
+
featuredDiagrams: string[] = [];
|
|
91
|
+
|
|
92
|
+
static readonly serialization = new SerializationFactory(
|
|
93
|
+
createModelSchema(V1_DataSpaceAnalysisResult, {
|
|
94
|
+
name: primitive(),
|
|
95
|
+
package: primitive(),
|
|
96
|
+
path: primitive(),
|
|
97
|
+
|
|
98
|
+
taggedValues: list(object(V1_DataSpaceTaggedValueInfo)),
|
|
99
|
+
stereotypes: list(object(V1_DataSpaceStereotypeInfo)),
|
|
100
|
+
|
|
101
|
+
description: optional(primitive()),
|
|
102
|
+
supportInfo: optionalCustom(
|
|
103
|
+
() => SKIP,
|
|
104
|
+
(val) => V1_deserializeSupportInfo(val),
|
|
105
|
+
),
|
|
106
|
+
|
|
107
|
+
model: object(V1_PureModelContextData),
|
|
108
|
+
|
|
109
|
+
executionContexts: list(
|
|
110
|
+
object(V1_DataSpaceExecutionContextAnalysisResult),
|
|
111
|
+
),
|
|
112
|
+
defaultExecutionContext: primitive(),
|
|
113
|
+
|
|
114
|
+
featuredDiagrams: list(primitive()),
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export * from './DSLDataSpace_Extension.js';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
18
|
+
export { DSLDataSpace_LegendStudioApplicationPlugin } from './components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js';
|
|
19
|
+
export { DSLDataSpace_LegendQueryApplicationPlugin } from './components/query/DSLDataSpace_LegendQueryApplicationPlugin.js';
|
|
20
20
|
|
|
21
21
|
export { DataSpaceViewer } from './components/DataSpaceViewer.js';
|
|
22
22
|
|
|
@@ -28,3 +28,5 @@ export {
|
|
|
28
28
|
export { DataSpaceViewerState } from './stores/DataSpaceViewerState.js';
|
|
29
29
|
|
|
30
30
|
export * from './graphManager/DSLDataSpace_GraphManagerHelper.js';
|
|
31
|
+
export { getDSLDataSpaceGraphManagerExtension } from './graphManager/protocol/DSLDataSpace_PureGraphManagerExtension.js';
|
|
32
|
+
export { DataSpaceAnalysisResult } from './graphManager/action/analytics/DataSpaceAnalysis.js';
|
package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts
CHANGED
|
@@ -78,7 +78,7 @@ const V1_serializeSupportInfo = (
|
|
|
78
78
|
throw new UnsupportedOperationError(`Can't serialize support info`, protocol);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
const V1_deserializeSupportInfo = (
|
|
81
|
+
export const V1_deserializeSupportInfo = (
|
|
82
82
|
json: PlainObject<V1_DataSpaceSupportInfo> | undefined,
|
|
83
83
|
): V1_DataSpaceSupportInfo | undefined => {
|
|
84
84
|
if (!json) {
|
|
@@ -17,20 +17,19 @@
|
|
|
17
17
|
import {
|
|
18
18
|
type ClassView,
|
|
19
19
|
type DiagramRenderer,
|
|
20
|
-
Diagram,
|
|
20
|
+
type Diagram,
|
|
21
21
|
DIAGRAM_INTERACTION_MODE,
|
|
22
22
|
} from '@finos/legend-extension-dsl-diagram';
|
|
23
|
-
import type {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from '@finos/legend-
|
|
28
|
-
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
23
|
+
import type { PackageableRuntime } from '@finos/legend-graph';
|
|
24
|
+
import {
|
|
25
|
+
getNullableFirstElement,
|
|
26
|
+
guaranteeNonNullable,
|
|
27
|
+
} from '@finos/legend-shared';
|
|
29
28
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
30
29
|
import type {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from '../
|
|
30
|
+
DataSpaceAnalysisResult,
|
|
31
|
+
DataSpaceExecutionContextAnalysisResult,
|
|
32
|
+
} from '../graphManager/action/analytics/DataSpaceAnalysis.js';
|
|
34
33
|
|
|
35
34
|
export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
|
|
36
35
|
MODELS_OVERVIEW = 'MODELS_OVERVIEW',
|
|
@@ -43,15 +42,14 @@ export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
export class DataSpaceViewerState {
|
|
46
|
-
graphManagerState: GraphManagerState;
|
|
47
45
|
groupId: string;
|
|
48
46
|
artifactId: string;
|
|
49
47
|
versionId: string;
|
|
50
|
-
|
|
48
|
+
dataSpaceAnalysisResult: DataSpaceAnalysisResult;
|
|
51
49
|
_renderer?: DiagramRenderer | undefined;
|
|
52
50
|
currentDiagram?: Diagram | undefined;
|
|
53
51
|
currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW;
|
|
54
|
-
currentExecutionContext:
|
|
52
|
+
currentExecutionContext: DataSpaceExecutionContextAnalysisResult;
|
|
55
53
|
currentRuntime: PackageableRuntime;
|
|
56
54
|
viewProject?:
|
|
57
55
|
| ((
|
|
@@ -64,11 +62,10 @@ export class DataSpaceViewerState {
|
|
|
64
62
|
onDiagramClassDoubleClick?: ((classView: ClassView) => void) | undefined;
|
|
65
63
|
|
|
66
64
|
constructor(
|
|
67
|
-
graphManagerState: GraphManagerState,
|
|
68
65
|
groupId: string,
|
|
69
66
|
artifactId: string,
|
|
70
67
|
versionId: string,
|
|
71
|
-
|
|
68
|
+
dataSpaceAnalysisResult: DataSpaceAnalysisResult,
|
|
72
69
|
options?: {
|
|
73
70
|
viewProject?: (
|
|
74
71
|
groupId: string,
|
|
@@ -93,22 +90,16 @@ export class DataSpaceViewerState {
|
|
|
93
90
|
setCurrentRuntime: action,
|
|
94
91
|
});
|
|
95
92
|
|
|
96
|
-
this.
|
|
97
|
-
this.dataSpace = dataSpace;
|
|
93
|
+
this.dataSpaceAnalysisResult = dataSpaceAnalysisResult;
|
|
98
94
|
this.groupId = groupId;
|
|
99
95
|
this.artifactId = artifactId;
|
|
100
96
|
this.versionId = versionId;
|
|
101
|
-
this.currentExecutionContext =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.currentDiagram =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
.featuredDiagrams[0] as PackageableElementReference<Diagram>
|
|
108
|
-
).value
|
|
109
|
-
: this.diagrams.length
|
|
110
|
-
? this.diagrams[0]
|
|
111
|
-
: undefined;
|
|
97
|
+
this.currentExecutionContext =
|
|
98
|
+
dataSpaceAnalysisResult.defaultExecutionContext;
|
|
99
|
+
this.currentRuntime = this.currentExecutionContext.defaultRuntime;
|
|
100
|
+
this.currentDiagram = getNullableFirstElement(
|
|
101
|
+
this.dataSpaceAnalysisResult.featuredDiagrams,
|
|
102
|
+
);
|
|
112
103
|
this.viewProject = options?.viewProject;
|
|
113
104
|
this.onDiagramClassDoubleClick = options?.onDiagramClassDoubleClick;
|
|
114
105
|
}
|
|
@@ -124,30 +115,6 @@ export class DataSpaceViewerState {
|
|
|
124
115
|
return Boolean(this._renderer);
|
|
125
116
|
}
|
|
126
117
|
|
|
127
|
-
get featuredDiagrams(): Diagram[] {
|
|
128
|
-
return this.dataSpace.featuredDiagrams?.map((ref) => ref.value) ?? [];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
get diagrams(): Diagram[] {
|
|
132
|
-
return this.graphManagerState.graph
|
|
133
|
-
.getExtensionElements(Diagram)
|
|
134
|
-
.concat(
|
|
135
|
-
this.graphManagerState.graph.dependencyManager.getExtensionElements(
|
|
136
|
-
Diagram,
|
|
137
|
-
),
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
get runtimes(): PackageableRuntime[] {
|
|
142
|
-
return this.graphManagerState.graph.ownRuntimes
|
|
143
|
-
.concat(this.graphManagerState.graph.dependencyManager.runtimes)
|
|
144
|
-
.filter((runtime) =>
|
|
145
|
-
runtime.runtimeValue.mappings
|
|
146
|
-
.map((mapping) => mapping.value)
|
|
147
|
-
.includes(this.currentExecutionContext.mapping.value),
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
118
|
// NOTE: we have tried to use React to control the cursor and
|
|
152
119
|
// could not overcome the jank/lag problem, so we settle with CSS-based approach
|
|
153
120
|
// See https://css-tricks.com/using-css-cursors/
|
|
@@ -183,9 +150,11 @@ export class DataSpaceViewerState {
|
|
|
183
150
|
this.currentActivity = val;
|
|
184
151
|
}
|
|
185
152
|
|
|
186
|
-
setCurrentExecutionContext(
|
|
153
|
+
setCurrentExecutionContext(
|
|
154
|
+
val: DataSpaceExecutionContextAnalysisResult,
|
|
155
|
+
): void {
|
|
187
156
|
this.currentExecutionContext = val;
|
|
188
|
-
this.currentRuntime = val.defaultRuntime
|
|
157
|
+
this.currentRuntime = val.defaultRuntime;
|
|
189
158
|
}
|
|
190
159
|
|
|
191
160
|
setCurrentRuntime(val: PackageableRuntime): void {
|
|
@@ -0,0 +1,69 @@
|
|
|
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 { generateExtensionUrlPattern } from '@finos/legend-application';
|
|
18
|
+
import {
|
|
19
|
+
LEGEND_QUERY_PATH_PARAM_TOKEN,
|
|
20
|
+
LEGEND_QUERY_QUERY_PARAM_TOKEN,
|
|
21
|
+
} from '@finos/legend-query';
|
|
22
|
+
import { generateGAVCoordinates } from '@finos/legend-server-depot';
|
|
23
|
+
import { generatePath } from 'react-router';
|
|
24
|
+
|
|
25
|
+
export enum DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN {
|
|
26
|
+
DATA_SPACE_PATH = 'dataSpacePath',
|
|
27
|
+
EXECUTION_CONTEXT = 'executionContext',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface DataSpaceQueryEditorPathParams {
|
|
31
|
+
[LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: string;
|
|
32
|
+
[DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH]: string;
|
|
33
|
+
[DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT]: string;
|
|
34
|
+
[LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH]?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DataSpaceQueryEditorQueryParams {
|
|
38
|
+
[LEGEND_QUERY_QUERY_PARAM_TOKEN.CLASS_PATH]?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const DATA_SPACE_QUERY_EDITOR_ROUTE_PATTERN = `/dataspace/:${LEGEND_QUERY_PATH_PARAM_TOKEN.GAV}/:${DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH}/:${DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH}?`;
|
|
42
|
+
|
|
43
|
+
export const generateDataSpaceQueryEditorRoute = (
|
|
44
|
+
groupId: string,
|
|
45
|
+
artifactId: string,
|
|
46
|
+
versionId: string,
|
|
47
|
+
dataSpacePath: string,
|
|
48
|
+
executionContextKey: string,
|
|
49
|
+
runtimePath?: string | undefined,
|
|
50
|
+
classPath?: string | undefined,
|
|
51
|
+
): string =>
|
|
52
|
+
`${generatePath(
|
|
53
|
+
generateExtensionUrlPattern(DATA_SPACE_QUERY_EDITOR_ROUTE_PATTERN),
|
|
54
|
+
{
|
|
55
|
+
[LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: generateGAVCoordinates(
|
|
56
|
+
groupId,
|
|
57
|
+
artifactId,
|
|
58
|
+
versionId,
|
|
59
|
+
),
|
|
60
|
+
[DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH]: dataSpacePath,
|
|
61
|
+
[DATA_SPACE_QUERY_EDITOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT]:
|
|
62
|
+
executionContextKey,
|
|
63
|
+
[LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH]: runtimePath,
|
|
64
|
+
},
|
|
65
|
+
)}${
|
|
66
|
+
classPath
|
|
67
|
+
? `?${LEGEND_QUERY_QUERY_PARAM_TOKEN.CLASS_PATH}=${classPath}`
|
|
68
|
+
: ''
|
|
69
|
+
}`;
|
|
@@ -0,0 +1,141 @@
|
|
|
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 Query,
|
|
19
|
+
extractElementNameFromPath,
|
|
20
|
+
QueryTaggedValue,
|
|
21
|
+
} from '@finos/legend-graph';
|
|
22
|
+
import {
|
|
23
|
+
QueryEditorStore,
|
|
24
|
+
type QueryExportConfiguration,
|
|
25
|
+
type LegendQueryPluginManager,
|
|
26
|
+
type LegendQueryApplicationStore,
|
|
27
|
+
} from '@finos/legend-query';
|
|
28
|
+
import type {
|
|
29
|
+
DepotServerClient,
|
|
30
|
+
ProjectGAVCoordinates,
|
|
31
|
+
} from '@finos/legend-server-depot';
|
|
32
|
+
import { guaranteeNonNullable, uuid } from '@finos/legend-shared';
|
|
33
|
+
import {
|
|
34
|
+
QUERY_PROFILE_PATH,
|
|
35
|
+
QUERY_PROFILE_TAG_DATA_SPACE,
|
|
36
|
+
} from '../../DSLDataSpace_Const.js';
|
|
37
|
+
import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
|
|
38
|
+
|
|
39
|
+
const createQueryDataSpaceTaggedValue = (
|
|
40
|
+
dataSpacePath: string,
|
|
41
|
+
): QueryTaggedValue => {
|
|
42
|
+
const taggedValue = new QueryTaggedValue();
|
|
43
|
+
taggedValue.profile = QUERY_PROFILE_PATH;
|
|
44
|
+
taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
|
|
45
|
+
taggedValue.value = dataSpacePath;
|
|
46
|
+
return taggedValue;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export class DataSpaceQueryEditorStore extends QueryEditorStore {
|
|
50
|
+
groupId: string;
|
|
51
|
+
artifactId: string;
|
|
52
|
+
versionId: string;
|
|
53
|
+
dataSpacePath: string;
|
|
54
|
+
executionContext: string;
|
|
55
|
+
runtimePath: string | undefined;
|
|
56
|
+
classPath: string | undefined;
|
|
57
|
+
|
|
58
|
+
constructor(
|
|
59
|
+
applicationStore: LegendQueryApplicationStore,
|
|
60
|
+
depotServerClient: DepotServerClient,
|
|
61
|
+
pluginManager: LegendQueryPluginManager,
|
|
62
|
+
groupId: string,
|
|
63
|
+
artifactId: string,
|
|
64
|
+
versionId: string,
|
|
65
|
+
dataSpacePath: string,
|
|
66
|
+
executionContext: string,
|
|
67
|
+
runtimePath: string | undefined,
|
|
68
|
+
executionKey: string | undefined,
|
|
69
|
+
) {
|
|
70
|
+
super(applicationStore, depotServerClient, pluginManager);
|
|
71
|
+
|
|
72
|
+
this.groupId = groupId;
|
|
73
|
+
this.artifactId = artifactId;
|
|
74
|
+
this.versionId = versionId;
|
|
75
|
+
this.dataSpacePath = dataSpacePath;
|
|
76
|
+
this.executionContext = executionContext;
|
|
77
|
+
this.runtimePath = runtimePath;
|
|
78
|
+
this.classPath = executionKey;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getProjectInfo(): ProjectGAVCoordinates {
|
|
82
|
+
return {
|
|
83
|
+
groupId: this.groupId,
|
|
84
|
+
artifactId: this.artifactId,
|
|
85
|
+
versionId: this.versionId,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async setUpBuilderState(): Promise<void> {
|
|
90
|
+
this.queryBuilderState.querySetupState.setMappingIsReadOnly(true);
|
|
91
|
+
this.queryBuilderState.querySetupState.setRuntimeIsReadOnly(true);
|
|
92
|
+
|
|
93
|
+
const dataSpace = getDataSpace(
|
|
94
|
+
this.dataSpacePath,
|
|
95
|
+
this.graphManagerState.graph,
|
|
96
|
+
);
|
|
97
|
+
const executionContext = guaranteeNonNullable(
|
|
98
|
+
dataSpace.executionContexts.find(
|
|
99
|
+
(context) => context.name === this.executionContext,
|
|
100
|
+
),
|
|
101
|
+
`Can't find execution context '${this.executionContext}'`,
|
|
102
|
+
);
|
|
103
|
+
this.queryBuilderState.querySetupState.setMapping(
|
|
104
|
+
executionContext.mapping.value,
|
|
105
|
+
);
|
|
106
|
+
this.queryBuilderState.querySetupState.setRuntimeValue(
|
|
107
|
+
(this.runtimePath
|
|
108
|
+
? this.graphManagerState.graph.getRuntime(this.runtimePath)
|
|
109
|
+
: executionContext.defaultRuntime.value
|
|
110
|
+
).runtimeValue,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (this.classPath) {
|
|
114
|
+
this.queryBuilderState.querySetupState._class =
|
|
115
|
+
this.queryBuilderState.graphManagerState.graph.getClass(this.classPath);
|
|
116
|
+
this.queryBuilderState.querySetupState.setClassIsReadOnly(true);
|
|
117
|
+
}
|
|
118
|
+
// TODO?: should we set the class here automatically?
|
|
119
|
+
|
|
120
|
+
// initialize query builder state after setting up
|
|
121
|
+
this.queryBuilderState.resetQueryBuilder();
|
|
122
|
+
this.queryBuilderState.resetQuerySetup();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async getExportConfiguration(): Promise<QueryExportConfiguration> {
|
|
126
|
+
return {
|
|
127
|
+
defaultName: `New Query for ${extractElementNameFromPath(
|
|
128
|
+
this.dataSpacePath,
|
|
129
|
+
)}[${this.executionContext}]`,
|
|
130
|
+
decorator: (query: Query): void => {
|
|
131
|
+
query.id = uuid();
|
|
132
|
+
query.groupId = this.groupId;
|
|
133
|
+
query.artifactId = this.artifactId;
|
|
134
|
+
query.versionId = this.versionId;
|
|
135
|
+
query.taggedValues = [
|
|
136
|
+
createQueryDataSpaceTaggedValue(this.dataSpacePath),
|
|
137
|
+
];
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|