/**
 * Compatibility Contracts — Migration Registry
 *
 * The MigrationRegistry holds all registered schema migration steps and
 * provides path resolution and ordered execution for any version pair.
 *
 * @module contracts/migrations
 */
import { type MigrationStep, type MigrationResult, type SchemaVersion } from '../types.js';
/**
 * Central registry for all schema migration steps.
 *
 * Migrations are registered per contract name and resolved as an ordered
 * chain from a given source version to the current target version.
 * All migration functions must be pure (no mutations, no side effects).
 */
export declare class MigrationRegistry {
    private readonly steps;
    /**
     * Registers a migration step for a given contract.
     *
     * Steps are stored in insertion order and sorted at resolution time.
     * Duplicate from→to pairs for the same contract are not permitted.
     *
     * @param contract - The contract name (e.g. 'runtimeState').
     * @param step - The migration step to register.
     * @throws If a step with the same from→to is already registered.
     */
    register(contract: string, step: MigrationStep): void;
    /**
     * Returns true if any migration path exists from `fromVersion` toward
     * a higher version for the given contract.
     *
     * @param contract - The contract name.
     * @param fromVersion - The source schema version to migrate from.
     */
    canMigrate(contract: string, fromVersion: SchemaVersion): boolean;
    /**
     * Resolves an ordered chain of migration steps from `from` to `to`.
     *
     * Uses a greedy forward walk: at each version, finds the step that advances
     * closest to the target. Throws if no complete path exists.
     *
     * @param contract - The contract name.
     * @param from - The starting schema version.
     * @param to - The target schema version.
     * @returns Ordered array of MigrationSteps forming the complete path.
     * @throws If no migration path exists between the two versions.
     */
    getMigrationPath(contract: string, from: SchemaVersion, to: SchemaVersion): MigrationStep[];
    /**
     * Migrates data from `fromVersion` to the latest version reachable via
     * registered steps for the given contract.
     *
     * If `fromVersion` already matches the end of the migration chain,
     * the data is returned as-is without transformation.
     *
     * @param contract - The contract name.
     * @param data - The raw data to migrate.
     * @param fromVersion - The schema version of the incoming data.
     * @returns The migrated data and the version it was migrated to.
     * @throws If the migration path is incomplete or a step throws.
     */
    migrate(contract: string, data: unknown, fromVersion: SchemaVersion): MigrationResult;
    /**
     * Resolves the highest version reachable from `fromVersion` by following
     * the chain of registered steps.
     */
    private _resolveLatestVersion;
    /**
     * Returns all registered contract names.
     */
    contractNames(): string[];
}
//# sourceMappingURL=index.d.ts.map