/** * Registry Download Service * * Handles downloading plugins from the curated registry by resolving * registry entries to downloadable plugin info using the appropriate sources. * * @since v1.54.0 */ import type { IPluginSource, PluginInfo, PluginSourceType } from '../types/index.js'; import type { RegistryPlugin } from './registry-types.js'; /** Progress info for a single plugin download */ export interface RegistryDownloadProgress { pluginName: string; percent: number; bytesDownloaded: number; totalBytes: number; status: 'downloading' | 'verifying' | 'done' | 'error'; message?: string; } /** Result of a single plugin download */ export interface RegistryDownloadResultBase { success: boolean; pluginName: string; version: string; filePath: string; bytesDownloaded: number; checksumValid?: boolean; error?: string; backedUpFile?: string; } /** Downloader contract — implemented by workflows/download.ts PluginDownloader */ export interface IPluginDownloader { download(info: PluginInfo): Promise; } /** Factory that creates a downloader from options */ export type DownloaderFactory = (options: { targetDir: string; backupExisting?: boolean; backupDir?: string; verifyChecksums?: boolean; onProgress?: (progress: RegistryDownloadProgress) => void; serverMcVersion?: string; hostJavaMajor?: number; strictCompat?: boolean; }) => IPluginDownloader; /** * Options for downloading from registry */ export interface RegistryDownloadOptions { /** Target directory (prod or test server plugins dir) */ targetDir: string; /** Specific version to download (default: latest) */ version?: string; /** Target Minecraft version for compatibility */ minecraftVersion?: string; /** Create backup of existing file */ backupExisting?: boolean; /** Backup directory */ backupDir?: string; /** Host Java major version for the class-version compat gate (Phase 4) */ hostJavaMajor?: number; /** Treat compat-gate warnings as failures (Phase 5 W2 config key) */ strictCompat?: boolean; /** Progress callback */ onProgress?: (progress: RegistryDownloadProgress) => void; } /** * Result of resolving a registry plugin to downloadable info */ export interface ResolveResult { success: boolean; pluginInfo?: PluginInfo; sourceType?: PluginSourceType; error?: string; triedSources?: string[]; } /** * Result of downloading from registry */ export interface RegistryDownloadResult extends RegistryDownloadResultBase { /** Which source was used */ sourceType?: PluginSourceType; /** Sources that were tried but failed */ triedSources?: string[]; } /** * Registry Download Service * * Resolves registry plugins to download URLs using configured sources */ export declare class RegistryDownloadService { private sources; private createDownloader; constructor(sources: IPluginSource[], createDownloader?: DownloaderFactory); /** * Resolve a registry plugin to downloadable PluginInfo * Tries sources in order of preference */ resolvePlugin(plugin: RegistryPlugin, options?: { minecraftVersion?: string; }): Promise; /** * Resolve plugin info from a specific source */ private resolveFromSource; /** * Get the source-specific identifier from a registry source config */ private getSourceId; /** * Download a plugin from the registry */ downloadPlugin(plugin: RegistryPlugin, options: RegistryDownloadOptions): Promise; /** * Download a plugin to multiple destinations */ downloadToMultiple(plugin: RegistryPlugin, destinations: { dir: string; name: string; }[], options: Omit): Promise<{ destination: string; result: RegistryDownloadResult; }[]>; /** * Check if a source is available for a registry plugin */ hasSource(plugin: RegistryPlugin): boolean; /** * Get available sources for a plugin */ getAvailableSources(plugin: RegistryPlugin): string[]; } /** * Create a registry download service */ export declare function createRegistryDownloadService(sources: IPluginSource[], createDownloader?: DownloaderFactory): RegistryDownloadService; //# sourceMappingURL=registry-download.d.ts.map