import Database from "better-sqlite3"; import type { FoodItem, CacheStats } from "./types.js"; import type { FoodResponse, SearchResponse } from "./types.js"; export declare class NutritionStore { db: Database.Database; private dbPath; constructor(dbPath?: string); reopen(): void; private openDatabase; /** * Idempotent, additive-only migration for DBs created before is_correction/verified_fields * existed (CREATE TABLE IF NOT EXISTS does not add columns to an already-existing table). Safe * to run against the live 232MB production DB: no rows are rewritten or dropped, only two * nullable/defaulted columns are added, wrapped in a transaction so it never half-applies. */ private migrateSchema; search(query: string, limit?: number): SearchResponse[]; /** Raw canonical row, no response shaping — for internal engine use (e.g. override() * inheritance) that must never see serving-scaled values. */ private getRawRow; /** * The id of the correction that supersedes `id`, or null. Exposed for callers (the search * orchestrator's freshly-fetched-USDA path) that build a response from an in-memory object * rather than a full row read, so they still reflect a pre-existing correction rather than * silently assuming none exists. */ findSupersededBy(id: string): string | null; lookup(id: string): FoodResponse | null; lookupByBarcode(barcode: string): FoodResponse | null; upsert(food: Omit): void; insertBulk(foods: Array>): void; getStats(): CacheStats; listCached(tier?: "usda" | "web" | "all", limit?: number, offset?: number): SearchResponse[]; delete(id: string): { deleted: boolean; reason?: string; }; private getRawRowBySourceId; override(id: string, fields: Partial>): { overridden: boolean; override_id?: string; reason?: string; }; static generateId(prefix: string): string; close(): void; }