@reltio/components 1.4.2210 → 1.4.2212
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/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +2 -1
- package/AttributesErrorsPanel/AttributesErrorsPanel.js +5 -5
- package/AttributesErrorsPanel/components/Error/AttributeErrorItem.d.ts +8 -0
- package/AttributesErrorsPanel/components/Error/{Error.js → AttributeErrorItem.js} +4 -4
- package/AttributesErrorsPanel/components/Error/{Error.test.js → AttributeErrorItem.test.js} +3 -3
- package/AttributesErrorsPanel/components/Error/index.d.ts +1 -1
- package/AttributesErrorsPanel/components/Error/index.js +1 -1
- package/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.d.ts +2 -1
- package/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.js +3 -2
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +2 -1
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.js +4 -4
- package/cjs/AttributesErrorsPanel/components/Error/AttributeErrorItem.d.ts +8 -0
- package/cjs/AttributesErrorsPanel/components/Error/{Error.js → AttributeErrorItem.js} +5 -5
- package/cjs/AttributesErrorsPanel/components/Error/{Error.test.js → AttributeErrorItem.test.js} +3 -3
- package/cjs/AttributesErrorsPanel/components/Error/index.d.ts +1 -1
- package/cjs/AttributesErrorsPanel/components/Error/index.js +3 -3
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.d.ts +2 -1
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.js +3 -2
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +1 -1
- package/cjs/features/workflow/helpers/attributes.js +2 -6
- package/cjs/features/workflow/helpers/attributes.test.js +22 -18
- package/cjs/features/workflow/helpers/merge.test.js +26 -20
- package/cjs/features/workflow/helpers/metadata.test-data.d.ts +1 -1
- package/cjs/features/workflow/helpers/metadata.test-data.js +149 -3
- package/cjs/features/workflow/helpers/validation.js +0 -1
- package/cjs/features/workflow/helpers/validation.test-data.d.ts +14 -0
- package/cjs/features/workflow/helpers/validation.test-data.js +508 -0
- package/cjs/features/workflow/helpers/validation.test.d.ts +1 -0
- package/cjs/features/workflow/helpers/validation.test.js +257 -0
- package/cjs/features/workflow/hooks/useDCRValidation.js +1 -1
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +1 -1
- package/features/workflow/helpers/attributes.js +2 -6
- package/features/workflow/helpers/attributes.test.js +5 -1
- package/features/workflow/helpers/merge.test.js +7 -1
- package/features/workflow/helpers/metadata.test-data.d.ts +1 -1
- package/features/workflow/helpers/metadata.test-data.js +147 -2
- package/features/workflow/helpers/validation.js +0 -1
- package/features/workflow/helpers/validation.test-data.d.ts +14 -0
- package/features/workflow/helpers/validation.test-data.js +498 -0
- package/features/workflow/helpers/validation.test.d.ts +1 -0
- package/features/workflow/helpers/validation.test.js +255 -0
- package/features/workflow/hooks/useDCRValidation.js +1 -1
- package/package.json +2 -2
- package/AttributesErrorsPanel/components/Error/Error.d.ts +0 -7
- package/cjs/AttributesErrorsPanel/components/Error/Error.d.ts +0 -7
- /package/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts} +0 -0
- /package/cjs/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts} +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var validation_1 = require("./validation");
|
|
4
|
+
var metadata_test_data_1 = require("./metadata.test-data");
|
|
5
|
+
var validation_test_data_1 = require("./validation.test-data");
|
|
6
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
|
+
describe('getValidationErrors', function () {
|
|
8
|
+
it('should validate required attributes with user changes', function () {
|
|
9
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
10
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
11
|
+
changes: (0, validation_test_data_1.getChanges)(),
|
|
12
|
+
userChanges: (0, validation_test_data_1.getUserChanges)(),
|
|
13
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
14
|
+
metadata: metadata
|
|
15
|
+
});
|
|
16
|
+
var firstNameAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/FirstName');
|
|
17
|
+
var prescriberIndicatorAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/Boolean');
|
|
18
|
+
var addressAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/Address');
|
|
19
|
+
var internalPostCodeAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/relationTypes/HasAddress/attributes/InternalPostCode');
|
|
20
|
+
var primarySpecialityIndAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd');
|
|
21
|
+
expect(result).toEqual([
|
|
22
|
+
{
|
|
23
|
+
error: {
|
|
24
|
+
type: 'missed',
|
|
25
|
+
attributeType: firstNameAttributeType,
|
|
26
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
27
|
+
parentUri: 'FirstName/2QHFlPPP',
|
|
28
|
+
uri: 'entityUri1/0SBmZIW/newValue',
|
|
29
|
+
message: 'Attribute is required',
|
|
30
|
+
source: 'local',
|
|
31
|
+
path: [
|
|
32
|
+
expect.objectContaining({
|
|
33
|
+
label: '<No label>',
|
|
34
|
+
type: 'attributeValue',
|
|
35
|
+
value: expect.objectContaining({
|
|
36
|
+
uri: 'entities/entityUri1/attributes/FirstName/2QHFlPPP'
|
|
37
|
+
}),
|
|
38
|
+
valueType: firstNameAttributeType
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
lineIds: ['entityUri1/0SBmZIW/newValue']
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
error: {
|
|
46
|
+
type: 'missed',
|
|
47
|
+
attributeType: prescriberIndicatorAttributeType,
|
|
48
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Boolean',
|
|
49
|
+
parentUri: 'Boolean/2DEYFcfk',
|
|
50
|
+
uri: 'entityUri1/0SBmys4/newValue',
|
|
51
|
+
message: 'Attribute is required',
|
|
52
|
+
source: 'local',
|
|
53
|
+
path: [
|
|
54
|
+
expect.objectContaining({
|
|
55
|
+
label: '<No label>',
|
|
56
|
+
type: 'attributeValue',
|
|
57
|
+
value: expect.objectContaining({
|
|
58
|
+
uri: 'entities/entityUri1/attributes/Boolean/2DEYFcfk'
|
|
59
|
+
}),
|
|
60
|
+
valueType: prescriberIndicatorAttributeType
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
lineIds: ['entityUri1/0SBmys4/newValue']
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
error: {
|
|
68
|
+
type: 'missed',
|
|
69
|
+
attributeType: internalPostCodeAttributeType,
|
|
70
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Address/attributes/InternalPostCode',
|
|
71
|
+
parentUri: 'InternalPostCode',
|
|
72
|
+
uri: 'entityUri1/0SBmubo/newValue',
|
|
73
|
+
message: 'Attribute is required',
|
|
74
|
+
source: 'local',
|
|
75
|
+
path: [
|
|
76
|
+
expect.objectContaining({
|
|
77
|
+
label: expect.any(String),
|
|
78
|
+
type: 'attributeValue',
|
|
79
|
+
value: expect.objectContaining({
|
|
80
|
+
uri: 'entities/entityUri1/attributes/Address/0HfPK9G'
|
|
81
|
+
}),
|
|
82
|
+
valueType: addressAttributeType
|
|
83
|
+
}),
|
|
84
|
+
expect.objectContaining({
|
|
85
|
+
label: '<No label>',
|
|
86
|
+
type: 'attributeValue',
|
|
87
|
+
value: expect.objectContaining({
|
|
88
|
+
uri: 'entities/entityUri1/attributes/Address/0HfPK9G/InternalPostCode/2GMCNw4E'
|
|
89
|
+
}),
|
|
90
|
+
valueType: internalPostCodeAttributeType
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
lineIds: ['entityUri1/0SBmubo/newValue']
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
error: {
|
|
98
|
+
type: 'missed',
|
|
99
|
+
attributeType: primarySpecialityIndAttributeType,
|
|
100
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd',
|
|
101
|
+
parentUri: undefined,
|
|
102
|
+
uri: 'entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0',
|
|
103
|
+
message: 'Attribute is required',
|
|
104
|
+
source: 'local',
|
|
105
|
+
path: []
|
|
106
|
+
},
|
|
107
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0']
|
|
108
|
+
}
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
it('should validate required attributes with subnested user changes', function () {
|
|
112
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
113
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
114
|
+
changes: (0, validation_test_data_1.getChanges)(),
|
|
115
|
+
userChanges: (0, validation_test_data_1.getUserChangesRejectSubnestedAttributes)(),
|
|
116
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
117
|
+
metadata: metadata
|
|
118
|
+
});
|
|
119
|
+
var specialitiesAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/Specialities');
|
|
120
|
+
var primarySpecialityIndAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd');
|
|
121
|
+
expect(result).toEqual([
|
|
122
|
+
{
|
|
123
|
+
error: {
|
|
124
|
+
type: 'missed',
|
|
125
|
+
attributeType: primarySpecialityIndAttributeType,
|
|
126
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd',
|
|
127
|
+
parentUri: undefined,
|
|
128
|
+
uri: 'entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0',
|
|
129
|
+
message: 'Attribute is required',
|
|
130
|
+
source: 'local',
|
|
131
|
+
path: []
|
|
132
|
+
},
|
|
133
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0']
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
error: {
|
|
137
|
+
type: 'missed',
|
|
138
|
+
attributeType: specialitiesAttributeType,
|
|
139
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities',
|
|
140
|
+
parentUri: undefined,
|
|
141
|
+
uri: 'entityUri1/0SBn7Oa/newValue',
|
|
142
|
+
message: 'Attribute is required',
|
|
143
|
+
source: 'local',
|
|
144
|
+
path: []
|
|
145
|
+
},
|
|
146
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue']
|
|
147
|
+
}
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
it('should validate required attributes with subnested relation user changes', function () {
|
|
151
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
152
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
153
|
+
changes: (0, validation_test_data_1.getChanges)(),
|
|
154
|
+
userChanges: (0, validation_test_data_1.getUserChangesRejectSubnestedRelationAttributes)(),
|
|
155
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
156
|
+
metadata: metadata
|
|
157
|
+
});
|
|
158
|
+
var refFirstLevelNestedAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr');
|
|
159
|
+
expect(result).toEqual([
|
|
160
|
+
{
|
|
161
|
+
error: {
|
|
162
|
+
type: 'missed',
|
|
163
|
+
attributeType: refFirstLevelNestedAttributeType,
|
|
164
|
+
attributeTypeUri: 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr',
|
|
165
|
+
parentUri: undefined,
|
|
166
|
+
uri: '0pSTmm8/0MCLpVw/newValue/attributes/NestedAttr/0',
|
|
167
|
+
message: 'Attribute is required',
|
|
168
|
+
source: 'local',
|
|
169
|
+
path: []
|
|
170
|
+
},
|
|
171
|
+
lineIds: ['0pSTmm8/0MCLpVw/newValue/attributes/NestedAttr/0']
|
|
172
|
+
}
|
|
173
|
+
]);
|
|
174
|
+
});
|
|
175
|
+
it('should validate required subnested attribute when value is empty', function () {
|
|
176
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
177
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
178
|
+
changes: (0, validation_test_data_1.getChanges)(),
|
|
179
|
+
userChanges: (0, validation_test_data_1.getUserChangesSubnestedEmpty)(),
|
|
180
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
181
|
+
metadata: metadata
|
|
182
|
+
});
|
|
183
|
+
var nestedAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/NestedAttr');
|
|
184
|
+
var intAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/Int');
|
|
185
|
+
expect(result).toEqual([
|
|
186
|
+
{
|
|
187
|
+
error: {
|
|
188
|
+
type: 'missed',
|
|
189
|
+
attributeType: intAttributeType,
|
|
190
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/Int',
|
|
191
|
+
parentUri: 'NestedAttr/2BNyTheu',
|
|
192
|
+
uri: 'entityUri1/0IEmjjX/newValue',
|
|
193
|
+
message: 'Attribute is required',
|
|
194
|
+
source: 'local',
|
|
195
|
+
path: [
|
|
196
|
+
expect.objectContaining({
|
|
197
|
+
label: '<No label>',
|
|
198
|
+
type: 'attributeValue',
|
|
199
|
+
value: expect.objectContaining({
|
|
200
|
+
uri: 'entities/entityUri1/attributes/NestedAttr/2BNyTheu'
|
|
201
|
+
}),
|
|
202
|
+
valueType: nestedAttributeType
|
|
203
|
+
}),
|
|
204
|
+
expect.objectContaining({
|
|
205
|
+
label: '<No label>',
|
|
206
|
+
type: 'attributeValue',
|
|
207
|
+
value: expect.objectContaining({
|
|
208
|
+
uri: 'entities/entityUri1/attributes/NestedAttr/2BNyTheu/Int/2BNyTlvA'
|
|
209
|
+
}),
|
|
210
|
+
valueType: intAttributeType
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
lineIds: ['entityUri1/0IEmjjX/newValue']
|
|
215
|
+
}
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
218
|
+
it('should validate required attributes in new entity', function () {
|
|
219
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
220
|
+
var result = (0, validation_1.getValidationErrors)({
|
|
221
|
+
changes: (0, validation_test_data_1.getChanges)(),
|
|
222
|
+
userChanges: (0, validation_test_data_1.getUserChangesNewEntity)(),
|
|
223
|
+
entitiesOrRelations: (0, validation_test_data_1.getEntitiesOrRelations)(),
|
|
224
|
+
metadata: metadata
|
|
225
|
+
});
|
|
226
|
+
var nameAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCO/attributes/Name');
|
|
227
|
+
var emailAttributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Email');
|
|
228
|
+
expect(result).toEqual([
|
|
229
|
+
{
|
|
230
|
+
error: {
|
|
231
|
+
type: 'missed',
|
|
232
|
+
attributeType: nameAttributeType,
|
|
233
|
+
attributeTypeUri: 'configuration/entityTypes/HCO/attributes/Name',
|
|
234
|
+
parentUri: undefined,
|
|
235
|
+
uri: 'entityUri2/0IEiwoe/newValue/attributes/Name/0',
|
|
236
|
+
message: 'Attribute is required',
|
|
237
|
+
source: 'local',
|
|
238
|
+
path: []
|
|
239
|
+
},
|
|
240
|
+
lineIds: ['entityUri2/0IEiwoe/newValue/attributes/Name/0']
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
error: {
|
|
244
|
+
type: 'missed',
|
|
245
|
+
attributeType: emailAttributeType,
|
|
246
|
+
attributeTypeUri: 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Email',
|
|
247
|
+
parentUri: undefined,
|
|
248
|
+
uri: 'entityUri2/0IEiwoe/newValue/attributes/ContactInfo/0/value/Email/0',
|
|
249
|
+
message: 'Attribute is required',
|
|
250
|
+
source: 'local',
|
|
251
|
+
path: []
|
|
252
|
+
},
|
|
253
|
+
lineIds: ['entityUri2/0IEiwoe/newValue/attributes/ContactInfo/0/value/Email/0']
|
|
254
|
+
}
|
|
255
|
+
]);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
@@ -132,7 +132,7 @@ var useDCRValidation = function (dcr) {
|
|
|
132
132
|
case 3:
|
|
133
133
|
relations = _a;
|
|
134
134
|
loadedRelationsObject = relations.reduce(function (acc, relation) {
|
|
135
|
-
acc[relation.uri] = relation;
|
|
135
|
+
acc[relation === null || relation === void 0 ? void 0 : relation.uri] = relation;
|
|
136
136
|
return acc;
|
|
137
137
|
}, {});
|
|
138
138
|
objectsByUri = __assign(__assign({}, localObjects), loadedRelationsObject);
|
|
@@ -10,5 +10,5 @@ export var DCRErrorsPanel = function () {
|
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
return (React.createElement("div", { className: styles.DCRErrorsPanel },
|
|
13
|
-
React.createElement(AttributesErrorsPanel, { attributesWithErrors: validationErrors })));
|
|
13
|
+
React.createElement(AttributesErrorsPanel, { attributesWithErrors: validationErrors, alwaysShowLink: true })));
|
|
14
14
|
};
|
|
@@ -63,12 +63,8 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
63
63
|
};
|
|
64
64
|
var extractLineIds = function (attributeValue) {
|
|
65
65
|
var _a, _b;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'lineIds' in attributeValue.value.newValue &&
|
|
69
|
-
Array.isArray(attributeValue.value.newValue.lineIds)
|
|
70
|
-
? (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds
|
|
71
|
-
: attributeValue.lineIds;
|
|
66
|
+
var lineIds = (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds;
|
|
67
|
+
return Array.isArray(lineIds) ? lineIds : attributeValue.lineIds;
|
|
72
68
|
};
|
|
73
69
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
74
70
|
var attributeTypeList = getAttributeTypeSubAttributes({}, attributeType);
|
|
@@ -10,10 +10,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { DCRTypes, EntityAttrTypes, DCROperationTypes } from '@reltio/mdm-sdk';
|
|
13
|
-
import {
|
|
13
|
+
import { getMetadata } from './metadata.test-data';
|
|
14
14
|
import { getEntityChanges, getRelationChanges } from './attributes';
|
|
15
15
|
describe('attributes helpers tests', function () {
|
|
16
16
|
it('getEntityChanges behaviour', function () {
|
|
17
|
+
var metadata = getMetadata();
|
|
17
18
|
var objectInfo = {
|
|
18
19
|
isExist: true,
|
|
19
20
|
label: '12345 - Address Line 1 City',
|
|
@@ -139,6 +140,7 @@ describe('attributes helpers tests', function () {
|
|
|
139
140
|
]
|
|
140
141
|
};
|
|
141
142
|
it('should not show operation for relation title', function () {
|
|
143
|
+
var metadata = getMetadata();
|
|
142
144
|
expect(getRelationChanges(metadata, relationInfo, changes, DCRTypes.INSERT_ATTRIBUTE, ['lineIds'])).toEqual([
|
|
143
145
|
{
|
|
144
146
|
attributeType: null,
|
|
@@ -167,6 +169,7 @@ describe('attributes helpers tests', function () {
|
|
|
167
169
|
]);
|
|
168
170
|
});
|
|
169
171
|
it('should show operation for relation title if it is new', function () {
|
|
172
|
+
var metadata = getMetadata();
|
|
170
173
|
expect(getRelationChanges(metadata, relationInfo, changes, DCRTypes.CREATE_RELATIONSHIP, ['lineIds'])).toEqual([
|
|
171
174
|
{
|
|
172
175
|
attributeType: null,
|
|
@@ -196,6 +199,7 @@ describe('attributes helpers tests', function () {
|
|
|
196
199
|
]);
|
|
197
200
|
});
|
|
198
201
|
it('should show operation for relation title if it was deleted and changes are empty', function () {
|
|
202
|
+
var metadata = getMetadata();
|
|
199
203
|
expect(getRelationChanges(metadata, relationInfo, {}, DCRTypes.DELETE_RELATIONSHIP, ['lineIds'])).toEqual([
|
|
200
204
|
{
|
|
201
205
|
attributeType: null,
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { DCRTypes, EntityAttrTypes, DCROperationTypes } from '@reltio/mdm-sdk';
|
|
13
|
-
import {
|
|
13
|
+
import { getMetadata } from './metadata.test-data';
|
|
14
14
|
import { mergeChanges } from './merge';
|
|
15
15
|
describe('mergeChanges tests', function () {
|
|
16
16
|
var entityUri = 'entities/1hRTSKE5';
|
|
@@ -23,6 +23,7 @@ describe('mergeChanges tests', function () {
|
|
|
23
23
|
};
|
|
24
24
|
it('should create path to change', function () {
|
|
25
25
|
var _a;
|
|
26
|
+
var metadata = getMetadata();
|
|
26
27
|
var changes = (_a = {},
|
|
27
28
|
_a[entityUri] = [
|
|
28
29
|
{
|
|
@@ -68,6 +69,7 @@ describe('mergeChanges tests', function () {
|
|
|
68
69
|
});
|
|
69
70
|
it('should merge changes with the same paths', function () {
|
|
70
71
|
var _a;
|
|
72
|
+
var metadata = getMetadata();
|
|
71
73
|
var changes = (_a = {},
|
|
72
74
|
_a[entityUri] = [
|
|
73
75
|
{
|
|
@@ -157,6 +159,7 @@ describe('mergeChanges tests', function () {
|
|
|
157
159
|
});
|
|
158
160
|
it('should not merge changes with the same paths, but different types', function () {
|
|
159
161
|
var _a;
|
|
162
|
+
var metadata = getMetadata();
|
|
160
163
|
var changes = (_a = {},
|
|
161
164
|
_a[entityUri] = [
|
|
162
165
|
{
|
|
@@ -236,6 +239,7 @@ describe('mergeChanges tests', function () {
|
|
|
236
239
|
});
|
|
237
240
|
it('should merge special attributes', function () {
|
|
238
241
|
var _a;
|
|
242
|
+
var metadata = getMetadata();
|
|
239
243
|
var changes = (_a = {},
|
|
240
244
|
_a[entityUri] = [
|
|
241
245
|
{
|
|
@@ -273,6 +277,7 @@ describe('mergeChanges tests', function () {
|
|
|
273
277
|
});
|
|
274
278
|
it('should merge relations', function () {
|
|
275
279
|
var _a;
|
|
280
|
+
var metadata = getMetadata();
|
|
276
281
|
var changes = {
|
|
277
282
|
'relations/1EvCRmwC': [
|
|
278
283
|
{
|
|
@@ -335,6 +340,7 @@ describe('mergeChanges tests', function () {
|
|
|
335
340
|
it('should merge lineIds when multiple changes have the same attributePath', function () {
|
|
336
341
|
var _a;
|
|
337
342
|
var _b, _c;
|
|
343
|
+
var metadata = getMetadata();
|
|
338
344
|
var changes = (_a = {},
|
|
339
345
|
_a[entityUri] = [
|
|
340
346
|
{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Metadata } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getMetadata: () => Metadata;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RelationTypeDirection } from '@reltio/mdm-sdk';
|
|
2
|
-
export var
|
|
2
|
+
export var getMetadata = function () { return ({
|
|
3
3
|
entityTypes: [
|
|
4
4
|
{
|
|
5
5
|
uri: 'configuration/entityTypes/HCA',
|
|
@@ -52,14 +52,125 @@ export var metadata = {
|
|
|
52
52
|
}
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
+
{
|
|
56
|
+
uri: 'configuration/entityTypes/HCP',
|
|
57
|
+
label: 'HCP',
|
|
58
|
+
attributes: [
|
|
59
|
+
{
|
|
60
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
61
|
+
label: 'First Name',
|
|
62
|
+
name: 'FirstName',
|
|
63
|
+
type: 'String',
|
|
64
|
+
required: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
uri: 'configuration/entityTypes/HCP/attributes/Boolean',
|
|
68
|
+
label: 'Boolean',
|
|
69
|
+
name: 'Boolean',
|
|
70
|
+
type: 'Boolean',
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
uri: 'configuration/entityTypes/HCP/attributes/Specialities',
|
|
75
|
+
label: 'Specialities',
|
|
76
|
+
name: 'Specialities',
|
|
77
|
+
type: 'Nested',
|
|
78
|
+
required: true,
|
|
79
|
+
attributes: [
|
|
80
|
+
{
|
|
81
|
+
uri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/SpecialityStatus',
|
|
82
|
+
label: 'Speciality Status',
|
|
83
|
+
name: 'SpecialityStatus',
|
|
84
|
+
type: 'String'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
uri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd',
|
|
88
|
+
label: 'Primary Speciality Ind',
|
|
89
|
+
name: 'PrimarySpecialityInd',
|
|
90
|
+
type: 'Boolean',
|
|
91
|
+
required: true
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
uri: 'configuration/entityTypes/HCP/attributes/NestedAttr',
|
|
97
|
+
label: 'Nested Attr',
|
|
98
|
+
name: 'NestedAttr',
|
|
99
|
+
type: 'Nested',
|
|
100
|
+
attributes: [
|
|
101
|
+
{
|
|
102
|
+
uri: 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/Int',
|
|
103
|
+
label: 'Int',
|
|
104
|
+
name: 'Int',
|
|
105
|
+
type: 'String',
|
|
106
|
+
required: true
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
uri: 'configuration/entityTypes/HCP/attributes/Address',
|
|
112
|
+
label: 'Address',
|
|
113
|
+
name: 'Address',
|
|
114
|
+
type: 'Reference',
|
|
115
|
+
referencedAttributeURIs: ['configuration/relationTypes/HasAddress/attributes/InternalPostCode'],
|
|
116
|
+
referencedEntityTypeURI: 'configuration/entityTypes/Location',
|
|
117
|
+
relationshipTypeURI: 'configuration/relationTypes/HasAddress'
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
uri: 'configuration/entityTypes/Location',
|
|
123
|
+
label: 'Location',
|
|
124
|
+
attributes: [
|
|
125
|
+
{
|
|
126
|
+
uri: 'configuration/entityTypes/Location/attributes/AddressLine1',
|
|
127
|
+
label: 'AddressLine1',
|
|
128
|
+
name: 'AddressLine1',
|
|
129
|
+
type: 'String'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
uri: 'configuration/entityTypes/Location/attributes/City',
|
|
133
|
+
label: 'City',
|
|
134
|
+
name: 'City',
|
|
135
|
+
type: 'String'
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
55
139
|
{
|
|
56
140
|
label: 'HCO',
|
|
57
141
|
uri: 'configuration/entityTypes/HCO',
|
|
58
142
|
attributes: [
|
|
143
|
+
{
|
|
144
|
+
uri: 'configuration/entityTypes/HCO/attributes/Name',
|
|
145
|
+
name: 'Name',
|
|
146
|
+
type: 'String',
|
|
147
|
+
required: true
|
|
148
|
+
},
|
|
59
149
|
{
|
|
60
150
|
uri: 'configuration/entityTypes/HCO/attributes/WebsiteURL',
|
|
61
151
|
name: 'WebsiteURL',
|
|
62
152
|
type: 'String'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
uri: 'configuration/entityTypes/HCO/attributes/ContactInfo',
|
|
156
|
+
label: 'Contact Info',
|
|
157
|
+
name: 'ContactInfo',
|
|
158
|
+
type: 'Nested',
|
|
159
|
+
attributes: [
|
|
160
|
+
{
|
|
161
|
+
uri: 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Email',
|
|
162
|
+
label: 'Email',
|
|
163
|
+
name: 'Email',
|
|
164
|
+
type: 'String',
|
|
165
|
+
required: true
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
uri: 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Phone',
|
|
169
|
+
label: 'Phone',
|
|
170
|
+
name: 'Phone',
|
|
171
|
+
type: 'String'
|
|
172
|
+
}
|
|
173
|
+
]
|
|
63
174
|
}
|
|
64
175
|
]
|
|
65
176
|
}
|
|
@@ -97,6 +208,13 @@ export var metadata = {
|
|
|
97
208
|
uri: 'configuration/relationTypes/HasAddress/attributes/AdditionalAttributes/attributes/AttributeValue'
|
|
98
209
|
}
|
|
99
210
|
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
uri: 'configuration/relationTypes/HasAddress/attributes/InternalPostCode',
|
|
214
|
+
label: 'Internal Post Code',
|
|
215
|
+
name: 'InternalPostCode',
|
|
216
|
+
type: 'String',
|
|
217
|
+
required: true
|
|
100
218
|
}
|
|
101
219
|
]
|
|
102
220
|
},
|
|
@@ -115,6 +233,33 @@ export var metadata = {
|
|
|
115
233
|
uri: 'configuration/relationTypes/Assistant/attributes/TestAttribute'
|
|
116
234
|
}
|
|
117
235
|
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
239
|
+
label: 'HCP to HCA',
|
|
240
|
+
attributes: [
|
|
241
|
+
{
|
|
242
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/Status',
|
|
243
|
+
label: 'Status',
|
|
244
|
+
name: 'Status',
|
|
245
|
+
type: 'String'
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr',
|
|
249
|
+
label: 'Nested Attr',
|
|
250
|
+
name: 'NestedAttr',
|
|
251
|
+
type: 'Nested',
|
|
252
|
+
required: true,
|
|
253
|
+
attributes: [
|
|
254
|
+
{
|
|
255
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr/attributes/SubAttr',
|
|
256
|
+
label: 'Sub Attr',
|
|
257
|
+
name: 'SubAttr',
|
|
258
|
+
type: 'String'
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
]
|
|
118
263
|
}
|
|
119
264
|
]
|
|
120
|
-
};
|
|
265
|
+
}); };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DCRChanges, Entity, Relation } from '@reltio/mdm-sdk';
|
|
2
|
+
import { LineData } from '../types';
|
|
3
|
+
type UserChange = {
|
|
4
|
+
lineId: string;
|
|
5
|
+
data: LineData;
|
|
6
|
+
};
|
|
7
|
+
export declare const getChanges: () => DCRChanges;
|
|
8
|
+
export declare const getEntitiesOrRelations: () => Record<string, Entity | Relation>;
|
|
9
|
+
export declare const getUserChanges: () => UserChange[];
|
|
10
|
+
export declare const getUserChangesRejectSubnestedAttributes: () => UserChange[];
|
|
11
|
+
export declare const getUserChangesRejectSubnestedRelationAttributes: () => UserChange[];
|
|
12
|
+
export declare const getUserChangesSubnestedEmpty: () => UserChange[];
|
|
13
|
+
export declare const getUserChangesNewEntity: () => UserChange[];
|
|
14
|
+
export {};
|