import type Database from 'better-sqlite3'; import type { Document, DocumentDetail, DocumentRegisterOptions, DocumentUpdateFields, SearchResult, ListOptions, SearchOptions } from '../models/document'; /** * Register a new document. * Wrapped with doc:global advisory lock (AD-0006) for multi-process coordination. */ export declare function registerDocument(db: Database.Database, id: string, type: string, title: string, opts?: DocumentRegisterOptions): Document; /** * List documents with optional filters, pagination, sorting, and count-only support. * Default ordering: ascending by id. * * When countOnly is true, returns { count: number } instead of Document[]. */ export declare function listDocuments(db: Database.Database, opts?: ListOptions): Document[] | { count: number; }; /** * Get a single document by ID. */ export declare function getDocument(db: Database.Database, id: string): Document; /** * Show document detail (with content if stored). * Content is fetched from document_contents (primary) or doc.path (fallback for * legacy documents registered before this fix). */ export declare function showDocument(db: Database.Database, id: string): DocumentDetail; /** * Update document metadata. * Wrapped with doc:global advisory lock (AD-0006) for multi-process coordination. * --meta replaces entirely (not merge), per spec. * * MOD-021: When fields.type changes the document type, the old entity is deleted * (with relation cascade) and a new entity is created with the updated type mapping. * All operations (content upsert, entity sync, document update) run within a single * atomic transaction per FS-SS-021-0004. */ export declare function updateDocument(db: Database.Database, id: string, fields: DocumentUpdateFields): Document; /** * Remove a document registration. * Wrapped with doc:global advisory lock (AD-0006) for multi-process coordination. * * Deletion ordering per SAD-0035 (3-step sequence after entities table drop): * Step 1: Delete relations (outgoing and incoming) referencing the document * Step 2: Delete document_contents row (UNCONDITIONAL per AD-0028 — FK constraint * requires content deletion before the document row is removed) * Step 3: Delete document row * * Content is always deleted unconditionally per AD-0028 — there is no soft-delete option. */ export declare function removeDocument(db: Database.Database, id: string): void; /** * Full-text search across document contents with pagination, sorting, count-only support, and type filtering. * Default ordering: FTS5 BM25 relevance ranking (descending). * When --order-by is specified, results are sorted by the given column via SQL subquery instead of by rank. * * When countOnly is true, returns { count: number } instead of SearchResult[]. */ export declare function searchDocuments(db: Database.Database, query: string, opts?: SearchOptions): SearchResult[] | { count: number; }; //# sourceMappingURL=document-service.d.ts.map