"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.migrateAndValidateConfig = void 0;
const migration_1 = require("../../../../config/migration");
const validation_1 = require("../../../../config/validation");
const logger_1 = require("../../../../logger");
async function migrateAndValidateConfig(config, configType) {
    const { isMigrated, migratedConfig } = (0, migration_1.migrateConfig)(config);
    if (isMigrated) {
        logger_1.logger.warn({ originalConfig: config, migratedConfig }, `${configType} needs migrating`);
    }
    const { warnings, errors } = await (0, validation_1.validateConfig)('global', migratedConfig);
    if (warnings.length) {
        logger_1.logger.warn({ warnings }, `Config validation warnings found in ${configType}`);
    }
    if (errors.length) {
        logger_1.logger.warn({ errors }, `Config validation errors found in ${configType}`);
    }
    return migratedConfig;
}
exports.migrateAndValidateConfig = migrateAndValidateConfig;
//# sourceMappingURL=util.js.map