@pyreon/mcp 0.12.1 → 0.12.3
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/lib/analysis/index.js.html +1 -1
- package/lib/index.js +1497 -957
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ZodOptional, z } from "zod";
|
|
|
5
5
|
import process$1 from "node:process";
|
|
6
6
|
import { detectReactPatterns, diagnoseError, generateContext, migrateReactCode } from "@pyreon/compiler";
|
|
7
7
|
|
|
8
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
8
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/helpers/util.js
|
|
9
9
|
var util;
|
|
10
10
|
(function(util) {
|
|
11
11
|
util.assertEqual = (_) => {};
|
|
@@ -102,7 +102,7 @@ const getParsedType = (data) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
//#endregion
|
|
105
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
105
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/ZodError.js
|
|
106
106
|
const ZodIssueCode = util.arrayToEnum([
|
|
107
107
|
"invalid_type",
|
|
108
108
|
"invalid_literal",
|
|
@@ -181,7 +181,7 @@ var ZodError$1 = class ZodError$1 extends Error {
|
|
|
181
181
|
return this.issues.length === 0;
|
|
182
182
|
}
|
|
183
183
|
flatten(mapper = (issue) => issue.message) {
|
|
184
|
-
const fieldErrors =
|
|
184
|
+
const fieldErrors = Object.create(null);
|
|
185
185
|
const formErrors = [];
|
|
186
186
|
for (const sub of this.issues) if (sub.path.length > 0) {
|
|
187
187
|
const firstEl = sub.path[0];
|
|
@@ -202,7 +202,7 @@ ZodError$1.create = (issues) => {
|
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
//#endregion
|
|
205
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
205
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/locales/en.js
|
|
206
206
|
const errorMap = (issue, _ctx) => {
|
|
207
207
|
let message;
|
|
208
208
|
switch (issue.code) {
|
|
@@ -280,14 +280,14 @@ const errorMap = (issue, _ctx) => {
|
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
//#endregion
|
|
283
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
283
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/errors.js
|
|
284
284
|
let overrideErrorMap = errorMap;
|
|
285
285
|
function getErrorMap() {
|
|
286
286
|
return overrideErrorMap;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
//#endregion
|
|
290
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
290
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
|
|
291
291
|
const makeIssue = (params) => {
|
|
292
292
|
const { data, path, errorMaps, issueData } = params;
|
|
293
293
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -392,7 +392,7 @@ const isValid = (x) => x.status === "valid";
|
|
|
392
392
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
393
393
|
|
|
394
394
|
//#endregion
|
|
395
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
395
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.js
|
|
396
396
|
var errorUtil;
|
|
397
397
|
(function(errorUtil) {
|
|
398
398
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -400,7 +400,7 @@ var errorUtil;
|
|
|
400
400
|
})(errorUtil || (errorUtil = {}));
|
|
401
401
|
|
|
402
402
|
//#endregion
|
|
403
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
403
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/types.js
|
|
404
404
|
var ParseInputLazyPath = class {
|
|
405
405
|
constructor(parent, value, path, key) {
|
|
406
406
|
this._cachedPath = [];
|
|
@@ -3551,22 +3551,28 @@ const preprocessType = ZodEffects.createWithPreprocess;
|
|
|
3551
3551
|
const pipelineType = ZodPipeline.create;
|
|
3552
3552
|
|
|
3553
3553
|
//#endregion
|
|
3554
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
3554
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
3555
3555
|
/** A special constant with type `never` */
|
|
3556
3556
|
const NEVER = Object.freeze({ status: "aborted" });
|
|
3557
3557
|
function $constructor(name, initializer, params) {
|
|
3558
3558
|
function init(inst, def) {
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3559
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
3560
|
+
value: {
|
|
3561
|
+
def,
|
|
3562
|
+
constr: _,
|
|
3563
|
+
traits: /* @__PURE__ */ new Set()
|
|
3564
|
+
},
|
|
3562
3565
|
enumerable: false
|
|
3563
3566
|
});
|
|
3564
|
-
(
|
|
3567
|
+
if (inst._zod.traits.has(name)) return;
|
|
3565
3568
|
inst._zod.traits.add(name);
|
|
3566
3569
|
initializer(inst, def);
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
+
const proto = _.prototype;
|
|
3571
|
+
const keys = Object.keys(proto);
|
|
3572
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3573
|
+
const k = keys[i];
|
|
3574
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
3575
|
+
}
|
|
3570
3576
|
}
|
|
3571
3577
|
const Parent = params?.Parent ?? Object;
|
|
3572
3578
|
class Definition extends Parent {}
|
|
@@ -3592,6 +3598,12 @@ var $ZodAsyncError = class extends Error {
|
|
|
3592
3598
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
3593
3599
|
}
|
|
3594
3600
|
};
|
|
3601
|
+
var $ZodEncodeError = class extends Error {
|
|
3602
|
+
constructor(name) {
|
|
3603
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
3604
|
+
this.name = "ZodEncodeError";
|
|
3605
|
+
}
|
|
3606
|
+
};
|
|
3595
3607
|
const globalConfig = {};
|
|
3596
3608
|
function config(newConfig) {
|
|
3597
3609
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
@@ -3599,7 +3611,7 @@ function config(newConfig) {
|
|
|
3599
3611
|
}
|
|
3600
3612
|
|
|
3601
3613
|
//#endregion
|
|
3602
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
3614
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
3603
3615
|
function getEnumValues(entries) {
|
|
3604
3616
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
3605
3617
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -3628,19 +3640,26 @@ function cleanRegex(source) {
|
|
|
3628
3640
|
}
|
|
3629
3641
|
function floatSafeRemainder(val, step) {
|
|
3630
3642
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
3631
|
-
const
|
|
3643
|
+
const stepString = step.toString();
|
|
3644
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
3645
|
+
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
3646
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
3647
|
+
if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
|
|
3648
|
+
}
|
|
3632
3649
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
3633
3650
|
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
3634
3651
|
}
|
|
3652
|
+
const EVALUATING = Symbol("evaluating");
|
|
3635
3653
|
function defineLazy(object, key, getter) {
|
|
3654
|
+
let value = void 0;
|
|
3636
3655
|
Object.defineProperty(object, key, {
|
|
3637
3656
|
get() {
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3657
|
+
if (value === EVALUATING) return;
|
|
3658
|
+
if (value === void 0) {
|
|
3659
|
+
value = EVALUATING;
|
|
3660
|
+
value = getter();
|
|
3642
3661
|
}
|
|
3643
|
-
|
|
3662
|
+
return value;
|
|
3644
3663
|
},
|
|
3645
3664
|
set(v) {
|
|
3646
3665
|
Object.defineProperty(object, key, { value: v });
|
|
@@ -3656,10 +3675,18 @@ function assignProp(target, prop, value) {
|
|
|
3656
3675
|
configurable: true
|
|
3657
3676
|
});
|
|
3658
3677
|
}
|
|
3678
|
+
function mergeDefs(...defs) {
|
|
3679
|
+
const mergedDescriptors = {};
|
|
3680
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
3681
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
3682
|
+
}
|
|
3659
3683
|
function esc(str) {
|
|
3660
3684
|
return JSON.stringify(str);
|
|
3661
3685
|
}
|
|
3662
|
-
|
|
3686
|
+
function slugify(input) {
|
|
3687
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3688
|
+
}
|
|
3689
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
3663
3690
|
function isObject(data) {
|
|
3664
3691
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
3665
3692
|
}
|
|
@@ -3676,11 +3703,17 @@ function isPlainObject$1(o) {
|
|
|
3676
3703
|
if (isObject(o) === false) return false;
|
|
3677
3704
|
const ctor = o.constructor;
|
|
3678
3705
|
if (ctor === void 0) return true;
|
|
3706
|
+
if (typeof ctor !== "function") return true;
|
|
3679
3707
|
const prot = ctor.prototype;
|
|
3680
3708
|
if (isObject(prot) === false) return false;
|
|
3681
3709
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
3682
3710
|
return true;
|
|
3683
3711
|
}
|
|
3712
|
+
function shallowClone(o) {
|
|
3713
|
+
if (isPlainObject$1(o)) return { ...o };
|
|
3714
|
+
if (Array.isArray(o)) return [...o];
|
|
3715
|
+
return o;
|
|
3716
|
+
}
|
|
3684
3717
|
const propertyKeyTypes = new Set([
|
|
3685
3718
|
"string",
|
|
3686
3719
|
"number",
|
|
@@ -3722,51 +3755,70 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
3722
3755
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
3723
3756
|
};
|
|
3724
3757
|
function pick(schema, mask) {
|
|
3725
|
-
const newShape = {};
|
|
3726
3758
|
const currDef = schema._zod.def;
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3759
|
+
const checks = currDef.checks;
|
|
3760
|
+
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
3761
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
3762
|
+
get shape() {
|
|
3763
|
+
const newShape = {};
|
|
3764
|
+
for (const key in mask) {
|
|
3765
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3766
|
+
if (!mask[key]) continue;
|
|
3767
|
+
newShape[key] = currDef.shape[key];
|
|
3768
|
+
}
|
|
3769
|
+
assignProp(this, "shape", newShape);
|
|
3770
|
+
return newShape;
|
|
3771
|
+
},
|
|
3735
3772
|
checks: []
|
|
3736
|
-
});
|
|
3773
|
+
}));
|
|
3737
3774
|
}
|
|
3738
3775
|
function omit(schema, mask) {
|
|
3739
|
-
const newShape = { ...schema._zod.def.shape };
|
|
3740
3776
|
const currDef = schema._zod.def;
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3777
|
+
const checks = currDef.checks;
|
|
3778
|
+
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
3779
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
3780
|
+
get shape() {
|
|
3781
|
+
const newShape = { ...schema._zod.def.shape };
|
|
3782
|
+
for (const key in mask) {
|
|
3783
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3784
|
+
if (!mask[key]) continue;
|
|
3785
|
+
delete newShape[key];
|
|
3786
|
+
}
|
|
3787
|
+
assignProp(this, "shape", newShape);
|
|
3788
|
+
return newShape;
|
|
3789
|
+
},
|
|
3749
3790
|
checks: []
|
|
3750
|
-
});
|
|
3791
|
+
}));
|
|
3751
3792
|
}
|
|
3752
3793
|
function extend(schema, shape) {
|
|
3753
3794
|
if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
}
|
|
3764
|
-
|
|
3765
|
-
|
|
3795
|
+
const checks = schema._zod.def.checks;
|
|
3796
|
+
if (checks && checks.length > 0) {
|
|
3797
|
+
const existingShape = schema._zod.def.shape;
|
|
3798
|
+
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
3799
|
+
}
|
|
3800
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
3801
|
+
const _shape = {
|
|
3802
|
+
...schema._zod.def.shape,
|
|
3803
|
+
...shape
|
|
3804
|
+
};
|
|
3805
|
+
assignProp(this, "shape", _shape);
|
|
3806
|
+
return _shape;
|
|
3807
|
+
} }));
|
|
3808
|
+
}
|
|
3809
|
+
function safeExtend(schema, shape) {
|
|
3810
|
+
if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
3811
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
3812
|
+
const _shape = {
|
|
3813
|
+
...schema._zod.def.shape,
|
|
3814
|
+
...shape
|
|
3815
|
+
};
|
|
3816
|
+
assignProp(this, "shape", _shape);
|
|
3817
|
+
return _shape;
|
|
3818
|
+
} }));
|
|
3766
3819
|
}
|
|
3767
3820
|
function merge(a, b) {
|
|
3768
|
-
return clone(a, {
|
|
3769
|
-
...a._zod.def,
|
|
3821
|
+
return clone(a, mergeDefs(a._zod.def, {
|
|
3770
3822
|
get shape() {
|
|
3771
3823
|
const _shape = {
|
|
3772
3824
|
...a._zod.def.shape,
|
|
@@ -3775,53 +3827,59 @@ function merge(a, b) {
|
|
|
3775
3827
|
assignProp(this, "shape", _shape);
|
|
3776
3828
|
return _shape;
|
|
3777
3829
|
},
|
|
3778
|
-
catchall
|
|
3830
|
+
get catchall() {
|
|
3831
|
+
return b._zod.def.catchall;
|
|
3832
|
+
},
|
|
3779
3833
|
checks: []
|
|
3780
|
-
});
|
|
3834
|
+
}));
|
|
3781
3835
|
}
|
|
3782
3836
|
function partial(Class, schema, mask) {
|
|
3783
|
-
const
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3837
|
+
const checks = schema._zod.def.checks;
|
|
3838
|
+
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
3839
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
3840
|
+
get shape() {
|
|
3841
|
+
const oldShape = schema._zod.def.shape;
|
|
3842
|
+
const shape = { ...oldShape };
|
|
3843
|
+
if (mask) for (const key in mask) {
|
|
3844
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3845
|
+
if (!mask[key]) continue;
|
|
3846
|
+
shape[key] = Class ? new Class({
|
|
3847
|
+
type: "optional",
|
|
3848
|
+
innerType: oldShape[key]
|
|
3849
|
+
}) : oldShape[key];
|
|
3850
|
+
}
|
|
3851
|
+
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
3852
|
+
type: "optional",
|
|
3853
|
+
innerType: oldShape[key]
|
|
3854
|
+
}) : oldShape[key];
|
|
3855
|
+
assignProp(this, "shape", shape);
|
|
3856
|
+
return shape;
|
|
3857
|
+
},
|
|
3800
3858
|
checks: []
|
|
3801
|
-
});
|
|
3859
|
+
}));
|
|
3802
3860
|
}
|
|
3803
3861
|
function required(Class, schema, mask) {
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
if (
|
|
3808
|
-
|
|
3809
|
-
|
|
3862
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
3863
|
+
const oldShape = schema._zod.def.shape;
|
|
3864
|
+
const shape = { ...oldShape };
|
|
3865
|
+
if (mask) for (const key in mask) {
|
|
3866
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3867
|
+
if (!mask[key]) continue;
|
|
3868
|
+
shape[key] = new Class({
|
|
3869
|
+
type: "nonoptional",
|
|
3870
|
+
innerType: oldShape[key]
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3873
|
+
else for (const key in oldShape) shape[key] = new Class({
|
|
3810
3874
|
type: "nonoptional",
|
|
3811
3875
|
innerType: oldShape[key]
|
|
3812
3876
|
});
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
innerType: oldShape[key]
|
|
3817
|
-
});
|
|
3818
|
-
return clone(schema, {
|
|
3819
|
-
...schema._zod.def,
|
|
3820
|
-
shape,
|
|
3821
|
-
checks: []
|
|
3822
|
-
});
|
|
3877
|
+
assignProp(this, "shape", shape);
|
|
3878
|
+
return shape;
|
|
3879
|
+
} }));
|
|
3823
3880
|
}
|
|
3824
3881
|
function aborted(x, startIndex = 0) {
|
|
3882
|
+
if (x.aborted === true) return true;
|
|
3825
3883
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
3826
3884
|
return false;
|
|
3827
3885
|
}
|
|
@@ -3864,7 +3922,7 @@ function issue(...args) {
|
|
|
3864
3922
|
}
|
|
3865
3923
|
|
|
3866
3924
|
//#endregion
|
|
3867
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
3925
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
3868
3926
|
const initializer$1 = (inst, def) => {
|
|
3869
3927
|
inst.name = "$ZodError";
|
|
3870
3928
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -3875,12 +3933,7 @@ const initializer$1 = (inst, def) => {
|
|
|
3875
3933
|
value: def,
|
|
3876
3934
|
enumerable: false
|
|
3877
3935
|
});
|
|
3878
|
-
|
|
3879
|
-
get() {
|
|
3880
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
3881
|
-
},
|
|
3882
|
-
enumerable: true
|
|
3883
|
-
});
|
|
3936
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
3884
3937
|
Object.defineProperty(inst, "toString", {
|
|
3885
3938
|
value: () => inst.message,
|
|
3886
3939
|
enumerable: false
|
|
@@ -3900,10 +3953,7 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
3900
3953
|
fieldErrors
|
|
3901
3954
|
};
|
|
3902
3955
|
}
|
|
3903
|
-
function formatError(error,
|
|
3904
|
-
const mapper = _mapper || function(issue) {
|
|
3905
|
-
return issue.message;
|
|
3906
|
-
};
|
|
3956
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
3907
3957
|
const fieldErrors = { _errors: [] };
|
|
3908
3958
|
const processError = (error) => {
|
|
3909
3959
|
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
@@ -3930,7 +3980,7 @@ function formatError(error, _mapper) {
|
|
|
3930
3980
|
}
|
|
3931
3981
|
|
|
3932
3982
|
//#endregion
|
|
3933
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
3983
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
3934
3984
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
3935
3985
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
3936
3986
|
const result = schema._zod.run({
|
|
@@ -3996,9 +4046,45 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
3996
4046
|
};
|
|
3997
4047
|
};
|
|
3998
4048
|
const safeParseAsync$2 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
4049
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
4050
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
4051
|
+
return _parse(_Err)(schema, value, ctx);
|
|
4052
|
+
};
|
|
4053
|
+
const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
|
|
4054
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
4055
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
4056
|
+
};
|
|
4057
|
+
const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
|
|
4058
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4059
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
4060
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
4061
|
+
};
|
|
4062
|
+
const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
4063
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4064
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
4065
|
+
};
|
|
4066
|
+
const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
4067
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
4068
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
4069
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
4070
|
+
};
|
|
4071
|
+
const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
4072
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
4073
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
4074
|
+
};
|
|
4075
|
+
const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
4076
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4077
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
4078
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
4079
|
+
};
|
|
4080
|
+
const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
4081
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4082
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
4083
|
+
};
|
|
4084
|
+
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
3999
4085
|
|
|
4000
4086
|
//#endregion
|
|
4001
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
4087
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
4002
4088
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
4003
4089
|
const cuid2 = /^[0-9a-z]+$/;
|
|
4004
4090
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -4009,11 +4095,11 @@ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
|
4009
4095
|
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
4010
4096
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
4011
4097
|
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})$/;
|
|
4012
|
-
/** Returns a regex for validating an RFC 4122 UUID.
|
|
4098
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
4013
4099
|
*
|
|
4014
4100
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
4015
4101
|
const uuid = (version) => {
|
|
4016
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
|
4102
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
4017
4103
|
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})$`);
|
|
4018
4104
|
};
|
|
4019
4105
|
/** Practical email validation */
|
|
@@ -4023,13 +4109,12 @@ function emoji() {
|
|
|
4023
4109
|
return new RegExp(_emoji$1, "u");
|
|
4024
4110
|
}
|
|
4025
4111
|
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])$/;
|
|
4026
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
4112
|
+
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}|:))$/;
|
|
4027
4113
|
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])$/;
|
|
4028
4114
|
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
4029
4115
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
4030
4116
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
4031
|
-
const
|
|
4032
|
-
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
4117
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
4033
4118
|
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])))`;
|
|
4034
4119
|
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
4035
4120
|
function timeSource(args) {
|
|
@@ -4043,7 +4128,7 @@ function datetime$1(args) {
|
|
|
4043
4128
|
const time = timeSource({ precision: args.precision });
|
|
4044
4129
|
const opts = ["Z"];
|
|
4045
4130
|
if (args.local) opts.push("");
|
|
4046
|
-
if (args.offset) opts.push(`([+-]\\d
|
|
4131
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
4047
4132
|
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
4048
4133
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
4049
4134
|
}
|
|
@@ -4051,15 +4136,15 @@ const string$1 = (params) => {
|
|
|
4051
4136
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
4052
4137
|
return new RegExp(`^${regex}$`);
|
|
4053
4138
|
};
|
|
4054
|
-
const integer =
|
|
4055
|
-
const number$1 = /^-?\d+(?:\.\d+)
|
|
4056
|
-
const boolean$1 =
|
|
4057
|
-
const _null$2 =
|
|
4139
|
+
const integer = /^-?\d+$/;
|
|
4140
|
+
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4141
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
4142
|
+
const _null$2 = /^null$/i;
|
|
4058
4143
|
const lowercase = /^[^A-Z]*$/;
|
|
4059
4144
|
const uppercase = /^[^a-z]*$/;
|
|
4060
4145
|
|
|
4061
4146
|
//#endregion
|
|
4062
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
4147
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
4063
4148
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
4064
4149
|
var _a;
|
|
4065
4150
|
inst._zod ?? (inst._zod = {});
|
|
@@ -4085,7 +4170,7 @@ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (ins
|
|
|
4085
4170
|
payload.issues.push({
|
|
4086
4171
|
origin,
|
|
4087
4172
|
code: "too_big",
|
|
4088
|
-
maximum: def.value,
|
|
4173
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
4089
4174
|
input: payload.value,
|
|
4090
4175
|
inclusive: def.inclusive,
|
|
4091
4176
|
inst,
|
|
@@ -4107,7 +4192,7 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
|
|
|
4107
4192
|
payload.issues.push({
|
|
4108
4193
|
origin,
|
|
4109
4194
|
code: "too_small",
|
|
4110
|
-
minimum: def.value,
|
|
4195
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
4111
4196
|
input: payload.value,
|
|
4112
4197
|
inclusive: def.inclusive,
|
|
4113
4198
|
inst,
|
|
@@ -4155,6 +4240,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4155
4240
|
expected: origin,
|
|
4156
4241
|
format: def.format,
|
|
4157
4242
|
code: "invalid_type",
|
|
4243
|
+
continue: false,
|
|
4158
4244
|
input,
|
|
4159
4245
|
inst
|
|
4160
4246
|
});
|
|
@@ -4168,6 +4254,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4168
4254
|
note: "Integers must be within the safe integer range.",
|
|
4169
4255
|
inst,
|
|
4170
4256
|
origin,
|
|
4257
|
+
inclusive: true,
|
|
4171
4258
|
continue: !def.abort
|
|
4172
4259
|
});
|
|
4173
4260
|
else payload.issues.push({
|
|
@@ -4177,6 +4264,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4177
4264
|
note: "Integers must be within the safe integer range.",
|
|
4178
4265
|
inst,
|
|
4179
4266
|
origin,
|
|
4267
|
+
inclusive: true,
|
|
4180
4268
|
continue: !def.abort
|
|
4181
4269
|
});
|
|
4182
4270
|
return;
|
|
@@ -4196,7 +4284,9 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4196
4284
|
input,
|
|
4197
4285
|
code: "too_big",
|
|
4198
4286
|
maximum,
|
|
4199
|
-
|
|
4287
|
+
inclusive: true,
|
|
4288
|
+
inst,
|
|
4289
|
+
continue: !def.abort
|
|
4200
4290
|
});
|
|
4201
4291
|
};
|
|
4202
4292
|
});
|
|
@@ -4413,7 +4503,7 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
|
|
|
4413
4503
|
});
|
|
4414
4504
|
|
|
4415
4505
|
//#endregion
|
|
4416
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
4506
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
4417
4507
|
var Doc = class {
|
|
4418
4508
|
constructor(args = []) {
|
|
4419
4509
|
this.content = [];
|
|
@@ -4445,15 +4535,15 @@ var Doc = class {
|
|
|
4445
4535
|
};
|
|
4446
4536
|
|
|
4447
4537
|
//#endregion
|
|
4448
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
4538
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
4449
4539
|
const version$1 = {
|
|
4450
4540
|
major: 4,
|
|
4451
|
-
minor:
|
|
4452
|
-
patch:
|
|
4541
|
+
minor: 3,
|
|
4542
|
+
patch: 6
|
|
4453
4543
|
};
|
|
4454
4544
|
|
|
4455
4545
|
//#endregion
|
|
4456
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
4546
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
4457
4547
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
4458
4548
|
var _a;
|
|
4459
4549
|
inst ?? (inst = {});
|
|
@@ -4494,7 +4584,33 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4494
4584
|
});
|
|
4495
4585
|
return payload;
|
|
4496
4586
|
};
|
|
4587
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
4588
|
+
if (aborted(canary)) {
|
|
4589
|
+
canary.aborted = true;
|
|
4590
|
+
return canary;
|
|
4591
|
+
}
|
|
4592
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
4593
|
+
if (checkResult instanceof Promise) {
|
|
4594
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
4595
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
4596
|
+
}
|
|
4597
|
+
return inst._zod.parse(checkResult, ctx);
|
|
4598
|
+
};
|
|
4497
4599
|
inst._zod.run = (payload, ctx) => {
|
|
4600
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
4601
|
+
if (ctx.direction === "backward") {
|
|
4602
|
+
const canary = inst._zod.parse({
|
|
4603
|
+
value: payload.value,
|
|
4604
|
+
issues: []
|
|
4605
|
+
}, {
|
|
4606
|
+
...ctx,
|
|
4607
|
+
skipChecks: true
|
|
4608
|
+
});
|
|
4609
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
4610
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
4611
|
+
});
|
|
4612
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
4613
|
+
}
|
|
4498
4614
|
const result = inst._zod.parse(payload, ctx);
|
|
4499
4615
|
if (result instanceof Promise) {
|
|
4500
4616
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
@@ -4503,7 +4619,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4503
4619
|
return runChecks(result, checks, ctx);
|
|
4504
4620
|
};
|
|
4505
4621
|
}
|
|
4506
|
-
inst
|
|
4622
|
+
defineLazy(inst, "~standard", () => ({
|
|
4507
4623
|
validate: (value) => {
|
|
4508
4624
|
try {
|
|
4509
4625
|
const r = safeParse$2(inst, value);
|
|
@@ -4514,7 +4630,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4514
4630
|
},
|
|
4515
4631
|
vendor: "zod",
|
|
4516
4632
|
version: 1
|
|
4517
|
-
};
|
|
4633
|
+
}));
|
|
4518
4634
|
});
|
|
4519
4635
|
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
4520
4636
|
$ZodType.init(inst, def);
|
|
@@ -4566,16 +4682,15 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
4566
4682
|
$ZodStringFormat.init(inst, def);
|
|
4567
4683
|
inst._zod.check = (payload) => {
|
|
4568
4684
|
try {
|
|
4569
|
-
const
|
|
4570
|
-
const url = new URL(
|
|
4571
|
-
const href = url.href;
|
|
4685
|
+
const trimmed = payload.value.trim();
|
|
4686
|
+
const url = new URL(trimmed);
|
|
4572
4687
|
if (def.hostname) {
|
|
4573
4688
|
def.hostname.lastIndex = 0;
|
|
4574
4689
|
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
4575
4690
|
code: "invalid_format",
|
|
4576
4691
|
format: "url",
|
|
4577
4692
|
note: "Invalid hostname",
|
|
4578
|
-
pattern: hostname.source,
|
|
4693
|
+
pattern: def.hostname.source,
|
|
4579
4694
|
input: payload.value,
|
|
4580
4695
|
inst,
|
|
4581
4696
|
continue: !def.abort
|
|
@@ -4593,8 +4708,8 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
4593
4708
|
continue: !def.abort
|
|
4594
4709
|
});
|
|
4595
4710
|
}
|
|
4596
|
-
if (
|
|
4597
|
-
else payload.value =
|
|
4711
|
+
if (def.normalize) payload.value = url.href;
|
|
4712
|
+
else payload.value = trimmed;
|
|
4598
4713
|
return;
|
|
4599
4714
|
} catch (_) {
|
|
4600
4715
|
payload.issues.push({
|
|
@@ -4654,18 +4769,12 @@ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, d
|
|
|
4654
4769
|
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
4655
4770
|
def.pattern ?? (def.pattern = ipv4);
|
|
4656
4771
|
$ZodStringFormat.init(inst, def);
|
|
4657
|
-
inst._zod.
|
|
4658
|
-
const bag = inst._zod.bag;
|
|
4659
|
-
bag.format = `ipv4`;
|
|
4660
|
-
});
|
|
4772
|
+
inst._zod.bag.format = `ipv4`;
|
|
4661
4773
|
});
|
|
4662
4774
|
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
4663
4775
|
def.pattern ?? (def.pattern = ipv6);
|
|
4664
4776
|
$ZodStringFormat.init(inst, def);
|
|
4665
|
-
inst._zod.
|
|
4666
|
-
const bag = inst._zod.bag;
|
|
4667
|
-
bag.format = `ipv6`;
|
|
4668
|
-
});
|
|
4777
|
+
inst._zod.bag.format = `ipv6`;
|
|
4669
4778
|
inst._zod.check = (payload) => {
|
|
4670
4779
|
try {
|
|
4671
4780
|
new URL(`http://[${payload.value}]`);
|
|
@@ -4688,8 +4797,10 @@ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
4688
4797
|
def.pattern ?? (def.pattern = cidrv6);
|
|
4689
4798
|
$ZodStringFormat.init(inst, def);
|
|
4690
4799
|
inst._zod.check = (payload) => {
|
|
4691
|
-
const
|
|
4800
|
+
const parts = payload.value.split("/");
|
|
4692
4801
|
try {
|
|
4802
|
+
if (parts.length !== 2) throw new Error();
|
|
4803
|
+
const [address, prefix] = parts;
|
|
4693
4804
|
if (!prefix) throw new Error();
|
|
4694
4805
|
const prefixNum = Number(prefix);
|
|
4695
4806
|
if (`${prefixNum}` !== prefix) throw new Error();
|
|
@@ -4719,9 +4830,7 @@ function isValidBase64(data) {
|
|
|
4719
4830
|
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
4720
4831
|
def.pattern ?? (def.pattern = base64);
|
|
4721
4832
|
$ZodStringFormat.init(inst, def);
|
|
4722
|
-
inst._zod.
|
|
4723
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
4724
|
-
});
|
|
4833
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
4725
4834
|
inst._zod.check = (payload) => {
|
|
4726
4835
|
if (isValidBase64(payload.value)) return;
|
|
4727
4836
|
payload.issues.push({
|
|
@@ -4741,9 +4850,7 @@ function isValidBase64URL(data) {
|
|
|
4741
4850
|
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
4742
4851
|
def.pattern ?? (def.pattern = base64url);
|
|
4743
4852
|
$ZodStringFormat.init(inst, def);
|
|
4744
|
-
inst._zod.
|
|
4745
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
4746
|
-
});
|
|
4853
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
4747
4854
|
inst._zod.check = (payload) => {
|
|
4748
4855
|
if (isValidBase64URL(payload.value)) return;
|
|
4749
4856
|
payload.issues.push({
|
|
@@ -4807,7 +4914,7 @@ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
4807
4914
|
return payload;
|
|
4808
4915
|
};
|
|
4809
4916
|
});
|
|
4810
|
-
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
4917
|
+
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
4811
4918
|
$ZodCheckNumberFormat.init(inst, def);
|
|
4812
4919
|
$ZodNumber.init(inst, def);
|
|
4813
4920
|
});
|
|
@@ -4893,32 +5000,68 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
4893
5000
|
return payload;
|
|
4894
5001
|
};
|
|
4895
5002
|
});
|
|
4896
|
-
function
|
|
4897
|
-
if (result.issues.length)
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
if (result.
|
|
4902
|
-
else final.value[key] = result.value;
|
|
4903
|
-
else final.issues.push(...prefixIssues(key, result.issues));
|
|
4904
|
-
else if (result.value === void 0) {
|
|
5003
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
5004
|
+
if (result.issues.length) {
|
|
5005
|
+
if (isOptionalOut && !(key in input)) return;
|
|
5006
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
5007
|
+
}
|
|
5008
|
+
if (result.value === void 0) {
|
|
4905
5009
|
if (key in input) final.value[key] = void 0;
|
|
4906
5010
|
} else final.value[key] = result.value;
|
|
4907
5011
|
}
|
|
5012
|
+
function normalizeDef(def) {
|
|
5013
|
+
const keys = Object.keys(def.shape);
|
|
5014
|
+
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
5015
|
+
const okeys = optionalKeys(def.shape);
|
|
5016
|
+
return {
|
|
5017
|
+
...def,
|
|
5018
|
+
keys,
|
|
5019
|
+
keySet: new Set(keys),
|
|
5020
|
+
numKeys: keys.length,
|
|
5021
|
+
optionalKeys: new Set(okeys)
|
|
5022
|
+
};
|
|
5023
|
+
}
|
|
5024
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
5025
|
+
const unrecognized = [];
|
|
5026
|
+
const keySet = def.keySet;
|
|
5027
|
+
const _catchall = def.catchall._zod;
|
|
5028
|
+
const t = _catchall.def.type;
|
|
5029
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
5030
|
+
for (const key in input) {
|
|
5031
|
+
if (keySet.has(key)) continue;
|
|
5032
|
+
if (t === "never") {
|
|
5033
|
+
unrecognized.push(key);
|
|
5034
|
+
continue;
|
|
5035
|
+
}
|
|
5036
|
+
const r = _catchall.run({
|
|
5037
|
+
value: input[key],
|
|
5038
|
+
issues: []
|
|
5039
|
+
}, ctx);
|
|
5040
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
5041
|
+
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5042
|
+
}
|
|
5043
|
+
if (unrecognized.length) payload.issues.push({
|
|
5044
|
+
code: "unrecognized_keys",
|
|
5045
|
+
keys: unrecognized,
|
|
5046
|
+
input,
|
|
5047
|
+
inst
|
|
5048
|
+
});
|
|
5049
|
+
if (!proms.length) return payload;
|
|
5050
|
+
return Promise.all(proms).then(() => {
|
|
5051
|
+
return payload;
|
|
5052
|
+
});
|
|
5053
|
+
}
|
|
4908
5054
|
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
4909
5055
|
$ZodType.init(inst, def);
|
|
4910
|
-
|
|
4911
|
-
const
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
optionalKeys: new Set(okeys)
|
|
4920
|
-
};
|
|
4921
|
-
});
|
|
5056
|
+
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
5057
|
+
const sh = def.shape;
|
|
5058
|
+
Object.defineProperty(def, "shape", { get: () => {
|
|
5059
|
+
const newSh = { ...sh };
|
|
5060
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
5061
|
+
return newSh;
|
|
5062
|
+
} });
|
|
5063
|
+
}
|
|
5064
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
4922
5065
|
defineLazy(inst._zod, "propValues", () => {
|
|
4923
5066
|
const shape = def.shape;
|
|
4924
5067
|
const propValues = {};
|
|
@@ -4931,6 +5074,42 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
4931
5074
|
}
|
|
4932
5075
|
return propValues;
|
|
4933
5076
|
});
|
|
5077
|
+
const isObject$2 = isObject;
|
|
5078
|
+
const catchall = def.catchall;
|
|
5079
|
+
let value;
|
|
5080
|
+
inst._zod.parse = (payload, ctx) => {
|
|
5081
|
+
value ?? (value = _normalized.value);
|
|
5082
|
+
const input = payload.value;
|
|
5083
|
+
if (!isObject$2(input)) {
|
|
5084
|
+
payload.issues.push({
|
|
5085
|
+
expected: "object",
|
|
5086
|
+
code: "invalid_type",
|
|
5087
|
+
input,
|
|
5088
|
+
inst
|
|
5089
|
+
});
|
|
5090
|
+
return payload;
|
|
5091
|
+
}
|
|
5092
|
+
payload.value = {};
|
|
5093
|
+
const proms = [];
|
|
5094
|
+
const shape = value.shape;
|
|
5095
|
+
for (const key of value.keys) {
|
|
5096
|
+
const el = shape[key];
|
|
5097
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
5098
|
+
const r = el._zod.run({
|
|
5099
|
+
value: input[key],
|
|
5100
|
+
issues: []
|
|
5101
|
+
}, ctx);
|
|
5102
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
5103
|
+
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
5104
|
+
}
|
|
5105
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
5106
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
5107
|
+
};
|
|
5108
|
+
});
|
|
5109
|
+
const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
5110
|
+
$ZodObject.init(inst, def);
|
|
5111
|
+
const superParse = inst._zod.parse;
|
|
5112
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
4934
5113
|
const generateFastpass = (shape) => {
|
|
4935
5114
|
const doc = new Doc([
|
|
4936
5115
|
"shape",
|
|
@@ -4946,40 +5125,48 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
4946
5125
|
const ids = Object.create(null);
|
|
4947
5126
|
let counter = 0;
|
|
4948
5127
|
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
4949
|
-
doc.write(`const newResult = {}
|
|
4950
|
-
for (const key of normalized.keys)
|
|
5128
|
+
doc.write(`const newResult = {};`);
|
|
5129
|
+
for (const key of normalized.keys) {
|
|
4951
5130
|
const id = ids[key];
|
|
4952
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
4953
5131
|
const k = esc(key);
|
|
4954
|
-
|
|
5132
|
+
const isOptionalOut = shape[key]?._zod?.optout === "optional";
|
|
5133
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
5134
|
+
if (isOptionalOut) doc.write(`
|
|
4955
5135
|
if (${id}.issues.length) {
|
|
4956
|
-
if (
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
5136
|
+
if (${k} in input) {
|
|
5137
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5138
|
+
...iss,
|
|
5139
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
5140
|
+
})));
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5144
|
+
if (${id}.value === undefined) {
|
|
5145
|
+
if (${k} in input) {
|
|
5146
|
+
newResult[${k}] = undefined;
|
|
4967
5147
|
}
|
|
4968
|
-
} else if (${id}.value === undefined) {
|
|
4969
|
-
if (${k} in input) newResult[${k}] = undefined;
|
|
4970
5148
|
} else {
|
|
4971
5149
|
newResult[${k}] = ${id}.value;
|
|
4972
5150
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5151
|
+
|
|
5152
|
+
`);
|
|
5153
|
+
else doc.write(`
|
|
5154
|
+
if (${id}.issues.length) {
|
|
5155
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
4979
5156
|
...iss,
|
|
4980
|
-
path: iss.path ? [${
|
|
4981
|
-
})))
|
|
4982
|
-
|
|
5157
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
5158
|
+
})));
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
if (${id}.value === undefined) {
|
|
5162
|
+
if (${k} in input) {
|
|
5163
|
+
newResult[${k}] = undefined;
|
|
5164
|
+
}
|
|
5165
|
+
} else {
|
|
5166
|
+
newResult[${k}] = ${id}.value;
|
|
5167
|
+
}
|
|
5168
|
+
|
|
5169
|
+
`);
|
|
4983
5170
|
}
|
|
4984
5171
|
doc.write(`payload.value = newResult;`);
|
|
4985
5172
|
doc.write(`return payload;`);
|
|
@@ -5005,53 +5192,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5005
5192
|
});
|
|
5006
5193
|
return payload;
|
|
5007
5194
|
}
|
|
5008
|
-
const proms = [];
|
|
5009
5195
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
5010
5196
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
5011
5197
|
payload = fastpass(payload, ctx);
|
|
5012
|
-
|
|
5013
|
-
payload
|
|
5014
|
-
const shape = value.shape;
|
|
5015
|
-
for (const key of value.keys) {
|
|
5016
|
-
const el = shape[key];
|
|
5017
|
-
const r = el._zod.run({
|
|
5018
|
-
value: input[key],
|
|
5019
|
-
issues: []
|
|
5020
|
-
}, ctx);
|
|
5021
|
-
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
5022
|
-
if (r instanceof Promise) proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
|
|
5023
|
-
else if (isOptional) handleOptionalObjectResult(r, payload, key, input);
|
|
5024
|
-
else handleObjectResult(r, payload, key);
|
|
5025
|
-
}
|
|
5198
|
+
if (!catchall) return payload;
|
|
5199
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
5026
5200
|
}
|
|
5027
|
-
|
|
5028
|
-
const unrecognized = [];
|
|
5029
|
-
const keySet = value.keySet;
|
|
5030
|
-
const _catchall = catchall._zod;
|
|
5031
|
-
const t = _catchall.def.type;
|
|
5032
|
-
for (const key of Object.keys(input)) {
|
|
5033
|
-
if (keySet.has(key)) continue;
|
|
5034
|
-
if (t === "never") {
|
|
5035
|
-
unrecognized.push(key);
|
|
5036
|
-
continue;
|
|
5037
|
-
}
|
|
5038
|
-
const r = _catchall.run({
|
|
5039
|
-
value: input[key],
|
|
5040
|
-
issues: []
|
|
5041
|
-
}, ctx);
|
|
5042
|
-
if (r instanceof Promise) proms.push(r.then((r) => handleObjectResult(r, payload, key)));
|
|
5043
|
-
else handleObjectResult(r, payload, key);
|
|
5044
|
-
}
|
|
5045
|
-
if (unrecognized.length) payload.issues.push({
|
|
5046
|
-
code: "unrecognized_keys",
|
|
5047
|
-
keys: unrecognized,
|
|
5048
|
-
input,
|
|
5049
|
-
inst
|
|
5050
|
-
});
|
|
5051
|
-
if (!proms.length) return payload;
|
|
5052
|
-
return Promise.all(proms).then(() => {
|
|
5053
|
-
return payload;
|
|
5054
|
-
});
|
|
5201
|
+
return superParse(payload, ctx);
|
|
5055
5202
|
};
|
|
5056
5203
|
});
|
|
5057
5204
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -5059,6 +5206,11 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
5059
5206
|
final.value = result.value;
|
|
5060
5207
|
return final;
|
|
5061
5208
|
}
|
|
5209
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
5210
|
+
if (nonaborted.length === 1) {
|
|
5211
|
+
final.value = nonaborted[0].value;
|
|
5212
|
+
return nonaborted[0];
|
|
5213
|
+
}
|
|
5062
5214
|
final.issues.push({
|
|
5063
5215
|
code: "invalid_union",
|
|
5064
5216
|
input: final.value,
|
|
@@ -5080,7 +5232,10 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5080
5232
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
5081
5233
|
}
|
|
5082
5234
|
});
|
|
5235
|
+
const single = def.options.length === 1;
|
|
5236
|
+
const first = def.options[0]._zod.run;
|
|
5083
5237
|
inst._zod.parse = (payload, ctx) => {
|
|
5238
|
+
if (single) return first(payload, ctx);
|
|
5084
5239
|
let async = false;
|
|
5085
5240
|
const results = [];
|
|
5086
5241
|
for (const option of def.options) {
|
|
@@ -5103,6 +5258,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5103
5258
|
};
|
|
5104
5259
|
});
|
|
5105
5260
|
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
5261
|
+
def.inclusive = false;
|
|
5106
5262
|
$ZodUnion.init(inst, def);
|
|
5107
5263
|
const _super = inst._zod.parse;
|
|
5108
5264
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -5121,7 +5277,7 @@ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUn
|
|
|
5121
5277
|
const opts = def.options;
|
|
5122
5278
|
const map = /* @__PURE__ */ new Map();
|
|
5123
5279
|
for (const o of opts) {
|
|
5124
|
-
const values = o._zod.propValues[def.discriminator];
|
|
5280
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
5125
5281
|
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
5126
5282
|
for (const v of values) {
|
|
5127
5283
|
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
@@ -5148,6 +5304,7 @@ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUn
|
|
|
5148
5304
|
code: "invalid_union",
|
|
5149
5305
|
errors: [],
|
|
5150
5306
|
note: "No matching discriminator",
|
|
5307
|
+
discriminator: def.discriminator,
|
|
5151
5308
|
input,
|
|
5152
5309
|
path: [def.discriminator],
|
|
5153
5310
|
inst
|
|
@@ -5229,8 +5386,25 @@ function mergeValues(a, b) {
|
|
|
5229
5386
|
};
|
|
5230
5387
|
}
|
|
5231
5388
|
function handleIntersectionResults(result, left, right) {
|
|
5232
|
-
|
|
5233
|
-
|
|
5389
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
5390
|
+
let unrecIssue;
|
|
5391
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
5392
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
5393
|
+
for (const k of iss.keys) {
|
|
5394
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
5395
|
+
unrecKeys.get(k).l = true;
|
|
5396
|
+
}
|
|
5397
|
+
} else result.issues.push(iss);
|
|
5398
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
5399
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
5400
|
+
unrecKeys.get(k).r = true;
|
|
5401
|
+
}
|
|
5402
|
+
else result.issues.push(iss);
|
|
5403
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
5404
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
5405
|
+
...unrecIssue,
|
|
5406
|
+
keys: bothKeys
|
|
5407
|
+
});
|
|
5234
5408
|
if (aborted(result)) return result;
|
|
5235
5409
|
const merged = mergeValues(left.value, right.value);
|
|
5236
5410
|
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
@@ -5251,10 +5425,12 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5251
5425
|
return payload;
|
|
5252
5426
|
}
|
|
5253
5427
|
const proms = [];
|
|
5254
|
-
|
|
5255
|
-
|
|
5428
|
+
const values = def.keyType._zod.values;
|
|
5429
|
+
if (values) {
|
|
5256
5430
|
payload.value = {};
|
|
5431
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
5257
5432
|
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
5433
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
5258
5434
|
const result = def.valueType._zod.run({
|
|
5259
5435
|
value: input[key],
|
|
5260
5436
|
issues: []
|
|
@@ -5269,7 +5445,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5269
5445
|
}
|
|
5270
5446
|
}
|
|
5271
5447
|
let unrecognized;
|
|
5272
|
-
for (const key in input) if (!
|
|
5448
|
+
for (const key in input) if (!recordKeys.has(key)) {
|
|
5273
5449
|
unrecognized = unrecognized ?? [];
|
|
5274
5450
|
unrecognized.push(key);
|
|
5275
5451
|
}
|
|
@@ -5283,21 +5459,29 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5283
5459
|
payload.value = {};
|
|
5284
5460
|
for (const key of Reflect.ownKeys(input)) {
|
|
5285
5461
|
if (key === "__proto__") continue;
|
|
5286
|
-
|
|
5462
|
+
let keyResult = def.keyType._zod.run({
|
|
5287
5463
|
value: key,
|
|
5288
5464
|
issues: []
|
|
5289
5465
|
}, ctx);
|
|
5290
5466
|
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
5467
|
+
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
5468
|
+
const retryResult = def.keyType._zod.run({
|
|
5469
|
+
value: Number(key),
|
|
5470
|
+
issues: []
|
|
5471
|
+
}, ctx);
|
|
5472
|
+
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
5473
|
+
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
5474
|
+
}
|
|
5291
5475
|
if (keyResult.issues.length) {
|
|
5292
|
-
payload.
|
|
5293
|
-
|
|
5476
|
+
if (def.mode === "loose") payload.value[key] = input[key];
|
|
5477
|
+
else payload.issues.push({
|
|
5294
5478
|
code: "invalid_key",
|
|
5479
|
+
origin: "record",
|
|
5295
5480
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
5296
5481
|
input: key,
|
|
5297
5482
|
path: [key],
|
|
5298
5483
|
inst
|
|
5299
5484
|
});
|
|
5300
|
-
payload.value[keyResult.value] = keyResult.value;
|
|
5301
5485
|
continue;
|
|
5302
5486
|
}
|
|
5303
5487
|
const result = def.valueType._zod.run({
|
|
@@ -5321,11 +5505,12 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5321
5505
|
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
5322
5506
|
$ZodType.init(inst, def);
|
|
5323
5507
|
const values = getEnumValues(def.entries);
|
|
5324
|
-
|
|
5508
|
+
const valuesSet = new Set(values);
|
|
5509
|
+
inst._zod.values = valuesSet;
|
|
5325
5510
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
5326
5511
|
inst._zod.parse = (payload, _ctx) => {
|
|
5327
5512
|
const input = payload.value;
|
|
5328
|
-
if (
|
|
5513
|
+
if (valuesSet.has(input)) return payload;
|
|
5329
5514
|
payload.issues.push({
|
|
5330
5515
|
code: "invalid_value",
|
|
5331
5516
|
values,
|
|
@@ -5337,11 +5522,13 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
5337
5522
|
});
|
|
5338
5523
|
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
5339
5524
|
$ZodType.init(inst, def);
|
|
5340
|
-
|
|
5341
|
-
|
|
5525
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
5526
|
+
const values = new Set(def.values);
|
|
5527
|
+
inst._zod.values = values;
|
|
5528
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
5342
5529
|
inst._zod.parse = (payload, _ctx) => {
|
|
5343
5530
|
const input = payload.value;
|
|
5344
|
-
if (
|
|
5531
|
+
if (values.has(input)) return payload;
|
|
5345
5532
|
payload.issues.push({
|
|
5346
5533
|
code: "invalid_value",
|
|
5347
5534
|
values: def.values,
|
|
@@ -5353,9 +5540,10 @@ const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
5353
5540
|
});
|
|
5354
5541
|
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
5355
5542
|
$ZodType.init(inst, def);
|
|
5356
|
-
inst._zod.parse = (payload,
|
|
5543
|
+
inst._zod.parse = (payload, ctx) => {
|
|
5544
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
5357
5545
|
const _out = def.transform(payload.value, payload);
|
|
5358
|
-
if (
|
|
5546
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
5359
5547
|
payload.value = output;
|
|
5360
5548
|
return payload;
|
|
5361
5549
|
});
|
|
@@ -5364,6 +5552,13 @@ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def)
|
|
|
5364
5552
|
return payload;
|
|
5365
5553
|
};
|
|
5366
5554
|
});
|
|
5555
|
+
function handleOptionalResult(result, input) {
|
|
5556
|
+
if (result.issues.length && input === void 0) return {
|
|
5557
|
+
issues: [],
|
|
5558
|
+
value: void 0
|
|
5559
|
+
};
|
|
5560
|
+
return result;
|
|
5561
|
+
}
|
|
5367
5562
|
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
5368
5563
|
$ZodType.init(inst, def);
|
|
5369
5564
|
inst._zod.optin = "optional";
|
|
@@ -5376,11 +5571,23 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
5376
5571
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
5377
5572
|
});
|
|
5378
5573
|
inst._zod.parse = (payload, ctx) => {
|
|
5379
|
-
if (def.innerType._zod.optin === "optional")
|
|
5574
|
+
if (def.innerType._zod.optin === "optional") {
|
|
5575
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
5576
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
5577
|
+
return handleOptionalResult(result, payload.value);
|
|
5578
|
+
}
|
|
5380
5579
|
if (payload.value === void 0) return payload;
|
|
5381
5580
|
return def.innerType._zod.run(payload, ctx);
|
|
5382
5581
|
};
|
|
5383
5582
|
});
|
|
5583
|
+
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
5584
|
+
$ZodOptional.init(inst, def);
|
|
5585
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5586
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
5587
|
+
inst._zod.parse = (payload, ctx) => {
|
|
5588
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5589
|
+
};
|
|
5590
|
+
});
|
|
5384
5591
|
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
5385
5592
|
$ZodType.init(inst, def);
|
|
5386
5593
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -5402,10 +5609,11 @@ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
5402
5609
|
inst._zod.optin = "optional";
|
|
5403
5610
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5404
5611
|
inst._zod.parse = (payload, ctx) => {
|
|
5612
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5405
5613
|
if (payload.value === void 0) {
|
|
5406
5614
|
payload.value = def.defaultValue;
|
|
5407
5615
|
/**
|
|
5408
|
-
* $ZodDefault
|
|
5616
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
5409
5617
|
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
5410
5618
|
return payload;
|
|
5411
5619
|
}
|
|
@@ -5423,6 +5631,7 @@ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) =>
|
|
|
5423
5631
|
inst._zod.optin = "optional";
|
|
5424
5632
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5425
5633
|
inst._zod.parse = (payload, ctx) => {
|
|
5634
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5426
5635
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
5427
5636
|
return def.innerType._zod.run(payload, ctx);
|
|
5428
5637
|
};
|
|
@@ -5450,10 +5659,11 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
5450
5659
|
}
|
|
5451
5660
|
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
5452
5661
|
$ZodType.init(inst, def);
|
|
5453
|
-
inst._zod
|
|
5662
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
5454
5663
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
5455
5664
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5456
5665
|
inst._zod.parse = (payload, ctx) => {
|
|
5666
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5457
5667
|
const result = def.innerType._zod.run(payload, ctx);
|
|
5458
5668
|
if (result instanceof Promise) return result.then((result) => {
|
|
5459
5669
|
payload.value = result.value;
|
|
@@ -5484,15 +5694,24 @@ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
5484
5694
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
5485
5695
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
5486
5696
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
5697
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
5487
5698
|
inst._zod.parse = (payload, ctx) => {
|
|
5699
|
+
if (ctx.direction === "backward") {
|
|
5700
|
+
const right = def.out._zod.run(payload, ctx);
|
|
5701
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
5702
|
+
return handlePipeResult(right, def.in, ctx);
|
|
5703
|
+
}
|
|
5488
5704
|
const left = def.in._zod.run(payload, ctx);
|
|
5489
|
-
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def, ctx));
|
|
5490
|
-
return handlePipeResult(left, def, ctx);
|
|
5705
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
5706
|
+
return handlePipeResult(left, def.out, ctx);
|
|
5491
5707
|
};
|
|
5492
5708
|
});
|
|
5493
|
-
function handlePipeResult(left,
|
|
5494
|
-
if (
|
|
5495
|
-
|
|
5709
|
+
function handlePipeResult(left, next, ctx) {
|
|
5710
|
+
if (left.issues.length) {
|
|
5711
|
+
left.aborted = true;
|
|
5712
|
+
return left;
|
|
5713
|
+
}
|
|
5714
|
+
return next._zod.run({
|
|
5496
5715
|
value: left.value,
|
|
5497
5716
|
issues: left.issues
|
|
5498
5717
|
}, ctx);
|
|
@@ -5501,9 +5720,10 @@ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) =>
|
|
|
5501
5720
|
$ZodType.init(inst, def);
|
|
5502
5721
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
5503
5722
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5504
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
5505
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
5723
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
5724
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
5506
5725
|
inst._zod.parse = (payload, ctx) => {
|
|
5726
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5507
5727
|
const result = def.innerType._zod.run(payload, ctx);
|
|
5508
5728
|
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
5509
5729
|
return handleReadonlyResult(result);
|
|
@@ -5541,23 +5761,21 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
5541
5761
|
}
|
|
5542
5762
|
|
|
5543
5763
|
//#endregion
|
|
5544
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
5764
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
5765
|
+
var _a;
|
|
5545
5766
|
var $ZodRegistry = class {
|
|
5546
5767
|
constructor() {
|
|
5547
|
-
this._map = /* @__PURE__ */ new
|
|
5768
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
5548
5769
|
this._idmap = /* @__PURE__ */ new Map();
|
|
5549
5770
|
}
|
|
5550
5771
|
add(schema, ..._meta) {
|
|
5551
5772
|
const meta = _meta[0];
|
|
5552
5773
|
this._map.set(schema, meta);
|
|
5553
|
-
if (meta && typeof meta === "object" && "id" in meta)
|
|
5554
|
-
if (this._idmap.has(meta.id)) throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
5555
|
-
this._idmap.set(meta.id, schema);
|
|
5556
|
-
}
|
|
5774
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
5557
5775
|
return this;
|
|
5558
5776
|
}
|
|
5559
5777
|
clear() {
|
|
5560
|
-
this._map = /* @__PURE__ */ new
|
|
5778
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
5561
5779
|
this._idmap = /* @__PURE__ */ new Map();
|
|
5562
5780
|
return this;
|
|
5563
5781
|
}
|
|
@@ -5572,10 +5790,11 @@ var $ZodRegistry = class {
|
|
|
5572
5790
|
if (p) {
|
|
5573
5791
|
const pm = { ...this.get(p) ?? {} };
|
|
5574
5792
|
delete pm.id;
|
|
5575
|
-
|
|
5793
|
+
const f = {
|
|
5576
5794
|
...pm,
|
|
5577
5795
|
...this._map.get(schema)
|
|
5578
5796
|
};
|
|
5797
|
+
return Object.keys(f).length ? f : void 0;
|
|
5579
5798
|
}
|
|
5580
5799
|
return this._map.get(schema);
|
|
5581
5800
|
}
|
|
@@ -5586,16 +5805,19 @@ var $ZodRegistry = class {
|
|
|
5586
5805
|
function registry() {
|
|
5587
5806
|
return new $ZodRegistry();
|
|
5588
5807
|
}
|
|
5589
|
-
|
|
5808
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
5809
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
5590
5810
|
|
|
5591
5811
|
//#endregion
|
|
5592
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
5812
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
5813
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5593
5814
|
function _string(Class, params) {
|
|
5594
5815
|
return new Class({
|
|
5595
5816
|
type: "string",
|
|
5596
5817
|
...normalizeParams(params)
|
|
5597
5818
|
});
|
|
5598
5819
|
}
|
|
5820
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5599
5821
|
function _email(Class, params) {
|
|
5600
5822
|
return new Class({
|
|
5601
5823
|
type: "string",
|
|
@@ -5605,6 +5827,7 @@ function _email(Class, params) {
|
|
|
5605
5827
|
...normalizeParams(params)
|
|
5606
5828
|
});
|
|
5607
5829
|
}
|
|
5830
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5608
5831
|
function _guid(Class, params) {
|
|
5609
5832
|
return new Class({
|
|
5610
5833
|
type: "string",
|
|
@@ -5614,6 +5837,7 @@ function _guid(Class, params) {
|
|
|
5614
5837
|
...normalizeParams(params)
|
|
5615
5838
|
});
|
|
5616
5839
|
}
|
|
5840
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5617
5841
|
function _uuid(Class, params) {
|
|
5618
5842
|
return new Class({
|
|
5619
5843
|
type: "string",
|
|
@@ -5623,6 +5847,7 @@ function _uuid(Class, params) {
|
|
|
5623
5847
|
...normalizeParams(params)
|
|
5624
5848
|
});
|
|
5625
5849
|
}
|
|
5850
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5626
5851
|
function _uuidv4(Class, params) {
|
|
5627
5852
|
return new Class({
|
|
5628
5853
|
type: "string",
|
|
@@ -5633,6 +5858,7 @@ function _uuidv4(Class, params) {
|
|
|
5633
5858
|
...normalizeParams(params)
|
|
5634
5859
|
});
|
|
5635
5860
|
}
|
|
5861
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5636
5862
|
function _uuidv6(Class, params) {
|
|
5637
5863
|
return new Class({
|
|
5638
5864
|
type: "string",
|
|
@@ -5643,6 +5869,7 @@ function _uuidv6(Class, params) {
|
|
|
5643
5869
|
...normalizeParams(params)
|
|
5644
5870
|
});
|
|
5645
5871
|
}
|
|
5872
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5646
5873
|
function _uuidv7(Class, params) {
|
|
5647
5874
|
return new Class({
|
|
5648
5875
|
type: "string",
|
|
@@ -5653,6 +5880,7 @@ function _uuidv7(Class, params) {
|
|
|
5653
5880
|
...normalizeParams(params)
|
|
5654
5881
|
});
|
|
5655
5882
|
}
|
|
5883
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5656
5884
|
function _url(Class, params) {
|
|
5657
5885
|
return new Class({
|
|
5658
5886
|
type: "string",
|
|
@@ -5662,6 +5890,7 @@ function _url(Class, params) {
|
|
|
5662
5890
|
...normalizeParams(params)
|
|
5663
5891
|
});
|
|
5664
5892
|
}
|
|
5893
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5665
5894
|
function _emoji(Class, params) {
|
|
5666
5895
|
return new Class({
|
|
5667
5896
|
type: "string",
|
|
@@ -5671,6 +5900,7 @@ function _emoji(Class, params) {
|
|
|
5671
5900
|
...normalizeParams(params)
|
|
5672
5901
|
});
|
|
5673
5902
|
}
|
|
5903
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5674
5904
|
function _nanoid(Class, params) {
|
|
5675
5905
|
return new Class({
|
|
5676
5906
|
type: "string",
|
|
@@ -5680,6 +5910,7 @@ function _nanoid(Class, params) {
|
|
|
5680
5910
|
...normalizeParams(params)
|
|
5681
5911
|
});
|
|
5682
5912
|
}
|
|
5913
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5683
5914
|
function _cuid(Class, params) {
|
|
5684
5915
|
return new Class({
|
|
5685
5916
|
type: "string",
|
|
@@ -5689,6 +5920,7 @@ function _cuid(Class, params) {
|
|
|
5689
5920
|
...normalizeParams(params)
|
|
5690
5921
|
});
|
|
5691
5922
|
}
|
|
5923
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5692
5924
|
function _cuid2(Class, params) {
|
|
5693
5925
|
return new Class({
|
|
5694
5926
|
type: "string",
|
|
@@ -5698,6 +5930,7 @@ function _cuid2(Class, params) {
|
|
|
5698
5930
|
...normalizeParams(params)
|
|
5699
5931
|
});
|
|
5700
5932
|
}
|
|
5933
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5701
5934
|
function _ulid(Class, params) {
|
|
5702
5935
|
return new Class({
|
|
5703
5936
|
type: "string",
|
|
@@ -5707,6 +5940,7 @@ function _ulid(Class, params) {
|
|
|
5707
5940
|
...normalizeParams(params)
|
|
5708
5941
|
});
|
|
5709
5942
|
}
|
|
5943
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5710
5944
|
function _xid(Class, params) {
|
|
5711
5945
|
return new Class({
|
|
5712
5946
|
type: "string",
|
|
@@ -5716,6 +5950,7 @@ function _xid(Class, params) {
|
|
|
5716
5950
|
...normalizeParams(params)
|
|
5717
5951
|
});
|
|
5718
5952
|
}
|
|
5953
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5719
5954
|
function _ksuid(Class, params) {
|
|
5720
5955
|
return new Class({
|
|
5721
5956
|
type: "string",
|
|
@@ -5725,6 +5960,7 @@ function _ksuid(Class, params) {
|
|
|
5725
5960
|
...normalizeParams(params)
|
|
5726
5961
|
});
|
|
5727
5962
|
}
|
|
5963
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5728
5964
|
function _ipv4(Class, params) {
|
|
5729
5965
|
return new Class({
|
|
5730
5966
|
type: "string",
|
|
@@ -5734,6 +5970,7 @@ function _ipv4(Class, params) {
|
|
|
5734
5970
|
...normalizeParams(params)
|
|
5735
5971
|
});
|
|
5736
5972
|
}
|
|
5973
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5737
5974
|
function _ipv6(Class, params) {
|
|
5738
5975
|
return new Class({
|
|
5739
5976
|
type: "string",
|
|
@@ -5743,6 +5980,7 @@ function _ipv6(Class, params) {
|
|
|
5743
5980
|
...normalizeParams(params)
|
|
5744
5981
|
});
|
|
5745
5982
|
}
|
|
5983
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5746
5984
|
function _cidrv4(Class, params) {
|
|
5747
5985
|
return new Class({
|
|
5748
5986
|
type: "string",
|
|
@@ -5752,6 +5990,7 @@ function _cidrv4(Class, params) {
|
|
|
5752
5990
|
...normalizeParams(params)
|
|
5753
5991
|
});
|
|
5754
5992
|
}
|
|
5993
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5755
5994
|
function _cidrv6(Class, params) {
|
|
5756
5995
|
return new Class({
|
|
5757
5996
|
type: "string",
|
|
@@ -5761,6 +6000,7 @@ function _cidrv6(Class, params) {
|
|
|
5761
6000
|
...normalizeParams(params)
|
|
5762
6001
|
});
|
|
5763
6002
|
}
|
|
6003
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5764
6004
|
function _base64(Class, params) {
|
|
5765
6005
|
return new Class({
|
|
5766
6006
|
type: "string",
|
|
@@ -5770,6 +6010,7 @@ function _base64(Class, params) {
|
|
|
5770
6010
|
...normalizeParams(params)
|
|
5771
6011
|
});
|
|
5772
6012
|
}
|
|
6013
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5773
6014
|
function _base64url(Class, params) {
|
|
5774
6015
|
return new Class({
|
|
5775
6016
|
type: "string",
|
|
@@ -5779,6 +6020,7 @@ function _base64url(Class, params) {
|
|
|
5779
6020
|
...normalizeParams(params)
|
|
5780
6021
|
});
|
|
5781
6022
|
}
|
|
6023
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5782
6024
|
function _e164(Class, params) {
|
|
5783
6025
|
return new Class({
|
|
5784
6026
|
type: "string",
|
|
@@ -5788,6 +6030,7 @@ function _e164(Class, params) {
|
|
|
5788
6030
|
...normalizeParams(params)
|
|
5789
6031
|
});
|
|
5790
6032
|
}
|
|
6033
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5791
6034
|
function _jwt(Class, params) {
|
|
5792
6035
|
return new Class({
|
|
5793
6036
|
type: "string",
|
|
@@ -5797,6 +6040,7 @@ function _jwt(Class, params) {
|
|
|
5797
6040
|
...normalizeParams(params)
|
|
5798
6041
|
});
|
|
5799
6042
|
}
|
|
6043
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5800
6044
|
function _isoDateTime(Class, params) {
|
|
5801
6045
|
return new Class({
|
|
5802
6046
|
type: "string",
|
|
@@ -5808,6 +6052,7 @@ function _isoDateTime(Class, params) {
|
|
|
5808
6052
|
...normalizeParams(params)
|
|
5809
6053
|
});
|
|
5810
6054
|
}
|
|
6055
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5811
6056
|
function _isoDate(Class, params) {
|
|
5812
6057
|
return new Class({
|
|
5813
6058
|
type: "string",
|
|
@@ -5816,6 +6061,7 @@ function _isoDate(Class, params) {
|
|
|
5816
6061
|
...normalizeParams(params)
|
|
5817
6062
|
});
|
|
5818
6063
|
}
|
|
6064
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5819
6065
|
function _isoTime(Class, params) {
|
|
5820
6066
|
return new Class({
|
|
5821
6067
|
type: "string",
|
|
@@ -5825,6 +6071,7 @@ function _isoTime(Class, params) {
|
|
|
5825
6071
|
...normalizeParams(params)
|
|
5826
6072
|
});
|
|
5827
6073
|
}
|
|
6074
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5828
6075
|
function _isoDuration(Class, params) {
|
|
5829
6076
|
return new Class({
|
|
5830
6077
|
type: "string",
|
|
@@ -5833,6 +6080,7 @@ function _isoDuration(Class, params) {
|
|
|
5833
6080
|
...normalizeParams(params)
|
|
5834
6081
|
});
|
|
5835
6082
|
}
|
|
6083
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5836
6084
|
function _number(Class, params) {
|
|
5837
6085
|
return new Class({
|
|
5838
6086
|
type: "number",
|
|
@@ -5840,6 +6088,7 @@ function _number(Class, params) {
|
|
|
5840
6088
|
...normalizeParams(params)
|
|
5841
6089
|
});
|
|
5842
6090
|
}
|
|
6091
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5843
6092
|
function _int(Class, params) {
|
|
5844
6093
|
return new Class({
|
|
5845
6094
|
type: "number",
|
|
@@ -5849,27 +6098,32 @@ function _int(Class, params) {
|
|
|
5849
6098
|
...normalizeParams(params)
|
|
5850
6099
|
});
|
|
5851
6100
|
}
|
|
6101
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5852
6102
|
function _boolean(Class, params) {
|
|
5853
6103
|
return new Class({
|
|
5854
6104
|
type: "boolean",
|
|
5855
6105
|
...normalizeParams(params)
|
|
5856
6106
|
});
|
|
5857
6107
|
}
|
|
6108
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5858
6109
|
function _null$1(Class, params) {
|
|
5859
6110
|
return new Class({
|
|
5860
6111
|
type: "null",
|
|
5861
6112
|
...normalizeParams(params)
|
|
5862
6113
|
});
|
|
5863
6114
|
}
|
|
6115
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5864
6116
|
function _unknown(Class) {
|
|
5865
6117
|
return new Class({ type: "unknown" });
|
|
5866
6118
|
}
|
|
6119
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5867
6120
|
function _never(Class, params) {
|
|
5868
6121
|
return new Class({
|
|
5869
6122
|
type: "never",
|
|
5870
6123
|
...normalizeParams(params)
|
|
5871
6124
|
});
|
|
5872
6125
|
}
|
|
6126
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5873
6127
|
function _lt(value, params) {
|
|
5874
6128
|
return new $ZodCheckLessThan({
|
|
5875
6129
|
check: "less_than",
|
|
@@ -5878,6 +6132,7 @@ function _lt(value, params) {
|
|
|
5878
6132
|
inclusive: false
|
|
5879
6133
|
});
|
|
5880
6134
|
}
|
|
6135
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5881
6136
|
function _lte(value, params) {
|
|
5882
6137
|
return new $ZodCheckLessThan({
|
|
5883
6138
|
check: "less_than",
|
|
@@ -5886,6 +6141,7 @@ function _lte(value, params) {
|
|
|
5886
6141
|
inclusive: true
|
|
5887
6142
|
});
|
|
5888
6143
|
}
|
|
6144
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5889
6145
|
function _gt(value, params) {
|
|
5890
6146
|
return new $ZodCheckGreaterThan({
|
|
5891
6147
|
check: "greater_than",
|
|
@@ -5894,6 +6150,7 @@ function _gt(value, params) {
|
|
|
5894
6150
|
inclusive: false
|
|
5895
6151
|
});
|
|
5896
6152
|
}
|
|
6153
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5897
6154
|
function _gte(value, params) {
|
|
5898
6155
|
return new $ZodCheckGreaterThan({
|
|
5899
6156
|
check: "greater_than",
|
|
@@ -5902,6 +6159,7 @@ function _gte(value, params) {
|
|
|
5902
6159
|
inclusive: true
|
|
5903
6160
|
});
|
|
5904
6161
|
}
|
|
6162
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5905
6163
|
function _multipleOf(value, params) {
|
|
5906
6164
|
return new $ZodCheckMultipleOf({
|
|
5907
6165
|
check: "multiple_of",
|
|
@@ -5909,6 +6167,7 @@ function _multipleOf(value, params) {
|
|
|
5909
6167
|
value
|
|
5910
6168
|
});
|
|
5911
6169
|
}
|
|
6170
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5912
6171
|
function _maxLength(maximum, params) {
|
|
5913
6172
|
return new $ZodCheckMaxLength({
|
|
5914
6173
|
check: "max_length",
|
|
@@ -5916,6 +6175,7 @@ function _maxLength(maximum, params) {
|
|
|
5916
6175
|
maximum
|
|
5917
6176
|
});
|
|
5918
6177
|
}
|
|
6178
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5919
6179
|
function _minLength(minimum, params) {
|
|
5920
6180
|
return new $ZodCheckMinLength({
|
|
5921
6181
|
check: "min_length",
|
|
@@ -5923,6 +6183,7 @@ function _minLength(minimum, params) {
|
|
|
5923
6183
|
minimum
|
|
5924
6184
|
});
|
|
5925
6185
|
}
|
|
6186
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5926
6187
|
function _length(length, params) {
|
|
5927
6188
|
return new $ZodCheckLengthEquals({
|
|
5928
6189
|
check: "length_equals",
|
|
@@ -5930,6 +6191,7 @@ function _length(length, params) {
|
|
|
5930
6191
|
length
|
|
5931
6192
|
});
|
|
5932
6193
|
}
|
|
6194
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5933
6195
|
function _regex(pattern, params) {
|
|
5934
6196
|
return new $ZodCheckRegex({
|
|
5935
6197
|
check: "string_format",
|
|
@@ -5938,6 +6200,7 @@ function _regex(pattern, params) {
|
|
|
5938
6200
|
pattern
|
|
5939
6201
|
});
|
|
5940
6202
|
}
|
|
6203
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5941
6204
|
function _lowercase(params) {
|
|
5942
6205
|
return new $ZodCheckLowerCase({
|
|
5943
6206
|
check: "string_format",
|
|
@@ -5945,6 +6208,7 @@ function _lowercase(params) {
|
|
|
5945
6208
|
...normalizeParams(params)
|
|
5946
6209
|
});
|
|
5947
6210
|
}
|
|
6211
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5948
6212
|
function _uppercase(params) {
|
|
5949
6213
|
return new $ZodCheckUpperCase({
|
|
5950
6214
|
check: "string_format",
|
|
@@ -5952,6 +6216,7 @@ function _uppercase(params) {
|
|
|
5952
6216
|
...normalizeParams(params)
|
|
5953
6217
|
});
|
|
5954
6218
|
}
|
|
6219
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5955
6220
|
function _includes(includes, params) {
|
|
5956
6221
|
return new $ZodCheckIncludes({
|
|
5957
6222
|
check: "string_format",
|
|
@@ -5960,6 +6225,7 @@ function _includes(includes, params) {
|
|
|
5960
6225
|
includes
|
|
5961
6226
|
});
|
|
5962
6227
|
}
|
|
6228
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5963
6229
|
function _startsWith(prefix, params) {
|
|
5964
6230
|
return new $ZodCheckStartsWith({
|
|
5965
6231
|
check: "string_format",
|
|
@@ -5968,6 +6234,7 @@ function _startsWith(prefix, params) {
|
|
|
5968
6234
|
prefix
|
|
5969
6235
|
});
|
|
5970
6236
|
}
|
|
6237
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5971
6238
|
function _endsWith(suffix, params) {
|
|
5972
6239
|
return new $ZodCheckEndsWith({
|
|
5973
6240
|
check: "string_format",
|
|
@@ -5976,24 +6243,34 @@ function _endsWith(suffix, params) {
|
|
|
5976
6243
|
suffix
|
|
5977
6244
|
});
|
|
5978
6245
|
}
|
|
6246
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5979
6247
|
function _overwrite(tx) {
|
|
5980
6248
|
return new $ZodCheckOverwrite({
|
|
5981
6249
|
check: "overwrite",
|
|
5982
6250
|
tx
|
|
5983
6251
|
});
|
|
5984
6252
|
}
|
|
6253
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5985
6254
|
function _normalize(form) {
|
|
5986
|
-
return _overwrite((input) => input.normalize(form));
|
|
6255
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
5987
6256
|
}
|
|
6257
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5988
6258
|
function _trim() {
|
|
5989
|
-
return _overwrite((input) => input.trim());
|
|
6259
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
5990
6260
|
}
|
|
6261
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5991
6262
|
function _toLowerCase() {
|
|
5992
|
-
return _overwrite((input) => input.toLowerCase());
|
|
6263
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
5993
6264
|
}
|
|
6265
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5994
6266
|
function _toUpperCase() {
|
|
5995
|
-
return _overwrite((input) => input.toUpperCase());
|
|
6267
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
5996
6268
|
}
|
|
6269
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6270
|
+
function _slugify() {
|
|
6271
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
6272
|
+
}
|
|
6273
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
5997
6274
|
function _array(Class, element, params) {
|
|
5998
6275
|
return new Class({
|
|
5999
6276
|
type: "array",
|
|
@@ -6001,6 +6278,7 @@ function _array(Class, element, params) {
|
|
|
6001
6278
|
...normalizeParams(params)
|
|
6002
6279
|
});
|
|
6003
6280
|
}
|
|
6281
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6004
6282
|
function _custom(Class, fn, _params) {
|
|
6005
6283
|
const norm = normalizeParams(_params);
|
|
6006
6284
|
norm.abort ?? (norm.abort = true);
|
|
@@ -6011,6 +6289,7 @@ function _custom(Class, fn, _params) {
|
|
|
6011
6289
|
...norm
|
|
6012
6290
|
});
|
|
6013
6291
|
}
|
|
6292
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6014
6293
|
function _refine(Class, fn, _params) {
|
|
6015
6294
|
return new Class({
|
|
6016
6295
|
type: "custom",
|
|
@@ -6019,607 +6298,811 @@ function _refine(Class, fn, _params) {
|
|
|
6019
6298
|
...normalizeParams(_params)
|
|
6020
6299
|
});
|
|
6021
6300
|
}
|
|
6301
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6302
|
+
function _superRefine(fn) {
|
|
6303
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
6304
|
+
payload.addIssue = (issue$2) => {
|
|
6305
|
+
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
6306
|
+
else {
|
|
6307
|
+
const _issue = issue$2;
|
|
6308
|
+
if (_issue.fatal) _issue.continue = false;
|
|
6309
|
+
_issue.code ?? (_issue.code = "custom");
|
|
6310
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
6311
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
6312
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
6313
|
+
payload.issues.push(issue(_issue));
|
|
6314
|
+
}
|
|
6315
|
+
};
|
|
6316
|
+
return fn(payload.value, payload);
|
|
6317
|
+
});
|
|
6318
|
+
return ch;
|
|
6319
|
+
}
|
|
6320
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6321
|
+
function _check(fn, params) {
|
|
6322
|
+
const ch = new $ZodCheck({
|
|
6323
|
+
check: "custom",
|
|
6324
|
+
...normalizeParams(params)
|
|
6325
|
+
});
|
|
6326
|
+
ch._zod.check = fn;
|
|
6327
|
+
return ch;
|
|
6328
|
+
}
|
|
6329
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6330
|
+
function describe$2(description) {
|
|
6331
|
+
const ch = new $ZodCheck({ check: "describe" });
|
|
6332
|
+
ch._zod.onattach = [(inst) => {
|
|
6333
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
6334
|
+
globalRegistry.add(inst, {
|
|
6335
|
+
...existing,
|
|
6336
|
+
description
|
|
6337
|
+
});
|
|
6338
|
+
}];
|
|
6339
|
+
ch._zod.check = () => {};
|
|
6340
|
+
return ch;
|
|
6341
|
+
}
|
|
6342
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6343
|
+
function meta$2(metadata) {
|
|
6344
|
+
const ch = new $ZodCheck({ check: "meta" });
|
|
6345
|
+
ch._zod.onattach = [(inst) => {
|
|
6346
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
6347
|
+
globalRegistry.add(inst, {
|
|
6348
|
+
...existing,
|
|
6349
|
+
...metadata
|
|
6350
|
+
});
|
|
6351
|
+
}];
|
|
6352
|
+
ch._zod.check = () => {};
|
|
6353
|
+
return ch;
|
|
6354
|
+
}
|
|
6022
6355
|
|
|
6023
6356
|
//#endregion
|
|
6024
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
const result = {
|
|
6055
|
-
schema: {},
|
|
6056
|
-
count: 1,
|
|
6057
|
-
cycle: void 0,
|
|
6058
|
-
path: _params.path
|
|
6059
|
-
};
|
|
6060
|
-
this.seen.set(schema, result);
|
|
6061
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
6062
|
-
if (overrideSchema) result.schema = overrideSchema;
|
|
6063
|
-
else {
|
|
6064
|
-
const params = {
|
|
6065
|
-
..._params,
|
|
6066
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
6067
|
-
path: _params.path
|
|
6068
|
-
};
|
|
6069
|
-
const parent = schema._zod.parent;
|
|
6070
|
-
if (parent) {
|
|
6071
|
-
result.ref = parent;
|
|
6072
|
-
this.process(parent, params);
|
|
6073
|
-
this.seen.get(parent).isParent = true;
|
|
6074
|
-
} else {
|
|
6075
|
-
const _json = result.schema;
|
|
6076
|
-
switch (def.type) {
|
|
6077
|
-
case "string": {
|
|
6078
|
-
const json = _json;
|
|
6079
|
-
json.type = "string";
|
|
6080
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
6081
|
-
if (typeof minimum === "number") json.minLength = minimum;
|
|
6082
|
-
if (typeof maximum === "number") json.maxLength = maximum;
|
|
6083
|
-
if (format) {
|
|
6084
|
-
json.format = formatMap[format] ?? format;
|
|
6085
|
-
if (json.format === "") delete json.format;
|
|
6086
|
-
}
|
|
6087
|
-
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
6088
|
-
if (patterns && patterns.size > 0) {
|
|
6089
|
-
const regexes = [...patterns];
|
|
6090
|
-
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
6091
|
-
else if (regexes.length > 1) result.schema.allOf = [...regexes.map((regex) => ({
|
|
6092
|
-
...this.target === "draft-7" ? { type: "string" } : {},
|
|
6093
|
-
pattern: regex.source
|
|
6094
|
-
}))];
|
|
6095
|
-
}
|
|
6096
|
-
break;
|
|
6097
|
-
}
|
|
6098
|
-
case "number": {
|
|
6099
|
-
const json = _json;
|
|
6100
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
6101
|
-
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
6102
|
-
else json.type = "number";
|
|
6103
|
-
if (typeof exclusiveMinimum === "number") json.exclusiveMinimum = exclusiveMinimum;
|
|
6104
|
-
if (typeof minimum === "number") {
|
|
6105
|
-
json.minimum = minimum;
|
|
6106
|
-
if (typeof exclusiveMinimum === "number") if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
6107
|
-
else delete json.exclusiveMinimum;
|
|
6108
|
-
}
|
|
6109
|
-
if (typeof exclusiveMaximum === "number") json.exclusiveMaximum = exclusiveMaximum;
|
|
6110
|
-
if (typeof maximum === "number") {
|
|
6111
|
-
json.maximum = maximum;
|
|
6112
|
-
if (typeof exclusiveMaximum === "number") if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
6113
|
-
else delete json.exclusiveMaximum;
|
|
6114
|
-
}
|
|
6115
|
-
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
6116
|
-
break;
|
|
6117
|
-
}
|
|
6118
|
-
case "boolean": {
|
|
6119
|
-
const json = _json;
|
|
6120
|
-
json.type = "boolean";
|
|
6121
|
-
break;
|
|
6122
|
-
}
|
|
6123
|
-
case "bigint":
|
|
6124
|
-
if (this.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
6125
|
-
break;
|
|
6126
|
-
case "symbol":
|
|
6127
|
-
if (this.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
6128
|
-
break;
|
|
6129
|
-
case "null":
|
|
6130
|
-
_json.type = "null";
|
|
6131
|
-
break;
|
|
6132
|
-
case "any": break;
|
|
6133
|
-
case "unknown": break;
|
|
6134
|
-
case "undefined":
|
|
6135
|
-
if (this.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
6136
|
-
break;
|
|
6137
|
-
case "void":
|
|
6138
|
-
if (this.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
6139
|
-
break;
|
|
6140
|
-
case "never":
|
|
6141
|
-
_json.not = {};
|
|
6142
|
-
break;
|
|
6143
|
-
case "date":
|
|
6144
|
-
if (this.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
6145
|
-
break;
|
|
6146
|
-
case "array": {
|
|
6147
|
-
const json = _json;
|
|
6148
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
6149
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
6150
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
6151
|
-
json.type = "array";
|
|
6152
|
-
json.items = this.process(def.element, {
|
|
6153
|
-
...params,
|
|
6154
|
-
path: [...params.path, "items"]
|
|
6155
|
-
});
|
|
6156
|
-
break;
|
|
6157
|
-
}
|
|
6158
|
-
case "object": {
|
|
6159
|
-
const json = _json;
|
|
6160
|
-
json.type = "object";
|
|
6161
|
-
json.properties = {};
|
|
6162
|
-
const shape = def.shape;
|
|
6163
|
-
for (const key in shape) json.properties[key] = this.process(shape[key], {
|
|
6164
|
-
...params,
|
|
6165
|
-
path: [
|
|
6166
|
-
...params.path,
|
|
6167
|
-
"properties",
|
|
6168
|
-
key
|
|
6169
|
-
]
|
|
6170
|
-
});
|
|
6171
|
-
const allKeys = new Set(Object.keys(shape));
|
|
6172
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
6173
|
-
const v = def.shape[key]._zod;
|
|
6174
|
-
if (this.io === "input") return v.optin === void 0;
|
|
6175
|
-
else return v.optout === void 0;
|
|
6176
|
-
}));
|
|
6177
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
6178
|
-
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
6179
|
-
else if (!def.catchall) {
|
|
6180
|
-
if (this.io === "output") json.additionalProperties = false;
|
|
6181
|
-
} else if (def.catchall) json.additionalProperties = this.process(def.catchall, {
|
|
6182
|
-
...params,
|
|
6183
|
-
path: [...params.path, "additionalProperties"]
|
|
6184
|
-
});
|
|
6185
|
-
break;
|
|
6186
|
-
}
|
|
6187
|
-
case "union": {
|
|
6188
|
-
const json = _json;
|
|
6189
|
-
json.anyOf = def.options.map((x, i) => this.process(x, {
|
|
6190
|
-
...params,
|
|
6191
|
-
path: [
|
|
6192
|
-
...params.path,
|
|
6193
|
-
"anyOf",
|
|
6194
|
-
i
|
|
6195
|
-
]
|
|
6196
|
-
}));
|
|
6197
|
-
break;
|
|
6198
|
-
}
|
|
6199
|
-
case "intersection": {
|
|
6200
|
-
const json = _json;
|
|
6201
|
-
const a = this.process(def.left, {
|
|
6202
|
-
...params,
|
|
6203
|
-
path: [
|
|
6204
|
-
...params.path,
|
|
6205
|
-
"allOf",
|
|
6206
|
-
0
|
|
6207
|
-
]
|
|
6208
|
-
});
|
|
6209
|
-
const b = this.process(def.right, {
|
|
6210
|
-
...params,
|
|
6211
|
-
path: [
|
|
6212
|
-
...params.path,
|
|
6213
|
-
"allOf",
|
|
6214
|
-
1
|
|
6215
|
-
]
|
|
6216
|
-
});
|
|
6217
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
6218
|
-
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
6219
|
-
break;
|
|
6220
|
-
}
|
|
6221
|
-
case "tuple": {
|
|
6222
|
-
const json = _json;
|
|
6223
|
-
json.type = "array";
|
|
6224
|
-
const prefixItems = def.items.map((x, i) => this.process(x, {
|
|
6225
|
-
...params,
|
|
6226
|
-
path: [
|
|
6227
|
-
...params.path,
|
|
6228
|
-
"prefixItems",
|
|
6229
|
-
i
|
|
6230
|
-
]
|
|
6231
|
-
}));
|
|
6232
|
-
if (this.target === "draft-2020-12") json.prefixItems = prefixItems;
|
|
6233
|
-
else json.items = prefixItems;
|
|
6234
|
-
if (def.rest) {
|
|
6235
|
-
const rest = this.process(def.rest, {
|
|
6236
|
-
...params,
|
|
6237
|
-
path: [...params.path, "items"]
|
|
6238
|
-
});
|
|
6239
|
-
if (this.target === "draft-2020-12") json.items = rest;
|
|
6240
|
-
else json.additionalItems = rest;
|
|
6241
|
-
}
|
|
6242
|
-
if (def.rest) json.items = this.process(def.rest, {
|
|
6243
|
-
...params,
|
|
6244
|
-
path: [...params.path, "items"]
|
|
6245
|
-
});
|
|
6246
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
6247
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
6248
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
6249
|
-
break;
|
|
6250
|
-
}
|
|
6251
|
-
case "record": {
|
|
6252
|
-
const json = _json;
|
|
6253
|
-
json.type = "object";
|
|
6254
|
-
json.propertyNames = this.process(def.keyType, {
|
|
6255
|
-
...params,
|
|
6256
|
-
path: [...params.path, "propertyNames"]
|
|
6257
|
-
});
|
|
6258
|
-
json.additionalProperties = this.process(def.valueType, {
|
|
6259
|
-
...params,
|
|
6260
|
-
path: [...params.path, "additionalProperties"]
|
|
6261
|
-
});
|
|
6262
|
-
break;
|
|
6263
|
-
}
|
|
6264
|
-
case "map":
|
|
6265
|
-
if (this.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
6266
|
-
break;
|
|
6267
|
-
case "set":
|
|
6268
|
-
if (this.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
6269
|
-
break;
|
|
6270
|
-
case "enum": {
|
|
6271
|
-
const json = _json;
|
|
6272
|
-
const values = getEnumValues(def.entries);
|
|
6273
|
-
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
6274
|
-
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
6275
|
-
json.enum = values;
|
|
6276
|
-
break;
|
|
6277
|
-
}
|
|
6278
|
-
case "literal": {
|
|
6279
|
-
const json = _json;
|
|
6280
|
-
const vals = [];
|
|
6281
|
-
for (const val of def.values) if (val === void 0) {
|
|
6282
|
-
if (this.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
6283
|
-
} else if (typeof val === "bigint") if (this.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
6284
|
-
else vals.push(Number(val));
|
|
6285
|
-
else vals.push(val);
|
|
6286
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
6287
|
-
const val = vals[0];
|
|
6288
|
-
json.type = val === null ? "null" : typeof val;
|
|
6289
|
-
json.const = val;
|
|
6290
|
-
} else {
|
|
6291
|
-
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
6292
|
-
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
6293
|
-
if (vals.every((v) => typeof v === "boolean")) json.type = "string";
|
|
6294
|
-
if (vals.every((v) => v === null)) json.type = "null";
|
|
6295
|
-
json.enum = vals;
|
|
6296
|
-
}
|
|
6297
|
-
break;
|
|
6298
|
-
}
|
|
6299
|
-
case "file": {
|
|
6300
|
-
const json = _json;
|
|
6301
|
-
const file = {
|
|
6302
|
-
type: "string",
|
|
6303
|
-
format: "binary",
|
|
6304
|
-
contentEncoding: "binary"
|
|
6305
|
-
};
|
|
6306
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
6307
|
-
if (minimum !== void 0) file.minLength = minimum;
|
|
6308
|
-
if (maximum !== void 0) file.maxLength = maximum;
|
|
6309
|
-
if (mime) if (mime.length === 1) {
|
|
6310
|
-
file.contentMediaType = mime[0];
|
|
6311
|
-
Object.assign(json, file);
|
|
6312
|
-
} else json.anyOf = mime.map((m) => {
|
|
6313
|
-
return {
|
|
6314
|
-
...file,
|
|
6315
|
-
contentMediaType: m
|
|
6316
|
-
};
|
|
6317
|
-
});
|
|
6318
|
-
else Object.assign(json, file);
|
|
6319
|
-
break;
|
|
6320
|
-
}
|
|
6321
|
-
case "transform":
|
|
6322
|
-
if (this.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
6323
|
-
break;
|
|
6324
|
-
case "nullable":
|
|
6325
|
-
_json.anyOf = [this.process(def.innerType, params), { type: "null" }];
|
|
6326
|
-
break;
|
|
6327
|
-
case "nonoptional":
|
|
6328
|
-
this.process(def.innerType, params);
|
|
6329
|
-
result.ref = def.innerType;
|
|
6330
|
-
break;
|
|
6331
|
-
case "success": {
|
|
6332
|
-
const json = _json;
|
|
6333
|
-
json.type = "boolean";
|
|
6334
|
-
break;
|
|
6335
|
-
}
|
|
6336
|
-
case "default":
|
|
6337
|
-
this.process(def.innerType, params);
|
|
6338
|
-
result.ref = def.innerType;
|
|
6339
|
-
_json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6340
|
-
break;
|
|
6341
|
-
case "prefault":
|
|
6342
|
-
this.process(def.innerType, params);
|
|
6343
|
-
result.ref = def.innerType;
|
|
6344
|
-
if (this.io === "input") _json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6345
|
-
break;
|
|
6346
|
-
case "catch": {
|
|
6347
|
-
this.process(def.innerType, params);
|
|
6348
|
-
result.ref = def.innerType;
|
|
6349
|
-
let catchValue;
|
|
6350
|
-
try {
|
|
6351
|
-
catchValue = def.catchValue(void 0);
|
|
6352
|
-
} catch {
|
|
6353
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
6354
|
-
}
|
|
6355
|
-
_json.default = catchValue;
|
|
6356
|
-
break;
|
|
6357
|
-
}
|
|
6358
|
-
case "nan":
|
|
6359
|
-
if (this.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
6360
|
-
break;
|
|
6361
|
-
case "template_literal": {
|
|
6362
|
-
const json = _json;
|
|
6363
|
-
const pattern = schema._zod.pattern;
|
|
6364
|
-
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
6365
|
-
json.type = "string";
|
|
6366
|
-
json.pattern = pattern.source;
|
|
6367
|
-
break;
|
|
6368
|
-
}
|
|
6369
|
-
case "pipe": {
|
|
6370
|
-
const innerType = this.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
6371
|
-
this.process(innerType, params);
|
|
6372
|
-
result.ref = innerType;
|
|
6373
|
-
break;
|
|
6374
|
-
}
|
|
6375
|
-
case "readonly":
|
|
6376
|
-
this.process(def.innerType, params);
|
|
6377
|
-
result.ref = def.innerType;
|
|
6378
|
-
_json.readOnly = true;
|
|
6379
|
-
break;
|
|
6380
|
-
case "promise":
|
|
6381
|
-
this.process(def.innerType, params);
|
|
6382
|
-
result.ref = def.innerType;
|
|
6383
|
-
break;
|
|
6384
|
-
case "optional":
|
|
6385
|
-
this.process(def.innerType, params);
|
|
6386
|
-
result.ref = def.innerType;
|
|
6387
|
-
break;
|
|
6388
|
-
case "lazy": {
|
|
6389
|
-
const innerType = schema._zod.innerType;
|
|
6390
|
-
this.process(innerType, params);
|
|
6391
|
-
result.ref = innerType;
|
|
6392
|
-
break;
|
|
6393
|
-
}
|
|
6394
|
-
case "custom":
|
|
6395
|
-
if (this.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
6396
|
-
break;
|
|
6397
|
-
default:
|
|
6398
|
-
}
|
|
6399
|
-
}
|
|
6400
|
-
}
|
|
6401
|
-
const meta = this.metadataRegistry.get(schema);
|
|
6402
|
-
if (meta) Object.assign(result.schema, meta);
|
|
6403
|
-
if (this.io === "input" && isTransforming(schema)) {
|
|
6404
|
-
delete result.schema.examples;
|
|
6405
|
-
delete result.schema.default;
|
|
6406
|
-
}
|
|
6407
|
-
if (this.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
6408
|
-
delete result.schema._prefault;
|
|
6409
|
-
return this.seen.get(schema).schema;
|
|
6357
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
6358
|
+
function initializeContext(params) {
|
|
6359
|
+
let target = params?.target ?? "draft-2020-12";
|
|
6360
|
+
if (target === "draft-4") target = "draft-04";
|
|
6361
|
+
if (target === "draft-7") target = "draft-07";
|
|
6362
|
+
return {
|
|
6363
|
+
processors: params.processors ?? {},
|
|
6364
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
6365
|
+
target,
|
|
6366
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
6367
|
+
override: params?.override ?? (() => {}),
|
|
6368
|
+
io: params?.io ?? "output",
|
|
6369
|
+
counter: 0,
|
|
6370
|
+
seen: /* @__PURE__ */ new Map(),
|
|
6371
|
+
cycles: params?.cycles ?? "ref",
|
|
6372
|
+
reused: params?.reused ?? "inline",
|
|
6373
|
+
external: params?.external ?? void 0
|
|
6374
|
+
};
|
|
6375
|
+
}
|
|
6376
|
+
function process$2(schema, ctx, _params = {
|
|
6377
|
+
path: [],
|
|
6378
|
+
schemaPath: []
|
|
6379
|
+
}) {
|
|
6380
|
+
var _a;
|
|
6381
|
+
const def = schema._zod.def;
|
|
6382
|
+
const seen = ctx.seen.get(schema);
|
|
6383
|
+
if (seen) {
|
|
6384
|
+
seen.count++;
|
|
6385
|
+
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
6386
|
+
return seen.schema;
|
|
6410
6387
|
}
|
|
6411
|
-
|
|
6388
|
+
const result = {
|
|
6389
|
+
schema: {},
|
|
6390
|
+
count: 1,
|
|
6391
|
+
cycle: void 0,
|
|
6392
|
+
path: _params.path
|
|
6393
|
+
};
|
|
6394
|
+
ctx.seen.set(schema, result);
|
|
6395
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
6396
|
+
if (overrideSchema) result.schema = overrideSchema;
|
|
6397
|
+
else {
|
|
6412
6398
|
const params = {
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6399
|
+
..._params,
|
|
6400
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
6401
|
+
path: _params.path
|
|
6416
6402
|
};
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
const
|
|
6421
|
-
if (
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6403
|
+
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
6404
|
+
else {
|
|
6405
|
+
const _json = result.schema;
|
|
6406
|
+
const processor = ctx.processors[def.type];
|
|
6407
|
+
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
6408
|
+
processor(schema, ctx, _json, params);
|
|
6409
|
+
}
|
|
6410
|
+
const parent = schema._zod.parent;
|
|
6411
|
+
if (parent) {
|
|
6412
|
+
if (!result.ref) result.ref = parent;
|
|
6413
|
+
process$2(parent, ctx, params);
|
|
6414
|
+
ctx.seen.get(parent).isParent = true;
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6417
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
6418
|
+
if (meta) Object.assign(result.schema, meta);
|
|
6419
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
6420
|
+
delete result.schema.examples;
|
|
6421
|
+
delete result.schema.default;
|
|
6422
|
+
}
|
|
6423
|
+
if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
6424
|
+
delete result.schema._prefault;
|
|
6425
|
+
return ctx.seen.get(schema).schema;
|
|
6426
|
+
}
|
|
6427
|
+
function extractDefs(ctx, schema) {
|
|
6428
|
+
const root = ctx.seen.get(schema);
|
|
6429
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6430
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
6431
|
+
for (const entry of ctx.seen.entries()) {
|
|
6432
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
6433
|
+
if (id) {
|
|
6434
|
+
const existing = idToSchema.get(id);
|
|
6435
|
+
if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
6436
|
+
idToSchema.set(id, entry[0]);
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
const makeURI = (entry) => {
|
|
6440
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6441
|
+
if (ctx.external) {
|
|
6442
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
6443
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
6444
|
+
if (externalId) return { ref: uriGenerator(externalId) };
|
|
6445
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
6446
|
+
entry[1].defId = id;
|
|
6435
6447
|
return {
|
|
6436
|
-
defId,
|
|
6437
|
-
ref:
|
|
6448
|
+
defId: id,
|
|
6449
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
6438
6450
|
};
|
|
6451
|
+
}
|
|
6452
|
+
if (entry[1] === root) return { ref: "#" };
|
|
6453
|
+
const defUriPrefix = `#/${defsSegment}/`;
|
|
6454
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
6455
|
+
return {
|
|
6456
|
+
defId,
|
|
6457
|
+
ref: defUriPrefix + defId
|
|
6439
6458
|
};
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6459
|
+
};
|
|
6460
|
+
const extractToDef = (entry) => {
|
|
6461
|
+
if (entry[1].schema.$ref) return;
|
|
6462
|
+
const seen = entry[1];
|
|
6463
|
+
const { ref, defId } = makeURI(entry);
|
|
6464
|
+
seen.def = { ...seen.schema };
|
|
6465
|
+
if (defId) seen.defId = defId;
|
|
6466
|
+
const schema = seen.schema;
|
|
6467
|
+
for (const key in schema) delete schema[key];
|
|
6468
|
+
schema.$ref = ref;
|
|
6469
|
+
};
|
|
6470
|
+
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
6471
|
+
const seen = entry[1];
|
|
6472
|
+
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
6453
6473
|
|
|
6454
6474
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
6475
|
+
}
|
|
6476
|
+
for (const entry of ctx.seen.entries()) {
|
|
6477
|
+
const seen = entry[1];
|
|
6478
|
+
if (schema === entry[0]) {
|
|
6479
|
+
extractToDef(entry);
|
|
6480
|
+
continue;
|
|
6455
6481
|
}
|
|
6456
|
-
|
|
6457
|
-
const
|
|
6458
|
-
if (schema
|
|
6482
|
+
if (ctx.external) {
|
|
6483
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
6484
|
+
if (schema !== entry[0] && ext) {
|
|
6459
6485
|
extractToDef(entry);
|
|
6460
6486
|
continue;
|
|
6461
6487
|
}
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
if (seen.cycle) {
|
|
6488
|
+
}
|
|
6489
|
+
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
6490
|
+
extractToDef(entry);
|
|
6491
|
+
continue;
|
|
6492
|
+
}
|
|
6493
|
+
if (seen.cycle) {
|
|
6494
|
+
extractToDef(entry);
|
|
6495
|
+
continue;
|
|
6496
|
+
}
|
|
6497
|
+
if (seen.count > 1) {
|
|
6498
|
+
if (ctx.reused === "ref") {
|
|
6474
6499
|
extractToDef(entry);
|
|
6475
6500
|
continue;
|
|
6476
6501
|
}
|
|
6477
|
-
if (seen.count > 1) {
|
|
6478
|
-
if (params.reused === "ref") {
|
|
6479
|
-
extractToDef(entry);
|
|
6480
|
-
continue;
|
|
6481
|
-
}
|
|
6482
|
-
}
|
|
6483
6502
|
}
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
function finalize(ctx, schema) {
|
|
6506
|
+
const root = ctx.seen.get(schema);
|
|
6507
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6508
|
+
const flattenRef = (zodSchema) => {
|
|
6509
|
+
const seen = ctx.seen.get(zodSchema);
|
|
6510
|
+
if (seen.ref === null) return;
|
|
6511
|
+
const schema = seen.def ?? seen.schema;
|
|
6512
|
+
const _cached = { ...schema };
|
|
6513
|
+
const ref = seen.ref;
|
|
6514
|
+
seen.ref = null;
|
|
6515
|
+
if (ref) {
|
|
6516
|
+
flattenRef(ref);
|
|
6517
|
+
const refSeen = ctx.seen.get(ref);
|
|
6518
|
+
const refSchema = refSeen.schema;
|
|
6519
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
6520
|
+
schema.allOf = schema.allOf ?? [];
|
|
6521
|
+
schema.allOf.push(refSchema);
|
|
6522
|
+
} else Object.assign(schema, refSchema);
|
|
6523
|
+
Object.assign(schema, _cached);
|
|
6524
|
+
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
6525
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
6526
|
+
if (!(key in _cached)) delete schema[key];
|
|
6527
|
+
}
|
|
6528
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
6529
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
6530
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
const parent = zodSchema._zod.parent;
|
|
6534
|
+
if (parent && parent !== ref) {
|
|
6535
|
+
flattenRef(parent);
|
|
6536
|
+
const parentSeen = ctx.seen.get(parent);
|
|
6537
|
+
if (parentSeen?.schema.$ref) {
|
|
6538
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
6539
|
+
if (parentSeen.def) for (const key in schema) {
|
|
6540
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
6541
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
6500
6542
|
}
|
|
6501
6543
|
}
|
|
6502
|
-
if (!seen.isParent) this.override({
|
|
6503
|
-
zodSchema,
|
|
6504
|
-
jsonSchema: schema,
|
|
6505
|
-
path: seen.path ?? []
|
|
6506
|
-
});
|
|
6507
|
-
};
|
|
6508
|
-
for (const entry of [...this.seen.entries()].reverse()) flattenRef(entry[0], { target: this.target });
|
|
6509
|
-
const result = {};
|
|
6510
|
-
if (this.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
6511
|
-
else if (this.target === "draft-7") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
6512
|
-
else console.warn(`Invalid target: ${this.target}`);
|
|
6513
|
-
if (params.external?.uri) {
|
|
6514
|
-
const id = params.external.registry.get(schema)?.id;
|
|
6515
|
-
if (!id) throw new Error("Schema is missing an `id` property");
|
|
6516
|
-
result.$id = params.external.uri(id);
|
|
6517
|
-
}
|
|
6518
|
-
Object.assign(result, root.def);
|
|
6519
|
-
const defs = params.external?.defs ?? {};
|
|
6520
|
-
for (const entry of this.seen.entries()) {
|
|
6521
|
-
const seen = entry[1];
|
|
6522
|
-
if (seen.def && seen.defId) defs[seen.defId] = seen.def;
|
|
6523
|
-
}
|
|
6524
|
-
if (params.external) {} else if (Object.keys(defs).length > 0) if (this.target === "draft-2020-12") result.$defs = defs;
|
|
6525
|
-
else result.definitions = defs;
|
|
6526
|
-
try {
|
|
6527
|
-
return JSON.parse(JSON.stringify(result));
|
|
6528
|
-
} catch (_err) {
|
|
6529
|
-
throw new Error("Error converting schema to JSON.");
|
|
6530
6544
|
}
|
|
6545
|
+
ctx.override({
|
|
6546
|
+
zodSchema,
|
|
6547
|
+
jsonSchema: schema,
|
|
6548
|
+
path: seen.path ?? []
|
|
6549
|
+
});
|
|
6550
|
+
};
|
|
6551
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
6552
|
+
const result = {};
|
|
6553
|
+
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
6554
|
+
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
6555
|
+
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
6556
|
+
else if (ctx.target === "openapi-3.0") {}
|
|
6557
|
+
if (ctx.external?.uri) {
|
|
6558
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
6559
|
+
if (!id) throw new Error("Schema is missing an `id` property");
|
|
6560
|
+
result.$id = ctx.external.uri(id);
|
|
6561
|
+
}
|
|
6562
|
+
Object.assign(result, root.def ?? root.schema);
|
|
6563
|
+
const defs = ctx.external?.defs ?? {};
|
|
6564
|
+
for (const entry of ctx.seen.entries()) {
|
|
6565
|
+
const seen = entry[1];
|
|
6566
|
+
if (seen.def && seen.defId) defs[seen.defId] = seen.def;
|
|
6567
|
+
}
|
|
6568
|
+
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
6569
|
+
else result.definitions = defs;
|
|
6570
|
+
try {
|
|
6571
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
6572
|
+
Object.defineProperty(finalized, "~standard", {
|
|
6573
|
+
value: {
|
|
6574
|
+
...schema["~standard"],
|
|
6575
|
+
jsonSchema: {
|
|
6576
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
6577
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
6578
|
+
}
|
|
6579
|
+
},
|
|
6580
|
+
enumerable: false,
|
|
6581
|
+
writable: false
|
|
6582
|
+
});
|
|
6583
|
+
return finalized;
|
|
6584
|
+
} catch (_err) {
|
|
6585
|
+
throw new Error("Error converting schema to JSON.");
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
function isTransforming(_schema, _ctx) {
|
|
6589
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
6590
|
+
if (ctx.seen.has(_schema)) return false;
|
|
6591
|
+
ctx.seen.add(_schema);
|
|
6592
|
+
const def = _schema._zod.def;
|
|
6593
|
+
if (def.type === "transform") return true;
|
|
6594
|
+
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
6595
|
+
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
6596
|
+
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
6597
|
+
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);
|
|
6598
|
+
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
6599
|
+
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
6600
|
+
if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
6601
|
+
if (def.type === "object") {
|
|
6602
|
+
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
6603
|
+
return false;
|
|
6604
|
+
}
|
|
6605
|
+
if (def.type === "union") {
|
|
6606
|
+
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
6607
|
+
return false;
|
|
6608
|
+
}
|
|
6609
|
+
if (def.type === "tuple") {
|
|
6610
|
+
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
6611
|
+
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
6612
|
+
return false;
|
|
6613
|
+
}
|
|
6614
|
+
return false;
|
|
6615
|
+
}
|
|
6616
|
+
/**
|
|
6617
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
6618
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
6619
|
+
*/
|
|
6620
|
+
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
6621
|
+
const ctx = initializeContext({
|
|
6622
|
+
...params,
|
|
6623
|
+
processors
|
|
6624
|
+
});
|
|
6625
|
+
process$2(schema, ctx);
|
|
6626
|
+
extractDefs(ctx, schema);
|
|
6627
|
+
return finalize(ctx, schema);
|
|
6628
|
+
};
|
|
6629
|
+
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
6630
|
+
const { libraryOptions, target } = params ?? {};
|
|
6631
|
+
const ctx = initializeContext({
|
|
6632
|
+
...libraryOptions ?? {},
|
|
6633
|
+
target,
|
|
6634
|
+
io,
|
|
6635
|
+
processors
|
|
6636
|
+
});
|
|
6637
|
+
process$2(schema, ctx);
|
|
6638
|
+
extractDefs(ctx, schema);
|
|
6639
|
+
return finalize(ctx, schema);
|
|
6640
|
+
};
|
|
6641
|
+
|
|
6642
|
+
//#endregion
|
|
6643
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
6644
|
+
const formatMap = {
|
|
6645
|
+
guid: "uuid",
|
|
6646
|
+
url: "uri",
|
|
6647
|
+
datetime: "date-time",
|
|
6648
|
+
json_string: "json-string",
|
|
6649
|
+
regex: ""
|
|
6650
|
+
};
|
|
6651
|
+
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
6652
|
+
const json = _json;
|
|
6653
|
+
json.type = "string";
|
|
6654
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
6655
|
+
if (typeof minimum === "number") json.minLength = minimum;
|
|
6656
|
+
if (typeof maximum === "number") json.maxLength = maximum;
|
|
6657
|
+
if (format) {
|
|
6658
|
+
json.format = formatMap[format] ?? format;
|
|
6659
|
+
if (json.format === "") delete json.format;
|
|
6660
|
+
if (format === "time") delete json.format;
|
|
6661
|
+
}
|
|
6662
|
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
6663
|
+
if (patterns && patterns.size > 0) {
|
|
6664
|
+
const regexes = [...patterns];
|
|
6665
|
+
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
6666
|
+
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
6667
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
6668
|
+
pattern: regex.source
|
|
6669
|
+
}))];
|
|
6670
|
+
}
|
|
6671
|
+
};
|
|
6672
|
+
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
6673
|
+
const json = _json;
|
|
6674
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
6675
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
6676
|
+
else json.type = "number";
|
|
6677
|
+
if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
6678
|
+
json.minimum = exclusiveMinimum;
|
|
6679
|
+
json.exclusiveMinimum = true;
|
|
6680
|
+
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
6681
|
+
if (typeof minimum === "number") {
|
|
6682
|
+
json.minimum = minimum;
|
|
6683
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
6684
|
+
else delete json.exclusiveMinimum;
|
|
6685
|
+
}
|
|
6686
|
+
if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
6687
|
+
json.maximum = exclusiveMaximum;
|
|
6688
|
+
json.exclusiveMaximum = true;
|
|
6689
|
+
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
6690
|
+
if (typeof maximum === "number") {
|
|
6691
|
+
json.maximum = maximum;
|
|
6692
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
6693
|
+
else delete json.exclusiveMaximum;
|
|
6694
|
+
}
|
|
6695
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
6696
|
+
};
|
|
6697
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
6698
|
+
json.type = "boolean";
|
|
6699
|
+
};
|
|
6700
|
+
const bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
6701
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
6702
|
+
};
|
|
6703
|
+
const symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
6704
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
6705
|
+
};
|
|
6706
|
+
const nullProcessor = (_schema, ctx, json, _params) => {
|
|
6707
|
+
if (ctx.target === "openapi-3.0") {
|
|
6708
|
+
json.type = "string";
|
|
6709
|
+
json.nullable = true;
|
|
6710
|
+
json.enum = [null];
|
|
6711
|
+
} else json.type = "null";
|
|
6712
|
+
};
|
|
6713
|
+
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
6714
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
6715
|
+
};
|
|
6716
|
+
const voidProcessor = (_schema, ctx, _json, _params) => {
|
|
6717
|
+
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
6718
|
+
};
|
|
6719
|
+
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
6720
|
+
json.not = {};
|
|
6721
|
+
};
|
|
6722
|
+
const anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
6723
|
+
const unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
6724
|
+
const dateProcessor = (_schema, ctx, _json, _params) => {
|
|
6725
|
+
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
6726
|
+
};
|
|
6727
|
+
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
6728
|
+
const def = schema._zod.def;
|
|
6729
|
+
const values = getEnumValues(def.entries);
|
|
6730
|
+
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
6731
|
+
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
6732
|
+
json.enum = values;
|
|
6733
|
+
};
|
|
6734
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
6735
|
+
const def = schema._zod.def;
|
|
6736
|
+
const vals = [];
|
|
6737
|
+
for (const val of def.values) if (val === void 0) {
|
|
6738
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
6739
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
6740
|
+
else vals.push(Number(val));
|
|
6741
|
+
else vals.push(val);
|
|
6742
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
6743
|
+
const val = vals[0];
|
|
6744
|
+
json.type = val === null ? "null" : typeof val;
|
|
6745
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
6746
|
+
else json.const = val;
|
|
6747
|
+
} else {
|
|
6748
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
6749
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
6750
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
6751
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
6752
|
+
json.enum = vals;
|
|
6753
|
+
}
|
|
6754
|
+
};
|
|
6755
|
+
const nanProcessor = (_schema, ctx, _json, _params) => {
|
|
6756
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
6757
|
+
};
|
|
6758
|
+
const templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
6759
|
+
const _json = json;
|
|
6760
|
+
const pattern = schema._zod.pattern;
|
|
6761
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
6762
|
+
_json.type = "string";
|
|
6763
|
+
_json.pattern = pattern.source;
|
|
6764
|
+
};
|
|
6765
|
+
const fileProcessor = (schema, _ctx, json, _params) => {
|
|
6766
|
+
const _json = json;
|
|
6767
|
+
const file = {
|
|
6768
|
+
type: "string",
|
|
6769
|
+
format: "binary",
|
|
6770
|
+
contentEncoding: "binary"
|
|
6771
|
+
};
|
|
6772
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
6773
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
6774
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
6775
|
+
if (mime) if (mime.length === 1) {
|
|
6776
|
+
file.contentMediaType = mime[0];
|
|
6777
|
+
Object.assign(_json, file);
|
|
6778
|
+
} else {
|
|
6779
|
+
Object.assign(_json, file);
|
|
6780
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
6781
|
+
}
|
|
6782
|
+
else Object.assign(_json, file);
|
|
6783
|
+
};
|
|
6784
|
+
const successProcessor = (_schema, _ctx, json, _params) => {
|
|
6785
|
+
json.type = "boolean";
|
|
6786
|
+
};
|
|
6787
|
+
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
6788
|
+
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
6789
|
+
};
|
|
6790
|
+
const functionProcessor = (_schema, ctx, _json, _params) => {
|
|
6791
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
6792
|
+
};
|
|
6793
|
+
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
6794
|
+
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
6795
|
+
};
|
|
6796
|
+
const mapProcessor = (_schema, ctx, _json, _params) => {
|
|
6797
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
6798
|
+
};
|
|
6799
|
+
const setProcessor = (_schema, ctx, _json, _params) => {
|
|
6800
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
6801
|
+
};
|
|
6802
|
+
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
6803
|
+
const json = _json;
|
|
6804
|
+
const def = schema._zod.def;
|
|
6805
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
6806
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
6807
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
6808
|
+
json.type = "array";
|
|
6809
|
+
json.items = process$2(def.element, ctx, {
|
|
6810
|
+
...params,
|
|
6811
|
+
path: [...params.path, "items"]
|
|
6812
|
+
});
|
|
6813
|
+
};
|
|
6814
|
+
const objectProcessor = (schema, ctx, _json, params) => {
|
|
6815
|
+
const json = _json;
|
|
6816
|
+
const def = schema._zod.def;
|
|
6817
|
+
json.type = "object";
|
|
6818
|
+
json.properties = {};
|
|
6819
|
+
const shape = def.shape;
|
|
6820
|
+
for (const key in shape) json.properties[key] = process$2(shape[key], ctx, {
|
|
6821
|
+
...params,
|
|
6822
|
+
path: [
|
|
6823
|
+
...params.path,
|
|
6824
|
+
"properties",
|
|
6825
|
+
key
|
|
6826
|
+
]
|
|
6827
|
+
});
|
|
6828
|
+
const allKeys = new Set(Object.keys(shape));
|
|
6829
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
6830
|
+
const v = def.shape[key]._zod;
|
|
6831
|
+
if (ctx.io === "input") return v.optin === void 0;
|
|
6832
|
+
else return v.optout === void 0;
|
|
6833
|
+
}));
|
|
6834
|
+
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
6835
|
+
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
6836
|
+
else if (!def.catchall) {
|
|
6837
|
+
if (ctx.io === "output") json.additionalProperties = false;
|
|
6838
|
+
} else if (def.catchall) json.additionalProperties = process$2(def.catchall, ctx, {
|
|
6839
|
+
...params,
|
|
6840
|
+
path: [...params.path, "additionalProperties"]
|
|
6841
|
+
});
|
|
6842
|
+
};
|
|
6843
|
+
const unionProcessor = (schema, ctx, json, params) => {
|
|
6844
|
+
const def = schema._zod.def;
|
|
6845
|
+
const isExclusive = def.inclusive === false;
|
|
6846
|
+
const options = def.options.map((x, i) => process$2(x, ctx, {
|
|
6847
|
+
...params,
|
|
6848
|
+
path: [
|
|
6849
|
+
...params.path,
|
|
6850
|
+
isExclusive ? "oneOf" : "anyOf",
|
|
6851
|
+
i
|
|
6852
|
+
]
|
|
6853
|
+
}));
|
|
6854
|
+
if (isExclusive) json.oneOf = options;
|
|
6855
|
+
else json.anyOf = options;
|
|
6856
|
+
};
|
|
6857
|
+
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
6858
|
+
const def = schema._zod.def;
|
|
6859
|
+
const a = process$2(def.left, ctx, {
|
|
6860
|
+
...params,
|
|
6861
|
+
path: [
|
|
6862
|
+
...params.path,
|
|
6863
|
+
"allOf",
|
|
6864
|
+
0
|
|
6865
|
+
]
|
|
6866
|
+
});
|
|
6867
|
+
const b = process$2(def.right, ctx, {
|
|
6868
|
+
...params,
|
|
6869
|
+
path: [
|
|
6870
|
+
...params.path,
|
|
6871
|
+
"allOf",
|
|
6872
|
+
1
|
|
6873
|
+
]
|
|
6874
|
+
});
|
|
6875
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
6876
|
+
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
6877
|
+
};
|
|
6878
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
6879
|
+
const json = _json;
|
|
6880
|
+
const def = schema._zod.def;
|
|
6881
|
+
json.type = "array";
|
|
6882
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
6883
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
6884
|
+
const prefixItems = def.items.map((x, i) => process$2(x, ctx, {
|
|
6885
|
+
...params,
|
|
6886
|
+
path: [
|
|
6887
|
+
...params.path,
|
|
6888
|
+
prefixPath,
|
|
6889
|
+
i
|
|
6890
|
+
]
|
|
6891
|
+
}));
|
|
6892
|
+
const rest = def.rest ? process$2(def.rest, ctx, {
|
|
6893
|
+
...params,
|
|
6894
|
+
path: [
|
|
6895
|
+
...params.path,
|
|
6896
|
+
restPath,
|
|
6897
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
6898
|
+
]
|
|
6899
|
+
}) : null;
|
|
6900
|
+
if (ctx.target === "draft-2020-12") {
|
|
6901
|
+
json.prefixItems = prefixItems;
|
|
6902
|
+
if (rest) json.items = rest;
|
|
6903
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
6904
|
+
json.items = { anyOf: prefixItems };
|
|
6905
|
+
if (rest) json.items.anyOf.push(rest);
|
|
6906
|
+
json.minItems = prefixItems.length;
|
|
6907
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
6908
|
+
} else {
|
|
6909
|
+
json.items = prefixItems;
|
|
6910
|
+
if (rest) json.additionalItems = rest;
|
|
6911
|
+
}
|
|
6912
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
6913
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
6914
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
6915
|
+
};
|
|
6916
|
+
const recordProcessor = (schema, ctx, _json, params) => {
|
|
6917
|
+
const json = _json;
|
|
6918
|
+
const def = schema._zod.def;
|
|
6919
|
+
json.type = "object";
|
|
6920
|
+
const keyType = def.keyType;
|
|
6921
|
+
const patterns = keyType._zod.bag?.patterns;
|
|
6922
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
6923
|
+
const valueSchema = process$2(def.valueType, ctx, {
|
|
6924
|
+
...params,
|
|
6925
|
+
path: [
|
|
6926
|
+
...params.path,
|
|
6927
|
+
"patternProperties",
|
|
6928
|
+
"*"
|
|
6929
|
+
]
|
|
6930
|
+
});
|
|
6931
|
+
json.patternProperties = {};
|
|
6932
|
+
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
6933
|
+
} else {
|
|
6934
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$2(def.keyType, ctx, {
|
|
6935
|
+
...params,
|
|
6936
|
+
path: [...params.path, "propertyNames"]
|
|
6937
|
+
});
|
|
6938
|
+
json.additionalProperties = process$2(def.valueType, ctx, {
|
|
6939
|
+
...params,
|
|
6940
|
+
path: [...params.path, "additionalProperties"]
|
|
6941
|
+
});
|
|
6942
|
+
}
|
|
6943
|
+
const keyValues = keyType._zod.values;
|
|
6944
|
+
if (keyValues) {
|
|
6945
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
6946
|
+
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
6531
6947
|
}
|
|
6532
6948
|
};
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6949
|
+
const nullableProcessor = (schema, ctx, json, params) => {
|
|
6950
|
+
const def = schema._zod.def;
|
|
6951
|
+
const inner = process$2(def.innerType, ctx, params);
|
|
6952
|
+
const seen = ctx.seen.get(schema);
|
|
6953
|
+
if (ctx.target === "openapi-3.0") {
|
|
6954
|
+
seen.ref = def.innerType;
|
|
6955
|
+
json.nullable = true;
|
|
6956
|
+
} else json.anyOf = [inner, { type: "null" }];
|
|
6957
|
+
};
|
|
6958
|
+
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
6959
|
+
const def = schema._zod.def;
|
|
6960
|
+
process$2(def.innerType, ctx, params);
|
|
6961
|
+
const seen = ctx.seen.get(schema);
|
|
6962
|
+
seen.ref = def.innerType;
|
|
6963
|
+
};
|
|
6964
|
+
const defaultProcessor = (schema, ctx, json, params) => {
|
|
6965
|
+
const def = schema._zod.def;
|
|
6966
|
+
process$2(def.innerType, ctx, params);
|
|
6967
|
+
const seen = ctx.seen.get(schema);
|
|
6968
|
+
seen.ref = def.innerType;
|
|
6969
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6970
|
+
};
|
|
6971
|
+
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
6972
|
+
const def = schema._zod.def;
|
|
6973
|
+
process$2(def.innerType, ctx, params);
|
|
6974
|
+
const seen = ctx.seen.get(schema);
|
|
6975
|
+
seen.ref = def.innerType;
|
|
6976
|
+
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6977
|
+
};
|
|
6978
|
+
const catchProcessor = (schema, ctx, json, params) => {
|
|
6979
|
+
const def = schema._zod.def;
|
|
6980
|
+
process$2(def.innerType, ctx, params);
|
|
6981
|
+
const seen = ctx.seen.get(schema);
|
|
6982
|
+
seen.ref = def.innerType;
|
|
6983
|
+
let catchValue;
|
|
6984
|
+
try {
|
|
6985
|
+
catchValue = def.catchValue(void 0);
|
|
6986
|
+
} catch {
|
|
6987
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
6988
|
+
}
|
|
6989
|
+
json.default = catchValue;
|
|
6990
|
+
};
|
|
6991
|
+
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
6992
|
+
const def = schema._zod.def;
|
|
6993
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
6994
|
+
process$2(innerType, ctx, params);
|
|
6995
|
+
const seen = ctx.seen.get(schema);
|
|
6996
|
+
seen.ref = innerType;
|
|
6997
|
+
};
|
|
6998
|
+
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
6999
|
+
const def = schema._zod.def;
|
|
7000
|
+
process$2(def.innerType, ctx, params);
|
|
7001
|
+
const seen = ctx.seen.get(schema);
|
|
7002
|
+
seen.ref = def.innerType;
|
|
7003
|
+
json.readOnly = true;
|
|
7004
|
+
};
|
|
7005
|
+
const promiseProcessor = (schema, ctx, _json, params) => {
|
|
7006
|
+
const def = schema._zod.def;
|
|
7007
|
+
process$2(def.innerType, ctx, params);
|
|
7008
|
+
const seen = ctx.seen.get(schema);
|
|
7009
|
+
seen.ref = def.innerType;
|
|
7010
|
+
};
|
|
7011
|
+
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
7012
|
+
const def = schema._zod.def;
|
|
7013
|
+
process$2(def.innerType, ctx, params);
|
|
7014
|
+
const seen = ctx.seen.get(schema);
|
|
7015
|
+
seen.ref = def.innerType;
|
|
7016
|
+
};
|
|
7017
|
+
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
7018
|
+
const innerType = schema._zod.innerType;
|
|
7019
|
+
process$2(innerType, ctx, params);
|
|
7020
|
+
const seen = ctx.seen.get(schema);
|
|
7021
|
+
seen.ref = innerType;
|
|
7022
|
+
};
|
|
7023
|
+
const allProcessors = {
|
|
7024
|
+
string: stringProcessor,
|
|
7025
|
+
number: numberProcessor,
|
|
7026
|
+
boolean: booleanProcessor,
|
|
7027
|
+
bigint: bigintProcessor,
|
|
7028
|
+
symbol: symbolProcessor,
|
|
7029
|
+
null: nullProcessor,
|
|
7030
|
+
undefined: undefinedProcessor,
|
|
7031
|
+
void: voidProcessor,
|
|
7032
|
+
never: neverProcessor,
|
|
7033
|
+
any: anyProcessor,
|
|
7034
|
+
unknown: unknownProcessor,
|
|
7035
|
+
date: dateProcessor,
|
|
7036
|
+
enum: enumProcessor,
|
|
7037
|
+
literal: literalProcessor,
|
|
7038
|
+
nan: nanProcessor,
|
|
7039
|
+
template_literal: templateLiteralProcessor,
|
|
7040
|
+
file: fileProcessor,
|
|
7041
|
+
success: successProcessor,
|
|
7042
|
+
custom: customProcessor,
|
|
7043
|
+
function: functionProcessor,
|
|
7044
|
+
transform: transformProcessor,
|
|
7045
|
+
map: mapProcessor,
|
|
7046
|
+
set: setProcessor,
|
|
7047
|
+
array: arrayProcessor,
|
|
7048
|
+
object: objectProcessor,
|
|
7049
|
+
union: unionProcessor,
|
|
7050
|
+
intersection: intersectionProcessor,
|
|
7051
|
+
tuple: tupleProcessor,
|
|
7052
|
+
record: recordProcessor,
|
|
7053
|
+
nullable: nullableProcessor,
|
|
7054
|
+
nonoptional: nonoptionalProcessor,
|
|
7055
|
+
default: defaultProcessor,
|
|
7056
|
+
prefault: prefaultProcessor,
|
|
7057
|
+
catch: catchProcessor,
|
|
7058
|
+
pipe: pipeProcessor,
|
|
7059
|
+
readonly: readonlyProcessor,
|
|
7060
|
+
promise: promiseProcessor,
|
|
7061
|
+
optional: optionalProcessor,
|
|
7062
|
+
lazy: lazyProcessor
|
|
7063
|
+
};
|
|
7064
|
+
function toJSONSchema(input, params) {
|
|
7065
|
+
if ("_idmap" in input) {
|
|
7066
|
+
const registry = input;
|
|
7067
|
+
const ctx = initializeContext({
|
|
7068
|
+
...params,
|
|
7069
|
+
processors: allProcessors
|
|
7070
|
+
});
|
|
6536
7071
|
const defs = {};
|
|
6537
|
-
for (const entry of
|
|
7072
|
+
for (const entry of registry._idmap.entries()) {
|
|
6538
7073
|
const [_, schema] = entry;
|
|
6539
|
-
|
|
7074
|
+
process$2(schema, ctx);
|
|
6540
7075
|
}
|
|
6541
7076
|
const schemas = {};
|
|
6542
|
-
|
|
6543
|
-
registry
|
|
6544
|
-
uri:
|
|
7077
|
+
ctx.external = {
|
|
7078
|
+
registry,
|
|
7079
|
+
uri: params?.uri,
|
|
6545
7080
|
defs
|
|
6546
7081
|
};
|
|
6547
|
-
for (const entry of
|
|
7082
|
+
for (const entry of registry._idmap.entries()) {
|
|
6548
7083
|
const [key, schema] = entry;
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
external
|
|
6552
|
-
});
|
|
7084
|
+
extractDefs(ctx, schema);
|
|
7085
|
+
schemas[key] = finalize(ctx, schema);
|
|
6553
7086
|
}
|
|
6554
|
-
if (Object.keys(defs).length > 0) schemas.__shared = { [
|
|
7087
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
6555
7088
|
return { schemas };
|
|
6556
7089
|
}
|
|
6557
|
-
const
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
}
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
ctx.seen.add(_schema);
|
|
6565
|
-
const def = _schema._zod.def;
|
|
6566
|
-
switch (def.type) {
|
|
6567
|
-
case "string":
|
|
6568
|
-
case "number":
|
|
6569
|
-
case "bigint":
|
|
6570
|
-
case "boolean":
|
|
6571
|
-
case "date":
|
|
6572
|
-
case "symbol":
|
|
6573
|
-
case "undefined":
|
|
6574
|
-
case "null":
|
|
6575
|
-
case "any":
|
|
6576
|
-
case "unknown":
|
|
6577
|
-
case "never":
|
|
6578
|
-
case "void":
|
|
6579
|
-
case "literal":
|
|
6580
|
-
case "enum":
|
|
6581
|
-
case "nan":
|
|
6582
|
-
case "file":
|
|
6583
|
-
case "template_literal": return false;
|
|
6584
|
-
case "array": return isTransforming(def.element, ctx);
|
|
6585
|
-
case "object":
|
|
6586
|
-
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
6587
|
-
return false;
|
|
6588
|
-
case "union":
|
|
6589
|
-
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
6590
|
-
return false;
|
|
6591
|
-
case "intersection": return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
6592
|
-
case "tuple":
|
|
6593
|
-
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
6594
|
-
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
6595
|
-
return false;
|
|
6596
|
-
case "record": return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
6597
|
-
case "map": return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
6598
|
-
case "set": return isTransforming(def.valueType, ctx);
|
|
6599
|
-
case "promise":
|
|
6600
|
-
case "optional":
|
|
6601
|
-
case "nonoptional":
|
|
6602
|
-
case "nullable":
|
|
6603
|
-
case "readonly": return isTransforming(def.innerType, ctx);
|
|
6604
|
-
case "lazy": return isTransforming(def.getter(), ctx);
|
|
6605
|
-
case "default": return isTransforming(def.innerType, ctx);
|
|
6606
|
-
case "prefault": return isTransforming(def.innerType, ctx);
|
|
6607
|
-
case "custom": return false;
|
|
6608
|
-
case "transform": return true;
|
|
6609
|
-
case "pipe": return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
6610
|
-
case "success": return false;
|
|
6611
|
-
case "catch": return false;
|
|
6612
|
-
default:
|
|
6613
|
-
}
|
|
6614
|
-
throw new Error(`Unknown schema type: ${def.type}`);
|
|
7090
|
+
const ctx = initializeContext({
|
|
7091
|
+
...params,
|
|
7092
|
+
processors: allProcessors
|
|
7093
|
+
});
|
|
7094
|
+
process$2(input, ctx);
|
|
7095
|
+
extractDefs(ctx, input);
|
|
7096
|
+
return finalize(ctx, input);
|
|
6615
7097
|
}
|
|
6616
7098
|
|
|
6617
7099
|
//#endregion
|
|
6618
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
7100
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/mini/schemas.js
|
|
6619
7101
|
const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
6620
7102
|
if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
|
|
6621
7103
|
$ZodType.init(inst, def);
|
|
6622
7104
|
inst.def = def;
|
|
7105
|
+
inst.type = def.type;
|
|
6623
7106
|
inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
|
|
6624
7107
|
inst.safeParse = (data, params) => safeParse$2(inst, data, params);
|
|
6625
7108
|
inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -6632,33 +7115,35 @@ const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
|
6632
7115
|
def: { check: "custom" },
|
|
6633
7116
|
onattach: []
|
|
6634
7117
|
} } : ch)]
|
|
6635
|
-
});
|
|
7118
|
+
}, { parent: true });
|
|
6636
7119
|
};
|
|
7120
|
+
inst.with = inst.check;
|
|
6637
7121
|
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
6638
7122
|
inst.brand = () => inst;
|
|
6639
7123
|
inst.register = ((reg, meta) => {
|
|
6640
7124
|
reg.add(inst, meta);
|
|
6641
7125
|
return inst;
|
|
6642
7126
|
});
|
|
7127
|
+
inst.apply = (fn) => fn(inst);
|
|
6643
7128
|
});
|
|
6644
7129
|
const ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
|
|
6645
7130
|
$ZodObject.init(inst, def);
|
|
6646
7131
|
ZodMiniType.init(inst, def);
|
|
6647
7132
|
defineLazy(inst, "shape", () => def.shape);
|
|
6648
7133
|
});
|
|
7134
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6649
7135
|
function object$1(shape, params) {
|
|
6650
7136
|
return new ZodMiniObject({
|
|
6651
7137
|
type: "object",
|
|
6652
|
-
|
|
6653
|
-
assignProp(this, "shape", { ...shape });
|
|
6654
|
-
return this.shape;
|
|
6655
|
-
},
|
|
7138
|
+
shape: shape ?? {},
|
|
6656
7139
|
...normalizeParams(params)
|
|
6657
7140
|
});
|
|
6658
7141
|
}
|
|
7142
|
+
const describe$1 = describe$2;
|
|
7143
|
+
const meta$1 = meta$2;
|
|
6659
7144
|
|
|
6660
7145
|
//#endregion
|
|
6661
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
7146
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
6662
7147
|
function isZ4Schema(s) {
|
|
6663
7148
|
return !!s._zod;
|
|
6664
7149
|
}
|
|
@@ -6774,7 +7259,7 @@ function getLiteralValue(schema) {
|
|
|
6774
7259
|
}
|
|
6775
7260
|
|
|
6776
7261
|
//#endregion
|
|
6777
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
7262
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
6778
7263
|
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
6779
7264
|
$ZodISODateTime.init(inst, def);
|
|
6780
7265
|
ZodStringFormat.init(inst, def);
|
|
@@ -6805,15 +7290,21 @@ function duration(params) {
|
|
|
6805
7290
|
}
|
|
6806
7291
|
|
|
6807
7292
|
//#endregion
|
|
6808
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
7293
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
6809
7294
|
const initializer = (inst, issues) => {
|
|
6810
7295
|
$ZodError.init(inst, issues);
|
|
6811
7296
|
inst.name = "ZodError";
|
|
6812
7297
|
Object.defineProperties(inst, {
|
|
6813
7298
|
format: { value: (mapper) => formatError(inst, mapper) },
|
|
6814
7299
|
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
6815
|
-
addIssue: { value: (issue) =>
|
|
6816
|
-
|
|
7300
|
+
addIssue: { value: (issue) => {
|
|
7301
|
+
inst.issues.push(issue);
|
|
7302
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7303
|
+
} },
|
|
7304
|
+
addIssues: { value: (issues) => {
|
|
7305
|
+
inst.issues.push(...issues);
|
|
7306
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7307
|
+
} },
|
|
6817
7308
|
isEmpty: { get() {
|
|
6818
7309
|
return inst.issues.length === 0;
|
|
6819
7310
|
} }
|
|
@@ -6823,28 +7314,40 @@ const ZodError = $constructor("ZodError", initializer);
|
|
|
6823
7314
|
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
6824
7315
|
|
|
6825
7316
|
//#endregion
|
|
6826
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
7317
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
6827
7318
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
6828
7319
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
6829
7320
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
6830
7321
|
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
7322
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
7323
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
7324
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
7325
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
7326
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
7327
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
7328
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
7329
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
6831
7330
|
|
|
6832
7331
|
//#endregion
|
|
6833
|
-
//#region ../../../node_modules/.bun/zod@3.
|
|
7332
|
+
//#region ../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
6834
7333
|
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
6835
7334
|
$ZodType.init(inst, def);
|
|
7335
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
7336
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
7337
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
7338
|
+
} });
|
|
7339
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
6836
7340
|
inst.def = def;
|
|
7341
|
+
inst.type = def.type;
|
|
6837
7342
|
Object.defineProperty(inst, "_def", { value: def });
|
|
6838
7343
|
inst.check = (...checks) => {
|
|
6839
|
-
return inst.clone({
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
onattach: []
|
|
6845
|
-
} } : ch)]
|
|
6846
|
-
});
|
|
7344
|
+
return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
7345
|
+
check: ch,
|
|
7346
|
+
def: { check: "custom" },
|
|
7347
|
+
onattach: []
|
|
7348
|
+
} } : ch)] }), { parent: true });
|
|
6847
7349
|
};
|
|
7350
|
+
inst.with = inst.check;
|
|
6848
7351
|
inst.clone = (def, params) => clone(inst, def, params);
|
|
6849
7352
|
inst.brand = () => inst;
|
|
6850
7353
|
inst.register = ((reg, meta) => {
|
|
@@ -6856,10 +7359,19 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
6856
7359
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
6857
7360
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
6858
7361
|
inst.spa = inst.safeParseAsync;
|
|
7362
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
7363
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
7364
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
7365
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
7366
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
7367
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
7368
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
7369
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
6859
7370
|
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
6860
7371
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
6861
7372
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
6862
7373
|
inst.optional = () => optional(inst);
|
|
7374
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
6863
7375
|
inst.nullable = () => nullable(inst);
|
|
6864
7376
|
inst.nullish = () => optional(nullable(inst));
|
|
6865
7377
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -6891,12 +7403,14 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
6891
7403
|
};
|
|
6892
7404
|
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
6893
7405
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
7406
|
+
inst.apply = (fn) => fn(inst);
|
|
6894
7407
|
return inst;
|
|
6895
7408
|
});
|
|
6896
7409
|
/** @internal */
|
|
6897
7410
|
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
6898
7411
|
$ZodString.init(inst, def);
|
|
6899
7412
|
ZodType.init(inst, def);
|
|
7413
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
6900
7414
|
const bag = inst._zod.bag;
|
|
6901
7415
|
inst.format = bag.format ?? null;
|
|
6902
7416
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -6915,6 +7429,7 @@ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
6915
7429
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
6916
7430
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
6917
7431
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
7432
|
+
inst.slugify = () => inst.check(_slugify());
|
|
6918
7433
|
});
|
|
6919
7434
|
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
6920
7435
|
$ZodString.init(inst, def);
|
|
@@ -7033,6 +7548,7 @@ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
7033
7548
|
const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
7034
7549
|
$ZodNumber.init(inst, def);
|
|
7035
7550
|
ZodType.init(inst, def);
|
|
7551
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
7036
7552
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
7037
7553
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
7038
7554
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -7068,6 +7584,7 @@ function int(params) {
|
|
|
7068
7584
|
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
7069
7585
|
$ZodBoolean.init(inst, def);
|
|
7070
7586
|
ZodType.init(inst, def);
|
|
7587
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7071
7588
|
});
|
|
7072
7589
|
function boolean(params) {
|
|
7073
7590
|
return _boolean(ZodBoolean, params);
|
|
@@ -7075,6 +7592,7 @@ function boolean(params) {
|
|
|
7075
7592
|
const ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
7076
7593
|
$ZodNull.init(inst, def);
|
|
7077
7594
|
ZodType.init(inst, def);
|
|
7595
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
7078
7596
|
});
|
|
7079
7597
|
function _null(params) {
|
|
7080
7598
|
return _null$1(ZodNull, params);
|
|
@@ -7082,6 +7600,7 @@ function _null(params) {
|
|
|
7082
7600
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7083
7601
|
$ZodUnknown.init(inst, def);
|
|
7084
7602
|
ZodType.init(inst, def);
|
|
7603
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
7085
7604
|
});
|
|
7086
7605
|
function unknown() {
|
|
7087
7606
|
return _unknown(ZodUnknown);
|
|
@@ -7089,6 +7608,7 @@ function unknown() {
|
|
|
7089
7608
|
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
7090
7609
|
$ZodNever.init(inst, def);
|
|
7091
7610
|
ZodType.init(inst, def);
|
|
7611
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
7092
7612
|
});
|
|
7093
7613
|
function never(params) {
|
|
7094
7614
|
return _never(ZodNever, params);
|
|
@@ -7096,6 +7616,7 @@ function never(params) {
|
|
|
7096
7616
|
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
7097
7617
|
$ZodArray.init(inst, def);
|
|
7098
7618
|
ZodType.init(inst, def);
|
|
7619
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
7099
7620
|
inst.element = def.element;
|
|
7100
7621
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
7101
7622
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -7107,9 +7628,12 @@ function array(element, params) {
|
|
|
7107
7628
|
return _array(ZodArray, element, params);
|
|
7108
7629
|
}
|
|
7109
7630
|
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
7110
|
-
$
|
|
7631
|
+
$ZodObjectJIT.init(inst, def);
|
|
7111
7632
|
ZodType.init(inst, def);
|
|
7112
|
-
|
|
7633
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
7634
|
+
defineLazy(inst, "shape", () => {
|
|
7635
|
+
return def.shape;
|
|
7636
|
+
});
|
|
7113
7637
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
7114
7638
|
inst.catchall = (catchall) => inst.clone({
|
|
7115
7639
|
...inst._zod.def,
|
|
@@ -7134,6 +7658,9 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
7134
7658
|
inst.extend = (incoming) => {
|
|
7135
7659
|
return extend(inst, incoming);
|
|
7136
7660
|
};
|
|
7661
|
+
inst.safeExtend = (incoming) => {
|
|
7662
|
+
return safeExtend(inst, incoming);
|
|
7663
|
+
};
|
|
7137
7664
|
inst.merge = (other) => merge(inst, other);
|
|
7138
7665
|
inst.pick = (mask) => pick(inst, mask);
|
|
7139
7666
|
inst.omit = (mask) => omit(inst, mask);
|
|
@@ -7143,20 +7670,14 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
7143
7670
|
function object(shape, params) {
|
|
7144
7671
|
return new ZodObject({
|
|
7145
7672
|
type: "object",
|
|
7146
|
-
|
|
7147
|
-
assignProp(this, "shape", { ...shape });
|
|
7148
|
-
return this.shape;
|
|
7149
|
-
},
|
|
7673
|
+
shape: shape ?? {},
|
|
7150
7674
|
...normalizeParams(params)
|
|
7151
7675
|
});
|
|
7152
7676
|
}
|
|
7153
7677
|
function looseObject(shape, params) {
|
|
7154
7678
|
return new ZodObject({
|
|
7155
7679
|
type: "object",
|
|
7156
|
-
|
|
7157
|
-
assignProp(this, "shape", { ...shape });
|
|
7158
|
-
return this.shape;
|
|
7159
|
-
},
|
|
7680
|
+
shape,
|
|
7160
7681
|
catchall: unknown(),
|
|
7161
7682
|
...normalizeParams(params)
|
|
7162
7683
|
});
|
|
@@ -7164,6 +7685,7 @@ function looseObject(shape, params) {
|
|
|
7164
7685
|
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
7165
7686
|
$ZodUnion.init(inst, def);
|
|
7166
7687
|
ZodType.init(inst, def);
|
|
7688
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
7167
7689
|
inst.options = def.options;
|
|
7168
7690
|
});
|
|
7169
7691
|
function union(options, params) {
|
|
@@ -7188,6 +7710,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
7188
7710
|
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
7189
7711
|
$ZodIntersection.init(inst, def);
|
|
7190
7712
|
ZodType.init(inst, def);
|
|
7713
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
7191
7714
|
});
|
|
7192
7715
|
function intersection(left, right) {
|
|
7193
7716
|
return new ZodIntersection({
|
|
@@ -7199,6 +7722,7 @@ function intersection(left, right) {
|
|
|
7199
7722
|
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
7200
7723
|
$ZodRecord.init(inst, def);
|
|
7201
7724
|
ZodType.init(inst, def);
|
|
7725
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
7202
7726
|
inst.keyType = def.keyType;
|
|
7203
7727
|
inst.valueType = def.valueType;
|
|
7204
7728
|
});
|
|
@@ -7213,6 +7737,7 @@ function record(keyType, valueType, params) {
|
|
|
7213
7737
|
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
7214
7738
|
$ZodEnum.init(inst, def);
|
|
7215
7739
|
ZodType.init(inst, def);
|
|
7740
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
7216
7741
|
inst.enum = def.entries;
|
|
7217
7742
|
inst.options = Object.values(def.entries);
|
|
7218
7743
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -7249,6 +7774,7 @@ function _enum(values, params) {
|
|
|
7249
7774
|
const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
7250
7775
|
$ZodLiteral.init(inst, def);
|
|
7251
7776
|
ZodType.init(inst, def);
|
|
7777
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
7252
7778
|
inst.values = new Set(def.values);
|
|
7253
7779
|
Object.defineProperty(inst, "value", { get() {
|
|
7254
7780
|
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -7265,16 +7791,17 @@ function literal(value, params) {
|
|
|
7265
7791
|
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
7266
7792
|
$ZodTransform.init(inst, def);
|
|
7267
7793
|
ZodType.init(inst, def);
|
|
7794
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
7268
7795
|
inst._zod.parse = (payload, _ctx) => {
|
|
7269
|
-
|
|
7270
|
-
|
|
7796
|
+
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
7797
|
+
payload.addIssue = (issue$1) => {
|
|
7798
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
7271
7799
|
else {
|
|
7272
|
-
const _issue = issue$
|
|
7800
|
+
const _issue = issue$1;
|
|
7273
7801
|
if (_issue.fatal) _issue.continue = false;
|
|
7274
7802
|
_issue.code ?? (_issue.code = "custom");
|
|
7275
7803
|
_issue.input ?? (_issue.input = payload.value);
|
|
7276
7804
|
_issue.inst ?? (_issue.inst = inst);
|
|
7277
|
-
_issue.continue ?? (_issue.continue = true);
|
|
7278
7805
|
payload.issues.push(issue(_issue));
|
|
7279
7806
|
}
|
|
7280
7807
|
};
|
|
@@ -7296,6 +7823,7 @@ function transform(fn) {
|
|
|
7296
7823
|
const ZodOptional$1 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
7297
7824
|
$ZodOptional.init(inst, def);
|
|
7298
7825
|
ZodType.init(inst, def);
|
|
7826
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7299
7827
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7300
7828
|
});
|
|
7301
7829
|
function optional(innerType) {
|
|
@@ -7304,9 +7832,22 @@ function optional(innerType) {
|
|
|
7304
7832
|
innerType
|
|
7305
7833
|
});
|
|
7306
7834
|
}
|
|
7835
|
+
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
7836
|
+
$ZodExactOptional.init(inst, def);
|
|
7837
|
+
ZodType.init(inst, def);
|
|
7838
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7839
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
7840
|
+
});
|
|
7841
|
+
function exactOptional(innerType) {
|
|
7842
|
+
return new ZodExactOptional({
|
|
7843
|
+
type: "optional",
|
|
7844
|
+
innerType
|
|
7845
|
+
});
|
|
7846
|
+
}
|
|
7307
7847
|
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
7308
7848
|
$ZodNullable.init(inst, def);
|
|
7309
7849
|
ZodType.init(inst, def);
|
|
7850
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
7310
7851
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7311
7852
|
});
|
|
7312
7853
|
function nullable(innerType) {
|
|
@@ -7318,6 +7859,7 @@ function nullable(innerType) {
|
|
|
7318
7859
|
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
7319
7860
|
$ZodDefault.init(inst, def);
|
|
7320
7861
|
ZodType.init(inst, def);
|
|
7862
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
7321
7863
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7322
7864
|
inst.removeDefault = inst.unwrap;
|
|
7323
7865
|
});
|
|
@@ -7326,13 +7868,14 @@ function _default(innerType, defaultValue) {
|
|
|
7326
7868
|
type: "default",
|
|
7327
7869
|
innerType,
|
|
7328
7870
|
get defaultValue() {
|
|
7329
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7871
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
7330
7872
|
}
|
|
7331
7873
|
});
|
|
7332
7874
|
}
|
|
7333
7875
|
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
7334
7876
|
$ZodPrefault.init(inst, def);
|
|
7335
7877
|
ZodType.init(inst, def);
|
|
7878
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
7336
7879
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7337
7880
|
});
|
|
7338
7881
|
function prefault(innerType, defaultValue) {
|
|
@@ -7340,13 +7883,14 @@ function prefault(innerType, defaultValue) {
|
|
|
7340
7883
|
type: "prefault",
|
|
7341
7884
|
innerType,
|
|
7342
7885
|
get defaultValue() {
|
|
7343
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7886
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
7344
7887
|
}
|
|
7345
7888
|
});
|
|
7346
7889
|
}
|
|
7347
7890
|
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
7348
7891
|
$ZodNonOptional.init(inst, def);
|
|
7349
7892
|
ZodType.init(inst, def);
|
|
7893
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
7350
7894
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7351
7895
|
});
|
|
7352
7896
|
function nonoptional(innerType, params) {
|
|
@@ -7359,6 +7903,7 @@ function nonoptional(innerType, params) {
|
|
|
7359
7903
|
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
7360
7904
|
$ZodCatch.init(inst, def);
|
|
7361
7905
|
ZodType.init(inst, def);
|
|
7906
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
7362
7907
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7363
7908
|
inst.removeCatch = inst.unwrap;
|
|
7364
7909
|
});
|
|
@@ -7372,6 +7917,7 @@ function _catch(innerType, catchValue) {
|
|
|
7372
7917
|
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
7373
7918
|
$ZodPipe.init(inst, def);
|
|
7374
7919
|
ZodType.init(inst, def);
|
|
7920
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
7375
7921
|
inst.in = def.in;
|
|
7376
7922
|
inst.out = def.out;
|
|
7377
7923
|
});
|
|
@@ -7385,6 +7931,8 @@ function pipe(in_, out) {
|
|
|
7385
7931
|
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
7386
7932
|
$ZodReadonly.init(inst, def);
|
|
7387
7933
|
ZodType.init(inst, def);
|
|
7934
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
7935
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
7388
7936
|
});
|
|
7389
7937
|
function readonly(innerType) {
|
|
7390
7938
|
return new ZodReadonly({
|
|
@@ -7395,12 +7943,8 @@ function readonly(innerType) {
|
|
|
7395
7943
|
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
7396
7944
|
$ZodCustom.init(inst, def);
|
|
7397
7945
|
ZodType.init(inst, def);
|
|
7946
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
7398
7947
|
});
|
|
7399
|
-
function check(fn) {
|
|
7400
|
-
const ch = new $ZodCheck({ check: "custom" });
|
|
7401
|
-
ch._zod.check = fn;
|
|
7402
|
-
return ch;
|
|
7403
|
-
}
|
|
7404
7948
|
function custom(fn, _params) {
|
|
7405
7949
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
7406
7950
|
}
|
|
@@ -7408,29 +7952,16 @@ function refine(fn, _params = {}) {
|
|
|
7408
7952
|
return _refine(ZodCustom, fn, _params);
|
|
7409
7953
|
}
|
|
7410
7954
|
function superRefine(fn) {
|
|
7411
|
-
|
|
7412
|
-
payload.addIssue = (issue$1) => {
|
|
7413
|
-
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
7414
|
-
else {
|
|
7415
|
-
const _issue = issue$1;
|
|
7416
|
-
if (_issue.fatal) _issue.continue = false;
|
|
7417
|
-
_issue.code ?? (_issue.code = "custom");
|
|
7418
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
7419
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
7420
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
7421
|
-
payload.issues.push(issue(_issue));
|
|
7422
|
-
}
|
|
7423
|
-
};
|
|
7424
|
-
return fn(payload.value, payload);
|
|
7425
|
-
});
|
|
7426
|
-
return ch;
|
|
7955
|
+
return _superRefine(fn);
|
|
7427
7956
|
}
|
|
7957
|
+
const describe = describe$2;
|
|
7958
|
+
const meta = meta$2;
|
|
7428
7959
|
function preprocess(fn, schema) {
|
|
7429
7960
|
return pipe(transform(fn), schema);
|
|
7430
7961
|
}
|
|
7431
7962
|
|
|
7432
7963
|
//#endregion
|
|
7433
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
7964
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
7434
7965
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
7435
7966
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
7436
7967
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -7459,7 +7990,7 @@ const CursorSchema = string();
|
|
|
7459
7990
|
* Task creation parameters, used to ask that the server create a task to represent a request.
|
|
7460
7991
|
*/
|
|
7461
7992
|
const TaskCreationParamsSchema = looseObject({
|
|
7462
|
-
ttl:
|
|
7993
|
+
ttl: number().optional(),
|
|
7463
7994
|
pollInterval: number().optional()
|
|
7464
7995
|
});
|
|
7465
7996
|
const TaskMetadataSchema = object({ ttl: number().optional() });
|
|
@@ -7665,7 +8196,8 @@ const ClientCapabilitiesSchema = object({
|
|
|
7665
8196
|
}).optional(),
|
|
7666
8197
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
7667
8198
|
roots: object({ listChanged: boolean().optional() }).optional(),
|
|
7668
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
8199
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
8200
|
+
extensions: record(string(), AssertObjectSchema).optional()
|
|
7669
8201
|
});
|
|
7670
8202
|
const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
7671
8203
|
protocolVersion: string(),
|
|
@@ -7692,7 +8224,8 @@ const ServerCapabilitiesSchema = object({
|
|
|
7692
8224
|
listChanged: boolean().optional()
|
|
7693
8225
|
}).optional(),
|
|
7694
8226
|
tools: object({ listChanged: boolean().optional() }).optional(),
|
|
7695
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
8227
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
8228
|
+
extensions: record(string(), AssertObjectSchema).optional()
|
|
7696
8229
|
});
|
|
7697
8230
|
/**
|
|
7698
8231
|
* After receiving an initialize request from the client, the server sends this response.
|
|
@@ -7864,6 +8397,7 @@ const ResourceSchema = object({
|
|
|
7864
8397
|
uri: string(),
|
|
7865
8398
|
description: optional(string()),
|
|
7866
8399
|
mimeType: optional(string()),
|
|
8400
|
+
size: optional(number()),
|
|
7867
8401
|
annotations: AnnotationsSchema.optional(),
|
|
7868
8402
|
_meta: optional(looseObject({}))
|
|
7869
8403
|
});
|
|
@@ -8687,7 +9221,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
8687
9221
|
};
|
|
8688
9222
|
|
|
8689
9223
|
//#endregion
|
|
8690
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
9224
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
8691
9225
|
/**
|
|
8692
9226
|
* Experimental task interfaces for MCP SDK.
|
|
8693
9227
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -8705,7 +9239,7 @@ function isTerminal(status) {
|
|
|
8705
9239
|
}
|
|
8706
9240
|
|
|
8707
9241
|
//#endregion
|
|
8708
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9242
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
8709
9243
|
const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
8710
9244
|
const defaultOptions = {
|
|
8711
9245
|
name: void 0,
|
|
@@ -8740,7 +9274,7 @@ const getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
8740
9274
|
};
|
|
8741
9275
|
|
|
8742
9276
|
//#endregion
|
|
8743
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9277
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
8744
9278
|
const getRefs = (options) => {
|
|
8745
9279
|
const _options = getDefaultOptions(options);
|
|
8746
9280
|
const currentPath = _options.name !== void 0 ? [
|
|
@@ -8766,7 +9300,7 @@ const getRefs = (options) => {
|
|
|
8766
9300
|
};
|
|
8767
9301
|
|
|
8768
9302
|
//#endregion
|
|
8769
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9303
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
8770
9304
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
8771
9305
|
if (!refs?.errorMessages) return;
|
|
8772
9306
|
if (errorMessage) res.errorMessage = {
|
|
@@ -8780,7 +9314,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
8780
9314
|
}
|
|
8781
9315
|
|
|
8782
9316
|
//#endregion
|
|
8783
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9317
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
8784
9318
|
const getRelativePath = (pathA, pathB) => {
|
|
8785
9319
|
let i = 0;
|
|
8786
9320
|
for (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;
|
|
@@ -8788,7 +9322,7 @@ const getRelativePath = (pathA, pathB) => {
|
|
|
8788
9322
|
};
|
|
8789
9323
|
|
|
8790
9324
|
//#endregion
|
|
8791
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9325
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
8792
9326
|
function parseAnyDef(refs) {
|
|
8793
9327
|
if (refs.target !== "openAi") return {};
|
|
8794
9328
|
const anyDefinitionPath = [
|
|
@@ -8801,7 +9335,7 @@ function parseAnyDef(refs) {
|
|
|
8801
9335
|
}
|
|
8802
9336
|
|
|
8803
9337
|
//#endregion
|
|
8804
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9338
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
8805
9339
|
function parseArrayDef(def, refs) {
|
|
8806
9340
|
const res = { type: "array" };
|
|
8807
9341
|
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {
|
|
@@ -8818,7 +9352,7 @@ function parseArrayDef(def, refs) {
|
|
|
8818
9352
|
}
|
|
8819
9353
|
|
|
8820
9354
|
//#endregion
|
|
8821
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9355
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
8822
9356
|
function parseBigintDef(def, refs) {
|
|
8823
9357
|
const res = {
|
|
8824
9358
|
type: "integer",
|
|
@@ -8850,25 +9384,25 @@ function parseBigintDef(def, refs) {
|
|
|
8850
9384
|
}
|
|
8851
9385
|
|
|
8852
9386
|
//#endregion
|
|
8853
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9387
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
8854
9388
|
function parseBooleanDef() {
|
|
8855
9389
|
return { type: "boolean" };
|
|
8856
9390
|
}
|
|
8857
9391
|
|
|
8858
9392
|
//#endregion
|
|
8859
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9393
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
8860
9394
|
function parseBrandedDef(_def, refs) {
|
|
8861
9395
|
return parseDef(_def.type._def, refs);
|
|
8862
9396
|
}
|
|
8863
9397
|
|
|
8864
9398
|
//#endregion
|
|
8865
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9399
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
8866
9400
|
const parseCatchDef = (def, refs) => {
|
|
8867
9401
|
return parseDef(def.innerType._def, refs);
|
|
8868
9402
|
};
|
|
8869
9403
|
|
|
8870
9404
|
//#endregion
|
|
8871
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9405
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
8872
9406
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
8873
9407
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
8874
9408
|
if (Array.isArray(strategy)) return { anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)) };
|
|
@@ -8903,7 +9437,7 @@ const integerDateParser = (def, refs) => {
|
|
|
8903
9437
|
};
|
|
8904
9438
|
|
|
8905
9439
|
//#endregion
|
|
8906
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9440
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
8907
9441
|
function parseDefaultDef(_def, refs) {
|
|
8908
9442
|
return {
|
|
8909
9443
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -8912,13 +9446,13 @@ function parseDefaultDef(_def, refs) {
|
|
|
8912
9446
|
}
|
|
8913
9447
|
|
|
8914
9448
|
//#endregion
|
|
8915
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9449
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
8916
9450
|
function parseEffectsDef(_def, refs) {
|
|
8917
9451
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
8918
9452
|
}
|
|
8919
9453
|
|
|
8920
9454
|
//#endregion
|
|
8921
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9455
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
8922
9456
|
function parseEnumDef(def) {
|
|
8923
9457
|
return {
|
|
8924
9458
|
type: "string",
|
|
@@ -8927,7 +9461,7 @@ function parseEnumDef(def) {
|
|
|
8927
9461
|
}
|
|
8928
9462
|
|
|
8929
9463
|
//#endregion
|
|
8930
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9464
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
8931
9465
|
const isJsonSchema7AllOfType = (type) => {
|
|
8932
9466
|
if ("type" in type && type.type === "string") return false;
|
|
8933
9467
|
return "allOf" in type;
|
|
@@ -8970,7 +9504,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
8970
9504
|
}
|
|
8971
9505
|
|
|
8972
9506
|
//#endregion
|
|
8973
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9507
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
8974
9508
|
function parseLiteralDef(def, refs) {
|
|
8975
9509
|
const parsedType = typeof def.value;
|
|
8976
9510
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return { type: Array.isArray(def.value) ? "array" : "object" };
|
|
@@ -8985,7 +9519,7 @@ function parseLiteralDef(def, refs) {
|
|
|
8985
9519
|
}
|
|
8986
9520
|
|
|
8987
9521
|
//#endregion
|
|
8988
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9522
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
8989
9523
|
let emojiRegex = void 0;
|
|
8990
9524
|
/**
|
|
8991
9525
|
* Generated from the regular expressions found here as of 2024-05-22:
|
|
@@ -9231,7 +9765,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
9231
9765
|
}
|
|
9232
9766
|
|
|
9233
9767
|
//#endregion
|
|
9234
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9768
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
9235
9769
|
function parseRecordDef(def, refs) {
|
|
9236
9770
|
if (refs.target === "openAi") console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
9237
9771
|
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
|
|
@@ -9279,7 +9813,7 @@ function parseRecordDef(def, refs) {
|
|
|
9279
9813
|
}
|
|
9280
9814
|
|
|
9281
9815
|
//#endregion
|
|
9282
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9816
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
9283
9817
|
function parseMapDef(def, refs) {
|
|
9284
9818
|
if (refs.mapStrategy === "record") return parseRecordDef(def, refs);
|
|
9285
9819
|
return {
|
|
@@ -9311,7 +9845,7 @@ function parseMapDef(def, refs) {
|
|
|
9311
9845
|
}
|
|
9312
9846
|
|
|
9313
9847
|
//#endregion
|
|
9314
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9848
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
9315
9849
|
function parseNativeEnumDef(def) {
|
|
9316
9850
|
const object = def.values;
|
|
9317
9851
|
const actualValues = Object.keys(def.values).filter((key) => {
|
|
@@ -9325,7 +9859,7 @@ function parseNativeEnumDef(def) {
|
|
|
9325
9859
|
}
|
|
9326
9860
|
|
|
9327
9861
|
//#endregion
|
|
9328
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9862
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
9329
9863
|
function parseNeverDef(refs) {
|
|
9330
9864
|
return refs.target === "openAi" ? void 0 : { not: parseAnyDef({
|
|
9331
9865
|
...refs,
|
|
@@ -9334,7 +9868,7 @@ function parseNeverDef(refs) {
|
|
|
9334
9868
|
}
|
|
9335
9869
|
|
|
9336
9870
|
//#endregion
|
|
9337
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9871
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
9338
9872
|
function parseNullDef(refs) {
|
|
9339
9873
|
return refs.target === "openApi3" ? {
|
|
9340
9874
|
enum: ["null"],
|
|
@@ -9343,7 +9877,7 @@ function parseNullDef(refs) {
|
|
|
9343
9877
|
}
|
|
9344
9878
|
|
|
9345
9879
|
//#endregion
|
|
9346
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9880
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
9347
9881
|
const primitiveMappings = {
|
|
9348
9882
|
ZodString: "string",
|
|
9349
9883
|
ZodNumber: "number",
|
|
@@ -9400,7 +9934,7 @@ const asAnyOf = (def, refs) => {
|
|
|
9400
9934
|
};
|
|
9401
9935
|
|
|
9402
9936
|
//#endregion
|
|
9403
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9937
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
9404
9938
|
function parseNullableDef(def, refs) {
|
|
9405
9939
|
if ([
|
|
9406
9940
|
"ZodString",
|
|
@@ -9441,7 +9975,7 @@ function parseNullableDef(def, refs) {
|
|
|
9441
9975
|
}
|
|
9442
9976
|
|
|
9443
9977
|
//#endregion
|
|
9444
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9978
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
9445
9979
|
function parseNumberDef(def, refs) {
|
|
9446
9980
|
const res = { type: "number" };
|
|
9447
9981
|
if (!def.checks) return res;
|
|
@@ -9474,7 +10008,7 @@ function parseNumberDef(def, refs) {
|
|
|
9474
10008
|
}
|
|
9475
10009
|
|
|
9476
10010
|
//#endregion
|
|
9477
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10011
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
9478
10012
|
function parseObjectDef(def, refs) {
|
|
9479
10013
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
9480
10014
|
const result = {
|
|
@@ -9534,7 +10068,7 @@ function safeIsOptional(schema) {
|
|
|
9534
10068
|
}
|
|
9535
10069
|
|
|
9536
10070
|
//#endregion
|
|
9537
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10071
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
9538
10072
|
const parseOptionalDef = (def, refs) => {
|
|
9539
10073
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) return parseDef(def.innerType._def, refs);
|
|
9540
10074
|
const innerSchema = parseDef(def.innerType._def, {
|
|
@@ -9549,7 +10083,7 @@ const parseOptionalDef = (def, refs) => {
|
|
|
9549
10083
|
};
|
|
9550
10084
|
|
|
9551
10085
|
//#endregion
|
|
9552
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10086
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
9553
10087
|
const parsePipelineDef = (def, refs) => {
|
|
9554
10088
|
if (refs.pipeStrategy === "input") return parseDef(def.in._def, refs);
|
|
9555
10089
|
else if (refs.pipeStrategy === "output") return parseDef(def.out._def, refs);
|
|
@@ -9572,13 +10106,13 @@ const parsePipelineDef = (def, refs) => {
|
|
|
9572
10106
|
};
|
|
9573
10107
|
|
|
9574
10108
|
//#endregion
|
|
9575
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10109
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
9576
10110
|
function parsePromiseDef(def, refs) {
|
|
9577
10111
|
return parseDef(def.type._def, refs);
|
|
9578
10112
|
}
|
|
9579
10113
|
|
|
9580
10114
|
//#endregion
|
|
9581
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10115
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
9582
10116
|
function parseSetDef(def, refs) {
|
|
9583
10117
|
const schema = {
|
|
9584
10118
|
type: "array",
|
|
@@ -9594,7 +10128,7 @@ function parseSetDef(def, refs) {
|
|
|
9594
10128
|
}
|
|
9595
10129
|
|
|
9596
10130
|
//#endregion
|
|
9597
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10131
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
9598
10132
|
function parseTupleDef(def, refs) {
|
|
9599
10133
|
if (def.rest) return {
|
|
9600
10134
|
type: "array",
|
|
@@ -9628,25 +10162,25 @@ function parseTupleDef(def, refs) {
|
|
|
9628
10162
|
}
|
|
9629
10163
|
|
|
9630
10164
|
//#endregion
|
|
9631
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10165
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
9632
10166
|
function parseUndefinedDef(refs) {
|
|
9633
10167
|
return { not: parseAnyDef(refs) };
|
|
9634
10168
|
}
|
|
9635
10169
|
|
|
9636
10170
|
//#endregion
|
|
9637
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10171
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
9638
10172
|
function parseUnknownDef(refs) {
|
|
9639
10173
|
return parseAnyDef(refs);
|
|
9640
10174
|
}
|
|
9641
10175
|
|
|
9642
10176
|
//#endregion
|
|
9643
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10177
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
9644
10178
|
const parseReadonlyDef = (def, refs) => {
|
|
9645
10179
|
return parseDef(def.innerType._def, refs);
|
|
9646
10180
|
};
|
|
9647
10181
|
|
|
9648
10182
|
//#endregion
|
|
9649
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10183
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
9650
10184
|
const selectParser = (def, typeName, refs) => {
|
|
9651
10185
|
switch (typeName) {
|
|
9652
10186
|
case ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);
|
|
@@ -9690,7 +10224,7 @@ const selectParser = (def, typeName, refs) => {
|
|
|
9690
10224
|
};
|
|
9691
10225
|
|
|
9692
10226
|
//#endregion
|
|
9693
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10227
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
9694
10228
|
function parseDef(def, refs, forceResolution = false) {
|
|
9695
10229
|
const seenItem = refs.seen.get(def);
|
|
9696
10230
|
if (refs.override) {
|
|
@@ -9740,7 +10274,7 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
9740
10274
|
};
|
|
9741
10275
|
|
|
9742
10276
|
//#endregion
|
|
9743
|
-
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
10277
|
+
//#region ../../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
9744
10278
|
const zodToJsonSchema = (schema, options) => {
|
|
9745
10279
|
const refs = getRefs(options);
|
|
9746
10280
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
@@ -9804,7 +10338,7 @@ const zodToJsonSchema = (schema, options) => {
|
|
|
9804
10338
|
};
|
|
9805
10339
|
|
|
9806
10340
|
//#endregion
|
|
9807
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
10341
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
9808
10342
|
function mapMiniTarget(t) {
|
|
9809
10343
|
if (!t) return "draft-7";
|
|
9810
10344
|
if (t === "jsonSchema7" || t === "draft-7") return "draft-7";
|
|
@@ -9835,7 +10369,7 @@ function parseWithCompat(schema, data) {
|
|
|
9835
10369
|
}
|
|
9836
10370
|
|
|
9837
10371
|
//#endregion
|
|
9838
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
10372
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
9839
10373
|
/**
|
|
9840
10374
|
* The default request timeout, in miliseconds.
|
|
9841
10375
|
*/
|
|
@@ -10021,6 +10555,8 @@ var Protocol = class {
|
|
|
10021
10555
|
this._progressHandlers.clear();
|
|
10022
10556
|
this._taskProgressTokens.clear();
|
|
10023
10557
|
this._pendingDebouncedNotifications.clear();
|
|
10558
|
+
for (const info of this._timeoutInfo.values()) clearTimeout(info.timeoutId);
|
|
10559
|
+
this._timeoutInfo.clear();
|
|
10024
10560
|
for (const controller of this._requestHandlerAbortControllers.values()) controller.abort();
|
|
10025
10561
|
this._requestHandlerAbortControllers.clear();
|
|
10026
10562
|
const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
@@ -10124,7 +10660,7 @@ var Protocol = class {
|
|
|
10124
10660
|
}, capturedTransport?.sessionId);
|
|
10125
10661
|
else await capturedTransport?.send(errorResponse);
|
|
10126
10662
|
}).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send response: ${error}`))).finally(() => {
|
|
10127
|
-
this._requestHandlerAbortControllers.delete(request.id);
|
|
10663
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) this._requestHandlerAbortControllers.delete(request.id);
|
|
10128
10664
|
});
|
|
10129
10665
|
}
|
|
10130
10666
|
_onprogress(notification) {
|
|
@@ -10686,7 +11222,7 @@ function mergeCapabilities(base, additional) {
|
|
|
10686
11222
|
}
|
|
10687
11223
|
|
|
10688
11224
|
//#endregion
|
|
10689
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11225
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
10690
11226
|
/**
|
|
10691
11227
|
* AJV-based JSON Schema validator provider
|
|
10692
11228
|
*/
|
|
@@ -10764,7 +11300,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
10764
11300
|
};
|
|
10765
11301
|
|
|
10766
11302
|
//#endregion
|
|
10767
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11303
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
10768
11304
|
/**
|
|
10769
11305
|
* Experimental server task features for MCP SDK.
|
|
10770
11306
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -10985,7 +11521,7 @@ var ExperimentalServerTasks = class {
|
|
|
10985
11521
|
};
|
|
10986
11522
|
|
|
10987
11523
|
//#endregion
|
|
10988
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11524
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
10989
11525
|
/**
|
|
10990
11526
|
* Experimental task capability assertion helpers.
|
|
10991
11527
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -11037,7 +11573,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
11037
11573
|
}
|
|
11038
11574
|
|
|
11039
11575
|
//#endregion
|
|
11040
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11576
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
11041
11577
|
/**
|
|
11042
11578
|
* An MCP server on top of a pluggable transport.
|
|
11043
11579
|
*
|
|
@@ -11379,7 +11915,7 @@ var Server = class extends Protocol {
|
|
|
11379
11915
|
};
|
|
11380
11916
|
|
|
11381
11917
|
//#endregion
|
|
11382
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11918
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
11383
11919
|
const COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
11384
11920
|
/**
|
|
11385
11921
|
* Checks if a schema is completable (has completion metadata).
|
|
@@ -11399,7 +11935,7 @@ var McpZodTypeKind;
|
|
|
11399
11935
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
11400
11936
|
|
|
11401
11937
|
//#endregion
|
|
11402
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
11938
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
11403
11939
|
/**
|
|
11404
11940
|
* Tool name validation utilities according to SEP: Specify Format for Tool Names
|
|
11405
11941
|
*
|
|
@@ -11471,7 +12007,7 @@ function validateAndWarnToolName(name) {
|
|
|
11471
12007
|
}
|
|
11472
12008
|
|
|
11473
12009
|
//#endregion
|
|
11474
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
12010
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
11475
12011
|
/**
|
|
11476
12012
|
* Experimental McpServer task features for MCP SDK.
|
|
11477
12013
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -11503,7 +12039,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
11503
12039
|
};
|
|
11504
12040
|
|
|
11505
12041
|
//#endregion
|
|
11506
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
12042
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
11507
12043
|
/**
|
|
11508
12044
|
* High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
|
|
11509
12045
|
* For advanced usage (like sending notifications or setting custom request handlers), use the underlying
|
|
@@ -11978,7 +12514,10 @@ var McpServer = class {
|
|
|
11978
12514
|
if (isZodRawShapeCompat(firstArg)) {
|
|
11979
12515
|
inputSchema = rest.shift();
|
|
11980
12516
|
if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShapeCompat(rest[0])) annotations = rest.shift();
|
|
11981
|
-
} else if (typeof firstArg === "object" && firstArg !== null)
|
|
12517
|
+
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
12518
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
12519
|
+
annotations = rest.shift();
|
|
12520
|
+
}
|
|
11982
12521
|
}
|
|
11983
12522
|
const callback = rest[0];
|
|
11984
12523
|
return this._createRegisteredTool(name, void 0, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
|
|
@@ -12088,11 +12627,12 @@ function isZodRawShapeCompat(obj) {
|
|
|
12088
12627
|
}
|
|
12089
12628
|
/**
|
|
12090
12629
|
* Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
|
|
12091
|
-
* otherwise returns the schema as is.
|
|
12630
|
+
* otherwise returns the schema as is. Throws if the value is not a valid Zod schema.
|
|
12092
12631
|
*/
|
|
12093
12632
|
function getZodSchemaObject(schema) {
|
|
12094
12633
|
if (!schema) return;
|
|
12095
12634
|
if (isZodRawShapeCompat(schema)) return objectFromShape(schema);
|
|
12635
|
+
if (!isZodSchemaInstance(schema)) throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
12096
12636
|
return schema;
|
|
12097
12637
|
}
|
|
12098
12638
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -12126,7 +12666,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
12126
12666
|
} };
|
|
12127
12667
|
|
|
12128
12668
|
//#endregion
|
|
12129
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
12669
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
12130
12670
|
/**
|
|
12131
12671
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
12132
12672
|
*/
|
|
@@ -12154,7 +12694,7 @@ function serializeMessage(message) {
|
|
|
12154
12694
|
}
|
|
12155
12695
|
|
|
12156
12696
|
//#endregion
|
|
12157
|
-
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
12697
|
+
//#region ../../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
12158
12698
|
/**
|
|
12159
12699
|
* Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
|
|
12160
12700
|
*
|
|
@@ -12210,7 +12750,7 @@ var StdioServerTransport = class {
|
|
|
12210
12750
|
|
|
12211
12751
|
//#endregion
|
|
12212
12752
|
//#region package.json
|
|
12213
|
-
var version = "0.12.
|
|
12753
|
+
var version = "0.12.3";
|
|
12214
12754
|
|
|
12215
12755
|
//#endregion
|
|
12216
12756
|
//#region src/api-reference.ts
|