@mastra/schema-compat 1.3.16-alpha.0 → 1.3.17-alpha.0
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/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +274 -889
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +1051 -1301
- package/dist/{esm-CWlHuVIx.js → esm-BG70JlG8.js} +60 -108
- package/dist/{esm-CWlHuVIx.js.map → esm-BG70JlG8.js.map} +1 -1
- package/dist/{esm-CkNCkZSB.cjs → esm-BQeGF7AD.cjs} +60 -108
- package/dist/{esm-CkNCkZSB.cjs.map → esm-BQeGF7AD.cjs.map} +1 -1
- package/dist/index.cjs +162 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +162 -185
- package/dist/index.js.map +1 -1
- package/dist/{json-schema-VSnKq6-P.cjs → json-schema-7oyknwMS.cjs} +241 -247
- package/dist/json-schema-7oyknwMS.cjs.map +1 -0
- package/dist/{json-schema-R8yfooPa.js → json-schema-BdCwqjfN.js} +241 -247
- package/dist/json-schema-BdCwqjfN.js.map +1 -0
- package/dist/{json-schema-traverse-B35mHRM8.js → json-schema-traverse-D0CId4oM.js} +5 -7
- package/dist/{json-schema-traverse-B35mHRM8.js.map → json-schema-traverse-D0CId4oM.js.map} +1 -1
- package/dist/{json-schema-traverse-DbuWNYgg.cjs → json-schema-traverse-evfp8uQX.cjs} +5 -7
- package/dist/{json-schema-traverse-DbuWNYgg.cjs.map → json-schema-traverse-evfp8uQX.cjs.map} +1 -1
- package/dist/json-to-zod.cjs +153 -142
- package/dist/json-to-zod.cjs.map +1 -1
- package/dist/json-to-zod.d.ts.map +1 -1
- package/dist/json-to-zod.js +153 -142
- package/dist/json-to-zod.js.map +1 -1
- package/dist/{schema-e0VHpMt0.js → schema-Bf12g7KC.js} +4 -6
- package/dist/{schema-e0VHpMt0.js.map → schema-Bf12g7KC.js.map} +1 -1
- package/dist/{schema-IhrnbMI3.cjs → schema-D2ab1-Dc.cjs} +5 -7
- package/dist/schema-D2ab1-Dc.cjs.map +1 -0
- package/dist/schema.cjs +1 -1
- package/dist/schema.js +1 -2
- package/dist/standard-schema/adapters/ai-sdk.cjs +2 -7
- package/dist/standard-schema/adapters/ai-sdk.cjs.map +1 -1
- package/dist/standard-schema/adapters/ai-sdk.js +2 -7
- package/dist/standard-schema/adapters/ai-sdk.js.map +1 -1
- package/dist/standard-schema/adapters/json-schema.cjs +1 -1
- package/dist/standard-schema/adapters/json-schema.js +1 -2
- package/dist/standard-schema/adapters/zod-v3.cjs +3 -4
- package/dist/standard-schema/adapters/zod-v3.cjs.map +1 -1
- package/dist/standard-schema/adapters/zod-v3.js +3 -4
- package/dist/standard-schema/adapters/zod-v3.js.map +1 -1
- package/dist/zod-to-json.cjs +6 -5
- package/dist/zod-to-json.cjs.map +1 -1
- package/dist/zod-to-json.js +6 -5
- package/dist/zod-to-json.js.map +1 -1
- package/package.json +24 -25
- package/dist/json-schema-R8yfooPa.js.map +0 -1
- package/dist/json-schema-VSnKq6-P.cjs.map +0 -1
- package/dist/schema-IhrnbMI3.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_json_schema_traverse$1 = require("./json-schema-traverse-
|
|
2
|
+
const require_json_schema_traverse$1 = require("./json-schema-traverse-evfp8uQX.cjs");
|
|
3
3
|
const require_zod_to_json = require("./zod-to-json.cjs");
|
|
4
|
-
const require_schema = require("./schema-
|
|
4
|
+
const require_schema = require("./schema-D2ab1-Dc.cjs");
|
|
5
5
|
let zod_v3 = require("zod/v3");
|
|
6
6
|
let zod = require("zod");
|
|
7
7
|
let zod_from_json_schema = require("zod-from-json-schema");
|
|
8
8
|
let zod_v4 = require("zod/v4");
|
|
9
|
-
|
|
9
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod-from-json-schema/0.0.5/8e273a13436172e49bb0898e3f9caf0fd3966851d12111764522ea958a085aeb/node_modules/zod-from-json-schema/dist/index.mjs
|
|
10
10
|
function convertJsonSchemaToZod$1(schema) {
|
|
11
11
|
function addMetadata(zodSchema, jsonSchema) {
|
|
12
12
|
if (jsonSchema.description) zodSchema = zodSchema.describe(jsonSchema.description);
|
|
@@ -136,8 +136,7 @@ function convertJsonSchemaToZod$1(schema) {
|
|
|
136
136
|
}
|
|
137
137
|
return addMetadata(zod.z.any(), schema);
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
//#region ../_vendored/ai_v4/dist/dist-Cm5DZgxA.js
|
|
139
|
+
// ../_vendored/ai_v4/dist/dist-DlRWVOEI.js
|
|
141
140
|
var marker$1 = "vercel.ai.error";
|
|
142
141
|
var symbol$1 = Symbol.for(marker$1);
|
|
143
142
|
var _a$1;
|
|
@@ -253,15 +252,14 @@ Error message: ${getErrorMessage(cause)}`,
|
|
|
253
252
|
};
|
|
254
253
|
_a13$1 = symbol13$1;
|
|
255
254
|
var TypeValidationError = _TypeValidationError;
|
|
256
|
-
|
|
257
|
-
//#region ../_vendored/ai_v4/dist/index.js
|
|
255
|
+
// ../_vendored/ai_v4/dist/index.js
|
|
258
256
|
var __create = Object.create;
|
|
259
257
|
var __defProp$1 = Object.defineProperty;
|
|
260
258
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
261
259
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
262
260
|
var __getProtoOf = Object.getPrototypeOf;
|
|
263
261
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
264
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
262
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
265
263
|
var __copyProps = (to, from, except, desc) => {
|
|
266
264
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
267
265
|
key = keys[i];
|
|
@@ -272,7 +270,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
272
270
|
}
|
|
273
271
|
return to;
|
|
274
272
|
};
|
|
275
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
|
|
273
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp$1(target, "default", {
|
|
276
274
|
value: mod,
|
|
277
275
|
enumerable: true
|
|
278
276
|
}) : target, mod));
|
|
@@ -577,24 +575,24 @@ function parseBigintDef(def, refs) {
|
|
|
577
575
|
if (!def.checks) return res;
|
|
578
576
|
for (const check of def.checks) switch (check.kind) {
|
|
579
577
|
case "min":
|
|
580
|
-
if (refs.target === "jsonSchema7")
|
|
581
|
-
|
|
582
|
-
|
|
578
|
+
if (refs.target === "jsonSchema7") {
|
|
579
|
+
if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
580
|
+
else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
581
|
+
} else {
|
|
583
582
|
if (!check.inclusive) res.exclusiveMinimum = true;
|
|
584
583
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
585
584
|
}
|
|
586
585
|
break;
|
|
587
586
|
case "max":
|
|
588
|
-
if (refs.target === "jsonSchema7")
|
|
589
|
-
|
|
590
|
-
|
|
587
|
+
if (refs.target === "jsonSchema7") {
|
|
588
|
+
if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
589
|
+
else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
590
|
+
} else {
|
|
591
591
|
if (!check.inclusive) res.exclusiveMaximum = true;
|
|
592
592
|
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
593
593
|
}
|
|
594
594
|
break;
|
|
595
|
-
case "multipleOf":
|
|
596
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
597
|
-
break;
|
|
595
|
+
case "multipleOf": setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
598
596
|
}
|
|
599
597
|
return res;
|
|
600
598
|
}
|
|
@@ -633,9 +631,7 @@ const integerDateParser = (def, refs) => {
|
|
|
633
631
|
case "min":
|
|
634
632
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
635
633
|
break;
|
|
636
|
-
case "max":
|
|
637
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
638
|
-
break;
|
|
634
|
+
case "max": setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
639
635
|
}
|
|
640
636
|
return res;
|
|
641
637
|
};
|
|
@@ -775,9 +771,7 @@ function parseStringDef(def, refs) {
|
|
|
775
771
|
case "format:idn-email":
|
|
776
772
|
addFormat(res, "idn-email", check.message, refs);
|
|
777
773
|
break;
|
|
778
|
-
case "pattern:zod":
|
|
779
|
-
addPattern(res, zodPatterns.email, check.message, refs);
|
|
780
|
-
break;
|
|
774
|
+
case "pattern:zod": addPattern(res, zodPatterns.email, check.message, refs);
|
|
781
775
|
}
|
|
782
776
|
break;
|
|
783
777
|
case "url":
|
|
@@ -848,16 +842,10 @@ function parseStringDef(def, refs) {
|
|
|
848
842
|
case "contentEncoding:base64":
|
|
849
843
|
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
850
844
|
break;
|
|
851
|
-
case "pattern:zod":
|
|
852
|
-
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
853
|
-
break;
|
|
845
|
+
case "pattern:zod": addPattern(res, zodPatterns.base64, check.message, refs);
|
|
854
846
|
}
|
|
855
847
|
break;
|
|
856
848
|
case "nanoid": addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
857
|
-
case "toLowerCase":
|
|
858
|
-
case "toUpperCase":
|
|
859
|
-
case "trim": break;
|
|
860
|
-
default:
|
|
861
849
|
}
|
|
862
850
|
return res;
|
|
863
851
|
}
|
|
@@ -1173,24 +1161,24 @@ function parseNumberDef(def, refs) {
|
|
|
1173
1161
|
addErrorMessage(res, "type", check.message, refs);
|
|
1174
1162
|
break;
|
|
1175
1163
|
case "min":
|
|
1176
|
-
if (refs.target === "jsonSchema7")
|
|
1177
|
-
|
|
1178
|
-
|
|
1164
|
+
if (refs.target === "jsonSchema7") {
|
|
1165
|
+
if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1166
|
+
else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
1167
|
+
} else {
|
|
1179
1168
|
if (!check.inclusive) res.exclusiveMinimum = true;
|
|
1180
1169
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1181
1170
|
}
|
|
1182
1171
|
break;
|
|
1183
1172
|
case "max":
|
|
1184
|
-
if (refs.target === "jsonSchema7")
|
|
1185
|
-
|
|
1186
|
-
|
|
1173
|
+
if (refs.target === "jsonSchema7") {
|
|
1174
|
+
if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1175
|
+
else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
1176
|
+
} else {
|
|
1187
1177
|
if (!check.inclusive) res.exclusiveMaximum = true;
|
|
1188
1178
|
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1189
1179
|
}
|
|
1190
1180
|
break;
|
|
1191
|
-
case "multipleOf":
|
|
1192
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1193
|
-
break;
|
|
1181
|
+
case "multipleOf": setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1194
1182
|
}
|
|
1195
1183
|
return res;
|
|
1196
1184
|
}
|
|
@@ -1609,7 +1597,6 @@ function fixJson(input) {
|
|
|
1609
1597
|
stack.pop();
|
|
1610
1598
|
stack.push(swapState);
|
|
1611
1599
|
stack.push("INSIDE_ARRAY_START");
|
|
1612
|
-
break;
|
|
1613
1600
|
}
|
|
1614
1601
|
}
|
|
1615
1602
|
function processAfterObjectValue(char, i) {
|
|
@@ -1621,7 +1608,6 @@ function fixJson(input) {
|
|
|
1621
1608
|
case "}":
|
|
1622
1609
|
lastValidIndex = i;
|
|
1623
1610
|
stack.pop();
|
|
1624
|
-
break;
|
|
1625
1611
|
}
|
|
1626
1612
|
}
|
|
1627
1613
|
function processAfterArrayValue(char, i) {
|
|
@@ -1633,7 +1619,6 @@ function fixJson(input) {
|
|
|
1633
1619
|
case "]":
|
|
1634
1620
|
lastValidIndex = i;
|
|
1635
1621
|
stack.pop();
|
|
1636
|
-
break;
|
|
1637
1622
|
}
|
|
1638
1623
|
}
|
|
1639
1624
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -1651,7 +1636,6 @@ function fixJson(input) {
|
|
|
1651
1636
|
case "}":
|
|
1652
1637
|
lastValidIndex = i;
|
|
1653
1638
|
stack.pop();
|
|
1654
|
-
break;
|
|
1655
1639
|
}
|
|
1656
1640
|
break;
|
|
1657
1641
|
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
@@ -1659,7 +1643,6 @@ function fixJson(input) {
|
|
|
1659
1643
|
case "\"":
|
|
1660
1644
|
stack.pop();
|
|
1661
1645
|
stack.push("INSIDE_OBJECT_KEY");
|
|
1662
|
-
break;
|
|
1663
1646
|
}
|
|
1664
1647
|
break;
|
|
1665
1648
|
case "INSIDE_OBJECT_KEY":
|
|
@@ -1667,7 +1650,6 @@ function fixJson(input) {
|
|
|
1667
1650
|
case "\"":
|
|
1668
1651
|
stack.pop();
|
|
1669
1652
|
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
1670
|
-
break;
|
|
1671
1653
|
}
|
|
1672
1654
|
break;
|
|
1673
1655
|
case "INSIDE_OBJECT_AFTER_KEY":
|
|
@@ -1675,7 +1657,6 @@ function fixJson(input) {
|
|
|
1675
1657
|
case ":":
|
|
1676
1658
|
stack.pop();
|
|
1677
1659
|
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
1678
|
-
break;
|
|
1679
1660
|
}
|
|
1680
1661
|
break;
|
|
1681
1662
|
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
@@ -1705,7 +1686,6 @@ function fixJson(input) {
|
|
|
1705
1686
|
default:
|
|
1706
1687
|
lastValidIndex = i;
|
|
1707
1688
|
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
1708
|
-
break;
|
|
1709
1689
|
}
|
|
1710
1690
|
break;
|
|
1711
1691
|
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
@@ -1718,9 +1698,7 @@ function fixJson(input) {
|
|
|
1718
1698
|
lastValidIndex = i;
|
|
1719
1699
|
stack.pop();
|
|
1720
1700
|
break;
|
|
1721
|
-
default:
|
|
1722
|
-
lastValidIndex = i;
|
|
1723
|
-
break;
|
|
1701
|
+
default: lastValidIndex = i;
|
|
1724
1702
|
}
|
|
1725
1703
|
break;
|
|
1726
1704
|
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
@@ -1761,9 +1739,7 @@ function fixJson(input) {
|
|
|
1761
1739
|
stack.pop();
|
|
1762
1740
|
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1763
1741
|
break;
|
|
1764
|
-
default:
|
|
1765
|
-
stack.pop();
|
|
1766
|
-
break;
|
|
1742
|
+
default: stack.pop();
|
|
1767
1743
|
}
|
|
1768
1744
|
break;
|
|
1769
1745
|
case "INSIDE_LITERAL": {
|
|
@@ -3384,8 +3360,7 @@ function trimStartOfStream() {
|
|
|
3384
3360
|
return text2;
|
|
3385
3361
|
};
|
|
3386
3362
|
}
|
|
3387
|
-
|
|
3388
|
-
//#region src/utils.ts
|
|
3363
|
+
// src/utils.ts
|
|
3389
3364
|
/**
|
|
3390
3365
|
* Converts a Zod schema to an AI SDK Schema with validation support.
|
|
3391
3366
|
*
|
|
@@ -3508,7 +3483,10 @@ function convertSchemaToZod(schema) {
|
|
|
3508
3483
|
function applyCompatLayer({ schema, compatLayers, mode }) {
|
|
3509
3484
|
if (mode === "jsonSchema") {
|
|
3510
3485
|
const standardSchema = require_schema.toStandardSchema(schema);
|
|
3511
|
-
for (const compat of compatLayers) if (compat.shouldApply())
|
|
3486
|
+
for (const compat of compatLayers) if (compat.shouldApply()) {
|
|
3487
|
+
const compatSchema = compat.processToCompatSchema(standardSchema);
|
|
3488
|
+
return require_schema.standardSchemaToJSONSchema(compatSchema);
|
|
3489
|
+
}
|
|
3512
3490
|
return require_schema.standardSchemaToJSONSchema(standardSchema);
|
|
3513
3491
|
} else {
|
|
3514
3492
|
let zodSchema;
|
|
@@ -3521,8 +3499,7 @@ function applyCompatLayer({ schema, compatLayers, mode }) {
|
|
|
3521
3499
|
return convertZodSchemaToAISDKSchema(zodSchema);
|
|
3522
3500
|
}
|
|
3523
3501
|
}
|
|
3524
|
-
|
|
3525
|
-
//#region src/schema-compatibility-v3.ts
|
|
3502
|
+
// src/schema-compatibility-v3.ts
|
|
3526
3503
|
/**
|
|
3527
3504
|
* All supported string validation check types that can be processed or converted to descriptions.
|
|
3528
3505
|
* @constant
|
|
@@ -3803,12 +3780,18 @@ var SchemaCompatLayer$1 = class {
|
|
|
3803
3780
|
const processedType = this.processZodType(zodArrayDef.type);
|
|
3804
3781
|
let result = zod_v3.z.array(processedType);
|
|
3805
3782
|
const constraints = [];
|
|
3806
|
-
if (zodArrayDef.minLength?.value !== void 0)
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
if (zodArrayDef.
|
|
3811
|
-
|
|
3783
|
+
if (zodArrayDef.minLength?.value !== void 0) {
|
|
3784
|
+
if (handleChecks.includes("min")) constraints.push(`minimum length ${zodArrayDef.minLength.value}`);
|
|
3785
|
+
else result = result.min(zodArrayDef.minLength.value);
|
|
3786
|
+
}
|
|
3787
|
+
if (zodArrayDef.maxLength?.value !== void 0) {
|
|
3788
|
+
if (handleChecks.includes("max")) constraints.push(`maximum length ${zodArrayDef.maxLength.value}`);
|
|
3789
|
+
else result = result.max(zodArrayDef.maxLength.value);
|
|
3790
|
+
}
|
|
3791
|
+
if (zodArrayDef.exactLength?.value !== void 0) {
|
|
3792
|
+
if (handleChecks.includes("length")) constraints.push(`exact length ${zodArrayDef.exactLength.value}`);
|
|
3793
|
+
else result = result.length(zodArrayDef.exactLength.value);
|
|
3794
|
+
}
|
|
3812
3795
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
3813
3796
|
if (description) result = result.describe(description);
|
|
3814
3797
|
return result;
|
|
@@ -3838,23 +3821,23 @@ var SchemaCompatLayer$1 = class {
|
|
|
3838
3821
|
const constraints = [];
|
|
3839
3822
|
const checks = value._def.checks || [];
|
|
3840
3823
|
const newChecks = [];
|
|
3841
|
-
for (const check of checks) if ("kind" in check)
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
constraints.push(`${check.kind}imum length ${check.value}`);
|
|
3855
|
-
|
|
3824
|
+
for (const check of checks) if ("kind" in check) {
|
|
3825
|
+
if (handleChecks.includes(check.kind)) switch (check.kind) {
|
|
3826
|
+
case "regex":
|
|
3827
|
+
constraints.push(`input must match this regex ${check.regex.source}`);
|
|
3828
|
+
break;
|
|
3829
|
+
case "emoji":
|
|
3830
|
+
case "email":
|
|
3831
|
+
case "url":
|
|
3832
|
+
case "uuid":
|
|
3833
|
+
case "cuid":
|
|
3834
|
+
constraints.push(`a valid ${check.kind}`);
|
|
3835
|
+
break;
|
|
3836
|
+
case "min":
|
|
3837
|
+
case "max": constraints.push(`${check.kind}imum length ${check.value}`);
|
|
3838
|
+
}
|
|
3839
|
+
else newChecks.push(check);
|
|
3856
3840
|
}
|
|
3857
|
-
else newChecks.push(check);
|
|
3858
3841
|
let result = zod_v3.z.string();
|
|
3859
3842
|
for (const check of newChecks) result = result._addCheck(check);
|
|
3860
3843
|
const description = this.mergeParameterDescription(value.description, constraints);
|
|
@@ -3872,20 +3855,20 @@ var SchemaCompatLayer$1 = class {
|
|
|
3872
3855
|
const constraints = [];
|
|
3873
3856
|
const checks = value._def.checks || [];
|
|
3874
3857
|
const newChecks = [];
|
|
3875
|
-
for (const check of checks) if ("kind" in check)
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
constraints.push(`multiple of ${check.value}`);
|
|
3886
|
-
|
|
3858
|
+
for (const check of checks) if ("kind" in check) {
|
|
3859
|
+
if (handleChecks.includes(check.kind)) switch (check.kind) {
|
|
3860
|
+
case "min":
|
|
3861
|
+
if (check.inclusive) constraints.push(`greater than or equal to ${check.value}`);
|
|
3862
|
+
else constraints.push(`greater than ${check.value}`);
|
|
3863
|
+
break;
|
|
3864
|
+
case "max":
|
|
3865
|
+
if (check.inclusive) constraints.push(`lower than or equal to ${check.value}`);
|
|
3866
|
+
else constraints.push(`lower than ${check.value}`);
|
|
3867
|
+
break;
|
|
3868
|
+
case "multipleOf": constraints.push(`multiple of ${check.value}`);
|
|
3869
|
+
}
|
|
3870
|
+
else newChecks.push(check);
|
|
3887
3871
|
}
|
|
3888
|
-
else newChecks.push(check);
|
|
3889
3872
|
let result = zod_v3.z.number();
|
|
3890
3873
|
for (const check of newChecks) switch (check.kind) {
|
|
3891
3874
|
case "int":
|
|
@@ -3991,8 +3974,7 @@ var SchemaCompatLayer$1 = class {
|
|
|
3991
3974
|
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
3992
3975
|
}
|
|
3993
3976
|
};
|
|
3994
|
-
|
|
3995
|
-
//#region src/schema-compatibility-v4.ts
|
|
3977
|
+
// src/schema-compatibility-v4.ts
|
|
3996
3978
|
/**
|
|
3997
3979
|
* All supported string validation check types that can be processed or converted to descriptions.
|
|
3998
3980
|
* @constant
|
|
@@ -4276,12 +4258,18 @@ var SchemaCompatLayer$2 = class {
|
|
|
4276
4258
|
let result = zod_v4.z.array(processedType);
|
|
4277
4259
|
const constraints = [];
|
|
4278
4260
|
if (zodArrayDef.checks) for (const check of zodArrayDef.checks) {
|
|
4279
|
-
if (check._zod.def.check === "min_length")
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
if (check._zod.def.check === "
|
|
4284
|
-
|
|
4261
|
+
if (check._zod.def.check === "min_length") {
|
|
4262
|
+
if (handleChecks.includes("min")) constraints.push(`minimum length ${check._zod.def.minimum}`);
|
|
4263
|
+
else result = result.min(check._zod.def.minimum);
|
|
4264
|
+
}
|
|
4265
|
+
if (check._zod.def.check === "max_length") {
|
|
4266
|
+
if (handleChecks.includes("max")) constraints.push(`maximum length ${check._zod.def.maximum}`);
|
|
4267
|
+
else result = result.max(check._zod.def.maximum);
|
|
4268
|
+
}
|
|
4269
|
+
if (check._zod.def.check === "length_equals") {
|
|
4270
|
+
if (handleChecks.includes("length")) constraints.push(`exact length ${check._zod.def.length}`);
|
|
4271
|
+
else result = result.length(check._zod.def.length);
|
|
4272
|
+
}
|
|
4285
4273
|
}
|
|
4286
4274
|
const metaDescription = value.meta()?.description;
|
|
4287
4275
|
const legacyDescription = value.description;
|
|
@@ -4321,23 +4309,19 @@ var SchemaCompatLayer$2 = class {
|
|
|
4321
4309
|
case "max_length":
|
|
4322
4310
|
constraints.push(`maximum length ${check._zod.def.maximum}`);
|
|
4323
4311
|
break;
|
|
4324
|
-
case "string_format":
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
newChecks.push(check);
|
|
4338
|
-
break;
|
|
4339
|
-
}
|
|
4340
|
-
break;
|
|
4312
|
+
case "string_format": switch (check._zod.def.format) {
|
|
4313
|
+
case "email":
|
|
4314
|
+
case "url":
|
|
4315
|
+
case "emoji":
|
|
4316
|
+
case "uuid":
|
|
4317
|
+
case "cuid":
|
|
4318
|
+
constraints.push(`a valid ${check._zod.def.format}`);
|
|
4319
|
+
break;
|
|
4320
|
+
case "regex":
|
|
4321
|
+
constraints.push(`input must match this regex ${check._zod.def.pattern}`);
|
|
4322
|
+
break;
|
|
4323
|
+
default: newChecks.push(check);
|
|
4324
|
+
}
|
|
4341
4325
|
}
|
|
4342
4326
|
else newChecks.push(check);
|
|
4343
4327
|
let result = zod_v4.z.string();
|
|
@@ -4368,18 +4352,14 @@ var SchemaCompatLayer$2 = class {
|
|
|
4368
4352
|
if (check._zod.def.inclusive) constraints.push(`lower than or equal to ${check._zod.def.value}`);
|
|
4369
4353
|
else constraints.push(`lower than ${check._zod.def.value}`);
|
|
4370
4354
|
break;
|
|
4371
|
-
case "multiple_of":
|
|
4372
|
-
constraints.push(`multiple of ${check._zod.def.value}`);
|
|
4373
|
-
break;
|
|
4355
|
+
case "multiple_of": constraints.push(`multiple of ${check._zod.def.value}`);
|
|
4374
4356
|
}
|
|
4375
4357
|
else newChecks.push(check);
|
|
4376
4358
|
let result = zod_v4.z.number();
|
|
4377
4359
|
for (const check of newChecks) switch (check._zod.def.check) {
|
|
4378
4360
|
case "number_format":
|
|
4379
4361
|
switch (check._zod.def.format) {
|
|
4380
|
-
case "safeint":
|
|
4381
|
-
result = result.int();
|
|
4382
|
-
break;
|
|
4362
|
+
case "safeint": result = result.int();
|
|
4383
4363
|
}
|
|
4384
4364
|
break;
|
|
4385
4365
|
default: result = result.check(check);
|
|
@@ -4484,8 +4464,7 @@ var SchemaCompatLayer$2 = class {
|
|
|
4484
4464
|
return this.processToAISDKSchema(zodSchema).jsonSchema;
|
|
4485
4465
|
}
|
|
4486
4466
|
};
|
|
4487
|
-
|
|
4488
|
-
//#region src/json-schema/utils.ts
|
|
4467
|
+
// src/json-schema/utils.ts
|
|
4489
4468
|
var import_json_schema_traverse = /* @__PURE__ */ require_json_schema_traverse$1.__toESM(require_json_schema_traverse$1.require_json_schema_traverse(), 1);
|
|
4490
4469
|
/**
|
|
4491
4470
|
* Type guard to check if a JSON Schema has a specific type
|
|
@@ -4553,8 +4532,7 @@ function isOptionalSchema(propertyName, parentSchema) {
|
|
|
4553
4532
|
if (!parentSchema.required || !Array.isArray(parentSchema.required)) return true;
|
|
4554
4533
|
return !parentSchema.required.includes(propertyName);
|
|
4555
4534
|
}
|
|
4556
|
-
|
|
4557
|
-
//#region src/schema-compatibility.ts
|
|
4535
|
+
// src/schema-compatibility.ts
|
|
4558
4536
|
var SchemaCompatLayer = class {
|
|
4559
4537
|
model;
|
|
4560
4538
|
v3Layer;
|
|
@@ -4672,12 +4650,13 @@ var SchemaCompatLayer = class {
|
|
|
4672
4650
|
if (!v4Type) return value;
|
|
4673
4651
|
innerTypeName = "Zod" + v4Type.charAt(0).toUpperCase() + v4Type.slice(1);
|
|
4674
4652
|
} else innerTypeName = value._def.innerType._def.typeName;
|
|
4675
|
-
if (handleTypes.includes(innerTypeName))
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4653
|
+
if (handleTypes.includes(innerTypeName)) {
|
|
4654
|
+
if ("_zod" in value) {
|
|
4655
|
+
const innerType = value._zod?.def?.innerType;
|
|
4656
|
+
if (!innerType) return value;
|
|
4657
|
+
return this.processZodType(innerType).optional();
|
|
4658
|
+
} else return this.processZodType(value._def.innerType).optional();
|
|
4659
|
+
} else return value;
|
|
4681
4660
|
}
|
|
4682
4661
|
defaultZodNullableHandler(value, handleTypes) {
|
|
4683
4662
|
if ("_zod" in value) return this.v4Layer.defaultZodNullableHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES$2);
|
|
@@ -4700,7 +4679,8 @@ var SchemaCompatLayer = class {
|
|
|
4700
4679
|
* @returns
|
|
4701
4680
|
*/
|
|
4702
4681
|
processToJSONSchema(schema, io = "input") {
|
|
4703
|
-
const
|
|
4682
|
+
const standardSchema = require_schema.toStandardSchema(schema);
|
|
4683
|
+
const jsonSchema = require_schema.standardSchemaToJSONSchema(standardSchema, {
|
|
4704
4684
|
target: "draft-07",
|
|
4705
4685
|
io
|
|
4706
4686
|
});
|
|
@@ -4788,7 +4768,6 @@ var SchemaCompatLayer = class {
|
|
|
4788
4768
|
constraints.push(`a valid ${schema.format}`);
|
|
4789
4769
|
delete schema.pattern;
|
|
4790
4770
|
delete schema.format;
|
|
4791
|
-
break;
|
|
4792
4771
|
}
|
|
4793
4772
|
if (constraints.length === 0 && schema.pattern !== void 0) {
|
|
4794
4773
|
constraints.push(`input must match this regex ${schema.pattern}`);
|
|
@@ -4943,7 +4922,8 @@ var SchemaCompatLayer = class {
|
|
|
4943
4922
|
};
|
|
4944
4923
|
const schemaTarget = this.getSchemaTarget();
|
|
4945
4924
|
const target = (schemaTarget && SCHEMA_TARGET_TO_STANDARD[schemaTarget]) ?? schemaTarget;
|
|
4946
|
-
const
|
|
4925
|
+
const standardSchema = require_schema.toStandardSchema(zodSchema);
|
|
4926
|
+
const jsonSchema = require_schema.standardSchemaToJSONSchema(standardSchema, {
|
|
4947
4927
|
target,
|
|
4948
4928
|
io: "input"
|
|
4949
4929
|
});
|
|
@@ -4958,8 +4938,7 @@ var SchemaCompatLayer = class {
|
|
|
4958
4938
|
return jsonSchema;
|
|
4959
4939
|
}
|
|
4960
4940
|
};
|
|
4961
|
-
|
|
4962
|
-
//#region src/null-to-undefined.ts
|
|
4941
|
+
// src/null-to-undefined.ts
|
|
4963
4942
|
/**
|
|
4964
4943
|
* Recursively converts null values to undefined in an object based on which
|
|
4965
4944
|
* properties are optional in the JSON Schema. This is needed because OpenAI
|
|
@@ -5105,8 +5084,7 @@ function isNullable(z) {
|
|
|
5105
5084
|
function isIntersection(z) {
|
|
5106
5085
|
return (v) => v instanceof z["ZodIntersection"];
|
|
5107
5086
|
}
|
|
5108
|
-
|
|
5109
|
-
//#region src/provider-compats/openai.ts
|
|
5087
|
+
// src/provider-compats/openai.ts
|
|
5110
5088
|
const allowedStringFormats = [
|
|
5111
5089
|
"date-time",
|
|
5112
5090
|
"time",
|
|
@@ -5217,7 +5195,8 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5217
5195
|
* which causes OpenAI strict mode to reject tool schemas missing additionalProperties: false.
|
|
5218
5196
|
*/
|
|
5219
5197
|
processToAISDKSchema(zodSchema) {
|
|
5220
|
-
const
|
|
5198
|
+
const compat = this.processToCompatSchema(zodSchema);
|
|
5199
|
+
const transformedJsonSchema = require_schema.standardSchemaToJSONSchema(compat);
|
|
5221
5200
|
return jsonSchema(transformedJsonSchema, { validate: (value) => {
|
|
5222
5201
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
5223
5202
|
const result = zodSchema.safeParse(transformed);
|
|
@@ -5394,14 +5373,16 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5394
5373
|
prop.anyOf = [propSchema, { type: "null" }];
|
|
5395
5374
|
}
|
|
5396
5375
|
} else if (prop.type === void 0 && Array.isArray(prop.anyOf)) {
|
|
5397
|
-
if (!prop.anyOf.some((branch) => typeof branch !== "boolean" && branch.type === "null"))
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5376
|
+
if (!prop.anyOf.some((branch) => typeof branch !== "boolean" && branch.type === "null")) {
|
|
5377
|
+
if (genericConstraintKeywords.some((keyword) => keyword in prop)) {
|
|
5378
|
+
const branch = { anyOf: prop.anyOf };
|
|
5379
|
+
for (const keyword of genericConstraintKeywords) if (keyword in prop) {
|
|
5380
|
+
branch[keyword] = prop[keyword];
|
|
5381
|
+
delete prop[keyword];
|
|
5382
|
+
}
|
|
5383
|
+
prop.anyOf = [branch, { type: "null" }];
|
|
5384
|
+
} else prop.anyOf = [...prop.anyOf, { type: "null" }];
|
|
5385
|
+
}
|
|
5405
5386
|
}
|
|
5406
5387
|
}
|
|
5407
5388
|
}
|
|
@@ -5458,8 +5439,7 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5458
5439
|
function isDateFormat(schema) {
|
|
5459
5440
|
return schema.format === "date-time" || schema.format === "date";
|
|
5460
5441
|
}
|
|
5461
|
-
|
|
5462
|
-
//#region src/provider-compats/openai-reasoning.ts
|
|
5442
|
+
// src/provider-compats/openai-reasoning.ts
|
|
5463
5443
|
var OpenAIReasoningSchemaCompatLayer = class extends OpenAISchemaCompatLayer {
|
|
5464
5444
|
getSchemaTarget() {
|
|
5465
5445
|
return `openApi3`;
|
|
@@ -5507,8 +5487,7 @@ var OpenAIReasoningSchemaCompatLayer = class extends OpenAISchemaCompatLayer {
|
|
|
5507
5487
|
return this.defaultUnsupportedZodTypeHandler(value);
|
|
5508
5488
|
}
|
|
5509
5489
|
};
|
|
5510
|
-
|
|
5511
|
-
//#region src/standard-schema-compat.ts
|
|
5490
|
+
// src/standard-schema-compat.ts
|
|
5512
5491
|
/**
|
|
5513
5492
|
* Standard Schema compatibility utilities
|
|
5514
5493
|
*
|
|
@@ -5560,7 +5539,8 @@ function applyOpenAICompatTransforms(schema, modelInfo) {
|
|
|
5560
5539
|
const reasoningLayer = new OpenAIReasoningSchemaCompatLayer(modelInfo);
|
|
5561
5540
|
const compatLayer = reasoningLayer.isReasoningModel() ? reasoningLayer : new OpenAISchemaCompatLayer(modelInfo);
|
|
5562
5541
|
if (!compatLayer.shouldApply()) return schema;
|
|
5563
|
-
|
|
5542
|
+
const processedZodSchema = compatLayer.processZodType(zodSchema);
|
|
5543
|
+
return require_schema.toStandardSchema(processedZodSchema);
|
|
5564
5544
|
}
|
|
5565
5545
|
/**
|
|
5566
5546
|
* Applies OpenAI compat transforms to all tools in a toolset.
|
|
@@ -5602,8 +5582,7 @@ function applyOpenAICompatToTools(tools, modelInfo) {
|
|
|
5602
5582
|
} else transformedTools[name] = tool;
|
|
5603
5583
|
return transformedTools;
|
|
5604
5584
|
}
|
|
5605
|
-
|
|
5606
|
-
//#region src/provider-compats/anthropic.ts
|
|
5585
|
+
// src/provider-compats/anthropic.ts
|
|
5607
5586
|
var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
5608
5587
|
constructor(model) {
|
|
5609
5588
|
super(model);
|
|
@@ -5648,9 +5627,10 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5648
5627
|
} else if (this.isObj(value)) return this.defaultZodObjectHandler(value);
|
|
5649
5628
|
else if (this.isArr(value)) return this.defaultZodArrayHandler(value, []);
|
|
5650
5629
|
else if (this.isUnion(value)) return this.defaultZodUnionHandler(value);
|
|
5651
|
-
else if (this.isString(value))
|
|
5652
|
-
|
|
5653
|
-
|
|
5630
|
+
else if (this.isString(value)) {
|
|
5631
|
+
if (this.getModel().modelId.includes("claude-3.5-haiku")) return this.defaultZodStringHandler(value, ["max", "min"]);
|
|
5632
|
+
else return value;
|
|
5633
|
+
} else if (isNull(zod.z)(value)) return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value.description || "must be null");
|
|
5654
5634
|
else if (isIntersection(zod.z)(value)) return this.defaultZodIntersectionHandler(value);
|
|
5655
5635
|
return this.defaultUnsupportedZodTypeHandler(value);
|
|
5656
5636
|
}
|
|
@@ -5815,12 +5795,10 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5815
5795
|
case "promise":
|
|
5816
5796
|
replace("innerType");
|
|
5817
5797
|
break;
|
|
5818
|
-
case "lazy":
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
};
|
|
5823
|
-
break;
|
|
5798
|
+
case "lazy": nextDef = {
|
|
5799
|
+
...def,
|
|
5800
|
+
getter: () => strip(def.getter())
|
|
5801
|
+
};
|
|
5824
5802
|
}
|
|
5825
5803
|
if (nextDef === def) {
|
|
5826
5804
|
schemas.set(value, value);
|
|
@@ -5934,12 +5912,10 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5934
5912
|
replace("in");
|
|
5935
5913
|
replace("out");
|
|
5936
5914
|
break;
|
|
5937
|
-
case "ZodLazy":
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
};
|
|
5942
|
-
break;
|
|
5915
|
+
case "ZodLazy": nextDef = {
|
|
5916
|
+
...def,
|
|
5917
|
+
getter: () => strip(def.getter())
|
|
5918
|
+
};
|
|
5943
5919
|
}
|
|
5944
5920
|
if (nextDef === def) {
|
|
5945
5921
|
schemas.set(value, value);
|
|
@@ -5961,8 +5937,7 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5961
5937
|
}) ?? schema;
|
|
5962
5938
|
}
|
|
5963
5939
|
};
|
|
5964
|
-
|
|
5965
|
-
//#region src/provider-compats/deepseek.ts
|
|
5940
|
+
// src/provider-compats/deepseek.ts
|
|
5966
5941
|
var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
5967
5942
|
constructor(model) {
|
|
5968
5943
|
super(model);
|
|
@@ -5989,7 +5964,8 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5989
5964
|
return value;
|
|
5990
5965
|
}
|
|
5991
5966
|
processToAISDKSchema(zodSchema) {
|
|
5992
|
-
const
|
|
5967
|
+
const compat = this.processToCompatSchema(zodSchema);
|
|
5968
|
+
const transformedJsonSchema = require_schema.standardSchemaToJSONSchema(compat);
|
|
5993
5969
|
return jsonSchema(transformedJsonSchema, { validate: (value) => {
|
|
5994
5970
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
5995
5971
|
const result = zodSchema.safeParse(transformed);
|
|
@@ -6054,8 +6030,7 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
6054
6030
|
return schema;
|
|
6055
6031
|
}
|
|
6056
6032
|
};
|
|
6057
|
-
|
|
6058
|
-
//#region src/provider-compats/google.ts
|
|
6033
|
+
// src/provider-compats/google.ts
|
|
6059
6034
|
function fixAISDKNullableUnionTypes(schema) {
|
|
6060
6035
|
if (typeof schema !== "object" || schema === null) return schema;
|
|
6061
6036
|
const result = { ...schema };
|
|
@@ -6091,8 +6066,10 @@ function fixAISDKNullableUnionTypes(schema) {
|
|
|
6091
6066
|
}
|
|
6092
6067
|
}
|
|
6093
6068
|
if (result.properties && typeof result.properties === "object") result.properties = Object.fromEntries(Object.entries(result.properties).map(([key, value]) => [key, fixAISDKNullableUnionTypes(value)]));
|
|
6094
|
-
if (result.items)
|
|
6095
|
-
|
|
6069
|
+
if (result.items) {
|
|
6070
|
+
if (Array.isArray(result.items)) result.items = result.items.map((item) => fixAISDKNullableUnionTypes(item));
|
|
6071
|
+
else result.items = fixAISDKNullableUnionTypes(result.items);
|
|
6072
|
+
}
|
|
6096
6073
|
if (result.additionalProperties && typeof result.additionalProperties === "object") result.additionalProperties = fixAISDKNullableUnionTypes(result.additionalProperties);
|
|
6097
6074
|
if (result.anyOf && Array.isArray(result.anyOf)) result.anyOf = result.anyOf.map((s) => fixAISDKNullableUnionTypes(s));
|
|
6098
6075
|
if (result.oneOf && Array.isArray(result.oneOf)) result.oneOf = result.oneOf.map((s) => fixAISDKNullableUnionTypes(s));
|
|
@@ -6180,7 +6157,8 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
6180
6157
|
return result;
|
|
6181
6158
|
}
|
|
6182
6159
|
processToAISDKSchema(zodSchema) {
|
|
6183
|
-
const
|
|
6160
|
+
const compat = this.processToCompatSchema(zodSchema);
|
|
6161
|
+
const fixedJsonSchema = fixAISDKNullableUnionTypes(require_schema.standardSchemaToJSONSchema(compat));
|
|
6184
6162
|
return jsonSchema(fixedJsonSchema, { validate: (value) => {
|
|
6185
6163
|
const transformed = this.#traverse(value, fixedJsonSchema);
|
|
6186
6164
|
const result = zodSchema.safeParse(transformed);
|
|
@@ -6311,8 +6289,7 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
6311
6289
|
return schema;
|
|
6312
6290
|
}
|
|
6313
6291
|
};
|
|
6314
|
-
|
|
6315
|
-
//#region src/provider-compats/meta.ts
|
|
6292
|
+
// src/provider-compats/meta.ts
|
|
6316
6293
|
var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
6317
6294
|
constructor(model) {
|
|
6318
6295
|
super(model);
|
|
@@ -6340,7 +6317,8 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
6340
6317
|
return value;
|
|
6341
6318
|
}
|
|
6342
6319
|
processToAISDKSchema(zodSchema) {
|
|
6343
|
-
const
|
|
6320
|
+
const compat = this.processToCompatSchema(zodSchema);
|
|
6321
|
+
const transformedJsonSchema = require_schema.standardSchemaToJSONSchema(compat);
|
|
6344
6322
|
return jsonSchema(transformedJsonSchema, { validate: (value) => {
|
|
6345
6323
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
6346
6324
|
const result = zodSchema.safeParse(transformed);
|
|
@@ -6405,7 +6383,6 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
6405
6383
|
return schema;
|
|
6406
6384
|
}
|
|
6407
6385
|
};
|
|
6408
|
-
//#endregion
|
|
6409
6386
|
exports.ALL_ARRAY_CHECKS = ALL_ARRAY_CHECKS;
|
|
6410
6387
|
exports.ALL_NUMBER_CHECKS = ALL_NUMBER_CHECKS;
|
|
6411
6388
|
exports.ALL_STRING_CHECKS = ALL_STRING_CHECKS;
|