@alienplatform/sdk 3.3.18 → 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/dist.js +1833 -900
- package/package.json +5 -5
package/dist/dist.js
CHANGED
|
@@ -170,70 +170,14 @@ function setOnTaskRegistered(hook) {
|
|
|
170
170
|
registry$1().onTaskRegistered = hook;
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
174
|
-
var _a$1;
|
|
175
|
-
function $constructor(name, initializer, params) {
|
|
176
|
-
function init(inst, def) {
|
|
177
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
178
|
-
value: {
|
|
179
|
-
def,
|
|
180
|
-
constr: _,
|
|
181
|
-
traits: /* @__PURE__ */ new Set()
|
|
182
|
-
},
|
|
183
|
-
enumerable: false
|
|
184
|
-
});
|
|
185
|
-
if (inst._zod.traits.has(name)) return;
|
|
186
|
-
inst._zod.traits.add(name);
|
|
187
|
-
initializer(inst, def);
|
|
188
|
-
const proto = _.prototype;
|
|
189
|
-
const keys = Object.keys(proto);
|
|
190
|
-
for (let i = 0; i < keys.length; i++) {
|
|
191
|
-
const k = keys[i];
|
|
192
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const Parent = params?.Parent ?? Object;
|
|
196
|
-
class Definition extends Parent {}
|
|
197
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
198
|
-
function _(def) {
|
|
199
|
-
var _a;
|
|
200
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
201
|
-
init(inst, def);
|
|
202
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
203
|
-
for (const fn of inst._zod.deferred) fn();
|
|
204
|
-
return inst;
|
|
205
|
-
}
|
|
206
|
-
Object.defineProperty(_, "init", { value: init });
|
|
207
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
208
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
209
|
-
return inst?._zod?.traits?.has(name);
|
|
210
|
-
} });
|
|
211
|
-
Object.defineProperty(_, "name", { value: name });
|
|
212
|
-
return _;
|
|
213
|
-
}
|
|
214
|
-
var $ZodAsyncError = class extends Error {
|
|
215
|
-
constructor() {
|
|
216
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
var $ZodEncodeError = class extends Error {
|
|
220
|
-
constructor(name) {
|
|
221
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
222
|
-
this.name = "ZodEncodeError";
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
226
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
227
|
-
function config(newConfig) {
|
|
228
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
229
|
-
return globalConfig;
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
173
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/util.js
|
|
233
174
|
function getEnumValues(entries) {
|
|
234
175
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
235
176
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
236
177
|
}
|
|
178
|
+
function joinValues(array, separator = "|") {
|
|
179
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
180
|
+
}
|
|
237
181
|
function jsonStringifyReplacer(_, value) {
|
|
238
182
|
if (typeof value === "bigint") return value.toString();
|
|
239
183
|
return value;
|
|
@@ -258,7 +202,7 @@ function cleanRegex(source) {
|
|
|
258
202
|
function floatSafeRemainder(val, step) {
|
|
259
203
|
const ratio = val / step;
|
|
260
204
|
const roundedRatio = Math.round(ratio);
|
|
261
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
205
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
262
206
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
263
207
|
return ratio - roundedRatio;
|
|
264
208
|
}
|
|
@@ -361,18 +305,23 @@ function normalizeParams(_params) {
|
|
|
361
305
|
};
|
|
362
306
|
return params;
|
|
363
307
|
}
|
|
308
|
+
function stringifyPrimitive(value) {
|
|
309
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
310
|
+
if (typeof value === "string") return `"${value}"`;
|
|
311
|
+
return `${value}`;
|
|
312
|
+
}
|
|
364
313
|
function optionalKeys(shape) {
|
|
365
314
|
return Object.keys(shape).filter((k) => {
|
|
366
|
-
return shape[k]._zod.optin
|
|
315
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
367
316
|
});
|
|
368
317
|
}
|
|
369
|
-
const NUMBER_FORMAT_RANGES = {
|
|
318
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
370
319
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
371
320
|
int32: [-2147483648, 2147483647],
|
|
372
321
|
uint32: [0, 4294967295],
|
|
373
322
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
374
323
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
375
|
-
};
|
|
324
|
+
}))();
|
|
376
325
|
function pick(schema, mask) {
|
|
377
326
|
const currDef = schema._zod.def;
|
|
378
327
|
const checks = currDef.checks;
|
|
@@ -380,10 +329,10 @@ function pick(schema, mask) {
|
|
|
380
329
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
381
330
|
get shape() {
|
|
382
331
|
const newShape = {};
|
|
383
|
-
for (const key
|
|
384
|
-
if (!(
|
|
332
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
333
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
385
334
|
if (!mask[key]) continue;
|
|
386
|
-
newShape
|
|
335
|
+
assignProp(newShape, key, currDef.shape[key]);
|
|
387
336
|
}
|
|
388
337
|
assignProp(this, "shape", newShape);
|
|
389
338
|
return newShape;
|
|
@@ -398,8 +347,8 @@ function omit(schema, mask) {
|
|
|
398
347
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
399
348
|
get shape() {
|
|
400
349
|
const newShape = { ...schema._zod.def.shape };
|
|
401
|
-
for (const key
|
|
402
|
-
if (!(
|
|
350
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
351
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
403
352
|
if (!mask[key]) continue;
|
|
404
353
|
delete newShape[key];
|
|
405
354
|
}
|
|
@@ -414,7 +363,7 @@ function extend(schema, shape) {
|
|
|
414
363
|
const checks = schema._zod.def.checks;
|
|
415
364
|
if (checks && checks.length > 0) {
|
|
416
365
|
const existingShape = schema._zod.def.shape;
|
|
417
|
-
for (const key
|
|
366
|
+
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.");
|
|
418
367
|
}
|
|
419
368
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
420
369
|
const _shape = {
|
|
@@ -437,6 +386,7 @@ function safeExtend(schema, shape) {
|
|
|
437
386
|
} }));
|
|
438
387
|
}
|
|
439
388
|
function merge(a, b) {
|
|
389
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
440
390
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
441
391
|
return clone(a, mergeDefs(a._zod.def, {
|
|
442
392
|
get shape() {
|
|
@@ -453,22 +403,22 @@ function merge(a, b) {
|
|
|
453
403
|
checks: b._zod.def.checks ?? []
|
|
454
404
|
}));
|
|
455
405
|
}
|
|
456
|
-
function partial(Class, schema, mask) {
|
|
406
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
457
407
|
const checks = schema._zod.def.checks;
|
|
458
|
-
if (checks && checks.length > 0) throw new Error(
|
|
408
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
459
409
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
460
410
|
get shape() {
|
|
461
411
|
const oldShape = schema._zod.def.shape;
|
|
462
412
|
const shape = { ...oldShape };
|
|
463
|
-
if (mask) for (const key
|
|
464
|
-
if (!(key
|
|
413
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
414
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
465
415
|
if (!mask[key]) continue;
|
|
466
416
|
shape[key] = Class ? new Class({
|
|
467
417
|
type: "optional",
|
|
468
418
|
innerType: oldShape[key]
|
|
469
419
|
}) : oldShape[key];
|
|
470
420
|
}
|
|
471
|
-
else for (const key
|
|
421
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
472
422
|
type: "optional",
|
|
473
423
|
innerType: oldShape[key]
|
|
474
424
|
}) : oldShape[key];
|
|
@@ -482,15 +432,15 @@ function required(Class, schema, mask) {
|
|
|
482
432
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
483
433
|
const oldShape = schema._zod.def.shape;
|
|
484
434
|
const shape = { ...oldShape };
|
|
485
|
-
if (mask) for (const key
|
|
486
|
-
if (!(key
|
|
435
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
436
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
487
437
|
if (!mask[key]) continue;
|
|
488
438
|
shape[key] = new Class({
|
|
489
439
|
type: "nonoptional",
|
|
490
440
|
innerType: oldShape[key]
|
|
491
441
|
});
|
|
492
442
|
}
|
|
493
|
-
else for (const key
|
|
443
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
494
444
|
type: "nonoptional",
|
|
495
445
|
innerType: oldShape[key]
|
|
496
446
|
});
|
|
@@ -519,19 +469,54 @@ function prefixIssues(path, issues) {
|
|
|
519
469
|
function unwrapMessage(message) {
|
|
520
470
|
return typeof message === "string" ? message : message?.message;
|
|
521
471
|
}
|
|
472
|
+
function attachSchema(issues, start, inst) {
|
|
473
|
+
var _a;
|
|
474
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
475
|
+
}
|
|
522
476
|
function finalizeIssue(iss, ctx, config) {
|
|
523
|
-
|
|
524
|
-
const
|
|
477
|
+
var _a;
|
|
478
|
+
const traits = iss.inst?._zod?.traits;
|
|
479
|
+
if (traits?.has("$ZodType")) {
|
|
480
|
+
if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
481
|
+
else iss.schema = iss.inst;
|
|
482
|
+
}
|
|
483
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
484
|
+
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";
|
|
485
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
525
486
|
rest.path ?? (rest.path = []);
|
|
526
487
|
rest.message = message;
|
|
527
488
|
if (ctx?.reportInput) rest.input = _input;
|
|
528
489
|
return rest;
|
|
529
490
|
}
|
|
491
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
492
|
+
function codePointLength(str) {
|
|
493
|
+
const units = str.length;
|
|
494
|
+
if (!highSurrogate.test(str)) return units;
|
|
495
|
+
let count = units;
|
|
496
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
497
|
+
count--;
|
|
498
|
+
i++;
|
|
499
|
+
}
|
|
500
|
+
return count;
|
|
501
|
+
}
|
|
530
502
|
function getLengthableOrigin(input) {
|
|
531
503
|
if (Array.isArray(input)) return "array";
|
|
532
504
|
if (typeof input === "string") return "string";
|
|
533
505
|
return "unknown";
|
|
534
506
|
}
|
|
507
|
+
function parsedType(data) {
|
|
508
|
+
const t = typeof data;
|
|
509
|
+
switch (t) {
|
|
510
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
511
|
+
case "object": {
|
|
512
|
+
if (data === null) return "null";
|
|
513
|
+
if (Array.isArray(data)) return "array";
|
|
514
|
+
const obj = data;
|
|
515
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return t;
|
|
519
|
+
}
|
|
535
520
|
function issue(...args) {
|
|
536
521
|
const [iss, input, inst] = args;
|
|
537
522
|
if (typeof iss === "string") return {
|
|
@@ -542,33 +527,330 @@ function issue(...args) {
|
|
|
542
527
|
};
|
|
543
528
|
return { ...iss };
|
|
544
529
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
530
|
+
/**
|
|
531
|
+
* 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.
|
|
532
|
+
*
|
|
533
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
534
|
+
*/
|
|
535
|
+
function members(proto, table) {
|
|
536
|
+
for (const key in table) {
|
|
537
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
538
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
539
|
+
...desc,
|
|
540
|
+
enumerable: false
|
|
541
|
+
});
|
|
542
|
+
else defineBound(proto, key, desc.value);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
546
|
+
function own(inst, key, value, enumerable = true) {
|
|
547
|
+
Object.defineProperty(inst, key, {
|
|
548
|
+
configurable: true,
|
|
549
|
+
writable: true,
|
|
550
|
+
enumerable,
|
|
551
|
+
value
|
|
552
552
|
});
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
return value;
|
|
554
|
+
}
|
|
555
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
556
|
+
function hide(inst, key, value) {
|
|
557
|
+
return own(inst, key, value, false);
|
|
558
|
+
}
|
|
559
|
+
function defineBound(proto, key, fn) {
|
|
560
|
+
Object.defineProperty(proto, key, {
|
|
561
|
+
configurable: true,
|
|
562
|
+
get() {
|
|
563
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
564
|
+
},
|
|
565
|
+
set(value) {
|
|
566
|
+
own(this, key, value);
|
|
567
|
+
}
|
|
556
568
|
});
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
569
|
+
}
|
|
570
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
571
|
+
function claim(inst, sentinel) {
|
|
572
|
+
const proto = Object.getPrototypeOf(inst);
|
|
573
|
+
return sentinel in proto ? void 0 : proto;
|
|
574
|
+
}
|
|
575
|
+
let installing;
|
|
576
|
+
let broke = false;
|
|
577
|
+
const breaker = {
|
|
578
|
+
configurable: true,
|
|
579
|
+
get() {
|
|
580
|
+
broke = true;
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
585
|
+
* constructor, computed from the internals object itself and cached there on
|
|
586
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
587
|
+
*/
|
|
588
|
+
function defineLazyInternal(inst, key, compute) {
|
|
589
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
590
|
+
if (key in proto && installing !== inst._zod) {
|
|
591
|
+
installing = void 0;
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
installing = inst._zod;
|
|
595
|
+
Object.defineProperty(proto, key, {
|
|
596
|
+
configurable: true,
|
|
597
|
+
get() {
|
|
598
|
+
Object.defineProperty(this, key, breaker);
|
|
599
|
+
const outer = broke;
|
|
600
|
+
broke = false;
|
|
601
|
+
try {
|
|
602
|
+
const value = compute(this);
|
|
603
|
+
if (broke) delete this[key];
|
|
604
|
+
else Object.defineProperty(this, key, {
|
|
605
|
+
configurable: true,
|
|
606
|
+
writable: true,
|
|
607
|
+
value
|
|
608
|
+
});
|
|
609
|
+
broke = broke || outer;
|
|
610
|
+
return value;
|
|
611
|
+
} catch (err) {
|
|
612
|
+
delete this[key];
|
|
613
|
+
broke = broke || outer;
|
|
614
|
+
throw err;
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
set(value) {
|
|
618
|
+
Object.defineProperty(this, key, {
|
|
619
|
+
configurable: true,
|
|
620
|
+
writable: true,
|
|
621
|
+
value
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
628
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
629
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
630
|
+
*/
|
|
631
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
632
|
+
const proto = claim(inst, key);
|
|
633
|
+
if (!proto) return;
|
|
634
|
+
Object.defineProperty(proto, key, {
|
|
635
|
+
configurable: true,
|
|
636
|
+
get() {
|
|
637
|
+
const desc = {
|
|
638
|
+
configurable: true,
|
|
639
|
+
writable: true,
|
|
640
|
+
enumerable,
|
|
641
|
+
value: void 0
|
|
642
|
+
};
|
|
643
|
+
Object.defineProperty(this, key, desc);
|
|
644
|
+
desc.value = make(this);
|
|
645
|
+
Object.defineProperty(this, key, desc);
|
|
646
|
+
return desc.value;
|
|
647
|
+
},
|
|
648
|
+
set(value) {
|
|
649
|
+
Object.defineProperty(this, key, {
|
|
650
|
+
configurable: true,
|
|
651
|
+
writable: true,
|
|
652
|
+
enumerable,
|
|
653
|
+
value
|
|
654
|
+
});
|
|
655
|
+
}
|
|
561
656
|
});
|
|
657
|
+
}
|
|
658
|
+
/** 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. */
|
|
659
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
660
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
661
|
+
function constantCatch(value) {
|
|
662
|
+
const fn = () => value;
|
|
663
|
+
fn[CONSTANT_CATCH] = true;
|
|
664
|
+
return fn;
|
|
665
|
+
}
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/core.js
|
|
668
|
+
var _a$1;
|
|
669
|
+
const _zodDesc$1 = {
|
|
670
|
+
value: void 0,
|
|
671
|
+
enumerable: false
|
|
672
|
+
};
|
|
673
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
674
|
+
function newError$1(Definition) {
|
|
675
|
+
const E = _E;
|
|
676
|
+
if (E) {
|
|
677
|
+
const saved = E.stackTraceLimit;
|
|
678
|
+
if (typeof saved === "number") {
|
|
679
|
+
try {
|
|
680
|
+
E.stackTraceLimit = 0;
|
|
681
|
+
} catch {
|
|
682
|
+
_E = null;
|
|
683
|
+
return new Definition();
|
|
684
|
+
}
|
|
685
|
+
try {
|
|
686
|
+
return new Definition();
|
|
687
|
+
} finally {
|
|
688
|
+
E.stackTraceLimit = saved;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return new Definition();
|
|
693
|
+
}
|
|
694
|
+
function $constructor(name, initializer, proto, params) {
|
|
695
|
+
const zodProto = {};
|
|
696
|
+
function Internals(def) {
|
|
697
|
+
this.def = def;
|
|
698
|
+
this.constr = _;
|
|
699
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
700
|
+
}
|
|
701
|
+
Internals.prototype = zodProto;
|
|
702
|
+
const protoMembers = proto;
|
|
703
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
704
|
+
function init(inst, def) {
|
|
705
|
+
if (!inst._zod) {
|
|
706
|
+
_zodDesc$1.value = new Internals(def);
|
|
707
|
+
try {
|
|
708
|
+
Object.defineProperty(inst, "_zod", _zodDesc$1);
|
|
709
|
+
} finally {
|
|
710
|
+
_zodDesc$1.value = void 0;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
if (inst._zod.traits.has(name)) return;
|
|
714
|
+
inst._zod.traits.add(name);
|
|
715
|
+
initializer(inst, def);
|
|
716
|
+
if (initialized) {
|
|
717
|
+
const own = Object.getPrototypeOf(inst);
|
|
718
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
719
|
+
let up = own;
|
|
720
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
721
|
+
const target = up ?? own;
|
|
722
|
+
if (!initialized.has(target)) {
|
|
723
|
+
initialized.add(target);
|
|
724
|
+
members(target, protoMembers);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
const proto = _.prototype;
|
|
728
|
+
for (const k in proto) {
|
|
729
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
730
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
const Parent = params?.Parent ?? Object;
|
|
734
|
+
class Definition extends Parent {}
|
|
735
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
736
|
+
function _(def) {
|
|
737
|
+
const inst = params?.Parent ? newError$1(Definition) : this;
|
|
738
|
+
init(inst, def);
|
|
739
|
+
const deferred = inst._zod.deferred;
|
|
740
|
+
if (deferred) {
|
|
741
|
+
for (const fn of deferred) fn();
|
|
742
|
+
inst._zod.deferred = void 0;
|
|
743
|
+
}
|
|
744
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
745
|
+
if (pp) pp(inst);
|
|
746
|
+
return inst;
|
|
747
|
+
}
|
|
748
|
+
Object.defineProperty(_, "init", { value: init });
|
|
749
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
750
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
751
|
+
return inst?._zod?.traits?.has(name);
|
|
752
|
+
} });
|
|
753
|
+
Object.defineProperty(_, "name", { value: name });
|
|
754
|
+
return _;
|
|
755
|
+
}
|
|
756
|
+
var $ZodAsyncError = class extends Error {
|
|
757
|
+
constructor() {
|
|
758
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
var $ZodEncodeError = class extends Error {
|
|
762
|
+
constructor(name) {
|
|
763
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
764
|
+
this.name = "ZodEncodeError";
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
768
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
769
|
+
function config(newConfig) {
|
|
770
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
771
|
+
return globalConfig;
|
|
772
|
+
}
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/errors.js
|
|
775
|
+
function _getMessage() {
|
|
776
|
+
const internals = this._zod;
|
|
777
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
778
|
+
return internals.message;
|
|
779
|
+
}
|
|
780
|
+
function _setMessage(value) {
|
|
781
|
+
this._zod.message = value;
|
|
782
|
+
}
|
|
783
|
+
const _messageDesc = {
|
|
784
|
+
get: _getMessage,
|
|
785
|
+
set: _setMessage,
|
|
786
|
+
enumerable: true,
|
|
787
|
+
configurable: true
|
|
788
|
+
};
|
|
789
|
+
const _zodDesc = {
|
|
790
|
+
value: void 0,
|
|
791
|
+
enumerable: false
|
|
792
|
+
};
|
|
793
|
+
const _issuesDesc = {
|
|
794
|
+
value: void 0,
|
|
795
|
+
enumerable: false
|
|
796
|
+
};
|
|
797
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
798
|
+
const initializer$1 = (inst, def) => {
|
|
799
|
+
inst.name = "$ZodError";
|
|
800
|
+
_zodDesc.value = inst._zod;
|
|
801
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
802
|
+
_issuesDesc.value = def;
|
|
803
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
804
|
+
_zodDesc.value = void 0;
|
|
805
|
+
_issuesDesc.value = void 0;
|
|
806
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
807
|
+
const proto = Object.getPrototypeOf(inst);
|
|
808
|
+
if (!_installedToString.has(proto)) {
|
|
809
|
+
_installedToString.add(proto);
|
|
810
|
+
Object.defineProperty(proto, "toString", {
|
|
811
|
+
configurable: true,
|
|
812
|
+
enumerable: false,
|
|
813
|
+
get() {
|
|
814
|
+
const value = () => this.message;
|
|
815
|
+
Object.defineProperty(this, "toString", {
|
|
816
|
+
value,
|
|
817
|
+
configurable: true,
|
|
818
|
+
writable: true
|
|
819
|
+
});
|
|
820
|
+
return value;
|
|
821
|
+
},
|
|
822
|
+
set(value) {
|
|
823
|
+
Object.defineProperty(this, "toString", {
|
|
824
|
+
value,
|
|
825
|
+
configurable: true,
|
|
826
|
+
writable: true
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
}
|
|
562
831
|
};
|
|
563
832
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
564
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
833
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
834
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
835
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
836
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
837
|
+
function node(obj, key, make) {
|
|
838
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
839
|
+
if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
840
|
+
value: make(),
|
|
841
|
+
writable: true,
|
|
842
|
+
enumerable: true,
|
|
843
|
+
configurable: true
|
|
844
|
+
});
|
|
845
|
+
else obj[key] = make();
|
|
846
|
+
}
|
|
847
|
+
return obj[key];
|
|
848
|
+
}
|
|
565
849
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
566
850
|
const fieldErrors = {};
|
|
567
851
|
const formErrors = [];
|
|
568
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
569
|
-
|
|
570
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
571
|
-
} else formErrors.push(mapper(sub));
|
|
852
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
853
|
+
else formErrors.push(mapper(sub));
|
|
572
854
|
return {
|
|
573
855
|
formErrors,
|
|
574
856
|
fieldErrors
|
|
@@ -588,12 +870,21 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
588
870
|
let i = 0;
|
|
589
871
|
while (i < fullpath.length) {
|
|
590
872
|
const el = fullpath[i];
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
873
|
+
const terminal = i === fullpath.length - 1;
|
|
874
|
+
if (el === "_errors") {
|
|
875
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
876
|
+
i++;
|
|
877
|
+
continue;
|
|
595
878
|
}
|
|
596
|
-
curr
|
|
879
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
880
|
+
value: { _errors: [] },
|
|
881
|
+
enumerable: true,
|
|
882
|
+
writable: true,
|
|
883
|
+
configurable: true
|
|
884
|
+
});
|
|
885
|
+
const node = curr[el];
|
|
886
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
887
|
+
curr = node;
|
|
597
888
|
i++;
|
|
598
889
|
}
|
|
599
890
|
}
|
|
@@ -603,40 +894,52 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
603
894
|
return fieldErrors;
|
|
604
895
|
}
|
|
605
896
|
//#endregion
|
|
606
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
897
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/parse.js
|
|
898
|
+
function finalizeParams(callee, params) {
|
|
899
|
+
return {
|
|
900
|
+
callee: params?.callee ?? callee,
|
|
901
|
+
Err: params?.Err
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
const _parse = (_Err) => {
|
|
905
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
906
|
+
const ctx = _ctx ? {
|
|
907
|
+
..._ctx,
|
|
908
|
+
async: false
|
|
909
|
+
} : { async: false };
|
|
910
|
+
const result = schema._zod.run({
|
|
911
|
+
value,
|
|
912
|
+
issues: []
|
|
913
|
+
}, ctx);
|
|
914
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
915
|
+
if (result.issues.length) {
|
|
916
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
917
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
918
|
+
throw e;
|
|
919
|
+
}
|
|
920
|
+
return result.value;
|
|
921
|
+
};
|
|
922
|
+
return fn;
|
|
623
923
|
};
|
|
624
|
-
const _parseAsync = (_Err) =>
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
924
|
+
const _parseAsync = (_Err) => {
|
|
925
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
926
|
+
const ctx = _ctx ? {
|
|
927
|
+
..._ctx,
|
|
928
|
+
async: true
|
|
929
|
+
} : { async: true };
|
|
930
|
+
let result = schema._zod.run({
|
|
931
|
+
value,
|
|
932
|
+
issues: []
|
|
933
|
+
}, ctx);
|
|
934
|
+
if (result instanceof Promise) result = await result;
|
|
935
|
+
if (result.issues.length) {
|
|
936
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
937
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
938
|
+
throw e;
|
|
939
|
+
}
|
|
940
|
+
return result.value;
|
|
941
|
+
};
|
|
942
|
+
return fn;
|
|
640
943
|
};
|
|
641
944
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
642
945
|
const ctx = _ctx ? {
|
|
@@ -676,25 +979,41 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
676
979
|
};
|
|
677
980
|
};
|
|
678
981
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
679
|
-
const _encode = (_Err) =>
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
982
|
+
const _encode = (_Err) => {
|
|
983
|
+
const parse = _parse(_Err);
|
|
984
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
985
|
+
const ctx = _ctx ? {
|
|
986
|
+
..._ctx,
|
|
987
|
+
direction: "backward"
|
|
988
|
+
} : { direction: "backward" };
|
|
989
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
990
|
+
};
|
|
991
|
+
return fn;
|
|
685
992
|
};
|
|
686
|
-
const _decode = (_Err) =>
|
|
687
|
-
|
|
993
|
+
const _decode = (_Err) => {
|
|
994
|
+
const parse = _parse(_Err);
|
|
995
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
996
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
997
|
+
};
|
|
998
|
+
return fn;
|
|
688
999
|
};
|
|
689
|
-
const _encodeAsync = (_Err) =>
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
1000
|
+
const _encodeAsync = (_Err) => {
|
|
1001
|
+
const parseAsync = _parseAsync(_Err);
|
|
1002
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1003
|
+
const ctx = _ctx ? {
|
|
1004
|
+
..._ctx,
|
|
1005
|
+
direction: "backward"
|
|
1006
|
+
} : { direction: "backward" };
|
|
1007
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
1008
|
+
};
|
|
1009
|
+
return fn;
|
|
695
1010
|
};
|
|
696
|
-
const _decodeAsync = (_Err) =>
|
|
697
|
-
|
|
1011
|
+
const _decodeAsync = (_Err) => {
|
|
1012
|
+
const parseAsync = _parseAsync(_Err);
|
|
1013
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1014
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1015
|
+
};
|
|
1016
|
+
return fn;
|
|
698
1017
|
};
|
|
699
1018
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
700
1019
|
const ctx = _ctx ? {
|
|
@@ -717,7 +1036,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
717
1036
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
718
1037
|
};
|
|
719
1038
|
//#endregion
|
|
720
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1039
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/regexes.js
|
|
721
1040
|
/**
|
|
722
1041
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
723
1042
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -725,12 +1044,15 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
725
1044
|
*/
|
|
726
1045
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
727
1046
|
const cuid2 = /^[0-9a-z]+$/;
|
|
728
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
1047
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
729
1048
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
730
1049
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
731
1050
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1051
|
+
function nanoidOfLength(length) {
|
|
1052
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
1053
|
+
}
|
|
732
1054
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
733
|
-
const duration
|
|
1055
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
734
1056
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
735
1057
|
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})$/;
|
|
736
1058
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -742,33 +1064,41 @@ const uuid = (version) => {
|
|
|
742
1064
|
};
|
|
743
1065
|
/** Practical email validation */
|
|
744
1066
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
745
|
-
const _emoji$1 = `^
|
|
1067
|
+
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
746
1068
|
function emoji() {
|
|
747
1069
|
return new RegExp(_emoji$1, "u");
|
|
748
1070
|
}
|
|
749
1071
|
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])$/;
|
|
750
1072
|
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}|:))$/;
|
|
751
1073
|
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])$/;
|
|
752
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
1074
|
+
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])$/;
|
|
753
1075
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
754
1076
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
755
1077
|
const httpProtocol = /^https?$/;
|
|
756
1078
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
757
1079
|
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])))`;
|
|
758
|
-
|
|
1080
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
1081
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
1082
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
1083
|
+
function anchor(source) {
|
|
1084
|
+
return new RegExp(`^${source}$`);
|
|
1085
|
+
}
|
|
1086
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
759
1087
|
function timeSource(args) {
|
|
760
1088
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
761
|
-
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+)?)?`;
|
|
1089
|
+
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+)?)?`;
|
|
762
1090
|
}
|
|
763
|
-
function time
|
|
1091
|
+
function time(args) {
|
|
764
1092
|
return new RegExp(`^${timeSource(args)}$`);
|
|
765
1093
|
}
|
|
766
1094
|
function datetime$1(args) {
|
|
767
|
-
const time = timeSource({ precision: args.precision });
|
|
768
1095
|
const opts = ["Z"];
|
|
769
|
-
if (args.local) opts.push("");
|
|
770
1096
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
771
|
-
const
|
|
1097
|
+
const qualified = `${timeSource({
|
|
1098
|
+
precision: args.precision,
|
|
1099
|
+
seconds: true
|
|
1100
|
+
})}(?:${opts.join("|")})`;
|
|
1101
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
772
1102
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
773
1103
|
}
|
|
774
1104
|
const string$1 = (params) => {
|
|
@@ -782,13 +1112,18 @@ const _null$2 = /^null$/i;
|
|
|
782
1112
|
const lowercase = /^[^A-Z]*$/;
|
|
783
1113
|
const uppercase = /^[^a-z]*$/;
|
|
784
1114
|
//#endregion
|
|
785
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1115
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/checks.js
|
|
786
1116
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
787
1117
|
var _a;
|
|
788
1118
|
inst._zod ?? (inst._zod = {});
|
|
789
1119
|
inst._zod.def = def;
|
|
790
1120
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
791
1121
|
});
|
|
1122
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
1123
|
+
const _whenHasLength = (payload) => {
|
|
1124
|
+
const val = payload.value;
|
|
1125
|
+
return !nullish(val) && val.length !== void 0;
|
|
1126
|
+
};
|
|
792
1127
|
const numericOriginMap = {
|
|
793
1128
|
number: "number",
|
|
794
1129
|
bigint: "bigint",
|
|
@@ -808,7 +1143,7 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
|
|
|
808
1143
|
inst._zod.check = (payload) => {
|
|
809
1144
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
810
1145
|
payload.issues.push({
|
|
811
|
-
origin,
|
|
1146
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
812
1147
|
code: "too_big",
|
|
813
1148
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
814
1149
|
input: payload.value,
|
|
@@ -832,7 +1167,7 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
|
|
|
832
1167
|
inst._zod.check = (payload) => {
|
|
833
1168
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
834
1169
|
payload.issues.push({
|
|
835
|
-
origin,
|
|
1170
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
836
1171
|
code: "too_small",
|
|
837
1172
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
838
1173
|
input: payload.value,
|
|
@@ -850,7 +1185,7 @@ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (i
|
|
|
850
1185
|
});
|
|
851
1186
|
inst._zod.check = (payload) => {
|
|
852
1187
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
853
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1188
|
+
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
854
1189
|
payload.issues.push({
|
|
855
1190
|
origin: typeof payload.value,
|
|
856
1191
|
code: "not_multiple_of",
|
|
@@ -935,17 +1270,15 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
935
1270
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
936
1271
|
var _a;
|
|
937
1272
|
$ZodCheck.init(inst, def);
|
|
938
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
939
|
-
const val = payload.value;
|
|
940
|
-
return !nullish(val) && val.length !== void 0;
|
|
941
|
-
});
|
|
1273
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
942
1274
|
inst._zod.onattach.push((inst) => {
|
|
943
1275
|
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
944
1276
|
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
945
1277
|
});
|
|
946
1278
|
inst._zod.check = (payload) => {
|
|
947
1279
|
const input = payload.value;
|
|
948
|
-
|
|
1280
|
+
const units = input.length;
|
|
1281
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
949
1282
|
const origin = getLengthableOrigin(input);
|
|
950
1283
|
payload.issues.push({
|
|
951
1284
|
origin,
|
|
@@ -961,17 +1294,15 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
961
1294
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
962
1295
|
var _a;
|
|
963
1296
|
$ZodCheck.init(inst, def);
|
|
964
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
965
|
-
const val = payload.value;
|
|
966
|
-
return !nullish(val) && val.length !== void 0;
|
|
967
|
-
});
|
|
1297
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
968
1298
|
inst._zod.onattach.push((inst) => {
|
|
969
1299
|
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
970
1300
|
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
971
1301
|
});
|
|
972
1302
|
inst._zod.check = (payload) => {
|
|
973
1303
|
const input = payload.value;
|
|
974
|
-
|
|
1304
|
+
const units = input.length;
|
|
1305
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
975
1306
|
const origin = getLengthableOrigin(input);
|
|
976
1307
|
payload.issues.push({
|
|
977
1308
|
origin,
|
|
@@ -987,10 +1318,7 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
987
1318
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
988
1319
|
var _a;
|
|
989
1320
|
$ZodCheck.init(inst, def);
|
|
990
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
991
|
-
const val = payload.value;
|
|
992
|
-
return !nullish(val) && val.length !== void 0;
|
|
993
|
-
});
|
|
1321
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
994
1322
|
inst._zod.onattach.push((inst) => {
|
|
995
1323
|
const bag = inst._zod.bag;
|
|
996
1324
|
bag.minimum = def.length;
|
|
@@ -999,7 +1327,8 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
999
1327
|
});
|
|
1000
1328
|
inst._zod.check = (payload) => {
|
|
1001
1329
|
const input = payload.value;
|
|
1002
|
-
const
|
|
1330
|
+
const units = input.length;
|
|
1331
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
1003
1332
|
if (length === def.length) return;
|
|
1004
1333
|
const origin = getLengthableOrigin(input);
|
|
1005
1334
|
const tooBig = length > def.length;
|
|
@@ -1073,7 +1402,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1073
1402
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1074
1403
|
$ZodCheck.init(inst, def);
|
|
1075
1404
|
const escapedRegex = escapeRegex(def.includes);
|
|
1076
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1405
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1077
1406
|
def.pattern = pattern;
|
|
1078
1407
|
inst._zod.onattach.push((inst) => {
|
|
1079
1408
|
const bag = inst._zod.bag;
|
|
@@ -1144,12 +1473,13 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1144
1473
|
};
|
|
1145
1474
|
});
|
|
1146
1475
|
//#endregion
|
|
1147
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1476
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/doc.js
|
|
1148
1477
|
var Doc = class {
|
|
1149
|
-
constructor(args = []) {
|
|
1478
|
+
constructor(args = [], closed = {}) {
|
|
1150
1479
|
this.content = [];
|
|
1151
1480
|
this.indent = 0;
|
|
1152
|
-
|
|
1481
|
+
this.args = args;
|
|
1482
|
+
this.closed = closed;
|
|
1153
1483
|
}
|
|
1154
1484
|
indented(fn) {
|
|
1155
1485
|
this.indent += 1;
|
|
@@ -1169,28 +1499,27 @@ var Doc = class {
|
|
|
1169
1499
|
}
|
|
1170
1500
|
compile() {
|
|
1171
1501
|
const F = Function;
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
return new F(...args, lines.join("\n"));
|
|
1502
|
+
const content = this?.content ?? [``];
|
|
1503
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1175
1504
|
}
|
|
1176
1505
|
};
|
|
1177
1506
|
//#endregion
|
|
1178
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1507
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/versions.js
|
|
1179
1508
|
const version = {
|
|
1180
1509
|
major: 4,
|
|
1181
|
-
minor:
|
|
1182
|
-
patch:
|
|
1510
|
+
minor: 5,
|
|
1511
|
+
patch: 2
|
|
1183
1512
|
};
|
|
1184
1513
|
//#endregion
|
|
1185
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1514
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/schemas.js
|
|
1186
1515
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1187
1516
|
var _a;
|
|
1188
1517
|
inst ?? (inst = {});
|
|
1189
1518
|
inst._zod.def = def;
|
|
1190
1519
|
inst._zod.bag = inst._zod.bag || {};
|
|
1191
1520
|
inst._zod.version = version;
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1521
|
+
const defChecks = inst._zod.def.checks;
|
|
1522
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1194
1523
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1195
1524
|
if (checks.length === 0) {
|
|
1196
1525
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1199,6 +1528,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1199
1528
|
});
|
|
1200
1529
|
} else {
|
|
1201
1530
|
const runChecks = (payload, checks, ctx) => {
|
|
1531
|
+
if (payload.memo) return payload;
|
|
1202
1532
|
let isAborted = aborted(payload);
|
|
1203
1533
|
let asyncResult;
|
|
1204
1534
|
for (const ch of checks) {
|
|
@@ -1212,10 +1542,12 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1212
1542
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1213
1543
|
await _;
|
|
1214
1544
|
if (payload.issues.length === currLen) return;
|
|
1545
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1215
1546
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1216
1547
|
});
|
|
1217
1548
|
else {
|
|
1218
1549
|
if (payload.issues.length === currLen) continue;
|
|
1550
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1219
1551
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1220
1552
|
}
|
|
1221
1553
|
}
|
|
@@ -1259,19 +1591,29 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1259
1591
|
return runChecks(result, checks, ctx);
|
|
1260
1592
|
};
|
|
1261
1593
|
}
|
|
1262
|
-
|
|
1594
|
+
}, {
|
|
1595
|
+
get "~standard"() {
|
|
1596
|
+
return hide(this, "~standard", standardProps(this));
|
|
1597
|
+
},
|
|
1598
|
+
set "~standard"(value) {
|
|
1599
|
+
own(this, "~standard", value);
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1603
|
+
const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1604
|
+
function standardProps(inst) {
|
|
1605
|
+
return {
|
|
1263
1606
|
validate: (value) => {
|
|
1264
1607
|
try {
|
|
1265
|
-
|
|
1266
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1608
|
+
return toStandardResult(safeParse$1(inst, value));
|
|
1267
1609
|
} catch (_) {
|
|
1268
|
-
return safeParseAsync$1(inst, value).then(
|
|
1610
|
+
return safeParseAsync$1(inst, value).then(toStandardResult);
|
|
1269
1611
|
}
|
|
1270
1612
|
},
|
|
1271
1613
|
vendor: "zod",
|
|
1272
1614
|
version: 1
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1275
1617
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1276
1618
|
$ZodType.init(inst, def);
|
|
1277
1619
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
@@ -1318,51 +1660,74 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1318
1660
|
def.pattern ?? (def.pattern = email);
|
|
1319
1661
|
$ZodStringFormat.init(inst, def);
|
|
1320
1662
|
});
|
|
1663
|
+
/** 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. */
|
|
1664
|
+
function parseURLObject(trimmed, def) {
|
|
1665
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1666
|
+
try {
|
|
1667
|
+
return new URL(trimmed);
|
|
1668
|
+
} catch {
|
|
1669
|
+
return 2;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1673
|
+
/** 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. */
|
|
1674
|
+
function stripTabAndNewline(value) {
|
|
1675
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1676
|
+
}
|
|
1677
|
+
function urlHostnameOk(url, hostname) {
|
|
1678
|
+
hostname.lastIndex = 0;
|
|
1679
|
+
return hostname.test(url.hostname);
|
|
1680
|
+
}
|
|
1681
|
+
function urlProtocolOk(url, protocol) {
|
|
1682
|
+
protocol.lastIndex = 0;
|
|
1683
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1684
|
+
}
|
|
1321
1685
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1322
1686
|
$ZodStringFormat.init(inst, def);
|
|
1323
1687
|
inst._zod.check = (payload) => {
|
|
1324
1688
|
try {
|
|
1325
1689
|
const trimmed = payload.value.trim();
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
code: "invalid_format",
|
|
1330
|
-
format: "url",
|
|
1331
|
-
note: "Invalid URL format",
|
|
1332
|
-
input: payload.value,
|
|
1333
|
-
inst,
|
|
1334
|
-
continue: !def.abort
|
|
1335
|
-
});
|
|
1336
|
-
return;
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
const url = new URL(trimmed);
|
|
1340
|
-
if (def.hostname) {
|
|
1341
|
-
def.hostname.lastIndex = 0;
|
|
1342
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1690
|
+
const url = parseURLObject(trimmed, def);
|
|
1691
|
+
if (url === 1) {
|
|
1692
|
+
payload.issues.push({
|
|
1343
1693
|
code: "invalid_format",
|
|
1344
1694
|
format: "url",
|
|
1345
|
-
note: "Invalid
|
|
1346
|
-
pattern: def.hostname.source,
|
|
1695
|
+
note: "Invalid URL format",
|
|
1347
1696
|
input: payload.value,
|
|
1348
1697
|
inst,
|
|
1349
1698
|
continue: !def.abort
|
|
1350
1699
|
});
|
|
1700
|
+
return;
|
|
1351
1701
|
}
|
|
1352
|
-
if (
|
|
1353
|
-
|
|
1354
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1702
|
+
if (url === 2) {
|
|
1703
|
+
payload.issues.push({
|
|
1355
1704
|
code: "invalid_format",
|
|
1356
1705
|
format: "url",
|
|
1357
|
-
note: "Invalid protocol",
|
|
1358
|
-
pattern: def.protocol.source,
|
|
1359
1706
|
input: payload.value,
|
|
1360
1707
|
inst,
|
|
1361
1708
|
continue: !def.abort
|
|
1362
1709
|
});
|
|
1710
|
+
return;
|
|
1363
1711
|
}
|
|
1364
|
-
if (def.
|
|
1365
|
-
|
|
1712
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1713
|
+
code: "invalid_format",
|
|
1714
|
+
format: "url",
|
|
1715
|
+
note: "Invalid hostname",
|
|
1716
|
+
pattern: def.hostname.source,
|
|
1717
|
+
input: payload.value,
|
|
1718
|
+
inst,
|
|
1719
|
+
continue: !def.abort
|
|
1720
|
+
});
|
|
1721
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1722
|
+
code: "invalid_format",
|
|
1723
|
+
format: "url",
|
|
1724
|
+
note: "Invalid protocol",
|
|
1725
|
+
pattern: def.protocol.source,
|
|
1726
|
+
input: payload.value,
|
|
1727
|
+
inst,
|
|
1728
|
+
continue: !def.abort
|
|
1729
|
+
});
|
|
1730
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1366
1731
|
return;
|
|
1367
1732
|
} catch (_) {
|
|
1368
1733
|
payload.issues.push({
|
|
@@ -1380,7 +1745,8 @@ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
1380
1745
|
$ZodStringFormat.init(inst, def);
|
|
1381
1746
|
});
|
|
1382
1747
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1383
|
-
def.
|
|
1748
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1749
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1384
1750
|
$ZodStringFormat.init(inst, def);
|
|
1385
1751
|
});
|
|
1386
1752
|
/**
|
|
@@ -1411,17 +1777,23 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1411
1777
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1412
1778
|
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1413
1779
|
$ZodStringFormat.init(inst, def);
|
|
1780
|
+
if (def.local || def.precision === -1) {
|
|
1781
|
+
inst._zod.bag.laxFormat = true;
|
|
1782
|
+
inst._zod.onattach.push((s) => {
|
|
1783
|
+
s._zod.bag.laxFormat = true;
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1414
1786
|
});
|
|
1415
1787
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1416
|
-
def.pattern ?? (def.pattern = date
|
|
1788
|
+
def.pattern ?? (def.pattern = date);
|
|
1417
1789
|
$ZodStringFormat.init(inst, def);
|
|
1418
1790
|
});
|
|
1419
1791
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1420
|
-
def.pattern ?? (def.pattern = time
|
|
1792
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1421
1793
|
$ZodStringFormat.init(inst, def);
|
|
1422
1794
|
});
|
|
1423
1795
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1424
|
-
def.pattern ?? (def.pattern = duration
|
|
1796
|
+
def.pattern ?? (def.pattern = duration);
|
|
1425
1797
|
$ZodStringFormat.init(inst, def);
|
|
1426
1798
|
});
|
|
1427
1799
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
@@ -1429,50 +1801,56 @@ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
|
1429
1801
|
$ZodStringFormat.init(inst, def);
|
|
1430
1802
|
inst._zod.bag.format = `ipv4`;
|
|
1431
1803
|
});
|
|
1804
|
+
/** 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`. */
|
|
1805
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1806
|
+
function isValidIPv6(value) {
|
|
1807
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
1808
|
+
try {
|
|
1809
|
+
new URL(`http://[${value}]`);
|
|
1810
|
+
return true;
|
|
1811
|
+
} catch {
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1432
1815
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1433
1816
|
def.pattern ?? (def.pattern = ipv6);
|
|
1434
1817
|
$ZodStringFormat.init(inst, def);
|
|
1435
1818
|
inst._zod.bag.format = `ipv6`;
|
|
1436
1819
|
inst._zod.check = (payload) => {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
payload.
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
inst,
|
|
1445
|
-
continue: !def.abort
|
|
1446
|
-
});
|
|
1447
|
-
}
|
|
1820
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1821
|
+
code: "invalid_format",
|
|
1822
|
+
format: "ipv6",
|
|
1823
|
+
input: payload.value,
|
|
1824
|
+
inst,
|
|
1825
|
+
continue: !def.abort
|
|
1826
|
+
});
|
|
1448
1827
|
};
|
|
1449
1828
|
});
|
|
1450
1829
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1451
1830
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1452
1831
|
$ZodStringFormat.init(inst, def);
|
|
1453
1832
|
});
|
|
1833
|
+
function isValidCIDRv6(value) {
|
|
1834
|
+
const parts = value.split("/");
|
|
1835
|
+
if (parts.length !== 2) return false;
|
|
1836
|
+
const [address, prefix] = parts;
|
|
1837
|
+
if (!prefix) return false;
|
|
1838
|
+
const prefixNum = Number(prefix);
|
|
1839
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
1840
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1841
|
+
return isValidIPv6(address);
|
|
1842
|
+
}
|
|
1454
1843
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1455
1844
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1456
1845
|
$ZodStringFormat.init(inst, def);
|
|
1457
1846
|
inst._zod.check = (payload) => {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1466
|
-
new URL(`http://[${address}]`);
|
|
1467
|
-
} catch {
|
|
1468
|
-
payload.issues.push({
|
|
1469
|
-
code: "invalid_format",
|
|
1470
|
-
format: "cidrv6",
|
|
1471
|
-
input: payload.value,
|
|
1472
|
-
inst,
|
|
1473
|
-
continue: !def.abort
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1847
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
1848
|
+
code: "invalid_format",
|
|
1849
|
+
format: "cidrv6",
|
|
1850
|
+
input: payload.value,
|
|
1851
|
+
inst,
|
|
1852
|
+
continue: !def.abort
|
|
1853
|
+
});
|
|
1476
1854
|
};
|
|
1477
1855
|
});
|
|
1478
1856
|
function isValidBase64(data) {
|
|
@@ -1562,7 +1940,7 @@ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
|
1562
1940
|
} catch (_) {}
|
|
1563
1941
|
const input = payload.value;
|
|
1564
1942
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1565
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1943
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
1566
1944
|
payload.issues.push({
|
|
1567
1945
|
expected: "number",
|
|
1568
1946
|
code: "invalid_type",
|
|
@@ -1637,6 +2015,8 @@ function handleArrayResult(result, final, index) {
|
|
|
1637
2015
|
}
|
|
1638
2016
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1639
2017
|
$ZodType.init(inst, def);
|
|
2018
|
+
const memo = globalConfig.memoizer;
|
|
2019
|
+
memo?.attach(inst);
|
|
1640
2020
|
inst._zod.parse = (payload, ctx) => {
|
|
1641
2021
|
const input = payload.value;
|
|
1642
2022
|
if (!Array.isArray(input)) {
|
|
@@ -1648,7 +2028,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1648
2028
|
});
|
|
1649
2029
|
return payload;
|
|
1650
2030
|
}
|
|
1651
|
-
payload.value = Array(input.length);
|
|
2031
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1652
2032
|
const proms = [];
|
|
1653
2033
|
for (let i = 0; i < input.length; i++) {
|
|
1654
2034
|
const item = input[i];
|
|
@@ -1663,13 +2043,15 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1663
2043
|
return payload;
|
|
1664
2044
|
};
|
|
1665
2045
|
});
|
|
1666
|
-
function handlePropertyResult(result, final, key, input,
|
|
2046
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1667
2047
|
const isPresent = key in input;
|
|
2048
|
+
const isOptionalOut = optout === "optional";
|
|
2049
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1668
2050
|
if (result.issues.length) {
|
|
1669
|
-
if (
|
|
2051
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
1670
2052
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1671
2053
|
}
|
|
1672
|
-
if (!isPresent &&
|
|
2054
|
+
if (!isPresent && optin === void 0) {
|
|
1673
2055
|
if (!result.issues.length) final.issues.push({
|
|
1674
2056
|
code: "invalid_type",
|
|
1675
2057
|
expected: "nonoptional",
|
|
@@ -1682,13 +2064,18 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
1682
2064
|
if (isPresent) final.value[key] = void 0;
|
|
1683
2065
|
} else final.value[key] = result.value;
|
|
1684
2066
|
}
|
|
2067
|
+
const NO_SYMBOL_KEYS = [];
|
|
1685
2068
|
function normalizeDef(def) {
|
|
1686
2069
|
const keys = Object.keys(def.shape);
|
|
1687
|
-
|
|
2070
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
2071
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
2072
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
2073
|
+
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`);
|
|
1688
2074
|
const okeys = optionalKeys(def.shape);
|
|
1689
2075
|
return {
|
|
1690
2076
|
...def,
|
|
1691
|
-
|
|
2077
|
+
allKeys,
|
|
2078
|
+
symbolKeys,
|
|
1692
2079
|
keySet: new Set(keys),
|
|
1693
2080
|
numKeys: keys.length,
|
|
1694
2081
|
optionalKeys: new Set(okeys)
|
|
@@ -1699,11 +2086,14 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1699
2086
|
const keySet = def.keySet;
|
|
1700
2087
|
const _catchall = def.catchall._zod;
|
|
1701
2088
|
const t = _catchall.def.type;
|
|
1702
|
-
const
|
|
1703
|
-
const
|
|
2089
|
+
const optin = _catchall.optin;
|
|
2090
|
+
const optout = _catchall.optout;
|
|
1704
2091
|
for (const key in input) {
|
|
1705
|
-
if (key === "__proto__") continue;
|
|
1706
2092
|
if (keySet.has(key)) continue;
|
|
2093
|
+
if (key === "__proto__") {
|
|
2094
|
+
if (t === "never") unrecognized.push(key);
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
1707
2097
|
if (t === "never") {
|
|
1708
2098
|
unrecognized.push(key);
|
|
1709
2099
|
continue;
|
|
@@ -1712,39 +2102,44 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1712
2102
|
value: input[key],
|
|
1713
2103
|
issues: []
|
|
1714
2104
|
}, ctx);
|
|
1715
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1716
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2105
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2106
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1717
2107
|
}
|
|
1718
2108
|
if (unrecognized.length) payload.issues.push({
|
|
1719
2109
|
code: "unrecognized_keys",
|
|
1720
2110
|
keys: unrecognized,
|
|
1721
2111
|
input,
|
|
1722
|
-
inst
|
|
2112
|
+
inst,
|
|
2113
|
+
continue: true
|
|
1723
2114
|
});
|
|
1724
2115
|
if (!proms.length) return payload;
|
|
1725
2116
|
return Promise.all(proms).then(() => {
|
|
1726
2117
|
return payload;
|
|
1727
2118
|
});
|
|
1728
2119
|
}
|
|
2120
|
+
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
1729
2121
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1730
2122
|
$ZodType.init(inst, def);
|
|
1731
2123
|
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1732
2124
|
const sh = def.shape;
|
|
2125
|
+
propShapes.set(def, sh);
|
|
1733
2126
|
Object.defineProperty(def, "shape", { get: () => {
|
|
1734
2127
|
const newSh = { ...sh };
|
|
1735
2128
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
2129
|
+
propShapes.set(def, newSh);
|
|
1736
2130
|
return newSh;
|
|
1737
2131
|
} });
|
|
1738
2132
|
}
|
|
1739
2133
|
const _normalized = cached(() => normalizeDef(def));
|
|
1740
|
-
|
|
1741
|
-
const shape = def.shape;
|
|
2134
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2135
|
+
const shape = zod.def.shape;
|
|
1742
2136
|
const propValues = {};
|
|
1743
2137
|
for (const key in shape) {
|
|
1744
2138
|
const field = shape[key]._zod;
|
|
1745
2139
|
if (field.values) {
|
|
1746
|
-
propValues
|
|
2140
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
1747
2141
|
for (const v of field.values) propValues[key].add(v);
|
|
2142
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
1748
2143
|
}
|
|
1749
2144
|
}
|
|
1750
2145
|
return propValues;
|
|
@@ -1752,6 +2147,8 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1752
2147
|
const isObject$1 = isObject;
|
|
1753
2148
|
const catchall = def.catchall;
|
|
1754
2149
|
let value;
|
|
2150
|
+
const memo = globalConfig.memoizer;
|
|
2151
|
+
memo?.attach(inst);
|
|
1755
2152
|
inst._zod.parse = (payload, ctx) => {
|
|
1756
2153
|
value ?? (value = _normalized.value);
|
|
1757
2154
|
const input = payload.value;
|
|
@@ -1764,19 +2161,20 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1764
2161
|
});
|
|
1765
2162
|
return payload;
|
|
1766
2163
|
}
|
|
1767
|
-
payload.value = {};
|
|
2164
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1768
2165
|
const proms = [];
|
|
1769
2166
|
const shape = value.shape;
|
|
1770
|
-
for (const key of value.
|
|
2167
|
+
for (const key of value.allKeys) {
|
|
2168
|
+
if (key === "__proto__") continue;
|
|
1771
2169
|
const el = shape[key];
|
|
1772
|
-
const
|
|
1773
|
-
const
|
|
2170
|
+
const optin = el._zod.optin;
|
|
2171
|
+
const optout = el._zod.optout;
|
|
1774
2172
|
const r = el._zod.run({
|
|
1775
2173
|
value: input[key],
|
|
1776
2174
|
issues: []
|
|
1777
2175
|
}, ctx);
|
|
1778
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1779
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2176
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2177
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1780
2178
|
}
|
|
1781
2179
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1782
2180
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
@@ -1786,55 +2184,55 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1786
2184
|
$ZodObject.init(inst, def);
|
|
1787
2185
|
const superParse = inst._zod.parse;
|
|
1788
2186
|
const _normalized = cached(() => normalizeDef(def));
|
|
2187
|
+
const memo = globalConfig.memoizer;
|
|
1789
2188
|
const generateFastpass = (shape) => {
|
|
1790
|
-
const doc = new Doc([
|
|
1791
|
-
"shape",
|
|
1792
|
-
"payload",
|
|
1793
|
-
"ctx"
|
|
1794
|
-
]);
|
|
1795
2189
|
const normalized = _normalized.value;
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
2190
|
+
const syms = normalized.symbolKeys;
|
|
2191
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
2192
|
+
shape,
|
|
2193
|
+
inst,
|
|
2194
|
+
memo,
|
|
2195
|
+
syms
|
|
2196
|
+
});
|
|
2197
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2198
|
+
const prefixStr = (id, k) => `
|
|
2199
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2200
|
+
const iss = ${id}.issues[i];
|
|
2201
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2202
|
+
payload.issues.push(iss);
|
|
2203
|
+
}`;
|
|
1800
2204
|
doc.write(`const input = payload.value;`);
|
|
1801
2205
|
const ids = Object.create(null);
|
|
1802
2206
|
let counter = 0;
|
|
1803
|
-
for (const key of normalized.
|
|
1804
|
-
doc.write(`const newResult = {};`);
|
|
1805
|
-
for (const key of normalized.
|
|
2207
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
2208
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2209
|
+
for (const key of normalized.allKeys) {
|
|
2210
|
+
if (key === "__proto__") continue;
|
|
1806
2211
|
const id = ids[key];
|
|
1807
|
-
const k = esc(key);
|
|
2212
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2213
|
+
const isPresent = `${k} in input`;
|
|
1808
2214
|
const schema = shape[key];
|
|
1809
|
-
const
|
|
2215
|
+
const optin = schema?._zod?.optin;
|
|
2216
|
+
const isOptionalIn = optin !== void 0;
|
|
1810
2217
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1811
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1812
|
-
if (isOptionalIn && isOptionalOut)
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
})));
|
|
2218
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2219
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2220
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2221
|
+
doc.write(`
|
|
2222
|
+
const ${id}_present = ${isPresent};
|
|
2223
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2224
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1819
2225
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
if (${k} in input) {
|
|
1824
|
-
newResult[${k}] = undefined;
|
|
2226
|
+
|
|
2227
|
+
if (${assign}) {
|
|
2228
|
+
newResult[${k}] = ${id}.value;
|
|
1825
2229
|
}
|
|
1826
|
-
} else {
|
|
1827
|
-
newResult[${k}] = ${id}.value;
|
|
1828
2230
|
}
|
|
1829
|
-
|
|
2231
|
+
|
|
1830
2232
|
`);
|
|
1831
|
-
else if (!isOptionalIn) doc.write(`
|
|
1832
|
-
const ${id}_present = ${
|
|
1833
|
-
if (${id}.issues.length) {
|
|
1834
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1835
|
-
...iss,
|
|
1836
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1837
|
-
})));
|
|
2233
|
+
} else if (!isOptionalIn) doc.write(`
|
|
2234
|
+
const ${id}_present = ${isPresent};
|
|
2235
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1838
2236
|
}
|
|
1839
2237
|
if (!${id}_present && !${id}.issues.length) {
|
|
1840
2238
|
payload.issues.push({
|
|
@@ -1846,36 +2244,27 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1846
2244
|
}
|
|
1847
2245
|
|
|
1848
2246
|
if (${id}_present) {
|
|
1849
|
-
|
|
1850
|
-
newResult[${k}] = undefined;
|
|
1851
|
-
} else {
|
|
1852
|
-
newResult[${k}] = ${id}.value;
|
|
1853
|
-
}
|
|
2247
|
+
newResult[${k}] = ${id}.value;
|
|
1854
2248
|
}
|
|
1855
2249
|
|
|
1856
2250
|
`);
|
|
1857
2251
|
else doc.write(`
|
|
1858
|
-
if (${id}.issues.length) {
|
|
1859
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1860
|
-
...iss,
|
|
1861
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1862
|
-
})));
|
|
2252
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1863
2253
|
}
|
|
1864
2254
|
|
|
1865
2255
|
if (${id}.value === undefined) {
|
|
1866
|
-
if (${
|
|
2256
|
+
if (${isPresent}) {
|
|
1867
2257
|
newResult[${k}] = undefined;
|
|
1868
2258
|
}
|
|
1869
2259
|
} else {
|
|
1870
2260
|
newResult[${k}] = ${id}.value;
|
|
1871
2261
|
}
|
|
1872
|
-
|
|
2262
|
+
|
|
1873
2263
|
`);
|
|
1874
2264
|
}
|
|
1875
2265
|
doc.write(`payload.value = newResult;`);
|
|
1876
2266
|
doc.write(`return payload;`);
|
|
1877
|
-
|
|
1878
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2267
|
+
return doc.compile();
|
|
1879
2268
|
};
|
|
1880
2269
|
let fastpass;
|
|
1881
2270
|
const isObject$2 = isObject;
|
|
@@ -1924,14 +2313,14 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1924
2313
|
}
|
|
1925
2314
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1926
2315
|
$ZodType.init(inst, def);
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2316
|
+
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);
|
|
2317
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2318
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2319
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1931
2320
|
});
|
|
1932
|
-
|
|
1933
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1934
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2321
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2322
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2323
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1935
2324
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1936
2325
|
}
|
|
1937
2326
|
});
|
|
@@ -1993,7 +2382,9 @@ function mergeValues(a, b) {
|
|
|
1993
2382
|
...a,
|
|
1994
2383
|
...b
|
|
1995
2384
|
};
|
|
2385
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
1996
2386
|
for (const key of sharedKeys) {
|
|
2387
|
+
if (key === "__proto__") continue;
|
|
1997
2388
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1998
2389
|
if (!sharedValue.valid) return {
|
|
1999
2390
|
valid: false,
|
|
@@ -2035,26 +2426,39 @@ function mergeValues(a, b) {
|
|
|
2035
2426
|
function handleIntersectionResults(result, left, right) {
|
|
2036
2427
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
2037
2428
|
let unrecIssue;
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2429
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2430
|
+
const collect = (iss, side) => {
|
|
2431
|
+
let keys;
|
|
2432
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2433
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
2434
|
+
keys = iss.keys;
|
|
2435
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2436
|
+
const k = String(iss.path[0]);
|
|
2437
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2438
|
+
keys = [k];
|
|
2439
|
+
} else return false;
|
|
2440
|
+
for (const k of keys) {
|
|
2041
2441
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
2042
|
-
unrecKeys.get(k)
|
|
2442
|
+
unrecKeys.get(k)[side] = true;
|
|
2043
2443
|
}
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
}
|
|
2049
|
-
else result.issues.push(iss);
|
|
2444
|
+
return true;
|
|
2445
|
+
};
|
|
2446
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
2447
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
2050
2448
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2051
|
-
if (bothKeys.length
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2449
|
+
if (bothKeys.length) {
|
|
2450
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2451
|
+
if (aggregated.length) result.issues.push({
|
|
2452
|
+
...unrecIssue,
|
|
2453
|
+
keys: aggregated
|
|
2454
|
+
});
|
|
2455
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
2456
|
+
}
|
|
2056
2457
|
const merged = mergeValues(left.value, right.value);
|
|
2057
|
-
if (!merged.valid)
|
|
2458
|
+
if (!merged.valid) {
|
|
2459
|
+
if (aborted(result)) return result;
|
|
2460
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2461
|
+
}
|
|
2058
2462
|
result.value = merged.data;
|
|
2059
2463
|
return result;
|
|
2060
2464
|
}
|
|
@@ -2063,7 +2467,8 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2063
2467
|
const values = getEnumValues(def.entries);
|
|
2064
2468
|
const valuesSet = new Set(values);
|
|
2065
2469
|
inst._zod.values = valuesSet;
|
|
2066
|
-
|
|
2470
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
2471
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2067
2472
|
inst._zod.parse = (payload, _ctx) => {
|
|
2068
2473
|
const input = payload.value;
|
|
2069
2474
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2079,67 +2484,66 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2079
2484
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2080
2485
|
$ZodType.init(inst, def);
|
|
2081
2486
|
inst._zod.optin = "optional";
|
|
2487
|
+
globalConfig.memoizer?.guard(inst);
|
|
2082
2488
|
inst._zod.parse = (payload, ctx) => {
|
|
2083
2489
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2084
2490
|
const _out = def.transform(payload.value, payload);
|
|
2085
2491
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2086
2492
|
payload.value = output;
|
|
2087
|
-
payload.fallback = true;
|
|
2088
2493
|
return payload;
|
|
2089
2494
|
});
|
|
2090
2495
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2091
2496
|
payload.value = _out;
|
|
2092
|
-
payload.fallback = true;
|
|
2093
2497
|
return payload;
|
|
2094
2498
|
};
|
|
2095
2499
|
});
|
|
2096
|
-
function handleOptionalResult(
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
value: void 0
|
|
2100
|
-
};
|
|
2101
|
-
return result;
|
|
2500
|
+
function handleOptionalResult(payload, result) {
|
|
2501
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2502
|
+
return payload;
|
|
2102
2503
|
}
|
|
2103
2504
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2104
2505
|
$ZodType.init(inst, def);
|
|
2105
|
-
inst._zod.optin
|
|
2506
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2106
2507
|
inst._zod.optout = "optional";
|
|
2107
|
-
|
|
2108
|
-
|
|
2508
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2509
|
+
const values = zod.def.innerType._zod.values;
|
|
2510
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
2109
2511
|
});
|
|
2110
|
-
|
|
2111
|
-
const pattern = def.innerType._zod.pattern;
|
|
2512
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2513
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2112
2514
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2113
2515
|
});
|
|
2114
2516
|
inst._zod.parse = (payload, ctx) => {
|
|
2115
|
-
if (
|
|
2116
|
-
|
|
2117
|
-
const result = def.innerType._zod.run(
|
|
2118
|
-
|
|
2119
|
-
|
|
2517
|
+
if (payload.value === void 0) {
|
|
2518
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
2519
|
+
const result = def.innerType._zod.run({
|
|
2520
|
+
value: payload.value,
|
|
2521
|
+
issues: []
|
|
2522
|
+
}, ctx);
|
|
2523
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2524
|
+
return handleOptionalResult(payload, result);
|
|
2120
2525
|
}
|
|
2121
|
-
if (payload.value === void 0) return payload;
|
|
2122
2526
|
return def.innerType._zod.run(payload, ctx);
|
|
2123
2527
|
};
|
|
2124
2528
|
});
|
|
2125
2529
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2126
2530
|
$ZodOptional.init(inst, def);
|
|
2127
|
-
|
|
2128
|
-
|
|
2531
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2532
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2129
2533
|
inst._zod.parse = (payload, ctx) => {
|
|
2130
2534
|
return def.innerType._zod.run(payload, ctx);
|
|
2131
2535
|
};
|
|
2132
2536
|
});
|
|
2133
2537
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2134
2538
|
$ZodType.init(inst, def);
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
const pattern = def.innerType._zod.pattern;
|
|
2539
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2540
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2541
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2542
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2139
2543
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2140
2544
|
});
|
|
2141
|
-
|
|
2142
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2545
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2546
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
2143
2547
|
});
|
|
2144
2548
|
inst._zod.parse = (payload, ctx) => {
|
|
2145
2549
|
if (payload.value === null) return payload;
|
|
@@ -2148,8 +2552,8 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
|
2148
2552
|
});
|
|
2149
2553
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2150
2554
|
$ZodType.init(inst, def);
|
|
2151
|
-
inst._zod.optin = "
|
|
2152
|
-
|
|
2555
|
+
inst._zod.optin = "defaulted";
|
|
2556
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2153
2557
|
inst._zod.parse = (payload, ctx) => {
|
|
2154
2558
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2155
2559
|
if (payload.value === void 0) {
|
|
@@ -2170,8 +2574,8 @@ function handleDefaultResult(payload, def) {
|
|
|
2170
2574
|
}
|
|
2171
2575
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2172
2576
|
$ZodType.init(inst, def);
|
|
2173
|
-
inst._zod.optin = "
|
|
2174
|
-
|
|
2577
|
+
inst._zod.optin = "defaulted";
|
|
2578
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2175
2579
|
inst._zod.parse = (payload, ctx) => {
|
|
2176
2580
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2177
2581
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -2180,8 +2584,8 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
2180
2584
|
});
|
|
2181
2585
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2182
2586
|
$ZodType.init(inst, def);
|
|
2183
|
-
|
|
2184
|
-
const v = def.innerType._zod.values;
|
|
2587
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2588
|
+
const v = zod.def.innerType._zod.values;
|
|
2185
2589
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2186
2590
|
});
|
|
2187
2591
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2199,46 +2603,41 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2199
2603
|
});
|
|
2200
2604
|
return payload;
|
|
2201
2605
|
}
|
|
2606
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2607
|
+
if (!result.issues.length) {
|
|
2608
|
+
payload.value = result.value;
|
|
2609
|
+
if (result.memo) payload.memo = true;
|
|
2610
|
+
return payload;
|
|
2611
|
+
}
|
|
2612
|
+
payload.value = def.catchValue({
|
|
2613
|
+
...result,
|
|
2614
|
+
value: payload.value,
|
|
2615
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2616
|
+
input: payload.value
|
|
2617
|
+
});
|
|
2618
|
+
return payload;
|
|
2619
|
+
}
|
|
2202
2620
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2203
2621
|
$ZodType.init(inst, def);
|
|
2204
|
-
inst._zod.optin
|
|
2205
|
-
|
|
2206
|
-
|
|
2622
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2623
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2624
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2207
2625
|
inst._zod.parse = (payload, ctx) => {
|
|
2208
2626
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2209
|
-
const result = def.innerType._zod.run(
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2216
|
-
input: payload.value
|
|
2217
|
-
});
|
|
2218
|
-
payload.issues = [];
|
|
2219
|
-
payload.fallback = true;
|
|
2220
|
-
}
|
|
2221
|
-
return payload;
|
|
2222
|
-
});
|
|
2223
|
-
payload.value = result.value;
|
|
2224
|
-
if (result.issues.length) {
|
|
2225
|
-
payload.value = def.catchValue({
|
|
2226
|
-
...payload,
|
|
2227
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2228
|
-
input: payload.value
|
|
2229
|
-
});
|
|
2230
|
-
payload.issues = [];
|
|
2231
|
-
payload.fallback = true;
|
|
2232
|
-
}
|
|
2233
|
-
return payload;
|
|
2627
|
+
const result = def.innerType._zod.run({
|
|
2628
|
+
value: payload.value,
|
|
2629
|
+
issues: []
|
|
2630
|
+
}, ctx);
|
|
2631
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2632
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2234
2633
|
};
|
|
2235
2634
|
});
|
|
2236
2635
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2237
2636
|
$ZodType.init(inst, def);
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2637
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2638
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2639
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2640
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2242
2641
|
inst._zod.parse = (payload, ctx) => {
|
|
2243
2642
|
if (ctx.direction === "backward") {
|
|
2244
2643
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2251,22 +2650,21 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2251
2650
|
};
|
|
2252
2651
|
});
|
|
2253
2652
|
function handlePipeResult(left, next, ctx) {
|
|
2254
|
-
if (left.issues.
|
|
2653
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2255
2654
|
left.aborted = true;
|
|
2256
2655
|
return left;
|
|
2257
2656
|
}
|
|
2258
2657
|
return next._zod.run({
|
|
2259
2658
|
value: left.value,
|
|
2260
|
-
issues: left.issues
|
|
2261
|
-
fallback: left.fallback
|
|
2659
|
+
issues: left.issues
|
|
2262
2660
|
}, ctx);
|
|
2263
2661
|
}
|
|
2264
2662
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2265
2663
|
$ZodType.init(inst, def);
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2664
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2665
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2666
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2667
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2270
2668
|
inst._zod.parse = (payload, ctx) => {
|
|
2271
2669
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2272
2670
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2275,7 +2673,7 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2275
2673
|
};
|
|
2276
2674
|
});
|
|
2277
2675
|
function handleReadonlyResult(payload) {
|
|
2278
|
-
payload.value = Object.freeze(payload.value);
|
|
2676
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
2279
2677
|
return payload;
|
|
2280
2678
|
}
|
|
2281
2679
|
const $ZodLazy = /*@__PURE__*/ $constructor("$ZodLazy", (inst, def) => {
|
|
@@ -2285,10 +2683,10 @@ const $ZodLazy = /*@__PURE__*/ $constructor("$ZodLazy", (inst, def) => {
|
|
|
2285
2683
|
if (!d._cachedInner) d._cachedInner = def.getter();
|
|
2286
2684
|
return d._cachedInner;
|
|
2287
2685
|
});
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2686
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2687
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2688
|
+
defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? void 0);
|
|
2689
|
+
defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? void 0);
|
|
2292
2690
|
inst._zod.parse = (payload, ctx) => {
|
|
2293
2691
|
return inst._zod.innerType._zod.run(payload, ctx);
|
|
2294
2692
|
};
|
|
@@ -2320,7 +2718,265 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2320
2718
|
}
|
|
2321
2719
|
}
|
|
2322
2720
|
//#endregion
|
|
2323
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
2721
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/memoizer.js
|
|
2722
|
+
var $ZodCyclicError = class extends Error {
|
|
2723
|
+
constructor() {
|
|
2724
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2725
|
+
this.name = "ZodCyclicError";
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2728
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2729
|
+
const STATE = "~memo";
|
|
2730
|
+
const NO_ISSUES = [];
|
|
2731
|
+
function cloneIssues(issues) {
|
|
2732
|
+
return issues.map((iss) => iss.path ? {
|
|
2733
|
+
...iss,
|
|
2734
|
+
path: iss.path.slice()
|
|
2735
|
+
} : { ...iss });
|
|
2736
|
+
}
|
|
2737
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2738
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2739
|
+
function isRecursive(inst, stack) {
|
|
2740
|
+
const cached = recursive.get(inst);
|
|
2741
|
+
if (cached !== void 0) return cached;
|
|
2742
|
+
if (stack.has(inst)) return true;
|
|
2743
|
+
stack.add(inst);
|
|
2744
|
+
let result = false;
|
|
2745
|
+
const check = (child) => {
|
|
2746
|
+
if (!result && child?._zod && isRecursive(child, stack)) result = true;
|
|
2747
|
+
};
|
|
2748
|
+
const def = inst._zod.def;
|
|
2749
|
+
if (def.type === "lazy") check(inst._zod.innerType);
|
|
2750
|
+
else {
|
|
2751
|
+
const shape = def.shape;
|
|
2752
|
+
if (shape) for (const key of Reflect.ownKeys(shape)) check(shape[key]);
|
|
2753
|
+
for (const key in def) {
|
|
2754
|
+
const value = def[key];
|
|
2755
|
+
if (!value || typeof value !== "object") continue;
|
|
2756
|
+
if (value._zod) check(value);
|
|
2757
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
stack.delete(inst);
|
|
2761
|
+
recursive.set(inst, result);
|
|
2762
|
+
return result;
|
|
2763
|
+
}
|
|
2764
|
+
function bucketFor(state, inst) {
|
|
2765
|
+
let bucket = state.buckets.get(inst);
|
|
2766
|
+
if (!bucket) {
|
|
2767
|
+
bucket = /* @__PURE__ */ new Map();
|
|
2768
|
+
state.buckets.set(inst, bucket);
|
|
2769
|
+
}
|
|
2770
|
+
return bucket;
|
|
2771
|
+
}
|
|
2772
|
+
let handoff;
|
|
2773
|
+
const open = [];
|
|
2774
|
+
const memo = {
|
|
2775
|
+
alloc(_inst, payload, empty) {
|
|
2776
|
+
const bucket = handoff;
|
|
2777
|
+
if (!bucket) return empty;
|
|
2778
|
+
handoff = void 0;
|
|
2779
|
+
const entry = {
|
|
2780
|
+
value: empty,
|
|
2781
|
+
issues: null
|
|
2782
|
+
};
|
|
2783
|
+
bucket.set(payload.value, entry);
|
|
2784
|
+
open.push(entry);
|
|
2785
|
+
return empty;
|
|
2786
|
+
},
|
|
2787
|
+
guard(inst) {
|
|
2788
|
+
var _a;
|
|
2789
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2790
|
+
inst._zod.deferred.push(() => {
|
|
2791
|
+
const base = inst._zod.parse;
|
|
2792
|
+
const wrapped = (payload, ctx) => {
|
|
2793
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2794
|
+
return base(payload, ctx);
|
|
2795
|
+
};
|
|
2796
|
+
inst._zod.parse = wrapped;
|
|
2797
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2798
|
+
});
|
|
2799
|
+
},
|
|
2800
|
+
attach(inst) {
|
|
2801
|
+
var _a;
|
|
2802
|
+
let isRecursiveInst;
|
|
2803
|
+
let lastCtx;
|
|
2804
|
+
let lastBucket;
|
|
2805
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2806
|
+
inst._zod.deferred.push(() => {
|
|
2807
|
+
const base = inst._zod.parse;
|
|
2808
|
+
const wrapped = (payload, ctx) => {
|
|
2809
|
+
if (isRecursiveInst === void 0) {
|
|
2810
|
+
isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
|
|
2811
|
+
if (!isRecursiveInst) {
|
|
2812
|
+
inst._zod.parse = base;
|
|
2813
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2814
|
+
return base(payload, ctx);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
const input = payload.value;
|
|
2818
|
+
if (input === null || typeof input !== "object") return base(payload, ctx);
|
|
2819
|
+
let state = ctx[STATE];
|
|
2820
|
+
if (!state) {
|
|
2821
|
+
state = {
|
|
2822
|
+
buckets: /* @__PURE__ */ new Map(),
|
|
2823
|
+
backEdges: void 0
|
|
2824
|
+
};
|
|
2825
|
+
ctx[STATE] = state;
|
|
2826
|
+
}
|
|
2827
|
+
let bucket;
|
|
2828
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
2829
|
+
else {
|
|
2830
|
+
bucket = bucketFor(state, inst);
|
|
2831
|
+
lastCtx = ctx;
|
|
2832
|
+
lastBucket = bucket;
|
|
2833
|
+
}
|
|
2834
|
+
const hit = bucket.get(input);
|
|
2835
|
+
if (hit) {
|
|
2836
|
+
payload.value = hit.value;
|
|
2837
|
+
if (hit.issues) {
|
|
2838
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2839
|
+
} else {
|
|
2840
|
+
payload.memo = true;
|
|
2841
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
|
|
2842
|
+
state.backEdges.add(hit.value);
|
|
2843
|
+
}
|
|
2844
|
+
return payload;
|
|
2845
|
+
}
|
|
2846
|
+
handoff = bucket;
|
|
2847
|
+
const depth = open.length;
|
|
2848
|
+
const result = base(payload, ctx);
|
|
2849
|
+
handoff = void 0;
|
|
2850
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
2851
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
2852
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2853
|
+
return r;
|
|
2854
|
+
});
|
|
2855
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2856
|
+
return result;
|
|
2857
|
+
};
|
|
2858
|
+
inst._zod.parse = wrapped;
|
|
2859
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2864
|
+
function memoizer() {
|
|
2865
|
+
return memo;
|
|
2866
|
+
}
|
|
2867
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2868
|
+
function isBackEdge(ctx, value) {
|
|
2869
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
2870
|
+
return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
|
|
2871
|
+
}
|
|
2872
|
+
//#endregion
|
|
2873
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/locales/en.js
|
|
2874
|
+
const error = () => {
|
|
2875
|
+
const Sizable = {
|
|
2876
|
+
string: {
|
|
2877
|
+
unit: "characters",
|
|
2878
|
+
verb: "to have"
|
|
2879
|
+
},
|
|
2880
|
+
file: {
|
|
2881
|
+
unit: "bytes",
|
|
2882
|
+
verb: "to have"
|
|
2883
|
+
},
|
|
2884
|
+
array: {
|
|
2885
|
+
unit: "items",
|
|
2886
|
+
verb: "to have"
|
|
2887
|
+
},
|
|
2888
|
+
set: {
|
|
2889
|
+
unit: "items",
|
|
2890
|
+
verb: "to have"
|
|
2891
|
+
},
|
|
2892
|
+
map: {
|
|
2893
|
+
unit: "entries",
|
|
2894
|
+
verb: "to have"
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
function getSizing(origin) {
|
|
2898
|
+
return Sizable[origin] ?? null;
|
|
2899
|
+
}
|
|
2900
|
+
const FormatDictionary = {
|
|
2901
|
+
regex: "input",
|
|
2902
|
+
email: "email address",
|
|
2903
|
+
url: "URL",
|
|
2904
|
+
emoji: "emoji",
|
|
2905
|
+
uuid: "UUID",
|
|
2906
|
+
uuidv4: "UUIDv4",
|
|
2907
|
+
uuidv6: "UUIDv6",
|
|
2908
|
+
nanoid: "nanoid",
|
|
2909
|
+
guid: "GUID",
|
|
2910
|
+
cuid: "cuid",
|
|
2911
|
+
cuid2: "cuid2",
|
|
2912
|
+
ulid: "ULID",
|
|
2913
|
+
xid: "XID",
|
|
2914
|
+
ksuid: "KSUID",
|
|
2915
|
+
datetime: "ISO datetime",
|
|
2916
|
+
date: "ISO date",
|
|
2917
|
+
time: "ISO time",
|
|
2918
|
+
duration: "ISO duration",
|
|
2919
|
+
ipv4: "IPv4 address",
|
|
2920
|
+
ipv6: "IPv6 address",
|
|
2921
|
+
mac: "MAC address",
|
|
2922
|
+
cidrv4: "IPv4 range",
|
|
2923
|
+
cidrv6: "IPv6 range",
|
|
2924
|
+
base64: "base64-encoded string",
|
|
2925
|
+
base64url: "base64url-encoded string",
|
|
2926
|
+
json_string: "JSON string",
|
|
2927
|
+
e164: "E.164 number",
|
|
2928
|
+
credit_card: "credit card number",
|
|
2929
|
+
jwt: "JWT",
|
|
2930
|
+
template_literal: "input"
|
|
2931
|
+
};
|
|
2932
|
+
const TypeDictionary = { nan: "NaN" };
|
|
2933
|
+
function getTypeName(type, input) {
|
|
2934
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
2935
|
+
return TypeDictionary[type] ?? type;
|
|
2936
|
+
}
|
|
2937
|
+
return (issue) => {
|
|
2938
|
+
switch (issue.code) {
|
|
2939
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
2940
|
+
case "invalid_value":
|
|
2941
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
2942
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
2943
|
+
case "too_big": {
|
|
2944
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
2945
|
+
const sizing = getSizing(issue.origin);
|
|
2946
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
2947
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
2948
|
+
}
|
|
2949
|
+
case "too_small": {
|
|
2950
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
2951
|
+
const sizing = getSizing(issue.origin);
|
|
2952
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
2953
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
2954
|
+
}
|
|
2955
|
+
case "invalid_format": {
|
|
2956
|
+
const _issue = issue;
|
|
2957
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
2958
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
2959
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
2960
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
2961
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
2962
|
+
}
|
|
2963
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
2964
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
2965
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
2966
|
+
case "invalid_union":
|
|
2967
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
2968
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
2969
|
+
return "Invalid input";
|
|
2970
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
2971
|
+
default: return `Invalid input`;
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
};
|
|
2975
|
+
function en_default() {
|
|
2976
|
+
return { localeError: error() };
|
|
2977
|
+
}
|
|
2978
|
+
//#endregion
|
|
2979
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/registries.js
|
|
2324
2980
|
var _a;
|
|
2325
2981
|
var $ZodRegistry = class {
|
|
2326
2982
|
constructor() {
|
|
@@ -2367,7 +3023,7 @@ function registry() {
|
|
|
2367
3023
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2368
3024
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2369
3025
|
//#endregion
|
|
2370
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3026
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/api.js
|
|
2371
3027
|
// @__NO_SIDE_EFFECTS__
|
|
2372
3028
|
function _string(Class, params) {
|
|
2373
3029
|
return new Class({
|
|
@@ -2863,7 +3519,7 @@ function _superRefine(fn, params) {
|
|
|
2863
3519
|
const _issue = issue$2;
|
|
2864
3520
|
if (_issue.fatal) _issue.continue = false;
|
|
2865
3521
|
_issue.code ?? (_issue.code = "custom");
|
|
2866
|
-
|
|
3522
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
2867
3523
|
_issue.inst ?? (_issue.inst = ch);
|
|
2868
3524
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2869
3525
|
payload.issues.push(issue(_issue));
|
|
@@ -2883,7 +3539,11 @@ function _check(fn, params) {
|
|
|
2883
3539
|
return ch;
|
|
2884
3540
|
}
|
|
2885
3541
|
//#endregion
|
|
2886
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3542
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/to-json-schema.js
|
|
3543
|
+
function assignProps(target, ...sources) {
|
|
3544
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3545
|
+
return target;
|
|
3546
|
+
}
|
|
2887
3547
|
function initializeContext(params) {
|
|
2888
3548
|
let target = params?.target ?? "draft-2020-12";
|
|
2889
3549
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -2897,11 +3557,30 @@ function initializeContext(params) {
|
|
|
2897
3557
|
io: params?.io ?? "output",
|
|
2898
3558
|
counter: 0,
|
|
2899
3559
|
seen: /* @__PURE__ */ new Map(),
|
|
3560
|
+
sharedDefsExtractedFor: void 0,
|
|
3561
|
+
sharedEmitDoneFor: void 0,
|
|
2900
3562
|
cycles: params?.cycles ?? "ref",
|
|
2901
3563
|
reused: params?.reused ?? "inline",
|
|
3564
|
+
intersections: [],
|
|
2902
3565
|
external: params?.external ?? void 0
|
|
2903
3566
|
};
|
|
2904
3567
|
}
|
|
3568
|
+
/**
|
|
3569
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3570
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3571
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3572
|
+
*/
|
|
3573
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3574
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3575
|
+
zodSchema: schema,
|
|
3576
|
+
path: params.path,
|
|
3577
|
+
message
|
|
3578
|
+
}) : ctx.unrepresentable;
|
|
3579
|
+
if (result === "any") return false;
|
|
3580
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3581
|
+
Object.assign(json, result);
|
|
3582
|
+
return true;
|
|
3583
|
+
}
|
|
2905
3584
|
function process(schema, ctx, _params = {
|
|
2906
3585
|
path: [],
|
|
2907
3586
|
schemaPath: []
|
|
@@ -2921,6 +3600,8 @@ function process(schema, ctx, _params = {
|
|
|
2921
3600
|
path: _params.path
|
|
2922
3601
|
};
|
|
2923
3602
|
ctx.seen.set(schema, result);
|
|
3603
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
3604
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
2924
3605
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2925
3606
|
if (overrideSchema) result.schema = overrideSchema;
|
|
2926
3607
|
else {
|
|
@@ -2944,7 +3625,7 @@ function process(schema, ctx, _params = {
|
|
|
2944
3625
|
}
|
|
2945
3626
|
}
|
|
2946
3627
|
const meta = ctx.metadataRegistry.get(schema);
|
|
2947
|
-
if (meta)
|
|
3628
|
+
if (meta) assignProps(result.schema, meta);
|
|
2948
3629
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2949
3630
|
delete result.schema.examples;
|
|
2950
3631
|
delete result.schema.default;
|
|
@@ -2953,9 +3634,13 @@ function process(schema, ctx, _params = {
|
|
|
2953
3634
|
delete result.schema._prefault;
|
|
2954
3635
|
return ctx.seen.get(schema).schema;
|
|
2955
3636
|
}
|
|
3637
|
+
function encodeJSONPointerSegment(segment) {
|
|
3638
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3639
|
+
}
|
|
2956
3640
|
function extractDefs(ctx, schema) {
|
|
2957
3641
|
const root = ctx.seen.get(schema);
|
|
2958
3642
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3643
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
2959
3644
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
2960
3645
|
for (const entry of ctx.seen.entries()) {
|
|
2961
3646
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -2975,15 +3660,16 @@ function extractDefs(ctx, schema) {
|
|
|
2975
3660
|
entry[1].defId = id;
|
|
2976
3661
|
return {
|
|
2977
3662
|
defId: id,
|
|
2978
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3663
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
2979
3664
|
};
|
|
2980
3665
|
}
|
|
2981
|
-
|
|
2982
|
-
const defUriPrefix =
|
|
3666
|
+
const uriPrefix = `#`;
|
|
3667
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
3668
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2983
3669
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2984
3670
|
return {
|
|
2985
3671
|
defId,
|
|
2986
|
-
ref: defUriPrefix + defId
|
|
3672
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
2987
3673
|
};
|
|
2988
3674
|
};
|
|
2989
3675
|
const extractToDef = (entry) => {
|
|
@@ -3030,6 +3716,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3030
3716
|
}
|
|
3031
3717
|
}
|
|
3032
3718
|
}
|
|
3719
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3720
|
+
}
|
|
3721
|
+
/** 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. */
|
|
3722
|
+
function compactTypeUnion(schema) {
|
|
3723
|
+
const options = schema.anyOf;
|
|
3724
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3725
|
+
const types = [];
|
|
3726
|
+
for (const option of options) {
|
|
3727
|
+
if (!option || typeof option !== "object") return;
|
|
3728
|
+
compactTypeUnion(option);
|
|
3729
|
+
const keys = Object.keys(option);
|
|
3730
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3731
|
+
const type = option.type;
|
|
3732
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3733
|
+
if (typeof member !== "string") return;
|
|
3734
|
+
if (!types.includes(member)) types.push(member);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
delete schema.anyOf;
|
|
3738
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
3739
|
+
}
|
|
3740
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3741
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3742
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3743
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3744
|
+
"type",
|
|
3745
|
+
"properties",
|
|
3746
|
+
"required",
|
|
3747
|
+
"additionalProperties"
|
|
3748
|
+
]);
|
|
3749
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3750
|
+
/** 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. */
|
|
3751
|
+
function undeclaredConstraint(member) {
|
|
3752
|
+
const extra = member.additionalProperties;
|
|
3753
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3754
|
+
return Object.keys(extra).length ? extra : null;
|
|
3755
|
+
}
|
|
3756
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3757
|
+
function foldObjects(members) {
|
|
3758
|
+
const objects = [];
|
|
3759
|
+
for (const member of members) {
|
|
3760
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3761
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3762
|
+
objects.push(member);
|
|
3763
|
+
}
|
|
3764
|
+
const properties = {};
|
|
3765
|
+
const required = /* @__PURE__ */ new Set();
|
|
3766
|
+
for (const object of objects) {
|
|
3767
|
+
for (const key in object.properties) {
|
|
3768
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3769
|
+
const parts = [];
|
|
3770
|
+
for (const other of objects) {
|
|
3771
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3772
|
+
if (part === null || part === void 0) continue;
|
|
3773
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
3774
|
+
}
|
|
3775
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
3776
|
+
}
|
|
3777
|
+
for (const key of object.required ?? []) required.add(key);
|
|
3778
|
+
}
|
|
3779
|
+
const folded = {
|
|
3780
|
+
type: "object",
|
|
3781
|
+
properties
|
|
3782
|
+
};
|
|
3783
|
+
if (required.size) folded.required = [...required];
|
|
3784
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3785
|
+
else {
|
|
3786
|
+
const constraints = [];
|
|
3787
|
+
for (const object of objects) {
|
|
3788
|
+
const constraint = undeclaredConstraint(object);
|
|
3789
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3790
|
+
}
|
|
3791
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3792
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3793
|
+
}
|
|
3794
|
+
return folded;
|
|
3795
|
+
}
|
|
3796
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3797
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3798
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3799
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3800
|
+
* into one object is the encoding that says so on every target.
|
|
3801
|
+
*
|
|
3802
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3803
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3804
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3805
|
+
function foldIntersection(json) {
|
|
3806
|
+
const allOf = json.allOf;
|
|
3807
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3808
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3809
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3810
|
+
let folded = null;
|
|
3811
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
3812
|
+
else {
|
|
3813
|
+
const union = unions[0];
|
|
3814
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3815
|
+
if (Object.keys(union).length !== 1) return;
|
|
3816
|
+
const rest = allOf.filter((m) => m !== union);
|
|
3817
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3818
|
+
if (branches.some((b) => !b)) return;
|
|
3819
|
+
folded = { [keyword]: branches };
|
|
3820
|
+
}
|
|
3821
|
+
if (!folded) return;
|
|
3822
|
+
delete json.allOf;
|
|
3823
|
+
assignProps(json, folded);
|
|
3033
3824
|
}
|
|
3034
3825
|
function finalize(ctx, schema) {
|
|
3035
3826
|
const root = ctx.seen.get(schema);
|
|
@@ -3048,8 +3839,8 @@ function finalize(ctx, schema) {
|
|
|
3048
3839
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
3049
3840
|
schema.allOf = schema.allOf ?? [];
|
|
3050
3841
|
schema.allOf.push(refSchema);
|
|
3051
|
-
} else
|
|
3052
|
-
|
|
3842
|
+
} else assignProps(schema, refSchema);
|
|
3843
|
+
assignProps(schema, _cached);
|
|
3053
3844
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
3054
3845
|
if (key === "$ref" || key === "allOf") continue;
|
|
3055
3846
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -3077,7 +3868,21 @@ function finalize(ctx, schema) {
|
|
|
3077
3868
|
path: seen.path ?? []
|
|
3078
3869
|
});
|
|
3079
3870
|
};
|
|
3080
|
-
|
|
3871
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
3872
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3873
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3874
|
+
if (ctx.intersections.length) {
|
|
3875
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
3876
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3877
|
+
const allOf = json?.allOf;
|
|
3878
|
+
if (!Array.isArray(allOf)) continue;
|
|
3879
|
+
const existing = carriers.get(allOf);
|
|
3880
|
+
if (existing) existing.push(json);
|
|
3881
|
+
else carriers.set(allOf, [json]);
|
|
3882
|
+
}
|
|
3883
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3081
3886
|
const result = {};
|
|
3082
3887
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3083
3888
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -3088,17 +3893,18 @@ function finalize(ctx, schema) {
|
|
|
3088
3893
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
3089
3894
|
result.$id = ctx.external.uri(id);
|
|
3090
3895
|
}
|
|
3091
|
-
|
|
3896
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
3092
3897
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3093
3898
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
3094
3899
|
const defs = ctx.external?.defs ?? {};
|
|
3095
|
-
for (const entry of ctx.seen.entries()) {
|
|
3900
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
3096
3901
|
const seen = entry[1];
|
|
3097
3902
|
if (seen.def && seen.defId) {
|
|
3098
3903
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
3099
|
-
defs
|
|
3904
|
+
assignProp(defs, seen.defId, seen.def);
|
|
3100
3905
|
}
|
|
3101
3906
|
}
|
|
3907
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
3102
3908
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
3103
3909
|
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
3104
3910
|
else result.definitions = defs;
|
|
@@ -3130,7 +3936,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
3130
3936
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3131
3937
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3132
3938
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3133
|
-
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);
|
|
3939
|
+
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);
|
|
3134
3940
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3135
3941
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3136
3942
|
if (def.type === "pipe") {
|
|
@@ -3178,7 +3984,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3178
3984
|
return finalize(ctx, schema);
|
|
3179
3985
|
};
|
|
3180
3986
|
//#endregion
|
|
3181
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3987
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/json-schema-processors.js
|
|
3182
3988
|
const formatMap = {
|
|
3183
3989
|
guid: "uuid",
|
|
3184
3990
|
url: "uri",
|
|
@@ -3189,13 +3995,13 @@ const formatMap = {
|
|
|
3189
3995
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3190
3996
|
const json = _json;
|
|
3191
3997
|
json.type = "string";
|
|
3192
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3998
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
|
|
3193
3999
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
3194
4000
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3195
4001
|
if (format) {
|
|
3196
4002
|
json.format = formatMap[format] ?? format;
|
|
3197
4003
|
if (json.format === "") delete json.format;
|
|
3198
|
-
if (format === "time") delete json.format;
|
|
4004
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
3199
4005
|
}
|
|
3200
4006
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3201
4007
|
if (patterns && patterns.size > 0) {
|
|
@@ -3207,7 +4013,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3207
4013
|
}))];
|
|
3208
4014
|
}
|
|
3209
4015
|
};
|
|
3210
|
-
const numberProcessor = (schema, ctx, _json,
|
|
4016
|
+
const numberProcessor = (schema, ctx, _json, params) => {
|
|
3211
4017
|
const json = _json;
|
|
3212
4018
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3213
4019
|
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
@@ -3227,7 +4033,10 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
3227
4033
|
json.exclusiveMaximum = true;
|
|
3228
4034
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3229
4035
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
3230
|
-
if (typeof multipleOf === "number")
|
|
4036
|
+
if (typeof multipleOf === "number") {
|
|
4037
|
+
if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
|
|
4038
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
|
|
4039
|
+
}
|
|
3231
4040
|
};
|
|
3232
4041
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3233
4042
|
json.type = "boolean";
|
|
@@ -3245,15 +4054,19 @@ const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
|
3245
4054
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3246
4055
|
const def = schema._zod.def;
|
|
3247
4056
|
const values = getEnumValues(def.entries);
|
|
4057
|
+
if (values.length === 0) {
|
|
4058
|
+
json.not = {};
|
|
4059
|
+
return;
|
|
4060
|
+
}
|
|
3248
4061
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3249
4062
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3250
4063
|
json.enum = values;
|
|
3251
4064
|
};
|
|
3252
|
-
const customProcessor = (
|
|
3253
|
-
|
|
4065
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
4066
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3254
4067
|
};
|
|
3255
|
-
const transformProcessor = (
|
|
3256
|
-
|
|
4068
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
4069
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3257
4070
|
};
|
|
3258
4071
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3259
4072
|
const json = _json;
|
|
@@ -3267,25 +4080,32 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
3267
4080
|
path: [...params.path, "items"]
|
|
3268
4081
|
});
|
|
3269
4082
|
};
|
|
4083
|
+
function inputOptin(schema) {
|
|
4084
|
+
const def = schema._zod.def;
|
|
4085
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
4086
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
4087
|
+
return schema._zod.optin;
|
|
4088
|
+
}
|
|
3270
4089
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3271
4090
|
const json = _json;
|
|
3272
4091
|
const def = schema._zod.def;
|
|
4092
|
+
const shape = def.shape;
|
|
4093
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3273
4094
|
json.type = "object";
|
|
3274
4095
|
json.properties = {};
|
|
3275
|
-
const shape
|
|
3276
|
-
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
4096
|
+
for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
|
|
3277
4097
|
...params,
|
|
3278
4098
|
path: [
|
|
3279
4099
|
...params.path,
|
|
3280
4100
|
"properties",
|
|
3281
4101
|
key
|
|
3282
4102
|
]
|
|
3283
|
-
});
|
|
4103
|
+
}));
|
|
3284
4104
|
const allKeys = new Set(Object.keys(shape));
|
|
3285
4105
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3286
|
-
const
|
|
3287
|
-
if (ctx.io === "input") return
|
|
3288
|
-
else return
|
|
4106
|
+
const field = def.shape[key];
|
|
4107
|
+
if (ctx.io === "input") return inputOptin(field) === void 0;
|
|
4108
|
+
else return field._zod.optout === void 0;
|
|
3289
4109
|
}));
|
|
3290
4110
|
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3291
4111
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
@@ -3329,7 +4149,9 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3329
4149
|
]
|
|
3330
4150
|
});
|
|
3331
4151
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3332
|
-
|
|
4152
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4153
|
+
json.allOf = allOf;
|
|
4154
|
+
ctx.intersections.push(allOf);
|
|
3333
4155
|
};
|
|
3334
4156
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3335
4157
|
const def = schema._zod.def;
|
|
@@ -3346,19 +4168,37 @@ const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3346
4168
|
const seen = ctx.seen.get(schema);
|
|
3347
4169
|
seen.ref = def.innerType;
|
|
3348
4170
|
};
|
|
4171
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
4172
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
4173
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
4174
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4175
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4176
|
+
let unrepresentable = false;
|
|
4177
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
4178
|
+
if (typeof val !== "bigint") return val;
|
|
4179
|
+
unrepresentable = true;
|
|
4180
|
+
return null;
|
|
4181
|
+
});
|
|
4182
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
4183
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4184
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
4185
|
+
}
|
|
3349
4186
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3350
4187
|
const def = schema._zod.def;
|
|
3351
4188
|
process(def.innerType, ctx, params);
|
|
3352
4189
|
const seen = ctx.seen.get(schema);
|
|
3353
4190
|
seen.ref = def.innerType;
|
|
3354
|
-
|
|
4191
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4192
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3355
4193
|
};
|
|
3356
4194
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3357
4195
|
const def = schema._zod.def;
|
|
3358
4196
|
process(def.innerType, ctx, params);
|
|
3359
4197
|
const seen = ctx.seen.get(schema);
|
|
3360
4198
|
seen.ref = def.innerType;
|
|
3361
|
-
if (ctx.io
|
|
4199
|
+
if (ctx.io !== "input") return;
|
|
4200
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4201
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3362
4202
|
};
|
|
3363
4203
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
3364
4204
|
const def = schema._zod.def;
|
|
@@ -3369,7 +4209,8 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
3369
4209
|
try {
|
|
3370
4210
|
catchValue = def.catchValue(void 0);
|
|
3371
4211
|
} catch {
|
|
3372
|
-
|
|
4212
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
4213
|
+
return;
|
|
3373
4214
|
}
|
|
3374
4215
|
json.default = catchValue;
|
|
3375
4216
|
};
|
|
@@ -3394,240 +4235,246 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3394
4235
|
const seen = ctx.seen.get(schema);
|
|
3395
4236
|
seen.ref = def.innerType;
|
|
3396
4237
|
};
|
|
3397
|
-
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
3398
|
-
const innerType = schema._zod.innerType;
|
|
3399
|
-
process(innerType, ctx, params);
|
|
3400
|
-
const seen = ctx.seen.get(schema);
|
|
3401
|
-
seen.ref = innerType;
|
|
3402
|
-
};
|
|
3403
|
-
//#endregion
|
|
3404
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3405
|
-
const
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
}
|
|
3419
|
-
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
3420
|
-
$ZodISOTime.init(inst, def);
|
|
3421
|
-
ZodStringFormat.init(inst, def);
|
|
3422
|
-
});
|
|
3423
|
-
function time(params) {
|
|
3424
|
-
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3425
|
-
}
|
|
3426
|
-
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
3427
|
-
$ZodISODuration.init(inst, def);
|
|
3428
|
-
ZodStringFormat.init(inst, def);
|
|
3429
|
-
});
|
|
3430
|
-
function duration(params) {
|
|
3431
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3432
|
-
}
|
|
3433
|
-
//#endregion
|
|
3434
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
3435
|
-
const initializer = (inst, issues) => {
|
|
3436
|
-
$ZodError.init(inst, issues);
|
|
3437
|
-
inst.name = "ZodError";
|
|
3438
|
-
Object.defineProperties(inst, {
|
|
3439
|
-
format: { value: (mapper) => formatError(inst, mapper) },
|
|
3440
|
-
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
3441
|
-
addIssue: { value: (issue) => {
|
|
3442
|
-
inst.issues.push(issue);
|
|
3443
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3444
|
-
} },
|
|
3445
|
-
addIssues: { value: (issues) => {
|
|
3446
|
-
inst.issues.push(...issues);
|
|
3447
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3448
|
-
} },
|
|
3449
|
-
isEmpty: { get() {
|
|
3450
|
-
return inst.issues.length === 0;
|
|
3451
|
-
} }
|
|
3452
|
-
});
|
|
3453
|
-
};
|
|
3454
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
3455
|
-
//#endregion
|
|
3456
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
3457
|
-
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3458
|
-
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3459
|
-
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
3460
|
-
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3461
|
-
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3462
|
-
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3463
|
-
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
3464
|
-
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
3465
|
-
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3466
|
-
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3467
|
-
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3468
|
-
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3469
|
-
//#endregion
|
|
3470
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
3471
|
-
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
3472
|
-
function _installLazyMethods(inst, group, methods) {
|
|
3473
|
-
const proto = Object.getPrototypeOf(inst);
|
|
3474
|
-
let installed = _installedGroups.get(proto);
|
|
3475
|
-
if (!installed) {
|
|
3476
|
-
installed = /* @__PURE__ */ new Set();
|
|
3477
|
-
_installedGroups.set(proto, installed);
|
|
3478
|
-
}
|
|
3479
|
-
if (installed.has(group)) return;
|
|
3480
|
-
installed.add(group);
|
|
3481
|
-
for (const key in methods) {
|
|
3482
|
-
const fn = methods[key];
|
|
3483
|
-
Object.defineProperty(proto, key, {
|
|
3484
|
-
configurable: true,
|
|
3485
|
-
enumerable: false,
|
|
3486
|
-
get() {
|
|
3487
|
-
const bound = fn.bind(this);
|
|
3488
|
-
Object.defineProperty(this, key, {
|
|
3489
|
-
configurable: true,
|
|
3490
|
-
writable: true,
|
|
3491
|
-
enumerable: true,
|
|
3492
|
-
value: bound
|
|
3493
|
-
});
|
|
3494
|
-
return bound;
|
|
3495
|
-
},
|
|
3496
|
-
set(v) {
|
|
3497
|
-
Object.defineProperty(this, key, {
|
|
3498
|
-
configurable: true,
|
|
3499
|
-
writable: true,
|
|
3500
|
-
enumerable: true,
|
|
3501
|
-
value: v
|
|
3502
|
-
});
|
|
3503
|
-
}
|
|
3504
|
-
});
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
3508
|
-
$ZodType.init(inst, def);
|
|
3509
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3510
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3511
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3512
|
-
} });
|
|
3513
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3514
|
-
inst.def = def;
|
|
3515
|
-
inst.type = def.type;
|
|
3516
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3517
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3518
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3519
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3520
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3521
|
-
inst.spa = inst.safeParseAsync;
|
|
3522
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3523
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3524
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3525
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3526
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3527
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3528
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3529
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3530
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3531
|
-
check(...chks) {
|
|
3532
|
-
const def = this.def;
|
|
3533
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3534
|
-
check: ch,
|
|
3535
|
-
def: { check: "custom" },
|
|
3536
|
-
onattach: []
|
|
3537
|
-
} } : ch)] }), { parent: true });
|
|
3538
|
-
},
|
|
3539
|
-
with(...chks) {
|
|
3540
|
-
return this.check(...chks);
|
|
3541
|
-
},
|
|
3542
|
-
clone(def, params) {
|
|
3543
|
-
return clone(this, def, params);
|
|
3544
|
-
},
|
|
3545
|
-
brand() {
|
|
3546
|
-
return this;
|
|
3547
|
-
},
|
|
3548
|
-
register(reg, meta) {
|
|
3549
|
-
reg.add(this, meta);
|
|
3550
|
-
return this;
|
|
3551
|
-
},
|
|
3552
|
-
refine(check, params) {
|
|
3553
|
-
return this.check(refine(check, params));
|
|
3554
|
-
},
|
|
3555
|
-
superRefine(refinement, params) {
|
|
3556
|
-
return this.check(superRefine(refinement, params));
|
|
3557
|
-
},
|
|
3558
|
-
overwrite(fn) {
|
|
3559
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3560
|
-
},
|
|
3561
|
-
optional() {
|
|
3562
|
-
return optional(this);
|
|
3563
|
-
},
|
|
3564
|
-
exactOptional() {
|
|
3565
|
-
return exactOptional(this);
|
|
3566
|
-
},
|
|
3567
|
-
nullable() {
|
|
3568
|
-
return nullable(this);
|
|
3569
|
-
},
|
|
3570
|
-
nullish() {
|
|
3571
|
-
return optional(nullable(this));
|
|
3572
|
-
},
|
|
3573
|
-
nonoptional(params) {
|
|
3574
|
-
return nonoptional(this, params);
|
|
3575
|
-
},
|
|
3576
|
-
array() {
|
|
3577
|
-
return array(this);
|
|
3578
|
-
},
|
|
3579
|
-
or(arg) {
|
|
3580
|
-
return union([this, arg]);
|
|
3581
|
-
},
|
|
3582
|
-
and(arg) {
|
|
3583
|
-
return intersection(this, arg);
|
|
3584
|
-
},
|
|
3585
|
-
transform(tx) {
|
|
3586
|
-
return pipe(this, transform(tx));
|
|
3587
|
-
},
|
|
3588
|
-
default(d) {
|
|
3589
|
-
return _default(this, d);
|
|
3590
|
-
},
|
|
3591
|
-
prefault(d) {
|
|
3592
|
-
return prefault(this, d);
|
|
3593
|
-
},
|
|
3594
|
-
catch(params) {
|
|
3595
|
-
return _catch(this, params);
|
|
3596
|
-
},
|
|
3597
|
-
pipe(target) {
|
|
3598
|
-
return pipe(this, target);
|
|
3599
|
-
},
|
|
3600
|
-
readonly() {
|
|
3601
|
-
return readonly(this);
|
|
3602
|
-
},
|
|
3603
|
-
describe(description) {
|
|
3604
|
-
const cl = this.clone();
|
|
3605
|
-
globalRegistry.add(cl, { description });
|
|
3606
|
-
return cl;
|
|
3607
|
-
},
|
|
3608
|
-
meta(...args) {
|
|
3609
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
3610
|
-
const cl = this.clone();
|
|
3611
|
-
globalRegistry.add(cl, args[0]);
|
|
3612
|
-
return cl;
|
|
3613
|
-
},
|
|
3614
|
-
isOptional() {
|
|
3615
|
-
return this.safeParse(void 0).success;
|
|
3616
|
-
},
|
|
3617
|
-
isNullable() {
|
|
3618
|
-
return this.safeParse(null).success;
|
|
4238
|
+
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
4239
|
+
const innerType = schema._zod.innerType;
|
|
4240
|
+
process(innerType, ctx, params);
|
|
4241
|
+
const seen = ctx.seen.get(schema);
|
|
4242
|
+
seen.ref = innerType;
|
|
4243
|
+
};
|
|
4244
|
+
//#endregion
|
|
4245
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/errors.js
|
|
4246
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4247
|
+
function _lazyMethod(proto, key, make) {
|
|
4248
|
+
Object.defineProperty(proto, key, {
|
|
4249
|
+
configurable: true,
|
|
4250
|
+
enumerable: false,
|
|
4251
|
+
get() {
|
|
4252
|
+
const value = make(this);
|
|
4253
|
+
Object.defineProperty(this, key, {
|
|
4254
|
+
value,
|
|
4255
|
+
configurable: true,
|
|
4256
|
+
writable: true
|
|
4257
|
+
});
|
|
4258
|
+
return value;
|
|
3619
4259
|
},
|
|
3620
|
-
|
|
3621
|
-
|
|
4260
|
+
set(value) {
|
|
4261
|
+
Object.defineProperty(this, key, {
|
|
4262
|
+
value,
|
|
4263
|
+
configurable: true,
|
|
4264
|
+
writable: true
|
|
4265
|
+
});
|
|
3622
4266
|
}
|
|
3623
4267
|
});
|
|
3624
|
-
|
|
4268
|
+
}
|
|
4269
|
+
const initializer = (inst, issues) => {
|
|
4270
|
+
$ZodError.init(inst, issues);
|
|
4271
|
+
inst.name = "ZodError";
|
|
4272
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4273
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
4274
|
+
_installedErrorProtos.add(proto);
|
|
4275
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4276
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4277
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
4278
|
+
self.issues.push(issue);
|
|
4279
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4280
|
+
});
|
|
4281
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
4282
|
+
self.issues.push(...issues);
|
|
4283
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4284
|
+
});
|
|
4285
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4286
|
+
configurable: true,
|
|
4287
|
+
enumerable: false,
|
|
3625
4288
|
get() {
|
|
3626
|
-
return
|
|
3627
|
-
}
|
|
3628
|
-
configurable: true
|
|
4289
|
+
return this.issues.length === 0;
|
|
4290
|
+
}
|
|
3629
4291
|
});
|
|
4292
|
+
};
|
|
4293
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
4294
|
+
//#endregion
|
|
4295
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/parse.js
|
|
4296
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4297
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4298
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
4299
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
4300
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
4301
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
4302
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
4303
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
4304
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
4305
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
4306
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4307
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4308
|
+
//#endregion
|
|
4309
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/schemas.js
|
|
4310
|
+
function _ensureDefaultLocale() {
|
|
4311
|
+
if (!globalConfig.localeError) config(en_default());
|
|
4312
|
+
}
|
|
4313
|
+
function _ensureDefaultMemoizer() {
|
|
4314
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
4315
|
+
}
|
|
4316
|
+
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4317
|
+
_ensureDefaultLocale();
|
|
4318
|
+
$ZodType.init(inst, def);
|
|
4319
|
+
inst.def = def;
|
|
4320
|
+
inst.type = def.type;
|
|
3630
4321
|
return inst;
|
|
4322
|
+
}, {
|
|
4323
|
+
check(...chks) {
|
|
4324
|
+
const def = this.def;
|
|
4325
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4326
|
+
check: ch,
|
|
4327
|
+
def: { check: "custom" },
|
|
4328
|
+
onattach: []
|
|
4329
|
+
} } : ch)] }), { parent: true });
|
|
4330
|
+
},
|
|
4331
|
+
with(...chks) {
|
|
4332
|
+
return this.check(...chks);
|
|
4333
|
+
},
|
|
4334
|
+
clone(def, params) {
|
|
4335
|
+
return clone(this, def, params);
|
|
4336
|
+
},
|
|
4337
|
+
brand() {
|
|
4338
|
+
return this;
|
|
4339
|
+
},
|
|
4340
|
+
register(reg, meta) {
|
|
4341
|
+
reg.add(this, meta);
|
|
4342
|
+
return this;
|
|
4343
|
+
},
|
|
4344
|
+
refine(check, params) {
|
|
4345
|
+
return this.check(refine(check, params));
|
|
4346
|
+
},
|
|
4347
|
+
superRefine(refinement, params) {
|
|
4348
|
+
return this.check(superRefine(refinement, params));
|
|
4349
|
+
},
|
|
4350
|
+
overwrite(fn) {
|
|
4351
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4352
|
+
},
|
|
4353
|
+
optional() {
|
|
4354
|
+
return optional(this);
|
|
4355
|
+
},
|
|
4356
|
+
exactOptional() {
|
|
4357
|
+
return exactOptional(this);
|
|
4358
|
+
},
|
|
4359
|
+
nullable() {
|
|
4360
|
+
return nullable(this);
|
|
4361
|
+
},
|
|
4362
|
+
nullish() {
|
|
4363
|
+
return optional(nullable(this));
|
|
4364
|
+
},
|
|
4365
|
+
nonoptional(params) {
|
|
4366
|
+
return nonoptional(this, params);
|
|
4367
|
+
},
|
|
4368
|
+
array() {
|
|
4369
|
+
return array(this);
|
|
4370
|
+
},
|
|
4371
|
+
or(arg) {
|
|
4372
|
+
return union([this, arg]);
|
|
4373
|
+
},
|
|
4374
|
+
and(arg) {
|
|
4375
|
+
return intersection(this, arg);
|
|
4376
|
+
},
|
|
4377
|
+
transform(tx) {
|
|
4378
|
+
return pipe(this, transform(tx));
|
|
4379
|
+
},
|
|
4380
|
+
default(d) {
|
|
4381
|
+
return _default(this, d);
|
|
4382
|
+
},
|
|
4383
|
+
prefault(d) {
|
|
4384
|
+
return prefault(this, d);
|
|
4385
|
+
},
|
|
4386
|
+
catch(params) {
|
|
4387
|
+
return _catch(this, params);
|
|
4388
|
+
},
|
|
4389
|
+
pipe(target) {
|
|
4390
|
+
return pipe(this, target);
|
|
4391
|
+
},
|
|
4392
|
+
readonly() {
|
|
4393
|
+
return readonly(this);
|
|
4394
|
+
},
|
|
4395
|
+
describe(description) {
|
|
4396
|
+
const cl = this.clone();
|
|
4397
|
+
globalRegistry.add(cl, { description });
|
|
4398
|
+
return cl;
|
|
4399
|
+
},
|
|
4400
|
+
meta(...args) {
|
|
4401
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
4402
|
+
const cl = this.clone();
|
|
4403
|
+
globalRegistry.add(cl, args[0]);
|
|
4404
|
+
return cl;
|
|
4405
|
+
},
|
|
4406
|
+
isOptional() {
|
|
4407
|
+
return this.safeParse(void 0).success;
|
|
4408
|
+
},
|
|
4409
|
+
isNullable() {
|
|
4410
|
+
return this.safeParse(null).success;
|
|
4411
|
+
},
|
|
4412
|
+
apply(fn, ...args) {
|
|
4413
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4414
|
+
},
|
|
4415
|
+
get "~standard"() {
|
|
4416
|
+
return hide(this, "~standard", {
|
|
4417
|
+
...standardProps(this),
|
|
4418
|
+
jsonSchema: {
|
|
4419
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4420
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
4421
|
+
}
|
|
4422
|
+
});
|
|
4423
|
+
},
|
|
4424
|
+
set "~standard"(value) {
|
|
4425
|
+
own(this, "~standard", value);
|
|
4426
|
+
},
|
|
4427
|
+
parse: function _parse(data, params) {
|
|
4428
|
+
return parse(this, data, params, { callee: _parse });
|
|
4429
|
+
},
|
|
4430
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
4431
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4432
|
+
},
|
|
4433
|
+
safeParse(data, params) {
|
|
4434
|
+
return safeParse(this, data, params);
|
|
4435
|
+
},
|
|
4436
|
+
async safeParseAsync(data, params) {
|
|
4437
|
+
return safeParseAsync(this, data, params);
|
|
4438
|
+
},
|
|
4439
|
+
get spa() {
|
|
4440
|
+
return this?.safeParseAsync;
|
|
4441
|
+
},
|
|
4442
|
+
set spa(value) {
|
|
4443
|
+
own(this, "spa", value);
|
|
4444
|
+
},
|
|
4445
|
+
encode: function _encode(data, params) {
|
|
4446
|
+
return encode(this, data, params, { callee: _encode });
|
|
4447
|
+
},
|
|
4448
|
+
decode: function _decode(data, params) {
|
|
4449
|
+
return decode(this, data, params, { callee: _decode });
|
|
4450
|
+
},
|
|
4451
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
4452
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4453
|
+
},
|
|
4454
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
4455
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4456
|
+
},
|
|
4457
|
+
safeEncode(data, params) {
|
|
4458
|
+
return safeEncode(this, data, params);
|
|
4459
|
+
},
|
|
4460
|
+
safeDecode(data, params) {
|
|
4461
|
+
return safeDecode(this, data, params);
|
|
4462
|
+
},
|
|
4463
|
+
async safeEncodeAsync(data, params) {
|
|
4464
|
+
return safeEncodeAsync(this, data, params);
|
|
4465
|
+
},
|
|
4466
|
+
async safeDecodeAsync(data, params) {
|
|
4467
|
+
return safeDecodeAsync(this, data, params);
|
|
4468
|
+
},
|
|
4469
|
+
toJSONSchema(params) {
|
|
4470
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
4471
|
+
},
|
|
4472
|
+
get description() {
|
|
4473
|
+
return globalRegistry.get(this)?.description;
|
|
4474
|
+
},
|
|
4475
|
+
get _def() {
|
|
4476
|
+
return this._zod.def;
|
|
4477
|
+
}
|
|
3631
4478
|
});
|
|
3632
4479
|
/** @internal */
|
|
3633
4480
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
@@ -3638,84 +4485,135 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
3638
4485
|
inst.format = bag.format ?? null;
|
|
3639
4486
|
inst.minLength = bag.minimum ?? null;
|
|
3640
4487
|
inst.maxLength = bag.maximum ?? null;
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
});
|
|
4488
|
+
}, {
|
|
4489
|
+
regex(...args) {
|
|
4490
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4491
|
+
},
|
|
4492
|
+
includes(...args) {
|
|
4493
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4494
|
+
},
|
|
4495
|
+
startsWith(...args) {
|
|
4496
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4497
|
+
},
|
|
4498
|
+
endsWith(...args) {
|
|
4499
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4500
|
+
},
|
|
4501
|
+
min(...args) {
|
|
4502
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4503
|
+
},
|
|
4504
|
+
max(...args) {
|
|
4505
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4506
|
+
},
|
|
4507
|
+
length(...args) {
|
|
4508
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
4509
|
+
},
|
|
4510
|
+
nonempty(...args) {
|
|
4511
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4512
|
+
},
|
|
4513
|
+
lowercase(params) {
|
|
4514
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4515
|
+
},
|
|
4516
|
+
uppercase(params) {
|
|
4517
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4518
|
+
},
|
|
4519
|
+
trim() {
|
|
4520
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
4521
|
+
},
|
|
4522
|
+
normalize(...args) {
|
|
4523
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4524
|
+
},
|
|
4525
|
+
toLowerCase() {
|
|
4526
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4527
|
+
},
|
|
4528
|
+
toUpperCase() {
|
|
4529
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4530
|
+
},
|
|
4531
|
+
slugify() {
|
|
4532
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
4533
|
+
}
|
|
3688
4534
|
});
|
|
3689
4535
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3690
4536
|
$ZodString.init(inst, def);
|
|
3691
4537
|
_ZodString.init(inst, def);
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
4538
|
+
}, {
|
|
4539
|
+
email(params) {
|
|
4540
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4541
|
+
},
|
|
4542
|
+
url(params) {
|
|
4543
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4544
|
+
},
|
|
4545
|
+
jwt(params) {
|
|
4546
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4547
|
+
},
|
|
4548
|
+
emoji(params) {
|
|
4549
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4550
|
+
},
|
|
4551
|
+
guid(params) {
|
|
4552
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4553
|
+
},
|
|
4554
|
+
uuid(params) {
|
|
4555
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4556
|
+
},
|
|
4557
|
+
uuidv4(params) {
|
|
4558
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4559
|
+
},
|
|
4560
|
+
uuidv6(params) {
|
|
4561
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4562
|
+
},
|
|
4563
|
+
uuidv7(params) {
|
|
4564
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4565
|
+
},
|
|
4566
|
+
nanoid(params) {
|
|
4567
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4568
|
+
},
|
|
4569
|
+
cuid(params) {
|
|
4570
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4571
|
+
},
|
|
4572
|
+
cuid2(params) {
|
|
4573
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4574
|
+
},
|
|
4575
|
+
ulid(params) {
|
|
4576
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4577
|
+
},
|
|
4578
|
+
base64(params) {
|
|
4579
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4580
|
+
},
|
|
4581
|
+
base64url(params) {
|
|
4582
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4583
|
+
},
|
|
4584
|
+
xid(params) {
|
|
4585
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4586
|
+
},
|
|
4587
|
+
ksuid(params) {
|
|
4588
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4589
|
+
},
|
|
4590
|
+
ipv4(params) {
|
|
4591
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4592
|
+
},
|
|
4593
|
+
ipv6(params) {
|
|
4594
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4595
|
+
},
|
|
4596
|
+
cidrv4(params) {
|
|
4597
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4598
|
+
},
|
|
4599
|
+
cidrv6(params) {
|
|
4600
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4601
|
+
},
|
|
4602
|
+
e164(params) {
|
|
4603
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4604
|
+
},
|
|
4605
|
+
datetime(params) {
|
|
4606
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4607
|
+
},
|
|
4608
|
+
date(params) {
|
|
4609
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4610
|
+
},
|
|
4611
|
+
time(params) {
|
|
4612
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4613
|
+
},
|
|
4614
|
+
duration(params) {
|
|
4615
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4616
|
+
}
|
|
3719
4617
|
});
|
|
3720
4618
|
function string(params) {
|
|
3721
4619
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -3724,6 +4622,22 @@ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def
|
|
|
3724
4622
|
$ZodStringFormat.init(inst, def);
|
|
3725
4623
|
_ZodString.init(inst, def);
|
|
3726
4624
|
});
|
|
4625
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4626
|
+
$ZodISODateTime.init(inst, def);
|
|
4627
|
+
ZodStringFormat.init(inst, def);
|
|
4628
|
+
});
|
|
4629
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4630
|
+
$ZodISODate.init(inst, def);
|
|
4631
|
+
ZodStringFormat.init(inst, def);
|
|
4632
|
+
});
|
|
4633
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4634
|
+
$ZodISOTime.init(inst, def);
|
|
4635
|
+
ZodStringFormat.init(inst, def);
|
|
4636
|
+
});
|
|
4637
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4638
|
+
$ZodISODuration.init(inst, def);
|
|
4639
|
+
ZodStringFormat.init(inst, def);
|
|
4640
|
+
});
|
|
3727
4641
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3728
4642
|
$ZodEmail.init(inst, def);
|
|
3729
4643
|
ZodStringFormat.init(inst, def);
|
|
@@ -3809,59 +4723,58 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
3809
4723
|
$ZodNumber.init(inst, def);
|
|
3810
4724
|
ZodType.init(inst, def);
|
|
3811
4725
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3812
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
3813
|
-
gt(value, params) {
|
|
3814
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3815
|
-
},
|
|
3816
|
-
gte(value, params) {
|
|
3817
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3818
|
-
},
|
|
3819
|
-
min(value, params) {
|
|
3820
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3821
|
-
},
|
|
3822
|
-
lt(value, params) {
|
|
3823
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3824
|
-
},
|
|
3825
|
-
lte(value, params) {
|
|
3826
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3827
|
-
},
|
|
3828
|
-
max(value, params) {
|
|
3829
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3830
|
-
},
|
|
3831
|
-
int(params) {
|
|
3832
|
-
return this.check(int(params));
|
|
3833
|
-
},
|
|
3834
|
-
safe(params) {
|
|
3835
|
-
return this.check(int(params));
|
|
3836
|
-
},
|
|
3837
|
-
positive(params) {
|
|
3838
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3839
|
-
},
|
|
3840
|
-
nonnegative(params) {
|
|
3841
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3842
|
-
},
|
|
3843
|
-
negative(params) {
|
|
3844
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3845
|
-
},
|
|
3846
|
-
nonpositive(params) {
|
|
3847
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3848
|
-
},
|
|
3849
|
-
multipleOf(value, params) {
|
|
3850
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3851
|
-
},
|
|
3852
|
-
step(value, params) {
|
|
3853
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3854
|
-
},
|
|
3855
|
-
finite() {
|
|
3856
|
-
return this;
|
|
3857
|
-
}
|
|
3858
|
-
});
|
|
3859
4726
|
const bag = inst._zod.bag;
|
|
3860
4727
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3861
4728
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3862
4729
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3863
4730
|
inst.isFinite = true;
|
|
3864
4731
|
inst.format = bag.format ?? null;
|
|
4732
|
+
}, {
|
|
4733
|
+
gt(value, params) {
|
|
4734
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
4735
|
+
},
|
|
4736
|
+
gte(value, params) {
|
|
4737
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4738
|
+
},
|
|
4739
|
+
min(value, params) {
|
|
4740
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4741
|
+
},
|
|
4742
|
+
lt(value, params) {
|
|
4743
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
4744
|
+
},
|
|
4745
|
+
lte(value, params) {
|
|
4746
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4747
|
+
},
|
|
4748
|
+
max(value, params) {
|
|
4749
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4750
|
+
},
|
|
4751
|
+
int(params) {
|
|
4752
|
+
return this.check(int(params));
|
|
4753
|
+
},
|
|
4754
|
+
safe(params) {
|
|
4755
|
+
return this.check(int(params));
|
|
4756
|
+
},
|
|
4757
|
+
positive(params) {
|
|
4758
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
4759
|
+
},
|
|
4760
|
+
nonnegative(params) {
|
|
4761
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
4762
|
+
},
|
|
4763
|
+
negative(params) {
|
|
4764
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
4765
|
+
},
|
|
4766
|
+
nonpositive(params) {
|
|
4767
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
4768
|
+
},
|
|
4769
|
+
multipleOf(value, params) {
|
|
4770
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4771
|
+
},
|
|
4772
|
+
step(value, params) {
|
|
4773
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4774
|
+
},
|
|
4775
|
+
finite() {
|
|
4776
|
+
return this;
|
|
4777
|
+
}
|
|
3865
4778
|
});
|
|
3866
4779
|
function number(params) {
|
|
3867
4780
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
@@ -3914,94 +4827,95 @@ function never(params) {
|
|
|
3914
4827
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3915
4828
|
}
|
|
3916
4829
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
4830
|
+
_ensureDefaultMemoizer();
|
|
3917
4831
|
$ZodArray.init(inst, def);
|
|
3918
4832
|
ZodType.init(inst, def);
|
|
3919
4833
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3920
4834
|
inst.element = def.element;
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
});
|
|
4835
|
+
}, {
|
|
4836
|
+
min(n, params) {
|
|
4837
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
4838
|
+
},
|
|
4839
|
+
nonempty(params) {
|
|
4840
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
4841
|
+
},
|
|
4842
|
+
max(n, params) {
|
|
4843
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
4844
|
+
},
|
|
4845
|
+
length(n, params) {
|
|
4846
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
4847
|
+
},
|
|
4848
|
+
unwrap() {
|
|
4849
|
+
return this.element;
|
|
4850
|
+
}
|
|
3938
4851
|
});
|
|
3939
4852
|
function array(element, params) {
|
|
3940
4853
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3941
4854
|
}
|
|
3942
4855
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
4856
|
+
_ensureDefaultMemoizer();
|
|
3943
4857
|
$ZodObjectJIT.init(inst, def);
|
|
3944
4858
|
ZodType.init(inst, def);
|
|
3945
4859
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
}
|
|
4860
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
4861
|
+
}, {
|
|
4862
|
+
keyof() {
|
|
4863
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
4864
|
+
},
|
|
4865
|
+
catchall(catchall) {
|
|
4866
|
+
return this.clone({
|
|
4867
|
+
...this._zod.def,
|
|
4868
|
+
catchall
|
|
4869
|
+
});
|
|
4870
|
+
},
|
|
4871
|
+
passthrough() {
|
|
4872
|
+
return this.clone({
|
|
4873
|
+
...this._zod.def,
|
|
4874
|
+
catchall: unknown()
|
|
4875
|
+
});
|
|
4876
|
+
},
|
|
4877
|
+
loose() {
|
|
4878
|
+
return this.clone({
|
|
4879
|
+
...this._zod.def,
|
|
4880
|
+
catchall: unknown()
|
|
4881
|
+
});
|
|
4882
|
+
},
|
|
4883
|
+
strict() {
|
|
4884
|
+
return this.clone({
|
|
4885
|
+
...this._zod.def,
|
|
4886
|
+
catchall: never()
|
|
4887
|
+
});
|
|
4888
|
+
},
|
|
4889
|
+
strip() {
|
|
4890
|
+
return this.clone({
|
|
4891
|
+
...this._zod.def,
|
|
4892
|
+
catchall: void 0
|
|
4893
|
+
});
|
|
4894
|
+
},
|
|
4895
|
+
extend(incoming) {
|
|
4896
|
+
return extend(this, incoming);
|
|
4897
|
+
},
|
|
4898
|
+
safeExtend(incoming) {
|
|
4899
|
+
return safeExtend(this, incoming);
|
|
4900
|
+
},
|
|
4901
|
+
merge(other) {
|
|
4902
|
+
return merge(this, other);
|
|
4903
|
+
},
|
|
4904
|
+
pick(mask) {
|
|
4905
|
+
return pick(this, mask);
|
|
4906
|
+
},
|
|
4907
|
+
omit(mask) {
|
|
4908
|
+
return omit(this, mask);
|
|
4909
|
+
},
|
|
4910
|
+
partial(...args) {
|
|
4911
|
+
return partial(ZodOptional, this, args[0]);
|
|
4912
|
+
},
|
|
4913
|
+
exactPartial(...args) {
|
|
4914
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
4915
|
+
},
|
|
4916
|
+
required(...args) {
|
|
4917
|
+
return required(ZodNonOptional, this, args[0]);
|
|
4918
|
+
}
|
|
4005
4919
|
});
|
|
4006
4920
|
function object(shape, params) {
|
|
4007
4921
|
const def = {
|
|
@@ -4075,6 +4989,7 @@ function _enum(values, params) {
|
|
|
4075
4989
|
});
|
|
4076
4990
|
}
|
|
4077
4991
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
4992
|
+
_ensureDefaultMemoizer();
|
|
4078
4993
|
$ZodTransform.init(inst, def);
|
|
4079
4994
|
ZodType.init(inst, def);
|
|
4080
4995
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -4086,7 +5001,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
4086
5001
|
const _issue = issue$1;
|
|
4087
5002
|
if (_issue.fatal) _issue.continue = false;
|
|
4088
5003
|
_issue.code ?? (_issue.code = "custom");
|
|
4089
|
-
|
|
5004
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
4090
5005
|
_issue.inst ?? (_issue.inst = inst);
|
|
4091
5006
|
payload.issues.push(issue(_issue));
|
|
4092
5007
|
}
|
|
@@ -4094,11 +5009,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
4094
5009
|
const output = def.transform(payload.value, payload);
|
|
4095
5010
|
if (output instanceof Promise) return output.then((output) => {
|
|
4096
5011
|
payload.value = output;
|
|
4097
|
-
payload.fallback = true;
|
|
4098
5012
|
return payload;
|
|
4099
5013
|
});
|
|
4100
5014
|
payload.value = output;
|
|
4101
|
-
payload.fallback = true;
|
|
4102
5015
|
return payload;
|
|
4103
5016
|
};
|
|
4104
5017
|
});
|
|
@@ -4199,7 +5112,7 @@ function _catch(innerType, catchValue) {
|
|
|
4199
5112
|
return new ZodCatch({
|
|
4200
5113
|
type: "catch",
|
|
4201
5114
|
innerType,
|
|
4202
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
5115
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
4203
5116
|
});
|
|
4204
5117
|
}
|
|
4205
5118
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -4252,6 +5165,11 @@ function superRefine(fn, params) {
|
|
|
4252
5165
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4253
5166
|
}
|
|
4254
5167
|
//#endregion
|
|
5168
|
+
//#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/iso.js
|
|
5169
|
+
function datetime(params) {
|
|
5170
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
5171
|
+
}
|
|
5172
|
+
//#endregion
|
|
4255
5173
|
//#region ../../node_modules/.pnpm/serialize-error@12.0.0/node_modules/serialize-error/error-constructors.js
|
|
4256
5174
|
const list = [
|
|
4257
5175
|
Error,
|
|
@@ -8461,6 +9379,20 @@ union([
|
|
|
8461
9379
|
"updatedAt": datetime().describe("Timestamp when the state changed")
|
|
8462
9380
|
})
|
|
8463
9381
|
]).describe("Represents a change to an event");
|
|
9382
|
+
/**
|
|
9383
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
9384
|
+
* Do not edit manually.
|
|
9385
|
+
*/
|
|
9386
|
+
/**
|
|
9387
|
+
* @description GCP: the Agent Platform template sessions are cut from, and the engine it hangs under.\n\nNo session count: that needs `aiplatform.sandboxEnvironments.list`, which only the management\npermission set holds. No template state either — emission is gated on reading it `ACTIVE`,\nwhich is what `status` already says.
|
|
9388
|
+
*/
|
|
9389
|
+
const GcpAgentPlatformSandboxHeartbeatDataSchema = object({
|
|
9390
|
+
"engine": string().describe("Reasoning engine the template hangs under, without which the template id names nothing."),
|
|
9391
|
+
get "status"() {
|
|
9392
|
+
return SandboxHeartbeatStatusSchema;
|
|
9393
|
+
},
|
|
9394
|
+
"templateId": string().describe("The template sessions are currently cut from.")
|
|
9395
|
+
}).describe("GCP: the Agent Platform template sessions are cut from, and the engine it hangs under.\n\nNo session count: that needs `aiplatform.sandboxEnvironments.list`, which only the management\npermission set holds. No template state either — emission is gated on reading it `ACTIVE`,\nwhich is what `status` already says.");
|
|
8464
9396
|
object({
|
|
8465
9397
|
"projectId": string().describe("Project ID hosting the registry."),
|
|
8466
9398
|
"pullServiceAccountEmail": string().describe("Service account email with pull-only access."),
|
|
@@ -9790,6 +10722,7 @@ const ResourceEntrySchema = object({
|
|
|
9790
10722
|
const SandboxHeartbeatDataSchema = union([
|
|
9791
10723
|
lazy(() => AwsMicrovmSandboxHeartbeatDataSchema).and(object({ "backend": _enum(["awsMicrovm"]) })).describe("AWS: the image a sandbox runs from, and the lifecycle state AWS reports for it."),
|
|
9792
10724
|
lazy(() => AzureSandboxGroupHeartbeatDataSchema).and(object({ "backend": _enum(["azureSandboxGroup"]) })).describe("Azure: the sandbox group's ARM state. The data plane has no list operation, so a session count\nis not available here."),
|
|
10725
|
+
lazy(() => GcpAgentPlatformSandboxHeartbeatDataSchema).and(object({ "backend": _enum(["gcpAgentPlatform"]) })).describe("GCP: the Agent Platform template sessions are cut from, and the engine it hangs under.\n\nNo session count: that needs `aiplatform.sandboxEnvironments.list`, which only the management\npermission set holds. No template state either — emission is gated on reading it `ACTIVE`,\nwhich is what `status` already says."),
|
|
9793
10726
|
lazy(() => KubernetesSandboxHeartbeatDataSchema).and(object({ "backend": _enum(["kubernetesPods"]) })).describe("Kubernetes: pods carrying the sandbox label, in the deployment's namespace."),
|
|
9794
10727
|
lazy(() => LocalSandboxHeartbeatDataSchema).and(object({ "backend": _enum(["local"]) })).describe("Local: containers Docker still holds for this sandbox.")
|
|
9795
10728
|
]).describe("Content-free telemetry about a sandbox's sessions.\n\nNever anything from inside a session. A controller reaches only the cloud's management APIs,\nand the whole point of the resource is that the control plane cannot see what runs in it.");
|
|
@@ -10104,7 +11037,7 @@ object({
|
|
|
10104
11037
|
get "limits"() {
|
|
10105
11038
|
return union([SandboxLimitsSchema, _null()]).optional();
|
|
10106
11039
|
},
|
|
10107
|
-
"previewPorts": optional(array(int().min(0)).describe("Ports eligible for a preview capability.
|
|
11040
|
+
"previewPorts": optional(array(int().min(0)).describe("Ports eligible for a preview capability. An application reaches its sandbox through the\nprovider, so it cannot widen its own ingress at runtime; a holder of a remote binding's\ncredentials is bounded by no port condition, which is why a remote sandbox declares none.")),
|
|
10108
11041
|
get "session"() {
|
|
10109
11042
|
return SandboxSessionPolicySchema.describe("How long a session may live and when it is suspended.");
|
|
10110
11043
|
}
|