import { ValidationOptions } from 'joi'; import { AnySchemaTyped } from './joi.model'; import { JoiValidationError } from './joi.validation.error'; export interface JoiValidationResult { value: T; error?: JoiValidationError; } /** * Validates with Joi. * Throws JoiValidationError if invalid. * Returns *converted* value. * * If `schema` is undefined - returns value as is. */ export declare function validate(value: IN, schema?: AnySchemaTyped, objectName?: string, options?: ValidationOptions): OUT; /** * Validates with Joi. * Returns JoiValidationResult with converted value and error (if any). * Does not throw. * * If `schema` is undefined - returns value as is. */ export declare function getValidationResult(value: IN, schema?: AnySchemaTyped, objectName?: string, options?: ValidationOptions): JoiValidationResult; /** * Convenience function that returns true if !error. */ export declare function isValid(value: IN, schema?: AnySchemaTyped): boolean; export declare function undefinedIfInvalid(value: IN, schema?: AnySchemaTyped): OUT | undefined; /** * Will do joi-convertation, regardless of error/validity of value. * * @returns converted value */ export declare function convert(value: IN, schema?: AnySchemaTyped): OUT;