lkd-web-kit 0.4.8 → 0.4.9

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 (132) hide show
  1. package/dist/hooks/useZodConfig.cjs +2 -2
  2. package/dist/hooks/useZodConfig.js +2 -2
  3. package/dist/index.d.ts +2 -2
  4. package/package.json +7 -7
  5. package/dist/node_modules/zod/v4/classic/coerce.cjs +0 -28
  6. package/dist/node_modules/zod/v4/classic/coerce.js +0 -20
  7. package/dist/node_modules/zod/v4/classic/compat.cjs +0 -37
  8. package/dist/node_modules/zod/v4/classic/compat.js +0 -30
  9. package/dist/node_modules/zod/v4/classic/errors.cjs +0 -49
  10. package/dist/node_modules/zod/v4/classic/errors.js +0 -44
  11. package/dist/node_modules/zod/v4/classic/external.cjs +0 -231
  12. package/dist/node_modules/zod/v4/classic/external.js +0 -28
  13. package/dist/node_modules/zod/v4/classic/index.cjs +0 -10
  14. package/dist/node_modules/zod/v4/classic/index.js +0 -5
  15. package/dist/node_modules/zod/v4/classic/iso.cjs +0 -46
  16. package/dist/node_modules/zod/v4/classic/iso.js +0 -35
  17. package/dist/node_modules/zod/v4/classic/parse.cjs +0 -16
  18. package/dist/node_modules/zod/v4/classic/parse.js +0 -9
  19. package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -1155
  20. package/dist/node_modules/zod/v4/classic/schemas.js +0 -1006
  21. package/dist/node_modules/zod/v4/core/api.cjs +0 -1016
  22. package/dist/node_modules/zod/v4/core/api.js +0 -903
  23. package/dist/node_modules/zod/v4/core/checks.cjs +0 -587
  24. package/dist/node_modules/zod/v4/core/checks.js +0 -562
  25. package/dist/node_modules/zod/v4/core/core.cjs +0 -72
  26. package/dist/node_modules/zod/v4/core/core.js +0 -63
  27. package/dist/node_modules/zod/v4/core/doc.cjs +0 -41
  28. package/dist/node_modules/zod/v4/core/doc.js +0 -37
  29. package/dist/node_modules/zod/v4/core/errors.cjs +0 -204
  30. package/dist/node_modules/zod/v4/core/errors.js +0 -194
  31. package/dist/node_modules/zod/v4/core/function.cjs +0 -81
  32. package/dist/node_modules/zod/v4/core/function.js +0 -76
  33. package/dist/node_modules/zod/v4/core/index.cjs +0 -261
  34. package/dist/node_modules/zod/v4/core/index.js +0 -20
  35. package/dist/node_modules/zod/v4/core/json-schema.cjs +0 -2
  36. package/dist/node_modules/zod/v4/core/json-schema.js +0 -1
  37. package/dist/node_modules/zod/v4/core/parse.cjs +0 -71
  38. package/dist/node_modules/zod/v4/core/parse.js +0 -60
  39. package/dist/node_modules/zod/v4/core/regexes.cjs +0 -139
  40. package/dist/node_modules/zod/v4/core/regexes.js +0 -95
  41. package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
  42. package/dist/node_modules/zod/v4/core/registries.js +0 -44
  43. package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1793
  44. package/dist/node_modules/zod/v4/core/schemas.js +0 -1720
  45. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -823
  46. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -818
  47. package/dist/node_modules/zod/v4/core/util.cjs +0 -543
  48. package/dist/node_modules/zod/v4/core/util.js +0 -491
  49. package/dist/node_modules/zod/v4/core/versions.cjs +0 -11
  50. package/dist/node_modules/zod/v4/core/versions.js +0 -7
  51. package/dist/node_modules/zod/v4/index.cjs +0 -10
  52. package/dist/node_modules/zod/v4/index.js +0 -5
  53. package/dist/node_modules/zod/v4/locales/ar.cjs +0 -121
  54. package/dist/node_modules/zod/v4/locales/ar.js +0 -119
  55. package/dist/node_modules/zod/v4/locales/az.cjs +0 -120
  56. package/dist/node_modules/zod/v4/locales/az.js +0 -118
  57. package/dist/node_modules/zod/v4/locales/be.cjs +0 -169
  58. package/dist/node_modules/zod/v4/locales/be.js +0 -167
  59. package/dist/node_modules/zod/v4/locales/ca.cjs +0 -123
  60. package/dist/node_modules/zod/v4/locales/ca.js +0 -121
  61. package/dist/node_modules/zod/v4/locales/cs.cjs +0 -140
  62. package/dist/node_modules/zod/v4/locales/cs.js +0 -138
  63. package/dist/node_modules/zod/v4/locales/de.cjs +0 -121
  64. package/dist/node_modules/zod/v4/locales/de.js +0 -119
  65. package/dist/node_modules/zod/v4/locales/en.cjs +0 -125
  66. package/dist/node_modules/zod/v4/locales/en.js +0 -120
  67. package/dist/node_modules/zod/v4/locales/eo.cjs +0 -124
  68. package/dist/node_modules/zod/v4/locales/eo.js +0 -119
  69. package/dist/node_modules/zod/v4/locales/es.cjs +0 -122
  70. package/dist/node_modules/zod/v4/locales/es.js +0 -120
  71. package/dist/node_modules/zod/v4/locales/fa.cjs +0 -127
  72. package/dist/node_modules/zod/v4/locales/fa.js +0 -125
  73. package/dist/node_modules/zod/v4/locales/fi.cjs +0 -127
  74. package/dist/node_modules/zod/v4/locales/fi.js +0 -125
  75. package/dist/node_modules/zod/v4/locales/fr-CA.cjs +0 -122
  76. package/dist/node_modules/zod/v4/locales/fr-CA.js +0 -120
  77. package/dist/node_modules/zod/v4/locales/fr.cjs +0 -121
  78. package/dist/node_modules/zod/v4/locales/fr.js +0 -119
  79. package/dist/node_modules/zod/v4/locales/he.cjs +0 -122
  80. package/dist/node_modules/zod/v4/locales/he.js +0 -120
  81. package/dist/node_modules/zod/v4/locales/hu.cjs +0 -122
  82. package/dist/node_modules/zod/v4/locales/hu.js +0 -120
  83. package/dist/node_modules/zod/v4/locales/id.cjs +0 -121
  84. package/dist/node_modules/zod/v4/locales/id.js +0 -119
  85. package/dist/node_modules/zod/v4/locales/index.cjs +0 -85
  86. package/dist/node_modules/zod/v4/locales/index.js +0 -39
  87. package/dist/node_modules/zod/v4/locales/it.cjs +0 -122
  88. package/dist/node_modules/zod/v4/locales/it.js +0 -120
  89. package/dist/node_modules/zod/v4/locales/ja.cjs +0 -120
  90. package/dist/node_modules/zod/v4/locales/ja.js +0 -118
  91. package/dist/node_modules/zod/v4/locales/kh.cjs +0 -122
  92. package/dist/node_modules/zod/v4/locales/kh.js +0 -120
  93. package/dist/node_modules/zod/v4/locales/ko.cjs +0 -126
  94. package/dist/node_modules/zod/v4/locales/ko.js +0 -124
  95. package/dist/node_modules/zod/v4/locales/mk.cjs +0 -123
  96. package/dist/node_modules/zod/v4/locales/mk.js +0 -121
  97. package/dist/node_modules/zod/v4/locales/ms.cjs +0 -121
  98. package/dist/node_modules/zod/v4/locales/ms.js +0 -119
  99. package/dist/node_modules/zod/v4/locales/nl.cjs +0 -122
  100. package/dist/node_modules/zod/v4/locales/nl.js +0 -120
  101. package/dist/node_modules/zod/v4/locales/no.cjs +0 -121
  102. package/dist/node_modules/zod/v4/locales/no.js +0 -119
  103. package/dist/node_modules/zod/v4/locales/ota.cjs +0 -122
  104. package/dist/node_modules/zod/v4/locales/ota.js +0 -120
  105. package/dist/node_modules/zod/v4/locales/pl.cjs +0 -122
  106. package/dist/node_modules/zod/v4/locales/pl.js +0 -120
  107. package/dist/node_modules/zod/v4/locales/ps.cjs +0 -127
  108. package/dist/node_modules/zod/v4/locales/ps.js +0 -125
  109. package/dist/node_modules/zod/v4/locales/pt.cjs +0 -121
  110. package/dist/node_modules/zod/v4/locales/pt.js +0 -119
  111. package/dist/node_modules/zod/v4/locales/ru.cjs +0 -169
  112. package/dist/node_modules/zod/v4/locales/ru.js +0 -167
  113. package/dist/node_modules/zod/v4/locales/sl.cjs +0 -122
  114. package/dist/node_modules/zod/v4/locales/sl.js +0 -120
  115. package/dist/node_modules/zod/v4/locales/sv.cjs +0 -123
  116. package/dist/node_modules/zod/v4/locales/sv.js +0 -121
  117. package/dist/node_modules/zod/v4/locales/ta.cjs +0 -122
  118. package/dist/node_modules/zod/v4/locales/ta.js +0 -120
  119. package/dist/node_modules/zod/v4/locales/th.cjs +0 -122
  120. package/dist/node_modules/zod/v4/locales/th.js +0 -120
  121. package/dist/node_modules/zod/v4/locales/tr.cjs +0 -123
  122. package/dist/node_modules/zod/v4/locales/tr.js +0 -118
  123. package/dist/node_modules/zod/v4/locales/ua.cjs +0 -122
  124. package/dist/node_modules/zod/v4/locales/ua.js +0 -120
  125. package/dist/node_modules/zod/v4/locales/ur.cjs +0 -122
  126. package/dist/node_modules/zod/v4/locales/ur.js +0 -120
  127. package/dist/node_modules/zod/v4/locales/vi.cjs +0 -121
  128. package/dist/node_modules/zod/v4/locales/vi.js +0 -119
  129. package/dist/node_modules/zod/v4/locales/zh-CN.cjs +0 -121
  130. package/dist/node_modules/zod/v4/locales/zh-CN.js +0 -119
  131. package/dist/node_modules/zod/v4/locales/zh-TW.cjs +0 -122
  132. package/dist/node_modules/zod/v4/locales/zh-TW.js +0 -120
@@ -1,903 +0,0 @@
1
- import { $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite } from './checks.js';
2
- import { $ZodPipe, $ZodBoolean, $ZodString, $ZodTransform, $ZodType } from './schemas.js';
3
- import { normalizeParams } from './util.js';
4
-
5
- function _string(Class, params) {
6
- return new Class({
7
- type: "string",
8
- ...normalizeParams(params),
9
- });
10
- }
11
- function _coercedString(Class, params) {
12
- return new Class({
13
- type: "string",
14
- coerce: true,
15
- ...normalizeParams(params),
16
- });
17
- }
18
- function _email(Class, params) {
19
- return new Class({
20
- type: "string",
21
- format: "email",
22
- check: "string_format",
23
- abort: false,
24
- ...normalizeParams(params),
25
- });
26
- }
27
- function _guid(Class, params) {
28
- return new Class({
29
- type: "string",
30
- format: "guid",
31
- check: "string_format",
32
- abort: false,
33
- ...normalizeParams(params),
34
- });
35
- }
36
- function _uuid(Class, params) {
37
- return new Class({
38
- type: "string",
39
- format: "uuid",
40
- check: "string_format",
41
- abort: false,
42
- ...normalizeParams(params),
43
- });
44
- }
45
- function _uuidv4(Class, params) {
46
- return new Class({
47
- type: "string",
48
- format: "uuid",
49
- check: "string_format",
50
- abort: false,
51
- version: "v4",
52
- ...normalizeParams(params),
53
- });
54
- }
55
- function _uuidv6(Class, params) {
56
- return new Class({
57
- type: "string",
58
- format: "uuid",
59
- check: "string_format",
60
- abort: false,
61
- version: "v6",
62
- ...normalizeParams(params),
63
- });
64
- }
65
- function _uuidv7(Class, params) {
66
- return new Class({
67
- type: "string",
68
- format: "uuid",
69
- check: "string_format",
70
- abort: false,
71
- version: "v7",
72
- ...normalizeParams(params),
73
- });
74
- }
75
- function _url(Class, params) {
76
- return new Class({
77
- type: "string",
78
- format: "url",
79
- check: "string_format",
80
- abort: false,
81
- ...normalizeParams(params),
82
- });
83
- }
84
- function _emoji(Class, params) {
85
- return new Class({
86
- type: "string",
87
- format: "emoji",
88
- check: "string_format",
89
- abort: false,
90
- ...normalizeParams(params),
91
- });
92
- }
93
- function _nanoid(Class, params) {
94
- return new Class({
95
- type: "string",
96
- format: "nanoid",
97
- check: "string_format",
98
- abort: false,
99
- ...normalizeParams(params),
100
- });
101
- }
102
- function _cuid(Class, params) {
103
- return new Class({
104
- type: "string",
105
- format: "cuid",
106
- check: "string_format",
107
- abort: false,
108
- ...normalizeParams(params),
109
- });
110
- }
111
- function _cuid2(Class, params) {
112
- return new Class({
113
- type: "string",
114
- format: "cuid2",
115
- check: "string_format",
116
- abort: false,
117
- ...normalizeParams(params),
118
- });
119
- }
120
- function _ulid(Class, params) {
121
- return new Class({
122
- type: "string",
123
- format: "ulid",
124
- check: "string_format",
125
- abort: false,
126
- ...normalizeParams(params),
127
- });
128
- }
129
- function _xid(Class, params) {
130
- return new Class({
131
- type: "string",
132
- format: "xid",
133
- check: "string_format",
134
- abort: false,
135
- ...normalizeParams(params),
136
- });
137
- }
138
- function _ksuid(Class, params) {
139
- return new Class({
140
- type: "string",
141
- format: "ksuid",
142
- check: "string_format",
143
- abort: false,
144
- ...normalizeParams(params),
145
- });
146
- }
147
- function _ipv4(Class, params) {
148
- return new Class({
149
- type: "string",
150
- format: "ipv4",
151
- check: "string_format",
152
- abort: false,
153
- ...normalizeParams(params),
154
- });
155
- }
156
- function _ipv6(Class, params) {
157
- return new Class({
158
- type: "string",
159
- format: "ipv6",
160
- check: "string_format",
161
- abort: false,
162
- ...normalizeParams(params),
163
- });
164
- }
165
- function _cidrv4(Class, params) {
166
- return new Class({
167
- type: "string",
168
- format: "cidrv4",
169
- check: "string_format",
170
- abort: false,
171
- ...normalizeParams(params),
172
- });
173
- }
174
- function _cidrv6(Class, params) {
175
- return new Class({
176
- type: "string",
177
- format: "cidrv6",
178
- check: "string_format",
179
- abort: false,
180
- ...normalizeParams(params),
181
- });
182
- }
183
- function _base64(Class, params) {
184
- return new Class({
185
- type: "string",
186
- format: "base64",
187
- check: "string_format",
188
- abort: false,
189
- ...normalizeParams(params),
190
- });
191
- }
192
- function _base64url(Class, params) {
193
- return new Class({
194
- type: "string",
195
- format: "base64url",
196
- check: "string_format",
197
- abort: false,
198
- ...normalizeParams(params),
199
- });
200
- }
201
- function _e164(Class, params) {
202
- return new Class({
203
- type: "string",
204
- format: "e164",
205
- check: "string_format",
206
- abort: false,
207
- ...normalizeParams(params),
208
- });
209
- }
210
- function _jwt(Class, params) {
211
- return new Class({
212
- type: "string",
213
- format: "jwt",
214
- check: "string_format",
215
- abort: false,
216
- ...normalizeParams(params),
217
- });
218
- }
219
- const TimePrecision = {
220
- Any: null,
221
- Minute: -1,
222
- Second: 0,
223
- Millisecond: 3,
224
- Microsecond: 6,
225
- };
226
- function _isoDateTime(Class, params) {
227
- return new Class({
228
- type: "string",
229
- format: "datetime",
230
- check: "string_format",
231
- offset: false,
232
- local: false,
233
- precision: null,
234
- ...normalizeParams(params),
235
- });
236
- }
237
- function _isoDate(Class, params) {
238
- return new Class({
239
- type: "string",
240
- format: "date",
241
- check: "string_format",
242
- ...normalizeParams(params),
243
- });
244
- }
245
- function _isoTime(Class, params) {
246
- return new Class({
247
- type: "string",
248
- format: "time",
249
- check: "string_format",
250
- precision: null,
251
- ...normalizeParams(params),
252
- });
253
- }
254
- function _isoDuration(Class, params) {
255
- return new Class({
256
- type: "string",
257
- format: "duration",
258
- check: "string_format",
259
- ...normalizeParams(params),
260
- });
261
- }
262
- function _number(Class, params) {
263
- return new Class({
264
- type: "number",
265
- checks: [],
266
- ...normalizeParams(params),
267
- });
268
- }
269
- function _coercedNumber(Class, params) {
270
- return new Class({
271
- type: "number",
272
- coerce: true,
273
- checks: [],
274
- ...normalizeParams(params),
275
- });
276
- }
277
- function _int(Class, params) {
278
- return new Class({
279
- type: "number",
280
- check: "number_format",
281
- abort: false,
282
- format: "safeint",
283
- ...normalizeParams(params),
284
- });
285
- }
286
- function _float32(Class, params) {
287
- return new Class({
288
- type: "number",
289
- check: "number_format",
290
- abort: false,
291
- format: "float32",
292
- ...normalizeParams(params),
293
- });
294
- }
295
- function _float64(Class, params) {
296
- return new Class({
297
- type: "number",
298
- check: "number_format",
299
- abort: false,
300
- format: "float64",
301
- ...normalizeParams(params),
302
- });
303
- }
304
- function _int32(Class, params) {
305
- return new Class({
306
- type: "number",
307
- check: "number_format",
308
- abort: false,
309
- format: "int32",
310
- ...normalizeParams(params),
311
- });
312
- }
313
- function _uint32(Class, params) {
314
- return new Class({
315
- type: "number",
316
- check: "number_format",
317
- abort: false,
318
- format: "uint32",
319
- ...normalizeParams(params),
320
- });
321
- }
322
- function _boolean(Class, params) {
323
- return new Class({
324
- type: "boolean",
325
- ...normalizeParams(params),
326
- });
327
- }
328
- function _coercedBoolean(Class, params) {
329
- return new Class({
330
- type: "boolean",
331
- coerce: true,
332
- ...normalizeParams(params),
333
- });
334
- }
335
- function _bigint(Class, params) {
336
- return new Class({
337
- type: "bigint",
338
- ...normalizeParams(params),
339
- });
340
- }
341
- function _coercedBigint(Class, params) {
342
- return new Class({
343
- type: "bigint",
344
- coerce: true,
345
- ...normalizeParams(params),
346
- });
347
- }
348
- function _int64(Class, params) {
349
- return new Class({
350
- type: "bigint",
351
- check: "bigint_format",
352
- abort: false,
353
- format: "int64",
354
- ...normalizeParams(params),
355
- });
356
- }
357
- function _uint64(Class, params) {
358
- return new Class({
359
- type: "bigint",
360
- check: "bigint_format",
361
- abort: false,
362
- format: "uint64",
363
- ...normalizeParams(params),
364
- });
365
- }
366
- function _symbol(Class, params) {
367
- return new Class({
368
- type: "symbol",
369
- ...normalizeParams(params),
370
- });
371
- }
372
- function _undefined(Class, params) {
373
- return new Class({
374
- type: "undefined",
375
- ...normalizeParams(params),
376
- });
377
- }
378
- function _null(Class, params) {
379
- return new Class({
380
- type: "null",
381
- ...normalizeParams(params),
382
- });
383
- }
384
- function _any(Class) {
385
- return new Class({
386
- type: "any",
387
- });
388
- }
389
- function _unknown(Class) {
390
- return new Class({
391
- type: "unknown",
392
- });
393
- }
394
- function _never(Class, params) {
395
- return new Class({
396
- type: "never",
397
- ...normalizeParams(params),
398
- });
399
- }
400
- function _void(Class, params) {
401
- return new Class({
402
- type: "void",
403
- ...normalizeParams(params),
404
- });
405
- }
406
- function _date(Class, params) {
407
- return new Class({
408
- type: "date",
409
- ...normalizeParams(params),
410
- });
411
- }
412
- function _coercedDate(Class, params) {
413
- return new Class({
414
- type: "date",
415
- coerce: true,
416
- ...normalizeParams(params),
417
- });
418
- }
419
- function _nan(Class, params) {
420
- return new Class({
421
- type: "nan",
422
- ...normalizeParams(params),
423
- });
424
- }
425
- function _lt(value, params) {
426
- return new $ZodCheckLessThan({
427
- check: "less_than",
428
- ...normalizeParams(params),
429
- value,
430
- inclusive: false,
431
- });
432
- }
433
- function _lte(value, params) {
434
- return new $ZodCheckLessThan({
435
- check: "less_than",
436
- ...normalizeParams(params),
437
- value,
438
- inclusive: true,
439
- });
440
- }
441
- function _gt(value, params) {
442
- return new $ZodCheckGreaterThan({
443
- check: "greater_than",
444
- ...normalizeParams(params),
445
- value,
446
- inclusive: false,
447
- });
448
- }
449
- function _gte(value, params) {
450
- return new $ZodCheckGreaterThan({
451
- check: "greater_than",
452
- ...normalizeParams(params),
453
- value,
454
- inclusive: true,
455
- });
456
- }
457
- function _positive(params) {
458
- return _gt(0, params);
459
- }
460
- // negative
461
- function _negative(params) {
462
- return _lt(0, params);
463
- }
464
- // nonpositive
465
- function _nonpositive(params) {
466
- return _lte(0, params);
467
- }
468
- // nonnegative
469
- function _nonnegative(params) {
470
- return _gte(0, params);
471
- }
472
- function _multipleOf(value, params) {
473
- return new $ZodCheckMultipleOf({
474
- check: "multiple_of",
475
- ...normalizeParams(params),
476
- value,
477
- });
478
- }
479
- function _maxSize(maximum, params) {
480
- return new $ZodCheckMaxSize({
481
- check: "max_size",
482
- ...normalizeParams(params),
483
- maximum,
484
- });
485
- }
486
- function _minSize(minimum, params) {
487
- return new $ZodCheckMinSize({
488
- check: "min_size",
489
- ...normalizeParams(params),
490
- minimum,
491
- });
492
- }
493
- function _size(size, params) {
494
- return new $ZodCheckSizeEquals({
495
- check: "size_equals",
496
- ...normalizeParams(params),
497
- size,
498
- });
499
- }
500
- function _maxLength(maximum, params) {
501
- const ch = new $ZodCheckMaxLength({
502
- check: "max_length",
503
- ...normalizeParams(params),
504
- maximum,
505
- });
506
- return ch;
507
- }
508
- function _minLength(minimum, params) {
509
- return new $ZodCheckMinLength({
510
- check: "min_length",
511
- ...normalizeParams(params),
512
- minimum,
513
- });
514
- }
515
- function _length(length, params) {
516
- return new $ZodCheckLengthEquals({
517
- check: "length_equals",
518
- ...normalizeParams(params),
519
- length,
520
- });
521
- }
522
- function _regex(pattern, params) {
523
- return new $ZodCheckRegex({
524
- check: "string_format",
525
- format: "regex",
526
- ...normalizeParams(params),
527
- pattern,
528
- });
529
- }
530
- function _lowercase(params) {
531
- return new $ZodCheckLowerCase({
532
- check: "string_format",
533
- format: "lowercase",
534
- ...normalizeParams(params),
535
- });
536
- }
537
- function _uppercase(params) {
538
- return new $ZodCheckUpperCase({
539
- check: "string_format",
540
- format: "uppercase",
541
- ...normalizeParams(params),
542
- });
543
- }
544
- function _includes(includes, params) {
545
- return new $ZodCheckIncludes({
546
- check: "string_format",
547
- format: "includes",
548
- ...normalizeParams(params),
549
- includes,
550
- });
551
- }
552
- function _startsWith(prefix, params) {
553
- return new $ZodCheckStartsWith({
554
- check: "string_format",
555
- format: "starts_with",
556
- ...normalizeParams(params),
557
- prefix,
558
- });
559
- }
560
- function _endsWith(suffix, params) {
561
- return new $ZodCheckEndsWith({
562
- check: "string_format",
563
- format: "ends_with",
564
- ...normalizeParams(params),
565
- suffix,
566
- });
567
- }
568
- function _property(property, schema, params) {
569
- return new $ZodCheckProperty({
570
- check: "property",
571
- property,
572
- schema,
573
- ...normalizeParams(params),
574
- });
575
- }
576
- function _mime(types, params) {
577
- return new $ZodCheckMimeType({
578
- check: "mime_type",
579
- mime: types,
580
- ...normalizeParams(params),
581
- });
582
- }
583
- function _overwrite(tx) {
584
- return new $ZodCheckOverwrite({
585
- check: "overwrite",
586
- tx,
587
- });
588
- }
589
- // normalize
590
- function _normalize(form) {
591
- return _overwrite((input) => input.normalize(form));
592
- }
593
- // trim
594
- function _trim() {
595
- return _overwrite((input) => input.trim());
596
- }
597
- // toLowerCase
598
- function _toLowerCase() {
599
- return _overwrite((input) => input.toLowerCase());
600
- }
601
- // toUpperCase
602
- function _toUpperCase() {
603
- return _overwrite((input) => input.toUpperCase());
604
- }
605
- function _array(Class, element, params) {
606
- return new Class({
607
- type: "array",
608
- element,
609
- // get element() {
610
- // return element;
611
- // },
612
- ...normalizeParams(params),
613
- });
614
- }
615
- function _union(Class, options, params) {
616
- return new Class({
617
- type: "union",
618
- options,
619
- ...normalizeParams(params),
620
- });
621
- }
622
- function _discriminatedUnion(Class, discriminator, options, params) {
623
- return new Class({
624
- type: "union",
625
- options,
626
- discriminator,
627
- ...normalizeParams(params),
628
- });
629
- }
630
- function _intersection(Class, left, right) {
631
- return new Class({
632
- type: "intersection",
633
- left,
634
- right,
635
- });
636
- }
637
- // export function _tuple(
638
- // Class: util.SchemaClass<schemas.$ZodTuple>,
639
- // items: [],
640
- // params?: string | $ZodTupleParams
641
- // ): schemas.$ZodTuple<[], null>;
642
- function _tuple(Class, items, _paramsOrRest, _params) {
643
- const hasRest = _paramsOrRest instanceof $ZodType;
644
- const params = hasRest ? _params : _paramsOrRest;
645
- const rest = hasRest ? _paramsOrRest : null;
646
- return new Class({
647
- type: "tuple",
648
- items,
649
- rest,
650
- ...normalizeParams(params),
651
- });
652
- }
653
- function _record(Class, keyType, valueType, params) {
654
- return new Class({
655
- type: "record",
656
- keyType,
657
- valueType,
658
- ...normalizeParams(params),
659
- });
660
- }
661
- function _map(Class, keyType, valueType, params) {
662
- return new Class({
663
- type: "map",
664
- keyType,
665
- valueType,
666
- ...normalizeParams(params),
667
- });
668
- }
669
- function _set(Class, valueType, params) {
670
- return new Class({
671
- type: "set",
672
- valueType,
673
- ...normalizeParams(params),
674
- });
675
- }
676
- function _enum(Class, values, params) {
677
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
678
- // if (Array.isArray(values)) {
679
- // for (const value of values) {
680
- // entries[value] = value;
681
- // }
682
- // } else {
683
- // Object.assign(entries, values);
684
- // }
685
- // const entries: util.EnumLike = {};
686
- // for (const val of values) {
687
- // entries[val] = val;
688
- // }
689
- return new Class({
690
- type: "enum",
691
- entries,
692
- ...normalizeParams(params),
693
- });
694
- }
695
- /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
696
- *
697
- * ```ts
698
- * enum Colors { red, green, blue }
699
- * z.enum(Colors);
700
- * ```
701
- */
702
- function _nativeEnum(Class, entries, params) {
703
- return new Class({
704
- type: "enum",
705
- entries,
706
- ...normalizeParams(params),
707
- });
708
- }
709
- function _literal(Class, value, params) {
710
- return new Class({
711
- type: "literal",
712
- values: Array.isArray(value) ? value : [value],
713
- ...normalizeParams(params),
714
- });
715
- }
716
- function _file(Class, params) {
717
- return new Class({
718
- type: "file",
719
- ...normalizeParams(params),
720
- });
721
- }
722
- function _transform(Class, fn) {
723
- return new Class({
724
- type: "transform",
725
- transform: fn,
726
- });
727
- }
728
- function _optional(Class, innerType) {
729
- return new Class({
730
- type: "optional",
731
- innerType,
732
- });
733
- }
734
- function _nullable(Class, innerType) {
735
- return new Class({
736
- type: "nullable",
737
- innerType,
738
- });
739
- }
740
- function _default(Class, innerType, defaultValue) {
741
- return new Class({
742
- type: "default",
743
- innerType,
744
- get defaultValue() {
745
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
746
- },
747
- });
748
- }
749
- function _nonoptional(Class, innerType, params) {
750
- return new Class({
751
- type: "nonoptional",
752
- innerType,
753
- ...normalizeParams(params),
754
- });
755
- }
756
- function _success(Class, innerType) {
757
- return new Class({
758
- type: "success",
759
- innerType,
760
- });
761
- }
762
- function _catch(Class, innerType, catchValue) {
763
- return new Class({
764
- type: "catch",
765
- innerType,
766
- catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
767
- });
768
- }
769
- function _pipe(Class, in_, out) {
770
- return new Class({
771
- type: "pipe",
772
- in: in_,
773
- out,
774
- });
775
- }
776
- function _readonly(Class, innerType) {
777
- return new Class({
778
- type: "readonly",
779
- innerType,
780
- });
781
- }
782
- function _templateLiteral(Class, parts, params) {
783
- return new Class({
784
- type: "template_literal",
785
- parts,
786
- ...normalizeParams(params),
787
- });
788
- }
789
- function _lazy(Class, getter) {
790
- return new Class({
791
- type: "lazy",
792
- getter,
793
- });
794
- }
795
- function _promise(Class, innerType) {
796
- return new Class({
797
- type: "promise",
798
- innerType,
799
- });
800
- }
801
- function _custom(Class, fn, _params) {
802
- const norm = normalizeParams(_params);
803
- norm.abort ?? (norm.abort = true); // default to abort:false
804
- const schema = new Class({
805
- type: "custom",
806
- check: "custom",
807
- fn: fn,
808
- ...norm,
809
- });
810
- return schema;
811
- }
812
- // export function _refine<T>(
813
- // Class: util.SchemaClass<schemas.$ZodCustom>,
814
- // fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
815
- // _params: string | $ZodCustomParams = {}
816
- // ): checks.$ZodCheck<T> {
817
- // return _custom(Class, fn, _params);
818
- // }
819
- // same as _custom but defaults to abort:false
820
- function _refine(Class, fn, _params) {
821
- const schema = new Class({
822
- type: "custom",
823
- check: "custom",
824
- fn: fn,
825
- ...normalizeParams(_params),
826
- });
827
- return schema;
828
- }
829
- function _stringbool(Classes, _params) {
830
- const params = normalizeParams(_params);
831
- let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
832
- let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
833
- if (params.case !== "sensitive") {
834
- truthyArray = truthyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
835
- falsyArray = falsyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
836
- }
837
- const truthySet = new Set(truthyArray);
838
- const falsySet = new Set(falsyArray);
839
- const _Pipe = Classes.Pipe ?? $ZodPipe;
840
- const _Boolean = Classes.Boolean ?? $ZodBoolean;
841
- const _String = Classes.String ?? $ZodString;
842
- const _Transform = Classes.Transform ?? $ZodTransform;
843
- const tx = new _Transform({
844
- type: "transform",
845
- transform: (input, payload) => {
846
- let data = input;
847
- if (params.case !== "sensitive")
848
- data = data.toLowerCase();
849
- if (truthySet.has(data)) {
850
- return true;
851
- }
852
- else if (falsySet.has(data)) {
853
- return false;
854
- }
855
- else {
856
- payload.issues.push({
857
- code: "invalid_value",
858
- expected: "stringbool",
859
- values: [...truthySet, ...falsySet],
860
- input: payload.value,
861
- inst: tx,
862
- });
863
- return {};
864
- }
865
- },
866
- error: params.error,
867
- });
868
- // params.error;
869
- const innerPipe = new _Pipe({
870
- type: "pipe",
871
- in: new _String({ type: "string", error: params.error }),
872
- out: tx,
873
- error: params.error,
874
- });
875
- const outerPipe = new _Pipe({
876
- type: "pipe",
877
- in: innerPipe,
878
- out: new _Boolean({
879
- type: "boolean",
880
- error: params.error,
881
- }),
882
- error: params.error,
883
- });
884
- return outerPipe;
885
- }
886
- function _stringFormat(Class, format, fnOrRegex, _params = {}) {
887
- const params = normalizeParams(_params);
888
- const def = {
889
- ...normalizeParams(_params),
890
- check: "string_format",
891
- type: "string",
892
- format,
893
- fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
894
- ...params,
895
- };
896
- if (fnOrRegex instanceof RegExp) {
897
- def.pattern = fnOrRegex;
898
- }
899
- const inst = new Class(def);
900
- return inst;
901
- }
902
-
903
- export { TimePrecision, _any, _array, _base64, _base64url, _bigint, _boolean, _catch, _cidrv4, _cidrv6, _coercedBigint, _coercedBoolean, _coercedDate, _coercedNumber, _coercedString, _cuid, _cuid2, _custom, _date, _default, _discriminatedUnion, _e164, _email, _emoji, _endsWith, _enum, _file, _float32, _float64, _gt, _gte, _guid, _includes, _int, _int32, _int64, _intersection, _ipv4, _ipv6, _isoDate, _isoDateTime, _isoDuration, _isoTime, _jwt, _ksuid, _lazy, _length, _literal, _lowercase, _lt, _lte, _map, _lte as _max, _maxLength, _maxSize, _mime, _gte as _min, _minLength, _minSize, _multipleOf, _nan, _nanoid, _nativeEnum, _negative, _never, _nonnegative, _nonoptional, _nonpositive, _normalize, _null, _nullable, _number, _optional, _overwrite, _pipe, _positive, _promise, _property, _readonly, _record, _refine, _regex, _set, _size, _startsWith, _string, _stringFormat, _stringbool, _success, _symbol, _templateLiteral, _toLowerCase, _toUpperCase, _transform, _trim, _tuple, _uint32, _uint64, _ulid, _undefined, _union, _unknown, _uppercase, _url, _uuid, _uuidv4, _uuidv6, _uuidv7, _void, _xid };