/** * Compute content hash for change detection (first 16 chars of SHA-256) */ export declare function computeContentHash(markdown: string): Promise; export interface DatabaseAdapter { all: (sql: string, params?: unknown[]) => Promise; first: (sql: string, params?: unknown[]) => Promise; exec: (sql: string, params?: unknown[]) => Promise; close?: () => Promise; } export interface InitSchemaOptions { /** FTS5 tokenizer (default: 'unicode61 remove_diacritics 2'). Use 'trigram' for CJK locales. */ ftsTokenizer?: string; } /** * Initialize database schema with version checking. * Rebuilds when SCHEMA_VERSION changes or when the configured FTS5 tokenizer * differs from the one baked into the existing virtual table (e.g. user added * a CJK locale on a later deploy). */ export declare function initSchema(db: DatabaseAdapter, options?: InitSchemaOptions): Promise; /** * Normalize route to storage key format * e.g., '/about/team' -> 'about:team', '/' -> 'index' */ export declare function normalizeRouteKey(route: string): string; /** * Compress data to base64 gzip */ export declare function compressToBase64(data: unknown): Promise; /** * Decompress from base64 gzip */ export declare function decompressFromBase64(base64: string): Promise; export interface PageInput { route: string; title: string; description: string; markdown: string; headings: string; keywords: string[]; contentHash?: string; updatedAt: string; isError?: boolean; source?: 'prerender' | 'runtime'; locale?: string; } export interface PageOutput { route: string; title: string; description: string; markdown: string; headings: string; keywords: string[]; contentHash?: string; updatedAt: string; isError: boolean; locale: string; } export interface PageMetaOutput { route: string; title: string; description: string; headings: string; keywords: string[]; contentHash?: string; updatedAt: string; isError: boolean; locale: string; } /** * Insert or update a page */ export declare function insertPage(db: DatabaseAdapter, page: PageInput): Promise; export interface QueryAllPagesOptions { includeErrors?: boolean; excludeMarkdown?: boolean; } /** * Query all pages from database * @param db - Database adapter * @param options - Query options * @param options.excludeMarkdown - If true, omit markdown field to reduce memory usage */ export declare function queryAllPages(db: DatabaseAdapter, options?: QueryAllPagesOptions & { excludeMarkdown: true; }): Promise; export declare function queryAllPages(db: DatabaseAdapter, options?: QueryAllPagesOptions & { excludeMarkdown?: false; }): Promise; export declare function queryAllPages(db: DatabaseAdapter, options?: QueryAllPagesOptions): Promise; export interface DumpRow { route: string; route_key: string; title: string; description: string; markdown: string; headings: string; keywords: string; content_hash: string | null; updated_at: string; indexed_at: number; is_error: number; indexed: number; source: string; last_seen_at: number | null; indexnow_synced_at: number | null; locale: string | null; } /** * Export database as compressed dump (base64 gzip) using batched streaming * Processes rows in batches to avoid loading entire database into memory */ export declare function exportDbDump(db: DatabaseAdapter): Promise; /** * Import dump into database * Sets indexed=1, last_seen_at=indexed_at, indexnow_synced_at=indexed_at * (pages from dump were already indexed and synced during build, no need to re-notify) */ export declare function importDbDump(db: DatabaseAdapter, rows: DumpRow[]): Promise;