@reltio/components 1.4.2243 → 1.4.2244

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.
Files changed (217) hide show
  1. package/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
  2. package/ActivenessDateControl/ActivenessDateControl.js +11 -0
  3. package/ActivenessDateControl/index.d.ts +1 -0
  4. package/ActivenessDateControl/index.js +1 -0
  5. package/EntitySelector/EntitySelector.d.ts +2 -1
  6. package/EntitySelector/EntitySelector.js +2 -2
  7. package/EntitySelector/index.d.ts +1 -0
  8. package/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
  9. package/MoreAttributesButton/MoreAttributesButton.js +8 -8
  10. package/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
  11. package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
  12. package/cjs/ActivenessDateControl/ActivenessDateControl.js +18 -0
  13. package/cjs/ActivenessDateControl/index.d.ts +1 -0
  14. package/cjs/ActivenessDateControl/index.js +5 -0
  15. package/cjs/EntitySelector/EntitySelector.d.ts +2 -1
  16. package/cjs/EntitySelector/EntitySelector.js +2 -2
  17. package/cjs/EntitySelector/index.d.ts +1 -0
  18. package/cjs/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
  19. package/cjs/MoreAttributesButton/MoreAttributesButton.js +8 -8
  20. package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
  21. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
  22. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +22 -11
  23. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
  24. package/cjs/features/activity-log/ActivityLog/constants.d.ts +17 -0
  25. package/cjs/features/activity-log/ActivityLog/constants.js +20 -0
  26. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
  27. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
  28. package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
  29. package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +67 -0
  30. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
  31. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
  32. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
  33. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +25 -6
  34. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  35. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
  36. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +79 -0
  37. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
  38. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +5 -0
  39. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
  40. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
  41. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
  42. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +41 -0
  43. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
  44. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
  45. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +6 -0
  46. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
  47. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +134 -5
  48. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +2 -2
  49. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
  50. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +110 -0
  51. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
  52. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
  53. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
  54. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +1 -3
  55. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
  56. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +89 -0
  57. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
  58. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +5 -0
  59. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
  60. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +12 -11
  61. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
  62. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
  63. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +5 -0
  64. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
  65. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +34 -0
  66. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
  67. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
  68. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +5 -0
  69. package/cjs/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
  70. package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
  71. package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.js +12 -0
  72. package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
  73. package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +74 -0
  74. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
  75. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +157 -0
  76. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
  77. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +203 -0
  78. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
  79. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +22 -3
  80. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
  81. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +190 -0
  82. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
  83. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +768 -0
  84. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
  85. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
  86. package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
  87. package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +65 -0
  88. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
  89. package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
  90. package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +152 -0
  91. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
  92. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
  93. package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
  94. package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +78 -0
  95. package/cjs/features/workflow/helpers/attributes.js +16 -13
  96. package/cjs/features/workflow/helpers/attributes.test.js +6 -3
  97. package/cjs/features/workflow/helpers/dcr.d.ts +6 -1
  98. package/cjs/features/workflow/helpers/dcr.js +113 -18
  99. package/cjs/features/workflow/helpers/dcr.test.js +122 -0
  100. package/cjs/features/workflow/helpers/merge.d.ts +3 -0
  101. package/cjs/features/workflow/helpers/merge.js +32 -20
  102. package/cjs/features/workflow/helpers/merge.test.js +2 -1
  103. package/cjs/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
  104. package/cjs/features/workflow/helpers/moreAttributesScope.js +20 -0
  105. package/cjs/features/workflow/helpers/validation.js +31 -6
  106. package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
  107. package/cjs/features/workflow/hooks/useApplyDcrChanges.js +80 -63
  108. package/cjs/features/workflow/types.d.ts +12 -2
  109. package/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
  110. package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +15 -4
  111. package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
  112. package/features/activity-log/ActivityLog/constants.d.ts +17 -0
  113. package/features/activity-log/ActivityLog/constants.js +17 -0
  114. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
  115. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
  116. package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
  117. package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +37 -0
  118. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
  119. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
  120. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
  121. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +26 -7
  122. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  123. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
  124. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +49 -0
  125. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
  126. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +1 -0
  127. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
  128. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
  129. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
  130. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +34 -0
  131. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
  132. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
  133. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +1 -0
  134. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
  135. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +112 -6
  136. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +1 -1
  137. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
  138. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +80 -0
  139. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
  140. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
  141. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
  142. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +0 -1
  143. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
  144. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +59 -0
  145. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
  146. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +1 -0
  147. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
  148. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +10 -9
  149. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
  150. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
  151. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +1 -0
  152. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
  153. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +27 -0
  154. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
  155. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
  156. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +1 -0
  157. package/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
  158. package/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
  159. package/features/workflow/ChangeRequestEditor/components/editors/index.js +4 -0
  160. package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
  161. package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +62 -0
  162. package/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
  163. package/features/workflow/ChangeRequestEditor/helpers/changesList.js +153 -0
  164. package/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
  165. package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +201 -0
  166. package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
  167. package/features/workflow/ChangeRequestEditor/helpers/helpers.js +19 -3
  168. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
  169. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +186 -0
  170. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
  171. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +766 -0
  172. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
  173. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
  174. package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
  175. package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +61 -0
  176. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
  177. package/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
  178. package/features/workflow/contexts/AddedAttributesContext/index.js +125 -0
  179. package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
  180. package/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
  181. package/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
  182. package/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +51 -0
  183. package/features/workflow/helpers/attributes.js +16 -13
  184. package/features/workflow/helpers/attributes.test.js +6 -3
  185. package/features/workflow/helpers/dcr.d.ts +6 -1
  186. package/features/workflow/helpers/dcr.js +112 -18
  187. package/features/workflow/helpers/dcr.test.js +123 -1
  188. package/features/workflow/helpers/merge.d.ts +3 -0
  189. package/features/workflow/helpers/merge.js +30 -19
  190. package/features/workflow/helpers/merge.test.js +2 -1
  191. package/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
  192. package/features/workflow/helpers/moreAttributesScope.js +14 -0
  193. package/features/workflow/helpers/validation.js +31 -6
  194. package/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
  195. package/features/workflow/hooks/useApplyDcrChanges.js +83 -66
  196. package/features/workflow/types.d.ts +12 -2
  197. package/package.json +2 -2
  198. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
  199. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -57
  200. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -95
  201. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
  202. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
  203. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -21
  204. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
  205. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
  206. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -5
  207. package/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
  208. package/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -54
  209. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -65
  210. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
  211. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
  212. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -14
  213. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
  214. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
  215. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -1
  216. /package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
  217. /package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
@@ -0,0 +1,768 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
15
+ var mergeAddedAttributesWithDCRChanges_1 = require("./mergeAddedAttributesWithDCRChanges");
16
+ var createSimpleAttrType = function (overrides) {
17
+ if (overrides === void 0) { overrides = {}; }
18
+ return (__assign({ name: 'FirstName', uri: 'configuration/entityTypes/HCP/attributes/FirstName', label: 'First Name', type: 'String' }, overrides));
19
+ };
20
+ var createReferenceAttrType = function (overrides) {
21
+ if (overrides === void 0) { overrides = {}; }
22
+ return (__assign({ name: 'Address', uri: 'configuration/entityTypes/HCP/attributes/Address', label: 'Address', type: 'Reference', referencedEntityTypeURI: 'configuration/entityTypes/Location', relationshipTypeURI: 'configuration/relationTypes/HasAddress' }, overrides));
23
+ };
24
+ describe('mergeAddedAttributesWithDCRChanges', function () {
25
+ var _a;
26
+ var entityUri = 'entities/456';
27
+ var baseChanges = (_a = {},
28
+ _a[entityUri] = [
29
+ {
30
+ id: 'existingChange1',
31
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
32
+ attributePath: 'Name/456',
33
+ newValue: { value: 'New Name' },
34
+ oldValue: { value: 'Old Name' }
35
+ }
36
+ ],
37
+ _a);
38
+ var enrichedBaseChange = {
39
+ id: 'existingChange1',
40
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
41
+ attributePath: 'Name/456',
42
+ newValue: { value: 'New Name', lineIds: ['456/existingChange1/newValue'] },
43
+ oldValue: { value: 'Old Name', lineIds: ['456/existingChange1/oldValue'] },
44
+ lineIds: ['456/existingChange1']
45
+ };
46
+ it('should return enriched changes with lineIds when addedAttributes is empty', function () {
47
+ var _a;
48
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, []);
49
+ expect(result).toEqual((_a = {},
50
+ _a[entityUri] = [enrichedBaseChange],
51
+ _a));
52
+ });
53
+ it('should return original changes without enrichment when enrich is false and addedAttributes is empty', function () {
54
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, [], false);
55
+ expect(result).toEqual(baseChanges);
56
+ });
57
+ it('should add INSERT_ATTRIBUTE change for simple root attribute', function () {
58
+ var _a;
59
+ var attrType = createSimpleAttrType();
60
+ var added = [
61
+ {
62
+ id: 'added|abc',
63
+ objectUri: entityUri,
64
+ attributeType: attrType
65
+ }
66
+ ];
67
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
68
+ expect(result).toEqual((_a = {},
69
+ _a[entityUri] = [
70
+ enrichedBaseChange,
71
+ {
72
+ id: 'added|abc',
73
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
74
+ attributePath: 'FirstName',
75
+ attributeType: 'configuration/entityTypes/HCP/attributes/FirstName',
76
+ newValue: { value: undefined, addedId: 'added|abc', lineIds: ['456/added|abc/newValue'] },
77
+ lineIds: ['456/added|abc']
78
+ }
79
+ ],
80
+ _a));
81
+ });
82
+ it('should add INSERT_ATTRIBUTE with refEntity for reference attribute', function () {
83
+ var _a;
84
+ var attrType = createReferenceAttrType();
85
+ var added = [
86
+ {
87
+ id: 'added|ref1',
88
+ objectUri: entityUri,
89
+ attributeType: attrType,
90
+ refEntity: { entityUri: 'entities/789' }
91
+ }
92
+ ];
93
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
94
+ expect(result).toEqual((_a = {},
95
+ _a[entityUri] = [
96
+ enrichedBaseChange,
97
+ {
98
+ id: 'added|ref1',
99
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
100
+ attributePath: 'Address',
101
+ attributeType: 'configuration/entityTypes/HCP/attributes/Address',
102
+ newValue: {
103
+ value: {},
104
+ addedId: 'added|ref1',
105
+ refEntity: { objectURI: 'entities/789' },
106
+ lineIds: ['456/added|ref1/newValue']
107
+ },
108
+ lineIds: ['456/added|ref1']
109
+ }
110
+ ],
111
+ _a));
112
+ });
113
+ it('should add UPDATE_ROLES change for role attribute', function () {
114
+ var _a;
115
+ var added = [
116
+ {
117
+ id: 'added|role1',
118
+ objectUri: entityUri,
119
+ attributeType: mdm_sdk_1.EntityAttrTypes.roles
120
+ }
121
+ ];
122
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
123
+ expect(result).toEqual((_a = {},
124
+ _a[entityUri] = [
125
+ enrichedBaseChange,
126
+ {
127
+ id: 'added|role1',
128
+ type: mdm_sdk_1.DCRTypes.UPDATE_ROLES,
129
+ newValue: { value: [], addedId: 'added|role1', lineIds: ['456/added|role1/newValue'] },
130
+ lineIds: ['456/added|role1']
131
+ }
132
+ ],
133
+ _a));
134
+ });
135
+ it('should add UPDATE_TAGS change for tag attribute', function () {
136
+ var _a;
137
+ var added = [
138
+ {
139
+ id: 'added|tag1',
140
+ objectUri: entityUri,
141
+ attributeType: mdm_sdk_1.EntityAttrTypes.tags
142
+ }
143
+ ];
144
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
145
+ expect(result).toEqual((_a = {},
146
+ _a[entityUri] = [
147
+ enrichedBaseChange,
148
+ {
149
+ id: 'added|tag1',
150
+ type: mdm_sdk_1.DCRTypes.UPDATE_TAGS,
151
+ newValue: { value: [], addedId: 'added|tag1', lineIds: ['456/added|tag1/newValue'] },
152
+ lineIds: ['456/added|tag1']
153
+ }
154
+ ],
155
+ _a));
156
+ });
157
+ it('should add UPDATE_START_DATE change for start date attribute', function () {
158
+ var _a;
159
+ var added = [
160
+ {
161
+ id: 'added|sd1',
162
+ objectUri: entityUri,
163
+ attributeType: mdm_sdk_1.EntityAttrTypes.startDate
164
+ }
165
+ ];
166
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
167
+ expect(result).toEqual((_a = {},
168
+ _a[entityUri] = [
169
+ enrichedBaseChange,
170
+ {
171
+ id: 'added|sd1',
172
+ type: mdm_sdk_1.DCRTypes.UPDATE_START_DATE,
173
+ objectType: 'startDate',
174
+ newValue: { value: undefined, addedId: 'added|sd1', lineIds: ['456/added|sd1/newValue'] },
175
+ lineIds: ['456/added|sd1']
176
+ }
177
+ ],
178
+ _a));
179
+ });
180
+ it('should add UPDATE_END_DATE change for end date attribute', function () {
181
+ var _a;
182
+ var added = [
183
+ {
184
+ id: 'added|ed1',
185
+ objectUri: entityUri,
186
+ attributeType: mdm_sdk_1.EntityAttrTypes.endDate
187
+ }
188
+ ];
189
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
190
+ expect(result).toEqual((_a = {},
191
+ _a[entityUri] = [
192
+ enrichedBaseChange,
193
+ {
194
+ id: 'added|ed1',
195
+ type: mdm_sdk_1.DCRTypes.UPDATE_END_DATE,
196
+ objectType: 'endDate',
197
+ newValue: { value: undefined, addedId: 'added|ed1', lineIds: ['456/added|ed1/newValue'] },
198
+ lineIds: ['456/added|ed1']
199
+ }
200
+ ],
201
+ _a));
202
+ });
203
+ it('should attach child to existing parent node by parentId', function () {
204
+ var _a;
205
+ var parentAttrType = createSimpleAttrType({
206
+ name: 'Parent',
207
+ uri: 'configuration/entityTypes/HCP/attributes/Parent',
208
+ type: 'Nested'
209
+ });
210
+ var childAttrType = createSimpleAttrType({
211
+ name: 'Child',
212
+ uri: 'configuration/entityTypes/HCP/attributes/Parent/attributes/Child'
213
+ });
214
+ var added = [
215
+ {
216
+ id: 'added|parent1',
217
+ objectUri: entityUri,
218
+ attributeType: parentAttrType
219
+ },
220
+ {
221
+ id: 'added|parent1|child1',
222
+ objectUri: entityUri,
223
+ attributeType: childAttrType,
224
+ parentId: 'added|parent1'
225
+ }
226
+ ];
227
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(baseChanges, added);
228
+ expect(result).toEqual((_a = {},
229
+ _a[entityUri] = [
230
+ enrichedBaseChange,
231
+ {
232
+ id: 'added|parent1',
233
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
234
+ attributePath: 'Parent',
235
+ attributeType: 'configuration/entityTypes/HCP/attributes/Parent',
236
+ newValue: {
237
+ value: {
238
+ Child: [
239
+ {
240
+ value: undefined,
241
+ addedId: 'added|parent1|child1',
242
+ lineIds: ['456/added|parent1/newValue/value/Child/0']
243
+ }
244
+ ]
245
+ },
246
+ addedId: 'added|parent1',
247
+ lineIds: ['456/added|parent1/newValue']
248
+ },
249
+ lineIds: ['456/added|parent1']
250
+ }
251
+ ],
252
+ _a));
253
+ });
254
+ it('should attach child to existing DCR node by parentLineId', function () {
255
+ var _a, _b;
256
+ var changes = (_a = {},
257
+ _a[entityUri] = [
258
+ {
259
+ id: 'existingNested',
260
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
261
+ newValue: { value: { SubAttr: [{ value: 'test' }] } }
262
+ }
263
+ ],
264
+ _a);
265
+ var childAttrType = createSimpleAttrType({
266
+ name: 'NewChild',
267
+ uri: 'configuration/entityTypes/HCP/attributes/NestedAttr/attributes/NewChild'
268
+ });
269
+ var added = [
270
+ {
271
+ id: 'added|child2',
272
+ objectUri: entityUri,
273
+ attributeType: childAttrType,
274
+ parentLineId: '456/existingNested/newValue'
275
+ }
276
+ ];
277
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(changes, added);
278
+ expect(result).toEqual((_b = {},
279
+ _b[entityUri] = [
280
+ {
281
+ id: 'existingNested',
282
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
283
+ newValue: {
284
+ value: {
285
+ SubAttr: [{ value: 'test', lineIds: ['456/existingNested/newValue/value/SubAttr/0'] }],
286
+ NewChild: [
287
+ {
288
+ value: undefined,
289
+ addedId: 'added|child2',
290
+ lineIds: ['456/existingNested/newValue/value/NewChild/0']
291
+ }
292
+ ]
293
+ },
294
+ lineIds: ['456/existingNested/newValue']
295
+ },
296
+ lineIds: ['456/existingNested']
297
+ }
298
+ ],
299
+ _b));
300
+ });
301
+ it('should create INSERT_ATTRIBUTE with full path when changeOverrides is provided', function () {
302
+ var _a;
303
+ var changes = (_a = {},
304
+ _a[entityUri] = [
305
+ {
306
+ id: 'existingChange',
307
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
308
+ attributePath: 'AddressNested/26fvrHXjx/PostalCode',
309
+ newValue: { value: '12345' },
310
+ attributeType: 'configuration/entityTypes/HCP/attributes/AddressNested/attributes/PostalCode'
311
+ }
312
+ ],
313
+ _a);
314
+ var childAttrType = createSimpleAttrType({
315
+ name: 'City',
316
+ uri: 'configuration/entityTypes/HCP/attributes/AddressNested/attributes/City'
317
+ });
318
+ var added = [
319
+ {
320
+ id: 'added|city1',
321
+ objectUri: entityUri,
322
+ attributeType: childAttrType,
323
+ changeOverrides: { attributePath: 'AddressNested/26fvrHXjx/City' }
324
+ }
325
+ ];
326
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(changes, added);
327
+ expect(result[entityUri]).toHaveLength(2);
328
+ expect(result[entityUri][1]).toEqual(expect.objectContaining({
329
+ id: 'added|city1',
330
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
331
+ attributePath: 'AddressNested/26fvrHXjx/City',
332
+ newValue: expect.objectContaining({
333
+ value: undefined,
334
+ addedId: 'added|city1'
335
+ })
336
+ }));
337
+ });
338
+ it('should fill existing UPDATE_ROLES change with empty newValue instead of creating duplicate', function () {
339
+ var _a, _b;
340
+ var changes = (_a = {},
341
+ _a[entityUri] = [
342
+ {
343
+ id: 'existingRoles',
344
+ type: mdm_sdk_1.DCRTypes.UPDATE_ROLES,
345
+ oldValue: ['admin', 'user'],
346
+ newValue: undefined
347
+ }
348
+ ],
349
+ _a);
350
+ var added = [
351
+ {
352
+ id: 'added|role2',
353
+ objectUri: entityUri,
354
+ attributeType: mdm_sdk_1.EntityAttrTypes.roles
355
+ }
356
+ ];
357
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(changes, added, false);
358
+ expect(result).toEqual((_b = {},
359
+ _b[entityUri] = [{ id: 'existingRoles', type: mdm_sdk_1.DCRTypes.UPDATE_ROLES, oldValue: ['admin', 'user'], newValue: [] }],
360
+ _b));
361
+ });
362
+ it('should attach root attribute to existing CREATE_ENTITY change instead of creating INSERT_ATTRIBUTE', function () {
363
+ var _a, _b;
364
+ var createEntityChanges = (_a = {},
365
+ _a[entityUri] = [
366
+ {
367
+ id: 'createChange1',
368
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
369
+ newValue: {
370
+ value: undefined,
371
+ attributes: {
372
+ ExistingAttr: [{ value: 'existing' }]
373
+ }
374
+ }
375
+ }
376
+ ],
377
+ _a);
378
+ var attrType = createSimpleAttrType();
379
+ var added = [
380
+ {
381
+ id: 'added|abc',
382
+ objectUri: entityUri,
383
+ attributeType: attrType
384
+ }
385
+ ];
386
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createEntityChanges, added);
387
+ expect(result).toEqual((_b = {},
388
+ _b[entityUri] = [
389
+ {
390
+ id: 'createChange1',
391
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
392
+ newValue: {
393
+ value: undefined,
394
+ attributes: {
395
+ ExistingAttr: [
396
+ { value: 'existing', lineIds: ['456/createChange1/newValue/attributes/ExistingAttr/0'] }
397
+ ],
398
+ FirstName: [
399
+ {
400
+ value: undefined,
401
+ addedId: 'added|abc',
402
+ lineIds: ['456/createChange1/newValue/attributes/FirstName/0']
403
+ }
404
+ ]
405
+ },
406
+ lineIds: ['456/createChange1/newValue']
407
+ },
408
+ lineIds: ['456/createChange1']
409
+ }
410
+ ],
411
+ _b));
412
+ });
413
+ it('should attach root attribute to CREATE_RELATIONSHIP change', function () {
414
+ var _a, _b;
415
+ var createRelChanges = (_a = {},
416
+ _a[entityUri] = [
417
+ {
418
+ id: 'createRel1',
419
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
420
+ newValue: {
421
+ value: undefined,
422
+ attributes: {}
423
+ }
424
+ }
425
+ ],
426
+ _a);
427
+ var attrType = createSimpleAttrType();
428
+ var added = [
429
+ {
430
+ id: 'added|rel1',
431
+ objectUri: entityUri,
432
+ attributeType: attrType
433
+ }
434
+ ];
435
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createRelChanges, added);
436
+ expect(result).toEqual((_b = {},
437
+ _b[entityUri] = [
438
+ {
439
+ id: 'createRel1',
440
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
441
+ newValue: {
442
+ value: undefined,
443
+ attributes: {
444
+ FirstName: [
445
+ {
446
+ value: undefined,
447
+ addedId: 'added|rel1',
448
+ lineIds: ['456/createRel1/newValue/attributes/FirstName/0']
449
+ }
450
+ ]
451
+ },
452
+ lineIds: ['456/createRel1/newValue']
453
+ },
454
+ lineIds: ['456/createRel1']
455
+ }
456
+ ],
457
+ _b));
458
+ });
459
+ it('should attach roles to CREATE_ENTITY newValue instead of creating UPDATE_ROLES', function () {
460
+ var _a, _b;
461
+ var createEntityChanges = (_a = {},
462
+ _a[entityUri] = [
463
+ {
464
+ id: 'createChange1',
465
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
466
+ newValue: {
467
+ value: undefined,
468
+ attributes: {}
469
+ }
470
+ }
471
+ ],
472
+ _a);
473
+ var added = [
474
+ {
475
+ id: 'added|role1',
476
+ objectUri: entityUri,
477
+ attributeType: mdm_sdk_1.EntityAttrTypes.roles
478
+ }
479
+ ];
480
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createEntityChanges, added);
481
+ expect(result).toEqual((_b = {},
482
+ _b[entityUri] = [
483
+ {
484
+ id: 'createChange1',
485
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
486
+ newValue: {
487
+ value: undefined,
488
+ attributes: {},
489
+ roles: { value: [], addedId: 'added|role1' },
490
+ lineIds: ['456/createChange1/newValue']
491
+ },
492
+ lineIds: ['456/createChange1']
493
+ }
494
+ ],
495
+ _b));
496
+ });
497
+ it('should attach tags to CREATE_ENTITY newValue instead of creating UPDATE_TAGS', function () {
498
+ var _a, _b;
499
+ var createEntityChanges = (_a = {},
500
+ _a[entityUri] = [
501
+ {
502
+ id: 'createChange1',
503
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
504
+ newValue: {
505
+ value: undefined,
506
+ attributes: {}
507
+ }
508
+ }
509
+ ],
510
+ _a);
511
+ var added = [
512
+ {
513
+ id: 'added|tag1',
514
+ objectUri: entityUri,
515
+ attributeType: mdm_sdk_1.EntityAttrTypes.tags
516
+ }
517
+ ];
518
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createEntityChanges, added);
519
+ expect(result).toEqual((_b = {},
520
+ _b[entityUri] = [
521
+ {
522
+ id: 'createChange1',
523
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
524
+ newValue: {
525
+ value: undefined,
526
+ attributes: {},
527
+ tags: { value: [], addedId: 'added|tag1' },
528
+ lineIds: ['456/createChange1/newValue']
529
+ },
530
+ lineIds: ['456/createChange1']
531
+ }
532
+ ],
533
+ _b));
534
+ });
535
+ it('should attach startDate to CREATE_ENTITY newValue instead of creating UPDATE_START_DATE', function () {
536
+ var _a, _b;
537
+ var createEntityChanges = (_a = {},
538
+ _a[entityUri] = [
539
+ {
540
+ id: 'createChange1',
541
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
542
+ newValue: {
543
+ value: undefined,
544
+ attributes: {}
545
+ }
546
+ }
547
+ ],
548
+ _a);
549
+ var added = [
550
+ {
551
+ id: 'added|sd1',
552
+ objectUri: entityUri,
553
+ attributeType: mdm_sdk_1.EntityAttrTypes.startDate
554
+ }
555
+ ];
556
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createEntityChanges, added);
557
+ expect(result).toEqual((_b = {},
558
+ _b[entityUri] = [
559
+ {
560
+ id: 'createChange1',
561
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
562
+ newValue: {
563
+ value: undefined,
564
+ attributes: {},
565
+ startDate: { addedId: 'added|sd1' },
566
+ lineIds: ['456/createChange1/newValue']
567
+ },
568
+ lineIds: ['456/createChange1']
569
+ }
570
+ ],
571
+ _b));
572
+ });
573
+ it('should attach startDate to CREATE_RELATIONSHIP newValue instead of creating UPDATE_START_DATE', function () {
574
+ var _a, _b;
575
+ var relationUri = 'relations/rel345';
576
+ var createRelChanges = (_a = {},
577
+ _a[relationUri] = [
578
+ {
579
+ id: 'createRelChange1',
580
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
581
+ newValue: {
582
+ attributes: { Status: [{ value: 'Active' }] },
583
+ type: 'configuration/relationTypes/HCPtoHCA',
584
+ uri: relationUri
585
+ }
586
+ }
587
+ ],
588
+ _a);
589
+ var added = [
590
+ {
591
+ id: 'added|sd1',
592
+ objectUri: relationUri,
593
+ parentLineId: 'rel345/createRelChange1',
594
+ attributeType: mdm_sdk_1.EntityAttrTypes.startDate
595
+ }
596
+ ];
597
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createRelChanges, added);
598
+ expect(result).toEqual((_b = {},
599
+ _b[relationUri] = [
600
+ {
601
+ id: 'createRelChange1',
602
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
603
+ newValue: {
604
+ attributes: {
605
+ Status: [
606
+ { value: 'Active', lineIds: ['rel345/createRelChange1/newValue/attributes/Status/0'] }
607
+ ]
608
+ },
609
+ type: 'configuration/relationTypes/HCPtoHCA',
610
+ uri: relationUri,
611
+ startDate: { addedId: 'added|sd1' },
612
+ lineIds: ['rel345/createRelChange1/newValue']
613
+ },
614
+ lineIds: ['rel345/createRelChange1']
615
+ }
616
+ ],
617
+ _b));
618
+ });
619
+ it('should attach endDate to CREATE_RELATIONSHIP newValue instead of creating UPDATE_END_DATE', function () {
620
+ var _a, _b;
621
+ var relationUri = 'relations/rel345';
622
+ var createRelChanges = (_a = {},
623
+ _a[relationUri] = [
624
+ {
625
+ id: 'createRelChange1',
626
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
627
+ newValue: {
628
+ attributes: {},
629
+ type: 'configuration/relationTypes/HCPtoHCA',
630
+ uri: relationUri
631
+ }
632
+ }
633
+ ],
634
+ _a);
635
+ var added = [
636
+ {
637
+ id: 'added|ed1',
638
+ objectUri: relationUri,
639
+ parentLineId: 'rel345/createRelChange1',
640
+ attributeType: mdm_sdk_1.EntityAttrTypes.endDate
641
+ }
642
+ ];
643
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createRelChanges, added);
644
+ expect(result).toEqual((_b = {},
645
+ _b[relationUri] = [
646
+ {
647
+ id: 'createRelChange1',
648
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
649
+ newValue: {
650
+ attributes: {},
651
+ type: 'configuration/relationTypes/HCPtoHCA',
652
+ uri: relationUri,
653
+ endDate: { addedId: 'added|ed1' },
654
+ lineIds: ['rel345/createRelChange1/newValue']
655
+ },
656
+ lineIds: ['rel345/createRelChange1']
657
+ }
658
+ ],
659
+ _b));
660
+ });
661
+ it('should attach startDate to CREATE_RELATIONSHIP with addedId when enriched', function () {
662
+ var _a, _b;
663
+ var relationUri = 'relations/rel345';
664
+ var createRelChanges = (_a = {},
665
+ _a[relationUri] = [
666
+ {
667
+ id: 'createRelChange1',
668
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
669
+ newValue: {
670
+ attributes: {},
671
+ type: 'configuration/relationTypes/HCPtoHCA',
672
+ uri: relationUri
673
+ }
674
+ }
675
+ ],
676
+ _a);
677
+ var added = [
678
+ {
679
+ id: 'added|sd1',
680
+ objectUri: relationUri,
681
+ parentLineId: 'rel345/createRelChange1',
682
+ attributeType: mdm_sdk_1.EntityAttrTypes.startDate
683
+ }
684
+ ];
685
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(createRelChanges, added, true);
686
+ expect(result).toEqual((_b = {},
687
+ _b[relationUri] = [
688
+ {
689
+ id: 'createRelChange1',
690
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
691
+ newValue: {
692
+ attributes: {},
693
+ type: 'configuration/relationTypes/HCPtoHCA',
694
+ uri: relationUri,
695
+ startDate: { addedId: 'added|sd1' },
696
+ lineIds: ['rel345/createRelChange1/newValue']
697
+ },
698
+ lineIds: ['rel345/createRelChange1']
699
+ }
700
+ ],
701
+ _b));
702
+ });
703
+ it('should create separate UPDATE_START_DATE when no CREATE_RELATIONSHIP exists', function () {
704
+ var _a, _b;
705
+ var relationUri = 'relations/rel345';
706
+ var existingRelChanges = (_a = {},
707
+ _a[relationUri] = [
708
+ {
709
+ id: 'updateChange1',
710
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
711
+ newValue: { value: 'x' }
712
+ }
713
+ ],
714
+ _a);
715
+ var added = [
716
+ {
717
+ id: 'added|sd1',
718
+ objectUri: relationUri,
719
+ parentLineId: 'rel345/updateChange1',
720
+ attributeType: mdm_sdk_1.EntityAttrTypes.startDate
721
+ }
722
+ ];
723
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(existingRelChanges, added);
724
+ expect(result).toEqual((_b = {},
725
+ _b[relationUri] = [
726
+ {
727
+ id: 'updateChange1',
728
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
729
+ newValue: { value: 'x', lineIds: ['rel345/updateChange1/newValue'] },
730
+ lineIds: ['rel345/updateChange1']
731
+ },
732
+ {
733
+ id: 'added|sd1',
734
+ type: mdm_sdk_1.DCRTypes.UPDATE_START_DATE,
735
+ objectType: mdm_sdk_1.EntityAttrTypes.startDate.uri,
736
+ newValue: { value: undefined, addedId: 'added|sd1', lineIds: ['rel345/added|sd1/newValue'] },
737
+ lineIds: ['rel345/added|sd1']
738
+ }
739
+ ],
740
+ _b));
741
+ });
742
+ it('should resolve objectUri from objectId when full URI is not in changes', function () {
743
+ var changes = {
744
+ 'entities/someId123': [{ id: 'c1', type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE, newValue: { value: 'x' } }]
745
+ };
746
+ var attrType = createSimpleAttrType();
747
+ var added = [
748
+ {
749
+ id: 'added|resolve1',
750
+ objectUri: 'someId123',
751
+ attributeType: attrType
752
+ }
753
+ ];
754
+ var result = (0, mergeAddedAttributesWithDCRChanges_1.mergeAddedAttributesWithDCRChanges)(changes, added, false);
755
+ expect(result).toEqual({
756
+ 'entities/someId123': [
757
+ { id: 'c1', type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE, newValue: { value: 'x' } },
758
+ {
759
+ id: 'added|resolve1',
760
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
761
+ attributePath: 'FirstName',
762
+ attributeType: 'configuration/entityTypes/HCP/attributes/FirstName',
763
+ newValue: { value: undefined }
764
+ }
765
+ ]
766
+ });
767
+ });
768
+ });