export interface RawStorageOptions {
    userId: string;
    fileBuffer: Buffer;
    mimeType: string;
    originalFilename?: string;
    sourceType?: string;
    provenance?: Record<string, unknown>;
    idempotencyKey?: string;
}
export interface RawStorageResult {
    sourceId: string;
    contentHash: string;
    storageUrl: string;
    fileSize: number;
    deduplicated: boolean;
    idempotencyKey?: string;
}
/**
 * Compute SHA-256 hash of file content
 */
export declare function computeContentHash(buffer: Buffer): string;
/**
 * Store raw file content with content-addressed deduplication.
 * Idempotent: second calls with the same content return the existing source
 * (or claim the existing file in DB) instead of throwing "file already exists".
 *
 * Storage path: sources/{user_id}/{content_hash}
 * Deduplication: Per-user uniqueness on (user_id, content_hash)
 */
export declare function storeRawContent(options: RawStorageOptions): Promise<RawStorageResult>;
/**
 * Get source metadata by ID
 */
export declare function getSourceMetadata(sourceId: string): Promise<any>;
/** Thrown when the stored file is missing (e.g. ENOENT on local storage). Callers can catch and skip or retry. */
export declare class SourceFileNotFoundError extends Error {
    readonly storageUrl: string;
    readonly code = "SOURCE_FILE_NOT_FOUND";
    constructor(message: string, storageUrl: string);
}
/**
 * Download raw content from storage
 */
export declare function downloadRawContent(storageUrl: string, bucketName?: string): Promise<Buffer>;
/**
 * Absolute filesystem path for a row's `storage_url` when using local raw storage
 * (`sources` bucket → {@link config.rawStorageDir} + object key).
 * Returns null for non-file keys (e.g. `internal://…`) or non-local backends.
 */
export declare function resolveLocalSourceFilePath(storageUrl: string | null | undefined): string | null;
//# sourceMappingURL=raw_storage.d.ts.map