/** * @module minions-sdk/index-layer/neon * Neon (serverless Postgres) index adapter for the Minions system. * * Requires the `@neondatabase/serverless` package as an optional peer dependency. * * Stores index entries in a Postgres table with full-text search via * `to_tsvector` / `ts_query`. Uses the same schema approach as the * Supabase index adapter but communicates directly via the Neon client. * * @example * ```typescript * import { neon } from '@neondatabase/serverless'; * import { NeonIndexAdapter } from 'minions-sdk'; * * const sql = neon(process.env.NEON_DATABASE_URL!); * const index = new NeonIndexAdapter(sql); * const minions = new Minions({ storage, index }); * ``` */ import type { StorageFilter } from '../storage/StorageAdapter.js'; import type { IndexAdapter, IndexEntry } from './IndexAdapter.js'; /** Row result from a Neon query. */ type NeonRow = Record; /** * Minimal interface for a Neon `sql` tagged template function. * * The `neon()` function from `@neondatabase/serverless` returns a function * with this signature. */ export interface NeonClientLike { (strings: TemplateStringsArray, ...values: unknown[]): Promise; } /** Options for the Neon index adapter. */ export interface NeonIndexOptions { /** * Name of the Postgres table for the index. * Defaults to `"minion_index"`. */ table?: string; } /** * Index adapter backed by **Neon** (serverless Postgres). * * Use {@link NeonIndexAdapter.createTableSQL} to get the DDL for creating * the index table. * * @example * ```sql * CREATE TABLE IF NOT EXISTS minion_index ( * id TEXT PRIMARY KEY, * title TEXT NOT NULL, * description TEXT, * minion_type_id TEXT NOT NULL, * status TEXT, * priority TEXT, * tags TEXT[], * searchable_text TEXT NOT NULL, * created_at TEXT NOT NULL, * updated_at TEXT NOT NULL, * deleted_at TEXT * ); * CREATE INDEX IF NOT EXISTS idx_minion_index_fts * ON minion_index USING gin(to_tsvector('english', searchable_text)); * ``` */ export declare class NeonIndexAdapter implements IndexAdapter { private sql; private table; constructor(sql: NeonClientLike, options?: NeonIndexOptions); /** * Returns the SQL DDL for creating the index table. * Run this in your Neon console or in a migration. */ static createTableSQL(table?: string): string; private fromRow; upsert(entry: IndexEntry): Promise; remove(id: string): Promise; list(filter?: StorageFilter): Promise; search(query: string): Promise; count(filter?: StorageFilter): Promise; clear(): Promise; } export {}; //# sourceMappingURL=NeonIndexAdapter.d.ts.map