@resolveio/client-lib-core 15.0.3 → 15.0.5
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/esm2020/lib/util/common.helper.mjs +24 -28
- package/fesm2015/resolveio-client-lib-core.mjs +23 -27
- package/fesm2015/resolveio-client-lib-core.mjs.map +1 -1
- package/fesm2020/resolveio-client-lib-core.mjs +23 -27
- package/fesm2020/resolveio-client-lib-core.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -473,22 +473,13 @@ function deepDiffDetails(obj1, obj2) {
|
|
|
473
473
|
return typeof value === 'string' ? `"${value}"` : String(value);
|
|
474
474
|
};
|
|
475
475
|
const formatArrayDiff = (arr1, arr2) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
arrayDiff.push(`added: ${formatValue(arr2[i])}`);
|
|
481
|
-
continue;
|
|
476
|
+
return arr1.map((item, index) => {
|
|
477
|
+
const arr2Item = arr2[index];
|
|
478
|
+
if (typeof item === 'object' && item !== null && arr2Item !== undefined) {
|
|
479
|
+
return `{${formatObjectDiff(item, arr2Item)}}`;
|
|
482
480
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
continue;
|
|
486
|
-
}
|
|
487
|
-
if (arr1[i] !== arr2[i]) {
|
|
488
|
-
arrayDiff.push(`from: ${formatValue(arr1[i])} to: ${formatValue(arr2[i])}`);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return `[${arrayDiff.join(', ')}]`;
|
|
481
|
+
return arr2Item !== undefined ? `from: ${formatValue(item)} to: ${formatValue(arr2Item)}` : `removed: ${formatValue(item)}`;
|
|
482
|
+
}).join(', ');
|
|
492
483
|
};
|
|
493
484
|
const formatObjectDiff = (obj1, obj2) => {
|
|
494
485
|
if (obj1 === null || obj2 === null || typeof obj1 !== 'object' || typeof obj2 !== 'object') {
|
|
@@ -497,21 +488,26 @@ function deepDiffDetails(obj1, obj2) {
|
|
|
497
488
|
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
498
489
|
return formatArrayDiff(obj1, obj2);
|
|
499
490
|
}
|
|
500
|
-
return Object.keys(obj1).map(key => {
|
|
501
|
-
|
|
502
|
-
|
|
491
|
+
return Object.keys({ ...obj1, ...obj2 }).map(key => {
|
|
492
|
+
const obj1Val = obj1[key], obj2Val = obj2[key];
|
|
493
|
+
if (typeof obj1Val === 'object' && obj1Val !== null && obj2Val !== null) {
|
|
494
|
+
return `${toTitleCase(key)}: {${formatObjectDiff(obj1Val, obj2Val)}}`;
|
|
503
495
|
}
|
|
504
|
-
return `${toTitleCase(key)}: from: ${formatValue(
|
|
496
|
+
return `${toTitleCase(key)}: from: ${formatValue(obj1Val)} to: ${formatValue(obj2Val)}`;
|
|
505
497
|
}).join(', ');
|
|
506
498
|
};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
499
|
+
['added', 'deleted', 'updated'].forEach(diffType => {
|
|
500
|
+
if (Object.keys(diff[diffType]).length > 0) {
|
|
501
|
+
diffString += `${toTitleCase(diffType)}:\n`;
|
|
502
|
+
const updates = Object.keys(diff[diffType])
|
|
503
|
+
.map(key => {
|
|
504
|
+
const currentValue = diffType === 'deleted' ? obj1[key] : obj2[key];
|
|
505
|
+
return `${toTitleCase(key)}: {${formatObjectDiff(diff[diffType][key], currentValue)}}`;
|
|
506
|
+
})
|
|
507
|
+
.join(',\n');
|
|
508
|
+
diffString += updates ? `${updates}\n` : '';
|
|
509
|
+
}
|
|
510
|
+
});
|
|
515
511
|
return diffString;
|
|
516
512
|
}
|
|
517
513
|
function generateCronStringFromDate(date) {
|