import { C11nEnv } from '../interpreter/c11n-env'; /** * Provides the basic APIs to handle validation in the Constellation infrastructure */ /** Object that contains APIs that handle validations on a field * @param pConnect The context object that is used for this instance of the ValidationApi */ declare class ValidationApi { private readonly c11nEnv; constructor(pConnect: C11nEnv); /** * It Validates the field against the validation provided to the field and updates the state with the validation message. * If validation success it will return object with status as true * else it will return status as false along with an error message. * @param value - user provided value of the field to be validated. * @param propertyName - name of the filed to be validated. The default value is taken from redux state if propertyname is not provided. * @returns object contains status and message * @public * @example example of validate() validate the property with it's value. * * pConnect.getValidationApi().validate('mail.com', '.email'); * //Output - when validation fails * { * status : false, * message: 'Invalid Email' * } * * pConnect.getValidationApi().validate('abc@gamil.com', '.email'); * //Output - when validation success * { * status : true * } */ validate(value: string, propertyName?: string): { status: boolean; message: string; } | { status: boolean; message?: undefined; }; } export default ValidationApi;