// storage/version-cache-store.ts — SPEC-664: Per-project package version cache with 7-day TTL
import { readJson, writeJson, projectDataDir } from './base-store.js';
import { join } from 'node:path';
const TTL_MS = 7 * 24 * 60 * 60 * 1000;
function cacheFile(projectId) {
    return join(projectDataDir(projectId), 'version-cache.json');
}
export function isExpired(entry) {
    const age = Date.now() - new Date(entry.resolvedAt).getTime();
    return age > TTL_MS;
}
export async function getCachedVersions(projectId) {
    return readJson(cacheFile(projectId), {});
}
export async function saveCachedVersions(projectId, cache) {
    await writeJson(cacheFile(projectId), cache);
}
//# sourceMappingURL=version-cache-store.js.map