/** * ADRFlow Storage Layer * * Provides persistent storage for ADRs using the memvid SDK. * Handles all I/O operations and ensures data integrity. * * @module adrflow/storage/store */ import type { ADR, ADRId, ADRStats, SearchOptions, SearchResult, TimelineOptions } from '../core/types.js'; /** * Storage configuration options */ export interface StorageConfig { /** Path to the .mv2 storage file */ readonly storagePath: string; /** Whether to create the storage if it doesn't exist */ readonly createIfMissing?: boolean; } /** * Storage interface for ADRs * * This abstract interface allows for different storage implementations * while maintaining a consistent API. */ export interface ADRStore { /** * Opens the storage connection * Must be called before any other operations */ open(): Promise; /** * Closes the storage connection * Should be called when done with the store */ close(): Promise; /** * Checks if the store is currently open */ isOpen(): boolean; /** * Saves an ADR to storage * Creates a new record or updates an existing one */ save(adr: ADR): Promise; /** * Retrieves an ADR by its ID * Returns undefined if not found */ get(id: ADRId): Promise; /** * Checks if an ADR exists */ exists(id: ADRId): Promise; /** * Deletes an ADR by ID * Returns true if deleted, false if not found */ delete(id: ADRId): Promise; /** * Lists all ADRs with optional filtering and pagination */ list(options?: SearchOptions): Promise; /** * Searches ADRs by text query * Uses full-text search on title, context, and decision */ search(query: string, options?: SearchOptions): Promise; /** * Gets ADRs in chronological order */ timeline(options?: TimelineOptions): Promise; /** * Gets the next available ADR ID */ getNextId(): Promise; /** * Gets statistics about the stored ADRs */ getStats(): Promise; /** * Compacts the storage file to reclaim space */ compact(): Promise; } /** * Memvid-backed implementation of ADR storage * * Uses the memvid SDK for high-performance, crash-safe storage * with full-text search and temporal querying. */ export declare class MemvidADRStore implements ADRStore { private readonly config; private memvid; private nextIdCounter; private adrCache; constructor(config: StorageConfig); open(): Promise; close(): Promise; isOpen(): boolean; private ensureOpen; save(adr: ADR): Promise; get(id: ADRId): Promise; exists(id: ADRId): Promise; delete(id: ADRId): Promise; list(options?: SearchOptions): Promise; search(query: string, options?: SearchOptions): Promise; timeline(options?: TimelineOptions): Promise; getNextId(): Promise; getStats(): Promise; compact(): Promise; /** * Loads all ADRs into the cache on startup */ private loadCache; /** * Extracts the numeric part of an ADR ID */ private extractIdNumber; } /** * Creates a new ADR store with default configuration */ export declare function createStore(storagePath: string): ADRStore; //# sourceMappingURL=store.d.ts.map