@finos/legend-graph 31.4.2 → 31.5.1
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/BasicModel.d.ts.map +1 -1
- package/lib/graph/BasicModel.js +6 -1
- package/lib/graph/BasicModel.js.map +1 -1
- package/lib/graph/Core_HashUtils.d.ts +4 -0
- package/lib/graph/Core_HashUtils.d.ts.map +1 -1
- package/lib/graph/Core_HashUtils.js +5 -0
- package/lib/graph/Core_HashUtils.js.map +1 -1
- package/lib/graph/MetaModelConst.d.ts +2 -1
- package/lib/graph/MetaModelConst.d.ts.map +1 -1
- package/lib/graph/MetaModelConst.js +1 -0
- package/lib/graph/MetaModelConst.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.d.ts +4 -1
- package/lib/graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js +2 -0
- package/lib/graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.d.ts +26 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.d.ts.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.js +31 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.js.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.d.ts +32 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.d.ts.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.js +46 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.js.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.d.ts +22 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.d.ts.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.js +31 -0
- package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.js.map +1 -0
- package/lib/graph-manager/action/changeDetection/DomainObserverHelper.d.ts +7 -1
- package/lib/graph-manager/action/changeDetection/DomainObserverHelper.d.ts.map +1 -1
- package/lib/graph-manager/action/changeDetection/DomainObserverHelper.js +34 -1
- package/lib/graph-manager/action/changeDetection/DomainObserverHelper.js.map +1 -1
- package/lib/graph-manager/action/changeDetection/PackageableElementObserver.js +1 -1
- package/lib/graph-manager/action/changeDetection/PackageableElementObserver.js.map +1 -1
- package/lib/graph-manager/action/changeDetection/Testable_ObserverHelper.d.ts.map +1 -1
- package/lib/graph-manager/action/changeDetection/Testable_ObserverHelper.js +5 -0
- package/lib/graph-manager/action/changeDetection/Testable_ObserverHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/V1_ConcreteFunctionDefinition.d.ts +2 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/V1_ConcreteFunctionDefinition.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/V1_ConcreteFunctionDefinition.js +2 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/V1_ConcreteFunctionDefinition.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionStoreTestData.d.ts +24 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionStoreTestData.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionStoreTestData.js +31 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionStoreTestData.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.d.ts +32 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.js +46 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTestSuite.d.ts +22 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTestSuite.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTestSuite.js +31 -0
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTestSuite.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DomainTransformer.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DomainTransformer.js +44 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DomainTransformer.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js +4 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DomainBuilderHelper.d.ts +3 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DomainBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DomainBuilderHelper.js +43 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DomainBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js +33 -33
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RuntimeBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RuntimeBuilderHelper.js +0 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RuntimeBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PackageableElementSerialization.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PackageableElementSerialization.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.d.ts +19 -17
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.js +4 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_FunctionSeriaizationHelper.d.ts +23 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_FunctionSeriaizationHelper.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_FunctionSeriaizationHelper.js +47 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_FunctionSeriaizationHelper.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TestSerializationHelper.d.ts +2 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TestSerializationHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TestSerializationHelper.js +14 -0
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TestSerializationHelper.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/graph/BasicModel.ts +6 -1
- package/src/graph/Core_HashUtils.ts +6 -0
- package/src/graph/MetaModelConst.ts +1 -0
- package/src/graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.ts +5 -1
- package/src/graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.ts +36 -0
- package/src/graph/metamodel/pure/packageableElements/function/test/FunctionTest.ts +52 -0
- package/src/graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.ts +34 -0
- package/src/graph-manager/action/changeDetection/DomainObserverHelper.ts +56 -4
- package/src/graph-manager/action/changeDetection/PackageableElementObserver.ts +1 -1
- package/src/graph-manager/action/changeDetection/Testable_ObserverHelper.ts +4 -0
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/function/V1_ConcreteFunctionDefinition.ts +3 -0
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionStoreTestData.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.ts +53 -0
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTestSuite.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DomainTransformer.ts +59 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.ts +6 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DomainBuilderHelper.ts +68 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.ts +36 -40
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_RuntimeBuilderHelper.ts +0 -5
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PackageableElementSerialization.ts +2 -2
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.ts +17 -5
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_FunctionSeriaizationHelper.ts +100 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TestSerializationHelper.ts +15 -0
- package/src/index.ts +3 -1
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
|
18
|
+
import { AtomicTest } from '../../../test/Test.js';
|
|
19
|
+
import {
|
|
20
|
+
CORE_HASH_STRUCTURE,
|
|
21
|
+
hashObjectWithoutSourceInformation,
|
|
22
|
+
} from '../../../../../Core_HashUtils.js';
|
|
23
|
+
|
|
24
|
+
export class FunctionParameterValue implements Hashable {
|
|
25
|
+
name!: string;
|
|
26
|
+
/**
|
|
27
|
+
* Studio does not process value specification, they are left in raw JSON form
|
|
28
|
+
*
|
|
29
|
+
* @discrepancy model
|
|
30
|
+
*/
|
|
31
|
+
value!: object;
|
|
32
|
+
|
|
33
|
+
get hashCode(): string {
|
|
34
|
+
return hashArray([
|
|
35
|
+
CORE_HASH_STRUCTURE.FUNCTION_PARAMETER_VALUE,
|
|
36
|
+
this.name,
|
|
37
|
+
hashObjectWithoutSourceInformation(this.value),
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class FunctionTest extends AtomicTest implements Hashable {
|
|
43
|
+
parameters: FunctionParameterValue[] | undefined;
|
|
44
|
+
get hashCode(): string {
|
|
45
|
+
return hashArray([
|
|
46
|
+
CORE_HASH_STRUCTURE.FUNCTION_TEST,
|
|
47
|
+
this.id,
|
|
48
|
+
this.doc ?? '',
|
|
49
|
+
this.parameters ? hashArray(this.parameters) : '',
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashArray } from '@finos/legend-shared';
|
|
18
|
+
import { TestSuite } from '../../../test/Test.js';
|
|
19
|
+
import type { FunctionStoreTestData } from './FunctionStoreTestData.js';
|
|
20
|
+
import { CORE_HASH_STRUCTURE } from '../../../../../Core_HashUtils.js';
|
|
21
|
+
|
|
22
|
+
export class FunctionTestSuite extends TestSuite {
|
|
23
|
+
testData: FunctionStoreTestData[] | undefined;
|
|
24
|
+
|
|
25
|
+
override get hashCode(): string {
|
|
26
|
+
return hashArray([
|
|
27
|
+
CORE_HASH_STRUCTURE.FUNCTION_TEST_SUITE,
|
|
28
|
+
this.id,
|
|
29
|
+
this.doc ?? '',
|
|
30
|
+
this.testData ? hashArray(this.testData) : '',
|
|
31
|
+
hashArray(this.tests),
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -68,6 +68,14 @@ import {
|
|
|
68
68
|
import type { INTERNAL__UnknownFunctionActivator } from '../../../graph/metamodel/pure/packageableElements/function/INTERNAL__UnknownFunctionActivator.js';
|
|
69
69
|
import type { SnowflakeApp } from '../../../graph/metamodel/pure/packageableElements/function/SnowflakeApp.js';
|
|
70
70
|
import { observe_SnowflakeAppDeploymentConfiguration } from './DSL_FunctionActivatorObserverHelper.js';
|
|
71
|
+
import type { FunctionTest } from '../../../graph/metamodel/pure/packageableElements/function/test/FunctionTest.js';
|
|
72
|
+
import type { FunctionTestSuite } from '../../../graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.js';
|
|
73
|
+
import {
|
|
74
|
+
observe_AtomicTest,
|
|
75
|
+
observe_TestAssertion,
|
|
76
|
+
} from './Testable_ObserverHelper.js';
|
|
77
|
+
import type { FunctionStoreTestData } from '../../../graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.js';
|
|
78
|
+
import { observe_EmbeddedData } from './DSL_Data_ObserverHelper.js';
|
|
71
79
|
|
|
72
80
|
const _observe_Abstract_Package = (metamodel: Package): void => {
|
|
73
81
|
observe_Abstract_PackageableElement(metamodel);
|
|
@@ -83,7 +91,7 @@ const _observe_Abstract_Package = (metamodel: Package): void => {
|
|
|
83
91
|
* and observe all descendents.
|
|
84
92
|
*/
|
|
85
93
|
export const observe_Package = skipObservedWithContext(
|
|
86
|
-
(metamodel: Package, context): Package => {
|
|
94
|
+
(metamodel: Package, context: ObserverContext): Package => {
|
|
87
95
|
_observe_Abstract_Package(metamodel);
|
|
88
96
|
|
|
89
97
|
metamodel.children.forEach((child) => {
|
|
@@ -453,8 +461,52 @@ export const observe_Association = skipObserved(
|
|
|
453
461
|
|
|
454
462
|
// ------------------------------------- Function -------------------------------------
|
|
455
463
|
|
|
456
|
-
export const
|
|
457
|
-
(metamodel:
|
|
464
|
+
export const observe_FunctionTest = skipObserved(
|
|
465
|
+
(metamodel: FunctionTest): FunctionTest => {
|
|
466
|
+
makeObservable(metamodel, {
|
|
467
|
+
id: observable,
|
|
468
|
+
doc: observable,
|
|
469
|
+
assertions: observable,
|
|
470
|
+
hashCode: computed,
|
|
471
|
+
});
|
|
472
|
+
metamodel.assertions.forEach(observe_TestAssertion);
|
|
473
|
+
return metamodel;
|
|
474
|
+
},
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
export const observe_FunctionTestData = skipObservedWithContext(
|
|
478
|
+
(metamodel: FunctionStoreTestData, context: ObserverContext) => {
|
|
479
|
+
makeObservable(metamodel, {
|
|
480
|
+
store: observable,
|
|
481
|
+
data: observable,
|
|
482
|
+
hashCode: computed,
|
|
483
|
+
});
|
|
484
|
+
observe_EmbeddedData(metamodel.data, context);
|
|
485
|
+
return metamodel;
|
|
486
|
+
},
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
export const observe_FunctionTestSuite = skipObservedWithContext(
|
|
490
|
+
(
|
|
491
|
+
metamodel: FunctionTestSuite,
|
|
492
|
+
context: ObserverContext,
|
|
493
|
+
): FunctionTestSuite => {
|
|
494
|
+
makeObservable(metamodel, {
|
|
495
|
+
id: observable,
|
|
496
|
+
tests: observable,
|
|
497
|
+
testData: observable,
|
|
498
|
+
hashCode: computed,
|
|
499
|
+
});
|
|
500
|
+
metamodel.tests.forEach((t) => observe_AtomicTest(t, context));
|
|
501
|
+
metamodel.testData?.forEach((t) => observe_FunctionTestData(t, context));
|
|
502
|
+
return metamodel;
|
|
503
|
+
},
|
|
504
|
+
);
|
|
505
|
+
export const observe_ConcreteFunctionDefinition = skipObservedWithContext(
|
|
506
|
+
(
|
|
507
|
+
metamodel: ConcreteFunctionDefinition,
|
|
508
|
+
context: ObserverContext,
|
|
509
|
+
): ConcreteFunctionDefinition => {
|
|
458
510
|
observe_Abstract_PackageableElement(metamodel);
|
|
459
511
|
|
|
460
512
|
makeObservable<ConcreteFunctionDefinition, '_elementHashCode'>(metamodel, {
|
|
@@ -471,7 +523,7 @@ export const observe_ConcreteFunctionDefinition = skipObserved(
|
|
|
471
523
|
observe_PackageableElementReference(metamodel.returnType);
|
|
472
524
|
metamodel.stereotypes.forEach(observe_StereotypeReference);
|
|
473
525
|
metamodel.taggedValues.forEach(observe_TaggedValue);
|
|
474
|
-
|
|
526
|
+
metamodel.tests.forEach((t) => observe_FunctionTestSuite(t, context));
|
|
475
527
|
return metamodel;
|
|
476
528
|
},
|
|
477
529
|
);
|
|
@@ -146,7 +146,7 @@ class PackageableElementObserver implements PackageableElementVisitor<void> {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
visit_ConcreteFunctionDefinition(element: ConcreteFunctionDefinition): void {
|
|
149
|
-
observe_ConcreteFunctionDefinition(element);
|
|
149
|
+
observe_ConcreteFunctionDefinition(element, this.observerContext);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
visit_FlatData(element: FlatData): void {
|
|
@@ -38,6 +38,8 @@ import {
|
|
|
38
38
|
observe_ServiceTest,
|
|
39
39
|
observe_ServiceTestSuite,
|
|
40
40
|
} from './DSL_Service_ObserverHelper.js';
|
|
41
|
+
import { FunctionTest } from '../../../graph/metamodel/pure/packageableElements/function/test/FunctionTest.js';
|
|
42
|
+
import { observe_FunctionTest } from './DomainObserverHelper.js';
|
|
41
43
|
|
|
42
44
|
export const observe_EqualTo = skipObserved((metamodel: EqualTo): EqualTo => {
|
|
43
45
|
makeObservable(metamodel, {
|
|
@@ -83,6 +85,8 @@ export function observe_AtomicTest(
|
|
|
83
85
|
return observe_ServiceTest(metamodel);
|
|
84
86
|
} else if (metamodel instanceof MappingTest) {
|
|
85
87
|
return observe_MappingTest(metamodel, context);
|
|
88
|
+
} else if (metamodel instanceof FunctionTest) {
|
|
89
|
+
return observe_FunctionTest(metamodel);
|
|
86
90
|
}
|
|
87
91
|
const extraAtomicTestBuilder = context.plugins.flatMap(
|
|
88
92
|
(plugin) =>
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type V1_PackageableElementVisitor,
|
|
28
28
|
V1_PackageableElement,
|
|
29
29
|
} from '../../../model/packageableElements/V1_PackageableElement.js';
|
|
30
|
+
import type { V1_FunctionTestSuite } from './test/V1_FunctionTestSuite.js';
|
|
30
31
|
|
|
31
32
|
export class V1_ConcreteFunctionDefinition extends V1_PackageableElement {
|
|
32
33
|
/**
|
|
@@ -57,6 +58,7 @@ export class V1_ConcreteFunctionDefinition extends V1_PackageableElement {
|
|
|
57
58
|
returnMultiplicity!: V1_Multiplicity;
|
|
58
59
|
taggedValues: V1_TaggedValue[] = [];
|
|
59
60
|
stereotypes: V1_StereotypePtr[] = [];
|
|
61
|
+
tests: V1_FunctionTestSuite[] | undefined;
|
|
60
62
|
|
|
61
63
|
override get hashCode(): string {
|
|
62
64
|
return hashArray([
|
|
@@ -67,6 +69,7 @@ export class V1_ConcreteFunctionDefinition extends V1_PackageableElement {
|
|
|
67
69
|
hashArray(this.taggedValues),
|
|
68
70
|
hashArray(this.stereotypes),
|
|
69
71
|
hashRawLambda(undefined, this.body),
|
|
72
|
+
this.tests ? hashArray(this.tests) : '',
|
|
70
73
|
]);
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
|
18
|
+
import type { V1_EmbeddedData } from '../../../data/V1_EmbeddedData.js';
|
|
19
|
+
import { CORE_HASH_STRUCTURE } from '../../../../../../../../graph/Core_HashUtils.js';
|
|
20
|
+
|
|
21
|
+
export class V1_FunctionStoreTestData implements Hashable {
|
|
22
|
+
doc: string | undefined;
|
|
23
|
+
store!: string;
|
|
24
|
+
data!: V1_EmbeddedData;
|
|
25
|
+
|
|
26
|
+
get hashCode(): string {
|
|
27
|
+
return hashArray([
|
|
28
|
+
CORE_HASH_STRUCTURE.FUNCTION_STORE_TEST_DATA,
|
|
29
|
+
this.doc ?? '',
|
|
30
|
+
this.store,
|
|
31
|
+
this.data,
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
|
18
|
+
import { V1_AtomicTest } from '../../../test/V1_AtomicTest.js';
|
|
19
|
+
import {
|
|
20
|
+
CORE_HASH_STRUCTURE,
|
|
21
|
+
hashObjectWithoutSourceInformation,
|
|
22
|
+
} from '../../../../../../../../graph/Core_HashUtils.js';
|
|
23
|
+
|
|
24
|
+
export class V1_FunctionParameterValue implements Hashable {
|
|
25
|
+
name!: string;
|
|
26
|
+
/**
|
|
27
|
+
* Studio does not process value specification, they are left in raw JSON form
|
|
28
|
+
*
|
|
29
|
+
* @discrepancy model
|
|
30
|
+
*/
|
|
31
|
+
value!: object;
|
|
32
|
+
|
|
33
|
+
get hashCode(): string {
|
|
34
|
+
return hashArray([
|
|
35
|
+
CORE_HASH_STRUCTURE.FUNCTION_PARAMETER_VALUE,
|
|
36
|
+
this.name,
|
|
37
|
+
hashObjectWithoutSourceInformation(this.value),
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class V1_FunctionTest extends V1_AtomicTest {
|
|
43
|
+
parameters: V1_FunctionParameterValue[] | undefined;
|
|
44
|
+
|
|
45
|
+
get hashCode(): string {
|
|
46
|
+
return hashArray([
|
|
47
|
+
CORE_HASH_STRUCTURE.FUNCTION_TEST,
|
|
48
|
+
this.id,
|
|
49
|
+
this.doc ?? '',
|
|
50
|
+
this.parameters ? hashArray(this.parameters) : '',
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashArray } from '@finos/legend-shared';
|
|
18
|
+
import { V1_TestSuite } from '../../../test/V1_TestSuite.js';
|
|
19
|
+
import { CORE_HASH_STRUCTURE } from '../../../../../../../../graph/Core_HashUtils.js';
|
|
20
|
+
import type { V1_FunctionStoreTestData } from './V1_FunctionStoreTestData.js';
|
|
21
|
+
|
|
22
|
+
export class V1_FunctionTestSuite extends V1_TestSuite {
|
|
23
|
+
testData: V1_FunctionStoreTestData[] | undefined;
|
|
24
|
+
|
|
25
|
+
override get hashCode(): string {
|
|
26
|
+
return hashArray([
|
|
27
|
+
CORE_HASH_STRUCTURE.FUNCTION_TEST_SUITE,
|
|
28
|
+
this.id,
|
|
29
|
+
this.doc ?? '',
|
|
30
|
+
this.testData ? hashArray(this.testData) : '',
|
|
31
|
+
hashArray(this.tests),
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DomainTransformer.ts
CHANGED
|
@@ -54,6 +54,17 @@ import { V1_DerivedProperty } from '../../../model/packageableElements/domain/V1
|
|
|
54
54
|
import type { V1_RawVariable } from '../../../model/rawValueSpecification/V1_RawVariable.js';
|
|
55
55
|
import type { V1_GraphTransformerContext } from './V1_GraphTransformerContext.js';
|
|
56
56
|
import { isStubbed_RawLambda } from '../../../../../../../graph/helpers/creator/RawValueSpecificationCreatorHelper.js';
|
|
57
|
+
import type { FunctionTestSuite } from '../../../../../../../graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.js';
|
|
58
|
+
import { V1_FunctionTestSuite } from '../../../model/packageableElements/function/test/V1_FunctionTestSuite.js';
|
|
59
|
+
import { FunctionTest } from '../../../../../../../graph/metamodel/pure/packageableElements/function/test/FunctionTest.js';
|
|
60
|
+
import {
|
|
61
|
+
V1_FunctionParameterValue,
|
|
62
|
+
V1_FunctionTest,
|
|
63
|
+
} from '../../../model/packageableElements/function/test/V1_FunctionTest.js';
|
|
64
|
+
import { UnsupportedOperationError } from '@finos/legend-shared';
|
|
65
|
+
import { V1_FunctionStoreTestData } from '../../../model/packageableElements/function/test/V1_FunctionStoreTestData.js';
|
|
66
|
+
import { V1_transformEmbeddedData } from './V1_DataElementTransformer.js';
|
|
67
|
+
import { V1_transformTestAssertion } from './V1_TestTransformer.js';
|
|
57
68
|
|
|
58
69
|
export const V1_transformProfile = (element: Profile): V1_Profile => {
|
|
59
70
|
const profile = new V1_Profile();
|
|
@@ -224,6 +235,49 @@ export const V1_transformAssociation = (
|
|
|
224
235
|
return association;
|
|
225
236
|
};
|
|
226
237
|
|
|
238
|
+
const V1_transformFunctionTest = (element: FunctionTest): V1_FunctionTest => {
|
|
239
|
+
const functionTest = new V1_FunctionTest();
|
|
240
|
+
functionTest.id = element.id;
|
|
241
|
+
functionTest.doc = element.doc;
|
|
242
|
+
functionTest.assertions = element.assertions.map((assertion) =>
|
|
243
|
+
V1_transformTestAssertion(assertion),
|
|
244
|
+
);
|
|
245
|
+
functionTest.parameters = element.parameters?.map((p) => {
|
|
246
|
+
const parameterValue = new V1_FunctionParameterValue();
|
|
247
|
+
parameterValue.name = p.name;
|
|
248
|
+
parameterValue.value = p.value;
|
|
249
|
+
return parameterValue;
|
|
250
|
+
});
|
|
251
|
+
return functionTest;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const V1_transformFunctionSuite = (
|
|
255
|
+
element: FunctionTestSuite,
|
|
256
|
+
context: V1_GraphTransformerContext,
|
|
257
|
+
): V1_FunctionTestSuite => {
|
|
258
|
+
const testSuite = new V1_FunctionTestSuite();
|
|
259
|
+
testSuite.id = element.id;
|
|
260
|
+
testSuite.doc = element.doc;
|
|
261
|
+
if (element.testData?.length) {
|
|
262
|
+
testSuite.testData = element.testData.map((elementData) => {
|
|
263
|
+
const pTestData = new V1_FunctionStoreTestData();
|
|
264
|
+
pTestData.doc = elementData.doc;
|
|
265
|
+
pTestData.store = elementData.store.valueForSerialization ?? '';
|
|
266
|
+
pTestData.data = V1_transformEmbeddedData(elementData.data, context);
|
|
267
|
+
return pTestData;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
testSuite.tests = element.tests.map((el) => {
|
|
271
|
+
if (el instanceof FunctionTest) {
|
|
272
|
+
return V1_transformFunctionTest(el);
|
|
273
|
+
}
|
|
274
|
+
throw new UnsupportedOperationError(
|
|
275
|
+
'Unsupported function test to transform',
|
|
276
|
+
);
|
|
277
|
+
});
|
|
278
|
+
return testSuite;
|
|
279
|
+
};
|
|
280
|
+
|
|
227
281
|
export const V1_transformFunction = (
|
|
228
282
|
element: ConcreteFunctionDefinition,
|
|
229
283
|
context: V1_GraphTransformerContext,
|
|
@@ -243,5 +297,10 @@ export const V1_transformFunction = (
|
|
|
243
297
|
_function.returnMultiplicity = V1_transformMultiplicity(
|
|
244
298
|
element.returnMultiplicity,
|
|
245
299
|
);
|
|
300
|
+
if (element.tests.length) {
|
|
301
|
+
_function.tests = element.tests.map((suite) =>
|
|
302
|
+
V1_transformFunctionSuite(suite, context),
|
|
303
|
+
);
|
|
304
|
+
}
|
|
246
305
|
return _function;
|
|
247
306
|
};
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
V1_buildVariable,
|
|
51
51
|
V1_buildUnit,
|
|
52
52
|
V1_buildTaggedValue,
|
|
53
|
+
V1_buildFunctionSuite,
|
|
53
54
|
} from './helpers/V1_DomainBuilderHelper.js';
|
|
54
55
|
import {
|
|
55
56
|
V1_buildServiceExecution,
|
|
@@ -322,6 +323,11 @@ export class V1_ElementSecondPassBuilder
|
|
|
322
323
|
);
|
|
323
324
|
func.expressionSequence = protocol.body;
|
|
324
325
|
func.functionName = getFunctionName(func, func.name);
|
|
326
|
+
if (protocol.tests?.length) {
|
|
327
|
+
func.tests = protocol.tests.map((l) =>
|
|
328
|
+
V1_buildFunctionSuite(l, this.context),
|
|
329
|
+
);
|
|
330
|
+
}
|
|
325
331
|
}
|
|
326
332
|
|
|
327
333
|
visit_FlatData(element: V1_FlatData): void {
|
|
@@ -58,6 +58,18 @@ import {
|
|
|
58
58
|
} from '../../../../../../../../graph/helpers/DomainHelper.js';
|
|
59
59
|
import { AggregationKind } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/AggregationKind.js';
|
|
60
60
|
import { GraphBuilderError } from '../../../../../../../GraphManagerUtils.js';
|
|
61
|
+
import type { V1_FunctionTestSuite } from '../../../../model/packageableElements/function/test/V1_FunctionTestSuite.js';
|
|
62
|
+
import { FunctionTestSuite } from '../../../../../../../../graph/metamodel/pure/packageableElements/function/test/FunctionTestSuite.js';
|
|
63
|
+
import type { V1_FunctionStoreTestData } from '../../../../model/packageableElements/function/test/V1_FunctionStoreTestData.js';
|
|
64
|
+
import { FunctionStoreTestData } from '../../../../../../../../graph/metamodel/pure/packageableElements/function/test/FunctionStoreTestData.js';
|
|
65
|
+
import { V1_buildEmbeddedData } from './V1_DataElementBuilderHelper.js';
|
|
66
|
+
import { V1_FunctionTest } from '../../../../model/packageableElements/function/test/V1_FunctionTest.js';
|
|
67
|
+
import {
|
|
68
|
+
FunctionParameterValue,
|
|
69
|
+
FunctionTest,
|
|
70
|
+
} from '../../../../../../../../graph/metamodel/pure/packageableElements/function/test/FunctionTest.js';
|
|
71
|
+
import { V1_buildTestAssertion } from './V1_TestBuilderHelper.js';
|
|
72
|
+
import type { TestSuite } from '../../../../../../../../graph/metamodel/pure/test/Test.js';
|
|
61
73
|
|
|
62
74
|
export const V1_buildTaggedValue = (
|
|
63
75
|
taggedValue: V1_TaggedValue,
|
|
@@ -335,3 +347,59 @@ export const V1_getAppliedProperty = (
|
|
|
335
347
|
`Property '${name}' not found in class '${parentClass.path}'`,
|
|
336
348
|
);
|
|
337
349
|
};
|
|
350
|
+
|
|
351
|
+
// Function Suite
|
|
352
|
+
const V1_buildFunctionTest = (
|
|
353
|
+
element: V1_FunctionTest,
|
|
354
|
+
parentSuite: TestSuite,
|
|
355
|
+
context: V1_GraphBuilderContext,
|
|
356
|
+
): FunctionTest => {
|
|
357
|
+
const functionTest = new FunctionTest();
|
|
358
|
+
functionTest.id = element.id;
|
|
359
|
+
functionTest.__parent = parentSuite;
|
|
360
|
+
functionTest.doc = element.doc;
|
|
361
|
+
functionTest.assertions = element.assertions.map((assertion) =>
|
|
362
|
+
V1_buildTestAssertion(assertion, functionTest, context),
|
|
363
|
+
);
|
|
364
|
+
functionTest.parameters = element.parameters?.map((param) => {
|
|
365
|
+
const parameterValue = new FunctionParameterValue();
|
|
366
|
+
parameterValue.name = param.name;
|
|
367
|
+
parameterValue.value = param.value;
|
|
368
|
+
return parameterValue;
|
|
369
|
+
});
|
|
370
|
+
return functionTest;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const V1_buildFunctionStoreTestData = (
|
|
374
|
+
element: V1_FunctionStoreTestData,
|
|
375
|
+
context: V1_GraphBuilderContext,
|
|
376
|
+
): FunctionStoreTestData => {
|
|
377
|
+
const storeTestData = new FunctionStoreTestData();
|
|
378
|
+
storeTestData.doc = element.doc;
|
|
379
|
+
storeTestData.store = context.resolveStore(element.store);
|
|
380
|
+
storeTestData.data = V1_buildEmbeddedData(element.data, context);
|
|
381
|
+
return storeTestData;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
export const V1_buildFunctionSuite = (
|
|
385
|
+
element: V1_FunctionTestSuite,
|
|
386
|
+
context: V1_GraphBuilderContext,
|
|
387
|
+
): FunctionTestSuite => {
|
|
388
|
+
const functionSuite = new FunctionTestSuite();
|
|
389
|
+
functionSuite.id = element.id;
|
|
390
|
+
functionSuite.doc = element.doc;
|
|
391
|
+
if (element.testData?.length) {
|
|
392
|
+
functionSuite.testData = element.testData.map((e) =>
|
|
393
|
+
V1_buildFunctionStoreTestData(e, context),
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
functionSuite.tests = element.tests.map((test) => {
|
|
397
|
+
if (test instanceof V1_FunctionTest) {
|
|
398
|
+
return V1_buildFunctionTest(test, functionSuite, context);
|
|
399
|
+
}
|
|
400
|
+
throw new UnsupportedOperationError(
|
|
401
|
+
'Unable to build function test: Unsupported function test type',
|
|
402
|
+
);
|
|
403
|
+
});
|
|
404
|
+
return functionSuite;
|
|
405
|
+
};
|