/** * Cache Types * * Type definitions for the caching system */ /** * Cache entry metadata stored in the manifest */ export interface CacheEntryMeta { /** SHA-256 checksum of the file contents */ checksum: string; /** ISO timestamp when the entry was last updated */ updatedAt: string; /** TTL in milliseconds */ ttlMs: number; /** Cache format version for this entry type */ formatVersion: string; } /** * Cache manifest structure */ export interface CacheManifest { /** Manifest format version */ version: string; /** ISO timestamp when manifest was created */ createdAt: string; /** Map of cache entry names to their metadata */ entries: Record; } /** * Plugin update result cache entry */ export interface CachedUpdateResult { /** Current version installed */ currentVersion: string; /** Latest version available */ latestVersion: string; /** Whether an update is available */ hasUpdate: boolean; /** Download URL if available */ downloadUrl?: string; /** File checksum if available */ fileChecksum?: string; /** Source type (spigot, modrinth, github, etc) */ source: string; /** Source-specific ID (resource ID, project slug, etc) */ sourceId?: string; /** * Why automatic download is unavailable ('premium' | 'external-page'). * Mirrors PluginInfo.manualDownloadReason — without it, a cache round-trip * silently dropped the runtime premium detection and a cached premium * result flipped back into the auto-download bucket (Phase 3, roadmap 3.1). */ manualDownloadReason?: 'premium' | 'external-page'; /** ISO timestamp when this was checked */ checkedAt: string; } /** * Update results cache file structure */ export interface UpdateResultsCache { /** Cache format version */ version: string; /** ISO timestamp of the last update check */ lastChecked: string; /** Map of plugin names to their update results */ results: Record; } /** * Minecraft versions cache file structure */ export interface MinecraftVersionsCache { /** Cache format version */ version: string; /** ISO timestamp when versions were fetched */ fetchedAt: string; /** List of version strings, newest first */ versions: string[]; } /** * Source metadata cache entry */ export interface CachedSourceMetadata { /** Plugin name */ name: string; /** Source type */ source: string; /** Source-specific ID */ sourceId: string; /** Description if available */ description?: string; /** Author if available */ author?: string; /** Project URL if available */ projectUrl?: string; /** ISO timestamp when fetched */ fetchedAt: string; } /** * Source metadata cache file structure */ export interface SourceMetadataCache { /** Cache format version */ version: string; /** Map of cache keys to metadata */ entries: Record; } /** * Server JAR versions cache file structure */ export interface ServerJarVersionsCache { /** Cache format version */ version: string; /** ISO timestamp when fetched */ fetchedAt: string; /** Map of server type to available versions */ servers: Record; } /** * Failed download entry - tracks plugins that couldn't be downloaded */ export interface FailedDownloadEntry { /** Plugin name */ pluginName: string; /** HTTP status code (404, 403, etc.) or error type */ statusCode?: number; /** Error message */ errorMessage: string; /** ISO timestamp when the failure occurred */ failedAt: string; /** Number of consecutive failures */ failureCount: number; } /** * Failed downloads cache file structure */ export interface FailedDownloadsCache { /** Cache format version */ version: string; /** Map of plugin names to their failure info */ failures: Record; } /** * Cache configuration options */ export interface CacheConfig { /** Base directory for cache files (default: ./data/.cache) */ cacheDir: string; /** TTL for update results in ms (default: 1 hour) */ updateResultsTtlMs: number; /** TTL for MC versions in ms (default: 24 hours) */ mcVersionsTtlMs: number; /** TTL for source metadata in ms (default: 6 hours) */ sourceMetadataTtlMs: number; /** TTL for server JAR versions in ms (default: 24 hours) */ serverJarVersionsTtlMs: number; /** TTL for failed downloads in ms (default: 7 days) */ failedDownloadsTtlMs: number; /** Whether to validate checksums on load (default: true) */ validateChecksums: boolean; } /** * Default cache configuration */ export declare const DEFAULT_CACHE_CONFIG: CacheConfig; /** * Cache entry names (file names without extension) */ export declare const CACHE_ENTRIES: { readonly MANIFEST: "manifest"; readonly UPDATE_RESULTS: "update-results"; readonly MC_VERSIONS: "mc-versions"; readonly SOURCE_METADATA: "source-metadata"; readonly SERVER_JAR_VERSIONS: "server-jar-versions"; readonly FAILED_DOWNLOADS: "failed-downloads"; }; export type CacheEntryName = (typeof CACHE_ENTRIES)[keyof typeof CACHE_ENTRIES]; /** * Cache load result with freshness info */ export interface CacheLoadResult { /** The cached data, or null if not found/invalid */ data: T | null; /** Whether the cache entry exists */ exists: boolean; /** Whether the data is still fresh (within TTL) */ isFresh: boolean; /** Whether the checksum was valid (if validation enabled) */ isValid: boolean; /** ISO timestamp when the entry was last updated */ updatedAt: string | null; /** Age of the cache entry in milliseconds */ ageMs: number; /** Error message if load failed */ error?: string; } //# sourceMappingURL=types.d.ts.map