import { CustomPropertyDecorator, TypeOverride } from "@plumier/reflect"; import validatorJs from "validator"; interface Opt { message?: string; } declare namespace val { /** * Check if the string is a date that's after the specified date * @param date date, default now */ function after(date?: string): CustomPropertyDecorator; /** * Check if the string is a date that's after the specified date * @param opt options */ function after(opt?: Opt & { date?: string; }): CustomPropertyDecorator; /** * Check if the string contains only letters (a-zA-Z). * @param opt options */ function alpha(opt?: Opt & { locale?: validatorJs.AlphaLocale; }): CustomPropertyDecorator; /** * Check if the string contains only letters and numbers. * @param opt options */ function alphanumeric(opt?: Opt & { locale?: validatorJs.AlphaLocale; }): CustomPropertyDecorator; /** * Check if the string contains ASCII chars only. * @param opt options */ function ascii(opt?: Opt): CustomPropertyDecorator; /** * Check if a string is base64 encoded. * @param opt options */ function base64(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a date that's before the specified date. * @param date date, default now */ function before(date?: string): CustomPropertyDecorator; /** * Check if the string is a date that's before the specified date. * @param opt options */ function before(opt?: Opt & { date?: string; }): CustomPropertyDecorator; /** * Check if the string's length (in UTF-8 bytes) falls in a range. * @param opt options */ function byteLength(opt: Opt & validatorJs.IsByteLengthOptions): CustomPropertyDecorator; /** * Check if the string is a credit card. * @param opt options */ function creditCard(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a valid currency amount. * @param opt options */ function currency(opt?: Opt & validatorJs.IsCurrencyOptions): CustomPropertyDecorator; /** * Check if the string is a [data uri format](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs). * @param opt options */ function dataURI(opt?: Opt): CustomPropertyDecorator; /** * Check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0 etc. * @param opt options */ function decimal(opt?: Opt & validatorJs.IsDecimalOptions): CustomPropertyDecorator; /** * Check if the string is a number that's divisible by another. * @param num divider number */ function divisibleBy(num: number): CustomPropertyDecorator; /** * Check if the string is a number that's divisible by another. * @param opt options */ function divisibleBy(opt: Opt & { num: number; }): CustomPropertyDecorator; /** * Check if the string is an email. * @param opt options */ function email(opt?: Opt & validatorJs.IsEmailOptions): CustomPropertyDecorator; /** * Check if the string is a fully qualified domain name (e.g. domain.com). * @param opt options */ function fqdn(opt?: Opt & validatorJs.IsFQDNOptions): CustomPropertyDecorator; /** * Check if the string is a float. * @param opt options */ function float(opt?: Opt & validatorJs.IsFloatOptions): CustomPropertyDecorator; /** * Check if the string contains any full-width chars. * @param opt options */ function fullWidth(opt?: Opt): CustomPropertyDecorator; /** * Check if the string contains any half-width chars. * @param opt options */ function halfWidth(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a hash of type algorithm. * @param algorithm algorithm */ function hash(algorithm: validatorJs.HashAlgorithm): CustomPropertyDecorator; /** * Check if the string is a hash of type algorithm. * @param opt options */ function hash(opt: Opt & { algorithm: validatorJs.HashAlgorithm; }): CustomPropertyDecorator; /** * Check if the string is a hexadecimal color. * @param opt options */ function hexColor(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a hexadecimal number. * @param opt options */ function hexadecimal(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is an IP (version 4 or 6). * @param version IP version */ function ip(version?: "4" | "6"): CustomPropertyDecorator; /** * Check if the string is an IP (version 4 or 6). * @param opt options */ function ip(opt?: Opt & { version?: "4" | "6"; }): CustomPropertyDecorator; /** * Check if the string is an ISBN (version 10 or 13). * @param version ISBN version */ function isbn(version?: "10" | "13"): CustomPropertyDecorator; /** * Check if the string is an ISBN (version 10 or 13). * @param opt options */ function isbn(opt?: Opt & { version?: "10" | "13"; }): CustomPropertyDecorator; /** * Check if the string is an [ISIN](https://en.wikipedia.org/wiki/International_Securities_Identification_Number) (stock/security identifier). * @param opt options */ function isin(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a valid [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code. * @param opt options */ function iso31661Alpha2(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a valid [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date. * @param opt options */ function iso8601(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code). * @param opt options */ function isrc(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is an [ISSN](https://en.wikipedia.org/wiki/International_Standard_Serial_Number). * @param opt options */ function issn(opt?: Opt & validatorJs.IsISSNOptions): CustomPropertyDecorator; /** * Check if the string is an integer. * @param opt options */ function int(opt?: Opt & validatorJs.IsIntOptions): CustomPropertyDecorator; /** * Check if the string is valid JSON (note: uses JSON.parse). * @param opt options */ function json(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a valid latitude-longitude coordinate in the format: * * `lat,long` or `lat, long`. * @param opt options */ function latLong(opt?: Opt): CustomPropertyDecorator; /** * Check if the string's length falls in a range. * * Note: this function takes into account surrogate pairs. * @param opt options */ function length(opt: Opt & validatorJs.IsLengthOptions): CustomPropertyDecorator; /** * Check if the string is lowercase. * @param opt options */ function lowerCase(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a MAC address. * @param opt options */ function macAddress(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a MD5 hash. * @param opt options */ function md5(opt?: Opt): CustomPropertyDecorator; /** * Check if the string matches to a valid [MIME type](https://en.wikipedia.org/wiki/Media_type) format. * @param opt options */ function mimeType(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a mobile phone number. * @param opt options */ function mobilePhone(opt?: Opt & { locale?: validatorJs.MobilePhoneLocale; options?: validatorJs.IsMobilePhoneOptions; }): CustomPropertyDecorator; /** * Check if the string is a valid hex-encoded representation of a [MongoDB ObjectId](http://docs.mongodb.org/manual/reference/object-id/). * @param opt options */ function mongoId(opt?: Opt): CustomPropertyDecorator; /** * Check if the string contains one or more multibyte chars. * @param opt options */ function multibyte(opt?: Opt): CustomPropertyDecorator; /** * Check if the string contains only numbers. * @param opt options */ function numeric(opt?: Opt & validatorJs.IsNumericOptions): CustomPropertyDecorator; /** * Check if the string is a valid port number. * @param opt options */ function port(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is a postal code * @param opt options */ function postalCode(opt?: Opt & { locale?: validatorJs.PostalCodeLocale; }): CustomPropertyDecorator; /** * Check if string matches the pattern. * @param pattern RegExp pattern */ function regex(pattern: RegExp): CustomPropertyDecorator; /** * Check if string matches the pattern. * @param opt options */ function regex(opt: Opt & { pattern: RegExp; }): CustomPropertyDecorator; /** * Check if the string is of type slug. * @param opt options */ function slug(opt?: Opt): CustomPropertyDecorator; /** * Check if the string contains any surrogate pairs chars. * @param opt options */ function surrogatePair(opt?: Opt): CustomPropertyDecorator; /** * Check if the string is an URL. * @param opt options */ function url(opt?: Opt & validatorJs.IsURLOptions): CustomPropertyDecorator; /** * Check if the string is a UUID (version 3, 4 or 5). * @param opt options */ function UUID(opt?: Opt & { version?: 3 | 4 | 5 | "3" | "4" | "5" | "all"; }): CustomPropertyDecorator; /** * Check if the string is uppercase. * @param opt options */ function uppercase(opt?: Opt): CustomPropertyDecorator; /** * Check if the string contains a mixture of full and half-width chars. * @param opt options */ function variableWidth(opt?: Opt): CustomPropertyDecorator; /** * Checks characters if they appear in the whitelist. * @param opt options */ function whiteListed(opt: Opt & { chars: string | string[]; }): CustomPropertyDecorator; /** * Mark if the property is required */ function required(): CustomPropertyDecorator; /** * Mark parameter data type as partial, any required validation will be ignored * @param typ parameter data type */ function partial(typ: TypeOverride | ((x: any) => TypeOverride)): (...args: any[]) => void; } export { val, Opt };