import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs"; import { SchemaContext } from "../types/context-types.mjs"; import { ValidationResult } from "../types/result-types.mjs"; import { BaseValidator } from "./base-validator.mjs"; //#region ../@warlock.js/seal/src/validators/record-validator.d.ts /** * Record validator class - validates objects with dynamic keys and consistent value types * * @example * ```ts * // Translations object * v.record(v.string()) * // Valid: { en: "Hello", ar: "مرحبا", fr: "Bonjour" } * * // User preferences * v.record(v.union([v.string(), v.number(), v.boolean()])) * // Valid: { theme: "dark", fontSize: 16, notifications: true } * ``` */ declare class RecordValidator extends BaseValidator { valueValidator: BaseValidator; constructor(valueValidator: BaseValidator, errorMessage?: string); /** * Validate it as plain object */ plainObject(errorMessage?: string): this; /** * Check if value is a plain object type */ matchesType(value: any): boolean; /** * Clone the validator */ clone(): this; /** * Validate record - iterate all keys and validate each value * * Absent input (and absent without `.default()`) propagates as `data: undefined` * so the parent ObjectValidator can omit the key. Without this, optional record * fields would silently materialise as `{}` in the validated output. */ validate(data: any, context: SchemaContext): Promise; /** * @inheritdoc * * Generates `{ type: "object", additionalProperties: }` — * the standard JSON Schema for a dictionary/map with homogeneous values. * * @example * ```ts * v.record(v.string()).toJsonSchema("draft-2020-12") * // → { type: "object", additionalProperties: { type: "string" } } * * v.record(v.union([v.string(), v.number()])).toJsonSchema("draft-2020-12") * // → { type: "object", additionalProperties: { oneOf: [{ type: "string" }, { type: "number" }] } } * ``` */ toJsonSchema(target?: JsonSchemaTarget): JsonSchemaResult; } //#endregion export { RecordValidator }; //# sourceMappingURL=record-validator.d.mts.map