@finos/legend-application-studio 28.19.34 → 28.19.36

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 (44) hide show
  1. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts +13 -2
  2. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  3. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +104 -20
  4. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  5. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  6. package/lib/components/editor/side-bar/CreateNewElementModal.js +15 -2
  7. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  8. package/lib/index.css +2 -2
  9. package/lib/index.css.map +1 -1
  10. package/lib/package.json +1 -1
  11. package/lib/stores/editor/NewElementState.d.ts +6 -2
  12. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  13. package/lib/stores/editor/NewElementState.js +25 -12
  14. package/lib/stores/editor/NewElementState.js.map +1 -1
  15. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  16. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +2 -2
  17. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  18. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +25 -1
  19. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  20. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +98 -4
  21. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  22. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  23. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +2 -2
  24. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  25. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.d.ts.map +1 -1
  26. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js +2 -2
  27. package/lib/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.js.map +1 -1
  28. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  29. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +2 -2
  30. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  31. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +14 -1
  32. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  33. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +42 -2
  34. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  35. package/package.json +9 -9
  36. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +357 -41
  37. package/src/components/editor/side-bar/CreateNewElementModal.tsx +33 -0
  38. package/src/stores/editor/NewElementState.ts +25 -12
  39. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +2 -0
  40. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +162 -3
  41. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +2 -0
  42. package/src/stores/editor/editor-state/element-editor-state/mapping/legacy/DEPRECATED__MappingTestState.ts +2 -0
  43. package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +2 -0
  44. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +90 -5
@@ -32,6 +32,20 @@ import {
32
32
  type Stereotype,
33
33
  getStereotype,
34
34
  type StereotypeReference,
35
+ ModelAccessPointGroup,
36
+ PackageableRuntime,
37
+ Association,
38
+ Class,
39
+ Enumeration,
40
+ Package,
41
+ observe_DataProductRuntimeInfo,
42
+ PackageableElementExplicitReference,
43
+ DataProductRuntimeInfo,
44
+ type DataProductElement,
45
+ type Mapping,
46
+ observe_DataProductElementScope,
47
+ DataProductElementScope,
48
+ validate_PureExecutionMapping,
35
49
  } from '@finos/legend-graph';
36
50
  import type { EditorStore } from '../../../EditorStore.js';
37
51
  import { ElementEditorState } from '../ElementEditorState.js';
@@ -57,6 +71,7 @@ import {
57
71
  uuid,
58
72
  swapEntry,
59
73
  returnUndefOnError,
74
+ deepEqual,
60
75
  } from '@finos/legend-shared';
61
76
  import {
62
77
  accessPointGroup_swapAccessPoints,
@@ -65,6 +80,13 @@ import {
65
80
  dataProduct_deleteAccessPoint,
66
81
  dataProduct_deleteAccessPointGroup,
67
82
  dataProduct_swapAccessPointGroups,
83
+ modelAccessPointGroup_addCompatibleRuntime,
84
+ modelAccessPointGroup_addElement,
85
+ modelAccessPointGroup_removeCompatibleRuntime,
86
+ modelAccessPointGroup_removeElement,
87
+ modelAccessPointGroup_setDefaultRuntime,
88
+ modelAccessPointGroup_setElementExclude,
89
+ modelAccessPointGroup_setMapping,
68
90
  } from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
69
91
  import { LambdaEditorState } from '@finos/legend-query-builder';
70
92
  import {
@@ -280,6 +302,16 @@ export class AccessPointGroupState {
280
302
  return undefined;
281
303
  }
282
304
 
305
+ hasErrors(): boolean {
306
+ return (
307
+ this.accessPointStates.length === 0 ||
308
+ this.value.id === '' ||
309
+ Boolean(
310
+ this.accessPointStates.find((apState) => apState.accessPoint.id === ''),
311
+ )
312
+ );
313
+ }
314
+
283
315
  deleteAccessPoint(val: AccessPointState): void {
284
316
  const state = this.accessPointStates.find((a) => a === val);
285
317
  deleteEntry(this.accessPointStates, state);
@@ -313,6 +345,122 @@ export class AccessPointGroupState {
313
345
  }
314
346
  }
315
347
 
348
+ export class ModelAccessPointGroupState extends AccessPointGroupState {
349
+ declare value: ModelAccessPointGroup;
350
+ showNewModal = false;
351
+
352
+ constructor(val: ModelAccessPointGroup, editorState: DataProductEditorState) {
353
+ super(val, editorState);
354
+ this.value = val;
355
+ }
356
+
357
+ setMapping(mapping: Mapping): void {
358
+ modelAccessPointGroup_setMapping(
359
+ this.value,
360
+ PackageableElementExplicitReference.create(mapping),
361
+ );
362
+ }
363
+
364
+ setDefaultRuntime(runtime: DataProductRuntimeInfo) {
365
+ modelAccessPointGroup_setDefaultRuntime(this.value, runtime);
366
+ }
367
+
368
+ addCompatibleRuntime(runtime: PackageableRuntime): void {
369
+ const newRuntime = observe_DataProductRuntimeInfo(
370
+ new DataProductRuntimeInfo(),
371
+ );
372
+ newRuntime.id = runtime.name;
373
+ newRuntime.runtime = PackageableElementExplicitReference.create(runtime);
374
+ modelAccessPointGroup_addCompatibleRuntime(this.value, newRuntime);
375
+
376
+ if (deepEqual(this.value.defaultRuntime, new DataProductRuntimeInfo())) {
377
+ this.setDefaultRuntime(newRuntime);
378
+ }
379
+ }
380
+
381
+ removeCompatibleRuntime(runtime: DataProductRuntimeInfo): void {
382
+ modelAccessPointGroup_removeCompatibleRuntime(this.value, runtime);
383
+ if (runtime === this.value.defaultRuntime) {
384
+ if (!this.value.compatibleRuntimes.length) {
385
+ this.setDefaultRuntime(new DataProductRuntimeInfo());
386
+ } else if (this.value.compatibleRuntimes[0]) {
387
+ this.setDefaultRuntime(this.value.compatibleRuntimes[0]);
388
+ }
389
+ }
390
+ }
391
+
392
+ addFeaturedElement(element: DataProductElement): void {
393
+ const elementPointer = observe_DataProductElementScope(
394
+ new DataProductElementScope(),
395
+ );
396
+ elementPointer.element =
397
+ PackageableElementExplicitReference.create(element);
398
+ modelAccessPointGroup_addElement(this.value, elementPointer);
399
+ }
400
+
401
+ removeFeaturedElement(element: DataProductElementScope): void {
402
+ modelAccessPointGroup_removeElement(this.value, element);
403
+ }
404
+
405
+ excludeFeaturedElement(
406
+ element: DataProductElementScope,
407
+ value: boolean,
408
+ ): void {
409
+ modelAccessPointGroup_setElementExclude(element, value);
410
+ }
411
+
412
+ override hasErrors(): boolean {
413
+ return Boolean(
414
+ super.hasErrors() ||
415
+ !validate_PureExecutionMapping(this.value.mapping.value) ||
416
+ !deepEqual(this.value.defaultRuntime, new DataProductRuntimeInfo()),
417
+ );
418
+ }
419
+
420
+ getCompatibleRuntimeOptions(): {
421
+ label: string;
422
+ value: PackageableRuntime;
423
+ }[] {
424
+ const currentRuntimes = this.value.compatibleRuntimes.map(
425
+ (runtimePointer) => runtimePointer.runtime.value,
426
+ );
427
+ return this.state.editorStore.graphManagerState.graph.allOwnElements
428
+ .filter(
429
+ (element): element is PackageableRuntime =>
430
+ element instanceof PackageableRuntime,
431
+ )
432
+ .filter((runtime) => !currentRuntimes.includes(runtime))
433
+ .map((runtime) => ({
434
+ label: runtime.path,
435
+ value: runtime,
436
+ }));
437
+ }
438
+
439
+ isValidDataProductElement(
440
+ element: PackageableElement,
441
+ ): element is DataProductElement {
442
+ return (
443
+ element instanceof Package ||
444
+ element instanceof Class ||
445
+ element instanceof Enumeration ||
446
+ element instanceof Association
447
+ );
448
+ }
449
+
450
+ getFeaturedElementOptions(): { label: string; value: DataProductElement }[] {
451
+ const currentElements = this.value.featuredElements.map(
452
+ (elementPointer) => elementPointer.element.value,
453
+ );
454
+ return this.state.editorStore.graphManagerState.graph.allOwnElements
455
+ .filter((element) => this.isValidDataProductElement(element))
456
+ .filter((element) => !currentElements.includes(element))
457
+ .map((element) => ({
458
+ label: element.path,
459
+ value: element,
460
+ }));
461
+ }
462
+ }
463
+
316
464
  const createEditorInitialConfiguration = (): EditorInitialConfiguration => {
317
465
  const config = new EditorInitialConfiguration();
318
466
  const ingest = new DataProductElementEditorInitialConfiguration();
@@ -343,6 +491,7 @@ export class DataProductEditorState extends ElementEditorState {
343
491
  deployResponse: AdhocDataProductDeployResponse | undefined;
344
492
  selectedGroupState: AccessPointGroupState | undefined;
345
493
  selectedTab: DATA_PRODUCT_TAB;
494
+ modelledDataProduct = false;
346
495
 
347
496
  constructor(
348
497
  editorStore: EditorStore,
@@ -356,6 +505,7 @@ export class DataProductEditorState extends ElementEditorState {
356
505
  accessPointGroupStates: observable,
357
506
  isConvertingTransformLambdaObjects: observable,
358
507
  selectedTab: observable,
508
+ modelledDataProduct: observable,
359
509
  setSelectedTab: action,
360
510
  addGroupState: action,
361
511
  deleteGroupState: action,
@@ -371,9 +521,18 @@ export class DataProductEditorState extends ElementEditorState {
371
521
  swapAccessPointGroups: action,
372
522
  });
373
523
 
374
- this.accessPointGroupStates = this.product.accessPointGroups.map(
375
- (e) => new AccessPointGroupState(e, this),
376
- );
524
+ this.accessPointGroupStates = this.product.accessPointGroups.map((e) => {
525
+ if (e instanceof ModelAccessPointGroup) {
526
+ this.modelledDataProduct = true;
527
+ return new ModelAccessPointGroupState(e, this);
528
+ } else if (e instanceof AccessPointGroup) {
529
+ return new AccessPointGroupState(e, this);
530
+ } else {
531
+ throw new Error(
532
+ `Can't build access point group state for unsupported access point group type: ${e}`,
533
+ );
534
+ }
535
+ });
377
536
 
378
537
  this.selectedGroupState = this.accessPointGroupStates[0];
379
538
 
@@ -885,6 +885,7 @@ export class MappingExecutionState extends MappingEditorTabState {
885
885
  this.mappingEditorState.mapping,
886
886
  runtime,
887
887
  this.editorStore.graphManagerState.graph,
888
+ undefined,
888
889
  report,
889
890
  )) as { plan: RawExecutionPlan; debug: string };
890
891
 
@@ -900,6 +901,7 @@ export class MappingExecutionState extends MappingEditorTabState {
900
901
  this.mappingEditorState.mapping,
901
902
  runtime,
902
903
  this.editorStore.graphManagerState.graph,
904
+ undefined,
903
905
  report,
904
906
  )) as object;
905
907
  }
@@ -874,6 +874,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
874
874
  this.mappingEditorState.mapping,
875
875
  this.inputDataState.runtime,
876
876
  this.editorStore.graphManagerState.graph,
877
+ undefined,
877
878
  report,
878
879
  )) as { plan: RawExecutionPlan; debug: string };
879
880
  rawPlan = debugResult.plan;
@@ -888,6 +889,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
888
889
  this.mappingEditorState.mapping,
889
890
  this.inputDataState.runtime,
890
891
  this.editorStore.graphManagerState.graph,
892
+ undefined,
891
893
  report,
892
894
  )) as object;
893
895
  }
@@ -570,6 +570,7 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
570
570
  this.selectedExecutionContextState?.executionContext.mapping.value,
571
571
  this.selectedExecutionContextState?.executionContext.runtime,
572
572
  this.editorStore.graphManagerState.graph,
573
+ undefined,
573
574
  report,
574
575
  )) as { plan: RawExecutionPlan; debug: string };
575
576
  rawPlan = debugResult.plan;
@@ -584,6 +585,7 @@ export abstract class ServicePureExecutionState extends ServiceExecutionState {
584
585
  this.selectedExecutionContextState?.executionContext.mapping.value,
585
586
  this.selectedExecutionContextState?.executionContext.runtime,
586
587
  this.editorStore.graphManagerState.graph,
588
+ undefined,
587
589
  report,
588
590
  )) as object;
589
591
  }
@@ -23,11 +23,17 @@ import {
23
23
  type LakehouseAccessPoint,
24
24
  DataProductLink,
25
25
  observe_AccessPoint,
26
- observe_AccessPointGroup,
27
26
  observe_Email,
28
27
  observe_SupportInfo,
29
28
  observer_DataProductLink,
30
29
  SupportInfo,
30
+ type ModelAccessPointGroup,
31
+ type DataProductRuntimeInfo,
32
+ type PackageableElementReference,
33
+ type Mapping,
34
+ type DataProductDiagram,
35
+ type DataProductElementScope,
36
+ observe_APG,
31
37
  } from '@finos/legend-graph';
32
38
  import { addUniqueEntry, deleteEntry, swapEntry } from '@finos/legend-shared';
33
39
  import { action } from 'mobx';
@@ -68,6 +74,87 @@ export const accessPointGroup_setName = action(
68
74
  },
69
75
  );
70
76
 
77
+ export const modelAccessPointGroup_setDefaultRuntime = action(
78
+ (group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo) => {
79
+ group.defaultRuntime = runtime;
80
+ },
81
+ );
82
+
83
+ export const modelAccessPointGroup_setMapping = action(
84
+ (
85
+ group: ModelAccessPointGroup,
86
+ mapping: PackageableElementReference<Mapping>,
87
+ ) => {
88
+ group.mapping = mapping;
89
+ },
90
+ );
91
+
92
+ export const modelAccessPointGroup_addCompatibleRuntime = action(
93
+ (group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo) => {
94
+ addUniqueEntry(group.compatibleRuntimes, runtime);
95
+ },
96
+ );
97
+
98
+ export const modelAccessPointGroup_removeCompatibleRuntime = action(
99
+ (group: ModelAccessPointGroup, runtime: DataProductRuntimeInfo): void => {
100
+ deleteEntry(group.compatibleRuntimes, runtime);
101
+ },
102
+ );
103
+
104
+ export const modelAccessPointGroup_addElement = action(
105
+ (group: ModelAccessPointGroup, element: DataProductElementScope): void => {
106
+ addUniqueEntry(group.featuredElements, element);
107
+ },
108
+ );
109
+
110
+ export const modelAccessPointGroup_removeElement = action(
111
+ (group: ModelAccessPointGroup, element: DataProductElementScope): void => {
112
+ deleteEntry(group.featuredElements, element);
113
+ },
114
+ );
115
+
116
+ export const modelAccessPointGroup_setElementExclude = action(
117
+ (element: DataProductElementScope, exclude: boolean): void => {
118
+ element.exclude = exclude;
119
+ },
120
+ );
121
+
122
+ export const modelAccessPointGroup_addDiagram = action(
123
+ (group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
124
+ addUniqueEntry(group.diagrams, diagram);
125
+ },
126
+ );
127
+
128
+ export const modelAccessPointGroup_removeDiagram = action(
129
+ (group: ModelAccessPointGroup, diagram: DataProductDiagram): void => {
130
+ deleteEntry(group.diagrams, diagram);
131
+ },
132
+ );
133
+
134
+ export const dataProductDiagram_setTitle = action(
135
+ (diagram: DataProductDiagram, title: string): void => {
136
+ diagram.title = title;
137
+ },
138
+ );
139
+
140
+ export const dataProductDiagram_setDescription = action(
141
+ (diagram: DataProductDiagram, desc: string | undefined): void => {
142
+ diagram.description = desc;
143
+ },
144
+ );
145
+
146
+ export const runtimeInfo_setId = action(
147
+ (runtimeInfo: DataProductRuntimeInfo, id: string): void => {
148
+ runtimeInfo.id = id;
149
+ },
150
+ );
151
+
152
+ export const runtimeInfo_setDescription = action(
153
+ (runtimeInfo: DataProductRuntimeInfo, desc: string | undefined): void => {
154
+ runtimeInfo.description = desc;
155
+ },
156
+ );
157
+
71
158
  export const accessPointGroup_swapAccessPoints = action(
72
159
  (
73
160
  group: AccessPointGroup,
@@ -80,10 +167,8 @@ export const accessPointGroup_swapAccessPoints = action(
80
167
 
81
168
  export const dataProduct_addAccessPointGroup = action(
82
169
  (product: DataProduct, accessPointGroup: AccessPointGroup) => {
83
- addUniqueEntry(
84
- product.accessPointGroups,
85
- observe_AccessPointGroup(accessPointGroup),
86
- );
170
+ const observedApg = observe_APG(accessPointGroup);
171
+ addUniqueEntry(product.accessPointGroups, observedApg);
87
172
  },
88
173
  );
89
174