@elysiajs/openapi 1.4.14 → 1.4.15
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/README.md +125 -101
- package/bun.lock +8 -8
- package/dist/cjs/gen/index.js +322 -70
- package/dist/cjs/index.js +340 -87
- package/dist/cjs/scalar/index.js +18 -17
- package/dist/gen/index.mjs +322 -70
- package/dist/index.mjs +340 -87
- package/dist/scalar/index.mjs +18 -17
- package/package.json +8 -8
package/dist/cjs/gen/index.js
CHANGED
|
@@ -4179,6 +4179,7 @@ __export(util_exports, {
|
|
|
4179
4179
|
objectClone: () => objectClone,
|
|
4180
4180
|
omit: () => omit,
|
|
4181
4181
|
optionalKeys: () => optionalKeys,
|
|
4182
|
+
parsedType: () => parsedType,
|
|
4182
4183
|
partial: () => partial,
|
|
4183
4184
|
pick: () => pick,
|
|
4184
4185
|
prefixIssues: () => prefixIssues,
|
|
@@ -4511,6 +4512,11 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
4511
4512
|
};
|
|
4512
4513
|
function pick(schema, mask) {
|
|
4513
4514
|
const currDef = schema._zod.def;
|
|
4515
|
+
const checks = currDef.checks;
|
|
4516
|
+
const hasChecks = checks && checks.length > 0;
|
|
4517
|
+
if (hasChecks) {
|
|
4518
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
4519
|
+
}
|
|
4514
4520
|
const def = mergeDefs(schema._zod.def, {
|
|
4515
4521
|
get shape() {
|
|
4516
4522
|
const newShape = {};
|
|
@@ -4531,6 +4537,11 @@ function pick(schema, mask) {
|
|
|
4531
4537
|
}
|
|
4532
4538
|
function omit(schema, mask) {
|
|
4533
4539
|
const currDef = schema._zod.def;
|
|
4540
|
+
const checks = currDef.checks;
|
|
4541
|
+
const hasChecks = checks && checks.length > 0;
|
|
4542
|
+
if (hasChecks) {
|
|
4543
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
4544
|
+
}
|
|
4534
4545
|
const def = mergeDefs(schema._zod.def, {
|
|
4535
4546
|
get shape() {
|
|
4536
4547
|
const newShape = { ...schema._zod.def.shape };
|
|
@@ -4556,15 +4567,19 @@ function extend(schema, shape) {
|
|
|
4556
4567
|
const checks = schema._zod.def.checks;
|
|
4557
4568
|
const hasChecks = checks && checks.length > 0;
|
|
4558
4569
|
if (hasChecks) {
|
|
4559
|
-
|
|
4570
|
+
const existingShape = schema._zod.def.shape;
|
|
4571
|
+
for (const key in shape) {
|
|
4572
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
4573
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4560
4576
|
}
|
|
4561
4577
|
const def = mergeDefs(schema._zod.def, {
|
|
4562
4578
|
get shape() {
|
|
4563
4579
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
4564
4580
|
assignProp(this, "shape", _shape);
|
|
4565
4581
|
return _shape;
|
|
4566
|
-
}
|
|
4567
|
-
checks: []
|
|
4582
|
+
}
|
|
4568
4583
|
});
|
|
4569
4584
|
return clone(schema, def);
|
|
4570
4585
|
}
|
|
@@ -4572,15 +4587,13 @@ function safeExtend(schema, shape) {
|
|
|
4572
4587
|
if (!isPlainObject(shape)) {
|
|
4573
4588
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
4574
4589
|
}
|
|
4575
|
-
const def = {
|
|
4576
|
-
...schema._zod.def,
|
|
4590
|
+
const def = mergeDefs(schema._zod.def, {
|
|
4577
4591
|
get shape() {
|
|
4578
4592
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
4579
4593
|
assignProp(this, "shape", _shape);
|
|
4580
4594
|
return _shape;
|
|
4581
|
-
}
|
|
4582
|
-
|
|
4583
|
-
};
|
|
4595
|
+
}
|
|
4596
|
+
});
|
|
4584
4597
|
return clone(schema, def);
|
|
4585
4598
|
}
|
|
4586
4599
|
function merge(a, b) {
|
|
@@ -4599,6 +4612,12 @@ function merge(a, b) {
|
|
|
4599
4612
|
return clone(a, def);
|
|
4600
4613
|
}
|
|
4601
4614
|
function partial(Class2, schema, mask) {
|
|
4615
|
+
const currDef = schema._zod.def;
|
|
4616
|
+
const checks = currDef.checks;
|
|
4617
|
+
const hasChecks = checks && checks.length > 0;
|
|
4618
|
+
if (hasChecks) {
|
|
4619
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
4620
|
+
}
|
|
4602
4621
|
const def = mergeDefs(schema._zod.def, {
|
|
4603
4622
|
get shape() {
|
|
4604
4623
|
const oldShape = schema._zod.def.shape;
|
|
@@ -4657,8 +4676,7 @@ function required(Class2, schema, mask) {
|
|
|
4657
4676
|
}
|
|
4658
4677
|
assignProp(this, "shape", shape);
|
|
4659
4678
|
return shape;
|
|
4660
|
-
}
|
|
4661
|
-
checks: []
|
|
4679
|
+
}
|
|
4662
4680
|
});
|
|
4663
4681
|
return clone(schema, def);
|
|
4664
4682
|
}
|
|
@@ -4712,6 +4730,27 @@ function getLengthableOrigin(input) {
|
|
|
4712
4730
|
return "string";
|
|
4713
4731
|
return "unknown";
|
|
4714
4732
|
}
|
|
4733
|
+
function parsedType(data) {
|
|
4734
|
+
const t = typeof data;
|
|
4735
|
+
switch (t) {
|
|
4736
|
+
case "number": {
|
|
4737
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
4738
|
+
}
|
|
4739
|
+
case "object": {
|
|
4740
|
+
if (data === null) {
|
|
4741
|
+
return "null";
|
|
4742
|
+
}
|
|
4743
|
+
if (Array.isArray(data)) {
|
|
4744
|
+
return "array";
|
|
4745
|
+
}
|
|
4746
|
+
const obj = data;
|
|
4747
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
4748
|
+
return obj.constructor.name;
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
return t;
|
|
4753
|
+
}
|
|
4715
4754
|
function issue(...args) {
|
|
4716
4755
|
const [iss, input, inst] = args;
|
|
4717
4756
|
if (typeof iss === "string") {
|
|
@@ -4940,7 +4979,7 @@ 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]
|
|
|
4940
4979
|
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])$/;
|
|
4941
4980
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
4942
4981
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
4943
|
-
var e164 = /^\+
|
|
4982
|
+
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
4944
4983
|
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])))`;
|
|
4945
4984
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
4946
4985
|
function timeSource(args) {
|
|
@@ -4967,7 +5006,7 @@ var string2 = (params) => {
|
|
|
4967
5006
|
};
|
|
4968
5007
|
var bigint = /^-?\d+n?$/;
|
|
4969
5008
|
var integer = /^-?\d+$/;
|
|
4970
|
-
var number = /^-?\d+(?:\.\d+)
|
|
5009
|
+
var number = /^-?\d+(?:\.\d+)?$/;
|
|
4971
5010
|
var boolean = /^(?:true|false)$/i;
|
|
4972
5011
|
var _null = /^null$/i;
|
|
4973
5012
|
var _undefined = /^undefined$/i;
|
|
@@ -5006,7 +5045,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
5006
5045
|
payload.issues.push({
|
|
5007
5046
|
origin,
|
|
5008
5047
|
code: "too_big",
|
|
5009
|
-
maximum: def.value,
|
|
5048
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5010
5049
|
input: payload.value,
|
|
5011
5050
|
inclusive: def.inclusive,
|
|
5012
5051
|
inst,
|
|
@@ -5034,7 +5073,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5034
5073
|
payload.issues.push({
|
|
5035
5074
|
origin,
|
|
5036
5075
|
code: "too_small",
|
|
5037
|
-
minimum: def.value,
|
|
5076
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5038
5077
|
input: payload.value,
|
|
5039
5078
|
inclusive: def.inclusive,
|
|
5040
5079
|
inst,
|
|
@@ -5101,6 +5140,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5101
5140
|
note: "Integers must be within the safe integer range.",
|
|
5102
5141
|
inst,
|
|
5103
5142
|
origin,
|
|
5143
|
+
inclusive: true,
|
|
5104
5144
|
continue: !def.abort
|
|
5105
5145
|
});
|
|
5106
5146
|
} else {
|
|
@@ -5111,6 +5151,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5111
5151
|
note: "Integers must be within the safe integer range.",
|
|
5112
5152
|
inst,
|
|
5113
5153
|
origin,
|
|
5154
|
+
inclusive: true,
|
|
5114
5155
|
continue: !def.abort
|
|
5115
5156
|
});
|
|
5116
5157
|
}
|
|
@@ -5134,7 +5175,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5134
5175
|
input,
|
|
5135
5176
|
code: "too_big",
|
|
5136
5177
|
maximum,
|
|
5137
|
-
|
|
5178
|
+
inclusive: true,
|
|
5179
|
+
inst,
|
|
5180
|
+
continue: !def.abort
|
|
5138
5181
|
});
|
|
5139
5182
|
}
|
|
5140
5183
|
};
|
|
@@ -5399,8 +5442,8 @@ var Doc = class {
|
|
|
5399
5442
|
// node_modules/zod/v4/core/versions.js
|
|
5400
5443
|
var version = {
|
|
5401
5444
|
major: 4,
|
|
5402
|
-
minor:
|
|
5403
|
-
patch:
|
|
5445
|
+
minor: 3,
|
|
5446
|
+
patch: 6
|
|
5404
5447
|
};
|
|
5405
5448
|
|
|
5406
5449
|
// node_modules/zod/v4/core/schemas.js
|
|
@@ -5500,7 +5543,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5500
5543
|
return runChecks(result, checks, ctx);
|
|
5501
5544
|
};
|
|
5502
5545
|
}
|
|
5503
|
-
inst
|
|
5546
|
+
defineLazy(inst, "~standard", () => ({
|
|
5504
5547
|
validate: (value) => {
|
|
5505
5548
|
try {
|
|
5506
5549
|
const r = safeParse2(inst, value);
|
|
@@ -5511,7 +5554,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
5511
5554
|
},
|
|
5512
5555
|
vendor: "zod",
|
|
5513
5556
|
version: 1
|
|
5514
|
-
};
|
|
5557
|
+
}));
|
|
5515
5558
|
});
|
|
5516
5559
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
5517
5560
|
$ZodType.init(inst, def);
|
|
@@ -6022,8 +6065,11 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
6022
6065
|
return payload;
|
|
6023
6066
|
};
|
|
6024
6067
|
});
|
|
6025
|
-
function handlePropertyResult(result, final, key, input) {
|
|
6068
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
6026
6069
|
if (result.issues.length) {
|
|
6070
|
+
if (isOptionalOut && !(key in input)) {
|
|
6071
|
+
return;
|
|
6072
|
+
}
|
|
6027
6073
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
6028
6074
|
}
|
|
6029
6075
|
if (result.value === void 0) {
|
|
@@ -6055,6 +6101,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6055
6101
|
const keySet = def.keySet;
|
|
6056
6102
|
const _catchall = def.catchall._zod;
|
|
6057
6103
|
const t = _catchall.def.type;
|
|
6104
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
6058
6105
|
for (const key in input) {
|
|
6059
6106
|
if (keySet.has(key))
|
|
6060
6107
|
continue;
|
|
@@ -6064,9 +6111,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6064
6111
|
}
|
|
6065
6112
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
6066
6113
|
if (r instanceof Promise) {
|
|
6067
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
6114
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
6068
6115
|
} else {
|
|
6069
|
-
handlePropertyResult(r, payload, key, input);
|
|
6116
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
6070
6117
|
}
|
|
6071
6118
|
}
|
|
6072
6119
|
if (unrecognized.length) {
|
|
@@ -6132,11 +6179,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
6132
6179
|
const shape = value.shape;
|
|
6133
6180
|
for (const key of value.keys) {
|
|
6134
6181
|
const el = shape[key];
|
|
6182
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
6135
6183
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
6136
6184
|
if (r instanceof Promise) {
|
|
6137
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
6185
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
6138
6186
|
} else {
|
|
6139
|
-
handlePropertyResult(r, payload, key, input);
|
|
6187
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
6140
6188
|
}
|
|
6141
6189
|
}
|
|
6142
6190
|
if (!catchall) {
|
|
@@ -6166,8 +6214,31 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
6166
6214
|
for (const key of normalized.keys) {
|
|
6167
6215
|
const id = ids[key];
|
|
6168
6216
|
const k = esc(key);
|
|
6217
|
+
const schema = shape[key];
|
|
6218
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
6169
6219
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
6170
|
-
|
|
6220
|
+
if (isOptionalOut) {
|
|
6221
|
+
doc.write(`
|
|
6222
|
+
if (${id}.issues.length) {
|
|
6223
|
+
if (${k} in input) {
|
|
6224
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
6225
|
+
...iss,
|
|
6226
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
6227
|
+
})));
|
|
6228
|
+
}
|
|
6229
|
+
}
|
|
6230
|
+
|
|
6231
|
+
if (${id}.value === undefined) {
|
|
6232
|
+
if (${k} in input) {
|
|
6233
|
+
newResult[${k}] = undefined;
|
|
6234
|
+
}
|
|
6235
|
+
} else {
|
|
6236
|
+
newResult[${k}] = ${id}.value;
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6239
|
+
`);
|
|
6240
|
+
} else {
|
|
6241
|
+
doc.write(`
|
|
6171
6242
|
if (${id}.issues.length) {
|
|
6172
6243
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
6173
6244
|
...iss,
|
|
@@ -6175,7 +6246,6 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
6175
6246
|
})));
|
|
6176
6247
|
}
|
|
6177
6248
|
|
|
6178
|
-
|
|
6179
6249
|
if (${id}.value === undefined) {
|
|
6180
6250
|
if (${k} in input) {
|
|
6181
6251
|
newResult[${k}] = undefined;
|
|
@@ -6185,6 +6255,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
6185
6255
|
}
|
|
6186
6256
|
|
|
6187
6257
|
`);
|
|
6258
|
+
}
|
|
6188
6259
|
}
|
|
6189
6260
|
doc.write(`payload.value = newResult;`);
|
|
6190
6261
|
doc.write(`return payload;`);
|
|
@@ -6413,11 +6484,34 @@ function mergeValues(a, b) {
|
|
|
6413
6484
|
return { valid: false, mergeErrorPath: [] };
|
|
6414
6485
|
}
|
|
6415
6486
|
function handleIntersectionResults(result, left, right) {
|
|
6416
|
-
|
|
6417
|
-
|
|
6487
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
6488
|
+
let unrecIssue;
|
|
6489
|
+
for (const iss of left.issues) {
|
|
6490
|
+
if (iss.code === "unrecognized_keys") {
|
|
6491
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
6492
|
+
for (const k of iss.keys) {
|
|
6493
|
+
if (!unrecKeys.has(k))
|
|
6494
|
+
unrecKeys.set(k, {});
|
|
6495
|
+
unrecKeys.get(k).l = true;
|
|
6496
|
+
}
|
|
6497
|
+
} else {
|
|
6498
|
+
result.issues.push(iss);
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
for (const iss of right.issues) {
|
|
6502
|
+
if (iss.code === "unrecognized_keys") {
|
|
6503
|
+
for (const k of iss.keys) {
|
|
6504
|
+
if (!unrecKeys.has(k))
|
|
6505
|
+
unrecKeys.set(k, {});
|
|
6506
|
+
unrecKeys.get(k).r = true;
|
|
6507
|
+
}
|
|
6508
|
+
} else {
|
|
6509
|
+
result.issues.push(iss);
|
|
6510
|
+
}
|
|
6418
6511
|
}
|
|
6419
|
-
|
|
6420
|
-
|
|
6512
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
6513
|
+
if (bothKeys.length && unrecIssue) {
|
|
6514
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
6421
6515
|
}
|
|
6422
6516
|
if (aborted(result))
|
|
6423
6517
|
return result;
|
|
@@ -6451,7 +6545,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
6451
6545
|
const tooSmall = input.length < optStart - 1;
|
|
6452
6546
|
if (tooBig || tooSmall) {
|
|
6453
6547
|
payload.issues.push({
|
|
6454
|
-
...tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length },
|
|
6548
|
+
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
|
|
6455
6549
|
input,
|
|
6456
6550
|
inst,
|
|
6457
6551
|
origin: "array"
|
|
@@ -6559,10 +6653,20 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
6559
6653
|
for (const key of Reflect.ownKeys(input)) {
|
|
6560
6654
|
if (key === "__proto__")
|
|
6561
6655
|
continue;
|
|
6562
|
-
|
|
6656
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
6563
6657
|
if (keyResult instanceof Promise) {
|
|
6564
6658
|
throw new Error("Async schemas not supported in object keys currently");
|
|
6565
6659
|
}
|
|
6660
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
6661
|
+
if (checkNumericKey) {
|
|
6662
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
6663
|
+
if (retryResult instanceof Promise) {
|
|
6664
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
6665
|
+
}
|
|
6666
|
+
if (retryResult.issues.length === 0) {
|
|
6667
|
+
keyResult = retryResult;
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6566
6670
|
if (keyResult.issues.length) {
|
|
6567
6671
|
if (def.mode === "loose") {
|
|
6568
6672
|
payload.value[key] = input[key];
|
|
@@ -6693,6 +6797,14 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
6693
6797
|
return def.innerType._zod.run(payload, ctx);
|
|
6694
6798
|
};
|
|
6695
6799
|
});
|
|
6800
|
+
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
6801
|
+
$ZodOptional.init(inst, def);
|
|
6802
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
6803
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
6804
|
+
inst._zod.parse = (payload, ctx) => {
|
|
6805
|
+
return def.innerType._zod.run(payload, ctx);
|
|
6806
|
+
};
|
|
6807
|
+
});
|
|
6696
6808
|
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
6697
6809
|
$ZodType.init(inst, def);
|
|
6698
6810
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -6914,9 +7026,6 @@ var $ZodRegistry = class {
|
|
|
6914
7026
|
const meta2 = _meta[0];
|
|
6915
7027
|
this._map.set(schema, meta2);
|
|
6916
7028
|
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
6917
|
-
if (this._idmap.has(meta2.id)) {
|
|
6918
|
-
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
6919
|
-
}
|
|
6920
7029
|
this._idmap.set(meta2.id, schema);
|
|
6921
7030
|
}
|
|
6922
7031
|
return this;
|
|
@@ -6955,12 +7064,14 @@ function registry() {
|
|
|
6955
7064
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
6956
7065
|
|
|
6957
7066
|
// node_modules/zod/v4/core/api.js
|
|
7067
|
+
// @__NO_SIDE_EFFECTS__
|
|
6958
7068
|
function _string(Class2, params) {
|
|
6959
7069
|
return new Class2({
|
|
6960
7070
|
type: "string",
|
|
6961
7071
|
...normalizeParams(params)
|
|
6962
7072
|
});
|
|
6963
7073
|
}
|
|
7074
|
+
// @__NO_SIDE_EFFECTS__
|
|
6964
7075
|
function _email(Class2, params) {
|
|
6965
7076
|
return new Class2({
|
|
6966
7077
|
type: "string",
|
|
@@ -6970,6 +7081,7 @@ function _email(Class2, params) {
|
|
|
6970
7081
|
...normalizeParams(params)
|
|
6971
7082
|
});
|
|
6972
7083
|
}
|
|
7084
|
+
// @__NO_SIDE_EFFECTS__
|
|
6973
7085
|
function _guid(Class2, params) {
|
|
6974
7086
|
return new Class2({
|
|
6975
7087
|
type: "string",
|
|
@@ -6979,6 +7091,7 @@ function _guid(Class2, params) {
|
|
|
6979
7091
|
...normalizeParams(params)
|
|
6980
7092
|
});
|
|
6981
7093
|
}
|
|
7094
|
+
// @__NO_SIDE_EFFECTS__
|
|
6982
7095
|
function _uuid(Class2, params) {
|
|
6983
7096
|
return new Class2({
|
|
6984
7097
|
type: "string",
|
|
@@ -6988,6 +7101,7 @@ function _uuid(Class2, params) {
|
|
|
6988
7101
|
...normalizeParams(params)
|
|
6989
7102
|
});
|
|
6990
7103
|
}
|
|
7104
|
+
// @__NO_SIDE_EFFECTS__
|
|
6991
7105
|
function _uuidv4(Class2, params) {
|
|
6992
7106
|
return new Class2({
|
|
6993
7107
|
type: "string",
|
|
@@ -6998,6 +7112,7 @@ function _uuidv4(Class2, params) {
|
|
|
6998
7112
|
...normalizeParams(params)
|
|
6999
7113
|
});
|
|
7000
7114
|
}
|
|
7115
|
+
// @__NO_SIDE_EFFECTS__
|
|
7001
7116
|
function _uuidv6(Class2, params) {
|
|
7002
7117
|
return new Class2({
|
|
7003
7118
|
type: "string",
|
|
@@ -7008,6 +7123,7 @@ function _uuidv6(Class2, params) {
|
|
|
7008
7123
|
...normalizeParams(params)
|
|
7009
7124
|
});
|
|
7010
7125
|
}
|
|
7126
|
+
// @__NO_SIDE_EFFECTS__
|
|
7011
7127
|
function _uuidv7(Class2, params) {
|
|
7012
7128
|
return new Class2({
|
|
7013
7129
|
type: "string",
|
|
@@ -7018,6 +7134,7 @@ function _uuidv7(Class2, params) {
|
|
|
7018
7134
|
...normalizeParams(params)
|
|
7019
7135
|
});
|
|
7020
7136
|
}
|
|
7137
|
+
// @__NO_SIDE_EFFECTS__
|
|
7021
7138
|
function _url(Class2, params) {
|
|
7022
7139
|
return new Class2({
|
|
7023
7140
|
type: "string",
|
|
@@ -7027,6 +7144,7 @@ function _url(Class2, params) {
|
|
|
7027
7144
|
...normalizeParams(params)
|
|
7028
7145
|
});
|
|
7029
7146
|
}
|
|
7147
|
+
// @__NO_SIDE_EFFECTS__
|
|
7030
7148
|
function _emoji2(Class2, params) {
|
|
7031
7149
|
return new Class2({
|
|
7032
7150
|
type: "string",
|
|
@@ -7036,6 +7154,7 @@ function _emoji2(Class2, params) {
|
|
|
7036
7154
|
...normalizeParams(params)
|
|
7037
7155
|
});
|
|
7038
7156
|
}
|
|
7157
|
+
// @__NO_SIDE_EFFECTS__
|
|
7039
7158
|
function _nanoid(Class2, params) {
|
|
7040
7159
|
return new Class2({
|
|
7041
7160
|
type: "string",
|
|
@@ -7045,6 +7164,7 @@ function _nanoid(Class2, params) {
|
|
|
7045
7164
|
...normalizeParams(params)
|
|
7046
7165
|
});
|
|
7047
7166
|
}
|
|
7167
|
+
// @__NO_SIDE_EFFECTS__
|
|
7048
7168
|
function _cuid(Class2, params) {
|
|
7049
7169
|
return new Class2({
|
|
7050
7170
|
type: "string",
|
|
@@ -7054,6 +7174,7 @@ function _cuid(Class2, params) {
|
|
|
7054
7174
|
...normalizeParams(params)
|
|
7055
7175
|
});
|
|
7056
7176
|
}
|
|
7177
|
+
// @__NO_SIDE_EFFECTS__
|
|
7057
7178
|
function _cuid2(Class2, params) {
|
|
7058
7179
|
return new Class2({
|
|
7059
7180
|
type: "string",
|
|
@@ -7063,6 +7184,7 @@ function _cuid2(Class2, params) {
|
|
|
7063
7184
|
...normalizeParams(params)
|
|
7064
7185
|
});
|
|
7065
7186
|
}
|
|
7187
|
+
// @__NO_SIDE_EFFECTS__
|
|
7066
7188
|
function _ulid(Class2, params) {
|
|
7067
7189
|
return new Class2({
|
|
7068
7190
|
type: "string",
|
|
@@ -7072,6 +7194,7 @@ function _ulid(Class2, params) {
|
|
|
7072
7194
|
...normalizeParams(params)
|
|
7073
7195
|
});
|
|
7074
7196
|
}
|
|
7197
|
+
// @__NO_SIDE_EFFECTS__
|
|
7075
7198
|
function _xid(Class2, params) {
|
|
7076
7199
|
return new Class2({
|
|
7077
7200
|
type: "string",
|
|
@@ -7081,6 +7204,7 @@ function _xid(Class2, params) {
|
|
|
7081
7204
|
...normalizeParams(params)
|
|
7082
7205
|
});
|
|
7083
7206
|
}
|
|
7207
|
+
// @__NO_SIDE_EFFECTS__
|
|
7084
7208
|
function _ksuid(Class2, params) {
|
|
7085
7209
|
return new Class2({
|
|
7086
7210
|
type: "string",
|
|
@@ -7090,6 +7214,7 @@ function _ksuid(Class2, params) {
|
|
|
7090
7214
|
...normalizeParams(params)
|
|
7091
7215
|
});
|
|
7092
7216
|
}
|
|
7217
|
+
// @__NO_SIDE_EFFECTS__
|
|
7093
7218
|
function _ipv4(Class2, params) {
|
|
7094
7219
|
return new Class2({
|
|
7095
7220
|
type: "string",
|
|
@@ -7099,6 +7224,7 @@ function _ipv4(Class2, params) {
|
|
|
7099
7224
|
...normalizeParams(params)
|
|
7100
7225
|
});
|
|
7101
7226
|
}
|
|
7227
|
+
// @__NO_SIDE_EFFECTS__
|
|
7102
7228
|
function _ipv6(Class2, params) {
|
|
7103
7229
|
return new Class2({
|
|
7104
7230
|
type: "string",
|
|
@@ -7108,6 +7234,7 @@ function _ipv6(Class2, params) {
|
|
|
7108
7234
|
...normalizeParams(params)
|
|
7109
7235
|
});
|
|
7110
7236
|
}
|
|
7237
|
+
// @__NO_SIDE_EFFECTS__
|
|
7111
7238
|
function _cidrv4(Class2, params) {
|
|
7112
7239
|
return new Class2({
|
|
7113
7240
|
type: "string",
|
|
@@ -7117,6 +7244,7 @@ function _cidrv4(Class2, params) {
|
|
|
7117
7244
|
...normalizeParams(params)
|
|
7118
7245
|
});
|
|
7119
7246
|
}
|
|
7247
|
+
// @__NO_SIDE_EFFECTS__
|
|
7120
7248
|
function _cidrv6(Class2, params) {
|
|
7121
7249
|
return new Class2({
|
|
7122
7250
|
type: "string",
|
|
@@ -7126,6 +7254,7 @@ function _cidrv6(Class2, params) {
|
|
|
7126
7254
|
...normalizeParams(params)
|
|
7127
7255
|
});
|
|
7128
7256
|
}
|
|
7257
|
+
// @__NO_SIDE_EFFECTS__
|
|
7129
7258
|
function _base64(Class2, params) {
|
|
7130
7259
|
return new Class2({
|
|
7131
7260
|
type: "string",
|
|
@@ -7135,6 +7264,7 @@ function _base64(Class2, params) {
|
|
|
7135
7264
|
...normalizeParams(params)
|
|
7136
7265
|
});
|
|
7137
7266
|
}
|
|
7267
|
+
// @__NO_SIDE_EFFECTS__
|
|
7138
7268
|
function _base64url(Class2, params) {
|
|
7139
7269
|
return new Class2({
|
|
7140
7270
|
type: "string",
|
|
@@ -7144,6 +7274,7 @@ function _base64url(Class2, params) {
|
|
|
7144
7274
|
...normalizeParams(params)
|
|
7145
7275
|
});
|
|
7146
7276
|
}
|
|
7277
|
+
// @__NO_SIDE_EFFECTS__
|
|
7147
7278
|
function _e164(Class2, params) {
|
|
7148
7279
|
return new Class2({
|
|
7149
7280
|
type: "string",
|
|
@@ -7153,6 +7284,7 @@ function _e164(Class2, params) {
|
|
|
7153
7284
|
...normalizeParams(params)
|
|
7154
7285
|
});
|
|
7155
7286
|
}
|
|
7287
|
+
// @__NO_SIDE_EFFECTS__
|
|
7156
7288
|
function _jwt(Class2, params) {
|
|
7157
7289
|
return new Class2({
|
|
7158
7290
|
type: "string",
|
|
@@ -7162,6 +7294,7 @@ function _jwt(Class2, params) {
|
|
|
7162
7294
|
...normalizeParams(params)
|
|
7163
7295
|
});
|
|
7164
7296
|
}
|
|
7297
|
+
// @__NO_SIDE_EFFECTS__
|
|
7165
7298
|
function _isoDateTime(Class2, params) {
|
|
7166
7299
|
return new Class2({
|
|
7167
7300
|
type: "string",
|
|
@@ -7173,6 +7306,7 @@ function _isoDateTime(Class2, params) {
|
|
|
7173
7306
|
...normalizeParams(params)
|
|
7174
7307
|
});
|
|
7175
7308
|
}
|
|
7309
|
+
// @__NO_SIDE_EFFECTS__
|
|
7176
7310
|
function _isoDate(Class2, params) {
|
|
7177
7311
|
return new Class2({
|
|
7178
7312
|
type: "string",
|
|
@@ -7181,6 +7315,7 @@ function _isoDate(Class2, params) {
|
|
|
7181
7315
|
...normalizeParams(params)
|
|
7182
7316
|
});
|
|
7183
7317
|
}
|
|
7318
|
+
// @__NO_SIDE_EFFECTS__
|
|
7184
7319
|
function _isoTime(Class2, params) {
|
|
7185
7320
|
return new Class2({
|
|
7186
7321
|
type: "string",
|
|
@@ -7190,6 +7325,7 @@ function _isoTime(Class2, params) {
|
|
|
7190
7325
|
...normalizeParams(params)
|
|
7191
7326
|
});
|
|
7192
7327
|
}
|
|
7328
|
+
// @__NO_SIDE_EFFECTS__
|
|
7193
7329
|
function _isoDuration(Class2, params) {
|
|
7194
7330
|
return new Class2({
|
|
7195
7331
|
type: "string",
|
|
@@ -7198,6 +7334,7 @@ function _isoDuration(Class2, params) {
|
|
|
7198
7334
|
...normalizeParams(params)
|
|
7199
7335
|
});
|
|
7200
7336
|
}
|
|
7337
|
+
// @__NO_SIDE_EFFECTS__
|
|
7201
7338
|
function _int(Class2, params) {
|
|
7202
7339
|
return new Class2({
|
|
7203
7340
|
type: "number",
|
|
@@ -7207,17 +7344,20 @@ function _int(Class2, params) {
|
|
|
7207
7344
|
...normalizeParams(params)
|
|
7208
7345
|
});
|
|
7209
7346
|
}
|
|
7347
|
+
// @__NO_SIDE_EFFECTS__
|
|
7210
7348
|
function _unknown(Class2) {
|
|
7211
7349
|
return new Class2({
|
|
7212
7350
|
type: "unknown"
|
|
7213
7351
|
});
|
|
7214
7352
|
}
|
|
7353
|
+
// @__NO_SIDE_EFFECTS__
|
|
7215
7354
|
function _never(Class2, params) {
|
|
7216
7355
|
return new Class2({
|
|
7217
7356
|
type: "never",
|
|
7218
7357
|
...normalizeParams(params)
|
|
7219
7358
|
});
|
|
7220
7359
|
}
|
|
7360
|
+
// @__NO_SIDE_EFFECTS__
|
|
7221
7361
|
function _lt(value, params) {
|
|
7222
7362
|
return new $ZodCheckLessThan({
|
|
7223
7363
|
check: "less_than",
|
|
@@ -7226,6 +7366,7 @@ function _lt(value, params) {
|
|
|
7226
7366
|
inclusive: false
|
|
7227
7367
|
});
|
|
7228
7368
|
}
|
|
7369
|
+
// @__NO_SIDE_EFFECTS__
|
|
7229
7370
|
function _lte(value, params) {
|
|
7230
7371
|
return new $ZodCheckLessThan({
|
|
7231
7372
|
check: "less_than",
|
|
@@ -7234,6 +7375,7 @@ function _lte(value, params) {
|
|
|
7234
7375
|
inclusive: true
|
|
7235
7376
|
});
|
|
7236
7377
|
}
|
|
7378
|
+
// @__NO_SIDE_EFFECTS__
|
|
7237
7379
|
function _gt(value, params) {
|
|
7238
7380
|
return new $ZodCheckGreaterThan({
|
|
7239
7381
|
check: "greater_than",
|
|
@@ -7242,6 +7384,7 @@ function _gt(value, params) {
|
|
|
7242
7384
|
inclusive: false
|
|
7243
7385
|
});
|
|
7244
7386
|
}
|
|
7387
|
+
// @__NO_SIDE_EFFECTS__
|
|
7245
7388
|
function _gte(value, params) {
|
|
7246
7389
|
return new $ZodCheckGreaterThan({
|
|
7247
7390
|
check: "greater_than",
|
|
@@ -7250,6 +7393,7 @@ function _gte(value, params) {
|
|
|
7250
7393
|
inclusive: true
|
|
7251
7394
|
});
|
|
7252
7395
|
}
|
|
7396
|
+
// @__NO_SIDE_EFFECTS__
|
|
7253
7397
|
function _multipleOf(value, params) {
|
|
7254
7398
|
return new $ZodCheckMultipleOf({
|
|
7255
7399
|
check: "multiple_of",
|
|
@@ -7257,6 +7401,7 @@ function _multipleOf(value, params) {
|
|
|
7257
7401
|
value
|
|
7258
7402
|
});
|
|
7259
7403
|
}
|
|
7404
|
+
// @__NO_SIDE_EFFECTS__
|
|
7260
7405
|
function _maxLength(maximum, params) {
|
|
7261
7406
|
const ch = new $ZodCheckMaxLength({
|
|
7262
7407
|
check: "max_length",
|
|
@@ -7265,6 +7410,7 @@ function _maxLength(maximum, params) {
|
|
|
7265
7410
|
});
|
|
7266
7411
|
return ch;
|
|
7267
7412
|
}
|
|
7413
|
+
// @__NO_SIDE_EFFECTS__
|
|
7268
7414
|
function _minLength(minimum, params) {
|
|
7269
7415
|
return new $ZodCheckMinLength({
|
|
7270
7416
|
check: "min_length",
|
|
@@ -7272,6 +7418,7 @@ function _minLength(minimum, params) {
|
|
|
7272
7418
|
minimum
|
|
7273
7419
|
});
|
|
7274
7420
|
}
|
|
7421
|
+
// @__NO_SIDE_EFFECTS__
|
|
7275
7422
|
function _length(length, params) {
|
|
7276
7423
|
return new $ZodCheckLengthEquals({
|
|
7277
7424
|
check: "length_equals",
|
|
@@ -7279,6 +7426,7 @@ function _length(length, params) {
|
|
|
7279
7426
|
length
|
|
7280
7427
|
});
|
|
7281
7428
|
}
|
|
7429
|
+
// @__NO_SIDE_EFFECTS__
|
|
7282
7430
|
function _regex(pattern, params) {
|
|
7283
7431
|
return new $ZodCheckRegex({
|
|
7284
7432
|
check: "string_format",
|
|
@@ -7287,6 +7435,7 @@ function _regex(pattern, params) {
|
|
|
7287
7435
|
pattern
|
|
7288
7436
|
});
|
|
7289
7437
|
}
|
|
7438
|
+
// @__NO_SIDE_EFFECTS__
|
|
7290
7439
|
function _lowercase(params) {
|
|
7291
7440
|
return new $ZodCheckLowerCase({
|
|
7292
7441
|
check: "string_format",
|
|
@@ -7294,6 +7443,7 @@ function _lowercase(params) {
|
|
|
7294
7443
|
...normalizeParams(params)
|
|
7295
7444
|
});
|
|
7296
7445
|
}
|
|
7446
|
+
// @__NO_SIDE_EFFECTS__
|
|
7297
7447
|
function _uppercase(params) {
|
|
7298
7448
|
return new $ZodCheckUpperCase({
|
|
7299
7449
|
check: "string_format",
|
|
@@ -7301,6 +7451,7 @@ function _uppercase(params) {
|
|
|
7301
7451
|
...normalizeParams(params)
|
|
7302
7452
|
});
|
|
7303
7453
|
}
|
|
7454
|
+
// @__NO_SIDE_EFFECTS__
|
|
7304
7455
|
function _includes(includes, params) {
|
|
7305
7456
|
return new $ZodCheckIncludes({
|
|
7306
7457
|
check: "string_format",
|
|
@@ -7309,6 +7460,7 @@ function _includes(includes, params) {
|
|
|
7309
7460
|
includes
|
|
7310
7461
|
});
|
|
7311
7462
|
}
|
|
7463
|
+
// @__NO_SIDE_EFFECTS__
|
|
7312
7464
|
function _startsWith(prefix, params) {
|
|
7313
7465
|
return new $ZodCheckStartsWith({
|
|
7314
7466
|
check: "string_format",
|
|
@@ -7317,6 +7469,7 @@ function _startsWith(prefix, params) {
|
|
|
7317
7469
|
prefix
|
|
7318
7470
|
});
|
|
7319
7471
|
}
|
|
7472
|
+
// @__NO_SIDE_EFFECTS__
|
|
7320
7473
|
function _endsWith(suffix, params) {
|
|
7321
7474
|
return new $ZodCheckEndsWith({
|
|
7322
7475
|
check: "string_format",
|
|
@@ -7325,27 +7478,34 @@ function _endsWith(suffix, params) {
|
|
|
7325
7478
|
suffix
|
|
7326
7479
|
});
|
|
7327
7480
|
}
|
|
7481
|
+
// @__NO_SIDE_EFFECTS__
|
|
7328
7482
|
function _overwrite(tx) {
|
|
7329
7483
|
return new $ZodCheckOverwrite({
|
|
7330
7484
|
check: "overwrite",
|
|
7331
7485
|
tx
|
|
7332
7486
|
});
|
|
7333
7487
|
}
|
|
7488
|
+
// @__NO_SIDE_EFFECTS__
|
|
7334
7489
|
function _normalize(form) {
|
|
7335
|
-
return _overwrite((input) => input.normalize(form));
|
|
7490
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
7336
7491
|
}
|
|
7492
|
+
// @__NO_SIDE_EFFECTS__
|
|
7337
7493
|
function _trim() {
|
|
7338
|
-
return _overwrite((input) => input.trim());
|
|
7494
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
7339
7495
|
}
|
|
7496
|
+
// @__NO_SIDE_EFFECTS__
|
|
7340
7497
|
function _toLowerCase() {
|
|
7341
|
-
return _overwrite((input) => input.toLowerCase());
|
|
7498
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
7342
7499
|
}
|
|
7500
|
+
// @__NO_SIDE_EFFECTS__
|
|
7343
7501
|
function _toUpperCase() {
|
|
7344
|
-
return _overwrite((input) => input.toUpperCase());
|
|
7502
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
7345
7503
|
}
|
|
7504
|
+
// @__NO_SIDE_EFFECTS__
|
|
7346
7505
|
function _slugify() {
|
|
7347
|
-
return _overwrite((input) => slugify(input));
|
|
7506
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
7348
7507
|
}
|
|
7508
|
+
// @__NO_SIDE_EFFECTS__
|
|
7349
7509
|
function _array(Class2, element, params) {
|
|
7350
7510
|
return new Class2({
|
|
7351
7511
|
type: "array",
|
|
@@ -7356,6 +7516,7 @@ function _array(Class2, element, params) {
|
|
|
7356
7516
|
...normalizeParams(params)
|
|
7357
7517
|
});
|
|
7358
7518
|
}
|
|
7519
|
+
// @__NO_SIDE_EFFECTS__
|
|
7359
7520
|
function _refine(Class2, fn, _params) {
|
|
7360
7521
|
const schema = new Class2({
|
|
7361
7522
|
type: "custom",
|
|
@@ -7365,8 +7526,9 @@ function _refine(Class2, fn, _params) {
|
|
|
7365
7526
|
});
|
|
7366
7527
|
return schema;
|
|
7367
7528
|
}
|
|
7529
|
+
// @__NO_SIDE_EFFECTS__
|
|
7368
7530
|
function _superRefine(fn) {
|
|
7369
|
-
const ch = _check((payload) => {
|
|
7531
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
7370
7532
|
payload.addIssue = (issue2) => {
|
|
7371
7533
|
if (typeof issue2 === "string") {
|
|
7372
7534
|
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
@@ -7385,6 +7547,7 @@ function _superRefine(fn) {
|
|
|
7385
7547
|
});
|
|
7386
7548
|
return ch;
|
|
7387
7549
|
}
|
|
7550
|
+
// @__NO_SIDE_EFFECTS__
|
|
7388
7551
|
function _check(fn, params) {
|
|
7389
7552
|
const ch = new $ZodCheck({
|
|
7390
7553
|
check: "custom",
|
|
@@ -7439,12 +7602,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
7439
7602
|
schemaPath: [..._params.schemaPath, schema],
|
|
7440
7603
|
path: _params.path
|
|
7441
7604
|
};
|
|
7442
|
-
|
|
7443
|
-
if (parent) {
|
|
7444
|
-
result.ref = parent;
|
|
7445
|
-
process2(parent, ctx, params);
|
|
7446
|
-
ctx.seen.get(parent).isParent = true;
|
|
7447
|
-
} else if (schema._zod.processJSONSchema) {
|
|
7605
|
+
if (schema._zod.processJSONSchema) {
|
|
7448
7606
|
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
7449
7607
|
} else {
|
|
7450
7608
|
const _json = result.schema;
|
|
@@ -7454,6 +7612,13 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
7454
7612
|
}
|
|
7455
7613
|
processor(schema, ctx, _json, params);
|
|
7456
7614
|
}
|
|
7615
|
+
const parent = schema._zod.parent;
|
|
7616
|
+
if (parent) {
|
|
7617
|
+
if (!result.ref)
|
|
7618
|
+
result.ref = parent;
|
|
7619
|
+
process2(parent, ctx, params);
|
|
7620
|
+
ctx.seen.get(parent).isParent = true;
|
|
7621
|
+
}
|
|
7457
7622
|
}
|
|
7458
7623
|
const meta2 = ctx.metadataRegistry.get(schema);
|
|
7459
7624
|
if (meta2)
|
|
@@ -7472,6 +7637,17 @@ function extractDefs(ctx, schema) {
|
|
|
7472
7637
|
const root = ctx.seen.get(schema);
|
|
7473
7638
|
if (!root)
|
|
7474
7639
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
7640
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
7641
|
+
for (const entry of ctx.seen.entries()) {
|
|
7642
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
7643
|
+
if (id) {
|
|
7644
|
+
const existing = idToSchema.get(id);
|
|
7645
|
+
if (existing && existing !== entry[0]) {
|
|
7646
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
7647
|
+
}
|
|
7648
|
+
idToSchema.set(id, entry[0]);
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7475
7651
|
const makeURI = (entry) => {
|
|
7476
7652
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
7477
7653
|
if (ctx.external) {
|
|
@@ -7553,30 +7729,65 @@ function finalize(ctx, schema) {
|
|
|
7553
7729
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
7554
7730
|
const flattenRef = (zodSchema) => {
|
|
7555
7731
|
const seen = ctx.seen.get(zodSchema);
|
|
7732
|
+
if (seen.ref === null)
|
|
7733
|
+
return;
|
|
7556
7734
|
const schema2 = seen.def ?? seen.schema;
|
|
7557
7735
|
const _cached = { ...schema2 };
|
|
7558
|
-
if (seen.ref === null) {
|
|
7559
|
-
return;
|
|
7560
|
-
}
|
|
7561
7736
|
const ref = seen.ref;
|
|
7562
7737
|
seen.ref = null;
|
|
7563
7738
|
if (ref) {
|
|
7564
7739
|
flattenRef(ref);
|
|
7565
|
-
const
|
|
7740
|
+
const refSeen = ctx.seen.get(ref);
|
|
7741
|
+
const refSchema = refSeen.schema;
|
|
7566
7742
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
7567
7743
|
schema2.allOf = schema2.allOf ?? [];
|
|
7568
7744
|
schema2.allOf.push(refSchema);
|
|
7569
7745
|
} else {
|
|
7570
7746
|
Object.assign(schema2, refSchema);
|
|
7571
|
-
|
|
7747
|
+
}
|
|
7748
|
+
Object.assign(schema2, _cached);
|
|
7749
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
7750
|
+
if (isParentRef) {
|
|
7751
|
+
for (const key in schema2) {
|
|
7752
|
+
if (key === "$ref" || key === "allOf")
|
|
7753
|
+
continue;
|
|
7754
|
+
if (!(key in _cached)) {
|
|
7755
|
+
delete schema2[key];
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
if (refSchema.$ref && refSeen.def) {
|
|
7760
|
+
for (const key in schema2) {
|
|
7761
|
+
if (key === "$ref" || key === "allOf")
|
|
7762
|
+
continue;
|
|
7763
|
+
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
|
|
7764
|
+
delete schema2[key];
|
|
7765
|
+
}
|
|
7766
|
+
}
|
|
7572
7767
|
}
|
|
7573
7768
|
}
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7769
|
+
const parent = zodSchema._zod.parent;
|
|
7770
|
+
if (parent && parent !== ref) {
|
|
7771
|
+
flattenRef(parent);
|
|
7772
|
+
const parentSeen = ctx.seen.get(parent);
|
|
7773
|
+
if (parentSeen?.schema.$ref) {
|
|
7774
|
+
schema2.$ref = parentSeen.schema.$ref;
|
|
7775
|
+
if (parentSeen.def) {
|
|
7776
|
+
for (const key in schema2) {
|
|
7777
|
+
if (key === "$ref" || key === "allOf")
|
|
7778
|
+
continue;
|
|
7779
|
+
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
7780
|
+
delete schema2[key];
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7786
|
+
ctx.override({
|
|
7787
|
+
zodSchema,
|
|
7788
|
+
jsonSchema: schema2,
|
|
7789
|
+
path: seen.path ?? []
|
|
7790
|
+
});
|
|
7580
7791
|
};
|
|
7581
7792
|
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
7582
7793
|
flattenRef(entry[0]);
|
|
@@ -7621,8 +7832,8 @@ function finalize(ctx, schema) {
|
|
|
7621
7832
|
value: {
|
|
7622
7833
|
...schema["~standard"],
|
|
7623
7834
|
jsonSchema: {
|
|
7624
|
-
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
7625
|
-
output: createStandardJSONSchemaMethod(schema, "output")
|
|
7835
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
7836
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
7626
7837
|
}
|
|
7627
7838
|
},
|
|
7628
7839
|
enumerable: false,
|
|
@@ -7690,9 +7901,9 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
7690
7901
|
extractDefs(ctx, schema);
|
|
7691
7902
|
return finalize(ctx, schema);
|
|
7692
7903
|
};
|
|
7693
|
-
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
7904
|
+
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
7694
7905
|
const { libraryOptions, target } = params ?? {};
|
|
7695
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors
|
|
7906
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
7696
7907
|
process2(schema, ctx);
|
|
7697
7908
|
extractDefs(ctx, schema);
|
|
7698
7909
|
return finalize(ctx, schema);
|
|
@@ -7719,6 +7930,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
7719
7930
|
json.format = formatMap[format] ?? format;
|
|
7720
7931
|
if (json.format === "")
|
|
7721
7932
|
delete json.format;
|
|
7933
|
+
if (format === "time") {
|
|
7934
|
+
delete json.format;
|
|
7935
|
+
}
|
|
7722
7936
|
}
|
|
7723
7937
|
if (contentEncoding)
|
|
7724
7938
|
json.contentEncoding = contentEncoding;
|
|
@@ -8006,16 +8220,37 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
8006
8220
|
const json = _json;
|
|
8007
8221
|
const def = schema._zod.def;
|
|
8008
8222
|
json.type = "object";
|
|
8009
|
-
|
|
8010
|
-
|
|
8223
|
+
const keyType = def.keyType;
|
|
8224
|
+
const keyBag = keyType._zod.bag;
|
|
8225
|
+
const patterns = keyBag?.patterns;
|
|
8226
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
8227
|
+
const valueSchema = process2(def.valueType, ctx, {
|
|
8228
|
+
...params,
|
|
8229
|
+
path: [...params.path, "patternProperties", "*"]
|
|
8230
|
+
});
|
|
8231
|
+
json.patternProperties = {};
|
|
8232
|
+
for (const pattern of patterns) {
|
|
8233
|
+
json.patternProperties[pattern.source] = valueSchema;
|
|
8234
|
+
}
|
|
8235
|
+
} else {
|
|
8236
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
8237
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
8238
|
+
...params,
|
|
8239
|
+
path: [...params.path, "propertyNames"]
|
|
8240
|
+
});
|
|
8241
|
+
}
|
|
8242
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8011
8243
|
...params,
|
|
8012
|
-
path: [...params.path, "
|
|
8244
|
+
path: [...params.path, "additionalProperties"]
|
|
8013
8245
|
});
|
|
8014
8246
|
}
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8247
|
+
const keyValues = keyType._zod.values;
|
|
8248
|
+
if (keyValues) {
|
|
8249
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
8250
|
+
if (validKeyValues.length > 0) {
|
|
8251
|
+
json.required = validKeyValues;
|
|
8252
|
+
}
|
|
8253
|
+
}
|
|
8019
8254
|
};
|
|
8020
8255
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8021
8256
|
const def = schema._zod.def;
|
|
@@ -8192,8 +8427,11 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8192
8427
|
...def.checks ?? [],
|
|
8193
8428
|
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
8194
8429
|
]
|
|
8195
|
-
})
|
|
8430
|
+
}), {
|
|
8431
|
+
parent: true
|
|
8432
|
+
});
|
|
8196
8433
|
};
|
|
8434
|
+
inst.with = inst.check;
|
|
8197
8435
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
8198
8436
|
inst.brand = () => inst;
|
|
8199
8437
|
inst.register = ((reg, meta2) => {
|
|
@@ -8217,6 +8455,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8217
8455
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
8218
8456
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
8219
8457
|
inst.optional = () => optional(inst);
|
|
8458
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
8220
8459
|
inst.nullable = () => nullable(inst);
|
|
8221
8460
|
inst.nullish = () => optional(nullable(inst));
|
|
8222
8461
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -8250,6 +8489,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8250
8489
|
};
|
|
8251
8490
|
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
8252
8491
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
8492
|
+
inst.apply = (fn) => fn(inst);
|
|
8253
8493
|
return inst;
|
|
8254
8494
|
});
|
|
8255
8495
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
@@ -8695,6 +8935,18 @@ function optional(innerType) {
|
|
|
8695
8935
|
innerType
|
|
8696
8936
|
});
|
|
8697
8937
|
}
|
|
8938
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
8939
|
+
$ZodExactOptional.init(inst, def);
|
|
8940
|
+
ZodType.init(inst, def);
|
|
8941
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
8942
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
8943
|
+
});
|
|
8944
|
+
function exactOptional(innerType) {
|
|
8945
|
+
return new ZodExactOptional({
|
|
8946
|
+
type: "optional",
|
|
8947
|
+
innerType
|
|
8948
|
+
});
|
|
8949
|
+
}
|
|
8698
8950
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
8699
8951
|
$ZodNullable.init(inst, def);
|
|
8700
8952
|
ZodType.init(inst, def);
|