@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.
- package/CHANGELOG.md +140 -2
- package/README.md +0 -4
- package/dist/chunk-5WM4A32G.cjs +83 -0
- package/dist/chunk-5WM4A32G.cjs.map +1 -0
- package/dist/chunk-U2HXWNAF.js +77 -0
- package/dist/chunk-U2HXWNAF.js.map +1 -0
- package/dist/index.cjs +860 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +859 -139
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/anthropic.d.ts +7 -5
- package/dist/provider-compats/anthropic.d.ts.map +1 -1
- package/dist/provider-compats/deepseek.d.ts +7 -5
- package/dist/provider-compats/deepseek.d.ts.map +1 -1
- package/dist/provider-compats/google.d.ts +7 -5
- package/dist/provider-compats/google.d.ts.map +1 -1
- package/dist/provider-compats/meta.d.ts +7 -5
- package/dist/provider-compats/meta.d.ts.map +1 -1
- package/dist/provider-compats/openai-reasoning.d.ts +7 -5
- package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
- package/dist/provider-compats/openai.d.ts +7 -5
- package/dist/provider-compats/openai.d.ts.map +1 -1
- package/dist/schema-compatibility-v3.d.ts +288 -0
- package/dist/schema-compatibility-v3.d.ts.map +1 -0
- package/dist/schema-compatibility-v4.d.ts +279 -0
- package/dist/schema-compatibility-v4.d.ts.map +1 -0
- package/dist/schema-compatibility.d.ts +81 -165
- package/dist/schema-compatibility.d.ts.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils-test-suite.d.ts +2 -0
- package/dist/utils-test-suite.d.ts.map +1 -0
- package/dist/utils.d.ts +17 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/zod-to-json-test-suite.d.ts +6 -0
- package/dist/zod-to-json-test-suite.d.ts.map +1 -0
- package/dist/zod-to-json.cjs +12 -0
- package/dist/zod-to-json.cjs.map +1 -0
- package/dist/zod-to-json.d.ts +6 -0
- package/dist/zod-to-json.d.ts.map +1 -0
- package/dist/zod-to-json.js +3 -0
- package/dist/zod-to-json.js.map +1 -0
- package/dist/zodTypes.d.ts +21 -0
- package/dist/zodTypes.d.ts.map +1 -0
- package/package.json +35 -10
- package/.turbo/turbo-build.log +0 -4
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -39
- package/src/provider-compats/anthropic.ts +0 -43
- package/src/provider-compats/deepseek.ts +0 -35
- package/src/provider-compats/google.ts +0 -63
- package/src/provider-compats/meta.ts +0 -36
- package/src/provider-compats/openai-reasoning.ts +0 -88
- package/src/provider-compats/openai.ts +0 -56
- package/src/provider-compats.test.ts +0 -312
- package/src/schema-compatibility.test.ts +0 -479
- package/src/schema-compatibility.ts +0 -590
- package/src/utils.test.ts +0 -442
- package/src/utils.ts +0 -205
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -22
- package/vitest.config.ts +0 -7
package/dist/index.cjs
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk5WM4A32G_cjs = require('./chunk-5WM4A32G.cjs');
|
|
3
4
|
var zod = require('zod');
|
|
4
5
|
var ai = require('ai');
|
|
5
6
|
var zodFromJsonSchema = require('zod-from-json-schema');
|
|
6
|
-
var
|
|
7
|
+
var zodFromJsonSchemaV3 = require('zod-from-json-schema-v3');
|
|
8
|
+
var v4 = require('zod/v4');
|
|
7
9
|
|
|
8
|
-
// src/schema-compatibility.ts
|
|
9
10
|
function convertZodSchemaToAISDKSchema(zodSchema, target = "jsonSchema7") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
validate: (value) => {
|
|
17
|
-
const result = zodSchema.safeParse(value);
|
|
18
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
19
|
-
}
|
|
11
|
+
const jsonSchemaToUse = chunk5WM4A32G_cjs.zodToJsonSchema(zodSchema, target);
|
|
12
|
+
return ai.jsonSchema(jsonSchemaToUse, {
|
|
13
|
+
validate: (value) => {
|
|
14
|
+
const result = zodSchema.safeParse(value);
|
|
15
|
+
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
20
16
|
}
|
|
21
|
-
);
|
|
17
|
+
});
|
|
22
18
|
}
|
|
23
19
|
function isZodType(value) {
|
|
24
20
|
return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
|
|
@@ -29,7 +25,11 @@ function convertSchemaToZod(schema) {
|
|
|
29
25
|
} else {
|
|
30
26
|
const jsonSchemaToConvert = "jsonSchema" in schema ? schema.jsonSchema : schema;
|
|
31
27
|
try {
|
|
32
|
-
|
|
28
|
+
if ("toJSONSchema" in zod.z) {
|
|
29
|
+
return zodFromJsonSchema.convertJsonSchemaToZod(jsonSchemaToConvert);
|
|
30
|
+
} else {
|
|
31
|
+
return zodFromJsonSchemaV3.convertJsonSchemaToZod(jsonSchemaToConvert);
|
|
32
|
+
}
|
|
33
33
|
} catch (e) {
|
|
34
34
|
const errorMessage = `[Schema Builder] Failed to convert schema parameters to Zod. Original schema: ${JSON.stringify(jsonSchemaToConvert)}`;
|
|
35
35
|
console.error(errorMessage, e);
|
|
@@ -55,13 +55,13 @@ function applyCompatLayer({
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
if (mode === "jsonSchema") {
|
|
58
|
-
return
|
|
58
|
+
return chunk5WM4A32G_cjs.zodToJsonSchema(zodSchema, "jsonSchema7");
|
|
59
59
|
} else {
|
|
60
60
|
return convertZodSchemaToAISDKSchema(zodSchema);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// src/schema-compatibility.ts
|
|
64
|
+
// src/schema-compatibility-v3.ts
|
|
65
65
|
var ALL_STRING_CHECKS = ["regex", "emoji", "email", "url", "uuid", "cuid", "min", "max"];
|
|
66
66
|
var ALL_NUMBER_CHECKS = [
|
|
67
67
|
"min",
|
|
@@ -73,13 +73,10 @@ var ALL_NUMBER_CHECKS = [
|
|
|
73
73
|
var ALL_ARRAY_CHECKS = ["min", "max", "length"];
|
|
74
74
|
var isOptional = (v) => v instanceof zod.ZodOptional;
|
|
75
75
|
var isObj = (v) => v instanceof zod.ZodObject;
|
|
76
|
-
var isNull = (v) => v instanceof zod.ZodNull;
|
|
77
76
|
var isArr = (v) => v instanceof zod.ZodArray;
|
|
78
77
|
var isUnion = (v) => v instanceof zod.ZodUnion;
|
|
79
78
|
var isString = (v) => v instanceof zod.ZodString;
|
|
80
79
|
var isNumber = (v) => v instanceof zod.ZodNumber;
|
|
81
|
-
var isDate = (v) => v instanceof zod.ZodDate;
|
|
82
|
-
var isDefault = (v) => v instanceof zod.ZodDefault;
|
|
83
80
|
var UNSUPPORTED_ZOD_TYPES = ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
|
|
84
81
|
var SUPPORTED_ZOD_TYPES = [
|
|
85
82
|
"ZodObject",
|
|
@@ -94,13 +91,15 @@ var SUPPORTED_ZOD_TYPES = [
|
|
|
94
91
|
var ALL_ZOD_TYPES = [...SUPPORTED_ZOD_TYPES, ...UNSUPPORTED_ZOD_TYPES];
|
|
95
92
|
var SchemaCompatLayer = class {
|
|
96
93
|
model;
|
|
94
|
+
parent;
|
|
97
95
|
/**
|
|
98
96
|
* Creates a new schema compatibility instance.
|
|
99
97
|
*
|
|
100
98
|
* @param model - The language model this compatibility layer applies to
|
|
101
99
|
*/
|
|
102
|
-
constructor(model) {
|
|
100
|
+
constructor(model, parent) {
|
|
103
101
|
this.model = model;
|
|
102
|
+
this.parent = parent;
|
|
104
103
|
}
|
|
105
104
|
/**
|
|
106
105
|
* Gets the language model associated with this compatibility layer.
|
|
@@ -110,6 +109,91 @@ var SchemaCompatLayer = class {
|
|
|
110
109
|
getModel() {
|
|
111
110
|
return this.model;
|
|
112
111
|
}
|
|
112
|
+
getUnsupportedZodTypes() {
|
|
113
|
+
return UNSUPPORTED_ZOD_TYPES;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Type guard for optional Zod types
|
|
117
|
+
*/
|
|
118
|
+
isOptional(v) {
|
|
119
|
+
return v instanceof zod.ZodOptional;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Type guard for object Zod types
|
|
123
|
+
*/
|
|
124
|
+
isObj(v) {
|
|
125
|
+
return v instanceof zod.ZodObject;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Type guard for null Zod types
|
|
129
|
+
*/
|
|
130
|
+
isNull(v) {
|
|
131
|
+
return v instanceof zod.ZodNull;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Type guard for array Zod types
|
|
135
|
+
*/
|
|
136
|
+
isArr(v) {
|
|
137
|
+
return v instanceof zod.ZodArray;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Type guard for union Zod types
|
|
141
|
+
*/
|
|
142
|
+
isUnion(v) {
|
|
143
|
+
return v instanceof zod.ZodUnion;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Type guard for string Zod types
|
|
147
|
+
*/
|
|
148
|
+
isString(v) {
|
|
149
|
+
return v instanceof zod.ZodString;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Type guard for number Zod types
|
|
153
|
+
*/
|
|
154
|
+
isNumber(v) {
|
|
155
|
+
return v instanceof zod.ZodNumber;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Type guard for date Zod types
|
|
159
|
+
*/
|
|
160
|
+
isDate(v) {
|
|
161
|
+
return v instanceof zod.ZodDate;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Type guard for default Zod types
|
|
165
|
+
*/
|
|
166
|
+
isDefault(v) {
|
|
167
|
+
return v instanceof zod.ZodDefault;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Determines whether this compatibility layer should be applied for the current model.
|
|
171
|
+
*
|
|
172
|
+
* @returns True if this compatibility layer should be used, false otherwise
|
|
173
|
+
* @abstract
|
|
174
|
+
*/
|
|
175
|
+
shouldApply() {
|
|
176
|
+
return this.parent.shouldApply();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Returns the JSON Schema target format for this provider.
|
|
180
|
+
*
|
|
181
|
+
* @returns The schema target format, or undefined to use the default 'jsonSchema7'
|
|
182
|
+
* @abstract
|
|
183
|
+
*/
|
|
184
|
+
getSchemaTarget() {
|
|
185
|
+
return this.parent.getSchemaTarget();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Processes a specific Zod type according to the provider's requirements.
|
|
189
|
+
*
|
|
190
|
+
* @param value - The Zod type to process
|
|
191
|
+
* @returns The processed Zod type
|
|
192
|
+
* @abstract
|
|
193
|
+
*/
|
|
194
|
+
processZodType(value) {
|
|
195
|
+
return this.parent.processZodType(value);
|
|
196
|
+
}
|
|
113
197
|
/**
|
|
114
198
|
* Default handler for Zod object types. Recursively processes all properties in the object.
|
|
115
199
|
*
|
|
@@ -147,8 +231,8 @@ var SchemaCompatLayer = class {
|
|
|
147
231
|
* @returns The updated description with constraints, or undefined if no constraints
|
|
148
232
|
*/
|
|
149
233
|
mergeParameterDescription(description, constraints) {
|
|
150
|
-
if (
|
|
151
|
-
return (description ? description + "\n" : "") +
|
|
234
|
+
if (constraints.length > 0) {
|
|
235
|
+
return (description ? description + "\n" : "") + `constraints: ${constraints.join(`, `)}`;
|
|
152
236
|
} else {
|
|
153
237
|
return description;
|
|
154
238
|
}
|
|
@@ -178,24 +262,24 @@ var SchemaCompatLayer = class {
|
|
|
178
262
|
const zodArrayDef = value._def;
|
|
179
263
|
const processedType = this.processZodType(zodArrayDef.type);
|
|
180
264
|
let result = zod.z.array(processedType);
|
|
181
|
-
const constraints =
|
|
265
|
+
const constraints = [];
|
|
182
266
|
if (zodArrayDef.minLength?.value !== void 0) {
|
|
183
267
|
if (handleChecks.includes("min")) {
|
|
184
|
-
constraints.
|
|
268
|
+
constraints.push(`minimum length ${zodArrayDef.minLength.value}`);
|
|
185
269
|
} else {
|
|
186
270
|
result = result.min(zodArrayDef.minLength.value);
|
|
187
271
|
}
|
|
188
272
|
}
|
|
189
273
|
if (zodArrayDef.maxLength?.value !== void 0) {
|
|
190
274
|
if (handleChecks.includes("max")) {
|
|
191
|
-
constraints.
|
|
275
|
+
constraints.push(`maximum length ${zodArrayDef.maxLength.value}`);
|
|
192
276
|
} else {
|
|
193
277
|
result = result.max(zodArrayDef.maxLength.value);
|
|
194
278
|
}
|
|
195
279
|
}
|
|
196
280
|
if (zodArrayDef.exactLength?.value !== void 0) {
|
|
197
281
|
if (handleChecks.includes("length")) {
|
|
198
|
-
constraints.
|
|
282
|
+
constraints.push(`exact length ${zodArrayDef.exactLength.value}`);
|
|
199
283
|
} else {
|
|
200
284
|
result = result.length(zodArrayDef.exactLength.value);
|
|
201
285
|
}
|
|
@@ -230,7 +314,7 @@ var SchemaCompatLayer = class {
|
|
|
230
314
|
* @returns The processed Zod string
|
|
231
315
|
*/
|
|
232
316
|
defaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {
|
|
233
|
-
const constraints =
|
|
317
|
+
const constraints = [];
|
|
234
318
|
const checks = value._def.checks || [];
|
|
235
319
|
const newChecks = [];
|
|
236
320
|
for (const check of checks) {
|
|
@@ -238,38 +322,20 @@ var SchemaCompatLayer = class {
|
|
|
238
322
|
if (handleChecks.includes(check.kind)) {
|
|
239
323
|
switch (check.kind) {
|
|
240
324
|
case "regex": {
|
|
241
|
-
constraints.regex
|
|
242
|
-
pattern: check.regex.source,
|
|
243
|
-
flags: check.regex.flags
|
|
244
|
-
};
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
case "emoji": {
|
|
248
|
-
constraints.emoji = true;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
case "email": {
|
|
252
|
-
constraints.email = true;
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
case "url": {
|
|
256
|
-
constraints.url = true;
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
case "uuid": {
|
|
260
|
-
constraints.uuid = true;
|
|
325
|
+
constraints.push(`input must match this regex ${check.regex.source}`);
|
|
261
326
|
break;
|
|
262
327
|
}
|
|
328
|
+
case "emoji":
|
|
329
|
+
case "email":
|
|
330
|
+
case "url":
|
|
331
|
+
case "uuid":
|
|
263
332
|
case "cuid": {
|
|
264
|
-
constraints.
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
case "min": {
|
|
268
|
-
constraints.minLength = check.value;
|
|
333
|
+
constraints.push(`a valid ${check.kind}`);
|
|
269
334
|
break;
|
|
270
335
|
}
|
|
336
|
+
case "min":
|
|
271
337
|
case "max": {
|
|
272
|
-
constraints.
|
|
338
|
+
constraints.push(`${check.kind}imum length ${check.value}`);
|
|
273
339
|
break;
|
|
274
340
|
}
|
|
275
341
|
}
|
|
@@ -296,7 +362,7 @@ var SchemaCompatLayer = class {
|
|
|
296
362
|
* @returns The processed Zod number
|
|
297
363
|
*/
|
|
298
364
|
defaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {
|
|
299
|
-
const constraints =
|
|
365
|
+
const constraints = [];
|
|
300
366
|
const checks = value._def.checks || [];
|
|
301
367
|
const newChecks = [];
|
|
302
368
|
for (const check of checks) {
|
|
@@ -305,20 +371,20 @@ var SchemaCompatLayer = class {
|
|
|
305
371
|
switch (check.kind) {
|
|
306
372
|
case "min":
|
|
307
373
|
if (check.inclusive) {
|
|
308
|
-
constraints.
|
|
374
|
+
constraints.push(`greater than or equal to ${check.value}`);
|
|
309
375
|
} else {
|
|
310
|
-
constraints.
|
|
376
|
+
constraints.push(`greater than ${check.value}`);
|
|
311
377
|
}
|
|
312
378
|
break;
|
|
313
379
|
case "max":
|
|
314
380
|
if (check.inclusive) {
|
|
315
|
-
constraints.
|
|
381
|
+
constraints.push(`lower than or equal to ${check.value}`);
|
|
316
382
|
} else {
|
|
317
|
-
constraints.
|
|
383
|
+
constraints.push(`lower than ${check.value}`);
|
|
318
384
|
}
|
|
319
385
|
break;
|
|
320
386
|
case "multipleOf": {
|
|
321
|
-
constraints.
|
|
387
|
+
constraints.push(`multiple of ${check.value}`);
|
|
322
388
|
break;
|
|
323
389
|
}
|
|
324
390
|
}
|
|
@@ -353,7 +419,7 @@ var SchemaCompatLayer = class {
|
|
|
353
419
|
* @returns A Zod string schema representing the date in ISO format
|
|
354
420
|
*/
|
|
355
421
|
defaultZodDateHandler(value) {
|
|
356
|
-
const constraints =
|
|
422
|
+
const constraints = [];
|
|
357
423
|
const checks = value._def.checks || [];
|
|
358
424
|
for (const check of checks) {
|
|
359
425
|
if ("kind" in check) {
|
|
@@ -361,19 +427,19 @@ var SchemaCompatLayer = class {
|
|
|
361
427
|
case "min":
|
|
362
428
|
const minDate = new Date(check.value);
|
|
363
429
|
if (!isNaN(minDate.getTime())) {
|
|
364
|
-
constraints.
|
|
430
|
+
constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
|
|
365
431
|
}
|
|
366
432
|
break;
|
|
367
433
|
case "max":
|
|
368
434
|
const maxDate = new Date(check.value);
|
|
369
435
|
if (!isNaN(maxDate.getTime())) {
|
|
370
|
-
constraints.
|
|
436
|
+
constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);
|
|
371
437
|
}
|
|
372
438
|
break;
|
|
373
439
|
}
|
|
374
440
|
}
|
|
375
441
|
}
|
|
376
|
-
constraints.
|
|
442
|
+
constraints.push(`Date format is date-time`);
|
|
377
443
|
let result = zod.z.string().describe("date-time");
|
|
378
444
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
379
445
|
if (description) {
|
|
@@ -415,9 +481,667 @@ var SchemaCompatLayer = class {
|
|
|
415
481
|
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
416
482
|
}
|
|
417
483
|
};
|
|
484
|
+
var ALL_STRING_CHECKS2 = [
|
|
485
|
+
"regex",
|
|
486
|
+
"emoji",
|
|
487
|
+
"email",
|
|
488
|
+
"url",
|
|
489
|
+
"uuid",
|
|
490
|
+
"cuid",
|
|
491
|
+
"min_length",
|
|
492
|
+
"max_length",
|
|
493
|
+
"string_format"
|
|
494
|
+
];
|
|
495
|
+
var ALL_NUMBER_CHECKS2 = ["greater_than", "less_than", "multiple_of"];
|
|
496
|
+
var ALL_ARRAY_CHECKS2 = ["min", "max", "length"];
|
|
497
|
+
var UNSUPPORTED_ZOD_TYPES2 = ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
|
|
498
|
+
var SUPPORTED_ZOD_TYPES2 = [
|
|
499
|
+
"ZodObject",
|
|
500
|
+
"ZodArray",
|
|
501
|
+
"ZodUnion",
|
|
502
|
+
"ZodString",
|
|
503
|
+
"ZodNumber",
|
|
504
|
+
"ZodDate",
|
|
505
|
+
"ZodAny",
|
|
506
|
+
"ZodDefault"
|
|
507
|
+
];
|
|
508
|
+
var SchemaCompatLayer2 = class {
|
|
509
|
+
model;
|
|
510
|
+
parent;
|
|
511
|
+
/**
|
|
512
|
+
* Creates a new schema compatibility instance.
|
|
513
|
+
*
|
|
514
|
+
* @param model - The language model this compatibility layer applies to
|
|
515
|
+
*/
|
|
516
|
+
constructor(model, parent) {
|
|
517
|
+
this.model = model;
|
|
518
|
+
this.parent = parent;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Gets the language model associated with this compatibility layer.
|
|
522
|
+
*
|
|
523
|
+
* @returns The language model instance
|
|
524
|
+
*/
|
|
525
|
+
getModel() {
|
|
526
|
+
return this.model;
|
|
527
|
+
}
|
|
528
|
+
getUnsupportedZodTypes() {
|
|
529
|
+
return UNSUPPORTED_ZOD_TYPES2;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Type guard for optional Zod types
|
|
533
|
+
*/
|
|
534
|
+
isOptional(v) {
|
|
535
|
+
return v instanceof v4.ZodOptional;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Type guard for object Zod types
|
|
539
|
+
*/
|
|
540
|
+
isObj(v) {
|
|
541
|
+
return v instanceof v4.ZodObject;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Type guard for null Zod types
|
|
545
|
+
*/
|
|
546
|
+
isNull(v) {
|
|
547
|
+
return v instanceof v4.ZodNull;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Type guard for array Zod types
|
|
551
|
+
*/
|
|
552
|
+
isArr(v) {
|
|
553
|
+
return v instanceof v4.ZodArray;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Type guard for union Zod types
|
|
557
|
+
*/
|
|
558
|
+
isUnion(v) {
|
|
559
|
+
return v instanceof v4.ZodUnion;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Type guard for string Zod types
|
|
563
|
+
*/
|
|
564
|
+
isString(v) {
|
|
565
|
+
return v instanceof v4.ZodString;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Type guard for number Zod types
|
|
569
|
+
*/
|
|
570
|
+
isNumber(v) {
|
|
571
|
+
return v instanceof v4.ZodNumber;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Type guard for date Zod types
|
|
575
|
+
*/
|
|
576
|
+
isDate(v) {
|
|
577
|
+
return v instanceof v4.ZodDate;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Type guard for default Zod types
|
|
581
|
+
*/
|
|
582
|
+
isDefault(v) {
|
|
583
|
+
return v instanceof v4.ZodDefault;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Determines whether this compatibility layer should be applied for the current model.
|
|
587
|
+
*
|
|
588
|
+
* @returns True if this compatibility layer should be used, false otherwise
|
|
589
|
+
* @abstract
|
|
590
|
+
*/
|
|
591
|
+
shouldApply() {
|
|
592
|
+
return this.parent.shouldApply();
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Returns the JSON Schema target format for this provider.
|
|
596
|
+
*
|
|
597
|
+
* @returns The schema target format, or undefined to use the default 'jsonSchema7'
|
|
598
|
+
* @abstract
|
|
599
|
+
*/
|
|
600
|
+
getSchemaTarget() {
|
|
601
|
+
return this.parent.getSchemaTarget();
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Processes a specific Zod type according to the provider's requirements.
|
|
605
|
+
*
|
|
606
|
+
* @param value - The Zod type to process
|
|
607
|
+
* @returns The processed Zod type
|
|
608
|
+
* @abstract
|
|
609
|
+
*/
|
|
610
|
+
processZodType(value) {
|
|
611
|
+
return this.parent.processZodType(value);
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Default handler for Zod object types. Recursively processes all properties in the object.
|
|
615
|
+
*
|
|
616
|
+
* @param value - The Zod object to process
|
|
617
|
+
* @returns The processed Zod object
|
|
618
|
+
*/
|
|
619
|
+
defaultZodObjectHandler(value, options = { passthrough: true }) {
|
|
620
|
+
const processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {
|
|
621
|
+
acc[key] = this.processZodType(propValue);
|
|
622
|
+
return acc;
|
|
623
|
+
}, {});
|
|
624
|
+
let result = v4.z.object(processedShape);
|
|
625
|
+
if (value._zod.def.catchall instanceof v4.z.ZodNever) {
|
|
626
|
+
result = v4.z.strictObject(processedShape);
|
|
627
|
+
}
|
|
628
|
+
if (value._zod.def.catchall && !(value._zod.def.catchall instanceof v4.z.ZodNever)) {
|
|
629
|
+
result = result.catchall(value._zod.def.catchall);
|
|
630
|
+
}
|
|
631
|
+
if (value.description) {
|
|
632
|
+
result = result.describe(value.description);
|
|
633
|
+
}
|
|
634
|
+
if (options.passthrough && value._zod.def.catchall instanceof v4.z.ZodUnknown) {
|
|
635
|
+
result = v4.z.looseObject(processedShape);
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Merges validation constraints into a parameter description.
|
|
641
|
+
*
|
|
642
|
+
* This helper method converts validation constraints that may not be supported
|
|
643
|
+
* by a provider into human-readable descriptions.
|
|
644
|
+
*
|
|
645
|
+
* @param description - The existing parameter description
|
|
646
|
+
* @param constraints - The validation constraints to merge
|
|
647
|
+
* @returns The updated description with constraints, or undefined if no constraints
|
|
648
|
+
*/
|
|
649
|
+
mergeParameterDescription(description, constraints) {
|
|
650
|
+
if (constraints.length > 0) {
|
|
651
|
+
return (description ? description + "\n" : "") + `constraints: ${constraints.join(`, `)}`;
|
|
652
|
+
} else {
|
|
653
|
+
return description;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Default handler for unsupported Zod types. Throws an error for specified unsupported types.
|
|
658
|
+
*
|
|
659
|
+
* @param value - The Zod type to check
|
|
660
|
+
* @param throwOnTypes - Array of type names to throw errors for
|
|
661
|
+
* @returns The original value if not in the throw list
|
|
662
|
+
* @throws Error if the type is in the unsupported list
|
|
663
|
+
*/
|
|
664
|
+
defaultUnsupportedZodTypeHandler(value, throwOnTypes = UNSUPPORTED_ZOD_TYPES2) {
|
|
665
|
+
if (throwOnTypes.includes(value.constructor.name)) {
|
|
666
|
+
throw new Error(`${this.model.modelId} does not support zod type: ${value.constructor.name}`);
|
|
667
|
+
}
|
|
668
|
+
return value;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Default handler for Zod array types. Processes array constraints according to provider support.
|
|
672
|
+
*
|
|
673
|
+
* @param value - The Zod array to process
|
|
674
|
+
* @param handleChecks - Array constraints to convert to descriptions vs keep as validation
|
|
675
|
+
* @returns The processed Zod array
|
|
676
|
+
*/
|
|
677
|
+
defaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS2) {
|
|
678
|
+
const zodArrayDef = value._zod.def;
|
|
679
|
+
const processedType = this.processZodType(zodArrayDef.element);
|
|
680
|
+
let result = v4.z.array(processedType);
|
|
681
|
+
const constraints = [];
|
|
682
|
+
if (zodArrayDef.checks) {
|
|
683
|
+
for (const check of zodArrayDef.checks) {
|
|
684
|
+
if (check._zod.def.check === "min_length") {
|
|
685
|
+
if (handleChecks.includes("min")) {
|
|
686
|
+
constraints.push(`minimum length ${check._zod.def.minimum}`);
|
|
687
|
+
} else {
|
|
688
|
+
result = result.min(check._zod.def.minimum);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (check._zod.def.check === "max_length") {
|
|
692
|
+
if (handleChecks.includes("max")) {
|
|
693
|
+
constraints.push(`maximum length ${check._zod.def.maximum}`);
|
|
694
|
+
} else {
|
|
695
|
+
result = result.max(check._zod.def.maximum);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (check._zod.def.check === "length_equals") {
|
|
699
|
+
if (handleChecks.includes("length")) {
|
|
700
|
+
constraints.push(`exact length ${check._zod.def.length}`);
|
|
701
|
+
} else {
|
|
702
|
+
result = result.length(check._zod.def.length);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
const metaDescription = value.meta()?.description;
|
|
708
|
+
const legacyDescription = value.description;
|
|
709
|
+
const description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);
|
|
710
|
+
if (description) {
|
|
711
|
+
result = result.describe(description);
|
|
712
|
+
}
|
|
713
|
+
return result;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Default handler for Zod union types. Processes all union options.
|
|
717
|
+
*
|
|
718
|
+
* @param value - The Zod union to process
|
|
719
|
+
* @returns The processed Zod union
|
|
720
|
+
* @throws Error if union has fewer than 2 options
|
|
721
|
+
*/
|
|
722
|
+
defaultZodUnionHandler(value) {
|
|
723
|
+
const processedOptions = value._zod.def.options.map((option) => this.processZodType(option));
|
|
724
|
+
if (processedOptions.length < 2) throw new Error("Union must have at least 2 options");
|
|
725
|
+
let result = v4.z.union(processedOptions);
|
|
726
|
+
if (value.description) {
|
|
727
|
+
result = result.describe(value.description);
|
|
728
|
+
}
|
|
729
|
+
return result;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Default handler for Zod string types. Processes string validation constraints.
|
|
733
|
+
*
|
|
734
|
+
* @param value - The Zod string to process
|
|
735
|
+
* @param handleChecks - String constraints to convert to descriptions vs keep as validation
|
|
736
|
+
* @returns The processed Zod string
|
|
737
|
+
*/
|
|
738
|
+
defaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS2) {
|
|
739
|
+
const constraints = [];
|
|
740
|
+
const checks = value._zod.def.checks || [];
|
|
741
|
+
const newChecks = [];
|
|
742
|
+
if (checks) {
|
|
743
|
+
for (const check of checks) {
|
|
744
|
+
if (handleChecks.includes(check._zod.def.check)) {
|
|
745
|
+
switch (check._zod.def.check) {
|
|
746
|
+
case "min_length":
|
|
747
|
+
constraints.push(`minimum length ${check._zod.def.minimum}`);
|
|
748
|
+
break;
|
|
749
|
+
case "max_length":
|
|
750
|
+
constraints.push(`maximum length ${check._zod.def.maximum}`);
|
|
751
|
+
break;
|
|
752
|
+
case "string_format":
|
|
753
|
+
{
|
|
754
|
+
switch (check._zod.def.format) {
|
|
755
|
+
case "email":
|
|
756
|
+
case "url":
|
|
757
|
+
case "emoji":
|
|
758
|
+
case "uuid":
|
|
759
|
+
case "cuid":
|
|
760
|
+
constraints.push(`a valid ${check._zod.def.format}`);
|
|
761
|
+
break;
|
|
762
|
+
case "regex":
|
|
763
|
+
constraints.push(`input must match this regex ${check._zod.def.pattern}`);
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
} else {
|
|
770
|
+
newChecks.push(check);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
let result = v4.z.string();
|
|
775
|
+
for (const check of newChecks) {
|
|
776
|
+
result = result.check(check);
|
|
777
|
+
}
|
|
778
|
+
const metaDescription = value.meta()?.description;
|
|
779
|
+
const legacyDescription = value.description;
|
|
780
|
+
const description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);
|
|
781
|
+
if (description) {
|
|
782
|
+
result = result.describe(description);
|
|
783
|
+
}
|
|
784
|
+
return result;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Default handler for Zod number types. Processes number validation constraints.
|
|
788
|
+
*
|
|
789
|
+
* @param value - The Zod number to process
|
|
790
|
+
* @param handleChecks - Number constraints to convert to descriptions vs keep as validation
|
|
791
|
+
* @returns The processed Zod number
|
|
792
|
+
*/
|
|
793
|
+
defaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS2) {
|
|
794
|
+
const constraints = [];
|
|
795
|
+
const checks = value._zod.def.checks || [];
|
|
796
|
+
const newChecks = [];
|
|
797
|
+
if (checks) {
|
|
798
|
+
for (const check of checks) {
|
|
799
|
+
if (handleChecks.includes(check._zod.def.check)) {
|
|
800
|
+
switch (check._zod.def.check) {
|
|
801
|
+
case "greater_than":
|
|
802
|
+
if (check._zod.def.inclusive) {
|
|
803
|
+
constraints.push(`greater than or equal to ${check._zod.def.value}`);
|
|
804
|
+
} else {
|
|
805
|
+
constraints.push(`greater than ${check._zod.def.value}`);
|
|
806
|
+
}
|
|
807
|
+
break;
|
|
808
|
+
case "less_than":
|
|
809
|
+
if (check._zod.def.inclusive) {
|
|
810
|
+
constraints.push(`lower than or equal to ${check._zod.def.value}`);
|
|
811
|
+
} else {
|
|
812
|
+
constraints.push(`lower than ${check._zod.def.value}`);
|
|
813
|
+
}
|
|
814
|
+
break;
|
|
815
|
+
case "multiple_of": {
|
|
816
|
+
constraints.push(`multiple of ${check._zod.def.value}`);
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
} else {
|
|
821
|
+
newChecks.push(check);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
let result = v4.z.number();
|
|
826
|
+
for (const check of newChecks) {
|
|
827
|
+
switch (check._zod.def.check) {
|
|
828
|
+
case "number_format": {
|
|
829
|
+
switch (check._zod.def.format) {
|
|
830
|
+
case "safeint":
|
|
831
|
+
result = result.int();
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
break;
|
|
835
|
+
}
|
|
836
|
+
default:
|
|
837
|
+
result = result.check(check);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const description = this.mergeParameterDescription(value.description, constraints);
|
|
841
|
+
if (description) {
|
|
842
|
+
result = result.describe(description);
|
|
843
|
+
}
|
|
844
|
+
return result;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.
|
|
848
|
+
*
|
|
849
|
+
* @param value - The Zod date to process
|
|
850
|
+
* @returns A Zod string schema representing the date in ISO format
|
|
851
|
+
*/
|
|
852
|
+
defaultZodDateHandler(value) {
|
|
853
|
+
const constraints = [];
|
|
854
|
+
const checks = value._zod.def.checks || [];
|
|
855
|
+
if (checks) {
|
|
856
|
+
for (const check of checks) {
|
|
857
|
+
switch (check._zod.def.check) {
|
|
858
|
+
case "less_than":
|
|
859
|
+
const minDate = new Date(check._zod.def.value);
|
|
860
|
+
if (!isNaN(minDate.getTime())) {
|
|
861
|
+
constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
|
|
862
|
+
}
|
|
863
|
+
break;
|
|
864
|
+
case "greater_than":
|
|
865
|
+
const maxDate = new Date(check._zod.def.value);
|
|
866
|
+
if (!isNaN(maxDate.getTime())) {
|
|
867
|
+
constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
constraints.push(`Date format is date-time`);
|
|
874
|
+
let result = v4.z.string().describe("date-time");
|
|
875
|
+
const description = this.mergeParameterDescription(value.description, constraints);
|
|
876
|
+
if (description) {
|
|
877
|
+
result = result.describe(description);
|
|
878
|
+
}
|
|
879
|
+
return result;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Default handler for Zod optional types. Processes the inner type and maintains optionality.
|
|
883
|
+
*
|
|
884
|
+
* @param value - The Zod optional to process
|
|
885
|
+
* @param handleTypes - Types that should be processed vs passed through
|
|
886
|
+
* @returns The processed Zod optional
|
|
887
|
+
*/
|
|
888
|
+
defaultZodOptionalHandler(value, handleTypes = SUPPORTED_ZOD_TYPES2) {
|
|
889
|
+
if (handleTypes.includes(value.constructor.name)) {
|
|
890
|
+
return this.processZodType(value._zod.def.innerType).optional();
|
|
891
|
+
} else {
|
|
892
|
+
return value;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Processes a Zod object schema and converts it to an AI SDK Schema.
|
|
897
|
+
*
|
|
898
|
+
* @param zodSchema - The Zod object schema to process
|
|
899
|
+
* @returns An AI SDK Schema with provider-specific compatibility applied
|
|
900
|
+
*/
|
|
901
|
+
processToAISDKSchema(zodSchema) {
|
|
902
|
+
const processedSchema = this.processZodType(zodSchema);
|
|
903
|
+
return convertZodSchemaToAISDKSchema(processedSchema, this.getSchemaTarget());
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Processes a Zod object schema and converts it to a JSON Schema.
|
|
907
|
+
*
|
|
908
|
+
* @param zodSchema - The Zod object schema to process
|
|
909
|
+
* @returns A JSONSchema7 object with provider-specific compatibility applied
|
|
910
|
+
*/
|
|
911
|
+
processToJSONSchema(zodSchema) {
|
|
912
|
+
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
// src/schema-compatibility.ts
|
|
917
|
+
var SchemaCompatLayer3 = class {
|
|
918
|
+
model;
|
|
919
|
+
v3Layer;
|
|
920
|
+
v4Layer;
|
|
921
|
+
/**
|
|
922
|
+
* Creates a new schema compatibility instance.
|
|
923
|
+
*
|
|
924
|
+
* @param model - The language model this compatibility layer applies to
|
|
925
|
+
*/
|
|
926
|
+
constructor(model) {
|
|
927
|
+
this.model = model;
|
|
928
|
+
this.v3Layer = new SchemaCompatLayer(model, this);
|
|
929
|
+
this.v4Layer = new SchemaCompatLayer2(model, this);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Gets the language model associated with this compatibility layer.
|
|
933
|
+
*
|
|
934
|
+
* @returns The language model instance
|
|
935
|
+
*/
|
|
936
|
+
getModel() {
|
|
937
|
+
return this.model;
|
|
938
|
+
}
|
|
939
|
+
getUnsupportedZodTypes(v) {
|
|
940
|
+
if ("_zod" in v) {
|
|
941
|
+
return this.v4Layer.getUnsupportedZodTypes();
|
|
942
|
+
} else {
|
|
943
|
+
return this.v3Layer.getUnsupportedZodTypes();
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
isOptional(v) {
|
|
947
|
+
if ("_zod" in v) {
|
|
948
|
+
return this.v4Layer.isOptional(v);
|
|
949
|
+
} else {
|
|
950
|
+
return this.v3Layer.isOptional(v);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
isObj(v) {
|
|
954
|
+
if ("_zod" in v) {
|
|
955
|
+
return this.v4Layer.isObj(v);
|
|
956
|
+
} else {
|
|
957
|
+
return this.v3Layer.isObj(v);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
isNull(v) {
|
|
961
|
+
if ("_zod" in v) {
|
|
962
|
+
return this.v4Layer.isNull(v);
|
|
963
|
+
} else {
|
|
964
|
+
return this.v3Layer.isNull(v);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
isArr(v) {
|
|
968
|
+
if ("_zod" in v) {
|
|
969
|
+
return this.v4Layer.isArr(v);
|
|
970
|
+
} else {
|
|
971
|
+
return this.v3Layer.isArr(v);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
isUnion(v) {
|
|
975
|
+
if ("_zod" in v) {
|
|
976
|
+
return this.v4Layer.isUnion(v);
|
|
977
|
+
} else {
|
|
978
|
+
return this.v3Layer.isUnion(v);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
isString(v) {
|
|
982
|
+
if ("_zod" in v) {
|
|
983
|
+
return this.v4Layer.isString(v);
|
|
984
|
+
} else {
|
|
985
|
+
return this.v3Layer.isString(v);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
isNumber(v) {
|
|
989
|
+
if ("_zod" in v) {
|
|
990
|
+
return this.v4Layer.isNumber(v);
|
|
991
|
+
} else {
|
|
992
|
+
return this.v3Layer.isNumber(v);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
isDate(v) {
|
|
996
|
+
if ("_zod" in v) {
|
|
997
|
+
return this.v4Layer.isDate(v);
|
|
998
|
+
} else {
|
|
999
|
+
return this.v3Layer.isDate(v);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
isDefault(v) {
|
|
1003
|
+
if ("_zod" in v) {
|
|
1004
|
+
return this.v4Layer.isDefault(v);
|
|
1005
|
+
} else {
|
|
1006
|
+
return this.v3Layer.isDefault(v);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
defaultZodObjectHandler(value, options = { passthrough: true }) {
|
|
1010
|
+
if ("_zod" in value) {
|
|
1011
|
+
return this.v4Layer.defaultZodObjectHandler(value, options);
|
|
1012
|
+
} else {
|
|
1013
|
+
return this.v3Layer.defaultZodObjectHandler(value, options);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Merges validation constraints into a parameter description.
|
|
1018
|
+
*
|
|
1019
|
+
* This helper method converts validation constraints that may not be supported
|
|
1020
|
+
* by a provider into human-readable descriptions.
|
|
1021
|
+
*
|
|
1022
|
+
* @param description - The existing parameter description
|
|
1023
|
+
* @param constraints - The validation constraints to merge
|
|
1024
|
+
* @returns The updated description with constraints, or undefined if no constraints
|
|
1025
|
+
*/
|
|
1026
|
+
mergeParameterDescription(description, constraints) {
|
|
1027
|
+
return this.v3Layer.mergeParameterDescription(description, constraints);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Default handler for unsupported Zod types. Throws an error for specified unsupported types.
|
|
1031
|
+
*
|
|
1032
|
+
* @param value - The Zod type to check
|
|
1033
|
+
* @param throwOnTypes - Array of type names to throw errors for
|
|
1034
|
+
* @returns The original value if not in the throw list
|
|
1035
|
+
* @throws Error if the type is in the unsupported list
|
|
1036
|
+
*/
|
|
1037
|
+
defaultUnsupportedZodTypeHandler(value, throwOnTypes) {
|
|
1038
|
+
if ("_zod" in value) {
|
|
1039
|
+
return this.v4Layer.defaultUnsupportedZodTypeHandler(
|
|
1040
|
+
// @ts-expect-error - fix later
|
|
1041
|
+
value,
|
|
1042
|
+
throwOnTypes ?? UNSUPPORTED_ZOD_TYPES2
|
|
1043
|
+
);
|
|
1044
|
+
} else {
|
|
1045
|
+
return this.v3Layer.defaultUnsupportedZodTypeHandler(
|
|
1046
|
+
value,
|
|
1047
|
+
throwOnTypes ?? UNSUPPORTED_ZOD_TYPES
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
defaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS) {
|
|
1052
|
+
if ("_zod" in value) {
|
|
1053
|
+
return this.v4Layer.defaultZodArrayHandler(value, handleChecks);
|
|
1054
|
+
} else {
|
|
1055
|
+
return this.v3Layer.defaultZodArrayHandler(value, handleChecks);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
defaultZodUnionHandler(value) {
|
|
1059
|
+
if ("_zod" in value) {
|
|
1060
|
+
return this.v4Layer.defaultZodUnionHandler(value);
|
|
1061
|
+
} else {
|
|
1062
|
+
return this.v3Layer.defaultZodUnionHandler(value);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
defaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {
|
|
1066
|
+
if ("_zod" in value) {
|
|
1067
|
+
return this.v4Layer.defaultZodStringHandler(value);
|
|
1068
|
+
} else {
|
|
1069
|
+
return this.v3Layer.defaultZodStringHandler(value, handleChecks);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
defaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {
|
|
1073
|
+
if ("_zod" in value) {
|
|
1074
|
+
return this.v4Layer.defaultZodNumberHandler(value);
|
|
1075
|
+
} else {
|
|
1076
|
+
return this.v3Layer.defaultZodNumberHandler(value, handleChecks);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
defaultZodDateHandler(value) {
|
|
1080
|
+
if ("_zod" in value) {
|
|
1081
|
+
return this.v4Layer.defaultZodDateHandler(value);
|
|
1082
|
+
} else {
|
|
1083
|
+
return this.v3Layer.defaultZodDateHandler(value);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
defaultZodOptionalHandler(value, handleTypes) {
|
|
1087
|
+
if ("_zod" in value) {
|
|
1088
|
+
return this.v4Layer.defaultZodOptionalHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES2);
|
|
1089
|
+
} else {
|
|
1090
|
+
return this.v3Layer.defaultZodOptionalHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Processes a Zod object schema and converts it to an AI SDK Schema.
|
|
1095
|
+
*
|
|
1096
|
+
* @param zodSchema - The Zod object schema to process
|
|
1097
|
+
* @returns An AI SDK Schema with provider-specific compatibility applied
|
|
1098
|
+
*/
|
|
1099
|
+
processToAISDKSchema(zodSchema) {
|
|
1100
|
+
const processedSchema = this.processZodType(zodSchema);
|
|
1101
|
+
return convertZodSchemaToAISDKSchema(processedSchema, this.getSchemaTarget());
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Processes a Zod object schema and converts it to a JSON Schema.
|
|
1105
|
+
*
|
|
1106
|
+
* @param zodSchema - The Zod object schema to process
|
|
1107
|
+
* @returns A JSONSchema7 object with provider-specific compatibility applied
|
|
1108
|
+
*/
|
|
1109
|
+
processToJSONSchema(zodSchema) {
|
|
1110
|
+
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// src/zodTypes.ts
|
|
1115
|
+
function isOptional2(z10) {
|
|
1116
|
+
return (v) => v instanceof z10["ZodOptional"];
|
|
1117
|
+
}
|
|
1118
|
+
function isObj2(z10) {
|
|
1119
|
+
return (v) => v instanceof z10["ZodObject"];
|
|
1120
|
+
}
|
|
1121
|
+
function isNull(z10) {
|
|
1122
|
+
return (v) => v instanceof z10["ZodNull"];
|
|
1123
|
+
}
|
|
1124
|
+
function isArr2(z10) {
|
|
1125
|
+
return (v) => v instanceof z10["ZodArray"];
|
|
1126
|
+
}
|
|
1127
|
+
function isUnion2(z10) {
|
|
1128
|
+
return (v) => v instanceof z10["ZodUnion"];
|
|
1129
|
+
}
|
|
1130
|
+
function isString2(z10) {
|
|
1131
|
+
return (v) => v instanceof z10["ZodString"];
|
|
1132
|
+
}
|
|
1133
|
+
function isNumber2(z10) {
|
|
1134
|
+
return (v) => v instanceof z10["ZodNumber"];
|
|
1135
|
+
}
|
|
1136
|
+
function isDate(z10) {
|
|
1137
|
+
return (v) => v instanceof z10["ZodDate"];
|
|
1138
|
+
}
|
|
1139
|
+
function isDefault(z10) {
|
|
1140
|
+
return (v) => v instanceof z10["ZodDefault"];
|
|
1141
|
+
}
|
|
418
1142
|
|
|
419
1143
|
// src/provider-compats/anthropic.ts
|
|
420
|
-
var AnthropicSchemaCompatLayer = class extends
|
|
1144
|
+
var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
421
1145
|
constructor(model) {
|
|
422
1146
|
super(model);
|
|
423
1147
|
}
|
|
@@ -428,29 +1152,38 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
428
1152
|
return this.getModel().modelId.includes("claude");
|
|
429
1153
|
}
|
|
430
1154
|
processZodType(value) {
|
|
431
|
-
if (
|
|
432
|
-
const handleTypes = [
|
|
1155
|
+
if (isOptional2(zod.z)(value)) {
|
|
1156
|
+
const handleTypes = [
|
|
1157
|
+
"ZodObject",
|
|
1158
|
+
"ZodArray",
|
|
1159
|
+
"ZodUnion",
|
|
1160
|
+
"ZodNever",
|
|
1161
|
+
"ZodUndefined",
|
|
1162
|
+
"ZodTuple"
|
|
1163
|
+
];
|
|
433
1164
|
if (this.getModel().modelId.includes("claude-3.5-haiku")) handleTypes.push("ZodString");
|
|
434
1165
|
return this.defaultZodOptionalHandler(value, handleTypes);
|
|
435
|
-
} else if (
|
|
1166
|
+
} else if (isObj2(zod.z)(value)) {
|
|
436
1167
|
return this.defaultZodObjectHandler(value);
|
|
437
|
-
} else if (
|
|
1168
|
+
} else if (isArr2(zod.z)(value)) {
|
|
438
1169
|
return this.defaultZodArrayHandler(value, []);
|
|
439
|
-
} else if (
|
|
1170
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
440
1171
|
return this.defaultZodUnionHandler(value);
|
|
441
|
-
} else if (
|
|
1172
|
+
} else if (isString2(zod.z)(value)) {
|
|
442
1173
|
if (this.getModel().modelId.includes("claude-3.5-haiku")) {
|
|
443
1174
|
return this.defaultZodStringHandler(value, ["max", "min"]);
|
|
444
1175
|
} else {
|
|
445
1176
|
return value;
|
|
446
1177
|
}
|
|
447
1178
|
}
|
|
448
|
-
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1179
|
+
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1180
|
+
"ZodNever",
|
|
1181
|
+
"ZodTuple",
|
|
1182
|
+
"ZodUndefined"
|
|
1183
|
+
]);
|
|
449
1184
|
}
|
|
450
1185
|
};
|
|
451
|
-
|
|
452
|
-
// src/provider-compats/deepseek.ts
|
|
453
|
-
var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1186
|
+
var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
454
1187
|
constructor(model) {
|
|
455
1188
|
super(model);
|
|
456
1189
|
}
|
|
@@ -461,21 +1194,21 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
461
1194
|
return this.getModel().modelId.includes("deepseek") && !this.getModel().modelId.includes("r1");
|
|
462
1195
|
}
|
|
463
1196
|
processZodType(value) {
|
|
464
|
-
if (
|
|
1197
|
+
if (isOptional2(zod.z)(value)) {
|
|
465
1198
|
return this.defaultZodOptionalHandler(value, ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber"]);
|
|
466
|
-
} else if (
|
|
1199
|
+
} else if (isObj2(zod.z)(value)) {
|
|
467
1200
|
return this.defaultZodObjectHandler(value);
|
|
468
|
-
} else if (
|
|
1201
|
+
} else if (isArr2(zod.z)(value)) {
|
|
469
1202
|
return this.defaultZodArrayHandler(value, ["min", "max"]);
|
|
470
|
-
} else if (
|
|
1203
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
471
1204
|
return this.defaultZodUnionHandler(value);
|
|
472
|
-
} else if (
|
|
1205
|
+
} else if (isString2(zod.z)(value)) {
|
|
473
1206
|
return this.defaultZodStringHandler(value);
|
|
474
1207
|
}
|
|
475
1208
|
return value;
|
|
476
1209
|
}
|
|
477
1210
|
};
|
|
478
|
-
var GoogleSchemaCompatLayer = class extends
|
|
1211
|
+
var GoogleSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
479
1212
|
constructor(model) {
|
|
480
1213
|
super(model);
|
|
481
1214
|
}
|
|
@@ -486,34 +1219,25 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
486
1219
|
return this.getModel().provider.includes("google") || this.getModel().modelId.includes("google");
|
|
487
1220
|
}
|
|
488
1221
|
processZodType(value) {
|
|
489
|
-
if (
|
|
490
|
-
return this.defaultZodOptionalHandler(value, [
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
"ZodString",
|
|
495
|
-
"ZodNumber",
|
|
496
|
-
...UNSUPPORTED_ZOD_TYPES
|
|
497
|
-
]);
|
|
498
|
-
} else if (isNull(value)) {
|
|
499
|
-
return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value._def.description || "must be null");
|
|
500
|
-
} else if (isObj(value)) {
|
|
1222
|
+
if (isOptional2(zod.z)(value)) {
|
|
1223
|
+
return this.defaultZodOptionalHandler(value, ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber"]);
|
|
1224
|
+
} else if (isNull(zod.z)(value)) {
|
|
1225
|
+
return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value.description || "must be null");
|
|
1226
|
+
} else if (isObj2(zod.z)(value)) {
|
|
501
1227
|
return this.defaultZodObjectHandler(value);
|
|
502
|
-
} else if (
|
|
1228
|
+
} else if (isArr2(zod.z)(value)) {
|
|
503
1229
|
return this.defaultZodArrayHandler(value, []);
|
|
504
|
-
} else if (
|
|
1230
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
505
1231
|
return this.defaultZodUnionHandler(value);
|
|
506
|
-
} else if (
|
|
1232
|
+
} else if (isString2(zod.z)(value)) {
|
|
507
1233
|
return this.defaultZodStringHandler(value);
|
|
508
|
-
} else if (
|
|
1234
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
509
1235
|
return this.defaultZodNumberHandler(value);
|
|
510
1236
|
}
|
|
511
1237
|
return this.defaultUnsupportedZodTypeHandler(value);
|
|
512
1238
|
}
|
|
513
1239
|
};
|
|
514
|
-
|
|
515
|
-
// src/provider-compats/meta.ts
|
|
516
|
-
var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1240
|
+
var MetaSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
517
1241
|
constructor(model) {
|
|
518
1242
|
super(model);
|
|
519
1243
|
}
|
|
@@ -524,25 +1248,23 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
524
1248
|
return this.getModel().modelId.includes("meta");
|
|
525
1249
|
}
|
|
526
1250
|
processZodType(value) {
|
|
527
|
-
if (
|
|
1251
|
+
if (isOptional2(zod.z)(value)) {
|
|
528
1252
|
return this.defaultZodOptionalHandler(value, ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber"]);
|
|
529
|
-
} else if (
|
|
1253
|
+
} else if (isObj2(zod.z)(value)) {
|
|
530
1254
|
return this.defaultZodObjectHandler(value);
|
|
531
|
-
} else if (
|
|
1255
|
+
} else if (isArr2(zod.z)(value)) {
|
|
532
1256
|
return this.defaultZodArrayHandler(value, ["min", "max"]);
|
|
533
|
-
} else if (
|
|
1257
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
534
1258
|
return this.defaultZodUnionHandler(value);
|
|
535
|
-
} else if (
|
|
1259
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
536
1260
|
return this.defaultZodNumberHandler(value);
|
|
537
|
-
} else if (
|
|
1261
|
+
} else if (isString2(zod.z)(value)) {
|
|
538
1262
|
return this.defaultZodStringHandler(value);
|
|
539
1263
|
}
|
|
540
1264
|
return value;
|
|
541
1265
|
}
|
|
542
1266
|
};
|
|
543
|
-
|
|
544
|
-
// src/provider-compats/openai.ts
|
|
545
|
-
var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1267
|
+
var OpenAISchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
546
1268
|
constructor(model) {
|
|
547
1269
|
super(model);
|
|
548
1270
|
}
|
|
@@ -550,16 +1272,13 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
550
1272
|
return `jsonSchema7`;
|
|
551
1273
|
}
|
|
552
1274
|
shouldApply() {
|
|
553
|
-
if (
|
|
554
|
-
// !this.getModel().supportsStructuredOutputs && // <- TODO: this no longer exists, do we need it?
|
|
555
|
-
this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`)
|
|
556
|
-
) {
|
|
1275
|
+
if (!this.getModel().supportsStructuredOutputs && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))) {
|
|
557
1276
|
return true;
|
|
558
1277
|
}
|
|
559
1278
|
return false;
|
|
560
1279
|
}
|
|
561
1280
|
processZodType(value) {
|
|
562
|
-
if (
|
|
1281
|
+
if (isOptional2(zod.z)(value)) {
|
|
563
1282
|
return this.defaultZodOptionalHandler(value, [
|
|
564
1283
|
"ZodObject",
|
|
565
1284
|
"ZodArray",
|
|
@@ -569,24 +1288,28 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
569
1288
|
"ZodUndefined",
|
|
570
1289
|
"ZodTuple"
|
|
571
1290
|
]);
|
|
572
|
-
} else if (
|
|
1291
|
+
} else if (isObj2(zod.z)(value)) {
|
|
573
1292
|
return this.defaultZodObjectHandler(value);
|
|
574
|
-
} else if (
|
|
1293
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
575
1294
|
return this.defaultZodUnionHandler(value);
|
|
576
|
-
} else if (
|
|
1295
|
+
} else if (isArr2(zod.z)(value)) {
|
|
577
1296
|
return this.defaultZodArrayHandler(value);
|
|
578
|
-
} else if (
|
|
1297
|
+
} else if (isString2(zod.z)(value)) {
|
|
579
1298
|
const model = this.getModel();
|
|
580
1299
|
const checks = ["emoji"];
|
|
581
1300
|
if (model.modelId.includes("gpt-4o-mini")) {
|
|
582
|
-
|
|
1301
|
+
return this.defaultZodStringHandler(value, ["emoji", "regex"]);
|
|
583
1302
|
}
|
|
584
1303
|
return this.defaultZodStringHandler(value, checks);
|
|
585
1304
|
}
|
|
586
|
-
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1305
|
+
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1306
|
+
"ZodNever",
|
|
1307
|
+
"ZodUndefined",
|
|
1308
|
+
"ZodTuple"
|
|
1309
|
+
]);
|
|
587
1310
|
}
|
|
588
1311
|
};
|
|
589
|
-
var OpenAIReasoningSchemaCompatLayer = class extends
|
|
1312
|
+
var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
590
1313
|
constructor(model) {
|
|
591
1314
|
super(model);
|
|
592
1315
|
}
|
|
@@ -594,34 +1317,31 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
594
1317
|
return `openApi3`;
|
|
595
1318
|
}
|
|
596
1319
|
isReasoningModel() {
|
|
597
|
-
return this.getModel().modelId.includes(`o3`) || this.getModel().modelId.includes(`o4`);
|
|
1320
|
+
return this.getModel().modelId.includes(`o3`) || this.getModel().modelId.includes(`o4`) || this.getModel().modelId.includes(`o1`);
|
|
598
1321
|
}
|
|
599
1322
|
shouldApply() {
|
|
600
|
-
if (
|
|
601
|
-
// (this.getModel().supportsStructuredOutputs || this.isReasoningModel()) && // <- supportsStructuredOutputs no longer exists
|
|
602
|
-
this.isReasoningModel() && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))
|
|
603
|
-
) {
|
|
1323
|
+
if ((this.getModel().supportsStructuredOutputs || this.isReasoningModel()) && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))) {
|
|
604
1324
|
return true;
|
|
605
1325
|
}
|
|
606
1326
|
return false;
|
|
607
1327
|
}
|
|
608
1328
|
processZodType(value) {
|
|
609
|
-
if (
|
|
1329
|
+
if (isOptional2(zod.z)(value)) {
|
|
610
1330
|
const innerZodType = this.processZodType(value._def.innerType);
|
|
611
1331
|
return innerZodType.nullable();
|
|
612
|
-
} else if (
|
|
1332
|
+
} else if (isObj2(zod.z)(value)) {
|
|
613
1333
|
return this.defaultZodObjectHandler(value, { passthrough: false });
|
|
614
|
-
} else if (
|
|
1334
|
+
} else if (isArr2(zod.z)(value)) {
|
|
615
1335
|
return this.defaultZodArrayHandler(value);
|
|
616
|
-
} else if (
|
|
1336
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
617
1337
|
return this.defaultZodUnionHandler(value);
|
|
618
|
-
} else if (isDefault(value)) {
|
|
1338
|
+
} else if (isDefault(zod.z)(value)) {
|
|
619
1339
|
const defaultDef = value._def;
|
|
620
1340
|
const innerType = defaultDef.innerType;
|
|
621
|
-
const defaultValue = defaultDef.defaultValue();
|
|
622
|
-
const constraints =
|
|
1341
|
+
const defaultValue = typeof defaultDef.defaultValue === "function" ? defaultDef.defaultValue() : defaultDef.defaultValue;
|
|
1342
|
+
const constraints = [];
|
|
623
1343
|
if (defaultValue !== void 0) {
|
|
624
|
-
constraints.
|
|
1344
|
+
constraints.push(`the default value is ${defaultValue}`);
|
|
625
1345
|
}
|
|
626
1346
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
627
1347
|
let result = this.processZodType(innerType);
|
|
@@ -629,13 +1349,13 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
629
1349
|
result = result.describe(description);
|
|
630
1350
|
}
|
|
631
1351
|
return result;
|
|
632
|
-
} else if (
|
|
1352
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
633
1353
|
return this.defaultZodNumberHandler(value);
|
|
634
|
-
} else if (
|
|
1354
|
+
} else if (isString2(zod.z)(value)) {
|
|
635
1355
|
return this.defaultZodStringHandler(value);
|
|
636
|
-
} else if (isDate(value)) {
|
|
1356
|
+
} else if (isDate(zod.z)(value)) {
|
|
637
1357
|
return this.defaultZodDateHandler(value);
|
|
638
|
-
} else if (value.
|
|
1358
|
+
} else if (value.constructor.name === "ZodAny") {
|
|
639
1359
|
return zod.z.string().describe(
|
|
640
1360
|
(value.description ?? "") + `
|
|
641
1361
|
Argument was an "any" type, but you (the LLM) do not support "any", so it was cast to a "string" type`
|
|
@@ -656,7 +1376,9 @@ exports.MetaSchemaCompatLayer = MetaSchemaCompatLayer;
|
|
|
656
1376
|
exports.OpenAIReasoningSchemaCompatLayer = OpenAIReasoningSchemaCompatLayer;
|
|
657
1377
|
exports.OpenAISchemaCompatLayer = OpenAISchemaCompatLayer;
|
|
658
1378
|
exports.SUPPORTED_ZOD_TYPES = SUPPORTED_ZOD_TYPES;
|
|
659
|
-
exports.SchemaCompatLayer =
|
|
1379
|
+
exports.SchemaCompatLayer = SchemaCompatLayer3;
|
|
1380
|
+
exports.SchemaCompatLayerV3 = SchemaCompatLayer;
|
|
1381
|
+
exports.SchemaCompatLayerV4 = SchemaCompatLayer2;
|
|
660
1382
|
exports.UNSUPPORTED_ZOD_TYPES = UNSUPPORTED_ZOD_TYPES;
|
|
661
1383
|
exports.applyCompatLayer = applyCompatLayer;
|
|
662
1384
|
exports.convertSchemaToZod = convertSchemaToZod;
|