@mastra/schema-compat 1.2.11 → 1.2.13
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 +6 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +11 -8
- package/dist/{chunk-MXN3UURE.js → chunk-32GCIDQI.js} +175 -175
- package/dist/chunk-32GCIDQI.js.map +1 -0
- package/dist/{chunk-ZRSV37SF.cjs → chunk-7IQVBFIT.cjs} +4 -4
- package/dist/{chunk-ZRSV37SF.cjs.map → chunk-7IQVBFIT.cjs.map} +1 -1
- package/dist/{chunk-H72LBCXW.js → chunk-JRKBFHQT.js} +3 -3
- package/dist/{chunk-H72LBCXW.js.map → chunk-JRKBFHQT.js.map} +1 -1
- package/dist/{chunk-B6ZU4MU5.cjs → chunk-PRX3QIA2.cjs} +175 -175
- package/dist/chunk-PRX3QIA2.cjs.map +1 -0
- package/dist/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/json-schema/utils.d.ts +1 -1
- package/dist/json-schema.d.ts +1 -1
- package/dist/provider-compats/anthropic.d.ts +1 -1
- package/dist/provider-compats/deepseek.d.ts +1 -1
- package/dist/provider-compats/google.d.ts +1 -1
- package/dist/provider-compats/meta.d.ts +1 -1
- package/dist/provider-compats/openai.d.ts +1 -1
- package/dist/schema.cjs +7 -7
- package/dist/schema.js +1 -1
- package/dist/schema.types.d.ts +1 -1
- package/dist/standard-schema/adapters/ai-sdk.d.ts +1 -1
- package/dist/standard-schema/adapters/json-schema.cjs +3 -3
- package/dist/standard-schema/adapters/json-schema.d.ts +1 -1
- package/dist/standard-schema/adapters/json-schema.js +1 -1
- package/dist/standard-schema/standard-schema.d.ts +1 -1
- package/dist/zod-to-json.d.ts +1 -1
- package/package.json +15 -15
- package/dist/chunk-B6ZU4MU5.cjs.map +0 -1
- package/dist/chunk-MXN3UURE.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7IQVBFIT_cjs = require('./chunk-7IQVBFIT.cjs');
|
|
4
4
|
var chunkLQOEEQF6_cjs = require('./chunk-LQOEEQF6.cjs');
|
|
5
5
|
var chunkSKPYVQBT_cjs = require('./chunk-SKPYVQBT.cjs');
|
|
6
6
|
var chunkDZUJEN5N_cjs = require('./chunk-DZUJEN5N.cjs');
|
|
@@ -10,7 +10,7 @@ var zodFromJsonSchema = require('zod-from-json-schema');
|
|
|
10
10
|
var zodFromJsonSchemaV3 = require('zod-from-json-schema-v3');
|
|
11
11
|
var v4 = require('zod/v4');
|
|
12
12
|
|
|
13
|
-
// ../_vendored/ai_v4/dist/chunk-
|
|
13
|
+
// ../_vendored/ai_v4/dist/chunk-QGLOM3VL.js
|
|
14
14
|
var __create = Object.create;
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
16
16
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -3608,20 +3608,20 @@ function applyCompatLayer({
|
|
|
3608
3608
|
mode
|
|
3609
3609
|
}) {
|
|
3610
3610
|
if (mode === "jsonSchema") {
|
|
3611
|
-
const standardSchema =
|
|
3611
|
+
const standardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
3612
3612
|
for (const compat of compatLayers) {
|
|
3613
3613
|
if (compat.shouldApply()) {
|
|
3614
3614
|
const compatSchema = compat.processToCompatSchema(standardSchema);
|
|
3615
|
-
return
|
|
3615
|
+
return chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compatSchema);
|
|
3616
3616
|
}
|
|
3617
3617
|
}
|
|
3618
|
-
return
|
|
3618
|
+
return chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(standardSchema);
|
|
3619
3619
|
} else {
|
|
3620
3620
|
let zodSchema2;
|
|
3621
3621
|
if (isZodType(schema)) {
|
|
3622
3622
|
zodSchema2 = schema;
|
|
3623
3623
|
} else {
|
|
3624
|
-
if (
|
|
3624
|
+
if (chunk7IQVBFIT_cjs.isStandardSchemaWithJSON(schema)) {
|
|
3625
3625
|
throw new Error("StandardSchemaWithJSON is not supported for applyCompatLayer and aiSdkSchema mode");
|
|
3626
3626
|
}
|
|
3627
3627
|
zodSchema2 = convertSchemaToZod(schema);
|
|
@@ -4881,8 +4881,8 @@ var SchemaCompatLayer3 = class {
|
|
|
4881
4881
|
* @returns
|
|
4882
4882
|
*/
|
|
4883
4883
|
processToJSONSchema(schema, io = "input") {
|
|
4884
|
-
const standardSchema =
|
|
4885
|
-
const jsonSchema2 =
|
|
4884
|
+
const standardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
4885
|
+
const jsonSchema2 = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(standardSchema, {
|
|
4886
4886
|
target: "draft-07",
|
|
4887
4887
|
io
|
|
4888
4888
|
// Use input mode so fields with defaults are optional
|
|
@@ -4904,7 +4904,7 @@ var SchemaCompatLayer3 = class {
|
|
|
4904
4904
|
"~standard": {
|
|
4905
4905
|
version: 1,
|
|
4906
4906
|
vendor: "mastra",
|
|
4907
|
-
validate: (value) =>
|
|
4907
|
+
validate: (value) => chunk7IQVBFIT_cjs.toStandardSchema(schema)["~standard"].validate(value),
|
|
4908
4908
|
jsonSchema: {
|
|
4909
4909
|
input: () => {
|
|
4910
4910
|
return this.processToJSONSchema(schema, "input");
|
|
@@ -5162,8 +5162,8 @@ var SchemaCompatLayer3 = class {
|
|
|
5162
5162
|
};
|
|
5163
5163
|
const schemaTarget = this.getSchemaTarget();
|
|
5164
5164
|
const target = (schemaTarget && SCHEMA_TARGET_TO_STANDARD[schemaTarget]) ?? schemaTarget;
|
|
5165
|
-
const standardSchema =
|
|
5166
|
-
const jsonSchema2 =
|
|
5165
|
+
const standardSchema = chunk7IQVBFIT_cjs.toStandardSchema(zodSchema2);
|
|
5166
|
+
const jsonSchema2 = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(standardSchema, {
|
|
5167
5167
|
target,
|
|
5168
5168
|
io: "input"
|
|
5169
5169
|
// Use input mode so fields with defaults are optional
|
|
@@ -5364,7 +5364,7 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5364
5364
|
*/
|
|
5365
5365
|
processToAISDKSchema(zodSchema2) {
|
|
5366
5366
|
const compat = this.processToCompatSchema(zodSchema2);
|
|
5367
|
-
const transformedJsonSchema =
|
|
5367
|
+
const transformedJsonSchema = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compat);
|
|
5368
5368
|
return jsonSchema(transformedJsonSchema, {
|
|
5369
5369
|
validate: (value) => {
|
|
5370
5370
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
@@ -5374,7 +5374,7 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5374
5374
|
});
|
|
5375
5375
|
}
|
|
5376
5376
|
processToCompatSchema(schema) {
|
|
5377
|
-
const originalStandardSchema =
|
|
5377
|
+
const originalStandardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
5378
5378
|
return {
|
|
5379
5379
|
"~standard": {
|
|
5380
5380
|
version: 1,
|
|
@@ -5632,7 +5632,7 @@ function applyOpenAICompatTransforms(schema, modelInfo) {
|
|
|
5632
5632
|
return schema;
|
|
5633
5633
|
}
|
|
5634
5634
|
const processedZodSchema = compatLayer.processZodType(zodSchema2);
|
|
5635
|
-
return
|
|
5635
|
+
return chunk7IQVBFIT_cjs.toStandardSchema(processedZodSchema);
|
|
5636
5636
|
}
|
|
5637
5637
|
function applyOpenAICompatToTools(tools, modelInfo) {
|
|
5638
5638
|
if (!tools) {
|
|
@@ -5688,7 +5688,7 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5688
5688
|
}
|
|
5689
5689
|
processToAISDKSchema(zodSchema2) {
|
|
5690
5690
|
const compat = this.processToCompatSchema(zodSchema2);
|
|
5691
|
-
const transformedJsonSchema =
|
|
5691
|
+
const transformedJsonSchema = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compat);
|
|
5692
5692
|
return jsonSchema(transformedJsonSchema, {
|
|
5693
5693
|
validate: (value) => {
|
|
5694
5694
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
@@ -5698,7 +5698,7 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5698
5698
|
});
|
|
5699
5699
|
}
|
|
5700
5700
|
processToCompatSchema(schema) {
|
|
5701
|
-
const originalStandardSchema =
|
|
5701
|
+
const originalStandardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
5702
5702
|
return {
|
|
5703
5703
|
"~standard": {
|
|
5704
5704
|
version: 1,
|
|
@@ -5819,7 +5819,7 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5819
5819
|
}
|
|
5820
5820
|
processToAISDKSchema(zodSchema2) {
|
|
5821
5821
|
const compat = this.processToCompatSchema(zodSchema2);
|
|
5822
|
-
const transformedJsonSchema =
|
|
5822
|
+
const transformedJsonSchema = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compat);
|
|
5823
5823
|
return jsonSchema(transformedJsonSchema, {
|
|
5824
5824
|
validate: (value) => {
|
|
5825
5825
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
@@ -5829,7 +5829,7 @@ var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
5829
5829
|
});
|
|
5830
5830
|
}
|
|
5831
5831
|
processToCompatSchema(schema) {
|
|
5832
|
-
const originalStandardSchema =
|
|
5832
|
+
const originalStandardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
5833
5833
|
return {
|
|
5834
5834
|
"~standard": {
|
|
5835
5835
|
version: 1,
|
|
@@ -6065,7 +6065,7 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
6065
6065
|
}
|
|
6066
6066
|
processToAISDKSchema(zodSchema2) {
|
|
6067
6067
|
const compat = this.processToCompatSchema(zodSchema2);
|
|
6068
|
-
const transformedJsonSchema =
|
|
6068
|
+
const transformedJsonSchema = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compat);
|
|
6069
6069
|
const fixedJsonSchema = fixAISDKNullableUnionTypes(transformedJsonSchema);
|
|
6070
6070
|
return jsonSchema(fixedJsonSchema, {
|
|
6071
6071
|
validate: (value) => {
|
|
@@ -6076,7 +6076,7 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
6076
6076
|
});
|
|
6077
6077
|
}
|
|
6078
6078
|
processToCompatSchema(schema) {
|
|
6079
|
-
const originalStandardSchema =
|
|
6079
|
+
const originalStandardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
6080
6080
|
return {
|
|
6081
6081
|
"~standard": {
|
|
6082
6082
|
version: 1,
|
|
@@ -6230,7 +6230,7 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
6230
6230
|
}
|
|
6231
6231
|
processToAISDKSchema(zodSchema2) {
|
|
6232
6232
|
const compat = this.processToCompatSchema(zodSchema2);
|
|
6233
|
-
const transformedJsonSchema =
|
|
6233
|
+
const transformedJsonSchema = chunk7IQVBFIT_cjs.standardSchemaToJSONSchema(compat);
|
|
6234
6234
|
return jsonSchema(transformedJsonSchema, {
|
|
6235
6235
|
validate: (value) => {
|
|
6236
6236
|
const transformed = this.#traverse(value, transformedJsonSchema);
|
|
@@ -6240,7 +6240,7 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
6240
6240
|
});
|
|
6241
6241
|
}
|
|
6242
6242
|
processToCompatSchema(schema) {
|
|
6243
|
-
const originalStandardSchema =
|
|
6243
|
+
const originalStandardSchema = chunk7IQVBFIT_cjs.toStandardSchema(schema);
|
|
6244
6244
|
return {
|
|
6245
6245
|
"~standard": {
|
|
6246
6246
|
version: 1,
|
|
@@ -6319,27 +6319,27 @@ var MetaSchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
6319
6319
|
|
|
6320
6320
|
Object.defineProperty(exports, "JSON_SCHEMA_LIBRARY_OPTIONS", {
|
|
6321
6321
|
enumerable: true,
|
|
6322
|
-
get: function () { return
|
|
6322
|
+
get: function () { return chunk7IQVBFIT_cjs.JSON_SCHEMA_LIBRARY_OPTIONS; }
|
|
6323
6323
|
});
|
|
6324
6324
|
Object.defineProperty(exports, "isStandardJSONSchema", {
|
|
6325
6325
|
enumerable: true,
|
|
6326
|
-
get: function () { return
|
|
6326
|
+
get: function () { return chunk7IQVBFIT_cjs.isStandardJSONSchema; }
|
|
6327
6327
|
});
|
|
6328
6328
|
Object.defineProperty(exports, "isStandardSchema", {
|
|
6329
6329
|
enumerable: true,
|
|
6330
|
-
get: function () { return
|
|
6330
|
+
get: function () { return chunk7IQVBFIT_cjs.isStandardSchema; }
|
|
6331
6331
|
});
|
|
6332
6332
|
Object.defineProperty(exports, "isStandardSchemaWithJSON", {
|
|
6333
6333
|
enumerable: true,
|
|
6334
|
-
get: function () { return
|
|
6334
|
+
get: function () { return chunk7IQVBFIT_cjs.isStandardSchemaWithJSON; }
|
|
6335
6335
|
});
|
|
6336
6336
|
Object.defineProperty(exports, "standardSchemaToJSONSchema", {
|
|
6337
6337
|
enumerable: true,
|
|
6338
|
-
get: function () { return
|
|
6338
|
+
get: function () { return chunk7IQVBFIT_cjs.standardSchemaToJSONSchema; }
|
|
6339
6339
|
});
|
|
6340
6340
|
Object.defineProperty(exports, "toStandardSchema", {
|
|
6341
6341
|
enumerable: true,
|
|
6342
|
-
get: function () { return
|
|
6342
|
+
get: function () { return chunk7IQVBFIT_cjs.toStandardSchema; }
|
|
6343
6343
|
});
|
|
6344
6344
|
Object.defineProperty(exports, "ensureAllPropertiesRequired", {
|
|
6345
6345
|
enumerable: true,
|