/** * Knex-style migration runner for the vector battery. * * @module @nhtio/adk/batteries/vector/migrate */ import type { VectorSchemaBuilder } from "./schema"; /** The context passed to each migration's `up`/`down` — exposes the schema builder. */ export interface VectorMigrationContext { /** Schema facade for performing collection DDL within the migration. */ schema: VectorSchemaBuilder; } /** A single migration module: a name plus its forward (`up`) and reverse (`down`) steps. */ export interface VectorMigration { /** Unique migration name, used as its ledger key. */ name: string; /** Apply the migration. */ up: (ctx: VectorMigrationContext) => Promise; /** Reverse the migration. */ down: (ctx: VectorMigrationContext) => Promise; } /** Persistence for which migrations have run; backed by a store-provided implementation. */ export interface MigrationLedger { /** Resolve the names of migrations already applied, in application order. */ applied(): Promise; /** Record `name` as applied. */ record(name: string): Promise; /** Remove `name` from the applied set (on rollback). */ remove(name: string): Promise; } /** Construction options for a {@link VectorMigrator}. */ export interface VectorMigrateOptions { /** The ordered set of migration modules. */ migrations: VectorMigration[]; /** Ledger tracking which migrations have run. */ ledger: MigrationLedger; /** Schema facade handed to each migration. */ schema: VectorSchemaBuilder; } /** Knex-style migration runner: applies pending migrations forward and rolls the last one back. */ export declare class VectorMigrator { #private; /** * @param opts - The migrations, ledger, and schema facade to run against. */ constructor(opts: VectorMigrateOptions); /** * Apply every not-yet-applied migration in order, recording each in the ledger. * * @returns The names of the migrations applied during this run. * @throws {@link @nhtio/adk/batteries!E_VECTOR_STORE_MIGRATION_FAILED} when a migration's `up` throws. */ latest(): Promise; /** * Reverse the most recently applied migration and remove it from the ledger. * * @returns The name of the rolled-back migration, or `null` when nothing was applied. * @throws {@link @nhtio/adk/batteries!E_VECTOR_STORE_MIGRATION_FAILED} when the migration module is missing or * its `down` throws. */ rollback(): Promise; }