@mastra/server 1.0.0-beta.6 → 1.0.0-beta.7
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 +57 -0
- package/dist/{chunk-FCCK5TSS.js → chunk-3SFLFUKY.js} +3 -3
- package/dist/{chunk-FCCK5TSS.js.map → chunk-3SFLFUKY.js.map} +1 -1
- package/dist/{chunk-G7BPNX2V.js → chunk-6YWE7UPT.js} +16 -3
- package/dist/chunk-6YWE7UPT.js.map +1 -0
- package/dist/{chunk-ORJBWSYB.js → chunk-7N3PD4SV.js} +3 -3
- package/dist/{chunk-ORJBWSYB.js.map → chunk-7N3PD4SV.js.map} +1 -1
- package/dist/{chunk-SNPELBJA.cjs → chunk-C3D3X2L5.cjs} +5 -5
- package/dist/{chunk-SNPELBJA.cjs.map → chunk-C3D3X2L5.cjs.map} +1 -1
- package/dist/{chunk-OSLIOPFU.js → chunk-C4J473OZ.js} +44 -35
- package/dist/chunk-C4J473OZ.js.map +1 -0
- package/dist/{chunk-CQDHE64H.js → chunk-CT5VG7NT.js} +3 -3
- package/dist/{chunk-CQDHE64H.js.map → chunk-CT5VG7NT.js.map} +1 -1
- package/dist/{chunk-Z4GN2JAO.cjs → chunk-DHWPHLGF.cjs} +16 -16
- package/dist/{chunk-Z4GN2JAO.cjs.map → chunk-DHWPHLGF.cjs.map} +1 -1
- package/dist/{chunk-7MKJBWFB.js → chunk-DRUNNM4C.js} +3 -3
- package/dist/{chunk-7MKJBWFB.js.map → chunk-DRUNNM4C.js.map} +1 -1
- package/dist/{chunk-QS23OV2B.cjs → chunk-ESZ6V5WB.cjs} +10 -10
- package/dist/{chunk-QS23OV2B.cjs.map → chunk-ESZ6V5WB.cjs.map} +1 -1
- package/dist/{chunk-5772SXSK.cjs → chunk-F4H7J6YV.cjs} +55 -45
- package/dist/chunk-F4H7J6YV.cjs.map +1 -0
- package/dist/{chunk-777BJH4Z.cjs → chunk-FMTSLS25.cjs} +95 -86
- package/dist/chunk-FMTSLS25.cjs.map +1 -0
- package/dist/{chunk-C36PTNGG.js → chunk-FYY54HZC.js} +3 -3
- package/dist/{chunk-C36PTNGG.js.map → chunk-FYY54HZC.js.map} +1 -1
- package/dist/{chunk-TIX6M3ZD.js → chunk-GFF2I6UD.js} +3 -3
- package/dist/{chunk-TIX6M3ZD.js.map → chunk-GFF2I6UD.js.map} +1 -1
- package/dist/{chunk-PKRHEXX7.js → chunk-HT4LP3BO.js} +19 -18
- package/dist/chunk-HT4LP3BO.js.map +1 -0
- package/dist/{chunk-CLRYA4BH.cjs → chunk-I6LR6CPC.cjs} +6 -6
- package/dist/{chunk-CLRYA4BH.cjs.map → chunk-I6LR6CPC.cjs.map} +1 -1
- package/dist/{chunk-QCW6WANZ.cjs → chunk-LBSJWPXK.cjs} +28 -12
- package/dist/chunk-LBSJWPXK.cjs.map +1 -0
- package/dist/{chunk-2NW6POYK.cjs → chunk-MCYD5LW7.cjs} +19 -18
- package/dist/chunk-MCYD5LW7.cjs.map +1 -0
- package/dist/{chunk-MK6GBMKE.js → chunk-OL6U27XK.js} +2039 -767
- package/dist/chunk-OL6U27XK.js.map +1 -0
- package/dist/{chunk-UZ6CYAOG.cjs → chunk-PUSD37LD.cjs} +16 -3
- package/dist/chunk-PUSD37LD.cjs.map +1 -0
- package/dist/{chunk-XMKZWHVG.js → chunk-QNVYGEJ4.js} +4 -4
- package/dist/{chunk-XMKZWHVG.js.map → chunk-QNVYGEJ4.js.map} +1 -1
- package/dist/{chunk-TOUBNMVI.cjs → chunk-S3TIWWQL.cjs} +5 -5
- package/dist/{chunk-TOUBNMVI.cjs.map → chunk-S3TIWWQL.cjs.map} +1 -1
- package/dist/{chunk-B4UYPCEY.js → chunk-TKL4TD2V.js} +27 -17
- package/dist/chunk-TKL4TD2V.js.map +1 -0
- package/dist/{chunk-IO7XB4XH.cjs → chunk-TWZCZKUD.cjs} +2145 -873
- package/dist/chunk-TWZCZKUD.cjs.map +1 -0
- package/dist/{chunk-TT25WHVT.cjs → chunk-TYZ6ZISQ.cjs} +6 -6
- package/dist/{chunk-TT25WHVT.cjs.map → chunk-TYZ6ZISQ.cjs.map} +1 -1
- package/dist/{chunk-UPY7WWRA.cjs → chunk-US6Y5RLR.cjs} +21 -21
- package/dist/{chunk-UPY7WWRA.cjs.map → chunk-US6Y5RLR.cjs.map} +1 -1
- package/dist/{chunk-WISPJOEJ.js → chunk-UTIOKR5C.js} +3 -3
- package/dist/{chunk-WISPJOEJ.js.map → chunk-UTIOKR5C.js.map} +1 -1
- package/dist/{chunk-R4M3BSUG.js → chunk-WE4USCF3.js} +3 -3
- package/dist/{chunk-R4M3BSUG.js.map → chunk-WE4USCF3.js.map} +1 -1
- package/dist/{chunk-SWIK2QSP.cjs → chunk-X43DWDXB.cjs} +5 -5
- package/dist/{chunk-SWIK2QSP.cjs.map → chunk-X43DWDXB.cjs.map} +1 -1
- package/dist/{chunk-MWQQRVQC.cjs → chunk-X4QMPCTP.cjs} +7 -7
- package/dist/{chunk-MWQQRVQC.cjs.map → chunk-X4QMPCTP.cjs.map} +1 -1
- package/dist/{chunk-VJVDLNFK.js → chunk-XNKZPXCY.js} +28 -12
- package/dist/chunk-XNKZPXCY.js.map +1 -0
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +19 -19
- package/dist/server/handlers/agent-builder.d.ts +9 -25
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +23 -23
- package/dist/server/handlers/agents.d.ts +4 -2
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/mcp.cjs +9 -9
- package/dist/server/handlers/mcp.d.ts +3 -1
- package/dist/server/handlers/mcp.d.ts.map +1 -1
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/memory.cjs +24 -24
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +9 -9
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vector.cjs +13 -13
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +26 -26
- package/dist/server/handlers/workflows.d.ts +278 -291
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +24 -24
- package/dist/server/handlers.js +12 -12
- package/dist/server/schemas/common.d.ts +29 -15
- package/dist/server/schemas/common.d.ts.map +1 -1
- package/dist/server/schemas/mcp.d.ts +9 -3
- package/dist/server/schemas/mcp.d.ts.map +1 -1
- package/dist/server/schemas/workflows.d.ts +11 -26
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +136 -136
- package/dist/server/server-adapter/index.js +13 -13
- package/dist/server/utils.d.ts +1 -1
- package/dist/server/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-2NW6POYK.cjs.map +0 -1
- package/dist/chunk-5772SXSK.cjs.map +0 -1
- package/dist/chunk-777BJH4Z.cjs.map +0 -1
- package/dist/chunk-B4UYPCEY.js.map +0 -1
- package/dist/chunk-G7BPNX2V.js.map +0 -1
- package/dist/chunk-IO7XB4XH.cjs.map +0 -1
- package/dist/chunk-MK6GBMKE.js.map +0 -1
- package/dist/chunk-OSLIOPFU.js.map +0 -1
- package/dist/chunk-PKRHEXX7.js.map +0 -1
- package/dist/chunk-QCW6WANZ.cjs.map +0 -1
- package/dist/chunk-UZ6CYAOG.cjs.map +0 -1
- package/dist/chunk-VJVDLNFK.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { listWorkflowsResponseSchema, LIST_WORKFLOWS_ROUTE, workflowInfoSchema, GET_WORKFLOW_BY_ID_ROUTE, workflowRunsResponseSchema, listWorkflowRunsQuerySchema, LIST_WORKFLOW_RUNS_ROUTE, workflowRunResponseSchema, GET_WORKFLOW_RUN_BY_ID_ROUTE, workflowExecutionResultSchema, GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE, createWorkflowRunResponseSchema, CREATE_WORKFLOW_RUN_ROUTE, streamWorkflowBodySchema, STREAM_WORKFLOW_ROUTE, STREAM_VNEXT_WORKFLOW_ROUTE, startAsyncWorkflowBodySchema, START_ASYNC_WORKFLOW_ROUTE, workflowControlResponseSchema, START_WORKFLOW_RUN_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE, resumeBodySchema, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, CANCEL_WORKFLOW_RUN_ROUTE, streamLegacyWorkflowBodySchema, STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE } from './chunk-
|
|
1
|
+
import { listWorkflowsResponseSchema, LIST_WORKFLOWS_ROUTE, workflowInfoSchema, GET_WORKFLOW_BY_ID_ROUTE, workflowRunsResponseSchema, listWorkflowRunsQuerySchema, LIST_WORKFLOW_RUNS_ROUTE, workflowRunResponseSchema, GET_WORKFLOW_RUN_BY_ID_ROUTE, workflowExecutionResultSchema, GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE, createWorkflowRunResponseSchema, CREATE_WORKFLOW_RUN_ROUTE, streamWorkflowBodySchema, STREAM_WORKFLOW_ROUTE, STREAM_VNEXT_WORKFLOW_ROUTE, startAsyncWorkflowBodySchema, START_ASYNC_WORKFLOW_ROUTE, workflowControlResponseSchema, START_WORKFLOW_RUN_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE, resumeBodySchema, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, CANCEL_WORKFLOW_RUN_ROUTE, streamLegacyWorkflowBodySchema, STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE } from './chunk-TKL4TD2V.js';
|
|
2
2
|
import { require_token_error } from './chunk-ER3QM7DD.js';
|
|
3
3
|
import { openai } from './chunk-ZULZ2752.js';
|
|
4
4
|
import { createIdGenerator, AISDKError, isAbortError, getErrorMessage, APICallError, delay, safeParseJSON, safeValidateTypes, convertAsyncIteratorToReadableStream, validatorSymbol } from './chunk-RQK4FQUD.js';
|
|
5
|
-
import { WorkflowRegistry } from './chunk-
|
|
6
|
-
import { streamResponseSchema } from './chunk-
|
|
7
|
-
import { optionalRunIdSchema, runIdSchema } from './chunk-
|
|
5
|
+
import { WorkflowRegistry } from './chunk-6YWE7UPT.js';
|
|
6
|
+
import { streamResponseSchema } from './chunk-WE4USCF3.js';
|
|
7
|
+
import { optionalRunIdSchema, runIdSchema } from './chunk-HT4LP3BO.js';
|
|
8
8
|
import { createRoute } from './chunk-SXVANU23.js';
|
|
9
9
|
import { handleError } from './chunk-UXGQZUYZ.js';
|
|
10
10
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
@@ -13,9 +13,9 @@ import { Agent, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, MessageL
|
|
|
13
13
|
import { MastraMemory } from '@mastra/core/memory';
|
|
14
14
|
import { generateEmptyFromSchema } from '@mastra/core/utils';
|
|
15
15
|
import z19, { z, ZodObject, ZodFirstPartyTypeKind } from 'zod';
|
|
16
|
+
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1 } from 'zod/v3';
|
|
16
17
|
import * as z42 from 'zod/v4';
|
|
17
18
|
import { z as z$1 } from 'zod/v4';
|
|
18
|
-
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1 } from 'zod/v3';
|
|
19
19
|
import { createTool } from '@mastra/core/tools';
|
|
20
20
|
import { exec as exec$1, execFile as execFile$1, spawn as spawn$1 } from 'child_process';
|
|
21
21
|
import { mkdtemp, rm, readFile, writeFile, mkdir, copyFile, readdir, stat } from 'fs/promises';
|
|
@@ -1981,135 +1981,1407 @@ function zodToJsonSchema2(zodSchema5, target = "jsonSchema7", strategy = "relati
|
|
|
1981
1981
|
});
|
|
1982
1982
|
}
|
|
1983
1983
|
}
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
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
|
-
break;
|
|
2036
|
-
}
|
|
2037
|
-
case "[": {
|
|
2038
|
-
lastValidIndex = i;
|
|
2039
|
-
stack.pop();
|
|
2040
|
-
stack.push(swapState);
|
|
2041
|
-
stack.push("INSIDE_ARRAY_START");
|
|
2042
|
-
break;
|
|
2043
|
-
}
|
|
1984
|
+
|
|
1985
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
1986
|
+
var ignoreOverride2 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
1987
|
+
var defaultOptions2 = {
|
|
1988
|
+
name: void 0,
|
|
1989
|
+
$refStrategy: "root",
|
|
1990
|
+
basePath: ["#"],
|
|
1991
|
+
effectStrategy: "input",
|
|
1992
|
+
pipeStrategy: "all",
|
|
1993
|
+
dateStrategy: "format:date-time",
|
|
1994
|
+
mapStrategy: "entries",
|
|
1995
|
+
removeAdditionalStrategy: "passthrough",
|
|
1996
|
+
allowedAdditionalProperties: true,
|
|
1997
|
+
rejectedAdditionalProperties: false,
|
|
1998
|
+
definitionPath: "definitions",
|
|
1999
|
+
target: "jsonSchema7",
|
|
2000
|
+
strictUnions: false,
|
|
2001
|
+
definitions: {},
|
|
2002
|
+
errorMessages: false,
|
|
2003
|
+
markdownDescription: false,
|
|
2004
|
+
patternStrategy: "escape",
|
|
2005
|
+
applyRegexFlags: false,
|
|
2006
|
+
emailStrategy: "format:email",
|
|
2007
|
+
base64Strategy: "contentEncoding:base64",
|
|
2008
|
+
nameStrategy: "ref",
|
|
2009
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
2010
|
+
};
|
|
2011
|
+
var getDefaultOptions2 = (options) => typeof options === "string" ? {
|
|
2012
|
+
...defaultOptions2,
|
|
2013
|
+
name: options
|
|
2014
|
+
} : {
|
|
2015
|
+
...defaultOptions2,
|
|
2016
|
+
...options
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
2020
|
+
var getRefs2 = (options) => {
|
|
2021
|
+
const _options = getDefaultOptions2(options);
|
|
2022
|
+
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
2023
|
+
return {
|
|
2024
|
+
..._options,
|
|
2025
|
+
flags: { hasReferencedOpenAiAnyType: false },
|
|
2026
|
+
currentPath,
|
|
2027
|
+
propertyPath: void 0,
|
|
2028
|
+
seen: new Map(Object.entries(_options.definitions).map(([name21, def]) => [
|
|
2029
|
+
def._def,
|
|
2030
|
+
{
|
|
2031
|
+
def: def._def,
|
|
2032
|
+
path: [..._options.basePath, _options.definitionPath, name21],
|
|
2033
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
2034
|
+
jsonSchema: void 0
|
|
2044
2035
|
}
|
|
2045
|
-
|
|
2036
|
+
]))
|
|
2037
|
+
};
|
|
2038
|
+
};
|
|
2039
|
+
|
|
2040
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
2041
|
+
function addErrorMessage2(res, key, errorMessage, refs) {
|
|
2042
|
+
if (!refs?.errorMessages)
|
|
2043
|
+
return;
|
|
2044
|
+
if (errorMessage) {
|
|
2045
|
+
res.errorMessage = {
|
|
2046
|
+
...res.errorMessage,
|
|
2047
|
+
[key]: errorMessage
|
|
2048
|
+
};
|
|
2046
2049
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
}
|
|
2050
|
+
}
|
|
2051
|
+
function setResponseValueAndErrors2(res, key, value, errorMessage, refs) {
|
|
2052
|
+
res[key] = value;
|
|
2053
|
+
addErrorMessage2(res, key, errorMessage, refs);
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
2057
|
+
var getRelativePath2 = (pathA, pathB) => {
|
|
2058
|
+
let i = 0;
|
|
2059
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
2060
|
+
if (pathA[i] !== pathB[i])
|
|
2061
|
+
break;
|
|
2060
2062
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
case "]": {
|
|
2069
|
-
lastValidIndex = i;
|
|
2070
|
-
stack.pop();
|
|
2071
|
-
break;
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2063
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
2064
|
+
};
|
|
2065
|
+
|
|
2066
|
+
// ../../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
|
|
2067
|
+
function parseAnyDef2(refs) {
|
|
2068
|
+
if (refs.target !== "openAi") {
|
|
2069
|
+
return {};
|
|
2074
2070
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2071
|
+
const anyDefinitionPath = [
|
|
2072
|
+
...refs.basePath,
|
|
2073
|
+
refs.definitionPath,
|
|
2074
|
+
refs.openAiAnyTypeName
|
|
2075
|
+
];
|
|
2076
|
+
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
2077
|
+
return {
|
|
2078
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath2(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
function parseArrayDef2(def, refs) {
|
|
2082
|
+
const res = {
|
|
2083
|
+
type: "array"
|
|
2084
|
+
};
|
|
2085
|
+
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
2086
|
+
res.items = parseDef2(def.type._def, {
|
|
2087
|
+
...refs,
|
|
2088
|
+
currentPath: [...refs.currentPath, "items"]
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
if (def.minLength) {
|
|
2092
|
+
setResponseValueAndErrors2(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
2093
|
+
}
|
|
2094
|
+
if (def.maxLength) {
|
|
2095
|
+
setResponseValueAndErrors2(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
2096
|
+
}
|
|
2097
|
+
if (def.exactLength) {
|
|
2098
|
+
setResponseValueAndErrors2(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
2099
|
+
setResponseValueAndErrors2(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
2100
|
+
}
|
|
2101
|
+
return res;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
2105
|
+
function parseBigintDef2(def, refs) {
|
|
2106
|
+
const res = {
|
|
2107
|
+
type: "integer",
|
|
2108
|
+
format: "int64"
|
|
2109
|
+
};
|
|
2110
|
+
if (!def.checks)
|
|
2111
|
+
return res;
|
|
2112
|
+
for (const check of def.checks) {
|
|
2113
|
+
switch (check.kind) {
|
|
2114
|
+
case "min":
|
|
2115
|
+
if (refs.target === "jsonSchema7") {
|
|
2116
|
+
if (check.inclusive) {
|
|
2117
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2118
|
+
} else {
|
|
2119
|
+
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
2088
2120
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
break;
|
|
2121
|
+
} else {
|
|
2122
|
+
if (!check.inclusive) {
|
|
2123
|
+
res.exclusiveMinimum = true;
|
|
2093
2124
|
}
|
|
2125
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2094
2126
|
}
|
|
2095
2127
|
break;
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2128
|
+
case "max":
|
|
2129
|
+
if (refs.target === "jsonSchema7") {
|
|
2130
|
+
if (check.inclusive) {
|
|
2131
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2132
|
+
} else {
|
|
2133
|
+
setResponseValueAndErrors2(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
2134
|
+
}
|
|
2135
|
+
} else {
|
|
2136
|
+
if (!check.inclusive) {
|
|
2137
|
+
res.exclusiveMaximum = true;
|
|
2103
2138
|
}
|
|
2139
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2104
2140
|
}
|
|
2105
2141
|
break;
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2142
|
+
case "multipleOf":
|
|
2143
|
+
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
return res;
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
// ../../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
|
|
2151
|
+
function parseBooleanDef2() {
|
|
2152
|
+
return {
|
|
2153
|
+
type: "boolean"
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
// ../../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
|
|
2158
|
+
function parseBrandedDef2(_def, refs) {
|
|
2159
|
+
return parseDef2(_def.type._def, refs);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// ../../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
|
|
2163
|
+
var parseCatchDef2 = (def, refs) => {
|
|
2164
|
+
return parseDef2(def.innerType._def, refs);
|
|
2165
|
+
};
|
|
2166
|
+
|
|
2167
|
+
// ../../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
|
|
2168
|
+
function parseDateDef2(def, refs, overrideDateStrategy) {
|
|
2169
|
+
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
2170
|
+
if (Array.isArray(strategy)) {
|
|
2171
|
+
return {
|
|
2172
|
+
anyOf: strategy.map((item, i) => parseDateDef2(def, refs, item))
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
switch (strategy) {
|
|
2176
|
+
case "string":
|
|
2177
|
+
case "format:date-time":
|
|
2178
|
+
return {
|
|
2179
|
+
type: "string",
|
|
2180
|
+
format: "date-time"
|
|
2181
|
+
};
|
|
2182
|
+
case "format:date":
|
|
2183
|
+
return {
|
|
2184
|
+
type: "string",
|
|
2185
|
+
format: "date"
|
|
2186
|
+
};
|
|
2187
|
+
case "integer":
|
|
2188
|
+
return integerDateParser2(def, refs);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
var integerDateParser2 = (def, refs) => {
|
|
2192
|
+
const res = {
|
|
2193
|
+
type: "integer",
|
|
2194
|
+
format: "unix-time"
|
|
2195
|
+
};
|
|
2196
|
+
if (refs.target === "openApi3") {
|
|
2197
|
+
return res;
|
|
2198
|
+
}
|
|
2199
|
+
for (const check of def.checks) {
|
|
2200
|
+
switch (check.kind) {
|
|
2201
|
+
case "min":
|
|
2202
|
+
setResponseValueAndErrors2(
|
|
2203
|
+
res,
|
|
2204
|
+
"minimum",
|
|
2205
|
+
check.value,
|
|
2206
|
+
// This is in milliseconds
|
|
2207
|
+
check.message,
|
|
2208
|
+
refs
|
|
2209
|
+
);
|
|
2210
|
+
break;
|
|
2211
|
+
case "max":
|
|
2212
|
+
setResponseValueAndErrors2(
|
|
2213
|
+
res,
|
|
2214
|
+
"maximum",
|
|
2215
|
+
check.value,
|
|
2216
|
+
// This is in milliseconds
|
|
2217
|
+
check.message,
|
|
2218
|
+
refs
|
|
2219
|
+
);
|
|
2220
|
+
break;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
return res;
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
// ../../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
|
|
2227
|
+
function parseDefaultDef2(_def, refs) {
|
|
2228
|
+
return {
|
|
2229
|
+
...parseDef2(_def.innerType._def, refs),
|
|
2230
|
+
default: _def.defaultValue()
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
// ../../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
|
|
2235
|
+
function parseEffectsDef2(_def, refs) {
|
|
2236
|
+
return refs.effectStrategy === "input" ? parseDef2(_def.schema._def, refs) : parseAnyDef2(refs);
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
// ../../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
|
|
2240
|
+
function parseEnumDef2(def) {
|
|
2241
|
+
return {
|
|
2242
|
+
type: "string",
|
|
2243
|
+
enum: Array.from(def.values)
|
|
2244
|
+
};
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
// ../../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
|
|
2248
|
+
var isJsonSchema7AllOfType2 = (type) => {
|
|
2249
|
+
if ("type" in type && type.type === "string")
|
|
2250
|
+
return false;
|
|
2251
|
+
return "allOf" in type;
|
|
2252
|
+
};
|
|
2253
|
+
function parseIntersectionDef2(def, refs) {
|
|
2254
|
+
const allOf = [
|
|
2255
|
+
parseDef2(def.left._def, {
|
|
2256
|
+
...refs,
|
|
2257
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
2258
|
+
}),
|
|
2259
|
+
parseDef2(def.right._def, {
|
|
2260
|
+
...refs,
|
|
2261
|
+
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
2262
|
+
})
|
|
2263
|
+
].filter((x) => !!x);
|
|
2264
|
+
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
2265
|
+
const mergedAllOf = [];
|
|
2266
|
+
allOf.forEach((schema) => {
|
|
2267
|
+
if (isJsonSchema7AllOfType2(schema)) {
|
|
2268
|
+
mergedAllOf.push(...schema.allOf);
|
|
2269
|
+
if (schema.unevaluatedProperties === void 0) {
|
|
2270
|
+
unevaluatedProperties = void 0;
|
|
2271
|
+
}
|
|
2272
|
+
} else {
|
|
2273
|
+
let nestedSchema = schema;
|
|
2274
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
2275
|
+
const { additionalProperties, ...rest } = schema;
|
|
2276
|
+
nestedSchema = rest;
|
|
2277
|
+
} else {
|
|
2278
|
+
unevaluatedProperties = void 0;
|
|
2279
|
+
}
|
|
2280
|
+
mergedAllOf.push(nestedSchema);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
return mergedAllOf.length ? {
|
|
2284
|
+
allOf: mergedAllOf,
|
|
2285
|
+
...unevaluatedProperties
|
|
2286
|
+
} : void 0;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
// ../../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
|
|
2290
|
+
function parseLiteralDef2(def, refs) {
|
|
2291
|
+
const parsedType = typeof def.value;
|
|
2292
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
2293
|
+
return {
|
|
2294
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
if (refs.target === "openApi3") {
|
|
2298
|
+
return {
|
|
2299
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
2300
|
+
enum: [def.value]
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
return {
|
|
2304
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
2305
|
+
const: def.value
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
// ../../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
|
|
2310
|
+
var emojiRegex2 = void 0;
|
|
2311
|
+
var zodPatterns2 = {
|
|
2312
|
+
/**
|
|
2313
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
2314
|
+
*/
|
|
2315
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
|
2316
|
+
cuid2: /^[0-9a-z]+$/,
|
|
2317
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
2318
|
+
/**
|
|
2319
|
+
* `a-z` was added to replicate /i flag
|
|
2320
|
+
*/
|
|
2321
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
2322
|
+
/**
|
|
2323
|
+
* Constructed a valid Unicode RegExp
|
|
2324
|
+
*
|
|
2325
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
2326
|
+
* in all envs (e.g. React Native).
|
|
2327
|
+
*
|
|
2328
|
+
* See:
|
|
2329
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
2330
|
+
* Fix in Zod:
|
|
2331
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
2332
|
+
*/
|
|
2333
|
+
emoji: () => {
|
|
2334
|
+
if (emojiRegex2 === void 0) {
|
|
2335
|
+
emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
2336
|
+
}
|
|
2337
|
+
return emojiRegex2;
|
|
2338
|
+
},
|
|
2339
|
+
/**
|
|
2340
|
+
* Unused
|
|
2341
|
+
*/
|
|
2342
|
+
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}$/,
|
|
2343
|
+
/**
|
|
2344
|
+
* Unused
|
|
2345
|
+
*/
|
|
2346
|
+
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])$/,
|
|
2347
|
+
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])$/,
|
|
2348
|
+
/**
|
|
2349
|
+
* Unused
|
|
2350
|
+
*/
|
|
2351
|
+
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})))$/,
|
|
2352
|
+
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])$/,
|
|
2353
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
2354
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
2355
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
2356
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
2357
|
+
};
|
|
2358
|
+
function parseStringDef2(def, refs) {
|
|
2359
|
+
const res = {
|
|
2360
|
+
type: "string"
|
|
2361
|
+
};
|
|
2362
|
+
if (def.checks) {
|
|
2363
|
+
for (const check of def.checks) {
|
|
2364
|
+
switch (check.kind) {
|
|
2365
|
+
case "min":
|
|
2366
|
+
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
2367
|
+
break;
|
|
2368
|
+
case "max":
|
|
2369
|
+
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
2370
|
+
break;
|
|
2371
|
+
case "email":
|
|
2372
|
+
switch (refs.emailStrategy) {
|
|
2373
|
+
case "format:email":
|
|
2374
|
+
addFormat2(res, "email", check.message, refs);
|
|
2375
|
+
break;
|
|
2376
|
+
case "format:idn-email":
|
|
2377
|
+
addFormat2(res, "idn-email", check.message, refs);
|
|
2378
|
+
break;
|
|
2379
|
+
case "pattern:zod":
|
|
2380
|
+
addPattern2(res, zodPatterns2.email, check.message, refs);
|
|
2381
|
+
break;
|
|
2382
|
+
}
|
|
2383
|
+
break;
|
|
2384
|
+
case "url":
|
|
2385
|
+
addFormat2(res, "uri", check.message, refs);
|
|
2386
|
+
break;
|
|
2387
|
+
case "uuid":
|
|
2388
|
+
addFormat2(res, "uuid", check.message, refs);
|
|
2389
|
+
break;
|
|
2390
|
+
case "regex":
|
|
2391
|
+
addPattern2(res, check.regex, check.message, refs);
|
|
2392
|
+
break;
|
|
2393
|
+
case "cuid":
|
|
2394
|
+
addPattern2(res, zodPatterns2.cuid, check.message, refs);
|
|
2395
|
+
break;
|
|
2396
|
+
case "cuid2":
|
|
2397
|
+
addPattern2(res, zodPatterns2.cuid2, check.message, refs);
|
|
2398
|
+
break;
|
|
2399
|
+
case "startsWith":
|
|
2400
|
+
addPattern2(res, RegExp(`^${escapeLiteralCheckValue2(check.value, refs)}`), check.message, refs);
|
|
2401
|
+
break;
|
|
2402
|
+
case "endsWith":
|
|
2403
|
+
addPattern2(res, RegExp(`${escapeLiteralCheckValue2(check.value, refs)}$`), check.message, refs);
|
|
2404
|
+
break;
|
|
2405
|
+
case "datetime":
|
|
2406
|
+
addFormat2(res, "date-time", check.message, refs);
|
|
2407
|
+
break;
|
|
2408
|
+
case "date":
|
|
2409
|
+
addFormat2(res, "date", check.message, refs);
|
|
2410
|
+
break;
|
|
2411
|
+
case "time":
|
|
2412
|
+
addFormat2(res, "time", check.message, refs);
|
|
2413
|
+
break;
|
|
2414
|
+
case "duration":
|
|
2415
|
+
addFormat2(res, "duration", check.message, refs);
|
|
2416
|
+
break;
|
|
2417
|
+
case "length":
|
|
2418
|
+
setResponseValueAndErrors2(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
2419
|
+
setResponseValueAndErrors2(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
2420
|
+
break;
|
|
2421
|
+
case "includes": {
|
|
2422
|
+
addPattern2(res, RegExp(escapeLiteralCheckValue2(check.value, refs)), check.message, refs);
|
|
2423
|
+
break;
|
|
2424
|
+
}
|
|
2425
|
+
case "ip": {
|
|
2426
|
+
if (check.version !== "v6") {
|
|
2427
|
+
addFormat2(res, "ipv4", check.message, refs);
|
|
2428
|
+
}
|
|
2429
|
+
if (check.version !== "v4") {
|
|
2430
|
+
addFormat2(res, "ipv6", check.message, refs);
|
|
2431
|
+
}
|
|
2432
|
+
break;
|
|
2433
|
+
}
|
|
2434
|
+
case "base64url":
|
|
2435
|
+
addPattern2(res, zodPatterns2.base64url, check.message, refs);
|
|
2436
|
+
break;
|
|
2437
|
+
case "jwt":
|
|
2438
|
+
addPattern2(res, zodPatterns2.jwt, check.message, refs);
|
|
2439
|
+
break;
|
|
2440
|
+
case "cidr": {
|
|
2441
|
+
if (check.version !== "v6") {
|
|
2442
|
+
addPattern2(res, zodPatterns2.ipv4Cidr, check.message, refs);
|
|
2443
|
+
}
|
|
2444
|
+
if (check.version !== "v4") {
|
|
2445
|
+
addPattern2(res, zodPatterns2.ipv6Cidr, check.message, refs);
|
|
2446
|
+
}
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2449
|
+
case "emoji":
|
|
2450
|
+
addPattern2(res, zodPatterns2.emoji(), check.message, refs);
|
|
2451
|
+
break;
|
|
2452
|
+
case "ulid": {
|
|
2453
|
+
addPattern2(res, zodPatterns2.ulid, check.message, refs);
|
|
2454
|
+
break;
|
|
2455
|
+
}
|
|
2456
|
+
case "base64": {
|
|
2457
|
+
switch (refs.base64Strategy) {
|
|
2458
|
+
case "format:binary": {
|
|
2459
|
+
addFormat2(res, "binary", check.message, refs);
|
|
2460
|
+
break;
|
|
2461
|
+
}
|
|
2462
|
+
case "contentEncoding:base64": {
|
|
2463
|
+
setResponseValueAndErrors2(res, "contentEncoding", "base64", check.message, refs);
|
|
2464
|
+
break;
|
|
2465
|
+
}
|
|
2466
|
+
case "pattern:zod": {
|
|
2467
|
+
addPattern2(res, zodPatterns2.base64, check.message, refs);
|
|
2468
|
+
break;
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
break;
|
|
2472
|
+
}
|
|
2473
|
+
case "nanoid": {
|
|
2474
|
+
addPattern2(res, zodPatterns2.nanoid, check.message, refs);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
return res;
|
|
2480
|
+
}
|
|
2481
|
+
function escapeLiteralCheckValue2(literal, refs) {
|
|
2482
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
|
|
2483
|
+
}
|
|
2484
|
+
var ALPHA_NUMERIC2 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
2485
|
+
function escapeNonAlphaNumeric2(source) {
|
|
2486
|
+
let result = "";
|
|
2487
|
+
for (let i = 0; i < source.length; i++) {
|
|
2488
|
+
if (!ALPHA_NUMERIC2.has(source[i])) {
|
|
2489
|
+
result += "\\";
|
|
2490
|
+
}
|
|
2491
|
+
result += source[i];
|
|
2492
|
+
}
|
|
2493
|
+
return result;
|
|
2494
|
+
}
|
|
2495
|
+
function addFormat2(schema, value, message, refs) {
|
|
2496
|
+
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
2497
|
+
if (!schema.anyOf) {
|
|
2498
|
+
schema.anyOf = [];
|
|
2499
|
+
}
|
|
2500
|
+
if (schema.format) {
|
|
2501
|
+
schema.anyOf.push({
|
|
2502
|
+
format: schema.format,
|
|
2503
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
2504
|
+
errorMessage: { format: schema.errorMessage.format }
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2507
|
+
delete schema.format;
|
|
2508
|
+
if (schema.errorMessage) {
|
|
2509
|
+
delete schema.errorMessage.format;
|
|
2510
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
2511
|
+
delete schema.errorMessage;
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
schema.anyOf.push({
|
|
2516
|
+
format: value,
|
|
2517
|
+
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
2518
|
+
});
|
|
2519
|
+
} else {
|
|
2520
|
+
setResponseValueAndErrors2(schema, "format", value, message, refs);
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
function addPattern2(schema, regex, message, refs) {
|
|
2524
|
+
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
2525
|
+
if (!schema.allOf) {
|
|
2526
|
+
schema.allOf = [];
|
|
2527
|
+
}
|
|
2528
|
+
if (schema.pattern) {
|
|
2529
|
+
schema.allOf.push({
|
|
2530
|
+
pattern: schema.pattern,
|
|
2531
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
2532
|
+
errorMessage: { pattern: schema.errorMessage.pattern }
|
|
2533
|
+
}
|
|
2534
|
+
});
|
|
2535
|
+
delete schema.pattern;
|
|
2536
|
+
if (schema.errorMessage) {
|
|
2537
|
+
delete schema.errorMessage.pattern;
|
|
2538
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
2539
|
+
delete schema.errorMessage;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
schema.allOf.push({
|
|
2544
|
+
pattern: stringifyRegExpWithFlags2(regex, refs),
|
|
2545
|
+
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
2546
|
+
});
|
|
2547
|
+
} else {
|
|
2548
|
+
setResponseValueAndErrors2(schema, "pattern", stringifyRegExpWithFlags2(regex, refs), message, refs);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
function stringifyRegExpWithFlags2(regex, refs) {
|
|
2552
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
2553
|
+
return regex.source;
|
|
2554
|
+
}
|
|
2555
|
+
const flags = {
|
|
2556
|
+
i: regex.flags.includes("i"),
|
|
2557
|
+
m: regex.flags.includes("m"),
|
|
2558
|
+
s: regex.flags.includes("s")
|
|
2559
|
+
// `.` matches newlines
|
|
2560
|
+
};
|
|
2561
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
2562
|
+
let pattern = "";
|
|
2563
|
+
let isEscaped = false;
|
|
2564
|
+
let inCharGroup = false;
|
|
2565
|
+
let inCharRange = false;
|
|
2566
|
+
for (let i = 0; i < source.length; i++) {
|
|
2567
|
+
if (isEscaped) {
|
|
2568
|
+
pattern += source[i];
|
|
2569
|
+
isEscaped = false;
|
|
2570
|
+
continue;
|
|
2571
|
+
}
|
|
2572
|
+
if (flags.i) {
|
|
2573
|
+
if (inCharGroup) {
|
|
2574
|
+
if (source[i].match(/[a-z]/)) {
|
|
2575
|
+
if (inCharRange) {
|
|
2576
|
+
pattern += source[i];
|
|
2577
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
2578
|
+
inCharRange = false;
|
|
2579
|
+
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
2580
|
+
pattern += source[i];
|
|
2581
|
+
inCharRange = true;
|
|
2582
|
+
} else {
|
|
2583
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
2584
|
+
}
|
|
2585
|
+
continue;
|
|
2586
|
+
}
|
|
2587
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
2588
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
2589
|
+
continue;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
if (flags.m) {
|
|
2593
|
+
if (source[i] === "^") {
|
|
2594
|
+
pattern += `(^|(?<=[\r
|
|
2595
|
+
]))`;
|
|
2596
|
+
continue;
|
|
2597
|
+
} else if (source[i] === "$") {
|
|
2598
|
+
pattern += `($|(?=[\r
|
|
2599
|
+
]))`;
|
|
2600
|
+
continue;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
if (flags.s && source[i] === ".") {
|
|
2604
|
+
pattern += inCharGroup ? `${source[i]}\r
|
|
2605
|
+
` : `[${source[i]}\r
|
|
2606
|
+
]`;
|
|
2607
|
+
continue;
|
|
2608
|
+
}
|
|
2609
|
+
pattern += source[i];
|
|
2610
|
+
if (source[i] === "\\") {
|
|
2611
|
+
isEscaped = true;
|
|
2612
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
2613
|
+
inCharGroup = false;
|
|
2614
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
2615
|
+
inCharGroup = true;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
return pattern;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
// ../../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
|
|
2622
|
+
function parseRecordDef2(def, refs) {
|
|
2623
|
+
if (refs.target === "openAi") {
|
|
2624
|
+
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
2625
|
+
}
|
|
2626
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
|
|
2627
|
+
return {
|
|
2628
|
+
type: "object",
|
|
2629
|
+
required: def.keyType._def.values,
|
|
2630
|
+
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
2631
|
+
...acc,
|
|
2632
|
+
[key]: parseDef2(def.valueType._def, {
|
|
2633
|
+
...refs,
|
|
2634
|
+
currentPath: [...refs.currentPath, "properties", key]
|
|
2635
|
+
}) ?? parseAnyDef2(refs)
|
|
2636
|
+
}), {}),
|
|
2637
|
+
additionalProperties: refs.rejectedAdditionalProperties
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
const schema = {
|
|
2641
|
+
type: "object",
|
|
2642
|
+
additionalProperties: parseDef2(def.valueType._def, {
|
|
2643
|
+
...refs,
|
|
2644
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
2645
|
+
}) ?? refs.allowedAdditionalProperties
|
|
2646
|
+
};
|
|
2647
|
+
if (refs.target === "openApi3") {
|
|
2648
|
+
return schema;
|
|
2649
|
+
}
|
|
2650
|
+
if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.checks?.length) {
|
|
2651
|
+
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
2652
|
+
return {
|
|
2653
|
+
...schema,
|
|
2654
|
+
propertyNames: keyType
|
|
2655
|
+
};
|
|
2656
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
|
|
2657
|
+
return {
|
|
2658
|
+
...schema,
|
|
2659
|
+
propertyNames: {
|
|
2660
|
+
enum: def.keyType._def.values
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2663
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
2664
|
+
const { type, ...keyType } = parseBrandedDef2(def.keyType._def, refs);
|
|
2665
|
+
return {
|
|
2666
|
+
...schema,
|
|
2667
|
+
propertyNames: keyType
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
return schema;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
// ../../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
|
|
2674
|
+
function parseMapDef2(def, refs) {
|
|
2675
|
+
if (refs.mapStrategy === "record") {
|
|
2676
|
+
return parseRecordDef2(def, refs);
|
|
2677
|
+
}
|
|
2678
|
+
const keys = parseDef2(def.keyType._def, {
|
|
2679
|
+
...refs,
|
|
2680
|
+
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
2681
|
+
}) || parseAnyDef2(refs);
|
|
2682
|
+
const values = parseDef2(def.valueType._def, {
|
|
2683
|
+
...refs,
|
|
2684
|
+
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
2685
|
+
}) || parseAnyDef2(refs);
|
|
2686
|
+
return {
|
|
2687
|
+
type: "array",
|
|
2688
|
+
maxItems: 125,
|
|
2689
|
+
items: {
|
|
2690
|
+
type: "array",
|
|
2691
|
+
items: [keys, values],
|
|
2692
|
+
minItems: 2,
|
|
2693
|
+
maxItems: 2
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
// ../../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
|
|
2699
|
+
function parseNativeEnumDef2(def) {
|
|
2700
|
+
const object5 = def.values;
|
|
2701
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
2702
|
+
return typeof object5[object5[key]] !== "number";
|
|
2703
|
+
});
|
|
2704
|
+
const actualValues = actualKeys.map((key) => object5[key]);
|
|
2705
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
2706
|
+
return {
|
|
2707
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
2708
|
+
enum: actualValues
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
// ../../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
|
|
2713
|
+
function parseNeverDef2(refs) {
|
|
2714
|
+
return refs.target === "openAi" ? void 0 : {
|
|
2715
|
+
not: parseAnyDef2({
|
|
2716
|
+
...refs,
|
|
2717
|
+
currentPath: [...refs.currentPath, "not"]
|
|
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/null.js
|
|
2723
|
+
function parseNullDef2(refs) {
|
|
2724
|
+
return refs.target === "openApi3" ? {
|
|
2725
|
+
enum: ["null"],
|
|
2726
|
+
nullable: true
|
|
2727
|
+
} : {
|
|
2728
|
+
type: "null"
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
// ../../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
|
|
2733
|
+
var primitiveMappings2 = {
|
|
2734
|
+
ZodString: "string",
|
|
2735
|
+
ZodNumber: "number",
|
|
2736
|
+
ZodBigInt: "integer",
|
|
2737
|
+
ZodBoolean: "boolean",
|
|
2738
|
+
ZodNull: "null"
|
|
2739
|
+
};
|
|
2740
|
+
function parseUnionDef2(def, refs) {
|
|
2741
|
+
if (refs.target === "openApi3")
|
|
2742
|
+
return asAnyOf2(def, refs);
|
|
2743
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
2744
|
+
if (options.every((x) => x._def.typeName in primitiveMappings2 && (!x._def.checks || !x._def.checks.length))) {
|
|
2745
|
+
const types = options.reduce((types2, x) => {
|
|
2746
|
+
const type = primitiveMappings2[x._def.typeName];
|
|
2747
|
+
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
2748
|
+
}, []);
|
|
2749
|
+
return {
|
|
2750
|
+
type: types.length > 1 ? types : types[0]
|
|
2751
|
+
};
|
|
2752
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
2753
|
+
const types = options.reduce((acc, x) => {
|
|
2754
|
+
const type = typeof x._def.value;
|
|
2755
|
+
switch (type) {
|
|
2756
|
+
case "string":
|
|
2757
|
+
case "number":
|
|
2758
|
+
case "boolean":
|
|
2759
|
+
return [...acc, type];
|
|
2760
|
+
case "bigint":
|
|
2761
|
+
return [...acc, "integer"];
|
|
2762
|
+
case "object":
|
|
2763
|
+
if (x._def.value === null)
|
|
2764
|
+
return [...acc, "null"];
|
|
2765
|
+
case "symbol":
|
|
2766
|
+
case "undefined":
|
|
2767
|
+
case "function":
|
|
2768
|
+
default:
|
|
2769
|
+
return acc;
|
|
2770
|
+
}
|
|
2771
|
+
}, []);
|
|
2772
|
+
if (types.length === options.length) {
|
|
2773
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
2774
|
+
return {
|
|
2775
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
2776
|
+
enum: options.reduce((acc, x) => {
|
|
2777
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
2778
|
+
}, [])
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
2782
|
+
return {
|
|
2783
|
+
type: "string",
|
|
2784
|
+
enum: options.reduce((acc, x) => [
|
|
2785
|
+
...acc,
|
|
2786
|
+
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
2787
|
+
], [])
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
return asAnyOf2(def, refs);
|
|
2791
|
+
}
|
|
2792
|
+
var asAnyOf2 = (def, refs) => {
|
|
2793
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef2(x._def, {
|
|
2794
|
+
...refs,
|
|
2795
|
+
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
2796
|
+
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
2797
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
2798
|
+
};
|
|
2799
|
+
|
|
2800
|
+
// ../../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
|
|
2801
|
+
function parseNullableDef2(def, refs) {
|
|
2802
|
+
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
2803
|
+
if (refs.target === "openApi3") {
|
|
2804
|
+
return {
|
|
2805
|
+
type: primitiveMappings2[def.innerType._def.typeName],
|
|
2806
|
+
nullable: true
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
return {
|
|
2810
|
+
type: [
|
|
2811
|
+
primitiveMappings2[def.innerType._def.typeName],
|
|
2812
|
+
"null"
|
|
2813
|
+
]
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
if (refs.target === "openApi3") {
|
|
2817
|
+
const base2 = parseDef2(def.innerType._def, {
|
|
2818
|
+
...refs,
|
|
2819
|
+
currentPath: [...refs.currentPath]
|
|
2820
|
+
});
|
|
2821
|
+
if (base2 && "$ref" in base2)
|
|
2822
|
+
return { allOf: [base2], nullable: true };
|
|
2823
|
+
return base2 && { ...base2, nullable: true };
|
|
2824
|
+
}
|
|
2825
|
+
const base = parseDef2(def.innerType._def, {
|
|
2826
|
+
...refs,
|
|
2827
|
+
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
2828
|
+
});
|
|
2829
|
+
return base && { anyOf: [base, { type: "null" }] };
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// ../../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
|
|
2833
|
+
function parseNumberDef2(def, refs) {
|
|
2834
|
+
const res = {
|
|
2835
|
+
type: "number"
|
|
2836
|
+
};
|
|
2837
|
+
if (!def.checks)
|
|
2838
|
+
return res;
|
|
2839
|
+
for (const check of def.checks) {
|
|
2840
|
+
switch (check.kind) {
|
|
2841
|
+
case "int":
|
|
2842
|
+
res.type = "integer";
|
|
2843
|
+
addErrorMessage2(res, "type", check.message, refs);
|
|
2844
|
+
break;
|
|
2845
|
+
case "min":
|
|
2846
|
+
if (refs.target === "jsonSchema7") {
|
|
2847
|
+
if (check.inclusive) {
|
|
2848
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2849
|
+
} else {
|
|
2850
|
+
setResponseValueAndErrors2(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
2851
|
+
}
|
|
2852
|
+
} else {
|
|
2853
|
+
if (!check.inclusive) {
|
|
2854
|
+
res.exclusiveMinimum = true;
|
|
2855
|
+
}
|
|
2856
|
+
setResponseValueAndErrors2(res, "minimum", check.value, check.message, refs);
|
|
2857
|
+
}
|
|
2858
|
+
break;
|
|
2859
|
+
case "max":
|
|
2860
|
+
if (refs.target === "jsonSchema7") {
|
|
2861
|
+
if (check.inclusive) {
|
|
2862
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2863
|
+
} else {
|
|
2864
|
+
setResponseValueAndErrors2(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
2865
|
+
}
|
|
2866
|
+
} else {
|
|
2867
|
+
if (!check.inclusive) {
|
|
2868
|
+
res.exclusiveMaximum = true;
|
|
2869
|
+
}
|
|
2870
|
+
setResponseValueAndErrors2(res, "maximum", check.value, check.message, refs);
|
|
2871
|
+
}
|
|
2872
|
+
break;
|
|
2873
|
+
case "multipleOf":
|
|
2874
|
+
setResponseValueAndErrors2(res, "multipleOf", check.value, check.message, refs);
|
|
2875
|
+
break;
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
return res;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
// ../../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
|
|
2882
|
+
function parseObjectDef2(def, refs) {
|
|
2883
|
+
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
2884
|
+
const result = {
|
|
2885
|
+
type: "object",
|
|
2886
|
+
properties: {}
|
|
2887
|
+
};
|
|
2888
|
+
const required = [];
|
|
2889
|
+
const shape = def.shape();
|
|
2890
|
+
for (const propName in shape) {
|
|
2891
|
+
let propDef = shape[propName];
|
|
2892
|
+
if (propDef === void 0 || propDef._def === void 0) {
|
|
2893
|
+
continue;
|
|
2894
|
+
}
|
|
2895
|
+
let propOptional = safeIsOptional2(propDef);
|
|
2896
|
+
if (propOptional && forceOptionalIntoNullable) {
|
|
2897
|
+
if (propDef._def.typeName === "ZodOptional") {
|
|
2898
|
+
propDef = propDef._def.innerType;
|
|
2899
|
+
}
|
|
2900
|
+
if (!propDef.isNullable()) {
|
|
2901
|
+
propDef = propDef.nullable();
|
|
2902
|
+
}
|
|
2903
|
+
propOptional = false;
|
|
2904
|
+
}
|
|
2905
|
+
const parsedDef = parseDef2(propDef._def, {
|
|
2906
|
+
...refs,
|
|
2907
|
+
currentPath: [...refs.currentPath, "properties", propName],
|
|
2908
|
+
propertyPath: [...refs.currentPath, "properties", propName]
|
|
2909
|
+
});
|
|
2910
|
+
if (parsedDef === void 0) {
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
result.properties[propName] = parsedDef;
|
|
2914
|
+
if (!propOptional) {
|
|
2915
|
+
required.push(propName);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
if (required.length) {
|
|
2919
|
+
result.required = required;
|
|
2920
|
+
}
|
|
2921
|
+
const additionalProperties = decideAdditionalProperties2(def, refs);
|
|
2922
|
+
if (additionalProperties !== void 0) {
|
|
2923
|
+
result.additionalProperties = additionalProperties;
|
|
2924
|
+
}
|
|
2925
|
+
return result;
|
|
2926
|
+
}
|
|
2927
|
+
function decideAdditionalProperties2(def, refs) {
|
|
2928
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
2929
|
+
return parseDef2(def.catchall._def, {
|
|
2930
|
+
...refs,
|
|
2931
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
switch (def.unknownKeys) {
|
|
2935
|
+
case "passthrough":
|
|
2936
|
+
return refs.allowedAdditionalProperties;
|
|
2937
|
+
case "strict":
|
|
2938
|
+
return refs.rejectedAdditionalProperties;
|
|
2939
|
+
case "strip":
|
|
2940
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
function safeIsOptional2(schema) {
|
|
2944
|
+
try {
|
|
2945
|
+
return schema.isOptional();
|
|
2946
|
+
} catch {
|
|
2947
|
+
return true;
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
// ../../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
|
|
2952
|
+
var parseOptionalDef2 = (def, refs) => {
|
|
2953
|
+
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
2954
|
+
return parseDef2(def.innerType._def, refs);
|
|
2955
|
+
}
|
|
2956
|
+
const innerSchema = parseDef2(def.innerType._def, {
|
|
2957
|
+
...refs,
|
|
2958
|
+
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
2959
|
+
});
|
|
2960
|
+
return innerSchema ? {
|
|
2961
|
+
anyOf: [
|
|
2962
|
+
{
|
|
2963
|
+
not: parseAnyDef2(refs)
|
|
2964
|
+
},
|
|
2965
|
+
innerSchema
|
|
2966
|
+
]
|
|
2967
|
+
} : parseAnyDef2(refs);
|
|
2968
|
+
};
|
|
2969
|
+
|
|
2970
|
+
// ../../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
|
|
2971
|
+
var parsePipelineDef2 = (def, refs) => {
|
|
2972
|
+
if (refs.pipeStrategy === "input") {
|
|
2973
|
+
return parseDef2(def.in._def, refs);
|
|
2974
|
+
} else if (refs.pipeStrategy === "output") {
|
|
2975
|
+
return parseDef2(def.out._def, refs);
|
|
2976
|
+
}
|
|
2977
|
+
const a = parseDef2(def.in._def, {
|
|
2978
|
+
...refs,
|
|
2979
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
2980
|
+
});
|
|
2981
|
+
const b = parseDef2(def.out._def, {
|
|
2982
|
+
...refs,
|
|
2983
|
+
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
2984
|
+
});
|
|
2985
|
+
return {
|
|
2986
|
+
allOf: [a, b].filter((x) => x !== void 0)
|
|
2987
|
+
};
|
|
2988
|
+
};
|
|
2989
|
+
|
|
2990
|
+
// ../../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
|
|
2991
|
+
function parsePromiseDef2(def, refs) {
|
|
2992
|
+
return parseDef2(def.type._def, refs);
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
// ../../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
|
|
2996
|
+
function parseSetDef2(def, refs) {
|
|
2997
|
+
const items = parseDef2(def.valueType._def, {
|
|
2998
|
+
...refs,
|
|
2999
|
+
currentPath: [...refs.currentPath, "items"]
|
|
3000
|
+
});
|
|
3001
|
+
const schema = {
|
|
3002
|
+
type: "array",
|
|
3003
|
+
uniqueItems: true,
|
|
3004
|
+
items
|
|
3005
|
+
};
|
|
3006
|
+
if (def.minSize) {
|
|
3007
|
+
setResponseValueAndErrors2(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
3008
|
+
}
|
|
3009
|
+
if (def.maxSize) {
|
|
3010
|
+
setResponseValueAndErrors2(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
3011
|
+
}
|
|
3012
|
+
return schema;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
// ../../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
|
|
3016
|
+
function parseTupleDef2(def, refs) {
|
|
3017
|
+
if (def.rest) {
|
|
3018
|
+
return {
|
|
3019
|
+
type: "array",
|
|
3020
|
+
minItems: def.items.length,
|
|
3021
|
+
items: def.items.map((x, i) => parseDef2(x._def, {
|
|
3022
|
+
...refs,
|
|
3023
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
3024
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
3025
|
+
additionalItems: parseDef2(def.rest._def, {
|
|
3026
|
+
...refs,
|
|
3027
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
3028
|
+
})
|
|
3029
|
+
};
|
|
3030
|
+
} else {
|
|
3031
|
+
return {
|
|
3032
|
+
type: "array",
|
|
3033
|
+
minItems: def.items.length,
|
|
3034
|
+
maxItems: def.items.length,
|
|
3035
|
+
items: def.items.map((x, i) => parseDef2(x._def, {
|
|
3036
|
+
...refs,
|
|
3037
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
3038
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
// ../../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
|
|
3044
|
+
function parseUndefinedDef2(refs) {
|
|
3045
|
+
return {
|
|
3046
|
+
not: parseAnyDef2(refs)
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
// ../../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
|
|
3051
|
+
function parseUnknownDef2(refs) {
|
|
3052
|
+
return parseAnyDef2(refs);
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
// ../../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
|
|
3056
|
+
var parseReadonlyDef2 = (def, refs) => {
|
|
3057
|
+
return parseDef2(def.innerType._def, refs);
|
|
3058
|
+
};
|
|
3059
|
+
|
|
3060
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
3061
|
+
var selectParser2 = (def, typeName, refs) => {
|
|
3062
|
+
switch (typeName) {
|
|
3063
|
+
case ZodFirstPartyTypeKind$1.ZodString:
|
|
3064
|
+
return parseStringDef2(def, refs);
|
|
3065
|
+
case ZodFirstPartyTypeKind$1.ZodNumber:
|
|
3066
|
+
return parseNumberDef2(def, refs);
|
|
3067
|
+
case ZodFirstPartyTypeKind$1.ZodObject:
|
|
3068
|
+
return parseObjectDef2(def, refs);
|
|
3069
|
+
case ZodFirstPartyTypeKind$1.ZodBigInt:
|
|
3070
|
+
return parseBigintDef2(def, refs);
|
|
3071
|
+
case ZodFirstPartyTypeKind$1.ZodBoolean:
|
|
3072
|
+
return parseBooleanDef2();
|
|
3073
|
+
case ZodFirstPartyTypeKind$1.ZodDate:
|
|
3074
|
+
return parseDateDef2(def, refs);
|
|
3075
|
+
case ZodFirstPartyTypeKind$1.ZodUndefined:
|
|
3076
|
+
return parseUndefinedDef2(refs);
|
|
3077
|
+
case ZodFirstPartyTypeKind$1.ZodNull:
|
|
3078
|
+
return parseNullDef2(refs);
|
|
3079
|
+
case ZodFirstPartyTypeKind$1.ZodArray:
|
|
3080
|
+
return parseArrayDef2(def, refs);
|
|
3081
|
+
case ZodFirstPartyTypeKind$1.ZodUnion:
|
|
3082
|
+
case ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion:
|
|
3083
|
+
return parseUnionDef2(def, refs);
|
|
3084
|
+
case ZodFirstPartyTypeKind$1.ZodIntersection:
|
|
3085
|
+
return parseIntersectionDef2(def, refs);
|
|
3086
|
+
case ZodFirstPartyTypeKind$1.ZodTuple:
|
|
3087
|
+
return parseTupleDef2(def, refs);
|
|
3088
|
+
case ZodFirstPartyTypeKind$1.ZodRecord:
|
|
3089
|
+
return parseRecordDef2(def, refs);
|
|
3090
|
+
case ZodFirstPartyTypeKind$1.ZodLiteral:
|
|
3091
|
+
return parseLiteralDef2(def, refs);
|
|
3092
|
+
case ZodFirstPartyTypeKind$1.ZodEnum:
|
|
3093
|
+
return parseEnumDef2(def);
|
|
3094
|
+
case ZodFirstPartyTypeKind$1.ZodNativeEnum:
|
|
3095
|
+
return parseNativeEnumDef2(def);
|
|
3096
|
+
case ZodFirstPartyTypeKind$1.ZodNullable:
|
|
3097
|
+
return parseNullableDef2(def, refs);
|
|
3098
|
+
case ZodFirstPartyTypeKind$1.ZodOptional:
|
|
3099
|
+
return parseOptionalDef2(def, refs);
|
|
3100
|
+
case ZodFirstPartyTypeKind$1.ZodMap:
|
|
3101
|
+
return parseMapDef2(def, refs);
|
|
3102
|
+
case ZodFirstPartyTypeKind$1.ZodSet:
|
|
3103
|
+
return parseSetDef2(def, refs);
|
|
3104
|
+
case ZodFirstPartyTypeKind$1.ZodLazy:
|
|
3105
|
+
return () => def.getter()._def;
|
|
3106
|
+
case ZodFirstPartyTypeKind$1.ZodPromise:
|
|
3107
|
+
return parsePromiseDef2(def, refs);
|
|
3108
|
+
case ZodFirstPartyTypeKind$1.ZodNaN:
|
|
3109
|
+
case ZodFirstPartyTypeKind$1.ZodNever:
|
|
3110
|
+
return parseNeverDef2(refs);
|
|
3111
|
+
case ZodFirstPartyTypeKind$1.ZodEffects:
|
|
3112
|
+
return parseEffectsDef2(def, refs);
|
|
3113
|
+
case ZodFirstPartyTypeKind$1.ZodAny:
|
|
3114
|
+
return parseAnyDef2(refs);
|
|
3115
|
+
case ZodFirstPartyTypeKind$1.ZodUnknown:
|
|
3116
|
+
return parseUnknownDef2(refs);
|
|
3117
|
+
case ZodFirstPartyTypeKind$1.ZodDefault:
|
|
3118
|
+
return parseDefaultDef2(def, refs);
|
|
3119
|
+
case ZodFirstPartyTypeKind$1.ZodBranded:
|
|
3120
|
+
return parseBrandedDef2(def, refs);
|
|
3121
|
+
case ZodFirstPartyTypeKind$1.ZodReadonly:
|
|
3122
|
+
return parseReadonlyDef2(def, refs);
|
|
3123
|
+
case ZodFirstPartyTypeKind$1.ZodCatch:
|
|
3124
|
+
return parseCatchDef2(def, refs);
|
|
3125
|
+
case ZodFirstPartyTypeKind$1.ZodPipeline:
|
|
3126
|
+
return parsePipelineDef2(def, refs);
|
|
3127
|
+
case ZodFirstPartyTypeKind$1.ZodFunction:
|
|
3128
|
+
case ZodFirstPartyTypeKind$1.ZodVoid:
|
|
3129
|
+
case ZodFirstPartyTypeKind$1.ZodSymbol:
|
|
3130
|
+
return void 0;
|
|
3131
|
+
default:
|
|
3132
|
+
return /* @__PURE__ */ ((_) => void 0)();
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
|
|
3136
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
3137
|
+
function parseDef2(def, refs, forceResolution = false) {
|
|
3138
|
+
const seenItem = refs.seen.get(def);
|
|
3139
|
+
if (refs.override) {
|
|
3140
|
+
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
3141
|
+
if (overrideResult !== ignoreOverride2) {
|
|
3142
|
+
return overrideResult;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
if (seenItem && !forceResolution) {
|
|
3146
|
+
const seenSchema = get$ref2(seenItem, refs);
|
|
3147
|
+
if (seenSchema !== void 0) {
|
|
3148
|
+
return seenSchema;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
3152
|
+
refs.seen.set(def, newItem);
|
|
3153
|
+
const jsonSchemaOrGetter = selectParser2(def, def.typeName, refs);
|
|
3154
|
+
const jsonSchema5 = typeof jsonSchemaOrGetter === "function" ? parseDef2(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
3155
|
+
if (jsonSchema5) {
|
|
3156
|
+
addMeta2(def, refs, jsonSchema5);
|
|
3157
|
+
}
|
|
3158
|
+
if (refs.postProcess) {
|
|
3159
|
+
const postProcessResult = refs.postProcess(jsonSchema5, def, refs);
|
|
3160
|
+
newItem.jsonSchema = jsonSchema5;
|
|
3161
|
+
return postProcessResult;
|
|
3162
|
+
}
|
|
3163
|
+
newItem.jsonSchema = jsonSchema5;
|
|
3164
|
+
return jsonSchema5;
|
|
3165
|
+
}
|
|
3166
|
+
var get$ref2 = (item, refs) => {
|
|
3167
|
+
switch (refs.$refStrategy) {
|
|
3168
|
+
case "root":
|
|
3169
|
+
return { $ref: item.path.join("/") };
|
|
3170
|
+
case "relative":
|
|
3171
|
+
return { $ref: getRelativePath2(refs.currentPath, item.path) };
|
|
3172
|
+
case "none":
|
|
3173
|
+
case "seen": {
|
|
3174
|
+
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
3175
|
+
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
3176
|
+
return parseAnyDef2(refs);
|
|
3177
|
+
}
|
|
3178
|
+
return refs.$refStrategy === "seen" ? parseAnyDef2(refs) : void 0;
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
var addMeta2 = (def, refs, jsonSchema5) => {
|
|
3183
|
+
if (def.description) {
|
|
3184
|
+
jsonSchema5.description = def.description;
|
|
3185
|
+
if (refs.markdownDescription) {
|
|
3186
|
+
jsonSchema5.markdownDescription = def.description;
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
return jsonSchema5;
|
|
3190
|
+
};
|
|
3191
|
+
|
|
3192
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
3193
|
+
var zodToJsonSchema3 = (schema, options) => {
|
|
3194
|
+
const refs = getRefs2(options);
|
|
3195
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name26, schema2]) => ({
|
|
3196
|
+
...acc,
|
|
3197
|
+
[name26]: parseDef2(schema2._def, {
|
|
3198
|
+
...refs,
|
|
3199
|
+
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
3200
|
+
}, true) ?? parseAnyDef2(refs)
|
|
3201
|
+
}), {}) : void 0;
|
|
3202
|
+
const name21 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
3203
|
+
const main = parseDef2(schema._def, name21 === void 0 ? refs : {
|
|
3204
|
+
...refs,
|
|
3205
|
+
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
3206
|
+
}, false) ?? parseAnyDef2(refs);
|
|
3207
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
3208
|
+
if (title !== void 0) {
|
|
3209
|
+
main.title = title;
|
|
3210
|
+
}
|
|
3211
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
3212
|
+
if (!definitions) {
|
|
3213
|
+
definitions = {};
|
|
3214
|
+
}
|
|
3215
|
+
if (!definitions[refs.openAiAnyTypeName]) {
|
|
3216
|
+
definitions[refs.openAiAnyTypeName] = {
|
|
3217
|
+
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
3218
|
+
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
3219
|
+
items: {
|
|
3220
|
+
$ref: refs.$refStrategy === "relative" ? "1" : [
|
|
3221
|
+
...refs.basePath,
|
|
3222
|
+
refs.definitionPath,
|
|
3223
|
+
refs.openAiAnyTypeName
|
|
3224
|
+
].join("/")
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
const combined = name21 === void 0 ? definitions ? {
|
|
3230
|
+
...main,
|
|
3231
|
+
[refs.definitionPath]: definitions
|
|
3232
|
+
} : main : {
|
|
3233
|
+
$ref: [
|
|
3234
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
3235
|
+
refs.definitionPath,
|
|
3236
|
+
name21
|
|
3237
|
+
].join("/"),
|
|
3238
|
+
[refs.definitionPath]: {
|
|
3239
|
+
...definitions,
|
|
3240
|
+
[name21]: main
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
if (refs.target === "jsonSchema7") {
|
|
3244
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
3245
|
+
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
3246
|
+
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
3247
|
+
}
|
|
3248
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
3249
|
+
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
3250
|
+
}
|
|
3251
|
+
return combined;
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
3255
|
+
var esm_default2 = zodToJsonSchema3;
|
|
3256
|
+
function fixJson(input) {
|
|
3257
|
+
const stack = ["ROOT"];
|
|
3258
|
+
let lastValidIndex = -1;
|
|
3259
|
+
let literalStart = null;
|
|
3260
|
+
function processValueStart(char, i, swapState) {
|
|
3261
|
+
{
|
|
3262
|
+
switch (char) {
|
|
3263
|
+
case '"': {
|
|
3264
|
+
lastValidIndex = i;
|
|
3265
|
+
stack.pop();
|
|
3266
|
+
stack.push(swapState);
|
|
3267
|
+
stack.push("INSIDE_STRING");
|
|
3268
|
+
break;
|
|
3269
|
+
}
|
|
3270
|
+
case "f":
|
|
3271
|
+
case "t":
|
|
3272
|
+
case "n": {
|
|
3273
|
+
lastValidIndex = i;
|
|
3274
|
+
literalStart = i;
|
|
3275
|
+
stack.pop();
|
|
3276
|
+
stack.push(swapState);
|
|
3277
|
+
stack.push("INSIDE_LITERAL");
|
|
3278
|
+
break;
|
|
3279
|
+
}
|
|
3280
|
+
case "-": {
|
|
3281
|
+
stack.pop();
|
|
3282
|
+
stack.push(swapState);
|
|
3283
|
+
stack.push("INSIDE_NUMBER");
|
|
3284
|
+
break;
|
|
3285
|
+
}
|
|
3286
|
+
case "0":
|
|
3287
|
+
case "1":
|
|
3288
|
+
case "2":
|
|
3289
|
+
case "3":
|
|
3290
|
+
case "4":
|
|
3291
|
+
case "5":
|
|
3292
|
+
case "6":
|
|
3293
|
+
case "7":
|
|
3294
|
+
case "8":
|
|
3295
|
+
case "9": {
|
|
3296
|
+
lastValidIndex = i;
|
|
3297
|
+
stack.pop();
|
|
3298
|
+
stack.push(swapState);
|
|
3299
|
+
stack.push("INSIDE_NUMBER");
|
|
3300
|
+
break;
|
|
3301
|
+
}
|
|
3302
|
+
case "{": {
|
|
3303
|
+
lastValidIndex = i;
|
|
3304
|
+
stack.pop();
|
|
3305
|
+
stack.push(swapState);
|
|
3306
|
+
stack.push("INSIDE_OBJECT_START");
|
|
3307
|
+
break;
|
|
3308
|
+
}
|
|
3309
|
+
case "[": {
|
|
3310
|
+
lastValidIndex = i;
|
|
3311
|
+
stack.pop();
|
|
3312
|
+
stack.push(swapState);
|
|
3313
|
+
stack.push("INSIDE_ARRAY_START");
|
|
3314
|
+
break;
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
function processAfterObjectValue(char, i) {
|
|
3320
|
+
switch (char) {
|
|
3321
|
+
case ",": {
|
|
3322
|
+
stack.pop();
|
|
3323
|
+
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
3324
|
+
break;
|
|
3325
|
+
}
|
|
3326
|
+
case "}": {
|
|
3327
|
+
lastValidIndex = i;
|
|
3328
|
+
stack.pop();
|
|
3329
|
+
break;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
function processAfterArrayValue(char, i) {
|
|
3334
|
+
switch (char) {
|
|
3335
|
+
case ",": {
|
|
3336
|
+
stack.pop();
|
|
3337
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
3338
|
+
break;
|
|
3339
|
+
}
|
|
3340
|
+
case "]": {
|
|
3341
|
+
lastValidIndex = i;
|
|
3342
|
+
stack.pop();
|
|
3343
|
+
break;
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
for (let i = 0; i < input.length; i++) {
|
|
3348
|
+
const char = input[i];
|
|
3349
|
+
const currentState = stack[stack.length - 1];
|
|
3350
|
+
switch (currentState) {
|
|
3351
|
+
case "ROOT":
|
|
3352
|
+
processValueStart(char, i, "FINISH");
|
|
3353
|
+
break;
|
|
3354
|
+
case "INSIDE_OBJECT_START": {
|
|
3355
|
+
switch (char) {
|
|
3356
|
+
case '"': {
|
|
3357
|
+
stack.pop();
|
|
3358
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
3359
|
+
break;
|
|
3360
|
+
}
|
|
3361
|
+
case "}": {
|
|
3362
|
+
lastValidIndex = i;
|
|
3363
|
+
stack.pop();
|
|
3364
|
+
break;
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
break;
|
|
3368
|
+
}
|
|
3369
|
+
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
3370
|
+
switch (char) {
|
|
3371
|
+
case '"': {
|
|
3372
|
+
stack.pop();
|
|
3373
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
3374
|
+
break;
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
break;
|
|
3378
|
+
}
|
|
3379
|
+
case "INSIDE_OBJECT_KEY": {
|
|
3380
|
+
switch (char) {
|
|
3381
|
+
case '"': {
|
|
3382
|
+
stack.pop();
|
|
3383
|
+
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
3384
|
+
break;
|
|
2113
3385
|
}
|
|
2114
3386
|
}
|
|
2115
3387
|
break;
|
|
@@ -2578,7 +3850,7 @@ function zodSchema(zodSchema22, options) {
|
|
|
2578
3850
|
var _a26;
|
|
2579
3851
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
2580
3852
|
return jsonSchema(
|
|
2581
|
-
|
|
3853
|
+
esm_default2(zodSchema22, {
|
|
2582
3854
|
$refStrategy: useReferences ? "root" : "none",
|
|
2583
3855
|
target: "jsonSchema7"
|
|
2584
3856
|
// note: openai mode breaks various gemini conversions
|
|
@@ -5395,7 +6667,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
|
5395
6667
|
rawValue: parsedResult.rawValue
|
|
5396
6668
|
};
|
|
5397
6669
|
};
|
|
5398
|
-
var
|
|
6670
|
+
var getRelativePath3 = (pathA, pathB) => {
|
|
5399
6671
|
let i = 0;
|
|
5400
6672
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
5401
6673
|
if (pathA[i] !== pathB[i])
|
|
@@ -5403,10 +6675,10 @@ var getRelativePath2 = (pathA, pathB) => {
|
|
|
5403
6675
|
}
|
|
5404
6676
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
5405
6677
|
};
|
|
5406
|
-
var
|
|
6678
|
+
var ignoreOverride3 = Symbol(
|
|
5407
6679
|
"Let zodToJsonSchema decide on which parser to use"
|
|
5408
6680
|
);
|
|
5409
|
-
var
|
|
6681
|
+
var defaultOptions3 = {
|
|
5410
6682
|
name: void 0,
|
|
5411
6683
|
$refStrategy: "root",
|
|
5412
6684
|
basePath: ["#"],
|
|
@@ -5427,23 +6699,23 @@ var defaultOptions2 = {
|
|
|
5427
6699
|
base64Strategy: "contentEncoding:base64",
|
|
5428
6700
|
nameStrategy: "ref"
|
|
5429
6701
|
};
|
|
5430
|
-
var
|
|
5431
|
-
...
|
|
6702
|
+
var getDefaultOptions3 = (options) => typeof options === "string" ? {
|
|
6703
|
+
...defaultOptions3,
|
|
5432
6704
|
name: options
|
|
5433
6705
|
} : {
|
|
5434
|
-
...
|
|
6706
|
+
...defaultOptions3,
|
|
5435
6707
|
...options
|
|
5436
6708
|
};
|
|
5437
|
-
function
|
|
6709
|
+
function parseAnyDef3() {
|
|
5438
6710
|
return {};
|
|
5439
6711
|
}
|
|
5440
|
-
function
|
|
6712
|
+
function parseArrayDef3(def, refs) {
|
|
5441
6713
|
var _a26, _b8, _c;
|
|
5442
6714
|
const res = {
|
|
5443
6715
|
type: "array"
|
|
5444
6716
|
};
|
|
5445
6717
|
if (((_a26 = def.type) == null ? void 0 : _a26._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
5446
|
-
res.items =
|
|
6718
|
+
res.items = parseDef3(def.type._def, {
|
|
5447
6719
|
...refs,
|
|
5448
6720
|
currentPath: [...refs.currentPath, "items"]
|
|
5449
6721
|
});
|
|
@@ -5460,7 +6732,7 @@ function parseArrayDef2(def, refs) {
|
|
|
5460
6732
|
}
|
|
5461
6733
|
return res;
|
|
5462
6734
|
}
|
|
5463
|
-
function
|
|
6735
|
+
function parseBigintDef3(def) {
|
|
5464
6736
|
const res = {
|
|
5465
6737
|
type: "integer",
|
|
5466
6738
|
format: "int64"
|
|
@@ -5490,20 +6762,20 @@ function parseBigintDef2(def) {
|
|
|
5490
6762
|
}
|
|
5491
6763
|
return res;
|
|
5492
6764
|
}
|
|
5493
|
-
function
|
|
6765
|
+
function parseBooleanDef3() {
|
|
5494
6766
|
return { type: "boolean" };
|
|
5495
6767
|
}
|
|
5496
|
-
function
|
|
5497
|
-
return
|
|
6768
|
+
function parseBrandedDef3(_def, refs) {
|
|
6769
|
+
return parseDef3(_def.type._def, refs);
|
|
5498
6770
|
}
|
|
5499
|
-
var
|
|
5500
|
-
return
|
|
6771
|
+
var parseCatchDef3 = (def, refs) => {
|
|
6772
|
+
return parseDef3(def.innerType._def, refs);
|
|
5501
6773
|
};
|
|
5502
|
-
function
|
|
6774
|
+
function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
5503
6775
|
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
5504
6776
|
if (Array.isArray(strategy)) {
|
|
5505
6777
|
return {
|
|
5506
|
-
anyOf: strategy.map((item, i) =>
|
|
6778
|
+
anyOf: strategy.map((item, i) => parseDateDef3(def, refs, item))
|
|
5507
6779
|
};
|
|
5508
6780
|
}
|
|
5509
6781
|
switch (strategy) {
|
|
@@ -5519,10 +6791,10 @@ function parseDateDef2(def, refs, overrideDateStrategy) {
|
|
|
5519
6791
|
format: "date"
|
|
5520
6792
|
};
|
|
5521
6793
|
case "integer":
|
|
5522
|
-
return
|
|
6794
|
+
return integerDateParser3(def);
|
|
5523
6795
|
}
|
|
5524
6796
|
}
|
|
5525
|
-
var
|
|
6797
|
+
var integerDateParser3 = (def) => {
|
|
5526
6798
|
const res = {
|
|
5527
6799
|
type: "integer",
|
|
5528
6800
|
format: "unix-time"
|
|
@@ -5539,40 +6811,40 @@ var integerDateParser2 = (def) => {
|
|
|
5539
6811
|
}
|
|
5540
6812
|
return res;
|
|
5541
6813
|
};
|
|
5542
|
-
function
|
|
6814
|
+
function parseDefaultDef3(_def, refs) {
|
|
5543
6815
|
return {
|
|
5544
|
-
...
|
|
6816
|
+
...parseDef3(_def.innerType._def, refs),
|
|
5545
6817
|
default: _def.defaultValue()
|
|
5546
6818
|
};
|
|
5547
6819
|
}
|
|
5548
|
-
function
|
|
5549
|
-
return refs.effectStrategy === "input" ?
|
|
6820
|
+
function parseEffectsDef3(_def, refs) {
|
|
6821
|
+
return refs.effectStrategy === "input" ? parseDef3(_def.schema._def, refs) : parseAnyDef3();
|
|
5550
6822
|
}
|
|
5551
|
-
function
|
|
6823
|
+
function parseEnumDef3(def) {
|
|
5552
6824
|
return {
|
|
5553
6825
|
type: "string",
|
|
5554
6826
|
enum: Array.from(def.values)
|
|
5555
6827
|
};
|
|
5556
6828
|
}
|
|
5557
|
-
var
|
|
6829
|
+
var isJsonSchema7AllOfType3 = (type) => {
|
|
5558
6830
|
if ("type" in type && type.type === "string")
|
|
5559
6831
|
return false;
|
|
5560
6832
|
return "allOf" in type;
|
|
5561
6833
|
};
|
|
5562
|
-
function
|
|
6834
|
+
function parseIntersectionDef3(def, refs) {
|
|
5563
6835
|
const allOf = [
|
|
5564
|
-
|
|
6836
|
+
parseDef3(def.left._def, {
|
|
5565
6837
|
...refs,
|
|
5566
6838
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
5567
6839
|
}),
|
|
5568
|
-
|
|
6840
|
+
parseDef3(def.right._def, {
|
|
5569
6841
|
...refs,
|
|
5570
6842
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
5571
6843
|
})
|
|
5572
6844
|
].filter((x) => !!x);
|
|
5573
6845
|
const mergedAllOf = [];
|
|
5574
6846
|
allOf.forEach((schema) => {
|
|
5575
|
-
if (
|
|
6847
|
+
if (isJsonSchema7AllOfType3(schema)) {
|
|
5576
6848
|
mergedAllOf.push(...schema.allOf);
|
|
5577
6849
|
} else {
|
|
5578
6850
|
let nestedSchema = schema;
|
|
@@ -5585,7 +6857,7 @@ function parseIntersectionDef2(def, refs) {
|
|
|
5585
6857
|
});
|
|
5586
6858
|
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
5587
6859
|
}
|
|
5588
|
-
function
|
|
6860
|
+
function parseLiteralDef3(def) {
|
|
5589
6861
|
const parsedType = typeof def.value;
|
|
5590
6862
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
5591
6863
|
return {
|
|
@@ -5597,8 +6869,8 @@ function parseLiteralDef2(def) {
|
|
|
5597
6869
|
const: def.value
|
|
5598
6870
|
};
|
|
5599
6871
|
}
|
|
5600
|
-
var
|
|
5601
|
-
var
|
|
6872
|
+
var emojiRegex3 = void 0;
|
|
6873
|
+
var zodPatterns3 = {
|
|
5602
6874
|
/**
|
|
5603
6875
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
5604
6876
|
*/
|
|
@@ -5621,13 +6893,13 @@ var zodPatterns2 = {
|
|
|
5621
6893
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
5622
6894
|
*/
|
|
5623
6895
|
emoji: () => {
|
|
5624
|
-
if (
|
|
5625
|
-
|
|
6896
|
+
if (emojiRegex3 === void 0) {
|
|
6897
|
+
emojiRegex3 = RegExp(
|
|
5626
6898
|
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
5627
6899
|
"u"
|
|
5628
6900
|
);
|
|
5629
6901
|
}
|
|
5630
|
-
return
|
|
6902
|
+
return emojiRegex3;
|
|
5631
6903
|
},
|
|
5632
6904
|
/**
|
|
5633
6905
|
* Unused
|
|
@@ -5648,7 +6920,7 @@ var zodPatterns2 = {
|
|
|
5648
6920
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
5649
6921
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
5650
6922
|
};
|
|
5651
|
-
function
|
|
6923
|
+
function parseStringDef3(def, refs) {
|
|
5652
6924
|
const res = {
|
|
5653
6925
|
type: "string"
|
|
5654
6926
|
};
|
|
@@ -5664,67 +6936,67 @@ function parseStringDef2(def, refs) {
|
|
|
5664
6936
|
case "email":
|
|
5665
6937
|
switch (refs.emailStrategy) {
|
|
5666
6938
|
case "format:email":
|
|
5667
|
-
|
|
6939
|
+
addFormat3(res, "email", check.message, refs);
|
|
5668
6940
|
break;
|
|
5669
6941
|
case "format:idn-email":
|
|
5670
|
-
|
|
6942
|
+
addFormat3(res, "idn-email", check.message, refs);
|
|
5671
6943
|
break;
|
|
5672
6944
|
case "pattern:zod":
|
|
5673
|
-
|
|
6945
|
+
addPattern3(res, zodPatterns3.email, check.message, refs);
|
|
5674
6946
|
break;
|
|
5675
6947
|
}
|
|
5676
6948
|
break;
|
|
5677
6949
|
case "url":
|
|
5678
|
-
|
|
6950
|
+
addFormat3(res, "uri", check.message, refs);
|
|
5679
6951
|
break;
|
|
5680
6952
|
case "uuid":
|
|
5681
|
-
|
|
6953
|
+
addFormat3(res, "uuid", check.message, refs);
|
|
5682
6954
|
break;
|
|
5683
6955
|
case "regex":
|
|
5684
|
-
|
|
6956
|
+
addPattern3(res, check.regex, check.message, refs);
|
|
5685
6957
|
break;
|
|
5686
6958
|
case "cuid":
|
|
5687
|
-
|
|
6959
|
+
addPattern3(res, zodPatterns3.cuid, check.message, refs);
|
|
5688
6960
|
break;
|
|
5689
6961
|
case "cuid2":
|
|
5690
|
-
|
|
6962
|
+
addPattern3(res, zodPatterns3.cuid2, check.message, refs);
|
|
5691
6963
|
break;
|
|
5692
6964
|
case "startsWith":
|
|
5693
|
-
|
|
6965
|
+
addPattern3(
|
|
5694
6966
|
res,
|
|
5695
|
-
RegExp(`^${
|
|
6967
|
+
RegExp(`^${escapeLiteralCheckValue3(check.value, refs)}`),
|
|
5696
6968
|
check.message,
|
|
5697
6969
|
refs
|
|
5698
6970
|
);
|
|
5699
6971
|
break;
|
|
5700
6972
|
case "endsWith":
|
|
5701
|
-
|
|
6973
|
+
addPattern3(
|
|
5702
6974
|
res,
|
|
5703
|
-
RegExp(`${
|
|
6975
|
+
RegExp(`${escapeLiteralCheckValue3(check.value, refs)}$`),
|
|
5704
6976
|
check.message,
|
|
5705
6977
|
refs
|
|
5706
6978
|
);
|
|
5707
6979
|
break;
|
|
5708
6980
|
case "datetime":
|
|
5709
|
-
|
|
6981
|
+
addFormat3(res, "date-time", check.message, refs);
|
|
5710
6982
|
break;
|
|
5711
6983
|
case "date":
|
|
5712
|
-
|
|
6984
|
+
addFormat3(res, "date", check.message, refs);
|
|
5713
6985
|
break;
|
|
5714
6986
|
case "time":
|
|
5715
|
-
|
|
6987
|
+
addFormat3(res, "time", check.message, refs);
|
|
5716
6988
|
break;
|
|
5717
6989
|
case "duration":
|
|
5718
|
-
|
|
6990
|
+
addFormat3(res, "duration", check.message, refs);
|
|
5719
6991
|
break;
|
|
5720
6992
|
case "length":
|
|
5721
6993
|
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
5722
6994
|
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
5723
6995
|
break;
|
|
5724
6996
|
case "includes": {
|
|
5725
|
-
|
|
6997
|
+
addPattern3(
|
|
5726
6998
|
res,
|
|
5727
|
-
RegExp(
|
|
6999
|
+
RegExp(escapeLiteralCheckValue3(check.value, refs)),
|
|
5728
7000
|
check.message,
|
|
5729
7001
|
refs
|
|
5730
7002
|
);
|
|
@@ -5732,39 +7004,39 @@ function parseStringDef2(def, refs) {
|
|
|
5732
7004
|
}
|
|
5733
7005
|
case "ip": {
|
|
5734
7006
|
if (check.version !== "v6") {
|
|
5735
|
-
|
|
7007
|
+
addFormat3(res, "ipv4", check.message, refs);
|
|
5736
7008
|
}
|
|
5737
7009
|
if (check.version !== "v4") {
|
|
5738
|
-
|
|
7010
|
+
addFormat3(res, "ipv6", check.message, refs);
|
|
5739
7011
|
}
|
|
5740
7012
|
break;
|
|
5741
7013
|
}
|
|
5742
7014
|
case "base64url":
|
|
5743
|
-
|
|
7015
|
+
addPattern3(res, zodPatterns3.base64url, check.message, refs);
|
|
5744
7016
|
break;
|
|
5745
7017
|
case "jwt":
|
|
5746
|
-
|
|
7018
|
+
addPattern3(res, zodPatterns3.jwt, check.message, refs);
|
|
5747
7019
|
break;
|
|
5748
7020
|
case "cidr": {
|
|
5749
7021
|
if (check.version !== "v6") {
|
|
5750
|
-
|
|
7022
|
+
addPattern3(res, zodPatterns3.ipv4Cidr, check.message, refs);
|
|
5751
7023
|
}
|
|
5752
7024
|
if (check.version !== "v4") {
|
|
5753
|
-
|
|
7025
|
+
addPattern3(res, zodPatterns3.ipv6Cidr, check.message, refs);
|
|
5754
7026
|
}
|
|
5755
7027
|
break;
|
|
5756
7028
|
}
|
|
5757
7029
|
case "emoji":
|
|
5758
|
-
|
|
7030
|
+
addPattern3(res, zodPatterns3.emoji(), check.message, refs);
|
|
5759
7031
|
break;
|
|
5760
7032
|
case "ulid": {
|
|
5761
|
-
|
|
7033
|
+
addPattern3(res, zodPatterns3.ulid, check.message, refs);
|
|
5762
7034
|
break;
|
|
5763
7035
|
}
|
|
5764
7036
|
case "base64": {
|
|
5765
7037
|
switch (refs.base64Strategy) {
|
|
5766
7038
|
case "format:binary": {
|
|
5767
|
-
|
|
7039
|
+
addFormat3(res, "binary", check.message, refs);
|
|
5768
7040
|
break;
|
|
5769
7041
|
}
|
|
5770
7042
|
case "contentEncoding:base64": {
|
|
@@ -5772,37 +7044,37 @@ function parseStringDef2(def, refs) {
|
|
|
5772
7044
|
break;
|
|
5773
7045
|
}
|
|
5774
7046
|
case "pattern:zod": {
|
|
5775
|
-
|
|
7047
|
+
addPattern3(res, zodPatterns3.base64, check.message, refs);
|
|
5776
7048
|
break;
|
|
5777
7049
|
}
|
|
5778
7050
|
}
|
|
5779
7051
|
break;
|
|
5780
7052
|
}
|
|
5781
7053
|
case "nanoid": {
|
|
5782
|
-
|
|
7054
|
+
addPattern3(res, zodPatterns3.nanoid, check.message, refs);
|
|
5783
7055
|
}
|
|
5784
7056
|
}
|
|
5785
7057
|
}
|
|
5786
7058
|
}
|
|
5787
7059
|
return res;
|
|
5788
7060
|
}
|
|
5789
|
-
function
|
|
5790
|
-
return refs.patternStrategy === "escape" ?
|
|
7061
|
+
function escapeLiteralCheckValue3(literal, refs) {
|
|
7062
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric3(literal) : literal;
|
|
5791
7063
|
}
|
|
5792
|
-
var
|
|
7064
|
+
var ALPHA_NUMERIC3 = new Set(
|
|
5793
7065
|
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
5794
7066
|
);
|
|
5795
|
-
function
|
|
7067
|
+
function escapeNonAlphaNumeric3(source) {
|
|
5796
7068
|
let result = "";
|
|
5797
7069
|
for (let i = 0; i < source.length; i++) {
|
|
5798
|
-
if (!
|
|
7070
|
+
if (!ALPHA_NUMERIC3.has(source[i])) {
|
|
5799
7071
|
result += "\\";
|
|
5800
7072
|
}
|
|
5801
7073
|
result += source[i];
|
|
5802
7074
|
}
|
|
5803
7075
|
return result;
|
|
5804
7076
|
}
|
|
5805
|
-
function
|
|
7077
|
+
function addFormat3(schema, value, message, refs) {
|
|
5806
7078
|
var _a26;
|
|
5807
7079
|
if (schema.format || ((_a26 = schema.anyOf) == null ? void 0 : _a26.some((x) => x.format))) {
|
|
5808
7080
|
if (!schema.anyOf) {
|
|
@@ -5822,7 +7094,7 @@ function addFormat2(schema, value, message, refs) {
|
|
|
5822
7094
|
schema.format = value;
|
|
5823
7095
|
}
|
|
5824
7096
|
}
|
|
5825
|
-
function
|
|
7097
|
+
function addPattern3(schema, regex, message, refs) {
|
|
5826
7098
|
var _a26;
|
|
5827
7099
|
if (schema.pattern || ((_a26 = schema.allOf) == null ? void 0 : _a26.some((x) => x.pattern))) {
|
|
5828
7100
|
if (!schema.allOf) {
|
|
@@ -5835,14 +7107,14 @@ function addPattern2(schema, regex, message, refs) {
|
|
|
5835
7107
|
delete schema.pattern;
|
|
5836
7108
|
}
|
|
5837
7109
|
schema.allOf.push({
|
|
5838
|
-
pattern:
|
|
7110
|
+
pattern: stringifyRegExpWithFlags3(regex, refs),
|
|
5839
7111
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
5840
7112
|
});
|
|
5841
7113
|
} else {
|
|
5842
|
-
schema.pattern =
|
|
7114
|
+
schema.pattern = stringifyRegExpWithFlags3(regex, refs);
|
|
5843
7115
|
}
|
|
5844
7116
|
}
|
|
5845
|
-
function
|
|
7117
|
+
function stringifyRegExpWithFlags3(regex, refs) {
|
|
5846
7118
|
var _a26;
|
|
5847
7119
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
5848
7120
|
return regex.source;
|
|
@@ -5914,17 +7186,17 @@ function stringifyRegExpWithFlags2(regex, refs) {
|
|
|
5914
7186
|
}
|
|
5915
7187
|
return pattern;
|
|
5916
7188
|
}
|
|
5917
|
-
function
|
|
7189
|
+
function parseRecordDef3(def, refs) {
|
|
5918
7190
|
var _a26, _b8, _c, _d, _e, _f;
|
|
5919
7191
|
const schema = {
|
|
5920
7192
|
type: "object",
|
|
5921
|
-
additionalProperties: (_a26 =
|
|
7193
|
+
additionalProperties: (_a26 = parseDef3(def.valueType._def, {
|
|
5922
7194
|
...refs,
|
|
5923
7195
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
5924
7196
|
})) != null ? _a26 : refs.allowedAdditionalProperties
|
|
5925
7197
|
};
|
|
5926
7198
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind$1.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
5927
|
-
const { type, ...keyType } =
|
|
7199
|
+
const { type, ...keyType } = parseStringDef3(def.keyType._def, refs);
|
|
5928
7200
|
return {
|
|
5929
7201
|
...schema,
|
|
5930
7202
|
propertyNames: keyType
|
|
@@ -5937,7 +7209,7 @@ function parseRecordDef2(def, refs) {
|
|
|
5937
7209
|
}
|
|
5938
7210
|
};
|
|
5939
7211
|
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
5940
|
-
const { type, ...keyType } =
|
|
7212
|
+
const { type, ...keyType } = parseBrandedDef3(
|
|
5941
7213
|
def.keyType._def,
|
|
5942
7214
|
refs
|
|
5943
7215
|
);
|
|
@@ -5948,18 +7220,18 @@ function parseRecordDef2(def, refs) {
|
|
|
5948
7220
|
}
|
|
5949
7221
|
return schema;
|
|
5950
7222
|
}
|
|
5951
|
-
function
|
|
7223
|
+
function parseMapDef3(def, refs) {
|
|
5952
7224
|
if (refs.mapStrategy === "record") {
|
|
5953
|
-
return
|
|
7225
|
+
return parseRecordDef3(def, refs);
|
|
5954
7226
|
}
|
|
5955
|
-
const keys =
|
|
7227
|
+
const keys = parseDef3(def.keyType._def, {
|
|
5956
7228
|
...refs,
|
|
5957
7229
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
5958
|
-
}) ||
|
|
5959
|
-
const values =
|
|
7230
|
+
}) || parseAnyDef3();
|
|
7231
|
+
const values = parseDef3(def.valueType._def, {
|
|
5960
7232
|
...refs,
|
|
5961
7233
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
5962
|
-
}) ||
|
|
7234
|
+
}) || parseAnyDef3();
|
|
5963
7235
|
return {
|
|
5964
7236
|
type: "array",
|
|
5965
7237
|
maxItems: 125,
|
|
@@ -5971,7 +7243,7 @@ function parseMapDef2(def, refs) {
|
|
|
5971
7243
|
}
|
|
5972
7244
|
};
|
|
5973
7245
|
}
|
|
5974
|
-
function
|
|
7246
|
+
function parseNativeEnumDef3(def) {
|
|
5975
7247
|
const object5 = def.values;
|
|
5976
7248
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
5977
7249
|
return typeof object5[object5[key]] !== "number";
|
|
@@ -5985,28 +7257,28 @@ function parseNativeEnumDef2(def) {
|
|
|
5985
7257
|
enum: actualValues
|
|
5986
7258
|
};
|
|
5987
7259
|
}
|
|
5988
|
-
function
|
|
5989
|
-
return { not:
|
|
7260
|
+
function parseNeverDef3() {
|
|
7261
|
+
return { not: parseAnyDef3() };
|
|
5990
7262
|
}
|
|
5991
|
-
function
|
|
7263
|
+
function parseNullDef3() {
|
|
5992
7264
|
return {
|
|
5993
7265
|
type: "null"
|
|
5994
7266
|
};
|
|
5995
7267
|
}
|
|
5996
|
-
var
|
|
7268
|
+
var primitiveMappings3 = {
|
|
5997
7269
|
ZodString: "string",
|
|
5998
7270
|
ZodNumber: "number",
|
|
5999
7271
|
ZodBigInt: "integer",
|
|
6000
7272
|
ZodBoolean: "boolean",
|
|
6001
7273
|
ZodNull: "null"
|
|
6002
7274
|
};
|
|
6003
|
-
function
|
|
7275
|
+
function parseUnionDef3(def, refs) {
|
|
6004
7276
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
6005
7277
|
if (options.every(
|
|
6006
|
-
(x) => x._def.typeName in
|
|
7278
|
+
(x) => x._def.typeName in primitiveMappings3 && (!x._def.checks || !x._def.checks.length)
|
|
6007
7279
|
)) {
|
|
6008
7280
|
const types = options.reduce((types2, x) => {
|
|
6009
|
-
const type =
|
|
7281
|
+
const type = primitiveMappings3[x._def.typeName];
|
|
6010
7282
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
6011
7283
|
}, []);
|
|
6012
7284
|
return {
|
|
@@ -6059,11 +7331,11 @@ function parseUnionDef2(def, refs) {
|
|
|
6059
7331
|
)
|
|
6060
7332
|
};
|
|
6061
7333
|
}
|
|
6062
|
-
return
|
|
7334
|
+
return asAnyOf3(def, refs);
|
|
6063
7335
|
}
|
|
6064
|
-
var
|
|
7336
|
+
var asAnyOf3 = (def, refs) => {
|
|
6065
7337
|
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
6066
|
-
(x, i) =>
|
|
7338
|
+
(x, i) => parseDef3(x._def, {
|
|
6067
7339
|
...refs,
|
|
6068
7340
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
6069
7341
|
})
|
|
@@ -6072,24 +7344,24 @@ var asAnyOf2 = (def, refs) => {
|
|
|
6072
7344
|
);
|
|
6073
7345
|
return anyOf.length ? { anyOf } : void 0;
|
|
6074
7346
|
};
|
|
6075
|
-
function
|
|
7347
|
+
function parseNullableDef3(def, refs) {
|
|
6076
7348
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
6077
7349
|
def.innerType._def.typeName
|
|
6078
7350
|
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
6079
7351
|
return {
|
|
6080
7352
|
type: [
|
|
6081
|
-
|
|
7353
|
+
primitiveMappings3[def.innerType._def.typeName],
|
|
6082
7354
|
"null"
|
|
6083
7355
|
]
|
|
6084
7356
|
};
|
|
6085
7357
|
}
|
|
6086
|
-
const base =
|
|
7358
|
+
const base = parseDef3(def.innerType._def, {
|
|
6087
7359
|
...refs,
|
|
6088
7360
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
6089
7361
|
});
|
|
6090
7362
|
return base && { anyOf: [base, { type: "null" }] };
|
|
6091
7363
|
}
|
|
6092
|
-
function
|
|
7364
|
+
function parseNumberDef3(def) {
|
|
6093
7365
|
const res = {
|
|
6094
7366
|
type: "number"
|
|
6095
7367
|
};
|
|
@@ -6121,7 +7393,7 @@ function parseNumberDef2(def) {
|
|
|
6121
7393
|
}
|
|
6122
7394
|
return res;
|
|
6123
7395
|
}
|
|
6124
|
-
function
|
|
7396
|
+
function parseObjectDef3(def, refs) {
|
|
6125
7397
|
const result = {
|
|
6126
7398
|
type: "object",
|
|
6127
7399
|
properties: {}
|
|
@@ -6133,8 +7405,8 @@ function parseObjectDef2(def, refs) {
|
|
|
6133
7405
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
6134
7406
|
continue;
|
|
6135
7407
|
}
|
|
6136
|
-
const propOptional =
|
|
6137
|
-
const parsedDef =
|
|
7408
|
+
const propOptional = safeIsOptional3(propDef);
|
|
7409
|
+
const parsedDef = parseDef3(propDef._def, {
|
|
6138
7410
|
...refs,
|
|
6139
7411
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
6140
7412
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -6150,15 +7422,15 @@ function parseObjectDef2(def, refs) {
|
|
|
6150
7422
|
if (required.length) {
|
|
6151
7423
|
result.required = required;
|
|
6152
7424
|
}
|
|
6153
|
-
const additionalProperties =
|
|
7425
|
+
const additionalProperties = decideAdditionalProperties3(def, refs);
|
|
6154
7426
|
if (additionalProperties !== void 0) {
|
|
6155
7427
|
result.additionalProperties = additionalProperties;
|
|
6156
7428
|
}
|
|
6157
7429
|
return result;
|
|
6158
7430
|
}
|
|
6159
|
-
function
|
|
7431
|
+
function decideAdditionalProperties3(def, refs) {
|
|
6160
7432
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
6161
|
-
return
|
|
7433
|
+
return parseDef3(def.catchall._def, {
|
|
6162
7434
|
...refs,
|
|
6163
7435
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
6164
7436
|
});
|
|
@@ -6172,35 +7444,35 @@ function decideAdditionalProperties2(def, refs) {
|
|
|
6172
7444
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
6173
7445
|
}
|
|
6174
7446
|
}
|
|
6175
|
-
function
|
|
7447
|
+
function safeIsOptional3(schema) {
|
|
6176
7448
|
try {
|
|
6177
7449
|
return schema.isOptional();
|
|
6178
7450
|
} catch (e2) {
|
|
6179
7451
|
return true;
|
|
6180
7452
|
}
|
|
6181
7453
|
}
|
|
6182
|
-
var
|
|
7454
|
+
var parseOptionalDef3 = (def, refs) => {
|
|
6183
7455
|
var _a26;
|
|
6184
7456
|
if (refs.currentPath.toString() === ((_a26 = refs.propertyPath) == null ? void 0 : _a26.toString())) {
|
|
6185
|
-
return
|
|
7457
|
+
return parseDef3(def.innerType._def, refs);
|
|
6186
7458
|
}
|
|
6187
|
-
const innerSchema =
|
|
7459
|
+
const innerSchema = parseDef3(def.innerType._def, {
|
|
6188
7460
|
...refs,
|
|
6189
7461
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
6190
7462
|
});
|
|
6191
|
-
return innerSchema ? { anyOf: [{ not:
|
|
7463
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef3() }, innerSchema] } : parseAnyDef3();
|
|
6192
7464
|
};
|
|
6193
|
-
var
|
|
7465
|
+
var parsePipelineDef3 = (def, refs) => {
|
|
6194
7466
|
if (refs.pipeStrategy === "input") {
|
|
6195
|
-
return
|
|
7467
|
+
return parseDef3(def.in._def, refs);
|
|
6196
7468
|
} else if (refs.pipeStrategy === "output") {
|
|
6197
|
-
return
|
|
7469
|
+
return parseDef3(def.out._def, refs);
|
|
6198
7470
|
}
|
|
6199
|
-
const a =
|
|
7471
|
+
const a = parseDef3(def.in._def, {
|
|
6200
7472
|
...refs,
|
|
6201
7473
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
6202
7474
|
});
|
|
6203
|
-
const b =
|
|
7475
|
+
const b = parseDef3(def.out._def, {
|
|
6204
7476
|
...refs,
|
|
6205
7477
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
6206
7478
|
});
|
|
@@ -6208,11 +7480,11 @@ var parsePipelineDef2 = (def, refs) => {
|
|
|
6208
7480
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
6209
7481
|
};
|
|
6210
7482
|
};
|
|
6211
|
-
function
|
|
6212
|
-
return
|
|
7483
|
+
function parsePromiseDef3(def, refs) {
|
|
7484
|
+
return parseDef3(def.type._def, refs);
|
|
6213
7485
|
}
|
|
6214
|
-
function
|
|
6215
|
-
const items =
|
|
7486
|
+
function parseSetDef3(def, refs) {
|
|
7487
|
+
const items = parseDef3(def.valueType._def, {
|
|
6216
7488
|
...refs,
|
|
6217
7489
|
currentPath: [...refs.currentPath, "items"]
|
|
6218
7490
|
});
|
|
@@ -6229,13 +7501,13 @@ function parseSetDef2(def, refs) {
|
|
|
6229
7501
|
}
|
|
6230
7502
|
return schema;
|
|
6231
7503
|
}
|
|
6232
|
-
function
|
|
7504
|
+
function parseTupleDef3(def, refs) {
|
|
6233
7505
|
if (def.rest) {
|
|
6234
7506
|
return {
|
|
6235
7507
|
type: "array",
|
|
6236
7508
|
minItems: def.items.length,
|
|
6237
7509
|
items: def.items.map(
|
|
6238
|
-
(x, i) =>
|
|
7510
|
+
(x, i) => parseDef3(x._def, {
|
|
6239
7511
|
...refs,
|
|
6240
7512
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
6241
7513
|
})
|
|
@@ -6243,7 +7515,7 @@ function parseTupleDef2(def, refs) {
|
|
|
6243
7515
|
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
6244
7516
|
[]
|
|
6245
7517
|
),
|
|
6246
|
-
additionalItems:
|
|
7518
|
+
additionalItems: parseDef3(def.rest._def, {
|
|
6247
7519
|
...refs,
|
|
6248
7520
|
currentPath: [...refs.currentPath, "additionalItems"]
|
|
6249
7521
|
})
|
|
@@ -6254,7 +7526,7 @@ function parseTupleDef2(def, refs) {
|
|
|
6254
7526
|
minItems: def.items.length,
|
|
6255
7527
|
maxItems: def.items.length,
|
|
6256
7528
|
items: def.items.map(
|
|
6257
|
-
(x, i) =>
|
|
7529
|
+
(x, i) => parseDef3(x._def, {
|
|
6258
7530
|
...refs,
|
|
6259
7531
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
6260
7532
|
})
|
|
@@ -6265,83 +7537,83 @@ function parseTupleDef2(def, refs) {
|
|
|
6265
7537
|
};
|
|
6266
7538
|
}
|
|
6267
7539
|
}
|
|
6268
|
-
function
|
|
7540
|
+
function parseUndefinedDef3() {
|
|
6269
7541
|
return {
|
|
6270
|
-
not:
|
|
7542
|
+
not: parseAnyDef3()
|
|
6271
7543
|
};
|
|
6272
7544
|
}
|
|
6273
|
-
function
|
|
6274
|
-
return
|
|
7545
|
+
function parseUnknownDef3() {
|
|
7546
|
+
return parseAnyDef3();
|
|
6275
7547
|
}
|
|
6276
|
-
var
|
|
6277
|
-
return
|
|
7548
|
+
var parseReadonlyDef3 = (def, refs) => {
|
|
7549
|
+
return parseDef3(def.innerType._def, refs);
|
|
6278
7550
|
};
|
|
6279
|
-
var
|
|
7551
|
+
var selectParser3 = (def, typeName, refs) => {
|
|
6280
7552
|
switch (typeName) {
|
|
6281
7553
|
case ZodFirstPartyTypeKind$1.ZodString:
|
|
6282
|
-
return
|
|
7554
|
+
return parseStringDef3(def, refs);
|
|
6283
7555
|
case ZodFirstPartyTypeKind$1.ZodNumber:
|
|
6284
|
-
return
|
|
7556
|
+
return parseNumberDef3(def);
|
|
6285
7557
|
case ZodFirstPartyTypeKind$1.ZodObject:
|
|
6286
|
-
return
|
|
7558
|
+
return parseObjectDef3(def, refs);
|
|
6287
7559
|
case ZodFirstPartyTypeKind$1.ZodBigInt:
|
|
6288
|
-
return
|
|
7560
|
+
return parseBigintDef3(def);
|
|
6289
7561
|
case ZodFirstPartyTypeKind$1.ZodBoolean:
|
|
6290
|
-
return
|
|
7562
|
+
return parseBooleanDef3();
|
|
6291
7563
|
case ZodFirstPartyTypeKind$1.ZodDate:
|
|
6292
|
-
return
|
|
7564
|
+
return parseDateDef3(def, refs);
|
|
6293
7565
|
case ZodFirstPartyTypeKind$1.ZodUndefined:
|
|
6294
|
-
return
|
|
7566
|
+
return parseUndefinedDef3();
|
|
6295
7567
|
case ZodFirstPartyTypeKind$1.ZodNull:
|
|
6296
|
-
return
|
|
7568
|
+
return parseNullDef3();
|
|
6297
7569
|
case ZodFirstPartyTypeKind$1.ZodArray:
|
|
6298
|
-
return
|
|
7570
|
+
return parseArrayDef3(def, refs);
|
|
6299
7571
|
case ZodFirstPartyTypeKind$1.ZodUnion:
|
|
6300
7572
|
case ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion:
|
|
6301
|
-
return
|
|
7573
|
+
return parseUnionDef3(def, refs);
|
|
6302
7574
|
case ZodFirstPartyTypeKind$1.ZodIntersection:
|
|
6303
|
-
return
|
|
7575
|
+
return parseIntersectionDef3(def, refs);
|
|
6304
7576
|
case ZodFirstPartyTypeKind$1.ZodTuple:
|
|
6305
|
-
return
|
|
7577
|
+
return parseTupleDef3(def, refs);
|
|
6306
7578
|
case ZodFirstPartyTypeKind$1.ZodRecord:
|
|
6307
|
-
return
|
|
7579
|
+
return parseRecordDef3(def, refs);
|
|
6308
7580
|
case ZodFirstPartyTypeKind$1.ZodLiteral:
|
|
6309
|
-
return
|
|
7581
|
+
return parseLiteralDef3(def);
|
|
6310
7582
|
case ZodFirstPartyTypeKind$1.ZodEnum:
|
|
6311
|
-
return
|
|
7583
|
+
return parseEnumDef3(def);
|
|
6312
7584
|
case ZodFirstPartyTypeKind$1.ZodNativeEnum:
|
|
6313
|
-
return
|
|
7585
|
+
return parseNativeEnumDef3(def);
|
|
6314
7586
|
case ZodFirstPartyTypeKind$1.ZodNullable:
|
|
6315
|
-
return
|
|
7587
|
+
return parseNullableDef3(def, refs);
|
|
6316
7588
|
case ZodFirstPartyTypeKind$1.ZodOptional:
|
|
6317
|
-
return
|
|
7589
|
+
return parseOptionalDef3(def, refs);
|
|
6318
7590
|
case ZodFirstPartyTypeKind$1.ZodMap:
|
|
6319
|
-
return
|
|
7591
|
+
return parseMapDef3(def, refs);
|
|
6320
7592
|
case ZodFirstPartyTypeKind$1.ZodSet:
|
|
6321
|
-
return
|
|
7593
|
+
return parseSetDef3(def, refs);
|
|
6322
7594
|
case ZodFirstPartyTypeKind$1.ZodLazy:
|
|
6323
7595
|
return () => def.getter()._def;
|
|
6324
7596
|
case ZodFirstPartyTypeKind$1.ZodPromise:
|
|
6325
|
-
return
|
|
7597
|
+
return parsePromiseDef3(def, refs);
|
|
6326
7598
|
case ZodFirstPartyTypeKind$1.ZodNaN:
|
|
6327
7599
|
case ZodFirstPartyTypeKind$1.ZodNever:
|
|
6328
|
-
return
|
|
7600
|
+
return parseNeverDef3();
|
|
6329
7601
|
case ZodFirstPartyTypeKind$1.ZodEffects:
|
|
6330
|
-
return
|
|
7602
|
+
return parseEffectsDef3(def, refs);
|
|
6331
7603
|
case ZodFirstPartyTypeKind$1.ZodAny:
|
|
6332
|
-
return
|
|
7604
|
+
return parseAnyDef3();
|
|
6333
7605
|
case ZodFirstPartyTypeKind$1.ZodUnknown:
|
|
6334
|
-
return
|
|
7606
|
+
return parseUnknownDef3();
|
|
6335
7607
|
case ZodFirstPartyTypeKind$1.ZodDefault:
|
|
6336
|
-
return
|
|
7608
|
+
return parseDefaultDef3(def, refs);
|
|
6337
7609
|
case ZodFirstPartyTypeKind$1.ZodBranded:
|
|
6338
|
-
return
|
|
7610
|
+
return parseBrandedDef3(def, refs);
|
|
6339
7611
|
case ZodFirstPartyTypeKind$1.ZodReadonly:
|
|
6340
|
-
return
|
|
7612
|
+
return parseReadonlyDef3(def, refs);
|
|
6341
7613
|
case ZodFirstPartyTypeKind$1.ZodCatch:
|
|
6342
|
-
return
|
|
7614
|
+
return parseCatchDef3(def, refs);
|
|
6343
7615
|
case ZodFirstPartyTypeKind$1.ZodPipeline:
|
|
6344
|
-
return
|
|
7616
|
+
return parsePipelineDef3(def, refs);
|
|
6345
7617
|
case ZodFirstPartyTypeKind$1.ZodFunction:
|
|
6346
7618
|
case ZodFirstPartyTypeKind$1.ZodVoid:
|
|
6347
7619
|
case ZodFirstPartyTypeKind$1.ZodSymbol:
|
|
@@ -6350,7 +7622,7 @@ var selectParser2 = (def, typeName, refs) => {
|
|
|
6350
7622
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
6351
7623
|
}
|
|
6352
7624
|
};
|
|
6353
|
-
function
|
|
7625
|
+
function parseDef3(def, refs, forceResolution = false) {
|
|
6354
7626
|
var _a26;
|
|
6355
7627
|
const seenItem = refs.seen.get(def);
|
|
6356
7628
|
if (refs.override) {
|
|
@@ -6361,22 +7633,22 @@ function parseDef2(def, refs, forceResolution = false) {
|
|
|
6361
7633
|
seenItem,
|
|
6362
7634
|
forceResolution
|
|
6363
7635
|
);
|
|
6364
|
-
if (overrideResult !==
|
|
7636
|
+
if (overrideResult !== ignoreOverride3) {
|
|
6365
7637
|
return overrideResult;
|
|
6366
7638
|
}
|
|
6367
7639
|
}
|
|
6368
7640
|
if (seenItem && !forceResolution) {
|
|
6369
|
-
const seenSchema = get$
|
|
7641
|
+
const seenSchema = get$ref3(seenItem, refs);
|
|
6370
7642
|
if (seenSchema !== void 0) {
|
|
6371
7643
|
return seenSchema;
|
|
6372
7644
|
}
|
|
6373
7645
|
}
|
|
6374
7646
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
6375
7647
|
refs.seen.set(def, newItem);
|
|
6376
|
-
const jsonSchemaOrGetter =
|
|
6377
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
7648
|
+
const jsonSchemaOrGetter = selectParser3(def, def.typeName, refs);
|
|
7649
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef3(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
6378
7650
|
if (jsonSchema22) {
|
|
6379
|
-
|
|
7651
|
+
addMeta3(def, refs, jsonSchema22);
|
|
6380
7652
|
}
|
|
6381
7653
|
if (refs.postProcess) {
|
|
6382
7654
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -6386,12 +7658,12 @@ function parseDef2(def, refs, forceResolution = false) {
|
|
|
6386
7658
|
newItem.jsonSchema = jsonSchema22;
|
|
6387
7659
|
return jsonSchema22;
|
|
6388
7660
|
}
|
|
6389
|
-
var get$
|
|
7661
|
+
var get$ref3 = (item, refs) => {
|
|
6390
7662
|
switch (refs.$refStrategy) {
|
|
6391
7663
|
case "root":
|
|
6392
7664
|
return { $ref: item.path.join("/") };
|
|
6393
7665
|
case "relative":
|
|
6394
|
-
return { $ref:
|
|
7666
|
+
return { $ref: getRelativePath3(refs.currentPath, item.path) };
|
|
6395
7667
|
case "none":
|
|
6396
7668
|
case "seen": {
|
|
6397
7669
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
@@ -6400,20 +7672,20 @@ var get$ref2 = (item, refs) => {
|
|
|
6400
7672
|
"/"
|
|
6401
7673
|
)}! Defaulting to any`
|
|
6402
7674
|
);
|
|
6403
|
-
return
|
|
7675
|
+
return parseAnyDef3();
|
|
6404
7676
|
}
|
|
6405
|
-
return refs.$refStrategy === "seen" ?
|
|
7677
|
+
return refs.$refStrategy === "seen" ? parseAnyDef3() : void 0;
|
|
6406
7678
|
}
|
|
6407
7679
|
}
|
|
6408
7680
|
};
|
|
6409
|
-
var
|
|
7681
|
+
var addMeta3 = (def, refs, jsonSchema22) => {
|
|
6410
7682
|
if (def.description) {
|
|
6411
7683
|
jsonSchema22.description = def.description;
|
|
6412
7684
|
}
|
|
6413
7685
|
return jsonSchema22;
|
|
6414
7686
|
};
|
|
6415
|
-
var
|
|
6416
|
-
const _options =
|
|
7687
|
+
var getRefs3 = (options) => {
|
|
7688
|
+
const _options = getDefaultOptions3(options);
|
|
6417
7689
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
6418
7690
|
return {
|
|
6419
7691
|
..._options,
|
|
@@ -6432,35 +7704,35 @@ var getRefs2 = (options) => {
|
|
|
6432
7704
|
)
|
|
6433
7705
|
};
|
|
6434
7706
|
};
|
|
6435
|
-
var
|
|
7707
|
+
var zodToJsonSchema4 = (schema, options) => {
|
|
6436
7708
|
var _a26;
|
|
6437
|
-
const refs =
|
|
7709
|
+
const refs = getRefs3(options);
|
|
6438
7710
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
6439
7711
|
(acc, [name26, schema2]) => {
|
|
6440
7712
|
var _a27;
|
|
6441
7713
|
return {
|
|
6442
7714
|
...acc,
|
|
6443
|
-
[name26]: (_a27 =
|
|
7715
|
+
[name26]: (_a27 = parseDef3(
|
|
6444
7716
|
schema2._def,
|
|
6445
7717
|
{
|
|
6446
7718
|
...refs,
|
|
6447
7719
|
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
6448
7720
|
},
|
|
6449
7721
|
true
|
|
6450
|
-
)) != null ? _a27 :
|
|
7722
|
+
)) != null ? _a27 : parseAnyDef3()
|
|
6451
7723
|
};
|
|
6452
7724
|
},
|
|
6453
7725
|
{}
|
|
6454
7726
|
) : void 0;
|
|
6455
7727
|
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
6456
|
-
const main = (_a26 =
|
|
7728
|
+
const main = (_a26 = parseDef3(
|
|
6457
7729
|
schema._def,
|
|
6458
7730
|
name21 === void 0 ? refs : {
|
|
6459
7731
|
...refs,
|
|
6460
7732
|
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
6461
7733
|
},
|
|
6462
7734
|
false
|
|
6463
|
-
)) != null ? _a26 :
|
|
7735
|
+
)) != null ? _a26 : parseAnyDef3();
|
|
6464
7736
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
6465
7737
|
if (title !== void 0) {
|
|
6466
7738
|
main.title = title;
|
|
@@ -6482,7 +7754,7 @@ var zodToJsonSchema3 = (schema, options) => {
|
|
|
6482
7754
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
6483
7755
|
return combined;
|
|
6484
7756
|
};
|
|
6485
|
-
var zod_to_json_schema_default =
|
|
7757
|
+
var zod_to_json_schema_default = zodToJsonSchema4;
|
|
6486
7758
|
function zod3Schema(zodSchema22, options) {
|
|
6487
7759
|
var _a26;
|
|
6488
7760
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
@@ -10476,8 +11748,8 @@ function safeParseJSON3({
|
|
|
10476
11748
|
};
|
|
10477
11749
|
}
|
|
10478
11750
|
}
|
|
10479
|
-
var
|
|
10480
|
-
var
|
|
11751
|
+
var ignoreOverride4 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
11752
|
+
var defaultOptions4 = {
|
|
10481
11753
|
name: void 0,
|
|
10482
11754
|
$refStrategy: "root",
|
|
10483
11755
|
basePath: ["#"],
|
|
@@ -10501,15 +11773,15 @@ var defaultOptions3 = {
|
|
|
10501
11773
|
nameStrategy: "ref",
|
|
10502
11774
|
openAiAnyTypeName: "OpenAiAnyType"
|
|
10503
11775
|
};
|
|
10504
|
-
var
|
|
10505
|
-
...
|
|
11776
|
+
var getDefaultOptions4 = (options) => typeof options === "string" ? {
|
|
11777
|
+
...defaultOptions4,
|
|
10506
11778
|
name: options
|
|
10507
11779
|
} : {
|
|
10508
|
-
...
|
|
11780
|
+
...defaultOptions4,
|
|
10509
11781
|
...options
|
|
10510
11782
|
};
|
|
10511
|
-
var
|
|
10512
|
-
const _options =
|
|
11783
|
+
var getRefs4 = (options) => {
|
|
11784
|
+
const _options = getDefaultOptions4(options);
|
|
10513
11785
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
10514
11786
|
return {
|
|
10515
11787
|
..._options,
|
|
@@ -10527,7 +11799,7 @@ var getRefs3 = (options) => {
|
|
|
10527
11799
|
]))
|
|
10528
11800
|
};
|
|
10529
11801
|
};
|
|
10530
|
-
function
|
|
11802
|
+
function addErrorMessage3(res, key, errorMessage, refs) {
|
|
10531
11803
|
if (!refs?.errorMessages)
|
|
10532
11804
|
return;
|
|
10533
11805
|
if (errorMessage) {
|
|
@@ -10537,11 +11809,11 @@ function addErrorMessage2(res, key, errorMessage, refs) {
|
|
|
10537
11809
|
};
|
|
10538
11810
|
}
|
|
10539
11811
|
}
|
|
10540
|
-
function
|
|
11812
|
+
function setResponseValueAndErrors3(res, key, value, errorMessage, refs) {
|
|
10541
11813
|
res[key] = value;
|
|
10542
|
-
|
|
11814
|
+
addErrorMessage3(res, key, errorMessage, refs);
|
|
10543
11815
|
}
|
|
10544
|
-
var
|
|
11816
|
+
var getRelativePath4 = (pathA, pathB) => {
|
|
10545
11817
|
let i = 0;
|
|
10546
11818
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
10547
11819
|
if (pathA[i] !== pathB[i])
|
|
@@ -10549,7 +11821,7 @@ var getRelativePath3 = (pathA, pathB) => {
|
|
|
10549
11821
|
}
|
|
10550
11822
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
10551
11823
|
};
|
|
10552
|
-
function
|
|
11824
|
+
function parseAnyDef4(refs) {
|
|
10553
11825
|
if (refs.target !== "openAi") {
|
|
10554
11826
|
return {};
|
|
10555
11827
|
}
|
|
@@ -10560,32 +11832,32 @@ function parseAnyDef3(refs) {
|
|
|
10560
11832
|
];
|
|
10561
11833
|
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
10562
11834
|
return {
|
|
10563
|
-
$ref: refs.$refStrategy === "relative" ?
|
|
11835
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath4(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
10564
11836
|
};
|
|
10565
11837
|
}
|
|
10566
|
-
function
|
|
11838
|
+
function parseArrayDef4(def, refs) {
|
|
10567
11839
|
const res = {
|
|
10568
11840
|
type: "array"
|
|
10569
11841
|
};
|
|
10570
|
-
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
|
|
10571
|
-
res.items =
|
|
11842
|
+
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
11843
|
+
res.items = parseDef4(def.type._def, {
|
|
10572
11844
|
...refs,
|
|
10573
11845
|
currentPath: [...refs.currentPath, "items"]
|
|
10574
11846
|
});
|
|
10575
11847
|
}
|
|
10576
11848
|
if (def.minLength) {
|
|
10577
|
-
|
|
11849
|
+
setResponseValueAndErrors3(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
10578
11850
|
}
|
|
10579
11851
|
if (def.maxLength) {
|
|
10580
|
-
|
|
11852
|
+
setResponseValueAndErrors3(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
10581
11853
|
}
|
|
10582
11854
|
if (def.exactLength) {
|
|
10583
|
-
|
|
10584
|
-
|
|
11855
|
+
setResponseValueAndErrors3(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
11856
|
+
setResponseValueAndErrors3(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
10585
11857
|
}
|
|
10586
11858
|
return res;
|
|
10587
11859
|
}
|
|
10588
|
-
function
|
|
11860
|
+
function parseBigintDef4(def, refs) {
|
|
10589
11861
|
const res = {
|
|
10590
11862
|
type: "integer",
|
|
10591
11863
|
format: "int64"
|
|
@@ -10597,54 +11869,54 @@ function parseBigintDef3(def, refs) {
|
|
|
10597
11869
|
case "min":
|
|
10598
11870
|
if (refs.target === "jsonSchema7") {
|
|
10599
11871
|
if (check.inclusive) {
|
|
10600
|
-
|
|
11872
|
+
setResponseValueAndErrors3(res, "minimum", check.value, check.message, refs);
|
|
10601
11873
|
} else {
|
|
10602
|
-
|
|
11874
|
+
setResponseValueAndErrors3(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
10603
11875
|
}
|
|
10604
11876
|
} else {
|
|
10605
11877
|
if (!check.inclusive) {
|
|
10606
11878
|
res.exclusiveMinimum = true;
|
|
10607
11879
|
}
|
|
10608
|
-
|
|
11880
|
+
setResponseValueAndErrors3(res, "minimum", check.value, check.message, refs);
|
|
10609
11881
|
}
|
|
10610
11882
|
break;
|
|
10611
11883
|
case "max":
|
|
10612
11884
|
if (refs.target === "jsonSchema7") {
|
|
10613
11885
|
if (check.inclusive) {
|
|
10614
|
-
|
|
11886
|
+
setResponseValueAndErrors3(res, "maximum", check.value, check.message, refs);
|
|
10615
11887
|
} else {
|
|
10616
|
-
|
|
11888
|
+
setResponseValueAndErrors3(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
10617
11889
|
}
|
|
10618
11890
|
} else {
|
|
10619
11891
|
if (!check.inclusive) {
|
|
10620
11892
|
res.exclusiveMaximum = true;
|
|
10621
11893
|
}
|
|
10622
|
-
|
|
11894
|
+
setResponseValueAndErrors3(res, "maximum", check.value, check.message, refs);
|
|
10623
11895
|
}
|
|
10624
11896
|
break;
|
|
10625
11897
|
case "multipleOf":
|
|
10626
|
-
|
|
11898
|
+
setResponseValueAndErrors3(res, "multipleOf", check.value, check.message, refs);
|
|
10627
11899
|
break;
|
|
10628
11900
|
}
|
|
10629
11901
|
}
|
|
10630
11902
|
return res;
|
|
10631
11903
|
}
|
|
10632
|
-
function
|
|
11904
|
+
function parseBooleanDef4() {
|
|
10633
11905
|
return {
|
|
10634
11906
|
type: "boolean"
|
|
10635
11907
|
};
|
|
10636
11908
|
}
|
|
10637
|
-
function
|
|
10638
|
-
return
|
|
11909
|
+
function parseBrandedDef4(_def, refs) {
|
|
11910
|
+
return parseDef4(_def.type._def, refs);
|
|
10639
11911
|
}
|
|
10640
|
-
var
|
|
10641
|
-
return
|
|
11912
|
+
var parseCatchDef4 = (def, refs) => {
|
|
11913
|
+
return parseDef4(def.innerType._def, refs);
|
|
10642
11914
|
};
|
|
10643
|
-
function
|
|
11915
|
+
function parseDateDef4(def, refs, overrideDateStrategy) {
|
|
10644
11916
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
10645
11917
|
if (Array.isArray(strategy)) {
|
|
10646
11918
|
return {
|
|
10647
|
-
anyOf: strategy.map((item, i) =>
|
|
11919
|
+
anyOf: strategy.map((item, i) => parseDateDef4(def, refs, item))
|
|
10648
11920
|
};
|
|
10649
11921
|
}
|
|
10650
11922
|
switch (strategy) {
|
|
@@ -10660,10 +11932,10 @@ function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
|
10660
11932
|
format: "date"
|
|
10661
11933
|
};
|
|
10662
11934
|
case "integer":
|
|
10663
|
-
return
|
|
11935
|
+
return integerDateParser4(def, refs);
|
|
10664
11936
|
}
|
|
10665
11937
|
}
|
|
10666
|
-
var
|
|
11938
|
+
var integerDateParser4 = (def, refs) => {
|
|
10667
11939
|
const res = {
|
|
10668
11940
|
type: "integer",
|
|
10669
11941
|
format: "unix-time"
|
|
@@ -10674,7 +11946,7 @@ var integerDateParser3 = (def, refs) => {
|
|
|
10674
11946
|
for (const check of def.checks) {
|
|
10675
11947
|
switch (check.kind) {
|
|
10676
11948
|
case "min":
|
|
10677
|
-
|
|
11949
|
+
setResponseValueAndErrors3(
|
|
10678
11950
|
res,
|
|
10679
11951
|
"minimum",
|
|
10680
11952
|
check.value,
|
|
@@ -10684,7 +11956,7 @@ var integerDateParser3 = (def, refs) => {
|
|
|
10684
11956
|
);
|
|
10685
11957
|
break;
|
|
10686
11958
|
case "max":
|
|
10687
|
-
|
|
11959
|
+
setResponseValueAndErrors3(
|
|
10688
11960
|
res,
|
|
10689
11961
|
"maximum",
|
|
10690
11962
|
check.value,
|
|
@@ -10697,33 +11969,33 @@ var integerDateParser3 = (def, refs) => {
|
|
|
10697
11969
|
}
|
|
10698
11970
|
return res;
|
|
10699
11971
|
};
|
|
10700
|
-
function
|
|
11972
|
+
function parseDefaultDef4(_def, refs) {
|
|
10701
11973
|
return {
|
|
10702
|
-
...
|
|
11974
|
+
...parseDef4(_def.innerType._def, refs),
|
|
10703
11975
|
default: _def.defaultValue()
|
|
10704
11976
|
};
|
|
10705
11977
|
}
|
|
10706
|
-
function
|
|
10707
|
-
return refs.effectStrategy === "input" ?
|
|
11978
|
+
function parseEffectsDef4(_def, refs) {
|
|
11979
|
+
return refs.effectStrategy === "input" ? parseDef4(_def.schema._def, refs) : parseAnyDef4(refs);
|
|
10708
11980
|
}
|
|
10709
|
-
function
|
|
11981
|
+
function parseEnumDef4(def) {
|
|
10710
11982
|
return {
|
|
10711
11983
|
type: "string",
|
|
10712
11984
|
enum: Array.from(def.values)
|
|
10713
11985
|
};
|
|
10714
11986
|
}
|
|
10715
|
-
var
|
|
11987
|
+
var isJsonSchema7AllOfType4 = (type) => {
|
|
10716
11988
|
if ("type" in type && type.type === "string")
|
|
10717
11989
|
return false;
|
|
10718
11990
|
return "allOf" in type;
|
|
10719
11991
|
};
|
|
10720
|
-
function
|
|
11992
|
+
function parseIntersectionDef4(def, refs) {
|
|
10721
11993
|
const allOf = [
|
|
10722
|
-
|
|
11994
|
+
parseDef4(def.left._def, {
|
|
10723
11995
|
...refs,
|
|
10724
11996
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
10725
11997
|
}),
|
|
10726
|
-
|
|
11998
|
+
parseDef4(def.right._def, {
|
|
10727
11999
|
...refs,
|
|
10728
12000
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
10729
12001
|
})
|
|
@@ -10731,7 +12003,7 @@ function parseIntersectionDef3(def, refs) {
|
|
|
10731
12003
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
10732
12004
|
const mergedAllOf = [];
|
|
10733
12005
|
allOf.forEach((schema) => {
|
|
10734
|
-
if (
|
|
12006
|
+
if (isJsonSchema7AllOfType4(schema)) {
|
|
10735
12007
|
mergedAllOf.push(...schema.allOf);
|
|
10736
12008
|
if (schema.unevaluatedProperties === void 0) {
|
|
10737
12009
|
unevaluatedProperties = void 0;
|
|
@@ -10752,7 +12024,7 @@ function parseIntersectionDef3(def, refs) {
|
|
|
10752
12024
|
...unevaluatedProperties
|
|
10753
12025
|
} : void 0;
|
|
10754
12026
|
}
|
|
10755
|
-
function
|
|
12027
|
+
function parseLiteralDef4(def, refs) {
|
|
10756
12028
|
const parsedType = typeof def.value;
|
|
10757
12029
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
10758
12030
|
return {
|
|
@@ -10770,8 +12042,8 @@ function parseLiteralDef3(def, refs) {
|
|
|
10770
12042
|
const: def.value
|
|
10771
12043
|
};
|
|
10772
12044
|
}
|
|
10773
|
-
var
|
|
10774
|
-
var
|
|
12045
|
+
var emojiRegex4 = void 0;
|
|
12046
|
+
var zodPatterns4 = {
|
|
10775
12047
|
/**
|
|
10776
12048
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
10777
12049
|
*/
|
|
@@ -10794,10 +12066,10 @@ var zodPatterns3 = {
|
|
|
10794
12066
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
10795
12067
|
*/
|
|
10796
12068
|
emoji: () => {
|
|
10797
|
-
if (
|
|
10798
|
-
|
|
12069
|
+
if (emojiRegex4 === void 0) {
|
|
12070
|
+
emojiRegex4 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
10799
12071
|
}
|
|
10800
|
-
return
|
|
12072
|
+
return emojiRegex4;
|
|
10801
12073
|
},
|
|
10802
12074
|
/**
|
|
10803
12075
|
* Unused
|
|
@@ -10818,7 +12090,7 @@ var zodPatterns3 = {
|
|
|
10818
12090
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
10819
12091
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
10820
12092
|
};
|
|
10821
|
-
function
|
|
12093
|
+
function parseStringDef4(def, refs) {
|
|
10822
12094
|
const res = {
|
|
10823
12095
|
type: "string"
|
|
10824
12096
|
};
|
|
@@ -10826,136 +12098,136 @@ function parseStringDef3(def, refs) {
|
|
|
10826
12098
|
for (const check of def.checks) {
|
|
10827
12099
|
switch (check.kind) {
|
|
10828
12100
|
case "min":
|
|
10829
|
-
|
|
12101
|
+
setResponseValueAndErrors3(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
10830
12102
|
break;
|
|
10831
12103
|
case "max":
|
|
10832
|
-
|
|
12104
|
+
setResponseValueAndErrors3(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
10833
12105
|
break;
|
|
10834
12106
|
case "email":
|
|
10835
12107
|
switch (refs.emailStrategy) {
|
|
10836
12108
|
case "format:email":
|
|
10837
|
-
|
|
12109
|
+
addFormat4(res, "email", check.message, refs);
|
|
10838
12110
|
break;
|
|
10839
12111
|
case "format:idn-email":
|
|
10840
|
-
|
|
12112
|
+
addFormat4(res, "idn-email", check.message, refs);
|
|
10841
12113
|
break;
|
|
10842
12114
|
case "pattern:zod":
|
|
10843
|
-
|
|
12115
|
+
addPattern4(res, zodPatterns4.email, check.message, refs);
|
|
10844
12116
|
break;
|
|
10845
12117
|
}
|
|
10846
12118
|
break;
|
|
10847
12119
|
case "url":
|
|
10848
|
-
|
|
12120
|
+
addFormat4(res, "uri", check.message, refs);
|
|
10849
12121
|
break;
|
|
10850
12122
|
case "uuid":
|
|
10851
|
-
|
|
12123
|
+
addFormat4(res, "uuid", check.message, refs);
|
|
10852
12124
|
break;
|
|
10853
12125
|
case "regex":
|
|
10854
|
-
|
|
12126
|
+
addPattern4(res, check.regex, check.message, refs);
|
|
10855
12127
|
break;
|
|
10856
12128
|
case "cuid":
|
|
10857
|
-
|
|
12129
|
+
addPattern4(res, zodPatterns4.cuid, check.message, refs);
|
|
10858
12130
|
break;
|
|
10859
12131
|
case "cuid2":
|
|
10860
|
-
|
|
12132
|
+
addPattern4(res, zodPatterns4.cuid2, check.message, refs);
|
|
10861
12133
|
break;
|
|
10862
12134
|
case "startsWith":
|
|
10863
|
-
|
|
12135
|
+
addPattern4(res, RegExp(`^${escapeLiteralCheckValue4(check.value, refs)}`), check.message, refs);
|
|
10864
12136
|
break;
|
|
10865
12137
|
case "endsWith":
|
|
10866
|
-
|
|
12138
|
+
addPattern4(res, RegExp(`${escapeLiteralCheckValue4(check.value, refs)}$`), check.message, refs);
|
|
10867
12139
|
break;
|
|
10868
12140
|
case "datetime":
|
|
10869
|
-
|
|
12141
|
+
addFormat4(res, "date-time", check.message, refs);
|
|
10870
12142
|
break;
|
|
10871
12143
|
case "date":
|
|
10872
|
-
|
|
12144
|
+
addFormat4(res, "date", check.message, refs);
|
|
10873
12145
|
break;
|
|
10874
12146
|
case "time":
|
|
10875
|
-
|
|
12147
|
+
addFormat4(res, "time", check.message, refs);
|
|
10876
12148
|
break;
|
|
10877
12149
|
case "duration":
|
|
10878
|
-
|
|
12150
|
+
addFormat4(res, "duration", check.message, refs);
|
|
10879
12151
|
break;
|
|
10880
12152
|
case "length":
|
|
10881
|
-
|
|
10882
|
-
|
|
12153
|
+
setResponseValueAndErrors3(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
12154
|
+
setResponseValueAndErrors3(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
10883
12155
|
break;
|
|
10884
12156
|
case "includes": {
|
|
10885
|
-
|
|
12157
|
+
addPattern4(res, RegExp(escapeLiteralCheckValue4(check.value, refs)), check.message, refs);
|
|
10886
12158
|
break;
|
|
10887
12159
|
}
|
|
10888
12160
|
case "ip": {
|
|
10889
12161
|
if (check.version !== "v6") {
|
|
10890
|
-
|
|
12162
|
+
addFormat4(res, "ipv4", check.message, refs);
|
|
10891
12163
|
}
|
|
10892
12164
|
if (check.version !== "v4") {
|
|
10893
|
-
|
|
12165
|
+
addFormat4(res, "ipv6", check.message, refs);
|
|
10894
12166
|
}
|
|
10895
12167
|
break;
|
|
10896
12168
|
}
|
|
10897
12169
|
case "base64url":
|
|
10898
|
-
|
|
12170
|
+
addPattern4(res, zodPatterns4.base64url, check.message, refs);
|
|
10899
12171
|
break;
|
|
10900
12172
|
case "jwt":
|
|
10901
|
-
|
|
12173
|
+
addPattern4(res, zodPatterns4.jwt, check.message, refs);
|
|
10902
12174
|
break;
|
|
10903
12175
|
case "cidr": {
|
|
10904
12176
|
if (check.version !== "v6") {
|
|
10905
|
-
|
|
12177
|
+
addPattern4(res, zodPatterns4.ipv4Cidr, check.message, refs);
|
|
10906
12178
|
}
|
|
10907
12179
|
if (check.version !== "v4") {
|
|
10908
|
-
|
|
12180
|
+
addPattern4(res, zodPatterns4.ipv6Cidr, check.message, refs);
|
|
10909
12181
|
}
|
|
10910
12182
|
break;
|
|
10911
12183
|
}
|
|
10912
12184
|
case "emoji":
|
|
10913
|
-
|
|
12185
|
+
addPattern4(res, zodPatterns4.emoji(), check.message, refs);
|
|
10914
12186
|
break;
|
|
10915
12187
|
case "ulid": {
|
|
10916
|
-
|
|
12188
|
+
addPattern4(res, zodPatterns4.ulid, check.message, refs);
|
|
10917
12189
|
break;
|
|
10918
12190
|
}
|
|
10919
12191
|
case "base64": {
|
|
10920
12192
|
switch (refs.base64Strategy) {
|
|
10921
12193
|
case "format:binary": {
|
|
10922
|
-
|
|
12194
|
+
addFormat4(res, "binary", check.message, refs);
|
|
10923
12195
|
break;
|
|
10924
12196
|
}
|
|
10925
12197
|
case "contentEncoding:base64": {
|
|
10926
|
-
|
|
12198
|
+
setResponseValueAndErrors3(res, "contentEncoding", "base64", check.message, refs);
|
|
10927
12199
|
break;
|
|
10928
12200
|
}
|
|
10929
12201
|
case "pattern:zod": {
|
|
10930
|
-
|
|
12202
|
+
addPattern4(res, zodPatterns4.base64, check.message, refs);
|
|
10931
12203
|
break;
|
|
10932
12204
|
}
|
|
10933
12205
|
}
|
|
10934
12206
|
break;
|
|
10935
12207
|
}
|
|
10936
12208
|
case "nanoid": {
|
|
10937
|
-
|
|
12209
|
+
addPattern4(res, zodPatterns4.nanoid, check.message, refs);
|
|
10938
12210
|
}
|
|
10939
12211
|
}
|
|
10940
12212
|
}
|
|
10941
12213
|
}
|
|
10942
12214
|
return res;
|
|
10943
12215
|
}
|
|
10944
|
-
function
|
|
10945
|
-
return refs.patternStrategy === "escape" ?
|
|
12216
|
+
function escapeLiteralCheckValue4(literal, refs) {
|
|
12217
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric4(literal) : literal;
|
|
10946
12218
|
}
|
|
10947
|
-
var
|
|
10948
|
-
function
|
|
12219
|
+
var ALPHA_NUMERIC4 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
12220
|
+
function escapeNonAlphaNumeric4(source) {
|
|
10949
12221
|
let result = "";
|
|
10950
12222
|
for (let i = 0; i < source.length; i++) {
|
|
10951
|
-
if (!
|
|
12223
|
+
if (!ALPHA_NUMERIC4.has(source[i])) {
|
|
10952
12224
|
result += "\\";
|
|
10953
12225
|
}
|
|
10954
12226
|
result += source[i];
|
|
10955
12227
|
}
|
|
10956
12228
|
return result;
|
|
10957
12229
|
}
|
|
10958
|
-
function
|
|
12230
|
+
function addFormat4(schema, value, message, refs) {
|
|
10959
12231
|
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
10960
12232
|
if (!schema.anyOf) {
|
|
10961
12233
|
schema.anyOf = [];
|
|
@@ -10980,10 +12252,10 @@ function addFormat3(schema, value, message, refs) {
|
|
|
10980
12252
|
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
10981
12253
|
});
|
|
10982
12254
|
} else {
|
|
10983
|
-
|
|
12255
|
+
setResponseValueAndErrors3(schema, "format", value, message, refs);
|
|
10984
12256
|
}
|
|
10985
12257
|
}
|
|
10986
|
-
function
|
|
12258
|
+
function addPattern4(schema, regex, message, refs) {
|
|
10987
12259
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
10988
12260
|
if (!schema.allOf) {
|
|
10989
12261
|
schema.allOf = [];
|
|
@@ -11004,14 +12276,14 @@ function addPattern3(schema, regex, message, refs) {
|
|
|
11004
12276
|
}
|
|
11005
12277
|
}
|
|
11006
12278
|
schema.allOf.push({
|
|
11007
|
-
pattern:
|
|
12279
|
+
pattern: stringifyRegExpWithFlags4(regex, refs),
|
|
11008
12280
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
11009
12281
|
});
|
|
11010
12282
|
} else {
|
|
11011
|
-
|
|
12283
|
+
setResponseValueAndErrors3(schema, "pattern", stringifyRegExpWithFlags4(regex, refs), message, refs);
|
|
11012
12284
|
}
|
|
11013
12285
|
}
|
|
11014
|
-
function
|
|
12286
|
+
function stringifyRegExpWithFlags4(regex, refs) {
|
|
11015
12287
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
11016
12288
|
return regex.source;
|
|
11017
12289
|
}
|
|
@@ -11080,27 +12352,27 @@ function stringifyRegExpWithFlags3(regex, refs) {
|
|
|
11080
12352
|
}
|
|
11081
12353
|
return pattern;
|
|
11082
12354
|
}
|
|
11083
|
-
function
|
|
12355
|
+
function parseRecordDef4(def, refs) {
|
|
11084
12356
|
if (refs.target === "openAi") {
|
|
11085
12357
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
11086
12358
|
}
|
|
11087
|
-
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
12359
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
|
|
11088
12360
|
return {
|
|
11089
12361
|
type: "object",
|
|
11090
12362
|
required: def.keyType._def.values,
|
|
11091
12363
|
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
11092
12364
|
...acc,
|
|
11093
|
-
[key]:
|
|
12365
|
+
[key]: parseDef4(def.valueType._def, {
|
|
11094
12366
|
...refs,
|
|
11095
12367
|
currentPath: [...refs.currentPath, "properties", key]
|
|
11096
|
-
}) ??
|
|
12368
|
+
}) ?? parseAnyDef4(refs)
|
|
11097
12369
|
}), {}),
|
|
11098
12370
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
11099
12371
|
};
|
|
11100
12372
|
}
|
|
11101
12373
|
const schema = {
|
|
11102
12374
|
type: "object",
|
|
11103
|
-
additionalProperties:
|
|
12375
|
+
additionalProperties: parseDef4(def.valueType._def, {
|
|
11104
12376
|
...refs,
|
|
11105
12377
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
11106
12378
|
}) ?? refs.allowedAdditionalProperties
|
|
@@ -11108,21 +12380,21 @@ function parseRecordDef3(def, refs) {
|
|
|
11108
12380
|
if (refs.target === "openApi3") {
|
|
11109
12381
|
return schema;
|
|
11110
12382
|
}
|
|
11111
|
-
if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
11112
|
-
const { type, ...keyType } =
|
|
12383
|
+
if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.checks?.length) {
|
|
12384
|
+
const { type, ...keyType } = parseStringDef4(def.keyType._def, refs);
|
|
11113
12385
|
return {
|
|
11114
12386
|
...schema,
|
|
11115
12387
|
propertyNames: keyType
|
|
11116
12388
|
};
|
|
11117
|
-
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
12389
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
|
|
11118
12390
|
return {
|
|
11119
12391
|
...schema,
|
|
11120
12392
|
propertyNames: {
|
|
11121
12393
|
enum: def.keyType._def.values
|
|
11122
12394
|
}
|
|
11123
12395
|
};
|
|
11124
|
-
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
11125
|
-
const { type, ...keyType } =
|
|
12396
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
12397
|
+
const { type, ...keyType } = parseBrandedDef4(def.keyType._def, refs);
|
|
11126
12398
|
return {
|
|
11127
12399
|
...schema,
|
|
11128
12400
|
propertyNames: keyType
|
|
@@ -11130,18 +12402,18 @@ function parseRecordDef3(def, refs) {
|
|
|
11130
12402
|
}
|
|
11131
12403
|
return schema;
|
|
11132
12404
|
}
|
|
11133
|
-
function
|
|
12405
|
+
function parseMapDef4(def, refs) {
|
|
11134
12406
|
if (refs.mapStrategy === "record") {
|
|
11135
|
-
return
|
|
12407
|
+
return parseRecordDef4(def, refs);
|
|
11136
12408
|
}
|
|
11137
|
-
const keys =
|
|
12409
|
+
const keys = parseDef4(def.keyType._def, {
|
|
11138
12410
|
...refs,
|
|
11139
12411
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
11140
|
-
}) ||
|
|
11141
|
-
const values =
|
|
12412
|
+
}) || parseAnyDef4(refs);
|
|
12413
|
+
const values = parseDef4(def.valueType._def, {
|
|
11142
12414
|
...refs,
|
|
11143
12415
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
11144
|
-
}) ||
|
|
12416
|
+
}) || parseAnyDef4(refs);
|
|
11145
12417
|
return {
|
|
11146
12418
|
type: "array",
|
|
11147
12419
|
maxItems: 125,
|
|
@@ -11153,7 +12425,7 @@ function parseMapDef3(def, refs) {
|
|
|
11153
12425
|
}
|
|
11154
12426
|
};
|
|
11155
12427
|
}
|
|
11156
|
-
function
|
|
12428
|
+
function parseNativeEnumDef4(def) {
|
|
11157
12429
|
const object22 = def.values;
|
|
11158
12430
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
11159
12431
|
return typeof object22[object22[key]] !== "number";
|
|
@@ -11165,15 +12437,15 @@ function parseNativeEnumDef3(def) {
|
|
|
11165
12437
|
enum: actualValues
|
|
11166
12438
|
};
|
|
11167
12439
|
}
|
|
11168
|
-
function
|
|
12440
|
+
function parseNeverDef4(refs) {
|
|
11169
12441
|
return refs.target === "openAi" ? void 0 : {
|
|
11170
|
-
not:
|
|
12442
|
+
not: parseAnyDef4({
|
|
11171
12443
|
...refs,
|
|
11172
12444
|
currentPath: [...refs.currentPath, "not"]
|
|
11173
12445
|
})
|
|
11174
12446
|
};
|
|
11175
12447
|
}
|
|
11176
|
-
function
|
|
12448
|
+
function parseNullDef4(refs) {
|
|
11177
12449
|
return refs.target === "openApi3" ? {
|
|
11178
12450
|
enum: ["null"],
|
|
11179
12451
|
nullable: true
|
|
@@ -11181,20 +12453,20 @@ function parseNullDef3(refs) {
|
|
|
11181
12453
|
type: "null"
|
|
11182
12454
|
};
|
|
11183
12455
|
}
|
|
11184
|
-
var
|
|
12456
|
+
var primitiveMappings4 = {
|
|
11185
12457
|
ZodString: "string",
|
|
11186
12458
|
ZodNumber: "number",
|
|
11187
12459
|
ZodBigInt: "integer",
|
|
11188
12460
|
ZodBoolean: "boolean",
|
|
11189
12461
|
ZodNull: "null"
|
|
11190
12462
|
};
|
|
11191
|
-
function
|
|
12463
|
+
function parseUnionDef4(def, refs) {
|
|
11192
12464
|
if (refs.target === "openApi3")
|
|
11193
|
-
return
|
|
12465
|
+
return asAnyOf4(def, refs);
|
|
11194
12466
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
11195
|
-
if (options.every((x) => x._def.typeName in
|
|
12467
|
+
if (options.every((x) => x._def.typeName in primitiveMappings4 && (!x._def.checks || !x._def.checks.length))) {
|
|
11196
12468
|
const types = options.reduce((types2, x) => {
|
|
11197
|
-
const type =
|
|
12469
|
+
const type = primitiveMappings4[x._def.typeName];
|
|
11198
12470
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
11199
12471
|
}, []);
|
|
11200
12472
|
return {
|
|
@@ -11238,32 +12510,32 @@ function parseUnionDef3(def, refs) {
|
|
|
11238
12510
|
], [])
|
|
11239
12511
|
};
|
|
11240
12512
|
}
|
|
11241
|
-
return
|
|
12513
|
+
return asAnyOf4(def, refs);
|
|
11242
12514
|
}
|
|
11243
|
-
var
|
|
11244
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) =>
|
|
12515
|
+
var asAnyOf4 = (def, refs) => {
|
|
12516
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef4(x._def, {
|
|
11245
12517
|
...refs,
|
|
11246
12518
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
11247
12519
|
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
11248
12520
|
return anyOf.length ? { anyOf } : void 0;
|
|
11249
12521
|
};
|
|
11250
|
-
function
|
|
12522
|
+
function parseNullableDef4(def, refs) {
|
|
11251
12523
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
11252
12524
|
if (refs.target === "openApi3") {
|
|
11253
12525
|
return {
|
|
11254
|
-
type:
|
|
12526
|
+
type: primitiveMappings4[def.innerType._def.typeName],
|
|
11255
12527
|
nullable: true
|
|
11256
12528
|
};
|
|
11257
12529
|
}
|
|
11258
12530
|
return {
|
|
11259
12531
|
type: [
|
|
11260
|
-
|
|
12532
|
+
primitiveMappings4[def.innerType._def.typeName],
|
|
11261
12533
|
"null"
|
|
11262
12534
|
]
|
|
11263
12535
|
};
|
|
11264
12536
|
}
|
|
11265
12537
|
if (refs.target === "openApi3") {
|
|
11266
|
-
const base2 =
|
|
12538
|
+
const base2 = parseDef4(def.innerType._def, {
|
|
11267
12539
|
...refs,
|
|
11268
12540
|
currentPath: [...refs.currentPath]
|
|
11269
12541
|
});
|
|
@@ -11271,13 +12543,13 @@ function parseNullableDef3(def, refs) {
|
|
|
11271
12543
|
return { allOf: [base2], nullable: true };
|
|
11272
12544
|
return base2 && { ...base2, nullable: true };
|
|
11273
12545
|
}
|
|
11274
|
-
const base =
|
|
12546
|
+
const base = parseDef4(def.innerType._def, {
|
|
11275
12547
|
...refs,
|
|
11276
12548
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
11277
12549
|
});
|
|
11278
12550
|
return base && { anyOf: [base, { type: "null" }] };
|
|
11279
12551
|
}
|
|
11280
|
-
function
|
|
12552
|
+
function parseNumberDef4(def, refs) {
|
|
11281
12553
|
const res = {
|
|
11282
12554
|
type: "number"
|
|
11283
12555
|
};
|
|
@@ -11287,44 +12559,44 @@ function parseNumberDef3(def, refs) {
|
|
|
11287
12559
|
switch (check.kind) {
|
|
11288
12560
|
case "int":
|
|
11289
12561
|
res.type = "integer";
|
|
11290
|
-
|
|
12562
|
+
addErrorMessage3(res, "type", check.message, refs);
|
|
11291
12563
|
break;
|
|
11292
12564
|
case "min":
|
|
11293
12565
|
if (refs.target === "jsonSchema7") {
|
|
11294
12566
|
if (check.inclusive) {
|
|
11295
|
-
|
|
12567
|
+
setResponseValueAndErrors3(res, "minimum", check.value, check.message, refs);
|
|
11296
12568
|
} else {
|
|
11297
|
-
|
|
12569
|
+
setResponseValueAndErrors3(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
11298
12570
|
}
|
|
11299
12571
|
} else {
|
|
11300
12572
|
if (!check.inclusive) {
|
|
11301
12573
|
res.exclusiveMinimum = true;
|
|
11302
12574
|
}
|
|
11303
|
-
|
|
12575
|
+
setResponseValueAndErrors3(res, "minimum", check.value, check.message, refs);
|
|
11304
12576
|
}
|
|
11305
12577
|
break;
|
|
11306
12578
|
case "max":
|
|
11307
12579
|
if (refs.target === "jsonSchema7") {
|
|
11308
12580
|
if (check.inclusive) {
|
|
11309
|
-
|
|
12581
|
+
setResponseValueAndErrors3(res, "maximum", check.value, check.message, refs);
|
|
11310
12582
|
} else {
|
|
11311
|
-
|
|
12583
|
+
setResponseValueAndErrors3(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
11312
12584
|
}
|
|
11313
12585
|
} else {
|
|
11314
12586
|
if (!check.inclusive) {
|
|
11315
12587
|
res.exclusiveMaximum = true;
|
|
11316
12588
|
}
|
|
11317
|
-
|
|
12589
|
+
setResponseValueAndErrors3(res, "maximum", check.value, check.message, refs);
|
|
11318
12590
|
}
|
|
11319
12591
|
break;
|
|
11320
12592
|
case "multipleOf":
|
|
11321
|
-
|
|
12593
|
+
setResponseValueAndErrors3(res, "multipleOf", check.value, check.message, refs);
|
|
11322
12594
|
break;
|
|
11323
12595
|
}
|
|
11324
12596
|
}
|
|
11325
12597
|
return res;
|
|
11326
12598
|
}
|
|
11327
|
-
function
|
|
12599
|
+
function parseObjectDef4(def, refs) {
|
|
11328
12600
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
11329
12601
|
const result = {
|
|
11330
12602
|
type: "object",
|
|
@@ -11337,7 +12609,7 @@ function parseObjectDef3(def, refs) {
|
|
|
11337
12609
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
11338
12610
|
continue;
|
|
11339
12611
|
}
|
|
11340
|
-
let propOptional =
|
|
12612
|
+
let propOptional = safeIsOptional4(propDef);
|
|
11341
12613
|
if (propOptional && forceOptionalIntoNullable) {
|
|
11342
12614
|
if (propDef._def.typeName === "ZodOptional") {
|
|
11343
12615
|
propDef = propDef._def.innerType;
|
|
@@ -11347,7 +12619,7 @@ function parseObjectDef3(def, refs) {
|
|
|
11347
12619
|
}
|
|
11348
12620
|
propOptional = false;
|
|
11349
12621
|
}
|
|
11350
|
-
const parsedDef =
|
|
12622
|
+
const parsedDef = parseDef4(propDef._def, {
|
|
11351
12623
|
...refs,
|
|
11352
12624
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
11353
12625
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -11363,15 +12635,15 @@ function parseObjectDef3(def, refs) {
|
|
|
11363
12635
|
if (required.length) {
|
|
11364
12636
|
result.required = required;
|
|
11365
12637
|
}
|
|
11366
|
-
const additionalProperties =
|
|
12638
|
+
const additionalProperties = decideAdditionalProperties4(def, refs);
|
|
11367
12639
|
if (additionalProperties !== void 0) {
|
|
11368
12640
|
result.additionalProperties = additionalProperties;
|
|
11369
12641
|
}
|
|
11370
12642
|
return result;
|
|
11371
12643
|
}
|
|
11372
|
-
function
|
|
12644
|
+
function decideAdditionalProperties4(def, refs) {
|
|
11373
12645
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
11374
|
-
return
|
|
12646
|
+
return parseDef4(def.catchall._def, {
|
|
11375
12647
|
...refs,
|
|
11376
12648
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
11377
12649
|
});
|
|
@@ -11385,41 +12657,41 @@ function decideAdditionalProperties3(def, refs) {
|
|
|
11385
12657
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
11386
12658
|
}
|
|
11387
12659
|
}
|
|
11388
|
-
function
|
|
12660
|
+
function safeIsOptional4(schema) {
|
|
11389
12661
|
try {
|
|
11390
12662
|
return schema.isOptional();
|
|
11391
12663
|
} catch {
|
|
11392
12664
|
return true;
|
|
11393
12665
|
}
|
|
11394
12666
|
}
|
|
11395
|
-
var
|
|
12667
|
+
var parseOptionalDef4 = (def, refs) => {
|
|
11396
12668
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
11397
|
-
return
|
|
12669
|
+
return parseDef4(def.innerType._def, refs);
|
|
11398
12670
|
}
|
|
11399
|
-
const innerSchema =
|
|
12671
|
+
const innerSchema = parseDef4(def.innerType._def, {
|
|
11400
12672
|
...refs,
|
|
11401
12673
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
11402
12674
|
});
|
|
11403
12675
|
return innerSchema ? {
|
|
11404
12676
|
anyOf: [
|
|
11405
12677
|
{
|
|
11406
|
-
not:
|
|
12678
|
+
not: parseAnyDef4(refs)
|
|
11407
12679
|
},
|
|
11408
12680
|
innerSchema
|
|
11409
12681
|
]
|
|
11410
|
-
} :
|
|
12682
|
+
} : parseAnyDef4(refs);
|
|
11411
12683
|
};
|
|
11412
|
-
var
|
|
12684
|
+
var parsePipelineDef4 = (def, refs) => {
|
|
11413
12685
|
if (refs.pipeStrategy === "input") {
|
|
11414
|
-
return
|
|
12686
|
+
return parseDef4(def.in._def, refs);
|
|
11415
12687
|
} else if (refs.pipeStrategy === "output") {
|
|
11416
|
-
return
|
|
12688
|
+
return parseDef4(def.out._def, refs);
|
|
11417
12689
|
}
|
|
11418
|
-
const a =
|
|
12690
|
+
const a = parseDef4(def.in._def, {
|
|
11419
12691
|
...refs,
|
|
11420
12692
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
11421
12693
|
});
|
|
11422
|
-
const b =
|
|
12694
|
+
const b = parseDef4(def.out._def, {
|
|
11423
12695
|
...refs,
|
|
11424
12696
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
11425
12697
|
});
|
|
@@ -11427,11 +12699,11 @@ var parsePipelineDef3 = (def, refs) => {
|
|
|
11427
12699
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
11428
12700
|
};
|
|
11429
12701
|
};
|
|
11430
|
-
function
|
|
11431
|
-
return
|
|
12702
|
+
function parsePromiseDef4(def, refs) {
|
|
12703
|
+
return parseDef4(def.type._def, refs);
|
|
11432
12704
|
}
|
|
11433
|
-
function
|
|
11434
|
-
const items =
|
|
12705
|
+
function parseSetDef4(def, refs) {
|
|
12706
|
+
const items = parseDef4(def.valueType._def, {
|
|
11435
12707
|
...refs,
|
|
11436
12708
|
currentPath: [...refs.currentPath, "items"]
|
|
11437
12709
|
});
|
|
@@ -11441,144 +12713,144 @@ function parseSetDef3(def, refs) {
|
|
|
11441
12713
|
items
|
|
11442
12714
|
};
|
|
11443
12715
|
if (def.minSize) {
|
|
11444
|
-
|
|
12716
|
+
setResponseValueAndErrors3(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
11445
12717
|
}
|
|
11446
12718
|
if (def.maxSize) {
|
|
11447
|
-
|
|
12719
|
+
setResponseValueAndErrors3(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
11448
12720
|
}
|
|
11449
12721
|
return schema;
|
|
11450
12722
|
}
|
|
11451
|
-
function
|
|
12723
|
+
function parseTupleDef4(def, refs) {
|
|
11452
12724
|
if (def.rest) {
|
|
11453
12725
|
return {
|
|
11454
12726
|
type: "array",
|
|
11455
12727
|
minItems: def.items.length,
|
|
11456
|
-
items: def.items.map((x, i) =>
|
|
12728
|
+
items: def.items.map((x, i) => parseDef4(x._def, {
|
|
11457
12729
|
...refs,
|
|
11458
12730
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
11459
12731
|
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
11460
|
-
additionalItems:
|
|
11461
|
-
...refs,
|
|
11462
|
-
currentPath: [...refs.currentPath, "additionalItems"]
|
|
11463
|
-
})
|
|
11464
|
-
};
|
|
11465
|
-
} else {
|
|
11466
|
-
return {
|
|
11467
|
-
type: "array",
|
|
11468
|
-
minItems: def.items.length,
|
|
11469
|
-
maxItems: def.items.length,
|
|
11470
|
-
items: def.items.map((x, i) =>
|
|
11471
|
-
...refs,
|
|
11472
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
11473
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
11474
|
-
};
|
|
11475
|
-
}
|
|
11476
|
-
}
|
|
11477
|
-
function
|
|
11478
|
-
return {
|
|
11479
|
-
not:
|
|
11480
|
-
};
|
|
11481
|
-
}
|
|
11482
|
-
function
|
|
11483
|
-
return
|
|
11484
|
-
}
|
|
11485
|
-
var
|
|
11486
|
-
return
|
|
11487
|
-
};
|
|
11488
|
-
var
|
|
11489
|
-
switch (typeName) {
|
|
11490
|
-
case ZodFirstPartyTypeKind.ZodString:
|
|
11491
|
-
return
|
|
11492
|
-
case ZodFirstPartyTypeKind.ZodNumber:
|
|
11493
|
-
return
|
|
11494
|
-
case ZodFirstPartyTypeKind.ZodObject:
|
|
11495
|
-
return
|
|
11496
|
-
case ZodFirstPartyTypeKind.ZodBigInt:
|
|
11497
|
-
return
|
|
11498
|
-
case ZodFirstPartyTypeKind.ZodBoolean:
|
|
11499
|
-
return
|
|
11500
|
-
case ZodFirstPartyTypeKind.ZodDate:
|
|
11501
|
-
return
|
|
11502
|
-
case ZodFirstPartyTypeKind.ZodUndefined:
|
|
11503
|
-
return
|
|
11504
|
-
case ZodFirstPartyTypeKind.ZodNull:
|
|
11505
|
-
return
|
|
11506
|
-
case ZodFirstPartyTypeKind.ZodArray:
|
|
11507
|
-
return
|
|
11508
|
-
case ZodFirstPartyTypeKind.ZodUnion:
|
|
11509
|
-
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
11510
|
-
return
|
|
11511
|
-
case ZodFirstPartyTypeKind.ZodIntersection:
|
|
11512
|
-
return
|
|
11513
|
-
case ZodFirstPartyTypeKind.ZodTuple:
|
|
11514
|
-
return
|
|
11515
|
-
case ZodFirstPartyTypeKind.ZodRecord:
|
|
11516
|
-
return
|
|
11517
|
-
case ZodFirstPartyTypeKind.ZodLiteral:
|
|
11518
|
-
return
|
|
11519
|
-
case ZodFirstPartyTypeKind.ZodEnum:
|
|
11520
|
-
return
|
|
11521
|
-
case ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
11522
|
-
return
|
|
11523
|
-
case ZodFirstPartyTypeKind.ZodNullable:
|
|
11524
|
-
return
|
|
11525
|
-
case ZodFirstPartyTypeKind.ZodOptional:
|
|
11526
|
-
return
|
|
11527
|
-
case ZodFirstPartyTypeKind.ZodMap:
|
|
11528
|
-
return
|
|
11529
|
-
case ZodFirstPartyTypeKind.ZodSet:
|
|
11530
|
-
return
|
|
11531
|
-
case ZodFirstPartyTypeKind.ZodLazy:
|
|
12732
|
+
additionalItems: parseDef4(def.rest._def, {
|
|
12733
|
+
...refs,
|
|
12734
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
12735
|
+
})
|
|
12736
|
+
};
|
|
12737
|
+
} else {
|
|
12738
|
+
return {
|
|
12739
|
+
type: "array",
|
|
12740
|
+
minItems: def.items.length,
|
|
12741
|
+
maxItems: def.items.length,
|
|
12742
|
+
items: def.items.map((x, i) => parseDef4(x._def, {
|
|
12743
|
+
...refs,
|
|
12744
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12745
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
12746
|
+
};
|
|
12747
|
+
}
|
|
12748
|
+
}
|
|
12749
|
+
function parseUndefinedDef4(refs) {
|
|
12750
|
+
return {
|
|
12751
|
+
not: parseAnyDef4(refs)
|
|
12752
|
+
};
|
|
12753
|
+
}
|
|
12754
|
+
function parseUnknownDef4(refs) {
|
|
12755
|
+
return parseAnyDef4(refs);
|
|
12756
|
+
}
|
|
12757
|
+
var parseReadonlyDef4 = (def, refs) => {
|
|
12758
|
+
return parseDef4(def.innerType._def, refs);
|
|
12759
|
+
};
|
|
12760
|
+
var selectParser4 = (def, typeName, refs) => {
|
|
12761
|
+
switch (typeName) {
|
|
12762
|
+
case ZodFirstPartyTypeKind$1.ZodString:
|
|
12763
|
+
return parseStringDef4(def, refs);
|
|
12764
|
+
case ZodFirstPartyTypeKind$1.ZodNumber:
|
|
12765
|
+
return parseNumberDef4(def, refs);
|
|
12766
|
+
case ZodFirstPartyTypeKind$1.ZodObject:
|
|
12767
|
+
return parseObjectDef4(def, refs);
|
|
12768
|
+
case ZodFirstPartyTypeKind$1.ZodBigInt:
|
|
12769
|
+
return parseBigintDef4(def, refs);
|
|
12770
|
+
case ZodFirstPartyTypeKind$1.ZodBoolean:
|
|
12771
|
+
return parseBooleanDef4();
|
|
12772
|
+
case ZodFirstPartyTypeKind$1.ZodDate:
|
|
12773
|
+
return parseDateDef4(def, refs);
|
|
12774
|
+
case ZodFirstPartyTypeKind$1.ZodUndefined:
|
|
12775
|
+
return parseUndefinedDef4(refs);
|
|
12776
|
+
case ZodFirstPartyTypeKind$1.ZodNull:
|
|
12777
|
+
return parseNullDef4(refs);
|
|
12778
|
+
case ZodFirstPartyTypeKind$1.ZodArray:
|
|
12779
|
+
return parseArrayDef4(def, refs);
|
|
12780
|
+
case ZodFirstPartyTypeKind$1.ZodUnion:
|
|
12781
|
+
case ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion:
|
|
12782
|
+
return parseUnionDef4(def, refs);
|
|
12783
|
+
case ZodFirstPartyTypeKind$1.ZodIntersection:
|
|
12784
|
+
return parseIntersectionDef4(def, refs);
|
|
12785
|
+
case ZodFirstPartyTypeKind$1.ZodTuple:
|
|
12786
|
+
return parseTupleDef4(def, refs);
|
|
12787
|
+
case ZodFirstPartyTypeKind$1.ZodRecord:
|
|
12788
|
+
return parseRecordDef4(def, refs);
|
|
12789
|
+
case ZodFirstPartyTypeKind$1.ZodLiteral:
|
|
12790
|
+
return parseLiteralDef4(def, refs);
|
|
12791
|
+
case ZodFirstPartyTypeKind$1.ZodEnum:
|
|
12792
|
+
return parseEnumDef4(def);
|
|
12793
|
+
case ZodFirstPartyTypeKind$1.ZodNativeEnum:
|
|
12794
|
+
return parseNativeEnumDef4(def);
|
|
12795
|
+
case ZodFirstPartyTypeKind$1.ZodNullable:
|
|
12796
|
+
return parseNullableDef4(def, refs);
|
|
12797
|
+
case ZodFirstPartyTypeKind$1.ZodOptional:
|
|
12798
|
+
return parseOptionalDef4(def, refs);
|
|
12799
|
+
case ZodFirstPartyTypeKind$1.ZodMap:
|
|
12800
|
+
return parseMapDef4(def, refs);
|
|
12801
|
+
case ZodFirstPartyTypeKind$1.ZodSet:
|
|
12802
|
+
return parseSetDef4(def, refs);
|
|
12803
|
+
case ZodFirstPartyTypeKind$1.ZodLazy:
|
|
11532
12804
|
return () => def.getter()._def;
|
|
11533
|
-
case ZodFirstPartyTypeKind.ZodPromise:
|
|
11534
|
-
return
|
|
11535
|
-
case ZodFirstPartyTypeKind.ZodNaN:
|
|
11536
|
-
case ZodFirstPartyTypeKind.ZodNever:
|
|
11537
|
-
return
|
|
11538
|
-
case ZodFirstPartyTypeKind.ZodEffects:
|
|
11539
|
-
return
|
|
11540
|
-
case ZodFirstPartyTypeKind.ZodAny:
|
|
11541
|
-
return
|
|
11542
|
-
case ZodFirstPartyTypeKind.ZodUnknown:
|
|
11543
|
-
return
|
|
11544
|
-
case ZodFirstPartyTypeKind.ZodDefault:
|
|
11545
|
-
return
|
|
11546
|
-
case ZodFirstPartyTypeKind.ZodBranded:
|
|
11547
|
-
return
|
|
11548
|
-
case ZodFirstPartyTypeKind.ZodReadonly:
|
|
11549
|
-
return
|
|
11550
|
-
case ZodFirstPartyTypeKind.ZodCatch:
|
|
11551
|
-
return
|
|
11552
|
-
case ZodFirstPartyTypeKind.ZodPipeline:
|
|
11553
|
-
return
|
|
11554
|
-
case ZodFirstPartyTypeKind.ZodFunction:
|
|
11555
|
-
case ZodFirstPartyTypeKind.ZodVoid:
|
|
11556
|
-
case ZodFirstPartyTypeKind.ZodSymbol:
|
|
12805
|
+
case ZodFirstPartyTypeKind$1.ZodPromise:
|
|
12806
|
+
return parsePromiseDef4(def, refs);
|
|
12807
|
+
case ZodFirstPartyTypeKind$1.ZodNaN:
|
|
12808
|
+
case ZodFirstPartyTypeKind$1.ZodNever:
|
|
12809
|
+
return parseNeverDef4(refs);
|
|
12810
|
+
case ZodFirstPartyTypeKind$1.ZodEffects:
|
|
12811
|
+
return parseEffectsDef4(def, refs);
|
|
12812
|
+
case ZodFirstPartyTypeKind$1.ZodAny:
|
|
12813
|
+
return parseAnyDef4(refs);
|
|
12814
|
+
case ZodFirstPartyTypeKind$1.ZodUnknown:
|
|
12815
|
+
return parseUnknownDef4(refs);
|
|
12816
|
+
case ZodFirstPartyTypeKind$1.ZodDefault:
|
|
12817
|
+
return parseDefaultDef4(def, refs);
|
|
12818
|
+
case ZodFirstPartyTypeKind$1.ZodBranded:
|
|
12819
|
+
return parseBrandedDef4(def, refs);
|
|
12820
|
+
case ZodFirstPartyTypeKind$1.ZodReadonly:
|
|
12821
|
+
return parseReadonlyDef4(def, refs);
|
|
12822
|
+
case ZodFirstPartyTypeKind$1.ZodCatch:
|
|
12823
|
+
return parseCatchDef4(def, refs);
|
|
12824
|
+
case ZodFirstPartyTypeKind$1.ZodPipeline:
|
|
12825
|
+
return parsePipelineDef4(def, refs);
|
|
12826
|
+
case ZodFirstPartyTypeKind$1.ZodFunction:
|
|
12827
|
+
case ZodFirstPartyTypeKind$1.ZodVoid:
|
|
12828
|
+
case ZodFirstPartyTypeKind$1.ZodSymbol:
|
|
11557
12829
|
return void 0;
|
|
11558
12830
|
default:
|
|
11559
12831
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
11560
12832
|
}
|
|
11561
12833
|
};
|
|
11562
|
-
function
|
|
12834
|
+
function parseDef4(def, refs, forceResolution = false) {
|
|
11563
12835
|
const seenItem = refs.seen.get(def);
|
|
11564
12836
|
if (refs.override) {
|
|
11565
12837
|
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
11566
|
-
if (overrideResult !==
|
|
12838
|
+
if (overrideResult !== ignoreOverride4) {
|
|
11567
12839
|
return overrideResult;
|
|
11568
12840
|
}
|
|
11569
12841
|
}
|
|
11570
12842
|
if (seenItem && !forceResolution) {
|
|
11571
|
-
const seenSchema = get$
|
|
12843
|
+
const seenSchema = get$ref4(seenItem, refs);
|
|
11572
12844
|
if (seenSchema !== void 0) {
|
|
11573
12845
|
return seenSchema;
|
|
11574
12846
|
}
|
|
11575
12847
|
}
|
|
11576
12848
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
11577
12849
|
refs.seen.set(def, newItem);
|
|
11578
|
-
const jsonSchemaOrGetter =
|
|
11579
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
12850
|
+
const jsonSchemaOrGetter = selectParser4(def, def.typeName, refs);
|
|
12851
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef4(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
11580
12852
|
if (jsonSchema22) {
|
|
11581
|
-
|
|
12853
|
+
addMeta4(def, refs, jsonSchema22);
|
|
11582
12854
|
}
|
|
11583
12855
|
if (refs.postProcess) {
|
|
11584
12856
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -11588,23 +12860,23 @@ function parseDef3(def, refs, forceResolution = false) {
|
|
|
11588
12860
|
newItem.jsonSchema = jsonSchema22;
|
|
11589
12861
|
return jsonSchema22;
|
|
11590
12862
|
}
|
|
11591
|
-
var get$
|
|
12863
|
+
var get$ref4 = (item, refs) => {
|
|
11592
12864
|
switch (refs.$refStrategy) {
|
|
11593
12865
|
case "root":
|
|
11594
12866
|
return { $ref: item.path.join("/") };
|
|
11595
12867
|
case "relative":
|
|
11596
|
-
return { $ref:
|
|
12868
|
+
return { $ref: getRelativePath4(refs.currentPath, item.path) };
|
|
11597
12869
|
case "none":
|
|
11598
12870
|
case "seen": {
|
|
11599
12871
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
11600
12872
|
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
11601
|
-
return
|
|
12873
|
+
return parseAnyDef4(refs);
|
|
11602
12874
|
}
|
|
11603
|
-
return refs.$refStrategy === "seen" ?
|
|
12875
|
+
return refs.$refStrategy === "seen" ? parseAnyDef4(refs) : void 0;
|
|
11604
12876
|
}
|
|
11605
12877
|
}
|
|
11606
12878
|
};
|
|
11607
|
-
var
|
|
12879
|
+
var addMeta4 = (def, refs, jsonSchema22) => {
|
|
11608
12880
|
if (def.description) {
|
|
11609
12881
|
jsonSchema22.description = def.description;
|
|
11610
12882
|
if (refs.markdownDescription) {
|
|
@@ -11614,19 +12886,19 @@ var addMeta3 = (def, refs, jsonSchema22) => {
|
|
|
11614
12886
|
return jsonSchema22;
|
|
11615
12887
|
};
|
|
11616
12888
|
var zodToJsonSchema22 = (schema, options) => {
|
|
11617
|
-
const refs =
|
|
12889
|
+
const refs = getRefs4(options);
|
|
11618
12890
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name182, schema2]) => ({
|
|
11619
12891
|
...acc,
|
|
11620
|
-
[name182]:
|
|
12892
|
+
[name182]: parseDef4(schema2._def, {
|
|
11621
12893
|
...refs,
|
|
11622
12894
|
currentPath: [...refs.basePath, refs.definitionPath, name182]
|
|
11623
|
-
}, true) ??
|
|
12895
|
+
}, true) ?? parseAnyDef4(refs)
|
|
11624
12896
|
}), {}) : void 0;
|
|
11625
12897
|
const name172 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
11626
|
-
const main =
|
|
12898
|
+
const main = parseDef4(schema._def, name172 === void 0 ? refs : {
|
|
11627
12899
|
...refs,
|
|
11628
12900
|
currentPath: [...refs.basePath, refs.definitionPath, name172]
|
|
11629
|
-
}, false) ??
|
|
12901
|
+
}, false) ?? parseAnyDef4(refs);
|
|
11630
12902
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
11631
12903
|
if (title !== void 0) {
|
|
11632
12904
|
main.title = title;
|
|
@@ -11673,7 +12945,7 @@ var zodToJsonSchema22 = (schema, options) => {
|
|
|
11673
12945
|
}
|
|
11674
12946
|
return combined;
|
|
11675
12947
|
};
|
|
11676
|
-
var
|
|
12948
|
+
var esm_default3 = zodToJsonSchema22;
|
|
11677
12949
|
function fixJson3(input) {
|
|
11678
12950
|
const stack = ["ROOT"];
|
|
11679
12951
|
let lastValidIndex = -1;
|
|
@@ -12271,7 +13543,7 @@ function zodSchema3(zodSchema22, options) {
|
|
|
12271
13543
|
var _a172;
|
|
12272
13544
|
const useReferences = (_a172 = void 0) != null ? _a172 : false;
|
|
12273
13545
|
return jsonSchema3(
|
|
12274
|
-
|
|
13546
|
+
esm_default3(zodSchema22, {
|
|
12275
13547
|
$refStrategy: useReferences ? "root" : "none",
|
|
12276
13548
|
target: "jsonSchema7"
|
|
12277
13549
|
// note: openai mode breaks various gemini conversions
|
|
@@ -14685,17 +15957,17 @@ async function safeParseJSON4({
|
|
|
14685
15957
|
};
|
|
14686
15958
|
}
|
|
14687
15959
|
}
|
|
14688
|
-
var
|
|
15960
|
+
var getRelativePath5 = (pathA, pathB) => {
|
|
14689
15961
|
let i = 0;
|
|
14690
15962
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
14691
15963
|
if (pathA[i] !== pathB[i]) break;
|
|
14692
15964
|
}
|
|
14693
15965
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
14694
15966
|
};
|
|
14695
|
-
var
|
|
15967
|
+
var ignoreOverride5 = Symbol(
|
|
14696
15968
|
"Let zodToJsonSchema decide on which parser to use"
|
|
14697
15969
|
);
|
|
14698
|
-
var
|
|
15970
|
+
var defaultOptions5 = {
|
|
14699
15971
|
name: void 0,
|
|
14700
15972
|
$refStrategy: "root",
|
|
14701
15973
|
basePath: ["#"],
|
|
@@ -14716,23 +15988,23 @@ var defaultOptions4 = {
|
|
|
14716
15988
|
base64Strategy: "contentEncoding:base64",
|
|
14717
15989
|
nameStrategy: "ref"
|
|
14718
15990
|
};
|
|
14719
|
-
var
|
|
14720
|
-
...
|
|
15991
|
+
var getDefaultOptions5 = (options) => typeof options === "string" ? {
|
|
15992
|
+
...defaultOptions5,
|
|
14721
15993
|
name: options
|
|
14722
15994
|
} : {
|
|
14723
|
-
...
|
|
15995
|
+
...defaultOptions5,
|
|
14724
15996
|
...options
|
|
14725
15997
|
};
|
|
14726
|
-
function
|
|
15998
|
+
function parseAnyDef5() {
|
|
14727
15999
|
return {};
|
|
14728
16000
|
}
|
|
14729
|
-
function
|
|
16001
|
+
function parseArrayDef5(def, refs) {
|
|
14730
16002
|
var _a26, _b8, _c;
|
|
14731
16003
|
const res = {
|
|
14732
16004
|
type: "array"
|
|
14733
16005
|
};
|
|
14734
16006
|
if (((_a26 = def.type) == null ? void 0 : _a26._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
14735
|
-
res.items =
|
|
16007
|
+
res.items = parseDef5(def.type._def, {
|
|
14736
16008
|
...refs,
|
|
14737
16009
|
currentPath: [...refs.currentPath, "items"]
|
|
14738
16010
|
});
|
|
@@ -14749,7 +16021,7 @@ function parseArrayDef4(def, refs) {
|
|
|
14749
16021
|
}
|
|
14750
16022
|
return res;
|
|
14751
16023
|
}
|
|
14752
|
-
function
|
|
16024
|
+
function parseBigintDef5(def) {
|
|
14753
16025
|
const res = {
|
|
14754
16026
|
type: "integer",
|
|
14755
16027
|
format: "int64"
|
|
@@ -14778,20 +16050,20 @@ function parseBigintDef4(def) {
|
|
|
14778
16050
|
}
|
|
14779
16051
|
return res;
|
|
14780
16052
|
}
|
|
14781
|
-
function
|
|
16053
|
+
function parseBooleanDef5() {
|
|
14782
16054
|
return { type: "boolean" };
|
|
14783
16055
|
}
|
|
14784
|
-
function
|
|
14785
|
-
return
|
|
16056
|
+
function parseBrandedDef5(_def, refs) {
|
|
16057
|
+
return parseDef5(_def.type._def, refs);
|
|
14786
16058
|
}
|
|
14787
|
-
var
|
|
14788
|
-
return
|
|
16059
|
+
var parseCatchDef5 = (def, refs) => {
|
|
16060
|
+
return parseDef5(def.innerType._def, refs);
|
|
14789
16061
|
};
|
|
14790
|
-
function
|
|
16062
|
+
function parseDateDef5(def, refs, overrideDateStrategy) {
|
|
14791
16063
|
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
14792
16064
|
if (Array.isArray(strategy)) {
|
|
14793
16065
|
return {
|
|
14794
|
-
anyOf: strategy.map((item, i) =>
|
|
16066
|
+
anyOf: strategy.map((item, i) => parseDateDef5(def, refs, item))
|
|
14795
16067
|
};
|
|
14796
16068
|
}
|
|
14797
16069
|
switch (strategy) {
|
|
@@ -14807,10 +16079,10 @@ function parseDateDef4(def, refs, overrideDateStrategy) {
|
|
|
14807
16079
|
format: "date"
|
|
14808
16080
|
};
|
|
14809
16081
|
case "integer":
|
|
14810
|
-
return
|
|
16082
|
+
return integerDateParser5(def);
|
|
14811
16083
|
}
|
|
14812
16084
|
}
|
|
14813
|
-
var
|
|
16085
|
+
var integerDateParser5 = (def) => {
|
|
14814
16086
|
const res = {
|
|
14815
16087
|
type: "integer",
|
|
14816
16088
|
format: "unix-time"
|
|
@@ -14827,39 +16099,39 @@ var integerDateParser4 = (def) => {
|
|
|
14827
16099
|
}
|
|
14828
16100
|
return res;
|
|
14829
16101
|
};
|
|
14830
|
-
function
|
|
16102
|
+
function parseDefaultDef5(_def, refs) {
|
|
14831
16103
|
return {
|
|
14832
|
-
...
|
|
16104
|
+
...parseDef5(_def.innerType._def, refs),
|
|
14833
16105
|
default: _def.defaultValue()
|
|
14834
16106
|
};
|
|
14835
16107
|
}
|
|
14836
|
-
function
|
|
14837
|
-
return refs.effectStrategy === "input" ?
|
|
16108
|
+
function parseEffectsDef5(_def, refs) {
|
|
16109
|
+
return refs.effectStrategy === "input" ? parseDef5(_def.schema._def, refs) : parseAnyDef5();
|
|
14838
16110
|
}
|
|
14839
|
-
function
|
|
16111
|
+
function parseEnumDef5(def) {
|
|
14840
16112
|
return {
|
|
14841
16113
|
type: "string",
|
|
14842
16114
|
enum: Array.from(def.values)
|
|
14843
16115
|
};
|
|
14844
16116
|
}
|
|
14845
|
-
var
|
|
16117
|
+
var isJsonSchema7AllOfType5 = (type) => {
|
|
14846
16118
|
if ("type" in type && type.type === "string") return false;
|
|
14847
16119
|
return "allOf" in type;
|
|
14848
16120
|
};
|
|
14849
|
-
function
|
|
16121
|
+
function parseIntersectionDef5(def, refs) {
|
|
14850
16122
|
const allOf = [
|
|
14851
|
-
|
|
16123
|
+
parseDef5(def.left._def, {
|
|
14852
16124
|
...refs,
|
|
14853
16125
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
14854
16126
|
}),
|
|
14855
|
-
|
|
16127
|
+
parseDef5(def.right._def, {
|
|
14856
16128
|
...refs,
|
|
14857
16129
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
14858
16130
|
})
|
|
14859
16131
|
].filter((x) => !!x);
|
|
14860
16132
|
const mergedAllOf = [];
|
|
14861
16133
|
allOf.forEach((schema) => {
|
|
14862
|
-
if (
|
|
16134
|
+
if (isJsonSchema7AllOfType5(schema)) {
|
|
14863
16135
|
mergedAllOf.push(...schema.allOf);
|
|
14864
16136
|
} else {
|
|
14865
16137
|
let nestedSchema = schema;
|
|
@@ -14872,7 +16144,7 @@ function parseIntersectionDef4(def, refs) {
|
|
|
14872
16144
|
});
|
|
14873
16145
|
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
14874
16146
|
}
|
|
14875
|
-
function
|
|
16147
|
+
function parseLiteralDef5(def) {
|
|
14876
16148
|
const parsedType = typeof def.value;
|
|
14877
16149
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
14878
16150
|
return {
|
|
@@ -14884,8 +16156,8 @@ function parseLiteralDef4(def) {
|
|
|
14884
16156
|
const: def.value
|
|
14885
16157
|
};
|
|
14886
16158
|
}
|
|
14887
|
-
var
|
|
14888
|
-
var
|
|
16159
|
+
var emojiRegex5 = void 0;
|
|
16160
|
+
var zodPatterns5 = {
|
|
14889
16161
|
/**
|
|
14890
16162
|
* `c` was changed to `[cC]` to replicate /i flag
|
|
14891
16163
|
*/
|
|
@@ -14908,13 +16180,13 @@ var zodPatterns4 = {
|
|
|
14908
16180
|
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
14909
16181
|
*/
|
|
14910
16182
|
emoji: () => {
|
|
14911
|
-
if (
|
|
14912
|
-
|
|
16183
|
+
if (emojiRegex5 === void 0) {
|
|
16184
|
+
emojiRegex5 = RegExp(
|
|
14913
16185
|
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
14914
16186
|
"u"
|
|
14915
16187
|
);
|
|
14916
16188
|
}
|
|
14917
|
-
return
|
|
16189
|
+
return emojiRegex5;
|
|
14918
16190
|
},
|
|
14919
16191
|
/**
|
|
14920
16192
|
* Unused
|
|
@@ -14935,7 +16207,7 @@ var zodPatterns4 = {
|
|
|
14935
16207
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
14936
16208
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
14937
16209
|
};
|
|
14938
|
-
function
|
|
16210
|
+
function parseStringDef5(def, refs) {
|
|
14939
16211
|
const res = {
|
|
14940
16212
|
type: "string"
|
|
14941
16213
|
};
|
|
@@ -14951,67 +16223,67 @@ function parseStringDef4(def, refs) {
|
|
|
14951
16223
|
case "email":
|
|
14952
16224
|
switch (refs.emailStrategy) {
|
|
14953
16225
|
case "format:email":
|
|
14954
|
-
|
|
16226
|
+
addFormat5(res, "email", check.message, refs);
|
|
14955
16227
|
break;
|
|
14956
16228
|
case "format:idn-email":
|
|
14957
|
-
|
|
16229
|
+
addFormat5(res, "idn-email", check.message, refs);
|
|
14958
16230
|
break;
|
|
14959
16231
|
case "pattern:zod":
|
|
14960
|
-
|
|
16232
|
+
addPattern5(res, zodPatterns5.email, check.message, refs);
|
|
14961
16233
|
break;
|
|
14962
16234
|
}
|
|
14963
16235
|
break;
|
|
14964
16236
|
case "url":
|
|
14965
|
-
|
|
16237
|
+
addFormat5(res, "uri", check.message, refs);
|
|
14966
16238
|
break;
|
|
14967
16239
|
case "uuid":
|
|
14968
|
-
|
|
16240
|
+
addFormat5(res, "uuid", check.message, refs);
|
|
14969
16241
|
break;
|
|
14970
16242
|
case "regex":
|
|
14971
|
-
|
|
16243
|
+
addPattern5(res, check.regex, check.message, refs);
|
|
14972
16244
|
break;
|
|
14973
16245
|
case "cuid":
|
|
14974
|
-
|
|
16246
|
+
addPattern5(res, zodPatterns5.cuid, check.message, refs);
|
|
14975
16247
|
break;
|
|
14976
16248
|
case "cuid2":
|
|
14977
|
-
|
|
16249
|
+
addPattern5(res, zodPatterns5.cuid2, check.message, refs);
|
|
14978
16250
|
break;
|
|
14979
16251
|
case "startsWith":
|
|
14980
|
-
|
|
16252
|
+
addPattern5(
|
|
14981
16253
|
res,
|
|
14982
|
-
RegExp(`^${
|
|
16254
|
+
RegExp(`^${escapeLiteralCheckValue5(check.value, refs)}`),
|
|
14983
16255
|
check.message,
|
|
14984
16256
|
refs
|
|
14985
16257
|
);
|
|
14986
16258
|
break;
|
|
14987
16259
|
case "endsWith":
|
|
14988
|
-
|
|
16260
|
+
addPattern5(
|
|
14989
16261
|
res,
|
|
14990
|
-
RegExp(`${
|
|
16262
|
+
RegExp(`${escapeLiteralCheckValue5(check.value, refs)}$`),
|
|
14991
16263
|
check.message,
|
|
14992
16264
|
refs
|
|
14993
16265
|
);
|
|
14994
16266
|
break;
|
|
14995
16267
|
case "datetime":
|
|
14996
|
-
|
|
16268
|
+
addFormat5(res, "date-time", check.message, refs);
|
|
14997
16269
|
break;
|
|
14998
16270
|
case "date":
|
|
14999
|
-
|
|
16271
|
+
addFormat5(res, "date", check.message, refs);
|
|
15000
16272
|
break;
|
|
15001
16273
|
case "time":
|
|
15002
|
-
|
|
16274
|
+
addFormat5(res, "time", check.message, refs);
|
|
15003
16275
|
break;
|
|
15004
16276
|
case "duration":
|
|
15005
|
-
|
|
16277
|
+
addFormat5(res, "duration", check.message, refs);
|
|
15006
16278
|
break;
|
|
15007
16279
|
case "length":
|
|
15008
16280
|
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
15009
16281
|
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
15010
16282
|
break;
|
|
15011
16283
|
case "includes": {
|
|
15012
|
-
|
|
16284
|
+
addPattern5(
|
|
15013
16285
|
res,
|
|
15014
|
-
RegExp(
|
|
16286
|
+
RegExp(escapeLiteralCheckValue5(check.value, refs)),
|
|
15015
16287
|
check.message,
|
|
15016
16288
|
refs
|
|
15017
16289
|
);
|
|
@@ -15019,39 +16291,39 @@ function parseStringDef4(def, refs) {
|
|
|
15019
16291
|
}
|
|
15020
16292
|
case "ip": {
|
|
15021
16293
|
if (check.version !== "v6") {
|
|
15022
|
-
|
|
16294
|
+
addFormat5(res, "ipv4", check.message, refs);
|
|
15023
16295
|
}
|
|
15024
16296
|
if (check.version !== "v4") {
|
|
15025
|
-
|
|
16297
|
+
addFormat5(res, "ipv6", check.message, refs);
|
|
15026
16298
|
}
|
|
15027
16299
|
break;
|
|
15028
16300
|
}
|
|
15029
16301
|
case "base64url":
|
|
15030
|
-
|
|
16302
|
+
addPattern5(res, zodPatterns5.base64url, check.message, refs);
|
|
15031
16303
|
break;
|
|
15032
16304
|
case "jwt":
|
|
15033
|
-
|
|
16305
|
+
addPattern5(res, zodPatterns5.jwt, check.message, refs);
|
|
15034
16306
|
break;
|
|
15035
16307
|
case "cidr": {
|
|
15036
16308
|
if (check.version !== "v6") {
|
|
15037
|
-
|
|
16309
|
+
addPattern5(res, zodPatterns5.ipv4Cidr, check.message, refs);
|
|
15038
16310
|
}
|
|
15039
16311
|
if (check.version !== "v4") {
|
|
15040
|
-
|
|
16312
|
+
addPattern5(res, zodPatterns5.ipv6Cidr, check.message, refs);
|
|
15041
16313
|
}
|
|
15042
16314
|
break;
|
|
15043
16315
|
}
|
|
15044
16316
|
case "emoji":
|
|
15045
|
-
|
|
16317
|
+
addPattern5(res, zodPatterns5.emoji(), check.message, refs);
|
|
15046
16318
|
break;
|
|
15047
16319
|
case "ulid": {
|
|
15048
|
-
|
|
16320
|
+
addPattern5(res, zodPatterns5.ulid, check.message, refs);
|
|
15049
16321
|
break;
|
|
15050
16322
|
}
|
|
15051
16323
|
case "base64": {
|
|
15052
16324
|
switch (refs.base64Strategy) {
|
|
15053
16325
|
case "format:binary": {
|
|
15054
|
-
|
|
16326
|
+
addFormat5(res, "binary", check.message, refs);
|
|
15055
16327
|
break;
|
|
15056
16328
|
}
|
|
15057
16329
|
case "contentEncoding:base64": {
|
|
@@ -15059,37 +16331,37 @@ function parseStringDef4(def, refs) {
|
|
|
15059
16331
|
break;
|
|
15060
16332
|
}
|
|
15061
16333
|
case "pattern:zod": {
|
|
15062
|
-
|
|
16334
|
+
addPattern5(res, zodPatterns5.base64, check.message, refs);
|
|
15063
16335
|
break;
|
|
15064
16336
|
}
|
|
15065
16337
|
}
|
|
15066
16338
|
break;
|
|
15067
16339
|
}
|
|
15068
16340
|
case "nanoid": {
|
|
15069
|
-
|
|
16341
|
+
addPattern5(res, zodPatterns5.nanoid, check.message, refs);
|
|
15070
16342
|
}
|
|
15071
16343
|
}
|
|
15072
16344
|
}
|
|
15073
16345
|
}
|
|
15074
16346
|
return res;
|
|
15075
16347
|
}
|
|
15076
|
-
function
|
|
15077
|
-
return refs.patternStrategy === "escape" ?
|
|
16348
|
+
function escapeLiteralCheckValue5(literal, refs) {
|
|
16349
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric5(literal) : literal;
|
|
15078
16350
|
}
|
|
15079
|
-
var
|
|
16351
|
+
var ALPHA_NUMERIC5 = new Set(
|
|
15080
16352
|
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
15081
16353
|
);
|
|
15082
|
-
function
|
|
16354
|
+
function escapeNonAlphaNumeric5(source) {
|
|
15083
16355
|
let result = "";
|
|
15084
16356
|
for (let i = 0; i < source.length; i++) {
|
|
15085
|
-
if (!
|
|
16357
|
+
if (!ALPHA_NUMERIC5.has(source[i])) {
|
|
15086
16358
|
result += "\\";
|
|
15087
16359
|
}
|
|
15088
16360
|
result += source[i];
|
|
15089
16361
|
}
|
|
15090
16362
|
return result;
|
|
15091
16363
|
}
|
|
15092
|
-
function
|
|
16364
|
+
function addFormat5(schema, value, message, refs) {
|
|
15093
16365
|
var _a26;
|
|
15094
16366
|
if (schema.format || ((_a26 = schema.anyOf) == null ? void 0 : _a26.some((x) => x.format))) {
|
|
15095
16367
|
if (!schema.anyOf) {
|
|
@@ -15109,7 +16381,7 @@ function addFormat4(schema, value, message, refs) {
|
|
|
15109
16381
|
schema.format = value;
|
|
15110
16382
|
}
|
|
15111
16383
|
}
|
|
15112
|
-
function
|
|
16384
|
+
function addPattern5(schema, regex, message, refs) {
|
|
15113
16385
|
var _a26;
|
|
15114
16386
|
if (schema.pattern || ((_a26 = schema.allOf) == null ? void 0 : _a26.some((x) => x.pattern))) {
|
|
15115
16387
|
if (!schema.allOf) {
|
|
@@ -15122,14 +16394,14 @@ function addPattern4(schema, regex, message, refs) {
|
|
|
15122
16394
|
delete schema.pattern;
|
|
15123
16395
|
}
|
|
15124
16396
|
schema.allOf.push({
|
|
15125
|
-
pattern:
|
|
16397
|
+
pattern: stringifyRegExpWithFlags5(regex, refs),
|
|
15126
16398
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
15127
16399
|
});
|
|
15128
16400
|
} else {
|
|
15129
|
-
schema.pattern =
|
|
16401
|
+
schema.pattern = stringifyRegExpWithFlags5(regex, refs);
|
|
15130
16402
|
}
|
|
15131
16403
|
}
|
|
15132
|
-
function
|
|
16404
|
+
function stringifyRegExpWithFlags5(regex, refs) {
|
|
15133
16405
|
var _a26;
|
|
15134
16406
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
15135
16407
|
return regex.source;
|
|
@@ -15201,17 +16473,17 @@ function stringifyRegExpWithFlags4(regex, refs) {
|
|
|
15201
16473
|
}
|
|
15202
16474
|
return pattern;
|
|
15203
16475
|
}
|
|
15204
|
-
function
|
|
16476
|
+
function parseRecordDef5(def, refs) {
|
|
15205
16477
|
var _a26, _b8, _c, _d, _e, _f;
|
|
15206
16478
|
const schema = {
|
|
15207
16479
|
type: "object",
|
|
15208
|
-
additionalProperties: (_a26 =
|
|
16480
|
+
additionalProperties: (_a26 = parseDef5(def.valueType._def, {
|
|
15209
16481
|
...refs,
|
|
15210
16482
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
15211
16483
|
})) != null ? _a26 : refs.allowedAdditionalProperties
|
|
15212
16484
|
};
|
|
15213
16485
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind$1.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
15214
|
-
const { type, ...keyType } =
|
|
16486
|
+
const { type, ...keyType } = parseStringDef5(def.keyType._def, refs);
|
|
15215
16487
|
return {
|
|
15216
16488
|
...schema,
|
|
15217
16489
|
propertyNames: keyType
|
|
@@ -15224,7 +16496,7 @@ function parseRecordDef4(def, refs) {
|
|
|
15224
16496
|
}
|
|
15225
16497
|
};
|
|
15226
16498
|
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
15227
|
-
const { type, ...keyType } =
|
|
16499
|
+
const { type, ...keyType } = parseBrandedDef5(
|
|
15228
16500
|
def.keyType._def,
|
|
15229
16501
|
refs
|
|
15230
16502
|
);
|
|
@@ -15235,18 +16507,18 @@ function parseRecordDef4(def, refs) {
|
|
|
15235
16507
|
}
|
|
15236
16508
|
return schema;
|
|
15237
16509
|
}
|
|
15238
|
-
function
|
|
16510
|
+
function parseMapDef5(def, refs) {
|
|
15239
16511
|
if (refs.mapStrategy === "record") {
|
|
15240
|
-
return
|
|
16512
|
+
return parseRecordDef5(def, refs);
|
|
15241
16513
|
}
|
|
15242
|
-
const keys =
|
|
16514
|
+
const keys = parseDef5(def.keyType._def, {
|
|
15243
16515
|
...refs,
|
|
15244
16516
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
15245
|
-
}) ||
|
|
15246
|
-
const values =
|
|
16517
|
+
}) || parseAnyDef5();
|
|
16518
|
+
const values = parseDef5(def.valueType._def, {
|
|
15247
16519
|
...refs,
|
|
15248
16520
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
15249
|
-
}) ||
|
|
16521
|
+
}) || parseAnyDef5();
|
|
15250
16522
|
return {
|
|
15251
16523
|
type: "array",
|
|
15252
16524
|
maxItems: 125,
|
|
@@ -15258,7 +16530,7 @@ function parseMapDef4(def, refs) {
|
|
|
15258
16530
|
}
|
|
15259
16531
|
};
|
|
15260
16532
|
}
|
|
15261
|
-
function
|
|
16533
|
+
function parseNativeEnumDef5(def) {
|
|
15262
16534
|
const object5 = def.values;
|
|
15263
16535
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
15264
16536
|
return typeof object5[object5[key]] !== "number";
|
|
@@ -15272,28 +16544,28 @@ function parseNativeEnumDef4(def) {
|
|
|
15272
16544
|
enum: actualValues
|
|
15273
16545
|
};
|
|
15274
16546
|
}
|
|
15275
|
-
function
|
|
15276
|
-
return { not:
|
|
16547
|
+
function parseNeverDef5() {
|
|
16548
|
+
return { not: parseAnyDef5() };
|
|
15277
16549
|
}
|
|
15278
|
-
function
|
|
16550
|
+
function parseNullDef5() {
|
|
15279
16551
|
return {
|
|
15280
16552
|
type: "null"
|
|
15281
16553
|
};
|
|
15282
16554
|
}
|
|
15283
|
-
var
|
|
16555
|
+
var primitiveMappings5 = {
|
|
15284
16556
|
ZodString: "string",
|
|
15285
16557
|
ZodNumber: "number",
|
|
15286
16558
|
ZodBigInt: "integer",
|
|
15287
16559
|
ZodBoolean: "boolean",
|
|
15288
16560
|
ZodNull: "null"
|
|
15289
16561
|
};
|
|
15290
|
-
function
|
|
16562
|
+
function parseUnionDef5(def, refs) {
|
|
15291
16563
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
15292
16564
|
if (options.every(
|
|
15293
|
-
(x) => x._def.typeName in
|
|
16565
|
+
(x) => x._def.typeName in primitiveMappings5 && (!x._def.checks || !x._def.checks.length)
|
|
15294
16566
|
)) {
|
|
15295
16567
|
const types = options.reduce((types2, x) => {
|
|
15296
|
-
const type =
|
|
16568
|
+
const type = primitiveMappings5[x._def.typeName];
|
|
15297
16569
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
15298
16570
|
}, []);
|
|
15299
16571
|
return {
|
|
@@ -15345,11 +16617,11 @@ function parseUnionDef4(def, refs) {
|
|
|
15345
16617
|
)
|
|
15346
16618
|
};
|
|
15347
16619
|
}
|
|
15348
|
-
return
|
|
16620
|
+
return asAnyOf5(def, refs);
|
|
15349
16621
|
}
|
|
15350
|
-
var
|
|
16622
|
+
var asAnyOf5 = (def, refs) => {
|
|
15351
16623
|
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
15352
|
-
(x, i) =>
|
|
16624
|
+
(x, i) => parseDef5(x._def, {
|
|
15353
16625
|
...refs,
|
|
15354
16626
|
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
15355
16627
|
})
|
|
@@ -15358,24 +16630,24 @@ var asAnyOf4 = (def, refs) => {
|
|
|
15358
16630
|
);
|
|
15359
16631
|
return anyOf.length ? { anyOf } : void 0;
|
|
15360
16632
|
};
|
|
15361
|
-
function
|
|
16633
|
+
function parseNullableDef5(def, refs) {
|
|
15362
16634
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
15363
16635
|
def.innerType._def.typeName
|
|
15364
16636
|
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
15365
16637
|
return {
|
|
15366
16638
|
type: [
|
|
15367
|
-
|
|
16639
|
+
primitiveMappings5[def.innerType._def.typeName],
|
|
15368
16640
|
"null"
|
|
15369
16641
|
]
|
|
15370
16642
|
};
|
|
15371
16643
|
}
|
|
15372
|
-
const base =
|
|
16644
|
+
const base = parseDef5(def.innerType._def, {
|
|
15373
16645
|
...refs,
|
|
15374
16646
|
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
15375
16647
|
});
|
|
15376
16648
|
return base && { anyOf: [base, { type: "null" }] };
|
|
15377
16649
|
}
|
|
15378
|
-
function
|
|
16650
|
+
function parseNumberDef5(def) {
|
|
15379
16651
|
const res = {
|
|
15380
16652
|
type: "number"
|
|
15381
16653
|
};
|
|
@@ -15406,7 +16678,7 @@ function parseNumberDef4(def) {
|
|
|
15406
16678
|
}
|
|
15407
16679
|
return res;
|
|
15408
16680
|
}
|
|
15409
|
-
function
|
|
16681
|
+
function parseObjectDef5(def, refs) {
|
|
15410
16682
|
const result = {
|
|
15411
16683
|
type: "object",
|
|
15412
16684
|
properties: {}
|
|
@@ -15418,8 +16690,8 @@ function parseObjectDef4(def, refs) {
|
|
|
15418
16690
|
if (propDef === void 0 || propDef._def === void 0) {
|
|
15419
16691
|
continue;
|
|
15420
16692
|
}
|
|
15421
|
-
const propOptional =
|
|
15422
|
-
const parsedDef =
|
|
16693
|
+
const propOptional = safeIsOptional5(propDef);
|
|
16694
|
+
const parsedDef = parseDef5(propDef._def, {
|
|
15423
16695
|
...refs,
|
|
15424
16696
|
currentPath: [...refs.currentPath, "properties", propName],
|
|
15425
16697
|
propertyPath: [...refs.currentPath, "properties", propName]
|
|
@@ -15435,15 +16707,15 @@ function parseObjectDef4(def, refs) {
|
|
|
15435
16707
|
if (required.length) {
|
|
15436
16708
|
result.required = required;
|
|
15437
16709
|
}
|
|
15438
|
-
const additionalProperties =
|
|
16710
|
+
const additionalProperties = decideAdditionalProperties5(def, refs);
|
|
15439
16711
|
if (additionalProperties !== void 0) {
|
|
15440
16712
|
result.additionalProperties = additionalProperties;
|
|
15441
16713
|
}
|
|
15442
16714
|
return result;
|
|
15443
16715
|
}
|
|
15444
|
-
function
|
|
16716
|
+
function decideAdditionalProperties5(def, refs) {
|
|
15445
16717
|
if (def.catchall._def.typeName !== "ZodNever") {
|
|
15446
|
-
return
|
|
16718
|
+
return parseDef5(def.catchall._def, {
|
|
15447
16719
|
...refs,
|
|
15448
16720
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
15449
16721
|
});
|
|
@@ -15457,35 +16729,35 @@ function decideAdditionalProperties4(def, refs) {
|
|
|
15457
16729
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
15458
16730
|
}
|
|
15459
16731
|
}
|
|
15460
|
-
function
|
|
16732
|
+
function safeIsOptional5(schema) {
|
|
15461
16733
|
try {
|
|
15462
16734
|
return schema.isOptional();
|
|
15463
16735
|
} catch (e2) {
|
|
15464
16736
|
return true;
|
|
15465
16737
|
}
|
|
15466
16738
|
}
|
|
15467
|
-
var
|
|
16739
|
+
var parseOptionalDef5 = (def, refs) => {
|
|
15468
16740
|
var _a26;
|
|
15469
16741
|
if (refs.currentPath.toString() === ((_a26 = refs.propertyPath) == null ? void 0 : _a26.toString())) {
|
|
15470
|
-
return
|
|
16742
|
+
return parseDef5(def.innerType._def, refs);
|
|
15471
16743
|
}
|
|
15472
|
-
const innerSchema =
|
|
16744
|
+
const innerSchema = parseDef5(def.innerType._def, {
|
|
15473
16745
|
...refs,
|
|
15474
16746
|
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
15475
16747
|
});
|
|
15476
|
-
return innerSchema ? { anyOf: [{ not:
|
|
16748
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef5() }, innerSchema] } : parseAnyDef5();
|
|
15477
16749
|
};
|
|
15478
|
-
var
|
|
16750
|
+
var parsePipelineDef5 = (def, refs) => {
|
|
15479
16751
|
if (refs.pipeStrategy === "input") {
|
|
15480
|
-
return
|
|
16752
|
+
return parseDef5(def.in._def, refs);
|
|
15481
16753
|
} else if (refs.pipeStrategy === "output") {
|
|
15482
|
-
return
|
|
16754
|
+
return parseDef5(def.out._def, refs);
|
|
15483
16755
|
}
|
|
15484
|
-
const a =
|
|
16756
|
+
const a = parseDef5(def.in._def, {
|
|
15485
16757
|
...refs,
|
|
15486
16758
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
15487
16759
|
});
|
|
15488
|
-
const b =
|
|
16760
|
+
const b = parseDef5(def.out._def, {
|
|
15489
16761
|
...refs,
|
|
15490
16762
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
15491
16763
|
});
|
|
@@ -15493,11 +16765,11 @@ var parsePipelineDef4 = (def, refs) => {
|
|
|
15493
16765
|
allOf: [a, b].filter((x) => x !== void 0)
|
|
15494
16766
|
};
|
|
15495
16767
|
};
|
|
15496
|
-
function
|
|
15497
|
-
return
|
|
16768
|
+
function parsePromiseDef5(def, refs) {
|
|
16769
|
+
return parseDef5(def.type._def, refs);
|
|
15498
16770
|
}
|
|
15499
|
-
function
|
|
15500
|
-
const items =
|
|
16771
|
+
function parseSetDef5(def, refs) {
|
|
16772
|
+
const items = parseDef5(def.valueType._def, {
|
|
15501
16773
|
...refs,
|
|
15502
16774
|
currentPath: [...refs.currentPath, "items"]
|
|
15503
16775
|
});
|
|
@@ -15514,13 +16786,13 @@ function parseSetDef4(def, refs) {
|
|
|
15514
16786
|
}
|
|
15515
16787
|
return schema;
|
|
15516
16788
|
}
|
|
15517
|
-
function
|
|
16789
|
+
function parseTupleDef5(def, refs) {
|
|
15518
16790
|
if (def.rest) {
|
|
15519
16791
|
return {
|
|
15520
16792
|
type: "array",
|
|
15521
16793
|
minItems: def.items.length,
|
|
15522
16794
|
items: def.items.map(
|
|
15523
|
-
(x, i) =>
|
|
16795
|
+
(x, i) => parseDef5(x._def, {
|
|
15524
16796
|
...refs,
|
|
15525
16797
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
15526
16798
|
})
|
|
@@ -15528,7 +16800,7 @@ function parseTupleDef4(def, refs) {
|
|
|
15528
16800
|
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
15529
16801
|
[]
|
|
15530
16802
|
),
|
|
15531
|
-
additionalItems:
|
|
16803
|
+
additionalItems: parseDef5(def.rest._def, {
|
|
15532
16804
|
...refs,
|
|
15533
16805
|
currentPath: [...refs.currentPath, "additionalItems"]
|
|
15534
16806
|
})
|
|
@@ -15539,7 +16811,7 @@ function parseTupleDef4(def, refs) {
|
|
|
15539
16811
|
minItems: def.items.length,
|
|
15540
16812
|
maxItems: def.items.length,
|
|
15541
16813
|
items: def.items.map(
|
|
15542
|
-
(x, i) =>
|
|
16814
|
+
(x, i) => parseDef5(x._def, {
|
|
15543
16815
|
...refs,
|
|
15544
16816
|
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
15545
16817
|
})
|
|
@@ -15550,83 +16822,83 @@ function parseTupleDef4(def, refs) {
|
|
|
15550
16822
|
};
|
|
15551
16823
|
}
|
|
15552
16824
|
}
|
|
15553
|
-
function
|
|
16825
|
+
function parseUndefinedDef5() {
|
|
15554
16826
|
return {
|
|
15555
|
-
not:
|
|
16827
|
+
not: parseAnyDef5()
|
|
15556
16828
|
};
|
|
15557
16829
|
}
|
|
15558
|
-
function
|
|
15559
|
-
return
|
|
16830
|
+
function parseUnknownDef5() {
|
|
16831
|
+
return parseAnyDef5();
|
|
15560
16832
|
}
|
|
15561
|
-
var
|
|
15562
|
-
return
|
|
16833
|
+
var parseReadonlyDef5 = (def, refs) => {
|
|
16834
|
+
return parseDef5(def.innerType._def, refs);
|
|
15563
16835
|
};
|
|
15564
|
-
var
|
|
16836
|
+
var selectParser5 = (def, typeName, refs) => {
|
|
15565
16837
|
switch (typeName) {
|
|
15566
16838
|
case ZodFirstPartyTypeKind$1.ZodString:
|
|
15567
|
-
return
|
|
16839
|
+
return parseStringDef5(def, refs);
|
|
15568
16840
|
case ZodFirstPartyTypeKind$1.ZodNumber:
|
|
15569
|
-
return
|
|
16841
|
+
return parseNumberDef5(def);
|
|
15570
16842
|
case ZodFirstPartyTypeKind$1.ZodObject:
|
|
15571
|
-
return
|
|
16843
|
+
return parseObjectDef5(def, refs);
|
|
15572
16844
|
case ZodFirstPartyTypeKind$1.ZodBigInt:
|
|
15573
|
-
return
|
|
16845
|
+
return parseBigintDef5(def);
|
|
15574
16846
|
case ZodFirstPartyTypeKind$1.ZodBoolean:
|
|
15575
|
-
return
|
|
16847
|
+
return parseBooleanDef5();
|
|
15576
16848
|
case ZodFirstPartyTypeKind$1.ZodDate:
|
|
15577
|
-
return
|
|
16849
|
+
return parseDateDef5(def, refs);
|
|
15578
16850
|
case ZodFirstPartyTypeKind$1.ZodUndefined:
|
|
15579
|
-
return
|
|
16851
|
+
return parseUndefinedDef5();
|
|
15580
16852
|
case ZodFirstPartyTypeKind$1.ZodNull:
|
|
15581
|
-
return
|
|
16853
|
+
return parseNullDef5();
|
|
15582
16854
|
case ZodFirstPartyTypeKind$1.ZodArray:
|
|
15583
|
-
return
|
|
16855
|
+
return parseArrayDef5(def, refs);
|
|
15584
16856
|
case ZodFirstPartyTypeKind$1.ZodUnion:
|
|
15585
16857
|
case ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion:
|
|
15586
|
-
return
|
|
16858
|
+
return parseUnionDef5(def, refs);
|
|
15587
16859
|
case ZodFirstPartyTypeKind$1.ZodIntersection:
|
|
15588
|
-
return
|
|
16860
|
+
return parseIntersectionDef5(def, refs);
|
|
15589
16861
|
case ZodFirstPartyTypeKind$1.ZodTuple:
|
|
15590
|
-
return
|
|
16862
|
+
return parseTupleDef5(def, refs);
|
|
15591
16863
|
case ZodFirstPartyTypeKind$1.ZodRecord:
|
|
15592
|
-
return
|
|
16864
|
+
return parseRecordDef5(def, refs);
|
|
15593
16865
|
case ZodFirstPartyTypeKind$1.ZodLiteral:
|
|
15594
|
-
return
|
|
16866
|
+
return parseLiteralDef5(def);
|
|
15595
16867
|
case ZodFirstPartyTypeKind$1.ZodEnum:
|
|
15596
|
-
return
|
|
16868
|
+
return parseEnumDef5(def);
|
|
15597
16869
|
case ZodFirstPartyTypeKind$1.ZodNativeEnum:
|
|
15598
|
-
return
|
|
16870
|
+
return parseNativeEnumDef5(def);
|
|
15599
16871
|
case ZodFirstPartyTypeKind$1.ZodNullable:
|
|
15600
|
-
return
|
|
16872
|
+
return parseNullableDef5(def, refs);
|
|
15601
16873
|
case ZodFirstPartyTypeKind$1.ZodOptional:
|
|
15602
|
-
return
|
|
16874
|
+
return parseOptionalDef5(def, refs);
|
|
15603
16875
|
case ZodFirstPartyTypeKind$1.ZodMap:
|
|
15604
|
-
return
|
|
16876
|
+
return parseMapDef5(def, refs);
|
|
15605
16877
|
case ZodFirstPartyTypeKind$1.ZodSet:
|
|
15606
|
-
return
|
|
16878
|
+
return parseSetDef5(def, refs);
|
|
15607
16879
|
case ZodFirstPartyTypeKind$1.ZodLazy:
|
|
15608
16880
|
return () => def.getter()._def;
|
|
15609
16881
|
case ZodFirstPartyTypeKind$1.ZodPromise:
|
|
15610
|
-
return
|
|
16882
|
+
return parsePromiseDef5(def, refs);
|
|
15611
16883
|
case ZodFirstPartyTypeKind$1.ZodNaN:
|
|
15612
16884
|
case ZodFirstPartyTypeKind$1.ZodNever:
|
|
15613
|
-
return
|
|
16885
|
+
return parseNeverDef5();
|
|
15614
16886
|
case ZodFirstPartyTypeKind$1.ZodEffects:
|
|
15615
|
-
return
|
|
16887
|
+
return parseEffectsDef5(def, refs);
|
|
15616
16888
|
case ZodFirstPartyTypeKind$1.ZodAny:
|
|
15617
|
-
return
|
|
16889
|
+
return parseAnyDef5();
|
|
15618
16890
|
case ZodFirstPartyTypeKind$1.ZodUnknown:
|
|
15619
|
-
return
|
|
16891
|
+
return parseUnknownDef5();
|
|
15620
16892
|
case ZodFirstPartyTypeKind$1.ZodDefault:
|
|
15621
|
-
return
|
|
16893
|
+
return parseDefaultDef5(def, refs);
|
|
15622
16894
|
case ZodFirstPartyTypeKind$1.ZodBranded:
|
|
15623
|
-
return
|
|
16895
|
+
return parseBrandedDef5(def, refs);
|
|
15624
16896
|
case ZodFirstPartyTypeKind$1.ZodReadonly:
|
|
15625
|
-
return
|
|
16897
|
+
return parseReadonlyDef5(def, refs);
|
|
15626
16898
|
case ZodFirstPartyTypeKind$1.ZodCatch:
|
|
15627
|
-
return
|
|
16899
|
+
return parseCatchDef5(def, refs);
|
|
15628
16900
|
case ZodFirstPartyTypeKind$1.ZodPipeline:
|
|
15629
|
-
return
|
|
16901
|
+
return parsePipelineDef5(def, refs);
|
|
15630
16902
|
case ZodFirstPartyTypeKind$1.ZodFunction:
|
|
15631
16903
|
case ZodFirstPartyTypeKind$1.ZodVoid:
|
|
15632
16904
|
case ZodFirstPartyTypeKind$1.ZodSymbol:
|
|
@@ -15635,7 +16907,7 @@ var selectParser4 = (def, typeName, refs) => {
|
|
|
15635
16907
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
15636
16908
|
}
|
|
15637
16909
|
};
|
|
15638
|
-
function
|
|
16910
|
+
function parseDef5(def, refs, forceResolution = false) {
|
|
15639
16911
|
var _a26;
|
|
15640
16912
|
const seenItem = refs.seen.get(def);
|
|
15641
16913
|
if (refs.override) {
|
|
@@ -15646,22 +16918,22 @@ function parseDef4(def, refs, forceResolution = false) {
|
|
|
15646
16918
|
seenItem,
|
|
15647
16919
|
forceResolution
|
|
15648
16920
|
);
|
|
15649
|
-
if (overrideResult !==
|
|
16921
|
+
if (overrideResult !== ignoreOverride5) {
|
|
15650
16922
|
return overrideResult;
|
|
15651
16923
|
}
|
|
15652
16924
|
}
|
|
15653
16925
|
if (seenItem && !forceResolution) {
|
|
15654
|
-
const seenSchema = get$
|
|
16926
|
+
const seenSchema = get$ref5(seenItem, refs);
|
|
15655
16927
|
if (seenSchema !== void 0) {
|
|
15656
16928
|
return seenSchema;
|
|
15657
16929
|
}
|
|
15658
16930
|
}
|
|
15659
16931
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
15660
16932
|
refs.seen.set(def, newItem);
|
|
15661
|
-
const jsonSchemaOrGetter =
|
|
15662
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ?
|
|
16933
|
+
const jsonSchemaOrGetter = selectParser5(def, def.typeName, refs);
|
|
16934
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef5(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
15663
16935
|
if (jsonSchema22) {
|
|
15664
|
-
|
|
16936
|
+
addMeta5(def, refs, jsonSchema22);
|
|
15665
16937
|
}
|
|
15666
16938
|
if (refs.postProcess) {
|
|
15667
16939
|
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
@@ -15671,12 +16943,12 @@ function parseDef4(def, refs, forceResolution = false) {
|
|
|
15671
16943
|
newItem.jsonSchema = jsonSchema22;
|
|
15672
16944
|
return jsonSchema22;
|
|
15673
16945
|
}
|
|
15674
|
-
var get$
|
|
16946
|
+
var get$ref5 = (item, refs) => {
|
|
15675
16947
|
switch (refs.$refStrategy) {
|
|
15676
16948
|
case "root":
|
|
15677
16949
|
return { $ref: item.path.join("/") };
|
|
15678
16950
|
case "relative":
|
|
15679
|
-
return { $ref:
|
|
16951
|
+
return { $ref: getRelativePath5(refs.currentPath, item.path) };
|
|
15680
16952
|
case "none":
|
|
15681
16953
|
case "seen": {
|
|
15682
16954
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
@@ -15685,20 +16957,20 @@ var get$ref4 = (item, refs) => {
|
|
|
15685
16957
|
"/"
|
|
15686
16958
|
)}! Defaulting to any`
|
|
15687
16959
|
);
|
|
15688
|
-
return
|
|
16960
|
+
return parseAnyDef5();
|
|
15689
16961
|
}
|
|
15690
|
-
return refs.$refStrategy === "seen" ?
|
|
16962
|
+
return refs.$refStrategy === "seen" ? parseAnyDef5() : void 0;
|
|
15691
16963
|
}
|
|
15692
16964
|
}
|
|
15693
16965
|
};
|
|
15694
|
-
var
|
|
16966
|
+
var addMeta5 = (def, refs, jsonSchema22) => {
|
|
15695
16967
|
if (def.description) {
|
|
15696
16968
|
jsonSchema22.description = def.description;
|
|
15697
16969
|
}
|
|
15698
16970
|
return jsonSchema22;
|
|
15699
16971
|
};
|
|
15700
|
-
var
|
|
15701
|
-
const _options =
|
|
16972
|
+
var getRefs5 = (options) => {
|
|
16973
|
+
const _options = getDefaultOptions5(options);
|
|
15702
16974
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
15703
16975
|
return {
|
|
15704
16976
|
..._options,
|
|
@@ -15717,35 +16989,35 @@ var getRefs4 = (options) => {
|
|
|
15717
16989
|
)
|
|
15718
16990
|
};
|
|
15719
16991
|
};
|
|
15720
|
-
var
|
|
16992
|
+
var zodToJsonSchema5 = (schema, options) => {
|
|
15721
16993
|
var _a26;
|
|
15722
|
-
const refs =
|
|
16994
|
+
const refs = getRefs5(options);
|
|
15723
16995
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
15724
16996
|
(acc, [name26, schema2]) => {
|
|
15725
16997
|
var _a27;
|
|
15726
16998
|
return {
|
|
15727
16999
|
...acc,
|
|
15728
|
-
[name26]: (_a27 =
|
|
17000
|
+
[name26]: (_a27 = parseDef5(
|
|
15729
17001
|
schema2._def,
|
|
15730
17002
|
{
|
|
15731
17003
|
...refs,
|
|
15732
17004
|
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
15733
17005
|
},
|
|
15734
17006
|
true
|
|
15735
|
-
)) != null ? _a27 :
|
|
17007
|
+
)) != null ? _a27 : parseAnyDef5()
|
|
15736
17008
|
};
|
|
15737
17009
|
},
|
|
15738
17010
|
{}
|
|
15739
17011
|
) : void 0;
|
|
15740
17012
|
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
15741
|
-
const main = (_a26 =
|
|
17013
|
+
const main = (_a26 = parseDef5(
|
|
15742
17014
|
schema._def,
|
|
15743
17015
|
name21 === void 0 ? refs : {
|
|
15744
17016
|
...refs,
|
|
15745
17017
|
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
15746
17018
|
},
|
|
15747
17019
|
false
|
|
15748
|
-
)) != null ? _a26 :
|
|
17020
|
+
)) != null ? _a26 : parseAnyDef5();
|
|
15749
17021
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
15750
17022
|
if (title !== void 0) {
|
|
15751
17023
|
main.title = title;
|
|
@@ -15767,7 +17039,7 @@ var zodToJsonSchema4 = (schema, options) => {
|
|
|
15767
17039
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
15768
17040
|
return combined;
|
|
15769
17041
|
};
|
|
15770
|
-
var zod_to_json_schema_default2 =
|
|
17042
|
+
var zod_to_json_schema_default2 = zodToJsonSchema5;
|
|
15771
17043
|
function zod3Schema2(zodSchema22, options) {
|
|
15772
17044
|
var _a26;
|
|
15773
17045
|
const useReferences = (_a26 = void 0 ) != null ? _a26 : false;
|
|
@@ -23212,5 +24484,5 @@ var OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({
|
|
|
23212
24484
|
});
|
|
23213
24485
|
|
|
23214
24486
|
export { CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_EXECUTION_RESULT_ROUTE, LIST_AGENT_BUILDER_ACTIONS_ROUTE, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE, RESUME_AGENT_BUILDER_ACTION_ROUTE, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE, START_AGENT_BUILDER_ACTION_RUN_ROUTE, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE, STREAM_AGENT_BUILDER_ACTION_ROUTE, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE, agent_builder_exports };
|
|
23215
|
-
//# sourceMappingURL=chunk-
|
|
23216
|
-
//# sourceMappingURL=chunk-
|
|
24487
|
+
//# sourceMappingURL=chunk-OL6U27XK.js.map
|
|
24488
|
+
//# sourceMappingURL=chunk-OL6U27XK.js.map
|