@resolveio/client-lib-core 15.0.3 → 15.0.4

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.
@@ -504,14 +504,26 @@ function deepDiffDetails(obj1, obj2) {
504
504
  return `${toTitleCase(key)}: from: ${formatValue(obj1[key])} to: ${formatValue(obj2[key])}`;
505
505
  }).join(', ');
506
506
  };
507
- if (Object.keys(diff.updated).length > 0) {
508
- diffString += 'Updated:\n';
509
- const updates = Object.keys(diff.updated)
510
- .filter(key => key.substr(0, 2) !== 'id' && diff.updated[key] !== obj2[key])
511
- .map(key => `${toTitleCase(key)}: {${formatObjectDiff(diff.updated[key], obj2[key])}}`)
512
- .join(',\n');
513
- diffString += updates ? `${updates}\n` : '';
514
- }
507
+ const handleDiffType = (diffObj, obj, key) => {
508
+ if (Array.isArray(diffObj[key])) {
509
+ return `${toTitleCase(key)}: ${formatArrayDiff(obj1[key] || [], obj2[key] || [])}`;
510
+ }
511
+ else if (typeof diffObj[key] === 'object') {
512
+ return `${toTitleCase(key)}: {${formatObjectDiff(obj1[key], obj2[key])}}`;
513
+ }
514
+ else {
515
+ return `${toTitleCase(key)}: from: ${formatValue(obj1[key])} to: ${formatValue(obj2[key])}`;
516
+ }
517
+ };
518
+ ['added', 'deleted', 'updated'].forEach(diffType => {
519
+ if (Object.keys(diff[diffType]).length > 0) {
520
+ diffString += `${toTitleCase(diffType)}:\n`;
521
+ const updates = Object.keys(diff[diffType])
522
+ .map(key => handleDiffType(diff[diffType], diffType === 'deleted' ? obj1 : obj2, key))
523
+ .join(',\n');
524
+ diffString += updates ? `${updates}\n` : '';
525
+ }
526
+ });
515
527
  return diffString;
516
528
  }
517
529
  function generateCronStringFromDate(date) {