@mastra/schema-compat 0.0.0-ai-v5-20250801192614 → 0.0.0-consolidate-changesets-20250904042643

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 (63) hide show
  1. package/CHANGELOG.md +133 -2
  2. package/README.md +0 -4
  3. package/dist/chunk-F4D2N3FC.js +28 -0
  4. package/dist/chunk-F4D2N3FC.js.map +1 -0
  5. package/dist/chunk-WRGSGOLQ.cjs +34 -0
  6. package/dist/chunk-WRGSGOLQ.cjs.map +1 -0
  7. package/dist/index.cjs +845 -92
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +3 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +844 -93
  12. package/dist/index.js.map +1 -1
  13. package/dist/provider-compats/anthropic.d.ts +6 -4
  14. package/dist/provider-compats/anthropic.d.ts.map +1 -1
  15. package/dist/provider-compats/deepseek.d.ts +6 -4
  16. package/dist/provider-compats/deepseek.d.ts.map +1 -1
  17. package/dist/provider-compats/google.d.ts +6 -4
  18. package/dist/provider-compats/google.d.ts.map +1 -1
  19. package/dist/provider-compats/meta.d.ts +6 -4
  20. package/dist/provider-compats/meta.d.ts.map +1 -1
  21. package/dist/provider-compats/openai-reasoning.d.ts +6 -4
  22. package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
  23. package/dist/provider-compats/openai.d.ts +6 -4
  24. package/dist/provider-compats/openai.d.ts.map +1 -1
  25. package/dist/schema-compatibility-v3.d.ts +319 -0
  26. package/dist/schema-compatibility-v3.d.ts.map +1 -0
  27. package/dist/schema-compatibility-v4.d.ts +310 -0
  28. package/dist/schema-compatibility-v4.d.ts.map +1 -0
  29. package/dist/schema-compatibility.d.ts +79 -132
  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 +16 -4
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/zod-to-json.cjs +12 -0
  38. package/dist/zod-to-json.cjs.map +1 -0
  39. package/dist/zod-to-json.d.ts +6 -0
  40. package/dist/zod-to-json.d.ts.map +1 -0
  41. package/dist/zod-to-json.js +3 -0
  42. package/dist/zod-to-json.js.map +1 -0
  43. package/dist/zodTypes.d.ts +21 -0
  44. package/dist/zodTypes.d.ts.map +1 -0
  45. package/package.json +33 -9
  46. package/.turbo/turbo-build.log +0 -4
  47. package/eslint.config.js +0 -6
  48. package/src/index.ts +0 -39
  49. package/src/provider-compats/anthropic.ts +0 -43
  50. package/src/provider-compats/deepseek.ts +0 -35
  51. package/src/provider-compats/google.ts +0 -63
  52. package/src/provider-compats/meta.ts +0 -36
  53. package/src/provider-compats/openai-reasoning.ts +0 -88
  54. package/src/provider-compats/openai.ts +0 -56
  55. package/src/provider-compats.test.ts +0 -312
  56. package/src/schema-compatibility.test.ts +0 -479
  57. package/src/schema-compatibility.ts +0 -590
  58. package/src/utils.test.ts +0 -442
  59. package/src/utils.ts +0 -205
  60. package/tsconfig.build.json +0 -9
  61. package/tsconfig.json +0 -5
  62. package/tsup.config.ts +0 -22
  63. package/vitest.config.ts +0 -7
@@ -1,84 +1,10 @@
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>];
6
+ import type { UnsupportedZodType as UnsupportedZodTypeV3, ShapeValue as ShapeValueV3, StringCheckType, NumberCheckType, ArrayCheckType, AllZodType as AllZodTypeV3 } from './schema-compatibility-v3';
7
+ import type { UnsupportedZodType as UnsupportedZodTypeV4, ShapeValue as ShapeValueV4, AllZodType as AllZodTypeV4 } from './schema-compatibility-v4';
82
8
  type StringConstraints = {
83
9
  minLength?: number;
84
10
  maxLength?: number;
@@ -109,59 +35,69 @@ type DateConstraints = {
109
35
  maxDate?: string;
110
36
  dateFormat?: string;
111
37
  };
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
- */
38
+ import type { ModelInformation } from './types';
151
39
  export declare abstract class SchemaCompatLayer {
152
40
  private model;
41
+ private v3Layer;
42
+ private v4Layer;
153
43
  /**
154
44
  * Creates a new schema compatibility instance.
155
45
  *
156
46
  * @param model - The language model this compatibility layer applies to
157
47
  */
158
- constructor(model: SchemaCompatModel);
48
+ constructor(model: ModelInformation);
159
49
  /**
160
50
  * Gets the language model associated with this compatibility layer.
161
51
  *
162
52
  * @returns The language model instance
163
53
  */
164
- getModel(): SchemaCompatModel;
54
+ getModel(): ModelInformation;
55
+ getUnsupportedZodTypes(v: ZodType): readonly string[];
56
+ /**
57
+ * Type guard for optional Zod types
58
+ */
59
+ isOptional(v: zV4.ZodType): v is zV4.ZodOptional<any>;
60
+ isOptional(v: zV3.ZodType): v is zV3.ZodOptional<any>;
61
+ /**
62
+ * Type guard for object Zod types
63
+ */
64
+ isObj(v: zV4.ZodType): v is zV4.ZodObject<any, any>;
65
+ isObj(v: zV3.ZodType): v is zV3.ZodObject<any, any, any, any, any>;
66
+ /**
67
+ * Type guard for null Zod types
68
+ */
69
+ isNull(v: zV4.ZodType): v is zV4.ZodNull;
70
+ isNull(v: zV3.ZodType): v is zV3.ZodNull;
71
+ /**
72
+ * Type guard for array Zod types
73
+ */
74
+ isArr(v: zV4.ZodType): v is zV4.ZodArray<any>;
75
+ isArr(v: zV3.ZodType): v is zV3.ZodArray<any, any>;
76
+ /**
77
+ * Type guard for union Zod types
78
+ */
79
+ isUnion(v: zV4.ZodType): v is zV4.ZodUnion<[zV4.ZodType, ...zV4.ZodType[]]>;
80
+ isUnion(v: zV3.ZodType): v is zV3.ZodUnion<[zV3.ZodType, ...zV3.ZodType[]]>;
81
+ /**
82
+ * Type guard for string Zod types
83
+ */
84
+ isString(v: zV4.ZodType): v is zV4.ZodString;
85
+ isString(v: zV3.ZodType): v is zV3.ZodString;
86
+ /**
87
+ * Type guard for number Zod types
88
+ */
89
+ isNumber(v: zV4.ZodType): v is zV4.ZodNumber;
90
+ isNumber(v: zV3.ZodType): v is zV3.ZodNumber;
91
+ /**
92
+ * Type guard for date Zod types
93
+ */
94
+ isDate(v: zV4.ZodType): v is zV4.ZodDate;
95
+ isDate(v: zV3.ZodType): v is zV3.ZodDate;
96
+ /**
97
+ * Type guard for default Zod types
98
+ */
99
+ isDefault(v: zV4.ZodType): v is zV4.ZodDefault<any>;
100
+ isDefault(v: zV3.ZodType): v is zV3.ZodDefault<any>;
165
101
  /**
166
102
  * Determines whether this compatibility layer should be applied for the current model.
167
103
  *
@@ -183,16 +119,21 @@ export declare abstract class SchemaCompatLayer {
183
119
  * @returns The processed Zod type
184
120
  * @abstract
185
121
  */
186
- abstract processZodType(value: ZodTypeAny): ZodTypeAny;
122
+ abstract processZodType(value: zV4.ZodType): zV4.ZodType;
123
+ abstract processZodType(value: zV3.ZodType): zV3.ZodType;
124
+ abstract processZodType(value: zV4.ZodType | zV3.ZodType): zV4.ZodType | zV3.ZodType;
187
125
  /**
188
126
  * Default handler for Zod object types. Recursively processes all properties in the object.
189
127
  *
190
128
  * @param value - The Zod object to process
191
129
  * @returns The processed Zod object
192
130
  */
193
- defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
131
+ defaultZodObjectHandler(value: zV4.ZodObject<any, any>, options?: {
132
+ passthrough?: boolean;
133
+ }): zV4.ZodObject<any, any>;
134
+ defaultZodObjectHandler(value: zV3.ZodObject<any, any>, options?: {
194
135
  passthrough?: boolean;
195
- }): ZodObject<any, any, any>;
136
+ }): zV3.ZodObject<any, any>;
196
137
  /**
197
138
  * Merges validation constraints into a parameter description.
198
139
  *
@@ -214,7 +155,7 @@ export declare abstract class SchemaCompatLayer {
214
155
  * @returns The original value if not in the throw list
215
156
  * @throws Error if the type is in the unsupported list
216
157
  */
217
- defaultUnsupportedZodTypeHandler<T extends z.AnyZodObject>(value: z.ZodTypeAny, throwOnTypes?: readonly UnsupportedZodType[]): ShapeValue<T>;
158
+ 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
159
  /**
219
160
  * Default handler for Zod array types. Processes array constraints according to provider support.
220
161
  *
@@ -222,7 +163,8 @@ export declare abstract class SchemaCompatLayer {
222
163
  * @param handleChecks - Array constraints to convert to descriptions vs keep as validation
223
164
  * @returns The processed Zod array
224
165
  */
225
- defaultZodArrayHandler(value: ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): ZodArray<any, any>;
166
+ defaultZodArrayHandler(value: zV4.ZodArray<any>, handleChecks?: readonly ArrayCheckType[]): zV4.ZodArray<any>;
167
+ defaultZodArrayHandler(value: zV3.ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): zV3.ZodArray<any, any>;
226
168
  /**
227
169
  * Default handler for Zod union types. Processes all union options.
228
170
  *
@@ -230,7 +172,8 @@ export declare abstract class SchemaCompatLayer {
230
172
  * @returns The processed Zod union
231
173
  * @throws Error if union has fewer than 2 options
232
174
  */
233
- defaultZodUnionHandler(value: ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>): ZodTypeAny;
175
+ defaultZodUnionHandler(value: zV4.ZodUnion<[zV4.ZodType, ...zV4.ZodType[]]>): zV4.ZodType;
176
+ defaultZodUnionHandler(value: zV3.ZodUnion<[zV3.ZodType, ...zV3.ZodType[]]>): zV3.ZodType;
234
177
  /**
235
178
  * Default handler for Zod string types. Processes string validation constraints.
236
179
  *
@@ -238,7 +181,8 @@ export declare abstract class SchemaCompatLayer {
238
181
  * @param handleChecks - String constraints to convert to descriptions vs keep as validation
239
182
  * @returns The processed Zod string
240
183
  */
241
- defaultZodStringHandler(value: ZodString, handleChecks?: readonly StringCheckType[]): ZodString;
184
+ defaultZodStringHandler(value: zV4.ZodString, handleChecks?: readonly StringCheckType[]): zV4.ZodString;
185
+ defaultZodStringHandler(value: zV3.ZodString, handleChecks?: readonly StringCheckType[]): zV3.ZodString;
242
186
  /**
243
187
  * Default handler for Zod number types. Processes number validation constraints.
244
188
  *
@@ -246,14 +190,16 @@ export declare abstract class SchemaCompatLayer {
246
190
  * @param handleChecks - Number constraints to convert to descriptions vs keep as validation
247
191
  * @returns The processed Zod number
248
192
  */
249
- defaultZodNumberHandler(value: ZodNumber, handleChecks?: readonly NumberCheckType[]): ZodNumber;
193
+ defaultZodNumberHandler(value: zV4.ZodNumber, handleChecks?: readonly NumberCheckType[]): zV4.ZodNumber;
194
+ defaultZodNumberHandler(value: zV3.ZodNumber, handleChecks?: readonly NumberCheckType[]): zV3.ZodNumber;
250
195
  /**
251
196
  * Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
252
197
  *
253
198
  * @param value - The Zod date to process
254
199
  * @returns A Zod string schema representing the date in ISO format
255
200
  */
256
- defaultZodDateHandler(value: ZodDate): ZodString;
201
+ defaultZodDateHandler(value: zV4.ZodDate): zV4.ZodString;
202
+ defaultZodDateHandler(value: zV3.ZodDate): zV3.ZodString;
257
203
  /**
258
204
  * Default handler for Zod optional types. Processes the inner type and maintains optionality.
259
205
  *
@@ -261,21 +207,22 @@ export declare abstract class SchemaCompatLayer {
261
207
  * @param handleTypes - Types that should be processed vs passed through
262
208
  * @returns The processed Zod optional
263
209
  */
264
- defaultZodOptionalHandler(value: ZodOptional<any>, handleTypes?: readonly AllZodType[]): ZodTypeAny;
210
+ defaultZodOptionalHandler(value: zV4.ZodOptional<any>, handleTypes?: readonly AllZodTypeV4[]): zV4.ZodType;
211
+ defaultZodOptionalHandler(value: zV3.ZodOptional<any>, handleTypes?: readonly AllZodTypeV3[]): zV3.ZodType;
265
212
  /**
266
213
  * Processes a Zod object schema and converts it to an AI SDK Schema.
267
214
  *
268
215
  * @param zodSchema - The Zod object schema to process
269
216
  * @returns An AI SDK Schema with provider-specific compatibility applied
270
217
  */
271
- processToAISDKSchema(zodSchema: z.ZodSchema): Schema;
218
+ processToAISDKSchema(zodSchema: zV3.ZodSchema | zV4.ZodType): Schema;
272
219
  /**
273
220
  * Processes a Zod object schema and converts it to a JSON Schema.
274
221
  *
275
222
  * @param zodSchema - The Zod object schema to process
276
223
  * @returns A JSONSchema7 object with provider-specific compatibility applied
277
224
  */
278
- processToJSONSchema(zodSchema: z.ZodSchema): JSONSchema7;
225
+ processToJSONSchema(zodSchema: zV3.ZodSchema | zV4.ZodType): JSONSchema7;
279
226
  }
280
227
  export {};
281
228
  //# 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;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: 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
6
  import type { SchemaCompatLayer } from './schema-compatibility';
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;A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;;;;;;;;;;GAsBG;AAEH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,GAAE,OAAuB,eASlG;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAW1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,12 @@
1
+ 'use strict';
2
+
3
+ var chunkWRGSGOLQ_cjs = require('./chunk-WRGSGOLQ.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "zodToJsonSchema", {
8
+ enumerable: true,
9
+ get: function () { return chunkWRGSGOLQ_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): 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;AAGlD,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,EAAE,MAAM,GAAE,OAAuB,eAsBpG"}
@@ -0,0 +1,3 @@
1
+ export { zodToJsonSchema } from './chunk-F4D2N3FC.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,WAAW,CAAC,GAAG,CAAC,CAAC;AAC9F,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAK9F,wBAA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1
1
  {
2
2
  "name": "@mastra/schema-compat",
3
- "version": "0.0.0-ai-v5-20250801192614",
3
+ "version": "0.0.0-consolidate-changesets-20250904042643",
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,33 @@
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",
57
+ "ai": "4.3.16",
43
58
  "eslint": "^9.30.1",
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-consolidate-changesets-20250904042643"
64
+ },
65
+ "homepage": "https://mastra.ai",
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/mastra-ai/mastra.git",
69
+ "directory": "packages/schema-compat"
70
+ },
71
+ "bugs": {
72
+ "url": "https://github.com/mastra-ai/mastra/issues"
49
73
  },
50
74
  "scripts": {
51
75
  "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];
package/src/index.ts DELETED
@@ -1,39 +0,0 @@
1
- // Schema compatibility base class and related types
2
- export {
3
- SchemaCompatLayer,
4
- // Constants
5
- ALL_STRING_CHECKS,
6
- ALL_NUMBER_CHECKS,
7
- ALL_ARRAY_CHECKS,
8
- UNSUPPORTED_ZOD_TYPES,
9
- SUPPORTED_ZOD_TYPES,
10
- ALL_ZOD_TYPES,
11
- // Types
12
- type StringCheckType,
13
- type NumberCheckType,
14
- type ArrayCheckType,
15
- type UnsupportedZodType,
16
- type SupportedZodType,
17
- type AllZodType,
18
- type ZodShape,
19
- type ShapeKey,
20
- type ShapeValue,
21
- // Re-usable type predicates
22
- isOptional,
23
- isObj,
24
- isArr,
25
- isUnion,
26
- isString,
27
- isNumber,
28
- } from './schema-compatibility';
29
-
30
- // Utility functions
31
- export { convertZodSchemaToAISDKSchema, applyCompatLayer, convertSchemaToZod } from './utils';
32
-
33
- // Provider compatibility implementations
34
- export { AnthropicSchemaCompatLayer } from './provider-compats/anthropic';
35
- export { DeepSeekSchemaCompatLayer } from './provider-compats/deepseek';
36
- export { GoogleSchemaCompatLayer } from './provider-compats/google';
37
- export { MetaSchemaCompatLayer } from './provider-compats/meta';
38
- export { OpenAISchemaCompatLayer } from './provider-compats/openai';
39
- export { OpenAIReasoningSchemaCompatLayer } from './provider-compats/openai-reasoning';