@finos/legend-extension-dsl-data-space 10.1.96 → 10.2.1

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.
Files changed (109) hide show
  1. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts +18 -6
  2. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js +18 -6
  4. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +1 -1
  5. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +1 -0
  7. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  8. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +4 -1
  9. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  10. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +55 -5
  11. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  12. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +1 -1
  13. package/lib/components/query/DataSpaceAdvancedSearchModal.js +5 -17
  14. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +1 -1
  15. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -1
  16. package/lib/components/query/DataSpaceQueryBuilder.js +4 -16
  17. package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -1
  18. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js +1 -1
  19. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
  20. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
  21. package/lib/components/query/DataSpaceQuerySetup.js +3 -16
  22. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  23. package/lib/components/query/DataSpaceTemplateQueryCreator.js +4 -4
  24. package/lib/components/query/DataSpaceTemplateQueryCreator.js.map +1 -1
  25. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +2 -0
  26. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  27. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +13 -0
  28. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  29. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts +19 -0
  30. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts.map +1 -0
  31. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js +79 -0
  32. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js.map +1 -0
  33. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts +1 -0
  34. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts.map +1 -1
  35. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js +2 -0
  36. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js.map +1 -1
  37. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts +1 -0
  38. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
  39. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js +1 -0
  40. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js.map +1 -1
  41. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts +10 -1
  42. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  43. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  44. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  45. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js +2 -0
  46. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  47. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts +12 -1
  48. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  49. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +28 -3
  50. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +1 -0
  52. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
  53. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +2 -0
  54. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
  55. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts +1 -0
  56. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts.map +1 -1
  57. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js +2 -0
  58. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js.map +1 -1
  59. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts.map +1 -1
  60. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js +1 -0
  61. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js.map +1 -1
  62. package/lib/index.css +2 -2
  63. package/lib/index.css.map +1 -1
  64. package/lib/package.json +2 -1
  65. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +1 -1
  66. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  67. package/lib/stores/query/DataSpaceAdvancedSearchState.js +3 -6
  68. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  69. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +1 -1
  70. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -1
  71. package/lib/stores/query/DataSpaceQueryBuilderState.js +3 -6
  72. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -1
  73. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +1 -1
  74. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -1
  75. package/lib/stores/query/DataSpaceQuerySetupStore.js +3 -6
  76. package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -1
  77. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts +3 -2
  78. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  79. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +9 -13
  80. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  81. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +61 -0
  82. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +1 -0
  83. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js +407 -0
  84. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js.map +1 -0
  85. package/package.json +11 -10
  86. package/src/__lib__/query/DSL_DataSpace_LegendQueryNavigation.ts +43 -9
  87. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +1 -0
  88. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +117 -3
  89. package/src/components/query/DataSpaceAdvancedSearchModal.tsx +4 -25
  90. package/src/components/query/DataSpaceQueryBuilder.tsx +3 -23
  91. package/src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +1 -1
  92. package/src/components/query/DataSpaceQuerySetup.tsx +2 -24
  93. package/src/components/query/DataSpaceTemplateQueryCreator.tsx +6 -6
  94. package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +18 -1
  95. package/src/components/studio/DataSpaceTemplateQueryPromoteReview.tsx +285 -0
  96. package/src/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.ts +2 -0
  97. package/src/graph-manager/action/analytics/DataSpaceAnalysis.ts +1 -0
  98. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.ts +15 -0
  99. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.ts +2 -0
  100. package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +66 -2
  101. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +2 -0
  102. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.ts +2 -0
  103. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts +1 -0
  104. package/src/stores/query/DataSpaceAdvancedSearchState.ts +3 -11
  105. package/src/stores/query/DataSpaceQueryBuilderState.ts +3 -11
  106. package/src/stores/query/DataSpaceQuerySetupStore.ts +3 -11
  107. package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +12 -24
  108. package/src/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.ts +636 -0
  109. package/tsconfig.json +2 -0
@@ -0,0 +1,285 @@
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 { BlankPanelContent, GitBranchIcon, clsx } from '@finos/legend-art';
18
+ import { observer, useLocalObservable } from 'mobx-react-lite';
19
+ import { useApplicationStore } from '@finos/legend-application';
20
+ import { DataSpaceTemplateQueryPromotionReviewerStore } from '../../stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js';
21
+ import {
22
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN,
23
+ type DataSpaceTemplateQueryPromotionReviewerPathParams,
24
+ } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
25
+ import { useParams } from '@finos/legend-application/browser';
26
+ import {
27
+ ActivityBarMenu,
28
+ LEGEND_STUDIO_TEST_ID,
29
+ useLegendStudioApplicationStore,
30
+ useLegendStudioBaseStore,
31
+ } from '@finos/legend-application-studio';
32
+ import { createContext, useContext } from 'react';
33
+ import { guaranteeNonNullable } from '@finos/legend-shared';
34
+ import { flowResult } from 'mobx';
35
+
36
+ const TemplateQueryPromotionReviewerStoreContext = createContext<
37
+ DataSpaceTemplateQueryPromotionReviewerStore | undefined
38
+ >(undefined);
39
+
40
+ const DataSpaceTemplateQueryPromotionReviewerStoreProvider: React.FC<{
41
+ children: React.ReactNode;
42
+ dataSpacePath: string;
43
+ queryId: string;
44
+ }> = ({ children, dataSpacePath, queryId }) => {
45
+ const applicationStore = useLegendStudioApplicationStore();
46
+ const baseStore = useLegendStudioBaseStore();
47
+ const store = useLocalObservable(
48
+ () =>
49
+ new DataSpaceTemplateQueryPromotionReviewerStore(
50
+ applicationStore,
51
+ baseStore.sdlcServerClient,
52
+ baseStore.depotServerClient,
53
+ ),
54
+ );
55
+ store.initialize(queryId, dataSpacePath);
56
+ return (
57
+ <TemplateQueryPromotionReviewerStoreContext.Provider value={store}>
58
+ {children}
59
+ </TemplateQueryPromotionReviewerStoreContext.Provider>
60
+ );
61
+ };
62
+
63
+ const useTemplateQueryPromotionReviewerStore =
64
+ (): DataSpaceTemplateQueryPromotionReviewerStore =>
65
+ guaranteeNonNullable(
66
+ useContext(TemplateQueryPromotionReviewerStoreContext),
67
+ `Can't find query productionizer store in context`,
68
+ );
69
+
70
+ const TemplateQueryPromotionReviewerContent = observer(() => {
71
+ const applicationStore = useApplicationStore();
72
+ const queryPromotionReviewerStore = useTemplateQueryPromotionReviewerStore();
73
+ const isLoadingEditor = !queryPromotionReviewerStore.initState.hasCompleted;
74
+
75
+ // workspace name
76
+ const changeWorkspaceName: React.ChangeEventHandler<HTMLInputElement> = (
77
+ event,
78
+ ) => queryPromotionReviewerStore.setWorkspaceName(event.target.value);
79
+
80
+ // template query
81
+ const onChangeTemplateQueryId: React.ChangeEventHandler<HTMLInputElement> = (
82
+ event,
83
+ ) => queryPromotionReviewerStore.setTemplateQueryId(event.target.value);
84
+
85
+ const onChangeTemplateQueryTitle: React.ChangeEventHandler<
86
+ HTMLInputElement
87
+ > = (event) =>
88
+ queryPromotionReviewerStore.setTemplateQueryTitle(event.target.value);
89
+
90
+ const onChangeTemplateQueryDescription: React.ChangeEventHandler<
91
+ HTMLInputElement
92
+ > = (event) =>
93
+ queryPromotionReviewerStore.setTemplateQueryDescription(event.target.value);
94
+
95
+ // actions
96
+ const promoteTemplateQuery = (): void => {
97
+ flowResult(queryPromotionReviewerStore.promoteAsTemplateQuery()).catch(
98
+ applicationStore.alertUnhandledError,
99
+ );
100
+ };
101
+
102
+ return (
103
+ <div className="app__page">
104
+ {isLoadingEditor && (
105
+ <BlankPanelContent>
106
+ {queryPromotionReviewerStore.initState.message ??
107
+ queryPromotionReviewerStore.graphManagerState.systemBuildState
108
+ .message ??
109
+ queryPromotionReviewerStore.graphManagerState.dependenciesBuildState
110
+ .message ??
111
+ queryPromotionReviewerStore.graphManagerState.generationsBuildState
112
+ .message ??
113
+ queryPromotionReviewerStore.graphManagerState.graphBuildState
114
+ .message}
115
+ </BlankPanelContent>
116
+ )}
117
+ <div className="template-query-promotor">
118
+ <div className="template-query-promotor__body">
119
+ <div className="activity-bar">
120
+ <ActivityBarMenu />
121
+ </div>
122
+ <div
123
+ className="template-query-promotor__content"
124
+ data-testid={LEGEND_STUDIO_TEST_ID.SETUP__CONTENT}
125
+ >
126
+ <div className="template-query-promotor__content__main">
127
+ <div className="template-query-promotor__title">
128
+ Promote as Curated Template Query
129
+ </div>
130
+ <div className="template-query-promotor__title__prompt">
131
+ We will promote this query as a curated template query in
132
+ dataspace. This automated process will generate a code review
133
+ and workspace. Please get the generated code review reviewed and
134
+ approved.
135
+ </div>
136
+ <div className="template-query-promotor__group template-query-promotor__group--workspace">
137
+ <div className="template-query-promotor__group__header">
138
+ workspace
139
+ </div>
140
+ <div className="template-query-promotor__group__content">
141
+ <div className="template-query-promotor__input">
142
+ <div
143
+ className="template-query-promotor__input__icon"
144
+ title="workspace"
145
+ >
146
+ <GitBranchIcon className="template-query-promotor__input__icon--workspce" />
147
+ </div>
148
+ <div className="input-group template-query-promotor__input__input">
149
+ <input
150
+ className={clsx(
151
+ 'input input--dark input-group__input',
152
+ {
153
+ 'input-group__input--error':
154
+ !queryPromotionReviewerStore.isWorkspaceNameValid,
155
+ },
156
+ )}
157
+ spellCheck={false}
158
+ value={queryPromotionReviewerStore.workspaceName}
159
+ placeholder="Enter a name for your workspace"
160
+ onChange={changeWorkspaceName}
161
+ />
162
+ {!queryPromotionReviewerStore.isWorkspaceNameValid && (
163
+ <div className="input-group__error-message">
164
+ Workspace already existed
165
+ </div>
166
+ )}
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ <div className="template-query-promotor__group template-query-promotor__group--template">
172
+ <div className="template-query-promotor__group__header">
173
+ template query
174
+ </div>
175
+ <div className="template-query-promotor__group__content">
176
+ <div className="template-query-promotor__input">
177
+ <div className="template-query-promotor__input__label">
178
+ id
179
+ </div>
180
+ <div className="input-group template-query-promotor__input__input">
181
+ <input
182
+ className={clsx(
183
+ 'input input--dark input-group__input',
184
+ {
185
+ 'input-group__input--error':
186
+ !queryPromotionReviewerStore.isTemplateQueryIdValid,
187
+ },
188
+ )}
189
+ spellCheck={false}
190
+ placeholder="Create an id for your template query"
191
+ value={queryPromotionReviewerStore.templateQueryId}
192
+ onChange={onChangeTemplateQueryId}
193
+ />
194
+ {!queryPromotionReviewerStore.isTemplateQueryIdValid && (
195
+ <div className="input-group__error-message">
196
+ Invalid template query id
197
+ </div>
198
+ )}
199
+ </div>
200
+ </div>
201
+ <div className="template-query-promotor__input">
202
+ <div className="template-query-promotor__input__label">
203
+ title
204
+ </div>
205
+ <div className="input-group template-query-promotor__input__input">
206
+ <input
207
+ className="input input--dark input-group__input"
208
+ spellCheck={false}
209
+ placeholder="Create a title for your template query"
210
+ value={queryPromotionReviewerStore.templateQueryTitle}
211
+ onChange={onChangeTemplateQueryTitle}
212
+ />
213
+ </div>
214
+ </div>
215
+ <div className="template-query-promotor__input">
216
+ <div className="template-query-promotor__input__label">
217
+ description
218
+ </div>
219
+ <div className="input-group template-query-promotor__input__input">
220
+ <input
221
+ className="input input--dark input-group__input"
222
+ spellCheck={false}
223
+ placeholder="Add some descriptions for your template query"
224
+ value={
225
+ queryPromotionReviewerStore.templateQueryDescription
226
+ }
227
+ onChange={onChangeTemplateQueryDescription}
228
+ />
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </div>
233
+ <div className="template-query-promotor__actions">
234
+ <button
235
+ className="template-query-promotor__next-btn btn--dark"
236
+ onClick={promoteTemplateQuery}
237
+ disabled={
238
+ queryPromotionReviewerStore.promoteState.isInProgress ||
239
+ !queryPromotionReviewerStore.currentQuery ||
240
+ !queryPromotionReviewerStore.currentQueryInfo ||
241
+ !queryPromotionReviewerStore.currentProject ||
242
+ !queryPromotionReviewerStore
243
+ .currentProjectConfigurationStatus?.isConfigured ||
244
+ !queryPromotionReviewerStore.workspaceName ||
245
+ !queryPromotionReviewerStore.templateQueryTitle ||
246
+ !queryPromotionReviewerStore.isWorkspaceNameValid ||
247
+ !queryPromotionReviewerStore.isTemplateQueryIdValid
248
+ }
249
+ >
250
+ Promote Query
251
+ </button>
252
+ </div>
253
+ </div>
254
+ </div>
255
+ </div>
256
+ <div
257
+ data-testid={LEGEND_STUDIO_TEST_ID.STATUS_BAR}
258
+ className="editor__status-bar"
259
+ />
260
+ </div>
261
+ </div>
262
+ );
263
+ });
264
+
265
+ export const DataSpaceTemplateQueryPromotionReviewer = observer(() => {
266
+ const parameters =
267
+ useParams<DataSpaceTemplateQueryPromotionReviewerPathParams>();
268
+ const dataSpacePath =
269
+ parameters[
270
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
271
+ ];
272
+ const queryId =
273
+ parameters[
274
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.QUERY_ID
275
+ ];
276
+
277
+ return (
278
+ <DataSpaceTemplateQueryPromotionReviewerStoreProvider
279
+ dataSpacePath={dataSpacePath}
280
+ queryId={queryId}
281
+ >
282
+ <TemplateQueryPromotionReviewerContent />
283
+ </DataSpaceTemplateQueryPromotionReviewerStoreProvider>
284
+ );
285
+ });
@@ -100,12 +100,14 @@ export class DataSpaceExecutableTemplate
100
100
  extends DataSpaceExecutable
101
101
  implements Hashable
102
102
  {
103
+ id!: string;
103
104
  query!: RawLambda;
104
105
  executionContextKey?: string;
105
106
 
106
107
  override get hashCode(): string {
107
108
  return hashArray([
108
109
  DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_TEMPLATE_EXECUTABLE,
110
+ this.id,
109
111
  this.title,
110
112
  this.description ?? '',
111
113
  this.query,
@@ -130,6 +130,7 @@ export abstract class DataSpaceExecutableInfo {
130
130
  }
131
131
 
132
132
  export class DataSpaceTemplateExecutableInfo extends DataSpaceExecutableInfo {
133
+ id!: string;
133
134
  executionContextKey!: string;
134
135
  }
135
136
 
@@ -16,6 +16,7 @@
16
16
 
17
17
  import {
18
18
  type AbstractPureGraphManager,
19
+ type RawLambda,
19
20
  AbstractPureGraphManagerExtension,
20
21
  } from '@finos/legend-graph';
21
22
  import type { Entity } from '@finos/legend-storage';
@@ -38,6 +39,20 @@ export abstract class DSL_DataSpace_PureGraphManagerExtension extends AbstractPu
38
39
  cacheRetriever: () => Promise<PlainObject<DataSpaceAnalysisResult>>,
39
40
  actionState?: ActionState,
40
41
  ): Promise<DataSpaceAnalysisResult | undefined>;
42
+
43
+ abstract addNewExecutableToDataSpaceEntity(
44
+ dataSpaceEntity: Entity,
45
+ executable: {
46
+ id: string;
47
+ title: string;
48
+ mapping: string;
49
+ runtime: string;
50
+ query: RawLambda;
51
+ description?: string;
52
+ },
53
+ ): Promise<Entity>;
54
+
55
+ abstract IsTemplateQueryIdValid(dataSpaceEntity: Entity, id: string): boolean;
41
56
  }
42
57
 
43
58
  export const DSL_DataSpace_getGraphManagerExtension = (
@@ -229,6 +229,7 @@ export class DSL_DataSpace_PureProtocolProcessorPlugin
229
229
  executableProtocol instanceof V1_DataSpaceTemplateExecutable
230
230
  ) {
231
231
  const executable = new DataSpaceExecutableTemplate();
232
+ executable.id = executableProtocol.id;
232
233
  executable.title = executableProtocol.title;
233
234
  executable.description = executableProtocol.description;
234
235
  executable.query = V1_buildRawLambdaWithResolvedPaths(
@@ -418,6 +419,7 @@ export class DSL_DataSpace_PureProtocolProcessorPlugin
418
419
  protocol.executables = metamodel.executables?.map((executable) => {
419
420
  if (executable instanceof DataSpaceExecutableTemplate) {
420
421
  const executableProtocol = new V1_DataSpaceTemplateExecutable();
422
+ executableProtocol.id = executable.id;
421
423
  executableProtocol.title = executable.title;
422
424
  executableProtocol.description = executable.description;
423
425
  if (executable.executionContextKey) {
@@ -15,10 +15,12 @@
15
15
  */
16
16
 
17
17
  import {
18
+ type AbstractPureGraphManager,
19
+ type PureProtocolProcessorPlugin,
20
+ type RawLambda,
18
21
  PureModel,
19
22
  V1_PureGraphManager,
20
23
  PureClientVersion,
21
- type AbstractPureGraphManager,
22
24
  CoreModel,
23
25
  SystemModel,
24
26
  V1_Mapping,
@@ -29,13 +31,16 @@ import {
29
31
  V1_Class,
30
32
  GRAPH_MANAGER_EVENT,
31
33
  V1_buildDatasetSpecification,
32
- type PureProtocolProcessorPlugin,
33
34
  V1_buildModelCoverageAnalysisResult,
35
+ V1_deserializePackageableElement,
36
+ V1_transformRawLambda,
37
+ V1_GraphTransformerContextBuilder,
34
38
  } from '@finos/legend-graph';
35
39
  import type { Entity } from '@finos/legend-storage';
36
40
  import {
37
41
  ActionState,
38
42
  assertErrorThrown,
43
+ filterByType,
39
44
  guaranteeNonEmptyString,
40
45
  guaranteeNonNullable,
41
46
  guaranteeType,
@@ -49,8 +54,10 @@ import {
49
54
  DataSpaceSupportEmail,
50
55
  } from '../../../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
51
56
  import {
57
+ V1_DataSpace,
52
58
  V1_DataSpaceSupportCombinedInfo,
53
59
  V1_DataSpaceSupportEmail,
60
+ V1_DataSpaceTemplateExecutable,
54
61
  } from '../../../../graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js';
55
62
  import {
56
63
  DataSpaceAnalysisResult,
@@ -101,6 +108,62 @@ export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_Pu
101
108
  return PureClientVersion.V1_0_0;
102
109
  }
103
110
 
111
+ getDataSpaceProtocolFromEntity(dataSpaceEntity: Entity): V1_DataSpace {
112
+ return guaranteeType(
113
+ V1_deserializePackageableElement(
114
+ dataSpaceEntity.content,
115
+ this.graphManager.pluginManager.getPureProtocolProcessorPlugins(),
116
+ ),
117
+ V1_DataSpace,
118
+ );
119
+ }
120
+
121
+ IsTemplateQueryIdValid(dataSpaceEntity: Entity, id: string): boolean {
122
+ const dataSpaceProtocol =
123
+ this.getDataSpaceProtocolFromEntity(dataSpaceEntity);
124
+ return !dataSpaceProtocol.executables
125
+ ?.filter(filterByType(V1_DataSpaceTemplateExecutable))
126
+ .map((et) => et.id)
127
+ .includes(id);
128
+ }
129
+
130
+ async addNewExecutableToDataSpaceEntity(
131
+ dataSpaceEntity: Entity,
132
+ executable: {
133
+ id: string;
134
+ title: string;
135
+ mapping: string;
136
+ runtime: string;
137
+ query: RawLambda;
138
+ description?: string;
139
+ },
140
+ ): Promise<Entity> {
141
+ const dataSpaceProtocol =
142
+ this.getDataSpaceProtocolFromEntity(dataSpaceEntity);
143
+ const dataSpaceTemplateExecutable = new V1_DataSpaceTemplateExecutable();
144
+ dataSpaceTemplateExecutable.id = executable.id;
145
+ dataSpaceTemplateExecutable.title = executable.title;
146
+ dataSpaceTemplateExecutable.description = executable.description;
147
+ dataSpaceTemplateExecutable.executionContextKey = guaranteeNonNullable(
148
+ dataSpaceProtocol.executionContexts.filter(
149
+ (ec) =>
150
+ ec.mapping.path === executable.mapping &&
151
+ ec.defaultRuntime.path === executable.runtime,
152
+ )[0]?.name,
153
+ 'can`t find a corresponding executatin key based on query`s mapping and runtime in dataspace',
154
+ );
155
+ dataSpaceTemplateExecutable.query = V1_transformRawLambda(
156
+ executable.query,
157
+ new V1_GraphTransformerContextBuilder(
158
+ this.graphManager.pluginManager.getPureProtocolProcessorPlugins(),
159
+ ).build(),
160
+ );
161
+ dataSpaceProtocol.executables = dataSpaceProtocol.executables
162
+ ? [...dataSpaceProtocol.executables, dataSpaceTemplateExecutable]
163
+ : [dataSpaceTemplateExecutable];
164
+ return this.graphManager.elementProtocolToEntity(dataSpaceProtocol);
165
+ }
166
+
104
167
  async analyzeDataSpace(
105
168
  dataSpacePath: string,
106
169
  entitiesRetriever: () => Promise<Entity[]>,
@@ -496,6 +559,7 @@ export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_Pu
496
559
  executableProtocol.info instanceof V1_DataSpaceTemplateExecutableInfo
497
560
  ) {
498
561
  const templateExecutableInfo = new DataSpaceTemplateExecutableInfo();
562
+ templateExecutableInfo.id = executableProtocol.info.id;
499
563
  templateExecutableInfo.query = executableProtocol.info.query;
500
564
  templateExecutableInfo.executionContextKey =
501
565
  executableProtocol.info.executionContextKey;
@@ -254,6 +254,7 @@ const V1_DATA_SPACE_MULTI_EXECUTION_SERVICE_EXECUTABLE_INFO_TYPE =
254
254
  'multiExecutionService';
255
255
 
256
256
  export class V1_DataSpaceTemplateExecutableInfo extends V1_DataSpaceExecutableInfo {
257
+ id!: string;
257
258
  executionContextKey!: string;
258
259
  }
259
260
 
@@ -264,6 +265,7 @@ const V1_DataSpaceTemplateExecutableInfoModelSchema = (
264
265
  _type: usingConstantValueSchema(
265
266
  V1_DATA_SPACE_TEMPLATE_EXECUTABLE_INFO_TYPE,
266
267
  ),
268
+ id: primitive(),
267
269
  executionContextKey: primitive(),
268
270
  });
269
271
 
@@ -93,12 +93,14 @@ export class V1_DataSpaceTemplateExecutable
93
93
  extends V1_DataSpaceExecutable
94
94
  implements Hashable
95
95
  {
96
+ id!: string;
96
97
  query!: V1_RawLambda;
97
98
  executionContextKey?: string;
98
99
 
99
100
  override get hashCode(): string {
100
101
  return hashArray([
101
102
  DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_TEMPLATE_EXECUTABLE,
103
+ this.id,
102
104
  this.title,
103
105
  this.description ?? '',
104
106
  this.query,
@@ -156,6 +156,7 @@ const V1_dataSpaceTemplateExecutableModelSchema = createModelSchema(
156
156
  _type: usingConstantValueSchema(V1_DATA_SPACE_TEMPLATE_EXECUTABLE),
157
157
  description: optional(primitive()),
158
158
  title: primitive(),
159
+ id: primitive(),
159
160
  query: usingModelSchema(V1_rawLambdaModelSchema),
160
161
  executionContextKey: optional(primitive()),
161
162
  },
@@ -40,11 +40,7 @@ import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol
40
40
  import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
41
41
  import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
42
42
  import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
43
- import {
44
- DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
45
- DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
46
- type GenericLegendApplicationStore,
47
- } from '@finos/legend-application';
43
+ import { type GenericLegendApplicationStore } from '@finos/legend-application';
48
44
  import { retrieveAnalyticsResultCache } from '../../graph-manager/action/analytics/DataSpaceAnalysisHelper.js';
49
45
  import type { DataSpaceAnalysisResult } from '../../graph-manager/action/analytics/DataSpaceAnalysis.js';
50
46
  import { generateServiceQueryCreatorRoute } from '@finos/legend-application-query';
@@ -128,20 +124,16 @@ export class DataSpaceAdvancedSearchState {
128
124
  this.toGetSnapShot = val;
129
125
  }
130
126
 
131
- *loadDataSpaces(searchText: string): GeneratorFn<void> {
132
- const isValidSearchString =
133
- searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
127
+ *loadDataSpaces(): GeneratorFn<void> {
134
128
  this.loadDataSpacesState.inProgress();
135
129
  try {
136
130
  this.dataSpaces = (
137
- (yield this.depotServerClient.getEntitiesByClassifierPath(
131
+ (yield this.depotServerClient.getEntitiesByClassifier(
138
132
  DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
139
133
  {
140
- search: isValidSearchString ? searchText : undefined,
141
134
  scope: this.toGetSnapShot
142
135
  ? DepotScope.SNAPSHOT
143
136
  : DepotScope.RELEASES,
144
- limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
145
137
  },
146
138
  )) as StoredEntity[]
147
139
  ).map((storedEntity) =>
@@ -14,11 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {
18
- type GenericLegendApplicationStore,
19
- DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
20
- DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
21
- } from '@finos/legend-application';
17
+ import { type GenericLegendApplicationStore } from '@finos/legend-application';
22
18
  import {
23
19
  type QueryBuilderConfig,
24
20
  QueryBuilderState,
@@ -240,21 +236,17 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
240
236
  this.showRuntimeSelector = val;
241
237
  }
242
238
 
243
- *loadDataSpaces(searchText: string): GeneratorFn<void> {
239
+ *loadDataSpaces(): GeneratorFn<void> {
244
240
  if (this.projectInfo) {
245
- const isValidSearchString =
246
- searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
247
241
  this.loadDataSpacesState.inProgress();
248
242
  const toGetSnapShot =
249
243
  this.projectInfo.versionId === SNAPSHOT_VERSION_ALIAS;
250
244
  try {
251
245
  this.dataSpaces = (
252
- (yield this.depotServerClient.getEntitiesByClassifierPath(
246
+ (yield this.depotServerClient.getEntitiesByClassifier(
253
247
  DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
254
248
  {
255
- search: isValidSearchString ? searchText : undefined,
256
249
  scope: toGetSnapShot ? DepotScope.SNAPSHOT : DepotScope.RELEASES,
257
- limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
258
250
  },
259
251
  )) as StoredEntity[]
260
252
  ).map((storedEntity) =>
@@ -27,11 +27,7 @@ import {
27
27
  type StoredEntity,
28
28
  } from '@finos/legend-server-depot';
29
29
  import type { GraphManagerState, RawLambda } from '@finos/legend-graph';
30
- import {
31
- DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
32
- DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
33
- type GenericLegendApplicationStore,
34
- } from '@finos/legend-application';
30
+ import { type GenericLegendApplicationStore } from '@finos/legend-application';
35
31
  import { action, flow, makeObservable, observable } from 'mobx';
36
32
  import {
37
33
  type QueryBuilderConfig,
@@ -132,18 +128,14 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
132
128
  this.advancedSearchState = undefined;
133
129
  }
134
130
 
135
- *loadDataSpaces(searchText: string): GeneratorFn<void> {
136
- const isValidSearchString =
137
- searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
131
+ *loadDataSpaces(): GeneratorFn<void> {
138
132
  this.loadDataSpacesState.inProgress();
139
133
  try {
140
134
  this.dataSpaces = (
141
- (yield this.depotServerClient.getEntitiesByClassifierPath(
135
+ (yield this.depotServerClient.getEntitiesByClassifier(
142
136
  DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
143
137
  {
144
- search: isValidSearchString ? searchText : undefined,
145
138
  scope: DepotScope.RELEASES,
146
- limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
147
139
  },
148
140
  )) as StoredEntity[]
149
141
  ).map((storedEntity) => extractDataSpaceInfo(storedEntity, false));