import { z } from 'zod'; import { optional } from '../optional'; export declare const semVerZ: z.ZodString; export type SemVer = z.infer; export interface CompareSemVerOptions { /** * Whether to validate that major versions are equal. * @default true */ checkMajor?: boolean; /** * Whether to validate that minor versions are equal. * @default true */ checkMinor?: boolean; /** * Whether to validate that patch versions are equal. * @default true */ checkPatch?: boolean; } /** * Compares the two semantic versions. * * @param a The first semantic version. * @param b The second semantic version. * @param opts - Optional object to disable checking specific version parts * (major, minor, patch). * @returns a number, where the the number is compare.LESS_THAN (negative) if a is OLDER * than B, compare.EQUAL (0) if a is the same as b, and compare.GREATER_THAN (positive) * if a is NEWER than b. */ export declare const compareSemVer: (a: SemVer, b: SemVer, opts?: CompareSemVerOptions) => number; /** * @returns true if the two semantic versions are equal. * @param a - The first semantic version. * @param b - The second semantic version. * @param opts - Optional object to disable checking specific version parts * (major, minor, patch). */ export declare const versionsEqual: (a: SemVer, b: SemVer, opts?: CompareSemVerOptions) => boolean; /** * @returns true if the first semantic version is newer than the second. * @param a The first semantic version. * @param b The second semantic version. * @param opts - Optional object to disable checking specific version parts * (major, minor, patch). */ export declare const semVerNewer: (a: SemVer, b: SemVer, opts?: CompareSemVerOptions) => boolean; /** * @returns true if the first semantic version is older than the second. * @param a The first semantic version. * @param b The second semantic version. * @param opts - Optional object to disable checking specific version parts * (major, minor, patch). */ export declare const semVerOlder: (a: SemVer, b: SemVer, opts?: CompareSemVerOptions) => boolean; export type Migratable = { version: V; }; export type Migration = (input: I) => O; export interface MigrationProps { name: string; inputSchema?: ZI; outputSchema?: ZO; migrate: Migration; } export declare const createMigration: ({ name, migrate, }: MigrationProps) => Migration; /** * A record of migrations to be applied, where the key of the record is the * input version of the migration. */ export type Migrations = Record>; interface MigratorProps { name: string; migrations: Migrations; def: O; defaultVersion?: string; targetSchema?: ZO; } export type Migrator = , O>(v: I) => O; export declare const migrator: , O extends Migratable, ZO extends z.ZodType = z.ZodType>({ name, migrations, targetSchema, defaultVersion, def, }: MigratorProps) => ((v: I) => O); export {}; //# sourceMappingURL=migrate.d.ts.map