"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isValidRev13 = exports.isValidRev12 = exports.isValidRev11 = exports.isValidRev10 = exports.CACHE_REVISION = void 0;
const tslib_1 = require("tslib");
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
// Increment this whenever there could be incompatibilities between old and new cache structure
exports.CACHE_REVISION = 13;
function isValidRev10(input, repo) {
    return (is_1.default.plainObject(input) &&
        is_1.default.safeInteger(input.revision) &&
        input.revision === 10 &&
        is_1.default.string(input.repository) &&
        (!repo || repo === input.repository));
}
exports.isValidRev10 = isValidRev10;
function isValidRev11(input, repo) {
    return (is_1.default.plainObject(input) &&
        is_1.default.safeInteger(input.revision) &&
        input.revision === 11 &&
        is_1.default.string(input.repository) &&
        is_1.default.plainObject(input.data) &&
        (!repo || repo === input.repository));
}
exports.isValidRev11 = isValidRev11;
function isValidRev12Shape(input, repo) {
    return (is_1.default.plainObject(input) &&
        is_1.default.safeInteger(input.revision) &&
        is_1.default.string(input.repository) &&
        is_1.default.string(input.payload) &&
        is_1.default.string(input.hash));
}
function isValidRev12(input, repo) {
    return (isValidRev12Shape(input, repo) &&
        input.revision === 12 &&
        (!repo || repo === input.repository));
}
exports.isValidRev12 = isValidRev12;
function isValidRev13(input) {
    return (is_1.default.plainObject(input) &&
        is_1.default.string(input.fingerprint) &&
        isValidRev12Shape(input) &&
        input.revision === 13);
}
exports.isValidRev13 = isValidRev13;
//# sourceMappingURL=common.js.map