@reltio/components 1.4.1777 → 1.4.1778

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.
@@ -62,15 +62,14 @@ var useAttributeActions = function (_a) {
62
62
  var attributeValue = _a.attributeValue, attributeType = _a.attributeType, crosswalks = _a.crosswalks;
63
63
  var action = (0, mdm_sdk_1.isReference)(attributeType)
64
64
  ? (0, ramda_1.pipe)(mdm_sdk_1.getReferencedRelationFromAttrValue, (0, ramda_1.prop)('objectURI'), mdm_sdk_1.removeRelation, handleErrorResponse)(attributeValue)
65
- : Promise.all((crosswalks || []).map(function (_a) {
66
- var type = _a.type, value = _a.value, sourceTable = _a.sourceTable;
67
- return handleErrorResponse((0, mdm_sdk_1.deleteAttribute)({
68
- attributeUri: attributeValue.uri,
69
- sourceUri: type,
70
- crosswalkValue: value,
71
- crosswalkSourceTable: sourceTable
72
- }));
73
- }));
65
+ : (0, ramda_1.pipe)((0, ramda_1.defaultTo)([]), (0, ramda_1.map)(function (_a) {
66
+ var type = _a.type, value = _a.value;
67
+ return ({
68
+ type: 'DELETE_ATTRIBUTE',
69
+ uri: attributeValue.uri,
70
+ crosswalk: { type: type, value: value }
71
+ });
72
+ }), function (diff) { return ({ uri: (0, mdm_sdk_1.getBaseUri)(attributeValue.uri), diff: diff }); }, mdm_sdk_1.entityCumulativeUpdate, handleErrorResponse)(crosswalks);
74
73
  handleAction(action);
75
74
  }, [handleAction, handleErrorResponse]);
76
75
  var pinAttributeAction = (0, react_1.useCallback)(function (_a) {
@@ -35,8 +35,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { useCallback } from 'react';
38
- import { createAttribute, deleteAttribute, getReferencedRelationFromAttrValue, ignoreAttribute, isComplexAttribute, isImage, isLookupAttrType, isReference, pinAttribute, removeRelation, updateAttribute } from '@reltio/mdm-sdk';
39
- import { andThen, pipe, prop } from 'ramda';
38
+ import { createAttribute, entityCumulativeUpdate, getBaseUri, getReferencedRelationFromAttrValue, ignoreAttribute, isComplexAttribute, isImage, isLookupAttrType, isReference, pinAttribute, removeRelation, updateAttribute } from '@reltio/mdm-sdk';
39
+ import { andThen, pipe, prop, defaultTo, map } from 'ramda';
40
40
  import { noop } from '../../../core';
41
41
  export var useAttributeActions = function (_a) {
42
42
  var _b = _a.onSuccess, onSuccess = _b === void 0 ? noop : _b, _c = _a.onError, onError = _c === void 0 ? noop : _c, _d = _a.onLoad, onLoad = _d === void 0 ? noop : _d;
@@ -59,15 +59,14 @@ export var useAttributeActions = function (_a) {
59
59
  var attributeValue = _a.attributeValue, attributeType = _a.attributeType, crosswalks = _a.crosswalks;
60
60
  var action = isReference(attributeType)
61
61
  ? pipe(getReferencedRelationFromAttrValue, prop('objectURI'), removeRelation, handleErrorResponse)(attributeValue)
62
- : Promise.all((crosswalks || []).map(function (_a) {
63
- var type = _a.type, value = _a.value, sourceTable = _a.sourceTable;
64
- return handleErrorResponse(deleteAttribute({
65
- attributeUri: attributeValue.uri,
66
- sourceUri: type,
67
- crosswalkValue: value,
68
- crosswalkSourceTable: sourceTable
69
- }));
70
- }));
62
+ : pipe(defaultTo([]), map(function (_a) {
63
+ var type = _a.type, value = _a.value;
64
+ return ({
65
+ type: 'DELETE_ATTRIBUTE',
66
+ uri: attributeValue.uri,
67
+ crosswalk: { type: type, value: value }
68
+ });
69
+ }), function (diff) { return ({ uri: getBaseUri(attributeValue.uri), diff: diff }); }, entityCumulativeUpdate, handleErrorResponse)(crosswalks);
71
70
  handleAction(action);
72
71
  }, [handleAction, handleErrorResponse]);
73
72
  var pinAttributeAction = useCallback(function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1777",
3
+ "version": "1.4.1778",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",