fullstacked 0.12.1-1359 → 0.12.1-1364

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 (335) hide show
  1. package/fullstacked_modules/@fullstacked/ai-agent/ai-agent.js +55352 -53576
  2. package/fullstacked_modules/@fullstacked/ai-agent/index.ts +0 -1
  3. package/fullstacked_modules/@fullstacked/ai-agent/lock.json +157 -152
  4. package/fullstacked_modules/@fullstacked/ai-agent/package.json +13 -13
  5. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/ollama.ts +2 -2
  6. package/fullstacked_modules/@fullstacked/ui/index.js +6 -1
  7. package/fullstacked_modules/zod/README.md +4 -4
  8. package/fullstacked_modules/zod/index.cjs +2 -2
  9. package/fullstacked_modules/zod/index.d.cts +2 -2
  10. package/fullstacked_modules/zod/index.d.ts +2 -2
  11. package/fullstacked_modules/zod/index.js +2 -2
  12. package/fullstacked_modules/zod/locales/index.cjs +17 -0
  13. package/fullstacked_modules/zod/locales/index.d.cts +1 -0
  14. package/fullstacked_modules/zod/locales/index.d.ts +1 -0
  15. package/fullstacked_modules/zod/locales/index.js +1 -0
  16. package/fullstacked_modules/zod/locales/package.json +6 -0
  17. package/fullstacked_modules/zod/mini/index.cjs +17 -0
  18. package/fullstacked_modules/zod/mini/index.d.cts +1 -0
  19. package/fullstacked_modules/zod/mini/index.d.ts +1 -0
  20. package/fullstacked_modules/zod/mini/index.js +1 -0
  21. package/fullstacked_modules/zod/mini/package.json +6 -0
  22. package/fullstacked_modules/zod/package.json +29 -12
  23. package/fullstacked_modules/zod/src/index.ts +2 -2
  24. package/fullstacked_modules/zod/src/locales/index.ts +1 -0
  25. package/fullstacked_modules/zod/src/mini/index.ts +1 -0
  26. package/fullstacked_modules/zod/src/v3/ZodError.ts +1 -1
  27. package/fullstacked_modules/zod/src/v3/tests/object.test.ts +2 -2
  28. package/fullstacked_modules/zod/src/v3/tests/string.test.ts +2 -2
  29. package/fullstacked_modules/zod/src/v3/types.ts +3 -1
  30. package/fullstacked_modules/zod/src/v4/classic/checks.ts +1 -0
  31. package/fullstacked_modules/zod/src/v4/classic/compat.ts +4 -0
  32. package/fullstacked_modules/zod/src/v4/classic/errors.ts +9 -2
  33. package/fullstacked_modules/zod/src/v4/classic/external.ts +1 -1
  34. package/fullstacked_modules/zod/src/v4/classic/parse.ts +49 -0
  35. package/fullstacked_modules/zod/src/v4/classic/schemas.ts +224 -81
  36. package/fullstacked_modules/zod/src/v4/classic/tests/array.test.ts +6 -6
  37. package/fullstacked_modules/zod/src/v4/classic/tests/catch.test.ts +29 -5
  38. package/fullstacked_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
  39. package/fullstacked_modules/zod/src/v4/classic/tests/codec.test.ts +562 -0
  40. package/fullstacked_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
  41. package/fullstacked_modules/zod/src/v4/classic/tests/datetime.test.ts +6 -0
  42. package/fullstacked_modules/zod/src/v4/classic/tests/default.test.ts +52 -0
  43. package/fullstacked_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +42 -0
  44. package/fullstacked_modules/zod/src/v4/classic/tests/error-utils.test.ts +70 -2
  45. package/fullstacked_modules/zod/src/v4/classic/tests/file.test.ts +9 -4
  46. package/fullstacked_modules/zod/src/v4/classic/tests/firstparty.test.ts +4 -0
  47. package/fullstacked_modules/zod/src/v4/classic/tests/function.test.ts +71 -31
  48. package/fullstacked_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
  49. package/fullstacked_modules/zod/src/v4/classic/tests/index.test.ts +15 -0
  50. package/fullstacked_modules/zod/src/v4/classic/tests/literal.test.ts +25 -0
  51. package/fullstacked_modules/zod/src/v4/classic/tests/nonoptional.test.ts +15 -0
  52. package/fullstacked_modules/zod/src/v4/classic/tests/number.test.ts +23 -0
  53. package/fullstacked_modules/zod/src/v4/classic/tests/object.test.ts +48 -2
  54. package/fullstacked_modules/zod/src/v4/classic/tests/optional.test.ts +13 -0
  55. package/fullstacked_modules/zod/src/v4/classic/tests/partial.test.ts +193 -0
  56. package/fullstacked_modules/zod/src/v4/classic/tests/pickomit.test.ts +5 -5
  57. package/fullstacked_modules/zod/src/v4/classic/tests/pipe.test.ts +25 -5
  58. package/fullstacked_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  59. package/fullstacked_modules/zod/src/v4/classic/tests/preprocess.test.ts +5 -21
  60. package/fullstacked_modules/zod/src/v4/classic/tests/record.test.ts +15 -1
  61. package/fullstacked_modules/zod/src/v4/classic/tests/recursive-types.test.ts +226 -0
  62. package/fullstacked_modules/zod/src/v4/classic/tests/refine.test.ts +78 -5
  63. package/fullstacked_modules/zod/src/v4/classic/tests/set.test.ts +5 -3
  64. package/fullstacked_modules/zod/src/v4/classic/tests/string-formats.test.ts +16 -0
  65. package/fullstacked_modules/zod/src/v4/classic/tests/string.test.ts +204 -5
  66. package/fullstacked_modules/zod/src/v4/classic/tests/stringbool.test.ts +40 -0
  67. package/fullstacked_modules/zod/src/v4/classic/tests/template-literal.test.ts +14 -9
  68. package/fullstacked_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +315 -7
  69. package/fullstacked_modules/zod/src/v4/classic/tests/transform.test.ts +111 -0
  70. package/fullstacked_modules/zod/src/v4/classic/tests/tuple.test.ts +2 -2
  71. package/fullstacked_modules/zod/src/v4/classic/tests/union.test.ts +90 -3
  72. package/fullstacked_modules/zod/src/v4/core/api.ts +160 -133
  73. package/fullstacked_modules/zod/src/v4/core/checks.ts +6 -2
  74. package/fullstacked_modules/zod/src/v4/core/core.ts +9 -28
  75. package/fullstacked_modules/zod/src/v4/core/doc.ts +2 -2
  76. package/fullstacked_modules/zod/src/v4/core/errors.ts +49 -60
  77. package/fullstacked_modules/zod/src/v4/core/index.ts +0 -1
  78. package/fullstacked_modules/zod/src/v4/core/json-schema.ts +7 -3
  79. package/fullstacked_modules/zod/src/v4/core/parse.ts +101 -0
  80. package/fullstacked_modules/zod/src/v4/core/regexes.ts +56 -14
  81. package/fullstacked_modules/zod/src/v4/core/registries.ts +5 -4
  82. package/fullstacked_modules/zod/src/v4/core/schemas.ts +705 -230
  83. package/fullstacked_modules/zod/src/v4/core/tests/extend.test.ts +18 -0
  84. package/fullstacked_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
  85. package/fullstacked_modules/zod/src/v4/core/to-json-schema.ts +100 -33
  86. package/fullstacked_modules/zod/src/v4/core/util.ts +237 -102
  87. package/fullstacked_modules/zod/src/v4/core/versions.ts +2 -2
  88. package/fullstacked_modules/zod/src/v4/locales/bg.ts +136 -0
  89. package/fullstacked_modules/zod/src/v4/locales/da.ts +141 -0
  90. package/fullstacked_modules/zod/src/v4/locales/es.ts +44 -10
  91. package/fullstacked_modules/zod/src/v4/locales/index.ts +8 -0
  92. package/fullstacked_modules/zod/src/v4/locales/is.ts +127 -0
  93. package/fullstacked_modules/zod/src/v4/locales/ka.ts +138 -0
  94. package/fullstacked_modules/zod/src/v4/locales/kh.ts +3 -122
  95. package/fullstacked_modules/zod/src/v4/locales/km.ts +126 -0
  96. package/fullstacked_modules/zod/src/v4/locales/lt.ts +265 -0
  97. package/fullstacked_modules/zod/src/v4/locales/ua.ts +3 -122
  98. package/fullstacked_modules/zod/src/v4/locales/uk.ts +126 -0
  99. package/fullstacked_modules/zod/src/v4/locales/yo.ts +131 -0
  100. package/fullstacked_modules/zod/src/v4/mini/external.ts +1 -1
  101. package/fullstacked_modules/zod/src/v4/mini/parse.ts +14 -1
  102. package/fullstacked_modules/zod/src/v4/mini/schemas.ts +186 -40
  103. package/fullstacked_modules/zod/src/v4/mini/tests/assignability.test.ts +1 -1
  104. package/fullstacked_modules/zod/src/v4/mini/tests/codec.test.ts +529 -0
  105. package/fullstacked_modules/zod/src/v4/mini/tests/computed.test.ts +1 -1
  106. package/fullstacked_modules/zod/src/v4/mini/tests/error.test.ts +1 -1
  107. package/fullstacked_modules/zod/src/v4/mini/tests/index.test.ts +29 -1
  108. package/fullstacked_modules/zod/src/v4/mini/tests/number.test.ts +1 -1
  109. package/fullstacked_modules/zod/src/v4/mini/tests/object.test.ts +16 -1
  110. package/fullstacked_modules/zod/src/v4/mini/tests/prototypes.test.ts +1 -1
  111. package/fullstacked_modules/zod/src/v4/mini/tests/recursive-types.test.ts +1 -1
  112. package/fullstacked_modules/zod/src/v4/mini/tests/string.test.ts +17 -1
  113. package/fullstacked_modules/zod/v3/ZodError.cjs +1 -1
  114. package/fullstacked_modules/zod/v3/ZodError.d.cts +6 -6
  115. package/fullstacked_modules/zod/v3/ZodError.d.ts +6 -6
  116. package/fullstacked_modules/zod/v3/ZodError.js +1 -1
  117. package/fullstacked_modules/zod/v3/locales/en.cjs +1 -0
  118. package/fullstacked_modules/zod/v3/locales/en.d.cts +1 -1
  119. package/fullstacked_modules/zod/v3/package.json +6 -0
  120. package/fullstacked_modules/zod/v3/types.cjs +2 -0
  121. package/fullstacked_modules/zod/v3/types.d.cts +4 -1
  122. package/fullstacked_modules/zod/v3/types.d.ts +4 -1
  123. package/fullstacked_modules/zod/v3/types.js +2 -0
  124. package/fullstacked_modules/zod/v4/classic/checks.d.cts +1 -1
  125. package/fullstacked_modules/zod/v4/classic/checks.d.ts +1 -1
  126. package/fullstacked_modules/zod/v4/classic/compat.cjs +5 -1
  127. package/fullstacked_modules/zod/v4/classic/compat.d.cts +4 -0
  128. package/fullstacked_modules/zod/v4/classic/compat.d.ts +4 -0
  129. package/fullstacked_modules/zod/v4/classic/compat.js +4 -0
  130. package/fullstacked_modules/zod/v4/classic/errors.cjs +9 -2
  131. package/fullstacked_modules/zod/v4/classic/errors.js +9 -2
  132. package/fullstacked_modules/zod/v4/classic/external.cjs +2 -2
  133. package/fullstacked_modules/zod/v4/classic/external.d.cts +1 -1
  134. package/fullstacked_modules/zod/v4/classic/external.d.ts +1 -1
  135. package/fullstacked_modules/zod/v4/classic/external.js +1 -1
  136. package/fullstacked_modules/zod/v4/classic/package.json +6 -0
  137. package/fullstacked_modules/zod/v4/classic/parse.cjs +10 -1
  138. package/fullstacked_modules/zod/v4/classic/parse.d.cts +8 -0
  139. package/fullstacked_modules/zod/v4/classic/parse.d.ts +8 -0
  140. package/fullstacked_modules/zod/v4/classic/parse.js +9 -0
  141. package/fullstacked_modules/zod/v4/classic/schemas.cjs +90 -48
  142. package/fullstacked_modules/zod/v4/classic/schemas.d.cts +70 -27
  143. package/fullstacked_modules/zod/v4/classic/schemas.d.ts +70 -27
  144. package/fullstacked_modules/zod/v4/classic/schemas.js +81 -47
  145. package/fullstacked_modules/zod/v4/core/api.cjs +52 -31
  146. package/fullstacked_modules/zod/v4/core/api.d.cts +87 -76
  147. package/fullstacked_modules/zod/v4/core/api.d.ts +87 -76
  148. package/fullstacked_modules/zod/v4/core/api.js +50 -31
  149. package/fullstacked_modules/zod/v4/core/checks.cjs +4 -0
  150. package/fullstacked_modules/zod/v4/core/checks.d.cts +2 -2
  151. package/fullstacked_modules/zod/v4/core/checks.d.ts +2 -2
  152. package/fullstacked_modules/zod/v4/core/checks.js +4 -0
  153. package/fullstacked_modules/zod/v4/core/core.cjs +8 -1
  154. package/fullstacked_modules/zod/v4/core/core.d.cts +5 -2
  155. package/fullstacked_modules/zod/v4/core/core.d.ts +5 -2
  156. package/fullstacked_modules/zod/v4/core/core.js +6 -0
  157. package/fullstacked_modules/zod/v4/core/doc.d.cts +1 -1
  158. package/fullstacked_modules/zod/v4/core/doc.d.ts +1 -1
  159. package/fullstacked_modules/zod/v4/core/errors.cjs +6 -19
  160. package/fullstacked_modules/zod/v4/core/errors.d.cts +24 -22
  161. package/fullstacked_modules/zod/v4/core/errors.d.ts +24 -22
  162. package/fullstacked_modules/zod/v4/core/errors.js +6 -19
  163. package/fullstacked_modules/zod/v4/core/index.cjs +0 -1
  164. package/fullstacked_modules/zod/v4/core/index.d.cts +0 -1
  165. package/fullstacked_modules/zod/v4/core/index.d.ts +0 -1
  166. package/fullstacked_modules/zod/v4/core/index.js +0 -1
  167. package/fullstacked_modules/zod/v4/core/json-schema.d.cts +4 -3
  168. package/fullstacked_modules/zod/v4/core/json-schema.d.ts +4 -3
  169. package/fullstacked_modules/zod/v4/core/package.json +6 -0
  170. package/fullstacked_modules/zod/v4/core/parse.cjs +45 -1
  171. package/fullstacked_modules/zod/v4/core/parse.d.cts +24 -0
  172. package/fullstacked_modules/zod/v4/core/parse.d.ts +24 -0
  173. package/fullstacked_modules/zod/v4/core/parse.js +36 -0
  174. package/fullstacked_modules/zod/v4/core/regexes.cjs +49 -16
  175. package/fullstacked_modules/zod/v4/core/regexes.d.cts +18 -2
  176. package/fullstacked_modules/zod/v4/core/regexes.d.ts +18 -2
  177. package/fullstacked_modules/zod/v4/core/regexes.js +46 -14
  178. package/fullstacked_modules/zod/v4/core/registries.cjs +4 -3
  179. package/fullstacked_modules/zod/v4/core/registries.d.cts +2 -2
  180. package/fullstacked_modules/zod/v4/core/registries.d.ts +2 -2
  181. package/fullstacked_modules/zod/v4/core/registries.js +4 -3
  182. package/fullstacked_modules/zod/v4/core/schemas.cjs +409 -171
  183. package/fullstacked_modules/zod/v4/core/schemas.d.cts +88 -16
  184. package/fullstacked_modules/zod/v4/core/schemas.d.ts +88 -16
  185. package/fullstacked_modules/zod/v4/core/schemas.js +408 -170
  186. package/fullstacked_modules/zod/v4/core/to-json-schema.cjs +97 -31
  187. package/fullstacked_modules/zod/v4/core/to-json-schema.d.cts +5 -3
  188. package/fullstacked_modules/zod/v4/core/to-json-schema.d.ts +5 -3
  189. package/fullstacked_modules/zod/v4/core/to-json-schema.js +97 -31
  190. package/fullstacked_modules/zod/v4/core/util.cjs +220 -101
  191. package/fullstacked_modules/zod/v4/core/util.d.cts +14 -0
  192. package/fullstacked_modules/zod/v4/core/util.d.ts +14 -0
  193. package/fullstacked_modules/zod/v4/core/util.js +209 -101
  194. package/fullstacked_modules/zod/v4/core/versions.cjs +2 -2
  195. package/fullstacked_modules/zod/v4/core/versions.d.cts +1 -1
  196. package/fullstacked_modules/zod/v4/core/versions.d.ts +1 -1
  197. package/fullstacked_modules/zod/v4/core/versions.js +2 -2
  198. package/fullstacked_modules/zod/v4/locales/ar.cjs +1 -0
  199. package/fullstacked_modules/zod/v4/locales/ar.d.cts +2 -1
  200. package/fullstacked_modules/zod/v4/locales/az.cjs +1 -0
  201. package/fullstacked_modules/zod/v4/locales/az.d.cts +2 -1
  202. package/fullstacked_modules/zod/v4/locales/be.cjs +1 -0
  203. package/fullstacked_modules/zod/v4/locales/be.d.cts +2 -1
  204. package/fullstacked_modules/zod/v4/locales/bg.cjs +156 -0
  205. package/fullstacked_modules/zod/v4/locales/bg.d.cts +5 -0
  206. package/fullstacked_modules/zod/v4/locales/bg.d.ts +5 -0
  207. package/fullstacked_modules/zod/v4/locales/bg.js +128 -0
  208. package/fullstacked_modules/zod/v4/locales/ca.cjs +1 -0
  209. package/fullstacked_modules/zod/v4/locales/ca.d.cts +2 -1
  210. package/fullstacked_modules/zod/v4/locales/cs.cjs +1 -0
  211. package/fullstacked_modules/zod/v4/locales/cs.d.cts +2 -1
  212. package/fullstacked_modules/zod/v4/locales/da.cjs +158 -0
  213. package/fullstacked_modules/zod/v4/locales/da.d.cts +5 -0
  214. package/fullstacked_modules/zod/v4/locales/da.d.ts +4 -0
  215. package/fullstacked_modules/zod/v4/locales/da.js +131 -0
  216. package/fullstacked_modules/zod/v4/locales/de.cjs +1 -0
  217. package/fullstacked_modules/zod/v4/locales/de.d.cts +2 -1
  218. package/fullstacked_modules/zod/v4/locales/es.cjs +43 -10
  219. package/fullstacked_modules/zod/v4/locales/es.d.cts +2 -1
  220. package/fullstacked_modules/zod/v4/locales/es.js +42 -10
  221. package/fullstacked_modules/zod/v4/locales/fa.cjs +1 -0
  222. package/fullstacked_modules/zod/v4/locales/fa.d.cts +2 -1
  223. package/fullstacked_modules/zod/v4/locales/fi.cjs +1 -0
  224. package/fullstacked_modules/zod/v4/locales/fi.d.cts +2 -1
  225. package/fullstacked_modules/zod/v4/locales/fr-CA.cjs +1 -0
  226. package/fullstacked_modules/zod/v4/locales/fr-CA.d.cts +2 -1
  227. package/fullstacked_modules/zod/v4/locales/fr.cjs +1 -0
  228. package/fullstacked_modules/zod/v4/locales/fr.d.cts +2 -1
  229. package/fullstacked_modules/zod/v4/locales/he.cjs +1 -0
  230. package/fullstacked_modules/zod/v4/locales/he.d.cts +2 -1
  231. package/fullstacked_modules/zod/v4/locales/hu.cjs +1 -0
  232. package/fullstacked_modules/zod/v4/locales/hu.d.cts +2 -1
  233. package/fullstacked_modules/zod/v4/locales/id.cjs +1 -0
  234. package/fullstacked_modules/zod/v4/locales/id.d.cts +2 -1
  235. package/fullstacked_modules/zod/v4/locales/index.cjs +17 -1
  236. package/fullstacked_modules/zod/v4/locales/index.d.cts +8 -0
  237. package/fullstacked_modules/zod/v4/locales/index.d.ts +8 -0
  238. package/fullstacked_modules/zod/v4/locales/index.js +8 -0
  239. package/fullstacked_modules/zod/v4/locales/is.cjs +145 -0
  240. package/fullstacked_modules/zod/v4/locales/is.d.cts +5 -0
  241. package/fullstacked_modules/zod/v4/locales/is.d.ts +5 -0
  242. package/fullstacked_modules/zod/v4/locales/is.js +117 -0
  243. package/fullstacked_modules/zod/v4/locales/it.cjs +1 -0
  244. package/fullstacked_modules/zod/v4/locales/it.d.cts +2 -1
  245. package/fullstacked_modules/zod/v4/locales/ja.cjs +1 -0
  246. package/fullstacked_modules/zod/v4/locales/ja.d.cts +2 -1
  247. package/fullstacked_modules/zod/v4/locales/ka.cjs +153 -0
  248. package/fullstacked_modules/zod/v4/locales/ka.d.cts +5 -0
  249. package/fullstacked_modules/zod/v4/locales/ka.d.ts +5 -0
  250. package/fullstacked_modules/zod/v4/locales/ka.js +125 -0
  251. package/fullstacked_modules/zod/v4/locales/kh.cjs +6 -137
  252. package/fullstacked_modules/zod/v4/locales/kh.d.cts +2 -1
  253. package/fullstacked_modules/zod/v4/locales/kh.d.ts +1 -0
  254. package/fullstacked_modules/zod/v4/locales/kh.js +3 -115
  255. package/fullstacked_modules/zod/v4/locales/km.cjs +144 -0
  256. package/fullstacked_modules/zod/v4/locales/km.d.cts +5 -0
  257. package/fullstacked_modules/zod/v4/locales/km.d.ts +4 -0
  258. package/fullstacked_modules/zod/v4/locales/km.js +117 -0
  259. package/fullstacked_modules/zod/v4/locales/ko.cjs +1 -0
  260. package/fullstacked_modules/zod/v4/locales/ko.d.cts +2 -1
  261. package/fullstacked_modules/zod/v4/locales/lt.cjs +258 -0
  262. package/fullstacked_modules/zod/v4/locales/lt.d.cts +5 -0
  263. package/fullstacked_modules/zod/v4/locales/lt.d.ts +5 -0
  264. package/fullstacked_modules/zod/v4/locales/lt.js +230 -0
  265. package/fullstacked_modules/zod/v4/locales/mk.cjs +1 -0
  266. package/fullstacked_modules/zod/v4/locales/mk.d.cts +2 -1
  267. package/fullstacked_modules/zod/v4/locales/ms.cjs +1 -0
  268. package/fullstacked_modules/zod/v4/locales/ms.d.cts +2 -1
  269. package/fullstacked_modules/zod/v4/locales/nl.cjs +1 -0
  270. package/fullstacked_modules/zod/v4/locales/nl.d.cts +2 -1
  271. package/fullstacked_modules/zod/v4/locales/no.cjs +1 -0
  272. package/fullstacked_modules/zod/v4/locales/no.d.cts +2 -1
  273. package/fullstacked_modules/zod/v4/locales/ota.cjs +1 -0
  274. package/fullstacked_modules/zod/v4/locales/ota.d.cts +2 -1
  275. package/fullstacked_modules/zod/v4/locales/package.json +6 -0
  276. package/fullstacked_modules/zod/v4/locales/pl.cjs +1 -0
  277. package/fullstacked_modules/zod/v4/locales/pl.d.cts +2 -1
  278. package/fullstacked_modules/zod/v4/locales/ps.cjs +1 -0
  279. package/fullstacked_modules/zod/v4/locales/ps.d.cts +2 -1
  280. package/fullstacked_modules/zod/v4/locales/pt.cjs +1 -0
  281. package/fullstacked_modules/zod/v4/locales/pt.d.cts +2 -1
  282. package/fullstacked_modules/zod/v4/locales/ru.cjs +1 -0
  283. package/fullstacked_modules/zod/v4/locales/ru.d.cts +2 -1
  284. package/fullstacked_modules/zod/v4/locales/sl.cjs +1 -0
  285. package/fullstacked_modules/zod/v4/locales/sl.d.cts +2 -1
  286. package/fullstacked_modules/zod/v4/locales/sv.cjs +1 -0
  287. package/fullstacked_modules/zod/v4/locales/sv.d.cts +2 -1
  288. package/fullstacked_modules/zod/v4/locales/ta.cjs +1 -0
  289. package/fullstacked_modules/zod/v4/locales/ta.d.cts +2 -1
  290. package/fullstacked_modules/zod/v4/locales/th.cjs +1 -0
  291. package/fullstacked_modules/zod/v4/locales/th.d.cts +2 -1
  292. package/fullstacked_modules/zod/v4/locales/ua.cjs +6 -137
  293. package/fullstacked_modules/zod/v4/locales/ua.d.cts +2 -1
  294. package/fullstacked_modules/zod/v4/locales/ua.d.ts +1 -0
  295. package/fullstacked_modules/zod/v4/locales/ua.js +3 -115
  296. package/fullstacked_modules/zod/v4/locales/uk.cjs +144 -0
  297. package/fullstacked_modules/zod/v4/locales/uk.d.cts +5 -0
  298. package/fullstacked_modules/zod/v4/locales/uk.d.ts +4 -0
  299. package/fullstacked_modules/zod/v4/locales/uk.js +117 -0
  300. package/fullstacked_modules/zod/v4/locales/ur.cjs +1 -0
  301. package/fullstacked_modules/zod/v4/locales/ur.d.cts +2 -1
  302. package/fullstacked_modules/zod/v4/locales/vi.cjs +1 -0
  303. package/fullstacked_modules/zod/v4/locales/vi.d.cts +2 -1
  304. package/fullstacked_modules/zod/v4/locales/yo.cjs +142 -0
  305. package/fullstacked_modules/zod/v4/locales/yo.d.cts +5 -0
  306. package/fullstacked_modules/zod/v4/locales/yo.d.ts +4 -0
  307. package/fullstacked_modules/zod/v4/locales/yo.js +115 -0
  308. package/fullstacked_modules/zod/v4/locales/zh-CN.cjs +1 -0
  309. package/fullstacked_modules/zod/v4/locales/zh-CN.d.cts +2 -1
  310. package/fullstacked_modules/zod/v4/locales/zh-TW.cjs +1 -0
  311. package/fullstacked_modules/zod/v4/locales/zh-TW.d.cts +2 -1
  312. package/fullstacked_modules/zod/v4/mini/external.cjs +2 -2
  313. package/fullstacked_modules/zod/v4/mini/external.d.cts +1 -1
  314. package/fullstacked_modules/zod/v4/mini/external.d.ts +1 -1
  315. package/fullstacked_modules/zod/v4/mini/external.js +1 -1
  316. package/fullstacked_modules/zod/v4/mini/package.json +6 -0
  317. package/fullstacked_modules/zod/v4/mini/parse.cjs +9 -1
  318. package/fullstacked_modules/zod/v4/mini/parse.d.cts +1 -1
  319. package/fullstacked_modules/zod/v4/mini/parse.d.ts +1 -1
  320. package/fullstacked_modules/zod/v4/mini/parse.js +1 -1
  321. package/fullstacked_modules/zod/v4/mini/schemas.cjs +77 -24
  322. package/fullstacked_modules/zod/v4/mini/schemas.d.cts +56 -5
  323. package/fullstacked_modules/zod/v4/mini/schemas.d.ts +56 -5
  324. package/fullstacked_modules/zod/v4/mini/schemas.js +66 -23
  325. package/fullstacked_modules/zod/v4/package.json +6 -0
  326. package/fullstacked_modules/zod/v4-mini/package.json +6 -0
  327. package/index.js +1 -1
  328. package/package.json +1 -1
  329. package/fullstacked_modules/@fullstacked/ai-agent/story.txt +0 -7
  330. package/fullstacked_modules/@fullstacked/ai-agent/summary.txt +0 -7
  331. package/fullstacked_modules/zod/src/v4/core/function.ts +0 -176
  332. package/fullstacked_modules/zod/v4/core/function.cjs +0 -102
  333. package/fullstacked_modules/zod/v4/core/function.d.cts +0 -52
  334. package/fullstacked_modules/zod/v4/core/function.d.ts +0 -52
  335. package/fullstacked_modules/zod/v4/core/function.js +0 -75
@@ -3,7 +3,7 @@ import * as checks from "./checks.js";
3
3
  import * as core from "./core.js";
4
4
  import { Doc } from "./doc.js";
5
5
  import type * as errors from "./errors.js";
6
- import { safeParse, safeParseAsync } from "./parse.js";
6
+ import { parse, parseAsync, safeParse, safeParseAsync } from "./parse.js";
7
7
  import * as regexes from "./regexes.js";
8
8
  import type { StandardSchemaV1 } from "./standard-schema.js";
9
9
  import * as util from "./util.js";
@@ -25,11 +25,15 @@ export interface ParseContext<T extends errors.$ZodIssueBase = never> {
25
25
  /** @internal */
26
26
  export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> extends ParseContext<T> {
27
27
  readonly async?: boolean | undefined;
28
+ readonly direction?: "forward" | "backward";
29
+ readonly skipChecks?: boolean;
28
30
  }
29
31
 
30
32
  export interface ParsePayload<T = unknown> {
31
33
  value: T;
32
34
  issues: errors.$ZodRawIssue[];
35
+ /** A may to mark a whole payload as aborted. Used in codecs/pipes. */
36
+ aborted?: boolean;
33
37
  }
34
38
 
35
39
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
@@ -76,6 +80,7 @@ export interface $ZodTypeDef {
76
80
  | "template_literal"
77
81
  | "promise"
78
82
  | "lazy"
83
+ | "function"
79
84
  | "custom";
80
85
  error?: errors.$ZodErrorMap<never> | undefined;
81
86
  checks?: checks.$ZodCheck<never>[];
@@ -121,6 +126,9 @@ export interface _$ZodTypeInternals {
121
126
  */
122
127
  values?: util.PrimitiveSet | undefined;
123
128
 
129
+ /** Default value bubbled up from */
130
+ // default?: unknown | undefined;
131
+
124
132
  /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
125
133
  propValues?: util.PropValues | undefined;
126
134
 
@@ -165,9 +173,7 @@ export interface $ZodType<
165
173
  "~standard": $ZodStandardSchema<this>;
166
174
  }
167
175
  export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
168
- extends $ZodType<T["output"], T["input"], T> {
169
- // _zod: T;
170
- }
176
+ extends $ZodType<T["output"], T["input"], T> {}
171
177
 
172
178
  export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
173
179
  inst ??= {} as any;
@@ -182,7 +188,6 @@ export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constru
182
188
  if (inst._zod.traits.has("$ZodCheck")) {
183
189
  checks.unshift(inst as any);
184
190
  }
185
- //
186
191
 
187
192
  for (const ch of checks) {
188
193
  for (const fn of ch._zod.onattach) {
@@ -241,9 +246,52 @@ export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constru
241
246
  return payload;
242
247
  };
243
248
 
249
+ // const handleChecksResult = (
250
+ // checkResult: ParsePayload,
251
+ // originalResult: ParsePayload,
252
+ // ctx: ParseContextInternal
253
+ // ): util.MaybeAsync<ParsePayload> => {
254
+ // // if the checks mutated the value && there are no issues, re-parse the result
255
+ // if (checkResult.value !== originalResult.value && !checkResult.issues.length)
256
+ // return inst._zod.parse(checkResult, ctx);
257
+ // return originalResult;
258
+ // };
259
+ const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
260
+ // abort if the canary is aborted
261
+ if (util.aborted(canary)) {
262
+ canary.aborted = true;
263
+ return canary;
264
+ }
265
+
266
+ // run checks first, then
267
+ const checkResult = runChecks(payload, checks, ctx);
268
+ if (checkResult instanceof Promise) {
269
+ if (ctx.async === false) throw new core.$ZodAsyncError();
270
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
271
+ }
272
+ return inst._zod.parse(checkResult, ctx);
273
+ };
274
+
244
275
  inst._zod.run = (payload, ctx) => {
245
- const result = inst._zod.parse(payload, ctx);
276
+ if (ctx.skipChecks) {
277
+ return inst._zod.parse(payload, ctx);
278
+ }
279
+ if (ctx.direction === "backward") {
280
+ // run canary
281
+ // initial pass (no checks)
282
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
283
+
284
+ if (canary instanceof Promise) {
285
+ return canary.then((canary) => {
286
+ return handleCanaryResult(canary, payload, ctx);
287
+ });
288
+ }
289
+
290
+ return handleCanaryResult(canary, payload, ctx);
291
+ }
246
292
 
293
+ // forward
294
+ const result = inst._zod.parse(payload, ctx);
247
295
  if (result instanceof Promise) {
248
296
  if (ctx.async === false) throw new core.$ZodAsyncError();
249
297
  return result.then((result) => runChecks(result, checks, ctx));
@@ -316,6 +364,7 @@ export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$con
316
364
  payload.issues.push({
317
365
  expected: "string",
318
366
  code: "invalid_type",
367
+
319
368
  input: payload.value,
320
369
  inst,
321
370
  });
@@ -414,6 +463,7 @@ export const $ZodEmail: core.$constructor<$ZodEmail> = /*@__PURE__*/ core.$const
414
463
  export interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
415
464
  hostname?: RegExp | undefined;
416
465
  protocol?: RegExp | undefined;
466
+ normalize?: boolean | undefined;
417
467
  }
418
468
  export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
419
469
  def: $ZodURLDef;
@@ -427,9 +477,10 @@ export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$construct
427
477
  $ZodStringFormat.init(inst, def);
428
478
  inst._zod.check = (payload) => {
429
479
  try {
430
- const orig = payload.value;
431
- const url = new URL(orig);
432
- const href = url.href;
480
+ // Trim whitespace from input
481
+ const trimmed = payload.value.trim();
482
+ // @ts-ignore
483
+ const url = new URL(trimmed);
433
484
 
434
485
  if (def.hostname) {
435
486
  def.hostname.lastIndex = 0;
@@ -461,11 +512,13 @@ export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$construct
461
512
  }
462
513
  }
463
514
 
464
- // payload.value = url.href;
465
- if (!orig.endsWith("/") && href.endsWith("/")) {
466
- payload.value = href.slice(0, -1);
515
+ // Set the output value based on normalize flag
516
+ if (def.normalize) {
517
+ // Use normalized URL
518
+ payload.value = url.href;
467
519
  } else {
468
- payload.value = href;
520
+ // Preserve the original input (trimmed)
521
+ payload.value = trimmed;
469
522
  }
470
523
 
471
524
  return;
@@ -719,6 +772,7 @@ export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constru
719
772
 
720
773
  inst._zod.check = (payload) => {
721
774
  try {
775
+ // @ts-ignore
722
776
  new URL(`http://[${payload.value}]`);
723
777
  // return;
724
778
  } catch {
@@ -776,12 +830,15 @@ export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$con
776
830
  $ZodStringFormat.init(inst, def);
777
831
 
778
832
  inst._zod.check = (payload) => {
779
- const [address, prefix] = payload.value.split("/");
833
+ const parts = payload.value.split("/");
780
834
  try {
835
+ if (parts.length !== 2) throw new Error();
836
+ const [address, prefix] = parts;
781
837
  if (!prefix) throw new Error();
782
838
  const prefixNum = Number(prefix);
783
839
  if (`${prefixNum}` !== prefix) throw new Error();
784
840
  if (prefixNum < 0 || prefixNum > 128) throw new Error();
841
+ // @ts-ignore
785
842
  new URL(`http://[${address}]`);
786
843
  } catch {
787
844
  payload.issues.push({
@@ -801,6 +858,7 @@ export function isValidBase64(data: string): boolean {
801
858
  if (data === "") return true;
802
859
  if (data.length % 4 !== 0) return false;
803
860
  try {
861
+ // @ts-ignore
804
862
  atob(data);
805
863
  return true;
806
864
  } catch {
@@ -900,6 +958,7 @@ export function isValidJWT(token: string, algorithm: util.JWTAlgorithm | null =
900
958
  if (tokensParts.length !== 3) return false;
901
959
  const [header] = tokensParts;
902
960
  if (!header) return false;
961
+ // @ts-ignore
903
962
  const parsedHeader = JSON.parse(atob(header));
904
963
  if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
905
964
  if (!parsedHeader.alg) return false;
@@ -1030,6 +1089,7 @@ export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$con
1030
1089
  payload.issues.push({
1031
1090
  expected: "number",
1032
1091
  code: "invalid_type",
1092
+
1033
1093
  input,
1034
1094
  inst,
1035
1095
  ...(received ? { received } : {}),
@@ -1100,6 +1160,7 @@ export const $ZodBoolean: core.$constructor<$ZodBoolean> = /*@__PURE__*/ core.$c
1100
1160
  payload.issues.push({
1101
1161
  expected: "boolean",
1102
1162
  code: "invalid_type",
1163
+
1103
1164
  input,
1104
1165
  inst,
1105
1166
  });
@@ -1152,6 +1213,7 @@ export const $ZodBigInt: core.$constructor<$ZodBigInt> = /*@__PURE__*/ core.$con
1152
1213
  payload.issues.push({
1153
1214
  expected: "bigint",
1154
1215
  code: "invalid_type",
1216
+
1155
1217
  input: payload.value,
1156
1218
  inst,
1157
1219
  });
@@ -1211,6 +1273,7 @@ export const $ZodSymbol: core.$constructor<$ZodSymbol> = /*@__PURE__*/ core.$con
1211
1273
  payload.issues.push({
1212
1274
  expected: "symbol",
1213
1275
  code: "invalid_type",
1276
+
1214
1277
  input,
1215
1278
  inst,
1216
1279
  });
@@ -1255,6 +1318,7 @@ export const $ZodUndefined: core.$constructor<$ZodUndefined> = /*@__PURE__*/ cor
1255
1318
  payload.issues.push({
1256
1319
  expected: "undefined",
1257
1320
  code: "invalid_type",
1321
+
1258
1322
  input,
1259
1323
  inst,
1260
1324
  });
@@ -1297,6 +1361,7 @@ export const $ZodNull: core.$constructor<$ZodNull> = /*@__PURE__*/ core.$constru
1297
1361
  payload.issues.push({
1298
1362
  expected: "null",
1299
1363
  code: "invalid_type",
1364
+
1300
1365
  input,
1301
1366
  inst,
1302
1367
  });
@@ -1388,6 +1453,7 @@ export const $ZodNever: core.$constructor<$ZodNever> = /*@__PURE__*/ core.$const
1388
1453
  payload.issues.push({
1389
1454
  expected: "never",
1390
1455
  code: "invalid_type",
1456
+
1391
1457
  input: payload.value,
1392
1458
  inst,
1393
1459
  });
@@ -1425,6 +1491,7 @@ export const $ZodVoid: core.$constructor<$ZodVoid> = /*@__PURE__*/ core.$constru
1425
1491
  payload.issues.push({
1426
1492
  expected: "void",
1427
1493
  code: "invalid_type",
1494
+
1428
1495
  input,
1429
1496
  inst,
1430
1497
  });
@@ -1475,6 +1542,7 @@ export const $ZodDate: core.$constructor<$ZodDate> = /*@__PURE__*/ core.$constru
1475
1542
  payload.issues.push({
1476
1543
  expected: "date",
1477
1544
  code: "invalid_type",
1545
+
1478
1546
  input,
1479
1547
  ...(isDate ? { received: "Invalid Date" } : {}),
1480
1548
  inst,
@@ -1524,6 +1592,7 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1524
1592
  payload.issues.push({
1525
1593
  expected: "array",
1526
1594
  code: "invalid_type",
1595
+
1527
1596
  input,
1528
1597
  inst,
1529
1598
  });
@@ -1582,6 +1651,36 @@ export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<st
1582
1651
  } & Extra
1583
1652
  >;
1584
1653
 
1654
+ // experimental
1655
+ // export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = keyof (T &
1656
+ // Extra) extends never
1657
+ // ? Record<string, never>
1658
+ // : string extends keyof T
1659
+ // ? util.Prettify<
1660
+ // {
1661
+ // [k: string]: util.IsAny<T[string]["_zod"]["output"]> extends true ? unknown : T[string]["_zod"]["output"];
1662
+ // } & $InferObjectOutputNoIndex<util.OmitIndexSignature<T>, Extra>
1663
+ // >
1664
+ // : util.Prettify<$InferObjectOutputNoIndex<T, Extra>>;
1665
+
1666
+ // export type $InferObjectOutputNoIndex<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = {
1667
+ // [k in keyof T as string extends k
1668
+ // ? never
1669
+ // : k extends string
1670
+ // ? T[k] extends OptionalOutSchema
1671
+ // ? never
1672
+ // : k
1673
+ // : never]: T[k]["_zod"]["output"];
1674
+ // } & {
1675
+ // [k in keyof T as string extends k
1676
+ // ? never
1677
+ // : k extends string
1678
+ // ? T[k] extends OptionalOutSchema
1679
+ // ? k
1680
+ // : never
1681
+ // : never]?: T[k]["_zod"]["output"];
1682
+ // } & Extra;
1683
+
1585
1684
  export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1586
1685
  ? util.IsAny<T[keyof T]> extends true
1587
1686
  ? Record<string, unknown>
@@ -1596,33 +1695,16 @@ export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<str
1596
1695
  } & Extra
1597
1696
  >;
1598
1697
 
1599
- function handleObjectResult(result: ParsePayload, final: ParsePayload, key: PropertyKey) {
1600
- // if(isOptional)
1698
+ function handlePropertyResult(result: ParsePayload, final: ParsePayload, key: PropertyKey, input: any) {
1601
1699
  if (result.issues.length) {
1602
1700
  final.issues.push(...util.prefixIssues(key, result.issues));
1603
1701
  }
1604
1702
 
1605
- (final.value as any)[key] = result.value;
1606
- }
1607
-
1608
- function handleOptionalObjectResult(result: ParsePayload, final: ParsePayload, key: PropertyKey, input: any) {
1609
- if (result.issues.length) {
1610
- // validation failed against value schema
1611
- if (input[key] === undefined) {
1612
- // if input was undefined, ignore the error
1613
- if (key in input) {
1614
- (final.value as any)[key] = undefined;
1615
- } else {
1616
- (final.value as any)[key] = result.value;
1617
- }
1618
- } else {
1619
- final.issues.push(...util.prefixIssues(key, result.issues));
1703
+ if (result.value === undefined) {
1704
+ if (key in input) {
1705
+ (final.value as any)[key] = undefined;
1620
1706
  }
1621
- } else if (result.value === undefined) {
1622
- // validation returned `undefined`
1623
- if (key in input) (final.value as any)[key] = undefined;
1624
1707
  } else {
1625
- // non-undefined value
1626
1708
  (final.value as any)[key] = result.value;
1627
1709
  }
1628
1710
  }
@@ -1657,7 +1739,7 @@ export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $Zod
1657
1739
 
1658
1740
  export interface $ZodObjectInternals<
1659
1741
  /** @ts-ignore Cast variance */
1660
- out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
1742
+ out Shape extends $ZodShape = $ZodShape,
1661
1743
  out Config extends $ZodObjectConfig = $ZodObjectConfig,
1662
1744
  > extends _$ZodTypeInternals {
1663
1745
  def: $ZodObjectDef<Shape>;
@@ -1666,6 +1748,8 @@ export interface $ZodObjectInternals<
1666
1748
  propValues: util.PropValues;
1667
1749
  output: $InferObjectOutput<Shape, Config["out"]>;
1668
1750
  input: $InferObjectInput<Shape, Config["in"]>;
1751
+ optin?: "optional" | undefined;
1752
+ optout?: "optional" | undefined;
1669
1753
  }
1670
1754
  export type $ZodLooseShape = Record<string, any>;
1671
1755
 
@@ -1677,27 +1761,87 @@ export interface $ZodObject<
1677
1761
  "~standard": $ZodStandardSchema<this>;
1678
1762
  }
1679
1763
 
1764
+ function normalizeDef(def: $ZodObjectDef) {
1765
+ const keys = Object.keys(def.shape);
1766
+ for (const k of keys) {
1767
+ if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1768
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1769
+ }
1770
+ }
1771
+ const okeys = util.optionalKeys(def.shape);
1772
+
1773
+ return {
1774
+ ...def,
1775
+ keys,
1776
+ keySet: new Set(keys),
1777
+ numKeys: keys.length,
1778
+ optionalKeys: new Set(okeys),
1779
+ };
1780
+ }
1781
+
1782
+ function handleCatchall(
1783
+ proms: Promise<any>[],
1784
+ input: any,
1785
+ payload: ParsePayload,
1786
+ ctx: ParseContext,
1787
+ def: ReturnType<typeof normalizeDef>,
1788
+ inst: $ZodObject
1789
+ ) {
1790
+ const unrecognized: string[] = [];
1791
+ // iterate over input keys
1792
+ const keySet = def.keySet;
1793
+ const _catchall = def.catchall!._zod;
1794
+ const t = _catchall.def.type;
1795
+ for (const key of Object.keys(input)) {
1796
+ if (keySet.has(key)) continue;
1797
+ if (t === "never") {
1798
+ unrecognized.push(key);
1799
+ continue;
1800
+ }
1801
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1802
+
1803
+ if (r instanceof Promise) {
1804
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1805
+ } else {
1806
+ handlePropertyResult(r, payload, key, input);
1807
+ }
1808
+ }
1809
+
1810
+ if (unrecognized.length) {
1811
+ payload.issues.push({
1812
+ code: "unrecognized_keys",
1813
+ keys: unrecognized,
1814
+ input,
1815
+ inst,
1816
+ });
1817
+ }
1818
+
1819
+ if (!proms.length) return payload;
1820
+ return Promise.all(proms).then(() => {
1821
+ return payload;
1822
+ });
1823
+ }
1824
+
1680
1825
  export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
1681
1826
  // requires cast because technically $ZodObject doesn't extend
1682
1827
  $ZodType.init(inst, def);
1828
+ // const sh = def.shape;
1829
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
1830
+ if (!desc?.get) {
1831
+ const sh = def.shape;
1832
+ Object.defineProperty(def, "shape", {
1833
+ get: () => {
1834
+ const newSh = { ...sh };
1835
+ Object.defineProperty(def, "shape", {
1836
+ value: newSh,
1837
+ });
1683
1838
 
1684
- const _normalized = util.cached(() => {
1685
- const keys = Object.keys(def.shape);
1686
- for (const k of keys) {
1687
- if (!(def.shape[k] instanceof $ZodType)) {
1688
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1689
- }
1690
- }
1691
- const okeys = util.optionalKeys(def.shape);
1692
-
1693
- return {
1694
- shape: def.shape,
1695
- keys,
1696
- keySet: new Set(keys),
1697
- numKeys: keys.length,
1698
- optionalKeys: new Set(okeys),
1699
- };
1700
- });
1839
+ return newSh;
1840
+ },
1841
+ });
1842
+ }
1843
+
1844
+ const _normalized = util.cached(() => normalizeDef(def));
1701
1845
 
1702
1846
  util.defineLazy(inst._zod, "propValues", () => {
1703
1847
  const shape = def.shape;
@@ -1712,76 +1856,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1712
1856
  return propValues;
1713
1857
  });
1714
1858
 
1715
- const generateFastpass = (shape: any) => {
1716
- const doc = new Doc(["shape", "payload", "ctx"]);
1717
- const normalized = _normalized.value;
1718
-
1719
- const parseStr = (key: string) => {
1720
- const k = util.esc(key);
1721
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1722
- };
1723
-
1724
- doc.write(`const input = payload.value;`);
1725
-
1726
- const ids: any = Object.create(null);
1727
- let counter = 0;
1728
- for (const key of normalized.keys) {
1729
- ids[key] = `key_${counter++}`;
1730
- }
1731
-
1732
- // A: preserve key order {
1733
- doc.write(`const newResult = {}`);
1734
- for (const key of normalized.keys) {
1735
- if (normalized.optionalKeys.has(key)) {
1736
- const id = ids[key];
1737
- doc.write(`const ${id} = ${parseStr(key)};`);
1738
- const k = util.esc(key);
1739
- doc.write(`
1740
- if (${id}.issues.length) {
1741
- if (input[${k}] === undefined) {
1742
- if (${k} in input) {
1743
- newResult[${k}] = undefined;
1744
- }
1745
- } else {
1746
- payload.issues = payload.issues.concat(
1747
- ${id}.issues.map((iss) => ({
1748
- ...iss,
1749
- path: iss.path ? [${k}, ...iss.path] : [${k}],
1750
- }))
1751
- );
1752
- }
1753
- } else if (${id}.value === undefined) {
1754
- if (${k} in input) newResult[${k}] = undefined;
1755
- } else {
1756
- newResult[${k}] = ${id}.value;
1757
- }
1758
- `);
1759
- } else {
1760
- const id = ids[key];
1761
- // const id = ids[key];
1762
- doc.write(`const ${id} = ${parseStr(key)};`);
1763
- doc.write(`
1764
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1765
- ...iss,
1766
- path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
1767
- })));`);
1768
- doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
1769
- }
1770
- }
1771
-
1772
- doc.write(`payload.value = newResult;`);
1773
- doc.write(`return payload;`);
1774
- const fn = doc.compile();
1775
- return (payload: any, ctx: any) => fn(shape, payload, ctx);
1776
- };
1777
-
1778
- let fastpass!: ReturnType<typeof generateFastpass>;
1779
-
1780
1859
  const isObject = util.isObject;
1781
- const jit = !core.globalConfig.jitless;
1782
- const allowsEval = util.allowsEval;
1783
-
1784
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
1785
1860
  const catchall = def.catchall;
1786
1861
 
1787
1862
  let value!: typeof _normalized.value;
@@ -1799,88 +1874,124 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1799
1874
  return payload;
1800
1875
  }
1801
1876
 
1802
- const proms: Promise<any>[] = [];
1877
+ payload.value = {};
1803
1878
 
1804
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1805
- // always synchronous
1806
- if (!fastpass) fastpass = generateFastpass(def.shape);
1807
- payload = fastpass(payload, ctx);
1808
- } else {
1809
- payload.value = {};
1879
+ const proms: Promise<any>[] = [];
1880
+ const shape = value.shape;
1810
1881
 
1811
- const shape = value.shape;
1812
- for (const key of value.keys) {
1813
- const el = shape[key]!;
1814
-
1815
- // do not add omitted optional keys
1816
- // if (!(key in input)) {
1817
- // if (optionalKeys.has(key)) continue;
1818
- // payload.issues.push({
1819
- // code: "invalid_type",
1820
- // path: [key],
1821
- // expected: "nonoptional",
1822
- // note: `Missing required key: "${key}"`,
1823
- // input,
1824
- // inst,
1825
- // });
1826
- // }
1827
-
1828
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1829
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
1830
-
1831
- if (r instanceof Promise) {
1832
- proms.push(
1833
- r.then((r) =>
1834
- isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)
1835
- )
1836
- );
1837
- } else if (isOptional) {
1838
- handleOptionalObjectResult(r, payload, key, input);
1839
- } else {
1840
- handleObjectResult(r, payload, key);
1841
- }
1882
+ for (const key of value.keys) {
1883
+ const el = shape[key]!;
1884
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1885
+ if (r instanceof Promise) {
1886
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1887
+ } else {
1888
+ handlePropertyResult(r, payload, key, input);
1842
1889
  }
1843
1890
  }
1844
1891
 
1845
1892
  if (!catchall) {
1846
- // return payload;
1847
1893
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
1848
1894
  }
1849
- const unrecognized: string[] = [];
1850
- // iterate over input keys
1851
- const keySet = value.keySet;
1852
- const _catchall = catchall._zod;
1853
- const t = _catchall.def.type;
1854
- for (const key of Object.keys(input)) {
1855
- if (keySet.has(key)) continue;
1856
- if (t === "never") {
1857
- unrecognized.push(key);
1858
- continue;
1895
+
1896
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1897
+ };
1898
+ });
1899
+
1900
+ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor(
1901
+ "$ZodObjectJIT",
1902
+ (inst, def) => {
1903
+ // requires cast because technically $ZodObject doesn't extend
1904
+ $ZodObject.init(inst, def);
1905
+
1906
+ const superParse = inst._zod.parse;
1907
+ const _normalized = util.cached(() => normalizeDef(def));
1908
+
1909
+ const generateFastpass = (shape: any) => {
1910
+ const doc = new Doc(["shape", "payload", "ctx"]);
1911
+ const normalized = _normalized.value;
1912
+
1913
+ const parseStr = (key: string) => {
1914
+ const k = util.esc(key);
1915
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1916
+ };
1917
+
1918
+ doc.write(`const input = payload.value;`);
1919
+
1920
+ const ids: any = Object.create(null);
1921
+ let counter = 0;
1922
+ for (const key of normalized.keys) {
1923
+ ids[key] = `key_${counter++}`;
1859
1924
  }
1860
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1861
1925
 
1862
- if (r instanceof Promise) {
1863
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
1864
- } else {
1865
- handleObjectResult(r, payload, key);
1926
+ // A: preserve key order {
1927
+ doc.write(`const newResult = {};`);
1928
+ for (const key of normalized.keys) {
1929
+ const id = ids[key];
1930
+ const k = util.esc(key);
1931
+ doc.write(`const ${id} = ${parseStr(key)};`);
1932
+ doc.write(`
1933
+ if (${id}.issues.length) {
1934
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1935
+ ...iss,
1936
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1937
+ })));
1938
+ }
1939
+
1940
+
1941
+ if (${id}.value === undefined) {
1942
+ if (${k} in input) {
1943
+ newResult[${k}] = undefined;
1944
+ }
1945
+ } else {
1946
+ newResult[${k}] = ${id}.value;
1947
+ }
1948
+
1949
+ `);
1866
1950
  }
1867
- }
1868
1951
 
1869
- if (unrecognized.length) {
1870
- payload.issues.push({
1871
- code: "unrecognized_keys",
1872
- keys: unrecognized,
1873
- input,
1874
- inst,
1875
- });
1876
- }
1952
+ doc.write(`payload.value = newResult;`);
1953
+ doc.write(`return payload;`);
1954
+ const fn = doc.compile();
1955
+ return (payload: any, ctx: any) => fn(shape, payload, ctx);
1956
+ };
1877
1957
 
1878
- if (!proms.length) return payload;
1879
- return Promise.all(proms).then(() => {
1880
- return payload;
1881
- });
1882
- };
1883
- });
1958
+ let fastpass!: ReturnType<typeof generateFastpass>;
1959
+
1960
+ const isObject = util.isObject;
1961
+ const jit = !core.globalConfig.jitless;
1962
+ const allowsEval = util.allowsEval;
1963
+
1964
+ const fastEnabled = jit && allowsEval.value; // && !def.catchall;
1965
+ const catchall = def.catchall;
1966
+
1967
+ let value!: typeof _normalized.value;
1968
+
1969
+ inst._zod.parse = (payload, ctx) => {
1970
+ value ??= _normalized.value;
1971
+ const input = payload.value;
1972
+ if (!isObject(input)) {
1973
+ payload.issues.push({
1974
+ expected: "object",
1975
+ code: "invalid_type",
1976
+ input,
1977
+ inst,
1978
+ });
1979
+ return payload;
1980
+ }
1981
+
1982
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1983
+ // always synchronous
1984
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1985
+ payload = fastpass(payload, ctx);
1986
+
1987
+ if (!catchall) return payload;
1988
+ return handleCatchall([], input, payload, ctx, value, inst);
1989
+ }
1990
+
1991
+ return superParse(payload, ctx);
1992
+ };
1993
+ }
1994
+ );
1884
1995
 
1885
1996
  /////////////////////////////////////////
1886
1997
  /////////////////////////////////////////
@@ -1925,8 +2036,15 @@ function handleUnionResults(results: ParsePayload[], final: ParsePayload, inst:
1925
2036
  }
1926
2037
  }
1927
2038
 
2039
+ const nonaborted = results.filter((r) => !util.aborted(r));
2040
+ if (nonaborted.length === 1) {
2041
+ final.value = nonaborted[0].value;
2042
+ return nonaborted[0];
2043
+ }
2044
+
1928
2045
  final.issues.push({
1929
2046
  code: "invalid_union",
2047
+
1930
2048
  input: final.value,
1931
2049
  inst,
1932
2050
  errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
@@ -1961,7 +2079,13 @@ export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$const
1961
2079
  return undefined;
1962
2080
  });
1963
2081
 
2082
+ const single = def.options.length === 1;
2083
+ const first = def.options[0]._zod.run;
2084
+
1964
2085
  inst._zod.parse = (payload, ctx) => {
2086
+ if (single) {
2087
+ return first(payload, ctx);
2088
+ }
1965
2089
  let async = false;
1966
2090
 
1967
2091
  const results: util.MaybeAsync<ParsePayload>[] = [];
@@ -1997,20 +2121,27 @@ export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$const
1997
2121
  //////////////////////////////////////////////////////
1998
2122
  //////////////////////////////////////////////////////
1999
2123
 
2000
- export interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]>
2001
- extends $ZodUnionDef<Options> {
2002
- discriminator: string;
2124
+ export interface $ZodDiscriminatedUnionDef<
2125
+ Options extends readonly SomeType[] = readonly $ZodType[],
2126
+ Disc extends string = string,
2127
+ > extends $ZodUnionDef<Options> {
2128
+ discriminator: Disc;
2003
2129
  unionFallback?: boolean;
2004
2130
  }
2005
2131
 
2006
- export interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[]>
2007
- extends $ZodUnionInternals<Options> {
2008
- def: $ZodDiscriminatedUnionDef<Options>;
2132
+ export interface $ZodDiscriminatedUnionInternals<
2133
+ Options extends readonly SomeType[] = readonly $ZodType[],
2134
+ Disc extends string = string,
2135
+ > extends $ZodUnionInternals<Options> {
2136
+ def: $ZodDiscriminatedUnionDef<Options, Disc>;
2009
2137
  propValues: util.PropValues;
2010
2138
  }
2011
2139
 
2012
- export interface $ZodDiscriminatedUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
2013
- _zod: $ZodDiscriminatedUnionInternals<T>;
2140
+ export interface $ZodDiscriminatedUnion<
2141
+ Options extends readonly SomeType[] = readonly $ZodType[],
2142
+ Disc extends string = string,
2143
+ > extends $ZodType {
2144
+ _zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
2014
2145
  }
2015
2146
 
2016
2147
  export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
@@ -2039,7 +2170,7 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2039
2170
  const opts = def.options as $ZodTypeDiscriminable[];
2040
2171
  const map: Map<util.Primitive, $ZodType> = new Map();
2041
2172
  for (const o of opts) {
2042
- const values = o._zod.propValues[def.discriminator];
2173
+ const values = o._zod.propValues?.[def.discriminator];
2043
2174
  if (!values || values.size === 0)
2044
2175
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2045
2176
  for (const v of values) {
@@ -2057,6 +2188,7 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2057
2188
  if (!util.isObject(input)) {
2058
2189
  payload.issues.push({
2059
2190
  code: "invalid_type",
2191
+
2060
2192
  expected: "object",
2061
2193
  input,
2062
2194
  inst,
@@ -2076,8 +2208,10 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2076
2208
  // no matching discriminator
2077
2209
  payload.issues.push({
2078
2210
  code: "invalid_union",
2211
+
2079
2212
  errors: [],
2080
2213
  note: "No matching discriminator",
2214
+ discriminator: def.discriminator,
2081
2215
  input,
2082
2216
  path: [def.discriminator],
2083
2217
  inst,
@@ -2103,11 +2237,14 @@ export interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right ext
2103
2237
  }
2104
2238
 
2105
2239
  export interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
2106
- extends $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>> {
2240
+ extends _$ZodTypeInternals {
2241
+ // $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>>
2107
2242
  def: $ZodIntersectionDef<A, B>;
2108
2243
  isst: never;
2109
2244
  optin: A["_zod"]["optin"] | B["_zod"]["optin"];
2110
2245
  optout: A["_zod"]["optout"] | B["_zod"]["optout"];
2246
+ output: core.output<A> & core.output<B>;
2247
+ input: core.input<A> & core.input<B>;
2111
2248
  }
2112
2249
 
2113
2250
  export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
@@ -2265,9 +2402,12 @@ type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonl
2265
2402
  export interface $ZodTupleInternals<
2266
2403
  T extends util.TupleItems = readonly $ZodType[],
2267
2404
  Rest extends SomeType | null = $ZodType | null,
2268
- > extends $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>> {
2405
+ > extends _$ZodTypeInternals {
2269
2406
  def: $ZodTupleDef<T, Rest>;
2270
2407
  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
2408
+ // $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>>
2409
+ output: $InferTupleOutputType<T, Rest>;
2410
+ input: $InferTupleInputType<T, Rest>;
2271
2411
  }
2272
2412
 
2273
2413
  export interface $ZodTuple<
@@ -2302,10 +2442,11 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2302
2442
  const tooSmall = input.length < optStart - 1;
2303
2443
  if (tooBig || tooSmall) {
2304
2444
  payload.issues.push({
2445
+ ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2446
+
2305
2447
  input,
2306
2448
  inst,
2307
2449
  origin: "array" as const,
2308
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2309
2450
  });
2310
2451
  return payload;
2311
2452
  }
@@ -2440,6 +2581,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2440
2581
  payload.issues.push({
2441
2582
  expected: "record",
2442
2583
  code: "invalid_type",
2584
+
2443
2585
  input,
2444
2586
  inst,
2445
2587
  });
@@ -2483,6 +2625,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2483
2625
  if (unrecognized && unrecognized.length > 0) {
2484
2626
  payload.issues.push({
2485
2627
  code: "unrecognized_keys",
2628
+
2486
2629
  input,
2487
2630
  inst,
2488
2631
  keys: unrecognized,
@@ -2500,8 +2643,9 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2500
2643
 
2501
2644
  if (keyResult.issues.length) {
2502
2645
  payload.issues.push({
2503
- origin: "record",
2504
2646
  code: "invalid_key",
2647
+
2648
+ origin: "record",
2505
2649
  issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
2506
2650
  input: key,
2507
2651
  path: [key],
@@ -2572,6 +2716,7 @@ export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$construct
2572
2716
  payload.issues.push({
2573
2717
  expected: "map",
2574
2718
  code: "invalid_type",
2719
+
2575
2720
  input,
2576
2721
  inst,
2577
2722
  });
@@ -2615,8 +2760,9 @@ function handleMapResult(
2615
2760
  final.issues.push(...util.prefixIssues(key as PropertyKey, keyResult.issues));
2616
2761
  } else {
2617
2762
  final.issues.push({
2618
- origin: "map",
2619
2763
  code: "invalid_key",
2764
+
2765
+ origin: "map",
2620
2766
  input,
2621
2767
  inst,
2622
2768
  issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
@@ -2630,6 +2776,7 @@ function handleMapResult(
2630
2776
  final.issues.push({
2631
2777
  origin: "map",
2632
2778
  code: "invalid_element",
2779
+
2633
2780
  input,
2634
2781
  inst,
2635
2782
  key: key,
@@ -2737,8 +2884,8 @@ export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constru
2737
2884
  $ZodType.init(inst, def);
2738
2885
 
2739
2886
  const values = util.getEnumValues(def.entries);
2740
-
2741
- inst._zod.values = new Set<util.Primitive>(values);
2887
+ const valuesSet = new Set<util.Primitive>(values);
2888
+ inst._zod.values = valuesSet;
2742
2889
 
2743
2890
  inst._zod.pattern = new RegExp(
2744
2891
  `^(${values
@@ -2749,11 +2896,12 @@ export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constru
2749
2896
 
2750
2897
  inst._zod.parse = (payload, _ctx) => {
2751
2898
  const input = payload.value;
2752
- if (inst._zod.values.has(input)) {
2899
+ if (valuesSet.has(input)) {
2753
2900
  return payload;
2754
2901
  }
2755
2902
  payload.issues.push({
2756
2903
  code: "invalid_value",
2904
+
2757
2905
  values,
2758
2906
  input,
2759
2907
  inst,
@@ -2790,12 +2938,15 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
2790
2938
  "$ZodLiteral",
2791
2939
  (inst, def) => {
2792
2940
  $ZodType.init(inst, def);
2941
+ if (def.values.length === 0) {
2942
+ throw new Error("Cannot create literal schema with no valid values");
2943
+ }
2793
2944
 
2794
2945
  inst._zod.values = new Set<util.Literal>(def.values);
2795
2946
  inst._zod.pattern = new RegExp(
2796
2947
  `^(${def.values
2797
2948
 
2798
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
2949
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
2799
2950
  .join("|")})$`
2800
2951
  );
2801
2952
 
@@ -2806,6 +2957,7 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
2806
2957
  }
2807
2958
  payload.issues.push({
2808
2959
  code: "invalid_value",
2960
+
2809
2961
  values: def.values,
2810
2962
  input,
2811
2963
  inst,
@@ -2865,8 +3017,11 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
2865
3017
  //////////////////////////////////////////
2866
3018
 
2867
3019
  // provide a fallback in case the File interface isn't provided in the environment
2868
- declare global {
2869
- interface File {}
3020
+ type _File = typeof globalThis extends { File: infer F extends new (...args: any[]) => any } ? InstanceType<F> : {};
3021
+ /** Do not reference this directly. */
3022
+ export interface File extends _File {
3023
+ readonly type: string;
3024
+ readonly size: number;
2870
3025
  }
2871
3026
 
2872
3027
  export interface $ZodFileDef extends $ZodTypeDef {
@@ -2892,10 +3047,12 @@ export const $ZodFile: core.$constructor<$ZodFile> = /*@__PURE__*/ core.$constru
2892
3047
 
2893
3048
  inst._zod.parse = (payload, _ctx) => {
2894
3049
  const input = payload.value;
3050
+ // @ts-ignore
2895
3051
  if (input instanceof File) return payload;
2896
3052
  payload.issues.push({
2897
3053
  expected: "file",
2898
3054
  code: "invalid_type",
3055
+
2899
3056
  input,
2900
3057
  inst,
2901
3058
  });
@@ -2927,9 +3084,13 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
2927
3084
  "$ZodTransform",
2928
3085
  (inst, def) => {
2929
3086
  $ZodType.init(inst, def);
2930
- inst._zod.parse = (payload, _ctx) => {
3087
+ inst._zod.parse = (payload, ctx) => {
3088
+ if (ctx.direction === "backward") {
3089
+ throw new core.$ZodEncodeError(inst.constructor.name);
3090
+ }
3091
+
2931
3092
  const _out = def.transform(payload.value, payload);
2932
- if (_ctx.async) {
3093
+ if (ctx.async) {
2933
3094
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2934
3095
  return output.then((output) => {
2935
3096
  payload.value = output;
@@ -2973,6 +3134,13 @@ export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
2973
3134
  _zod: $ZodOptionalInternals<T>;
2974
3135
  }
2975
3136
 
3137
+ function handleOptionalResult(result: ParsePayload, input: unknown) {
3138
+ if (result.issues.length && input === undefined) {
3139
+ return { issues: [], value: undefined };
3140
+ }
3141
+ return result;
3142
+ }
3143
+
2976
3144
  export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.$constructor(
2977
3145
  "$ZodOptional",
2978
3146
  (inst, def) => {
@@ -2990,7 +3158,9 @@ export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.
2990
3158
 
2991
3159
  inst._zod.parse = (payload, ctx) => {
2992
3160
  if (def.innerType._zod.optin === "optional") {
2993
- return def.innerType._zod.run(payload, ctx);
3161
+ const result = def.innerType._zod.run(payload, ctx);
3162
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
3163
+ return handleOptionalResult(result, payload.value);
2994
3164
  }
2995
3165
  if (payload.value === undefined) {
2996
3166
  return payload;
@@ -3043,6 +3213,7 @@ export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.
3043
3213
  });
3044
3214
 
3045
3215
  inst._zod.parse = (payload, ctx) => {
3216
+ // Forward direction (decode): allow null to pass through
3046
3217
  if (payload.value === null) return payload;
3047
3218
  return def.innerType._zod.run(payload, ctx);
3048
3219
  };
@@ -3087,13 +3258,19 @@ export const $ZodDefault: core.$constructor<$ZodDefault> = /*@__PURE__*/ core.$c
3087
3258
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3088
3259
 
3089
3260
  inst._zod.parse = (payload, ctx) => {
3261
+ if (ctx.direction === "backward") {
3262
+ return def.innerType._zod.run(payload, ctx);
3263
+ }
3264
+
3265
+ // Forward direction (decode): apply defaults for undefined input
3090
3266
  if (payload.value === undefined) {
3091
3267
  payload.value = def.defaultValue;
3092
3268
  /**
3093
- * $ZodDefault always returns the default value immediately.
3269
+ * $ZodDefault returns the default value immediately in forward direction.
3094
3270
  * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
3095
3271
  return payload;
3096
3272
  }
3273
+ // Forward direction: continue with default handling
3097
3274
  const result = def.innerType._zod.run(payload, ctx);
3098
3275
  if (result instanceof Promise) {
3099
3276
  return result.then((result) => handleDefaultResult(result, def));
@@ -3147,6 +3324,11 @@ export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.
3147
3324
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3148
3325
 
3149
3326
  inst._zod.parse = (payload, ctx) => {
3327
+ if (ctx.direction === "backward") {
3328
+ return def.innerType._zod.run(payload, ctx);
3329
+ }
3330
+
3331
+ // Forward direction (decode): apply prefault for undefined input
3150
3332
  if (payload.value === undefined) {
3151
3333
  payload.value = def.defaultValue;
3152
3334
  }
@@ -3281,6 +3463,10 @@ export const $ZodSuccess: core.$constructor<$ZodSuccess> = /*@__PURE__*/ core.$c
3281
3463
  $ZodType.init(inst, def);
3282
3464
 
3283
3465
  inst._zod.parse = (payload, ctx) => {
3466
+ if (ctx.direction === "backward") {
3467
+ throw new core.$ZodEncodeError("ZodSuccess");
3468
+ }
3469
+
3284
3470
  const result = def.innerType._zod.run(payload, ctx);
3285
3471
  if (result instanceof Promise) {
3286
3472
  return result.then((result) => {
@@ -3314,11 +3500,8 @@ export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef
3314
3500
  }
3315
3501
 
3316
3502
  export interface $ZodCatchInternals<T extends SomeType = $ZodType>
3317
- extends $ZodTypeInternals<core.output<T>, core.input<T> | util.Whatever> {
3503
+ extends $ZodTypeInternals<core.output<T>, core.input<T>> {
3318
3504
  def: $ZodCatchDef<T>;
3319
- // qin: T["_zod"]["qin"];
3320
- // qout: T["_zod"]["qout"];
3321
-
3322
3505
  optin: T["_zod"]["optin"];
3323
3506
  optout: T["_zod"]["optout"];
3324
3507
  isst: never;
@@ -3331,11 +3514,16 @@ export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
3331
3514
 
3332
3515
  export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
3333
3516
  $ZodType.init(inst, def);
3334
- inst._zod.optin = "optional";
3517
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3335
3518
  util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3336
3519
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3337
3520
 
3338
3521
  inst._zod.parse = (payload, ctx) => {
3522
+ if (ctx.direction === "backward") {
3523
+ return def.innerType._zod.run(payload, ctx);
3524
+ }
3525
+
3526
+ // Forward direction (decode): apply catch logic
3339
3527
  const result = def.innerType._zod.run(payload, ctx);
3340
3528
  if (result instanceof Promise) {
3341
3529
  return result.then((result) => {
@@ -3364,6 +3552,7 @@ export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$const
3364
3552
  },
3365
3553
  input: payload.value,
3366
3554
  });
3555
+
3367
3556
  payload.issues = [];
3368
3557
  }
3369
3558
 
@@ -3419,6 +3608,10 @@ export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType =
3419
3608
  type: "pipe";
3420
3609
  in: A;
3421
3610
  out: B;
3611
+ /** Only defined inside $ZodCodec instances. */
3612
+ transform?: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
3613
+ /** Only defined inside $ZodCodec instances. */
3614
+ reverseTransform?: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
3422
3615
  }
3423
3616
 
3424
3617
  export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
@@ -3428,6 +3621,7 @@ export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends Some
3428
3621
  values: A["_zod"]["values"];
3429
3622
  optin: A["_zod"]["optin"];
3430
3623
  optout: B["_zod"]["optout"];
3624
+ propValues: A["_zod"]["propValues"];
3431
3625
  }
3432
3626
 
3433
3627
  export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
@@ -3439,21 +3633,117 @@ export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constru
3439
3633
  util.defineLazy(inst._zod, "values", () => def.in._zod.values);
3440
3634
  util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
3441
3635
  util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
3636
+ util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
3442
3637
 
3443
3638
  inst._zod.parse = (payload, ctx) => {
3639
+ if (ctx.direction === "backward") {
3640
+ const right = def.out._zod.run(payload, ctx);
3641
+ if (right instanceof Promise) {
3642
+ return right.then((right) => handlePipeResult(right, def.in, ctx));
3643
+ }
3644
+ return handlePipeResult(right, def.in, ctx);
3645
+ }
3646
+
3444
3647
  const left = def.in._zod.run(payload, ctx);
3445
3648
  if (left instanceof Promise) {
3446
- return left.then((left) => handlePipeResult(left, def, ctx));
3649
+ return left.then((left) => handlePipeResult(left, def.out, ctx));
3650
+ }
3651
+ return handlePipeResult(left, def.out, ctx);
3652
+ };
3653
+ });
3654
+
3655
+ function handlePipeResult(left: ParsePayload, next: $ZodType, ctx: ParseContextInternal) {
3656
+ if (left.issues.length) {
3657
+ // prevent further checks
3658
+ left.aborted = true;
3659
+ return left;
3660
+ }
3661
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
3662
+ }
3663
+
3664
+ ////////////////////////////////////////////
3665
+ ////////////////////////////////////////////
3666
+ ////////// //////////
3667
+ ////////// $ZodCodec //////////
3668
+ ////////// //////////
3669
+ ////////////////////////////////////////////
3670
+ ////////////////////////////////////////////
3671
+ export interface $ZodCodecDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodPipeDef<A, B> {
3672
+ transform: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
3673
+ reverseTransform: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
3674
+ }
3675
+
3676
+ export interface $ZodCodecInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
3677
+ extends $ZodTypeInternals<core.output<B>, core.input<A>> {
3678
+ def: $ZodCodecDef<A, B>;
3679
+ isst: never;
3680
+ values: A["_zod"]["values"];
3681
+ optin: A["_zod"]["optin"];
3682
+ optout: B["_zod"]["optout"];
3683
+ propValues: A["_zod"]["propValues"];
3684
+ }
3685
+
3686
+ export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
3687
+ _zod: $ZodCodecInternals<A, B>;
3688
+ }
3689
+
3690
+ export const $ZodCodec: core.$constructor<$ZodCodec> = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
3691
+ $ZodType.init(inst, def);
3692
+ util.defineLazy(inst._zod, "values", () => def.in._zod.values);
3693
+ util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
3694
+ util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
3695
+ util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
3696
+
3697
+ inst._zod.parse = (payload, ctx) => {
3698
+ const direction = ctx.direction || "forward";
3699
+ if (direction === "forward") {
3700
+ const left = def.in._zod.run(payload, ctx);
3701
+ if (left instanceof Promise) {
3702
+ return left.then((left) => handleCodecAResult(left, def, ctx));
3703
+ }
3704
+ return handleCodecAResult(left, def, ctx);
3705
+ } else {
3706
+ const right = def.out._zod.run(payload, ctx);
3707
+ if (right instanceof Promise) {
3708
+ return right.then((right) => handleCodecAResult(right, def, ctx));
3709
+ }
3710
+ return handleCodecAResult(right, def, ctx);
3447
3711
  }
3448
- return handlePipeResult(left, def, ctx);
3449
3712
  };
3450
3713
  });
3451
3714
 
3452
- function handlePipeResult(left: ParsePayload, def: $ZodPipeDef, ctx: ParseContext) {
3453
- if (util.aborted(left)) {
3715
+ function handleCodecAResult(result: ParsePayload, def: $ZodCodecDef, ctx: ParseContextInternal) {
3716
+ if (result.issues.length) {
3717
+ // prevent further checks
3718
+ result.aborted = true;
3719
+ return result;
3720
+ }
3721
+
3722
+ const direction = ctx.direction || "forward";
3723
+
3724
+ if (direction === "forward") {
3725
+ const transformed = def.transform(result.value, result);
3726
+ if (transformed instanceof Promise) {
3727
+ return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
3728
+ }
3729
+ return handleCodecTxResult(result, transformed, def.out, ctx);
3730
+ } else {
3731
+ const transformed = def.reverseTransform(result.value, result);
3732
+ if (transformed instanceof Promise) {
3733
+ return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
3734
+ }
3735
+ return handleCodecTxResult(result, transformed, def.in, ctx);
3736
+ }
3737
+ }
3738
+
3739
+ function handleCodecTxResult(left: ParsePayload, value: any, nextSchema: SomeType, ctx: ParseContextInternal) {
3740
+ // Check if transform added any issues
3741
+ if (left.issues.length) {
3742
+ left.aborted = true;
3454
3743
  return left;
3455
3744
  }
3456
- return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
3745
+
3746
+ return nextSchema._zod.run({ value, issues: left.issues }, ctx);
3457
3747
  }
3458
3748
 
3459
3749
  ////////////////////////////////////////////
@@ -3493,6 +3783,9 @@ export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.
3493
3783
  util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3494
3784
 
3495
3785
  inst._zod.parse = (payload, ctx) => {
3786
+ if (ctx.direction === "backward") {
3787
+ return def.innerType._zod.run(payload, ctx);
3788
+ }
3496
3789
  const result = def.innerType._zod.run(payload, ctx);
3497
3790
  if (result instanceof Promise) {
3498
3791
  return result.then(handleReadonlyResult);
@@ -3518,6 +3811,7 @@ function handleReadonlyResult(payload: ParsePayload): ParsePayload {
3518
3811
  export interface $ZodTemplateLiteralDef extends $ZodTypeDef {
3519
3812
  type: "template_literal";
3520
3813
  parts: $ZodTemplateLiteralPart[];
3814
+ format?: string | undefined;
3521
3815
  }
3522
3816
  export interface $ZodTemplateLiteralInternals<Template extends string = string>
3523
3817
  extends $ZodTypeInternals<Template, Template> {
@@ -3585,7 +3879,8 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
3585
3879
  $ZodType.init(inst, def);
3586
3880
  const regexParts: string[] = [];
3587
3881
  for (const part of def.parts) {
3588
- if (part instanceof $ZodType) {
3882
+ if (typeof part === "object" && part !== null) {
3883
+ // is Zod schema
3589
3884
  if (!part._zod.pattern) {
3590
3885
  // if (!source)
3591
3886
  throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
@@ -3623,8 +3918,9 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
3623
3918
  payload.issues.push({
3624
3919
  input: payload.value,
3625
3920
  inst,
3921
+
3626
3922
  code: "invalid_format",
3627
- format: "template_literal",
3923
+ format: def.format ?? "template_literal",
3628
3924
  pattern: inst._zod.pattern.source,
3629
3925
  });
3630
3926
  return payload;
@@ -3635,6 +3931,174 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
3635
3931
  }
3636
3932
  );
3637
3933
 
3934
+ //////////////////////////////////////////
3935
+ //////////////////////////////////////////
3936
+ ////////// //////////
3937
+ ////////// $ZodFunction //////////
3938
+ ////////// //////////
3939
+ //////////////////////////////////////////
3940
+ //////////////////////////////////////////
3941
+ export type $ZodFunctionArgs = $ZodType<unknown[], unknown[]>;
3942
+ export type $ZodFunctionIn = $ZodFunctionArgs;
3943
+ export type $ZodFunctionOut = $ZodType;
3944
+
3945
+ export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
3946
+ ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
3947
+ ) => core.input<Returns>;
3948
+
3949
+ export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
3950
+ ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
3951
+ ) => util.MaybeAsync<core.input<Returns>>;
3952
+
3953
+ export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
3954
+ ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
3955
+ ) => core.output<Returns>;
3956
+
3957
+ export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
3958
+ ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
3959
+ ) => util.MaybeAsync<core.output<Returns>>;
3960
+
3961
+ export interface $ZodFunctionDef<
3962
+ In extends $ZodFunctionIn = $ZodFunctionIn,
3963
+ Out extends $ZodFunctionOut = $ZodFunctionOut,
3964
+ > extends $ZodTypeDef {
3965
+ type: "function";
3966
+ input: In;
3967
+ output: Out;
3968
+ }
3969
+
3970
+ export interface $ZodFunctionInternals<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut>
3971
+ extends $ZodTypeInternals<$InferOuterFunctionType<Args, Returns>, $InferInnerFunctionType<Args, Returns>> {
3972
+ def: $ZodFunctionDef<Args, Returns>;
3973
+ isst: errors.$ZodIssueInvalidType;
3974
+ }
3975
+
3976
+ export interface $ZodFunction<
3977
+ Args extends $ZodFunctionIn = $ZodFunctionIn,
3978
+ Returns extends $ZodFunctionOut = $ZodFunctionOut,
3979
+ > extends $ZodType<any, any, $ZodFunctionInternals<Args, Returns>> {
3980
+ /** @deprecated */
3981
+ _def: $ZodFunctionDef<Args, Returns>;
3982
+ _input: $InferInnerFunctionType<Args, Returns>;
3983
+ _output: $InferOuterFunctionType<Args, Returns>;
3984
+
3985
+ implement<F extends $InferInnerFunctionType<Args, Returns>>(
3986
+ func: F
3987
+ ): // allow for return type inference
3988
+ (
3989
+ ...args: Parameters<this["_output"]>
3990
+ ) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
3991
+
3992
+ implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(
3993
+ func: F
3994
+ ): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns>;
3995
+
3996
+ input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(
3997
+ args: Items,
3998
+ rest?: Rest
3999
+ ): $ZodFunction<$ZodTuple<Items, Rest>, Returns>;
4000
+ input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
4001
+ input(...args: any[]): $ZodFunction<any, Returns>;
4002
+
4003
+ output<NewReturns extends $ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
4004
+ }
4005
+
4006
+ export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends $ZodType> {
4007
+ input?: I;
4008
+ output?: O;
4009
+ }
4010
+
4011
+ export const $ZodFunction: core.$constructor<$ZodFunction> = /*@__PURE__*/ core.$constructor(
4012
+ "$ZodFunction",
4013
+ (inst, def) => {
4014
+ $ZodType.init(inst, def);
4015
+ inst._def = def;
4016
+ inst._zod.def = def;
4017
+
4018
+ inst.implement = (func) => {
4019
+ if (typeof func !== "function") {
4020
+ throw new Error("implement() must be called with a function");
4021
+ }
4022
+ return function (this: any, ...args: never[]) {
4023
+ const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4024
+ const result = Reflect.apply(func, this, parsedArgs as never[]);
4025
+ if (inst._def.output) {
4026
+ return parse(inst._def.output, result);
4027
+ }
4028
+ return result as any;
4029
+ };
4030
+ };
4031
+
4032
+ inst.implementAsync = (func) => {
4033
+ if (typeof func !== "function") {
4034
+ throw new Error("implementAsync() must be called with a function");
4035
+ }
4036
+ return async function (this: any, ...args: never[]) {
4037
+ const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4038
+ const result = await Reflect.apply(func, this, parsedArgs as never[]);
4039
+ if (inst._def.output) {
4040
+ return await parseAsync(inst._def.output, result);
4041
+ }
4042
+ return result;
4043
+ } as any;
4044
+ };
4045
+
4046
+ inst._zod.parse = (payload, _ctx) => {
4047
+ if (typeof payload.value !== "function") {
4048
+ payload.issues.push({
4049
+ code: "invalid_type",
4050
+ expected: "function",
4051
+ input: payload.value,
4052
+ inst,
4053
+ });
4054
+ return payload;
4055
+ }
4056
+
4057
+ // Check if output is a promise type to determine if we should use async implementation
4058
+ const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
4059
+
4060
+ if (hasPromiseOutput) {
4061
+ payload.value = inst.implementAsync(payload.value);
4062
+ } else {
4063
+ payload.value = inst.implement(payload.value);
4064
+ }
4065
+ return payload;
4066
+ };
4067
+
4068
+ inst.input = (...args: any[]): $ZodFunction<any, any> => {
4069
+ const F: any = inst.constructor;
4070
+ if (Array.isArray(args[0])) {
4071
+ return new F({
4072
+ type: "function",
4073
+ input: new $ZodTuple({
4074
+ type: "tuple",
4075
+ items: args[0],
4076
+ rest: args[1],
4077
+ }),
4078
+ output: inst._def.output,
4079
+ });
4080
+ }
4081
+
4082
+ return new F({
4083
+ type: "function",
4084
+ input: args[0],
4085
+ output: inst._def.output,
4086
+ });
4087
+ };
4088
+
4089
+ inst.output = (output) => {
4090
+ const F: any = inst.constructor;
4091
+ return new F({
4092
+ type: "function",
4093
+ input: inst._def.input,
4094
+ output,
4095
+ });
4096
+ };
4097
+
4098
+ return inst;
4099
+ }
4100
+ );
4101
+
3638
4102
  /////////////////////////////////////////
3639
4103
  /////////////////////////////////////////
3640
4104
  ////////// //////////
@@ -3700,11 +4164,18 @@ export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
3700
4164
  export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
3701
4165
  $ZodType.init(inst, def);
3702
4166
 
4167
+ // let _innerType!: any;
4168
+ // util.defineLazy(def, "getter", () => {
4169
+ // if (!_innerType) {
4170
+ // _innerType = def.getter();
4171
+ // }
4172
+ // return () => _innerType;
4173
+ // });
3703
4174
  util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
3704
4175
  util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
3705
4176
  util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
3706
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
3707
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
4177
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
4178
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
3708
4179
  inst._zod.parse = (payload, ctx) => {
3709
4180
  const inner = inst._zod.innerType;
3710
4181
  return inner._zod.run(payload, ctx);
@@ -3800,6 +4271,7 @@ export type $ZodTypes =
3800
4271
  | $ZodSet
3801
4272
  | $ZodLiteral
3802
4273
  | $ZodEnum
4274
+ | $ZodFunction
3803
4275
  | $ZodPromise
3804
4276
  | $ZodLazy
3805
4277
  | $ZodOptional
@@ -3839,4 +4311,7 @@ export type $ZodStringFormatTypes =
3839
4311
  | $ZodBase64
3840
4312
  | $ZodBase64URL
3841
4313
  | $ZodE164
3842
- | $ZodJWT;
4314
+ | $ZodJWT
4315
+ | $ZodCustomStringFormat<"hex">
4316
+ | $ZodCustomStringFormat<util.HashFormat>
4317
+ | $ZodCustomStringFormat<"hostname">;