lakutata 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (594) hide show
  1. package/.idea/codeStyles/Project.xml +18 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/lakutata.iml +13 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/vcs.xml +6 -0
  7. package/LICENSE +21 -0
  8. package/README.md +1 -0
  9. package/build/Application-78a416de.d.ts +387 -0
  10. package/build/Application-b5e19e08.d.ts +387 -0
  11. package/build/Components.cjs +55 -0
  12. package/build/Components.d.cts +9 -0
  13. package/build/Components.d.ts +9 -0
  14. package/build/Components.js +44 -0
  15. package/build/Core.cjs +148 -0
  16. package/build/Core.d.cts +33 -0
  17. package/build/Core.d.ts +33 -0
  18. package/build/Core.js +71 -0
  19. package/build/Crypto.cjs +96 -0
  20. package/build/Crypto.d.cts +19 -0
  21. package/build/Crypto.d.ts +19 -0
  22. package/build/Crypto.js +41 -0
  23. package/build/Decorators.cjs +100 -0
  24. package/build/Decorators.d.cts +23 -0
  25. package/build/Decorators.d.ts +23 -0
  26. package/build/Decorators.js +45 -0
  27. package/build/DependencyInjectionContainer-871a6c03.d.ts +340 -0
  28. package/build/DependencyInjectionContainer-f037ac36.d.ts +340 -0
  29. package/build/Exceptions.cjs +144 -0
  30. package/build/Exceptions.d.cts +28 -0
  31. package/build/Exceptions.d.ts +28 -0
  32. package/build/Exceptions.js +37 -0
  33. package/build/Hash.cjs +223 -0
  34. package/build/Hash.d.cts +535 -0
  35. package/build/Hash.d.ts +535 -0
  36. package/build/Hash.js +10 -0
  37. package/build/Time.cjs +14 -0
  38. package/build/Time.d.cts +5 -0
  39. package/build/Time.d.ts +5 -0
  40. package/build/Time.js +5 -0
  41. package/build/TimeInput-24fced42.d.ts +243 -0
  42. package/build/TimeInput-4401fc58.d.ts +243 -0
  43. package/build/Utilities.cjs +100 -0
  44. package/build/Utilities.d.cts +212 -0
  45. package/build/Utilities.d.ts +212 -0
  46. package/build/Utilities.js +7 -0
  47. package/build/Validator.cjs +24 -0
  48. package/build/Validator.d.cts +1851 -0
  49. package/build/Validator.d.ts +1851 -0
  50. package/build/Validator.js +11 -0
  51. package/build/chunk-26TQI22I.js +196 -0
  52. package/build/chunk-27OFA7C3.js +16 -0
  53. package/build/chunk-2C2UILFN.js +23 -0
  54. package/build/chunk-2CHYQHWR.cjs +16 -0
  55. package/build/chunk-2DN35UQB.cjs +10947 -0
  56. package/build/chunk-2E4TF6LU.cjs +16 -0
  57. package/build/chunk-2PLJEW2R.js +14 -0
  58. package/build/chunk-2RW3VMNS.js +45 -0
  59. package/build/chunk-2T6JU2UH.js +14 -0
  60. package/build/chunk-3CX3GCQF.js +32 -0
  61. package/build/chunk-3JIQCDQG.cjs +25 -0
  62. package/build/chunk-3KLEN3PR.js +14 -0
  63. package/build/chunk-3LZRQPJ5.js +14 -0
  64. package/build/chunk-3NHHHZFR.cjs +870 -0
  65. package/build/chunk-4332C5BW.js +30 -0
  66. package/build/chunk-46V7GHKE.cjs +25 -0
  67. package/build/chunk-4EPPSZ7L.js +14 -0
  68. package/build/chunk-4FEEQIQ4.js +23 -0
  69. package/build/chunk-4G2ZCUBN.js +5570 -0
  70. package/build/chunk-4KTVY73U.js +15 -0
  71. package/build/chunk-4MQXSUTL.cjs +14 -0
  72. package/build/chunk-4OHSPWRQ.js +34 -0
  73. package/build/chunk-4PK4TGU4.cjs +16 -0
  74. package/build/chunk-4YXUEJSO.js +23 -0
  75. package/build/chunk-5475IFR4.cjs +16 -0
  76. package/build/chunk-5B5Z4GCR.cjs +17 -0
  77. package/build/chunk-5FPTDIKI.cjs +16 -0
  78. package/build/chunk-5NK7E2HA.js +69 -0
  79. package/build/chunk-67F5WP5Z.cjs +8 -0
  80. package/build/chunk-6BJTKEXZ.cjs +25 -0
  81. package/build/chunk-6WNLPTDY.cjs +8 -0
  82. package/build/chunk-7G7FCNEG.cjs +8 -0
  83. package/build/chunk-7IVNTVYK.cjs +16 -0
  84. package/build/chunk-7MJAWOWL.js +22896 -0
  85. package/build/chunk-7MTOK62N.js +767 -0
  86. package/build/chunk-7PADGZPI.cjs +129 -0
  87. package/build/chunk-7ZUM53G6.js +14 -0
  88. package/build/chunk-A4BYNKYF.js +42 -0
  89. package/build/chunk-A7F6LCRA.cjs +16 -0
  90. package/build/chunk-AFV3VN3X.cjs +8 -0
  91. package/build/chunk-AGHMOCC3.cjs +16 -0
  92. package/build/chunk-AHUH4FWQ.cjs +29 -0
  93. package/build/chunk-AM4YMG2S.js +6 -0
  94. package/build/chunk-ANDEVIKJ.cjs +16 -0
  95. package/build/chunk-APETX7ZT.cjs +16 -0
  96. package/build/chunk-ASMC7EUP.js +6 -0
  97. package/build/chunk-BDCRHGKN.js +6 -0
  98. package/build/chunk-BDJXMO44.js +2920 -0
  99. package/build/chunk-BE7ICF5R.js +32 -0
  100. package/build/chunk-BEDKPRVX.cjs +17 -0
  101. package/build/chunk-BFE66ADZ.cjs +34 -0
  102. package/build/chunk-BKCT2HSQ.js +178 -0
  103. package/build/chunk-BMNC4W46.js +20 -0
  104. package/build/chunk-BO7Y6HNS.cjs +176 -0
  105. package/build/chunk-D4H35ART.cjs +53 -0
  106. package/build/chunk-D5DE7Z4J.js +29 -0
  107. package/build/chunk-DHSSJJMD.cjs +25 -0
  108. package/build/chunk-DIMOR6NE.cjs +8 -0
  109. package/build/chunk-DN5TSX6S.cjs +244 -0
  110. package/build/chunk-EEH5LCBP.cjs +16 -0
  111. package/build/chunk-EFYDUUXT.cjs +92 -0
  112. package/build/chunk-ENJSEFE4.js +14 -0
  113. package/build/chunk-EPYJVQHQ.js +6 -0
  114. package/build/chunk-EUVLTNDV.js +32 -0
  115. package/build/chunk-EXQVCESB.cjs +20 -0
  116. package/build/chunk-EYPPC6HP.js +18 -0
  117. package/build/chunk-F5NKGQDL.cjs +16 -0
  118. package/build/chunk-F7RNH2H2.js +266 -0
  119. package/build/chunk-FCTV4OB7.cjs +50 -0
  120. package/build/chunk-FHEXUE67.js +29 -0
  121. package/build/chunk-FJP3KNXK.js +23 -0
  122. package/build/chunk-FJQSLRIP.js +14 -0
  123. package/build/chunk-FSFWPTIC.js +6 -0
  124. package/build/chunk-FTKFMQHJ.cjs +16 -0
  125. package/build/chunk-FW26MPE4.js +69 -0
  126. package/build/chunk-FZNRGZGE.js +6372 -0
  127. package/build/chunk-G7EDOLQ7.cjs +100 -0
  128. package/build/chunk-GGY7LCMQ.cjs +73 -0
  129. package/build/chunk-GLWUJIMW.cjs +8 -0
  130. package/build/chunk-GZ5KN2PE.js +6 -0
  131. package/build/chunk-HBPRX3WA.cjs +202 -0
  132. package/build/chunk-HJAQ6WJM.cjs +288 -0
  133. package/build/chunk-HJSJA5CF.js +14 -0
  134. package/build/chunk-HKAY7FWM.js +28 -0
  135. package/build/chunk-HMKTNRQF.js +14 -0
  136. package/build/chunk-HODDA5D5.js +199 -0
  137. package/build/chunk-HPKJUFTM.js +14 -0
  138. package/build/chunk-HWCTWIVZ.cjs +30 -0
  139. package/build/chunk-HXWC4YN6.cjs +22908 -0
  140. package/build/chunk-HZJ7XFHQ.cjs +8 -0
  141. package/build/chunk-I5TGKTX6.js +18 -0
  142. package/build/chunk-I7J6V3EU.cjs +34 -0
  143. package/build/chunk-IKWXYUGY.js +14 -0
  144. package/build/chunk-IYGGR65W.cjs +16 -0
  145. package/build/chunk-J6RXNX2K.js +174 -0
  146. package/build/chunk-JAEEMFEZ.cjs +24 -0
  147. package/build/chunk-JFOMNL5I.cjs +22 -0
  148. package/build/chunk-JPV2PUHF.cjs +8 -0
  149. package/build/chunk-JR726PDZ.cjs +70 -0
  150. package/build/chunk-JTKOYDJB.js +5914 -0
  151. package/build/chunk-JU53NOVA.cjs +31 -0
  152. package/build/chunk-JVSBYHUY.js +10944 -0
  153. package/build/chunk-JYBISTRN.cjs +25 -0
  154. package/build/chunk-K2ALA7QI.js +12 -0
  155. package/build/chunk-KG6DPM4B.js +14 -0
  156. package/build/chunk-KNSBLLL2.cjs +32 -0
  157. package/build/chunk-KNTGBUSY.js +6 -0
  158. package/build/chunk-KWOHVRRL.js +6 -0
  159. package/build/chunk-L3IVYIVA.js +23 -0
  160. package/build/chunk-LBL5XNWX.js +221 -0
  161. package/build/chunk-LBOBUFWZ.js +6 -0
  162. package/build/chunk-LEJXJUBE.js +6 -0
  163. package/build/chunk-LJTCXKC4.js +242 -0
  164. package/build/chunk-MBKTJ3KM.cjs +118 -0
  165. package/build/chunk-MDE5SRLT.cjs +16 -0
  166. package/build/chunk-MEKICSEL.js +22 -0
  167. package/build/chunk-MNDBRDT2.cjs +608 -0
  168. package/build/chunk-MSWZLYS7.cjs +5916 -0
  169. package/build/chunk-MT2OB376.js +14 -0
  170. package/build/chunk-MVWB4XDJ.js +14 -0
  171. package/build/chunk-MXAAAL2S.js +53 -0
  172. package/build/chunk-N37KV2VV.cjs +199 -0
  173. package/build/chunk-NZ5IZMM5.cjs +2922 -0
  174. package/build/chunk-O2NOYN65.js +54 -0
  175. package/build/chunk-OAD22QZQ.js +6 -0
  176. package/build/chunk-OIFILR4I.js +125 -0
  177. package/build/chunk-OJGBPS2B.cjs +16 -0
  178. package/build/chunk-OMPATIMZ.cjs +71 -0
  179. package/build/chunk-P3Z7ZEGJ.cjs +18 -0
  180. package/build/chunk-P6BBXCBD.cjs +6425 -0
  181. package/build/chunk-PE4C2TIO.cjs +16 -0
  182. package/build/chunk-PF2WAZLH.cjs +52 -0
  183. package/build/chunk-PFFTGOAR.cjs +25 -0
  184. package/build/chunk-PFUZLHWJ.cjs +25 -0
  185. package/build/chunk-POE7A7NF.cjs +180 -0
  186. package/build/chunk-PQSDA5BN.js +50 -0
  187. package/build/chunk-PR5TPAGH.js +14 -0
  188. package/build/chunk-PXMWVOKK.cjs +16 -0
  189. package/build/chunk-PZ5OJC4I.cjs +16 -0
  190. package/build/chunk-Q4LNTPEI.cjs +34 -0
  191. package/build/chunk-QCA5YGYV.js +14 -0
  192. package/build/chunk-QGGML4PP.js +17 -0
  193. package/build/chunk-QHW273SN.js +32 -0
  194. package/build/chunk-QJJRQMA6.cjs +8 -0
  195. package/build/chunk-QKB76MIV.cjs +769 -0
  196. package/build/chunk-QKVPGRI5.cjs +8 -0
  197. package/build/chunk-QME47CJL.cjs +8 -0
  198. package/build/chunk-QNJ6XBYQ.js +14 -0
  199. package/build/chunk-QWYKUNU5.js +14 -0
  200. package/build/chunk-QXTBP6TW.js +116 -0
  201. package/build/chunk-RH3LAIQS.js +32 -0
  202. package/build/chunk-RMAXG5F7.js +118 -0
  203. package/build/chunk-RUHAPGDE.js +14 -0
  204. package/build/chunk-S4KA3ZGO.js +6 -0
  205. package/build/chunk-SAGMV3YX.cjs +16 -0
  206. package/build/chunk-SCWEQ5JA.cjs +34 -0
  207. package/build/chunk-SEKBDIJH.cjs +16 -0
  208. package/build/chunk-SGWWTKLW.cjs +16 -0
  209. package/build/chunk-SWCU6OID.cjs +61 -0
  210. package/build/chunk-T4C7UJEZ.js +29 -0
  211. package/build/chunk-TBWIKIS3.cjs +8 -0
  212. package/build/chunk-TS74DN3N.cjs +229 -0
  213. package/build/chunk-TXTNUC7S.cjs +16 -0
  214. package/build/chunk-UEGDBJEG.cjs +127 -0
  215. package/build/chunk-UR2ZK7MI.cjs +16 -0
  216. package/build/chunk-VAOR6JOP.js +14 -0
  217. package/build/chunk-VELZ3KJY.cjs +45 -0
  218. package/build/chunk-VHTAHAD6.cjs +34 -0
  219. package/build/chunk-VISA22LF.js +14 -0
  220. package/build/chunk-VOFRWVGM.js +23 -0
  221. package/build/chunk-VPRNM6FU.cjs +118 -0
  222. package/build/chunk-VTFNEUOF.js +14 -0
  223. package/build/chunk-VVNU27G2.js +868 -0
  224. package/build/chunk-W3TQER3B.cjs +31 -0
  225. package/build/chunk-WINISBV4.js +70 -0
  226. package/build/chunk-WSEZ7DZV.js +14 -0
  227. package/build/chunk-WW57G6RG.js +124 -0
  228. package/build/chunk-WYJCE3KY.cjs +5593 -0
  229. package/build/chunk-WZI5UPER.cjs +61 -0
  230. package/build/chunk-WZZF2IEV.js +14 -0
  231. package/build/chunk-X4AIZSIY.cjs +47 -0
  232. package/build/chunk-XO6M5AYN.js +585 -0
  233. package/build/chunk-XWP76C6E.js +25 -0
  234. package/build/chunk-Y7O5SCF6.cjs +16 -0
  235. package/build/chunk-YEBPQG7X.js +96 -0
  236. package/build/chunk-YT4CYDJ3.js +14 -0
  237. package/build/chunk-ZG3PHRVQ.cjs +20 -0
  238. package/build/chunk-ZG7QF5S2.cjs +16 -0
  239. package/build/chunk-ZJYLWSBE.js +90 -0
  240. package/build/chunk-ZYBMNLGI.js +48 -0
  241. package/build/constants/DefaultValue.cjs +14 -0
  242. package/build/constants/DefaultValue.d.cts +9 -0
  243. package/build/constants/DefaultValue.d.ts +9 -0
  244. package/build/constants/DefaultValue.js +5 -0
  245. package/build/constants/MetadataKey.cjs +114 -0
  246. package/build/constants/MetadataKey.d.cts +30 -0
  247. package/build/constants/MetadataKey.d.ts +30 -0
  248. package/build/constants/MetadataKey.js +5 -0
  249. package/build/decorators/ControllerDecorators.cjs +21 -0
  250. package/build/decorators/ControllerDecorators.d.cts +32 -0
  251. package/build/decorators/ControllerDecorators.d.ts +32 -0
  252. package/build/decorators/ControllerDecorators.js +12 -0
  253. package/build/decorators/DependencyInjectionDecorators.cjs +78 -0
  254. package/build/decorators/DependencyInjectionDecorators.d.cts +75 -0
  255. package/build/decorators/DependencyInjectionDecorators.d.ts +75 -0
  256. package/build/decorators/DependencyInjectionDecorators.js +41 -0
  257. package/build/decorators/ValidationDecorators.cjs +35 -0
  258. package/build/decorators/ValidationDecorators.d.cts +36 -0
  259. package/build/decorators/ValidationDecorators.d.ts +36 -0
  260. package/build/decorators/ValidationDecorators.js +14 -0
  261. package/build/exceptions/DependencyInjectionException.cjs +18 -0
  262. package/build/exceptions/DependencyInjectionException.d.cts +8 -0
  263. package/build/exceptions/DependencyInjectionException.d.ts +8 -0
  264. package/build/exceptions/DependencyInjectionException.js +9 -0
  265. package/build/exceptions/InvalidConfigurableValueException.cjs +18 -0
  266. package/build/exceptions/InvalidConfigurableValueException.d.cts +8 -0
  267. package/build/exceptions/InvalidConfigurableValueException.d.ts +8 -0
  268. package/build/exceptions/InvalidConfigurableValueException.js +9 -0
  269. package/build/exceptions/InvalidDTOValueException.cjs +18 -0
  270. package/build/exceptions/InvalidDTOValueException.d.cts +8 -0
  271. package/build/exceptions/InvalidDTOValueException.d.ts +8 -0
  272. package/build/exceptions/InvalidDTOValueException.js +9 -0
  273. package/build/exceptions/InvalidGlobStringException.cjs +18 -0
  274. package/build/exceptions/InvalidGlobStringException.d.cts +8 -0
  275. package/build/exceptions/InvalidGlobStringException.d.ts +8 -0
  276. package/build/exceptions/InvalidGlobStringException.js +9 -0
  277. package/build/exceptions/MethodNotFoundException.cjs +18 -0
  278. package/build/exceptions/MethodNotFoundException.d.cts +8 -0
  279. package/build/exceptions/MethodNotFoundException.d.ts +8 -0
  280. package/build/exceptions/MethodNotFoundException.js +9 -0
  281. package/build/exceptions/NotSupportHashException.cjs +18 -0
  282. package/build/exceptions/NotSupportHashException.d.cts +8 -0
  283. package/build/exceptions/NotSupportHashException.d.ts +8 -0
  284. package/build/exceptions/NotSupportHashException.js +9 -0
  285. package/build/exceptions/controller/DuplicateControllerActionPatternException.cjs +18 -0
  286. package/build/exceptions/controller/DuplicateControllerActionPatternException.d.cts +8 -0
  287. package/build/exceptions/controller/DuplicateControllerActionPatternException.d.ts +8 -0
  288. package/build/exceptions/controller/DuplicateControllerActionPatternException.js +9 -0
  289. package/build/exceptions/controller/DynamicRegisterControllerNotAllowException.cjs +18 -0
  290. package/build/exceptions/controller/DynamicRegisterControllerNotAllowException.d.cts +8 -0
  291. package/build/exceptions/controller/DynamicRegisterControllerNotAllowException.d.ts +8 -0
  292. package/build/exceptions/controller/DynamicRegisterControllerNotAllowException.js +9 -0
  293. package/build/exceptions/controller/NoMatchedControllerActionPatternException.cjs +18 -0
  294. package/build/exceptions/controller/NoMatchedControllerActionPatternException.d.cts +8 -0
  295. package/build/exceptions/controller/NoMatchedControllerActionPatternException.d.ts +8 -0
  296. package/build/exceptions/controller/NoMatchedControllerActionPatternException.js +9 -0
  297. package/build/exceptions/crypto/asymmetric/AsymmetricDecryptException.cjs +18 -0
  298. package/build/exceptions/crypto/asymmetric/AsymmetricDecryptException.d.cts +8 -0
  299. package/build/exceptions/crypto/asymmetric/AsymmetricDecryptException.d.ts +8 -0
  300. package/build/exceptions/crypto/asymmetric/AsymmetricDecryptException.js +9 -0
  301. package/build/exceptions/crypto/asymmetric/AsymmetricEncryptException.cjs +18 -0
  302. package/build/exceptions/crypto/asymmetric/AsymmetricEncryptException.d.cts +8 -0
  303. package/build/exceptions/crypto/asymmetric/AsymmetricEncryptException.d.ts +8 -0
  304. package/build/exceptions/crypto/asymmetric/AsymmetricEncryptException.js +9 -0
  305. package/build/exceptions/crypto/asymmetric/AsymmetricSignException.cjs +18 -0
  306. package/build/exceptions/crypto/asymmetric/AsymmetricSignException.d.cts +8 -0
  307. package/build/exceptions/crypto/asymmetric/AsymmetricSignException.d.ts +8 -0
  308. package/build/exceptions/crypto/asymmetric/AsymmetricSignException.js +9 -0
  309. package/build/exceptions/crypto/asymmetric/AsymmetricVerifyException.cjs +18 -0
  310. package/build/exceptions/crypto/asymmetric/AsymmetricVerifyException.d.cts +8 -0
  311. package/build/exceptions/crypto/asymmetric/AsymmetricVerifyException.d.ts +8 -0
  312. package/build/exceptions/crypto/asymmetric/AsymmetricVerifyException.js +9 -0
  313. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptKeyPairException.cjs +18 -0
  314. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptKeyPairException.d.cts +8 -0
  315. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptKeyPairException.d.ts +8 -0
  316. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptKeyPairException.js +9 -0
  317. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPrivateKeyException.cjs +18 -0
  318. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPrivateKeyException.d.cts +8 -0
  319. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPrivateKeyException.d.ts +8 -0
  320. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPrivateKeyException.js +9 -0
  321. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPublicKeyException.cjs +18 -0
  322. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPublicKeyException.d.cts +8 -0
  323. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPublicKeyException.d.ts +8 -0
  324. package/build/exceptions/crypto/asymmetric/InvalidAsymmetricEncryptPublicKeyException.js +9 -0
  325. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPrivateKeyException.cjs +18 -0
  326. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPrivateKeyException.d.cts +8 -0
  327. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPrivateKeyException.d.ts +8 -0
  328. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPrivateKeyException.js +9 -0
  329. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPublicKeyException.cjs +18 -0
  330. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPublicKeyException.d.cts +8 -0
  331. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPublicKeyException.d.ts +8 -0
  332. package/build/exceptions/crypto/asymmetric/NoAsymmetricEncryptPublicKeyException.js +9 -0
  333. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherIVLengthException.cjs +18 -0
  334. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherIVLengthException.d.cts +8 -0
  335. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherIVLengthException.d.ts +8 -0
  336. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherIVLengthException.js +9 -0
  337. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherKeyLengthException.cjs +18 -0
  338. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherKeyLengthException.d.cts +8 -0
  339. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherKeyLengthException.d.ts +8 -0
  340. package/build/exceptions/crypto/symmetric/InvalidSymmetricCipherKeyLengthException.js +9 -0
  341. package/build/exceptions/crypto/symmetric/NotSupportCipherException.cjs +18 -0
  342. package/build/exceptions/crypto/symmetric/NotSupportCipherException.d.cts +8 -0
  343. package/build/exceptions/crypto/symmetric/NotSupportCipherException.d.ts +8 -0
  344. package/build/exceptions/crypto/symmetric/NotSupportCipherException.js +9 -0
  345. package/build/exceptions/crypto/symmetric/SymmetricDecryptException.cjs +18 -0
  346. package/build/exceptions/crypto/symmetric/SymmetricDecryptException.d.cts +8 -0
  347. package/build/exceptions/crypto/symmetric/SymmetricDecryptException.d.ts +8 -0
  348. package/build/exceptions/crypto/symmetric/SymmetricDecryptException.js +9 -0
  349. package/build/exceptions/crypto/symmetric/SymmetricEncryptException.cjs +18 -0
  350. package/build/exceptions/crypto/symmetric/SymmetricEncryptException.d.cts +8 -0
  351. package/build/exceptions/crypto/symmetric/SymmetricEncryptException.d.ts +8 -0
  352. package/build/exceptions/crypto/symmetric/SymmetricEncryptException.js +9 -0
  353. package/build/exceptions/validation/InvalidMethodAcceptException.cjs +18 -0
  354. package/build/exceptions/validation/InvalidMethodAcceptException.d.cts +8 -0
  355. package/build/exceptions/validation/InvalidMethodAcceptException.d.ts +8 -0
  356. package/build/exceptions/validation/InvalidMethodAcceptException.js +9 -0
  357. package/build/exceptions/validation/InvalidMethodReturnException.cjs +18 -0
  358. package/build/exceptions/validation/InvalidMethodReturnException.d.cts +8 -0
  359. package/build/exceptions/validation/InvalidMethodReturnException.d.ts +8 -0
  360. package/build/exceptions/validation/InvalidMethodReturnException.js +9 -0
  361. package/build/exceptions/validation/InvalidValueException.cjs +18 -0
  362. package/build/exceptions/validation/InvalidValueException.d.cts +8 -0
  363. package/build/exceptions/validation/InvalidValueException.d.ts +8 -0
  364. package/build/exceptions/validation/InvalidValueException.js +9 -0
  365. package/build/index.d-e5279fea.d.ts +872 -0
  366. package/build/interfaces/IConstructor.cjs +7 -0
  367. package/build/interfaces/IConstructor.d.cts +6 -0
  368. package/build/interfaces/IConstructor.d.ts +6 -0
  369. package/build/interfaces/IConstructor.js +4 -0
  370. package/build/interfaces/ILogger.cjs +7 -0
  371. package/build/interfaces/ILogger.d.cts +22 -0
  372. package/build/interfaces/ILogger.d.ts +22 -0
  373. package/build/interfaces/ILogger.js +4 -0
  374. package/build/interfaces/IPatRun.cjs +7 -0
  375. package/build/interfaces/IPatRun.d.cts +12 -0
  376. package/build/interfaces/IPatRun.d.ts +12 -0
  377. package/build/interfaces/IPatRun.js +4 -0
  378. package/build/interfaces/ISortArrayOptions.cjs +7 -0
  379. package/build/interfaces/ISortArrayOptions.d.cts +12 -0
  380. package/build/interfaces/ISortArrayOptions.d.ts +12 -0
  381. package/build/interfaces/ISortArrayOptions.js +4 -0
  382. package/build/interfaces/ISortObjectOptions.cjs +7 -0
  383. package/build/interfaces/ISortObjectOptions.d.cts +6 -0
  384. package/build/interfaces/ISortObjectOptions.d.ts +6 -0
  385. package/build/interfaces/ISortObjectOptions.js +4 -0
  386. package/build/lib/Application.cjs +50 -0
  387. package/build/lib/Application.d.cts +20 -0
  388. package/build/lib/Application.d.ts +20 -0
  389. package/build/lib/Application.js +41 -0
  390. package/build/lib/base/BaseObject.cjs +50 -0
  391. package/build/lib/base/BaseObject.d.cts +112 -0
  392. package/build/lib/base/BaseObject.d.ts +112 -0
  393. package/build/lib/base/BaseObject.js +41 -0
  394. package/build/lib/base/Component.cjs +50 -0
  395. package/build/lib/base/Component.d.cts +116 -0
  396. package/build/lib/base/Component.d.ts +116 -0
  397. package/build/lib/base/Component.js +41 -0
  398. package/build/lib/base/Container.cjs +50 -0
  399. package/build/lib/base/Container.d.cts +20 -0
  400. package/build/lib/base/Container.d.ts +20 -0
  401. package/build/lib/base/Container.js +41 -0
  402. package/build/lib/base/Controller.cjs +50 -0
  403. package/build/lib/base/Controller.d.cts +20 -0
  404. package/build/lib/base/Controller.d.ts +20 -0
  405. package/build/lib/base/Controller.js +41 -0
  406. package/build/lib/base/DTO.cjs +23 -0
  407. package/build/lib/base/DTO.d.cts +59 -0
  408. package/build/lib/base/DTO.d.ts +59 -0
  409. package/build/lib/base/DTO.js +14 -0
  410. package/build/lib/base/Model.cjs +51 -0
  411. package/build/lib/base/Model.d.cts +30 -0
  412. package/build/lib/base/Model.d.ts +30 -0
  413. package/build/lib/base/Model.js +42 -0
  414. package/build/lib/base/Module.cjs +50 -0
  415. package/build/lib/base/Module.d.cts +20 -0
  416. package/build/lib/base/Module.d.ts +20 -0
  417. package/build/lib/base/Module.js +41 -0
  418. package/build/lib/base/abstracts/AsymmetricEncryption.cjs +27 -0
  419. package/build/lib/base/abstracts/AsymmetricEncryption.d.cts +172 -0
  420. package/build/lib/base/abstracts/AsymmetricEncryption.d.ts +172 -0
  421. package/build/lib/base/abstracts/AsymmetricEncryption.js +18 -0
  422. package/build/lib/base/abstracts/Exception.cjs +17 -0
  423. package/build/lib/base/abstracts/Exception.d.cts +23 -0
  424. package/build/lib/base/abstracts/Exception.d.ts +23 -0
  425. package/build/lib/base/abstracts/Exception.js +8 -0
  426. package/build/lib/base/abstracts/Interval.cjs +51 -0
  427. package/build/lib/base/abstracts/Interval.d.cts +76 -0
  428. package/build/lib/base/abstracts/Interval.d.ts +76 -0
  429. package/build/lib/base/abstracts/Interval.js +42 -0
  430. package/build/lib/base/abstracts/SymmetricEncryption.cjs +23 -0
  431. package/build/lib/base/abstracts/SymmetricEncryption.d.cts +149 -0
  432. package/build/lib/base/abstracts/SymmetricEncryption.d.ts +149 -0
  433. package/build/lib/base/abstracts/SymmetricEncryption.js +14 -0
  434. package/build/lib/base/async-constructor/Append.cjs +14 -0
  435. package/build/lib/base/async-constructor/Append.d.cts +5 -0
  436. package/build/lib/base/async-constructor/Append.d.ts +5 -0
  437. package/build/lib/base/async-constructor/Append.js +5 -0
  438. package/build/lib/base/async-constructor/AsyncConstructor.cjs +15 -0
  439. package/build/lib/base/async-constructor/AsyncConstructor.d.cts +7 -0
  440. package/build/lib/base/async-constructor/AsyncConstructor.d.ts +7 -0
  441. package/build/lib/base/async-constructor/AsyncConstructor.js +6 -0
  442. package/build/lib/components/Formatter.cjs +50 -0
  443. package/build/lib/components/Formatter.d.cts +203 -0
  444. package/build/lib/components/Formatter.d.ts +203 -0
  445. package/build/lib/components/Formatter.js +41 -0
  446. package/build/lib/components/Logger.cjs +50 -0
  447. package/build/lib/components/Logger.d.cts +61 -0
  448. package/build/lib/components/Logger.d.ts +61 -0
  449. package/build/lib/components/Logger.js +41 -0
  450. package/build/lib/crypto/RSA.cjs +28 -0
  451. package/build/lib/crypto/RSA.d.cts +61 -0
  452. package/build/lib/crypto/RSA.d.ts +61 -0
  453. package/build/lib/crypto/RSA.js +19 -0
  454. package/build/lib/crypto/SM2.cjs +28 -0
  455. package/build/lib/crypto/SM2.d.cts +47 -0
  456. package/build/lib/crypto/SM2.d.ts +47 -0
  457. package/build/lib/crypto/SM2.js +19 -0
  458. package/build/lib/crypto/aes/AES128.cjs +25 -0
  459. package/build/lib/crypto/aes/AES128.d.cts +14 -0
  460. package/build/lib/crypto/aes/AES128.d.ts +14 -0
  461. package/build/lib/crypto/aes/AES128.js +16 -0
  462. package/build/lib/crypto/aes/AES192.cjs +25 -0
  463. package/build/lib/crypto/aes/AES192.d.cts +14 -0
  464. package/build/lib/crypto/aes/AES192.d.ts +14 -0
  465. package/build/lib/crypto/aes/AES192.js +16 -0
  466. package/build/lib/crypto/aes/AES256.cjs +25 -0
  467. package/build/lib/crypto/aes/AES256.d.cts +14 -0
  468. package/build/lib/crypto/aes/AES256.d.ts +14 -0
  469. package/build/lib/crypto/aes/AES256.js +16 -0
  470. package/build/lib/crypto/aria/ARIA128.cjs +24 -0
  471. package/build/lib/crypto/aria/ARIA128.d.cts +13 -0
  472. package/build/lib/crypto/aria/ARIA128.d.ts +13 -0
  473. package/build/lib/crypto/aria/ARIA128.js +15 -0
  474. package/build/lib/crypto/aria/ARIA192.cjs +24 -0
  475. package/build/lib/crypto/aria/ARIA192.d.cts +13 -0
  476. package/build/lib/crypto/aria/ARIA192.d.ts +13 -0
  477. package/build/lib/crypto/aria/ARIA192.js +15 -0
  478. package/build/lib/crypto/aria/ARIA256.cjs +24 -0
  479. package/build/lib/crypto/aria/ARIA256.d.cts +13 -0
  480. package/build/lib/crypto/aria/ARIA256.d.ts +13 -0
  481. package/build/lib/crypto/aria/ARIA256.js +15 -0
  482. package/build/lib/crypto/camellia/CAMELLIA128.cjs +24 -0
  483. package/build/lib/crypto/camellia/CAMELLIA128.d.cts +13 -0
  484. package/build/lib/crypto/camellia/CAMELLIA128.d.ts +13 -0
  485. package/build/lib/crypto/camellia/CAMELLIA128.js +15 -0
  486. package/build/lib/crypto/camellia/CAMELLIA192.cjs +24 -0
  487. package/build/lib/crypto/camellia/CAMELLIA192.d.cts +13 -0
  488. package/build/lib/crypto/camellia/CAMELLIA192.d.ts +13 -0
  489. package/build/lib/crypto/camellia/CAMELLIA192.js +15 -0
  490. package/build/lib/crypto/camellia/CAMELLIA256.cjs +24 -0
  491. package/build/lib/crypto/camellia/CAMELLIA256.d.cts +13 -0
  492. package/build/lib/crypto/camellia/CAMELLIA256.d.ts +13 -0
  493. package/build/lib/crypto/camellia/CAMELLIA256.js +15 -0
  494. package/build/lib/crypto/des/DES.cjs +25 -0
  495. package/build/lib/crypto/des/DES.d.cts +14 -0
  496. package/build/lib/crypto/des/DES.d.ts +14 -0
  497. package/build/lib/crypto/des/DES.js +16 -0
  498. package/build/lib/crypto/des/TripleDES.cjs +25 -0
  499. package/build/lib/crypto/des/TripleDES.d.cts +14 -0
  500. package/build/lib/crypto/des/TripleDES.d.ts +14 -0
  501. package/build/lib/crypto/des/TripleDES.js +16 -0
  502. package/build/lib/ioc/DependencyInjectionContainer.cjs +29 -0
  503. package/build/lib/ioc/DependencyInjectionContainer.d.cts +4 -0
  504. package/build/lib/ioc/DependencyInjectionContainer.d.ts +4 -0
  505. package/build/lib/ioc/DependencyInjectionContainer.js +20 -0
  506. package/build/lib/ioc/Errors.cjs +27 -0
  507. package/build/lib/ioc/Errors.d.cts +53 -0
  508. package/build/lib/ioc/Errors.d.ts +53 -0
  509. package/build/lib/ioc/Errors.js +10 -0
  510. package/build/lib/ioc/FunctionTokenizer.cjs +18 -0
  511. package/build/lib/ioc/FunctionTokenizer.d.cts +33 -0
  512. package/build/lib/ioc/FunctionTokenizer.d.ts +33 -0
  513. package/build/lib/ioc/FunctionTokenizer.js +5 -0
  514. package/build/lib/ioc/InjectionMode.cjs +14 -0
  515. package/build/lib/ioc/InjectionMode.d.cts +12 -0
  516. package/build/lib/ioc/InjectionMode.d.ts +12 -0
  517. package/build/lib/ioc/InjectionMode.js +5 -0
  518. package/build/lib/ioc/Lifetime.cjs +14 -0
  519. package/build/lib/ioc/Lifetime.d.cts +12 -0
  520. package/build/lib/ioc/Lifetime.d.ts +12 -0
  521. package/build/lib/ioc/Lifetime.js +5 -0
  522. package/build/lib/ioc/ListModules.cjs +17 -0
  523. package/build/lib/ioc/ListModules.d.cts +4 -0
  524. package/build/lib/ioc/ListModules.d.ts +4 -0
  525. package/build/lib/ioc/ListModules.js +8 -0
  526. package/build/lib/ioc/LoadModuleNative.cjs +14 -0
  527. package/build/lib/ioc/LoadModuleNative.d.cts +9 -0
  528. package/build/lib/ioc/LoadModuleNative.d.ts +9 -0
  529. package/build/lib/ioc/LoadModuleNative.js +5 -0
  530. package/build/lib/ioc/LoadModules.cjs +26 -0
  531. package/build/lib/ioc/LoadModules.d.cts +4 -0
  532. package/build/lib/ioc/LoadModules.d.ts +4 -0
  533. package/build/lib/ioc/LoadModules.js +17 -0
  534. package/build/lib/ioc/ParamParser.cjs +15 -0
  535. package/build/lib/ioc/ParamParser.d.cts +25 -0
  536. package/build/lib/ioc/ParamParser.d.ts +25 -0
  537. package/build/lib/ioc/ParamParser.js +6 -0
  538. package/build/lib/ioc/Resolvers.cjs +49 -0
  539. package/build/lib/ioc/Resolvers.d.cts +4 -0
  540. package/build/lib/ioc/Resolvers.d.ts +4 -0
  541. package/build/lib/ioc/Resolvers.js +16 -0
  542. package/build/lib/ioc/Utils.cjs +35 -0
  543. package/build/lib/ioc/Utils.d.cts +38 -0
  544. package/build/lib/ioc/Utils.d.ts +38 -0
  545. package/build/lib/ioc/Utils.js +6 -0
  546. package/build/options/ApplicationOptions.cjs +50 -0
  547. package/build/options/ApplicationOptions.d.cts +20 -0
  548. package/build/options/ApplicationOptions.d.ts +20 -0
  549. package/build/options/ApplicationOptions.js +41 -0
  550. package/build/options/LoadComponentOptions.cjs +50 -0
  551. package/build/options/LoadComponentOptions.d.cts +22 -0
  552. package/build/options/LoadComponentOptions.d.ts +22 -0
  553. package/build/options/LoadComponentOptions.js +41 -0
  554. package/build/options/LoadEntryClassOptions.cjs +50 -0
  555. package/build/options/LoadEntryClassOptions.d.cts +16 -0
  556. package/build/options/LoadEntryClassOptions.d.ts +16 -0
  557. package/build/options/LoadEntryClassOptions.js +41 -0
  558. package/build/options/LoadEntryCommonOptions.cjs +27 -0
  559. package/build/options/LoadEntryCommonOptions.d.cts +13 -0
  560. package/build/options/LoadEntryCommonOptions.d.ts +13 -0
  561. package/build/options/LoadEntryCommonOptions.js +18 -0
  562. package/build/options/LoadModuleOptions.cjs +50 -0
  563. package/build/options/LoadModuleOptions.d.cts +20 -0
  564. package/build/options/LoadModuleOptions.d.ts +20 -0
  565. package/build/options/LoadModuleOptions.js +41 -0
  566. package/build/options/ModuleOptions.cjs +50 -0
  567. package/build/options/ModuleOptions.d.cts +20 -0
  568. package/build/options/ModuleOptions.d.ts +20 -0
  569. package/build/options/ModuleOptions.js +41 -0
  570. package/build/types/AsyncFunction.cjs +7 -0
  571. package/build/types/AsyncFunction.d.cts +3 -0
  572. package/build/types/AsyncFunction.d.ts +3 -0
  573. package/build/types/AsyncFunction.js +4 -0
  574. package/build/types/ControllerActionMapItem.cjs +7 -0
  575. package/build/types/ControllerActionMapItem.d.cts +20 -0
  576. package/build/types/ControllerActionMapItem.d.ts +20 -0
  577. package/build/types/ControllerActionMapItem.js +4 -0
  578. package/build/types/InjectionProperties.cjs +7 -0
  579. package/build/types/InjectionProperties.d.cts +3 -0
  580. package/build/types/InjectionProperties.d.ts +3 -0
  581. package/build/types/InjectionProperties.js +4 -0
  582. package/build/types/TimeInput.cjs +7 -0
  583. package/build/types/TimeInput.d.cts +5 -0
  584. package/build/types/TimeInput.d.ts +5 -0
  585. package/build/types/TimeInput.js +4 -0
  586. package/build/types/TimeObject.cjs +7 -0
  587. package/build/types/TimeObject.d.cts +11 -0
  588. package/build/types/TimeObject.d.ts +11 -0
  589. package/build/types/TimeObject.js +4 -0
  590. package/build/types/UnitOfTime.cjs +7 -0
  591. package/build/types/UnitOfTime.d.cts +14 -0
  592. package/build/types/UnitOfTime.d.ts +14 -0
  593. package/build/types/UnitOfTime.js +4 -0
  594. package/package.json +145 -0
@@ -0,0 +1,1851 @@
1
+ import './tests/Test.spec.cjs';
2
+
3
+ declare class BaseValidator {
4
+ /**
5
+ * 任意类型验证
6
+ * @constructor
7
+ */
8
+ Any<TSchema = any>(): AnySchema<TSchema>;
9
+ /**
10
+ * 字符串类型验证
11
+ * @constructor
12
+ */
13
+ String<TSchema = string>(): StringSchema<TSchema>;
14
+ /**
15
+ * 数字类型验证
16
+ * @constructor
17
+ */
18
+ Number<TSchema = number>(): NumberSchema<TSchema>;
19
+ /**
20
+ * 布尔类型验证
21
+ * @constructor
22
+ */
23
+ Boolean<TSchema = boolean>(): BooleanSchema<TSchema>;
24
+ /**
25
+ * 日期类型验证
26
+ * @constructor
27
+ */
28
+ Date<TSchema = Date>(): DateSchema<TSchema>;
29
+ /**
30
+ * 对象类型验证
31
+ * @param schema
32
+ * @constructor
33
+ */
34
+ Object<TSchema = any, isStrict = false, T = TSchema>(schema?: SchemaMap<T, isStrict>): ObjectSchema<TSchema>;
35
+ /**
36
+ * 数组类型验证
37
+ * @param types
38
+ * @constructor
39
+ */
40
+ Array<TSchema = any[]>(...types: SchemaLikeWithoutArray[]): ArraySchema<TSchema>;
41
+ /**
42
+ * 二进制类型验证
43
+ * @constructor
44
+ */
45
+ Binary<TSchema = Buffer>(): BinarySchema<TSchema>;
46
+ /**
47
+ * 方法类型验证
48
+ * @constructor
49
+ */
50
+ Function<TSchema = Function>(): FunctionSchema<TSchema>;
51
+ /**
52
+ * 异步方法类型验证
53
+ * @constructor
54
+ */
55
+ AsyncFunction<TSchema = Function>(): FunctionSchema<TSchema>;
56
+ /**
57
+ * 类验证器
58
+ * @param inheritsFrom
59
+ * @constructor
60
+ */
61
+ Class<TSchema = Function>(inheritsFrom?: TSchema | (() => TSchema)): FunctionSchema<TSchema>;
62
+ /**
63
+ * 通配符匹配操作符字符串验证器
64
+ * @constructor
65
+ */
66
+ Glob<TSchema = string>(): StringSchema<TSchema>;
67
+ /**
68
+ * 符号类型验证
69
+ * @constructor
70
+ */
71
+ Symbol<TSchema = Symbol>(): SymbolSchema<TSchema>;
72
+ /**
73
+ * 可选参数类型验证
74
+ * @param types
75
+ * @constructor
76
+ */
77
+ Alternatives<TSchema = any>(...types: SchemaLike[]): AlternativesSchema<TSchema>;
78
+ /**
79
+ * 为已命名的键值生成引用
80
+ * @param key
81
+ * @param options
82
+ * @constructor
83
+ */
84
+ Ref(key: string, options?: ReferenceOptions): Reference;
85
+ /**
86
+ * 将一个键标记为禁止,该键将不允许除undefined以外的任何值。用于明确禁止键。
87
+ * @constructor
88
+ */
89
+ Forbidden(): Schema;
90
+ /**
91
+ * 创建一个引用,当解析时,将其作为值数组用于与规则进行匹配。
92
+ * @param ref
93
+ * @param options
94
+ * @constructor
95
+ */
96
+ In(ref: string, options?: ReferenceOptions): Reference;
97
+ /**
98
+ * 对值进行模式验证,返回有效的对象,如果验证失败则抛出异常。
99
+ * @param value
100
+ * @param schema
101
+ * @param options
102
+ * @constructor
103
+ */
104
+ Attempt<TSchema extends Schema>(value: any, schema: TSchema, options?: ValidationOptions): TSchema extends Schema<infer Value> ? Value : never;
105
+ /**
106
+ * 根据Schema判断数据是否正确(同步方法)
107
+ * @param data
108
+ * @param schema
109
+ * @param options
110
+ */
111
+ isValid<T = any>(data: T, schema: Schema, options?: ValidationOptions): boolean;
112
+ /**
113
+ * 根据Schema判断数据是否正确(异步方法)
114
+ * @param data
115
+ * @param schema
116
+ * @param options
117
+ */
118
+ isValidAsync<T = any>(data: T, schema: Schema, options?: ValidationOptions): Promise<boolean>;
119
+ /**
120
+ * 根据Schema验证数据(同步方法)
121
+ * @param data
122
+ * @param schema
123
+ * @param options
124
+ */
125
+ validate<T = any>(data: T, schema: Schema, options?: ValidationOptions): T;
126
+ /**
127
+ * 根据Schema验证数据(异步方法)
128
+ * @param data
129
+ * @param schema
130
+ * @param options
131
+ */
132
+ validateAsync<T = any>(data: T, schema: Schema, options?: ValidationOptions): Promise<T>;
133
+ }
134
+ declare const Validator: BaseValidator;
135
+ type Types = 'any' | 'alternatives' | 'array' | 'boolean' | 'binary' | 'date' | 'function' | 'link' | 'number' | 'object' | 'string' | 'symbol';
136
+ type BasicType = boolean | number | string | any[] | object | null;
137
+ type LanguageMessages = Record<string, string>;
138
+ type PresenceMode = 'optional' | 'required' | 'forbidden';
139
+ interface ErrorFormattingOptions {
140
+ /**
141
+ * when true, error message templates will escape special characters to HTML entities, for security purposes.
142
+ *
143
+ * @default false
144
+ */
145
+ escapeHtml?: boolean;
146
+ /**
147
+ * defines the value used to set the label context variable.
148
+ */
149
+ label?: 'path' | 'key' | false;
150
+ /**
151
+ * The preferred language code for error messages.
152
+ * The value is matched against keys at the root of the messages object, and then the error code as a child key of that.
153
+ * Can be a reference to the value, global context, or local context which is the root value passed to the validation function.
154
+ *
155
+ * Note that references to the value are usually not what you want as they move around the value structure relative to where the error happens.
156
+ * Instead, either use the global context, or the absolute value (e.g. `Joi.ref('/variable')`)
157
+ */
158
+ language?: keyof LanguageMessages;
159
+ /**
160
+ * when false, skips rendering error templates. Useful when error messages are generated elsewhere to save processing time.
161
+ *
162
+ * @default true
163
+ */
164
+ render?: boolean;
165
+ /**
166
+ * when true, the main error will possess a stack trace, otherwise it will be disabled.
167
+ * Defaults to false for performances reasons. Has no effect on platforms other than V8/node.js as it uses the Stack trace API.
168
+ *
169
+ * @default false
170
+ */
171
+ stack?: boolean;
172
+ /**
173
+ * overrides the way values are wrapped (e.g. `[]` around arrays, `""` around labels).
174
+ * Each key can be set to a string with one (same character before and after the value) or two characters (first character
175
+ * before and second character after), or `false` to disable wrapping.
176
+ */
177
+ wrap?: {
178
+ /**
179
+ * the characters used around `{#label}` references. Defaults to `'"'`.
180
+ *
181
+ * @default '"'
182
+ */
183
+ label?: string | false;
184
+ /**
185
+ * the characters used around array values. Defaults to `'[]'`
186
+ *
187
+ * @default '[]'
188
+ */
189
+ array?: string | false;
190
+ /**
191
+ * the characters used around array string values. Defaults to no wrapping.
192
+ *
193
+ * @default false
194
+ */
195
+ string?: string | false;
196
+ };
197
+ }
198
+ interface BaseValidationOptions {
199
+ /**
200
+ * when true, stops validation on the first error, otherwise returns all the errors found.
201
+ *
202
+ * @default true
203
+ */
204
+ abortEarly?: boolean;
205
+ /**
206
+ * when true, allows object to contain unknown keys which are ignored.
207
+ *
208
+ * @default false
209
+ */
210
+ allowUnknown?: boolean;
211
+ /**
212
+ * when true, return artifacts alongside the value.
213
+ *
214
+ * @default false
215
+ */
216
+ artifacts?: boolean;
217
+ /**
218
+ * when true, schema caching is enabled (for schemas with explicit caching rules).
219
+ *
220
+ * @default false
221
+ */
222
+ cache?: boolean;
223
+ /**
224
+ * provides an external data set to be used in references
225
+ */
226
+ context?: Context;
227
+ /**
228
+ * when true, attempts to cast values to the required types (e.g. a string to a number).
229
+ *
230
+ * @default true
231
+ */
232
+ convert?: boolean;
233
+ /**
234
+ * sets the string format used when converting dates to strings in error messages and casting.
235
+ *
236
+ * @default 'iso'
237
+ */
238
+ dateFormat?: 'date' | 'iso' | 'string' | 'time' | 'utc';
239
+ /**
240
+ * when true, valid results and throw errors are decorated with a debug property which includes an array of the validation steps used to generate the returned result.
241
+ *
242
+ * @default false
243
+ */
244
+ debug?: boolean;
245
+ /**
246
+ * error formatting settings.
247
+ */
248
+ errors?: ErrorFormattingOptions;
249
+ /**
250
+ * if false, the external rules set with `any.external()` are ignored, which is required to ignore any external validations in synchronous mode (or an exception is thrown).
251
+ *
252
+ * @default true
253
+ */
254
+ externals?: boolean;
255
+ /**
256
+ * when true, do not apply default values.
257
+ *
258
+ * @default false
259
+ */
260
+ noDefaults?: boolean;
261
+ /**
262
+ * when true, inputs are shallow cloned to include non-enumerable properties.
263
+ *
264
+ * @default false
265
+ */
266
+ nonEnumerables?: boolean;
267
+ /**
268
+ * sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'.
269
+ *
270
+ * @default 'optional'
271
+ */
272
+ presence?: PresenceMode;
273
+ /**
274
+ * when true, ignores unknown keys with a function value.
275
+ *
276
+ * @default false
277
+ */
278
+ skipFunctions?: boolean;
279
+ /**
280
+ * remove unknown elements from objects and arrays.
281
+ * - when true, all unknown elements will be removed
282
+ * - when an object:
283
+ * - objects - set to true to remove unknown keys from objects
284
+ *
285
+ * @default false
286
+ */
287
+ stripUnknown?: boolean | {
288
+ arrays?: boolean;
289
+ objects?: boolean;
290
+ };
291
+ }
292
+ interface ValidationOptions extends BaseValidationOptions {
293
+ /**
294
+ * overrides individual error messages. Defaults to no override (`{}`).
295
+ * Messages use the same rules as templates.
296
+ * Variables in double braces `{{var}}` are HTML escaped if the option `errors.escapeHtml` is set to true.
297
+ *
298
+ * @default {}
299
+ */
300
+ messages?: LanguageMessages;
301
+ }
302
+ interface AsyncValidationOptions extends ValidationOptions {
303
+ /**
304
+ * when true, artifacts are returned alongside the value (i.e. `{ value, artifacts }`)
305
+ *
306
+ * @default false
307
+ */
308
+ artifacts?: boolean;
309
+ /**
310
+ * when true, warnings are returned alongside the value (i.e. `{ value, warning }`).
311
+ *
312
+ * @default false
313
+ */
314
+ warnings?: boolean;
315
+ }
316
+ interface LanguageMessageTemplate {
317
+ source: string;
318
+ rendered: string;
319
+ }
320
+ interface ErrorValidationOptions extends BaseValidationOptions {
321
+ messages?: Record<string, LanguageMessageTemplate>;
322
+ }
323
+ interface RenameOptions {
324
+ /**
325
+ * if true, does not delete the old key name, keeping both the new and old keys in place.
326
+ *
327
+ * @default false
328
+ */
329
+ alias?: boolean;
330
+ /**
331
+ * if true, allows renaming multiple keys to the same destination where the last rename wins.
332
+ *
333
+ * @default false
334
+ */
335
+ multiple?: boolean;
336
+ /**
337
+ * if true, allows renaming a key over an existing key.
338
+ *
339
+ * @default false
340
+ */
341
+ override?: boolean;
342
+ /**
343
+ * if true, skip renaming of a key if it's undefined.
344
+ *
345
+ * @default false
346
+ */
347
+ ignoreUndefined?: boolean;
348
+ }
349
+ interface TopLevelDomainOptions {
350
+ /**
351
+ * - `true` to use the IANA list of registered TLDs. This is the default value.
352
+ * - `false` to allow any TLD not listed in the `deny` list, if present.
353
+ * - A `Set` or array of the allowed TLDs. Cannot be used together with `deny`.
354
+ */
355
+ allow?: Set<string> | string[] | boolean;
356
+ /**
357
+ * - A `Set` or array of the forbidden TLDs. Cannot be used together with a custom `allow` list.
358
+ */
359
+ deny?: Set<string> | string[];
360
+ }
361
+ interface HierarchySeparatorOptions {
362
+ /**
363
+ * overrides the default `.` hierarchy separator. Set to false to treat the key as a literal value.
364
+ *
365
+ * @default '.'
366
+ */
367
+ separator?: string | false;
368
+ }
369
+ interface DependencyOptions extends HierarchySeparatorOptions {
370
+ /**
371
+ * overrides the default check for a present value.
372
+ *
373
+ * @default (resolved) => resolved !== undefined
374
+ */
375
+ isPresent?: (resolved: any) => boolean;
376
+ }
377
+ interface EmailOptions {
378
+ /**
379
+ * if `true`, domains ending with a `.` character are permitted
380
+ *
381
+ * @default false
382
+ */
383
+ allowFullyQualified?: boolean;
384
+ /**
385
+ * If `true`, Unicode characters are permitted
386
+ *
387
+ * @default true
388
+ */
389
+ allowUnicode?: boolean;
390
+ /**
391
+ * if `true`, ignore invalid email length errors.
392
+ *
393
+ * @default false
394
+ */
395
+ ignoreLength?: boolean;
396
+ /**
397
+ * if true, allows multiple email addresses in a single string, separated by , or the separator characters.
398
+ *
399
+ * @default false
400
+ */
401
+ multiple?: boolean;
402
+ /**
403
+ * when multiple is true, overrides the default , separator. String can be a single character or multiple separator characters.
404
+ *
405
+ * @default ','
406
+ */
407
+ separator?: string | string[];
408
+ /**
409
+ * Options for TLD (top level domain) validation. By default, the TLD must be a valid name listed on the [IANA registry](http://data.iana.org/TLD/tlds-alpha-by-domain.txt)
410
+ *
411
+ * @default { allow: true }
412
+ */
413
+ tlds?: TopLevelDomainOptions | false;
414
+ /**
415
+ * Number of segments required for the domain. Be careful since some domains, such as `io`, directly allow email.
416
+ *
417
+ * @default 2
418
+ */
419
+ minDomainSegments?: number;
420
+ /**
421
+ * The maximum number of domain segments (e.g. `x.y.z` has 3 segments) allowed. Defaults to no limit.
422
+ *
423
+ * @default Infinity
424
+ */
425
+ maxDomainSegments?: number;
426
+ }
427
+ interface DomainOptions {
428
+ /**
429
+ * if `true`, domains ending with a `.` character are permitted
430
+ *
431
+ * @default false
432
+ */
433
+ allowFullyQualified?: boolean;
434
+ /**
435
+ * If `true`, Unicode characters are permitted
436
+ *
437
+ * @default true
438
+ */
439
+ allowUnicode?: boolean;
440
+ /**
441
+ * Options for TLD (top level domain) validation. By default, the TLD must be a valid name listed on the [IANA registry](http://data.iana.org/TLD/tlds-alpha-by-domain.txt)
442
+ *
443
+ * @default { allow: true }
444
+ */
445
+ tlds?: TopLevelDomainOptions | false;
446
+ /**
447
+ * Number of segments required for the domain.
448
+ *
449
+ * @default 2
450
+ */
451
+ minDomainSegments?: number;
452
+ /**
453
+ * The maximum number of domain segments (e.g. `x.y.z` has 3 segments) allowed. Defaults to no limit.
454
+ *
455
+ * @default Infinity
456
+ */
457
+ maxDomainSegments?: number;
458
+ }
459
+ interface HexOptions {
460
+ /**
461
+ * hex decoded representation must be byte aligned.
462
+ * @default false
463
+ */
464
+ byteAligned?: boolean;
465
+ }
466
+ interface IpOptions {
467
+ /**
468
+ * One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture
469
+ */
470
+ version?: string | string[];
471
+ /**
472
+ * Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden
473
+ */
474
+ cidr?: PresenceMode;
475
+ }
476
+ type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5';
477
+ interface GuidOptions {
478
+ version?: GuidVersions[] | GuidVersions;
479
+ separator?: boolean | '-' | ':';
480
+ }
481
+ interface UriOptions {
482
+ /**
483
+ * Specifies one or more acceptable Schemes, should only include the scheme name.
484
+ * Can be an Array or String (strings are automatically escaped for use in a Regular Expression).
485
+ */
486
+ scheme?: string | RegExp | Array<string | RegExp>;
487
+ /**
488
+ * Allow relative URIs.
489
+ *
490
+ * @default false
491
+ */
492
+ allowRelative?: boolean;
493
+ /**
494
+ * Restrict only relative URIs.
495
+ *
496
+ * @default false
497
+ */
498
+ relativeOnly?: boolean;
499
+ /**
500
+ * Allows unencoded square brackets inside the query string.
501
+ * This is NOT RFC 3986 compliant but query strings like abc[]=123&abc[]=456 are very common these days.
502
+ *
503
+ * @default false
504
+ */
505
+ allowQuerySquareBrackets?: boolean;
506
+ /**
507
+ * Validate the domain component using the options specified in `string.domain()`.
508
+ */
509
+ domain?: DomainOptions;
510
+ }
511
+ interface DataUriOptions {
512
+ /**
513
+ * optional parameter defaulting to true which will require `=` padding if true or make padding optional if false
514
+ *
515
+ * @default true
516
+ */
517
+ paddingRequired?: boolean;
518
+ }
519
+ interface Base64Options extends Pick<DataUriOptions, 'paddingRequired'> {
520
+ /**
521
+ * if true, uses the URI-safe base64 format which replaces `+` with `-` and `\` with `_`.
522
+ *
523
+ * @default false
524
+ */
525
+ urlSafe?: boolean;
526
+ }
527
+ interface SwitchCases {
528
+ /**
529
+ * the required condition joi type.
530
+ */
531
+ is: SchemaLike;
532
+ /**
533
+ * the alternative schema type if the condition is true.
534
+ */
535
+ then: SchemaLike;
536
+ }
537
+ interface SwitchDefault {
538
+ /**
539
+ * the alternative schema type if no cases matched.
540
+ * Only one otherwise statement is allowed in switch as the last array item.
541
+ */
542
+ otherwise: SchemaLike;
543
+ }
544
+ interface WhenOptions {
545
+ /**
546
+ * the required condition joi type.
547
+ */
548
+ is?: SchemaLike;
549
+ /**
550
+ * the negative version of `is` (`then` and `otherwise` have reverse
551
+ * roles).
552
+ */
553
+ not?: SchemaLike;
554
+ /**
555
+ * the alternative schema type if the condition is true. Required if otherwise or switch are missing.
556
+ */
557
+ then?: SchemaLike;
558
+ /**
559
+ * the alternative schema type if the condition is false. Required if then or switch are missing.
560
+ */
561
+ otherwise?: SchemaLike;
562
+ /**
563
+ * the list of cases. Required if then is missing. Required if then or otherwise are missing.
564
+ */
565
+ switch?: Array<SwitchCases | SwitchDefault>;
566
+ /**
567
+ * whether to stop applying further conditions if the condition is true.
568
+ */
569
+ break?: boolean;
570
+ }
571
+ interface WhenSchemaOptions {
572
+ /**
573
+ * the alternative schema type if the condition is true. Required if otherwise is missing.
574
+ */
575
+ then?: SchemaLike;
576
+ /**
577
+ * the alternative schema type if the condition is false. Required if then is missing.
578
+ */
579
+ otherwise?: SchemaLike;
580
+ }
581
+ interface Cache {
582
+ /**
583
+ * Add an item to the cache.
584
+ *
585
+ * Note that key and value can be anything including objects, array, etc.
586
+ */
587
+ set(key: any, value: any): void;
588
+ /**
589
+ * Retrieve an item from the cache.
590
+ *
591
+ * Note that key and value can be anything including objects, array, etc.
592
+ */
593
+ get(key: any): any;
594
+ }
595
+ interface CacheProvisionOptions {
596
+ /**
597
+ * number of items to store in the cache before the least used items are dropped.
598
+ *
599
+ * @default 1000
600
+ */
601
+ max: number;
602
+ }
603
+ interface CacheConfiguration {
604
+ /**
605
+ * Provisions a simple LRU cache for caching simple inputs (`undefined`, `null`, strings, numbers, and booleans).
606
+ */
607
+ provision(options?: CacheProvisionOptions): void;
608
+ }
609
+ interface CompileOptions {
610
+ /**
611
+ * If true and the provided schema is (or contains parts) using an older version of joi, will return a compiled schema that is compatible with the older version.
612
+ * If false, the schema is always compiled using the current version and if older schema components are found, an error is thrown.
613
+ */
614
+ legacy: boolean;
615
+ }
616
+ interface IsSchemaOptions {
617
+ /**
618
+ * If true, will identify schemas from older versions of joi, otherwise will throw an error.
619
+ *
620
+ * @default false
621
+ */
622
+ legacy: boolean;
623
+ }
624
+ interface ReferenceOptions extends HierarchySeparatorOptions {
625
+ /**
626
+ * a function with the signature `function(value)` where `value` is the resolved reference value and the return value is the adjusted value to use.
627
+ * Note that the adjust feature will not perform any type validation on the adjusted value, and it must match the value expected by the rule it is used in.
628
+ * Cannot be used with `map`.
629
+ *
630
+ * @example `(value) => value + 5`
631
+ */
632
+ adjust?: (value: any) => any;
633
+ /**
634
+ * an array of array pairs using the format `[[key, value], [key, value]]` used to maps the resolved reference value to another value.
635
+ * If the resolved value is not in the map, it is returned as-is.
636
+ * Cannot be used with `adjust`.
637
+ */
638
+ map?: Array<[any, any]>;
639
+ /**
640
+ * overrides default prefix characters.
641
+ */
642
+ prefix?: {
643
+ /**
644
+ * references to the globally provided context preference.
645
+ *
646
+ * @default '$'
647
+ */
648
+ global?: string;
649
+ /**
650
+ * references to error-specific or rule specific context.
651
+ *
652
+ * @default '#'
653
+ */
654
+ local?: string;
655
+ /**
656
+ * references to the root value being validated.
657
+ *
658
+ * @default '/'
659
+ */
660
+ root?: string;
661
+ };
662
+ /**
663
+ * If set to a number, sets the reference relative starting point.
664
+ * Cannot be combined with separator prefix characters.
665
+ * Defaults to the reference key prefix (or 1 if none present)
666
+ */
667
+ ancestor?: number;
668
+ /**
669
+ * creates an in-reference.
670
+ */
671
+ in?: boolean;
672
+ /**
673
+ * when true, the reference resolves by reaching into maps and sets.
674
+ */
675
+ iterables?: boolean;
676
+ /**
677
+ * when true, the value of the reference is used instead of its name in error messages
678
+ * and template rendering. Defaults to false.
679
+ */
680
+ render?: boolean;
681
+ }
682
+ interface StringRegexOptions {
683
+ /**
684
+ * optional pattern name.
685
+ */
686
+ name?: string;
687
+ /**
688
+ * when true, the provided pattern will be disallowed instead of required.
689
+ *
690
+ * @default false
691
+ */
692
+ invert?: boolean;
693
+ }
694
+ interface RuleOptions {
695
+ /**
696
+ * if true, the rules will not be replaced by the same unique rule later.
697
+ *
698
+ * For example, `Joi.number().min(1).rule({ keep: true }).min(2)` will keep both `min()` rules instead of the later rule overriding the first.
699
+ *
700
+ * @default false
701
+ */
702
+ keep?: boolean;
703
+ /**
704
+ * a single message string or a messages object where each key is an error code and corresponding message string as value.
705
+ *
706
+ * The object is the same as the messages used as an option in `any.validate()`.
707
+ * The strings can be plain messages or a message template.
708
+ */
709
+ message?: string | LanguageMessages;
710
+ /**
711
+ * if true, turns any error generated by the ruleset to warnings.
712
+ */
713
+ warn?: boolean;
714
+ }
715
+ interface ErrorReport extends Error {
716
+ code: string;
717
+ flags: Record<string, ExtensionFlag>;
718
+ path: string[];
719
+ prefs: ErrorValidationOptions;
720
+ messages: LanguageMessages;
721
+ state: State;
722
+ value: any;
723
+ local: any;
724
+ }
725
+ interface ValidationError extends Error {
726
+ name: 'ValidationError';
727
+ isJoi: boolean;
728
+ /**
729
+ * array of errors.
730
+ */
731
+ details: ValidationErrorItem[];
732
+ /**
733
+ * function that returns a string with an annotated version of the object pointing at the places where errors occurred.
734
+ *
735
+ * NOTE: This method does not exist in browser builds of Joi
736
+ *
737
+ * @param stripColors - if truthy, will strip the colors out of the output.
738
+ */
739
+ annotate(stripColors?: boolean): string;
740
+ _original: any;
741
+ }
742
+ interface ValidationErrorItem {
743
+ message: string;
744
+ path: Array<string | number>;
745
+ type: string;
746
+ context?: Context;
747
+ }
748
+ type ValidationErrorFunction = (errors: ErrorReport[]) => string | ValidationErrorItem | Error;
749
+ interface ValidationWarning {
750
+ message: string;
751
+ details: ValidationErrorItem[];
752
+ }
753
+ type ValidationResult<TSchema = any> = {
754
+ error: undefined;
755
+ warning?: ValidationError;
756
+ value: TSchema;
757
+ } | {
758
+ error: ValidationError;
759
+ warning?: ValidationError;
760
+ value: undefined;
761
+ };
762
+ interface CreateErrorOptions {
763
+ flags?: boolean;
764
+ messages?: LanguageMessages;
765
+ }
766
+ interface ModifyOptions {
767
+ each?: boolean;
768
+ once?: boolean;
769
+ ref?: boolean;
770
+ schema?: boolean;
771
+ }
772
+ interface MutateRegisterOptions {
773
+ family?: any;
774
+ key?: any;
775
+ }
776
+ interface SetFlagOptions {
777
+ clone: boolean;
778
+ }
779
+ interface CustomHelpers<V = any> {
780
+ schema: ExtensionBoundSchema;
781
+ state: State;
782
+ prefs: ValidationOptions;
783
+ original: V;
784
+ warn: (code: string, local?: Context) => void;
785
+ error: (code: string, local?: Context) => ErrorReport;
786
+ message: (messages: LanguageMessages, local?: Context) => ErrorReport;
787
+ }
788
+ type CustomValidator<V = any, R = V> = (value: V, helpers: CustomHelpers<R>) => R | ErrorReport;
789
+ interface ExternalHelpers<V = any> {
790
+ schema: ExtensionBoundSchema;
791
+ linked: ExtensionBoundSchema | null;
792
+ state: State;
793
+ prefs: ValidationOptions;
794
+ original: V;
795
+ warn: (code: string, local?: Context) => void;
796
+ error: (code: string, local?: Context) => ErrorReport;
797
+ message: (messages: LanguageMessages, local?: Context) => ErrorReport;
798
+ }
799
+ type ExternalValidationFunction<V = any, R = V> = (value: V, helpers: ExternalHelpers<R>) => R | undefined;
800
+ type SchemaLikeWithoutArray = string | number | boolean | null | Schema | SchemaMap;
801
+ type SchemaLike = SchemaLikeWithoutArray | object;
802
+ type NullableType<T> = undefined | null | T;
803
+ type IsPrimitiveSubset<T> = [
804
+ T
805
+ ] extends [string] ? true : [T] extends [number] ? true : [T] extends [bigint] ? true : [T] extends [boolean] ? true : [T] extends [symbol] ? true : [T] extends [null] ? true : [T] extends [undefined] ? true : false;
806
+ type IsUnion<T, U extends T = T> = T extends unknown ? [U] extends [T] ? false : true : false;
807
+ type IsNonPrimitiveSubsetUnion<T> = true extends IsUnion<T> ? true extends IsPrimitiveSubset<T> ? false : true : false;
808
+ type ObjectPropertiesSchema<T = any> = true extends IsNonPrimitiveSubsetUnion<Exclude<T, undefined | null>> ? AlternativesSchema : T extends NullableType<string> ? StringSchema : T extends NullableType<number> ? NumberSchema : T extends NullableType<bigint> ? NumberSchema : T extends NullableType<boolean> ? BooleanSchema : T extends NullableType<Date> ? DateSchema : T extends NullableType<Array<any>> ? ArraySchema : T extends NullableType<object> ? (StrictSchemaMap<T> | ObjectSchema<T>) : never;
809
+ type PartialSchemaMap<TSchema = any> = {
810
+ [key in keyof TSchema]?: SchemaLike | SchemaLike[];
811
+ };
812
+ type StrictSchemaMap<TSchema = any> = {
813
+ [key in keyof TSchema]-?: ObjectPropertiesSchema<TSchema[key]>;
814
+ };
815
+ type SchemaMap<TSchema = any, isStrict = false> = isStrict extends true ? StrictSchemaMap<TSchema> : PartialSchemaMap<TSchema>;
816
+ type Schema<P = any> = AnySchema<P> | ArraySchema<P> | AlternativesSchema<P> | BinarySchema<P> | BooleanSchema<P> | DateSchema<P> | FunctionSchema<P> | NumberSchema<P> | ObjectSchema<P> | StringSchema<P> | LinkSchema<P> | SymbolSchema<P>;
817
+ type SchemaFunction = (schema: Schema) => Schema;
818
+ interface AddRuleOptions {
819
+ name: string;
820
+ args?: {
821
+ [key: string]: any;
822
+ };
823
+ }
824
+ interface GetRuleOptions {
825
+ args?: Record<string, any>;
826
+ method?: string;
827
+ name: string;
828
+ operator?: string;
829
+ }
830
+ interface SchemaInternals {
831
+ /**
832
+ * Parent schema object.
833
+ */
834
+ $_super: Schema;
835
+ /**
836
+ * Terms of current schema.
837
+ */
838
+ $_terms: Record<string, any>;
839
+ /**
840
+ * Adds a rule to current validation schema.
841
+ */
842
+ $_addRule(rule: string | AddRuleOptions): Schema;
843
+ /**
844
+ * Internally compiles schema.
845
+ */
846
+ $_compile(schema: SchemaLike, options?: CompileOptions): Schema;
847
+ /**
848
+ * Creates a joi error object.
849
+ */
850
+ $_createError(code: string, value: any, context: Context, state: State, prefs: ValidationOptions, options?: CreateErrorOptions): Err;
851
+ /**
852
+ * Get value from given flag.
853
+ */
854
+ $_getFlag(name: string): any;
855
+ /**
856
+ * Retrieve some rule configuration.
857
+ */
858
+ $_getRule(name: string): GetRuleOptions | undefined;
859
+ $_mapLabels(path: string | string[]): string;
860
+ /**
861
+ * Returns true if validations runs fine on given value.
862
+ */
863
+ $_match(value: any, state: State, prefs: ValidationOptions): boolean;
864
+ $_modify(options?: ModifyOptions): Schema;
865
+ /**
866
+ * Resets current schema.
867
+ */
868
+ $_mutateRebuild(): this;
869
+ $_mutateRegister(schema: Schema, options?: MutateRegisterOptions): void;
870
+ /**
871
+ * Get value from given property.
872
+ */
873
+ $_property(name: string): any;
874
+ /**
875
+ * Get schema at given path.
876
+ */
877
+ $_reach(path: string[]): Schema;
878
+ /**
879
+ * Get current schema root references.
880
+ */
881
+ $_rootReferences(): any;
882
+ /**
883
+ * Set flag to given value.
884
+ */
885
+ $_setFlag(flag: string, value: any, options?: SetFlagOptions): void;
886
+ /**
887
+ * Runs internal validations against given value.
888
+ */
889
+ $_validate(value: any, state: State, prefs: ValidationOptions): ValidationResult;
890
+ }
891
+ interface AnySchema<TSchema = any> extends SchemaInternals {
892
+ /**
893
+ * Flags of current schema.
894
+ */
895
+ _flags: Record<string, any>;
896
+ /**
897
+ * Starts a ruleset in order to apply multiple rule options. The set ends when `rule()`, `keep()`, `message()`, or `warn()` is called.
898
+ */
899
+ $: this;
900
+ /**
901
+ * Starts a ruleset in order to apply multiple rule options. The set ends when `rule()`, `keep()`, `message()`, or `warn()` is called.
902
+ */
903
+ ruleset: this;
904
+ type?: Types | string;
905
+ /**
906
+ * Whitelists a value
907
+ */
908
+ allow(...values: any[]): this;
909
+ /**
910
+ * Assign target alteration options to a schema that are applied when `any.tailor()` is called.
911
+ * @param targets - an object where each key is a target name, and each value is a function that takes a schema and returns a schema.
912
+ */
913
+ alter(targets: Record<string, (schema: this) => Schema>): this;
914
+ /**
915
+ * Assigns the schema an artifact id which is included in the validation result if the rule passed validation.
916
+ * @param id - any value other than undefined which will be returned as-is in the result artifacts map.
917
+ */
918
+ artifact(id: any): this;
919
+ /**
920
+ * By default, some Joi methods to function properly need to rely on the Joi instance they are attached to because
921
+ * they use `this` internally.
922
+ * So `Joi.string()` works but if you extract the function from it and call `string()` it won't.
923
+ * `bind()` creates a new Joi instance where all the functions relying on `this` are bound to the Joi instance.
924
+ */
925
+ bind(): this;
926
+ /**
927
+ * Adds caching to the schema which will attempt to cache the validation results (success and failures) of incoming inputs.
928
+ * If no cache is passed, a default cache is provisioned by using `cache.provision()` internally.
929
+ */
930
+ cache(cache?: Cache): this;
931
+ /**
932
+ * Casts the validated value to the specified type.
933
+ */
934
+ cast(to: 'map' | 'number' | 'set' | 'string'): this;
935
+ /**
936
+ * Returns a new type that is the result of adding the rules of one type to another.
937
+ */
938
+ concat(schema: this): this;
939
+ /**
940
+ * Adds a custom validation function.
941
+ */
942
+ custom(fn: CustomValidator, description?: string): this;
943
+ /**
944
+ * Sets a default value if the original value is `undefined` where:
945
+ * @param value - the default value. One of:
946
+ * - a literal value (string, number, object, etc.)
947
+ * - a [references](#refkey-options)
948
+ * - a function which returns the default value using the signature `function(parent, helpers)` where:
949
+ * - `parent` - a clone of the object containing the value being validated. Note that since specifying a
950
+ * `parent` argument performs cloning, do not declare format arguments if you are not using them.
951
+ * - `helpers` - same as those described in [`any.custom()`](anycustomermethod_description)
952
+ *
953
+ * When called without any `value` on an object schema type, a default value will be automatically generated
954
+ * based on the default values of the object keys.
955
+ *
956
+ * Note that if value is an object, any changes to the object after `default()` is called will change the
957
+ * reference and any future assignment.
958
+ */
959
+ default(value?: BasicType | Reference | ((parent: any, helpers: CustomHelpers) => BasicType | Reference)): this;
960
+ /**
961
+ * Returns a plain object representing the schema's rules and properties
962
+ */
963
+ describe(): Description;
964
+ /**
965
+ * Annotates the key
966
+ */
967
+ description(desc: string): this;
968
+ /**
969
+ * Disallows values.
970
+ */
971
+ disallow(...values: any[]): this;
972
+ /**
973
+ * Considers anything that matches the schema to be empty (undefined).
974
+ * @param schema - any object or joi schema to match. An undefined schema unsets that rule.
975
+ */
976
+ empty(schema?: SchemaLike): this;
977
+ /**
978
+ * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed.
979
+ */
980
+ equal(...values: any[]): this;
981
+ /**
982
+ * Overrides the default joi error with a custom error if the rule fails where:
983
+ * @param err - can be:
984
+ * an instance of `Error` - the override error.
985
+ * a `function(errors)`, taking an array of errors as argument, where it must either:
986
+ * return a `string` - substitutes the error message with this text
987
+ * return a single ` object` or an `Array` of it, where:
988
+ * `type` - optional parameter providing the type of the error (e.g. `number.min`).
989
+ * `message` - optional parameter if `template` is provided, containing the text of the error.
990
+ * `template` - optional parameter if `message` is provided, containing a template string, using the same format as usual joi language errors.
991
+ * `context` - optional parameter, to provide context to your error if you are using the `template`.
992
+ * return an `Error` - same as when you directly provide an `Error`, but you can customize the error message based on the errors.
993
+ *
994
+ * Note that if you provide an `Error`, it will be returned as-is, unmodified and undecorated with any of the
995
+ * normal joi error properties. If validation fails and another error is found before the error
996
+ * override, that error will be returned and the override will be ignored (unless the `abortEarly`
997
+ * option has been set to `false`).
998
+ */
999
+ error(err: Error | ValidationErrorFunction): this;
1000
+ /**
1001
+ * Annotates the key with an example value, must be valid.
1002
+ */
1003
+ example(value: any, options?: {
1004
+ override: boolean;
1005
+ }): this;
1006
+ /**
1007
+ * Marks a key as required which will not allow undefined as value. All keys are optional by default.
1008
+ */
1009
+ exist(): this;
1010
+ /**
1011
+ * Adds an external validation rule.
1012
+ *
1013
+ * Note that external validation rules are only called after the all other validation rules for the entire schema (from the value root) are checked.
1014
+ * This means that any changes made to the value by the external rules are not available to any other validation rules during the non-external validation phase.
1015
+ * If schema validation failed, no external validation rules are called.
1016
+ */
1017
+ external(method: ExternalValidationFunction, description?: string): this;
1018
+ /**
1019
+ * Returns a sub-schema based on a path of object keys or schema ids.
1020
+ *
1021
+ * @param path - a dot `.` separated path string or a pre-split array of path keys. The keys must match the sub-schema id or object key (if no id was explicitly set).
1022
+ */
1023
+ extract(path: string | string[]): Schema;
1024
+ /**
1025
+ * Sets a failover value if the original value fails passing validation.
1026
+ *
1027
+ * @param value - the failover value. value supports references. value may be assigned a function which returns the default value.
1028
+ *
1029
+ * If value is specified as a function that accepts a single parameter, that parameter will be a context object that can be used to derive the resulting value.
1030
+ * Note that if value is an object, any changes to the object after `failover()` is called will change the reference and any future assignment.
1031
+ * Use a function when setting a dynamic value (e.g. the current time).
1032
+ * Using a function with a single argument performs some internal cloning which has a performance impact.
1033
+ * If you do not need access to the context, define the function without any arguments.
1034
+ */
1035
+ failover(value: any): this;
1036
+ /**
1037
+ * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys.
1038
+ */
1039
+ forbidden(): this;
1040
+ /**
1041
+ * Returns a new schema where each of the path keys listed have been modified.
1042
+ *
1043
+ * @param key - an array of key strings, a single key string, or an array of arrays of pre-split key strings.
1044
+ * @param adjuster - a function which must return a modified schema.
1045
+ */
1046
+ fork(key: string | string[] | string[][], adjuster: SchemaFunction): this;
1047
+ /**
1048
+ * Sets a schema id for reaching into the schema via `any.extract()`.
1049
+ * If no id is set, the schema id defaults to the object key it is associated with.
1050
+ * If the schema is used in an array or alternatives type and no id is set, the schema in unreachable.
1051
+ */
1052
+ id(name?: string): this;
1053
+ /**
1054
+ * Disallows values.
1055
+ */
1056
+ invalid(...values: any[]): this;
1057
+ /**
1058
+ * Same as `rule({ keep: true })`.
1059
+ *
1060
+ * Note that `keep()` will terminate the current ruleset and cannot be followed by another rule option.
1061
+ * Use `rule()` to apply multiple rule options.
1062
+ */
1063
+ keep(): this;
1064
+ /**
1065
+ * Overrides the key name in error messages.
1066
+ */
1067
+ label(name: string): this;
1068
+ /**
1069
+ * Same as `rule({ message })`.
1070
+ *
1071
+ * Note that `message()` will terminate the current ruleset and cannot be followed by another rule option.
1072
+ * Use `rule()` to apply multiple rule options.
1073
+ */
1074
+ message(message: string): this;
1075
+ /**
1076
+ * Same as `any.prefs({ messages })`.
1077
+ * Note that while `any.message()` applies only to the last rule or ruleset, `any.messages()` applies to the entire schema.
1078
+ */
1079
+ messages(messages: LanguageMessages): this;
1080
+ /**
1081
+ * Attaches metadata to the key.
1082
+ */
1083
+ meta(meta: object): this;
1084
+ /**
1085
+ * Disallows values.
1086
+ */
1087
+ not(...values: any[]): this;
1088
+ /**
1089
+ * Annotates the key
1090
+ */
1091
+ note(...notes: string[]): this;
1092
+ /**
1093
+ * Requires the validated value to match of the provided `any.allow()` values.
1094
+ * It has not effects when called together with `any.valid()` since it already sets the requirements.
1095
+ * When used with `any.allow()` it converts it to an `any.valid()`.
1096
+ */
1097
+ only(): this;
1098
+ /**
1099
+ * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default.
1100
+ */
1101
+ optional(): this;
1102
+ /**
1103
+ * Overrides the global validate() options for the current key and any sub-key.
1104
+ */
1105
+ options(options: ValidationOptions): this;
1106
+ /**
1107
+ * Overrides the global validate() options for the current key and any sub-key.
1108
+ */
1109
+ prefs(options: ValidationOptions): this;
1110
+ /**
1111
+ * Overrides the global validate() options for the current key and any sub-key.
1112
+ */
1113
+ preferences(options: ValidationOptions): this;
1114
+ /**
1115
+ * Sets the presence mode for the schema.
1116
+ */
1117
+ presence(mode: PresenceMode): this;
1118
+ /**
1119
+ * Outputs the original untouched value instead of the cast value.
1120
+ */
1121
+ raw(enabled?: boolean): this;
1122
+ /**
1123
+ * Marks a key as required which will not allow undefined as value. All keys are optional by default.
1124
+ */
1125
+ required(): this;
1126
+ /**
1127
+ * Applies a set of rule options to the current ruleset or last rule added.
1128
+ *
1129
+ * When applying rule options, the last rule (e.g. `min()`) is used unless there is an active ruleset defined (e.g. `$.min().max()`)
1130
+ * in which case the options are applied to all the provided rules.
1131
+ * Once `rule()` is called, the previous rules can no longer be modified and any active ruleset is terminated.
1132
+ *
1133
+ * Rule modifications can only be applied to supported rules.
1134
+ * Most of the `any` methods do not support rule modifications because they are implemented using schema flags (e.g. `required()`) or special
1135
+ * internal implementation (e.g. `valid()`).
1136
+ * In those cases, use the `any.messages()` method to override the error codes for the errors you want to customize.
1137
+ */
1138
+ rule(options: RuleOptions): this;
1139
+ /**
1140
+ * Registers a schema to be used by descendants of the current schema in named link references.
1141
+ */
1142
+ shared(ref: Schema): this;
1143
+ /**
1144
+ * Sets the options.convert() options to false which prevent type casting for the current key and any child keys.
1145
+ */
1146
+ strict(isStrict?: boolean): this;
1147
+ /**
1148
+ * Marks a key to be removed from a resulting object or array after validation. Used to sanitize output.
1149
+ * @param [enabled=true] - if true, the value is stripped, otherwise the validated value is retained. Defaults to true.
1150
+ */
1151
+ strip(enabled?: boolean): this;
1152
+ /**
1153
+ * Annotates the key
1154
+ */
1155
+ tag(...tags: string[]): this;
1156
+ /**
1157
+ * Applies any assigned target alterations to a copy of the schema that were applied via `any.alter()`.
1158
+ */
1159
+ tailor(targets: string | string[]): Schema;
1160
+ /**
1161
+ * Annotates the key with a unit name.
1162
+ */
1163
+ unit(name: string): this;
1164
+ /**
1165
+ * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed.
1166
+ */
1167
+ valid(...values: any[]): this;
1168
+ /**
1169
+ * Validates a value using the schema and options.
1170
+ */
1171
+ validate(value: any, options?: ValidationOptions): ValidationResult<TSchema>;
1172
+ /**
1173
+ * Validates a value using the schema and options.
1174
+ */
1175
+ validateAsync<TOpts extends AsyncValidationOptions>(value: any, options?: TOpts): Promise<TOpts extends {
1176
+ artifacts: true;
1177
+ } | {
1178
+ warnings: true;
1179
+ } ? {
1180
+ value: TSchema;
1181
+ } & (TOpts extends {
1182
+ artifacts: true;
1183
+ } ? {
1184
+ artifacts: Map<any, string[][]>;
1185
+ } : {}) & (TOpts extends {
1186
+ warnings: true;
1187
+ } ? {
1188
+ warning: ValidationWarning;
1189
+ } : {}) : TSchema>;
1190
+ /**
1191
+ * Same as `rule({ warn: true })`.
1192
+ * Note that `warn()` will terminate the current ruleset and cannot be followed by another rule option.
1193
+ * Use `rule()` to apply multiple rule options.
1194
+ */
1195
+ warn(): this;
1196
+ /**
1197
+ * Generates a warning.
1198
+ * When calling `any.validateAsync()`, set the `warning` option to true to enable warnings.
1199
+ * Warnings are reported separately from errors alongside the result value via the warning key (i.e. `{ value, warning }`).
1200
+ * Warning are always included when calling `any.validate()`.
1201
+ */
1202
+ warning(code: string, context: Context): this;
1203
+ /**
1204
+ * Converts the type into an alternatives type where the conditions are merged into the type definition where:
1205
+ */
1206
+ when(ref: string | Reference, options: WhenOptions | WhenOptions[]): this;
1207
+ /**
1208
+ * Converts the type into an alternatives type where the conditions are merged into the type definition where:
1209
+ */
1210
+ when(ref: Schema, options: WhenSchemaOptions): this;
1211
+ }
1212
+ interface Description {
1213
+ type?: Types | string;
1214
+ label?: string;
1215
+ description?: string;
1216
+ flags?: object;
1217
+ notes?: string[];
1218
+ tags?: string[];
1219
+ meta?: any[];
1220
+ example?: any[];
1221
+ valids?: any[];
1222
+ invalids?: any[];
1223
+ unit?: string;
1224
+ options?: ValidationOptions;
1225
+ [key: string]: any;
1226
+ }
1227
+ interface Context {
1228
+ [key: string]: any;
1229
+ key?: string;
1230
+ label?: string;
1231
+ value?: any;
1232
+ }
1233
+ interface State {
1234
+ key?: string;
1235
+ path?: string;
1236
+ parent?: any;
1237
+ reference?: any;
1238
+ ancestors?: any;
1239
+ localize?(...args: any[]): State;
1240
+ }
1241
+ interface BooleanSchema<TSchema = boolean> extends AnySchema<TSchema> {
1242
+ /**
1243
+ * Allows for additional values to be considered valid booleans by converting them to false during validation.
1244
+ * String comparisons are by default case-insensitive,
1245
+ * see `boolean.sensitive()` to change this behavior.
1246
+ * @param values - strings, numbers or arrays of them
1247
+ */
1248
+ falsy(...values: Array<string | number | null>): this;
1249
+ /**
1250
+ * Allows the values provided to truthy and falsy as well as the "true" and "false" default conversion
1251
+ * (when not in `strict()` mode) to be matched in a case-insensitive manner.
1252
+ */
1253
+ sensitive(enabled?: boolean): this;
1254
+ /**
1255
+ * Allows for additional values to be considered valid booleans by converting them to true during validation.
1256
+ * String comparisons are by default case-insensitive, see `boolean.sensitive()` to change this behavior.
1257
+ * @param values - strings, numbers or arrays of them
1258
+ */
1259
+ truthy(...values: Array<string | number | null>): this;
1260
+ }
1261
+ interface NumberSchema<TSchema = number> extends AnySchema<TSchema> {
1262
+ /**
1263
+ * Specifies that the value must be greater than limit.
1264
+ * It can also be a reference to another field.
1265
+ */
1266
+ greater(limit: number | Reference): this;
1267
+ /**
1268
+ * Requires the number to be an integer (no floating point).
1269
+ */
1270
+ integer(): this;
1271
+ /**
1272
+ * Specifies that the value must be less than limit.
1273
+ * It can also be a reference to another field.
1274
+ */
1275
+ less(limit: number | Reference): this;
1276
+ /**
1277
+ * Specifies the maximum value.
1278
+ * It can also be a reference to another field.
1279
+ */
1280
+ max(limit: number | Reference): this;
1281
+ /**
1282
+ * Specifies the minimum value.
1283
+ * It can also be a reference to another field.
1284
+ */
1285
+ min(limit: number | Reference): this;
1286
+ /**
1287
+ * Specifies that the value must be a multiple of base.
1288
+ */
1289
+ multiple(base: number | Reference): this;
1290
+ /**
1291
+ * Requires the number to be negative.
1292
+ */
1293
+ negative(): this;
1294
+ /**
1295
+ * Requires the number to be a TCP port, so between 0 and 65535.
1296
+ */
1297
+ port(): this;
1298
+ /**
1299
+ * Requires the number to be positive.
1300
+ */
1301
+ positive(): this;
1302
+ /**
1303
+ * Specifies the maximum number of decimal places where:
1304
+ * @param limit - the maximum number of decimal places allowed.
1305
+ */
1306
+ precision(limit: number): this;
1307
+ /**
1308
+ * Requires the number to be negative or positive.
1309
+ */
1310
+ sign(sign: 'positive' | 'negative'): this;
1311
+ /**
1312
+ * Allows the number to be outside of JavaScript's safety range (Number.MIN_SAFE_INTEGER & Number.MAX_SAFE_INTEGER).
1313
+ */
1314
+ unsafe(enabled?: any): this;
1315
+ }
1316
+ interface StringSchema<TSchema = string> extends AnySchema<TSchema> {
1317
+ /**
1318
+ * Requires the string value to only contain a-z, A-Z, and 0-9.
1319
+ */
1320
+ alphanum(): this;
1321
+ /**
1322
+ * Requires the string value to be a valid base64 string; does not check the decoded value.
1323
+ */
1324
+ base64(options?: Base64Options): this;
1325
+ /**
1326
+ * Sets the required string case.
1327
+ */
1328
+ case(direction: 'upper' | 'lower'): this;
1329
+ /**
1330
+ * Requires the number to be a credit card number (Using Luhn Algorithm).
1331
+ */
1332
+ creditCard(): this;
1333
+ /**
1334
+ * Requires the string value to be a valid data URI string.
1335
+ */
1336
+ dataUri(options?: DataUriOptions): this;
1337
+ /**
1338
+ * Requires the string value to be a valid domain.
1339
+ */
1340
+ domain(options?: DomainOptions): this;
1341
+ /**
1342
+ * Requires the string value to be a valid email address.
1343
+ */
1344
+ email(options?: EmailOptions): this;
1345
+ /**
1346
+ * Requires the string value to be a valid GUID.
1347
+ */
1348
+ guid(options?: GuidOptions): this;
1349
+ /**
1350
+ * Requires the string value to be a valid hexadecimal string.
1351
+ */
1352
+ hex(options?: HexOptions): this;
1353
+ /**
1354
+ * Requires the string value to be a valid hostname as per RFC1123.
1355
+ */
1356
+ hostname(): this;
1357
+ /**
1358
+ * Allows the value to match any whitelist of blacklist item in a case-insensitive comparison.
1359
+ */
1360
+ insensitive(): this;
1361
+ /**
1362
+ * Requires the string value to be a valid ip address.
1363
+ */
1364
+ ip(options?: IpOptions): this;
1365
+ /**
1366
+ * Requires the string value to be in valid ISO 8601 date format.
1367
+ */
1368
+ isoDate(): this;
1369
+ /**
1370
+ * Requires the string value to be in valid ISO 8601 duration format.
1371
+ */
1372
+ isoDuration(): this;
1373
+ /**
1374
+ * Specifies the exact string length required
1375
+ * @param limit - the required string length. It can also be a reference to another field.
1376
+ * @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
1377
+ */
1378
+ length(limit: number | Reference, encoding?: string): this;
1379
+ /**
1380
+ * Requires the string value to be all lowercase. If the validation convert option is on (enabled by default), the string will be forced to lowercase.
1381
+ */
1382
+ lowercase(): this;
1383
+ /**
1384
+ * Specifies the maximum number of string characters.
1385
+ * @param limit - the maximum number of string characters allowed. It can also be a reference to another field.
1386
+ * @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
1387
+ */
1388
+ max(limit: number | Reference, encoding?: string): this;
1389
+ /**
1390
+ * Specifies the minimum number string characters.
1391
+ * @param limit - the minimum number of string characters required. It can also be a reference to another field.
1392
+ * @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
1393
+ */
1394
+ min(limit: number | Reference, encoding?: string): this;
1395
+ /**
1396
+ * Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized.
1397
+ * @param [form='NFC'] - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD
1398
+ */
1399
+ normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this;
1400
+ /**
1401
+ * Defines a regular expression rule.
1402
+ * @param pattern - a regular expression object the string value must match against.
1403
+ * @param options - optional, can be:
1404
+ * Name for patterns (useful with multiple patterns). Defaults to 'required'.
1405
+ * An optional configuration object with the following supported properties:
1406
+ * name - optional pattern name.
1407
+ * invert - optional boolean flag. Defaults to false behavior. If specified as true, the provided pattern will be disallowed instead of required.
1408
+ */
1409
+ pattern(pattern: RegExp, options?: string | StringRegexOptions): this;
1410
+ /**
1411
+ * Defines a regular expression rule.
1412
+ * @param pattern - a regular expression object the string value must match against.
1413
+ * @param options - optional, can be:
1414
+ * Name for patterns (useful with multiple patterns). Defaults to 'required'.
1415
+ * An optional configuration object with the following supported properties:
1416
+ * name - optional pattern name.
1417
+ * invert - optional boolean flag. Defaults to false behavior. If specified as true, the provided pattern will be disallowed instead of required.
1418
+ */
1419
+ regex(pattern: RegExp, options?: string | StringRegexOptions): this;
1420
+ /**
1421
+ * Replace characters matching the given pattern with the specified replacement string where:
1422
+ * @param pattern - a regular expression object to match against, or a string of which all occurrences will be replaced.
1423
+ * @param replacement - the string that will replace the pattern.
1424
+ */
1425
+ replace(pattern: RegExp | string, replacement: string): this;
1426
+ /**
1427
+ * Requires the string value to only contain a-z, A-Z, 0-9, and underscore _.
1428
+ */
1429
+ token(): this;
1430
+ /**
1431
+ * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed.
1432
+ * @param [enabled=true] - optional parameter defaulting to true which allows you to reset the behavior of trim by providing a falsy value.
1433
+ */
1434
+ trim(enabled?: any): this;
1435
+ /**
1436
+ * Specifies whether the string.max() limit should be used as a truncation.
1437
+ * @param [enabled=true] - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value.
1438
+ */
1439
+ truncate(enabled?: boolean): this;
1440
+ /**
1441
+ * Requires the string value to be all uppercase. If the validation convert option is on (enabled by default), the string will be forced to uppercase.
1442
+ */
1443
+ uppercase(): this;
1444
+ /**
1445
+ * Requires the string value to be a valid RFC 3986 URI.
1446
+ */
1447
+ uri(options?: UriOptions): this;
1448
+ /**
1449
+ * Requires the string value to be a valid GUID.
1450
+ */
1451
+ uuid(options?: GuidOptions): this;
1452
+ }
1453
+ interface SymbolSchema<TSchema = Symbol> extends AnySchema<TSchema> {
1454
+ map(iterable: Iterable<[string | number | boolean | symbol, symbol]> | {
1455
+ [key: string]: symbol;
1456
+ }): this;
1457
+ }
1458
+ interface ArraySortOptions {
1459
+ /**
1460
+ * @default 'ascending'
1461
+ */
1462
+ order?: 'ascending' | 'descending';
1463
+ by?: string | Reference;
1464
+ }
1465
+ interface ArrayUniqueOptions extends HierarchySeparatorOptions {
1466
+ /**
1467
+ * if true, undefined values for the dot notation string comparator will not cause the array to fail on uniqueness.
1468
+ *
1469
+ * @default false
1470
+ */
1471
+ ignoreUndefined?: boolean;
1472
+ }
1473
+ type ComparatorFunction = (a: any, b: any) => boolean;
1474
+ interface ArraySchema<TSchema = any[]> extends AnySchema<TSchema> {
1475
+ /**
1476
+ * Verifies that an assertion passes for at least one item in the array, where:
1477
+ * `schema` - the validation rules required to satisfy the assertion. If the `schema` includes references, they are resolved against
1478
+ * the array item being tested, not the value of the `ref` target.
1479
+ */
1480
+ has(schema: SchemaLike): this;
1481
+ /**
1482
+ * List the types allowed for the array values.
1483
+ * If a given type is .required() then there must be a matching item in the array.
1484
+ * If a type is .forbidden() then it cannot appear in the array.
1485
+ * Required items can be added multiple times to signify that multiple items must be found.
1486
+ * Errors will contain the number of items that didn't match.
1487
+ * Any unmatched item having a label will be mentioned explicitly.
1488
+ *
1489
+ * @param types
1490
+ */
1491
+ items(...types: SchemaLikeWithoutArray[]): this;
1492
+ /**
1493
+ * Specifies the exact number of items in the array.
1494
+ */
1495
+ length(limit: number | Reference): this;
1496
+ /**
1497
+ * Specifies the maximum number of items in the array.
1498
+ */
1499
+ max(limit: number | Reference): this;
1500
+ /**
1501
+ * Specifies the minimum number of items in the array.
1502
+ */
1503
+ min(limit: number | Reference): this;
1504
+ /**
1505
+ * Lists the types in sequence order for the array values where:
1506
+ * If a given type is .required() then there must be a matching item with the same index position in the array.
1507
+ * Errors will contain the number of items that didn't match.
1508
+ * Any unmatched item having a label will be mentioned explicitly.
1509
+ * @param types
1510
+ */
1511
+ ordered(...types: SchemaLikeWithoutArray[]): this;
1512
+ /**
1513
+ * Allow single values to be checked against rules as if it were provided as an array.
1514
+ * enabled can be used with a falsy value to go back to the default behavior.
1515
+ */
1516
+ single(enabled?: any): this;
1517
+ /**
1518
+ * Sorts the array by given order.
1519
+ */
1520
+ sort(options?: ArraySortOptions): this;
1521
+ /**
1522
+ * Allow this array to be sparse.
1523
+ * enabled can be used with a falsy value to go back to the default behavior.
1524
+ */
1525
+ sparse(enabled?: any): this;
1526
+ /**
1527
+ * Requires the array values to be unique.
1528
+ * Remember that if you provide a custom comparator function,
1529
+ * different types can be passed as parameter depending on the rules you set on items.
1530
+ * Be aware that a deep equality is performed on elements of the array having a type of object,
1531
+ * a performance penalty is to be expected for this kind of operation.
1532
+ */
1533
+ unique(comparator?: string | ComparatorFunction, options?: ArrayUniqueOptions): this;
1534
+ }
1535
+ interface ObjectPatternOptions {
1536
+ fallthrough?: boolean;
1537
+ matches: SchemaLike | Reference;
1538
+ }
1539
+ interface ObjectSchema<TSchema = any> extends AnySchema<TSchema> {
1540
+ /**
1541
+ * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well.
1542
+ *
1543
+ * Optional settings must be the last argument.
1544
+ */
1545
+ and(...peers: Array<string | DependencyOptions>): this;
1546
+ /**
1547
+ * Appends the allowed object keys. If schema is null, undefined, or {}, no changes will be applied.
1548
+ */
1549
+ append(schema?: SchemaMap<TSchema>): this;
1550
+ append<TSchemaExtended = any, T = TSchemaExtended>(schema?: SchemaMap<T>): ObjectSchema<T>;
1551
+ /**
1552
+ * Verifies an assertion where.
1553
+ */
1554
+ assert(ref: string | Reference, schema: SchemaLike, message?: string): this;
1555
+ /**
1556
+ * Requires the object to be an instance of a given constructor.
1557
+ *
1558
+ * @param constructor - the constructor function that the object must be an instance of.
1559
+ * @param name - an alternate name to use in validation errors. This is useful when the constructor function does not have a name.
1560
+ */
1561
+ instance(constructor: Function, name?: string): this;
1562
+ /**
1563
+ * Sets or extends the allowed object keys.
1564
+ */
1565
+ keys(schema?: SchemaMap<TSchema>): this;
1566
+ /**
1567
+ * Specifies the exact number of keys in the object.
1568
+ */
1569
+ length(limit: number): this;
1570
+ /**
1571
+ * Specifies the maximum number of keys in the object.
1572
+ */
1573
+ max(limit: number | Reference): this;
1574
+ /**
1575
+ * Specifies the minimum number of keys in the object.
1576
+ */
1577
+ min(limit: number | Reference): this;
1578
+ /**
1579
+ * Defines a relationship between keys where not all peers can be present at the same time.
1580
+ *
1581
+ * Optional settings must be the last argument.
1582
+ */
1583
+ nand(...peers: Array<string | DependencyOptions>): this;
1584
+ /**
1585
+ * Defines a relationship between keys where one of the peers is required (and more than one is allowed).
1586
+ *
1587
+ * Optional settings must be the last argument.
1588
+ */
1589
+ or(...peers: Array<string | DependencyOptions>): this;
1590
+ /**
1591
+ * Defines an exclusive relationship between a set of keys where only one is allowed but none are required.
1592
+ *
1593
+ * Optional settings must be the last argument.
1594
+ */
1595
+ oxor(...peers: Array<string | DependencyOptions>): this;
1596
+ /**
1597
+ * Specify validation rules for unknown keys matching a pattern.
1598
+ *
1599
+ * @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names
1600
+ * @param schema - the schema object matching keys must validate against
1601
+ * @param options
1602
+ */
1603
+ pattern(pattern: RegExp | SchemaLike, schema: SchemaLike, options?: ObjectPatternOptions): this;
1604
+ /**
1605
+ * Requires the object to be a Joi reference.
1606
+ */
1607
+ ref(): this;
1608
+ /**
1609
+ * Requires the object to be a `RegExp` object.
1610
+ */
1611
+ regex(): this;
1612
+ /**
1613
+ * Renames a key to another name (deletes the renamed key).
1614
+ */
1615
+ rename(from: string | RegExp, to: string, options?: RenameOptions): this;
1616
+ /**
1617
+ * Requires the object to be a Joi schema instance.
1618
+ */
1619
+ schema(type?: SchemaLike): this;
1620
+ /**
1621
+ * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children).
1622
+ */
1623
+ unknown(allow?: boolean): this;
1624
+ /**
1625
+ * Requires the presence of other keys whenever the specified key is present.
1626
+ */
1627
+ with(key: string, peers: string | string[], options?: DependencyOptions): this;
1628
+ /**
1629
+ * Forbids the presence of other keys whenever the specified is present.
1630
+ */
1631
+ without(key: string, peers: string | string[], options?: DependencyOptions): this;
1632
+ /**
1633
+ * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time.
1634
+ *
1635
+ * Optional settings must be the last argument.
1636
+ */
1637
+ xor(...peers: Array<string | DependencyOptions>): this;
1638
+ }
1639
+ interface BinarySchema<TSchema = Buffer> extends AnySchema<TSchema> {
1640
+ /**
1641
+ * Sets the string encoding format if a string input is converted to a buffer.
1642
+ */
1643
+ encoding(encoding: string): this;
1644
+ /**
1645
+ * Specifies the minimum length of the buffer.
1646
+ */
1647
+ min(limit: number | Reference): this;
1648
+ /**
1649
+ * Specifies the maximum length of the buffer.
1650
+ */
1651
+ max(limit: number | Reference): this;
1652
+ /**
1653
+ * Specifies the exact length of the buffer:
1654
+ */
1655
+ length(limit: number | Reference): this;
1656
+ }
1657
+ interface DateSchema<TSchema = Date> extends AnySchema<TSchema> {
1658
+ /**
1659
+ * Specifies that the value must be greater than date.
1660
+ * Notes: 'now' can be passed in lieu of date to always compare relatively to the current date,
1661
+ * allowing to explicitly ensure a date is either in the past or in the future.
1662
+ * It can also be a reference to another field.
1663
+ */
1664
+ greater(date: 'now' | Date | number | string | Reference): this;
1665
+ /**
1666
+ * Requires the string value to be in valid ISO 8601 date format.
1667
+ */
1668
+ iso(): this;
1669
+ /**
1670
+ * Specifies that the value must be less than date.
1671
+ * Notes: 'now' can be passed in lieu of date to always compare relatively to the current date,
1672
+ * allowing to explicitly ensure a date is either in the past or in the future.
1673
+ * It can also be a reference to another field.
1674
+ */
1675
+ less(date: 'now' | Date | number | string | Reference): this;
1676
+ /**
1677
+ * Specifies the oldest date allowed.
1678
+ * Notes: 'now' can be passed in lieu of date to always compare relatively to the current date,
1679
+ * allowing to explicitly ensure a date is either in the past or in the future.
1680
+ * It can also be a reference to another field.
1681
+ */
1682
+ min(date: 'now' | Date | number | string | Reference): this;
1683
+ /**
1684
+ * Specifies the latest date allowed.
1685
+ * Notes: 'now' can be passed in lieu of date to always compare relatively to the current date,
1686
+ * allowing to explicitly ensure a date is either in the past or in the future.
1687
+ * It can also be a reference to another field.
1688
+ */
1689
+ max(date: 'now' | Date | number | string | Reference): this;
1690
+ /**
1691
+ * Requires the value to be a timestamp interval from Unix Time.
1692
+ * @param type - the type of timestamp (allowed values are unix or javascript [default])
1693
+ */
1694
+ timestamp(type?: 'javascript' | 'unix'): this;
1695
+ }
1696
+ interface FunctionSchema<TSchema = Function> extends ObjectSchema<TSchema> {
1697
+ /**
1698
+ * Specifies the arity of the function where:
1699
+ * @param n - the arity expected.
1700
+ */
1701
+ arity(n: number): this;
1702
+ /**
1703
+ * Requires the function to be a class.
1704
+ */
1705
+ class(): this;
1706
+ /**
1707
+ * Specifies the minimal arity of the function where:
1708
+ * @param n - the minimal arity expected.
1709
+ */
1710
+ minArity(n: number): this;
1711
+ /**
1712
+ * Specifies the minimal arity of the function where:
1713
+ * @param n - the minimal arity expected.
1714
+ */
1715
+ maxArity(n: number): this;
1716
+ }
1717
+ interface AlternativesSchema<TSchema = any> extends AnySchema<TSchema> {
1718
+ /**
1719
+ * Adds a conditional alternative schema type, either based on another key value, or a schema peeking into the current value.
1720
+ */
1721
+ conditional(ref: string | Reference, options: WhenOptions | WhenOptions[]): this;
1722
+ conditional(ref: Schema, options: WhenSchemaOptions): this;
1723
+ /**
1724
+ * Requires the validated value to match a specific set of the provided alternative.try() schemas.
1725
+ * Cannot be combined with `alternatives.conditional()`.
1726
+ */
1727
+ match(mode: 'any' | 'all' | 'one'): this;
1728
+ /**
1729
+ * Adds an alternative schema type for attempting to match against the validated value.
1730
+ */
1731
+ try(...types: SchemaLikeWithoutArray[]): this;
1732
+ }
1733
+ interface LinkSchema<TSchema = any> extends AnySchema<TSchema> {
1734
+ /**
1735
+ * Same as `any.concat()` but the schema is merged after the link is resolved which allows merging with schemas of the same type as the resolved link.
1736
+ * Will throw an exception during validation if the merged types are not compatible.
1737
+ */
1738
+ concat(schema: Schema): this;
1739
+ /**
1740
+ * Initializes the schema after constructions for cases where the schema has to be constructed first and then initialized.
1741
+ * If `ref` was not passed to the constructor, `link.ref()` must be called prior to usage.
1742
+ */
1743
+ ref(ref: string): this;
1744
+ }
1745
+ interface Reference extends Exclude<ReferenceOptions, 'prefix'> {
1746
+ depth: number;
1747
+ type: string;
1748
+ key: string;
1749
+ root: string;
1750
+ path: string[];
1751
+ display: string;
1752
+ toString(): string;
1753
+ }
1754
+ type ExtensionBoundSchema = Schema & SchemaInternals;
1755
+ interface RuleArgs {
1756
+ name: string;
1757
+ ref?: boolean;
1758
+ assert?: ((value: any) => boolean) | AnySchema;
1759
+ message?: string;
1760
+ /**
1761
+ * Undocumented properties
1762
+ */
1763
+ normalize?(value: any): any;
1764
+ }
1765
+ type RuleMethod = (...args: any[]) => any;
1766
+ interface ExtensionRule {
1767
+ /**
1768
+ * alternative name for this rule.
1769
+ */
1770
+ alias?: string;
1771
+ /**
1772
+ * whether rule supports multiple invocations.
1773
+ */
1774
+ multi?: boolean;
1775
+ /**
1776
+ * Dual rule: converts or validates.
1777
+ */
1778
+ convert?: boolean;
1779
+ /**
1780
+ * list of arguments accepted by `method`.
1781
+ */
1782
+ args?: Array<RuleArgs | string>;
1783
+ /**
1784
+ * rule body.
1785
+ */
1786
+ method?: RuleMethod | false;
1787
+ /**
1788
+ * validation function.
1789
+ */
1790
+ validate?(value: any, helpers: any, args: Record<string, any>, options: any): any;
1791
+ /**
1792
+ * undocumented flags.
1793
+ */
1794
+ priority?: boolean;
1795
+ manifest?: boolean;
1796
+ }
1797
+ interface CoerceResult {
1798
+ errors?: ErrorReport[];
1799
+ value?: any;
1800
+ }
1801
+ type CoerceFunction = (value: any, helpers: CustomHelpers) => CoerceResult;
1802
+ interface CoerceObject {
1803
+ method: CoerceFunction;
1804
+ from?: string | string[];
1805
+ }
1806
+ interface ExtensionFlag {
1807
+ setter?: string;
1808
+ default?: any;
1809
+ }
1810
+ interface ExtensionTermManifest {
1811
+ mapped: {
1812
+ from: string;
1813
+ to: string;
1814
+ };
1815
+ }
1816
+ interface ExtensionTerm {
1817
+ init: any[] | null;
1818
+ register?: any;
1819
+ manifest?: Record<string, 'schema' | 'single' | ExtensionTermManifest>;
1820
+ }
1821
+ interface Extension {
1822
+ type: string | RegExp;
1823
+ args?(...args: SchemaLike[]): Schema;
1824
+ base?: Schema;
1825
+ coerce?: CoerceFunction | CoerceObject;
1826
+ flags?: Record<string, ExtensionFlag>;
1827
+ manifest?: {
1828
+ build?(obj: ExtensionBoundSchema, desc: Record<string, any>): any;
1829
+ };
1830
+ messages?: LanguageMessages | string;
1831
+ modifiers?: Record<string, (rule: any, enabled?: boolean) => any>;
1832
+ overrides?: Record<string, (value: any) => Schema>;
1833
+ prepare?(value: any, helpers: CustomHelpers): any;
1834
+ rebuild?(schema: ExtensionBoundSchema): void;
1835
+ rules?: Record<string, ExtensionRule & ThisType<SchemaInternals>>;
1836
+ terms?: Record<string, ExtensionTerm>;
1837
+ validate?(value: any, helpers: CustomHelpers): any;
1838
+ /**
1839
+ * undocumented options
1840
+ */
1841
+ cast?: Record<string, {
1842
+ from(value: any): any;
1843
+ to(value: any, helpers: CustomHelpers): any;
1844
+ }>;
1845
+ properties?: Record<string, any>;
1846
+ }
1847
+ interface Err {
1848
+ toString(): string;
1849
+ }
1850
+
1851
+ export { AddRuleOptions, AlternativesSchema, AnySchema, ArraySchema, ArraySortOptions, ArrayUniqueOptions, AsyncValidationOptions, Base64Options, BaseValidationOptions, BaseValidator, BasicType, BinarySchema, BooleanSchema, Cache, CacheConfiguration, CacheProvisionOptions, CoerceFunction, CoerceObject, CoerceResult, ComparatorFunction, CompileOptions, Context, CreateErrorOptions, CustomHelpers, CustomValidator, DataUriOptions, DateSchema, DependencyOptions, Description, DomainOptions, EmailOptions, ErrorFormattingOptions, ErrorReport, ErrorValidationOptions, Extension, ExtensionBoundSchema, ExtensionFlag, ExtensionRule, ExtensionTerm, ExtensionTermManifest, ExternalHelpers, ExternalValidationFunction, FunctionSchema, GetRuleOptions, GuidOptions, GuidVersions, HexOptions, HierarchySeparatorOptions, IpOptions, IsNonPrimitiveSubsetUnion, IsPrimitiveSubset, IsSchemaOptions, IsUnion, LanguageMessageTemplate, LanguageMessages, LinkSchema, ModifyOptions, MutateRegisterOptions, NullableType, NumberSchema, ObjectPatternOptions, ObjectPropertiesSchema, ObjectSchema, PartialSchemaMap, PresenceMode, Reference, ReferenceOptions, RenameOptions, RuleArgs, RuleMethod, RuleOptions, Schema, SchemaFunction, SchemaInternals, SchemaLike, SchemaLikeWithoutArray, SchemaMap, SetFlagOptions, State, StrictSchemaMap, StringRegexOptions, StringSchema, SwitchCases, SwitchDefault, SymbolSchema, TopLevelDomainOptions, Types, UriOptions, ValidationError, ValidationErrorFunction, ValidationErrorItem, ValidationOptions, ValidationResult, ValidationWarning, Validator, WhenOptions, WhenSchemaOptions };