@mastra/schema-compat 0.10.2 → 0.10.3-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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/schema-compat@0.10.2-alpha.3 build /home/runner/work/mastra/mastra/packages/schema-compat
2
+ > @mastra/schema-compat@0.10.3-alpha.0 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 2143ms
9
+ TSC ⚡️ Build success in 2224ms
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 1931ms
16
+ DTS ⚡️ Build success in 1937ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 21.03 KB
21
- ESM ⚡️ Build success in 162ms
22
- CJS dist/index.cjs 21.65 KB
23
- CJS ⚡️ Build success in 163ms
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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 0.10.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 98bbe5a: Claude cannot handle tuple schemas now.
8
+
3
9
  ## 0.10.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -425,9 +425,8 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
425
425
  }
426
426
  processZodType(value) {
427
427
  if (isOptional(value)) {
428
- const handleTypes = ["ZodObject", "ZodArray", "ZodUnion", "ZodNever", "ZodUndefined"];
428
+ const handleTypes = ["ZodObject", "ZodArray", "ZodUnion", "ZodNever", "ZodUndefined", "ZodTuple"];
429
429
  if (this.getModel().modelId.includes("claude-3.5-haiku")) handleTypes.push("ZodString");
430
- if (this.getModel().modelId.includes("claude-3.7")) handleTypes.push("ZodTuple");
431
430
  return this.defaultZodOptionalHandler(value, handleTypes);
432
431
  } else if (isObj(value)) {
433
432
  return this.defaultZodObjectHandler(value);
@@ -442,11 +441,7 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
442
441
  return value;
443
442
  }
444
443
  }
445
- if (this.getModel().modelId.includes("claude-3.7")) {
446
- return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodTuple", "ZodUndefined"]);
447
- } else {
448
- return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodUndefined"]);
449
- }
444
+ return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodTuple", "ZodUndefined"]);
450
445
  }
451
446
  };
452
447
 
package/dist/index.js CHANGED
@@ -423,9 +423,8 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
423
423
  }
424
424
  processZodType(value) {
425
425
  if (isOptional(value)) {
426
- const handleTypes = ["ZodObject", "ZodArray", "ZodUnion", "ZodNever", "ZodUndefined"];
426
+ const handleTypes = ["ZodObject", "ZodArray", "ZodUnion", "ZodNever", "ZodUndefined", "ZodTuple"];
427
427
  if (this.getModel().modelId.includes("claude-3.5-haiku")) handleTypes.push("ZodString");
428
- if (this.getModel().modelId.includes("claude-3.7")) handleTypes.push("ZodTuple");
429
428
  return this.defaultZodOptionalHandler(value, handleTypes);
430
429
  } else if (isObj(value)) {
431
430
  return this.defaultZodObjectHandler(value);
@@ -440,11 +439,7 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {
440
439
  return value;
441
440
  }
442
441
  }
443
- if (this.getModel().modelId.includes("claude-3.7")) {
444
- return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodTuple", "ZodUndefined"]);
445
- } else {
446
- return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodUndefined"]);
447
- }
442
+ return this.defaultUnsupportedZodTypeHandler(value, ["ZodNever", "ZodTuple", "ZodUndefined"]);
448
443
  }
449
444
  };
450
445
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/schema-compat",
3
- "version": "0.10.2",
3
+ "version": "0.10.3-alpha.0",
4
4
  "description": "Tool schema compatibility layer for Mastra.ai",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,24 +28,24 @@
28
28
  "author": "",
29
29
  "license": "Elastic-2.0",
30
30
  "dependencies": {
31
+ "json-schema": "^0.4.0",
31
32
  "zod-from-json-schema": "^0.0.5",
32
- "zod-to-json-schema": "^3.24.5",
33
- "json-schema": "^0.4.0"
33
+ "zod-to-json-schema": "^3.24.5"
34
34
  },
35
35
  "peerDependencies": {
36
- "zod": "^3.0.0",
37
- "ai": "^4.0.0"
36
+ "ai": "^4.0.0",
37
+ "zod": "^3.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^20.17.57",
41
40
  "@types/json-schema": "^7.0.15",
42
- "eslint": "^9.28.0",
43
- "tsup": "^8.5.0",
44
- "typescript": "^5.8.2",
45
- "vitest": "^3.2.2",
46
- "zod": "^3.25.56",
41
+ "@types/node": "^20.19.0",
47
42
  "ai": "4.3.16",
48
- "@internal/lint": "0.0.11"
43
+ "eslint": "^9.29.0",
44
+ "tsup": "^8.5.0",
45
+ "typescript": "^5.8.3",
46
+ "vitest": "^3.2.3",
47
+ "zod": "^3.25.67",
48
+ "@internal/lint": "0.0.13"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
@@ -19,9 +19,8 @@ export class AnthropicSchemaCompatLayer extends SchemaCompatLayer {
19
19
 
20
20
  processZodType(value: ZodTypeAny): ZodTypeAny {
21
21
  if (isOptional(value)) {
22
- const handleTypes: AllZodType[] = ['ZodObject', 'ZodArray', 'ZodUnion', 'ZodNever', 'ZodUndefined'];
22
+ const handleTypes: AllZodType[] = ['ZodObject', 'ZodArray', 'ZodUnion', 'ZodNever', 'ZodUndefined', 'ZodTuple'];
23
23
  if (this.getModel().modelId.includes('claude-3.5-haiku')) handleTypes.push('ZodString');
24
- if (this.getModel().modelId.includes('claude-3.7')) handleTypes.push('ZodTuple');
25
24
  return this.defaultZodOptionalHandler(value, handleTypes);
26
25
  } else if (isObj(value)) {
27
26
  return this.defaultZodObjectHandler(value);
@@ -40,10 +39,6 @@ export class AnthropicSchemaCompatLayer extends SchemaCompatLayer {
40
39
  }
41
40
  }
42
41
 
43
- if (this.getModel().modelId.includes('claude-3.7')) {
44
- return this.defaultUnsupportedZodTypeHandler(value, ['ZodNever', 'ZodTuple', 'ZodUndefined']);
45
- } else {
46
- return this.defaultUnsupportedZodTypeHandler(value, ['ZodNever', 'ZodUndefined']);
47
- }
42
+ return this.defaultUnsupportedZodTypeHandler(value, ['ZodNever', 'ZodTuple', 'ZodUndefined']);
48
43
  }
49
44
  }