options.d.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. export type URLProtocol = 'http' | 'https' | 'ftp' | string;
  2. export type UUIDVersion = 1 | 2 | 3 | 4 | 5 | 7 | '1' | '2' | '3' | '4' | '5' | '7' | 'all' | 'loose';
  3. export type IPVersion = 4 | 6;
  4. export type AlphaLocale = 'ar' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-QA' | 'ar-QM' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'az-AZ' | 'bg-BG' | 'bn-BD' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'en-AU' | 'en-GB' | 'en-HK' | 'en-IN' | 'en-NZ' | 'en-US' | 'en-ZA' | 'en-ZM' | 'es-ES' | 'eo' | 'fa-AF' | 'fa-IR' | 'fi-FI' | 'fr-FR' | 'gu-IN' | 'he' | 'hi-IN' | 'hu-HU' | 'id-ID' | 'it-IT' | 'ja-JP' | 'kk-KZ' | 'kn-IN' | 'ko-KR' | 'ku-IQ' | 'ml-IN' | 'nb-NO' | 'nl-NL' | 'nn-NO' | 'or-IN' | 'pa-IN' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ru-RU' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'sr-RS' | 'sr-RS@latin' | 'sv-SE' | 'ta-IN' | 'te-IN' | 'th-TH' | 'tr-TR' | 'uk-UA' | 'vi-VN';
  5. export type AlphanumericLocale = 'ar' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-QA' | 'ar-QM' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'az-AZ' | 'bg-BG' | 'bn-BD' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'en-AU' | 'en-GB' | 'en-HK' | 'en-IN' | 'en-NZ' | 'en-US' | 'en-ZA' | 'en-ZM' | 'es-ES' | 'eo' | 'fa-AF' | 'fa-IR' | 'fi-FI' | 'fr-FR' | 'fr-BE' | 'gu-IN' | 'he' | 'hi-IN' | 'hu-HU' | 'it-IT' | 'id-ID' | 'ja-JP' | 'kk-KZ' | 'kn-IN' | 'ko-KR' | 'ku-IQ' | 'ml-IN' | 'nb-NO' | 'nl-BE' | 'nl-NL' | 'nn-NO' | 'or-IN' | 'pa-IN' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ru-RU' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'sr-RS' | 'sr-RS@latin' | 'sv-SE' | 'ta-IN' | 'te-IN' | 'th-TH' | 'tr-TR' | 'uk-UA' | 'vi-VN';
  6. export type MobilePhoneLocale = 'any' | 'am-AM' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-EH' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'ar-OM' | 'ar-QA' | 'ar-PS' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'az-AZ' | 'be-BY' | 'bg-BG' | 'bn-BD' | 'bs-BA' | 'cs-CZ' | 'de-AT' | 'de-CH' | 'de-DE' | 'de-LU' | 'da-DK' | 'dv-MV' | 'dz-BT' | 'el-CY' | 'el-GR' | 'en-AG' | 'en-AI' | 'en-AU' | 'en-BM' | 'en-BS' | 'en-BW' | 'en-CA' | 'en-GB' | 'en-GG' | 'en-GH' | 'en-GY' | 'en-HK' | 'en-HN' | 'en-IE' | 'en-IN' | 'en-JM' | 'en-KE' | 'en-KI' | 'en-KN' | 'en-LS' | 'en-MT' | 'en-MU' | 'en-MW' | 'en-NA' | 'en-NG' | 'en-NZ' | 'en-PG' | 'en-PH' | 'en-PK' | 'en-RW' | 'en-SG' | 'en-SL' | 'en-SS' | 'en-TZ' | 'en-UG' | 'en-US' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'es-AR' | 'es-BO' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-CU' | 'es-DO' | 'es-EC' | 'es-ES' | 'es-GT' | 'es-HN' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PY' | 'es-SV' | 'es-UY' | 'es-VE' | 'et-EE' | 'fa-AF' | 'fa-IR' | 'fi-FI' | 'fj-FJ' | 'fo-FO' | 'fr-BE' | 'fr-BF' | 'fr-BJ' | 'fr-CD' | 'fr-CF' | 'fr-CH' | 'fr-CM' | 'fr-FR' | 'fr-GF' | 'fr-GP' | 'fr-MQ' | 'fr-PF' | 'fr-RE' | 'fr-WF' | 'ga-IE' | 'he-IL' | 'hu-HU' | 'id-ID' | 'ir-IR' | 'it-CH' | 'it-IT' | 'it-SM' | 'ja-JP' | 'ka-GE' | 'kk-KZ' | 'kl-GL' | 'ko-KR' | 'ky-KG' | 'lt-LT' | 'lv-LV' | 'mg-MG' | 'mk-MK' | 'mn-MN' | 'ms-MY' | 'my-MM' | 'mz-MZ' | 'nb-NO' | 'nl-AW' | 'nl-BE' | 'nl-NL' | 'ne-NP' | 'nn-NO' | 'pl-PL' | 'pt-AO' | 'pt-BR' | 'pt-PT' | 'ro-MD' | 'ro-RO' | 'ru-RU' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'so-SO' | 'sq-AL' | 'sr-RS' | 'sv-SE' | 'tg-TJ' | 'th-TH' | 'tk-TM' | 'tr-TR' | 'uk-UA' | 'uz-Uz' | 'vi-VN' | 'zh-CN' | 'zh-HK' | 'zh-TW';
  7. export type PostalCodeLocale = 'any' | 'AD' | 'AT' | 'AU' | 'AZ' | 'BA' | 'BD' | 'BE' | 'BG' | 'BR' | 'BY' | 'CA' | 'CH' | 'CN' | 'CO' | 'CZ' | 'DE' | 'DK' | 'DO' | 'DZ' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HT' | 'HU' | 'ID' | 'IL' | 'IN' | 'IR' | 'IS' | 'IT' | 'JP' | 'KE' | 'KR' | 'LI' | 'LK' | 'LT' | 'LU' | 'LV' | 'MT' | 'MX' | 'MY' | 'NL' | 'NO' | 'NP' | 'NZ' | 'PK' | 'PL' | 'PR' | 'PT' | 'RO' | 'RU' | 'SA' | 'SE' | 'SG' | 'SI' | 'SK' | 'TH' | 'TN' | 'TW' | 'UA' | 'US' | 'ZA' | 'ZM';
  8. export type HashAlgorithm = 'md4' | 'md5' | 'sha1' | 'sha256' | 'sha384' | 'sha512' | 'ripemd128' | 'ripemd160' | 'tiger128' | 'tiger160' | 'tiger192' | 'crc32' | 'crc32b';
  9. export type IBANCode = 'AD' | 'AE' | 'AL' | 'AT' | 'AZ' | 'BA' | 'BE' | 'BG' | 'BH' | 'BR' | 'BY' | 'CH' | 'CR' | 'CY' | 'CZ' | 'DE' | 'DK' | 'DO' | 'DZ' | 'EE' | 'EG' | 'ES' | 'FI' | 'FO' | 'FR' | 'GB' | 'GE' | 'GI' | 'GL' | 'GR' | 'GT' | 'HR' | 'HU' | 'IE' | 'IL' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JO' | 'KW' | 'KZ' | 'LB' | 'LC' | 'LI' | 'LT' | 'LU' | 'LV' | 'MC' | 'MD' | 'ME' | 'MK' | 'MR' | 'MT' | 'MU' | 'MZ' | 'NL' | 'NO' | 'PK' | 'PL' | 'PS' | 'PT' | 'QA' | 'RO' | 'RS' | 'SA' | 'SC' | 'SE' | 'SI' | 'SK' | 'SM' | 'SV' | 'TL' | 'TN' | 'TR' | 'UA' | 'VA' | 'VG' | 'XK';
  10. export interface IsIBANOptions {
  11. whitelist?: readonly IBANCode[];
  12. blacklist?: readonly IBANCode[];
  13. }
  14. export type IdentityCardLocale = 'any' | 'ar-LY' | 'ar-TN' | 'ES' | 'FI' | 'he-IL' | 'hk-HK' | 'IN' | 'IT' | 'IR' | 'MZ' | 'NO' | 'PK' | 'PL' | 'TH' | 'zh-CN' | 'zh-TW';
  15. export type PassportCountryCode = 'AM' | 'AR' | 'AT' | 'AU' | 'AZ' | 'BE' | 'BG' | 'BY' | 'BR' | 'CA' | 'CH' | 'CN' | 'CY' | 'CZ' | 'DE' | 'DK' | 'DZ' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'ID' | 'IE' | 'IN' | 'IR' | 'IS' | 'IT' | 'JM' | 'JP' | 'KR' | 'KZ' | 'LI' | 'LT' | 'LU' | 'LV' | 'LY' | 'MT' | 'MY' | 'MZ' | 'NL' | 'NZ' | 'PH' | 'PK' | 'PL' | 'PO' | 'PT' | 'RO' | 'RU' | 'SE' | 'SL' | 'SK' | 'TH' | 'TR' | 'UA' | 'US' | 'ZA';
  16. export type IsLicensePlateLocale = 'cs-CZ' | 'de-DE' | 'de-LI' | 'en-NI' | 'en-PK' | 'en-SG' | 'es-AR' | 'fi-FI' | 'hu-HU' | 'pt-BR' | 'pt-PT' | 'sq-AL' | 'sv-SE' | 'any';
  17. export type TaxIDLocale = 'bg-BG' | 'cs-CZ' | 'de-AT' | 'de-DE' | 'dk-DK' | 'el-CY' | 'el-GR' | 'en-CA' | 'en-GB' | 'en-IE' | 'en-US' | 'es-AR' | 'es-ES' | 'et-EE' | 'fi-FI' | 'fr-BE' | 'fr-FR' | 'fr-LU' | 'hr-HR' | 'hu-HU' | 'it-IT' | 'lb-LU' | 'lt-LT' | 'lv-LV' | 'mt-MT' | 'nl-BE' | 'nl-NL' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ro-RO' | 'sk-SK' | 'sl-SI' | 'sv-SE' | 'uk-UA';
  18. export type VATCountryCode = 'GB' | 'IT' | 'NL' | 'AT' | 'BE' | 'BG' | 'HR' | 'CU' | 'CY' | 'CZ' | 'DK' | 'EE' | 'FI' | 'FR' | 'DE' | 'EL' | 'HU' | 'IE' | 'LV' | 'LT' | 'LU' | 'MT' | 'PL' | 'PT' | 'RO' | 'SK' | 'SI' | 'ES' | 'SE' | 'AL' | 'MK' | 'AU' | 'BY' | 'CA' | 'IS' | 'IN' | 'ID' | 'IL' | 'KZ' | 'NZ' | 'NG' | 'NO' | 'PH' | 'RU' | 'SM' | 'SA' | 'RS' | 'CH' | 'TR' | 'UA' | 'UZ' | 'AR' | 'BO' | 'BR' | 'CL' | 'CO' | 'CR' | 'EC' | 'SV' | 'GT' | 'HN' | 'MX' | 'NI' | 'PA' | 'PY' | 'PE' | 'DO' | 'UY' | 'VE';
  19. export interface MinMaxOptions {
  20. min?: number;
  21. max?: number;
  22. }
  23. export interface MinMaxExtendedOptions extends MinMaxOptions {
  24. lt?: number;
  25. gt?: number;
  26. }
  27. /**
  28. * defaults to
  29. * {
  30. * ignoreCase: false|
  31. * minOccurrences: 1
  32. * }
  33. */
  34. export interface ContainsOptions {
  35. ignoreCase?: boolean;
  36. minOccurrences?: number;
  37. }
  38. /**
  39. * defaults to
  40. * {
  41. * comparisonDate: Date().toString()
  42. * }
  43. */
  44. export interface IsAfterOptions {
  45. comparisonDate?: string;
  46. }
  47. export interface IsAlphaOptions {
  48. ignore?: string | string[] | RegExp;
  49. }
  50. export interface IsAlphanumericOptions {
  51. ignore?: string | RegExp;
  52. }
  53. /**
  54. * defaults to
  55. * {
  56. * crockford: false
  57. * }
  58. */
  59. export interface IsBase32Options {
  60. crockford?: boolean;
  61. }
  62. /**
  63. * defaults to
  64. * {
  65. * urlSafe: false
  66. * }
  67. */
  68. export interface IsBase64Options {
  69. urlSafe?: boolean;
  70. }
  71. /**
  72. * defaults to
  73. * {
  74. * comparisonDate: new Date().toString()
  75. * }
  76. */
  77. export interface IsBeforeOptions {
  78. comparisonDate?: string;
  79. }
  80. /**
  81. * defaults to
  82. * {
  83. * strict: false
  84. * loose: false
  85. * }
  86. */
  87. export interface IsBooleanOptions {
  88. strict?: boolean;
  89. loose?: boolean;
  90. }
  91. /**
  92. * defaults to
  93. * {
  94. * includePercentValues: true
  95. * allowSpaces: true
  96. * }
  97. */
  98. export interface IsRgbColorOptions {
  99. includePercentValues?: boolean;
  100. allowSpaces?: boolean;
  101. }
  102. export interface IsCreditCard {
  103. provider?: 'amex' | 'dinersclub' | 'discover' | 'jcb' | 'mastercard' | 'unionpay' | 'visa';
  104. }
  105. /**
  106. * defaults to
  107. * {
  108. * symbol: '$'|
  109. * require_symbol: false|
  110. * allow_space_after_symbol: false|
  111. * symbol_after_digits: false|
  112. * allow_negatives: true|
  113. * parens_for_negatives: false|
  114. * negative_sign_before_digits: false|
  115. * negative_sign_after_digits: false|
  116. * allow_negative_sign_placeholder: false|
  117. * thousands_separator: '|'|
  118. * decimal_separator: '.'|
  119. * allow_space_after_digits: false
  120. * }
  121. */
  122. export interface IsCurrencyOptions {
  123. symbol?: string;
  124. require_symbol?: boolean;
  125. allow_space_after_symbol?: boolean;
  126. symbol_after_digits?: boolean;
  127. allow_negatives?: boolean;
  128. parens_for_negatives?: boolean;
  129. negative_sign_before_digits?: boolean;
  130. negative_sign_after_digits?: boolean;
  131. allow_negative_sign_placeholder?: boolean;
  132. thousands_separator?: string;
  133. decimal_separator?: string;
  134. allow_decimal?: boolean;
  135. require_decimal?: boolean;
  136. digits_after_decimal?: number[];
  137. allow_space_after_digits?: boolean;
  138. }
  139. /**
  140. * defaults to
  141. * {
  142. * format: 'YYYY/MM/DD'|
  143. * delimiters: ['/'| '-']|
  144. * strictMode: false
  145. * }
  146. */
  147. export interface IsDateOptions {
  148. format?: string;
  149. delimiters?: string[];
  150. strictMode?: boolean;
  151. }
  152. export interface IsDecimalOptions {
  153. decimal_digits?: string;
  154. force_decimal?: boolean;
  155. locale?: AlphanumericLocale;
  156. blacklisted_chars?: string;
  157. }
  158. export interface IsEmailOptions {
  159. allow_display_name?: boolean;
  160. allow_underscores?: boolean;
  161. allow_utf8_local_part?: boolean;
  162. require_tld?: boolean;
  163. ignore_max_length?: boolean;
  164. allow_ip_domain?: boolean;
  165. domain_specific_validation?: boolean;
  166. blacklisted_chars?: string;
  167. host_blacklist?: (string | RegExp)[];
  168. host_whitelist?: (string | RegExp)[];
  169. }
  170. /**
  171. * defaults to
  172. * {
  173. * ignore_whitespace: false
  174. * }
  175. */
  176. export interface IsEmptyOptions {
  177. ignore_whitespace: boolean;
  178. }
  179. export interface IsFloatOptions extends MinMaxExtendedOptions {
  180. locale?: AlphanumericLocale;
  181. }
  182. /**
  183. * defaults to
  184. * {
  185. * require_tld: true|
  186. * allow_underscores: false|
  187. * allow_trailing_dot: false|
  188. * allow_numeric_tld: false|
  189. * allow_wildcard: false|
  190. * ignore_max_length: false
  191. * }
  192. */
  193. export interface IsFQDNOptions {
  194. require_tld?: boolean;
  195. allow_underscores?: boolean;
  196. allow_trailing_dot?: boolean;
  197. allow_numeric_tld?: boolean;
  198. allow_wildcard?: boolean;
  199. ignore_max_length?: boolean;
  200. }
  201. export interface IsIntOptions extends MinMaxExtendedOptions {
  202. allow_leading_zeroes?: boolean;
  203. }
  204. /**
  205. * defaults to
  206. * {
  207. * allow_primitives: false
  208. * }
  209. */
  210. export interface IsJSONOptions {
  211. allow_primitives?: boolean;
  212. }
  213. /**
  214. * defaults to
  215. * {
  216. * checkDMS: false
  217. * }
  218. */
  219. export interface IsLatLongOptions {
  220. checkDMS?: boolean;
  221. }
  222. export interface IsLengthOptions extends MinMaxOptions {
  223. discreteLengths?: number[];
  224. }
  225. /**
  226. * defaults to
  227. * {
  228. * allow_hyphens: false
  229. * }
  230. */
  231. export interface IsIMEIOptions {
  232. allow_hyphens?: boolean;
  233. }
  234. /**
  235. * defaults to
  236. * {
  237. * strict: false|
  238. * strictSeparator: false
  239. * }
  240. */
  241. export interface IsISO8601Options {
  242. strict?: boolean;
  243. strictSeparator?: boolean;
  244. }
  245. export interface IsISBNOptions {
  246. version?: '10' | '13';
  247. }
  248. /**
  249. * defaults to
  250. * {
  251. * case_sensitive: false|
  252. * require_hyphen: false
  253. * }
  254. */
  255. export interface IsISSNOptions {
  256. case_sensitive?: boolean;
  257. require_hyphen?: boolean;
  258. }
  259. /**
  260. * defaults to
  261. * ```js
  262. * {
  263. * no_separators: false
  264. * }
  265. * ```
  266. */
  267. export interface IsMACAddressOptions {
  268. no_separators?: boolean;
  269. /**
  270. * @deprecated use `no_separators` instead
  271. */
  272. no_colons?: boolean;
  273. eui?: '48' | '64';
  274. }
  275. export interface IsMobilePhoneOptions {
  276. strictMode?: boolean;
  277. }
  278. /**
  279. * defaults to
  280. * {
  281. * no_symbols: false
  282. * }
  283. */
  284. export interface IsNumericOptions {
  285. no_symbols: boolean;
  286. locale?: AlphanumericLocale;
  287. }
  288. /**
  289. * defaults to
  290. * {
  291. * minLength: 8|
  292. * minLowercase: 1|
  293. * minUppercase: 1|
  294. * minNumbers: 1|
  295. * minSymbols: 1|
  296. * returnScore: false|
  297. * pointsPerUnique: 1|
  298. * pointsPerRepeat: 0.5|
  299. * pointsForContainingLower: 10|
  300. * pointsForContainingUpper: 10|
  301. * pointsForContainingNumber: 10|
  302. * pointsForContainingSymbol: 10
  303. * }
  304. */
  305. export interface IsStrongPasswordOptions {
  306. minLength?: number;
  307. minLowercase?: number;
  308. minUppercase?: number;
  309. minNumbers?: number;
  310. minSymbols?: number;
  311. returnScore?: boolean;
  312. pointsPerUnique?: number;
  313. pointsPerRepeat?: number;
  314. pointsForContainingLower?: number;
  315. pointsForContainingUpper?: number;
  316. pointsForContainingNumber?: number;
  317. pointsForContainingSymbol?: number;
  318. }
  319. /**
  320. * defaults to
  321. * {
  322. * protocols: ['http'|'https'|'ftp']|
  323. * require_tld: true|
  324. * require_protocol: false|
  325. * require_host: true|
  326. * require_port: false;
  327. * require_valid_protocol: true|
  328. * allow_underscores: false|
  329. * host_whitelist: false|
  330. * host_blacklist: false|
  331. * allow_trailing_dot: false|
  332. * allow_protocol_relative_urls: false|
  333. * validate_length: true|
  334. * allow_fragments: true|
  335. * allow_query_components: true
  336. * }
  337. */
  338. export interface IsURLOptions extends IsFQDNOptions {
  339. protocols?: URLProtocol[];
  340. require_protocol?: boolean;
  341. require_host?: boolean;
  342. require_port?: boolean;
  343. require_valid_protocol?: boolean;
  344. host_whitelist?: (string | RegExp)[];
  345. host_blacklist?: (string | RegExp)[];
  346. allow_protocol_relative_urls?: boolean;
  347. disallow_auth?: boolean;
  348. validate_length?: boolean;
  349. max_allowed_length?: number;
  350. allow_fragments?: boolean;
  351. allow_query_components?: boolean;
  352. }
  353. /**
  354. * defaults to
  355. * {
  356. * hourFormat: 'hour24'|
  357. * mode: 'default'|
  358. * };
  359. */
  360. export interface IsTimeOptions {
  361. hourFormat?: 'hour24' | 'hour12';
  362. mode?: 'default' | 'withSeconds';
  363. }
  364. export interface NormalizeEmailOptions {
  365. all_lowercase?: boolean;
  366. gmail_lowercase?: boolean;
  367. gmail_remove_dots?: boolean;
  368. gmail_remove_subaddress?: boolean;
  369. gmail_convert_googlemaildotcom?: boolean;
  370. outlookdotcom_lowercase?: boolean;
  371. outlookdotcom_remove_subaddress?: boolean;
  372. yahoo_lowercase?: boolean;
  373. yahoo_remove_subaddress?: boolean;
  374. icloud_lowercase?: boolean;
  375. icloud_remove_subaddress?: boolean;
  376. yandex_convert_yandexru?: boolean;
  377. }