@mastra/schema-compat 0.0.0-ai-v5-20250813235735 → 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 +107 -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 +859 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +858 -135
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/anthropic.d.ts +5 -3
- package/dist/provider-compats/anthropic.d.ts.map +1 -1
- package/dist/provider-compats/deepseek.d.ts +5 -3
- package/dist/provider-compats/deepseek.d.ts.map +1 -1
- package/dist/provider-compats/google.d.ts +5 -3
- package/dist/provider-compats/google.d.ts.map +1 -1
- package/dist/provider-compats/meta.d.ts +5 -3
- package/dist/provider-compats/meta.d.ts.map +1 -1
- package/dist/provider-compats/openai-reasoning.d.ts +5 -3
- package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
- package/dist/provider-compats/openai.d.ts +5 -3
- 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 +79 -164
- 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 +16 -4
- 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 +34 -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 -62
- package/src/provider-compats/meta.ts +0 -36
- package/src/provider-compats/openai-reasoning.ts +0 -91
- package/src/provider-compats/openai.ts +0 -56
- package/src/provider-compats.test.ts +0 -383
- package/src/schema-compatibility.test.ts +0 -491
- package/src/schema-compatibility.ts +0 -592
- package/src/utils.test.ts +0 -463
- package/src/utils.ts +0 -205
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- 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,35 +322,20 @@ var SchemaCompatLayer = class {
|
|
|
238
322
|
if (handleChecks.includes(check.kind)) {
|
|
239
323
|
switch (check.kind) {
|
|
240
324
|
case "regex": {
|
|
241
|
-
constraints.
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
case "emoji": {
|
|
245
|
-
constraints.emoji = true;
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
case "email": {
|
|
249
|
-
constraints.email = true;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
case "url": {
|
|
253
|
-
constraints.url = true;
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case "uuid": {
|
|
257
|
-
constraints.uuid = true;
|
|
325
|
+
constraints.push(`input must match this regex ${check.regex.source}`);
|
|
258
326
|
break;
|
|
259
327
|
}
|
|
328
|
+
case "emoji":
|
|
329
|
+
case "email":
|
|
330
|
+
case "url":
|
|
331
|
+
case "uuid":
|
|
260
332
|
case "cuid": {
|
|
261
|
-
constraints.
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
case "min": {
|
|
265
|
-
constraints.minLength = check.value;
|
|
333
|
+
constraints.push(`a valid ${check.kind}`);
|
|
266
334
|
break;
|
|
267
335
|
}
|
|
336
|
+
case "min":
|
|
268
337
|
case "max": {
|
|
269
|
-
constraints.
|
|
338
|
+
constraints.push(`${check.kind}imum length ${check.value}`);
|
|
270
339
|
break;
|
|
271
340
|
}
|
|
272
341
|
}
|
|
@@ -293,7 +362,7 @@ var SchemaCompatLayer = class {
|
|
|
293
362
|
* @returns The processed Zod number
|
|
294
363
|
*/
|
|
295
364
|
defaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {
|
|
296
|
-
const constraints =
|
|
365
|
+
const constraints = [];
|
|
297
366
|
const checks = value._def.checks || [];
|
|
298
367
|
const newChecks = [];
|
|
299
368
|
for (const check of checks) {
|
|
@@ -302,20 +371,20 @@ var SchemaCompatLayer = class {
|
|
|
302
371
|
switch (check.kind) {
|
|
303
372
|
case "min":
|
|
304
373
|
if (check.inclusive) {
|
|
305
|
-
constraints.
|
|
374
|
+
constraints.push(`greater than or equal to ${check.value}`);
|
|
306
375
|
} else {
|
|
307
|
-
constraints.
|
|
376
|
+
constraints.push(`greater than ${check.value}`);
|
|
308
377
|
}
|
|
309
378
|
break;
|
|
310
379
|
case "max":
|
|
311
380
|
if (check.inclusive) {
|
|
312
|
-
constraints.
|
|
381
|
+
constraints.push(`lower than or equal to ${check.value}`);
|
|
313
382
|
} else {
|
|
314
|
-
constraints.
|
|
383
|
+
constraints.push(`lower than ${check.value}`);
|
|
315
384
|
}
|
|
316
385
|
break;
|
|
317
386
|
case "multipleOf": {
|
|
318
|
-
constraints.
|
|
387
|
+
constraints.push(`multiple of ${check.value}`);
|
|
319
388
|
break;
|
|
320
389
|
}
|
|
321
390
|
}
|
|
@@ -350,7 +419,7 @@ var SchemaCompatLayer = class {
|
|
|
350
419
|
* @returns A Zod string schema representing the date in ISO format
|
|
351
420
|
*/
|
|
352
421
|
defaultZodDateHandler(value) {
|
|
353
|
-
const constraints =
|
|
422
|
+
const constraints = [];
|
|
354
423
|
const checks = value._def.checks || [];
|
|
355
424
|
for (const check of checks) {
|
|
356
425
|
if ("kind" in check) {
|
|
@@ -358,19 +427,19 @@ var SchemaCompatLayer = class {
|
|
|
358
427
|
case "min":
|
|
359
428
|
const minDate = new Date(check.value);
|
|
360
429
|
if (!isNaN(minDate.getTime())) {
|
|
361
|
-
constraints.
|
|
430
|
+
constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
|
|
362
431
|
}
|
|
363
432
|
break;
|
|
364
433
|
case "max":
|
|
365
434
|
const maxDate = new Date(check.value);
|
|
366
435
|
if (!isNaN(maxDate.getTime())) {
|
|
367
|
-
constraints.
|
|
436
|
+
constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);
|
|
368
437
|
}
|
|
369
438
|
break;
|
|
370
439
|
}
|
|
371
440
|
}
|
|
372
441
|
}
|
|
373
|
-
constraints.
|
|
442
|
+
constraints.push(`Date format is date-time`);
|
|
374
443
|
let result = zod.z.string().describe("date-time");
|
|
375
444
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
376
445
|
if (description) {
|
|
@@ -412,9 +481,667 @@ var SchemaCompatLayer = class {
|
|
|
412
481
|
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
413
482
|
}
|
|
414
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
|
+
}
|
|
415
1142
|
|
|
416
1143
|
// src/provider-compats/anthropic.ts
|
|
417
|
-
var AnthropicSchemaCompatLayer = class extends
|
|
1144
|
+
var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
418
1145
|
constructor(model) {
|
|
419
1146
|
super(model);
|
|
420
1147
|
}
|
|
@@ -425,29 +1152,38 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
425
1152
|
return this.getModel().modelId.includes("claude");
|
|
426
1153
|
}
|
|
427
1154
|
processZodType(value) {
|
|
428
|
-
if (
|
|
429
|
-
const handleTypes = [
|
|
1155
|
+
if (isOptional2(zod.z)(value)) {
|
|
1156
|
+
const handleTypes = [
|
|
1157
|
+
"ZodObject",
|
|
1158
|
+
"ZodArray",
|
|
1159
|
+
"ZodUnion",
|
|
1160
|
+
"ZodNever",
|
|
1161
|
+
"ZodUndefined",
|
|
1162
|
+
"ZodTuple"
|
|
1163
|
+
];
|
|
430
1164
|
if (this.getModel().modelId.includes("claude-3.5-haiku")) handleTypes.push("ZodString");
|
|
431
1165
|
return this.defaultZodOptionalHandler(value, handleTypes);
|
|
432
|
-
} else if (
|
|
1166
|
+
} else if (isObj2(zod.z)(value)) {
|
|
433
1167
|
return this.defaultZodObjectHandler(value);
|
|
434
|
-
} else if (
|
|
1168
|
+
} else if (isArr2(zod.z)(value)) {
|
|
435
1169
|
return this.defaultZodArrayHandler(value, []);
|
|
436
|
-
} else if (
|
|
1170
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
437
1171
|
return this.defaultZodUnionHandler(value);
|
|
438
|
-
} else if (
|
|
1172
|
+
} else if (isString2(zod.z)(value)) {
|
|
439
1173
|
if (this.getModel().modelId.includes("claude-3.5-haiku")) {
|
|
440
1174
|
return this.defaultZodStringHandler(value, ["max", "min"]);
|
|
441
1175
|
} else {
|
|
442
1176
|
return value;
|
|
443
1177
|
}
|
|
444
1178
|
}
|
|
445
|
-
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1179
|
+
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1180
|
+
"ZodNever",
|
|
1181
|
+
"ZodTuple",
|
|
1182
|
+
"ZodUndefined"
|
|
1183
|
+
]);
|
|
446
1184
|
}
|
|
447
1185
|
};
|
|
448
|
-
|
|
449
|
-
// src/provider-compats/deepseek.ts
|
|
450
|
-
var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1186
|
+
var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
451
1187
|
constructor(model) {
|
|
452
1188
|
super(model);
|
|
453
1189
|
}
|
|
@@ -458,21 +1194,21 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
458
1194
|
return this.getModel().modelId.includes("deepseek") && !this.getModel().modelId.includes("r1");
|
|
459
1195
|
}
|
|
460
1196
|
processZodType(value) {
|
|
461
|
-
if (
|
|
1197
|
+
if (isOptional2(zod.z)(value)) {
|
|
462
1198
|
return this.defaultZodOptionalHandler(value, ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber"]);
|
|
463
|
-
} else if (
|
|
1199
|
+
} else if (isObj2(zod.z)(value)) {
|
|
464
1200
|
return this.defaultZodObjectHandler(value);
|
|
465
|
-
} else if (
|
|
1201
|
+
} else if (isArr2(zod.z)(value)) {
|
|
466
1202
|
return this.defaultZodArrayHandler(value, ["min", "max"]);
|
|
467
|
-
} else if (
|
|
1203
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
468
1204
|
return this.defaultZodUnionHandler(value);
|
|
469
|
-
} else if (
|
|
1205
|
+
} else if (isString2(zod.z)(value)) {
|
|
470
1206
|
return this.defaultZodStringHandler(value);
|
|
471
1207
|
}
|
|
472
1208
|
return value;
|
|
473
1209
|
}
|
|
474
1210
|
};
|
|
475
|
-
var GoogleSchemaCompatLayer = class extends
|
|
1211
|
+
var GoogleSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
476
1212
|
constructor(model) {
|
|
477
1213
|
super(model);
|
|
478
1214
|
}
|
|
@@ -483,34 +1219,25 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
483
1219
|
return this.getModel().provider.includes("google") || this.getModel().modelId.includes("google");
|
|
484
1220
|
}
|
|
485
1221
|
processZodType(value) {
|
|
486
|
-
if (
|
|
487
|
-
return this.defaultZodOptionalHandler(value, [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
"ZodString",
|
|
492
|
-
"ZodNumber",
|
|
493
|
-
...UNSUPPORTED_ZOD_TYPES
|
|
494
|
-
]);
|
|
495
|
-
} else if (isNull(value)) {
|
|
496
|
-
return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value._def.description || "must be null");
|
|
497
|
-
} 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)) {
|
|
498
1227
|
return this.defaultZodObjectHandler(value);
|
|
499
|
-
} else if (
|
|
1228
|
+
} else if (isArr2(zod.z)(value)) {
|
|
500
1229
|
return this.defaultZodArrayHandler(value, []);
|
|
501
|
-
} else if (
|
|
1230
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
502
1231
|
return this.defaultZodUnionHandler(value);
|
|
503
|
-
} else if (
|
|
1232
|
+
} else if (isString2(zod.z)(value)) {
|
|
504
1233
|
return this.defaultZodStringHandler(value);
|
|
505
|
-
} else if (
|
|
1234
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
506
1235
|
return this.defaultZodNumberHandler(value);
|
|
507
1236
|
}
|
|
508
1237
|
return this.defaultUnsupportedZodTypeHandler(value);
|
|
509
1238
|
}
|
|
510
1239
|
};
|
|
511
|
-
|
|
512
|
-
// src/provider-compats/meta.ts
|
|
513
|
-
var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1240
|
+
var MetaSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
514
1241
|
constructor(model) {
|
|
515
1242
|
super(model);
|
|
516
1243
|
}
|
|
@@ -521,25 +1248,23 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
521
1248
|
return this.getModel().modelId.includes("meta");
|
|
522
1249
|
}
|
|
523
1250
|
processZodType(value) {
|
|
524
|
-
if (
|
|
1251
|
+
if (isOptional2(zod.z)(value)) {
|
|
525
1252
|
return this.defaultZodOptionalHandler(value, ["ZodObject", "ZodArray", "ZodUnion", "ZodString", "ZodNumber"]);
|
|
526
|
-
} else if (
|
|
1253
|
+
} else if (isObj2(zod.z)(value)) {
|
|
527
1254
|
return this.defaultZodObjectHandler(value);
|
|
528
|
-
} else if (
|
|
1255
|
+
} else if (isArr2(zod.z)(value)) {
|
|
529
1256
|
return this.defaultZodArrayHandler(value, ["min", "max"]);
|
|
530
|
-
} else if (
|
|
1257
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
531
1258
|
return this.defaultZodUnionHandler(value);
|
|
532
|
-
} else if (
|
|
1259
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
533
1260
|
return this.defaultZodNumberHandler(value);
|
|
534
|
-
} else if (
|
|
1261
|
+
} else if (isString2(zod.z)(value)) {
|
|
535
1262
|
return this.defaultZodStringHandler(value);
|
|
536
1263
|
}
|
|
537
1264
|
return value;
|
|
538
1265
|
}
|
|
539
1266
|
};
|
|
540
|
-
|
|
541
|
-
// src/provider-compats/openai.ts
|
|
542
|
-
var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
1267
|
+
var OpenAISchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
543
1268
|
constructor(model) {
|
|
544
1269
|
super(model);
|
|
545
1270
|
}
|
|
@@ -547,16 +1272,13 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
547
1272
|
return `jsonSchema7`;
|
|
548
1273
|
}
|
|
549
1274
|
shouldApply() {
|
|
550
|
-
if (
|
|
551
|
-
// !this.getModel().supportsStructuredOutputs && // <- TODO: this no longer exists, do we need it?
|
|
552
|
-
this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`)
|
|
553
|
-
) {
|
|
1275
|
+
if (!this.getModel().supportsStructuredOutputs && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))) {
|
|
554
1276
|
return true;
|
|
555
1277
|
}
|
|
556
1278
|
return false;
|
|
557
1279
|
}
|
|
558
1280
|
processZodType(value) {
|
|
559
|
-
if (
|
|
1281
|
+
if (isOptional2(zod.z)(value)) {
|
|
560
1282
|
return this.defaultZodOptionalHandler(value, [
|
|
561
1283
|
"ZodObject",
|
|
562
1284
|
"ZodArray",
|
|
@@ -566,24 +1288,28 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
566
1288
|
"ZodUndefined",
|
|
567
1289
|
"ZodTuple"
|
|
568
1290
|
]);
|
|
569
|
-
} else if (
|
|
1291
|
+
} else if (isObj2(zod.z)(value)) {
|
|
570
1292
|
return this.defaultZodObjectHandler(value);
|
|
571
|
-
} else if (
|
|
1293
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
572
1294
|
return this.defaultZodUnionHandler(value);
|
|
573
|
-
} else if (
|
|
1295
|
+
} else if (isArr2(zod.z)(value)) {
|
|
574
1296
|
return this.defaultZodArrayHandler(value);
|
|
575
|
-
} else if (
|
|
1297
|
+
} else if (isString2(zod.z)(value)) {
|
|
576
1298
|
const model = this.getModel();
|
|
577
1299
|
const checks = ["emoji"];
|
|
578
1300
|
if (model.modelId.includes("gpt-4o-mini")) {
|
|
579
|
-
|
|
1301
|
+
return this.defaultZodStringHandler(value, ["emoji", "regex"]);
|
|
580
1302
|
}
|
|
581
1303
|
return this.defaultZodStringHandler(value, checks);
|
|
582
1304
|
}
|
|
583
|
-
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1305
|
+
return this.defaultUnsupportedZodTypeHandler(value, [
|
|
1306
|
+
"ZodNever",
|
|
1307
|
+
"ZodUndefined",
|
|
1308
|
+
"ZodTuple"
|
|
1309
|
+
]);
|
|
584
1310
|
}
|
|
585
1311
|
};
|
|
586
|
-
var OpenAIReasoningSchemaCompatLayer = class extends
|
|
1312
|
+
var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
587
1313
|
constructor(model) {
|
|
588
1314
|
super(model);
|
|
589
1315
|
}
|
|
@@ -594,31 +1320,28 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
594
1320
|
return this.getModel().modelId.includes(`o3`) || this.getModel().modelId.includes(`o4`) || this.getModel().modelId.includes(`o1`);
|
|
595
1321
|
}
|
|
596
1322
|
shouldApply() {
|
|
597
|
-
if (
|
|
598
|
-
// (this.getModel().supportsStructuredOutputs || this.isReasoningModel()) && // <- supportsStructuredOutputs no longer exists
|
|
599
|
-
this.isReasoningModel() && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))
|
|
600
|
-
) {
|
|
1323
|
+
if ((this.getModel().supportsStructuredOutputs || this.isReasoningModel()) && (this.getModel().provider.includes(`openai`) || this.getModel().modelId.includes(`openai`))) {
|
|
601
1324
|
return true;
|
|
602
1325
|
}
|
|
603
1326
|
return false;
|
|
604
1327
|
}
|
|
605
1328
|
processZodType(value) {
|
|
606
|
-
if (
|
|
1329
|
+
if (isOptional2(zod.z)(value)) {
|
|
607
1330
|
const innerZodType = this.processZodType(value._def.innerType);
|
|
608
1331
|
return innerZodType.nullable();
|
|
609
|
-
} else if (
|
|
1332
|
+
} else if (isObj2(zod.z)(value)) {
|
|
610
1333
|
return this.defaultZodObjectHandler(value, { passthrough: false });
|
|
611
|
-
} else if (
|
|
1334
|
+
} else if (isArr2(zod.z)(value)) {
|
|
612
1335
|
return this.defaultZodArrayHandler(value);
|
|
613
|
-
} else if (
|
|
1336
|
+
} else if (isUnion2(zod.z)(value)) {
|
|
614
1337
|
return this.defaultZodUnionHandler(value);
|
|
615
|
-
} else if (isDefault(value)) {
|
|
1338
|
+
} else if (isDefault(zod.z)(value)) {
|
|
616
1339
|
const defaultDef = value._def;
|
|
617
1340
|
const innerType = defaultDef.innerType;
|
|
618
|
-
const defaultValue = defaultDef.defaultValue();
|
|
619
|
-
const constraints =
|
|
1341
|
+
const defaultValue = typeof defaultDef.defaultValue === "function" ? defaultDef.defaultValue() : defaultDef.defaultValue;
|
|
1342
|
+
const constraints = [];
|
|
620
1343
|
if (defaultValue !== void 0) {
|
|
621
|
-
constraints.
|
|
1344
|
+
constraints.push(`the default value is ${defaultValue}`);
|
|
622
1345
|
}
|
|
623
1346
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
624
1347
|
let result = this.processZodType(innerType);
|
|
@@ -626,13 +1349,13 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
626
1349
|
result = result.describe(description);
|
|
627
1350
|
}
|
|
628
1351
|
return result;
|
|
629
|
-
} else if (
|
|
1352
|
+
} else if (isNumber2(zod.z)(value)) {
|
|
630
1353
|
return this.defaultZodNumberHandler(value);
|
|
631
|
-
} else if (
|
|
1354
|
+
} else if (isString2(zod.z)(value)) {
|
|
632
1355
|
return this.defaultZodStringHandler(value);
|
|
633
|
-
} else if (isDate(value)) {
|
|
1356
|
+
} else if (isDate(zod.z)(value)) {
|
|
634
1357
|
return this.defaultZodDateHandler(value);
|
|
635
|
-
} else if (value.
|
|
1358
|
+
} else if (value.constructor.name === "ZodAny") {
|
|
636
1359
|
return zod.z.string().describe(
|
|
637
1360
|
(value.description ?? "") + `
|
|
638
1361
|
Argument was an "any" type, but you (the LLM) do not support "any", so it was cast to a "string" type`
|
|
@@ -653,7 +1376,9 @@ exports.MetaSchemaCompatLayer = MetaSchemaCompatLayer;
|
|
|
653
1376
|
exports.OpenAIReasoningSchemaCompatLayer = OpenAIReasoningSchemaCompatLayer;
|
|
654
1377
|
exports.OpenAISchemaCompatLayer = OpenAISchemaCompatLayer;
|
|
655
1378
|
exports.SUPPORTED_ZOD_TYPES = SUPPORTED_ZOD_TYPES;
|
|
656
|
-
exports.SchemaCompatLayer =
|
|
1379
|
+
exports.SchemaCompatLayer = SchemaCompatLayer3;
|
|
1380
|
+
exports.SchemaCompatLayerV3 = SchemaCompatLayer;
|
|
1381
|
+
exports.SchemaCompatLayerV4 = SchemaCompatLayer2;
|
|
657
1382
|
exports.UNSUPPORTED_ZOD_TYPES = UNSUPPORTED_ZOD_TYPES;
|
|
658
1383
|
exports.applyCompatLayer = applyCompatLayer;
|
|
659
1384
|
exports.convertSchemaToZod = convertSchemaToZod;
|