@finos/legend-application-studio 26.1.11 → 27.0.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 (49) hide show
  1. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  2. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +6 -6
  3. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  4. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  5. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +9 -3
  6. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  7. package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
  8. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +15 -14
  9. package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
  10. package/lib/index.css +1 -1
  11. package/lib/package.json +4 -4
  12. package/lib/stores/LegendStudioApplicationPlugin.d.ts +7 -7
  13. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  14. package/lib/stores/LegendStudioApplicationPlugin.js.map +1 -1
  15. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  16. package/lib/stores/editor/GraphEditFormModeState.js +0 -1
  17. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  18. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  19. package/lib/stores/editor/NewElementState.js +5 -3
  20. package/lib/stores/editor/NewElementState.js.map +1 -1
  21. package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js +1 -1
  22. package/lib/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.js.map +1 -1
  23. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  24. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -1
  25. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  26. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts +1 -1
  27. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts.map +1 -1
  28. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js +2 -2
  29. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js.map +1 -1
  30. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +1 -1
  31. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  32. package/lib/stores/editor/utils/MockDataUtils.d.ts +1 -1
  33. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  34. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  35. package/lib/stores/editor/utils/PackageTreeUtils.js +3 -3
  36. package/lib/stores/editor/utils/PackageTreeUtils.js.map +1 -1
  37. package/package.json +14 -14
  38. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +6 -10
  39. package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +13 -5
  40. package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +21 -23
  41. package/src/stores/LegendStudioApplicationPlugin.ts +7 -11
  42. package/src/stores/editor/GraphEditFormModeState.ts +0 -1
  43. package/src/stores/editor/NewElementState.ts +6 -3
  44. package/src/stores/editor/editor-state/element-editor-state/service/ServicePostValidationState.ts +1 -1
  45. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -2
  46. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts +2 -2
  47. package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +1 -1
  48. package/src/stores/editor/utils/MockDataUtils.ts +1 -1
  49. package/src/stores/editor/utils/PackageTreeUtils.ts +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-studio",
3
- "version": "26.1.11",
3
+ "version": "27.0.0",
4
4
  "description": "Legend Studio application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -45,18 +45,18 @@
45
45
  "test:watch": "jest --watch"
46
46
  },
47
47
  "dependencies": {
48
- "@finos/legend-application": "15.0.23",
49
- "@finos/legend-art": "7.0.23",
50
- "@finos/legend-graph": "30.0.8",
51
- "@finos/legend-lego": "1.0.21",
52
- "@finos/legend-query-builder": "4.0.12",
53
- "@finos/legend-server-depot": "6.0.15",
54
- "@finos/legend-server-sdlc": "5.0.16",
55
- "@finos/legend-shared": "10.0.14",
56
- "@finos/legend-storage": "3.0.64",
48
+ "@finos/legend-application": "15.0.24",
49
+ "@finos/legend-art": "7.0.24",
50
+ "@finos/legend-graph": "30.0.9",
51
+ "@finos/legend-lego": "1.1.0",
52
+ "@finos/legend-query-builder": "4.0.13",
53
+ "@finos/legend-server-depot": "6.0.16",
54
+ "@finos/legend-server-sdlc": "5.0.17",
55
+ "@finos/legend-shared": "10.0.15",
56
+ "@finos/legend-storage": "3.0.65",
57
57
  "@testing-library/react": "14.0.0",
58
- "@types/react": "18.2.12",
59
- "@types/react-dom": "18.2.5",
58
+ "@types/react": "18.2.13",
59
+ "@types/react-dom": "18.2.6",
60
60
  "fast-xml-parser": "4.2.4",
61
61
  "mobx": "6.9.0",
62
62
  "mobx-react-lite": "3.4.3",
@@ -70,10 +70,10 @@
70
70
  "yaml": "2.3.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@finos/legend-dev-utils": "2.0.68",
73
+ "@finos/legend-dev-utils": "2.0.69",
74
74
  "@jest/globals": "29.5.0",
75
75
  "cross-env": "7.0.3",
76
- "eslint": "8.42.0",
76
+ "eslint": "8.43.0",
77
77
  "jest": "29.5.0",
78
78
  "npm-run-all": "4.1.5",
79
79
  "rimraf": "5.0.1",
@@ -118,16 +118,12 @@ const ProjectDependencyActions = observer(
118
118
  dependencyEditorState.dependencyReport?.conflicts.length;
119
119
  const viewTree = (): void => {
120
120
  if (dependencyEditorState.dependencyReport) {
121
- dependencyEditorState.setDependencyReport(
122
- DEPENDENCY_REPORT_TAB.EXPLORER,
123
- );
121
+ dependencyEditorState.setReportTab(DEPENDENCY_REPORT_TAB.EXPLORER);
124
122
  }
125
123
  };
126
124
  const viewConflict = (): void => {
127
125
  if (dependencyEditorState.dependencyReport) {
128
- dependencyEditorState.setDependencyReport(
129
- DEPENDENCY_REPORT_TAB.CONFLICTS,
130
- );
126
+ dependencyEditorState.setReportTab(DEPENDENCY_REPORT_TAB.CONFLICTS);
131
127
  }
132
128
  };
133
129
  return (
@@ -604,17 +600,17 @@ const ProjectDependencyReportModal = observer(
604
600
  const changeTab =
605
601
  (tab: DEPENDENCY_REPORT_TAB): (() => void) =>
606
602
  (): void =>
607
- dependencyEditorState.setDependencyReport(tab);
603
+ dependencyEditorState.setReportTab(tab);
608
604
  const dependencyReport = dependencyEditorState.dependencyReport;
609
605
  const closeModal = (): void =>
610
- dependencyEditorState.setDependencyReport(undefined);
606
+ dependencyEditorState.setReportTab(undefined);
611
607
  const [flattenView, setFlattenView] = useState(false);
612
608
  const [isExpandingDependencies, setIsExpandingDependencies] =
613
609
  useState(false);
614
610
  const setTreeData = (
615
- treeData: TreeData<ProjectDependencyTreeNodeData>,
611
+ val: TreeData<ProjectDependencyTreeNodeData>,
616
612
  ): void => {
617
- dependencyEditorState.setTreeData(treeData, flattenView);
613
+ dependencyEditorState.setTreeData(val, flattenView);
618
614
  };
619
615
  const toggleViewAsListOrAsTree = (): void => {
620
616
  setFlattenView(!flattenView);
@@ -225,6 +225,14 @@ const ServiceTestParameterEditor = observer(
225
225
  const type = bindingParamPair
226
226
  ? bindingParamPair.binding.contentType
227
227
  : paramState.varExpression.genericType?.value.rawType.name ?? 'unknown';
228
+ const paramValue = (
229
+ paramState.varExpression.genericType?.value.rawType === PrimitiveType.BYTE
230
+ ? atob(
231
+ (paramState.valueSpec as PrimitiveInstanceValue)
232
+ .values[0] as string,
233
+ )
234
+ : (paramState.valueSpec as PrimitiveInstanceValue).values[0]
235
+ ) as string;
228
236
 
229
237
  const openInPopUp = (): void => setShowPopUp(!showPopUp);
230
238
  const closePopUp = (): void => setShowPopUp(false);
@@ -232,7 +240,10 @@ const ServiceTestParameterEditor = observer(
232
240
  if (paramState.valueSpec instanceof PrimitiveInstanceValue) {
233
241
  instanceValue_setValue(
234
242
  paramState.valueSpec,
235
- val,
243
+ paramState.varExpression.genericType?.value.rawType ===
244
+ PrimitiveType.BYTE
245
+ ? btoa(val)
246
+ : val,
236
247
  0,
237
248
  setupState.editorStore.changeDetectionState.observerContext,
238
249
  );
@@ -261,10 +272,7 @@ const ServiceTestParameterEditor = observer(
261
272
  <textarea
262
273
  className="panel__content__form__section__textarea value-spec-editor__input"
263
274
  spellCheck={false}
264
- value={
265
- (paramState.valueSpec as PrimitiveInstanceValue)
266
- .values[0] as string
267
- }
275
+ value={paramValue}
268
276
  placeholder={
269
277
  ((paramState.valueSpec as PrimitiveInstanceValue)
270
278
  .values[0] as string) === ''
@@ -54,7 +54,6 @@ import {
54
54
  type GeneratorFn,
55
55
  isNonNullable,
56
56
  prettyCONSTName,
57
- toTitleCase,
58
57
  } from '@finos/legend-shared';
59
58
  import { observer } from 'mobx-react-lite';
60
59
  import { forwardRef, useEffect, useState } from 'react';
@@ -429,23 +428,28 @@ export const GlobalTestRunner = observer(
429
428
  const editorStore = useEditorStore();
430
429
  const globalTestRunnerState = props.globalTestRunnerState;
431
430
  const isDispatchingAction = globalTestRunnerState.isDispatchingAction;
432
- const testRunnerTabs = (Object.values(TEST_RUNNER_TABS) as string[])
433
- .concat(
434
- editorStore.pluginManager
435
- .getApplicationPlugins()
436
- .flatMap(
437
- (plugin) => plugin.getExtraTestRunnerTabClassifiers?.() ?? [],
438
- ),
439
- )
440
- .map((e) => ({
441
- value: e,
442
- label: prettyCONSTName(e),
443
- }));
444
431
 
445
432
  const [selectedTab, setSelectedTab] = useState(
446
433
  TEST_RUNNER_TABS.TEST_RUNNER.valueOf(),
447
434
  );
448
435
 
436
+ const extractTestRunnerTabConfigurations = editorStore.pluginManager
437
+ .getApplicationPlugins()
438
+ .flatMap((plugin) => plugin.getExtraTestRunnerTabConfigurations?.() ?? [])
439
+ .filter((configuration) => configuration.renderer(editorStore));
440
+
441
+ const testRunnerTabs = (Object.values(TEST_RUNNER_TABS) as string[])
442
+ .map((e) => ({
443
+ value: e,
444
+ label: prettyCONSTName(e),
445
+ }))
446
+ .concat(
447
+ extractTestRunnerTabConfigurations.map((config) => ({
448
+ value: config.key,
449
+ label: config.title,
450
+ })),
451
+ );
452
+
449
453
  const changeTab = (tab: string): void => {
450
454
  setSelectedTab(tab);
451
455
  };
@@ -544,7 +548,7 @@ export const GlobalTestRunner = observer(
544
548
  ['panel__header__tab--active']: tab.value === selectedTab,
545
549
  })}
546
550
  >
547
- {toTitleCase(prettyCONSTName(tab.value))}
551
+ {tab.label}
548
552
  </div>
549
553
  ))}
550
554
  </div>
@@ -578,15 +582,9 @@ export const GlobalTestRunner = observer(
578
582
  </div>
579
583
  );
580
584
  } else {
581
- const extraTestRunnerTabEditorRenderers = editorStore.pluginManager
582
- .getApplicationPlugins()
583
- .flatMap(
584
- (plugin) => plugin.getExtraTestRunnerTabEditorRenderers?.() ?? [],
585
- );
586
- for (const editorRenderer of extraTestRunnerTabEditorRenderers) {
587
- const editor = editorRenderer(selectedTab, editorStore);
588
- if (editor) {
589
- return editor;
585
+ for (const testRunnerTabConfiguration of extractTestRunnerTabConfigurations) {
586
+ if (testRunnerTabConfiguration.key === selectedTab) {
587
+ return testRunnerTabConfiguration.renderer(editorStore);
590
588
  }
591
589
  }
592
590
  return (
@@ -77,10 +77,11 @@ export type TestableMetadataGetter = (
77
77
  editorStore: EditorStore,
78
78
  ) => TestableMetadata | undefined;
79
79
 
80
- export type TestRunnerTabRenderer = (
81
- selectedTab: string,
82
- editorStore: EditorStore,
83
- ) => React.ReactNode | undefined;
80
+ export type TestRunnerTabConfiguration = {
81
+ key: string;
82
+ title: string;
83
+ renderer: (editorStore: EditorStore) => React.ReactNode | undefined;
84
+ };
84
85
 
85
86
  export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlugin {
86
87
  /**
@@ -126,14 +127,9 @@ export abstract class LegendStudioApplicationPlugin extends LegendApplicationPlu
126
127
  getExtraTestableMetadata?(): TestableMetadataGetter[];
127
128
 
128
129
  /**
129
- * Get the list of the supported classifers for test runner tabs.
130
- */
131
- getExtraTestRunnerTabClassifiers?(): string[];
132
-
133
- /**
134
- * Get the list of renderers for the editor for a test runner tab.
130
+ * Get the list of configurations for the editor for a test runner tab.
135
131
  */
136
- getExtraTestRunnerTabEditorRenderers?(): TestRunnerTabRenderer[];
132
+ getExtraTestRunnerTabConfigurations?(): TestRunnerTabConfiguration[];
137
133
  }
138
134
 
139
135
  export type PureGrammarElementLabeler = (
@@ -578,7 +578,6 @@ export class GraphEditFormModeState extends GraphEditorMode {
578
578
 
579
579
  *onLeave(): GeneratorFn<void> {
580
580
  this.editorStore.sqlPlaygroundState.setConnection(undefined);
581
- return;
582
581
  }
583
582
 
584
583
  *cleanupBeforeEntering(fallbackOptions?: {
@@ -66,7 +66,6 @@ import {
66
66
  PackageableElementExplicitReference,
67
67
  RelationalDatabaseConnection,
68
68
  DatabaseType,
69
- StaticDatasourceSpecification,
70
69
  DefaultH2AuthenticationStrategy,
71
70
  ModelGenerationSpecification,
72
71
  DataElement,
@@ -74,6 +73,7 @@ import {
74
73
  Measure,
75
74
  Multiplicity,
76
75
  PrimitiveType,
76
+ LocalH2DatasourceSpecification,
77
77
  } from '@finos/legend-graph';
78
78
  import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
79
79
  import {
@@ -302,6 +302,8 @@ export class NewFlatDataConnectionDriver extends NewConnectionValueDriver<FlatDa
302
302
  }
303
303
  }
304
304
 
305
+ const DEFAULT_H2_SQL =
306
+ '-- loads sample data for getting started. See https://github.com/pthom/northwind_psql for more info\n call loadNorthwindData()';
305
307
  export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDriver<RelationalDatabaseConnection> {
306
308
  constructor(editorStore: EditorStore) {
307
309
  super(editorStore);
@@ -327,10 +329,12 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
327
329
  const dbs = this.editorStore.graphManagerState.usableDatabases;
328
330
  selectedStore = dbs.length ? (dbs[0] as Database) : stub_Database();
329
331
  }
332
+ const spec = new LocalH2DatasourceSpecification();
333
+ spec.testDataSetupSqls = [DEFAULT_H2_SQL];
330
334
  return new RelationalDatabaseConnection(
331
335
  PackageableElementExplicitReference.create(selectedStore),
332
336
  DatabaseType.H2,
333
- new StaticDatasourceSpecification('dummyHost', 80, 'myDb'),
337
+ spec,
334
338
  new DefaultH2AuthenticationStrategy(),
335
339
  );
336
340
  }
@@ -440,7 +444,6 @@ export class NewPackageableConnectionDriver extends NewElementDriver<Packageable
440
444
  this.store = store;
441
445
  this.newConnectionValueDriver = newDriver;
442
446
  }
443
- return;
444
447
  }
445
448
 
446
449
  get isValid(): boolean {
@@ -411,7 +411,7 @@ export class PostValidationState {
411
411
  );
412
412
  serviceValidation_deleteAssertion(this.validation, assertion);
413
413
  this.assertionStates = this.assertionStates.filter(
414
- (e) => !(e === _assertionState),
414
+ (e) => e !== _assertionState,
415
415
  );
416
416
  }
417
417
  }
@@ -254,10 +254,20 @@ export class ServiceTestSetupState {
254
254
  ),
255
255
  this.editorStore.graphManagerState.graph,
256
256
  );
257
-
258
257
  if (valueSpec instanceof LambdaFunctionInstanceValue) {
259
258
  return this.getBindingWithParamRecursively(
260
- valueSpec.values[0]?.expressionSequence[0],
259
+ valueSpec.values[0]?.expressionSequence.find(
260
+ (exp) =>
261
+ exp instanceof SimpleFunctionExpression &&
262
+ (matchFunctionName(
263
+ exp.functionName,
264
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.SERIALIZE,
265
+ ) ||
266
+ matchFunctionName(
267
+ exp.functionName,
268
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.EXTERNALIZE,
269
+ )),
270
+ ),
261
271
  );
262
272
  }
263
273
  } catch (error) {
@@ -316,7 +316,7 @@ export class ProjectDependencyEditorState {
316
316
  reportTab: observable,
317
317
  expandConflictsState: observable,
318
318
  buildConflictPathState: observable,
319
- setDependencyReport: action,
319
+ setReportTab: action,
320
320
  expandAllConflicts: action,
321
321
  setFlattenDependencyTreeData: action,
322
322
  clearTrees: action,
@@ -356,7 +356,7 @@ export class ProjectDependencyEditorState {
356
356
  }
357
357
  }
358
358
 
359
- setDependencyReport(tab: DEPENDENCY_REPORT_TAB | undefined): void {
359
+ setReportTab(tab: DEPENDENCY_REPORT_TAB | undefined): void {
360
360
  this.reportTab = tab;
361
361
  }
362
362
 
@@ -152,7 +152,7 @@ export class GlobalBulkServiceRegistrationState {
152
152
  }
153
153
 
154
154
  setSelectAll(val: boolean): void {
155
- this.bulkServiceRegistrationStates.map(
155
+ this.bulkServiceRegistrationStates.forEach(
156
156
  (serviceRegistrationState) => (serviceRegistrationState.isSelected = val),
157
157
  );
158
158
  }
@@ -242,7 +242,7 @@ export const getPrimitiveTypeFromRelationalType = (
242
242
  export const createMockDataForColumn = (
243
243
  col: Column,
244
244
  isPrimaryKey: boolean,
245
- idx?: number | number,
245
+ idx?: number | undefined,
246
246
  ): string | undefined => {
247
247
  const type = col.type;
248
248
 
@@ -367,7 +367,7 @@ export const openNode = (
367
367
  let currentElement: PackageableElement | undefined = element;
368
368
  let openingNode: PackageTreeNodeData | undefined;
369
369
  while (currentElement.package) {
370
- const node: PackageTreeNodeData =
370
+ const currentNode: PackageTreeNodeData =
371
371
  treeData.nodes.get(currentElement.path) ??
372
372
  addNode(
373
373
  editorStore,
@@ -376,8 +376,8 @@ export const openNode = (
376
376
  childFilter,
377
377
  isDependencyElement,
378
378
  );
379
- node.isOpen = currentElement instanceof Package;
380
- openingNode = !openingNode ? node : openingNode;
379
+ currentNode.isOpen = currentElement instanceof Package;
380
+ openingNode = !openingNode ? currentNode : openingNode;
381
381
  currentElement = currentElement.package;
382
382
  }
383
383
  // Open the dependency root