zod 3.25.12-alpha.0 → 3.25.13

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 (191) hide show
  1. package/package.json +16 -17
  2. package/dist/types/index.d.ts +0 -3
  3. package/dist/types/index.js +0 -3
  4. package/dist/types/v3/ZodError.d.ts +0 -164
  5. package/dist/types/v3/ZodError.js +0 -132
  6. package/dist/types/v3/benchmarks/datetime.d.ts +0 -5
  7. package/dist/types/v3/benchmarks/datetime.js +0 -49
  8. package/dist/types/v3/benchmarks/discriminatedUnion.d.ts +0 -5
  9. package/dist/types/v3/benchmarks/discriminatedUnion.js +0 -74
  10. package/dist/types/v3/benchmarks/index.d.ts +0 -1
  11. package/dist/types/v3/benchmarks/index.js +0 -54
  12. package/dist/types/v3/benchmarks/ipv4.d.ts +0 -5
  13. package/dist/types/v3/benchmarks/ipv4.js +0 -49
  14. package/dist/types/v3/benchmarks/object.d.ts +0 -5
  15. package/dist/types/v3/benchmarks/object.js +0 -65
  16. package/dist/types/v3/benchmarks/primitives.d.ts +0 -5
  17. package/dist/types/v3/benchmarks/primitives.js +0 -154
  18. package/dist/types/v3/benchmarks/realworld.d.ts +0 -5
  19. package/dist/types/v3/benchmarks/realworld.js +0 -51
  20. package/dist/types/v3/benchmarks/string.d.ts +0 -5
  21. package/dist/types/v3/benchmarks/string.js +0 -50
  22. package/dist/types/v3/benchmarks/union.d.ts +0 -5
  23. package/dist/types/v3/benchmarks/union.js +0 -74
  24. package/dist/types/v3/errors.d.ts +0 -5
  25. package/dist/types/v3/errors.js +0 -9
  26. package/dist/types/v3/external.d.ts +0 -6
  27. package/dist/types/v3/external.js +0 -6
  28. package/dist/types/v3/helpers/enumUtil.d.ts +0 -8
  29. package/dist/types/v3/helpers/enumUtil.js +0 -1
  30. package/dist/types/v3/helpers/errorUtil.d.ts +0 -9
  31. package/dist/types/v3/helpers/errorUtil.js +0 -6
  32. package/dist/types/v3/helpers/parseUtil.d.ts +0 -78
  33. package/dist/types/v3/helpers/parseUtil.js +0 -109
  34. package/dist/types/v3/helpers/partialUtil.d.ts +0 -8
  35. package/dist/types/v3/helpers/partialUtil.js +0 -1
  36. package/dist/types/v3/helpers/typeAliases.d.ts +0 -2
  37. package/dist/types/v3/helpers/typeAliases.js +0 -1
  38. package/dist/types/v3/helpers/util.d.ts +0 -85
  39. package/dist/types/v3/helpers/util.js +0 -133
  40. package/dist/types/v3/index.d.ts +0 -4
  41. package/dist/types/v3/index.js +0 -4
  42. package/dist/types/v3/locales/en.d.ts +0 -3
  43. package/dist/types/v3/locales/en.js +0 -107
  44. package/dist/types/v3/standard-schema.d.ts +0 -102
  45. package/dist/types/v3/standard-schema.js +0 -1
  46. package/dist/types/v3/tests/Mocker.d.ts +0 -17
  47. package/dist/types/v3/tests/Mocker.js +0 -53
  48. package/dist/types/v3/tests/language-server.source.d.ts +0 -70
  49. package/dist/types/v3/tests/language-server.source.js +0 -45
  50. package/dist/types/v3/types.d.ts +0 -1031
  51. package/dist/types/v3/types.js +0 -3713
  52. package/dist/types/v4/classic/checks.d.ts +0 -1
  53. package/dist/types/v4/classic/checks.js +0 -1
  54. package/dist/types/v4/classic/coerce.d.ts +0 -17
  55. package/dist/types/v4/classic/coerce.js +0 -17
  56. package/dist/types/v4/classic/compat.d.ts +0 -48
  57. package/dist/types/v4/classic/compat.js +0 -33
  58. package/dist/types/v4/classic/errors.d.ts +0 -30
  59. package/dist/types/v4/classic/errors.js +0 -41
  60. package/dist/types/v4/classic/external.d.ts +0 -8
  61. package/dist/types/v4/classic/external.js +0 -11
  62. package/dist/types/v4/classic/index.d.ts +0 -4
  63. package/dist/types/v4/classic/index.js +0 -4
  64. package/dist/types/v4/classic/iso.d.ts +0 -22
  65. package/dist/types/v4/classic/iso.js +0 -30
  66. package/dist/types/v4/classic/parse.d.ts +0 -23
  67. package/dist/types/v4/classic/parse.js +0 -6
  68. package/dist/types/v4/classic/schemas.d.ts +0 -653
  69. package/dist/types/v4/classic/schemas.js +0 -1012
  70. package/dist/types/v4/core/api.d.ts +0 -273
  71. package/dist/types/v4/core/api.js +0 -867
  72. package/dist/types/v4/core/checks.d.ts +0 -277
  73. package/dist/types/v4/core/checks.js +0 -535
  74. package/dist/types/v4/core/config.d.ts +0 -9
  75. package/dist/types/v4/core/config.js +0 -6
  76. package/dist/types/v4/core/core.d.ts +0 -43
  77. package/dist/types/v4/core/core.js +0 -53
  78. package/dist/types/v4/core/doc.d.ts +0 -14
  79. package/dist/types/v4/core/doc.js +0 -36
  80. package/dist/types/v4/core/errors.d.ts +0 -204
  81. package/dist/types/v4/core/errors.js +0 -206
  82. package/dist/types/v4/core/function.d.ts +0 -35
  83. package/dist/types/v4/core/function.js +0 -70
  84. package/dist/types/v4/core/index.d.ts +0 -15
  85. package/dist/types/v4/core/index.js +0 -15
  86. package/dist/types/v4/core/json-schema.d.ts +0 -100
  87. package/dist/types/v4/core/json-schema.js +0 -1
  88. package/dist/types/v4/core/parse.d.ts +0 -25
  89. package/dist/types/v4/core/parse.js +0 -57
  90. package/dist/types/v4/core/regexes.d.ts +0 -62
  91. package/dist/types/v4/core/regexes.js +0 -93
  92. package/dist/types/v4/core/registries.d.ts +0 -32
  93. package/dist/types/v4/core/registries.js +0 -42
  94. package/dist/types/v4/core/schemas.d.ts +0 -975
  95. package/dist/types/v4/core/schemas.js +0 -1740
  96. package/dist/types/v4/core/standard-schema.d.ts +0 -55
  97. package/dist/types/v4/core/standard-schema.js +0 -1
  98. package/dist/types/v4/core/to-json-schema.d.ts +0 -84
  99. package/dist/types/v4/core/to-json-schema.js +0 -665
  100. package/dist/types/v4/core/util.d.ts +0 -186
  101. package/dist/types/v4/core/util.js +0 -469
  102. package/dist/types/v4/core/versions.d.ts +0 -5
  103. package/dist/types/v4/core/versions.js +0 -5
  104. package/dist/types/v4/core/zsf.d.ts +0 -91
  105. package/dist/types/v4/core/zsf.js +0 -171
  106. package/dist/types/v4/index.d.ts +0 -3
  107. package/dist/types/v4/index.js +0 -3
  108. package/dist/types/v4/locales/ar.d.ts +0 -7
  109. package/dist/types/v4/locales/ar.js +0 -115
  110. package/dist/types/v4/locales/az.d.ts +0 -7
  111. package/dist/types/v4/locales/az.js +0 -114
  112. package/dist/types/v4/locales/be.d.ts +0 -7
  113. package/dist/types/v4/locales/be.js +0 -163
  114. package/dist/types/v4/locales/ca.d.ts +0 -7
  115. package/dist/types/v4/locales/ca.js +0 -117
  116. package/dist/types/v4/locales/cs.d.ts +0 -7
  117. package/dist/types/v4/locales/cs.js +0 -134
  118. package/dist/types/v4/locales/de.d.ts +0 -7
  119. package/dist/types/v4/locales/de.js +0 -115
  120. package/dist/types/v4/locales/en.d.ts +0 -7
  121. package/dist/types/v4/locales/en.js +0 -117
  122. package/dist/types/v4/locales/es.d.ts +0 -7
  123. package/dist/types/v4/locales/es.js +0 -116
  124. package/dist/types/v4/locales/fa.d.ts +0 -7
  125. package/dist/types/v4/locales/fa.js +0 -121
  126. package/dist/types/v4/locales/fi.d.ts +0 -7
  127. package/dist/types/v4/locales/fi.js +0 -121
  128. package/dist/types/v4/locales/fr.d.ts +0 -7
  129. package/dist/types/v4/locales/fr.js +0 -115
  130. package/dist/types/v4/locales/frCA.d.ts +0 -7
  131. package/dist/types/v4/locales/frCA.js +0 -116
  132. package/dist/types/v4/locales/he.d.ts +0 -7
  133. package/dist/types/v4/locales/he.js +0 -116
  134. package/dist/types/v4/locales/hu.d.ts +0 -7
  135. package/dist/types/v4/locales/hu.js +0 -116
  136. package/dist/types/v4/locales/id.d.ts +0 -7
  137. package/dist/types/v4/locales/id.js +0 -115
  138. package/dist/types/v4/locales/index.d.ts +0 -34
  139. package/dist/types/v4/locales/index.js +0 -34
  140. package/dist/types/v4/locales/it.d.ts +0 -7
  141. package/dist/types/v4/locales/it.js +0 -116
  142. package/dist/types/v4/locales/ja.d.ts +0 -7
  143. package/dist/types/v4/locales/ja.js +0 -114
  144. package/dist/types/v4/locales/ko.d.ts +0 -7
  145. package/dist/types/v4/locales/ko.js +0 -120
  146. package/dist/types/v4/locales/mk.d.ts +0 -7
  147. package/dist/types/v4/locales/mk.js +0 -117
  148. package/dist/types/v4/locales/ms.d.ts +0 -7
  149. package/dist/types/v4/locales/ms.js +0 -115
  150. package/dist/types/v4/locales/no.d.ts +0 -7
  151. package/dist/types/v4/locales/no.js +0 -115
  152. package/dist/types/v4/locales/ota.d.ts +0 -7
  153. package/dist/types/v4/locales/ota.js +0 -116
  154. package/dist/types/v4/locales/pl.d.ts +0 -7
  155. package/dist/types/v4/locales/pl.js +0 -116
  156. package/dist/types/v4/locales/pt.d.ts +0 -7
  157. package/dist/types/v4/locales/pt.js +0 -115
  158. package/dist/types/v4/locales/ru.d.ts +0 -7
  159. package/dist/types/v4/locales/ru.js +0 -163
  160. package/dist/types/v4/locales/sl.d.ts +0 -7
  161. package/dist/types/v4/locales/sl.js +0 -116
  162. package/dist/types/v4/locales/ta.d.ts +0 -7
  163. package/dist/types/v4/locales/ta.js +0 -116
  164. package/dist/types/v4/locales/th.d.ts +0 -7
  165. package/dist/types/v4/locales/th.js +0 -116
  166. package/dist/types/v4/locales/tr.d.ts +0 -7
  167. package/dist/types/v4/locales/tr.js +0 -114
  168. package/dist/types/v4/locales/ua.d.ts +0 -7
  169. package/dist/types/v4/locales/ua.js +0 -116
  170. package/dist/types/v4/locales/ur.d.ts +0 -7
  171. package/dist/types/v4/locales/ur.js +0 -116
  172. package/dist/types/v4/locales/vi.d.ts +0 -7
  173. package/dist/types/v4/locales/vi.js +0 -115
  174. package/dist/types/v4/locales/zh-CN.d.ts +0 -7
  175. package/dist/types/v4/locales/zh-CN.js +0 -115
  176. package/dist/types/v4/locales/zh-tw.d.ts +0 -7
  177. package/dist/types/v4/locales/zh-tw.js +0 -116
  178. package/dist/types/v4/mini/checks.d.ts +0 -1
  179. package/dist/types/v4/mini/checks.js +0 -1
  180. package/dist/types/v4/mini/coerce.d.ts +0 -7
  181. package/dist/types/v4/mini/coerce.js +0 -17
  182. package/dist/types/v4/mini/external.d.ts +0 -7
  183. package/dist/types/v4/mini/external.js +0 -7
  184. package/dist/types/v4/mini/index.d.ts +0 -3
  185. package/dist/types/v4/mini/index.js +0 -3
  186. package/dist/types/v4/mini/iso.d.ts +0 -22
  187. package/dist/types/v4/mini/iso.js +0 -30
  188. package/dist/types/v4/mini/parse.d.ts +0 -1
  189. package/dist/types/v4/mini/parse.js +0 -1
  190. package/dist/types/v4/mini/schemas.d.ts +0 -405
  191. package/dist/types/v4/mini/schemas.js +0 -738
@@ -1,738 +0,0 @@
1
- import * as core from "zod/v4/core";
2
- import { util } from "zod/v4/core";
3
- import * as parse from "./parse.js";
4
- export * as coerce from "./coerce.js";
5
- export * as iso from "./iso.js";
6
- export const ZodMiniType = /*@__PURE__*/ core.$constructor("ZodMiniType", (inst, def) => {
7
- if (!inst._zod)
8
- throw new Error("Uninitialized schema in mixin ZodMiniType.");
9
- core.$ZodType.init(inst, def);
10
- inst.def = def;
11
- inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
12
- inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
13
- inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
14
- inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
15
- inst.check = (...checks) => {
16
- return inst.clone({
17
- ...def,
18
- checks: [
19
- ...(def.checks ?? []),
20
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
21
- ],
22
- }
23
- // { parent: true }
24
- );
25
- };
26
- inst.clone = (_def, params) => core.clone(inst, _def, params);
27
- inst.brand = () => inst;
28
- inst.register = ((reg, meta) => {
29
- reg.add(inst, meta);
30
- return inst;
31
- });
32
- });
33
- export const ZodMiniString = /*@__PURE__*/ core.$constructor("ZodMiniString", (inst, def) => {
34
- core.$ZodString.init(inst, def);
35
- ZodMiniType.init(inst, def);
36
- });
37
- export function string(params) {
38
- return core._string(ZodMiniString, params);
39
- }
40
- export const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniStringFormat", (inst, def) => {
41
- core.$ZodStringFormat.init(inst, def);
42
- ZodMiniString.init(inst, def);
43
- });
44
- export const ZodMiniEmail = /*@__PURE__*/ core.$constructor("ZodMiniEmail", (inst, def) => {
45
- core.$ZodEmail.init(inst, def);
46
- ZodMiniStringFormat.init(inst, def);
47
- });
48
- export function email(params) {
49
- return core._email(ZodMiniEmail, params);
50
- }
51
- export const ZodMiniGUID = /*@__PURE__*/ core.$constructor("ZodMiniGUID", (inst, def) => {
52
- core.$ZodGUID.init(inst, def);
53
- ZodMiniStringFormat.init(inst, def);
54
- });
55
- export function guid(params) {
56
- return core._guid(ZodMiniGUID, params);
57
- }
58
- export const ZodMiniUUID = /*@__PURE__*/ core.$constructor("ZodMiniUUID", (inst, def) => {
59
- core.$ZodUUID.init(inst, def);
60
- ZodMiniStringFormat.init(inst, def);
61
- });
62
- export function uuid(params) {
63
- return core._uuid(ZodMiniUUID, params);
64
- }
65
- export function uuidv4(params) {
66
- return core._uuidv4(ZodMiniUUID, params);
67
- }
68
- // ZodMiniUUIDv6
69
- export function uuidv6(params) {
70
- return core._uuidv6(ZodMiniUUID, params);
71
- }
72
- // ZodMiniUUIDv7
73
- export function uuidv7(params) {
74
- return core._uuidv7(ZodMiniUUID, params);
75
- }
76
- export const ZodMiniURL = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
77
- core.$ZodURL.init(inst, def);
78
- ZodMiniStringFormat.init(inst, def);
79
- });
80
- export function url(params) {
81
- return core._url(ZodMiniURL, params);
82
- }
83
- export const ZodMiniEmoji = /*@__PURE__*/ core.$constructor("ZodMiniEmoji", (inst, def) => {
84
- core.$ZodEmoji.init(inst, def);
85
- ZodMiniStringFormat.init(inst, def);
86
- });
87
- export function emoji(params) {
88
- return core._emoji(ZodMiniEmoji, params);
89
- }
90
- export const ZodMiniNanoID = /*@__PURE__*/ core.$constructor("ZodMiniNanoID", (inst, def) => {
91
- core.$ZodNanoID.init(inst, def);
92
- ZodMiniStringFormat.init(inst, def);
93
- });
94
- export function nanoid(params) {
95
- return core._nanoid(ZodMiniNanoID, params);
96
- }
97
- export const ZodMiniCUID = /*@__PURE__*/ core.$constructor("ZodMiniCUID", (inst, def) => {
98
- core.$ZodCUID.init(inst, def);
99
- ZodMiniStringFormat.init(inst, def);
100
- });
101
- export function cuid(params) {
102
- return core._cuid(ZodMiniCUID, params);
103
- }
104
- export const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor("ZodMiniCUID2", (inst, def) => {
105
- core.$ZodCUID2.init(inst, def);
106
- ZodMiniStringFormat.init(inst, def);
107
- });
108
- export function cuid2(params) {
109
- return core._cuid2(ZodMiniCUID2, params);
110
- }
111
- export const ZodMiniULID = /*@__PURE__*/ core.$constructor("ZodMiniULID", (inst, def) => {
112
- core.$ZodULID.init(inst, def);
113
- ZodMiniStringFormat.init(inst, def);
114
- });
115
- export function ulid(params) {
116
- return core._ulid(ZodMiniULID, params);
117
- }
118
- export const ZodMiniXID = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
119
- core.$ZodXID.init(inst, def);
120
- ZodMiniStringFormat.init(inst, def);
121
- });
122
- export function xid(params) {
123
- return core._xid(ZodMiniXID, params);
124
- }
125
- export const ZodMiniKSUID = /*@__PURE__*/ core.$constructor("ZodMiniKSUID", (inst, def) => {
126
- core.$ZodKSUID.init(inst, def);
127
- ZodMiniStringFormat.init(inst, def);
128
- });
129
- export function ksuid(params) {
130
- return core._ksuid(ZodMiniKSUID, params);
131
- }
132
- export const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor("ZodMiniIPv4", (inst, def) => {
133
- core.$ZodIPv4.init(inst, def);
134
- ZodMiniStringFormat.init(inst, def);
135
- });
136
- export function ipv4(params) {
137
- return core._ipv4(ZodMiniIPv4, params);
138
- }
139
- export const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor("ZodMiniIPv6", (inst, def) => {
140
- core.$ZodIPv6.init(inst, def);
141
- ZodMiniStringFormat.init(inst, def);
142
- });
143
- export function ipv6(params) {
144
- return core._ipv6(ZodMiniIPv6, params);
145
- }
146
- export const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv4", (inst, def) => {
147
- core.$ZodCIDRv4.init(inst, def);
148
- ZodMiniStringFormat.init(inst, def);
149
- });
150
- export function cidrv4(params) {
151
- return core._cidrv4(ZodMiniCIDRv4, params);
152
- }
153
- export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (inst, def) => {
154
- core.$ZodCIDRv6.init(inst, def);
155
- ZodMiniStringFormat.init(inst, def);
156
- });
157
- export function cidrv6(params) {
158
- return core._cidrv6(ZodMiniCIDRv6, params);
159
- }
160
- export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
161
- core.$ZodBase64.init(inst, def);
162
- ZodMiniStringFormat.init(inst, def);
163
- });
164
- export function base64(params) {
165
- return core._base64(ZodMiniBase64, params);
166
- }
167
- export const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor("ZodMiniBase64URL", (inst, def) => {
168
- core.$ZodBase64URL.init(inst, def);
169
- ZodMiniStringFormat.init(inst, def);
170
- });
171
- export function base64url(params) {
172
- return core._base64url(ZodMiniBase64URL, params);
173
- }
174
- export const ZodMiniE164 = /*@__PURE__*/ core.$constructor("ZodMiniE164", (inst, def) => {
175
- core.$ZodE164.init(inst, def);
176
- ZodMiniStringFormat.init(inst, def);
177
- });
178
- export function e164(params) {
179
- return core._e164(ZodMiniE164, params);
180
- }
181
- export const ZodMiniJWT = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
182
- core.$ZodJWT.init(inst, def);
183
- ZodMiniStringFormat.init(inst, def);
184
- });
185
- export function jwt(params) {
186
- return core._jwt(ZodMiniJWT, params);
187
- }
188
- export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
189
- core.$ZodNumber.init(inst, def);
190
- ZodMiniType.init(inst, def);
191
- });
192
- export function number(params) {
193
- return core._number(ZodMiniNumber, params);
194
- }
195
- export const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor("ZodMiniNumberFormat", (inst, def) => {
196
- core.$ZodNumberFormat.init(inst, def);
197
- ZodMiniNumber.init(inst, def);
198
- });
199
- // int
200
- export function int(params) {
201
- return core._int(ZodMiniNumberFormat, params);
202
- }
203
- // float32
204
- export function float32(params) {
205
- return core._float32(ZodMiniNumberFormat, params);
206
- }
207
- // float64
208
- export function float64(params) {
209
- return core._float64(ZodMiniNumberFormat, params);
210
- }
211
- // int32
212
- export function int32(params) {
213
- return core._int32(ZodMiniNumberFormat, params);
214
- }
215
- // uint32
216
- export function uint32(params) {
217
- return core._uint32(ZodMiniNumberFormat, params);
218
- }
219
- export const ZodMiniBoolean = /*@__PURE__*/ core.$constructor("ZodMiniBoolean", (inst, def) => {
220
- core.$ZodBoolean.init(inst, def);
221
- ZodMiniType.init(inst, def);
222
- });
223
- export function boolean(params) {
224
- return core._boolean(ZodMiniBoolean, params);
225
- }
226
- export const ZodMiniBigInt = /*@__PURE__*/ core.$constructor("ZodMiniBigInt", (inst, def) => {
227
- core.$ZodBigInt.init(inst, def);
228
- ZodMiniType.init(inst, def);
229
- });
230
- export function bigint(params) {
231
- return core._bigint(ZodMiniBigInt, params);
232
- }
233
- export const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
234
- core.$ZodBigIntFormat.init(inst, def);
235
- ZodMiniBigInt.init(inst, def);
236
- });
237
- // int64
238
- export function int64(params) {
239
- return core._int64(ZodMiniBigIntFormat, params);
240
- }
241
- // uint64
242
- export function uint64(params) {
243
- return core._uint64(ZodMiniBigIntFormat, params);
244
- }
245
- export const ZodMiniSymbol = /*@__PURE__*/ core.$constructor("ZodMiniSymbol", (inst, def) => {
246
- core.$ZodSymbol.init(inst, def);
247
- ZodMiniType.init(inst, def);
248
- });
249
- export function symbol(params) {
250
- return core._symbol(ZodMiniSymbol, params);
251
- }
252
- export const ZodMiniUndefined = /*@__PURE__*/ core.$constructor("ZodMiniUndefined", (inst, def) => {
253
- core.$ZodUndefined.init(inst, def);
254
- ZodMiniType.init(inst, def);
255
- });
256
- function _undefined(params) {
257
- return core._undefined(ZodMiniUndefined, params);
258
- }
259
- export { _undefined as undefined };
260
- export const ZodMiniNull = /*@__PURE__*/ core.$constructor("ZodMiniNull", (inst, def) => {
261
- core.$ZodNull.init(inst, def);
262
- ZodMiniType.init(inst, def);
263
- });
264
- function _null(params) {
265
- return core._null(ZodMiniNull, params);
266
- }
267
- export { _null as null };
268
- export const ZodMiniAny = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
269
- core.$ZodAny.init(inst, def);
270
- ZodMiniType.init(inst, def);
271
- });
272
- export function any() {
273
- return core._any(ZodMiniAny);
274
- }
275
- export const ZodMiniUnknown = /*@__PURE__*/ core.$constructor("ZodMiniUnknown", (inst, def) => {
276
- core.$ZodUnknown.init(inst, def);
277
- ZodMiniType.init(inst, def);
278
- });
279
- export function unknown() {
280
- return core._unknown(ZodMiniUnknown);
281
- }
282
- export const ZodMiniNever = /*@__PURE__*/ core.$constructor("ZodMiniNever", (inst, def) => {
283
- core.$ZodNever.init(inst, def);
284
- ZodMiniType.init(inst, def);
285
- });
286
- export function never(params) {
287
- return core._never(ZodMiniNever, params);
288
- }
289
- export const ZodMiniVoid = /*@__PURE__*/ core.$constructor("ZodMiniVoid", (inst, def) => {
290
- core.$ZodVoid.init(inst, def);
291
- ZodMiniType.init(inst, def);
292
- });
293
- function _void(params) {
294
- return core._void(ZodMiniVoid, params);
295
- }
296
- export { _void as void };
297
- export const ZodMiniDate = /*@__PURE__*/ core.$constructor("ZodMiniDate", (inst, def) => {
298
- core.$ZodDate.init(inst, def);
299
- ZodMiniType.init(inst, def);
300
- });
301
- export function date(params) {
302
- return core._date(ZodMiniDate, params);
303
- }
304
- export const ZodMiniArray = /*@__PURE__*/ core.$constructor("ZodMiniArray", (inst, def) => {
305
- core.$ZodArray.init(inst, def);
306
- ZodMiniType.init(inst, def);
307
- });
308
- export function array(element, params) {
309
- return new ZodMiniArray({
310
- type: "array",
311
- element,
312
- // get element() {
313
- // return element;
314
- // },
315
- ...util.normalizeParams(params),
316
- });
317
- }
318
- // .keyof
319
- export function keyof(schema) {
320
- const shape = schema._zod.def.shape;
321
- return literal(Object.keys(shape));
322
- }
323
- export const ZodMiniObject = /*@__PURE__*/ core.$constructor("ZodMiniObject", (inst, def) => {
324
- core.$ZodObject.init(inst, def);
325
- ZodMiniType.init(inst, def);
326
- });
327
- export function object(shape, params) {
328
- const def = {
329
- type: "object",
330
- get shape() {
331
- util.assignProp(this, "shape", { ...shape });
332
- return this.shape;
333
- },
334
- ...util.normalizeParams(params),
335
- };
336
- return new ZodMiniObject(def);
337
- }
338
- // strictObject
339
- export function strictObject(shape, params) {
340
- return new ZodMiniObject({
341
- type: "object",
342
- // shape: shape as core.$ZodLooseShape,
343
- get shape() {
344
- util.assignProp(this, "shape", { ...shape });
345
- return this.shape;
346
- },
347
- // get optional() {
348
- // return util.optionalKeys(shape);
349
- // },
350
- catchall: never(),
351
- ...util.normalizeParams(params),
352
- });
353
- }
354
- // looseObject
355
- export function looseObject(shape, params) {
356
- return new ZodMiniObject({
357
- type: "object",
358
- // shape: shape as core.$ZodLooseShape,
359
- get shape() {
360
- util.assignProp(this, "shape", { ...shape });
361
- return this.shape;
362
- },
363
- // get optional() {
364
- // return util.optionalKeys(shape);
365
- // },
366
- catchall: unknown(),
367
- ...util.normalizeParams(params),
368
- });
369
- }
370
- // object methods
371
- export function extend(schema, shape) {
372
- return util.extend(schema, shape);
373
- }
374
- export function merge(schema, shape) {
375
- return util.extend(schema, shape);
376
- }
377
- export function pick(schema, mask) {
378
- return util.pick(schema, mask);
379
- }
380
- // .omit
381
- export function omit(schema, mask) {
382
- return util.omit(schema, mask);
383
- }
384
- export function partial(schema, mask) {
385
- return util.partial(ZodMiniOptional, schema, mask);
386
- }
387
- export function required(schema, mask) {
388
- return util.required(ZodMiniNonOptional, schema, mask);
389
- }
390
- export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
391
- core.$ZodUnion.init(inst, def);
392
- ZodMiniType.init(inst, def);
393
- });
394
- export function union(options, params) {
395
- return new ZodMiniUnion({
396
- type: "union",
397
- options,
398
- ...util.normalizeParams(params),
399
- });
400
- }
401
- export const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
402
- core.$ZodDiscriminatedUnion.init(inst, def);
403
- ZodMiniType.init(inst, def);
404
- });
405
- export function discriminatedUnion(discriminator, options, params) {
406
- return new ZodMiniDiscriminatedUnion({
407
- type: "union",
408
- options,
409
- discriminator,
410
- ...util.normalizeParams(params),
411
- });
412
- }
413
- export const ZodMiniIntersection = /*@__PURE__*/ core.$constructor("ZodMiniIntersection", (inst, def) => {
414
- core.$ZodIntersection.init(inst, def);
415
- ZodMiniType.init(inst, def);
416
- });
417
- export function intersection(left, right) {
418
- return new ZodMiniIntersection({
419
- type: "intersection",
420
- left,
421
- right,
422
- });
423
- }
424
- export const ZodMiniTuple = /*@__PURE__*/ core.$constructor("ZodMiniTuple", (inst, def) => {
425
- core.$ZodTuple.init(inst, def);
426
- ZodMiniType.init(inst, def);
427
- });
428
- export function tuple(items, _paramsOrRest, _params) {
429
- const hasRest = _paramsOrRest instanceof core.$ZodType;
430
- const params = hasRest ? _params : _paramsOrRest;
431
- const rest = hasRest ? _paramsOrRest : null;
432
- return new ZodMiniTuple({
433
- type: "tuple",
434
- items,
435
- rest,
436
- ...util.normalizeParams(params),
437
- });
438
- }
439
- export const ZodMiniRecord = /*@__PURE__*/ core.$constructor("ZodMiniRecord", (inst, def) => {
440
- core.$ZodRecord.init(inst, def);
441
- ZodMiniType.init(inst, def);
442
- });
443
- export function record(keyType, valueType, params) {
444
- return new ZodMiniRecord({
445
- type: "record",
446
- keyType,
447
- valueType,
448
- ...util.normalizeParams(params),
449
- });
450
- }
451
- export function partialRecord(keyType, valueType, params) {
452
- return new ZodMiniRecord({
453
- type: "record",
454
- keyType: union([keyType, never()]),
455
- valueType,
456
- ...util.normalizeParams(params),
457
- });
458
- }
459
- export const ZodMiniMap = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
460
- core.$ZodMap.init(inst, def);
461
- ZodMiniType.init(inst, def);
462
- });
463
- export function map(keyType, valueType, params) {
464
- return new ZodMiniMap({
465
- type: "map",
466
- keyType,
467
- valueType,
468
- ...util.normalizeParams(params),
469
- });
470
- }
471
- export const ZodMiniSet = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
472
- core.$ZodSet.init(inst, def);
473
- ZodMiniType.init(inst, def);
474
- });
475
- export function set(valueType, params) {
476
- return new ZodMiniSet({
477
- type: "set",
478
- valueType,
479
- ...util.normalizeParams(params),
480
- });
481
- }
482
- export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
483
- core.$ZodEnum.init(inst, def);
484
- ZodMiniType.init(inst, def);
485
- });
486
- function _enum(values, params) {
487
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
488
- return new ZodMiniEnum({
489
- type: "enum",
490
- entries,
491
- ...util.normalizeParams(params),
492
- });
493
- }
494
- export { _enum as enum };
495
- /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
496
- *
497
- * ```ts
498
- * enum Colors { red, green, blue }
499
- * z.enum(Colors);
500
- * ```
501
- */
502
- export function nativeEnum(entries, params) {
503
- return new ZodMiniEnum({
504
- type: "enum",
505
- entries,
506
- ...util.normalizeParams(params),
507
- });
508
- }
509
- export const ZodMiniLiteral = /*@__PURE__*/ core.$constructor("ZodMiniLiteral", (inst, def) => {
510
- core.$ZodLiteral.init(inst, def);
511
- ZodMiniType.init(inst, def);
512
- });
513
- export function literal(value, params) {
514
- return new ZodMiniLiteral({
515
- type: "literal",
516
- values: Array.isArray(value) ? value : [value],
517
- ...util.normalizeParams(params),
518
- });
519
- }
520
- export const ZodMiniFile = /*@__PURE__*/ core.$constructor("ZodMiniFile", (inst, def) => {
521
- core.$ZodFile.init(inst, def);
522
- ZodMiniType.init(inst, def);
523
- });
524
- export function file(params) {
525
- return core._file(ZodMiniFile, params);
526
- }
527
- export const ZodMiniTransform = /*@__PURE__*/ core.$constructor("ZodMiniTransform", (inst, def) => {
528
- core.$ZodTransform.init(inst, def);
529
- ZodMiniType.init(inst, def);
530
- });
531
- export function transform(fn) {
532
- return new ZodMiniTransform({
533
- type: "transform",
534
- transform: fn,
535
- });
536
- }
537
- export const ZodMiniOptional = /*@__PURE__*/ core.$constructor("ZodMiniOptional", (inst, def) => {
538
- core.$ZodOptional.init(inst, def);
539
- ZodMiniType.init(inst, def);
540
- });
541
- export function optional(innerType) {
542
- return new ZodMiniOptional({
543
- type: "optional",
544
- innerType,
545
- });
546
- }
547
- export const ZodMiniNullable = /*@__PURE__*/ core.$constructor("ZodMiniNullable", (inst, def) => {
548
- core.$ZodNullable.init(inst, def);
549
- ZodMiniType.init(inst, def);
550
- });
551
- export function nullable(innerType) {
552
- return new ZodMiniNullable({
553
- type: "nullable",
554
- innerType,
555
- });
556
- }
557
- // nullish
558
- export function nullish(innerType) {
559
- return optional(nullable(innerType));
560
- }
561
- export const ZodMiniDefault = /*@__PURE__*/ core.$constructor("ZodMiniDefault", (inst, def) => {
562
- core.$ZodDefault.init(inst, def);
563
- ZodMiniType.init(inst, def);
564
- });
565
- export function _default(innerType, defaultValue) {
566
- return new ZodMiniDefault({
567
- type: "default",
568
- innerType,
569
- get defaultValue() {
570
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
571
- },
572
- });
573
- }
574
- export const ZodMiniPrefault = /*@__PURE__*/ core.$constructor("ZodMiniPrefault", (inst, def) => {
575
- core.$ZodPrefault.init(inst, def);
576
- ZodMiniType.init(inst, def);
577
- });
578
- export function prefault(innerType, defaultValue) {
579
- return new ZodMiniPrefault({
580
- type: "prefault",
581
- innerType,
582
- get defaultValue() {
583
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
584
- },
585
- });
586
- }
587
- export const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor("ZodMiniNonOptional", (inst, def) => {
588
- core.$ZodNonOptional.init(inst, def);
589
- ZodMiniType.init(inst, def);
590
- });
591
- export function nonoptional(innerType, params) {
592
- return new ZodMiniNonOptional({
593
- type: "nonoptional",
594
- innerType,
595
- ...util.normalizeParams(params),
596
- });
597
- }
598
- export const ZodMiniSuccess = /*@__PURE__*/ core.$constructor("ZodMiniSuccess", (inst, def) => {
599
- core.$ZodSuccess.init(inst, def);
600
- ZodMiniType.init(inst, def);
601
- });
602
- export function success(innerType) {
603
- return new ZodMiniSuccess({
604
- type: "success",
605
- innerType,
606
- });
607
- }
608
- export const ZodMiniCatch = /*@__PURE__*/ core.$constructor("ZodMiniCatch", (inst, def) => {
609
- core.$ZodCatch.init(inst, def);
610
- ZodMiniType.init(inst, def);
611
- });
612
- function _catch(innerType, catchValue) {
613
- return new ZodMiniCatch({
614
- type: "catch",
615
- innerType,
616
- catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
617
- });
618
- }
619
- export { _catch as catch };
620
- export const ZodMiniNaN = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
621
- core.$ZodNaN.init(inst, def);
622
- ZodMiniType.init(inst, def);
623
- });
624
- export function nan(params) {
625
- return core._nan(ZodMiniNaN, params);
626
- }
627
- export const ZodMiniPipe = /*@__PURE__*/ core.$constructor("ZodMiniPipe", (inst, def) => {
628
- core.$ZodPipe.init(inst, def);
629
- ZodMiniType.init(inst, def);
630
- });
631
- export function pipe(in_, out) {
632
- return new ZodMiniPipe({
633
- type: "pipe",
634
- in: in_,
635
- out,
636
- });
637
- }
638
- export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
639
- core.$ZodReadonly.init(inst, def);
640
- ZodMiniType.init(inst, def);
641
- });
642
- export function readonly(innerType) {
643
- return new ZodMiniReadonly({
644
- type: "readonly",
645
- innerType,
646
- });
647
- }
648
- export const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
649
- core.$ZodTemplateLiteral.init(inst, def);
650
- ZodMiniType.init(inst, def);
651
- });
652
- export function templateLiteral(parts, params) {
653
- return new ZodMiniTemplateLiteral({
654
- type: "template_literal",
655
- parts,
656
- ...util.normalizeParams(params),
657
- });
658
- }
659
- export const ZodMiniLazy = /*@__PURE__*/ core.$constructor("ZodMiniLazy", (inst, def) => {
660
- core.$ZodLazy.init(inst, def);
661
- ZodMiniType.init(inst, def);
662
- });
663
- // export function lazy<T extends object>(getter: () => T): T {
664
- // return util.createTransparentProxy<T>(getter);
665
- // }
666
- function _lazy(getter) {
667
- return new ZodMiniLazy({
668
- type: "lazy",
669
- getter,
670
- });
671
- }
672
- export { _lazy as lazy };
673
- export const ZodMiniPromise = /*@__PURE__*/ core.$constructor("ZodMiniPromise", (inst, def) => {
674
- core.$ZodPromise.init(inst, def);
675
- ZodMiniType.init(inst, def);
676
- });
677
- export function promise(innerType) {
678
- return new ZodMiniPromise({
679
- type: "promise",
680
- innerType,
681
- });
682
- }
683
- export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (inst, def) => {
684
- core.$ZodCustom.init(inst, def);
685
- ZodMiniType.init(inst, def);
686
- });
687
- // custom checks
688
- export function check(fn, params) {
689
- const ch = new core.$ZodCheck({
690
- check: "custom",
691
- ...util.normalizeParams(params),
692
- });
693
- ch._zod.check = fn;
694
- return ch;
695
- }
696
- // ZodCustom
697
- function _custom(fn, _params, Class) {
698
- const params = util.normalizeParams(_params);
699
- const schema = new Class({
700
- type: "custom",
701
- check: "custom",
702
- fn: fn,
703
- ...params,
704
- });
705
- return schema;
706
- }
707
- // refine
708
- export function refine(fn, _params = {}) {
709
- return _custom(fn, _params, ZodMiniCustom);
710
- }
711
- // custom schema
712
- export function custom(fn, _params) {
713
- return _custom(fn ?? (() => true), _params, ZodMiniCustom);
714
- }
715
- // instanceof
716
- class Class {
717
- constructor(..._args) { }
718
- }
719
- function _instanceof(cls, params = {
720
- error: `Input not instance of ${cls.name}`,
721
- }) {
722
- const inst = custom((data) => data instanceof cls, params);
723
- inst._zod.bag.Class = cls;
724
- return inst;
725
- }
726
- export { _instanceof as instanceof };
727
- // stringbool
728
- export const stringbool = /* @__PURE__ */ core._stringbool.bind(null, {
729
- Pipe: ZodMiniPipe,
730
- Boolean: ZodMiniBoolean,
731
- Unknown: ZodMiniUnknown,
732
- });
733
- export function json() {
734
- const jsonSchema = _lazy(() => {
735
- return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
736
- });
737
- return jsonSchema;
738
- }