@alienplatform/commands 3.3.17 → 3.3.19
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/index.js +1810 -910
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,69 +1,13 @@
|
|
|
1
1
|
import { AlienError, AlienError as AlienError$1, CommandStatusResponseSchema, CreateCommandResponseSchema, LeaseResponseSchema, defineError, defineError as defineError$1 } from "@alienplatform/core";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
4
|
-
var _a$1;
|
|
5
|
-
function $constructor(name, initializer, params) {
|
|
6
|
-
function init(inst, def) {
|
|
7
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
8
|
-
value: {
|
|
9
|
-
def,
|
|
10
|
-
constr: _,
|
|
11
|
-
traits: /* @__PURE__ */ new Set()
|
|
12
|
-
},
|
|
13
|
-
enumerable: false
|
|
14
|
-
});
|
|
15
|
-
if (inst._zod.traits.has(name)) return;
|
|
16
|
-
inst._zod.traits.add(name);
|
|
17
|
-
initializer(inst, def);
|
|
18
|
-
const proto = _.prototype;
|
|
19
|
-
const keys = Object.keys(proto);
|
|
20
|
-
for (let i = 0; i < keys.length; i++) {
|
|
21
|
-
const k = keys[i];
|
|
22
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const Parent = params?.Parent ?? Object;
|
|
26
|
-
class Definition extends Parent {}
|
|
27
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
28
|
-
function _(def) {
|
|
29
|
-
var _a;
|
|
30
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
31
|
-
init(inst, def);
|
|
32
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
33
|
-
for (const fn of inst._zod.deferred) fn();
|
|
34
|
-
return inst;
|
|
35
|
-
}
|
|
36
|
-
Object.defineProperty(_, "init", { value: init });
|
|
37
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
38
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
39
|
-
return inst?._zod?.traits?.has(name);
|
|
40
|
-
} });
|
|
41
|
-
Object.defineProperty(_, "name", { value: name });
|
|
42
|
-
return _;
|
|
43
|
-
}
|
|
44
|
-
var $ZodAsyncError = class extends Error {
|
|
45
|
-
constructor() {
|
|
46
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var $ZodEncodeError = class extends Error {
|
|
50
|
-
constructor(name) {
|
|
51
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
52
|
-
this.name = "ZodEncodeError";
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
56
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
57
|
-
function config(newConfig) {
|
|
58
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
59
|
-
return globalConfig;
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
3
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/util.js
|
|
63
4
|
function getEnumValues(entries) {
|
|
64
5
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
65
6
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
66
7
|
}
|
|
8
|
+
function joinValues(array, separator = "|") {
|
|
9
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
10
|
+
}
|
|
67
11
|
function jsonStringifyReplacer(_, value) {
|
|
68
12
|
if (typeof value === "bigint") return value.toString();
|
|
69
13
|
return value;
|
|
@@ -88,28 +32,10 @@ function cleanRegex(source) {
|
|
|
88
32
|
function floatSafeRemainder(val, step) {
|
|
89
33
|
const ratio = val / step;
|
|
90
34
|
const roundedRatio = Math.round(ratio);
|
|
91
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
35
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
92
36
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
93
37
|
return ratio - roundedRatio;
|
|
94
38
|
}
|
|
95
|
-
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
96
|
-
function defineLazy(object, key, getter) {
|
|
97
|
-
let value = void 0;
|
|
98
|
-
Object.defineProperty(object, key, {
|
|
99
|
-
get() {
|
|
100
|
-
if (value === EVALUATING) return;
|
|
101
|
-
if (value === void 0) {
|
|
102
|
-
value = EVALUATING;
|
|
103
|
-
value = getter();
|
|
104
|
-
}
|
|
105
|
-
return value;
|
|
106
|
-
},
|
|
107
|
-
set(v) {
|
|
108
|
-
Object.defineProperty(object, key, { value: v });
|
|
109
|
-
},
|
|
110
|
-
configurable: true
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
39
|
function assignProp(target, prop, value) {
|
|
114
40
|
Object.defineProperty(target, prop, {
|
|
115
41
|
value,
|
|
@@ -191,18 +117,23 @@ function normalizeParams(_params) {
|
|
|
191
117
|
};
|
|
192
118
|
return params;
|
|
193
119
|
}
|
|
120
|
+
function stringifyPrimitive(value) {
|
|
121
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
122
|
+
if (typeof value === "string") return `"${value}"`;
|
|
123
|
+
return `${value}`;
|
|
124
|
+
}
|
|
194
125
|
function optionalKeys(shape) {
|
|
195
126
|
return Object.keys(shape).filter((k) => {
|
|
196
|
-
return shape[k]._zod.optin
|
|
127
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
197
128
|
});
|
|
198
129
|
}
|
|
199
|
-
const NUMBER_FORMAT_RANGES = {
|
|
130
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
200
131
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
201
132
|
int32: [-2147483648, 2147483647],
|
|
202
133
|
uint32: [0, 4294967295],
|
|
203
134
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
204
135
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
205
|
-
};
|
|
136
|
+
}))();
|
|
206
137
|
function pick(schema, mask) {
|
|
207
138
|
const currDef = schema._zod.def;
|
|
208
139
|
const checks = currDef.checks;
|
|
@@ -210,10 +141,10 @@ function pick(schema, mask) {
|
|
|
210
141
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
211
142
|
get shape() {
|
|
212
143
|
const newShape = {};
|
|
213
|
-
for (const key
|
|
214
|
-
if (!(
|
|
144
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
145
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
215
146
|
if (!mask[key]) continue;
|
|
216
|
-
newShape
|
|
147
|
+
assignProp(newShape, key, currDef.shape[key]);
|
|
217
148
|
}
|
|
218
149
|
assignProp(this, "shape", newShape);
|
|
219
150
|
return newShape;
|
|
@@ -228,8 +159,8 @@ function omit(schema, mask) {
|
|
|
228
159
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
229
160
|
get shape() {
|
|
230
161
|
const newShape = { ...schema._zod.def.shape };
|
|
231
|
-
for (const key
|
|
232
|
-
if (!(
|
|
162
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
163
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
233
164
|
if (!mask[key]) continue;
|
|
234
165
|
delete newShape[key];
|
|
235
166
|
}
|
|
@@ -244,7 +175,7 @@ function extend(schema, shape) {
|
|
|
244
175
|
const checks = schema._zod.def.checks;
|
|
245
176
|
if (checks && checks.length > 0) {
|
|
246
177
|
const existingShape = schema._zod.def.shape;
|
|
247
|
-
for (const key
|
|
178
|
+
for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
248
179
|
}
|
|
249
180
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
250
181
|
const _shape = {
|
|
@@ -267,6 +198,7 @@ function safeExtend(schema, shape) {
|
|
|
267
198
|
} }));
|
|
268
199
|
}
|
|
269
200
|
function merge(a, b) {
|
|
201
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
270
202
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
271
203
|
return clone(a, mergeDefs(a._zod.def, {
|
|
272
204
|
get shape() {
|
|
@@ -283,22 +215,22 @@ function merge(a, b) {
|
|
|
283
215
|
checks: b._zod.def.checks ?? []
|
|
284
216
|
}));
|
|
285
217
|
}
|
|
286
|
-
function partial(Class, schema, mask) {
|
|
218
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
287
219
|
const checks = schema._zod.def.checks;
|
|
288
|
-
if (checks && checks.length > 0) throw new Error(
|
|
220
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
289
221
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
290
222
|
get shape() {
|
|
291
223
|
const oldShape = schema._zod.def.shape;
|
|
292
224
|
const shape = { ...oldShape };
|
|
293
|
-
if (mask) for (const key
|
|
294
|
-
if (!(key
|
|
225
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
226
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
295
227
|
if (!mask[key]) continue;
|
|
296
228
|
shape[key] = Class ? new Class({
|
|
297
229
|
type: "optional",
|
|
298
230
|
innerType: oldShape[key]
|
|
299
231
|
}) : oldShape[key];
|
|
300
232
|
}
|
|
301
|
-
else for (const key
|
|
233
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
302
234
|
type: "optional",
|
|
303
235
|
innerType: oldShape[key]
|
|
304
236
|
}) : oldShape[key];
|
|
@@ -312,15 +244,15 @@ function required(Class, schema, mask) {
|
|
|
312
244
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
313
245
|
const oldShape = schema._zod.def.shape;
|
|
314
246
|
const shape = { ...oldShape };
|
|
315
|
-
if (mask) for (const key
|
|
316
|
-
if (!(key
|
|
247
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
248
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
317
249
|
if (!mask[key]) continue;
|
|
318
250
|
shape[key] = new Class({
|
|
319
251
|
type: "nonoptional",
|
|
320
252
|
innerType: oldShape[key]
|
|
321
253
|
});
|
|
322
254
|
}
|
|
323
|
-
else for (const key
|
|
255
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
324
256
|
type: "nonoptional",
|
|
325
257
|
innerType: oldShape[key]
|
|
326
258
|
});
|
|
@@ -349,19 +281,54 @@ function prefixIssues(path, issues) {
|
|
|
349
281
|
function unwrapMessage(message) {
|
|
350
282
|
return typeof message === "string" ? message : message?.message;
|
|
351
283
|
}
|
|
284
|
+
function attachSchema(issues, start, inst) {
|
|
285
|
+
var _a;
|
|
286
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
287
|
+
}
|
|
352
288
|
function finalizeIssue(iss, ctx, config) {
|
|
353
|
-
|
|
354
|
-
const
|
|
289
|
+
var _a;
|
|
290
|
+
const traits = iss.inst?._zod?.traits;
|
|
291
|
+
if (traits?.has("$ZodType")) {
|
|
292
|
+
if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
293
|
+
else iss.schema = iss.inst;
|
|
294
|
+
}
|
|
295
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
296
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
297
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
355
298
|
rest.path ?? (rest.path = []);
|
|
356
299
|
rest.message = message;
|
|
357
300
|
if (ctx?.reportInput) rest.input = _input;
|
|
358
301
|
return rest;
|
|
359
302
|
}
|
|
303
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
304
|
+
function codePointLength(str) {
|
|
305
|
+
const units = str.length;
|
|
306
|
+
if (!highSurrogate.test(str)) return units;
|
|
307
|
+
let count = units;
|
|
308
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
309
|
+
count--;
|
|
310
|
+
i++;
|
|
311
|
+
}
|
|
312
|
+
return count;
|
|
313
|
+
}
|
|
360
314
|
function getLengthableOrigin(input) {
|
|
361
315
|
if (Array.isArray(input)) return "array";
|
|
362
316
|
if (typeof input === "string") return "string";
|
|
363
317
|
return "unknown";
|
|
364
318
|
}
|
|
319
|
+
function parsedType(data) {
|
|
320
|
+
const t = typeof data;
|
|
321
|
+
switch (t) {
|
|
322
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
323
|
+
case "object": {
|
|
324
|
+
if (data === null) return "null";
|
|
325
|
+
if (Array.isArray(data)) return "array";
|
|
326
|
+
const obj = data;
|
|
327
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return t;
|
|
331
|
+
}
|
|
365
332
|
function issue(...args) {
|
|
366
333
|
const [iss, input, inst] = args;
|
|
367
334
|
if (typeof iss === "string") return {
|
|
@@ -372,33 +339,330 @@ function issue(...args) {
|
|
|
372
339
|
};
|
|
373
340
|
return { ...iss };
|
|
374
341
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
344
|
+
*
|
|
345
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
346
|
+
*/
|
|
347
|
+
function members(proto, table) {
|
|
348
|
+
for (const key in table) {
|
|
349
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
350
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
351
|
+
...desc,
|
|
352
|
+
enumerable: false
|
|
353
|
+
});
|
|
354
|
+
else defineBound(proto, key, desc.value);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
358
|
+
function own(inst, key, value, enumerable = true) {
|
|
359
|
+
Object.defineProperty(inst, key, {
|
|
360
|
+
configurable: true,
|
|
361
|
+
writable: true,
|
|
362
|
+
enumerable,
|
|
363
|
+
value
|
|
382
364
|
});
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
365
|
+
return value;
|
|
366
|
+
}
|
|
367
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
368
|
+
function hide(inst, key, value) {
|
|
369
|
+
return own(inst, key, value, false);
|
|
370
|
+
}
|
|
371
|
+
function defineBound(proto, key, fn) {
|
|
372
|
+
Object.defineProperty(proto, key, {
|
|
373
|
+
configurable: true,
|
|
374
|
+
get() {
|
|
375
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
376
|
+
},
|
|
377
|
+
set(value) {
|
|
378
|
+
own(this, key, value);
|
|
379
|
+
}
|
|
386
380
|
});
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
381
|
+
}
|
|
382
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
383
|
+
function claim(inst, sentinel) {
|
|
384
|
+
const proto = Object.getPrototypeOf(inst);
|
|
385
|
+
return sentinel in proto ? void 0 : proto;
|
|
386
|
+
}
|
|
387
|
+
let installing;
|
|
388
|
+
let broke = false;
|
|
389
|
+
const breaker = {
|
|
390
|
+
configurable: true,
|
|
391
|
+
get() {
|
|
392
|
+
broke = true;
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
397
|
+
* constructor, computed from the internals object itself and cached there on
|
|
398
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
399
|
+
*/
|
|
400
|
+
function defineLazyInternal(inst, key, compute) {
|
|
401
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
402
|
+
if (key in proto && installing !== inst._zod) {
|
|
403
|
+
installing = void 0;
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
installing = inst._zod;
|
|
407
|
+
Object.defineProperty(proto, key, {
|
|
408
|
+
configurable: true,
|
|
409
|
+
get() {
|
|
410
|
+
Object.defineProperty(this, key, breaker);
|
|
411
|
+
const outer = broke;
|
|
412
|
+
broke = false;
|
|
413
|
+
try {
|
|
414
|
+
const value = compute(this);
|
|
415
|
+
if (broke) delete this[key];
|
|
416
|
+
else Object.defineProperty(this, key, {
|
|
417
|
+
configurable: true,
|
|
418
|
+
writable: true,
|
|
419
|
+
value
|
|
420
|
+
});
|
|
421
|
+
broke = broke || outer;
|
|
422
|
+
return value;
|
|
423
|
+
} catch (err) {
|
|
424
|
+
delete this[key];
|
|
425
|
+
broke = broke || outer;
|
|
426
|
+
throw err;
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
set(value) {
|
|
430
|
+
Object.defineProperty(this, key, {
|
|
431
|
+
configurable: true,
|
|
432
|
+
writable: true,
|
|
433
|
+
value
|
|
434
|
+
});
|
|
435
|
+
}
|
|
391
436
|
});
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
440
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
441
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
442
|
+
*/
|
|
443
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
444
|
+
const proto = claim(inst, key);
|
|
445
|
+
if (!proto) return;
|
|
446
|
+
Object.defineProperty(proto, key, {
|
|
447
|
+
configurable: true,
|
|
448
|
+
get() {
|
|
449
|
+
const desc = {
|
|
450
|
+
configurable: true,
|
|
451
|
+
writable: true,
|
|
452
|
+
enumerable,
|
|
453
|
+
value: void 0
|
|
454
|
+
};
|
|
455
|
+
Object.defineProperty(this, key, desc);
|
|
456
|
+
desc.value = make(this);
|
|
457
|
+
Object.defineProperty(this, key, desc);
|
|
458
|
+
return desc.value;
|
|
459
|
+
},
|
|
460
|
+
set(value) {
|
|
461
|
+
Object.defineProperty(this, key, {
|
|
462
|
+
configurable: true,
|
|
463
|
+
writable: true,
|
|
464
|
+
enumerable,
|
|
465
|
+
value
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
471
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
472
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
473
|
+
function constantCatch(value) {
|
|
474
|
+
const fn = () => value;
|
|
475
|
+
fn[CONSTANT_CATCH] = true;
|
|
476
|
+
return fn;
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/core.js
|
|
480
|
+
var _a$1;
|
|
481
|
+
const _zodDesc$1 = {
|
|
482
|
+
value: void 0,
|
|
483
|
+
enumerable: false
|
|
484
|
+
};
|
|
485
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
486
|
+
function newError(Definition) {
|
|
487
|
+
const E = _E;
|
|
488
|
+
if (E) {
|
|
489
|
+
const saved = E.stackTraceLimit;
|
|
490
|
+
if (typeof saved === "number") {
|
|
491
|
+
try {
|
|
492
|
+
E.stackTraceLimit = 0;
|
|
493
|
+
} catch {
|
|
494
|
+
_E = null;
|
|
495
|
+
return new Definition();
|
|
496
|
+
}
|
|
497
|
+
try {
|
|
498
|
+
return new Definition();
|
|
499
|
+
} finally {
|
|
500
|
+
E.stackTraceLimit = saved;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return new Definition();
|
|
505
|
+
}
|
|
506
|
+
function $constructor(name, initializer, proto, params) {
|
|
507
|
+
const zodProto = {};
|
|
508
|
+
function Internals(def) {
|
|
509
|
+
this.def = def;
|
|
510
|
+
this.constr = _;
|
|
511
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
512
|
+
}
|
|
513
|
+
Internals.prototype = zodProto;
|
|
514
|
+
const protoMembers = proto;
|
|
515
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
516
|
+
function init(inst, def) {
|
|
517
|
+
if (!inst._zod) {
|
|
518
|
+
_zodDesc$1.value = new Internals(def);
|
|
519
|
+
try {
|
|
520
|
+
Object.defineProperty(inst, "_zod", _zodDesc$1);
|
|
521
|
+
} finally {
|
|
522
|
+
_zodDesc$1.value = void 0;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (inst._zod.traits.has(name)) return;
|
|
526
|
+
inst._zod.traits.add(name);
|
|
527
|
+
initializer(inst, def);
|
|
528
|
+
if (initialized) {
|
|
529
|
+
const own = Object.getPrototypeOf(inst);
|
|
530
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
531
|
+
let up = own;
|
|
532
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
533
|
+
const target = up ?? own;
|
|
534
|
+
if (!initialized.has(target)) {
|
|
535
|
+
initialized.add(target);
|
|
536
|
+
members(target, protoMembers);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
const proto = _.prototype;
|
|
540
|
+
for (const k in proto) {
|
|
541
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
542
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const Parent = params?.Parent ?? Object;
|
|
546
|
+
class Definition extends Parent {}
|
|
547
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
548
|
+
function _(def) {
|
|
549
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
550
|
+
init(inst, def);
|
|
551
|
+
const deferred = inst._zod.deferred;
|
|
552
|
+
if (deferred) {
|
|
553
|
+
for (const fn of deferred) fn();
|
|
554
|
+
inst._zod.deferred = void 0;
|
|
555
|
+
}
|
|
556
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
557
|
+
if (pp) pp(inst);
|
|
558
|
+
return inst;
|
|
559
|
+
}
|
|
560
|
+
Object.defineProperty(_, "init", { value: init });
|
|
561
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
562
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
563
|
+
return inst?._zod?.traits?.has(name);
|
|
564
|
+
} });
|
|
565
|
+
Object.defineProperty(_, "name", { value: name });
|
|
566
|
+
return _;
|
|
567
|
+
}
|
|
568
|
+
var $ZodAsyncError = class extends Error {
|
|
569
|
+
constructor() {
|
|
570
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
var $ZodEncodeError = class extends Error {
|
|
574
|
+
constructor(name) {
|
|
575
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
576
|
+
this.name = "ZodEncodeError";
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
580
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
581
|
+
function config(newConfig) {
|
|
582
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
583
|
+
return globalConfig;
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/errors.js
|
|
587
|
+
function _getMessage() {
|
|
588
|
+
const internals = this._zod;
|
|
589
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
590
|
+
return internals.message;
|
|
591
|
+
}
|
|
592
|
+
function _setMessage(value) {
|
|
593
|
+
this._zod.message = value;
|
|
594
|
+
}
|
|
595
|
+
const _messageDesc = {
|
|
596
|
+
get: _getMessage,
|
|
597
|
+
set: _setMessage,
|
|
598
|
+
enumerable: true,
|
|
599
|
+
configurable: true
|
|
600
|
+
};
|
|
601
|
+
const _zodDesc = {
|
|
602
|
+
value: void 0,
|
|
603
|
+
enumerable: false
|
|
604
|
+
};
|
|
605
|
+
const _issuesDesc = {
|
|
606
|
+
value: void 0,
|
|
607
|
+
enumerable: false
|
|
608
|
+
};
|
|
609
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
610
|
+
const initializer$1 = (inst, def) => {
|
|
611
|
+
inst.name = "$ZodError";
|
|
612
|
+
_zodDesc.value = inst._zod;
|
|
613
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
614
|
+
_issuesDesc.value = def;
|
|
615
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
616
|
+
_zodDesc.value = void 0;
|
|
617
|
+
_issuesDesc.value = void 0;
|
|
618
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
619
|
+
const proto = Object.getPrototypeOf(inst);
|
|
620
|
+
if (!_installedToString.has(proto)) {
|
|
621
|
+
_installedToString.add(proto);
|
|
622
|
+
Object.defineProperty(proto, "toString", {
|
|
623
|
+
configurable: true,
|
|
624
|
+
enumerable: false,
|
|
625
|
+
get() {
|
|
626
|
+
const value = () => this.message;
|
|
627
|
+
Object.defineProperty(this, "toString", {
|
|
628
|
+
value,
|
|
629
|
+
configurable: true,
|
|
630
|
+
writable: true
|
|
631
|
+
});
|
|
632
|
+
return value;
|
|
633
|
+
},
|
|
634
|
+
set(value) {
|
|
635
|
+
Object.defineProperty(this, "toString", {
|
|
636
|
+
value,
|
|
637
|
+
configurable: true,
|
|
638
|
+
writable: true
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}
|
|
392
643
|
};
|
|
393
644
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
394
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
645
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
646
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
647
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
648
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
649
|
+
function node(obj, key, make) {
|
|
650
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
651
|
+
if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
652
|
+
value: make(),
|
|
653
|
+
writable: true,
|
|
654
|
+
enumerable: true,
|
|
655
|
+
configurable: true
|
|
656
|
+
});
|
|
657
|
+
else obj[key] = make();
|
|
658
|
+
}
|
|
659
|
+
return obj[key];
|
|
660
|
+
}
|
|
395
661
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
396
662
|
const fieldErrors = {};
|
|
397
663
|
const formErrors = [];
|
|
398
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
399
|
-
|
|
400
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
401
|
-
} else formErrors.push(mapper(sub));
|
|
664
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
665
|
+
else formErrors.push(mapper(sub));
|
|
402
666
|
return {
|
|
403
667
|
formErrors,
|
|
404
668
|
fieldErrors
|
|
@@ -418,12 +682,21 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
418
682
|
let i = 0;
|
|
419
683
|
while (i < fullpath.length) {
|
|
420
684
|
const el = fullpath[i];
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
685
|
+
const terminal = i === fullpath.length - 1;
|
|
686
|
+
if (el === "_errors") {
|
|
687
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
688
|
+
i++;
|
|
689
|
+
continue;
|
|
425
690
|
}
|
|
426
|
-
curr
|
|
691
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
692
|
+
value: { _errors: [] },
|
|
693
|
+
enumerable: true,
|
|
694
|
+
writable: true,
|
|
695
|
+
configurable: true
|
|
696
|
+
});
|
|
697
|
+
const node = curr[el];
|
|
698
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
699
|
+
curr = node;
|
|
427
700
|
i++;
|
|
428
701
|
}
|
|
429
702
|
}
|
|
@@ -433,40 +706,52 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
433
706
|
return fieldErrors;
|
|
434
707
|
}
|
|
435
708
|
//#endregion
|
|
436
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
709
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/parse.js
|
|
710
|
+
function finalizeParams(callee, params) {
|
|
711
|
+
return {
|
|
712
|
+
callee: params?.callee ?? callee,
|
|
713
|
+
Err: params?.Err
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
const _parse = (_Err) => {
|
|
717
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
718
|
+
const ctx = _ctx ? {
|
|
719
|
+
..._ctx,
|
|
720
|
+
async: false
|
|
721
|
+
} : { async: false };
|
|
722
|
+
const result = schema._zod.run({
|
|
723
|
+
value,
|
|
724
|
+
issues: []
|
|
725
|
+
}, ctx);
|
|
726
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
727
|
+
if (result.issues.length) {
|
|
728
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
729
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
730
|
+
throw e;
|
|
731
|
+
}
|
|
732
|
+
return result.value;
|
|
733
|
+
};
|
|
734
|
+
return fn;
|
|
453
735
|
};
|
|
454
|
-
const _parseAsync = (_Err) =>
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
736
|
+
const _parseAsync = (_Err) => {
|
|
737
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
738
|
+
const ctx = _ctx ? {
|
|
739
|
+
..._ctx,
|
|
740
|
+
async: true
|
|
741
|
+
} : { async: true };
|
|
742
|
+
let result = schema._zod.run({
|
|
743
|
+
value,
|
|
744
|
+
issues: []
|
|
745
|
+
}, ctx);
|
|
746
|
+
if (result instanceof Promise) result = await result;
|
|
747
|
+
if (result.issues.length) {
|
|
748
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
749
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
750
|
+
throw e;
|
|
751
|
+
}
|
|
752
|
+
return result.value;
|
|
753
|
+
};
|
|
754
|
+
return fn;
|
|
470
755
|
};
|
|
471
756
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
472
757
|
const ctx = _ctx ? {
|
|
@@ -506,25 +791,41 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
506
791
|
};
|
|
507
792
|
};
|
|
508
793
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
509
|
-
const _encode = (_Err) =>
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
794
|
+
const _encode = (_Err) => {
|
|
795
|
+
const parse = _parse(_Err);
|
|
796
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
797
|
+
const ctx = _ctx ? {
|
|
798
|
+
..._ctx,
|
|
799
|
+
direction: "backward"
|
|
800
|
+
} : { direction: "backward" };
|
|
801
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
802
|
+
};
|
|
803
|
+
return fn;
|
|
515
804
|
};
|
|
516
|
-
const _decode = (_Err) =>
|
|
517
|
-
|
|
805
|
+
const _decode = (_Err) => {
|
|
806
|
+
const parse = _parse(_Err);
|
|
807
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
808
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
809
|
+
};
|
|
810
|
+
return fn;
|
|
518
811
|
};
|
|
519
|
-
const _encodeAsync = (_Err) =>
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
812
|
+
const _encodeAsync = (_Err) => {
|
|
813
|
+
const parseAsync = _parseAsync(_Err);
|
|
814
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
815
|
+
const ctx = _ctx ? {
|
|
816
|
+
..._ctx,
|
|
817
|
+
direction: "backward"
|
|
818
|
+
} : { direction: "backward" };
|
|
819
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
820
|
+
};
|
|
821
|
+
return fn;
|
|
525
822
|
};
|
|
526
|
-
const _decodeAsync = (_Err) =>
|
|
527
|
-
|
|
823
|
+
const _decodeAsync = (_Err) => {
|
|
824
|
+
const parseAsync = _parseAsync(_Err);
|
|
825
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
826
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
827
|
+
};
|
|
828
|
+
return fn;
|
|
528
829
|
};
|
|
529
830
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
530
831
|
const ctx = _ctx ? {
|
|
@@ -547,7 +848,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
547
848
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
548
849
|
};
|
|
549
850
|
//#endregion
|
|
550
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
851
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/regexes.js
|
|
551
852
|
/**
|
|
552
853
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
553
854
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -555,12 +856,15 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
555
856
|
*/
|
|
556
857
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
557
858
|
const cuid2 = /^[0-9a-z]+$/;
|
|
558
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
859
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
559
860
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
560
861
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
561
862
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
863
|
+
function nanoidOfLength(length) {
|
|
864
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
865
|
+
}
|
|
562
866
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
563
|
-
const duration
|
|
867
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
564
868
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
565
869
|
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
566
870
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -572,33 +876,41 @@ const uuid = (version) => {
|
|
|
572
876
|
};
|
|
573
877
|
/** Practical email validation */
|
|
574
878
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
575
|
-
const _emoji$1 = `^
|
|
879
|
+
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
576
880
|
function emoji() {
|
|
577
881
|
return new RegExp(_emoji$1, "u");
|
|
578
882
|
}
|
|
579
883
|
const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
580
884
|
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
581
885
|
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
582
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
886
|
+
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
583
887
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
584
888
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
585
889
|
const httpProtocol = /^https?$/;
|
|
586
890
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
587
891
|
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
588
|
-
|
|
892
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
893
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
894
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
895
|
+
function anchor(source) {
|
|
896
|
+
return new RegExp(`^${source}$`);
|
|
897
|
+
}
|
|
898
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
589
899
|
function timeSource(args) {
|
|
590
900
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
591
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
901
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
592
902
|
}
|
|
593
|
-
function time
|
|
903
|
+
function time(args) {
|
|
594
904
|
return new RegExp(`^${timeSource(args)}$`);
|
|
595
905
|
}
|
|
596
906
|
function datetime$1(args) {
|
|
597
|
-
const time = timeSource({ precision: args.precision });
|
|
598
907
|
const opts = ["Z"];
|
|
599
|
-
if (args.local) opts.push("");
|
|
600
908
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
601
|
-
const
|
|
909
|
+
const qualified = `${timeSource({
|
|
910
|
+
precision: args.precision,
|
|
911
|
+
seconds: true
|
|
912
|
+
})}(?:${opts.join("|")})`;
|
|
913
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
602
914
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
603
915
|
}
|
|
604
916
|
const string$1 = (params) => {
|
|
@@ -611,13 +923,18 @@ const _undefined$2 = /^undefined$/i;
|
|
|
611
923
|
const lowercase = /^[^A-Z]*$/;
|
|
612
924
|
const uppercase = /^[^a-z]*$/;
|
|
613
925
|
//#endregion
|
|
614
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
926
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/checks.js
|
|
615
927
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
616
928
|
var _a;
|
|
617
929
|
inst._zod ?? (inst._zod = {});
|
|
618
930
|
inst._zod.def = def;
|
|
619
931
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
620
932
|
});
|
|
933
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
934
|
+
const _whenHasLength = (payload) => {
|
|
935
|
+
const val = payload.value;
|
|
936
|
+
return !nullish(val) && val.length !== void 0;
|
|
937
|
+
};
|
|
621
938
|
const numericOriginMap = {
|
|
622
939
|
number: "number",
|
|
623
940
|
bigint: "bigint",
|
|
@@ -637,7 +954,7 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
|
|
|
637
954
|
inst._zod.check = (payload) => {
|
|
638
955
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
639
956
|
payload.issues.push({
|
|
640
|
-
origin,
|
|
957
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
641
958
|
code: "too_big",
|
|
642
959
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
643
960
|
input: payload.value,
|
|
@@ -661,7 +978,7 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
|
|
|
661
978
|
inst._zod.check = (payload) => {
|
|
662
979
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
663
980
|
payload.issues.push({
|
|
664
|
-
origin,
|
|
981
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
665
982
|
code: "too_small",
|
|
666
983
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
667
984
|
input: payload.value,
|
|
@@ -679,7 +996,7 @@ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (i
|
|
|
679
996
|
});
|
|
680
997
|
inst._zod.check = (payload) => {
|
|
681
998
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
682
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
999
|
+
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
683
1000
|
payload.issues.push({
|
|
684
1001
|
origin: typeof payload.value,
|
|
685
1002
|
code: "not_multiple_of",
|
|
@@ -764,17 +1081,15 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
764
1081
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
765
1082
|
var _a;
|
|
766
1083
|
$ZodCheck.init(inst, def);
|
|
767
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
768
|
-
const val = payload.value;
|
|
769
|
-
return !nullish(val) && val.length !== void 0;
|
|
770
|
-
});
|
|
1084
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
771
1085
|
inst._zod.onattach.push((inst) => {
|
|
772
1086
|
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
773
1087
|
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
774
1088
|
});
|
|
775
1089
|
inst._zod.check = (payload) => {
|
|
776
1090
|
const input = payload.value;
|
|
777
|
-
|
|
1091
|
+
const units = input.length;
|
|
1092
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
778
1093
|
const origin = getLengthableOrigin(input);
|
|
779
1094
|
payload.issues.push({
|
|
780
1095
|
origin,
|
|
@@ -790,17 +1105,15 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
790
1105
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
791
1106
|
var _a;
|
|
792
1107
|
$ZodCheck.init(inst, def);
|
|
793
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
794
|
-
const val = payload.value;
|
|
795
|
-
return !nullish(val) && val.length !== void 0;
|
|
796
|
-
});
|
|
1108
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
797
1109
|
inst._zod.onattach.push((inst) => {
|
|
798
1110
|
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
799
1111
|
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
800
1112
|
});
|
|
801
1113
|
inst._zod.check = (payload) => {
|
|
802
1114
|
const input = payload.value;
|
|
803
|
-
|
|
1115
|
+
const units = input.length;
|
|
1116
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
804
1117
|
const origin = getLengthableOrigin(input);
|
|
805
1118
|
payload.issues.push({
|
|
806
1119
|
origin,
|
|
@@ -816,10 +1129,7 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
816
1129
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
817
1130
|
var _a;
|
|
818
1131
|
$ZodCheck.init(inst, def);
|
|
819
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
820
|
-
const val = payload.value;
|
|
821
|
-
return !nullish(val) && val.length !== void 0;
|
|
822
|
-
});
|
|
1132
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
823
1133
|
inst._zod.onattach.push((inst) => {
|
|
824
1134
|
const bag = inst._zod.bag;
|
|
825
1135
|
bag.minimum = def.length;
|
|
@@ -828,7 +1138,8 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
828
1138
|
});
|
|
829
1139
|
inst._zod.check = (payload) => {
|
|
830
1140
|
const input = payload.value;
|
|
831
|
-
const
|
|
1141
|
+
const units = input.length;
|
|
1142
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
832
1143
|
if (length === def.length) return;
|
|
833
1144
|
const origin = getLengthableOrigin(input);
|
|
834
1145
|
const tooBig = length > def.length;
|
|
@@ -902,7 +1213,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
|
|
|
902
1213
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
903
1214
|
$ZodCheck.init(inst, def);
|
|
904
1215
|
const escapedRegex = escapeRegex(def.includes);
|
|
905
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1216
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
906
1217
|
def.pattern = pattern;
|
|
907
1218
|
inst._zod.onattach.push((inst) => {
|
|
908
1219
|
const bag = inst._zod.bag;
|
|
@@ -973,12 +1284,13 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
973
1284
|
};
|
|
974
1285
|
});
|
|
975
1286
|
//#endregion
|
|
976
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1287
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/doc.js
|
|
977
1288
|
var Doc = class {
|
|
978
|
-
constructor(args = []) {
|
|
1289
|
+
constructor(args = [], closed = {}) {
|
|
979
1290
|
this.content = [];
|
|
980
1291
|
this.indent = 0;
|
|
981
|
-
|
|
1292
|
+
this.args = args;
|
|
1293
|
+
this.closed = closed;
|
|
982
1294
|
}
|
|
983
1295
|
indented(fn) {
|
|
984
1296
|
this.indent += 1;
|
|
@@ -998,28 +1310,27 @@ var Doc = class {
|
|
|
998
1310
|
}
|
|
999
1311
|
compile() {
|
|
1000
1312
|
const F = Function;
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1003
|
-
return new F(...args, lines.join("\n"));
|
|
1313
|
+
const content = this?.content ?? [``];
|
|
1314
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1004
1315
|
}
|
|
1005
1316
|
};
|
|
1006
1317
|
//#endregion
|
|
1007
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1318
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/versions.js
|
|
1008
1319
|
const version = {
|
|
1009
1320
|
major: 4,
|
|
1010
|
-
minor:
|
|
1011
|
-
patch:
|
|
1321
|
+
minor: 5,
|
|
1322
|
+
patch: 2
|
|
1012
1323
|
};
|
|
1013
1324
|
//#endregion
|
|
1014
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1325
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/schemas.js
|
|
1015
1326
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1016
1327
|
var _a;
|
|
1017
1328
|
inst ?? (inst = {});
|
|
1018
1329
|
inst._zod.def = def;
|
|
1019
1330
|
inst._zod.bag = inst._zod.bag || {};
|
|
1020
1331
|
inst._zod.version = version;
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1332
|
+
const defChecks = inst._zod.def.checks;
|
|
1333
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1023
1334
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1024
1335
|
if (checks.length === 0) {
|
|
1025
1336
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1028,6 +1339,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1028
1339
|
});
|
|
1029
1340
|
} else {
|
|
1030
1341
|
const runChecks = (payload, checks, ctx) => {
|
|
1342
|
+
if (payload.memo) return payload;
|
|
1031
1343
|
let isAborted = aborted(payload);
|
|
1032
1344
|
let asyncResult;
|
|
1033
1345
|
for (const ch of checks) {
|
|
@@ -1041,10 +1353,12 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1041
1353
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1042
1354
|
await _;
|
|
1043
1355
|
if (payload.issues.length === currLen) return;
|
|
1356
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1044
1357
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1045
1358
|
});
|
|
1046
1359
|
else {
|
|
1047
1360
|
if (payload.issues.length === currLen) continue;
|
|
1361
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1048
1362
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1049
1363
|
}
|
|
1050
1364
|
}
|
|
@@ -1088,19 +1402,29 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1088
1402
|
return runChecks(result, checks, ctx);
|
|
1089
1403
|
};
|
|
1090
1404
|
}
|
|
1091
|
-
|
|
1405
|
+
}, {
|
|
1406
|
+
get "~standard"() {
|
|
1407
|
+
return hide(this, "~standard", standardProps(this));
|
|
1408
|
+
},
|
|
1409
|
+
set "~standard"(value) {
|
|
1410
|
+
own(this, "~standard", value);
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1414
|
+
const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1415
|
+
function standardProps(inst) {
|
|
1416
|
+
return {
|
|
1092
1417
|
validate: (value) => {
|
|
1093
1418
|
try {
|
|
1094
|
-
|
|
1095
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1419
|
+
return toStandardResult(safeParse$1(inst, value));
|
|
1096
1420
|
} catch (_) {
|
|
1097
|
-
return safeParseAsync$1(inst, value).then(
|
|
1421
|
+
return safeParseAsync$1(inst, value).then(toStandardResult);
|
|
1098
1422
|
}
|
|
1099
1423
|
},
|
|
1100
1424
|
vendor: "zod",
|
|
1101
1425
|
version: 1
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1104
1428
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1105
1429
|
$ZodType.init(inst, def);
|
|
1106
1430
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
@@ -1147,51 +1471,74 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1147
1471
|
def.pattern ?? (def.pattern = email);
|
|
1148
1472
|
$ZodStringFormat.init(inst, def);
|
|
1149
1473
|
});
|
|
1474
|
+
/** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
|
|
1475
|
+
function parseURLObject(trimmed, def) {
|
|
1476
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1477
|
+
try {
|
|
1478
|
+
return new URL(trimmed);
|
|
1479
|
+
} catch {
|
|
1480
|
+
return 2;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1484
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
1485
|
+
function stripTabAndNewline(value) {
|
|
1486
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1487
|
+
}
|
|
1488
|
+
function urlHostnameOk(url, hostname) {
|
|
1489
|
+
hostname.lastIndex = 0;
|
|
1490
|
+
return hostname.test(url.hostname);
|
|
1491
|
+
}
|
|
1492
|
+
function urlProtocolOk(url, protocol) {
|
|
1493
|
+
protocol.lastIndex = 0;
|
|
1494
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1495
|
+
}
|
|
1150
1496
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1151
1497
|
$ZodStringFormat.init(inst, def);
|
|
1152
1498
|
inst._zod.check = (payload) => {
|
|
1153
1499
|
try {
|
|
1154
1500
|
const trimmed = payload.value.trim();
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
code: "invalid_format",
|
|
1159
|
-
format: "url",
|
|
1160
|
-
note: "Invalid URL format",
|
|
1161
|
-
input: payload.value,
|
|
1162
|
-
inst,
|
|
1163
|
-
continue: !def.abort
|
|
1164
|
-
});
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
const url = new URL(trimmed);
|
|
1169
|
-
if (def.hostname) {
|
|
1170
|
-
def.hostname.lastIndex = 0;
|
|
1171
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1501
|
+
const url = parseURLObject(trimmed, def);
|
|
1502
|
+
if (url === 1) {
|
|
1503
|
+
payload.issues.push({
|
|
1172
1504
|
code: "invalid_format",
|
|
1173
1505
|
format: "url",
|
|
1174
|
-
note: "Invalid
|
|
1175
|
-
pattern: def.hostname.source,
|
|
1506
|
+
note: "Invalid URL format",
|
|
1176
1507
|
input: payload.value,
|
|
1177
1508
|
inst,
|
|
1178
1509
|
continue: !def.abort
|
|
1179
1510
|
});
|
|
1511
|
+
return;
|
|
1180
1512
|
}
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1183
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1513
|
+
if (url === 2) {
|
|
1514
|
+
payload.issues.push({
|
|
1184
1515
|
code: "invalid_format",
|
|
1185
1516
|
format: "url",
|
|
1186
|
-
note: "Invalid protocol",
|
|
1187
|
-
pattern: def.protocol.source,
|
|
1188
1517
|
input: payload.value,
|
|
1189
1518
|
inst,
|
|
1190
1519
|
continue: !def.abort
|
|
1191
1520
|
});
|
|
1521
|
+
return;
|
|
1192
1522
|
}
|
|
1193
|
-
if (def.
|
|
1194
|
-
|
|
1523
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1524
|
+
code: "invalid_format",
|
|
1525
|
+
format: "url",
|
|
1526
|
+
note: "Invalid hostname",
|
|
1527
|
+
pattern: def.hostname.source,
|
|
1528
|
+
input: payload.value,
|
|
1529
|
+
inst,
|
|
1530
|
+
continue: !def.abort
|
|
1531
|
+
});
|
|
1532
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1533
|
+
code: "invalid_format",
|
|
1534
|
+
format: "url",
|
|
1535
|
+
note: "Invalid protocol",
|
|
1536
|
+
pattern: def.protocol.source,
|
|
1537
|
+
input: payload.value,
|
|
1538
|
+
inst,
|
|
1539
|
+
continue: !def.abort
|
|
1540
|
+
});
|
|
1541
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1195
1542
|
return;
|
|
1196
1543
|
} catch (_) {
|
|
1197
1544
|
payload.issues.push({
|
|
@@ -1209,7 +1556,8 @@ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
1209
1556
|
$ZodStringFormat.init(inst, def);
|
|
1210
1557
|
});
|
|
1211
1558
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1212
|
-
def.
|
|
1559
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1560
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1213
1561
|
$ZodStringFormat.init(inst, def);
|
|
1214
1562
|
});
|
|
1215
1563
|
/**
|
|
@@ -1240,17 +1588,23 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1240
1588
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1241
1589
|
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1242
1590
|
$ZodStringFormat.init(inst, def);
|
|
1591
|
+
if (def.local || def.precision === -1) {
|
|
1592
|
+
inst._zod.bag.laxFormat = true;
|
|
1593
|
+
inst._zod.onattach.push((s) => {
|
|
1594
|
+
s._zod.bag.laxFormat = true;
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1243
1597
|
});
|
|
1244
1598
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1245
|
-
def.pattern ?? (def.pattern = date
|
|
1599
|
+
def.pattern ?? (def.pattern = date);
|
|
1246
1600
|
$ZodStringFormat.init(inst, def);
|
|
1247
1601
|
});
|
|
1248
1602
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1249
|
-
def.pattern ?? (def.pattern = time
|
|
1603
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1250
1604
|
$ZodStringFormat.init(inst, def);
|
|
1251
1605
|
});
|
|
1252
1606
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1253
|
-
def.pattern ?? (def.pattern = duration
|
|
1607
|
+
def.pattern ?? (def.pattern = duration);
|
|
1254
1608
|
$ZodStringFormat.init(inst, def);
|
|
1255
1609
|
});
|
|
1256
1610
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
@@ -1258,50 +1612,56 @@ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
|
1258
1612
|
$ZodStringFormat.init(inst, def);
|
|
1259
1613
|
inst._zod.bag.format = `ipv4`;
|
|
1260
1614
|
});
|
|
1615
|
+
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
1616
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1617
|
+
function isValidIPv6(value) {
|
|
1618
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
1619
|
+
try {
|
|
1620
|
+
new URL(`http://[${value}]`);
|
|
1621
|
+
return true;
|
|
1622
|
+
} catch {
|
|
1623
|
+
return false;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1261
1626
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1262
1627
|
def.pattern ?? (def.pattern = ipv6);
|
|
1263
1628
|
$ZodStringFormat.init(inst, def);
|
|
1264
1629
|
inst._zod.bag.format = `ipv6`;
|
|
1265
1630
|
inst._zod.check = (payload) => {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
payload.
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
inst,
|
|
1274
|
-
continue: !def.abort
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1631
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1632
|
+
code: "invalid_format",
|
|
1633
|
+
format: "ipv6",
|
|
1634
|
+
input: payload.value,
|
|
1635
|
+
inst,
|
|
1636
|
+
continue: !def.abort
|
|
1637
|
+
});
|
|
1277
1638
|
};
|
|
1278
1639
|
});
|
|
1279
1640
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1280
1641
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1281
1642
|
$ZodStringFormat.init(inst, def);
|
|
1282
1643
|
});
|
|
1644
|
+
function isValidCIDRv6(value) {
|
|
1645
|
+
const parts = value.split("/");
|
|
1646
|
+
if (parts.length !== 2) return false;
|
|
1647
|
+
const [address, prefix] = parts;
|
|
1648
|
+
if (!prefix) return false;
|
|
1649
|
+
const prefixNum = Number(prefix);
|
|
1650
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
1651
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1652
|
+
return isValidIPv6(address);
|
|
1653
|
+
}
|
|
1283
1654
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1284
1655
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1285
1656
|
$ZodStringFormat.init(inst, def);
|
|
1286
1657
|
inst._zod.check = (payload) => {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1295
|
-
new URL(`http://[${address}]`);
|
|
1296
|
-
} catch {
|
|
1297
|
-
payload.issues.push({
|
|
1298
|
-
code: "invalid_format",
|
|
1299
|
-
format: "cidrv6",
|
|
1300
|
-
input: payload.value,
|
|
1301
|
-
inst,
|
|
1302
|
-
continue: !def.abort
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1658
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
1659
|
+
code: "invalid_format",
|
|
1660
|
+
format: "cidrv6",
|
|
1661
|
+
input: payload.value,
|
|
1662
|
+
inst,
|
|
1663
|
+
continue: !def.abort
|
|
1664
|
+
});
|
|
1305
1665
|
};
|
|
1306
1666
|
});
|
|
1307
1667
|
function isValidBase64(data) {
|
|
@@ -1391,7 +1751,7 @@ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
|
1391
1751
|
} catch (_) {}
|
|
1392
1752
|
const input = payload.value;
|
|
1393
1753
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1394
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1754
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
1395
1755
|
payload.issues.push({
|
|
1396
1756
|
expected: "number",
|
|
1397
1757
|
code: "invalid_type",
|
|
@@ -1444,6 +1804,8 @@ function handleArrayResult(result, final, index) {
|
|
|
1444
1804
|
}
|
|
1445
1805
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1446
1806
|
$ZodType.init(inst, def);
|
|
1807
|
+
const memo = globalConfig.memoizer;
|
|
1808
|
+
memo?.attach(inst);
|
|
1447
1809
|
inst._zod.parse = (payload, ctx) => {
|
|
1448
1810
|
const input = payload.value;
|
|
1449
1811
|
if (!Array.isArray(input)) {
|
|
@@ -1455,7 +1817,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1455
1817
|
});
|
|
1456
1818
|
return payload;
|
|
1457
1819
|
}
|
|
1458
|
-
payload.value = Array(input.length);
|
|
1820
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1459
1821
|
const proms = [];
|
|
1460
1822
|
for (let i = 0; i < input.length; i++) {
|
|
1461
1823
|
const item = input[i];
|
|
@@ -1470,13 +1832,15 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1470
1832
|
return payload;
|
|
1471
1833
|
};
|
|
1472
1834
|
});
|
|
1473
|
-
function handlePropertyResult(result, final, key, input,
|
|
1835
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1474
1836
|
const isPresent = key in input;
|
|
1837
|
+
const isOptionalOut = optout === "optional";
|
|
1838
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1475
1839
|
if (result.issues.length) {
|
|
1476
|
-
if (
|
|
1840
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
1477
1841
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1478
1842
|
}
|
|
1479
|
-
if (!isPresent &&
|
|
1843
|
+
if (!isPresent && optin === void 0) {
|
|
1480
1844
|
if (!result.issues.length) final.issues.push({
|
|
1481
1845
|
code: "invalid_type",
|
|
1482
1846
|
expected: "nonoptional",
|
|
@@ -1489,13 +1853,18 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
1489
1853
|
if (isPresent) final.value[key] = void 0;
|
|
1490
1854
|
} else final.value[key] = result.value;
|
|
1491
1855
|
}
|
|
1856
|
+
const NO_SYMBOL_KEYS = [];
|
|
1492
1857
|
function normalizeDef(def) {
|
|
1493
1858
|
const keys = Object.keys(def.shape);
|
|
1494
|
-
|
|
1859
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
1860
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
1861
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
1862
|
+
for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
1495
1863
|
const okeys = optionalKeys(def.shape);
|
|
1496
1864
|
return {
|
|
1497
1865
|
...def,
|
|
1498
|
-
|
|
1866
|
+
allKeys,
|
|
1867
|
+
symbolKeys,
|
|
1499
1868
|
keySet: new Set(keys),
|
|
1500
1869
|
numKeys: keys.length,
|
|
1501
1870
|
optionalKeys: new Set(okeys)
|
|
@@ -1506,11 +1875,14 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1506
1875
|
const keySet = def.keySet;
|
|
1507
1876
|
const _catchall = def.catchall._zod;
|
|
1508
1877
|
const t = _catchall.def.type;
|
|
1509
|
-
const
|
|
1510
|
-
const
|
|
1878
|
+
const optin = _catchall.optin;
|
|
1879
|
+
const optout = _catchall.optout;
|
|
1511
1880
|
for (const key in input) {
|
|
1512
|
-
if (key === "__proto__") continue;
|
|
1513
1881
|
if (keySet.has(key)) continue;
|
|
1882
|
+
if (key === "__proto__") {
|
|
1883
|
+
if (t === "never") unrecognized.push(key);
|
|
1884
|
+
continue;
|
|
1885
|
+
}
|
|
1514
1886
|
if (t === "never") {
|
|
1515
1887
|
unrecognized.push(key);
|
|
1516
1888
|
continue;
|
|
@@ -1519,39 +1891,44 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1519
1891
|
value: input[key],
|
|
1520
1892
|
issues: []
|
|
1521
1893
|
}, ctx);
|
|
1522
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1523
|
-
else handlePropertyResult(r, payload, key, input,
|
|
1894
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
1895
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1524
1896
|
}
|
|
1525
1897
|
if (unrecognized.length) payload.issues.push({
|
|
1526
1898
|
code: "unrecognized_keys",
|
|
1527
1899
|
keys: unrecognized,
|
|
1528
1900
|
input,
|
|
1529
|
-
inst
|
|
1901
|
+
inst,
|
|
1902
|
+
continue: true
|
|
1530
1903
|
});
|
|
1531
1904
|
if (!proms.length) return payload;
|
|
1532
1905
|
return Promise.all(proms).then(() => {
|
|
1533
1906
|
return payload;
|
|
1534
1907
|
});
|
|
1535
1908
|
}
|
|
1909
|
+
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
1536
1910
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1537
1911
|
$ZodType.init(inst, def);
|
|
1538
1912
|
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1539
1913
|
const sh = def.shape;
|
|
1914
|
+
propShapes.set(def, sh);
|
|
1540
1915
|
Object.defineProperty(def, "shape", { get: () => {
|
|
1541
1916
|
const newSh = { ...sh };
|
|
1542
1917
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
1918
|
+
propShapes.set(def, newSh);
|
|
1543
1919
|
return newSh;
|
|
1544
1920
|
} });
|
|
1545
1921
|
}
|
|
1546
1922
|
const _normalized = cached(() => normalizeDef(def));
|
|
1547
|
-
|
|
1548
|
-
const shape = def.shape;
|
|
1923
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
1924
|
+
const shape = zod.def.shape;
|
|
1549
1925
|
const propValues = {};
|
|
1550
1926
|
for (const key in shape) {
|
|
1551
1927
|
const field = shape[key]._zod;
|
|
1552
1928
|
if (field.values) {
|
|
1553
|
-
propValues
|
|
1929
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
1554
1930
|
for (const v of field.values) propValues[key].add(v);
|
|
1931
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
1555
1932
|
}
|
|
1556
1933
|
}
|
|
1557
1934
|
return propValues;
|
|
@@ -1559,6 +1936,8 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1559
1936
|
const isObject$1 = isObject;
|
|
1560
1937
|
const catchall = def.catchall;
|
|
1561
1938
|
let value;
|
|
1939
|
+
const memo = globalConfig.memoizer;
|
|
1940
|
+
memo?.attach(inst);
|
|
1562
1941
|
inst._zod.parse = (payload, ctx) => {
|
|
1563
1942
|
value ?? (value = _normalized.value);
|
|
1564
1943
|
const input = payload.value;
|
|
@@ -1571,19 +1950,20 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1571
1950
|
});
|
|
1572
1951
|
return payload;
|
|
1573
1952
|
}
|
|
1574
|
-
payload.value = {};
|
|
1953
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1575
1954
|
const proms = [];
|
|
1576
1955
|
const shape = value.shape;
|
|
1577
|
-
for (const key of value.
|
|
1956
|
+
for (const key of value.allKeys) {
|
|
1957
|
+
if (key === "__proto__") continue;
|
|
1578
1958
|
const el = shape[key];
|
|
1579
|
-
const
|
|
1580
|
-
const
|
|
1959
|
+
const optin = el._zod.optin;
|
|
1960
|
+
const optout = el._zod.optout;
|
|
1581
1961
|
const r = el._zod.run({
|
|
1582
1962
|
value: input[key],
|
|
1583
1963
|
issues: []
|
|
1584
1964
|
}, ctx);
|
|
1585
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1586
|
-
else handlePropertyResult(r, payload, key, input,
|
|
1965
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
1966
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1587
1967
|
}
|
|
1588
1968
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1589
1969
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
@@ -1593,55 +1973,55 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1593
1973
|
$ZodObject.init(inst, def);
|
|
1594
1974
|
const superParse = inst._zod.parse;
|
|
1595
1975
|
const _normalized = cached(() => normalizeDef(def));
|
|
1976
|
+
const memo = globalConfig.memoizer;
|
|
1596
1977
|
const generateFastpass = (shape) => {
|
|
1597
|
-
const doc = new Doc([
|
|
1598
|
-
"shape",
|
|
1599
|
-
"payload",
|
|
1600
|
-
"ctx"
|
|
1601
|
-
]);
|
|
1602
1978
|
const normalized = _normalized.value;
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1979
|
+
const syms = normalized.symbolKeys;
|
|
1980
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
1981
|
+
shape,
|
|
1982
|
+
inst,
|
|
1983
|
+
memo,
|
|
1984
|
+
syms
|
|
1985
|
+
});
|
|
1986
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1987
|
+
const prefixStr = (id, k) => `
|
|
1988
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1989
|
+
const iss = ${id}.issues[i];
|
|
1990
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1991
|
+
payload.issues.push(iss);
|
|
1992
|
+
}`;
|
|
1607
1993
|
doc.write(`const input = payload.value;`);
|
|
1608
1994
|
const ids = Object.create(null);
|
|
1609
1995
|
let counter = 0;
|
|
1610
|
-
for (const key of normalized.
|
|
1611
|
-
doc.write(`const newResult = {};`);
|
|
1612
|
-
for (const key of normalized.
|
|
1996
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
1997
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1998
|
+
for (const key of normalized.allKeys) {
|
|
1999
|
+
if (key === "__proto__") continue;
|
|
1613
2000
|
const id = ids[key];
|
|
1614
|
-
const k = esc(key);
|
|
2001
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2002
|
+
const isPresent = `${k} in input`;
|
|
1615
2003
|
const schema = shape[key];
|
|
1616
|
-
const
|
|
2004
|
+
const optin = schema?._zod?.optin;
|
|
2005
|
+
const isOptionalIn = optin !== void 0;
|
|
1617
2006
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1618
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1619
|
-
if (isOptionalIn && isOptionalOut)
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
})));
|
|
2007
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2008
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2009
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2010
|
+
doc.write(`
|
|
2011
|
+
const ${id}_present = ${isPresent};
|
|
2012
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2013
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1626
2014
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
if (${k} in input) {
|
|
1631
|
-
newResult[${k}] = undefined;
|
|
2015
|
+
|
|
2016
|
+
if (${assign}) {
|
|
2017
|
+
newResult[${k}] = ${id}.value;
|
|
1632
2018
|
}
|
|
1633
|
-
} else {
|
|
1634
|
-
newResult[${k}] = ${id}.value;
|
|
1635
2019
|
}
|
|
1636
|
-
|
|
2020
|
+
|
|
1637
2021
|
`);
|
|
1638
|
-
else if (!isOptionalIn) doc.write(`
|
|
1639
|
-
const ${id}_present = ${
|
|
1640
|
-
if (${id}.issues.length) {
|
|
1641
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1642
|
-
...iss,
|
|
1643
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1644
|
-
})));
|
|
2022
|
+
} else if (!isOptionalIn) doc.write(`
|
|
2023
|
+
const ${id}_present = ${isPresent};
|
|
2024
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1645
2025
|
}
|
|
1646
2026
|
if (!${id}_present && !${id}.issues.length) {
|
|
1647
2027
|
payload.issues.push({
|
|
@@ -1653,36 +2033,27 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1653
2033
|
}
|
|
1654
2034
|
|
|
1655
2035
|
if (${id}_present) {
|
|
1656
|
-
|
|
1657
|
-
newResult[${k}] = undefined;
|
|
1658
|
-
} else {
|
|
1659
|
-
newResult[${k}] = ${id}.value;
|
|
1660
|
-
}
|
|
2036
|
+
newResult[${k}] = ${id}.value;
|
|
1661
2037
|
}
|
|
1662
2038
|
|
|
1663
2039
|
`);
|
|
1664
2040
|
else doc.write(`
|
|
1665
|
-
if (${id}.issues.length) {
|
|
1666
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1667
|
-
...iss,
|
|
1668
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1669
|
-
})));
|
|
2041
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1670
2042
|
}
|
|
1671
2043
|
|
|
1672
2044
|
if (${id}.value === undefined) {
|
|
1673
|
-
if (${
|
|
2045
|
+
if (${isPresent}) {
|
|
1674
2046
|
newResult[${k}] = undefined;
|
|
1675
2047
|
}
|
|
1676
2048
|
} else {
|
|
1677
2049
|
newResult[${k}] = ${id}.value;
|
|
1678
2050
|
}
|
|
1679
|
-
|
|
2051
|
+
|
|
1680
2052
|
`);
|
|
1681
2053
|
}
|
|
1682
2054
|
doc.write(`payload.value = newResult;`);
|
|
1683
2055
|
doc.write(`return payload;`);
|
|
1684
|
-
|
|
1685
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2056
|
+
return doc.compile();
|
|
1686
2057
|
};
|
|
1687
2058
|
let fastpass;
|
|
1688
2059
|
const isObject$2 = isObject;
|
|
@@ -1731,14 +2102,14 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1731
2102
|
}
|
|
1732
2103
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1733
2104
|
$ZodType.init(inst, def);
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2105
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
|
|
2106
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2107
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2108
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1738
2109
|
});
|
|
1739
|
-
|
|
1740
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1741
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2110
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2111
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2112
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1742
2113
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1743
2114
|
}
|
|
1744
2115
|
});
|
|
@@ -1800,7 +2171,9 @@ function mergeValues(a, b) {
|
|
|
1800
2171
|
...a,
|
|
1801
2172
|
...b
|
|
1802
2173
|
};
|
|
2174
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
1803
2175
|
for (const key of sharedKeys) {
|
|
2176
|
+
if (key === "__proto__") continue;
|
|
1804
2177
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1805
2178
|
if (!sharedValue.valid) return {
|
|
1806
2179
|
valid: false,
|
|
@@ -1842,26 +2215,39 @@ function mergeValues(a, b) {
|
|
|
1842
2215
|
function handleIntersectionResults(result, left, right) {
|
|
1843
2216
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1844
2217
|
let unrecIssue;
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2218
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2219
|
+
const collect = (iss, side) => {
|
|
2220
|
+
let keys;
|
|
2221
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2222
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
2223
|
+
keys = iss.keys;
|
|
2224
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2225
|
+
const k = String(iss.path[0]);
|
|
2226
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2227
|
+
keys = [k];
|
|
2228
|
+
} else return false;
|
|
2229
|
+
for (const k of keys) {
|
|
1848
2230
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1849
|
-
unrecKeys.get(k)
|
|
2231
|
+
unrecKeys.get(k)[side] = true;
|
|
1850
2232
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}
|
|
1856
|
-
else result.issues.push(iss);
|
|
2233
|
+
return true;
|
|
2234
|
+
};
|
|
2235
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
2236
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
1857
2237
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1858
|
-
if (bothKeys.length
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
2238
|
+
if (bothKeys.length) {
|
|
2239
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2240
|
+
if (aggregated.length) result.issues.push({
|
|
2241
|
+
...unrecIssue,
|
|
2242
|
+
keys: aggregated
|
|
2243
|
+
});
|
|
2244
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
2245
|
+
}
|
|
1863
2246
|
const merged = mergeValues(left.value, right.value);
|
|
1864
|
-
if (!merged.valid)
|
|
2247
|
+
if (!merged.valid) {
|
|
2248
|
+
if (aborted(result)) return result;
|
|
2249
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2250
|
+
}
|
|
1865
2251
|
result.value = merged.data;
|
|
1866
2252
|
return result;
|
|
1867
2253
|
}
|
|
@@ -1870,7 +2256,8 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
1870
2256
|
const values = getEnumValues(def.entries);
|
|
1871
2257
|
const valuesSet = new Set(values);
|
|
1872
2258
|
inst._zod.values = valuesSet;
|
|
1873
|
-
|
|
2259
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
2260
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
1874
2261
|
inst._zod.parse = (payload, _ctx) => {
|
|
1875
2262
|
const input = payload.value;
|
|
1876
2263
|
if (valuesSet.has(input)) return payload;
|
|
@@ -1886,67 +2273,66 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
1886
2273
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
1887
2274
|
$ZodType.init(inst, def);
|
|
1888
2275
|
inst._zod.optin = "optional";
|
|
2276
|
+
globalConfig.memoizer?.guard(inst);
|
|
1889
2277
|
inst._zod.parse = (payload, ctx) => {
|
|
1890
2278
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
1891
2279
|
const _out = def.transform(payload.value, payload);
|
|
1892
2280
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
1893
2281
|
payload.value = output;
|
|
1894
|
-
payload.fallback = true;
|
|
1895
2282
|
return payload;
|
|
1896
2283
|
});
|
|
1897
2284
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
1898
2285
|
payload.value = _out;
|
|
1899
|
-
payload.fallback = true;
|
|
1900
2286
|
return payload;
|
|
1901
2287
|
};
|
|
1902
2288
|
});
|
|
1903
|
-
function handleOptionalResult(
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
value: void 0
|
|
1907
|
-
};
|
|
1908
|
-
return result;
|
|
2289
|
+
function handleOptionalResult(payload, result) {
|
|
2290
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2291
|
+
return payload;
|
|
1909
2292
|
}
|
|
1910
2293
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
1911
2294
|
$ZodType.init(inst, def);
|
|
1912
|
-
inst._zod.optin
|
|
2295
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1913
2296
|
inst._zod.optout = "optional";
|
|
1914
|
-
|
|
1915
|
-
|
|
2297
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2298
|
+
const values = zod.def.innerType._zod.values;
|
|
2299
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
1916
2300
|
});
|
|
1917
|
-
|
|
1918
|
-
const pattern = def.innerType._zod.pattern;
|
|
2301
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2302
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1919
2303
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1920
2304
|
});
|
|
1921
2305
|
inst._zod.parse = (payload, ctx) => {
|
|
1922
|
-
if (
|
|
1923
|
-
|
|
1924
|
-
const result = def.innerType._zod.run(
|
|
1925
|
-
|
|
1926
|
-
|
|
2306
|
+
if (payload.value === void 0) {
|
|
2307
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
2308
|
+
const result = def.innerType._zod.run({
|
|
2309
|
+
value: payload.value,
|
|
2310
|
+
issues: []
|
|
2311
|
+
}, ctx);
|
|
2312
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2313
|
+
return handleOptionalResult(payload, result);
|
|
1927
2314
|
}
|
|
1928
|
-
if (payload.value === void 0) return payload;
|
|
1929
2315
|
return def.innerType._zod.run(payload, ctx);
|
|
1930
2316
|
};
|
|
1931
2317
|
});
|
|
1932
2318
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
1933
2319
|
$ZodOptional.init(inst, def);
|
|
1934
|
-
|
|
1935
|
-
|
|
2320
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2321
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1936
2322
|
inst._zod.parse = (payload, ctx) => {
|
|
1937
2323
|
return def.innerType._zod.run(payload, ctx);
|
|
1938
2324
|
};
|
|
1939
2325
|
});
|
|
1940
2326
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
1941
2327
|
$ZodType.init(inst, def);
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
const pattern = def.innerType._zod.pattern;
|
|
2328
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2329
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2330
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2331
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1946
2332
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1947
2333
|
});
|
|
1948
|
-
|
|
1949
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2334
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2335
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
1950
2336
|
});
|
|
1951
2337
|
inst._zod.parse = (payload, ctx) => {
|
|
1952
2338
|
if (payload.value === null) return payload;
|
|
@@ -1955,8 +2341,8 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
|
1955
2341
|
});
|
|
1956
2342
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
1957
2343
|
$ZodType.init(inst, def);
|
|
1958
|
-
inst._zod.optin = "
|
|
1959
|
-
|
|
2344
|
+
inst._zod.optin = "defaulted";
|
|
2345
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1960
2346
|
inst._zod.parse = (payload, ctx) => {
|
|
1961
2347
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1962
2348
|
if (payload.value === void 0) {
|
|
@@ -1977,8 +2363,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1977
2363
|
}
|
|
1978
2364
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
1979
2365
|
$ZodType.init(inst, def);
|
|
1980
|
-
inst._zod.optin = "
|
|
1981
|
-
|
|
2366
|
+
inst._zod.optin = "defaulted";
|
|
2367
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1982
2368
|
inst._zod.parse = (payload, ctx) => {
|
|
1983
2369
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1984
2370
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -1987,8 +2373,8 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
1987
2373
|
});
|
|
1988
2374
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1989
2375
|
$ZodType.init(inst, def);
|
|
1990
|
-
|
|
1991
|
-
const v = def.innerType._zod.values;
|
|
2376
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2377
|
+
const v = zod.def.innerType._zod.values;
|
|
1992
2378
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1993
2379
|
});
|
|
1994
2380
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2006,46 +2392,41 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2006
2392
|
});
|
|
2007
2393
|
return payload;
|
|
2008
2394
|
}
|
|
2395
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2396
|
+
if (!result.issues.length) {
|
|
2397
|
+
payload.value = result.value;
|
|
2398
|
+
if (result.memo) payload.memo = true;
|
|
2399
|
+
return payload;
|
|
2400
|
+
}
|
|
2401
|
+
payload.value = def.catchValue({
|
|
2402
|
+
...result,
|
|
2403
|
+
value: payload.value,
|
|
2404
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2405
|
+
input: payload.value
|
|
2406
|
+
});
|
|
2407
|
+
return payload;
|
|
2408
|
+
}
|
|
2009
2409
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2010
2410
|
$ZodType.init(inst, def);
|
|
2011
|
-
inst._zod.optin
|
|
2012
|
-
|
|
2013
|
-
|
|
2411
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2412
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2413
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2014
2414
|
inst._zod.parse = (payload, ctx) => {
|
|
2015
2415
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2016
|
-
const result = def.innerType._zod.run(
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2023
|
-
input: payload.value
|
|
2024
|
-
});
|
|
2025
|
-
payload.issues = [];
|
|
2026
|
-
payload.fallback = true;
|
|
2027
|
-
}
|
|
2028
|
-
return payload;
|
|
2029
|
-
});
|
|
2030
|
-
payload.value = result.value;
|
|
2031
|
-
if (result.issues.length) {
|
|
2032
|
-
payload.value = def.catchValue({
|
|
2033
|
-
...payload,
|
|
2034
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2035
|
-
input: payload.value
|
|
2036
|
-
});
|
|
2037
|
-
payload.issues = [];
|
|
2038
|
-
payload.fallback = true;
|
|
2039
|
-
}
|
|
2040
|
-
return payload;
|
|
2416
|
+
const result = def.innerType._zod.run({
|
|
2417
|
+
value: payload.value,
|
|
2418
|
+
issues: []
|
|
2419
|
+
}, ctx);
|
|
2420
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2421
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2041
2422
|
};
|
|
2042
2423
|
});
|
|
2043
2424
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2044
2425
|
$ZodType.init(inst, def);
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2426
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2427
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2428
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2429
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2049
2430
|
inst._zod.parse = (payload, ctx) => {
|
|
2050
2431
|
if (ctx.direction === "backward") {
|
|
2051
2432
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2058,22 +2439,21 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2058
2439
|
};
|
|
2059
2440
|
});
|
|
2060
2441
|
function handlePipeResult(left, next, ctx) {
|
|
2061
|
-
if (left.issues.
|
|
2442
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2062
2443
|
left.aborted = true;
|
|
2063
2444
|
return left;
|
|
2064
2445
|
}
|
|
2065
2446
|
return next._zod.run({
|
|
2066
2447
|
value: left.value,
|
|
2067
|
-
issues: left.issues
|
|
2068
|
-
fallback: left.fallback
|
|
2448
|
+
issues: left.issues
|
|
2069
2449
|
}, ctx);
|
|
2070
2450
|
}
|
|
2071
2451
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2072
2452
|
$ZodType.init(inst, def);
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2453
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2454
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2455
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2456
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2077
2457
|
inst._zod.parse = (payload, ctx) => {
|
|
2078
2458
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2079
2459
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2082,37 +2462,295 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2082
2462
|
};
|
|
2083
2463
|
});
|
|
2084
2464
|
function handleReadonlyResult(payload) {
|
|
2085
|
-
payload.value = Object.freeze(payload.value);
|
|
2465
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
2086
2466
|
return payload;
|
|
2087
2467
|
}
|
|
2088
|
-
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2089
|
-
$ZodCheck.init(inst, def);
|
|
2090
|
-
$ZodType.init(inst, def);
|
|
2091
|
-
inst._zod.parse = (payload, _) => {
|
|
2092
|
-
return payload;
|
|
2468
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2469
|
+
$ZodCheck.init(inst, def);
|
|
2470
|
+
$ZodType.init(inst, def);
|
|
2471
|
+
inst._zod.parse = (payload, _) => {
|
|
2472
|
+
return payload;
|
|
2473
|
+
};
|
|
2474
|
+
inst._zod.check = (payload) => {
|
|
2475
|
+
const input = payload.value;
|
|
2476
|
+
const r = def.fn(input);
|
|
2477
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2478
|
+
handleRefineResult(r, payload, input, inst);
|
|
2479
|
+
};
|
|
2480
|
+
});
|
|
2481
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2482
|
+
if (!result) {
|
|
2483
|
+
const _iss = {
|
|
2484
|
+
code: "custom",
|
|
2485
|
+
input,
|
|
2486
|
+
inst,
|
|
2487
|
+
path: [...inst._zod.def.path ?? []],
|
|
2488
|
+
continue: !inst._zod.def.abort
|
|
2489
|
+
};
|
|
2490
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2491
|
+
payload.issues.push(issue(_iss));
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
//#endregion
|
|
2495
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/memoizer.js
|
|
2496
|
+
var $ZodCyclicError = class extends Error {
|
|
2497
|
+
constructor() {
|
|
2498
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2499
|
+
this.name = "ZodCyclicError";
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2503
|
+
const STATE = "~memo";
|
|
2504
|
+
const NO_ISSUES = [];
|
|
2505
|
+
function cloneIssues(issues) {
|
|
2506
|
+
return issues.map((iss) => iss.path ? {
|
|
2507
|
+
...iss,
|
|
2508
|
+
path: iss.path.slice()
|
|
2509
|
+
} : { ...iss });
|
|
2510
|
+
}
|
|
2511
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2512
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2513
|
+
function isRecursive(inst, stack) {
|
|
2514
|
+
const cached = recursive.get(inst);
|
|
2515
|
+
if (cached !== void 0) return cached;
|
|
2516
|
+
if (stack.has(inst)) return true;
|
|
2517
|
+
stack.add(inst);
|
|
2518
|
+
let result = false;
|
|
2519
|
+
const check = (child) => {
|
|
2520
|
+
if (!result && child?._zod && isRecursive(child, stack)) result = true;
|
|
2521
|
+
};
|
|
2522
|
+
const def = inst._zod.def;
|
|
2523
|
+
if (def.type === "lazy") check(inst._zod.innerType);
|
|
2524
|
+
else {
|
|
2525
|
+
const shape = def.shape;
|
|
2526
|
+
if (shape) for (const key of Reflect.ownKeys(shape)) check(shape[key]);
|
|
2527
|
+
for (const key in def) {
|
|
2528
|
+
const value = def[key];
|
|
2529
|
+
if (!value || typeof value !== "object") continue;
|
|
2530
|
+
if (value._zod) check(value);
|
|
2531
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
stack.delete(inst);
|
|
2535
|
+
recursive.set(inst, result);
|
|
2536
|
+
return result;
|
|
2537
|
+
}
|
|
2538
|
+
function bucketFor(state, inst) {
|
|
2539
|
+
let bucket = state.buckets.get(inst);
|
|
2540
|
+
if (!bucket) {
|
|
2541
|
+
bucket = /* @__PURE__ */ new Map();
|
|
2542
|
+
state.buckets.set(inst, bucket);
|
|
2543
|
+
}
|
|
2544
|
+
return bucket;
|
|
2545
|
+
}
|
|
2546
|
+
let handoff;
|
|
2547
|
+
const open = [];
|
|
2548
|
+
const memo = {
|
|
2549
|
+
alloc(_inst, payload, empty) {
|
|
2550
|
+
const bucket = handoff;
|
|
2551
|
+
if (!bucket) return empty;
|
|
2552
|
+
handoff = void 0;
|
|
2553
|
+
const entry = {
|
|
2554
|
+
value: empty,
|
|
2555
|
+
issues: null
|
|
2556
|
+
};
|
|
2557
|
+
bucket.set(payload.value, entry);
|
|
2558
|
+
open.push(entry);
|
|
2559
|
+
return empty;
|
|
2560
|
+
},
|
|
2561
|
+
guard(inst) {
|
|
2562
|
+
var _a;
|
|
2563
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2564
|
+
inst._zod.deferred.push(() => {
|
|
2565
|
+
const base = inst._zod.parse;
|
|
2566
|
+
const wrapped = (payload, ctx) => {
|
|
2567
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2568
|
+
return base(payload, ctx);
|
|
2569
|
+
};
|
|
2570
|
+
inst._zod.parse = wrapped;
|
|
2571
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2572
|
+
});
|
|
2573
|
+
},
|
|
2574
|
+
attach(inst) {
|
|
2575
|
+
var _a;
|
|
2576
|
+
let isRecursiveInst;
|
|
2577
|
+
let lastCtx;
|
|
2578
|
+
let lastBucket;
|
|
2579
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2580
|
+
inst._zod.deferred.push(() => {
|
|
2581
|
+
const base = inst._zod.parse;
|
|
2582
|
+
const wrapped = (payload, ctx) => {
|
|
2583
|
+
if (isRecursiveInst === void 0) {
|
|
2584
|
+
isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
|
|
2585
|
+
if (!isRecursiveInst) {
|
|
2586
|
+
inst._zod.parse = base;
|
|
2587
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2588
|
+
return base(payload, ctx);
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
const input = payload.value;
|
|
2592
|
+
if (input === null || typeof input !== "object") return base(payload, ctx);
|
|
2593
|
+
let state = ctx[STATE];
|
|
2594
|
+
if (!state) {
|
|
2595
|
+
state = {
|
|
2596
|
+
buckets: /* @__PURE__ */ new Map(),
|
|
2597
|
+
backEdges: void 0
|
|
2598
|
+
};
|
|
2599
|
+
ctx[STATE] = state;
|
|
2600
|
+
}
|
|
2601
|
+
let bucket;
|
|
2602
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
2603
|
+
else {
|
|
2604
|
+
bucket = bucketFor(state, inst);
|
|
2605
|
+
lastCtx = ctx;
|
|
2606
|
+
lastBucket = bucket;
|
|
2607
|
+
}
|
|
2608
|
+
const hit = bucket.get(input);
|
|
2609
|
+
if (hit) {
|
|
2610
|
+
payload.value = hit.value;
|
|
2611
|
+
if (hit.issues) {
|
|
2612
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2613
|
+
} else {
|
|
2614
|
+
payload.memo = true;
|
|
2615
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
|
|
2616
|
+
state.backEdges.add(hit.value);
|
|
2617
|
+
}
|
|
2618
|
+
return payload;
|
|
2619
|
+
}
|
|
2620
|
+
handoff = bucket;
|
|
2621
|
+
const depth = open.length;
|
|
2622
|
+
const result = base(payload, ctx);
|
|
2623
|
+
handoff = void 0;
|
|
2624
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
2625
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
2626
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2627
|
+
return r;
|
|
2628
|
+
});
|
|
2629
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2630
|
+
return result;
|
|
2631
|
+
};
|
|
2632
|
+
inst._zod.parse = wrapped;
|
|
2633
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
};
|
|
2637
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2638
|
+
function memoizer() {
|
|
2639
|
+
return memo;
|
|
2640
|
+
}
|
|
2641
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2642
|
+
function isBackEdge(ctx, value) {
|
|
2643
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
2644
|
+
return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
|
|
2645
|
+
}
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/locales/en.js
|
|
2648
|
+
const error = () => {
|
|
2649
|
+
const Sizable = {
|
|
2650
|
+
string: {
|
|
2651
|
+
unit: "characters",
|
|
2652
|
+
verb: "to have"
|
|
2653
|
+
},
|
|
2654
|
+
file: {
|
|
2655
|
+
unit: "bytes",
|
|
2656
|
+
verb: "to have"
|
|
2657
|
+
},
|
|
2658
|
+
array: {
|
|
2659
|
+
unit: "items",
|
|
2660
|
+
verb: "to have"
|
|
2661
|
+
},
|
|
2662
|
+
set: {
|
|
2663
|
+
unit: "items",
|
|
2664
|
+
verb: "to have"
|
|
2665
|
+
},
|
|
2666
|
+
map: {
|
|
2667
|
+
unit: "entries",
|
|
2668
|
+
verb: "to have"
|
|
2669
|
+
}
|
|
2093
2670
|
};
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2671
|
+
function getSizing(origin) {
|
|
2672
|
+
return Sizable[origin] ?? null;
|
|
2673
|
+
}
|
|
2674
|
+
const FormatDictionary = {
|
|
2675
|
+
regex: "input",
|
|
2676
|
+
email: "email address",
|
|
2677
|
+
url: "URL",
|
|
2678
|
+
emoji: "emoji",
|
|
2679
|
+
uuid: "UUID",
|
|
2680
|
+
uuidv4: "UUIDv4",
|
|
2681
|
+
uuidv6: "UUIDv6",
|
|
2682
|
+
nanoid: "nanoid",
|
|
2683
|
+
guid: "GUID",
|
|
2684
|
+
cuid: "cuid",
|
|
2685
|
+
cuid2: "cuid2",
|
|
2686
|
+
ulid: "ULID",
|
|
2687
|
+
xid: "XID",
|
|
2688
|
+
ksuid: "KSUID",
|
|
2689
|
+
datetime: "ISO datetime",
|
|
2690
|
+
date: "ISO date",
|
|
2691
|
+
time: "ISO time",
|
|
2692
|
+
duration: "ISO duration",
|
|
2693
|
+
ipv4: "IPv4 address",
|
|
2694
|
+
ipv6: "IPv6 address",
|
|
2695
|
+
mac: "MAC address",
|
|
2696
|
+
cidrv4: "IPv4 range",
|
|
2697
|
+
cidrv6: "IPv6 range",
|
|
2698
|
+
base64: "base64-encoded string",
|
|
2699
|
+
base64url: "base64url-encoded string",
|
|
2700
|
+
json_string: "JSON string",
|
|
2701
|
+
e164: "E.164 number",
|
|
2702
|
+
credit_card: "credit card number",
|
|
2703
|
+
jwt: "JWT",
|
|
2704
|
+
template_literal: "input"
|
|
2099
2705
|
};
|
|
2100
|
-
}
|
|
2101
|
-
function
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
code: "custom",
|
|
2105
|
-
input,
|
|
2106
|
-
inst,
|
|
2107
|
-
path: [...inst._zod.def.path ?? []],
|
|
2108
|
-
continue: !inst._zod.def.abort
|
|
2109
|
-
};
|
|
2110
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2111
|
-
payload.issues.push(issue(_iss));
|
|
2706
|
+
const TypeDictionary = { nan: "NaN" };
|
|
2707
|
+
function getTypeName(type, input) {
|
|
2708
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
2709
|
+
return TypeDictionary[type] ?? type;
|
|
2112
2710
|
}
|
|
2711
|
+
return (issue) => {
|
|
2712
|
+
switch (issue.code) {
|
|
2713
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
2714
|
+
case "invalid_value":
|
|
2715
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
2716
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
2717
|
+
case "too_big": {
|
|
2718
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
2719
|
+
const sizing = getSizing(issue.origin);
|
|
2720
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
2721
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
2722
|
+
}
|
|
2723
|
+
case "too_small": {
|
|
2724
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
2725
|
+
const sizing = getSizing(issue.origin);
|
|
2726
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
2727
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
2728
|
+
}
|
|
2729
|
+
case "invalid_format": {
|
|
2730
|
+
const _issue = issue;
|
|
2731
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
2732
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
2733
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
2734
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
2735
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
2736
|
+
}
|
|
2737
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
2738
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
2739
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
2740
|
+
case "invalid_union":
|
|
2741
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
2742
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
2743
|
+
return "Invalid input";
|
|
2744
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
2745
|
+
default: return `Invalid input`;
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
};
|
|
2749
|
+
function en_default() {
|
|
2750
|
+
return { localeError: error() };
|
|
2113
2751
|
}
|
|
2114
2752
|
//#endregion
|
|
2115
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
2753
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/registries.js
|
|
2116
2754
|
var _a;
|
|
2117
2755
|
var $ZodRegistry = class {
|
|
2118
2756
|
constructor() {
|
|
@@ -2159,7 +2797,7 @@ function registry() {
|
|
|
2159
2797
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2160
2798
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2161
2799
|
//#endregion
|
|
2162
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
2800
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/api.js
|
|
2163
2801
|
// @__NO_SIDE_EFFECTS__
|
|
2164
2802
|
function _string(Class, params) {
|
|
2165
2803
|
return new Class({
|
|
@@ -2644,7 +3282,7 @@ function _superRefine(fn, params) {
|
|
|
2644
3282
|
const _issue = issue$2;
|
|
2645
3283
|
if (_issue.fatal) _issue.continue = false;
|
|
2646
3284
|
_issue.code ?? (_issue.code = "custom");
|
|
2647
|
-
|
|
3285
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
2648
3286
|
_issue.inst ?? (_issue.inst = ch);
|
|
2649
3287
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2650
3288
|
payload.issues.push(issue(_issue));
|
|
@@ -2664,7 +3302,11 @@ function _check(fn, params) {
|
|
|
2664
3302
|
return ch;
|
|
2665
3303
|
}
|
|
2666
3304
|
//#endregion
|
|
2667
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3305
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/to-json-schema.js
|
|
3306
|
+
function assignProps(target, ...sources) {
|
|
3307
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3308
|
+
return target;
|
|
3309
|
+
}
|
|
2668
3310
|
function initializeContext(params) {
|
|
2669
3311
|
let target = params?.target ?? "draft-2020-12";
|
|
2670
3312
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -2678,11 +3320,30 @@ function initializeContext(params) {
|
|
|
2678
3320
|
io: params?.io ?? "output",
|
|
2679
3321
|
counter: 0,
|
|
2680
3322
|
seen: /* @__PURE__ */ new Map(),
|
|
3323
|
+
sharedDefsExtractedFor: void 0,
|
|
3324
|
+
sharedEmitDoneFor: void 0,
|
|
2681
3325
|
cycles: params?.cycles ?? "ref",
|
|
2682
3326
|
reused: params?.reused ?? "inline",
|
|
3327
|
+
intersections: [],
|
|
2683
3328
|
external: params?.external ?? void 0
|
|
2684
3329
|
};
|
|
2685
3330
|
}
|
|
3331
|
+
/**
|
|
3332
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3333
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3334
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3335
|
+
*/
|
|
3336
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3337
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3338
|
+
zodSchema: schema,
|
|
3339
|
+
path: params.path,
|
|
3340
|
+
message
|
|
3341
|
+
}) : ctx.unrepresentable;
|
|
3342
|
+
if (result === "any") return false;
|
|
3343
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3344
|
+
Object.assign(json, result);
|
|
3345
|
+
return true;
|
|
3346
|
+
}
|
|
2686
3347
|
function process$1(schema, ctx, _params = {
|
|
2687
3348
|
path: [],
|
|
2688
3349
|
schemaPath: []
|
|
@@ -2702,6 +3363,8 @@ function process$1(schema, ctx, _params = {
|
|
|
2702
3363
|
path: _params.path
|
|
2703
3364
|
};
|
|
2704
3365
|
ctx.seen.set(schema, result);
|
|
3366
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
3367
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
2705
3368
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2706
3369
|
if (overrideSchema) result.schema = overrideSchema;
|
|
2707
3370
|
else {
|
|
@@ -2725,7 +3388,7 @@ function process$1(schema, ctx, _params = {
|
|
|
2725
3388
|
}
|
|
2726
3389
|
}
|
|
2727
3390
|
const meta = ctx.metadataRegistry.get(schema);
|
|
2728
|
-
if (meta)
|
|
3391
|
+
if (meta) assignProps(result.schema, meta);
|
|
2729
3392
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2730
3393
|
delete result.schema.examples;
|
|
2731
3394
|
delete result.schema.default;
|
|
@@ -2734,9 +3397,13 @@ function process$1(schema, ctx, _params = {
|
|
|
2734
3397
|
delete result.schema._prefault;
|
|
2735
3398
|
return ctx.seen.get(schema).schema;
|
|
2736
3399
|
}
|
|
3400
|
+
function encodeJSONPointerSegment(segment) {
|
|
3401
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3402
|
+
}
|
|
2737
3403
|
function extractDefs(ctx, schema) {
|
|
2738
3404
|
const root = ctx.seen.get(schema);
|
|
2739
3405
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3406
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
2740
3407
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
2741
3408
|
for (const entry of ctx.seen.entries()) {
|
|
2742
3409
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -2756,15 +3423,16 @@ function extractDefs(ctx, schema) {
|
|
|
2756
3423
|
entry[1].defId = id;
|
|
2757
3424
|
return {
|
|
2758
3425
|
defId: id,
|
|
2759
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3426
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
2760
3427
|
};
|
|
2761
3428
|
}
|
|
2762
|
-
|
|
2763
|
-
const defUriPrefix =
|
|
3429
|
+
const uriPrefix = `#`;
|
|
3430
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
3431
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2764
3432
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2765
3433
|
return {
|
|
2766
3434
|
defId,
|
|
2767
|
-
ref: defUriPrefix + defId
|
|
3435
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
2768
3436
|
};
|
|
2769
3437
|
};
|
|
2770
3438
|
const extractToDef = (entry) => {
|
|
@@ -2811,6 +3479,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2811
3479
|
}
|
|
2812
3480
|
}
|
|
2813
3481
|
}
|
|
3482
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3483
|
+
}
|
|
3484
|
+
/** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
|
|
3485
|
+
function compactTypeUnion(schema) {
|
|
3486
|
+
const options = schema.anyOf;
|
|
3487
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3488
|
+
const types = [];
|
|
3489
|
+
for (const option of options) {
|
|
3490
|
+
if (!option || typeof option !== "object") return;
|
|
3491
|
+
compactTypeUnion(option);
|
|
3492
|
+
const keys = Object.keys(option);
|
|
3493
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3494
|
+
const type = option.type;
|
|
3495
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3496
|
+
if (typeof member !== "string") return;
|
|
3497
|
+
if (!types.includes(member)) types.push(member);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
delete schema.anyOf;
|
|
3501
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
3502
|
+
}
|
|
3503
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3504
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3505
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3506
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3507
|
+
"type",
|
|
3508
|
+
"properties",
|
|
3509
|
+
"required",
|
|
3510
|
+
"additionalProperties"
|
|
3511
|
+
]);
|
|
3512
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3513
|
+
/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
|
|
3514
|
+
function undeclaredConstraint(member) {
|
|
3515
|
+
const extra = member.additionalProperties;
|
|
3516
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3517
|
+
return Object.keys(extra).length ? extra : null;
|
|
3518
|
+
}
|
|
3519
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3520
|
+
function foldObjects(members) {
|
|
3521
|
+
const objects = [];
|
|
3522
|
+
for (const member of members) {
|
|
3523
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3524
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3525
|
+
objects.push(member);
|
|
3526
|
+
}
|
|
3527
|
+
const properties = {};
|
|
3528
|
+
const required = /* @__PURE__ */ new Set();
|
|
3529
|
+
for (const object of objects) {
|
|
3530
|
+
for (const key in object.properties) {
|
|
3531
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3532
|
+
const parts = [];
|
|
3533
|
+
for (const other of objects) {
|
|
3534
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3535
|
+
if (part === null || part === void 0) continue;
|
|
3536
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
3537
|
+
}
|
|
3538
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
3539
|
+
}
|
|
3540
|
+
for (const key of object.required ?? []) required.add(key);
|
|
3541
|
+
}
|
|
3542
|
+
const folded = {
|
|
3543
|
+
type: "object",
|
|
3544
|
+
properties
|
|
3545
|
+
};
|
|
3546
|
+
if (required.size) folded.required = [...required];
|
|
3547
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3548
|
+
else {
|
|
3549
|
+
const constraints = [];
|
|
3550
|
+
for (const object of objects) {
|
|
3551
|
+
const constraint = undeclaredConstraint(object);
|
|
3552
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3553
|
+
}
|
|
3554
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3555
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3556
|
+
}
|
|
3557
|
+
return folded;
|
|
3558
|
+
}
|
|
3559
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3560
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3561
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3562
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3563
|
+
* into one object is the encoding that says so on every target.
|
|
3564
|
+
*
|
|
3565
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3566
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3567
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3568
|
+
function foldIntersection(json) {
|
|
3569
|
+
const allOf = json.allOf;
|
|
3570
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3571
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3572
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3573
|
+
let folded = null;
|
|
3574
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
3575
|
+
else {
|
|
3576
|
+
const union = unions[0];
|
|
3577
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3578
|
+
if (Object.keys(union).length !== 1) return;
|
|
3579
|
+
const rest = allOf.filter((m) => m !== union);
|
|
3580
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3581
|
+
if (branches.some((b) => !b)) return;
|
|
3582
|
+
folded = { [keyword]: branches };
|
|
3583
|
+
}
|
|
3584
|
+
if (!folded) return;
|
|
3585
|
+
delete json.allOf;
|
|
3586
|
+
assignProps(json, folded);
|
|
2814
3587
|
}
|
|
2815
3588
|
function finalize(ctx, schema) {
|
|
2816
3589
|
const root = ctx.seen.get(schema);
|
|
@@ -2829,8 +3602,8 @@ function finalize(ctx, schema) {
|
|
|
2829
3602
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2830
3603
|
schema.allOf = schema.allOf ?? [];
|
|
2831
3604
|
schema.allOf.push(refSchema);
|
|
2832
|
-
} else
|
|
2833
|
-
|
|
3605
|
+
} else assignProps(schema, refSchema);
|
|
3606
|
+
assignProps(schema, _cached);
|
|
2834
3607
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
2835
3608
|
if (key === "$ref" || key === "allOf") continue;
|
|
2836
3609
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -2858,7 +3631,21 @@ function finalize(ctx, schema) {
|
|
|
2858
3631
|
path: seen.path ?? []
|
|
2859
3632
|
});
|
|
2860
3633
|
};
|
|
2861
|
-
|
|
3634
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
3635
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3636
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3637
|
+
if (ctx.intersections.length) {
|
|
3638
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
3639
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3640
|
+
const allOf = json?.allOf;
|
|
3641
|
+
if (!Array.isArray(allOf)) continue;
|
|
3642
|
+
const existing = carriers.get(allOf);
|
|
3643
|
+
if (existing) existing.push(json);
|
|
3644
|
+
else carriers.set(allOf, [json]);
|
|
3645
|
+
}
|
|
3646
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
2862
3649
|
const result = {};
|
|
2863
3650
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
2864
3651
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -2869,17 +3656,18 @@ function finalize(ctx, schema) {
|
|
|
2869
3656
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
2870
3657
|
result.$id = ctx.external.uri(id);
|
|
2871
3658
|
}
|
|
2872
|
-
|
|
3659
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
2873
3660
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
2874
3661
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
2875
3662
|
const defs = ctx.external?.defs ?? {};
|
|
2876
|
-
for (const entry of ctx.seen.entries()) {
|
|
3663
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
2877
3664
|
const seen = entry[1];
|
|
2878
3665
|
if (seen.def && seen.defId) {
|
|
2879
3666
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
2880
|
-
defs
|
|
3667
|
+
assignProp(defs, seen.defId, seen.def);
|
|
2881
3668
|
}
|
|
2882
3669
|
}
|
|
3670
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
2883
3671
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
2884
3672
|
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
2885
3673
|
else result.definitions = defs;
|
|
@@ -2911,7 +3699,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
2911
3699
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
2912
3700
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
2913
3701
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
2914
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
3702
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx);
|
|
2915
3703
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
2916
3704
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
2917
3705
|
if (def.type === "pipe") {
|
|
@@ -2959,7 +3747,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
2959
3747
|
return finalize(ctx, schema);
|
|
2960
3748
|
};
|
|
2961
3749
|
//#endregion
|
|
2962
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3750
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/json-schema-processors.js
|
|
2963
3751
|
const formatMap = {
|
|
2964
3752
|
guid: "uuid",
|
|
2965
3753
|
url: "uri",
|
|
@@ -2970,13 +3758,13 @@ const formatMap = {
|
|
|
2970
3758
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
2971
3759
|
const json = _json;
|
|
2972
3760
|
json.type = "string";
|
|
2973
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3761
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
|
|
2974
3762
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
2975
3763
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
2976
3764
|
if (format) {
|
|
2977
3765
|
json.format = formatMap[format] ?? format;
|
|
2978
3766
|
if (json.format === "") delete json.format;
|
|
2979
|
-
if (format === "time") delete json.format;
|
|
3767
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
2980
3768
|
}
|
|
2981
3769
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
2982
3770
|
if (patterns && patterns.size > 0) {
|
|
@@ -2988,7 +3776,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
2988
3776
|
}))];
|
|
2989
3777
|
}
|
|
2990
3778
|
};
|
|
2991
|
-
const numberProcessor = (schema, ctx, _json,
|
|
3779
|
+
const numberProcessor = (schema, ctx, _json, params) => {
|
|
2992
3780
|
const json = _json;
|
|
2993
3781
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
2994
3782
|
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
@@ -3008,10 +3796,13 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
3008
3796
|
json.exclusiveMaximum = true;
|
|
3009
3797
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3010
3798
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
3011
|
-
if (typeof multipleOf === "number")
|
|
3799
|
+
if (typeof multipleOf === "number") {
|
|
3800
|
+
if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
|
|
3801
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
|
|
3802
|
+
}
|
|
3012
3803
|
};
|
|
3013
|
-
const undefinedProcessor = (
|
|
3014
|
-
|
|
3804
|
+
const undefinedProcessor = (schema, ctx, json, params) => {
|
|
3805
|
+
handleUnrepresentable(schema, ctx, json, params, "Undefined cannot be represented in JSON Schema");
|
|
3015
3806
|
};
|
|
3016
3807
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3017
3808
|
json.not = {};
|
|
@@ -3019,15 +3810,19 @@ const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
|
3019
3810
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3020
3811
|
const def = schema._zod.def;
|
|
3021
3812
|
const values = getEnumValues(def.entries);
|
|
3813
|
+
if (values.length === 0) {
|
|
3814
|
+
json.not = {};
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3022
3817
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3023
3818
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3024
3819
|
json.enum = values;
|
|
3025
3820
|
};
|
|
3026
|
-
const customProcessor = (
|
|
3027
|
-
|
|
3821
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
3822
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3028
3823
|
};
|
|
3029
|
-
const transformProcessor = (
|
|
3030
|
-
|
|
3824
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
3825
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3031
3826
|
};
|
|
3032
3827
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3033
3828
|
const json = _json;
|
|
@@ -3041,25 +3836,32 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
3041
3836
|
path: [...params.path, "items"]
|
|
3042
3837
|
});
|
|
3043
3838
|
};
|
|
3839
|
+
function inputOptin(schema) {
|
|
3840
|
+
const def = schema._zod.def;
|
|
3841
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
3842
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
3843
|
+
return schema._zod.optin;
|
|
3844
|
+
}
|
|
3044
3845
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3045
3846
|
const json = _json;
|
|
3046
3847
|
const def = schema._zod.def;
|
|
3848
|
+
const shape = def.shape;
|
|
3849
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3047
3850
|
json.type = "object";
|
|
3048
3851
|
json.properties = {};
|
|
3049
|
-
const shape
|
|
3050
|
-
for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
|
|
3852
|
+
for (const key in shape) assignProp(json.properties, key, process$1(shape[key], ctx, {
|
|
3051
3853
|
...params,
|
|
3052
3854
|
path: [
|
|
3053
3855
|
...params.path,
|
|
3054
3856
|
"properties",
|
|
3055
3857
|
key
|
|
3056
3858
|
]
|
|
3057
|
-
});
|
|
3859
|
+
}));
|
|
3058
3860
|
const allKeys = new Set(Object.keys(shape));
|
|
3059
3861
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3060
|
-
const
|
|
3061
|
-
if (ctx.io === "input") return
|
|
3062
|
-
else return
|
|
3862
|
+
const field = def.shape[key];
|
|
3863
|
+
if (ctx.io === "input") return inputOptin(field) === void 0;
|
|
3864
|
+
else return field._zod.optout === void 0;
|
|
3063
3865
|
}));
|
|
3064
3866
|
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3065
3867
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
@@ -3103,7 +3905,9 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3103
3905
|
]
|
|
3104
3906
|
});
|
|
3105
3907
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3106
|
-
|
|
3908
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3909
|
+
json.allOf = allOf;
|
|
3910
|
+
ctx.intersections.push(allOf);
|
|
3107
3911
|
};
|
|
3108
3912
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3109
3913
|
const def = schema._zod.def;
|
|
@@ -3120,19 +3924,37 @@ const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3120
3924
|
const seen = ctx.seen.get(schema);
|
|
3121
3925
|
seen.ref = def.innerType;
|
|
3122
3926
|
};
|
|
3927
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
3928
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
3929
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
3930
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
3931
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
3932
|
+
let unrepresentable = false;
|
|
3933
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
3934
|
+
if (typeof val !== "bigint") return val;
|
|
3935
|
+
unrepresentable = true;
|
|
3936
|
+
return null;
|
|
3937
|
+
});
|
|
3938
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
3939
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
3940
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
3941
|
+
}
|
|
3123
3942
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3124
3943
|
const def = schema._zod.def;
|
|
3125
3944
|
process$1(def.innerType, ctx, params);
|
|
3126
3945
|
const seen = ctx.seen.get(schema);
|
|
3127
3946
|
seen.ref = def.innerType;
|
|
3128
|
-
|
|
3947
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
3948
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3129
3949
|
};
|
|
3130
3950
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3131
3951
|
const def = schema._zod.def;
|
|
3132
3952
|
process$1(def.innerType, ctx, params);
|
|
3133
3953
|
const seen = ctx.seen.get(schema);
|
|
3134
3954
|
seen.ref = def.innerType;
|
|
3135
|
-
if (ctx.io
|
|
3955
|
+
if (ctx.io !== "input") return;
|
|
3956
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
3957
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3136
3958
|
};
|
|
3137
3959
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
3138
3960
|
const def = schema._zod.def;
|
|
@@ -3143,7 +3965,8 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
3143
3965
|
try {
|
|
3144
3966
|
catchValue = def.catchValue(void 0);
|
|
3145
3967
|
} catch {
|
|
3146
|
-
|
|
3968
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
3969
|
+
return;
|
|
3147
3970
|
}
|
|
3148
3971
|
json.default = catchValue;
|
|
3149
3972
|
};
|
|
@@ -3169,59 +3992,57 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3169
3992
|
seen.ref = def.innerType;
|
|
3170
3993
|
};
|
|
3171
3994
|
//#endregion
|
|
3172
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3173
|
-
const
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
}
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
}
|
|
3194
|
-
|
|
3195
|
-
$ZodISODuration.init(inst, def);
|
|
3196
|
-
ZodStringFormat.init(inst, def);
|
|
3197
|
-
});
|
|
3198
|
-
function duration(params) {
|
|
3199
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3995
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/errors.js
|
|
3996
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
3997
|
+
function _lazyMethod(proto, key, make) {
|
|
3998
|
+
Object.defineProperty(proto, key, {
|
|
3999
|
+
configurable: true,
|
|
4000
|
+
enumerable: false,
|
|
4001
|
+
get() {
|
|
4002
|
+
const value = make(this);
|
|
4003
|
+
Object.defineProperty(this, key, {
|
|
4004
|
+
value,
|
|
4005
|
+
configurable: true,
|
|
4006
|
+
writable: true
|
|
4007
|
+
});
|
|
4008
|
+
return value;
|
|
4009
|
+
},
|
|
4010
|
+
set(value) {
|
|
4011
|
+
Object.defineProperty(this, key, {
|
|
4012
|
+
value,
|
|
4013
|
+
configurable: true,
|
|
4014
|
+
writable: true
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
});
|
|
3200
4018
|
}
|
|
3201
|
-
//#endregion
|
|
3202
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
3203
4019
|
const initializer = (inst, issues) => {
|
|
3204
4020
|
$ZodError.init(inst, issues);
|
|
3205
4021
|
inst.name = "ZodError";
|
|
3206
|
-
Object.
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
4022
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4023
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
4024
|
+
_installedErrorProtos.add(proto);
|
|
4025
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4026
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4027
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
4028
|
+
self.issues.push(issue);
|
|
4029
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4030
|
+
});
|
|
4031
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
4032
|
+
self.issues.push(...issues);
|
|
4033
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4034
|
+
});
|
|
4035
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4036
|
+
configurable: true,
|
|
4037
|
+
enumerable: false,
|
|
4038
|
+
get() {
|
|
4039
|
+
return this.issues.length === 0;
|
|
4040
|
+
}
|
|
3220
4041
|
});
|
|
3221
4042
|
};
|
|
3222
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
4043
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
3223
4044
|
//#endregion
|
|
3224
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
4045
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/parse.js
|
|
3225
4046
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3226
4047
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3227
4048
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -3235,167 +4056,175 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
3235
4056
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3236
4057
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3237
4058
|
//#endregion
|
|
3238
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
if (!
|
|
3244
|
-
installed = /* @__PURE__ */ new Set();
|
|
3245
|
-
_installedGroups.set(proto, installed);
|
|
3246
|
-
}
|
|
3247
|
-
if (installed.has(group)) return;
|
|
3248
|
-
installed.add(group);
|
|
3249
|
-
for (const key in methods) {
|
|
3250
|
-
const fn = methods[key];
|
|
3251
|
-
Object.defineProperty(proto, key, {
|
|
3252
|
-
configurable: true,
|
|
3253
|
-
enumerable: false,
|
|
3254
|
-
get() {
|
|
3255
|
-
const bound = fn.bind(this);
|
|
3256
|
-
Object.defineProperty(this, key, {
|
|
3257
|
-
configurable: true,
|
|
3258
|
-
writable: true,
|
|
3259
|
-
enumerable: true,
|
|
3260
|
-
value: bound
|
|
3261
|
-
});
|
|
3262
|
-
return bound;
|
|
3263
|
-
},
|
|
3264
|
-
set(v) {
|
|
3265
|
-
Object.defineProperty(this, key, {
|
|
3266
|
-
configurable: true,
|
|
3267
|
-
writable: true,
|
|
3268
|
-
enumerable: true,
|
|
3269
|
-
value: v
|
|
3270
|
-
});
|
|
3271
|
-
}
|
|
3272
|
-
});
|
|
3273
|
-
}
|
|
4059
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/schemas.js
|
|
4060
|
+
function _ensureDefaultLocale() {
|
|
4061
|
+
if (!globalConfig.localeError) config(en_default());
|
|
4062
|
+
}
|
|
4063
|
+
function _ensureDefaultMemoizer() {
|
|
4064
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
3274
4065
|
}
|
|
3275
4066
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4067
|
+
_ensureDefaultLocale();
|
|
3276
4068
|
$ZodType.init(inst, def);
|
|
3277
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3278
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3279
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3280
|
-
} });
|
|
3281
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3282
4069
|
inst.def = def;
|
|
3283
4070
|
inst.type = def.type;
|
|
3284
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3285
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3286
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3287
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3288
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3289
|
-
inst.spa = inst.safeParseAsync;
|
|
3290
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3291
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3292
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3293
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3294
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3295
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3296
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3297
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3298
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3299
|
-
check(...chks) {
|
|
3300
|
-
const def = this.def;
|
|
3301
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3302
|
-
check: ch,
|
|
3303
|
-
def: { check: "custom" },
|
|
3304
|
-
onattach: []
|
|
3305
|
-
} } : ch)] }), { parent: true });
|
|
3306
|
-
},
|
|
3307
|
-
with(...chks) {
|
|
3308
|
-
return this.check(...chks);
|
|
3309
|
-
},
|
|
3310
|
-
clone(def, params) {
|
|
3311
|
-
return clone(this, def, params);
|
|
3312
|
-
},
|
|
3313
|
-
brand() {
|
|
3314
|
-
return this;
|
|
3315
|
-
},
|
|
3316
|
-
register(reg, meta) {
|
|
3317
|
-
reg.add(this, meta);
|
|
3318
|
-
return this;
|
|
3319
|
-
},
|
|
3320
|
-
refine(check, params) {
|
|
3321
|
-
return this.check(refine(check, params));
|
|
3322
|
-
},
|
|
3323
|
-
superRefine(refinement, params) {
|
|
3324
|
-
return this.check(superRefine(refinement, params));
|
|
3325
|
-
},
|
|
3326
|
-
overwrite(fn) {
|
|
3327
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3328
|
-
},
|
|
3329
|
-
optional() {
|
|
3330
|
-
return optional(this);
|
|
3331
|
-
},
|
|
3332
|
-
exactOptional() {
|
|
3333
|
-
return exactOptional(this);
|
|
3334
|
-
},
|
|
3335
|
-
nullable() {
|
|
3336
|
-
return nullable(this);
|
|
3337
|
-
},
|
|
3338
|
-
nullish() {
|
|
3339
|
-
return optional(nullable(this));
|
|
3340
|
-
},
|
|
3341
|
-
nonoptional(params) {
|
|
3342
|
-
return nonoptional(this, params);
|
|
3343
|
-
},
|
|
3344
|
-
array() {
|
|
3345
|
-
return array(this);
|
|
3346
|
-
},
|
|
3347
|
-
or(arg) {
|
|
3348
|
-
return union([this, arg]);
|
|
3349
|
-
},
|
|
3350
|
-
and(arg) {
|
|
3351
|
-
return intersection(this, arg);
|
|
3352
|
-
},
|
|
3353
|
-
transform(tx) {
|
|
3354
|
-
return pipe(this, transform(tx));
|
|
3355
|
-
},
|
|
3356
|
-
default(d) {
|
|
3357
|
-
return _default(this, d);
|
|
3358
|
-
},
|
|
3359
|
-
prefault(d) {
|
|
3360
|
-
return prefault(this, d);
|
|
3361
|
-
},
|
|
3362
|
-
catch(params) {
|
|
3363
|
-
return _catch(this, params);
|
|
3364
|
-
},
|
|
3365
|
-
pipe(target) {
|
|
3366
|
-
return pipe(this, target);
|
|
3367
|
-
},
|
|
3368
|
-
readonly() {
|
|
3369
|
-
return readonly(this);
|
|
3370
|
-
},
|
|
3371
|
-
describe(description) {
|
|
3372
|
-
const cl = this.clone();
|
|
3373
|
-
globalRegistry.add(cl, { description });
|
|
3374
|
-
return cl;
|
|
3375
|
-
},
|
|
3376
|
-
meta(...args) {
|
|
3377
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
3378
|
-
const cl = this.clone();
|
|
3379
|
-
globalRegistry.add(cl, args[0]);
|
|
3380
|
-
return cl;
|
|
3381
|
-
},
|
|
3382
|
-
isOptional() {
|
|
3383
|
-
return this.safeParse(void 0).success;
|
|
3384
|
-
},
|
|
3385
|
-
isNullable() {
|
|
3386
|
-
return this.safeParse(null).success;
|
|
3387
|
-
},
|
|
3388
|
-
apply(fn) {
|
|
3389
|
-
return fn(this);
|
|
3390
|
-
}
|
|
3391
|
-
});
|
|
3392
|
-
Object.defineProperty(inst, "description", {
|
|
3393
|
-
get() {
|
|
3394
|
-
return globalRegistry.get(inst)?.description;
|
|
3395
|
-
},
|
|
3396
|
-
configurable: true
|
|
3397
|
-
});
|
|
3398
4071
|
return inst;
|
|
4072
|
+
}, {
|
|
4073
|
+
check(...chks) {
|
|
4074
|
+
const def = this.def;
|
|
4075
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4076
|
+
check: ch,
|
|
4077
|
+
def: { check: "custom" },
|
|
4078
|
+
onattach: []
|
|
4079
|
+
} } : ch)] }), { parent: true });
|
|
4080
|
+
},
|
|
4081
|
+
with(...chks) {
|
|
4082
|
+
return this.check(...chks);
|
|
4083
|
+
},
|
|
4084
|
+
clone(def, params) {
|
|
4085
|
+
return clone(this, def, params);
|
|
4086
|
+
},
|
|
4087
|
+
brand() {
|
|
4088
|
+
return this;
|
|
4089
|
+
},
|
|
4090
|
+
register(reg, meta) {
|
|
4091
|
+
reg.add(this, meta);
|
|
4092
|
+
return this;
|
|
4093
|
+
},
|
|
4094
|
+
refine(check, params) {
|
|
4095
|
+
return this.check(refine(check, params));
|
|
4096
|
+
},
|
|
4097
|
+
superRefine(refinement, params) {
|
|
4098
|
+
return this.check(superRefine(refinement, params));
|
|
4099
|
+
},
|
|
4100
|
+
overwrite(fn) {
|
|
4101
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4102
|
+
},
|
|
4103
|
+
optional() {
|
|
4104
|
+
return optional(this);
|
|
4105
|
+
},
|
|
4106
|
+
exactOptional() {
|
|
4107
|
+
return exactOptional(this);
|
|
4108
|
+
},
|
|
4109
|
+
nullable() {
|
|
4110
|
+
return nullable(this);
|
|
4111
|
+
},
|
|
4112
|
+
nullish() {
|
|
4113
|
+
return optional(nullable(this));
|
|
4114
|
+
},
|
|
4115
|
+
nonoptional(params) {
|
|
4116
|
+
return nonoptional(this, params);
|
|
4117
|
+
},
|
|
4118
|
+
array() {
|
|
4119
|
+
return array(this);
|
|
4120
|
+
},
|
|
4121
|
+
or(arg) {
|
|
4122
|
+
return union([this, arg]);
|
|
4123
|
+
},
|
|
4124
|
+
and(arg) {
|
|
4125
|
+
return intersection(this, arg);
|
|
4126
|
+
},
|
|
4127
|
+
transform(tx) {
|
|
4128
|
+
return pipe(this, transform(tx));
|
|
4129
|
+
},
|
|
4130
|
+
default(d) {
|
|
4131
|
+
return _default(this, d);
|
|
4132
|
+
},
|
|
4133
|
+
prefault(d) {
|
|
4134
|
+
return prefault(this, d);
|
|
4135
|
+
},
|
|
4136
|
+
catch(params) {
|
|
4137
|
+
return _catch(this, params);
|
|
4138
|
+
},
|
|
4139
|
+
pipe(target) {
|
|
4140
|
+
return pipe(this, target);
|
|
4141
|
+
},
|
|
4142
|
+
readonly() {
|
|
4143
|
+
return readonly(this);
|
|
4144
|
+
},
|
|
4145
|
+
describe(description) {
|
|
4146
|
+
const cl = this.clone();
|
|
4147
|
+
globalRegistry.add(cl, { description });
|
|
4148
|
+
return cl;
|
|
4149
|
+
},
|
|
4150
|
+
meta(...args) {
|
|
4151
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
4152
|
+
const cl = this.clone();
|
|
4153
|
+
globalRegistry.add(cl, args[0]);
|
|
4154
|
+
return cl;
|
|
4155
|
+
},
|
|
4156
|
+
isOptional() {
|
|
4157
|
+
return this.safeParse(void 0).success;
|
|
4158
|
+
},
|
|
4159
|
+
isNullable() {
|
|
4160
|
+
return this.safeParse(null).success;
|
|
4161
|
+
},
|
|
4162
|
+
apply(fn, ...args) {
|
|
4163
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4164
|
+
},
|
|
4165
|
+
get "~standard"() {
|
|
4166
|
+
return hide(this, "~standard", {
|
|
4167
|
+
...standardProps(this),
|
|
4168
|
+
jsonSchema: {
|
|
4169
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4170
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
4171
|
+
}
|
|
4172
|
+
});
|
|
4173
|
+
},
|
|
4174
|
+
set "~standard"(value) {
|
|
4175
|
+
own(this, "~standard", value);
|
|
4176
|
+
},
|
|
4177
|
+
parse: function _parse(data, params) {
|
|
4178
|
+
return parse(this, data, params, { callee: _parse });
|
|
4179
|
+
},
|
|
4180
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
4181
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4182
|
+
},
|
|
4183
|
+
safeParse(data, params) {
|
|
4184
|
+
return safeParse(this, data, params);
|
|
4185
|
+
},
|
|
4186
|
+
async safeParseAsync(data, params) {
|
|
4187
|
+
return safeParseAsync(this, data, params);
|
|
4188
|
+
},
|
|
4189
|
+
get spa() {
|
|
4190
|
+
return this?.safeParseAsync;
|
|
4191
|
+
},
|
|
4192
|
+
set spa(value) {
|
|
4193
|
+
own(this, "spa", value);
|
|
4194
|
+
},
|
|
4195
|
+
encode: function _encode(data, params) {
|
|
4196
|
+
return encode(this, data, params, { callee: _encode });
|
|
4197
|
+
},
|
|
4198
|
+
decode: function _decode(data, params) {
|
|
4199
|
+
return decode(this, data, params, { callee: _decode });
|
|
4200
|
+
},
|
|
4201
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
4202
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4203
|
+
},
|
|
4204
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
4205
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4206
|
+
},
|
|
4207
|
+
safeEncode(data, params) {
|
|
4208
|
+
return safeEncode(this, data, params);
|
|
4209
|
+
},
|
|
4210
|
+
safeDecode(data, params) {
|
|
4211
|
+
return safeDecode(this, data, params);
|
|
4212
|
+
},
|
|
4213
|
+
async safeEncodeAsync(data, params) {
|
|
4214
|
+
return safeEncodeAsync(this, data, params);
|
|
4215
|
+
},
|
|
4216
|
+
async safeDecodeAsync(data, params) {
|
|
4217
|
+
return safeDecodeAsync(this, data, params);
|
|
4218
|
+
},
|
|
4219
|
+
toJSONSchema(params) {
|
|
4220
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
4221
|
+
},
|
|
4222
|
+
get description() {
|
|
4223
|
+
return globalRegistry.get(this)?.description;
|
|
4224
|
+
},
|
|
4225
|
+
get _def() {
|
|
4226
|
+
return this._zod.def;
|
|
4227
|
+
}
|
|
3399
4228
|
});
|
|
3400
4229
|
/** @internal */
|
|
3401
4230
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
@@ -3406,84 +4235,135 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
3406
4235
|
inst.format = bag.format ?? null;
|
|
3407
4236
|
inst.minLength = bag.minimum ?? null;
|
|
3408
4237
|
inst.maxLength = bag.maximum ?? null;
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
});
|
|
4238
|
+
}, {
|
|
4239
|
+
regex(...args) {
|
|
4240
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4241
|
+
},
|
|
4242
|
+
includes(...args) {
|
|
4243
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4244
|
+
},
|
|
4245
|
+
startsWith(...args) {
|
|
4246
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4247
|
+
},
|
|
4248
|
+
endsWith(...args) {
|
|
4249
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4250
|
+
},
|
|
4251
|
+
min(...args) {
|
|
4252
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4253
|
+
},
|
|
4254
|
+
max(...args) {
|
|
4255
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4256
|
+
},
|
|
4257
|
+
length(...args) {
|
|
4258
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
4259
|
+
},
|
|
4260
|
+
nonempty(...args) {
|
|
4261
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4262
|
+
},
|
|
4263
|
+
lowercase(params) {
|
|
4264
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4265
|
+
},
|
|
4266
|
+
uppercase(params) {
|
|
4267
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4268
|
+
},
|
|
4269
|
+
trim() {
|
|
4270
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
4271
|
+
},
|
|
4272
|
+
normalize(...args) {
|
|
4273
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4274
|
+
},
|
|
4275
|
+
toLowerCase() {
|
|
4276
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4277
|
+
},
|
|
4278
|
+
toUpperCase() {
|
|
4279
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4280
|
+
},
|
|
4281
|
+
slugify() {
|
|
4282
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
4283
|
+
}
|
|
3456
4284
|
});
|
|
3457
4285
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3458
4286
|
$ZodString.init(inst, def);
|
|
3459
4287
|
_ZodString.init(inst, def);
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
4288
|
+
}, {
|
|
4289
|
+
email(params) {
|
|
4290
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4291
|
+
},
|
|
4292
|
+
url(params) {
|
|
4293
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4294
|
+
},
|
|
4295
|
+
jwt(params) {
|
|
4296
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4297
|
+
},
|
|
4298
|
+
emoji(params) {
|
|
4299
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4300
|
+
},
|
|
4301
|
+
guid(params) {
|
|
4302
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4303
|
+
},
|
|
4304
|
+
uuid(params) {
|
|
4305
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4306
|
+
},
|
|
4307
|
+
uuidv4(params) {
|
|
4308
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4309
|
+
},
|
|
4310
|
+
uuidv6(params) {
|
|
4311
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4312
|
+
},
|
|
4313
|
+
uuidv7(params) {
|
|
4314
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4315
|
+
},
|
|
4316
|
+
nanoid(params) {
|
|
4317
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4318
|
+
},
|
|
4319
|
+
cuid(params) {
|
|
4320
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4321
|
+
},
|
|
4322
|
+
cuid2(params) {
|
|
4323
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4324
|
+
},
|
|
4325
|
+
ulid(params) {
|
|
4326
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4327
|
+
},
|
|
4328
|
+
base64(params) {
|
|
4329
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4330
|
+
},
|
|
4331
|
+
base64url(params) {
|
|
4332
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4333
|
+
},
|
|
4334
|
+
xid(params) {
|
|
4335
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4336
|
+
},
|
|
4337
|
+
ksuid(params) {
|
|
4338
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4339
|
+
},
|
|
4340
|
+
ipv4(params) {
|
|
4341
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4342
|
+
},
|
|
4343
|
+
ipv6(params) {
|
|
4344
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4345
|
+
},
|
|
4346
|
+
cidrv4(params) {
|
|
4347
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4348
|
+
},
|
|
4349
|
+
cidrv6(params) {
|
|
4350
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4351
|
+
},
|
|
4352
|
+
e164(params) {
|
|
4353
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4354
|
+
},
|
|
4355
|
+
datetime(params) {
|
|
4356
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4357
|
+
},
|
|
4358
|
+
date(params) {
|
|
4359
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4360
|
+
},
|
|
4361
|
+
time(params) {
|
|
4362
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4363
|
+
},
|
|
4364
|
+
duration(params) {
|
|
4365
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4366
|
+
}
|
|
3487
4367
|
});
|
|
3488
4368
|
function string(params) {
|
|
3489
4369
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -3492,6 +4372,22 @@ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def
|
|
|
3492
4372
|
$ZodStringFormat.init(inst, def);
|
|
3493
4373
|
_ZodString.init(inst, def);
|
|
3494
4374
|
});
|
|
4375
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4376
|
+
$ZodISODateTime.init(inst, def);
|
|
4377
|
+
ZodStringFormat.init(inst, def);
|
|
4378
|
+
});
|
|
4379
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4380
|
+
$ZodISODate.init(inst, def);
|
|
4381
|
+
ZodStringFormat.init(inst, def);
|
|
4382
|
+
});
|
|
4383
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4384
|
+
$ZodISOTime.init(inst, def);
|
|
4385
|
+
ZodStringFormat.init(inst, def);
|
|
4386
|
+
});
|
|
4387
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4388
|
+
$ZodISODuration.init(inst, def);
|
|
4389
|
+
ZodStringFormat.init(inst, def);
|
|
4390
|
+
});
|
|
3495
4391
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3496
4392
|
$ZodEmail.init(inst, def);
|
|
3497
4393
|
ZodStringFormat.init(inst, def);
|
|
@@ -3580,59 +4476,58 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
3580
4476
|
$ZodNumber.init(inst, def);
|
|
3581
4477
|
ZodType.init(inst, def);
|
|
3582
4478
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3583
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
3584
|
-
gt(value, params) {
|
|
3585
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3586
|
-
},
|
|
3587
|
-
gte(value, params) {
|
|
3588
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3589
|
-
},
|
|
3590
|
-
min(value, params) {
|
|
3591
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3592
|
-
},
|
|
3593
|
-
lt(value, params) {
|
|
3594
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3595
|
-
},
|
|
3596
|
-
lte(value, params) {
|
|
3597
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3598
|
-
},
|
|
3599
|
-
max(value, params) {
|
|
3600
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3601
|
-
},
|
|
3602
|
-
int(params) {
|
|
3603
|
-
return this.check(int(params));
|
|
3604
|
-
},
|
|
3605
|
-
safe(params) {
|
|
3606
|
-
return this.check(int(params));
|
|
3607
|
-
},
|
|
3608
|
-
positive(params) {
|
|
3609
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3610
|
-
},
|
|
3611
|
-
nonnegative(params) {
|
|
3612
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3613
|
-
},
|
|
3614
|
-
negative(params) {
|
|
3615
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3616
|
-
},
|
|
3617
|
-
nonpositive(params) {
|
|
3618
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3619
|
-
},
|
|
3620
|
-
multipleOf(value, params) {
|
|
3621
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3622
|
-
},
|
|
3623
|
-
step(value, params) {
|
|
3624
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3625
|
-
},
|
|
3626
|
-
finite() {
|
|
3627
|
-
return this;
|
|
3628
|
-
}
|
|
3629
|
-
});
|
|
3630
4479
|
const bag = inst._zod.bag;
|
|
3631
4480
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3632
4481
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3633
4482
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3634
4483
|
inst.isFinite = true;
|
|
3635
4484
|
inst.format = bag.format ?? null;
|
|
4485
|
+
}, {
|
|
4486
|
+
gt(value, params) {
|
|
4487
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
4488
|
+
},
|
|
4489
|
+
gte(value, params) {
|
|
4490
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4491
|
+
},
|
|
4492
|
+
min(value, params) {
|
|
4493
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4494
|
+
},
|
|
4495
|
+
lt(value, params) {
|
|
4496
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
4497
|
+
},
|
|
4498
|
+
lte(value, params) {
|
|
4499
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4500
|
+
},
|
|
4501
|
+
max(value, params) {
|
|
4502
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4503
|
+
},
|
|
4504
|
+
int(params) {
|
|
4505
|
+
return this.check(int(params));
|
|
4506
|
+
},
|
|
4507
|
+
safe(params) {
|
|
4508
|
+
return this.check(int(params));
|
|
4509
|
+
},
|
|
4510
|
+
positive(params) {
|
|
4511
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
4512
|
+
},
|
|
4513
|
+
nonnegative(params) {
|
|
4514
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
4515
|
+
},
|
|
4516
|
+
negative(params) {
|
|
4517
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
4518
|
+
},
|
|
4519
|
+
nonpositive(params) {
|
|
4520
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
4521
|
+
},
|
|
4522
|
+
multipleOf(value, params) {
|
|
4523
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4524
|
+
},
|
|
4525
|
+
step(value, params) {
|
|
4526
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4527
|
+
},
|
|
4528
|
+
finite() {
|
|
4529
|
+
return this;
|
|
4530
|
+
}
|
|
3636
4531
|
});
|
|
3637
4532
|
function number(params) {
|
|
3638
4533
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
@@ -3669,94 +4564,95 @@ function never(params) {
|
|
|
3669
4564
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3670
4565
|
}
|
|
3671
4566
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
4567
|
+
_ensureDefaultMemoizer();
|
|
3672
4568
|
$ZodArray.init(inst, def);
|
|
3673
4569
|
ZodType.init(inst, def);
|
|
3674
4570
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3675
4571
|
inst.element = def.element;
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
});
|
|
4572
|
+
}, {
|
|
4573
|
+
min(n, params) {
|
|
4574
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
4575
|
+
},
|
|
4576
|
+
nonempty(params) {
|
|
4577
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
4578
|
+
},
|
|
4579
|
+
max(n, params) {
|
|
4580
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
4581
|
+
},
|
|
4582
|
+
length(n, params) {
|
|
4583
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
4584
|
+
},
|
|
4585
|
+
unwrap() {
|
|
4586
|
+
return this.element;
|
|
4587
|
+
}
|
|
3693
4588
|
});
|
|
3694
4589
|
function array(element, params) {
|
|
3695
4590
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3696
4591
|
}
|
|
3697
4592
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
4593
|
+
_ensureDefaultMemoizer();
|
|
3698
4594
|
$ZodObjectJIT.init(inst, def);
|
|
3699
4595
|
ZodType.init(inst, def);
|
|
3700
4596
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
}
|
|
4597
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
4598
|
+
}, {
|
|
4599
|
+
keyof() {
|
|
4600
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
4601
|
+
},
|
|
4602
|
+
catchall(catchall) {
|
|
4603
|
+
return this.clone({
|
|
4604
|
+
...this._zod.def,
|
|
4605
|
+
catchall
|
|
4606
|
+
});
|
|
4607
|
+
},
|
|
4608
|
+
passthrough() {
|
|
4609
|
+
return this.clone({
|
|
4610
|
+
...this._zod.def,
|
|
4611
|
+
catchall: unknown()
|
|
4612
|
+
});
|
|
4613
|
+
},
|
|
4614
|
+
loose() {
|
|
4615
|
+
return this.clone({
|
|
4616
|
+
...this._zod.def,
|
|
4617
|
+
catchall: unknown()
|
|
4618
|
+
});
|
|
4619
|
+
},
|
|
4620
|
+
strict() {
|
|
4621
|
+
return this.clone({
|
|
4622
|
+
...this._zod.def,
|
|
4623
|
+
catchall: never()
|
|
4624
|
+
});
|
|
4625
|
+
},
|
|
4626
|
+
strip() {
|
|
4627
|
+
return this.clone({
|
|
4628
|
+
...this._zod.def,
|
|
4629
|
+
catchall: void 0
|
|
4630
|
+
});
|
|
4631
|
+
},
|
|
4632
|
+
extend(incoming) {
|
|
4633
|
+
return extend(this, incoming);
|
|
4634
|
+
},
|
|
4635
|
+
safeExtend(incoming) {
|
|
4636
|
+
return safeExtend(this, incoming);
|
|
4637
|
+
},
|
|
4638
|
+
merge(other) {
|
|
4639
|
+
return merge(this, other);
|
|
4640
|
+
},
|
|
4641
|
+
pick(mask) {
|
|
4642
|
+
return pick(this, mask);
|
|
4643
|
+
},
|
|
4644
|
+
omit(mask) {
|
|
4645
|
+
return omit(this, mask);
|
|
4646
|
+
},
|
|
4647
|
+
partial(...args) {
|
|
4648
|
+
return partial(ZodOptional, this, args[0]);
|
|
4649
|
+
},
|
|
4650
|
+
exactPartial(...args) {
|
|
4651
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
4652
|
+
},
|
|
4653
|
+
required(...args) {
|
|
4654
|
+
return required(ZodNonOptional, this, args[0]);
|
|
4655
|
+
}
|
|
3760
4656
|
});
|
|
3761
4657
|
function object(shape, params) {
|
|
3762
4658
|
const def = {
|
|
@@ -3830,6 +4726,7 @@ function _enum(values, params) {
|
|
|
3830
4726
|
});
|
|
3831
4727
|
}
|
|
3832
4728
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
4729
|
+
_ensureDefaultMemoizer();
|
|
3833
4730
|
$ZodTransform.init(inst, def);
|
|
3834
4731
|
ZodType.init(inst, def);
|
|
3835
4732
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -3841,7 +4738,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3841
4738
|
const _issue = issue$1;
|
|
3842
4739
|
if (_issue.fatal) _issue.continue = false;
|
|
3843
4740
|
_issue.code ?? (_issue.code = "custom");
|
|
3844
|
-
|
|
4741
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
3845
4742
|
_issue.inst ?? (_issue.inst = inst);
|
|
3846
4743
|
payload.issues.push(issue(_issue));
|
|
3847
4744
|
}
|
|
@@ -3849,11 +4746,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3849
4746
|
const output = def.transform(payload.value, payload);
|
|
3850
4747
|
if (output instanceof Promise) return output.then((output) => {
|
|
3851
4748
|
payload.value = output;
|
|
3852
|
-
payload.fallback = true;
|
|
3853
4749
|
return payload;
|
|
3854
4750
|
});
|
|
3855
4751
|
payload.value = output;
|
|
3856
|
-
payload.fallback = true;
|
|
3857
4752
|
return payload;
|
|
3858
4753
|
};
|
|
3859
4754
|
});
|
|
@@ -3954,7 +4849,7 @@ function _catch(innerType, catchValue) {
|
|
|
3954
4849
|
return new ZodCatch({
|
|
3955
4850
|
type: "catch",
|
|
3956
4851
|
innerType,
|
|
3957
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
4852
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
3958
4853
|
});
|
|
3959
4854
|
}
|
|
3960
4855
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -3995,6 +4890,11 @@ function superRefine(fn, params) {
|
|
|
3995
4890
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
3996
4891
|
}
|
|
3997
4892
|
//#endregion
|
|
4893
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/iso.js
|
|
4894
|
+
function datetime(params) {
|
|
4895
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
4896
|
+
}
|
|
4897
|
+
//#endregion
|
|
3998
4898
|
//#region src/errors.ts
|
|
3999
4899
|
/**
|
|
4000
4900
|
* Command sender error definitions.
|