@langchain/core 1.1.34 → 1.1.35
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 +10 -0
- package/dist/callbacks/dispatch/index.d.ts +1 -0
- package/dist/callbacks/dispatch/index.d.ts.map +1 -1
- package/dist/callbacks/dispatch/web.d.ts +1 -0
- package/dist/callbacks/dispatch/web.d.ts.map +1 -1
- package/dist/language_models/base.cjs +1 -1
- package/dist/language_models/base.cjs.map +1 -1
- package/dist/language_models/base.d.cts +5 -7
- package/dist/language_models/base.d.cts.map +1 -1
- package/dist/language_models/base.d.ts +5 -7
- package/dist/language_models/base.d.ts.map +1 -1
- package/dist/language_models/base.js +1 -1
- package/dist/language_models/base.js.map +1 -1
- package/dist/language_models/chat_models.cjs +14 -3
- package/dist/language_models/chat_models.cjs.map +1 -1
- package/dist/language_models/chat_models.d.cts +12 -6
- package/dist/language_models/chat_models.d.cts.map +1 -1
- package/dist/language_models/chat_models.d.ts +12 -7
- package/dist/language_models/chat_models.d.ts.map +1 -1
- package/dist/language_models/chat_models.js +14 -3
- package/dist/language_models/chat_models.js.map +1 -1
- package/dist/language_models/llms.d.ts.map +1 -1
- package/dist/language_models/structured_output.d.ts.map +1 -1
- package/dist/output_parsers/base.d.ts.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +3 -5
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +3 -5
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
- package/dist/prompts/structured.d.ts.map +1 -1
- package/dist/retrievers/index.d.ts.map +1 -1
- package/dist/runnables/branch.d.ts.map +1 -1
- package/dist/runnables/history.d.ts.map +1 -1
- package/dist/runnables/passthrough.d.ts.map +1 -1
- package/dist/runnables/router.d.ts.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/types.cjs.map +1 -1
- package/dist/tools/types.d.cts +3 -4
- package/dist/tools/types.d.cts.map +1 -1
- package/dist/tools/types.d.ts +3 -4
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/utils/json_schema.cjs.map +1 -1
- package/dist/utils/json_schema.d.cts +1 -1
- package/dist/utils/json_schema.d.cts.map +1 -1
- package/dist/utils/json_schema.d.ts.map +1 -1
- package/dist/utils/json_schema.js.map +1 -1
- package/dist/utils/types/index.d.cts +2 -2
- package/dist/utils/types/index.d.ts +2 -2
- package/dist/utils/types/zod.cjs +1 -1
- package/dist/utils/types/zod.cjs.map +1 -1
- package/dist/utils/types/zod.d.cts +141 -35
- package/dist/utils/types/zod.d.cts.map +1 -1
- package/dist/utils/types/zod.d.ts +141 -35
- package/dist/utils/types/zod.d.ts.map +1 -1
- package/dist/utils/types/zod.js +1 -1
- package/dist/utils/types/zod.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.cjs","names":["globalRegistry","util","$ZodOptional","$ZodNever","$ZodUnknown"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nimport type * as z4Classic from \"zod/v4\";\n// Import from main \"zod\" package to get the types users would get with `import { z } from \"zod\"`\n// This is important for zod v4.x where the main package uses the classic/compat API\nimport type * as zodMain from \"zod\";\nimport {\n parse,\n parseAsync,\n globalRegistry,\n util,\n clone,\n _unknown,\n _never,\n $ZodUnknown,\n $ZodNever,\n $ZodOptional,\n} from \"zod/v4/core\";\nimport { SerializableSchema } from \"../standard_schema.js\";\n\nexport type ZodStringV3 = z3.ZodString;\n\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n\n// ZodObject in zod v3 and zod v4's v3 compat layer has 5 type parameters:\n// T (shape), UnknownKeys, Catchall, Output, Input\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any, any>;\n\n// Core $ZodObject type from \"zod/v4/core\"\nexport type ZodObjectV4 = z4.$ZodObject;\n\n// Classic ZodObject type from \"zod/v4\" (the classic/compat API)\n// This is what users get when using `import { z } from \"zod\"` with zod v4.x\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV4Classic = z4Classic.ZodObject<any, any>;\n\n// Main \"zod\" package ZodObject - the type users get with `import { z } from \"zod\"`\n// In zod v4.x, this uses the v4 classic API with 2 type params (Shape, Config)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectMain = zodMain.ZodObject<any, any>;\n\nexport type ZodDefaultV3<T extends z3.ZodTypeAny> = z3.ZodDefault<T>;\nexport type ZodDefaultV4<T extends z4.SomeType> = z4.$ZodDefault<T>;\nexport type ZodOptionalV3<T extends z3.ZodTypeAny> = z3.ZodOptional<T>;\nexport type ZodOptionalV4<T extends z4.SomeType> = z4.$ZodOptional<T>;\nexport type ZodNullableV4<T extends z4.SomeType> = z4.$ZodNullable<T>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> =\n | z3.ZodType<Output, z3.ZodTypeDef, Input>\n | z4.$ZodType<Output, Input>;\n\nexport type InteropZodObject =\n | ZodObjectV3\n | ZodObjectV4\n | ZodObjectV4Classic\n | ZodObjectMain;\nexport type InteropZodDefault<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodDefaultV3<T>\n : T extends z4.SomeType\n ? ZodDefaultV4<T>\n : never;\nexport type InteropZodOptional<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodOptionalV3<T>\n : T extends z4.SomeType\n ? ZodOptionalV4<T>\n : never;\n\nexport type InteropZodObjectShape<\n T extends InteropZodObject = InteropZodObject,\n> =\n T extends z3.ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : T extends z4.$ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : T extends z4Classic.ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : T extends zodMain.ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : never;\n\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> =\n T extends z3.ZodType<unknown, z3.ZodTypeDef, infer Input>\n ? Input\n : T extends z4.$ZodType<unknown, infer Input>\n ? Input\n : T extends { _zod: { input: infer Input } }\n ? Input\n : never;\n\nexport type InferInteropZodOutput<T> =\n T extends z3.ZodType<infer Output, z3.ZodTypeDef, unknown>\n ? Output\n : T extends z4.$ZodType<infer Output, unknown>\n ? Output\n : T extends { _zod: { output: infer Output } }\n ? Output\n : never;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\nexport function isZodSchemaV4(\n schema: unknown\n): schema is z4.$ZodType<unknown, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_zod\" in obj)) {\n return false;\n }\n\n const zod = obj._zod;\n return (\n typeof zod === \"object\" &&\n zod !== null &&\n \"def\" in (zod as Record<string, unknown>)\n );\n}\n\nexport function isZodSchemaV3(\n schema: unknown\n): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_def\" in obj) || \"_zod\" in obj) {\n return false;\n }\n\n const def = obj._def;\n return (\n typeof def === \"object\" &&\n def != null &&\n \"typeName\" in (def as Record<string, unknown>)\n );\n}\n\n/** Backward compatible isZodSchema for Zod 3 */\nexport function isZodSchema<\n RunOutput extends Record<string, unknown> = Record<string, unknown>,\n>(\n schema: z3.ZodType<RunOutput> | Record<string, unknown>\n): schema is z3.ZodType<RunOutput> {\n if (isZodSchemaV4(schema)) {\n console.warn(\n \"[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior.\"\n );\n }\n return isZodSchemaV3(schema);\n}\n\n/**\n * Given either a Zod schema, or plain object, determine if the input is a Zod schema.\n *\n * @param {unknown} input\n * @returns {boolean} Whether or not the provided input is a Zod schema.\n */\nexport function isInteropZodSchema(input: unknown): input is InteropZodType {\n if (!input) {\n return false;\n }\n if (typeof input !== \"object\") {\n return false;\n }\n if (Array.isArray(input)) {\n return false;\n }\n if (\n isZodSchemaV4(input) ||\n isZodSchemaV3(input as z3.ZodType<Record<string, unknown>>)\n ) {\n return true;\n }\n return false;\n}\n\nexport type InteropZodLiteral = z3.ZodLiteral<unknown> | z4.$ZodLiteral;\n\nexport function isZodLiteralV3(obj: unknown): obj is z3.ZodLiteral<unknown> {\n // Zod v3 literal schemas have _def.typeName === \"ZodLiteral\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodLiteral\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodLiteralV4(obj: unknown): obj is z4.$ZodLiteral {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 literal schemas have _zod.def.type === \"literal\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"literal\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.\n */\nexport function isInteropZodLiteral(obj: unknown): obj is InteropZodLiteral {\n if (isZodLiteralV3(obj)) return true;\n if (isZodLiteralV4(obj)) return true;\n return false;\n}\n\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.\n * This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<InteropZodSafeParseResult<T>>} A promise that resolves to a safe parse result object.\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopSafeParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<InteropZodSafeParseResult<T>> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = await parseAsync(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.safeParseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<T>} A promise that resolves to the parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<T> {\n if (isZodSchemaV4(schema)) {\n return await parseAsync(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.parseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object\n * indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {InteropZodSafeParseResult<T>} An object with either the parsed data (on success)\n * or the error (on failure).\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopSafeParse<T>(\n schema: InteropZodType<T>,\n input: unknown\n): InteropZodSafeParseResult<T> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = parse(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.safeParse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {T} The parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopParse<T>(schema: InteropZodType<T>, input: unknown): T {\n if (isZodSchemaV4(schema)) {\n return parse(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.parse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Retrieves the description from a schema definition (v3, v4, standard schema, or plain object), if available.\n *\n * @param {unknown} schema - The schema to extract the description from.\n * @returns {string | undefined} The description of the schema, or undefined if not present.\n */\nexport function getSchemaDescription(\n schema: SerializableSchema | InteropZodType<unknown> | Record<string, unknown>\n): string | undefined {\n if (isZodSchemaV4(schema)) {\n return globalRegistry.get(schema)?.description;\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return (schema as z3.ZodType<Record<string, unknown>>).description;\n }\n if (\"description\" in schema && typeof schema.description === \"string\") {\n return schema.description;\n }\n return undefined;\n}\n\n/**\n * Determines if the provided Zod schema is \"shapeless\".\n * A shapeless schema is one that does not define any object shape,\n * such as ZodString, ZodNumber, ZodBoolean, ZodAny, etc.\n * For ZodObject, it must have no shape keys to be considered shapeless.\n * ZodRecord schemas are considered shapeless since they define dynamic\n * key-value mappings without fixed keys.\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is shapeless, false otherwise.\n */\nexport function isShapelessZodSchema(schema: unknown): boolean {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // Check for v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // ZodObject is only shaped if it has actual shape keys\n if (def.typeName === \"ZodObject\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // ZodRecord is shapeless (dynamic key-value mapping)\n if (def.typeName === \"ZodRecord\") {\n return true;\n }\n }\n\n // Check for v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Object type is only shaped if it has actual shape keys\n if (def.type === \"object\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // Record type is shapeless (dynamic key-value mapping)\n if (def.type === \"record\") {\n return true;\n }\n }\n\n // For other schemas, check if they have a `shape` property\n // If they don't have shape, they're likely shapeless\n if (typeof schema === \"object\" && schema !== null && !(\"shape\" in schema)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determines if the provided Zod schema should be treated as a simple string schema\n * that maps to DynamicTool. This aligns with the type-level constraint of\n * InteropZodType<string | undefined> which only matches basic string schemas.\n * If the provided schema is just z.string(), we can make the determination that\n * the tool is just a generic string tool that doesn't require any input validation.\n *\n * This function only returns true for basic ZodString schemas, including:\n * - Basic string schemas (z.string())\n * - String schemas with validations (z.string().min(1), z.string().email(), etc.)\n *\n * This function returns false for everything else, including:\n * - String schemas with defaults (z.string().default(\"value\"))\n * - Branded string schemas (z.string().brand<\"UserId\">())\n * - String schemas with catch operations (z.string().catch(\"default\"))\n * - Optional/nullable string schemas (z.string().optional())\n * - Transformed schemas (z.string().transform() or z.object().transform())\n * - Object or record schemas, even if they're empty\n * - Any other schema type\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is a basic ZodString, false otherwise.\n */\nexport function isSimpleStringZodSchema(\n schema: unknown\n): schema is InteropZodType<string | undefined> {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // For v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // Only accept basic ZodString\n return def.typeName === \"ZodString\";\n }\n\n // For v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Only accept basic string type\n return def.type === \"string\";\n }\n\n return false;\n}\n\nexport function isZodObjectV3(obj: unknown): obj is ZodObjectV3 {\n // Zod v3 object schemas have _def.typeName === \"ZodObject\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodObject\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodObjectV4(obj: unknown): obj is z4.$ZodObject {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 object schemas have _zod.def.type === \"object\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"object\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodArrayV4(obj: unknown): obj is z4.$ZodArray {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 array schemas have _zod.def.type === \"array\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"array\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodOptionalV4(obj: unknown): obj is z4.$ZodOptional {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 optional schemas have _zod.def.type === \"optional\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"optional\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodNullableV4(obj: unknown): obj is z4.$ZodNullable {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 nullable schemas have _zod.def.type === \"nullable\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"nullable\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 object schema, false otherwise.\n */\nexport function isInteropZodObject(obj: unknown): obj is InteropZodObject {\n if (isZodObjectV3(obj)) return true;\n if (isZodObjectV4(obj)) return true;\n return false;\n}\n\n/**\n * Retrieves the shape (fields) of a Zod object schema, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObjectShape<T>} The shape of the object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function getInteropZodObjectShape<T extends InteropZodObject>(\n schema: T\n): InteropZodObjectShape<T> {\n if (isZodSchemaV3(schema)) {\n return schema.shape;\n }\n if (isZodSchemaV4(schema)) {\n return schema._zod.def.shape as InteropZodObjectShape<T>;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Extends a Zod object schema with additional fields, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {InteropZodObjectShape} extension - The fields to add to the schema.\n * @returns {InteropZodObject} The extended Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function extendInteropZodObject<T extends InteropZodObject>(\n schema: T,\n extension: InteropZodObjectShape\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n return schema.extend(extension as z3.ZodRawShape);\n }\n if (isZodSchemaV4(schema)) {\n return util.extend(schema, extension);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a partial version of a Zod object schema, making all fields optional.\n * Supports both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObject} The partial Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPartial<T extends InteropZodObject>(\n schema: T\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // z3: .partial() exists and works as expected\n return schema.partial();\n }\n if (isZodSchemaV4(schema)) {\n // z4: util.partial exists and works as expected\n return util.partial($ZodOptional, schema, undefined);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a strict version of a Zod object schema, disallowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies strictness\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply strictness recursively to nested objects/arrays.\n * @returns {InteropZodObject} The strict Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectStrict<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.strict();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it strict\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectStrict(keySchema, recursive);\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema strict if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectStrict(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _never($ZodNever),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a passthrough version of a Zod object schema, allowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies passthrough\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply passthrough recursively to nested objects/arrays.\n * @returns {InteropZodObject} The passthrough Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPassthrough<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodObjectV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.passthrough();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it passthrough\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectPassthrough(\n keySchema,\n recursive\n );\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema passthrough if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectPassthrough(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _unknown($ZodUnknown),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a getter function for the default value of a Zod schema, if one is defined.\n * Supports both Zod v3 and v4 schemas. If the schema has a default value,\n * the returned function will return that value when called. If no default is defined,\n * returns undefined.\n *\n * @template T - The type of the Zod schema.\n * @param {T} schema - The Zod schema instance (either v3 or v4).\n * @returns {(() => InferInteropZodOutput<T>) | undefined} A function that returns the default value, or undefined if no default is set.\n */\nexport function getInteropZodDefaultGetter<T extends InteropZodType>(\n schema: T\n): (() => InferInteropZodOutput<T>) | undefined {\n if (isZodSchemaV3(schema)) {\n try {\n const defaultValue = schema.parse(undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n if (isZodSchemaV4(schema)) {\n try {\n const defaultValue = parse(schema, undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction isZodTransformV3(\n schema: InteropZodType\n): schema is z3.ZodEffects<z3.ZodTypeAny> {\n return (\n isZodSchemaV3(schema) &&\n \"typeName\" in schema._def &&\n schema._def.typeName === \"ZodEffects\"\n );\n}\n\nfunction isZodTransformV4(schema: InteropZodType): schema is z4.$ZodPipe {\n return isZodSchemaV4(schema) && schema._zod.def.type === \"pipe\";\n}\n\nfunction interopZodTransformInputSchemaImpl(\n schema: InteropZodType,\n recursive: boolean,\n cache: WeakMap<InteropZodType, InteropZodType>\n): InteropZodType {\n const cached = cache.get(schema);\n if (cached !== undefined) {\n return cached;\n }\n\n // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchemaImpl(\n schema._def.schema,\n recursive,\n cache\n );\n }\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema;\n }\n\n // Zod v4: _def.type is the input schema for ZodEffects (transform)\n if (isZodSchemaV4(schema)) {\n let outputSchema: InteropZodType = schema;\n if (isZodTransformV4(schema)) {\n outputSchema = interopZodTransformInputSchemaImpl(\n schema._zod.def.in,\n recursive,\n cache\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n const outputShape: Mutable<z4.$ZodShape> = {};\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchemaImpl(\n keySchema,\n recursive,\n cache\n ) as z4.$ZodType;\n }\n outputSchema = clone<ZodObjectV4>(outputSchema, {\n ...outputSchema._zod.def,\n shape: outputShape,\n });\n }\n // Handle nested array schemas\n else if (isZodArrayV4(outputSchema)) {\n const elementSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.element,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodArray>(outputSchema, {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n });\n }\n // Handle optional schemas\n else if (isZodOptionalV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodOptional>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n // Handle nullable schemas\n else if (isZodNullableV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodNullable>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n }\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n cache.set(schema, outputSchema);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Returns the input type of a Zod transform schema, for both v3 and v4.\n * If the schema is not a transform, returns undefined. If `recursive` is true,\n * recursively processes nested object schemas and arrays of object schemas.\n *\n * @param schema - The Zod schema instance (v3 or v4)\n * @param {boolean} [recursive=false] - Whether to recursively process nested objects/arrays.\n * @returns The input Zod schema of the transform, or undefined if not a transform\n */\nexport function interopZodTransformInputSchema(\n schema: InteropZodType,\n recursive = false\n): InteropZodType {\n const cache = new WeakMap<InteropZodType, InteropZodType>();\n return interopZodTransformInputSchemaImpl(schema, recursive, cache);\n}\n\n/**\n * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.\n * Supports both Zod v3 and v4 schemas and preserves the original schema version.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.\n * @returns {InteropZodObject} The modified Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(\n schema: T,\n predicate: (key: string, value: InteropZodType) => boolean\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const modifiedShape: Record<string, z3.ZodTypeAny> = {};\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v3 methods\n modifiedShape[key] = (value as z3.ZodTypeAny).optional();\n } else {\n // Keep field as-is\n modifiedShape[key] = value;\n }\n }\n\n // Use v3's extend method to create a new schema with the modified shape\n return schema.extend(modifiedShape as z3.ZodRawShape);\n }\n\n if (isZodSchemaV4(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const outputShape: Mutable<z4.$ZodShape> = { ...schema._zod.def.shape };\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v4 methods\n outputShape[key] = new $ZodOptional({\n type: \"optional\" as const,\n innerType: value as z4.$ZodType,\n });\n }\n // Otherwise keep the field as-is (already in outputShape)\n }\n\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n });\n\n // Preserve metadata\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n\n return modifiedSchema;\n }\n\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\nexport function isInteropZodError(e: unknown) {\n return (\n // eslint-disable-next-line no-instanceof/no-instanceof\n e instanceof Error &&\n (e.constructor.name === \"ZodError\" || e.constructor.name === \"$ZodError\")\n );\n}\n"],"mappings":";;;AA6GA,SAAgB,cACd,QACyC;AACzC,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,KACd,QAAO;CAGT,MAAM,MAAM,IAAI;AAChB,QACE,OAAO,QAAQ,YACf,QAAQ,QACR,SAAU;;AAId,SAAgB,cACd,QACuD;AACvD,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,QAAQ,UAAU,IAChC,QAAO;CAGT,MAAM,MAAM,IAAI;AAChB,QACE,OAAO,QAAQ,YACf,OAAO,QACP,cAAe;;;AAKnB,SAAgB,YAGd,QACiC;AACjC,KAAI,cAAc,OAAO,CACvB,SAAQ,KACN,4HACD;AAEH,QAAO,cAAc,OAAO;;;;;;;;AAS9B,SAAgB,mBAAmB,OAAyC;AAC1E,KAAI,CAAC,MACH,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO;AAET,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO;AAET,KACE,cAAc,MAAM,IACpB,cAAc,MAA6C,CAE3D,QAAO;AAET,QAAO;;AAKT,SAAgB,eAAe,KAA6C;AAE1E,KACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,OAAO,IAAI,SAAS,YACpB,IAAI,SAAS,QACb,cAAc,IAAI,QAClB,IAAI,KAAK,aAAa,aAEtB,QAA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AAgC;;AAGvD,KAAI,cAAc,OAAO,EAAE;EACzB,MAAM,QAAQ,yBAAyB,OAAO;EAC9C,MAAM,cAAqC,EAAE,GAAG,OAAO,KAAK,IAAI,OAAO;AAEvE,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,KAAK,MAAM,CAEvB,aAAY,OAAO,IAAIE,YAAAA,aAAa;GAClC,MAAM;GACN,WAAW;GACZ,CAAC;EAKN,MAAM,kBAAA,GAAA,YAAA,OAAoC,QAAQ;GAChD,GAAG,OAAO,KAAK;GACf,OAAO;GACR,CAAC;EAGF,MAAM,OAAOF,YAAAA,eAAe,IAAI,OAAO;AACvC,MAAI,KAAM,aAAA,eAAe,IAAI,gBAAgB,KAAK;AAElD,SAAO;;AAGT,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,kBAAkB,GAAY;AAC5C,QAEE,aAAa,UACZ,EAAE,YAAY,SAAS,cAAc,EAAE,YAAY,SAAS"}
|
|
1
|
+
{"version":3,"file":"zod.cjs","names":["globalRegistry","util","$ZodOptional","$ZodNever","$ZodUnknown"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport {\n parse,\n parseAsync,\n globalRegistry,\n util,\n clone,\n _unknown,\n _never,\n $ZodUnknown,\n $ZodNever,\n $ZodOptional,\n} from \"zod/v4/core\";\n\n// Internal-only type import – used for casts inside function bodies.\n// Never appears in exported type signatures, so it won't leak into\n// downstream .d.ts files or trigger cross-version structural comparisons.\nimport type * as z4 from \"zod/v4/core\";\n\nimport { SerializableSchema } from \"../standard_schema.js\";\n\n// @langchain/core's public API exposes types like `InteropZodType` (a union\n// of Zod v3 and v4 schema types) in function signatures, class properties,\n// and generic constraints. When those types were defined in terms of the\n// *real* Zod type imports (`z3.ZodType`, `z4.$ZodType`), they worked fine as\n// long as every package in the workspace resolved the exact same Zod version.\n//\n// In practice that assumption breaks. Zod 4 re-exports Zod 3 under\n// `zod/v3`, but different packages can still resolve to different *copies*\n// of Zod (e.g. `zod@3.25.x` vs `zod@4.x`) depending on their own lockfile\n// or hoisting. When that happens, TypeScript sees two structurally-similar\n// but *nominally-different* types and falls back to a full structural\n// comparison.\n//\n// The real Zod types are massive: ~3,400+ lines of deeply-nested,\n// mutually-recursive generics (`ZodType` → `ZodTypeDef` → `ZodEffects` →\n// `ZodType` → …). A structural comparison walks every branch of this tree\n// for *every* callsite that touches an `InteropZodType`. In a large\n// monorepo this quickly causes:\n//\n// • The TypeScript language server becoming unresponsive\n// • `tsc` exhausting the default heap and OOM-ing\n// • \"Type instantiation is excessively deep and possibly infinite\" errors\n//\n// We replace every Zod type that appears in an *exported* signature with the\n// minimal structural interface defined below. Each interface captures only\n// the properties that @langchain/core actually reads at runtime (e.g.\n// `_type`, `_output`, `_def`, `parse`, `_zod.def.type`, etc.).\n//\n// Because these interfaces are plain object shapes with no imports from the\n// `zod` package, TypeScript can check assignability in O(1) — there is\n// nothing recursive to walk. A real `z3.ZodString` or `z4.$ZodString` is\n// still assignable to `ZodV3Like<string>` or `ZodV4Like<string>` (they have\n// the required properties), so call-site compatibility is preserved.\n\nexport interface ZodV3TypeDef {\n typeName?: string;\n description?: string;\n [key: string]: any;\n}\n\nexport interface ZodV3Like<Output = any, Input = Output> {\n readonly _type: Output;\n readonly _output: Output;\n readonly _input: Input;\n readonly _def: ZodV3TypeDef;\n readonly description?: string;\n parse(data: unknown, params?: any): Output;\n safeParse(\n data: unknown,\n params?: any\n ): { success: boolean; data?: Output; error?: unknown };\n parseAsync(data: unknown, params?: any): Promise<Output>;\n safeParseAsync(\n data: unknown,\n params?: any\n ): Promise<{ success: boolean; data?: Output; error?: unknown }>;\n optional?(): ZodV3Like<Output | undefined, Input | undefined>;\n \"~standard\"?: any;\n}\n\nexport interface ZodV3ObjectLike extends ZodV3Like {\n readonly shape: Record<string, any>;\n extend(augmentation: Record<string, any>): ZodV3ObjectLike;\n partial(): ZodV3ObjectLike;\n strict(): ZodV3ObjectLike;\n passthrough(): ZodV3ObjectLike;\n}\n\nexport interface ZodV4Internals<O = any, I = any> {\n def: any;\n output: O;\n input: I;\n [key: string]: any;\n}\n\nexport interface ZodV4Like<Output = any, Input = Output> {\n _zod: ZodV4Internals<Output, Input>;\n \"~standard\"?: any;\n}\n\nexport interface ZodV4ObjectLike extends ZodV4Like {\n _zod: ZodV4Internals & {\n def: { type: \"object\"; shape: Record<string, any>; [key: string]: any };\n };\n}\n\nexport interface ZodV4ArrayLike extends ZodV4Like {\n _zod: ZodV4Internals & {\n def: { type: \"array\"; element: ZodV4Like; [key: string]: unknown };\n };\n}\n\nexport interface ZodV4OptionalLike extends ZodV4Like {\n _zod: ZodV4Internals & {\n def: { type: \"optional\"; innerType: ZodV4Like; [key: string]: unknown };\n };\n}\n\nexport interface ZodV4NullableLike extends ZodV4Like {\n _zod: ZodV4Internals & {\n def: { type: \"nullable\"; innerType: ZodV4Like; [key: string]: unknown };\n };\n}\n\nexport interface ZodV4PipeLike extends ZodV4Like {\n _zod: ZodV4Internals & {\n def: { type: \"pipe\"; in: InteropZodType; [key: string]: unknown };\n [key: string]: unknown;\n };\n}\n\nexport interface ZodV3EffectsLike extends ZodV3Like {\n _def: ZodV3TypeDef & {\n typeName: \"ZodEffects\";\n schema: InteropZodType;\n };\n}\n\n// Aliases\n\nexport type ZodStringV3 = ZodV3Like<string>;\nexport type ZodStringV4 = ZodV4Like<string, unknown>;\n\nexport type ZodObjectV3 = ZodV3ObjectLike;\nexport type ZodObjectV4 = ZodV4ObjectLike;\nexport type ZodObjectV4Classic = ZodV4ObjectLike;\nexport type ZodObjectMain = ZodV4ObjectLike;\n\nexport type ZodDefaultV3<T extends ZodV3Like> = ZodV3Like<\n T extends ZodV3Like<infer O, any> ? O : any\n>;\nexport type ZodDefaultV4<T extends ZodV4Like> = ZodV4Like<\n T extends ZodV4Like<infer O, any> ? O : any\n>;\nexport type ZodOptionalV3<T extends ZodV3Like> = ZodV3Like<\n T extends ZodV3Like<infer O, any> ? O | undefined : any\n>;\nexport type ZodOptionalV4<T extends ZodV4Like> = ZodV4Like<\n T extends ZodV4Like<infer O, any> ? O | undefined : any\n>;\nexport type ZodNullableV4<T extends ZodV4Like> = ZodV4Like<\n T extends ZodV4Like<infer O, any> ? O | null : any\n>;\n\n// Interop types\n\nexport type InteropZodType<Output = any, Input = Output> =\n | ZodV3Like<Output, Input>\n | ZodV4Like<Output, Input>;\n\nexport type InteropZodObject = ZodV3ObjectLike | ZodV4ObjectLike;\n\nexport type InteropZodDefault<T = InteropZodObject> = T extends ZodV3Like\n ? ZodDefaultV3<T>\n : T extends ZodV4Like\n ? ZodDefaultV4<T>\n : never;\n\nexport type InteropZodOptional<T = InteropZodObject> = T extends ZodV3Like\n ? ZodOptionalV3<T>\n : T extends ZodV4Like\n ? ZodOptionalV4<T>\n : never;\n\nexport type InteropZodObjectShape<\n T extends InteropZodObject = InteropZodObject,\n> = T extends ZodV3ObjectLike\n ? { [K in keyof T[\"shape\"]]: T[\"shape\"][K] }\n : T extends ZodV4ObjectLike\n ? { [K in keyof T[\"_zod\"][\"def\"][\"shape\"]]: T[\"_zod\"][\"def\"][\"shape\"][K] }\n : never;\n\nexport interface InteropZodIssue {\n message: string;\n path: (string | number)[];\n [key: string]: unknown;\n}\n\nexport type InferInteropZodInput<T> =\n T extends ZodV3Like<unknown, infer Input>\n ? Input\n : T extends ZodV4Like<unknown, infer Input>\n ? Input\n : T extends { _zod: { input: infer Input } }\n ? Input\n : never;\n\nexport type InferInteropZodOutput<T> =\n T extends ZodV3Like<infer Output, unknown>\n ? Output\n : T extends ZodV4Like<infer Output, unknown>\n ? Output\n : T extends { _zod: { output: infer Output } }\n ? Output\n : never;\n\nexport type InteropZodLiteral = ZodV3Like | ZodV4Like;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\nexport function isZodSchemaV4(\n schema: unknown\n): schema is ZodV4Like<unknown, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_zod\" in obj)) {\n return false;\n }\n\n const zod = obj._zod;\n return (\n typeof zod === \"object\" &&\n zod !== null &&\n \"def\" in (zod as Record<string, unknown>)\n );\n}\n\nexport function isZodSchemaV3(\n schema: unknown\n): schema is ZodV3Like<unknown, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_def\" in obj) || \"_zod\" in obj) {\n return false;\n }\n\n const def = obj._def;\n return (\n typeof def === \"object\" &&\n def != null &&\n \"typeName\" in (def as Record<string, unknown>)\n );\n}\n\n/** Backward compatible isZodSchema for Zod 3 */\nexport function isZodSchema<\n RunOutput extends Record<string, unknown> = Record<string, unknown>,\n>(\n schema: ZodV3Like<RunOutput> | Record<string, unknown>\n): schema is ZodV3Like<RunOutput> {\n if (isZodSchemaV4(schema)) {\n console.warn(\n \"[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior.\"\n );\n }\n return isZodSchemaV3(schema);\n}\n\n/**\n * Given either a Zod schema, or plain object, determine if the input is a Zod schema.\n *\n * @param {unknown} input\n * @returns {boolean} Whether or not the provided input is a Zod schema.\n */\nexport function isInteropZodSchema(input: unknown): input is InteropZodType {\n if (!input) {\n return false;\n }\n if (typeof input !== \"object\") {\n return false;\n }\n if (Array.isArray(input)) {\n return false;\n }\n if (isZodSchemaV4(input) || isZodSchemaV3(input)) {\n return true;\n }\n return false;\n}\n\nexport function isZodLiteralV3(obj: unknown): obj is ZodV3Like {\n // Zod v3 literal schemas have _def.typeName === \"ZodLiteral\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodLiteral\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodLiteralV4(obj: unknown): obj is ZodV4Like {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 literal schemas have _zod.def.type === \"literal\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"literal\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.\n */\nexport function isInteropZodLiteral(obj: unknown): obj is InteropZodLiteral {\n if (isZodLiteralV3(obj)) return true;\n if (isZodLiteralV4(obj)) return true;\n return false;\n}\n\nexport interface InteropZodError {\n issues: InteropZodIssue[];\n}\n\ntype InteropZodSafeParseResult<T> =\n | { success: true; data: T; error?: never }\n | { success: false; error: InteropZodError; data?: never };\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.\n * This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<InteropZodSafeParseResult<T>>} A promise that resolves to a safe parse result object.\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopSafeParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<InteropZodSafeParseResult<T>> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = await parseAsync(schema as z4.$ZodType<T>, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as InteropZodError,\n };\n }\n }\n if (isZodSchemaV3(schema)) {\n return (await schema.safeParseAsync(input)) as InteropZodSafeParseResult<T>;\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<T>} A promise that resolves to the parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<T> {\n if (isZodSchemaV4(schema)) {\n return await parseAsync(schema as z4.$ZodType<T>, input);\n }\n if (isZodSchemaV3(schema)) {\n return await schema.parseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object\n * indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {InteropZodSafeParseResult<T>} An object with either the parsed data (on success)\n * or the error (on failure).\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopSafeParse<T>(\n schema: InteropZodType<T>,\n input: unknown\n): InteropZodSafeParseResult<T> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = parse(schema as z4.$ZodType<T>, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as InteropZodError,\n };\n }\n }\n if (isZodSchemaV3(schema)) {\n return schema.safeParse(input) as InteropZodSafeParseResult<T>;\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {T} The parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopParse<T>(schema: InteropZodType<T>, input: unknown): T {\n if (isZodSchemaV4(schema)) {\n return parse(schema as z4.$ZodType<T>, input);\n }\n if (isZodSchemaV3(schema)) {\n return schema.parse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Retrieves the description from a schema definition (v3, v4, standard schema, or plain object), if available.\n *\n * @param {unknown} schema - The schema to extract the description from.\n * @returns {string | undefined} The description of the schema, or undefined if not present.\n */\nexport function getSchemaDescription(\n schema: SerializableSchema | InteropZodType<unknown> | Record<string, unknown>\n): string | undefined {\n if (isZodSchemaV4(schema)) {\n return globalRegistry.get(schema as z4.$ZodType)?.description;\n }\n if (isZodSchemaV3(schema)) {\n return schema.description;\n }\n if (\"description\" in schema && typeof schema.description === \"string\") {\n return schema.description;\n }\n return undefined;\n}\n\n/**\n * Determines if the provided Zod schema is \"shapeless\".\n * A shapeless schema is one that does not define any object shape,\n * such as ZodString, ZodNumber, ZodBoolean, ZodAny, etc.\n * For ZodObject, it must have no shape keys to be considered shapeless.\n * ZodRecord schemas are considered shapeless since they define dynamic\n * key-value mappings without fixed keys.\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is shapeless, false otherwise.\n */\nexport function isShapelessZodSchema(schema: unknown): boolean {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // Check for v3 schemas\n if (isZodSchemaV3(schema)) {\n const def = schema._def;\n\n // ZodObject is only shaped if it has actual shape keys\n if (def.typeName === \"ZodObject\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // ZodRecord is shapeless (dynamic key-value mapping)\n if (def.typeName === \"ZodRecord\") {\n return true;\n }\n }\n\n // Check for v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Object type is only shaped if it has actual shape keys\n if (def.type === \"object\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // Record type is shapeless (dynamic key-value mapping)\n if (def.type === \"record\") {\n return true;\n }\n }\n\n // For other schemas, check if they have a `shape` property\n // If they don't have shape, they're likely shapeless\n if (typeof schema === \"object\" && schema !== null && !(\"shape\" in schema)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determines if the provided Zod schema should be treated as a simple string schema\n * that maps to DynamicTool. This aligns with the type-level constraint of\n * InteropZodType<string | undefined> which only matches basic string schemas.\n * If the provided schema is just z.string(), we can make the determination that\n * the tool is just a generic string tool that doesn't require any input validation.\n *\n * This function only returns true for basic ZodString schemas, including:\n * - Basic string schemas (z.string())\n * - String schemas with validations (z.string().min(1), z.string().email(), etc.)\n *\n * This function returns false for everything else, including:\n * - String schemas with defaults (z.string().default(\"value\"))\n * - Branded string schemas (z.string().brand<\"UserId\">())\n * - String schemas with catch operations (z.string().catch(\"default\"))\n * - Optional/nullable string schemas (z.string().optional())\n * - Transformed schemas (z.string().transform() or z.object().transform())\n * - Object or record schemas, even if they're empty\n * - Any other schema type\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is a basic ZodString, false otherwise.\n */\nexport function isSimpleStringZodSchema(\n schema: unknown\n): schema is InteropZodType<string | undefined> {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // For v3 schemas\n if (isZodSchemaV3(schema)) {\n const def = schema._def;\n\n // Only accept basic ZodString\n return def.typeName === \"ZodString\";\n }\n\n // For v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Only accept basic string type\n return def.type === \"string\";\n }\n\n return false;\n}\n\nexport function isZodObjectV3(obj: unknown): obj is ZodObjectV3 {\n // Zod v3 object schemas have _def.typeName === \"ZodObject\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodObject\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodObjectV4(obj: unknown): obj is ZodV4ObjectLike {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 object schemas have _zod.def.type === \"object\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"object\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodArrayV4(obj: unknown): obj is ZodV4ArrayLike {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 array schemas have _zod.def.type === \"array\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"array\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodOptionalV4(obj: unknown): obj is ZodV4OptionalLike {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 optional schemas have _zod.def.type === \"optional\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"optional\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodNullableV4(obj: unknown): obj is ZodV4NullableLike {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 nullable schemas have _zod.def.type === \"nullable\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"nullable\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 object schema, false otherwise.\n */\nexport function isInteropZodObject(obj: unknown): obj is InteropZodObject {\n if (isZodObjectV3(obj)) return true;\n if (isZodObjectV4(obj)) return true;\n return false;\n}\n\n/**\n * Retrieves the shape (fields) of a Zod object schema, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObjectShape<T>} The shape of the object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function getInteropZodObjectShape<T extends InteropZodObject>(\n schema: T\n): InteropZodObjectShape<T> {\n if (isZodSchemaV3(schema)) {\n return schema.shape as InteropZodObjectShape<T>;\n }\n if (isZodSchemaV4(schema)) {\n return schema._zod.def.shape as InteropZodObjectShape<T>;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Extends a Zod object schema with additional fields, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {InteropZodObjectShape} extension - The fields to add to the schema.\n * @returns {InteropZodObject} The extended Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function extendInteropZodObject<T extends InteropZodObject>(\n schema: T,\n extension: InteropZodObjectShape\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n return schema.extend(extension);\n }\n if (isZodSchemaV4(schema)) {\n return util.extend(schema as z4.$ZodObject, extension);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a partial version of a Zod object schema, making all fields optional.\n * Supports both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObject} The partial Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPartial<T extends InteropZodObject>(\n schema: T\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // z3: .partial() exists and works as expected\n return schema.partial();\n }\n if (isZodSchemaV4(schema)) {\n // z4: util.partial exists and works as expected\n return util.partial($ZodOptional, schema as z4.$ZodObject, undefined);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a strict version of a Zod object schema, disallowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies strictness\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply strictness recursively to nested objects/arrays.\n * @returns {InteropZodObject} The strict Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectStrict<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodObjectV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.strict();\n }\n if (isZodObjectV4(schema)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputShape: Record<string, any> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it strict\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectStrict(keySchema, recursive);\n outputShape[key] = outputSchema;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema strict if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectStrict(elementSchema, recursive);\n }\n outputShape[key] = clone(keySchema as unknown as z4.$ZodType, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema as z4.$ZodType);\n if (meta) globalRegistry.add(outputShape[key] as z4.$ZodType, meta);\n }\n }\n const modifiedSchema = clone<z4.$ZodObject>(schema as z4.$ZodObject, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _never($ZodNever),\n });\n const meta = globalRegistry.get(schema as unknown as z4.$ZodType);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a passthrough version of a Zod object schema, allowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies passthrough\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply passthrough recursively to nested objects/arrays.\n * @returns {InteropZodObject} The passthrough Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPassthrough<T extends InteropZodObject>(\n schema: T,\n recursive: boolean = false\n): InteropZodObject {\n if (isZodObjectV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.passthrough();\n }\n if (isZodObjectV4(schema)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputShape: Record<string, any> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it passthrough\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectPassthrough(\n keySchema,\n recursive\n );\n outputShape[key] = outputSchema;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema passthrough if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectPassthrough(\n elementSchema,\n recursive\n ) as ZodV4ObjectLike;\n }\n outputShape[key] = clone(keySchema as unknown as z4.$ZodType, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema as z4.$ZodType);\n if (meta) globalRegistry.add(outputShape[key] as z4.$ZodType, meta);\n }\n }\n const modifiedSchema = clone<z4.$ZodObject>(schema as z4.$ZodObject, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _unknown($ZodUnknown),\n });\n const meta = globalRegistry.get(schema as unknown as z4.$ZodType);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema as InteropZodObject;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a getter function for the default value of a Zod schema, if one is defined.\n * Supports both Zod v3 and v4 schemas. If the schema has a default value,\n * the returned function will return that value when called. If no default is defined,\n * returns undefined.\n *\n * @template T - The type of the Zod schema.\n * @param {T} schema - The Zod schema instance (either v3 or v4).\n * @returns {(() => InferInteropZodOutput<T>) | undefined} A function that returns the default value, or undefined if no default is set.\n */\nexport function getInteropZodDefaultGetter<T extends InteropZodType>(\n schema: T\n): (() => InferInteropZodOutput<T>) | undefined {\n if (isZodSchemaV3(schema)) {\n try {\n const defaultValue = schema.parse(undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n if (isZodSchemaV4(schema)) {\n try {\n const defaultValue = parse(schema as z4.$ZodType, undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction isZodTransformV3(schema: InteropZodType): schema is ZodV3EffectsLike {\n return (\n isZodSchemaV3(schema) &&\n \"typeName\" in schema._def &&\n schema._def.typeName === \"ZodEffects\"\n );\n}\n\nfunction isZodTransformV4(schema: InteropZodType): schema is ZodV4PipeLike {\n return isZodSchemaV4(schema) && schema._zod.def.type === \"pipe\";\n}\n\nfunction interopZodTransformInputSchemaImpl(\n schema: InteropZodType,\n recursive: boolean,\n cache: WeakMap<InteropZodType, InteropZodType>\n): InteropZodType {\n const cached = cache.get(schema);\n if (cached !== undefined) {\n return cached;\n }\n\n // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchemaImpl(\n schema._def.schema,\n recursive,\n cache\n );\n }\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema;\n }\n\n // Zod v4: _def.type is the input schema for ZodEffects (transform)\n if (isZodSchemaV4(schema)) {\n let outputSchema: InteropZodType = schema;\n if (isZodTransformV4(schema)) {\n outputSchema = interopZodTransformInputSchemaImpl(\n schema._zod.def.in,\n recursive,\n cache\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputShape: Record<string, any> = {};\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchemaImpl(\n keySchema as InteropZodType,\n recursive,\n cache\n );\n }\n outputSchema = clone<z4.$ZodObject>(outputSchema as z4.$ZodObject, {\n ...outputSchema._zod.def,\n shape: outputShape,\n }) as InteropZodType;\n }\n // Handle nested array schemas\n else if (isZodArrayV4(outputSchema)) {\n const elementSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.element as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodArray>(\n outputSchema as unknown as z4.$ZodArray,\n {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n }\n ) as InteropZodType;\n }\n // Handle optional schemas\n else if (isZodOptionalV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodOptional>(\n outputSchema as unknown as z4.$ZodOptional,\n {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n }\n ) as InteropZodType;\n }\n // Handle nullable schemas\n else if (isZodNullableV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodNullable>(\n outputSchema as unknown as z4.$ZodNullable,\n {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n }\n ) as InteropZodType;\n }\n }\n const meta = globalRegistry.get(schema as z4.$ZodType);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n cache.set(schema, outputSchema);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Returns the input type of a Zod transform schema, for both v3 and v4.\n * If the schema is not a transform, returns undefined. If `recursive` is true,\n * recursively processes nested object schemas and arrays of object schemas.\n *\n * @param schema - The Zod schema instance (v3 or v4)\n * @param {boolean} [recursive=false] - Whether to recursively process nested objects/arrays.\n * @returns The input Zod schema of the transform, or undefined if not a transform\n */\nexport function interopZodTransformInputSchema(\n schema: InteropZodType,\n recursive = false\n): InteropZodType {\n const cache = new WeakMap<InteropZodType, InteropZodType>();\n return interopZodTransformInputSchemaImpl(schema, recursive, cache);\n}\n\n/**\n * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.\n * Supports both Zod v3 and v4 schemas and preserves the original schema version.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.\n * @returns {InteropZodObject} The modified Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(\n schema: T,\n predicate: (key: string, value: InteropZodType) => boolean\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n const shape = getInteropZodObjectShape(schema as InteropZodObject);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const modifiedShape: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value as InteropZodType)) {\n // Make this field optional using v3 methods\n modifiedShape[key] = value.optional();\n } else {\n // Keep field as-is\n modifiedShape[key] = value;\n }\n }\n\n // Use v3's extend method to create a new schema with the modified shape\n return schema.extend(modifiedShape) as InteropZodObject;\n }\n\n if (isZodSchemaV4(schema)) {\n const shape = getInteropZodObjectShape(schema as InteropZodObject);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputShape: Record<string, any> = {\n ...schema._zod.def.shape,\n };\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value as InteropZodType)) {\n // Make this field optional using v4 methods\n outputShape[key] = new $ZodOptional({\n type: \"optional\" as const,\n innerType: value as z4.$ZodType,\n });\n }\n // Otherwise keep the field as-is (already in outputShape)\n }\n\n const modifiedSchema = clone<z4.$ZodObject>(schema as z4.$ZodObject, {\n ...schema._zod.def,\n shape: outputShape,\n });\n\n // Preserve metadata\n const meta = globalRegistry.get(schema as unknown as z4.$ZodType);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n\n return modifiedSchema as InteropZodObject;\n }\n\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\nexport function isInteropZodError(e: unknown) {\n return (\n // eslint-disable-next-line no-instanceof/no-instanceof\n e instanceof Error &&\n (e.constructor.name === \"ZodError\" || e.constructor.name === \"$ZodError\")\n );\n}\n"],"mappings":";;;AAgOA,SAAgB,cACd,QACuC;AACvC,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU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AAK;AAElD,SAAO;;AAGT,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,kBAAkB,GAAY;AAC5C,QAEE,aAAa,UACZ,EAAE,YAAY,SAAS,cAAc,EAAE,YAAY,SAAS"}
|
|
@@ -1,42 +1,138 @@
|
|
|
1
1
|
import { SerializableSchema } from "../standard_schema.cjs";
|
|
2
|
-
import * as z3 from "zod/v3";
|
|
3
|
-
import * as z4 from "zod/v4/core";
|
|
4
|
-
import * as z4Classic from "zod/v4";
|
|
5
|
-
import * as zodMain from "zod";
|
|
6
2
|
|
|
7
3
|
//#region src/utils/types/zod.d.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
interface ZodV3TypeDef {
|
|
5
|
+
typeName?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
interface ZodV3Like<Output = any, Input = Output> {
|
|
10
|
+
readonly _type: Output;
|
|
11
|
+
readonly _output: Output;
|
|
12
|
+
readonly _input: Input;
|
|
13
|
+
readonly _def: ZodV3TypeDef;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
parse(data: unknown, params?: any): Output;
|
|
16
|
+
safeParse(data: unknown, params?: any): {
|
|
17
|
+
success: boolean;
|
|
18
|
+
data?: Output;
|
|
19
|
+
error?: unknown;
|
|
20
|
+
};
|
|
21
|
+
parseAsync(data: unknown, params?: any): Promise<Output>;
|
|
22
|
+
safeParseAsync(data: unknown, params?: any): Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
data?: Output;
|
|
25
|
+
error?: unknown;
|
|
26
|
+
}>;
|
|
27
|
+
optional?(): ZodV3Like<Output | undefined, Input | undefined>;
|
|
28
|
+
"~standard"?: any;
|
|
29
|
+
}
|
|
30
|
+
interface ZodV3ObjectLike extends ZodV3Like {
|
|
31
|
+
readonly shape: Record<string, any>;
|
|
32
|
+
extend(augmentation: Record<string, any>): ZodV3ObjectLike;
|
|
33
|
+
partial(): ZodV3ObjectLike;
|
|
34
|
+
strict(): ZodV3ObjectLike;
|
|
35
|
+
passthrough(): ZodV3ObjectLike;
|
|
36
|
+
}
|
|
37
|
+
interface ZodV4Internals<O = any, I = any> {
|
|
38
|
+
def: any;
|
|
39
|
+
output: O;
|
|
40
|
+
input: I;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
interface ZodV4Like<Output = any, Input = Output> {
|
|
44
|
+
_zod: ZodV4Internals<Output, Input>;
|
|
45
|
+
"~standard"?: any;
|
|
46
|
+
}
|
|
47
|
+
interface ZodV4ObjectLike extends ZodV4Like {
|
|
48
|
+
_zod: ZodV4Internals & {
|
|
49
|
+
def: {
|
|
50
|
+
type: "object";
|
|
51
|
+
shape: Record<string, any>;
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface ZodV4ArrayLike extends ZodV4Like {
|
|
57
|
+
_zod: ZodV4Internals & {
|
|
58
|
+
def: {
|
|
59
|
+
type: "array";
|
|
60
|
+
element: ZodV4Like;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface ZodV4OptionalLike extends ZodV4Like {
|
|
66
|
+
_zod: ZodV4Internals & {
|
|
67
|
+
def: {
|
|
68
|
+
type: "optional";
|
|
69
|
+
innerType: ZodV4Like;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
interface ZodV4NullableLike extends ZodV4Like {
|
|
75
|
+
_zod: ZodV4Internals & {
|
|
76
|
+
def: {
|
|
77
|
+
type: "nullable";
|
|
78
|
+
innerType: ZodV4Like;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface ZodV4PipeLike extends ZodV4Like {
|
|
84
|
+
_zod: ZodV4Internals & {
|
|
85
|
+
def: {
|
|
86
|
+
type: "pipe";
|
|
87
|
+
in: InteropZodType;
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
interface ZodV3EffectsLike extends ZodV3Like {
|
|
94
|
+
_def: ZodV3TypeDef & {
|
|
95
|
+
typeName: "ZodEffects";
|
|
96
|
+
schema: InteropZodType;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
type ZodStringV3 = ZodV3Like<string>;
|
|
100
|
+
type ZodStringV4 = ZodV4Like<string, unknown>;
|
|
101
|
+
type ZodObjectV3 = ZodV3ObjectLike;
|
|
102
|
+
type ZodObjectV4 = ZodV4ObjectLike;
|
|
103
|
+
type ZodObjectV4Classic = ZodV4ObjectLike;
|
|
104
|
+
type ZodObjectMain = ZodV4ObjectLike;
|
|
105
|
+
type ZodDefaultV3<T extends ZodV3Like> = ZodV3Like<T extends ZodV3Like<infer O, any> ? O : any>;
|
|
106
|
+
type ZodDefaultV4<T extends ZodV4Like> = ZodV4Like<T extends ZodV4Like<infer O, any> ? O : any>;
|
|
107
|
+
type ZodOptionalV3<T extends ZodV3Like> = ZodV3Like<T extends ZodV3Like<infer O, any> ? O | undefined : any>;
|
|
108
|
+
type ZodOptionalV4<T extends ZodV4Like> = ZodV4Like<T extends ZodV4Like<infer O, any> ? O | undefined : any>;
|
|
109
|
+
type ZodNullableV4<T extends ZodV4Like> = ZodV4Like<T extends ZodV4Like<infer O, any> ? O | null : any>;
|
|
110
|
+
type InteropZodType<Output = any, Input = Output> = ZodV3Like<Output, Input> | ZodV4Like<Output, Input>;
|
|
111
|
+
type InteropZodObject = ZodV3ObjectLike | ZodV4ObjectLike;
|
|
112
|
+
type InteropZodDefault<T = InteropZodObject> = T extends ZodV3Like ? ZodDefaultV3<T> : T extends ZodV4Like ? ZodDefaultV4<T> : never;
|
|
113
|
+
type InteropZodOptional<T = InteropZodObject> = T extends ZodV3Like ? ZodOptionalV3<T> : T extends ZodV4Like ? ZodOptionalV4<T> : never;
|
|
114
|
+
type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = T extends ZodV3ObjectLike ? { [K in keyof T["shape"]]: T["shape"][K] } : T extends ZodV4ObjectLike ? { [K in keyof T["_zod"]["def"]["shape"]]: T["_zod"]["def"]["shape"][K] } : never;
|
|
115
|
+
interface InteropZodIssue {
|
|
116
|
+
message: string;
|
|
117
|
+
path: (string | number)[];
|
|
118
|
+
[key: string]: unknown;
|
|
119
|
+
}
|
|
120
|
+
type InferInteropZodInput<T> = T extends ZodV3Like<unknown, infer Input> ? Input : T extends ZodV4Like<unknown, infer Input> ? Input : T extends {
|
|
26
121
|
_zod: {
|
|
27
122
|
input: infer Input;
|
|
28
123
|
};
|
|
29
124
|
} ? Input : never;
|
|
30
|
-
type InferInteropZodOutput<T> = T extends
|
|
125
|
+
type InferInteropZodOutput<T> = T extends ZodV3Like<infer Output, unknown> ? Output : T extends ZodV4Like<infer Output, unknown> ? Output : T extends {
|
|
31
126
|
_zod: {
|
|
32
127
|
output: infer Output;
|
|
33
128
|
};
|
|
34
129
|
} ? Output : never;
|
|
130
|
+
type InteropZodLiteral = ZodV3Like | ZodV4Like;
|
|
35
131
|
type Mutable<T> = { -readonly [P in keyof T]: T[P] };
|
|
36
|
-
declare function isZodSchemaV4(schema: unknown): schema is
|
|
37
|
-
declare function isZodSchemaV3(schema: unknown): schema is
|
|
132
|
+
declare function isZodSchemaV4(schema: unknown): schema is ZodV4Like<unknown, unknown>;
|
|
133
|
+
declare function isZodSchemaV3(schema: unknown): schema is ZodV3Like<unknown, unknown>;
|
|
38
134
|
/** Backward compatible isZodSchema for Zod 3 */
|
|
39
|
-
declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema:
|
|
135
|
+
declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema: ZodV3Like<RunOutput> | Record<string, unknown>): schema is ZodV3Like<RunOutput>;
|
|
40
136
|
/**
|
|
41
137
|
* Given either a Zod schema, or plain object, determine if the input is a Zod schema.
|
|
42
138
|
*
|
|
@@ -44,9 +140,8 @@ declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<
|
|
|
44
140
|
* @returns {boolean} Whether or not the provided input is a Zod schema.
|
|
45
141
|
*/
|
|
46
142
|
declare function isInteropZodSchema(input: unknown): input is InteropZodType;
|
|
47
|
-
|
|
48
|
-
declare function
|
|
49
|
-
declare function isZodLiteralV4(obj: unknown): obj is z4.$ZodLiteral;
|
|
143
|
+
declare function isZodLiteralV3(obj: unknown): obj is ZodV3Like;
|
|
144
|
+
declare function isZodLiteralV4(obj: unknown): obj is ZodV4Like;
|
|
50
145
|
/**
|
|
51
146
|
* Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).
|
|
52
147
|
*
|
|
@@ -54,7 +149,18 @@ declare function isZodLiteralV4(obj: unknown): obj is z4.$ZodLiteral;
|
|
|
54
149
|
* @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.
|
|
55
150
|
*/
|
|
56
151
|
declare function isInteropZodLiteral(obj: unknown): obj is InteropZodLiteral;
|
|
57
|
-
|
|
152
|
+
interface InteropZodError {
|
|
153
|
+
issues: InteropZodIssue[];
|
|
154
|
+
}
|
|
155
|
+
type InteropZodSafeParseResult<T> = {
|
|
156
|
+
success: true;
|
|
157
|
+
data: T;
|
|
158
|
+
error?: never;
|
|
159
|
+
} | {
|
|
160
|
+
success: false;
|
|
161
|
+
error: InteropZodError;
|
|
162
|
+
data?: never;
|
|
163
|
+
};
|
|
58
164
|
/**
|
|
59
165
|
* Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.
|
|
60
166
|
* This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.
|
|
@@ -144,10 +250,10 @@ declare function isShapelessZodSchema(schema: unknown): boolean;
|
|
|
144
250
|
*/
|
|
145
251
|
declare function isSimpleStringZodSchema(schema: unknown): schema is InteropZodType<string | undefined>;
|
|
146
252
|
declare function isZodObjectV3(obj: unknown): obj is ZodObjectV3;
|
|
147
|
-
declare function isZodObjectV4(obj: unknown): obj is
|
|
148
|
-
declare function isZodArrayV4(obj: unknown): obj is
|
|
149
|
-
declare function isZodOptionalV4(obj: unknown): obj is
|
|
150
|
-
declare function isZodNullableV4(obj: unknown): obj is
|
|
253
|
+
declare function isZodObjectV4(obj: unknown): obj is ZodV4ObjectLike;
|
|
254
|
+
declare function isZodArrayV4(obj: unknown): obj is ZodV4ArrayLike;
|
|
255
|
+
declare function isZodOptionalV4(obj: unknown): obj is ZodV4OptionalLike;
|
|
256
|
+
declare function isZodNullableV4(obj: unknown): obj is ZodV4NullableLike;
|
|
151
257
|
/**
|
|
152
258
|
* Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).
|
|
153
259
|
*
|
|
@@ -242,5 +348,5 @@ declare function interopZodTransformInputSchema(schema: InteropZodType, recursiv
|
|
|
242
348
|
declare function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(schema: T, predicate: (key: string, value: InteropZodType) => boolean): InteropZodObject;
|
|
243
349
|
declare function isInteropZodError(e: unknown): boolean;
|
|
244
350
|
//#endregion
|
|
245
|
-
export { InferInteropZodInput, InferInteropZodOutput, InteropZodDefault, InteropZodIssue, InteropZodLiteral, InteropZodObject, InteropZodObjectShape, InteropZodOptional, InteropZodType, Mutable, ZodDefaultV3, ZodDefaultV4, ZodNullableV4, ZodObjectMain, ZodObjectV3, ZodObjectV4, ZodObjectV4Classic, ZodOptionalV3, ZodOptionalV4, ZodStringV3, ZodStringV4, extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodError, isInteropZodLiteral, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodLiteralV3, isZodLiteralV4, isZodNullableV4, isZodObjectV3, isZodObjectV4, isZodOptionalV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
|
|
351
|
+
export { InferInteropZodInput, InferInteropZodOutput, InteropZodDefault, InteropZodError, InteropZodIssue, InteropZodLiteral, InteropZodObject, InteropZodObjectShape, InteropZodOptional, InteropZodType, Mutable, ZodDefaultV3, ZodDefaultV4, ZodNullableV4, ZodObjectMain, ZodObjectV3, ZodObjectV4, ZodObjectV4Classic, ZodOptionalV3, ZodOptionalV4, ZodStringV3, ZodStringV4, ZodV3EffectsLike, ZodV3Like, ZodV3ObjectLike, ZodV3TypeDef, ZodV4ArrayLike, ZodV4Internals, ZodV4Like, ZodV4NullableLike, ZodV4ObjectLike, ZodV4OptionalLike, ZodV4PipeLike, extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodError, isInteropZodLiteral, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodLiteralV3, isZodLiteralV4, isZodNullableV4, isZodObjectV3, isZodObjectV4, isZodOptionalV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
|
|
246
352
|
//# sourceMappingURL=zod.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.cts","names":[],"sources":["../../../src/utils/types/zod.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod.d.cts","names":[],"sources":["../../../src/utils/types/z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