@reltio/components 1.4.2207 → 1.4.2208
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/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +4 -4
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +14 -8
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +10 -7
- package/cjs/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +8 -3
- package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
- package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +1 -0
- package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +12 -0
- package/cjs/features/workflow/helpers/dcr.d.ts +8 -1
- package/cjs/features/workflow/helpers/dcr.js +186 -1
- package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
- package/cjs/features/workflow/hooks/useApplyDcrChanges.js +145 -0
- package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
- package/cjs/features/workflow/hooks/useWorkflowActions.js +31 -8
- package/cjs/features/workflow/types.d.ts +4 -0
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +1 -1
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +8 -2
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +10 -7
- package/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +9 -4
- package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
- package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +1 -0
- package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +13 -1
- package/features/workflow/helpers/dcr.d.ts +8 -1
- package/features/workflow/helpers/dcr.js +186 -2
- package/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
- package/features/workflow/hooks/useApplyDcrChanges.js +141 -0
- package/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
- package/features/workflow/hooks/useWorkflowActions.js +31 -8
- package/features/workflow/types.d.ts +4 -0
- package/package.json +2 -2
|
@@ -34,7 +34,6 @@ var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
|
34
34
|
var helpers_1 = require("./helpers/helpers");
|
|
35
35
|
var SuggestedChanges_1 = __importDefault(require("../../../icons/SuggestedChanges"));
|
|
36
36
|
var EntityChangesGroup_1 = require("./components/EntityChangesGroup");
|
|
37
|
-
var context_1 = require("./context");
|
|
38
37
|
var ChangeRequestEditor_module_css_1 = __importDefault(require("./ChangeRequestEditor.module.css"));
|
|
39
38
|
var ChangeRequestEditor = function (_a) {
|
|
40
39
|
var dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
@@ -52,6 +51,6 @@ var ChangeRequestEditor = function (_a) {
|
|
|
52
51
|
react_1.default.createElement("div", { className: ChangeRequestEditor_module_css_1.default.suggestedChangesIcon },
|
|
53
52
|
react_1.default.createElement(SuggestedChanges_1.default, null)),
|
|
54
53
|
react_1.default.createElement(Typography_1.default, { variant: "h6", className: ChangeRequestEditor_module_css_1.default.suggestedChangesTitle }, ui_i18n_1.default.text('Suggested changes'))),
|
|
55
|
-
dcrLoaded ? (
|
|
54
|
+
dcrLoaded ? (groupedObjects.map(function (object, index) { return (react_1.default.createElement(EntityChangesGroup_1.EntityChangesGroup, { key: "entity-".concat(index), entityInfo: object.entity, relationsInfo: object.relations, task: task, dcr: enrichedDCR })); })) : (react_1.default.createElement(EntityChangesGroup_1.SkeletonEntityChangesGroupLoader, null))));
|
|
56
55
|
};
|
|
57
56
|
exports.ChangeRequestEditor = ChangeRequestEditor;
|
package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js
CHANGED
|
@@ -50,7 +50,7 @@ var ChangeItemEditor = function (_a) {
|
|
|
50
50
|
var _b, _c, _d;
|
|
51
51
|
var change = _a.change, _e = _a.editable, editable = _e === void 0 ? true : _e, classes = _a.classes;
|
|
52
52
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
53
|
-
var _f = (0, useChangeRequestEditor_1.useChangeRequestEditor)({ change: change }), handleChange = _f.handleChange, handleReject = _f.handleReject, handleRevert = _f.handleRevert, lineData = _f.lineData, isLineRejected = _f.isLineRejected, isParentLineRejected = _f.isParentLineRejected, isUpdated = _f.isUpdated, hasChangeId = _f.hasChangeId;
|
|
53
|
+
var _f = (0, useChangeRequestEditor_1.useChangeRequestEditor)({ change: change }), handleChange = _f.handleChange, handleReject = _f.handleReject, handleRevert = _f.handleRevert, lineData = _f.lineData, isLineRejected = _f.isLineRejected, isParentLineRejected = _f.isParentLineRejected, isUpdated = _f.isUpdated, hasChangeId = _f.hasChangeId, isSubAttributeOfDeletedAttribute = _f.isSubAttributeOfDeletedAttribute;
|
|
54
54
|
var entity = (0, MdmModuleContext_1.useMdmEntity)();
|
|
55
55
|
var entityType = (0, mdm_sdk_1.getEntityType)(metadata, entity === null || entity === void 0 ? void 0 : entity.type);
|
|
56
56
|
var isUpdateOperation = change.operation === mdm_sdk_1.DCROperationTypes.EDITED;
|
|
@@ -77,6 +77,7 @@ var ChangeItemEditor = function (_a) {
|
|
|
77
77
|
!isUpdated &&
|
|
78
78
|
!isParentLineRejected &&
|
|
79
79
|
hasChangeId &&
|
|
80
|
+
!isSubAttributeOfDeletedAttribute &&
|
|
80
81
|
!(change.isReferenceSubAttribute && !editable);
|
|
81
82
|
var showStatusChips = !isParentLineRejected;
|
|
82
83
|
var isRejected = isLineRejected || isParentLineRejected;
|
|
@@ -9,7 +9,7 @@ var react_1 = __importDefault(require("react"));
|
|
|
9
9
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
10
10
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
11
11
|
var helpers_1 = require("../../helpers/helpers");
|
|
12
|
-
var
|
|
12
|
+
var ChangeRequestEditorContext_1 = require("../../../contexts/ChangeRequestEditorContext");
|
|
13
13
|
var ChangeItemEditor_1 = require("../ChangeItemEditor");
|
|
14
14
|
var merge_1 = require("../../../helpers/merge");
|
|
15
15
|
var ChangeItemRow_module_css_1 = __importDefault(require("./ChangeItemRow.module.css"));
|
|
@@ -17,13 +17,13 @@ var ChangeItemRow = function (_a) {
|
|
|
17
17
|
var _b;
|
|
18
18
|
var change = _a.change, entityInfo = _a.entityInfo;
|
|
19
19
|
var lineIds = change.lineIds || (0, merge_1.extractLineIds)(change === null || change === void 0 ? void 0 : change.newValue);
|
|
20
|
-
var isParentLineRejected = (0, react_context_selector_1.useContextSelector)(
|
|
20
|
+
var isParentLineRejected = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
21
21
|
return context.getIsParentLineRejected(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
|
|
22
22
|
});
|
|
23
|
-
var isLineRejected = (0, react_context_selector_1.useContextSelector)(
|
|
23
|
+
var isLineRejected = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
24
24
|
return context.getIsLineRejected(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
|
|
25
25
|
});
|
|
26
|
-
var isUpdated = (0, react_context_selector_1.useContextSelector)(
|
|
26
|
+
var isUpdated = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
27
27
|
return context.getIsLineUpdated(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
|
|
28
28
|
});
|
|
29
29
|
var isEditedOperation = change.operation === mdm_sdk_1.DCROperationTypes.EDITED;
|
package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '
|
|
3
|
+
import { LineDataValue } from '../../../contexts/ChangeRequestEditorContext';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, DataTypeDefinition, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '
|
|
3
|
+
import { LineDataValue } from '../../../contexts/ChangeRequestEditorContext';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -7,10 +7,11 @@ export declare const useChangeRequestEditor: ({ change }: Props) => {
|
|
|
7
7
|
handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
8
8
|
handleReject: () => void;
|
|
9
9
|
handleRevert: () => void;
|
|
10
|
-
lineData: import("
|
|
10
|
+
lineData: import("../../contexts/ChangeRequestEditorContext").LineData;
|
|
11
11
|
isLineRejected: boolean;
|
|
12
12
|
isParentLineRejected: boolean;
|
|
13
13
|
isUpdated: boolean;
|
|
14
14
|
hasChangeId: boolean;
|
|
15
|
+
isSubAttributeOfDeletedAttribute: any;
|
|
15
16
|
};
|
|
16
17
|
export {};
|
|
@@ -3,22 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useChangeRequestEditor = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
|
-
var
|
|
6
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
|
+
var ChangeRequestEditorContext_1 = require("../../contexts/ChangeRequestEditorContext");
|
|
7
8
|
var merge_1 = require("../../helpers/merge");
|
|
8
9
|
var emptyLineIds = [];
|
|
9
10
|
var useChangeRequestEditor = function (_a) {
|
|
10
11
|
var change = _a.change;
|
|
11
12
|
var lineIds = change.lineIds || (0, merge_1.extractLineIds)(change === null || change === void 0 ? void 0 : change.newValue) || emptyLineIds;
|
|
12
|
-
var lineData = (0, react_context_selector_1.useContextSelector)(
|
|
13
|
-
var updateChange = (0, react_context_selector_1.useContextSelector)(
|
|
14
|
-
var rejectChange = (0, react_context_selector_1.useContextSelector)(
|
|
15
|
-
var revertChangeUpdateOrReject = (0, react_context_selector_1.useContextSelector)(
|
|
16
|
-
var isParentLineRejected = (0, react_context_selector_1.useContextSelector)(
|
|
13
|
+
var lineData = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.getLineData(lineIds[0]); });
|
|
14
|
+
var updateChange = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.updateChange; });
|
|
15
|
+
var rejectChange = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.rejectChange; });
|
|
16
|
+
var revertChangeUpdateOrReject = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.revertChangeUpdateOrReject; });
|
|
17
|
+
var isParentLineRejected = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
17
18
|
return context.getIsParentLineRejected(lineIds[0]);
|
|
18
19
|
});
|
|
19
|
-
var isUpdated = (0, react_context_selector_1.useContextSelector)(
|
|
20
|
+
var isUpdated = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.getIsLineUpdated(lineIds[0]); });
|
|
20
21
|
var isLineRejected = lineData === null || lineData === void 0 ? void 0 : lineData.isRejected;
|
|
21
22
|
var hasChangeId = lineIds.length > 0;
|
|
23
|
+
var isSubAttributeOfDeletedAttribute = change.operation === mdm_sdk_1.DCROperationTypes.DELETED &&
|
|
24
|
+
change.level > 0 &&
|
|
25
|
+
lineIds.length > 0 &&
|
|
26
|
+
lineIds[0].includes('/value/');
|
|
22
27
|
var handleChange = (0, react_1.useCallback)(function (newValue) {
|
|
23
28
|
updateChange(lineIds, typeof newValue === 'object' && 'value' in newValue ? newValue : { value: newValue });
|
|
24
29
|
}, [lineIds, updateChange]);
|
|
@@ -36,7 +41,8 @@ var useChangeRequestEditor = function (_a) {
|
|
|
36
41
|
isLineRejected: isLineRejected,
|
|
37
42
|
isParentLineRejected: isParentLineRejected,
|
|
38
43
|
isUpdated: isUpdated,
|
|
39
|
-
hasChangeId: hasChangeId
|
|
44
|
+
hasChangeId: hasChangeId,
|
|
45
|
+
isSubAttributeOfDeletedAttribute: isSubAttributeOfDeletedAttribute
|
|
40
46
|
};
|
|
41
47
|
};
|
|
42
48
|
exports.useChangeRequestEditor = useChangeRequestEditor;
|
|
@@ -15,7 +15,6 @@ var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
|
15
15
|
var useWorkflowCheckPermission_1 = require("../hooks/useWorkflowCheckPermission");
|
|
16
16
|
var useWorkflowActions_1 = require("../hooks/useWorkflowActions");
|
|
17
17
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
18
|
-
var context_1 = require("../ChangeRequestEditor/context");
|
|
19
18
|
var ProfileBand_1 = require("../../../ProfileBand");
|
|
20
19
|
var DueDateField_1 = require("../DueDateField");
|
|
21
20
|
var PrioritySelector_1 = require("../PrioritySelector");
|
|
@@ -24,17 +23,22 @@ var WorkflowComments_1 = require("../WorkflowComments");
|
|
|
24
23
|
var WorkflowActionButtons_1 = require("../WorkflowActionButtons");
|
|
25
24
|
var DCRSummaryInfo_1 = require("./components/DCRSummaryInfo/DCRSummaryInfo");
|
|
26
25
|
var ChangeRequestEditor_1 = require("../ChangeRequestEditor");
|
|
26
|
+
var useApplyDcrChanges_1 = require("../hooks/useApplyDcrChanges");
|
|
27
27
|
var ReviewDCRDialog_module_css_1 = __importDefault(require("./ReviewDCRDialog.module.css"));
|
|
28
28
|
var ReviewDCRDialog = function (_a) {
|
|
29
29
|
var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
30
30
|
var entity = (0, MdmModuleContext_1.useMdmEntity)();
|
|
31
31
|
var checkWorkflowPermission = (0, useWorkflowCheckPermission_1.useWorkflowCheckPermission)();
|
|
32
32
|
var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
|
|
33
|
+
var applyDcrChanges = (0, useApplyDcrChanges_1.useApplyDcrChanges)(dcr);
|
|
33
34
|
var _b = (0, useWorkflowActions_1.useWorkflowActions)({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
task: {
|
|
36
|
+
taskId: task.taskId,
|
|
37
|
+
possibleActions: task.possibleActions,
|
|
38
|
+
assignee: task.assignee,
|
|
39
|
+
isOpen: task.isOpen
|
|
40
|
+
},
|
|
41
|
+
beforeAction: applyDcrChanges
|
|
38
42
|
}), workflowActions = _b.actions, actionRequestIsInProgress = _b.actionRequestIsInProgress;
|
|
39
43
|
return (react_1.default.createElement(Dialog_1.default, { open: open, onClose: onClose, fullScreen: true },
|
|
40
44
|
react_1.default.createElement(DialogTitle_1.default, { className: ReviewDCRDialog_module_css_1.default.dialogTitle },
|
|
@@ -55,8 +59,7 @@ var ReviewDCRDialog = function (_a) {
|
|
|
55
59
|
react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.editableItem },
|
|
56
60
|
react_1.default.createElement(AssigneeSelector_1.AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
|
|
57
61
|
react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.changesSection },
|
|
58
|
-
react_1.default.createElement(
|
|
59
|
-
react_1.default.createElement(ChangeRequestEditor_1.ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects })))),
|
|
62
|
+
react_1.default.createElement(ChangeRequestEditor_1.ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects }))),
|
|
60
63
|
canViewComments && (react_1.default.createElement(WorkflowComments_1.WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
|
|
61
64
|
container: ReviewDCRDialog_module_css_1.default.commentsRootContainer,
|
|
62
65
|
commentsContainer: ReviewDCRDialog_module_css_1.default.commentsContainer
|
|
@@ -12,10 +12,12 @@ var TaskActionButtons = function (_a) {
|
|
|
12
12
|
var task = _a.task;
|
|
13
13
|
var taskId = task.taskId, possibleActions = task.possibleActions, assignee = task.assignee, isOpen = task.isOpen, preferredAction = task.preferredAction;
|
|
14
14
|
var _b = (0, useWorkflowActions_1.useWorkflowActions)({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
task: {
|
|
16
|
+
taskId: taskId,
|
|
17
|
+
possibleActions: possibleActions,
|
|
18
|
+
assignee: assignee,
|
|
19
|
+
isOpen: isOpen
|
|
20
|
+
}
|
|
19
21
|
}), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
|
|
20
22
|
var _c = (0, ramda_1.partition)((0, ramda_1.propEq)('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
|
|
21
23
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.DataChangeRequestTaskCard = void 0;
|
|
30
30
|
var react_1 = __importStar(require("react"));
|
|
31
31
|
var ramda_1 = require("ramda");
|
|
32
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
32
33
|
var DcrTaskIcon_1 = __importDefault(require("../../../../../icons/DcrTaskIcon"));
|
|
33
34
|
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
|
|
34
35
|
var GenericWorkflowTaskCard_1 = require("../GenericWorkflowTaskCard");
|
|
@@ -38,11 +39,14 @@ var useChangeRequest_1 = require("../../../hooks/useChangeRequest");
|
|
|
38
39
|
var common_1 = require("../../../helpers/common");
|
|
39
40
|
var ReviewDCRDialog_1 = require("../../../ReviewDCRDialog");
|
|
40
41
|
var ReviewDCRButton_1 = require("../../../ReviewDCRButton");
|
|
42
|
+
var ChangeRequestEditorContext_1 = require("../../../contexts/ChangeRequestEditorContext");
|
|
41
43
|
var WorkflowTasksContext_1 = require("../../../../../contexts/WorkflowTasksContext");
|
|
42
44
|
var DataChangeRequestTaskCard = function (_a) {
|
|
43
45
|
var task = _a.task;
|
|
44
46
|
var reviewDCREnabledByEntityType = ((0, react_1.useContext)(WorkflowTasksContext_1.WorkflowTasksContext) || {}).reviewDCR;
|
|
45
47
|
var reviewDCREnabled = (0, MdmModuleContext_1.useMdmReviewDCREnabled)();
|
|
48
|
+
var entity = (0, MdmModuleContext_1.useMdmEntity)();
|
|
49
|
+
var isDCREntity = (0, mdm_sdk_1.isDCRUri)(entity === null || entity === void 0 ? void 0 : entity.uri);
|
|
46
50
|
var isReviewDCREnabled = (0, ramda_1.isNil)(reviewDCREnabledByEntityType) ? reviewDCREnabled : reviewDCREnabledByEntityType;
|
|
47
51
|
var username = (0, MdmModuleContext_1.useMdmUsername)();
|
|
48
52
|
var _b = (0, react_1.useState)(false), isReviewDCRDialogOpen = _b[0], setIsReviewDCRDialogOpen = _b[1];
|
|
@@ -55,13 +59,14 @@ var DataChangeRequestTaskCard = function (_a) {
|
|
|
55
59
|
var handleCloseReviewDCRDialog = (0, react_1.useCallback)(function () {
|
|
56
60
|
setIsReviewDCRDialogOpen(false);
|
|
57
61
|
}, []);
|
|
58
|
-
var showReviewDCRButton = isReviewDCREnabled && assignee == username;
|
|
59
|
-
var showReviewDialog = isReviewDCRDialogOpen && (showReviewDCRButton || isReviewDCREnabled);
|
|
62
|
+
var showReviewDCRButton = !isDCREntity && isReviewDCREnabled && assignee == username;
|
|
63
|
+
var showReviewDialog = !isDCREntity && isReviewDCRDialogOpen && (showReviewDCRButton || isReviewDCREnabled);
|
|
60
64
|
var customActionsSlot = (0, react_1.useMemo)(function () { return showReviewDCRButton && react_1.default.createElement(ReviewDCRButton_1.ReviewDCRButton, { onClick: handleReviewDCR }); }, [showReviewDCRButton, handleReviewDCR]);
|
|
61
65
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
66
|
react_1.default.createElement(GenericWorkflowTaskCard_1.GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon_1.default, customActionsSlot: customActionsSlot }, dcr &&
|
|
63
67
|
groupedObjects.map(function (object, index) { return (react_1.default.createElement(LineDecorator_1.LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
64
68
|
react_1.default.createElement(AttributesChanges_1.AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })),
|
|
65
|
-
showReviewDialog && (react_1.default.createElement(
|
|
69
|
+
showReviewDialog && (react_1.default.createElement(ChangeRequestEditorContext_1.ChangeRequestEditorProvider, null,
|
|
70
|
+
react_1.default.createElement(ReviewDCRDialog_1.ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task })))));
|
|
66
71
|
};
|
|
67
72
|
exports.DataChangeRequestTaskCard = DataChangeRequestTaskCard;
|
|
@@ -55,10 +55,12 @@ var GenericWorkflowTaskCard = function (_a) {
|
|
|
55
55
|
var checkWorkflowPermission = (0, useWorkflowCheckPermission_1.useWorkflowCheckPermission)();
|
|
56
56
|
var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
|
|
57
57
|
var _d = (0, useWorkflowActions_1.useWorkflowActions)({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
task: {
|
|
59
|
+
taskId: taskId,
|
|
60
|
+
possibleActions: possibleActions,
|
|
61
|
+
assignee: assignee,
|
|
62
|
+
isOpen: isTaskOpen
|
|
63
|
+
}
|
|
62
64
|
}), workflowActions = _d.actions, actionRequestIsInProgress = _d.actionRequestIsInProgress;
|
|
63
65
|
return (react_1.default.createElement("div", { className: GenericWorkflowTaskCard_module_css_1.default.card },
|
|
64
66
|
react_1.default.createElement("div", { className: (0, classnames_1.default)((_b = {}, _b[GenericWorkflowTaskCard_module_css_1.default.withBackground] = isExpanded, _b)) },
|
|
@@ -10,6 +10,7 @@ export type LineData = {
|
|
|
10
10
|
type ChangeRequestEditorContextType = {
|
|
11
11
|
updateChange: (lineIds: string[], data: LineDataValue) => void;
|
|
12
12
|
getLineData: (lineId: string) => LineData | undefined;
|
|
13
|
+
getLinesByChangeId: (changeId: string) => Array<[string, LineData]>;
|
|
13
14
|
rejectChange: (lineIds: string[]) => void;
|
|
14
15
|
revertChangeUpdateOrReject: (lineIds: string[]) => void;
|
|
15
16
|
getIsParentLineRejected: (lineId: string) => boolean;
|
|
@@ -30,6 +30,7 @@ var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
|
30
30
|
exports.ChangeRequestEditorContext = (0, react_context_selector_1.createContext)({
|
|
31
31
|
updateChange: undefined,
|
|
32
32
|
getLineData: undefined,
|
|
33
|
+
getLinesByChangeId: undefined,
|
|
33
34
|
rejectChange: undefined,
|
|
34
35
|
revertChangeUpdateOrReject: undefined,
|
|
35
36
|
getIsParentLineRejected: undefined,
|
|
@@ -39,6 +40,7 @@ exports.ChangeRequestEditorContext = (0, react_context_selector_1.createContext)
|
|
|
39
40
|
var ChangeRequestEditorProvider = function (_a) {
|
|
40
41
|
var children = _a.children;
|
|
41
42
|
var _b = (0, react_1.useState)(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
|
|
43
|
+
var lineDataMapRef = (0, react_1.useRef)(lineDataMap);
|
|
42
44
|
var updateChange = (0, react_1.useCallback)(function (lineIds, data) {
|
|
43
45
|
setLineDataMap(function (prevMap) {
|
|
44
46
|
var newMap = new Map(prevMap);
|
|
@@ -88,9 +90,19 @@ var ChangeRequestEditorProvider = function (_a) {
|
|
|
88
90
|
var _a;
|
|
89
91
|
return !(0, ramda_1.isNil)((_a = lineDataMap.get(lineId)) === null || _a === void 0 ? void 0 : _a.value);
|
|
90
92
|
}, [lineDataMap]);
|
|
93
|
+
var getLinesByChangeId = (0, react_1.useCallback)(function (changeId) {
|
|
94
|
+
return Array.from(lineDataMapRef.current).filter(function (_a) {
|
|
95
|
+
var key = _a[0], _value = _a[1];
|
|
96
|
+
return key.split('/')[1] === changeId;
|
|
97
|
+
});
|
|
98
|
+
}, []);
|
|
99
|
+
(0, react_1.useEffect)(function () {
|
|
100
|
+
lineDataMapRef.current = lineDataMap;
|
|
101
|
+
}, [lineDataMap]);
|
|
91
102
|
var contextValue = {
|
|
92
103
|
updateChange: updateChange,
|
|
93
104
|
getLineData: getLineData,
|
|
105
|
+
getLinesByChangeId: getLinesByChangeId,
|
|
94
106
|
rejectChange: rejectChange,
|
|
95
107
|
revertChangeUpdateOrReject: revertChangeUpdateOrReject,
|
|
96
108
|
getIsParentLineRejected: getIsParentLineRejected,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ChangeRequest, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo } from '@reltio/mdm-sdk';
|
|
1
|
+
import { AttributeDelete, ChangeRequest, DCRChange, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo, Metadata } from '@reltio/mdm-sdk';
|
|
2
|
+
import { LineData } from '../contexts/ChangeRequestEditorContext';
|
|
2
3
|
export declare const getEntitiesObjects: any;
|
|
3
4
|
export declare const getRelationsObjects: any;
|
|
4
5
|
export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
|
|
@@ -7,3 +8,9 @@ export declare const createEntityRelationsObjectByRelation: any;
|
|
|
7
8
|
export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
|
|
8
9
|
export declare const getEntityUriForChangeRequest: (dcrUri: string, entityUri: string) => string;
|
|
9
10
|
export declare const isCreateEntityOperation: (dcr: ChangeRequest) => boolean;
|
|
11
|
+
export declare const buildDCRSavePlan: (changes: DCRChanges, getLinesByChangeId: (changeId: string) => Array<[string, LineData]>, metadata: Metadata) => {
|
|
12
|
+
rejectedChangeIds: string[];
|
|
13
|
+
updatedChanges: Record<string, DCRChange[]>;
|
|
14
|
+
deleteEntityAttributes: Record<string, AttributeDelete[]>;
|
|
15
|
+
deleteRelationAttributes: Record<string, AttributeDelete[]>;
|
|
16
|
+
};
|
|
@@ -10,8 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.isCreateEntityOperation = exports.getEntityUriForChangeRequest = exports.concatEntityRelationsObjects = exports.createEntityRelationsObjectByRelation = exports.createEntityRelationsObjectByEntity = exports.extractObjectsFromChangeRequest = exports.getRelationsObjects = exports.getEntitiesObjects = void 0;
|
|
23
|
+
exports.buildDCRSavePlan = exports.isCreateEntityOperation = exports.getEntityUriForChangeRequest = exports.concatEntityRelationsObjects = exports.createEntityRelationsObjectByRelation = exports.createEntityRelationsObjectByEntity = exports.extractObjectsFromChangeRequest = exports.getRelationsObjects = exports.getEntitiesObjects = void 0;
|
|
15
24
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
16
25
|
var ramda_1 = require("ramda");
|
|
17
26
|
exports.getEntitiesObjects = (0, ramda_1.filter)((0, ramda_1.pipe)((0, ramda_1.prop)('uri'), mdm_sdk_1.isEntityUri));
|
|
@@ -54,3 +63,179 @@ var isCreateEntityOperation = function (dcr) {
|
|
|
54
63
|
return dcr.type === mdm_sdk_1.DCRTypes.CREATE_ENTITY;
|
|
55
64
|
};
|
|
56
65
|
exports.isCreateEntityOperation = isCreateEntityOperation;
|
|
66
|
+
var cleanValueRecursively = function (value) {
|
|
67
|
+
if (typeof value === 'string' || (0, ramda_1.isEmpty)(value)) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
var cleanedProperties = (0, ramda_1.map)(function (propertyValues) {
|
|
71
|
+
return propertyValues
|
|
72
|
+
.map(function (item) {
|
|
73
|
+
var itemValue = item.value;
|
|
74
|
+
var cleanedItemValue = itemValue && typeof itemValue === 'object' ? cleanValueRecursively(itemValue) : itemValue;
|
|
75
|
+
return __assign(__assign({}, item), { value: cleanedItemValue });
|
|
76
|
+
})
|
|
77
|
+
.filter(function (item) {
|
|
78
|
+
var itemValue = item.value;
|
|
79
|
+
return !(0, ramda_1.isEmpty)(itemValue) && !(0, ramda_1.isNil)(itemValue);
|
|
80
|
+
});
|
|
81
|
+
}, value);
|
|
82
|
+
return (0, ramda_1.filter)(function (propertyValues) { return !(0, ramda_1.isEmpty)(propertyValues); }, cleanedProperties);
|
|
83
|
+
};
|
|
84
|
+
var cleanChange = function (change) {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
if (Array.isArray(change.newValue)) {
|
|
87
|
+
return change;
|
|
88
|
+
}
|
|
89
|
+
if ((0, mdm_sdk_1.isRelationTypeUri)(change.objectType)) {
|
|
90
|
+
if (change.type === mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE || change.type === mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE) {
|
|
91
|
+
var cleanedValues = cleanValueRecursively((_a = change.newValue) === null || _a === void 0 ? void 0 : _a.value);
|
|
92
|
+
return (0, ramda_1.assocPath)(['newValue', 'value'], cleanedValues, change);
|
|
93
|
+
}
|
|
94
|
+
var cleanedAttributes = cleanValueRecursively((_b = change.newValue) === null || _b === void 0 ? void 0 : _b.attributes);
|
|
95
|
+
var changeWithCleanedAttributes = (0, ramda_1.assocPath)(['newValue', 'attributes'], cleanedAttributes, change);
|
|
96
|
+
if (change.type === mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP) {
|
|
97
|
+
var cleanByPath = function (valuePath) {
|
|
98
|
+
return (0, ramda_1.when)((0, ramda_1.allPass)([(0, ramda_1.hasPath)(valuePath), (0, ramda_1.pipe)((0, ramda_1.path)(valuePath), ramda_1.isNil)]), (0, ramda_1.dissocPath)(valuePath));
|
|
99
|
+
};
|
|
100
|
+
return (0, ramda_1.pipe)(cleanByPath(['newValue', 'startDate']), cleanByPath(['newValue', 'endDate']))(changeWithCleanedAttributes);
|
|
101
|
+
}
|
|
102
|
+
return changeWithCleanedAttributes;
|
|
103
|
+
}
|
|
104
|
+
if (typeof change.newValue === 'object') {
|
|
105
|
+
var cleanedValue = cleanValueRecursively((_c = change.newValue) === null || _c === void 0 ? void 0 : _c.value);
|
|
106
|
+
return (0, ramda_1.assocPath)(['newValue', 'value'], cleanedValue, change);
|
|
107
|
+
}
|
|
108
|
+
return change;
|
|
109
|
+
};
|
|
110
|
+
var calculateValuePath = function (key, change) {
|
|
111
|
+
var path = key
|
|
112
|
+
.split('/')
|
|
113
|
+
.slice(2)
|
|
114
|
+
.map(function (part) { return (isNaN(Number(part)) ? part : parseInt(part)); });
|
|
115
|
+
switch (change.type) {
|
|
116
|
+
case mdm_sdk_1.DCRTypes.UPDATE_TAGS:
|
|
117
|
+
case mdm_sdk_1.DCRTypes.UPDATE_ROLES:
|
|
118
|
+
return path;
|
|
119
|
+
case mdm_sdk_1.DCRTypes.UPDATE_START_DATE:
|
|
120
|
+
case mdm_sdk_1.DCRTypes.UPDATE_END_DATE:
|
|
121
|
+
return __spreadArray(__spreadArray([], path, true), [0], false);
|
|
122
|
+
case mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP:
|
|
123
|
+
if (path.length === 2) {
|
|
124
|
+
if (path[1] === 'activeness.startDate') {
|
|
125
|
+
return [path[0], 'startDate'];
|
|
126
|
+
}
|
|
127
|
+
if (path[1] === 'activeness.endDate') {
|
|
128
|
+
return [path[0], 'endDate'];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return __spreadArray(__spreadArray([], path, true), ['value'], false);
|
|
132
|
+
default:
|
|
133
|
+
return __spreadArray(__spreadArray([], path, true), ['value'], false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var valuesAreEqual = function (oldValue, newValue) {
|
|
137
|
+
var sortWithLocale = function (array) { return array.slice().sort(function (a, b) { return a.localeCompare(b); }); };
|
|
138
|
+
if (Array.isArray(oldValue) && Array.isArray(newValue)) {
|
|
139
|
+
return oldValue.length === newValue.length && (0, ramda_1.equals)(sortWithLocale(oldValue), sortWithLocale(newValue));
|
|
140
|
+
}
|
|
141
|
+
if (typeof oldValue === 'string' && typeof newValue === 'number') {
|
|
142
|
+
return oldValue === newValue.toString();
|
|
143
|
+
}
|
|
144
|
+
return oldValue === newValue;
|
|
145
|
+
};
|
|
146
|
+
var getOldValueByNewValuePath = function (valuePath, change) {
|
|
147
|
+
if (valuePath.includes('newValue')) {
|
|
148
|
+
return (0, ramda_1.pathOr)(null, valuePath.map(function (item) { return (item === 'newValue' ? 'oldValue' : item); }), change);
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
};
|
|
152
|
+
var buildDCRSavePlan = function (changes, getLinesByChangeId, metadata) {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
var rejectedChangeIds = [];
|
|
155
|
+
var updatedChanges = {};
|
|
156
|
+
var deleteAttributes = {};
|
|
157
|
+
for (var _i = 0, _c = Object.entries(changes); _i < _c.length; _i++) {
|
|
158
|
+
var _d = _c[_i], objectUri = _d[0], objectChanges = _d[1];
|
|
159
|
+
var rawChanges = new Map();
|
|
160
|
+
var _loop_1 = function (change) {
|
|
161
|
+
var _h = (0, ramda_1.pipe)((0, ramda_1.prop)('id'), getLinesByChangeId, (0, ramda_1.partition)(function (_a) {
|
|
162
|
+
var _b;
|
|
163
|
+
var key = _a[0], lineData = _a[1];
|
|
164
|
+
return key.split('/').length === 3 &&
|
|
165
|
+
(lineData.isRejected ||
|
|
166
|
+
((0, ramda_1.isEmpty)((_b = lineData.value) === null || _b === void 0 ? void 0 : _b.value) && change.type !== mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE));
|
|
167
|
+
}))(change), rejectedRootLines = _h[0], otherLines = _h[1];
|
|
168
|
+
rejectedChangeIds.push.apply(rejectedChangeIds, rejectedRootLines.map(function (_a) {
|
|
169
|
+
var key = _a[0];
|
|
170
|
+
return key.split('/')[1];
|
|
171
|
+
}));
|
|
172
|
+
var rejectedRootLinesMap = new Map(rejectedRootLines);
|
|
173
|
+
for (var _j = 0, otherLines_1 = otherLines; _j < otherLines_1.length; _j++) {
|
|
174
|
+
var _k = otherLines_1[_j], key = _k[0], lineData = _k[1];
|
|
175
|
+
var rootId = key.split('/').slice(0, 3).join('/');
|
|
176
|
+
var newValue = (_a = lineData.value) === null || _a === void 0 ? void 0 : _a.value;
|
|
177
|
+
if (rootId === key && change.type === mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE && (0, ramda_1.isEmpty)(newValue)) {
|
|
178
|
+
var attributeUri = [objectUri, 'attributes', change.attributePath].join('/');
|
|
179
|
+
var entry = __assign(__assign({}, (0, mdm_sdk_1.createEntryDeleteAttribute)({ uri: attributeUri })[0]), (change.crosswalk && { crosswalk: change.crosswalk }));
|
|
180
|
+
deleteAttributes[objectUri] = (0, ramda_1.uniqBy)((0, ramda_1.prop)('uri'), (0, ramda_1.append)(entry, (0, ramda_1.propOr)([], objectUri, deleteAttributes)));
|
|
181
|
+
rejectedChangeIds.push(change.id);
|
|
182
|
+
}
|
|
183
|
+
else if (!rejectedRootLinesMap.has(rootId)) {
|
|
184
|
+
var valuePath = calculateValuePath(key, change);
|
|
185
|
+
var oldDCRValue = (0, ramda_1.path)(valuePath, change);
|
|
186
|
+
var oldValue = getOldValueByNewValuePath(valuePath, change);
|
|
187
|
+
var initialChange = rawChanges.has(change.id) ? rawChanges.get(change.id) : change;
|
|
188
|
+
var updatedChange = void 0;
|
|
189
|
+
if (lineData.isRejected || (0, ramda_1.isEmpty)(newValue)) {
|
|
190
|
+
updatedChange = (0, ramda_1.assocPath)(valuePath, null, initialChange);
|
|
191
|
+
}
|
|
192
|
+
else if (!valuesAreEqual(oldDCRValue, newValue)) {
|
|
193
|
+
if (oldValue && valuesAreEqual(oldValue, newValue)) {
|
|
194
|
+
rejectedChangeIds.push(change.id);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
var processedNewValue = typeof oldDCRValue === 'string' && typeof newValue === 'number'
|
|
198
|
+
? newValue.toString()
|
|
199
|
+
: newValue;
|
|
200
|
+
updatedChange = (0, ramda_1.assocPath)(valuePath, processedNewValue, initialChange);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (updatedChange) {
|
|
204
|
+
rawChanges.set(change.id, updatedChange);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
for (var _e = 0, objectChanges_1 = objectChanges; _e < objectChanges_1.length; _e++) {
|
|
210
|
+
var change = objectChanges_1[_e];
|
|
211
|
+
_loop_1(change);
|
|
212
|
+
}
|
|
213
|
+
for (var _f = 0, _g = Array.from(rawChanges.values()); _f < _g.length; _f++) {
|
|
214
|
+
var rawChange = _g[_f];
|
|
215
|
+
var cleanedChange = cleanChange(rawChange);
|
|
216
|
+
var isNestedChange = (0, ramda_1.has)('attributeType', cleanedChange) &&
|
|
217
|
+
(0, mdm_sdk_1.isNested)((0, mdm_sdk_1.findAttributeTypeByUri)(metadata, cleanedChange.attributeType));
|
|
218
|
+
if (isNestedChange && (0, ramda_1.isEmpty)((_b = cleanedChange.newValue) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
219
|
+
rejectedChangeIds.push(cleanedChange.id);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
updatedChanges[objectUri] = (0, ramda_1.append)(cleanedChange, (0, ramda_1.propOr)([], objectUri, updatedChanges));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
var rejectedBeforeUpdateIds = (0, ramda_1.pipe)(ramda_1.values, ramda_1.flatten, (0, ramda_1.pluck)('id'))(updatedChanges);
|
|
227
|
+
rejectedChangeIds.push.apply(rejectedChangeIds, rejectedBeforeUpdateIds);
|
|
228
|
+
var deleteAttributesGroups = (0, ramda_1.groupBy)(function (_a) {
|
|
229
|
+
var uri = _a[0];
|
|
230
|
+
return ((0, mdm_sdk_1.isRelationUri)(uri) ? 'relation' : 'entity');
|
|
231
|
+
}, (0, ramda_1.toPairs)(deleteAttributes));
|
|
232
|
+
var deleteRelationAttributes = (0, ramda_1.fromPairs)(deleteAttributesGroups.relation || []);
|
|
233
|
+
var deleteEntityAttributes = (0, ramda_1.fromPairs)(deleteAttributesGroups.entity || []);
|
|
234
|
+
return {
|
|
235
|
+
rejectedChangeIds: rejectedChangeIds,
|
|
236
|
+
updatedChanges: updatedChanges,
|
|
237
|
+
deleteEntityAttributes: deleteEntityAttributes,
|
|
238
|
+
deleteRelationAttributes: deleteRelationAttributes
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
exports.buildDCRSavePlan = buildDCRSavePlan;
|