function serializeConfig(config) {
    return JSON.stringify(config, (_key, value) => value !== null && typeof value === 'object' && !Array.isArray(value)
        ? Object.keys(value)
            .sort()
            .reduce((acc, k) => {
            acc[k] = value[k];
            return acc;
        }, {})
        : value);
}
function hasConfigChanged(before, after) {
    if (before === undefined && after === undefined)
        return false;
    if (before === undefined || after === undefined)
        return true;
    return serializeConfig(before) !== serializeConfig(after);
}
export function hasConnectionChanges(before, after) {
    const warehouseChanged = hasConfigChanged(before.warehouseConnection, after.warehouseConnection);
    const dbtChanged = hasConfigChanged(before.dbtConnection, after.dbtConnection);
    return warehouseChanged || dbtChanged;
}
//# sourceMappingURL=connectionChanges.js.map