@mastra/server 1.0.0-beta.8 → 1.0.0-beta.9
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/CHANGELOG.md +48 -0
- package/dist/chunk-HAJOEDNB.js +274 -0
- package/dist/chunk-HAJOEDNB.js.map +1 -0
- package/dist/chunk-IEYXQTUW.cjs +284 -0
- package/dist/chunk-IEYXQTUW.cjs.map +1 -0
- package/dist/{chunk-25K5B3GJ.cjs → chunk-VD3WO2TJ.cjs} +756 -2028
- package/dist/chunk-VD3WO2TJ.cjs.map +1 -0
- package/dist/{chunk-M55XXZ35.js → chunk-VDJHDTPP.js} +756 -2028
- package/dist/chunk-VDJHDTPP.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +19 -19
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +28 -0
- package/dist/server/handlers/stored-agents.cjs.map +1 -0
- package/dist/server/handlers/stored-agents.d.ts +289 -0
- package/dist/server/handlers/stored-agents.d.ts.map +1 -0
- package/dist/server/handlers/stored-agents.js +3 -0
- package/dist/server/handlers/stored-agents.js.map +1 -0
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/schemas/stored-agents.d.ts +792 -0
- package/dist/server/schemas/stored-agents.d.ts.map +1 -0
- package/dist/server/server-adapter/index.cjs +34 -20
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +16 -2
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts +8 -0
- package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-25K5B3GJ.cjs.map +0 -1
- package/dist/chunk-M55XXZ35.js.map +0 -1
|
@@ -15,8 +15,8 @@ var agent = require('@mastra/core/agent');
|
|
|
15
15
|
var memory = require('@mastra/core/memory');
|
|
16
16
|
var utils = require('@mastra/core/utils');
|
|
17
17
|
var z19 = require('zod');
|
|
18
|
-
var v3 = require('zod/v3');
|
|
19
18
|
var z42 = require('zod/v4');
|
|
19
|
+
var v3 = require('zod/v3');
|
|
20
20
|
var tools = require('@mastra/core/tools');
|
|
21
21
|
var child_process = require('child_process');
|
|
22
22
|
var promises = require('fs/promises');
|
|
@@ -2005,1397 +2005,125 @@ function zodToJsonSchema2(zodSchema5, target = "jsonSchema7", strategy = "relati
|
|
|
2005
2005
|
});
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2008
|
+
function fixJson(input) {
|
|
2009
|
+
const stack = ["ROOT"];
|
|
2010
|
+
let lastValidIndex = -1;
|
|
2011
|
+
let literalStart = null;
|
|
2012
|
+
function processValueStart(char, i, swapState) {
|
|
2013
|
+
{
|
|
2014
|
+
switch (char) {
|
|
2015
|
+
case '"': {
|
|
2016
|
+
lastValidIndex = i;
|
|
2017
|
+
stack.pop();
|
|
2018
|
+
stack.push(swapState);
|
|
2019
|
+
stack.push("INSIDE_STRING");
|
|
2020
|
+
break;
|
|
2021
|
+
}
|
|
2022
|
+
case "f":
|
|
2023
|
+
case "t":
|
|
2024
|
+
case "n": {
|
|
2025
|
+
lastValidIndex = i;
|
|
2026
|
+
literalStart = i;
|
|
2027
|
+
stack.pop();
|
|
2028
|
+
stack.push(swapState);
|
|
2029
|
+
stack.push("INSIDE_LITERAL");
|
|
2030
|
+
break;
|
|
2031
|
+
}
|
|
2032
|
+
case "-": {
|
|
2033
|
+
stack.pop();
|
|
2034
|
+
stack.push(swapState);
|
|
2035
|
+
stack.push("INSIDE_NUMBER");
|
|
2036
|
+
break;
|
|
2037
|
+
}
|
|
2038
|
+
case "0":
|
|
2039
|
+
case "1":
|
|
2040
|
+
case "2":
|
|
2041
|
+
case "3":
|
|
2042
|
+
case "4":
|
|
2043
|
+
case "5":
|
|
2044
|
+
case "6":
|
|
2045
|
+
case "7":
|
|
2046
|
+
case "8":
|
|
2047
|
+
case "9": {
|
|
2048
|
+
lastValidIndex = i;
|
|
2049
|
+
stack.pop();
|
|
2050
|
+
stack.push(swapState);
|
|
2051
|
+
stack.push("INSIDE_NUMBER");
|
|
2052
|
+
break;
|
|
2053
|
+
}
|
|
2054
|
+
case "{": {
|
|
2055
|
+
lastValidIndex = i;
|
|
2056
|
+
stack.pop();
|
|
2057
|
+
stack.push(swapState);
|
|
2058
|
+
stack.push("INSIDE_OBJECT_START");
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
case "[": {
|
|
2062
|
+
lastValidIndex = i;
|
|
2063
|
+
stack.pop();
|
|
2064
|
+
stack.push(swapState);
|
|
2065
|
+
stack.push("INSIDE_ARRAY_START");
|
|
2066
|
+
break;
|
|
2067
|
+
}
|
|
2059
2068
|
}
|
|
2060
|
-
|
|
2061
|
-
};
|
|
2062
|
-
};
|
|
2063
|
-
|
|
2064
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
2065
|
-
function addErrorMessage2(res, key, errorMessage, refs) {
|
|
2066
|
-
if (!refs?.errorMessages)
|
|
2067
|
-
return;
|
|
2068
|
-
if (errorMessage) {
|
|
2069
|
-
res.errorMessage = {
|
|
2070
|
-
...res.errorMessage,
|
|
2071
|
-
[key]: errorMessage
|
|
2072
|
-
};
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
function setResponseValueAndErrors2(res, key, value, errorMessage, refs) {
|
|
2076
|
-
res[key] = value;
|
|
2077
|
-
addErrorMessage2(res, key, errorMessage, refs);
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
2081
|
-
var getRelativePath2 = (pathA, pathB) => {
|
|
2082
|
-
let i = 0;
|
|
2083
|
-
for (; i < pathA.length && i < pathB.length; i++) {
|
|
2084
|
-
if (pathA[i] !== pathB[i])
|
|
2085
|
-
break;
|
|
2086
|
-
}
|
|
2087
|
-
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
2088
|
-
};
|
|
2089
|
-
|
|
2090
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
2091
|
-
function parseAnyDef2(refs) {
|
|
2092
|
-
if (refs.target !== "openAi") {
|
|
2093
|
-
return {};
|
|
2094
|
-
}
|
|
2095
|
-
const anyDefinitionPath = [
|
|
2096
|
-
...refs.basePath,
|
|
2097
|
-
refs.definitionPath,
|
|
2098
|
-
refs.openAiAnyTypeName
|
|
2099
|
-
];
|
|
2100
|
-
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
2101
|
-
return {
|
|
2102
|
-
$ref: refs.$refStrategy === "relative" ? getRelativePath2(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
function parseArrayDef2(def, refs) {
|
|
2106
|
-
const res = {
|
|
2107
|
-
type: "array"
|
|
2108
|
-
};
|
|
2109
|
-
if (def.type?._def && def.type?._def?.typeName !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
2110
|
-
res.items = parseDef2(def.type._def, {
|
|
2111
|
-
...refs,
|
|
2112
|
-
currentPath: [...refs.currentPath, "items"]
|
|
2113
|
-
});
|
|
2114
|
-
}
|
|
2115
|
-
if (def.minLength) {
|
|
2116
|
-
setResponseValueAndErrors2(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
2069
|
+
}
|
|
2117
2070
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2071
|
+
function processAfterObjectValue(char, i) {
|
|
2072
|
+
switch (char) {
|
|
2073
|
+
case ",": {
|
|
2074
|
+
stack.pop();
|
|
2075
|
+
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
2076
|
+
break;
|
|
2077
|
+
}
|
|
2078
|
+
case "}": {
|
|
2079
|
+
lastValidIndex = i;
|
|
2080
|
+
stack.pop();
|
|
2081
|
+
break;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2120
2084
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2085
|
+
function processAfterArrayValue(char, i) {
|
|
2086
|
+
switch (char) {
|
|
2087
|
+
case ",": {
|
|
2088
|
+
stack.pop();
|
|
2089
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
2090
|
+
break;
|
|
2091
|
+
}
|
|
2092
|
+
case "]": {
|
|
2093
|
+
lastValidIndex = i;
|
|
2094
|
+
stack.pop();
|
|
2095
|
+
break;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2124
2098
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
case "min":
|
|
2139
|
-
if (refs.target === "jsonSchema7") {
|
|
2140
|
-
if (check.inclusive) {
|
|
2141
|
-
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2142
|
-
} else {
|
|
2143
|
-
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
2099
|
+
for (let i = 0; i < input.length; i++) {
|
|
2100
|
+
const char = input[i];
|
|
2101
|
+
const currentState = stack[stack.length - 1];
|
|
2102
|
+
switch (currentState) {
|
|
2103
|
+
case "ROOT":
|
|
2104
|
+
processValueStart(char, i, "FINISH");
|
|
2105
|
+
break;
|
|
2106
|
+
case "INSIDE_OBJECT_START": {
|
|
2107
|
+
switch (char) {
|
|
2108
|
+
case '"': {
|
|
2109
|
+
stack.pop();
|
|
2110
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
2111
|
+
break;
|
|
2144
2112
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2113
|
+
case "}": {
|
|
2114
|
+
lastValidIndex = i;
|
|
2115
|
+
stack.pop();
|
|
2116
|
+
break;
|
|
2148
2117
|
}
|
|
2149
|
-
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2150
2118
|
}
|
|
2151
2119
|
break;
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
} else {
|
|
2160
|
-
if (!check.inclusive) {
|
|
2161
|
-
res.exclusiveMaximum = true;
|
|
2162
|
-
}
|
|
2163
|
-
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2164
|
-
}
|
|
2165
|
-
break;
|
|
2166
|
-
case "multipleOf":
|
|
2167
|
-
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
2168
|
-
break;
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
return res;
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
2175
|
-
function parseBooleanDef2() {
|
|
2176
|
-
return {
|
|
2177
|
-
type: "boolean"
|
|
2178
|
-
};
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
2182
|
-
function parseBrandedDef2(_def, refs) {
|
|
2183
|
-
return parseDef2(_def.type._def, refs);
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
2187
|
-
var parseCatchDef2 = (def, refs) => {
|
|
2188
|
-
return parseDef2(def.innerType._def, refs);
|
|
2189
|
-
};
|
|
2190
|
-
|
|
2191
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
2192
|
-
function parseDateDef2(def, refs, overrideDateStrategy) {
|
|
2193
|
-
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
2194
|
-
if (Array.isArray(strategy)) {
|
|
2195
|
-
return {
|
|
2196
|
-
anyOf: strategy.map((item, i) => parseDateDef2(def, refs, item))
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
switch (strategy) {
|
|
2200
|
-
case "string":
|
|
2201
|
-
case "format:date-time":
|
|
2202
|
-
return {
|
|
2203
|
-
type: "string",
|
|
2204
|
-
format: "date-time"
|
|
2205
|
-
};
|
|
2206
|
-
case "format:date":
|
|
2207
|
-
return {
|
|
2208
|
-
type: "string",
|
|
2209
|
-
format: "date"
|
|
2210
|
-
};
|
|
2211
|
-
case "integer":
|
|
2212
|
-
return integerDateParser2(def, refs);
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
var integerDateParser2 = (def, refs) => {
|
|
2216
|
-
const res = {
|
|
2217
|
-
type: "integer",
|
|
2218
|
-
format: "unix-time"
|
|
2219
|
-
};
|
|
2220
|
-
if (refs.target === "openApi3") {
|
|
2221
|
-
return res;
|
|
2222
|
-
}
|
|
2223
|
-
for (const check of def.checks) {
|
|
2224
|
-
switch (check.kind) {
|
|
2225
|
-
case "min":
|
|
2226
|
-
setResponseValueAndErrors2(
|
|
2227
|
-
res,
|
|
2228
|
-
"minimum",
|
|
2229
|
-
check.value,
|
|
2230
|
-
// This is in milliseconds
|
|
2231
|
-
check.message,
|
|
2232
|
-
refs
|
|
2233
|
-
);
|
|
2234
|
-
break;
|
|
2235
|
-
case "max":
|
|
2236
|
-
setResponseValueAndErrors2(
|
|
2237
|
-
res,
|
|
2238
|
-
"maximum",
|
|
2239
|
-
check.value,
|
|
2240
|
-
// This is in milliseconds
|
|
2241
|
-
check.message,
|
|
2242
|
-
refs
|
|
2243
|
-
);
|
|
2244
|
-
break;
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
return res;
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
2251
|
-
function parseDefaultDef2(_def, refs) {
|
|
2252
|
-
return {
|
|
2253
|
-
...parseDef2(_def.innerType._def, refs),
|
|
2254
|
-
default: _def.defaultValue()
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
2259
|
-
function parseEffectsDef2(_def, refs) {
|
|
2260
|
-
return refs.effectStrategy === "input" ? parseDef2(_def.schema._def, refs) : parseAnyDef2(refs);
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
2264
|
-
function parseEnumDef2(def) {
|
|
2265
|
-
return {
|
|
2266
|
-
type: "string",
|
|
2267
|
-
enum: Array.from(def.values)
|
|
2268
|
-
};
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
2272
|
-
var isJsonSchema7AllOfType2 = (type) => {
|
|
2273
|
-
if ("type" in type && type.type === "string")
|
|
2274
|
-
return false;
|
|
2275
|
-
return "allOf" in type;
|
|
2276
|
-
};
|
|
2277
|
-
function parseIntersectionDef2(def, refs) {
|
|
2278
|
-
const allOf = [
|
|
2279
|
-
parseDef2(def.left._def, {
|
|
2280
|
-
...refs,
|
|
2281
|
-
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
2282
|
-
}),
|
|
2283
|
-
parseDef2(def.right._def, {
|
|
2284
|
-
...refs,
|
|
2285
|
-
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
2286
|
-
})
|
|
2287
|
-
].filter((x) => !!x);
|
|
2288
|
-
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
2289
|
-
const mergedAllOf = [];
|
|
2290
|
-
allOf.forEach((schema) => {
|
|
2291
|
-
if (isJsonSchema7AllOfType2(schema)) {
|
|
2292
|
-
mergedAllOf.push(...schema.allOf);
|
|
2293
|
-
if (schema.unevaluatedProperties === void 0) {
|
|
2294
|
-
unevaluatedProperties = void 0;
|
|
2295
|
-
}
|
|
2296
|
-
} else {
|
|
2297
|
-
let nestedSchema = schema;
|
|
2298
|
-
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
2299
|
-
const { additionalProperties, ...rest } = schema;
|
|
2300
|
-
nestedSchema = rest;
|
|
2301
|
-
} else {
|
|
2302
|
-
unevaluatedProperties = void 0;
|
|
2303
|
-
}
|
|
2304
|
-
mergedAllOf.push(nestedSchema);
|
|
2305
|
-
}
|
|
2306
|
-
});
|
|
2307
|
-
return mergedAllOf.length ? {
|
|
2308
|
-
allOf: mergedAllOf,
|
|
2309
|
-
...unevaluatedProperties
|
|
2310
|
-
} : void 0;
|
|
2311
|
-
}
|
|
2312
|
-
|
|
2313
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
2314
|
-
function parseLiteralDef2(def, refs) {
|
|
2315
|
-
const parsedType = typeof def.value;
|
|
2316
|
-
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
2317
|
-
return {
|
|
2318
|
-
type: Array.isArray(def.value) ? "array" : "object"
|
|
2319
|
-
};
|
|
2320
|
-
}
|
|
2321
|
-
if (refs.target === "openApi3") {
|
|
2322
|
-
return {
|
|
2323
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
2324
|
-
enum: [def.value]
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
return {
|
|
2328
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
2329
|
-
const: def.value
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
2334
|
-
var emojiRegex2 = void 0;
|
|
2335
|
-
var zodPatterns2 = {
|
|
2336
|
-
/**
|
|
2337
|
-
* `c` was changed to `[cC]` to replicate /i flag
|
|
2338
|
-
*/
|
|
2339
|
-
cuid: /^[cC][^\s-]{8,}$/,
|
|
2340
|
-
cuid2: /^[0-9a-z]+$/,
|
|
2341
|
-
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
2342
|
-
/**
|
|
2343
|
-
* `a-z` was added to replicate /i flag
|
|
2344
|
-
*/
|
|
2345
|
-
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
2346
|
-
/**
|
|
2347
|
-
* Constructed a valid Unicode RegExp
|
|
2348
|
-
*
|
|
2349
|
-
* Lazily instantiate since this type of regex isn't supported
|
|
2350
|
-
* in all envs (e.g. React Native).
|
|
2351
|
-
*
|
|
2352
|
-
* See:
|
|
2353
|
-
* https://github.com/colinhacks/zod/issues/2433
|
|
2354
|
-
* Fix in Zod:
|
|
2355
|
-
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
2356
|
-
*/
|
|
2357
|
-
emoji: () => {
|
|
2358
|
-
if (emojiRegex2 === void 0) {
|
|
2359
|
-
emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
2360
|
-
}
|
|
2361
|
-
return emojiRegex2;
|
|
2362
|
-
},
|
|
2363
|
-
/**
|
|
2364
|
-
* Unused
|
|
2365
|
-
*/
|
|
2366
|
-
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
2367
|
-
/**
|
|
2368
|
-
* Unused
|
|
2369
|
-
*/
|
|
2370
|
-
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
2371
|
-
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
2372
|
-
/**
|
|
2373
|
-
* Unused
|
|
2374
|
-
*/
|
|
2375
|
-
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
2376
|
-
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
2377
|
-
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
2378
|
-
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
2379
|
-
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
2380
|
-
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
2381
|
-
};
|
|
2382
|
-
function parseStringDef2(def, refs) {
|
|
2383
|
-
const res = {
|
|
2384
|
-
type: "string"
|
|
2385
|
-
};
|
|
2386
|
-
if (def.checks) {
|
|
2387
|
-
for (const check of def.checks) {
|
|
2388
|
-
switch (check.kind) {
|
|
2389
|
-
case "min":
|
|
2390
|
-
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
2391
|
-
break;
|
|
2392
|
-
case "max":
|
|
2393
|
-
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
2394
|
-
break;
|
|
2395
|
-
case "email":
|
|
2396
|
-
switch (refs.emailStrategy) {
|
|
2397
|
-
case "format:email":
|
|
2398
|
-
addFormat2(res, "email", check.message, refs);
|
|
2399
|
-
break;
|
|
2400
|
-
case "format:idn-email":
|
|
2401
|
-
addFormat2(res, "idn-email", check.message, refs);
|
|
2402
|
-
break;
|
|
2403
|
-
case "pattern:zod":
|
|
2404
|
-
addPattern2(res, zodPatterns2.email, check.message, refs);
|
|
2405
|
-
break;
|
|
2406
|
-
}
|
|
2407
|
-
break;
|
|
2408
|
-
case "url":
|
|
2409
|
-
addFormat2(res, "uri", check.message, refs);
|
|
2410
|
-
break;
|
|
2411
|
-
case "uuid":
|
|
2412
|
-
addFormat2(res, "uuid", check.message, refs);
|
|
2413
|
-
break;
|
|
2414
|
-
case "regex":
|
|
2415
|
-
addPattern2(res, check.regex, check.message, refs);
|
|
2416
|
-
break;
|
|
2417
|
-
case "cuid":
|
|
2418
|
-
addPattern2(res, zodPatterns2.cuid, check.message, refs);
|
|
2419
|
-
break;
|
|
2420
|
-
case "cuid2":
|
|
2421
|
-
addPattern2(res, zodPatterns2.cuid2, check.message, refs);
|
|
2422
|
-
break;
|
|
2423
|
-
case "startsWith":
|
|
2424
|
-
addPattern2(res, RegExp(`^${escapeLiteralCheckValue2(check.value, refs)}`), check.message, refs);
|
|
2425
|
-
break;
|
|
2426
|
-
case "endsWith":
|
|
2427
|
-
addPattern2(res, RegExp(`${escapeLiteralCheckValue2(check.value, refs)}$`), check.message, refs);
|
|
2428
|
-
break;
|
|
2429
|
-
case "datetime":
|
|
2430
|
-
addFormat2(res, "date-time", check.message, refs);
|
|
2431
|
-
break;
|
|
2432
|
-
case "date":
|
|
2433
|
-
addFormat2(res, "date", check.message, refs);
|
|
2434
|
-
break;
|
|
2435
|
-
case "time":
|
|
2436
|
-
addFormat2(res, "time", check.message, refs);
|
|
2437
|
-
break;
|
|
2438
|
-
case "duration":
|
|
2439
|
-
addFormat2(res, "duration", check.message, refs);
|
|
2440
|
-
break;
|
|
2441
|
-
case "length":
|
|
2442
|
-
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
2443
|
-
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
2444
|
-
break;
|
|
2445
|
-
case "includes": {
|
|
2446
|
-
addPattern2(res, RegExp(escapeLiteralCheckValue2(check.value, refs)), check.message, refs);
|
|
2447
|
-
break;
|
|
2448
|
-
}
|
|
2449
|
-
case "ip": {
|
|
2450
|
-
if (check.version !== "v6") {
|
|
2451
|
-
addFormat2(res, "ipv4", check.message, refs);
|
|
2452
|
-
}
|
|
2453
|
-
if (check.version !== "v4") {
|
|
2454
|
-
addFormat2(res, "ipv6", check.message, refs);
|
|
2455
|
-
}
|
|
2456
|
-
break;
|
|
2457
|
-
}
|
|
2458
|
-
case "base64url":
|
|
2459
|
-
addPattern2(res, zodPatterns2.base64url, check.message, refs);
|
|
2460
|
-
break;
|
|
2461
|
-
case "jwt":
|
|
2462
|
-
addPattern2(res, zodPatterns2.jwt, check.message, refs);
|
|
2463
|
-
break;
|
|
2464
|
-
case "cidr": {
|
|
2465
|
-
if (check.version !== "v6") {
|
|
2466
|
-
addPattern2(res, zodPatterns2.ipv4Cidr, check.message, refs);
|
|
2467
|
-
}
|
|
2468
|
-
if (check.version !== "v4") {
|
|
2469
|
-
addPattern2(res, zodPatterns2.ipv6Cidr, check.message, refs);
|
|
2470
|
-
}
|
|
2471
|
-
break;
|
|
2472
|
-
}
|
|
2473
|
-
case "emoji":
|
|
2474
|
-
addPattern2(res, zodPatterns2.emoji(), check.message, refs);
|
|
2475
|
-
break;
|
|
2476
|
-
case "ulid": {
|
|
2477
|
-
addPattern2(res, zodPatterns2.ulid, check.message, refs);
|
|
2478
|
-
break;
|
|
2479
|
-
}
|
|
2480
|
-
case "base64": {
|
|
2481
|
-
switch (refs.base64Strategy) {
|
|
2482
|
-
case "format:binary": {
|
|
2483
|
-
addFormat2(res, "binary", check.message, refs);
|
|
2484
|
-
break;
|
|
2485
|
-
}
|
|
2486
|
-
case "contentEncoding:base64": {
|
|
2487
|
-
setResponseValueAndErrors2(res, "contentEncoding", "base64", check.message, refs);
|
|
2488
|
-
break;
|
|
2489
|
-
}
|
|
2490
|
-
case "pattern:zod": {
|
|
2491
|
-
addPattern2(res, zodPatterns2.base64, check.message, refs);
|
|
2492
|
-
break;
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
break;
|
|
2496
|
-
}
|
|
2497
|
-
case "nanoid": {
|
|
2498
|
-
addPattern2(res, zodPatterns2.nanoid, check.message, refs);
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
return res;
|
|
2504
|
-
}
|
|
2505
|
-
function escapeLiteralCheckValue2(literal, refs) {
|
|
2506
|
-
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
|
|
2507
|
-
}
|
|
2508
|
-
var ALPHA_NUMERIC2 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
2509
|
-
function escapeNonAlphaNumeric2(source) {
|
|
2510
|
-
let result = "";
|
|
2511
|
-
for (let i = 0; i < source.length; i++) {
|
|
2512
|
-
if (!ALPHA_NUMERIC2.has(source[i])) {
|
|
2513
|
-
result += "\\";
|
|
2514
|
-
}
|
|
2515
|
-
result += source[i];
|
|
2516
|
-
}
|
|
2517
|
-
return result;
|
|
2518
|
-
}
|
|
2519
|
-
function addFormat2(schema, value, message, refs) {
|
|
2520
|
-
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
2521
|
-
if (!schema.anyOf) {
|
|
2522
|
-
schema.anyOf = [];
|
|
2523
|
-
}
|
|
2524
|
-
if (schema.format) {
|
|
2525
|
-
schema.anyOf.push({
|
|
2526
|
-
format: schema.format,
|
|
2527
|
-
...schema.errorMessage && refs.errorMessages && {
|
|
2528
|
-
errorMessage: { format: schema.errorMessage.format }
|
|
2529
|
-
}
|
|
2530
|
-
});
|
|
2531
|
-
delete schema.format;
|
|
2532
|
-
if (schema.errorMessage) {
|
|
2533
|
-
delete schema.errorMessage.format;
|
|
2534
|
-
if (Object.keys(schema.errorMessage).length === 0) {
|
|
2535
|
-
delete schema.errorMessage;
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
schema.anyOf.push({
|
|
2540
|
-
format: value,
|
|
2541
|
-
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
2542
|
-
});
|
|
2543
|
-
} else {
|
|
2544
|
-
setResponseValueAndErrors2(schema, "format", value, message, refs);
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
function addPattern2(schema, regex, message, refs) {
|
|
2548
|
-
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
2549
|
-
if (!schema.allOf) {
|
|
2550
|
-
schema.allOf = [];
|
|
2551
|
-
}
|
|
2552
|
-
if (schema.pattern) {
|
|
2553
|
-
schema.allOf.push({
|
|
2554
|
-
pattern: schema.pattern,
|
|
2555
|
-
...schema.errorMessage && refs.errorMessages && {
|
|
2556
|
-
errorMessage: { pattern: schema.errorMessage.pattern }
|
|
2557
|
-
}
|
|
2558
|
-
});
|
|
2559
|
-
delete schema.pattern;
|
|
2560
|
-
if (schema.errorMessage) {
|
|
2561
|
-
delete schema.errorMessage.pattern;
|
|
2562
|
-
if (Object.keys(schema.errorMessage).length === 0) {
|
|
2563
|
-
delete schema.errorMessage;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
schema.allOf.push({
|
|
2568
|
-
pattern: stringifyRegExpWithFlags2(regex, refs),
|
|
2569
|
-
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
2570
|
-
});
|
|
2571
|
-
} else {
|
|
2572
|
-
setResponseValueAndErrors2(schema, "pattern", stringifyRegExpWithFlags2(regex, refs), message, refs);
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
function stringifyRegExpWithFlags2(regex, refs) {
|
|
2576
|
-
if (!refs.applyRegexFlags || !regex.flags) {
|
|
2577
|
-
return regex.source;
|
|
2578
|
-
}
|
|
2579
|
-
const flags = {
|
|
2580
|
-
i: regex.flags.includes("i"),
|
|
2581
|
-
m: regex.flags.includes("m"),
|
|
2582
|
-
s: regex.flags.includes("s")
|
|
2583
|
-
// `.` matches newlines
|
|
2584
|
-
};
|
|
2585
|
-
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
2586
|
-
let pattern = "";
|
|
2587
|
-
let isEscaped = false;
|
|
2588
|
-
let inCharGroup = false;
|
|
2589
|
-
let inCharRange = false;
|
|
2590
|
-
for (let i = 0; i < source.length; i++) {
|
|
2591
|
-
if (isEscaped) {
|
|
2592
|
-
pattern += source[i];
|
|
2593
|
-
isEscaped = false;
|
|
2594
|
-
continue;
|
|
2595
|
-
}
|
|
2596
|
-
if (flags.i) {
|
|
2597
|
-
if (inCharGroup) {
|
|
2598
|
-
if (source[i].match(/[a-z]/)) {
|
|
2599
|
-
if (inCharRange) {
|
|
2600
|
-
pattern += source[i];
|
|
2601
|
-
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
2602
|
-
inCharRange = false;
|
|
2603
|
-
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
2604
|
-
pattern += source[i];
|
|
2605
|
-
inCharRange = true;
|
|
2606
|
-
} else {
|
|
2607
|
-
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
2608
|
-
}
|
|
2609
|
-
continue;
|
|
2610
|
-
}
|
|
2611
|
-
} else if (source[i].match(/[a-z]/)) {
|
|
2612
|
-
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
2613
|
-
continue;
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
if (flags.m) {
|
|
2617
|
-
if (source[i] === "^") {
|
|
2618
|
-
pattern += `(^|(?<=[\r
|
|
2619
|
-
]))`;
|
|
2620
|
-
continue;
|
|
2621
|
-
} else if (source[i] === "$") {
|
|
2622
|
-
pattern += `($|(?=[\r
|
|
2623
|
-
]))`;
|
|
2624
|
-
continue;
|
|
2625
|
-
}
|
|
2626
|
-
}
|
|
2627
|
-
if (flags.s && source[i] === ".") {
|
|
2628
|
-
pattern += inCharGroup ? `${source[i]}\r
|
|
2629
|
-
` : `[${source[i]}\r
|
|
2630
|
-
]`;
|
|
2631
|
-
continue;
|
|
2632
|
-
}
|
|
2633
|
-
pattern += source[i];
|
|
2634
|
-
if (source[i] === "\\") {
|
|
2635
|
-
isEscaped = true;
|
|
2636
|
-
} else if (inCharGroup && source[i] === "]") {
|
|
2637
|
-
inCharGroup = false;
|
|
2638
|
-
} else if (!inCharGroup && source[i] === "[") {
|
|
2639
|
-
inCharGroup = true;
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
return pattern;
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
2646
|
-
function parseRecordDef2(def, refs) {
|
|
2647
|
-
if (refs.target === "openAi") {
|
|
2648
|
-
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
2649
|
-
}
|
|
2650
|
-
if (refs.target === "openApi3" && def.keyType?._def.typeName === v3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
2651
|
-
return {
|
|
2652
|
-
type: "object",
|
|
2653
|
-
required: def.keyType._def.values,
|
|
2654
|
-
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
2655
|
-
...acc,
|
|
2656
|
-
[key]: parseDef2(def.valueType._def, {
|
|
2657
|
-
...refs,
|
|
2658
|
-
currentPath: [...refs.currentPath, "properties", key]
|
|
2659
|
-
}) ?? parseAnyDef2(refs)
|
|
2660
|
-
}), {}),
|
|
2661
|
-
additionalProperties: refs.rejectedAdditionalProperties
|
|
2662
|
-
};
|
|
2663
|
-
}
|
|
2664
|
-
const schema = {
|
|
2665
|
-
type: "object",
|
|
2666
|
-
additionalProperties: parseDef2(def.valueType._def, {
|
|
2667
|
-
...refs,
|
|
2668
|
-
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
2669
|
-
}) ?? refs.allowedAdditionalProperties
|
|
2670
|
-
};
|
|
2671
|
-
if (refs.target === "openApi3") {
|
|
2672
|
-
return schema;
|
|
2673
|
-
}
|
|
2674
|
-
if (def.keyType?._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
2675
|
-
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
2676
|
-
return {
|
|
2677
|
-
...schema,
|
|
2678
|
-
propertyNames: keyType
|
|
2679
|
-
};
|
|
2680
|
-
} else if (def.keyType?._def.typeName === v3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
2681
|
-
return {
|
|
2682
|
-
...schema,
|
|
2683
|
-
propertyNames: {
|
|
2684
|
-
enum: def.keyType._def.values
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
} else if (def.keyType?._def.typeName === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
2688
|
-
const { type, ...keyType } = parseBrandedDef2(def.keyType._def, refs);
|
|
2689
|
-
return {
|
|
2690
|
-
...schema,
|
|
2691
|
-
propertyNames: keyType
|
|
2692
|
-
};
|
|
2693
|
-
}
|
|
2694
|
-
return schema;
|
|
2695
|
-
}
|
|
2696
|
-
|
|
2697
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
2698
|
-
function parseMapDef2(def, refs) {
|
|
2699
|
-
if (refs.mapStrategy === "record") {
|
|
2700
|
-
return parseRecordDef2(def, refs);
|
|
2701
|
-
}
|
|
2702
|
-
const keys = parseDef2(def.keyType._def, {
|
|
2703
|
-
...refs,
|
|
2704
|
-
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
2705
|
-
}) || parseAnyDef2(refs);
|
|
2706
|
-
const values = parseDef2(def.valueType._def, {
|
|
2707
|
-
...refs,
|
|
2708
|
-
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
2709
|
-
}) || parseAnyDef2(refs);
|
|
2710
|
-
return {
|
|
2711
|
-
type: "array",
|
|
2712
|
-
maxItems: 125,
|
|
2713
|
-
items: {
|
|
2714
|
-
type: "array",
|
|
2715
|
-
items: [keys, values],
|
|
2716
|
-
minItems: 2,
|
|
2717
|
-
maxItems: 2
|
|
2718
|
-
}
|
|
2719
|
-
};
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
2723
|
-
function parseNativeEnumDef2(def) {
|
|
2724
|
-
const object5 = def.values;
|
|
2725
|
-
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
2726
|
-
return typeof object5[object5[key]] !== "number";
|
|
2727
|
-
});
|
|
2728
|
-
const actualValues = actualKeys.map((key) => object5[key]);
|
|
2729
|
-
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
2730
|
-
return {
|
|
2731
|
-
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
2732
|
-
enum: actualValues
|
|
2733
|
-
};
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
2737
|
-
function parseNeverDef2(refs) {
|
|
2738
|
-
return refs.target === "openAi" ? void 0 : {
|
|
2739
|
-
not: parseAnyDef2({
|
|
2740
|
-
...refs,
|
|
2741
|
-
currentPath: [...refs.currentPath, "not"]
|
|
2742
|
-
})
|
|
2743
|
-
};
|
|
2744
|
-
}
|
|
2745
|
-
|
|
2746
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
2747
|
-
function parseNullDef2(refs) {
|
|
2748
|
-
return refs.target === "openApi3" ? {
|
|
2749
|
-
enum: ["null"],
|
|
2750
|
-
nullable: true
|
|
2751
|
-
} : {
|
|
2752
|
-
type: "null"
|
|
2753
|
-
};
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
2757
|
-
var primitiveMappings2 = {
|
|
2758
|
-
ZodString: "string",
|
|
2759
|
-
ZodNumber: "number",
|
|
2760
|
-
ZodBigInt: "integer",
|
|
2761
|
-
ZodBoolean: "boolean",
|
|
2762
|
-
ZodNull: "null"
|
|
2763
|
-
};
|
|
2764
|
-
function parseUnionDef2(def, refs) {
|
|
2765
|
-
if (refs.target === "openApi3")
|
|
2766
|
-
return asAnyOf2(def, refs);
|
|
2767
|
-
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
2768
|
-
if (options.every((x) => x._def.typeName in primitiveMappings2 && (!x._def.checks || !x._def.checks.length))) {
|
|
2769
|
-
const types = options.reduce((types2, x) => {
|
|
2770
|
-
const type = primitiveMappings2[x._def.typeName];
|
|
2771
|
-
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
2772
|
-
}, []);
|
|
2773
|
-
return {
|
|
2774
|
-
type: types.length > 1 ? types : types[0]
|
|
2775
|
-
};
|
|
2776
|
-
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
2777
|
-
const types = options.reduce((acc, x) => {
|
|
2778
|
-
const type = typeof x._def.value;
|
|
2779
|
-
switch (type) {
|
|
2780
|
-
case "string":
|
|
2781
|
-
case "number":
|
|
2782
|
-
case "boolean":
|
|
2783
|
-
return [...acc, type];
|
|
2784
|
-
case "bigint":
|
|
2785
|
-
return [...acc, "integer"];
|
|
2786
|
-
case "object":
|
|
2787
|
-
if (x._def.value === null)
|
|
2788
|
-
return [...acc, "null"];
|
|
2789
|
-
case "symbol":
|
|
2790
|
-
case "undefined":
|
|
2791
|
-
case "function":
|
|
2792
|
-
default:
|
|
2793
|
-
return acc;
|
|
2794
|
-
}
|
|
2795
|
-
}, []);
|
|
2796
|
-
if (types.length === options.length) {
|
|
2797
|
-
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
2798
|
-
return {
|
|
2799
|
-
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
2800
|
-
enum: options.reduce((acc, x) => {
|
|
2801
|
-
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
2802
|
-
}, [])
|
|
2803
|
-
};
|
|
2804
|
-
}
|
|
2805
|
-
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
2806
|
-
return {
|
|
2807
|
-
type: "string",
|
|
2808
|
-
enum: options.reduce((acc, x) => [
|
|
2809
|
-
...acc,
|
|
2810
|
-
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
2811
|
-
], [])
|
|
2812
|
-
};
|
|
2813
|
-
}
|
|
2814
|
-
return asAnyOf2(def, refs);
|
|
2815
|
-
}
|
|
2816
|
-
var asAnyOf2 = (def, refs) => {
|
|
2817
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef2(x._def, {
|
|
2818
|
-
...refs,
|
|
2819
|
-
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
2820
|
-
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
2821
|
-
return anyOf.length ? { anyOf } : void 0;
|
|
2822
|
-
};
|
|
2823
|
-
|
|
2824
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
2825
|
-
function parseNullableDef2(def, refs) {
|
|
2826
|
-
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
2827
|
-
if (refs.target === "openApi3") {
|
|
2828
|
-
return {
|
|
2829
|
-
type: primitiveMappings2[def.innerType._def.typeName],
|
|
2830
|
-
nullable: true
|
|
2831
|
-
};
|
|
2832
|
-
}
|
|
2833
|
-
return {
|
|
2834
|
-
type: [
|
|
2835
|
-
primitiveMappings2[def.innerType._def.typeName],
|
|
2836
|
-
"null"
|
|
2837
|
-
]
|
|
2838
|
-
};
|
|
2839
|
-
}
|
|
2840
|
-
if (refs.target === "openApi3") {
|
|
2841
|
-
const base2 = parseDef2(def.innerType._def, {
|
|
2842
|
-
...refs,
|
|
2843
|
-
currentPath: [...refs.currentPath]
|
|
2844
|
-
});
|
|
2845
|
-
if (base2 && "$ref" in base2)
|
|
2846
|
-
return { allOf: [base2], nullable: true };
|
|
2847
|
-
return base2 && { ...base2, nullable: true };
|
|
2848
|
-
}
|
|
2849
|
-
const base = parseDef2(def.innerType._def, {
|
|
2850
|
-
...refs,
|
|
2851
|
-
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
2852
|
-
});
|
|
2853
|
-
return base && { anyOf: [base, { type: "null" }] };
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
2857
|
-
function parseNumberDef2(def, refs) {
|
|
2858
|
-
const res = {
|
|
2859
|
-
type: "number"
|
|
2860
|
-
};
|
|
2861
|
-
if (!def.checks)
|
|
2862
|
-
return res;
|
|
2863
|
-
for (const check of def.checks) {
|
|
2864
|
-
switch (check.kind) {
|
|
2865
|
-
case "int":
|
|
2866
|
-
res.type = "integer";
|
|
2867
|
-
addErrorMessage2(res, "type", check.message, refs);
|
|
2868
|
-
break;
|
|
2869
|
-
case "min":
|
|
2870
|
-
if (refs.target === "jsonSchema7") {
|
|
2871
|
-
if (check.inclusive) {
|
|
2872
|
-
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2873
|
-
} else {
|
|
2874
|
-
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
2875
|
-
}
|
|
2876
|
-
} else {
|
|
2877
|
-
if (!check.inclusive) {
|
|
2878
|
-
res.exclusiveMinimum = true;
|
|
2879
|
-
}
|
|
2880
|
-
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2881
|
-
}
|
|
2882
|
-
break;
|
|
2883
|
-
case "max":
|
|
2884
|
-
if (refs.target === "jsonSchema7") {
|
|
2885
|
-
if (check.inclusive) {
|
|
2886
|
-
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2887
|
-
} else {
|
|
2888
|
-
setResponseValueAndErrors2(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
2889
|
-
}
|
|
2890
|
-
} else {
|
|
2891
|
-
if (!check.inclusive) {
|
|
2892
|
-
res.exclusiveMaximum = true;
|
|
2893
|
-
}
|
|
2894
|
-
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2895
|
-
}
|
|
2896
|
-
break;
|
|
2897
|
-
case "multipleOf":
|
|
2898
|
-
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
2899
|
-
break;
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
return res;
|
|
2903
|
-
}
|
|
2904
|
-
|
|
2905
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
2906
|
-
function parseObjectDef2(def, refs) {
|
|
2907
|
-
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
2908
|
-
const result = {
|
|
2909
|
-
type: "object",
|
|
2910
|
-
properties: {}
|
|
2911
|
-
};
|
|
2912
|
-
const required = [];
|
|
2913
|
-
const shape = def.shape();
|
|
2914
|
-
for (const propName in shape) {
|
|
2915
|
-
let propDef = shape[propName];
|
|
2916
|
-
if (propDef === void 0 || propDef._def === void 0) {
|
|
2917
|
-
continue;
|
|
2918
|
-
}
|
|
2919
|
-
let propOptional = safeIsOptional2(propDef);
|
|
2920
|
-
if (propOptional && forceOptionalIntoNullable) {
|
|
2921
|
-
if (propDef._def.typeName === "ZodOptional") {
|
|
2922
|
-
propDef = propDef._def.innerType;
|
|
2923
|
-
}
|
|
2924
|
-
if (!propDef.isNullable()) {
|
|
2925
|
-
propDef = propDef.nullable();
|
|
2926
|
-
}
|
|
2927
|
-
propOptional = false;
|
|
2928
|
-
}
|
|
2929
|
-
const parsedDef = parseDef2(propDef._def, {
|
|
2930
|
-
...refs,
|
|
2931
|
-
currentPath: [...refs.currentPath, "properties", propName],
|
|
2932
|
-
propertyPath: [...refs.currentPath, "properties", propName]
|
|
2933
|
-
});
|
|
2934
|
-
if (parsedDef === void 0) {
|
|
2935
|
-
continue;
|
|
2936
|
-
}
|
|
2937
|
-
result.properties[propName] = parsedDef;
|
|
2938
|
-
if (!propOptional) {
|
|
2939
|
-
required.push(propName);
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
if (required.length) {
|
|
2943
|
-
result.required = required;
|
|
2944
|
-
}
|
|
2945
|
-
const additionalProperties = decideAdditionalProperties2(def, refs);
|
|
2946
|
-
if (additionalProperties !== void 0) {
|
|
2947
|
-
result.additionalProperties = additionalProperties;
|
|
2948
|
-
}
|
|
2949
|
-
return result;
|
|
2950
|
-
}
|
|
2951
|
-
function decideAdditionalProperties2(def, refs) {
|
|
2952
|
-
if (def.catchall._def.typeName !== "ZodNever") {
|
|
2953
|
-
return parseDef2(def.catchall._def, {
|
|
2954
|
-
...refs,
|
|
2955
|
-
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
2956
|
-
});
|
|
2957
|
-
}
|
|
2958
|
-
switch (def.unknownKeys) {
|
|
2959
|
-
case "passthrough":
|
|
2960
|
-
return refs.allowedAdditionalProperties;
|
|
2961
|
-
case "strict":
|
|
2962
|
-
return refs.rejectedAdditionalProperties;
|
|
2963
|
-
case "strip":
|
|
2964
|
-
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
function safeIsOptional2(schema) {
|
|
2968
|
-
try {
|
|
2969
|
-
return schema.isOptional();
|
|
2970
|
-
} catch {
|
|
2971
|
-
return true;
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
2976
|
-
var parseOptionalDef2 = (def, refs) => {
|
|
2977
|
-
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
2978
|
-
return parseDef2(def.innerType._def, refs);
|
|
2979
|
-
}
|
|
2980
|
-
const innerSchema = parseDef2(def.innerType._def, {
|
|
2981
|
-
...refs,
|
|
2982
|
-
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
2983
|
-
});
|
|
2984
|
-
return innerSchema ? {
|
|
2985
|
-
anyOf: [
|
|
2986
|
-
{
|
|
2987
|
-
not: parseAnyDef2(refs)
|
|
2988
|
-
},
|
|
2989
|
-
innerSchema
|
|
2990
|
-
]
|
|
2991
|
-
} : parseAnyDef2(refs);
|
|
2992
|
-
};
|
|
2993
|
-
|
|
2994
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
2995
|
-
var parsePipelineDef2 = (def, refs) => {
|
|
2996
|
-
if (refs.pipeStrategy === "input") {
|
|
2997
|
-
return parseDef2(def.in._def, refs);
|
|
2998
|
-
} else if (refs.pipeStrategy === "output") {
|
|
2999
|
-
return parseDef2(def.out._def, refs);
|
|
3000
|
-
}
|
|
3001
|
-
const a = parseDef2(def.in._def, {
|
|
3002
|
-
...refs,
|
|
3003
|
-
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
3004
|
-
});
|
|
3005
|
-
const b = parseDef2(def.out._def, {
|
|
3006
|
-
...refs,
|
|
3007
|
-
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
3008
|
-
});
|
|
3009
|
-
return {
|
|
3010
|
-
allOf: [a, b].filter((x) => x !== void 0)
|
|
3011
|
-
};
|
|
3012
|
-
};
|
|
3013
|
-
|
|
3014
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
3015
|
-
function parsePromiseDef2(def, refs) {
|
|
3016
|
-
return parseDef2(def.type._def, refs);
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
3020
|
-
function parseSetDef2(def, refs) {
|
|
3021
|
-
const items = parseDef2(def.valueType._def, {
|
|
3022
|
-
...refs,
|
|
3023
|
-
currentPath: [...refs.currentPath, "items"]
|
|
3024
|
-
});
|
|
3025
|
-
const schema = {
|
|
3026
|
-
type: "array",
|
|
3027
|
-
uniqueItems: true,
|
|
3028
|
-
items
|
|
3029
|
-
};
|
|
3030
|
-
if (def.minSize) {
|
|
3031
|
-
setResponseValueAndErrors2(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
3032
|
-
}
|
|
3033
|
-
if (def.maxSize) {
|
|
3034
|
-
setResponseValueAndErrors2(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
3035
|
-
}
|
|
3036
|
-
return schema;
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
3040
|
-
function parseTupleDef2(def, refs) {
|
|
3041
|
-
if (def.rest) {
|
|
3042
|
-
return {
|
|
3043
|
-
type: "array",
|
|
3044
|
-
minItems: def.items.length,
|
|
3045
|
-
items: def.items.map((x, i) => parseDef2(x._def, {
|
|
3046
|
-
...refs,
|
|
3047
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
3048
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
3049
|
-
additionalItems: parseDef2(def.rest._def, {
|
|
3050
|
-
...refs,
|
|
3051
|
-
currentPath: [...refs.currentPath, "additionalItems"]
|
|
3052
|
-
})
|
|
3053
|
-
};
|
|
3054
|
-
} else {
|
|
3055
|
-
return {
|
|
3056
|
-
type: "array",
|
|
3057
|
-
minItems: def.items.length,
|
|
3058
|
-
maxItems: def.items.length,
|
|
3059
|
-
items: def.items.map((x, i) => parseDef2(x._def, {
|
|
3060
|
-
...refs,
|
|
3061
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
3062
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
3063
|
-
};
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
|
|
3067
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
3068
|
-
function parseUndefinedDef2(refs) {
|
|
3069
|
-
return {
|
|
3070
|
-
not: parseAnyDef2(refs)
|
|
3071
|
-
};
|
|
3072
|
-
}
|
|
3073
|
-
|
|
3074
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
3075
|
-
function parseUnknownDef2(refs) {
|
|
3076
|
-
return parseAnyDef2(refs);
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
3080
|
-
var parseReadonlyDef2 = (def, refs) => {
|
|
3081
|
-
return parseDef2(def.innerType._def, refs);
|
|
3082
|
-
};
|
|
3083
|
-
|
|
3084
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
3085
|
-
var selectParser2 = (def, typeName, refs) => {
|
|
3086
|
-
switch (typeName) {
|
|
3087
|
-
case v3.ZodFirstPartyTypeKind.ZodString:
|
|
3088
|
-
return parseStringDef2(def, refs);
|
|
3089
|
-
case v3.ZodFirstPartyTypeKind.ZodNumber:
|
|
3090
|
-
return parseNumberDef2(def, refs);
|
|
3091
|
-
case v3.ZodFirstPartyTypeKind.ZodObject:
|
|
3092
|
-
return parseObjectDef2(def, refs);
|
|
3093
|
-
case v3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
3094
|
-
return parseBigintDef2(def, refs);
|
|
3095
|
-
case v3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
3096
|
-
return parseBooleanDef2();
|
|
3097
|
-
case v3.ZodFirstPartyTypeKind.ZodDate:
|
|
3098
|
-
return parseDateDef2(def, refs);
|
|
3099
|
-
case v3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
3100
|
-
return parseUndefinedDef2(refs);
|
|
3101
|
-
case v3.ZodFirstPartyTypeKind.ZodNull:
|
|
3102
|
-
return parseNullDef2(refs);
|
|
3103
|
-
case v3.ZodFirstPartyTypeKind.ZodArray:
|
|
3104
|
-
return parseArrayDef2(def, refs);
|
|
3105
|
-
case v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
3106
|
-
case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
3107
|
-
return parseUnionDef2(def, refs);
|
|
3108
|
-
case v3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
3109
|
-
return parseIntersectionDef2(def, refs);
|
|
3110
|
-
case v3.ZodFirstPartyTypeKind.ZodTuple:
|
|
3111
|
-
return parseTupleDef2(def, refs);
|
|
3112
|
-
case v3.ZodFirstPartyTypeKind.ZodRecord:
|
|
3113
|
-
return parseRecordDef2(def, refs);
|
|
3114
|
-
case v3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
3115
|
-
return parseLiteralDef2(def, refs);
|
|
3116
|
-
case v3.ZodFirstPartyTypeKind.ZodEnum:
|
|
3117
|
-
return parseEnumDef2(def);
|
|
3118
|
-
case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
3119
|
-
return parseNativeEnumDef2(def);
|
|
3120
|
-
case v3.ZodFirstPartyTypeKind.ZodNullable:
|
|
3121
|
-
return parseNullableDef2(def, refs);
|
|
3122
|
-
case v3.ZodFirstPartyTypeKind.ZodOptional:
|
|
3123
|
-
return parseOptionalDef2(def, refs);
|
|
3124
|
-
case v3.ZodFirstPartyTypeKind.ZodMap:
|
|
3125
|
-
return parseMapDef2(def, refs);
|
|
3126
|
-
case v3.ZodFirstPartyTypeKind.ZodSet:
|
|
3127
|
-
return parseSetDef2(def, refs);
|
|
3128
|
-
case v3.ZodFirstPartyTypeKind.ZodLazy:
|
|
3129
|
-
return () => def.getter()._def;
|
|
3130
|
-
case v3.ZodFirstPartyTypeKind.ZodPromise:
|
|
3131
|
-
return parsePromiseDef2(def, refs);
|
|
3132
|
-
case v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
3133
|
-
case v3.ZodFirstPartyTypeKind.ZodNever:
|
|
3134
|
-
return parseNeverDef2(refs);
|
|
3135
|
-
case v3.ZodFirstPartyTypeKind.ZodEffects:
|
|
3136
|
-
return parseEffectsDef2(def, refs);
|
|
3137
|
-
case v3.ZodFirstPartyTypeKind.ZodAny:
|
|
3138
|
-
return parseAnyDef2(refs);
|
|
3139
|
-
case v3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
3140
|
-
return parseUnknownDef2(refs);
|
|
3141
|
-
case v3.ZodFirstPartyTypeKind.ZodDefault:
|
|
3142
|
-
return parseDefaultDef2(def, refs);
|
|
3143
|
-
case v3.ZodFirstPartyTypeKind.ZodBranded:
|
|
3144
|
-
return parseBrandedDef2(def, refs);
|
|
3145
|
-
case v3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
3146
|
-
return parseReadonlyDef2(def, refs);
|
|
3147
|
-
case v3.ZodFirstPartyTypeKind.ZodCatch:
|
|
3148
|
-
return parseCatchDef2(def, refs);
|
|
3149
|
-
case v3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
3150
|
-
return parsePipelineDef2(def, refs);
|
|
3151
|
-
case v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
3152
|
-
case v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
3153
|
-
case v3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
3154
|
-
return void 0;
|
|
3155
|
-
default:
|
|
3156
|
-
return /* @__PURE__ */ ((_) => void 0)();
|
|
3157
|
-
}
|
|
3158
|
-
};
|
|
3159
|
-
|
|
3160
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
3161
|
-
function parseDef2(def, refs, forceResolution = false) {
|
|
3162
|
-
const seenItem = refs.seen.get(def);
|
|
3163
|
-
if (refs.override) {
|
|
3164
|
-
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
3165
|
-
if (overrideResult !== ignoreOverride2) {
|
|
3166
|
-
return overrideResult;
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
if (seenItem && !forceResolution) {
|
|
3170
|
-
const seenSchema = get$ref2(seenItem, refs);
|
|
3171
|
-
if (seenSchema !== void 0) {
|
|
3172
|
-
return seenSchema;
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
3176
|
-
refs.seen.set(def, newItem);
|
|
3177
|
-
const jsonSchemaOrGetter = selectParser2(def, def.typeName, refs);
|
|
3178
|
-
const jsonSchema5 = typeof jsonSchemaOrGetter === "function" ? parseDef2(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
3179
|
-
if (jsonSchema5) {
|
|
3180
|
-
addMeta2(def, refs, jsonSchema5);
|
|
3181
|
-
}
|
|
3182
|
-
if (refs.postProcess) {
|
|
3183
|
-
const postProcessResult = refs.postProcess(jsonSchema5, def, refs);
|
|
3184
|
-
newItem.jsonSchema = jsonSchema5;
|
|
3185
|
-
return postProcessResult;
|
|
3186
|
-
}
|
|
3187
|
-
newItem.jsonSchema = jsonSchema5;
|
|
3188
|
-
return jsonSchema5;
|
|
3189
|
-
}
|
|
3190
|
-
var get$ref2 = (item, refs) => {
|
|
3191
|
-
switch (refs.$refStrategy) {
|
|
3192
|
-
case "root":
|
|
3193
|
-
return { $ref: item.path.join("/") };
|
|
3194
|
-
case "relative":
|
|
3195
|
-
return { $ref: getRelativePath2(refs.currentPath, item.path) };
|
|
3196
|
-
case "none":
|
|
3197
|
-
case "seen": {
|
|
3198
|
-
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
3199
|
-
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
3200
|
-
return parseAnyDef2(refs);
|
|
3201
|
-
}
|
|
3202
|
-
return refs.$refStrategy === "seen" ? parseAnyDef2(refs) : void 0;
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
};
|
|
3206
|
-
var addMeta2 = (def, refs, jsonSchema5) => {
|
|
3207
|
-
if (def.description) {
|
|
3208
|
-
jsonSchema5.description = def.description;
|
|
3209
|
-
if (refs.markdownDescription) {
|
|
3210
|
-
jsonSchema5.markdownDescription = def.description;
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
return jsonSchema5;
|
|
3214
|
-
};
|
|
3215
|
-
|
|
3216
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
3217
|
-
var zodToJsonSchema3 = (schema, options) => {
|
|
3218
|
-
const refs = getRefs2(options);
|
|
3219
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name26, schema2]) => ({
|
|
3220
|
-
...acc,
|
|
3221
|
-
[name26]: parseDef2(schema2._def, {
|
|
3222
|
-
...refs,
|
|
3223
|
-
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
3224
|
-
}, true) ?? parseAnyDef2(refs)
|
|
3225
|
-
}), {}) : void 0;
|
|
3226
|
-
const name21 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
3227
|
-
const main = parseDef2(schema._def, name21 === void 0 ? refs : {
|
|
3228
|
-
...refs,
|
|
3229
|
-
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
3230
|
-
}, false) ?? parseAnyDef2(refs);
|
|
3231
|
-
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
3232
|
-
if (title !== void 0) {
|
|
3233
|
-
main.title = title;
|
|
3234
|
-
}
|
|
3235
|
-
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
3236
|
-
if (!definitions) {
|
|
3237
|
-
definitions = {};
|
|
3238
|
-
}
|
|
3239
|
-
if (!definitions[refs.openAiAnyTypeName]) {
|
|
3240
|
-
definitions[refs.openAiAnyTypeName] = {
|
|
3241
|
-
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
3242
|
-
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
3243
|
-
items: {
|
|
3244
|
-
$ref: refs.$refStrategy === "relative" ? "1" : [
|
|
3245
|
-
...refs.basePath,
|
|
3246
|
-
refs.definitionPath,
|
|
3247
|
-
refs.openAiAnyTypeName
|
|
3248
|
-
].join("/")
|
|
3249
|
-
}
|
|
3250
|
-
};
|
|
3251
|
-
}
|
|
3252
|
-
}
|
|
3253
|
-
const combined = name21 === void 0 ? definitions ? {
|
|
3254
|
-
...main,
|
|
3255
|
-
[refs.definitionPath]: definitions
|
|
3256
|
-
} : main : {
|
|
3257
|
-
$ref: [
|
|
3258
|
-
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
3259
|
-
refs.definitionPath,
|
|
3260
|
-
name21
|
|
3261
|
-
].join("/"),
|
|
3262
|
-
[refs.definitionPath]: {
|
|
3263
|
-
...definitions,
|
|
3264
|
-
[name21]: main
|
|
3265
|
-
}
|
|
3266
|
-
};
|
|
3267
|
-
if (refs.target === "jsonSchema7") {
|
|
3268
|
-
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
3269
|
-
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
3270
|
-
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
3271
|
-
}
|
|
3272
|
-
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
3273
|
-
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
3274
|
-
}
|
|
3275
|
-
return combined;
|
|
3276
|
-
};
|
|
3277
|
-
|
|
3278
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
3279
|
-
var esm_default2 = zodToJsonSchema3;
|
|
3280
|
-
function fixJson(input) {
|
|
3281
|
-
const stack = ["ROOT"];
|
|
3282
|
-
let lastValidIndex = -1;
|
|
3283
|
-
let literalStart = null;
|
|
3284
|
-
function processValueStart(char, i, swapState) {
|
|
3285
|
-
{
|
|
3286
|
-
switch (char) {
|
|
3287
|
-
case '"': {
|
|
3288
|
-
lastValidIndex = i;
|
|
3289
|
-
stack.pop();
|
|
3290
|
-
stack.push(swapState);
|
|
3291
|
-
stack.push("INSIDE_STRING");
|
|
3292
|
-
break;
|
|
3293
|
-
}
|
|
3294
|
-
case "f":
|
|
3295
|
-
case "t":
|
|
3296
|
-
case "n": {
|
|
3297
|
-
lastValidIndex = i;
|
|
3298
|
-
literalStart = i;
|
|
3299
|
-
stack.pop();
|
|
3300
|
-
stack.push(swapState);
|
|
3301
|
-
stack.push("INSIDE_LITERAL");
|
|
3302
|
-
break;
|
|
3303
|
-
}
|
|
3304
|
-
case "-": {
|
|
3305
|
-
stack.pop();
|
|
3306
|
-
stack.push(swapState);
|
|
3307
|
-
stack.push("INSIDE_NUMBER");
|
|
3308
|
-
break;
|
|
3309
|
-
}
|
|
3310
|
-
case "0":
|
|
3311
|
-
case "1":
|
|
3312
|
-
case "2":
|
|
3313
|
-
case "3":
|
|
3314
|
-
case "4":
|
|
3315
|
-
case "5":
|
|
3316
|
-
case "6":
|
|
3317
|
-
case "7":
|
|
3318
|
-
case "8":
|
|
3319
|
-
case "9": {
|
|
3320
|
-
lastValidIndex = i;
|
|
3321
|
-
stack.pop();
|
|
3322
|
-
stack.push(swapState);
|
|
3323
|
-
stack.push("INSIDE_NUMBER");
|
|
3324
|
-
break;
|
|
3325
|
-
}
|
|
3326
|
-
case "{": {
|
|
3327
|
-
lastValidIndex = i;
|
|
3328
|
-
stack.pop();
|
|
3329
|
-
stack.push(swapState);
|
|
3330
|
-
stack.push("INSIDE_OBJECT_START");
|
|
3331
|
-
break;
|
|
3332
|
-
}
|
|
3333
|
-
case "[": {
|
|
3334
|
-
lastValidIndex = i;
|
|
3335
|
-
stack.pop();
|
|
3336
|
-
stack.push(swapState);
|
|
3337
|
-
stack.push("INSIDE_ARRAY_START");
|
|
3338
|
-
break;
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
function processAfterObjectValue(char, i) {
|
|
3344
|
-
switch (char) {
|
|
3345
|
-
case ",": {
|
|
3346
|
-
stack.pop();
|
|
3347
|
-
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
3348
|
-
break;
|
|
3349
|
-
}
|
|
3350
|
-
case "}": {
|
|
3351
|
-
lastValidIndex = i;
|
|
3352
|
-
stack.pop();
|
|
3353
|
-
break;
|
|
3354
|
-
}
|
|
3355
|
-
}
|
|
3356
|
-
}
|
|
3357
|
-
function processAfterArrayValue(char, i) {
|
|
3358
|
-
switch (char) {
|
|
3359
|
-
case ",": {
|
|
3360
|
-
stack.pop();
|
|
3361
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
3362
|
-
break;
|
|
3363
|
-
}
|
|
3364
|
-
case "]": {
|
|
3365
|
-
lastValidIndex = i;
|
|
3366
|
-
stack.pop();
|
|
3367
|
-
break;
|
|
3368
|
-
}
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3371
|
-
for (let i = 0; i < input.length; i++) {
|
|
3372
|
-
const char = input[i];
|
|
3373
|
-
const currentState = stack[stack.length - 1];
|
|
3374
|
-
switch (currentState) {
|
|
3375
|
-
case "ROOT":
|
|
3376
|
-
processValueStart(char, i, "FINISH");
|
|
3377
|
-
break;
|
|
3378
|
-
case "INSIDE_OBJECT_START": {
|
|
3379
|
-
switch (char) {
|
|
3380
|
-
case '"': {
|
|
3381
|
-
stack.pop();
|
|
3382
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
3383
|
-
break;
|
|
3384
|
-
}
|
|
3385
|
-
case "}": {
|
|
3386
|
-
lastValidIndex = i;
|
|
3387
|
-
stack.pop();
|
|
3388
|
-
break;
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
break;
|
|
3392
|
-
}
|
|
3393
|
-
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
3394
|
-
switch (char) {
|
|
3395
|
-
case '"': {
|
|
3396
|
-
stack.pop();
|
|
3397
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
3398
|
-
break;
|
|
2120
|
+
}
|
|
2121
|
+
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
2122
|
+
switch (char) {
|
|
2123
|
+
case '"': {
|
|
2124
|
+
stack.pop();
|
|
2125
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
2126
|
+
break;
|
|
3399
2127
|
}
|
|
3400
2128
|
}
|
|
3401
2129
|
break;
|
|
@@ -3874,7 +2602,7 @@ function zodSchema(zodSchema22, options) {
|
|
|
3874
2602
|
var _a26;
|
|
3875
2603
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
3876
2604
|
return jsonSchema(
|
|
3877
|
-
|
|
2605
|
+
esm_default(zodSchema22, {
|
|
3878
2606
|
$refStrategy: useReferences ? "root" : "none",
|
|
3879
2607
|
target: "jsonSchema7"
|
|
3880
2608
|
// note: openai mode breaks various gemini conversions
|
|
@@ -6691,7 +5419,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
|
6691
5419
|
rawValue: parsedResult.rawValue
|
|
6692
5420
|
};
|
|
6693
5421
|
};
|
|
6694
|
-
var
|
|
5422
|
+
var getRelativePath2 = (pathA, pathB) => {
|
|
6695
5423
|
let i = 0;
|
|
6696
5424
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
6697
5425
|
if (pathA[i] !== pathB[i])
|
|
@@ -6699,10 +5427,10 @@ var getRelativePath3 = (pathA, pathB) => {
|
|
|
6699
5427
|
}
|
|
6700
5428
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
6701
5429
|
};
|
|
6702
|
-
var
|
|
5430
|
+
var ignoreOverride2 = Symbol(
|
|
6703
5431
|
"Let zodToJsonSchema decide on which parser to use"
|
|
6704
5432
|
);
|
|
6705
|
-
var
|
|
5433
|
+
var defaultOptions2 = {
|
|
6706
5434
|
name: void 0,
|
|
6707
5435
|
$refStrategy: "root",
|
|
6708
5436
|
basePath: ["#"],
|
|
@@ -6723,23 +5451,23 @@ var defaultOptions3 = {
|
|
|
6723
5451
|
base64Strategy: "contentEncoding:base64",
|
|
6724
5452
|
nameStrategy: "ref"
|
|
6725
5453
|
};
|
|
6726
|
-
var
|
|
6727
|
-
...
|
|
5454
|
+
var getDefaultOptions2 = (options) => typeof options === "string" ? {
|
|
5455
|
+
...defaultOptions2,
|
|
6728
5456
|
name: options
|
|
6729
5457
|
} : {
|
|
6730
|
-
...
|
|
5458
|
+
...defaultOptions2,
|
|
6731
5459
|
...options
|
|
6732
5460
|
};
|
|
6733
|
-
function
|
|
5461
|
+
function parseAnyDef2() {
|
|
6734
5462
|
return {};
|
|
6735
5463
|
}
|
|
6736
|
-
function
|
|
5464
|
+
function parseArrayDef2(def, refs) {
|
|
6737
5465
|
var _a26, _b8, _c;
|
|
6738
5466
|
const res = {
|
|
6739
5467
|
type: "array"
|
|
6740
5468
|
};
|
|
6741
5469
|
if (((_a26 = def.type) == null ? void 0 : _a26._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
6742
|
-
res.items =
|
|
5470
|
+
res.items = parseDef2(def.type._def, {
|
|
6743
5471
|
...refs,
|
|
6744
5472
|
currentPath: [...refs.currentPath, "items"]
|
|
6745
5473
|
});
|
|
@@ -6756,7 +5484,7 @@ function parseArrayDef3(def, refs) {
|
|
|
6756
5484
|
}
|
|
6757
5485
|
return res;
|
|
6758
5486
|
}
|
|
6759
|
-
function
|
|
5487
|
+
function parseBigintDef2(def) {
|
|
6760
5488
|
const res = {
|
|
6761
5489
|
type: "integer",
|
|
6762
5490
|
format: "int64"
|
|
@@ -6786,20 +5514,20 @@ function parseBigintDef3(def) {
|
|
|
6786
5514
|
}
|
|
6787
5515
|
return res;
|
|
6788
5516
|
}
|
|
6789
|
-
function
|
|
5517
|
+
function parseBooleanDef2() {
|
|
6790
5518
|
return { type: "boolean" };
|
|
6791
5519
|
}
|
|
6792
|
-
function
|
|
6793
|
-
return
|
|
5520
|
+
function parseBrandedDef2(_def, refs) {
|
|
5521
|
+
return parseDef2(_def.type._def, refs);
|
|
6794
5522
|
}
|
|
6795
|
-
var
|
|
6796
|
-
return
|
|
5523
|
+
var parseCatchDef2 = (def, refs) => {
|
|
5524
|
+
return parseDef2(def.innerType._def, refs);
|
|
6797
5525
|
};
|
|
6798
|
-
function
|
|
5526
|
+
function parseDateDef2(def, refs, overrideDateStrategy) {
|
|
6799
5527
|
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
6800
5528
|
if (Array.isArray(strategy)) {
|
|
6801
5529
|
return {
|
|
6802
|
-
anyOf: strategy.map((item, i) =>
|
|
5530
|
+
anyOf: strategy.map((item, i) => parseDateDef2(def, refs, item))
|
|
6803
5531
|
};
|
|
6804
5532
|
}
|
|
6805
5533
|
switch (strategy) {
|
|
@@ -6815,10 +5543,10 @@ function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
|
6815
5543
|
format: "date"
|
|
6816
5544
|
};
|
|
6817
5545
|
case "integer":
|
|
6818
|
-
return
|
|
5546
|
+
return integerDateParser2(def);
|
|
6819
5547
|
}
|
|
6820
5548
|
}
|
|
6821
|
-
var
|
|
5549
|
+
var integerDateParser2 = (def) => {
|
|
6822
5550
|
const res = {
|
|
6823
5551
|
type: "integer",
|
|
6824
5552
|
format: "unix-time"
|
|
@@ -6835,40 +5563,40 @@ var integerDateParser3 = (def) => {
|
|
|
6835
5563
|
}
|
|
6836
5564
|
return res;
|
|
6837
5565
|
};
|
|
6838
|
-
function
|
|
5566
|
+
function parseDefaultDef2(_def, refs) {
|
|
6839
5567
|
return {
|
|
6840
|
-
...
|
|
5568
|
+
...parseDef2(_def.innerType._def, refs),
|
|
6841
5569
|
default: _def.defaultValue()
|
|
6842
5570
|
};
|
|
6843
5571
|
}
|
|
6844
|
-
function
|
|
6845
|
-
return refs.effectStrategy === "input" ?
|
|
5572
|
+
function parseEffectsDef2(_def, refs) {
|
|
5573
|
+
return refs.effectStrategy === "input" ? parseDef2(_def.schema._def, refs) : parseAnyDef2();
|
|
6846
5574
|
}
|
|
6847
|
-
function
|
|
5575
|
+
function parseEnumDef2(def) {
|
|
6848
5576
|
return {
|
|
6849
5577
|
type: "string",
|
|
6850
5578
|
enum: Array.from(def.values)
|
|
6851
5579
|
};
|
|
6852
5580
|
}
|
|
6853
|
-
var
|
|
5581
|
+
var isJsonSchema7AllOfType2 = (type) => {
|
|
6854
5582
|
if ("type" in type && type.type === "string")
|
|
6855
5583
|
return false;
|
|
6856
5584
|
return "allOf" in type;
|
|
6857
5585
|
};
|
|
6858
|
-
function
|
|
5586
|
+
function parseIntersectionDef2(def, refs) {
|
|
6859
5587
|
const allOf = [
|
|
6860
|
-
|
|
5588
|
+
parseDef2(def.left._def, {
|
|
6861
5589
|
...refs,
|
|
6862
5590
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
6863
5591
|
}),
|
|
6864
|
-
|
|
5592
|
+
parseDef2(def.right._def, {
|
|
6865
5593
|
...refs,
|
|
6866
5594
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
6867
5595
|
})
|
|
6868
5596
|
].filter((x) => !!x);
|
|
6869
5597
|
const mergedAllOf = [];
|
|
6870
5598
|
allOf.forEach((schema) => {
|
|
6871
|
-
if (
|
|
5599
|
+
if (isJsonSchema7AllOfType2(schema)) {
|
|
6872
5600
|
mergedAllOf.push(...schema.allOf);
|
|
6873
5601
|
} else {
|
|
6874
5602
|
let nestedSchema = schema;
|
|
@@ -6881,7 +5609,7 @@ function parseIntersectionDef3(def, refs) {
|
|
|
6881
5609
|
});
|
|
6882
5610
|
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
6883
5611
|
}
|
|
6884
|
-
function
|
|
5612
|
+
function parseLiteralDef2(def) {
|
|
6885
5613
|
const parsedType = typeof def.value;
|
|
6886
5614
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
6887
5615
|
return {
|
|
@@ -6893,8 +5621,8 @@ function parseLiteralDef3(def) {
|
|
|
6893
5621
|
const: def.value
|
|
6894
5622
|
};
|
|
6895
5623
|
}
|
|
6896
|
-
var
|
|
6897
|
-
var
|
|
5624
|
+
var emojiRegex2 = void 0;
|
|
5625
|
+
var zodPatterns2 = {
|
|
6898
5626
|
/**
|
|
6899
5627
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
6900
5628
|
*/
|
|
@@ -6917,13 +5645,13 @@ var zodPatterns3 = {
|
|
|
6917
5645
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
6918
5646
|
*/
|
|
6919
5647
|
emoji: () => {
|
|
6920
|
-
if (
|
|
6921
|
-
|
|
5648
|
+
if (emojiRegex2 === void 0) {
|
|
5649
|
+
emojiRegex2 = RegExp(
|
|
6922
5650
|
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
6923
5651
|
"u"
|
|
6924
5652
|
);
|
|
6925
5653
|
}
|
|
6926
|
-
return
|
|
5654
|
+
return emojiRegex2;
|
|
6927
5655
|
},
|
|
6928
5656
|
/**
|
|
6929
5657
|
* Unused
|
|
@@ -6944,7 +5672,7 @@ var zodPatterns3 = {
|
|
|
6944
5672
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
6945
5673
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
6946
5674
|
};
|
|
6947
|
-
function
|
|
5675
|
+
function parseStringDef2(def, refs) {
|
|
6948
5676
|
const res = {
|
|
6949
5677
|
type: "string"
|
|
6950
5678
|
};
|
|
@@ -6960,67 +5688,67 @@ function parseStringDef3(def, refs) {
|
|
|
6960
5688
|
case "email":
|
|
6961
5689
|
switch (refs.emailStrategy) {
|
|
6962
5690
|
case "format:email":
|
|
6963
|
-
|
|
5691
|
+
addFormat2(res, "email", check.message, refs);
|
|
6964
5692
|
break;
|
|
6965
5693
|
case "format:idn-email":
|
|
6966
|
-
|
|
5694
|
+
addFormat2(res, "idn-email", check.message, refs);
|
|
6967
5695
|
break;
|
|
6968
5696
|
case "pattern:zod":
|
|
6969
|
-
|
|
5697
|
+
addPattern2(res, zodPatterns2.email, check.message, refs);
|
|
6970
5698
|
break;
|
|
6971
5699
|
}
|
|
6972
5700
|
break;
|
|
6973
5701
|
case "url":
|
|
6974
|
-
|
|
5702
|
+
addFormat2(res, "uri", check.message, refs);
|
|
6975
5703
|
break;
|
|
6976
5704
|
case "uuid":
|
|
6977
|
-
|
|
5705
|
+
addFormat2(res, "uuid", check.message, refs);
|
|
6978
5706
|
break;
|
|
6979
5707
|
case "regex":
|
|
6980
|
-
|
|
5708
|
+
addPattern2(res, check.regex, check.message, refs);
|
|
6981
5709
|
break;
|
|
6982
5710
|
case "cuid":
|
|
6983
|
-
|
|
5711
|
+
addPattern2(res, zodPatterns2.cuid, check.message, refs);
|
|
6984
5712
|
break;
|
|
6985
5713
|
case "cuid2":
|
|
6986
|
-
|
|
5714
|
+
addPattern2(res, zodPatterns2.cuid2, check.message, refs);
|
|
6987
5715
|
break;
|
|
6988
5716
|
case "startsWith":
|
|
6989
|
-
|
|
5717
|
+
addPattern2(
|
|
6990
5718
|
res,
|
|
6991
|
-
RegExp(`^${
|
|
5719
|
+
RegExp(`^${escapeLiteralCheckValue2(check.value, refs)}`),
|
|
6992
5720
|
check.message,
|
|
6993
5721
|
refs
|
|
6994
5722
|
);
|
|
6995
5723
|
break;
|
|
6996
5724
|
case "endsWith":
|
|
6997
|
-
|
|
5725
|
+
addPattern2(
|
|
6998
5726
|
res,
|
|
6999
|
-
RegExp(`${
|
|
5727
|
+
RegExp(`${escapeLiteralCheckValue2(check.value, refs)}$`),
|
|
7000
5728
|
check.message,
|
|
7001
5729
|
refs
|
|
7002
5730
|
);
|
|
7003
5731
|
break;
|
|
7004
5732
|
case "datetime":
|
|
7005
|
-
|
|
5733
|
+
addFormat2(res, "date-time", check.message, refs);
|
|
7006
5734
|
break;
|
|
7007
5735
|
case "date":
|
|
7008
|
-
|
|
5736
|
+
addFormat2(res, "date", check.message, refs);
|
|
7009
5737
|
break;
|
|
7010
5738
|
case "time":
|
|
7011
|
-
|
|
5739
|
+
addFormat2(res, "time", check.message, refs);
|
|
7012
5740
|
break;
|
|
7013
5741
|
case "duration":
|
|
7014
|
-
|
|
5742
|
+
addFormat2(res, "duration", check.message, refs);
|
|
7015
5743
|
break;
|
|
7016
5744
|
case "length":
|
|
7017
5745
|
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
7018
5746
|
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
7019
5747
|
break;
|
|
7020
5748
|
case "includes": {
|
|
7021
|
-
|
|
5749
|
+
addPattern2(
|
|
7022
5750
|
res,
|
|
7023
|
-
RegExp(
|
|
5751
|
+
RegExp(escapeLiteralCheckValue2(check.value, refs)),
|
|
7024
5752
|
check.message,
|
|
7025
5753
|
refs
|
|
7026
5754
|
);
|
|
@@ -7028,39 +5756,39 @@ function parseStringDef3(def, refs) {
|
|
|
7028
5756
|
}
|
|
7029
5757
|
case "ip": {
|
|
7030
5758
|
if (check.version !== "v6") {
|
|
7031
|
-
|
|
5759
|
+
addFormat2(res, "ipv4", check.message, refs);
|
|
7032
5760
|
}
|
|
7033
5761
|
if (check.version !== "v4") {
|
|
7034
|
-
|
|
5762
|
+
addFormat2(res, "ipv6", check.message, refs);
|
|
7035
5763
|
}
|
|
7036
5764
|
break;
|
|
7037
5765
|
}
|
|
7038
5766
|
case "base64url":
|
|
7039
|
-
|
|
5767
|
+
addPattern2(res, zodPatterns2.base64url, check.message, refs);
|
|
7040
5768
|
break;
|
|
7041
5769
|
case "jwt":
|
|
7042
|
-
|
|
5770
|
+
addPattern2(res, zodPatterns2.jwt, check.message, refs);
|
|
7043
5771
|
break;
|
|
7044
5772
|
case "cidr": {
|
|
7045
5773
|
if (check.version !== "v6") {
|
|
7046
|
-
|
|
5774
|
+
addPattern2(res, zodPatterns2.ipv4Cidr, check.message, refs);
|
|
7047
5775
|
}
|
|
7048
5776
|
if (check.version !== "v4") {
|
|
7049
|
-
|
|
5777
|
+
addPattern2(res, zodPatterns2.ipv6Cidr, check.message, refs);
|
|
7050
5778
|
}
|
|
7051
5779
|
break;
|
|
7052
5780
|
}
|
|
7053
5781
|
case "emoji":
|
|
7054
|
-
|
|
5782
|
+
addPattern2(res, zodPatterns2.emoji(), check.message, refs);
|
|
7055
5783
|
break;
|
|
7056
5784
|
case "ulid": {
|
|
7057
|
-
|
|
5785
|
+
addPattern2(res, zodPatterns2.ulid, check.message, refs);
|
|
7058
5786
|
break;
|
|
7059
5787
|
}
|
|
7060
5788
|
case "base64": {
|
|
7061
5789
|
switch (refs.base64Strategy) {
|
|
7062
5790
|
case "format:binary": {
|
|
7063
|
-
|
|
5791
|
+
addFormat2(res, "binary", check.message, refs);
|
|
7064
5792
|
break;
|
|
7065
5793
|
}
|
|
7066
5794
|
case "contentEncoding:base64": {
|
|
@@ -7068,37 +5796,37 @@ function parseStringDef3(def, refs) {
|
|
|
7068
5796
|
break;
|
|
7069
5797
|
}
|
|
7070
5798
|
case "pattern:zod": {
|
|
7071
|
-
|
|
5799
|
+
addPattern2(res, zodPatterns2.base64, check.message, refs);
|
|
7072
5800
|
break;
|
|
7073
5801
|
}
|
|
7074
5802
|
}
|
|
7075
5803
|
break;
|
|
7076
5804
|
}
|
|
7077
5805
|
case "nanoid": {
|
|
7078
|
-
|
|
5806
|
+
addPattern2(res, zodPatterns2.nanoid, check.message, refs);
|
|
7079
5807
|
}
|
|
7080
5808
|
}
|
|
7081
5809
|
}
|
|
7082
5810
|
}
|
|
7083
5811
|
return res;
|
|
7084
5812
|
}
|
|
7085
|
-
function
|
|
7086
|
-
return refs.patternStrategy === "escape" ?
|
|
5813
|
+
function escapeLiteralCheckValue2(literal, refs) {
|
|
5814
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
|
|
7087
5815
|
}
|
|
7088
|
-
var
|
|
5816
|
+
var ALPHA_NUMERIC2 = new Set(
|
|
7089
5817
|
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
7090
5818
|
);
|
|
7091
|
-
function
|
|
5819
|
+
function escapeNonAlphaNumeric2(source) {
|
|
7092
5820
|
let result = "";
|
|
7093
5821
|
for (let i = 0; i < source.length; i++) {
|
|
7094
|
-
if (!
|
|
5822
|
+
if (!ALPHA_NUMERIC2.has(source[i])) {
|
|
7095
5823
|
result += "\\";
|
|
7096
5824
|
}
|
|
7097
5825
|
result += source[i];
|
|
7098
5826
|
}
|
|
7099
5827
|
return result;
|
|
7100
5828
|
}
|
|
7101
|
-
function
|
|
5829
|
+
function addFormat2(schema, value, message, refs) {
|
|
7102
5830
|
var _a26;
|
|
7103
5831
|
if (schema.format || ((_a26 = schema.anyOf) == null ? void 0 : _a26.some((x) => x.format))) {
|
|
7104
5832
|
if (!schema.anyOf) {
|
|
@@ -7118,7 +5846,7 @@ function addFormat3(schema, value, message, refs) {
|
|
|
7118
5846
|
schema.format = value;
|
|
7119
5847
|
}
|
|
7120
5848
|
}
|
|
7121
|
-
function
|
|
5849
|
+
function addPattern2(schema, regex, message, refs) {
|
|
7122
5850
|
var _a26;
|
|
7123
5851
|
if (schema.pattern || ((_a26 = schema.allOf) == null ? void 0 : _a26.some((x) => x.pattern))) {
|
|
7124
5852
|
if (!schema.allOf) {
|
|
@@ -7131,14 +5859,14 @@ function addPattern3(schema, regex, message, refs) {
|
|
|
7131
5859
|
delete schema.pattern;
|
|
7132
5860
|
}
|
|
7133
5861
|
schema.allOf.push({
|
|
7134
|
-
pattern:
|
|
5862
|
+
pattern: stringifyRegExpWithFlags2(regex, refs),
|
|
7135
5863
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
7136
5864
|
});
|
|
7137
5865
|
} else {
|
|
7138
|
-
schema.pattern =
|
|
5866
|
+
schema.pattern = stringifyRegExpWithFlags2(regex, refs);
|
|
7139
5867
|
}
|
|
7140
5868
|
}
|
|
7141
|
-
function
|
|
5869
|
+
function stringifyRegExpWithFlags2(regex, refs) {
|
|
7142
5870
|
var _a26;
|
|
7143
5871
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
7144
5872
|
return regex.source;
|
|
@@ -7210,17 +5938,17 @@ function stringifyRegExpWithFlags3(regex, refs) {
|
|
|
7210
5938
|
}
|
|
7211
5939
|
return pattern;
|
|
7212
5940
|
}
|
|
7213
|
-
function
|
|
5941
|
+
function parseRecordDef2(def, refs) {
|
|
7214
5942
|
var _a26, _b8, _c, _d, _e, _f;
|
|
7215
5943
|
const schema = {
|
|
7216
5944
|
type: "object",
|
|
7217
|
-
additionalProperties: (_a26 =
|
|
5945
|
+
additionalProperties: (_a26 = parseDef2(def.valueType._def, {
|
|
7218
5946
|
...refs,
|
|
7219
5947
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
7220
5948
|
})) != null ? _a26 : refs.allowedAdditionalProperties
|
|
7221
5949
|
};
|
|
7222
5950
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
7223
|
-
const { type, ...keyType } =
|
|
5951
|
+
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
7224
5952
|
return {
|
|
7225
5953
|
...schema,
|
|
7226
5954
|
propertyNames: keyType
|
|
@@ -7233,7 +5961,7 @@ function parseRecordDef3(def, refs) {
|
|
|
7233
5961
|
}
|
|
7234
5962
|
};
|
|
7235
5963
|
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
7236
|
-
const { type, ...keyType } =
|
|
5964
|
+
const { type, ...keyType } = parseBrandedDef2(
|
|
7237
5965
|
def.keyType._def,
|
|
7238
5966
|
refs
|
|
7239
5967
|
);
|
|
@@ -7244,18 +5972,18 @@ function parseRecordDef3(def, refs) {
|
|
|
7244
5972
|
}
|
|
7245
5973
|
return schema;
|
|
7246
5974
|
}
|
|
7247
|
-
function
|
|
5975
|
+
function parseMapDef2(def, refs) {
|
|
7248
5976
|
if (refs.mapStrategy === "record") {
|
|
7249
|
-
return
|
|
5977
|
+
return parseRecordDef2(def, refs);
|
|
7250
5978
|
}
|
|
7251
|
-
const keys =
|
|
5979
|
+
const keys = parseDef2(def.keyType._def, {
|
|
7252
5980
|
...refs,
|
|
7253
5981
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
7254
|
-
}) ||
|
|
7255
|
-
const values =
|
|
5982
|
+
}) || parseAnyDef2();
|
|
5983
|
+
const values = parseDef2(def.valueType._def, {
|
|
7256
5984
|
...refs,
|
|
7257
5985
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
7258
|
-
}) ||
|
|
5986
|
+
}) || parseAnyDef2();
|
|
7259
5987
|
return {
|
|
7260
5988
|
type: "array",
|
|
7261
5989
|
maxItems: 125,
|
|
@@ -7267,7 +5995,7 @@ function parseMapDef3(def, refs) {
|
|
|
7267
5995
|
}
|
|
7268
5996
|
};
|
|
7269
5997
|
}
|
|
7270
|
-
function
|
|
5998
|
+
function parseNativeEnumDef2(def) {
|
|
7271
5999
|
const object5 = def.values;
|
|
7272
6000
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
7273
6001
|
return typeof object5[object5[key]] !== "number";
|
|
@@ -7281,28 +6009,28 @@ function parseNativeEnumDef3(def) {
|
|
|
7281
6009
|
enum: actualValues
|
|
7282
6010
|
};
|
|
7283
6011
|
}
|
|
7284
|
-
function
|
|
7285
|
-
return { not:
|
|
6012
|
+
function parseNeverDef2() {
|
|
6013
|
+
return { not: parseAnyDef2() };
|
|
7286
6014
|
}
|
|
7287
|
-
function
|
|
6015
|
+
function parseNullDef2() {
|
|
7288
6016
|
return {
|
|
7289
6017
|
type: "null"
|
|
7290
6018
|
};
|
|
7291
6019
|
}
|
|
7292
|
-
var
|
|
6020
|
+
var primitiveMappings2 = {
|
|
7293
6021
|
ZodString: "string",
|
|
7294
6022
|
ZodNumber: "number",
|
|
7295
6023
|
ZodBigInt: "integer",
|
|
7296
6024
|
ZodBoolean: "boolean",
|
|
7297
6025
|
ZodNull: "null"
|
|
7298
6026
|
};
|
|
7299
|
-
function
|
|
6027
|
+
function parseUnionDef2(def, refs) {
|
|
7300
6028
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
7301
6029
|
if (options.every(
|
|
7302
|
-
(x) => x._def.typeName in
|
|
6030
|
+
(x) => x._def.typeName in primitiveMappings2 && (!x._def.checks || !x._def.checks.length)
|
|
7303
6031
|
)) {
|
|
7304
6032
|
const types = options.reduce((types2, x) => {
|
|
7305
|
-
const type =
|
|
6033
|
+
const type = primitiveMappings2[x._def.typeName];
|
|
7306
6034
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
7307
6035
|
}, []);
|
|
7308
6036
|
return {
|
|
@@ -7355,11 +6083,11 @@ function parseUnionDef3(def, refs) {
|
|
|
7355
6083
|
)
|
|
7356
6084
|
};
|
|
7357
6085
|
}
|
|
7358
|
-
return
|
|
6086
|
+
return asAnyOf2(def, refs);
|
|
7359
6087
|
}
|
|
7360
|
-
var
|
|
6088
|
+
var asAnyOf2 = (def, refs) => {
|
|
7361
6089
|
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
7362
|
-
(x, i) =>
|
|
6090
|
+
(x, i) => parseDef2(x._def, {
|
|
7363
6091
|
...refs,
|
|
7364
6092
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
7365
6093
|
})
|
|
@@ -7368,24 +6096,24 @@ var asAnyOf3 = (def, refs) => {
|
|
|
7368
6096
|
);
|
|
7369
6097
|
return anyOf.length ? { anyOf } : void 0;
|
|
7370
6098
|
};
|
|
7371
|
-
function
|
|
6099
|
+
function parseNullableDef2(def, refs) {
|
|
7372
6100
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
7373
6101
|
def.innerType._def.typeName
|
|
7374
6102
|
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
7375
6103
|
return {
|
|
7376
6104
|
type: [
|
|
7377
|
-
|
|
6105
|
+
primitiveMappings2[def.innerType._def.typeName],
|
|
7378
6106
|
"null"
|
|
7379
6107
|
]
|
|
7380
6108
|
};
|
|
7381
6109
|
}
|
|
7382
|
-
const base =
|
|
6110
|
+
const base = parseDef2(def.innerType._def, {
|
|
7383
6111
|
...refs,
|
|
7384
6112
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
7385
6113
|
});
|
|
7386
6114
|
return base && { anyOf: [base, { type: "null" }] };
|
|
7387
6115
|
}
|
|
7388
|
-
function
|
|
6116
|
+
function parseNumberDef2(def) {
|
|
7389
6117
|
const res = {
|
|
7390
6118
|
type: "number"
|
|
7391
6119
|
};
|
|
@@ -7417,7 +6145,7 @@ function parseNumberDef3(def) {
|
|
|
7417
6145
|
}
|
|
7418
6146
|
return res;
|
|
7419
6147
|
}
|
|
7420
|
-
function
|
|
6148
|
+
function parseObjectDef2(def, refs) {
|
|
7421
6149
|
const result = {
|
|
7422
6150
|
type: "object",
|
|
7423
6151
|
properties: {}
|
|
@@ -7429,8 +6157,8 @@ function parseObjectDef3(def, refs) {
|
|
|
7429
6157
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
7430
6158
|
continue;
|
|
7431
6159
|
}
|
|
7432
|
-
const propOptional =
|
|
7433
|
-
const parsedDef =
|
|
6160
|
+
const propOptional = safeIsOptional2(propDef);
|
|
6161
|
+
const parsedDef = parseDef2(propDef._def, {
|
|
7434
6162
|
...refs,
|
|
7435
6163
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
7436
6164
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -7446,15 +6174,15 @@ function parseObjectDef3(def, refs) {
|
|
|
7446
6174
|
if (required.length) {
|
|
7447
6175
|
result.required = required;
|
|
7448
6176
|
}
|
|
7449
|
-
const additionalProperties =
|
|
6177
|
+
const additionalProperties = decideAdditionalProperties2(def, refs);
|
|
7450
6178
|
if (additionalProperties !== void 0) {
|
|
7451
6179
|
result.additionalProperties = additionalProperties;
|
|
7452
6180
|
}
|
|
7453
6181
|
return result;
|
|
7454
6182
|
}
|
|
7455
|
-
function
|
|
6183
|
+
function decideAdditionalProperties2(def, refs) {
|
|
7456
6184
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
7457
|
-
return
|
|
6185
|
+
return parseDef2(def.catchall._def, {
|
|
7458
6186
|
...refs,
|
|
7459
6187
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
7460
6188
|
});
|
|
@@ -7468,35 +6196,35 @@ function decideAdditionalProperties3(def, refs) {
|
|
|
7468
6196
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
7469
6197
|
}
|
|
7470
6198
|
}
|
|
7471
|
-
function
|
|
6199
|
+
function safeIsOptional2(schema) {
|
|
7472
6200
|
try {
|
|
7473
6201
|
return schema.isOptional();
|
|
7474
6202
|
} catch (e2) {
|
|
7475
6203
|
return true;
|
|
7476
6204
|
}
|
|
7477
6205
|
}
|
|
7478
|
-
var
|
|
6206
|
+
var parseOptionalDef2 = (def, refs) => {
|
|
7479
6207
|
var _a26;
|
|
7480
6208
|
if (refs.currentPath.toString() === ((_a26 = refs.propertyPath) == null ? void 0 : _a26.toString())) {
|
|
7481
|
-
return
|
|
6209
|
+
return parseDef2(def.innerType._def, refs);
|
|
7482
6210
|
}
|
|
7483
|
-
const innerSchema =
|
|
6211
|
+
const innerSchema = parseDef2(def.innerType._def, {
|
|
7484
6212
|
...refs,
|
|
7485
6213
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
7486
6214
|
});
|
|
7487
|
-
return innerSchema ? { anyOf: [{ not:
|
|
6215
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef2() }, innerSchema] } : parseAnyDef2();
|
|
7488
6216
|
};
|
|
7489
|
-
var
|
|
6217
|
+
var parsePipelineDef2 = (def, refs) => {
|
|
7490
6218
|
if (refs.pipeStrategy === "input") {
|
|
7491
|
-
return
|
|
6219
|
+
return parseDef2(def.in._def, refs);
|
|
7492
6220
|
} else if (refs.pipeStrategy === "output") {
|
|
7493
|
-
return
|
|
6221
|
+
return parseDef2(def.out._def, refs);
|
|
7494
6222
|
}
|
|
7495
|
-
const a =
|
|
6223
|
+
const a = parseDef2(def.in._def, {
|
|
7496
6224
|
...refs,
|
|
7497
6225
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
7498
6226
|
});
|
|
7499
|
-
const b =
|
|
6227
|
+
const b = parseDef2(def.out._def, {
|
|
7500
6228
|
...refs,
|
|
7501
6229
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
7502
6230
|
});
|
|
@@ -7504,11 +6232,11 @@ var parsePipelineDef3 = (def, refs) => {
|
|
|
7504
6232
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
7505
6233
|
};
|
|
7506
6234
|
};
|
|
7507
|
-
function
|
|
7508
|
-
return
|
|
6235
|
+
function parsePromiseDef2(def, refs) {
|
|
6236
|
+
return parseDef2(def.type._def, refs);
|
|
7509
6237
|
}
|
|
7510
|
-
function
|
|
7511
|
-
const items =
|
|
6238
|
+
function parseSetDef2(def, refs) {
|
|
6239
|
+
const items = parseDef2(def.valueType._def, {
|
|
7512
6240
|
...refs,
|
|
7513
6241
|
currentPath: [...refs.currentPath, "items"]
|
|
7514
6242
|
});
|
|
@@ -7525,13 +6253,13 @@ function parseSetDef3(def, refs) {
|
|
|
7525
6253
|
}
|
|
7526
6254
|
return schema;
|
|
7527
6255
|
}
|
|
7528
|
-
function
|
|
6256
|
+
function parseTupleDef2(def, refs) {
|
|
7529
6257
|
if (def.rest) {
|
|
7530
6258
|
return {
|
|
7531
6259
|
type: "array",
|
|
7532
6260
|
minItems: def.items.length,
|
|
7533
6261
|
items: def.items.map(
|
|
7534
|
-
(x, i) =>
|
|
6262
|
+
(x, i) => parseDef2(x._def, {
|
|
7535
6263
|
...refs,
|
|
7536
6264
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
7537
6265
|
})
|
|
@@ -7539,7 +6267,7 @@ function parseTupleDef3(def, refs) {
|
|
|
7539
6267
|
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
7540
6268
|
[]
|
|
7541
6269
|
),
|
|
7542
|
-
additionalItems:
|
|
6270
|
+
additionalItems: parseDef2(def.rest._def, {
|
|
7543
6271
|
...refs,
|
|
7544
6272
|
currentPath: [...refs.currentPath, "additionalItems"]
|
|
7545
6273
|
})
|
|
@@ -7550,7 +6278,7 @@ function parseTupleDef3(def, refs) {
|
|
|
7550
6278
|
minItems: def.items.length,
|
|
7551
6279
|
maxItems: def.items.length,
|
|
7552
6280
|
items: def.items.map(
|
|
7553
|
-
(x, i) =>
|
|
6281
|
+
(x, i) => parseDef2(x._def, {
|
|
7554
6282
|
...refs,
|
|
7555
6283
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
7556
6284
|
})
|
|
@@ -7561,83 +6289,83 @@ function parseTupleDef3(def, refs) {
|
|
|
7561
6289
|
};
|
|
7562
6290
|
}
|
|
7563
6291
|
}
|
|
7564
|
-
function
|
|
6292
|
+
function parseUndefinedDef2() {
|
|
7565
6293
|
return {
|
|
7566
|
-
not:
|
|
6294
|
+
not: parseAnyDef2()
|
|
7567
6295
|
};
|
|
7568
6296
|
}
|
|
7569
|
-
function
|
|
7570
|
-
return
|
|
6297
|
+
function parseUnknownDef2() {
|
|
6298
|
+
return parseAnyDef2();
|
|
7571
6299
|
}
|
|
7572
|
-
var
|
|
7573
|
-
return
|
|
6300
|
+
var parseReadonlyDef2 = (def, refs) => {
|
|
6301
|
+
return parseDef2(def.innerType._def, refs);
|
|
7574
6302
|
};
|
|
7575
|
-
var
|
|
6303
|
+
var selectParser2 = (def, typeName, refs) => {
|
|
7576
6304
|
switch (typeName) {
|
|
7577
6305
|
case v3.ZodFirstPartyTypeKind.ZodString:
|
|
7578
|
-
return
|
|
6306
|
+
return parseStringDef2(def, refs);
|
|
7579
6307
|
case v3.ZodFirstPartyTypeKind.ZodNumber:
|
|
7580
|
-
return
|
|
6308
|
+
return parseNumberDef2(def);
|
|
7581
6309
|
case v3.ZodFirstPartyTypeKind.ZodObject:
|
|
7582
|
-
return
|
|
6310
|
+
return parseObjectDef2(def, refs);
|
|
7583
6311
|
case v3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
7584
|
-
return
|
|
6312
|
+
return parseBigintDef2(def);
|
|
7585
6313
|
case v3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
7586
|
-
return
|
|
6314
|
+
return parseBooleanDef2();
|
|
7587
6315
|
case v3.ZodFirstPartyTypeKind.ZodDate:
|
|
7588
|
-
return
|
|
6316
|
+
return parseDateDef2(def, refs);
|
|
7589
6317
|
case v3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
7590
|
-
return
|
|
6318
|
+
return parseUndefinedDef2();
|
|
7591
6319
|
case v3.ZodFirstPartyTypeKind.ZodNull:
|
|
7592
|
-
return
|
|
6320
|
+
return parseNullDef2();
|
|
7593
6321
|
case v3.ZodFirstPartyTypeKind.ZodArray:
|
|
7594
|
-
return
|
|
6322
|
+
return parseArrayDef2(def, refs);
|
|
7595
6323
|
case v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
7596
6324
|
case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
7597
|
-
return
|
|
6325
|
+
return parseUnionDef2(def, refs);
|
|
7598
6326
|
case v3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
7599
|
-
return
|
|
6327
|
+
return parseIntersectionDef2(def, refs);
|
|
7600
6328
|
case v3.ZodFirstPartyTypeKind.ZodTuple:
|
|
7601
|
-
return
|
|
6329
|
+
return parseTupleDef2(def, refs);
|
|
7602
6330
|
case v3.ZodFirstPartyTypeKind.ZodRecord:
|
|
7603
|
-
return
|
|
6331
|
+
return parseRecordDef2(def, refs);
|
|
7604
6332
|
case v3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
7605
|
-
return
|
|
6333
|
+
return parseLiteralDef2(def);
|
|
7606
6334
|
case v3.ZodFirstPartyTypeKind.ZodEnum:
|
|
7607
|
-
return
|
|
6335
|
+
return parseEnumDef2(def);
|
|
7608
6336
|
case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
7609
|
-
return
|
|
6337
|
+
return parseNativeEnumDef2(def);
|
|
7610
6338
|
case v3.ZodFirstPartyTypeKind.ZodNullable:
|
|
7611
|
-
return
|
|
6339
|
+
return parseNullableDef2(def, refs);
|
|
7612
6340
|
case v3.ZodFirstPartyTypeKind.ZodOptional:
|
|
7613
|
-
return
|
|
6341
|
+
return parseOptionalDef2(def, refs);
|
|
7614
6342
|
case v3.ZodFirstPartyTypeKind.ZodMap:
|
|
7615
|
-
return
|
|
6343
|
+
return parseMapDef2(def, refs);
|
|
7616
6344
|
case v3.ZodFirstPartyTypeKind.ZodSet:
|
|
7617
|
-
return
|
|
6345
|
+
return parseSetDef2(def, refs);
|
|
7618
6346
|
case v3.ZodFirstPartyTypeKind.ZodLazy:
|
|
7619
6347
|
return () => def.getter()._def;
|
|
7620
6348
|
case v3.ZodFirstPartyTypeKind.ZodPromise:
|
|
7621
|
-
return
|
|
6349
|
+
return parsePromiseDef2(def, refs);
|
|
7622
6350
|
case v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
7623
6351
|
case v3.ZodFirstPartyTypeKind.ZodNever:
|
|
7624
|
-
return
|
|
6352
|
+
return parseNeverDef2();
|
|
7625
6353
|
case v3.ZodFirstPartyTypeKind.ZodEffects:
|
|
7626
|
-
return
|
|
6354
|
+
return parseEffectsDef2(def, refs);
|
|
7627
6355
|
case v3.ZodFirstPartyTypeKind.ZodAny:
|
|
7628
|
-
return
|
|
6356
|
+
return parseAnyDef2();
|
|
7629
6357
|
case v3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
7630
|
-
return
|
|
6358
|
+
return parseUnknownDef2();
|
|
7631
6359
|
case v3.ZodFirstPartyTypeKind.ZodDefault:
|
|
7632
|
-
return
|
|
6360
|
+
return parseDefaultDef2(def, refs);
|
|
7633
6361
|
case v3.ZodFirstPartyTypeKind.ZodBranded:
|
|
7634
|
-
return
|
|
6362
|
+
return parseBrandedDef2(def, refs);
|
|
7635
6363
|
case v3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
7636
|
-
return
|
|
6364
|
+
return parseReadonlyDef2(def, refs);
|
|
7637
6365
|
case v3.ZodFirstPartyTypeKind.ZodCatch:
|
|
7638
|
-
return
|
|
6366
|
+
return parseCatchDef2(def, refs);
|
|
7639
6367
|
case v3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
7640
|
-
return
|
|
6368
|
+
return parsePipelineDef2(def, refs);
|
|
7641
6369
|
case v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
7642
6370
|
case v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
7643
6371
|
case v3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
@@ -7646,7 +6374,7 @@ var selectParser3 = (def, typeName, refs) => {
|
|
|
7646
6374
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
7647
6375
|
}
|
|
7648
6376
|
};
|
|
7649
|
-
function
|
|
6377
|
+
function parseDef2(def, refs, forceResolution = false) {
|
|
7650
6378
|
var _a26;
|
|
7651
6379
|
const seenItem = refs.seen.get(def);
|
|
7652
6380
|
if (refs.override) {
|
|
@@ -7657,22 +6385,22 @@ function parseDef3(def, refs, forceResolution = false) {
|
|
|
7657
6385
|
seenItem,
|
|
7658
6386
|
forceResolution
|
|
7659
6387
|
);
|
|
7660
|
-
if (overrideResult !==
|
|
6388
|
+
if (overrideResult !== ignoreOverride2) {
|
|
7661
6389
|
return overrideResult;
|
|
7662
6390
|
}
|
|
7663
6391
|
}
|
|
7664
6392
|
if (seenItem && !forceResolution) {
|
|
7665
|
-
const seenSchema = get$
|
|
6393
|
+
const seenSchema = get$ref2(seenItem, refs);
|
|
7666
6394
|
if (seenSchema !== void 0) {
|
|
7667
6395
|
return seenSchema;
|
|
7668
6396
|
}
|
|
7669
6397
|
}
|
|
7670
6398
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
7671
6399
|
refs.seen.set(def, newItem);
|
|
7672
|
-
const jsonSchemaOrGetter =
|
|
7673
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
6400
|
+
const jsonSchemaOrGetter = selectParser2(def, def.typeName, refs);
|
|
6401
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef2(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
7674
6402
|
if (jsonSchema22) {
|
|
7675
|
-
|
|
6403
|
+
addMeta2(def, refs, jsonSchema22);
|
|
7676
6404
|
}
|
|
7677
6405
|
if (refs.postProcess) {
|
|
7678
6406
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -7682,12 +6410,12 @@ function parseDef3(def, refs, forceResolution = false) {
|
|
|
7682
6410
|
newItem.jsonSchema = jsonSchema22;
|
|
7683
6411
|
return jsonSchema22;
|
|
7684
6412
|
}
|
|
7685
|
-
var get$
|
|
6413
|
+
var get$ref2 = (item, refs) => {
|
|
7686
6414
|
switch (refs.$refStrategy) {
|
|
7687
6415
|
case "root":
|
|
7688
6416
|
return { $ref: item.path.join("/") };
|
|
7689
6417
|
case "relative":
|
|
7690
|
-
return { $ref:
|
|
6418
|
+
return { $ref: getRelativePath2(refs.currentPath, item.path) };
|
|
7691
6419
|
case "none":
|
|
7692
6420
|
case "seen": {
|
|
7693
6421
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
@@ -7696,20 +6424,20 @@ var get$ref3 = (item, refs) => {
|
|
|
7696
6424
|
"/"
|
|
7697
6425
|
)}! Defaulting to any`
|
|
7698
6426
|
);
|
|
7699
|
-
return
|
|
6427
|
+
return parseAnyDef2();
|
|
7700
6428
|
}
|
|
7701
|
-
return refs.$refStrategy === "seen" ?
|
|
6429
|
+
return refs.$refStrategy === "seen" ? parseAnyDef2() : void 0;
|
|
7702
6430
|
}
|
|
7703
6431
|
}
|
|
7704
6432
|
};
|
|
7705
|
-
var
|
|
6433
|
+
var addMeta2 = (def, refs, jsonSchema22) => {
|
|
7706
6434
|
if (def.description) {
|
|
7707
6435
|
jsonSchema22.description = def.description;
|
|
7708
6436
|
}
|
|
7709
6437
|
return jsonSchema22;
|
|
7710
6438
|
};
|
|
7711
|
-
var
|
|
7712
|
-
const _options =
|
|
6439
|
+
var getRefs2 = (options) => {
|
|
6440
|
+
const _options = getDefaultOptions2(options);
|
|
7713
6441
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
7714
6442
|
return {
|
|
7715
6443
|
..._options,
|
|
@@ -7728,35 +6456,35 @@ var getRefs3 = (options) => {
|
|
|
7728
6456
|
)
|
|
7729
6457
|
};
|
|
7730
6458
|
};
|
|
7731
|
-
var
|
|
6459
|
+
var zodToJsonSchema3 = (schema, options) => {
|
|
7732
6460
|
var _a26;
|
|
7733
|
-
const refs =
|
|
6461
|
+
const refs = getRefs2(options);
|
|
7734
6462
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
7735
6463
|
(acc, [name26, schema2]) => {
|
|
7736
6464
|
var _a27;
|
|
7737
6465
|
return {
|
|
7738
6466
|
...acc,
|
|
7739
|
-
[name26]: (_a27 =
|
|
6467
|
+
[name26]: (_a27 = parseDef2(
|
|
7740
6468
|
schema2._def,
|
|
7741
6469
|
{
|
|
7742
6470
|
...refs,
|
|
7743
6471
|
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
7744
6472
|
},
|
|
7745
6473
|
true
|
|
7746
|
-
)) != null ? _a27 :
|
|
6474
|
+
)) != null ? _a27 : parseAnyDef2()
|
|
7747
6475
|
};
|
|
7748
6476
|
},
|
|
7749
6477
|
{}
|
|
7750
6478
|
) : void 0;
|
|
7751
6479
|
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
7752
|
-
const main = (_a26 =
|
|
6480
|
+
const main = (_a26 = parseDef2(
|
|
7753
6481
|
schema._def,
|
|
7754
6482
|
name21 === void 0 ? refs : {
|
|
7755
6483
|
...refs,
|
|
7756
6484
|
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
7757
6485
|
},
|
|
7758
6486
|
false
|
|
7759
|
-
)) != null ? _a26 :
|
|
6487
|
+
)) != null ? _a26 : parseAnyDef2();
|
|
7760
6488
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
7761
6489
|
if (title !== void 0) {
|
|
7762
6490
|
main.title = title;
|
|
@@ -7778,7 +6506,7 @@ var zodToJsonSchema4 = (schema, options) => {
|
|
|
7778
6506
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
7779
6507
|
return combined;
|
|
7780
6508
|
};
|
|
7781
|
-
var zod_to_json_schema_default =
|
|
6509
|
+
var zod_to_json_schema_default = zodToJsonSchema3;
|
|
7782
6510
|
function zod3Schema(zodSchema22, options) {
|
|
7783
6511
|
var _a26;
|
|
7784
6512
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
@@ -11772,8 +10500,8 @@ function safeParseJSON3({
|
|
|
11772
10500
|
};
|
|
11773
10501
|
}
|
|
11774
10502
|
}
|
|
11775
|
-
var
|
|
11776
|
-
var
|
|
10503
|
+
var ignoreOverride3 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
10504
|
+
var defaultOptions3 = {
|
|
11777
10505
|
name: void 0,
|
|
11778
10506
|
$refStrategy: "root",
|
|
11779
10507
|
basePath: ["#"],
|
|
@@ -11797,15 +10525,15 @@ var defaultOptions4 = {
|
|
|
11797
10525
|
nameStrategy: "ref",
|
|
11798
10526
|
openAiAnyTypeName: "OpenAiAnyType"
|
|
11799
10527
|
};
|
|
11800
|
-
var
|
|
11801
|
-
...
|
|
10528
|
+
var getDefaultOptions3 = (options) => typeof options === "string" ? {
|
|
10529
|
+
...defaultOptions3,
|
|
11802
10530
|
name: options
|
|
11803
10531
|
} : {
|
|
11804
|
-
...
|
|
10532
|
+
...defaultOptions3,
|
|
11805
10533
|
...options
|
|
11806
10534
|
};
|
|
11807
|
-
var
|
|
11808
|
-
const _options =
|
|
10535
|
+
var getRefs3 = (options) => {
|
|
10536
|
+
const _options = getDefaultOptions3(options);
|
|
11809
10537
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
11810
10538
|
return {
|
|
11811
10539
|
..._options,
|
|
@@ -11823,7 +10551,7 @@ var getRefs4 = (options) => {
|
|
|
11823
10551
|
]))
|
|
11824
10552
|
};
|
|
11825
10553
|
};
|
|
11826
|
-
function
|
|
10554
|
+
function addErrorMessage2(res, key, errorMessage, refs) {
|
|
11827
10555
|
if (!refs?.errorMessages)
|
|
11828
10556
|
return;
|
|
11829
10557
|
if (errorMessage) {
|
|
@@ -11833,11 +10561,11 @@ function addErrorMessage3(res, key, errorMessage, refs) {
|
|
|
11833
10561
|
};
|
|
11834
10562
|
}
|
|
11835
10563
|
}
|
|
11836
|
-
function
|
|
10564
|
+
function setResponseValueAndErrors2(res, key, value, errorMessage, refs) {
|
|
11837
10565
|
res[key] = value;
|
|
11838
|
-
|
|
10566
|
+
addErrorMessage2(res, key, errorMessage, refs);
|
|
11839
10567
|
}
|
|
11840
|
-
var
|
|
10568
|
+
var getRelativePath3 = (pathA, pathB) => {
|
|
11841
10569
|
let i = 0;
|
|
11842
10570
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
11843
10571
|
if (pathA[i] !== pathB[i])
|
|
@@ -11845,7 +10573,7 @@ var getRelativePath4 = (pathA, pathB) => {
|
|
|
11845
10573
|
}
|
|
11846
10574
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
11847
10575
|
};
|
|
11848
|
-
function
|
|
10576
|
+
function parseAnyDef3(refs) {
|
|
11849
10577
|
if (refs.target !== "openAi") {
|
|
11850
10578
|
return {};
|
|
11851
10579
|
}
|
|
@@ -11856,32 +10584,32 @@ function parseAnyDef4(refs) {
|
|
|
11856
10584
|
];
|
|
11857
10585
|
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
11858
10586
|
return {
|
|
11859
|
-
$ref: refs.$refStrategy === "relative" ?
|
|
10587
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath3(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
11860
10588
|
};
|
|
11861
10589
|
}
|
|
11862
|
-
function
|
|
10590
|
+
function parseArrayDef3(def, refs) {
|
|
11863
10591
|
const res = {
|
|
11864
10592
|
type: "array"
|
|
11865
10593
|
};
|
|
11866
|
-
if (def.type?._def && def.type?._def?.typeName !==
|
|
11867
|
-
res.items =
|
|
10594
|
+
if (def.type?._def && def.type?._def?.typeName !== z19.ZodFirstPartyTypeKind.ZodAny) {
|
|
10595
|
+
res.items = parseDef3(def.type._def, {
|
|
11868
10596
|
...refs,
|
|
11869
10597
|
currentPath: [...refs.currentPath, "items"]
|
|
11870
10598
|
});
|
|
11871
10599
|
}
|
|
11872
10600
|
if (def.minLength) {
|
|
11873
|
-
|
|
10601
|
+
setResponseValueAndErrors2(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
11874
10602
|
}
|
|
11875
10603
|
if (def.maxLength) {
|
|
11876
|
-
|
|
10604
|
+
setResponseValueAndErrors2(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
11877
10605
|
}
|
|
11878
10606
|
if (def.exactLength) {
|
|
11879
|
-
|
|
11880
|
-
|
|
10607
|
+
setResponseValueAndErrors2(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
10608
|
+
setResponseValueAndErrors2(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
11881
10609
|
}
|
|
11882
10610
|
return res;
|
|
11883
10611
|
}
|
|
11884
|
-
function
|
|
10612
|
+
function parseBigintDef3(def, refs) {
|
|
11885
10613
|
const res = {
|
|
11886
10614
|
type: "integer",
|
|
11887
10615
|
format: "int64"
|
|
@@ -11893,54 +10621,54 @@ function parseBigintDef4(def, refs) {
|
|
|
11893
10621
|
case "min":
|
|
11894
10622
|
if (refs.target === "jsonSchema7") {
|
|
11895
10623
|
if (check.inclusive) {
|
|
11896
|
-
|
|
10624
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
11897
10625
|
} else {
|
|
11898
|
-
|
|
10626
|
+
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
11899
10627
|
}
|
|
11900
10628
|
} else {
|
|
11901
10629
|
if (!check.inclusive) {
|
|
11902
10630
|
res.exclusiveMinimum = true;
|
|
11903
10631
|
}
|
|
11904
|
-
|
|
10632
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
11905
10633
|
}
|
|
11906
10634
|
break;
|
|
11907
10635
|
case "max":
|
|
11908
10636
|
if (refs.target === "jsonSchema7") {
|
|
11909
10637
|
if (check.inclusive) {
|
|
11910
|
-
|
|
10638
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
11911
10639
|
} else {
|
|
11912
|
-
|
|
10640
|
+
setResponseValueAndErrors2(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
11913
10641
|
}
|
|
11914
10642
|
} else {
|
|
11915
10643
|
if (!check.inclusive) {
|
|
11916
10644
|
res.exclusiveMaximum = true;
|
|
11917
10645
|
}
|
|
11918
|
-
|
|
10646
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
11919
10647
|
}
|
|
11920
10648
|
break;
|
|
11921
10649
|
case "multipleOf":
|
|
11922
|
-
|
|
10650
|
+
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
11923
10651
|
break;
|
|
11924
10652
|
}
|
|
11925
10653
|
}
|
|
11926
10654
|
return res;
|
|
11927
10655
|
}
|
|
11928
|
-
function
|
|
10656
|
+
function parseBooleanDef3() {
|
|
11929
10657
|
return {
|
|
11930
10658
|
type: "boolean"
|
|
11931
10659
|
};
|
|
11932
10660
|
}
|
|
11933
|
-
function
|
|
11934
|
-
return
|
|
10661
|
+
function parseBrandedDef3(_def, refs) {
|
|
10662
|
+
return parseDef3(_def.type._def, refs);
|
|
11935
10663
|
}
|
|
11936
|
-
var
|
|
11937
|
-
return
|
|
10664
|
+
var parseCatchDef3 = (def, refs) => {
|
|
10665
|
+
return parseDef3(def.innerType._def, refs);
|
|
11938
10666
|
};
|
|
11939
|
-
function
|
|
10667
|
+
function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
11940
10668
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
11941
10669
|
if (Array.isArray(strategy)) {
|
|
11942
10670
|
return {
|
|
11943
|
-
anyOf: strategy.map((item, i) =>
|
|
10671
|
+
anyOf: strategy.map((item, i) => parseDateDef3(def, refs, item))
|
|
11944
10672
|
};
|
|
11945
10673
|
}
|
|
11946
10674
|
switch (strategy) {
|
|
@@ -11956,10 +10684,10 @@ function parseDateDef4(def, refs, overrideDateStrategy) {
|
|
|
11956
10684
|
format: "date"
|
|
11957
10685
|
};
|
|
11958
10686
|
case "integer":
|
|
11959
|
-
return
|
|
10687
|
+
return integerDateParser3(def, refs);
|
|
11960
10688
|
}
|
|
11961
10689
|
}
|
|
11962
|
-
var
|
|
10690
|
+
var integerDateParser3 = (def, refs) => {
|
|
11963
10691
|
const res = {
|
|
11964
10692
|
type: "integer",
|
|
11965
10693
|
format: "unix-time"
|
|
@@ -11970,7 +10698,7 @@ var integerDateParser4 = (def, refs) => {
|
|
|
11970
10698
|
for (const check of def.checks) {
|
|
11971
10699
|
switch (check.kind) {
|
|
11972
10700
|
case "min":
|
|
11973
|
-
|
|
10701
|
+
setResponseValueAndErrors2(
|
|
11974
10702
|
res,
|
|
11975
10703
|
"minimum",
|
|
11976
10704
|
check.value,
|
|
@@ -11980,7 +10708,7 @@ var integerDateParser4 = (def, refs) => {
|
|
|
11980
10708
|
);
|
|
11981
10709
|
break;
|
|
11982
10710
|
case "max":
|
|
11983
|
-
|
|
10711
|
+
setResponseValueAndErrors2(
|
|
11984
10712
|
res,
|
|
11985
10713
|
"maximum",
|
|
11986
10714
|
check.value,
|
|
@@ -11993,33 +10721,33 @@ var integerDateParser4 = (def, refs) => {
|
|
|
11993
10721
|
}
|
|
11994
10722
|
return res;
|
|
11995
10723
|
};
|
|
11996
|
-
function
|
|
10724
|
+
function parseDefaultDef3(_def, refs) {
|
|
11997
10725
|
return {
|
|
11998
|
-
...
|
|
10726
|
+
...parseDef3(_def.innerType._def, refs),
|
|
11999
10727
|
default: _def.defaultValue()
|
|
12000
10728
|
};
|
|
12001
10729
|
}
|
|
12002
|
-
function
|
|
12003
|
-
return refs.effectStrategy === "input" ?
|
|
10730
|
+
function parseEffectsDef3(_def, refs) {
|
|
10731
|
+
return refs.effectStrategy === "input" ? parseDef3(_def.schema._def, refs) : parseAnyDef3(refs);
|
|
12004
10732
|
}
|
|
12005
|
-
function
|
|
10733
|
+
function parseEnumDef3(def) {
|
|
12006
10734
|
return {
|
|
12007
10735
|
type: "string",
|
|
12008
10736
|
enum: Array.from(def.values)
|
|
12009
10737
|
};
|
|
12010
10738
|
}
|
|
12011
|
-
var
|
|
10739
|
+
var isJsonSchema7AllOfType3 = (type) => {
|
|
12012
10740
|
if ("type" in type && type.type === "string")
|
|
12013
10741
|
return false;
|
|
12014
10742
|
return "allOf" in type;
|
|
12015
10743
|
};
|
|
12016
|
-
function
|
|
10744
|
+
function parseIntersectionDef3(def, refs) {
|
|
12017
10745
|
const allOf = [
|
|
12018
|
-
|
|
10746
|
+
parseDef3(def.left._def, {
|
|
12019
10747
|
...refs,
|
|
12020
10748
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
12021
10749
|
}),
|
|
12022
|
-
|
|
10750
|
+
parseDef3(def.right._def, {
|
|
12023
10751
|
...refs,
|
|
12024
10752
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
12025
10753
|
})
|
|
@@ -12027,7 +10755,7 @@ function parseIntersectionDef4(def, refs) {
|
|
|
12027
10755
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
12028
10756
|
const mergedAllOf = [];
|
|
12029
10757
|
allOf.forEach((schema) => {
|
|
12030
|
-
if (
|
|
10758
|
+
if (isJsonSchema7AllOfType3(schema)) {
|
|
12031
10759
|
mergedAllOf.push(...schema.allOf);
|
|
12032
10760
|
if (schema.unevaluatedProperties === void 0) {
|
|
12033
10761
|
unevaluatedProperties = void 0;
|
|
@@ -12048,7 +10776,7 @@ function parseIntersectionDef4(def, refs) {
|
|
|
12048
10776
|
...unevaluatedProperties
|
|
12049
10777
|
} : void 0;
|
|
12050
10778
|
}
|
|
12051
|
-
function
|
|
10779
|
+
function parseLiteralDef3(def, refs) {
|
|
12052
10780
|
const parsedType = typeof def.value;
|
|
12053
10781
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
12054
10782
|
return {
|
|
@@ -12066,8 +10794,8 @@ function parseLiteralDef4(def, refs) {
|
|
|
12066
10794
|
const: def.value
|
|
12067
10795
|
};
|
|
12068
10796
|
}
|
|
12069
|
-
var
|
|
12070
|
-
var
|
|
10797
|
+
var emojiRegex3 = void 0;
|
|
10798
|
+
var zodPatterns3 = {
|
|
12071
10799
|
/**
|
|
12072
10800
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
12073
10801
|
*/
|
|
@@ -12090,10 +10818,10 @@ var zodPatterns4 = {
|
|
|
12090
10818
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
12091
10819
|
*/
|
|
12092
10820
|
emoji: () => {
|
|
12093
|
-
if (
|
|
12094
|
-
|
|
10821
|
+
if (emojiRegex3 === void 0) {
|
|
10822
|
+
emojiRegex3 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
12095
10823
|
}
|
|
12096
|
-
return
|
|
10824
|
+
return emojiRegex3;
|
|
12097
10825
|
},
|
|
12098
10826
|
/**
|
|
12099
10827
|
* Unused
|
|
@@ -12114,7 +10842,7 @@ var zodPatterns4 = {
|
|
|
12114
10842
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
12115
10843
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
12116
10844
|
};
|
|
12117
|
-
function
|
|
10845
|
+
function parseStringDef3(def, refs) {
|
|
12118
10846
|
const res = {
|
|
12119
10847
|
type: "string"
|
|
12120
10848
|
};
|
|
@@ -12122,136 +10850,136 @@ function parseStringDef4(def, refs) {
|
|
|
12122
10850
|
for (const check of def.checks) {
|
|
12123
10851
|
switch (check.kind) {
|
|
12124
10852
|
case "min":
|
|
12125
|
-
|
|
10853
|
+
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
12126
10854
|
break;
|
|
12127
10855
|
case "max":
|
|
12128
|
-
|
|
10856
|
+
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
12129
10857
|
break;
|
|
12130
10858
|
case "email":
|
|
12131
10859
|
switch (refs.emailStrategy) {
|
|
12132
10860
|
case "format:email":
|
|
12133
|
-
|
|
10861
|
+
addFormat3(res, "email", check.message, refs);
|
|
12134
10862
|
break;
|
|
12135
10863
|
case "format:idn-email":
|
|
12136
|
-
|
|
10864
|
+
addFormat3(res, "idn-email", check.message, refs);
|
|
12137
10865
|
break;
|
|
12138
10866
|
case "pattern:zod":
|
|
12139
|
-
|
|
10867
|
+
addPattern3(res, zodPatterns3.email, check.message, refs);
|
|
12140
10868
|
break;
|
|
12141
10869
|
}
|
|
12142
10870
|
break;
|
|
12143
10871
|
case "url":
|
|
12144
|
-
|
|
10872
|
+
addFormat3(res, "uri", check.message, refs);
|
|
12145
10873
|
break;
|
|
12146
10874
|
case "uuid":
|
|
12147
|
-
|
|
10875
|
+
addFormat3(res, "uuid", check.message, refs);
|
|
12148
10876
|
break;
|
|
12149
10877
|
case "regex":
|
|
12150
|
-
|
|
10878
|
+
addPattern3(res, check.regex, check.message, refs);
|
|
12151
10879
|
break;
|
|
12152
10880
|
case "cuid":
|
|
12153
|
-
|
|
10881
|
+
addPattern3(res, zodPatterns3.cuid, check.message, refs);
|
|
12154
10882
|
break;
|
|
12155
10883
|
case "cuid2":
|
|
12156
|
-
|
|
10884
|
+
addPattern3(res, zodPatterns3.cuid2, check.message, refs);
|
|
12157
10885
|
break;
|
|
12158
10886
|
case "startsWith":
|
|
12159
|
-
|
|
10887
|
+
addPattern3(res, RegExp(`^${escapeLiteralCheckValue3(check.value, refs)}`), check.message, refs);
|
|
12160
10888
|
break;
|
|
12161
10889
|
case "endsWith":
|
|
12162
|
-
|
|
10890
|
+
addPattern3(res, RegExp(`${escapeLiteralCheckValue3(check.value, refs)}$`), check.message, refs);
|
|
12163
10891
|
break;
|
|
12164
10892
|
case "datetime":
|
|
12165
|
-
|
|
10893
|
+
addFormat3(res, "date-time", check.message, refs);
|
|
12166
10894
|
break;
|
|
12167
10895
|
case "date":
|
|
12168
|
-
|
|
10896
|
+
addFormat3(res, "date", check.message, refs);
|
|
12169
10897
|
break;
|
|
12170
10898
|
case "time":
|
|
12171
|
-
|
|
10899
|
+
addFormat3(res, "time", check.message, refs);
|
|
12172
10900
|
break;
|
|
12173
10901
|
case "duration":
|
|
12174
|
-
|
|
10902
|
+
addFormat3(res, "duration", check.message, refs);
|
|
12175
10903
|
break;
|
|
12176
10904
|
case "length":
|
|
12177
|
-
|
|
12178
|
-
|
|
10905
|
+
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
10906
|
+
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
12179
10907
|
break;
|
|
12180
10908
|
case "includes": {
|
|
12181
|
-
|
|
10909
|
+
addPattern3(res, RegExp(escapeLiteralCheckValue3(check.value, refs)), check.message, refs);
|
|
12182
10910
|
break;
|
|
12183
10911
|
}
|
|
12184
10912
|
case "ip": {
|
|
12185
10913
|
if (check.version !== "v6") {
|
|
12186
|
-
|
|
10914
|
+
addFormat3(res, "ipv4", check.message, refs);
|
|
12187
10915
|
}
|
|
12188
10916
|
if (check.version !== "v4") {
|
|
12189
|
-
|
|
10917
|
+
addFormat3(res, "ipv6", check.message, refs);
|
|
12190
10918
|
}
|
|
12191
10919
|
break;
|
|
12192
10920
|
}
|
|
12193
10921
|
case "base64url":
|
|
12194
|
-
|
|
10922
|
+
addPattern3(res, zodPatterns3.base64url, check.message, refs);
|
|
12195
10923
|
break;
|
|
12196
10924
|
case "jwt":
|
|
12197
|
-
|
|
10925
|
+
addPattern3(res, zodPatterns3.jwt, check.message, refs);
|
|
12198
10926
|
break;
|
|
12199
10927
|
case "cidr": {
|
|
12200
10928
|
if (check.version !== "v6") {
|
|
12201
|
-
|
|
10929
|
+
addPattern3(res, zodPatterns3.ipv4Cidr, check.message, refs);
|
|
12202
10930
|
}
|
|
12203
10931
|
if (check.version !== "v4") {
|
|
12204
|
-
|
|
10932
|
+
addPattern3(res, zodPatterns3.ipv6Cidr, check.message, refs);
|
|
12205
10933
|
}
|
|
12206
10934
|
break;
|
|
12207
10935
|
}
|
|
12208
10936
|
case "emoji":
|
|
12209
|
-
|
|
10937
|
+
addPattern3(res, zodPatterns3.emoji(), check.message, refs);
|
|
12210
10938
|
break;
|
|
12211
10939
|
case "ulid": {
|
|
12212
|
-
|
|
10940
|
+
addPattern3(res, zodPatterns3.ulid, check.message, refs);
|
|
12213
10941
|
break;
|
|
12214
10942
|
}
|
|
12215
10943
|
case "base64": {
|
|
12216
10944
|
switch (refs.base64Strategy) {
|
|
12217
10945
|
case "format:binary": {
|
|
12218
|
-
|
|
10946
|
+
addFormat3(res, "binary", check.message, refs);
|
|
12219
10947
|
break;
|
|
12220
10948
|
}
|
|
12221
10949
|
case "contentEncoding:base64": {
|
|
12222
|
-
|
|
10950
|
+
setResponseValueAndErrors2(res, "contentEncoding", "base64", check.message, refs);
|
|
12223
10951
|
break;
|
|
12224
10952
|
}
|
|
12225
10953
|
case "pattern:zod": {
|
|
12226
|
-
|
|
10954
|
+
addPattern3(res, zodPatterns3.base64, check.message, refs);
|
|
12227
10955
|
break;
|
|
12228
10956
|
}
|
|
12229
10957
|
}
|
|
12230
10958
|
break;
|
|
12231
10959
|
}
|
|
12232
10960
|
case "nanoid": {
|
|
12233
|
-
|
|
10961
|
+
addPattern3(res, zodPatterns3.nanoid, check.message, refs);
|
|
12234
10962
|
}
|
|
12235
10963
|
}
|
|
12236
10964
|
}
|
|
12237
10965
|
}
|
|
12238
10966
|
return res;
|
|
12239
10967
|
}
|
|
12240
|
-
function
|
|
12241
|
-
return refs.patternStrategy === "escape" ?
|
|
10968
|
+
function escapeLiteralCheckValue3(literal, refs) {
|
|
10969
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric3(literal) : literal;
|
|
12242
10970
|
}
|
|
12243
|
-
var
|
|
12244
|
-
function
|
|
10971
|
+
var ALPHA_NUMERIC3 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
10972
|
+
function escapeNonAlphaNumeric3(source) {
|
|
12245
10973
|
let result = "";
|
|
12246
10974
|
for (let i = 0; i < source.length; i++) {
|
|
12247
|
-
if (!
|
|
10975
|
+
if (!ALPHA_NUMERIC3.has(source[i])) {
|
|
12248
10976
|
result += "\\";
|
|
12249
10977
|
}
|
|
12250
10978
|
result += source[i];
|
|
12251
10979
|
}
|
|
12252
10980
|
return result;
|
|
12253
10981
|
}
|
|
12254
|
-
function
|
|
10982
|
+
function addFormat3(schema, value, message, refs) {
|
|
12255
10983
|
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
12256
10984
|
if (!schema.anyOf) {
|
|
12257
10985
|
schema.anyOf = [];
|
|
@@ -12276,10 +11004,10 @@ function addFormat4(schema, value, message, refs) {
|
|
|
12276
11004
|
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
12277
11005
|
});
|
|
12278
11006
|
} else {
|
|
12279
|
-
|
|
11007
|
+
setResponseValueAndErrors2(schema, "format", value, message, refs);
|
|
12280
11008
|
}
|
|
12281
11009
|
}
|
|
12282
|
-
function
|
|
11010
|
+
function addPattern3(schema, regex, message, refs) {
|
|
12283
11011
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
12284
11012
|
if (!schema.allOf) {
|
|
12285
11013
|
schema.allOf = [];
|
|
@@ -12300,14 +11028,14 @@ function addPattern4(schema, regex, message, refs) {
|
|
|
12300
11028
|
}
|
|
12301
11029
|
}
|
|
12302
11030
|
schema.allOf.push({
|
|
12303
|
-
pattern:
|
|
11031
|
+
pattern: stringifyRegExpWithFlags3(regex, refs),
|
|
12304
11032
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
12305
11033
|
});
|
|
12306
11034
|
} else {
|
|
12307
|
-
|
|
11035
|
+
setResponseValueAndErrors2(schema, "pattern", stringifyRegExpWithFlags3(regex, refs), message, refs);
|
|
12308
11036
|
}
|
|
12309
11037
|
}
|
|
12310
|
-
function
|
|
11038
|
+
function stringifyRegExpWithFlags3(regex, refs) {
|
|
12311
11039
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
12312
11040
|
return regex.source;
|
|
12313
11041
|
}
|
|
@@ -12376,27 +11104,27 @@ function stringifyRegExpWithFlags4(regex, refs) {
|
|
|
12376
11104
|
}
|
|
12377
11105
|
return pattern;
|
|
12378
11106
|
}
|
|
12379
|
-
function
|
|
11107
|
+
function parseRecordDef3(def, refs) {
|
|
12380
11108
|
if (refs.target === "openAi") {
|
|
12381
11109
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
12382
11110
|
}
|
|
12383
|
-
if (refs.target === "openApi3" && def.keyType?._def.typeName ===
|
|
11111
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === z19.ZodFirstPartyTypeKind.ZodEnum) {
|
|
12384
11112
|
return {
|
|
12385
11113
|
type: "object",
|
|
12386
11114
|
required: def.keyType._def.values,
|
|
12387
11115
|
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
12388
11116
|
...acc,
|
|
12389
|
-
[key]:
|
|
11117
|
+
[key]: parseDef3(def.valueType._def, {
|
|
12390
11118
|
...refs,
|
|
12391
11119
|
currentPath: [...refs.currentPath, "properties", key]
|
|
12392
|
-
}) ??
|
|
11120
|
+
}) ?? parseAnyDef3(refs)
|
|
12393
11121
|
}), {}),
|
|
12394
11122
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
12395
11123
|
};
|
|
12396
11124
|
}
|
|
12397
11125
|
const schema = {
|
|
12398
11126
|
type: "object",
|
|
12399
|
-
additionalProperties:
|
|
11127
|
+
additionalProperties: parseDef3(def.valueType._def, {
|
|
12400
11128
|
...refs,
|
|
12401
11129
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
12402
11130
|
}) ?? refs.allowedAdditionalProperties
|
|
@@ -12404,21 +11132,21 @@ function parseRecordDef4(def, refs) {
|
|
|
12404
11132
|
if (refs.target === "openApi3") {
|
|
12405
11133
|
return schema;
|
|
12406
11134
|
}
|
|
12407
|
-
if (def.keyType?._def.typeName ===
|
|
12408
|
-
const { type, ...keyType } =
|
|
11135
|
+
if (def.keyType?._def.typeName === z19.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
11136
|
+
const { type, ...keyType } = parseStringDef3(def.keyType._def, refs);
|
|
12409
11137
|
return {
|
|
12410
11138
|
...schema,
|
|
12411
11139
|
propertyNames: keyType
|
|
12412
11140
|
};
|
|
12413
|
-
} else if (def.keyType?._def.typeName ===
|
|
11141
|
+
} else if (def.keyType?._def.typeName === z19.ZodFirstPartyTypeKind.ZodEnum) {
|
|
12414
11142
|
return {
|
|
12415
11143
|
...schema,
|
|
12416
11144
|
propertyNames: {
|
|
12417
11145
|
enum: def.keyType._def.values
|
|
12418
11146
|
}
|
|
12419
11147
|
};
|
|
12420
|
-
} else if (def.keyType?._def.typeName ===
|
|
12421
|
-
const { type, ...keyType } =
|
|
11148
|
+
} else if (def.keyType?._def.typeName === z19.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === z19.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
11149
|
+
const { type, ...keyType } = parseBrandedDef3(def.keyType._def, refs);
|
|
12422
11150
|
return {
|
|
12423
11151
|
...schema,
|
|
12424
11152
|
propertyNames: keyType
|
|
@@ -12426,18 +11154,18 @@ function parseRecordDef4(def, refs) {
|
|
|
12426
11154
|
}
|
|
12427
11155
|
return schema;
|
|
12428
11156
|
}
|
|
12429
|
-
function
|
|
11157
|
+
function parseMapDef3(def, refs) {
|
|
12430
11158
|
if (refs.mapStrategy === "record") {
|
|
12431
|
-
return
|
|
11159
|
+
return parseRecordDef3(def, refs);
|
|
12432
11160
|
}
|
|
12433
|
-
const keys =
|
|
11161
|
+
const keys = parseDef3(def.keyType._def, {
|
|
12434
11162
|
...refs,
|
|
12435
11163
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
12436
|
-
}) ||
|
|
12437
|
-
const values =
|
|
11164
|
+
}) || parseAnyDef3(refs);
|
|
11165
|
+
const values = parseDef3(def.valueType._def, {
|
|
12438
11166
|
...refs,
|
|
12439
11167
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
12440
|
-
}) ||
|
|
11168
|
+
}) || parseAnyDef3(refs);
|
|
12441
11169
|
return {
|
|
12442
11170
|
type: "array",
|
|
12443
11171
|
maxItems: 125,
|
|
@@ -12449,7 +11177,7 @@ function parseMapDef4(def, refs) {
|
|
|
12449
11177
|
}
|
|
12450
11178
|
};
|
|
12451
11179
|
}
|
|
12452
|
-
function
|
|
11180
|
+
function parseNativeEnumDef3(def) {
|
|
12453
11181
|
const object22 = def.values;
|
|
12454
11182
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
12455
11183
|
return typeof object22[object22[key]] !== "number";
|
|
@@ -12461,15 +11189,15 @@ function parseNativeEnumDef4(def) {
|
|
|
12461
11189
|
enum: actualValues
|
|
12462
11190
|
};
|
|
12463
11191
|
}
|
|
12464
|
-
function
|
|
11192
|
+
function parseNeverDef3(refs) {
|
|
12465
11193
|
return refs.target === "openAi" ? void 0 : {
|
|
12466
|
-
not:
|
|
11194
|
+
not: parseAnyDef3({
|
|
12467
11195
|
...refs,
|
|
12468
11196
|
currentPath: [...refs.currentPath, "not"]
|
|
12469
11197
|
})
|
|
12470
11198
|
};
|
|
12471
11199
|
}
|
|
12472
|
-
function
|
|
11200
|
+
function parseNullDef3(refs) {
|
|
12473
11201
|
return refs.target === "openApi3" ? {
|
|
12474
11202
|
enum: ["null"],
|
|
12475
11203
|
nullable: true
|
|
@@ -12477,20 +11205,20 @@ function parseNullDef4(refs) {
|
|
|
12477
11205
|
type: "null"
|
|
12478
11206
|
};
|
|
12479
11207
|
}
|
|
12480
|
-
var
|
|
11208
|
+
var primitiveMappings3 = {
|
|
12481
11209
|
ZodString: "string",
|
|
12482
11210
|
ZodNumber: "number",
|
|
12483
11211
|
ZodBigInt: "integer",
|
|
12484
11212
|
ZodBoolean: "boolean",
|
|
12485
11213
|
ZodNull: "null"
|
|
12486
11214
|
};
|
|
12487
|
-
function
|
|
11215
|
+
function parseUnionDef3(def, refs) {
|
|
12488
11216
|
if (refs.target === "openApi3")
|
|
12489
|
-
return
|
|
11217
|
+
return asAnyOf3(def, refs);
|
|
12490
11218
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
12491
|
-
if (options.every((x) => x._def.typeName in
|
|
11219
|
+
if (options.every((x) => x._def.typeName in primitiveMappings3 && (!x._def.checks || !x._def.checks.length))) {
|
|
12492
11220
|
const types = options.reduce((types2, x) => {
|
|
12493
|
-
const type =
|
|
11221
|
+
const type = primitiveMappings3[x._def.typeName];
|
|
12494
11222
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
12495
11223
|
}, []);
|
|
12496
11224
|
return {
|
|
@@ -12534,32 +11262,32 @@ function parseUnionDef4(def, refs) {
|
|
|
12534
11262
|
], [])
|
|
12535
11263
|
};
|
|
12536
11264
|
}
|
|
12537
|
-
return
|
|
11265
|
+
return asAnyOf3(def, refs);
|
|
12538
11266
|
}
|
|
12539
|
-
var
|
|
12540
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) =>
|
|
11267
|
+
var asAnyOf3 = (def, refs) => {
|
|
11268
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef3(x._def, {
|
|
12541
11269
|
...refs,
|
|
12542
11270
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
12543
11271
|
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
12544
11272
|
return anyOf.length ? { anyOf } : void 0;
|
|
12545
11273
|
};
|
|
12546
|
-
function
|
|
11274
|
+
function parseNullableDef3(def, refs) {
|
|
12547
11275
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
12548
11276
|
if (refs.target === "openApi3") {
|
|
12549
11277
|
return {
|
|
12550
|
-
type:
|
|
11278
|
+
type: primitiveMappings3[def.innerType._def.typeName],
|
|
12551
11279
|
nullable: true
|
|
12552
11280
|
};
|
|
12553
11281
|
}
|
|
12554
11282
|
return {
|
|
12555
11283
|
type: [
|
|
12556
|
-
|
|
11284
|
+
primitiveMappings3[def.innerType._def.typeName],
|
|
12557
11285
|
"null"
|
|
12558
11286
|
]
|
|
12559
11287
|
};
|
|
12560
11288
|
}
|
|
12561
11289
|
if (refs.target === "openApi3") {
|
|
12562
|
-
const base2 =
|
|
11290
|
+
const base2 = parseDef3(def.innerType._def, {
|
|
12563
11291
|
...refs,
|
|
12564
11292
|
currentPath: [...refs.currentPath]
|
|
12565
11293
|
});
|
|
@@ -12567,13 +11295,13 @@ function parseNullableDef4(def, refs) {
|
|
|
12567
11295
|
return { allOf: [base2], nullable: true };
|
|
12568
11296
|
return base2 && { ...base2, nullable: true };
|
|
12569
11297
|
}
|
|
12570
|
-
const base =
|
|
11298
|
+
const base = parseDef3(def.innerType._def, {
|
|
12571
11299
|
...refs,
|
|
12572
11300
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
12573
11301
|
});
|
|
12574
11302
|
return base && { anyOf: [base, { type: "null" }] };
|
|
12575
11303
|
}
|
|
12576
|
-
function
|
|
11304
|
+
function parseNumberDef3(def, refs) {
|
|
12577
11305
|
const res = {
|
|
12578
11306
|
type: "number"
|
|
12579
11307
|
};
|
|
@@ -12583,44 +11311,44 @@ function parseNumberDef4(def, refs) {
|
|
|
12583
11311
|
switch (check.kind) {
|
|
12584
11312
|
case "int":
|
|
12585
11313
|
res.type = "integer";
|
|
12586
|
-
|
|
11314
|
+
addErrorMessage2(res, "type", check.message, refs);
|
|
12587
11315
|
break;
|
|
12588
11316
|
case "min":
|
|
12589
11317
|
if (refs.target === "jsonSchema7") {
|
|
12590
11318
|
if (check.inclusive) {
|
|
12591
|
-
|
|
11319
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
12592
11320
|
} else {
|
|
12593
|
-
|
|
11321
|
+
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
12594
11322
|
}
|
|
12595
11323
|
} else {
|
|
12596
11324
|
if (!check.inclusive) {
|
|
12597
11325
|
res.exclusiveMinimum = true;
|
|
12598
11326
|
}
|
|
12599
|
-
|
|
11327
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
12600
11328
|
}
|
|
12601
11329
|
break;
|
|
12602
11330
|
case "max":
|
|
12603
11331
|
if (refs.target === "jsonSchema7") {
|
|
12604
11332
|
if (check.inclusive) {
|
|
12605
|
-
|
|
11333
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
12606
11334
|
} else {
|
|
12607
|
-
|
|
11335
|
+
setResponseValueAndErrors2(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
12608
11336
|
}
|
|
12609
11337
|
} else {
|
|
12610
11338
|
if (!check.inclusive) {
|
|
12611
11339
|
res.exclusiveMaximum = true;
|
|
12612
11340
|
}
|
|
12613
|
-
|
|
11341
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
12614
11342
|
}
|
|
12615
11343
|
break;
|
|
12616
11344
|
case "multipleOf":
|
|
12617
|
-
|
|
11345
|
+
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
12618
11346
|
break;
|
|
12619
11347
|
}
|
|
12620
11348
|
}
|
|
12621
11349
|
return res;
|
|
12622
11350
|
}
|
|
12623
|
-
function
|
|
11351
|
+
function parseObjectDef3(def, refs) {
|
|
12624
11352
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
12625
11353
|
const result = {
|
|
12626
11354
|
type: "object",
|
|
@@ -12633,7 +11361,7 @@ function parseObjectDef4(def, refs) {
|
|
|
12633
11361
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
12634
11362
|
continue;
|
|
12635
11363
|
}
|
|
12636
|
-
let propOptional =
|
|
11364
|
+
let propOptional = safeIsOptional3(propDef);
|
|
12637
11365
|
if (propOptional && forceOptionalIntoNullable) {
|
|
12638
11366
|
if (propDef._def.typeName === "ZodOptional") {
|
|
12639
11367
|
propDef = propDef._def.innerType;
|
|
@@ -12643,7 +11371,7 @@ function parseObjectDef4(def, refs) {
|
|
|
12643
11371
|
}
|
|
12644
11372
|
propOptional = false;
|
|
12645
11373
|
}
|
|
12646
|
-
const parsedDef =
|
|
11374
|
+
const parsedDef = parseDef3(propDef._def, {
|
|
12647
11375
|
...refs,
|
|
12648
11376
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
12649
11377
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -12659,15 +11387,15 @@ function parseObjectDef4(def, refs) {
|
|
|
12659
11387
|
if (required.length) {
|
|
12660
11388
|
result.required = required;
|
|
12661
11389
|
}
|
|
12662
|
-
const additionalProperties =
|
|
11390
|
+
const additionalProperties = decideAdditionalProperties3(def, refs);
|
|
12663
11391
|
if (additionalProperties !== void 0) {
|
|
12664
11392
|
result.additionalProperties = additionalProperties;
|
|
12665
11393
|
}
|
|
12666
11394
|
return result;
|
|
12667
11395
|
}
|
|
12668
|
-
function
|
|
11396
|
+
function decideAdditionalProperties3(def, refs) {
|
|
12669
11397
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
12670
|
-
return
|
|
11398
|
+
return parseDef3(def.catchall._def, {
|
|
12671
11399
|
...refs,
|
|
12672
11400
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
12673
11401
|
});
|
|
@@ -12681,41 +11409,41 @@ function decideAdditionalProperties4(def, refs) {
|
|
|
12681
11409
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
12682
11410
|
}
|
|
12683
11411
|
}
|
|
12684
|
-
function
|
|
11412
|
+
function safeIsOptional3(schema) {
|
|
12685
11413
|
try {
|
|
12686
11414
|
return schema.isOptional();
|
|
12687
11415
|
} catch {
|
|
12688
11416
|
return true;
|
|
12689
11417
|
}
|
|
12690
11418
|
}
|
|
12691
|
-
var
|
|
11419
|
+
var parseOptionalDef3 = (def, refs) => {
|
|
12692
11420
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
12693
|
-
return
|
|
11421
|
+
return parseDef3(def.innerType._def, refs);
|
|
12694
11422
|
}
|
|
12695
|
-
const innerSchema =
|
|
11423
|
+
const innerSchema = parseDef3(def.innerType._def, {
|
|
12696
11424
|
...refs,
|
|
12697
11425
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
12698
11426
|
});
|
|
12699
11427
|
return innerSchema ? {
|
|
12700
11428
|
anyOf: [
|
|
12701
11429
|
{
|
|
12702
|
-
not:
|
|
11430
|
+
not: parseAnyDef3(refs)
|
|
12703
11431
|
},
|
|
12704
11432
|
innerSchema
|
|
12705
11433
|
]
|
|
12706
|
-
} :
|
|
11434
|
+
} : parseAnyDef3(refs);
|
|
12707
11435
|
};
|
|
12708
|
-
var
|
|
11436
|
+
var parsePipelineDef3 = (def, refs) => {
|
|
12709
11437
|
if (refs.pipeStrategy === "input") {
|
|
12710
|
-
return
|
|
11438
|
+
return parseDef3(def.in._def, refs);
|
|
12711
11439
|
} else if (refs.pipeStrategy === "output") {
|
|
12712
|
-
return
|
|
11440
|
+
return parseDef3(def.out._def, refs);
|
|
12713
11441
|
}
|
|
12714
|
-
const a =
|
|
11442
|
+
const a = parseDef3(def.in._def, {
|
|
12715
11443
|
...refs,
|
|
12716
11444
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
12717
11445
|
});
|
|
12718
|
-
const b =
|
|
11446
|
+
const b = parseDef3(def.out._def, {
|
|
12719
11447
|
...refs,
|
|
12720
11448
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
12721
11449
|
});
|
|
@@ -12723,11 +11451,11 @@ var parsePipelineDef4 = (def, refs) => {
|
|
|
12723
11451
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
12724
11452
|
};
|
|
12725
11453
|
};
|
|
12726
|
-
function
|
|
12727
|
-
return
|
|
11454
|
+
function parsePromiseDef3(def, refs) {
|
|
11455
|
+
return parseDef3(def.type._def, refs);
|
|
12728
11456
|
}
|
|
12729
|
-
function
|
|
12730
|
-
const items =
|
|
11457
|
+
function parseSetDef3(def, refs) {
|
|
11458
|
+
const items = parseDef3(def.valueType._def, {
|
|
12731
11459
|
...refs,
|
|
12732
11460
|
currentPath: [...refs.currentPath, "items"]
|
|
12733
11461
|
});
|
|
@@ -12737,144 +11465,144 @@ function parseSetDef4(def, refs) {
|
|
|
12737
11465
|
items
|
|
12738
11466
|
};
|
|
12739
11467
|
if (def.minSize) {
|
|
12740
|
-
|
|
11468
|
+
setResponseValueAndErrors2(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
12741
11469
|
}
|
|
12742
11470
|
if (def.maxSize) {
|
|
12743
|
-
|
|
11471
|
+
setResponseValueAndErrors2(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
12744
11472
|
}
|
|
12745
11473
|
return schema;
|
|
12746
11474
|
}
|
|
12747
|
-
function
|
|
11475
|
+
function parseTupleDef3(def, refs) {
|
|
12748
11476
|
if (def.rest) {
|
|
12749
11477
|
return {
|
|
12750
11478
|
type: "array",
|
|
12751
11479
|
minItems: def.items.length,
|
|
12752
|
-
items: def.items.map((x, i) =>
|
|
11480
|
+
items: def.items.map((x, i) => parseDef3(x._def, {
|
|
12753
11481
|
...refs,
|
|
12754
11482
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12755
11483
|
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
12756
|
-
additionalItems:
|
|
12757
|
-
...refs,
|
|
12758
|
-
currentPath: [...refs.currentPath, "additionalItems"]
|
|
12759
|
-
})
|
|
12760
|
-
};
|
|
12761
|
-
} else {
|
|
12762
|
-
return {
|
|
12763
|
-
type: "array",
|
|
12764
|
-
minItems: def.items.length,
|
|
12765
|
-
maxItems: def.items.length,
|
|
12766
|
-
items: def.items.map((x, i) =>
|
|
12767
|
-
...refs,
|
|
12768
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12769
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
12770
|
-
};
|
|
12771
|
-
}
|
|
12772
|
-
}
|
|
12773
|
-
function
|
|
12774
|
-
return {
|
|
12775
|
-
not:
|
|
12776
|
-
};
|
|
12777
|
-
}
|
|
12778
|
-
function
|
|
12779
|
-
return
|
|
12780
|
-
}
|
|
12781
|
-
var
|
|
12782
|
-
return
|
|
12783
|
-
};
|
|
12784
|
-
var
|
|
12785
|
-
switch (typeName) {
|
|
12786
|
-
case
|
|
12787
|
-
return
|
|
12788
|
-
case
|
|
12789
|
-
return
|
|
12790
|
-
case
|
|
12791
|
-
return
|
|
12792
|
-
case
|
|
12793
|
-
return
|
|
12794
|
-
case
|
|
12795
|
-
return
|
|
12796
|
-
case
|
|
12797
|
-
return
|
|
12798
|
-
case
|
|
12799
|
-
return
|
|
12800
|
-
case
|
|
12801
|
-
return
|
|
12802
|
-
case
|
|
12803
|
-
return
|
|
12804
|
-
case
|
|
12805
|
-
case
|
|
12806
|
-
return
|
|
12807
|
-
case
|
|
12808
|
-
return
|
|
12809
|
-
case
|
|
12810
|
-
return
|
|
12811
|
-
case
|
|
12812
|
-
return
|
|
12813
|
-
case
|
|
12814
|
-
return
|
|
12815
|
-
case
|
|
12816
|
-
return
|
|
12817
|
-
case
|
|
12818
|
-
return
|
|
12819
|
-
case
|
|
12820
|
-
return
|
|
12821
|
-
case
|
|
12822
|
-
return
|
|
12823
|
-
case
|
|
12824
|
-
return
|
|
12825
|
-
case
|
|
12826
|
-
return
|
|
12827
|
-
case
|
|
11484
|
+
additionalItems: parseDef3(def.rest._def, {
|
|
11485
|
+
...refs,
|
|
11486
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
11487
|
+
})
|
|
11488
|
+
};
|
|
11489
|
+
} else {
|
|
11490
|
+
return {
|
|
11491
|
+
type: "array",
|
|
11492
|
+
minItems: def.items.length,
|
|
11493
|
+
maxItems: def.items.length,
|
|
11494
|
+
items: def.items.map((x, i) => parseDef3(x._def, {
|
|
11495
|
+
...refs,
|
|
11496
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
11497
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
11498
|
+
};
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
function parseUndefinedDef3(refs) {
|
|
11502
|
+
return {
|
|
11503
|
+
not: parseAnyDef3(refs)
|
|
11504
|
+
};
|
|
11505
|
+
}
|
|
11506
|
+
function parseUnknownDef3(refs) {
|
|
11507
|
+
return parseAnyDef3(refs);
|
|
11508
|
+
}
|
|
11509
|
+
var parseReadonlyDef3 = (def, refs) => {
|
|
11510
|
+
return parseDef3(def.innerType._def, refs);
|
|
11511
|
+
};
|
|
11512
|
+
var selectParser3 = (def, typeName, refs) => {
|
|
11513
|
+
switch (typeName) {
|
|
11514
|
+
case z19.ZodFirstPartyTypeKind.ZodString:
|
|
11515
|
+
return parseStringDef3(def, refs);
|
|
11516
|
+
case z19.ZodFirstPartyTypeKind.ZodNumber:
|
|
11517
|
+
return parseNumberDef3(def, refs);
|
|
11518
|
+
case z19.ZodFirstPartyTypeKind.ZodObject:
|
|
11519
|
+
return parseObjectDef3(def, refs);
|
|
11520
|
+
case z19.ZodFirstPartyTypeKind.ZodBigInt:
|
|
11521
|
+
return parseBigintDef3(def, refs);
|
|
11522
|
+
case z19.ZodFirstPartyTypeKind.ZodBoolean:
|
|
11523
|
+
return parseBooleanDef3();
|
|
11524
|
+
case z19.ZodFirstPartyTypeKind.ZodDate:
|
|
11525
|
+
return parseDateDef3(def, refs);
|
|
11526
|
+
case z19.ZodFirstPartyTypeKind.ZodUndefined:
|
|
11527
|
+
return parseUndefinedDef3(refs);
|
|
11528
|
+
case z19.ZodFirstPartyTypeKind.ZodNull:
|
|
11529
|
+
return parseNullDef3(refs);
|
|
11530
|
+
case z19.ZodFirstPartyTypeKind.ZodArray:
|
|
11531
|
+
return parseArrayDef3(def, refs);
|
|
11532
|
+
case z19.ZodFirstPartyTypeKind.ZodUnion:
|
|
11533
|
+
case z19.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
11534
|
+
return parseUnionDef3(def, refs);
|
|
11535
|
+
case z19.ZodFirstPartyTypeKind.ZodIntersection:
|
|
11536
|
+
return parseIntersectionDef3(def, refs);
|
|
11537
|
+
case z19.ZodFirstPartyTypeKind.ZodTuple:
|
|
11538
|
+
return parseTupleDef3(def, refs);
|
|
11539
|
+
case z19.ZodFirstPartyTypeKind.ZodRecord:
|
|
11540
|
+
return parseRecordDef3(def, refs);
|
|
11541
|
+
case z19.ZodFirstPartyTypeKind.ZodLiteral:
|
|
11542
|
+
return parseLiteralDef3(def, refs);
|
|
11543
|
+
case z19.ZodFirstPartyTypeKind.ZodEnum:
|
|
11544
|
+
return parseEnumDef3(def);
|
|
11545
|
+
case z19.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
11546
|
+
return parseNativeEnumDef3(def);
|
|
11547
|
+
case z19.ZodFirstPartyTypeKind.ZodNullable:
|
|
11548
|
+
return parseNullableDef3(def, refs);
|
|
11549
|
+
case z19.ZodFirstPartyTypeKind.ZodOptional:
|
|
11550
|
+
return parseOptionalDef3(def, refs);
|
|
11551
|
+
case z19.ZodFirstPartyTypeKind.ZodMap:
|
|
11552
|
+
return parseMapDef3(def, refs);
|
|
11553
|
+
case z19.ZodFirstPartyTypeKind.ZodSet:
|
|
11554
|
+
return parseSetDef3(def, refs);
|
|
11555
|
+
case z19.ZodFirstPartyTypeKind.ZodLazy:
|
|
12828
11556
|
return () => def.getter()._def;
|
|
12829
|
-
case
|
|
12830
|
-
return
|
|
12831
|
-
case
|
|
12832
|
-
case
|
|
12833
|
-
return
|
|
12834
|
-
case
|
|
12835
|
-
return
|
|
12836
|
-
case
|
|
12837
|
-
return
|
|
12838
|
-
case
|
|
12839
|
-
return
|
|
12840
|
-
case
|
|
12841
|
-
return
|
|
12842
|
-
case
|
|
12843
|
-
return
|
|
12844
|
-
case
|
|
12845
|
-
return
|
|
12846
|
-
case
|
|
12847
|
-
return
|
|
12848
|
-
case
|
|
12849
|
-
return
|
|
12850
|
-
case
|
|
12851
|
-
case
|
|
12852
|
-
case
|
|
11557
|
+
case z19.ZodFirstPartyTypeKind.ZodPromise:
|
|
11558
|
+
return parsePromiseDef3(def, refs);
|
|
11559
|
+
case z19.ZodFirstPartyTypeKind.ZodNaN:
|
|
11560
|
+
case z19.ZodFirstPartyTypeKind.ZodNever:
|
|
11561
|
+
return parseNeverDef3(refs);
|
|
11562
|
+
case z19.ZodFirstPartyTypeKind.ZodEffects:
|
|
11563
|
+
return parseEffectsDef3(def, refs);
|
|
11564
|
+
case z19.ZodFirstPartyTypeKind.ZodAny:
|
|
11565
|
+
return parseAnyDef3(refs);
|
|
11566
|
+
case z19.ZodFirstPartyTypeKind.ZodUnknown:
|
|
11567
|
+
return parseUnknownDef3(refs);
|
|
11568
|
+
case z19.ZodFirstPartyTypeKind.ZodDefault:
|
|
11569
|
+
return parseDefaultDef3(def, refs);
|
|
11570
|
+
case z19.ZodFirstPartyTypeKind.ZodBranded:
|
|
11571
|
+
return parseBrandedDef3(def, refs);
|
|
11572
|
+
case z19.ZodFirstPartyTypeKind.ZodReadonly:
|
|
11573
|
+
return parseReadonlyDef3(def, refs);
|
|
11574
|
+
case z19.ZodFirstPartyTypeKind.ZodCatch:
|
|
11575
|
+
return parseCatchDef3(def, refs);
|
|
11576
|
+
case z19.ZodFirstPartyTypeKind.ZodPipeline:
|
|
11577
|
+
return parsePipelineDef3(def, refs);
|
|
11578
|
+
case z19.ZodFirstPartyTypeKind.ZodFunction:
|
|
11579
|
+
case z19.ZodFirstPartyTypeKind.ZodVoid:
|
|
11580
|
+
case z19.ZodFirstPartyTypeKind.ZodSymbol:
|
|
12853
11581
|
return void 0;
|
|
12854
11582
|
default:
|
|
12855
11583
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
12856
11584
|
}
|
|
12857
11585
|
};
|
|
12858
|
-
function
|
|
11586
|
+
function parseDef3(def, refs, forceResolution = false) {
|
|
12859
11587
|
const seenItem = refs.seen.get(def);
|
|
12860
11588
|
if (refs.override) {
|
|
12861
11589
|
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
12862
|
-
if (overrideResult !==
|
|
11590
|
+
if (overrideResult !== ignoreOverride3) {
|
|
12863
11591
|
return overrideResult;
|
|
12864
11592
|
}
|
|
12865
11593
|
}
|
|
12866
11594
|
if (seenItem && !forceResolution) {
|
|
12867
|
-
const seenSchema = get$
|
|
11595
|
+
const seenSchema = get$ref3(seenItem, refs);
|
|
12868
11596
|
if (seenSchema !== void 0) {
|
|
12869
11597
|
return seenSchema;
|
|
12870
11598
|
}
|
|
12871
11599
|
}
|
|
12872
11600
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
12873
11601
|
refs.seen.set(def, newItem);
|
|
12874
|
-
const jsonSchemaOrGetter =
|
|
12875
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
11602
|
+
const jsonSchemaOrGetter = selectParser3(def, def.typeName, refs);
|
|
11603
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef3(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
12876
11604
|
if (jsonSchema22) {
|
|
12877
|
-
|
|
11605
|
+
addMeta3(def, refs, jsonSchema22);
|
|
12878
11606
|
}
|
|
12879
11607
|
if (refs.postProcess) {
|
|
12880
11608
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -12884,23 +11612,23 @@ function parseDef4(def, refs, forceResolution = false) {
|
|
|
12884
11612
|
newItem.jsonSchema = jsonSchema22;
|
|
12885
11613
|
return jsonSchema22;
|
|
12886
11614
|
}
|
|
12887
|
-
var get$
|
|
11615
|
+
var get$ref3 = (item, refs) => {
|
|
12888
11616
|
switch (refs.$refStrategy) {
|
|
12889
11617
|
case "root":
|
|
12890
11618
|
return { $ref: item.path.join("/") };
|
|
12891
11619
|
case "relative":
|
|
12892
|
-
return { $ref:
|
|
11620
|
+
return { $ref: getRelativePath3(refs.currentPath, item.path) };
|
|
12893
11621
|
case "none":
|
|
12894
11622
|
case "seen": {
|
|
12895
11623
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
12896
11624
|
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
12897
|
-
return
|
|
11625
|
+
return parseAnyDef3(refs);
|
|
12898
11626
|
}
|
|
12899
|
-
return refs.$refStrategy === "seen" ?
|
|
11627
|
+
return refs.$refStrategy === "seen" ? parseAnyDef3(refs) : void 0;
|
|
12900
11628
|
}
|
|
12901
11629
|
}
|
|
12902
11630
|
};
|
|
12903
|
-
var
|
|
11631
|
+
var addMeta3 = (def, refs, jsonSchema22) => {
|
|
12904
11632
|
if (def.description) {
|
|
12905
11633
|
jsonSchema22.description = def.description;
|
|
12906
11634
|
if (refs.markdownDescription) {
|
|
@@ -12910,19 +11638,19 @@ var addMeta4 = (def, refs, jsonSchema22) => {
|
|
|
12910
11638
|
return jsonSchema22;
|
|
12911
11639
|
};
|
|
12912
11640
|
var zodToJsonSchema22 = (schema, options) => {
|
|
12913
|
-
const refs =
|
|
11641
|
+
const refs = getRefs3(options);
|
|
12914
11642
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name182, schema2]) => ({
|
|
12915
11643
|
...acc,
|
|
12916
|
-
[name182]:
|
|
11644
|
+
[name182]: parseDef3(schema2._def, {
|
|
12917
11645
|
...refs,
|
|
12918
11646
|
currentPath: [...refs.basePath, refs.definitionPath, name182]
|
|
12919
|
-
}, true) ??
|
|
11647
|
+
}, true) ?? parseAnyDef3(refs)
|
|
12920
11648
|
}), {}) : void 0;
|
|
12921
11649
|
const name172 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
12922
|
-
const main =
|
|
11650
|
+
const main = parseDef3(schema._def, name172 === void 0 ? refs : {
|
|
12923
11651
|
...refs,
|
|
12924
11652
|
currentPath: [...refs.basePath, refs.definitionPath, name172]
|
|
12925
|
-
}, false) ??
|
|
11653
|
+
}, false) ?? parseAnyDef3(refs);
|
|
12926
11654
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
12927
11655
|
if (title !== void 0) {
|
|
12928
11656
|
main.title = title;
|
|
@@ -12969,7 +11697,7 @@ var zodToJsonSchema22 = (schema, options) => {
|
|
|
12969
11697
|
}
|
|
12970
11698
|
return combined;
|
|
12971
11699
|
};
|
|
12972
|
-
var
|
|
11700
|
+
var esm_default2 = zodToJsonSchema22;
|
|
12973
11701
|
function fixJson3(input) {
|
|
12974
11702
|
const stack = ["ROOT"];
|
|
12975
11703
|
let lastValidIndex = -1;
|
|
@@ -13567,7 +12295,7 @@ function zodSchema3(zodSchema22, options) {
|
|
|
13567
12295
|
var _a172;
|
|
13568
12296
|
const useReferences = (_a172 = void 0) != null ? _a172 : false;
|
|
13569
12297
|
return jsonSchema3(
|
|
13570
|
-
|
|
12298
|
+
esm_default2(zodSchema22, {
|
|
13571
12299
|
$refStrategy: useReferences ? "root" : "none",
|
|
13572
12300
|
target: "jsonSchema7"
|
|
13573
12301
|
// note: openai mode breaks various gemini conversions
|
|
@@ -15991,17 +14719,17 @@ async function safeParseJSON4({
|
|
|
15991
14719
|
};
|
|
15992
14720
|
}
|
|
15993
14721
|
}
|
|
15994
|
-
var
|
|
14722
|
+
var getRelativePath4 = (pathA, pathB) => {
|
|
15995
14723
|
let i = 0;
|
|
15996
14724
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
15997
14725
|
if (pathA[i] !== pathB[i]) break;
|
|
15998
14726
|
}
|
|
15999
14727
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
16000
14728
|
};
|
|
16001
|
-
var
|
|
14729
|
+
var ignoreOverride4 = Symbol(
|
|
16002
14730
|
"Let zodToJsonSchema decide on which parser to use"
|
|
16003
14731
|
);
|
|
16004
|
-
var
|
|
14732
|
+
var defaultOptions4 = {
|
|
16005
14733
|
name: void 0,
|
|
16006
14734
|
$refStrategy: "root",
|
|
16007
14735
|
basePath: ["#"],
|
|
@@ -16022,23 +14750,23 @@ var defaultOptions5 = {
|
|
|
16022
14750
|
base64Strategy: "contentEncoding:base64",
|
|
16023
14751
|
nameStrategy: "ref"
|
|
16024
14752
|
};
|
|
16025
|
-
var
|
|
16026
|
-
...
|
|
14753
|
+
var getDefaultOptions4 = (options) => typeof options === "string" ? {
|
|
14754
|
+
...defaultOptions4,
|
|
16027
14755
|
name: options
|
|
16028
14756
|
} : {
|
|
16029
|
-
...
|
|
14757
|
+
...defaultOptions4,
|
|
16030
14758
|
...options
|
|
16031
14759
|
};
|
|
16032
|
-
function
|
|
14760
|
+
function parseAnyDef4() {
|
|
16033
14761
|
return {};
|
|
16034
14762
|
}
|
|
16035
|
-
function
|
|
14763
|
+
function parseArrayDef4(def, refs) {
|
|
16036
14764
|
var _a26, _b8, _c;
|
|
16037
14765
|
const res = {
|
|
16038
14766
|
type: "array"
|
|
16039
14767
|
};
|
|
16040
14768
|
if (((_a26 = def.type) == null ? void 0 : _a26._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
16041
|
-
res.items =
|
|
14769
|
+
res.items = parseDef4(def.type._def, {
|
|
16042
14770
|
...refs,
|
|
16043
14771
|
currentPath: [...refs.currentPath, "items"]
|
|
16044
14772
|
});
|
|
@@ -16055,7 +14783,7 @@ function parseArrayDef5(def, refs) {
|
|
|
16055
14783
|
}
|
|
16056
14784
|
return res;
|
|
16057
14785
|
}
|
|
16058
|
-
function
|
|
14786
|
+
function parseBigintDef4(def) {
|
|
16059
14787
|
const res = {
|
|
16060
14788
|
type: "integer",
|
|
16061
14789
|
format: "int64"
|
|
@@ -16084,20 +14812,20 @@ function parseBigintDef5(def) {
|
|
|
16084
14812
|
}
|
|
16085
14813
|
return res;
|
|
16086
14814
|
}
|
|
16087
|
-
function
|
|
14815
|
+
function parseBooleanDef4() {
|
|
16088
14816
|
return { type: "boolean" };
|
|
16089
14817
|
}
|
|
16090
|
-
function
|
|
16091
|
-
return
|
|
14818
|
+
function parseBrandedDef4(_def, refs) {
|
|
14819
|
+
return parseDef4(_def.type._def, refs);
|
|
16092
14820
|
}
|
|
16093
|
-
var
|
|
16094
|
-
return
|
|
14821
|
+
var parseCatchDef4 = (def, refs) => {
|
|
14822
|
+
return parseDef4(def.innerType._def, refs);
|
|
16095
14823
|
};
|
|
16096
|
-
function
|
|
14824
|
+
function parseDateDef4(def, refs, overrideDateStrategy) {
|
|
16097
14825
|
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
16098
14826
|
if (Array.isArray(strategy)) {
|
|
16099
14827
|
return {
|
|
16100
|
-
anyOf: strategy.map((item, i) =>
|
|
14828
|
+
anyOf: strategy.map((item, i) => parseDateDef4(def, refs, item))
|
|
16101
14829
|
};
|
|
16102
14830
|
}
|
|
16103
14831
|
switch (strategy) {
|
|
@@ -16113,10 +14841,10 @@ function parseDateDef5(def, refs, overrideDateStrategy) {
|
|
|
16113
14841
|
format: "date"
|
|
16114
14842
|
};
|
|
16115
14843
|
case "integer":
|
|
16116
|
-
return
|
|
14844
|
+
return integerDateParser4(def);
|
|
16117
14845
|
}
|
|
16118
14846
|
}
|
|
16119
|
-
var
|
|
14847
|
+
var integerDateParser4 = (def) => {
|
|
16120
14848
|
const res = {
|
|
16121
14849
|
type: "integer",
|
|
16122
14850
|
format: "unix-time"
|
|
@@ -16133,39 +14861,39 @@ var integerDateParser5 = (def) => {
|
|
|
16133
14861
|
}
|
|
16134
14862
|
return res;
|
|
16135
14863
|
};
|
|
16136
|
-
function
|
|
14864
|
+
function parseDefaultDef4(_def, refs) {
|
|
16137
14865
|
return {
|
|
16138
|
-
...
|
|
14866
|
+
...parseDef4(_def.innerType._def, refs),
|
|
16139
14867
|
default: _def.defaultValue()
|
|
16140
14868
|
};
|
|
16141
14869
|
}
|
|
16142
|
-
function
|
|
16143
|
-
return refs.effectStrategy === "input" ?
|
|
14870
|
+
function parseEffectsDef4(_def, refs) {
|
|
14871
|
+
return refs.effectStrategy === "input" ? parseDef4(_def.schema._def, refs) : parseAnyDef4();
|
|
16144
14872
|
}
|
|
16145
|
-
function
|
|
14873
|
+
function parseEnumDef4(def) {
|
|
16146
14874
|
return {
|
|
16147
14875
|
type: "string",
|
|
16148
14876
|
enum: Array.from(def.values)
|
|
16149
14877
|
};
|
|
16150
14878
|
}
|
|
16151
|
-
var
|
|
14879
|
+
var isJsonSchema7AllOfType4 = (type) => {
|
|
16152
14880
|
if ("type" in type && type.type === "string") return false;
|
|
16153
14881
|
return "allOf" in type;
|
|
16154
14882
|
};
|
|
16155
|
-
function
|
|
14883
|
+
function parseIntersectionDef4(def, refs) {
|
|
16156
14884
|
const allOf = [
|
|
16157
|
-
|
|
14885
|
+
parseDef4(def.left._def, {
|
|
16158
14886
|
...refs,
|
|
16159
14887
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
16160
14888
|
}),
|
|
16161
|
-
|
|
14889
|
+
parseDef4(def.right._def, {
|
|
16162
14890
|
...refs,
|
|
16163
14891
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
16164
14892
|
})
|
|
16165
14893
|
].filter((x) => !!x);
|
|
16166
14894
|
const mergedAllOf = [];
|
|
16167
14895
|
allOf.forEach((schema) => {
|
|
16168
|
-
if (
|
|
14896
|
+
if (isJsonSchema7AllOfType4(schema)) {
|
|
16169
14897
|
mergedAllOf.push(...schema.allOf);
|
|
16170
14898
|
} else {
|
|
16171
14899
|
let nestedSchema = schema;
|
|
@@ -16178,7 +14906,7 @@ function parseIntersectionDef5(def, refs) {
|
|
|
16178
14906
|
});
|
|
16179
14907
|
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
16180
14908
|
}
|
|
16181
|
-
function
|
|
14909
|
+
function parseLiteralDef4(def) {
|
|
16182
14910
|
const parsedType = typeof def.value;
|
|
16183
14911
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
16184
14912
|
return {
|
|
@@ -16190,8 +14918,8 @@ function parseLiteralDef5(def) {
|
|
|
16190
14918
|
const: def.value
|
|
16191
14919
|
};
|
|
16192
14920
|
}
|
|
16193
|
-
var
|
|
16194
|
-
var
|
|
14921
|
+
var emojiRegex4 = void 0;
|
|
14922
|
+
var zodPatterns4 = {
|
|
16195
14923
|
/**
|
|
16196
14924
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
16197
14925
|
*/
|
|
@@ -16214,13 +14942,13 @@ var zodPatterns5 = {
|
|
|
16214
14942
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
16215
14943
|
*/
|
|
16216
14944
|
emoji: () => {
|
|
16217
|
-
if (
|
|
16218
|
-
|
|
14945
|
+
if (emojiRegex4 === void 0) {
|
|
14946
|
+
emojiRegex4 = RegExp(
|
|
16219
14947
|
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
16220
14948
|
"u"
|
|
16221
14949
|
);
|
|
16222
14950
|
}
|
|
16223
|
-
return
|
|
14951
|
+
return emojiRegex4;
|
|
16224
14952
|
},
|
|
16225
14953
|
/**
|
|
16226
14954
|
* Unused
|
|
@@ -16241,7 +14969,7 @@ var zodPatterns5 = {
|
|
|
16241
14969
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
16242
14970
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
16243
14971
|
};
|
|
16244
|
-
function
|
|
14972
|
+
function parseStringDef4(def, refs) {
|
|
16245
14973
|
const res = {
|
|
16246
14974
|
type: "string"
|
|
16247
14975
|
};
|
|
@@ -16257,67 +14985,67 @@ function parseStringDef5(def, refs) {
|
|
|
16257
14985
|
case "email":
|
|
16258
14986
|
switch (refs.emailStrategy) {
|
|
16259
14987
|
case "format:email":
|
|
16260
|
-
|
|
14988
|
+
addFormat4(res, "email", check.message, refs);
|
|
16261
14989
|
break;
|
|
16262
14990
|
case "format:idn-email":
|
|
16263
|
-
|
|
14991
|
+
addFormat4(res, "idn-email", check.message, refs);
|
|
16264
14992
|
break;
|
|
16265
14993
|
case "pattern:zod":
|
|
16266
|
-
|
|
14994
|
+
addPattern4(res, zodPatterns4.email, check.message, refs);
|
|
16267
14995
|
break;
|
|
16268
14996
|
}
|
|
16269
14997
|
break;
|
|
16270
14998
|
case "url":
|
|
16271
|
-
|
|
14999
|
+
addFormat4(res, "uri", check.message, refs);
|
|
16272
15000
|
break;
|
|
16273
15001
|
case "uuid":
|
|
16274
|
-
|
|
15002
|
+
addFormat4(res, "uuid", check.message, refs);
|
|
16275
15003
|
break;
|
|
16276
15004
|
case "regex":
|
|
16277
|
-
|
|
15005
|
+
addPattern4(res, check.regex, check.message, refs);
|
|
16278
15006
|
break;
|
|
16279
15007
|
case "cuid":
|
|
16280
|
-
|
|
15008
|
+
addPattern4(res, zodPatterns4.cuid, check.message, refs);
|
|
16281
15009
|
break;
|
|
16282
15010
|
case "cuid2":
|
|
16283
|
-
|
|
15011
|
+
addPattern4(res, zodPatterns4.cuid2, check.message, refs);
|
|
16284
15012
|
break;
|
|
16285
15013
|
case "startsWith":
|
|
16286
|
-
|
|
15014
|
+
addPattern4(
|
|
16287
15015
|
res,
|
|
16288
|
-
RegExp(`^${
|
|
15016
|
+
RegExp(`^${escapeLiteralCheckValue4(check.value, refs)}`),
|
|
16289
15017
|
check.message,
|
|
16290
15018
|
refs
|
|
16291
15019
|
);
|
|
16292
15020
|
break;
|
|
16293
15021
|
case "endsWith":
|
|
16294
|
-
|
|
15022
|
+
addPattern4(
|
|
16295
15023
|
res,
|
|
16296
|
-
RegExp(`${
|
|
15024
|
+
RegExp(`${escapeLiteralCheckValue4(check.value, refs)}$`),
|
|
16297
15025
|
check.message,
|
|
16298
15026
|
refs
|
|
16299
15027
|
);
|
|
16300
15028
|
break;
|
|
16301
15029
|
case "datetime":
|
|
16302
|
-
|
|
15030
|
+
addFormat4(res, "date-time", check.message, refs);
|
|
16303
15031
|
break;
|
|
16304
15032
|
case "date":
|
|
16305
|
-
|
|
15033
|
+
addFormat4(res, "date", check.message, refs);
|
|
16306
15034
|
break;
|
|
16307
15035
|
case "time":
|
|
16308
|
-
|
|
15036
|
+
addFormat4(res, "time", check.message, refs);
|
|
16309
15037
|
break;
|
|
16310
15038
|
case "duration":
|
|
16311
|
-
|
|
15039
|
+
addFormat4(res, "duration", check.message, refs);
|
|
16312
15040
|
break;
|
|
16313
15041
|
case "length":
|
|
16314
15042
|
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
16315
15043
|
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
16316
15044
|
break;
|
|
16317
15045
|
case "includes": {
|
|
16318
|
-
|
|
15046
|
+
addPattern4(
|
|
16319
15047
|
res,
|
|
16320
|
-
RegExp(
|
|
15048
|
+
RegExp(escapeLiteralCheckValue4(check.value, refs)),
|
|
16321
15049
|
check.message,
|
|
16322
15050
|
refs
|
|
16323
15051
|
);
|
|
@@ -16325,39 +15053,39 @@ function parseStringDef5(def, refs) {
|
|
|
16325
15053
|
}
|
|
16326
15054
|
case "ip": {
|
|
16327
15055
|
if (check.version !== "v6") {
|
|
16328
|
-
|
|
15056
|
+
addFormat4(res, "ipv4", check.message, refs);
|
|
16329
15057
|
}
|
|
16330
15058
|
if (check.version !== "v4") {
|
|
16331
|
-
|
|
15059
|
+
addFormat4(res, "ipv6", check.message, refs);
|
|
16332
15060
|
}
|
|
16333
15061
|
break;
|
|
16334
15062
|
}
|
|
16335
15063
|
case "base64url":
|
|
16336
|
-
|
|
15064
|
+
addPattern4(res, zodPatterns4.base64url, check.message, refs);
|
|
16337
15065
|
break;
|
|
16338
15066
|
case "jwt":
|
|
16339
|
-
|
|
15067
|
+
addPattern4(res, zodPatterns4.jwt, check.message, refs);
|
|
16340
15068
|
break;
|
|
16341
15069
|
case "cidr": {
|
|
16342
15070
|
if (check.version !== "v6") {
|
|
16343
|
-
|
|
15071
|
+
addPattern4(res, zodPatterns4.ipv4Cidr, check.message, refs);
|
|
16344
15072
|
}
|
|
16345
15073
|
if (check.version !== "v4") {
|
|
16346
|
-
|
|
15074
|
+
addPattern4(res, zodPatterns4.ipv6Cidr, check.message, refs);
|
|
16347
15075
|
}
|
|
16348
15076
|
break;
|
|
16349
15077
|
}
|
|
16350
15078
|
case "emoji":
|
|
16351
|
-
|
|
15079
|
+
addPattern4(res, zodPatterns4.emoji(), check.message, refs);
|
|
16352
15080
|
break;
|
|
16353
15081
|
case "ulid": {
|
|
16354
|
-
|
|
15082
|
+
addPattern4(res, zodPatterns4.ulid, check.message, refs);
|
|
16355
15083
|
break;
|
|
16356
15084
|
}
|
|
16357
15085
|
case "base64": {
|
|
16358
15086
|
switch (refs.base64Strategy) {
|
|
16359
15087
|
case "format:binary": {
|
|
16360
|
-
|
|
15088
|
+
addFormat4(res, "binary", check.message, refs);
|
|
16361
15089
|
break;
|
|
16362
15090
|
}
|
|
16363
15091
|
case "contentEncoding:base64": {
|
|
@@ -16365,37 +15093,37 @@ function parseStringDef5(def, refs) {
|
|
|
16365
15093
|
break;
|
|
16366
15094
|
}
|
|
16367
15095
|
case "pattern:zod": {
|
|
16368
|
-
|
|
15096
|
+
addPattern4(res, zodPatterns4.base64, check.message, refs);
|
|
16369
15097
|
break;
|
|
16370
15098
|
}
|
|
16371
15099
|
}
|
|
16372
15100
|
break;
|
|
16373
15101
|
}
|
|
16374
15102
|
case "nanoid": {
|
|
16375
|
-
|
|
15103
|
+
addPattern4(res, zodPatterns4.nanoid, check.message, refs);
|
|
16376
15104
|
}
|
|
16377
15105
|
}
|
|
16378
15106
|
}
|
|
16379
15107
|
}
|
|
16380
15108
|
return res;
|
|
16381
15109
|
}
|
|
16382
|
-
function
|
|
16383
|
-
return refs.patternStrategy === "escape" ?
|
|
15110
|
+
function escapeLiteralCheckValue4(literal, refs) {
|
|
15111
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric4(literal) : literal;
|
|
16384
15112
|
}
|
|
16385
|
-
var
|
|
15113
|
+
var ALPHA_NUMERIC4 = new Set(
|
|
16386
15114
|
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
16387
15115
|
);
|
|
16388
|
-
function
|
|
15116
|
+
function escapeNonAlphaNumeric4(source) {
|
|
16389
15117
|
let result = "";
|
|
16390
15118
|
for (let i = 0; i < source.length; i++) {
|
|
16391
|
-
if (!
|
|
15119
|
+
if (!ALPHA_NUMERIC4.has(source[i])) {
|
|
16392
15120
|
result += "\\";
|
|
16393
15121
|
}
|
|
16394
15122
|
result += source[i];
|
|
16395
15123
|
}
|
|
16396
15124
|
return result;
|
|
16397
15125
|
}
|
|
16398
|
-
function
|
|
15126
|
+
function addFormat4(schema, value, message, refs) {
|
|
16399
15127
|
var _a26;
|
|
16400
15128
|
if (schema.format || ((_a26 = schema.anyOf) == null ? void 0 : _a26.some((x) => x.format))) {
|
|
16401
15129
|
if (!schema.anyOf) {
|
|
@@ -16415,7 +15143,7 @@ function addFormat5(schema, value, message, refs) {
|
|
|
16415
15143
|
schema.format = value;
|
|
16416
15144
|
}
|
|
16417
15145
|
}
|
|
16418
|
-
function
|
|
15146
|
+
function addPattern4(schema, regex, message, refs) {
|
|
16419
15147
|
var _a26;
|
|
16420
15148
|
if (schema.pattern || ((_a26 = schema.allOf) == null ? void 0 : _a26.some((x) => x.pattern))) {
|
|
16421
15149
|
if (!schema.allOf) {
|
|
@@ -16428,14 +15156,14 @@ function addPattern5(schema, regex, message, refs) {
|
|
|
16428
15156
|
delete schema.pattern;
|
|
16429
15157
|
}
|
|
16430
15158
|
schema.allOf.push({
|
|
16431
|
-
pattern:
|
|
15159
|
+
pattern: stringifyRegExpWithFlags4(regex, refs),
|
|
16432
15160
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
16433
15161
|
});
|
|
16434
15162
|
} else {
|
|
16435
|
-
schema.pattern =
|
|
15163
|
+
schema.pattern = stringifyRegExpWithFlags4(regex, refs);
|
|
16436
15164
|
}
|
|
16437
15165
|
}
|
|
16438
|
-
function
|
|
15166
|
+
function stringifyRegExpWithFlags4(regex, refs) {
|
|
16439
15167
|
var _a26;
|
|
16440
15168
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
16441
15169
|
return regex.source;
|
|
@@ -16507,17 +15235,17 @@ function stringifyRegExpWithFlags5(regex, refs) {
|
|
|
16507
15235
|
}
|
|
16508
15236
|
return pattern;
|
|
16509
15237
|
}
|
|
16510
|
-
function
|
|
15238
|
+
function parseRecordDef4(def, refs) {
|
|
16511
15239
|
var _a26, _b8, _c, _d, _e, _f;
|
|
16512
15240
|
const schema = {
|
|
16513
15241
|
type: "object",
|
|
16514
|
-
additionalProperties: (_a26 =
|
|
15242
|
+
additionalProperties: (_a26 = parseDef4(def.valueType._def, {
|
|
16515
15243
|
...refs,
|
|
16516
15244
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
16517
15245
|
})) != null ? _a26 : refs.allowedAdditionalProperties
|
|
16518
15246
|
};
|
|
16519
15247
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
16520
|
-
const { type, ...keyType } =
|
|
15248
|
+
const { type, ...keyType } = parseStringDef4(def.keyType._def, refs);
|
|
16521
15249
|
return {
|
|
16522
15250
|
...schema,
|
|
16523
15251
|
propertyNames: keyType
|
|
@@ -16530,7 +15258,7 @@ function parseRecordDef5(def, refs) {
|
|
|
16530
15258
|
}
|
|
16531
15259
|
};
|
|
16532
15260
|
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
16533
|
-
const { type, ...keyType } =
|
|
15261
|
+
const { type, ...keyType } = parseBrandedDef4(
|
|
16534
15262
|
def.keyType._def,
|
|
16535
15263
|
refs
|
|
16536
15264
|
);
|
|
@@ -16541,18 +15269,18 @@ function parseRecordDef5(def, refs) {
|
|
|
16541
15269
|
}
|
|
16542
15270
|
return schema;
|
|
16543
15271
|
}
|
|
16544
|
-
function
|
|
15272
|
+
function parseMapDef4(def, refs) {
|
|
16545
15273
|
if (refs.mapStrategy === "record") {
|
|
16546
|
-
return
|
|
15274
|
+
return parseRecordDef4(def, refs);
|
|
16547
15275
|
}
|
|
16548
|
-
const keys =
|
|
15276
|
+
const keys = parseDef4(def.keyType._def, {
|
|
16549
15277
|
...refs,
|
|
16550
15278
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
16551
|
-
}) ||
|
|
16552
|
-
const values =
|
|
15279
|
+
}) || parseAnyDef4();
|
|
15280
|
+
const values = parseDef4(def.valueType._def, {
|
|
16553
15281
|
...refs,
|
|
16554
15282
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
16555
|
-
}) ||
|
|
15283
|
+
}) || parseAnyDef4();
|
|
16556
15284
|
return {
|
|
16557
15285
|
type: "array",
|
|
16558
15286
|
maxItems: 125,
|
|
@@ -16564,7 +15292,7 @@ function parseMapDef5(def, refs) {
|
|
|
16564
15292
|
}
|
|
16565
15293
|
};
|
|
16566
15294
|
}
|
|
16567
|
-
function
|
|
15295
|
+
function parseNativeEnumDef4(def) {
|
|
16568
15296
|
const object5 = def.values;
|
|
16569
15297
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
16570
15298
|
return typeof object5[object5[key]] !== "number";
|
|
@@ -16578,28 +15306,28 @@ function parseNativeEnumDef5(def) {
|
|
|
16578
15306
|
enum: actualValues
|
|
16579
15307
|
};
|
|
16580
15308
|
}
|
|
16581
|
-
function
|
|
16582
|
-
return { not:
|
|
15309
|
+
function parseNeverDef4() {
|
|
15310
|
+
return { not: parseAnyDef4() };
|
|
16583
15311
|
}
|
|
16584
|
-
function
|
|
15312
|
+
function parseNullDef4() {
|
|
16585
15313
|
return {
|
|
16586
15314
|
type: "null"
|
|
16587
15315
|
};
|
|
16588
15316
|
}
|
|
16589
|
-
var
|
|
15317
|
+
var primitiveMappings4 = {
|
|
16590
15318
|
ZodString: "string",
|
|
16591
15319
|
ZodNumber: "number",
|
|
16592
15320
|
ZodBigInt: "integer",
|
|
16593
15321
|
ZodBoolean: "boolean",
|
|
16594
15322
|
ZodNull: "null"
|
|
16595
15323
|
};
|
|
16596
|
-
function
|
|
15324
|
+
function parseUnionDef4(def, refs) {
|
|
16597
15325
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
16598
15326
|
if (options.every(
|
|
16599
|
-
(x) => x._def.typeName in
|
|
15327
|
+
(x) => x._def.typeName in primitiveMappings4 && (!x._def.checks || !x._def.checks.length)
|
|
16600
15328
|
)) {
|
|
16601
15329
|
const types = options.reduce((types2, x) => {
|
|
16602
|
-
const type =
|
|
15330
|
+
const type = primitiveMappings4[x._def.typeName];
|
|
16603
15331
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
16604
15332
|
}, []);
|
|
16605
15333
|
return {
|
|
@@ -16651,11 +15379,11 @@ function parseUnionDef5(def, refs) {
|
|
|
16651
15379
|
)
|
|
16652
15380
|
};
|
|
16653
15381
|
}
|
|
16654
|
-
return
|
|
15382
|
+
return asAnyOf4(def, refs);
|
|
16655
15383
|
}
|
|
16656
|
-
var
|
|
15384
|
+
var asAnyOf4 = (def, refs) => {
|
|
16657
15385
|
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
16658
|
-
(x, i) =>
|
|
15386
|
+
(x, i) => parseDef4(x._def, {
|
|
16659
15387
|
...refs,
|
|
16660
15388
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
16661
15389
|
})
|
|
@@ -16664,24 +15392,24 @@ var asAnyOf5 = (def, refs) => {
|
|
|
16664
15392
|
);
|
|
16665
15393
|
return anyOf.length ? { anyOf } : void 0;
|
|
16666
15394
|
};
|
|
16667
|
-
function
|
|
15395
|
+
function parseNullableDef4(def, refs) {
|
|
16668
15396
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
16669
15397
|
def.innerType._def.typeName
|
|
16670
15398
|
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
16671
15399
|
return {
|
|
16672
15400
|
type: [
|
|
16673
|
-
|
|
15401
|
+
primitiveMappings4[def.innerType._def.typeName],
|
|
16674
15402
|
"null"
|
|
16675
15403
|
]
|
|
16676
15404
|
};
|
|
16677
15405
|
}
|
|
16678
|
-
const base =
|
|
15406
|
+
const base = parseDef4(def.innerType._def, {
|
|
16679
15407
|
...refs,
|
|
16680
15408
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
16681
15409
|
});
|
|
16682
15410
|
return base && { anyOf: [base, { type: "null" }] };
|
|
16683
15411
|
}
|
|
16684
|
-
function
|
|
15412
|
+
function parseNumberDef4(def) {
|
|
16685
15413
|
const res = {
|
|
16686
15414
|
type: "number"
|
|
16687
15415
|
};
|
|
@@ -16712,7 +15440,7 @@ function parseNumberDef5(def) {
|
|
|
16712
15440
|
}
|
|
16713
15441
|
return res;
|
|
16714
15442
|
}
|
|
16715
|
-
function
|
|
15443
|
+
function parseObjectDef4(def, refs) {
|
|
16716
15444
|
const result = {
|
|
16717
15445
|
type: "object",
|
|
16718
15446
|
properties: {}
|
|
@@ -16724,8 +15452,8 @@ function parseObjectDef5(def, refs) {
|
|
|
16724
15452
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
16725
15453
|
continue;
|
|
16726
15454
|
}
|
|
16727
|
-
const propOptional =
|
|
16728
|
-
const parsedDef =
|
|
15455
|
+
const propOptional = safeIsOptional4(propDef);
|
|
15456
|
+
const parsedDef = parseDef4(propDef._def, {
|
|
16729
15457
|
...refs,
|
|
16730
15458
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
16731
15459
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -16741,15 +15469,15 @@ function parseObjectDef5(def, refs) {
|
|
|
16741
15469
|
if (required.length) {
|
|
16742
15470
|
result.required = required;
|
|
16743
15471
|
}
|
|
16744
|
-
const additionalProperties =
|
|
15472
|
+
const additionalProperties = decideAdditionalProperties4(def, refs);
|
|
16745
15473
|
if (additionalProperties !== void 0) {
|
|
16746
15474
|
result.additionalProperties = additionalProperties;
|
|
16747
15475
|
}
|
|
16748
15476
|
return result;
|
|
16749
15477
|
}
|
|
16750
|
-
function
|
|
15478
|
+
function decideAdditionalProperties4(def, refs) {
|
|
16751
15479
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
16752
|
-
return
|
|
15480
|
+
return parseDef4(def.catchall._def, {
|
|
16753
15481
|
...refs,
|
|
16754
15482
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
16755
15483
|
});
|
|
@@ -16763,35 +15491,35 @@ function decideAdditionalProperties5(def, refs) {
|
|
|
16763
15491
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
16764
15492
|
}
|
|
16765
15493
|
}
|
|
16766
|
-
function
|
|
15494
|
+
function safeIsOptional4(schema) {
|
|
16767
15495
|
try {
|
|
16768
15496
|
return schema.isOptional();
|
|
16769
15497
|
} catch (e2) {
|
|
16770
15498
|
return true;
|
|
16771
15499
|
}
|
|
16772
15500
|
}
|
|
16773
|
-
var
|
|
15501
|
+
var parseOptionalDef4 = (def, refs) => {
|
|
16774
15502
|
var _a26;
|
|
16775
15503
|
if (refs.currentPath.toString() === ((_a26 = refs.propertyPath) == null ? void 0 : _a26.toString())) {
|
|
16776
|
-
return
|
|
15504
|
+
return parseDef4(def.innerType._def, refs);
|
|
16777
15505
|
}
|
|
16778
|
-
const innerSchema =
|
|
15506
|
+
const innerSchema = parseDef4(def.innerType._def, {
|
|
16779
15507
|
...refs,
|
|
16780
15508
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
16781
15509
|
});
|
|
16782
|
-
return innerSchema ? { anyOf: [{ not:
|
|
15510
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef4() }, innerSchema] } : parseAnyDef4();
|
|
16783
15511
|
};
|
|
16784
|
-
var
|
|
15512
|
+
var parsePipelineDef4 = (def, refs) => {
|
|
16785
15513
|
if (refs.pipeStrategy === "input") {
|
|
16786
|
-
return
|
|
15514
|
+
return parseDef4(def.in._def, refs);
|
|
16787
15515
|
} else if (refs.pipeStrategy === "output") {
|
|
16788
|
-
return
|
|
15516
|
+
return parseDef4(def.out._def, refs);
|
|
16789
15517
|
}
|
|
16790
|
-
const a =
|
|
15518
|
+
const a = parseDef4(def.in._def, {
|
|
16791
15519
|
...refs,
|
|
16792
15520
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
16793
15521
|
});
|
|
16794
|
-
const b =
|
|
15522
|
+
const b = parseDef4(def.out._def, {
|
|
16795
15523
|
...refs,
|
|
16796
15524
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
16797
15525
|
});
|
|
@@ -16799,11 +15527,11 @@ var parsePipelineDef5 = (def, refs) => {
|
|
|
16799
15527
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
16800
15528
|
};
|
|
16801
15529
|
};
|
|
16802
|
-
function
|
|
16803
|
-
return
|
|
15530
|
+
function parsePromiseDef4(def, refs) {
|
|
15531
|
+
return parseDef4(def.type._def, refs);
|
|
16804
15532
|
}
|
|
16805
|
-
function
|
|
16806
|
-
const items =
|
|
15533
|
+
function parseSetDef4(def, refs) {
|
|
15534
|
+
const items = parseDef4(def.valueType._def, {
|
|
16807
15535
|
...refs,
|
|
16808
15536
|
currentPath: [...refs.currentPath, "items"]
|
|
16809
15537
|
});
|
|
@@ -16820,13 +15548,13 @@ function parseSetDef5(def, refs) {
|
|
|
16820
15548
|
}
|
|
16821
15549
|
return schema;
|
|
16822
15550
|
}
|
|
16823
|
-
function
|
|
15551
|
+
function parseTupleDef4(def, refs) {
|
|
16824
15552
|
if (def.rest) {
|
|
16825
15553
|
return {
|
|
16826
15554
|
type: "array",
|
|
16827
15555
|
minItems: def.items.length,
|
|
16828
15556
|
items: def.items.map(
|
|
16829
|
-
(x, i) =>
|
|
15557
|
+
(x, i) => parseDef4(x._def, {
|
|
16830
15558
|
...refs,
|
|
16831
15559
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
16832
15560
|
})
|
|
@@ -16834,7 +15562,7 @@ function parseTupleDef5(def, refs) {
|
|
|
16834
15562
|
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
16835
15563
|
[]
|
|
16836
15564
|
),
|
|
16837
|
-
additionalItems:
|
|
15565
|
+
additionalItems: parseDef4(def.rest._def, {
|
|
16838
15566
|
...refs,
|
|
16839
15567
|
currentPath: [...refs.currentPath, "additionalItems"]
|
|
16840
15568
|
})
|
|
@@ -16845,7 +15573,7 @@ function parseTupleDef5(def, refs) {
|
|
|
16845
15573
|
minItems: def.items.length,
|
|
16846
15574
|
maxItems: def.items.length,
|
|
16847
15575
|
items: def.items.map(
|
|
16848
|
-
(x, i) =>
|
|
15576
|
+
(x, i) => parseDef4(x._def, {
|
|
16849
15577
|
...refs,
|
|
16850
15578
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
16851
15579
|
})
|
|
@@ -16856,83 +15584,83 @@ function parseTupleDef5(def, refs) {
|
|
|
16856
15584
|
};
|
|
16857
15585
|
}
|
|
16858
15586
|
}
|
|
16859
|
-
function
|
|
15587
|
+
function parseUndefinedDef4() {
|
|
16860
15588
|
return {
|
|
16861
|
-
not:
|
|
15589
|
+
not: parseAnyDef4()
|
|
16862
15590
|
};
|
|
16863
15591
|
}
|
|
16864
|
-
function
|
|
16865
|
-
return
|
|
15592
|
+
function parseUnknownDef4() {
|
|
15593
|
+
return parseAnyDef4();
|
|
16866
15594
|
}
|
|
16867
|
-
var
|
|
16868
|
-
return
|
|
15595
|
+
var parseReadonlyDef4 = (def, refs) => {
|
|
15596
|
+
return parseDef4(def.innerType._def, refs);
|
|
16869
15597
|
};
|
|
16870
|
-
var
|
|
15598
|
+
var selectParser4 = (def, typeName, refs) => {
|
|
16871
15599
|
switch (typeName) {
|
|
16872
15600
|
case v3.ZodFirstPartyTypeKind.ZodString:
|
|
16873
|
-
return
|
|
15601
|
+
return parseStringDef4(def, refs);
|
|
16874
15602
|
case v3.ZodFirstPartyTypeKind.ZodNumber:
|
|
16875
|
-
return
|
|
15603
|
+
return parseNumberDef4(def);
|
|
16876
15604
|
case v3.ZodFirstPartyTypeKind.ZodObject:
|
|
16877
|
-
return
|
|
15605
|
+
return parseObjectDef4(def, refs);
|
|
16878
15606
|
case v3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
16879
|
-
return
|
|
15607
|
+
return parseBigintDef4(def);
|
|
16880
15608
|
case v3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
16881
|
-
return
|
|
15609
|
+
return parseBooleanDef4();
|
|
16882
15610
|
case v3.ZodFirstPartyTypeKind.ZodDate:
|
|
16883
|
-
return
|
|
15611
|
+
return parseDateDef4(def, refs);
|
|
16884
15612
|
case v3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
16885
|
-
return
|
|
15613
|
+
return parseUndefinedDef4();
|
|
16886
15614
|
case v3.ZodFirstPartyTypeKind.ZodNull:
|
|
16887
|
-
return
|
|
15615
|
+
return parseNullDef4();
|
|
16888
15616
|
case v3.ZodFirstPartyTypeKind.ZodArray:
|
|
16889
|
-
return
|
|
15617
|
+
return parseArrayDef4(def, refs);
|
|
16890
15618
|
case v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
16891
15619
|
case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
16892
|
-
return
|
|
15620
|
+
return parseUnionDef4(def, refs);
|
|
16893
15621
|
case v3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
16894
|
-
return
|
|
15622
|
+
return parseIntersectionDef4(def, refs);
|
|
16895
15623
|
case v3.ZodFirstPartyTypeKind.ZodTuple:
|
|
16896
|
-
return
|
|
15624
|
+
return parseTupleDef4(def, refs);
|
|
16897
15625
|
case v3.ZodFirstPartyTypeKind.ZodRecord:
|
|
16898
|
-
return
|
|
15626
|
+
return parseRecordDef4(def, refs);
|
|
16899
15627
|
case v3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
16900
|
-
return
|
|
15628
|
+
return parseLiteralDef4(def);
|
|
16901
15629
|
case v3.ZodFirstPartyTypeKind.ZodEnum:
|
|
16902
|
-
return
|
|
15630
|
+
return parseEnumDef4(def);
|
|
16903
15631
|
case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
16904
|
-
return
|
|
15632
|
+
return parseNativeEnumDef4(def);
|
|
16905
15633
|
case v3.ZodFirstPartyTypeKind.ZodNullable:
|
|
16906
|
-
return
|
|
15634
|
+
return parseNullableDef4(def, refs);
|
|
16907
15635
|
case v3.ZodFirstPartyTypeKind.ZodOptional:
|
|
16908
|
-
return
|
|
15636
|
+
return parseOptionalDef4(def, refs);
|
|
16909
15637
|
case v3.ZodFirstPartyTypeKind.ZodMap:
|
|
16910
|
-
return
|
|
15638
|
+
return parseMapDef4(def, refs);
|
|
16911
15639
|
case v3.ZodFirstPartyTypeKind.ZodSet:
|
|
16912
|
-
return
|
|
15640
|
+
return parseSetDef4(def, refs);
|
|
16913
15641
|
case v3.ZodFirstPartyTypeKind.ZodLazy:
|
|
16914
15642
|
return () => def.getter()._def;
|
|
16915
15643
|
case v3.ZodFirstPartyTypeKind.ZodPromise:
|
|
16916
|
-
return
|
|
15644
|
+
return parsePromiseDef4(def, refs);
|
|
16917
15645
|
case v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
16918
15646
|
case v3.ZodFirstPartyTypeKind.ZodNever:
|
|
16919
|
-
return
|
|
15647
|
+
return parseNeverDef4();
|
|
16920
15648
|
case v3.ZodFirstPartyTypeKind.ZodEffects:
|
|
16921
|
-
return
|
|
15649
|
+
return parseEffectsDef4(def, refs);
|
|
16922
15650
|
case v3.ZodFirstPartyTypeKind.ZodAny:
|
|
16923
|
-
return
|
|
15651
|
+
return parseAnyDef4();
|
|
16924
15652
|
case v3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
16925
|
-
return
|
|
15653
|
+
return parseUnknownDef4();
|
|
16926
15654
|
case v3.ZodFirstPartyTypeKind.ZodDefault:
|
|
16927
|
-
return
|
|
15655
|
+
return parseDefaultDef4(def, refs);
|
|
16928
15656
|
case v3.ZodFirstPartyTypeKind.ZodBranded:
|
|
16929
|
-
return
|
|
15657
|
+
return parseBrandedDef4(def, refs);
|
|
16930
15658
|
case v3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
16931
|
-
return
|
|
15659
|
+
return parseReadonlyDef4(def, refs);
|
|
16932
15660
|
case v3.ZodFirstPartyTypeKind.ZodCatch:
|
|
16933
|
-
return
|
|
15661
|
+
return parseCatchDef4(def, refs);
|
|
16934
15662
|
case v3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
16935
|
-
return
|
|
15663
|
+
return parsePipelineDef4(def, refs);
|
|
16936
15664
|
case v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
16937
15665
|
case v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
16938
15666
|
case v3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
@@ -16941,7 +15669,7 @@ var selectParser5 = (def, typeName, refs) => {
|
|
|
16941
15669
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
16942
15670
|
}
|
|
16943
15671
|
};
|
|
16944
|
-
function
|
|
15672
|
+
function parseDef4(def, refs, forceResolution = false) {
|
|
16945
15673
|
var _a26;
|
|
16946
15674
|
const seenItem = refs.seen.get(def);
|
|
16947
15675
|
if (refs.override) {
|
|
@@ -16952,22 +15680,22 @@ function parseDef5(def, refs, forceResolution = false) {
|
|
|
16952
15680
|
seenItem,
|
|
16953
15681
|
forceResolution
|
|
16954
15682
|
);
|
|
16955
|
-
if (overrideResult !==
|
|
15683
|
+
if (overrideResult !== ignoreOverride4) {
|
|
16956
15684
|
return overrideResult;
|
|
16957
15685
|
}
|
|
16958
15686
|
}
|
|
16959
15687
|
if (seenItem && !forceResolution) {
|
|
16960
|
-
const seenSchema = get$
|
|
15688
|
+
const seenSchema = get$ref4(seenItem, refs);
|
|
16961
15689
|
if (seenSchema !== void 0) {
|
|
16962
15690
|
return seenSchema;
|
|
16963
15691
|
}
|
|
16964
15692
|
}
|
|
16965
15693
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
16966
15694
|
refs.seen.set(def, newItem);
|
|
16967
|
-
const jsonSchemaOrGetter =
|
|
16968
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
15695
|
+
const jsonSchemaOrGetter = selectParser4(def, def.typeName, refs);
|
|
15696
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef4(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
16969
15697
|
if (jsonSchema22) {
|
|
16970
|
-
|
|
15698
|
+
addMeta4(def, refs, jsonSchema22);
|
|
16971
15699
|
}
|
|
16972
15700
|
if (refs.postProcess) {
|
|
16973
15701
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -16977,12 +15705,12 @@ function parseDef5(def, refs, forceResolution = false) {
|
|
|
16977
15705
|
newItem.jsonSchema = jsonSchema22;
|
|
16978
15706
|
return jsonSchema22;
|
|
16979
15707
|
}
|
|
16980
|
-
var get$
|
|
15708
|
+
var get$ref4 = (item, refs) => {
|
|
16981
15709
|
switch (refs.$refStrategy) {
|
|
16982
15710
|
case "root":
|
|
16983
15711
|
return { $ref: item.path.join("/") };
|
|
16984
15712
|
case "relative":
|
|
16985
|
-
return { $ref:
|
|
15713
|
+
return { $ref: getRelativePath4(refs.currentPath, item.path) };
|
|
16986
15714
|
case "none":
|
|
16987
15715
|
case "seen": {
|
|
16988
15716
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
@@ -16991,20 +15719,20 @@ var get$ref5 = (item, refs) => {
|
|
|
16991
15719
|
"/"
|
|
16992
15720
|
)}! Defaulting to any`
|
|
16993
15721
|
);
|
|
16994
|
-
return
|
|
15722
|
+
return parseAnyDef4();
|
|
16995
15723
|
}
|
|
16996
|
-
return refs.$refStrategy === "seen" ?
|
|
15724
|
+
return refs.$refStrategy === "seen" ? parseAnyDef4() : void 0;
|
|
16997
15725
|
}
|
|
16998
15726
|
}
|
|
16999
15727
|
};
|
|
17000
|
-
var
|
|
15728
|
+
var addMeta4 = (def, refs, jsonSchema22) => {
|
|
17001
15729
|
if (def.description) {
|
|
17002
15730
|
jsonSchema22.description = def.description;
|
|
17003
15731
|
}
|
|
17004
15732
|
return jsonSchema22;
|
|
17005
15733
|
};
|
|
17006
|
-
var
|
|
17007
|
-
const _options =
|
|
15734
|
+
var getRefs4 = (options) => {
|
|
15735
|
+
const _options = getDefaultOptions4(options);
|
|
17008
15736
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
17009
15737
|
return {
|
|
17010
15738
|
..._options,
|
|
@@ -17023,35 +15751,35 @@ var getRefs5 = (options) => {
|
|
|
17023
15751
|
)
|
|
17024
15752
|
};
|
|
17025
15753
|
};
|
|
17026
|
-
var
|
|
15754
|
+
var zodToJsonSchema4 = (schema, options) => {
|
|
17027
15755
|
var _a26;
|
|
17028
|
-
const refs =
|
|
15756
|
+
const refs = getRefs4(options);
|
|
17029
15757
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
17030
15758
|
(acc, [name26, schema2]) => {
|
|
17031
15759
|
var _a27;
|
|
17032
15760
|
return {
|
|
17033
15761
|
...acc,
|
|
17034
|
-
[name26]: (_a27 =
|
|
15762
|
+
[name26]: (_a27 = parseDef4(
|
|
17035
15763
|
schema2._def,
|
|
17036
15764
|
{
|
|
17037
15765
|
...refs,
|
|
17038
15766
|
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
17039
15767
|
},
|
|
17040
15768
|
true
|
|
17041
|
-
)) != null ? _a27 :
|
|
15769
|
+
)) != null ? _a27 : parseAnyDef4()
|
|
17042
15770
|
};
|
|
17043
15771
|
},
|
|
17044
15772
|
{}
|
|
17045
15773
|
) : void 0;
|
|
17046
15774
|
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
17047
|
-
const main = (_a26 =
|
|
15775
|
+
const main = (_a26 = parseDef4(
|
|
17048
15776
|
schema._def,
|
|
17049
15777
|
name21 === void 0 ? refs : {
|
|
17050
15778
|
...refs,
|
|
17051
15779
|
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
17052
15780
|
},
|
|
17053
15781
|
false
|
|
17054
|
-
)) != null ? _a26 :
|
|
15782
|
+
)) != null ? _a26 : parseAnyDef4();
|
|
17055
15783
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
17056
15784
|
if (title !== void 0) {
|
|
17057
15785
|
main.title = title;
|
|
@@ -17073,7 +15801,7 @@ var zodToJsonSchema5 = (schema, options) => {
|
|
|
17073
15801
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
17074
15802
|
return combined;
|
|
17075
15803
|
};
|
|
17076
|
-
var zod_to_json_schema_default2 =
|
|
15804
|
+
var zod_to_json_schema_default2 = zodToJsonSchema4;
|
|
17077
15805
|
function zod3Schema2(zodSchema22, options) {
|
|
17078
15806
|
var _a26;
|
|
17079
15807
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
@@ -24536,5 +23264,5 @@ exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
|
|
|
24536
23264
|
exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
|
|
24537
23265
|
exports.STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE = STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE;
|
|
24538
23266
|
exports.agent_builder_exports = agent_builder_exports;
|
|
24539
|
-
//# sourceMappingURL=chunk-
|
|
24540
|
-
//# sourceMappingURL=chunk-
|
|
23267
|
+
//# sourceMappingURL=chunk-VD3WO2TJ.cjs.map
|
|
23268
|
+
//# sourceMappingURL=chunk-VD3WO2TJ.cjs.map
|