import type { IndexerAdapter, IndexerProviderOptions, IndexerSlice } from "@voyant-travel/catalog-contracts/indexer/contract"; import type { AnyDrizzleDb } from "@voyant-travel/db"; type PostgresVectorStrategy = "none" | "pgvector" | "lakebase"; type PostgresTypoStrategy = "none" | "pgtrgm"; type PostgresTextStrategy = "native" | "lakebase"; export interface PostgresIndexerOptions extends IndexerProviderOptions { /** The deployment-owned pooled database client. */ db: AnyDrizzleDb; /** * Recorded deployment capability. `pgvector` requires a provisioned vector * extension; the adapter never creates extensions or probes per request. */ vectorStrategy?: PostgresVectorStrategy; /** Recorded typo-recovery capability; pg_trgm remains deployment-owned. */ typoStrategy?: PostgresTypoStrategy; /** Recorded corpus-aware lexical capability provided by lakebase_text. */ textStrategy?: PostgresTextStrategy; /** HMAC material for opaque pagination cursors in a deployed provider. */ cursorSigningKey?: string; } export interface PostgresIndexerDiagnostics { candidateLimit: number; typoStrategy: PostgresTypoStrategy; textStrategy: PostgresTextStrategy; vectorDimensions: number | null; vectorStrategy: PostgresVectorStrategy; } export interface PostgresProjectionState { documentCount: number; generation: number; /** Documents safely staged for a retryable bulk rebuild but not yet published. */ stagedDocumentCount: number; updatedAt: Date | string; } export interface PostgresIndexerAdapter extends IndexerAdapter { /** Deployment-private cache invalidation token for one projection slice. */ projectionGeneration(slice: IndexerSlice): Promise; /** Deployment-private projection state for maintenance and cache diagnostics. */ projectionState(slice: IndexerSlice): Promise; /** Restore the immediately preceding atomically published projection, if retained. */ rollbackProjection(slice: IndexerSlice): Promise; /** Recorded capability state; no request-time extension or management probes. */ diagnostics(): PostgresIndexerDiagnostics; } /** * Native Postgres catalog search projection. * * This first slice deliberately uses only portable Postgres facilities: JSONB * storage for structural hit fidelity and a generated `tsvector` + GIN index * for bounded lexical retrieval. Lakebase BM25/ANN and pgvector strategies * build on the same projection in subsequent slices; they must be capability * selected rather than probed while serving a request. */ export declare function createPostgresIndexer(options: PostgresIndexerOptions): PostgresIndexerAdapter; export {};