@mastra/schema-compat 0.0.0-ai-v5-20250801192614 → 0.0.0-bundle-recursion-20251030002519

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 (65) hide show
  1. package/CHANGELOG.md +140 -2
  2. package/README.md +0 -4
  3. package/dist/chunk-5WM4A32G.cjs +83 -0
  4. package/dist/chunk-5WM4A32G.cjs.map +1 -0
  5. package/dist/chunk-U2HXWNAF.js +77 -0
  6. package/dist/chunk-U2HXWNAF.js.map +1 -0
  7. package/dist/index.cjs +860 -138
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +10 -8
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +859 -139
  12. package/dist/index.js.map +1 -1
  13. package/dist/provider-compats/anthropic.d.ts +7 -5
  14. package/dist/provider-compats/anthropic.d.ts.map +1 -1
  15. package/dist/provider-compats/deepseek.d.ts +7 -5
  16. package/dist/provider-compats/deepseek.d.ts.map +1 -1
  17. package/dist/provider-compats/google.d.ts +7 -5
  18. package/dist/provider-compats/google.d.ts.map +1 -1
  19. package/dist/provider-compats/meta.d.ts +7 -5
  20. package/dist/provider-compats/meta.d.ts.map +1 -1
  21. package/dist/provider-compats/openai-reasoning.d.ts +7 -5
  22. package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
  23. package/dist/provider-compats/openai.d.ts +7 -5
  24. package/dist/provider-compats/openai.d.ts.map +1 -1
  25. package/dist/schema-compatibility-v3.d.ts +288 -0
  26. package/dist/schema-compatibility-v3.d.ts.map +1 -0
  27. package/dist/schema-compatibility-v4.d.ts +279 -0
  28. package/dist/schema-compatibility-v4.d.ts.map +1 -0
  29. package/dist/schema-compatibility.d.ts +81 -165
  30. package/dist/schema-compatibility.d.ts.map +1 -1
  31. package/dist/types.d.ts +6 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/utils-test-suite.d.ts +2 -0
  34. package/dist/utils-test-suite.d.ts.map +1 -0
  35. package/dist/utils.d.ts +17 -5
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/zod-to-json-test-suite.d.ts +6 -0
  38. package/dist/zod-to-json-test-suite.d.ts.map +1 -0
  39. package/dist/zod-to-json.cjs +12 -0
  40. package/dist/zod-to-json.cjs.map +1 -0
  41. package/dist/zod-to-json.d.ts +6 -0
  42. package/dist/zod-to-json.d.ts.map +1 -0
  43. package/dist/zod-to-json.js +3 -0
  44. package/dist/zod-to-json.js.map +1 -0
  45. package/dist/zodTypes.d.ts +21 -0
  46. package/dist/zodTypes.d.ts.map +1 -0
  47. package/package.json +35 -10
  48. package/.turbo/turbo-build.log +0 -4
  49. package/eslint.config.js +0 -6
  50. package/src/index.ts +0 -39
  51. package/src/provider-compats/anthropic.ts +0 -43
  52. package/src/provider-compats/deepseek.ts +0 -35
  53. package/src/provider-compats/google.ts +0 -63
  54. package/src/provider-compats/meta.ts +0 -36
  55. package/src/provider-compats/openai-reasoning.ts +0 -88
  56. package/src/provider-compats/openai.ts +0 -56
  57. package/src/provider-compats.test.ts +0 -312
  58. package/src/schema-compatibility.test.ts +0 -479
  59. package/src/schema-compatibility.ts +0 -590
  60. package/src/utils.test.ts +0 -442
  61. package/src/utils.ts +0 -205
  62. package/tsconfig.build.json +0 -9
  63. package/tsconfig.json +0 -5
  64. package/tsup.config.ts +0 -22
  65. package/vitest.config.ts +0 -7
@@ -1,167 +1,74 @@
1
- import type { Schema, LanguageModel } from 'ai';
1
+ import type { Schema } from 'ai';
2
2
  import type { JSONSchema7 } from 'json-schema';
3
- import { z, ZodOptional, ZodObject, ZodArray, ZodUnion, ZodString, ZodNumber, ZodDate, ZodDefault, ZodNull } from 'zod';
4
- import type { ZodTypeAny } from 'zod';
3
+ import type { z as zV3 } from 'zod/v3';
4
+ import type { z as zV4, ZodType } from 'zod/v4';
5
5
  import type { Targets } from 'zod-to-json-schema';
6
- export type SchemaCompatModel = Exclude<LanguageModel, string>;
7
- /**
8
- * All supported string validation check types that can be processed or converted to descriptions.
9
- * @constant
10
- */
11
- export declare const ALL_STRING_CHECKS: readonly ["regex", "emoji", "email", "url", "uuid", "cuid", "min", "max"];
12
- /**
13
- * All supported number validation check types that can be processed or converted to descriptions.
14
- * @constant
15
- */
16
- export declare const ALL_NUMBER_CHECKS: readonly ["min", "max", "multipleOf"];
17
- /**
18
- * All supported array validation check types that can be processed or converted to descriptions.
19
- * @constant
20
- */
21
- export declare const ALL_ARRAY_CHECKS: readonly ["min", "max", "length"];
22
- export declare const isOptional: (v: ZodTypeAny) => v is ZodOptional<any>;
23
- export declare const isObj: (v: ZodTypeAny) => v is ZodObject<any, any, any>;
24
- export declare const isNull: (v: ZodTypeAny) => v is ZodNull;
25
- export declare const isArr: (v: ZodTypeAny) => v is ZodArray<any, any>;
26
- export declare const isUnion: (v: ZodTypeAny) => v is ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>;
27
- export declare const isString: (v: ZodTypeAny) => v is ZodString;
28
- export declare const isNumber: (v: ZodTypeAny) => v is ZodNumber;
29
- export declare const isDate: (v: ZodTypeAny) => v is ZodDate;
30
- export declare const isDefault: (v: ZodTypeAny) => v is ZodDefault<any>;
31
- /**
32
- * Zod types that are not supported by most AI model providers and should be avoided.
33
- * @constant
34
- */
35
- export declare const UNSUPPORTED_ZOD_TYPES: readonly ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
36
- /**
37
- * Zod types that are generally supported by AI model providers.
38
- * @constant
39
- */
40
- export declare const SUPPORTED_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault"];
41
- /**
42
- * All Zod types (both supported and unsupported).
43
- * @constant
44
- */
45
- export declare const ALL_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault", "ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
46
- /**
47
- * Type representing string validation checks.
48
- */
49
- export type StringCheckType = (typeof ALL_STRING_CHECKS)[number];
50
- /**
51
- * Type representing number validation checks.
52
- */
53
- export type NumberCheckType = (typeof ALL_NUMBER_CHECKS)[number];
54
- /**
55
- * Type representing array validation checks.
56
- */
57
- export type ArrayCheckType = (typeof ALL_ARRAY_CHECKS)[number];
58
- /**
59
- * Type representing unsupported Zod schema types.
60
- */
61
- export type UnsupportedZodType = (typeof UNSUPPORTED_ZOD_TYPES)[number];
62
- /**
63
- * Type representing supported Zod schema types.
64
- */
65
- export type SupportedZodType = (typeof SUPPORTED_ZOD_TYPES)[number];
66
- /**
67
- * Type representing all Zod schema types (supported and unsupported).
68
- */
69
- export type AllZodType = (typeof ALL_ZOD_TYPES)[number];
70
- /**
71
- * Utility type to extract the shape of a Zod object schema.
72
- */
73
- export type ZodShape<T extends z.AnyZodObject> = T['shape'];
74
- /**
75
- * Utility type to extract the keys from a Zod object shape.
76
- */
77
- export type ShapeKey<T extends z.AnyZodObject> = keyof ZodShape<T>;
78
- /**
79
- * Utility type to extract the value types from a Zod object shape.
80
- */
81
- export type ShapeValue<T extends z.AnyZodObject> = ZodShape<T>[ShapeKey<T>];
82
- type StringConstraints = {
83
- minLength?: number;
84
- maxLength?: number;
85
- email?: boolean;
86
- url?: boolean;
87
- uuid?: boolean;
88
- cuid?: boolean;
89
- emoji?: boolean;
90
- regex?: {
91
- pattern: string;
92
- flags?: string;
93
- };
94
- };
95
- type NumberConstraints = {
96
- gt?: number;
97
- gte?: number;
98
- lt?: number;
99
- lte?: number;
100
- multipleOf?: number;
101
- };
102
- type ArrayConstraints = {
103
- minLength?: number;
104
- maxLength?: number;
105
- exactLength?: number;
106
- };
107
- type DateConstraints = {
108
- minDate?: string;
109
- maxDate?: string;
110
- dateFormat?: string;
111
- };
112
- /**
113
- * Abstract base class for creating schema compatibility layers for different AI model providers.
114
- *
115
- * This class provides a framework for transforming Zod schemas to work with specific AI model
116
- * provider requirements and limitations. Each provider may have different support levels for
117
- * JSON Schema features, validation constraints, and data types.
118
- *
119
- * @abstract
120
- *
121
- * @example
122
- * ```typescript
123
- * import { SchemaCompatLayer } from '@mastra/schema-compat';
124
- * import type { LanguageModelV1 } from 'ai';
125
- *
126
- * class CustomProviderCompat extends SchemaCompatLayer {
127
- * constructor(model: LanguageModelV1) {
128
- * super(model);
129
- * }
130
- *
131
- * shouldApply(): boolean {
132
- * return this.getModel().provider === 'custom-provider';
133
- * }
134
- *
135
- * getSchemaTarget() {
136
- * return 'jsonSchema7';
137
- * }
138
- *
139
- * processZodType<T extends z.AnyZodObject>(value: z.ZodTypeAny): ShapeValue<T> {
140
- * // Custom processing logic for this provider
141
- * switch (value._def.typeName) {
142
- * case 'ZodString':
143
- * return this.defaultZodStringHandler(value, ['email', 'url']);
144
- * default:
145
- * return this.defaultUnsupportedZodTypeHandler(value);
146
- * }
147
- * }
148
- * }
149
- * ```
150
- */
6
+ import type { UnsupportedZodType as UnsupportedZodTypeV3, ShapeValue as ShapeValueV3, StringCheckType, NumberCheckType, ArrayCheckType, AllZodType as AllZodTypeV3 } from './schema-compatibility-v3.js';
7
+ import type { UnsupportedZodType as UnsupportedZodTypeV4, ShapeValue as ShapeValueV4, AllZodType as AllZodTypeV4 } from './schema-compatibility-v4.js';
8
+ import type { ModelInformation } from './types.js';
9
+ type ConstraintHelperText = string[];
151
10
  export declare abstract class SchemaCompatLayer {
152
11
  private model;
12
+ private v3Layer;
13
+ private v4Layer;
153
14
  /**
154
15
  * Creates a new schema compatibility instance.
155
16
  *
156
17
  * @param model - The language model this compatibility layer applies to
157
18
  */
158
- constructor(model: SchemaCompatModel);
19
+ constructor(model: ModelInformation);
159
20
  /**
160
21
  * Gets the language model associated with this compatibility layer.
161
22
  *
162
23
  * @returns The language model instance
163
24
  */
164
- getModel(): SchemaCompatModel;
25
+ getModel(): ModelInformation;
26
+ getUnsupportedZodTypes(v: ZodType): readonly string[];
27
+ /**
28
+ * Type guard for optional Zod types
29
+ */
30
+ isOptional(v: zV4.ZodType): v is zV4.ZodOptional<any>;
31
+ isOptional(v: zV3.ZodType): v is zV3.ZodOptional<any>;
32
+ /**
33
+ * Type guard for object Zod types
34
+ */
35
+ isObj(v: zV4.ZodType): v is zV4.ZodObject<any, any>;
36
+ isObj(v: zV3.ZodType): v is zV3.ZodObject<any, any, any, any, any>;
37
+ /**
38
+ * Type guard for null Zod types
39
+ */
40
+ isNull(v: zV4.ZodType): v is zV4.ZodNull;
41
+ isNull(v: zV3.ZodType): v is zV3.ZodNull;
42
+ /**
43
+ * Type guard for array Zod types
44
+ */
45
+ isArr(v: zV4.ZodType): v is zV4.ZodArray<any>;
46
+ isArr(v: zV3.ZodType): v is zV3.ZodArray<any, any>;
47
+ /**
48
+ * Type guard for union Zod types
49
+ */
50
+ isUnion(v: zV4.ZodType): v is zV4.ZodUnion<[zV4.ZodType, ...zV4.ZodType[]]>;
51
+ isUnion(v: zV3.ZodType): v is zV3.ZodUnion<[zV3.ZodType, ...zV3.ZodType[]]>;
52
+ /**
53
+ * Type guard for string Zod types
54
+ */
55
+ isString(v: zV4.ZodType): v is zV4.ZodString;
56
+ isString(v: zV3.ZodType): v is zV3.ZodString;
57
+ /**
58
+ * Type guard for number Zod types
59
+ */
60
+ isNumber(v: zV4.ZodType): v is zV4.ZodNumber;
61
+ isNumber(v: zV3.ZodType): v is zV3.ZodNumber;
62
+ /**
63
+ * Type guard for date Zod types
64
+ */
65
+ isDate(v: zV4.ZodType): v is zV4.ZodDate;
66
+ isDate(v: zV3.ZodType): v is zV3.ZodDate;
67
+ /**
68
+ * Type guard for default Zod types
69
+ */
70
+ isDefault(v: zV4.ZodType): v is zV4.ZodDefault<any>;
71
+ isDefault(v: zV3.ZodType): v is zV3.ZodDefault<any>;
165
72
  /**
166
73
  * Determines whether this compatibility layer should be applied for the current model.
167
74
  *
@@ -183,16 +90,21 @@ export declare abstract class SchemaCompatLayer {
183
90
  * @returns The processed Zod type
184
91
  * @abstract
185
92
  */
186
- abstract processZodType(value: ZodTypeAny): ZodTypeAny;
93
+ abstract processZodType(value: zV4.ZodType): zV4.ZodType;
94
+ abstract processZodType(value: zV3.ZodType): zV3.ZodType;
95
+ abstract processZodType(value: zV4.ZodType | zV3.ZodType): zV4.ZodType | zV3.ZodType;
187
96
  /**
188
97
  * Default handler for Zod object types. Recursively processes all properties in the object.
189
98
  *
190
99
  * @param value - The Zod object to process
191
100
  * @returns The processed Zod object
192
101
  */
193
- defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
102
+ defaultZodObjectHandler(value: zV4.ZodObject<any, any>, options?: {
103
+ passthrough?: boolean;
104
+ }): zV4.ZodObject<any, any>;
105
+ defaultZodObjectHandler(value: zV3.ZodObject<any, any>, options?: {
194
106
  passthrough?: boolean;
195
- }): ZodObject<any, any, any>;
107
+ }): zV3.ZodObject<any, any>;
196
108
  /**
197
109
  * Merges validation constraints into a parameter description.
198
110
  *
@@ -203,9 +115,7 @@ export declare abstract class SchemaCompatLayer {
203
115
  * @param constraints - The validation constraints to merge
204
116
  * @returns The updated description with constraints, or undefined if no constraints
205
117
  */
206
- mergeParameterDescription(description: string | undefined, constraints: NumberConstraints | StringConstraints | ArrayConstraints | DateConstraints | {
207
- defaultValue?: unknown;
208
- }): string | undefined;
118
+ mergeParameterDescription(description: string | undefined, constraints: ConstraintHelperText): string | undefined;
209
119
  /**
210
120
  * Default handler for unsupported Zod types. Throws an error for specified unsupported types.
211
121
  *
@@ -214,7 +124,7 @@ export declare abstract class SchemaCompatLayer {
214
124
  * @returns The original value if not in the throw list
215
125
  * @throws Error if the type is in the unsupported list
216
126
  */
217
- defaultUnsupportedZodTypeHandler<T extends z.AnyZodObject>(value: z.ZodTypeAny, throwOnTypes?: readonly UnsupportedZodType[]): ShapeValue<T>;
127
+ defaultUnsupportedZodTypeHandler<T extends zV4.ZodObject | zV3.AnyZodObject>(value: T, throwOnTypes?: T extends zV4.ZodObject ? UnsupportedZodTypeV4[] : T extends zV3.AnyZodObject ? UnsupportedZodTypeV3[] : never): T extends zV4.ZodObject ? ShapeValueV4<T> : T extends zV3.AnyZodObject ? ShapeValueV3<T> : never;
218
128
  /**
219
129
  * Default handler for Zod array types. Processes array constraints according to provider support.
220
130
  *
@@ -222,7 +132,8 @@ export declare abstract class SchemaCompatLayer {
222
132
  * @param handleChecks - Array constraints to convert to descriptions vs keep as validation
223
133
  * @returns The processed Zod array
224
134
  */
225
- defaultZodArrayHandler(value: ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): ZodArray<any, any>;
135
+ defaultZodArrayHandler(value: zV4.ZodArray<any>, handleChecks?: readonly ArrayCheckType[]): zV4.ZodArray<any>;
136
+ defaultZodArrayHandler(value: zV3.ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): zV3.ZodArray<any, any>;
226
137
  /**
227
138
  * Default handler for Zod union types. Processes all union options.
228
139
  *
@@ -230,7 +141,8 @@ export declare abstract class SchemaCompatLayer {
230
141
  * @returns The processed Zod union
231
142
  * @throws Error if union has fewer than 2 options
232
143
  */
233
- defaultZodUnionHandler(value: ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>): ZodTypeAny;
144
+ defaultZodUnionHandler(value: zV4.ZodUnion<[zV4.ZodType, ...zV4.ZodType[]]>): zV4.ZodType;
145
+ defaultZodUnionHandler(value: zV3.ZodUnion<[zV3.ZodType, ...zV3.ZodType[]]>): zV3.ZodType;
234
146
  /**
235
147
  * Default handler for Zod string types. Processes string validation constraints.
236
148
  *
@@ -238,7 +150,8 @@ export declare abstract class SchemaCompatLayer {
238
150
  * @param handleChecks - String constraints to convert to descriptions vs keep as validation
239
151
  * @returns The processed Zod string
240
152
  */
241
- defaultZodStringHandler(value: ZodString, handleChecks?: readonly StringCheckType[]): ZodString;
153
+ defaultZodStringHandler(value: zV4.ZodString, handleChecks?: readonly StringCheckType[]): zV4.ZodString;
154
+ defaultZodStringHandler(value: zV3.ZodString, handleChecks?: readonly StringCheckType[]): zV3.ZodString;
242
155
  /**
243
156
  * Default handler for Zod number types. Processes number validation constraints.
244
157
  *
@@ -246,14 +159,16 @@ export declare abstract class SchemaCompatLayer {
246
159
  * @param handleChecks - Number constraints to convert to descriptions vs keep as validation
247
160
  * @returns The processed Zod number
248
161
  */
249
- defaultZodNumberHandler(value: ZodNumber, handleChecks?: readonly NumberCheckType[]): ZodNumber;
162
+ defaultZodNumberHandler(value: zV4.ZodNumber, handleChecks?: readonly NumberCheckType[]): zV4.ZodNumber;
163
+ defaultZodNumberHandler(value: zV3.ZodNumber, handleChecks?: readonly NumberCheckType[]): zV3.ZodNumber;
250
164
  /**
251
165
  * Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
252
166
  *
253
167
  * @param value - The Zod date to process
254
168
  * @returns A Zod string schema representing the date in ISO format
255
169
  */
256
- defaultZodDateHandler(value: ZodDate): ZodString;
170
+ defaultZodDateHandler(value: zV4.ZodDate): zV4.ZodString;
171
+ defaultZodDateHandler(value: zV3.ZodDate): zV3.ZodString;
257
172
  /**
258
173
  * Default handler for Zod optional types. Processes the inner type and maintains optionality.
259
174
  *
@@ -261,21 +176,22 @@ export declare abstract class SchemaCompatLayer {
261
176
  * @param handleTypes - Types that should be processed vs passed through
262
177
  * @returns The processed Zod optional
263
178
  */
264
- defaultZodOptionalHandler(value: ZodOptional<any>, handleTypes?: readonly AllZodType[]): ZodTypeAny;
179
+ defaultZodOptionalHandler(value: zV4.ZodOptional<any>, handleTypes?: readonly AllZodTypeV4[]): zV4.ZodType;
180
+ defaultZodOptionalHandler(value: zV3.ZodOptional<any>, handleTypes?: readonly AllZodTypeV3[]): zV3.ZodType;
265
181
  /**
266
182
  * Processes a Zod object schema and converts it to an AI SDK Schema.
267
183
  *
268
184
  * @param zodSchema - The Zod object schema to process
269
185
  * @returns An AI SDK Schema with provider-specific compatibility applied
270
186
  */
271
- processToAISDKSchema(zodSchema: z.ZodSchema): Schema;
187
+ processToAISDKSchema(zodSchema: zV3.ZodSchema | zV4.ZodType): Schema;
272
188
  /**
273
189
  * Processes a Zod object schema and converts it to a JSON Schema.
274
190
  *
275
191
  * @param zodSchema - The Zod object schema to process
276
192
  * @returns A JSONSchema7 object with provider-specific compatibility applied
277
193
  */
278
- processToJSONSchema(zodSchema: z.ZodSchema): JSONSchema7;
194
+ processToJSONSchema(zodSchema: zV3.ZodSchema | zV4.ZodType): JSONSchema7;
279
195
  }
280
196
  export {};
281
197
  //# sourceMappingURL=schema-compatibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-compatibility.d.ts","sourceRoot":"","sources":["../src/schema-compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACxH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2EAA4E,CAAC;AAE3G;;;GAGG;AACH,eAAO,MAAM,iBAAiB,uCAIpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,gBAAgB,mCAAoC,CAAC;AAElE,eAAO,MAAM,UAAU,GAAI,GAAG,UAAU,KAAG,CAAC,IAAI,WAAW,CAAC,GAAG,CAA6B,CAAC;AAC7F,eAAO,MAAM,KAAK,GAAI,GAAG,UAAU,KAAG,CAAC,IAAI,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAA2B,CAAC;AAC9F,eAAO,MAAM,MAAM,GAAI,GAAG,UAAU,KAA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;;;OAMG;IACI,uBAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,GAAG,GAAG,CAAC,SAAS;IACvG,uBAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,GAAG,GAAG,CAAC,SAAS;IAY9G;;;;;OAKG;IACI,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,SAAS;IACxD,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,SAAS;IAS/D;;;;;;OAMG;IACI,yBAAyB,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,OAAO;IAC1G,yBAAyB,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,OAAO;IAYjH;;;;;OAKG;IACI,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,GAAG,MAAM;IAM3E;;;;;OAKG;IACI,mBAAmB,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,GAAG,WAAW;CAGhF"}
@@ -0,0 +1,6 @@
1
+ export type ModelInformation = {
2
+ modelId: string;
3
+ provider: string;
4
+ supportsStructuredOutputs: boolean;
5
+ };
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB,EAAE,OAAO,CAAC;CACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runTestSuite(): void;
2
+ //# sourceMappingURL=utils-test-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-test-suite.d.ts","sourceRoot":"","sources":["../src/utils-test-suite.ts"],"names":[],"mappings":"AAgDA,wBAAgB,YAAY,SAka3B"}
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { Schema } from 'ai';
2
2
  import type { JSONSchema7 } from 'json-schema';
3
- import type { z, ZodSchema } from 'zod';
3
+ import type { ZodSchema as ZodSchemaV3, ZodType as ZodTypeV3 } from 'zod/v3';
4
+ import type { ZodType as ZodSchemaV4, ZodType as ZodTypeV4 } from 'zod/v4';
4
5
  import type { Targets } from 'zod-to-json-schema';
5
- import type { SchemaCompatLayer } from './schema-compatibility';
6
+ import type { SchemaCompatLayer } from './schema-compatibility.js';
7
+ type ZodSchema = ZodSchemaV3 | ZodSchemaV4;
8
+ type ZodType = ZodTypeV3 | ZodTypeV4;
6
9
  /**
7
10
  * Converts a Zod schema to an AI SDK Schema with validation support.
8
11
  *
@@ -27,6 +30,14 @@ import type { SchemaCompatLayer } from './schema-compatibility';
27
30
  * ```
28
31
  */
29
32
  export declare function convertZodSchemaToAISDKSchema(zodSchema: ZodSchema, target?: Targets): Schema<any>;
33
+ /**
34
+ * Checks if a value is a Zod type by examining its properties and methods.
35
+ *
36
+ * @param value - The value to check
37
+ * @returns True if the value is a Zod type, false otherwise
38
+ * @internal
39
+ */
40
+ export declare function isZodType(value: unknown): value is ZodType;
30
41
  /**
31
42
  * Converts an AI SDK Schema or Zod schema to a Zod schema.
32
43
  *
@@ -52,7 +63,7 @@ export declare function convertZodSchemaToAISDKSchema(zodSchema: ZodSchema, targ
52
63
  * const zodSchema = convertSchemaToZod(aiSchema);
53
64
  * ```
54
65
  */
55
- export declare function convertSchemaToZod(schema: Schema | z.ZodSchema): z.ZodType;
66
+ export declare function convertSchemaToZod(schema: Schema | ZodSchema): ZodType;
56
67
  /**
57
68
  * Processes a schema using provider compatibility layers and converts it to an AI SDK Schema.
58
69
  *
@@ -63,7 +74,7 @@ export declare function convertSchemaToZod(schema: Schema | z.ZodSchema): z.ZodT
63
74
  * @returns Processed schema as an AI SDK Schema
64
75
  */
65
76
  export declare function applyCompatLayer(options: {
66
- schema: Schema | z.ZodSchema;
77
+ schema: Schema | ZodSchema;
67
78
  compatLayers: SchemaCompatLayer[];
68
79
  mode: 'aiSdkSchema';
69
80
  }): Schema;
@@ -77,8 +88,9 @@ export declare function applyCompatLayer(options: {
77
88
  * @returns Processed schema as a JSONSchema7
78
89
  */
79
90
  export declare function applyCompatLayer(options: {
80
- schema: Schema | z.ZodSchema;
91
+ schema: Schema | ZodSchema;
81
92
  compatLayers: SchemaCompatLayer[];
82
93
  mode: 'jsonSchema';
83
94
  }): JSONSchema7;
95
+ export {};
84
96
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,GAAE,OAAuB,eAalG;AAsBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAa1E;AAED;;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G;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAkBtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,MAAM,CAAC;AAEX;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,IAAI,EAAE,YAAY,CAAC;CACpB,GAAG,WAAW,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared test suite for zodToJsonSchema that runs with both Zod v3 and v4.
3
+ * The importing test file should mock 'zod' to either v3 or v4 before calling this.
4
+ */
5
+ export declare function runZodToJsonTestSuite(): void;
6
+ //# sourceMappingURL=zod-to-json-test-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-to-json-test-suite.d.ts","sourceRoot":"","sources":["../src/zod-to-json-test-suite.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,qBAAqB,SA8jBpC"}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunk5WM4A32G_cjs = require('./chunk-5WM4A32G.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "zodToJsonSchema", {
8
+ enumerable: true,
9
+ get: function () { return chunk5WM4A32G_cjs.zodToJsonSchema; }
10
+ });
11
+ //# sourceMappingURL=zod-to-json.cjs.map
12
+ //# sourceMappingURL=zod-to-json.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"zod-to-json.cjs"}
@@ -0,0 +1,6 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ import type { ZodSchema as ZodSchemaV3 } from 'zod/v3';
3
+ import type { ZodType as ZodSchemaV4 } from 'zod/v4';
4
+ import type { Targets } from 'zod-to-json-schema';
5
+ export declare function zodToJsonSchema(zodSchema: ZodSchemaV3 | ZodSchemaV4, target?: Targets, strategy?: 'none' | 'seen' | 'root' | 'relative'): JSONSchema7;
6
+ //# sourceMappingURL=zod-to-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-to-json.d.ts","sourceRoot":"","sources":["../src/zod-to-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAmFlD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,WAAW,GAAG,WAAW,EACpC,MAAM,GAAE,OAAuB,EAC/B,QAAQ,GAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAuB,eA2B7D"}
@@ -0,0 +1,3 @@
1
+ export { zodToJsonSchema } from './chunk-U2HXWNAF.js';
2
+ //# sourceMappingURL=zod-to-json.js.map
3
+ //# sourceMappingURL=zod-to-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"zod-to-json.js"}
@@ -0,0 +1,21 @@
1
+ import type { z as zV3 } from 'zod/v3';
2
+ import type { z as zV4 } from 'zod/v4';
3
+ export declare function isOptional<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodOptional<any>;
4
+ export declare function isOptional<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodOptional<any>;
5
+ export declare function isObj<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodObject<any>;
6
+ export declare function isObj<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodObject;
7
+ export declare function isNull<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodNull;
8
+ export declare function isNull<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodNull;
9
+ export declare function isArr<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodArray<any>;
10
+ export declare function isArr<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodArray;
11
+ export declare function isUnion<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodUnion<any>;
12
+ export declare function isUnion<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodUnion;
13
+ export declare function isString<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodString;
14
+ export declare function isString<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodString;
15
+ export declare function isNumber<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodNumber;
16
+ export declare function isNumber<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodNumber;
17
+ export declare function isDate<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodDate;
18
+ export declare function isDate<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodDate;
19
+ export declare function isDefault<Z extends typeof zV3>(z: Z): (v: any) => v is zV3.ZodDefault<any>;
20
+ export declare function isDefault<Z extends typeof zV4>(z: Z): (v: any) => v is zV4.ZodDefault;
21
+ //# sourceMappingURL=zodTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodTypes.d.ts","sourceRoot":"","sources":["../src/zodTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC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U,CAAC,GAAG,CAAC,CAAC;AAC5F,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@mastra/schema-compat",
3
- "version": "0.0.0-ai-v5-20250801192614",
3
+ "version": "0.0.0-bundle-recursion-20251030002519",
4
4
  "description": "Tool schema compatibility layer for Mastra.ai",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "CHANGELOG.md"
11
+ ],
8
12
  "exports": {
9
13
  ".": {
10
14
  "import": {
@@ -12,10 +16,20 @@
12
16
  "default": "./dist/index.js"
13
17
  },
14
18
  "require": {
15
- "types": "./dist/index.d.cts",
19
+ "types": "./dist/index.d.ts",
16
20
  "default": "./dist/index.cjs"
17
21
  }
18
22
  },
23
+ "./zod-to-json": {
24
+ "import": {
25
+ "types": "./dist/zod-to-json.d.ts",
26
+ "default": "./dist/zod-to-json.js"
27
+ },
28
+ "require": {
29
+ "types": "./dist/zod-to-json.d.ts",
30
+ "default": "./dist/zod-to-json.cjs"
31
+ }
32
+ },
19
33
  "./package.json": "./package.json"
20
34
  },
21
35
  "keywords": [
@@ -29,23 +43,34 @@
29
43
  "license": "Apache-2.0",
30
44
  "dependencies": {
31
45
  "json-schema": "^0.4.0",
32
- "zod-from-json-schema": "^0.0.5",
33
- "zod-to-json-schema": "^3.24.5"
46
+ "zod-from-json-schema": "^0.5.0",
47
+ "zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5",
48
+ "zod-to-json-schema": "^3.24.6"
34
49
  },
35
50
  "peerDependencies": {
36
- "ai": "^5.0.0",
37
- "zod": "^3.0.0"
51
+ "ai": "^4.0.0 || ^5.0.0",
52
+ "zod": "^3.25.0 || ^4.0.0"
38
53
  },
39
54
  "devDependencies": {
40
55
  "@types/json-schema": "^7.0.15",
41
- "ai": "latest",
42
56
  "@types/node": "^20.19.0",
43
- "eslint": "^9.30.1",
57
+ "ai": "4.3.16",
58
+ "eslint": "^9.37.0",
44
59
  "tsup": "^8.5.0",
45
60
  "typescript": "^5.8.3",
46
61
  "vitest": "^3.2.4",
47
- "zod": "^3.25.67",
48
- "@internal/lint": "0.0.0-ai-v5-20250801192614"
62
+ "zod": "^3.25.76",
63
+ "@internal/lint": "0.0.0-bundle-recursion-20251030002519",
64
+ "@internal/types-builder": "0.0.0-bundle-recursion-20251030002519"
65
+ },
66
+ "homepage": "https://mastra.ai",
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "git+https://github.com/mastra-ai/mastra.git",
70
+ "directory": "packages/schema-compat"
71
+ },
72
+ "bugs": {
73
+ "url": "https://github.com/mastra-ai/mastra/issues"
49
74
  },
50
75
  "scripts": {
51
76
  "build": "tsup --silent --config tsup.config.ts",
@@ -1,4 +0,0 @@
1
-
2
- > @mastra/schema-compat@0.10.5 build /home/runner/work/mastra/mastra/packages/schema-compat
3
- > tsup --silent --config tsup.config.ts
4
-
package/eslint.config.js DELETED
@@ -1,6 +0,0 @@
1
- import { createConfig } from '@internal/lint/eslint';
2
-
3
- const config = await createConfig();
4
-
5
- /** @type {import("eslint").Linter.Config[]} */
6
- export default [...config];