@finos/legend-application-studio 25.0.2 → 25.0.4

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 (38) hide show
  1. package/lib/components/editor/ActivityBar.js +1 -1
  2. package/lib/components/editor/ActivityBar.js.map +1 -1
  3. package/lib/components/editor/editor-group/service-editor/BulkServiceRegistrationEditor.d.ts.map +1 -1
  4. package/lib/components/editor/editor-group/service-editor/BulkServiceRegistrationEditor.js +1 -7
  5. package/lib/components/editor/editor-group/service-editor/BulkServiceRegistrationEditor.js.map +1 -1
  6. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.d.ts.map +1 -1
  7. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js +2 -5
  8. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js.map +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/package.json +4 -4
  11. package/lib/stores/editor/EditorDepotState.d.ts +25 -0
  12. package/lib/stores/editor/EditorDepotState.d.ts.map +1 -0
  13. package/lib/stores/editor/EditorDepotState.js +49 -0
  14. package/lib/stores/editor/EditorDepotState.js.map +1 -0
  15. package/lib/stores/editor/EditorStore.d.ts +2 -0
  16. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  17. package/lib/stores/editor/EditorStore.js +5 -0
  18. package/lib/stores/editor/EditorStore.js.map +1 -1
  19. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts +4 -4
  20. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  21. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +32 -16
  22. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  23. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.d.ts.map +1 -1
  24. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +1 -5
  25. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  26. package/lib/stores/project-view/ProjectViewerStore.d.ts.map +1 -1
  27. package/lib/stores/project-view/ProjectViewerStore.js +1 -0
  28. package/lib/stores/project-view/ProjectViewerStore.js.map +1 -1
  29. package/package.json +14 -14
  30. package/src/components/editor/ActivityBar.tsx +1 -1
  31. package/src/components/editor/editor-group/service-editor/BulkServiceRegistrationEditor.tsx +2 -8
  32. package/src/components/editor/editor-group/service-editor/ServiceRegistrationEditor.tsx +3 -7
  33. package/src/stores/editor/EditorDepotState.ts +70 -0
  34. package/src/stores/editor/EditorStore.ts +5 -0
  35. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +39 -22
  36. package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +2 -7
  37. package/src/stores/project-view/ProjectViewerStore.ts +1 -0
  38. package/tsconfig.json +1 -0
@@ -32,26 +32,30 @@ import {
32
32
  filterByType,
33
33
  } from '@finos/legend-shared';
34
34
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
35
- import { Version } from '@finos/legend-server-sdlc';
36
35
  import {
37
36
  type Service,
38
37
  type PureExecution,
38
+ type ServiceRegistrationSuccess,
39
39
  ServiceExecutionMode,
40
40
  buildLambdaVariableExpressions,
41
41
  VariableExpression,
42
42
  generateMultiplicityString,
43
43
  areMultiplicitiesEqual,
44
44
  Multiplicity,
45
- type ServiceRegistrationSuccess,
46
45
  } from '@finos/legend-graph';
47
46
  import { ServiceRegistrationEnvironmentConfig } from '../../../../../application/LegendStudioApplicationConfig.js';
48
47
  import {
49
48
  ActionAlertActionType,
50
49
  ActionAlertType,
51
50
  } from '@finos/legend-application';
51
+ import { compareSemVerVersions } from '@finos/legend-storage';
52
52
 
53
53
  export const LATEST_PROJECT_REVISION = 'Latest Project Revision';
54
54
 
55
+ const PROD_SERVICE_EXECUTION_SERVER = 'PROD';
56
+
57
+ export const PROJECT_SEMANTIC_VERSION_PATTERN = /^[0-9]*.[0-9]*.[0-9]*$/;
58
+
55
59
  export const generateServiceManagementUrl = (
56
60
  baseUrl: string,
57
61
  serviceUrlPattern: string,
@@ -82,7 +86,7 @@ const getServiceExecutionMode = (mode: string): ServiceExecutionMode => {
82
86
 
83
87
  interface ServiceVersionOption {
84
88
  label: string;
85
- value: Version | string;
89
+ value: string;
86
90
  }
87
91
 
88
92
  export class ServiceConfigState {
@@ -92,7 +96,7 @@ export class ServiceConfigState {
92
96
 
93
97
  serviceEnv?: string | undefined;
94
98
  serviceExecutionMode?: ServiceExecutionMode | undefined;
95
- projectVersion?: Version | string | undefined;
99
+ projectVersion?: string | undefined;
96
100
  enableModesWithVersioning: boolean;
97
101
  TEMPORARY__useStoreModel = false;
98
102
  TEMPORARY__useGenerateLineage = true;
@@ -159,19 +163,36 @@ export class ServiceConfigState {
159
163
  this.enableModesWithVersioning &&
160
164
  this.serviceExecutionMode !== ServiceExecutionMode.FULL_INTERACTIVE
161
165
  ) {
162
- const options: ServiceVersionOption[] =
163
- this.editorStore.sdlcState.projectVersions.map((version) => ({
164
- label: version.id.id,
166
+ const semVerVersions = this.editorStore.depotState.projectVersions
167
+ .filter((v) => v.match(PROJECT_SEMANTIC_VERSION_PATTERN))
168
+ .sort((v1, v2) => compareSemVerVersions(v2, v1));
169
+ const snapshotVersions = this.editorStore.depotState.projectVersions
170
+ .filter((v) => !v.match(PROJECT_SEMANTIC_VERSION_PATTERN))
171
+ .sort((v1, v2) => v1.localeCompare(v2));
172
+ const options: ServiceVersionOption[] = snapshotVersions
173
+ .concat(semVerVersions)
174
+ .map((version) => ({
175
+ label: version,
165
176
  value: version,
166
177
  }));
167
- if (this.serviceExecutionMode !== ServiceExecutionMode.PROD) {
168
- return [
169
- {
170
- label: prettyCONSTName(LATEST_PROJECT_REVISION),
171
- value: LATEST_PROJECT_REVISION,
172
- },
173
- ...options,
174
- ];
178
+ if (
179
+ this.serviceEnv &&
180
+ this.serviceEnv.toUpperCase() === PROD_SERVICE_EXECUTION_SERVER
181
+ ) {
182
+ return semVerVersions.map((version) => ({
183
+ label: version,
184
+ value: version,
185
+ }));
186
+ } else {
187
+ if (this.serviceExecutionMode !== ServiceExecutionMode.PROD) {
188
+ return [
189
+ {
190
+ label: prettyCONSTName(LATEST_PROJECT_REVISION),
191
+ value: LATEST_PROJECT_REVISION,
192
+ },
193
+ ...options,
194
+ ];
195
+ }
175
196
  }
176
197
  return options;
177
198
  }
@@ -186,7 +207,7 @@ export class ServiceConfigState {
186
207
  this.serviceExecutionMode = val;
187
208
  }
188
209
 
189
- setProjectVersion(val: Version | string | undefined): void {
210
+ setProjectVersion(val: string | undefined): void {
190
211
  this.projectVersion = val;
191
212
  }
192
213
 
@@ -208,7 +229,7 @@ export class ServiceConfigState {
208
229
  if (this.serviceExecutionMode === ServiceExecutionMode.SEMI_INTERACTIVE) {
209
230
  this.projectVersion = LATEST_PROJECT_REVISION;
210
231
  } else if (this.serviceExecutionMode === ServiceExecutionMode.PROD) {
211
- this.projectVersion = this.editorStore.sdlcState.projectVersions[0];
232
+ this.projectVersion = this.editorStore.depotState.projectVersions[0];
212
233
  } else {
213
234
  this.projectVersion = undefined;
214
235
  }
@@ -256,10 +277,6 @@ export class ServiceRegistrationState extends ServiceConfigState {
256
277
  this.options.find((info) => info.env === this.serviceEnv),
257
278
  );
258
279
  const serverUrl = config.executionUrl;
259
- const versionInput =
260
- this.projectVersion instanceof Version
261
- ? this.projectVersion.id.id
262
- : undefined;
263
280
  const projectConfig = guaranteeNonNullable(
264
281
  this.editorStore.projectConfigurationEditorState.projectConfiguration,
265
282
  );
@@ -270,7 +287,7 @@ export class ServiceRegistrationState extends ServiceConfigState {
270
287
  this.editorStore.graphManagerState.graph,
271
288
  projectConfig.groupId,
272
289
  projectConfig.artifactId,
273
- versionInput,
290
+ this.projectVersion,
274
291
  serverUrl,
275
292
  guaranteeNonNullable(this.serviceExecutionMode),
276
293
  {
@@ -30,7 +30,6 @@ import {
30
30
  ActionState,
31
31
  assertTrue,
32
32
  } from '@finos/legend-shared';
33
- import { Version } from '@finos/legend-server-sdlc';
34
33
  import {
35
34
  ServiceConfigState,
36
35
  ServiceRegistrationState,
@@ -193,23 +192,19 @@ export class GlobalBulkServiceRegistrationState {
193
192
  this.editorStore.projectConfigurationEditorState.projectConfiguration,
194
193
  );
195
194
 
196
- const versionInput =
197
- this.serviceConfigState.projectVersion instanceof Version
198
- ? this.serviceConfigState.projectVersion.id.id
199
- : undefined;
200
-
201
195
  const config = guaranteeNonNullable(
202
196
  this.serviceConfigState.options.find(
203
197
  (info) => info.env === this.serviceConfigState.serviceEnv,
204
198
  ),
205
199
  );
200
+
206
201
  const registrationResults =
207
202
  (yield this.editorStore.graphManagerState.graphManager.bulkServiceRegistration(
208
203
  selectedServices,
209
204
  this.editorStore.graphManagerState.graph,
210
205
  projectConfig.groupId,
211
206
  projectConfig.artifactId,
212
- versionInput,
207
+ this.serviceConfigState.projectVersion,
213
208
  config.executionUrl,
214
209
  guaranteeNonNullable(this.serviceConfigState.serviceExecutionMode),
215
210
  {
@@ -181,6 +181,7 @@ export class ProjectViewerStore {
181
181
 
182
182
  // fetch project versions
183
183
  yield flowResult(this.editorStore.sdlcState.fetchProjectVersions());
184
+ yield flowResult(this.editorStore.depotState.fetchProjectVersions());
184
185
 
185
186
  // ensure only either version or revision is specified
186
187
  if (versionId && revisionId) {
package/tsconfig.json CHANGED
@@ -56,6 +56,7 @@
56
56
  "./src/stores/editor/ChangeDetectionState.ts",
57
57
  "./src/stores/editor/DependencyProjectViewerHelper.ts",
58
58
  "./src/stores/editor/EditorConfig.ts",
59
+ "./src/stores/editor/EditorDepotState.ts",
59
60
  "./src/stores/editor/EditorGraphState.ts",
60
61
  "./src/stores/editor/EditorMode.ts",
61
62
  "./src/stores/editor/EditorSDLCState.ts",