@cabloy/zod 4.3.6

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 (701) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/index.cjs +33 -0
  4. package/index.d.cts +4 -0
  5. package/index.d.ts +4 -0
  6. package/index.js +4 -0
  7. package/locales/index.cjs +17 -0
  8. package/locales/index.d.cts +1 -0
  9. package/locales/index.d.ts +1 -0
  10. package/locales/index.js +1 -0
  11. package/locales/package.json +7 -0
  12. package/mini/index.cjs +32 -0
  13. package/mini/index.d.cts +3 -0
  14. package/mini/index.d.ts +3 -0
  15. package/mini/index.js +3 -0
  16. package/mini/package.json +7 -0
  17. package/package.json +135 -0
  18. package/src/index.ts +4 -0
  19. package/src/locales/index.ts +1 -0
  20. package/src/mini/index.ts +3 -0
  21. package/src/v3/ZodError.ts +330 -0
  22. package/src/v3/benchmarks/datetime.ts +58 -0
  23. package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  24. package/src/v3/benchmarks/index.ts +59 -0
  25. package/src/v3/benchmarks/ipv4.ts +57 -0
  26. package/src/v3/benchmarks/object.ts +69 -0
  27. package/src/v3/benchmarks/primitives.ts +162 -0
  28. package/src/v3/benchmarks/realworld.ts +63 -0
  29. package/src/v3/benchmarks/string.ts +55 -0
  30. package/src/v3/benchmarks/union.ts +80 -0
  31. package/src/v3/errors.ts +13 -0
  32. package/src/v3/external.ts +6 -0
  33. package/src/v3/helpers/enumUtil.ts +17 -0
  34. package/src/v3/helpers/errorUtil.ts +8 -0
  35. package/src/v3/helpers/parseUtil.ts +176 -0
  36. package/src/v3/helpers/partialUtil.ts +34 -0
  37. package/src/v3/helpers/typeAliases.ts +2 -0
  38. package/src/v3/helpers/util.ts +224 -0
  39. package/src/v3/index.ts +4 -0
  40. package/src/v3/locales/en.ts +124 -0
  41. package/src/v3/standard-schema.ts +113 -0
  42. package/src/v3/tests/Mocker.ts +54 -0
  43. package/src/v3/tests/all-errors.test.ts +157 -0
  44. package/src/v3/tests/anyunknown.test.ts +28 -0
  45. package/src/v3/tests/array.test.ts +71 -0
  46. package/src/v3/tests/async-parsing.test.ts +388 -0
  47. package/src/v3/tests/async-refinements.test.ts +46 -0
  48. package/src/v3/tests/base.test.ts +29 -0
  49. package/src/v3/tests/bigint.test.ts +55 -0
  50. package/src/v3/tests/branded.test.ts +53 -0
  51. package/src/v3/tests/catch.test.ts +220 -0
  52. package/src/v3/tests/coerce.test.ts +133 -0
  53. package/src/v3/tests/complex.test.ts +70 -0
  54. package/src/v3/tests/custom.test.ts +31 -0
  55. package/src/v3/tests/date.test.ts +32 -0
  56. package/src/v3/tests/deepmasking.test.ts +186 -0
  57. package/src/v3/tests/default.test.ts +112 -0
  58. package/src/v3/tests/description.test.ts +33 -0
  59. package/src/v3/tests/discriminated-unions.test.ts +315 -0
  60. package/src/v3/tests/enum.test.ts +80 -0
  61. package/src/v3/tests/error.test.ts +551 -0
  62. package/src/v3/tests/firstparty.test.ts +87 -0
  63. package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  64. package/src/v3/tests/function.test.ts +261 -0
  65. package/src/v3/tests/generics.test.ts +48 -0
  66. package/src/v3/tests/instanceof.test.ts +37 -0
  67. package/src/v3/tests/intersection.test.ts +110 -0
  68. package/src/v3/tests/language-server.source.ts +76 -0
  69. package/src/v3/tests/language-server.test.ts +207 -0
  70. package/src/v3/tests/literal.test.ts +36 -0
  71. package/src/v3/tests/map.test.ts +110 -0
  72. package/src/v3/tests/masking.test.ts +4 -0
  73. package/src/v3/tests/mocker.test.ts +19 -0
  74. package/src/v3/tests/nan.test.ts +24 -0
  75. package/src/v3/tests/nativeEnum.test.ts +87 -0
  76. package/src/v3/tests/nullable.test.ts +42 -0
  77. package/src/v3/tests/number.test.ts +176 -0
  78. package/src/v3/tests/object-augmentation.test.ts +29 -0
  79. package/src/v3/tests/object-in-es5-env.test.ts +29 -0
  80. package/src/v3/tests/object.test.ts +434 -0
  81. package/src/v3/tests/optional.test.ts +42 -0
  82. package/src/v3/tests/parseUtil.test.ts +23 -0
  83. package/src/v3/tests/parser.test.ts +41 -0
  84. package/src/v3/tests/partials.test.ts +243 -0
  85. package/src/v3/tests/pickomit.test.ts +111 -0
  86. package/src/v3/tests/pipeline.test.ts +29 -0
  87. package/src/v3/tests/preprocess.test.ts +186 -0
  88. package/src/v3/tests/primitive.test.ts +440 -0
  89. package/src/v3/tests/promise.test.ts +90 -0
  90. package/src/v3/tests/readonly.test.ts +194 -0
  91. package/src/v3/tests/record.test.ts +171 -0
  92. package/src/v3/tests/recursive.test.ts +197 -0
  93. package/src/v3/tests/refine.test.ts +313 -0
  94. package/src/v3/tests/safeparse.test.ts +27 -0
  95. package/src/v3/tests/set.test.ts +142 -0
  96. package/src/v3/tests/standard-schema.test.ts +83 -0
  97. package/src/v3/tests/string.test.ts +916 -0
  98. package/src/v3/tests/transformer.test.ts +233 -0
  99. package/src/v3/tests/tuple.test.ts +90 -0
  100. package/src/v3/tests/unions.test.ts +57 -0
  101. package/src/v3/tests/validations.test.ts +133 -0
  102. package/src/v3/tests/void.test.ts +15 -0
  103. package/src/v3/types.ts +5138 -0
  104. package/src/v4/classic/checks.ts +32 -0
  105. package/src/v4/classic/coerce.ts +27 -0
  106. package/src/v4/classic/compat.ts +70 -0
  107. package/src/v4/classic/errors.ts +82 -0
  108. package/src/v4/classic/external.ts +51 -0
  109. package/src/v4/classic/from-json-schema.ts +643 -0
  110. package/src/v4/classic/index.ts +5 -0
  111. package/src/v4/classic/iso.ts +90 -0
  112. package/src/v4/classic/parse.ts +82 -0
  113. package/src/v4/classic/schemas.ts +2409 -0
  114. package/src/v4/classic/tests/anyunknown.test.ts +26 -0
  115. package/src/v4/classic/tests/apply.test.ts +59 -0
  116. package/src/v4/classic/tests/array.test.ts +264 -0
  117. package/src/v4/classic/tests/assignability.test.ts +210 -0
  118. package/src/v4/classic/tests/async-parsing.test.ts +381 -0
  119. package/src/v4/classic/tests/async-refinements.test.ts +68 -0
  120. package/src/v4/classic/tests/base.test.ts +7 -0
  121. package/src/v4/classic/tests/bigint.test.ts +54 -0
  122. package/src/v4/classic/tests/brand.test.ts +106 -0
  123. package/src/v4/classic/tests/catch.test.ts +276 -0
  124. package/src/v4/classic/tests/coalesce.test.ts +20 -0
  125. package/src/v4/classic/tests/codec-examples.test.ts +573 -0
  126. package/src/v4/classic/tests/codec.test.ts +562 -0
  127. package/src/v4/classic/tests/coerce.test.ts +160 -0
  128. package/src/v4/classic/tests/continuability.test.ts +374 -0
  129. package/src/v4/classic/tests/custom.test.ts +40 -0
  130. package/src/v4/classic/tests/date.test.ts +62 -0
  131. package/src/v4/classic/tests/datetime.test.ts +302 -0
  132. package/src/v4/classic/tests/default.test.ts +365 -0
  133. package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  134. package/src/v4/classic/tests/description.test.ts +32 -0
  135. package/src/v4/classic/tests/discriminated-unions.test.ts +661 -0
  136. package/src/v4/classic/tests/enum.test.ts +285 -0
  137. package/src/v4/classic/tests/error-utils.test.ts +595 -0
  138. package/src/v4/classic/tests/error.test.ts +711 -0
  139. package/src/v4/classic/tests/file.test.ts +96 -0
  140. package/src/v4/classic/tests/firstparty.test.ts +179 -0
  141. package/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  142. package/src/v4/classic/tests/from-json-schema.test.ts +734 -0
  143. package/src/v4/classic/tests/function.test.ts +360 -0
  144. package/src/v4/classic/tests/generics.test.ts +72 -0
  145. package/src/v4/classic/tests/hash.test.ts +68 -0
  146. package/src/v4/classic/tests/index.test.ts +939 -0
  147. package/src/v4/classic/tests/instanceof.test.ts +60 -0
  148. package/src/v4/classic/tests/intersection.test.ts +198 -0
  149. package/src/v4/classic/tests/json.test.ts +109 -0
  150. package/src/v4/classic/tests/lazy.test.ts +227 -0
  151. package/src/v4/classic/tests/literal.test.ts +117 -0
  152. package/src/v4/classic/tests/locales_ka.test.ts +29 -0
  153. package/src/v4/classic/tests/map.test.ts +330 -0
  154. package/src/v4/classic/tests/nan.test.ts +21 -0
  155. package/src/v4/classic/tests/nested-refine.test.ts +168 -0
  156. package/src/v4/classic/tests/nonoptional.test.ts +101 -0
  157. package/src/v4/classic/tests/nullable.test.ts +22 -0
  158. package/src/v4/classic/tests/number.test.ts +311 -0
  159. package/src/v4/classic/tests/object.test.ts +640 -0
  160. package/src/v4/classic/tests/optional.test.ts +223 -0
  161. package/src/v4/classic/tests/partial.test.ts +427 -0
  162. package/src/v4/classic/tests/pickomit.test.ts +211 -0
  163. package/src/v4/classic/tests/pipe.test.ts +101 -0
  164. package/src/v4/classic/tests/prefault.test.ts +74 -0
  165. package/src/v4/classic/tests/preprocess.test.ts +282 -0
  166. package/src/v4/classic/tests/primitive.test.ts +175 -0
  167. package/src/v4/classic/tests/promise.test.ts +81 -0
  168. package/src/v4/classic/tests/prototypes.test.ts +23 -0
  169. package/src/v4/classic/tests/readonly.test.ts +252 -0
  170. package/src/v4/classic/tests/record.test.ts +632 -0
  171. package/src/v4/classic/tests/recursive-types.test.ts +582 -0
  172. package/src/v4/classic/tests/refine.test.ts +570 -0
  173. package/src/v4/classic/tests/registries.test.ts +243 -0
  174. package/src/v4/classic/tests/set.test.ts +181 -0
  175. package/src/v4/classic/tests/standard-schema.test.ts +134 -0
  176. package/src/v4/classic/tests/string-formats.test.ts +125 -0
  177. package/src/v4/classic/tests/string.test.ts +1200 -0
  178. package/src/v4/classic/tests/stringbool.test.ts +106 -0
  179. package/src/v4/classic/tests/template-literal.test.ts +771 -0
  180. package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  181. package/src/v4/classic/tests/to-json-schema.test.ts +2990 -0
  182. package/src/v4/classic/tests/transform.test.ts +361 -0
  183. package/src/v4/classic/tests/tuple.test.ts +183 -0
  184. package/src/v4/classic/tests/union.test.ts +219 -0
  185. package/src/v4/classic/tests/url.test.ts +13 -0
  186. package/src/v4/classic/tests/validations.test.ts +283 -0
  187. package/src/v4/classic/tests/void.test.ts +12 -0
  188. package/src/v4/core/api.ts +1798 -0
  189. package/src/v4/core/checks.ts +1293 -0
  190. package/src/v4/core/config.ts +15 -0
  191. package/src/v4/core/core.ts +138 -0
  192. package/src/v4/core/doc.ts +44 -0
  193. package/src/v4/core/errors.ts +448 -0
  194. package/src/v4/core/index.ts +16 -0
  195. package/src/v4/core/json-schema-generator.ts +126 -0
  196. package/src/v4/core/json-schema-processors.ts +667 -0
  197. package/src/v4/core/json-schema.ts +147 -0
  198. package/src/v4/core/parse.ts +195 -0
  199. package/src/v4/core/regexes.ts +185 -0
  200. package/src/v4/core/registries.ts +105 -0
  201. package/src/v4/core/schemas.ts +4562 -0
  202. package/src/v4/core/standard-schema.ts +159 -0
  203. package/src/v4/core/tests/extend.test.ts +59 -0
  204. package/src/v4/core/tests/index.test.ts +46 -0
  205. package/src/v4/core/tests/locales/be.test.ts +124 -0
  206. package/src/v4/core/tests/locales/en.test.ts +22 -0
  207. package/src/v4/core/tests/locales/es.test.ts +181 -0
  208. package/src/v4/core/tests/locales/he.test.ts +379 -0
  209. package/src/v4/core/tests/locales/hr.test.ts +163 -0
  210. package/src/v4/core/tests/locales/nl.test.ts +46 -0
  211. package/src/v4/core/tests/locales/ru.test.ts +128 -0
  212. package/src/v4/core/tests/locales/tr.test.ts +69 -0
  213. package/src/v4/core/tests/locales/uz.test.ts +105 -0
  214. package/src/v4/core/tests/record-constructor.test.ts +67 -0
  215. package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  216. package/src/v4/core/to-json-schema.ts +613 -0
  217. package/src/v4/core/util.ts +984 -0
  218. package/src/v4/core/versions.ts +5 -0
  219. package/src/v4/core/zsf.ts +323 -0
  220. package/src/v4/index.ts +4 -0
  221. package/src/v4/locales/ar.ts +115 -0
  222. package/src/v4/locales/az.ts +111 -0
  223. package/src/v4/locales/be.ts +176 -0
  224. package/src/v4/locales/bg.ts +128 -0
  225. package/src/v4/locales/ca.ts +116 -0
  226. package/src/v4/locales/cs.ts +118 -0
  227. package/src/v4/locales/da.ts +123 -0
  228. package/src/v4/locales/de.ts +116 -0
  229. package/src/v4/locales/en.ts +119 -0
  230. package/src/v4/locales/eo.ts +118 -0
  231. package/src/v4/locales/es.ts +141 -0
  232. package/src/v4/locales/fa.ts +126 -0
  233. package/src/v4/locales/fi.ts +121 -0
  234. package/src/v4/locales/fr-CA.ts +116 -0
  235. package/src/v4/locales/fr.ts +116 -0
  236. package/src/v4/locales/he.ts +246 -0
  237. package/src/v4/locales/hr.ts +131 -0
  238. package/src/v4/locales/hu.ts +117 -0
  239. package/src/v4/locales/hy.ts +164 -0
  240. package/src/v4/locales/id.ts +115 -0
  241. package/src/v4/locales/index.ts +50 -0
  242. package/src/v4/locales/is.ts +119 -0
  243. package/src/v4/locales/it.ts +116 -0
  244. package/src/v4/locales/ja.ts +114 -0
  245. package/src/v4/locales/ka.ts +123 -0
  246. package/src/v4/locales/kh.ts +7 -0
  247. package/src/v4/locales/km.ts +119 -0
  248. package/src/v4/locales/ko.ts +121 -0
  249. package/src/v4/locales/lt.ts +239 -0
  250. package/src/v4/locales/mk.ts +118 -0
  251. package/src/v4/locales/ms.ts +115 -0
  252. package/src/v4/locales/nl.ts +121 -0
  253. package/src/v4/locales/no.ts +116 -0
  254. package/src/v4/locales/ota.ts +117 -0
  255. package/src/v4/locales/pl.ts +118 -0
  256. package/src/v4/locales/ps.ts +126 -0
  257. package/src/v4/locales/pt.ts +116 -0
  258. package/src/v4/locales/ru.ts +176 -0
  259. package/src/v4/locales/sl.ts +118 -0
  260. package/src/v4/locales/sv.ts +119 -0
  261. package/src/v4/locales/ta.ts +118 -0
  262. package/src/v4/locales/th.ts +119 -0
  263. package/src/v4/locales/tr.ts +111 -0
  264. package/src/v4/locales/ua.ts +7 -0
  265. package/src/v4/locales/uk.ts +117 -0
  266. package/src/v4/locales/ur.ts +119 -0
  267. package/src/v4/locales/uz.ts +117 -0
  268. package/src/v4/locales/vi.ts +117 -0
  269. package/src/v4/locales/yo.ts +124 -0
  270. package/src/v4/locales/zh-CN.ts +116 -0
  271. package/src/v4/locales/zh-TW.ts +115 -0
  272. package/src/v4/mini/checks.ts +32 -0
  273. package/src/v4/mini/coerce.ts +27 -0
  274. package/src/v4/mini/external.ts +40 -0
  275. package/src/v4/mini/index.ts +3 -0
  276. package/src/v4/mini/iso.ts +66 -0
  277. package/src/v4/mini/parse.ts +14 -0
  278. package/src/v4/mini/schemas.ts +1916 -0
  279. package/src/v4/mini/tests/apply.test.ts +24 -0
  280. package/src/v4/mini/tests/assignability.test.ts +129 -0
  281. package/src/v4/mini/tests/brand.test.ts +94 -0
  282. package/src/v4/mini/tests/checks.test.ts +144 -0
  283. package/src/v4/mini/tests/codec.test.ts +529 -0
  284. package/src/v4/mini/tests/computed.test.ts +36 -0
  285. package/src/v4/mini/tests/error.test.ts +22 -0
  286. package/src/v4/mini/tests/functions.test.ts +5 -0
  287. package/src/v4/mini/tests/index.test.ts +963 -0
  288. package/src/v4/mini/tests/number.test.ts +95 -0
  289. package/src/v4/mini/tests/object.test.ts +227 -0
  290. package/src/v4/mini/tests/prototypes.test.ts +43 -0
  291. package/src/v4/mini/tests/recursive-types.test.ts +275 -0
  292. package/src/v4/mini/tests/standard-schema.test.ts +50 -0
  293. package/src/v4/mini/tests/string.test.ts +347 -0
  294. package/src/v4-mini/index.ts +3 -0
  295. package/v3/ZodError.cjs +138 -0
  296. package/v3/ZodError.d.cts +164 -0
  297. package/v3/ZodError.d.ts +164 -0
  298. package/v3/ZodError.js +133 -0
  299. package/v3/errors.cjs +17 -0
  300. package/v3/errors.d.cts +5 -0
  301. package/v3/errors.d.ts +5 -0
  302. package/v3/errors.js +9 -0
  303. package/v3/external.cjs +22 -0
  304. package/v3/external.d.cts +6 -0
  305. package/v3/external.d.ts +6 -0
  306. package/v3/external.js +6 -0
  307. package/v3/helpers/enumUtil.cjs +2 -0
  308. package/v3/helpers/enumUtil.d.cts +8 -0
  309. package/v3/helpers/enumUtil.d.ts +8 -0
  310. package/v3/helpers/enumUtil.js +1 -0
  311. package/v3/helpers/errorUtil.cjs +9 -0
  312. package/v3/helpers/errorUtil.d.cts +9 -0
  313. package/v3/helpers/errorUtil.d.ts +9 -0
  314. package/v3/helpers/errorUtil.js +6 -0
  315. package/v3/helpers/parseUtil.cjs +124 -0
  316. package/v3/helpers/parseUtil.d.cts +78 -0
  317. package/v3/helpers/parseUtil.d.ts +78 -0
  318. package/v3/helpers/parseUtil.js +109 -0
  319. package/v3/helpers/partialUtil.cjs +2 -0
  320. package/v3/helpers/partialUtil.d.cts +8 -0
  321. package/v3/helpers/partialUtil.d.ts +8 -0
  322. package/v3/helpers/partialUtil.js +1 -0
  323. package/v3/helpers/typeAliases.cjs +2 -0
  324. package/v3/helpers/typeAliases.d.cts +2 -0
  325. package/v3/helpers/typeAliases.d.ts +2 -0
  326. package/v3/helpers/typeAliases.js +1 -0
  327. package/v3/helpers/util.cjs +137 -0
  328. package/v3/helpers/util.d.cts +85 -0
  329. package/v3/helpers/util.d.ts +85 -0
  330. package/v3/helpers/util.js +133 -0
  331. package/v3/index.cjs +33 -0
  332. package/v3/index.d.cts +4 -0
  333. package/v3/index.d.ts +4 -0
  334. package/v3/index.js +4 -0
  335. package/v3/locales/en.cjs +112 -0
  336. package/v3/locales/en.d.cts +3 -0
  337. package/v3/locales/en.d.ts +3 -0
  338. package/v3/locales/en.js +109 -0
  339. package/v3/package.json +7 -0
  340. package/v3/standard-schema.cjs +2 -0
  341. package/v3/standard-schema.d.cts +102 -0
  342. package/v3/standard-schema.d.ts +102 -0
  343. package/v3/standard-schema.js +1 -0
  344. package/v3/types.cjs +3777 -0
  345. package/v3/types.d.cts +1034 -0
  346. package/v3/types.d.ts +1034 -0
  347. package/v3/types.js +3695 -0
  348. package/v4/classic/checks.cjs +33 -0
  349. package/v4/classic/checks.d.cts +1 -0
  350. package/v4/classic/checks.d.ts +1 -0
  351. package/v4/classic/checks.js +1 -0
  352. package/v4/classic/coerce.cjs +47 -0
  353. package/v4/classic/coerce.d.cts +17 -0
  354. package/v4/classic/coerce.d.ts +17 -0
  355. package/v4/classic/coerce.js +17 -0
  356. package/v4/classic/compat.cjs +61 -0
  357. package/v4/classic/compat.d.cts +50 -0
  358. package/v4/classic/compat.d.ts +50 -0
  359. package/v4/classic/compat.js +31 -0
  360. package/v4/classic/errors.cjs +74 -0
  361. package/v4/classic/errors.d.cts +30 -0
  362. package/v4/classic/errors.d.ts +30 -0
  363. package/v4/classic/errors.js +48 -0
  364. package/v4/classic/external.cjs +73 -0
  365. package/v4/classic/external.d.cts +15 -0
  366. package/v4/classic/external.d.ts +15 -0
  367. package/v4/classic/external.js +20 -0
  368. package/v4/classic/from-json-schema.cjs +610 -0
  369. package/v4/classic/from-json-schema.d.cts +12 -0
  370. package/v4/classic/from-json-schema.d.ts +12 -0
  371. package/v4/classic/from-json-schema.js +584 -0
  372. package/v4/classic/index.cjs +33 -0
  373. package/v4/classic/index.d.cts +4 -0
  374. package/v4/classic/index.d.ts +4 -0
  375. package/v4/classic/index.js +4 -0
  376. package/v4/classic/iso.cjs +60 -0
  377. package/v4/classic/iso.d.cts +22 -0
  378. package/v4/classic/iso.d.ts +22 -0
  379. package/v4/classic/iso.js +30 -0
  380. package/v4/classic/package.json +7 -0
  381. package/v4/classic/parse.cjs +41 -0
  382. package/v4/classic/parse.d.cts +31 -0
  383. package/v4/classic/parse.d.ts +31 -0
  384. package/v4/classic/parse.js +15 -0
  385. package/v4/classic/schemas.cjs +1272 -0
  386. package/v4/classic/schemas.d.cts +739 -0
  387. package/v4/classic/schemas.d.ts +739 -0
  388. package/v4/classic/schemas.js +1157 -0
  389. package/v4/core/api.cjs +1222 -0
  390. package/v4/core/api.d.cts +304 -0
  391. package/v4/core/api.d.ts +304 -0
  392. package/v4/core/api.js +1082 -0
  393. package/v4/core/checks.cjs +601 -0
  394. package/v4/core/checks.d.cts +278 -0
  395. package/v4/core/checks.d.ts +278 -0
  396. package/v4/core/checks.js +575 -0
  397. package/v4/core/core.cjs +83 -0
  398. package/v4/core/core.d.cts +70 -0
  399. package/v4/core/core.d.ts +70 -0
  400. package/v4/core/core.js +76 -0
  401. package/v4/core/doc.cjs +39 -0
  402. package/v4/core/doc.d.cts +14 -0
  403. package/v4/core/doc.d.ts +14 -0
  404. package/v4/core/doc.js +35 -0
  405. package/v4/core/errors.cjs +213 -0
  406. package/v4/core/errors.d.cts +220 -0
  407. package/v4/core/errors.d.ts +220 -0
  408. package/v4/core/errors.js +182 -0
  409. package/v4/core/index.cjs +47 -0
  410. package/v4/core/index.d.cts +16 -0
  411. package/v4/core/index.d.ts +16 -0
  412. package/v4/core/index.js +16 -0
  413. package/v4/core/json-schema-generator.cjs +99 -0
  414. package/v4/core/json-schema-generator.d.cts +65 -0
  415. package/v4/core/json-schema-generator.d.ts +65 -0
  416. package/v4/core/json-schema-generator.js +95 -0
  417. package/v4/core/json-schema-processors.cjs +648 -0
  418. package/v4/core/json-schema-processors.d.cts +49 -0
  419. package/v4/core/json-schema-processors.d.ts +49 -0
  420. package/v4/core/json-schema-processors.js +605 -0
  421. package/v4/core/json-schema.cjs +2 -0
  422. package/v4/core/json-schema.d.cts +88 -0
  423. package/v4/core/json-schema.d.ts +88 -0
  424. package/v4/core/json-schema.js +1 -0
  425. package/v4/core/package.json +7 -0
  426. package/v4/core/parse.cjs +131 -0
  427. package/v4/core/parse.d.cts +49 -0
  428. package/v4/core/parse.d.ts +49 -0
  429. package/v4/core/parse.js +93 -0
  430. package/v4/core/regexes.cjs +167 -0
  431. package/v4/core/regexes.d.cts +80 -0
  432. package/v4/core/regexes.d.ts +80 -0
  433. package/v4/core/regexes.js +134 -0
  434. package/v4/core/registries.cjs +56 -0
  435. package/v4/core/registries.d.cts +35 -0
  436. package/v4/core/registries.d.ts +35 -0
  437. package/v4/core/registries.js +51 -0
  438. package/v4/core/schemas.cjs +2147 -0
  439. package/v4/core/schemas.d.cts +1147 -0
  440. package/v4/core/schemas.d.ts +1147 -0
  441. package/v4/core/schemas.js +2115 -0
  442. package/v4/core/standard-schema.cjs +2 -0
  443. package/v4/core/standard-schema.d.cts +126 -0
  444. package/v4/core/standard-schema.d.ts +126 -0
  445. package/v4/core/standard-schema.js +1 -0
  446. package/v4/core/to-json-schema.cjs +446 -0
  447. package/v4/core/to-json-schema.d.cts +114 -0
  448. package/v4/core/to-json-schema.d.ts +114 -0
  449. package/v4/core/to-json-schema.js +437 -0
  450. package/v4/core/util.cjs +729 -0
  451. package/v4/core/util.d.cts +201 -0
  452. package/v4/core/util.d.ts +201 -0
  453. package/v4/core/util.js +668 -0
  454. package/v4/core/versions.cjs +8 -0
  455. package/v4/core/versions.d.cts +5 -0
  456. package/v4/core/versions.d.ts +5 -0
  457. package/v4/core/versions.js +5 -0
  458. package/v4/index.cjs +22 -0
  459. package/v4/index.d.cts +3 -0
  460. package/v4/index.d.ts +3 -0
  461. package/v4/index.js +3 -0
  462. package/v4/locales/ar.cjs +133 -0
  463. package/v4/locales/ar.d.cts +5 -0
  464. package/v4/locales/ar.d.ts +4 -0
  465. package/v4/locales/ar.js +106 -0
  466. package/v4/locales/az.cjs +132 -0
  467. package/v4/locales/az.d.cts +5 -0
  468. package/v4/locales/az.d.ts +4 -0
  469. package/v4/locales/az.js +105 -0
  470. package/v4/locales/be.cjs +183 -0
  471. package/v4/locales/be.d.cts +5 -0
  472. package/v4/locales/be.d.ts +4 -0
  473. package/v4/locales/be.js +156 -0
  474. package/v4/locales/bg.cjs +147 -0
  475. package/v4/locales/bg.d.cts +5 -0
  476. package/v4/locales/bg.d.ts +4 -0
  477. package/v4/locales/bg.js +120 -0
  478. package/v4/locales/ca.cjs +134 -0
  479. package/v4/locales/ca.d.cts +5 -0
  480. package/v4/locales/ca.d.ts +4 -0
  481. package/v4/locales/ca.js +107 -0
  482. package/v4/locales/cs.cjs +138 -0
  483. package/v4/locales/cs.d.cts +5 -0
  484. package/v4/locales/cs.d.ts +4 -0
  485. package/v4/locales/cs.js +111 -0
  486. package/v4/locales/da.cjs +142 -0
  487. package/v4/locales/da.d.cts +5 -0
  488. package/v4/locales/da.d.ts +4 -0
  489. package/v4/locales/da.js +115 -0
  490. package/v4/locales/de.cjs +135 -0
  491. package/v4/locales/de.d.cts +5 -0
  492. package/v4/locales/de.d.ts +4 -0
  493. package/v4/locales/de.js +108 -0
  494. package/v4/locales/en.cjs +136 -0
  495. package/v4/locales/en.d.cts +5 -0
  496. package/v4/locales/en.d.ts +4 -0
  497. package/v4/locales/en.js +109 -0
  498. package/v4/locales/eo.cjs +136 -0
  499. package/v4/locales/eo.d.cts +5 -0
  500. package/v4/locales/eo.d.ts +4 -0
  501. package/v4/locales/eo.js +109 -0
  502. package/v4/locales/es.cjs +159 -0
  503. package/v4/locales/es.d.cts +5 -0
  504. package/v4/locales/es.d.ts +4 -0
  505. package/v4/locales/es.js +132 -0
  506. package/v4/locales/fa.cjs +141 -0
  507. package/v4/locales/fa.d.cts +5 -0
  508. package/v4/locales/fa.d.ts +4 -0
  509. package/v4/locales/fa.js +114 -0
  510. package/v4/locales/fi.cjs +139 -0
  511. package/v4/locales/fi.d.cts +5 -0
  512. package/v4/locales/fi.d.ts +4 -0
  513. package/v4/locales/fi.js +112 -0
  514. package/v4/locales/fr-CA.cjs +134 -0
  515. package/v4/locales/fr-CA.d.cts +5 -0
  516. package/v4/locales/fr-CA.d.ts +4 -0
  517. package/v4/locales/fr-CA.js +107 -0
  518. package/v4/locales/fr.cjs +135 -0
  519. package/v4/locales/fr.d.cts +5 -0
  520. package/v4/locales/fr.d.ts +4 -0
  521. package/v4/locales/fr.js +108 -0
  522. package/v4/locales/he.cjs +241 -0
  523. package/v4/locales/he.d.cts +5 -0
  524. package/v4/locales/he.d.ts +4 -0
  525. package/v4/locales/he.js +214 -0
  526. package/v4/locales/hr.cjs +149 -0
  527. package/v4/locales/hr.d.cts +5 -0
  528. package/v4/locales/hr.d.ts +4 -0
  529. package/v4/locales/hr.js +122 -0
  530. package/v4/locales/hu.cjs +135 -0
  531. package/v4/locales/hu.d.cts +5 -0
  532. package/v4/locales/hu.d.ts +4 -0
  533. package/v4/locales/hu.js +108 -0
  534. package/v4/locales/hy.cjs +174 -0
  535. package/v4/locales/hy.d.cts +5 -0
  536. package/v4/locales/hy.d.ts +4 -0
  537. package/v4/locales/hy.js +147 -0
  538. package/v4/locales/id.cjs +133 -0
  539. package/v4/locales/id.d.cts +5 -0
  540. package/v4/locales/id.d.ts +4 -0
  541. package/v4/locales/id.js +106 -0
  542. package/v4/locales/index.cjs +106 -0
  543. package/v4/locales/index.d.cts +50 -0
  544. package/v4/locales/index.d.ts +50 -0
  545. package/v4/locales/index.js +50 -0
  546. package/v4/locales/is.cjs +136 -0
  547. package/v4/locales/is.d.cts +5 -0
  548. package/v4/locales/is.d.ts +4 -0
  549. package/v4/locales/is.js +109 -0
  550. package/v4/locales/it.cjs +135 -0
  551. package/v4/locales/it.d.cts +5 -0
  552. package/v4/locales/it.d.ts +4 -0
  553. package/v4/locales/it.js +108 -0
  554. package/v4/locales/ja.cjs +134 -0
  555. package/v4/locales/ja.d.cts +5 -0
  556. package/v4/locales/ja.d.ts +4 -0
  557. package/v4/locales/ja.js +107 -0
  558. package/v4/locales/ka.cjs +139 -0
  559. package/v4/locales/ka.d.cts +5 -0
  560. package/v4/locales/ka.d.ts +4 -0
  561. package/v4/locales/ka.js +112 -0
  562. package/v4/locales/kh.cjs +12 -0
  563. package/v4/locales/kh.d.cts +5 -0
  564. package/v4/locales/kh.d.ts +5 -0
  565. package/v4/locales/kh.js +5 -0
  566. package/v4/locales/km.cjs +137 -0
  567. package/v4/locales/km.d.cts +5 -0
  568. package/v4/locales/km.d.ts +4 -0
  569. package/v4/locales/km.js +110 -0
  570. package/v4/locales/ko.cjs +138 -0
  571. package/v4/locales/ko.d.cts +5 -0
  572. package/v4/locales/ko.d.ts +4 -0
  573. package/v4/locales/ko.js +111 -0
  574. package/v4/locales/lt.cjs +230 -0
  575. package/v4/locales/lt.d.cts +5 -0
  576. package/v4/locales/lt.d.ts +4 -0
  577. package/v4/locales/lt.js +203 -0
  578. package/v4/locales/mk.cjs +136 -0
  579. package/v4/locales/mk.d.cts +5 -0
  580. package/v4/locales/mk.d.ts +4 -0
  581. package/v4/locales/mk.js +109 -0
  582. package/v4/locales/ms.cjs +134 -0
  583. package/v4/locales/ms.d.cts +5 -0
  584. package/v4/locales/ms.d.ts +4 -0
  585. package/v4/locales/ms.js +107 -0
  586. package/v4/locales/nl.cjs +137 -0
  587. package/v4/locales/nl.d.cts +5 -0
  588. package/v4/locales/nl.d.ts +4 -0
  589. package/v4/locales/nl.js +110 -0
  590. package/v4/locales/no.cjs +135 -0
  591. package/v4/locales/no.d.cts +5 -0
  592. package/v4/locales/no.d.ts +4 -0
  593. package/v4/locales/no.js +108 -0
  594. package/v4/locales/ota.cjs +136 -0
  595. package/v4/locales/ota.d.cts +5 -0
  596. package/v4/locales/ota.d.ts +4 -0
  597. package/v4/locales/ota.js +109 -0
  598. package/v4/locales/package.json +7 -0
  599. package/v4/locales/pl.cjs +136 -0
  600. package/v4/locales/pl.d.cts +5 -0
  601. package/v4/locales/pl.d.ts +4 -0
  602. package/v4/locales/pl.js +109 -0
  603. package/v4/locales/ps.cjs +141 -0
  604. package/v4/locales/ps.d.cts +5 -0
  605. package/v4/locales/ps.d.ts +4 -0
  606. package/v4/locales/ps.js +114 -0
  607. package/v4/locales/pt.cjs +135 -0
  608. package/v4/locales/pt.d.cts +5 -0
  609. package/v4/locales/pt.d.ts +4 -0
  610. package/v4/locales/pt.js +108 -0
  611. package/v4/locales/ru.cjs +183 -0
  612. package/v4/locales/ru.d.cts +5 -0
  613. package/v4/locales/ru.d.ts +4 -0
  614. package/v4/locales/ru.js +156 -0
  615. package/v4/locales/sl.cjs +136 -0
  616. package/v4/locales/sl.d.cts +5 -0
  617. package/v4/locales/sl.d.ts +4 -0
  618. package/v4/locales/sl.js +109 -0
  619. package/v4/locales/sv.cjs +137 -0
  620. package/v4/locales/sv.d.cts +5 -0
  621. package/v4/locales/sv.d.ts +4 -0
  622. package/v4/locales/sv.js +110 -0
  623. package/v4/locales/ta.cjs +137 -0
  624. package/v4/locales/ta.d.cts +5 -0
  625. package/v4/locales/ta.d.ts +4 -0
  626. package/v4/locales/ta.js +110 -0
  627. package/v4/locales/th.cjs +137 -0
  628. package/v4/locales/th.d.cts +5 -0
  629. package/v4/locales/th.d.ts +4 -0
  630. package/v4/locales/th.js +110 -0
  631. package/v4/locales/tr.cjs +132 -0
  632. package/v4/locales/tr.d.cts +5 -0
  633. package/v4/locales/tr.d.ts +4 -0
  634. package/v4/locales/tr.js +105 -0
  635. package/v4/locales/ua.cjs +12 -0
  636. package/v4/locales/ua.d.cts +5 -0
  637. package/v4/locales/ua.d.ts +5 -0
  638. package/v4/locales/ua.js +5 -0
  639. package/v4/locales/uk.cjs +135 -0
  640. package/v4/locales/uk.d.cts +5 -0
  641. package/v4/locales/uk.d.ts +4 -0
  642. package/v4/locales/uk.js +108 -0
  643. package/v4/locales/ur.cjs +137 -0
  644. package/v4/locales/ur.d.cts +5 -0
  645. package/v4/locales/ur.d.ts +4 -0
  646. package/v4/locales/ur.js +110 -0
  647. package/v4/locales/uz.cjs +137 -0
  648. package/v4/locales/uz.d.cts +5 -0
  649. package/v4/locales/uz.d.ts +4 -0
  650. package/v4/locales/uz.js +110 -0
  651. package/v4/locales/vi.cjs +135 -0
  652. package/v4/locales/vi.d.cts +5 -0
  653. package/v4/locales/vi.d.ts +4 -0
  654. package/v4/locales/vi.js +108 -0
  655. package/v4/locales/yo.cjs +134 -0
  656. package/v4/locales/yo.d.cts +5 -0
  657. package/v4/locales/yo.d.ts +4 -0
  658. package/v4/locales/yo.js +107 -0
  659. package/v4/locales/zh-CN.cjs +136 -0
  660. package/v4/locales/zh-CN.d.cts +5 -0
  661. package/v4/locales/zh-CN.d.ts +4 -0
  662. package/v4/locales/zh-CN.js +109 -0
  663. package/v4/locales/zh-TW.cjs +134 -0
  664. package/v4/locales/zh-TW.d.cts +5 -0
  665. package/v4/locales/zh-TW.d.ts +4 -0
  666. package/v4/locales/zh-TW.js +107 -0
  667. package/v4/mini/checks.cjs +34 -0
  668. package/v4/mini/checks.d.cts +1 -0
  669. package/v4/mini/checks.d.ts +1 -0
  670. package/v4/mini/checks.js +1 -0
  671. package/v4/mini/coerce.cjs +52 -0
  672. package/v4/mini/coerce.d.cts +7 -0
  673. package/v4/mini/coerce.d.ts +7 -0
  674. package/v4/mini/coerce.js +22 -0
  675. package/v4/mini/external.cjs +63 -0
  676. package/v4/mini/external.d.cts +12 -0
  677. package/v4/mini/external.d.ts +12 -0
  678. package/v4/mini/external.js +14 -0
  679. package/v4/mini/index.cjs +32 -0
  680. package/v4/mini/index.d.cts +3 -0
  681. package/v4/mini/index.d.ts +3 -0
  682. package/v4/mini/index.js +3 -0
  683. package/v4/mini/iso.cjs +64 -0
  684. package/v4/mini/iso.d.cts +22 -0
  685. package/v4/mini/iso.d.ts +22 -0
  686. package/v4/mini/iso.js +34 -0
  687. package/v4/mini/package.json +7 -0
  688. package/v4/mini/parse.cjs +16 -0
  689. package/v4/mini/parse.d.cts +1 -0
  690. package/v4/mini/parse.d.ts +1 -0
  691. package/v4/mini/parse.js +1 -0
  692. package/v4/mini/schemas.cjs +1046 -0
  693. package/v4/mini/schemas.d.cts +427 -0
  694. package/v4/mini/schemas.d.ts +427 -0
  695. package/v4/mini/schemas.js +925 -0
  696. package/v4/package.json +7 -0
  697. package/v4-mini/index.cjs +32 -0
  698. package/v4-mini/index.d.cts +3 -0
  699. package/v4-mini/index.d.ts +3 -0
  700. package/v4-mini/index.js +3 -0
  701. package/v4-mini/package.json +7 -0
@@ -0,0 +1,1200 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { expect, test } from "vitest";
3
+
4
+ import * as z from "zod/v4";
5
+
6
+ const minFive = z.string().min(5, "min5");
7
+ const maxFive = z.string().max(5, "max5");
8
+ const justFive = z.string().length(5);
9
+ const nonempty = z.string().min(1, "nonempty");
10
+ const includes = z.string().includes("includes");
11
+ const includesFromIndex2 = z.string().includes("includes", { position: 2 });
12
+ const startsWith = z.string().startsWith("startsWith");
13
+ const endsWith = z.string().endsWith("endsWith");
14
+
15
+ test("length checks", () => {
16
+ minFive.parse("12345");
17
+ minFive.parse("123456");
18
+ maxFive.parse("12345");
19
+ maxFive.parse("1234");
20
+ nonempty.parse("1");
21
+ justFive.parse("12345");
22
+
23
+ expect(() => minFive.parse("1234")).toThrow();
24
+ expect(() => maxFive.parse("123456")).toThrow();
25
+ expect(() => nonempty.parse("")).toThrow();
26
+ expect(() => justFive.parse("1234")).toThrow();
27
+ expect(() => justFive.parse("123456")).toThrow();
28
+ });
29
+
30
+ test("includes", () => {
31
+ includes.parse("XincludesXX");
32
+ includesFromIndex2.parse("XXXincludesXX");
33
+
34
+ expect(() => includes.parse("XincludeXX")).toThrow();
35
+ expect(() => includesFromIndex2.parse("XincludesXX")).toThrow();
36
+ });
37
+
38
+ test("includes with string error message", () => {
39
+ const schema = z.string().includes("test", "must contain test");
40
+ schema.parse("this is a test");
41
+
42
+ expect(schema.safeParse("this is invalid")).toMatchInlineSnapshot(`
43
+ {
44
+ "error": [ZodError: [
45
+ {
46
+ "origin": "string",
47
+ "code": "invalid_format",
48
+ "format": "includes",
49
+ "includes": "test",
50
+ "path": [],
51
+ "message": "must contain test"
52
+ }
53
+ ]],
54
+ "success": false,
55
+ }
56
+ `);
57
+ });
58
+
59
+ test("startswith/endswith", () => {
60
+ startsWith.parse("startsWithX");
61
+ endsWith.parse("XendsWith");
62
+
63
+ expect(() => startsWith.parse("x")).toThrow();
64
+ expect(() => endsWith.parse("x")).toThrow();
65
+ });
66
+
67
+ test("email validations", () => {
68
+ const validEmails = [
69
+ `email@domain.com`,
70
+ `firstname.lastname@domain.com`,
71
+ `email@subdomain.domain.com`,
72
+ `firstname+lastname@domain.com`,
73
+ `1234567890@domain.com`,
74
+ `email@domain-one.com`,
75
+ `_______@domain.com`,
76
+ `email@domain.name`,
77
+ `email@domain.co.jp`,
78
+ `firstname-lastname@domain.com`,
79
+ `very.common@example.com`,
80
+ `disposable.style.email.with+symbol@example.com`,
81
+ `other.email-with-hyphen@example.com`,
82
+ `fully-qualified-domain@example.com`,
83
+ `user.name+tag+sorting@example.com`,
84
+ `x@example.com`,
85
+ `mojojojo@asdf.example.com`,
86
+ `example-indeed@strange-example.com`,
87
+ `example@s.example`,
88
+ `user-@example.org`,
89
+ `user@my-example.com`,
90
+ `a@b.cd`,
91
+ `work+user@mail.com`,
92
+ `tom@test.te-st.com`,
93
+ `something@subdomain.domain-with-hyphens.tld`,
94
+ `common'name@domain.com`,
95
+ `francois@etu.inp-n7.fr`,
96
+ ];
97
+ const invalidEmails = [
98
+ // no "printable characters"
99
+ // `user%example.com@example.org`,
100
+ // `mailhost!username@example.org`,
101
+ // `test/test@test.com`,
102
+
103
+ // double @
104
+ `francois@@etu.inp-n7.fr`,
105
+ // do not support quotes
106
+ `"email"@domain.com`,
107
+ `"e asdf sadf ?<>ail"@domain.com`,
108
+ `" "@example.org`,
109
+ `"john..doe"@example.org`,
110
+ `"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com`,
111
+ // do not support comma
112
+ `a,b@domain.com`,
113
+
114
+ // do not support IPv4
115
+ `email@123.123.123.123`,
116
+ `email@[123.123.123.123]`,
117
+ `postmaster@123.123.123.123`,
118
+ `user@[68.185.127.196]`,
119
+ `ipv4@[85.129.96.247]`,
120
+ `valid@[79.208.229.53]`,
121
+ `valid@[255.255.255.255]`,
122
+ `valid@[255.0.55.2]`,
123
+ `valid@[255.0.55.2]`,
124
+
125
+ // do not support ipv6
126
+ `hgrebert0@[IPv6:4dc8:ac7:ce79:8878:1290:6098:5c50:1f25]`,
127
+ `bshapiro4@[IPv6:3669:c709:e981:4884:59a3:75d1:166b:9ae]`,
128
+ `jsmith@[IPv6:2001:db8::1]`,
129
+ `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]`,
130
+ `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:192.168.1.1]`,
131
+
132
+ // microsoft test cases
133
+ `plainaddress`,
134
+ `#@%^%#$@#$@#.com`,
135
+ `@domain.com`,
136
+ `Joe Smith &lt;email@domain.com&gt;`,
137
+ `email.domain.com`,
138
+ `email@domain@domain.com`,
139
+ `.email@domain.com`,
140
+ `email.@domain.com`,
141
+ `email..email@domain.com`,
142
+ `あいうえお@domain.com`,
143
+ `email@domain.com (Joe Smith)`,
144
+ `email@domain`,
145
+ `email@-domain.com`,
146
+ `email@111.222.333.44444`,
147
+ `email@domain..com`,
148
+ `Abc.example.com`,
149
+ `A@b@c@example.com`,
150
+ `colin..hacks@domain.com`,
151
+ `a"b(c)d,e:f;g<h>i[j\k]l@example.com`,
152
+ `just"not"right@example.com`,
153
+ `this is"not\allowed@example.com`,
154
+ `this\ still\"not\\allowed@example.com`,
155
+
156
+ // random
157
+ `i_like_underscore@but_its_not_allowed_in_this_part.example.com`,
158
+ `QA[icon]CHOCOLATE[icon]@test.com`,
159
+ `invalid@-start.com`,
160
+ `invalid@end.com-`,
161
+ `a.b@c.d`,
162
+ `invalid@[1.1.1.-1]`,
163
+ `invalid@[68.185.127.196.55]`,
164
+ `temp@[192.168.1]`,
165
+ `temp@[9.18.122.]`,
166
+ `double..point@test.com`,
167
+ `asdad@test..com`,
168
+ `asdad@hghg...sd...au`,
169
+ `asdad@hghg........au`,
170
+ `invalid@[256.2.2.48]`,
171
+ `invalid@[256.2.2.48]`,
172
+ `invalid@[999.465.265.1]`,
173
+ `jkibbey4@[IPv6:82c4:19a8::70a9:2aac:557::ea69:d985:28d]`,
174
+ `mlivesay3@[9952:143f:b4df:2179:49a1:5e82:b92e:6b6]`,
175
+ `gbacher0@[IPv6:bc37:4d3f:5048:2e26:37cc:248e:df8e:2f7f:af]`,
176
+ `invalid@[IPv6:5348:4ed3:5d38:67fb:e9b:acd2:c13:192.168.256.1]`,
177
+ `test@.com`,
178
+ `aaaaaaaaaaaaaaalongemailthatcausesregexDoSvulnerability@test.c`,
179
+ ];
180
+ const emailSchema = z.string().email();
181
+
182
+ expect(
183
+ validEmails.every((email) => {
184
+ return emailSchema.safeParse(email).success;
185
+ })
186
+ ).toBe(true);
187
+ expect(
188
+ invalidEmails.every((email) => {
189
+ return emailSchema.safeParse(email).success === false;
190
+ })
191
+ ).toBe(true);
192
+ });
193
+
194
+ test("base64 validations", () => {
195
+ const validBase64Strings = [
196
+ "SGVsbG8gV29ybGQ=", // "Hello World"
197
+ "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==", // "This is an encoded string"
198
+ "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=", // "Many hands make light work"
199
+ "UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz", // "Patience is the key to success"
200
+ "QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==", // "Base64 encoding is fun"
201
+ "MTIzNDU2Nzg5MA==", // "1234567890"
202
+ "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=", // "abcdefghijklmnopqrstuvwxyz"
203
+ "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=", // "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
204
+ "ISIkJSMmJyonKCk=", // "!\"#$%&'()*"
205
+ "", // Empty string is technically a valid base64
206
+ ];
207
+
208
+ for (const str of validBase64Strings) {
209
+ expect(str + z.string().base64().safeParse(str).success).toBe(`${str}true`);
210
+ }
211
+
212
+ const invalidBase64Strings = [
213
+ "12345", // Not padded correctly, not a multiple of 4 characters
214
+ "SGVsbG8gV29ybGQ", // Missing padding
215
+ "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw", // Missing padding
216
+ "!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz", // Invalid character '!'
217
+ "?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==", // Invalid character '?'
218
+ ".MTIzND2Nzg5MC4=", // Invalid character '.'
219
+ "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo", // Missing padding
220
+ ];
221
+
222
+ for (const str of invalidBase64Strings) {
223
+ expect(str + z.string().base64().safeParse(str).success).toBe(`${str}false`);
224
+ }
225
+ });
226
+
227
+ test("base64url validations", () => {
228
+ const base64url = z.string().base64url();
229
+
230
+ const validBase64URLStrings = [
231
+ "SGVsbG8gV29ybGQ", // "Hello World"
232
+
233
+ "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw", // "This is an encoded string"
234
+
235
+ "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms", // "Many hands make light work"
236
+
237
+ "UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz", // "Patience is the key to success"
238
+ "QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg", // "Base64 encoding is fun"
239
+
240
+ "MTIzNDU2Nzg5MA", // "1234567890"
241
+
242
+ "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo", // "abcdefghijklmnopqrstuvwxyz"
243
+
244
+ "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo", // "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
245
+
246
+ "ISIkJSMmJyonKCk", // "!\"#$%&'()*"
247
+
248
+ "", // Empty string is technically valid base64url
249
+ "w7_Dv8O-w74K", // ÿÿþþ
250
+ "123456",
251
+ ];
252
+
253
+ for (const str of validBase64URLStrings) {
254
+ expect(str + base64url.safeParse(str).success).toBe(`${str}true`);
255
+ }
256
+
257
+ const invalidBase64URLStrings = [
258
+ "w7/Dv8O+w74K", // Has + and / characters (is base64)
259
+ "12345", // Invalid length (not a multiple of 4 characters when adding allowed number of padding characters)
260
+ "12345===", // Not padded correctly
261
+ "!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz", // Invalid character '!'
262
+ "?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==", // Invalid character '?'
263
+ ".MTIzND2Nzg5MC4=", // Invalid character '.'
264
+
265
+ // disallow valid padding
266
+ "SGVsbG8gV29ybGQ=", // "Hello World" with padding
267
+ "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==", // "This is an encoded string" with padding
268
+ "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=", // "Many hands make light work" with padding
269
+ "QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==", // "Base64 encoding is fun" with padding
270
+ "MTIzNDU2Nzg5MA==", // "1234567890" with padding
271
+ "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=", // "abcdefghijklmnopqrstuvwxyz with padding"
272
+ "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=", // "ABCDEFGHIJKLMNOPQRSTUVWXYZ" with padding
273
+ "ISIkJSMmJyonKCk=", // "!\"#$%&'()*" with padding
274
+ ];
275
+
276
+ for (const str of invalidBase64URLStrings) {
277
+ expect(str + base64url.safeParse(str).success).toBe(`${str}false`);
278
+ }
279
+ });
280
+
281
+ test("big base64 and base64url", () => {
282
+ const bigbase64 = randomBytes(1024 * 1024 * 10).toString("base64");
283
+ z.base64().parse(bigbase64);
284
+ const bigbase64url = randomBytes(1024 * 1024 * 10).toString("base64url");
285
+ z.base64url().parse(bigbase64url);
286
+ });
287
+
288
+ function makeJwt(header: object, payload: object) {
289
+ const headerBase64 = Buffer.from(JSON.stringify(header)).toString("base64url");
290
+ const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
291
+ const signature = "signature"; // Placeholder for the signature
292
+ return `${headerBase64}.${payloadBase64}.${signature}`;
293
+ }
294
+
295
+ test("jwt token", () => {
296
+ const jwt = z.string().jwt();
297
+ expect(() => jwt.parse("invalid")).toThrow();
298
+ expect(() => jwt.parse("invalid.invalid")).toThrow();
299
+ expect(() => jwt.parse("invalid.invalid.invalid")).toThrow();
300
+
301
+ // Valid JWTs
302
+ const es256jwt = z.string().jwt({ alg: "ES256" });
303
+ const d1 = makeJwt({ typ: "JWT", alg: "ES256" }, {});
304
+ jwt.parse(d1);
305
+ es256jwt.parse(d1);
306
+
307
+ // Invalid header
308
+ const d2 = makeJwt({}, {});
309
+ expect(() => jwt.parse(d2)).toThrow();
310
+
311
+ // Wrong algorithm
312
+ const d3 = makeJwt({ typ: "JWT", alg: "RS256" }, {});
313
+ expect(() => es256jwt.parse(d3)).toThrow();
314
+
315
+ // missing typ is fine
316
+ const d4 = makeJwt({ alg: "HS256" }, {});
317
+ jwt.parse(d4);
318
+
319
+ // type isn't JWT
320
+ const d5 = makeJwt({ typ: "SUP", alg: "HS256" }, { foo: "bar" });
321
+ expect(() => jwt.parse(d5)).toThrow();
322
+ });
323
+
324
+ test("url validations", () => {
325
+ const url = z.string().url();
326
+ url.parse("http://google.com");
327
+ url.parse("https://google.com/asdf?asdf=ljk3lk4&asdf=234#asdf");
328
+ url.parse("https://anonymous:flabada@developer.mozilla.org/en-US/docs/Web/API/URL/password");
329
+ url.parse("https://localhost");
330
+ url.parse("https://my.local");
331
+ url.parse("http://aslkfjdalsdfkjaf");
332
+ url.parse("http://localhost");
333
+
334
+ url.parse("c:");
335
+
336
+ expect(() => url.parse("asdf")).toThrow();
337
+ expect(() => url.parse("https:/")).toThrow();
338
+ expect(() => url.parse("asdfj@lkjsdf.com")).toThrow();
339
+ expect(() => url.parse("https://")).toThrow();
340
+ });
341
+
342
+ test("url preserves original input", () => {
343
+ const url = z.string().url();
344
+
345
+ // Test the specific case from the user report
346
+ const input = "https://example.com?key=NUXOmHqWNVTapJkJJHw8BfD155AuqhH_qju_5fNmQ4ZHV7u8";
347
+ const output = url.parse(input);
348
+ expect(output).toBe(input); // Should preserve the original input exactly
349
+
350
+ // Test other cases where URL constructor would normalize
351
+ expect(url.parse("https://example.com?foo=bar")).toBe("https://example.com?foo=bar");
352
+ expect(url.parse("http://example.com?test=123")).toBe("http://example.com?test=123");
353
+ expect(url.parse("https://sub.example.com?param=value&other=data")).toBe(
354
+ "https://sub.example.com?param=value&other=data"
355
+ );
356
+
357
+ // Test cases with trailing slashes are preserved
358
+ expect(url.parse("https://example.com/")).toBe("https://example.com/");
359
+ expect(url.parse("https://example.com/path/")).toBe("https://example.com/path/");
360
+
361
+ // Test cases with paths and query parameters
362
+ expect(url.parse("https://example.com/path?query=param")).toBe("https://example.com/path?query=param");
363
+ });
364
+
365
+ test("url trims whitespace", () => {
366
+ const url = z.string().url();
367
+
368
+ // Test trimming whitespace from URLs
369
+ expect(url.parse(" https://example.com ")).toBe("https://example.com");
370
+ expect(url.parse(" https://example.com/path?query=param ")).toBe("https://example.com/path?query=param");
371
+ expect(url.parse("\t\nhttps://example.com\t\n")).toBe("https://example.com");
372
+ expect(url.parse(" https://example.com?key=value ")).toBe("https://example.com?key=value");
373
+
374
+ // Test that URLs without extra whitespace are unchanged
375
+ expect(url.parse("https://example.com")).toBe("https://example.com");
376
+ expect(url.parse("https://example.com/path")).toBe("https://example.com/path");
377
+ });
378
+
379
+ test("url normalize flag", () => {
380
+ const normalizeUrl = z.url({ normalize: true });
381
+ const preserveUrl = z.url(); // normalize: false/undefined by default
382
+
383
+ // Test that normalize flag causes URL normalization
384
+ expect(normalizeUrl.parse("https://example.com?key=value")).toBe("https://example.com/?key=value");
385
+ expect(normalizeUrl.parse("http://example.com?test=123")).toBe("http://example.com/?test=123");
386
+
387
+ // Test with already normalized URLs
388
+ expect(normalizeUrl.parse("https://example.com/")).toBe("https://example.com/");
389
+ expect(normalizeUrl.parse("https://example.com/path?query=param")).toBe("https://example.com/path?query=param");
390
+
391
+ // Test complex URLs with normalization
392
+ expect(normalizeUrl.parse("https://example.com/../?key=value")).toBe("https://example.com/?key=value");
393
+ expect(normalizeUrl.parse("https://example.com/./path?key=value")).toBe("https://example.com/path?key=value");
394
+
395
+ // Compare with non-normalize behavior
396
+ expect(preserveUrl.parse("https://example.com?key=value")).toBe("https://example.com?key=value");
397
+ expect(preserveUrl.parse("http://example.com?test=123")).toBe("http://example.com?test=123");
398
+
399
+ // Test trimming with normalize
400
+ expect(normalizeUrl.parse(" https://example.com?key=value ")).toBe("https://example.com/?key=value");
401
+ expect(preserveUrl.parse(" https://example.com?key=value ")).toBe("https://example.com?key=value");
402
+ });
403
+
404
+ test("url normalize with hostname and protocol constraints", () => {
405
+ const constrainedNormalizeUrl = z.url({
406
+ normalize: true,
407
+ protocol: /^https$/,
408
+ hostname: /^example\.com$/,
409
+ });
410
+
411
+ // Test that normalization works with constraints
412
+ expect(constrainedNormalizeUrl.parse("https://example.com?key=value")).toBe("https://example.com/?key=value");
413
+
414
+ // Test that constraints are still enforced
415
+ expect(() => constrainedNormalizeUrl.parse("http://example.com?key=value")).toThrow();
416
+ expect(() => constrainedNormalizeUrl.parse("https://other.com?key=value")).toThrow();
417
+ });
418
+
419
+ test("httpurl", () => {
420
+ const httpUrl = z.url({
421
+ protocol: /^https?$/,
422
+ hostname: z.regexes.domain,
423
+ // /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/
424
+ });
425
+
426
+ httpUrl.parse("https://example.com");
427
+ httpUrl.parse("http://example.com");
428
+ // ports
429
+ httpUrl.parse("https://example.com:8080");
430
+ httpUrl.parse("http://example.com:8080");
431
+ // subdomains
432
+ httpUrl.parse("https://sub.example.com");
433
+ httpUrl.parse("http://sub.example.com");
434
+ // paths
435
+ httpUrl.parse("https://example.com/path/to/resource");
436
+ httpUrl.parse("http://example.com/path/to/resource");
437
+ // query parameters
438
+ httpUrl.parse("https://example.com/path?query=param");
439
+ httpUrl.parse("http://example.com/path?query=param");
440
+ // fragment identifiers
441
+ httpUrl.parse("https://example.com/path#fragment");
442
+ httpUrl.parse("http://example.com/path#fragment");
443
+ // fails
444
+ expect(() => httpUrl.parse("ftp://example.com")).toThrow();
445
+ expect(() => httpUrl.parse("shttp://example.com")).toThrow();
446
+ expect(() => httpUrl.parse("httpz://example.com")).toThrow();
447
+ expect(() => httpUrl.parse("http://")).toThrow();
448
+ expect(() => httpUrl.parse("http://localhost")).toThrow();
449
+ expect(() => httpUrl.parse("http://-asdf.com")).toThrow();
450
+ expect(() =>
451
+ httpUrl.parse(
452
+ "http://asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf.com"
453
+ )
454
+ ).toThrow();
455
+ expect(() => httpUrl.parse("http://asdf.c")).toThrow();
456
+ expect(() => httpUrl.parse("mailto:asdf@lckj.com")).toThrow();
457
+ // missing // after protocol
458
+ expect(() => httpUrl.parse("http:example.com")).toThrow();
459
+ expect(() => httpUrl.parse("https:example.com")).toThrow();
460
+ // missing one /
461
+ expect(() => httpUrl.parse("https:/www.google.com")).toThrow();
462
+ expect(() => httpUrl.parse("http:/example.com")).toThrow();
463
+ });
464
+
465
+ test("url error overrides", () => {
466
+ try {
467
+ z.string().url().parse("https");
468
+ } catch (err) {
469
+ expect((err as z.ZodError).issues[0].message).toEqual("Invalid URL");
470
+ }
471
+ try {
472
+ z.string().url("badurl").parse("https");
473
+ } catch (err) {
474
+ expect((err as z.ZodError).issues[0].message).toEqual("badurl");
475
+ }
476
+ try {
477
+ z.string().url({ message: "badurl" }).parse("https");
478
+ } catch (err) {
479
+ expect((err as z.ZodError).issues[0].message).toEqual("badurl");
480
+ }
481
+ });
482
+
483
+ test("emoji validations", () => {
484
+ const emoji = z.string().emoji();
485
+
486
+ emoji.parse("👋👋👋👋");
487
+ emoji.parse("🍺👩‍🚀🫡");
488
+ emoji.parse("💚💙💜💛❤️");
489
+ emoji.parse("🐛🗝🐏🍡🎦🚢🏨💫🎌☘🗡😹🔒🎬➡️🍹🗂🚨⚜🕑〽️🚦🌊🍴💍🍌💰😳🌺🍃");
490
+ emoji.parse("🇹🇷🤽🏿‍♂️");
491
+ emoji.parse(
492
+ "😀😁😂🤣😃😄😅😆😉😊😋😎😍😘🥰😗😙😚☺️☺🙂🤗🤩🤔🤨😐😑😶🙄😏😣😥😮🤐😯😪😫😴😌😛😜😝🤤😒😓😔😕🙃🤑😲☹️☹🙁😖😞😟😤😢😭😦😧😨😩🤯😬😰😱🥵🥶😳🤪😵😡😠🤬😷🤒🤕🤢🤮🤧😇🤠🥳🥴🥺🤥🤫🤭🧐🤓😈👿🤡👹👺💀☠️☠👻👽👾🤖💩😺😸😹😻😼😽🙀😿😾🙈🙉🙊🏻🏼🏽🏾🏿👶👶🏻👶🏼👶🏽👶🏾👶🏿🧒🧒🏻🧒🏼🧒🏽🧒🏾🧒🏿👦👦🏻👦🏼👦🏽👦🏾👦🏿👧👧🏻👧🏼👧🏽👧🏾👧🏿🧑🧑🏻🧑🏼🧑🏽🧑🏾🧑🏿👨👨🏻👨🏼👨🏽👨🏾👨🏿👩👩🏻👩🏼👩🏽👩🏾👩🏿🧓🧓🏻🧓🏼🧓🏽🧓🏾🧓🏿👴👴🏻👴🏼👴🏽👴🏾👴🏿👵👵🏻👵🏼👵🏽👵🏾👵🏿👨‍⚕️👨‍⚕👨🏻‍⚕️👨🏻‍⚕👨🏼‍⚕️👨🏼‍⚕👨🏽‍⚕️👨🏽‍⚕👨🏾‍⚕️👨🏾‍⚕👨🏿‍⚕️👨🏿‍⚕👩‍⚕️👩‍⚕👩🏻‍⚕️👩🏻‍⚕👩🏼‍⚕️👩🏼‍⚕👩🏽‍⚕️👩🏽‍⚕👩🏾‍⚕️👩🏾‍⚕👩🏿‍⚕️👩🏿‍⚕👨‍🎓👨🏻‍🎓👨🏼‍🎓👨🏽‍🎓👨🏾‍🎓👨🏿‍🎓👩‍🎓👩🏻‍🎓👩🏼‍🎓👩🏽‍🎓👩🏾‍🎓👩🏿‍🎓👨‍🏫👨🏻‍🏫👨🏼‍🏫👨🏽‍🏫👨🏾‍🏫👨🏿‍🏫👩‍🏫👩🏻‍🏫👩🏼‍🏫👩🏽‍🏫👩🏾‍🏫👩🏿‍🏫👨‍⚖️👨‍⚖👨🏻‍⚖️👨🏻‍⚖👨🏼‍⚖️👨🏼‍⚖👨🏽‍⚖️👨🏽‍⚖👨🏾‍⚖️👨🏾‍⚖👨🏿‍⚖️👨🏿‍⚖👩‍⚖️👩‍⚖👩🏻‍⚖️👩🏻‍⚖👩🏼‍⚖️👩🏼‍⚖👩🏽‍⚖️👩🏽‍⚖👩🏾‍⚖️👩🏾‍⚖👩🏿‍⚖️👩🏿‍⚖👨‍🌾👨🏻‍🌾👨🏼‍🌾👨🏽‍🌾👨🏾‍🌾👨🏿‍🌾👩‍🌾👩🏻‍🌾👩🏼‍🌾👩🏽‍🌾👩🏾‍🌾👩🏿‍🌾👨‍🍳👨🏻‍🍳👨🏼‍🍳👨🏽‍🍳👨🏾‍🍳👨🏿‍🍳👩‍🍳👩🏻‍🍳👩🏼‍🍳👩🏽‍🍳👩🏾‍🍳👩🏿‍🍳👨‍🔧👨🏻‍🔧👨🏼‍🔧👨🏽‍🔧👨🏾‍🔧👨🏿‍🔧👩‍🔧👩🏻‍🔧👩🏼‍🔧👩🏽‍🔧👩🏾‍🔧👩🏿‍🔧👨‍🏭👨🏻‍🏭👨🏼‍🏭👨🏽‍🏭👨🏾‍🏭👨🏿‍🏭👩‍🏭👩🏻‍🏭👩🏼‍🏭👩🏽‍🏭👩🏾‍🏭👩🏿‍🏭👨‍💼👨🏻‍💼👨🏼‍💼👨🏽‍💼👨🏾‍💼👨🏿‍💼👩‍💼👩🏻‍💼👩🏼‍💼👩🏽‍💼👩🏾‍💼👩🏿‍💼👨‍🔬👨🏻‍🔬👨🏼‍🔬👨🏽‍🔬👨🏾‍🔬👨🏿‍🔬👩‍🔬👩🏻‍🔬👩🏼‍🔬👩🏽‍🔬👩🏾‍🔬👩🏿‍🔬👨‍💻👨🏻‍💻👨🏼‍💻👨🏽‍💻👨🏾‍💻👨🏿‍💻👩‍💻👩🏻‍💻👩🏼‍💻👩🏽‍💻👩🏾‍💻👩🏿‍💻👨‍🎤👨🏻‍🎤👨🏼‍🎤👨🏽‍🎤👨🏾‍🎤👨🏿‍🎤👩‍🎤👩🏻‍🎤👩🏼‍🎤👩🏽‍🎤👩🏾‍🎤👩🏿‍🎤👨‍🎨👨🏻‍🎨👨🏼‍🎨👨🏽‍🎨👨🏾‍🎨👨🏿‍🎨👩‍🎨👩🏻‍🎨👩🏼‍🎨👩🏽‍🎨👩🏾‍🎨👩🏿‍🎨👨‍✈️👨‍✈👨🏻‍✈️👨🏻‍✈👨🏼‍✈️👨🏼‍✈👨🏽‍✈️👨🏽‍✈👨🏾‍✈️👨🏾‍✈👨🏿‍✈️👨🏿‍✈👩‍✈️👩‍✈👩🏻‍✈️👩🏻‍✈👩🏼‍✈️👩🏼‍✈👩🏽‍✈️👩🏽‍✈👩🏾‍✈️👩🏾‍✈👩🏿‍✈️👩🏿‍✈👨‍🚀👨🏻‍🚀👨🏼‍🚀👨🏽‍🚀👨🏾‍🚀👨🏿‍🚀👩‍🚀👩🏻‍🚀👩🏼‍🚀👩🏽‍🚀👩🏾‍🚀👩🏿‍🚀👨‍🚒👨🏻‍🚒👨🏼‍🚒👨🏽‍🚒👨🏾‍🚒👨🏿‍🚒👩‍🚒👩🏻‍🚒👩🏼‍🚒👩🏽‍🚒👩🏾‍🚒👩🏿‍🚒👮👮🏻👮🏼👮🏽👮🏾👮🏿👮‍♂️👮‍♂👮🏻‍♂️👮🏻‍♂👮🏼‍♂️👮🏼‍♂👮🏽‍♂️👮🏽‍♂👮🏾‍♂️👮🏾‍♂👮🏿‍♂️👮🏿‍♂👮‍♀️👮‍♀👮🏻‍♀️👮🏻‍♀👮🏼‍♀️👮🏼‍♀👮🏽‍♀️👮🏽‍♀👮🏾‍♀️👮🏾‍♀👮🏿‍♀️👮🏿‍♀🕵️🕵🕵🏻🕵🏼🕵🏽🕵🏾🕵🏿🕵️‍♂️🕵‍♂️🕵️‍♂🕵‍♂🕵🏻‍♂️🕵🏻‍♂🕵🏼‍♂️🕵🏼‍♂🕵🏽‍♂️🕵🏽‍♂🕵🏾‍♂️🕵🏾‍♂🕵🏿‍♂️🕵🏿‍♂🕵️‍♀️🕵‍♀️🕵️‍♀🕵‍♀🕵🏻‍♀️🕵🏻‍♀🕵🏼‍♀️🕵🏼‍♀🕵🏽‍♀️🕵🏽‍♀🕵🏾‍♀️🕵🏾‍♀🕵🏿‍♀️🕵🏿‍♀💂💂🏻💂🏼💂🏽💂🏾💂🏿💂‍♂️💂‍♂💂🏻‍♂️💂🏻‍♂💂🏼‍♂️💂🏼‍♂💂🏽‍♂️💂🏽‍♂💂🏾‍♂️💂🏾‍♂💂🏿‍♂️💂🏿‍♂💂‍♀️💂‍♀💂🏻‍♀️💂🏻‍♀💂🏼‍♀️💂🏼‍♀💂🏽‍♀️💂🏽‍♀💂🏾‍♀️💂🏾‍♀💂🏿‍♀️💂🏿‍♀👷👷🏻👷🏼👷🏽👷🏾👷🏿👷‍♂️👷‍♂👷🏻‍♂️👷🏻‍♂👷🏼‍♂️👷🏼‍♂👷🏽‍♂️👷🏽‍♂👷🏾‍♂️👷🏾‍♂👷🏿‍♂️👷🏿‍♂👷‍♀️👷‍♀👷🏻‍♀️👷🏻‍♀👷🏼‍♀️👷🏼‍♀👷🏽‍♀️👷🏽‍♀👷🏾‍♀️👷🏾‍♀👷🏿‍♀️👷🏿‍♀🤴🤴🏻🤴🏼🤴🏽🤴🏾🤴🏿👸👸🏻👸🏼👸🏽👸🏾👸🏿👳👳🏻👳🏼👳🏽👳🏾👳🏿👳‍♂️👳‍♂👳🏻‍♂️👳🏻‍♂👳🏼‍♂️👳🏼‍♂👳🏽‍♂️👳🏽‍♂👳🏾‍♂️👳🏾‍♂👳🏿‍♂️👳🏿‍♂👳‍♀️👳‍♀👳🏻‍♀️👳🏻‍♀👳🏼‍♀️👳🏼‍♀👳🏽‍♀️👳🏽‍♀👳🏾‍♀️👳🏾‍♀👳🏿‍♀️👳🏿‍♀👲👲🏻👲🏼👲🏽👲🏾👲🏿🧕🧕🏻🧕🏼🧕🏽🧕🏾🧕🏿🧔🧔🏻🧔🏼🧔🏽🧔🏾🧔🏿👱👱🏻👱🏼👱🏽👱🏾👱🏿👱‍♂️👱‍♂👱🏻‍♂️👱🏻‍♂👱🏼‍♂️👱🏼‍♂👱🏽‍♂️👱🏽‍♂👱🏾‍♂️👱🏾‍♂👱🏿‍♂️👱🏿‍♂👱‍♀️👱‍♀👱🏻‍♀️👱🏻‍♀👱🏼‍♀️👱🏼‍♀👱🏽‍♀️👱🏽‍♀👱🏾‍♀️👱🏾‍♀👱🏿‍♀️👱🏿‍♀👨‍🦰👨🏻‍🦰👨🏼‍🦰👨🏽‍🦰👨🏾‍🦰👨🏿‍🦰👩‍🦰👩🏻‍🦰👩🏼‍🦰👩🏽‍🦰👩🏾‍🦰👩🏿‍🦰👨‍🦱👨🏻‍🦱👨🏼‍🦱👨🏽‍🦱👨🏾‍🦱👨🏿‍🦱👩‍🦱👩🏻‍🦱👩🏼‍🦱👩🏽‍🦱👩🏾‍🦱👩🏿‍🦱👨‍🦲👨🏻‍🦲👨🏼‍🦲👨🏽‍🦲👨🏾‍🦲👨🏿‍🦲👩‍🦲👩🏻‍🦲👩🏼‍🦲👩🏽‍🦲👩🏾‍🦲👩🏿‍🦲👨‍🦳👨🏻‍🦳👨🏼‍🦳👨🏽‍🦳👨🏾‍🦳👨🏿‍🦳👩‍🦳👩🏻‍🦳👩🏼‍🦳👩🏽‍🦳👩🏾‍🦳👩🏿‍🦳🤵🤵🏻🤵🏼🤵🏽🤵🏾🤵🏿👰👰🏻👰🏼👰🏽👰🏾👰🏿🤰🤰🏻🤰🏼🤰🏽🤰🏾🤰🏿🤱🤱🏻🤱🏼🤱🏽🤱🏾🤱🏿👼👼🏻👼🏼👼🏽👼🏾👼🏿🎅🎅🏻🎅🏼🎅🏽🎅🏾🎅🏿🤶🤶🏻🤶🏼🤶🏽🤶🏾🤶🏿🦸🦸🏻🦸🏼🦸🏽🦸🏾🦸🏿🦸‍♀️🦸‍♀🦸🏻‍♀️🦸🏻‍♀🦸🏼‍♀️🦸🏼‍♀🦸🏽‍♀️🦸🏽‍♀🦸🏾‍♀️🦸🏾‍♀🦸🏿‍♀️🦸🏿‍♀🦸‍♂️🦸‍♂🦸🏻‍♂️🦸🏻‍♂🦸🏼‍♂️🦸🏼‍♂🦸🏽‍♂️🦸🏽‍♂🦸🏾‍♂️🦸🏾‍♂🦸🏿‍♂️🦸🏿‍♂🦹🦹🏻🦹🏼🦹🏽🦹🏾🦹🏿🦹‍♀️🦹‍♀🦹🏻‍♀️🦹🏻‍♀🦹🏼‍♀️🦹🏼‍♀🦹🏽‍♀️🦹🏽‍♀🦹🏾‍♀️🦹🏾‍♀🦹🏿‍♀️🦹🏿‍♀🦹‍♂️🦹‍♂🦹🏻‍♂️🦹🏻‍♂🦹🏼‍♂️🦹🏼‍♂🦹🏽‍♂️🦹🏽‍♂🦹🏾‍♂️🦹🏾‍♂🦹🏿‍♂️🦹🏿‍♂🧙🧙🏻🧙🏼🧙🏽🧙🏾🧙🏿🧙‍♀️🧙‍♀🧙🏻‍♀️🧙🏻‍♀🧙🏼‍♀️🧙🏼‍♀🧙🏽‍♀️🧙🏽‍♀🧙🏾‍♀️🧙🏾‍♀🧙🏿‍♀️🧙🏿‍♀🧙‍♂️🧙‍♂🧙🏻‍♂️🧙🏻‍♂🧙🏼‍♂️🧙🏼‍♂🧙🏽‍♂️🧙🏽‍♂🧙🏾‍♂️🧙🏾‍♂🧙🏿‍♂️🧙🏿‍♂🧚🧚🏻🧚🏼🧚🏽🧚🏾🧚🏿🧚‍♀️🧚‍♀🧚🏻‍♀️🧚🏻‍♀🧚🏼‍♀️🧚🏼‍♀🧚🏽‍♀️🧚🏽‍♀🧚🏾‍♀️🧚🏾‍♀🧚🏿‍♀️🧚🏿‍♀🧚‍♂️🧚‍♂🧚🏻‍♂️🧚🏻‍♂🧚🏼‍♂️🧚🏼‍♂🧚🏽‍♂️🧚🏽‍♂🧚🏾‍♂️🧚🏾‍♂🧚🏿‍♂️🧚🏿‍♂🧛🧛🏻🧛🏼🧛🏽🧛🏾🧛🏿🧛‍♀️🧛‍♀🧛🏻‍♀️🧛🏻‍♀🧛🏼‍♀️🧛🏼‍♀🧛🏽‍♀️🧛🏽‍♀🧛🏾‍♀️🧛🏾‍♀🧛🏿‍♀️🧛🏿‍♀🧛‍♂️🧛‍♂🧛🏻‍♂️🧛🏻‍♂🧛🏼‍♂️🧛🏼‍♂🧛🏽‍♂️🧛🏽‍♂🧛🏾‍♂️🧛🏾‍♂🧛🏿‍♂️🧛🏿‍♂🧜🧜🏻🧜🏼🧜🏽🧜🏾🧜🏿🧜‍♀️🧜‍♀🧜🏻‍♀️🧜🏻‍♀🧜🏼‍♀️🧜🏼‍♀🧜🏽‍♀️🧜🏽‍♀🧜🏾‍♀️🧜🏾‍♀🧜🏿‍♀️🧜🏿‍♀🧜‍♂️🧜‍♂🧜🏻‍♂️🧜🏻‍♂🧜🏼‍♂️🧜🏼‍♂🧜🏽‍♂️🧜🏽‍♂🧜🏾‍♂️🧜🏾‍♂🧜🏿‍♂️🧜🏿‍♂🧝🧝🏻🧝🏼🧝🏽🧝🏾🧝🏿🧝‍♀️🧝‍♀🧝🏻‍♀️🧝🏻‍♀🧝🏼‍♀️🧝🏼‍♀🧝🏽‍♀️🧝🏽‍♀🧝🏾‍♀️🧝🏾‍♀🧝🏿‍♀️🧝🏿‍♀🧝‍♂️🧝‍♂🧝🏻‍♂️🧝🏻‍♂🧝🏼‍♂️🧝🏼‍♂🧝🏽‍♂️🧝🏽‍♂🧝🏾‍♂️🧝🏾‍♂🧝🏿‍♂️🧝🏿‍♂🧞🧞‍♀️🧞‍♀🧞‍♂️🧞‍♂🧟🧟‍♀️🧟‍♀🧟‍♂️🧟‍♂🙍🙍🏻🙍🏼🙍🏽🙍🏾🙍🏿🙍‍♂️🙍‍♂🙍🏻‍♂️🙍🏻‍♂🙍🏼‍♂️🙍🏼‍♂🙍🏽‍♂️🙍🏽‍♂🙍🏾‍♂️🙍🏾‍♂🙍🏿‍♂️🙍🏿‍♂🙍‍♀️🙍‍♀🙍🏻‍♀️🙍🏻‍♀🙍🏼‍♀️🙍🏼‍♀🙍🏽‍♀️🙍🏽‍♀🙍🏾‍♀️🙍🏾‍♀🙍🏿‍♀️🙍🏿‍♀🙎🙎🏻🙎🏼🙎🏽🙎🏾🙎🏿🙎‍♂️🙎‍♂🙎🏻‍♂️🙎🏻‍♂🙎🏼‍♂️🙎🏼‍♂🙎🏽‍♂️🙎🏽‍♂🙎🏾‍♂️🙎🏾‍♂🙎🏿‍♂️🙎🏿‍♂🙎‍♀️🙎‍♀🙎🏻‍♀️🙎🏻‍♀🙎🏼‍♀️🙎🏼‍♀🙎🏽‍♀️🙎🏽‍♀🙎🏾‍♀️🙎🏾‍♀🙎🏿‍♀️🙎🏿‍♀🙅🙅🏻🙅🏼🙅🏽🙅🏾🙅🏿🙅‍♂️🙅‍♂🙅🏻‍♂️🙅🏻‍♂🙅🏼‍♂️🙅🏼‍♂🙅🏽‍♂️🙅🏽‍♂🙅🏾‍♂️🙅🏾‍♂🙅🏿‍♂️🙅🏿‍♂🙅‍♀️🙅‍♀🙅🏻‍♀️🙅🏻‍♀🙅🏼‍♀️🙅🏼‍♀🙅🏽‍♀️🙅🏽‍♀🙅🏾‍♀️🙅🏾‍♀🙅🏿‍♀️🙅🏿‍♀🙆🙆🏻🙆🏼🙆🏽🙆🏾🙆🏿🙆‍♂️🙆‍♂🙆🏻‍♂️🙆🏻‍♂🙆🏼‍♂️🙆🏼‍♂🙆🏽‍♂️🙆🏽‍♂🙆🏾‍♂️🙆🏾‍♂🙆🏿‍♂️🙆🏿‍♂🙆‍♀️🙆‍♀🙆🏻‍♀️🙆🏻‍♀🙆🏼‍♀️🙆🏼‍♀🙆🏽‍♀️🙆🏽‍♀🙆🏾‍♀️🙆🏾‍♀🙆🏿‍♀️🙆🏿‍♀💁💁🏻💁🏼💁🏽💁🏾💁🏿💁‍♂️💁‍♂💁🏻‍♂️💁🏻‍♂💁🏼‍♂️💁🏼‍♂💁🏽‍♂️💁🏽‍♂💁🏾‍♂️💁🏾‍♂💁🏿‍♂️💁🏿‍♂💁‍♀️💁‍♀💁🏻‍♀️💁🏻‍♀💁🏼‍♀️💁🏼‍♀💁🏽‍♀️💁🏽‍♀💁🏾‍♀️💁🏾‍♀💁🏿‍♀️💁🏿‍♀🙋🙋🏻🙋🏼🙋🏽🙋🏾🙋🏿🙋‍♂️🙋‍♂🙋🏻‍♂️🙋🏻‍♂🙋🏼‍♂️🙋🏼‍♂🙋🏽‍♂️🙋🏽‍♂🙋🏾‍♂️🙋🏾‍♂🙋🏿‍♂️🙋🏿‍♂🙋‍♀️🙋‍♀🙋🏻‍♀️🙋🏻‍♀🙋🏼‍♀️🙋🏼‍♀🙋🏽‍♀️🙋🏽‍♀🙋🏾‍♀️🙋🏾‍♀🙋🏿‍♀️🙋🏿‍♀🙇🙇🏻🙇🏼🙇🏽🙇🏾🙇🏿🙇‍♂️🙇‍♂🙇🏻‍♂️🙇🏻‍♂🙇🏼‍♂️🙇🏼‍♂🙇🏽‍♂️🙇🏽‍♂🙇🏾‍♂️🙇🏾‍♂🙇🏿‍♂️🙇🏿‍♂🙇‍♀️🙇‍♀🙇🏻‍♀️🙇🏻‍♀🙇🏼‍♀️🙇🏼‍♀🙇🏽‍♀️🙇🏽‍♀🙇🏾‍♀️🙇🏾‍♀🙇🏿‍♀️🙇🏿‍♀🤦🤦🏻🤦🏼🤦🏽🤦🏾🤦🏿🤦‍♂️🤦‍♂🤦🏻‍♂️🤦🏻‍♂🤦🏼‍♂️🤦🏼‍♂🤦🏽‍♂️🤦🏽‍♂🤦🏾‍♂️🤦🏾‍♂🤦🏿‍♂️🤦🏿‍♂🤦‍♀️🤦‍♀🤦🏻‍♀️🤦🏻‍♀🤦🏼‍♀️🤦🏼‍♀🤦🏽‍♀️🤦🏽‍♀🤦🏾‍♀️🤦🏾‍♀🤦🏿‍♀️🤦🏿‍♀🤷🤷🏻🤷🏼🤷🏽🤷🏾🤷🏿🤷‍♂️🤷‍♂🤷🏻‍♂️🤷🏻‍♂🤷🏼‍♂️🤷🏼‍♂🤷🏽‍♂️🤷🏽‍♂🤷🏾‍♂️🤷🏾‍♂🤷🏿‍♂️🤷🏿‍♂🤷‍♀️🤷‍♀🤷🏻‍♀️🤷🏻‍♀🤷🏼‍♀️🤷🏼‍♀🤷🏽‍♀️🤷🏽‍♀🤷🏾‍♀️🤷🏾‍♀🤷🏿‍♀️🤷🏿‍♀💆💆🏻💆🏼💆🏽💆🏾💆🏿💆‍♂️💆‍♂💆🏻‍♂️💆🏻‍♂💆🏼‍♂️💆🏼‍♂💆🏽‍♂️💆🏽‍♂💆🏾‍♂️💆🏾‍♂💆🏿‍♂️💆🏿‍♂💆‍♀️💆‍♀💆🏻‍♀️💆🏻‍♀💆🏼‍♀️💆🏼‍♀💆🏽‍♀️💆🏽‍♀💆🏾‍♀️💆🏾‍♀💆🏿‍♀️💆🏿‍♀💇💇🏻💇🏼💇🏽💇🏾💇🏿💇‍♂️💇‍♂💇🏻‍♂️💇🏻‍♂💇🏼‍♂️💇🏼‍♂💇🏽‍♂️💇🏽‍♂💇🏾‍♂️💇🏾‍♂💇🏿‍♂️💇🏿‍♂💇‍♀️💇‍♀💇🏻‍♀️💇🏻‍♀💇🏼‍♀️💇🏼‍♀💇🏽‍♀️💇🏽‍♀💇🏾‍♀️💇🏾‍♀💇🏿‍♀️💇🏿‍♀🚶🚶🏻🚶🏼🚶🏽🚶🏾🚶🏿🚶‍♂️🚶‍♂🚶🏻‍♂️🚶🏻‍♂🚶🏼‍♂️🚶🏼‍♂🚶🏽‍♂️🚶🏽‍♂🚶🏾‍♂️🚶🏾‍♂🚶🏿‍♂️🚶🏿‍♂🚶‍♀️🚶‍♀🚶🏻‍♀️🚶🏻‍♀🚶🏼‍♀️🚶🏼‍♀🚶🏽‍♀️🚶🏽‍♀🚶🏾‍♀️🚶🏾‍♀🚶🏿‍♀️🚶🏿‍♀🏃🏃🏻🏃🏼🏃🏽🏃🏾🏃🏿🏃‍♂️🏃‍♂🏃🏻‍♂️🏃🏻‍♂🏃🏼‍♂️🏃🏼‍♂🏃🏽‍♂️🏃🏽‍♂🏃🏾‍♂️🏃🏾‍♂🏃🏿‍♂️🏃🏿‍♂🏃‍♀️🏃‍♀🏃🏻‍♀️🏃🏻‍♀🏃🏼‍♀️🏃🏼‍♀🏃🏽‍♀️🏃🏽‍♀🏃🏾‍♀️🏃🏾‍♀🏃🏿‍♀️🏃🏿‍♀💃💃🏻💃🏼💃🏽💃🏾💃🏿🕺🕺🏻🕺🏼🕺🏽🕺🏾🕺🏿👯👯‍♂️👯‍♂👯‍♀️👯‍♀🧖🧖🏻🧖🏼🧖🏽🧖🏾🧖🏿🧖‍♀️🧖‍♀🧖🏻‍♀️🧖🏻‍♀🧖🏼‍♀️🧖🏼‍♀🧖🏽‍♀️🧖🏽‍♀🧖🏾‍♀️🧖🏾‍♀🧖🏿‍♀️🧖🏿‍♀🧖‍♂️🧖‍♂🧖🏻‍♂️🧖🏻‍♂🧖🏼‍♂️🧖🏼‍♂🧖🏽‍♂️🧖🏽‍♂🧖🏾‍♂️🧖🏾‍♂🧖🏿‍♂️🧖🏿‍♂🧗🧗🏻🧗🏼🧗🏽🧗🏾🧗🏿🧗‍♀️🧗‍♀🧗🏻‍♀️🧗🏻‍♀🧗🏼‍♀️🧗🏼‍♀🧗🏽‍♀️🧗🏽‍♀🧗🏾‍♀️🧗🏾‍♀🧗🏿‍♀️🧗🏿‍♀🧗‍♂️🧗‍♂🧗🏻‍♂️🧗🏻‍♂🧗🏼‍♂️🧗🏼‍♂🧗🏽‍♂️🧗🏽‍♂🧗🏾‍♂️🧗🏾‍♂🧗🏿‍♂️🧗🏿‍♂🧘🧘🏻🧘🏼🧘🏽🧘🏾🧘🏿🧘‍♀️🧘‍♀🧘🏻‍♀️🧘🏻‍♀🧘🏼‍♀️🧘🏼‍♀🧘🏽‍♀️🧘🏽‍♀🧘🏾‍♀️🧘🏾‍♀🧘🏿‍♀️🧘🏿‍♀🧘‍♂️🧘‍♂🧘🏻‍♂️🧘🏻‍♂🧘🏼‍♂️🧘🏼‍♂🧘🏽‍♂️🧘🏽‍♂🧘🏾‍♂️🧘🏾‍♂🧘🏿‍♂️🧘🏿‍♂🛀🛀🏻🛀🏼🛀🏽🛀🏾🛀🏿🛌🛌🏻🛌🏼🛌🏽🛌🏾🛌🏿🕴️🕴🕴🏻🕴🏼🕴🏽🕴🏾🕴🏿🗣️🗣👤👥🤺🏇🏇🏻🏇🏼🏇🏽🏇🏾🏇🏿⛷️⛷🏂🏂🏻🏂🏼🏂🏽🏂🏾🏂🏿🏌️🏌🏌🏻🏌🏼🏌🏽🏌🏾🏌🏿🏌️‍♂️🏌‍♂️🏌️‍♂🏌‍♂🏌🏻‍♂️🏌🏻‍♂🏌🏼‍♂️🏌🏼‍♂🏌🏽‍♂️🏌🏽‍♂🏌🏾‍♂️🏌🏾‍♂🏌🏿‍♂️🏌🏿‍♂🏌️‍♀️🏌‍♀️🏌️‍♀🏌‍♀🏌🏻‍♀️🏌🏻‍♀🏌🏼‍♀️🏌🏼‍♀🏌🏽‍♀️🏌🏽‍♀🏌🏾‍♀️🏌🏾‍♀🏌🏿‍♀️🏌🏿‍♀🏄🏄🏻🏄🏼🏄🏽🏄🏾🏄🏿🏄‍♂️🏄‍♂🏄🏻‍♂️🏄🏻‍♂🏄🏼‍♂️🏄🏼‍♂🏄🏽‍♂️🏄🏽‍♂🏄🏾‍♂️🏄🏾‍♂🏄🏿‍♂️🏄🏿‍♂🏄‍♀️🏄‍♀🏄🏻‍♀️🏄🏻‍♀🏄🏼‍♀️🏄🏼‍♀🏄🏽‍♀️🏄🏽‍♀🏄🏾‍♀️🏄🏾‍♀🏄🏿‍♀️🏄🏿‍♀🚣🚣🏻🚣🏼🚣🏽🚣🏾🚣🏿🚣‍♂️🚣‍♂🚣🏻‍♂️🚣🏻‍♂🚣🏼‍♂️🚣🏼‍♂🚣🏽‍♂️🚣🏽‍♂🚣🏾‍♂️🚣🏾‍♂🚣🏿‍♂️🚣🏿‍♂🚣‍♀️🚣‍♀🚣🏻‍♀️🚣🏻‍♀🚣🏼‍♀️🚣🏼‍♀🚣🏽‍♀️🚣🏽‍♀🚣🏾‍♀️🚣🏾‍♀🚣🏿‍♀️🚣🏿‍♀🏊🏊🏻🏊🏼🏊🏽🏊🏾🏊🏿🏊‍♂️🏊‍♂🏊🏻‍♂️🏊🏻‍♂🏊🏼‍♂️🏊🏼‍♂🏊🏽‍♂️🏊🏽‍♂🏊🏾‍♂️🏊🏾‍♂🏊🏿‍♂️🏊🏿‍♂🏊‍♀️🏊‍♀🏊🏻‍♀️🏊🏻‍♀🏊🏼‍♀️🏊🏼‍♀🏊🏽‍♀️🏊🏽‍♀🏊🏾‍♀️🏊🏾‍♀🏊🏿‍♀️🏊🏿‍♀⛹️⛹⛹🏻⛹🏼⛹🏽⛹🏾⛹🏿⛹️‍♂️⛹‍♂️⛹️‍♂⛹‍♂⛹🏻‍♂️⛹🏻‍♂⛹🏼‍♂️⛹🏼‍♂⛹🏽‍♂️⛹🏽‍♂⛹🏾‍♂️⛹🏾‍♂⛹🏿‍♂️⛹🏿‍♂⛹️‍♀️⛹‍♀️⛹️‍♀⛹‍♀⛹🏻‍♀️⛹🏻‍♀⛹🏼‍♀️⛹🏼‍♀⛹🏽‍♀️⛹🏽‍♀⛹🏾‍♀️⛹🏾‍♀⛹🏿‍♀️⛹🏿‍♀🏋️🏋🏋🏻🏋🏼🏋🏽🏋🏾🏋🏿🏋️‍♂️🏋‍♂️🏋️‍♂🏋‍♂🏋🏻‍♂️🏋🏻‍♂🏋🏼‍♂️🏋🏼‍♂🏋🏽‍♂️🏋🏽‍♂🏋🏾‍♂️🏋🏾‍♂🏋🏿‍♂️🏋🏿‍♂🏋️‍♀️🏋‍♀️🏋️‍♀🏋‍♀🏋🏻‍♀️🏋🏻‍♀🏋🏼‍♀️🏋🏼‍♀🏋🏽‍♀️🏋🏽‍♀🏋🏾‍♀️🏋🏾‍♀🏋🏿‍♀️🏋🏿‍♀🚴🚴🏻🚴🏼🚴🏽🚴🏾🚴🏿🚴‍♂️🚴‍♂🚴🏻‍♂️🚴🏻‍♂🚴🏼‍♂️🚴🏼‍♂🚴🏽‍♂️🚴🏽‍♂🚴🏾‍♂️🚴🏾‍♂🚴🏿‍♂️🚴🏿‍♂🚴‍♀️🚴‍♀🚴🏻‍♀️🚴🏻‍♀🚴🏼‍♀️🚴🏼‍♀🚴🏽‍♀️🚴🏽‍♀🚴🏾‍♀️🚴🏾‍♀🚴🏿‍♀️🚴🏿‍♀🚵🚵🏻🚵🏼🚵🏽🚵🏾🚵🏿🚵‍♂️🚵‍♂🚵🏻‍♂️🚵🏻‍♂🚵🏼‍♂️🚵🏼‍♂🚵🏽‍♂️🚵🏽‍♂🚵🏾‍♂️🚵🏾‍♂🚵🏿‍♂️🚵🏿‍♂🚵‍♀️🚵‍♀🚵🏻‍♀️🚵🏻‍♀🚵🏼‍♀️🚵🏼‍♀🚵🏽‍♀️🚵🏽‍♀🚵🏾‍♀️🚵🏾‍♀🚵🏿‍♀️🚵🏿‍♀🏎️🏎🏍️🏍🤸🤸🏻🤸🏼🤸🏽🤸🏾🤸🏿🤸‍♂️🤸‍♂🤸🏻‍♂️🤸🏻‍♂🤸🏼‍♂️🤸🏼‍♂🤸🏽‍♂️🤸🏽‍♂🤸🏾‍♂️🤸🏾‍♂🤸🏿‍♂️🤸🏿‍♂🤸‍♀️🤸‍♀🤸🏻‍♀️🤸🏻‍♀🤸🏼‍♀️🤸🏼‍♀🤸🏽‍♀️🤸🏽‍♀🤸🏾‍♀️🤸🏾‍♀🤸🏿‍♀️🤸🏿‍♀🤼🤼‍♂️🤼‍♂🤼‍♀️🤼‍♀🤽🤽🏻🤽🏼🤽🏽🤽🏾🤽🏿🤽‍♂️🤽‍♂🤽🏻‍♂️🤽🏻‍♂🤽🏼‍♂️🤽🏼‍♂🤽🏽‍♂️🤽🏽‍♂🤽🏾‍♂️🤽🏾‍♂🤽🏿‍♂️🤽🏿‍♂🤽‍♀️🤽‍♀🤽🏻‍♀️🤽🏻‍♀🤽🏼‍♀️🤽🏼‍♀🤽🏽‍♀️🤽🏽‍♀🤽🏾‍♀️🤽🏾‍♀🤽🏿‍♀️🤽🏿‍♀🤾🤾🏻🤾🏼🤾🏽🤾🏾🤾🏿🤾‍♂️🤾‍♂🤾🏻‍♂️🤾🏻‍♂🤾🏼‍♂️🤾🏼‍♂🤾🏽‍♂️🤾🏽‍♂🤾🏾‍♂️🤾🏾‍♂🤾🏿‍♂️🤾🏿‍♂🤾‍♀️🤾‍♀🤾🏻‍♀️🤾🏻‍♀🤾🏼‍♀️🤾🏼‍♀🤾🏽‍♀️🤾🏽‍♀🤾🏾‍♀️🤾🏾‍♀🤾🏿‍♀️🤾🏿‍♀🤹🤹🏻🤹🏼🤹🏽🤹🏾🤹🏿🤹‍♂️🤹‍♂🤹🏻‍♂️🤹🏻‍♂🤹🏼‍♂️🤹🏼‍♂🤹🏽‍♂️🤹🏽‍♂🤹🏾‍♂️🤹🏾‍♂🤹🏿‍♂️🤹🏿‍♂🤹‍♀️🤹‍♀🤹🏻‍♀️🤹🏻‍♀🤹🏼‍♀️🤹🏼‍♀🤹🏽‍♀️🤹🏽‍♀🤹🏾‍♀️🤹🏾‍♀🤹🏿‍♀️🤹🏿‍♀👫👬👭💏👩‍❤️‍💋‍👨👩‍❤‍💋‍👨👨‍❤️‍💋‍👨👨‍❤‍💋‍👨👩‍❤️‍💋‍👩👩‍❤‍💋‍👩💑👩‍❤️‍👨👩‍❤‍👨👨‍❤️‍👨👨‍❤‍👨👩‍❤️‍👩👩‍❤‍👩👪👨‍👩‍👦👨‍👩‍👧👨‍👩‍👧‍👦👨‍👩‍👦‍👦👨‍👩‍👧‍👧👨‍👨‍👦👨‍👨‍👧👨‍👨‍👧‍👦👨‍👨‍👦‍👦👨‍👨‍👧‍👧👩‍👩‍👦👩‍👩‍👧👩‍👩‍👧‍👦👩‍👩‍👦‍👦👩‍👩‍👧‍👧👨‍👦👨‍👦‍👦👨‍👧👨‍👧‍👦👨‍👧‍👧👩‍👦👩‍👦‍👦👩‍👧👩‍👧‍👦👩‍👧‍👧🤳🤳🏻🤳🏼🤳🏽🤳🏾🤳🏿💪💪🏻💪🏼💪🏽💪🏾💪🏿🦵🦵🏻🦵🏼🦵🏽🦵🏾🦵🏿🦶🦶🏻🦶🏼🦶🏽🦶🏾🦶🏿👈👈🏻👈🏼👈🏽👈🏾👈🏿👉👉🏻👉🏼👉🏽👉🏾👉🏿☝️☝☝🏻☝🏼☝🏽☝🏾☝🏿👆👆🏻👆🏼👆🏽👆🏾👆🏿🖕🖕🏻🖕🏼🖕🏽🖕🏾🖕🏿👇👇🏻👇🏼👇🏽👇🏾👇🏿✌️✌✌🏻✌🏼✌🏽✌🏾✌🏿🤞🤞🏻🤞🏼🤞🏽🤞🏾🤞🏿🖖🖖🏻🖖🏼🖖🏽🖖🏾🖖🏿🤘🤘🏻🤘🏼🤘🏽🤘🏾🤘🏿🤙🤙🏻🤙🏼🤙🏽🤙🏾🤙🏿🖐️🖐🖐🏻🖐🏼🖐🏽🖐🏾🖐🏿✋✋🏻✋🏼✋🏽✋🏾✋🏿👌👌🏻👌🏼👌🏽👌🏾👌🏿👍👍🏻👍🏼👍🏽👍🏾👍🏿👎👎🏻👎🏼👎🏽👎🏾👎🏿✊✊🏻✊🏼✊🏽✊🏾✊🏿👊👊🏻👊🏼👊🏽👊🏾👊🏿🤛🤛🏻🤛🏼🤛🏽🤛🏾🤛🏿🤜🤜🏻🤜🏼🤜🏽🤜🏾🤜🏿🤚🤚🏻🤚🏼🤚🏽🤚🏾🤚🏿👋👋🏻👋🏼👋🏽👋🏾👋🏿🤟🤟🏻🤟🏼🤟🏽🤟🏾🤟🏿✍️✍✍🏻✍🏼✍🏽✍🏾✍🏿👏👏🏻👏🏼👏🏽👏🏾👏🏿👐👐🏻👐🏼👐🏽👐🏾👐🏿🙌🙌🏻🙌🏼🙌🏽🙌🏾🙌🏿🤲🤲🏻🤲🏼🤲🏽🤲🏾🤲🏿🙏🙏🏻🙏🏼🙏🏽🙏🏾🙏🏿🤝💅💅🏻💅🏼💅🏽💅🏾💅🏿👂👂🏻👂🏼👂🏽👂🏾👂🏿👃👃🏻👃🏼👃🏽👃🏾👃🏿🦰🦱🦲🦳👣👀👁️👁👁️‍🗨️👁‍🗨️👁️‍🗨👁‍🗨🧠🦴🦷👅👄💋💘❤️❤💓💔💕💖💗💙💚💛🧡💜🖤💝💞💟❣️❣💌💤💢💣💥💦💨💫💬🗨️🗨🗯️🗯💭🕳️🕳👓🕶️🕶🥽🥼👔👕👖🧣🧤🧥🧦👗👘👙👚👛👜👝🛍️🛍🎒👞👟🥾🥿👠👡👢👑👒🎩🎓🧢⛑️⛑📿💄💍💎🐵🐒🦍🐶🐕🐩🐺🦊🦝🐱🐈🦁🐯🐅🐆🐴🐎🦄🦓🦌🐮🐂🐃🐄🐷🐖🐗🐽🐏🐑🐐🐪🐫🦙🦒🐘🦏🦛🐭🐁🐀🐹🐰🐇🐿️🐿🦔🦇🐻🐨🐼🦘🦡🐾🦃🐔🐓🐣🐤🐥🐦🐧🕊️🕊🦅🦆🦢🦉🦚🦜🐸🐊🐢🦎🐍🐲🐉🦕🦖🐳🐋🐬🐟🐠🐡🦈🐙🐚🦀🦞🦐🦑🐌🦋🐛🐜🐝🐞🦗🕷️🕷🕸️🕸🦂🦟🦠💐🌸💮🏵️🏵🌹🥀🌺🌻🌼🌷🌱🌲🌳🌴🌵🌾🌿☘️☘🍀🍁🍂🍃🍇🍈🍉🍊🍋🍌🍍🥭🍎🍏🍐🍑🍒🍓🥝🍅🥥🥑🍆🥔🥕🌽🌶️🌶🥒🥬🥦🍄🥜🌰🍞🥐🥖🥨🥯🥞🧀🍖🍗🥩🥓🍔🍟🍕🌭🥪🌮🌯🥙🥚🍳🥘🍲🥣🥗🍿🧂🥫🍱🍘🍙🍚🍛🍜🍝🍠🍢🍣🍤🍥🥮🍡🥟🥠🥡🍦🍧🍨🍩🍪🎂🍰🧁🥧🍫🍬🍭🍮🍯🍼🥛☕🍵🍶🍾🍷🍸🍹🍺🍻🥂🥃🥤🥢🍽️🍽🍴🥄🔪🏺🌍🌎🌏🌐🗺️🗺🗾🧭🏔️🏔⛰️⛰🌋🗻🏕️🏕🏖️🏖🏜️🏜🏝️🏝🏞️🏞🏟️🏟🏛️🏛🏗️🏗🧱🏘️🏘🏚️🏚🏠🏡🏢🏣🏤🏥🏦🏨🏩🏪🏫🏬🏭🏯🏰💒🗼🗽⛪🕌🕍⛩️⛩🕋⛲⛺🌁🌃🏙️🏙🌄🌅🌆🌇🌉♨️♨🌌🎠🎡🎢💈🎪🚂🚃🚄🚅🚆🚇🚈🚉🚊🚝🚞🚋🚌🚍🚎🚐🚑🚒🚓🚔🚕🚖🚗🚘🚙🚚🚛🚜🚲🛴🛹🛵🚏🛣️🛣🛤️🛤🛢️🛢⛽🚨🚥🚦🛑🚧⚓⛵🛶🚤🛳️🛳⛴️⛴🛥️🛥🚢✈️✈🛩️🛩🛫🛬💺🚁🚟🚠🚡🛰️🛰🚀🛸🛎️🛎🧳⌛⏳⌚⏰⏱️⏱⏲️⏲🕰️🕰🕛🕧🕐🕜🕑🕝🕒🕞🕓🕟🕔🕠🕕🕡🕖🕢🕗🕣🕘🕤🕙🕥🕚🕦🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜🌡️🌡☀️☀🌝🌞⭐🌟🌠☁️☁⛅⛈️⛈🌤️🌤🌥️🌥🌦️🌦🌧️🌧🌨️🌨🌩️🌩🌪️🌪🌫️🌫🌬️🌬🌀🌈🌂☂️☂☔⛱️⛱⚡❄️❄☃️☃⛄☄️☄🔥💧🌊🎃🎄🎆🎇🧨✨🎈🎉🎊🎋🎍🎎🎏🎐🎑🧧🎀🎁🎗️🎗🎟️🎟🎫🎖️🎖🏆🏅🥇🥈🥉⚽⚾🥎🏀🏐🏈🏉🎾🥏🎳🏏🏑🏒🥍🏓🏸🥊🥋🥅⛳⛸️⛸🎣🎽🎿🛷🥌🎯🎱🔮🧿🎮🕹️🕹🎰🎲🧩🧸♠️♠♥️♥♦️♦♣️♣♟️♟🃏🀄🎴🎭🖼️🖼🎨🧵🧶🔇🔈🔉🔊📢📣📯🔔🔕🎼🎵🎶🎙️🎙🎚️🎚🎛️🎛🎤🎧📻🎷🎸🎹🎺🎻🥁📱📲☎️☎📞📟📠🔋🔌💻🖥️🖥🖨️🖨⌨️⌨🖱️🖱🖲️🖲💽💾💿📀🧮🎥🎞️🎞📽️📽🎬📺📷📸📹📼🔍🔎🕯️🕯💡🔦🏮📔📕📖📗📘📙📚📓📒📃📜📄📰🗞️🗞📑🔖🏷️🏷💰💴💵💶💷💸💳🧾💹💱💲✉️✉📧📨📩📤📥📦📫📪📬📭📮🗳️🗳✏️✏✒️✒🖋️🖋🖊️🖊🖌️🖌🖍️🖍📝💼📁📂🗂️🗂📅📆🗒️🗒🗓️🗓📇📈📉📊📋📌📍📎🖇️🖇📏📐✂️✂🗃️🗃🗄️🗄🗑️🗑🔒🔓🔏🔐🔑🗝️🗝🔨⛏️⛏⚒️⚒🛠️🛠🗡️🗡⚔️⚔🔫🏹🛡️🛡🔧🔩⚙️⚙🗜️🗜⚖️⚖🔗⛓️⛓🧰🧲⚗️⚗🧪🧫🧬🔬🔭📡💉💊🚪🛏️🛏🛋️🛋🚽🚿🛁🧴🧷🧹🧺🧻🧼🧽🧯🛒🚬⚰️⚰⚱️⚱🗿🏧🚮🚰♿🚹🚺🚻🚼🚾🛂🛃🛄🛅⚠️⚠🚸⛔🚫🚳🚭🚯🚱🚷📵🔞☢️☢☣️☣⬆️⬆↗️↗➡️➡↘️↘⬇️⬇↙️↙⬅️⬅↖️↖↕️↕↔️↔↩️↩↪️↪⤴️⤴⤵️⤵🔃🔄🔙🔚🔛🔜🔝🛐⚛️⚛🕉️🕉✡️✡☸️☸☯️☯✝️✝☦️☦☪️☪☮️☮🕎🔯♈♉♊♋♌♍♎♏♐♑♒♓⛎🔀🔁🔂▶️▶⏩⏭️⏭⏯️⏯◀️◀⏪⏮️⏮🔼⏫🔽⏬⏸️⏸⏹️⏹⏺️⏺⏏️⏏🎦🔅🔆📶📳📴♀️♀♂️♂⚕️⚕♾️♾♻️♻⚜️⚜🔱📛🔰⭕✅☑️☑✔️✔✖️✖❌❎➕➖➗➰➿〽️〽✳️✳✴️✴❇️❇‼️‼⁉️⁉❓❔❕❗〰️〰©️©®️®™️™#️⃣#⃣*️⃣*⃣0️⃣0⃣1️⃣1⃣2️⃣2⃣3️⃣3⃣4️⃣4⃣5️⃣5⃣6️⃣6⃣7️⃣7⃣8️⃣8⃣9️⃣9⃣🔟💯🔠🔡🔢🔣🔤🅰️🅰🆎🅱️🅱🆑🆒🆓ℹ️ℹ🆔Ⓜ️Ⓜ🆕🆖🅾️🅾🆗🅿️🅿🆘🆙🆚🈁🈂️🈂🈷️🈷🈶🈯🉐🈹🈚🈲🉑🈸🈴🈳㊗️㊗㊙️㊙🈺🈵▪️▪▫️▫◻️◻◼️◼◽◾⬛⬜🔶🔷🔸🔹🔺🔻💠🔘🔲🔳⚪⚫🔴🔵🏁🚩🎌🏴🏳️🏳🏳️‍🌈🏳‍🌈🏴‍☠️🏴‍☠🇦🇨🇦🇩🇦🇪🇦🇫🇦🇬🇦🇮🇦🇱🇦🇲🇦🇴🇦🇶🇦🇷🇦🇸🇦🇹🇦🇺🇦🇼🇦🇽🇦🇿🇧🇦🇧🇧🇧🇩🇧🇪🇧🇫🇧🇬🇧🇭🇧🇮🇧🇯🇧🇱🇧🇲🇧🇳🇧🇴🇧🇶🇧🇷🇧🇸🇧🇹🇧🇻🇧🇼🇧🇾🇧🇿🇨🇦🇨🇨🇨🇩🇨🇫🇨🇬🇨🇭🇨🇮🇨🇰🇨🇱🇨🇲🇨🇳🇨🇴🇨🇵🇨🇷🇨🇺🇨🇻🇨🇼🇨🇽🇨🇾🇨🇿🇩🇪🇩🇬🇩🇯🇩🇰🇩🇲🇩🇴🇩🇿🇪🇦🇪🇨🇪🇪🇪🇬🇪🇭🇪🇷🇪🇸🇪🇹🇪🇺🇫🇮🇫🇯🇫🇰🇫🇲🇫🇴🇫🇷🇬🇦🇬🇧🇬🇩🇬🇪🇬🇫🇬🇬🇬🇭🇬🇮🇬🇱🇬🇲🇬🇳🇬🇵🇬🇶🇬🇷🇬🇸🇬🇹🇬🇺🇬🇼🇬🇾🇭🇰🇭🇲🇭🇳🇭🇷🇭🇹🇭🇺🇮🇨🇮🇩🇮🇪🇮🇱🇮🇲🇮🇳🇮🇴🇮🇶🇮🇷🇮🇸🇮🇹🇯🇪🇯🇲🇯🇴🇯🇵🇰🇪🇰🇬🇰🇭🇰🇮🇰🇲🇰🇳🇰🇵🇰🇷🇰🇼🇰🇾🇰🇿🇱🇦🇱🇧🇱🇨🇱🇮🇱🇰🇱🇷🇱🇸🇱🇹🇱🇺🇱🇻🇱🇾🇲🇦🇲🇨🇲🇩🇲🇪🇲🇫🇲🇬🇲🇭🇲🇰🇲🇱🇲🇲🇲🇳🇲🇴🇲🇵🇲🇶🇲🇷🇲🇸🇲🇹🇲🇺🇲🇻🇲🇼🇲🇽🇲🇾🇲🇿🇳🇦🇳🇨🇳🇪🇳🇫🇳🇬🇳🇮🇳🇱🇳🇴🇳🇵🇳🇷🇳🇺🇳🇿🇴🇲🇵🇦🇵🇪🇵🇫🇵🇬🇵🇭🇵🇰🇵🇱🇵🇲🇵🇳🇵🇷🇵🇸🇵🇹🇵🇼🇵🇾🇶🇦🇷🇪🇷🇴🇷🇸🇷🇺🇷🇼🇸🇦🇸🇧🇸🇨🇸🇩🇸🇪🇸🇬🇸🇭🇸🇮🇸🇯🇸🇰🇸🇱🇸🇲🇸🇳🇸🇴🇸🇷🇸🇸🇸🇹🇸🇻🇸🇽🇸🇾🇸🇿🇹🇦🇹🇨🇹🇩🇹🇫🇹🇬🇹🇭🇹🇯🇹🇰🇹🇱🇹🇲🇹🇳🇹🇴🇹🇷🇹🇹🇹🇻🇹🇼🇹🇿🇺🇦🇺🇬🇺🇲🇺🇳🇺🇸🇺🇾🇺🇿🇻🇦🇻🇨🇻🇪🇻🇬🇻🇮🇻🇳🇻🇺🇼🇫🇼🇸🇽🇰🇾🇪🇾🇹🇿🇦🇿🇲🇿🇼🏴󠁧󠁢󠁥󠁮󠁧󠁿🏴󠁧󠁢󠁳󠁣󠁴󠁿🏴󠁧󠁢󠁷󠁬󠁳󠁿"
493
+ );
494
+ expect(() => emoji.parse(":-)")).toThrow();
495
+ expect(() => emoji.parse("😀 is an emoji")).toThrow();
496
+ expect(() => emoji.parse("😀stuff")).toThrow();
497
+ expect(() => emoji.parse("stuff😀")).toThrow();
498
+ });
499
+
500
+ test("nanoid", () => {
501
+ const nanoid = z.string().nanoid("custom error");
502
+ nanoid.parse("lfNZluvAxMkf7Q8C5H-QS");
503
+ nanoid.parse("mIU_4PJWikaU8fMbmkouz");
504
+ nanoid.parse("Hb9ZUtUa2JDm_dD-47EGv");
505
+ nanoid.parse("5Noocgv_8vQ9oPijj4ioQ");
506
+ const result = nanoid.safeParse("Xq90uDyhddC53KsoASYJGX");
507
+ expect(result).toMatchObject({ success: false });
508
+
509
+ expect(result.error!.issues[0].message).toEqual("custom error");
510
+ expect(result.error).toMatchInlineSnapshot(`
511
+ [ZodError: [
512
+ {
513
+ "origin": "string",
514
+ "code": "invalid_format",
515
+ "format": "nanoid",
516
+ "pattern": "/^[a-zA-Z0-9_-]{21}$/",
517
+ "path": [],
518
+ "message": "custom error"
519
+ }
520
+ ]]
521
+ `);
522
+ });
523
+
524
+ test("bad nanoid", () => {
525
+ const nanoid = z.string().nanoid("custom error");
526
+ nanoid.parse("ySh_984wpDUu7IQRrLXAp");
527
+ const result = nanoid.safeParse("invalid nanoid");
528
+ expect(result).toMatchObject({ success: false });
529
+
530
+ expect(result.error!.issues[0].message).toEqual("custom error");
531
+ expect(result.error).toMatchInlineSnapshot(`
532
+ [ZodError: [
533
+ {
534
+ "origin": "string",
535
+ "code": "invalid_format",
536
+ "format": "nanoid",
537
+ "pattern": "/^[a-zA-Z0-9_-]{21}$/",
538
+ "path": [],
539
+ "message": "custom error"
540
+ }
541
+ ]]
542
+ `);
543
+ });
544
+
545
+ test("good uuid", () => {
546
+ const uuid = z.string().uuid("custom error");
547
+ const goodUuids = [
548
+ "9491d710-3185-1e06-bea0-6a2f275345e0",
549
+ "9491d710-3185-2e06-bea0-6a2f275345e0",
550
+ "9491d710-3185-3e06-bea0-6a2f275345e0",
551
+ "9491d710-3185-4e06-bea0-6a2f275345e0",
552
+ "9491d710-3185-5e06-bea0-6a2f275345e0",
553
+ "9491d710-3185-5e06-aea0-6a2f275345e0",
554
+ "9491d710-3185-5e06-8ea0-6a2f275345e0",
555
+ "9491d710-3185-5e06-9ea0-6a2f275345e0",
556
+ "00000000-0000-0000-0000-000000000000",
557
+ "ffffffff-ffff-ffff-ffff-ffffffffffff",
558
+ ];
559
+
560
+ for (const goodUuid of goodUuids) {
561
+ const result = uuid.safeParse(goodUuid);
562
+ expect(result.success).toEqual(true);
563
+ }
564
+ });
565
+
566
+ test(`bad uuid`, () => {
567
+ const uuid = z.string().uuid("custom error");
568
+ for (const badUuid of [
569
+ "9491d710-3185-0e06-bea0-6a2f275345e0",
570
+ "9491d710-3185-5e06-0ea0-6a2f275345e0",
571
+ "d89e7b01-7598-ed11-9d7a-0022489382fd", // new sequential id
572
+ "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 9562/4122: Reserved, NCS backward compatibility
573
+ "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 9562/4122: Reserved, Microsoft Corporation backward compatibility
574
+ "invalid uuid",
575
+ "9491d710-3185-4e06-bea0-6a2f275345e0X",
576
+ ]) {
577
+ const result = uuid.safeParse(badUuid);
578
+ expect(result).toMatchObject({ success: false });
579
+ expect(result.error?.issues[0].message).toEqual("custom error");
580
+ }
581
+ });
582
+
583
+ test("good guid", () => {
584
+ const guid = z.string().guid("custom error");
585
+ for (const goodGuid of [
586
+ "9491d710-3185-4e06-bea0-6a2f275345e0",
587
+ "d89e7b01-7598-ed11-9d7a-0022489382fd", // new sequential id
588
+ "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 9562/4122: Reserved, NCS backward compatibility
589
+ "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 9562/4122: Reserved, Microsoft Corporation backward compatibility
590
+ "00000000-0000-0000-0000-000000000000",
591
+ "ffffffff-ffff-ffff-ffff-ffffffffffff",
592
+ ]) {
593
+ const result = guid.safeParse(goodGuid);
594
+ expect(result.success).toEqual(true);
595
+ }
596
+ });
597
+
598
+ test("bad guid", () => {
599
+ const guid = z.string().guid("custom error");
600
+ for (const badGuid of ["9491d710-3185-4e06-bea0-6a2f275345e0X"]) {
601
+ const result = guid.safeParse(badGuid);
602
+ expect(result).toMatchObject({ success: false });
603
+ expect(result.error?.issues[0].message).toEqual("custom error");
604
+ }
605
+ });
606
+
607
+ test("cuid", () => {
608
+ const cuid = z.string().cuid();
609
+ cuid.parse("ckopqwooh000001la8mbi2im9");
610
+ const result = cuid.safeParse("cifjhdsfhsd-invalid-cuid");
611
+ expect(result).toMatchObject({ success: false });
612
+
613
+ expect(result.error!.issues[0].message).toEqual("Invalid cuid");
614
+ expect(result.error).toMatchInlineSnapshot(`
615
+ [ZodError: [
616
+ {
617
+ "origin": "string",
618
+ "code": "invalid_format",
619
+ "format": "cuid",
620
+ "pattern": "/^[cC][^\\\\s-]{8,}$/",
621
+ "path": [],
622
+ "message": "Invalid cuid"
623
+ }
624
+ ]]
625
+ `);
626
+ });
627
+
628
+ test("cuid2", () => {
629
+ const cuid2 = z.string().cuid2();
630
+ const validStrings = [
631
+ "a", // short string
632
+ "tz4a98xxat96iws9zmbrgj3a", // normal string
633
+ "kf5vz6ssxe4zjcb409rjgo747tc5qjazgptvotk6", // longer than require("@paralleldrive/cuid2").bigLength
634
+ ];
635
+ for (const s of validStrings) {
636
+ cuid2.parse(s);
637
+ }
638
+
639
+ const invalidStrings = [
640
+ "", // empty string
641
+ "tz4a98xxat96iws9zMbrgj3a", // include uppercase
642
+ "tz4a98xxat96iws-zmbrgj3a", // involve symbols
643
+ ];
644
+ const results = invalidStrings.map((s) => cuid2.safeParse(s));
645
+ expect(results.every((r) => !r.success)).toEqual(true);
646
+ if (!results[0].success) {
647
+ expect(results[0].error.issues[0].message).toEqual("Invalid cuid2");
648
+ }
649
+ });
650
+
651
+ test("ulid", () => {
652
+ const ulid = z.string().ulid();
653
+ ulid.parse("01ARZ3NDEKTSV4RRFFQ69G5FAV");
654
+ const result = ulid.safeParse("invalidulid");
655
+ expect(result).toMatchObject({ success: false });
656
+ const tooLong = "01ARZ3NDEKTSV4RRFFQ69G5FAVA";
657
+ expect(ulid.safeParse(tooLong)).toMatchObject({ success: false });
658
+
659
+ const caseInsensitive = ulid.safeParse("01arZ3nDeKTsV4RRffQ69G5FAV");
660
+ expect(caseInsensitive.success).toEqual(true);
661
+
662
+ expect(result.error!.issues[0].message).toEqual("Invalid ULID");
663
+ expect(result.error).toMatchInlineSnapshot(`
664
+ [ZodError: [
665
+ {
666
+ "origin": "string",
667
+ "code": "invalid_format",
668
+ "format": "ulid",
669
+ "pattern": "/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/",
670
+ "path": [],
671
+ "message": "Invalid ULID"
672
+ }
673
+ ]]
674
+ `);
675
+ });
676
+
677
+ test("xid", () => {
678
+ const xid = z.string().xid();
679
+ xid.parse("9m4e2mr0ui3e8a215n4g");
680
+ const result = xid.safeParse("invalidxid");
681
+ expect(result).toMatchObject({ success: false });
682
+
683
+ expect(result.error!.issues[0].message).toEqual("Invalid XID");
684
+ expect(result.error).toMatchInlineSnapshot(`
685
+ [ZodError: [
686
+ {
687
+ "origin": "string",
688
+ "code": "invalid_format",
689
+ "format": "xid",
690
+ "pattern": "/^[0-9a-vA-V]{20}$/",
691
+ "path": [],
692
+ "message": "Invalid XID"
693
+ }
694
+ ]]
695
+ `);
696
+ });
697
+
698
+ test("ksuid", () => {
699
+ const ksuid = z.string().ksuid();
700
+ ksuid.parse("0o0t9hkGxgFLtd3lmJ4TSTeY0Vb");
701
+ const result = ksuid.safeParse("invalidksuid");
702
+ expect(result).toMatchObject({ success: false });
703
+ const tooLong = "0o0t9hkGxgFLtd3lmJ4TSTeY0VbA";
704
+ expect(ksuid.safeParse(tooLong)).toMatchObject({ success: false });
705
+ expect(result.error!.issues).toMatchInlineSnapshot(`
706
+ [
707
+ {
708
+ "code": "invalid_format",
709
+ "format": "ksuid",
710
+ "message": "Invalid KSUID",
711
+ "origin": "string",
712
+ "path": [],
713
+ "pattern": "/^[A-Za-z0-9]{27}$/",
714
+ },
715
+ ]
716
+ `);
717
+ });
718
+
719
+ test("regex", () => {
720
+ z.string()
721
+ .regex(/^moo+$/)
722
+ .parse("mooooo");
723
+ expect(() => z.string().uuid().parse("purr")).toThrow();
724
+ });
725
+
726
+ test("regexp error message", () => {
727
+ const result = z
728
+ .string()
729
+ .regex(/^moo+$/)
730
+ .safeParse("boooo");
731
+ expect(result.error!.issues).toMatchInlineSnapshot(`
732
+ [
733
+ {
734
+ "code": "invalid_format",
735
+ "format": "regex",
736
+ "message": "Invalid string: must match pattern /^moo+$/",
737
+ "origin": "string",
738
+ "path": [],
739
+ "pattern": "/^moo+$/",
740
+ },
741
+ ]
742
+ `);
743
+
744
+ expect(() => z.string().uuid().parse("purr")).toThrow();
745
+ });
746
+
747
+ test("regexp error custom message", () => {
748
+ const result = z
749
+ .string()
750
+ .regex(/^moo+$/, { message: "Custom error message" })
751
+ .safeParse("boooo");
752
+ expect(result.error!.issues).toMatchInlineSnapshot(`
753
+ [
754
+ {
755
+ "code": "invalid_format",
756
+ "format": "regex",
757
+ "message": "Custom error message",
758
+ "origin": "string",
759
+ "path": [],
760
+ "pattern": "/^moo+$/",
761
+ },
762
+ ]
763
+ `);
764
+
765
+ expect(() => z.string().uuid().parse("purr")).toThrow();
766
+ });
767
+
768
+ test("regex lastIndex reset", () => {
769
+ const schema = z.string().regex(/^\d+$/g);
770
+ expect(schema.safeParse("123").success).toEqual(true);
771
+ expect(schema.safeParse("123").success).toEqual(true);
772
+ expect(schema.safeParse("123").success).toEqual(true);
773
+ expect(schema.safeParse("123").success).toEqual(true);
774
+ expect(schema.safeParse("123").success).toEqual(true);
775
+ });
776
+
777
+ test("format", () => {
778
+ expect(z.string().email().format).toEqual("email");
779
+ expect(z.string().url().format).toEqual("url");
780
+ expect(z.string().jwt().format).toEqual("jwt");
781
+ expect(z.string().emoji().format).toEqual("emoji");
782
+ expect(z.string().guid().format).toEqual("guid");
783
+ expect(z.string().uuid().format).toEqual("uuid");
784
+ expect(z.string().uuidv4().format).toEqual("uuid");
785
+ expect(z.string().uuidv6().format).toEqual("uuid");
786
+ expect(z.string().uuidv7().format).toEqual("uuid");
787
+ expect(z.string().nanoid().format).toEqual("nanoid");
788
+ expect(z.string().guid().format).toEqual("guid");
789
+ expect(z.string().cuid().format).toEqual("cuid");
790
+ expect(z.string().cuid2().format).toEqual("cuid2");
791
+ expect(z.string().ulid().format).toEqual("ulid");
792
+ expect(z.string().base64().format).toEqual("base64");
793
+ // expect(z.string().jsonString().format).toEqual("json_string");
794
+ // expect(z.string().json().format).toEqual("json_string");
795
+ expect(z.string().xid().format).toEqual("xid");
796
+ expect(z.string().ksuid().format).toEqual("ksuid");
797
+ // expect(z.string().ip().format).toEqual("ip");
798
+ expect(z.string().ipv4().format).toEqual("ipv4");
799
+ expect(z.string().ipv6().format).toEqual("ipv6");
800
+ expect(z.string().e164().format).toEqual("e164");
801
+ expect(z.string().datetime().format).toEqual("datetime");
802
+ expect(z.string().date().format).toEqual("date");
803
+ expect(z.string().time().format).toEqual("time");
804
+ expect(z.string().duration().format).toEqual("duration");
805
+
806
+ expect(z.mac().format).toEqual("mac");
807
+ });
808
+
809
+ test("min max getters", () => {
810
+ expect(z.string().min(5).minLength).toEqual(5);
811
+ expect(z.string().min(5).min(10).minLength).toEqual(10);
812
+ expect(z.string().minLength).toEqual(null);
813
+
814
+ expect(z.string().max(5).maxLength).toEqual(5);
815
+ expect(z.string().max(5).max(1).maxLength).toEqual(1);
816
+ expect(z.string().max(5).max(10).maxLength).toEqual(5);
817
+ expect(z.string().maxLength).toEqual(null);
818
+ });
819
+
820
+ test("boundary cases with zero length", () => {
821
+ // Test length(0) - only empty string should pass
822
+ const lengthZero = z.string().length(0);
823
+ expect(lengthZero.parse("")).toEqual("");
824
+ expect(() => lengthZero.parse("a")).toThrow();
825
+
826
+ // Test min(0) - all strings including empty should pass
827
+ const minZero = z.string().min(0);
828
+ expect(minZero.parse("")).toEqual("");
829
+ expect(minZero.parse("a")).toEqual("a");
830
+ expect(minZero.parse("hello")).toEqual("hello");
831
+
832
+ // Test max(0) - only empty string should pass
833
+ const maxZero = z.string().max(0);
834
+ expect(maxZero.parse("")).toEqual("");
835
+ expect(() => maxZero.parse("a")).toThrow();
836
+ expect(() => maxZero.parse("hello")).toThrow();
837
+ });
838
+
839
+ test("trim", () => {
840
+ expect(z.string().trim().min(2).parse(" 12 ")).toEqual("12");
841
+
842
+ // ordering of methods is respected
843
+ expect(z.string().min(2).trim().parse(" 1 ")).toEqual("1");
844
+ expect(() => z.string().trim().min(2).parse(" 1 ")).toThrow();
845
+ });
846
+
847
+ test("lowerCase", () => {
848
+ expect(z.string().toLowerCase().parse("ASDF")).toEqual("asdf");
849
+ expect(z.string().toUpperCase().parse("asdf")).toEqual("ASDF");
850
+ });
851
+
852
+ test("slugify", () => {
853
+ expect(z.string().slugify().parse("Hello World")).toEqual("hello-world");
854
+ expect(z.string().slugify().parse(" Hello World ")).toEqual("hello-world");
855
+ expect(z.string().slugify().parse("Hello@World#123")).toEqual("helloworld123");
856
+ expect(z.string().slugify().parse("Hello-World")).toEqual("hello-world");
857
+ expect(z.string().slugify().parse("Hello_World")).toEqual("hello-world");
858
+ expect(z.string().slugify().parse("---Hello---World---")).toEqual("hello-world");
859
+ expect(z.string().slugify().parse("Hello World")).toEqual("hello-world");
860
+ expect(z.string().slugify().parse("Hello!@#$%^&*()World")).toEqual("helloworld");
861
+
862
+ // can be used with check
863
+ expect(z.string().check(z.slugify()).parse("Hello World")).toEqual("hello-world");
864
+
865
+ // can be chained with other methods
866
+ expect(z.string().slugify().min(5).parse("Hello World")).toEqual("hello-world");
867
+ expect(() => z.string().slugify().min(20).parse("Hello World")).toThrow();
868
+ });
869
+
870
+ // test("IP validation", () => {
871
+ // const ipSchema = z.string().ip();
872
+
873
+ // // General IP validation (accepts both v4 and v6)
874
+ // expect(ipSchema.safeParse("114.71.82.94").success).toBe(true);
875
+ // expect(ipSchema.safeParse("0.0.0.0").success).toBe(true);
876
+ // expect(ipSchema.safeParse("37.85.236.115").success).toBe(true);
877
+ // expect(ipSchema.safeParse("1e5e:e6c8:daac:514b:114b:e360:d8c0:682c").success).toBe(true);
878
+ // expect(ipSchema.safeParse("9d4:c956:420f:5788:4339:9b3b:2418:75c3").success).toBe(true);
879
+ // expect(ipSchema.safeParse("a6ea::2454:a5ce:94.105.123.75").success).toBe(true);
880
+ // expect(ipSchema.safeParse("474f:4c83::4e40:a47:ff95:0cda").success).toBe(true);
881
+ // expect(ipSchema.safeParse("d329:0:25b4:db47:a9d1:0:4926:0000").success).toBe(true);
882
+ // expect(ipSchema.safeParse("e48:10fb:1499:3e28:e4b6:dea5:4692:912c").success).toBe(true);
883
+
884
+ // expect(ipSchema.safeParse("d329:1be4:25b4:db47:a9d1:dc71:4926:992c:14af").success).toBe(false);
885
+ // expect(ipSchema.safeParse("d5e7:7214:2b78::3906:85e6:53cc:709:32ba").success).toBe(false);
886
+ // expect(ipSchema.safeParse("8f69::c757:395e:976e::3441").success).toBe(false);
887
+ // expect(ipSchema.safeParse("54cb::473f:d516:0.255.256.22").success).toBe(false);
888
+ // expect(ipSchema.safeParse("54cb::473f:d516:192.168.1").success).toBe(false);
889
+ // expect(ipSchema.safeParse("256.0.4.4").success).toBe(false);
890
+ // expect(ipSchema.safeParse("-1.0.555.4").success).toBe(false);
891
+ // expect(ipSchema.safeParse("0.0.0.0.0").success).toBe(false);
892
+ // expect(ipSchema.safeParse("1.1.1").success).toBe(false);
893
+ // });
894
+
895
+ test("IPv4 validation", () => {
896
+ const ipv4 = z.string().ipv4();
897
+
898
+ // Valid IPv4 addresses
899
+ expect(ipv4.safeParse("114.71.82.94").success).toBe(true);
900
+ expect(ipv4.safeParse("0.0.0.0").success).toBe(true);
901
+ expect(ipv4.safeParse("37.85.236.115").success).toBe(true);
902
+ expect(ipv4.safeParse("192.168.0.1").success).toBe(true);
903
+ expect(ipv4.safeParse("255.255.255.255").success).toBe(true);
904
+ expect(ipv4.safeParse("1.2.3.4").success).toBe(true);
905
+
906
+ // Invalid IPv4 addresses
907
+ expect(ipv4.safeParse("256.0.4.4").success).toBe(false);
908
+ expect(ipv4.safeParse("-1.0.555.4").success).toBe(false);
909
+ expect(ipv4.safeParse("0.0.0.0.0").success).toBe(false);
910
+ expect(ipv4.safeParse("1.1.1").success).toBe(false);
911
+ expect(ipv4.safeParse("1e5e:e6c8:daac:514b:114b:e360:d8c0:682c").success).toBe(false);
912
+ expect(ipv4.safeParse("a6ea::2454:a5ce:94.105.123.75").success).toBe(false);
913
+ expect(ipv4.safeParse("not an ip").success).toBe(false);
914
+ expect(ipv4.safeParse("1.2.3").success).toBe(false);
915
+ expect(ipv4.safeParse("1.2.3.4.5").success).toBe(false);
916
+ expect(ipv4.safeParse("1.2.3.256").success).toBe(false);
917
+
918
+ // Test specific error
919
+ expect(() => ipv4.parse("6097:adfa:6f0b:220d:db08:5021:6191:7990")).toThrow();
920
+ });
921
+
922
+ test("IPv6 validation", () => {
923
+ const ipv6 = z.string().ipv6();
924
+
925
+ // Valid IPv6 addresses
926
+ expect(ipv6.safeParse("1e5e:e6c8:daac:514b:114b:e360:d8c0:682c").success).toBe(true);
927
+ expect(ipv6.safeParse("9d4:c956:420f:5788:4339:9b3b:2418:75c3").success).toBe(true);
928
+ expect(ipv6.safeParse("a6ea::2454:a5ce:94.105.123.75").success).toBe(true);
929
+ expect(ipv6.safeParse("474f:4c83::4e40:a47:ff95:0cda").success).toBe(true);
930
+ expect(ipv6.safeParse("d329:0:25b4:db47:a9d1:0:4926:0000").success).toBe(true);
931
+ expect(ipv6.safeParse("e48:10fb:1499:3e28:e4b6:dea5:4692:912c").success).toBe(true);
932
+ expect(ipv6.safeParse("::1").success).toBe(true);
933
+ expect(ipv6.safeParse("2001:db8::").success).toBe(true);
934
+ expect(ipv6.safeParse("2001:0db8:85a3:0000:0000:8a2e:0370:7334").success).toBe(true);
935
+ expect(ipv6.safeParse("2001:db8::192.168.0.1").success).toBe(true);
936
+ expect(ipv6.safeParse("::ffff:192.168.0.1").success).toBe(true);
937
+ expect(ipv6.safeParse("::ffff:c000:0280").success).toBe(true); // IPv4-mapped IPv6 address
938
+ expect(ipv6.safeParse("64:ff9b::192.168.0.1").success).toBe(true); // IPv4/IPv6 translation
939
+
940
+ // Invalid IPv6 addresses
941
+ expect(ipv6.safeParse("d329:1be4:25b4:db47:a9d1:dc71:4926:992c:14af").success).toBe(false);
942
+ expect(ipv6.safeParse("d5e7:7214:2b78::3906:85e6:53cc:709:32ba").success).toBe(false);
943
+ expect(ipv6.safeParse("8f69::c757:395e:976e::3441").success).toBe(false);
944
+ expect(ipv6.safeParse("54cb::473f:d516:0.255.256.22").success).toBe(false);
945
+ expect(ipv6.safeParse("54cb::473f:d516:192.168.1").success).toBe(false);
946
+ expect(ipv6.safeParse("114.71.82.94").success).toBe(false);
947
+ expect(ipv6.safeParse("not an ip").success).toBe(false);
948
+ expect(ipv6.safeParse("g123::1234:5678").success).toBe(false);
949
+
950
+ // Test specific error
951
+ expect(() => ipv6.parse("254.164.77.1")).toThrow();
952
+ });
953
+
954
+ test("MAC validation", () => {
955
+ const mac = z.mac();
956
+
957
+ // Valid MAC addresses
958
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
959
+ expect(mac.safeParse("FF:FF:FF:FF:FF:FF").success).toBe(true);
960
+ expect(mac.safeParse("00:11:22:33:44:55").success).toBe(true);
961
+ expect(mac.safeParse("A1:B2:C3:D4:E5:F6").success).toBe(true);
962
+ expect(mac.safeParse("10:20:30:40:50:60").success).toBe(true);
963
+ expect(mac.safeParse("0a:1b:2c:3d:4e:5f").success).toBe(true);
964
+ expect(mac.safeParse("12:34:56:78:9A:BC").success).toBe(true);
965
+
966
+ // Invalid MAC addresses
967
+ expect(mac.safeParse("00:1A-2B:3C-4D:5E").success).toBe(false);
968
+ expect(mac.safeParse("00:1A:2B:3C:4D").success).toBe(false);
969
+ expect(mac.safeParse("00:1A:2B:3C:4D").success).toBe(false);
970
+ expect(mac.safeParse("00-1A-2B-3C-4D").success).toBe(false);
971
+ expect(mac.safeParse("01-23-45-67-89-AB").success).toBe(false); // Dash delimiter not accepted by default
972
+ expect(mac.safeParse("AA-BB-CC-DD-EE-FF").success).toBe(false); // Dash delimiter not accepted by default
973
+ expect(mac.safeParse("DE-AD-BE-EF-00-01").success).toBe(false); // Dash delimiter not accepted by default
974
+ expect(mac.safeParse("98-76-54-32-10-FF").success).toBe(false); // Dash delimiter not accepted by default
975
+ expect(mac.safeParse("00:1A:2B:3C:4D:GZ").success).toBe(false);
976
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E:GG").success).toBe(false);
977
+ expect(mac.safeParse("123:45:67:89:AB:CD").success).toBe(false);
978
+ expect(mac.safeParse("00--1A:2B:3C:4D:5E").success).toBe(false);
979
+ expect(mac.safeParse("00:1A::2B:3C:4D:5E").success).toBe(false);
980
+ expect(mac.safeParse("00:1A:2B:3C:3C:2B:1A:00").success).toBe(false); // Disallow EUI-64
981
+ expect(mac.safeParse("00:1a:2B:3c:4D:5e").success).toBe(false); // Disallow mixed-case
982
+
983
+ // MAC formats that are nonstandard but occassionally referenced, ex. https://www.postgresql.org/docs/17/datatype-net-types.html#DATATYPE-MACADDR
984
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E:FF").success).toBe(false);
985
+ expect(mac.safeParse("001A2B:3C4D5E").success).toBe(false);
986
+ expect(mac.safeParse("001A:2B3C:4D5E").success).toBe(false);
987
+ expect(mac.safeParse("001A.2B3C.4D5E").success).toBe(false);
988
+ expect(mac.safeParse("001A2B3C4D5E").success).toBe(false);
989
+ expect(mac.safeParse("00.1A.2B.3C.4D.5E").success).toBe(false);
990
+ });
991
+
992
+ test("MAC validation with custom delimiter", () => {
993
+ const colonMac = z.mac({ delimiter: ":" });
994
+ expect(colonMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
995
+ expect(colonMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(false);
996
+
997
+ const dashMac = z.mac({ delimiter: "-" });
998
+ expect(dashMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(true);
999
+ expect(dashMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(false);
1000
+
1001
+ const colonOnlyMac = z.mac({ delimiter: ":" });
1002
+ expect(colonOnlyMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
1003
+ expect(colonOnlyMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(false);
1004
+ });
1005
+
1006
+ test("CIDR v4 validation", () => {
1007
+ const cidrV4 = z.string().cidrv4();
1008
+
1009
+ // Valid CIDR v4 addresses
1010
+ expect(cidrV4.safeParse("192.168.0.0/24").success).toBe(true);
1011
+ expect(cidrV4.safeParse("10.0.0.0/8").success).toBe(true);
1012
+ expect(cidrV4.safeParse("172.16.0.0/12").success).toBe(true);
1013
+ expect(cidrV4.safeParse("0.0.0.0/0").success).toBe(true);
1014
+ expect(cidrV4.safeParse("255.255.255.255/32").success).toBe(true);
1015
+
1016
+ // Invalid CIDR v4 addresses
1017
+ expect(cidrV4.safeParse("192.168.0.0").success).toBe(false); // Missing prefix
1018
+ expect(cidrV4.safeParse("192.168.0.0/33").success).toBe(false); // Invalid prefix length
1019
+ expect(cidrV4.safeParse("256.0.0.0/24").success).toBe(false); // Invalid IP
1020
+ expect(cidrV4.safeParse("192.168.0.0/-1").success).toBe(false); // Negative prefix length
1021
+ expect(cidrV4.safeParse("not a cidr").success).toBe(false); // Invalid format
1022
+ });
1023
+
1024
+ test("CIDR v6 validation", () => {
1025
+ const cidrV6 = z.string().cidrv6();
1026
+
1027
+ // Valid CIDR v6 addresses
1028
+ expect(cidrV6.safeParse("2001:db8::/32").success).toBe(true);
1029
+ expect(cidrV6.safeParse("::/0").success).toBe(true);
1030
+ expect(cidrV6.safeParse("fe80::/10").success).toBe(true);
1031
+ expect(cidrV6.safeParse("::1/128").success).toBe(true);
1032
+ expect(cidrV6.safeParse("2001:0db8:85a3::/64").success).toBe(true);
1033
+
1034
+ // Invalid CIDR v6 addresses
1035
+ expect(cidrV6.safeParse("2001:db8::").success).toBe(false); // Missing prefix
1036
+ expect(cidrV6.safeParse("2001:db8::/129").success).toBe(false); // Invalid prefix length
1037
+ expect(cidrV6.safeParse("2001:db8::/abc").success).toBe(false); // Invalid prefix format
1038
+ expect(cidrV6.safeParse("not a cidr").success).toBe(false); // Invalid format
1039
+ expect(cidrV6.safeParse("192.168.0.0/24").success).toBe(false); // IPv4 CIDR in v6 validation
1040
+ expect(cidrV6.safeParse("2001:0db8:85a3::/64/whatever-after").success).toBe(false);
1041
+ expect(cidrV6.safeParse("22d9:f4a8:6a90:f3bf:dcaa:2beb:5fba:0000/112").success).toBe(true);
1042
+ expect(cidrV6.safeParse("22d9:f4a8:6a90:f3bf:dcaa:2beb:5fba:0000/112/268").success).toBe(false);
1043
+ });
1044
+
1045
+ test("E.164 validation", () => {
1046
+ const e164Number = z.string().e164();
1047
+ expect(e164Number.safeParse("+1555555").success).toBe(true);
1048
+
1049
+ const validE164Numbers = [
1050
+ "+1555555", // min-length (7 digits + '+')
1051
+ "+15555555",
1052
+ "+155555555",
1053
+ "+1555555555",
1054
+ "+15555555555",
1055
+ "+155555555555",
1056
+ "+1555555555555",
1057
+ "+15555555555555",
1058
+ "+155555555555555",
1059
+ "+105555555555555",
1060
+ "+100555555555555", // max-length (15 digits + '+')
1061
+ ];
1062
+
1063
+ const invalidE164Numbers = [
1064
+ "", // empty
1065
+ "+", // only plus sign
1066
+ "-", // wrong sign
1067
+ " 555555555", // starts with space
1068
+ "555555555", // missing plus sign
1069
+ "+1 555 555 555", // space after plus sign
1070
+ "+1555 555 555", // space between numbers
1071
+ "+1555+555", // multiple plus signs
1072
+ "+0000000", // leading zero country code
1073
+ "+0123456789", // leading zero with more digits
1074
+ "+1555555555555555", // too long
1075
+ "+115abc55", // non numeric characters in number part
1076
+ "+1555555 ", // space after number
1077
+ ];
1078
+
1079
+ expect(validE164Numbers.every((number) => e164Number.safeParse(number).success)).toBe(true);
1080
+ expect(invalidE164Numbers.every((number) => e164Number.safeParse(number).success === false)).toBe(true);
1081
+ });
1082
+
1083
+ test("hostname", () => {
1084
+ const hostname = z.hostname();
1085
+
1086
+ // Valid hostnames
1087
+ hostname.parse("localhost");
1088
+ hostname.parse("example.com");
1089
+ hostname.parse("sub.example.com");
1090
+ hostname.parse("a-b-c.example.com");
1091
+ hostname.parse("123.example.com");
1092
+ hostname.parse("example-123.com");
1093
+ hostname.parse("example-123.1234");
1094
+ hostname.parse("developer.mozilla.org");
1095
+ hostname.parse("hello.world.example.com");
1096
+ hostname.parse("www.google.com");
1097
+ hostname.parse("192.168.1.1");
1098
+ hostname.parse("xn--d1acj3b.com");
1099
+ hostname.parse("xn--d1acj3b.org");
1100
+ hostname.parse("xn--d1acj3b");
1101
+
1102
+ // Invalid hostnames
1103
+ expect(() => hostname.parse("")).toThrow();
1104
+ expect(() => hostname.parse("example..com")).toThrow();
1105
+ expect(() => hostname.parse("example-.com")).toThrow();
1106
+ expect(() => hostname.parse("-example.com")).toThrow();
1107
+ expect(() => hostname.parse("example.com-")).toThrow();
1108
+ expect(() => hostname.parse("example_com")).toThrow();
1109
+ expect(() => hostname.parse("example.com:8080")).toThrow();
1110
+ expect(() => hostname.parse("http://example.com")).toThrow();
1111
+ expect(() => hostname.parse("ht!tp://invalid.com")).toThrow();
1112
+
1113
+ expect(() => hostname.parse("xn--d1acj3b..com")).toThrow();
1114
+ expect(() => hostname.parse("ex@mple.com")).toThrow();
1115
+ expect(() => hostname.parse("[2001:db8::zzzz]")).toThrow();
1116
+ expect(() => hostname.parse("exa mple.com")).toThrow();
1117
+ expect(() => hostname.parse("-example.com")).toThrow();
1118
+ expect(() => hostname.parse("example..com")).toThrow();
1119
+ });
1120
+
1121
+ test("hash validation", () => {
1122
+ // MD5 tests
1123
+ const md5hex = z.hash("md5");
1124
+ const md5base64 = z.hash("md5", { enc: "base64" });
1125
+ const md5base64url = z.hash("md5", { enc: "base64url" });
1126
+
1127
+ // Valid MD5 hashes
1128
+ expect(md5hex.parse("5d41402abc4b2a76b9719d911017c592")).toBe("5d41402abc4b2a76b9719d911017c592");
1129
+ expect(md5hex.parse("5D41402ABC4B2A76B9719D911017C592")).toBe("5D41402ABC4B2A76B9719D911017C592"); // uppercase
1130
+ expect(md5base64.parse("XUFAKrxLKna5cZ2REBfFkg==")).toBe("XUFAKrxLKna5cZ2REBfFkg==");
1131
+ expect(md5base64url.parse("XUFAKrxLKna5cZ2REBfFkg")).toBe("XUFAKrxLKna5cZ2REBfFkg");
1132
+
1133
+ // Invalid MD5 hashes
1134
+ expect(() => md5hex.parse("5d41402abc4b2a76b9719d911017c59")).toThrow(); // too short
1135
+ expect(() => md5hex.parse("5d41402abc4b2a76b9719d911017c592x")).toThrow(); // too long
1136
+ expect(() => md5base64.parse("XUFAKrxLKna5cZ2REBfFkg=")).toThrow(); // wrong padding
1137
+ expect(() => md5base64url.parse("XUFAKrxLKna5cZ2REBfFkg=")).toThrow(); // has padding
1138
+
1139
+ // SHA1 tests
1140
+ const sha1hex = z.hash("sha1");
1141
+ const sha1base64 = z.hash("sha1", { enc: "base64" });
1142
+ const sha1base64url = z.hash("sha1", { enc: "base64url" });
1143
+
1144
+ // Valid SHA1 hashes
1145
+ expect(sha1hex.parse("aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d")).toBe("aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d");
1146
+ expect(sha1base64.parse("qvTGHdzF6KLavt4PO0gs2a6pQ00=")).toBe("qvTGHdzF6KLavt4PO0gs2a6pQ00=");
1147
+ expect(sha1base64url.parse("qvTGHdzF6KLavt4PO0gs2a6pQ00")).toBe("qvTGHdzF6KLavt4PO0gs2a6pQ00");
1148
+
1149
+ // SHA256 tests
1150
+ const sha256hex = z.hash("sha256");
1151
+ const sha256base64 = z.hash("sha256", { enc: "base64" });
1152
+ const sha256base64url = z.hash("sha256", { enc: "base64url" });
1153
+
1154
+ // Valid SHA256 hashes
1155
+ expect(sha256hex.parse("2cf24dba4f21d4288094c4a2e2c2d6c6b0c3e0c8f0e0c8f0e0c8f0e0c8f0e0c8")).toBe(
1156
+ "2cf24dba4f21d4288094c4a2e2c2d6c6b0c3e0c8f0e0c8f0e0c8f0e0c8f0e0c8"
1157
+ );
1158
+ expect(sha256base64.parse("LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=")).toBe(
1159
+ "LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
1160
+ );
1161
+ expect(sha256base64url.parse("LPJNul-wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ")).toBe(
1162
+ "LPJNul-wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ"
1163
+ );
1164
+
1165
+ // SHA384 tests (no padding in base64)
1166
+ const sha384hex = z.hash("sha384");
1167
+ const sha384base64 = z.hash("sha384", { enc: "base64" });
1168
+
1169
+ expect(
1170
+ sha384hex.parse("59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f")
1171
+ ).toBe("59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f");
1172
+ expect(sha384base64.parse("WeF0h3dEjGneawDXozO7+5/xtGPkQ1TDVTvNucZm+pASWjx5+QOXvfX2oT3oKGhP")).toBe(
1173
+ "WeF0h3dEjGneawDXozO7+5/xtGPkQ1TDVTvNucZm+pASWjx5+QOXvfX2oT3oKGhP"
1174
+ );
1175
+
1176
+ // SHA512 tests
1177
+ const sha512hex = z.hash("sha512");
1178
+ const sha512base64 = z.hash("sha512", { enc: "base64" });
1179
+
1180
+ expect(
1181
+ sha512hex.parse(
1182
+ "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"
1183
+ )
1184
+ ).toBe(
1185
+ "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"
1186
+ );
1187
+ expect(
1188
+ sha512base64.parse("m3HSJL1i83hdltRq0+o9czGb+8KJDKra4t/3JRlnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==")
1189
+ ).toBe("m3HSJL1i83hdltRq0+o9czGb+8KJDKra4t/3JRlnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==");
1190
+
1191
+ // Test default encoding (hex)
1192
+ const defaultHash = z.hash("sha256");
1193
+ expect(defaultHash.parse("2cf24dba4f21d4288094c4a2e2c2d6c6b0c3e0c8f0e0c8f0e0c8f0e0c8f0e0c8")).toBe(
1194
+ "2cf24dba4f21d4288094c4a2e2c2d6c6b0c3e0c8f0e0c8f0e0c8f0e0c8f0e0c8"
1195
+ );
1196
+
1197
+ // Test with custom error message
1198
+ const hashWithMessage = z.hash("md5", { message: "Invalid MD5 hash" });
1199
+ expect(() => hashWithMessage.parse("invalid")).toThrow("Invalid MD5 hash");
1200
+ });