@finos/legend-graph 22.2.5 → 22.2.6
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.
- package/lib/graph/metamodel/pure/packageableElements/domain/Association.d.ts +7 -0
- package/lib/graph/metamodel/pure/packageableElements/domain/Association.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/domain/Association.js +22 -1
- package/lib/graph/metamodel/pure/packageableElements/domain/Association.js.map +1 -1
- package/lib/package.json +3 -3
- package/package.json +6 -6
- package/src/graph/metamodel/pure/packageableElements/domain/Association.ts +34 -1
|
@@ -46,6 +46,13 @@ export declare class Association extends PackageableElement implements Hashable
|
|
|
46
46
|
properties: [Property, Property];
|
|
47
47
|
derivedProperties: DerivedProperty[];
|
|
48
48
|
constructor(name: string);
|
|
49
|
+
/**
|
|
50
|
+
* Make sure we clean up the properties added to classes through
|
|
51
|
+
* this association
|
|
52
|
+
*
|
|
53
|
+
* @internal model logic
|
|
54
|
+
*/
|
|
55
|
+
dispose(): void;
|
|
49
56
|
protected get _elementHashCode(): string;
|
|
50
57
|
accept_PackageableElementVisitor<T>(visitor: PackageableElementVisitor<T>): T;
|
|
51
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Association.d.ts","sourceRoot":"","sources":["../../../../../../src/graph/metamodel/pure/packageableElements/domain/Association.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Association.d.ts","sourceRoot":"","sources":["../../../../../../src/graph/metamodel/pure/packageableElements/domain/Association.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,QAAQ,EAId,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,yBAAyB,EAC9B,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAY,SAAQ,kBAAmB,YAAW,QAAQ;IACrE;;;;;OAKG;IACH,8BAA8B,EAAE,gBAAgB,EAAE,CAAM;IAExD,UAAU,EAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClC,iBAAiB,EAAE,eAAe,EAAE,CAAM;gBAE9B,IAAI,EAAE,MAAM;IAaxB;;;;;OAKG;IACM,OAAO,IAAI,IAAI;IAqBxB,cAAuB,gBAAgB,IAAI,MAAM,CAShD;IAED,gCAAgC,CAAC,CAAC,EAChC,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACpC,CAAC;CAGL"}
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { hashArray } from '@finos/legend-shared';
|
|
16
|
+
import { hashArray, guaranteeType, } from '@finos/legend-shared';
|
|
17
17
|
import { CORE_HASH_STRUCTURE } from '../../../../../graph/Core_HashUtils.js';
|
|
18
18
|
import { PackageableElement, } from '../PackageableElement.js';
|
|
19
19
|
import { stub_Class, stub_Property, } from '../../../../../graph/helpers/creator/DomainModelCreatorHelper.js';
|
|
20
|
+
import { Class } from './Class.js';
|
|
20
21
|
/**
|
|
21
22
|
* Assocation needs exactly 2 properties (for 2 classes, not enumeration, not primitive), e.g.
|
|
22
23
|
* employees: Person[*]
|
|
@@ -55,6 +56,26 @@ export class Association extends PackageableElement {
|
|
|
55
56
|
properties[1]._OWNER = this;
|
|
56
57
|
this.properties = properties;
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Make sure we clean up the properties added to classes through
|
|
61
|
+
* this association
|
|
62
|
+
*
|
|
63
|
+
* @internal model logic
|
|
64
|
+
*/
|
|
65
|
+
dispose() {
|
|
66
|
+
super.dispose();
|
|
67
|
+
// cleanup property classes' properties which were added through this association
|
|
68
|
+
const [propertyA, propertyB] = this.properties;
|
|
69
|
+
if (propertyA.genericType.value.rawType instanceof Class &&
|
|
70
|
+
propertyB.genericType.value.rawType instanceof Class) {
|
|
71
|
+
const classA = guaranteeType(propertyA.genericType.value.rawType, Class);
|
|
72
|
+
const classB = guaranteeType(propertyB.genericType.value.rawType, Class);
|
|
73
|
+
classA.propertiesFromAssociations =
|
|
74
|
+
classA.propertiesFromAssociations.filter((property) => property !== propertyB);
|
|
75
|
+
classB.propertiesFromAssociations =
|
|
76
|
+
classB.propertiesFromAssociations.filter((property) => property !== propertyA);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
58
79
|
get _elementHashCode() {
|
|
59
80
|
return hashArray([
|
|
60
81
|
CORE_HASH_STRUCTURE.ASSOCIATION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Association.js","sourceRoot":"","sources":["../../../../../../src/graph/metamodel/pure/packageableElements/domain/Association.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Association.js","sourceRoot":"","sources":["../../../../../../src/graph/metamodel/pure/packageableElements/domain/Association.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,SAAS,EACT,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAEL,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,UAAU,EACV,aAAa,GACd,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,WAAY,SAAQ,kBAAkB;IACjD;;;;;OAKG;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AC;SACL;IACH,CAAC;IAED,IAAuB,gBAAgB;QACrC,OAAO,SAAS,CAAC;YACf,mBAAmB,CAAC,WAAW;YAC/B,IAAI,CAAC,IAAI;YACT,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1B,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC;YACjC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC7D,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,gCAAgC,CAC9B,OAAqC;QAErC,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-graph",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.6",
|
|
4
4
|
"description": "Legend graph and graph manager",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@finos/legend-shared": "workspace:*",
|
|
43
43
|
"@finos/legend-storage": "workspace:*",
|
|
44
|
-
"mobx": "6.
|
|
44
|
+
"mobx": "6.8.0",
|
|
45
45
|
"mobx-react-lite": "3.4.0",
|
|
46
46
|
"react": "18.2.0",
|
|
47
47
|
"serializr": "3.0.2"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@finos/legend-dev-utils": "workspace:*",
|
|
51
51
|
"@jest/globals": "29.4.2",
|
|
52
52
|
"cross-env": "7.0.3",
|
|
53
|
-
"eslint": "8.
|
|
53
|
+
"eslint": "8.34.0",
|
|
54
54
|
"jest": "29.4.2",
|
|
55
55
|
"npm-run-all": "4.1.5",
|
|
56
56
|
"rimraf": "4.1.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-graph",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.6",
|
|
4
4
|
"description": "Legend graph and graph manager",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"test:watch": "jest --watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@finos/legend-shared": "6.2.
|
|
43
|
-
"@finos/legend-storage": "3.0.
|
|
44
|
-
"mobx": "6.
|
|
42
|
+
"@finos/legend-shared": "6.2.18",
|
|
43
|
+
"@finos/legend-storage": "3.0.33",
|
|
44
|
+
"mobx": "6.8.0",
|
|
45
45
|
"mobx-react-lite": "3.4.0",
|
|
46
46
|
"react": "18.2.0",
|
|
47
47
|
"serializr": "3.0.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@finos/legend-dev-utils": "2.0.
|
|
50
|
+
"@finos/legend-dev-utils": "2.0.41",
|
|
51
51
|
"@jest/globals": "29.4.2",
|
|
52
52
|
"cross-env": "7.0.3",
|
|
53
|
-
"eslint": "8.
|
|
53
|
+
"eslint": "8.34.0",
|
|
54
54
|
"jest": "29.4.2",
|
|
55
55
|
"npm-run-all": "4.1.5",
|
|
56
56
|
"rimraf": "4.1.2",
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
type Hashable,
|
|
19
|
+
type Writable,
|
|
20
|
+
hashArray,
|
|
21
|
+
guaranteeType,
|
|
22
|
+
} from '@finos/legend-shared';
|
|
18
23
|
import { CORE_HASH_STRUCTURE } from '../../../../../graph/Core_HashUtils.js';
|
|
19
24
|
import {
|
|
20
25
|
type PackageableElementVisitor,
|
|
@@ -27,6 +32,7 @@ import {
|
|
|
27
32
|
stub_Class,
|
|
28
33
|
stub_Property,
|
|
29
34
|
} from '../../../../../graph/helpers/creator/DomainModelCreatorHelper.js';
|
|
35
|
+
import { Class } from './Class.js';
|
|
30
36
|
|
|
31
37
|
/**
|
|
32
38
|
* Assocation needs exactly 2 properties (for 2 classes, not enumeration, not primitive), e.g.
|
|
@@ -70,6 +76,33 @@ export class Association extends PackageableElement implements Hashable {
|
|
|
70
76
|
this.properties = properties;
|
|
71
77
|
}
|
|
72
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Make sure we clean up the properties added to classes through
|
|
81
|
+
* this association
|
|
82
|
+
*
|
|
83
|
+
* @internal model logic
|
|
84
|
+
*/
|
|
85
|
+
override dispose(): void {
|
|
86
|
+
super.dispose();
|
|
87
|
+
// cleanup property classes' properties which were added through this association
|
|
88
|
+
const [propertyA, propertyB] = this.properties;
|
|
89
|
+
if (
|
|
90
|
+
propertyA.genericType.value.rawType instanceof Class &&
|
|
91
|
+
propertyB.genericType.value.rawType instanceof Class
|
|
92
|
+
) {
|
|
93
|
+
const classA = guaranteeType(propertyA.genericType.value.rawType, Class);
|
|
94
|
+
const classB = guaranteeType(propertyB.genericType.value.rawType, Class);
|
|
95
|
+
classA.propertiesFromAssociations =
|
|
96
|
+
classA.propertiesFromAssociations.filter(
|
|
97
|
+
(property) => property !== propertyB,
|
|
98
|
+
);
|
|
99
|
+
classB.propertiesFromAssociations =
|
|
100
|
+
classB.propertiesFromAssociations.filter(
|
|
101
|
+
(property) => property !== propertyA,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
73
106
|
protected override get _elementHashCode(): string {
|
|
74
107
|
return hashArray([
|
|
75
108
|
CORE_HASH_STRUCTURE.ASSOCIATION,
|