@finos/legend-application-studio 28.1.4 → 28.2.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 (47) hide show
  1. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts +0 -1
  2. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
  3. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +1 -3
  4. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
  5. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/FunctionEditor.js +43 -6
  7. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  9. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +4 -9
  10. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  11. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  12. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +36 -47
  13. package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  14. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js +6 -6
  15. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js.map +1 -1
  16. package/lib/components/editor/side-bar/Explorer.js +1 -1
  17. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  18. package/lib/index.css +1 -1
  19. package/lib/package.json +1 -1
  20. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  21. package/lib/stores/editor/EditorGraphState.js +3 -27
  22. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  23. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
  24. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  25. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +16 -2
  26. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  27. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.d.ts.map +1 -1
  28. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js +1 -1
  29. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js.map +1 -1
  30. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +5 -3
  32. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  33. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
  34. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +0 -11
  35. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
  36. package/package.json +6 -6
  37. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +0 -7
  38. package/src/components/editor/editor-group/FunctionEditor.tsx +100 -2
  39. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +11 -18
  40. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +69 -83
  41. package/src/components/editor/editor-group/uml-editor/ClassQueryBuilder.tsx +6 -6
  42. package/src/components/editor/side-bar/Explorer.tsx +1 -1
  43. package/src/stores/editor/EditorGraphState.ts +10 -53
  44. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +29 -0
  45. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.ts +1 -2
  46. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
  47. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +0 -16
@@ -42,11 +42,7 @@ import { ElementEditorState } from './editor-state/element-editor-state/ElementE
42
42
  import { GraphGenerationState } from './editor-state/GraphGenerationState.js';
43
43
  import { MODEL_IMPORT_NATIVE_INPUT_TYPE } from './editor-state/ModelImporterState.js';
44
44
  import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudioApplicationPlugin.js';
45
- import {
46
- type Entity,
47
- EntitiesWithOrigin,
48
- generateGAVCoordinates,
49
- } from '@finos/legend-storage';
45
+ import { type Entity, EntitiesWithOrigin } from '@finos/legend-storage';
50
46
  import {
51
47
  type EntityChange,
52
48
  type ProjectDependency,
@@ -59,7 +55,6 @@ import {
59
55
  ProjectDependencyCoordinates,
60
56
  RawProjectDependencyReport,
61
57
  buildDependencyReport,
62
- StoreProjectData,
63
58
  } from '@finos/legend-server-depot';
64
59
  import {
65
60
  GRAPH_MANAGER_EVENT,
@@ -752,53 +747,15 @@ export class EditorGraphState {
752
747
  projectDependencies: ProjectDependency[],
753
748
  ): Promise<ProjectDependencyCoordinates[]> {
754
749
  return Promise.all(
755
- projectDependencies.map(async (dep) => {
756
- /**
757
- * We expect current dependency ids to be in the format of {groupId}:{artifactId}.
758
- * For the legacy dependency we must fetch the corresponding coordinates (group, artifact ids) from the depot server
759
- *
760
- * @backwardCompatibility
761
- */
762
- if (dep.isLegacyDependency) {
763
- return this.editorStore.depotServerClient
764
- .getProjectById(dep.projectId)
765
- .then((projects) => {
766
- const projectsData = projects.map((p) =>
767
- StoreProjectData.serialization.fromJson(p),
768
- );
769
- if (projectsData.length !== 1) {
770
- throw new Error(
771
- `Expected 1 project for project ID '${dep.projectId}'. Got ${
772
- projectsData.length
773
- } projects with coordinates ${projectsData
774
- .map(
775
- (i) =>
776
- `'${generateGAVCoordinates(
777
- i.groupId,
778
- i.artifactId,
779
- undefined,
780
- )}'`,
781
- )
782
- .join(', ')}.`,
783
- );
784
- }
785
- const project = projectsData[0] as StoreProjectData;
786
- return new ProjectDependencyCoordinates(
787
- project.groupId,
788
- project.artifactId,
789
- dep.versionId,
790
- );
791
- });
792
- } else {
793
- return Promise.resolve(
794
- new ProjectDependencyCoordinates(
795
- guaranteeNonNullable(dep.groupId),
796
- guaranteeNonNullable(dep.artifactId),
797
- dep.versionId,
798
- ),
799
- );
800
- }
801
- }),
750
+ projectDependencies.map(async (dep) =>
751
+ Promise.resolve(
752
+ new ProjectDependencyCoordinates(
753
+ guaranteeNonNullable(dep.groupId),
754
+ guaranteeNonNullable(dep.artifactId),
755
+ dep.versionId,
756
+ ),
757
+ ),
758
+ ),
802
759
  );
803
760
  }
804
761
 
@@ -32,6 +32,7 @@ import {
32
32
  assertType,
33
33
  StopWatch,
34
34
  filterByType,
35
+ assertTrue,
35
36
  } from '@finos/legend-shared';
36
37
  import { ElementEditorState } from './ElementEditorState.js';
37
38
  import {
@@ -51,6 +52,7 @@ import {
51
52
  VariableExpression,
52
53
  observe_ValueSpecification,
53
54
  generateFunctionPrettyName,
55
+ RawVariableExpression,
54
56
  } from '@finos/legend-graph';
55
57
  import {
56
58
  ExecutionPlanState,
@@ -271,6 +273,7 @@ export class FunctionEditorState extends ElementEditorState {
271
273
  generatePlan: flow,
272
274
  handleRunFunc: flow,
273
275
  cancelFuncRun: flow,
276
+ updateFunctionWithQuery: flow,
274
277
  });
275
278
 
276
279
  assertType(
@@ -335,6 +338,32 @@ export class FunctionEditorState extends ElementEditorState {
335
338
  this.functionDefinitionEditorState.setCompilationError(undefined);
336
339
  }
337
340
 
341
+ *updateFunctionWithQuery(val: RawLambda): GeneratorFn<void> {
342
+ const lambdaParam = val.parameters ? (val.parameters as object[]) : [];
343
+ const parameters = lambdaParam
344
+ .map((param) =>
345
+ this.editorStore.graphManagerState.graphManager.buildRawValueSpecification(
346
+ param,
347
+ this.editorStore.graphManagerState.graph,
348
+ ),
349
+ )
350
+ .map((rawValueSpec) =>
351
+ guaranteeType(rawValueSpec, RawVariableExpression),
352
+ );
353
+ assertTrue(
354
+ Array.isArray(val.body),
355
+ `Query body expected to be a list of expressions`,
356
+ );
357
+ this.functionElement.expressionSequence = val.body as object[];
358
+ this.functionElement.parameters = parameters;
359
+ yield flowResult(
360
+ this.functionDefinitionEditorState.convertLambdaObjectToGrammarString({
361
+ pretty: true,
362
+ firstLoad: true,
363
+ }),
364
+ );
365
+ }
366
+
338
367
  reprocess(
339
368
  newElement: ConcreteFunctionDefinition,
340
369
  editorStore: EditorStore,
@@ -31,9 +31,8 @@ export class MappingExecutionQueryBuilderState extends QueryBuilderState {
31
31
  mapping: Mapping,
32
32
  ) {
33
33
  super(applicationStore, graphManagerState);
34
-
35
34
  this.executionMapping = mapping;
36
- this.mapping = mapping;
35
+ this.executionContextState.mapping = mapping;
37
36
  }
38
37
 
39
38
  override get isMappingReadOnly(): boolean {
@@ -42,6 +42,7 @@ import {
42
42
  getValueSpecificationReturnType,
43
43
  type Type,
44
44
  resolveServiceQueryRawLambda,
45
+ PureExecution,
45
46
  } from '@finos/legend-graph';
46
47
  import { ServiceTestableState } from './testable/ServiceTestableState.js';
47
48
  import { User } from '@finos/legend-server-sdlc';
@@ -132,10 +133,13 @@ export class ServiceEditorState extends ElementEditorState {
132
133
  editorStore.sdlcServerClient.features.canCreateVersion,
133
134
  );
134
135
  this.testableState = new ServiceTestableState(editorStore, this);
135
- const query = this.executionState.serviceExecutionParameters?.query;
136
+ const executionQuery =
137
+ this.service.execution instanceof PureExecution
138
+ ? this.service.execution.func
139
+ : undefined;
136
140
  // default to execution tab if query is defined
137
141
  this.selectedTab =
138
- query && !isStubbed_RawLambda(query)
142
+ executionQuery && !isStubbed_RawLambda(executionQuery)
139
143
  ? SERVICE_TAB.EXECUTION
140
144
  : SERVICE_TAB.GENERAL;
141
145
  this.postValidationState = new ServicePostValidationsState(this);
@@ -200,22 +200,6 @@ export class ProjectConfigurationEditorState extends EditorState {
200
200
  .map((v) => StoreProjectData.serialization.fromJson(v))
201
201
  .forEach((project) => this.projects.set(project.coordinates, project));
202
202
 
203
- // Update the legacy dependency to newer format (using group ID and artifact ID instead of just project ID)
204
- this.projectConfiguration?.projectDependencies.forEach(
205
- (dependency): void => {
206
- if (!dependency.isLegacyDependency) {
207
- return;
208
- }
209
- const project = Array.from(this.projects.values()).find(
210
- (e) => e.projectId === dependency.projectId,
211
- );
212
- // re-write to new format
213
- if (project) {
214
- dependency.setProjectId(project.coordinates);
215
- }
216
- },
217
- );
218
-
219
203
  // fetch the versions for the dependency projects
220
204
  for (const dep of this.projectConfiguration?.projectDependencies ?? []) {
221
205
  const project = this.projects.get(dep.projectId);