zod 3.26.0-canary.20250619T152955 → 3.26.0-canary.20250702T074442

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 (402) hide show
  1. package/README.md +2 -2
  2. package/{dist/cjs/v3/index.js → index.cjs} +2 -2
  3. package/index.d.cts +4 -0
  4. package/index.d.ts +4 -0
  5. package/index.js +4 -0
  6. package/package.json +63 -80
  7. package/{dist/cjs/v3/ZodError.js → v3/ZodError.cjs} +4 -3
  8. package/v3/ZodError.d.cts +164 -0
  9. package/{dist/esm/v3 → v3}/ZodError.js +3 -2
  10. package/{dist/cjs/v3/errors.js → v3/errors.cjs} +1 -1
  11. package/v3/errors.d.cts +5 -0
  12. package/{dist/cjs/v3/external.js → v3/external.cjs} +6 -6
  13. package/v3/external.d.cts +6 -0
  14. package/v3/helpers/enumUtil.d.ts +8 -0
  15. package/v3/helpers/errorUtil.d.ts +9 -0
  16. package/{dist/cjs/v3/helpers/parseUtil.js → v3/helpers/parseUtil.cjs} +2 -2
  17. package/v3/helpers/parseUtil.d.cts +78 -0
  18. package/v3/helpers/partialUtil.d.cts +8 -0
  19. package/v3/helpers/typeAliases.d.ts +2 -0
  20. package/v3/helpers/util.d.ts +85 -0
  21. package/{dist/cjs/v4/classic/index.js → v3/index.cjs} +2 -2
  22. package/v3/index.d.cts +4 -0
  23. package/v3/index.d.ts +3 -2
  24. package/v3/index.js +4 -1
  25. package/{dist/cjs/v3/locales/en.js → v3/locales/en.cjs} +2 -2
  26. package/v3/locales/en.d.cts +3 -0
  27. package/v3/standard-schema.d.ts +102 -0
  28. package/{dist/cjs/v3/types.js → v3/types.cjs} +7 -5
  29. package/v3/types.d.cts +1031 -0
  30. package/{dist/esm/v3 → v3}/types.js +2 -0
  31. package/{dist/cjs/v4/classic/checks.js → v4/classic/checks.cjs} +29 -29
  32. package/v4/classic/checks.d.cts +1 -0
  33. package/{dist/types/v4 → v4}/classic/checks.d.ts +1 -1
  34. package/{dist/esm/v4 → v4}/classic/checks.js +1 -1
  35. package/{dist/cjs/v4/classic/coerce.js → v4/classic/coerce.cjs} +2 -2
  36. package/v4/classic/coerce.d.cts +17 -0
  37. package/{dist/types/v4 → v4}/classic/coerce.d.ts +1 -1
  38. package/{dist/esm/v4 → v4}/classic/coerce.js +1 -1
  39. package/{dist/cjs/v4/classic/compat.js → v4/classic/compat.cjs} +4 -4
  40. package/v4/classic/compat.d.cts +48 -0
  41. package/{dist/types/v4 → v4}/classic/compat.d.ts +3 -3
  42. package/{dist/esm/v4 → v4}/classic/compat.js +2 -2
  43. package/{dist/cjs/v4/classic/errors.js → v4/classic/errors.cjs} +3 -3
  44. package/v4/classic/errors.d.cts +30 -0
  45. package/{dist/types/v4 → v4}/classic/errors.d.ts +3 -3
  46. package/{dist/esm/v4 → v4}/classic/errors.js +2 -2
  47. package/{dist/cjs/v4/classic/external.js → v4/classic/external.cjs} +29 -29
  48. package/v4/classic/external.d.cts +13 -0
  49. package/{dist/types/v4 → v4}/classic/external.d.ts +3 -3
  50. package/{dist/esm/v4 → v4}/classic/external.js +4 -4
  51. package/v4/classic/index.cjs +33 -0
  52. package/v4/classic/index.d.cts +4 -0
  53. package/{dist/cjs/v4/classic/iso.js → v4/classic/iso.cjs} +2 -2
  54. package/v4/classic/iso.d.cts +22 -0
  55. package/{dist/types/v4 → v4}/classic/iso.d.ts +1 -1
  56. package/{dist/esm/v4 → v4}/classic/iso.js +1 -1
  57. package/{dist/cjs/v4/classic/parse.js → v4/classic/parse.cjs} +2 -2
  58. package/v4/classic/parse.d.cts +23 -0
  59. package/{dist/types/v4 → v4}/classic/parse.d.ts +1 -1
  60. package/{dist/esm/v4 → v4}/classic/parse.js +1 -1
  61. package/{dist/cjs/v4/classic/schemas.js → v4/classic/schemas.cjs} +38 -38
  62. package/v4/classic/schemas.d.cts +629 -0
  63. package/{dist/types/v4 → v4}/classic/schemas.d.ts +2 -2
  64. package/{dist/esm/v4 → v4}/classic/schemas.js +2 -2
  65. package/{dist/cjs/v4/core/api.js → v4/core/api.cjs} +3 -3
  66. package/v4/core/api.d.cts +284 -0
  67. package/{dist/cjs/v4/core/checks.js → v4/core/checks.cjs} +3 -3
  68. package/v4/core/checks.d.cts +277 -0
  69. package/v4/core/core.d.cts +47 -0
  70. package/v4/core/doc.d.ts +14 -0
  71. package/{dist/cjs/v4/core/errors.js → v4/core/errors.cjs} +2 -2
  72. package/v4/core/errors.d.cts +204 -0
  73. package/{dist/cjs/v4/core/function.js → v4/core/function.cjs} +4 -4
  74. package/v4/core/function.d.cts +52 -0
  75. package/{dist/cjs/v4/core/index.js → v4/core/index.cjs} +15 -15
  76. package/v4/core/index.d.cts +15 -0
  77. package/v4/core/index.d.ts +15 -1
  78. package/v4/core/index.js +15 -1
  79. package/v4/core/json-schema.d.ts +87 -0
  80. package/{dist/cjs/v4/core/parse.js → v4/core/parse.cjs} +3 -3
  81. package/v4/core/parse.d.cts +25 -0
  82. package/v4/core/regexes.d.ts +62 -0
  83. package/v4/core/registries.d.cts +34 -0
  84. package/{dist/cjs/v4/core/schemas.js → v4/core/schemas.cjs} +10 -10
  85. package/v4/core/schemas.d.cts +1015 -0
  86. package/{dist/esm/v4 → v4}/core/schemas.js +2 -2
  87. package/v4/core/standard-schema.d.ts +55 -0
  88. package/{dist/cjs/v4/core/to-json-schema.js → v4/core/to-json-schema.cjs} +2 -2
  89. package/v4/core/to-json-schema.d.cts +84 -0
  90. package/{dist/cjs/v4/core/util.js → v4/core/util.cjs} +1 -4
  91. package/v4/core/util.d.cts +183 -0
  92. package/{dist/esm/v4 → v4}/core/util.js +1 -4
  93. package/v4/core/versions.d.ts +5 -0
  94. package/{dist/cjs/index.js → v4/index.cjs} +2 -2
  95. package/v4/index.d.cts +3 -0
  96. package/v4/index.d.ts +3 -3
  97. package/v4/index.js +3 -1
  98. package/{dist/cjs/v4/locales/ar.js → v4/locales/ar.cjs} +1 -1
  99. package/v4/locales/ar.d.cts +4 -0
  100. package/{dist/cjs/v4/locales/az.js → v4/locales/az.cjs} +1 -1
  101. package/v4/locales/az.d.cts +4 -0
  102. package/{dist/cjs/v4/locales/be.js → v4/locales/be.cjs} +1 -1
  103. package/v4/locales/be.d.cts +4 -0
  104. package/{dist/cjs/v4/locales/ca.js → v4/locales/ca.cjs} +1 -1
  105. package/v4/locales/ca.d.cts +4 -0
  106. package/{dist/cjs/v4/locales/cs.js → v4/locales/cs.cjs} +1 -1
  107. package/v4/locales/cs.d.cts +4 -0
  108. package/{dist/cjs/v4/locales/de.js → v4/locales/de.cjs} +1 -1
  109. package/v4/locales/de.d.cts +4 -0
  110. package/{dist/cjs/v4/locales/en.js → v4/locales/en.cjs} +1 -1
  111. package/{dist/types/v4/locales/en.d.ts → v4/locales/en.d.cts} +1 -1
  112. package/v4/locales/en.d.ts +5 -2
  113. package/v4/locales/en.js +117 -2
  114. package/{dist/cjs/v4/locales/es.js → v4/locales/es.cjs} +1 -1
  115. package/v4/locales/es.d.cts +4 -0
  116. package/{dist/cjs/v4/locales/fa.js → v4/locales/fa.cjs} +1 -1
  117. package/v4/locales/fa.d.cts +4 -0
  118. package/{dist/cjs/v4/locales/fi.js → v4/locales/fi.cjs} +1 -1
  119. package/v4/locales/fi.d.cts +4 -0
  120. package/{dist/cjs/v4/locales/fr-CA.js → v4/locales/fr-CA.cjs} +1 -1
  121. package/v4/locales/fr-CA.d.cts +4 -0
  122. package/{dist/cjs/v4/locales/fr.js → v4/locales/fr.cjs} +1 -1
  123. package/v4/locales/fr.d.cts +4 -0
  124. package/{dist/cjs/v4/locales/he.js → v4/locales/he.cjs} +1 -1
  125. package/v4/locales/he.d.cts +4 -0
  126. package/{dist/cjs/v4/locales/hu.js → v4/locales/hu.cjs} +1 -1
  127. package/v4/locales/hu.d.cts +4 -0
  128. package/{dist/cjs/v4/locales/id.js → v4/locales/id.cjs} +1 -1
  129. package/v4/locales/id.d.cts +4 -0
  130. package/{dist/cjs/v4/locales/index.js → v4/locales/index.cjs} +38 -38
  131. package/v4/locales/index.d.cts +38 -0
  132. package/v4/locales/index.d.ts +38 -1
  133. package/v4/locales/index.js +38 -1
  134. package/{dist/cjs/v4/locales/it.js → v4/locales/it.cjs} +1 -1
  135. package/v4/locales/it.d.cts +4 -0
  136. package/{dist/cjs/v4/locales/ja.js → v4/locales/ja.cjs} +1 -1
  137. package/v4/locales/ja.d.cts +4 -0
  138. package/{dist/cjs/v4/locales/kh.js → v4/locales/kh.cjs} +1 -1
  139. package/v4/locales/kh.d.cts +4 -0
  140. package/{dist/cjs/v4/locales/ko.js → v4/locales/ko.cjs} +1 -1
  141. package/v4/locales/ko.d.cts +4 -0
  142. package/{dist/cjs/v4/locales/mk.js → v4/locales/mk.cjs} +1 -1
  143. package/v4/locales/mk.d.cts +4 -0
  144. package/{dist/cjs/v4/locales/ms.js → v4/locales/ms.cjs} +1 -1
  145. package/v4/locales/ms.d.cts +4 -0
  146. package/{dist/cjs/v4/locales/nl.js → v4/locales/nl.cjs} +1 -1
  147. package/v4/locales/nl.d.cts +4 -0
  148. package/{dist/cjs/v4/locales/no.js → v4/locales/no.cjs} +1 -1
  149. package/v4/locales/no.d.cts +4 -0
  150. package/{dist/cjs/v4/locales/ota.js → v4/locales/ota.cjs} +1 -1
  151. package/v4/locales/ota.d.cts +4 -0
  152. package/{dist/cjs/v4/locales/pl.js → v4/locales/pl.cjs} +1 -1
  153. package/v4/locales/pl.d.cts +4 -0
  154. package/{dist/cjs/v4/locales/ps.js → v4/locales/ps.cjs} +1 -1
  155. package/v4/locales/ps.d.cts +4 -0
  156. package/{dist/cjs/v4/locales/pt.js → v4/locales/pt.cjs} +1 -1
  157. package/v4/locales/pt.d.cts +4 -0
  158. package/{dist/cjs/v4/locales/ru.js → v4/locales/ru.cjs} +1 -1
  159. package/v4/locales/ru.d.cts +4 -0
  160. package/{dist/cjs/v4/locales/sl.js → v4/locales/sl.cjs} +1 -1
  161. package/v4/locales/sl.d.cts +4 -0
  162. package/{dist/cjs/v4/locales/sv.js → v4/locales/sv.cjs} +1 -1
  163. package/v4/locales/sv.d.cts +4 -0
  164. package/{dist/cjs/v4/locales/ta.js → v4/locales/ta.cjs} +1 -1
  165. package/v4/locales/ta.d.cts +4 -0
  166. package/{dist/cjs/v4/locales/th.js → v4/locales/th.cjs} +1 -1
  167. package/v4/locales/th.d.cts +4 -0
  168. package/{dist/cjs/v4/locales/tr.js → v4/locales/tr.cjs} +1 -1
  169. package/v4/locales/tr.d.cts +5 -0
  170. package/{dist/cjs/v4/locales/ua.js → v4/locales/ua.cjs} +1 -1
  171. package/v4/locales/ua.d.cts +4 -0
  172. package/{dist/cjs/v4/locales/ur.js → v4/locales/ur.cjs} +1 -1
  173. package/v4/locales/ur.d.cts +4 -0
  174. package/{dist/cjs/v4/locales/vi.js → v4/locales/vi.cjs} +1 -1
  175. package/v4/locales/vi.d.cts +4 -0
  176. package/{dist/cjs/v4/locales/zh-CN.js → v4/locales/zh-CN.cjs} +1 -1
  177. package/v4/locales/zh-CN.d.cts +4 -0
  178. package/{dist/cjs/v4/locales/zh-TW.js → v4/locales/zh-TW.cjs} +1 -1
  179. package/v4/locales/zh-TW.d.cts +4 -0
  180. package/{dist/cjs/v4/mini/checks.js → v4/mini/checks.cjs} +31 -31
  181. package/v4/mini/checks.d.cts +1 -0
  182. package/{dist/types/v4 → v4}/mini/checks.d.ts +1 -1
  183. package/{dist/esm/v4 → v4}/mini/checks.js +1 -1
  184. package/{dist/cjs/v4/mini/coerce.js → v4/mini/coerce.cjs} +2 -2
  185. package/v4/mini/coerce.d.cts +7 -0
  186. package/{dist/types/v4 → v4}/mini/coerce.d.ts +1 -1
  187. package/{dist/esm/v4 → v4}/mini/coerce.js +1 -1
  188. package/{dist/cjs/v4/mini/external.js → v4/mini/external.cjs} +24 -24
  189. package/v4/mini/external.d.cts +11 -0
  190. package/{dist/types/v4 → v4}/mini/external.d.ts +3 -3
  191. package/{dist/esm/v4 → v4}/mini/external.js +2 -2
  192. package/{dist/cjs/v4/mini/index.js → v4/mini/index.cjs} +2 -2
  193. package/v4/mini/index.d.cts +3 -0
  194. package/{dist/cjs/v4/mini/iso.js → v4/mini/iso.cjs} +2 -2
  195. package/v4/mini/iso.d.cts +22 -0
  196. package/{dist/types/v4 → v4}/mini/iso.d.ts +1 -1
  197. package/{dist/esm/v4 → v4}/mini/iso.js +1 -1
  198. package/{dist/cjs/v4/mini/parse.js → v4/mini/parse.cjs} +5 -5
  199. package/v4/mini/parse.d.cts +1 -0
  200. package/v4/mini/parse.d.ts +1 -0
  201. package/v4/mini/parse.js +1 -0
  202. package/{dist/cjs/v4/mini/schemas.js → v4/mini/schemas.cjs} +30 -30
  203. package/v4/mini/schemas.d.cts +356 -0
  204. package/{dist/types/v4 → v4}/mini/schemas.d.ts +2 -2
  205. package/{dist/esm/v4 → v4}/mini/schemas.js +2 -2
  206. package/{dist/cjs/v4/index.js → v4-mini/index.cjs} +1 -6
  207. package/v4-mini/index.d.cts +1 -0
  208. package/v4-mini/index.d.ts +1 -1
  209. package/v4-mini/index.js +1 -1
  210. package/dist/cjs/package.json +0 -3
  211. package/dist/cjs/v3/benchmarks/datetime.js +0 -54
  212. package/dist/cjs/v3/benchmarks/discriminatedUnion.js +0 -79
  213. package/dist/cjs/v3/benchmarks/index.js +0 -59
  214. package/dist/cjs/v3/benchmarks/ipv4.js +0 -54
  215. package/dist/cjs/v3/benchmarks/object.js +0 -70
  216. package/dist/cjs/v3/benchmarks/primitives.js +0 -159
  217. package/dist/cjs/v3/benchmarks/realworld.js +0 -56
  218. package/dist/cjs/v3/benchmarks/string.js +0 -55
  219. package/dist/cjs/v3/benchmarks/union.js +0 -79
  220. package/dist/cjs/v3/tests/Mocker.js +0 -57
  221. package/dist/cjs/v4/core/config.js +0 -10
  222. package/dist/cjs/v4/core/zsf.js +0 -172
  223. package/dist/esm/index.js +0 -3
  224. package/dist/esm/package.json +0 -3
  225. package/dist/esm/v3/benchmarks/datetime.js +0 -49
  226. package/dist/esm/v3/benchmarks/discriminatedUnion.js +0 -74
  227. package/dist/esm/v3/benchmarks/index.js +0 -54
  228. package/dist/esm/v3/benchmarks/ipv4.js +0 -49
  229. package/dist/esm/v3/benchmarks/object.js +0 -65
  230. package/dist/esm/v3/benchmarks/primitives.js +0 -154
  231. package/dist/esm/v3/benchmarks/realworld.js +0 -51
  232. package/dist/esm/v3/benchmarks/string.js +0 -50
  233. package/dist/esm/v3/benchmarks/union.js +0 -74
  234. package/dist/esm/v3/index.js +0 -4
  235. package/dist/esm/v3/tests/Mocker.js +0 -53
  236. package/dist/esm/v4/core/config.js +0 -6
  237. package/dist/esm/v4/core/index.js +0 -15
  238. package/dist/esm/v4/core/zsf.js +0 -171
  239. package/dist/esm/v4/index.js +0 -3
  240. package/dist/esm/v4/locales/en.js +0 -117
  241. package/dist/esm/v4/locales/index.js +0 -38
  242. package/dist/esm/v4/mini/parse.js +0 -1
  243. package/dist/types/index.d.ts +0 -3
  244. package/dist/types/package.json +0 -3
  245. package/dist/types/v3/benchmarks/datetime.d.ts +0 -5
  246. package/dist/types/v3/benchmarks/discriminatedUnion.d.ts +0 -5
  247. package/dist/types/v3/benchmarks/index.d.ts +0 -1
  248. package/dist/types/v3/benchmarks/ipv4.d.ts +0 -5
  249. package/dist/types/v3/benchmarks/object.d.ts +0 -5
  250. package/dist/types/v3/benchmarks/primitives.d.ts +0 -5
  251. package/dist/types/v3/benchmarks/realworld.d.ts +0 -5
  252. package/dist/types/v3/benchmarks/string.d.ts +0 -5
  253. package/dist/types/v3/benchmarks/union.d.ts +0 -5
  254. package/dist/types/v3/index.d.ts +0 -4
  255. package/dist/types/v3/tests/Mocker.d.ts +0 -17
  256. package/dist/types/v4/core/config.d.ts +0 -9
  257. package/dist/types/v4/core/index.d.ts +0 -15
  258. package/dist/types/v4/core/zsf.d.ts +0 -91
  259. package/dist/types/v4/index.d.ts +0 -3
  260. package/dist/types/v4/locales/index.d.ts +0 -38
  261. package/dist/types/v4/mini/parse.d.ts +0 -1
  262. /package/{dist/types/v3 → v3}/ZodError.d.ts +0 -0
  263. /package/{dist/types/v3 → v3}/errors.d.ts +0 -0
  264. /package/{dist/esm/v3 → v3}/errors.js +0 -0
  265. /package/{dist/types/v3 → v3}/external.d.ts +0 -0
  266. /package/{dist/esm/v3 → v3}/external.js +0 -0
  267. /package/{dist/cjs/v3/helpers/enumUtil.js → v3/helpers/enumUtil.cjs} +0 -0
  268. /package/{dist/types/v3/helpers/enumUtil.d.ts → v3/helpers/enumUtil.d.cts} +0 -0
  269. /package/{dist/esm/v3 → v3}/helpers/enumUtil.js +0 -0
  270. /package/{dist/cjs/v3/helpers/errorUtil.js → v3/helpers/errorUtil.cjs} +0 -0
  271. /package/{dist/types/v3/helpers/errorUtil.d.ts → v3/helpers/errorUtil.d.cts} +0 -0
  272. /package/{dist/esm/v3 → v3}/helpers/errorUtil.js +0 -0
  273. /package/{dist/types/v3 → v3}/helpers/parseUtil.d.ts +0 -0
  274. /package/{dist/esm/v3 → v3}/helpers/parseUtil.js +0 -0
  275. /package/{dist/cjs/v3/helpers/partialUtil.js → v3/helpers/partialUtil.cjs} +0 -0
  276. /package/{dist/types/v3 → v3}/helpers/partialUtil.d.ts +0 -0
  277. /package/{dist/esm/v3 → v3}/helpers/partialUtil.js +0 -0
  278. /package/{dist/cjs/v3/helpers/typeAliases.js → v3/helpers/typeAliases.cjs} +0 -0
  279. /package/{dist/types/v3/helpers/typeAliases.d.ts → v3/helpers/typeAliases.d.cts} +0 -0
  280. /package/{dist/esm/v3 → v3}/helpers/typeAliases.js +0 -0
  281. /package/{dist/cjs/v3/helpers/util.js → v3/helpers/util.cjs} +0 -0
  282. /package/{dist/types/v3/helpers/util.d.ts → v3/helpers/util.d.cts} +0 -0
  283. /package/{dist/esm/v3 → v3}/helpers/util.js +0 -0
  284. /package/{dist/types/v3 → v3}/locales/en.d.ts +0 -0
  285. /package/{dist/esm/v3 → v3}/locales/en.js +0 -0
  286. /package/{dist/cjs/v3/standard-schema.js → v3/standard-schema.cjs} +0 -0
  287. /package/{dist/types/v3/standard-schema.d.ts → v3/standard-schema.d.cts} +0 -0
  288. /package/{dist/esm/v3 → v3}/standard-schema.js +0 -0
  289. /package/{dist/types/v3 → v3}/types.d.ts +0 -0
  290. /package/{dist/types/v4 → v4}/classic/index.d.ts +0 -0
  291. /package/{dist/esm/v4 → v4}/classic/index.js +0 -0
  292. /package/{dist/types/v4 → v4}/core/api.d.ts +0 -0
  293. /package/{dist/esm/v4 → v4}/core/api.js +0 -0
  294. /package/{dist/types/v4 → v4}/core/checks.d.ts +0 -0
  295. /package/{dist/esm/v4 → v4}/core/checks.js +0 -0
  296. /package/{dist/cjs/v4/core/core.js → v4/core/core.cjs} +0 -0
  297. /package/{dist/types/v4 → v4}/core/core.d.ts +0 -0
  298. /package/{dist/esm/v4 → v4}/core/core.js +0 -0
  299. /package/{dist/cjs/v4/core/doc.js → v4/core/doc.cjs} +0 -0
  300. /package/{dist/types/v4/core/doc.d.ts → v4/core/doc.d.cts} +0 -0
  301. /package/{dist/esm/v4 → v4}/core/doc.js +0 -0
  302. /package/{dist/types/v4 → v4}/core/errors.d.ts +0 -0
  303. /package/{dist/esm/v4 → v4}/core/errors.js +0 -0
  304. /package/{dist/types/v4 → v4}/core/function.d.ts +0 -0
  305. /package/{dist/esm/v4 → v4}/core/function.js +0 -0
  306. /package/{dist/cjs/v4/core/json-schema.js → v4/core/json-schema.cjs} +0 -0
  307. /package/{dist/types/v4/core/json-schema.d.ts → v4/core/json-schema.d.cts} +0 -0
  308. /package/{dist/esm/v4 → v4}/core/json-schema.js +0 -0
  309. /package/{dist/types/v4 → v4}/core/parse.d.ts +0 -0
  310. /package/{dist/esm/v4 → v4}/core/parse.js +0 -0
  311. /package/{dist/cjs/v4/core/regexes.js → v4/core/regexes.cjs} +0 -0
  312. /package/{dist/types/v4/core/regexes.d.ts → v4/core/regexes.d.cts} +0 -0
  313. /package/{dist/esm/v4 → v4}/core/regexes.js +0 -0
  314. /package/{dist/cjs/v4/core/registries.js → v4/core/registries.cjs} +0 -0
  315. /package/{dist/types/v4 → v4}/core/registries.d.ts +0 -0
  316. /package/{dist/esm/v4 → v4}/core/registries.js +0 -0
  317. /package/{dist/types/v4 → v4}/core/schemas.d.ts +0 -0
  318. /package/{dist/cjs/v4/core/standard-schema.js → v4/core/standard-schema.cjs} +0 -0
  319. /package/{dist/types/v4/core/standard-schema.d.ts → v4/core/standard-schema.d.cts} +0 -0
  320. /package/{dist/esm/v4 → v4}/core/standard-schema.js +0 -0
  321. /package/{dist/types/v4 → v4}/core/to-json-schema.d.ts +0 -0
  322. /package/{dist/esm/v4 → v4}/core/to-json-schema.js +0 -0
  323. /package/{dist/types/v4 → v4}/core/util.d.ts +0 -0
  324. /package/{dist/cjs/v4/core/versions.js → v4/core/versions.cjs} +0 -0
  325. /package/{dist/types/v4/core/versions.d.ts → v4/core/versions.d.cts} +0 -0
  326. /package/{dist/esm/v4 → v4}/core/versions.js +0 -0
  327. /package/{dist/types/v4 → v4}/locales/ar.d.ts +0 -0
  328. /package/{dist/esm/v4 → v4}/locales/ar.js +0 -0
  329. /package/{dist/types/v4 → v4}/locales/az.d.ts +0 -0
  330. /package/{dist/esm/v4 → v4}/locales/az.js +0 -0
  331. /package/{dist/types/v4 → v4}/locales/be.d.ts +0 -0
  332. /package/{dist/esm/v4 → v4}/locales/be.js +0 -0
  333. /package/{dist/types/v4 → v4}/locales/ca.d.ts +0 -0
  334. /package/{dist/esm/v4 → v4}/locales/ca.js +0 -0
  335. /package/{dist/types/v4 → v4}/locales/cs.d.ts +0 -0
  336. /package/{dist/esm/v4 → v4}/locales/cs.js +0 -0
  337. /package/{dist/types/v4 → v4}/locales/de.d.ts +0 -0
  338. /package/{dist/esm/v4 → v4}/locales/de.js +0 -0
  339. /package/{dist/types/v4 → v4}/locales/es.d.ts +0 -0
  340. /package/{dist/esm/v4 → v4}/locales/es.js +0 -0
  341. /package/{dist/types/v4 → v4}/locales/fa.d.ts +0 -0
  342. /package/{dist/esm/v4 → v4}/locales/fa.js +0 -0
  343. /package/{dist/types/v4 → v4}/locales/fi.d.ts +0 -0
  344. /package/{dist/esm/v4 → v4}/locales/fi.js +0 -0
  345. /package/{dist/types/v4 → v4}/locales/fr-CA.d.ts +0 -0
  346. /package/{dist/esm/v4 → v4}/locales/fr-CA.js +0 -0
  347. /package/{dist/types/v4 → v4}/locales/fr.d.ts +0 -0
  348. /package/{dist/esm/v4 → v4}/locales/fr.js +0 -0
  349. /package/{dist/types/v4 → v4}/locales/he.d.ts +0 -0
  350. /package/{dist/esm/v4 → v4}/locales/he.js +0 -0
  351. /package/{dist/types/v4 → v4}/locales/hu.d.ts +0 -0
  352. /package/{dist/esm/v4 → v4}/locales/hu.js +0 -0
  353. /package/{dist/types/v4 → v4}/locales/id.d.ts +0 -0
  354. /package/{dist/esm/v4 → v4}/locales/id.js +0 -0
  355. /package/{dist/types/v4 → v4}/locales/it.d.ts +0 -0
  356. /package/{dist/esm/v4 → v4}/locales/it.js +0 -0
  357. /package/{dist/types/v4 → v4}/locales/ja.d.ts +0 -0
  358. /package/{dist/esm/v4 → v4}/locales/ja.js +0 -0
  359. /package/{dist/types/v4 → v4}/locales/kh.d.ts +0 -0
  360. /package/{dist/esm/v4 → v4}/locales/kh.js +0 -0
  361. /package/{dist/types/v4 → v4}/locales/ko.d.ts +0 -0
  362. /package/{dist/esm/v4 → v4}/locales/ko.js +0 -0
  363. /package/{dist/types/v4 → v4}/locales/mk.d.ts +0 -0
  364. /package/{dist/esm/v4 → v4}/locales/mk.js +0 -0
  365. /package/{dist/types/v4 → v4}/locales/ms.d.ts +0 -0
  366. /package/{dist/esm/v4 → v4}/locales/ms.js +0 -0
  367. /package/{dist/types/v4 → v4}/locales/nl.d.ts +0 -0
  368. /package/{dist/esm/v4 → v4}/locales/nl.js +0 -0
  369. /package/{dist/types/v4 → v4}/locales/no.d.ts +0 -0
  370. /package/{dist/esm/v4 → v4}/locales/no.js +0 -0
  371. /package/{dist/types/v4 → v4}/locales/ota.d.ts +0 -0
  372. /package/{dist/esm/v4 → v4}/locales/ota.js +0 -0
  373. /package/{dist/types/v4 → v4}/locales/pl.d.ts +0 -0
  374. /package/{dist/esm/v4 → v4}/locales/pl.js +0 -0
  375. /package/{dist/types/v4 → v4}/locales/ps.d.ts +0 -0
  376. /package/{dist/esm/v4 → v4}/locales/ps.js +0 -0
  377. /package/{dist/types/v4 → v4}/locales/pt.d.ts +0 -0
  378. /package/{dist/esm/v4 → v4}/locales/pt.js +0 -0
  379. /package/{dist/types/v4 → v4}/locales/ru.d.ts +0 -0
  380. /package/{dist/esm/v4 → v4}/locales/ru.js +0 -0
  381. /package/{dist/types/v4 → v4}/locales/sl.d.ts +0 -0
  382. /package/{dist/esm/v4 → v4}/locales/sl.js +0 -0
  383. /package/{dist/types/v4 → v4}/locales/sv.d.ts +0 -0
  384. /package/{dist/esm/v4 → v4}/locales/sv.js +0 -0
  385. /package/{dist/types/v4 → v4}/locales/ta.d.ts +0 -0
  386. /package/{dist/esm/v4 → v4}/locales/ta.js +0 -0
  387. /package/{dist/types/v4 → v4}/locales/th.d.ts +0 -0
  388. /package/{dist/esm/v4 → v4}/locales/th.js +0 -0
  389. /package/{dist/types/v4 → v4}/locales/tr.d.ts +0 -0
  390. /package/{dist/esm/v4 → v4}/locales/tr.js +0 -0
  391. /package/{dist/types/v4 → v4}/locales/ua.d.ts +0 -0
  392. /package/{dist/esm/v4 → v4}/locales/ua.js +0 -0
  393. /package/{dist/types/v4 → v4}/locales/ur.d.ts +0 -0
  394. /package/{dist/esm/v4 → v4}/locales/ur.js +0 -0
  395. /package/{dist/types/v4 → v4}/locales/vi.d.ts +0 -0
  396. /package/{dist/esm/v4 → v4}/locales/vi.js +0 -0
  397. /package/{dist/types/v4 → v4}/locales/zh-CN.d.ts +0 -0
  398. /package/{dist/esm/v4 → v4}/locales/zh-CN.js +0 -0
  399. /package/{dist/types/v4 → v4}/locales/zh-TW.d.ts +0 -0
  400. /package/{dist/esm/v4 → v4}/locales/zh-TW.js +0 -0
  401. /package/{dist/types/v4 → v4}/mini/index.d.ts +0 -0
  402. /package/{dist/esm/v4 → v4}/mini/index.js +0 -0
@@ -231,7 +231,6 @@ export const $ZodKSUID = /*@__PURE__*/ core.$constructor("$ZodKSUID", (inst, def
231
231
  export const $ZodISODateTime = /*@__PURE__*/ core.$constructor("$ZodISODateTime", (inst, def) => {
232
232
  def.pattern ?? (def.pattern = regexes.datetime(def));
233
233
  $ZodStringFormat.init(inst, def);
234
- const _super = inst._zod.check;
235
234
  });
236
235
  export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst, def) => {
237
236
  def.pattern ?? (def.pattern = regexes.date);
@@ -240,7 +239,6 @@ export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst,
240
239
  export const $ZodISOTime = /*@__PURE__*/ core.$constructor("$ZodISOTime", (inst, def) => {
241
240
  def.pattern ?? (def.pattern = regexes.time(def));
242
241
  $ZodStringFormat.init(inst, def);
243
- const _super = inst._zod.check;
244
242
  });
245
243
  export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration", (inst, def) => {
246
244
  def.pattern ?? (def.pattern = regexes.duration);
@@ -376,6 +374,8 @@ export function isValidJWT(token, algorithm = null) {
376
374
  if (tokensParts.length !== 3)
377
375
  return false;
378
376
  const [header] = tokensParts;
377
+ if (!header)
378
+ return false;
379
379
  const parsedHeader = JSON.parse(atob(header));
380
380
  if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
381
381
  return false;
@@ -0,0 +1,55 @@
1
+ /** The Standard Schema interface. */
2
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
3
+ /** The Standard Schema properties. */
4
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
5
+ }
6
+ export declare namespace StandardSchemaV1 {
7
+ /** The Standard Schema properties interface. */
8
+ interface Props<Input = unknown, Output = Input> {
9
+ /** The version number of the standard. */
10
+ readonly version: 1;
11
+ /** The vendor name of the schema library. */
12
+ readonly vendor: string;
13
+ /** Validates unknown input values. */
14
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
15
+ /** Inferred types associated with the schema. */
16
+ readonly types?: Types<Input, Output> | undefined;
17
+ }
18
+ /** The result interface of the validate function. */
19
+ type Result<Output> = SuccessResult<Output> | FailureResult;
20
+ /** The result interface if validation succeeds. */
21
+ interface SuccessResult<Output> {
22
+ /** The typed output value. */
23
+ readonly value: Output;
24
+ /** The non-existent issues. */
25
+ readonly issues?: undefined;
26
+ }
27
+ /** The result interface if validation fails. */
28
+ interface FailureResult {
29
+ /** The issues of failed validation. */
30
+ readonly issues: ReadonlyArray<Issue>;
31
+ }
32
+ /** The issue interface of the failure output. */
33
+ interface Issue {
34
+ /** The error message of the issue. */
35
+ readonly message: string;
36
+ /** The path of the issue, if any. */
37
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
38
+ }
39
+ /** The path segment interface of the issue. */
40
+ interface PathSegment {
41
+ /** The key representing a path segment. */
42
+ readonly key: PropertyKey;
43
+ }
44
+ /** The Standard Schema types interface. */
45
+ interface Types<Input = unknown, Output = Input> {
46
+ /** The input type of the schema. */
47
+ readonly input: Input;
48
+ /** The output type of the schema. */
49
+ readonly output: Output;
50
+ }
51
+ /** Infers the input type of a Standard Schema. */
52
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
53
+ /** Infers the output type of a Standard Schema. */
54
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
55
+ }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JSONSchemaGenerator = void 0;
4
4
  exports.toJSONSchema = toJSONSchema;
5
- const registries_js_1 = require("./registries.js");
6
- const util_js_1 = require("./util.js");
5
+ const registries_js_1 = require("./registries.cjs");
6
+ const util_js_1 = require("./util.cjs");
7
7
  class JSONSchemaGenerator {
8
8
  constructor(params) {
9
9
  this.counter = 0;
@@ -0,0 +1,84 @@
1
+ import type * as JSONSchema from "./json-schema.cjs";
2
+ import { $ZodRegistry } from "./registries.cjs";
3
+ import type * as schemas from "./schemas.cjs";
4
+ interface JSONSchemaGeneratorParams {
5
+ /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
6
+ * @default globalRegistry */
7
+ metadata?: $ZodRegistry<Record<string, any>>;
8
+ /** The JSON Schema version to target.
9
+ * - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
10
+ * - `"draft-7"` — JSON Schema Draft 7 */
11
+ target?: "draft-7" | "draft-2020-12";
12
+ /** How to handle unrepresentable types.
13
+ * - `"throw"` — Default. Unrepresentable types throw an error
14
+ * - `"any"` — Unrepresentable types become `{}` */
15
+ unrepresentable?: "throw" | "any";
16
+ /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
17
+ override?: (ctx: {
18
+ zodSchema: schemas.$ZodTypes;
19
+ jsonSchema: JSONSchema.BaseSchema;
20
+ }) => void;
21
+ /** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, Error converting schema to JSONz, defaults, coerced primitives, etc.
22
+ * - `"output" — Default. Convert the output schema.
23
+ * - `"input"` — Convert the input schema. */
24
+ io?: "input" | "output";
25
+ }
26
+ interface ProcessParams {
27
+ schemaPath: schemas.$ZodType[];
28
+ path: (string | number)[];
29
+ }
30
+ interface EmitParams {
31
+ /** How to handle cycles.
32
+ * - `"ref"` — Default. Cycles will be broken using $defs
33
+ * - `"throw"` — Cycles will throw an error if encountered */
34
+ cycles?: "ref" | "throw";
35
+ reused?: "ref" | "inline";
36
+ external?: {
37
+ /** */
38
+ registry: $ZodRegistry<{
39
+ id?: string | undefined;
40
+ }>;
41
+ uri: (id: string) => string;
42
+ defs: Record<string, JSONSchema.BaseSchema>;
43
+ } | undefined;
44
+ }
45
+ interface Seen {
46
+ /** JSON Schema result for this Zod schema */
47
+ schema: JSONSchema.BaseSchema;
48
+ /** A cached version of the schema that doesn't get overwritten during ref resolution */
49
+ def?: JSONSchema.BaseSchema;
50
+ defId?: string | undefined;
51
+ /** Number of times this schema was encountered during traversal */
52
+ count: number;
53
+ /** Cycle path */
54
+ cycle?: (string | number)[] | undefined;
55
+ isParent?: boolean | undefined;
56
+ ref?: schemas.$ZodType | undefined | null;
57
+ }
58
+ export declare class JSONSchemaGenerator {
59
+ metadataRegistry: $ZodRegistry<Record<string, any>>;
60
+ target: "draft-7" | "draft-2020-12";
61
+ unrepresentable: "throw" | "any";
62
+ override: (ctx: {
63
+ zodSchema: schemas.$ZodTypes;
64
+ jsonSchema: JSONSchema.BaseSchema;
65
+ }) => void;
66
+ io: "input" | "output";
67
+ counter: number;
68
+ seen: Map<schemas.$ZodType, Seen>;
69
+ constructor(params?: JSONSchemaGeneratorParams);
70
+ process(schema: schemas.$ZodType, _params?: ProcessParams): JSONSchema.BaseSchema;
71
+ emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema;
72
+ }
73
+ interface ToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {
74
+ }
75
+ interface RegistryToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {
76
+ uri?: (id: string) => string;
77
+ }
78
+ export declare function toJSONSchema(schema: schemas.$ZodType, _params?: ToJSONSchemaParams): JSONSchema.BaseSchema;
79
+ export declare function toJSONSchema(registry: $ZodRegistry<{
80
+ id?: string | undefined;
81
+ }>, _params?: RegistryToJSONSchemaParams): {
82
+ schemas: Record<string, JSONSchema.BaseSchema>;
83
+ };
84
+ export {};
@@ -173,9 +173,6 @@ exports.allowsEval = cached(() => {
173
173
  return false;
174
174
  }
175
175
  });
176
- function _isObject(o) {
177
- return Object.prototype.toString.call(o) === "[object Object]";
178
- }
179
176
  function isPlainObject(o) {
180
177
  if (isObject(o) === false)
181
178
  return false;
@@ -459,7 +456,7 @@ function required(Class, schema, mask) {
459
456
  }
460
457
  function aborted(x, startIndex = 0) {
461
458
  for (let i = startIndex; i < x.issues.length; i++) {
462
- if (x.issues[i].continue !== true)
459
+ if (x.issues[i]?.continue !== true)
463
460
  return true;
464
461
  }
465
462
  return false;
@@ -0,0 +1,183 @@
1
+ import type * as checks from "./checks.cjs";
2
+ import type { $ZodConfig } from "./core.cjs";
3
+ import type * as errors from "./errors.cjs";
4
+ import type * as schemas from "./schemas.cjs";
5
+ export type JSONType = string | number | boolean | null | JSONType[] | {
6
+ [key: string]: JSONType;
7
+ };
8
+ export type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
9
+ export type IPVersion = "v4" | "v6";
10
+ export type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
11
+ export type ParsedTypes = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "file" | "date" | "array" | "map" | "set" | "nan" | "null" | "promise";
12
+ export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
13
+ export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
14
+ export type AssertExtends<T, U> = T extends U ? T : never;
15
+ export type IsAny<T> = 0 extends 1 & T ? true : false;
16
+ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
17
+ export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
18
+ export type MakePartial<T, K extends keyof T> = Omit<T, K> & InexactPartial<Pick<T, K>>;
19
+ export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
20
+ export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
21
+ export type NoUndefined<T> = T extends undefined ? never : T;
22
+ export type Whatever = {} | undefined | null;
23
+ export type LoosePartial<T extends object> = InexactPartial<T> & {
24
+ [k: string]: unknown;
25
+ };
26
+ export type Mask<Keys extends PropertyKey> = {
27
+ [K in Keys]?: true;
28
+ };
29
+ export type Writeable<T> = {
30
+ -readonly [P in keyof T]: T[P];
31
+ } & {};
32
+ export type InexactPartial<T> = {
33
+ [P in keyof T]?: T[P] | undefined;
34
+ };
35
+ export type EmptyObject = Record<string, never>;
36
+ export type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
37
+ readonly [Symbol.toStringTag]: string;
38
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
39
+ export type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
40
+ export type SomeObject = Record<PropertyKey, any>;
41
+ export type Identity<T> = T;
42
+ export type Flatten<T> = Identity<{
43
+ [k in keyof T]: T[k];
44
+ }>;
45
+ export type Mapped<T> = {
46
+ [k in keyof T]: T[k];
47
+ };
48
+ export type Prettify<T> = {
49
+ [K in keyof T]: T[K];
50
+ } & {};
51
+ export type NoNeverKeys<T> = {
52
+ [k in keyof T]: [T[k]] extends [never] ? never : k;
53
+ }[keyof T];
54
+ export type NoNever<T> = Identity<{
55
+ [k in NoNeverKeys<T>]: k extends keyof T ? T[k] : never;
56
+ }>;
57
+ export type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : {
58
+ [K in keyof A as K extends keyof B ? never : K]: A[K];
59
+ } & {
60
+ [K in keyof B]: B[K];
61
+ }>;
62
+ export type TupleItems = ReadonlyArray<schemas.SomeType>;
63
+ export type AnyFunc = (...args: any[]) => any;
64
+ export type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;
65
+ export type MaybeAsync<T> = T | Promise<T>;
66
+ export type KeyOf<T> = keyof OmitIndexSignature<T>;
67
+ export type OmitIndexSignature<T> = {
68
+ [K in keyof T as string extends K ? never : K extends string ? K : never]: T[K];
69
+ };
70
+ export type ExtractIndexSignature<T> = {
71
+ [K in keyof T as string extends K ? K : K extends string ? never : K]: T[K];
72
+ };
73
+ export type Keys<T extends object> = keyof OmitIndexSignature<T>;
74
+ export type SchemaClass<T extends schemas.SomeType> = {
75
+ new (def: T["_zod"]["def"]): T;
76
+ };
77
+ export type EnumValue = string | number;
78
+ export type EnumLike = Readonly<Record<string, EnumValue>>;
79
+ export type ToEnum<T extends EnumValue> = Flatten<{
80
+ [k in T]: k;
81
+ }>;
82
+ export type KeysEnum<T extends object> = ToEnum<Exclude<keyof T, symbol>>;
83
+ export type KeysArray<T extends object> = Flatten<(keyof T & string)[]>;
84
+ export type Literal = string | number | bigint | boolean | null | undefined;
85
+ export type LiteralArray = Array<Literal>;
86
+ export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
87
+ export type PrimitiveArray = Array<Primitive>;
88
+ export type HasSize = {
89
+ size: number;
90
+ };
91
+ export type HasLength = {
92
+ length: number;
93
+ };
94
+ export type Numeric = number | bigint | Date;
95
+ export type SafeParseResult<T> = SafeParseSuccess<T> | SafeParseError<T>;
96
+ export type SafeParseSuccess<T> = {
97
+ success: true;
98
+ data: T;
99
+ error?: never;
100
+ };
101
+ export type SafeParseError<T> = {
102
+ success: false;
103
+ data?: never;
104
+ error: errors.$ZodError<T>;
105
+ };
106
+ export type PropValues = Record<string, Set<Primitive>>;
107
+ export type PrimitiveSet = Set<Primitive>;
108
+ export declare function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B>;
109
+ export declare function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<A, B>;
110
+ export declare function assertIs<T>(_arg: T): void;
111
+ export declare function assertNever(_x: never): never;
112
+ export declare function assert<T>(_: any): asserts _ is T;
113
+ export declare function getEnumValues(entries: EnumLike): EnumValue[];
114
+ export declare function joinValues<T extends Primitive[]>(array: T, separator?: string): string;
115
+ export declare function jsonStringifyReplacer(_: string, value: any): any;
116
+ export declare function cached<T>(getter: () => T): {
117
+ value: T;
118
+ };
119
+ export declare function nullish(input: any): boolean;
120
+ export declare function cleanRegex(source: string): string;
121
+ export declare function floatSafeRemainder(val: number, step: number): number;
122
+ export declare function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void;
123
+ export declare function assignProp<T extends object, K extends PropertyKey>(target: T, prop: K, value: K extends keyof T ? T[K] : any): void;
124
+ export declare function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any;
125
+ export declare function promiseAllObject<T extends object>(promisesObj: T): Promise<{
126
+ [k in keyof T]: Awaited<T[k]>;
127
+ }>;
128
+ export declare function randomString(length?: number): string;
129
+ export declare function esc(str: string): string;
130
+ export declare const captureStackTrace: typeof Error.captureStackTrace;
131
+ export declare function isObject(data: any): data is Record<PropertyKey, unknown>;
132
+ export declare const allowsEval: {
133
+ value: boolean;
134
+ };
135
+ export declare function isPlainObject(o: any): o is Record<PropertyKey, unknown>;
136
+ export declare function numKeys(data: any): number;
137
+ export declare const getParsedType: (data: any) => ParsedTypes;
138
+ export declare const propertyKeyTypes: Set<string>;
139
+ export declare const primitiveTypes: Set<string>;
140
+ export declare function escapeRegex(str: string): string;
141
+ export declare function clone<T extends schemas.$ZodType>(inst: T, def?: T["_zod"]["def"], params?: {
142
+ parent: boolean;
143
+ }): T;
144
+ export type EmptyToNever<T> = keyof T extends never ? never : T;
145
+ export type Normalize<T> = T extends undefined ? never : T extends Record<any, any> ? Flatten<{
146
+ [k in keyof Omit<T, "error" | "message">]: T[k];
147
+ } & ("error" extends keyof T ? {
148
+ error?: Exclude<T["error"], string>;
149
+ } : unknown)> : never;
150
+ export declare function normalizeParams<T>(_params: T): Normalize<T>;
151
+ export declare function createTransparentProxy<T extends object>(getter: () => T): T;
152
+ export declare function stringifyPrimitive(value: any): string;
153
+ export declare function optionalKeys(shape: schemas.$ZodShape): string[];
154
+ export type CleanKey<T extends PropertyKey> = T extends `?${infer K}` ? K : T extends `${infer K}?` ? K : T;
155
+ export type ToCleanMap<T extends schemas.$ZodLooseShape> = {
156
+ [k in keyof T]: k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k;
157
+ };
158
+ export type FromCleanMap<T extends schemas.$ZodLooseShape> = {
159
+ [k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k;
160
+ };
161
+ export declare const NUMBER_FORMAT_RANGES: Record<checks.$ZodNumberFormats, [number, number]>;
162
+ export declare const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, bigint]>;
163
+ export declare function pick(schema: schemas.$ZodObject, mask: Record<string, unknown>): any;
164
+ export declare function omit(schema: schemas.$ZodObject, mask: object): any;
165
+ export declare function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any;
166
+ export declare function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any;
167
+ export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null, schema: schemas.$ZodObject, mask: object | undefined): any;
168
+ export declare function required(Class: SchemaClass<schemas.$ZodNonOptional>, schema: schemas.$ZodObject, mask: object | undefined): any;
169
+ export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
170
+ export declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean;
171
+ export declare function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[];
172
+ export declare function unwrapMessage(message: string | {
173
+ message: string;
174
+ } | undefined | null): string | undefined;
175
+ export declare function finalizeIssue(iss: errors.$ZodRawIssue, ctx: schemas.ParseContextInternal | undefined, config: $ZodConfig): errors.$ZodIssue;
176
+ export declare function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown";
177
+ export declare function getLengthableOrigin(input: any): "array" | "string" | "unknown";
178
+ export declare function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue;
179
+ export declare function issue(_iss: errors.$ZodRawIssue): errors.$ZodRawIssue;
180
+ export declare function cleanEnum(obj: Record<string, EnumValue>): EnumValue[];
181
+ export declare abstract class Class {
182
+ constructor(..._args: any[]);
183
+ }
@@ -129,9 +129,6 @@ export const allowsEval = cached(() => {
129
129
  return false;
130
130
  }
131
131
  });
132
- function _isObject(o) {
133
- return Object.prototype.toString.call(o) === "[object Object]";
134
- }
135
132
  export function isPlainObject(o) {
136
133
  if (isObject(o) === false)
137
134
  return false;
@@ -414,7 +411,7 @@ export function required(Class, schema, mask) {
414
411
  }
415
412
  export function aborted(x, startIndex = 0) {
416
413
  for (let i = startIndex; i < x.issues.length; i++) {
417
- if (x.issues[i].continue !== true)
414
+ if (x.issues[i]?.continue !== true)
418
415
  return true;
419
416
  }
420
417
  return false;
@@ -0,0 +1,5 @@
1
+ export declare const version: {
2
+ readonly major: 4;
3
+ readonly minor: 0;
4
+ readonly patch: number;
5
+ };
@@ -17,6 +17,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- const index_js_1 = __importDefault(require("./v3/index.js"));
21
- __exportStar(require("./v3/index.js"), exports);
20
+ const index_js_1 = __importDefault(require("./classic/index.cjs"));
21
+ __exportStar(require("./classic/index.cjs"), exports);
22
22
  exports.default = index_js_1.default;
package/v4/index.d.cts ADDED
@@ -0,0 +1,3 @@
1
+ import z4 from "./classic/index.cjs";
2
+ export * from "./classic/index.cjs";
3
+ export default z4;
package/v4/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import z from "../dist/types/v4/index.js";
2
- export * from "../dist/types/v4/index.js";
3
- export default z;
1
+ import z4 from "./classic/index.js";
2
+ export * from "./classic/index.js";
3
+ export default z4;
package/v4/index.js CHANGED
@@ -1 +1,3 @@
1
- export * from "../dist/esm/v4/index.js";
1
+ import z4 from "./classic/index.js";
2
+ export * from "./classic/index.js";
3
+ export default z4;
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  const error = () => {
29
29
  const Sizable = {
30
30
  string: { unit: "حرف", verb: "أن يحوي" },
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  const error = () => {
29
29
  const Sizable = {
30
30
  string: { unit: "simvol", verb: "olmalıdır" },
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  function getBelarusianPlural(count, one, few, many) {
29
29
  const absCount = Math.abs(count);
30
30
  const lastDigit = absCount % 10;
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  const error = () => {
29
29
  const Sizable = {
30
30
  string: { unit: "caràcters", verb: "contenir" },
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  const error = () => {
29
29
  const Sizable = {
30
30
  string: { unit: "znaků", verb: "mít" },
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = default_1;
27
- const util = __importStar(require("../core/util.js"));
27
+ const util = __importStar(require("../core/util.cjs"));
28
28
  const error = () => {
29
29
  const Sizable = {
30
30
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.parsedType = void 0;
27
27
  exports.default = default_1;
28
- const util = __importStar(require("../core/util.js"));
28
+ const util = __importStar(require("../core/util.cjs"));
29
29
  const parsedType = (data) => {
30
30
  const t = typeof data;
31
31
  switch (t) {
@@ -1,4 +1,4 @@
1
- import type * as errors from "../core/errors.js";
1
+ import type * as errors from "../core/errors.cjs";
2
2
  export declare const parsedType: (data: any) => string;
3
3
  export default function (): {
4
4
  localeError: errors.$ZodErrorMap;
@@ -1,2 +1,5 @@
1
- export * from "../../dist/types/v4/locales/en.d.ts";
2
- export { default } from "../../dist/types/v4/locales/en.d.ts";
1
+ import type * as errors from "../core/errors.js";
2
+ export declare const parsedType: (data: any) => string;
3
+ export default function (): {
4
+ localeError: errors.$ZodErrorMap;
5
+ };