"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._purgeNonGuidsFromCatalog = _purgeNonGuidsFromCatalog;
const get_prop_1 = require("../../objects/get-prop");
const util_1 = require("../../util");
const is_guid_1 = require("../../utils/is-guid");
/**
 * Remove any non-guid entries from the data catalog groups array
 * @param {object} model Site Model
 * @private
 */
function _purgeNonGuidsFromCatalog(model) {
    if ((0, get_prop_1.getProp)(model, "item.properties.schemaVersion") >= 1.3)
        return model;
    const clone = (0, util_1.cloneObject)(model);
    const groups = (0, get_prop_1.getProp)(clone, "data.catalog.groups") || [];
    clone.data.catalog.groups = groups.filter(is_guid_1.isGuid);
    clone.item.properties.schemaVersion = 1.3;
    return clone;
}
//# sourceMappingURL=_purge-non-guids-from-catalog.js.map