@finos/legend-extension-dsl-data-space 10.2.4 → 10.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. package/lib/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.d.ts +1 -1
  2. package/lib/__lib__/query/DSL_DataSpace_LegendQueryDocumentation.d.ts.map +1 -0
  3. package/lib/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.js +4 -4
  4. package/lib/__lib__/query/DSL_DataSpace_LegendQueryDocumentation.js.map +1 -0
  5. package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.d.ts +15 -0
  6. package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.d.ts.map +1 -0
  7. package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.js +32 -0
  8. package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.js.map +1 -0
  9. package/lib/__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.d.ts +38 -0
  10. package/lib/__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.d.ts.map +1 -0
  11. package/lib/__lib__/{query/DSL_DataSpace_LegendQueryNavigation.js → to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js} +33 -13
  12. package/lib/__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js.map +1 -0
  13. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +3 -3
  14. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  15. package/lib/components/index.d.ts +6 -4
  16. package/lib/components/index.d.ts.map +1 -1
  17. package/lib/components/index.js +6 -4
  18. package/lib/components/index.js.map +1 -1
  19. package/lib/components/query-builder/DataSpaceAdvancedSearchModal.d.ts.map +1 -0
  20. package/lib/components/query-builder/DataSpaceAdvancedSearchModal.js.map +1 -0
  21. package/lib/components/{query → query-builder}/DataSpaceQueryBuilder.d.ts +2 -5
  22. package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -0
  23. package/lib/components/{query → query-builder}/DataSpaceQueryBuilder.js +5 -24
  24. package/lib/components/query-builder/DataSpaceQueryBuilder.js.map +1 -0
  25. package/lib/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts +1 -1
  26. package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -0
  27. package/lib/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.js +4 -4
  28. package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -0
  29. package/lib/components/query-builder/QueryDataSpaceUtil.d.ts.map +1 -0
  30. package/lib/components/query-builder/QueryDataSpaceUtil.js.map +1 -0
  31. package/lib/components/{query → query-builder}/index.d.ts +3 -1
  32. package/lib/components/query-builder/index.d.ts.map +1 -0
  33. package/lib/components/{query → query-builder}/index.js +3 -1
  34. package/lib/components/query-builder/index.js.map +1 -0
  35. package/lib/components/shared/DSL_DataSpace_Icon.d.ts.map +1 -0
  36. package/lib/components/shared/DSL_DataSpace_Icon.js.map +1 -0
  37. package/lib/graph-manager/index.d.ts +4 -0
  38. package/lib/graph-manager/index.d.ts.map +1 -1
  39. package/lib/graph-manager/index.js +5 -0
  40. package/lib/graph-manager/index.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +3 -8
  44. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +1 -1
  45. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  46. package/lib/stores/query/DataSpaceAdvancedSearchState.js +2 -3
  47. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  48. package/lib/stores/{query → query-builder}/DataSpaceQueryBuilderState.d.ts +2 -2
  49. package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -0
  50. package/lib/stores/{query → query-builder}/DataSpaceQueryBuilderState.js +3 -3
  51. package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -0
  52. package/lib/stores/shared/DataSpaceInfo.d.ts.map +1 -0
  53. package/lib/stores/shared/DataSpaceInfo.js.map +1 -0
  54. package/lib/{__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.d.ts → stores/shared/DataSpaceUtils.d.ts} +4 -5
  55. package/lib/stores/shared/DataSpaceUtils.d.ts.map +1 -0
  56. package/lib/stores/shared/DataSpaceUtils.js +32 -0
  57. package/lib/stores/shared/DataSpaceUtils.js.map +1 -0
  58. package/package.json +4 -9
  59. package/src/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.ts +1 -1
  60. package/src/__lib__/shared/DSL_DataSpace_LegendNavigation.ts +57 -0
  61. package/src/__lib__/{query/DSL_DataSpace_LegendQueryNavigation.ts → to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.ts} +41 -46
  62. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +6 -6
  63. package/src/components/index.ts +15 -4
  64. package/src/components/{query → query-builder}/DataSpaceAdvancedSearchModal.tsx +1 -1
  65. package/src/components/{query → query-builder}/DataSpaceQueryBuilder.tsx +7 -68
  66. package/src/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +5 -5
  67. package/src/components/{studio → query-builder}/index.ts +7 -1
  68. package/src/graph-manager/index.ts +6 -0
  69. package/src/stores/query/DataSpaceAdvancedSearchState.ts +8 -3
  70. package/src/stores/{query → query-builder}/DataSpaceQueryBuilderState.ts +6 -3
  71. package/src/stores/shared/DataSpaceUtils.ts +42 -0
  72. package/tsconfig.json +12 -26
  73. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts +0 -65
  74. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +0 -1
  75. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +0 -1
  76. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts +0 -17
  77. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts.map +0 -1
  78. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.js +0 -54
  79. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.js.map +0 -1
  80. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.d.ts.map +0 -1
  81. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.js +0 -21
  82. package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.js.map +0 -1
  83. package/lib/components/DSL_DataSpace_Icon.d.ts.map +0 -1
  84. package/lib/components/DSL_DataSpace_Icon.js.map +0 -1
  85. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +0 -29
  86. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +0 -1
  87. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +0 -242
  88. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +0 -1
  89. package/lib/components/query/DSL_DataSpace_LegendQueryDocumentation.d.ts.map +0 -1
  90. package/lib/components/query/DSL_DataSpace_LegendQueryDocumentation.js.map +0 -1
  91. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +0 -1
  92. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +0 -1
  93. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +0 -1
  94. package/lib/components/query/DataSpaceQueryBuilder.js.map +0 -1
  95. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +0 -1
  96. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +0 -1
  97. package/lib/components/query/DataSpaceQueryCreator.d.ts +0 -19
  98. package/lib/components/query/DataSpaceQueryCreator.d.ts.map +0 -1
  99. package/lib/components/query/DataSpaceQueryCreator.js +0 -41
  100. package/lib/components/query/DataSpaceQueryCreator.js.map +0 -1
  101. package/lib/components/query/DataSpaceQuerySetup.d.ts +0 -21
  102. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +0 -1
  103. package/lib/components/query/DataSpaceQuerySetup.js +0 -63
  104. package/lib/components/query/DataSpaceQuerySetup.js.map +0 -1
  105. package/lib/components/query/DataSpaceTemplateQueryCreator.d.ts +0 -19
  106. package/lib/components/query/DataSpaceTemplateQueryCreator.d.ts.map +0 -1
  107. package/lib/components/query/DataSpaceTemplateQueryCreator.js +0 -37
  108. package/lib/components/query/DataSpaceTemplateQueryCreator.js.map +0 -1
  109. package/lib/components/query/QueryDataSpaceUtil.d.ts.map +0 -1
  110. package/lib/components/query/QueryDataSpaceUtil.js.map +0 -1
  111. package/lib/components/query/index.d.ts.map +0 -1
  112. package/lib/components/query/index.js.map +0 -1
  113. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +0 -39
  114. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +0 -1
  115. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +0 -207
  116. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +0 -1
  117. package/lib/components/studio/DataSpacePreviewAction.d.ts +0 -25
  118. package/lib/components/studio/DataSpacePreviewAction.d.ts.map +0 -1
  119. package/lib/components/studio/DataSpacePreviewAction.js +0 -53
  120. package/lib/components/studio/DataSpacePreviewAction.js.map +0 -1
  121. package/lib/components/studio/DataSpaceQueryAction.d.ts +0 -22
  122. package/lib/components/studio/DataSpaceQueryAction.d.ts.map +0 -1
  123. package/lib/components/studio/DataSpaceQueryAction.js +0 -29
  124. package/lib/components/studio/DataSpaceQueryAction.js.map +0 -1
  125. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts +0 -19
  126. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts.map +0 -1
  127. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js +0 -81
  128. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js.map +0 -1
  129. package/lib/components/studio/index.d.ts +0 -17
  130. package/lib/components/studio/index.d.ts.map +0 -1
  131. package/lib/components/studio/index.js +0 -17
  132. package/lib/components/studio/index.js.map +0 -1
  133. package/lib/stores/query/DataSpaceInfo.d.ts.map +0 -1
  134. package/lib/stores/query/DataSpaceInfo.js.map +0 -1
  135. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +0 -1
  136. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +0 -1
  137. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts +0 -38
  138. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +0 -1
  139. package/lib/stores/query/DataSpaceQueryCreatorStore.js +0 -149
  140. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +0 -1
  141. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +0 -51
  142. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +0 -1
  143. package/lib/stores/query/DataSpaceQuerySetupStore.js +0 -107
  144. package/lib/stores/query/DataSpaceQuerySetupStore.js.map +0 -1
  145. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts +0 -35
  146. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts.map +0 -1
  147. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +0 -108
  148. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +0 -1
  149. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +0 -61
  150. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +0 -1
  151. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js +0 -407
  152. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js.map +0 -1
  153. package/lib/stores/studio/DataSpacePreviewState.d.ts +0 -33
  154. package/lib/stores/studio/DataSpacePreviewState.d.ts.map +0 -1
  155. package/lib/stores/studio/DataSpacePreviewState.js +0 -117
  156. package/lib/stores/studio/DataSpacePreviewState.js.map +0 -1
  157. package/src/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.ts +0 -54
  158. package/src/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.ts +0 -20
  159. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +0 -445
  160. package/src/components/query/DataSpaceQueryCreator.tsx +0 -99
  161. package/src/components/query/DataSpaceQuerySetup.tsx +0 -165
  162. package/src/components/query/DataSpaceTemplateQueryCreator.tsx +0 -82
  163. package/src/components/query/index.ts +0 -17
  164. package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +0 -297
  165. package/src/components/studio/DataSpacePreviewAction.tsx +0 -136
  166. package/src/components/studio/DataSpaceQueryAction.tsx +0 -34
  167. package/src/components/studio/DataSpaceTemplateQueryPromoteReview.tsx +0 -292
  168. package/src/stores/query/DataSpaceQueryCreatorStore.ts +0 -308
  169. package/src/stores/query/DataSpaceQuerySetupStore.ts +0 -205
  170. package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +0 -207
  171. package/src/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.ts +0 -636
  172. package/src/stores/studio/DataSpacePreviewState.ts +0 -195
  173. /package/lib/components/{query → query-builder}/DataSpaceAdvancedSearchModal.d.ts +0 -0
  174. /package/lib/components/{query → query-builder}/DataSpaceAdvancedSearchModal.js +0 -0
  175. /package/lib/components/{query → query-builder}/QueryDataSpaceUtil.d.ts +0 -0
  176. /package/lib/components/{query → query-builder}/QueryDataSpaceUtil.js +0 -0
  177. /package/lib/components/{DSL_DataSpace_Icon.d.ts → shared/DSL_DataSpace_Icon.d.ts} +0 -0
  178. /package/lib/components/{DSL_DataSpace_Icon.js → shared/DSL_DataSpace_Icon.js} +0 -0
  179. /package/lib/stores/{query → shared}/DataSpaceInfo.d.ts +0 -0
  180. /package/lib/stores/{query → shared}/DataSpaceInfo.js +0 -0
  181. /package/src/components/{query → query-builder}/QueryDataSpaceUtil.ts +0 -0
  182. /package/src/components/{DSL_DataSpace_Icon.tsx → shared/DSL_DataSpace_Icon.tsx} +0 -0
  183. /package/src/stores/{query → shared}/DataSpaceInfo.ts +0 -0
@@ -1,308 +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 Query,
19
- extractElementNameFromPath,
20
- QueryTaggedValue,
21
- RuntimePointer,
22
- PackageableElementExplicitReference,
23
- type Runtime,
24
- type Class,
25
- type RawLambda,
26
- } from '@finos/legend-graph';
27
- import {
28
- QueryEditorStore,
29
- type QueryPersistConfiguration,
30
- type LegendQueryApplicationStore,
31
- createViewProjectHandler,
32
- createViewSDLCProjectHandler,
33
- } from '@finos/legend-application-query';
34
- import {
35
- type DepotServerClient,
36
- StoreProjectData,
37
- LATEST_VERSION_ALIAS,
38
- } from '@finos/legend-server-depot';
39
- import {
40
- guaranteeNonNullable,
41
- guaranteeType,
42
- uuid,
43
- } from '@finos/legend-shared';
44
- import {
45
- QUERY_PROFILE_PATH,
46
- QUERY_PROFILE_TAG_CLASS,
47
- QUERY_PROFILE_TAG_DATA_SPACE,
48
- } from '../../graph/DSL_DataSpace_MetaModelConst.js';
49
- import { getDataSpace } from '../../graph-manager/DSL_DataSpace_GraphManagerHelper.js';
50
- import {
51
- DataSpaceQueryBuilderState,
52
- DataSpaceProjectInfo,
53
- } from './DataSpaceQueryBuilderState.js';
54
- import type { DataSpaceInfo } from './DataSpaceInfo.js';
55
- import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
56
- import type { DataSpaceExecutionContext } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
57
- import type { QueryBuilderState } from '@finos/legend-query-builder';
58
- import type { ProjectGAVCoordinates } from '@finos/legend-storage';
59
- import { DSL_DataSpace_getGraphManagerExtension } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js';
60
- import { retrieveAnalyticsResultCache } from '../../graph-manager/action/analytics/DataSpaceAnalysisHelper.js';
61
-
62
- export const createQueryDataSpaceTaggedValue = (
63
- dataSpacePath: string,
64
- ): QueryTaggedValue => {
65
- const taggedValue = new QueryTaggedValue();
66
- taggedValue.profile = QUERY_PROFILE_PATH;
67
- taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
68
- taggedValue.value = dataSpacePath;
69
- return taggedValue;
70
- };
71
-
72
- export const createQueryClassTaggedValue = (
73
- classPath: string,
74
- ): QueryTaggedValue => {
75
- const taggedValue = new QueryTaggedValue();
76
- taggedValue.profile = QUERY_PROFILE_PATH;
77
- taggedValue.tag = QUERY_PROFILE_TAG_CLASS;
78
- taggedValue.value = classPath;
79
- return taggedValue;
80
- };
81
-
82
- export class DataSpaceQueryCreatorStore extends QueryEditorStore {
83
- readonly groupId: string;
84
- readonly artifactId: string;
85
- readonly versionId: string;
86
- readonly dataSpacePath: string;
87
- readonly executionContext: string;
88
- readonly runtimePath: string | undefined;
89
- readonly classPath: string | undefined;
90
-
91
- constructor(
92
- applicationStore: LegendQueryApplicationStore,
93
- depotServerClient: DepotServerClient,
94
- groupId: string,
95
- artifactId: string,
96
- versionId: string,
97
- dataSpacePath: string,
98
- executionContext: string,
99
- runtimePath: string | undefined,
100
- executionKey: string | undefined,
101
- ) {
102
- super(applicationStore, depotServerClient);
103
-
104
- this.groupId = groupId;
105
- this.artifactId = artifactId;
106
- this.versionId = versionId;
107
- this.dataSpacePath = dataSpacePath;
108
- this.executionContext = executionContext;
109
- this.runtimePath = runtimePath;
110
- this.classPath = executionKey;
111
- }
112
-
113
- getProjectInfo(): ProjectGAVCoordinates {
114
- return {
115
- groupId: this.groupId,
116
- artifactId: this.artifactId,
117
- versionId: this.versionId,
118
- };
119
- }
120
-
121
- async initializeQueryBuilderState(): Promise<QueryBuilderState> {
122
- const dataSpace = getDataSpace(
123
- this.dataSpacePath,
124
- this.graphManagerState.graph,
125
- );
126
- const executionContext = guaranteeNonNullable(
127
- dataSpace.executionContexts.find(
128
- (context) => context.name === this.executionContext,
129
- ),
130
- `Can't find execution context '${this.executionContext}'`,
131
- );
132
- let dataSpaceAnalysisResult;
133
- try {
134
- const project = StoreProjectData.serialization.fromJson(
135
- await this.depotServerClient.getProject(this.groupId, this.artifactId),
136
- );
137
- dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
138
- this.graphManagerState.graphManager,
139
- ).retrieveDataSpaceAnalysisFromCache(() =>
140
- retrieveAnalyticsResultCache(
141
- project,
142
- this.versionId,
143
- dataSpace.path,
144
- this.depotServerClient,
145
- ),
146
- );
147
- } catch {
148
- // do nothing
149
- }
150
- const projectInfo = new DataSpaceProjectInfo(
151
- this.groupId,
152
- this.artifactId,
153
- this.versionId,
154
- createViewProjectHandler(this.applicationStore),
155
- createViewSDLCProjectHandler(
156
- this.applicationStore,
157
- this.depotServerClient,
158
- ),
159
- );
160
- const sourceInfo = {
161
- groupId: projectInfo.groupId,
162
- artifactId: projectInfo.artifactId,
163
- versionId: projectInfo.versionId,
164
- dataSpace: dataSpace.path,
165
- };
166
- const queryBuilderState = new DataSpaceQueryBuilderState(
167
- this.applicationStore,
168
- this.graphManagerState,
169
- this.depotServerClient,
170
- dataSpace,
171
- executionContext,
172
- (dataSpaceInfo: DataSpaceInfo) => {
173
- if (dataSpaceInfo.defaultExecutionContext) {
174
- this.applicationStore.navigationService.navigator.goToLocation(
175
- generateDataSpaceQueryCreatorRoute(
176
- guaranteeNonNullable(dataSpaceInfo.groupId),
177
- guaranteeNonNullable(dataSpaceInfo.artifactId),
178
- LATEST_VERSION_ALIAS, //always default to latest
179
- dataSpaceInfo.path,
180
- dataSpaceInfo.defaultExecutionContext,
181
- undefined,
182
- undefined,
183
- ),
184
- );
185
- } else {
186
- this.applicationStore.notificationService.notifyWarning(
187
- `Can't switch data space: default execution context not specified`,
188
- );
189
- }
190
- },
191
- true,
192
- dataSpaceAnalysisResult,
193
- (ec: DataSpaceExecutionContext) => {
194
- // runtime should already be set
195
- const runtimePointer = guaranteeType(
196
- queryBuilderState.executionContextState.runtimeValue,
197
- RuntimePointer,
198
- );
199
- this.applicationStore.navigationService.navigator.updateCurrentLocation(
200
- generateDataSpaceQueryCreatorRoute(
201
- this.groupId,
202
- this.artifactId,
203
- this.versionId,
204
- dataSpace.path,
205
- ec.name,
206
- runtimePointer.packageableRuntime.value ===
207
- queryBuilderState.executionContext.defaultRuntime.value
208
- ? undefined
209
- : runtimePointer.packageableRuntime.value.path,
210
- queryBuilderState.class?.path,
211
- ),
212
- );
213
- },
214
- (runtimeValue: Runtime) => {
215
- const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
216
- queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
217
- generateDataSpaceQueryCreatorRoute(
218
- guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
219
- guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
220
- guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
221
- queryBuilderState.dataSpace.path,
222
- queryBuilderState.executionContext.name,
223
- runtimePointer.packageableRuntime.value ===
224
- queryBuilderState.executionContext.defaultRuntime.value
225
- ? undefined
226
- : runtimePointer.packageableRuntime.value.path,
227
- queryBuilderState.class?.path,
228
- ),
229
- );
230
- },
231
- (_class: Class) => {
232
- // runtime should already be set
233
- const runtimePointer = guaranteeType(
234
- queryBuilderState.executionContextState.runtimeValue,
235
- RuntimePointer,
236
- );
237
- queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
238
- generateDataSpaceQueryCreatorRoute(
239
- guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
240
- guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
241
- guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
242
- queryBuilderState.dataSpace.path,
243
- queryBuilderState.executionContext.name,
244
- runtimePointer.packageableRuntime.value ===
245
- queryBuilderState.executionContext.defaultRuntime.value
246
- ? undefined
247
- : runtimePointer.packageableRuntime.value.path,
248
- _class.path,
249
- ),
250
- );
251
- },
252
- projectInfo,
253
- this.applicationStore.config.options.queryBuilderConfig,
254
- sourceInfo,
255
- );
256
- queryBuilderState.setExecutionContext(executionContext);
257
- queryBuilderState.propagateExecutionContextChange(executionContext);
258
-
259
- // set runtime if already chosen
260
- if (this.runtimePath) {
261
- queryBuilderState.changeRuntime(
262
- new RuntimePointer(
263
- PackageableElementExplicitReference.create(
264
- this.graphManagerState.graph.getRuntime(this.runtimePath),
265
- ),
266
- ),
267
- );
268
- }
269
-
270
- // set class if already chosen
271
- if (this.classPath) {
272
- queryBuilderState.changeClass(
273
- this.graphManagerState.graph.getClass(this.classPath),
274
- );
275
- }
276
-
277
- return queryBuilderState;
278
- }
279
-
280
- getPersistConfiguration(
281
- lambda: RawLambda,
282
- options?: { update?: boolean | undefined },
283
- ): QueryPersistConfiguration {
284
- return {
285
- defaultName: options?.update
286
- ? `${extractElementNameFromPath(this.dataSpacePath)}`
287
- : `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${
288
- this.executionContext
289
- }]`,
290
- decorator: (query: Query): void => {
291
- query.id = uuid();
292
- query.groupId = this.groupId;
293
- query.artifactId = this.artifactId;
294
- query.versionId = this.versionId;
295
- if (this.queryBuilderState?.class) {
296
- query.taggedValues = [
297
- createQueryDataSpaceTaggedValue(this.dataSpacePath),
298
- createQueryClassTaggedValue(this.queryBuilderState.class.path),
299
- ];
300
- } else {
301
- query.taggedValues = [
302
- createQueryDataSpaceTaggedValue(this.dataSpacePath),
303
- ];
304
- }
305
- },
306
- };
307
- }
308
- }
@@ -1,205 +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
- createViewProjectHandler,
19
- createViewSDLCProjectHandler,
20
- QueryEditorStore,
21
- type QueryPersistConfiguration,
22
- } from '@finos/legend-application-query';
23
- import {
24
- DepotScope,
25
- LATEST_VERSION_ALIAS,
26
- type DepotServerClient,
27
- type StoredEntity,
28
- } from '@finos/legend-server-depot';
29
- import type { GraphManagerState, RawLambda } from '@finos/legend-graph';
30
- import { type GenericLegendApplicationStore } from '@finos/legend-application';
31
- import { action, flow, makeObservable, observable } from 'mobx';
32
- import {
33
- type QueryBuilderConfig,
34
- QueryBuilderState,
35
- } from '@finos/legend-query-builder';
36
- import type { ProjectGAVCoordinates } from '@finos/legend-storage';
37
- import {
38
- ActionState,
39
- assertErrorThrown,
40
- guaranteeNonNullable,
41
- UnsupportedOperationError,
42
- type GeneratorFn,
43
- } from '@finos/legend-shared';
44
- import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
45
- import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
46
- import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
47
- import { renderDataSpaceQuerySetupSetupPanelContent } from '../../components/query/DataSpaceQuerySetup.js';
48
- import { DataSpaceAdvancedSearchState } from './DataSpaceAdvancedSearchState.js';
49
-
50
- export class DataSpaceQuerySetupState extends QueryBuilderState {
51
- readonly depotServerClient: DepotServerClient;
52
- readonly loadDataSpacesState = ActionState.create();
53
- readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
54
- readonly viewProject: (
55
- groupId: string,
56
- artifactId: string,
57
- versionId: string,
58
- entityPath: string | undefined,
59
- ) => void;
60
- readonly viewSDLCProject: (
61
- groupId: string,
62
- artifactId: string,
63
- entityPath: string | undefined,
64
- ) => Promise<void>;
65
-
66
- override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
67
- renderDataSpaceQuerySetupSetupPanelContent(this);
68
-
69
- dataSpaces: DataSpaceInfo[] = [];
70
- showRuntimeSelector = false;
71
- advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
72
-
73
- constructor(
74
- applicationStore: GenericLegendApplicationStore,
75
- graphManagerState: GraphManagerState,
76
- depotServerClient: DepotServerClient,
77
- onDataSpaceChange: (val: DataSpaceInfo) => void,
78
- viewProject: (
79
- groupId: string,
80
- artifactId: string,
81
- versionId: string,
82
- entityPath: string | undefined,
83
- ) => void,
84
- viewSDLCProject: (
85
- groupId: string,
86
- artifactId: string,
87
- entityPath: string | undefined,
88
- ) => Promise<void>,
89
- config: QueryBuilderConfig | undefined,
90
- ) {
91
- super(applicationStore, graphManagerState, config);
92
-
93
- makeObservable(this, {
94
- dataSpaces: observable,
95
- advancedSearchState: observable,
96
- showAdvancedSearchPanel: action,
97
- hideAdvancedSearchPanel: action,
98
- loadDataSpaces: flow,
99
- });
100
-
101
- this.depotServerClient = depotServerClient;
102
- this.onDataSpaceChange = onDataSpaceChange;
103
- this.viewProject = viewProject;
104
- this.viewSDLCProject = viewSDLCProject;
105
- }
106
-
107
- override get isResultPanelHidden(): boolean {
108
- return true;
109
- }
110
-
111
- override get sideBarClassName(): string | undefined {
112
- return 'query-builder__setup__data-space-setup';
113
- }
114
-
115
- showAdvancedSearchPanel(): void {
116
- this.advancedSearchState = new DataSpaceAdvancedSearchState(
117
- this.applicationStore,
118
- this.graphManagerState,
119
- this.depotServerClient,
120
- {
121
- viewProject: this.viewProject,
122
- viewSDLCProject: this.viewSDLCProject,
123
- },
124
- );
125
- }
126
-
127
- hideAdvancedSearchPanel(): void {
128
- this.advancedSearchState = undefined;
129
- }
130
-
131
- *loadDataSpaces(): GeneratorFn<void> {
132
- this.loadDataSpacesState.inProgress();
133
- try {
134
- this.dataSpaces = (
135
- (yield this.depotServerClient.getEntitiesByClassifier(
136
- DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
137
- {
138
- scope: DepotScope.RELEASES,
139
- },
140
- )) as StoredEntity[]
141
- ).map((storedEntity) => extractDataSpaceInfo(storedEntity, false));
142
- this.loadDataSpacesState.pass();
143
- } catch (error) {
144
- assertErrorThrown(error);
145
- this.loadDataSpacesState.fail();
146
- this.applicationStore.notificationService.notifyError(error);
147
- }
148
- }
149
- }
150
-
151
- export class DataSpaceQuerySetupStore extends QueryEditorStore {
152
- override get isViewProjectActionDisabled(): boolean {
153
- return true;
154
- }
155
-
156
- getProjectInfo(): ProjectGAVCoordinates {
157
- throw new UnsupportedOperationError();
158
- }
159
-
160
- getPersistConfiguration(
161
- lambda: RawLambda,
162
- options?: { update?: boolean | undefined },
163
- ): QueryPersistConfiguration {
164
- throw new UnsupportedOperationError();
165
- }
166
-
167
- async initializeQueryBuilderState(): Promise<QueryBuilderState> {
168
- const queryBuilderState = new DataSpaceQuerySetupState(
169
- this.applicationStore,
170
- this.graphManagerState,
171
- this.depotServerClient,
172
- (dataSpaceInfo: DataSpaceInfo) => {
173
- if (dataSpaceInfo.defaultExecutionContext) {
174
- this.applicationStore.navigationService.navigator.goToLocation(
175
- generateDataSpaceQueryCreatorRoute(
176
- guaranteeNonNullable(dataSpaceInfo.groupId),
177
- guaranteeNonNullable(dataSpaceInfo.artifactId),
178
- LATEST_VERSION_ALIAS, //always default to latest
179
- dataSpaceInfo.path,
180
- dataSpaceInfo.defaultExecutionContext,
181
- undefined,
182
- undefined,
183
- ),
184
- );
185
- } else {
186
- this.applicationStore.notificationService.notifyWarning(
187
- `Can't switch data space: default execution context not specified`,
188
- );
189
- }
190
- },
191
- createViewProjectHandler(this.applicationStore),
192
- createViewSDLCProjectHandler(
193
- this.applicationStore,
194
- this.depotServerClient,
195
- ),
196
- this.applicationStore.config.options.queryBuilderConfig,
197
- );
198
-
199
- return queryBuilderState;
200
- }
201
-
202
- override *buildGraph(): GeneratorFn<void> {
203
- // do nothing
204
- }
205
- }