@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,636 +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 LightQuery,
19
- type QueryInfo,
20
- type RawLambda,
21
- GraphManagerState,
22
- } from '@finos/legend-graph';
23
- import {
24
- type DepotServerClient,
25
- StoreProjectData,
26
- ProjectDependencyCoordinates,
27
- ProjectVersionEntities,
28
- } from '@finos/legend-server-depot';
29
- import {
30
- ActionState,
31
- assertErrorThrown,
32
- guaranteeNonNullable,
33
- LogEvent,
34
- type GeneratorFn,
35
- type PlainObject,
36
- } from '@finos/legend-shared';
37
- import {
38
- generateDataSpaceQuerySetupRoute,
39
- generateDataSpaceTemplateQueryPromotionRoute,
40
- } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
41
- import { type Entity } from '@finos/legend-storage';
42
- import {
43
- type ProjectConfigurationStatus,
44
- fetchProjectConfigurationStatus,
45
- generateEditorRoute,
46
- LEGEND_STUDIO_APP_EVENT,
47
- type LegendStudioApplicationStore,
48
- EditorStore,
49
- generateReviewRoute,
50
- } from '@finos/legend-application-studio';
51
- import {
52
- DEFAULT_TAB_SIZE,
53
- ActionAlertType,
54
- ActionAlertActionType,
55
- } from '@finos/legend-application';
56
- import {
57
- makeObservable,
58
- observable,
59
- computed,
60
- action,
61
- flow,
62
- flowResult,
63
- } from 'mobx';
64
- import {
65
- type SDLCServerClient,
66
- type ProjectDependency,
67
- Project,
68
- WorkspaceType,
69
- Workspace,
70
- ProjectConfiguration,
71
- EntityChangeType,
72
- } from '@finos/legend-server-sdlc';
73
- import {
74
- type DSL_DataSpace_PureGraphManagerExtension,
75
- DSL_DataSpace_getGraphManagerExtension,
76
- } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js';
77
- import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
78
-
79
- const projectDependencyToProjectCoordinates = (
80
- projectDependency: ProjectDependency,
81
- ): ProjectDependencyCoordinates =>
82
- new ProjectDependencyCoordinates(
83
- guaranteeNonNullable(projectDependency.groupId),
84
- guaranteeNonNullable(projectDependency.artifactId),
85
- projectDependency.versionId,
86
- );
87
-
88
- const DEFAULT_WORKSPACE_NAME_PREFIX = 'promote-as-template-query';
89
-
90
- export class DataSpaceTemplateQueryPromotionReviewerStore {
91
- readonly applicationStore: LegendStudioApplicationStore;
92
- readonly sdlcServerClient: SDLCServerClient;
93
- readonly depotServerClient: DepotServerClient;
94
- readonly graphManagerState: GraphManagerState;
95
- readonly initState = ActionState.create();
96
- readonly promoteState = ActionState.create();
97
- readonly loadQueryState = ActionState.create();
98
- readonly loadWorkspacesState = ActionState.create();
99
- editorStore: EditorStore;
100
- graphManagerExtension: DSL_DataSpace_PureGraphManagerExtension;
101
- currentQuery?: LightQuery | undefined;
102
- currentQueryInfo?: QueryInfo | undefined;
103
- currentQueryProject?: StoreProjectData | undefined;
104
- currentProject?: Project | undefined;
105
- currentProjectConfiguration?: ProjectConfiguration;
106
- currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
107
- currentProjectEntities: Entity[] = [];
108
- dependencyEntities: Entity[] = [];
109
- groupWorkspaces: Workspace[] = [];
110
- workspaceName = '';
111
- dataSpacePath!: string;
112
- dataSpaceEntity: Entity | undefined;
113
- templateQueryId = 'template_id';
114
- templateQueryTitle = 'template_title';
115
- templateQueryDescription = '';
116
-
117
- constructor(
118
- applicationStore: LegendStudioApplicationStore,
119
- sdlcServerClient: SDLCServerClient,
120
- depotServerClient: DepotServerClient,
121
- ) {
122
- makeObservable(this, {
123
- editorStore: observable,
124
- graphManagerExtension: observable,
125
- currentQuery: observable,
126
- currentQueryInfo: observable,
127
- currentQueryProject: observable,
128
- currentProject: observable,
129
- currentProjectConfiguration: observable,
130
- currentProjectConfigurationStatus: observable,
131
- currentProjectEntities: observable,
132
- dataSpaceEntity: observable,
133
- groupWorkspaces: observable,
134
- workspaceName: observable,
135
- templateQueryId: observable,
136
- templateQueryTitle: observable,
137
- templateQueryDescription: observable,
138
- isWorkspaceNameValid: computed,
139
- isTemplateQueryIdValid: computed,
140
- setWorkspaceName: action,
141
- setTemplateQueryId: action,
142
- setTemplateQueryTitle: action,
143
- setTemplateQueryDescription: action,
144
- initialize: flow,
145
- loadQuery: flow,
146
- loadProject: flow,
147
- promoteAsTemplateQuery: flow,
148
- });
149
-
150
- this.applicationStore = applicationStore;
151
- this.sdlcServerClient = sdlcServerClient;
152
- this.depotServerClient = depotServerClient;
153
- this.graphManagerState = new GraphManagerState(
154
- applicationStore.pluginManager,
155
- applicationStore.logService,
156
- );
157
- this.editorStore = new EditorStore(
158
- applicationStore,
159
- sdlcServerClient,
160
- depotServerClient,
161
- );
162
- this.graphManagerExtension = DSL_DataSpace_getGraphManagerExtension(
163
- this.editorStore.graphManagerState.graphManager,
164
- );
165
- }
166
-
167
- setWorkspaceName(val: string): void {
168
- this.workspaceName = val;
169
- }
170
-
171
- setTemplateQueryId(val: string): void {
172
- this.templateQueryId = val;
173
- }
174
-
175
- setTemplateQueryTitle(val: string): void {
176
- this.templateQueryTitle = val;
177
- }
178
-
179
- setTemplateQueryDescription(val: string): void {
180
- this.templateQueryDescription = val;
181
- }
182
-
183
- get isWorkspaceNameValid(): boolean {
184
- return !this.groupWorkspaces.some(
185
- (ws) => ws.workspaceId === this.workspaceName,
186
- );
187
- }
188
-
189
- get isTemplateQueryIdValid(): boolean {
190
- if (this.dataSpaceEntity) {
191
- return this.graphManagerExtension.IsTemplateQueryIdValid(
192
- this.dataSpaceEntity,
193
- this.templateQueryId,
194
- );
195
- }
196
- return false;
197
- }
198
-
199
- *initialize(
200
- queryId: string | undefined,
201
- dataSpacePath: string,
202
- ): GeneratorFn<void> {
203
- if (!this.initState.isInInitialState) {
204
- return;
205
- }
206
- try {
207
- this.initState.inProgress();
208
- yield this.graphManagerState.graphManager.initialize(
209
- {
210
- env: this.applicationStore.config.env,
211
- tabSize: DEFAULT_TAB_SIZE,
212
- clientConfig: {
213
- baseUrl: this.applicationStore.config.engineServerUrl,
214
- queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
215
- enableCompression: true,
216
- },
217
- },
218
- {
219
- tracerService: this.applicationStore.tracerService,
220
- },
221
- );
222
- this.dataSpacePath = dataSpacePath;
223
- if (queryId) {
224
- let query: LightQuery | undefined;
225
- try {
226
- query = (yield this.graphManagerState.graphManager.getLightQuery(
227
- queryId,
228
- )) as LightQuery;
229
- } catch {
230
- query = undefined;
231
- }
232
- if (query) {
233
- yield flowResult(this.loadQuery(query));
234
- } else {
235
- this.applicationStore.navigationService.navigator.updateCurrentLocation(
236
- generateDataSpaceQuerySetupRoute(),
237
- );
238
- }
239
- }
240
- if (this.currentQuery) {
241
- this.currentQueryProject = StoreProjectData.serialization.fromJson(
242
- (yield this.depotServerClient.getProject(
243
- this.currentQuery.groupId,
244
- this.currentQuery.artifactId,
245
- )) as PlainObject<StoreProjectData>,
246
- );
247
- const projectData = (yield Promise.all([
248
- this.depotServerClient.getVersionEntities(
249
- this.currentQuery.groupId,
250
- this.currentQuery.artifactId,
251
- this.currentQuery.versionId,
252
- ),
253
- this.sdlcServerClient.getConfiguration(
254
- this.currentQueryProject.projectId,
255
- undefined,
256
- ),
257
- ])) as [Entity[], PlainObject<ProjectConfiguration>];
258
-
259
- const [currentProjectEntities, currentProjectConfiguration] = [
260
- projectData[0],
261
- ProjectConfiguration.serialization.fromJson(projectData[1]),
262
- ];
263
- this.currentProjectConfiguration = currentProjectConfiguration;
264
- const dependencyEntities = (
265
- (yield this.depotServerClient.collectDependencyEntities(
266
- (
267
- [
268
- ...currentProjectConfiguration.projectDependencies,
269
- ] as ProjectDependency[]
270
- )
271
- .map(projectDependencyToProjectCoordinates)
272
- .map((p) => ProjectDependencyCoordinates.serialization.toJson(p)),
273
- true,
274
- true,
275
- )) as PlainObject<ProjectVersionEntities>[]
276
- )
277
- .map((p) => ProjectVersionEntities.serialization.fromJson(p))
278
- .flatMap((info) => info.entities);
279
- this.dependencyEntities = dependencyEntities;
280
- this.currentProjectEntities = currentProjectEntities;
281
- this.dataSpaceEntity = guaranteeNonNullable(
282
- currentProjectEntities.filter(
283
- (entity: Entity) =>
284
- entity.path === dataSpacePath &&
285
- entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
286
- )[0],
287
- `Can't find dataSpace entity with path ${this.dataSpaceEntity}`,
288
- );
289
- this.initState.pass();
290
- }
291
- } catch (error) {
292
- assertErrorThrown(error);
293
- this.applicationStore.logService.error(
294
- LogEvent.create(LEGEND_STUDIO_APP_EVENT.GENERIC_FAILURE),
295
- error,
296
- );
297
- this.applicationStore.alertService.setBlockingAlert({
298
- message: `Can't initialize template query promotion reviewer store`,
299
- });
300
- this.initState.fail();
301
- }
302
- }
303
-
304
- *loadQuery(query: LightQuery): GeneratorFn<void> {
305
- this.currentQuery = query;
306
- this.templateQueryTitle = query.name;
307
-
308
- try {
309
- this.loadQueryState.inProgress();
310
- this.currentQueryInfo =
311
- (yield this.graphManagerState.graphManager.getQueryInfo(
312
- query.id,
313
- )) as QueryInfo;
314
- this.currentQueryProject = StoreProjectData.serialization.fromJson(
315
- (yield this.depotServerClient.getProject(
316
- this.currentQuery.groupId,
317
- this.currentQuery.artifactId,
318
- )) as PlainObject<StoreProjectData>,
319
- );
320
- this.setWorkspaceName(`${DEFAULT_WORKSPACE_NAME_PREFIX}-${query.name}`);
321
- this.applicationStore.navigationService.navigator.updateCurrentLocation(
322
- generateDataSpaceTemplateQueryPromotionRoute(
323
- this.currentQuery.groupId,
324
- this.currentQuery.artifactId,
325
- this.currentQuery.versionId,
326
- this.dataSpacePath,
327
- query.id,
328
- ),
329
- );
330
- const currentProject = Project.serialization.fromJson(
331
- (yield this.sdlcServerClient.getProject(
332
- this.currentQueryProject.projectId,
333
- )) as PlainObject<Project>,
334
- );
335
- yield flowResult(this.loadProject(currentProject));
336
- } catch (error) {
337
- assertErrorThrown(error);
338
- this.applicationStore.notificationService.notifyError(error);
339
- } finally {
340
- this.loadQueryState.complete();
341
- }
342
- }
343
-
344
- *loadProject(project: Project): GeneratorFn<void> {
345
- this.currentProject = project;
346
- this.currentProjectConfigurationStatus = undefined;
347
- this.loadWorkspacesState.inProgress();
348
- try {
349
- this.currentProjectConfigurationStatus =
350
- (yield fetchProjectConfigurationStatus(
351
- project.projectId,
352
- undefined,
353
- this.applicationStore,
354
- this.sdlcServerClient,
355
- )) as ProjectConfigurationStatus;
356
- this.groupWorkspaces = (
357
- (yield this.sdlcServerClient.getGroupWorkspaces(
358
- project.projectId,
359
- )) as PlainObject<Workspace>[]
360
- )
361
- .map((v) => Workspace.serialization.fromJson(v))
362
- .filter((workspace) => workspace.workspaceType === WorkspaceType.GROUP);
363
- this.loadWorkspacesState.pass();
364
- } catch (error) {
365
- assertErrorThrown(error);
366
- this.applicationStore.logService.error(
367
- LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
368
- error,
369
- );
370
- this.applicationStore.notificationService.notifyError(error);
371
- this.loadWorkspacesState.fail();
372
- }
373
- }
374
-
375
- *promoteAsTemplateQuery(): GeneratorFn<void> {
376
- const query = this.currentQuery;
377
- const project = this.currentProject;
378
- if (
379
- this.promoteState.isInProgress ||
380
- !query ||
381
- !this.currentQueryInfo ||
382
- !this.currentProjectConfiguration ||
383
- !project ||
384
- !this.workspaceName ||
385
- !this.templateQueryTitle ||
386
- !this.dataSpaceEntity ||
387
- !this.isWorkspaceNameValid ||
388
- !this.isTemplateQueryIdValid
389
- ) {
390
- return;
391
- }
392
-
393
- try {
394
- this.promoteState.inProgress();
395
- // 1. prepare project entities
396
- this.applicationStore.alertService.setBlockingAlert({
397
- message: `Fetching and updating project...`,
398
- prompt: 'Please do not close the application',
399
- showLoading: true,
400
- });
401
-
402
- // update datasapce entity
403
- const updatedDataSpaceEntity =
404
- (yield this.graphManagerExtension.addNewExecutableToDataSpaceEntity(
405
- this.dataSpaceEntity,
406
- {
407
- id: this.templateQueryId,
408
- title: this.templateQueryTitle,
409
- mapping: guaranteeNonNullable(this.currentQueryInfo).mapping,
410
- runtime: guaranteeNonNullable(this.currentQueryInfo).runtime,
411
- query: (yield this.graphManagerState.graphManager.pureCodeToLambda(
412
- this.currentQueryInfo.content,
413
- )) as RawLambda,
414
- description: this.templateQueryDescription,
415
- },
416
- )) as Entity;
417
- guaranteeNonNullable(
418
- this.currentProjectEntities.filter(
419
- (entity: Entity) =>
420
- entity.path === this.dataSpacePath &&
421
- entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
422
- )[0],
423
- ).content = updatedDataSpaceEntity.content;
424
-
425
- // 2. check if the graph compiles properly
426
- this.applicationStore.alertService.setBlockingAlert({
427
- message: `Checking workspace compilation status...`,
428
- prompt: 'Please do not close the application',
429
- showLoading: true,
430
- });
431
- let compilationFailed = false;
432
- try {
433
- yield this.graphManagerState.graphManager.compileEntities([
434
- ...this.dependencyEntities,
435
- ...this.currentProjectEntities,
436
- ]);
437
- } catch {
438
- compilationFailed = true;
439
- }
440
-
441
- // 3. proceed to setup the workspace
442
- const setupWorkspace = async (): Promise<void> => {
443
- let workspace: Workspace | undefined;
444
- try {
445
- this.applicationStore.alertService.setBlockingAlert({
446
- message: `Creating workspace...`,
447
- prompt: 'Please do not close the application',
448
- showLoading: true,
449
- });
450
-
451
- // i. create workspace
452
- workspace = Workspace.serialization.fromJson(
453
- await this.sdlcServerClient.createWorkspace(
454
- project.projectId,
455
- undefined,
456
- this.workspaceName,
457
- WorkspaceType.GROUP,
458
- ),
459
- );
460
-
461
- // ii. update dataspace
462
- this.applicationStore.alertService.setBlockingAlert({
463
- message: `Generating code commit...`,
464
- prompt: 'Please do not close the application',
465
- showLoading: true,
466
- });
467
- await this.sdlcServerClient.performEntityChanges(
468
- project.projectId,
469
- workspace,
470
- {
471
- message:
472
- 'promote-as-template-query: promote query as a template query to dataspace',
473
- entityChanges: [
474
- {
475
- classifierPath: updatedDataSpaceEntity.classifierPath,
476
- entityPath: updatedDataSpaceEntity.path,
477
- content: updatedDataSpaceEntity.content,
478
- type: EntityChangeType.MODIFY,
479
- },
480
- ],
481
- },
482
- );
483
-
484
- // iii create review
485
- this.applicationStore.alertService.setBlockingAlert({
486
- message: `Generating code review...`,
487
- prompt: 'Please do not close the application',
488
- showLoading: true,
489
- });
490
- await flowResult(
491
- this.editorStore.initialize(
492
- project.projectId,
493
- undefined,
494
- workspace.workspaceId,
495
- workspace.workspaceType,
496
- ),
497
- );
498
- const workspaceReviewState = this.editorStore.workspaceReviewState;
499
- const workspaceContainsSnapshotDependencies =
500
- this.editorStore.projectConfigurationEditorState
501
- .containsSnapshotDependencies;
502
- const isCreateReviewDisabled =
503
- Boolean(workspaceReviewState.workspaceReview) ||
504
- workspaceContainsSnapshotDependencies ||
505
- !workspaceReviewState.canCreateReview ||
506
- workspaceReviewState.sdlcState.isActiveProjectSandbox;
507
- workspaceReviewState.reviewTitle =
508
- 'code review - promote query as a template query to dataspace';
509
- if (!isCreateReviewDisabled) {
510
- await flowResult(
511
- workspaceReviewState.createWorkspaceReview(
512
- workspaceReviewState.reviewTitle,
513
- ),
514
- );
515
- } else {
516
- this.applicationStore.notificationService.notifyError(
517
- `Can't create code review`,
518
- );
519
- }
520
-
521
- // iv. complete, redirect user to the service query editor screen
522
- this.applicationStore.alertService.setBlockingAlert(undefined);
523
- this.promoteState.pass();
524
- this.applicationStore.alertService.setActionAlertInfo({
525
- message: `Successfully promoted query into dataspace '${this.dataSpacePath}'. Now your template query can be found in workspace '${this.workspaceName}' of project '${project.name}' (${project.projectId})`,
526
- prompt: compilationFailed
527
- ? `The workspace might not compile at the moment, please make sure to fix the issue and submit a review to make the dataspace part of the project to complete template query promotion`
528
- : `Please make sure to get the generated code-review reviewed and approved`,
529
- type: ActionAlertType.STANDARD,
530
- actions: compilationFailed
531
- ? [
532
- {
533
- label: 'Open Workspace',
534
- type: ActionAlertActionType.PROCEED,
535
- handler: (): void => {
536
- this.applicationStore.navigationService.navigator.goToLocation(
537
- generateEditorRoute(
538
- project.projectId,
539
- undefined,
540
- this.workspaceName,
541
- WorkspaceType.GROUP,
542
- ),
543
- );
544
- },
545
- default: true,
546
- },
547
- ]
548
- : [
549
- {
550
- label: 'Open Code Review',
551
- type: ActionAlertActionType.PROCEED,
552
- handler: (): void => {
553
- if (workspaceReviewState.workspaceReview) {
554
- this.applicationStore.navigationService.navigator.visitAddress(
555
- this.applicationStore.navigationService.navigator.generateAddress(
556
- generateReviewRoute(
557
- workspaceReviewState.workspaceReview.projectId,
558
- workspaceReviewState.workspaceReview.id,
559
- ),
560
- ),
561
- );
562
- }
563
- },
564
- default: true,
565
- },
566
- {
567
- label: 'Open Workspace',
568
- type: ActionAlertActionType.PROCEED,
569
- handler: (): void => {
570
- this.applicationStore.navigationService.navigator.goToLocation(
571
- generateEditorRoute(
572
- project.projectId,
573
- undefined,
574
- this.workspaceName,
575
- WorkspaceType.GROUP,
576
- ),
577
- );
578
- },
579
- },
580
- ],
581
- });
582
- } catch (error) {
583
- assertErrorThrown(error);
584
- this.applicationStore.alertService.setBlockingAlert(undefined);
585
- this.applicationStore.notificationService.notifyError(
586
- `Can't set up workspace: ${error.message}`,
587
- );
588
- if (workspace) {
589
- await this.sdlcServerClient.deleteWorkspace(
590
- project.projectId,
591
- workspace,
592
- );
593
- }
594
- this.promoteState.fail();
595
- }
596
- };
597
-
598
- this.applicationStore.alertService.setBlockingAlert(undefined);
599
- if (compilationFailed) {
600
- this.applicationStore.alertService.setActionAlertInfo({
601
- message: `We have found compilation issues with the workspace. Your query can still be promoted, but you would need to fix compilation issues afterwards`,
602
- prompt: `Do you still want to proceed to promote the query as a template query?`,
603
- type: ActionAlertType.STANDARD,
604
- actions: [
605
- {
606
- label: `Proceed`,
607
- type: ActionAlertActionType.PROCEED_WITH_CAUTION,
608
- handler: (): void => {
609
- setupWorkspace().catch(
610
- this.applicationStore.alertUnhandledError,
611
- );
612
- },
613
- },
614
- {
615
- label: 'Abort',
616
- type: ActionAlertActionType.PROCEED,
617
- handler: (): void => {
618
- this.promoteState.fail();
619
- },
620
- default: true,
621
- },
622
- ],
623
- });
624
- } else {
625
- yield setupWorkspace();
626
- }
627
-
628
- this.promoteState.pass();
629
- } catch (error) {
630
- assertErrorThrown(error);
631
- this.applicationStore.alertService.setBlockingAlert(undefined);
632
- this.applicationStore.notificationService.notifyError(error);
633
- this.promoteState.fail();
634
- }
635
- }
636
- }