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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) 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/DataSpaceQueryBuilderTemplateQueryPanelContent.js +1 -1
  13. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
  14. package/lib/components/query/DataSpaceTemplateQueryCreator.js +4 -4
  15. package/lib/components/query/DataSpaceTemplateQueryCreator.js.map +1 -1
  16. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +2 -0
  17. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  18. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +13 -0
  19. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  20. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts +19 -0
  21. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts.map +1 -0
  22. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js +79 -0
  23. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js.map +1 -0
  24. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts +1 -0
  25. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts.map +1 -1
  26. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js +2 -0
  27. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js.map +1 -1
  28. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts +1 -0
  29. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
  30. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js +1 -0
  31. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js.map +1 -1
  32. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts +10 -1
  33. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  34. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js +2 -0
  37. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  38. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts +12 -1
  39. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  40. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +28 -3
  41. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  42. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +1 -0
  43. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
  44. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +2 -0
  45. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
  46. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts +1 -0
  47. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts.map +1 -1
  48. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js +2 -0
  49. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js.map +1 -1
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js +1 -0
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js.map +1 -1
  53. package/lib/index.css +2 -2
  54. package/lib/index.css.map +1 -1
  55. package/lib/package.json +2 -1
  56. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts +3 -2
  57. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  58. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +9 -13
  59. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  60. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +61 -0
  61. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +1 -0
  62. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js +407 -0
  63. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js.map +1 -0
  64. package/package.json +8 -7
  65. package/src/__lib__/query/DSL_DataSpace_LegendQueryNavigation.ts +43 -9
  66. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +1 -0
  67. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +117 -3
  68. package/src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +1 -1
  69. package/src/components/query/DataSpaceTemplateQueryCreator.tsx +6 -6
  70. package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +18 -1
  71. package/src/components/studio/DataSpaceTemplateQueryPromoteReview.tsx +285 -0
  72. package/src/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.ts +2 -0
  73. package/src/graph-manager/action/analytics/DataSpaceAnalysis.ts +1 -0
  74. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.ts +15 -0
  75. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.ts +2 -0
  76. package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +66 -2
  77. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +2 -0
  78. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.ts +2 -0
  79. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts +1 -0
  80. package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +12 -24
  81. package/src/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.ts +636 -0
  82. package/tsconfig.json +2 -0
@@ -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
  },
@@ -29,7 +29,6 @@ import {
29
29
  import {
30
30
  type DepotServerClient,
31
31
  StoreProjectData,
32
- LATEST_VERSION_ALIAS,
33
32
  } from '@finos/legend-server-depot';
34
33
  import { filterByType, guaranteeNonNullable, uuid } from '@finos/legend-shared';
35
34
 
@@ -58,7 +57,8 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
58
57
  readonly artifactId: string;
59
58
  readonly versionId: string;
60
59
  readonly dataSpacePath: string;
61
- readonly templateQueryTitle: string;
60
+ readonly templateQueryId: string;
61
+ templateQueryTitle?: string;
62
62
 
63
63
  constructor(
64
64
  applicationStore: LegendQueryApplicationStore,
@@ -67,7 +67,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
67
67
  artifactId: string,
68
68
  versionId: string,
69
69
  dataSpacePath: string,
70
- templateQueryTitle: string,
70
+ templateQueryId: string,
71
71
  ) {
72
72
  super(applicationStore, depotServerClient);
73
73
 
@@ -75,7 +75,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
75
75
  this.artifactId = artifactId;
76
76
  this.versionId = versionId;
77
77
  this.dataSpacePath = dataSpacePath;
78
- this.templateQueryTitle = templateQueryTitle;
78
+ this.templateQueryId = templateQueryId;
79
79
  }
80
80
 
81
81
  getProjectInfo(): ProjectGAVCoordinates {
@@ -94,8 +94,8 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
94
94
  const dataSpaceExecutableTemplate = guaranteeNonNullable(
95
95
  dataSpace.executables
96
96
  ?.filter(filterByType(DataSpaceExecutableTemplate))
97
- .find((executable) => executable.title === this.templateQueryTitle),
98
- `Can't find template query with title '${this.templateQueryTitle}'`,
97
+ .find((executable) => executable.id === this.templateQueryId),
98
+ `Can't find template query with id '${this.templateQueryId}'`,
99
99
  );
100
100
  const executionContext = guaranteeNonNullable(
101
101
  dataSpaceExecutableTemplate.executionContextKey
@@ -105,7 +105,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
105
105
  : dataSpace.defaultExecutionContext,
106
106
  `Can't find execution context '${dataSpaceExecutableTemplate.executionContextKey}'`,
107
107
  );
108
-
108
+ this.templateQueryTitle = dataSpaceExecutableTemplate.title;
109
109
  let dataSpaceAnalysisResult;
110
110
  try {
111
111
  const project = StoreProjectData.serialization.fromJson(
@@ -147,21 +147,9 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
147
147
  dataSpace,
148
148
  executionContext,
149
149
  (dataSpaceInfo: DataSpaceInfo) => {
150
- if (dataSpaceInfo.defaultExecutionContext) {
151
- this.applicationStore.navigationService.navigator.goToLocation(
152
- generateDataSpaceTemplateQueryCreatorRoute(
153
- guaranteeNonNullable(dataSpaceInfo.groupId),
154
- guaranteeNonNullable(dataSpaceInfo.artifactId),
155
- LATEST_VERSION_ALIAS, //always default to latest
156
- dataSpaceInfo.path,
157
- this.templateQueryTitle,
158
- ),
159
- );
160
- } else {
161
- this.applicationStore.notificationService.notifyWarning(
162
- `Can't switch data space: default execution context not specified`,
163
- );
164
- }
150
+ this.applicationStore.notificationService.notifyWarning(
151
+ `Can't switch data space to visit current template query`,
152
+ );
165
153
  },
166
154
  true,
167
155
  dataSpaceAnalysisResult,
@@ -172,7 +160,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
172
160
  this.artifactId,
173
161
  this.versionId,
174
162
  dataSpace.path,
175
- this.templateQueryTitle,
163
+ this.templateQueryId,
176
164
  ),
177
165
  );
178
166
  },
@@ -196,7 +184,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
196
184
  defaultName: options?.update
197
185
  ? `${extractElementNameFromPath(this.dataSpacePath)}`
198
186
  : `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${
199
- this.templateQueryTitle
187
+ this.templateQueryId
200
188
  }]`,
201
189
  decorator: (query: Query): void => {
202
190
  query.id = uuid();