import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs"; import { PrimitiveValidator } from "./primitive-validator.mjs"; //#region ../@warlock.js/seal/src/validators/number-validator.d.ts /** * Number validator class - base for Int and Float validators */ declare class NumberValidator extends PrimitiveValidator { constructor(errorMessage?: string); /** * Check if value is a number type */ matchesType(value: any): boolean; /** * Value must be equal or higher than the given number or field * Smart detection: number or field name * * @category Validation Rule */ min(min: number | string, errorMessage?: string): this; /** * Value must be equal or less than the given number or field * Smart detection: number or field name * * @category Validation Rule */ max(max: number | string, errorMessage?: string): this; /** * Value must be >= sibling field value * @category Validation Rule */ minSibling(field: string, errorMessage?: string): this; /** * Value must be <= sibling field value * @category Validation Rule */ maxSibling(field: string, errorMessage?: string): this; /** * Value must be strictly greater than the given number or field (>) * Smart detection: number or field name * * @category Validation Rule */ greaterThan(value: number | string, errorMessage?: string): this; /** * Value must be strictly less than the given number or field (<) * Smart detection: number or field name * * @category Validation Rule */ lessThan(value: number | string, errorMessage?: string): this; /** * Alias for greaterThan() - shorter syntax * @category Validation Rule */ gt(value: number | string, errorMessage?: string): this; /** * Alias for lessThan() - shorter syntax * @category Validation Rule */ lt(value: number | string, errorMessage?: string): this; /** * Value must be > sibling field value * @category Validation Rule */ greaterThanSibling(field: string, errorMessage?: string): this; /** * Alias for greaterThanSibling() - shorter syntax * @category Validation Rule */ gtSibling(field: string, errorMessage?: string): this; /** * Value must be < sibling field value * @category Validation Rule */ lessThanSibling(field: string, errorMessage?: string): this; /** * Alias for lessThanSibling() - shorter syntax * @category Validation Rule */ ltSibling(field: string, errorMessage?: string): this; /** Value must be a modulo of the given number */ modulo(value: number, errorMessage?: string): this; /** * Alias for modulo() - Value must be divisible by the given number */ divisibleBy(value: number, errorMessage?: string): this; /** * Alias for modulo() - Value must be a multiple of the given number */ multipleOf(value: number, errorMessage?: string): this; /** * Alias for modulo() - Value must be a multiple of the given number */ modulusOf(value: number, errorMessage?: string): this; /** Accept only numbers higher than 0 */ positive(errorMessage?: string): this; /** Accept only negative numbers */ negative(errorMessage?: string): this; /** Accept only odd numbers */ odd(errorMessage?: string): this; /** Accept only even numbers */ even(errorMessage?: string): this; /** * Accept only numbers between the given two numbers or fields (Inclusive) * Smart detection: number or field name * * @category Validation Rule */ between(min: number | string, max: number | string, errorMessage?: string): this; /** * Value must be between sibling field values * @category Validation Rule */ betweenSibling(minField: string, maxField: string, errorMessage?: string): this; /** * Value (as a string) must be exactly this many characters. * Useful for fixed-format numeric codes (e.g. 4-digit PIN). */ length(length: number, errorMessage?: string): this; /** Value (as string representation) length must be ≥ min */ minLength(length: number, errorMessage?: string): this; /** Value (as string representation) length must be ≤ max */ maxLength(length: number, errorMessage?: string): this; /** * Convert value to its absolute value */ abs(): this; /** * Round value up to the nearest integer */ ceil(): this; /** * Round value down to the nearest integer */ floor(): this; /** * Round value to the nearest integer or specified decimals */ round(decimals?: number): this; /** * Format number using fixed-point notation */ toFixed(decimals?: number): this; /** * @inheritdoc * * Returns `{ type: "number" }` with numeric constraint keywords. * IntValidator overrides `type` to `"integer"`. * * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable * in JSON Schema and are silently omitted. * * @example * ```ts * v.number().min(0).max(100).toJsonSchema("draft-2020-12") * // → { type: "number", minimum: 0, maximum: 100 } * ``` */ toJsonSchema(target?: JsonSchemaTarget): JsonSchemaResult; /** * Shared logic for number/integer JSON Schema generation. * Called by NumberValidator.toJsonSchema() (→ type: "number") * and IntValidator.toJsonSchema() (→ type: "integer"). */ protected buildNumberJsonSchema(type: "number" | "integer", target: JsonSchemaTarget): JsonSchemaResult; } //#endregion export { NumberValidator }; //# sourceMappingURL=number-validator.d.mts.map