import { AbstractValidator } from '../types'; import { ObjectValidator } from '../validators/object'; import type { Schema, Validator } from '../types'; /** Constraints to validate a `URL` with. */ export interface URLConstraints { /** Constraint to validate the `href` component of the `URL`. */ href?: string | Validator; /** Constraint to validate the `origin` component of the `URL`. */ origin?: string | Validator; /** Constraint to validate the `protocol` component of the `URL`. */ protocol?: string | Validator; /** Constraint to validate the `username` component of the `URL`. */ username?: string | Validator; /** Constraint to validate the `password` component of the `URL`. */ password?: string | Validator; /** Constraint to validate the `host` (`hostname:port`) component of the `URL`. */ host?: string | Validator; /** Constraint to validate the `hostname` component of the `URL`. */ hostname?: string | Validator; /** Constraint to validate the `port` component of the `URL`. */ port?: string | Validator; /** Constraint to validate the `pathname` component of the `URL`. */ pathname?: string | Validator; /** Constraint to validate the `search` component of the `URL` as a string. */ search?: string | Validator; /** Constraint to validate the `hash` component of the `URL`. */ hash?: string | Validator; /** * Schema used to validate the `searchParams` component of the `URL`. * * The `searchParams` will be normalized in a `Record`, where * only the _first_ value associated with a search parameter will be checked. */ searchParams?: Schema; } /** A `Validator` validating URLs and converting them to `URL` instances. */ export declare class URLValidator extends AbstractValidator { readonly href?: Validator; readonly origin?: Validator; readonly protocol?: Validator; readonly username?: Validator; readonly password?: Validator; readonly host?: Validator; readonly hostname?: Validator; readonly port?: Validator; readonly pathname?: Validator; readonly search?: Validator; readonly hash?: Validator; readonly searchParams?: ObjectValidator; constructor(constraints?: URLConstraints); validate(value: unknown): URL; } export declare function urlFactory(constraints: URLConstraints): URLValidator; /** Validate URLs and convert them to `URL` instances. */ export declare const url: typeof urlFactory & URLValidator;