@finos/legend-application-studio 28.14.1 → 28.14.3

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 (90) hide show
  1. package/lib/application/LegendStudioApplicationConfig.d.ts +5 -0
  2. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendStudioApplicationConfig.js +6 -0
  4. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  5. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts +1 -1
  6. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts.map +1 -1
  7. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js +93 -14
  8. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js.map +1 -1
  9. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.d.ts.map +1 -1
  10. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js +7 -1
  11. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js.map +1 -1
  12. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts +1 -13
  13. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  14. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +7 -21
  15. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  16. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +12 -1
  17. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
  18. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +13 -3
  19. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
  20. package/lib/components/editor/side-bar/WorkspaceReview.d.ts.map +1 -1
  21. package/lib/components/editor/side-bar/WorkspaceReview.js +12 -7
  22. package/lib/components/editor/side-bar/WorkspaceReview.js.map +1 -1
  23. package/lib/components/workspace-setup/WorkspaceSetup.d.ts.map +1 -1
  24. package/lib/components/workspace-setup/WorkspaceSetup.js +9 -2
  25. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/package.json +1 -1
  29. package/lib/stores/editor/EditorSDLCState.d.ts +1 -0
  30. package/lib/stores/editor/EditorSDLCState.d.ts.map +1 -1
  31. package/lib/stores/editor/EditorSDLCState.js +5 -1
  32. package/lib/stores/editor/EditorSDLCState.js.map +1 -1
  33. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts +34 -10
  34. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts.map +1 -1
  35. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +174 -95
  36. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -1
  37. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +1 -8
  38. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  39. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +1 -70
  40. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  41. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +1 -1
  42. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -1
  43. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +2 -4
  44. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -1
  45. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts +2 -0
  46. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  47. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +6 -0
  48. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  49. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +0 -8
  50. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  51. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -73
  52. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  53. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +12 -2
  54. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
  55. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +120 -16
  56. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
  57. package/lib/stores/editor/sidebar-state/WorkspaceReviewState.d.ts.map +1 -1
  58. package/lib/stores/editor/sidebar-state/WorkspaceReviewState.js +5 -1
  59. package/lib/stores/editor/sidebar-state/WorkspaceReviewState.js.map +1 -1
  60. package/lib/stores/editor/utils/TestableUtils.d.ts +7 -1
  61. package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
  62. package/lib/stores/editor/utils/TestableUtils.js +71 -2
  63. package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
  64. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts +6 -1
  65. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts.map +1 -1
  66. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js +16 -1
  67. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js.map +1 -1
  68. package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts +8 -1
  69. package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts.map +1 -1
  70. package/lib/stores/workspace-setup/WorkspaceSetupStore.js +97 -8
  71. package/lib/stores/workspace-setup/WorkspaceSetupStore.js.map +1 -1
  72. package/package.json +5 -5
  73. package/src/application/LegendStudioApplicationConfig.ts +7 -0
  74. package/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx +376 -61
  75. package/src/components/editor/editor-group/service-editor/ServiceRegistrationEditor.tsx +38 -1
  76. package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +18 -92
  77. package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +74 -1
  78. package/src/components/editor/side-bar/WorkspaceReview.tsx +6 -1
  79. package/src/components/workspace-setup/WorkspaceSetup.tsx +22 -1
  80. package/src/stores/editor/EditorSDLCState.ts +7 -0
  81. package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +280 -131
  82. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +2 -94
  83. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +5 -5
  84. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +7 -0
  85. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +1 -143
  86. package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +159 -19
  87. package/src/stores/editor/sidebar-state/WorkspaceReviewState.ts +7 -1
  88. package/src/stores/editor/utils/TestableUtils.ts +144 -4
  89. package/src/stores/graph-modifier/DomainGraphModifierHelper.ts +33 -0
  90. package/src/stores/workspace-setup/WorkspaceSetupStore.ts +152 -21
@@ -23,26 +23,33 @@ import {
23
23
  LogEvent,
24
24
  ActionState,
25
25
  IllegalStateError,
26
+ UnsupportedOperationError,
27
+ guaranteeNonNullable,
28
+ guaranteeType,
26
29
  } from '@finos/legend-shared';
27
30
  import { generateSetupRoute } from '../../__lib__/LegendStudioNavigation.js';
28
31
  import {
29
32
  type SDLCServerClient,
33
+ SANDBOX_SDLC_TAG,
30
34
  WorkspaceType,
31
35
  ImportReport,
32
36
  Project,
33
37
  Review,
34
38
  Workspace,
35
39
  Patch,
40
+ isProjectSandbox,
36
41
  } from '@finos/legend-server-sdlc';
37
42
  import type { LegendStudioApplicationStore } from '../LegendStudioBaseStore.js';
38
43
  import {
44
+ DEFAULT_TAB_SIZE,
39
45
  DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
40
46
  DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
41
47
  } from '@finos/legend-application';
42
48
  import {
43
49
  fetchProjectConfigurationStatus,
44
- type ProjectConfigurationStatus,
50
+ ProjectConfigurationStatus,
45
51
  } from './ProjectConfigurationStatus.js';
52
+ import { GraphManagerState } from '@finos/legend-graph';
46
53
 
47
54
  interface ImportProjectSuccessReport {
48
55
  projectId: string;
@@ -57,13 +64,17 @@ export class WorkspaceSetupStore {
57
64
  readonly initState = ActionState.create();
58
65
 
59
66
  projects: Project[] = [];
67
+ sandboxProject: Project | boolean = false;
60
68
  currentProject?: Project | undefined;
61
69
  currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
62
70
  loadProjectsState = ActionState.create();
71
+ loadSandboxState = ActionState.create();
63
72
  createOrImportProjectState = ActionState.create();
64
73
  importProjectSuccessReport?: ImportProjectSuccessReport | undefined;
65
74
  showCreateProjectModal = false;
66
75
 
76
+ createSandboxProjectState = ActionState.create();
77
+
67
78
  patches: Patch[] = [];
68
79
  loadPatchesState = ActionState.create();
69
80
 
@@ -74,6 +85,8 @@ export class WorkspaceSetupStore {
74
85
  showCreateWorkspaceModal = false;
75
86
  showAdvancedWorkspaceFilterOptions = false;
76
87
 
88
+ graphManagerState: GraphManagerState;
89
+
77
90
  constructor(
78
91
  applicationStore: LegendStudioApplicationStore,
79
92
  sdlcServerClient: SDLCServerClient,
@@ -87,7 +100,10 @@ export class WorkspaceSetupStore {
87
100
  workspaces: observable,
88
101
  currentWorkspace: observable,
89
102
  showAdvancedWorkspaceFilterOptions: observable,
103
+ loadSandboxState: observable,
90
104
  showCreateWorkspaceModal: observable,
105
+ sandboxProject: observable,
106
+ createSandboxProjectState: observable,
91
107
  setShowCreateProjectModal: action,
92
108
  setShowCreateWorkspaceModal: action,
93
109
  setShowAdvancedWorkspaceFilterOptions: action,
@@ -97,14 +113,20 @@ export class WorkspaceSetupStore {
97
113
  resetWorkspace: action,
98
114
  initialize: flow,
99
115
  loadProjects: flow,
116
+ loadSandboxProject: flow,
100
117
  changeProject: flow,
101
118
  createProject: flow,
102
119
  importProject: flow,
120
+ createSandboxProject: flow,
103
121
  createWorkspace: flow,
104
122
  });
105
123
 
106
124
  this.applicationStore = applicationStore;
107
125
  this.sdlcServerClient = sdlcServerClient;
126
+ this.graphManagerState = new GraphManagerState(
127
+ applicationStore.pluginManager,
128
+ applicationStore.logService,
129
+ );
108
130
  }
109
131
 
110
132
  setShowCreateProjectModal(val: boolean): void {
@@ -150,6 +172,59 @@ export class WorkspaceSetupStore {
150
172
  }
151
173
  }
152
174
 
175
+ *createSandboxProject(): GeneratorFn<void> {
176
+ try {
177
+ // create sandbox project and pilot workspace
178
+ this.applicationStore.alertService.setBlockingAlert({
179
+ message: 'Creating sandbox project...',
180
+ showLoading: true,
181
+ });
182
+ const sandboxProject =
183
+ (yield this.graphManagerState.graphManager.createSandboxProject()) as {
184
+ projectId: string;
185
+ webUrl: string | undefined;
186
+ owner: string;
187
+ };
188
+ this.applicationStore.alertService.setBlockingAlert({
189
+ message: `Sandbox project ${sandboxProject.projectId} created. Creating default workspace...`,
190
+ showLoading: true,
191
+ });
192
+ yield flowResult(this.loadSandboxProject());
193
+ const sandbox = guaranteeType(
194
+ this.sandboxProject,
195
+ Project,
196
+ 'Error Retrieving sandbox project',
197
+ );
198
+ const pilotWorkspace = Workspace.serialization.fromJson(
199
+ (yield this.sdlcServerClient.createWorkspace(
200
+ sandbox.projectId,
201
+ undefined,
202
+ 'pilotWorkspace',
203
+ WorkspaceType.GROUP,
204
+ )) as PlainObject<Workspace>,
205
+ );
206
+ yield flowResult(
207
+ this.changeProject(sandbox, {
208
+ workspaceId: pilotWorkspace.workspaceId,
209
+ workspaceType: WorkspaceType.GROUP,
210
+ }),
211
+ );
212
+ this.applicationStore.alertService.setBlockingAlert(undefined);
213
+ this.applicationStore.notificationService.notifySuccess(
214
+ `Sandbox Project with pilot workspace created`,
215
+ );
216
+ } catch (error) {
217
+ assertErrorThrown(error);
218
+ this.applicationStore.logService.error(
219
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DEPOT_MANAGER_FAILURE),
220
+ error,
221
+ );
222
+ this.applicationStore.notificationService.notifyError(error);
223
+ } finally {
224
+ this.applicationStore.alertService.setBlockingAlert(undefined);
225
+ }
226
+ }
227
+
153
228
  *initialize(
154
229
  projectId: string | undefined,
155
230
  workspaceId: string | undefined,
@@ -193,7 +268,22 @@ export class WorkspaceSetupStore {
193
268
  ),
194
269
  );
195
270
  }
196
-
271
+ yield flowResult(
272
+ this.graphManagerState.graphManager.initialize(
273
+ {
274
+ env: this.applicationStore.config.env,
275
+ tabSize: DEFAULT_TAB_SIZE,
276
+ clientConfig: {
277
+ baseUrl: this.applicationStore.config.engineServerUrl,
278
+ queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
279
+ enableCompression: true,
280
+ },
281
+ },
282
+ {
283
+ tracerService: this.applicationStore.tracerService,
284
+ },
285
+ ),
286
+ );
197
287
  this.initState.pass();
198
288
  } catch (error) {
199
289
  assertErrorThrown(error);
@@ -227,6 +317,35 @@ export class WorkspaceSetupStore {
227
317
  }
228
318
  }
229
319
 
320
+ *loadSandboxProject(): GeneratorFn<void> {
321
+ this.sandboxProject = false;
322
+ this.loadSandboxState.inProgress();
323
+ try {
324
+ const sandboxProject = (
325
+ (yield this.sdlcServerClient.getProjects(
326
+ undefined,
327
+ this.sdlcServerClient.currentUser?.userId,
328
+ [SANDBOX_SDLC_TAG],
329
+ 1,
330
+ )) as PlainObject<Project>[]
331
+ ).map((v) => Project.serialization.fromJson(v));
332
+ this.sandboxProject = true;
333
+ if (sandboxProject.length > 1) {
334
+ throw new UnsupportedOperationError('Only one sandbox is supported., ');
335
+ } else if (sandboxProject.length === 1) {
336
+ this.sandboxProject = guaranteeNonNullable(sandboxProject[0]);
337
+ }
338
+ this.loadSandboxState.pass();
339
+ } catch (error) {
340
+ this.sandboxProject = true;
341
+ assertErrorThrown(error);
342
+ this.applicationStore.logService.error(
343
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.WORKSPACE_SETUP_FAILURE),
344
+ );
345
+ this.loadSandboxState.fail();
346
+ }
347
+ }
348
+
230
349
  *changeProject(
231
350
  project: Project,
232
351
  workspaceInfo?:
@@ -240,11 +359,15 @@ export class WorkspaceSetupStore {
240
359
  this.currentProjectConfigurationStatus = undefined;
241
360
  this.loadPatchesState.inProgress();
242
361
  try {
243
- this.patches = (
244
- (yield this.sdlcServerClient.getPatches(
245
- project.projectId,
246
- )) as PlainObject<Patch>[]
247
- ).map((v) => Patch.serialization.fromJson(v));
362
+ if (isProjectSandbox(project)) {
363
+ this.patches = [];
364
+ } else {
365
+ this.patches = (
366
+ (yield this.sdlcServerClient.getPatches(
367
+ project.projectId,
368
+ )) as PlainObject<Patch>[]
369
+ ).map((v) => Patch.serialization.fromJson(v));
370
+ }
248
371
  this.loadPatchesState.pass();
249
372
  } catch (error) {
250
373
  assertErrorThrown(error);
@@ -258,20 +381,28 @@ export class WorkspaceSetupStore {
258
381
 
259
382
  this.loadWorkspacesState.inProgress();
260
383
  try {
261
- this.currentProjectConfigurationStatus =
262
- (yield fetchProjectConfigurationStatus(
263
- project.projectId,
264
- undefined,
265
- this.applicationStore,
266
- this.sdlcServerClient,
267
- )) as ProjectConfigurationStatus;
268
-
269
- const workspacesInConflictResolutionIds = (
270
- (yield this.sdlcServerClient.getWorkspacesInConflictResolutionMode(
271
- project.projectId,
272
- undefined,
273
- )) as Workspace[]
274
- ).map((workspace) => workspace.workspaceId);
384
+ if (isProjectSandbox(project)) {
385
+ const result = new ProjectConfigurationStatus();
386
+ result.projectId = project.projectId;
387
+ result.isConfigured = true;
388
+ this.currentProjectConfigurationStatus = result;
389
+ } else {
390
+ this.currentProjectConfigurationStatus =
391
+ (yield fetchProjectConfigurationStatus(
392
+ project.projectId,
393
+ undefined,
394
+ this.applicationStore,
395
+ this.sdlcServerClient,
396
+ )) as ProjectConfigurationStatus;
397
+ }
398
+ const workspacesInConflictResolutionIds = isProjectSandbox(project)
399
+ ? []
400
+ : (
401
+ (yield this.sdlcServerClient.getWorkspacesInConflictResolutionMode(
402
+ project.projectId,
403
+ undefined,
404
+ )) as Workspace[]
405
+ ).map((workspace) => workspace.workspaceId);
275
406
 
276
407
  this.workspaces = (
277
408
  (yield this.sdlcServerClient.getWorkspaces(