@finos/legend-application-studio 28.1.4 → 28.2.1

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 (56) 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/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  15. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js +12 -3
  16. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  17. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js +6 -6
  18. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js.map +1 -1
  19. package/lib/components/editor/side-bar/Explorer.js +1 -1
  20. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  21. package/lib/index.css +1 -1
  22. package/lib/package.json +1 -1
  23. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  24. package/lib/stores/editor/EditorGraphState.js +3 -27
  25. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  26. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +1 -0
  27. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  28. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +16 -2
  29. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  30. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.d.ts.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js +1 -1
  32. package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.js.map +1 -1
  33. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  34. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +5 -3
  35. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  36. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +2 -0
  37. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  38. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +29 -2
  39. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  40. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
  41. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +0 -11
  42. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
  43. package/package.json +6 -6
  44. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +0 -7
  45. package/src/components/editor/editor-group/FunctionEditor.tsx +100 -2
  46. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +11 -18
  47. package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +69 -83
  48. package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx +55 -18
  49. package/src/components/editor/editor-group/uml-editor/ClassQueryBuilder.tsx +6 -6
  50. package/src/components/editor/side-bar/Explorer.tsx +1 -1
  51. package/src/stores/editor/EditorGraphState.ts +10 -53
  52. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +29 -0
  53. package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionQueryBuilderState.ts +1 -2
  54. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
  55. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +61 -0
  56. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +0 -16
@@ -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);
@@ -23,6 +23,7 @@ import {
23
23
  type RawLambda,
24
24
  type DataElement,
25
25
  type Mapping,
26
+ type TestDataGenerationResult,
26
27
  ConnectionTestData,
27
28
  PureSingleExecution,
28
29
  PureMultiExecution,
@@ -37,6 +38,7 @@ import {
37
38
  getAllIdentifiedConnectionsFromRuntime,
38
39
  getAllIdentifiedServiceConnections,
39
40
  Database,
41
+ RuntimePointer,
40
42
  } from '@finos/legend-graph';
41
43
  import {
42
44
  type GeneratorFn,
@@ -47,6 +49,8 @@ import {
47
49
  guaranteeNonNullable,
48
50
  returnUndefOnError,
49
51
  getNullableFirstEntry,
52
+ assertType,
53
+ assertTrue,
50
54
  } from '@finos/legend-shared';
51
55
  import { action, flow, flowResult, makeObservable, observable } from 'mobx';
52
56
  import type { EditorStore } from '../../../../EditorStore.js';
@@ -156,6 +160,7 @@ export class ConnectionTestDataState {
156
160
  readonly connectionData: ConnectionTestData;
157
161
  readonly parametersState: ServiceTestDataParametersState;
158
162
  readonly generatingTestDataState = ActionState.create();
163
+ readonly generateSchemaQueryState = ActionState.create();
159
164
  useSharedModal = false;
160
165
 
161
166
  embeddedEditorState: EmbeddedDataEditorState;
@@ -167,6 +172,7 @@ export class ConnectionTestDataState {
167
172
  ) {
168
173
  makeObservable(this, {
169
174
  generatingTestDataState: observable,
175
+ generateSchemaQueryState: observable,
170
176
  embeddedEditorState: observable,
171
177
  useSharedModal: observable,
172
178
  anonymizeGeneratedData: observable,
@@ -175,6 +181,7 @@ export class ConnectionTestDataState {
175
181
  buildEmbeddedEditorState: action,
176
182
  generateTestData: flow,
177
183
  generateTestDataForDatabaseConnection: flow,
184
+ generateQuerySchemas: flow,
178
185
  });
179
186
  this.testDataState = testDataState;
180
187
  this.editorStore = testDataState.editorStore;
@@ -326,6 +333,60 @@ export class ConnectionTestDataState {
326
333
  }
327
334
  }
328
335
 
336
+ *generateQuerySchemas(): GeneratorFn<void> {
337
+ try {
338
+ this.generateSchemaQueryState.inProgress();
339
+ const connection = guaranteeNonNullable(
340
+ this.resolveConnectionValue(this.connectionData.connectionId),
341
+ `Unable to resolve connection ID '${this.connectionData.connectionId}`,
342
+ );
343
+ if (connection instanceof DatabaseConnection) {
344
+ const serviceExecutionParameters = guaranteeNonNullable(
345
+ this.testDataState.testSuiteState.testableState.serviceEditorState
346
+ .executionState.serviceExecutionParameters,
347
+ );
348
+ assertType(
349
+ serviceExecutionParameters.runtime,
350
+ RuntimePointer,
351
+ 'Expected runtime type to be RuntimePointer',
352
+ );
353
+ const testDataGenerationResult =
354
+ (yield this.editorStore.graphManagerState.graphManager.generateTestData(
355
+ getExecutionQueryFromRawLambda(
356
+ serviceExecutionParameters.query,
357
+ this.parametersState.parameterStates,
358
+ this.editorStore.graphManagerState,
359
+ ),
360
+ serviceExecutionParameters.mapping.path,
361
+ serviceExecutionParameters.runtime.packageableRuntime.value.path,
362
+ this.editorStore.graphManagerState.graph,
363
+ )) as TestDataGenerationResult;
364
+ assertTrue(
365
+ testDataGenerationResult.data.length >= 1,
366
+ 'Expected generated data to at least have one data',
367
+ );
368
+ service_setConnectionTestDataEmbeddedData(
369
+ this.connectionData,
370
+ guaranteeNonNullable(testDataGenerationResult.data[0]),
371
+ this.editorStore.changeDetectionState.observerContext,
372
+ );
373
+ this.embeddedEditorState = new EmbeddedDataEditorState(
374
+ this.testDataState.editorStore,
375
+ this.connectionData.testData,
376
+ );
377
+ }
378
+ this.generateSchemaQueryState.pass();
379
+ } catch (error) {
380
+ assertErrorThrown(error);
381
+ this.editorStore.applicationStore.notificationService.notifyError(
382
+ `Unable to generate query schemas: ${error.message}`,
383
+ );
384
+ this.generateSchemaQueryState.fail();
385
+ } finally {
386
+ this.generateSchemaQueryState.complete();
387
+ }
388
+ }
389
+
329
390
  changeEmbeddedData(val: EmbeddedData): void {
330
391
  service_setConnectionTestDataEmbeddedData(
331
392
  this.connectionData,
@@ -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);