@finos/legend-application-studio 27.1.10 → 28.0.0

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 (119) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +3 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/application/LegendStudioApplicationConfig.d.ts +6 -6
  6. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  7. package/lib/application/LegendStudioApplicationConfig.js +7 -6
  8. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  9. package/lib/components/ShowcaseManager.d.ts +19 -0
  10. package/lib/components/ShowcaseManager.d.ts.map +1 -0
  11. package/lib/components/ShowcaseManager.js +94 -0
  12. package/lib/components/ShowcaseManager.js.map +1 -0
  13. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  14. package/lib/components/editor/ActivityBar.js +13 -1
  15. package/lib/components/editor/ActivityBar.js.map +1 -1
  16. package/lib/components/editor/Editor.js +1 -1
  17. package/lib/components/editor/Editor.js.map +1 -1
  18. package/lib/components/editor/EmbeddedQueryBuilder.d.ts.map +1 -0
  19. package/lib/components/{EmbeddedQueryBuilder.js → editor/EmbeddedQueryBuilder.js} +3 -3
  20. package/lib/components/editor/EmbeddedQueryBuilder.js.map +1 -0
  21. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts +1 -1
  22. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
  23. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +2 -1
  24. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
  25. package/lib/components/editor/editor-group/element-generation-editor/ElementXTGenerationEditor.js.map +1 -1
  26. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.d.ts +1 -1
  27. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  28. package/lib/components/editor/editor-group/element-generation-editor/FileGenerationEditor.js.map +1 -1
  29. package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js.map +1 -1
  30. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  31. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.d.ts +3 -3
  32. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.d.ts.map +1 -1
  33. package/lib/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
  34. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.d.ts.map +1 -1
  35. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js +1 -1
  36. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js.map +1 -1
  37. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  38. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +4 -4
  39. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  40. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  41. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +1 -1
  42. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  43. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts +4 -1
  44. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  45. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +21 -0
  46. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
  47. package/lib/components/project-view/ProjectViewer.js +1 -1
  48. package/lib/components/project-view/ProjectViewer.js.map +1 -1
  49. package/lib/index.css +2 -2
  50. package/lib/index.css.map +1 -1
  51. package/lib/index.d.ts +1 -1
  52. package/lib/index.d.ts.map +1 -1
  53. package/lib/index.js +1 -0
  54. package/lib/index.js.map +1 -1
  55. package/lib/package.json +9 -8
  56. package/lib/stores/LegendStudioApplicationPlugin.d.ts +12 -10
  57. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  58. package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
  59. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  60. package/lib/stores/LegendStudioBaseStore.js +16 -6
  61. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  62. package/lib/stores/ShowcaseManagerState.d.ts +56 -0
  63. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -0
  64. package/lib/stores/ShowcaseManagerState.js +176 -0
  65. package/lib/stores/ShowcaseManagerState.js.map +1 -0
  66. package/lib/stores/editor/EditorStore.d.ts +7 -1
  67. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  68. package/lib/stores/editor/EditorStore.js +8 -5
  69. package/lib/stores/editor/EditorStore.js.map +1 -1
  70. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.js +1 -1
  71. package/lib/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.d.ts +1 -1
  72. package/lib/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.d.ts.map +1 -1
  73. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.d.ts.map +1 -1
  75. package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
  76. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +2 -2
  77. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
  78. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  79. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts +1 -1
  80. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.d.ts.map +1 -1
  81. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  82. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +1 -1
  83. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  84. package/lib/stores/extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.d.ts +2 -2
  85. package/lib/stores/extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  86. package/package.json +19 -18
  87. package/src/__lib__/LegendStudioEvent.ts +4 -0
  88. package/src/application/LegendStudioApplicationConfig.ts +12 -8
  89. package/src/components/ShowcaseManager.tsx +298 -0
  90. package/src/components/editor/ActivityBar.tsx +21 -1
  91. package/src/components/editor/Editor.tsx +1 -1
  92. package/src/components/{EmbeddedQueryBuilder.tsx → editor/EmbeddedQueryBuilder.tsx} +5 -3
  93. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +2 -2
  94. package/src/components/editor/editor-group/element-generation-editor/ElementXTGenerationEditor.tsx +1 -1
  95. package/src/components/editor/editor-group/element-generation-editor/FileGenerationEditor.tsx +8 -8
  96. package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx +1 -1
  97. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationEditor.tsx +1 -1
  98. package/src/components/editor/editor-group/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +3 -5
  99. package/src/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.tsx +5 -7
  100. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +8 -10
  101. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +3 -1
  102. package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +29 -0
  103. package/src/components/project-view/ProjectViewer.tsx +1 -1
  104. package/src/index.ts +1 -1
  105. package/src/stores/LegendStudioApplicationPlugin.ts +12 -10
  106. package/src/stores/LegendStudioBaseStore.ts +21 -8
  107. package/src/stores/ShowcaseManagerState.ts +275 -0
  108. package/src/stores/editor/EditorStore.ts +12 -7
  109. package/src/stores/editor/__test-utils__/EditorStoreTestUtils.ts +1 -1
  110. package/src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts +1 -1
  111. package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +1 -1
  112. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +2 -2
  113. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
  114. package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +1 -1
  115. package/src/stores/extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.ts +2 -2
  116. package/tsconfig.json +3 -1
  117. package/lib/components/EmbeddedQueryBuilder.d.ts.map +0 -1
  118. package/lib/components/EmbeddedQueryBuilder.js.map +0 -1
  119. /package/lib/components/{EmbeddedQueryBuilder.d.ts → editor/EmbeddedQueryBuilder.d.ts} +0 -0
@@ -49,7 +49,7 @@ export type EditorExtensionComponentRendererConfiguration = {
49
49
  renderer: (editorStore: EditorStore) => React.ReactNode | undefined;
50
50
  };
51
51
 
52
- export type EditorExtensionStateCreator = (
52
+ export type EditorExtensionStateBuilder = (
53
53
  editorStore: EditorStore,
54
54
  ) => EditorExtensionState | undefined;
55
55
 
@@ -77,7 +77,7 @@ export type TestableMetadataGetter = (
77
77
  editorStore: EditorStore,
78
78
  ) => TestableMetadata | undefined;
79
79
 
80
- export type TestRunnerTabConfiguration = {
80
+ export type TestRunnerViewConfiguration = {
81
81
  key: string;
82
82
  title: string;
83
83
  renderer: (editorStore: EditorStore) => React.ReactNode | undefined;
@@ -95,16 +95,18 @@ export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlu
95
95
  }
96
96
 
97
97
  /**
98
- * Get the list of items to be rendered in the explorer context menu.
98
+ * Get the list of extension state builders for editor store.
99
+ *
100
+ * This is a mechanism to have the store holds references to extension states
101
+ * so that we can refer back to these states when needed or do cross-extensions
102
+ * operations
99
103
  */
100
- getExtraExplorerContextMenuItemRendererConfigurations?(): ExplorerContextMenuItemRendererConfiguration[];
104
+ getExtraEditorExtensionStateBuilders?(): EditorExtensionStateBuilder[];
101
105
 
102
106
  /**
103
- * Get the list of creators for editor extension state.
104
- *
105
- * This is a mechanism to extend the editor store.
107
+ * Get the list of items to be rendered in the explorer context menu.
106
108
  */
107
- getExtraEditorExtensionStateCreators?(): EditorExtensionStateCreator[];
109
+ getExtraExplorerContextMenuItemRendererConfigurations?(): ExplorerContextMenuItemRendererConfiguration[];
108
110
 
109
111
  /**
110
112
  * Get the list of configurations for the renderer of editor extension states.
@@ -127,9 +129,9 @@ export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlu
127
129
  getExtraTestableMetadata?(): TestableMetadataGetter[];
128
130
 
129
131
  /**
130
- * Get the list of configurations for the editor for a test runner tab.
132
+ * Get the list of view configurations for test runner.
131
133
  */
132
- getExtraTestRunnerTabConfigurations?(): TestRunnerTabConfiguration[];
134
+ getExtraTestRunnerViewConfigurations?(): TestRunnerViewConfiguration[];
133
135
  }
134
136
 
135
137
  export type PureGrammarElementLabeler = (
@@ -47,6 +47,7 @@ import type { LegendStudioPluginManager } from '../application/LegendStudioPlugi
47
47
  import type { LegendStudioApplicationConfig } from '../application/LegendStudioApplicationConfig.js';
48
48
  import { LegendStudioEventHelper } from '../__lib__/LegendStudioEventHelper.js';
49
49
  import { LEGEND_STUDIO_SDLC_BYPASSED_ROUTE_PATTERN } from '../__lib__/LegendStudioNavigation.js';
50
+ import { ShowcaseManagerState } from './ShowcaseManagerState.js';
50
51
 
51
52
  export type LegendStudioApplicationStore = ApplicationStore<
52
53
  LegendStudioApplicationConfig,
@@ -78,20 +79,21 @@ export class LegendStudioBaseStore {
78
79
  this.applicationStore = applicationStore;
79
80
  this.pluginManager = applicationStore.pluginManager;
80
81
 
81
- // setup servers
82
- this.sdlcServerClient = new SDLCServerClient({
83
- env: this.applicationStore.config.env,
84
- serverUrl: this.applicationStore.config.sdlcServerUrl,
85
- baseHeaders: this.applicationStore.config.SDLCServerBaseHeaders,
86
- });
87
- this.sdlcServerClient.setTracerService(this.applicationStore.tracerService);
88
-
82
+ // depot
89
83
  this.depotServerClient = new DepotServerClient({
90
84
  serverUrl: this.applicationStore.config.depotServerUrl,
91
85
  });
92
86
  this.depotServerClient.setTracerService(
93
87
  this.applicationStore.tracerService,
94
88
  );
89
+
90
+ // sdlc
91
+ this.sdlcServerClient = new SDLCServerClient({
92
+ env: this.applicationStore.config.env,
93
+ serverUrl: this.applicationStore.config.sdlcServerUrl,
94
+ baseHeaders: this.applicationStore.config.sdlcServerBaseHeaders,
95
+ });
96
+ this.sdlcServerClient.setTracerService(this.applicationStore.tracerService);
95
97
  }
96
98
 
97
99
  *initialize(): GeneratorFn<void> {
@@ -103,6 +105,17 @@ export class LegendStudioBaseStore {
103
105
  }
104
106
  this.initState.inProgress();
105
107
 
108
+ // initialization components asynchronously
109
+ // TODO: this is a nice non-blocking pattern for initialization
110
+ // we should do this for things like documentation, etc.
111
+ Promise.all([
112
+ ShowcaseManagerState.retrieveNullableState(
113
+ this.applicationStore,
114
+ )?.initialize(),
115
+ ]).catch((error) => {
116
+ // do nothing
117
+ });
118
+
106
119
  // authorize SDLC, unless navigation location match SDLC-bypassed patterns
107
120
  if (
108
121
  !matchPath(
@@ -0,0 +1,275 @@
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 {
18
+ type GeneratorFn,
19
+ ActionState,
20
+ LogEvent,
21
+ assertErrorThrown,
22
+ guaranteeNonNullable,
23
+ } from '@finos/legend-shared';
24
+ import { action, flow, makeObservable, observable } from 'mobx';
25
+ import { LEGEND_STUDIO_APP_EVENT } from '../__lib__/LegendStudioEvent.js';
26
+ import {
27
+ type Showcase,
28
+ type ShowcaseMetadata,
29
+ ShowcaseRegistryServerClient,
30
+ } from '@finos/legend-server-showcase';
31
+ import type { LegendStudioApplicationStore } from './LegendStudioBaseStore.js';
32
+ import {
33
+ ApplicationExtensionState,
34
+ type GenericLegendApplicationStore,
35
+ } from '@finos/legend-application';
36
+ import type { TreeData, TreeNodeData } from '@finos/legend-art';
37
+ import { DIRECTORY_PATH_DELIMITER } from '@finos/legend-graph';
38
+
39
+ export enum SHOWCASE_MANAGER_VIEW {
40
+ EXPLORER = 'EXPLORER',
41
+ SEARCH = 'SEARCH',
42
+ }
43
+
44
+ export class ShowcasesExplorerTreeNodeData implements TreeNodeData {
45
+ isOpen?: boolean | undefined;
46
+ id: string;
47
+ label: string;
48
+ parentId?: string | undefined;
49
+ childrenIds: string[] = [];
50
+ metadata?: ShowcaseMetadata | undefined;
51
+
52
+ constructor(
53
+ id: string,
54
+ label: string,
55
+ parentId: string | undefined,
56
+ metadata?: ShowcaseMetadata | undefined,
57
+ ) {
58
+ this.id = id;
59
+ this.label = label;
60
+ this.parentId = parentId;
61
+ this.metadata = metadata;
62
+ }
63
+ }
64
+
65
+ const buildShowcasesExplorerTreeNode = (
66
+ showcase: ShowcaseMetadata,
67
+ path: string,
68
+ parentId: string | undefined,
69
+ nodes: Map<string, ShowcasesExplorerTreeNodeData>,
70
+ rootIds: string[],
71
+ ): ShowcasesExplorerTreeNodeData => {
72
+ let node: ShowcasesExplorerTreeNodeData;
73
+ const idx = path.indexOf(DIRECTORY_PATH_DELIMITER);
74
+ if (idx === -1) {
75
+ // showcase node
76
+ node = new ShowcasesExplorerTreeNodeData(
77
+ `${parentId ? `${parentId}${DIRECTORY_PATH_DELIMITER}` : ''}${path}`,
78
+ path,
79
+ parentId,
80
+ showcase,
81
+ );
82
+ } else {
83
+ // directory node
84
+ const directoryName = path.substring(0, idx);
85
+ const directoryNodeId = `${
86
+ parentId ? `${parentId}${DIRECTORY_PATH_DELIMITER}` : ''
87
+ }${directoryName}`;
88
+ node =
89
+ nodes.get(directoryNodeId) ??
90
+ new ShowcasesExplorerTreeNodeData(
91
+ directoryNodeId,
92
+ directoryName,
93
+ undefined,
94
+ undefined,
95
+ );
96
+ }
97
+ nodes.set(node.id, node);
98
+ if (!parentId && !rootIds.includes(node.id)) {
99
+ rootIds.push(node.id);
100
+ }
101
+ if (parentId) {
102
+ const parentNode = nodes.get(parentId);
103
+ if (parentNode) {
104
+ if (!parentNode.childrenIds.includes(node.id)) {
105
+ parentNode.childrenIds.push(node.id);
106
+ }
107
+ }
108
+ }
109
+ if (idx !== -1) {
110
+ buildShowcasesExplorerTreeNode(
111
+ showcase,
112
+ path.substring(idx + 1),
113
+ node.id,
114
+ nodes,
115
+ rootIds,
116
+ );
117
+ }
118
+ return node;
119
+ };
120
+
121
+ const buildShowcasesExplorerTreeData = (
122
+ showcases: ShowcaseMetadata[],
123
+ ): TreeData<ShowcasesExplorerTreeNodeData> => {
124
+ const rootIds: string[] = [];
125
+ const nodes = new Map<string, ShowcasesExplorerTreeNodeData>();
126
+ showcases.forEach((showcase) =>
127
+ buildShowcasesExplorerTreeNode(
128
+ showcase,
129
+ showcase.path,
130
+ undefined,
131
+ nodes,
132
+ rootIds,
133
+ ),
134
+ );
135
+ return { rootIds, nodes };
136
+ };
137
+
138
+ export class ShowcaseManagerState extends ApplicationExtensionState {
139
+ private static readonly IDENTIFIER = 'showcase-manager';
140
+
141
+ readonly applicationStore: LegendStudioApplicationStore;
142
+ readonly initState = ActionState.create();
143
+ readonly fetchShowcaseState = ActionState.create();
144
+
145
+ private readonly showcaseServerClient?: ShowcaseRegistryServerClient;
146
+
147
+ showcases: ShowcaseMetadata[] = [];
148
+ currentShowcase?: Showcase | undefined;
149
+
150
+ currentView = SHOWCASE_MANAGER_VIEW.EXPLORER;
151
+ explorerTreeData?: TreeData<ShowcasesExplorerTreeNodeData> | undefined;
152
+
153
+ constructor(applicationStore: LegendStudioApplicationStore) {
154
+ super();
155
+
156
+ makeObservable(this, {
157
+ showcases: observable,
158
+ currentShowcase: observable,
159
+ currentView: observable,
160
+ explorerTreeData: observable.ref,
161
+ initialize: flow,
162
+ setCurrentView: action,
163
+ closeShowcase: action,
164
+ openShowcase: flow,
165
+ setExplorerTreeData: action,
166
+ });
167
+
168
+ this.applicationStore = applicationStore;
169
+
170
+ if (this.applicationStore.config.showcaseServerUrl) {
171
+ this.showcaseServerClient = new ShowcaseRegistryServerClient({
172
+ baseUrl: this.applicationStore.config.showcaseServerUrl,
173
+ });
174
+ }
175
+ }
176
+
177
+ override get INTERNAL__identifierKey(): string {
178
+ return ShowcaseManagerState.IDENTIFIER;
179
+ }
180
+
181
+ static retrieveNullableState(
182
+ applicationStore: GenericLegendApplicationStore,
183
+ ): ShowcaseManagerState | undefined {
184
+ return applicationStore.extensionStates.find((extensionState) => {
185
+ if (
186
+ /**
187
+ * In development mode, when we make changes in certain areas like utils or base states, the following `instanceof`
188
+ * check will fail as if there were multiple copies of the classes with the same name, this could be caused by either
189
+ * React `fast-refresh` or `webpack HMR`; we didn't have time to really do a thorough debug here, as such,
190
+ * we will just do a simple key check to match the right state to bypass the problem for development mode.
191
+ */
192
+ // eslint-disable-next-line no-process-env
193
+ process.env.NODE_ENV === 'development'
194
+ ) {
195
+ return (
196
+ extensionState.INTERNAL__identifierKey ===
197
+ ShowcaseManagerState.IDENTIFIER
198
+ );
199
+ }
200
+ return extensionState instanceof ShowcaseManagerState;
201
+ }) as ShowcaseManagerState;
202
+ }
203
+
204
+ static retrieveState(
205
+ applicationStore: GenericLegendApplicationStore,
206
+ ): ShowcaseManagerState {
207
+ return guaranteeNonNullable(
208
+ ShowcaseManagerState.retrieveNullableState(applicationStore),
209
+ `Can't find showcase manager state: make sure it is added as an editor extension state`,
210
+ );
211
+ }
212
+
213
+ get isEnabled(): boolean {
214
+ return Boolean(this.showcaseServerClient);
215
+ }
216
+
217
+ private get client(): ShowcaseRegistryServerClient {
218
+ return guaranteeNonNullable(
219
+ this.showcaseServerClient,
220
+ `Showcase registry server client is not configured`,
221
+ );
222
+ }
223
+
224
+ setCurrentView(val: SHOWCASE_MANAGER_VIEW): void {
225
+ this.currentView = val;
226
+ }
227
+
228
+ *openShowcase(metadata: ShowcaseMetadata): GeneratorFn<void> {
229
+ this.fetchShowcaseState.inProgress();
230
+
231
+ try {
232
+ this.currentShowcase = (yield this.client.getShowcase(
233
+ metadata.path,
234
+ )) as Showcase;
235
+
236
+ this.fetchShowcaseState.pass();
237
+ } catch (error) {
238
+ assertErrorThrown(error);
239
+ this.applicationStore.logService.error(
240
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.SHOWCASE_MANAGER_FAILURE),
241
+ error,
242
+ );
243
+ this.fetchShowcaseState.fail();
244
+ }
245
+ }
246
+
247
+ closeShowcase(): void {
248
+ this.currentShowcase = undefined;
249
+ }
250
+
251
+ setExplorerTreeData(val: TreeData<ShowcasesExplorerTreeNodeData>): void {
252
+ this.explorerTreeData = val;
253
+ }
254
+
255
+ *initialize(): GeneratorFn<void> {
256
+ if (!this.isEnabled || this.initState.isInProgress) {
257
+ return;
258
+ }
259
+ this.initState.inProgress();
260
+
261
+ try {
262
+ this.showcases = (yield this.client.getShowcases()) as Showcase[];
263
+ this.explorerTreeData = buildShowcasesExplorerTreeData(this.showcases);
264
+
265
+ this.initState.pass();
266
+ } catch (error) {
267
+ assertErrorThrown(error);
268
+ this.applicationStore.logService.error(
269
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.SHOWCASE_MANAGER_FAILURE),
270
+ error,
271
+ );
272
+ this.initState.fail();
273
+ }
274
+ }
275
+ }
@@ -113,6 +113,8 @@ export abstract class EditorExtensionState {
113
113
  * See https://github.com/finos/legend-studio/blob/master/docs/technical/typescript-usage.md#understand-typescript-structual-type-system
114
114
  */
115
115
  private readonly _$nominalTypeBrand!: 'EditorExtensionState';
116
+
117
+ abstract get INTERNAL__identifierKey(): string;
116
118
  }
117
119
 
118
120
  export class EditorStore implements CommandRegistrar {
@@ -121,6 +123,13 @@ export class EditorStore implements CommandRegistrar {
121
123
  readonly depotServerClient: DepotServerClient;
122
124
  readonly pluginManager: LegendStudioPluginManager;
123
125
 
126
+ /**
127
+ * This is a mechanism to have the store holds references to extension states
128
+ * so that we can refer back to these states when needed or do cross-extensions
129
+ * operations
130
+ */
131
+ readonly extensionStates: EditorExtensionState[] = [];
132
+
124
133
  readonly initState = ActionState.create();
125
134
 
126
135
  initialEntityPath?: string | undefined;
@@ -132,8 +141,6 @@ export class EditorStore implements CommandRegistrar {
132
141
  // See https://github.com/finos/legend-studio/issues/317
133
142
  mode = EDITOR_MODE.STANDARD;
134
143
 
135
- editorExtensionStates: EditorExtensionState[] = [];
136
-
137
144
  // SDLC
138
145
  sdlcState: EditorSDLCState;
139
146
  changeDetectionState: ChangeDetectionState;
@@ -270,11 +277,12 @@ export class EditorStore implements CommandRegistrar {
270
277
  this,
271
278
  this.sdlcState,
272
279
  );
280
+
273
281
  // extensions
274
- this.editorExtensionStates = this.pluginManager
282
+ this.extensionStates = this.pluginManager
275
283
  .getApplicationPlugins()
276
284
  .flatMap(
277
- (plugin) => plugin.getExtraEditorExtensionStateCreators?.() ?? [],
285
+ (plugin) => plugin.getExtraEditorExtensionStateBuilders?.() ?? [],
278
286
  )
279
287
  .map((creator) => creator(this))
280
288
  .filter(isNonNullable);
@@ -671,9 +679,6 @@ export class EditorStore implements CommandRegistrar {
671
679
  },
672
680
  {
673
681
  tracerService: this.applicationStore.tracerService,
674
- TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism:
675
- this.applicationStore.config.options
676
- .TEMPORARY__enableNewServiceRegistrationInputCollectorMechanism,
677
682
  },
678
683
  ),
679
684
  ]);
@@ -34,7 +34,7 @@ export const TEST__getTestEditorStore = (
34
34
  new SDLCServerClient({
35
35
  env: applicationStore.config.env,
36
36
  serverUrl: applicationStore.config.sdlcServerUrl,
37
- baseHeaders: applicationStore.config.SDLCServerBaseHeaders,
37
+ baseHeaders: applicationStore.config.sdlcServerBaseHeaders,
38
38
  }),
39
39
  new DepotServerClient({
40
40
  serverUrl: applicationStore.config.depotServerUrl,
@@ -129,7 +129,7 @@ export class SchemaSetModelGenerationState {
129
129
  this.targetBinding = val;
130
130
  }
131
131
 
132
- getConfigValue(name: string): unknown | undefined {
132
+ getConfigValue(name: string): unknown {
133
133
  return this.getConfig(name)?.value;
134
134
  }
135
135
 
@@ -576,7 +576,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
576
576
  }
577
577
 
578
578
  setInputDataStateBasedOnSource(
579
- source: MappingElementSource | undefined,
579
+ source: MappingElementSource,
580
580
  populateWithMockData: boolean,
581
581
  ): void {
582
582
  if (source === undefined || source instanceof Class) {
@@ -274,7 +274,7 @@ export const getMappingElementLabel = (
274
274
  export const getMappingElementSource = (
275
275
  mappingElement: MappingElement,
276
276
  plugins: LegendStudioApplicationPlugin[],
277
- ): MappingElementSource | undefined => {
277
+ ): MappingElementSource => {
278
278
  if (mappingElement instanceof INTERNAL__UnknownSetImplementation) {
279
279
  return undefined;
280
280
  } else if (mappingElement instanceof OperationSetImplementation) {
@@ -941,7 +941,7 @@ export class MappingEditorState extends ElementEditorState {
941
941
 
942
942
  *changeClassMappingSourceDriver(
943
943
  setImplementation: InstanceSetImplementation,
944
- newSource: MappingElementSource | undefined,
944
+ newSource: MappingElementSource,
945
945
  ): GeneratorFn<void> {
946
946
  const currentSource = getMappingElementSource(
947
947
  setImplementation,
@@ -594,7 +594,7 @@ export class MappingExecutionState extends MappingEditorTabState {
594
594
  }
595
595
 
596
596
  setInputDataStateBasedOnSource(
597
- source: unknown | undefined,
597
+ source: unknown,
598
598
  populateWithMockData: boolean,
599
599
  ): void {
600
600
  if (source instanceof Class) {
@@ -328,7 +328,7 @@ export const getTestableResultFromAssertionStatus = (
328
328
  export const getTestableResultFromTestResults = (
329
329
  testResults: (TestResult | undefined)[] | undefined,
330
330
  ): TESTABLE_RESULT => {
331
- if (testResults === undefined || !testResults.length) {
331
+ if (!testResults?.length) {
332
332
  return TESTABLE_RESULT.DID_NOT_RUN;
333
333
  }
334
334
  if (
@@ -64,7 +64,7 @@ export type SetImplementationMappingElementLabelInfoBuilder = (
64
64
 
65
65
  export type MappingElementSourceExtractor = (
66
66
  mappingElement: MappingElement,
67
- ) => MappingElementSource | undefined;
67
+ ) => MappingElementSource;
68
68
 
69
69
  export type MappingElementStateCreator = (
70
70
  mappingElement: MappingElement | undefined,
@@ -106,7 +106,7 @@ export type NewConnectionSnippetSuggestion = PureGrammarTextSuggestion;
106
106
  */
107
107
  export type InstanceSetImplementationSourceUpdater = (
108
108
  setImplementation: InstanceSetImplementation,
109
- newSource: unknown | undefined,
109
+ newSource: unknown,
110
110
  ) => boolean;
111
111
 
112
112
  export type MappingSourceTypeInfoGetter = (
package/tsconfig.json CHANGED
@@ -52,6 +52,7 @@
52
52
  "./src/components/__test-utils__/EmbeddedQueryBuilderTestUtils.ts",
53
53
  "./src/stores/LegendStudioApplicationPlugin.ts",
54
54
  "./src/stores/LegendStudioBaseStore.ts",
55
+ "./src/stores/ShowcaseManagerState.ts",
55
56
  "./src/stores/__test-utils__/LegendStudioApplicationTestUtils.ts",
56
57
  "./src/stores/editor/AbstractConflictResolutionState.ts",
57
58
  "./src/stores/editor/ChangeDetectionState.ts",
@@ -170,14 +171,15 @@
170
171
  "./src/stores/workspace-setup/WorkspaceSetupStore.ts",
171
172
  "./src/application/LegendStudio.tsx",
172
173
  "./src/components/ElementIconUtils.tsx",
173
- "./src/components/EmbeddedQueryBuilder.tsx",
174
174
  "./src/components/LegendStudioAppInfo.tsx",
175
175
  "./src/components/LegendStudioFrameworkProvider.tsx",
176
176
  "./src/components/LegendStudioWebApplication.tsx",
177
+ "./src/components/ShowcaseManager.tsx",
177
178
  "./src/components/__test-utils__/LegendStudioFrameworkTestUtils.tsx",
178
179
  "./src/components/editor/ActivityBar.tsx",
179
180
  "./src/components/editor/Editor.tsx",
180
181
  "./src/components/editor/EditorStoreProvider.tsx",
182
+ "./src/components/editor/EmbeddedQueryBuilder.tsx",
181
183
  "./src/components/editor/QuickInput.tsx",
182
184
  "./src/components/editor/StatusBar.tsx",
183
185
  "./src/components/editor/__test-utils__/EditorComponentTestUtils.tsx",
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmbeddedQueryBuilder.d.ts","sourceRoot":"","sources":["../../src/components/EmbeddedQueryBuilder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA2GH,eAAO,MAAM,oBAAoB;;CAa/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmbeddedQueryBuilder.js","sourceRoot":"","sources":["../../src/components/EmbeddedQueryBuilder.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAEb,MAAM,6BAA6B,CAAC;AACrC,O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