@mastra/schema-compat 1.3.11-alpha.1 → 1.3.12-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 +367 -25
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +686 -37
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/{json-schema-DaHLYDhg.js → json-schema-R8yfooPa.js} +95 -96
- package/dist/json-schema-R8yfooPa.js.map +1 -0
- package/dist/{json-schema-8xkiEZVb.cjs → json-schema-VSnKq6-P.cjs} +95 -96
- package/dist/json-schema-VSnKq6-P.cjs.map +1 -0
- package/dist/provider-compats/openai.d.ts.map +1 -1
- package/dist/{schema-D35TsNfD.cjs → schema-IhrnbMI3.cjs} +2 -2
- package/dist/{schema-D35TsNfD.cjs.map → schema-IhrnbMI3.cjs.map} +1 -1
- package/dist/{schema-BwlBcZRB.js → schema-e0VHpMt0.js} +2 -2
- package/dist/{schema-BwlBcZRB.js.map → schema-e0VHpMt0.js.map} +1 -1
- package/dist/schema.cjs +1 -1
- package/dist/schema.js +1 -1
- package/dist/standard-schema/adapters/json-schema.cjs +1 -1
- package/dist/standard-schema/adapters/json-schema.js +1 -1
- package/dist/zod-to-json.cjs +5 -2
- package/dist/zod-to-json.cjs.map +1 -1
- package/dist/zod-to-json.d.ts.map +1 -1
- package/dist/zod-to-json.js +5 -2
- package/dist/zod-to-json.js.map +1 -1
- package/package.json +8 -8
- package/dist/json-schema-8xkiEZVb.cjs.map +0 -1
- package/dist/json-schema-DaHLYDhg.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_json_schema_traverse$1 = require("./json-schema-traverse-DbuWNYgg.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-IhrnbMI3.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");
|
|
@@ -5228,6 +5228,15 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5228
5228
|
"x-optional"
|
|
5229
5229
|
];
|
|
5230
5230
|
const arrayKeywords = ["items"];
|
|
5231
|
+
const numericKeywords = [
|
|
5232
|
+
"format",
|
|
5233
|
+
"minimum",
|
|
5234
|
+
"maximum",
|
|
5235
|
+
"exclusiveMinimum",
|
|
5236
|
+
"exclusiveMaximum",
|
|
5237
|
+
"multipleOf"
|
|
5238
|
+
];
|
|
5239
|
+
const isNumericType = (type) => type === "integer" || type === "number";
|
|
5231
5240
|
const genericConstraintKeywords = [
|
|
5232
5241
|
"const",
|
|
5233
5242
|
"enum",
|
|
@@ -5277,10 +5286,26 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5277
5286
|
prop.anyOf = types.map((type) => {
|
|
5278
5287
|
if (type === "null") return { type: "null" };
|
|
5279
5288
|
const branch = { type };
|
|
5280
|
-
|
|
5289
|
+
const numericFormat = typeof prop.format === "string" && [
|
|
5290
|
+
"int32",
|
|
5291
|
+
"int64",
|
|
5292
|
+
"float",
|
|
5293
|
+
"double"
|
|
5294
|
+
].includes(prop.format);
|
|
5295
|
+
const formatOwner = types.includes("string") && !numericFormat ? type === "string" : isNumericType(type);
|
|
5296
|
+
for (const keyword of [
|
|
5297
|
+
...typeSpecificKeywords(type),
|
|
5298
|
+
...isNumericType(type) ? numericKeywords.filter((k) => k !== "format") : [],
|
|
5299
|
+
...formatOwner ? ["format"] : []
|
|
5300
|
+
]) if (keyword in prop) branch[keyword] = prop[keyword];
|
|
5281
5301
|
return Object.assign(branch, branchConstraints);
|
|
5282
5302
|
});
|
|
5283
|
-
|
|
5303
|
+
const numericBranchExists = types.some(isNumericType);
|
|
5304
|
+
for (const keyword of [
|
|
5305
|
+
...objectKeywords,
|
|
5306
|
+
...arrayKeywords,
|
|
5307
|
+
...numericBranchExists ? numericKeywords : []
|
|
5308
|
+
]) delete prop[keyword];
|
|
5284
5309
|
} else if (prop.type && prop.type !== "null") {
|
|
5285
5310
|
const originalType = prop.type;
|
|
5286
5311
|
const keywords = typeSpecificKeywords(originalType);
|
|
@@ -5301,6 +5326,7 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer {
|
|
|
5301
5326
|
};
|
|
5302
5327
|
if (isRedundantNullableUnion(originalType)) delete propSchema.anyOf;
|
|
5303
5328
|
for (const keyword of [...genericConstraintKeywords, "anyOf"]) delete prop[keyword];
|
|
5329
|
+
if (isNumericType(originalType)) for (const keyword of numericKeywords) delete prop[keyword];
|
|
5304
5330
|
delete prop.type;
|
|
5305
5331
|
prop.anyOf = [propSchema, { type: "null" }];
|
|
5306
5332
|
}
|