Add warning on same destination secret sync

This commit is contained in:
Carlos Monastyrski
2025-09-29 17:30:16 -03:00
parent 83755d0bba
commit 67f2072756
10 changed files with 401 additions and 25 deletions
+31
View File
@@ -53,3 +53,34 @@ export const titleCaseToCamelCase = (obj: unknown): unknown => {
return result;
};
export const deepEqual = (obj1: unknown, obj2: unknown): boolean => {
if (obj1 === obj2) return true;
if (obj1 === null || obj2 === null || obj1 === undefined || obj2 === undefined) {
return obj1 === obj2;
}
if (typeof obj1 !== typeof obj2) return false;
if (typeof obj1 !== "object") return obj1 === obj2;
if (Array.isArray(obj1) !== Array.isArray(obj2)) return false;
if (Array.isArray(obj1)) {
const arr1 = obj1 as unknown[];
const arr2 = obj2 as unknown[];
if (arr1.length !== arr2.length) return false;
return arr1.every((val, idx) => deepEqual(val, arr2[idx]));
}
const keys1 = Object.keys(obj1 as Record<string, unknown>).sort();
const keys2 = Object.keys(obj2 as Record<string, unknown>).sort();
if (keys1.length !== keys2.length) return false;
if (keys1.some((key, idx) => key !== keys2[idx])) return false;
return keys1.every((key) =>
deepEqual((obj1 as Record<string, unknown>)[key], (obj2 as Record<string, unknown>)[key])
);
};