import * as Joi from "joi"; /** * SchemaBuilder for the Joi validator. * It exposes some facility methods for some simple task, * and it also allows a complete personalization of the final result. */ export declare class SchemaBuilder { keys: any; lastKey: string; constructor(); /** * Generate the final Joi Object Schema */ build(): Joi.ObjectSchema; /** * General method, that can be used with the Joi functions */ general(key: string, spec: any): SchemaBuilder; /** * Add an optional string to the Schema * @param key the key * @param min minimum length of the string * @param max maximum length of the string * @return the schema builder */ stringOptional(key: string, min?: number, max?: number): SchemaBuilder; /** * Add a required string to the Schema * @param key the key * @param min minimum length of the string * @param max maximum length of the string * @return the schema builder */ string(key: string, min?: number, max?: number): SchemaBuilder; /** * Add a required email to the Schema * @param key the key * @return the schema builder */ email(key: string): SchemaBuilder; /** * Add an optional email to the Schema * @param key the key * @return the schema builder */ emailOptional(key: string): SchemaBuilder; /** * Add a required password to the Schema. * The password will be validated using the following regex: * ^[0-9a-zA-Z\|\!\"\£\$\%\&\/\(\)\=\?\^\,\;\.\:\-\_\\\~]{6,}$ * @param key the key * @return the schema builder */ password(key: string): SchemaBuilder; /** * Add an optional password to the Schema. * The password will be validated using the following regex: * ^[0-9a-zA-Z\|\!\"\£\$\%\&\/\(\)\=\?\^\,\;\.\:\-\_\\\~]{6,}$ * @param key the key * @return the schema builder */ passwordOptional(key: string): SchemaBuilder; /** * Add an optional number to the Schema * @param key the key * @param min minimum value of the number * @param max maximum value of the number * @return the schema builder */ numberOptional(key: string, min?: number, max?: number): SchemaBuilder; /** * Add a required number to the Schema * @param key the key * @param min minimum value of the number * @param max maximum value of the number * @return the schema builder */ number(key: string, min?: number, max?: number): SchemaBuilder; /** * Add an optional integer number to the Schema * @param key the key * @param min minimum value of the number * @param max maximum value of the number * @return the schema builder */ integerOptional(key: string, min?: number, max?: number): SchemaBuilder; /** * Add a required integer number to the Schema * @param key the key * @param min minimum value of the number * @param max maximum value of the number * @return the schema builder */ integer(key: string, min?: number, max?: number): SchemaBuilder; /** * Add an optional date to the Schema * @param key the key * @return the schema builder */ dateOptional(key: string): SchemaBuilder; /** * Add a required date to the Schema * @param key the key * @return the schema builder */ date(key: string): SchemaBuilder; /** * Add the label to the last added key * @param label the label to use in case of error * @return the schema builder */ withLabel(label: string): SchemaBuilder; } /** * Contains the name of the error and a localized error message. */ export interface ValidationError { name: string; message: string; } /** * This class is used to validate an object using a given schema. * It is used by Lynx to automatically validate the body of any requests, using * the Body decodator. */ export declare class ValidateObject { private _obj; private schema; private valid; /** * @param obj the object to validate * @param schema the schema * @param locales an array of available language. You can use the `req.acceptsLanguages()` */ constructor(obj: any, schema: Joi.Schema, locales: string[]); private validate; /** * Verify that the object rescpect the schema. * @return true if the object is valid, false otherwise. */ readonly isValid: boolean; /** * Unwrap the object (can be valid or not!) * @return the unwrapped object */ readonly obj: T; /** * Getter that returns an array of validation errors. * @return an array of validation errors. It can not be null. */ readonly errors: ValidationError[]; /** * Getter that returns a map of errors. This prop contains the save information * as the `errors` prop, but with a different format. * @return a map or loclaized errors. */ readonly errorsMap: any; }