@langchain/core 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
Files changed (82) hide show
  1. package/dist/caches/base.d.cts.map +1 -1
  2. package/dist/caches/base.d.ts.map +1 -1
  3. package/dist/callbacks/base.d.cts.map +1 -1
  4. package/dist/callbacks/base.d.ts.map +1 -1
  5. package/dist/language_models/chat_models.d.cts.map +1 -1
  6. package/dist/messages/ai.cjs +4 -4
  7. package/dist/messages/ai.cjs.map +1 -1
  8. package/dist/messages/ai.js +4 -4
  9. package/dist/messages/ai.js.map +1 -1
  10. package/dist/messages/base.cjs +1 -1
  11. package/dist/messages/base.cjs.map +1 -1
  12. package/dist/messages/base.d.cts +2 -2
  13. package/dist/messages/base.d.cts.map +1 -1
  14. package/dist/messages/base.d.ts +2 -2
  15. package/dist/messages/base.d.ts.map +1 -1
  16. package/dist/messages/base.js +1 -1
  17. package/dist/messages/base.js.map +1 -1
  18. package/dist/messages/block_translators/bedrock_converse.cjs +213 -0
  19. package/dist/messages/block_translators/bedrock_converse.cjs.map +1 -0
  20. package/dist/messages/block_translators/bedrock_converse.js +213 -0
  21. package/dist/messages/block_translators/bedrock_converse.js.map +1 -0
  22. package/dist/messages/block_translators/google_genai.cjs +73 -0
  23. package/dist/messages/block_translators/google_genai.cjs.map +1 -0
  24. package/dist/messages/block_translators/google_genai.js +73 -0
  25. package/dist/messages/block_translators/google_genai.js.map +1 -0
  26. package/dist/messages/block_translators/google_vertexai.cjs +74 -0
  27. package/dist/messages/block_translators/google_vertexai.cjs.map +1 -0
  28. package/dist/messages/block_translators/google_vertexai.js +74 -0
  29. package/dist/messages/block_translators/google_vertexai.js.map +1 -0
  30. package/dist/messages/block_translators/index.cjs +10 -1
  31. package/dist/messages/block_translators/index.cjs.map +1 -1
  32. package/dist/messages/block_translators/index.js +10 -1
  33. package/dist/messages/block_translators/index.js.map +1 -1
  34. package/dist/messages/block_translators/utils.cjs +4 -0
  35. package/dist/messages/block_translators/utils.cjs.map +1 -1
  36. package/dist/messages/block_translators/utils.js +4 -1
  37. package/dist/messages/block_translators/utils.js.map +1 -1
  38. package/dist/messages/content/index.cjs.map +1 -1
  39. package/dist/messages/content/index.d.cts +20 -1
  40. package/dist/messages/content/index.d.cts.map +1 -1
  41. package/dist/messages/content/index.d.ts +20 -1
  42. package/dist/messages/content/index.d.ts.map +1 -1
  43. package/dist/messages/content/index.js.map +1 -1
  44. package/dist/messages/content/tools.cjs +3 -0
  45. package/dist/messages/content/tools.cjs.map +1 -1
  46. package/dist/messages/content/tools.d.cts +67 -6
  47. package/dist/messages/content/tools.d.cts.map +1 -1
  48. package/dist/messages/content/tools.d.ts +67 -6
  49. package/dist/messages/content/tools.d.ts.map +1 -1
  50. package/dist/messages/content/tools.js +3 -0
  51. package/dist/messages/content/tools.js.map +1 -1
  52. package/dist/messages/index.cjs +4 -0
  53. package/dist/messages/index.cjs.map +1 -1
  54. package/dist/messages/index.d.cts +2 -2
  55. package/dist/messages/index.d.ts +2 -2
  56. package/dist/messages/index.js +4 -2
  57. package/dist/messages/index.js.map +1 -1
  58. package/dist/messages/message.cjs.map +1 -1
  59. package/dist/messages/message.d.cts +6 -6
  60. package/dist/messages/message.d.cts.map +1 -1
  61. package/dist/messages/message.d.ts +6 -6
  62. package/dist/messages/message.d.ts.map +1 -1
  63. package/dist/messages/message.js.map +1 -1
  64. package/dist/messages/tool.cjs.map +1 -1
  65. package/dist/messages/tool.d.cts +3 -1
  66. package/dist/messages/tool.d.cts.map +1 -1
  67. package/dist/messages/tool.d.ts +3 -1
  68. package/dist/messages/tool.d.ts.map +1 -1
  69. package/dist/messages/tool.js.map +1 -1
  70. package/dist/utils/types/index.cjs +2 -0
  71. package/dist/utils/types/index.d.cts +2 -2
  72. package/dist/utils/types/index.d.ts +2 -2
  73. package/dist/utils/types/index.js +3 -2
  74. package/dist/utils/types/zod.cjs +39 -3
  75. package/dist/utils/types/zod.cjs.map +1 -1
  76. package/dist/utils/types/zod.d.cts +18 -1
  77. package/dist/utils/types/zod.d.cts.map +1 -1
  78. package/dist/utils/types/zod.d.ts +18 -1
  79. package/dist/utils/types/zod.d.ts.map +1 -1
  80. package/dist/utils/types/zod.js +39 -4
  81. package/dist/utils/types/zod.js.map +1 -1
  82. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"zod.d.cts","names":["z3","z4","ZodStringV3","ZodString","ZodStringV4","$ZodType","ZodObjectV3","ZodObject","ZodObjectV4","$ZodObject","InteropZodType","Output","ZodTypeDef","Input","ZodType","InteropZodObject","InteropZodObjectShape","T","Shape","K","InteropZodIssue","ZodIssue","$ZodIssue","InferInteropZodInput","InferInteropZodOutput","Mutable","P","isZodSchemaV4","isZodSchemaV3","isZodSchema","Record","RunOutput","isInteropZodSchema","InteropZodSafeParseResult","SafeParseReturnType","interopSafeParseAsync","Promise","interopParseAsync","interopSafeParse","interopParse","getSchemaDescription","isShapelessZodSchema","isSimpleStringZodSchema","isZodObjectV3","isZodObjectV4","isZodArrayV4","$ZodArray","isInteropZodObject","getInteropZodObjectShape","extendInteropZodObject","interopZodObjectPartial","interopZodObjectStrict","interopZodObjectPassthrough","getInteropZodDefaultGetter","interopZodTransformInputSchema"],"sources":["../../../src/utils/types/zod.d.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nexport type ZodStringV3 = z3.ZodString;\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\nexport type ZodObjectV4 = z4.$ZodObject;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> = z3.ZodType<Output, z3.ZodTypeDef, Input> | z4.$ZodType<Output, Input>;\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = 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} : never;\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<unknown, z3.ZodTypeDef, infer Input> ? Input : T extends z4.$ZodType<unknown, infer Input> ? Input : T extends {\n _zod: {\n input: infer Input;\n };\n} ? Input : never;\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<infer Output, z3.ZodTypeDef, unknown> ? Output : T extends z4.$ZodType<infer Output, unknown> ? Output : T extends {\n _zod: {\n output: infer Output;\n };\n} ? Output : never;\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\nexport declare function isZodSchemaV4(schema: unknown): schema is z4.$ZodType<unknown, unknown>;\nexport declare function isZodSchemaV3(schema: unknown): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown>;\n/** Backward compatible isZodSchema for Zod 3 */\nexport declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema: z3.ZodType<RunOutput> | Record<string, unknown>): schema is z3.ZodType<RunOutput>;\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 declare function isInteropZodSchema(input: unknown): input is InteropZodType;\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\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 declare function interopSafeParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<InteropZodSafeParseResult<T>>;\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 declare function interopParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<T>;\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 declare function interopSafeParse<T>(schema: InteropZodType<T>, input: unknown): InteropZodSafeParseResult<T>;\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 declare function interopParse<T>(schema: InteropZodType<T>, input: unknown): T;\n/**\n * Retrieves the description from a schema definition (v3, v4, 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 declare function getSchemaDescription(schema: InteropZodType<unknown> | Record<string, unknown>): string | undefined;\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 declare function isShapelessZodSchema(schema: unknown): boolean;\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 declare function isSimpleStringZodSchema(schema: unknown): schema is InteropZodType<string | undefined>;\nexport declare function isZodObjectV3(obj: unknown): obj is ZodObjectV3;\nexport declare function isZodObjectV4(obj: unknown): obj is z4.$ZodObject;\nexport declare function isZodArrayV4(obj: unknown): obj is z4.$ZodArray;\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 declare function isInteropZodObject(obj: unknown): obj is InteropZodObject;\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 declare function getInteropZodObjectShape<T extends InteropZodObject>(schema: T): InteropZodObjectShape<T>;\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 declare function extendInteropZodObject<T extends InteropZodObject>(schema: T, extension: InteropZodObjectShape): InteropZodObject;\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 declare function interopZodObjectPartial<T extends InteropZodObject>(schema: T): InteropZodObject;\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 declare function interopZodObjectStrict<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function interopZodObjectPassthrough<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function getInteropZodDefaultGetter<T extends InteropZodType>(schema: T): (() => InferInteropZodOutput<T>) | undefined;\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 declare function interopZodTransformInputSchema(schema: InteropZodType, recursive?: boolean): InteropZodType;\nexport {};\n"],"mappings":";;;;KAEYE,WAAAA,GAAcF,EAAAA,CAAGG;KACjBC,WAAAA,GAAcH,EAAAA,CAAGI;AAD7B;AACYD,KAEAE,WAAAA,GAAcN,EAAAA,CAAGO,SAFAF,CAAAA,GAAQ,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA;AAEzBC,KACAE,WAAAA,GAAcP,EAAAA,CAAGQ,UADAF;AAC7B;AAEYG,KAAAA,cAAc,CAAA,SAAA,GAAA,EAAA,QAAuBC,MAAvB,CAAA,GAAiCX,EAAAA,CAAGc,OAApC,CAA4CH,MAA5C,EAAoDX,EAAAA,CAAGY,UAAvD,EAAmEC,KAAnE,CAAA,GAA4EZ,EAAAA,CAAGI,QAA/E,CAAwFM,MAAxF,EAAgGE,KAAhG,CAAA;AAAA,KACdE,gBAAAA,GAAmBT,WADL,GACmBE,WADnB;AAAuBG,KAErCK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ZodStringV4","$ZodType","ZodObjectV3","ZodObject","ZodObjectV4","$ZodObject","ZodDefaultV3","ZodTypeAny","T","ZodDefault","ZodDefaultV4","SomeType","$ZodDefault","ZodOptionalV3","ZodOptional","ZodOptionalV4","$ZodOptional","InteropZodType","Output","ZodTypeDef","Input","ZodType","InteropZodObject","InteropZodDefault","InteropZodObjectShape","InteropZodOptional","Shape","K","InteropZodIssue","ZodIssue","$ZodIssue","InferInteropZodInput","InferInteropZodOutput","Mutable","P","isZodSchemaV4","isZodSchemaV3","isZodSchema","Record","RunOutput","isInteropZodSchema","InteropZodSafeParseResult","SafeParseReturnType","interopSafeParseAsync","Promise","interopParseAsync","interopSafeParse","interopParse","getSchemaDescription","isShapelessZodSchema","isSimpleStringZodSchema","isZodObjectV3","isZodObjectV4","isZodArrayV4","$ZodArray","isInteropZodObject","getInteropZodObjectShape","extendInteropZodObject","interopZodObjectPartial","interopZodObjectStrict","interopZodObjectPassthrough","getInteropZodDefaultGetter","interopZodTransformInputSchema","interopZodObjectMakeFieldsOptional"],"sources":["../../../src/utils/types/zod.d.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nexport type ZodStringV3 = z3.ZodString;\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\nexport type ZodObjectV4 = z4.$ZodObject;\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>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> = z3.ZodType<Output, z3.ZodTypeDef, Input> | z4.$ZodType<Output, Input>;\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodDefault<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodDefaultV3<T> : T extends z4.SomeType ? ZodDefaultV4<T> : never;\nexport type InteropZodOptional<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodOptionalV3<T> : T extends z4.SomeType ? ZodOptionalV4<T> : never;\nexport type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = 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} : never;\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<unknown, z3.ZodTypeDef, infer Input> ? Input : T extends z4.$ZodType<unknown, infer Input> ? Input : T extends {\n _zod: {\n input: infer Input;\n };\n} ? Input : never;\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<infer Output, z3.ZodTypeDef, unknown> ? Output : T extends z4.$ZodType<infer Output, unknown> ? Output : T extends {\n _zod: {\n output: infer Output;\n };\n} ? Output : never;\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\nexport declare function isZodSchemaV4(schema: unknown): schema is z4.$ZodType<unknown, unknown>;\nexport declare function isZodSchemaV3(schema: unknown): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown>;\n/** Backward compatible isZodSchema for Zod 3 */\nexport declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema: z3.ZodType<RunOutput> | Record<string, unknown>): schema is z3.ZodType<RunOutput>;\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 declare function isInteropZodSchema(input: unknown): input is InteropZodType;\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\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 declare function interopSafeParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<InteropZodSafeParseResult<T>>;\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 declare function interopParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<T>;\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 declare function interopSafeParse<T>(schema: InteropZodType<T>, input: unknown): InteropZodSafeParseResult<T>;\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 declare function interopParse<T>(schema: InteropZodType<T>, input: unknown): T;\n/**\n * Retrieves the description from a schema definition (v3, v4, 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 declare function getSchemaDescription(schema: InteropZodType<unknown> | Record<string, unknown>): string | undefined;\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 declare function isShapelessZodSchema(schema: unknown): boolean;\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 declare function isSimpleStringZodSchema(schema: unknown): schema is InteropZodType<string | undefined>;\nexport declare function isZodObjectV3(obj: unknown): obj is ZodObjectV3;\nexport declare function isZodObjectV4(obj: unknown): obj is z4.$ZodObject;\nexport declare function isZodArrayV4(obj: unknown): obj is z4.$ZodArray;\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 declare function isInteropZodObject(obj: unknown): obj is InteropZodObject;\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 declare function getInteropZodObjectShape<T extends InteropZodObject>(schema: T): InteropZodObjectShape<T>;\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 declare function extendInteropZodObject<T extends InteropZodObject>(schema: T, extension: InteropZodObjectShape): InteropZodObject;\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 declare function interopZodObjectPartial<T extends InteropZodObject>(schema: T): InteropZodObject;\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 declare function interopZodObjectStrict<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function interopZodObjectPassthrough<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function getInteropZodDefaultGetter<T extends InteropZodType>(schema: T): (() => InferInteropZodOutput<T>) | undefined;\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 declare function interopZodTransformInputSchema(schema: InteropZodType, recursive?: boolean): InteropZodType;\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 declare function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(schema: T, predicate: (key: string, value: InteropZodType) => boolean): InteropZodObject;\nexport {};\n"],"mappings":";;;;KAEYE,WAAAA,GAAcF,EAAAA,CAAGG;KACjBC,WAAAA,GAAcH,EAAAA,CAAGI;AAD7B;AACYD,KAEAE,WAAAA,GAAcN,EAAAA,CAAGO,SAFAF,CAAAA,GAAQ,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA;AAEzBC,KACAE,WAAAA,GAAcP,EAAAA,CAAGQ,UADAF;AACjBC,KACAE,YADW,CAAA,UACYV,EAAAA,CAAGW,UADC,CAAA,GACaX,EAAAA,CAAGa,UADhB,CAC2BD,CAD3B,CAAA;AAC3BF,KACAI,YADY,CAAA,UACWb,EAAAA,CAAGc,QADd,CAAA,GAC0Bd,EAAAA,CAAGe,WAD7B,CACyCJ,CADzC,CAAA;AAAA,KAEZK,aAFY,CAAA,UAEYjB,EAAAA,CAAGW,UAFf,CAAA,GAE6BX,EAAAA,CAAGkB,WAFhC,CAE4CN,CAF5C,CAAA;AAAWZ,KAGvBmB,aAH0BR,CAAAA,UAGFV,EAAAA,CAAGc,QAHDJ,CAAAA,GAGaV,EAAAA,CAAGmB,YAHhBT,CAG6BC,CAH7BD,CAAAA;;AAAcX,KAKxCqB,cAL2CR,CAAAA,SAAAA,GAAAA,EAAAA,QAKNS,MALMT,CAAAA,GAKIb,EAAAA,CAAGyB,OALPZ,CAKeS,MALfT,EAKuBb,EAAAA,CAAGuB,UAL1BV,EAKsCW,KALtCX,CAAAA,GAK+CZ,EAAAA,CAAGI,QALlDQ,CAK2DS,MAL3DT,EAKmEW,KALnEX,CAAAA;AAAU,KAMrDa,gBAAAA,GAAmBpB,WANkC,GAMpBE,WANoB;AACrDM,KAMAa,iBANY,CAAA,IAMUC,qBANV,CAAA,GAMmChB,CANnC,SAM6CZ,EAAAA,CAAGW,UANhD,GAM6DD,YAN7D,CAM0EE,CAN1E,CAAA,GAM+EA,CAN/E,SAMyFX,EAAAA,CAAGc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;
9
9
  type ZodObjectV4 = z4.$ZodObject;
10
+ type ZodDefaultV3<T extends z3.ZodTypeAny> = z3.ZodDefault<T>;
11
+ type ZodDefaultV4<T extends z4.SomeType> = z4.$ZodDefault<T>;
12
+ type ZodOptionalV3<T extends z3.ZodTypeAny> = z3.ZodOptional<T>;
13
+ type ZodOptionalV4<T extends z4.SomeType> = z4.$ZodOptional<T>;
10
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
15
  type InteropZodType<Output = any, Input = Output> = z3.ZodType<Output, z3.ZodTypeDef, Input> | z4.$ZodType<Output, Input>;
12
16
  type InteropZodObject = ZodObjectV3 | ZodObjectV4;
17
+ type InteropZodDefault<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodDefaultV3<T> : T extends z4.SomeType ? ZodDefaultV4<T> : never;
18
+ type InteropZodOptional<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodOptionalV3<T> : T extends z4.SomeType ? ZodOptionalV4<T> : never;
13
19
  type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = T extends z3.ZodObject<infer Shape> ? { [K in keyof Shape]: Shape[K] } : T extends z4.$ZodObject<infer Shape> ? { [K in keyof Shape]: Shape[K] } : never;
14
20
  type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;
15
21
  // Simplified type inference to avoid circular dependencies
@@ -208,6 +214,17 @@ declare function getInteropZodDefaultGetter<T extends InteropZodType>(schema: T)
208
214
  * @returns The input Zod schema of the transform, or undefined if not a transform
209
215
  */
210
216
  declare function interopZodTransformInputSchema(schema: InteropZodType, recursive?: boolean): InteropZodType;
217
+ /**
218
+ * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.
219
+ * Supports both Zod v3 and v4 schemas and preserves the original schema version.
220
+ *
221
+ * @template T - The type of the Zod object schema.
222
+ * @param {T} schema - The Zod object schema instance (either v3 or v4).
223
+ * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.
224
+ * @returns {InteropZodObject} The modified Zod object schema.
225
+ * @throws {Error} If the schema is not a Zod v3 or v4 object.
226
+ */
227
+ declare function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(schema: T, predicate: (key: string, value: InteropZodType) => boolean): InteropZodObject;
211
228
  //#endregion
212
- export { InferInteropZodInput, InferInteropZodOutput, InteropZodIssue, InteropZodObject, InteropZodObjectShape, InteropZodType, Mutable, ZodObjectV3, ZodObjectV4, ZodStringV3, ZodStringV4, extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodObjectV3, isZodObjectV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
229
+ export { InferInteropZodInput, InferInteropZodOutput, InteropZodDefault, InteropZodIssue, InteropZodObject, InteropZodObjectShape, InteropZodOptional, InteropZodType, Mutable, ZodDefaultV3, ZodDefaultV4, ZodObjectV3, ZodObjectV4, ZodOptionalV3, ZodOptionalV4, ZodStringV3, ZodStringV4, extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodObjectV3, isZodObjectV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
213
230
  //# sourceMappingURL=zod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zod.d.ts","names":["z3","z4","ZodStringV3","ZodString","ZodStringV4","$ZodType","ZodObjectV3","ZodObject","ZodObjectV4","$ZodObject","InteropZodType","Output","ZodTypeDef","Input","ZodType","InteropZodObject","InteropZodObjectShape","T","Shape","K","InteropZodIssue","ZodIssue","$ZodIssue","InferInteropZodInput","InferInteropZodOutput","Mutable","P","isZodSchemaV4","isZodSchemaV3","isZodSchema","Record","RunOutput","isInteropZodSchema","InteropZodSafeParseResult","SafeParseReturnType","interopSafeParseAsync","Promise","interopParseAsync","interopSafeParse","interopParse","getSchemaDescription","isShapelessZodSchema","isSimpleStringZodSchema","isZodObjectV3","isZodObjectV4","isZodArrayV4","$ZodArray","isInteropZodObject","getInteropZodObjectShape","extendInteropZodObject","interopZodObjectPartial","interopZodObjectStrict","interopZodObjectPassthrough","getInteropZodDefaultGetter","interopZodTransformInputSchema"],"sources":["../../../src/utils/types/zod.d.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nexport type ZodStringV3 = z3.ZodString;\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\nexport type ZodObjectV4 = z4.$ZodObject;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> = z3.ZodType<Output, z3.ZodTypeDef, Input> | z4.$ZodType<Output, Input>;\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = 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} : never;\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<unknown, z3.ZodTypeDef, infer Input> ? Input : T extends z4.$ZodType<unknown, infer Input> ? Input : T extends {\n _zod: {\n input: infer Input;\n };\n} ? Input : never;\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<infer Output, z3.ZodTypeDef, unknown> ? Output : T extends z4.$ZodType<infer Output, unknown> ? Output : T extends {\n _zod: {\n output: infer Output;\n };\n} ? Output : never;\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\nexport declare function isZodSchemaV4(schema: unknown): schema is z4.$ZodType<unknown, unknown>;\nexport declare function isZodSchemaV3(schema: unknown): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown>;\n/** Backward compatible isZodSchema for Zod 3 */\nexport declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema: z3.ZodType<RunOutput> | Record<string, unknown>): schema is z3.ZodType<RunOutput>;\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 declare function isInteropZodSchema(input: unknown): input is InteropZodType;\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\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 declare function interopSafeParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<InteropZodSafeParseResult<T>>;\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 declare function interopParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<T>;\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 declare function interopSafeParse<T>(schema: InteropZodType<T>, input: unknown): InteropZodSafeParseResult<T>;\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 declare function interopParse<T>(schema: InteropZodType<T>, input: unknown): T;\n/**\n * Retrieves the description from a schema definition (v3, v4, 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 declare function getSchemaDescription(schema: InteropZodType<unknown> | Record<string, unknown>): string | undefined;\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 declare function isShapelessZodSchema(schema: unknown): boolean;\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 declare function isSimpleStringZodSchema(schema: unknown): schema is InteropZodType<string | undefined>;\nexport declare function isZodObjectV3(obj: unknown): obj is ZodObjectV3;\nexport declare function isZodObjectV4(obj: unknown): obj is z4.$ZodObject;\nexport declare function isZodArrayV4(obj: unknown): obj is z4.$ZodArray;\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 declare function isInteropZodObject(obj: unknown): obj is InteropZodObject;\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 declare function getInteropZodObjectShape<T extends InteropZodObject>(schema: T): InteropZodObjectShape<T>;\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 declare function extendInteropZodObject<T extends InteropZodObject>(schema: T, extension: InteropZodObjectShape): InteropZodObject;\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 declare function interopZodObjectPartial<T extends InteropZodObject>(schema: T): InteropZodObject;\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 declare function interopZodObjectStrict<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function interopZodObjectPassthrough<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function getInteropZodDefaultGetter<T extends InteropZodType>(schema: T): (() => InferInteropZodOutput<T>) | undefined;\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 declare function interopZodTransformInputSchema(schema: InteropZodType, recursive?: boolean): InteropZodType;\nexport {};\n"],"mappings":";;;;KAEYE,WAAAA,GAAcF,EAAAA,CAAGG;KACjBC,WAAAA,GAAcH,EAAAA,CAAGI;AAD7B;AACYD,KAEAE,WAAAA,GAAcN,EAAAA,CAAGO,SAFAF,CAAAA,GAAQ,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA;AAEzBC,KACAE,WAAAA,GAAcP,EAAAA,CAAGQ,UADAF;AAC7B;AAEYG,KAAAA,cAAc,CAAA,SAAA,GAAA,EAAA,QAAuBC,MAAvB,CAAA,GAAiCX,EAAAA,CAAGc,OAApC,CAA4CH,MAA5C,EAAoDX,EAAAA,CAAGY,UAAvD,EAAmEC,KAAnE,CAAA,GAA4EZ,EAAAA,CAAGI,QAA/E,CAAwFM,MAAxF,EAAgGE,KAAhG,CAAA;AAAA,KACdE,gBAAAA,GAAmBT,WADL,GACmBE,WADnB;AAAuBG,KAErCK,qBAFqCL,CAAAA,UAELI,gBAFKJ,GAEcI,gBAFdJ,CAAAA,GAEkCM,CAFlCN,SAE4CX,EAAAA,CAAGO,SAF/CI,CAAAA,KAAAA,MAAAA,CAAAA,GAAAA,QAAqBA,MAGtDO,KAHsDP,GAG9CO,KAH8CP,CAGxCQ,CAHwCR,CAAAA,EAAM,GAIxEM,CAJwE,SAI9DhB,EAAAA,CAAGQ,UAJgEG,CAAAA,KAAAA,MAAAA,CAAAA,GAAAA,QAAYC,MAK7EK,KAL6EL,GAKrEK,KALqEL,CAK/DM,CAL+DN,CAAAA,EAAK,GAAA,KAAvC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AAA,EAAAA,OAAAA,CAAAA,EAAAA,GAAAA,IATpBF,gBASoBE;;;AAAyB;AAU9G;;;;;AAAyHF,iBAVjGiC,wBAUiGjC,CAAAA,UAV9DA,gBAU8DA,CAAAA,CAAAA,MAAAA,EAVpCE,CAUoCF,CAAAA,EAVhCC,qBAUgCD,CAVVE,CAUUF,CAAAA;AAAgB;AAUzI;;;;;AAAwG;AAYxG;;AAAyDA,iBAtBjCkC,sBAsBiClC,CAAAA,UAtBAA,gBAsBAA,CAAAA,CAAAA,MAAAA,EAtB0BE,CAsB1BF,EAAAA,SAAAA,EAtBwCC,qBAsBxCD,CAAAA,EAtBgEA,gBAsBhEA;;;AAAmE;AAY5H;;;;;AAAiI;AAWzGsC,iBAnCAH,uBAmC0B,CAAA,UAnCQnC,gBAmCR,CAAA,CAAA,MAAA,EAnCkCE,CAmClC,CAAA,EAnCsCF,gBAmCtC;;;;;;AAAmE;AAUrH;;;;AAAmH;iBAjC3FoC,iCAAiCpC,0BAA0BE,yBAAyBF;;;;;;;;;;;;iBAYpFqC,sCAAsCrC,0BAA0BE,yBAAyBF;;;;;;;;;;;iBAWzFsC,qCAAqC3C,wBAAwBO,WAAWO,sBAAsBP;;;;;;;;;;iBAU9FqC,8BAAAA,SAAuC5C,sCAAsCA"}
1
+ {"version":3,"file":"zod.d.ts","names":["z3","z4","ZodStringV3","ZodString","ZodStringV4","$ZodType","ZodObjectV3","ZodObject","ZodObjectV4","$ZodObject","ZodDefaultV3","ZodTypeAny","T","ZodDefault","ZodDefaultV4","SomeType","$ZodDefault","ZodOptionalV3","ZodOptional","ZodOptionalV4","$ZodOptional","InteropZodType","Output","ZodTypeDef","Input","ZodType","InteropZodObject","InteropZodDefault","InteropZodObjectShape","InteropZodOptional","Shape","K","InteropZodIssue","ZodIssue","$ZodIssue","InferInteropZodInput","InferInteropZodOutput","Mutable","P","isZodSchemaV4","isZodSchemaV3","isZodSchema","Record","RunOutput","isInteropZodSchema","InteropZodSafeParseResult","SafeParseReturnType","interopSafeParseAsync","Promise","interopParseAsync","interopSafeParse","interopParse","getSchemaDescription","isShapelessZodSchema","isSimpleStringZodSchema","isZodObjectV3","isZodObjectV4","isZodArrayV4","$ZodArray","isInteropZodObject","getInteropZodObjectShape","extendInteropZodObject","interopZodObjectPartial","interopZodObjectStrict","interopZodObjectPassthrough","getInteropZodDefaultGetter","interopZodTransformInputSchema","interopZodObjectMakeFieldsOptional"],"sources":["../../../src/utils/types/zod.d.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nexport type ZodStringV3 = z3.ZodString;\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\nexport type ZodObjectV4 = z4.$ZodObject;\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>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> = z3.ZodType<Output, z3.ZodTypeDef, Input> | z4.$ZodType<Output, Input>;\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodDefault<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodDefaultV3<T> : T extends z4.SomeType ? ZodDefaultV4<T> : never;\nexport type InteropZodOptional<T = InteropZodObjectShape> = T extends z3.ZodTypeAny ? ZodOptionalV3<T> : T extends z4.SomeType ? ZodOptionalV4<T> : never;\nexport type InteropZodObjectShape<T extends InteropZodObject = InteropZodObject> = 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} : never;\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<unknown, z3.ZodTypeDef, infer Input> ? Input : T extends z4.$ZodType<unknown, infer Input> ? Input : T extends {\n _zod: {\n input: infer Input;\n };\n} ? Input : never;\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<infer Output, z3.ZodTypeDef, unknown> ? Output : T extends z4.$ZodType<infer Output, unknown> ? Output : T extends {\n _zod: {\n output: infer Output;\n };\n} ? Output : never;\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\nexport declare function isZodSchemaV4(schema: unknown): schema is z4.$ZodType<unknown, unknown>;\nexport declare function isZodSchemaV3(schema: unknown): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown>;\n/** Backward compatible isZodSchema for Zod 3 */\nexport declare function isZodSchema<RunOutput extends Record<string, unknown> = Record<string, unknown>>(schema: z3.ZodType<RunOutput> | Record<string, unknown>): schema is z3.ZodType<RunOutput>;\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 declare function isInteropZodSchema(input: unknown): input is InteropZodType;\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\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 declare function interopSafeParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<InteropZodSafeParseResult<T>>;\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 declare function interopParseAsync<T>(schema: InteropZodType<T>, input: unknown): Promise<T>;\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 declare function interopSafeParse<T>(schema: InteropZodType<T>, input: unknown): InteropZodSafeParseResult<T>;\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 declare function interopParse<T>(schema: InteropZodType<T>, input: unknown): T;\n/**\n * Retrieves the description from a schema definition (v3, v4, 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 declare function getSchemaDescription(schema: InteropZodType<unknown> | Record<string, unknown>): string | undefined;\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 declare function isShapelessZodSchema(schema: unknown): boolean;\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 declare function isSimpleStringZodSchema(schema: unknown): schema is InteropZodType<string | undefined>;\nexport declare function isZodObjectV3(obj: unknown): obj is ZodObjectV3;\nexport declare function isZodObjectV4(obj: unknown): obj is z4.$ZodObject;\nexport declare function isZodArrayV4(obj: unknown): obj is z4.$ZodArray;\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 declare function isInteropZodObject(obj: unknown): obj is InteropZodObject;\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 declare function getInteropZodObjectShape<T extends InteropZodObject>(schema: T): InteropZodObjectShape<T>;\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 declare function extendInteropZodObject<T extends InteropZodObject>(schema: T, extension: InteropZodObjectShape): InteropZodObject;\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 declare function interopZodObjectPartial<T extends InteropZodObject>(schema: T): InteropZodObject;\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 declare function interopZodObjectStrict<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function interopZodObjectPassthrough<T extends InteropZodObject>(schema: T, recursive?: boolean): InteropZodObject;\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 declare function getInteropZodDefaultGetter<T extends InteropZodType>(schema: T): (() => InferInteropZodOutput<T>) | undefined;\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 declare function interopZodTransformInputSchema(schema: InteropZodType, recursive?: boolean): InteropZodType;\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 declare function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(schema: T, predicate: (key: string, value: InteropZodType) => boolean): InteropZodObject;\nexport {};\n"],"mappings":";;;;KAEYE,WAAAA,GAAcF,EAAAA,CAAGG;KACjBC,WAAAA,GAAcH,EAAAA,CAAGI;AAD7B;AACYD,KAEAE,WAAAA,GAAcN,EAAAA,CAAGO,SAFAF,CAAAA,GAAQ,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA;AAEzBC,KACAE,WAAAA,GAAcP,EAAAA,CAAGQ,UADAF;AACjBC,KACAE,YADW,CAAA,UACYV,EAAAA,CAAGW,UADC,CAAA,GACaX,EAAA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UAwBetC,gBAxBf,CAAA,CAAA,MAAA,EAwByCd,CAxBzC,EAAA,SAAA,CAAA,EAAA,OAAA,CAAA,EAwBkEc,gBAxBlE;;;;;AAAyD;AAYxG;;;;;AAA4H,iBAuBpGuC,0BAvBoG,CAAA,UAuB/D5C,cAvB+D,CAAA,CAAA,MAAA,EAuBvCT,CAvBuC,CAAA,EAAA,CAAA,GAAA,GAuB5BwB,qBAvB4B,CAuBNxB,CAvBM,CAAA,CAAA,GAAA,SAAA;AAY5H;;;;;AAAiI;AAWjI;;;AAAqFA,iBAU7DsD,8BAAAA,CAV6DtD,MAAAA,EAUtBS,cAVsBT,EAAAA,SAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAUgBS,cAVhBT;;;AAAgC;AAUrH;;;;AAAmH;AAWnH;;AAAqEc,iBAA7CyC,kCAA6CzC,CAAAA,UAAAA,gBAAAA,CAAAA,CAAAA,MAAAA,EAA0Bd,CAA1Bc,EAAAA,SAAAA,EAAAA,CAAAA,GAAAA,EAAAA,MAAAA,EAAAA,KAAAA,EAA6DL,cAA7DK,EAAAA,GAAAA,OAAAA,CAAAA,EAA0FA,gBAA1FA"}
@@ -56,7 +56,7 @@ async function interopSafeParseAsync(schema, input) {
56
56
  error
57
57
  };
58
58
  }
59
- if (isZodSchemaV3(schema)) return schema.safeParse(input);
59
+ if (isZodSchemaV3(schema)) return await schema.safeParseAsync(input);
60
60
  throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType");
61
61
  }
62
62
  /**
@@ -70,8 +70,8 @@ async function interopSafeParseAsync(schema, input) {
70
70
  * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.
71
71
  */
72
72
  async function interopParseAsync(schema, input) {
73
- if (isZodSchemaV4(schema)) return parse(schema, input);
74
- if (isZodSchemaV3(schema)) return schema.parse(input);
73
+ if (isZodSchemaV4(schema)) return await parseAsync(schema, input);
74
+ if (isZodSchemaV3(schema)) return await schema.parseAsync(input);
75
75
  throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType");
76
76
  }
77
77
  /**
@@ -413,7 +413,42 @@ function interopZodTransformInputSchema(schema, recursive = false) {
413
413
  }
414
414
  throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType");
415
415
  }
416
+ /**
417
+ * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.
418
+ * Supports both Zod v3 and v4 schemas and preserves the original schema version.
419
+ *
420
+ * @template T - The type of the Zod object schema.
421
+ * @param {T} schema - The Zod object schema instance (either v3 or v4).
422
+ * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.
423
+ * @returns {InteropZodObject} The modified Zod object schema.
424
+ * @throws {Error} If the schema is not a Zod v3 or v4 object.
425
+ */
426
+ function interopZodObjectMakeFieldsOptional(schema, predicate) {
427
+ if (isZodSchemaV3(schema)) {
428
+ const shape = getInteropZodObjectShape(schema);
429
+ const modifiedShape = {};
430
+ for (const [key, value] of Object.entries(shape)) if (predicate(key, value)) modifiedShape[key] = value.optional();
431
+ else modifiedShape[key] = value;
432
+ return schema.extend(modifiedShape);
433
+ }
434
+ if (isZodSchemaV4(schema)) {
435
+ const shape = getInteropZodObjectShape(schema);
436
+ const outputShape = { ...schema._zod.def.shape };
437
+ for (const [key, value] of Object.entries(shape)) if (predicate(key, value)) outputShape[key] = new $ZodOptional({
438
+ type: "optional",
439
+ innerType: value
440
+ });
441
+ const modifiedSchema = clone(schema, {
442
+ ...schema._zod.def,
443
+ shape: outputShape
444
+ });
445
+ const meta = globalRegistry.get(schema);
446
+ if (meta) globalRegistry.add(modifiedSchema, meta);
447
+ return modifiedSchema;
448
+ }
449
+ throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject");
450
+ }
416
451
 
417
452
  //#endregion
418
- export { extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodObjectV3, isZodObjectV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
453
+ export { extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodObjectV3, isZodObjectV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };
419
454
  //# sourceMappingURL=zod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zod.js","names":["schema: unknown","schema: z3.ZodType<RunOutput> | Record<string, unknown>","input: unknown","schema: InteropZodType<T>","schema: InteropZodType<unknown> | Record<string, unknown>","obj: unknown","schema: T","extension: InteropZodObjectShape","outputShape: Mutable<z4.$ZodShape>","meta","schema: InteropZodType","outputSchema: InteropZodType"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\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\nexport type ZodStringV3 = z3.ZodString;\n\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\n\nexport type ZodObjectV4 = z4.$ZodObject;\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 = ZodObjectV3 | ZodObjectV4;\n\nexport type InteropZodObjectShape<\n T extends InteropZodObject = InteropZodObject\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 : never;\n\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<\n unknown,\n z3.ZodTypeDef,\n infer Input\n>\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> = T extends z3.ZodType<\n infer Output,\n z3.ZodTypeDef,\n unknown\n>\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\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 schema.safeParse(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 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 * 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, 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: 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.description as string | undefined;\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\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\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 // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchema(schema._def.schema, recursive);\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 = interopZodTransformInputSchema(\n schema._zod.def.in,\n recursive\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n const outputShape: Mutable<z4.$ZodShape> = outputSchema._zod.def.shape;\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchema(\n keySchema,\n recursive\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 = interopZodTransformInputSchema(\n outputSchema._zod.def.element,\n recursive\n );\n outputSchema = clone<z4.$ZodArray>(outputSchema, {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n });\n }\n }\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n"],"mappings":";;;AAsEA,SAAgB,cACdA,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;AAEb;AAED,SAAgB,cACdA,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;AAElB;;AAGD,SAAgB,YAGdC,QACiC;AACjC,KAAI,cAAc,OAAO,EACvB,QAAQ,KACN,4HACD;AAEH,QAAO,cAAc,OAAO;AAC7B;;;;;;;AAQD,SAAgB,mBAAmBC,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,MAA6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,EAC1B,eAAe,+BACb,OAAO,KAAK,IAAI,IAChB,UACD;AAEH,MAAI,WAEF;OAAI,cAAc,aAAa,EAAE;IAC/B,MAAMH,cAAqC,aAAa,KAAK,IAAI;AACjE,SAAK,MAAM,CAAC,KAAK,UAAU,IAAI,OAAO,QACpC,aAAa,KAAK,IAAI,MACvB,EACC,YAAY,OAAO,+BACjB,WACA,UACD;IAEH,eAAe,MAAmB,cAAc;KAC9C,GAAG,aAAa,KAAK;KACrB,OAAO;IACR,EAAC;GACH,WAEQ,aAAa,aAAa,EAAE;IACnC,MAAM,gBAAgB,+BACpB,aAAa,KAAK,IAAI,SACtB,UACD;IACD,eAAe,MAAoB,cAAc;KAC/C,GAAG,aAAa,KAAK;KACrB,SAAS;IACV,EAAC;GACH;;EAEH,MAAM,OAAO,eAAe,IAAI,OAAO;AACvC,MAAI,MAAM,eAAe,IAAI,cAA6B,KAAK;AAC/D,SAAO;CACR;AAED,OAAM,IAAI,MAAM;AACjB"}
1
+ {"version":3,"file":"zod.js","names":["schema: unknown","schema: z3.ZodType<RunOutput> | Record<string, unknown>","input: unknown","schema: InteropZodType<T>","schema: InteropZodType<unknown> | Record<string, unknown>","obj: unknown","schema: T","extension: InteropZodObjectShape","outputShape: Mutable<z4.$ZodShape>","meta","schema: InteropZodType","outputSchema: InteropZodType","predicate: (key: string, value: InteropZodType) => boolean","modifiedShape: Record<string, z3.ZodTypeAny>"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\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\nexport type ZodStringV3 = z3.ZodString;\n\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\n\nexport type ZodObjectV4 = z4.$ZodObject;\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>;\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 = ZodObjectV3 | ZodObjectV4;\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> = 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 : never;\n\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<\n unknown,\n z3.ZodTypeDef,\n infer Input\n>\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> = T extends z3.ZodType<\n infer Output,\n z3.ZodTypeDef,\n unknown\n>\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\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, 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: 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.description as string | undefined;\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\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\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 // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchema(schema._def.schema, recursive);\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 = interopZodTransformInputSchema(\n schema._zod.def.in,\n recursive\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n const outputShape: Mutable<z4.$ZodShape> = outputSchema._zod.def.shape;\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchema(\n keySchema,\n recursive\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 = interopZodTransformInputSchema(\n outputSchema._zod.def.element,\n recursive\n );\n outputSchema = clone<z4.$ZodArray>(outputSchema, {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n });\n }\n }\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\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"],"mappings":";;;AAuFA,SAAgB,cACdA,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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AE;EACzB,MAAM,QAAQ,yBAAyB,OAAO;EAC9C,MAAMC,gBAA+C,CAAE;AAEvD,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,KAAK,MAAM,EAEvB,cAAc,OAAQ,MAAwB,UAAU;OAGxD,cAAc,OAAO;AAKzB,SAAO,OAAO,OAAO,cAAgC;CACtD;AAED,KAAI,cAAc,OAAO,EAAE;EACzB,MAAM,QAAQ,yBAAyB,OAAO;EAC9C,MAAML,cAAqC,EAAE,GAAG,OAAO,KAAK,IAAI,MAAO;AAEvE,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,KAAK,MAAM,EAEvB,YAAY,OAAO,IAAI,aAAa;GAClC,MAAM;GACN,WAAW;EACZ;EAKL,MAAM,iBAAiB,MAAmB,QAAQ;GAChD,GAAG,OAAO,KAAK;GACf,OAAO;EACR,EAAC;EAGF,MAAM,OAAO,eAAe,IAAI,OAAO;AACvC,MAAI,MAAM,eAAe,IAAI,gBAAgB,KAAK;AAElD,SAAO;CACR;AAED,OAAM,IAAI,MACR;AAEH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {