Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/big-squids-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
5 changes: 5 additions & 0 deletions .changeset/grumpy-houses-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/eslint-plugin-legend-studio': minor
---

Support `Typscript` [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html), by using `@typescript-eslint/no-redeclare` instead of `no-redeclare`
5 changes: 5 additions & 0 deletions .changeset/light-jobs-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-graph': major
---

**BREAKING CHANGE:** Move logic out of metamodels, such as `Class.getProperty()`, `Database.getSchema()`, etc. and expose them as helper methods.
13 changes: 13 additions & 0 deletions .changeset/mighty-kings-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-dev-utils': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-shared': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
11 changes: 11 additions & 0 deletions .changeset/nine-experts-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
5 changes: 5 additions & 0 deletions .changeset/old-buses-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-graph': major
---

**BREAKING CHANGE:** Remove `Stubable` interface and all stub logic in metamodels, such as `createStub()`, `isStub()`, these methods are now cleaned up and organized in `model creater helpers` which will be exported as utilities from this package.
9 changes: 9 additions & 0 deletions .changeset/perfect-ways-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
8 changes: 8 additions & 0 deletions .changeset/pretty-monkeys-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
11 changes: 11 additions & 0 deletions .changeset/purple-crabs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
11 changes: 11 additions & 0 deletions .changeset/shaggy-goats-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-query': patch
'@finos/legend-studio': patch
'@finos/legend-studio-extension-query-builder': patch
---
5 changes: 5 additions & 0 deletions .changeset/tiny-shrimps-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-graph': major
---

Rename `fullPath` to `path` in `Package`. Where this change really makes a difference is for the root package: previously, `path` was the `name` of the root package element, from now on, `path` will be `empty string`, this makes the handling of root package when constructing element path more consistent.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@
"glob-parent": "^6.0.1"
},
"devDependencies": {
"@actions/core": "1.8.0",
"@actions/github": "5.0.1",
"@actions/core": "1.8.1",
"@actions/github": "5.0.2",
"@babel/core": "7.17.10",
"@changesets/cli": "2.22.0",
"@finos/babel-preset-legend-studio": "workspace:*",
"@finos/eslint-plugin-legend-studio": "workspace:*",
"@finos/legend-dev-utils": "workspace:*",
"@finos/stylelint-config-legend-studio": "workspace:*",
"@types/jest": "27.5.0",
"@types/node": "17.0.31",
"@types/jest": "27.5.1",
"@types/node": "17.0.32",
"chalk": "5.0.1",
"cross-env": "7.0.3",
"envinfo": "7.8.1",
Expand All @@ -108,7 +108,7 @@
"sort-package-json": "1.57.0",
"stylelint": "14.8.2",
"typescript": "4.6.4",
"yargs": "17.4.1"
"yargs": "17.5.0"
},
"packageManager": "yarn@3.2.0",
"engines": {
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const ES_RULES = {
'no-process-exit': ERROR,
'no-proto': ERROR,
'no-prototype-builtins': ERROR,
'no-redeclare': ERROR,
'no-redeclare': OFF,
'no-regex-spaces': ERROR,
'no-return-assign': ERROR,
/**
Expand Down Expand Up @@ -137,6 +137,7 @@ const TYPESCRIPT_RULES = {
],
'@typescript-eslint/func-call-spacing': ERROR,
'@typescript-eslint/no-inferrable-types': [WARN, { ignoreParameters: true }],
'@typescript-eslint/no-redeclare': [ERROR, { ignoreDeclarationMerge: true }],
'@typescript-eslint/no-var-requires': OFF,
'@typescript-eslint/no-unused-vars': [
WARN,
Expand Down
2 changes: 1 addition & 1 deletion packages/legend-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@changesets/write": "0.1.8",
"@juggle/resize-observer": "3.3.1",
"@manypkg/get-packages": "1.1.3",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.6",
"autoprefixer": "10.4.7",
"babel-jest": "28.1.0",
"babel-loader": "8.2.5",
Expand Down
42 changes: 25 additions & 17 deletions packages/legend-extension-dsl-diagram/src/DiagramRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import {
GenericType,
Property,
Multiplicity,
getAllSuperclasses,
getAllOwnClassProperties,
generateMultiplicityString,
getRawGenericType,
} from '@finos/legend-graph';
import { action, makeObservable, observable } from 'mobx';
import type { Diagram } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
Expand Down Expand Up @@ -595,11 +599,11 @@ export class DiagramRenderer {
// Do not allow creating self-inheritance
startClassView.class.value !== targetClassView.class.value &&
// Avoid creating inhertance that already existed
!startClassView.class.value.allSuperclasses.includes(
!getAllSuperclasses(startClassView.class.value).includes(
targetClassView.class.value,
) &&
// Avoid loop (might be expensive)
!targetClassView.class.value.allSuperclasses.includes(
!getAllSuperclasses(targetClassView.class.value).includes(
startClassView.class.value,
)
) {
Expand Down Expand Up @@ -924,7 +928,7 @@ export class DiagramRenderer {
);
}
// Add property view
addedClass.getAllOwnedProperties().forEach((property) => {
getAllOwnClassProperties(addedClass).forEach((property) => {
if (property.genericType.value.rawType === _class) {
diagram_addPropertyView(
this.diagram,
Expand All @@ -938,7 +942,7 @@ export class DiagramRenderer {
);
}
});
_class.getAllOwnedProperties().forEach((property) => {
getAllOwnClassProperties(_class).forEach((property) => {
if (property.genericType.value.rawType === addedClass) {
diagram_addPropertyView(
this.diagram,
Expand Down Expand Up @@ -1394,14 +1398,14 @@ export class DiagramRenderer {
this.ctx.font = `${(this.fontSize - 1) * (measureOnly ? 1 : this.zoom)}px ${
this.fontFamily
}`;
const multiplicityString = generateMultiplicityString(
property.multiplicity.lowerBound,
property.multiplicity.upperBound,
);
if (!measureOnly) {
this.ctx.fillText(
`[${property.multiplicity.str}]`,
propX + txtMeasure,
propY,
);
this.ctx.fillText(`[${multiplicityString}]`, propX + txtMeasure, propY);
}
txtMeasure += this.ctx.measureText(`[${property.multiplicity.str}]`).width;
txtMeasure += this.ctx.measureText(`[${multiplicityString}]`).width;
return txtMeasure;
}

Expand Down Expand Up @@ -1451,7 +1455,7 @@ export class DiagramRenderer {

// Calculate box for properties
if (!classView.hideProperties) {
classView.class.value.getAllOwnedProperties().forEach((property) => {
getAllOwnClassProperties(classView.class.value).forEach((property) => {
if (!this.hasPropertyView(classView, property)) {
const propertyTextMeasure = this.drawClassViewProperty(
classView,
Expand Down Expand Up @@ -1632,7 +1636,7 @@ export class DiagramRenderer {
);
this.ctx.stroke();

for (const property of classView.class.value.getAllOwnedProperties()) {
for (const property of getAllOwnClassProperties(classView.class.value)) {
if (!this.hasPropertyView(classView, property)) {
this.ctx.fillStyle =
property instanceof DerivedProperty
Expand Down Expand Up @@ -1671,8 +1675,12 @@ export class DiagramRenderer {
): PositionedRectangle {
this.ctx.font = `${this.fontSize}px ${this.fontFamily}`;
const propertyName = getPropertyDisplayName(property);
const multiplictyString = generateMultiplicityString(
property.multiplicity.lowerBound,
property.multiplicity.upperBound,
);
const textSize = this.ctx.measureText(propertyName).width;
const mulSize = this.ctx.measureText(property.multiplicity.str).width;
const mulSize = this.ctx.measureText(multiplictyString).width;
this.ctx.font = `${this.fontSize * this.zoom}px ${this.fontFamily}`;
const posX = textPositionX(textSize);
const posY = textPositionY(textSize);
Expand All @@ -1689,7 +1697,7 @@ export class DiagramRenderer {
);
if (!measureOnly) {
this.ctx.fillText(
property.multiplicity.str,
multiplictyString,
multiplicityPosition.x,
multiplicityPosition.y,
);
Expand Down Expand Up @@ -2341,7 +2349,7 @@ export class DiagramRenderer {
else if ('ArrowDown' === e.key) {
const views = uniqBy(
this.selectedClasses.flatMap((x) =>
x.class.value.subclasses.flatMap(
x.class.value._subclasses.flatMap(
(c) =>
new ClassView(
this.diagram,
Expand Down Expand Up @@ -3115,7 +3123,7 @@ export class DiagramRenderer {
cursorY += this.classViewSpaceY;

// Check hover class property
for (const property of _class.getAllOwnedProperties()) {
for (const property of getAllOwnClassProperties(_class)) {
if (!this.hasPropertyView(classView, property)) {
this.ctx.font = `${(this.fontSize - 1) * this.zoom}px ${
this.fontFamily
Expand Down Expand Up @@ -3204,7 +3212,7 @@ export class DiagramRenderer {
diagram,
uuid(),
PackageableElementExplicitReference.create(
generation.value.getRawType(Class),
getRawGenericType(generation.value, Class),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const V1_buildPropertyView = (
getClassView(diagram, guaranteeNonNullable(propertyView.targetView)),
`Property view 'targetView' field is missing`,
);
const property = context.resolveOwnedProperty(propertyView.property);
const property = context.resolveOwnProperty(propertyView.property);
const view = new PropertyView(
diagram,
property,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class DSLText_PureProtocolProcessorPlugin extends PureProtocolProcessorPl
const protocol = new V1_Text();
V1_initPackageableElement(protocol, metamodel);
protocol.name = metamodel.name;
protocol.package = metamodel.package?.fullPath ?? '';
protocol.package = metamodel.package?.path ?? '';
protocol.content = metamodel.content;
protocol.type = metamodel.type;
return protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { type Hashable, hashArray } from '@finos/legend-shared';
import {
InstanceSetImplementation,
type PropertyMapping,
type SetImplementationVisitor,
} from '@finos/legend-graph';
import { SERVICE_STORE_HASH_STRUCTURE } from '../../../../../../../ESService_ModelUtils';
Expand Down Expand Up @@ -45,26 +44,4 @@ export class RootServiceInstanceSetImplementation
accept_SetImplementationVisitor<T>(visitor: SetImplementationVisitor<T>): T {
return visitor.visit_SetImplementation(this);
}

getEmbeddedSetImplmentations(): InstanceSetImplementation[] {
return [];
}

findPropertyMapping(
propertyName: string,
targetId: string | undefined,
): PropertyMapping | undefined {
let properties = undefined;
properties = this.propertyMappings.filter(
(propertyMapping) => propertyMapping.property.value.name === propertyName,
);
if (targetId === undefined || properties.length === 1) {
return properties[0];
}
return properties.find(
(propertyMapping) =>
propertyMapping.targetSetImplementation &&
propertyMapping.targetSetImplementation.id.value === targetId,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class ESService_PureProtocolProcessorPlugin
const protocol = new V1_ServiceStore();
V1_initPackageableElement(protocol, metamodel);
protocol.name = metamodel.name;
protocol.package = metamodel.package?.fullPath ?? '';
protocol.package = metamodel.package?.path ?? '';
protocol.description = metamodel.description;
protocol.elements = metamodel.elements.map((element) =>
V1_transformServiceStoreElement(element, context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ import {
} from '@finos/legend-application';
import type { MappingGenerationEditorState } from '../stores/MappingGenerationEditorState';
import { flowResult, runInAction } from 'mobx';
import { Mapping, createValidationError } from '@finos/legend-graph';
import {
Mapping,
createValidationError,
isStubbed_PackageableElement,
} from '@finos/legend-graph';

const StringEditor = observer(
(props: {
Expand Down Expand Up @@ -295,9 +299,11 @@ const MappingSelectorEditor = observer(
editorStore,
} = props;
// mapping
const isMappingEmpty = selectedMapping?.value.isStub
? createValidationError(['Mapping cannot be empty'])
: undefined;
const isMappingEmpty =
selectedMapping?.value &&
isStubbed_PackageableElement(selectedMapping.value)
? createValidationError(['Mapping cannot be empty'])
: undefined;
const mapping = selectedMapping?.value;
const mappingOptions = editorStore.mappingOptions;
const noMappingLabel = (
Expand Down
1 change: 1 addition & 0 deletions packages/legend-graph/src/DSLMapping_Exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export {
ObjectInputData,
ObjectInputType,
} from './models/metamodels/pure/packageableElements/store/modelToModel/mapping/ObjectInputData';
export { type EmbeddedSetImplementation } from './models/metamodels/pure/packageableElements/mapping/EmbeddedSetImplementation';

// protocols
export {
Expand Down
Loading