@finos/legend-extension-dsl-data-space 6.1.11 → 6.1.12
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 +2 -0
- package/lib/DSLDataSpace_Const.d.ts.map +1 -1
- package/lib/DSLDataSpace_Const.js +2 -0
- package/lib/DSLDataSpace_Const.js.map +1 -1
- package/lib/components/DSLDataSpace_Icon.d.ts +18 -0
- package/lib/components/DSLDataSpace_Icon.d.ts.map +1 -0
- package/lib/components/DSLDataSpace_Icon.js +19 -0
- package/lib/components/DSLDataSpace_Icon.js.map +1 -0
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts +3 -2
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js +99 -8
- package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/query/DataSpaceQueryBuilder.d.ts +18 -0
- package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -0
- package/lib/components/query/DataSpaceQueryBuilder.js +126 -0
- package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -0
- package/lib/components/query/{DataSpaceQueryEditor.d.ts → DataSpaceQueryCreator.d.ts} +2 -2
- package/lib/components/query/DataSpaceQueryCreator.d.ts.map +1 -0
- package/lib/components/query/{DataSpaceQueryEditor.js → DataSpaceQueryCreator.js} +11 -11
- package/lib/components/query/DataSpaceQueryCreator.js.map +1 -0
- package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/query/DataSpaceQuerySetup.js +6 -8
- package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js +2 -2
- package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +6 -6
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts +11 -8
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js +15 -11
- package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js.map +1 -1
- package/lib/stores/query/DataSpaceInfo.d.ts +31 -0
- package/lib/stores/query/DataSpaceInfo.d.ts.map +1 -0
- package/lib/stores/query/DataSpaceInfo.js +34 -0
- package/lib/stores/query/DataSpaceInfo.js.map +1 -0
- package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +52 -0
- package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/query/DataSpaceQueryBuilderState.js +112 -0
- package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -0
- package/lib/stores/query/{DataSpaceQueryEditorStore.d.ts → DataSpaceQueryCreatorStore.d.ts} +6 -4
- package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -0
- package/lib/stores/query/DataSpaceQueryCreatorStore.js +113 -0
- package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -0
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts +5 -12
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupState.js +9 -19
- package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
- package/package.json +16 -16
- package/src/DSLDataSpace_Const.ts +3 -0
- package/src/components/DSLDataSpace_Icon.tsx +23 -0
- package/src/components/query/DSLDataSpace_LegendQueryApplicationPlugin.tsx +170 -8
- package/src/components/query/DataSpaceQueryBuilder.tsx +344 -0
- package/src/components/query/{DataSpaceQueryEditor.tsx → DataSpaceQueryCreator.tsx} +13 -13
- package/src/components/query/DataSpaceQuerySetup.tsx +10 -14
- package/src/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.tsx +2 -6
- package/src/stores/query/DSLDataSpace_LegendQueryRouter.ts +17 -15
- package/src/stores/query/DataSpaceInfo.ts +57 -0
- package/src/stores/query/DataSpaceQueryBuilderState.ts +178 -0
- package/src/stores/query/DataSpaceQueryCreatorStore.ts +241 -0
- package/src/stores/query/DataSpaceQuerySetupState.ts +18 -32
- package/tsconfig.json +7 -3
- package/tsconfig.package.json +1 -1
- package/lib/components/query/DataSpaceQueryEditor.d.ts.map +0 -1
- package/lib/components/query/DataSpaceQueryEditor.js.map +0 -1
- package/lib/stores/query/DataSpaceQueryEditorStore.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceQueryEditorStore.js +0 -98
- package/lib/stores/query/DataSpaceQueryEditorStore.js.map +0 -1
- package/src/stores/query/DataSpaceQueryEditorStore.ts +0 -173
|
@@ -0,0 +1,178 @@
|
|
|
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 type { GenericLegendApplicationStore } from '@finos/legend-application';
|
|
18
|
+
import { QueryBuilderState } from '@finos/legend-application-query';
|
|
19
|
+
import {
|
|
20
|
+
type GraphManagerState,
|
|
21
|
+
getMappingCompatibleClasses,
|
|
22
|
+
RuntimePointer,
|
|
23
|
+
type Runtime,
|
|
24
|
+
type Class,
|
|
25
|
+
} from '@finos/legend-graph';
|
|
26
|
+
import {
|
|
27
|
+
DepotScope,
|
|
28
|
+
SNAPSHOT_VERSION_ALIAS,
|
|
29
|
+
type DepotServerClient,
|
|
30
|
+
type StoredEntity,
|
|
31
|
+
} from '@finos/legend-server-depot';
|
|
32
|
+
import {
|
|
33
|
+
type GeneratorFn,
|
|
34
|
+
ActionState,
|
|
35
|
+
assertErrorThrown,
|
|
36
|
+
getNullableFirstElement,
|
|
37
|
+
} from '@finos/legend-shared';
|
|
38
|
+
import { action, flow, makeObservable, observable } from 'mobx';
|
|
39
|
+
import { renderDataSpaceQueryBuilderSetupPanelContent } from '../../components/query/DataSpaceQueryBuilder.js';
|
|
40
|
+
import {
|
|
41
|
+
DEFAULT_DATA_SPACE_LOADER_LIMIT,
|
|
42
|
+
MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH,
|
|
43
|
+
} from '../../DSLDataSpace_Const.js';
|
|
44
|
+
import type {
|
|
45
|
+
DataSpace,
|
|
46
|
+
DataSpaceExecutionContext,
|
|
47
|
+
} from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.js';
|
|
48
|
+
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graphManager/protocol/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
|
|
49
|
+
import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
|
|
50
|
+
|
|
51
|
+
export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
52
|
+
readonly dataSpace: DataSpace;
|
|
53
|
+
readonly groupId: string;
|
|
54
|
+
readonly artifactId: string;
|
|
55
|
+
readonly versionId: string;
|
|
56
|
+
readonly depotServerClient: DepotServerClient;
|
|
57
|
+
readonly loadDataSpacesState = ActionState.create();
|
|
58
|
+
readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
|
|
59
|
+
readonly onExecutionContextChange?:
|
|
60
|
+
| ((val: DataSpaceExecutionContext) => void)
|
|
61
|
+
| undefined;
|
|
62
|
+
readonly onRuntimeChange?: ((val: Runtime) => void) | undefined;
|
|
63
|
+
readonly onClassChange?: ((val: Class) => void) | undefined;
|
|
64
|
+
|
|
65
|
+
override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
|
|
66
|
+
renderDataSpaceQueryBuilderSetupPanelContent(this);
|
|
67
|
+
|
|
68
|
+
executionContext!: DataSpaceExecutionContext;
|
|
69
|
+
dataSpaces: DataSpaceInfo[] = [];
|
|
70
|
+
showRuntimeSelector = false;
|
|
71
|
+
|
|
72
|
+
constructor(
|
|
73
|
+
applicationStore: GenericLegendApplicationStore,
|
|
74
|
+
graphManagerState: GraphManagerState,
|
|
75
|
+
depotServerClient: DepotServerClient,
|
|
76
|
+
dataSpace: DataSpace,
|
|
77
|
+
executionContext: DataSpaceExecutionContext,
|
|
78
|
+
groupId: string,
|
|
79
|
+
versionId: string,
|
|
80
|
+
artifactId: string,
|
|
81
|
+
onDataSpaceChange: (val: DataSpaceInfo) => void,
|
|
82
|
+
onExecutionContextChange?:
|
|
83
|
+
| ((val: DataSpaceExecutionContext) => void)
|
|
84
|
+
| undefined,
|
|
85
|
+
onRuntimeChange?: ((val: Runtime) => void) | undefined,
|
|
86
|
+
onClassChange?: ((val: Class) => void) | undefined,
|
|
87
|
+
) {
|
|
88
|
+
super(applicationStore, graphManagerState);
|
|
89
|
+
|
|
90
|
+
makeObservable(this, {
|
|
91
|
+
dataSpaces: observable,
|
|
92
|
+
executionContext: observable,
|
|
93
|
+
showRuntimeSelector: observable,
|
|
94
|
+
setExecutionContext: action,
|
|
95
|
+
setShowRuntimeSelector: action,
|
|
96
|
+
loadDataSpaces: flow,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
this.depotServerClient = depotServerClient;
|
|
100
|
+
this.dataSpace = dataSpace;
|
|
101
|
+
this.executionContext = executionContext;
|
|
102
|
+
this.groupId = groupId;
|
|
103
|
+
this.artifactId = artifactId;
|
|
104
|
+
this.versionId = versionId;
|
|
105
|
+
this.onDataSpaceChange = onDataSpaceChange;
|
|
106
|
+
this.onExecutionContextChange = onExecutionContextChange;
|
|
107
|
+
this.onRuntimeChange = onRuntimeChange;
|
|
108
|
+
this.onClassChange = onClassChange;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
override get sideBarClassName(): string | undefined {
|
|
112
|
+
return this.showRuntimeSelector
|
|
113
|
+
? 'query-builder__setup__data-space--with-runtime'
|
|
114
|
+
: 'query-builder__setup__data-space';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
setExecutionContext(val: DataSpaceExecutionContext): void {
|
|
118
|
+
this.executionContext = val;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setShowRuntimeSelector(val: boolean): void {
|
|
122
|
+
this.showRuntimeSelector = val;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
*loadDataSpaces(searchText: string): GeneratorFn<void> {
|
|
126
|
+
const isValidSearchString =
|
|
127
|
+
searchText.length >= MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH;
|
|
128
|
+
this.loadDataSpacesState.inProgress();
|
|
129
|
+
const toGetSnapShot = this.versionId === SNAPSHOT_VERSION_ALIAS;
|
|
130
|
+
try {
|
|
131
|
+
this.dataSpaces = (
|
|
132
|
+
(yield this.depotServerClient.getEntitiesByClassifierPath(
|
|
133
|
+
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
134
|
+
{
|
|
135
|
+
search: isValidSearchString ? searchText : undefined,
|
|
136
|
+
scope: toGetSnapShot ? DepotScope.SNAPSHOT : DepotScope.RELEASES,
|
|
137
|
+
limit: DEFAULT_DATA_SPACE_LOADER_LIMIT,
|
|
138
|
+
},
|
|
139
|
+
)) as StoredEntity[]
|
|
140
|
+
).map((storedEntity) =>
|
|
141
|
+
extractDataSpaceInfo(storedEntity, toGetSnapShot),
|
|
142
|
+
);
|
|
143
|
+
this.loadDataSpacesState.pass();
|
|
144
|
+
} catch (error) {
|
|
145
|
+
assertErrorThrown(error);
|
|
146
|
+
this.loadDataSpacesState.fail();
|
|
147
|
+
this.applicationStore.notifyError(error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Propagation after changing the execution context:
|
|
153
|
+
* - The mapping will be updated to the mapping of the execution context
|
|
154
|
+
* - The runtime will be updated to the default runtime of the execution context
|
|
155
|
+
* - If no class is selected, try to select a compatible class
|
|
156
|
+
* - If the chosen class is compatible with the new selected execution context mapping, do nothing, otherwise, try to select a compatible class
|
|
157
|
+
*/
|
|
158
|
+
propagateExecutionContextChange(
|
|
159
|
+
executionContext: DataSpaceExecutionContext,
|
|
160
|
+
): void {
|
|
161
|
+
const mapping = executionContext.mapping.value;
|
|
162
|
+
this.changeMapping(mapping);
|
|
163
|
+
this.changeRuntime(new RuntimePointer(executionContext.defaultRuntime));
|
|
164
|
+
|
|
165
|
+
const compatibleClasses = getMappingCompatibleClasses(
|
|
166
|
+
mapping,
|
|
167
|
+
this.graphManagerState.usableClasses,
|
|
168
|
+
);
|
|
169
|
+
// if there is no chosen class or the chosen one is not compatible
|
|
170
|
+
// with the mapping then pick a compatible class if possible
|
|
171
|
+
if (!this.class || !compatibleClasses.includes(this.class)) {
|
|
172
|
+
const possibleNewClass = getNullableFirstElement(compatibleClasses);
|
|
173
|
+
if (possibleNewClass) {
|
|
174
|
+
this.changeClass(possibleNewClass);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
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
|
+
RuntimePointer,
|
|
22
|
+
PackageableElementExplicitReference,
|
|
23
|
+
type Runtime,
|
|
24
|
+
type Class,
|
|
25
|
+
} from '@finos/legend-graph';
|
|
26
|
+
import {
|
|
27
|
+
QueryEditorStore,
|
|
28
|
+
type QueryExportConfiguration,
|
|
29
|
+
type LegendQueryPluginManager,
|
|
30
|
+
type LegendQueryApplicationStore,
|
|
31
|
+
type QueryBuilderState,
|
|
32
|
+
} from '@finos/legend-application-query';
|
|
33
|
+
import type {
|
|
34
|
+
DepotServerClient,
|
|
35
|
+
ProjectGAVCoordinates,
|
|
36
|
+
} from '@finos/legend-server-depot';
|
|
37
|
+
import {
|
|
38
|
+
guaranteeNonNullable,
|
|
39
|
+
guaranteeType,
|
|
40
|
+
uuid,
|
|
41
|
+
} from '@finos/legend-shared';
|
|
42
|
+
import {
|
|
43
|
+
QUERY_PROFILE_PATH,
|
|
44
|
+
QUERY_PROFILE_TAG_DATA_SPACE,
|
|
45
|
+
} from '../../DSLDataSpace_Const.js';
|
|
46
|
+
import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
|
|
47
|
+
import { DataSpaceQueryBuilderState } from './DataSpaceQueryBuilderState.js';
|
|
48
|
+
import type { DataSpaceInfo } from './DataSpaceInfo.js';
|
|
49
|
+
import { generateDataSpaceQueryCreatorRoute } from './DSLDataSpace_LegendQueryRouter.js';
|
|
50
|
+
import type { DataSpaceExecutionContext } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.js';
|
|
51
|
+
|
|
52
|
+
export const createQueryDataSpaceTaggedValue = (
|
|
53
|
+
dataSpacePath: string,
|
|
54
|
+
): QueryTaggedValue => {
|
|
55
|
+
const taggedValue = new QueryTaggedValue();
|
|
56
|
+
taggedValue.profile = QUERY_PROFILE_PATH;
|
|
57
|
+
taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
|
|
58
|
+
taggedValue.value = dataSpacePath;
|
|
59
|
+
return taggedValue;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
63
|
+
groupId: string;
|
|
64
|
+
artifactId: string;
|
|
65
|
+
versionId: string;
|
|
66
|
+
dataSpacePath: string;
|
|
67
|
+
executionContext: string;
|
|
68
|
+
runtimePath: string | undefined;
|
|
69
|
+
classPath: string | undefined;
|
|
70
|
+
|
|
71
|
+
constructor(
|
|
72
|
+
applicationStore: LegendQueryApplicationStore,
|
|
73
|
+
depotServerClient: DepotServerClient,
|
|
74
|
+
pluginManager: LegendQueryPluginManager,
|
|
75
|
+
groupId: string,
|
|
76
|
+
artifactId: string,
|
|
77
|
+
versionId: string,
|
|
78
|
+
dataSpacePath: string,
|
|
79
|
+
executionContext: string,
|
|
80
|
+
runtimePath: string | undefined,
|
|
81
|
+
executionKey: string | undefined,
|
|
82
|
+
) {
|
|
83
|
+
super(applicationStore, depotServerClient, pluginManager);
|
|
84
|
+
|
|
85
|
+
this.groupId = groupId;
|
|
86
|
+
this.artifactId = artifactId;
|
|
87
|
+
this.versionId = versionId;
|
|
88
|
+
this.dataSpacePath = dataSpacePath;
|
|
89
|
+
this.executionContext = executionContext;
|
|
90
|
+
this.runtimePath = runtimePath;
|
|
91
|
+
this.classPath = executionKey;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getProjectInfo(): ProjectGAVCoordinates {
|
|
95
|
+
return {
|
|
96
|
+
groupId: this.groupId,
|
|
97
|
+
artifactId: this.artifactId,
|
|
98
|
+
versionId: this.versionId,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async initializeQueryBuilderState(): Promise<QueryBuilderState> {
|
|
103
|
+
const dataSpace = getDataSpace(
|
|
104
|
+
this.dataSpacePath,
|
|
105
|
+
this.graphManagerState.graph,
|
|
106
|
+
);
|
|
107
|
+
const executionContext = guaranteeNonNullable(
|
|
108
|
+
dataSpace.executionContexts.find(
|
|
109
|
+
(context) => context.name === this.executionContext,
|
|
110
|
+
),
|
|
111
|
+
`Can't find execution context '${this.executionContext}'`,
|
|
112
|
+
);
|
|
113
|
+
const queryBuilderState = new DataSpaceQueryBuilderState(
|
|
114
|
+
this.applicationStore,
|
|
115
|
+
this.graphManagerState,
|
|
116
|
+
this.depotServerClient,
|
|
117
|
+
dataSpace,
|
|
118
|
+
executionContext,
|
|
119
|
+
this.groupId,
|
|
120
|
+
this.artifactId,
|
|
121
|
+
this.versionId,
|
|
122
|
+
(dataSpaceInfo: DataSpaceInfo) => {
|
|
123
|
+
if (dataSpaceInfo.defaultExecutionContext) {
|
|
124
|
+
this.applicationStore.navigator.jumpTo(
|
|
125
|
+
generateDataSpaceQueryCreatorRoute(
|
|
126
|
+
dataSpaceInfo.groupId,
|
|
127
|
+
dataSpaceInfo.artifactId,
|
|
128
|
+
dataSpaceInfo.versionId,
|
|
129
|
+
dataSpaceInfo.path,
|
|
130
|
+
dataSpaceInfo.defaultExecutionContext,
|
|
131
|
+
undefined,
|
|
132
|
+
undefined,
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
} else {
|
|
136
|
+
this.applicationStore.notifyWarning(
|
|
137
|
+
`Can't switch data space: default execution context not specified`,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
(ec: DataSpaceExecutionContext) => {
|
|
142
|
+
// runtime should already be set
|
|
143
|
+
const runtimePointer = guaranteeType(
|
|
144
|
+
queryBuilderState.runtimeValue,
|
|
145
|
+
RuntimePointer,
|
|
146
|
+
);
|
|
147
|
+
this.applicationStore.navigator.goTo(
|
|
148
|
+
generateDataSpaceQueryCreatorRoute(
|
|
149
|
+
this.groupId,
|
|
150
|
+
this.artifactId,
|
|
151
|
+
this.versionId,
|
|
152
|
+
dataSpace.path,
|
|
153
|
+
ec.name,
|
|
154
|
+
runtimePointer.packageableRuntime.value ===
|
|
155
|
+
queryBuilderState.executionContext.defaultRuntime.value
|
|
156
|
+
? undefined
|
|
157
|
+
: runtimePointer.packageableRuntime.value.path,
|
|
158
|
+
queryBuilderState.class?.path,
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
},
|
|
162
|
+
(runtimeValue: Runtime) => {
|
|
163
|
+
const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
|
|
164
|
+
queryBuilderState.applicationStore.navigator.goTo(
|
|
165
|
+
generateDataSpaceQueryCreatorRoute(
|
|
166
|
+
queryBuilderState.groupId,
|
|
167
|
+
queryBuilderState.artifactId,
|
|
168
|
+
queryBuilderState.versionId,
|
|
169
|
+
queryBuilderState.dataSpace.path,
|
|
170
|
+
queryBuilderState.executionContext.name,
|
|
171
|
+
runtimePointer.packageableRuntime.value ===
|
|
172
|
+
queryBuilderState.executionContext.defaultRuntime.value
|
|
173
|
+
? undefined
|
|
174
|
+
: runtimePointer.packageableRuntime.value.path,
|
|
175
|
+
queryBuilderState.class?.path,
|
|
176
|
+
),
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
(_class: Class) => {
|
|
180
|
+
// runtime should already be set
|
|
181
|
+
const runtimePointer = guaranteeType(
|
|
182
|
+
queryBuilderState.runtimeValue,
|
|
183
|
+
RuntimePointer,
|
|
184
|
+
);
|
|
185
|
+
queryBuilderState.applicationStore.navigator.goTo(
|
|
186
|
+
generateDataSpaceQueryCreatorRoute(
|
|
187
|
+
queryBuilderState.groupId,
|
|
188
|
+
queryBuilderState.artifactId,
|
|
189
|
+
queryBuilderState.versionId,
|
|
190
|
+
queryBuilderState.dataSpace.path,
|
|
191
|
+
queryBuilderState.executionContext.name,
|
|
192
|
+
runtimePointer.packageableRuntime.value ===
|
|
193
|
+
queryBuilderState.executionContext.defaultRuntime.value
|
|
194
|
+
? undefined
|
|
195
|
+
: runtimePointer.packageableRuntime.value.path,
|
|
196
|
+
_class.path,
|
|
197
|
+
),
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
);
|
|
201
|
+
queryBuilderState.setExecutionContext(executionContext);
|
|
202
|
+
queryBuilderState.propagateExecutionContextChange(executionContext);
|
|
203
|
+
|
|
204
|
+
// set runtime if already chosen
|
|
205
|
+
if (this.runtimePath) {
|
|
206
|
+
queryBuilderState.changeRuntime(
|
|
207
|
+
new RuntimePointer(
|
|
208
|
+
PackageableElementExplicitReference.create(
|
|
209
|
+
this.graphManagerState.graph.getRuntime(this.runtimePath),
|
|
210
|
+
),
|
|
211
|
+
),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// set class if already chosen
|
|
216
|
+
if (this.classPath) {
|
|
217
|
+
queryBuilderState.changeClass(
|
|
218
|
+
this.graphManagerState.graph.getClass(this.classPath),
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return queryBuilderState;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async getExportConfiguration(): Promise<QueryExportConfiguration> {
|
|
226
|
+
return {
|
|
227
|
+
defaultName: `New Query for ${extractElementNameFromPath(
|
|
228
|
+
this.dataSpacePath,
|
|
229
|
+
)}[${this.executionContext}]`,
|
|
230
|
+
decorator: (query: Query): void => {
|
|
231
|
+
query.id = uuid();
|
|
232
|
+
query.groupId = this.groupId;
|
|
233
|
+
query.artifactId = this.artifactId;
|
|
234
|
+
query.versionId = this.versionId;
|
|
235
|
+
query.taggedValues = [
|
|
236
|
+
createQueryDataSpaceTaggedValue(this.dataSpacePath),
|
|
237
|
+
];
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import type { ClassView } from '@finos/legend-extension-dsl-diagram';
|
|
18
18
|
import type { Class } from '@finos/legend-graph';
|
|
19
|
-
import {
|
|
19
|
+
import type { Entity } from '@finos/legend-storage';
|
|
20
20
|
import {
|
|
21
21
|
type QuerySetupStore,
|
|
22
22
|
QuerySetupState,
|
|
@@ -26,36 +26,30 @@ import {
|
|
|
26
26
|
type StoredEntity,
|
|
27
27
|
DepotScope,
|
|
28
28
|
ProjectData,
|
|
29
|
-
SNAPSHOT_VERSION_ALIAS,
|
|
30
29
|
} from '@finos/legend-server-depot';
|
|
31
30
|
import {
|
|
32
31
|
type GeneratorFn,
|
|
33
32
|
type PlainObject,
|
|
34
33
|
ActionState,
|
|
35
34
|
assertErrorThrown,
|
|
36
|
-
isString,
|
|
37
35
|
} from '@finos/legend-shared';
|
|
38
36
|
import { action, flow, flowResult, makeObservable, observable } from 'mobx';
|
|
39
37
|
import type { DataSpaceAnalysisResult } from '../../graphManager/action/analytics/DataSpaceAnalysis.js';
|
|
40
38
|
import { getDSLDataSpaceGraphManagerExtension } from '../../graphManager/protocol/pure/DSLDataSpace_PureGraphManagerExtension.js';
|
|
41
39
|
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graphManager/protocol/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
|
|
42
40
|
import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
title: string | undefined;
|
|
50
|
-
name: string;
|
|
51
|
-
path: string;
|
|
52
|
-
}
|
|
41
|
+
import { generateDataSpaceQueryCreatorRoute } from './DSLDataSpace_LegendQueryRouter.js';
|
|
42
|
+
import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
|
|
43
|
+
import {
|
|
44
|
+
DEFAULT_DATA_SPACE_LOADER_LIMIT,
|
|
45
|
+
MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH,
|
|
46
|
+
} from '../../DSLDataSpace_Const.js';
|
|
53
47
|
|
|
54
48
|
export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
55
|
-
dataSpaces:
|
|
49
|
+
dataSpaces: DataSpaceInfo[] = [];
|
|
56
50
|
loadDataSpacesState = ActionState.create();
|
|
57
51
|
loadDataSpaceState = ActionState.create();
|
|
58
|
-
currentDataSpace?:
|
|
52
|
+
currentDataSpace?: DataSpaceInfo | undefined;
|
|
59
53
|
dataSpaceViewerState?: DataSpaceViewerState | undefined;
|
|
60
54
|
toGetSnapShot = false;
|
|
61
55
|
|
|
@@ -76,7 +70,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
|
76
70
|
});
|
|
77
71
|
}
|
|
78
72
|
|
|
79
|
-
setCurrentDataSpace(val:
|
|
73
|
+
setCurrentDataSpace(val: DataSpaceInfo | undefined): void {
|
|
80
74
|
this.currentDataSpace = val;
|
|
81
75
|
}
|
|
82
76
|
|
|
@@ -89,7 +83,8 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
|
89
83
|
}
|
|
90
84
|
|
|
91
85
|
*loadDataSpaces(searchText: string): GeneratorFn<void> {
|
|
92
|
-
const isValidSearchString =
|
|
86
|
+
const isValidSearchString =
|
|
87
|
+
searchText.length >= MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH;
|
|
93
88
|
this.loadDataSpacesState.inProgress();
|
|
94
89
|
try {
|
|
95
90
|
this.dataSpaces = (
|
|
@@ -100,21 +95,12 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
|
100
95
|
scope: this.toGetSnapShot
|
|
101
96
|
? DepotScope.SNAPSHOT
|
|
102
97
|
: DepotScope.RELEASES,
|
|
103
|
-
limit:
|
|
98
|
+
limit: DEFAULT_DATA_SPACE_LOADER_LIMIT,
|
|
104
99
|
},
|
|
105
100
|
)) as StoredEntity[]
|
|
106
|
-
).map((storedEntity) =>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
versionId: this.toGetSnapShot
|
|
110
|
-
? SNAPSHOT_VERSION_ALIAS
|
|
111
|
-
: storedEntity.versionId,
|
|
112
|
-
path: storedEntity.entity.path,
|
|
113
|
-
name: extractEntityNameFromPath(storedEntity.entity.path),
|
|
114
|
-
title: isString(storedEntity.entity.content.title)
|
|
115
|
-
? storedEntity.entity.content.title
|
|
116
|
-
: undefined,
|
|
117
|
-
}));
|
|
101
|
+
).map((storedEntity) =>
|
|
102
|
+
extractDataSpaceInfo(storedEntity, this.toGetSnapShot),
|
|
103
|
+
);
|
|
118
104
|
this.loadDataSpacesState.pass();
|
|
119
105
|
} catch (error) {
|
|
120
106
|
assertErrorThrown(error);
|
|
@@ -123,7 +109,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
|
123
109
|
}
|
|
124
110
|
}
|
|
125
111
|
|
|
126
|
-
*loadDataSpace(dataSpace:
|
|
112
|
+
*loadDataSpace(dataSpace: DataSpaceInfo): GeneratorFn<void> {
|
|
127
113
|
this.loadDataSpaceState.inProgress();
|
|
128
114
|
this.loadDataSpaceState.setMessage(`Initializing...`);
|
|
129
115
|
|
|
@@ -204,7 +190,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
|
|
|
204
190
|
*proceedToCreateQuery(_class?: Class): GeneratorFn<void> {
|
|
205
191
|
if (this.dataSpaceViewerState) {
|
|
206
192
|
this.setupStore.applicationStore.navigator.goTo(
|
|
207
|
-
|
|
193
|
+
generateDataSpaceQueryCreatorRoute(
|
|
208
194
|
this.dataSpaceViewerState.groupId,
|
|
209
195
|
this.dataSpaceViewerState.artifactId,
|
|
210
196
|
this.dataSpaceViewerState.versionId,
|
package/tsconfig.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"noImplicitOverride": true,
|
|
22
22
|
"noUncheckedIndexedAccess": true,
|
|
23
23
|
"exactOptionalPropertyTypes": true,
|
|
24
|
-
"forceConsistentCasingInFileNames":
|
|
24
|
+
"forceConsistentCasingInFileNames": true,
|
|
25
25
|
"outDir": "./lib",
|
|
26
26
|
"tsBuildInfoFile": "./build/prod.tsbuildinfo",
|
|
27
27
|
"rootDir": "./src",
|
|
@@ -55,11 +55,15 @@
|
|
|
55
55
|
"./src/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts",
|
|
56
56
|
"./src/stores/DataSpaceViewerState.ts",
|
|
57
57
|
"./src/stores/query/DSLDataSpace_LegendQueryRouter.ts",
|
|
58
|
-
"./src/stores/query/
|
|
58
|
+
"./src/stores/query/DataSpaceInfo.ts",
|
|
59
|
+
"./src/stores/query/DataSpaceQueryBuilderState.ts",
|
|
60
|
+
"./src/stores/query/DataSpaceQueryCreatorStore.ts",
|
|
59
61
|
"./src/stores/query/DataSpaceQuerySetupState.ts",
|
|
62
|
+
"./src/components/DSLDataSpace_Icon.tsx",
|
|
60
63
|
"./src/components/DataSpaceViewer.tsx",
|
|
61
64
|
"./src/components/query/DSLDataSpace_LegendQueryApplicationPlugin.tsx",
|
|
62
|
-
"./src/components/query/
|
|
65
|
+
"./src/components/query/DataSpaceQueryBuilder.tsx",
|
|
66
|
+
"./src/components/query/DataSpaceQueryCreator.tsx",
|
|
63
67
|
"./src/components/query/DataSpaceQuerySetup.tsx",
|
|
64
68
|
"./src/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.tsx",
|
|
65
69
|
"./src/graphManager/protocol/pure/v1/V1_DSLDataSpace_SystemModels.json"
|
package/tsconfig.package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"noImplicitOverride": true,
|
|
22
22
|
"noUncheckedIndexedAccess": true,
|
|
23
23
|
"exactOptionalPropertyTypes": true,
|
|
24
|
-
"forceConsistentCasingInFileNames":
|
|
24
|
+
"forceConsistentCasingInFileNames": true,
|
|
25
25
|
"outDir": "./lib",
|
|
26
26
|
"tsBuildInfoFile": "./build/package.tsbuildinfo",
|
|
27
27
|
"rootDir": "./"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceQueryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/query/DataSpaceQueryEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAkEH,eAAO,MAAM,oBAAoB;;CAyB/B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceQueryEditor.js","sourceRoot":"","sources":["../../../src/components/query/DataSpaceQueryEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,WAAW,EACX,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAGL,wCAAwC,GACzC,MAAM,sDAAsD,CAAC;AAE9D,MAAM,iCAAiC,GAOlC,CAAC,EACJ,QAAQ,EACR,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,SAAS,GACV,EAAE,EAAE;IACH,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACpE,MAAM,gBAAgB,GAAG,8BAA8B,EAAE,CAAC;IAC1D,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;IACjD,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,kBAAkB,CAC9B,GAAG,EAAE,CACH,IAAI,yBAAyB,CAC3B,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,CAAC,aAAa,EACvB,OAAO,EACP,UAAU,EACV,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,SAAS,CACV,CACJ,CAAC;IACF,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC3C,QAAQ,GACwB,CACpC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,GAAG,EAAE;IAChD,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,SAAS,EAAkC,CAAC;IAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACtD,MAAM,aAAa,GACjB,MAAM,CAAC,wCAAwC,CAAC,eAAe,CAAC,CAAC;IACnE,MAAM,gBAAgB,GACpB,MAAM,CAAC,wCAAwC,CAAC,iBAAiB,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,kBAAkB,CAClC,gBAAgB,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAC/C,IAAI,CACL,CAAC,8BAA8B,CAAC,UAAU,CAAC,CAAC;IAE7C,OAAO,CACL,KAAC,iCAAiC,IAChC,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,YAEpB,KAAC,WAAW,KAAG,GACmB,CACrC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceQueryEditorStore.d.ts","sourceRoot":"","sources":["../../../src/stores/query/DataSpaceQueryEditorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,OAAO,EACL,gBAAgB,EAChB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAsBpC,qBAAa,yBAA0B,SAAQ,gBAAgB;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAG5B,gBAAgB,EAAE,2BAA2B,EAC7C,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,EAAE,MAAM,GAAG,SAAS;IAalC,cAAc,IAAI,qBAAqB;IAQjC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IA4DlC,sBAAsB,IAAI,OAAO,CAAC,wBAAwB,CAAC;CAgBlE"}
|
|
@@ -1,98 +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 { extractElementNameFromPath, QueryTaggedValue, RuntimePointer, PackageableElementExplicitReference, getAllClassMappings, isSystemElement, } from '@finos/legend-graph';
|
|
17
|
-
import { QueryEditorStore, } from '@finos/legend-application-query';
|
|
18
|
-
import { getNullableFirstElement, guaranteeNonNullable, uuid, } from '@finos/legend-shared';
|
|
19
|
-
import { QUERY_PROFILE_PATH, QUERY_PROFILE_TAG_DATA_SPACE, } from '../../DSLDataSpace_Const.js';
|
|
20
|
-
import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
|
|
21
|
-
const createQueryDataSpaceTaggedValue = (dataSpacePath) => {
|
|
22
|
-
const taggedValue = new QueryTaggedValue();
|
|
23
|
-
taggedValue.profile = QUERY_PROFILE_PATH;
|
|
24
|
-
taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
|
|
25
|
-
taggedValue.value = dataSpacePath;
|
|
26
|
-
return taggedValue;
|
|
27
|
-
};
|
|
28
|
-
export class DataSpaceQueryEditorStore extends QueryEditorStore {
|
|
29
|
-
groupId;
|
|
30
|
-
artifactId;
|
|
31
|
-
versionId;
|
|
32
|
-
dataSpacePath;
|
|
33
|
-
executionContext;
|
|
34
|
-
runtimePath;
|
|
35
|
-
classPath;
|
|
36
|
-
constructor(applicationStore, depotServerClient, pluginManager, groupId, artifactId, versionId, dataSpacePath, executionContext, runtimePath, executionKey) {
|
|
37
|
-
super(applicationStore, depotServerClient, pluginManager);
|
|
38
|
-
this.groupId = groupId;
|
|
39
|
-
this.artifactId = artifactId;
|
|
40
|
-
this.versionId = versionId;
|
|
41
|
-
this.dataSpacePath = dataSpacePath;
|
|
42
|
-
this.executionContext = executionContext;
|
|
43
|
-
this.runtimePath = runtimePath;
|
|
44
|
-
this.classPath = executionKey;
|
|
45
|
-
}
|
|
46
|
-
getProjectInfo() {
|
|
47
|
-
return {
|
|
48
|
-
groupId: this.groupId,
|
|
49
|
-
artifactId: this.artifactId,
|
|
50
|
-
versionId: this.versionId,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
async setUpBuilderState() {
|
|
54
|
-
this.queryBuilderState.querySetupState.setMappingIsReadOnly(true);
|
|
55
|
-
this.queryBuilderState.querySetupState.setRuntimeIsReadOnly(true);
|
|
56
|
-
const dataSpace = getDataSpace(this.dataSpacePath, this.graphManagerState.graph);
|
|
57
|
-
const executionContext = guaranteeNonNullable(dataSpace.executionContexts.find((context) => context.name === this.executionContext), `Can't find execution context '${this.executionContext}'`);
|
|
58
|
-
this.queryBuilderState.querySetupState.setMapping(executionContext.mapping.value);
|
|
59
|
-
this.queryBuilderState.querySetupState.setRuntimeValue(new RuntimePointer(PackageableElementExplicitReference.create(this.runtimePath
|
|
60
|
-
? this.graphManagerState.graph.getRuntime(this.runtimePath)
|
|
61
|
-
: executionContext.defaultRuntime.value)));
|
|
62
|
-
if (this.classPath) {
|
|
63
|
-
this.queryBuilderState.changeClass(this.queryBuilderState.graphManagerState.graph.getClass(this.classPath));
|
|
64
|
-
this.queryBuilderState.querySetupState.setClassIsReadOnly(true);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// try to find a class to set
|
|
68
|
-
// first, find classes which is mapped by the mapping
|
|
69
|
-
// then, find any classes except for class coming from system
|
|
70
|
-
// if none found, default to a dummy blank query
|
|
71
|
-
const defaultClass = getNullableFirstElement(this.queryBuilderState.querySetupState.mapping
|
|
72
|
-
? getAllClassMappings(this.queryBuilderState.querySetupState.mapping).map((classMapping) => classMapping.class.value)
|
|
73
|
-
: []) ??
|
|
74
|
-
getNullableFirstElement(this.queryBuilderState.graphManagerState.graph.classes.filter((el) => !isSystemElement(el)));
|
|
75
|
-
if (defaultClass) {
|
|
76
|
-
this.queryBuilderState.changeClass(defaultClass);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.queryBuilderState.initialize(this.queryBuilderState.graphManagerState.graphManager.createDefaultBasicRawLambda());
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async getExportConfiguration() {
|
|
84
|
-
return {
|
|
85
|
-
defaultName: `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${this.executionContext}]`,
|
|
86
|
-
decorator: (query) => {
|
|
87
|
-
query.id = uuid();
|
|
88
|
-
query.groupId = this.groupId;
|
|
89
|
-
query.artifactId = this.artifactId;
|
|
90
|
-
query.versionId = this.versionId;
|
|
91
|
-
query.taggedValues = [
|
|
92
|
-
createQueryDataSpaceTaggedValue(this.dataSpacePath),
|
|
93
|
-
];
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=DataSpaceQueryEditorStore.js.map
|