import { type EnvConfig } from '../config/env.js'; import { type ProjectCache, type ArtifactRecord, type VerifiedDeviceRecord } from './types.js'; /** * SQLite-backed persistent storage for the MCP server. * * Manages project cache entries, generic key/value cache with TTL, * and artifact records. Uses WAL mode and foreign keys for safety. * All public methods are safe — errors are logged internally and * never thrown to the caller. */ export declare class Storage { private db; private config; private initialized; constructor(config: EnvConfig); /** Initialise the schema (tables + indexes). Safe to call multiple times. */ initialize(): void; /** Retrieve a cached value by key. Returns `null` when missing or expired. */ cacheGet(key: string): string | null; /** * Store a value in the cache. * @param ttlSec Time-to-live in seconds. 0 means never expire. */ cacheSet(key: string, value: string, ttlSec?: number): void; /** Remove a single cache entry by key. */ cacheDelete(key: string): void; /** Remove all cache entries. */ cacheClear(): void; /** Look up a project cache entry by its hash. Returns `null` if not found. */ getProjectCache(hash: string): ProjectCache | null; /** Insert or replace a project cache entry. */ upsertProjectCache(cache: ProjectCache): void; /** Store a new artifact record (gerber, bom, pdf, etc.). */ insertArtifact(artifact: ArtifactRecord): void; /** * List artifact records for a project, optionally filtered by type. * Results are ordered by creation date descending. */ getArtifacts(projectHash: string, type?: string): ArtifactRecord[]; /** Insert or replace a verified-device cache entry, keyed by LCSC id. */ upsertVerifiedDevice(record: Omit): void; /** Look up a cached verified-device entry by LCSC id. Returns `null` if not found. */ getVerifiedDevice(lcscId: string): VerifiedDeviceRecord | null; /** List cached verified devices, optionally filtered by status, newest first. */ listVerifiedDevices(status?: VerifiedDeviceRecord['status']): VerifiedDeviceRecord[]; /** Remove a cached verified-device entry by LCSC id. */ deleteVerifiedDevice(lcscId: string): void; /** Reclaim storage by running VACUUM. */ vacuum(): void; /** Close the database connection. */ close(): void; }