@mastra/schema-compat 0.10.2-alpha.2 → 0.10.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +6 -0
- package/dist/_tsup-dts-rollup.d.cts +55 -26
- package/dist/_tsup-dts-rollup.d.ts +55 -26
- package/dist/index.cjs +178 -240
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +174 -242
- package/package.json +3 -3
- package/src/index.ts +7 -0
- package/src/provider-compats/anthropic.ts +27 -32
- package/src/provider-compats/deepseek.ts +15 -21
- package/src/provider-compats/google.ts +34 -33
- package/src/provider-compats/meta.ts +17 -24
- package/src/provider-compats/openai-reasoning.ts +51 -50
- package/src/provider-compats/openai.ts +28 -33
- package/src/schema-compatibility.test.ts +161 -40
- package/src/schema-compatibility.ts +83 -91
- package/src/utils.test.ts +129 -23
- package/src/utils.ts +8 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/schema-compat@0.10.2-alpha.
|
|
2
|
+
> @mastra/schema-compat@0.10.2-alpha.3 build /home/runner/work/mastra/mastra/packages/schema-compat
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 2363ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1947ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in 175ms
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[32m22.37 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m21.03 KB[39m
|
|
23
21
|
[32mESM[39m ⚡️ Build success in 175ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m21.65 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 175ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/schema-compat
|
|
2
2
|
|
|
3
|
+
## 0.10.2-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f6fd25f: Updates @mastra/schema-compat to allow all zod schemas. Uses @mastra/schema-compat to apply schema transformations to agent output schema.
|
|
8
|
+
|
|
3
9
|
## 0.10.2-alpha.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -3,7 +3,16 @@ import type { LanguageModelV1 } from 'ai';
|
|
|
3
3
|
import type { Schema } from 'ai';
|
|
4
4
|
import type { Targets } from 'zod-to-json-schema';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { ZodArray } from 'zod';
|
|
7
|
+
import { ZodDate } from 'zod';
|
|
8
|
+
import { ZodDefault } from 'zod';
|
|
9
|
+
import { ZodNumber } from 'zod';
|
|
10
|
+
import { ZodObject } from 'zod';
|
|
11
|
+
import { ZodOptional } from 'zod';
|
|
6
12
|
import type { ZodSchema } from 'zod';
|
|
13
|
+
import { ZodString } from 'zod';
|
|
14
|
+
import type { ZodTypeAny } from 'zod';
|
|
15
|
+
import { ZodUnion } from 'zod';
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
18
|
* All supported array validation check types that can be processed or converted to descriptions.
|
|
@@ -48,7 +57,7 @@ declare class AnthropicSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
48
57
|
constructor(model: LanguageModelV1);
|
|
49
58
|
getSchemaTarget(): Targets | undefined;
|
|
50
59
|
shouldApply(): boolean;
|
|
51
|
-
processZodType
|
|
60
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
52
61
|
}
|
|
53
62
|
export { AnthropicSchemaCompatLayer }
|
|
54
63
|
export { AnthropicSchemaCompatLayer as AnthropicSchemaCompatLayer_alias_1 }
|
|
@@ -63,7 +72,7 @@ export { AnthropicSchemaCompatLayer as AnthropicSchemaCompatLayer_alias_1 }
|
|
|
63
72
|
* @returns Processed schema as an AI SDK Schema
|
|
64
73
|
*/
|
|
65
74
|
declare function applyCompatLayer(options: {
|
|
66
|
-
schema: Schema | z.
|
|
75
|
+
schema: Schema | z.ZodSchema;
|
|
67
76
|
compatLayers: SchemaCompatLayer[];
|
|
68
77
|
mode: 'aiSdkSchema';
|
|
69
78
|
}): Schema;
|
|
@@ -78,7 +87,7 @@ declare function applyCompatLayer(options: {
|
|
|
78
87
|
* @returns Processed schema as a JSONSchema7
|
|
79
88
|
*/
|
|
80
89
|
declare function applyCompatLayer(options: {
|
|
81
|
-
schema: Schema | z.
|
|
90
|
+
schema: Schema | z.ZodSchema;
|
|
82
91
|
compatLayers: SchemaCompatLayer[];
|
|
83
92
|
mode: 'jsonSchema';
|
|
84
93
|
}): JSONSchema7;
|
|
@@ -164,7 +173,7 @@ declare class DeepSeekSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
164
173
|
constructor(model: LanguageModelV1);
|
|
165
174
|
getSchemaTarget(): Targets | undefined;
|
|
166
175
|
shouldApply(): boolean;
|
|
167
|
-
processZodType
|
|
176
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
168
177
|
}
|
|
169
178
|
export { DeepSeekSchemaCompatLayer }
|
|
170
179
|
export { DeepSeekSchemaCompatLayer as DeepSeekSchemaCompatLayer_alias_1 }
|
|
@@ -173,16 +182,44 @@ declare class GoogleSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
173
182
|
constructor(model: LanguageModelV1);
|
|
174
183
|
getSchemaTarget(): Targets | undefined;
|
|
175
184
|
shouldApply(): boolean;
|
|
176
|
-
processZodType
|
|
185
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
177
186
|
}
|
|
178
187
|
export { GoogleSchemaCompatLayer }
|
|
179
188
|
export { GoogleSchemaCompatLayer as GoogleSchemaCompatLayer_alias_1 }
|
|
180
189
|
|
|
190
|
+
declare const isArr: (v: ZodTypeAny) => v is ZodArray<any, any>;
|
|
191
|
+
export { isArr }
|
|
192
|
+
export { isArr as isArr_alias_1 }
|
|
193
|
+
|
|
194
|
+
export declare const isDate: (v: ZodTypeAny) => v is ZodDate;
|
|
195
|
+
|
|
196
|
+
export declare const isDefault: (v: ZodTypeAny) => v is ZodDefault<any>;
|
|
197
|
+
|
|
198
|
+
declare const isNumber: (v: ZodTypeAny) => v is ZodNumber;
|
|
199
|
+
export { isNumber }
|
|
200
|
+
export { isNumber as isNumber_alias_1 }
|
|
201
|
+
|
|
202
|
+
declare const isObj: (v: ZodTypeAny) => v is ZodObject<any, any, any>;
|
|
203
|
+
export { isObj }
|
|
204
|
+
export { isObj as isObj_alias_1 }
|
|
205
|
+
|
|
206
|
+
declare const isOptional: (v: ZodTypeAny) => v is ZodOptional<any>;
|
|
207
|
+
export { isOptional }
|
|
208
|
+
export { isOptional as isOptional_alias_1 }
|
|
209
|
+
|
|
210
|
+
declare const isString: (v: ZodTypeAny) => v is ZodString;
|
|
211
|
+
export { isString }
|
|
212
|
+
export { isString as isString_alias_1 }
|
|
213
|
+
|
|
214
|
+
declare const isUnion: (v: ZodTypeAny) => v is ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
215
|
+
export { isUnion }
|
|
216
|
+
export { isUnion as isUnion_alias_1 }
|
|
217
|
+
|
|
181
218
|
declare class MetaSchemaCompatLayer extends SchemaCompatLayer {
|
|
182
219
|
constructor(model: LanguageModelV1);
|
|
183
220
|
getSchemaTarget(): Targets | undefined;
|
|
184
221
|
shouldApply(): boolean;
|
|
185
|
-
processZodType
|
|
222
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
186
223
|
}
|
|
187
224
|
export { MetaSchemaCompatLayer }
|
|
188
225
|
export { MetaSchemaCompatLayer as MetaSchemaCompatLayer_alias_1 }
|
|
@@ -207,7 +244,7 @@ declare class OpenAIReasoningSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
207
244
|
getSchemaTarget(): Targets | undefined;
|
|
208
245
|
isReasoningModel(): boolean;
|
|
209
246
|
shouldApply(): boolean;
|
|
210
|
-
processZodType
|
|
247
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
211
248
|
}
|
|
212
249
|
export { OpenAIReasoningSchemaCompatLayer }
|
|
213
250
|
export { OpenAIReasoningSchemaCompatLayer as OpenAIReasoningSchemaCompatLayer_alias_1 }
|
|
@@ -216,7 +253,7 @@ declare class OpenAISchemaCompatLayer extends SchemaCompatLayer {
|
|
|
216
253
|
constructor(model: LanguageModelV1);
|
|
217
254
|
getSchemaTarget(): Targets | undefined;
|
|
218
255
|
shouldApply(): boolean;
|
|
219
|
-
processZodType
|
|
256
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
220
257
|
}
|
|
221
258
|
export { OpenAISchemaCompatLayer }
|
|
222
259
|
export { OpenAISchemaCompatLayer as OpenAISchemaCompatLayer_alias_1 }
|
|
@@ -295,22 +332,14 @@ declare abstract class SchemaCompatLayer {
|
|
|
295
332
|
* @returns The processed Zod type
|
|
296
333
|
* @abstract
|
|
297
334
|
*/
|
|
298
|
-
abstract processZodType
|
|
299
|
-
/**
|
|
300
|
-
* Applies compatibility transformations to a Zod object schema.
|
|
301
|
-
*
|
|
302
|
-
* @param zodSchema - The Zod object schema to transform
|
|
303
|
-
* @returns Object containing the transformed schema
|
|
304
|
-
* @private
|
|
305
|
-
*/
|
|
306
|
-
private applyZodSchemaCompatibility;
|
|
335
|
+
abstract processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
307
336
|
/**
|
|
308
337
|
* Default handler for Zod object types. Recursively processes all properties in the object.
|
|
309
338
|
*
|
|
310
339
|
* @param value - The Zod object to process
|
|
311
340
|
* @returns The processed Zod object
|
|
312
341
|
*/
|
|
313
|
-
defaultZodObjectHandler<
|
|
342
|
+
defaultZodObjectHandler(value: ZodObject<any, any, any>): ZodObject<any, any, any>;
|
|
314
343
|
/**
|
|
315
344
|
* Merges validation constraints into a parameter description.
|
|
316
345
|
*
|
|
@@ -340,7 +369,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
340
369
|
* @param handleChecks - Array constraints to convert to descriptions vs keep as validation
|
|
341
370
|
* @returns The processed Zod array
|
|
342
371
|
*/
|
|
343
|
-
defaultZodArrayHandler
|
|
372
|
+
defaultZodArrayHandler(value: ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): ZodArray<any, any>;
|
|
344
373
|
/**
|
|
345
374
|
* Default handler for Zod union types. Processes all union options.
|
|
346
375
|
*
|
|
@@ -348,7 +377,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
348
377
|
* @returns The processed Zod union
|
|
349
378
|
* @throws Error if union has fewer than 2 options
|
|
350
379
|
*/
|
|
351
|
-
defaultZodUnionHandler
|
|
380
|
+
defaultZodUnionHandler(value: ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>): ZodTypeAny;
|
|
352
381
|
/**
|
|
353
382
|
* Default handler for Zod string types. Processes string validation constraints.
|
|
354
383
|
*
|
|
@@ -356,7 +385,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
356
385
|
* @param handleChecks - String constraints to convert to descriptions vs keep as validation
|
|
357
386
|
* @returns The processed Zod string
|
|
358
387
|
*/
|
|
359
|
-
defaultZodStringHandler
|
|
388
|
+
defaultZodStringHandler(value: ZodString, handleChecks?: readonly StringCheckType[]): ZodString;
|
|
360
389
|
/**
|
|
361
390
|
* Default handler for Zod number types. Processes number validation constraints.
|
|
362
391
|
*
|
|
@@ -364,14 +393,14 @@ declare abstract class SchemaCompatLayer {
|
|
|
364
393
|
* @param handleChecks - Number constraints to convert to descriptions vs keep as validation
|
|
365
394
|
* @returns The processed Zod number
|
|
366
395
|
*/
|
|
367
|
-
defaultZodNumberHandler
|
|
396
|
+
defaultZodNumberHandler(value: ZodNumber, handleChecks?: readonly NumberCheckType[]): ZodNumber;
|
|
368
397
|
/**
|
|
369
398
|
* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
|
|
370
399
|
*
|
|
371
400
|
* @param value - The Zod date to process
|
|
372
401
|
* @returns A Zod string schema representing the date in ISO format
|
|
373
402
|
*/
|
|
374
|
-
defaultZodDateHandler
|
|
403
|
+
defaultZodDateHandler(value: ZodDate): ZodString;
|
|
375
404
|
/**
|
|
376
405
|
* Default handler for Zod optional types. Processes the inner type and maintains optionality.
|
|
377
406
|
*
|
|
@@ -379,21 +408,21 @@ declare abstract class SchemaCompatLayer {
|
|
|
379
408
|
* @param handleTypes - Types that should be processed vs passed through
|
|
380
409
|
* @returns The processed Zod optional
|
|
381
410
|
*/
|
|
382
|
-
defaultZodOptionalHandler
|
|
411
|
+
defaultZodOptionalHandler(value: ZodOptional<any>, handleTypes?: readonly AllZodType[]): ZodTypeAny;
|
|
383
412
|
/**
|
|
384
413
|
* Processes a Zod object schema and converts it to an AI SDK Schema.
|
|
385
414
|
*
|
|
386
415
|
* @param zodSchema - The Zod object schema to process
|
|
387
416
|
* @returns An AI SDK Schema with provider-specific compatibility applied
|
|
388
417
|
*/
|
|
389
|
-
processToAISDKSchema(zodSchema: z.
|
|
418
|
+
processToAISDKSchema(zodSchema: z.ZodSchema): Schema;
|
|
390
419
|
/**
|
|
391
420
|
* Processes a Zod object schema and converts it to a JSON Schema.
|
|
392
421
|
*
|
|
393
422
|
* @param zodSchema - The Zod object schema to process
|
|
394
423
|
* @returns A JSONSchema7 object with provider-specific compatibility applied
|
|
395
424
|
*/
|
|
396
|
-
processToJSONSchema(zodSchema: z.
|
|
425
|
+
processToJSONSchema(zodSchema: z.ZodSchema): JSONSchema7;
|
|
397
426
|
}
|
|
398
427
|
export { SchemaCompatLayer }
|
|
399
428
|
export { SchemaCompatLayer as SchemaCompatLayer_alias_1 }
|
|
@@ -3,7 +3,16 @@ import type { LanguageModelV1 } from 'ai';
|
|
|
3
3
|
import type { Schema } from 'ai';
|
|
4
4
|
import type { Targets } from 'zod-to-json-schema';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { ZodArray } from 'zod';
|
|
7
|
+
import { ZodDate } from 'zod';
|
|
8
|
+
import { ZodDefault } from 'zod';
|
|
9
|
+
import { ZodNumber } from 'zod';
|
|
10
|
+
import { ZodObject } from 'zod';
|
|
11
|
+
import { ZodOptional } from 'zod';
|
|
6
12
|
import type { ZodSchema } from 'zod';
|
|
13
|
+
import { ZodString } from 'zod';
|
|
14
|
+
import type { ZodTypeAny } from 'zod';
|
|
15
|
+
import { ZodUnion } from 'zod';
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
18
|
* All supported array validation check types that can be processed or converted to descriptions.
|
|
@@ -48,7 +57,7 @@ declare class AnthropicSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
48
57
|
constructor(model: LanguageModelV1);
|
|
49
58
|
getSchemaTarget(): Targets | undefined;
|
|
50
59
|
shouldApply(): boolean;
|
|
51
|
-
processZodType
|
|
60
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
52
61
|
}
|
|
53
62
|
export { AnthropicSchemaCompatLayer }
|
|
54
63
|
export { AnthropicSchemaCompatLayer as AnthropicSchemaCompatLayer_alias_1 }
|
|
@@ -63,7 +72,7 @@ export { AnthropicSchemaCompatLayer as AnthropicSchemaCompatLayer_alias_1 }
|
|
|
63
72
|
* @returns Processed schema as an AI SDK Schema
|
|
64
73
|
*/
|
|
65
74
|
declare function applyCompatLayer(options: {
|
|
66
|
-
schema: Schema | z.
|
|
75
|
+
schema: Schema | z.ZodSchema;
|
|
67
76
|
compatLayers: SchemaCompatLayer[];
|
|
68
77
|
mode: 'aiSdkSchema';
|
|
69
78
|
}): Schema;
|
|
@@ -78,7 +87,7 @@ declare function applyCompatLayer(options: {
|
|
|
78
87
|
* @returns Processed schema as a JSONSchema7
|
|
79
88
|
*/
|
|
80
89
|
declare function applyCompatLayer(options: {
|
|
81
|
-
schema: Schema | z.
|
|
90
|
+
schema: Schema | z.ZodSchema;
|
|
82
91
|
compatLayers: SchemaCompatLayer[];
|
|
83
92
|
mode: 'jsonSchema';
|
|
84
93
|
}): JSONSchema7;
|
|
@@ -164,7 +173,7 @@ declare class DeepSeekSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
164
173
|
constructor(model: LanguageModelV1);
|
|
165
174
|
getSchemaTarget(): Targets | undefined;
|
|
166
175
|
shouldApply(): boolean;
|
|
167
|
-
processZodType
|
|
176
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
168
177
|
}
|
|
169
178
|
export { DeepSeekSchemaCompatLayer }
|
|
170
179
|
export { DeepSeekSchemaCompatLayer as DeepSeekSchemaCompatLayer_alias_1 }
|
|
@@ -173,16 +182,44 @@ declare class GoogleSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
173
182
|
constructor(model: LanguageModelV1);
|
|
174
183
|
getSchemaTarget(): Targets | undefined;
|
|
175
184
|
shouldApply(): boolean;
|
|
176
|
-
processZodType
|
|
185
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
177
186
|
}
|
|
178
187
|
export { GoogleSchemaCompatLayer }
|
|
179
188
|
export { GoogleSchemaCompatLayer as GoogleSchemaCompatLayer_alias_1 }
|
|
180
189
|
|
|
190
|
+
declare const isArr: (v: ZodTypeAny) => v is ZodArray<any, any>;
|
|
191
|
+
export { isArr }
|
|
192
|
+
export { isArr as isArr_alias_1 }
|
|
193
|
+
|
|
194
|
+
export declare const isDate: (v: ZodTypeAny) => v is ZodDate;
|
|
195
|
+
|
|
196
|
+
export declare const isDefault: (v: ZodTypeAny) => v is ZodDefault<any>;
|
|
197
|
+
|
|
198
|
+
declare const isNumber: (v: ZodTypeAny) => v is ZodNumber;
|
|
199
|
+
export { isNumber }
|
|
200
|
+
export { isNumber as isNumber_alias_1 }
|
|
201
|
+
|
|
202
|
+
declare const isObj: (v: ZodTypeAny) => v is ZodObject<any, any, any>;
|
|
203
|
+
export { isObj }
|
|
204
|
+
export { isObj as isObj_alias_1 }
|
|
205
|
+
|
|
206
|
+
declare const isOptional: (v: ZodTypeAny) => v is ZodOptional<any>;
|
|
207
|
+
export { isOptional }
|
|
208
|
+
export { isOptional as isOptional_alias_1 }
|
|
209
|
+
|
|
210
|
+
declare const isString: (v: ZodTypeAny) => v is ZodString;
|
|
211
|
+
export { isString }
|
|
212
|
+
export { isString as isString_alias_1 }
|
|
213
|
+
|
|
214
|
+
declare const isUnion: (v: ZodTypeAny) => v is ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
215
|
+
export { isUnion }
|
|
216
|
+
export { isUnion as isUnion_alias_1 }
|
|
217
|
+
|
|
181
218
|
declare class MetaSchemaCompatLayer extends SchemaCompatLayer {
|
|
182
219
|
constructor(model: LanguageModelV1);
|
|
183
220
|
getSchemaTarget(): Targets | undefined;
|
|
184
221
|
shouldApply(): boolean;
|
|
185
|
-
processZodType
|
|
222
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
186
223
|
}
|
|
187
224
|
export { MetaSchemaCompatLayer }
|
|
188
225
|
export { MetaSchemaCompatLayer as MetaSchemaCompatLayer_alias_1 }
|
|
@@ -207,7 +244,7 @@ declare class OpenAIReasoningSchemaCompatLayer extends SchemaCompatLayer {
|
|
|
207
244
|
getSchemaTarget(): Targets | undefined;
|
|
208
245
|
isReasoningModel(): boolean;
|
|
209
246
|
shouldApply(): boolean;
|
|
210
|
-
processZodType
|
|
247
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
211
248
|
}
|
|
212
249
|
export { OpenAIReasoningSchemaCompatLayer }
|
|
213
250
|
export { OpenAIReasoningSchemaCompatLayer as OpenAIReasoningSchemaCompatLayer_alias_1 }
|
|
@@ -216,7 +253,7 @@ declare class OpenAISchemaCompatLayer extends SchemaCompatLayer {
|
|
|
216
253
|
constructor(model: LanguageModelV1);
|
|
217
254
|
getSchemaTarget(): Targets | undefined;
|
|
218
255
|
shouldApply(): boolean;
|
|
219
|
-
processZodType
|
|
256
|
+
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
220
257
|
}
|
|
221
258
|
export { OpenAISchemaCompatLayer }
|
|
222
259
|
export { OpenAISchemaCompatLayer as OpenAISchemaCompatLayer_alias_1 }
|
|
@@ -295,22 +332,14 @@ declare abstract class SchemaCompatLayer {
|
|
|
295
332
|
* @returns The processed Zod type
|
|
296
333
|
* @abstract
|
|
297
334
|
*/
|
|
298
|
-
abstract processZodType
|
|
299
|
-
/**
|
|
300
|
-
* Applies compatibility transformations to a Zod object schema.
|
|
301
|
-
*
|
|
302
|
-
* @param zodSchema - The Zod object schema to transform
|
|
303
|
-
* @returns Object containing the transformed schema
|
|
304
|
-
* @private
|
|
305
|
-
*/
|
|
306
|
-
private applyZodSchemaCompatibility;
|
|
335
|
+
abstract processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
307
336
|
/**
|
|
308
337
|
* Default handler for Zod object types. Recursively processes all properties in the object.
|
|
309
338
|
*
|
|
310
339
|
* @param value - The Zod object to process
|
|
311
340
|
* @returns The processed Zod object
|
|
312
341
|
*/
|
|
313
|
-
defaultZodObjectHandler<
|
|
342
|
+
defaultZodObjectHandler(value: ZodObject<any, any, any>): ZodObject<any, any, any>;
|
|
314
343
|
/**
|
|
315
344
|
* Merges validation constraints into a parameter description.
|
|
316
345
|
*
|
|
@@ -340,7 +369,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
340
369
|
* @param handleChecks - Array constraints to convert to descriptions vs keep as validation
|
|
341
370
|
* @returns The processed Zod array
|
|
342
371
|
*/
|
|
343
|
-
defaultZodArrayHandler
|
|
372
|
+
defaultZodArrayHandler(value: ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): ZodArray<any, any>;
|
|
344
373
|
/**
|
|
345
374
|
* Default handler for Zod union types. Processes all union options.
|
|
346
375
|
*
|
|
@@ -348,7 +377,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
348
377
|
* @returns The processed Zod union
|
|
349
378
|
* @throws Error if union has fewer than 2 options
|
|
350
379
|
*/
|
|
351
|
-
defaultZodUnionHandler
|
|
380
|
+
defaultZodUnionHandler(value: ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>): ZodTypeAny;
|
|
352
381
|
/**
|
|
353
382
|
* Default handler for Zod string types. Processes string validation constraints.
|
|
354
383
|
*
|
|
@@ -356,7 +385,7 @@ declare abstract class SchemaCompatLayer {
|
|
|
356
385
|
* @param handleChecks - String constraints to convert to descriptions vs keep as validation
|
|
357
386
|
* @returns The processed Zod string
|
|
358
387
|
*/
|
|
359
|
-
defaultZodStringHandler
|
|
388
|
+
defaultZodStringHandler(value: ZodString, handleChecks?: readonly StringCheckType[]): ZodString;
|
|
360
389
|
/**
|
|
361
390
|
* Default handler for Zod number types. Processes number validation constraints.
|
|
362
391
|
*
|
|
@@ -364,14 +393,14 @@ declare abstract class SchemaCompatLayer {
|
|
|
364
393
|
* @param handleChecks - Number constraints to convert to descriptions vs keep as validation
|
|
365
394
|
* @returns The processed Zod number
|
|
366
395
|
*/
|
|
367
|
-
defaultZodNumberHandler
|
|
396
|
+
defaultZodNumberHandler(value: ZodNumber, handleChecks?: readonly NumberCheckType[]): ZodNumber;
|
|
368
397
|
/**
|
|
369
398
|
* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
|
|
370
399
|
*
|
|
371
400
|
* @param value - The Zod date to process
|
|
372
401
|
* @returns A Zod string schema representing the date in ISO format
|
|
373
402
|
*/
|
|
374
|
-
defaultZodDateHandler
|
|
403
|
+
defaultZodDateHandler(value: ZodDate): ZodString;
|
|
375
404
|
/**
|
|
376
405
|
* Default handler for Zod optional types. Processes the inner type and maintains optionality.
|
|
377
406
|
*
|
|
@@ -379,21 +408,21 @@ declare abstract class SchemaCompatLayer {
|
|
|
379
408
|
* @param handleTypes - Types that should be processed vs passed through
|
|
380
409
|
* @returns The processed Zod optional
|
|
381
410
|
*/
|
|
382
|
-
defaultZodOptionalHandler
|
|
411
|
+
defaultZodOptionalHandler(value: ZodOptional<any>, handleTypes?: readonly AllZodType[]): ZodTypeAny;
|
|
383
412
|
/**
|
|
384
413
|
* Processes a Zod object schema and converts it to an AI SDK Schema.
|
|
385
414
|
*
|
|
386
415
|
* @param zodSchema - The Zod object schema to process
|
|
387
416
|
* @returns An AI SDK Schema with provider-specific compatibility applied
|
|
388
417
|
*/
|
|
389
|
-
processToAISDKSchema(zodSchema: z.
|
|
418
|
+
processToAISDKSchema(zodSchema: z.ZodSchema): Schema;
|
|
390
419
|
/**
|
|
391
420
|
* Processes a Zod object schema and converts it to a JSON Schema.
|
|
392
421
|
*
|
|
393
422
|
* @param zodSchema - The Zod object schema to process
|
|
394
423
|
* @returns A JSONSchema7 object with provider-specific compatibility applied
|
|
395
424
|
*/
|
|
396
|
-
processToJSONSchema(zodSchema: z.
|
|
425
|
+
processToJSONSchema(zodSchema: z.ZodSchema): JSONSchema7;
|
|
397
426
|
}
|
|
398
427
|
export { SchemaCompatLayer }
|
|
399
428
|
export { SchemaCompatLayer as SchemaCompatLayer_alias_1 }
|