@mastra/slack 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2205 -1032
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -42
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +102 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2205 -1032
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -327,82 +327,34 @@ function buildManifest(options) {
|
|
|
327
327
|
return manifest;
|
|
328
328
|
}
|
|
329
329
|
//#endregion
|
|
330
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
331
|
-
var _a$1;
|
|
332
|
-
function $constructor(name, initializer, params) {
|
|
333
|
-
function init(inst, def) {
|
|
334
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
335
|
-
value: {
|
|
336
|
-
def,
|
|
337
|
-
constr: _,
|
|
338
|
-
traits: /* @__PURE__ */ new Set()
|
|
339
|
-
},
|
|
340
|
-
enumerable: false
|
|
341
|
-
});
|
|
342
|
-
if (inst._zod.traits.has(name)) return;
|
|
343
|
-
inst._zod.traits.add(name);
|
|
344
|
-
initializer(inst, def);
|
|
345
|
-
const proto = _.prototype;
|
|
346
|
-
const keys = Object.keys(proto);
|
|
347
|
-
for (let i = 0; i < keys.length; i++) {
|
|
348
|
-
const k = keys[i];
|
|
349
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
const Parent = params?.Parent ?? Object;
|
|
353
|
-
class Definition extends Parent {}
|
|
354
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
355
|
-
function _(def) {
|
|
356
|
-
var _a;
|
|
357
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
358
|
-
init(inst, def);
|
|
359
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
360
|
-
for (const fn of inst._zod.deferred) fn();
|
|
361
|
-
return inst;
|
|
362
|
-
}
|
|
363
|
-
Object.defineProperty(_, "init", { value: init });
|
|
364
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
365
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
366
|
-
return inst?._zod?.traits?.has(name);
|
|
367
|
-
} });
|
|
368
|
-
Object.defineProperty(_, "name", { value: name });
|
|
369
|
-
return _;
|
|
370
|
-
}
|
|
371
|
-
var $ZodAsyncError = class extends Error {
|
|
372
|
-
constructor() {
|
|
373
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
var $ZodEncodeError = class extends Error {
|
|
377
|
-
constructor(name) {
|
|
378
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
379
|
-
this.name = "ZodEncodeError";
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
383
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
384
|
-
function config(newConfig) {
|
|
385
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
386
|
-
return globalConfig;
|
|
387
|
-
}
|
|
388
|
-
//#endregion
|
|
389
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.4.3/09b4e1f4024540142723f154808f0d43eb14b44b685c1085d435a20f90e89165/node_modules/zod/v4/core/util.js
|
|
330
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/util.js
|
|
390
331
|
function getEnumValues(entries) {
|
|
391
332
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
392
333
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
393
334
|
}
|
|
335
|
+
function joinValues(array, separator = "|") {
|
|
336
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
337
|
+
}
|
|
394
338
|
function jsonStringifyReplacer(_, value) {
|
|
395
339
|
if (typeof value === "bigint") return value.toString();
|
|
396
340
|
return value;
|
|
397
341
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
342
|
+
var Cached = class {
|
|
343
|
+
constructor(getter) {
|
|
344
|
+
this._getter = getter;
|
|
345
|
+
this._value = void 0;
|
|
346
|
+
}
|
|
347
|
+
get value() {
|
|
348
|
+
const getter = this._getter;
|
|
349
|
+
if (getter !== void 0) {
|
|
350
|
+
this._value = getter();
|
|
351
|
+
this._getter = void 0;
|
|
404
352
|
}
|
|
405
|
-
|
|
353
|
+
return this._value;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
function cached(getter) {
|
|
357
|
+
return new Cached(getter);
|
|
406
358
|
}
|
|
407
359
|
function nullish(input) {
|
|
408
360
|
return input === null || input === void 0;
|
|
@@ -412,24 +364,6 @@ function cleanRegex(source) {
|
|
|
412
364
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
413
365
|
return source.slice(start, end);
|
|
414
366
|
}
|
|
415
|
-
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
416
|
-
function defineLazy(object, key, getter) {
|
|
417
|
-
let value = void 0;
|
|
418
|
-
Object.defineProperty(object, key, {
|
|
419
|
-
get() {
|
|
420
|
-
if (value === EVALUATING) return;
|
|
421
|
-
if (value === void 0) {
|
|
422
|
-
value = EVALUATING;
|
|
423
|
-
value = getter();
|
|
424
|
-
}
|
|
425
|
-
return value;
|
|
426
|
-
},
|
|
427
|
-
set(v) {
|
|
428
|
-
Object.defineProperty(object, key, { value: v });
|
|
429
|
-
},
|
|
430
|
-
configurable: true
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
367
|
function assignProp(target, prop, value) {
|
|
434
368
|
Object.defineProperty(target, prop, {
|
|
435
369
|
value,
|
|
@@ -438,6 +372,58 @@ function assignProp(target, prop, value) {
|
|
|
438
372
|
configurable: true
|
|
439
373
|
});
|
|
440
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
377
|
+
*
|
|
378
|
+
* Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
|
|
379
|
+
*/
|
|
380
|
+
function rawShape(def) {
|
|
381
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
382
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
383
|
+
}
|
|
384
|
+
function sourceShape(schema) {
|
|
385
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
386
|
+
}
|
|
387
|
+
function deferProp(target, key, getter) {
|
|
388
|
+
Object.defineProperty(target, key, {
|
|
389
|
+
get() {
|
|
390
|
+
const value = getter();
|
|
391
|
+
assignProp(this, key, value);
|
|
392
|
+
return value;
|
|
393
|
+
},
|
|
394
|
+
enumerable: true,
|
|
395
|
+
configurable: true
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function putProp(target, key, value) {
|
|
399
|
+
if (key in target) assignProp(target, key, value);
|
|
400
|
+
else target[key] = value;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
404
|
+
*
|
|
405
|
+
* A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
|
|
406
|
+
*/
|
|
407
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
408
|
+
const raw = sourceShape(source);
|
|
409
|
+
for (const key of keys) {
|
|
410
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
411
|
+
if (!desc.enumerable) continue;
|
|
412
|
+
if (desc.get) deferProp(target, key, () => {
|
|
413
|
+
const value = source._zod.def.shape[key];
|
|
414
|
+
return wrap ? wrap(value, key) : value;
|
|
415
|
+
});
|
|
416
|
+
else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function mirrorProps(target, source) {
|
|
420
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
421
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
422
|
+
if (!desc.enumerable) continue;
|
|
423
|
+
if (desc.get) deferProp(target, key, () => source[key]);
|
|
424
|
+
else putProp(target, key, desc.value);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
441
427
|
function mergeDefs(...defs) {
|
|
442
428
|
const mergedDescriptors = {};
|
|
443
429
|
for (const def of defs) {
|
|
@@ -511,45 +497,56 @@ function normalizeParams(_params) {
|
|
|
511
497
|
};
|
|
512
498
|
return params;
|
|
513
499
|
}
|
|
500
|
+
function stringifyPrimitive(value) {
|
|
501
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
502
|
+
if (typeof value === "string") return `"${value}"`;
|
|
503
|
+
return `${value}`;
|
|
504
|
+
}
|
|
514
505
|
function optionalKeys(shape) {
|
|
515
506
|
return Object.keys(shape).filter((k) => {
|
|
516
|
-
return shape[k]._zod.optin
|
|
507
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
517
508
|
});
|
|
518
509
|
}
|
|
519
|
-
|
|
510
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
511
|
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
512
|
+
int32: [-2147483648, 2147483647],
|
|
513
|
+
uint32: [0, 4294967295],
|
|
514
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
515
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
516
|
+
}))();
|
|
517
|
+
const BIGINT_FORMAT_RANGES = {
|
|
518
|
+
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
519
|
+
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
|
|
520
|
+
};
|
|
520
521
|
function pick(schema, mask) {
|
|
521
522
|
const currDef = schema._zod.def;
|
|
522
523
|
const checks = currDef.checks;
|
|
523
524
|
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
529
|
-
if (!mask[key]) continue;
|
|
530
|
-
newShape[key] = currDef.shape[key];
|
|
531
|
-
}
|
|
532
|
-
assignProp(this, "shape", newShape);
|
|
533
|
-
return newShape;
|
|
534
|
-
},
|
|
525
|
+
const newShape = {};
|
|
526
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
527
|
+
return clone(schema, mergeDefs(currDef, {
|
|
528
|
+
shape: newShape,
|
|
535
529
|
checks: []
|
|
536
530
|
}));
|
|
537
531
|
}
|
|
532
|
+
function maskedKeys(schema, mask) {
|
|
533
|
+
const raw = sourceShape(schema);
|
|
534
|
+
const keys = [];
|
|
535
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
536
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
537
|
+
if (mask[key]) keys.push(key);
|
|
538
|
+
}
|
|
539
|
+
return keys;
|
|
540
|
+
}
|
|
538
541
|
function omit(schema, mask) {
|
|
539
542
|
const currDef = schema._zod.def;
|
|
540
543
|
const checks = currDef.checks;
|
|
541
544
|
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
if (!mask[key]) continue;
|
|
548
|
-
delete newShape[key];
|
|
549
|
-
}
|
|
550
|
-
assignProp(this, "shape", newShape);
|
|
551
|
-
return newShape;
|
|
552
|
-
},
|
|
545
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
546
|
+
const newShape = {};
|
|
547
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
548
|
+
return clone(schema, mergeDefs(currDef, {
|
|
549
|
+
shape: newShape,
|
|
553
550
|
checks: []
|
|
554
551
|
}));
|
|
555
552
|
}
|
|
@@ -557,90 +554,57 @@ function extend(schema, shape) {
|
|
|
557
554
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
558
555
|
const checks = schema._zod.def.checks;
|
|
559
556
|
if (checks && checks.length > 0) {
|
|
560
|
-
const existingShape = schema
|
|
561
|
-
for (const key
|
|
557
|
+
const existingShape = sourceShape(schema);
|
|
558
|
+
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.");
|
|
562
559
|
}
|
|
563
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
} }));
|
|
560
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
561
|
+
}
|
|
562
|
+
function extended(schema, shape) {
|
|
563
|
+
const newShape = {};
|
|
564
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
565
|
+
mirrorProps(newShape, shape);
|
|
566
|
+
return newShape;
|
|
571
567
|
}
|
|
572
568
|
function safeExtend(schema, shape) {
|
|
573
569
|
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
574
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
575
|
-
const _shape = {
|
|
576
|
-
...schema._zod.def.shape,
|
|
577
|
-
...shape
|
|
578
|
-
};
|
|
579
|
-
assignProp(this, "shape", _shape);
|
|
580
|
-
return _shape;
|
|
581
|
-
} }));
|
|
570
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
582
571
|
}
|
|
583
572
|
function merge(a, b) {
|
|
573
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
584
574
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
575
|
+
const newShape = {};
|
|
576
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
577
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
585
578
|
return clone(a, mergeDefs(a._zod.def, {
|
|
586
|
-
|
|
587
|
-
const _shape = {
|
|
588
|
-
...a._zod.def.shape,
|
|
589
|
-
...b._zod.def.shape
|
|
590
|
-
};
|
|
591
|
-
assignProp(this, "shape", _shape);
|
|
592
|
-
return _shape;
|
|
593
|
-
},
|
|
579
|
+
shape: newShape,
|
|
594
580
|
get catchall() {
|
|
595
581
|
return b._zod.def.catchall;
|
|
596
582
|
},
|
|
597
583
|
checks: b._zod.def.checks ?? []
|
|
598
584
|
}));
|
|
599
585
|
}
|
|
600
|
-
function partial(Class, schema, mask) {
|
|
586
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
601
587
|
const checks = schema._zod.def.checks;
|
|
602
|
-
if (checks && checks.length > 0) throw new Error(
|
|
588
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
589
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
590
|
+
const newShape = {};
|
|
591
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
|
|
592
|
+
type: "optional",
|
|
593
|
+
innerType: value
|
|
594
|
+
})));
|
|
603
595
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
604
|
-
|
|
605
|
-
const oldShape = schema._zod.def.shape;
|
|
606
|
-
const shape = { ...oldShape };
|
|
607
|
-
if (mask) for (const key in mask) {
|
|
608
|
-
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
609
|
-
if (!mask[key]) continue;
|
|
610
|
-
shape[key] = Class ? new Class({
|
|
611
|
-
type: "optional",
|
|
612
|
-
innerType: oldShape[key]
|
|
613
|
-
}) : oldShape[key];
|
|
614
|
-
}
|
|
615
|
-
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
616
|
-
type: "optional",
|
|
617
|
-
innerType: oldShape[key]
|
|
618
|
-
}) : oldShape[key];
|
|
619
|
-
assignProp(this, "shape", shape);
|
|
620
|
-
return shape;
|
|
621
|
-
},
|
|
596
|
+
shape: newShape,
|
|
622
597
|
checks: []
|
|
623
598
|
}));
|
|
624
599
|
}
|
|
625
600
|
function required(Class, schema, mask) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
type: "nonoptional",
|
|
634
|
-
innerType: oldShape[key]
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
else for (const key in oldShape) shape[key] = new Class({
|
|
638
|
-
type: "nonoptional",
|
|
639
|
-
innerType: oldShape[key]
|
|
640
|
-
});
|
|
641
|
-
assignProp(this, "shape", shape);
|
|
642
|
-
return shape;
|
|
643
|
-
} }));
|
|
601
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
602
|
+
const newShape = {};
|
|
603
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
|
|
604
|
+
type: "nonoptional",
|
|
605
|
+
innerType: value
|
|
606
|
+
}));
|
|
607
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
644
608
|
}
|
|
645
609
|
function aborted(x, startIndex = 0) {
|
|
646
610
|
if (x.aborted === true) return true;
|
|
@@ -663,19 +627,56 @@ function prefixIssues(path, issues) {
|
|
|
663
627
|
function unwrapMessage(message) {
|
|
664
628
|
return typeof message === "string" ? message : message?.message;
|
|
665
629
|
}
|
|
630
|
+
function attachSchema(issues, start, inst) {
|
|
631
|
+
var _a;
|
|
632
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
633
|
+
}
|
|
666
634
|
function finalizeIssue(iss, ctx, config) {
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
635
|
+
var _a;
|
|
636
|
+
const traits = iss.inst?._zod?.traits;
|
|
637
|
+
if (traits?.has("$ZodType")) if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
638
|
+
else iss.schema = iss.inst;
|
|
639
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
640
|
+
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";
|
|
641
|
+
const full = {};
|
|
642
|
+
for (const k of Object.keys(iss)) {
|
|
643
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
644
|
+
full[k] = iss[k];
|
|
645
|
+
}
|
|
646
|
+
full.path ?? (full.path = []);
|
|
647
|
+
full.message = message;
|
|
648
|
+
if (ctx?.reportInput) full.input = iss.input;
|
|
649
|
+
return full;
|
|
650
|
+
}
|
|
651
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
652
|
+
function codePointLength(str) {
|
|
653
|
+
const units = str.length;
|
|
654
|
+
if (!highSurrogate.test(str)) return units;
|
|
655
|
+
let count = units;
|
|
656
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
657
|
+
count--;
|
|
658
|
+
i++;
|
|
659
|
+
}
|
|
660
|
+
return count;
|
|
673
661
|
}
|
|
674
662
|
function getLengthableOrigin(input) {
|
|
675
663
|
if (Array.isArray(input)) return "array";
|
|
676
664
|
if (typeof input === "string") return "string";
|
|
677
665
|
return "unknown";
|
|
678
666
|
}
|
|
667
|
+
function parsedType(data) {
|
|
668
|
+
const t = typeof data;
|
|
669
|
+
switch (t) {
|
|
670
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
671
|
+
case "object": {
|
|
672
|
+
if (data === null) return "null";
|
|
673
|
+
if (Array.isArray(data)) return "array";
|
|
674
|
+
const obj = data;
|
|
675
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return t;
|
|
679
|
+
}
|
|
679
680
|
function issue(...args) {
|
|
680
681
|
const [iss, input, inst] = args;
|
|
681
682
|
if (typeof iss === "string") return {
|
|
@@ -686,33 +687,337 @@ function issue(...args) {
|
|
|
686
687
|
};
|
|
687
688
|
return { ...iss };
|
|
688
689
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
690
|
+
/**
|
|
691
|
+
* 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.
|
|
692
|
+
*
|
|
693
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
694
|
+
*/
|
|
695
|
+
function members(proto, table) {
|
|
696
|
+
for (const key in table) {
|
|
697
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
698
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
699
|
+
...desc,
|
|
700
|
+
enumerable: false
|
|
701
|
+
});
|
|
702
|
+
else defineBound(proto, key, desc.value);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
706
|
+
function own(inst, key, value, enumerable = true) {
|
|
707
|
+
Object.defineProperty(inst, key, {
|
|
708
|
+
configurable: true,
|
|
709
|
+
writable: true,
|
|
710
|
+
enumerable,
|
|
711
|
+
value
|
|
712
|
+
});
|
|
713
|
+
return value;
|
|
714
|
+
}
|
|
715
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
716
|
+
function hide(inst, key, value) {
|
|
717
|
+
return own(inst, key, value, false);
|
|
718
|
+
}
|
|
719
|
+
/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
|
|
720
|
+
function derived(computes, table) {
|
|
721
|
+
for (const key in computes) {
|
|
722
|
+
const compute = computes[key];
|
|
723
|
+
Object.defineProperty(table, key, {
|
|
724
|
+
configurable: true,
|
|
725
|
+
enumerable: true,
|
|
726
|
+
get() {
|
|
727
|
+
return own(this, key, compute(this));
|
|
728
|
+
},
|
|
729
|
+
set(value) {
|
|
730
|
+
own(this, key, value);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
return table;
|
|
735
|
+
}
|
|
736
|
+
function defineBound(proto, key, fn) {
|
|
737
|
+
Object.defineProperty(proto, key, {
|
|
738
|
+
configurable: true,
|
|
739
|
+
get() {
|
|
740
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
741
|
+
},
|
|
742
|
+
set(value) {
|
|
743
|
+
own(this, key, value);
|
|
744
|
+
}
|
|
696
745
|
});
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
746
|
+
}
|
|
747
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
748
|
+
function claim(inst, sentinel) {
|
|
749
|
+
const proto = Object.getPrototypeOf(inst);
|
|
750
|
+
return sentinel in proto ? void 0 : proto;
|
|
751
|
+
}
|
|
752
|
+
let installing;
|
|
753
|
+
let broke = false;
|
|
754
|
+
const breaker = {
|
|
755
|
+
configurable: true,
|
|
756
|
+
get() {
|
|
757
|
+
broke = true;
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
/**
|
|
761
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
762
|
+
* constructor, computed from the internals object itself and cached there on
|
|
763
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
764
|
+
*/
|
|
765
|
+
function defineLazyInternal(inst, key, compute) {
|
|
766
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
767
|
+
if (key in proto && installing !== inst._zod) {
|
|
768
|
+
installing = void 0;
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
installing = inst._zod;
|
|
772
|
+
Object.defineProperty(proto, key, {
|
|
773
|
+
configurable: true,
|
|
774
|
+
get() {
|
|
775
|
+
Object.defineProperty(this, key, breaker);
|
|
776
|
+
const outer = broke;
|
|
777
|
+
broke = false;
|
|
778
|
+
try {
|
|
779
|
+
const value = compute(this);
|
|
780
|
+
if (broke) delete this[key];
|
|
781
|
+
else Object.defineProperty(this, key, {
|
|
782
|
+
configurable: true,
|
|
783
|
+
writable: true,
|
|
784
|
+
value
|
|
785
|
+
});
|
|
786
|
+
broke = broke || outer;
|
|
787
|
+
return value;
|
|
788
|
+
} catch (err) {
|
|
789
|
+
delete this[key];
|
|
790
|
+
broke = broke || outer;
|
|
791
|
+
throw err;
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
set(value) {
|
|
795
|
+
Object.defineProperty(this, key, {
|
|
796
|
+
configurable: true,
|
|
797
|
+
writable: true,
|
|
798
|
+
value
|
|
799
|
+
});
|
|
800
|
+
}
|
|
700
801
|
});
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
805
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
806
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
807
|
+
*/
|
|
808
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
809
|
+
const proto = claim(inst, key);
|
|
810
|
+
if (!proto) return;
|
|
811
|
+
Object.defineProperty(proto, key, {
|
|
812
|
+
configurable: true,
|
|
813
|
+
get() {
|
|
814
|
+
const desc = {
|
|
815
|
+
configurable: true,
|
|
816
|
+
writable: true,
|
|
817
|
+
enumerable,
|
|
818
|
+
value: void 0
|
|
819
|
+
};
|
|
820
|
+
Object.defineProperty(this, key, desc);
|
|
821
|
+
desc.value = make(this);
|
|
822
|
+
Object.defineProperty(this, key, desc);
|
|
823
|
+
return desc.value;
|
|
824
|
+
},
|
|
825
|
+
set(value) {
|
|
826
|
+
Object.defineProperty(this, key, {
|
|
827
|
+
configurable: true,
|
|
828
|
+
writable: true,
|
|
829
|
+
enumerable,
|
|
830
|
+
value
|
|
831
|
+
});
|
|
832
|
+
}
|
|
705
833
|
});
|
|
834
|
+
}
|
|
835
|
+
/** 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. */
|
|
836
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
837
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
838
|
+
function constantCatch(value) {
|
|
839
|
+
const fn = () => value;
|
|
840
|
+
fn[CONSTANT_CATCH] = true;
|
|
841
|
+
return fn;
|
|
842
|
+
}
|
|
843
|
+
//#endregion
|
|
844
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/core.js
|
|
845
|
+
var _a$1;
|
|
846
|
+
const _zodDesc = {
|
|
847
|
+
value: void 0,
|
|
848
|
+
enumerable: false
|
|
849
|
+
};
|
|
850
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
851
|
+
function newError(Definition) {
|
|
852
|
+
const E = _E;
|
|
853
|
+
if (E) {
|
|
854
|
+
const saved = E.stackTraceLimit;
|
|
855
|
+
if (typeof saved === "number") {
|
|
856
|
+
try {
|
|
857
|
+
E.stackTraceLimit = 0;
|
|
858
|
+
} catch {
|
|
859
|
+
_E = null;
|
|
860
|
+
return new Definition();
|
|
861
|
+
}
|
|
862
|
+
try {
|
|
863
|
+
return new Definition();
|
|
864
|
+
} finally {
|
|
865
|
+
E.stackTraceLimit = saved;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return new Definition();
|
|
870
|
+
}
|
|
871
|
+
function $constructor(name, initializer, proto, params) {
|
|
872
|
+
const zodProto = {};
|
|
873
|
+
function Internals(def) {
|
|
874
|
+
this.def = def;
|
|
875
|
+
this.constr = _;
|
|
876
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
877
|
+
}
|
|
878
|
+
Internals.prototype = zodProto;
|
|
879
|
+
const protoMembers = proto;
|
|
880
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
881
|
+
function init(inst, def) {
|
|
882
|
+
if (!inst._zod) {
|
|
883
|
+
_zodDesc.value = new Internals(def);
|
|
884
|
+
try {
|
|
885
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
886
|
+
} finally {
|
|
887
|
+
_zodDesc.value = void 0;
|
|
888
|
+
}
|
|
889
|
+
} else if (inst._zod.traits.has(name)) return;
|
|
890
|
+
inst._zod.traits.add(name);
|
|
891
|
+
initializer(inst, def);
|
|
892
|
+
if (initialized) {
|
|
893
|
+
const own = Object.getPrototypeOf(inst);
|
|
894
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
895
|
+
let up = own;
|
|
896
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
897
|
+
const target = up ?? own;
|
|
898
|
+
if (!initialized.has(target)) {
|
|
899
|
+
initialized.add(target);
|
|
900
|
+
members(target, protoMembers);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
const proto = _.prototype;
|
|
904
|
+
for (const k in proto) {
|
|
905
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
906
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const Parent = params?.Parent ?? Object;
|
|
910
|
+
class Definition extends Parent {}
|
|
911
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
912
|
+
function _(def) {
|
|
913
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
914
|
+
init(inst, def);
|
|
915
|
+
const deferred = inst._zod.deferred;
|
|
916
|
+
if (deferred) {
|
|
917
|
+
for (const fn of deferred) fn();
|
|
918
|
+
inst._zod.deferred = void 0;
|
|
919
|
+
}
|
|
920
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
921
|
+
if (pp) pp(inst);
|
|
922
|
+
return inst;
|
|
923
|
+
}
|
|
924
|
+
Object.defineProperty(_, "init", { value: init });
|
|
925
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
926
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
927
|
+
return inst?._zod?.traits?.has(name);
|
|
928
|
+
} });
|
|
929
|
+
Object.defineProperty(_, "name", { value: name });
|
|
930
|
+
return _;
|
|
931
|
+
}
|
|
932
|
+
var $ZodAsyncError = class extends Error {
|
|
933
|
+
constructor() {
|
|
934
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
var $ZodEncodeError = class extends Error {
|
|
938
|
+
constructor(name) {
|
|
939
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
940
|
+
this.name = "ZodEncodeError";
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
944
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
945
|
+
function config(newConfig) {
|
|
946
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
947
|
+
return globalConfig;
|
|
948
|
+
}
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/errors.js
|
|
951
|
+
function _getMessage() {
|
|
952
|
+
const internals = this._zod;
|
|
953
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
954
|
+
return internals.message;
|
|
955
|
+
}
|
|
956
|
+
function _setMessage(value) {
|
|
957
|
+
this._zod.message = value;
|
|
958
|
+
}
|
|
959
|
+
const _messageDesc = {
|
|
960
|
+
get: _getMessage,
|
|
961
|
+
set: _setMessage,
|
|
962
|
+
enumerable: true,
|
|
963
|
+
configurable: true
|
|
964
|
+
};
|
|
965
|
+
const _issuesDesc = {
|
|
966
|
+
value: void 0,
|
|
967
|
+
enumerable: false
|
|
968
|
+
};
|
|
969
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
970
|
+
const initializer$1 = (inst, def) => {
|
|
971
|
+
inst.name = "$ZodError";
|
|
972
|
+
_issuesDesc.value = def;
|
|
973
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
974
|
+
_issuesDesc.value = void 0;
|
|
975
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
976
|
+
const proto = Object.getPrototypeOf(inst);
|
|
977
|
+
if (!_installedToString.has(proto)) {
|
|
978
|
+
_installedToString.add(proto);
|
|
979
|
+
Object.defineProperty(proto, "toString", {
|
|
980
|
+
configurable: true,
|
|
981
|
+
enumerable: false,
|
|
982
|
+
get() {
|
|
983
|
+
const value = () => this.message;
|
|
984
|
+
Object.defineProperty(this, "toString", {
|
|
985
|
+
value,
|
|
986
|
+
configurable: true,
|
|
987
|
+
writable: true
|
|
988
|
+
});
|
|
989
|
+
return value;
|
|
990
|
+
},
|
|
991
|
+
set(value) {
|
|
992
|
+
Object.defineProperty(this, "toString", {
|
|
993
|
+
value,
|
|
994
|
+
configurable: true,
|
|
995
|
+
writable: true
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
}
|
|
706
1000
|
};
|
|
707
1001
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
708
|
-
|
|
1002
|
+
$constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
1003
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
1004
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
1005
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
1006
|
+
function node(obj, key, make) {
|
|
1007
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
1008
|
+
value: make(),
|
|
1009
|
+
writable: true,
|
|
1010
|
+
enumerable: true,
|
|
1011
|
+
configurable: true
|
|
1012
|
+
});
|
|
1013
|
+
else obj[key] = make();
|
|
1014
|
+
return obj[key];
|
|
1015
|
+
}
|
|
709
1016
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
710
1017
|
const fieldErrors = {};
|
|
711
1018
|
const formErrors = [];
|
|
712
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
713
|
-
|
|
714
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
715
|
-
} else formErrors.push(mapper(sub));
|
|
1019
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
1020
|
+
else formErrors.push(mapper(sub));
|
|
716
1021
|
return {
|
|
717
1022
|
formErrors,
|
|
718
1023
|
fieldErrors
|
|
@@ -732,12 +1037,21 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
732
1037
|
let i = 0;
|
|
733
1038
|
while (i < fullpath.length) {
|
|
734
1039
|
const el = fullpath[i];
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
1040
|
+
const terminal = i === fullpath.length - 1;
|
|
1041
|
+
if (el === "_errors") {
|
|
1042
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
1043
|
+
i++;
|
|
1044
|
+
continue;
|
|
739
1045
|
}
|
|
740
|
-
curr
|
|
1046
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
1047
|
+
value: { _errors: [] },
|
|
1048
|
+
enumerable: true,
|
|
1049
|
+
writable: true,
|
|
1050
|
+
configurable: true
|
|
1051
|
+
});
|
|
1052
|
+
const node = curr[el];
|
|
1053
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
1054
|
+
curr = node;
|
|
741
1055
|
i++;
|
|
742
1056
|
}
|
|
743
1057
|
}
|
|
@@ -747,8 +1061,54 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
747
1061
|
return fieldErrors;
|
|
748
1062
|
}
|
|
749
1063
|
//#endregion
|
|
750
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
751
|
-
|
|
1064
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/parse.js
|
|
1065
|
+
function finalizeParams(callee, params) {
|
|
1066
|
+
return {
|
|
1067
|
+
callee: params?.callee ?? callee,
|
|
1068
|
+
Err: params?.Err
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
const _parse = (_Err) => {
|
|
1072
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1073
|
+
const ctx = _ctx ? {
|
|
1074
|
+
..._ctx,
|
|
1075
|
+
async: false
|
|
1076
|
+
} : { async: false };
|
|
1077
|
+
const result = schema._zod.run({
|
|
1078
|
+
value,
|
|
1079
|
+
issues: []
|
|
1080
|
+
}, ctx);
|
|
1081
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
1082
|
+
if (result.issues.length) {
|
|
1083
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1084
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
1085
|
+
throw e;
|
|
1086
|
+
}
|
|
1087
|
+
return result.value;
|
|
1088
|
+
};
|
|
1089
|
+
return fn;
|
|
1090
|
+
};
|
|
1091
|
+
const _parseAsync = (_Err) => {
|
|
1092
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
1093
|
+
const ctx = _ctx ? {
|
|
1094
|
+
..._ctx,
|
|
1095
|
+
async: true
|
|
1096
|
+
} : { async: true };
|
|
1097
|
+
let result = schema._zod.run({
|
|
1098
|
+
value,
|
|
1099
|
+
issues: []
|
|
1100
|
+
}, ctx);
|
|
1101
|
+
if (result instanceof Promise) result = await result;
|
|
1102
|
+
if (result.issues.length) {
|
|
1103
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1104
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
1105
|
+
throw e;
|
|
1106
|
+
}
|
|
1107
|
+
return result.value;
|
|
1108
|
+
};
|
|
1109
|
+
return fn;
|
|
1110
|
+
};
|
|
1111
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
752
1112
|
const ctx = _ctx ? {
|
|
753
1113
|
..._ctx,
|
|
754
1114
|
async: false
|
|
@@ -758,14 +1118,31 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
758
1118
|
issues: []
|
|
759
1119
|
}, ctx);
|
|
760
1120
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
return result.value;
|
|
1121
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
1122
|
+
success: true,
|
|
1123
|
+
data: result.value
|
|
1124
|
+
};
|
|
767
1125
|
};
|
|
768
|
-
|
|
1126
|
+
function failure(Err, issues, ctx) {
|
|
1127
|
+
let error;
|
|
1128
|
+
return {
|
|
1129
|
+
success: false,
|
|
1130
|
+
get error() {
|
|
1131
|
+
if (!error) {
|
|
1132
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1133
|
+
issues = void 0;
|
|
1134
|
+
ctx = void 0;
|
|
1135
|
+
}
|
|
1136
|
+
return error;
|
|
1137
|
+
},
|
|
1138
|
+
set error(e) {
|
|
1139
|
+
error = e;
|
|
1140
|
+
issues = void 0;
|
|
1141
|
+
ctx = void 0;
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
769
1146
|
const ctx = _ctx ? {
|
|
770
1147
|
..._ctx,
|
|
771
1148
|
async: true
|
|
@@ -775,70 +1152,96 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
775
1152
|
issues: []
|
|
776
1153
|
}, ctx);
|
|
777
1154
|
if (result instanceof Promise) result = await result;
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
return result.value;
|
|
1155
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
1156
|
+
success: true,
|
|
1157
|
+
data: result.value
|
|
1158
|
+
};
|
|
784
1159
|
};
|
|
785
|
-
const
|
|
1160
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
1161
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
1162
|
+
const validate = ((schema, value, _ctx) => {
|
|
1163
|
+
const validator = schema._zod.bag.validator;
|
|
1164
|
+
if (validator !== void 0) {
|
|
1165
|
+
if (validator(value) !== COMPILE_INVALID) return true;
|
|
1166
|
+
if (validator.definite === true && _ctx === void 0) return false;
|
|
1167
|
+
}
|
|
1168
|
+
return validateFallback(schema, value, _ctx);
|
|
1169
|
+
});
|
|
1170
|
+
function validateFallback(schema, value, _ctx) {
|
|
786
1171
|
const ctx = _ctx ? {
|
|
787
1172
|
..._ctx,
|
|
788
|
-
async: false
|
|
789
|
-
|
|
790
|
-
|
|
1173
|
+
async: false,
|
|
1174
|
+
abortEarly: true
|
|
1175
|
+
} : {
|
|
1176
|
+
async: false,
|
|
1177
|
+
abortEarly: true
|
|
1178
|
+
};
|
|
1179
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
1180
|
+
let result;
|
|
1181
|
+
if (fallbackRun) {
|
|
1182
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
1183
|
+
result = fallbackRun({
|
|
1184
|
+
value,
|
|
1185
|
+
issues: []
|
|
1186
|
+
}, ctx);
|
|
1187
|
+
} else result = schema._zod.run({
|
|
791
1188
|
value,
|
|
792
1189
|
issues: []
|
|
793
1190
|
}, ctx);
|
|
794
1191
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
795
|
-
return result.issues.length
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
} : {
|
|
799
|
-
success: true,
|
|
800
|
-
data: result.value
|
|
801
|
-
};
|
|
802
|
-
};
|
|
803
|
-
const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
804
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1192
|
+
return result.issues.length === 0;
|
|
1193
|
+
}
|
|
1194
|
+
const validateAsync$1 = async (schema, value, _ctx) => {
|
|
805
1195
|
const ctx = _ctx ? {
|
|
806
1196
|
..._ctx,
|
|
807
|
-
async: true
|
|
808
|
-
|
|
1197
|
+
async: true,
|
|
1198
|
+
abortEarly: true
|
|
1199
|
+
} : {
|
|
1200
|
+
async: true,
|
|
1201
|
+
abortEarly: true
|
|
1202
|
+
};
|
|
809
1203
|
let result = schema._zod.run({
|
|
810
1204
|
value,
|
|
811
1205
|
issues: []
|
|
812
1206
|
}, ctx);
|
|
813
1207
|
if (result instanceof Promise) result = await result;
|
|
814
|
-
return result.issues.length
|
|
815
|
-
success: false,
|
|
816
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
817
|
-
} : {
|
|
818
|
-
success: true,
|
|
819
|
-
data: result.value
|
|
820
|
-
};
|
|
1208
|
+
return result.issues.length === 0;
|
|
821
1209
|
};
|
|
822
|
-
const
|
|
823
|
-
const
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1210
|
+
const _encode = (_Err) => {
|
|
1211
|
+
const parse = _parse(_Err);
|
|
1212
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1213
|
+
const ctx = _ctx ? {
|
|
1214
|
+
..._ctx,
|
|
1215
|
+
direction: "backward"
|
|
1216
|
+
} : { direction: "backward" };
|
|
1217
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
1218
|
+
};
|
|
1219
|
+
return fn;
|
|
829
1220
|
};
|
|
830
|
-
const _decode = (_Err) =>
|
|
831
|
-
|
|
1221
|
+
const _decode = (_Err) => {
|
|
1222
|
+
const parse = _parse(_Err);
|
|
1223
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1224
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1225
|
+
};
|
|
1226
|
+
return fn;
|
|
832
1227
|
};
|
|
833
|
-
const _encodeAsync = (_Err) =>
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1228
|
+
const _encodeAsync = (_Err) => {
|
|
1229
|
+
const parseAsync = _parseAsync(_Err);
|
|
1230
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1231
|
+
const ctx = _ctx ? {
|
|
1232
|
+
..._ctx,
|
|
1233
|
+
direction: "backward"
|
|
1234
|
+
} : { direction: "backward" };
|
|
1235
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
1236
|
+
};
|
|
1237
|
+
return fn;
|
|
839
1238
|
};
|
|
840
|
-
const _decodeAsync = (_Err) =>
|
|
841
|
-
|
|
1239
|
+
const _decodeAsync = (_Err) => {
|
|
1240
|
+
const parseAsync = _parseAsync(_Err);
|
|
1241
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1242
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1243
|
+
};
|
|
1244
|
+
return fn;
|
|
842
1245
|
};
|
|
843
1246
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
844
1247
|
const ctx = _ctx ? {
|
|
@@ -861,7 +1264,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
861
1264
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
862
1265
|
};
|
|
863
1266
|
//#endregion
|
|
864
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
1267
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/regexes.js
|
|
865
1268
|
/**
|
|
866
1269
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
867
1270
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -869,12 +1272,15 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
869
1272
|
*/
|
|
870
1273
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
871
1274
|
const cuid2 = /^[0-9a-z]+$/;
|
|
872
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
1275
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
873
1276
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
874
1277
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
875
1278
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1279
|
+
function nanoidOfLength(length) {
|
|
1280
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
1281
|
+
}
|
|
876
1282
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
877
|
-
const duration
|
|
1283
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
878
1284
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
879
1285
|
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})$/;
|
|
880
1286
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -885,64 +1291,68 @@ const uuid = (version) => {
|
|
|
885
1291
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
886
1292
|
};
|
|
887
1293
|
/** Practical email validation */
|
|
888
|
-
const email = /^(
|
|
889
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}
|
|
1294
|
+
const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1295
|
+
const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
890
1296
|
function emoji() {
|
|
891
1297
|
return new RegExp(_emoji$1, "u");
|
|
892
1298
|
}
|
|
893
1299
|
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])$/;
|
|
894
1300
|
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}|:))$/;
|
|
895
1301
|
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])$/;
|
|
896
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
1302
|
+
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])$/;
|
|
897
1303
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
898
|
-
const base64url = /^[A-Za-z0-9_-]
|
|
1304
|
+
const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
899
1305
|
const httpProtocol = /^https?$/;
|
|
900
1306
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
901
1307
|
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])))`;
|
|
902
|
-
|
|
1308
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
1309
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
1310
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
1311
|
+
function anchor(source) {
|
|
1312
|
+
return new RegExp(`^${source}$`);
|
|
1313
|
+
}
|
|
1314
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
903
1315
|
function timeSource(args) {
|
|
904
1316
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
905
|
-
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+)?)?`;
|
|
1317
|
+
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+)?)?`;
|
|
906
1318
|
}
|
|
907
|
-
function time
|
|
1319
|
+
function time(args) {
|
|
908
1320
|
return new RegExp(`^${timeSource(args)}$`);
|
|
909
1321
|
}
|
|
910
|
-
function datetime
|
|
911
|
-
const time = timeSource({ precision: args.precision });
|
|
1322
|
+
function datetime(args) {
|
|
912
1323
|
const opts = ["Z"];
|
|
913
|
-
if (args.local) opts.push("");
|
|
914
1324
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
915
|
-
const
|
|
1325
|
+
const qualified = `${timeSource({
|
|
1326
|
+
precision: args.precision,
|
|
1327
|
+
seconds: true
|
|
1328
|
+
})}(?:${opts.join("|")})`;
|
|
1329
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
916
1330
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
917
1331
|
}
|
|
918
|
-
const
|
|
919
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
920
|
-
return new RegExp(`^${regex}$`);
|
|
921
|
-
};
|
|
1332
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
922
1333
|
const lowercase = /^[^A-Z]*$/;
|
|
923
1334
|
const uppercase = /^[^a-z]*$/;
|
|
924
1335
|
//#endregion
|
|
925
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
1336
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/checks.js
|
|
926
1337
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
927
1338
|
var _a;
|
|
928
1339
|
inst._zod ?? (inst._zod = {});
|
|
929
1340
|
inst._zod.def = def;
|
|
930
1341
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
931
1342
|
});
|
|
1343
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
1344
|
+
const _whenHasLength = (payload) => {
|
|
1345
|
+
const val = payload.value;
|
|
1346
|
+
return !nullish(val) && val.length !== void 0;
|
|
1347
|
+
};
|
|
932
1348
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
933
1349
|
var _a;
|
|
934
1350
|
$ZodCheck.init(inst, def);
|
|
935
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
936
|
-
const val = payload.value;
|
|
937
|
-
return !nullish(val) && val.length !== void 0;
|
|
938
|
-
});
|
|
939
|
-
inst._zod.onattach.push((inst) => {
|
|
940
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
941
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
942
|
-
});
|
|
1351
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
943
1352
|
inst._zod.check = (payload) => {
|
|
944
1353
|
const input = payload.value;
|
|
945
|
-
|
|
1354
|
+
const units = input.length;
|
|
1355
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
946
1356
|
const origin = getLengthableOrigin(input);
|
|
947
1357
|
payload.issues.push({
|
|
948
1358
|
origin,
|
|
@@ -958,17 +1368,11 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
958
1368
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
959
1369
|
var _a;
|
|
960
1370
|
$ZodCheck.init(inst, def);
|
|
961
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
962
|
-
const val = payload.value;
|
|
963
|
-
return !nullish(val) && val.length !== void 0;
|
|
964
|
-
});
|
|
965
|
-
inst._zod.onattach.push((inst) => {
|
|
966
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
967
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
968
|
-
});
|
|
1371
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
969
1372
|
inst._zod.check = (payload) => {
|
|
970
1373
|
const input = payload.value;
|
|
971
|
-
|
|
1374
|
+
const units = input.length;
|
|
1375
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
972
1376
|
const origin = getLengthableOrigin(input);
|
|
973
1377
|
payload.issues.push({
|
|
974
1378
|
origin,
|
|
@@ -984,19 +1388,11 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
984
1388
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
985
1389
|
var _a;
|
|
986
1390
|
$ZodCheck.init(inst, def);
|
|
987
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
988
|
-
const val = payload.value;
|
|
989
|
-
return !nullish(val) && val.length !== void 0;
|
|
990
|
-
});
|
|
991
|
-
inst._zod.onattach.push((inst) => {
|
|
992
|
-
const bag = inst._zod.bag;
|
|
993
|
-
bag.minimum = def.length;
|
|
994
|
-
bag.maximum = def.length;
|
|
995
|
-
bag.length = def.length;
|
|
996
|
-
});
|
|
1391
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
997
1392
|
inst._zod.check = (payload) => {
|
|
998
1393
|
const input = payload.value;
|
|
999
|
-
const
|
|
1394
|
+
const units = input.length;
|
|
1395
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
1000
1396
|
if (length === def.length) return;
|
|
1001
1397
|
const origin = getLengthableOrigin(input);
|
|
1002
1398
|
const tooBig = length > def.length;
|
|
@@ -1020,14 +1416,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
1020
1416
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1021
1417
|
var _a, _b;
|
|
1022
1418
|
$ZodCheck.init(inst, def);
|
|
1023
|
-
inst._zod.onattach.push((inst) => {
|
|
1024
|
-
const bag = inst._zod.bag;
|
|
1025
|
-
bag.format = def.format;
|
|
1026
|
-
if (def.pattern) {
|
|
1027
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1028
|
-
bag.patterns.add(def.pattern);
|
|
1029
|
-
}
|
|
1030
|
-
});
|
|
1031
1419
|
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1032
1420
|
def.pattern.lastIndex = 0;
|
|
1033
1421
|
if (def.pattern.test(payload.value)) return;
|
|
@@ -1070,13 +1458,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1070
1458
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1071
1459
|
$ZodCheck.init(inst, def);
|
|
1072
1460
|
const escapedRegex = escapeRegex(def.includes);
|
|
1073
|
-
|
|
1074
|
-
def.pattern = pattern;
|
|
1075
|
-
inst._zod.onattach.push((inst) => {
|
|
1076
|
-
const bag = inst._zod.bag;
|
|
1077
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1078
|
-
bag.patterns.add(pattern);
|
|
1079
|
-
});
|
|
1461
|
+
def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1080
1462
|
inst._zod.check = (payload) => {
|
|
1081
1463
|
if (payload.value.includes(def.includes, def.position)) return;
|
|
1082
1464
|
payload.issues.push({
|
|
@@ -1094,11 +1476,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
|
|
|
1094
1476
|
$ZodCheck.init(inst, def);
|
|
1095
1477
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1096
1478
|
def.pattern ?? (def.pattern = pattern);
|
|
1097
|
-
inst._zod.onattach.push((inst) => {
|
|
1098
|
-
const bag = inst._zod.bag;
|
|
1099
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1100
|
-
bag.patterns.add(pattern);
|
|
1101
|
-
});
|
|
1102
1479
|
inst._zod.check = (payload) => {
|
|
1103
1480
|
if (payload.value.startsWith(def.prefix)) return;
|
|
1104
1481
|
payload.issues.push({
|
|
@@ -1116,11 +1493,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
1116
1493
|
$ZodCheck.init(inst, def);
|
|
1117
1494
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1118
1495
|
def.pattern ?? (def.pattern = pattern);
|
|
1119
|
-
inst._zod.onattach.push((inst) => {
|
|
1120
|
-
const bag = inst._zod.bag;
|
|
1121
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1122
|
-
bag.patterns.add(pattern);
|
|
1123
|
-
});
|
|
1124
1496
|
inst._zod.check = (payload) => {
|
|
1125
1497
|
if (payload.value.endsWith(def.suffix)) return;
|
|
1126
1498
|
payload.issues.push({
|
|
@@ -1141,17 +1513,21 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1141
1513
|
};
|
|
1142
1514
|
});
|
|
1143
1515
|
//#endregion
|
|
1144
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
1516
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/doc.js
|
|
1145
1517
|
var Doc = class {
|
|
1146
|
-
constructor(args = []) {
|
|
1518
|
+
constructor(args = [], closed = {}) {
|
|
1147
1519
|
this.content = [];
|
|
1148
1520
|
this.indent = 0;
|
|
1149
|
-
|
|
1521
|
+
this.args = args;
|
|
1522
|
+
this.closed = closed;
|
|
1150
1523
|
}
|
|
1151
1524
|
indented(fn) {
|
|
1152
1525
|
this.indent += 1;
|
|
1153
|
-
|
|
1154
|
-
|
|
1526
|
+
try {
|
|
1527
|
+
fn(this);
|
|
1528
|
+
} finally {
|
|
1529
|
+
this.indent -= 1;
|
|
1530
|
+
}
|
|
1155
1531
|
}
|
|
1156
1532
|
write(arg) {
|
|
1157
1533
|
if (typeof arg === "function") {
|
|
@@ -1166,28 +1542,27 @@ var Doc = class {
|
|
|
1166
1542
|
}
|
|
1167
1543
|
compile() {
|
|
1168
1544
|
const F = Function;
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
return new F(...args, lines.join("\n"));
|
|
1545
|
+
const content = this?.content ?? [``];
|
|
1546
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1172
1547
|
}
|
|
1173
1548
|
};
|
|
1174
1549
|
//#endregion
|
|
1175
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
1550
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/versions.js
|
|
1176
1551
|
const version = {
|
|
1177
1552
|
major: 4,
|
|
1178
|
-
minor:
|
|
1179
|
-
patch:
|
|
1553
|
+
minor: 6,
|
|
1554
|
+
patch: 5
|
|
1180
1555
|
};
|
|
1181
1556
|
//#endregion
|
|
1182
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
1557
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/schemas.js
|
|
1183
1558
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1184
1559
|
var _a;
|
|
1185
1560
|
inst ?? (inst = {});
|
|
1186
1561
|
inst._zod.def = def;
|
|
1187
1562
|
inst._zod.bag = inst._zod.bag || {};
|
|
1188
1563
|
inst._zod.version = version;
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1564
|
+
const defChecks = inst._zod.def.checks;
|
|
1565
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1191
1566
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1192
1567
|
if (checks.length === 0) {
|
|
1193
1568
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1196,6 +1571,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1196
1571
|
});
|
|
1197
1572
|
} else {
|
|
1198
1573
|
const runChecks = (payload, checks, ctx) => {
|
|
1574
|
+
if (payload.memo) return payload;
|
|
1199
1575
|
let isAborted = aborted(payload);
|
|
1200
1576
|
let asyncResult;
|
|
1201
1577
|
for (const ch of checks) {
|
|
@@ -1209,10 +1585,12 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1209
1585
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1210
1586
|
await _;
|
|
1211
1587
|
if (payload.issues.length === currLen) return;
|
|
1588
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1212
1589
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1213
1590
|
});
|
|
1214
1591
|
else {
|
|
1215
1592
|
if (payload.issues.length === currLen) continue;
|
|
1593
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1216
1594
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1217
1595
|
}
|
|
1218
1596
|
}
|
|
@@ -1256,22 +1634,43 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1256
1634
|
return runChecks(result, checks, ctx);
|
|
1257
1635
|
};
|
|
1258
1636
|
}
|
|
1259
|
-
|
|
1637
|
+
}, {
|
|
1638
|
+
get "~standard"() {
|
|
1639
|
+
return hide(this, "~standard", standardProps(this));
|
|
1640
|
+
},
|
|
1641
|
+
set "~standard"(value) {
|
|
1642
|
+
own(this, "~standard", value);
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1646
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1647
|
+
async function validateAsync(inst, value) {
|
|
1648
|
+
const ctx = { async: true };
|
|
1649
|
+
return toStandardResult(await inst._zod.run({
|
|
1650
|
+
value,
|
|
1651
|
+
issues: []
|
|
1652
|
+
}, ctx), ctx);
|
|
1653
|
+
}
|
|
1654
|
+
function standardProps(inst) {
|
|
1655
|
+
return {
|
|
1260
1656
|
validate: (value) => {
|
|
1657
|
+
const ctx = { async: false };
|
|
1261
1658
|
try {
|
|
1262
|
-
const r =
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1659
|
+
const r = inst._zod.run({
|
|
1660
|
+
value,
|
|
1661
|
+
issues: []
|
|
1662
|
+
}, ctx);
|
|
1663
|
+
if (!(r instanceof Promise)) return toStandardResult(r, ctx);
|
|
1664
|
+
} catch (_) {}
|
|
1665
|
+
return validateAsync(inst, value);
|
|
1267
1666
|
},
|
|
1268
1667
|
vendor: "zod",
|
|
1269
1668
|
version: 1
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1272
1671
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1273
1672
|
$ZodType.init(inst, def);
|
|
1274
|
-
inst._zod.pattern =
|
|
1673
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
1275
1674
|
inst._zod.parse = (payload, _) => {
|
|
1276
1675
|
if (def.coerce) try {
|
|
1277
1676
|
payload.value = String(payload.value);
|
|
@@ -1315,51 +1714,95 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1315
1714
|
def.pattern ?? (def.pattern = email);
|
|
1316
1715
|
$ZodStringFormat.init(inst, def);
|
|
1317
1716
|
});
|
|
1717
|
+
function canParseURL(input) {
|
|
1718
|
+
try {
|
|
1719
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
|
|
1720
|
+
new URL(input);
|
|
1721
|
+
return true;
|
|
1722
|
+
} catch {
|
|
1723
|
+
return false;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
function validateURL(trimmed, def) {
|
|
1727
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
|
|
1728
|
+
return parseURLObject(trimmed, def);
|
|
1729
|
+
}
|
|
1730
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
1731
|
+
function parseURLObject(trimmed, def) {
|
|
1732
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1733
|
+
try {
|
|
1734
|
+
if (typeof URL !== "undefined") {
|
|
1735
|
+
const URLStatic = URL;
|
|
1736
|
+
if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
|
|
1737
|
+
}
|
|
1738
|
+
return new URL(trimmed);
|
|
1739
|
+
} catch {
|
|
1740
|
+
return 2;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1744
|
+
/** 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. */
|
|
1745
|
+
function stripTabAndNewline(value) {
|
|
1746
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1747
|
+
}
|
|
1748
|
+
function urlHostnameOk(url, hostname) {
|
|
1749
|
+
hostname.lastIndex = 0;
|
|
1750
|
+
return hostname.test(url.hostname);
|
|
1751
|
+
}
|
|
1752
|
+
function urlProtocolOk(url, protocol) {
|
|
1753
|
+
protocol.lastIndex = 0;
|
|
1754
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1755
|
+
}
|
|
1318
1756
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1319
1757
|
$ZodStringFormat.init(inst, def);
|
|
1320
1758
|
inst._zod.check = (payload) => {
|
|
1321
1759
|
try {
|
|
1322
1760
|
const trimmed = payload.value.trim();
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
code: "invalid_format",
|
|
1327
|
-
format: "url",
|
|
1328
|
-
note: "Invalid URL format",
|
|
1329
|
-
input: payload.value,
|
|
1330
|
-
inst,
|
|
1331
|
-
continue: !def.abort
|
|
1332
|
-
});
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
const url = new URL(trimmed);
|
|
1337
|
-
if (def.hostname) {
|
|
1338
|
-
def.hostname.lastIndex = 0;
|
|
1339
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1761
|
+
const url = validateURL(trimmed, def);
|
|
1762
|
+
if (url === 1) {
|
|
1763
|
+
payload.issues.push({
|
|
1340
1764
|
code: "invalid_format",
|
|
1341
1765
|
format: "url",
|
|
1342
|
-
note: "Invalid
|
|
1343
|
-
pattern: def.hostname.source,
|
|
1766
|
+
note: "Invalid URL format",
|
|
1344
1767
|
input: payload.value,
|
|
1345
1768
|
inst,
|
|
1346
1769
|
continue: !def.abort
|
|
1347
1770
|
});
|
|
1771
|
+
return;
|
|
1348
1772
|
}
|
|
1349
|
-
if (
|
|
1350
|
-
|
|
1351
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1773
|
+
if (url === 2) {
|
|
1774
|
+
payload.issues.push({
|
|
1352
1775
|
code: "invalid_format",
|
|
1353
1776
|
format: "url",
|
|
1354
|
-
note: "Invalid protocol",
|
|
1355
|
-
pattern: def.protocol.source,
|
|
1356
1777
|
input: payload.value,
|
|
1357
1778
|
inst,
|
|
1358
1779
|
continue: !def.abort
|
|
1359
1780
|
});
|
|
1781
|
+
return;
|
|
1360
1782
|
}
|
|
1361
|
-
if (
|
|
1362
|
-
|
|
1783
|
+
if (url === true) {
|
|
1784
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
1785
|
+
return;
|
|
1786
|
+
}
|
|
1787
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1788
|
+
code: "invalid_format",
|
|
1789
|
+
format: "url",
|
|
1790
|
+
note: "Invalid hostname",
|
|
1791
|
+
pattern: def.hostname.source,
|
|
1792
|
+
input: payload.value,
|
|
1793
|
+
inst,
|
|
1794
|
+
continue: !def.abort
|
|
1795
|
+
});
|
|
1796
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1797
|
+
code: "invalid_format",
|
|
1798
|
+
format: "url",
|
|
1799
|
+
note: "Invalid protocol",
|
|
1800
|
+
pattern: def.protocol.source,
|
|
1801
|
+
input: payload.value,
|
|
1802
|
+
inst,
|
|
1803
|
+
continue: !def.abort
|
|
1804
|
+
});
|
|
1805
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1363
1806
|
return;
|
|
1364
1807
|
} catch (_) {
|
|
1365
1808
|
payload.issues.push({
|
|
@@ -1377,7 +1820,8 @@ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
1377
1820
|
$ZodStringFormat.init(inst, def);
|
|
1378
1821
|
});
|
|
1379
1822
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1380
|
-
def.
|
|
1823
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1824
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1381
1825
|
$ZodStringFormat.init(inst, def);
|
|
1382
1826
|
});
|
|
1383
1827
|
/**
|
|
@@ -1406,70 +1850,69 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1406
1850
|
$ZodStringFormat.init(inst, def);
|
|
1407
1851
|
});
|
|
1408
1852
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1409
|
-
def.pattern ?? (def.pattern = datetime
|
|
1853
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
1410
1854
|
$ZodStringFormat.init(inst, def);
|
|
1411
1855
|
});
|
|
1412
1856
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1413
|
-
def.pattern ?? (def.pattern = date
|
|
1857
|
+
def.pattern ?? (def.pattern = date);
|
|
1414
1858
|
$ZodStringFormat.init(inst, def);
|
|
1415
1859
|
});
|
|
1416
1860
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1417
|
-
def.pattern ?? (def.pattern = time
|
|
1861
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1418
1862
|
$ZodStringFormat.init(inst, def);
|
|
1419
1863
|
});
|
|
1420
1864
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1421
|
-
def.pattern ?? (def.pattern = duration
|
|
1865
|
+
def.pattern ?? (def.pattern = duration);
|
|
1422
1866
|
$ZodStringFormat.init(inst, def);
|
|
1423
1867
|
});
|
|
1424
1868
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1425
1869
|
def.pattern ?? (def.pattern = ipv4);
|
|
1426
1870
|
$ZodStringFormat.init(inst, def);
|
|
1427
|
-
inst._zod.bag.format = `ipv4`;
|
|
1428
1871
|
});
|
|
1872
|
+
/** 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`. */
|
|
1873
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1874
|
+
function isValidIPv6(value) {
|
|
1875
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
1876
|
+
return canParseURL(`http://[${value}]`);
|
|
1877
|
+
}
|
|
1429
1878
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1430
1879
|
def.pattern ?? (def.pattern = ipv6);
|
|
1431
1880
|
$ZodStringFormat.init(inst, def);
|
|
1432
|
-
inst._zod.bag.format = `ipv6`;
|
|
1433
1881
|
inst._zod.check = (payload) => {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
payload.
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
inst,
|
|
1442
|
-
continue: !def.abort
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1882
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1883
|
+
code: "invalid_format",
|
|
1884
|
+
format: "ipv6",
|
|
1885
|
+
input: payload.value,
|
|
1886
|
+
inst,
|
|
1887
|
+
continue: !def.abort
|
|
1888
|
+
});
|
|
1445
1889
|
};
|
|
1446
1890
|
});
|
|
1447
1891
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1448
1892
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1449
1893
|
$ZodStringFormat.init(inst, def);
|
|
1450
1894
|
});
|
|
1895
|
+
function isValidCIDRv6(value) {
|
|
1896
|
+
const parts = value.split("/");
|
|
1897
|
+
if (parts.length !== 2) return false;
|
|
1898
|
+
const [address, prefix] = parts;
|
|
1899
|
+
if (!prefix) return false;
|
|
1900
|
+
const prefixNum = Number(prefix);
|
|
1901
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
1902
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1903
|
+
return isValidIPv6(address);
|
|
1904
|
+
}
|
|
1451
1905
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1452
1906
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1453
1907
|
$ZodStringFormat.init(inst, def);
|
|
1454
1908
|
inst._zod.check = (payload) => {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1463
|
-
new URL(`http://[${address}]`);
|
|
1464
|
-
} catch {
|
|
1465
|
-
payload.issues.push({
|
|
1466
|
-
code: "invalid_format",
|
|
1467
|
-
format: "cidrv6",
|
|
1468
|
-
input: payload.value,
|
|
1469
|
-
inst,
|
|
1470
|
-
continue: !def.abort
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1909
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
1910
|
+
code: "invalid_format",
|
|
1911
|
+
format: "cidrv6",
|
|
1912
|
+
input: payload.value,
|
|
1913
|
+
inst,
|
|
1914
|
+
continue: !def.abort
|
|
1915
|
+
});
|
|
1473
1916
|
};
|
|
1474
1917
|
});
|
|
1475
1918
|
function isValidBase64(data) {
|
|
@@ -1483,10 +1926,10 @@ function isValidBase64(data) {
|
|
|
1483
1926
|
return false;
|
|
1484
1927
|
}
|
|
1485
1928
|
}
|
|
1929
|
+
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1486
1930
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1487
|
-
def.pattern ?? (def.pattern =
|
|
1931
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
1488
1932
|
$ZodStringFormat.init(inst, def);
|
|
1489
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1490
1933
|
inst._zod.check = (payload) => {
|
|
1491
1934
|
if (isValidBase64(payload.value)) return;
|
|
1492
1935
|
payload.issues.push({
|
|
@@ -1498,15 +1941,15 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
|
1498
1941
|
});
|
|
1499
1942
|
};
|
|
1500
1943
|
});
|
|
1944
|
+
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1501
1945
|
function isValidBase64URL(data) {
|
|
1502
|
-
if (!
|
|
1946
|
+
if (!base64urlCharset.test(data)) return false;
|
|
1503
1947
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1504
1948
|
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1505
1949
|
}
|
|
1506
1950
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1507
|
-
def.pattern ?? (def.pattern =
|
|
1951
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
1508
1952
|
$ZodStringFormat.init(inst, def);
|
|
1509
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1510
1953
|
inst._zod.check = (payload) => {
|
|
1511
1954
|
if (isValidBase64URL(payload.value)) return;
|
|
1512
1955
|
payload.issues.push({
|
|
@@ -1572,6 +2015,8 @@ function handleArrayResult(result, final, index) {
|
|
|
1572
2015
|
}
|
|
1573
2016
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1574
2017
|
$ZodType.init(inst, def);
|
|
2018
|
+
const memo = globalConfig.memoizer;
|
|
2019
|
+
memo?.attach(inst);
|
|
1575
2020
|
inst._zod.parse = (payload, ctx) => {
|
|
1576
2021
|
const input = payload.value;
|
|
1577
2022
|
if (!Array.isArray(input)) {
|
|
@@ -1583,8 +2028,9 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1583
2028
|
});
|
|
1584
2029
|
return payload;
|
|
1585
2030
|
}
|
|
1586
|
-
payload.value = Array(input.length);
|
|
2031
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1587
2032
|
const proms = [];
|
|
2033
|
+
const abortEarly = ctx?.abortEarly;
|
|
1588
2034
|
for (let i = 0; i < input.length; i++) {
|
|
1589
2035
|
const item = input[i];
|
|
1590
2036
|
const result = def.element._zod.run({
|
|
@@ -1592,19 +2038,24 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1592
2038
|
issues: []
|
|
1593
2039
|
}, ctx);
|
|
1594
2040
|
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1595
|
-
else
|
|
2041
|
+
else {
|
|
2042
|
+
handleArrayResult(result, payload, i);
|
|
2043
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
|
|
2044
|
+
}
|
|
1596
2045
|
}
|
|
1597
2046
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1598
2047
|
return payload;
|
|
1599
2048
|
};
|
|
1600
2049
|
});
|
|
1601
|
-
function handlePropertyResult(result, final, key, input,
|
|
2050
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1602
2051
|
const isPresent = key in input;
|
|
2052
|
+
const isOptionalOut = optout === "optional";
|
|
2053
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1603
2054
|
if (result.issues.length) {
|
|
1604
|
-
if (
|
|
2055
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
1605
2056
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1606
2057
|
}
|
|
1607
|
-
if (!isPresent &&
|
|
2058
|
+
if (!isPresent && optin === void 0) {
|
|
1608
2059
|
if (!result.issues.length) final.issues.push({
|
|
1609
2060
|
code: "invalid_type",
|
|
1610
2061
|
expected: "nonoptional",
|
|
@@ -1614,31 +2065,44 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
1614
2065
|
return;
|
|
1615
2066
|
}
|
|
1616
2067
|
if (result.value === void 0) {
|
|
1617
|
-
if (isPresent) final.value[key] = void 0;
|
|
2068
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
|
|
1618
2069
|
} else final.value[key] = result.value;
|
|
1619
2070
|
}
|
|
2071
|
+
const NO_SYMBOL_KEYS = [];
|
|
1620
2072
|
function normalizeDef(def) {
|
|
1621
2073
|
const keys = Object.keys(def.shape);
|
|
1622
|
-
|
|
2074
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
2075
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
2076
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
2077
|
+
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`);
|
|
1623
2078
|
const okeys = optionalKeys(def.shape);
|
|
1624
2079
|
return {
|
|
1625
2080
|
...def,
|
|
1626
|
-
|
|
2081
|
+
allKeys,
|
|
2082
|
+
symbolKeys,
|
|
1627
2083
|
keySet: new Set(keys),
|
|
1628
2084
|
numKeys: keys.length,
|
|
1629
2085
|
optionalKeys: new Set(okeys)
|
|
1630
2086
|
};
|
|
1631
2087
|
}
|
|
1632
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2088
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
1633
2089
|
const unrecognized = [];
|
|
1634
2090
|
const keySet = def.keySet;
|
|
1635
2091
|
const _catchall = def.catchall._zod;
|
|
1636
2092
|
const t = _catchall.def.type;
|
|
1637
|
-
const
|
|
1638
|
-
const
|
|
2093
|
+
const optin = _catchall.optin;
|
|
2094
|
+
const optout = _catchall.optout;
|
|
2095
|
+
let seen = 0;
|
|
1639
2096
|
for (const key in input) {
|
|
1640
|
-
if (
|
|
2097
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2098
|
+
if (aborted(payload, seen)) break;
|
|
2099
|
+
seen = payload.issues.length;
|
|
2100
|
+
}
|
|
1641
2101
|
if (keySet.has(key)) continue;
|
|
2102
|
+
if (key === "__proto__") {
|
|
2103
|
+
if (t === "never") unrecognized.push(key);
|
|
2104
|
+
continue;
|
|
2105
|
+
}
|
|
1642
2106
|
if (t === "never") {
|
|
1643
2107
|
unrecognized.push(key);
|
|
1644
2108
|
continue;
|
|
@@ -1647,14 +2111,15 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1647
2111
|
value: input[key],
|
|
1648
2112
|
issues: []
|
|
1649
2113
|
}, ctx);
|
|
1650
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1651
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2114
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2115
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1652
2116
|
}
|
|
1653
2117
|
if (unrecognized.length) payload.issues.push({
|
|
1654
2118
|
code: "unrecognized_keys",
|
|
1655
2119
|
keys: unrecognized,
|
|
1656
2120
|
input,
|
|
1657
|
-
inst
|
|
2121
|
+
inst,
|
|
2122
|
+
continue: true
|
|
1658
2123
|
});
|
|
1659
2124
|
if (!proms.length) return payload;
|
|
1660
2125
|
return Promise.all(proms).then(() => {
|
|
@@ -1663,34 +2128,41 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1663
2128
|
}
|
|
1664
2129
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1665
2130
|
$ZodType.init(inst, def);
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
2131
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
2132
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
2133
|
+
if (sh) {
|
|
2134
|
+
const get = () => {
|
|
1669
2135
|
const newSh = { ...sh };
|
|
1670
2136
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
2137
|
+
get.raw = newSh;
|
|
1671
2138
|
return newSh;
|
|
1672
|
-
}
|
|
2139
|
+
};
|
|
2140
|
+
get.raw = sh;
|
|
2141
|
+
Object.defineProperty(def, "shape", { get });
|
|
1673
2142
|
}
|
|
1674
2143
|
const _normalized = cached(() => normalizeDef(def));
|
|
1675
|
-
|
|
1676
|
-
const shape = def.shape;
|
|
2144
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2145
|
+
const shape = zod.def.shape;
|
|
1677
2146
|
const propValues = {};
|
|
1678
2147
|
for (const key in shape) {
|
|
1679
2148
|
const field = shape[key]._zod;
|
|
1680
2149
|
if (field.values) {
|
|
1681
|
-
propValues
|
|
2150
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
1682
2151
|
for (const v of field.values) propValues[key].add(v);
|
|
2152
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
1683
2153
|
}
|
|
1684
2154
|
}
|
|
1685
2155
|
return propValues;
|
|
1686
2156
|
});
|
|
1687
|
-
const isObject$
|
|
2157
|
+
const isObject$1 = isObject;
|
|
1688
2158
|
const catchall = def.catchall;
|
|
1689
2159
|
let value;
|
|
2160
|
+
const memo = globalConfig.memoizer;
|
|
2161
|
+
memo?.attach(inst);
|
|
1690
2162
|
inst._zod.parse = (payload, ctx) => {
|
|
1691
2163
|
value ?? (value = _normalized.value);
|
|
1692
2164
|
const input = payload.value;
|
|
1693
|
-
if (!isObject$
|
|
2165
|
+
if (!isObject$1(input)) {
|
|
1694
2166
|
payload.issues.push({
|
|
1695
2167
|
expected: "object",
|
|
1696
2168
|
code: "invalid_type",
|
|
@@ -1699,77 +2171,90 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1699
2171
|
});
|
|
1700
2172
|
return payload;
|
|
1701
2173
|
}
|
|
1702
|
-
payload.value = {};
|
|
2174
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1703
2175
|
const proms = [];
|
|
1704
2176
|
const shape = value.shape;
|
|
1705
|
-
|
|
2177
|
+
const abortEarly = ctx?.abortEarly;
|
|
2178
|
+
let seen = payload.issues.length;
|
|
2179
|
+
for (const key of value.allKeys) {
|
|
2180
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2181
|
+
if (aborted(payload, seen)) break;
|
|
2182
|
+
seen = payload.issues.length;
|
|
2183
|
+
}
|
|
2184
|
+
if (key === "__proto__") continue;
|
|
1706
2185
|
const el = shape[key];
|
|
1707
|
-
const
|
|
1708
|
-
const
|
|
2186
|
+
const optin = el._zod.optin;
|
|
2187
|
+
const optout = el._zod.optout;
|
|
1709
2188
|
const r = el._zod.run({
|
|
1710
2189
|
value: input[key],
|
|
1711
2190
|
issues: []
|
|
1712
2191
|
}, ctx);
|
|
1713
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1714
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2192
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2193
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1715
2194
|
}
|
|
1716
2195
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1717
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2196
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
1718
2197
|
};
|
|
1719
2198
|
});
|
|
1720
2199
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1721
2200
|
$ZodObject.init(inst, def);
|
|
1722
2201
|
const superParse = inst._zod.parse;
|
|
1723
2202
|
const _normalized = cached(() => normalizeDef(def));
|
|
2203
|
+
const memo = globalConfig.memoizer;
|
|
1724
2204
|
const generateFastpass = (shape) => {
|
|
1725
|
-
const doc = new Doc([
|
|
1726
|
-
"shape",
|
|
1727
|
-
"payload",
|
|
1728
|
-
"ctx"
|
|
1729
|
-
]);
|
|
1730
2205
|
const normalized = _normalized.value;
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2206
|
+
const syms = normalized.symbolKeys;
|
|
2207
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
2208
|
+
shape,
|
|
2209
|
+
inst,
|
|
2210
|
+
memo,
|
|
2211
|
+
syms
|
|
2212
|
+
});
|
|
2213
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2214
|
+
const prefixStr = (id, k) => `
|
|
2215
|
+
let ${id}_ab = false;
|
|
2216
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2217
|
+
const iss = ${id}.issues[i];
|
|
2218
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2219
|
+
payload.issues.push(iss);
|
|
2220
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
2221
|
+
}
|
|
2222
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2223
|
+
payload.value = newResult;
|
|
2224
|
+
return payload;
|
|
2225
|
+
}`;
|
|
1735
2226
|
doc.write(`const input = payload.value;`);
|
|
1736
2227
|
const ids = Object.create(null);
|
|
1737
2228
|
let counter = 0;
|
|
1738
|
-
for (const key of normalized.
|
|
1739
|
-
doc.write(`const newResult = {};`);
|
|
1740
|
-
for (const key of normalized.
|
|
2229
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
2230
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2231
|
+
for (const key of normalized.allKeys) {
|
|
2232
|
+
if (key === "__proto__") continue;
|
|
1741
2233
|
const id = ids[key];
|
|
1742
|
-
const k = esc(key);
|
|
2234
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2235
|
+
const isPresent = `${k} in input`;
|
|
1743
2236
|
const schema = shape[key];
|
|
1744
|
-
const
|
|
2237
|
+
const optin = schema?._zod?.optin;
|
|
2238
|
+
const isOptionalIn = optin !== void 0;
|
|
1745
2239
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1746
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1747
|
-
if (isOptionalIn && isOptionalOut)
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
})));
|
|
2240
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2241
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2242
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2243
|
+
doc.write(`
|
|
2244
|
+
const ${id}_present = ${isPresent};
|
|
2245
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2246
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1754
2247
|
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
if (${k} in input) {
|
|
1759
|
-
newResult[${k}] = undefined;
|
|
2248
|
+
|
|
2249
|
+
if (${assign}) {
|
|
2250
|
+
newResult[${k}] = ${id}.value;
|
|
1760
2251
|
}
|
|
1761
|
-
} else {
|
|
1762
|
-
newResult[${k}] = ${id}.value;
|
|
1763
2252
|
}
|
|
1764
|
-
|
|
2253
|
+
|
|
1765
2254
|
`);
|
|
1766
|
-
else if (!isOptionalIn) doc.write(`
|
|
1767
|
-
const ${id}_present = ${
|
|
1768
|
-
if (${id}.issues.length) {
|
|
1769
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1770
|
-
...iss,
|
|
1771
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1772
|
-
})));
|
|
2255
|
+
} else if (!isOptionalIn) doc.write(`
|
|
2256
|
+
const ${id}_present = ${isPresent};
|
|
2257
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1773
2258
|
}
|
|
1774
2259
|
if (!${id}_present && !${id}.issues.length) {
|
|
1775
2260
|
payload.issues.push({
|
|
@@ -1778,42 +2263,36 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1778
2263
|
input: undefined,
|
|
1779
2264
|
path: [${k}]
|
|
1780
2265
|
});
|
|
2266
|
+
if (ctx && ctx.abortEarly) {
|
|
2267
|
+
payload.value = newResult;
|
|
2268
|
+
return payload;
|
|
2269
|
+
}
|
|
1781
2270
|
}
|
|
1782
2271
|
|
|
1783
2272
|
if (${id}_present) {
|
|
1784
|
-
|
|
1785
|
-
newResult[${k}] = undefined;
|
|
1786
|
-
} else {
|
|
1787
|
-
newResult[${k}] = ${id}.value;
|
|
1788
|
-
}
|
|
2273
|
+
newResult[${k}] = ${id}.value;
|
|
1789
2274
|
}
|
|
1790
2275
|
|
|
1791
2276
|
`);
|
|
1792
|
-
else
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
...iss,
|
|
1796
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1797
|
-
})));
|
|
2277
|
+
else {
|
|
2278
|
+
doc.write(`
|
|
2279
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1798
2280
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
} else {
|
|
2281
|
+
`);
|
|
2282
|
+
if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
|
|
2283
|
+
else doc.write(`
|
|
2284
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
1805
2285
|
newResult[${k}] = ${id}.value;
|
|
1806
2286
|
}
|
|
1807
|
-
|
|
1808
2287
|
`);
|
|
2288
|
+
}
|
|
1809
2289
|
}
|
|
1810
2290
|
doc.write(`payload.value = newResult;`);
|
|
1811
2291
|
doc.write(`return payload;`);
|
|
1812
|
-
|
|
1813
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2292
|
+
return doc.compile();
|
|
1814
2293
|
};
|
|
1815
2294
|
let fastpass;
|
|
1816
|
-
const isObject$
|
|
2295
|
+
const isObject$2 = isObject;
|
|
1817
2296
|
const jit = !globalConfig.jitless;
|
|
1818
2297
|
const fastEnabled = jit && allowsEval.value;
|
|
1819
2298
|
const catchall = def.catchall;
|
|
@@ -1821,7 +2300,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1821
2300
|
inst._zod.parse = (payload, ctx) => {
|
|
1822
2301
|
value ?? (value = _normalized.value);
|
|
1823
2302
|
const input = payload.value;
|
|
1824
|
-
if (!isObject$
|
|
2303
|
+
if (!isObject$2(input)) {
|
|
1825
2304
|
payload.issues.push({
|
|
1826
2305
|
expected: "object",
|
|
1827
2306
|
code: "invalid_type",
|
|
@@ -1834,7 +2313,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1834
2313
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1835
2314
|
payload = fastpass(payload, ctx);
|
|
1836
2315
|
if (!catchall) return payload;
|
|
1837
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2316
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1838
2317
|
}
|
|
1839
2318
|
return superParse(payload, ctx);
|
|
1840
2319
|
};
|
|
@@ -1859,14 +2338,14 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1859
2338
|
}
|
|
1860
2339
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1861
2340
|
$ZodType.init(inst, def);
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2341
|
+
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);
|
|
2342
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2343
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2344
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1866
2345
|
});
|
|
1867
|
-
|
|
1868
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1869
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2346
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2347
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2348
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1870
2349
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1871
2350
|
}
|
|
1872
2351
|
});
|
|
@@ -1928,7 +2407,9 @@ function mergeValues(a, b) {
|
|
|
1928
2407
|
...a,
|
|
1929
2408
|
...b
|
|
1930
2409
|
};
|
|
2410
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
1931
2411
|
for (const key of sharedKeys) {
|
|
2412
|
+
if (key === "__proto__") continue;
|
|
1932
2413
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1933
2414
|
if (!sharedValue.valid) return {
|
|
1934
2415
|
valid: false,
|
|
@@ -1970,26 +2451,39 @@ function mergeValues(a, b) {
|
|
|
1970
2451
|
function handleIntersectionResults(result, left, right) {
|
|
1971
2452
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1972
2453
|
let unrecIssue;
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2454
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2455
|
+
const collect = (iss, side) => {
|
|
2456
|
+
let keys;
|
|
2457
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2458
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
2459
|
+
keys = iss.keys;
|
|
2460
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2461
|
+
const k = String(iss.path[0]);
|
|
2462
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2463
|
+
keys = [k];
|
|
2464
|
+
} else return false;
|
|
2465
|
+
for (const k of keys) {
|
|
1976
2466
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1977
|
-
unrecKeys.get(k)
|
|
2467
|
+
unrecKeys.get(k)[side] = true;
|
|
1978
2468
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
else result.issues.push(iss);
|
|
2469
|
+
return true;
|
|
2470
|
+
};
|
|
2471
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
2472
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
1985
2473
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1986
|
-
if (bothKeys.length
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2474
|
+
if (bothKeys.length) {
|
|
2475
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2476
|
+
if (aggregated.length) result.issues.push({
|
|
2477
|
+
...unrecIssue,
|
|
2478
|
+
keys: aggregated
|
|
2479
|
+
});
|
|
2480
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
2481
|
+
}
|
|
1991
2482
|
const merged = mergeValues(left.value, right.value);
|
|
1992
|
-
if (!merged.valid)
|
|
2483
|
+
if (!merged.valid) {
|
|
2484
|
+
if (aborted(result)) return result;
|
|
2485
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2486
|
+
}
|
|
1993
2487
|
result.value = merged.data;
|
|
1994
2488
|
return result;
|
|
1995
2489
|
}
|
|
@@ -1998,7 +2492,10 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
1998
2492
|
const values = getEnumValues(def.entries);
|
|
1999
2493
|
const valuesSet = new Set(values);
|
|
2000
2494
|
inst._zod.values = valuesSet;
|
|
2001
|
-
inst
|
|
2495
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2496
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2497
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2498
|
+
});
|
|
2002
2499
|
inst._zod.parse = (payload, _ctx) => {
|
|
2003
2500
|
const input = payload.value;
|
|
2004
2501
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2014,67 +2511,66 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2014
2511
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2015
2512
|
$ZodType.init(inst, def);
|
|
2016
2513
|
inst._zod.optin = "optional";
|
|
2514
|
+
globalConfig.memoizer?.guard(inst);
|
|
2017
2515
|
inst._zod.parse = (payload, ctx) => {
|
|
2018
2516
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2019
2517
|
const _out = def.transform(payload.value, payload);
|
|
2020
2518
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2021
2519
|
payload.value = output;
|
|
2022
|
-
payload.fallback = true;
|
|
2023
2520
|
return payload;
|
|
2024
2521
|
});
|
|
2025
2522
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2026
2523
|
payload.value = _out;
|
|
2027
|
-
payload.fallback = true;
|
|
2028
2524
|
return payload;
|
|
2029
2525
|
};
|
|
2030
2526
|
});
|
|
2031
|
-
function handleOptionalResult(
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
value: void 0
|
|
2035
|
-
};
|
|
2036
|
-
return result;
|
|
2527
|
+
function handleOptionalResult(payload, result) {
|
|
2528
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2529
|
+
return payload;
|
|
2037
2530
|
}
|
|
2038
2531
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2039
2532
|
$ZodType.init(inst, def);
|
|
2040
|
-
inst._zod.optin
|
|
2533
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2041
2534
|
inst._zod.optout = "optional";
|
|
2042
|
-
|
|
2043
|
-
|
|
2535
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2536
|
+
const values = zod.def.innerType._zod.values;
|
|
2537
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
2044
2538
|
});
|
|
2045
|
-
|
|
2046
|
-
const pattern = def.innerType._zod.pattern;
|
|
2539
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2540
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2047
2541
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2048
2542
|
});
|
|
2049
2543
|
inst._zod.parse = (payload, ctx) => {
|
|
2050
|
-
if (
|
|
2051
|
-
|
|
2052
|
-
const result = def.innerType._zod.run(
|
|
2053
|
-
|
|
2054
|
-
|
|
2544
|
+
if (payload.value === void 0) {
|
|
2545
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
2546
|
+
const result = def.innerType._zod.run({
|
|
2547
|
+
value: payload.value,
|
|
2548
|
+
issues: []
|
|
2549
|
+
}, ctx);
|
|
2550
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2551
|
+
return handleOptionalResult(payload, result);
|
|
2055
2552
|
}
|
|
2056
|
-
if (payload.value === void 0) return payload;
|
|
2057
2553
|
return def.innerType._zod.run(payload, ctx);
|
|
2058
2554
|
};
|
|
2059
2555
|
});
|
|
2060
2556
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2061
2557
|
$ZodOptional.init(inst, def);
|
|
2062
|
-
|
|
2063
|
-
|
|
2558
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2559
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2064
2560
|
inst._zod.parse = (payload, ctx) => {
|
|
2065
2561
|
return def.innerType._zod.run(payload, ctx);
|
|
2066
2562
|
};
|
|
2067
2563
|
});
|
|
2068
2564
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2069
2565
|
$ZodType.init(inst, def);
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
const pattern = def.innerType._zod.pattern;
|
|
2566
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2567
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2568
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2569
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2074
2570
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2075
2571
|
});
|
|
2076
|
-
|
|
2077
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2572
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2573
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
2078
2574
|
});
|
|
2079
2575
|
inst._zod.parse = (payload, ctx) => {
|
|
2080
2576
|
if (payload.value === null) return payload;
|
|
@@ -2083,8 +2579,8 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
|
2083
2579
|
});
|
|
2084
2580
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2085
2581
|
$ZodType.init(inst, def);
|
|
2086
|
-
inst._zod.optin = "
|
|
2087
|
-
|
|
2582
|
+
inst._zod.optin = "defaulted";
|
|
2583
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2088
2584
|
inst._zod.parse = (payload, ctx) => {
|
|
2089
2585
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2090
2586
|
if (payload.value === void 0) {
|
|
@@ -2105,8 +2601,8 @@ function handleDefaultResult(payload, def) {
|
|
|
2105
2601
|
}
|
|
2106
2602
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2107
2603
|
$ZodType.init(inst, def);
|
|
2108
|
-
inst._zod.optin = "
|
|
2109
|
-
|
|
2604
|
+
inst._zod.optin = "defaulted";
|
|
2605
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2110
2606
|
inst._zod.parse = (payload, ctx) => {
|
|
2111
2607
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2112
2608
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -2115,8 +2611,8 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
2115
2611
|
});
|
|
2116
2612
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2117
2613
|
$ZodType.init(inst, def);
|
|
2118
|
-
|
|
2119
|
-
const v = def.innerType._zod.values;
|
|
2614
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2615
|
+
const v = zod.def.innerType._zod.values;
|
|
2120
2616
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2121
2617
|
});
|
|
2122
2618
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2134,46 +2630,41 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2134
2630
|
});
|
|
2135
2631
|
return payload;
|
|
2136
2632
|
}
|
|
2633
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2634
|
+
if (!result.issues.length) {
|
|
2635
|
+
payload.value = result.value;
|
|
2636
|
+
if (result.memo) payload.memo = true;
|
|
2637
|
+
return payload;
|
|
2638
|
+
}
|
|
2639
|
+
payload.value = def.catchValue({
|
|
2640
|
+
...result,
|
|
2641
|
+
value: payload.value,
|
|
2642
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2643
|
+
input: payload.value
|
|
2644
|
+
});
|
|
2645
|
+
return payload;
|
|
2646
|
+
}
|
|
2137
2647
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2138
2648
|
$ZodType.init(inst, def);
|
|
2139
|
-
inst._zod.optin
|
|
2140
|
-
|
|
2141
|
-
|
|
2649
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2650
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2651
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2142
2652
|
inst._zod.parse = (payload, ctx) => {
|
|
2143
2653
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2144
|
-
const result = def.innerType._zod.run(
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2151
|
-
input: payload.value
|
|
2152
|
-
});
|
|
2153
|
-
payload.issues = [];
|
|
2154
|
-
payload.fallback = true;
|
|
2155
|
-
}
|
|
2156
|
-
return payload;
|
|
2157
|
-
});
|
|
2158
|
-
payload.value = result.value;
|
|
2159
|
-
if (result.issues.length) {
|
|
2160
|
-
payload.value = def.catchValue({
|
|
2161
|
-
...payload,
|
|
2162
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2163
|
-
input: payload.value
|
|
2164
|
-
});
|
|
2165
|
-
payload.issues = [];
|
|
2166
|
-
payload.fallback = true;
|
|
2167
|
-
}
|
|
2168
|
-
return payload;
|
|
2654
|
+
const result = def.innerType._zod.run({
|
|
2655
|
+
value: payload.value,
|
|
2656
|
+
issues: []
|
|
2657
|
+
}, ctx);
|
|
2658
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2659
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2169
2660
|
};
|
|
2170
2661
|
});
|
|
2171
2662
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2172
2663
|
$ZodType.init(inst, def);
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2664
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2665
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2666
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2667
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2177
2668
|
inst._zod.parse = (payload, ctx) => {
|
|
2178
2669
|
if (ctx.direction === "backward") {
|
|
2179
2670
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2186,22 +2677,21 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2186
2677
|
};
|
|
2187
2678
|
});
|
|
2188
2679
|
function handlePipeResult(left, next, ctx) {
|
|
2189
|
-
if (left.issues.
|
|
2680
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2190
2681
|
left.aborted = true;
|
|
2191
2682
|
return left;
|
|
2192
2683
|
}
|
|
2193
2684
|
return next._zod.run({
|
|
2194
2685
|
value: left.value,
|
|
2195
|
-
issues: left.issues
|
|
2196
|
-
fallback: left.fallback
|
|
2686
|
+
issues: left.issues
|
|
2197
2687
|
}, ctx);
|
|
2198
2688
|
}
|
|
2199
2689
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2200
2690
|
$ZodType.init(inst, def);
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2691
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2692
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2693
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2694
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2205
2695
|
inst._zod.parse = (payload, ctx) => {
|
|
2206
2696
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2207
2697
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2210,7 +2700,7 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2210
2700
|
};
|
|
2211
2701
|
});
|
|
2212
2702
|
function handleReadonlyResult(payload) {
|
|
2213
|
-
payload.value = Object.freeze(payload.value);
|
|
2703
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
2214
2704
|
return payload;
|
|
2215
2705
|
}
|
|
2216
2706
|
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
@@ -2240,7 +2730,368 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2240
2730
|
}
|
|
2241
2731
|
}
|
|
2242
2732
|
//#endregion
|
|
2243
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
2733
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/memoizer.js
|
|
2734
|
+
var $ZodCyclicError = class extends Error {
|
|
2735
|
+
constructor() {
|
|
2736
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2737
|
+
this.name = "ZodCyclicError";
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2741
|
+
const STATE = "~memo";
|
|
2742
|
+
const NO_ISSUES = [];
|
|
2743
|
+
function isRef(value) {
|
|
2744
|
+
return value !== null && typeof value === "object";
|
|
2745
|
+
}
|
|
2746
|
+
function cloneIssues(issues) {
|
|
2747
|
+
return issues.map((iss) => iss.path ? {
|
|
2748
|
+
...iss,
|
|
2749
|
+
path: iss.path.slice()
|
|
2750
|
+
} : { ...iss });
|
|
2751
|
+
}
|
|
2752
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2753
|
+
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
2754
|
+
const NONE = 0;
|
|
2755
|
+
const ASSUMED = 1;
|
|
2756
|
+
const PROVEN = 2;
|
|
2757
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2758
|
+
function isRecursive(inst, stack, resolve) {
|
|
2759
|
+
const cached = recursive.get(inst);
|
|
2760
|
+
if (cached !== void 0) return cached ? PROVEN : NONE;
|
|
2761
|
+
if (stack.has(inst)) return PROVEN;
|
|
2762
|
+
stack.add(inst);
|
|
2763
|
+
let result = NONE;
|
|
2764
|
+
const check = (child) => {
|
|
2765
|
+
if (result !== PROVEN && child?._zod) {
|
|
2766
|
+
const answer = isRecursive(child, stack, resolve);
|
|
2767
|
+
if (answer > result) result = answer;
|
|
2768
|
+
}
|
|
2769
|
+
};
|
|
2770
|
+
const shape = (sh, spread) => {
|
|
2771
|
+
let answer = NONE;
|
|
2772
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
2773
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
2774
|
+
if (spread && !desc.enumerable) continue;
|
|
2775
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
2776
|
+
if (child > answer) answer = child;
|
|
2777
|
+
}
|
|
2778
|
+
return answer;
|
|
2779
|
+
};
|
|
2780
|
+
const merge = (answer) => {
|
|
2781
|
+
if (answer > result) result = answer;
|
|
2782
|
+
};
|
|
2783
|
+
const def = inst._zod.def;
|
|
2784
|
+
switch (def.type) {
|
|
2785
|
+
case "object": {
|
|
2786
|
+
const raw = rawShape(def);
|
|
2787
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
2788
|
+
check(def.catchall);
|
|
2789
|
+
break;
|
|
2790
|
+
}
|
|
2791
|
+
case "array":
|
|
2792
|
+
check(def.element);
|
|
2793
|
+
break;
|
|
2794
|
+
case "tuple":
|
|
2795
|
+
for (const el of def.items) check(el);
|
|
2796
|
+
check(def.rest);
|
|
2797
|
+
break;
|
|
2798
|
+
case "record":
|
|
2799
|
+
case "map":
|
|
2800
|
+
check(def.keyType);
|
|
2801
|
+
check(def.valueType);
|
|
2802
|
+
break;
|
|
2803
|
+
case "set":
|
|
2804
|
+
check(def.valueType);
|
|
2805
|
+
break;
|
|
2806
|
+
case "union":
|
|
2807
|
+
for (const el of def.options) check(el);
|
|
2808
|
+
break;
|
|
2809
|
+
case "intersection":
|
|
2810
|
+
check(def.left);
|
|
2811
|
+
check(def.right);
|
|
2812
|
+
break;
|
|
2813
|
+
case "optional":
|
|
2814
|
+
case "nullable":
|
|
2815
|
+
case "default":
|
|
2816
|
+
case "prefault":
|
|
2817
|
+
case "catch":
|
|
2818
|
+
case "readonly":
|
|
2819
|
+
case "nonoptional":
|
|
2820
|
+
case "promise":
|
|
2821
|
+
case "success":
|
|
2822
|
+
check(def.innerType);
|
|
2823
|
+
break;
|
|
2824
|
+
case "pipe":
|
|
2825
|
+
check(def.in);
|
|
2826
|
+
check(def.out);
|
|
2827
|
+
break;
|
|
2828
|
+
case "function":
|
|
2829
|
+
check(def.input);
|
|
2830
|
+
check(def.output);
|
|
2831
|
+
break;
|
|
2832
|
+
case "lazy": {
|
|
2833
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
2834
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
2835
|
+
break;
|
|
2836
|
+
}
|
|
2837
|
+
case "template_literal":
|
|
2838
|
+
case "string":
|
|
2839
|
+
case "number":
|
|
2840
|
+
case "int":
|
|
2841
|
+
case "boolean":
|
|
2842
|
+
case "bigint":
|
|
2843
|
+
case "symbol":
|
|
2844
|
+
case "undefined":
|
|
2845
|
+
case "null":
|
|
2846
|
+
case "void":
|
|
2847
|
+
case "never":
|
|
2848
|
+
case "any":
|
|
2849
|
+
case "unknown":
|
|
2850
|
+
case "date":
|
|
2851
|
+
case "nan":
|
|
2852
|
+
case "enum":
|
|
2853
|
+
case "literal":
|
|
2854
|
+
case "file":
|
|
2855
|
+
case "transform":
|
|
2856
|
+
case "custom": break;
|
|
2857
|
+
default: for (const key in def) {
|
|
2858
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
2859
|
+
if (!desc || desc.get) continue;
|
|
2860
|
+
const value = desc.value;
|
|
2861
|
+
if (!value || typeof value !== "object") continue;
|
|
2862
|
+
if (value._zod) check(value);
|
|
2863
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
stack.delete(inst);
|
|
2867
|
+
return settle(inst, result);
|
|
2868
|
+
}
|
|
2869
|
+
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
2870
|
+
function settle(inst, answer) {
|
|
2871
|
+
if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
|
|
2872
|
+
return answer;
|
|
2873
|
+
}
|
|
2874
|
+
function bucketFor(state, inst) {
|
|
2875
|
+
let bucket = state.buckets.get(inst);
|
|
2876
|
+
if (!bucket) {
|
|
2877
|
+
bucket = /* @__PURE__ */ new WeakMap();
|
|
2878
|
+
state.buckets.set(inst, bucket);
|
|
2879
|
+
}
|
|
2880
|
+
return bucket;
|
|
2881
|
+
}
|
|
2882
|
+
let handoff;
|
|
2883
|
+
const open = [];
|
|
2884
|
+
const memo = {
|
|
2885
|
+
alloc(_inst, payload, empty) {
|
|
2886
|
+
const bucket = handoff;
|
|
2887
|
+
if (!bucket) return empty;
|
|
2888
|
+
handoff = void 0;
|
|
2889
|
+
const entry = {
|
|
2890
|
+
value: empty,
|
|
2891
|
+
issues: null
|
|
2892
|
+
};
|
|
2893
|
+
bucket.set(payload.value, entry);
|
|
2894
|
+
open.push(entry);
|
|
2895
|
+
return empty;
|
|
2896
|
+
},
|
|
2897
|
+
guard(inst) {
|
|
2898
|
+
var _a;
|
|
2899
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2900
|
+
inst._zod.deferred.push(() => {
|
|
2901
|
+
const base = inst._zod.parse;
|
|
2902
|
+
const wrapped = (payload, ctx) => {
|
|
2903
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2904
|
+
return base(payload, ctx);
|
|
2905
|
+
};
|
|
2906
|
+
inst._zod.parse = wrapped;
|
|
2907
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2908
|
+
});
|
|
2909
|
+
},
|
|
2910
|
+
attach(inst) {
|
|
2911
|
+
var _a;
|
|
2912
|
+
let isRecursiveInst;
|
|
2913
|
+
let rechecked = false;
|
|
2914
|
+
let lastCtx;
|
|
2915
|
+
let lastBucket;
|
|
2916
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2917
|
+
inst._zod.deferred.push(() => {
|
|
2918
|
+
const base = inst._zod.parse;
|
|
2919
|
+
const wrapped = (payload, ctx) => {
|
|
2920
|
+
if (isRecursiveInst === void 0) {
|
|
2921
|
+
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
2922
|
+
if (walked === NONE) {
|
|
2923
|
+
inst._zod.parse = base;
|
|
2924
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2925
|
+
return base(payload, ctx);
|
|
2926
|
+
}
|
|
2927
|
+
if (walked === PROVEN || rechecked) isRecursiveInst = true;
|
|
2928
|
+
else rechecked = true;
|
|
2929
|
+
}
|
|
2930
|
+
const input = payload.value;
|
|
2931
|
+
if (!isRef(input)) return base(payload, ctx);
|
|
2932
|
+
let state = ctx[STATE];
|
|
2933
|
+
if (!state) {
|
|
2934
|
+
state = {
|
|
2935
|
+
buckets: /* @__PURE__ */ new WeakMap(),
|
|
2936
|
+
backEdges: void 0
|
|
2937
|
+
};
|
|
2938
|
+
ctx[STATE] = state;
|
|
2939
|
+
}
|
|
2940
|
+
let bucket;
|
|
2941
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
2942
|
+
else {
|
|
2943
|
+
bucket = bucketFor(state, inst);
|
|
2944
|
+
lastCtx = ctx;
|
|
2945
|
+
lastBucket = bucket;
|
|
2946
|
+
}
|
|
2947
|
+
const hit = bucket.get(input);
|
|
2948
|
+
if (hit) {
|
|
2949
|
+
payload.value = hit.value;
|
|
2950
|
+
if (hit.issues) {
|
|
2951
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2952
|
+
} else {
|
|
2953
|
+
payload.memo = true;
|
|
2954
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
2955
|
+
state.backEdges.add(hit.value);
|
|
2956
|
+
}
|
|
2957
|
+
return payload;
|
|
2958
|
+
}
|
|
2959
|
+
handoff = bucket;
|
|
2960
|
+
const depth = open.length;
|
|
2961
|
+
const result = base(payload, ctx);
|
|
2962
|
+
handoff = void 0;
|
|
2963
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
2964
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
2965
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2966
|
+
return r;
|
|
2967
|
+
});
|
|
2968
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2969
|
+
return result;
|
|
2970
|
+
};
|
|
2971
|
+
inst._zod.parse = wrapped;
|
|
2972
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2977
|
+
function memoizer() {
|
|
2978
|
+
return memo;
|
|
2979
|
+
}
|
|
2980
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2981
|
+
function isBackEdge(ctx, value) {
|
|
2982
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
2983
|
+
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
2984
|
+
}
|
|
2985
|
+
//#endregion
|
|
2986
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/locales/en.js
|
|
2987
|
+
const error = () => {
|
|
2988
|
+
const Sizable = {
|
|
2989
|
+
string: {
|
|
2990
|
+
unit: "characters",
|
|
2991
|
+
verb: "to have"
|
|
2992
|
+
},
|
|
2993
|
+
file: {
|
|
2994
|
+
unit: "bytes",
|
|
2995
|
+
verb: "to have"
|
|
2996
|
+
},
|
|
2997
|
+
array: {
|
|
2998
|
+
unit: "items",
|
|
2999
|
+
verb: "to have"
|
|
3000
|
+
},
|
|
3001
|
+
set: {
|
|
3002
|
+
unit: "items",
|
|
3003
|
+
verb: "to have"
|
|
3004
|
+
},
|
|
3005
|
+
map: {
|
|
3006
|
+
unit: "entries",
|
|
3007
|
+
verb: "to have"
|
|
3008
|
+
}
|
|
3009
|
+
};
|
|
3010
|
+
function getSizing(origin) {
|
|
3011
|
+
return Sizable[origin] ?? null;
|
|
3012
|
+
}
|
|
3013
|
+
const FormatDictionary = {
|
|
3014
|
+
regex: "input",
|
|
3015
|
+
email: "email address",
|
|
3016
|
+
url: "URL",
|
|
3017
|
+
emoji: "emoji",
|
|
3018
|
+
uuid: "UUID",
|
|
3019
|
+
uuidv4: "UUIDv4",
|
|
3020
|
+
uuidv6: "UUIDv6",
|
|
3021
|
+
nanoid: "nanoid",
|
|
3022
|
+
guid: "GUID",
|
|
3023
|
+
cuid: "cuid",
|
|
3024
|
+
cuid2: "cuid2",
|
|
3025
|
+
ulid: "ULID",
|
|
3026
|
+
xid: "XID",
|
|
3027
|
+
ksuid: "KSUID",
|
|
3028
|
+
datetime: "ISO datetime",
|
|
3029
|
+
date: "ISO date",
|
|
3030
|
+
time: "ISO time",
|
|
3031
|
+
duration: "ISO duration",
|
|
3032
|
+
ipv4: "IPv4 address",
|
|
3033
|
+
ipv6: "IPv6 address",
|
|
3034
|
+
mac: "MAC address",
|
|
3035
|
+
cidrv4: "IPv4 range",
|
|
3036
|
+
cidrv6: "IPv6 range",
|
|
3037
|
+
base64: "base64-encoded string",
|
|
3038
|
+
base64url: "base64url-encoded string",
|
|
3039
|
+
json_string: "JSON string",
|
|
3040
|
+
e164: "E.164 number",
|
|
3041
|
+
currency_code: "currency code",
|
|
3042
|
+
credit_card: "credit card number",
|
|
3043
|
+
iban: "IBAN",
|
|
3044
|
+
jwt: "JWT",
|
|
3045
|
+
template_literal: "input"
|
|
3046
|
+
};
|
|
3047
|
+
const TypeDictionary = { nan: "NaN" };
|
|
3048
|
+
function getTypeName(type, input) {
|
|
3049
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
3050
|
+
return TypeDictionary[type] ?? type;
|
|
3051
|
+
}
|
|
3052
|
+
return (issue) => {
|
|
3053
|
+
switch (issue.code) {
|
|
3054
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
3055
|
+
case "invalid_value":
|
|
3056
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
3057
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
3058
|
+
case "too_big": {
|
|
3059
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
3060
|
+
const sizing = getSizing(issue.origin);
|
|
3061
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
3062
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
3063
|
+
}
|
|
3064
|
+
case "too_small": {
|
|
3065
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
3066
|
+
const sizing = getSizing(issue.origin);
|
|
3067
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
3068
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
3069
|
+
}
|
|
3070
|
+
case "invalid_format": {
|
|
3071
|
+
const _issue = issue;
|
|
3072
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
3073
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
3074
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
3075
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
3076
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
3077
|
+
}
|
|
3078
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
3079
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
3080
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
3081
|
+
case "invalid_union":
|
|
3082
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
3083
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
3084
|
+
return "Invalid input";
|
|
3085
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
3086
|
+
default: return `Invalid input`;
|
|
3087
|
+
}
|
|
3088
|
+
};
|
|
3089
|
+
};
|
|
3090
|
+
function en_default() {
|
|
3091
|
+
return { localeError: error() };
|
|
3092
|
+
}
|
|
3093
|
+
//#endregion
|
|
3094
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/registries.js
|
|
2244
3095
|
var _a;
|
|
2245
3096
|
var $ZodRegistry = class {
|
|
2246
3097
|
constructor() {
|
|
@@ -2287,13 +3138,17 @@ function registry() {
|
|
|
2287
3138
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2288
3139
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2289
3140
|
//#endregion
|
|
2290
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
3141
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/api.js
|
|
3142
|
+
function snapshotChecks(def) {
|
|
3143
|
+
if (def.checks) def.checks = [...def.checks];
|
|
3144
|
+
return def;
|
|
3145
|
+
}
|
|
2291
3146
|
// @__NO_SIDE_EFFECTS__
|
|
2292
3147
|
function _string(Class, params) {
|
|
2293
|
-
return new Class({
|
|
3148
|
+
return new Class(snapshotChecks({
|
|
2294
3149
|
type: "string",
|
|
2295
3150
|
...normalizeParams(params)
|
|
2296
|
-
});
|
|
3151
|
+
}));
|
|
2297
3152
|
}
|
|
2298
3153
|
// @__NO_SIDE_EFFECTS__
|
|
2299
3154
|
function _email(Class, params) {
|
|
@@ -2703,7 +3558,7 @@ function _superRefine(fn, params) {
|
|
|
2703
3558
|
const _issue = issue$2;
|
|
2704
3559
|
if (_issue.fatal) _issue.continue = false;
|
|
2705
3560
|
_issue.code ?? (_issue.code = "custom");
|
|
2706
|
-
|
|
3561
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
2707
3562
|
_issue.inst ?? (_issue.inst = ch);
|
|
2708
3563
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2709
3564
|
payload.issues.push(issue(_issue));
|
|
@@ -2723,7 +3578,11 @@ function _check(fn, params) {
|
|
|
2723
3578
|
return ch;
|
|
2724
3579
|
}
|
|
2725
3580
|
//#endregion
|
|
2726
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
3581
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/to-json-schema.js
|
|
3582
|
+
function assignProps(target, ...sources) {
|
|
3583
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3584
|
+
return target;
|
|
3585
|
+
}
|
|
2727
3586
|
function initializeContext(params) {
|
|
2728
3587
|
let target = params?.target ?? "draft-2020-12";
|
|
2729
3588
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -2737,12 +3596,32 @@ function initializeContext(params) {
|
|
|
2737
3596
|
io: params?.io ?? "output",
|
|
2738
3597
|
counter: 0,
|
|
2739
3598
|
seen: /* @__PURE__ */ new Map(),
|
|
3599
|
+
sharedDefsExtractedFor: void 0,
|
|
3600
|
+
sharedEmitDoneFor: void 0,
|
|
2740
3601
|
cycles: params?.cycles ?? "ref",
|
|
2741
3602
|
reused: params?.reused ?? "inline",
|
|
3603
|
+
intersections: [],
|
|
3604
|
+
deferred: [],
|
|
2742
3605
|
external: params?.external ?? void 0
|
|
2743
3606
|
};
|
|
2744
3607
|
}
|
|
2745
|
-
|
|
3608
|
+
/**
|
|
3609
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3610
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3611
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3612
|
+
*/
|
|
3613
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3614
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3615
|
+
zodSchema: schema,
|
|
3616
|
+
path: params.path,
|
|
3617
|
+
message
|
|
3618
|
+
}) : ctx.unrepresentable;
|
|
3619
|
+
if (result === "any") return false;
|
|
3620
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3621
|
+
Object.assign(json, result);
|
|
3622
|
+
return true;
|
|
3623
|
+
}
|
|
3624
|
+
function processSchema(schema, ctx, _params = {
|
|
2746
3625
|
path: [],
|
|
2747
3626
|
schemaPath: []
|
|
2748
3627
|
}) {
|
|
@@ -2761,6 +3640,8 @@ function process$1(schema, ctx, _params = {
|
|
|
2761
3640
|
path: _params.path
|
|
2762
3641
|
};
|
|
2763
3642
|
ctx.seen.set(schema, result);
|
|
3643
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
3644
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
2764
3645
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2765
3646
|
if (overrideSchema) result.schema = overrideSchema;
|
|
2766
3647
|
else {
|
|
@@ -2779,12 +3660,12 @@ function process$1(schema, ctx, _params = {
|
|
|
2779
3660
|
const parent = schema._zod.parent;
|
|
2780
3661
|
if (parent) {
|
|
2781
3662
|
if (!result.ref) result.ref = parent;
|
|
2782
|
-
|
|
3663
|
+
processSchema(parent, ctx, params);
|
|
2783
3664
|
ctx.seen.get(parent).isParent = true;
|
|
2784
3665
|
}
|
|
2785
3666
|
}
|
|
2786
3667
|
const meta = ctx.metadataRegistry.get(schema);
|
|
2787
|
-
if (meta)
|
|
3668
|
+
if (meta) assignProps(result.schema, meta);
|
|
2788
3669
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2789
3670
|
delete result.schema.examples;
|
|
2790
3671
|
delete result.schema.default;
|
|
@@ -2793,9 +3674,13 @@ function process$1(schema, ctx, _params = {
|
|
|
2793
3674
|
delete result.schema._prefault;
|
|
2794
3675
|
return ctx.seen.get(schema).schema;
|
|
2795
3676
|
}
|
|
3677
|
+
function encodeJSONPointerSegment(segment) {
|
|
3678
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3679
|
+
}
|
|
2796
3680
|
function extractDefs(ctx, schema) {
|
|
2797
3681
|
const root = ctx.seen.get(schema);
|
|
2798
3682
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3683
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
2799
3684
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
2800
3685
|
for (const entry of ctx.seen.entries()) {
|
|
2801
3686
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -2815,15 +3700,16 @@ function extractDefs(ctx, schema) {
|
|
|
2815
3700
|
entry[1].defId = id;
|
|
2816
3701
|
return {
|
|
2817
3702
|
defId: id,
|
|
2818
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3703
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
2819
3704
|
};
|
|
2820
3705
|
}
|
|
2821
|
-
|
|
2822
|
-
const defUriPrefix =
|
|
3706
|
+
const uriPrefix = `#`;
|
|
3707
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
3708
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2823
3709
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2824
3710
|
return {
|
|
2825
3711
|
defId,
|
|
2826
|
-
ref: defUriPrefix + defId
|
|
3712
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
2827
3713
|
};
|
|
2828
3714
|
};
|
|
2829
3715
|
const extractToDef = (entry) => {
|
|
@@ -2864,12 +3750,114 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2864
3750
|
continue;
|
|
2865
3751
|
}
|
|
2866
3752
|
if (seen.count > 1) {
|
|
2867
|
-
if (ctx.reused === "ref")
|
|
2868
|
-
|
|
2869
|
-
|
|
3753
|
+
if (ctx.reused === "ref") extractToDef(entry);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3757
|
+
}
|
|
3758
|
+
/** 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. */
|
|
3759
|
+
function compactTypeUnion(schema) {
|
|
3760
|
+
const options = schema.anyOf;
|
|
3761
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3762
|
+
const types = [];
|
|
3763
|
+
for (const option of options) {
|
|
3764
|
+
if (!option || typeof option !== "object") return;
|
|
3765
|
+
compactTypeUnion(option);
|
|
3766
|
+
const keys = Object.keys(option);
|
|
3767
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3768
|
+
const type = option.type;
|
|
3769
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3770
|
+
if (typeof member !== "string") return;
|
|
3771
|
+
if (!types.includes(member)) types.push(member);
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
delete schema.anyOf;
|
|
3775
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
3776
|
+
}
|
|
3777
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3778
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3779
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3780
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3781
|
+
"type",
|
|
3782
|
+
"properties",
|
|
3783
|
+
"required",
|
|
3784
|
+
"additionalProperties"
|
|
3785
|
+
]);
|
|
3786
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3787
|
+
/** 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. */
|
|
3788
|
+
function undeclaredConstraint(member) {
|
|
3789
|
+
const extra = member.additionalProperties;
|
|
3790
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3791
|
+
return Object.keys(extra).length ? extra : null;
|
|
3792
|
+
}
|
|
3793
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3794
|
+
function foldObjects(members) {
|
|
3795
|
+
const objects = [];
|
|
3796
|
+
for (const member of members) {
|
|
3797
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3798
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3799
|
+
objects.push(member);
|
|
3800
|
+
}
|
|
3801
|
+
const properties = {};
|
|
3802
|
+
const required = /* @__PURE__ */ new Set();
|
|
3803
|
+
for (const object of objects) {
|
|
3804
|
+
for (const key in object.properties) {
|
|
3805
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3806
|
+
const parts = [];
|
|
3807
|
+
for (const other of objects) {
|
|
3808
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3809
|
+
if (part === null || part === void 0) continue;
|
|
3810
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
2870
3811
|
}
|
|
3812
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
2871
3813
|
}
|
|
3814
|
+
for (const key of object.required ?? []) required.add(key);
|
|
3815
|
+
}
|
|
3816
|
+
const folded = {
|
|
3817
|
+
type: "object",
|
|
3818
|
+
properties
|
|
3819
|
+
};
|
|
3820
|
+
if (required.size) folded.required = [...required];
|
|
3821
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3822
|
+
else {
|
|
3823
|
+
const constraints = [];
|
|
3824
|
+
for (const object of objects) {
|
|
3825
|
+
const constraint = undeclaredConstraint(object);
|
|
3826
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3827
|
+
}
|
|
3828
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3829
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3830
|
+
}
|
|
3831
|
+
return folded;
|
|
3832
|
+
}
|
|
3833
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3834
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3835
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3836
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3837
|
+
* into one object is the encoding that says so on every target.
|
|
3838
|
+
*
|
|
3839
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3840
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3841
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3842
|
+
function foldIntersection(json) {
|
|
3843
|
+
const allOf = json.allOf;
|
|
3844
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3845
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3846
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3847
|
+
let folded = null;
|
|
3848
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
3849
|
+
else {
|
|
3850
|
+
const union = unions[0];
|
|
3851
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3852
|
+
if (Object.keys(union).length !== 1) return;
|
|
3853
|
+
const rest = allOf.filter((m) => m !== union);
|
|
3854
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3855
|
+
if (branches.some((b) => !b)) return;
|
|
3856
|
+
folded = { [keyword]: branches };
|
|
2872
3857
|
}
|
|
3858
|
+
if (!folded) return;
|
|
3859
|
+
delete json.allOf;
|
|
3860
|
+
assignProps(json, folded);
|
|
2873
3861
|
}
|
|
2874
3862
|
function finalize(ctx, schema) {
|
|
2875
3863
|
const root = ctx.seen.get(schema);
|
|
@@ -2888,8 +3876,8 @@ function finalize(ctx, schema) {
|
|
|
2888
3876
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2889
3877
|
schema.allOf = schema.allOf ?? [];
|
|
2890
3878
|
schema.allOf.push(refSchema);
|
|
2891
|
-
} else
|
|
2892
|
-
|
|
3879
|
+
} else assignProps(schema, refSchema);
|
|
3880
|
+
assignProps(schema, _cached);
|
|
2893
3881
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
2894
3882
|
if (key === "$ref" || key === "allOf") continue;
|
|
2895
3883
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -2917,7 +3905,22 @@ function finalize(ctx, schema) {
|
|
|
2917
3905
|
path: seen.path ?? []
|
|
2918
3906
|
});
|
|
2919
3907
|
};
|
|
2920
|
-
|
|
3908
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
3909
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3910
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3911
|
+
for (const rewrite of ctx.deferred) rewrite();
|
|
3912
|
+
if (ctx.intersections.length) {
|
|
3913
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
3914
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3915
|
+
const allOf = json?.allOf;
|
|
3916
|
+
if (!Array.isArray(allOf)) continue;
|
|
3917
|
+
const existing = carriers.get(allOf);
|
|
3918
|
+
if (existing) existing.push(json);
|
|
3919
|
+
else carriers.set(allOf, [json]);
|
|
3920
|
+
}
|
|
3921
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
2921
3924
|
const result = {};
|
|
2922
3925
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
2923
3926
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -2928,17 +3931,18 @@ function finalize(ctx, schema) {
|
|
|
2928
3931
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
2929
3932
|
result.$id = ctx.external.uri(id);
|
|
2930
3933
|
}
|
|
2931
|
-
|
|
3934
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
2932
3935
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
2933
3936
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
2934
3937
|
const defs = ctx.external?.defs ?? {};
|
|
2935
|
-
for (const entry of ctx.seen.entries()) {
|
|
3938
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
2936
3939
|
const seen = entry[1];
|
|
2937
3940
|
if (seen.def && seen.defId) {
|
|
2938
3941
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
2939
|
-
defs
|
|
3942
|
+
assignProp(defs, seen.defId, seen.def);
|
|
2940
3943
|
}
|
|
2941
3944
|
}
|
|
3945
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
2942
3946
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
2943
3947
|
else result.definitions = defs;
|
|
2944
3948
|
try {
|
|
@@ -2968,7 +3972,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
2968
3972
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
2969
3973
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
2970
3974
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
2971
|
-
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);
|
|
3975
|
+
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);
|
|
2972
3976
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
2973
3977
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
2974
3978
|
if (def.type === "pipe") {
|
|
@@ -2999,7 +4003,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
2999
4003
|
...params,
|
|
3000
4004
|
processors
|
|
3001
4005
|
});
|
|
3002
|
-
|
|
4006
|
+
processSchema(schema, ctx);
|
|
3003
4007
|
extractDefs(ctx, schema);
|
|
3004
4008
|
return finalize(ctx, schema);
|
|
3005
4009
|
};
|
|
@@ -3011,12 +4015,84 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3011
4015
|
io,
|
|
3012
4016
|
processors
|
|
3013
4017
|
});
|
|
3014
|
-
|
|
4018
|
+
processSchema(schema, ctx);
|
|
3015
4019
|
extractDefs(ctx, schema);
|
|
3016
4020
|
return finalize(ctx, schema);
|
|
3017
4021
|
};
|
|
3018
4022
|
//#endregion
|
|
3019
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
4023
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/json-schema-processors.js
|
|
4024
|
+
const narrowMin = (agg, key, value) => {
|
|
4025
|
+
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4026
|
+
};
|
|
4027
|
+
const narrowMax = (agg, key, value) => {
|
|
4028
|
+
if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
|
|
4029
|
+
};
|
|
4030
|
+
const narrowBoth = (agg, value) => {
|
|
4031
|
+
narrowMin(agg, "minimum", value);
|
|
4032
|
+
narrowMax(agg, "maximum", value);
|
|
4033
|
+
};
|
|
4034
|
+
const addDivisor = (agg, value) => {
|
|
4035
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4036
|
+
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
|
|
4037
|
+
};
|
|
4038
|
+
const addPattern = (agg, pattern) => {
|
|
4039
|
+
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4040
|
+
agg.patterns.add(pattern);
|
|
4041
|
+
};
|
|
4042
|
+
const intersectMime = (agg, mime) => {
|
|
4043
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4044
|
+
};
|
|
4045
|
+
const setFormat = (agg, format) => {
|
|
4046
|
+
agg.format = format;
|
|
4047
|
+
if (format.includes("int")) agg.isInt = true;
|
|
4048
|
+
};
|
|
4049
|
+
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4050
|
+
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4051
|
+
const formatContributor = (ranges) => (agg, def) => {
|
|
4052
|
+
setFormat(agg, def.format);
|
|
4053
|
+
const [minimum, maximum] = ranges[def.format];
|
|
4054
|
+
narrowMin(agg, "minimum", minimum);
|
|
4055
|
+
narrowMax(agg, "maximum", maximum);
|
|
4056
|
+
};
|
|
4057
|
+
const contributors = {
|
|
4058
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4059
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4060
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4061
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4062
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4063
|
+
min_length: minContributor,
|
|
4064
|
+
max_length: maxContributor,
|
|
4065
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4066
|
+
min_size: minContributor,
|
|
4067
|
+
max_size: maxContributor,
|
|
4068
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4069
|
+
string_format: (agg, def) => {
|
|
4070
|
+
setFormat(agg, def.format);
|
|
4071
|
+
if (def.pattern) addPattern(agg, def.pattern);
|
|
4072
|
+
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
|
|
4073
|
+
if (def.local || def.precision === -1) agg.laxFormat = true;
|
|
4074
|
+
},
|
|
4075
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4076
|
+
};
|
|
4077
|
+
function aggregateChecks(schema) {
|
|
4078
|
+
const agg = {};
|
|
4079
|
+
const def = schema._zod.def;
|
|
4080
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4081
|
+
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4082
|
+
const bag = schema._zod.bag;
|
|
4083
|
+
if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
|
|
4084
|
+
if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4085
|
+
if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
|
|
4086
|
+
if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4087
|
+
if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
|
|
4088
|
+
if (bag.format !== void 0) {
|
|
4089
|
+
agg.format ?? (agg.format = bag.format);
|
|
4090
|
+
if (bag.format.includes("int")) agg.isInt = true;
|
|
4091
|
+
}
|
|
4092
|
+
if (bag.mime) intersectMime(agg, bag.mime);
|
|
4093
|
+
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
|
|
4094
|
+
return agg;
|
|
4095
|
+
}
|
|
3020
4096
|
const formatMap = {
|
|
3021
4097
|
guid: "uuid",
|
|
3022
4098
|
url: "uri",
|
|
@@ -3024,22 +4100,24 @@ const formatMap = {
|
|
|
3024
4100
|
json_string: "json-string",
|
|
3025
4101
|
regex: ""
|
|
3026
4102
|
};
|
|
4103
|
+
const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
|
|
4104
|
+
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
3027
4105
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3028
4106
|
const json = _json;
|
|
3029
4107
|
json.type = "string";
|
|
3030
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema
|
|
4108
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
3031
4109
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
3032
4110
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3033
4111
|
if (format) {
|
|
3034
4112
|
json.format = formatMap[format] ?? format;
|
|
3035
4113
|
if (json.format === "") delete json.format;
|
|
3036
|
-
if (format === "time") delete json.format;
|
|
4114
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
3037
4115
|
}
|
|
3038
4116
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3039
4117
|
if (patterns && patterns.size > 0) {
|
|
3040
|
-
const
|
|
3041
|
-
if (
|
|
3042
|
-
else if (
|
|
4118
|
+
const patternList = [...patterns].map(exactPattern);
|
|
4119
|
+
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
4120
|
+
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
3043
4121
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3044
4122
|
pattern: regex.source
|
|
3045
4123
|
}))];
|
|
@@ -3051,53 +4129,63 @@ const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
|
3051
4129
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3052
4130
|
const def = schema._zod.def;
|
|
3053
4131
|
const values = getEnumValues(def.entries);
|
|
4132
|
+
if (values.length === 0) {
|
|
4133
|
+
json.not = {};
|
|
4134
|
+
return;
|
|
4135
|
+
}
|
|
3054
4136
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3055
4137
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3056
4138
|
json.enum = values;
|
|
3057
4139
|
};
|
|
3058
|
-
const customProcessor = (
|
|
3059
|
-
|
|
4140
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
4141
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3060
4142
|
};
|
|
3061
|
-
const transformProcessor = (
|
|
3062
|
-
|
|
4143
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
4144
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3063
4145
|
};
|
|
3064
4146
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3065
4147
|
const json = _json;
|
|
3066
4148
|
const def = schema._zod.def;
|
|
3067
|
-
const { minimum, maximum } = schema
|
|
4149
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
3068
4150
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
3069
4151
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3070
4152
|
json.type = "array";
|
|
3071
|
-
json.items =
|
|
4153
|
+
json.items = processSchema(def.element, ctx, {
|
|
3072
4154
|
...params,
|
|
3073
4155
|
path: [...params.path, "items"]
|
|
3074
4156
|
});
|
|
3075
4157
|
};
|
|
4158
|
+
function inputOptin(schema) {
|
|
4159
|
+
const def = schema._zod.def;
|
|
4160
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
4161
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
4162
|
+
return schema._zod.optin;
|
|
4163
|
+
}
|
|
3076
4164
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3077
4165
|
const json = _json;
|
|
3078
4166
|
const def = schema._zod.def;
|
|
4167
|
+
const shape = def.shape;
|
|
4168
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3079
4169
|
json.type = "object";
|
|
3080
4170
|
json.properties = {};
|
|
3081
|
-
const shape
|
|
3082
|
-
for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
|
|
4171
|
+
for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
3083
4172
|
...params,
|
|
3084
4173
|
path: [
|
|
3085
4174
|
...params.path,
|
|
3086
4175
|
"properties",
|
|
3087
4176
|
key
|
|
3088
4177
|
]
|
|
3089
|
-
});
|
|
3090
|
-
const allKeys = new Set(Object.keys(shape));
|
|
3091
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3092
|
-
const v = def.shape[key]._zod;
|
|
3093
|
-
if (ctx.io === "input") return v.optin === void 0;
|
|
3094
|
-
else return v.optout === void 0;
|
|
3095
4178
|
}));
|
|
3096
|
-
|
|
4179
|
+
const requiredKeys = [];
|
|
4180
|
+
for (const key of Object.keys(shape)) {
|
|
4181
|
+
const field = def.shape[key];
|
|
4182
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
|
|
4183
|
+
}
|
|
4184
|
+
if (requiredKeys.length > 0) json.required = requiredKeys;
|
|
3097
4185
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3098
4186
|
else if (!def.catchall) {
|
|
3099
4187
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
3100
|
-
} else if (def.catchall) json.additionalProperties =
|
|
4188
|
+
} else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
3101
4189
|
...params,
|
|
3102
4190
|
path: [...params.path, "additionalProperties"]
|
|
3103
4191
|
});
|
|
@@ -3105,7 +4193,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3105
4193
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
3106
4194
|
const def = schema._zod.def;
|
|
3107
4195
|
const isExclusive = def.inclusive === false;
|
|
3108
|
-
const options = def.options.map((x, i) =>
|
|
4196
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
3109
4197
|
...params,
|
|
3110
4198
|
path: [
|
|
3111
4199
|
...params.path,
|
|
@@ -3118,7 +4206,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
3118
4206
|
};
|
|
3119
4207
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
3120
4208
|
const def = schema._zod.def;
|
|
3121
|
-
const a =
|
|
4209
|
+
const a = processSchema(def.left, ctx, {
|
|
3122
4210
|
...params,
|
|
3123
4211
|
path: [
|
|
3124
4212
|
...params.path,
|
|
@@ -3126,7 +4214,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3126
4214
|
0
|
|
3127
4215
|
]
|
|
3128
4216
|
});
|
|
3129
|
-
const b =
|
|
4217
|
+
const b = processSchema(def.right, ctx, {
|
|
3130
4218
|
...params,
|
|
3131
4219
|
path: [
|
|
3132
4220
|
...params.path,
|
|
@@ -3135,11 +4223,13 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3135
4223
|
]
|
|
3136
4224
|
});
|
|
3137
4225
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3138
|
-
|
|
4226
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4227
|
+
json.allOf = allOf;
|
|
4228
|
+
ctx.intersections.push(allOf);
|
|
3139
4229
|
};
|
|
3140
4230
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3141
4231
|
const def = schema._zod.def;
|
|
3142
|
-
const inner =
|
|
4232
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
3143
4233
|
const seen = ctx.seen.get(schema);
|
|
3144
4234
|
if (ctx.target === "openapi-3.0") {
|
|
3145
4235
|
seen.ref = def.innerType;
|
|
@@ -3148,34 +4238,53 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
3148
4238
|
};
|
|
3149
4239
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3150
4240
|
const def = schema._zod.def;
|
|
3151
|
-
|
|
4241
|
+
processSchema(def.innerType, ctx, params);
|
|
3152
4242
|
const seen = ctx.seen.get(schema);
|
|
3153
4243
|
seen.ref = def.innerType;
|
|
3154
4244
|
};
|
|
4245
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
4246
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
4247
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
4248
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4249
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4250
|
+
let unrepresentable = false;
|
|
4251
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
4252
|
+
if (typeof val !== "bigint") return val;
|
|
4253
|
+
unrepresentable = true;
|
|
4254
|
+
return null;
|
|
4255
|
+
});
|
|
4256
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
4257
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4258
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
4259
|
+
}
|
|
3155
4260
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3156
4261
|
const def = schema._zod.def;
|
|
3157
|
-
|
|
4262
|
+
processSchema(def.innerType, ctx, params);
|
|
3158
4263
|
const seen = ctx.seen.get(schema);
|
|
3159
4264
|
seen.ref = def.innerType;
|
|
3160
|
-
|
|
4265
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4266
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3161
4267
|
};
|
|
3162
4268
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3163
4269
|
const def = schema._zod.def;
|
|
3164
|
-
|
|
4270
|
+
processSchema(def.innerType, ctx, params);
|
|
3165
4271
|
const seen = ctx.seen.get(schema);
|
|
3166
4272
|
seen.ref = def.innerType;
|
|
3167
|
-
if (ctx.io
|
|
4273
|
+
if (ctx.io !== "input") return;
|
|
4274
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4275
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3168
4276
|
};
|
|
3169
4277
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
3170
4278
|
const def = schema._zod.def;
|
|
3171
|
-
|
|
4279
|
+
processSchema(def.innerType, ctx, params);
|
|
3172
4280
|
const seen = ctx.seen.get(schema);
|
|
3173
4281
|
seen.ref = def.innerType;
|
|
3174
4282
|
let catchValue;
|
|
3175
4283
|
try {
|
|
3176
4284
|
catchValue = def.catchValue(void 0);
|
|
3177
4285
|
} catch {
|
|
3178
|
-
|
|
4286
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
4287
|
+
return;
|
|
3179
4288
|
}
|
|
3180
4289
|
json.default = catchValue;
|
|
3181
4290
|
};
|
|
@@ -3183,77 +4292,75 @@ const pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
3183
4292
|
const def = schema._zod.def;
|
|
3184
4293
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3185
4294
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3186
|
-
|
|
4295
|
+
processSchema(innerType, ctx, params);
|
|
3187
4296
|
const seen = ctx.seen.get(schema);
|
|
3188
4297
|
seen.ref = innerType;
|
|
3189
4298
|
};
|
|
3190
4299
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
3191
4300
|
const def = schema._zod.def;
|
|
3192
|
-
|
|
4301
|
+
processSchema(def.innerType, ctx, params);
|
|
3193
4302
|
const seen = ctx.seen.get(schema);
|
|
3194
4303
|
seen.ref = def.innerType;
|
|
3195
4304
|
json.readOnly = true;
|
|
3196
4305
|
};
|
|
3197
4306
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
3198
4307
|
const def = schema._zod.def;
|
|
3199
|
-
|
|
4308
|
+
processSchema(def.innerType, ctx, params);
|
|
3200
4309
|
const seen = ctx.seen.get(schema);
|
|
3201
4310
|
seen.ref = def.innerType;
|
|
3202
4311
|
};
|
|
3203
4312
|
//#endregion
|
|
3204
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
3205
|
-
const
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
}
|
|
3226
|
-
|
|
3227
|
-
$ZodISODuration.init(inst, def);
|
|
3228
|
-
ZodStringFormat.init(inst, def);
|
|
3229
|
-
});
|
|
3230
|
-
function duration(params) {
|
|
3231
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4313
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/classic/errors.js
|
|
4314
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4315
|
+
function _lazyMethod(proto, key, make) {
|
|
4316
|
+
Object.defineProperty(proto, key, {
|
|
4317
|
+
configurable: true,
|
|
4318
|
+
enumerable: false,
|
|
4319
|
+
get() {
|
|
4320
|
+
const value = make(this);
|
|
4321
|
+
Object.defineProperty(this, key, {
|
|
4322
|
+
value,
|
|
4323
|
+
configurable: true,
|
|
4324
|
+
writable: true
|
|
4325
|
+
});
|
|
4326
|
+
return value;
|
|
4327
|
+
},
|
|
4328
|
+
set(value) {
|
|
4329
|
+
Object.defineProperty(this, key, {
|
|
4330
|
+
value,
|
|
4331
|
+
configurable: true,
|
|
4332
|
+
writable: true
|
|
4333
|
+
});
|
|
4334
|
+
}
|
|
4335
|
+
});
|
|
3232
4336
|
}
|
|
3233
|
-
//#endregion
|
|
3234
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.4.3/09b4e1f4024540142723f154808f0d43eb14b44b685c1085d435a20f90e89165/node_modules/zod/v4/classic/errors.js
|
|
3235
4337
|
const initializer = (inst, issues) => {
|
|
3236
4338
|
$ZodError.init(inst, issues);
|
|
3237
4339
|
inst.name = "ZodError";
|
|
3238
|
-
Object.
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
4340
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4341
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
4342
|
+
_installedErrorProtos.add(proto);
|
|
4343
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4344
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4345
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
4346
|
+
self.issues.push(issue);
|
|
4347
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4348
|
+
});
|
|
4349
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
4350
|
+
self.issues.push(...issues);
|
|
4351
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4352
|
+
});
|
|
4353
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4354
|
+
configurable: true,
|
|
4355
|
+
enumerable: false,
|
|
4356
|
+
get() {
|
|
4357
|
+
return this.issues.length === 0;
|
|
4358
|
+
}
|
|
3252
4359
|
});
|
|
3253
4360
|
};
|
|
3254
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
4361
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
3255
4362
|
//#endregion
|
|
3256
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
4363
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/classic/parse.js
|
|
3257
4364
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3258
4365
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3259
4366
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -3267,255 +4374,320 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
3267
4374
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3268
4375
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3269
4376
|
//#endregion
|
|
3270
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
if (!
|
|
3276
|
-
installed = /* @__PURE__ */ new Set();
|
|
3277
|
-
_installedGroups.set(proto, installed);
|
|
3278
|
-
}
|
|
3279
|
-
if (installed.has(group)) return;
|
|
3280
|
-
installed.add(group);
|
|
3281
|
-
for (const key in methods) {
|
|
3282
|
-
const fn = methods[key];
|
|
3283
|
-
Object.defineProperty(proto, key, {
|
|
3284
|
-
configurable: true,
|
|
3285
|
-
enumerable: false,
|
|
3286
|
-
get() {
|
|
3287
|
-
const bound = fn.bind(this);
|
|
3288
|
-
Object.defineProperty(this, key, {
|
|
3289
|
-
configurable: true,
|
|
3290
|
-
writable: true,
|
|
3291
|
-
enumerable: true,
|
|
3292
|
-
value: bound
|
|
3293
|
-
});
|
|
3294
|
-
return bound;
|
|
3295
|
-
},
|
|
3296
|
-
set(v) {
|
|
3297
|
-
Object.defineProperty(this, key, {
|
|
3298
|
-
configurable: true,
|
|
3299
|
-
writable: true,
|
|
3300
|
-
enumerable: true,
|
|
3301
|
-
value: v
|
|
3302
|
-
});
|
|
3303
|
-
}
|
|
3304
|
-
});
|
|
3305
|
-
}
|
|
4377
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/classic/schemas.js
|
|
4378
|
+
function _ensureDefaultLocale() {
|
|
4379
|
+
if (!globalConfig.localeError) config(en_default());
|
|
4380
|
+
}
|
|
4381
|
+
function _ensureDefaultMemoizer() {
|
|
4382
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
3306
4383
|
}
|
|
3307
4384
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4385
|
+
_ensureDefaultLocale();
|
|
3308
4386
|
$ZodType.init(inst, def);
|
|
3309
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3310
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3311
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3312
|
-
} });
|
|
3313
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3314
4387
|
inst.def = def;
|
|
3315
4388
|
inst.type = def.type;
|
|
3316
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3317
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3318
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3319
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3320
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3321
|
-
inst.spa = inst.safeParseAsync;
|
|
3322
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3323
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3324
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3325
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3326
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3327
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3328
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3329
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3330
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3331
|
-
check(...chks) {
|
|
3332
|
-
const def = this.def;
|
|
3333
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3334
|
-
check: ch,
|
|
3335
|
-
def: { check: "custom" },
|
|
3336
|
-
onattach: []
|
|
3337
|
-
} } : ch)] }), { parent: true });
|
|
3338
|
-
},
|
|
3339
|
-
with(...chks) {
|
|
3340
|
-
return this.check(...chks);
|
|
3341
|
-
},
|
|
3342
|
-
clone(def, params) {
|
|
3343
|
-
return clone(this, def, params);
|
|
3344
|
-
},
|
|
3345
|
-
brand() {
|
|
3346
|
-
return this;
|
|
3347
|
-
},
|
|
3348
|
-
register(reg, meta) {
|
|
3349
|
-
reg.add(this, meta);
|
|
3350
|
-
return this;
|
|
3351
|
-
},
|
|
3352
|
-
refine(check, params) {
|
|
3353
|
-
return this.check(refine(check, params));
|
|
3354
|
-
},
|
|
3355
|
-
superRefine(refinement, params) {
|
|
3356
|
-
return this.check(superRefine(refinement, params));
|
|
3357
|
-
},
|
|
3358
|
-
overwrite(fn) {
|
|
3359
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3360
|
-
},
|
|
3361
|
-
optional() {
|
|
3362
|
-
return optional(this);
|
|
3363
|
-
},
|
|
3364
|
-
exactOptional() {
|
|
3365
|
-
return exactOptional(this);
|
|
3366
|
-
},
|
|
3367
|
-
nullable() {
|
|
3368
|
-
return nullable(this);
|
|
3369
|
-
},
|
|
3370
|
-
nullish() {
|
|
3371
|
-
return optional(nullable(this));
|
|
3372
|
-
},
|
|
3373
|
-
nonoptional(params) {
|
|
3374
|
-
return nonoptional(this, params);
|
|
3375
|
-
},
|
|
3376
|
-
array() {
|
|
3377
|
-
return array(this);
|
|
3378
|
-
},
|
|
3379
|
-
or(arg) {
|
|
3380
|
-
return union([this, arg]);
|
|
3381
|
-
},
|
|
3382
|
-
and(arg) {
|
|
3383
|
-
return intersection(this, arg);
|
|
3384
|
-
},
|
|
3385
|
-
transform(tx) {
|
|
3386
|
-
return pipe(this, transform(tx));
|
|
3387
|
-
},
|
|
3388
|
-
default(d) {
|
|
3389
|
-
return _default(this, d);
|
|
3390
|
-
},
|
|
3391
|
-
prefault(d) {
|
|
3392
|
-
return prefault(this, d);
|
|
3393
|
-
},
|
|
3394
|
-
catch(params) {
|
|
3395
|
-
return _catch(this, params);
|
|
3396
|
-
},
|
|
3397
|
-
pipe(target) {
|
|
3398
|
-
return pipe(this, target);
|
|
3399
|
-
},
|
|
3400
|
-
readonly() {
|
|
3401
|
-
return readonly(this);
|
|
3402
|
-
},
|
|
3403
|
-
describe(description) {
|
|
3404
|
-
const cl = this.clone();
|
|
3405
|
-
globalRegistry.add(cl, { description });
|
|
3406
|
-
return cl;
|
|
3407
|
-
},
|
|
3408
|
-
meta(...args) {
|
|
3409
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
3410
|
-
const cl = this.clone();
|
|
3411
|
-
globalRegistry.add(cl, args[0]);
|
|
3412
|
-
return cl;
|
|
3413
|
-
},
|
|
3414
|
-
isOptional() {
|
|
3415
|
-
return this.safeParse(void 0).success;
|
|
3416
|
-
},
|
|
3417
|
-
isNullable() {
|
|
3418
|
-
return this.safeParse(null).success;
|
|
3419
|
-
},
|
|
3420
|
-
apply(fn) {
|
|
3421
|
-
return fn(this);
|
|
3422
|
-
}
|
|
3423
|
-
});
|
|
3424
|
-
Object.defineProperty(inst, "description", {
|
|
3425
|
-
get() {
|
|
3426
|
-
return globalRegistry.get(inst)?.description;
|
|
3427
|
-
},
|
|
3428
|
-
configurable: true
|
|
3429
|
-
});
|
|
3430
4389
|
return inst;
|
|
4390
|
+
}, {
|
|
4391
|
+
check(...chks) {
|
|
4392
|
+
const def = this.def;
|
|
4393
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4394
|
+
check: ch,
|
|
4395
|
+
def: { check: "custom" },
|
|
4396
|
+
onattach: []
|
|
4397
|
+
} } : ch)] }), { parent: true });
|
|
4398
|
+
},
|
|
4399
|
+
with(...chks) {
|
|
4400
|
+
return this.check(...chks);
|
|
4401
|
+
},
|
|
4402
|
+
clone(def, params) {
|
|
4403
|
+
return clone(this, def, params);
|
|
4404
|
+
},
|
|
4405
|
+
brand() {
|
|
4406
|
+
return this;
|
|
4407
|
+
},
|
|
4408
|
+
register(reg, meta) {
|
|
4409
|
+
reg.add(this, meta);
|
|
4410
|
+
return this;
|
|
4411
|
+
},
|
|
4412
|
+
refine(check, params) {
|
|
4413
|
+
return this.check(refine(check, params));
|
|
4414
|
+
},
|
|
4415
|
+
superRefine(refinement, params) {
|
|
4416
|
+
return this.check(superRefine(refinement, params));
|
|
4417
|
+
},
|
|
4418
|
+
overwrite(fn) {
|
|
4419
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4420
|
+
},
|
|
4421
|
+
optional() {
|
|
4422
|
+
return optional(this);
|
|
4423
|
+
},
|
|
4424
|
+
exactOptional() {
|
|
4425
|
+
return exactOptional(this);
|
|
4426
|
+
},
|
|
4427
|
+
nullable() {
|
|
4428
|
+
return nullable(this);
|
|
4429
|
+
},
|
|
4430
|
+
nullish() {
|
|
4431
|
+
return optional(nullable(this));
|
|
4432
|
+
},
|
|
4433
|
+
nonoptional(params) {
|
|
4434
|
+
return nonoptional(this, params);
|
|
4435
|
+
},
|
|
4436
|
+
array() {
|
|
4437
|
+
return array(this);
|
|
4438
|
+
},
|
|
4439
|
+
or(arg) {
|
|
4440
|
+
return union([this, arg]);
|
|
4441
|
+
},
|
|
4442
|
+
and(arg) {
|
|
4443
|
+
return intersection(this, arg);
|
|
4444
|
+
},
|
|
4445
|
+
transform(tx) {
|
|
4446
|
+
return pipe(this, transform(tx));
|
|
4447
|
+
},
|
|
4448
|
+
default(d) {
|
|
4449
|
+
return _default(this, d);
|
|
4450
|
+
},
|
|
4451
|
+
prefault(d) {
|
|
4452
|
+
return prefault(this, d);
|
|
4453
|
+
},
|
|
4454
|
+
catch(params) {
|
|
4455
|
+
return _catch(this, params);
|
|
4456
|
+
},
|
|
4457
|
+
pipe(target) {
|
|
4458
|
+
return pipe(this, target);
|
|
4459
|
+
},
|
|
4460
|
+
readonly() {
|
|
4461
|
+
return readonly(this);
|
|
4462
|
+
},
|
|
4463
|
+
describe(description) {
|
|
4464
|
+
const cl = this.clone();
|
|
4465
|
+
globalRegistry.add(cl, { description });
|
|
4466
|
+
return cl;
|
|
4467
|
+
},
|
|
4468
|
+
meta(...args) {
|
|
4469
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
4470
|
+
const cl = this.clone();
|
|
4471
|
+
globalRegistry.add(cl, args[0]);
|
|
4472
|
+
return cl;
|
|
4473
|
+
},
|
|
4474
|
+
isOptional() {
|
|
4475
|
+
return this.safeParse(void 0).success;
|
|
4476
|
+
},
|
|
4477
|
+
isNullable() {
|
|
4478
|
+
return this.safeParse(null).success;
|
|
4479
|
+
},
|
|
4480
|
+
apply(fn, ...args) {
|
|
4481
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4482
|
+
},
|
|
4483
|
+
get "~standard"() {
|
|
4484
|
+
return hide(this, "~standard", {
|
|
4485
|
+
...standardProps(this),
|
|
4486
|
+
jsonSchema: {
|
|
4487
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4488
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
4489
|
+
}
|
|
4490
|
+
});
|
|
4491
|
+
},
|
|
4492
|
+
set "~standard"(value) {
|
|
4493
|
+
own(this, "~standard", value);
|
|
4494
|
+
},
|
|
4495
|
+
parse: function _parse(data, params) {
|
|
4496
|
+
return parse(this, data, params, { callee: _parse });
|
|
4497
|
+
},
|
|
4498
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
4499
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4500
|
+
},
|
|
4501
|
+
safeParse(data, params) {
|
|
4502
|
+
return safeParse(this, data, params);
|
|
4503
|
+
},
|
|
4504
|
+
async safeParseAsync(data, params) {
|
|
4505
|
+
return safeParseAsync(this, data, params);
|
|
4506
|
+
},
|
|
4507
|
+
get spa() {
|
|
4508
|
+
return this?.safeParseAsync;
|
|
4509
|
+
},
|
|
4510
|
+
set spa(value) {
|
|
4511
|
+
own(this, "spa", value);
|
|
4512
|
+
},
|
|
4513
|
+
validate(data, params) {
|
|
4514
|
+
return validate(this, data, params);
|
|
4515
|
+
},
|
|
4516
|
+
validateAsync(data, params) {
|
|
4517
|
+
return validateAsync$1(this, data, params);
|
|
4518
|
+
},
|
|
4519
|
+
encode: function _encode(data, params) {
|
|
4520
|
+
return encode(this, data, params, { callee: _encode });
|
|
4521
|
+
},
|
|
4522
|
+
decode: function _decode(data, params) {
|
|
4523
|
+
return decode(this, data, params, { callee: _decode });
|
|
4524
|
+
},
|
|
4525
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
4526
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4527
|
+
},
|
|
4528
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
4529
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4530
|
+
},
|
|
4531
|
+
safeEncode(data, params) {
|
|
4532
|
+
return safeEncode(this, data, params);
|
|
4533
|
+
},
|
|
4534
|
+
safeDecode(data, params) {
|
|
4535
|
+
return safeDecode(this, data, params);
|
|
4536
|
+
},
|
|
4537
|
+
async safeEncodeAsync(data, params) {
|
|
4538
|
+
return safeEncodeAsync(this, data, params);
|
|
4539
|
+
},
|
|
4540
|
+
async safeDecodeAsync(data, params) {
|
|
4541
|
+
return safeDecodeAsync(this, data, params);
|
|
4542
|
+
},
|
|
4543
|
+
toJSONSchema(params) {
|
|
4544
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
4545
|
+
},
|
|
4546
|
+
get description() {
|
|
4547
|
+
return globalRegistry.get(this)?.description;
|
|
4548
|
+
},
|
|
4549
|
+
get _def() {
|
|
4550
|
+
return this._zod.def;
|
|
4551
|
+
}
|
|
3431
4552
|
});
|
|
3432
4553
|
/** @internal */
|
|
3433
4554
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
3434
4555
|
$ZodString.init(inst, def);
|
|
3435
4556
|
ZodType.init(inst, def);
|
|
3436
4557
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
});
|
|
4558
|
+
}, /*@__PURE__*/ derived({
|
|
4559
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
4560
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
4561
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
4562
|
+
}, {
|
|
4563
|
+
regex(...args) {
|
|
4564
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4565
|
+
},
|
|
4566
|
+
includes(...args) {
|
|
4567
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4568
|
+
},
|
|
4569
|
+
startsWith(...args) {
|
|
4570
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4571
|
+
},
|
|
4572
|
+
endsWith(...args) {
|
|
4573
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4574
|
+
},
|
|
4575
|
+
min(...args) {
|
|
4576
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4577
|
+
},
|
|
4578
|
+
max(...args) {
|
|
4579
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4580
|
+
},
|
|
4581
|
+
length(...args) {
|
|
4582
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
4583
|
+
},
|
|
4584
|
+
nonempty(...args) {
|
|
4585
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4586
|
+
},
|
|
4587
|
+
lowercase(params) {
|
|
4588
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4589
|
+
},
|
|
4590
|
+
uppercase(params) {
|
|
4591
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4592
|
+
},
|
|
4593
|
+
trim() {
|
|
4594
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
4595
|
+
},
|
|
4596
|
+
normalize(...args) {
|
|
4597
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4598
|
+
},
|
|
4599
|
+
toLowerCase() {
|
|
4600
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4601
|
+
},
|
|
4602
|
+
toUpperCase() {
|
|
4603
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4604
|
+
},
|
|
4605
|
+
slugify() {
|
|
4606
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
4607
|
+
}
|
|
4608
|
+
}));
|
|
3489
4609
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3490
4610
|
$ZodString.init(inst, def);
|
|
3491
4611
|
_ZodString.init(inst, def);
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
4612
|
+
}, {
|
|
4613
|
+
email(params) {
|
|
4614
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4615
|
+
},
|
|
4616
|
+
url(params) {
|
|
4617
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4618
|
+
},
|
|
4619
|
+
jwt(params) {
|
|
4620
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4621
|
+
},
|
|
4622
|
+
emoji(params) {
|
|
4623
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4624
|
+
},
|
|
4625
|
+
guid(params) {
|
|
4626
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4627
|
+
},
|
|
4628
|
+
uuid(params) {
|
|
4629
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4630
|
+
},
|
|
4631
|
+
uuidv4(params) {
|
|
4632
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4633
|
+
},
|
|
4634
|
+
uuidv6(params) {
|
|
4635
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4636
|
+
},
|
|
4637
|
+
uuidv7(params) {
|
|
4638
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4639
|
+
},
|
|
4640
|
+
nanoid(params) {
|
|
4641
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4642
|
+
},
|
|
4643
|
+
cuid(params) {
|
|
4644
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4645
|
+
},
|
|
4646
|
+
cuid2(params) {
|
|
4647
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4648
|
+
},
|
|
4649
|
+
ulid(params) {
|
|
4650
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4651
|
+
},
|
|
4652
|
+
base64(params) {
|
|
4653
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4654
|
+
},
|
|
4655
|
+
base64url(params) {
|
|
4656
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4657
|
+
},
|
|
4658
|
+
xid(params) {
|
|
4659
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4660
|
+
},
|
|
4661
|
+
ksuid(params) {
|
|
4662
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4663
|
+
},
|
|
4664
|
+
ipv4(params) {
|
|
4665
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4666
|
+
},
|
|
4667
|
+
ipv6(params) {
|
|
4668
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4669
|
+
},
|
|
4670
|
+
cidrv4(params) {
|
|
4671
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4672
|
+
},
|
|
4673
|
+
cidrv6(params) {
|
|
4674
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4675
|
+
},
|
|
4676
|
+
e164(params) {
|
|
4677
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4678
|
+
},
|
|
4679
|
+
datetime(params) {
|
|
4680
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4681
|
+
},
|
|
4682
|
+
date(params) {
|
|
4683
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4684
|
+
},
|
|
4685
|
+
time(params) {
|
|
4686
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4687
|
+
},
|
|
4688
|
+
duration(params) {
|
|
4689
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4690
|
+
}
|
|
3519
4691
|
});
|
|
3520
4692
|
function string(params) {
|
|
3521
4693
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -3524,6 +4696,22 @@ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def
|
|
|
3524
4696
|
$ZodStringFormat.init(inst, def);
|
|
3525
4697
|
_ZodString.init(inst, def);
|
|
3526
4698
|
});
|
|
4699
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4700
|
+
$ZodISODateTime.init(inst, def);
|
|
4701
|
+
ZodStringFormat.init(inst, def);
|
|
4702
|
+
});
|
|
4703
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4704
|
+
$ZodISODate.init(inst, def);
|
|
4705
|
+
ZodStringFormat.init(inst, def);
|
|
4706
|
+
});
|
|
4707
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4708
|
+
$ZodISOTime.init(inst, def);
|
|
4709
|
+
ZodStringFormat.init(inst, def);
|
|
4710
|
+
});
|
|
4711
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4712
|
+
$ZodISODuration.init(inst, def);
|
|
4713
|
+
ZodStringFormat.init(inst, def);
|
|
4714
|
+
});
|
|
3527
4715
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3528
4716
|
$ZodEmail.init(inst, def);
|
|
3529
4717
|
ZodStringFormat.init(inst, def);
|
|
@@ -3622,94 +4810,80 @@ function never(params) {
|
|
|
3622
4810
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3623
4811
|
}
|
|
3624
4812
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
4813
|
+
_ensureDefaultMemoizer();
|
|
3625
4814
|
$ZodArray.init(inst, def);
|
|
3626
4815
|
ZodType.init(inst, def);
|
|
3627
4816
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3628
4817
|
inst.element = def.element;
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
});
|
|
4818
|
+
}, {
|
|
4819
|
+
min(n, params) {
|
|
4820
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
4821
|
+
},
|
|
4822
|
+
nonempty(params) {
|
|
4823
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
4824
|
+
},
|
|
4825
|
+
max(n, params) {
|
|
4826
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
4827
|
+
},
|
|
4828
|
+
length(n, params) {
|
|
4829
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
4830
|
+
},
|
|
4831
|
+
unwrap() {
|
|
4832
|
+
return this.element;
|
|
4833
|
+
}
|
|
3646
4834
|
});
|
|
3647
4835
|
function array(element, params) {
|
|
3648
4836
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3649
4837
|
}
|
|
3650
4838
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
4839
|
+
_ensureDefaultMemoizer();
|
|
3651
4840
|
$ZodObjectJIT.init(inst, def);
|
|
3652
4841
|
ZodType.init(inst, def);
|
|
3653
4842
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
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
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
return merge(this, other);
|
|
3699
|
-
},
|
|
3700
|
-
pick(mask) {
|
|
3701
|
-
return pick(this, mask);
|
|
3702
|
-
},
|
|
3703
|
-
omit(mask) {
|
|
3704
|
-
return omit(this, mask);
|
|
3705
|
-
},
|
|
3706
|
-
partial(...args) {
|
|
3707
|
-
return partial(ZodOptional, this, args[0]);
|
|
3708
|
-
},
|
|
3709
|
-
required(...args) {
|
|
3710
|
-
return required(ZodNonOptional, this, args[0]);
|
|
3711
|
-
}
|
|
3712
|
-
});
|
|
4843
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
4844
|
+
}, {
|
|
4845
|
+
keyof() {
|
|
4846
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
4847
|
+
},
|
|
4848
|
+
catchall(catchall) {
|
|
4849
|
+
return this.clone(mergeDefs(this._zod.def, { catchall }));
|
|
4850
|
+
},
|
|
4851
|
+
passthrough() {
|
|
4852
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
4853
|
+
},
|
|
4854
|
+
loose() {
|
|
4855
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
4856
|
+
},
|
|
4857
|
+
strict() {
|
|
4858
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
4859
|
+
},
|
|
4860
|
+
strip() {
|
|
4861
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
|
|
4862
|
+
},
|
|
4863
|
+
extend(incoming) {
|
|
4864
|
+
return extend(this, incoming);
|
|
4865
|
+
},
|
|
4866
|
+
safeExtend(incoming) {
|
|
4867
|
+
return safeExtend(this, incoming);
|
|
4868
|
+
},
|
|
4869
|
+
merge(other) {
|
|
4870
|
+
return merge(this, other);
|
|
4871
|
+
},
|
|
4872
|
+
pick(mask) {
|
|
4873
|
+
return pick(this, mask);
|
|
4874
|
+
},
|
|
4875
|
+
omit(mask) {
|
|
4876
|
+
return omit(this, mask);
|
|
4877
|
+
},
|
|
4878
|
+
partial(...args) {
|
|
4879
|
+
return partial(ZodOptional, this, args[0]);
|
|
4880
|
+
},
|
|
4881
|
+
exactPartial(...args) {
|
|
4882
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
4883
|
+
},
|
|
4884
|
+
required(...args) {
|
|
4885
|
+
return required(ZodNonOptional, this, args[0]);
|
|
4886
|
+
}
|
|
3713
4887
|
});
|
|
3714
4888
|
function object(shape, params) {
|
|
3715
4889
|
const def = {
|
|
@@ -3749,7 +4923,7 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
|
3749
4923
|
ZodType.init(inst, def);
|
|
3750
4924
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
3751
4925
|
inst.enum = def.entries;
|
|
3752
|
-
inst.options =
|
|
4926
|
+
inst.options = [...inst._zod.values];
|
|
3753
4927
|
const keys = new Set(Object.keys(def.entries));
|
|
3754
4928
|
inst.extract = (values, params) => {
|
|
3755
4929
|
const newEntries = {};
|
|
@@ -3783,6 +4957,7 @@ function _enum(values, params) {
|
|
|
3783
4957
|
});
|
|
3784
4958
|
}
|
|
3785
4959
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
4960
|
+
_ensureDefaultMemoizer();
|
|
3786
4961
|
$ZodTransform.init(inst, def);
|
|
3787
4962
|
ZodType.init(inst, def);
|
|
3788
4963
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -3794,7 +4969,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3794
4969
|
const _issue = issue$1;
|
|
3795
4970
|
if (_issue.fatal) _issue.continue = false;
|
|
3796
4971
|
_issue.code ?? (_issue.code = "custom");
|
|
3797
|
-
|
|
4972
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
3798
4973
|
_issue.inst ?? (_issue.inst = inst);
|
|
3799
4974
|
payload.issues.push(issue(_issue));
|
|
3800
4975
|
}
|
|
@@ -3802,11 +4977,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3802
4977
|
const output = def.transform(payload.value, payload);
|
|
3803
4978
|
if (output instanceof Promise) return output.then((output) => {
|
|
3804
4979
|
payload.value = output;
|
|
3805
|
-
payload.fallback = true;
|
|
3806
4980
|
return payload;
|
|
3807
4981
|
});
|
|
3808
4982
|
payload.value = output;
|
|
3809
|
-
payload.fallback = true;
|
|
3810
4983
|
return payload;
|
|
3811
4984
|
};
|
|
3812
4985
|
});
|
|
@@ -3907,7 +5080,7 @@ function _catch(innerType, catchValue) {
|
|
|
3907
5080
|
return new ZodCatch({
|
|
3908
5081
|
type: "catch",
|
|
3909
5082
|
innerType,
|
|
3910
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
5083
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
3911
5084
|
});
|
|
3912
5085
|
}
|
|
3913
5086
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|