lkd-web-kit 0.4.8 → 0.4.10
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.
- package/dist/components/MyDateInput/index.cjs +19 -0
- package/dist/components/MyDateInput/index.js +15 -0
- package/dist/form/base/FormDateInput.cjs +17 -0
- package/dist/form/base/FormDateInput.js +13 -0
- package/dist/hooks/useZodConfig.cjs +2 -2
- package/dist/hooks/useZodConfig.js +2 -2
- package/dist/index.cjs +11 -7
- package/dist/index.d.ts +14 -4
- package/dist/index.js +2 -0
- package/package.json +8 -8
- package/dist/node_modules/zod/v4/classic/coerce.cjs +0 -28
- package/dist/node_modules/zod/v4/classic/coerce.js +0 -20
- package/dist/node_modules/zod/v4/classic/compat.cjs +0 -37
- package/dist/node_modules/zod/v4/classic/compat.js +0 -30
- package/dist/node_modules/zod/v4/classic/errors.cjs +0 -49
- package/dist/node_modules/zod/v4/classic/errors.js +0 -44
- package/dist/node_modules/zod/v4/classic/external.cjs +0 -231
- package/dist/node_modules/zod/v4/classic/external.js +0 -28
- package/dist/node_modules/zod/v4/classic/index.cjs +0 -10
- package/dist/node_modules/zod/v4/classic/index.js +0 -5
- package/dist/node_modules/zod/v4/classic/iso.cjs +0 -46
- package/dist/node_modules/zod/v4/classic/iso.js +0 -35
- package/dist/node_modules/zod/v4/classic/parse.cjs +0 -16
- package/dist/node_modules/zod/v4/classic/parse.js +0 -9
- package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -1155
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -1006
- package/dist/node_modules/zod/v4/core/api.cjs +0 -1016
- package/dist/node_modules/zod/v4/core/api.js +0 -903
- package/dist/node_modules/zod/v4/core/checks.cjs +0 -587
- package/dist/node_modules/zod/v4/core/checks.js +0 -562
- package/dist/node_modules/zod/v4/core/core.cjs +0 -72
- package/dist/node_modules/zod/v4/core/core.js +0 -63
- package/dist/node_modules/zod/v4/core/doc.cjs +0 -41
- package/dist/node_modules/zod/v4/core/doc.js +0 -37
- package/dist/node_modules/zod/v4/core/errors.cjs +0 -204
- package/dist/node_modules/zod/v4/core/errors.js +0 -194
- package/dist/node_modules/zod/v4/core/function.cjs +0 -81
- package/dist/node_modules/zod/v4/core/function.js +0 -76
- package/dist/node_modules/zod/v4/core/index.cjs +0 -261
- package/dist/node_modules/zod/v4/core/index.js +0 -20
- package/dist/node_modules/zod/v4/core/json-schema.cjs +0 -2
- package/dist/node_modules/zod/v4/core/json-schema.js +0 -1
- package/dist/node_modules/zod/v4/core/parse.cjs +0 -71
- package/dist/node_modules/zod/v4/core/parse.js +0 -60
- package/dist/node_modules/zod/v4/core/regexes.cjs +0 -139
- package/dist/node_modules/zod/v4/core/regexes.js +0 -95
- package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
- package/dist/node_modules/zod/v4/core/registries.js +0 -44
- package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1793
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1720
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -823
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -818
- package/dist/node_modules/zod/v4/core/util.cjs +0 -543
- package/dist/node_modules/zod/v4/core/util.js +0 -491
- package/dist/node_modules/zod/v4/core/versions.cjs +0 -11
- package/dist/node_modules/zod/v4/core/versions.js +0 -7
- package/dist/node_modules/zod/v4/index.cjs +0 -10
- package/dist/node_modules/zod/v4/index.js +0 -5
- package/dist/node_modules/zod/v4/locales/ar.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/ar.js +0 -119
- package/dist/node_modules/zod/v4/locales/az.cjs +0 -120
- package/dist/node_modules/zod/v4/locales/az.js +0 -118
- package/dist/node_modules/zod/v4/locales/be.cjs +0 -169
- package/dist/node_modules/zod/v4/locales/be.js +0 -167
- package/dist/node_modules/zod/v4/locales/ca.cjs +0 -123
- package/dist/node_modules/zod/v4/locales/ca.js +0 -121
- package/dist/node_modules/zod/v4/locales/cs.cjs +0 -140
- package/dist/node_modules/zod/v4/locales/cs.js +0 -138
- package/dist/node_modules/zod/v4/locales/de.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/de.js +0 -119
- package/dist/node_modules/zod/v4/locales/en.cjs +0 -125
- package/dist/node_modules/zod/v4/locales/en.js +0 -120
- package/dist/node_modules/zod/v4/locales/eo.cjs +0 -124
- package/dist/node_modules/zod/v4/locales/eo.js +0 -119
- package/dist/node_modules/zod/v4/locales/es.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/es.js +0 -120
- package/dist/node_modules/zod/v4/locales/fa.cjs +0 -127
- package/dist/node_modules/zod/v4/locales/fa.js +0 -125
- package/dist/node_modules/zod/v4/locales/fi.cjs +0 -127
- package/dist/node_modules/zod/v4/locales/fi.js +0 -125
- package/dist/node_modules/zod/v4/locales/fr-CA.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/fr-CA.js +0 -120
- package/dist/node_modules/zod/v4/locales/fr.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/fr.js +0 -119
- package/dist/node_modules/zod/v4/locales/he.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/he.js +0 -120
- package/dist/node_modules/zod/v4/locales/hu.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/hu.js +0 -120
- package/dist/node_modules/zod/v4/locales/id.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/id.js +0 -119
- package/dist/node_modules/zod/v4/locales/index.cjs +0 -85
- package/dist/node_modules/zod/v4/locales/index.js +0 -39
- package/dist/node_modules/zod/v4/locales/it.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/it.js +0 -120
- package/dist/node_modules/zod/v4/locales/ja.cjs +0 -120
- package/dist/node_modules/zod/v4/locales/ja.js +0 -118
- package/dist/node_modules/zod/v4/locales/kh.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/kh.js +0 -120
- package/dist/node_modules/zod/v4/locales/ko.cjs +0 -126
- package/dist/node_modules/zod/v4/locales/ko.js +0 -124
- package/dist/node_modules/zod/v4/locales/mk.cjs +0 -123
- package/dist/node_modules/zod/v4/locales/mk.js +0 -121
- package/dist/node_modules/zod/v4/locales/ms.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/ms.js +0 -119
- package/dist/node_modules/zod/v4/locales/nl.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/nl.js +0 -120
- package/dist/node_modules/zod/v4/locales/no.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/no.js +0 -119
- package/dist/node_modules/zod/v4/locales/ota.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/ota.js +0 -120
- package/dist/node_modules/zod/v4/locales/pl.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/pl.js +0 -120
- package/dist/node_modules/zod/v4/locales/ps.cjs +0 -127
- package/dist/node_modules/zod/v4/locales/ps.js +0 -125
- package/dist/node_modules/zod/v4/locales/pt.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/pt.js +0 -119
- package/dist/node_modules/zod/v4/locales/ru.cjs +0 -169
- package/dist/node_modules/zod/v4/locales/ru.js +0 -167
- package/dist/node_modules/zod/v4/locales/sl.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/sl.js +0 -120
- package/dist/node_modules/zod/v4/locales/sv.cjs +0 -123
- package/dist/node_modules/zod/v4/locales/sv.js +0 -121
- package/dist/node_modules/zod/v4/locales/ta.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/ta.js +0 -120
- package/dist/node_modules/zod/v4/locales/th.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/th.js +0 -120
- package/dist/node_modules/zod/v4/locales/tr.cjs +0 -123
- package/dist/node_modules/zod/v4/locales/tr.js +0 -118
- package/dist/node_modules/zod/v4/locales/ua.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/ua.js +0 -120
- package/dist/node_modules/zod/v4/locales/ur.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/ur.js +0 -120
- package/dist/node_modules/zod/v4/locales/vi.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/vi.js +0 -119
- package/dist/node_modules/zod/v4/locales/zh-CN.cjs +0 -121
- package/dist/node_modules/zod/v4/locales/zh-CN.js +0 -119
- package/dist/node_modules/zod/v4/locales/zh-TW.cjs +0 -122
- package/dist/node_modules/zod/v4/locales/zh-TW.js +0 -120
|
@@ -1,587 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
5
|
-
const core = require('./core.cjs');
|
|
6
|
-
const regexes = require('./regexes.cjs');
|
|
7
|
-
const util = require('./util.cjs');
|
|
8
|
-
|
|
9
|
-
// import { $ZodType } from "./schemas.js";
|
|
10
|
-
const $ZodCheck = /*@__PURE__*/ core.$constructor("$ZodCheck", (inst, def) => {
|
|
11
|
-
var _a;
|
|
12
|
-
inst._zod ?? (inst._zod = {});
|
|
13
|
-
inst._zod.def = def;
|
|
14
|
-
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
15
|
-
});
|
|
16
|
-
const numericOriginMap = {
|
|
17
|
-
number: "number",
|
|
18
|
-
bigint: "bigint",
|
|
19
|
-
object: "date",
|
|
20
|
-
};
|
|
21
|
-
const $ZodCheckLessThan = /*@__PURE__*/ core.$constructor("$ZodCheckLessThan", (inst, def) => {
|
|
22
|
-
$ZodCheck.init(inst, def);
|
|
23
|
-
const origin = numericOriginMap[typeof def.value];
|
|
24
|
-
inst._zod.onattach.push((inst) => {
|
|
25
|
-
const bag = inst._zod.bag;
|
|
26
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
27
|
-
if (def.value < curr) {
|
|
28
|
-
if (def.inclusive)
|
|
29
|
-
bag.maximum = def.value;
|
|
30
|
-
else
|
|
31
|
-
bag.exclusiveMaximum = def.value;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
inst._zod.check = (payload) => {
|
|
35
|
-
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
payload.issues.push({
|
|
39
|
-
origin,
|
|
40
|
-
code: "too_big",
|
|
41
|
-
maximum: def.value,
|
|
42
|
-
input: payload.value,
|
|
43
|
-
inclusive: def.inclusive,
|
|
44
|
-
inst,
|
|
45
|
-
continue: !def.abort,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
const $ZodCheckGreaterThan = /*@__PURE__*/ core.$constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
50
|
-
$ZodCheck.init(inst, def);
|
|
51
|
-
const origin = numericOriginMap[typeof def.value];
|
|
52
|
-
inst._zod.onattach.push((inst) => {
|
|
53
|
-
const bag = inst._zod.bag;
|
|
54
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
55
|
-
if (def.value > curr) {
|
|
56
|
-
if (def.inclusive)
|
|
57
|
-
bag.minimum = def.value;
|
|
58
|
-
else
|
|
59
|
-
bag.exclusiveMinimum = def.value;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
inst._zod.check = (payload) => {
|
|
63
|
-
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
payload.issues.push({
|
|
67
|
-
origin,
|
|
68
|
-
code: "too_small",
|
|
69
|
-
minimum: def.value,
|
|
70
|
-
input: payload.value,
|
|
71
|
-
inclusive: def.inclusive,
|
|
72
|
-
inst,
|
|
73
|
-
continue: !def.abort,
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
const $ZodCheckMultipleOf =
|
|
78
|
-
/*@__PURE__*/ core.$constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
79
|
-
$ZodCheck.init(inst, def);
|
|
80
|
-
inst._zod.onattach.push((inst) => {
|
|
81
|
-
var _a;
|
|
82
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
83
|
-
});
|
|
84
|
-
inst._zod.check = (payload) => {
|
|
85
|
-
if (typeof payload.value !== typeof def.value)
|
|
86
|
-
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
87
|
-
const isMultiple = typeof payload.value === "bigint"
|
|
88
|
-
? payload.value % def.value === BigInt(0)
|
|
89
|
-
: util.floatSafeRemainder(payload.value, def.value) === 0;
|
|
90
|
-
if (isMultiple)
|
|
91
|
-
return;
|
|
92
|
-
payload.issues.push({
|
|
93
|
-
origin: typeof payload.value,
|
|
94
|
-
code: "not_multiple_of",
|
|
95
|
-
divisor: def.value,
|
|
96
|
-
input: payload.value,
|
|
97
|
-
inst,
|
|
98
|
-
continue: !def.abort,
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
103
|
-
$ZodCheck.init(inst, def); // no format checks
|
|
104
|
-
def.format = def.format || "float64";
|
|
105
|
-
const isInt = def.format?.includes("int");
|
|
106
|
-
const origin = isInt ? "int" : "number";
|
|
107
|
-
const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];
|
|
108
|
-
inst._zod.onattach.push((inst) => {
|
|
109
|
-
const bag = inst._zod.bag;
|
|
110
|
-
bag.format = def.format;
|
|
111
|
-
bag.minimum = minimum;
|
|
112
|
-
bag.maximum = maximum;
|
|
113
|
-
if (isInt)
|
|
114
|
-
bag.pattern = regexes.integer;
|
|
115
|
-
});
|
|
116
|
-
inst._zod.check = (payload) => {
|
|
117
|
-
const input = payload.value;
|
|
118
|
-
if (isInt) {
|
|
119
|
-
if (!Number.isInteger(input)) {
|
|
120
|
-
// invalid_format issue
|
|
121
|
-
// payload.issues.push({
|
|
122
|
-
// expected: def.format,
|
|
123
|
-
// format: def.format,
|
|
124
|
-
// code: "invalid_format",
|
|
125
|
-
// input,
|
|
126
|
-
// inst,
|
|
127
|
-
// });
|
|
128
|
-
// invalid_type issue
|
|
129
|
-
payload.issues.push({
|
|
130
|
-
expected: origin,
|
|
131
|
-
format: def.format,
|
|
132
|
-
code: "invalid_type",
|
|
133
|
-
input,
|
|
134
|
-
inst,
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
// not_multiple_of issue
|
|
138
|
-
// payload.issues.push({
|
|
139
|
-
// code: "not_multiple_of",
|
|
140
|
-
// origin: "number",
|
|
141
|
-
// input,
|
|
142
|
-
// inst,
|
|
143
|
-
// divisor: 1,
|
|
144
|
-
// });
|
|
145
|
-
}
|
|
146
|
-
if (!Number.isSafeInteger(input)) {
|
|
147
|
-
if (input > 0) {
|
|
148
|
-
// too_big
|
|
149
|
-
payload.issues.push({
|
|
150
|
-
input,
|
|
151
|
-
code: "too_big",
|
|
152
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
153
|
-
note: "Integers must be within the safe integer range.",
|
|
154
|
-
inst,
|
|
155
|
-
origin,
|
|
156
|
-
continue: !def.abort,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
// too_small
|
|
161
|
-
payload.issues.push({
|
|
162
|
-
input,
|
|
163
|
-
code: "too_small",
|
|
164
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
165
|
-
note: "Integers must be within the safe integer range.",
|
|
166
|
-
inst,
|
|
167
|
-
origin,
|
|
168
|
-
continue: !def.abort,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (input < minimum) {
|
|
175
|
-
payload.issues.push({
|
|
176
|
-
origin: "number",
|
|
177
|
-
input,
|
|
178
|
-
code: "too_small",
|
|
179
|
-
minimum,
|
|
180
|
-
inclusive: true,
|
|
181
|
-
inst,
|
|
182
|
-
continue: !def.abort,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
if (input > maximum) {
|
|
186
|
-
payload.issues.push({
|
|
187
|
-
origin: "number",
|
|
188
|
-
input,
|
|
189
|
-
code: "too_big",
|
|
190
|
-
maximum,
|
|
191
|
-
inst,
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
const $ZodCheckBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
|
|
197
|
-
$ZodCheck.init(inst, def); // no format checks
|
|
198
|
-
const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];
|
|
199
|
-
inst._zod.onattach.push((inst) => {
|
|
200
|
-
const bag = inst._zod.bag;
|
|
201
|
-
bag.format = def.format;
|
|
202
|
-
bag.minimum = minimum;
|
|
203
|
-
bag.maximum = maximum;
|
|
204
|
-
});
|
|
205
|
-
inst._zod.check = (payload) => {
|
|
206
|
-
const input = payload.value;
|
|
207
|
-
if (input < minimum) {
|
|
208
|
-
payload.issues.push({
|
|
209
|
-
origin: "bigint",
|
|
210
|
-
input,
|
|
211
|
-
code: "too_small",
|
|
212
|
-
minimum: minimum,
|
|
213
|
-
inclusive: true,
|
|
214
|
-
inst,
|
|
215
|
-
continue: !def.abort,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
if (input > maximum) {
|
|
219
|
-
payload.issues.push({
|
|
220
|
-
origin: "bigint",
|
|
221
|
-
input,
|
|
222
|
-
code: "too_big",
|
|
223
|
-
maximum,
|
|
224
|
-
inst,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
});
|
|
229
|
-
const $ZodCheckMaxSize = /*@__PURE__*/ core.$constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
230
|
-
$ZodCheck.init(inst, def);
|
|
231
|
-
inst._zod.when = (payload) => {
|
|
232
|
-
const val = payload.value;
|
|
233
|
-
return !util.nullish(val) && val.size !== undefined;
|
|
234
|
-
};
|
|
235
|
-
inst._zod.onattach.push((inst) => {
|
|
236
|
-
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
|
237
|
-
if (def.maximum < curr)
|
|
238
|
-
inst._zod.bag.maximum = def.maximum;
|
|
239
|
-
});
|
|
240
|
-
inst._zod.check = (payload) => {
|
|
241
|
-
const input = payload.value;
|
|
242
|
-
const size = input.size;
|
|
243
|
-
if (size <= def.maximum)
|
|
244
|
-
return;
|
|
245
|
-
payload.issues.push({
|
|
246
|
-
origin: util.getSizableOrigin(input),
|
|
247
|
-
code: "too_big",
|
|
248
|
-
maximum: def.maximum,
|
|
249
|
-
input,
|
|
250
|
-
inst,
|
|
251
|
-
continue: !def.abort,
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
const $ZodCheckMinSize = /*@__PURE__*/ core.$constructor("$ZodCheckMinSize", (inst, def) => {
|
|
256
|
-
$ZodCheck.init(inst, def);
|
|
257
|
-
inst._zod.when = (payload) => {
|
|
258
|
-
const val = payload.value;
|
|
259
|
-
return !util.nullish(val) && val.size !== undefined;
|
|
260
|
-
};
|
|
261
|
-
inst._zod.onattach.push((inst) => {
|
|
262
|
-
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
|
263
|
-
if (def.minimum > curr)
|
|
264
|
-
inst._zod.bag.minimum = def.minimum;
|
|
265
|
-
});
|
|
266
|
-
inst._zod.check = (payload) => {
|
|
267
|
-
const input = payload.value;
|
|
268
|
-
const size = input.size;
|
|
269
|
-
if (size >= def.minimum)
|
|
270
|
-
return;
|
|
271
|
-
payload.issues.push({
|
|
272
|
-
origin: util.getSizableOrigin(input),
|
|
273
|
-
code: "too_small",
|
|
274
|
-
minimum: def.minimum,
|
|
275
|
-
input,
|
|
276
|
-
inst,
|
|
277
|
-
continue: !def.abort,
|
|
278
|
-
});
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
const $ZodCheckSizeEquals = /*@__PURE__*/ core.$constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
282
|
-
$ZodCheck.init(inst, def);
|
|
283
|
-
inst._zod.when = (payload) => {
|
|
284
|
-
const val = payload.value;
|
|
285
|
-
return !util.nullish(val) && val.size !== undefined;
|
|
286
|
-
};
|
|
287
|
-
inst._zod.onattach.push((inst) => {
|
|
288
|
-
const bag = inst._zod.bag;
|
|
289
|
-
bag.minimum = def.size;
|
|
290
|
-
bag.maximum = def.size;
|
|
291
|
-
bag.size = def.size;
|
|
292
|
-
});
|
|
293
|
-
inst._zod.check = (payload) => {
|
|
294
|
-
const input = payload.value;
|
|
295
|
-
const size = input.size;
|
|
296
|
-
if (size === def.size)
|
|
297
|
-
return;
|
|
298
|
-
const tooBig = size > def.size;
|
|
299
|
-
payload.issues.push({
|
|
300
|
-
origin: util.getSizableOrigin(input),
|
|
301
|
-
...(tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }),
|
|
302
|
-
inclusive: true,
|
|
303
|
-
exact: true,
|
|
304
|
-
input: payload.value,
|
|
305
|
-
inst,
|
|
306
|
-
continue: !def.abort,
|
|
307
|
-
});
|
|
308
|
-
};
|
|
309
|
-
});
|
|
310
|
-
const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
311
|
-
$ZodCheck.init(inst, def);
|
|
312
|
-
inst._zod.when = (payload) => {
|
|
313
|
-
const val = payload.value;
|
|
314
|
-
return !util.nullish(val) && val.length !== undefined;
|
|
315
|
-
};
|
|
316
|
-
inst._zod.onattach.push((inst) => {
|
|
317
|
-
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
|
318
|
-
if (def.maximum < curr)
|
|
319
|
-
inst._zod.bag.maximum = def.maximum;
|
|
320
|
-
});
|
|
321
|
-
inst._zod.check = (payload) => {
|
|
322
|
-
const input = payload.value;
|
|
323
|
-
const length = input.length;
|
|
324
|
-
if (length <= def.maximum)
|
|
325
|
-
return;
|
|
326
|
-
const origin = util.getLengthableOrigin(input);
|
|
327
|
-
payload.issues.push({
|
|
328
|
-
origin,
|
|
329
|
-
code: "too_big",
|
|
330
|
-
maximum: def.maximum,
|
|
331
|
-
inclusive: true,
|
|
332
|
-
input,
|
|
333
|
-
inst,
|
|
334
|
-
continue: !def.abort,
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
});
|
|
338
|
-
const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor("$ZodCheckMinLength", (inst, def) => {
|
|
339
|
-
$ZodCheck.init(inst, def);
|
|
340
|
-
inst._zod.when = (payload) => {
|
|
341
|
-
const val = payload.value;
|
|
342
|
-
return !util.nullish(val) && val.length !== undefined;
|
|
343
|
-
};
|
|
344
|
-
inst._zod.onattach.push((inst) => {
|
|
345
|
-
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
|
346
|
-
if (def.minimum > curr)
|
|
347
|
-
inst._zod.bag.minimum = def.minimum;
|
|
348
|
-
});
|
|
349
|
-
inst._zod.check = (payload) => {
|
|
350
|
-
const input = payload.value;
|
|
351
|
-
const length = input.length;
|
|
352
|
-
if (length >= def.minimum)
|
|
353
|
-
return;
|
|
354
|
-
const origin = util.getLengthableOrigin(input);
|
|
355
|
-
payload.issues.push({
|
|
356
|
-
origin,
|
|
357
|
-
code: "too_small",
|
|
358
|
-
minimum: def.minimum,
|
|
359
|
-
inclusive: true,
|
|
360
|
-
input,
|
|
361
|
-
inst,
|
|
362
|
-
continue: !def.abort,
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
});
|
|
366
|
-
const $ZodCheckLengthEquals = /*@__PURE__*/ core.$constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
367
|
-
$ZodCheck.init(inst, def);
|
|
368
|
-
inst._zod.when = (payload) => {
|
|
369
|
-
const val = payload.value;
|
|
370
|
-
return !util.nullish(val) && val.length !== undefined;
|
|
371
|
-
};
|
|
372
|
-
inst._zod.onattach.push((inst) => {
|
|
373
|
-
const bag = inst._zod.bag;
|
|
374
|
-
bag.minimum = def.length;
|
|
375
|
-
bag.maximum = def.length;
|
|
376
|
-
bag.length = def.length;
|
|
377
|
-
});
|
|
378
|
-
inst._zod.check = (payload) => {
|
|
379
|
-
const input = payload.value;
|
|
380
|
-
const length = input.length;
|
|
381
|
-
if (length === def.length)
|
|
382
|
-
return;
|
|
383
|
-
const origin = util.getLengthableOrigin(input);
|
|
384
|
-
const tooBig = length > def.length;
|
|
385
|
-
payload.issues.push({
|
|
386
|
-
origin,
|
|
387
|
-
...(tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length }),
|
|
388
|
-
inclusive: true,
|
|
389
|
-
exact: true,
|
|
390
|
-
input: payload.value,
|
|
391
|
-
inst,
|
|
392
|
-
continue: !def.abort,
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
});
|
|
396
|
-
const $ZodCheckStringFormat = /*@__PURE__*/ core.$constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
397
|
-
var _a, _b;
|
|
398
|
-
$ZodCheck.init(inst, def);
|
|
399
|
-
inst._zod.onattach.push((inst) => {
|
|
400
|
-
const bag = inst._zod.bag;
|
|
401
|
-
bag.format = def.format;
|
|
402
|
-
if (def.pattern) {
|
|
403
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
404
|
-
bag.patterns.add(def.pattern);
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
if (def.pattern)
|
|
408
|
-
(_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
409
|
-
def.pattern.lastIndex = 0;
|
|
410
|
-
if (def.pattern.test(payload.value))
|
|
411
|
-
return;
|
|
412
|
-
payload.issues.push({
|
|
413
|
-
origin: "string",
|
|
414
|
-
code: "invalid_format",
|
|
415
|
-
format: def.format,
|
|
416
|
-
input: payload.value,
|
|
417
|
-
...(def.pattern ? { pattern: def.pattern.toString() } : {}),
|
|
418
|
-
inst,
|
|
419
|
-
continue: !def.abort,
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
else
|
|
423
|
-
(_b = inst._zod).check ?? (_b.check = () => { });
|
|
424
|
-
});
|
|
425
|
-
const $ZodCheckRegex = /*@__PURE__*/ core.$constructor("$ZodCheckRegex", (inst, def) => {
|
|
426
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
427
|
-
inst._zod.check = (payload) => {
|
|
428
|
-
def.pattern.lastIndex = 0;
|
|
429
|
-
if (def.pattern.test(payload.value))
|
|
430
|
-
return;
|
|
431
|
-
payload.issues.push({
|
|
432
|
-
origin: "string",
|
|
433
|
-
code: "invalid_format",
|
|
434
|
-
format: "regex",
|
|
435
|
-
input: payload.value,
|
|
436
|
-
pattern: def.pattern.toString(),
|
|
437
|
-
inst,
|
|
438
|
-
continue: !def.abort,
|
|
439
|
-
});
|
|
440
|
-
};
|
|
441
|
-
});
|
|
442
|
-
const $ZodCheckLowerCase = /*@__PURE__*/ core.$constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
443
|
-
def.pattern ?? (def.pattern = regexes.lowercase);
|
|
444
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
445
|
-
});
|
|
446
|
-
const $ZodCheckUpperCase = /*@__PURE__*/ core.$constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
447
|
-
def.pattern ?? (def.pattern = regexes.uppercase);
|
|
448
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
449
|
-
});
|
|
450
|
-
const $ZodCheckIncludes = /*@__PURE__*/ core.$constructor("$ZodCheckIncludes", (inst, def) => {
|
|
451
|
-
$ZodCheck.init(inst, def);
|
|
452
|
-
const escapedRegex = util.escapeRegex(def.includes);
|
|
453
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
454
|
-
def.pattern = pattern;
|
|
455
|
-
inst._zod.onattach.push((inst) => {
|
|
456
|
-
const bag = inst._zod.bag;
|
|
457
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
458
|
-
bag.patterns.add(pattern);
|
|
459
|
-
});
|
|
460
|
-
inst._zod.check = (payload) => {
|
|
461
|
-
if (payload.value.includes(def.includes, def.position))
|
|
462
|
-
return;
|
|
463
|
-
payload.issues.push({
|
|
464
|
-
origin: "string",
|
|
465
|
-
code: "invalid_format",
|
|
466
|
-
format: "includes",
|
|
467
|
-
includes: def.includes,
|
|
468
|
-
input: payload.value,
|
|
469
|
-
inst,
|
|
470
|
-
continue: !def.abort,
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
});
|
|
474
|
-
const $ZodCheckStartsWith = /*@__PURE__*/ core.$constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
475
|
-
$ZodCheck.init(inst, def);
|
|
476
|
-
const pattern = new RegExp(`^${util.escapeRegex(def.prefix)}.*`);
|
|
477
|
-
def.pattern ?? (def.pattern = pattern);
|
|
478
|
-
inst._zod.onattach.push((inst) => {
|
|
479
|
-
const bag = inst._zod.bag;
|
|
480
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
481
|
-
bag.patterns.add(pattern);
|
|
482
|
-
});
|
|
483
|
-
inst._zod.check = (payload) => {
|
|
484
|
-
if (payload.value.startsWith(def.prefix))
|
|
485
|
-
return;
|
|
486
|
-
payload.issues.push({
|
|
487
|
-
origin: "string",
|
|
488
|
-
code: "invalid_format",
|
|
489
|
-
format: "starts_with",
|
|
490
|
-
prefix: def.prefix,
|
|
491
|
-
input: payload.value,
|
|
492
|
-
inst,
|
|
493
|
-
continue: !def.abort,
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
const $ZodCheckEndsWith = /*@__PURE__*/ core.$constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
498
|
-
$ZodCheck.init(inst, def);
|
|
499
|
-
const pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);
|
|
500
|
-
def.pattern ?? (def.pattern = pattern);
|
|
501
|
-
inst._zod.onattach.push((inst) => {
|
|
502
|
-
const bag = inst._zod.bag;
|
|
503
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
504
|
-
bag.patterns.add(pattern);
|
|
505
|
-
});
|
|
506
|
-
inst._zod.check = (payload) => {
|
|
507
|
-
if (payload.value.endsWith(def.suffix))
|
|
508
|
-
return;
|
|
509
|
-
payload.issues.push({
|
|
510
|
-
origin: "string",
|
|
511
|
-
code: "invalid_format",
|
|
512
|
-
format: "ends_with",
|
|
513
|
-
suffix: def.suffix,
|
|
514
|
-
input: payload.value,
|
|
515
|
-
inst,
|
|
516
|
-
continue: !def.abort,
|
|
517
|
-
});
|
|
518
|
-
};
|
|
519
|
-
});
|
|
520
|
-
///////////////////////////////////
|
|
521
|
-
///// $ZodCheckProperty /////
|
|
522
|
-
///////////////////////////////////
|
|
523
|
-
function handleCheckPropertyResult(result, payload, property) {
|
|
524
|
-
if (result.issues.length) {
|
|
525
|
-
payload.issues.push(...util.prefixIssues(property, result.issues));
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
const $ZodCheckProperty = /*@__PURE__*/ core.$constructor("$ZodCheckProperty", (inst, def) => {
|
|
529
|
-
$ZodCheck.init(inst, def);
|
|
530
|
-
inst._zod.check = (payload) => {
|
|
531
|
-
const result = def.schema._zod.run({
|
|
532
|
-
value: payload.value[def.property],
|
|
533
|
-
issues: [],
|
|
534
|
-
}, {});
|
|
535
|
-
if (result instanceof Promise) {
|
|
536
|
-
return result.then((result) => handleCheckPropertyResult(result, payload, def.property));
|
|
537
|
-
}
|
|
538
|
-
handleCheckPropertyResult(result, payload, def.property);
|
|
539
|
-
return;
|
|
540
|
-
};
|
|
541
|
-
});
|
|
542
|
-
const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor("$ZodCheckMimeType", (inst, def) => {
|
|
543
|
-
$ZodCheck.init(inst, def);
|
|
544
|
-
const mimeSet = new Set(def.mime);
|
|
545
|
-
inst._zod.onattach.push((inst) => {
|
|
546
|
-
inst._zod.bag.mime = def.mime;
|
|
547
|
-
});
|
|
548
|
-
inst._zod.check = (payload) => {
|
|
549
|
-
if (mimeSet.has(payload.value.type))
|
|
550
|
-
return;
|
|
551
|
-
payload.issues.push({
|
|
552
|
-
code: "invalid_value",
|
|
553
|
-
values: def.mime,
|
|
554
|
-
input: payload.value.type,
|
|
555
|
-
inst,
|
|
556
|
-
});
|
|
557
|
-
};
|
|
558
|
-
});
|
|
559
|
-
const $ZodCheckOverwrite = /*@__PURE__*/ core.$constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
560
|
-
$ZodCheck.init(inst, def);
|
|
561
|
-
inst._zod.check = (payload) => {
|
|
562
|
-
payload.value = def.tx(payload.value);
|
|
563
|
-
};
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
exports.$ZodCheck = $ZodCheck;
|
|
567
|
-
exports.$ZodCheckBigIntFormat = $ZodCheckBigIntFormat;
|
|
568
|
-
exports.$ZodCheckEndsWith = $ZodCheckEndsWith;
|
|
569
|
-
exports.$ZodCheckGreaterThan = $ZodCheckGreaterThan;
|
|
570
|
-
exports.$ZodCheckIncludes = $ZodCheckIncludes;
|
|
571
|
-
exports.$ZodCheckLengthEquals = $ZodCheckLengthEquals;
|
|
572
|
-
exports.$ZodCheckLessThan = $ZodCheckLessThan;
|
|
573
|
-
exports.$ZodCheckLowerCase = $ZodCheckLowerCase;
|
|
574
|
-
exports.$ZodCheckMaxLength = $ZodCheckMaxLength;
|
|
575
|
-
exports.$ZodCheckMaxSize = $ZodCheckMaxSize;
|
|
576
|
-
exports.$ZodCheckMimeType = $ZodCheckMimeType;
|
|
577
|
-
exports.$ZodCheckMinLength = $ZodCheckMinLength;
|
|
578
|
-
exports.$ZodCheckMinSize = $ZodCheckMinSize;
|
|
579
|
-
exports.$ZodCheckMultipleOf = $ZodCheckMultipleOf;
|
|
580
|
-
exports.$ZodCheckNumberFormat = $ZodCheckNumberFormat;
|
|
581
|
-
exports.$ZodCheckOverwrite = $ZodCheckOverwrite;
|
|
582
|
-
exports.$ZodCheckProperty = $ZodCheckProperty;
|
|
583
|
-
exports.$ZodCheckRegex = $ZodCheckRegex;
|
|
584
|
-
exports.$ZodCheckSizeEquals = $ZodCheckSizeEquals;
|
|
585
|
-
exports.$ZodCheckStartsWith = $ZodCheckStartsWith;
|
|
586
|
-
exports.$ZodCheckStringFormat = $ZodCheckStringFormat;
|
|
587
|
-
exports.$ZodCheckUpperCase = $ZodCheckUpperCase;
|