@finos/legend-application-studio 28.21.30 → 28.21.32

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 (71) hide show
  1. package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts +2 -1
  2. package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioApplicationNavigationContext.js +1 -0
  4. package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
  5. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  6. package/lib/components/ElementIconUtils.js +2 -0
  7. package/lib/components/ElementIconUtils.js.map +1 -1
  8. package/lib/components/editor/availability-editor.css +1 -0
  9. package/lib/components/editor/availability-editor.css.map +1 -0
  10. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  11. package/lib/components/editor/editor-group/EditorGroup.js +5 -0
  12. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  13. package/lib/components/editor/editor-group/availability/AvailabilityEditor.d.ts +19 -0
  14. package/lib/components/editor/editor-group/availability/AvailabilityEditor.d.ts.map +1 -0
  15. package/lib/components/editor/editor-group/availability/AvailabilityEditor.js +50 -0
  16. package/lib/components/editor/editor-group/availability/AvailabilityEditor.js.map +1 -0
  17. package/lib/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.d.ts +22 -0
  18. package/lib/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.d.ts.map +1 -0
  19. package/lib/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.js +205 -0
  20. package/lib/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.js.map +1 -0
  21. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +5 -0
  22. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
  23. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +1 -1
  24. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
  25. package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
  26. package/lib/components/editor/panel-group/DevToolPanel.js +27 -24
  27. package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
  28. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  29. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +1 -0
  30. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
  31. package/lib/index.css +2 -2
  32. package/lib/index.css.map +1 -1
  33. package/lib/package.json +1 -1
  34. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  35. package/lib/stores/editor/EditorGraphState.js +4 -1
  36. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  37. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  38. package/lib/stores/editor/EditorTabManagerState.js +5 -1
  39. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  40. package/lib/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.d.ts +32 -0
  41. package/lib/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.d.ts.map +1 -0
  42. package/lib/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.js +46 -0
  43. package/lib/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.js.map +1 -0
  44. package/lib/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.d.ts +111 -0
  45. package/lib/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.d.ts.map +1 -0
  46. package/lib/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.js +425 -0
  47. package/lib/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.js.map +1 -0
  48. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts +3 -0
  49. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts.map +1 -1
  50. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js +8 -2
  51. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js.map +1 -1
  52. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +2 -1
  53. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
  54. package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
  55. package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
  56. package/package.json +12 -12
  57. package/src/__lib__/LegendStudioApplicationNavigationContext.ts +1 -0
  58. package/src/components/ElementIconUtils.tsx +2 -0
  59. package/src/components/editor/editor-group/EditorGroup.tsx +4 -0
  60. package/src/components/editor/editor-group/availability/AvailabilityEditor.tsx +114 -0
  61. package/src/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.tsx +829 -0
  62. package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +1 -1
  63. package/src/components/editor/panel-group/DevToolPanel.tsx +61 -60
  64. package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +1 -0
  65. package/src/stores/editor/EditorGraphState.ts +3 -0
  66. package/src/stores/editor/EditorTabManagerState.ts +4 -0
  67. package/src/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.ts +56 -0
  68. package/src/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.ts +631 -0
  69. package/src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts +13 -3
  70. package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
  71. package/tsconfig.json +4 -0
@@ -795,7 +795,7 @@ const AssertFailViewer = observer(
795
795
  },
796
796
  );
797
797
 
798
- const TestAssertionResultViewer = observer(
798
+ export const TestAssertionResultViewer = observer(
799
799
  (props: { testAssertionEditorState: TestAssertionEditorState }) => {
800
800
  const { testAssertionEditorState } = props;
801
801
  const parentAssertionResultState =
@@ -31,12 +31,8 @@ import {
31
31
  } from '@finos/legend-shared';
32
32
  import { useEditorStore } from '../EditorStoreProvider.js';
33
33
  import { LEGEND_STUDIO_SETTING_KEY } from '../../../__lib__/LegendStudioSetting.js';
34
- import { flowResult } from 'mobx';
35
- import {
36
- PARSER_SECTION_MARKER,
37
- PURE_PARSER,
38
- type PureModel,
39
- } from '@finos/legend-graph';
34
+ import { PARSER_SECTION_MARKER, PURE_PARSER } from '@finos/legend-graph';
35
+ import { ProjectDependencyCoordinates } from '@finos/legend-server-depot';
40
36
 
41
37
  export const DevToolPanel = observer(() => {
42
38
  const editorStore = useEditorStore();
@@ -75,53 +71,50 @@ export const DevToolPanel = observer(() => {
75
71
  );
76
72
  };
77
73
 
78
- const downloadDependencyProjectGrammars = async (): Promise<string[]> => {
79
- const grammars = await Promise.all(
80
- Array.from(
81
- editorStore.graphManagerState.graph.dependencyManager
82
- .projectDependencyModelsIndex,
83
- ).map(
84
- (graph) =>
85
- flowResult(
86
- editorStore.graphManagerState.graphManager.graphToPureCode(
87
- graph[1] as PureModel,
88
- {
89
- pretty: true,
90
- },
91
- ),
92
- ) as string,
93
- ),
94
- );
95
- return grammars;
96
- };
97
-
98
74
  const downloadProjectGrammar = async (
99
75
  withDependency: boolean,
100
76
  ): Promise<void> => {
101
- const graphGrammar = (await Promise.all([
102
- flowResult(
103
- editorStore.graphManagerState.graphManager.graphToPureCode(
104
- editorStore.graphManagerState.graph,
105
- { pretty: true },
106
- ),
107
- ),
108
- ])) as unknown as string;
109
- const dependencyGrammars = withDependency
110
- ? ((await Promise.all([
111
- flowResult(downloadDependencyProjectGrammars()),
112
- ])) as unknown as string[])
113
- : [];
114
- const fullGrammar = [graphGrammar, ...dependencyGrammars].join(
115
- `\n${PARSER_SECTION_MARKER}${PURE_PARSER.PURE}\n`,
77
+ const graphManager = editorStore.graphManagerState.graphManager;
78
+ const graphGrammar = await graphManager.graphToPureCode(
79
+ editorStore.graphManagerState.graph,
80
+ { pretty: true },
116
81
  );
82
+ let dependencyGrammar: string | undefined;
83
+ if (withDependency) {
84
+ // Fetch the dependency graph directly from Depot as a
85
+ // `V1_PureModelContextData` payload and hand it straight to the engine
86
+ // grammar transform. This skips building a `PureModel` for dependencies
87
+ // and collapses the whole dependency graph into a single engine call.
88
+ const projectDependencies =
89
+ editorStore.projectConfigurationEditorState.currentProjectConfiguration
90
+ .projectDependencies;
91
+ if (projectDependencies.length) {
92
+ const dependencyCoordinates =
93
+ await editorStore.graphState.buildProjectDependencyCoordinates(
94
+ projectDependencies,
95
+ );
96
+ const dependencyProtocolGraph =
97
+ await editorStore.depotServerClient.collectDependencyEntitiesAsPureModelContextData(
98
+ dependencyCoordinates.map((e) =>
99
+ ProjectDependencyCoordinates.serialization.toJson(e),
100
+ ),
101
+ true,
102
+ true,
103
+ );
104
+ dependencyGrammar = await graphManager.protocolToPureCode(
105
+ dependencyProtocolGraph,
106
+ { pretty: true },
107
+ );
108
+ }
109
+ }
110
+ const fullGrammar =
111
+ dependencyGrammar === undefined
112
+ ? graphGrammar
113
+ : `${graphGrammar}\n${PARSER_SECTION_MARKER}${PURE_PARSER.PURE}\n// ------------------------------------------------------------\n// Dependency grammar starts here\n// ------------------------------------------------------------\n${dependencyGrammar}`;
117
114
  const fileName = `grammar.${getContentTypeFileExtension(
118
115
  ContentType.TEXT_PLAIN,
119
116
  )}`;
120
- downloadFileUsingDataURI(
121
- fileName,
122
- `${fullGrammar}`,
123
- ContentType.TEXT_PLAIN,
124
- );
117
+ downloadFileUsingDataURI(fileName, fullGrammar, ContentType.TEXT_PLAIN);
125
118
  };
126
119
 
127
120
  return (
@@ -205,16 +198,20 @@ export const DevToolPanel = observer(() => {
205
198
  />
206
199
  <PanelFormListItems title="Download Project Grammar">
207
200
  <div className="developer-tools__action-groups">
208
- <div className="developer-tools__action-group">
201
+ <div
202
+ className="developer-tools__action-group"
203
+ onClick={() => {
204
+ downloadProjectGrammar(false).catch(
205
+ editorStore.applicationStore.alertUnhandledError,
206
+ );
207
+ }}
208
+ role="button"
209
+ tabIndex={-1}
210
+ title="Download Project Grammar"
211
+ >
209
212
  <button
210
213
  className="developer-tools__action-group__btn"
211
- onClick={() => {
212
- downloadProjectGrammar(false).catch(
213
- editorStore.applicationStore.alertUnhandledError,
214
- );
215
- }}
216
214
  tabIndex={-1}
217
- title="Download Project Grammar"
218
215
  >
219
216
  <CloudDownloadIcon />
220
217
  </button>
@@ -222,16 +219,20 @@ export const DevToolPanel = observer(() => {
222
219
  download grammar without dependency
223
220
  </div>
224
221
  </div>
225
- <div className="developer-tools__action-group">
222
+ <div
223
+ className="developer-tools__action-group"
224
+ onClick={() => {
225
+ downloadProjectGrammar(true).catch(
226
+ editorStore.applicationStore.alertUnhandledError,
227
+ );
228
+ }}
229
+ role="button"
230
+ tabIndex={-1}
231
+ title="Download Project Grammar with Dependency"
232
+ >
226
233
  <button
227
234
  className="developer-tools__action-group__btn"
228
- onClick={() => {
229
- downloadProjectGrammar(true).catch(
230
- editorStore.applicationStore.alertUnhandledError,
231
- );
232
- }}
233
235
  tabIndex={-1}
234
- title="Download Project Grammar with Dependency"
235
236
  >
236
237
  <CloudDownloadIcon />
237
238
  </button>
@@ -190,6 +190,7 @@ export class Core_LegendStudioApplicationPlugin extends LegendStudioApplicationP
190
190
  LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.EMBEDDED_DATA_MODEL_STORE_EDITOR,
191
191
  LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.INGEST_DEFINITION_EDITOR,
192
192
  LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.DATA_PRODUCT_EDITOR,
193
+ LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.AVAILABILITY_EDITOR,
193
194
  ];
194
195
  }
195
196
 
@@ -95,6 +95,7 @@ import {
95
95
  DataProduct,
96
96
  IngestDefinition,
97
97
  MemSQLFunction,
98
+ Availability,
98
99
  } from '@finos/legend-graph';
99
100
  import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
100
101
  import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
@@ -881,6 +882,8 @@ export class EditorGraphState {
881
882
  return PACKAGEABLE_ELEMENT_TYPE._COMPUTE;
882
883
  } else if (element instanceof IngestDefinition) {
883
884
  return PACKAGEABLE_ELEMENT_TYPE.INGEST_DEFINITION;
885
+ } else if (element instanceof Availability) {
886
+ return PACKAGEABLE_ELEMENT_TYPE.AVAILABILITY;
884
887
  } else if (element instanceof MemSQLFunction) {
885
888
  return PACKAGEABLE_ELEMENT_TYPE.MEM_SQL_FUNCTION;
886
889
  }
@@ -39,6 +39,7 @@ import {
39
39
  DataProduct,
40
40
  IngestDefinition,
41
41
  MemSQLFunction,
42
+ Availability,
42
43
  } from '@finos/legend-graph';
43
44
  import {
44
45
  type Clazz,
@@ -73,6 +74,7 @@ import { MemSQLFunctionActivatorEditorState } from './editor-state/element-edito
73
74
  import { ArtifactGenerationViewerState } from './editor-state/ArtifactGenerationViewerState.js';
74
75
  import { DataProductEditorState } from './editor-state/element-editor-state/dataProduct/DataProductEditorState.js';
75
76
  import { IngestDefinitionEditorState } from './editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
77
+ import { AvailabilityEditorState } from './editor-state/element-editor-state/availability/AvailabilityEditorState.js';
76
78
  import type { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
77
79
 
78
80
  export class EditorTabManagerState extends TabManagerState {
@@ -186,6 +188,8 @@ export class EditorTabManagerState extends TabManagerState {
186
188
  return new ServiceEditorState(this.editorStore, element);
187
189
  } else if (element instanceof DataProduct) {
188
190
  return new DataProductEditorState(this.editorStore, element, config);
191
+ } else if (element instanceof Availability) {
192
+ return new AvailabilityEditorState(this.editorStore, element);
189
193
  } else if (element instanceof GenerationSpecification) {
190
194
  return new GenerationSpecificationEditorState(this.editorStore, element);
191
195
  } else if (element instanceof FileGenerationSpecification) {
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2026-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 { type PackageableElement, Availability } from '@finos/legend-graph';
18
+ import { guaranteeType } from '@finos/legend-shared';
19
+ import { action, makeObservable, observable } from 'mobx';
20
+ import type { EditorStore } from '../../../EditorStore.js';
21
+ import { ElementEditorState } from '../ElementEditorState.js';
22
+ import { AvailabilityTestableState } from './testable/AvailabilityTestableState.js';
23
+
24
+ export enum AVAILABILITY_TAB {
25
+ DEFINITION = 'Definition',
26
+ TESTING = 'Testing',
27
+ }
28
+
29
+ export class AvailabilityEditorState extends ElementEditorState {
30
+ activeTab = AVAILABILITY_TAB.DEFINITION;
31
+ readonly testableState = new AvailabilityTestableState(this);
32
+
33
+ constructor(editorStore: EditorStore, element: PackageableElement) {
34
+ super(editorStore, element);
35
+
36
+ makeObservable(this, {
37
+ activeTab: observable,
38
+ setActiveTab: action,
39
+ });
40
+ }
41
+
42
+ get availability(): Availability {
43
+ return guaranteeType(this.element, Availability);
44
+ }
45
+
46
+ setActiveTab(tab: AVAILABILITY_TAB): void {
47
+ this.activeTab = tab;
48
+ }
49
+
50
+ override reprocess(
51
+ newElement: PackageableElement,
52
+ editorStore: EditorStore,
53
+ ): ElementEditorState {
54
+ return new AvailabilityEditorState(editorStore, newElement);
55
+ }
56
+ }