@swmansion/argent 0.8.0 → 0.9.0
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/bin/ax-service +0 -0
- package/dist/argent-android-devtools-0.1.0.apk +0 -0
- package/dist/installer.mjs +379 -27
- package/dist/mcp-server.mjs +2194 -669
- package/dist/tool-server.cjs +21453 -5693
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/manifest.json +7 -0
- package/package.json +2 -1
- package/rules/argent.md +8 -2
- package/skills/argent-device-interact/SKILL.md +11 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +2 -0
- package/skills/argent-screenshot-diff/SKILL.md +67 -0
- package/skills/argent-test-ui-flow/SKILL.md +38 -16
package/dist/mcp-server.mjs
CHANGED
|
@@ -72,12 +72,12 @@ var require_code = __commonJS({
|
|
|
72
72
|
return item === "" || item === '""';
|
|
73
73
|
}
|
|
74
74
|
get str() {
|
|
75
|
-
var
|
|
76
|
-
return (
|
|
75
|
+
var _a3;
|
|
76
|
+
return (_a3 = this._str) !== null && _a3 !== void 0 ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
|
|
77
77
|
}
|
|
78
78
|
get names() {
|
|
79
|
-
var
|
|
80
|
-
return (
|
|
79
|
+
var _a3;
|
|
80
|
+
return (_a3 = this._names) !== null && _a3 !== void 0 ? _a3 : this._names = this._items.reduce((names, c) => {
|
|
81
81
|
if (c instanceof Name)
|
|
82
82
|
names[c.str] = (names[c.str] || 0) + 1;
|
|
83
83
|
return names;
|
|
@@ -223,8 +223,8 @@ var require_scope = __commonJS({
|
|
|
223
223
|
return `${prefix}${ng.index++}`;
|
|
224
224
|
}
|
|
225
225
|
_nameGroup(prefix) {
|
|
226
|
-
var
|
|
227
|
-
if (((_b = (
|
|
226
|
+
var _a3, _b;
|
|
227
|
+
if (((_b = (_a3 = this._parent) === null || _a3 === void 0 ? void 0 : _a3._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
|
|
228
228
|
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
229
229
|
}
|
|
230
230
|
return this._names[prefix] = { prefix, index: 0 };
|
|
@@ -257,12 +257,12 @@ var require_scope = __commonJS({
|
|
|
257
257
|
return new ValueScopeName(prefix, this._newName(prefix));
|
|
258
258
|
}
|
|
259
259
|
value(nameOrPrefix, value) {
|
|
260
|
-
var
|
|
260
|
+
var _a3;
|
|
261
261
|
if (value.ref === void 0)
|
|
262
262
|
throw new Error("CodeGen: ref must be passed in value");
|
|
263
263
|
const name = this.toName(nameOrPrefix);
|
|
264
264
|
const { prefix } = name;
|
|
265
|
-
const valueKey = (
|
|
265
|
+
const valueKey = (_a3 = value.key) !== null && _a3 !== void 0 ? _a3 : value.ref;
|
|
266
266
|
let vs = this._values[prefix];
|
|
267
267
|
if (vs) {
|
|
268
268
|
const _name = vs.get(valueKey);
|
|
@@ -580,8 +580,8 @@ var require_codegen = __commonJS({
|
|
|
580
580
|
return this;
|
|
581
581
|
}
|
|
582
582
|
optimizeNames(names, constants) {
|
|
583
|
-
var
|
|
584
|
-
this.else = (
|
|
583
|
+
var _a3;
|
|
584
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
585
585
|
if (!(super.optimizeNames(names, constants) || this.else))
|
|
586
586
|
return;
|
|
587
587
|
this.condition = optimizeExpr(this.condition, names, constants);
|
|
@@ -685,16 +685,16 @@ var require_codegen = __commonJS({
|
|
|
685
685
|
return code;
|
|
686
686
|
}
|
|
687
687
|
optimizeNodes() {
|
|
688
|
-
var
|
|
688
|
+
var _a3, _b;
|
|
689
689
|
super.optimizeNodes();
|
|
690
|
-
(
|
|
690
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNodes();
|
|
691
691
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
692
692
|
return this;
|
|
693
693
|
}
|
|
694
694
|
optimizeNames(names, constants) {
|
|
695
|
-
var
|
|
695
|
+
var _a3, _b;
|
|
696
696
|
super.optimizeNames(names, constants);
|
|
697
|
-
(
|
|
697
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
698
698
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
|
|
699
699
|
return this;
|
|
700
700
|
}
|
|
@@ -1474,8 +1474,8 @@ var require_applicability = __commonJS({
|
|
|
1474
1474
|
}
|
|
1475
1475
|
exports.shouldUseGroup = shouldUseGroup;
|
|
1476
1476
|
function shouldUseRule(schema, rule) {
|
|
1477
|
-
var
|
|
1478
|
-
return schema[rule.keyword] !== void 0 || ((
|
|
1477
|
+
var _a3;
|
|
1478
|
+
return schema[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema[kwd] !== void 0));
|
|
1479
1479
|
}
|
|
1480
1480
|
exports.shouldUseRule = shouldUseRule;
|
|
1481
1481
|
}
|
|
@@ -1863,14 +1863,14 @@ var require_keyword = __commonJS({
|
|
|
1863
1863
|
}
|
|
1864
1864
|
exports.macroKeywordCode = macroKeywordCode;
|
|
1865
1865
|
function funcKeywordCode(cxt, def) {
|
|
1866
|
-
var
|
|
1866
|
+
var _a3;
|
|
1867
1867
|
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
|
1868
1868
|
checkAsyncKeyword(it, def);
|
|
1869
1869
|
const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
|
1870
1870
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
1871
1871
|
const valid = gen.let("valid");
|
|
1872
1872
|
cxt.block$data(valid, validateKeyword);
|
|
1873
|
-
cxt.ok((
|
|
1873
|
+
cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid);
|
|
1874
1874
|
function validateKeyword() {
|
|
1875
1875
|
if (def.errors === false) {
|
|
1876
1876
|
assignValid();
|
|
@@ -1901,8 +1901,8 @@ var require_keyword = __commonJS({
|
|
|
1901
1901
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
1902
1902
|
}
|
|
1903
1903
|
function reportErrs(errors) {
|
|
1904
|
-
var
|
|
1905
|
-
gen.if((0, codegen_1.not)((
|
|
1904
|
+
var _a4;
|
|
1905
|
+
gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid), errors);
|
|
1906
1906
|
}
|
|
1907
1907
|
}
|
|
1908
1908
|
exports.funcKeywordCode = funcKeywordCode;
|
|
@@ -2870,7 +2870,7 @@ var require_compile = __commonJS({
|
|
|
2870
2870
|
var validate_1 = require_validate();
|
|
2871
2871
|
var SchemaEnv = class {
|
|
2872
2872
|
constructor(env) {
|
|
2873
|
-
var
|
|
2873
|
+
var _a3;
|
|
2874
2874
|
this.refs = {};
|
|
2875
2875
|
this.dynamicAnchors = {};
|
|
2876
2876
|
let schema;
|
|
@@ -2879,7 +2879,7 @@ var require_compile = __commonJS({
|
|
|
2879
2879
|
this.schema = env.schema;
|
|
2880
2880
|
this.schemaId = env.schemaId;
|
|
2881
2881
|
this.root = env.root || this;
|
|
2882
|
-
this.baseId = (
|
|
2882
|
+
this.baseId = (_a3 = env.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
2883
2883
|
this.schemaPath = env.schemaPath;
|
|
2884
2884
|
this.localRefs = env.localRefs;
|
|
2885
2885
|
this.meta = env.meta;
|
|
@@ -2975,14 +2975,14 @@ var require_compile = __commonJS({
|
|
|
2975
2975
|
}
|
|
2976
2976
|
exports.compileSchema = compileSchema;
|
|
2977
2977
|
function resolveRef(root, baseId, ref) {
|
|
2978
|
-
var
|
|
2978
|
+
var _a3;
|
|
2979
2979
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
2980
2980
|
const schOrFunc = root.refs[ref];
|
|
2981
2981
|
if (schOrFunc)
|
|
2982
2982
|
return schOrFunc;
|
|
2983
2983
|
let _sch = resolve.call(this, root, ref);
|
|
2984
2984
|
if (_sch === void 0) {
|
|
2985
|
-
const schema = (
|
|
2985
|
+
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
2986
2986
|
const { schemaId } = this.opts;
|
|
2987
2987
|
if (schema)
|
|
2988
2988
|
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
@@ -3051,8 +3051,8 @@ var require_compile = __commonJS({
|
|
|
3051
3051
|
"definitions"
|
|
3052
3052
|
]);
|
|
3053
3053
|
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
3054
|
-
var
|
|
3055
|
-
if (((
|
|
3054
|
+
var _a3;
|
|
3055
|
+
if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/")
|
|
3056
3056
|
return;
|
|
3057
3057
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
3058
3058
|
if (typeof schema === "boolean")
|
|
@@ -4000,9 +4000,9 @@ var require_core = __commonJS({
|
|
|
4000
4000
|
};
|
|
4001
4001
|
var MAX_EXPRESSION = 200;
|
|
4002
4002
|
function requiredOptions(o) {
|
|
4003
|
-
var
|
|
4003
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
4004
4004
|
const s = o.strict;
|
|
4005
|
-
const _optz = (
|
|
4005
|
+
const _optz = (_a3 = o.code) === null || _a3 === void 0 ? void 0 : _a3.optimize;
|
|
4006
4006
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
4007
4007
|
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
4008
4008
|
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
@@ -4060,19 +4060,19 @@ var require_core = __commonJS({
|
|
|
4060
4060
|
this.addKeyword("$async");
|
|
4061
4061
|
}
|
|
4062
4062
|
_addDefaultMetaSchema() {
|
|
4063
|
-
const { $data, meta, schemaId } = this.opts;
|
|
4063
|
+
const { $data, meta: meta2, schemaId } = this.opts;
|
|
4064
4064
|
let _dataRefSchema = $dataRefSchema;
|
|
4065
4065
|
if (schemaId === "id") {
|
|
4066
4066
|
_dataRefSchema = { ...$dataRefSchema };
|
|
4067
4067
|
_dataRefSchema.id = _dataRefSchema.$id;
|
|
4068
4068
|
delete _dataRefSchema.$id;
|
|
4069
4069
|
}
|
|
4070
|
-
if (
|
|
4070
|
+
if (meta2 && $data)
|
|
4071
4071
|
this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
4072
4072
|
}
|
|
4073
4073
|
defaultMeta() {
|
|
4074
|
-
const { meta, schemaId } = this.opts;
|
|
4075
|
-
return this.opts.defaultMeta = typeof
|
|
4074
|
+
const { meta: meta2, schemaId } = this.opts;
|
|
4075
|
+
return this.opts.defaultMeta = typeof meta2 == "object" ? meta2[schemaId] || meta2 : void 0;
|
|
4076
4076
|
}
|
|
4077
4077
|
validate(schemaKeyRef, data) {
|
|
4078
4078
|
let v;
|
|
@@ -4092,12 +4092,12 @@ var require_core = __commonJS({
|
|
|
4092
4092
|
const sch = this._addSchema(schema, _meta);
|
|
4093
4093
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
4094
4094
|
}
|
|
4095
|
-
compileAsync(schema,
|
|
4095
|
+
compileAsync(schema, meta2) {
|
|
4096
4096
|
if (typeof this.opts.loadSchema != "function") {
|
|
4097
4097
|
throw new Error("options.loadSchema should be a function");
|
|
4098
4098
|
}
|
|
4099
4099
|
const { loadSchema } = this.opts;
|
|
4100
|
-
return runCompileAsync.call(this, schema,
|
|
4100
|
+
return runCompileAsync.call(this, schema, meta2);
|
|
4101
4101
|
async function runCompileAsync(_schema, _meta) {
|
|
4102
4102
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
4103
4103
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -4129,7 +4129,7 @@ var require_core = __commonJS({
|
|
|
4129
4129
|
if (!this.refs[ref])
|
|
4130
4130
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
4131
4131
|
if (!this.refs[ref])
|
|
4132
|
-
this.addSchema(_schema, ref,
|
|
4132
|
+
this.addSchema(_schema, ref, meta2);
|
|
4133
4133
|
}
|
|
4134
4134
|
async function _loadSchema(ref) {
|
|
4135
4135
|
const p = this._loading[ref];
|
|
@@ -4346,7 +4346,7 @@ var require_core = __commonJS({
|
|
|
4346
4346
|
}
|
|
4347
4347
|
}
|
|
4348
4348
|
}
|
|
4349
|
-
_addSchema(schema,
|
|
4349
|
+
_addSchema(schema, meta2, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
4350
4350
|
let id;
|
|
4351
4351
|
const { schemaId } = this.opts;
|
|
4352
4352
|
if (typeof schema == "object") {
|
|
@@ -4362,7 +4362,7 @@ var require_core = __commonJS({
|
|
|
4362
4362
|
return sch;
|
|
4363
4363
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
4364
4364
|
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
4365
|
-
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
4365
|
+
sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta2, baseId, localRefs });
|
|
4366
4366
|
this._cache.set(sch.schema, sch);
|
|
4367
4367
|
if (addSchema && !baseId.startsWith("#")) {
|
|
4368
4368
|
if (baseId)
|
|
@@ -4476,7 +4476,7 @@ var require_core = __commonJS({
|
|
|
4476
4476
|
}
|
|
4477
4477
|
}
|
|
4478
4478
|
function addRule(keyword, definition, dataType) {
|
|
4479
|
-
var
|
|
4479
|
+
var _a3;
|
|
4480
4480
|
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
4481
4481
|
if (dataType && post)
|
|
4482
4482
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -4502,7 +4502,7 @@ var require_core = __commonJS({
|
|
|
4502
4502
|
else
|
|
4503
4503
|
ruleGroup.rules.push(rule);
|
|
4504
4504
|
RULES.all[keyword] = rule;
|
|
4505
|
-
(
|
|
4505
|
+
(_a3 = definition.implements) === null || _a3 === void 0 ? void 0 : _a3.forEach((kwd) => this.addKeyword(kwd));
|
|
4506
4506
|
}
|
|
4507
4507
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
4508
4508
|
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
@@ -4636,10 +4636,10 @@ var require_ref = __commonJS({
|
|
|
4636
4636
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
4637
4637
|
}
|
|
4638
4638
|
function addEvaluatedFrom(source) {
|
|
4639
|
-
var
|
|
4639
|
+
var _a3;
|
|
4640
4640
|
if (!it.opts.unevaluated)
|
|
4641
4641
|
return;
|
|
4642
|
-
const schEvaluated = (
|
|
4642
|
+
const schEvaluated = (_a3 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a3 === void 0 ? void 0 : _a3.evaluated;
|
|
4643
4643
|
if (it.props !== true) {
|
|
4644
4644
|
if (schEvaluated && !schEvaluated.dynamicProps) {
|
|
4645
4645
|
if (schEvaluated.props !== void 0) {
|
|
@@ -6290,7 +6290,7 @@ var require_discriminator = __commonJS({
|
|
|
6290
6290
|
return _valid;
|
|
6291
6291
|
}
|
|
6292
6292
|
function getMapping() {
|
|
6293
|
-
var
|
|
6293
|
+
var _a3;
|
|
6294
6294
|
const oneOfMapping = {};
|
|
6295
6295
|
const topRequired = hasRequired(parentSchema);
|
|
6296
6296
|
let tagRequired = true;
|
|
@@ -6304,7 +6304,7 @@ var require_discriminator = __commonJS({
|
|
|
6304
6304
|
if (sch === void 0)
|
|
6305
6305
|
throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
|
|
6306
6306
|
}
|
|
6307
|
-
const propSch = (
|
|
6307
|
+
const propSch = (_a3 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a3 === void 0 ? void 0 : _a3[tagName];
|
|
6308
6308
|
if (typeof propSch != "object") {
|
|
6309
6309
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
6310
6310
|
}
|
|
@@ -6873,9 +6873,9 @@ var require_dist = __commonJS({
|
|
|
6873
6873
|
return f;
|
|
6874
6874
|
};
|
|
6875
6875
|
function addFormats(ajv, list, fs2, exportName) {
|
|
6876
|
-
var
|
|
6876
|
+
var _a3;
|
|
6877
6877
|
var _b;
|
|
6878
|
-
(
|
|
6878
|
+
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6879
6879
|
for (const f of list)
|
|
6880
6880
|
ajv.addFormat(f, fs2[f]);
|
|
6881
6881
|
}
|
|
@@ -6891,39 +6891,46 @@ import { dirname } from "node:path";
|
|
|
6891
6891
|
import { homedir as homedir2 } from "node:os";
|
|
6892
6892
|
|
|
6893
6893
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
6894
|
-
import
|
|
6894
|
+
import process3 from "node:process";
|
|
6895
6895
|
|
|
6896
6896
|
// ../../node_modules/zod/v4/core/core.js
|
|
6897
|
-
var
|
|
6898
|
-
status: "aborted"
|
|
6899
|
-
});
|
|
6897
|
+
var _a;
|
|
6900
6898
|
// @__NO_SIDE_EFFECTS__
|
|
6901
6899
|
function $constructor(name, initializer3, params) {
|
|
6902
6900
|
function init(inst, def) {
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6901
|
+
if (!inst._zod) {
|
|
6902
|
+
Object.defineProperty(inst, "_zod", {
|
|
6903
|
+
value: {
|
|
6904
|
+
def,
|
|
6905
|
+
constr: _,
|
|
6906
|
+
traits: /* @__PURE__ */ new Set()
|
|
6907
|
+
},
|
|
6908
|
+
enumerable: false
|
|
6909
|
+
});
|
|
6910
|
+
}
|
|
6911
|
+
if (inst._zod.traits.has(name)) {
|
|
6912
|
+
return;
|
|
6913
|
+
}
|
|
6909
6914
|
inst._zod.traits.add(name);
|
|
6910
6915
|
initializer3(inst, def);
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6916
|
+
const proto = _.prototype;
|
|
6917
|
+
const keys = Object.keys(proto);
|
|
6918
|
+
for (let i = 0; i < keys.length; i++) {
|
|
6919
|
+
const k = keys[i];
|
|
6920
|
+
if (!(k in inst)) {
|
|
6921
|
+
inst[k] = proto[k].bind(inst);
|
|
6922
|
+
}
|
|
6914
6923
|
}
|
|
6915
|
-
inst._zod.constr = _;
|
|
6916
|
-
inst._zod.def = def;
|
|
6917
6924
|
}
|
|
6918
6925
|
const Parent = params?.Parent ?? Object;
|
|
6919
6926
|
class Definition extends Parent {
|
|
6920
6927
|
}
|
|
6921
6928
|
Object.defineProperty(Definition, "name", { value: name });
|
|
6922
6929
|
function _(def) {
|
|
6923
|
-
var
|
|
6930
|
+
var _a3;
|
|
6924
6931
|
const inst = params?.Parent ? new Definition() : this;
|
|
6925
6932
|
init(inst, def);
|
|
6926
|
-
(
|
|
6933
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
6927
6934
|
for (const fn of inst._zod.deferred) {
|
|
6928
6935
|
fn();
|
|
6929
6936
|
}
|
|
@@ -6945,7 +6952,14 @@ var $ZodAsyncError = class extends Error {
|
|
|
6945
6952
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
6946
6953
|
}
|
|
6947
6954
|
};
|
|
6948
|
-
var
|
|
6955
|
+
var $ZodEncodeError = class extends Error {
|
|
6956
|
+
constructor(name) {
|
|
6957
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
6958
|
+
this.name = "ZodEncodeError";
|
|
6959
|
+
}
|
|
6960
|
+
};
|
|
6961
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
6962
|
+
var globalConfig = globalThis.__zod_globalConfig;
|
|
6949
6963
|
function config(newConfig) {
|
|
6950
6964
|
if (newConfig)
|
|
6951
6965
|
Object.assign(globalConfig, newConfig);
|
|
@@ -6966,15 +6980,19 @@ __export(util_exports, {
|
|
|
6966
6980
|
assertNever: () => assertNever,
|
|
6967
6981
|
assertNotEqual: () => assertNotEqual,
|
|
6968
6982
|
assignProp: () => assignProp,
|
|
6983
|
+
base64ToUint8Array: () => base64ToUint8Array,
|
|
6984
|
+
base64urlToUint8Array: () => base64urlToUint8Array,
|
|
6969
6985
|
cached: () => cached,
|
|
6970
6986
|
captureStackTrace: () => captureStackTrace,
|
|
6971
6987
|
cleanEnum: () => cleanEnum,
|
|
6972
6988
|
cleanRegex: () => cleanRegex,
|
|
6973
6989
|
clone: () => clone,
|
|
6990
|
+
cloneDef: () => cloneDef,
|
|
6974
6991
|
createTransparentProxy: () => createTransparentProxy,
|
|
6975
6992
|
defineLazy: () => defineLazy,
|
|
6976
6993
|
esc: () => esc,
|
|
6977
6994
|
escapeRegex: () => escapeRegex,
|
|
6995
|
+
explicitlyAborted: () => explicitlyAborted,
|
|
6978
6996
|
extend: () => extend,
|
|
6979
6997
|
finalizeIssue: () => finalizeIssue,
|
|
6980
6998
|
floatSafeRemainder: () => floatSafeRemainder,
|
|
@@ -6983,17 +7001,21 @@ __export(util_exports, {
|
|
|
6983
7001
|
getLengthableOrigin: () => getLengthableOrigin,
|
|
6984
7002
|
getParsedType: () => getParsedType,
|
|
6985
7003
|
getSizableOrigin: () => getSizableOrigin,
|
|
7004
|
+
hexToUint8Array: () => hexToUint8Array,
|
|
6986
7005
|
isObject: () => isObject,
|
|
6987
7006
|
isPlainObject: () => isPlainObject,
|
|
6988
7007
|
issue: () => issue,
|
|
6989
7008
|
joinValues: () => joinValues,
|
|
6990
7009
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
6991
7010
|
merge: () => merge,
|
|
7011
|
+
mergeDefs: () => mergeDefs,
|
|
6992
7012
|
normalizeParams: () => normalizeParams,
|
|
6993
7013
|
nullish: () => nullish,
|
|
6994
7014
|
numKeys: () => numKeys,
|
|
7015
|
+
objectClone: () => objectClone,
|
|
6995
7016
|
omit: () => omit,
|
|
6996
7017
|
optionalKeys: () => optionalKeys,
|
|
7018
|
+
parsedType: () => parsedType,
|
|
6997
7019
|
partial: () => partial,
|
|
6998
7020
|
pick: () => pick,
|
|
6999
7021
|
prefixIssues: () => prefixIssues,
|
|
@@ -7002,7 +7024,13 @@ __export(util_exports, {
|
|
|
7002
7024
|
propertyKeyTypes: () => propertyKeyTypes,
|
|
7003
7025
|
randomString: () => randomString,
|
|
7004
7026
|
required: () => required,
|
|
7027
|
+
safeExtend: () => safeExtend,
|
|
7028
|
+
shallowClone: () => shallowClone,
|
|
7029
|
+
slugify: () => slugify,
|
|
7005
7030
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
7031
|
+
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
7032
|
+
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
7033
|
+
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
7006
7034
|
unwrapMessage: () => unwrapMessage
|
|
7007
7035
|
});
|
|
7008
7036
|
function assertEqual(val) {
|
|
@@ -7014,7 +7042,7 @@ function assertNotEqual(val) {
|
|
|
7014
7042
|
function assertIs(_arg) {
|
|
7015
7043
|
}
|
|
7016
7044
|
function assertNever(_x) {
|
|
7017
|
-
throw new Error();
|
|
7045
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
7018
7046
|
}
|
|
7019
7047
|
function assert(_) {
|
|
7020
7048
|
}
|
|
@@ -7053,23 +7081,26 @@ function cleanRegex(source) {
|
|
|
7053
7081
|
return source.slice(start, end);
|
|
7054
7082
|
}
|
|
7055
7083
|
function floatSafeRemainder(val, step) {
|
|
7056
|
-
const
|
|
7057
|
-
const
|
|
7058
|
-
const
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
return
|
|
7062
|
-
}
|
|
7084
|
+
const ratio = val / step;
|
|
7085
|
+
const roundedRatio = Math.round(ratio);
|
|
7086
|
+
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
7087
|
+
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
7088
|
+
return 0;
|
|
7089
|
+
return ratio - roundedRatio;
|
|
7090
|
+
}
|
|
7091
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
7063
7092
|
function defineLazy(object3, key, getter) {
|
|
7064
|
-
|
|
7093
|
+
let value = void 0;
|
|
7065
7094
|
Object.defineProperty(object3, key, {
|
|
7066
7095
|
get() {
|
|
7067
|
-
if (
|
|
7068
|
-
|
|
7069
|
-
object3[key] = value;
|
|
7070
|
-
return value;
|
|
7096
|
+
if (value === EVALUATING) {
|
|
7097
|
+
return void 0;
|
|
7071
7098
|
}
|
|
7072
|
-
|
|
7099
|
+
if (value === void 0) {
|
|
7100
|
+
value = EVALUATING;
|
|
7101
|
+
value = getter();
|
|
7102
|
+
}
|
|
7103
|
+
return value;
|
|
7073
7104
|
},
|
|
7074
7105
|
set(v) {
|
|
7075
7106
|
Object.defineProperty(object3, key, {
|
|
@@ -7080,6 +7111,9 @@ function defineLazy(object3, key, getter) {
|
|
|
7080
7111
|
configurable: true
|
|
7081
7112
|
});
|
|
7082
7113
|
}
|
|
7114
|
+
function objectClone(obj) {
|
|
7115
|
+
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
7116
|
+
}
|
|
7083
7117
|
function assignProp(target, prop, value) {
|
|
7084
7118
|
Object.defineProperty(target, prop, {
|
|
7085
7119
|
value,
|
|
@@ -7088,6 +7122,17 @@ function assignProp(target, prop, value) {
|
|
|
7088
7122
|
configurable: true
|
|
7089
7123
|
});
|
|
7090
7124
|
}
|
|
7125
|
+
function mergeDefs(...defs) {
|
|
7126
|
+
const mergedDescriptors = {};
|
|
7127
|
+
for (const def of defs) {
|
|
7128
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
7129
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
7130
|
+
}
|
|
7131
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
7132
|
+
}
|
|
7133
|
+
function cloneDef(schema) {
|
|
7134
|
+
return mergeDefs(schema._zod.def);
|
|
7135
|
+
}
|
|
7091
7136
|
function getElementAtPath(obj, path2) {
|
|
7092
7137
|
if (!path2)
|
|
7093
7138
|
return obj;
|
|
@@ -7115,12 +7160,18 @@ function randomString(length = 10) {
|
|
|
7115
7160
|
function esc(str) {
|
|
7116
7161
|
return JSON.stringify(str);
|
|
7117
7162
|
}
|
|
7118
|
-
|
|
7163
|
+
function slugify(input) {
|
|
7164
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
7165
|
+
}
|
|
7166
|
+
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
7119
7167
|
};
|
|
7120
7168
|
function isObject(data) {
|
|
7121
7169
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
7122
7170
|
}
|
|
7123
|
-
var allowsEval = cached(() => {
|
|
7171
|
+
var allowsEval = /* @__PURE__ */ cached(() => {
|
|
7172
|
+
if (globalConfig.jitless) {
|
|
7173
|
+
return false;
|
|
7174
|
+
}
|
|
7124
7175
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
7125
7176
|
return false;
|
|
7126
7177
|
}
|
|
@@ -7138,6 +7189,8 @@ function isPlainObject(o) {
|
|
|
7138
7189
|
const ctor = o.constructor;
|
|
7139
7190
|
if (ctor === void 0)
|
|
7140
7191
|
return true;
|
|
7192
|
+
if (typeof ctor !== "function")
|
|
7193
|
+
return true;
|
|
7141
7194
|
const prot = ctor.prototype;
|
|
7142
7195
|
if (isObject(prot) === false)
|
|
7143
7196
|
return false;
|
|
@@ -7146,6 +7199,17 @@ function isPlainObject(o) {
|
|
|
7146
7199
|
}
|
|
7147
7200
|
return true;
|
|
7148
7201
|
}
|
|
7202
|
+
function shallowClone(o) {
|
|
7203
|
+
if (isPlainObject(o))
|
|
7204
|
+
return { ...o };
|
|
7205
|
+
if (Array.isArray(o))
|
|
7206
|
+
return [...o];
|
|
7207
|
+
if (o instanceof Map)
|
|
7208
|
+
return new Map(o);
|
|
7209
|
+
if (o instanceof Set)
|
|
7210
|
+
return new Set(o);
|
|
7211
|
+
return o;
|
|
7212
|
+
}
|
|
7149
7213
|
function numKeys(data) {
|
|
7150
7214
|
let keyCount = 0;
|
|
7151
7215
|
for (const key in data) {
|
|
@@ -7200,7 +7264,14 @@ var getParsedType = (data) => {
|
|
|
7200
7264
|
}
|
|
7201
7265
|
};
|
|
7202
7266
|
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
7203
|
-
var primitiveTypes = /* @__PURE__ */ new Set([
|
|
7267
|
+
var primitiveTypes = /* @__PURE__ */ new Set([
|
|
7268
|
+
"string",
|
|
7269
|
+
"number",
|
|
7270
|
+
"bigint",
|
|
7271
|
+
"boolean",
|
|
7272
|
+
"symbol",
|
|
7273
|
+
"undefined"
|
|
7274
|
+
]);
|
|
7204
7275
|
function escapeRegex(str) {
|
|
7205
7276
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7206
7277
|
}
|
|
@@ -7283,138 +7354,201 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
7283
7354
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
7284
7355
|
};
|
|
7285
7356
|
function pick(schema, mask) {
|
|
7286
|
-
const newShape = {};
|
|
7287
7357
|
const currDef = schema._zod.def;
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
if (!mask[key])
|
|
7293
|
-
continue;
|
|
7294
|
-
newShape[key] = currDef.shape[key];
|
|
7358
|
+
const checks = currDef.checks;
|
|
7359
|
+
const hasChecks = checks && checks.length > 0;
|
|
7360
|
+
if (hasChecks) {
|
|
7361
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
7295
7362
|
}
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7363
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7364
|
+
get shape() {
|
|
7365
|
+
const newShape = {};
|
|
7366
|
+
for (const key in mask) {
|
|
7367
|
+
if (!(key in currDef.shape)) {
|
|
7368
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
7369
|
+
}
|
|
7370
|
+
if (!mask[key])
|
|
7371
|
+
continue;
|
|
7372
|
+
newShape[key] = currDef.shape[key];
|
|
7373
|
+
}
|
|
7374
|
+
assignProp(this, "shape", newShape);
|
|
7375
|
+
return newShape;
|
|
7376
|
+
},
|
|
7299
7377
|
checks: []
|
|
7300
7378
|
});
|
|
7379
|
+
return clone(schema, def);
|
|
7301
7380
|
}
|
|
7302
7381
|
function omit(schema, mask) {
|
|
7303
|
-
const newShape = { ...schema._zod.def.shape };
|
|
7304
7382
|
const currDef = schema._zod.def;
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
if (!mask[key])
|
|
7310
|
-
continue;
|
|
7311
|
-
delete newShape[key];
|
|
7383
|
+
const checks = currDef.checks;
|
|
7384
|
+
const hasChecks = checks && checks.length > 0;
|
|
7385
|
+
if (hasChecks) {
|
|
7386
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
7312
7387
|
}
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7388
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7389
|
+
get shape() {
|
|
7390
|
+
const newShape = { ...schema._zod.def.shape };
|
|
7391
|
+
for (const key in mask) {
|
|
7392
|
+
if (!(key in currDef.shape)) {
|
|
7393
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
7394
|
+
}
|
|
7395
|
+
if (!mask[key])
|
|
7396
|
+
continue;
|
|
7397
|
+
delete newShape[key];
|
|
7398
|
+
}
|
|
7399
|
+
assignProp(this, "shape", newShape);
|
|
7400
|
+
return newShape;
|
|
7401
|
+
},
|
|
7316
7402
|
checks: []
|
|
7317
7403
|
});
|
|
7404
|
+
return clone(schema, def);
|
|
7318
7405
|
}
|
|
7319
7406
|
function extend(schema, shape) {
|
|
7320
7407
|
if (!isPlainObject(shape)) {
|
|
7321
7408
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
7322
7409
|
}
|
|
7323
|
-
const
|
|
7324
|
-
|
|
7410
|
+
const checks = schema._zod.def.checks;
|
|
7411
|
+
const hasChecks = checks && checks.length > 0;
|
|
7412
|
+
if (hasChecks) {
|
|
7413
|
+
const existingShape = schema._zod.def.shape;
|
|
7414
|
+
for (const key in shape) {
|
|
7415
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
7416
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7325
7421
|
get shape() {
|
|
7326
7422
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
7327
7423
|
assignProp(this, "shape", _shape);
|
|
7328
7424
|
return _shape;
|
|
7329
|
-
}
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7425
|
+
}
|
|
7426
|
+
});
|
|
7427
|
+
return clone(schema, def);
|
|
7428
|
+
}
|
|
7429
|
+
function safeExtend(schema, shape) {
|
|
7430
|
+
if (!isPlainObject(shape)) {
|
|
7431
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
7432
|
+
}
|
|
7433
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7434
|
+
get shape() {
|
|
7435
|
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
7436
|
+
assignProp(this, "shape", _shape);
|
|
7437
|
+
return _shape;
|
|
7438
|
+
}
|
|
7439
|
+
});
|
|
7333
7440
|
return clone(schema, def);
|
|
7334
7441
|
}
|
|
7335
7442
|
function merge(a, b) {
|
|
7336
|
-
|
|
7337
|
-
|
|
7443
|
+
if (a._zod.def.checks?.length) {
|
|
7444
|
+
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
7445
|
+
}
|
|
7446
|
+
const def = mergeDefs(a._zod.def, {
|
|
7338
7447
|
get shape() {
|
|
7339
7448
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
7340
7449
|
assignProp(this, "shape", _shape);
|
|
7341
7450
|
return _shape;
|
|
7342
7451
|
},
|
|
7343
|
-
catchall
|
|
7344
|
-
|
|
7345
|
-
|
|
7452
|
+
get catchall() {
|
|
7453
|
+
return b._zod.def.catchall;
|
|
7454
|
+
},
|
|
7455
|
+
checks: b._zod.def.checks ?? []
|
|
7346
7456
|
});
|
|
7457
|
+
return clone(a, def);
|
|
7347
7458
|
}
|
|
7348
7459
|
function partial(Class2, schema, mask) {
|
|
7349
|
-
const
|
|
7350
|
-
const
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
7355
|
-
}
|
|
7356
|
-
if (!mask[key])
|
|
7357
|
-
continue;
|
|
7358
|
-
shape[key] = Class2 ? new Class2({
|
|
7359
|
-
type: "optional",
|
|
7360
|
-
innerType: oldShape[key]
|
|
7361
|
-
}) : oldShape[key];
|
|
7362
|
-
}
|
|
7363
|
-
} else {
|
|
7364
|
-
for (const key in oldShape) {
|
|
7365
|
-
shape[key] = Class2 ? new Class2({
|
|
7366
|
-
type: "optional",
|
|
7367
|
-
innerType: oldShape[key]
|
|
7368
|
-
}) : oldShape[key];
|
|
7369
|
-
}
|
|
7460
|
+
const currDef = schema._zod.def;
|
|
7461
|
+
const checks = currDef.checks;
|
|
7462
|
+
const hasChecks = checks && checks.length > 0;
|
|
7463
|
+
if (hasChecks) {
|
|
7464
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
7370
7465
|
}
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7466
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7467
|
+
get shape() {
|
|
7468
|
+
const oldShape = schema._zod.def.shape;
|
|
7469
|
+
const shape = { ...oldShape };
|
|
7470
|
+
if (mask) {
|
|
7471
|
+
for (const key in mask) {
|
|
7472
|
+
if (!(key in oldShape)) {
|
|
7473
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
7474
|
+
}
|
|
7475
|
+
if (!mask[key])
|
|
7476
|
+
continue;
|
|
7477
|
+
shape[key] = Class2 ? new Class2({
|
|
7478
|
+
type: "optional",
|
|
7479
|
+
innerType: oldShape[key]
|
|
7480
|
+
}) : oldShape[key];
|
|
7481
|
+
}
|
|
7482
|
+
} else {
|
|
7483
|
+
for (const key in oldShape) {
|
|
7484
|
+
shape[key] = Class2 ? new Class2({
|
|
7485
|
+
type: "optional",
|
|
7486
|
+
innerType: oldShape[key]
|
|
7487
|
+
}) : oldShape[key];
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
assignProp(this, "shape", shape);
|
|
7491
|
+
return shape;
|
|
7492
|
+
},
|
|
7374
7493
|
checks: []
|
|
7375
7494
|
});
|
|
7495
|
+
return clone(schema, def);
|
|
7376
7496
|
}
|
|
7377
7497
|
function required(Class2, schema, mask) {
|
|
7378
|
-
const
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
if (
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7498
|
+
const def = mergeDefs(schema._zod.def, {
|
|
7499
|
+
get shape() {
|
|
7500
|
+
const oldShape = schema._zod.def.shape;
|
|
7501
|
+
const shape = { ...oldShape };
|
|
7502
|
+
if (mask) {
|
|
7503
|
+
for (const key in mask) {
|
|
7504
|
+
if (!(key in shape)) {
|
|
7505
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
7506
|
+
}
|
|
7507
|
+
if (!mask[key])
|
|
7508
|
+
continue;
|
|
7509
|
+
shape[key] = new Class2({
|
|
7510
|
+
type: "nonoptional",
|
|
7511
|
+
innerType: oldShape[key]
|
|
7512
|
+
});
|
|
7513
|
+
}
|
|
7514
|
+
} else {
|
|
7515
|
+
for (const key in oldShape) {
|
|
7516
|
+
shape[key] = new Class2({
|
|
7517
|
+
type: "nonoptional",
|
|
7518
|
+
innerType: oldShape[key]
|
|
7519
|
+
});
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
assignProp(this, "shape", shape);
|
|
7523
|
+
return shape;
|
|
7398
7524
|
}
|
|
7399
|
-
}
|
|
7400
|
-
return clone(schema, {
|
|
7401
|
-
...schema._zod.def,
|
|
7402
|
-
shape,
|
|
7403
|
-
// optional: [],
|
|
7404
|
-
checks: []
|
|
7405
7525
|
});
|
|
7526
|
+
return clone(schema, def);
|
|
7406
7527
|
}
|
|
7407
7528
|
function aborted(x, startIndex = 0) {
|
|
7529
|
+
if (x.aborted === true)
|
|
7530
|
+
return true;
|
|
7531
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
7532
|
+
if (x.issues[i]?.continue !== true) {
|
|
7533
|
+
return true;
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7536
|
+
return false;
|
|
7537
|
+
}
|
|
7538
|
+
function explicitlyAborted(x, startIndex = 0) {
|
|
7539
|
+
if (x.aborted === true)
|
|
7540
|
+
return true;
|
|
7408
7541
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
7409
|
-
if (x.issues[i]?.continue
|
|
7542
|
+
if (x.issues[i]?.continue === false) {
|
|
7410
7543
|
return true;
|
|
7544
|
+
}
|
|
7411
7545
|
}
|
|
7412
7546
|
return false;
|
|
7413
7547
|
}
|
|
7414
7548
|
function prefixIssues(path2, issues) {
|
|
7415
7549
|
return issues.map((iss) => {
|
|
7416
|
-
var
|
|
7417
|
-
(
|
|
7550
|
+
var _a3;
|
|
7551
|
+
(_a3 = iss).path ?? (_a3.path = []);
|
|
7418
7552
|
iss.path.unshift(path2);
|
|
7419
7553
|
return iss;
|
|
7420
7554
|
});
|
|
@@ -7423,17 +7557,14 @@ function unwrapMessage(message) {
|
|
|
7423
7557
|
return typeof message === "string" ? message : message?.message;
|
|
7424
7558
|
}
|
|
7425
7559
|
function finalizeIssue(iss, ctx, config2) {
|
|
7426
|
-
const
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7560
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
7561
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
7562
|
+
rest.path ?? (rest.path = []);
|
|
7563
|
+
rest.message = message;
|
|
7564
|
+
if (ctx?.reportInput) {
|
|
7565
|
+
rest.input = _input;
|
|
7430
7566
|
}
|
|
7431
|
-
|
|
7432
|
-
delete full.continue;
|
|
7433
|
-
if (!ctx?.reportInput) {
|
|
7434
|
-
delete full.input;
|
|
7435
|
-
}
|
|
7436
|
-
return full;
|
|
7567
|
+
return rest;
|
|
7437
7568
|
}
|
|
7438
7569
|
function getSizableOrigin(input) {
|
|
7439
7570
|
if (input instanceof Set)
|
|
@@ -7451,6 +7582,27 @@ function getLengthableOrigin(input) {
|
|
|
7451
7582
|
return "string";
|
|
7452
7583
|
return "unknown";
|
|
7453
7584
|
}
|
|
7585
|
+
function parsedType(data) {
|
|
7586
|
+
const t = typeof data;
|
|
7587
|
+
switch (t) {
|
|
7588
|
+
case "number": {
|
|
7589
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
7590
|
+
}
|
|
7591
|
+
case "object": {
|
|
7592
|
+
if (data === null) {
|
|
7593
|
+
return "null";
|
|
7594
|
+
}
|
|
7595
|
+
if (Array.isArray(data)) {
|
|
7596
|
+
return "array";
|
|
7597
|
+
}
|
|
7598
|
+
const obj = data;
|
|
7599
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
7600
|
+
return obj.constructor.name;
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
return t;
|
|
7605
|
+
}
|
|
7454
7606
|
function issue(...args) {
|
|
7455
7607
|
const [iss, input, inst] = args;
|
|
7456
7608
|
if (typeof iss === "string") {
|
|
@@ -7468,6 +7620,43 @@ function cleanEnum(obj) {
|
|
|
7468
7620
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
7469
7621
|
}).map((el) => el[1]);
|
|
7470
7622
|
}
|
|
7623
|
+
function base64ToUint8Array(base642) {
|
|
7624
|
+
const binaryString = atob(base642);
|
|
7625
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
7626
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
7627
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
7628
|
+
}
|
|
7629
|
+
return bytes;
|
|
7630
|
+
}
|
|
7631
|
+
function uint8ArrayToBase64(bytes) {
|
|
7632
|
+
let binaryString = "";
|
|
7633
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
7634
|
+
binaryString += String.fromCharCode(bytes[i]);
|
|
7635
|
+
}
|
|
7636
|
+
return btoa(binaryString);
|
|
7637
|
+
}
|
|
7638
|
+
function base64urlToUint8Array(base64url2) {
|
|
7639
|
+
const base642 = base64url2.replace(/-/g, "+").replace(/_/g, "/");
|
|
7640
|
+
const padding = "=".repeat((4 - base642.length % 4) % 4);
|
|
7641
|
+
return base64ToUint8Array(base642 + padding);
|
|
7642
|
+
}
|
|
7643
|
+
function uint8ArrayToBase64url(bytes) {
|
|
7644
|
+
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
7645
|
+
}
|
|
7646
|
+
function hexToUint8Array(hex) {
|
|
7647
|
+
const cleanHex = hex.replace(/^0x/, "");
|
|
7648
|
+
if (cleanHex.length % 2 !== 0) {
|
|
7649
|
+
throw new Error("Invalid hex string length");
|
|
7650
|
+
}
|
|
7651
|
+
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
7652
|
+
for (let i = 0; i < cleanHex.length; i += 2) {
|
|
7653
|
+
bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
|
7654
|
+
}
|
|
7655
|
+
return bytes;
|
|
7656
|
+
}
|
|
7657
|
+
function uint8ArrayToHex(bytes) {
|
|
7658
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7659
|
+
}
|
|
7471
7660
|
var Class = class {
|
|
7472
7661
|
constructor(..._args) {
|
|
7473
7662
|
}
|
|
@@ -7484,13 +7673,7 @@ var initializer = (inst, def) => {
|
|
|
7484
7673
|
value: def,
|
|
7485
7674
|
enumerable: false
|
|
7486
7675
|
});
|
|
7487
|
-
|
|
7488
|
-
get() {
|
|
7489
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
7490
|
-
},
|
|
7491
|
-
enumerable: true
|
|
7492
|
-
// configurable: false,
|
|
7493
|
-
});
|
|
7676
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
7494
7677
|
Object.defineProperty(inst, "toString", {
|
|
7495
7678
|
value: () => inst.message,
|
|
7496
7679
|
enumerable: false
|
|
@@ -7511,35 +7694,35 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
7511
7694
|
}
|
|
7512
7695
|
return { formErrors, fieldErrors };
|
|
7513
7696
|
}
|
|
7514
|
-
function formatError(error2,
|
|
7515
|
-
const mapper = _mapper || function(issue2) {
|
|
7516
|
-
return issue2.message;
|
|
7517
|
-
};
|
|
7697
|
+
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
7518
7698
|
const fieldErrors = { _errors: [] };
|
|
7519
|
-
const processError = (error3) => {
|
|
7699
|
+
const processError = (error3, path2 = []) => {
|
|
7520
7700
|
for (const issue2 of error3.issues) {
|
|
7521
7701
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
7522
|
-
issue2.errors.map((issues) => processError({ issues }));
|
|
7702
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
7523
7703
|
} else if (issue2.code === "invalid_key") {
|
|
7524
|
-
processError({ issues: issue2.issues });
|
|
7704
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
7525
7705
|
} else if (issue2.code === "invalid_element") {
|
|
7526
|
-
processError({ issues: issue2.issues });
|
|
7527
|
-
} else if (issue2.path.length === 0) {
|
|
7528
|
-
fieldErrors._errors.push(mapper(issue2));
|
|
7706
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
7529
7707
|
} else {
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7708
|
+
const fullpath = [...path2, ...issue2.path];
|
|
7709
|
+
if (fullpath.length === 0) {
|
|
7710
|
+
fieldErrors._errors.push(mapper(issue2));
|
|
7711
|
+
} else {
|
|
7712
|
+
let curr = fieldErrors;
|
|
7713
|
+
let i = 0;
|
|
7714
|
+
while (i < fullpath.length) {
|
|
7715
|
+
const el = fullpath[i];
|
|
7716
|
+
const terminal = i === fullpath.length - 1;
|
|
7717
|
+
if (!terminal) {
|
|
7718
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
7719
|
+
} else {
|
|
7720
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
7721
|
+
curr[el]._errors.push(mapper(issue2));
|
|
7722
|
+
}
|
|
7723
|
+
curr = curr[el];
|
|
7724
|
+
i++;
|
|
7540
7725
|
}
|
|
7541
|
-
curr = curr[el];
|
|
7542
|
-
i++;
|
|
7543
7726
|
}
|
|
7544
7727
|
}
|
|
7545
7728
|
}
|
|
@@ -7550,7 +7733,7 @@ function formatError(error2, _mapper) {
|
|
|
7550
7733
|
|
|
7551
7734
|
// ../../node_modules/zod/v4/core/parse.js
|
|
7552
7735
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
7553
|
-
const ctx = _ctx ?
|
|
7736
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
7554
7737
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
7555
7738
|
if (result instanceof Promise) {
|
|
7556
7739
|
throw new $ZodAsyncError();
|
|
@@ -7563,7 +7746,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
7563
7746
|
return result.value;
|
|
7564
7747
|
};
|
|
7565
7748
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
7566
|
-
const ctx = _ctx ?
|
|
7749
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
7567
7750
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
7568
7751
|
if (result instanceof Promise)
|
|
7569
7752
|
result = await result;
|
|
@@ -7587,7 +7770,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
7587
7770
|
};
|
|
7588
7771
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
7589
7772
|
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7590
|
-
const ctx = _ctx ?
|
|
7773
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
7591
7774
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
7592
7775
|
if (result instanceof Promise)
|
|
7593
7776
|
result = await result;
|
|
@@ -7597,9 +7780,37 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
7597
7780
|
} : { success: true, data: result.value };
|
|
7598
7781
|
};
|
|
7599
7782
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
7783
|
+
var _encode = (_Err) => (schema, value, _ctx) => {
|
|
7784
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7785
|
+
return _parse(_Err)(schema, value, ctx);
|
|
7786
|
+
};
|
|
7787
|
+
var _decode = (_Err) => (schema, value, _ctx) => {
|
|
7788
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
7789
|
+
};
|
|
7790
|
+
var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7791
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7792
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
7793
|
+
};
|
|
7794
|
+
var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7795
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
7796
|
+
};
|
|
7797
|
+
var _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
7798
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7799
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
7800
|
+
};
|
|
7801
|
+
var _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
7802
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
7803
|
+
};
|
|
7804
|
+
var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7805
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
7806
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
7807
|
+
};
|
|
7808
|
+
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
7809
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
7810
|
+
};
|
|
7600
7811
|
|
|
7601
7812
|
// ../../node_modules/zod/v4/core/regexes.js
|
|
7602
|
-
var cuid = /^[cC][
|
|
7813
|
+
var cuid = /^[cC][0-9a-z]{6,}$/;
|
|
7603
7814
|
var cuid2 = /^[0-9a-z]+$/;
|
|
7604
7815
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
7605
7816
|
var xid = /^[0-9a-vA-V]{20}$/;
|
|
@@ -7609,7 +7820,7 @@ var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)
|
|
|
7609
7820
|
var 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})$/;
|
|
7610
7821
|
var uuid = (version2) => {
|
|
7611
7822
|
if (!version2)
|
|
7612
|
-
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)$/;
|
|
7823
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
7613
7824
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
7614
7825
|
};
|
|
7615
7826
|
var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
@@ -7618,13 +7829,13 @@ function emoji() {
|
|
|
7618
7829
|
return new RegExp(_emoji, "u");
|
|
7619
7830
|
}
|
|
7620
7831
|
var 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])$/;
|
|
7621
|
-
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
7832
|
+
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
7622
7833
|
var 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])$/;
|
|
7623
7834
|
var 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])$/;
|
|
7624
7835
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
7625
7836
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
7626
|
-
var
|
|
7627
|
-
var e164 = /^\+
|
|
7837
|
+
var httpProtocol = /^https?$/;
|
|
7838
|
+
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
7628
7839
|
var 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])))`;
|
|
7629
7840
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
7630
7841
|
function timeSource(args) {
|
|
@@ -7641,7 +7852,7 @@ function datetime(args) {
|
|
|
7641
7852
|
if (args.local)
|
|
7642
7853
|
opts.push("");
|
|
7643
7854
|
if (args.offset)
|
|
7644
|
-
opts.push(`([+-]\\d
|
|
7855
|
+
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
7645
7856
|
const timeRegex = `${time3}(?:${opts.join("|")})`;
|
|
7646
7857
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
7647
7858
|
}
|
|
@@ -7649,19 +7860,19 @@ var string = (params) => {
|
|
|
7649
7860
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
7650
7861
|
return new RegExp(`^${regex}$`);
|
|
7651
7862
|
};
|
|
7652
|
-
var integer =
|
|
7653
|
-
var number = /^-?\d+(?:\.\d+)
|
|
7654
|
-
var boolean =
|
|
7655
|
-
var _null =
|
|
7863
|
+
var integer = /^-?\d+$/;
|
|
7864
|
+
var number = /^-?\d+(?:\.\d+)?$/;
|
|
7865
|
+
var boolean = /^(?:true|false)$/i;
|
|
7866
|
+
var _null = /^null$/i;
|
|
7656
7867
|
var lowercase = /^[^A-Z]*$/;
|
|
7657
7868
|
var uppercase = /^[^a-z]*$/;
|
|
7658
7869
|
|
|
7659
7870
|
// ../../node_modules/zod/v4/core/checks.js
|
|
7660
7871
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
7661
|
-
var
|
|
7872
|
+
var _a3;
|
|
7662
7873
|
inst._zod ?? (inst._zod = {});
|
|
7663
7874
|
inst._zod.def = def;
|
|
7664
|
-
(
|
|
7875
|
+
(_a3 = inst._zod).onattach ?? (_a3.onattach = []);
|
|
7665
7876
|
});
|
|
7666
7877
|
var numericOriginMap = {
|
|
7667
7878
|
number: "number",
|
|
@@ -7688,7 +7899,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
7688
7899
|
payload.issues.push({
|
|
7689
7900
|
origin,
|
|
7690
7901
|
code: "too_big",
|
|
7691
|
-
maximum: def.value,
|
|
7902
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
7692
7903
|
input: payload.value,
|
|
7693
7904
|
inclusive: def.inclusive,
|
|
7694
7905
|
inst,
|
|
@@ -7716,7 +7927,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
7716
7927
|
payload.issues.push({
|
|
7717
7928
|
origin,
|
|
7718
7929
|
code: "too_small",
|
|
7719
|
-
minimum: def.value,
|
|
7930
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
7720
7931
|
input: payload.value,
|
|
7721
7932
|
inclusive: def.inclusive,
|
|
7722
7933
|
inst,
|
|
@@ -7727,8 +7938,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
7727
7938
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
7728
7939
|
$ZodCheck.init(inst, def);
|
|
7729
7940
|
inst._zod.onattach.push((inst2) => {
|
|
7730
|
-
var
|
|
7731
|
-
(
|
|
7941
|
+
var _a3;
|
|
7942
|
+
(_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
|
|
7732
7943
|
});
|
|
7733
7944
|
inst._zod.check = (payload) => {
|
|
7734
7945
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -7768,6 +7979,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
7768
7979
|
expected: origin,
|
|
7769
7980
|
format: def.format,
|
|
7770
7981
|
code: "invalid_type",
|
|
7982
|
+
continue: false,
|
|
7771
7983
|
input,
|
|
7772
7984
|
inst
|
|
7773
7985
|
});
|
|
@@ -7782,6 +7994,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
7782
7994
|
note: "Integers must be within the safe integer range.",
|
|
7783
7995
|
inst,
|
|
7784
7996
|
origin,
|
|
7997
|
+
inclusive: true,
|
|
7785
7998
|
continue: !def.abort
|
|
7786
7999
|
});
|
|
7787
8000
|
} else {
|
|
@@ -7792,6 +8005,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
7792
8005
|
note: "Integers must be within the safe integer range.",
|
|
7793
8006
|
inst,
|
|
7794
8007
|
origin,
|
|
8008
|
+
inclusive: true,
|
|
7795
8009
|
continue: !def.abort
|
|
7796
8010
|
});
|
|
7797
8011
|
}
|
|
@@ -7815,15 +8029,17 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
7815
8029
|
input,
|
|
7816
8030
|
code: "too_big",
|
|
7817
8031
|
maximum,
|
|
7818
|
-
|
|
8032
|
+
inclusive: true,
|
|
8033
|
+
inst,
|
|
8034
|
+
continue: !def.abort
|
|
7819
8035
|
});
|
|
7820
8036
|
}
|
|
7821
8037
|
};
|
|
7822
8038
|
});
|
|
7823
8039
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
7824
|
-
var
|
|
8040
|
+
var _a3;
|
|
7825
8041
|
$ZodCheck.init(inst, def);
|
|
7826
|
-
(
|
|
8042
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
7827
8043
|
const val = payload.value;
|
|
7828
8044
|
return !nullish(val) && val.length !== void 0;
|
|
7829
8045
|
});
|
|
@@ -7850,9 +8066,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
7850
8066
|
};
|
|
7851
8067
|
});
|
|
7852
8068
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
7853
|
-
var
|
|
8069
|
+
var _a3;
|
|
7854
8070
|
$ZodCheck.init(inst, def);
|
|
7855
|
-
(
|
|
8071
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
7856
8072
|
const val = payload.value;
|
|
7857
8073
|
return !nullish(val) && val.length !== void 0;
|
|
7858
8074
|
});
|
|
@@ -7879,9 +8095,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
7879
8095
|
};
|
|
7880
8096
|
});
|
|
7881
8097
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
7882
|
-
var
|
|
8098
|
+
var _a3;
|
|
7883
8099
|
$ZodCheck.init(inst, def);
|
|
7884
|
-
(
|
|
8100
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
7885
8101
|
const val = payload.value;
|
|
7886
8102
|
return !nullish(val) && val.length !== void 0;
|
|
7887
8103
|
});
|
|
@@ -7910,7 +8126,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
7910
8126
|
};
|
|
7911
8127
|
});
|
|
7912
8128
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
7913
|
-
var
|
|
8129
|
+
var _a3, _b;
|
|
7914
8130
|
$ZodCheck.init(inst, def);
|
|
7915
8131
|
inst._zod.onattach.push((inst2) => {
|
|
7916
8132
|
const bag = inst2._zod.bag;
|
|
@@ -7921,7 +8137,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
7921
8137
|
}
|
|
7922
8138
|
});
|
|
7923
8139
|
if (def.pattern)
|
|
7924
|
-
(
|
|
8140
|
+
(_a3 = inst._zod).check ?? (_a3.check = (payload) => {
|
|
7925
8141
|
def.pattern.lastIndex = 0;
|
|
7926
8142
|
if (def.pattern.test(payload.value))
|
|
7927
8143
|
return;
|
|
@@ -8080,13 +8296,13 @@ var Doc = class {
|
|
|
8080
8296
|
// ../../node_modules/zod/v4/core/versions.js
|
|
8081
8297
|
var version = {
|
|
8082
8298
|
major: 4,
|
|
8083
|
-
minor:
|
|
8084
|
-
patch:
|
|
8299
|
+
minor: 4,
|
|
8300
|
+
patch: 3
|
|
8085
8301
|
};
|
|
8086
8302
|
|
|
8087
8303
|
// ../../node_modules/zod/v4/core/schemas.js
|
|
8088
8304
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
8089
|
-
var
|
|
8305
|
+
var _a3;
|
|
8090
8306
|
inst ?? (inst = {});
|
|
8091
8307
|
inst._zod.def = def;
|
|
8092
8308
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -8101,7 +8317,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
8101
8317
|
}
|
|
8102
8318
|
}
|
|
8103
8319
|
if (checks.length === 0) {
|
|
8104
|
-
(
|
|
8320
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
8105
8321
|
inst._zod.deferred?.push(() => {
|
|
8106
8322
|
inst._zod.run = inst._zod.parse;
|
|
8107
8323
|
});
|
|
@@ -8111,6 +8327,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
8111
8327
|
let asyncResult;
|
|
8112
8328
|
for (const ch of checks2) {
|
|
8113
8329
|
if (ch._zod.def.when) {
|
|
8330
|
+
if (explicitlyAborted(payload))
|
|
8331
|
+
continue;
|
|
8114
8332
|
const shouldRun = ch._zod.def.when(payload);
|
|
8115
8333
|
if (!shouldRun)
|
|
8116
8334
|
continue;
|
|
@@ -8146,7 +8364,32 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
8146
8364
|
}
|
|
8147
8365
|
return payload;
|
|
8148
8366
|
};
|
|
8367
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
8368
|
+
if (aborted(canary)) {
|
|
8369
|
+
canary.aborted = true;
|
|
8370
|
+
return canary;
|
|
8371
|
+
}
|
|
8372
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
8373
|
+
if (checkResult instanceof Promise) {
|
|
8374
|
+
if (ctx.async === false)
|
|
8375
|
+
throw new $ZodAsyncError();
|
|
8376
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
8377
|
+
}
|
|
8378
|
+
return inst._zod.parse(checkResult, ctx);
|
|
8379
|
+
};
|
|
8149
8380
|
inst._zod.run = (payload, ctx) => {
|
|
8381
|
+
if (ctx.skipChecks) {
|
|
8382
|
+
return inst._zod.parse(payload, ctx);
|
|
8383
|
+
}
|
|
8384
|
+
if (ctx.direction === "backward") {
|
|
8385
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
8386
|
+
if (canary instanceof Promise) {
|
|
8387
|
+
return canary.then((canary2) => {
|
|
8388
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
8389
|
+
});
|
|
8390
|
+
}
|
|
8391
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
8392
|
+
}
|
|
8150
8393
|
const result = inst._zod.parse(payload, ctx);
|
|
8151
8394
|
if (result instanceof Promise) {
|
|
8152
8395
|
if (ctx.async === false)
|
|
@@ -8156,7 +8399,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
8156
8399
|
return runChecks(result, checks, ctx);
|
|
8157
8400
|
};
|
|
8158
8401
|
}
|
|
8159
|
-
inst
|
|
8402
|
+
defineLazy(inst, "~standard", () => ({
|
|
8160
8403
|
validate: (value) => {
|
|
8161
8404
|
try {
|
|
8162
8405
|
const r = safeParse(inst, value);
|
|
@@ -8167,7 +8410,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
8167
8410
|
},
|
|
8168
8411
|
vendor: "zod",
|
|
8169
8412
|
version: 1
|
|
8170
|
-
};
|
|
8413
|
+
}));
|
|
8171
8414
|
});
|
|
8172
8415
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
8173
8416
|
$ZodType.init(inst, def);
|
|
@@ -8225,9 +8468,21 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
8225
8468
|
$ZodStringFormat.init(inst, def);
|
|
8226
8469
|
inst._zod.check = (payload) => {
|
|
8227
8470
|
try {
|
|
8228
|
-
const
|
|
8229
|
-
|
|
8230
|
-
|
|
8471
|
+
const trimmed = payload.value.trim();
|
|
8472
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
8473
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
8474
|
+
payload.issues.push({
|
|
8475
|
+
code: "invalid_format",
|
|
8476
|
+
format: "url",
|
|
8477
|
+
note: "Invalid URL format",
|
|
8478
|
+
input: payload.value,
|
|
8479
|
+
inst,
|
|
8480
|
+
continue: !def.abort
|
|
8481
|
+
});
|
|
8482
|
+
return;
|
|
8483
|
+
}
|
|
8484
|
+
}
|
|
8485
|
+
const url = new URL(trimmed);
|
|
8231
8486
|
if (def.hostname) {
|
|
8232
8487
|
def.hostname.lastIndex = 0;
|
|
8233
8488
|
if (!def.hostname.test(url.hostname)) {
|
|
@@ -8235,7 +8490,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
8235
8490
|
code: "invalid_format",
|
|
8236
8491
|
format: "url",
|
|
8237
8492
|
note: "Invalid hostname",
|
|
8238
|
-
pattern: hostname.source,
|
|
8493
|
+
pattern: def.hostname.source,
|
|
8239
8494
|
input: payload.value,
|
|
8240
8495
|
inst,
|
|
8241
8496
|
continue: !def.abort
|
|
@@ -8256,10 +8511,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
8256
8511
|
});
|
|
8257
8512
|
}
|
|
8258
8513
|
}
|
|
8259
|
-
if (
|
|
8260
|
-
payload.value = href
|
|
8514
|
+
if (def.normalize) {
|
|
8515
|
+
payload.value = url.href;
|
|
8261
8516
|
} else {
|
|
8262
|
-
payload.value =
|
|
8517
|
+
payload.value = trimmed;
|
|
8263
8518
|
}
|
|
8264
8519
|
return;
|
|
8265
8520
|
} catch (_) {
|
|
@@ -8320,18 +8575,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
8320
8575
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
8321
8576
|
def.pattern ?? (def.pattern = ipv4);
|
|
8322
8577
|
$ZodStringFormat.init(inst, def);
|
|
8323
|
-
inst._zod.
|
|
8324
|
-
const bag = inst2._zod.bag;
|
|
8325
|
-
bag.format = `ipv4`;
|
|
8326
|
-
});
|
|
8578
|
+
inst._zod.bag.format = `ipv4`;
|
|
8327
8579
|
});
|
|
8328
8580
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
8329
8581
|
def.pattern ?? (def.pattern = ipv6);
|
|
8330
8582
|
$ZodStringFormat.init(inst, def);
|
|
8331
|
-
inst._zod.
|
|
8332
|
-
const bag = inst2._zod.bag;
|
|
8333
|
-
bag.format = `ipv6`;
|
|
8334
|
-
});
|
|
8583
|
+
inst._zod.bag.format = `ipv6`;
|
|
8335
8584
|
inst._zod.check = (payload) => {
|
|
8336
8585
|
try {
|
|
8337
8586
|
new URL(`http://[${payload.value}]`);
|
|
@@ -8354,8 +8603,11 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
8354
8603
|
def.pattern ?? (def.pattern = cidrv6);
|
|
8355
8604
|
$ZodStringFormat.init(inst, def);
|
|
8356
8605
|
inst._zod.check = (payload) => {
|
|
8357
|
-
const
|
|
8606
|
+
const parts = payload.value.split("/");
|
|
8358
8607
|
try {
|
|
8608
|
+
if (parts.length !== 2)
|
|
8609
|
+
throw new Error();
|
|
8610
|
+
const [address, prefix] = parts;
|
|
8359
8611
|
if (!prefix)
|
|
8360
8612
|
throw new Error();
|
|
8361
8613
|
const prefixNum = Number(prefix);
|
|
@@ -8378,6 +8630,8 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
8378
8630
|
function isValidBase64(data) {
|
|
8379
8631
|
if (data === "")
|
|
8380
8632
|
return true;
|
|
8633
|
+
if (/\s/.test(data))
|
|
8634
|
+
return false;
|
|
8381
8635
|
if (data.length % 4 !== 0)
|
|
8382
8636
|
return false;
|
|
8383
8637
|
try {
|
|
@@ -8390,9 +8644,7 @@ function isValidBase64(data) {
|
|
|
8390
8644
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
8391
8645
|
def.pattern ?? (def.pattern = base64);
|
|
8392
8646
|
$ZodStringFormat.init(inst, def);
|
|
8393
|
-
inst._zod.
|
|
8394
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
8395
|
-
});
|
|
8647
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
8396
8648
|
inst._zod.check = (payload) => {
|
|
8397
8649
|
if (isValidBase64(payload.value))
|
|
8398
8650
|
return;
|
|
@@ -8415,9 +8667,7 @@ function isValidBase64URL(data) {
|
|
|
8415
8667
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
8416
8668
|
def.pattern ?? (def.pattern = base64url);
|
|
8417
8669
|
$ZodStringFormat.init(inst, def);
|
|
8418
|
-
inst._zod.
|
|
8419
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
8420
|
-
});
|
|
8670
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
8421
8671
|
inst._zod.check = (payload) => {
|
|
8422
8672
|
if (isValidBase64URL(payload.value))
|
|
8423
8673
|
return;
|
|
@@ -8492,7 +8742,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
8492
8742
|
return payload;
|
|
8493
8743
|
};
|
|
8494
8744
|
});
|
|
8495
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
8745
|
+
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
8496
8746
|
$ZodCheckNumberFormat.init(inst, def);
|
|
8497
8747
|
$ZodNumber.init(inst, def);
|
|
8498
8748
|
});
|
|
@@ -8589,48 +8839,102 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
8589
8839
|
return payload;
|
|
8590
8840
|
};
|
|
8591
8841
|
});
|
|
8592
|
-
function
|
|
8842
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
8843
|
+
const isPresent = key in input;
|
|
8593
8844
|
if (result.issues.length) {
|
|
8845
|
+
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
8846
|
+
return;
|
|
8847
|
+
}
|
|
8594
8848
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
8595
8849
|
}
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
}
|
|
8604
|
-
final.value[key] = result.value;
|
|
8605
|
-
}
|
|
8606
|
-
} else {
|
|
8607
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
8850
|
+
if (!isPresent && !isOptionalIn) {
|
|
8851
|
+
if (!result.issues.length) {
|
|
8852
|
+
final.issues.push({
|
|
8853
|
+
code: "invalid_type",
|
|
8854
|
+
expected: "nonoptional",
|
|
8855
|
+
input: void 0,
|
|
8856
|
+
path: [key]
|
|
8857
|
+
});
|
|
8608
8858
|
}
|
|
8609
|
-
|
|
8610
|
-
|
|
8859
|
+
return;
|
|
8860
|
+
}
|
|
8861
|
+
if (result.value === void 0) {
|
|
8862
|
+
if (isPresent) {
|
|
8611
8863
|
final.value[key] = void 0;
|
|
8864
|
+
}
|
|
8612
8865
|
} else {
|
|
8613
8866
|
final.value[key] = result.value;
|
|
8614
8867
|
}
|
|
8615
8868
|
}
|
|
8869
|
+
function normalizeDef(def) {
|
|
8870
|
+
const keys = Object.keys(def.shape);
|
|
8871
|
+
for (const k of keys) {
|
|
8872
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
8873
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
8874
|
+
}
|
|
8875
|
+
}
|
|
8876
|
+
const okeys = optionalKeys(def.shape);
|
|
8877
|
+
return {
|
|
8878
|
+
...def,
|
|
8879
|
+
keys,
|
|
8880
|
+
keySet: new Set(keys),
|
|
8881
|
+
numKeys: keys.length,
|
|
8882
|
+
optionalKeys: new Set(okeys)
|
|
8883
|
+
};
|
|
8884
|
+
}
|
|
8885
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
8886
|
+
const unrecognized = [];
|
|
8887
|
+
const keySet = def.keySet;
|
|
8888
|
+
const _catchall = def.catchall._zod;
|
|
8889
|
+
const t = _catchall.def.type;
|
|
8890
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
8891
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
8892
|
+
for (const key in input) {
|
|
8893
|
+
if (key === "__proto__")
|
|
8894
|
+
continue;
|
|
8895
|
+
if (keySet.has(key))
|
|
8896
|
+
continue;
|
|
8897
|
+
if (t === "never") {
|
|
8898
|
+
unrecognized.push(key);
|
|
8899
|
+
continue;
|
|
8900
|
+
}
|
|
8901
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
8902
|
+
if (r instanceof Promise) {
|
|
8903
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
8904
|
+
} else {
|
|
8905
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
8906
|
+
}
|
|
8907
|
+
}
|
|
8908
|
+
if (unrecognized.length) {
|
|
8909
|
+
payload.issues.push({
|
|
8910
|
+
code: "unrecognized_keys",
|
|
8911
|
+
keys: unrecognized,
|
|
8912
|
+
input,
|
|
8913
|
+
inst
|
|
8914
|
+
});
|
|
8915
|
+
}
|
|
8916
|
+
if (!proms.length)
|
|
8917
|
+
return payload;
|
|
8918
|
+
return Promise.all(proms).then(() => {
|
|
8919
|
+
return payload;
|
|
8920
|
+
});
|
|
8921
|
+
}
|
|
8616
8922
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
8617
8923
|
$ZodType.init(inst, def);
|
|
8618
|
-
const
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8924
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
8925
|
+
if (!desc?.get) {
|
|
8926
|
+
const sh = def.shape;
|
|
8927
|
+
Object.defineProperty(def, "shape", {
|
|
8928
|
+
get: () => {
|
|
8929
|
+
const newSh = { ...sh };
|
|
8930
|
+
Object.defineProperty(def, "shape", {
|
|
8931
|
+
value: newSh
|
|
8932
|
+
});
|
|
8933
|
+
return newSh;
|
|
8623
8934
|
}
|
|
8624
|
-
}
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
shape: def.shape,
|
|
8628
|
-
keys,
|
|
8629
|
-
keySet: new Set(keys),
|
|
8630
|
-
numKeys: keys.length,
|
|
8631
|
-
optionalKeys: new Set(okeys)
|
|
8632
|
-
};
|
|
8633
|
-
});
|
|
8935
|
+
});
|
|
8936
|
+
}
|
|
8937
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
8634
8938
|
defineLazy(inst._zod, "propValues", () => {
|
|
8635
8939
|
const shape = def.shape;
|
|
8636
8940
|
const propValues = {};
|
|
@@ -8644,54 +8948,131 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
8644
8948
|
}
|
|
8645
8949
|
return propValues;
|
|
8646
8950
|
});
|
|
8647
|
-
const
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8951
|
+
const isObject2 = isObject;
|
|
8952
|
+
const catchall = def.catchall;
|
|
8953
|
+
let value;
|
|
8954
|
+
inst._zod.parse = (payload, ctx) => {
|
|
8955
|
+
value ?? (value = _normalized.value);
|
|
8956
|
+
const input = payload.value;
|
|
8957
|
+
if (!isObject2(input)) {
|
|
8958
|
+
payload.issues.push({
|
|
8959
|
+
expected: "object",
|
|
8960
|
+
code: "invalid_type",
|
|
8961
|
+
input,
|
|
8962
|
+
inst
|
|
8963
|
+
});
|
|
8964
|
+
return payload;
|
|
8965
|
+
}
|
|
8966
|
+
payload.value = {};
|
|
8967
|
+
const proms = [];
|
|
8968
|
+
const shape = value.shape;
|
|
8969
|
+
for (const key of value.keys) {
|
|
8970
|
+
const el = shape[key];
|
|
8971
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
8972
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
8973
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
8974
|
+
if (r instanceof Promise) {
|
|
8975
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
8976
|
+
} else {
|
|
8977
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
8978
|
+
}
|
|
8979
|
+
}
|
|
8980
|
+
if (!catchall) {
|
|
8981
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
8982
|
+
}
|
|
8983
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
8984
|
+
};
|
|
8985
|
+
});
|
|
8986
|
+
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
8987
|
+
$ZodObject.init(inst, def);
|
|
8988
|
+
const superParse = inst._zod.parse;
|
|
8989
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
8990
|
+
const generateFastpass = (shape) => {
|
|
8991
|
+
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
8992
|
+
const normalized = _normalized.value;
|
|
8993
|
+
const parseStr = (key) => {
|
|
8994
|
+
const k = esc(key);
|
|
8995
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
8996
|
+
};
|
|
8997
|
+
doc.write(`const input = payload.value;`);
|
|
8998
|
+
const ids = /* @__PURE__ */ Object.create(null);
|
|
8999
|
+
let counter = 0;
|
|
9000
|
+
for (const key of normalized.keys) {
|
|
9001
|
+
ids[key] = `key_${counter++}`;
|
|
9002
|
+
}
|
|
9003
|
+
doc.write(`const newResult = {};`);
|
|
9004
|
+
for (const key of normalized.keys) {
|
|
9005
|
+
const id = ids[key];
|
|
9006
|
+
const k = esc(key);
|
|
9007
|
+
const schema = shape[key];
|
|
9008
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
9009
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
9010
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
9011
|
+
if (isOptionalIn && isOptionalOut) {
|
|
9012
|
+
doc.write(`
|
|
9013
|
+
if (${id}.issues.length) {
|
|
9014
|
+
if (${k} in input) {
|
|
9015
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
9016
|
+
...iss,
|
|
9017
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
9018
|
+
})));
|
|
9019
|
+
}
|
|
9020
|
+
}
|
|
9021
|
+
|
|
9022
|
+
if (${id}.value === undefined) {
|
|
9023
|
+
if (${k} in input) {
|
|
9024
|
+
newResult[${k}] = undefined;
|
|
9025
|
+
}
|
|
9026
|
+
} else {
|
|
9027
|
+
newResult[${k}] = ${id}.value;
|
|
9028
|
+
}
|
|
9029
|
+
|
|
9030
|
+
`);
|
|
9031
|
+
} else if (!isOptionalIn) {
|
|
9032
|
+
doc.write(`
|
|
9033
|
+
const ${id}_present = ${k} in input;
|
|
9034
|
+
if (${id}.issues.length) {
|
|
9035
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
8691
9036
|
...iss,
|
|
8692
|
-
path: iss.path ? [${
|
|
8693
|
-
})))
|
|
8694
|
-
|
|
9037
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
9038
|
+
})));
|
|
9039
|
+
}
|
|
9040
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
9041
|
+
payload.issues.push({
|
|
9042
|
+
code: "invalid_type",
|
|
9043
|
+
expected: "nonoptional",
|
|
9044
|
+
input: undefined,
|
|
9045
|
+
path: [${k}]
|
|
9046
|
+
});
|
|
9047
|
+
}
|
|
9048
|
+
|
|
9049
|
+
if (${id}_present) {
|
|
9050
|
+
if (${id}.value === undefined) {
|
|
9051
|
+
newResult[${k}] = undefined;
|
|
9052
|
+
} else {
|
|
9053
|
+
newResult[${k}] = ${id}.value;
|
|
9054
|
+
}
|
|
9055
|
+
}
|
|
9056
|
+
|
|
9057
|
+
`);
|
|
9058
|
+
} else {
|
|
9059
|
+
doc.write(`
|
|
9060
|
+
if (${id}.issues.length) {
|
|
9061
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
9062
|
+
...iss,
|
|
9063
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
9064
|
+
})));
|
|
9065
|
+
}
|
|
9066
|
+
|
|
9067
|
+
if (${id}.value === undefined) {
|
|
9068
|
+
if (${k} in input) {
|
|
9069
|
+
newResult[${k}] = undefined;
|
|
9070
|
+
}
|
|
9071
|
+
} else {
|
|
9072
|
+
newResult[${k}] = ${id}.value;
|
|
9073
|
+
}
|
|
9074
|
+
|
|
9075
|
+
`);
|
|
8695
9076
|
}
|
|
8696
9077
|
}
|
|
8697
9078
|
doc.write(`payload.value = newResult;`);
|
|
@@ -8718,61 +9099,15 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
8718
9099
|
});
|
|
8719
9100
|
return payload;
|
|
8720
9101
|
}
|
|
8721
|
-
const proms = [];
|
|
8722
9102
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
8723
9103
|
if (!fastpass)
|
|
8724
9104
|
fastpass = generateFastpass(def.shape);
|
|
8725
9105
|
payload = fastpass(payload, ctx);
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
for (const key of value.keys) {
|
|
8730
|
-
const el = shape[key];
|
|
8731
|
-
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
8732
|
-
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
8733
|
-
if (r instanceof Promise) {
|
|
8734
|
-
proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
|
|
8735
|
-
} else if (isOptional) {
|
|
8736
|
-
handleOptionalObjectResult(r, payload, key, input);
|
|
8737
|
-
} else {
|
|
8738
|
-
handleObjectResult(r, payload, key);
|
|
8739
|
-
}
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
|
-
if (!catchall) {
|
|
8743
|
-
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
8744
|
-
}
|
|
8745
|
-
const unrecognized = [];
|
|
8746
|
-
const keySet = value.keySet;
|
|
8747
|
-
const _catchall = catchall._zod;
|
|
8748
|
-
const t = _catchall.def.type;
|
|
8749
|
-
for (const key of Object.keys(input)) {
|
|
8750
|
-
if (keySet.has(key))
|
|
8751
|
-
continue;
|
|
8752
|
-
if (t === "never") {
|
|
8753
|
-
unrecognized.push(key);
|
|
8754
|
-
continue;
|
|
8755
|
-
}
|
|
8756
|
-
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
8757
|
-
if (r instanceof Promise) {
|
|
8758
|
-
proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
|
|
8759
|
-
} else {
|
|
8760
|
-
handleObjectResult(r, payload, key);
|
|
8761
|
-
}
|
|
8762
|
-
}
|
|
8763
|
-
if (unrecognized.length) {
|
|
8764
|
-
payload.issues.push({
|
|
8765
|
-
code: "unrecognized_keys",
|
|
8766
|
-
keys: unrecognized,
|
|
8767
|
-
input,
|
|
8768
|
-
inst
|
|
8769
|
-
});
|
|
9106
|
+
if (!catchall)
|
|
9107
|
+
return payload;
|
|
9108
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
8770
9109
|
}
|
|
8771
|
-
|
|
8772
|
-
return payload;
|
|
8773
|
-
return Promise.all(proms).then(() => {
|
|
8774
|
-
return payload;
|
|
8775
|
-
});
|
|
9110
|
+
return superParse(payload, ctx);
|
|
8776
9111
|
};
|
|
8777
9112
|
});
|
|
8778
9113
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -8782,6 +9117,11 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
8782
9117
|
return final;
|
|
8783
9118
|
}
|
|
8784
9119
|
}
|
|
9120
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
9121
|
+
if (nonaborted.length === 1) {
|
|
9122
|
+
final.value = nonaborted[0].value;
|
|
9123
|
+
return nonaborted[0];
|
|
9124
|
+
}
|
|
8785
9125
|
final.issues.push({
|
|
8786
9126
|
code: "invalid_union",
|
|
8787
9127
|
input: final.value,
|
|
@@ -8807,7 +9147,11 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
8807
9147
|
}
|
|
8808
9148
|
return void 0;
|
|
8809
9149
|
});
|
|
9150
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
8810
9151
|
inst._zod.parse = (payload, ctx) => {
|
|
9152
|
+
if (first) {
|
|
9153
|
+
return first(payload, ctx);
|
|
9154
|
+
}
|
|
8811
9155
|
let async = false;
|
|
8812
9156
|
const results = [];
|
|
8813
9157
|
for (const option of def.options) {
|
|
@@ -8832,6 +9176,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
8832
9176
|
};
|
|
8833
9177
|
});
|
|
8834
9178
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
9179
|
+
def.inclusive = false;
|
|
8835
9180
|
$ZodUnion.init(inst, def);
|
|
8836
9181
|
const _super = inst._zod.parse;
|
|
8837
9182
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -8854,7 +9199,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
8854
9199
|
const opts = def.options;
|
|
8855
9200
|
const map = /* @__PURE__ */ new Map();
|
|
8856
9201
|
for (const o of opts) {
|
|
8857
|
-
const values = o._zod.propValues[def.discriminator];
|
|
9202
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
8858
9203
|
if (!values || values.size === 0)
|
|
8859
9204
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
8860
9205
|
for (const v of values) {
|
|
@@ -8881,13 +9226,15 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
8881
9226
|
if (opt) {
|
|
8882
9227
|
return opt._zod.run(payload, ctx);
|
|
8883
9228
|
}
|
|
8884
|
-
if (def.unionFallback) {
|
|
9229
|
+
if (def.unionFallback || ctx.direction === "backward") {
|
|
8885
9230
|
return _super(payload, ctx);
|
|
8886
9231
|
}
|
|
8887
9232
|
payload.issues.push({
|
|
8888
9233
|
code: "invalid_union",
|
|
8889
9234
|
errors: [],
|
|
8890
9235
|
note: "No matching discriminator",
|
|
9236
|
+
discriminator: def.discriminator,
|
|
9237
|
+
options: Array.from(disc.value.keys()),
|
|
8891
9238
|
input,
|
|
8892
9239
|
path: [def.discriminator],
|
|
8893
9240
|
inst
|
|
@@ -8955,11 +9302,34 @@ function mergeValues(a, b) {
|
|
|
8955
9302
|
return { valid: false, mergeErrorPath: [] };
|
|
8956
9303
|
}
|
|
8957
9304
|
function handleIntersectionResults(result, left, right) {
|
|
8958
|
-
|
|
8959
|
-
|
|
9305
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
9306
|
+
let unrecIssue;
|
|
9307
|
+
for (const iss of left.issues) {
|
|
9308
|
+
if (iss.code === "unrecognized_keys") {
|
|
9309
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
9310
|
+
for (const k of iss.keys) {
|
|
9311
|
+
if (!unrecKeys.has(k))
|
|
9312
|
+
unrecKeys.set(k, {});
|
|
9313
|
+
unrecKeys.get(k).l = true;
|
|
9314
|
+
}
|
|
9315
|
+
} else {
|
|
9316
|
+
result.issues.push(iss);
|
|
9317
|
+
}
|
|
8960
9318
|
}
|
|
8961
|
-
|
|
8962
|
-
|
|
9319
|
+
for (const iss of right.issues) {
|
|
9320
|
+
if (iss.code === "unrecognized_keys") {
|
|
9321
|
+
for (const k of iss.keys) {
|
|
9322
|
+
if (!unrecKeys.has(k))
|
|
9323
|
+
unrecKeys.set(k, {});
|
|
9324
|
+
unrecKeys.get(k).r = true;
|
|
9325
|
+
}
|
|
9326
|
+
} else {
|
|
9327
|
+
result.issues.push(iss);
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
9331
|
+
if (bothKeys.length && unrecIssue) {
|
|
9332
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
8963
9333
|
}
|
|
8964
9334
|
if (aborted(result))
|
|
8965
9335
|
return result;
|
|
@@ -8984,30 +9354,48 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8984
9354
|
return payload;
|
|
8985
9355
|
}
|
|
8986
9356
|
const proms = [];
|
|
8987
|
-
|
|
8988
|
-
|
|
9357
|
+
const values = def.keyType._zod.values;
|
|
9358
|
+
if (values) {
|
|
8989
9359
|
payload.value = {};
|
|
9360
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
8990
9361
|
for (const key of values) {
|
|
8991
9362
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
9363
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
9364
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
9365
|
+
if (keyResult instanceof Promise) {
|
|
9366
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
9367
|
+
}
|
|
9368
|
+
if (keyResult.issues.length) {
|
|
9369
|
+
payload.issues.push({
|
|
9370
|
+
code: "invalid_key",
|
|
9371
|
+
origin: "record",
|
|
9372
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
9373
|
+
input: key,
|
|
9374
|
+
path: [key],
|
|
9375
|
+
inst
|
|
9376
|
+
});
|
|
9377
|
+
continue;
|
|
9378
|
+
}
|
|
9379
|
+
const outKey = keyResult.value;
|
|
8992
9380
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
8993
9381
|
if (result instanceof Promise) {
|
|
8994
9382
|
proms.push(result.then((result2) => {
|
|
8995
9383
|
if (result2.issues.length) {
|
|
8996
9384
|
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
8997
9385
|
}
|
|
8998
|
-
payload.value[
|
|
9386
|
+
payload.value[outKey] = result2.value;
|
|
8999
9387
|
}));
|
|
9000
9388
|
} else {
|
|
9001
9389
|
if (result.issues.length) {
|
|
9002
9390
|
payload.issues.push(...prefixIssues(key, result.issues));
|
|
9003
9391
|
}
|
|
9004
|
-
payload.value[
|
|
9392
|
+
payload.value[outKey] = result.value;
|
|
9005
9393
|
}
|
|
9006
9394
|
}
|
|
9007
9395
|
}
|
|
9008
9396
|
let unrecognized;
|
|
9009
9397
|
for (const key in input) {
|
|
9010
|
-
if (!
|
|
9398
|
+
if (!recordKeys.has(key)) {
|
|
9011
9399
|
unrecognized = unrecognized ?? [];
|
|
9012
9400
|
unrecognized.push(key);
|
|
9013
9401
|
}
|
|
@@ -9025,20 +9413,35 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
9025
9413
|
for (const key of Reflect.ownKeys(input)) {
|
|
9026
9414
|
if (key === "__proto__")
|
|
9027
9415
|
continue;
|
|
9028
|
-
|
|
9416
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key))
|
|
9417
|
+
continue;
|
|
9418
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
9029
9419
|
if (keyResult instanceof Promise) {
|
|
9030
9420
|
throw new Error("Async schemas not supported in object keys currently");
|
|
9031
9421
|
}
|
|
9422
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
9423
|
+
if (checkNumericKey) {
|
|
9424
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
9425
|
+
if (retryResult instanceof Promise) {
|
|
9426
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
9427
|
+
}
|
|
9428
|
+
if (retryResult.issues.length === 0) {
|
|
9429
|
+
keyResult = retryResult;
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9032
9432
|
if (keyResult.issues.length) {
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9433
|
+
if (def.mode === "loose") {
|
|
9434
|
+
payload.value[key] = input[key];
|
|
9435
|
+
} else {
|
|
9436
|
+
payload.issues.push({
|
|
9437
|
+
code: "invalid_key",
|
|
9438
|
+
origin: "record",
|
|
9439
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
9440
|
+
input: key,
|
|
9441
|
+
path: [key],
|
|
9442
|
+
inst
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9042
9445
|
continue;
|
|
9043
9446
|
}
|
|
9044
9447
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -9066,11 +9469,12 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
9066
9469
|
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
9067
9470
|
$ZodType.init(inst, def);
|
|
9068
9471
|
const values = getEnumValues(def.entries);
|
|
9069
|
-
|
|
9472
|
+
const valuesSet = new Set(values);
|
|
9473
|
+
inst._zod.values = valuesSet;
|
|
9070
9474
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
9071
9475
|
inst._zod.parse = (payload, _ctx) => {
|
|
9072
9476
|
const input = payload.value;
|
|
9073
|
-
if (
|
|
9477
|
+
if (valuesSet.has(input)) {
|
|
9074
9478
|
return payload;
|
|
9075
9479
|
}
|
|
9076
9480
|
payload.issues.push({
|
|
@@ -9084,11 +9488,15 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
9084
9488
|
});
|
|
9085
9489
|
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
9086
9490
|
$ZodType.init(inst, def);
|
|
9087
|
-
|
|
9088
|
-
|
|
9491
|
+
if (def.values.length === 0) {
|
|
9492
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
9493
|
+
}
|
|
9494
|
+
const values = new Set(def.values);
|
|
9495
|
+
inst._zod.values = values;
|
|
9496
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
9089
9497
|
inst._zod.parse = (payload, _ctx) => {
|
|
9090
9498
|
const input = payload.value;
|
|
9091
|
-
if (
|
|
9499
|
+
if (values.has(input)) {
|
|
9092
9500
|
return payload;
|
|
9093
9501
|
}
|
|
9094
9502
|
payload.issues.push({
|
|
@@ -9102,12 +9510,17 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
9102
9510
|
});
|
|
9103
9511
|
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
9104
9512
|
$ZodType.init(inst, def);
|
|
9105
|
-
inst._zod.
|
|
9513
|
+
inst._zod.optin = "optional";
|
|
9514
|
+
inst._zod.parse = (payload, ctx) => {
|
|
9515
|
+
if (ctx.direction === "backward") {
|
|
9516
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
9517
|
+
}
|
|
9106
9518
|
const _out = def.transform(payload.value, payload);
|
|
9107
|
-
if (
|
|
9519
|
+
if (ctx.async) {
|
|
9108
9520
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
9109
9521
|
return output.then((output2) => {
|
|
9110
9522
|
payload.value = output2;
|
|
9523
|
+
payload.fallback = true;
|
|
9111
9524
|
return payload;
|
|
9112
9525
|
});
|
|
9113
9526
|
}
|
|
@@ -9115,9 +9528,16 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
9115
9528
|
throw new $ZodAsyncError();
|
|
9116
9529
|
}
|
|
9117
9530
|
payload.value = _out;
|
|
9531
|
+
payload.fallback = true;
|
|
9118
9532
|
return payload;
|
|
9119
9533
|
};
|
|
9120
9534
|
});
|
|
9535
|
+
function handleOptionalResult(result, input) {
|
|
9536
|
+
if (input === void 0 && (result.issues.length || result.fallback)) {
|
|
9537
|
+
return { issues: [], value: void 0 };
|
|
9538
|
+
}
|
|
9539
|
+
return result;
|
|
9540
|
+
}
|
|
9121
9541
|
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
9122
9542
|
$ZodType.init(inst, def);
|
|
9123
9543
|
inst._zod.optin = "optional";
|
|
@@ -9131,7 +9551,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
9131
9551
|
});
|
|
9132
9552
|
inst._zod.parse = (payload, ctx) => {
|
|
9133
9553
|
if (def.innerType._zod.optin === "optional") {
|
|
9134
|
-
|
|
9554
|
+
const input = payload.value;
|
|
9555
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
9556
|
+
if (result instanceof Promise)
|
|
9557
|
+
return result.then((r) => handleOptionalResult(r, input));
|
|
9558
|
+
return handleOptionalResult(result, input);
|
|
9135
9559
|
}
|
|
9136
9560
|
if (payload.value === void 0) {
|
|
9137
9561
|
return payload;
|
|
@@ -9139,6 +9563,14 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
9139
9563
|
return def.innerType._zod.run(payload, ctx);
|
|
9140
9564
|
};
|
|
9141
9565
|
});
|
|
9566
|
+
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
9567
|
+
$ZodOptional.init(inst, def);
|
|
9568
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
9569
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
9570
|
+
inst._zod.parse = (payload, ctx) => {
|
|
9571
|
+
return def.innerType._zod.run(payload, ctx);
|
|
9572
|
+
};
|
|
9573
|
+
});
|
|
9142
9574
|
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
9143
9575
|
$ZodType.init(inst, def);
|
|
9144
9576
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -9161,6 +9593,9 @@ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
|
9161
9593
|
inst._zod.optin = "optional";
|
|
9162
9594
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
9163
9595
|
inst._zod.parse = (payload, ctx) => {
|
|
9596
|
+
if (ctx.direction === "backward") {
|
|
9597
|
+
return def.innerType._zod.run(payload, ctx);
|
|
9598
|
+
}
|
|
9164
9599
|
if (payload.value === void 0) {
|
|
9165
9600
|
payload.value = def.defaultValue;
|
|
9166
9601
|
return payload;
|
|
@@ -9183,6 +9618,9 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
9183
9618
|
inst._zod.optin = "optional";
|
|
9184
9619
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
9185
9620
|
inst._zod.parse = (payload, ctx) => {
|
|
9621
|
+
if (ctx.direction === "backward") {
|
|
9622
|
+
return def.innerType._zod.run(payload, ctx);
|
|
9623
|
+
}
|
|
9186
9624
|
if (payload.value === void 0) {
|
|
9187
9625
|
payload.value = def.defaultValue;
|
|
9188
9626
|
}
|
|
@@ -9220,6 +9658,9 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
9220
9658
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
9221
9659
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
9222
9660
|
inst._zod.parse = (payload, ctx) => {
|
|
9661
|
+
if (ctx.direction === "backward") {
|
|
9662
|
+
return def.innerType._zod.run(payload, ctx);
|
|
9663
|
+
}
|
|
9223
9664
|
const result = def.innerType._zod.run(payload, ctx);
|
|
9224
9665
|
if (result instanceof Promise) {
|
|
9225
9666
|
return result.then((result2) => {
|
|
@@ -9233,6 +9674,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
9233
9674
|
input: payload.value
|
|
9234
9675
|
});
|
|
9235
9676
|
payload.issues = [];
|
|
9677
|
+
payload.fallback = true;
|
|
9236
9678
|
}
|
|
9237
9679
|
return payload;
|
|
9238
9680
|
});
|
|
@@ -9247,6 +9689,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
9247
9689
|
input: payload.value
|
|
9248
9690
|
});
|
|
9249
9691
|
payload.issues = [];
|
|
9692
|
+
payload.fallback = true;
|
|
9250
9693
|
}
|
|
9251
9694
|
return payload;
|
|
9252
9695
|
};
|
|
@@ -9256,27 +9699,42 @@ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
9256
9699
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
9257
9700
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
9258
9701
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
9702
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
9259
9703
|
inst._zod.parse = (payload, ctx) => {
|
|
9704
|
+
if (ctx.direction === "backward") {
|
|
9705
|
+
const right = def.out._zod.run(payload, ctx);
|
|
9706
|
+
if (right instanceof Promise) {
|
|
9707
|
+
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
|
|
9708
|
+
}
|
|
9709
|
+
return handlePipeResult(right, def.in, ctx);
|
|
9710
|
+
}
|
|
9260
9711
|
const left = def.in._zod.run(payload, ctx);
|
|
9261
9712
|
if (left instanceof Promise) {
|
|
9262
|
-
return left.then((left2) => handlePipeResult(left2, def, ctx));
|
|
9713
|
+
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
|
|
9263
9714
|
}
|
|
9264
|
-
return handlePipeResult(left, def, ctx);
|
|
9715
|
+
return handlePipeResult(left, def.out, ctx);
|
|
9265
9716
|
};
|
|
9266
9717
|
});
|
|
9267
|
-
function handlePipeResult(left,
|
|
9268
|
-
if (
|
|
9718
|
+
function handlePipeResult(left, next, ctx) {
|
|
9719
|
+
if (left.issues.length) {
|
|
9720
|
+
left.aborted = true;
|
|
9269
9721
|
return left;
|
|
9270
9722
|
}
|
|
9271
|
-
return
|
|
9723
|
+
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
9272
9724
|
}
|
|
9725
|
+
var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
|
|
9726
|
+
$ZodPipe.init(inst, def);
|
|
9727
|
+
});
|
|
9273
9728
|
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
9274
9729
|
$ZodType.init(inst, def);
|
|
9275
9730
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
9276
9731
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
9277
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
9278
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
9732
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
9733
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
9279
9734
|
inst._zod.parse = (payload, ctx) => {
|
|
9735
|
+
if (ctx.direction === "backward") {
|
|
9736
|
+
return def.innerType._zod.run(payload, ctx);
|
|
9737
|
+
}
|
|
9280
9738
|
const result = def.innerType._zod.run(payload, ctx);
|
|
9281
9739
|
if (result instanceof Promise) {
|
|
9282
9740
|
return result.then(handleReadonlyResult);
|
|
@@ -9323,37 +9781,18 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
9323
9781
|
}
|
|
9324
9782
|
|
|
9325
9783
|
// ../../node_modules/zod/v4/locales/en.js
|
|
9326
|
-
var parsedType = (data) => {
|
|
9327
|
-
const t = typeof data;
|
|
9328
|
-
switch (t) {
|
|
9329
|
-
case "number": {
|
|
9330
|
-
return Number.isNaN(data) ? "NaN" : "number";
|
|
9331
|
-
}
|
|
9332
|
-
case "object": {
|
|
9333
|
-
if (Array.isArray(data)) {
|
|
9334
|
-
return "array";
|
|
9335
|
-
}
|
|
9336
|
-
if (data === null) {
|
|
9337
|
-
return "null";
|
|
9338
|
-
}
|
|
9339
|
-
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
|
9340
|
-
return data.constructor.name;
|
|
9341
|
-
}
|
|
9342
|
-
}
|
|
9343
|
-
}
|
|
9344
|
-
return t;
|
|
9345
|
-
};
|
|
9346
9784
|
var error = () => {
|
|
9347
9785
|
const Sizable = {
|
|
9348
9786
|
string: { unit: "characters", verb: "to have" },
|
|
9349
9787
|
file: { unit: "bytes", verb: "to have" },
|
|
9350
9788
|
array: { unit: "items", verb: "to have" },
|
|
9351
|
-
set: { unit: "items", verb: "to have" }
|
|
9789
|
+
set: { unit: "items", verb: "to have" },
|
|
9790
|
+
map: { unit: "entries", verb: "to have" }
|
|
9352
9791
|
};
|
|
9353
9792
|
function getSizing(origin) {
|
|
9354
9793
|
return Sizable[origin] ?? null;
|
|
9355
9794
|
}
|
|
9356
|
-
const
|
|
9795
|
+
const FormatDictionary = {
|
|
9357
9796
|
regex: "input",
|
|
9358
9797
|
email: "email address",
|
|
9359
9798
|
url: "URL",
|
|
@@ -9374,6 +9813,7 @@ var error = () => {
|
|
|
9374
9813
|
duration: "ISO duration",
|
|
9375
9814
|
ipv4: "IPv4 address",
|
|
9376
9815
|
ipv6: "IPv6 address",
|
|
9816
|
+
mac: "MAC address",
|
|
9377
9817
|
cidrv4: "IPv4 range",
|
|
9378
9818
|
cidrv6: "IPv6 range",
|
|
9379
9819
|
base64: "base64-encoded string",
|
|
@@ -9383,10 +9823,19 @@ var error = () => {
|
|
|
9383
9823
|
jwt: "JWT",
|
|
9384
9824
|
template_literal: "input"
|
|
9385
9825
|
};
|
|
9826
|
+
const TypeDictionary = {
|
|
9827
|
+
// Compatibility: "nan" -> "NaN" for display
|
|
9828
|
+
nan: "NaN"
|
|
9829
|
+
// All other type names omitted - they fall back to raw values via ?? operator
|
|
9830
|
+
};
|
|
9386
9831
|
return (issue2) => {
|
|
9387
9832
|
switch (issue2.code) {
|
|
9388
|
-
case "invalid_type":
|
|
9389
|
-
|
|
9833
|
+
case "invalid_type": {
|
|
9834
|
+
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
|
|
9835
|
+
const receivedType = parsedType(issue2.input);
|
|
9836
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
9837
|
+
return `Invalid input: expected ${expected}, received ${received}`;
|
|
9838
|
+
}
|
|
9390
9839
|
case "invalid_value":
|
|
9391
9840
|
if (issue2.values.length === 1)
|
|
9392
9841
|
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
|
|
@@ -9417,7 +9866,7 @@ var error = () => {
|
|
|
9417
9866
|
return `Invalid string: must include "${_issue.includes}"`;
|
|
9418
9867
|
if (_issue.format === "regex")
|
|
9419
9868
|
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
9420
|
-
return `Invalid ${
|
|
9869
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
|
|
9421
9870
|
}
|
|
9422
9871
|
case "not_multiple_of":
|
|
9423
9872
|
return `Invalid number: must be a multiple of ${issue2.divisor}`;
|
|
@@ -9426,6 +9875,10 @@ var error = () => {
|
|
|
9426
9875
|
case "invalid_key":
|
|
9427
9876
|
return `Invalid key in ${issue2.origin}`;
|
|
9428
9877
|
case "invalid_union":
|
|
9878
|
+
if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
|
|
9879
|
+
const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
|
|
9880
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
9881
|
+
}
|
|
9429
9882
|
return "Invalid input";
|
|
9430
9883
|
case "invalid_element":
|
|
9431
9884
|
return `Invalid value in ${issue2.origin}`;
|
|
@@ -9441,31 +9894,29 @@ function en_default() {
|
|
|
9441
9894
|
}
|
|
9442
9895
|
|
|
9443
9896
|
// ../../node_modules/zod/v4/core/registries.js
|
|
9897
|
+
var _a2;
|
|
9444
9898
|
var $ZodRegistry = class {
|
|
9445
9899
|
constructor() {
|
|
9446
|
-
this._map = /* @__PURE__ */ new
|
|
9900
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
9447
9901
|
this._idmap = /* @__PURE__ */ new Map();
|
|
9448
9902
|
}
|
|
9449
9903
|
add(schema, ..._meta) {
|
|
9450
|
-
const
|
|
9451
|
-
this._map.set(schema,
|
|
9452
|
-
if (
|
|
9453
|
-
|
|
9454
|
-
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
9455
|
-
}
|
|
9456
|
-
this._idmap.set(meta.id, schema);
|
|
9904
|
+
const meta2 = _meta[0];
|
|
9905
|
+
this._map.set(schema, meta2);
|
|
9906
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
9907
|
+
this._idmap.set(meta2.id, schema);
|
|
9457
9908
|
}
|
|
9458
9909
|
return this;
|
|
9459
9910
|
}
|
|
9460
9911
|
clear() {
|
|
9461
|
-
this._map = /* @__PURE__ */ new
|
|
9912
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
9462
9913
|
this._idmap = /* @__PURE__ */ new Map();
|
|
9463
9914
|
return this;
|
|
9464
9915
|
}
|
|
9465
9916
|
remove(schema) {
|
|
9466
|
-
const
|
|
9467
|
-
if (
|
|
9468
|
-
this._idmap.delete(
|
|
9917
|
+
const meta2 = this._map.get(schema);
|
|
9918
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
9919
|
+
this._idmap.delete(meta2.id);
|
|
9469
9920
|
}
|
|
9470
9921
|
this._map.delete(schema);
|
|
9471
9922
|
return this;
|
|
@@ -9475,7 +9926,8 @@ var $ZodRegistry = class {
|
|
|
9475
9926
|
if (p) {
|
|
9476
9927
|
const pm = { ...this.get(p) ?? {} };
|
|
9477
9928
|
delete pm.id;
|
|
9478
|
-
|
|
9929
|
+
const f = { ...pm, ...this._map.get(schema) };
|
|
9930
|
+
return Object.keys(f).length ? f : void 0;
|
|
9479
9931
|
}
|
|
9480
9932
|
return this._map.get(schema);
|
|
9481
9933
|
}
|
|
@@ -9486,15 +9938,18 @@ var $ZodRegistry = class {
|
|
|
9486
9938
|
function registry() {
|
|
9487
9939
|
return new $ZodRegistry();
|
|
9488
9940
|
}
|
|
9489
|
-
|
|
9941
|
+
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
9942
|
+
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
9490
9943
|
|
|
9491
9944
|
// ../../node_modules/zod/v4/core/api.js
|
|
9945
|
+
// @__NO_SIDE_EFFECTS__
|
|
9492
9946
|
function _string(Class2, params) {
|
|
9493
9947
|
return new Class2({
|
|
9494
9948
|
type: "string",
|
|
9495
9949
|
...normalizeParams(params)
|
|
9496
9950
|
});
|
|
9497
9951
|
}
|
|
9952
|
+
// @__NO_SIDE_EFFECTS__
|
|
9498
9953
|
function _email(Class2, params) {
|
|
9499
9954
|
return new Class2({
|
|
9500
9955
|
type: "string",
|
|
@@ -9504,6 +9959,7 @@ function _email(Class2, params) {
|
|
|
9504
9959
|
...normalizeParams(params)
|
|
9505
9960
|
});
|
|
9506
9961
|
}
|
|
9962
|
+
// @__NO_SIDE_EFFECTS__
|
|
9507
9963
|
function _guid(Class2, params) {
|
|
9508
9964
|
return new Class2({
|
|
9509
9965
|
type: "string",
|
|
@@ -9513,6 +9969,7 @@ function _guid(Class2, params) {
|
|
|
9513
9969
|
...normalizeParams(params)
|
|
9514
9970
|
});
|
|
9515
9971
|
}
|
|
9972
|
+
// @__NO_SIDE_EFFECTS__
|
|
9516
9973
|
function _uuid(Class2, params) {
|
|
9517
9974
|
return new Class2({
|
|
9518
9975
|
type: "string",
|
|
@@ -9522,6 +9979,7 @@ function _uuid(Class2, params) {
|
|
|
9522
9979
|
...normalizeParams(params)
|
|
9523
9980
|
});
|
|
9524
9981
|
}
|
|
9982
|
+
// @__NO_SIDE_EFFECTS__
|
|
9525
9983
|
function _uuidv4(Class2, params) {
|
|
9526
9984
|
return new Class2({
|
|
9527
9985
|
type: "string",
|
|
@@ -9532,6 +9990,7 @@ function _uuidv4(Class2, params) {
|
|
|
9532
9990
|
...normalizeParams(params)
|
|
9533
9991
|
});
|
|
9534
9992
|
}
|
|
9993
|
+
// @__NO_SIDE_EFFECTS__
|
|
9535
9994
|
function _uuidv6(Class2, params) {
|
|
9536
9995
|
return new Class2({
|
|
9537
9996
|
type: "string",
|
|
@@ -9542,6 +10001,7 @@ function _uuidv6(Class2, params) {
|
|
|
9542
10001
|
...normalizeParams(params)
|
|
9543
10002
|
});
|
|
9544
10003
|
}
|
|
10004
|
+
// @__NO_SIDE_EFFECTS__
|
|
9545
10005
|
function _uuidv7(Class2, params) {
|
|
9546
10006
|
return new Class2({
|
|
9547
10007
|
type: "string",
|
|
@@ -9552,6 +10012,7 @@ function _uuidv7(Class2, params) {
|
|
|
9552
10012
|
...normalizeParams(params)
|
|
9553
10013
|
});
|
|
9554
10014
|
}
|
|
10015
|
+
// @__NO_SIDE_EFFECTS__
|
|
9555
10016
|
function _url(Class2, params) {
|
|
9556
10017
|
return new Class2({
|
|
9557
10018
|
type: "string",
|
|
@@ -9561,6 +10022,7 @@ function _url(Class2, params) {
|
|
|
9561
10022
|
...normalizeParams(params)
|
|
9562
10023
|
});
|
|
9563
10024
|
}
|
|
10025
|
+
// @__NO_SIDE_EFFECTS__
|
|
9564
10026
|
function _emoji2(Class2, params) {
|
|
9565
10027
|
return new Class2({
|
|
9566
10028
|
type: "string",
|
|
@@ -9570,6 +10032,7 @@ function _emoji2(Class2, params) {
|
|
|
9570
10032
|
...normalizeParams(params)
|
|
9571
10033
|
});
|
|
9572
10034
|
}
|
|
10035
|
+
// @__NO_SIDE_EFFECTS__
|
|
9573
10036
|
function _nanoid(Class2, params) {
|
|
9574
10037
|
return new Class2({
|
|
9575
10038
|
type: "string",
|
|
@@ -9579,6 +10042,7 @@ function _nanoid(Class2, params) {
|
|
|
9579
10042
|
...normalizeParams(params)
|
|
9580
10043
|
});
|
|
9581
10044
|
}
|
|
10045
|
+
// @__NO_SIDE_EFFECTS__
|
|
9582
10046
|
function _cuid(Class2, params) {
|
|
9583
10047
|
return new Class2({
|
|
9584
10048
|
type: "string",
|
|
@@ -9588,6 +10052,7 @@ function _cuid(Class2, params) {
|
|
|
9588
10052
|
...normalizeParams(params)
|
|
9589
10053
|
});
|
|
9590
10054
|
}
|
|
10055
|
+
// @__NO_SIDE_EFFECTS__
|
|
9591
10056
|
function _cuid2(Class2, params) {
|
|
9592
10057
|
return new Class2({
|
|
9593
10058
|
type: "string",
|
|
@@ -9597,6 +10062,7 @@ function _cuid2(Class2, params) {
|
|
|
9597
10062
|
...normalizeParams(params)
|
|
9598
10063
|
});
|
|
9599
10064
|
}
|
|
10065
|
+
// @__NO_SIDE_EFFECTS__
|
|
9600
10066
|
function _ulid(Class2, params) {
|
|
9601
10067
|
return new Class2({
|
|
9602
10068
|
type: "string",
|
|
@@ -9606,6 +10072,7 @@ function _ulid(Class2, params) {
|
|
|
9606
10072
|
...normalizeParams(params)
|
|
9607
10073
|
});
|
|
9608
10074
|
}
|
|
10075
|
+
// @__NO_SIDE_EFFECTS__
|
|
9609
10076
|
function _xid(Class2, params) {
|
|
9610
10077
|
return new Class2({
|
|
9611
10078
|
type: "string",
|
|
@@ -9615,6 +10082,7 @@ function _xid(Class2, params) {
|
|
|
9615
10082
|
...normalizeParams(params)
|
|
9616
10083
|
});
|
|
9617
10084
|
}
|
|
10085
|
+
// @__NO_SIDE_EFFECTS__
|
|
9618
10086
|
function _ksuid(Class2, params) {
|
|
9619
10087
|
return new Class2({
|
|
9620
10088
|
type: "string",
|
|
@@ -9624,6 +10092,7 @@ function _ksuid(Class2, params) {
|
|
|
9624
10092
|
...normalizeParams(params)
|
|
9625
10093
|
});
|
|
9626
10094
|
}
|
|
10095
|
+
// @__NO_SIDE_EFFECTS__
|
|
9627
10096
|
function _ipv4(Class2, params) {
|
|
9628
10097
|
return new Class2({
|
|
9629
10098
|
type: "string",
|
|
@@ -9633,6 +10102,7 @@ function _ipv4(Class2, params) {
|
|
|
9633
10102
|
...normalizeParams(params)
|
|
9634
10103
|
});
|
|
9635
10104
|
}
|
|
10105
|
+
// @__NO_SIDE_EFFECTS__
|
|
9636
10106
|
function _ipv6(Class2, params) {
|
|
9637
10107
|
return new Class2({
|
|
9638
10108
|
type: "string",
|
|
@@ -9642,6 +10112,7 @@ function _ipv6(Class2, params) {
|
|
|
9642
10112
|
...normalizeParams(params)
|
|
9643
10113
|
});
|
|
9644
10114
|
}
|
|
10115
|
+
// @__NO_SIDE_EFFECTS__
|
|
9645
10116
|
function _cidrv4(Class2, params) {
|
|
9646
10117
|
return new Class2({
|
|
9647
10118
|
type: "string",
|
|
@@ -9651,6 +10122,7 @@ function _cidrv4(Class2, params) {
|
|
|
9651
10122
|
...normalizeParams(params)
|
|
9652
10123
|
});
|
|
9653
10124
|
}
|
|
10125
|
+
// @__NO_SIDE_EFFECTS__
|
|
9654
10126
|
function _cidrv6(Class2, params) {
|
|
9655
10127
|
return new Class2({
|
|
9656
10128
|
type: "string",
|
|
@@ -9660,6 +10132,7 @@ function _cidrv6(Class2, params) {
|
|
|
9660
10132
|
...normalizeParams(params)
|
|
9661
10133
|
});
|
|
9662
10134
|
}
|
|
10135
|
+
// @__NO_SIDE_EFFECTS__
|
|
9663
10136
|
function _base64(Class2, params) {
|
|
9664
10137
|
return new Class2({
|
|
9665
10138
|
type: "string",
|
|
@@ -9669,6 +10142,7 @@ function _base64(Class2, params) {
|
|
|
9669
10142
|
...normalizeParams(params)
|
|
9670
10143
|
});
|
|
9671
10144
|
}
|
|
10145
|
+
// @__NO_SIDE_EFFECTS__
|
|
9672
10146
|
function _base64url(Class2, params) {
|
|
9673
10147
|
return new Class2({
|
|
9674
10148
|
type: "string",
|
|
@@ -9678,6 +10152,7 @@ function _base64url(Class2, params) {
|
|
|
9678
10152
|
...normalizeParams(params)
|
|
9679
10153
|
});
|
|
9680
10154
|
}
|
|
10155
|
+
// @__NO_SIDE_EFFECTS__
|
|
9681
10156
|
function _e164(Class2, params) {
|
|
9682
10157
|
return new Class2({
|
|
9683
10158
|
type: "string",
|
|
@@ -9687,6 +10162,7 @@ function _e164(Class2, params) {
|
|
|
9687
10162
|
...normalizeParams(params)
|
|
9688
10163
|
});
|
|
9689
10164
|
}
|
|
10165
|
+
// @__NO_SIDE_EFFECTS__
|
|
9690
10166
|
function _jwt(Class2, params) {
|
|
9691
10167
|
return new Class2({
|
|
9692
10168
|
type: "string",
|
|
@@ -9696,6 +10172,7 @@ function _jwt(Class2, params) {
|
|
|
9696
10172
|
...normalizeParams(params)
|
|
9697
10173
|
});
|
|
9698
10174
|
}
|
|
10175
|
+
// @__NO_SIDE_EFFECTS__
|
|
9699
10176
|
function _isoDateTime(Class2, params) {
|
|
9700
10177
|
return new Class2({
|
|
9701
10178
|
type: "string",
|
|
@@ -9707,6 +10184,7 @@ function _isoDateTime(Class2, params) {
|
|
|
9707
10184
|
...normalizeParams(params)
|
|
9708
10185
|
});
|
|
9709
10186
|
}
|
|
10187
|
+
// @__NO_SIDE_EFFECTS__
|
|
9710
10188
|
function _isoDate(Class2, params) {
|
|
9711
10189
|
return new Class2({
|
|
9712
10190
|
type: "string",
|
|
@@ -9715,6 +10193,7 @@ function _isoDate(Class2, params) {
|
|
|
9715
10193
|
...normalizeParams(params)
|
|
9716
10194
|
});
|
|
9717
10195
|
}
|
|
10196
|
+
// @__NO_SIDE_EFFECTS__
|
|
9718
10197
|
function _isoTime(Class2, params) {
|
|
9719
10198
|
return new Class2({
|
|
9720
10199
|
type: "string",
|
|
@@ -9724,6 +10203,7 @@ function _isoTime(Class2, params) {
|
|
|
9724
10203
|
...normalizeParams(params)
|
|
9725
10204
|
});
|
|
9726
10205
|
}
|
|
10206
|
+
// @__NO_SIDE_EFFECTS__
|
|
9727
10207
|
function _isoDuration(Class2, params) {
|
|
9728
10208
|
return new Class2({
|
|
9729
10209
|
type: "string",
|
|
@@ -9732,6 +10212,7 @@ function _isoDuration(Class2, params) {
|
|
|
9732
10212
|
...normalizeParams(params)
|
|
9733
10213
|
});
|
|
9734
10214
|
}
|
|
10215
|
+
// @__NO_SIDE_EFFECTS__
|
|
9735
10216
|
function _number(Class2, params) {
|
|
9736
10217
|
return new Class2({
|
|
9737
10218
|
type: "number",
|
|
@@ -9739,6 +10220,7 @@ function _number(Class2, params) {
|
|
|
9739
10220
|
...normalizeParams(params)
|
|
9740
10221
|
});
|
|
9741
10222
|
}
|
|
10223
|
+
// @__NO_SIDE_EFFECTS__
|
|
9742
10224
|
function _int(Class2, params) {
|
|
9743
10225
|
return new Class2({
|
|
9744
10226
|
type: "number",
|
|
@@ -9748,29 +10230,34 @@ function _int(Class2, params) {
|
|
|
9748
10230
|
...normalizeParams(params)
|
|
9749
10231
|
});
|
|
9750
10232
|
}
|
|
10233
|
+
// @__NO_SIDE_EFFECTS__
|
|
9751
10234
|
function _boolean(Class2, params) {
|
|
9752
10235
|
return new Class2({
|
|
9753
10236
|
type: "boolean",
|
|
9754
10237
|
...normalizeParams(params)
|
|
9755
10238
|
});
|
|
9756
10239
|
}
|
|
10240
|
+
// @__NO_SIDE_EFFECTS__
|
|
9757
10241
|
function _null2(Class2, params) {
|
|
9758
10242
|
return new Class2({
|
|
9759
10243
|
type: "null",
|
|
9760
10244
|
...normalizeParams(params)
|
|
9761
10245
|
});
|
|
9762
10246
|
}
|
|
10247
|
+
// @__NO_SIDE_EFFECTS__
|
|
9763
10248
|
function _unknown(Class2) {
|
|
9764
10249
|
return new Class2({
|
|
9765
10250
|
type: "unknown"
|
|
9766
10251
|
});
|
|
9767
10252
|
}
|
|
10253
|
+
// @__NO_SIDE_EFFECTS__
|
|
9768
10254
|
function _never(Class2, params) {
|
|
9769
10255
|
return new Class2({
|
|
9770
10256
|
type: "never",
|
|
9771
10257
|
...normalizeParams(params)
|
|
9772
10258
|
});
|
|
9773
10259
|
}
|
|
10260
|
+
// @__NO_SIDE_EFFECTS__
|
|
9774
10261
|
function _lt(value, params) {
|
|
9775
10262
|
return new $ZodCheckLessThan({
|
|
9776
10263
|
check: "less_than",
|
|
@@ -9779,6 +10266,7 @@ function _lt(value, params) {
|
|
|
9779
10266
|
inclusive: false
|
|
9780
10267
|
});
|
|
9781
10268
|
}
|
|
10269
|
+
// @__NO_SIDE_EFFECTS__
|
|
9782
10270
|
function _lte(value, params) {
|
|
9783
10271
|
return new $ZodCheckLessThan({
|
|
9784
10272
|
check: "less_than",
|
|
@@ -9787,6 +10275,7 @@ function _lte(value, params) {
|
|
|
9787
10275
|
inclusive: true
|
|
9788
10276
|
});
|
|
9789
10277
|
}
|
|
10278
|
+
// @__NO_SIDE_EFFECTS__
|
|
9790
10279
|
function _gt(value, params) {
|
|
9791
10280
|
return new $ZodCheckGreaterThan({
|
|
9792
10281
|
check: "greater_than",
|
|
@@ -9795,6 +10284,7 @@ function _gt(value, params) {
|
|
|
9795
10284
|
inclusive: false
|
|
9796
10285
|
});
|
|
9797
10286
|
}
|
|
10287
|
+
// @__NO_SIDE_EFFECTS__
|
|
9798
10288
|
function _gte(value, params) {
|
|
9799
10289
|
return new $ZodCheckGreaterThan({
|
|
9800
10290
|
check: "greater_than",
|
|
@@ -9803,6 +10293,7 @@ function _gte(value, params) {
|
|
|
9803
10293
|
inclusive: true
|
|
9804
10294
|
});
|
|
9805
10295
|
}
|
|
10296
|
+
// @__NO_SIDE_EFFECTS__
|
|
9806
10297
|
function _multipleOf(value, params) {
|
|
9807
10298
|
return new $ZodCheckMultipleOf({
|
|
9808
10299
|
check: "multiple_of",
|
|
@@ -9810,6 +10301,7 @@ function _multipleOf(value, params) {
|
|
|
9810
10301
|
value
|
|
9811
10302
|
});
|
|
9812
10303
|
}
|
|
10304
|
+
// @__NO_SIDE_EFFECTS__
|
|
9813
10305
|
function _maxLength(maximum, params) {
|
|
9814
10306
|
const ch = new $ZodCheckMaxLength({
|
|
9815
10307
|
check: "max_length",
|
|
@@ -9818,6 +10310,7 @@ function _maxLength(maximum, params) {
|
|
|
9818
10310
|
});
|
|
9819
10311
|
return ch;
|
|
9820
10312
|
}
|
|
10313
|
+
// @__NO_SIDE_EFFECTS__
|
|
9821
10314
|
function _minLength(minimum, params) {
|
|
9822
10315
|
return new $ZodCheckMinLength({
|
|
9823
10316
|
check: "min_length",
|
|
@@ -9825,6 +10318,7 @@ function _minLength(minimum, params) {
|
|
|
9825
10318
|
minimum
|
|
9826
10319
|
});
|
|
9827
10320
|
}
|
|
10321
|
+
// @__NO_SIDE_EFFECTS__
|
|
9828
10322
|
function _length(length, params) {
|
|
9829
10323
|
return new $ZodCheckLengthEquals({
|
|
9830
10324
|
check: "length_equals",
|
|
@@ -9832,6 +10326,7 @@ function _length(length, params) {
|
|
|
9832
10326
|
length
|
|
9833
10327
|
});
|
|
9834
10328
|
}
|
|
10329
|
+
// @__NO_SIDE_EFFECTS__
|
|
9835
10330
|
function _regex(pattern, params) {
|
|
9836
10331
|
return new $ZodCheckRegex({
|
|
9837
10332
|
check: "string_format",
|
|
@@ -9840,6 +10335,7 @@ function _regex(pattern, params) {
|
|
|
9840
10335
|
pattern
|
|
9841
10336
|
});
|
|
9842
10337
|
}
|
|
10338
|
+
// @__NO_SIDE_EFFECTS__
|
|
9843
10339
|
function _lowercase(params) {
|
|
9844
10340
|
return new $ZodCheckLowerCase({
|
|
9845
10341
|
check: "string_format",
|
|
@@ -9847,6 +10343,7 @@ function _lowercase(params) {
|
|
|
9847
10343
|
...normalizeParams(params)
|
|
9848
10344
|
});
|
|
9849
10345
|
}
|
|
10346
|
+
// @__NO_SIDE_EFFECTS__
|
|
9850
10347
|
function _uppercase(params) {
|
|
9851
10348
|
return new $ZodCheckUpperCase({
|
|
9852
10349
|
check: "string_format",
|
|
@@ -9854,6 +10351,7 @@ function _uppercase(params) {
|
|
|
9854
10351
|
...normalizeParams(params)
|
|
9855
10352
|
});
|
|
9856
10353
|
}
|
|
10354
|
+
// @__NO_SIDE_EFFECTS__
|
|
9857
10355
|
function _includes(includes, params) {
|
|
9858
10356
|
return new $ZodCheckIncludes({
|
|
9859
10357
|
check: "string_format",
|
|
@@ -9862,6 +10360,7 @@ function _includes(includes, params) {
|
|
|
9862
10360
|
includes
|
|
9863
10361
|
});
|
|
9864
10362
|
}
|
|
10363
|
+
// @__NO_SIDE_EFFECTS__
|
|
9865
10364
|
function _startsWith(prefix, params) {
|
|
9866
10365
|
return new $ZodCheckStartsWith({
|
|
9867
10366
|
check: "string_format",
|
|
@@ -9870,6 +10369,7 @@ function _startsWith(prefix, params) {
|
|
|
9870
10369
|
prefix
|
|
9871
10370
|
});
|
|
9872
10371
|
}
|
|
10372
|
+
// @__NO_SIDE_EFFECTS__
|
|
9873
10373
|
function _endsWith(suffix, params) {
|
|
9874
10374
|
return new $ZodCheckEndsWith({
|
|
9875
10375
|
check: "string_format",
|
|
@@ -9878,24 +10378,34 @@ function _endsWith(suffix, params) {
|
|
|
9878
10378
|
suffix
|
|
9879
10379
|
});
|
|
9880
10380
|
}
|
|
10381
|
+
// @__NO_SIDE_EFFECTS__
|
|
9881
10382
|
function _overwrite(tx) {
|
|
9882
10383
|
return new $ZodCheckOverwrite({
|
|
9883
10384
|
check: "overwrite",
|
|
9884
10385
|
tx
|
|
9885
10386
|
});
|
|
9886
10387
|
}
|
|
10388
|
+
// @__NO_SIDE_EFFECTS__
|
|
9887
10389
|
function _normalize(form) {
|
|
9888
|
-
return _overwrite((input) => input.normalize(form));
|
|
10390
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
9889
10391
|
}
|
|
10392
|
+
// @__NO_SIDE_EFFECTS__
|
|
9890
10393
|
function _trim() {
|
|
9891
|
-
return _overwrite((input) => input.trim());
|
|
10394
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
9892
10395
|
}
|
|
10396
|
+
// @__NO_SIDE_EFFECTS__
|
|
9893
10397
|
function _toLowerCase() {
|
|
9894
|
-
return _overwrite((input) => input.toLowerCase());
|
|
10398
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
9895
10399
|
}
|
|
10400
|
+
// @__NO_SIDE_EFFECTS__
|
|
9896
10401
|
function _toUpperCase() {
|
|
9897
|
-
return _overwrite((input) => input.toUpperCase());
|
|
10402
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
10403
|
+
}
|
|
10404
|
+
// @__NO_SIDE_EFFECTS__
|
|
10405
|
+
function _slugify() {
|
|
10406
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
9898
10407
|
}
|
|
10408
|
+
// @__NO_SIDE_EFFECTS__
|
|
9899
10409
|
function _array(Class2, element, params) {
|
|
9900
10410
|
return new Class2({
|
|
9901
10411
|
type: "array",
|
|
@@ -9905,27 +10415,751 @@ function _array(Class2, element, params) {
|
|
|
9905
10415
|
// },
|
|
9906
10416
|
...normalizeParams(params)
|
|
9907
10417
|
});
|
|
9908
|
-
}
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
10418
|
+
}
|
|
10419
|
+
// @__NO_SIDE_EFFECTS__
|
|
10420
|
+
function _custom(Class2, fn, _params) {
|
|
10421
|
+
const norm = normalizeParams(_params);
|
|
10422
|
+
norm.abort ?? (norm.abort = true);
|
|
10423
|
+
const schema = new Class2({
|
|
10424
|
+
type: "custom",
|
|
10425
|
+
check: "custom",
|
|
10426
|
+
fn,
|
|
10427
|
+
...norm
|
|
10428
|
+
});
|
|
10429
|
+
return schema;
|
|
10430
|
+
}
|
|
10431
|
+
// @__NO_SIDE_EFFECTS__
|
|
10432
|
+
function _refine(Class2, fn, _params) {
|
|
10433
|
+
const schema = new Class2({
|
|
10434
|
+
type: "custom",
|
|
10435
|
+
check: "custom",
|
|
10436
|
+
fn,
|
|
10437
|
+
...normalizeParams(_params)
|
|
10438
|
+
});
|
|
10439
|
+
return schema;
|
|
10440
|
+
}
|
|
10441
|
+
// @__NO_SIDE_EFFECTS__
|
|
10442
|
+
function _superRefine(fn, params) {
|
|
10443
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
10444
|
+
payload.addIssue = (issue2) => {
|
|
10445
|
+
if (typeof issue2 === "string") {
|
|
10446
|
+
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
10447
|
+
} else {
|
|
10448
|
+
const _issue = issue2;
|
|
10449
|
+
if (_issue.fatal)
|
|
10450
|
+
_issue.continue = false;
|
|
10451
|
+
_issue.code ?? (_issue.code = "custom");
|
|
10452
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
10453
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
10454
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
10455
|
+
payload.issues.push(issue(_issue));
|
|
10456
|
+
}
|
|
10457
|
+
};
|
|
10458
|
+
return fn(payload.value, payload);
|
|
10459
|
+
}, params);
|
|
10460
|
+
return ch;
|
|
10461
|
+
}
|
|
10462
|
+
// @__NO_SIDE_EFFECTS__
|
|
10463
|
+
function _check(fn, params) {
|
|
10464
|
+
const ch = new $ZodCheck({
|
|
10465
|
+
check: "custom",
|
|
10466
|
+
...normalizeParams(params)
|
|
10467
|
+
});
|
|
10468
|
+
ch._zod.check = fn;
|
|
10469
|
+
return ch;
|
|
10470
|
+
}
|
|
10471
|
+
|
|
10472
|
+
// ../../node_modules/zod/v4/core/to-json-schema.js
|
|
10473
|
+
function initializeContext(params) {
|
|
10474
|
+
let target = params?.target ?? "draft-2020-12";
|
|
10475
|
+
if (target === "draft-4")
|
|
10476
|
+
target = "draft-04";
|
|
10477
|
+
if (target === "draft-7")
|
|
10478
|
+
target = "draft-07";
|
|
10479
|
+
return {
|
|
10480
|
+
processors: params.processors ?? {},
|
|
10481
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
10482
|
+
target,
|
|
10483
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
10484
|
+
override: params?.override ?? (() => {
|
|
10485
|
+
}),
|
|
10486
|
+
io: params?.io ?? "output",
|
|
10487
|
+
counter: 0,
|
|
10488
|
+
seen: /* @__PURE__ */ new Map(),
|
|
10489
|
+
cycles: params?.cycles ?? "ref",
|
|
10490
|
+
reused: params?.reused ?? "inline",
|
|
10491
|
+
external: params?.external ?? void 0
|
|
10492
|
+
};
|
|
10493
|
+
}
|
|
10494
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
10495
|
+
var _a3;
|
|
10496
|
+
const def = schema._zod.def;
|
|
10497
|
+
const seen = ctx.seen.get(schema);
|
|
10498
|
+
if (seen) {
|
|
10499
|
+
seen.count++;
|
|
10500
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
10501
|
+
if (isCycle) {
|
|
10502
|
+
seen.cycle = _params.path;
|
|
10503
|
+
}
|
|
10504
|
+
return seen.schema;
|
|
10505
|
+
}
|
|
10506
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
10507
|
+
ctx.seen.set(schema, result);
|
|
10508
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
10509
|
+
if (overrideSchema) {
|
|
10510
|
+
result.schema = overrideSchema;
|
|
10511
|
+
} else {
|
|
10512
|
+
const params = {
|
|
10513
|
+
..._params,
|
|
10514
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
10515
|
+
path: _params.path
|
|
10516
|
+
};
|
|
10517
|
+
if (schema._zod.processJSONSchema) {
|
|
10518
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
10519
|
+
} else {
|
|
10520
|
+
const _json = result.schema;
|
|
10521
|
+
const processor = ctx.processors[def.type];
|
|
10522
|
+
if (!processor) {
|
|
10523
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
10524
|
+
}
|
|
10525
|
+
processor(schema, ctx, _json, params);
|
|
10526
|
+
}
|
|
10527
|
+
const parent = schema._zod.parent;
|
|
10528
|
+
if (parent) {
|
|
10529
|
+
if (!result.ref)
|
|
10530
|
+
result.ref = parent;
|
|
10531
|
+
process2(parent, ctx, params);
|
|
10532
|
+
ctx.seen.get(parent).isParent = true;
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
10536
|
+
if (meta2)
|
|
10537
|
+
Object.assign(result.schema, meta2);
|
|
10538
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
10539
|
+
delete result.schema.examples;
|
|
10540
|
+
delete result.schema.default;
|
|
10541
|
+
}
|
|
10542
|
+
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
10543
|
+
(_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
|
|
10544
|
+
delete result.schema._prefault;
|
|
10545
|
+
const _result = ctx.seen.get(schema);
|
|
10546
|
+
return _result.schema;
|
|
10547
|
+
}
|
|
10548
|
+
function extractDefs(ctx, schema) {
|
|
10549
|
+
const root = ctx.seen.get(schema);
|
|
10550
|
+
if (!root)
|
|
10551
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
10552
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
10553
|
+
for (const entry of ctx.seen.entries()) {
|
|
10554
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
10555
|
+
if (id) {
|
|
10556
|
+
const existing = idToSchema.get(id);
|
|
10557
|
+
if (existing && existing !== entry[0]) {
|
|
10558
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
10559
|
+
}
|
|
10560
|
+
idToSchema.set(id, entry[0]);
|
|
10561
|
+
}
|
|
10562
|
+
}
|
|
10563
|
+
const makeURI = (entry) => {
|
|
10564
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
10565
|
+
if (ctx.external) {
|
|
10566
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
10567
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
10568
|
+
if (externalId) {
|
|
10569
|
+
return { ref: uriGenerator(externalId) };
|
|
10570
|
+
}
|
|
10571
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
10572
|
+
entry[1].defId = id;
|
|
10573
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
10574
|
+
}
|
|
10575
|
+
if (entry[1] === root) {
|
|
10576
|
+
return { ref: "#" };
|
|
10577
|
+
}
|
|
10578
|
+
const uriPrefix = `#`;
|
|
10579
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
10580
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
10581
|
+
return { defId, ref: defUriPrefix + defId };
|
|
10582
|
+
};
|
|
10583
|
+
const extractToDef = (entry) => {
|
|
10584
|
+
if (entry[1].schema.$ref) {
|
|
10585
|
+
return;
|
|
10586
|
+
}
|
|
10587
|
+
const seen = entry[1];
|
|
10588
|
+
const { ref, defId } = makeURI(entry);
|
|
10589
|
+
seen.def = { ...seen.schema };
|
|
10590
|
+
if (defId)
|
|
10591
|
+
seen.defId = defId;
|
|
10592
|
+
const schema2 = seen.schema;
|
|
10593
|
+
for (const key in schema2) {
|
|
10594
|
+
delete schema2[key];
|
|
10595
|
+
}
|
|
10596
|
+
schema2.$ref = ref;
|
|
10597
|
+
};
|
|
10598
|
+
if (ctx.cycles === "throw") {
|
|
10599
|
+
for (const entry of ctx.seen.entries()) {
|
|
10600
|
+
const seen = entry[1];
|
|
10601
|
+
if (seen.cycle) {
|
|
10602
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
10603
|
+
|
|
10604
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
10605
|
+
}
|
|
10606
|
+
}
|
|
10607
|
+
}
|
|
10608
|
+
for (const entry of ctx.seen.entries()) {
|
|
10609
|
+
const seen = entry[1];
|
|
10610
|
+
if (schema === entry[0]) {
|
|
10611
|
+
extractToDef(entry);
|
|
10612
|
+
continue;
|
|
10613
|
+
}
|
|
10614
|
+
if (ctx.external) {
|
|
10615
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
10616
|
+
if (schema !== entry[0] && ext) {
|
|
10617
|
+
extractToDef(entry);
|
|
10618
|
+
continue;
|
|
10619
|
+
}
|
|
10620
|
+
}
|
|
10621
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
10622
|
+
if (id) {
|
|
10623
|
+
extractToDef(entry);
|
|
10624
|
+
continue;
|
|
10625
|
+
}
|
|
10626
|
+
if (seen.cycle) {
|
|
10627
|
+
extractToDef(entry);
|
|
10628
|
+
continue;
|
|
10629
|
+
}
|
|
10630
|
+
if (seen.count > 1) {
|
|
10631
|
+
if (ctx.reused === "ref") {
|
|
10632
|
+
extractToDef(entry);
|
|
10633
|
+
continue;
|
|
10634
|
+
}
|
|
10635
|
+
}
|
|
10636
|
+
}
|
|
10637
|
+
}
|
|
10638
|
+
function finalize(ctx, schema) {
|
|
10639
|
+
const root = ctx.seen.get(schema);
|
|
10640
|
+
if (!root)
|
|
10641
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
10642
|
+
const flattenRef = (zodSchema) => {
|
|
10643
|
+
const seen = ctx.seen.get(zodSchema);
|
|
10644
|
+
if (seen.ref === null)
|
|
10645
|
+
return;
|
|
10646
|
+
const schema2 = seen.def ?? seen.schema;
|
|
10647
|
+
const _cached = { ...schema2 };
|
|
10648
|
+
const ref = seen.ref;
|
|
10649
|
+
seen.ref = null;
|
|
10650
|
+
if (ref) {
|
|
10651
|
+
flattenRef(ref);
|
|
10652
|
+
const refSeen = ctx.seen.get(ref);
|
|
10653
|
+
const refSchema = refSeen.schema;
|
|
10654
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
10655
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
10656
|
+
schema2.allOf.push(refSchema);
|
|
10657
|
+
} else {
|
|
10658
|
+
Object.assign(schema2, refSchema);
|
|
10659
|
+
}
|
|
10660
|
+
Object.assign(schema2, _cached);
|
|
10661
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
10662
|
+
if (isParentRef) {
|
|
10663
|
+
for (const key in schema2) {
|
|
10664
|
+
if (key === "$ref" || key === "allOf")
|
|
10665
|
+
continue;
|
|
10666
|
+
if (!(key in _cached)) {
|
|
10667
|
+
delete schema2[key];
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
if (refSchema.$ref && refSeen.def) {
|
|
10672
|
+
for (const key in schema2) {
|
|
10673
|
+
if (key === "$ref" || key === "allOf")
|
|
10674
|
+
continue;
|
|
10675
|
+
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
|
|
10676
|
+
delete schema2[key];
|
|
10677
|
+
}
|
|
10678
|
+
}
|
|
10679
|
+
}
|
|
10680
|
+
}
|
|
10681
|
+
const parent = zodSchema._zod.parent;
|
|
10682
|
+
if (parent && parent !== ref) {
|
|
10683
|
+
flattenRef(parent);
|
|
10684
|
+
const parentSeen = ctx.seen.get(parent);
|
|
10685
|
+
if (parentSeen?.schema.$ref) {
|
|
10686
|
+
schema2.$ref = parentSeen.schema.$ref;
|
|
10687
|
+
if (parentSeen.def) {
|
|
10688
|
+
for (const key in schema2) {
|
|
10689
|
+
if (key === "$ref" || key === "allOf")
|
|
10690
|
+
continue;
|
|
10691
|
+
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
10692
|
+
delete schema2[key];
|
|
10693
|
+
}
|
|
10694
|
+
}
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10697
|
+
}
|
|
10698
|
+
ctx.override({
|
|
10699
|
+
zodSchema,
|
|
10700
|
+
jsonSchema: schema2,
|
|
10701
|
+
path: seen.path ?? []
|
|
10702
|
+
});
|
|
10703
|
+
};
|
|
10704
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
10705
|
+
flattenRef(entry[0]);
|
|
10706
|
+
}
|
|
10707
|
+
const result = {};
|
|
10708
|
+
if (ctx.target === "draft-2020-12") {
|
|
10709
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
10710
|
+
} else if (ctx.target === "draft-07") {
|
|
10711
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
10712
|
+
} else if (ctx.target === "draft-04") {
|
|
10713
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
10714
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
10715
|
+
} else {
|
|
10716
|
+
}
|
|
10717
|
+
if (ctx.external?.uri) {
|
|
10718
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
10719
|
+
if (!id)
|
|
10720
|
+
throw new Error("Schema is missing an `id` property");
|
|
10721
|
+
result.$id = ctx.external.uri(id);
|
|
10722
|
+
}
|
|
10723
|
+
Object.assign(result, root.def ?? root.schema);
|
|
10724
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
10725
|
+
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
10726
|
+
delete result.id;
|
|
10727
|
+
const defs = ctx.external?.defs ?? {};
|
|
10728
|
+
for (const entry of ctx.seen.entries()) {
|
|
10729
|
+
const seen = entry[1];
|
|
10730
|
+
if (seen.def && seen.defId) {
|
|
10731
|
+
if (seen.def.id === seen.defId)
|
|
10732
|
+
delete seen.def.id;
|
|
10733
|
+
defs[seen.defId] = seen.def;
|
|
10734
|
+
}
|
|
10735
|
+
}
|
|
10736
|
+
if (ctx.external) {
|
|
10737
|
+
} else {
|
|
10738
|
+
if (Object.keys(defs).length > 0) {
|
|
10739
|
+
if (ctx.target === "draft-2020-12") {
|
|
10740
|
+
result.$defs = defs;
|
|
10741
|
+
} else {
|
|
10742
|
+
result.definitions = defs;
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10745
|
+
}
|
|
10746
|
+
try {
|
|
10747
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
10748
|
+
Object.defineProperty(finalized, "~standard", {
|
|
10749
|
+
value: {
|
|
10750
|
+
...schema["~standard"],
|
|
10751
|
+
jsonSchema: {
|
|
10752
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
10753
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
10754
|
+
}
|
|
10755
|
+
},
|
|
10756
|
+
enumerable: false,
|
|
10757
|
+
writable: false
|
|
10758
|
+
});
|
|
10759
|
+
return finalized;
|
|
10760
|
+
} catch (_err) {
|
|
10761
|
+
throw new Error("Error converting schema to JSON.");
|
|
10762
|
+
}
|
|
10763
|
+
}
|
|
10764
|
+
function isTransforming(_schema, _ctx) {
|
|
10765
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
10766
|
+
if (ctx.seen.has(_schema))
|
|
10767
|
+
return false;
|
|
10768
|
+
ctx.seen.add(_schema);
|
|
10769
|
+
const def = _schema._zod.def;
|
|
10770
|
+
if (def.type === "transform")
|
|
10771
|
+
return true;
|
|
10772
|
+
if (def.type === "array")
|
|
10773
|
+
return isTransforming(def.element, ctx);
|
|
10774
|
+
if (def.type === "set")
|
|
10775
|
+
return isTransforming(def.valueType, ctx);
|
|
10776
|
+
if (def.type === "lazy")
|
|
10777
|
+
return isTransforming(def.getter(), ctx);
|
|
10778
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
10779
|
+
return isTransforming(def.innerType, ctx);
|
|
10780
|
+
}
|
|
10781
|
+
if (def.type === "intersection") {
|
|
10782
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
10783
|
+
}
|
|
10784
|
+
if (def.type === "record" || def.type === "map") {
|
|
10785
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
10786
|
+
}
|
|
10787
|
+
if (def.type === "pipe") {
|
|
10788
|
+
if (_schema._zod.traits.has("$ZodCodec"))
|
|
10789
|
+
return true;
|
|
10790
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
10791
|
+
}
|
|
10792
|
+
if (def.type === "object") {
|
|
10793
|
+
for (const key in def.shape) {
|
|
10794
|
+
if (isTransforming(def.shape[key], ctx))
|
|
10795
|
+
return true;
|
|
10796
|
+
}
|
|
10797
|
+
return false;
|
|
10798
|
+
}
|
|
10799
|
+
if (def.type === "union") {
|
|
10800
|
+
for (const option of def.options) {
|
|
10801
|
+
if (isTransforming(option, ctx))
|
|
10802
|
+
return true;
|
|
10803
|
+
}
|
|
10804
|
+
return false;
|
|
10805
|
+
}
|
|
10806
|
+
if (def.type === "tuple") {
|
|
10807
|
+
for (const item of def.items) {
|
|
10808
|
+
if (isTransforming(item, ctx))
|
|
10809
|
+
return true;
|
|
10810
|
+
}
|
|
10811
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
10812
|
+
return true;
|
|
10813
|
+
return false;
|
|
10814
|
+
}
|
|
10815
|
+
return false;
|
|
10816
|
+
}
|
|
10817
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
10818
|
+
const ctx = initializeContext({ ...params, processors });
|
|
10819
|
+
process2(schema, ctx);
|
|
10820
|
+
extractDefs(ctx, schema);
|
|
10821
|
+
return finalize(ctx, schema);
|
|
10822
|
+
};
|
|
10823
|
+
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
10824
|
+
const { libraryOptions, target } = params ?? {};
|
|
10825
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
10826
|
+
process2(schema, ctx);
|
|
10827
|
+
extractDefs(ctx, schema);
|
|
10828
|
+
return finalize(ctx, schema);
|
|
10829
|
+
};
|
|
10830
|
+
|
|
10831
|
+
// ../../node_modules/zod/v4/core/json-schema-processors.js
|
|
10832
|
+
var formatMap = {
|
|
10833
|
+
guid: "uuid",
|
|
10834
|
+
url: "uri",
|
|
10835
|
+
datetime: "date-time",
|
|
10836
|
+
json_string: "json-string",
|
|
10837
|
+
regex: ""
|
|
10838
|
+
// do not set
|
|
10839
|
+
};
|
|
10840
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
10841
|
+
const json = _json;
|
|
10842
|
+
json.type = "string";
|
|
10843
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
10844
|
+
if (typeof minimum === "number")
|
|
10845
|
+
json.minLength = minimum;
|
|
10846
|
+
if (typeof maximum === "number")
|
|
10847
|
+
json.maxLength = maximum;
|
|
10848
|
+
if (format) {
|
|
10849
|
+
json.format = formatMap[format] ?? format;
|
|
10850
|
+
if (json.format === "")
|
|
10851
|
+
delete json.format;
|
|
10852
|
+
if (format === "time") {
|
|
10853
|
+
delete json.format;
|
|
10854
|
+
}
|
|
10855
|
+
}
|
|
10856
|
+
if (contentEncoding)
|
|
10857
|
+
json.contentEncoding = contentEncoding;
|
|
10858
|
+
if (patterns && patterns.size > 0) {
|
|
10859
|
+
const regexes = [...patterns];
|
|
10860
|
+
if (regexes.length === 1)
|
|
10861
|
+
json.pattern = regexes[0].source;
|
|
10862
|
+
else if (regexes.length > 1) {
|
|
10863
|
+
json.allOf = [
|
|
10864
|
+
...regexes.map((regex) => ({
|
|
10865
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
10866
|
+
pattern: regex.source
|
|
10867
|
+
}))
|
|
10868
|
+
];
|
|
10869
|
+
}
|
|
10870
|
+
}
|
|
10871
|
+
};
|
|
10872
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
10873
|
+
const json = _json;
|
|
10874
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
10875
|
+
if (typeof format === "string" && format.includes("int"))
|
|
10876
|
+
json.type = "integer";
|
|
10877
|
+
else
|
|
10878
|
+
json.type = "number";
|
|
10879
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
10880
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
10881
|
+
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
10882
|
+
if (exMin) {
|
|
10883
|
+
if (legacy) {
|
|
10884
|
+
json.minimum = exclusiveMinimum;
|
|
10885
|
+
json.exclusiveMinimum = true;
|
|
10886
|
+
} else {
|
|
10887
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
10888
|
+
}
|
|
10889
|
+
} else if (typeof minimum === "number") {
|
|
10890
|
+
json.minimum = minimum;
|
|
10891
|
+
}
|
|
10892
|
+
if (exMax) {
|
|
10893
|
+
if (legacy) {
|
|
10894
|
+
json.maximum = exclusiveMaximum;
|
|
10895
|
+
json.exclusiveMaximum = true;
|
|
10896
|
+
} else {
|
|
10897
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
10898
|
+
}
|
|
10899
|
+
} else if (typeof maximum === "number") {
|
|
10900
|
+
json.maximum = maximum;
|
|
10901
|
+
}
|
|
10902
|
+
if (typeof multipleOf === "number")
|
|
10903
|
+
json.multipleOf = multipleOf;
|
|
10904
|
+
};
|
|
10905
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
10906
|
+
json.type = "boolean";
|
|
10907
|
+
};
|
|
10908
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
10909
|
+
if (ctx.target === "openapi-3.0") {
|
|
10910
|
+
json.type = "string";
|
|
10911
|
+
json.nullable = true;
|
|
10912
|
+
json.enum = [null];
|
|
10913
|
+
} else {
|
|
10914
|
+
json.type = "null";
|
|
10915
|
+
}
|
|
10916
|
+
};
|
|
10917
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
10918
|
+
json.not = {};
|
|
10919
|
+
};
|
|
10920
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
10921
|
+
};
|
|
10922
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
10923
|
+
const def = schema._zod.def;
|
|
10924
|
+
const values = getEnumValues(def.entries);
|
|
10925
|
+
if (values.every((v) => typeof v === "number"))
|
|
10926
|
+
json.type = "number";
|
|
10927
|
+
if (values.every((v) => typeof v === "string"))
|
|
10928
|
+
json.type = "string";
|
|
10929
|
+
json.enum = values;
|
|
10930
|
+
};
|
|
10931
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
10932
|
+
const def = schema._zod.def;
|
|
10933
|
+
const vals = [];
|
|
10934
|
+
for (const val of def.values) {
|
|
10935
|
+
if (val === void 0) {
|
|
10936
|
+
if (ctx.unrepresentable === "throw") {
|
|
10937
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
10938
|
+
} else {
|
|
10939
|
+
}
|
|
10940
|
+
} else if (typeof val === "bigint") {
|
|
10941
|
+
if (ctx.unrepresentable === "throw") {
|
|
10942
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
10943
|
+
} else {
|
|
10944
|
+
vals.push(Number(val));
|
|
10945
|
+
}
|
|
10946
|
+
} else {
|
|
10947
|
+
vals.push(val);
|
|
10948
|
+
}
|
|
10949
|
+
}
|
|
10950
|
+
if (vals.length === 0) {
|
|
10951
|
+
} else if (vals.length === 1) {
|
|
10952
|
+
const val = vals[0];
|
|
10953
|
+
json.type = val === null ? "null" : typeof val;
|
|
10954
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
10955
|
+
json.enum = [val];
|
|
10956
|
+
} else {
|
|
10957
|
+
json.const = val;
|
|
10958
|
+
}
|
|
10959
|
+
} else {
|
|
10960
|
+
if (vals.every((v) => typeof v === "number"))
|
|
10961
|
+
json.type = "number";
|
|
10962
|
+
if (vals.every((v) => typeof v === "string"))
|
|
10963
|
+
json.type = "string";
|
|
10964
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
10965
|
+
json.type = "boolean";
|
|
10966
|
+
if (vals.every((v) => v === null))
|
|
10967
|
+
json.type = "null";
|
|
10968
|
+
json.enum = vals;
|
|
10969
|
+
}
|
|
10970
|
+
};
|
|
10971
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
10972
|
+
if (ctx.unrepresentable === "throw") {
|
|
10973
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
10974
|
+
}
|
|
10975
|
+
};
|
|
10976
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
10977
|
+
if (ctx.unrepresentable === "throw") {
|
|
10978
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
10979
|
+
}
|
|
10980
|
+
};
|
|
10981
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
10982
|
+
const json = _json;
|
|
10983
|
+
const def = schema._zod.def;
|
|
10984
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
10985
|
+
if (typeof minimum === "number")
|
|
10986
|
+
json.minItems = minimum;
|
|
10987
|
+
if (typeof maximum === "number")
|
|
10988
|
+
json.maxItems = maximum;
|
|
10989
|
+
json.type = "array";
|
|
10990
|
+
json.items = process2(def.element, ctx, {
|
|
10991
|
+
...params,
|
|
10992
|
+
path: [...params.path, "items"]
|
|
10993
|
+
});
|
|
10994
|
+
};
|
|
10995
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
10996
|
+
const json = _json;
|
|
10997
|
+
const def = schema._zod.def;
|
|
10998
|
+
json.type = "object";
|
|
10999
|
+
json.properties = {};
|
|
11000
|
+
const shape = def.shape;
|
|
11001
|
+
for (const key in shape) {
|
|
11002
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
11003
|
+
...params,
|
|
11004
|
+
path: [...params.path, "properties", key]
|
|
11005
|
+
});
|
|
11006
|
+
}
|
|
11007
|
+
const allKeys = new Set(Object.keys(shape));
|
|
11008
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
11009
|
+
const v = def.shape[key]._zod;
|
|
11010
|
+
if (ctx.io === "input") {
|
|
11011
|
+
return v.optin === void 0;
|
|
11012
|
+
} else {
|
|
11013
|
+
return v.optout === void 0;
|
|
11014
|
+
}
|
|
11015
|
+
}));
|
|
11016
|
+
if (requiredKeys.size > 0) {
|
|
11017
|
+
json.required = Array.from(requiredKeys);
|
|
11018
|
+
}
|
|
11019
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
11020
|
+
json.additionalProperties = false;
|
|
11021
|
+
} else if (!def.catchall) {
|
|
11022
|
+
if (ctx.io === "output")
|
|
11023
|
+
json.additionalProperties = false;
|
|
11024
|
+
} else if (def.catchall) {
|
|
11025
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
11026
|
+
...params,
|
|
11027
|
+
path: [...params.path, "additionalProperties"]
|
|
11028
|
+
});
|
|
11029
|
+
}
|
|
11030
|
+
};
|
|
11031
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
11032
|
+
const def = schema._zod.def;
|
|
11033
|
+
const isExclusive = def.inclusive === false;
|
|
11034
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
11035
|
+
...params,
|
|
11036
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
11037
|
+
}));
|
|
11038
|
+
if (isExclusive) {
|
|
11039
|
+
json.oneOf = options;
|
|
11040
|
+
} else {
|
|
11041
|
+
json.anyOf = options;
|
|
11042
|
+
}
|
|
11043
|
+
};
|
|
11044
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
11045
|
+
const def = schema._zod.def;
|
|
11046
|
+
const a = process2(def.left, ctx, {
|
|
11047
|
+
...params,
|
|
11048
|
+
path: [...params.path, "allOf", 0]
|
|
9917
11049
|
});
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
const schema = new Class2({
|
|
9922
|
-
type: "custom",
|
|
9923
|
-
check: "custom",
|
|
9924
|
-
fn,
|
|
9925
|
-
...normalizeParams(_params)
|
|
11050
|
+
const b = process2(def.right, ctx, {
|
|
11051
|
+
...params,
|
|
11052
|
+
path: [...params.path, "allOf", 1]
|
|
9926
11053
|
});
|
|
9927
|
-
|
|
9928
|
-
|
|
11054
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
11055
|
+
const allOf = [
|
|
11056
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
11057
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
11058
|
+
];
|
|
11059
|
+
json.allOf = allOf;
|
|
11060
|
+
};
|
|
11061
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
11062
|
+
const json = _json;
|
|
11063
|
+
const def = schema._zod.def;
|
|
11064
|
+
json.type = "object";
|
|
11065
|
+
const keyType = def.keyType;
|
|
11066
|
+
const keyBag = keyType._zod.bag;
|
|
11067
|
+
const patterns = keyBag?.patterns;
|
|
11068
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
11069
|
+
const valueSchema = process2(def.valueType, ctx, {
|
|
11070
|
+
...params,
|
|
11071
|
+
path: [...params.path, "patternProperties", "*"]
|
|
11072
|
+
});
|
|
11073
|
+
json.patternProperties = {};
|
|
11074
|
+
for (const pattern of patterns) {
|
|
11075
|
+
json.patternProperties[pattern.source] = valueSchema;
|
|
11076
|
+
}
|
|
11077
|
+
} else {
|
|
11078
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
11079
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
11080
|
+
...params,
|
|
11081
|
+
path: [...params.path, "propertyNames"]
|
|
11082
|
+
});
|
|
11083
|
+
}
|
|
11084
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
11085
|
+
...params,
|
|
11086
|
+
path: [...params.path, "additionalProperties"]
|
|
11087
|
+
});
|
|
11088
|
+
}
|
|
11089
|
+
const keyValues = keyType._zod.values;
|
|
11090
|
+
if (keyValues) {
|
|
11091
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
11092
|
+
if (validKeyValues.length > 0) {
|
|
11093
|
+
json.required = validKeyValues;
|
|
11094
|
+
}
|
|
11095
|
+
}
|
|
11096
|
+
};
|
|
11097
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
11098
|
+
const def = schema._zod.def;
|
|
11099
|
+
const inner = process2(def.innerType, ctx, params);
|
|
11100
|
+
const seen = ctx.seen.get(schema);
|
|
11101
|
+
if (ctx.target === "openapi-3.0") {
|
|
11102
|
+
seen.ref = def.innerType;
|
|
11103
|
+
json.nullable = true;
|
|
11104
|
+
} else {
|
|
11105
|
+
json.anyOf = [inner, { type: "null" }];
|
|
11106
|
+
}
|
|
11107
|
+
};
|
|
11108
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
11109
|
+
const def = schema._zod.def;
|
|
11110
|
+
process2(def.innerType, ctx, params);
|
|
11111
|
+
const seen = ctx.seen.get(schema);
|
|
11112
|
+
seen.ref = def.innerType;
|
|
11113
|
+
};
|
|
11114
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
11115
|
+
const def = schema._zod.def;
|
|
11116
|
+
process2(def.innerType, ctx, params);
|
|
11117
|
+
const seen = ctx.seen.get(schema);
|
|
11118
|
+
seen.ref = def.innerType;
|
|
11119
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
11120
|
+
};
|
|
11121
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
11122
|
+
const def = schema._zod.def;
|
|
11123
|
+
process2(def.innerType, ctx, params);
|
|
11124
|
+
const seen = ctx.seen.get(schema);
|
|
11125
|
+
seen.ref = def.innerType;
|
|
11126
|
+
if (ctx.io === "input")
|
|
11127
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
11128
|
+
};
|
|
11129
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
11130
|
+
const def = schema._zod.def;
|
|
11131
|
+
process2(def.innerType, ctx, params);
|
|
11132
|
+
const seen = ctx.seen.get(schema);
|
|
11133
|
+
seen.ref = def.innerType;
|
|
11134
|
+
let catchValue;
|
|
11135
|
+
try {
|
|
11136
|
+
catchValue = def.catchValue(void 0);
|
|
11137
|
+
} catch {
|
|
11138
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
11139
|
+
}
|
|
11140
|
+
json.default = catchValue;
|
|
11141
|
+
};
|
|
11142
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
11143
|
+
const def = schema._zod.def;
|
|
11144
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
11145
|
+
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
11146
|
+
process2(innerType, ctx, params);
|
|
11147
|
+
const seen = ctx.seen.get(schema);
|
|
11148
|
+
seen.ref = innerType;
|
|
11149
|
+
};
|
|
11150
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
11151
|
+
const def = schema._zod.def;
|
|
11152
|
+
process2(def.innerType, ctx, params);
|
|
11153
|
+
const seen = ctx.seen.get(schema);
|
|
11154
|
+
seen.ref = def.innerType;
|
|
11155
|
+
json.readOnly = true;
|
|
11156
|
+
};
|
|
11157
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
11158
|
+
const def = schema._zod.def;
|
|
11159
|
+
process2(def.innerType, ctx, params);
|
|
11160
|
+
const seen = ctx.seen.get(schema);
|
|
11161
|
+
seen.ref = def.innerType;
|
|
11162
|
+
};
|
|
9929
11163
|
|
|
9930
11164
|
// ../../node_modules/zod/v4/classic/iso.js
|
|
9931
11165
|
var iso_exports = {};
|
|
@@ -9982,11 +11216,17 @@ var initializer2 = (inst, issues) => {
|
|
|
9982
11216
|
// enumerable: false,
|
|
9983
11217
|
},
|
|
9984
11218
|
addIssue: {
|
|
9985
|
-
value: (issue2) =>
|
|
11219
|
+
value: (issue2) => {
|
|
11220
|
+
inst.issues.push(issue2);
|
|
11221
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
11222
|
+
}
|
|
9986
11223
|
// enumerable: false,
|
|
9987
11224
|
},
|
|
9988
11225
|
addIssues: {
|
|
9989
|
-
value: (issues2) =>
|
|
11226
|
+
value: (issues2) => {
|
|
11227
|
+
inst.issues.push(...issues2);
|
|
11228
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
11229
|
+
}
|
|
9990
11230
|
// enumerable: false,
|
|
9991
11231
|
},
|
|
9992
11232
|
isEmpty: {
|
|
@@ -9997,105 +11237,246 @@ var initializer2 = (inst, issues) => {
|
|
|
9997
11237
|
}
|
|
9998
11238
|
});
|
|
9999
11239
|
};
|
|
10000
|
-
var
|
|
10001
|
-
var ZodRealError = $constructor("ZodError", initializer2, {
|
|
11240
|
+
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
|
|
10002
11241
|
Parent: Error
|
|
10003
11242
|
});
|
|
10004
11243
|
|
|
10005
11244
|
// ../../node_modules/zod/v4/classic/parse.js
|
|
10006
|
-
var
|
|
10007
|
-
var
|
|
11245
|
+
var parse2 = /* @__PURE__ */ _parse(ZodRealError);
|
|
11246
|
+
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
10008
11247
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
10009
11248
|
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
11249
|
+
var encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
11250
|
+
var decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
11251
|
+
var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
11252
|
+
var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
11253
|
+
var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
11254
|
+
var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
11255
|
+
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
11256
|
+
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
10010
11257
|
|
|
10011
11258
|
// ../../node_modules/zod/v4/classic/schemas.js
|
|
11259
|
+
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
11260
|
+
function _installLazyMethods(inst, group, methods) {
|
|
11261
|
+
const proto = Object.getPrototypeOf(inst);
|
|
11262
|
+
let installed = _installedGroups.get(proto);
|
|
11263
|
+
if (!installed) {
|
|
11264
|
+
installed = /* @__PURE__ */ new Set();
|
|
11265
|
+
_installedGroups.set(proto, installed);
|
|
11266
|
+
}
|
|
11267
|
+
if (installed.has(group))
|
|
11268
|
+
return;
|
|
11269
|
+
installed.add(group);
|
|
11270
|
+
for (const key in methods) {
|
|
11271
|
+
const fn = methods[key];
|
|
11272
|
+
Object.defineProperty(proto, key, {
|
|
11273
|
+
configurable: true,
|
|
11274
|
+
enumerable: false,
|
|
11275
|
+
get() {
|
|
11276
|
+
const bound = fn.bind(this);
|
|
11277
|
+
Object.defineProperty(this, key, {
|
|
11278
|
+
configurable: true,
|
|
11279
|
+
writable: true,
|
|
11280
|
+
enumerable: true,
|
|
11281
|
+
value: bound
|
|
11282
|
+
});
|
|
11283
|
+
return bound;
|
|
11284
|
+
},
|
|
11285
|
+
set(v) {
|
|
11286
|
+
Object.defineProperty(this, key, {
|
|
11287
|
+
configurable: true,
|
|
11288
|
+
writable: true,
|
|
11289
|
+
enumerable: true,
|
|
11290
|
+
value: v
|
|
11291
|
+
});
|
|
11292
|
+
}
|
|
11293
|
+
});
|
|
11294
|
+
}
|
|
11295
|
+
}
|
|
10012
11296
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
10013
11297
|
$ZodType.init(inst, def);
|
|
11298
|
+
Object.assign(inst["~standard"], {
|
|
11299
|
+
jsonSchema: {
|
|
11300
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
11301
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
11302
|
+
}
|
|
11303
|
+
});
|
|
11304
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
10014
11305
|
inst.def = def;
|
|
11306
|
+
inst.type = def.type;
|
|
10015
11307
|
Object.defineProperty(inst, "_def", { value: def });
|
|
10016
|
-
inst.
|
|
10017
|
-
return inst.clone(
|
|
10018
|
-
{
|
|
10019
|
-
...def,
|
|
10020
|
-
checks: [
|
|
10021
|
-
...def.checks ?? [],
|
|
10022
|
-
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
10023
|
-
]
|
|
10024
|
-
}
|
|
10025
|
-
// { parent: true }
|
|
10026
|
-
);
|
|
10027
|
-
};
|
|
10028
|
-
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
10029
|
-
inst.brand = () => inst;
|
|
10030
|
-
inst.register = ((reg, meta) => {
|
|
10031
|
-
reg.add(inst, meta);
|
|
10032
|
-
return inst;
|
|
10033
|
-
});
|
|
10034
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
11308
|
+
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
10035
11309
|
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
10036
|
-
inst.parseAsync = async (data, params) =>
|
|
11310
|
+
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
10037
11311
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
10038
11312
|
inst.spa = inst.safeParseAsync;
|
|
10039
|
-
inst.
|
|
10040
|
-
inst.
|
|
10041
|
-
inst.
|
|
10042
|
-
inst.
|
|
10043
|
-
inst.
|
|
10044
|
-
inst.
|
|
10045
|
-
inst.
|
|
10046
|
-
inst.
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
11313
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
11314
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
11315
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
11316
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
11317
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
11318
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
11319
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
11320
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
11321
|
+
_installLazyMethods(inst, "ZodType", {
|
|
11322
|
+
check(...chks) {
|
|
11323
|
+
const def2 = this.def;
|
|
11324
|
+
return this.clone(util_exports.mergeDefs(def2, {
|
|
11325
|
+
checks: [
|
|
11326
|
+
...def2.checks ?? [],
|
|
11327
|
+
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
11328
|
+
]
|
|
11329
|
+
}), { parent: true });
|
|
11330
|
+
},
|
|
11331
|
+
with(...chks) {
|
|
11332
|
+
return this.check(...chks);
|
|
11333
|
+
},
|
|
11334
|
+
clone(def2, params) {
|
|
11335
|
+
return clone(this, def2, params);
|
|
11336
|
+
},
|
|
11337
|
+
brand() {
|
|
11338
|
+
return this;
|
|
11339
|
+
},
|
|
11340
|
+
register(reg, meta2) {
|
|
11341
|
+
reg.add(this, meta2);
|
|
11342
|
+
return this;
|
|
11343
|
+
},
|
|
11344
|
+
refine(check, params) {
|
|
11345
|
+
return this.check(refine(check, params));
|
|
11346
|
+
},
|
|
11347
|
+
superRefine(refinement, params) {
|
|
11348
|
+
return this.check(superRefine(refinement, params));
|
|
11349
|
+
},
|
|
11350
|
+
overwrite(fn) {
|
|
11351
|
+
return this.check(_overwrite(fn));
|
|
11352
|
+
},
|
|
11353
|
+
optional() {
|
|
11354
|
+
return optional(this);
|
|
11355
|
+
},
|
|
11356
|
+
exactOptional() {
|
|
11357
|
+
return exactOptional(this);
|
|
11358
|
+
},
|
|
11359
|
+
nullable() {
|
|
11360
|
+
return nullable(this);
|
|
11361
|
+
},
|
|
11362
|
+
nullish() {
|
|
11363
|
+
return optional(nullable(this));
|
|
11364
|
+
},
|
|
11365
|
+
nonoptional(params) {
|
|
11366
|
+
return nonoptional(this, params);
|
|
11367
|
+
},
|
|
11368
|
+
array() {
|
|
11369
|
+
return array(this);
|
|
11370
|
+
},
|
|
11371
|
+
or(arg) {
|
|
11372
|
+
return union([this, arg]);
|
|
11373
|
+
},
|
|
11374
|
+
and(arg) {
|
|
11375
|
+
return intersection(this, arg);
|
|
11376
|
+
},
|
|
11377
|
+
transform(tx) {
|
|
11378
|
+
return pipe(this, transform(tx));
|
|
11379
|
+
},
|
|
11380
|
+
default(d) {
|
|
11381
|
+
return _default(this, d);
|
|
11382
|
+
},
|
|
11383
|
+
prefault(d) {
|
|
11384
|
+
return prefault(this, d);
|
|
11385
|
+
},
|
|
11386
|
+
catch(params) {
|
|
11387
|
+
return _catch(this, params);
|
|
11388
|
+
},
|
|
11389
|
+
pipe(target) {
|
|
11390
|
+
return pipe(this, target);
|
|
11391
|
+
},
|
|
11392
|
+
readonly() {
|
|
11393
|
+
return readonly(this);
|
|
11394
|
+
},
|
|
11395
|
+
describe(description) {
|
|
11396
|
+
const cl = this.clone();
|
|
11397
|
+
globalRegistry.add(cl, { description });
|
|
11398
|
+
return cl;
|
|
11399
|
+
},
|
|
11400
|
+
meta(...args) {
|
|
11401
|
+
if (args.length === 0)
|
|
11402
|
+
return globalRegistry.get(this);
|
|
11403
|
+
const cl = this.clone();
|
|
11404
|
+
globalRegistry.add(cl, args[0]);
|
|
11405
|
+
return cl;
|
|
11406
|
+
},
|
|
11407
|
+
isOptional() {
|
|
11408
|
+
return this.safeParse(void 0).success;
|
|
11409
|
+
},
|
|
11410
|
+
isNullable() {
|
|
11411
|
+
return this.safeParse(null).success;
|
|
11412
|
+
},
|
|
11413
|
+
apply(fn) {
|
|
11414
|
+
return fn(this);
|
|
11415
|
+
}
|
|
11416
|
+
});
|
|
10060
11417
|
Object.defineProperty(inst, "description", {
|
|
10061
11418
|
get() {
|
|
10062
11419
|
return globalRegistry.get(inst)?.description;
|
|
10063
11420
|
},
|
|
10064
11421
|
configurable: true
|
|
10065
11422
|
});
|
|
10066
|
-
inst.meta = (...args) => {
|
|
10067
|
-
if (args.length === 0) {
|
|
10068
|
-
return globalRegistry.get(inst);
|
|
10069
|
-
}
|
|
10070
|
-
const cl = inst.clone();
|
|
10071
|
-
globalRegistry.add(cl, args[0]);
|
|
10072
|
-
return cl;
|
|
10073
|
-
};
|
|
10074
|
-
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
10075
|
-
inst.isNullable = () => inst.safeParse(null).success;
|
|
10076
11423
|
return inst;
|
|
10077
11424
|
});
|
|
10078
11425
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
10079
11426
|
$ZodString.init(inst, def);
|
|
10080
11427
|
ZodType.init(inst, def);
|
|
11428
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
10081
11429
|
const bag = inst._zod.bag;
|
|
10082
11430
|
inst.format = bag.format ?? null;
|
|
10083
11431
|
inst.minLength = bag.minimum ?? null;
|
|
10084
11432
|
inst.maxLength = bag.maximum ?? null;
|
|
10085
|
-
inst
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
11433
|
+
_installLazyMethods(inst, "_ZodString", {
|
|
11434
|
+
regex(...args) {
|
|
11435
|
+
return this.check(_regex(...args));
|
|
11436
|
+
},
|
|
11437
|
+
includes(...args) {
|
|
11438
|
+
return this.check(_includes(...args));
|
|
11439
|
+
},
|
|
11440
|
+
startsWith(...args) {
|
|
11441
|
+
return this.check(_startsWith(...args));
|
|
11442
|
+
},
|
|
11443
|
+
endsWith(...args) {
|
|
11444
|
+
return this.check(_endsWith(...args));
|
|
11445
|
+
},
|
|
11446
|
+
min(...args) {
|
|
11447
|
+
return this.check(_minLength(...args));
|
|
11448
|
+
},
|
|
11449
|
+
max(...args) {
|
|
11450
|
+
return this.check(_maxLength(...args));
|
|
11451
|
+
},
|
|
11452
|
+
length(...args) {
|
|
11453
|
+
return this.check(_length(...args));
|
|
11454
|
+
},
|
|
11455
|
+
nonempty(...args) {
|
|
11456
|
+
return this.check(_minLength(1, ...args));
|
|
11457
|
+
},
|
|
11458
|
+
lowercase(params) {
|
|
11459
|
+
return this.check(_lowercase(params));
|
|
11460
|
+
},
|
|
11461
|
+
uppercase(params) {
|
|
11462
|
+
return this.check(_uppercase(params));
|
|
11463
|
+
},
|
|
11464
|
+
trim() {
|
|
11465
|
+
return this.check(_trim());
|
|
11466
|
+
},
|
|
11467
|
+
normalize(...args) {
|
|
11468
|
+
return this.check(_normalize(...args));
|
|
11469
|
+
},
|
|
11470
|
+
toLowerCase() {
|
|
11471
|
+
return this.check(_toLowerCase());
|
|
11472
|
+
},
|
|
11473
|
+
toUpperCase() {
|
|
11474
|
+
return this.check(_toUpperCase());
|
|
11475
|
+
},
|
|
11476
|
+
slugify() {
|
|
11477
|
+
return this.check(_slugify());
|
|
11478
|
+
}
|
|
11479
|
+
});
|
|
10099
11480
|
});
|
|
10100
11481
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
10101
11482
|
$ZodString.init(inst, def);
|
|
@@ -10214,21 +11595,54 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
10214
11595
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
10215
11596
|
$ZodNumber.init(inst, def);
|
|
10216
11597
|
ZodType.init(inst, def);
|
|
10217
|
-
inst.
|
|
10218
|
-
inst
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
11598
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
11599
|
+
_installLazyMethods(inst, "ZodNumber", {
|
|
11600
|
+
gt(value, params) {
|
|
11601
|
+
return this.check(_gt(value, params));
|
|
11602
|
+
},
|
|
11603
|
+
gte(value, params) {
|
|
11604
|
+
return this.check(_gte(value, params));
|
|
11605
|
+
},
|
|
11606
|
+
min(value, params) {
|
|
11607
|
+
return this.check(_gte(value, params));
|
|
11608
|
+
},
|
|
11609
|
+
lt(value, params) {
|
|
11610
|
+
return this.check(_lt(value, params));
|
|
11611
|
+
},
|
|
11612
|
+
lte(value, params) {
|
|
11613
|
+
return this.check(_lte(value, params));
|
|
11614
|
+
},
|
|
11615
|
+
max(value, params) {
|
|
11616
|
+
return this.check(_lte(value, params));
|
|
11617
|
+
},
|
|
11618
|
+
int(params) {
|
|
11619
|
+
return this.check(int(params));
|
|
11620
|
+
},
|
|
11621
|
+
safe(params) {
|
|
11622
|
+
return this.check(int(params));
|
|
11623
|
+
},
|
|
11624
|
+
positive(params) {
|
|
11625
|
+
return this.check(_gt(0, params));
|
|
11626
|
+
},
|
|
11627
|
+
nonnegative(params) {
|
|
11628
|
+
return this.check(_gte(0, params));
|
|
11629
|
+
},
|
|
11630
|
+
negative(params) {
|
|
11631
|
+
return this.check(_lt(0, params));
|
|
11632
|
+
},
|
|
11633
|
+
nonpositive(params) {
|
|
11634
|
+
return this.check(_lte(0, params));
|
|
11635
|
+
},
|
|
11636
|
+
multipleOf(value, params) {
|
|
11637
|
+
return this.check(_multipleOf(value, params));
|
|
11638
|
+
},
|
|
11639
|
+
step(value, params) {
|
|
11640
|
+
return this.check(_multipleOf(value, params));
|
|
11641
|
+
},
|
|
11642
|
+
finite() {
|
|
11643
|
+
return this;
|
|
11644
|
+
}
|
|
11645
|
+
});
|
|
10232
11646
|
const bag = inst._zod.bag;
|
|
10233
11647
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
10234
11648
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
@@ -10249,6 +11663,7 @@ function int(params) {
|
|
|
10249
11663
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
10250
11664
|
$ZodBoolean.init(inst, def);
|
|
10251
11665
|
ZodType.init(inst, def);
|
|
11666
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
10252
11667
|
});
|
|
10253
11668
|
function boolean2(params) {
|
|
10254
11669
|
return _boolean(ZodBoolean, params);
|
|
@@ -10256,6 +11671,7 @@ function boolean2(params) {
|
|
|
10256
11671
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
10257
11672
|
$ZodNull.init(inst, def);
|
|
10258
11673
|
ZodType.init(inst, def);
|
|
11674
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
10259
11675
|
});
|
|
10260
11676
|
function _null3(params) {
|
|
10261
11677
|
return _null2(ZodNull, params);
|
|
@@ -10263,6 +11679,7 @@ function _null3(params) {
|
|
|
10263
11679
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
10264
11680
|
$ZodUnknown.init(inst, def);
|
|
10265
11681
|
ZodType.init(inst, def);
|
|
11682
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
10266
11683
|
});
|
|
10267
11684
|
function unknown() {
|
|
10268
11685
|
return _unknown(ZodUnknown);
|
|
@@ -10270,6 +11687,7 @@ function unknown() {
|
|
|
10270
11687
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
10271
11688
|
$ZodNever.init(inst, def);
|
|
10272
11689
|
ZodType.init(inst, def);
|
|
11690
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
10273
11691
|
});
|
|
10274
11692
|
function never(params) {
|
|
10275
11693
|
return _never(ZodNever, params);
|
|
@@ -10277,42 +11695,82 @@ function never(params) {
|
|
|
10277
11695
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
10278
11696
|
$ZodArray.init(inst, def);
|
|
10279
11697
|
ZodType.init(inst, def);
|
|
11698
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
10280
11699
|
inst.element = def.element;
|
|
10281
|
-
inst
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
11700
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
11701
|
+
min(n, params) {
|
|
11702
|
+
return this.check(_minLength(n, params));
|
|
11703
|
+
},
|
|
11704
|
+
nonempty(params) {
|
|
11705
|
+
return this.check(_minLength(1, params));
|
|
11706
|
+
},
|
|
11707
|
+
max(n, params) {
|
|
11708
|
+
return this.check(_maxLength(n, params));
|
|
11709
|
+
},
|
|
11710
|
+
length(n, params) {
|
|
11711
|
+
return this.check(_length(n, params));
|
|
11712
|
+
},
|
|
11713
|
+
unwrap() {
|
|
11714
|
+
return this.element;
|
|
11715
|
+
}
|
|
11716
|
+
});
|
|
10286
11717
|
});
|
|
10287
11718
|
function array(element, params) {
|
|
10288
11719
|
return _array(ZodArray, element, params);
|
|
10289
11720
|
}
|
|
10290
11721
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
10291
|
-
$
|
|
11722
|
+
$ZodObjectJIT.init(inst, def);
|
|
10292
11723
|
ZodType.init(inst, def);
|
|
10293
|
-
|
|
10294
|
-
inst
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
11724
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
11725
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
11726
|
+
return def.shape;
|
|
11727
|
+
});
|
|
11728
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
11729
|
+
keyof() {
|
|
11730
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
11731
|
+
},
|
|
11732
|
+
catchall(catchall) {
|
|
11733
|
+
return this.clone({ ...this._zod.def, catchall });
|
|
11734
|
+
},
|
|
11735
|
+
passthrough() {
|
|
11736
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
11737
|
+
},
|
|
11738
|
+
loose() {
|
|
11739
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
11740
|
+
},
|
|
11741
|
+
strict() {
|
|
11742
|
+
return this.clone({ ...this._zod.def, catchall: never() });
|
|
11743
|
+
},
|
|
11744
|
+
strip() {
|
|
11745
|
+
return this.clone({ ...this._zod.def, catchall: void 0 });
|
|
11746
|
+
},
|
|
11747
|
+
extend(incoming) {
|
|
11748
|
+
return util_exports.extend(this, incoming);
|
|
11749
|
+
},
|
|
11750
|
+
safeExtend(incoming) {
|
|
11751
|
+
return util_exports.safeExtend(this, incoming);
|
|
11752
|
+
},
|
|
11753
|
+
merge(other) {
|
|
11754
|
+
return util_exports.merge(this, other);
|
|
11755
|
+
},
|
|
11756
|
+
pick(mask) {
|
|
11757
|
+
return util_exports.pick(this, mask);
|
|
11758
|
+
},
|
|
11759
|
+
omit(mask) {
|
|
11760
|
+
return util_exports.omit(this, mask);
|
|
11761
|
+
},
|
|
11762
|
+
partial(...args) {
|
|
11763
|
+
return util_exports.partial(ZodOptional, this, args[0]);
|
|
11764
|
+
},
|
|
11765
|
+
required(...args) {
|
|
11766
|
+
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
11767
|
+
}
|
|
11768
|
+
});
|
|
10308
11769
|
});
|
|
10309
11770
|
function object(shape, params) {
|
|
10310
11771
|
const def = {
|
|
10311
11772
|
type: "object",
|
|
10312
|
-
|
|
10313
|
-
util_exports.assignProp(this, "shape", { ...shape });
|
|
10314
|
-
return this.shape;
|
|
10315
|
-
},
|
|
11773
|
+
shape: shape ?? {},
|
|
10316
11774
|
...util_exports.normalizeParams(params)
|
|
10317
11775
|
};
|
|
10318
11776
|
return new ZodObject(def);
|
|
@@ -10320,10 +11778,7 @@ function object(shape, params) {
|
|
|
10320
11778
|
function looseObject(shape, params) {
|
|
10321
11779
|
return new ZodObject({
|
|
10322
11780
|
type: "object",
|
|
10323
|
-
|
|
10324
|
-
util_exports.assignProp(this, "shape", { ...shape });
|
|
10325
|
-
return this.shape;
|
|
10326
|
-
},
|
|
11781
|
+
shape,
|
|
10327
11782
|
catchall: unknown(),
|
|
10328
11783
|
...util_exports.normalizeParams(params)
|
|
10329
11784
|
});
|
|
@@ -10331,6 +11786,7 @@ function looseObject(shape, params) {
|
|
|
10331
11786
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
10332
11787
|
$ZodUnion.init(inst, def);
|
|
10333
11788
|
ZodType.init(inst, def);
|
|
11789
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
10334
11790
|
inst.options = def.options;
|
|
10335
11791
|
});
|
|
10336
11792
|
function union(options, params) {
|
|
@@ -10355,6 +11811,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
10355
11811
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
10356
11812
|
$ZodIntersection.init(inst, def);
|
|
10357
11813
|
ZodType.init(inst, def);
|
|
11814
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
10358
11815
|
});
|
|
10359
11816
|
function intersection(left, right) {
|
|
10360
11817
|
return new ZodIntersection({
|
|
@@ -10366,10 +11823,19 @@ function intersection(left, right) {
|
|
|
10366
11823
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
10367
11824
|
$ZodRecord.init(inst, def);
|
|
10368
11825
|
ZodType.init(inst, def);
|
|
11826
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
10369
11827
|
inst.keyType = def.keyType;
|
|
10370
11828
|
inst.valueType = def.valueType;
|
|
10371
11829
|
});
|
|
10372
11830
|
function record(keyType, valueType, params) {
|
|
11831
|
+
if (!valueType || !valueType._zod) {
|
|
11832
|
+
return new ZodRecord({
|
|
11833
|
+
type: "record",
|
|
11834
|
+
keyType: string2(),
|
|
11835
|
+
valueType: keyType,
|
|
11836
|
+
...util_exports.normalizeParams(valueType)
|
|
11837
|
+
});
|
|
11838
|
+
}
|
|
10373
11839
|
return new ZodRecord({
|
|
10374
11840
|
type: "record",
|
|
10375
11841
|
keyType,
|
|
@@ -10380,6 +11846,7 @@ function record(keyType, valueType, params) {
|
|
|
10380
11846
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
10381
11847
|
$ZodEnum.init(inst, def);
|
|
10382
11848
|
ZodType.init(inst, def);
|
|
11849
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
10383
11850
|
inst.enum = def.entries;
|
|
10384
11851
|
inst.options = Object.values(def.entries);
|
|
10385
11852
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -10425,6 +11892,7 @@ function _enum(values, params) {
|
|
|
10425
11892
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
10426
11893
|
$ZodLiteral.init(inst, def);
|
|
10427
11894
|
ZodType.init(inst, def);
|
|
11895
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
10428
11896
|
inst.values = new Set(def.values);
|
|
10429
11897
|
Object.defineProperty(inst, "value", {
|
|
10430
11898
|
get() {
|
|
@@ -10445,7 +11913,11 @@ function literal(value, params) {
|
|
|
10445
11913
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
10446
11914
|
$ZodTransform.init(inst, def);
|
|
10447
11915
|
ZodType.init(inst, def);
|
|
11916
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
10448
11917
|
inst._zod.parse = (payload, _ctx) => {
|
|
11918
|
+
if (_ctx.direction === "backward") {
|
|
11919
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
11920
|
+
}
|
|
10449
11921
|
payload.addIssue = (issue2) => {
|
|
10450
11922
|
if (typeof issue2 === "string") {
|
|
10451
11923
|
payload.issues.push(util_exports.issue(issue2, payload.value, def));
|
|
@@ -10456,7 +11928,6 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
10456
11928
|
_issue.code ?? (_issue.code = "custom");
|
|
10457
11929
|
_issue.input ?? (_issue.input = payload.value);
|
|
10458
11930
|
_issue.inst ?? (_issue.inst = inst);
|
|
10459
|
-
_issue.continue ?? (_issue.continue = true);
|
|
10460
11931
|
payload.issues.push(util_exports.issue(_issue));
|
|
10461
11932
|
}
|
|
10462
11933
|
};
|
|
@@ -10464,10 +11935,12 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
10464
11935
|
if (output instanceof Promise) {
|
|
10465
11936
|
return output.then((output2) => {
|
|
10466
11937
|
payload.value = output2;
|
|
11938
|
+
payload.fallback = true;
|
|
10467
11939
|
return payload;
|
|
10468
11940
|
});
|
|
10469
11941
|
}
|
|
10470
11942
|
payload.value = output;
|
|
11943
|
+
payload.fallback = true;
|
|
10471
11944
|
return payload;
|
|
10472
11945
|
};
|
|
10473
11946
|
});
|
|
@@ -10480,6 +11953,7 @@ function transform(fn) {
|
|
|
10480
11953
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
10481
11954
|
$ZodOptional.init(inst, def);
|
|
10482
11955
|
ZodType.init(inst, def);
|
|
11956
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
10483
11957
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10484
11958
|
});
|
|
10485
11959
|
function optional(innerType) {
|
|
@@ -10488,9 +11962,22 @@ function optional(innerType) {
|
|
|
10488
11962
|
innerType
|
|
10489
11963
|
});
|
|
10490
11964
|
}
|
|
11965
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
11966
|
+
$ZodExactOptional.init(inst, def);
|
|
11967
|
+
ZodType.init(inst, def);
|
|
11968
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
11969
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
11970
|
+
});
|
|
11971
|
+
function exactOptional(innerType) {
|
|
11972
|
+
return new ZodExactOptional({
|
|
11973
|
+
type: "optional",
|
|
11974
|
+
innerType
|
|
11975
|
+
});
|
|
11976
|
+
}
|
|
10491
11977
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
10492
11978
|
$ZodNullable.init(inst, def);
|
|
10493
11979
|
ZodType.init(inst, def);
|
|
11980
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
10494
11981
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10495
11982
|
});
|
|
10496
11983
|
function nullable(innerType) {
|
|
@@ -10502,6 +11989,7 @@ function nullable(innerType) {
|
|
|
10502
11989
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
10503
11990
|
$ZodDefault.init(inst, def);
|
|
10504
11991
|
ZodType.init(inst, def);
|
|
11992
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
10505
11993
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10506
11994
|
inst.removeDefault = inst.unwrap;
|
|
10507
11995
|
});
|
|
@@ -10510,13 +11998,14 @@ function _default(innerType, defaultValue) {
|
|
|
10510
11998
|
type: "default",
|
|
10511
11999
|
innerType,
|
|
10512
12000
|
get defaultValue() {
|
|
10513
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
12001
|
+
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
10514
12002
|
}
|
|
10515
12003
|
});
|
|
10516
12004
|
}
|
|
10517
12005
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
10518
12006
|
$ZodPrefault.init(inst, def);
|
|
10519
12007
|
ZodType.init(inst, def);
|
|
12008
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
10520
12009
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10521
12010
|
});
|
|
10522
12011
|
function prefault(innerType, defaultValue) {
|
|
@@ -10524,13 +12013,14 @@ function prefault(innerType, defaultValue) {
|
|
|
10524
12013
|
type: "prefault",
|
|
10525
12014
|
innerType,
|
|
10526
12015
|
get defaultValue() {
|
|
10527
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
12016
|
+
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
10528
12017
|
}
|
|
10529
12018
|
});
|
|
10530
12019
|
}
|
|
10531
12020
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
10532
12021
|
$ZodNonOptional.init(inst, def);
|
|
10533
12022
|
ZodType.init(inst, def);
|
|
12023
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
10534
12024
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10535
12025
|
});
|
|
10536
12026
|
function nonoptional(innerType, params) {
|
|
@@ -10543,6 +12033,7 @@ function nonoptional(innerType, params) {
|
|
|
10543
12033
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
10544
12034
|
$ZodCatch.init(inst, def);
|
|
10545
12035
|
ZodType.init(inst, def);
|
|
12036
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
10546
12037
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
10547
12038
|
inst.removeCatch = inst.unwrap;
|
|
10548
12039
|
});
|
|
@@ -10556,6 +12047,7 @@ function _catch(innerType, catchValue) {
|
|
|
10556
12047
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
10557
12048
|
$ZodPipe.init(inst, def);
|
|
10558
12049
|
ZodType.init(inst, def);
|
|
12050
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
10559
12051
|
inst.in = def.in;
|
|
10560
12052
|
inst.out = def.out;
|
|
10561
12053
|
});
|
|
@@ -10567,9 +12059,15 @@ function pipe(in_, out) {
|
|
|
10567
12059
|
// ...util.normalizeParams(params),
|
|
10568
12060
|
});
|
|
10569
12061
|
}
|
|
12062
|
+
var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
|
|
12063
|
+
ZodPipe.init(inst, def);
|
|
12064
|
+
$ZodPreprocess.init(inst, def);
|
|
12065
|
+
});
|
|
10570
12066
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
10571
12067
|
$ZodReadonly.init(inst, def);
|
|
10572
12068
|
ZodType.init(inst, def);
|
|
12069
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
12070
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
10573
12071
|
});
|
|
10574
12072
|
function readonly(innerType) {
|
|
10575
12073
|
return new ZodReadonly({
|
|
@@ -10580,43 +12078,23 @@ function readonly(innerType) {
|
|
|
10580
12078
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
10581
12079
|
$ZodCustom.init(inst, def);
|
|
10582
12080
|
ZodType.init(inst, def);
|
|
12081
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
10583
12082
|
});
|
|
10584
|
-
function check(fn) {
|
|
10585
|
-
const ch = new $ZodCheck({
|
|
10586
|
-
check: "custom"
|
|
10587
|
-
// ...util.normalizeParams(params),
|
|
10588
|
-
});
|
|
10589
|
-
ch._zod.check = fn;
|
|
10590
|
-
return ch;
|
|
10591
|
-
}
|
|
10592
12083
|
function custom(fn, _params) {
|
|
10593
12084
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
10594
12085
|
}
|
|
10595
12086
|
function refine(fn, _params = {}) {
|
|
10596
12087
|
return _refine(ZodCustom, fn, _params);
|
|
10597
12088
|
}
|
|
10598
|
-
function superRefine(fn) {
|
|
10599
|
-
|
|
10600
|
-
payload.addIssue = (issue2) => {
|
|
10601
|
-
if (typeof issue2 === "string") {
|
|
10602
|
-
payload.issues.push(util_exports.issue(issue2, payload.value, ch._zod.def));
|
|
10603
|
-
} else {
|
|
10604
|
-
const _issue = issue2;
|
|
10605
|
-
if (_issue.fatal)
|
|
10606
|
-
_issue.continue = false;
|
|
10607
|
-
_issue.code ?? (_issue.code = "custom");
|
|
10608
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
10609
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
10610
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
10611
|
-
payload.issues.push(util_exports.issue(_issue));
|
|
10612
|
-
}
|
|
10613
|
-
};
|
|
10614
|
-
return fn(payload.value, payload);
|
|
10615
|
-
});
|
|
10616
|
-
return ch;
|
|
12089
|
+
function superRefine(fn, params) {
|
|
12090
|
+
return _superRefine(fn, params);
|
|
10617
12091
|
}
|
|
10618
12092
|
function preprocess(fn, schema) {
|
|
10619
|
-
return
|
|
12093
|
+
return new ZodPreprocess({
|
|
12094
|
+
type: "pipe",
|
|
12095
|
+
in: transform(fn),
|
|
12096
|
+
out: schema
|
|
12097
|
+
});
|
|
10620
12098
|
}
|
|
10621
12099
|
|
|
10622
12100
|
// ../../node_modules/zod/v4/classic/external.js
|
|
@@ -12171,7 +13649,7 @@ function serializeMessage(message) {
|
|
|
12171
13649
|
|
|
12172
13650
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
12173
13651
|
var StdioServerTransport = class {
|
|
12174
|
-
constructor(_stdin =
|
|
13652
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
12175
13653
|
this._stdin = _stdin;
|
|
12176
13654
|
this._stdout = _stdout;
|
|
12177
13655
|
this._readBuffer = new ReadBuffer();
|
|
@@ -14124,22 +15602,66 @@ async function ensureToolsServer(paths) {
|
|
|
14124
15602
|
}
|
|
14125
15603
|
|
|
14126
15604
|
// ../argent-mcp/src/content.ts
|
|
14127
|
-
|
|
15605
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
15606
|
+
var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
15607
|
+
async function fetchPngBytes(url) {
|
|
15608
|
+
try {
|
|
15609
|
+
const res = await fetch(url);
|
|
15610
|
+
if (!res.ok) return null;
|
|
15611
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
15612
|
+
if (buf.length < PNG_SIGNATURE.length) return null;
|
|
15613
|
+
if (!buf.subarray(0, PNG_SIGNATURE.length).equals(PNG_SIGNATURE)) return null;
|
|
15614
|
+
return buf;
|
|
15615
|
+
} catch {
|
|
15616
|
+
return null;
|
|
15617
|
+
}
|
|
15618
|
+
}
|
|
15619
|
+
async function toMcpContent(result, outputHint, args) {
|
|
14128
15620
|
if (outputHint === "image" && result && typeof result === "object" && "url" in result) {
|
|
14129
|
-
const
|
|
14130
|
-
|
|
14131
|
-
|
|
15621
|
+
const r = result;
|
|
15622
|
+
if (isRecord(args) && args.includeImageInContext === false) {
|
|
15623
|
+
return [{ type: "text", text: `Saved: ${r.path}` }];
|
|
15624
|
+
}
|
|
15625
|
+
const buf = await fetchPngBytes(r.url);
|
|
15626
|
+
if (buf) {
|
|
15627
|
+
return [
|
|
15628
|
+
{
|
|
15629
|
+
type: "image",
|
|
15630
|
+
data: buf.toString("base64"),
|
|
15631
|
+
mimeType: "image/png"
|
|
15632
|
+
},
|
|
15633
|
+
{ type: "text", text: `Saved: ${r.path ?? ""}` }
|
|
15634
|
+
];
|
|
15635
|
+
}
|
|
14132
15636
|
return [
|
|
14133
15637
|
{
|
|
14134
|
-
type: "
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
},
|
|
14138
|
-
{ type: "text", text: `Saved: ${filePath}` }
|
|
15638
|
+
type: "text",
|
|
15639
|
+
text: `(Screenshot unavailable: no valid PNG at ${r.url}. Take a new screenshot.)`
|
|
15640
|
+
}
|
|
14139
15641
|
];
|
|
14140
15642
|
}
|
|
14141
15643
|
return [{ type: "text", text: JSON.stringify(result, null, 2) }];
|
|
14142
15644
|
}
|
|
15645
|
+
function isRecord(value) {
|
|
15646
|
+
return value !== null && typeof value === "object";
|
|
15647
|
+
}
|
|
15648
|
+
function isScreenshotDiffResult(value) {
|
|
15649
|
+
if (!isRecord(value)) return false;
|
|
15650
|
+
return typeof value.summary === "string";
|
|
15651
|
+
}
|
|
15652
|
+
async function screenshotDiffToMcpContent(result) {
|
|
15653
|
+
const blocks = [];
|
|
15654
|
+
if (typeof result.contextDiffPath === "string") {
|
|
15655
|
+
const buf = await readFile2(result.contextDiffPath);
|
|
15656
|
+
blocks.push({
|
|
15657
|
+
type: "image",
|
|
15658
|
+
data: buf.toString("base64"),
|
|
15659
|
+
mimeType: "image/png"
|
|
15660
|
+
});
|
|
15661
|
+
}
|
|
15662
|
+
blocks.push({ type: "text", text: result.summary });
|
|
15663
|
+
return blocks;
|
|
15664
|
+
}
|
|
14143
15665
|
async function flowRunToMcpContent(result) {
|
|
14144
15666
|
const blocks = [];
|
|
14145
15667
|
if (result.executionPrerequisite) {
|
|
@@ -14164,7 +15686,7 @@ async function flowRunToMcpContent(result) {
|
|
|
14164
15686
|
});
|
|
14165
15687
|
} else {
|
|
14166
15688
|
blocks.push({ type: "text", text: `[${num}] ${step.tool}` });
|
|
14167
|
-
const stepContent = await toMcpContent(step.result, step.outputHint);
|
|
15689
|
+
const stepContent = await toMcpContent(step.result, step.outputHint, step.args);
|
|
14168
15690
|
blocks.push(...stepContent);
|
|
14169
15691
|
}
|
|
14170
15692
|
}
|
|
@@ -14235,14 +15757,14 @@ function getAutoScreenshotDelayMs(toolName) {
|
|
|
14235
15757
|
|
|
14236
15758
|
// ../argent-mcp/src/tool-mapping.ts
|
|
14237
15759
|
function toMcpTool(t) {
|
|
14238
|
-
const
|
|
14239
|
-
if (t.alwaysLoad)
|
|
14240
|
-
if (t.searchHint)
|
|
15760
|
+
const meta2 = {};
|
|
15761
|
+
if (t.alwaysLoad) meta2["anthropic/alwaysLoad"] = true;
|
|
15762
|
+
if (t.searchHint) meta2["anthropic/searchHint"] = t.searchHint;
|
|
14241
15763
|
return {
|
|
14242
15764
|
name: t.name,
|
|
14243
15765
|
description: t.description,
|
|
14244
15766
|
inputSchema: { type: "object", ...t.inputSchema },
|
|
14245
|
-
...Object.keys(
|
|
15767
|
+
...Object.keys(meta2).length > 0 ? { _meta: meta2 } : {}
|
|
14246
15768
|
};
|
|
14247
15769
|
}
|
|
14248
15770
|
|
|
@@ -14320,18 +15842,18 @@ async function startMcpServer(options) {
|
|
|
14320
15842
|
}
|
|
14321
15843
|
async function callTool(name, args) {
|
|
14322
15844
|
const tools = await fetchTools();
|
|
14323
|
-
const
|
|
15845
|
+
const meta2 = tools.find((t) => t.name === name);
|
|
14324
15846
|
const res = await fetchWithReconnect(() => `${TOOLS_URL}/tools/${name}`, reconnect, {
|
|
14325
15847
|
init: {
|
|
14326
15848
|
method: "POST",
|
|
14327
15849
|
headers: { "Content-Type": "application/json" },
|
|
14328
15850
|
body: JSON.stringify(args ?? {})
|
|
14329
15851
|
},
|
|
14330
|
-
fetchTimeoutMs:
|
|
15852
|
+
fetchTimeoutMs: meta2?.longRunning ? null : FETCH_TIMEOUT_MS
|
|
14331
15853
|
});
|
|
14332
15854
|
const json = await res.json();
|
|
14333
15855
|
if (!res.ok) throw new Error(json.error ?? json.message ?? res.statusText);
|
|
14334
|
-
return { result: json.data, outputHint:
|
|
15856
|
+
return { result: json.data, outputHint: meta2?.outputHint, note: json.note };
|
|
14335
15857
|
}
|
|
14336
15858
|
const server = new Server(
|
|
14337
15859
|
{ name: "argent", version: "0.5.3" },
|
|
@@ -14375,30 +15897,33 @@ async function startMcpServer(options) {
|
|
|
14375
15897
|
isError: false,
|
|
14376
15898
|
result
|
|
14377
15899
|
});
|
|
14378
|
-
let content
|
|
15900
|
+
let content;
|
|
15901
|
+
if (params.name === "flow-execute" && result && typeof result === "object" && "flow" in result && "steps" in result) {
|
|
15902
|
+
content = await flowRunToMcpContent(result);
|
|
15903
|
+
} else if (params.name === "screenshot-diff" && isScreenshotDiffResult(result)) {
|
|
15904
|
+
content = await screenshotDiffToMcpContent(result);
|
|
15905
|
+
} else {
|
|
15906
|
+
content = await toMcpContent(result, outputHint, params.arguments);
|
|
15907
|
+
}
|
|
14379
15908
|
const udid = getUdidFromArgs(params.arguments);
|
|
14380
15909
|
if (autoScreenshotEnabled() && udid && shouldAutoScreenshot(params.name)) {
|
|
14381
15910
|
const delayMs = getAutoScreenshotDelayMs(params.name);
|
|
14382
15911
|
if (delayMs > 0) await new Promise((r) => setTimeout(r, delayMs));
|
|
14383
15912
|
try {
|
|
14384
15913
|
const screenshotResult = await callTool("screenshot", { udid });
|
|
14385
|
-
const screenshotContent = await toMcpContent(screenshotResult.result, "image");
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
type: "text",
|
|
14399
|
-
text: `(Auto-screenshot skipped: ${ssErr instanceof Error ? ssErr.message : String(ssErr)})`
|
|
14400
|
-
}
|
|
14401
|
-
];
|
|
15914
|
+
const screenshotContent = await toMcpContent(screenshotResult.result, "image", { udid });
|
|
15915
|
+
const hasImage = screenshotContent.some((b) => b.type === "image");
|
|
15916
|
+
if (hasImage) {
|
|
15917
|
+
content = [
|
|
15918
|
+
...content,
|
|
15919
|
+
{
|
|
15920
|
+
type: "text",
|
|
15921
|
+
text: "--- Screen after action ---"
|
|
15922
|
+
},
|
|
15923
|
+
...screenshotContent
|
|
15924
|
+
];
|
|
15925
|
+
}
|
|
15926
|
+
} catch {
|
|
14402
15927
|
}
|
|
14403
15928
|
}
|
|
14404
15929
|
if (note) {
|