/** * Database Utilities * * Shared utility functions for database operations. * Single source of truth for common database helpers. */ import type { PromptRecord } from '../llm_api/types.js'; /** * Convert a database row to a PromptRecord object using column names * * This is the single source of truth for row-to-record conversion. * Used by both database initialization and prompt retrieval functions. * * @param row - Raw database row as array of values * @param columns - Array of column names from the query result * @returns PromptRecord object * * @example * ```typescript * const result = db.exec('SELECT * FROM hazo_prompts WHERE uuid = ?', [uuid]); * if (result.length > 0 && result[0].values.length > 0) { * const record = row_to_prompt_record(result[0].values[0], result[0].columns); * } * ``` */ export declare function row_to_prompt_record(row: unknown[], columns: string[]): PromptRecord; /** * Column indices for hazo_prompts table * Use these constants when building queries to ensure consistency */ export declare const PROMPT_COLUMNS: { readonly ID: 0; readonly PROMPT_AREA: 1; readonly PROMPT_KEY: 2; readonly LOCAL_1: 3; readonly LOCAL_2: 4; readonly LOCAL_3: 5; readonly USER_ID: 6; readonly SCOPE_ID: 7; readonly PROMPT_NAME: 8; readonly PROMPT_TEXT_HEAD: 9; readonly PROMPT_TEXT_BODY: 10; readonly PROMPT_TEXT_TAIL: 11; readonly PROMPT_VARIABLES: 12; readonly PROMPT_NOTES: 13; readonly CREATED_AT: 14; readonly CHANGED_AT: 15; readonly NEXT_PROMPT: 16; }; /** * SQL column names for hazo_prompts table */ export declare const PROMPT_COLUMN_NAMES: readonly ["id", "prompt_area", "prompt_key", "local_1", "local_2", "local_3", "user_id", "scope_id", "prompt_name", "prompt_text_head", "prompt_text_body", "prompt_text_tail", "prompt_variables", "prompt_notes", "created_at", "changed_at", "next_prompt"]; /** * Get the SELECT clause for all prompt columns * @returns SQL SELECT clause string */ export declare function get_prompt_select_clause(): string; //# sourceMappingURL=utils.d.ts.map