@mastra/schema-compat 0.10.3-alpha.0 → 0.10.3

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/schema-compat@0.10.3-alpha.0 build /home/runner/work/mastra/mastra/packages/schema-compat
2
+ > @mastra/schema-compat@0.10.3-alpha.1 build /home/runner/work/mastra/mastra/packages/schema-compat
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 2224ms
9
+ TSC ⚡️ Build success in 2189ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 1937ms
16
+ DTS ⚡️ Build success in 1915ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 20.79 KB
21
- ESM ⚡️ Build success in 150ms
22
- CJS dist/index.cjs 21.42 KB
23
- CJS ⚡️ Build success in 185ms
20
+ CJS dist/index.cjs 21.59 KB
21
+ CJS ⚡️ Build success in 164ms
22
+ ESM dist/index.js 20.96 KB
23
+ ESM ⚡️ Build success in 164ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 98bbe5a: Claude cannot handle tuple schemas now.
8
+ - a853c43: Allow for object.passthrough in schema compat (aka MCP tool support).
9
+
10
+ ## 0.10.3-alpha.1
11
+
12
+ ### Patch Changes
13
+
14
+ - a853c43: Allow for object.passthrough in schema compat (aka MCP tool support).
15
+
3
16
  ## 0.10.3-alpha.0
4
17
 
5
18
  ### Patch Changes
@@ -339,7 +339,9 @@ declare abstract class SchemaCompatLayer {
339
339
  * @param value - The Zod object to process
340
340
  * @returns The processed Zod object
341
341
  */
342
- defaultZodObjectHandler(value: ZodObject<any, any, any>): ZodObject<any, any, any>;
342
+ defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
343
+ passthrough?: boolean;
344
+ }): ZodObject<any, any, any>;
343
345
  /**
344
346
  * Merges validation constraints into a parameter description.
345
347
  *
@@ -339,7 +339,9 @@ declare abstract class SchemaCompatLayer {
339
339
  * @param value - The Zod object to process
340
340
  * @returns The processed Zod object
341
341
  */
342
- defaultZodObjectHandler(value: ZodObject<any, any, any>): ZodObject<any, any, any>;
342
+ defaultZodObjectHandler(value: ZodObject<any, any, any>, options?: {
343
+ passthrough?: boolean;
344
+ }): ZodObject<any, any, any>;
343
345
  /**
344
346
  * Merges validation constraints into a parameter description.
345
347
  *
package/dist/index.cjs CHANGED
@@ -115,7 +115,7 @@ var SchemaCompatLayer = class {
115
115
  * @param value - The Zod object to process
116
116
  * @returns The processed Zod object
117
117
  */
118
- defaultZodObjectHandler(value) {
118
+ defaultZodObjectHandler(value, options = { passthrough: true }) {
119
119
  const processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {
120
120
  acc[key] = this.processZodType(propValue);
121
121
  return acc;
@@ -130,6 +130,9 @@ var SchemaCompatLayer = class {
130
130
  if (value.description) {
131
131
  result = result.describe(value.description);
132
132
  }
133
+ if (options.passthrough && value._def.unknownKeys === "passthrough") {
134
+ result = result.passthrough();
135
+ }
133
136
  return result;
134
137
  }
135
138
  /**
@@ -600,7 +603,7 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
600
603
  const innerZodType = this.processZodType(value._def.innerType);
601
604
  return innerZodType.nullable();
602
605
  } else if (isObj(value)) {
603
- return this.defaultZodObjectHandler(value);
606
+ return this.defaultZodObjectHandler(value, { passthrough: false });
604
607
  } else if (isArr(value)) {
605
608
  return this.defaultZodArrayHandler(value);
606
609
  } else if (isUnion(value)) {
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ var SchemaCompatLayer = class {
113
113
  * @param value - The Zod object to process
114
114
  * @returns The processed Zod object
115
115
  */
116
- defaultZodObjectHandler(value) {
116
+ defaultZodObjectHandler(value, options = { passthrough: true }) {
117
117
  const processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {
118
118
  acc[key] = this.processZodType(propValue);
119
119
  return acc;
@@ -128,6 +128,9 @@ var SchemaCompatLayer = class {
128
128
  if (value.description) {
129
129
  result = result.describe(value.description);
130
130
  }
131
+ if (options.passthrough && value._def.unknownKeys === "passthrough") {
132
+ result = result.passthrough();
133
+ }
131
134
  return result;
132
135
  }
133
136
  /**
@@ -598,7 +601,7 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer {
598
601
  const innerZodType = this.processZodType(value._def.innerType);
599
602
  return innerZodType.nullable();
600
603
  } else if (isObj(value)) {
601
- return this.defaultZodObjectHandler(value);
604
+ return this.defaultZodObjectHandler(value, { passthrough: false });
602
605
  } else if (isArr(value)) {
603
606
  return this.defaultZodArrayHandler(value);
604
607
  } else if (isUnion(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/schema-compat",
3
- "version": "0.10.3-alpha.0",
3
+ "version": "0.10.3",
4
4
  "description": "Tool schema compatibility layer for Mastra.ai",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "typescript": "^5.8.3",
46
46
  "vitest": "^3.2.3",
47
47
  "zod": "^3.25.67",
48
- "@internal/lint": "0.0.13"
48
+ "@internal/lint": "0.0.14"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
@@ -45,7 +45,7 @@ export class OpenAIReasoningSchemaCompatLayer extends SchemaCompatLayer {
45
45
  const innerZodType = this.processZodType(value._def.innerType);
46
46
  return innerZodType.nullable();
47
47
  } else if (isObj(value)) {
48
- return this.defaultZodObjectHandler(value);
48
+ return this.defaultZodObjectHandler(value, { passthrough: false });
49
49
  } else if (isArr(value)) {
50
50
  return this.defaultZodArrayHandler(value);
51
51
  } else if (isUnion(value)) {
@@ -232,7 +232,10 @@ export abstract class SchemaCompatLayer {
232
232
  * @param value - The Zod object to process
233
233
  * @returns The processed Zod object
234
234
  */
235
- public defaultZodObjectHandler(value: ZodObject<any, any, any>): ZodObject<any, any, any> {
235
+ public defaultZodObjectHandler(
236
+ value: ZodObject<any, any, any>,
237
+ options: { passthrough?: boolean } = { passthrough: true },
238
+ ): ZodObject<any, any, any> {
236
239
  const processedShape = Object.entries(value.shape).reduce<Record<string, ZodTypeAny>>((acc, [key, propValue]) => {
237
240
  acc[key] = this.processZodType(propValue as ZodTypeAny);
238
241
  return acc;
@@ -250,6 +253,11 @@ export abstract class SchemaCompatLayer {
250
253
  if (value.description) {
251
254
  result = result.describe(value.description);
252
255
  }
256
+
257
+ if (options.passthrough && value._def.unknownKeys === 'passthrough') {
258
+ result = result.passthrough();
259
+ }
260
+
253
261
  return result;
254
262
  }
255
263