zod 4.5.3 → 4.6.0

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 (348) hide show
  1. package/compile.cjs +19 -0
  2. package/index.cjs +19 -0
  3. package/locales/index.cjs +19 -0
  4. package/mini/index.cjs +19 -0
  5. package/package.json +8 -7
  6. package/src/v3/helpers/errorUtil.ts +1 -1
  7. package/src/v4/classic/checks.ts +0 -1
  8. package/src/v4/classic/external.ts +2 -0
  9. package/src/v4/classic/from-json-schema.ts +248 -25
  10. package/src/v4/classic/schemas.ts +255 -164
  11. package/src/v4/classic/tests/assignability.test.ts +59 -9
  12. package/src/v4/classic/tests/bigint.test.ts +6 -0
  13. package/src/v4/classic/tests/continuability.test.ts +2 -2
  14. package/src/v4/classic/tests/cyclic-data.test.ts +316 -0
  15. package/src/v4/classic/tests/default.test.ts +46 -0
  16. package/src/v4/classic/tests/enum.test.ts +9 -0
  17. package/src/v4/classic/tests/error.test.ts +130 -1
  18. package/src/v4/classic/tests/firstparty.test.ts +4 -0
  19. package/src/v4/classic/tests/from-json-schema.test.ts +157 -0
  20. package/src/v4/classic/tests/iban.test.ts +81 -0
  21. package/src/v4/classic/tests/instance-footprint.test.ts +18 -2
  22. package/src/v4/classic/tests/instanceof.test.ts +27 -7
  23. package/src/v4/classic/tests/issue-schema.test.ts +88 -56
  24. package/src/v4/classic/tests/object.test.ts +56 -0
  25. package/src/v4/classic/tests/optin-ladder.test.ts +3 -2
  26. package/src/v4/classic/tests/properties.test.ts +225 -0
  27. package/src/v4/classic/tests/recursive-types.test.ts +1 -1
  28. package/src/v4/classic/tests/standard-schema.test.ts +19 -0
  29. package/src/v4/classic/tests/string.test.ts +25 -0
  30. package/src/v4/classic/tests/template-literal.test.ts +33 -1
  31. package/src/v4/classic/tests/to-json-schema.test.ts +147 -3
  32. package/src/v4/classic/tests/validate.test.ts +569 -0
  33. package/src/v4/core/api.ts +30 -6
  34. package/src/v4/core/checks.ts +1 -101
  35. package/src/v4/core/compile.ts +193 -81
  36. package/src/v4/core/doc.ts +6 -2
  37. package/src/v4/core/errors.ts +3 -6
  38. package/src/v4/core/json-schema-generator.ts +2 -2
  39. package/src/v4/core/json-schema-processors.ts +226 -68
  40. package/src/v4/core/memoizer.ts +162 -36
  41. package/src/v4/core/parse.ts +37 -16
  42. package/src/v4/core/regexes.ts +10 -4
  43. package/src/v4/core/schemas.ts +314 -83
  44. package/src/v4/core/tests/cached.test.ts +54 -0
  45. package/src/v4/core/tests/compile-generative.test.ts +445 -0
  46. package/src/v4/core/tests/compile.test.ts +222 -2
  47. package/src/v4/core/tests/email-regex.test.ts +140 -0
  48. package/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  49. package/src/v4/core/to-json-schema.ts +10 -8
  50. package/src/v4/core/util.ts +222 -147
  51. package/src/v4/core/versions.ts +2 -2
  52. package/src/v4/core/visit.ts +11 -0
  53. package/src/v4/locales/ar.ts +1 -0
  54. package/src/v4/locales/az.ts +1 -0
  55. package/src/v4/locales/be.ts +1 -0
  56. package/src/v4/locales/bg.ts +1 -0
  57. package/src/v4/locales/bn.ts +1 -0
  58. package/src/v4/locales/ca.ts +1 -0
  59. package/src/v4/locales/ckb.ts +1 -0
  60. package/src/v4/locales/cs.ts +1 -0
  61. package/src/v4/locales/da.ts +1 -0
  62. package/src/v4/locales/de.ts +1 -0
  63. package/src/v4/locales/el.ts +1 -0
  64. package/src/v4/locales/en.ts +1 -0
  65. package/src/v4/locales/eo.ts +1 -0
  66. package/src/v4/locales/es.ts +1 -0
  67. package/src/v4/locales/fa.ts +1 -0
  68. package/src/v4/locales/fi.ts +1 -0
  69. package/src/v4/locales/fr-CA.ts +1 -0
  70. package/src/v4/locales/fr.ts +1 -0
  71. package/src/v4/locales/gu.ts +1 -0
  72. package/src/v4/locales/he.ts +1 -0
  73. package/src/v4/locales/hi.ts +1 -0
  74. package/src/v4/locales/hr.ts +1 -0
  75. package/src/v4/locales/hu.ts +1 -0
  76. package/src/v4/locales/hy.ts +1 -0
  77. package/src/v4/locales/id.ts +1 -0
  78. package/src/v4/locales/is.ts +1 -0
  79. package/src/v4/locales/it.ts +1 -0
  80. package/src/v4/locales/ja.ts +1 -0
  81. package/src/v4/locales/ka.ts +1 -0
  82. package/src/v4/locales/km.ts +1 -0
  83. package/src/v4/locales/kn.ts +1 -0
  84. package/src/v4/locales/ko.ts +1 -0
  85. package/src/v4/locales/lt.ts +1 -0
  86. package/src/v4/locales/mk.ts +1 -0
  87. package/src/v4/locales/ms.ts +1 -0
  88. package/src/v4/locales/ne.ts +1 -0
  89. package/src/v4/locales/nl.ts +1 -0
  90. package/src/v4/locales/nn.ts +1 -0
  91. package/src/v4/locales/no.ts +1 -0
  92. package/src/v4/locales/ota.ts +1 -0
  93. package/src/v4/locales/pl.ts +1 -0
  94. package/src/v4/locales/ps.ts +1 -0
  95. package/src/v4/locales/pt-BR.ts +1 -0
  96. package/src/v4/locales/pt.ts +1 -0
  97. package/src/v4/locales/ro.ts +1 -0
  98. package/src/v4/locales/ru.ts +1 -0
  99. package/src/v4/locales/sk.ts +1 -0
  100. package/src/v4/locales/sl.ts +1 -0
  101. package/src/v4/locales/sv.ts +1 -0
  102. package/src/v4/locales/ta.ts +1 -0
  103. package/src/v4/locales/th.ts +1 -0
  104. package/src/v4/locales/tk.ts +1 -0
  105. package/src/v4/locales/tr.ts +1 -0
  106. package/src/v4/locales/uk.ts +1 -0
  107. package/src/v4/locales/ur.ts +1 -0
  108. package/src/v4/locales/uz.ts +1 -0
  109. package/src/v4/locales/vi.ts +1 -0
  110. package/src/v4/locales/yo.ts +1 -0
  111. package/src/v4/locales/zh-CN.ts +1 -0
  112. package/src/v4/locales/zh-TW.ts +1 -0
  113. package/src/v4/mini/checks.ts +0 -1
  114. package/src/v4/mini/external.ts +2 -0
  115. package/src/v4/mini/schemas.ts +38 -2
  116. package/src/v4/mini/tests/checks.test.ts +1 -1
  117. package/src/v4/mini/tests/computed.test.ts +11 -17
  118. package/src/v4/mini/tests/index.test.ts +8 -0
  119. package/src/v4/mini/tests/string.test.ts +16 -0
  120. package/v3/ZodError.cjs +19 -0
  121. package/v3/errors.cjs +19 -0
  122. package/v3/external.cjs +19 -0
  123. package/v3/helpers/enumUtil.cjs +19 -0
  124. package/v3/helpers/errorUtil.cjs +20 -1
  125. package/v3/helpers/errorUtil.js +1 -1
  126. package/v3/helpers/parseUtil.cjs +19 -0
  127. package/v3/helpers/partialUtil.cjs +19 -0
  128. package/v3/helpers/typeAliases.cjs +19 -0
  129. package/v3/helpers/util.cjs +19 -0
  130. package/v3/index.cjs +19 -0
  131. package/v3/standard-schema.cjs +19 -0
  132. package/v3/types.cjs +19 -0
  133. package/v4/classic/checks.cjs +20 -2
  134. package/v4/classic/checks.d.cts +1 -1
  135. package/v4/classic/checks.d.ts +1 -1
  136. package/v4/classic/checks.js +1 -1
  137. package/v4/classic/coerce.cjs +19 -0
  138. package/v4/classic/compat.cjs +19 -0
  139. package/v4/classic/deep-partial.cjs +19 -0
  140. package/v4/classic/errors.cjs +19 -0
  141. package/v4/classic/external.cjs +22 -1
  142. package/v4/classic/external.d.cts +1 -1
  143. package/v4/classic/external.d.ts +1 -1
  144. package/v4/classic/external.js +1 -1
  145. package/v4/classic/from-json-schema.cjs +264 -24
  146. package/v4/classic/from-json-schema.js +245 -24
  147. package/v4/classic/in-out.cjs +19 -0
  148. package/v4/classic/index.cjs +19 -0
  149. package/v4/classic/iso.cjs +19 -0
  150. package/v4/classic/parse.cjs +19 -0
  151. package/v4/classic/schemas.cjs +100 -31
  152. package/v4/classic/schemas.d.cts +17 -1
  153. package/v4/classic/schemas.d.ts +17 -1
  154. package/v4/classic/schemas.js +77 -29
  155. package/v4/core/api.cjs +37 -2
  156. package/v4/core/api.d.cts +6 -4
  157. package/v4/core/api.d.ts +6 -4
  158. package/v4/core/api.js +17 -2
  159. package/v4/core/checks.cjs +19 -96
  160. package/v4/core/checks.d.cts +1 -1
  161. package/v4/core/checks.d.ts +1 -1
  162. package/v4/core/checks.js +0 -96
  163. package/v4/core/compile.cjs +164 -65
  164. package/v4/core/compile.d.cts +18 -4
  165. package/v4/core/compile.d.ts +18 -4
  166. package/v4/core/compile.js +145 -66
  167. package/v4/core/core.cjs +19 -0
  168. package/v4/core/doc.cjs +26 -2
  169. package/v4/core/doc.js +7 -2
  170. package/v4/core/errors.cjs +21 -5
  171. package/v4/core/errors.js +2 -5
  172. package/v4/core/index.cjs +19 -0
  173. package/v4/core/json-schema-generator.cjs +20 -1
  174. package/v4/core/json-schema-generator.js +2 -2
  175. package/v4/core/json-schema-processors.cjs +215 -63
  176. package/v4/core/json-schema-processors.d.cts +17 -0
  177. package/v4/core/json-schema-processors.d.ts +17 -0
  178. package/v4/core/json-schema-processors.js +195 -64
  179. package/v4/core/json-schema.cjs +19 -0
  180. package/v4/core/memoizer.cjs +204 -36
  181. package/v4/core/memoizer.js +162 -36
  182. package/v4/core/parse.cjs +56 -16
  183. package/v4/core/parse.js +37 -16
  184. package/v4/core/regexes.cjs +29 -6
  185. package/v4/core/regexes.d.cts +2 -0
  186. package/v4/core/regexes.d.ts +2 -0
  187. package/v4/core/regexes.js +8 -4
  188. package/v4/core/registries.cjs +19 -0
  189. package/v4/core/schemas.cjs +285 -66
  190. package/v4/core/schemas.d.cts +34 -3
  191. package/v4/core/schemas.d.ts +34 -3
  192. package/v4/core/schemas.js +264 -65
  193. package/v4/core/standard-schema.cjs +19 -0
  194. package/v4/core/to-json-schema.cjs +29 -7
  195. package/v4/core/to-json-schema.d.cts +7 -3
  196. package/v4/core/to-json-schema.d.ts +7 -3
  197. package/v4/core/to-json-schema.js +8 -7
  198. package/v4/core/util.cjs +181 -143
  199. package/v4/core/util.d.cts +25 -4
  200. package/v4/core/util.d.ts +25 -4
  201. package/v4/core/util.js +160 -143
  202. package/v4/core/versions.cjs +21 -2
  203. package/v4/core/versions.d.cts +1 -1
  204. package/v4/core/versions.d.ts +1 -1
  205. package/v4/core/versions.js +2 -2
  206. package/v4/core/visit.cjs +31 -0
  207. package/v4/core/visit.js +12 -0
  208. package/v4/index.cjs +19 -0
  209. package/v4/locales/ar.cjs +1 -0
  210. package/v4/locales/ar.js +1 -0
  211. package/v4/locales/az.cjs +1 -0
  212. package/v4/locales/az.js +1 -0
  213. package/v4/locales/be.cjs +1 -0
  214. package/v4/locales/be.js +1 -0
  215. package/v4/locales/bg.cjs +1 -0
  216. package/v4/locales/bg.js +1 -0
  217. package/v4/locales/bn.cjs +1 -0
  218. package/v4/locales/bn.js +1 -0
  219. package/v4/locales/ca.cjs +1 -0
  220. package/v4/locales/ca.js +1 -0
  221. package/v4/locales/ckb.cjs +1 -0
  222. package/v4/locales/ckb.js +1 -0
  223. package/v4/locales/cs.cjs +1 -0
  224. package/v4/locales/cs.js +1 -0
  225. package/v4/locales/da.cjs +1 -0
  226. package/v4/locales/da.js +1 -0
  227. package/v4/locales/de.cjs +1 -0
  228. package/v4/locales/de.js +1 -0
  229. package/v4/locales/el.cjs +1 -0
  230. package/v4/locales/el.js +1 -0
  231. package/v4/locales/en.cjs +1 -0
  232. package/v4/locales/en.js +1 -0
  233. package/v4/locales/eo.cjs +1 -0
  234. package/v4/locales/eo.js +1 -0
  235. package/v4/locales/es.cjs +1 -0
  236. package/v4/locales/es.js +1 -0
  237. package/v4/locales/fa.cjs +1 -0
  238. package/v4/locales/fa.js +1 -0
  239. package/v4/locales/fi.cjs +1 -0
  240. package/v4/locales/fi.js +1 -0
  241. package/v4/locales/fr-CA.cjs +1 -0
  242. package/v4/locales/fr-CA.js +1 -0
  243. package/v4/locales/fr.cjs +1 -0
  244. package/v4/locales/fr.js +1 -0
  245. package/v4/locales/gu.cjs +1 -0
  246. package/v4/locales/gu.js +1 -0
  247. package/v4/locales/he.cjs +1 -0
  248. package/v4/locales/he.js +1 -0
  249. package/v4/locales/hi.cjs +1 -0
  250. package/v4/locales/hi.js +1 -0
  251. package/v4/locales/hr.cjs +1 -0
  252. package/v4/locales/hr.js +1 -0
  253. package/v4/locales/hu.cjs +1 -0
  254. package/v4/locales/hu.js +1 -0
  255. package/v4/locales/hy.cjs +1 -0
  256. package/v4/locales/hy.js +1 -0
  257. package/v4/locales/id.cjs +1 -0
  258. package/v4/locales/id.js +1 -0
  259. package/v4/locales/index.cjs +19 -0
  260. package/v4/locales/is.cjs +1 -0
  261. package/v4/locales/is.js +1 -0
  262. package/v4/locales/it.cjs +1 -0
  263. package/v4/locales/it.js +1 -0
  264. package/v4/locales/ja.cjs +1 -0
  265. package/v4/locales/ja.js +1 -0
  266. package/v4/locales/ka.cjs +1 -0
  267. package/v4/locales/ka.js +1 -0
  268. package/v4/locales/km.cjs +1 -0
  269. package/v4/locales/km.js +1 -0
  270. package/v4/locales/kn.cjs +1 -0
  271. package/v4/locales/kn.js +1 -0
  272. package/v4/locales/ko.cjs +1 -0
  273. package/v4/locales/ko.js +1 -0
  274. package/v4/locales/lt.cjs +1 -0
  275. package/v4/locales/lt.js +1 -0
  276. package/v4/locales/mk.cjs +1 -0
  277. package/v4/locales/mk.js +1 -0
  278. package/v4/locales/ms.cjs +1 -0
  279. package/v4/locales/ms.js +1 -0
  280. package/v4/locales/ne.cjs +1 -0
  281. package/v4/locales/ne.js +1 -0
  282. package/v4/locales/nl.cjs +1 -0
  283. package/v4/locales/nl.js +1 -0
  284. package/v4/locales/nn.cjs +1 -0
  285. package/v4/locales/nn.js +1 -0
  286. package/v4/locales/no.cjs +1 -0
  287. package/v4/locales/no.js +1 -0
  288. package/v4/locales/ota.cjs +1 -0
  289. package/v4/locales/ota.js +1 -0
  290. package/v4/locales/pl.cjs +1 -0
  291. package/v4/locales/pl.js +1 -0
  292. package/v4/locales/ps.cjs +1 -0
  293. package/v4/locales/ps.js +1 -0
  294. package/v4/locales/pt-BR.cjs +1 -0
  295. package/v4/locales/pt-BR.js +1 -0
  296. package/v4/locales/pt.cjs +1 -0
  297. package/v4/locales/pt.js +1 -0
  298. package/v4/locales/ro.cjs +1 -0
  299. package/v4/locales/ro.js +1 -0
  300. package/v4/locales/ru.cjs +1 -0
  301. package/v4/locales/ru.js +1 -0
  302. package/v4/locales/sk.cjs +1 -0
  303. package/v4/locales/sk.js +1 -0
  304. package/v4/locales/sl.cjs +1 -0
  305. package/v4/locales/sl.js +1 -0
  306. package/v4/locales/sv.cjs +1 -0
  307. package/v4/locales/sv.js +1 -0
  308. package/v4/locales/ta.cjs +1 -0
  309. package/v4/locales/ta.js +1 -0
  310. package/v4/locales/th.cjs +1 -0
  311. package/v4/locales/th.js +1 -0
  312. package/v4/locales/tk.cjs +1 -0
  313. package/v4/locales/tk.js +1 -0
  314. package/v4/locales/tr.cjs +1 -0
  315. package/v4/locales/tr.js +1 -0
  316. package/v4/locales/uk.cjs +1 -0
  317. package/v4/locales/uk.js +1 -0
  318. package/v4/locales/ur.cjs +1 -0
  319. package/v4/locales/ur.js +1 -0
  320. package/v4/locales/uz.cjs +1 -0
  321. package/v4/locales/uz.js +1 -0
  322. package/v4/locales/vi.cjs +1 -0
  323. package/v4/locales/vi.js +1 -0
  324. package/v4/locales/yo.cjs +1 -0
  325. package/v4/locales/yo.js +1 -0
  326. package/v4/locales/zh-CN.cjs +1 -0
  327. package/v4/locales/zh-CN.js +1 -0
  328. package/v4/locales/zh-TW.cjs +1 -0
  329. package/v4/locales/zh-TW.js +1 -0
  330. package/v4/mini/checks.cjs +20 -2
  331. package/v4/mini/checks.d.cts +1 -1
  332. package/v4/mini/checks.d.ts +1 -1
  333. package/v4/mini/checks.js +1 -1
  334. package/v4/mini/coerce.cjs +19 -0
  335. package/v4/mini/deep-partial.cjs +19 -0
  336. package/v4/mini/external.cjs +22 -1
  337. package/v4/mini/external.d.cts +1 -1
  338. package/v4/mini/external.d.ts +1 -1
  339. package/v4/mini/external.js +1 -1
  340. package/v4/mini/in-out.cjs +19 -0
  341. package/v4/mini/index.cjs +19 -0
  342. package/v4/mini/iso.cjs +19 -0
  343. package/v4/mini/parse.cjs +19 -0
  344. package/v4/mini/schemas.cjs +42 -4
  345. package/v4/mini/schemas.d.cts +8 -0
  346. package/v4/mini/schemas.d.ts +8 -0
  347. package/v4/mini/schemas.js +19 -2
  348. package/v4-mini/index.cjs +19 -0
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "chaîne JSON",
47
47
  e164: "numéro E.164",
48
48
  credit_card: "numéro de carte de crédit",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "entrée",
51
52
  };
@@ -45,6 +45,7 @@ const error: () => errors.$ZodErrorMap = () => {
45
45
  json_string: "chaîne de caractères JSON",
46
46
  e164: "numéro au format E.164",
47
47
  credit_card: "numéro de carte de crédit",
48
+ iban: "IBAN",
48
49
  jwt: "JWT",
49
50
  template_literal: "entrée",
50
51
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON સ્ટ્રિંગ",
47
47
  e164: "E.164 નંબર",
48
48
  credit_card: "ક્રેડિટ કાર્ડ નંબર",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "ઇનપુટ",
51
52
  };
@@ -88,6 +88,7 @@ const error: () => errors.$ZodErrorMap = () => {
88
88
  json_string: { label: "מחרוזת JSON", gender: "f" },
89
89
  e164: { label: "מספר E.164", gender: "m" },
90
90
  credit_card: { label: "מספר כרטיס אשראי", gender: "m" },
91
+ iban: { label: "IBAN", gender: "m" },
91
92
  jwt: { label: "JWT", gender: "m" },
92
93
  template_literal: { label: "קלט", gender: "m" },
93
94
  ends_with: { label: "קלט", gender: "m" },
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON स्ट्रिंग",
47
47
  e164: "E.164 संख्या",
48
48
  credit_card: "क्रेडिट कार्ड संख्या",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "इनपुट",
51
52
  };
@@ -45,6 +45,7 @@ const error: () => errors.$ZodErrorMap = () => {
45
45
  json_string: "JSON tekst",
46
46
  e164: "E.164 broj",
47
47
  credit_card: "broj kreditne kartice",
48
+ iban: "IBAN",
48
49
  jwt: "JWT",
49
50
  template_literal: "unos",
50
51
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON string",
47
47
  e164: "E.164 szám",
48
48
  credit_card: "hitelkártyaszám",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "bemenet",
51
52
  };
@@ -95,6 +95,7 @@ const error: () => errors.$ZodErrorMap = () => {
95
95
  json_string: "JSON տող",
96
96
  e164: "E.164 համար",
97
97
  credit_card: "կրեդիտ քարտի համար",
98
+ iban: "IBAN",
98
99
  jwt: "JWT",
99
100
  template_literal: "մուտք",
100
101
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "string JSON",
47
47
  e164: "angka E.164",
48
48
  credit_card: "nomor kartu kredit",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON strengur",
47
47
  e164: "E.164 tölugildi",
48
48
  credit_card: "kreditkortanúmer",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "gildi",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "stringa JSON",
47
47
  e164: "numero E.164",
48
48
  credit_card: "numero di carta di credito",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON文字列",
47
47
  e164: "E.164番号",
48
48
  credit_card: "クレジットカード番号",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "入力値",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON ველი",
47
47
  e164: "E.164 ნომერი",
48
48
  credit_card: "საკრედიტო ბარათის ნომერი",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "შეყვანა",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ខ្សែអក្សរ JSON",
47
47
  e164: "លេខ E.164",
48
48
  credit_card: "លេខប័ណ្ណឥណទាន",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "ទិន្នន័យបញ្ចូល",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSONಸ್ಟ್ರಿಂಗ್",
47
47
  e164: "E.164 ಸಂಖ್ಯೆ",
48
48
  credit_card: "ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "ಇನ್ಪುಟ್",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON 문자열",
47
47
  e164: "E.164 번호",
48
48
  credit_card: "신용카드 번호",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "입력",
51
52
  };
@@ -146,6 +146,7 @@ const error: () => errors.$ZodErrorMap = () => {
146
146
  json_string: "JSON eilutė",
147
147
  e164: "E.164 numeris",
148
148
  credit_card: "kredito kortelės numeris",
149
+ iban: "IBAN",
149
150
  jwt: "JWT",
150
151
  template_literal: "įvestis",
151
152
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON низа",
47
47
  e164: "E.164 број",
48
48
  credit_card: "број на кредитна картичка",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "внес",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "string JSON",
47
47
  e164: "nombor E.164",
48
48
  credit_card: "nombor kad kredit",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON स्ट्रिङ",
47
47
  e164: "E.164 नम्बर",
48
48
  credit_card: "क्रेडिट कार्ड नम्बर",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "इनपुट",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON string",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "creditcardnummer",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "invoer",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-streng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kredittkortnummer",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-streng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kredittkortnummer",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON metin",
47
47
  e164: "E.164 sayısı",
48
48
  credit_card: "i'tibâr kartı numarası",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "giren",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ciąg znaków w formacie JSON",
47
47
  e164: "liczba E.164",
48
48
  credit_card: "numer karty kredytowej",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "wejście",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON متن",
47
47
  e164: "د E.164 شمېره",
48
48
  credit_card: "د کریډیټ کارت شمیره",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "ورودي",
51
52
  };
@@ -47,6 +47,7 @@ const error: () => errors.$ZodErrorMap = () => {
47
47
  json_string: "o texto JSON",
48
48
  e164: "o número E.164",
49
49
  credit_card: "o número de cartão de crédito",
50
+ iban: "o IBAN",
50
51
  jwt: "o JWT",
51
52
  template_literal: "a entrada",
52
53
  };
@@ -47,6 +47,7 @@ const error: () => errors.$ZodErrorMap = () => {
47
47
  json_string: "o texto JSON",
48
48
  e164: "o número E.164",
49
49
  credit_card: "o número de cartão de crédito",
50
+ iban: "o IBAN",
50
51
  jwt: "o JWT",
51
52
  template_literal: "a entrada",
52
53
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "șir JSON",
47
47
  e164: "număr E.164",
48
48
  credit_card: "număr de card de credit",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "intrare",
51
52
  };
@@ -109,6 +109,7 @@ const error: () => errors.$ZodErrorMap = () => {
109
109
  json_string: "JSON строка",
110
110
  e164: "номер E.164",
111
111
  credit_card: "номер кредитной карты",
112
+ iban: "IBAN",
112
113
  jwt: "JWT",
113
114
  template_literal: "ввод",
114
115
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "reťazec vo formáte JSON",
47
47
  e164: "číslo E.164",
48
48
  credit_card: "číslo kreditnej karty",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "vstup",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON niz",
47
47
  e164: "E.164 številka",
48
48
  credit_card: "številka kreditne kartice",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "vnos",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-sträng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kreditkortsnummer",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "mall-literal",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON சரம்",
47
47
  e164: "E.164 எண்",
48
48
  credit_card: "கடன் அட்டை எண்",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "input",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ข้อความแบบ JSON",
47
47
  e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",
48
48
  credit_card: "หมายเลขบัตรเครดิต",
49
+ iban: "IBAN",
49
50
  jwt: "โทเคน JWT",
50
51
  template_literal: "ข้อมูลที่ป้อน",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON setiri",
47
47
  e164: "E.164 nomeri",
48
48
  credit_card: "kredit kartynyň nomeri",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "şablon",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON dizesi",
47
47
  e164: "E.164 sayısı",
48
48
  credit_card: "kredi kartı numarası",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "Şablon dizesi",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "рядок JSON",
47
47
  e164: "номер E.164",
48
48
  credit_card: "номер кредитної картки",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "вхідні дані",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "جے ایس او این سٹرنگ",
47
47
  e164: "ای 164 نمبر",
48
48
  credit_card: "کریڈٹ کارڈ نمبر",
49
+ iban: "IBAN",
49
50
  jwt: "جے ڈبلیو ٹی",
50
51
  template_literal: "ان پٹ",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON satr",
47
47
  e164: "E.164 raqam",
48
48
  credit_card: "kredit karta raqami",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "kirish",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "chuỗi JSON",
47
47
  e164: "số E.164",
48
48
  credit_card: "số thẻ tín dụng",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "đầu vào",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ọ̀rọ̀ JSON",
47
47
  e164: "nọ́mbà E.164",
48
48
  credit_card: "nọmba kaadi gbese",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "ẹ̀rọ ìbáwọlé",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON字符串",
47
47
  e164: "E.164号码",
48
48
  credit_card: "信用卡号",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "输入",
51
52
  };
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON 字串",
47
47
  e164: "E.164 數值",
48
48
  credit_card: "信用卡號",
49
+ iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "輸入",
51
52
  };
@@ -23,7 +23,6 @@ export {
23
23
  _startsWith as startsWith,
24
24
  _endsWith as endsWith,
25
25
  _property as property,
26
- _properties as properties,
27
26
  _mime as mime,
28
27
  _overwrite as overwrite,
29
28
  _normalize as normalize,
@@ -25,8 +25,10 @@ export {
25
25
  TimePrecision,
26
26
  util,
27
27
  NEVER,
28
+ INVALID,
28
29
  toZod,
29
30
  compile,
31
+ withParser,
30
32
  ZodCompileAsyncError,
31
33
  ZodCompileUnsupportedError,
32
34
  getDiscriminatedOption,
@@ -509,6 +509,21 @@ export function creditCard(params?: string | core.$ZodCreditCardParams): ZodMini
509
509
  return core._creditCard(ZodMiniCreditCard, params);
510
510
  }
511
511
 
512
+ // ZodMiniIBAN
513
+ export interface ZodMiniIBAN extends _ZodMiniString<core.$ZodIBANInternals> {}
514
+ export const ZodMiniIBAN: core.$constructor<ZodMiniIBAN> = /*@__PURE__*/ core.$constructor(
515
+ "ZodMiniIBAN",
516
+ (inst, def) => {
517
+ core.$ZodIBAN.init(inst, def);
518
+ ZodMiniStringFormat.init(inst, def);
519
+ }
520
+ );
521
+
522
+ // @__NO_SIDE_EFFECTS__
523
+ export function iban(params?: string | core.$ZodIBANParams): ZodMiniIBAN {
524
+ return core._iban(ZodMiniIBAN, params);
525
+ }
526
+
512
527
  // ZodMiniJWT
513
528
  export interface ZodMiniJWT extends _ZodMiniString<core.$ZodJWTInternals> {
514
529
  // _zod: core.$ZodJWTInternals;
@@ -1094,7 +1109,8 @@ export function catchall<T extends ZodMiniObject, U extends SomeType>(
1094
1109
  inst: T,
1095
1110
  catchall: U
1096
1111
  ): ZodMiniObject<T["shape"], core.$catchall<U>> {
1097
- return inst.clone({ ...inst._zod.def, catchall: catchall as any }) as any;
1112
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
1113
+ return inst.clone(util.mergeDefs(inst._zod.def, { catchall: catchall as any })) as any;
1098
1114
  }
1099
1115
 
1100
1116
  // ZodMiniUnion
@@ -1362,7 +1378,8 @@ export const ZodMiniEnum: core.$constructor<ZodMiniEnum> = /*@__PURE__*/ core.$c
1362
1378
  core.$ZodEnum.init(inst, def);
1363
1379
  ZodMiniType.init(inst, def);
1364
1380
 
1365
- inst.options = Object.values(def.entries);
1381
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
1382
+ inst.options = [...inst._zod.values] as util.EnumValue[];
1366
1383
  }
1367
1384
  );
1368
1385
 
@@ -1849,6 +1866,25 @@ export const ZodMiniCustom: core.$constructor<ZodMiniCustom> = /*@__PURE__*/ cor
1849
1866
  }
1850
1867
  );
1851
1868
 
1869
+ // ZodMiniProperties
1870
+ export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape>
1871
+ extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>,
1872
+ core.$ZodProperties<Shape> {}
1873
+ export const ZodMiniProperties: core.$constructor<ZodMiniProperties> = /*@__PURE__*/ core.$constructor(
1874
+ "ZodMiniProperties",
1875
+ (inst, def) => {
1876
+ core.$ZodProperties.init(inst, def);
1877
+ ZodMiniType.init(inst, def);
1878
+ }
1879
+ );
1880
+
1881
+ export function properties<Shape extends core.$ZodShape>(
1882
+ shape: Shape,
1883
+ params?: string | core.$ZodPropertiesParams
1884
+ ): ZodMiniProperties<Shape> {
1885
+ return core._properties(ZodMiniProperties, shape, params) as any;
1886
+ }
1887
+
1852
1888
  // custom checks
1853
1889
  // @__NO_SIDE_EFFECTS__
1854
1890
  export function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O> {
@@ -141,7 +141,7 @@ test("z.overwrite", () => {
141
141
  // property
142
142
 
143
143
  test("z.properties", () => {
144
- const a = z.instanceof(URL).check(...z.properties({ protocol: z.literal("https:" as string), hostname: z.string() }));
144
+ const a = z.instanceof(URL).check(...z.properties({ protocol: z.literal("https:"), hostname: z.string() }));
145
145
  expect(z.safeParse(a, new URL("https://example.com")).success).toEqual(true);
146
146
  expect(z.safeParse(a, new URL("http://example.com")).error!.issues.map((i) => i.path)).toEqual([["protocol"]]);
147
147
  });
@@ -2,35 +2,29 @@ import { expect, test } from "vitest";
2
2
  import * as z from "zod/mini";
3
3
  import { util as zc } from "zod/v4/core";
4
4
 
5
+ // checks no longer write metadata into the bag at attach time; the converter folds the checks itself, so the derived values are asserted through it
6
+
5
7
  test("min/max", () => {
6
8
  const a = z.number().check(z.minimum(5), z.minimum(6), z.minimum(7), z.maximum(10), z.maximum(11), z.maximum(12));
7
-
8
- expect(a._zod.bag.minimum).toEqual(7);
9
- expect(a._zod.bag.maximum).toEqual(10);
9
+ expect(z.toJSONSchema(a)).toMatchObject({ minimum: 7, maximum: 10 });
10
+ expect(a._zod.bag).toEqual({});
10
11
  });
11
12
 
12
13
  test("multipleOf", () => {
13
14
  const b = z.number().check(z.multipleOf(5));
14
- expect(b._zod.bag.multipleOf).toEqual(5);
15
- });
16
-
17
- test("int64 format", () => {
18
- const c = z.int64();
19
- expect(c._zod.bag.format).toEqual("int64");
20
- expect(c._zod.bag.minimum).toEqual(zc.BIGINT_FORMAT_RANGES.int64[0]);
21
- expect(c._zod.bag.maximum).toEqual(zc.BIGINT_FORMAT_RANGES.int64[1]);
15
+ expect(z.toJSONSchema(b)).toMatchObject({ multipleOf: 5 });
22
16
  });
23
17
 
24
18
  test("int32 format", () => {
25
19
  const d = z.int32();
26
- expect(d._zod.bag.format).toEqual("int32");
27
- expect(d._zod.bag.minimum).toEqual(zc.NUMBER_FORMAT_RANGES.int32[0]);
28
- expect(d._zod.bag.maximum).toEqual(zc.NUMBER_FORMAT_RANGES.int32[1]);
20
+ expect(z.toJSONSchema(d)).toMatchObject({
21
+ type: "integer",
22
+ minimum: zc.NUMBER_FORMAT_RANGES.int32[0],
23
+ maximum: zc.NUMBER_FORMAT_RANGES.int32[1],
24
+ });
29
25
  });
30
26
 
31
27
  test("array size", () => {
32
28
  const e = z.array(z.string()).check(z.length(5));
33
- expect(e._zod.bag.length).toEqual(5);
34
- expect(e._zod.bag.minimum).toEqual(5);
35
- expect(e._zod.bag.maximum).toEqual(5);
29
+ expect(z.toJSONSchema(e)).toMatchObject({ minItems: 5, maxItems: 5 });
36
30
  });
@@ -491,6 +491,14 @@ test("z.enum - native", () => {
491
491
  // expect(a.enum.A).toEqual(NativeEnum.A);
492
492
  // expect(a.enum.B).toEqual(NativeEnum.B);
493
493
  // expect(a.enum.C).toEqual(NativeEnum.C);
494
+
495
+ enum NumericEnum {
496
+ A = 0,
497
+ B = 1,
498
+ }
499
+
500
+ // numeric enums carry reverse-mapping keys; options lists only what parse accepts
501
+ expect(z.enum(NumericEnum).options).toEqual([NumericEnum.A, NumericEnum.B]);
494
502
  });
495
503
 
496
504
  test("z.nativeEnum", () => {
@@ -338,6 +338,22 @@ test("z.creditCard", () => {
338
338
  expect(() => z.parse(a, 123)).toThrow();
339
339
  });
340
340
 
341
+ test("z.iban", () => {
342
+ const a = z.iban();
343
+ // valid iban
344
+ expect(z.parse(a, "DE89370400440532013000")).toEqual("DE89370400440532013000");
345
+ expect(z.parse(a, "NO9386011117947")).toEqual("NO9386011117947");
346
+ // failed mod 97 checksum
347
+ expect(() => z.parse(a, "DE89370400440532013001")).toThrow();
348
+ // formatting violations
349
+ expect(() => z.parse(a, "de89370400440532013000")).toThrow();
350
+ expect(() => z.parse(a, "DE89 3704 0044 0532 0130 00")).toThrow();
351
+ expect(() => z.parse(a, "NO938601111794")).toThrow();
352
+ expect(() => z.parse(a, "hello")).toThrow();
353
+ // wrong type
354
+ expect(() => z.parse(a, 123)).toThrow();
355
+ });
356
+
341
357
  test("z.jwt", () => {
342
358
  const a = z.jwt();
343
359
  // valid jwt
package/v3/ZodError.cjs CHANGED
@@ -146,3 +146,22 @@ ZodError.create = (issues) => {
146
146
  const error = new ZodError(issues);
147
147
  return error;
148
148
  };
149
+
150
+ // seal-cjs-exports
151
+ (function () {
152
+ var keys = Object.getOwnPropertyNames(exports);
153
+ for (var i = 0; i < keys.length; i++) {
154
+ var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
155
+ if (!desc || !desc.get || !desc.configurable) continue;
156
+ var value;
157
+ try {
158
+ value = desc.get();
159
+ } catch (e) {
160
+ continue;
161
+ }
162
+ // a circular require may not have settled this one yet, so leave it live
163
+ if (value === undefined) continue;
164
+ Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
165
+ }
166
+ Object.freeze(exports);
167
+ })();
package/v3/errors.cjs CHANGED
@@ -15,3 +15,22 @@ function setErrorMap(map) {
15
15
  function getErrorMap() {
16
16
  return overrideErrorMap;
17
17
  }
18
+
19
+ // seal-cjs-exports
20
+ (function () {
21
+ var keys = Object.getOwnPropertyNames(exports);
22
+ for (var i = 0; i < keys.length; i++) {
23
+ var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
24
+ if (!desc || !desc.get || !desc.configurable) continue;
25
+ var value;
26
+ try {
27
+ value = desc.get();
28
+ } catch (e) {
29
+ continue;
30
+ }
31
+ // a circular require may not have settled this one yet, so leave it live
32
+ if (value === undefined) continue;
33
+ Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
34
+ }
35
+ Object.freeze(exports);
36
+ })();