@finos/legend-application-studio 26.1.5 → 26.1.7

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 (44) 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 +1 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioTesting.d.ts +3 -0
  6. package/lib/__lib__/LegendStudioTesting.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioTesting.js +3 -0
  8. package/lib/__lib__/LegendStudioTesting.js.map +1 -1
  9. package/lib/components/editor/ActivityBar.js +1 -1
  10. package/lib/components/editor/ActivityBar.js.map +1 -1
  11. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.d.ts.map +1 -1
  12. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js +51 -3
  13. package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js.map +1 -1
  14. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts +14 -1
  15. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  16. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +48 -19
  17. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  18. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  19. package/lib/components/editor/side-bar/Explorer.js +3 -2
  20. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  21. package/lib/index.css +2 -2
  22. package/lib/index.css.map +1 -1
  23. package/lib/package.json +1 -1
  24. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +9 -1
  25. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  26. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +60 -3
  27. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  28. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts +2 -0
  29. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
  30. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +6 -0
  31. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
  32. package/lib/stores/editor/utils/PackageTreeUtils.d.ts.map +1 -1
  33. package/lib/stores/editor/utils/PackageTreeUtils.js +3 -3
  34. package/lib/stores/editor/utils/PackageTreeUtils.js.map +1 -1
  35. package/package.json +4 -4
  36. package/src/__lib__/LegendStudioEvent.ts +1 -0
  37. package/src/__lib__/LegendStudioTesting.ts +3 -0
  38. package/src/components/editor/ActivityBar.tsx +1 -1
  39. package/src/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.tsx +156 -26
  40. package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +227 -44
  41. package/src/components/editor/side-bar/Explorer.tsx +3 -1
  42. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +114 -2
  43. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +7 -1
  44. package/src/stores/editor/utils/PackageTreeUtils.ts +7 -2
@@ -101,6 +101,7 @@ import {
101
101
  PackageableConnection,
102
102
  RelationalDatabaseConnection,
103
103
  guaranteeRelationalDatabaseConnection,
104
+ extractDependencyGACoordinateFromRootPackageName,
104
105
  } from '@finos/legend-graph';
105
106
  import { useApplicationStore } from '@finos/legend-application';
106
107
  import {
@@ -895,7 +896,8 @@ const PackageTreeNodeContainer = observer(
895
896
  tabIndex={-1}
896
897
  title={node.packageableElement.path}
897
898
  >
898
- {node.label}
899
+ {extractDependencyGACoordinateFromRootPackageName(node.label) ??
900
+ node.label}
899
901
  </button>
900
902
  </div>
901
903
  </ContextMenu>
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import {
18
+ type Binding,
18
19
  type ServiceTest,
19
20
  type Service,
20
21
  type ValueSpecification,
@@ -23,6 +24,13 @@ import {
23
24
  buildLambdaVariableExpressions,
24
25
  VariableExpression,
25
26
  PureMultiExecution,
27
+ PackageableElementImplicitReference,
28
+ matchFunctionName,
29
+ isStubbed_RawLambda,
30
+ InstanceValue,
31
+ LambdaFunctionInstanceValue,
32
+ SimpleFunctionExpression,
33
+ CollectionInstanceValue,
26
34
  } from '@finos/legend-graph';
27
35
  import { action, flow, makeObservable, observable } from 'mobx';
28
36
  import { TestableTestEditorState } from '../../testable/TestableEditorState.js';
@@ -37,6 +45,7 @@ import {
37
45
  service_setSerializationFormat,
38
46
  } from '../../../../../graph-modifier/DSL_Service_GraphModifierHelper.js';
39
47
  import {
48
+ type PlainObject,
40
49
  assertErrorThrown,
41
50
  deleteEntry,
42
51
  filterByType,
@@ -44,10 +53,15 @@ import {
44
53
  isNonNullable,
45
54
  returnUndefOnError,
46
55
  uuid,
47
- type PlainObject,
56
+ getNullableFirstEntry,
57
+ LogEvent,
48
58
  } from '@finos/legend-shared';
49
59
  import type { EditorStore } from '../../../../EditorStore.js';
50
- import { generateVariableExpressionMockValue } from '@finos/legend-query-builder';
60
+ import {
61
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS,
62
+ generateVariableExpressionMockValue,
63
+ } from '@finos/legend-query-builder';
64
+ import { LEGEND_STUDIO_APP_EVENT } from '../../../../../../__lib__/LegendStudioEvent.js';
51
65
 
52
66
  export enum SERIALIZATION_FORMAT {
53
67
  PURE = 'PURE',
@@ -180,6 +194,7 @@ export class ServiceTestSetupState {
180
194
  addServiceTestAssertKeys: action,
181
195
  syncWithQuery: action,
182
196
  removeParamValueState: action,
197
+ getBindingWithParamFromQuery: action,
183
198
  });
184
199
  this.parameterValueStates = this.buildParameterStates();
185
200
  }
@@ -221,6 +236,103 @@ export class ServiceTestSetupState {
221
236
  }));
222
237
  }
223
238
 
239
+ getBindingWithParamFromQuery(): {
240
+ binding: Binding;
241
+ param: string;
242
+ }[] {
243
+ const query =
244
+ this.testState.suiteState.testableState.serviceEditorState.serviceQuery;
245
+ if (query && !isStubbed_RawLambda(query)) {
246
+ // safely pass unsupported funtions when building ValueSpecification from Rawlambda
247
+ try {
248
+ const valueSpec =
249
+ this.editorStore.graphManagerState.graphManager.buildValueSpecification(
250
+ this.editorStore.graphManagerState.graphManager.serializeRawValueSpecification(
251
+ query,
252
+ ),
253
+ this.editorStore.graphManagerState.graph,
254
+ );
255
+
256
+ if (valueSpec instanceof LambdaFunctionInstanceValue) {
257
+ return this.getBindingWithParamRecursively(
258
+ valueSpec.values[0]?.expressionSequence[0],
259
+ );
260
+ }
261
+ } catch (error) {
262
+ this.editorStore.applicationStore.logService.error(
263
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.SERVICE_TEST_SETUP_FAILURE),
264
+ error,
265
+ );
266
+ }
267
+ }
268
+ return [];
269
+ }
270
+
271
+ getBindingWithParamRecursively(expression: ValueSpecification | undefined): {
272
+ binding: Binding;
273
+ param: string;
274
+ }[] {
275
+ let currentExpression = expression;
276
+ const res: {
277
+ binding: Binding;
278
+ param: string;
279
+ }[] = [];
280
+ // use if statement to safely scan service query without breaking the app
281
+ while (currentExpression instanceof SimpleFunctionExpression) {
282
+ if (
283
+ matchFunctionName(
284
+ currentExpression.functionName,
285
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.INTERNALIZE,
286
+ ) ||
287
+ matchFunctionName(
288
+ currentExpression.functionName,
289
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_RUNTIME_WITH_MODEL_QUERY_CONNECTION,
290
+ )
291
+ ) {
292
+ if (currentExpression.parametersValues[1] instanceof InstanceValue) {
293
+ if (
294
+ currentExpression.parametersValues[1].values[0] instanceof
295
+ PackageableElementImplicitReference<Binding> &&
296
+ currentExpression.parametersValues[2] instanceof VariableExpression
297
+ ) {
298
+ res.push({
299
+ binding: currentExpression.parametersValues[1].values[0]
300
+ .value as Binding,
301
+ param: currentExpression.parametersValues[2].name,
302
+ });
303
+ }
304
+ }
305
+ currentExpression = currentExpression.parametersValues[1];
306
+ } else if (
307
+ matchFunctionName(
308
+ currentExpression.functionName,
309
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.FROM,
310
+ )
311
+ ) {
312
+ currentExpression = currentExpression.parametersValues[2];
313
+ } else if (
314
+ matchFunctionName(
315
+ currentExpression.functionName,
316
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.MERGERUNTIMES,
317
+ )
318
+ ) {
319
+ const collection = currentExpression.parametersValues[0];
320
+ if (collection instanceof CollectionInstanceValue) {
321
+ collection.values
322
+ .map((v) => this.getBindingWithParamRecursively(v))
323
+ .flat()
324
+ .map((p) => res.push(p));
325
+ }
326
+ currentExpression = collection;
327
+ } else {
328
+ currentExpression = getNullableFirstEntry(
329
+ currentExpression.parametersValues,
330
+ );
331
+ }
332
+ }
333
+ return res;
334
+ }
335
+
224
336
  addServiceTestAssertKeys(val: string[]): void {
225
337
  service_addAssertKeyForTest(this.testState.test, val);
226
338
  }
@@ -63,7 +63,7 @@ export class ProjectConfigurationEditorState extends EditorState {
63
63
  projects = new Map<string, StoreProjectData>();
64
64
  versions = new Map<string, string[]>();
65
65
  latestProjectStructureVersion: ProjectStructureVersion | undefined;
66
-
66
+ manualOverwrite = false;
67
67
  associatedProjectsAndVersionsFetched = false;
68
68
 
69
69
  constructor(editorStore: EditorStore, sdlcState: EditorSDLCState) {
@@ -75,6 +75,7 @@ export class ProjectConfigurationEditorState extends EditorState {
75
75
  projectConfiguration: observable,
76
76
  selectedTab: observable,
77
77
  isReadOnly: observable,
78
+ manualOverwrite: observable,
78
79
  projects: observable,
79
80
  versions: observable,
80
81
  associatedProjectsAndVersionsFetched: observable,
@@ -88,6 +89,7 @@ export class ProjectConfigurationEditorState extends EditorState {
88
89
  setOriginalProjectConfiguration: action,
89
90
  setProjectConfiguration: action,
90
91
  setSelectedTab: action,
92
+ setManualOverwrite: action,
91
93
  fectchAssociatedProjectsAndVersions: flow,
92
94
  updateProjectConfiguration: flow,
93
95
  updateToLatestStructure: flow,
@@ -118,6 +120,10 @@ export class ProjectConfigurationEditorState extends EditorState {
118
120
  this.selectedTab = tab;
119
121
  }
120
122
 
123
+ setManualOverwrite(value: boolean): void {
124
+ this.manualOverwrite = value;
125
+ }
126
+
121
127
  get label(): string {
122
128
  return 'config';
123
129
  }
@@ -47,6 +47,7 @@ import {
47
47
  generateFunctionPrettyName,
48
48
  getElementRootPackage,
49
49
  extractDependencyGACoordinateFromRootPackageName,
50
+ generateDependencyRootPackageName,
50
51
  } from '@finos/legend-graph';
51
52
  import { ExplorerTreeRootPackageLabel } from '../ExplorerTreeState.js';
52
53
 
@@ -229,8 +230,12 @@ export const getDependenciesPackableElementTreeData = (
229
230
  const dependencyGACoordinates =
230
231
  extractDependencyGACoordinateFromRootPackageName(_package.name) ??
231
232
  _package.name;
232
- childRootNode.label = dependencyGACoordinates;
233
- childRootNode.id = dependencyGACoordinates;
233
+ childRootNode.label = generateDependencyRootPackageName(
234
+ dependencyGACoordinates,
235
+ );
236
+ childRootNode.id = generateDependencyRootPackageName(
237
+ dependencyGACoordinates,
238
+ );
234
239
  addUniqueEntry(rootIds, childRootNode.id);
235
240
  nodes.set(childRootNode.id, childRootNode);
236
241
  root.children.push(_package);