UNPKG

@mastra/schema-compat

Version:

Tool schema compatibility layer for Mastra.ai

91 lines 4.95 kB
import type { z as zV3 } from 'zod/v3'; import type { z as zV4 } from 'zod/v4'; /** * All supported string validation check types that can be processed or converted to descriptions. * @constant */ export declare const ALL_STRING_CHECKS: readonly ["regex", "emoji", "email", "url", "uuid", "cuid", "min", "max"]; /** * All supported number validation check types that can be processed or converted to descriptions. * @constant */ export declare const ALL_NUMBER_CHECKS: readonly ["min", "max", "multipleOf"]; /** * All supported array validation check types that can be processed or converted to descriptions. * @constant */ export declare const ALL_ARRAY_CHECKS: readonly ["min", "max", "length"]; /** * Zod types that are not supported by most AI model providers and should be avoided. * @constant */ export declare const UNSUPPORTED_ZOD_TYPES: readonly ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"]; /** * Zod types that are generally supported by AI model providers. * @constant */ export declare const SUPPORTED_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault", "ZodNullable"]; /** * All Zod types (both supported and unsupported). * @constant */ export declare const ALL_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault", "ZodNullable", "ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"]; /** * Type representing string validation checks. */ export type StringCheckType = (typeof ALL_STRING_CHECKS)[number]; /** * Type representing number validation checks. */ export type NumberCheckType = (typeof ALL_NUMBER_CHECKS)[number]; /** * Type representing array validation checks. */ export type ArrayCheckType = (typeof ALL_ARRAY_CHECKS)[number]; /** * Type representing unsupported Zod schema types. */ export type UnsupportedZodType = (typeof UNSUPPORTED_ZOD_TYPES)[number]; /** * Type representing supported Zod schema types. */ export type SupportedZodType = (typeof SUPPORTED_ZOD_TYPES)[number]; /** * Type representing all Zod schema types (supported and unsupported). */ export type AllZodType = (typeof ALL_ZOD_TYPES)[number]; /** * Utility type to extract the shape of a Zod object schema. */ export type ZodShape<T extends zV3.ZodObject<any, any, any> | zV4.ZodObject<any, any>> = T['shape']; /** * Utility type to extract the keys from a Zod object shape. */ export type ShapeKey<T extends zV3.ZodObject<any, any, any> | zV4.ZodObject<any, any>> = keyof ZodShape<T>; /** * Utility type to extract the value types from a Zod object shape. */ export type ShapeValue<T extends zV3.ZodObject<any, any, any> | zV4.ZodObject<any, any>> = ZodShape<T>[ShapeKey<T>]; export declare function isOptional<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodOptional<any>; export declare function isOptional<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodOptional<any>; export declare function isObj<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodObject<any>; export declare function isObj<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodObject; export declare function isNull<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodNull; export declare function isNull<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodNull; export declare function isArr<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodArray<any>; export declare function isArr<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodArray; export declare function isUnion<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodUnion<any>; export declare function isUnion<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodUnion; export declare function isString<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodString; export declare function isString<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodString; export declare function isNumber<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodNumber; export declare function isNumber<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodNumber; export declare function isDate<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodDate; export declare function isDate<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodDate; export declare function isDefault<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodDefault<any>; export declare function isDefault<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodDefault; export declare function isNullable<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodNullable<any>; export declare function isNullable<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodNullable; export declare function isIntersection<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodIntersection<any, any>; export declare function isIntersection<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodIntersection; //# sourceMappingURL=zodTypes.d.ts.map