@reltio/components 1.4.2211 → 1.4.2213
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/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +30 -11
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +10 -2
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +9 -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/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +30 -11
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +9 -1
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +9 -2
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +1 -1
- 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.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,255 @@
|
|
|
1
|
+
import { getValidationErrors } from './validation';
|
|
2
|
+
import { getMetadata } from './metadata.test-data';
|
|
3
|
+
import { getChanges, getEntitiesOrRelations, getUserChanges, getUserChangesRejectSubnestedAttributes, getUserChangesRejectSubnestedRelationAttributes, getUserChangesSubnestedEmpty, getUserChangesNewEntity } from './validation.test-data';
|
|
4
|
+
import { findAttributeTypeByUri } from '@reltio/mdm-sdk';
|
|
5
|
+
describe('getValidationErrors', function () {
|
|
6
|
+
it('should validate required attributes with user changes', function () {
|
|
7
|
+
var metadata = getMetadata();
|
|
8
|
+
var result = getValidationErrors({
|
|
9
|
+
changes: getChanges(),
|
|
10
|
+
userChanges: getUserChanges(),
|
|
11
|
+
entitiesOrRelations: getEntitiesOrRelations(),
|
|
12
|
+
metadata: metadata
|
|
13
|
+
});
|
|
14
|
+
var firstNameAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/FirstName');
|
|
15
|
+
var prescriberIndicatorAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/Boolean');
|
|
16
|
+
var addressAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/Address');
|
|
17
|
+
var internalPostCodeAttributeType = findAttributeTypeByUri(metadata, 'configuration/relationTypes/HasAddress/attributes/InternalPostCode');
|
|
18
|
+
var primarySpecialityIndAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd');
|
|
19
|
+
expect(result).toEqual([
|
|
20
|
+
{
|
|
21
|
+
error: {
|
|
22
|
+
type: 'missed',
|
|
23
|
+
attributeType: firstNameAttributeType,
|
|
24
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
25
|
+
parentUri: 'FirstName/2QHFlPPP',
|
|
26
|
+
uri: 'entityUri1/0SBmZIW/newValue',
|
|
27
|
+
message: 'Attribute is required',
|
|
28
|
+
source: 'local',
|
|
29
|
+
path: [
|
|
30
|
+
expect.objectContaining({
|
|
31
|
+
label: '<No label>',
|
|
32
|
+
type: 'attributeValue',
|
|
33
|
+
value: expect.objectContaining({
|
|
34
|
+
uri: 'entities/entityUri1/attributes/FirstName/2QHFlPPP'
|
|
35
|
+
}),
|
|
36
|
+
valueType: firstNameAttributeType
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
lineIds: ['entityUri1/0SBmZIW/newValue']
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
error: {
|
|
44
|
+
type: 'missed',
|
|
45
|
+
attributeType: prescriberIndicatorAttributeType,
|
|
46
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Boolean',
|
|
47
|
+
parentUri: 'Boolean/2DEYFcfk',
|
|
48
|
+
uri: 'entityUri1/0SBmys4/newValue',
|
|
49
|
+
message: 'Attribute is required',
|
|
50
|
+
source: 'local',
|
|
51
|
+
path: [
|
|
52
|
+
expect.objectContaining({
|
|
53
|
+
label: '<No label>',
|
|
54
|
+
type: 'attributeValue',
|
|
55
|
+
value: expect.objectContaining({
|
|
56
|
+
uri: 'entities/entityUri1/attributes/Boolean/2DEYFcfk'
|
|
57
|
+
}),
|
|
58
|
+
valueType: prescriberIndicatorAttributeType
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
lineIds: ['entityUri1/0SBmys4/newValue']
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
error: {
|
|
66
|
+
type: 'missed',
|
|
67
|
+
attributeType: internalPostCodeAttributeType,
|
|
68
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Address/attributes/InternalPostCode',
|
|
69
|
+
parentUri: 'InternalPostCode',
|
|
70
|
+
uri: 'entityUri1/0SBmubo/newValue',
|
|
71
|
+
message: 'Attribute is required',
|
|
72
|
+
source: 'local',
|
|
73
|
+
path: [
|
|
74
|
+
expect.objectContaining({
|
|
75
|
+
label: expect.any(String),
|
|
76
|
+
type: 'attributeValue',
|
|
77
|
+
value: expect.objectContaining({
|
|
78
|
+
uri: 'entities/entityUri1/attributes/Address/0HfPK9G'
|
|
79
|
+
}),
|
|
80
|
+
valueType: addressAttributeType
|
|
81
|
+
}),
|
|
82
|
+
expect.objectContaining({
|
|
83
|
+
label: '<No label>',
|
|
84
|
+
type: 'attributeValue',
|
|
85
|
+
value: expect.objectContaining({
|
|
86
|
+
uri: 'entities/entityUri1/attributes/Address/0HfPK9G/InternalPostCode/2GMCNw4E'
|
|
87
|
+
}),
|
|
88
|
+
valueType: internalPostCodeAttributeType
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
lineIds: ['entityUri1/0SBmubo/newValue']
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
error: {
|
|
96
|
+
type: 'missed',
|
|
97
|
+
attributeType: primarySpecialityIndAttributeType,
|
|
98
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd',
|
|
99
|
+
parentUri: undefined,
|
|
100
|
+
uri: 'entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0',
|
|
101
|
+
message: 'Attribute is required',
|
|
102
|
+
source: 'local',
|
|
103
|
+
path: []
|
|
104
|
+
},
|
|
105
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0']
|
|
106
|
+
}
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
it('should validate required attributes with subnested user changes', function () {
|
|
110
|
+
var metadata = getMetadata();
|
|
111
|
+
var result = getValidationErrors({
|
|
112
|
+
changes: getChanges(),
|
|
113
|
+
userChanges: getUserChangesRejectSubnestedAttributes(),
|
|
114
|
+
entitiesOrRelations: getEntitiesOrRelations(),
|
|
115
|
+
metadata: metadata
|
|
116
|
+
});
|
|
117
|
+
var specialitiesAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/Specialities');
|
|
118
|
+
var primarySpecialityIndAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd');
|
|
119
|
+
expect(result).toEqual([
|
|
120
|
+
{
|
|
121
|
+
error: {
|
|
122
|
+
type: 'missed',
|
|
123
|
+
attributeType: primarySpecialityIndAttributeType,
|
|
124
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities/attributes/PrimarySpecialityInd',
|
|
125
|
+
parentUri: undefined,
|
|
126
|
+
uri: 'entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0',
|
|
127
|
+
message: 'Attribute is required',
|
|
128
|
+
source: 'local',
|
|
129
|
+
path: []
|
|
130
|
+
},
|
|
131
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue/value/PrimarySpecialityInd/0']
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
error: {
|
|
135
|
+
type: 'missed',
|
|
136
|
+
attributeType: specialitiesAttributeType,
|
|
137
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/Specialities',
|
|
138
|
+
parentUri: undefined,
|
|
139
|
+
uri: 'entityUri1/0SBn7Oa/newValue',
|
|
140
|
+
message: 'Attribute is required',
|
|
141
|
+
source: 'local',
|
|
142
|
+
path: []
|
|
143
|
+
},
|
|
144
|
+
lineIds: ['entityUri1/0SBn7Oa/newValue']
|
|
145
|
+
}
|
|
146
|
+
]);
|
|
147
|
+
});
|
|
148
|
+
it('should validate required attributes with subnested relation user changes', function () {
|
|
149
|
+
var metadata = getMetadata();
|
|
150
|
+
var result = getValidationErrors({
|
|
151
|
+
changes: getChanges(),
|
|
152
|
+
userChanges: getUserChangesRejectSubnestedRelationAttributes(),
|
|
153
|
+
entitiesOrRelations: getEntitiesOrRelations(),
|
|
154
|
+
metadata: metadata
|
|
155
|
+
});
|
|
156
|
+
var refFirstLevelNestedAttributeType = findAttributeTypeByUri(metadata, 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr');
|
|
157
|
+
expect(result).toEqual([
|
|
158
|
+
{
|
|
159
|
+
error: {
|
|
160
|
+
type: 'missed',
|
|
161
|
+
attributeType: refFirstLevelNestedAttributeType,
|
|
162
|
+
attributeTypeUri: 'configuration/relationTypes/HCPtoHCA/attributes/NestedAttr',
|
|
163
|
+
parentUri: undefined,
|
|
164
|
+
uri: '0pSTmm8/0MCLpVw/newValue/attributes/NestedAttr/0',
|
|
165
|
+
message: 'Attribute is required',
|
|
166
|
+
source: 'local',
|
|
167
|
+
path: []
|
|
168
|
+
},
|
|
169
|
+
lineIds: ['0pSTmm8/0MCLpVw/newValue/attributes/NestedAttr/0']
|
|
170
|
+
}
|
|
171
|
+
]);
|
|
172
|
+
});
|
|
173
|
+
it('should validate required subnested attribute when value is empty', function () {
|
|
174
|
+
var metadata = getMetadata();
|
|
175
|
+
var result = getValidationErrors({
|
|
176
|
+
changes: getChanges(),
|
|
177
|
+
userChanges: getUserChangesSubnestedEmpty(),
|
|
178
|
+
entitiesOrRelations: getEntitiesOrRelations(),
|
|
179
|
+
metadata: metadata
|
|
180
|
+
});
|
|
181
|
+
var nestedAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/NestedAttr');
|
|
182
|
+
var intAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/Int');
|
|
183
|
+
expect(result).toEqual([
|
|
184
|
+
{
|
|
185
|
+
error: {
|
|
186
|
+
type: 'missed',
|
|
187
|
+
attributeType: intAttributeType,
|
|
188
|
+
attributeTypeUri: 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/Int',
|
|
189
|
+
parentUri: 'NestedAttr/2BNyTheu',
|
|
190
|
+
uri: 'entityUri1/0IEmjjX/newValue',
|
|
191
|
+
message: 'Attribute is required',
|
|
192
|
+
source: 'local',
|
|
193
|
+
path: [
|
|
194
|
+
expect.objectContaining({
|
|
195
|
+
label: '<No label>',
|
|
196
|
+
type: 'attributeValue',
|
|
197
|
+
value: expect.objectContaining({
|
|
198
|
+
uri: 'entities/entityUri1/attributes/NestedAttr/2BNyTheu'
|
|
199
|
+
}),
|
|
200
|
+
valueType: nestedAttributeType
|
|
201
|
+
}),
|
|
202
|
+
expect.objectContaining({
|
|
203
|
+
label: '<No label>',
|
|
204
|
+
type: 'attributeValue',
|
|
205
|
+
value: expect.objectContaining({
|
|
206
|
+
uri: 'entities/entityUri1/attributes/NestedAttr/2BNyTheu/Int/2BNyTlvA'
|
|
207
|
+
}),
|
|
208
|
+
valueType: intAttributeType
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
lineIds: ['entityUri1/0IEmjjX/newValue']
|
|
213
|
+
}
|
|
214
|
+
]);
|
|
215
|
+
});
|
|
216
|
+
it('should validate required attributes in new entity', function () {
|
|
217
|
+
var metadata = getMetadata();
|
|
218
|
+
var result = getValidationErrors({
|
|
219
|
+
changes: getChanges(),
|
|
220
|
+
userChanges: getUserChangesNewEntity(),
|
|
221
|
+
entitiesOrRelations: getEntitiesOrRelations(),
|
|
222
|
+
metadata: metadata
|
|
223
|
+
});
|
|
224
|
+
var nameAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCO/attributes/Name');
|
|
225
|
+
var emailAttributeType = findAttributeTypeByUri(metadata, 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Email');
|
|
226
|
+
expect(result).toEqual([
|
|
227
|
+
{
|
|
228
|
+
error: {
|
|
229
|
+
type: 'missed',
|
|
230
|
+
attributeType: nameAttributeType,
|
|
231
|
+
attributeTypeUri: 'configuration/entityTypes/HCO/attributes/Name',
|
|
232
|
+
parentUri: undefined,
|
|
233
|
+
uri: 'entityUri2/0IEiwoe/newValue/attributes/Name/0',
|
|
234
|
+
message: 'Attribute is required',
|
|
235
|
+
source: 'local',
|
|
236
|
+
path: []
|
|
237
|
+
},
|
|
238
|
+
lineIds: ['entityUri2/0IEiwoe/newValue/attributes/Name/0']
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
error: {
|
|
242
|
+
type: 'missed',
|
|
243
|
+
attributeType: emailAttributeType,
|
|
244
|
+
attributeTypeUri: 'configuration/entityTypes/HCO/attributes/ContactInfo/attributes/Email',
|
|
245
|
+
parentUri: undefined,
|
|
246
|
+
uri: 'entityUri2/0IEiwoe/newValue/attributes/ContactInfo/0/value/Email/0',
|
|
247
|
+
message: 'Attribute is required',
|
|
248
|
+
source: 'local',
|
|
249
|
+
path: []
|
|
250
|
+
},
|
|
251
|
+
lineIds: ['entityUri2/0IEiwoe/newValue/attributes/ContactInfo/0/value/Email/0']
|
|
252
|
+
}
|
|
253
|
+
]);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
@@ -129,7 +129,7 @@ export var useDCRValidation = function (dcr) {
|
|
|
129
129
|
case 3:
|
|
130
130
|
relations = _a;
|
|
131
131
|
loadedRelationsObject = relations.reduce(function (acc, relation) {
|
|
132
|
-
acc[relation.uri] = relation;
|
|
132
|
+
acc[relation === null || relation === void 0 ? void 0 : relation.uri] = relation;
|
|
133
133
|
return acc;
|
|
134
134
|
}, {});
|
|
135
135
|
objectsByUri = __assign(__assign({}, localObjects), loadedRelationsObject);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2213",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.2013",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|
/package/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts}
RENAMED
|
File without changes
|
/package/cjs/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts}
RENAMED
|
File without changes
|