@reltio/components 1.4.2248 → 1.4.2250

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.
@@ -265,9 +265,7 @@ var buildDCRSavePlan = function (changes, getLinesByChangeId, metadata) {
265
265
  if (lineValue && typeof lineValue === 'object' && 'lookupCode' in lineValue) {
266
266
  var parentPath = valuePath.slice(0, -1);
267
267
  updatedChange = (0, ramda_1.assocPath)(__spreadArray(__spreadArray([], parentPath, true), ['lookupCode'], false), lineValue.lookupCode, updatedChange);
268
- if ('lookupRawValue' in lineValue) {
269
- updatedChange = (0, ramda_1.assocPath)(__spreadArray(__spreadArray([], parentPath, true), ['lookupRawValue'], false), lineValue.lookupRawValue, updatedChange);
270
- }
268
+ updatedChange = (0, ramda_1.dissocPath)(__spreadArray(__spreadArray([], parentPath, true), ['lookupRawValue'], false), updatedChange);
271
269
  }
272
270
  }
273
271
  }
@@ -252,6 +252,36 @@ describe('dcr helpers tests', function () {
252
252
  ]
253
253
  } }));
254
254
  });
255
+ it('should remove lookupRawValue when new lookup value does not have it', function () {
256
+ var changes = {
257
+ 'entities/456': [
258
+ {
259
+ id: 'change1',
260
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
261
+ attributePath: 'Country',
262
+ attributeType: 'configuration/entityTypes/HCP/attributes/Country',
263
+ newValue: { value: 'Albania', lookupCode: 'ALBY', lookupRawValue: 'ALBY' },
264
+ oldValue: { value: 'France', lookupCode: 'FRA' }
265
+ }
266
+ ]
267
+ };
268
+ var lineData = [
269
+ ['456/change1/newValue', { value: { value: 'Germany', lookupCode: 'DEU' } }]
270
+ ];
271
+ var result = (0, dcr_1.buildDCRSavePlan)(changes, function (changeId) { return (changeId === 'change1' ? lineData : []); }, emptyMetadata);
272
+ expect(result).toEqual(__assign(__assign({}, emptyPlan), { rejectedChangeIds: ['change1'], updatedChanges: {
273
+ 'entities/456': [
274
+ {
275
+ id: 'change1',
276
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
277
+ attributePath: 'Country',
278
+ attributeType: 'configuration/entityTypes/HCP/attributes/Country',
279
+ newValue: { value: 'Germany', lookupCode: 'DEU' },
280
+ oldValue: { value: 'France', lookupCode: 'FRA' }
281
+ }
282
+ ]
283
+ } }));
284
+ });
255
285
  it('should preserve lookup sub-attribute with lookupCode inside nested parent', function () {
256
286
  var metadata = {
257
287
  entityTypes: [
@@ -258,9 +258,7 @@ export var buildDCRSavePlan = function (changes, getLinesByChangeId, metadata) {
258
258
  if (lineValue && typeof lineValue === 'object' && 'lookupCode' in lineValue) {
259
259
  var parentPath = valuePath.slice(0, -1);
260
260
  updatedChange = assocPath(__spreadArray(__spreadArray([], parentPath, true), ['lookupCode'], false), lineValue.lookupCode, updatedChange);
261
- if ('lookupRawValue' in lineValue) {
262
- updatedChange = assocPath(__spreadArray(__spreadArray([], parentPath, true), ['lookupRawValue'], false), lineValue.lookupRawValue, updatedChange);
263
- }
261
+ updatedChange = dissocPath(__spreadArray(__spreadArray([], parentPath, true), ['lookupRawValue'], false), updatedChange);
264
262
  }
265
263
  }
266
264
  }
@@ -250,6 +250,36 @@ describe('dcr helpers tests', function () {
250
250
  ]
251
251
  } }));
252
252
  });
253
+ it('should remove lookupRawValue when new lookup value does not have it', function () {
254
+ var changes = {
255
+ 'entities/456': [
256
+ {
257
+ id: 'change1',
258
+ type: DCRTypes.UPDATE_ATTRIBUTE,
259
+ attributePath: 'Country',
260
+ attributeType: 'configuration/entityTypes/HCP/attributes/Country',
261
+ newValue: { value: 'Albania', lookupCode: 'ALBY', lookupRawValue: 'ALBY' },
262
+ oldValue: { value: 'France', lookupCode: 'FRA' }
263
+ }
264
+ ]
265
+ };
266
+ var lineData = [
267
+ ['456/change1/newValue', { value: { value: 'Germany', lookupCode: 'DEU' } }]
268
+ ];
269
+ var result = buildDCRSavePlan(changes, function (changeId) { return (changeId === 'change1' ? lineData : []); }, emptyMetadata);
270
+ expect(result).toEqual(__assign(__assign({}, emptyPlan), { rejectedChangeIds: ['change1'], updatedChanges: {
271
+ 'entities/456': [
272
+ {
273
+ id: 'change1',
274
+ type: DCRTypes.UPDATE_ATTRIBUTE,
275
+ attributePath: 'Country',
276
+ attributeType: 'configuration/entityTypes/HCP/attributes/Country',
277
+ newValue: { value: 'Germany', lookupCode: 'DEU' },
278
+ oldValue: { value: 'France', lookupCode: 'FRA' }
279
+ }
280
+ ]
281
+ } }));
282
+ });
253
283
  it('should preserve lookup sub-attribute with lookupCode inside nested parent', function () {
254
284
  var metadata = {
255
285
  entityTypes: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2248",
3
+ "version": "1.4.2250",
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.2034",
14
+ "@reltio/mdm-sdk": "^1.4.2035",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",