@mastra/schema-compat 0.0.0-fix-fetching-workflow-snapshots-20250625000954 → 0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806184630
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 +2 -21
- package/CHANGELOG.md +43 -1
- package/LICENSE.md +11 -42
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -0
- package/dist/provider-compats/anthropic.d.ts +11 -0
- package/dist/provider-compats/anthropic.d.ts.map +1 -0
- package/dist/provider-compats/deepseek.d.ts +11 -0
- package/dist/provider-compats/deepseek.d.ts.map +1 -0
- package/dist/provider-compats/google.d.ts +11 -0
- package/dist/provider-compats/google.d.ts.map +1 -0
- package/dist/provider-compats/meta.d.ts +11 -0
- package/dist/provider-compats/meta.d.ts.map +1 -0
- package/dist/provider-compats/openai-reasoning.d.ts +12 -0
- package/dist/provider-compats/openai-reasoning.d.ts.map +1 -0
- package/dist/provider-compats/openai.d.ts +11 -0
- package/dist/provider-compats/openai.d.ts.map +1 -0
- package/dist/schema-compatibility.d.ts +280 -0
- package/dist/schema-compatibility.d.ts.map +1 -0
- package/dist/utils.d.ts +84 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +9 -8
- package/src/provider-compats/google.ts +8 -0
- package/src/provider-compats/openai-reasoning.ts +5 -1
- package/src/schema-compatibility.ts +4 -3
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +17 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -504
- package/dist/_tsup-dts-rollup.d.ts +0 -504
- package/dist/index.d.cts +0 -31
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
-
import type { LanguageModelV1 } from 'ai';
|
|
3
|
-
import type { Schema } from 'ai';
|
|
4
|
-
import type { Targets } from 'zod-to-json-schema';
|
|
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';
|
|
12
|
-
import type { ZodSchema } from 'zod';
|
|
13
|
-
import { ZodString } from 'zod';
|
|
14
|
-
import type { ZodTypeAny } from 'zod';
|
|
15
|
-
import { ZodUnion } from 'zod';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* All supported array validation check types that can be processed or converted to descriptions.
|
|
19
|
-
* @constant
|
|
20
|
-
*/
|
|
21
|
-
declare const ALL_ARRAY_CHECKS: readonly ["min", "max", "length"];
|
|
22
|
-
export { ALL_ARRAY_CHECKS }
|
|
23
|
-
export { ALL_ARRAY_CHECKS as ALL_ARRAY_CHECKS_alias_1 }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* All supported number validation check types that can be processed or converted to descriptions.
|
|
27
|
-
* @constant
|
|
28
|
-
*/
|
|
29
|
-
declare const ALL_NUMBER_CHECKS: readonly ["min", "max", "multipleOf"];
|
|
30
|
-
export { ALL_NUMBER_CHECKS }
|
|
31
|
-
export { ALL_NUMBER_CHECKS as ALL_NUMBER_CHECKS_alias_1 }
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* All supported string validation check types that can be processed or converted to descriptions.
|
|
35
|
-
* @constant
|
|
36
|
-
*/
|
|
37
|
-
declare const ALL_STRING_CHECKS: readonly ["regex", "emoji", "email", "url", "uuid", "cuid", "min", "max"];
|
|
38
|
-
export { ALL_STRING_CHECKS }
|
|
39
|
-
export { ALL_STRING_CHECKS as ALL_STRING_CHECKS_alias_1 }
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* All Zod types (both supported and unsupported).
|
|
43
|
-
* @constant
|
|
44
|
-
*/
|
|
45
|
-
declare const ALL_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault", "ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
|
|
46
|
-
export { ALL_ZOD_TYPES }
|
|
47
|
-
export { ALL_ZOD_TYPES as ALL_ZOD_TYPES_alias_1 }
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Type representing all Zod schema types (supported and unsupported).
|
|
51
|
-
*/
|
|
52
|
-
declare type AllZodType = (typeof ALL_ZOD_TYPES)[number];
|
|
53
|
-
export { AllZodType }
|
|
54
|
-
export { AllZodType as AllZodType_alias_1 }
|
|
55
|
-
|
|
56
|
-
declare class AnthropicSchemaCompatLayer extends SchemaCompatLayer {
|
|
57
|
-
constructor(model: LanguageModelV1);
|
|
58
|
-
getSchemaTarget(): Targets | undefined;
|
|
59
|
-
shouldApply(): boolean;
|
|
60
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
61
|
-
}
|
|
62
|
-
export { AnthropicSchemaCompatLayer }
|
|
63
|
-
export { AnthropicSchemaCompatLayer as AnthropicSchemaCompatLayer_alias_1 }
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Processes a schema using provider compatibility layers and converts it to an AI SDK Schema.
|
|
67
|
-
*
|
|
68
|
-
* @param options - Configuration object for schema processing
|
|
69
|
-
* @param options.schema - The schema to process (AI SDK Schema or Zod object schema)
|
|
70
|
-
* @param options.compatLayers - Array of compatibility layers to try
|
|
71
|
-
* @param options.mode - Must be 'aiSdkSchema'
|
|
72
|
-
* @returns Processed schema as an AI SDK Schema
|
|
73
|
-
*/
|
|
74
|
-
declare function applyCompatLayer(options: {
|
|
75
|
-
schema: Schema | z.ZodSchema;
|
|
76
|
-
compatLayers: SchemaCompatLayer[];
|
|
77
|
-
mode: 'aiSdkSchema';
|
|
78
|
-
}): Schema;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Processes a schema using provider compatibility layers and converts it to a JSON Schema.
|
|
82
|
-
*
|
|
83
|
-
* @param options - Configuration object for schema processing
|
|
84
|
-
* @param options.schema - The schema to process (AI SDK Schema or Zod object schema)
|
|
85
|
-
* @param options.compatLayers - Array of compatibility layers to try
|
|
86
|
-
* @param options.mode - Must be 'jsonSchema'
|
|
87
|
-
* @returns Processed schema as a JSONSchema7
|
|
88
|
-
*/
|
|
89
|
-
declare function applyCompatLayer(options: {
|
|
90
|
-
schema: Schema | z.ZodSchema;
|
|
91
|
-
compatLayers: SchemaCompatLayer[];
|
|
92
|
-
mode: 'jsonSchema';
|
|
93
|
-
}): JSONSchema7;
|
|
94
|
-
export { applyCompatLayer }
|
|
95
|
-
export { applyCompatLayer as applyCompatLayer_alias_1 }
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Type representing array validation checks.
|
|
99
|
-
*/
|
|
100
|
-
declare type ArrayCheckType = (typeof ALL_ARRAY_CHECKS)[number];
|
|
101
|
-
export { ArrayCheckType }
|
|
102
|
-
export { ArrayCheckType as ArrayCheckType_alias_1 }
|
|
103
|
-
|
|
104
|
-
declare type ArrayConstraints = {
|
|
105
|
-
minLength?: number;
|
|
106
|
-
maxLength?: number;
|
|
107
|
-
exactLength?: number;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Converts an AI SDK Schema or Zod schema to a Zod schema.
|
|
112
|
-
*
|
|
113
|
-
* If the input is already a Zod schema, it returns it unchanged.
|
|
114
|
-
* If the input is an AI SDK Schema, it extracts the JSON schema and converts it to Zod.
|
|
115
|
-
*
|
|
116
|
-
* @param schema - The schema to convert (AI SDK Schema or Zod schema)
|
|
117
|
-
* @returns A Zod schema equivalent of the input
|
|
118
|
-
* @throws Error if the conversion fails
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* import { jsonSchema } from 'ai';
|
|
123
|
-
* import { convertSchemaToZod } from '@mastra/schema-compat';
|
|
124
|
-
*
|
|
125
|
-
* const aiSchema = jsonSchema({
|
|
126
|
-
* type: 'object',
|
|
127
|
-
* properties: {
|
|
128
|
-
* name: { type: 'string' }
|
|
129
|
-
* }
|
|
130
|
-
* });
|
|
131
|
-
*
|
|
132
|
-
* const zodSchema = convertSchemaToZod(aiSchema);
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
declare function convertSchemaToZod(schema: Schema | z.ZodSchema): z.ZodType;
|
|
136
|
-
export { convertSchemaToZod }
|
|
137
|
-
export { convertSchemaToZod as convertSchemaToZod_alias_1 }
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Converts a Zod schema to an AI SDK Schema with validation support.
|
|
141
|
-
*
|
|
142
|
-
* This function mirrors the behavior of Vercel's AI SDK zod-schema utility but allows
|
|
143
|
-
* customization of the JSON Schema target format.
|
|
144
|
-
*
|
|
145
|
-
* @param zodSchema - The Zod schema to convert
|
|
146
|
-
* @param target - The JSON Schema target format (defaults to 'jsonSchema7')
|
|
147
|
-
* @returns An AI SDK Schema object with built-in validation
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* import { z } from 'zod';
|
|
152
|
-
* import { convertZodSchemaToAISDKSchema } from '@mastra/schema-compat';
|
|
153
|
-
*
|
|
154
|
-
* const userSchema = z.object({
|
|
155
|
-
* name: z.string(),
|
|
156
|
-
* age: z.number().min(0)
|
|
157
|
-
* });
|
|
158
|
-
*
|
|
159
|
-
* const aiSchema = convertZodSchemaToAISDKSchema(userSchema);
|
|
160
|
-
* ```
|
|
161
|
-
*/
|
|
162
|
-
declare function convertZodSchemaToAISDKSchema(zodSchema: ZodSchema, target?: Targets): Schema<any>;
|
|
163
|
-
export { convertZodSchemaToAISDKSchema }
|
|
164
|
-
export { convertZodSchemaToAISDKSchema as convertZodSchemaToAISDKSchema_alias_1 }
|
|
165
|
-
|
|
166
|
-
declare type DateConstraints = {
|
|
167
|
-
minDate?: string;
|
|
168
|
-
maxDate?: string;
|
|
169
|
-
dateFormat?: string;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
declare class DeepSeekSchemaCompatLayer extends SchemaCompatLayer {
|
|
173
|
-
constructor(model: LanguageModelV1);
|
|
174
|
-
getSchemaTarget(): Targets | undefined;
|
|
175
|
-
shouldApply(): boolean;
|
|
176
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
177
|
-
}
|
|
178
|
-
export { DeepSeekSchemaCompatLayer }
|
|
179
|
-
export { DeepSeekSchemaCompatLayer as DeepSeekSchemaCompatLayer_alias_1 }
|
|
180
|
-
|
|
181
|
-
declare class GoogleSchemaCompatLayer extends SchemaCompatLayer {
|
|
182
|
-
constructor(model: LanguageModelV1);
|
|
183
|
-
getSchemaTarget(): Targets | undefined;
|
|
184
|
-
shouldApply(): boolean;
|
|
185
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
186
|
-
}
|
|
187
|
-
export { GoogleSchemaCompatLayer }
|
|
188
|
-
export { GoogleSchemaCompatLayer as GoogleSchemaCompatLayer_alias_1 }
|
|
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
|
-
|
|
218
|
-
declare class MetaSchemaCompatLayer extends SchemaCompatLayer {
|
|
219
|
-
constructor(model: LanguageModelV1);
|
|
220
|
-
getSchemaTarget(): Targets | undefined;
|
|
221
|
-
shouldApply(): boolean;
|
|
222
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
223
|
-
}
|
|
224
|
-
export { MetaSchemaCompatLayer }
|
|
225
|
-
export { MetaSchemaCompatLayer as MetaSchemaCompatLayer_alias_1 }
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Type representing number validation checks.
|
|
229
|
-
*/
|
|
230
|
-
declare type NumberCheckType = (typeof ALL_NUMBER_CHECKS)[number];
|
|
231
|
-
export { NumberCheckType }
|
|
232
|
-
export { NumberCheckType as NumberCheckType_alias_1 }
|
|
233
|
-
|
|
234
|
-
declare type NumberConstraints = {
|
|
235
|
-
gt?: number;
|
|
236
|
-
gte?: number;
|
|
237
|
-
lt?: number;
|
|
238
|
-
lte?: number;
|
|
239
|
-
multipleOf?: number;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
declare class OpenAIReasoningSchemaCompatLayer extends SchemaCompatLayer {
|
|
243
|
-
constructor(model: LanguageModelV1);
|
|
244
|
-
getSchemaTarget(): Targets | undefined;
|
|
245
|
-
isReasoningModel(): boolean;
|
|
246
|
-
shouldApply(): boolean;
|
|
247
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
248
|
-
}
|
|
249
|
-
export { OpenAIReasoningSchemaCompatLayer }
|
|
250
|
-
export { OpenAIReasoningSchemaCompatLayer as OpenAIReasoningSchemaCompatLayer_alias_1 }
|
|
251
|
-
|
|
252
|
-
declare class OpenAISchemaCompatLayer extends SchemaCompatLayer {
|
|
253
|
-
constructor(model: LanguageModelV1);
|
|
254
|
-
getSchemaTarget(): Targets | undefined;
|
|
255
|
-
shouldApply(): boolean;
|
|
256
|
-
processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
257
|
-
}
|
|
258
|
-
export { OpenAISchemaCompatLayer }
|
|
259
|
-
export { OpenAISchemaCompatLayer as OpenAISchemaCompatLayer_alias_1 }
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Abstract base class for creating schema compatibility layers for different AI model providers.
|
|
263
|
-
*
|
|
264
|
-
* This class provides a framework for transforming Zod schemas to work with specific AI model
|
|
265
|
-
* provider requirements and limitations. Each provider may have different support levels for
|
|
266
|
-
* JSON Schema features, validation constraints, and data types.
|
|
267
|
-
*
|
|
268
|
-
* @abstract
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```typescript
|
|
272
|
-
* import { SchemaCompatLayer } from '@mastra/schema-compat';
|
|
273
|
-
* import type { LanguageModelV1 } from 'ai';
|
|
274
|
-
*
|
|
275
|
-
* class CustomProviderCompat extends SchemaCompatLayer {
|
|
276
|
-
* constructor(model: LanguageModelV1) {
|
|
277
|
-
* super(model);
|
|
278
|
-
* }
|
|
279
|
-
*
|
|
280
|
-
* shouldApply(): boolean {
|
|
281
|
-
* return this.getModel().provider === 'custom-provider';
|
|
282
|
-
* }
|
|
283
|
-
*
|
|
284
|
-
* getSchemaTarget() {
|
|
285
|
-
* return 'jsonSchema7';
|
|
286
|
-
* }
|
|
287
|
-
*
|
|
288
|
-
* processZodType<T extends z.AnyZodObject>(value: z.ZodTypeAny): ShapeValue<T> {
|
|
289
|
-
* // Custom processing logic for this provider
|
|
290
|
-
* switch (value._def.typeName) {
|
|
291
|
-
* case 'ZodString':
|
|
292
|
-
* return this.defaultZodStringHandler(value, ['email', 'url']);
|
|
293
|
-
* default:
|
|
294
|
-
* return this.defaultUnsupportedZodTypeHandler(value);
|
|
295
|
-
* }
|
|
296
|
-
* }
|
|
297
|
-
* }
|
|
298
|
-
* ```
|
|
299
|
-
*/
|
|
300
|
-
declare abstract class SchemaCompatLayer {
|
|
301
|
-
private model;
|
|
302
|
-
/**
|
|
303
|
-
* Creates a new schema compatibility instance.
|
|
304
|
-
*
|
|
305
|
-
* @param model - The language model this compatibility layer applies to
|
|
306
|
-
*/
|
|
307
|
-
constructor(model: LanguageModelV1);
|
|
308
|
-
/**
|
|
309
|
-
* Gets the language model associated with this compatibility layer.
|
|
310
|
-
*
|
|
311
|
-
* @returns The language model instance
|
|
312
|
-
*/
|
|
313
|
-
getModel(): LanguageModelV1;
|
|
314
|
-
/**
|
|
315
|
-
* Determines whether this compatibility layer should be applied for the current model.
|
|
316
|
-
*
|
|
317
|
-
* @returns True if this compatibility layer should be used, false otherwise
|
|
318
|
-
* @abstract
|
|
319
|
-
*/
|
|
320
|
-
abstract shouldApply(): boolean;
|
|
321
|
-
/**
|
|
322
|
-
* Returns the JSON Schema target format for this provider.
|
|
323
|
-
*
|
|
324
|
-
* @returns The schema target format, or undefined to use the default 'jsonSchema7'
|
|
325
|
-
* @abstract
|
|
326
|
-
*/
|
|
327
|
-
abstract getSchemaTarget(): Targets | undefined;
|
|
328
|
-
/**
|
|
329
|
-
* Processes a specific Zod type according to the provider's requirements.
|
|
330
|
-
*
|
|
331
|
-
* @param value - The Zod type to process
|
|
332
|
-
* @returns The processed Zod type
|
|
333
|
-
* @abstract
|
|
334
|
-
*/
|
|
335
|
-
abstract processZodType(value: ZodTypeAny): ZodTypeAny;
|
|
336
|
-
/**
|
|
337
|
-
* Default handler for Zod object types. Recursively processes all properties in the object.
|
|
338
|
-
*
|
|
339
|
-
* @param value - The Zod object to process
|
|
340
|
-
* @returns The processed Zod object
|
|
341
|
-
*/
|
|
342
|
-
defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
|
|
343
|
-
passthrough?: boolean;
|
|
344
|
-
}): ZodObject<any, any, any>;
|
|
345
|
-
/**
|
|
346
|
-
* Merges validation constraints into a parameter description.
|
|
347
|
-
*
|
|
348
|
-
* This helper method converts validation constraints that may not be supported
|
|
349
|
-
* by a provider into human-readable descriptions.
|
|
350
|
-
*
|
|
351
|
-
* @param description - The existing parameter description
|
|
352
|
-
* @param constraints - The validation constraints to merge
|
|
353
|
-
* @returns The updated description with constraints, or undefined if no constraints
|
|
354
|
-
*/
|
|
355
|
-
mergeParameterDescription(description: string | undefined, constraints: NumberConstraints | StringConstraints | ArrayConstraints | DateConstraints | {
|
|
356
|
-
defaultValue?: unknown;
|
|
357
|
-
}): string | undefined;
|
|
358
|
-
/**
|
|
359
|
-
* Default handler for unsupported Zod types. Throws an error for specified unsupported types.
|
|
360
|
-
*
|
|
361
|
-
* @param value - The Zod type to check
|
|
362
|
-
* @param throwOnTypes - Array of type names to throw errors for
|
|
363
|
-
* @returns The original value if not in the throw list
|
|
364
|
-
* @throws Error if the type is in the unsupported list
|
|
365
|
-
*/
|
|
366
|
-
defaultUnsupportedZodTypeHandler<T extends z.AnyZodObject>(value: z.ZodTypeAny, throwOnTypes?: readonly UnsupportedZodType[]): ShapeValue<T>;
|
|
367
|
-
/**
|
|
368
|
-
* Default handler for Zod array types. Processes array constraints according to provider support.
|
|
369
|
-
*
|
|
370
|
-
* @param value - The Zod array to process
|
|
371
|
-
* @param handleChecks - Array constraints to convert to descriptions vs keep as validation
|
|
372
|
-
* @returns The processed Zod array
|
|
373
|
-
*/
|
|
374
|
-
defaultZodArrayHandler(value: ZodArray<any, any>, handleChecks?: readonly ArrayCheckType[]): ZodArray<any, any>;
|
|
375
|
-
/**
|
|
376
|
-
* Default handler for Zod union types. Processes all union options.
|
|
377
|
-
*
|
|
378
|
-
* @param value - The Zod union to process
|
|
379
|
-
* @returns The processed Zod union
|
|
380
|
-
* @throws Error if union has fewer than 2 options
|
|
381
|
-
*/
|
|
382
|
-
defaultZodUnionHandler(value: ZodUnion<[ZodTypeAny, ...ZodTypeAny[]]>): ZodTypeAny;
|
|
383
|
-
/**
|
|
384
|
-
* Default handler for Zod string types. Processes string validation constraints.
|
|
385
|
-
*
|
|
386
|
-
* @param value - The Zod string to process
|
|
387
|
-
* @param handleChecks - String constraints to convert to descriptions vs keep as validation
|
|
388
|
-
* @returns The processed Zod string
|
|
389
|
-
*/
|
|
390
|
-
defaultZodStringHandler(value: ZodString, handleChecks?: readonly StringCheckType[]): ZodString;
|
|
391
|
-
/**
|
|
392
|
-
* Default handler for Zod number types. Processes number validation constraints.
|
|
393
|
-
*
|
|
394
|
-
* @param value - The Zod number to process
|
|
395
|
-
* @param handleChecks - Number constraints to convert to descriptions vs keep as validation
|
|
396
|
-
* @returns The processed Zod number
|
|
397
|
-
*/
|
|
398
|
-
defaultZodNumberHandler(value: ZodNumber, handleChecks?: readonly NumberCheckType[]): ZodNumber;
|
|
399
|
-
/**
|
|
400
|
-
* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
|
|
401
|
-
*
|
|
402
|
-
* @param value - The Zod date to process
|
|
403
|
-
* @returns A Zod string schema representing the date in ISO format
|
|
404
|
-
*/
|
|
405
|
-
defaultZodDateHandler(value: ZodDate): ZodString;
|
|
406
|
-
/**
|
|
407
|
-
* Default handler for Zod optional types. Processes the inner type and maintains optionality.
|
|
408
|
-
*
|
|
409
|
-
* @param value - The Zod optional to process
|
|
410
|
-
* @param handleTypes - Types that should be processed vs passed through
|
|
411
|
-
* @returns The processed Zod optional
|
|
412
|
-
*/
|
|
413
|
-
defaultZodOptionalHandler(value: ZodOptional<any>, handleTypes?: readonly AllZodType[]): ZodTypeAny;
|
|
414
|
-
/**
|
|
415
|
-
* Processes a Zod object schema and converts it to an AI SDK Schema.
|
|
416
|
-
*
|
|
417
|
-
* @param zodSchema - The Zod object schema to process
|
|
418
|
-
* @returns An AI SDK Schema with provider-specific compatibility applied
|
|
419
|
-
*/
|
|
420
|
-
processToAISDKSchema(zodSchema: z.ZodSchema): Schema;
|
|
421
|
-
/**
|
|
422
|
-
* Processes a Zod object schema and converts it to a JSON Schema.
|
|
423
|
-
*
|
|
424
|
-
* @param zodSchema - The Zod object schema to process
|
|
425
|
-
* @returns A JSONSchema7 object with provider-specific compatibility applied
|
|
426
|
-
*/
|
|
427
|
-
processToJSONSchema(zodSchema: z.ZodSchema): JSONSchema7;
|
|
428
|
-
}
|
|
429
|
-
export { SchemaCompatLayer }
|
|
430
|
-
export { SchemaCompatLayer as SchemaCompatLayer_alias_1 }
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Utility type to extract the keys from a Zod object shape.
|
|
434
|
-
*/
|
|
435
|
-
declare type ShapeKey<T extends z.AnyZodObject> = keyof ZodShape<T>;
|
|
436
|
-
export { ShapeKey }
|
|
437
|
-
export { ShapeKey as ShapeKey_alias_1 }
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Utility type to extract the value types from a Zod object shape.
|
|
441
|
-
*/
|
|
442
|
-
declare type ShapeValue<T extends z.AnyZodObject> = ZodShape<T>[ShapeKey<T>];
|
|
443
|
-
export { ShapeValue }
|
|
444
|
-
export { ShapeValue as ShapeValue_alias_1 }
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Type representing string validation checks.
|
|
448
|
-
*/
|
|
449
|
-
declare type StringCheckType = (typeof ALL_STRING_CHECKS)[number];
|
|
450
|
-
export { StringCheckType }
|
|
451
|
-
export { StringCheckType as StringCheckType_alias_1 }
|
|
452
|
-
|
|
453
|
-
declare type StringConstraints = {
|
|
454
|
-
minLength?: number;
|
|
455
|
-
maxLength?: number;
|
|
456
|
-
email?: boolean;
|
|
457
|
-
url?: boolean;
|
|
458
|
-
uuid?: boolean;
|
|
459
|
-
cuid?: boolean;
|
|
460
|
-
emoji?: boolean;
|
|
461
|
-
regex?: {
|
|
462
|
-
pattern: string;
|
|
463
|
-
flags?: string;
|
|
464
|
-
};
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Zod types that are generally supported by AI model providers.
|
|
469
|
-
* @constant
|
|
470
|
-
*/
|
|
471
|
-
declare const SUPPORTED_ZOD_TYPES: readonly ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber", "ZodDate", "ZodAny", "ZodDefault"];
|
|
472
|
-
export { SUPPORTED_ZOD_TYPES }
|
|
473
|
-
export { SUPPORTED_ZOD_TYPES as SUPPORTED_ZOD_TYPES_alias_1 }
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Type representing supported Zod schema types.
|
|
477
|
-
*/
|
|
478
|
-
declare type SupportedZodType = (typeof SUPPORTED_ZOD_TYPES)[number];
|
|
479
|
-
export { SupportedZodType }
|
|
480
|
-
export { SupportedZodType as SupportedZodType_alias_1 }
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Zod types that are not supported by most AI model providers and should be avoided.
|
|
484
|
-
* @constant
|
|
485
|
-
*/
|
|
486
|
-
declare const UNSUPPORTED_ZOD_TYPES: readonly ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
|
|
487
|
-
export { UNSUPPORTED_ZOD_TYPES }
|
|
488
|
-
export { UNSUPPORTED_ZOD_TYPES as UNSUPPORTED_ZOD_TYPES_alias_1 }
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Type representing unsupported Zod schema types.
|
|
492
|
-
*/
|
|
493
|
-
declare type UnsupportedZodType = (typeof UNSUPPORTED_ZOD_TYPES)[number];
|
|
494
|
-
export { UnsupportedZodType }
|
|
495
|
-
export { UnsupportedZodType as UnsupportedZodType_alias_1 }
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Utility type to extract the shape of a Zod object schema.
|
|
499
|
-
*/
|
|
500
|
-
declare type ZodShape<T extends z.AnyZodObject> = T['shape'];
|
|
501
|
-
export { ZodShape }
|
|
502
|
-
export { ZodShape as ZodShape_alias_1 }
|
|
503
|
-
|
|
504
|
-
export { }
|
package/dist/index.d.cts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export { SchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
2
|
-
export { ALL_STRING_CHECKS } from './_tsup-dts-rollup.cjs';
|
|
3
|
-
export { ALL_NUMBER_CHECKS } from './_tsup-dts-rollup.cjs';
|
|
4
|
-
export { ALL_ARRAY_CHECKS } from './_tsup-dts-rollup.cjs';
|
|
5
|
-
export { UNSUPPORTED_ZOD_TYPES } from './_tsup-dts-rollup.cjs';
|
|
6
|
-
export { SUPPORTED_ZOD_TYPES } from './_tsup-dts-rollup.cjs';
|
|
7
|
-
export { ALL_ZOD_TYPES } from './_tsup-dts-rollup.cjs';
|
|
8
|
-
export { StringCheckType } from './_tsup-dts-rollup.cjs';
|
|
9
|
-
export { NumberCheckType } from './_tsup-dts-rollup.cjs';
|
|
10
|
-
export { ArrayCheckType } from './_tsup-dts-rollup.cjs';
|
|
11
|
-
export { UnsupportedZodType } from './_tsup-dts-rollup.cjs';
|
|
12
|
-
export { SupportedZodType } from './_tsup-dts-rollup.cjs';
|
|
13
|
-
export { AllZodType } from './_tsup-dts-rollup.cjs';
|
|
14
|
-
export { ZodShape } from './_tsup-dts-rollup.cjs';
|
|
15
|
-
export { ShapeKey } from './_tsup-dts-rollup.cjs';
|
|
16
|
-
export { ShapeValue } from './_tsup-dts-rollup.cjs';
|
|
17
|
-
export { isOptional } from './_tsup-dts-rollup.cjs';
|
|
18
|
-
export { isObj } from './_tsup-dts-rollup.cjs';
|
|
19
|
-
export { isArr } from './_tsup-dts-rollup.cjs';
|
|
20
|
-
export { isUnion } from './_tsup-dts-rollup.cjs';
|
|
21
|
-
export { isString } from './_tsup-dts-rollup.cjs';
|
|
22
|
-
export { isNumber } from './_tsup-dts-rollup.cjs';
|
|
23
|
-
export { convertZodSchemaToAISDKSchema } from './_tsup-dts-rollup.cjs';
|
|
24
|
-
export { applyCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
25
|
-
export { convertSchemaToZod } from './_tsup-dts-rollup.cjs';
|
|
26
|
-
export { AnthropicSchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
27
|
-
export { DeepSeekSchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
28
|
-
export { GoogleSchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
29
|
-
export { MetaSchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
30
|
-
export { OpenAISchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|
|
31
|
-
export { OpenAIReasoningSchemaCompatLayer } from './_tsup-dts-rollup.cjs';
|