@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/index.mjs
CHANGED
|
@@ -109,29 +109,30 @@ var SwaggerUIRender = (info, config2) => {
|
|
|
109
109
|
|
|
110
110
|
// src/scalar/index.ts
|
|
111
111
|
var elysiaCSS = `.light-mode {
|
|
112
|
-
--scalar-color-1:
|
|
113
|
-
--scalar-color-2:
|
|
114
|
-
--scalar-color-3:
|
|
115
|
-
--scalar-color-accent:
|
|
112
|
+
--scalar-color-1: oklch(43.5% 0.029 321.78);
|
|
113
|
+
--scalar-color-2: oklch(54.2% 0.034 322.5);
|
|
114
|
+
--scalar-color-3: oklch(71.1% 0.019 323.02);
|
|
115
|
+
--scalar-color-accent: oklch(71.2% 0.194 13.428);
|
|
116
116
|
|
|
117
|
-
--scalar-background-1:
|
|
118
|
-
--scalar-background-2:
|
|
119
|
-
--scalar-background-3:
|
|
117
|
+
--scalar-background-1: oklch(98.5% 0 0);
|
|
118
|
+
--scalar-background-2: oklch(96% 0.003 325.6);
|
|
119
|
+
--scalar-background-3: oklch(92.2% 0.005 325.62);
|
|
120
120
|
|
|
121
|
-
--scalar-border-color:
|
|
121
|
+
--scalar-border-color: oklch(92.2% 0.005 325.62);
|
|
122
122
|
}
|
|
123
|
+
|
|
123
124
|
.dark-mode {
|
|
124
|
-
--scalar-color-1:
|
|
125
|
-
--scalar-color-2:
|
|
126
|
-
--scalar-color-3:
|
|
127
|
-
--scalar-color-accent:
|
|
125
|
+
--scalar-color-1: oklch(98.5% 0 0);
|
|
126
|
+
--scalar-color-2: oklch(71.1% 0.019 323.02);
|
|
127
|
+
--scalar-color-3: oklch(86.5% 0.012 325.68);
|
|
128
|
+
--scalar-color-accent: oklch(89.2% 0.058 10.001);
|
|
128
129
|
|
|
129
|
-
--scalar-background-1:
|
|
130
|
-
--scalar-background-2:
|
|
131
|
-
--scalar-background-3:
|
|
132
|
-
--scalar-background-accent:
|
|
130
|
+
--scalar-background-1: oklch(21.2% 0.019 322.12);
|
|
131
|
+
--scalar-background-2: oklch(26.3% 0.024 320.12);
|
|
132
|
+
--scalar-background-3: oklch(36.4% 0.029 323.89);
|
|
133
|
+
--scalar-background-accent: oklch(43.5% 0.029 321.78);
|
|
133
134
|
|
|
134
|
-
--scalar-border-color:
|
|
135
|
+
--scalar-border-color: oklch(36.4% 0.029 323.89);
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
/* Document Sidebar */
|
|
@@ -5107,6 +5108,7 @@ __export(util_exports, {
|
|
|
5107
5108
|
objectClone: () => objectClone,
|
|
5108
5109
|
omit: () => omit,
|
|
5109
5110
|
optionalKeys: () => optionalKeys,
|
|
5111
|
+
parsedType: () => parsedType,
|
|
5110
5112
|
partial: () => partial,
|
|
5111
5113
|
pick: () => pick,
|
|
5112
5114
|
prefixIssues: () => prefixIssues,
|
|
@@ -5439,6 +5441,11 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
5439
5441
|
};
|
|
5440
5442
|
function pick(schema, mask) {
|
|
5441
5443
|
const currDef = schema._zod.def;
|
|
5444
|
+
const checks = currDef.checks;
|
|
5445
|
+
const hasChecks = checks && checks.length > 0;
|
|
5446
|
+
if (hasChecks) {
|
|
5447
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
5448
|
+
}
|
|
5442
5449
|
const def = mergeDefs(schema._zod.def, {
|
|
5443
5450
|
get shape() {
|
|
5444
5451
|
const newShape = {};
|
|
@@ -5459,6 +5466,11 @@ function pick(schema, mask) {
|
|
|
5459
5466
|
}
|
|
5460
5467
|
function omit(schema, mask) {
|
|
5461
5468
|
const currDef = schema._zod.def;
|
|
5469
|
+
const checks = currDef.checks;
|
|
5470
|
+
const hasChecks = checks && checks.length > 0;
|
|
5471
|
+
if (hasChecks) {
|
|
5472
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
5473
|
+
}
|
|
5462
5474
|
const def = mergeDefs(schema._zod.def, {
|
|
5463
5475
|
get shape() {
|
|
5464
5476
|
const newShape = { ...schema._zod.def.shape };
|
|
@@ -5484,15 +5496,19 @@ function extend(schema, shape) {
|
|
|
5484
5496
|
const checks = schema._zod.def.checks;
|
|
5485
5497
|
const hasChecks = checks && checks.length > 0;
|
|
5486
5498
|
if (hasChecks) {
|
|
5487
|
-
|
|
5499
|
+
const existingShape = schema._zod.def.shape;
|
|
5500
|
+
for (const key in shape) {
|
|
5501
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
5502
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
5503
|
+
}
|
|
5504
|
+
}
|
|
5488
5505
|
}
|
|
5489
5506
|
const def = mergeDefs(schema._zod.def, {
|
|
5490
5507
|
get shape() {
|
|
5491
5508
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
5492
5509
|
assignProp(this, "shape", _shape);
|
|
5493
5510
|
return _shape;
|
|
5494
|
-
}
|
|
5495
|
-
checks: []
|
|
5511
|
+
}
|
|
5496
5512
|
});
|
|
5497
5513
|
return clone(schema, def);
|
|
5498
5514
|
}
|
|
@@ -5500,15 +5516,13 @@ function safeExtend(schema, shape) {
|
|
|
5500
5516
|
if (!isPlainObject(shape)) {
|
|
5501
5517
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
5502
5518
|
}
|
|
5503
|
-
const def = {
|
|
5504
|
-
...schema._zod.def,
|
|
5519
|
+
const def = mergeDefs(schema._zod.def, {
|
|
5505
5520
|
get shape() {
|
|
5506
5521
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
5507
5522
|
assignProp(this, "shape", _shape);
|
|
5508
5523
|
return _shape;
|
|
5509
|
-
}
|
|
5510
|
-
|
|
5511
|
-
};
|
|
5524
|
+
}
|
|
5525
|
+
});
|
|
5512
5526
|
return clone(schema, def);
|
|
5513
5527
|
}
|
|
5514
5528
|
function merge(a, b) {
|
|
@@ -5527,6 +5541,12 @@ function merge(a, b) {
|
|
|
5527
5541
|
return clone(a, def);
|
|
5528
5542
|
}
|
|
5529
5543
|
function partial(Class2, schema, mask) {
|
|
5544
|
+
const currDef = schema._zod.def;
|
|
5545
|
+
const checks = currDef.checks;
|
|
5546
|
+
const hasChecks = checks && checks.length > 0;
|
|
5547
|
+
if (hasChecks) {
|
|
5548
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
5549
|
+
}
|
|
5530
5550
|
const def = mergeDefs(schema._zod.def, {
|
|
5531
5551
|
get shape() {
|
|
5532
5552
|
const oldShape = schema._zod.def.shape;
|
|
@@ -5585,8 +5605,7 @@ function required(Class2, schema, mask) {
|
|
|
5585
5605
|
}
|
|
5586
5606
|
assignProp(this, "shape", shape);
|
|
5587
5607
|
return shape;
|
|
5588
|
-
}
|
|
5589
|
-
checks: []
|
|
5608
|
+
}
|
|
5590
5609
|
});
|
|
5591
5610
|
return clone(schema, def);
|
|
5592
5611
|
}
|
|
@@ -5640,6 +5659,27 @@ function getLengthableOrigin(input) {
|
|
|
5640
5659
|
return "string";
|
|
5641
5660
|
return "unknown";
|
|
5642
5661
|
}
|
|
5662
|
+
function parsedType(data) {
|
|
5663
|
+
const t2 = typeof data;
|
|
5664
|
+
switch (t2) {
|
|
5665
|
+
case "number": {
|
|
5666
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
5667
|
+
}
|
|
5668
|
+
case "object": {
|
|
5669
|
+
if (data === null) {
|
|
5670
|
+
return "null";
|
|
5671
|
+
}
|
|
5672
|
+
if (Array.isArray(data)) {
|
|
5673
|
+
return "array";
|
|
5674
|
+
}
|
|
5675
|
+
const obj = data;
|
|
5676
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
5677
|
+
return obj.constructor.name;
|
|
5678
|
+
}
|
|
5679
|
+
}
|
|
5680
|
+
}
|
|
5681
|
+
return t2;
|
|
5682
|
+
}
|
|
5643
5683
|
function issue(...args) {
|
|
5644
5684
|
const [iss, input, inst] = args;
|
|
5645
5685
|
if (typeof iss === "string") {
|
|
@@ -5868,7 +5908,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]
|
|
|
5868
5908
|
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])$/;
|
|
5869
5909
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
5870
5910
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
5871
|
-
var e164 = /^\+
|
|
5911
|
+
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
5872
5912
|
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])))`;
|
|
5873
5913
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
5874
5914
|
function timeSource(args) {
|
|
@@ -5895,7 +5935,7 @@ var string2 = (params) => {
|
|
|
5895
5935
|
};
|
|
5896
5936
|
var bigint = /^-?\d+n?$/;
|
|
5897
5937
|
var integer = /^-?\d+$/;
|
|
5898
|
-
var number = /^-?\d+(?:\.\d+)
|
|
5938
|
+
var number = /^-?\d+(?:\.\d+)?$/;
|
|
5899
5939
|
var boolean = /^(?:true|false)$/i;
|
|
5900
5940
|
var _null = /^null$/i;
|
|
5901
5941
|
var _undefined = /^undefined$/i;
|
|
@@ -5934,7 +5974,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
5934
5974
|
payload.issues.push({
|
|
5935
5975
|
origin,
|
|
5936
5976
|
code: "too_big",
|
|
5937
|
-
maximum: def.value,
|
|
5977
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5938
5978
|
input: payload.value,
|
|
5939
5979
|
inclusive: def.inclusive,
|
|
5940
5980
|
inst,
|
|
@@ -5962,7 +6002,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5962
6002
|
payload.issues.push({
|
|
5963
6003
|
origin,
|
|
5964
6004
|
code: "too_small",
|
|
5965
|
-
minimum: def.value,
|
|
6005
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
5966
6006
|
input: payload.value,
|
|
5967
6007
|
inclusive: def.inclusive,
|
|
5968
6008
|
inst,
|
|
@@ -6029,6 +6069,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6029
6069
|
note: "Integers must be within the safe integer range.",
|
|
6030
6070
|
inst,
|
|
6031
6071
|
origin,
|
|
6072
|
+
inclusive: true,
|
|
6032
6073
|
continue: !def.abort
|
|
6033
6074
|
});
|
|
6034
6075
|
} else {
|
|
@@ -6039,6 +6080,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6039
6080
|
note: "Integers must be within the safe integer range.",
|
|
6040
6081
|
inst,
|
|
6041
6082
|
origin,
|
|
6083
|
+
inclusive: true,
|
|
6042
6084
|
continue: !def.abort
|
|
6043
6085
|
});
|
|
6044
6086
|
}
|
|
@@ -6062,7 +6104,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6062
6104
|
input,
|
|
6063
6105
|
code: "too_big",
|
|
6064
6106
|
maximum,
|
|
6065
|
-
|
|
6107
|
+
inclusive: true,
|
|
6108
|
+
inst,
|
|
6109
|
+
continue: !def.abort
|
|
6066
6110
|
});
|
|
6067
6111
|
}
|
|
6068
6112
|
};
|
|
@@ -6327,8 +6371,8 @@ var Doc = class {
|
|
|
6327
6371
|
// node_modules/zod/v4/core/versions.js
|
|
6328
6372
|
var version = {
|
|
6329
6373
|
major: 4,
|
|
6330
|
-
minor:
|
|
6331
|
-
patch:
|
|
6374
|
+
minor: 3,
|
|
6375
|
+
patch: 6
|
|
6332
6376
|
};
|
|
6333
6377
|
|
|
6334
6378
|
// node_modules/zod/v4/core/schemas.js
|
|
@@ -6428,7 +6472,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6428
6472
|
return runChecks(result, checks, ctx);
|
|
6429
6473
|
};
|
|
6430
6474
|
}
|
|
6431
|
-
inst
|
|
6475
|
+
defineLazy(inst, "~standard", () => ({
|
|
6432
6476
|
validate: (value) => {
|
|
6433
6477
|
try {
|
|
6434
6478
|
const r = safeParse2(inst, value);
|
|
@@ -6439,7 +6483,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6439
6483
|
},
|
|
6440
6484
|
vendor: "zod",
|
|
6441
6485
|
version: 1
|
|
6442
|
-
};
|
|
6486
|
+
}));
|
|
6443
6487
|
});
|
|
6444
6488
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
6445
6489
|
$ZodType.init(inst, def);
|
|
@@ -6950,8 +6994,11 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
6950
6994
|
return payload;
|
|
6951
6995
|
};
|
|
6952
6996
|
});
|
|
6953
|
-
function handlePropertyResult(result, final, key, input) {
|
|
6997
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
6954
6998
|
if (result.issues.length) {
|
|
6999
|
+
if (isOptionalOut && !(key in input)) {
|
|
7000
|
+
return;
|
|
7001
|
+
}
|
|
6955
7002
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
6956
7003
|
}
|
|
6957
7004
|
if (result.value === void 0) {
|
|
@@ -6983,6 +7030,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6983
7030
|
const keySet = def.keySet;
|
|
6984
7031
|
const _catchall = def.catchall._zod;
|
|
6985
7032
|
const t2 = _catchall.def.type;
|
|
7033
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
6986
7034
|
for (const key in input) {
|
|
6987
7035
|
if (keySet.has(key))
|
|
6988
7036
|
continue;
|
|
@@ -6992,9 +7040,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6992
7040
|
}
|
|
6993
7041
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
6994
7042
|
if (r instanceof Promise) {
|
|
6995
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
7043
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
6996
7044
|
} else {
|
|
6997
|
-
handlePropertyResult(r, payload, key, input);
|
|
7045
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
6998
7046
|
}
|
|
6999
7047
|
}
|
|
7000
7048
|
if (unrecognized.length) {
|
|
@@ -7060,11 +7108,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7060
7108
|
const shape = value.shape;
|
|
7061
7109
|
for (const key of value.keys) {
|
|
7062
7110
|
const el = shape[key];
|
|
7111
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
7063
7112
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
7064
7113
|
if (r instanceof Promise) {
|
|
7065
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
7114
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
7066
7115
|
} else {
|
|
7067
|
-
handlePropertyResult(r, payload, key, input);
|
|
7116
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
7068
7117
|
}
|
|
7069
7118
|
}
|
|
7070
7119
|
if (!catchall) {
|
|
@@ -7094,8 +7143,31 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7094
7143
|
for (const key of normalized.keys) {
|
|
7095
7144
|
const id = ids[key];
|
|
7096
7145
|
const k = esc(key);
|
|
7146
|
+
const schema = shape[key];
|
|
7147
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
7097
7148
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
7098
|
-
|
|
7149
|
+
if (isOptionalOut) {
|
|
7150
|
+
doc.write(`
|
|
7151
|
+
if (${id}.issues.length) {
|
|
7152
|
+
if (${k} in input) {
|
|
7153
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
7154
|
+
...iss,
|
|
7155
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
7156
|
+
})));
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
|
|
7160
|
+
if (${id}.value === undefined) {
|
|
7161
|
+
if (${k} in input) {
|
|
7162
|
+
newResult[${k}] = undefined;
|
|
7163
|
+
}
|
|
7164
|
+
} else {
|
|
7165
|
+
newResult[${k}] = ${id}.value;
|
|
7166
|
+
}
|
|
7167
|
+
|
|
7168
|
+
`);
|
|
7169
|
+
} else {
|
|
7170
|
+
doc.write(`
|
|
7099
7171
|
if (${id}.issues.length) {
|
|
7100
7172
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
7101
7173
|
...iss,
|
|
@@ -7103,7 +7175,6 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7103
7175
|
})));
|
|
7104
7176
|
}
|
|
7105
7177
|
|
|
7106
|
-
|
|
7107
7178
|
if (${id}.value === undefined) {
|
|
7108
7179
|
if (${k} in input) {
|
|
7109
7180
|
newResult[${k}] = undefined;
|
|
@@ -7113,6 +7184,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7113
7184
|
}
|
|
7114
7185
|
|
|
7115
7186
|
`);
|
|
7187
|
+
}
|
|
7116
7188
|
}
|
|
7117
7189
|
doc.write(`payload.value = newResult;`);
|
|
7118
7190
|
doc.write(`return payload;`);
|
|
@@ -7341,11 +7413,34 @@ function mergeValues(a, b) {
|
|
|
7341
7413
|
return { valid: false, mergeErrorPath: [] };
|
|
7342
7414
|
}
|
|
7343
7415
|
function handleIntersectionResults(result, left, right) {
|
|
7344
|
-
|
|
7345
|
-
|
|
7416
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
7417
|
+
let unrecIssue;
|
|
7418
|
+
for (const iss of left.issues) {
|
|
7419
|
+
if (iss.code === "unrecognized_keys") {
|
|
7420
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
7421
|
+
for (const k of iss.keys) {
|
|
7422
|
+
if (!unrecKeys.has(k))
|
|
7423
|
+
unrecKeys.set(k, {});
|
|
7424
|
+
unrecKeys.get(k).l = true;
|
|
7425
|
+
}
|
|
7426
|
+
} else {
|
|
7427
|
+
result.issues.push(iss);
|
|
7428
|
+
}
|
|
7429
|
+
}
|
|
7430
|
+
for (const iss of right.issues) {
|
|
7431
|
+
if (iss.code === "unrecognized_keys") {
|
|
7432
|
+
for (const k of iss.keys) {
|
|
7433
|
+
if (!unrecKeys.has(k))
|
|
7434
|
+
unrecKeys.set(k, {});
|
|
7435
|
+
unrecKeys.get(k).r = true;
|
|
7436
|
+
}
|
|
7437
|
+
} else {
|
|
7438
|
+
result.issues.push(iss);
|
|
7439
|
+
}
|
|
7346
7440
|
}
|
|
7347
|
-
|
|
7348
|
-
|
|
7441
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
7442
|
+
if (bothKeys.length && unrecIssue) {
|
|
7443
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
7349
7444
|
}
|
|
7350
7445
|
if (aborted(result))
|
|
7351
7446
|
return result;
|
|
@@ -7379,7 +7474,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7379
7474
|
const tooSmall = input.length < optStart - 1;
|
|
7380
7475
|
if (tooBig || tooSmall) {
|
|
7381
7476
|
payload.issues.push({
|
|
7382
|
-
...tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length },
|
|
7477
|
+
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
|
|
7383
7478
|
input,
|
|
7384
7479
|
inst,
|
|
7385
7480
|
origin: "array"
|
|
@@ -7487,10 +7582,20 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7487
7582
|
for (const key of Reflect.ownKeys(input)) {
|
|
7488
7583
|
if (key === "__proto__")
|
|
7489
7584
|
continue;
|
|
7490
|
-
|
|
7585
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
7491
7586
|
if (keyResult instanceof Promise) {
|
|
7492
7587
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7493
7588
|
}
|
|
7589
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
7590
|
+
if (checkNumericKey) {
|
|
7591
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
7592
|
+
if (retryResult instanceof Promise) {
|
|
7593
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
7594
|
+
}
|
|
7595
|
+
if (retryResult.issues.length === 0) {
|
|
7596
|
+
keyResult = retryResult;
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7494
7599
|
if (keyResult.issues.length) {
|
|
7495
7600
|
if (def.mode === "loose") {
|
|
7496
7601
|
payload.value[key] = input[key];
|
|
@@ -7621,6 +7726,14 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
7621
7726
|
return def.innerType._zod.run(payload, ctx);
|
|
7622
7727
|
};
|
|
7623
7728
|
});
|
|
7729
|
+
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
7730
|
+
$ZodOptional.init(inst, def);
|
|
7731
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7732
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
7733
|
+
inst._zod.parse = (payload, ctx) => {
|
|
7734
|
+
return def.innerType._zod.run(payload, ctx);
|
|
7735
|
+
};
|
|
7736
|
+
});
|
|
7624
7737
|
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
7625
7738
|
$ZodType.init(inst, def);
|
|
7626
7739
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -7842,9 +7955,6 @@ var $ZodRegistry = class {
|
|
|
7842
7955
|
const meta2 = _meta[0];
|
|
7843
7956
|
this._map.set(schema, meta2);
|
|
7844
7957
|
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7845
|
-
if (this._idmap.has(meta2.id)) {
|
|
7846
|
-
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
7847
|
-
}
|
|
7848
7958
|
this._idmap.set(meta2.id, schema);
|
|
7849
7959
|
}
|
|
7850
7960
|
return this;
|
|
@@ -7883,12 +7993,14 @@ function registry() {
|
|
|
7883
7993
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
7884
7994
|
|
|
7885
7995
|
// node_modules/zod/v4/core/api.js
|
|
7996
|
+
// @__NO_SIDE_EFFECTS__
|
|
7886
7997
|
function _string(Class2, params) {
|
|
7887
7998
|
return new Class2({
|
|
7888
7999
|
type: "string",
|
|
7889
8000
|
...normalizeParams(params)
|
|
7890
8001
|
});
|
|
7891
8002
|
}
|
|
8003
|
+
// @__NO_SIDE_EFFECTS__
|
|
7892
8004
|
function _email(Class2, params) {
|
|
7893
8005
|
return new Class2({
|
|
7894
8006
|
type: "string",
|
|
@@ -7898,6 +8010,7 @@ function _email(Class2, params) {
|
|
|
7898
8010
|
...normalizeParams(params)
|
|
7899
8011
|
});
|
|
7900
8012
|
}
|
|
8013
|
+
// @__NO_SIDE_EFFECTS__
|
|
7901
8014
|
function _guid(Class2, params) {
|
|
7902
8015
|
return new Class2({
|
|
7903
8016
|
type: "string",
|
|
@@ -7907,6 +8020,7 @@ function _guid(Class2, params) {
|
|
|
7907
8020
|
...normalizeParams(params)
|
|
7908
8021
|
});
|
|
7909
8022
|
}
|
|
8023
|
+
// @__NO_SIDE_EFFECTS__
|
|
7910
8024
|
function _uuid(Class2, params) {
|
|
7911
8025
|
return new Class2({
|
|
7912
8026
|
type: "string",
|
|
@@ -7916,6 +8030,7 @@ function _uuid(Class2, params) {
|
|
|
7916
8030
|
...normalizeParams(params)
|
|
7917
8031
|
});
|
|
7918
8032
|
}
|
|
8033
|
+
// @__NO_SIDE_EFFECTS__
|
|
7919
8034
|
function _uuidv4(Class2, params) {
|
|
7920
8035
|
return new Class2({
|
|
7921
8036
|
type: "string",
|
|
@@ -7926,6 +8041,7 @@ function _uuidv4(Class2, params) {
|
|
|
7926
8041
|
...normalizeParams(params)
|
|
7927
8042
|
});
|
|
7928
8043
|
}
|
|
8044
|
+
// @__NO_SIDE_EFFECTS__
|
|
7929
8045
|
function _uuidv6(Class2, params) {
|
|
7930
8046
|
return new Class2({
|
|
7931
8047
|
type: "string",
|
|
@@ -7936,6 +8052,7 @@ function _uuidv6(Class2, params) {
|
|
|
7936
8052
|
...normalizeParams(params)
|
|
7937
8053
|
});
|
|
7938
8054
|
}
|
|
8055
|
+
// @__NO_SIDE_EFFECTS__
|
|
7939
8056
|
function _uuidv7(Class2, params) {
|
|
7940
8057
|
return new Class2({
|
|
7941
8058
|
type: "string",
|
|
@@ -7946,6 +8063,7 @@ function _uuidv7(Class2, params) {
|
|
|
7946
8063
|
...normalizeParams(params)
|
|
7947
8064
|
});
|
|
7948
8065
|
}
|
|
8066
|
+
// @__NO_SIDE_EFFECTS__
|
|
7949
8067
|
function _url(Class2, params) {
|
|
7950
8068
|
return new Class2({
|
|
7951
8069
|
type: "string",
|
|
@@ -7955,6 +8073,7 @@ function _url(Class2, params) {
|
|
|
7955
8073
|
...normalizeParams(params)
|
|
7956
8074
|
});
|
|
7957
8075
|
}
|
|
8076
|
+
// @__NO_SIDE_EFFECTS__
|
|
7958
8077
|
function _emoji2(Class2, params) {
|
|
7959
8078
|
return new Class2({
|
|
7960
8079
|
type: "string",
|
|
@@ -7964,6 +8083,7 @@ function _emoji2(Class2, params) {
|
|
|
7964
8083
|
...normalizeParams(params)
|
|
7965
8084
|
});
|
|
7966
8085
|
}
|
|
8086
|
+
// @__NO_SIDE_EFFECTS__
|
|
7967
8087
|
function _nanoid(Class2, params) {
|
|
7968
8088
|
return new Class2({
|
|
7969
8089
|
type: "string",
|
|
@@ -7973,6 +8093,7 @@ function _nanoid(Class2, params) {
|
|
|
7973
8093
|
...normalizeParams(params)
|
|
7974
8094
|
});
|
|
7975
8095
|
}
|
|
8096
|
+
// @__NO_SIDE_EFFECTS__
|
|
7976
8097
|
function _cuid(Class2, params) {
|
|
7977
8098
|
return new Class2({
|
|
7978
8099
|
type: "string",
|
|
@@ -7982,6 +8103,7 @@ function _cuid(Class2, params) {
|
|
|
7982
8103
|
...normalizeParams(params)
|
|
7983
8104
|
});
|
|
7984
8105
|
}
|
|
8106
|
+
// @__NO_SIDE_EFFECTS__
|
|
7985
8107
|
function _cuid2(Class2, params) {
|
|
7986
8108
|
return new Class2({
|
|
7987
8109
|
type: "string",
|
|
@@ -7991,6 +8113,7 @@ function _cuid2(Class2, params) {
|
|
|
7991
8113
|
...normalizeParams(params)
|
|
7992
8114
|
});
|
|
7993
8115
|
}
|
|
8116
|
+
// @__NO_SIDE_EFFECTS__
|
|
7994
8117
|
function _ulid(Class2, params) {
|
|
7995
8118
|
return new Class2({
|
|
7996
8119
|
type: "string",
|
|
@@ -8000,6 +8123,7 @@ function _ulid(Class2, params) {
|
|
|
8000
8123
|
...normalizeParams(params)
|
|
8001
8124
|
});
|
|
8002
8125
|
}
|
|
8126
|
+
// @__NO_SIDE_EFFECTS__
|
|
8003
8127
|
function _xid(Class2, params) {
|
|
8004
8128
|
return new Class2({
|
|
8005
8129
|
type: "string",
|
|
@@ -8009,6 +8133,7 @@ function _xid(Class2, params) {
|
|
|
8009
8133
|
...normalizeParams(params)
|
|
8010
8134
|
});
|
|
8011
8135
|
}
|
|
8136
|
+
// @__NO_SIDE_EFFECTS__
|
|
8012
8137
|
function _ksuid(Class2, params) {
|
|
8013
8138
|
return new Class2({
|
|
8014
8139
|
type: "string",
|
|
@@ -8018,6 +8143,7 @@ function _ksuid(Class2, params) {
|
|
|
8018
8143
|
...normalizeParams(params)
|
|
8019
8144
|
});
|
|
8020
8145
|
}
|
|
8146
|
+
// @__NO_SIDE_EFFECTS__
|
|
8021
8147
|
function _ipv4(Class2, params) {
|
|
8022
8148
|
return new Class2({
|
|
8023
8149
|
type: "string",
|
|
@@ -8027,6 +8153,7 @@ function _ipv4(Class2, params) {
|
|
|
8027
8153
|
...normalizeParams(params)
|
|
8028
8154
|
});
|
|
8029
8155
|
}
|
|
8156
|
+
// @__NO_SIDE_EFFECTS__
|
|
8030
8157
|
function _ipv6(Class2, params) {
|
|
8031
8158
|
return new Class2({
|
|
8032
8159
|
type: "string",
|
|
@@ -8036,6 +8163,7 @@ function _ipv6(Class2, params) {
|
|
|
8036
8163
|
...normalizeParams(params)
|
|
8037
8164
|
});
|
|
8038
8165
|
}
|
|
8166
|
+
// @__NO_SIDE_EFFECTS__
|
|
8039
8167
|
function _cidrv4(Class2, params) {
|
|
8040
8168
|
return new Class2({
|
|
8041
8169
|
type: "string",
|
|
@@ -8045,6 +8173,7 @@ function _cidrv4(Class2, params) {
|
|
|
8045
8173
|
...normalizeParams(params)
|
|
8046
8174
|
});
|
|
8047
8175
|
}
|
|
8176
|
+
// @__NO_SIDE_EFFECTS__
|
|
8048
8177
|
function _cidrv6(Class2, params) {
|
|
8049
8178
|
return new Class2({
|
|
8050
8179
|
type: "string",
|
|
@@ -8054,6 +8183,7 @@ function _cidrv6(Class2, params) {
|
|
|
8054
8183
|
...normalizeParams(params)
|
|
8055
8184
|
});
|
|
8056
8185
|
}
|
|
8186
|
+
// @__NO_SIDE_EFFECTS__
|
|
8057
8187
|
function _base64(Class2, params) {
|
|
8058
8188
|
return new Class2({
|
|
8059
8189
|
type: "string",
|
|
@@ -8063,6 +8193,7 @@ function _base64(Class2, params) {
|
|
|
8063
8193
|
...normalizeParams(params)
|
|
8064
8194
|
});
|
|
8065
8195
|
}
|
|
8196
|
+
// @__NO_SIDE_EFFECTS__
|
|
8066
8197
|
function _base64url(Class2, params) {
|
|
8067
8198
|
return new Class2({
|
|
8068
8199
|
type: "string",
|
|
@@ -8072,6 +8203,7 @@ function _base64url(Class2, params) {
|
|
|
8072
8203
|
...normalizeParams(params)
|
|
8073
8204
|
});
|
|
8074
8205
|
}
|
|
8206
|
+
// @__NO_SIDE_EFFECTS__
|
|
8075
8207
|
function _e164(Class2, params) {
|
|
8076
8208
|
return new Class2({
|
|
8077
8209
|
type: "string",
|
|
@@ -8081,6 +8213,7 @@ function _e164(Class2, params) {
|
|
|
8081
8213
|
...normalizeParams(params)
|
|
8082
8214
|
});
|
|
8083
8215
|
}
|
|
8216
|
+
// @__NO_SIDE_EFFECTS__
|
|
8084
8217
|
function _jwt(Class2, params) {
|
|
8085
8218
|
return new Class2({
|
|
8086
8219
|
type: "string",
|
|
@@ -8090,6 +8223,7 @@ function _jwt(Class2, params) {
|
|
|
8090
8223
|
...normalizeParams(params)
|
|
8091
8224
|
});
|
|
8092
8225
|
}
|
|
8226
|
+
// @__NO_SIDE_EFFECTS__
|
|
8093
8227
|
function _isoDateTime(Class2, params) {
|
|
8094
8228
|
return new Class2({
|
|
8095
8229
|
type: "string",
|
|
@@ -8101,6 +8235,7 @@ function _isoDateTime(Class2, params) {
|
|
|
8101
8235
|
...normalizeParams(params)
|
|
8102
8236
|
});
|
|
8103
8237
|
}
|
|
8238
|
+
// @__NO_SIDE_EFFECTS__
|
|
8104
8239
|
function _isoDate(Class2, params) {
|
|
8105
8240
|
return new Class2({
|
|
8106
8241
|
type: "string",
|
|
@@ -8109,6 +8244,7 @@ function _isoDate(Class2, params) {
|
|
|
8109
8244
|
...normalizeParams(params)
|
|
8110
8245
|
});
|
|
8111
8246
|
}
|
|
8247
|
+
// @__NO_SIDE_EFFECTS__
|
|
8112
8248
|
function _isoTime(Class2, params) {
|
|
8113
8249
|
return new Class2({
|
|
8114
8250
|
type: "string",
|
|
@@ -8118,6 +8254,7 @@ function _isoTime(Class2, params) {
|
|
|
8118
8254
|
...normalizeParams(params)
|
|
8119
8255
|
});
|
|
8120
8256
|
}
|
|
8257
|
+
// @__NO_SIDE_EFFECTS__
|
|
8121
8258
|
function _isoDuration(Class2, params) {
|
|
8122
8259
|
return new Class2({
|
|
8123
8260
|
type: "string",
|
|
@@ -8126,6 +8263,7 @@ function _isoDuration(Class2, params) {
|
|
|
8126
8263
|
...normalizeParams(params)
|
|
8127
8264
|
});
|
|
8128
8265
|
}
|
|
8266
|
+
// @__NO_SIDE_EFFECTS__
|
|
8129
8267
|
function _int(Class2, params) {
|
|
8130
8268
|
return new Class2({
|
|
8131
8269
|
type: "number",
|
|
@@ -8135,17 +8273,20 @@ function _int(Class2, params) {
|
|
|
8135
8273
|
...normalizeParams(params)
|
|
8136
8274
|
});
|
|
8137
8275
|
}
|
|
8276
|
+
// @__NO_SIDE_EFFECTS__
|
|
8138
8277
|
function _unknown(Class2) {
|
|
8139
8278
|
return new Class2({
|
|
8140
8279
|
type: "unknown"
|
|
8141
8280
|
});
|
|
8142
8281
|
}
|
|
8282
|
+
// @__NO_SIDE_EFFECTS__
|
|
8143
8283
|
function _never(Class2, params) {
|
|
8144
8284
|
return new Class2({
|
|
8145
8285
|
type: "never",
|
|
8146
8286
|
...normalizeParams(params)
|
|
8147
8287
|
});
|
|
8148
8288
|
}
|
|
8289
|
+
// @__NO_SIDE_EFFECTS__
|
|
8149
8290
|
function _lt(value, params) {
|
|
8150
8291
|
return new $ZodCheckLessThan({
|
|
8151
8292
|
check: "less_than",
|
|
@@ -8154,6 +8295,7 @@ function _lt(value, params) {
|
|
|
8154
8295
|
inclusive: false
|
|
8155
8296
|
});
|
|
8156
8297
|
}
|
|
8298
|
+
// @__NO_SIDE_EFFECTS__
|
|
8157
8299
|
function _lte(value, params) {
|
|
8158
8300
|
return new $ZodCheckLessThan({
|
|
8159
8301
|
check: "less_than",
|
|
@@ -8162,6 +8304,7 @@ function _lte(value, params) {
|
|
|
8162
8304
|
inclusive: true
|
|
8163
8305
|
});
|
|
8164
8306
|
}
|
|
8307
|
+
// @__NO_SIDE_EFFECTS__
|
|
8165
8308
|
function _gt(value, params) {
|
|
8166
8309
|
return new $ZodCheckGreaterThan({
|
|
8167
8310
|
check: "greater_than",
|
|
@@ -8170,6 +8313,7 @@ function _gt(value, params) {
|
|
|
8170
8313
|
inclusive: false
|
|
8171
8314
|
});
|
|
8172
8315
|
}
|
|
8316
|
+
// @__NO_SIDE_EFFECTS__
|
|
8173
8317
|
function _gte(value, params) {
|
|
8174
8318
|
return new $ZodCheckGreaterThan({
|
|
8175
8319
|
check: "greater_than",
|
|
@@ -8178,6 +8322,7 @@ function _gte(value, params) {
|
|
|
8178
8322
|
inclusive: true
|
|
8179
8323
|
});
|
|
8180
8324
|
}
|
|
8325
|
+
// @__NO_SIDE_EFFECTS__
|
|
8181
8326
|
function _multipleOf(value, params) {
|
|
8182
8327
|
return new $ZodCheckMultipleOf({
|
|
8183
8328
|
check: "multiple_of",
|
|
@@ -8185,6 +8330,7 @@ function _multipleOf(value, params) {
|
|
|
8185
8330
|
value
|
|
8186
8331
|
});
|
|
8187
8332
|
}
|
|
8333
|
+
// @__NO_SIDE_EFFECTS__
|
|
8188
8334
|
function _maxLength(maximum, params) {
|
|
8189
8335
|
const ch = new $ZodCheckMaxLength({
|
|
8190
8336
|
check: "max_length",
|
|
@@ -8193,6 +8339,7 @@ function _maxLength(maximum, params) {
|
|
|
8193
8339
|
});
|
|
8194
8340
|
return ch;
|
|
8195
8341
|
}
|
|
8342
|
+
// @__NO_SIDE_EFFECTS__
|
|
8196
8343
|
function _minLength(minimum, params) {
|
|
8197
8344
|
return new $ZodCheckMinLength({
|
|
8198
8345
|
check: "min_length",
|
|
@@ -8200,6 +8347,7 @@ function _minLength(minimum, params) {
|
|
|
8200
8347
|
minimum
|
|
8201
8348
|
});
|
|
8202
8349
|
}
|
|
8350
|
+
// @__NO_SIDE_EFFECTS__
|
|
8203
8351
|
function _length(length, params) {
|
|
8204
8352
|
return new $ZodCheckLengthEquals({
|
|
8205
8353
|
check: "length_equals",
|
|
@@ -8207,6 +8355,7 @@ function _length(length, params) {
|
|
|
8207
8355
|
length
|
|
8208
8356
|
});
|
|
8209
8357
|
}
|
|
8358
|
+
// @__NO_SIDE_EFFECTS__
|
|
8210
8359
|
function _regex(pattern, params) {
|
|
8211
8360
|
return new $ZodCheckRegex({
|
|
8212
8361
|
check: "string_format",
|
|
@@ -8215,6 +8364,7 @@ function _regex(pattern, params) {
|
|
|
8215
8364
|
pattern
|
|
8216
8365
|
});
|
|
8217
8366
|
}
|
|
8367
|
+
// @__NO_SIDE_EFFECTS__
|
|
8218
8368
|
function _lowercase(params) {
|
|
8219
8369
|
return new $ZodCheckLowerCase({
|
|
8220
8370
|
check: "string_format",
|
|
@@ -8222,6 +8372,7 @@ function _lowercase(params) {
|
|
|
8222
8372
|
...normalizeParams(params)
|
|
8223
8373
|
});
|
|
8224
8374
|
}
|
|
8375
|
+
// @__NO_SIDE_EFFECTS__
|
|
8225
8376
|
function _uppercase(params) {
|
|
8226
8377
|
return new $ZodCheckUpperCase({
|
|
8227
8378
|
check: "string_format",
|
|
@@ -8229,6 +8380,7 @@ function _uppercase(params) {
|
|
|
8229
8380
|
...normalizeParams(params)
|
|
8230
8381
|
});
|
|
8231
8382
|
}
|
|
8383
|
+
// @__NO_SIDE_EFFECTS__
|
|
8232
8384
|
function _includes(includes, params) {
|
|
8233
8385
|
return new $ZodCheckIncludes({
|
|
8234
8386
|
check: "string_format",
|
|
@@ -8237,6 +8389,7 @@ function _includes(includes, params) {
|
|
|
8237
8389
|
includes
|
|
8238
8390
|
});
|
|
8239
8391
|
}
|
|
8392
|
+
// @__NO_SIDE_EFFECTS__
|
|
8240
8393
|
function _startsWith(prefix, params) {
|
|
8241
8394
|
return new $ZodCheckStartsWith({
|
|
8242
8395
|
check: "string_format",
|
|
@@ -8245,6 +8398,7 @@ function _startsWith(prefix, params) {
|
|
|
8245
8398
|
prefix
|
|
8246
8399
|
});
|
|
8247
8400
|
}
|
|
8401
|
+
// @__NO_SIDE_EFFECTS__
|
|
8248
8402
|
function _endsWith(suffix, params) {
|
|
8249
8403
|
return new $ZodCheckEndsWith({
|
|
8250
8404
|
check: "string_format",
|
|
@@ -8253,27 +8407,34 @@ function _endsWith(suffix, params) {
|
|
|
8253
8407
|
suffix
|
|
8254
8408
|
});
|
|
8255
8409
|
}
|
|
8410
|
+
// @__NO_SIDE_EFFECTS__
|
|
8256
8411
|
function _overwrite(tx) {
|
|
8257
8412
|
return new $ZodCheckOverwrite({
|
|
8258
8413
|
check: "overwrite",
|
|
8259
8414
|
tx
|
|
8260
8415
|
});
|
|
8261
8416
|
}
|
|
8417
|
+
// @__NO_SIDE_EFFECTS__
|
|
8262
8418
|
function _normalize(form) {
|
|
8263
|
-
return _overwrite((input) => input.normalize(form));
|
|
8419
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
8264
8420
|
}
|
|
8421
|
+
// @__NO_SIDE_EFFECTS__
|
|
8265
8422
|
function _trim() {
|
|
8266
|
-
return _overwrite((input) => input.trim());
|
|
8423
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
8267
8424
|
}
|
|
8425
|
+
// @__NO_SIDE_EFFECTS__
|
|
8268
8426
|
function _toLowerCase() {
|
|
8269
|
-
return _overwrite((input) => input.toLowerCase());
|
|
8427
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
8270
8428
|
}
|
|
8429
|
+
// @__NO_SIDE_EFFECTS__
|
|
8271
8430
|
function _toUpperCase() {
|
|
8272
|
-
return _overwrite((input) => input.toUpperCase());
|
|
8431
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
8273
8432
|
}
|
|
8433
|
+
// @__NO_SIDE_EFFECTS__
|
|
8274
8434
|
function _slugify() {
|
|
8275
|
-
return _overwrite((input) => slugify(input));
|
|
8435
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
8276
8436
|
}
|
|
8437
|
+
// @__NO_SIDE_EFFECTS__
|
|
8277
8438
|
function _array(Class2, element, params) {
|
|
8278
8439
|
return new Class2({
|
|
8279
8440
|
type: "array",
|
|
@@ -8284,6 +8445,7 @@ function _array(Class2, element, params) {
|
|
|
8284
8445
|
...normalizeParams(params)
|
|
8285
8446
|
});
|
|
8286
8447
|
}
|
|
8448
|
+
// @__NO_SIDE_EFFECTS__
|
|
8287
8449
|
function _refine(Class2, fn, _params) {
|
|
8288
8450
|
const schema = new Class2({
|
|
8289
8451
|
type: "custom",
|
|
@@ -8293,8 +8455,9 @@ function _refine(Class2, fn, _params) {
|
|
|
8293
8455
|
});
|
|
8294
8456
|
return schema;
|
|
8295
8457
|
}
|
|
8458
|
+
// @__NO_SIDE_EFFECTS__
|
|
8296
8459
|
function _superRefine(fn) {
|
|
8297
|
-
const ch = _check((payload) => {
|
|
8460
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
8298
8461
|
payload.addIssue = (issue2) => {
|
|
8299
8462
|
if (typeof issue2 === "string") {
|
|
8300
8463
|
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
@@ -8313,6 +8476,7 @@ function _superRefine(fn) {
|
|
|
8313
8476
|
});
|
|
8314
8477
|
return ch;
|
|
8315
8478
|
}
|
|
8479
|
+
// @__NO_SIDE_EFFECTS__
|
|
8316
8480
|
function _check(fn, params) {
|
|
8317
8481
|
const ch = new $ZodCheck({
|
|
8318
8482
|
check: "custom",
|
|
@@ -8367,12 +8531,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
8367
8531
|
schemaPath: [..._params.schemaPath, schema],
|
|
8368
8532
|
path: _params.path
|
|
8369
8533
|
};
|
|
8370
|
-
|
|
8371
|
-
if (parent) {
|
|
8372
|
-
result.ref = parent;
|
|
8373
|
-
process2(parent, ctx, params);
|
|
8374
|
-
ctx.seen.get(parent).isParent = true;
|
|
8375
|
-
} else if (schema._zod.processJSONSchema) {
|
|
8534
|
+
if (schema._zod.processJSONSchema) {
|
|
8376
8535
|
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
8377
8536
|
} else {
|
|
8378
8537
|
const _json = result.schema;
|
|
@@ -8382,6 +8541,13 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
8382
8541
|
}
|
|
8383
8542
|
processor(schema, ctx, _json, params);
|
|
8384
8543
|
}
|
|
8544
|
+
const parent = schema._zod.parent;
|
|
8545
|
+
if (parent) {
|
|
8546
|
+
if (!result.ref)
|
|
8547
|
+
result.ref = parent;
|
|
8548
|
+
process2(parent, ctx, params);
|
|
8549
|
+
ctx.seen.get(parent).isParent = true;
|
|
8550
|
+
}
|
|
8385
8551
|
}
|
|
8386
8552
|
const meta2 = ctx.metadataRegistry.get(schema);
|
|
8387
8553
|
if (meta2)
|
|
@@ -8400,6 +8566,17 @@ function extractDefs(ctx, schema) {
|
|
|
8400
8566
|
const root = ctx.seen.get(schema);
|
|
8401
8567
|
if (!root)
|
|
8402
8568
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8569
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
8570
|
+
for (const entry of ctx.seen.entries()) {
|
|
8571
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
8572
|
+
if (id) {
|
|
8573
|
+
const existing = idToSchema.get(id);
|
|
8574
|
+
if (existing && existing !== entry[0]) {
|
|
8575
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
8576
|
+
}
|
|
8577
|
+
idToSchema.set(id, entry[0]);
|
|
8578
|
+
}
|
|
8579
|
+
}
|
|
8403
8580
|
const makeURI = (entry) => {
|
|
8404
8581
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
8405
8582
|
if (ctx.external) {
|
|
@@ -8481,30 +8658,65 @@ function finalize(ctx, schema) {
|
|
|
8481
8658
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8482
8659
|
const flattenRef = (zodSchema) => {
|
|
8483
8660
|
const seen = ctx.seen.get(zodSchema);
|
|
8661
|
+
if (seen.ref === null)
|
|
8662
|
+
return;
|
|
8484
8663
|
const schema2 = seen.def ?? seen.schema;
|
|
8485
8664
|
const _cached = { ...schema2 };
|
|
8486
|
-
if (seen.ref === null) {
|
|
8487
|
-
return;
|
|
8488
|
-
}
|
|
8489
8665
|
const ref = seen.ref;
|
|
8490
8666
|
seen.ref = null;
|
|
8491
8667
|
if (ref) {
|
|
8492
8668
|
flattenRef(ref);
|
|
8493
|
-
const
|
|
8669
|
+
const refSeen = ctx.seen.get(ref);
|
|
8670
|
+
const refSchema = refSeen.schema;
|
|
8494
8671
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
8495
8672
|
schema2.allOf = schema2.allOf ?? [];
|
|
8496
8673
|
schema2.allOf.push(refSchema);
|
|
8497
8674
|
} else {
|
|
8498
8675
|
Object.assign(schema2, refSchema);
|
|
8499
|
-
|
|
8676
|
+
}
|
|
8677
|
+
Object.assign(schema2, _cached);
|
|
8678
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
8679
|
+
if (isParentRef) {
|
|
8680
|
+
for (const key in schema2) {
|
|
8681
|
+
if (key === "$ref" || key === "allOf")
|
|
8682
|
+
continue;
|
|
8683
|
+
if (!(key in _cached)) {
|
|
8684
|
+
delete schema2[key];
|
|
8685
|
+
}
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
if (refSchema.$ref && refSeen.def) {
|
|
8689
|
+
for (const key in schema2) {
|
|
8690
|
+
if (key === "$ref" || key === "allOf")
|
|
8691
|
+
continue;
|
|
8692
|
+
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
|
|
8693
|
+
delete schema2[key];
|
|
8694
|
+
}
|
|
8695
|
+
}
|
|
8500
8696
|
}
|
|
8501
8697
|
}
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8698
|
+
const parent = zodSchema._zod.parent;
|
|
8699
|
+
if (parent && parent !== ref) {
|
|
8700
|
+
flattenRef(parent);
|
|
8701
|
+
const parentSeen = ctx.seen.get(parent);
|
|
8702
|
+
if (parentSeen?.schema.$ref) {
|
|
8703
|
+
schema2.$ref = parentSeen.schema.$ref;
|
|
8704
|
+
if (parentSeen.def) {
|
|
8705
|
+
for (const key in schema2) {
|
|
8706
|
+
if (key === "$ref" || key === "allOf")
|
|
8707
|
+
continue;
|
|
8708
|
+
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
8709
|
+
delete schema2[key];
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8713
|
+
}
|
|
8714
|
+
}
|
|
8715
|
+
ctx.override({
|
|
8716
|
+
zodSchema,
|
|
8717
|
+
jsonSchema: schema2,
|
|
8718
|
+
path: seen.path ?? []
|
|
8719
|
+
});
|
|
8508
8720
|
};
|
|
8509
8721
|
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
8510
8722
|
flattenRef(entry[0]);
|
|
@@ -8549,8 +8761,8 @@ function finalize(ctx, schema) {
|
|
|
8549
8761
|
value: {
|
|
8550
8762
|
...schema["~standard"],
|
|
8551
8763
|
jsonSchema: {
|
|
8552
|
-
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
8553
|
-
output: createStandardJSONSchemaMethod(schema, "output")
|
|
8764
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
8765
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
8554
8766
|
}
|
|
8555
8767
|
},
|
|
8556
8768
|
enumerable: false,
|
|
@@ -8618,9 +8830,9 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
8618
8830
|
extractDefs(ctx, schema);
|
|
8619
8831
|
return finalize(ctx, schema);
|
|
8620
8832
|
};
|
|
8621
|
-
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
8833
|
+
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
8622
8834
|
const { libraryOptions, target } = params ?? {};
|
|
8623
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors
|
|
8835
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
8624
8836
|
process2(schema, ctx);
|
|
8625
8837
|
extractDefs(ctx, schema);
|
|
8626
8838
|
return finalize(ctx, schema);
|
|
@@ -8647,6 +8859,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
8647
8859
|
json.format = formatMap[format] ?? format;
|
|
8648
8860
|
if (json.format === "")
|
|
8649
8861
|
delete json.format;
|
|
8862
|
+
if (format === "time") {
|
|
8863
|
+
delete json.format;
|
|
8864
|
+
}
|
|
8650
8865
|
}
|
|
8651
8866
|
if (contentEncoding)
|
|
8652
8867
|
json.contentEncoding = contentEncoding;
|
|
@@ -8934,16 +9149,37 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
8934
9149
|
const json = _json;
|
|
8935
9150
|
const def = schema._zod.def;
|
|
8936
9151
|
json.type = "object";
|
|
8937
|
-
|
|
8938
|
-
|
|
9152
|
+
const keyType = def.keyType;
|
|
9153
|
+
const keyBag = keyType._zod.bag;
|
|
9154
|
+
const patterns = keyBag?.patterns;
|
|
9155
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
9156
|
+
const valueSchema = process2(def.valueType, ctx, {
|
|
9157
|
+
...params,
|
|
9158
|
+
path: [...params.path, "patternProperties", "*"]
|
|
9159
|
+
});
|
|
9160
|
+
json.patternProperties = {};
|
|
9161
|
+
for (const pattern of patterns) {
|
|
9162
|
+
json.patternProperties[pattern.source] = valueSchema;
|
|
9163
|
+
}
|
|
9164
|
+
} else {
|
|
9165
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
9166
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
9167
|
+
...params,
|
|
9168
|
+
path: [...params.path, "propertyNames"]
|
|
9169
|
+
});
|
|
9170
|
+
}
|
|
9171
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8939
9172
|
...params,
|
|
8940
|
-
path: [...params.path, "
|
|
9173
|
+
path: [...params.path, "additionalProperties"]
|
|
8941
9174
|
});
|
|
8942
9175
|
}
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
9176
|
+
const keyValues = keyType._zod.values;
|
|
9177
|
+
if (keyValues) {
|
|
9178
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
9179
|
+
if (validKeyValues.length > 0) {
|
|
9180
|
+
json.required = validKeyValues;
|
|
9181
|
+
}
|
|
9182
|
+
}
|
|
8947
9183
|
};
|
|
8948
9184
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8949
9185
|
const def = schema._zod.def;
|
|
@@ -9120,8 +9356,11 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
9120
9356
|
...def.checks ?? [],
|
|
9121
9357
|
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
9122
9358
|
]
|
|
9123
|
-
})
|
|
9359
|
+
}), {
|
|
9360
|
+
parent: true
|
|
9361
|
+
});
|
|
9124
9362
|
};
|
|
9363
|
+
inst.with = inst.check;
|
|
9125
9364
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
9126
9365
|
inst.brand = () => inst;
|
|
9127
9366
|
inst.register = ((reg, meta2) => {
|
|
@@ -9145,6 +9384,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
9145
9384
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
9146
9385
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
9147
9386
|
inst.optional = () => optional(inst);
|
|
9387
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
9148
9388
|
inst.nullable = () => nullable(inst);
|
|
9149
9389
|
inst.nullish = () => optional(nullable(inst));
|
|
9150
9390
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -9178,6 +9418,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
9178
9418
|
};
|
|
9179
9419
|
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
9180
9420
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
9421
|
+
inst.apply = (fn) => fn(inst);
|
|
9181
9422
|
return inst;
|
|
9182
9423
|
});
|
|
9183
9424
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
@@ -9623,6 +9864,18 @@ function optional(innerType) {
|
|
|
9623
9864
|
innerType
|
|
9624
9865
|
});
|
|
9625
9866
|
}
|
|
9867
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
9868
|
+
$ZodExactOptional.init(inst, def);
|
|
9869
|
+
ZodType.init(inst, def);
|
|
9870
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
9871
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
9872
|
+
});
|
|
9873
|
+
function exactOptional(innerType) {
|
|
9874
|
+
return new ZodExactOptional({
|
|
9875
|
+
type: "optional",
|
|
9876
|
+
innerType
|
|
9877
|
+
});
|
|
9878
|
+
}
|
|
9626
9879
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
9627
9880
|
$ZodNullable.init(inst, def);
|
|
9628
9881
|
ZodType.init(inst, def);
|