zod 4.6.3 → 4.6.5

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 (232) hide show
  1. package/package.json +1 -1
  2. package/src/v4/classic/schemas.ts +11 -5
  3. package/src/v4/classic/tests/assignability.test.ts +1 -0
  4. package/src/v4/classic/tests/instance-footprint.test.ts +22 -0
  5. package/src/v4/classic/tests/number.test.ts +39 -0
  6. package/src/v4/classic/tests/properties.test.ts +19 -0
  7. package/src/v4/classic/tests/string.test.ts +70 -1
  8. package/src/v4/classic/tests/to-json-schema.test.ts +87 -35
  9. package/src/v4/core/api.ts +17 -22
  10. package/src/v4/core/compile.ts +27 -6
  11. package/src/v4/core/core.ts +1 -3
  12. package/src/v4/core/json-schema-processors.ts +9 -13
  13. package/src/v4/core/regexes.ts +4 -0
  14. package/src/v4/core/schemas.ts +35 -11
  15. package/src/v4/core/tests/compile-differential.test.ts +35 -0
  16. package/src/v4/core/tests/compile.test.ts +177 -0
  17. package/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  18. package/src/v4/core/versions.ts +1 -1
  19. package/src/v4/locales/ar.ts +1 -0
  20. package/src/v4/locales/az.ts +1 -0
  21. package/src/v4/locales/be.ts +1 -0
  22. package/src/v4/locales/bg.ts +1 -0
  23. package/src/v4/locales/bn.ts +1 -0
  24. package/src/v4/locales/ca.ts +1 -0
  25. package/src/v4/locales/ckb.ts +1 -0
  26. package/src/v4/locales/cs.ts +1 -0
  27. package/src/v4/locales/da.ts +1 -0
  28. package/src/v4/locales/de.ts +1 -0
  29. package/src/v4/locales/el.ts +1 -0
  30. package/src/v4/locales/en.ts +1 -0
  31. package/src/v4/locales/eo.ts +1 -0
  32. package/src/v4/locales/es.ts +1 -0
  33. package/src/v4/locales/fa.ts +1 -0
  34. package/src/v4/locales/fi.ts +1 -0
  35. package/src/v4/locales/fr-CA.ts +1 -0
  36. package/src/v4/locales/fr.ts +1 -0
  37. package/src/v4/locales/gu.ts +1 -0
  38. package/src/v4/locales/he.ts +1 -0
  39. package/src/v4/locales/hi.ts +1 -0
  40. package/src/v4/locales/hr.ts +1 -0
  41. package/src/v4/locales/hu.ts +1 -0
  42. package/src/v4/locales/hy.ts +1 -0
  43. package/src/v4/locales/id.ts +1 -0
  44. package/src/v4/locales/is.ts +1 -0
  45. package/src/v4/locales/it.ts +1 -0
  46. package/src/v4/locales/ja.ts +1 -0
  47. package/src/v4/locales/ka.ts +1 -0
  48. package/src/v4/locales/km.ts +1 -0
  49. package/src/v4/locales/kn.ts +1 -0
  50. package/src/v4/locales/ko.ts +1 -0
  51. package/src/v4/locales/lt.ts +1 -0
  52. package/src/v4/locales/mk.ts +1 -0
  53. package/src/v4/locales/ms.ts +1 -0
  54. package/src/v4/locales/ne.ts +1 -0
  55. package/src/v4/locales/nl.ts +1 -0
  56. package/src/v4/locales/nn.ts +1 -0
  57. package/src/v4/locales/no.ts +1 -0
  58. package/src/v4/locales/ota.ts +1 -0
  59. package/src/v4/locales/pl.ts +1 -0
  60. package/src/v4/locales/ps.ts +1 -0
  61. package/src/v4/locales/pt-BR.ts +1 -0
  62. package/src/v4/locales/pt.ts +1 -0
  63. package/src/v4/locales/ro.ts +1 -0
  64. package/src/v4/locales/ru.ts +1 -0
  65. package/src/v4/locales/sk.ts +1 -0
  66. package/src/v4/locales/sl.ts +1 -0
  67. package/src/v4/locales/sv.ts +1 -0
  68. package/src/v4/locales/ta.ts +1 -0
  69. package/src/v4/locales/tg.ts +1 -0
  70. package/src/v4/locales/th.ts +1 -0
  71. package/src/v4/locales/tk.ts +1 -0
  72. package/src/v4/locales/tr.ts +1 -0
  73. package/src/v4/locales/uk.ts +1 -0
  74. package/src/v4/locales/ur.ts +1 -0
  75. package/src/v4/locales/uz.ts +1 -0
  76. package/src/v4/locales/vi.ts +1 -0
  77. package/src/v4/locales/yo.ts +1 -0
  78. package/src/v4/locales/zh-CN.ts +1 -0
  79. package/src/v4/locales/zh-TW.ts +1 -0
  80. package/src/v4/mini/schemas.ts +12 -4
  81. package/src/v4/mini/tests/index.test.ts +56 -0
  82. package/src/v4/mini/tests/string.test.ts +7 -0
  83. package/v4/classic/schemas.cjs +9 -4
  84. package/v4/classic/schemas.d.cts +4 -1
  85. package/v4/classic/schemas.d.ts +4 -1
  86. package/v4/classic/schemas.js +8 -4
  87. package/v4/core/api.cjs +9 -20
  88. package/v4/core/api.d.cts +6 -2
  89. package/v4/core/api.d.ts +6 -2
  90. package/v4/core/api.js +9 -20
  91. package/v4/core/compile.cjs +7 -6
  92. package/v4/core/compile.js +8 -7
  93. package/v4/core/core.cjs +1 -1
  94. package/v4/core/core.js +1 -1
  95. package/v4/core/json-schema-processors.cjs +7 -10
  96. package/v4/core/json-schema-processors.js +7 -10
  97. package/v4/core/regexes.cjs +4 -2
  98. package/v4/core/regexes.d.cts +1 -0
  99. package/v4/core/regexes.d.ts +1 -0
  100. package/v4/core/regexes.js +2 -0
  101. package/v4/core/schemas.cjs +32 -11
  102. package/v4/core/schemas.d.cts +5 -3
  103. package/v4/core/schemas.d.ts +5 -3
  104. package/v4/core/schemas.js +30 -11
  105. package/v4/core/versions.cjs +1 -1
  106. package/v4/core/versions.js +1 -1
  107. package/v4/locales/ar.cjs +1 -0
  108. package/v4/locales/ar.js +1 -0
  109. package/v4/locales/az.cjs +1 -0
  110. package/v4/locales/az.js +1 -0
  111. package/v4/locales/be.cjs +1 -0
  112. package/v4/locales/be.js +1 -0
  113. package/v4/locales/bg.cjs +1 -0
  114. package/v4/locales/bg.js +1 -0
  115. package/v4/locales/bn.cjs +1 -0
  116. package/v4/locales/bn.js +1 -0
  117. package/v4/locales/ca.cjs +1 -0
  118. package/v4/locales/ca.js +1 -0
  119. package/v4/locales/ckb.cjs +1 -0
  120. package/v4/locales/ckb.js +1 -0
  121. package/v4/locales/cs.cjs +1 -0
  122. package/v4/locales/cs.js +1 -0
  123. package/v4/locales/da.cjs +1 -0
  124. package/v4/locales/da.js +1 -0
  125. package/v4/locales/de.cjs +1 -0
  126. package/v4/locales/de.js +1 -0
  127. package/v4/locales/el.cjs +1 -0
  128. package/v4/locales/el.js +1 -0
  129. package/v4/locales/en.cjs +1 -0
  130. package/v4/locales/en.js +1 -0
  131. package/v4/locales/eo.cjs +1 -0
  132. package/v4/locales/eo.js +1 -0
  133. package/v4/locales/es.cjs +1 -0
  134. package/v4/locales/es.js +1 -0
  135. package/v4/locales/fa.cjs +1 -0
  136. package/v4/locales/fa.js +1 -0
  137. package/v4/locales/fi.cjs +1 -0
  138. package/v4/locales/fi.js +1 -0
  139. package/v4/locales/fr-CA.cjs +1 -0
  140. package/v4/locales/fr-CA.js +1 -0
  141. package/v4/locales/fr.cjs +1 -0
  142. package/v4/locales/fr.js +1 -0
  143. package/v4/locales/gu.cjs +1 -0
  144. package/v4/locales/gu.js +1 -0
  145. package/v4/locales/he.cjs +1 -0
  146. package/v4/locales/he.js +1 -0
  147. package/v4/locales/hi.cjs +1 -0
  148. package/v4/locales/hi.js +1 -0
  149. package/v4/locales/hr.cjs +1 -0
  150. package/v4/locales/hr.js +1 -0
  151. package/v4/locales/hu.cjs +1 -0
  152. package/v4/locales/hu.js +1 -0
  153. package/v4/locales/hy.cjs +1 -0
  154. package/v4/locales/hy.js +1 -0
  155. package/v4/locales/id.cjs +1 -0
  156. package/v4/locales/id.js +1 -0
  157. package/v4/locales/is.cjs +1 -0
  158. package/v4/locales/is.js +1 -0
  159. package/v4/locales/it.cjs +1 -0
  160. package/v4/locales/it.js +1 -0
  161. package/v4/locales/ja.cjs +1 -0
  162. package/v4/locales/ja.js +1 -0
  163. package/v4/locales/ka.cjs +1 -0
  164. package/v4/locales/ka.js +1 -0
  165. package/v4/locales/km.cjs +1 -0
  166. package/v4/locales/km.js +1 -0
  167. package/v4/locales/kn.cjs +1 -0
  168. package/v4/locales/kn.js +1 -0
  169. package/v4/locales/ko.cjs +1 -0
  170. package/v4/locales/ko.js +1 -0
  171. package/v4/locales/lt.cjs +1 -0
  172. package/v4/locales/lt.js +1 -0
  173. package/v4/locales/mk.cjs +1 -0
  174. package/v4/locales/mk.js +1 -0
  175. package/v4/locales/ms.cjs +1 -0
  176. package/v4/locales/ms.js +1 -0
  177. package/v4/locales/ne.cjs +1 -0
  178. package/v4/locales/ne.js +1 -0
  179. package/v4/locales/nl.cjs +1 -0
  180. package/v4/locales/nl.js +1 -0
  181. package/v4/locales/nn.cjs +1 -0
  182. package/v4/locales/nn.js +1 -0
  183. package/v4/locales/no.cjs +1 -0
  184. package/v4/locales/no.js +1 -0
  185. package/v4/locales/ota.cjs +1 -0
  186. package/v4/locales/ota.js +1 -0
  187. package/v4/locales/pl.cjs +1 -0
  188. package/v4/locales/pl.js +1 -0
  189. package/v4/locales/ps.cjs +1 -0
  190. package/v4/locales/ps.js +1 -0
  191. package/v4/locales/pt-BR.cjs +1 -0
  192. package/v4/locales/pt-BR.js +1 -0
  193. package/v4/locales/pt.cjs +1 -0
  194. package/v4/locales/pt.js +1 -0
  195. package/v4/locales/ro.cjs +1 -0
  196. package/v4/locales/ro.js +1 -0
  197. package/v4/locales/ru.cjs +1 -0
  198. package/v4/locales/ru.js +1 -0
  199. package/v4/locales/sk.cjs +1 -0
  200. package/v4/locales/sk.js +1 -0
  201. package/v4/locales/sl.cjs +1 -0
  202. package/v4/locales/sl.js +1 -0
  203. package/v4/locales/sv.cjs +1 -0
  204. package/v4/locales/sv.js +1 -0
  205. package/v4/locales/ta.cjs +1 -0
  206. package/v4/locales/ta.js +1 -0
  207. package/v4/locales/tg.cjs +1 -0
  208. package/v4/locales/tg.js +1 -0
  209. package/v4/locales/th.cjs +1 -0
  210. package/v4/locales/th.js +1 -0
  211. package/v4/locales/tk.cjs +1 -0
  212. package/v4/locales/tk.js +1 -0
  213. package/v4/locales/tr.cjs +1 -0
  214. package/v4/locales/tr.js +1 -0
  215. package/v4/locales/uk.cjs +1 -0
  216. package/v4/locales/uk.js +1 -0
  217. package/v4/locales/ur.cjs +1 -0
  218. package/v4/locales/ur.js +1 -0
  219. package/v4/locales/uz.cjs +1 -0
  220. package/v4/locales/uz.js +1 -0
  221. package/v4/locales/vi.cjs +1 -0
  222. package/v4/locales/vi.js +1 -0
  223. package/v4/locales/yo.cjs +1 -0
  224. package/v4/locales/yo.js +1 -0
  225. package/v4/locales/zh-CN.cjs +1 -0
  226. package/v4/locales/zh-CN.js +1 -0
  227. package/v4/locales/zh-TW.cjs +1 -0
  228. package/v4/locales/zh-TW.js +1 -0
  229. package/v4/mini/schemas.cjs +10 -4
  230. package/v4/mini/schemas.d.cts +1 -0
  231. package/v4/mini/schemas.d.ts +1 -0
  232. package/v4/mini/schemas.js +9 -4
@@ -45,6 +45,7 @@ const error: () => errors.$ZodErrorMap = () => {
45
45
  json_string: "JSON tekst",
46
46
  e164: "E.164 broj",
47
47
  credit_card: "broj kreditne kartice",
48
+ currency_code: "kod valute",
48
49
  iban: "IBAN",
49
50
  jwt: "JWT",
50
51
  template_literal: "unos",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON string",
47
47
  e164: "E.164 szám",
48
48
  credit_card: "hitelkártyaszám",
49
+ currency_code: "pénznemkód",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "bemenet",
@@ -95,6 +95,7 @@ const error: () => errors.$ZodErrorMap = () => {
95
95
  json_string: "JSON տող",
96
96
  e164: "E.164 համար",
97
97
  credit_card: "կրեդիտ քարտի համար",
98
+ currency_code: "արժույթի կոդ",
98
99
  iban: "IBAN",
99
100
  jwt: "JWT",
100
101
  template_literal: "մուտք",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "string JSON",
47
47
  e164: "angka E.164",
48
48
  credit_card: "nomor kartu kredit",
49
+ currency_code: "kode mata uang",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON strengur",
47
47
  e164: "E.164 tölugildi",
48
48
  credit_card: "kreditkortanúmer",
49
+ currency_code: "gjaldmiðilskóði",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "gildi",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "stringa JSON",
47
47
  e164: "numero E.164",
48
48
  credit_card: "numero di carta di credito",
49
+ currency_code: "codice valuta",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON文字列",
47
47
  e164: "E.164番号",
48
48
  credit_card: "クレジットカード番号",
49
+ currency_code: "通貨コード",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "入力値",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON ველი",
47
47
  e164: "E.164 ნომერი",
48
48
  credit_card: "საკრედიტო ბარათის ნომერი",
49
+ currency_code: "ვალუტის კოდი",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "შეყვანა",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ខ្សែអក្សរ JSON",
47
47
  e164: "លេខ E.164",
48
48
  credit_card: "លេខប័ណ្ណឥណទាន",
49
+ currency_code: "កូដរូបិយប័ណ្ណ",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "ទិន្នន័យបញ្ចូល",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSONಸ್ಟ್ರಿಂಗ್",
47
47
  e164: "E.164 ಸಂಖ್ಯೆ",
48
48
  credit_card: "ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ",
49
+ currency_code: "ಕರೆನ್ಸಿ ಕೋಡ್",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "ಇನ್ಪುಟ್",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON 문자열",
47
47
  e164: "E.164 번호",
48
48
  credit_card: "신용카드 번호",
49
+ currency_code: "통화 코드",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "입력",
@@ -146,6 +146,7 @@ const error: () => errors.$ZodErrorMap = () => {
146
146
  json_string: "JSON eilutė",
147
147
  e164: "E.164 numeris",
148
148
  credit_card: "kredito kortelės numeris",
149
+ currency_code: "valiutos kodas",
149
150
  iban: "IBAN",
150
151
  jwt: "JWT",
151
152
  template_literal: "įvestis",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON низа",
47
47
  e164: "E.164 број",
48
48
  credit_card: "број на кредитна картичка",
49
+ currency_code: "код на валута",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "внес",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "string JSON",
47
47
  e164: "nombor E.164",
48
48
  credit_card: "nombor kad kredit",
49
+ currency_code: "kod mata wang",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON स्ट्रिङ",
47
47
  e164: "E.164 नम्बर",
48
48
  credit_card: "क्रेडिट कार्ड नम्बर",
49
+ currency_code: "मुद्रा कोड",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "इनपुट",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON string",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "creditcardnummer",
49
+ currency_code: "valutacode",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "invoer",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-streng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kredittkortnummer",
49
+ currency_code: "valutakode",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-streng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kredittkortnummer",
49
+ currency_code: "valutakode",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON metin",
47
47
  e164: "E.164 sayısı",
48
48
  credit_card: "i'tibâr kartı numarası",
49
+ currency_code: "para birimi kodu",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "giren",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ciąg znaków w formacie JSON",
47
47
  e164: "liczba E.164",
48
48
  credit_card: "numer karty kredytowej",
49
+ currency_code: "kod waluty",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "wejście",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON متن",
47
47
  e164: "د E.164 شمېره",
48
48
  credit_card: "د کریډیټ کارت شمیره",
49
+ currency_code: "د اسعارو کوډ",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "ورودي",
@@ -47,6 +47,7 @@ const error: () => errors.$ZodErrorMap = () => {
47
47
  json_string: "o texto JSON",
48
48
  e164: "o número E.164",
49
49
  credit_card: "o número de cartão de crédito",
50
+ currency_code: "o código de moeda",
50
51
  iban: "o IBAN",
51
52
  jwt: "o JWT",
52
53
  template_literal: "a entrada",
@@ -47,6 +47,7 @@ const error: () => errors.$ZodErrorMap = () => {
47
47
  json_string: "o texto JSON",
48
48
  e164: "o número E.164",
49
49
  credit_card: "o número de cartão de crédito",
50
+ currency_code: "o código de moeda",
50
51
  iban: "o IBAN",
51
52
  jwt: "o JWT",
52
53
  template_literal: "a entrada",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "șir JSON",
47
47
  e164: "număr E.164",
48
48
  credit_card: "număr de card de credit",
49
+ currency_code: "cod valutar",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "intrare",
@@ -109,6 +109,7 @@ const error: () => errors.$ZodErrorMap = () => {
109
109
  json_string: "JSON строка",
110
110
  e164: "номер E.164",
111
111
  credit_card: "номер кредитной карты",
112
+ currency_code: "код валюты",
112
113
  iban: "IBAN",
113
114
  jwt: "JWT",
114
115
  template_literal: "ввод",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "reťazec vo formáte JSON",
47
47
  e164: "číslo E.164",
48
48
  credit_card: "číslo kreditnej karty",
49
+ currency_code: "kód meny",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "vstup",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON niz",
47
47
  e164: "E.164 številka",
48
48
  credit_card: "številka kreditne kartice",
49
+ currency_code: "koda valute",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "vnos",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON-sträng",
47
47
  e164: "E.164-nummer",
48
48
  credit_card: "kreditkortsnummer",
49
+ currency_code: "valutakod",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "mall-literal",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON சரம்",
47
47
  e164: "E.164 எண்",
48
48
  credit_card: "கடன் அட்டை எண்",
49
+ currency_code: "நாணயக் குறியீடு",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "input",
@@ -47,6 +47,7 @@ const error: () => errors.$ZodErrorMap = () => {
47
47
  json_string: "сатри JSON",
48
48
  e164: "рақами E.164",
49
49
  credit_card: "рақами корти кредитӣ",
50
+ currency_code: "рамзи асъор",
50
51
  iban: "IBAN",
51
52
  jwt: "JWT",
52
53
  template_literal: "вуруд",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ข้อความแบบ JSON",
47
47
  e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",
48
48
  credit_card: "หมายเลขบัตรเครดิต",
49
+ currency_code: "รหัสสกุลเงิน",
49
50
  iban: "IBAN",
50
51
  jwt: "โทเคน JWT",
51
52
  template_literal: "ข้อมูลที่ป้อน",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON setiri",
47
47
  e164: "E.164 nomeri",
48
48
  credit_card: "kredit kartynyň nomeri",
49
+ currency_code: "walýuta kody",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "şablon",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON dizesi",
47
47
  e164: "E.164 sayısı",
48
48
  credit_card: "kredi kartı numarası",
49
+ currency_code: "para birimi kodu",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "Şablon dizesi",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "рядок JSON",
47
47
  e164: "номер E.164",
48
48
  credit_card: "номер кредитної картки",
49
+ currency_code: "код валюти",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "вхідні дані",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "جے ایس او این سٹرنگ",
47
47
  e164: "ای 164 نمبر",
48
48
  credit_card: "کریڈٹ کارڈ نمبر",
49
+ currency_code: "کرنسی کوڈ",
49
50
  iban: "IBAN",
50
51
  jwt: "جے ڈبلیو ٹی",
51
52
  template_literal: "ان پٹ",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON satr",
47
47
  e164: "E.164 raqam",
48
48
  credit_card: "kredit karta raqami",
49
+ currency_code: "valyuta kodi",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "kirish",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "chuỗi JSON",
47
47
  e164: "số E.164",
48
48
  credit_card: "số thẻ tín dụng",
49
+ currency_code: "mã tiền tệ",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "đầu vào",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "ọ̀rọ̀ JSON",
47
47
  e164: "nọ́mbà E.164",
48
48
  credit_card: "nọmba kaadi gbese",
49
+ currency_code: "koodu owó",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "ẹ̀rọ ìbáwọlé",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON字符串",
47
47
  e164: "E.164号码",
48
48
  credit_card: "信用卡号",
49
+ currency_code: "货币代码",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "输入",
@@ -46,6 +46,7 @@ const error: () => errors.$ZodErrorMap = () => {
46
46
  json_string: "JSON 字串",
47
47
  e164: "E.164 數值",
48
48
  credit_card: "信用卡號",
49
+ currency_code: "貨幣代碼",
49
50
  iban: "IBAN",
50
51
  jwt: "JWT",
51
52
  template_literal: "輸入",
@@ -1,5 +1,6 @@
1
1
  import * as core from "../core/index.js";
2
2
  import type { $ZodBigIntFormats } from "../core/index.js";
3
+ import * as regexes from "../core/regexes.js";
3
4
  import * as util from "../core/util.js";
4
5
  import * as parse from "./parse.js";
5
6
 
@@ -224,8 +225,8 @@ export function url(params?: string | core.$ZodURLParams): ZodMiniURL {
224
225
  // @__NO_SIDE_EFFECTS__
225
226
  export function httpUrl(params?: string | Omit<core.$ZodURLParams, "protocol" | "hostname">): ZodMiniURL {
226
227
  return core._url(ZodMiniURL, {
227
- protocol: core.regexes.httpProtocol,
228
- hostname: core.regexes.domain,
228
+ protocol: regexes.httpProtocol,
229
+ hostname: regexes.domain,
229
230
  ...util.normalizeParams(params),
230
231
  });
231
232
  }
@@ -563,12 +564,19 @@ export function stringFormat<Format extends string>(
563
564
 
564
565
  // @__NO_SIDE_EFFECTS__
565
566
  export function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname"> {
566
- return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params) as any;
567
+ return core._stringFormat(ZodMiniCustomStringFormat, "hostname", regexes.hostname, _params) as any;
567
568
  }
568
569
 
569
570
  // @__NO_SIDE_EFFECTS__
570
571
  export function hex(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hex"> {
571
- return core._stringFormat(ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params) as any;
572
+ return core._stringFormat(ZodMiniCustomStringFormat, "hex", regexes.hex, _params) as any;
573
+ }
574
+
575
+ // @__NO_SIDE_EFFECTS__
576
+ export function currencyCode(
577
+ _params?: string | core.$ZodStringFormatParams
578
+ ): ZodMiniCustomStringFormat<"currency_code"> {
579
+ return core._stringFormat(ZodMiniCustomStringFormat, "currency_code", regexes.currencyCode, _params) as any;
572
580
  }
573
581
 
574
582
  // @__NO_SIDE_EFFECTS__
@@ -2,6 +2,62 @@ import { expect, expectTypeOf, test } from "vitest";
2
2
  import * as z from "zod/mini";
3
3
  import type { util } from "zod/v4/core";
4
4
 
5
+ test("factory checks", () => {
6
+ const string = z.string({ checks: [z.minLength(1), z.maxLength(3)] as const });
7
+ const number = z.number({ checks: [z.minimum(1), z.maximum(3)] as const });
8
+ expectTypeOf<z.output<typeof string>>().toEqualTypeOf<string>();
9
+ expectTypeOf<z.output<typeof number>>().toEqualTypeOf<number>();
10
+ for (const [schema, valid, invalid] of [
11
+ [string, "ab", ""],
12
+ [number, 2, 4],
13
+ ] as const) {
14
+ expect(z.validate(schema, valid)).toBe(true);
15
+ expect(z.validate(schema, invalid)).toBe(false);
16
+ expect(schema._zod.parent).toBeUndefined();
17
+ expect(z.validate(z.compile(schema), valid)).toBe(true);
18
+ expect(z.validate(z.compile(schema), invalid)).toBe(false);
19
+ }
20
+ // @ts-expect-error numeric checks cannot validate strings
21
+ z.string({ checks: [z.minimum(1)] });
22
+ // @ts-expect-error length checks cannot validate numbers
23
+ z.number({ checks: [z.minLength(1)] });
24
+ });
25
+
26
+ test("factory checks snapshot caller arrays", () => {
27
+ for (const factory of [z.string, z.coerce.string]) {
28
+ const checks = [z.minLength(1)];
29
+ const schema = factory({ checks });
30
+ let reads = 0;
31
+ factory({
32
+ get checks() {
33
+ if (++reads > 1) throw new Error("checks read twice");
34
+ return checks;
35
+ },
36
+ });
37
+ expect(reads).toBe(1);
38
+ checks.push(z.minLength(10));
39
+ expect(z.validate(schema, "long")).toBe(true);
40
+ expect(z.validate(z.compile(schema), "long")).toBe(true);
41
+ expect(z.toJSONSchema(schema).minLength).toBe(1);
42
+ }
43
+ for (const factory of [z.number, z.coerce.number]) {
44
+ const checks = [z.minimum(1)];
45
+ const schema = factory({ checks });
46
+ let reads = 0;
47
+ factory({
48
+ get checks() {
49
+ if (++reads > 1) throw new Error("checks read twice");
50
+ return checks;
51
+ },
52
+ });
53
+ expect(reads).toBe(1);
54
+ checks.push(z.minimum(10));
55
+ expect(z.validate(schema, 3)).toBe(true);
56
+ expect(z.validate(z.compile(schema), 3)).toBe(true);
57
+ expect(z.toJSONSchema(schema).minimum).toBe(1);
58
+ }
59
+ });
60
+
5
61
  test("z.boolean", () => {
6
62
  const a = z.boolean();
7
63
  expect(z.parse(a, true)).toEqual(true);
@@ -387,3 +387,10 @@ test("z.hash generic format", () => {
387
387
  z.ZodMiniCustomStringFormat<"sha384_base64url">
388
388
  >();
389
389
  });
390
+
391
+ test("z.currencyCode", () => {
392
+ const a = z.currencyCode();
393
+ expectTypeOf(a).toEqualTypeOf<z.ZodMiniCustomStringFormat<"currency_code">>();
394
+ expect(z.parse(a, "EUR")).toBe("EUR");
395
+ expect(z.safeParse(a, "eur")).toMatchObject(FAIL);
396
+ });
@@ -58,6 +58,7 @@ exports.jwt = jwt;
58
58
  exports.stringFormat = stringFormat;
59
59
  exports.hostname = hostname;
60
60
  exports.hex = hex;
61
+ exports.currencyCode = currencyCode;
61
62
  exports.hash = hash;
62
63
  exports.number = number;
63
64
  exports.int = int;
@@ -128,6 +129,7 @@ exports.preprocess = preprocess;
128
129
  const core = __importStar(require("../core/index.cjs"));
129
130
  const index_js_1 = require("../core/index.cjs");
130
131
  const processors = __importStar(require("../core/json-schema-processors.cjs"));
132
+ const regexes = __importStar(require("../core/regexes.cjs"));
131
133
  const to_json_schema_js_1 = require("../core/to-json-schema.cjs");
132
134
  const en_js_1 = __importDefault(require("../locales/en.cjs"));
133
135
  const checks = __importStar(require("./checks.cjs"));
@@ -526,8 +528,8 @@ function url(params) {
526
528
  }
527
529
  function httpUrl(params) {
528
530
  return core._url(exports.ZodURL, {
529
- protocol: core.regexes.httpProtocol,
530
- hostname: core.regexes.domain,
531
+ protocol: regexes.httpProtocol,
532
+ hostname: regexes.domain,
531
533
  ...index_js_1.util.normalizeParams(params),
532
534
  });
533
535
  }
@@ -692,10 +694,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
692
694
  return core._stringFormat(exports.ZodCustomStringFormat, format, fnOrRegex, _params);
693
695
  }
694
696
  function hostname(_params) {
695
- return core._stringFormat(exports.ZodCustomStringFormat, "hostname", core.regexes.hostname, _params);
697
+ return core._stringFormat(exports.ZodCustomStringFormat, "hostname", regexes.hostname, _params);
696
698
  }
697
699
  function hex(_params) {
698
- return core._stringFormat(exports.ZodCustomStringFormat, "hex", core.regexes.hex, _params);
700
+ return core._stringFormat(exports.ZodCustomStringFormat, "hex", regexes.hex, _params);
701
+ }
702
+ function currencyCode(_params) {
703
+ return core._stringFormat(exports.ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params);
699
704
  }
700
705
  function hash(alg, params) {
701
706
  const enc = params?.enc ?? "hex";
@@ -330,6 +330,7 @@ export declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFor
330
330
  export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
331
331
  export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hostname">;
332
332
  export declare function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hex">;
333
+ export declare function currencyCode(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"currency_code">;
333
334
  export declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(alg: Alg, params?: {
334
335
  enc?: Enc;
335
336
  } & core.$ZodStringFormatParams): ZodCustomStringFormat<`${Alg}_${Enc}`>;
@@ -787,7 +788,9 @@ export declare const describe: typeof core.describe;
787
788
  export declare const meta: typeof core.meta;
788
789
  type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
789
790
  export interface ZodInstanceOf<T = unknown> extends ZodCustom<T, T> {
790
- properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodCheckPropertiesParams): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
791
+ properties<Shape extends {
792
+ [k in keyof T as T[k] extends Function ? never : k]?: core.$ZodType<unknown, T[k]>;
793
+ }>(shape: Shape, params?: string | core.$ZodCheckPropertiesParams): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
791
794
  }
792
795
  export declare const ZodInstanceOf: core.$constructor<ZodInstanceOf>;
793
796
  declare function _instanceof<T extends typeof util.Class>(cls: T, params?: ZodInstanceOfParams): ZodInstanceOf<InstanceType<T>>;
@@ -330,6 +330,7 @@ export declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFor
330
330
  export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
331
331
  export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hostname">;
332
332
  export declare function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hex">;
333
+ export declare function currencyCode(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"currency_code">;
333
334
  export declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(alg: Alg, params?: {
334
335
  enc?: Enc;
335
336
  } & core.$ZodStringFormatParams): ZodCustomStringFormat<`${Alg}_${Enc}`>;
@@ -787,7 +788,9 @@ export declare const describe: typeof core.describe;
787
788
  export declare const meta: typeof core.meta;
788
789
  type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
789
790
  export interface ZodInstanceOf<T = unknown> extends ZodCustom<T, T> {
790
- properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodCheckPropertiesParams): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
791
+ properties<Shape extends {
792
+ [k in keyof T as T[k] extends Function ? never : k]?: core.$ZodType<unknown, T[k]>;
793
+ }>(shape: Shape, params?: string | core.$ZodCheckPropertiesParams): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
791
794
  }
792
795
  export declare const ZodInstanceOf: core.$constructor<ZodInstanceOf>;
793
796
  declare function _instanceof<T extends typeof util.Class>(cls: T, params?: ZodInstanceOfParams): ZodInstanceOf<InstanceType<T>>;
@@ -1,6 +1,7 @@
1
1
  import * as core from "../core/index.js";
2
2
  import { util } from "../core/index.js";
3
3
  import * as processors from "../core/json-schema-processors.js";
4
+ import * as regexes from "../core/regexes.js";
4
5
  import { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from "../core/to-json-schema.js";
5
6
  import en from "../locales/en.js";
6
7
  import * as checks from "./checks.js";
@@ -399,8 +400,8 @@ export function url(params) {
399
400
  }
400
401
  export function httpUrl(params) {
401
402
  return core._url(ZodURL, {
402
- protocol: core.regexes.httpProtocol,
403
- hostname: core.regexes.domain,
403
+ protocol: regexes.httpProtocol,
404
+ hostname: regexes.domain,
404
405
  ...util.normalizeParams(params),
405
406
  });
406
407
  }
@@ -565,10 +566,13 @@ export function stringFormat(format, fnOrRegex, _params = {}) {
565
566
  return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
566
567
  }
567
568
  export function hostname(_params) {
568
- return core._stringFormat(ZodCustomStringFormat, "hostname", core.regexes.hostname, _params);
569
+ return core._stringFormat(ZodCustomStringFormat, "hostname", regexes.hostname, _params);
569
570
  }
570
571
  export function hex(_params) {
571
- return core._stringFormat(ZodCustomStringFormat, "hex", core.regexes.hex, _params);
572
+ return core._stringFormat(ZodCustomStringFormat, "hex", regexes.hex, _params);
573
+ }
574
+ export function currencyCode(_params) {
575
+ return core._stringFormat(ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params);
572
576
  }
573
577
  export function hash(alg, params) {
574
578
  const enc = params?.enc ?? "hex";