@finos/legend-graph 22.2.4 → 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/graphManager/action/validation/DSL_Service_ValidationHelper.js +3 -3
- package/lib/graphManager/action/validation/DSL_Service_ValidationHelper.js.map +1 -1
- package/lib/package.json +5 -5
- package/package.json +8 -8
- package/src/graph/metamodel/pure/packageableElements/domain/Association.ts +34 -1
- package/src/graphManager/action/validation/DSL_Service_ValidationHelper.ts +3 -3
|
@@ -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,CAA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,CAAC;YACJ,MAAM,CAAC,0BAA0B;gBAC/B,MAAM,CAAC,0BAA0B,CAAC,MAAM,CACtC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,CACrC,CAAC;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"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { addUniqueEntry } from '@finos/legend-shared';
|
|
16
|
+
import { addUniqueEntry, URL_SEPARATOR } from '@finos/legend-shared';
|
|
17
17
|
import { isStubbed_PackageableElement } from '../../../graph/helpers/creator/DomainModelCreatorHelper.js';
|
|
18
18
|
import { isStubbed_RawLambda } from '../../../graph/helpers/creator/RawValueSpecificationCreatorHelper.js';
|
|
19
19
|
import { createValidationError, } from './ValidationHelper.js';
|
|
@@ -22,10 +22,10 @@ export const validate_ServicePattern = (pattern) => {
|
|
|
22
22
|
if (!pattern) {
|
|
23
23
|
addUniqueEntry(errors, 'Pattern must not be empty');
|
|
24
24
|
}
|
|
25
|
-
else if (pattern ===
|
|
25
|
+
else if (pattern === URL_SEPARATOR) {
|
|
26
26
|
addUniqueEntry(errors, `Pattern must not be '/'`);
|
|
27
27
|
}
|
|
28
|
-
else if (!pattern.startsWith(
|
|
28
|
+
else if (!pattern.startsWith(URL_SEPARATOR)) {
|
|
29
29
|
addUniqueEntry(errors, `Pattern must start with a '/'`);
|
|
30
30
|
}
|
|
31
31
|
// TODO: potentially do more validation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSL_Service_ValidationHelper.js","sourceRoot":"","sources":["../../../../src/graphManager/action/validation/DSL_Service_ValidationHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"DSL_Service_ValidationHelper.js","sourceRoot":"","sources":["../../../../src/graphManager/action/validation/DSL_Service_ValidationHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAC3G,OAAO,EAEL,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAe,EACc,EAAE;IAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE;QACZ,cAAc,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;KACrD;SAAM,IAAI,OAAO,KAAK,aAAa,EAAE;QACpC,cAAc,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;KACnD;SAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QAC7C,cAAc,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC;KACzD;IACD,uCAAuC;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,SAAwB,EACK,EAAE;IAC/B,IAAI,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QACvC,OAAO,qBAAqB,CAAC;YAC3B,4CAA4C;SAC7C,CAAC,CAAC;KACJ;IACD,iHAAiH;IACjH,wCAAwC;IACxC,8EAA8E;IAC9E,IAAI;IACJ,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAAgB,EACa,EAAE,CAC/B,4BAA4B,CAAC,OAAO,CAAC;IACnC,CAAC,CAAC,qBAAqB,CAAC,CAAC,2CAA2C,CAAC,CAAC;IACtE,CAAC,CAAC,SAAS,CAAC"}
|
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,17 +41,17 @@
|
|
|
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"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@finos/legend-dev-utils": "workspace:*",
|
|
51
|
-
"@jest/globals": "29.4.
|
|
51
|
+
"@jest/globals": "29.4.2",
|
|
52
52
|
"cross-env": "7.0.3",
|
|
53
|
-
"eslint": "8.
|
|
54
|
-
"jest": "29.4.
|
|
53
|
+
"eslint": "8.34.0",
|
|
54
|
+
"jest": "29.4.2",
|
|
55
55
|
"npm-run-all": "4.1.5",
|
|
56
56
|
"rimraf": "4.1.2",
|
|
57
57
|
"typescript": "4.9.5"
|
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,19 +39,19 @@
|
|
|
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.
|
|
51
|
-
"@jest/globals": "29.4.
|
|
50
|
+
"@finos/legend-dev-utils": "2.0.41",
|
|
51
|
+
"@jest/globals": "29.4.2",
|
|
52
52
|
"cross-env": "7.0.3",
|
|
53
|
-
"eslint": "8.
|
|
54
|
-
"jest": "29.4.
|
|
53
|
+
"eslint": "8.34.0",
|
|
54
|
+
"jest": "29.4.2",
|
|
55
55
|
"npm-run-all": "4.1.5",
|
|
56
56
|
"rimraf": "4.1.2",
|
|
57
57
|
"typescript": "4.9.5"
|
|
@@ -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,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { addUniqueEntry } from '@finos/legend-shared';
|
|
17
|
+
import { addUniqueEntry, URL_SEPARATOR } from '@finos/legend-shared';
|
|
18
18
|
import type { Mapping } from '../../../graph/metamodel/pure/packageableElements/mapping/Mapping.js';
|
|
19
19
|
import type { PureExecution } from '../../../graph/metamodel/pure/packageableElements/service/ServiceExecution.js';
|
|
20
20
|
import { isStubbed_PackageableElement } from '../../../graph/helpers/creator/DomainModelCreatorHelper.js';
|
|
@@ -30,9 +30,9 @@ export const validate_ServicePattern = (
|
|
|
30
30
|
const errors: string[] = [];
|
|
31
31
|
if (!pattern) {
|
|
32
32
|
addUniqueEntry(errors, 'Pattern must not be empty');
|
|
33
|
-
} else if (pattern ===
|
|
33
|
+
} else if (pattern === URL_SEPARATOR) {
|
|
34
34
|
addUniqueEntry(errors, `Pattern must not be '/'`);
|
|
35
|
-
} else if (!pattern.startsWith(
|
|
35
|
+
} else if (!pattern.startsWith(URL_SEPARATOR)) {
|
|
36
36
|
addUniqueEntry(errors, `Pattern must start with a '/'`);
|
|
37
37
|
}
|
|
38
38
|
// TODO: potentially do more validation
|