import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-CHgpWQAY.js'; /** * Abstraction for file system operations needed by the migrator. * This allows dependency injection of file system operations, * avoiding bundling issues with Node.js fs module. */ interface FileSystemAdapter { /** * Read a text file and return its contents as a string */ readFile(filePath: string): Promise; /** * Read a binary file and return its contents as a Buffer */ readBinary(filePath: string): Promise; /** * Check if a file or directory exists */ exists(filePath: string): Promise; /** * Get file/directory statistics */ stat(filePath: string): Promise; /** * Write text data to a file */ writeFile(filePath: string, data: string | Buffer): Promise; /** * Write JSON data to a file with formatting */ writeJson(filePath: string, data: any, options?: { spaces?: number; }): Promise; /** * Ensure a directory exists, creating it and parent directories if needed */ ensureDir(dirPath: string): Promise; /** * Join path segments into a complete path */ joinPath(...segments: string[]): string; /** * Get the directory name of a path */ dirname(filePath: string): string; /** * Check if a path is absolute */ isAbsolute(filePath: string): boolean; } interface FileStats { isDirectory(): boolean; isFile(): boolean; size: number; } /** * Error thrown when file system operations fail */ declare class FileSystemError extends Error { readonly operation: string; readonly filePath: string; readonly cause?: Error | undefined; constructor(message: string, operation: string, filePath: string, cause?: Error | undefined); } declare class CouchDBToStaticPacker { private config; private sourceDB; constructor(config?: Partial); /** * Pack a CouchDB course database into static data structures */ packCourse(sourceDB: PouchDB.Database, courseId: string): Promise; /** * Pack a CouchDB course database and write the static files to disk */ packCourseToFiles(sourceDB: PouchDB.Database, courseId: string, outputDir: string, fsAdapter: FileSystemAdapter): Promise<{ manifest: StaticCourseManifest; filesWritten: number; attachmentsFound: number; }>; /** * Write packed course data to files using FileSystemAdapter */ private writePackedDataToFiles; private extractCourseConfig; private extractDesignDocs; private extractDocumentsByType; private createChunks; private prepareChunkData; private buildIndices; private buildEloIndex; private buildTagIndex; /** * Build view index by querying CouchDB views directly instead of parsing map functions */ private buildViewIndex; /** * Format CouchDB view results for static consumption */ private formatViewResults; /** * Format ELO view results - convert to sorted array format */ private formatEloViewIndex; /** * Format tags view results - convert to tag mapping format */ private formatTagsViewIndex; /** * Format inexperience view results - convert to experience-based format */ private formatInexperienceViewIndex; /** * Format generic view results - fallback for unknown views */ private formatGenericViewIndex; /** * Extract all attachments from documents and download binary data */ private extractAllAttachments; /** * Extract attachments for a single document */ private extractDocumentAttachments; /** * Transform attachment stubs to include file paths */ private transformAttachmentStubs; /** * Get file extension from content type */ private getFileExtension; } export { CouchDBToStaticPacker as C, type FileSystemAdapter as F, type FileStats as a, FileSystemError as b };