/** * Attachment sync operation * * Synchronizes metadata with files on disk: * - Detects new files not in metadata * - Detects missing files (in metadata but not on disk) * - Infers role/label from filename pattern */ import type { ILibrary, IdentifierType } from "../../../core/library-interface.js"; /** * Options for syncAttachments operation */ export interface SyncAttachmentOptions { /** Reference identifier (id or uuid) */ identifier: string; /** Apply changes (add new files to metadata) */ yes?: boolean; /** Remove missing files from metadata */ fix?: boolean; /** Identifier type */ idType?: IdentifierType; /** Base directory for attachments */ attachmentsDirectory: string; /** Override inferred roles for specific files (key: filename) */ roleOverrides?: Record; /** Rename files on disk (key: current filename, value: new filename) */ renames?: Record; } /** * Inferred file from disk */ export interface InferredFile { filename: string; role: string; label?: string; } /** * Result of syncAttachments operation */ export interface SyncAttachmentResult { success: boolean; /** Files on disk but not in metadata */ newFiles: InferredFile[]; /** Files in metadata but not on disk */ missingFiles: string[]; /** Whether changes were applied */ applied: boolean; error?: string; } /** * Suggest a role for a file based on context (existing files and file extension). * * This is a pure function with no side effects. * Returns a suggested role string or null if no suggestion. */ export declare function suggestRoleFromContext(filename: string, existingFiles: InferredFile[]): string | null; /** * Synchronize attachments metadata with files on disk */ export declare function syncAttachments(library: ILibrary, options: SyncAttachmentOptions): Promise; //# sourceMappingURL=sync.d.ts.map