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
@@ -23,11 +23,106 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.allProcessors = exports.lazyProcessor = exports.optionalProcessor = exports.promiseProcessor = exports.readonlyProcessor = exports.pipeProcessor = exports.catchProcessor = exports.prefaultProcessor = exports.defaultProcessor = exports.nonoptionalProcessor = exports.nullableProcessor = exports.recordProcessor = exports.tupleProcessor = exports.intersectionProcessor = exports.unionProcessor = exports.objectProcessor = exports.arrayProcessor = exports.setProcessor = exports.mapProcessor = exports.transformProcessor = exports.functionProcessor = exports.customProcessor = exports.successProcessor = exports.fileProcessor = exports.templateLiteralProcessor = exports.nanProcessor = exports.literalProcessor = exports.enumProcessor = exports.dateProcessor = exports.unknownProcessor = exports.anyProcessor = exports.neverProcessor = exports.voidProcessor = exports.undefinedProcessor = exports.nullProcessor = exports.symbolProcessor = exports.bigintProcessor = exports.booleanProcessor = exports.numberProcessor = exports.stringProcessor = void 0;
26
+ exports.allProcessors = exports.lazyProcessor = exports.optionalProcessor = exports.promiseProcessor = exports.readonlyProcessor = exports.pipeProcessor = exports.catchProcessor = exports.prefaultProcessor = exports.defaultProcessor = exports.nonoptionalProcessor = exports.nullableProcessor = exports.recordProcessor = exports.tupleProcessor = exports.intersectionProcessor = exports.unionProcessor = exports.propertiesProcessor = exports.objectProcessor = exports.arrayProcessor = exports.setProcessor = exports.mapProcessor = exports.transformProcessor = exports.functionProcessor = exports.customProcessor = exports.successProcessor = exports.fileProcessor = exports.templateLiteralProcessor = exports.nanProcessor = exports.literalProcessor = exports.enumProcessor = exports.dateProcessor = exports.unknownProcessor = exports.anyProcessor = exports.neverProcessor = exports.voidProcessor = exports.undefinedProcessor = exports.nullProcessor = exports.symbolProcessor = exports.bigintProcessor = exports.booleanProcessor = exports.numberProcessor = exports.stringProcessor = void 0;
27
+ exports.aggregateChecks = aggregateChecks;
27
28
  exports.toJSONSchema = toJSONSchema;
28
29
  const regexes = __importStar(require("./regexes.cjs"));
30
+ const schemas_js_1 = require("./schemas.cjs");
29
31
  const to_json_schema_js_1 = require("./to-json-schema.cjs");
30
32
  const util_js_1 = require("./util.cjs");
33
+ const narrowMin = (agg, key, value) => {
34
+ if (agg[key] === undefined || value > agg[key])
35
+ agg[key] = value;
36
+ };
37
+ const narrowMax = (agg, key, value) => {
38
+ if (agg[key] === undefined || value < agg[key])
39
+ agg[key] = value;
40
+ };
41
+ const narrowBoth = (agg, value) => {
42
+ narrowMin(agg, "minimum", value);
43
+ narrowMax(agg, "maximum", value);
44
+ };
45
+ const addDivisor = (agg, value) => {
46
+ agg.multipleOf ?? (agg.multipleOf = []);
47
+ if (!agg.multipleOf.includes(value))
48
+ agg.multipleOf.push(value);
49
+ };
50
+ const addPattern = (agg, pattern) => {
51
+ agg.patterns ?? (agg.patterns = new Set());
52
+ agg.patterns.add(pattern);
53
+ };
54
+ const intersectMime = (agg, mime) => {
55
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
56
+ };
57
+ // last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
58
+ const setFormat = (agg, format) => {
59
+ agg.format = format;
60
+ if (format.includes("int"))
61
+ agg.isInt = true;
62
+ };
63
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
64
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
65
+ const formatContributor = (ranges) => (agg, def) => {
66
+ setFormat(agg, def.format);
67
+ const [minimum, maximum] = ranges[def.format];
68
+ narrowMin(agg, "minimum", minimum);
69
+ narrowMax(agg, "maximum", maximum);
70
+ };
71
+ const contributors = {
72
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
73
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
74
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
75
+ number_format: formatContributor(util_js_1.NUMBER_FORMAT_RANGES),
76
+ bigint_format: formatContributor(util_js_1.BIGINT_FORMAT_RANGES),
77
+ min_length: minContributor,
78
+ max_length: maxContributor,
79
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
80
+ min_size: minContributor,
81
+ max_size: maxContributor,
82
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
83
+ string_format: (agg, def) => {
84
+ setFormat(agg, def.format);
85
+ if (def.pattern)
86
+ addPattern(agg, def.pattern);
87
+ if (def.format === "base64" || def.format === "base64url")
88
+ agg.contentEncoding = def.format;
89
+ if (def.local || def.precision === -1)
90
+ agg.laxFormat = true;
91
+ },
92
+ mime_type: (agg, def) => intersectMime(agg, def.mime),
93
+ };
94
+ function aggregateChecks(schema) {
95
+ const agg = {};
96
+ const def = schema._zod.def;
97
+ // a format schema is its own first check, same rule as $ZodType init
98
+ const list = schema._zod.traits.has("$ZodCheck")
99
+ ? [schema, ...(def.checks ?? [])]
100
+ : (def.checks ?? []);
101
+ for (const ch of list)
102
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
103
+ // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
104
+ const bag = schema._zod.bag;
105
+ if (bag.minimum !== undefined)
106
+ narrowMin(agg, "minimum", bag.minimum);
107
+ if (bag.exclusiveMinimum !== undefined)
108
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
109
+ if (bag.maximum !== undefined)
110
+ narrowMax(agg, "maximum", bag.maximum);
111
+ if (bag.exclusiveMaximum !== undefined)
112
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
113
+ if (bag.multipleOf !== undefined)
114
+ addDivisor(agg, bag.multipleOf);
115
+ if (bag.format !== undefined) {
116
+ agg.format ?? (agg.format = bag.format);
117
+ if (bag.format.includes("int"))
118
+ agg.isInt = true;
119
+ }
120
+ if (bag.mime)
121
+ intersectMime(agg, bag.mime);
122
+ for (const pattern of bag.patterns ?? [])
123
+ addPattern(agg, pattern);
124
+ return agg;
125
+ }
31
126
  const formatMap = {
32
127
  guid: "uuid",
33
128
  url: "uri",
@@ -36,11 +131,16 @@ const formatMap = {
36
131
  regex: "", // do not set
37
132
  };
38
133
  // ==================== SIMPLE TYPE PROCESSORS ====================
134
+ // the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
135
+ const exactPatterns = new Map([
136
+ [schemas_js_1.base64Charset, regexes.base64],
137
+ [schemas_js_1.base64urlCharset, regexes.base64url],
138
+ ]);
139
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
39
140
  const stringProcessor = (schema, ctx, _json, _params) => {
40
141
  const json = _json;
41
142
  json.type = "string";
42
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod
43
- .bag;
143
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
44
144
  if (typeof minimum === "number")
45
145
  json.minLength = minimum;
46
146
  if (typeof maximum === "number")
@@ -58,7 +158,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
58
158
  if (contentEncoding)
59
159
  json.contentEncoding = contentEncoding;
60
160
  if (patterns && patterns.size > 0) {
61
- const patternList = [...patterns];
161
+ const patternList = [...patterns].map(exactPattern);
62
162
  if (patternList.length === 1)
63
163
  json.pattern = patternList[0].source;
64
164
  else if (patternList.length > 1) {
@@ -76,11 +176,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
76
176
  exports.stringProcessor = stringProcessor;
77
177
  const numberProcessor = (schema, ctx, _json, params) => {
78
178
  const json = _json;
79
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
80
- if (typeof format === "string" && format.includes("int"))
81
- json.type = "integer";
82
- else
83
- json.type = "number";
179
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
180
+ json.type = isInt ? "integer" : "number";
84
181
  // when both minimum and exclusiveMinimum exist, pick the more restrictive one
85
182
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
86
183
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
@@ -109,12 +206,21 @@ const numberProcessor = (schema, ctx, _json, params) => {
109
206
  else if (typeof maximum === "number") {
110
207
  json.maximum = maximum;
111
208
  }
112
- if (typeof multipleOf === "number") {
209
+ if (multipleOf) {
113
210
  // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
114
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
115
- json.multipleOf = Math.abs(multipleOf);
116
- else
117
- (0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
211
+ const divisors = new Set();
212
+ for (const divisor of multipleOf) {
213
+ if (Number.isFinite(divisor) && divisor !== 0)
214
+ divisors.add(Math.abs(divisor));
215
+ else
216
+ (0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
217
+ }
218
+ // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
219
+ const [first, ...rest] = divisors;
220
+ if (first !== undefined)
221
+ json.multipleOf = first;
222
+ if (rest.length)
223
+ json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
118
224
  }
119
225
  };
120
226
  exports.numberProcessor = numberProcessor;
@@ -246,29 +352,24 @@ const templateLiteralProcessor = (schema, _ctx, json, _params) => {
246
352
  exports.templateLiteralProcessor = templateLiteralProcessor;
247
353
  const fileProcessor = (schema, _ctx, json, _params) => {
248
354
  const _json = json;
249
- const file = {
250
- type: "string",
251
- format: "binary",
252
- contentEncoding: "binary",
253
- };
254
- const { minimum, maximum, mime } = schema._zod.bag;
355
+ _json.type = "string";
356
+ _json.format = "binary";
357
+ _json.contentEncoding = "binary";
358
+ const { minimum, maximum, mime } = aggregateChecks(schema);
255
359
  if (minimum !== undefined)
256
- file.minLength = minimum;
360
+ _json.minLength = minimum;
257
361
  if (maximum !== undefined)
258
- file.maxLength = maximum;
259
- if (mime) {
260
- if (mime.length === 1) {
261
- file.contentMediaType = mime[0];
262
- Object.assign(_json, file);
263
- }
264
- else {
265
- Object.assign(_json, file); // shared props at root
266
- _json.anyOf = mime.map((m) => ({ contentMediaType: m })); // only contentMediaType differs
267
- }
268
- }
269
- else {
270
- Object.assign(_json, file);
271
- }
362
+ _json.maxLength = maximum;
363
+ if (!mime)
364
+ return;
365
+ // an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`
366
+ if (mime.length === 0)
367
+ _json.not = {};
368
+ else if (mime.length === 1)
369
+ _json.contentMediaType = mime[0];
370
+ // only contentMediaType differs, so the shared props stay at the root
371
+ else
372
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
272
373
  };
273
374
  exports.fileProcessor = fileProcessor;
274
375
  const successProcessor = (_schema, _ctx, json, _params) => {
@@ -299,13 +400,13 @@ exports.setProcessor = setProcessor;
299
400
  const arrayProcessor = (schema, ctx, _json, params) => {
300
401
  const json = _json;
301
402
  const def = schema._zod.def;
302
- const { minimum, maximum } = schema._zod.bag;
403
+ const { minimum, maximum } = aggregateChecks(schema);
303
404
  if (typeof minimum === "number")
304
405
  json.minItems = minimum;
305
406
  if (typeof maximum === "number")
306
407
  json.maxItems = maximum;
307
408
  json.type = "array";
308
- json.items = (0, to_json_schema_js_1.process)(def.element, ctx, {
409
+ json.items = (0, to_json_schema_js_1.processSchema)(def.element, ctx, {
309
410
  ...params,
310
411
  path: [...params.path, "items"],
311
412
  });
@@ -340,7 +441,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
340
441
  json.properties = {};
341
442
  for (const key in shape) {
342
443
  // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
343
- (0, util_js_1.assignProp)(json.properties, key, (0, to_json_schema_js_1.process)(shape[key], ctx, {
444
+ (0, util_js_1.assignProp)(json.properties, key, (0, to_json_schema_js_1.processSchema)(shape[key], ctx, {
344
445
  ...params,
345
446
  path: [...params.path, "properties", key],
346
447
  }));
@@ -370,18 +471,50 @@ const objectProcessor = (schema, ctx, _json, params) => {
370
471
  json.additionalProperties = false;
371
472
  }
372
473
  else if (def.catchall) {
373
- json.additionalProperties = (0, to_json_schema_js_1.process)(def.catchall, ctx, {
474
+ json.additionalProperties = (0, to_json_schema_js_1.processSchema)(def.catchall, ctx, {
374
475
  ...params,
375
476
  path: [...params.path, "additionalProperties"],
376
477
  });
377
478
  }
378
479
  };
379
480
  exports.objectProcessor = objectProcessor;
481
+ // asserts named properties in place and passes everything else through, so no additionalProperties constraint is emitted
482
+ const propertiesProcessor = (schema, ctx, _json, params) => {
483
+ const json = _json;
484
+ const def = schema._zod.def;
485
+ // dropping a symbol key silently would emit a schema that asserts less than this one does
486
+ if (Object.getOwnPropertySymbols(def.shape).length &&
487
+ (0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
488
+ return;
489
+ }
490
+ // the parsed value is the input, so an output-mode emission would describe a transformed value this schema never returns
491
+ if (ctx.io === "output") {
492
+ for (const key in def.shape) {
493
+ if ((0, to_json_schema_js_1.isTransforming)(def.shape[key]) &&
494
+ (0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
495
+ return;
496
+ }
497
+ }
498
+ }
499
+ json.type = "object";
500
+ json.properties = {};
501
+ for (const key in def.shape) {
502
+ (0, util_js_1.assignProp)(json.properties, key, (0, to_json_schema_js_1.processSchema)(def.shape[key], ctx, {
503
+ ...params,
504
+ path: [...params.path, "properties", key],
505
+ }));
506
+ }
507
+ // input-side optionality in both modes: the parsed value is the input, so a defaulted key that stays absent must not be required of the output either
508
+ const required = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === undefined);
509
+ if (required.length > 0)
510
+ json.required = required;
511
+ };
512
+ exports.propertiesProcessor = propertiesProcessor;
380
513
  const unionProcessor = (schema, ctx, json, params) => {
381
514
  const def = schema._zod.def;
382
515
  // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
383
516
  const isExclusive = def.inclusive === false;
384
- const options = def.options.map((x, i) => (0, to_json_schema_js_1.process)(x, ctx, {
517
+ const options = def.options.map((x, i) => (0, to_json_schema_js_1.processSchema)(x, ctx, {
385
518
  ...params,
386
519
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
387
520
  }));
@@ -395,11 +528,11 @@ const unionProcessor = (schema, ctx, json, params) => {
395
528
  exports.unionProcessor = unionProcessor;
396
529
  const intersectionProcessor = (schema, ctx, json, params) => {
397
530
  const def = schema._zod.def;
398
- const a = (0, to_json_schema_js_1.process)(def.left, ctx, {
531
+ const a = (0, to_json_schema_js_1.processSchema)(def.left, ctx, {
399
532
  ...params,
400
533
  path: [...params.path, "allOf", 0],
401
534
  });
402
- const b = (0, to_json_schema_js_1.process)(def.right, ctx, {
535
+ const b = (0, to_json_schema_js_1.processSchema)(def.right, ctx, {
403
536
  ...params,
404
537
  path: [...params.path, "allOf", 1],
405
538
  });
@@ -419,12 +552,12 @@ const tupleProcessor = (schema, ctx, _json, params) => {
419
552
  json.type = "array";
420
553
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
421
554
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
422
- const prefixItems = def.items.map((x, i) => (0, to_json_schema_js_1.process)(x, ctx, {
555
+ const prefixItems = def.items.map((x, i) => (0, to_json_schema_js_1.processSchema)(x, ctx, {
423
556
  ...params,
424
557
  path: [...params.path, prefixPath, i],
425
558
  }));
426
559
  const rest = def.rest
427
- ? (0, to_json_schema_js_1.process)(def.rest, ctx, {
560
+ ? (0, to_json_schema_js_1.processSchema)(def.rest, ctx, {
428
561
  ...params,
429
562
  path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
430
563
  })
@@ -478,7 +611,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
478
611
  json.maxItems = maxItems;
479
612
  }
480
613
  // explicit user-defined length checks take precedence
481
- const { minimum, maximum } = schema._zod.bag;
614
+ const { minimum, maximum } = aggregateChecks(schema);
482
615
  if (typeof minimum === "number")
483
616
  json.minItems = minimum;
484
617
  if (typeof maximum === "number")
@@ -572,23 +705,22 @@ const recordProcessor = (schema, ctx, _json, params) => {
572
705
  json.type = "object";
573
706
  // For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
574
707
  const keyType = def.keyType;
575
- const keyBag = keyType._zod.bag;
576
- const patterns = keyBag?.patterns;
708
+ const patterns = aggregateChecks(keyType).patterns;
577
709
  if (def.mode === "loose" && patterns && patterns.size > 0) {
578
710
  // Use patternProperties for looseRecord with regex patterns
579
- const valueSchema = (0, to_json_schema_js_1.process)(def.valueType, ctx, {
711
+ const valueSchema = (0, to_json_schema_js_1.processSchema)(def.valueType, ctx, {
580
712
  ...params,
581
713
  path: [...params.path, "patternProperties", "*"],
582
714
  });
583
715
  json.patternProperties = {};
584
716
  for (const pattern of patterns) {
585
- (0, util_js_1.assignProp)(json.patternProperties, pattern.source, valueSchema);
717
+ (0, util_js_1.assignProp)(json.patternProperties, exactPattern(pattern).source, valueSchema);
586
718
  }
587
719
  }
588
720
  else {
589
721
  // Default behavior: use propertyNames + additionalProperties
590
722
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
591
- json.propertyNames = (0, to_json_schema_js_1.process)(def.keyType, ctx, {
723
+ json.propertyNames = (0, to_json_schema_js_1.processSchema)(def.keyType, ctx, {
592
724
  ...params,
593
725
  path: [...params.path, "propertyNames"],
594
726
  });
@@ -600,7 +732,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
600
732
  }
601
733
  pending.push(schema);
602
734
  }
603
- json.additionalProperties = (0, to_json_schema_js_1.process)(def.valueType, ctx, {
735
+ json.additionalProperties = (0, to_json_schema_js_1.processSchema)(def.valueType, ctx, {
604
736
  ...params,
605
737
  path: [...params.path, "additionalProperties"],
606
738
  });
@@ -619,7 +751,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
619
751
  exports.recordProcessor = recordProcessor;
620
752
  const nullableProcessor = (schema, ctx, json, params) => {
621
753
  const def = schema._zod.def;
622
- const inner = (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
754
+ const inner = (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
623
755
  const seen = ctx.seen.get(schema);
624
756
  if (ctx.target === "openapi-3.0") {
625
757
  seen.ref = def.innerType;
@@ -632,7 +764,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
632
764
  exports.nullableProcessor = nullableProcessor;
633
765
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
634
766
  const def = schema._zod.def;
635
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
767
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
636
768
  const seen = ctx.seen.get(schema);
637
769
  seen.ref = def.innerType;
638
770
  };
@@ -656,7 +788,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
656
788
  }
657
789
  const defaultProcessor = (schema, ctx, json, params) => {
658
790
  const def = schema._zod.def;
659
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
791
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
660
792
  const seen = ctx.seen.get(schema);
661
793
  seen.ref = def.innerType;
662
794
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -666,7 +798,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
666
798
  exports.defaultProcessor = defaultProcessor;
667
799
  const prefaultProcessor = (schema, ctx, json, params) => {
668
800
  const def = schema._zod.def;
669
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
801
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
670
802
  const seen = ctx.seen.get(schema);
671
803
  seen.ref = def.innerType;
672
804
  if (ctx.io !== "input")
@@ -678,7 +810,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
678
810
  exports.prefaultProcessor = prefaultProcessor;
679
811
  const catchProcessor = (schema, ctx, json, params) => {
680
812
  const def = schema._zod.def;
681
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
813
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
682
814
  const seen = ctx.seen.get(schema);
683
815
  seen.ref = def.innerType;
684
816
  let catchValue;
@@ -696,14 +828,14 @@ const pipeProcessor = (schema, ctx, _json, params) => {
696
828
  const def = schema._zod.def;
697
829
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
698
830
  const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
699
- (0, to_json_schema_js_1.process)(innerType, ctx, params);
831
+ (0, to_json_schema_js_1.processSchema)(innerType, ctx, params);
700
832
  const seen = ctx.seen.get(schema);
701
833
  seen.ref = innerType;
702
834
  };
703
835
  exports.pipeProcessor = pipeProcessor;
704
836
  const readonlyProcessor = (schema, ctx, json, params) => {
705
837
  const def = schema._zod.def;
706
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
838
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
707
839
  const seen = ctx.seen.get(schema);
708
840
  seen.ref = def.innerType;
709
841
  json.readOnly = true;
@@ -711,21 +843,21 @@ const readonlyProcessor = (schema, ctx, json, params) => {
711
843
  exports.readonlyProcessor = readonlyProcessor;
712
844
  const promiseProcessor = (schema, ctx, _json, params) => {
713
845
  const def = schema._zod.def;
714
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
846
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
715
847
  const seen = ctx.seen.get(schema);
716
848
  seen.ref = def.innerType;
717
849
  };
718
850
  exports.promiseProcessor = promiseProcessor;
719
851
  const optionalProcessor = (schema, ctx, _json, params) => {
720
852
  const def = schema._zod.def;
721
- (0, to_json_schema_js_1.process)(def.innerType, ctx, params);
853
+ (0, to_json_schema_js_1.processSchema)(def.innerType, ctx, params);
722
854
  const seen = ctx.seen.get(schema);
723
855
  seen.ref = def.innerType;
724
856
  };
725
857
  exports.optionalProcessor = optionalProcessor;
726
858
  const lazyProcessor = (schema, ctx, _json, params) => {
727
859
  const innerType = schema._zod.innerType;
728
- (0, to_json_schema_js_1.process)(innerType, ctx, params);
860
+ (0, to_json_schema_js_1.processSchema)(innerType, ctx, params);
729
861
  const seen = ctx.seen.get(schema);
730
862
  seen.ref = innerType;
731
863
  };
@@ -751,6 +883,7 @@ exports.allProcessors = {
751
883
  file: exports.fileProcessor,
752
884
  success: exports.successProcessor,
753
885
  custom: exports.customProcessor,
886
+ properties: exports.propertiesProcessor,
754
887
  function: exports.functionProcessor,
755
888
  transform: exports.transformProcessor,
756
889
  map: exports.mapProcessor,
@@ -781,7 +914,7 @@ function toJSONSchema(input, params) {
781
914
  // First pass: process all schemas to build the seen map
782
915
  for (const entry of registry._idmap.entries()) {
783
916
  const [_, schema] = entry;
784
- (0, to_json_schema_js_1.process)(schema, ctx);
917
+ (0, to_json_schema_js_1.processSchema)(schema, ctx);
785
918
  }
786
919
  const schemas = {};
787
920
  const external = {
@@ -807,7 +940,26 @@ function toJSONSchema(input, params) {
807
940
  }
808
941
  // Single schema case
809
942
  const ctx = (0, to_json_schema_js_1.initializeContext)({ ...params, processors: exports.allProcessors });
810
- (0, to_json_schema_js_1.process)(input, ctx);
943
+ (0, to_json_schema_js_1.processSchema)(input, ctx);
811
944
  (0, to_json_schema_js_1.extractDefs)(ctx, input);
812
945
  return (0, to_json_schema_js_1.finalize)(ctx, input);
813
946
  }
947
+
948
+ // seal-cjs-exports
949
+ (function () {
950
+ var keys = Object.getOwnPropertyNames(exports);
951
+ for (var i = 0; i < keys.length; i++) {
952
+ var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
953
+ if (!desc || !desc.get || !desc.configurable) continue;
954
+ var value;
955
+ try {
956
+ value = desc.get();
957
+ } catch (e) {
958
+ continue;
959
+ }
960
+ // a circular require may not have settled this one yet, so leave it live
961
+ if (value === undefined) continue;
962
+ Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
963
+ }
964
+ Object.freeze(exports);
965
+ })();
@@ -1,6 +1,21 @@
1
1
  import type { $ZodRegistry } from "./registries.cjs";
2
2
  import type * as schemas from "./schemas.cjs";
3
3
  import { type Processor, type RegistryToJSONSchemaParams, type ToJSONSchemaParams, type ZodStandardJSONSchemaPayload } from "./to-json-schema.cjs";
4
+ type Bound = number | bigint | Date;
5
+ interface CheckAggregate<N extends Bound = Bound> {
6
+ minimum?: N;
7
+ maximum?: N;
8
+ exclusiveMinimum?: N;
9
+ exclusiveMaximum?: N;
10
+ multipleOf?: number[];
11
+ format?: string;
12
+ isInt?: boolean;
13
+ patterns?: Set<RegExp>;
14
+ mime?: string[];
15
+ contentEncoding?: string;
16
+ laxFormat?: boolean;
17
+ }
18
+ export declare function aggregateChecks<N extends Bound = Bound>(schema: schemas.$ZodType): CheckAggregate<N>;
4
19
  export declare const stringProcessor: Processor<schemas.$ZodString>;
5
20
  export declare const numberProcessor: Processor<schemas.$ZodNumber>;
6
21
  export declare const booleanProcessor: Processor<schemas.$ZodBoolean>;
@@ -26,6 +41,7 @@ export declare const mapProcessor: Processor<schemas.$ZodMap>;
26
41
  export declare const setProcessor: Processor<schemas.$ZodSet>;
27
42
  export declare const arrayProcessor: Processor<schemas.$ZodArray>;
28
43
  export declare const objectProcessor: Processor<schemas.$ZodObject>;
44
+ export declare const propertiesProcessor: Processor<schemas.$ZodProperties>;
29
45
  export declare const unionProcessor: Processor<schemas.$ZodUnion>;
30
46
  export declare const intersectionProcessor: Processor<schemas.$ZodIntersection>;
31
47
  export declare const tupleProcessor: Processor<schemas.$ZodTuple>;
@@ -47,3 +63,4 @@ export declare function toJSONSchema(registry: $ZodRegistry<{
47
63
  }>, params?: RegistryToJSONSchemaParams): {
48
64
  schemas: Record<string, ZodStandardJSONSchemaPayload<schemas.$ZodType>>;
49
65
  };
66
+ export {};
@@ -1,6 +1,21 @@
1
1
  import type { $ZodRegistry } from "./registries.js";
2
2
  import type * as schemas from "./schemas.js";
3
3
  import { type Processor, type RegistryToJSONSchemaParams, type ToJSONSchemaParams, type ZodStandardJSONSchemaPayload } from "./to-json-schema.js";
4
+ type Bound = number | bigint | Date;
5
+ interface CheckAggregate<N extends Bound = Bound> {
6
+ minimum?: N;
7
+ maximum?: N;
8
+ exclusiveMinimum?: N;
9
+ exclusiveMaximum?: N;
10
+ multipleOf?: number[];
11
+ format?: string;
12
+ isInt?: boolean;
13
+ patterns?: Set<RegExp>;
14
+ mime?: string[];
15
+ contentEncoding?: string;
16
+ laxFormat?: boolean;
17
+ }
18
+ export declare function aggregateChecks<N extends Bound = Bound>(schema: schemas.$ZodType): CheckAggregate<N>;
4
19
  export declare const stringProcessor: Processor<schemas.$ZodString>;
5
20
  export declare const numberProcessor: Processor<schemas.$ZodNumber>;
6
21
  export declare const booleanProcessor: Processor<schemas.$ZodBoolean>;
@@ -26,6 +41,7 @@ export declare const mapProcessor: Processor<schemas.$ZodMap>;
26
41
  export declare const setProcessor: Processor<schemas.$ZodSet>;
27
42
  export declare const arrayProcessor: Processor<schemas.$ZodArray>;
28
43
  export declare const objectProcessor: Processor<schemas.$ZodObject>;
44
+ export declare const propertiesProcessor: Processor<schemas.$ZodProperties>;
29
45
  export declare const unionProcessor: Processor<schemas.$ZodUnion>;
30
46
  export declare const intersectionProcessor: Processor<schemas.$ZodIntersection>;
31
47
  export declare const tupleProcessor: Processor<schemas.$ZodTuple>;
@@ -47,3 +63,4 @@ export declare function toJSONSchema(registry: $ZodRegistry<{
47
63
  }>, params?: RegistryToJSONSchemaParams): {
48
64
  schemas: Record<string, ZodStandardJSONSchemaPayload<schemas.$ZodType>>;
49
65
  };
66
+ export {};