@pyreon/mcp 0.7.1 → 0.7.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 +976 -1468
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/api-reference.ts +48 -1
- package/src/index.ts +0 -1
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@
|
|
8
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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@
|
|
105
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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 = {};
|
|
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@
|
|
205
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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@
|
|
283
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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@
|
|
290
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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@
|
|
395
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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@
|
|
403
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
404
404
|
var ParseInputLazyPath = class {
|
|
405
405
|
constructor(parent, value, path, key) {
|
|
406
406
|
this._cachedPath = [];
|
|
@@ -3551,28 +3551,22 @@ const preprocessType = ZodEffects.createWithPreprocess;
|
|
|
3551
3551
|
const pipelineType = ZodPipeline.create;
|
|
3552
3552
|
|
|
3553
3553
|
//#endregion
|
|
3554
|
-
//#region ../../node_modules/.bun/zod@
|
|
3554
|
+
//#region ../../node_modules/.bun/zod@3.25.76/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
|
-
|
|
3562
|
-
constr: _,
|
|
3563
|
-
traits: /* @__PURE__ */ new Set()
|
|
3564
|
-
},
|
|
3559
|
+
var _a;
|
|
3560
|
+
Object.defineProperty(inst, "_zod", {
|
|
3561
|
+
value: inst._zod ?? {},
|
|
3565
3562
|
enumerable: false
|
|
3566
3563
|
});
|
|
3567
|
-
|
|
3564
|
+
(_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
|
|
3568
3565
|
inst._zod.traits.add(name);
|
|
3569
3566
|
initializer(inst, def);
|
|
3570
|
-
const
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
const k = keys[i];
|
|
3574
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
3575
|
-
}
|
|
3567
|
+
for (const k in _.prototype) if (!(k in inst)) Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
|
|
3568
|
+
inst._zod.constr = _;
|
|
3569
|
+
inst._zod.def = def;
|
|
3576
3570
|
}
|
|
3577
3571
|
const Parent = params?.Parent ?? Object;
|
|
3578
3572
|
class Definition extends Parent {}
|
|
@@ -3598,12 +3592,6 @@ var $ZodAsyncError = class extends Error {
|
|
|
3598
3592
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
3599
3593
|
}
|
|
3600
3594
|
};
|
|
3601
|
-
var $ZodEncodeError = class extends Error {
|
|
3602
|
-
constructor(name) {
|
|
3603
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
3604
|
-
this.name = "ZodEncodeError";
|
|
3605
|
-
}
|
|
3606
|
-
};
|
|
3607
3595
|
const globalConfig = {};
|
|
3608
3596
|
function config(newConfig) {
|
|
3609
3597
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
@@ -3611,7 +3599,7 @@ function config(newConfig) {
|
|
|
3611
3599
|
}
|
|
3612
3600
|
|
|
3613
3601
|
//#endregion
|
|
3614
|
-
//#region ../../node_modules/.bun/zod@
|
|
3602
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/util.js
|
|
3615
3603
|
function getEnumValues(entries) {
|
|
3616
3604
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
3617
3605
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -3640,26 +3628,19 @@ function cleanRegex(source) {
|
|
|
3640
3628
|
}
|
|
3641
3629
|
function floatSafeRemainder(val, step) {
|
|
3642
3630
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
3643
|
-
const
|
|
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
|
-
}
|
|
3631
|
+
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
3649
3632
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
3650
3633
|
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
3651
3634
|
}
|
|
3652
|
-
const EVALUATING = Symbol("evaluating");
|
|
3653
3635
|
function defineLazy(object, key, getter) {
|
|
3654
|
-
let value = void 0;
|
|
3655
3636
|
Object.defineProperty(object, key, {
|
|
3656
3637
|
get() {
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
value
|
|
3638
|
+
{
|
|
3639
|
+
const value = getter();
|
|
3640
|
+
object[key] = value;
|
|
3641
|
+
return value;
|
|
3661
3642
|
}
|
|
3662
|
-
|
|
3643
|
+
throw new Error("cached value already set");
|
|
3663
3644
|
},
|
|
3664
3645
|
set(v) {
|
|
3665
3646
|
Object.defineProperty(object, key, { value: v });
|
|
@@ -3675,18 +3656,10 @@ function assignProp(target, prop, value) {
|
|
|
3675
3656
|
configurable: true
|
|
3676
3657
|
});
|
|
3677
3658
|
}
|
|
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
|
-
}
|
|
3683
3659
|
function esc(str) {
|
|
3684
3660
|
return JSON.stringify(str);
|
|
3685
3661
|
}
|
|
3686
|
-
|
|
3687
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3688
|
-
}
|
|
3689
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
3662
|
+
const captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => {};
|
|
3690
3663
|
function isObject(data) {
|
|
3691
3664
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
3692
3665
|
}
|
|
@@ -3703,17 +3676,11 @@ function isPlainObject$1(o) {
|
|
|
3703
3676
|
if (isObject(o) === false) return false;
|
|
3704
3677
|
const ctor = o.constructor;
|
|
3705
3678
|
if (ctor === void 0) return true;
|
|
3706
|
-
if (typeof ctor !== "function") return true;
|
|
3707
3679
|
const prot = ctor.prototype;
|
|
3708
3680
|
if (isObject(prot) === false) return false;
|
|
3709
3681
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
3710
3682
|
return true;
|
|
3711
3683
|
}
|
|
3712
|
-
function shallowClone(o) {
|
|
3713
|
-
if (isPlainObject$1(o)) return { ...o };
|
|
3714
|
-
if (Array.isArray(o)) return [...o];
|
|
3715
|
-
return o;
|
|
3716
|
-
}
|
|
3717
3684
|
const propertyKeyTypes = new Set([
|
|
3718
3685
|
"string",
|
|
3719
3686
|
"number",
|
|
@@ -3755,70 +3722,51 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
3755
3722
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
3756
3723
|
};
|
|
3757
3724
|
function pick(schema, mask) {
|
|
3725
|
+
const newShape = {};
|
|
3758
3726
|
const currDef = schema._zod.def;
|
|
3759
|
-
const
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
newShape[key] = currDef.shape[key];
|
|
3768
|
-
}
|
|
3769
|
-
assignProp(this, "shape", newShape);
|
|
3770
|
-
return newShape;
|
|
3771
|
-
},
|
|
3727
|
+
for (const key in mask) {
|
|
3728
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3729
|
+
if (!mask[key]) continue;
|
|
3730
|
+
newShape[key] = currDef.shape[key];
|
|
3731
|
+
}
|
|
3732
|
+
return clone(schema, {
|
|
3733
|
+
...schema._zod.def,
|
|
3734
|
+
shape: newShape,
|
|
3772
3735
|
checks: []
|
|
3773
|
-
})
|
|
3736
|
+
});
|
|
3774
3737
|
}
|
|
3775
3738
|
function omit(schema, mask) {
|
|
3739
|
+
const newShape = { ...schema._zod.def.shape };
|
|
3776
3740
|
const currDef = schema._zod.def;
|
|
3777
|
-
const
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
delete newShape[key];
|
|
3786
|
-
}
|
|
3787
|
-
assignProp(this, "shape", newShape);
|
|
3788
|
-
return newShape;
|
|
3789
|
-
},
|
|
3741
|
+
for (const key in mask) {
|
|
3742
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3743
|
+
if (!mask[key]) continue;
|
|
3744
|
+
delete newShape[key];
|
|
3745
|
+
}
|
|
3746
|
+
return clone(schema, {
|
|
3747
|
+
...schema._zod.def,
|
|
3748
|
+
shape: newShape,
|
|
3790
3749
|
checks: []
|
|
3791
|
-
})
|
|
3750
|
+
});
|
|
3792
3751
|
}
|
|
3793
3752
|
function extend(schema, shape) {
|
|
3794
3753
|
if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
}
|
|
3805
|
-
|
|
3806
|
-
|
|
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
|
-
} }));
|
|
3754
|
+
return clone(schema, {
|
|
3755
|
+
...schema._zod.def,
|
|
3756
|
+
get shape() {
|
|
3757
|
+
const _shape = {
|
|
3758
|
+
...schema._zod.def.shape,
|
|
3759
|
+
...shape
|
|
3760
|
+
};
|
|
3761
|
+
assignProp(this, "shape", _shape);
|
|
3762
|
+
return _shape;
|
|
3763
|
+
},
|
|
3764
|
+
checks: []
|
|
3765
|
+
});
|
|
3819
3766
|
}
|
|
3820
3767
|
function merge(a, b) {
|
|
3821
|
-
return clone(a,
|
|
3768
|
+
return clone(a, {
|
|
3769
|
+
...a._zod.def,
|
|
3822
3770
|
get shape() {
|
|
3823
3771
|
const _shape = {
|
|
3824
3772
|
...a._zod.def.shape,
|
|
@@ -3827,59 +3775,53 @@ function merge(a, b) {
|
|
|
3827
3775
|
assignProp(this, "shape", _shape);
|
|
3828
3776
|
return _shape;
|
|
3829
3777
|
},
|
|
3830
|
-
|
|
3831
|
-
return b._zod.def.catchall;
|
|
3832
|
-
},
|
|
3778
|
+
catchall: b._zod.def.catchall,
|
|
3833
3779
|
checks: []
|
|
3834
|
-
})
|
|
3780
|
+
});
|
|
3835
3781
|
}
|
|
3836
3782
|
function partial(Class, schema, mask) {
|
|
3837
|
-
const
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
}) : oldShape[key];
|
|
3855
|
-
assignProp(this, "shape", shape);
|
|
3856
|
-
return shape;
|
|
3857
|
-
},
|
|
3783
|
+
const oldShape = schema._zod.def.shape;
|
|
3784
|
+
const shape = { ...oldShape };
|
|
3785
|
+
if (mask) for (const key in mask) {
|
|
3786
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3787
|
+
if (!mask[key]) continue;
|
|
3788
|
+
shape[key] = Class ? new Class({
|
|
3789
|
+
type: "optional",
|
|
3790
|
+
innerType: oldShape[key]
|
|
3791
|
+
}) : oldShape[key];
|
|
3792
|
+
}
|
|
3793
|
+
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
3794
|
+
type: "optional",
|
|
3795
|
+
innerType: oldShape[key]
|
|
3796
|
+
}) : oldShape[key];
|
|
3797
|
+
return clone(schema, {
|
|
3798
|
+
...schema._zod.def,
|
|
3799
|
+
shape,
|
|
3858
3800
|
checks: []
|
|
3859
|
-
})
|
|
3801
|
+
});
|
|
3860
3802
|
}
|
|
3861
3803
|
function required(Class, schema, mask) {
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
if (
|
|
3866
|
-
|
|
3867
|
-
|
|
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({
|
|
3804
|
+
const oldShape = schema._zod.def.shape;
|
|
3805
|
+
const shape = { ...oldShape };
|
|
3806
|
+
if (mask) for (const key in mask) {
|
|
3807
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
3808
|
+
if (!mask[key]) continue;
|
|
3809
|
+
shape[key] = new Class({
|
|
3874
3810
|
type: "nonoptional",
|
|
3875
3811
|
innerType: oldShape[key]
|
|
3876
3812
|
});
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3813
|
+
}
|
|
3814
|
+
else for (const key in oldShape) shape[key] = new Class({
|
|
3815
|
+
type: "nonoptional",
|
|
3816
|
+
innerType: oldShape[key]
|
|
3817
|
+
});
|
|
3818
|
+
return clone(schema, {
|
|
3819
|
+
...schema._zod.def,
|
|
3820
|
+
shape,
|
|
3821
|
+
checks: []
|
|
3822
|
+
});
|
|
3880
3823
|
}
|
|
3881
3824
|
function aborted(x, startIndex = 0) {
|
|
3882
|
-
if (x.aborted === true) return true;
|
|
3883
3825
|
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
3884
3826
|
return false;
|
|
3885
3827
|
}
|
|
@@ -3922,7 +3864,7 @@ function issue(...args) {
|
|
|
3922
3864
|
}
|
|
3923
3865
|
|
|
3924
3866
|
//#endregion
|
|
3925
|
-
//#region ../../node_modules/.bun/zod@
|
|
3867
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/errors.js
|
|
3926
3868
|
const initializer$1 = (inst, def) => {
|
|
3927
3869
|
inst.name = "$ZodError";
|
|
3928
3870
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -3933,7 +3875,12 @@ const initializer$1 = (inst, def) => {
|
|
|
3933
3875
|
value: def,
|
|
3934
3876
|
enumerable: false
|
|
3935
3877
|
});
|
|
3936
|
-
|
|
3878
|
+
Object.defineProperty(inst, "message", {
|
|
3879
|
+
get() {
|
|
3880
|
+
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
3881
|
+
},
|
|
3882
|
+
enumerable: true
|
|
3883
|
+
});
|
|
3937
3884
|
Object.defineProperty(inst, "toString", {
|
|
3938
3885
|
value: () => inst.message,
|
|
3939
3886
|
enumerable: false
|
|
@@ -3953,7 +3900,10 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
3953
3900
|
fieldErrors
|
|
3954
3901
|
};
|
|
3955
3902
|
}
|
|
3956
|
-
function formatError(error,
|
|
3903
|
+
function formatError(error, _mapper) {
|
|
3904
|
+
const mapper = _mapper || function(issue) {
|
|
3905
|
+
return issue.message;
|
|
3906
|
+
};
|
|
3957
3907
|
const fieldErrors = { _errors: [] };
|
|
3958
3908
|
const processError = (error) => {
|
|
3959
3909
|
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
@@ -3980,7 +3930,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
3980
3930
|
}
|
|
3981
3931
|
|
|
3982
3932
|
//#endregion
|
|
3983
|
-
//#region ../../node_modules/.bun/zod@
|
|
3933
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/parse.js
|
|
3984
3934
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
3985
3935
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
3986
3936
|
const result = schema._zod.run({
|
|
@@ -4046,45 +3996,9 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
4046
3996
|
};
|
|
4047
3997
|
};
|
|
4048
3998
|
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);
|
|
4085
3999
|
|
|
4086
4000
|
//#endregion
|
|
4087
|
-
//#region ../../node_modules/.bun/zod@
|
|
4001
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/regexes.js
|
|
4088
4002
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
4089
4003
|
const cuid2 = /^[0-9a-z]+$/;
|
|
4090
4004
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -4095,11 +4009,11 @@ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
|
4095
4009
|
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)?)?)$/;
|
|
4096
4010
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
4097
4011
|
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})$/;
|
|
4098
|
-
/** Returns a regex for validating an RFC
|
|
4012
|
+
/** Returns a regex for validating an RFC 4122 UUID.
|
|
4099
4013
|
*
|
|
4100
4014
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
4101
4015
|
const uuid = (version) => {
|
|
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
|
|
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)$/;
|
|
4103
4017
|
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})$`);
|
|
4104
4018
|
};
|
|
4105
4019
|
/** Practical email validation */
|
|
@@ -4109,12 +4023,13 @@ function emoji() {
|
|
|
4109
4023
|
return new RegExp(_emoji$1, "u");
|
|
4110
4024
|
}
|
|
4111
4025
|
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])$/;
|
|
4112
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
4026
|
+
const ipv6 = /^(([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})$/;
|
|
4113
4027
|
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])$/;
|
|
4114
4028
|
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])$/;
|
|
4115
4029
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
4116
4030
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
4117
|
-
const
|
|
4031
|
+
const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
4032
|
+
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
4118
4033
|
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])))`;
|
|
4119
4034
|
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
4120
4035
|
function timeSource(args) {
|
|
@@ -4128,7 +4043,7 @@ function datetime$1(args) {
|
|
|
4128
4043
|
const time = timeSource({ precision: args.precision });
|
|
4129
4044
|
const opts = ["Z"];
|
|
4130
4045
|
if (args.local) opts.push("");
|
|
4131
|
-
if (args.offset) opts.push(`([+-]
|
|
4046
|
+
if (args.offset) opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
4132
4047
|
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
4133
4048
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
4134
4049
|
}
|
|
@@ -4136,15 +4051,15 @@ const string$1 = (params) => {
|
|
|
4136
4051
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
4137
4052
|
return new RegExp(`^${regex}$`);
|
|
4138
4053
|
};
|
|
4139
|
-
const integer =
|
|
4140
|
-
const number$1 = /^-?\d+(?:\.\d+)
|
|
4141
|
-
const boolean$1 =
|
|
4142
|
-
const _null$2 =
|
|
4054
|
+
const integer = /^\d+$/;
|
|
4055
|
+
const number$1 = /^-?\d+(?:\.\d+)?/i;
|
|
4056
|
+
const boolean$1 = /true|false/i;
|
|
4057
|
+
const _null$2 = /null/i;
|
|
4143
4058
|
const lowercase = /^[^A-Z]*$/;
|
|
4144
4059
|
const uppercase = /^[^a-z]*$/;
|
|
4145
4060
|
|
|
4146
4061
|
//#endregion
|
|
4147
|
-
//#region ../../node_modules/.bun/zod@
|
|
4062
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/checks.js
|
|
4148
4063
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
4149
4064
|
var _a;
|
|
4150
4065
|
inst._zod ?? (inst._zod = {});
|
|
@@ -4170,7 +4085,7 @@ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (ins
|
|
|
4170
4085
|
payload.issues.push({
|
|
4171
4086
|
origin,
|
|
4172
4087
|
code: "too_big",
|
|
4173
|
-
maximum:
|
|
4088
|
+
maximum: def.value,
|
|
4174
4089
|
input: payload.value,
|
|
4175
4090
|
inclusive: def.inclusive,
|
|
4176
4091
|
inst,
|
|
@@ -4192,7 +4107,7 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
|
|
|
4192
4107
|
payload.issues.push({
|
|
4193
4108
|
origin,
|
|
4194
4109
|
code: "too_small",
|
|
4195
|
-
minimum:
|
|
4110
|
+
minimum: def.value,
|
|
4196
4111
|
input: payload.value,
|
|
4197
4112
|
inclusive: def.inclusive,
|
|
4198
4113
|
inst,
|
|
@@ -4240,7 +4155,6 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4240
4155
|
expected: origin,
|
|
4241
4156
|
format: def.format,
|
|
4242
4157
|
code: "invalid_type",
|
|
4243
|
-
continue: false,
|
|
4244
4158
|
input,
|
|
4245
4159
|
inst
|
|
4246
4160
|
});
|
|
@@ -4254,7 +4168,6 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4254
4168
|
note: "Integers must be within the safe integer range.",
|
|
4255
4169
|
inst,
|
|
4256
4170
|
origin,
|
|
4257
|
-
inclusive: true,
|
|
4258
4171
|
continue: !def.abort
|
|
4259
4172
|
});
|
|
4260
4173
|
else payload.issues.push({
|
|
@@ -4264,7 +4177,6 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4264
4177
|
note: "Integers must be within the safe integer range.",
|
|
4265
4178
|
inst,
|
|
4266
4179
|
origin,
|
|
4267
|
-
inclusive: true,
|
|
4268
4180
|
continue: !def.abort
|
|
4269
4181
|
});
|
|
4270
4182
|
return;
|
|
@@ -4284,9 +4196,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
|
|
|
4284
4196
|
input,
|
|
4285
4197
|
code: "too_big",
|
|
4286
4198
|
maximum,
|
|
4287
|
-
|
|
4288
|
-
inst,
|
|
4289
|
-
continue: !def.abort
|
|
4199
|
+
inst
|
|
4290
4200
|
});
|
|
4291
4201
|
};
|
|
4292
4202
|
});
|
|
@@ -4503,7 +4413,7 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
|
|
|
4503
4413
|
});
|
|
4504
4414
|
|
|
4505
4415
|
//#endregion
|
|
4506
|
-
//#region ../../node_modules/.bun/zod@
|
|
4416
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/doc.js
|
|
4507
4417
|
var Doc = class {
|
|
4508
4418
|
constructor(args = []) {
|
|
4509
4419
|
this.content = [];
|
|
@@ -4535,15 +4445,15 @@ var Doc = class {
|
|
|
4535
4445
|
};
|
|
4536
4446
|
|
|
4537
4447
|
//#endregion
|
|
4538
|
-
//#region ../../node_modules/.bun/zod@
|
|
4448
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/versions.js
|
|
4539
4449
|
const version$1 = {
|
|
4540
4450
|
major: 4,
|
|
4541
|
-
minor:
|
|
4542
|
-
patch:
|
|
4451
|
+
minor: 0,
|
|
4452
|
+
patch: 0
|
|
4543
4453
|
};
|
|
4544
4454
|
|
|
4545
4455
|
//#endregion
|
|
4546
|
-
//#region ../../node_modules/.bun/zod@
|
|
4456
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/schemas.js
|
|
4547
4457
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
4548
4458
|
var _a;
|
|
4549
4459
|
inst ?? (inst = {});
|
|
@@ -4584,33 +4494,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4584
4494
|
});
|
|
4585
4495
|
return payload;
|
|
4586
4496
|
};
|
|
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
|
-
};
|
|
4599
4497
|
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
|
-
}
|
|
4614
4498
|
const result = inst._zod.parse(payload, ctx);
|
|
4615
4499
|
if (result instanceof Promise) {
|
|
4616
4500
|
if (ctx.async === false) throw new $ZodAsyncError();
|
|
@@ -4619,7 +4503,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4619
4503
|
return runChecks(result, checks, ctx);
|
|
4620
4504
|
};
|
|
4621
4505
|
}
|
|
4622
|
-
|
|
4506
|
+
inst["~standard"] = {
|
|
4623
4507
|
validate: (value) => {
|
|
4624
4508
|
try {
|
|
4625
4509
|
const r = safeParse$2(inst, value);
|
|
@@ -4630,7 +4514,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
4630
4514
|
},
|
|
4631
4515
|
vendor: "zod",
|
|
4632
4516
|
version: 1
|
|
4633
|
-
}
|
|
4517
|
+
};
|
|
4634
4518
|
});
|
|
4635
4519
|
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
4636
4520
|
$ZodType.init(inst, def);
|
|
@@ -4682,15 +4566,16 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
4682
4566
|
$ZodStringFormat.init(inst, def);
|
|
4683
4567
|
inst._zod.check = (payload) => {
|
|
4684
4568
|
try {
|
|
4685
|
-
const
|
|
4686
|
-
const url = new URL(
|
|
4569
|
+
const orig = payload.value;
|
|
4570
|
+
const url = new URL(orig);
|
|
4571
|
+
const href = url.href;
|
|
4687
4572
|
if (def.hostname) {
|
|
4688
4573
|
def.hostname.lastIndex = 0;
|
|
4689
4574
|
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
4690
4575
|
code: "invalid_format",
|
|
4691
4576
|
format: "url",
|
|
4692
4577
|
note: "Invalid hostname",
|
|
4693
|
-
pattern:
|
|
4578
|
+
pattern: hostname.source,
|
|
4694
4579
|
input: payload.value,
|
|
4695
4580
|
inst,
|
|
4696
4581
|
continue: !def.abort
|
|
@@ -4708,8 +4593,8 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
4708
4593
|
continue: !def.abort
|
|
4709
4594
|
});
|
|
4710
4595
|
}
|
|
4711
|
-
if (
|
|
4712
|
-
else payload.value =
|
|
4596
|
+
if (!orig.endsWith("/") && href.endsWith("/")) payload.value = href.slice(0, -1);
|
|
4597
|
+
else payload.value = href;
|
|
4713
4598
|
return;
|
|
4714
4599
|
} catch (_) {
|
|
4715
4600
|
payload.issues.push({
|
|
@@ -4769,12 +4654,18 @@ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, d
|
|
|
4769
4654
|
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
4770
4655
|
def.pattern ?? (def.pattern = ipv4);
|
|
4771
4656
|
$ZodStringFormat.init(inst, def);
|
|
4772
|
-
inst._zod.
|
|
4657
|
+
inst._zod.onattach.push((inst) => {
|
|
4658
|
+
const bag = inst._zod.bag;
|
|
4659
|
+
bag.format = `ipv4`;
|
|
4660
|
+
});
|
|
4773
4661
|
});
|
|
4774
4662
|
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
4775
4663
|
def.pattern ?? (def.pattern = ipv6);
|
|
4776
4664
|
$ZodStringFormat.init(inst, def);
|
|
4777
|
-
inst._zod.
|
|
4665
|
+
inst._zod.onattach.push((inst) => {
|
|
4666
|
+
const bag = inst._zod.bag;
|
|
4667
|
+
bag.format = `ipv6`;
|
|
4668
|
+
});
|
|
4778
4669
|
inst._zod.check = (payload) => {
|
|
4779
4670
|
try {
|
|
4780
4671
|
new URL(`http://[${payload.value}]`);
|
|
@@ -4797,10 +4688,8 @@ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
4797
4688
|
def.pattern ?? (def.pattern = cidrv6);
|
|
4798
4689
|
$ZodStringFormat.init(inst, def);
|
|
4799
4690
|
inst._zod.check = (payload) => {
|
|
4800
|
-
const
|
|
4691
|
+
const [address, prefix] = payload.value.split("/");
|
|
4801
4692
|
try {
|
|
4802
|
-
if (parts.length !== 2) throw new Error();
|
|
4803
|
-
const [address, prefix] = parts;
|
|
4804
4693
|
if (!prefix) throw new Error();
|
|
4805
4694
|
const prefixNum = Number(prefix);
|
|
4806
4695
|
if (`${prefixNum}` !== prefix) throw new Error();
|
|
@@ -4830,7 +4719,9 @@ function isValidBase64(data) {
|
|
|
4830
4719
|
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
4831
4720
|
def.pattern ?? (def.pattern = base64);
|
|
4832
4721
|
$ZodStringFormat.init(inst, def);
|
|
4833
|
-
inst._zod.
|
|
4722
|
+
inst._zod.onattach.push((inst) => {
|
|
4723
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
4724
|
+
});
|
|
4834
4725
|
inst._zod.check = (payload) => {
|
|
4835
4726
|
if (isValidBase64(payload.value)) return;
|
|
4836
4727
|
payload.issues.push({
|
|
@@ -4850,7 +4741,9 @@ function isValidBase64URL(data) {
|
|
|
4850
4741
|
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
4851
4742
|
def.pattern ?? (def.pattern = base64url);
|
|
4852
4743
|
$ZodStringFormat.init(inst, def);
|
|
4853
|
-
inst._zod.
|
|
4744
|
+
inst._zod.onattach.push((inst) => {
|
|
4745
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
4746
|
+
});
|
|
4854
4747
|
inst._zod.check = (payload) => {
|
|
4855
4748
|
if (isValidBase64URL(payload.value)) return;
|
|
4856
4749
|
payload.issues.push({
|
|
@@ -4914,7 +4807,7 @@ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
4914
4807
|
return payload;
|
|
4915
4808
|
};
|
|
4916
4809
|
});
|
|
4917
|
-
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
4810
|
+
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
4918
4811
|
$ZodCheckNumberFormat.init(inst, def);
|
|
4919
4812
|
$ZodNumber.init(inst, def);
|
|
4920
4813
|
});
|
|
@@ -5000,68 +4893,32 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
5000
4893
|
return payload;
|
|
5001
4894
|
};
|
|
5002
4895
|
});
|
|
5003
|
-
function
|
|
5004
|
-
if (result.issues.length)
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
if (result.
|
|
4896
|
+
function handleObjectResult(result, final, key) {
|
|
4897
|
+
if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
|
|
4898
|
+
final.value[key] = result.value;
|
|
4899
|
+
}
|
|
4900
|
+
function handleOptionalObjectResult(result, final, key, input) {
|
|
4901
|
+
if (result.issues.length) if (input[key] === void 0) if (key in input) final.value[key] = void 0;
|
|
4902
|
+
else final.value[key] = result.value;
|
|
4903
|
+
else final.issues.push(...prefixIssues(key, result.issues));
|
|
4904
|
+
else if (result.value === void 0) {
|
|
5009
4905
|
if (key in input) final.value[key] = void 0;
|
|
5010
4906
|
} else final.value[key] = result.value;
|
|
5011
4907
|
}
|
|
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
|
-
}
|
|
5054
4908
|
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
5055
4909
|
$ZodType.init(inst, def);
|
|
5056
|
-
|
|
5057
|
-
const
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
4910
|
+
const _normalized = cached(() => {
|
|
4911
|
+
const keys = Object.keys(def.shape);
|
|
4912
|
+
for (const k of keys) if (!(def.shape[k] instanceof $ZodType)) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
4913
|
+
const okeys = optionalKeys(def.shape);
|
|
4914
|
+
return {
|
|
4915
|
+
shape: def.shape,
|
|
4916
|
+
keys,
|
|
4917
|
+
keySet: new Set(keys),
|
|
4918
|
+
numKeys: keys.length,
|
|
4919
|
+
optionalKeys: new Set(okeys)
|
|
4920
|
+
};
|
|
4921
|
+
});
|
|
5065
4922
|
defineLazy(inst._zod, "propValues", () => {
|
|
5066
4923
|
const shape = def.shape;
|
|
5067
4924
|
const propValues = {};
|
|
@@ -5074,42 +4931,6 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
5074
4931
|
}
|
|
5075
4932
|
return propValues;
|
|
5076
4933
|
});
|
|
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));
|
|
5113
4934
|
const generateFastpass = (shape) => {
|
|
5114
4935
|
const doc = new Doc([
|
|
5115
4936
|
"shape",
|
|
@@ -5125,48 +4946,40 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5125
4946
|
const ids = Object.create(null);
|
|
5126
4947
|
let counter = 0;
|
|
5127
4948
|
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
5128
|
-
doc.write(`const newResult = {}
|
|
5129
|
-
for (const key of normalized.keys) {
|
|
4949
|
+
doc.write(`const newResult = {}`);
|
|
4950
|
+
for (const key of normalized.keys) if (normalized.optionalKeys.has(key)) {
|
|
5130
4951
|
const id = ids[key];
|
|
5131
|
-
const k = esc(key);
|
|
5132
|
-
const isOptionalOut = shape[key]?._zod?.optout === "optional";
|
|
5133
4952
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
5134
|
-
|
|
4953
|
+
const k = esc(key);
|
|
4954
|
+
doc.write(`
|
|
5135
4955
|
if (${id}.issues.length) {
|
|
5136
|
-
if (${k}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
4956
|
+
if (input[${k}] === undefined) {
|
|
4957
|
+
if (${k} in input) {
|
|
4958
|
+
newResult[${k}] = undefined;
|
|
4959
|
+
}
|
|
4960
|
+
} else {
|
|
4961
|
+
payload.issues = payload.issues.concat(
|
|
4962
|
+
${id}.issues.map((iss) => ({
|
|
4963
|
+
...iss,
|
|
4964
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}],
|
|
4965
|
+
}))
|
|
4966
|
+
);
|
|
5147
4967
|
}
|
|
4968
|
+
} else if (${id}.value === undefined) {
|
|
4969
|
+
if (${k} in input) newResult[${k}] = undefined;
|
|
5148
4970
|
} else {
|
|
5149
4971
|
newResult[${k}] = ${id}.value;
|
|
5150
4972
|
}
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
4973
|
+
`);
|
|
4974
|
+
} else {
|
|
4975
|
+
const id = ids[key];
|
|
4976
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
4977
|
+
doc.write(`
|
|
4978
|
+
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5156
4979
|
...iss,
|
|
5157
|
-
path: iss.path ? [${
|
|
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
|
-
`);
|
|
4980
|
+
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
4981
|
+
})));`);
|
|
4982
|
+
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
5170
4983
|
}
|
|
5171
4984
|
doc.write(`payload.value = newResult;`);
|
|
5172
4985
|
doc.write(`return payload;`);
|
|
@@ -5192,13 +5005,53 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
5192
5005
|
});
|
|
5193
5006
|
return payload;
|
|
5194
5007
|
}
|
|
5008
|
+
const proms = [];
|
|
5195
5009
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
5196
5010
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
5197
5011
|
payload = fastpass(payload, ctx);
|
|
5198
|
-
|
|
5199
|
-
|
|
5012
|
+
} else {
|
|
5013
|
+
payload.value = {};
|
|
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
|
+
}
|
|
5026
|
+
}
|
|
5027
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
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);
|
|
5200
5044
|
}
|
|
5201
|
-
|
|
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
|
+
});
|
|
5202
5055
|
};
|
|
5203
5056
|
});
|
|
5204
5057
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -5206,11 +5059,6 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
5206
5059
|
final.value = result.value;
|
|
5207
5060
|
return final;
|
|
5208
5061
|
}
|
|
5209
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
5210
|
-
if (nonaborted.length === 1) {
|
|
5211
|
-
final.value = nonaborted[0].value;
|
|
5212
|
-
return nonaborted[0];
|
|
5213
|
-
}
|
|
5214
5062
|
final.issues.push({
|
|
5215
5063
|
code: "invalid_union",
|
|
5216
5064
|
input: final.value,
|
|
@@ -5232,10 +5080,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5232
5080
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
5233
5081
|
}
|
|
5234
5082
|
});
|
|
5235
|
-
const single = def.options.length === 1;
|
|
5236
|
-
const first = def.options[0]._zod.run;
|
|
5237
5083
|
inst._zod.parse = (payload, ctx) => {
|
|
5238
|
-
if (single) return first(payload, ctx);
|
|
5239
5084
|
let async = false;
|
|
5240
5085
|
const results = [];
|
|
5241
5086
|
for (const option of def.options) {
|
|
@@ -5258,7 +5103,6 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
5258
5103
|
};
|
|
5259
5104
|
});
|
|
5260
5105
|
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
5261
|
-
def.inclusive = false;
|
|
5262
5106
|
$ZodUnion.init(inst, def);
|
|
5263
5107
|
const _super = inst._zod.parse;
|
|
5264
5108
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -5277,7 +5121,7 @@ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUn
|
|
|
5277
5121
|
const opts = def.options;
|
|
5278
5122
|
const map = /* @__PURE__ */ new Map();
|
|
5279
5123
|
for (const o of opts) {
|
|
5280
|
-
const values = o._zod.propValues
|
|
5124
|
+
const values = o._zod.propValues[def.discriminator];
|
|
5281
5125
|
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
5282
5126
|
for (const v of values) {
|
|
5283
5127
|
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
@@ -5304,7 +5148,6 @@ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUn
|
|
|
5304
5148
|
code: "invalid_union",
|
|
5305
5149
|
errors: [],
|
|
5306
5150
|
note: "No matching discriminator",
|
|
5307
|
-
discriminator: def.discriminator,
|
|
5308
5151
|
input,
|
|
5309
5152
|
path: [def.discriminator],
|
|
5310
5153
|
inst
|
|
@@ -5386,25 +5229,8 @@ function mergeValues(a, b) {
|
|
|
5386
5229
|
};
|
|
5387
5230
|
}
|
|
5388
5231
|
function handleIntersectionResults(result, left, right) {
|
|
5389
|
-
|
|
5390
|
-
|
|
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
|
-
});
|
|
5232
|
+
if (left.issues.length) result.issues.push(...left.issues);
|
|
5233
|
+
if (right.issues.length) result.issues.push(...right.issues);
|
|
5408
5234
|
if (aborted(result)) return result;
|
|
5409
5235
|
const merged = mergeValues(left.value, right.value);
|
|
5410
5236
|
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
@@ -5425,12 +5251,10 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5425
5251
|
return payload;
|
|
5426
5252
|
}
|
|
5427
5253
|
const proms = [];
|
|
5428
|
-
|
|
5429
|
-
|
|
5254
|
+
if (def.keyType._zod.values) {
|
|
5255
|
+
const values = def.keyType._zod.values;
|
|
5430
5256
|
payload.value = {};
|
|
5431
|
-
const recordKeys = /* @__PURE__ */ new Set();
|
|
5432
5257
|
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
5433
|
-
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
5434
5258
|
const result = def.valueType._zod.run({
|
|
5435
5259
|
value: input[key],
|
|
5436
5260
|
issues: []
|
|
@@ -5445,7 +5269,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5445
5269
|
}
|
|
5446
5270
|
}
|
|
5447
5271
|
let unrecognized;
|
|
5448
|
-
for (const key in input) if (!
|
|
5272
|
+
for (const key in input) if (!values.has(key)) {
|
|
5449
5273
|
unrecognized = unrecognized ?? [];
|
|
5450
5274
|
unrecognized.push(key);
|
|
5451
5275
|
}
|
|
@@ -5459,29 +5283,21 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5459
5283
|
payload.value = {};
|
|
5460
5284
|
for (const key of Reflect.ownKeys(input)) {
|
|
5461
5285
|
if (key === "__proto__") continue;
|
|
5462
|
-
|
|
5286
|
+
const keyResult = def.keyType._zod.run({
|
|
5463
5287
|
value: key,
|
|
5464
5288
|
issues: []
|
|
5465
5289
|
}, ctx);
|
|
5466
5290
|
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
|
-
}
|
|
5475
5291
|
if (keyResult.issues.length) {
|
|
5476
|
-
|
|
5477
|
-
else payload.issues.push({
|
|
5478
|
-
code: "invalid_key",
|
|
5292
|
+
payload.issues.push({
|
|
5479
5293
|
origin: "record",
|
|
5294
|
+
code: "invalid_key",
|
|
5480
5295
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
5481
5296
|
input: key,
|
|
5482
5297
|
path: [key],
|
|
5483
5298
|
inst
|
|
5484
5299
|
});
|
|
5300
|
+
payload.value[keyResult.value] = keyResult.value;
|
|
5485
5301
|
continue;
|
|
5486
5302
|
}
|
|
5487
5303
|
const result = def.valueType._zod.run({
|
|
@@ -5505,12 +5321,11 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
5505
5321
|
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
5506
5322
|
$ZodType.init(inst, def);
|
|
5507
5323
|
const values = getEnumValues(def.entries);
|
|
5508
|
-
|
|
5509
|
-
inst._zod.values = valuesSet;
|
|
5324
|
+
inst._zod.values = new Set(values);
|
|
5510
5325
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
5511
5326
|
inst._zod.parse = (payload, _ctx) => {
|
|
5512
5327
|
const input = payload.value;
|
|
5513
|
-
if (
|
|
5328
|
+
if (inst._zod.values.has(input)) return payload;
|
|
5514
5329
|
payload.issues.push({
|
|
5515
5330
|
code: "invalid_value",
|
|
5516
5331
|
values,
|
|
@@ -5522,13 +5337,11 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
5522
5337
|
});
|
|
5523
5338
|
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
5524
5339
|
$ZodType.init(inst, def);
|
|
5525
|
-
|
|
5526
|
-
|
|
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("|")})$`);
|
|
5340
|
+
inst._zod.values = new Set(def.values);
|
|
5341
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
|
|
5529
5342
|
inst._zod.parse = (payload, _ctx) => {
|
|
5530
5343
|
const input = payload.value;
|
|
5531
|
-
if (values.has(input)) return payload;
|
|
5344
|
+
if (inst._zod.values.has(input)) return payload;
|
|
5532
5345
|
payload.issues.push({
|
|
5533
5346
|
code: "invalid_value",
|
|
5534
5347
|
values: def.values,
|
|
@@ -5540,10 +5353,9 @@ const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
5540
5353
|
});
|
|
5541
5354
|
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
5542
5355
|
$ZodType.init(inst, def);
|
|
5543
|
-
inst._zod.parse = (payload,
|
|
5544
|
-
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
5356
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
5545
5357
|
const _out = def.transform(payload.value, payload);
|
|
5546
|
-
if (
|
|
5358
|
+
if (_ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
5547
5359
|
payload.value = output;
|
|
5548
5360
|
return payload;
|
|
5549
5361
|
});
|
|
@@ -5552,13 +5364,6 @@ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def)
|
|
|
5552
5364
|
return payload;
|
|
5553
5365
|
};
|
|
5554
5366
|
});
|
|
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
|
-
}
|
|
5562
5367
|
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
5563
5368
|
$ZodType.init(inst, def);
|
|
5564
5369
|
inst._zod.optin = "optional";
|
|
@@ -5571,23 +5376,11 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
5571
5376
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
5572
5377
|
});
|
|
5573
5378
|
inst._zod.parse = (payload, ctx) => {
|
|
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
|
-
}
|
|
5379
|
+
if (def.innerType._zod.optin === "optional") return def.innerType._zod.run(payload, ctx);
|
|
5579
5380
|
if (payload.value === void 0) return payload;
|
|
5580
5381
|
return def.innerType._zod.run(payload, ctx);
|
|
5581
5382
|
};
|
|
5582
5383
|
});
|
|
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
|
-
});
|
|
5591
5384
|
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
5592
5385
|
$ZodType.init(inst, def);
|
|
5593
5386
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -5609,11 +5402,10 @@ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
5609
5402
|
inst._zod.optin = "optional";
|
|
5610
5403
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5611
5404
|
inst._zod.parse = (payload, ctx) => {
|
|
5612
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5613
5405
|
if (payload.value === void 0) {
|
|
5614
5406
|
payload.value = def.defaultValue;
|
|
5615
5407
|
/**
|
|
5616
|
-
* $ZodDefault returns the default value immediately
|
|
5408
|
+
* $ZodDefault always returns the default value immediately.
|
|
5617
5409
|
* 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. */
|
|
5618
5410
|
return payload;
|
|
5619
5411
|
}
|
|
@@ -5631,7 +5423,6 @@ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) =>
|
|
|
5631
5423
|
inst._zod.optin = "optional";
|
|
5632
5424
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5633
5425
|
inst._zod.parse = (payload, ctx) => {
|
|
5634
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5635
5426
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
5636
5427
|
return def.innerType._zod.run(payload, ctx);
|
|
5637
5428
|
};
|
|
@@ -5659,11 +5450,10 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
5659
5450
|
}
|
|
5660
5451
|
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
5661
5452
|
$ZodType.init(inst, def);
|
|
5662
|
-
|
|
5453
|
+
inst._zod.optin = "optional";
|
|
5663
5454
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
5664
5455
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5665
5456
|
inst._zod.parse = (payload, ctx) => {
|
|
5666
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5667
5457
|
const result = def.innerType._zod.run(payload, ctx);
|
|
5668
5458
|
if (result instanceof Promise) return result.then((result) => {
|
|
5669
5459
|
payload.value = result.value;
|
|
@@ -5694,24 +5484,15 @@ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
5694
5484
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
5695
5485
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
5696
5486
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
5697
|
-
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
5698
5487
|
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
|
-
}
|
|
5704
5488
|
const left = def.in._zod.run(payload, ctx);
|
|
5705
|
-
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def
|
|
5706
|
-
return handlePipeResult(left, def
|
|
5489
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def, ctx));
|
|
5490
|
+
return handlePipeResult(left, def, ctx);
|
|
5707
5491
|
};
|
|
5708
5492
|
});
|
|
5709
|
-
function handlePipeResult(left,
|
|
5710
|
-
if (left
|
|
5711
|
-
|
|
5712
|
-
return left;
|
|
5713
|
-
}
|
|
5714
|
-
return next._zod.run({
|
|
5493
|
+
function handlePipeResult(left, def, ctx) {
|
|
5494
|
+
if (aborted(left)) return left;
|
|
5495
|
+
return def.out._zod.run({
|
|
5715
5496
|
value: left.value,
|
|
5716
5497
|
issues: left.issues
|
|
5717
5498
|
}, ctx);
|
|
@@ -5720,10 +5501,9 @@ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) =>
|
|
|
5720
5501
|
$ZodType.init(inst, def);
|
|
5721
5502
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
5722
5503
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5723
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
5724
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
5504
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
5505
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
5725
5506
|
inst._zod.parse = (payload, ctx) => {
|
|
5726
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5727
5507
|
const result = def.innerType._zod.run(payload, ctx);
|
|
5728
5508
|
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
5729
5509
|
return handleReadonlyResult(result);
|
|
@@ -5761,21 +5541,23 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
5761
5541
|
}
|
|
5762
5542
|
|
|
5763
5543
|
//#endregion
|
|
5764
|
-
//#region ../../node_modules/.bun/zod@
|
|
5765
|
-
var _a;
|
|
5544
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/registries.js
|
|
5766
5545
|
var $ZodRegistry = class {
|
|
5767
5546
|
constructor() {
|
|
5768
|
-
this._map = /* @__PURE__ */ new
|
|
5547
|
+
this._map = /* @__PURE__ */ new Map();
|
|
5769
5548
|
this._idmap = /* @__PURE__ */ new Map();
|
|
5770
5549
|
}
|
|
5771
5550
|
add(schema, ..._meta) {
|
|
5772
5551
|
const meta = _meta[0];
|
|
5773
5552
|
this._map.set(schema, meta);
|
|
5774
|
-
if (meta && typeof meta === "object" && "id" in 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
|
+
}
|
|
5775
5557
|
return this;
|
|
5776
5558
|
}
|
|
5777
5559
|
clear() {
|
|
5778
|
-
this._map = /* @__PURE__ */ new
|
|
5560
|
+
this._map = /* @__PURE__ */ new Map();
|
|
5779
5561
|
this._idmap = /* @__PURE__ */ new Map();
|
|
5780
5562
|
return this;
|
|
5781
5563
|
}
|
|
@@ -5790,11 +5572,10 @@ var $ZodRegistry = class {
|
|
|
5790
5572
|
if (p) {
|
|
5791
5573
|
const pm = { ...this.get(p) ?? {} };
|
|
5792
5574
|
delete pm.id;
|
|
5793
|
-
|
|
5575
|
+
return {
|
|
5794
5576
|
...pm,
|
|
5795
5577
|
...this._map.get(schema)
|
|
5796
5578
|
};
|
|
5797
|
-
return Object.keys(f).length ? f : void 0;
|
|
5798
5579
|
}
|
|
5799
5580
|
return this._map.get(schema);
|
|
5800
5581
|
}
|
|
@@ -5805,19 +5586,16 @@ var $ZodRegistry = class {
|
|
|
5805
5586
|
function registry() {
|
|
5806
5587
|
return new $ZodRegistry();
|
|
5807
5588
|
}
|
|
5808
|
-
|
|
5809
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
5589
|
+
const globalRegistry = /* @__PURE__ */ registry();
|
|
5810
5590
|
|
|
5811
5591
|
//#endregion
|
|
5812
|
-
//#region ../../node_modules/.bun/zod@
|
|
5813
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5592
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/api.js
|
|
5814
5593
|
function _string(Class, params) {
|
|
5815
5594
|
return new Class({
|
|
5816
5595
|
type: "string",
|
|
5817
5596
|
...normalizeParams(params)
|
|
5818
5597
|
});
|
|
5819
5598
|
}
|
|
5820
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5821
5599
|
function _email(Class, params) {
|
|
5822
5600
|
return new Class({
|
|
5823
5601
|
type: "string",
|
|
@@ -5827,7 +5605,6 @@ function _email(Class, params) {
|
|
|
5827
5605
|
...normalizeParams(params)
|
|
5828
5606
|
});
|
|
5829
5607
|
}
|
|
5830
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5831
5608
|
function _guid(Class, params) {
|
|
5832
5609
|
return new Class({
|
|
5833
5610
|
type: "string",
|
|
@@ -5837,7 +5614,6 @@ function _guid(Class, params) {
|
|
|
5837
5614
|
...normalizeParams(params)
|
|
5838
5615
|
});
|
|
5839
5616
|
}
|
|
5840
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5841
5617
|
function _uuid(Class, params) {
|
|
5842
5618
|
return new Class({
|
|
5843
5619
|
type: "string",
|
|
@@ -5847,7 +5623,6 @@ function _uuid(Class, params) {
|
|
|
5847
5623
|
...normalizeParams(params)
|
|
5848
5624
|
});
|
|
5849
5625
|
}
|
|
5850
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5851
5626
|
function _uuidv4(Class, params) {
|
|
5852
5627
|
return new Class({
|
|
5853
5628
|
type: "string",
|
|
@@ -5858,7 +5633,6 @@ function _uuidv4(Class, params) {
|
|
|
5858
5633
|
...normalizeParams(params)
|
|
5859
5634
|
});
|
|
5860
5635
|
}
|
|
5861
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5862
5636
|
function _uuidv6(Class, params) {
|
|
5863
5637
|
return new Class({
|
|
5864
5638
|
type: "string",
|
|
@@ -5869,7 +5643,6 @@ function _uuidv6(Class, params) {
|
|
|
5869
5643
|
...normalizeParams(params)
|
|
5870
5644
|
});
|
|
5871
5645
|
}
|
|
5872
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5873
5646
|
function _uuidv7(Class, params) {
|
|
5874
5647
|
return new Class({
|
|
5875
5648
|
type: "string",
|
|
@@ -5880,7 +5653,6 @@ function _uuidv7(Class, params) {
|
|
|
5880
5653
|
...normalizeParams(params)
|
|
5881
5654
|
});
|
|
5882
5655
|
}
|
|
5883
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5884
5656
|
function _url(Class, params) {
|
|
5885
5657
|
return new Class({
|
|
5886
5658
|
type: "string",
|
|
@@ -5890,7 +5662,6 @@ function _url(Class, params) {
|
|
|
5890
5662
|
...normalizeParams(params)
|
|
5891
5663
|
});
|
|
5892
5664
|
}
|
|
5893
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5894
5665
|
function _emoji(Class, params) {
|
|
5895
5666
|
return new Class({
|
|
5896
5667
|
type: "string",
|
|
@@ -5900,7 +5671,6 @@ function _emoji(Class, params) {
|
|
|
5900
5671
|
...normalizeParams(params)
|
|
5901
5672
|
});
|
|
5902
5673
|
}
|
|
5903
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5904
5674
|
function _nanoid(Class, params) {
|
|
5905
5675
|
return new Class({
|
|
5906
5676
|
type: "string",
|
|
@@ -5910,7 +5680,6 @@ function _nanoid(Class, params) {
|
|
|
5910
5680
|
...normalizeParams(params)
|
|
5911
5681
|
});
|
|
5912
5682
|
}
|
|
5913
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5914
5683
|
function _cuid(Class, params) {
|
|
5915
5684
|
return new Class({
|
|
5916
5685
|
type: "string",
|
|
@@ -5920,7 +5689,6 @@ function _cuid(Class, params) {
|
|
|
5920
5689
|
...normalizeParams(params)
|
|
5921
5690
|
});
|
|
5922
5691
|
}
|
|
5923
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5924
5692
|
function _cuid2(Class, params) {
|
|
5925
5693
|
return new Class({
|
|
5926
5694
|
type: "string",
|
|
@@ -5930,7 +5698,6 @@ function _cuid2(Class, params) {
|
|
|
5930
5698
|
...normalizeParams(params)
|
|
5931
5699
|
});
|
|
5932
5700
|
}
|
|
5933
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5934
5701
|
function _ulid(Class, params) {
|
|
5935
5702
|
return new Class({
|
|
5936
5703
|
type: "string",
|
|
@@ -5940,7 +5707,6 @@ function _ulid(Class, params) {
|
|
|
5940
5707
|
...normalizeParams(params)
|
|
5941
5708
|
});
|
|
5942
5709
|
}
|
|
5943
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5944
5710
|
function _xid(Class, params) {
|
|
5945
5711
|
return new Class({
|
|
5946
5712
|
type: "string",
|
|
@@ -5950,7 +5716,6 @@ function _xid(Class, params) {
|
|
|
5950
5716
|
...normalizeParams(params)
|
|
5951
5717
|
});
|
|
5952
5718
|
}
|
|
5953
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5954
5719
|
function _ksuid(Class, params) {
|
|
5955
5720
|
return new Class({
|
|
5956
5721
|
type: "string",
|
|
@@ -5960,7 +5725,6 @@ function _ksuid(Class, params) {
|
|
|
5960
5725
|
...normalizeParams(params)
|
|
5961
5726
|
});
|
|
5962
5727
|
}
|
|
5963
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5964
5728
|
function _ipv4(Class, params) {
|
|
5965
5729
|
return new Class({
|
|
5966
5730
|
type: "string",
|
|
@@ -5970,7 +5734,6 @@ function _ipv4(Class, params) {
|
|
|
5970
5734
|
...normalizeParams(params)
|
|
5971
5735
|
});
|
|
5972
5736
|
}
|
|
5973
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5974
5737
|
function _ipv6(Class, params) {
|
|
5975
5738
|
return new Class({
|
|
5976
5739
|
type: "string",
|
|
@@ -5980,7 +5743,6 @@ function _ipv6(Class, params) {
|
|
|
5980
5743
|
...normalizeParams(params)
|
|
5981
5744
|
});
|
|
5982
5745
|
}
|
|
5983
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5984
5746
|
function _cidrv4(Class, params) {
|
|
5985
5747
|
return new Class({
|
|
5986
5748
|
type: "string",
|
|
@@ -5990,7 +5752,6 @@ function _cidrv4(Class, params) {
|
|
|
5990
5752
|
...normalizeParams(params)
|
|
5991
5753
|
});
|
|
5992
5754
|
}
|
|
5993
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
5994
5755
|
function _cidrv6(Class, params) {
|
|
5995
5756
|
return new Class({
|
|
5996
5757
|
type: "string",
|
|
@@ -6000,7 +5761,6 @@ function _cidrv6(Class, params) {
|
|
|
6000
5761
|
...normalizeParams(params)
|
|
6001
5762
|
});
|
|
6002
5763
|
}
|
|
6003
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6004
5764
|
function _base64(Class, params) {
|
|
6005
5765
|
return new Class({
|
|
6006
5766
|
type: "string",
|
|
@@ -6010,7 +5770,6 @@ function _base64(Class, params) {
|
|
|
6010
5770
|
...normalizeParams(params)
|
|
6011
5771
|
});
|
|
6012
5772
|
}
|
|
6013
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6014
5773
|
function _base64url(Class, params) {
|
|
6015
5774
|
return new Class({
|
|
6016
5775
|
type: "string",
|
|
@@ -6020,7 +5779,6 @@ function _base64url(Class, params) {
|
|
|
6020
5779
|
...normalizeParams(params)
|
|
6021
5780
|
});
|
|
6022
5781
|
}
|
|
6023
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6024
5782
|
function _e164(Class, params) {
|
|
6025
5783
|
return new Class({
|
|
6026
5784
|
type: "string",
|
|
@@ -6030,7 +5788,6 @@ function _e164(Class, params) {
|
|
|
6030
5788
|
...normalizeParams(params)
|
|
6031
5789
|
});
|
|
6032
5790
|
}
|
|
6033
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6034
5791
|
function _jwt(Class, params) {
|
|
6035
5792
|
return new Class({
|
|
6036
5793
|
type: "string",
|
|
@@ -6040,7 +5797,6 @@ function _jwt(Class, params) {
|
|
|
6040
5797
|
...normalizeParams(params)
|
|
6041
5798
|
});
|
|
6042
5799
|
}
|
|
6043
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6044
5800
|
function _isoDateTime(Class, params) {
|
|
6045
5801
|
return new Class({
|
|
6046
5802
|
type: "string",
|
|
@@ -6052,7 +5808,6 @@ function _isoDateTime(Class, params) {
|
|
|
6052
5808
|
...normalizeParams(params)
|
|
6053
5809
|
});
|
|
6054
5810
|
}
|
|
6055
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6056
5811
|
function _isoDate(Class, params) {
|
|
6057
5812
|
return new Class({
|
|
6058
5813
|
type: "string",
|
|
@@ -6061,7 +5816,6 @@ function _isoDate(Class, params) {
|
|
|
6061
5816
|
...normalizeParams(params)
|
|
6062
5817
|
});
|
|
6063
5818
|
}
|
|
6064
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6065
5819
|
function _isoTime(Class, params) {
|
|
6066
5820
|
return new Class({
|
|
6067
5821
|
type: "string",
|
|
@@ -6071,7 +5825,6 @@ function _isoTime(Class, params) {
|
|
|
6071
5825
|
...normalizeParams(params)
|
|
6072
5826
|
});
|
|
6073
5827
|
}
|
|
6074
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6075
5828
|
function _isoDuration(Class, params) {
|
|
6076
5829
|
return new Class({
|
|
6077
5830
|
type: "string",
|
|
@@ -6080,7 +5833,6 @@ function _isoDuration(Class, params) {
|
|
|
6080
5833
|
...normalizeParams(params)
|
|
6081
5834
|
});
|
|
6082
5835
|
}
|
|
6083
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6084
5836
|
function _number(Class, params) {
|
|
6085
5837
|
return new Class({
|
|
6086
5838
|
type: "number",
|
|
@@ -6088,7 +5840,6 @@ function _number(Class, params) {
|
|
|
6088
5840
|
...normalizeParams(params)
|
|
6089
5841
|
});
|
|
6090
5842
|
}
|
|
6091
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6092
5843
|
function _int(Class, params) {
|
|
6093
5844
|
return new Class({
|
|
6094
5845
|
type: "number",
|
|
@@ -6098,32 +5849,27 @@ function _int(Class, params) {
|
|
|
6098
5849
|
...normalizeParams(params)
|
|
6099
5850
|
});
|
|
6100
5851
|
}
|
|
6101
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6102
5852
|
function _boolean(Class, params) {
|
|
6103
5853
|
return new Class({
|
|
6104
5854
|
type: "boolean",
|
|
6105
5855
|
...normalizeParams(params)
|
|
6106
5856
|
});
|
|
6107
5857
|
}
|
|
6108
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6109
5858
|
function _null$1(Class, params) {
|
|
6110
5859
|
return new Class({
|
|
6111
5860
|
type: "null",
|
|
6112
5861
|
...normalizeParams(params)
|
|
6113
5862
|
});
|
|
6114
5863
|
}
|
|
6115
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6116
5864
|
function _unknown(Class) {
|
|
6117
5865
|
return new Class({ type: "unknown" });
|
|
6118
5866
|
}
|
|
6119
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6120
5867
|
function _never(Class, params) {
|
|
6121
5868
|
return new Class({
|
|
6122
5869
|
type: "never",
|
|
6123
5870
|
...normalizeParams(params)
|
|
6124
5871
|
});
|
|
6125
5872
|
}
|
|
6126
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6127
5873
|
function _lt(value, params) {
|
|
6128
5874
|
return new $ZodCheckLessThan({
|
|
6129
5875
|
check: "less_than",
|
|
@@ -6132,7 +5878,6 @@ function _lt(value, params) {
|
|
|
6132
5878
|
inclusive: false
|
|
6133
5879
|
});
|
|
6134
5880
|
}
|
|
6135
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6136
5881
|
function _lte(value, params) {
|
|
6137
5882
|
return new $ZodCheckLessThan({
|
|
6138
5883
|
check: "less_than",
|
|
@@ -6141,7 +5886,6 @@ function _lte(value, params) {
|
|
|
6141
5886
|
inclusive: true
|
|
6142
5887
|
});
|
|
6143
5888
|
}
|
|
6144
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6145
5889
|
function _gt(value, params) {
|
|
6146
5890
|
return new $ZodCheckGreaterThan({
|
|
6147
5891
|
check: "greater_than",
|
|
@@ -6150,7 +5894,6 @@ function _gt(value, params) {
|
|
|
6150
5894
|
inclusive: false
|
|
6151
5895
|
});
|
|
6152
5896
|
}
|
|
6153
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6154
5897
|
function _gte(value, params) {
|
|
6155
5898
|
return new $ZodCheckGreaterThan({
|
|
6156
5899
|
check: "greater_than",
|
|
@@ -6159,7 +5902,6 @@ function _gte(value, params) {
|
|
|
6159
5902
|
inclusive: true
|
|
6160
5903
|
});
|
|
6161
5904
|
}
|
|
6162
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6163
5905
|
function _multipleOf(value, params) {
|
|
6164
5906
|
return new $ZodCheckMultipleOf({
|
|
6165
5907
|
check: "multiple_of",
|
|
@@ -6167,7 +5909,6 @@ function _multipleOf(value, params) {
|
|
|
6167
5909
|
value
|
|
6168
5910
|
});
|
|
6169
5911
|
}
|
|
6170
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6171
5912
|
function _maxLength(maximum, params) {
|
|
6172
5913
|
return new $ZodCheckMaxLength({
|
|
6173
5914
|
check: "max_length",
|
|
@@ -6175,7 +5916,6 @@ function _maxLength(maximum, params) {
|
|
|
6175
5916
|
maximum
|
|
6176
5917
|
});
|
|
6177
5918
|
}
|
|
6178
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6179
5919
|
function _minLength(minimum, params) {
|
|
6180
5920
|
return new $ZodCheckMinLength({
|
|
6181
5921
|
check: "min_length",
|
|
@@ -6183,7 +5923,6 @@ function _minLength(minimum, params) {
|
|
|
6183
5923
|
minimum
|
|
6184
5924
|
});
|
|
6185
5925
|
}
|
|
6186
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6187
5926
|
function _length(length, params) {
|
|
6188
5927
|
return new $ZodCheckLengthEquals({
|
|
6189
5928
|
check: "length_equals",
|
|
@@ -6191,7 +5930,6 @@ function _length(length, params) {
|
|
|
6191
5930
|
length
|
|
6192
5931
|
});
|
|
6193
5932
|
}
|
|
6194
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6195
5933
|
function _regex(pattern, params) {
|
|
6196
5934
|
return new $ZodCheckRegex({
|
|
6197
5935
|
check: "string_format",
|
|
@@ -6200,7 +5938,6 @@ function _regex(pattern, params) {
|
|
|
6200
5938
|
pattern
|
|
6201
5939
|
});
|
|
6202
5940
|
}
|
|
6203
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6204
5941
|
function _lowercase(params) {
|
|
6205
5942
|
return new $ZodCheckLowerCase({
|
|
6206
5943
|
check: "string_format",
|
|
@@ -6208,7 +5945,6 @@ function _lowercase(params) {
|
|
|
6208
5945
|
...normalizeParams(params)
|
|
6209
5946
|
});
|
|
6210
5947
|
}
|
|
6211
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6212
5948
|
function _uppercase(params) {
|
|
6213
5949
|
return new $ZodCheckUpperCase({
|
|
6214
5950
|
check: "string_format",
|
|
@@ -6216,7 +5952,6 @@ function _uppercase(params) {
|
|
|
6216
5952
|
...normalizeParams(params)
|
|
6217
5953
|
});
|
|
6218
5954
|
}
|
|
6219
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6220
5955
|
function _includes(includes, params) {
|
|
6221
5956
|
return new $ZodCheckIncludes({
|
|
6222
5957
|
check: "string_format",
|
|
@@ -6225,7 +5960,6 @@ function _includes(includes, params) {
|
|
|
6225
5960
|
includes
|
|
6226
5961
|
});
|
|
6227
5962
|
}
|
|
6228
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6229
5963
|
function _startsWith(prefix, params) {
|
|
6230
5964
|
return new $ZodCheckStartsWith({
|
|
6231
5965
|
check: "string_format",
|
|
@@ -6234,7 +5968,6 @@ function _startsWith(prefix, params) {
|
|
|
6234
5968
|
prefix
|
|
6235
5969
|
});
|
|
6236
5970
|
}
|
|
6237
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6238
5971
|
function _endsWith(suffix, params) {
|
|
6239
5972
|
return new $ZodCheckEndsWith({
|
|
6240
5973
|
check: "string_format",
|
|
@@ -6243,34 +5976,24 @@ function _endsWith(suffix, params) {
|
|
|
6243
5976
|
suffix
|
|
6244
5977
|
});
|
|
6245
5978
|
}
|
|
6246
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6247
5979
|
function _overwrite(tx) {
|
|
6248
5980
|
return new $ZodCheckOverwrite({
|
|
6249
5981
|
check: "overwrite",
|
|
6250
5982
|
tx
|
|
6251
5983
|
});
|
|
6252
5984
|
}
|
|
6253
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6254
5985
|
function _normalize(form) {
|
|
6255
|
-
return
|
|
5986
|
+
return _overwrite((input) => input.normalize(form));
|
|
6256
5987
|
}
|
|
6257
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6258
5988
|
function _trim() {
|
|
6259
|
-
return
|
|
5989
|
+
return _overwrite((input) => input.trim());
|
|
6260
5990
|
}
|
|
6261
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6262
5991
|
function _toLowerCase() {
|
|
6263
|
-
return
|
|
5992
|
+
return _overwrite((input) => input.toLowerCase());
|
|
6264
5993
|
}
|
|
6265
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6266
5994
|
function _toUpperCase() {
|
|
6267
|
-
return
|
|
6268
|
-
}
|
|
6269
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6270
|
-
function _slugify() {
|
|
6271
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
5995
|
+
return _overwrite((input) => input.toUpperCase());
|
|
6272
5996
|
}
|
|
6273
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6274
5997
|
function _array(Class, element, params) {
|
|
6275
5998
|
return new Class({
|
|
6276
5999
|
type: "array",
|
|
@@ -6278,7 +6001,6 @@ function _array(Class, element, params) {
|
|
|
6278
6001
|
...normalizeParams(params)
|
|
6279
6002
|
});
|
|
6280
6003
|
}
|
|
6281
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6282
6004
|
function _custom(Class, fn, _params) {
|
|
6283
6005
|
const norm = normalizeParams(_params);
|
|
6284
6006
|
norm.abort ?? (norm.abort = true);
|
|
@@ -6289,7 +6011,6 @@ function _custom(Class, fn, _params) {
|
|
|
6289
6011
|
...norm
|
|
6290
6012
|
});
|
|
6291
6013
|
}
|
|
6292
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6293
6014
|
function _refine(Class, fn, _params) {
|
|
6294
6015
|
return new Class({
|
|
6295
6016
|
type: "custom",
|
|
@@ -6298,811 +6019,607 @@ function _refine(Class, fn, _params) {
|
|
|
6298
6019
|
...normalizeParams(_params)
|
|
6299
6020
|
});
|
|
6300
6021
|
}
|
|
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
|
-
}
|
|
6355
6022
|
|
|
6356
6023
|
//#endregion
|
|
6357
|
-
//#region ../../node_modules/.bun/zod@
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
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 {
|
|
6398
|
-
const params = {
|
|
6399
|
-
..._params,
|
|
6400
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
6024
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js
|
|
6025
|
+
var JSONSchemaGenerator = class {
|
|
6026
|
+
constructor(params) {
|
|
6027
|
+
this.counter = 0;
|
|
6028
|
+
this.metadataRegistry = params?.metadata ?? globalRegistry;
|
|
6029
|
+
this.target = params?.target ?? "draft-2020-12";
|
|
6030
|
+
this.unrepresentable = params?.unrepresentable ?? "throw";
|
|
6031
|
+
this.override = params?.override ?? (() => {});
|
|
6032
|
+
this.io = params?.io ?? "output";
|
|
6033
|
+
this.seen = /* @__PURE__ */ new Map();
|
|
6034
|
+
}
|
|
6035
|
+
process(schema, _params = {
|
|
6036
|
+
path: [],
|
|
6037
|
+
schemaPath: []
|
|
6038
|
+
}) {
|
|
6039
|
+
var _a;
|
|
6040
|
+
const def = schema._zod.def;
|
|
6041
|
+
const formatMap = {
|
|
6042
|
+
guid: "uuid",
|
|
6043
|
+
url: "uri",
|
|
6044
|
+
datetime: "date-time",
|
|
6045
|
+
json_string: "json-string",
|
|
6046
|
+
regex: ""
|
|
6047
|
+
};
|
|
6048
|
+
const seen = this.seen.get(schema);
|
|
6049
|
+
if (seen) {
|
|
6050
|
+
seen.count++;
|
|
6051
|
+
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
6052
|
+
return seen.schema;
|
|
6053
|
+
}
|
|
6054
|
+
const result = {
|
|
6055
|
+
schema: {},
|
|
6056
|
+
count: 1,
|
|
6057
|
+
cycle: void 0,
|
|
6401
6058
|
path: _params.path
|
|
6402
6059
|
};
|
|
6403
|
-
|
|
6060
|
+
this.seen.set(schema, result);
|
|
6061
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
6062
|
+
if (overrideSchema) result.schema = overrideSchema;
|
|
6404
6063
|
else {
|
|
6405
|
-
const
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
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;
|
|
6447
|
-
return {
|
|
6448
|
-
defId: id,
|
|
6449
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
6064
|
+
const params = {
|
|
6065
|
+
..._params,
|
|
6066
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
6067
|
+
path: _params.path
|
|
6450
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
|
+
}
|
|
6451
6400
|
}
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
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;
|
|
6410
|
+
}
|
|
6411
|
+
emit(schema, _params) {
|
|
6412
|
+
const params = {
|
|
6413
|
+
cycles: _params?.cycles ?? "ref",
|
|
6414
|
+
reused: _params?.reused ?? "inline",
|
|
6415
|
+
external: _params?.external ?? void 0
|
|
6458
6416
|
};
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6417
|
+
const root = this.seen.get(schema);
|
|
6418
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6419
|
+
const makeURI = (entry) => {
|
|
6420
|
+
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6421
|
+
if (params.external) {
|
|
6422
|
+
const externalId = params.external.registry.get(entry[0])?.id;
|
|
6423
|
+
const uriGenerator = params.external.uri ?? ((id) => id);
|
|
6424
|
+
if (externalId) return { ref: uriGenerator(externalId) };
|
|
6425
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
|
|
6426
|
+
entry[1].defId = id;
|
|
6427
|
+
return {
|
|
6428
|
+
defId: id,
|
|
6429
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
6430
|
+
};
|
|
6431
|
+
}
|
|
6432
|
+
if (entry[1] === root) return { ref: "#" };
|
|
6433
|
+
const defUriPrefix = `#/${defsSegment}/`;
|
|
6434
|
+
const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
|
|
6435
|
+
return {
|
|
6436
|
+
defId,
|
|
6437
|
+
ref: defUriPrefix + defId
|
|
6438
|
+
};
|
|
6439
|
+
};
|
|
6440
|
+
const extractToDef = (entry) => {
|
|
6441
|
+
if (entry[1].schema.$ref) return;
|
|
6442
|
+
const seen = entry[1];
|
|
6443
|
+
const { ref, defId } = makeURI(entry);
|
|
6444
|
+
seen.def = { ...seen.schema };
|
|
6445
|
+
if (defId) seen.defId = defId;
|
|
6446
|
+
const schema = seen.schema;
|
|
6447
|
+
for (const key in schema) delete schema[key];
|
|
6448
|
+
schema.$ref = ref;
|
|
6449
|
+
};
|
|
6450
|
+
if (params.cycles === "throw") for (const entry of this.seen.entries()) {
|
|
6451
|
+
const seen = entry[1];
|
|
6452
|
+
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
6473
6453
|
|
|
6474
6454
|
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;
|
|
6481
6455
|
}
|
|
6482
|
-
|
|
6483
|
-
const
|
|
6484
|
-
if (schema
|
|
6456
|
+
for (const entry of this.seen.entries()) {
|
|
6457
|
+
const seen = entry[1];
|
|
6458
|
+
if (schema === entry[0]) {
|
|
6485
6459
|
extractToDef(entry);
|
|
6486
6460
|
continue;
|
|
6487
6461
|
}
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
}
|
|
6497
|
-
if (seen.count > 1) {
|
|
6498
|
-
if (ctx.reused === "ref") {
|
|
6462
|
+
if (params.external) {
|
|
6463
|
+
const ext = params.external.registry.get(entry[0])?.id;
|
|
6464
|
+
if (schema !== entry[0] && ext) {
|
|
6465
|
+
extractToDef(entry);
|
|
6466
|
+
continue;
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
if (this.metadataRegistry.get(entry[0])?.id) {
|
|
6499
6470
|
extractToDef(entry);
|
|
6500
6471
|
continue;
|
|
6501
6472
|
}
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
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];
|
|
6473
|
+
if (seen.cycle) {
|
|
6474
|
+
extractToDef(entry);
|
|
6475
|
+
continue;
|
|
6476
|
+
}
|
|
6477
|
+
if (seen.count > 1) {
|
|
6478
|
+
if (params.reused === "ref") {
|
|
6479
|
+
extractToDef(entry);
|
|
6480
|
+
continue;
|
|
6542
6481
|
}
|
|
6543
6482
|
}
|
|
6544
6483
|
}
|
|
6545
|
-
|
|
6546
|
-
zodSchema
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
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)
|
|
6484
|
+
const flattenRef = (zodSchema, params) => {
|
|
6485
|
+
const seen = this.seen.get(zodSchema);
|
|
6486
|
+
const schema = seen.def ?? seen.schema;
|
|
6487
|
+
const _cached = { ...schema };
|
|
6488
|
+
if (seen.ref === null) return;
|
|
6489
|
+
const ref = seen.ref;
|
|
6490
|
+
seen.ref = null;
|
|
6491
|
+
if (ref) {
|
|
6492
|
+
flattenRef(ref, params);
|
|
6493
|
+
const refSchema = this.seen.get(ref).schema;
|
|
6494
|
+
if (refSchema.$ref && params.target === "draft-7") {
|
|
6495
|
+
schema.allOf = schema.allOf ?? [];
|
|
6496
|
+
schema.allOf.push(refSchema);
|
|
6497
|
+
} else {
|
|
6498
|
+
Object.assign(schema, refSchema);
|
|
6499
|
+
Object.assign(schema, _cached);
|
|
6578
6500
|
}
|
|
6579
|
-
}
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
}
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
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;
|
|
6947
|
-
}
|
|
6948
|
-
};
|
|
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");
|
|
6501
|
+
}
|
|
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
|
+
}
|
|
6988
6531
|
}
|
|
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
6532
|
};
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
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
|
-
});
|
|
6533
|
+
function toJSONSchema(input, _params) {
|
|
6534
|
+
if (input instanceof $ZodRegistry) {
|
|
6535
|
+
const gen = new JSONSchemaGenerator(_params);
|
|
7071
6536
|
const defs = {};
|
|
7072
|
-
for (const entry of
|
|
6537
|
+
for (const entry of input._idmap.entries()) {
|
|
7073
6538
|
const [_, schema] = entry;
|
|
7074
|
-
process
|
|
6539
|
+
gen.process(schema);
|
|
7075
6540
|
}
|
|
7076
6541
|
const schemas = {};
|
|
7077
|
-
|
|
7078
|
-
registry,
|
|
7079
|
-
uri:
|
|
6542
|
+
const external = {
|
|
6543
|
+
registry: input,
|
|
6544
|
+
uri: _params?.uri,
|
|
7080
6545
|
defs
|
|
7081
6546
|
};
|
|
7082
|
-
for (const entry of
|
|
6547
|
+
for (const entry of input._idmap.entries()) {
|
|
7083
6548
|
const [key, schema] = entry;
|
|
7084
|
-
|
|
7085
|
-
|
|
6549
|
+
schemas[key] = gen.emit(schema, {
|
|
6550
|
+
..._params,
|
|
6551
|
+
external
|
|
6552
|
+
});
|
|
7086
6553
|
}
|
|
7087
|
-
if (Object.keys(defs).length > 0) schemas.__shared = { [
|
|
6554
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [gen.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
7088
6555
|
return { schemas };
|
|
7089
6556
|
}
|
|
7090
|
-
const
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
6557
|
+
const gen = new JSONSchemaGenerator(_params);
|
|
6558
|
+
gen.process(input);
|
|
6559
|
+
return gen.emit(input, _params);
|
|
6560
|
+
}
|
|
6561
|
+
function isTransforming(_schema, _ctx) {
|
|
6562
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
6563
|
+
if (ctx.seen.has(_schema)) return false;
|
|
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}`);
|
|
7097
6615
|
}
|
|
7098
6616
|
|
|
7099
6617
|
//#endregion
|
|
7100
|
-
//#region ../../node_modules/.bun/zod@
|
|
6618
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/mini/schemas.js
|
|
7101
6619
|
const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
7102
6620
|
if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
|
|
7103
6621
|
$ZodType.init(inst, def);
|
|
7104
6622
|
inst.def = def;
|
|
7105
|
-
inst.type = def.type;
|
|
7106
6623
|
inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
|
|
7107
6624
|
inst.safeParse = (data, params) => safeParse$2(inst, data, params);
|
|
7108
6625
|
inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -7115,32 +6632,30 @@ const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
|
7115
6632
|
def: { check: "custom" },
|
|
7116
6633
|
onattach: []
|
|
7117
6634
|
} } : ch)]
|
|
7118
|
-
}
|
|
6635
|
+
});
|
|
7119
6636
|
};
|
|
7120
|
-
inst.with = inst.check;
|
|
7121
6637
|
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
7122
6638
|
inst.brand = () => inst;
|
|
7123
6639
|
inst.register = ((reg, meta) => {
|
|
7124
6640
|
reg.add(inst, meta);
|
|
7125
6641
|
return inst;
|
|
7126
6642
|
});
|
|
7127
|
-
inst.apply = (fn) => fn(inst);
|
|
7128
6643
|
});
|
|
7129
6644
|
const ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
|
|
7130
6645
|
$ZodObject.init(inst, def);
|
|
7131
6646
|
ZodMiniType.init(inst, def);
|
|
7132
6647
|
defineLazy(inst, "shape", () => def.shape);
|
|
7133
6648
|
});
|
|
7134
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
7135
6649
|
function object$1(shape, params) {
|
|
7136
6650
|
return new ZodMiniObject({
|
|
7137
6651
|
type: "object",
|
|
7138
|
-
|
|
6652
|
+
get shape() {
|
|
6653
|
+
assignProp(this, "shape", { ...shape });
|
|
6654
|
+
return this.shape;
|
|
6655
|
+
},
|
|
7139
6656
|
...normalizeParams(params)
|
|
7140
6657
|
});
|
|
7141
6658
|
}
|
|
7142
|
-
const describe$1 = describe$2;
|
|
7143
|
-
const meta$1 = meta$2;
|
|
7144
6659
|
|
|
7145
6660
|
//#endregion
|
|
7146
6661
|
//#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
@@ -7259,7 +6774,7 @@ function getLiteralValue(schema) {
|
|
|
7259
6774
|
}
|
|
7260
6775
|
|
|
7261
6776
|
//#endregion
|
|
7262
|
-
//#region ../../node_modules/.bun/zod@
|
|
6777
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/iso.js
|
|
7263
6778
|
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
7264
6779
|
$ZodISODateTime.init(inst, def);
|
|
7265
6780
|
ZodStringFormat.init(inst, def);
|
|
@@ -7290,21 +6805,15 @@ function duration(params) {
|
|
|
7290
6805
|
}
|
|
7291
6806
|
|
|
7292
6807
|
//#endregion
|
|
7293
|
-
//#region ../../node_modules/.bun/zod@
|
|
6808
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/errors.js
|
|
7294
6809
|
const initializer = (inst, issues) => {
|
|
7295
6810
|
$ZodError.init(inst, issues);
|
|
7296
6811
|
inst.name = "ZodError";
|
|
7297
6812
|
Object.defineProperties(inst, {
|
|
7298
6813
|
format: { value: (mapper) => formatError(inst, mapper) },
|
|
7299
6814
|
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
7300
|
-
addIssue: { value: (issue) =>
|
|
7301
|
-
|
|
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
|
-
} },
|
|
6815
|
+
addIssue: { value: (issue) => inst.issues.push(issue) },
|
|
6816
|
+
addIssues: { value: (issues) => inst.issues.push(...issues) },
|
|
7308
6817
|
isEmpty: { get() {
|
|
7309
6818
|
return inst.issues.length === 0;
|
|
7310
6819
|
} }
|
|
@@ -7314,40 +6823,28 @@ const ZodError = $constructor("ZodError", initializer);
|
|
|
7314
6823
|
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
7315
6824
|
|
|
7316
6825
|
//#endregion
|
|
7317
|
-
//#region ../../node_modules/.bun/zod@
|
|
6826
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/parse.js
|
|
7318
6827
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
7319
6828
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
7320
6829
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
7321
6830
|
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);
|
|
7330
6831
|
|
|
7331
6832
|
//#endregion
|
|
7332
|
-
//#region ../../node_modules/.bun/zod@
|
|
6833
|
+
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/schemas.js
|
|
7333
6834
|
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
7334
6835
|
$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, {});
|
|
7340
6836
|
inst.def = def;
|
|
7341
|
-
inst.type = def.type;
|
|
7342
6837
|
Object.defineProperty(inst, "_def", { value: def });
|
|
7343
6838
|
inst.check = (...checks) => {
|
|
7344
|
-
return inst.clone(
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
6839
|
+
return inst.clone({
|
|
6840
|
+
...def,
|
|
6841
|
+
checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
6842
|
+
check: ch,
|
|
6843
|
+
def: { check: "custom" },
|
|
6844
|
+
onattach: []
|
|
6845
|
+
} } : ch)]
|
|
6846
|
+
});
|
|
7349
6847
|
};
|
|
7350
|
-
inst.with = inst.check;
|
|
7351
6848
|
inst.clone = (def, params) => clone(inst, def, params);
|
|
7352
6849
|
inst.brand = () => inst;
|
|
7353
6850
|
inst.register = ((reg, meta) => {
|
|
@@ -7359,19 +6856,10 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7359
6856
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
7360
6857
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
7361
6858
|
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);
|
|
7370
6859
|
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
7371
6860
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
7372
6861
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
7373
6862
|
inst.optional = () => optional(inst);
|
|
7374
|
-
inst.exactOptional = () => exactOptional(inst);
|
|
7375
6863
|
inst.nullable = () => nullable(inst);
|
|
7376
6864
|
inst.nullish = () => optional(nullable(inst));
|
|
7377
6865
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -7403,14 +6891,12 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
7403
6891
|
};
|
|
7404
6892
|
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
7405
6893
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
7406
|
-
inst.apply = (fn) => fn(inst);
|
|
7407
6894
|
return inst;
|
|
7408
6895
|
});
|
|
7409
6896
|
/** @internal */
|
|
7410
6897
|
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
7411
6898
|
$ZodString.init(inst, def);
|
|
7412
6899
|
ZodType.init(inst, def);
|
|
7413
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
7414
6900
|
const bag = inst._zod.bag;
|
|
7415
6901
|
inst.format = bag.format ?? null;
|
|
7416
6902
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -7429,7 +6915,6 @@ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
7429
6915
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
7430
6916
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
7431
6917
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
7432
|
-
inst.slugify = () => inst.check(_slugify());
|
|
7433
6918
|
});
|
|
7434
6919
|
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
7435
6920
|
$ZodString.init(inst, def);
|
|
@@ -7548,7 +7033,6 @@ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
7548
7033
|
const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
7549
7034
|
$ZodNumber.init(inst, def);
|
|
7550
7035
|
ZodType.init(inst, def);
|
|
7551
|
-
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
7552
7036
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
7553
7037
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
7554
7038
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -7584,7 +7068,6 @@ function int(params) {
|
|
|
7584
7068
|
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
7585
7069
|
$ZodBoolean.init(inst, def);
|
|
7586
7070
|
ZodType.init(inst, def);
|
|
7587
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7588
7071
|
});
|
|
7589
7072
|
function boolean(params) {
|
|
7590
7073
|
return _boolean(ZodBoolean, params);
|
|
@@ -7592,7 +7075,6 @@ function boolean(params) {
|
|
|
7592
7075
|
const ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
7593
7076
|
$ZodNull.init(inst, def);
|
|
7594
7077
|
ZodType.init(inst, def);
|
|
7595
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
7596
7078
|
});
|
|
7597
7079
|
function _null(params) {
|
|
7598
7080
|
return _null$1(ZodNull, params);
|
|
@@ -7600,7 +7082,6 @@ function _null(params) {
|
|
|
7600
7082
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7601
7083
|
$ZodUnknown.init(inst, def);
|
|
7602
7084
|
ZodType.init(inst, def);
|
|
7603
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
7604
7085
|
});
|
|
7605
7086
|
function unknown() {
|
|
7606
7087
|
return _unknown(ZodUnknown);
|
|
@@ -7608,7 +7089,6 @@ function unknown() {
|
|
|
7608
7089
|
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
7609
7090
|
$ZodNever.init(inst, def);
|
|
7610
7091
|
ZodType.init(inst, def);
|
|
7611
|
-
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
7612
7092
|
});
|
|
7613
7093
|
function never(params) {
|
|
7614
7094
|
return _never(ZodNever, params);
|
|
@@ -7616,7 +7096,6 @@ function never(params) {
|
|
|
7616
7096
|
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
7617
7097
|
$ZodArray.init(inst, def);
|
|
7618
7098
|
ZodType.init(inst, def);
|
|
7619
|
-
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
7620
7099
|
inst.element = def.element;
|
|
7621
7100
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
7622
7101
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -7628,12 +7107,9 @@ function array(element, params) {
|
|
|
7628
7107
|
return _array(ZodArray, element, params);
|
|
7629
7108
|
}
|
|
7630
7109
|
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
7631
|
-
$
|
|
7110
|
+
$ZodObject.init(inst, def);
|
|
7632
7111
|
ZodType.init(inst, def);
|
|
7633
|
-
inst
|
|
7634
|
-
defineLazy(inst, "shape", () => {
|
|
7635
|
-
return def.shape;
|
|
7636
|
-
});
|
|
7112
|
+
defineLazy(inst, "shape", () => def.shape);
|
|
7637
7113
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
7638
7114
|
inst.catchall = (catchall) => inst.clone({
|
|
7639
7115
|
...inst._zod.def,
|
|
@@ -7658,9 +7134,6 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
7658
7134
|
inst.extend = (incoming) => {
|
|
7659
7135
|
return extend(inst, incoming);
|
|
7660
7136
|
};
|
|
7661
|
-
inst.safeExtend = (incoming) => {
|
|
7662
|
-
return safeExtend(inst, incoming);
|
|
7663
|
-
};
|
|
7664
7137
|
inst.merge = (other) => merge(inst, other);
|
|
7665
7138
|
inst.pick = (mask) => pick(inst, mask);
|
|
7666
7139
|
inst.omit = (mask) => omit(inst, mask);
|
|
@@ -7670,14 +7143,20 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
7670
7143
|
function object(shape, params) {
|
|
7671
7144
|
return new ZodObject({
|
|
7672
7145
|
type: "object",
|
|
7673
|
-
|
|
7146
|
+
get shape() {
|
|
7147
|
+
assignProp(this, "shape", { ...shape });
|
|
7148
|
+
return this.shape;
|
|
7149
|
+
},
|
|
7674
7150
|
...normalizeParams(params)
|
|
7675
7151
|
});
|
|
7676
7152
|
}
|
|
7677
7153
|
function looseObject(shape, params) {
|
|
7678
7154
|
return new ZodObject({
|
|
7679
7155
|
type: "object",
|
|
7680
|
-
shape
|
|
7156
|
+
get shape() {
|
|
7157
|
+
assignProp(this, "shape", { ...shape });
|
|
7158
|
+
return this.shape;
|
|
7159
|
+
},
|
|
7681
7160
|
catchall: unknown(),
|
|
7682
7161
|
...normalizeParams(params)
|
|
7683
7162
|
});
|
|
@@ -7685,7 +7164,6 @@ function looseObject(shape, params) {
|
|
|
7685
7164
|
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
7686
7165
|
$ZodUnion.init(inst, def);
|
|
7687
7166
|
ZodType.init(inst, def);
|
|
7688
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
7689
7167
|
inst.options = def.options;
|
|
7690
7168
|
});
|
|
7691
7169
|
function union(options, params) {
|
|
@@ -7710,7 +7188,6 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
7710
7188
|
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
7711
7189
|
$ZodIntersection.init(inst, def);
|
|
7712
7190
|
ZodType.init(inst, def);
|
|
7713
|
-
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
7714
7191
|
});
|
|
7715
7192
|
function intersection(left, right) {
|
|
7716
7193
|
return new ZodIntersection({
|
|
@@ -7722,7 +7199,6 @@ function intersection(left, right) {
|
|
|
7722
7199
|
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
7723
7200
|
$ZodRecord.init(inst, def);
|
|
7724
7201
|
ZodType.init(inst, def);
|
|
7725
|
-
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
7726
7202
|
inst.keyType = def.keyType;
|
|
7727
7203
|
inst.valueType = def.valueType;
|
|
7728
7204
|
});
|
|
@@ -7737,7 +7213,6 @@ function record(keyType, valueType, params) {
|
|
|
7737
7213
|
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
7738
7214
|
$ZodEnum.init(inst, def);
|
|
7739
7215
|
ZodType.init(inst, def);
|
|
7740
|
-
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
7741
7216
|
inst.enum = def.entries;
|
|
7742
7217
|
inst.options = Object.values(def.entries);
|
|
7743
7218
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -7774,7 +7249,6 @@ function _enum(values, params) {
|
|
|
7774
7249
|
const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
7775
7250
|
$ZodLiteral.init(inst, def);
|
|
7776
7251
|
ZodType.init(inst, def);
|
|
7777
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
7778
7252
|
inst.values = new Set(def.values);
|
|
7779
7253
|
Object.defineProperty(inst, "value", { get() {
|
|
7780
7254
|
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -7791,17 +7265,16 @@ function literal(value, params) {
|
|
|
7791
7265
|
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
7792
7266
|
$ZodTransform.init(inst, def);
|
|
7793
7267
|
ZodType.init(inst, def);
|
|
7794
|
-
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
7795
7268
|
inst._zod.parse = (payload, _ctx) => {
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
7269
|
+
payload.addIssue = (issue$2) => {
|
|
7270
|
+
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, def));
|
|
7799
7271
|
else {
|
|
7800
|
-
const _issue = issue$
|
|
7272
|
+
const _issue = issue$2;
|
|
7801
7273
|
if (_issue.fatal) _issue.continue = false;
|
|
7802
7274
|
_issue.code ?? (_issue.code = "custom");
|
|
7803
7275
|
_issue.input ?? (_issue.input = payload.value);
|
|
7804
7276
|
_issue.inst ?? (_issue.inst = inst);
|
|
7277
|
+
_issue.continue ?? (_issue.continue = true);
|
|
7805
7278
|
payload.issues.push(issue(_issue));
|
|
7806
7279
|
}
|
|
7807
7280
|
};
|
|
@@ -7823,7 +7296,6 @@ function transform(fn) {
|
|
|
7823
7296
|
const ZodOptional$1 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
7824
7297
|
$ZodOptional.init(inst, def);
|
|
7825
7298
|
ZodType.init(inst, def);
|
|
7826
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7827
7299
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7828
7300
|
});
|
|
7829
7301
|
function optional(innerType) {
|
|
@@ -7832,22 +7304,9 @@ function optional(innerType) {
|
|
|
7832
7304
|
innerType
|
|
7833
7305
|
});
|
|
7834
7306
|
}
|
|
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
|
-
}
|
|
7847
7307
|
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
7848
7308
|
$ZodNullable.init(inst, def);
|
|
7849
7309
|
ZodType.init(inst, def);
|
|
7850
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
7851
7310
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7852
7311
|
});
|
|
7853
7312
|
function nullable(innerType) {
|
|
@@ -7859,7 +7318,6 @@ function nullable(innerType) {
|
|
|
7859
7318
|
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
7860
7319
|
$ZodDefault.init(inst, def);
|
|
7861
7320
|
ZodType.init(inst, def);
|
|
7862
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
7863
7321
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7864
7322
|
inst.removeDefault = inst.unwrap;
|
|
7865
7323
|
});
|
|
@@ -7868,14 +7326,13 @@ function _default(innerType, defaultValue) {
|
|
|
7868
7326
|
type: "default",
|
|
7869
7327
|
innerType,
|
|
7870
7328
|
get defaultValue() {
|
|
7871
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
7329
|
+
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7872
7330
|
}
|
|
7873
7331
|
});
|
|
7874
7332
|
}
|
|
7875
7333
|
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
7876
7334
|
$ZodPrefault.init(inst, def);
|
|
7877
7335
|
ZodType.init(inst, def);
|
|
7878
|
-
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
7879
7336
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7880
7337
|
});
|
|
7881
7338
|
function prefault(innerType, defaultValue) {
|
|
@@ -7883,14 +7340,13 @@ function prefault(innerType, defaultValue) {
|
|
|
7883
7340
|
type: "prefault",
|
|
7884
7341
|
innerType,
|
|
7885
7342
|
get defaultValue() {
|
|
7886
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
7343
|
+
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7887
7344
|
}
|
|
7888
7345
|
});
|
|
7889
7346
|
}
|
|
7890
7347
|
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
7891
7348
|
$ZodNonOptional.init(inst, def);
|
|
7892
7349
|
ZodType.init(inst, def);
|
|
7893
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
7894
7350
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7895
7351
|
});
|
|
7896
7352
|
function nonoptional(innerType, params) {
|
|
@@ -7903,7 +7359,6 @@ function nonoptional(innerType, params) {
|
|
|
7903
7359
|
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
7904
7360
|
$ZodCatch.init(inst, def);
|
|
7905
7361
|
ZodType.init(inst, def);
|
|
7906
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
7907
7362
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
7908
7363
|
inst.removeCatch = inst.unwrap;
|
|
7909
7364
|
});
|
|
@@ -7917,7 +7372,6 @@ function _catch(innerType, catchValue) {
|
|
|
7917
7372
|
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
7918
7373
|
$ZodPipe.init(inst, def);
|
|
7919
7374
|
ZodType.init(inst, def);
|
|
7920
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
7921
7375
|
inst.in = def.in;
|
|
7922
7376
|
inst.out = def.out;
|
|
7923
7377
|
});
|
|
@@ -7931,8 +7385,6 @@ function pipe(in_, out) {
|
|
|
7931
7385
|
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
7932
7386
|
$ZodReadonly.init(inst, def);
|
|
7933
7387
|
ZodType.init(inst, def);
|
|
7934
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
7935
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7936
7388
|
});
|
|
7937
7389
|
function readonly(innerType) {
|
|
7938
7390
|
return new ZodReadonly({
|
|
@@ -7943,8 +7395,12 @@ function readonly(innerType) {
|
|
|
7943
7395
|
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
7944
7396
|
$ZodCustom.init(inst, def);
|
|
7945
7397
|
ZodType.init(inst, def);
|
|
7946
|
-
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
7947
7398
|
});
|
|
7399
|
+
function check(fn) {
|
|
7400
|
+
const ch = new $ZodCheck({ check: "custom" });
|
|
7401
|
+
ch._zod.check = fn;
|
|
7402
|
+
return ch;
|
|
7403
|
+
}
|
|
7948
7404
|
function custom(fn, _params) {
|
|
7949
7405
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
7950
7406
|
}
|
|
@@ -7952,10 +7408,23 @@ function refine(fn, _params = {}) {
|
|
|
7952
7408
|
return _refine(ZodCustom, fn, _params);
|
|
7953
7409
|
}
|
|
7954
7410
|
function superRefine(fn) {
|
|
7955
|
-
|
|
7411
|
+
const ch = check((payload) => {
|
|
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;
|
|
7956
7427
|
}
|
|
7957
|
-
const describe = describe$2;
|
|
7958
|
-
const meta = meta$2;
|
|
7959
7428
|
function preprocess(fn, schema) {
|
|
7960
7429
|
return pipe(transform(fn), schema);
|
|
7961
7430
|
}
|
|
@@ -9236,7 +8705,7 @@ function isTerminal(status) {
|
|
|
9236
8705
|
}
|
|
9237
8706
|
|
|
9238
8707
|
//#endregion
|
|
9239
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8708
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
9240
8709
|
const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
9241
8710
|
const defaultOptions = {
|
|
9242
8711
|
name: void 0,
|
|
@@ -9271,7 +8740,7 @@ const getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
9271
8740
|
};
|
|
9272
8741
|
|
|
9273
8742
|
//#endregion
|
|
9274
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8743
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
9275
8744
|
const getRefs = (options) => {
|
|
9276
8745
|
const _options = getDefaultOptions(options);
|
|
9277
8746
|
const currentPath = _options.name !== void 0 ? [
|
|
@@ -9297,7 +8766,7 @@ const getRefs = (options) => {
|
|
|
9297
8766
|
};
|
|
9298
8767
|
|
|
9299
8768
|
//#endregion
|
|
9300
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8769
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
9301
8770
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
9302
8771
|
if (!refs?.errorMessages) return;
|
|
9303
8772
|
if (errorMessage) res.errorMessage = {
|
|
@@ -9311,7 +8780,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
9311
8780
|
}
|
|
9312
8781
|
|
|
9313
8782
|
//#endregion
|
|
9314
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8783
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
9315
8784
|
const getRelativePath = (pathA, pathB) => {
|
|
9316
8785
|
let i = 0;
|
|
9317
8786
|
for (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;
|
|
@@ -9319,7 +8788,7 @@ const getRelativePath = (pathA, pathB) => {
|
|
|
9319
8788
|
};
|
|
9320
8789
|
|
|
9321
8790
|
//#endregion
|
|
9322
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8791
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
9323
8792
|
function parseAnyDef(refs) {
|
|
9324
8793
|
if (refs.target !== "openAi") return {};
|
|
9325
8794
|
const anyDefinitionPath = [
|
|
@@ -9332,7 +8801,7 @@ function parseAnyDef(refs) {
|
|
|
9332
8801
|
}
|
|
9333
8802
|
|
|
9334
8803
|
//#endregion
|
|
9335
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8804
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
9336
8805
|
function parseArrayDef(def, refs) {
|
|
9337
8806
|
const res = { type: "array" };
|
|
9338
8807
|
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {
|
|
@@ -9349,7 +8818,7 @@ function parseArrayDef(def, refs) {
|
|
|
9349
8818
|
}
|
|
9350
8819
|
|
|
9351
8820
|
//#endregion
|
|
9352
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8821
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
9353
8822
|
function parseBigintDef(def, refs) {
|
|
9354
8823
|
const res = {
|
|
9355
8824
|
type: "integer",
|
|
@@ -9381,25 +8850,25 @@ function parseBigintDef(def, refs) {
|
|
|
9381
8850
|
}
|
|
9382
8851
|
|
|
9383
8852
|
//#endregion
|
|
9384
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8853
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
9385
8854
|
function parseBooleanDef() {
|
|
9386
8855
|
return { type: "boolean" };
|
|
9387
8856
|
}
|
|
9388
8857
|
|
|
9389
8858
|
//#endregion
|
|
9390
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8859
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
9391
8860
|
function parseBrandedDef(_def, refs) {
|
|
9392
8861
|
return parseDef(_def.type._def, refs);
|
|
9393
8862
|
}
|
|
9394
8863
|
|
|
9395
8864
|
//#endregion
|
|
9396
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8865
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
9397
8866
|
const parseCatchDef = (def, refs) => {
|
|
9398
8867
|
return parseDef(def.innerType._def, refs);
|
|
9399
8868
|
};
|
|
9400
8869
|
|
|
9401
8870
|
//#endregion
|
|
9402
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8871
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
9403
8872
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
9404
8873
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
9405
8874
|
if (Array.isArray(strategy)) return { anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)) };
|
|
@@ -9434,7 +8903,7 @@ const integerDateParser = (def, refs) => {
|
|
|
9434
8903
|
};
|
|
9435
8904
|
|
|
9436
8905
|
//#endregion
|
|
9437
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8906
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
9438
8907
|
function parseDefaultDef(_def, refs) {
|
|
9439
8908
|
return {
|
|
9440
8909
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -9443,13 +8912,13 @@ function parseDefaultDef(_def, refs) {
|
|
|
9443
8912
|
}
|
|
9444
8913
|
|
|
9445
8914
|
//#endregion
|
|
9446
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8915
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
9447
8916
|
function parseEffectsDef(_def, refs) {
|
|
9448
8917
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
9449
8918
|
}
|
|
9450
8919
|
|
|
9451
8920
|
//#endregion
|
|
9452
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8921
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
9453
8922
|
function parseEnumDef(def) {
|
|
9454
8923
|
return {
|
|
9455
8924
|
type: "string",
|
|
@@ -9458,7 +8927,7 @@ function parseEnumDef(def) {
|
|
|
9458
8927
|
}
|
|
9459
8928
|
|
|
9460
8929
|
//#endregion
|
|
9461
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8930
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
9462
8931
|
const isJsonSchema7AllOfType = (type) => {
|
|
9463
8932
|
if ("type" in type && type.type === "string") return false;
|
|
9464
8933
|
return "allOf" in type;
|
|
@@ -9501,7 +8970,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
9501
8970
|
}
|
|
9502
8971
|
|
|
9503
8972
|
//#endregion
|
|
9504
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8973
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
9505
8974
|
function parseLiteralDef(def, refs) {
|
|
9506
8975
|
const parsedType = typeof def.value;
|
|
9507
8976
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return { type: Array.isArray(def.value) ? "array" : "object" };
|
|
@@ -9516,7 +8985,7 @@ function parseLiteralDef(def, refs) {
|
|
|
9516
8985
|
}
|
|
9517
8986
|
|
|
9518
8987
|
//#endregion
|
|
9519
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
8988
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
9520
8989
|
let emojiRegex = void 0;
|
|
9521
8990
|
/**
|
|
9522
8991
|
* Generated from the regular expressions found here as of 2024-05-22:
|
|
@@ -9762,7 +9231,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
9762
9231
|
}
|
|
9763
9232
|
|
|
9764
9233
|
//#endregion
|
|
9765
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9234
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
9766
9235
|
function parseRecordDef(def, refs) {
|
|
9767
9236
|
if (refs.target === "openAi") console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
9768
9237
|
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
|
|
@@ -9810,7 +9279,7 @@ function parseRecordDef(def, refs) {
|
|
|
9810
9279
|
}
|
|
9811
9280
|
|
|
9812
9281
|
//#endregion
|
|
9813
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9282
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
9814
9283
|
function parseMapDef(def, refs) {
|
|
9815
9284
|
if (refs.mapStrategy === "record") return parseRecordDef(def, refs);
|
|
9816
9285
|
return {
|
|
@@ -9842,7 +9311,7 @@ function parseMapDef(def, refs) {
|
|
|
9842
9311
|
}
|
|
9843
9312
|
|
|
9844
9313
|
//#endregion
|
|
9845
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9314
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
9846
9315
|
function parseNativeEnumDef(def) {
|
|
9847
9316
|
const object = def.values;
|
|
9848
9317
|
const actualValues = Object.keys(def.values).filter((key) => {
|
|
@@ -9856,7 +9325,7 @@ function parseNativeEnumDef(def) {
|
|
|
9856
9325
|
}
|
|
9857
9326
|
|
|
9858
9327
|
//#endregion
|
|
9859
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9328
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
9860
9329
|
function parseNeverDef(refs) {
|
|
9861
9330
|
return refs.target === "openAi" ? void 0 : { not: parseAnyDef({
|
|
9862
9331
|
...refs,
|
|
@@ -9865,7 +9334,7 @@ function parseNeverDef(refs) {
|
|
|
9865
9334
|
}
|
|
9866
9335
|
|
|
9867
9336
|
//#endregion
|
|
9868
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9337
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
9869
9338
|
function parseNullDef(refs) {
|
|
9870
9339
|
return refs.target === "openApi3" ? {
|
|
9871
9340
|
enum: ["null"],
|
|
@@ -9874,7 +9343,7 @@ function parseNullDef(refs) {
|
|
|
9874
9343
|
}
|
|
9875
9344
|
|
|
9876
9345
|
//#endregion
|
|
9877
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9346
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
9878
9347
|
const primitiveMappings = {
|
|
9879
9348
|
ZodString: "string",
|
|
9880
9349
|
ZodNumber: "number",
|
|
@@ -9931,7 +9400,7 @@ const asAnyOf = (def, refs) => {
|
|
|
9931
9400
|
};
|
|
9932
9401
|
|
|
9933
9402
|
//#endregion
|
|
9934
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9403
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
9935
9404
|
function parseNullableDef(def, refs) {
|
|
9936
9405
|
if ([
|
|
9937
9406
|
"ZodString",
|
|
@@ -9972,7 +9441,7 @@ function parseNullableDef(def, refs) {
|
|
|
9972
9441
|
}
|
|
9973
9442
|
|
|
9974
9443
|
//#endregion
|
|
9975
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9444
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
9976
9445
|
function parseNumberDef(def, refs) {
|
|
9977
9446
|
const res = { type: "number" };
|
|
9978
9447
|
if (!def.checks) return res;
|
|
@@ -10005,7 +9474,7 @@ function parseNumberDef(def, refs) {
|
|
|
10005
9474
|
}
|
|
10006
9475
|
|
|
10007
9476
|
//#endregion
|
|
10008
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9477
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
10009
9478
|
function parseObjectDef(def, refs) {
|
|
10010
9479
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
10011
9480
|
const result = {
|
|
@@ -10065,7 +9534,7 @@ function safeIsOptional(schema) {
|
|
|
10065
9534
|
}
|
|
10066
9535
|
|
|
10067
9536
|
//#endregion
|
|
10068
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9537
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
10069
9538
|
const parseOptionalDef = (def, refs) => {
|
|
10070
9539
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) return parseDef(def.innerType._def, refs);
|
|
10071
9540
|
const innerSchema = parseDef(def.innerType._def, {
|
|
@@ -10080,7 +9549,7 @@ const parseOptionalDef = (def, refs) => {
|
|
|
10080
9549
|
};
|
|
10081
9550
|
|
|
10082
9551
|
//#endregion
|
|
10083
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9552
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
10084
9553
|
const parsePipelineDef = (def, refs) => {
|
|
10085
9554
|
if (refs.pipeStrategy === "input") return parseDef(def.in._def, refs);
|
|
10086
9555
|
else if (refs.pipeStrategy === "output") return parseDef(def.out._def, refs);
|
|
@@ -10103,13 +9572,13 @@ const parsePipelineDef = (def, refs) => {
|
|
|
10103
9572
|
};
|
|
10104
9573
|
|
|
10105
9574
|
//#endregion
|
|
10106
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9575
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
10107
9576
|
function parsePromiseDef(def, refs) {
|
|
10108
9577
|
return parseDef(def.type._def, refs);
|
|
10109
9578
|
}
|
|
10110
9579
|
|
|
10111
9580
|
//#endregion
|
|
10112
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9581
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
10113
9582
|
function parseSetDef(def, refs) {
|
|
10114
9583
|
const schema = {
|
|
10115
9584
|
type: "array",
|
|
@@ -10125,7 +9594,7 @@ function parseSetDef(def, refs) {
|
|
|
10125
9594
|
}
|
|
10126
9595
|
|
|
10127
9596
|
//#endregion
|
|
10128
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9597
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
10129
9598
|
function parseTupleDef(def, refs) {
|
|
10130
9599
|
if (def.rest) return {
|
|
10131
9600
|
type: "array",
|
|
@@ -10159,25 +9628,25 @@ function parseTupleDef(def, refs) {
|
|
|
10159
9628
|
}
|
|
10160
9629
|
|
|
10161
9630
|
//#endregion
|
|
10162
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9631
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
10163
9632
|
function parseUndefinedDef(refs) {
|
|
10164
9633
|
return { not: parseAnyDef(refs) };
|
|
10165
9634
|
}
|
|
10166
9635
|
|
|
10167
9636
|
//#endregion
|
|
10168
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9637
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
10169
9638
|
function parseUnknownDef(refs) {
|
|
10170
9639
|
return parseAnyDef(refs);
|
|
10171
9640
|
}
|
|
10172
9641
|
|
|
10173
9642
|
//#endregion
|
|
10174
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9643
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
10175
9644
|
const parseReadonlyDef = (def, refs) => {
|
|
10176
9645
|
return parseDef(def.innerType._def, refs);
|
|
10177
9646
|
};
|
|
10178
9647
|
|
|
10179
9648
|
//#endregion
|
|
10180
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9649
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
10181
9650
|
const selectParser = (def, typeName, refs) => {
|
|
10182
9651
|
switch (typeName) {
|
|
10183
9652
|
case ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);
|
|
@@ -10221,7 +9690,7 @@ const selectParser = (def, typeName, refs) => {
|
|
|
10221
9690
|
};
|
|
10222
9691
|
|
|
10223
9692
|
//#endregion
|
|
10224
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9693
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
10225
9694
|
function parseDef(def, refs, forceResolution = false) {
|
|
10226
9695
|
const seenItem = refs.seen.get(def);
|
|
10227
9696
|
if (refs.override) {
|
|
@@ -10271,7 +9740,7 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
10271
9740
|
};
|
|
10272
9741
|
|
|
10273
9742
|
//#endregion
|
|
10274
|
-
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+
|
|
9743
|
+
//#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
10275
9744
|
const zodToJsonSchema = (schema, options) => {
|
|
10276
9745
|
const refs = getRefs(options);
|
|
10277
9746
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
@@ -12741,7 +12210,7 @@ var StdioServerTransport = class {
|
|
|
12741
12210
|
|
|
12742
12211
|
//#endregion
|
|
12743
12212
|
//#region package.json
|
|
12744
|
-
var version = "0.7.
|
|
12213
|
+
var version = "0.7.3";
|
|
12745
12214
|
|
|
12746
12215
|
//#endregion
|
|
12747
12216
|
//#region src/api-reference.ts
|
|
@@ -12761,7 +12230,7 @@ count.update(n => n + 1) // 6
|
|
|
12761
12230
|
|
|
12762
12231
|
// Read without subscribing:
|
|
12763
12232
|
count.peek() // 6`,
|
|
12764
|
-
notes: "Signals are callable functions, NOT .value getters. Components run once — signal reads in JSX auto-subscribe.",
|
|
12233
|
+
notes: "Signals are callable functions, NOT .value getters. Components run once — signal reads in JSX auto-subscribe. Optional { name } for debugging — auto-injected by @pyreon/vite-plugin in dev mode.",
|
|
12765
12234
|
mistakes: `- \`count.value\` → Use \`count()\` to read
|
|
12766
12235
|
- \`{count}\` in JSX → Use \`{count()}\` to read (or let the compiler wrap it)
|
|
12767
12236
|
- \`const [val, setVal] = signal(0)\` → Not destructurable. Use \`const val = signal(0)\``
|
|
@@ -12803,6 +12272,17 @@ effect(() => {
|
|
|
12803
12272
|
notes: "Returns a dispose function. Dependencies auto-tracked on each run. Use onCleanup() inside to register cleanup that runs before re-execution. For DOM-specific effects, use renderEffect().",
|
|
12804
12273
|
mistakes: `- Don't pass a dependency array — Pyreon auto-tracks
|
|
12805
12274
|
- \`effect(() => { count })\` → Must call: \`effect(() => { count() })\``
|
|
12275
|
+
},
|
|
12276
|
+
"reactivity/onCleanup": {
|
|
12277
|
+
signature: "onCleanup(fn: () => void): void",
|
|
12278
|
+
example: `effect(() => {
|
|
12279
|
+
const handler = () => console.log(count())
|
|
12280
|
+
window.addEventListener("resize", handler)
|
|
12281
|
+
onCleanup(() => window.removeEventListener("resize", handler))
|
|
12282
|
+
})`,
|
|
12283
|
+
notes: "Registers a cleanup function inside an effect. Runs between re-executions (before the effect re-runs) and when the effect is disposed.",
|
|
12284
|
+
mistakes: `- Using onCleanup outside an effect — it only works inside effect() or renderEffect()
|
|
12285
|
+
- Confusing with onUnmount — onCleanup is for effects, onUnmount is for components`
|
|
12806
12286
|
},
|
|
12807
12287
|
"reactivity/batch": {
|
|
12808
12288
|
signature: "batch(fn: () => void): void",
|
|
@@ -12901,6 +12381,34 @@ const Child = () => {
|
|
|
12901
12381
|
signature: "useContext<T>(ctx: Context<T>): T",
|
|
12902
12382
|
example: `const theme = useContext(ThemeContext) // returns provided value or default`
|
|
12903
12383
|
},
|
|
12384
|
+
"core/provide": {
|
|
12385
|
+
signature: "provide<T>(ctx: Context<T>, value: T): void",
|
|
12386
|
+
example: `const ThemeCtx = createContext<"light" | "dark">("light")
|
|
12387
|
+
|
|
12388
|
+
function App() {
|
|
12389
|
+
provide(ThemeCtx, "dark")
|
|
12390
|
+
return <Child />
|
|
12391
|
+
}`,
|
|
12392
|
+
notes: "Pushes a context value and auto-cleans up on unmount. Preferred over manual pushContext/popContext. Must be called during component setup."
|
|
12393
|
+
},
|
|
12394
|
+
"core/ExtractProps": {
|
|
12395
|
+
signature: "type ExtractProps<T> = T extends ComponentFn<infer P> ? P : T",
|
|
12396
|
+
example: `const Greet: ComponentFn<{ name: string }> = ({ name }) => <h1>{name}</h1>
|
|
12397
|
+
|
|
12398
|
+
type Props = ExtractProps<typeof Greet>
|
|
12399
|
+
// { name: string }`,
|
|
12400
|
+
notes: "Extracts the props type from a ComponentFn. Passes through unchanged if T is not a ComponentFn."
|
|
12401
|
+
},
|
|
12402
|
+
"core/HigherOrderComponent": {
|
|
12403
|
+
signature: "type HigherOrderComponent<HOP, P> = ComponentFn<HOP & P>",
|
|
12404
|
+
example: `function withLogger<P>(Wrapped: ComponentFn<P>): HigherOrderComponent<{ logLevel?: string }, P> {
|
|
12405
|
+
return (props) => {
|
|
12406
|
+
console.log(\`[\${props.logLevel ?? "info"}] Rendering\`)
|
|
12407
|
+
return <Wrapped {...props} />
|
|
12408
|
+
}
|
|
12409
|
+
}`,
|
|
12410
|
+
notes: "Typed HOC pattern — HOP is the props the HOC adds, P is the wrapped component's own props."
|
|
12411
|
+
},
|
|
12904
12412
|
"core/For": {
|
|
12905
12413
|
signature: "<For each={items} by={keyFn}>{renderFn}</For>",
|
|
12906
12414
|
example: `const items = signal([
|