import type { Dataset, DatasetStore, Experiment, ExperimentStore } from '../types/evaluate.js'; import type { MigrationResult, SchemaMigration } from '../utils/schema-migrations.js'; import { type PostgresLikeClient } from './client.js'; import type { PostgresMigrateOptions } from './migrations.js'; /** Options for the Postgres evaluation stores. */ export interface PostgresEvaluationStoreOptions { /** Datasets table. Defaults to `nexus_datasets`. */ datasetsTable?: string; /** Experiments table. Defaults to `nexus_experiments`. */ experimentsTable?: string; } /** * The versioned schema, which `migrate()` and `nexus db migrate` apply. Version 1 is the 2.0 schema. */ export declare function evaluationStoreMigrations(options?: PostgresEvaluationStoreOptions): SchemaMigration[]; /** The schema for both tables, as statements. */ export declare function evaluationStoreMigration(options?: PostgresEvaluationStoreOptions): string[]; /** * Dataset versions in Postgres, keyed by name and content version. * * Saving the same version twice replaces it, which is safe because a version is derived from the * examples: the same version is the same content. */ export declare class PostgresDatasetStore implements DatasetStore { private readonly client; private readonly options; private readonly table; constructor(client: PostgresLikeClient, options?: PostgresEvaluationStoreOptions); /** * Applies this store's pending migrations, recorded in `nexus_schema_migrations`, under a lock. * Never runs implicitly. Safe on a database an older release created: what exists is kept. */ migrate(options?: PostgresMigrateOptions): Promise; /** Stores a dataset version, replacing one with the same name and version. */ save(dataset: Dataset): Promise; /** Returns a version, or the newest when none is given. */ get(name: string, version?: string): Promise; /** Every dataset name with its versions. */ list(): Promise>; } /** Experiments in Postgres, newest first by start time. */ export declare class PostgresExperimentStore implements ExperimentStore { private readonly client; private readonly options; private readonly table; constructor(client: PostgresLikeClient, options?: PostgresEvaluationStoreOptions); /** * Applies this store's pending migrations, recorded in `nexus_schema_migrations`, under a lock. * Never runs implicitly. Safe on a database an older release created: what exists is kept. */ migrate(options?: PostgresMigrateOptions): Promise; /** Stores an experiment, replacing one with the same id. */ save(experiment: Experiment): Promise; /** Reads an experiment by id. */ get(id: string): Promise; /** Experiments, newest first, filtered by name or dataset. Defaults to 50. */ list(filter?: { name?: string; dataset?: string; limit?: number; }): Promise; }