@finos/legend-extension-dsl-data-space 3.0.4 → 4.0.2

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 (54) hide show
  1. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  2. package/lib/components/DataSpaceViewer.js +5 -6
  3. package/lib/components/DataSpaceViewer.js.map +1 -1
  4. package/lib/components/query/DataSpaceQuerySetup.js +3 -3
  5. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  6. package/lib/components/studio/DSLDataSpace_CodeSnippets.d.ts +1 -1
  7. package/lib/components/studio/DSLDataSpace_CodeSnippets.d.ts.map +1 -1
  8. package/lib/components/studio/DSLDataSpace_CodeSnippets.js +0 -3
  9. package/lib/components/studio/DSLDataSpace_CodeSnippets.js.map +1 -1
  10. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.d.ts.map +1 -1
  11. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js +5 -8
  12. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js.map +1 -1
  13. package/lib/index.css +2 -2
  14. package/lib/index.css.map +1 -1
  15. package/lib/index.d.ts +2 -1
  16. package/lib/index.d.ts.map +1 -1
  17. package/lib/index.js +2 -1
  18. package/lib/index.js.map +1 -1
  19. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.d.ts +5 -7
  20. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.d.ts.map +1 -1
  21. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.js +4 -10
  22. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.js.map +1 -1
  23. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts +1 -36
  24. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  25. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js +9 -93
  26. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  27. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.d.ts +0 -3
  28. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.d.ts.map +1 -1
  29. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.js +0 -6
  30. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.js.map +1 -1
  31. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts.map +1 -1
  32. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js +2 -5
  33. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js.map +1 -1
  34. package/lib/package.json +5 -5
  35. package/lib/stores/DataSpaceViewerState.d.ts +8 -8
  36. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  37. package/lib/stores/DataSpaceViewerState.js +9 -9
  38. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  39. package/lib/stores/query/DataSpaceQuerySetupState.d.ts +7 -13
  40. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
  41. package/lib/stores/query/DataSpaceQuerySetupState.js +13 -21
  42. package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
  43. package/package.json +15 -15
  44. package/src/components/DataSpaceViewer.tsx +18 -47
  45. package/src/components/query/DataSpaceQuerySetup.tsx +5 -5
  46. package/src/components/studio/DSLDataSpace_CodeSnippets.ts +0 -3
  47. package/src/components/studio/DSLDataSpace_LegendStudioPlugin.tsx +12 -9
  48. package/src/index.ts +2 -1
  49. package/src/models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.ts +14 -12
  50. package/src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts +15 -170
  51. package/src/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DSLDataSpace_DataSpace.ts +0 -6
  52. package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts +2 -4
  53. package/src/stores/DataSpaceViewerState.ts +18 -18
  54. package/src/stores/query/DataSpaceQuerySetupState.ts +28 -71
@@ -37,6 +37,7 @@ import {
37
37
  UnsupportedOperationError,
38
38
  usingConstantValueSchema,
39
39
  usingModelSchema,
40
+ optionalCustom,
40
41
  } from '@finos/legend-shared';
41
42
  import {
42
43
  type V1_DataSpaceSupportInfo,
@@ -96,11 +97,10 @@ const V1_deserializeSupportInfo = (
96
97
 
97
98
  export const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
98
99
  _type: usingConstantValueSchema(V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE),
99
- artifactId: primitive(),
100
100
  defaultExecutionContext: primitive(),
101
101
  description: optional(primitive()),
102
102
  executionContexts: list(object(V1_dataSpaceExecutionContextModelSchema)),
103
- featuredDiagrams: custom(
103
+ featuredDiagrams: optionalCustom(
104
104
  (values) =>
105
105
  serializeArray(
106
106
  values,
@@ -121,7 +121,6 @@ export const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
121
121
  },
122
122
  ),
123
123
  ),
124
- groupId: primitive(),
125
124
  name: primitive(),
126
125
  package: primitive(),
127
126
  stereotypes: custom(
@@ -158,5 +157,4 @@ export const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
158
157
  skipIfEmpty: false,
159
158
  }),
160
159
  ),
161
- versionId: primitive(),
162
160
  });
@@ -28,9 +28,9 @@ import type {
28
28
  import { guaranteeNonNullable } from '@finos/legend-shared';
29
29
  import { action, computed, makeObservable, observable } from 'mobx';
30
30
  import type {
31
- ResolvedDataSpace,
32
- ResolvedDataSpaceExecutionContext,
33
- } from '../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
31
+ DataSpace,
32
+ DataSpaceExecutionContext,
33
+ } from '../models/metamodels/pure/model/packageableElements/dataSpace/DSLDataSpace_DataSpace.js';
34
34
 
35
35
  export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
36
36
  MODELS_OVERVIEW = 'MODELS_OVERVIEW',
@@ -44,14 +44,14 @@ export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
44
44
 
45
45
  export class DataSpaceViewerState {
46
46
  graphManagerState: GraphManagerState;
47
- dataSpaceGroupId: string;
48
- dataSpaceArtifactId: string;
49
- dataSpaceVersionId: string;
50
- dataSpace: ResolvedDataSpace;
47
+ groupId: string;
48
+ artifactId: string;
49
+ versionId: string;
50
+ dataSpace: DataSpace;
51
51
  _renderer?: DiagramRenderer | undefined;
52
52
  currentDiagram?: Diagram | undefined;
53
53
  currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW;
54
- currentExecutionContext: ResolvedDataSpaceExecutionContext;
54
+ currentExecutionContext: DataSpaceExecutionContext;
55
55
  currentRuntime: PackageableRuntime;
56
56
  viewProject?:
57
57
  | ((
@@ -65,10 +65,10 @@ export class DataSpaceViewerState {
65
65
 
66
66
  constructor(
67
67
  graphManagerState: GraphManagerState,
68
- dataSpaceGroupId: string,
69
- dataSpaceArtifactId: string,
70
- dataSpaceVersionId: string,
71
- dataSpace: ResolvedDataSpace,
68
+ groupId: string,
69
+ artifactId: string,
70
+ versionId: string,
71
+ dataSpace: DataSpace,
72
72
  options?: {
73
73
  viewProject?: (
74
74
  groupId: string,
@@ -95,13 +95,13 @@ export class DataSpaceViewerState {
95
95
 
96
96
  this.graphManagerState = graphManagerState;
97
97
  this.dataSpace = dataSpace;
98
- this.dataSpaceGroupId = dataSpaceGroupId;
99
- this.dataSpaceArtifactId = dataSpaceArtifactId;
100
- this.dataSpaceVersionId = dataSpaceVersionId;
98
+ this.groupId = groupId;
99
+ this.artifactId = artifactId;
100
+ this.versionId = versionId;
101
101
  this.currentExecutionContext = this.dataSpace.defaultExecutionContext;
102
102
  this.currentRuntime =
103
103
  this.dataSpace.defaultExecutionContext.defaultRuntime.value;
104
- this.currentDiagram = this.dataSpace.featuredDiagrams.length
104
+ this.currentDiagram = this.dataSpace.featuredDiagrams?.length
105
105
  ? (
106
106
  this.dataSpace
107
107
  .featuredDiagrams[0] as PackageableElementReference<Diagram>
@@ -125,7 +125,7 @@ export class DataSpaceViewerState {
125
125
  }
126
126
 
127
127
  get featuredDiagrams(): Diagram[] {
128
- return this.dataSpace.featuredDiagrams.map((ref) => ref.value);
128
+ return this.dataSpace.featuredDiagrams?.map((ref) => ref.value) ?? [];
129
129
  }
130
130
 
131
131
  get diagrams(): Diagram[] {
@@ -183,7 +183,7 @@ export class DataSpaceViewerState {
183
183
  this.currentActivity = val;
184
184
  }
185
185
 
186
- setCurrentExecutionContext(val: ResolvedDataSpaceExecutionContext): void {
186
+ setCurrentExecutionContext(val: DataSpaceExecutionContext): void {
187
187
  this.currentExecutionContext = val;
188
188
  this.currentRuntime = val.defaultRuntime.value;
189
189
  }
@@ -16,7 +16,6 @@
16
16
 
17
17
  import type { ClassView } from '@finos/legend-extension-dsl-diagram';
18
18
  import { type Class, QueryTaggedValue } from '@finos/legend-graph';
19
- import type { Entity } from '@finos/legend-model-storage';
20
19
  import {
21
20
  type QuerySetupStore,
22
21
  CreateQueryInfoState,
@@ -25,7 +24,6 @@ import {
25
24
  } from '@finos/legend-query';
26
25
  import {
27
26
  type StoredEntity,
28
- generateGAVCoordinates,
29
27
  DepotScope,
30
28
  ProjectData,
31
29
  SNAPSHOT_VERSION_ALIAS,
@@ -35,53 +33,37 @@ import {
35
33
  type PlainObject,
36
34
  ActionState,
37
35
  assertErrorThrown,
38
- guaranteeNonNullable,
39
36
  } from '@finos/legend-shared';
40
37
  import { action, flow, flowResult, makeObservable, observable } from 'mobx';
41
- import {
42
- DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
43
- getResolvedDataSpace,
44
- } from '../../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
38
+ import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
39
+ import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
45
40
  import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
46
41
 
47
- export type LightDataSpace = Entity & {
42
+ export interface DataSpaceContext {
48
43
  groupId: string;
49
44
  artifactId: string;
50
45
  versionId: string;
51
46
  path: string;
52
- content: {
53
- groupId: string;
54
- artifactId: string;
55
- versionId: string;
56
- };
57
- };
47
+ }
58
48
 
59
49
  const QUERY_PROFILE_PATH = 'meta::pure::profiles::query';
60
50
  const QUERY_PROFILE_TAG_DATA_SPACE = 'dataSpace';
61
- const DATA_SPACE_ID_DELIMITER = '@';
62
51
 
63
52
  export const createQueryDataSpaceTaggedValue = (
64
53
  dataSpacePath: string,
65
- groupId: string,
66
- artifactId: string,
67
- versionId: string,
68
54
  ): QueryTaggedValue => {
69
55
  const taggedValue = new QueryTaggedValue();
70
56
  taggedValue.profile = QUERY_PROFILE_PATH;
71
57
  taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
72
- taggedValue.value = `${generateGAVCoordinates(
73
- groupId,
74
- artifactId,
75
- versionId,
76
- )}${DATA_SPACE_ID_DELIMITER}${dataSpacePath}`;
58
+ taggedValue.value = dataSpacePath;
77
59
  return taggedValue;
78
60
  };
79
61
 
80
62
  export class DataSpaceQuerySetupState extends QuerySetupState {
81
- dataSpaces: LightDataSpace[] = [];
63
+ dataSpaces: DataSpaceContext[] = [];
82
64
  loadDataSpacesState = ActionState.create();
83
65
  setUpDataSpaceState = ActionState.create();
84
- currentDataSpace?: LightDataSpace | undefined;
66
+ currentDataSpace?: DataSpaceContext | undefined;
85
67
  dataSpaceViewerState?: DataSpaceViewerState | undefined;
86
68
  toGetSnapShot = false;
87
69
 
@@ -102,7 +84,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
102
84
  });
103
85
  }
104
86
 
105
- setCurrentDataSpace(val: LightDataSpace | undefined): void {
87
+ setCurrentDataSpace(val: DataSpaceContext | undefined): void {
106
88
  this.currentDataSpace = val;
107
89
  }
108
90
 
@@ -134,33 +116,14 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
134
116
  limit: 10,
135
117
  },
136
118
  )) as StoredEntity[]
137
- ).map(
138
- (storedEntity) =>
139
- ({
140
- ...storedEntity.entity,
141
- groupId: storedEntity.groupId,
142
- artifactId: storedEntity.artifactId,
143
- versionId: this.toGetSnapShot
144
- ? SNAPSHOT_VERSION_ALIAS
145
- : storedEntity.versionId,
146
- path: storedEntity.entity.path,
147
- content: {
148
- ...storedEntity.entity.content,
149
- groupId: guaranteeNonNullable(
150
- storedEntity.entity.content.groupId,
151
- `Data space 'groupId' field is missing`,
152
- ),
153
- artifactId: guaranteeNonNullable(
154
- storedEntity.entity.content.artifactId,
155
- `Data space 'artifactId' field is missing`,
156
- ),
157
- versionId: guaranteeNonNullable(
158
- storedEntity.entity.content.versionId,
159
- `Data space 'versionId' field is missing`,
160
- ),
161
- },
162
- } as LightDataSpace),
163
- );
119
+ ).map((storedEntity) => ({
120
+ groupId: storedEntity.groupId,
121
+ artifactId: storedEntity.artifactId,
122
+ versionId: this.toGetSnapShot
123
+ ? SNAPSHOT_VERSION_ALIAS
124
+ : storedEntity.versionId,
125
+ path: storedEntity.entity.path,
126
+ }));
164
127
  this.loadDataSpacesState.pass();
165
128
  } catch (error) {
166
129
  assertErrorThrown(error);
@@ -169,7 +132,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
169
132
  }
170
133
  }
171
134
 
172
- *setUpDataSpace(dataSpace: LightDataSpace): GeneratorFn<void> {
135
+ *setUpDataSpace(dataSpace: DataSpaceContext): GeneratorFn<void> {
173
136
  if (this.queryStore.initState.isInInitialState) {
174
137
  yield flowResult(this.queryStore.initialize());
175
138
  } else if (this.queryStore.initState.isInProgress) {
@@ -180,25 +143,22 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
180
143
  const projectData = ProjectData.serialization.fromJson(
181
144
  (yield flowResult(
182
145
  this.queryStore.depotServerClient.getProject(
183
- dataSpace.content.groupId,
184
- dataSpace.content.artifactId,
146
+ dataSpace.groupId,
147
+ dataSpace.artifactId,
185
148
  ),
186
149
  )) as PlainObject<ProjectData>,
187
150
  );
188
151
 
189
152
  yield flowResult(
190
- this.queryStore.buildGraph(projectData, dataSpace.content.versionId),
191
- );
192
- const resolvedDataSpace = getResolvedDataSpace(
193
- dataSpace.content,
194
- this.queryStore.graphManagerState.graph,
153
+ this.queryStore.buildGraph(projectData, dataSpace.versionId),
195
154
  );
155
+
196
156
  this.dataSpaceViewerState = new DataSpaceViewerState(
197
157
  this.queryStore.graphManagerState,
198
158
  dataSpace.groupId,
199
159
  dataSpace.artifactId,
200
160
  dataSpace.versionId,
201
- resolvedDataSpace,
161
+ getDataSpace(dataSpace.path, this.queryStore.graphManagerState.graph),
202
162
  {
203
163
  viewProject: (
204
164
  groupId: string,
@@ -230,32 +190,29 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
230
190
  const projectData = ProjectData.serialization.fromJson(
231
191
  (yield flowResult(
232
192
  this.queryStore.depotServerClient.getProject(
233
- this.dataSpaceViewerState.dataSpace.groupId,
234
- this.dataSpaceViewerState.dataSpace.artifactId,
193
+ this.dataSpaceViewerState.groupId,
194
+ this.dataSpaceViewerState.artifactId,
235
195
  ),
236
196
  )) as PlainObject<ProjectData>,
237
197
  );
238
198
  const queryInfoState = new CreateQueryInfoState(
239
199
  this.queryStore,
240
200
  projectData,
241
- this.dataSpaceViewerState.dataSpace.versionId,
201
+ this.dataSpaceViewerState.versionId,
242
202
  this.dataSpaceViewerState.currentExecutionContext.mapping.value,
243
203
  this.dataSpaceViewerState.currentRuntime,
244
204
  );
245
205
  queryInfoState.taggedValues = [
246
206
  createQueryDataSpaceTaggedValue(
247
207
  this.dataSpaceViewerState.dataSpace.path,
248
- this.dataSpaceViewerState.dataSpaceGroupId,
249
- this.dataSpaceViewerState.dataSpaceArtifactId,
250
- this.dataSpaceViewerState.dataSpaceVersionId,
251
208
  ),
252
209
  ];
253
210
  this.queryStore.setQueryInfoState(queryInfoState);
254
211
  this.queryStore.applicationStore.navigator.goTo(
255
212
  generateCreateQueryRoute(
256
- this.dataSpaceViewerState.dataSpace.groupId,
257
- this.dataSpaceViewerState.dataSpace.artifactId,
258
- this.dataSpaceViewerState.dataSpace.versionId,
213
+ this.dataSpaceViewerState.groupId,
214
+ this.dataSpaceViewerState.artifactId,
215
+ this.dataSpaceViewerState.versionId,
259
216
  this.dataSpaceViewerState.currentExecutionContext.mapping.value.path,
260
217
  this.dataSpaceViewerState.currentRuntime.path,
261
218
  _class?.path,