zod 4.6.2 → 4.6.4

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 (267) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/v4/classic/checks.ts +1 -0
  4. package/src/v4/classic/schemas.ts +12 -29
  5. package/src/v4/classic/tests/assignability.test.ts +1 -0
  6. package/src/v4/classic/tests/cyclic-data.test.ts +2 -11
  7. package/src/v4/classic/tests/firstparty.test.ts +0 -4
  8. package/src/v4/classic/tests/instance-footprint.test.ts +22 -0
  9. package/src/v4/classic/tests/instanceof.test.ts +1 -1
  10. package/src/v4/classic/tests/number.test.ts +39 -0
  11. package/src/v4/classic/tests/properties.test.ts +34 -137
  12. package/src/v4/classic/tests/string.test.ts +70 -1
  13. package/src/v4/classic/tests/to-json-schema.test.ts +87 -35
  14. package/src/v4/core/api.ts +21 -29
  15. package/src/v4/core/checks.ts +61 -1
  16. package/src/v4/core/compile.ts +35 -24
  17. package/src/v4/core/core.ts +1 -3
  18. package/src/v4/core/json-schema-processors.ts +9 -63
  19. package/src/v4/core/memoizer.ts +2 -5
  20. package/src/v4/core/regexes.ts +4 -0
  21. package/src/v4/core/schemas.ts +36 -109
  22. package/src/v4/core/tests/compile-differential.test.ts +35 -0
  23. package/src/v4/core/tests/compile.test.ts +177 -0
  24. package/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  25. package/src/v4/core/to-json-schema.ts +1 -1
  26. package/src/v4/core/util.ts +0 -4
  27. package/src/v4/core/versions.ts +1 -1
  28. package/src/v4/core/visit.ts +0 -11
  29. package/src/v4/locales/ar.ts +1 -0
  30. package/src/v4/locales/az.ts +1 -0
  31. package/src/v4/locales/be.ts +1 -0
  32. package/src/v4/locales/bg.ts +1 -0
  33. package/src/v4/locales/bn.ts +1 -0
  34. package/src/v4/locales/ca.ts +1 -0
  35. package/src/v4/locales/ckb.ts +1 -0
  36. package/src/v4/locales/cs.ts +1 -0
  37. package/src/v4/locales/da.ts +1 -0
  38. package/src/v4/locales/de.ts +1 -0
  39. package/src/v4/locales/el.ts +1 -0
  40. package/src/v4/locales/en.ts +1 -0
  41. package/src/v4/locales/eo.ts +1 -0
  42. package/src/v4/locales/es.ts +1 -0
  43. package/src/v4/locales/fa.ts +1 -0
  44. package/src/v4/locales/fi.ts +1 -0
  45. package/src/v4/locales/fr-CA.ts +1 -0
  46. package/src/v4/locales/fr.ts +1 -0
  47. package/src/v4/locales/gu.ts +1 -0
  48. package/src/v4/locales/he.ts +1 -0
  49. package/src/v4/locales/hi.ts +1 -0
  50. package/src/v4/locales/hr.ts +1 -0
  51. package/src/v4/locales/hu.ts +1 -0
  52. package/src/v4/locales/hy.ts +1 -0
  53. package/src/v4/locales/id.ts +1 -0
  54. package/src/v4/locales/is.ts +1 -0
  55. package/src/v4/locales/it.ts +1 -0
  56. package/src/v4/locales/ja.ts +1 -0
  57. package/src/v4/locales/ka.ts +1 -0
  58. package/src/v4/locales/km.ts +1 -0
  59. package/src/v4/locales/kn.ts +1 -0
  60. package/src/v4/locales/ko.ts +1 -0
  61. package/src/v4/locales/lt.ts +1 -0
  62. package/src/v4/locales/mk.ts +1 -0
  63. package/src/v4/locales/ms.ts +1 -0
  64. package/src/v4/locales/ne.ts +1 -0
  65. package/src/v4/locales/nl.ts +1 -0
  66. package/src/v4/locales/nn.ts +1 -0
  67. package/src/v4/locales/no.ts +1 -0
  68. package/src/v4/locales/ota.ts +1 -0
  69. package/src/v4/locales/pl.ts +1 -0
  70. package/src/v4/locales/ps.ts +1 -0
  71. package/src/v4/locales/pt-BR.ts +1 -0
  72. package/src/v4/locales/pt.ts +1 -0
  73. package/src/v4/locales/ro.ts +1 -0
  74. package/src/v4/locales/ru.ts +1 -0
  75. package/src/v4/locales/sk.ts +1 -0
  76. package/src/v4/locales/sl.ts +1 -0
  77. package/src/v4/locales/sv.ts +1 -0
  78. package/src/v4/locales/ta.ts +1 -0
  79. package/src/v4/locales/tg.ts +1 -0
  80. package/src/v4/locales/th.ts +1 -0
  81. package/src/v4/locales/tk.ts +1 -0
  82. package/src/v4/locales/tr.ts +1 -0
  83. package/src/v4/locales/uk.ts +1 -0
  84. package/src/v4/locales/ur.ts +1 -0
  85. package/src/v4/locales/uz.ts +1 -0
  86. package/src/v4/locales/vi.ts +1 -0
  87. package/src/v4/locales/yo.ts +1 -0
  88. package/src/v4/locales/zh-CN.ts +1 -0
  89. package/src/v4/locales/zh-TW.ts +1 -0
  90. package/src/v4/mini/checks.ts +1 -0
  91. package/src/v4/mini/schemas.ts +12 -23
  92. package/src/v4/mini/tests/index.test.ts +56 -0
  93. package/src/v4/mini/tests/string.test.ts +7 -0
  94. package/v4/classic/checks.cjs +2 -1
  95. package/v4/classic/checks.d.cts +1 -1
  96. package/v4/classic/checks.d.ts +1 -1
  97. package/v4/classic/checks.js +1 -1
  98. package/v4/classic/schemas.cjs +11 -15
  99. package/v4/classic/schemas.d.cts +2 -6
  100. package/v4/classic/schemas.d.ts +2 -6
  101. package/v4/classic/schemas.js +9 -13
  102. package/v4/core/api.cjs +11 -23
  103. package/v4/core/api.d.cts +8 -4
  104. package/v4/core/api.d.ts +8 -4
  105. package/v4/core/api.js +11 -23
  106. package/v4/core/checks.cjs +32 -1
  107. package/v4/core/checks.d.cts +16 -0
  108. package/v4/core/checks.d.ts +16 -0
  109. package/v4/core/checks.js +31 -0
  110. package/v4/core/compile.cjs +12 -17
  111. package/v4/core/compile.js +13 -18
  112. package/v4/core/core.cjs +1 -1
  113. package/v4/core/core.js +1 -1
  114. package/v4/core/json-schema-processors.cjs +8 -44
  115. package/v4/core/json-schema-processors.d.cts +0 -1
  116. package/v4/core/json-schema-processors.d.ts +0 -1
  117. package/v4/core/json-schema-processors.js +8 -43
  118. package/v4/core/memoizer.cjs +2 -5
  119. package/v4/core/memoizer.js +2 -5
  120. package/v4/core/regexes.cjs +4 -2
  121. package/v4/core/regexes.d.cts +1 -0
  122. package/v4/core/regexes.d.ts +1 -0
  123. package/v4/core/regexes.js +2 -0
  124. package/v4/core/schemas.cjs +33 -73
  125. package/v4/core/schemas.d.cts +7 -22
  126. package/v4/core/schemas.d.ts +7 -22
  127. package/v4/core/schemas.js +30 -72
  128. package/v4/core/to-json-schema.cjs +0 -1
  129. package/v4/core/to-json-schema.d.cts +0 -3
  130. package/v4/core/to-json-schema.d.ts +0 -3
  131. package/v4/core/to-json-schema.js +1 -1
  132. package/v4/core/util.cjs +0 -4
  133. package/v4/core/util.js +0 -4
  134. package/v4/core/versions.cjs +1 -1
  135. package/v4/core/versions.js +1 -1
  136. package/v4/core/visit.cjs +0 -12
  137. package/v4/core/visit.js +0 -12
  138. package/v4/locales/ar.cjs +1 -0
  139. package/v4/locales/ar.js +1 -0
  140. package/v4/locales/az.cjs +1 -0
  141. package/v4/locales/az.js +1 -0
  142. package/v4/locales/be.cjs +1 -0
  143. package/v4/locales/be.js +1 -0
  144. package/v4/locales/bg.cjs +1 -0
  145. package/v4/locales/bg.js +1 -0
  146. package/v4/locales/bn.cjs +1 -0
  147. package/v4/locales/bn.js +1 -0
  148. package/v4/locales/ca.cjs +1 -0
  149. package/v4/locales/ca.js +1 -0
  150. package/v4/locales/ckb.cjs +1 -0
  151. package/v4/locales/ckb.js +1 -0
  152. package/v4/locales/cs.cjs +1 -0
  153. package/v4/locales/cs.js +1 -0
  154. package/v4/locales/da.cjs +1 -0
  155. package/v4/locales/da.js +1 -0
  156. package/v4/locales/de.cjs +1 -0
  157. package/v4/locales/de.js +1 -0
  158. package/v4/locales/el.cjs +1 -0
  159. package/v4/locales/el.js +1 -0
  160. package/v4/locales/en.cjs +1 -0
  161. package/v4/locales/en.js +1 -0
  162. package/v4/locales/eo.cjs +1 -0
  163. package/v4/locales/eo.js +1 -0
  164. package/v4/locales/es.cjs +1 -0
  165. package/v4/locales/es.js +1 -0
  166. package/v4/locales/fa.cjs +1 -0
  167. package/v4/locales/fa.js +1 -0
  168. package/v4/locales/fi.cjs +1 -0
  169. package/v4/locales/fi.js +1 -0
  170. package/v4/locales/fr-CA.cjs +1 -0
  171. package/v4/locales/fr-CA.js +1 -0
  172. package/v4/locales/fr.cjs +1 -0
  173. package/v4/locales/fr.js +1 -0
  174. package/v4/locales/gu.cjs +1 -0
  175. package/v4/locales/gu.js +1 -0
  176. package/v4/locales/he.cjs +1 -0
  177. package/v4/locales/he.js +1 -0
  178. package/v4/locales/hi.cjs +1 -0
  179. package/v4/locales/hi.js +1 -0
  180. package/v4/locales/hr.cjs +1 -0
  181. package/v4/locales/hr.js +1 -0
  182. package/v4/locales/hu.cjs +1 -0
  183. package/v4/locales/hu.js +1 -0
  184. package/v4/locales/hy.cjs +1 -0
  185. package/v4/locales/hy.js +1 -0
  186. package/v4/locales/id.cjs +1 -0
  187. package/v4/locales/id.js +1 -0
  188. package/v4/locales/is.cjs +1 -0
  189. package/v4/locales/is.js +1 -0
  190. package/v4/locales/it.cjs +1 -0
  191. package/v4/locales/it.js +1 -0
  192. package/v4/locales/ja.cjs +1 -0
  193. package/v4/locales/ja.js +1 -0
  194. package/v4/locales/ka.cjs +1 -0
  195. package/v4/locales/ka.js +1 -0
  196. package/v4/locales/km.cjs +1 -0
  197. package/v4/locales/km.js +1 -0
  198. package/v4/locales/kn.cjs +1 -0
  199. package/v4/locales/kn.js +1 -0
  200. package/v4/locales/ko.cjs +1 -0
  201. package/v4/locales/ko.js +1 -0
  202. package/v4/locales/lt.cjs +1 -0
  203. package/v4/locales/lt.js +1 -0
  204. package/v4/locales/mk.cjs +1 -0
  205. package/v4/locales/mk.js +1 -0
  206. package/v4/locales/ms.cjs +1 -0
  207. package/v4/locales/ms.js +1 -0
  208. package/v4/locales/ne.cjs +1 -0
  209. package/v4/locales/ne.js +1 -0
  210. package/v4/locales/nl.cjs +1 -0
  211. package/v4/locales/nl.js +1 -0
  212. package/v4/locales/nn.cjs +1 -0
  213. package/v4/locales/nn.js +1 -0
  214. package/v4/locales/no.cjs +1 -0
  215. package/v4/locales/no.js +1 -0
  216. package/v4/locales/ota.cjs +1 -0
  217. package/v4/locales/ota.js +1 -0
  218. package/v4/locales/pl.cjs +1 -0
  219. package/v4/locales/pl.js +1 -0
  220. package/v4/locales/ps.cjs +1 -0
  221. package/v4/locales/ps.js +1 -0
  222. package/v4/locales/pt-BR.cjs +1 -0
  223. package/v4/locales/pt-BR.js +1 -0
  224. package/v4/locales/pt.cjs +1 -0
  225. package/v4/locales/pt.js +1 -0
  226. package/v4/locales/ro.cjs +1 -0
  227. package/v4/locales/ro.js +1 -0
  228. package/v4/locales/ru.cjs +1 -0
  229. package/v4/locales/ru.js +1 -0
  230. package/v4/locales/sk.cjs +1 -0
  231. package/v4/locales/sk.js +1 -0
  232. package/v4/locales/sl.cjs +1 -0
  233. package/v4/locales/sl.js +1 -0
  234. package/v4/locales/sv.cjs +1 -0
  235. package/v4/locales/sv.js +1 -0
  236. package/v4/locales/ta.cjs +1 -0
  237. package/v4/locales/ta.js +1 -0
  238. package/v4/locales/tg.cjs +1 -0
  239. package/v4/locales/tg.js +1 -0
  240. package/v4/locales/th.cjs +1 -0
  241. package/v4/locales/th.js +1 -0
  242. package/v4/locales/tk.cjs +1 -0
  243. package/v4/locales/tk.js +1 -0
  244. package/v4/locales/tr.cjs +1 -0
  245. package/v4/locales/tr.js +1 -0
  246. package/v4/locales/uk.cjs +1 -0
  247. package/v4/locales/uk.js +1 -0
  248. package/v4/locales/ur.cjs +1 -0
  249. package/v4/locales/ur.js +1 -0
  250. package/v4/locales/uz.cjs +1 -0
  251. package/v4/locales/uz.js +1 -0
  252. package/v4/locales/vi.cjs +1 -0
  253. package/v4/locales/vi.js +1 -0
  254. package/v4/locales/yo.cjs +1 -0
  255. package/v4/locales/yo.js +1 -0
  256. package/v4/locales/zh-CN.cjs +1 -0
  257. package/v4/locales/zh-CN.js +1 -0
  258. package/v4/locales/zh-TW.cjs +1 -0
  259. package/v4/locales/zh-TW.js +1 -0
  260. package/v4/mini/checks.cjs +2 -1
  261. package/v4/mini/checks.d.cts +1 -1
  262. package/v4/mini/checks.d.ts +1 -1
  263. package/v4/mini/checks.js +1 -1
  264. package/v4/mini/schemas.cjs +11 -13
  265. package/v4/mini/schemas.d.cts +1 -4
  266. package/v4/mini/schemas.d.ts +1 -4
  267. package/v4/mini/schemas.js +9 -11
@@ -24,8 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodIBAN = exports.$ZodCreditCard = exports.$ZodE164 = exports.$ZodBase64URL = exports.base64urlCharset = exports.$ZodBase64 = exports.base64Charset = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.URL_UNPARSEABLE = exports.URL_BAD_FORMAT = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
- exports.$ZodProperties = exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = void 0;
27
+ exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = void 0;
28
28
  exports.standardProps = standardProps;
29
+ exports.canParseURL = canParseURL;
30
+ exports.validateURL = validateURL;
29
31
  exports.parseURLObject = parseURLObject;
30
32
  exports.stripTabAndNewline = stripTabAndNewline;
31
33
  exports.urlHostnameOk = urlHostnameOk;
@@ -251,15 +253,37 @@ exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
251
253
  });
252
254
  /** The `://` guard rejected the input before the URL constructor saw it. */
253
255
  exports.URL_BAD_FORMAT = 1;
254
- /** The URL constructor rejected the input. */
256
+ /** The URL parser rejected the input. */
255
257
  exports.URL_UNPARSEABLE = 2;
256
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
258
+ function canParseURL(input) {
259
+ try {
260
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
261
+ return URL.canParse(input);
262
+ new URL(input);
263
+ return true;
264
+ }
265
+ catch {
266
+ return false;
267
+ }
268
+ }
269
+ function validateURL(trimmed, def) {
270
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
271
+ return canParseURL(trimmed) || exports.URL_UNPARSEABLE;
272
+ }
273
+ return parseURLObject(trimmed, def);
274
+ }
275
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
257
276
  function parseURLObject(trimmed, def) {
258
277
  // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
259
278
  if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
260
279
  return exports.URL_BAD_FORMAT;
261
280
  }
262
281
  try {
282
+ if (typeof URL !== "undefined") {
283
+ const URLStatic = URL;
284
+ if (typeof URLStatic.parse === "function")
285
+ return URLStatic.parse(trimmed) ?? exports.URL_UNPARSEABLE;
286
+ }
263
287
  // @ts-ignore
264
288
  return new URL(trimmed);
265
289
  }
@@ -286,7 +310,7 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
286
310
  try {
287
311
  // Trim whitespace from input
288
312
  const trimmed = payload.value.trim();
289
- const url = parseURLObject(trimmed, def);
313
+ const url = validateURL(trimmed, def);
290
314
  if (url === exports.URL_BAD_FORMAT) {
291
315
  payload.issues.push({
292
316
  code: "invalid_format",
@@ -308,6 +332,10 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
308
332
  });
309
333
  return;
310
334
  }
335
+ if (url === true) {
336
+ payload.value = stripTabAndNewline(trimmed);
337
+ return;
338
+ }
311
339
  if (def.hostname && !urlHostnameOk(url, def.hostname)) {
312
340
  payload.issues.push({
313
341
  code: "invalid_format",
@@ -405,14 +433,7 @@ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
405
433
  function isValidIPv6(value) {
406
434
  if (!ipv6Alphabet.test(value))
407
435
  return false;
408
- try {
409
- // @ts-ignore
410
- new URL(`http://[${value}]`);
411
- return true;
412
- }
413
- catch {
414
- return false;
415
- }
436
+ return canParseURL(`http://[${value}]`);
416
437
  }
417
438
  exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
418
439
  def.pattern ?? (def.pattern = regexes.ipv6);
@@ -2627,67 +2648,6 @@ function handleRefineResult(result, payload, input, inst) {
2627
2648
  payload.issues.push(util.issue(_iss));
2628
2649
  }
2629
2650
  }
2630
- // asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
2631
- function handlePropertiesResult(result, payload, key) {
2632
- if (result.issues.length) {
2633
- payload.issues.push(...util.prefixIssues(key, result.issues));
2634
- }
2635
- }
2636
- exports.$ZodProperties = core.$constructor("$ZodProperties", (inst, def) => {
2637
- // $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
2638
- exports.$ZodType.init(inst, def);
2639
- checks.$ZodCheck.init(inst, def);
2640
- const memo = core.globalConfig.memoizer;
2641
- memo?.attach(inst);
2642
- // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
2643
- let entries;
2644
- const runShape = (payload, ctx) => {
2645
- entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2646
- const input = payload.value;
2647
- let proms;
2648
- for (const [key, schema] of entries) {
2649
- const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
2650
- if (result instanceof Promise) {
2651
- proms ?? (proms = []);
2652
- proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
2653
- }
2654
- else {
2655
- handlePropertiesResult(result, payload, key);
2656
- }
2657
- }
2658
- if (proms)
2659
- return Promise.all(proms).then(() => undefined);
2660
- return undefined;
2661
- };
2662
- inst._zod.parse = (payload, ctx) => {
2663
- const input = payload.value;
2664
- // as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
2665
- if (input === null || (typeof input !== "object" && typeof input !== "function")) {
2666
- payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
2667
- return payload;
2668
- }
2669
- // both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
2670
- if (ctx.direction === "backward")
2671
- ctx = { ...ctx, direction: "forward" };
2672
- // the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
2673
- if (memo)
2674
- memo.alloc(inst, payload, input, ctx);
2675
- const result = runShape(payload, ctx);
2676
- return result instanceof Promise ? result.then(() => payload) : payload;
2677
- };
2678
- // as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
2679
- inst._zod.check = (payload) => {
2680
- if (payload.value == null) {
2681
- payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2682
- return undefined;
2683
- }
2684
- return runShape(payload, {});
2685
- };
2686
- }, {
2687
- *[Symbol.iterator]() {
2688
- yield this;
2689
- },
2690
- });
2691
2651
 
2692
2652
  // seal-cjs-exports
2693
2653
  (function () {
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
41
41
  }
42
42
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
43
43
  export interface $ZodTypeDef {
44
- type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom" | "properties";
44
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
45
45
  error?: errors.$ZodErrorMap<never> | undefined;
46
46
  checks?: checks.$ZodCheck<never>[];
47
47
  }
@@ -188,9 +188,11 @@ export interface $ZodURL extends $ZodType {
188
188
  }
189
189
  /** The `://` guard rejected the input before the URL constructor saw it. */
190
190
  export declare const URL_BAD_FORMAT = 1;
191
- /** The URL constructor rejected the input. */
191
+ /** The URL parser rejected the input. */
192
192
  export declare const URL_UNPARSEABLE = 2;
193
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
193
+ export declare function canParseURL(input: string): boolean;
194
+ export declare function validateURL(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "hostname" | "normalize">): URL | true | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
195
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
194
196
  export declare function parseURLObject(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "normalize">): URL | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
195
197
  /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
196
198
  export declare function stripTabAndNewline(value: string): string;
@@ -1267,22 +1269,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1267
1269
  _zod: $ZodCustomInternals<O, I>;
1268
1270
  }
1269
1271
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1270
- export interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, checks.$ZodCheckDef {
1271
- type: "properties";
1272
- check: "properties";
1273
- shape: Shape;
1274
- }
1275
- export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
1276
- -readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
1277
- }> {
1278
- def: $ZodPropertiesDef<Shape>;
1279
- isst: errors.$ZodIssueInvalidType;
1280
- issc: errors.$ZodIssue;
1281
- }
1282
- export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
1283
- _zod: $ZodPropertiesInternals<Shape>;
1284
- [Symbol.iterator](): Iterator<this>;
1285
- }
1286
- export declare const $ZodProperties: core.$constructor<$ZodProperties>;
1287
- export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1288
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1272
+ export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1273
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname"> | $ZodCustomStringFormat<"currency_code">;
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
41
41
  }
42
42
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
43
43
  export interface $ZodTypeDef {
44
- type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom" | "properties";
44
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
45
45
  error?: errors.$ZodErrorMap<never> | undefined;
46
46
  checks?: checks.$ZodCheck<never>[];
47
47
  }
@@ -188,9 +188,11 @@ export interface $ZodURL extends $ZodType {
188
188
  }
189
189
  /** The `://` guard rejected the input before the URL constructor saw it. */
190
190
  export declare const URL_BAD_FORMAT = 1;
191
- /** The URL constructor rejected the input. */
191
+ /** The URL parser rejected the input. */
192
192
  export declare const URL_UNPARSEABLE = 2;
193
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
193
+ export declare function canParseURL(input: string): boolean;
194
+ export declare function validateURL(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "hostname" | "normalize">): URL | true | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
195
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
194
196
  export declare function parseURLObject(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "normalize">): URL | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
195
197
  /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
196
198
  export declare function stripTabAndNewline(value: string): string;
@@ -1267,22 +1269,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1267
1269
  _zod: $ZodCustomInternals<O, I>;
1268
1270
  }
1269
1271
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1270
- export interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, checks.$ZodCheckDef {
1271
- type: "properties";
1272
- check: "properties";
1273
- shape: Shape;
1274
- }
1275
- export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
1276
- -readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
1277
- }> {
1278
- def: $ZodPropertiesDef<Shape>;
1279
- isst: errors.$ZodIssueInvalidType;
1280
- issc: errors.$ZodIssue;
1281
- }
1282
- export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
1283
- _zod: $ZodPropertiesInternals<Shape>;
1284
- [Symbol.iterator](): Iterator<this>;
1285
- }
1286
- export declare const $ZodProperties: core.$constructor<$ZodProperties>;
1287
- export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1288
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1272
+ export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1273
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname"> | $ZodCustomStringFormat<"currency_code">;
@@ -209,15 +209,37 @@ export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def
209
209
  });
210
210
  /** The `://` guard rejected the input before the URL constructor saw it. */
211
211
  export const URL_BAD_FORMAT = 1;
212
- /** The URL constructor rejected the input. */
212
+ /** The URL parser rejected the input. */
213
213
  export const URL_UNPARSEABLE = 2;
214
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
214
+ export function canParseURL(input) {
215
+ try {
216
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
217
+ return URL.canParse(input);
218
+ new URL(input);
219
+ return true;
220
+ }
221
+ catch {
222
+ return false;
223
+ }
224
+ }
225
+ export function validateURL(trimmed, def) {
226
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
227
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
228
+ }
229
+ return parseURLObject(trimmed, def);
230
+ }
231
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
215
232
  export function parseURLObject(trimmed, def) {
216
233
  // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
217
234
  if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
218
235
  return URL_BAD_FORMAT;
219
236
  }
220
237
  try {
238
+ if (typeof URL !== "undefined") {
239
+ const URLStatic = URL;
240
+ if (typeof URLStatic.parse === "function")
241
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
242
+ }
221
243
  // @ts-ignore
222
244
  return new URL(trimmed);
223
245
  }
@@ -244,7 +266,7 @@ export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) =>
244
266
  try {
245
267
  // Trim whitespace from input
246
268
  const trimmed = payload.value.trim();
247
- const url = parseURLObject(trimmed, def);
269
+ const url = validateURL(trimmed, def);
248
270
  if (url === URL_BAD_FORMAT) {
249
271
  payload.issues.push({
250
272
  code: "invalid_format",
@@ -266,6 +288,10 @@ export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) =>
266
288
  });
267
289
  return;
268
290
  }
291
+ if (url === true) {
292
+ payload.value = stripTabAndNewline(trimmed);
293
+ return;
294
+ }
269
295
  if (def.hostname && !urlHostnameOk(url, def.hostname)) {
270
296
  payload.issues.push({
271
297
  code: "invalid_format",
@@ -363,14 +389,7 @@ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
363
389
  export function isValidIPv6(value) {
364
390
  if (!ipv6Alphabet.test(value))
365
391
  return false;
366
- try {
367
- // @ts-ignore
368
- new URL(`http://[${value}]`);
369
- return true;
370
- }
371
- catch {
372
- return false;
373
- }
392
+ return canParseURL(`http://[${value}]`);
374
393
  }
375
394
  export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
376
395
  def.pattern ?? (def.pattern = regexes.ipv6);
@@ -2585,64 +2604,3 @@ function handleRefineResult(result, payload, input, inst) {
2585
2604
  payload.issues.push(util.issue(_iss));
2586
2605
  }
2587
2606
  }
2588
- // asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
2589
- function handlePropertiesResult(result, payload, key) {
2590
- if (result.issues.length) {
2591
- payload.issues.push(...util.prefixIssues(key, result.issues));
2592
- }
2593
- }
2594
- export const $ZodProperties = /*@__PURE__*/ core.$constructor("$ZodProperties", (inst, def) => {
2595
- // $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
2596
- $ZodType.init(inst, def);
2597
- checks.$ZodCheck.init(inst, def);
2598
- const memo = core.globalConfig.memoizer;
2599
- memo?.attach(inst);
2600
- // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
2601
- let entries;
2602
- const runShape = (payload, ctx) => {
2603
- entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2604
- const input = payload.value;
2605
- let proms;
2606
- for (const [key, schema] of entries) {
2607
- const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
2608
- if (result instanceof Promise) {
2609
- proms ?? (proms = []);
2610
- proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
2611
- }
2612
- else {
2613
- handlePropertiesResult(result, payload, key);
2614
- }
2615
- }
2616
- if (proms)
2617
- return Promise.all(proms).then(() => undefined);
2618
- return undefined;
2619
- };
2620
- inst._zod.parse = (payload, ctx) => {
2621
- const input = payload.value;
2622
- // as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
2623
- if (input === null || (typeof input !== "object" && typeof input !== "function")) {
2624
- payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
2625
- return payload;
2626
- }
2627
- // both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
2628
- if (ctx.direction === "backward")
2629
- ctx = { ...ctx, direction: "forward" };
2630
- // the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
2631
- if (memo)
2632
- memo.alloc(inst, payload, input, ctx);
2633
- const result = runShape(payload, ctx);
2634
- return result instanceof Promise ? result.then(() => payload) : payload;
2635
- };
2636
- // as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
2637
- inst._zod.check = (payload) => {
2638
- if (payload.value == null) {
2639
- payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2640
- return undefined;
2641
- }
2642
- return runShape(payload, {});
2643
- };
2644
- }, {
2645
- *[Symbol.iterator]() {
2646
- yield this;
2647
- },
2648
- });
@@ -9,7 +9,6 @@ exports.processSchema = processSchema;
9
9
  exports.process = processSchema;
10
10
  exports.extractDefs = extractDefs;
11
11
  exports.finalize = finalize;
12
- exports.isTransforming = isTransforming;
13
12
  const registries_js_1 = require("./registries.cjs");
14
13
  const util_js_1 = require("./util.cjs");
15
14
  function assignProps(target, ...sources) {
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
137
137
  export { processSchema as process };
138
138
  export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
139
139
  export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
140
- export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
141
- seen: Set<schemas.$ZodType>;
142
- }): boolean;
143
140
  export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
144
141
  export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
145
142
  "~standard": ZodStandardSchemaWithJSON<T>;
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
137
137
  export { processSchema as process };
138
138
  export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
139
139
  export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
140
- export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
141
- seen: Set<schemas.$ZodType>;
142
- }): boolean;
143
140
  export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
144
141
  export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
145
142
  "~standard": ZodStandardSchemaWithJSON<T>;
@@ -572,7 +572,7 @@ export function finalize(ctx, schema) {
572
572
  throw new Error("Error converting schema to JSON.");
573
573
  }
574
574
  }
575
- export function isTransforming(_schema, _ctx) {
575
+ function isTransforming(_schema, _ctx) {
576
576
  const ctx = _ctx ?? { seen: new Set() };
577
577
  if (ctx.seen.has(_schema))
578
578
  return false;
package/v4/core/util.cjs CHANGED
@@ -796,10 +796,6 @@ function members(proto, table) {
796
796
  else
797
797
  defineBound(proto, key, desc.value);
798
798
  }
799
- // for..in sees no symbol keys, so well-known members like Symbol.iterator install here
800
- for (const sym of Object.getOwnPropertySymbols(table)) {
801
- defineBound(proto, sym, table[sym]);
802
- }
803
799
  }
804
800
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
805
801
  function own(inst, key, value, enumerable = true) {
package/v4/core/util.js CHANGED
@@ -725,10 +725,6 @@ export function members(proto, table) {
725
725
  else
726
726
  defineBound(proto, key, desc.value);
727
727
  }
728
- // for..in sees no symbol keys, so well-known members like Symbol.iterator install here
729
- for (const sym of Object.getOwnPropertySymbols(table)) {
730
- defineBound(proto, sym, table[sym]);
731
- }
732
728
  }
733
729
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
734
730
  export function own(inst, key, value, enumerable = true) {
@@ -4,7 +4,7 @@ exports.version = void 0;
4
4
  exports.version = {
5
5
  major: 4,
6
6
  minor: 6,
7
- patch: 2,
7
+ patch: 4,
8
8
  };
9
9
 
10
10
  // seal-cjs-exports
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 6,
4
- patch: 2,
4
+ patch: 4,
5
5
  };
package/v4/core/visit.cjs CHANGED
@@ -161,18 +161,6 @@ function visit(schema, fnOrHandlers) {
161
161
  const { _cachedInner, ...rest } = def;
162
162
  return (0, util_js_1.clone)(s, { ...rest, getter: () => run(original()) });
163
163
  }
164
- case "properties": {
165
- const oldShape = def.shape;
166
- let changed = false;
167
- const newShape = {};
168
- for (const k of Reflect.ownKeys(oldShape)) {
169
- const mapped = run(oldShape[k]);
170
- if (mapped !== oldShape[k])
171
- changed = true;
172
- newShape[k] = mapped;
173
- }
174
- return changed ? (0, util_js_1.clone)(s, { ...def, shape: newShape }) : s;
175
- }
176
164
  // A leaf by choice: `parts` are regex fragments, not data positions.
177
165
  case "template_literal":
178
166
  // Leaves.
package/v4/core/visit.js CHANGED
@@ -135,18 +135,6 @@ export function visit(schema, fnOrHandlers) {
135
135
  const { _cachedInner, ...rest } = def;
136
136
  return clone(s, { ...rest, getter: () => run(original()) });
137
137
  }
138
- case "properties": {
139
- const oldShape = def.shape;
140
- let changed = false;
141
- const newShape = {};
142
- for (const k of Reflect.ownKeys(oldShape)) {
143
- const mapped = run(oldShape[k]);
144
- if (mapped !== oldShape[k])
145
- changed = true;
146
- newShape[k] = mapped;
147
- }
148
- return changed ? clone(s, { ...def, shape: newShape }) : s;
149
- }
150
138
  // A leaf by choice: `parts` are regex fragments, not data positions.
151
139
  case "template_literal":
152
140
  // Leaves.
package/v4/locales/ar.cjs CHANGED
@@ -65,6 +65,7 @@ const error = () => {
65
65
  json_string: "نَص على هيئة JSON",
66
66
  e164: "رقم هاتف بمعيار E.164",
67
67
  credit_card: "رقم بطاقة الائتمان",
68
+ currency_code: "رمز العملة",
68
69
  iban: "IBAN",
69
70
  jwt: "JWT",
70
71
  template_literal: "مدخل",
package/v4/locales/ar.js CHANGED
@@ -39,6 +39,7 @@ const error = () => {
39
39
  json_string: "نَص على هيئة JSON",
40
40
  e164: "رقم هاتف بمعيار E.164",
41
41
  credit_card: "رقم بطاقة الائتمان",
42
+ currency_code: "رمز العملة",
42
43
  iban: "IBAN",
43
44
  jwt: "JWT",
44
45
  template_literal: "مدخل",
package/v4/locales/az.cjs CHANGED
@@ -65,6 +65,7 @@ const error = () => {
65
65
  json_string: "JSON string",
66
66
  e164: "E.164 number",
67
67
  credit_card: "kredit kartı nömrəsi",
68
+ currency_code: "valyuta kodu",
68
69
  iban: "IBAN",
69
70
  jwt: "JWT",
70
71
  template_literal: "input",
package/v4/locales/az.js CHANGED
@@ -39,6 +39,7 @@ const error = () => {
39
39
  json_string: "JSON string",
40
40
  e164: "E.164 number",
41
41
  credit_card: "kredit kartı nömrəsi",
42
+ currency_code: "valyuta kodu",
42
43
  iban: "IBAN",
43
44
  jwt: "JWT",
44
45
  template_literal: "input",
package/v4/locales/be.cjs CHANGED
@@ -115,6 +115,7 @@ const error = () => {
115
115
  json_string: "JSON радок",
116
116
  e164: "нумар E.164",
117
117
  credit_card: "нумар крэдытнай карты",
118
+ currency_code: "код валюты",
118
119
  iban: "IBAN",
119
120
  jwt: "JWT",
120
121
  template_literal: "увод",
package/v4/locales/be.js CHANGED
@@ -89,6 +89,7 @@ const error = () => {
89
89
  json_string: "JSON радок",
90
90
  e164: "нумар E.164",
91
91
  credit_card: "нумар крэдытнай карты",
92
+ currency_code: "код валюты",
92
93
  iban: "IBAN",
93
94
  jwt: "JWT",
94
95
  template_literal: "увод",
package/v4/locales/bg.cjs CHANGED
@@ -65,6 +65,7 @@ const error = () => {
65
65
  json_string: "JSON низ",
66
66
  e164: "E.164 номер",
67
67
  credit_card: "номер на кредитна карта",
68
+ currency_code: "код на валута",
68
69
  iban: "IBAN",
69
70
  jwt: "JWT",
70
71
  template_literal: "вход",
package/v4/locales/bg.js CHANGED
@@ -39,6 +39,7 @@ const error = () => {
39
39
  json_string: "JSON низ",
40
40
  e164: "E.164 номер",
41
41
  credit_card: "номер на кредитна карта",
42
+ currency_code: "код на валута",
42
43
  iban: "IBAN",
43
44
  jwt: "JWT",
44
45
  template_literal: "вход",
package/v4/locales/bn.cjs CHANGED
@@ -65,6 +65,7 @@ const error = () => {
65
65
  json_string: "JSON স্ট্রিং",
66
66
  e164: "E.164 নম্বর",
67
67
  credit_card: "ক্রেডিট কার্ড নম্বর",
68
+ currency_code: "মুদ্রা কোড",
68
69
  iban: "IBAN",
69
70
  jwt: "JWT",
70
71
  template_literal: "ইনপুট",
package/v4/locales/bn.js CHANGED
@@ -39,6 +39,7 @@ const error = () => {
39
39
  json_string: "JSON স্ট্রিং",
40
40
  e164: "E.164 নম্বর",
41
41
  credit_card: "ক্রেডিট কার্ড নম্বর",
42
+ currency_code: "মুদ্রা কোড",
42
43
  iban: "IBAN",
43
44
  jwt: "JWT",
44
45
  template_literal: "ইনপুট",
package/v4/locales/ca.cjs CHANGED
@@ -65,6 +65,7 @@ const error = () => {
65
65
  json_string: "cadena JSON",
66
66
  e164: "número E.164",
67
67
  credit_card: "número de targeta de crèdit",
68
+ currency_code: "codi de moneda",
68
69
  iban: "IBAN",
69
70
  jwt: "JWT",
70
71
  template_literal: "entrada",
package/v4/locales/ca.js CHANGED
@@ -39,6 +39,7 @@ const error = () => {
39
39
  json_string: "cadena JSON",
40
40
  e164: "número E.164",
41
41
  credit_card: "número de targeta de crèdit",
42
+ currency_code: "codi de moneda",
42
43
  iban: "IBAN",
43
44
  jwt: "JWT",
44
45
  template_literal: "entrada",