@mastra/schema-compat 0.0.0-ai-v5-20250801192614 → 0.0.0-consolidate-changesets-20250904042643

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +133 -2
  2. package/README.md +0 -4
  3. package/dist/chunk-F4D2N3FC.js +28 -0
  4. package/dist/chunk-F4D2N3FC.js.map +1 -0
  5. package/dist/chunk-WRGSGOLQ.cjs +34 -0
  6. package/dist/chunk-WRGSGOLQ.cjs.map +1 -0
  7. package/dist/index.cjs +845 -92
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +3 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +844 -93
  12. package/dist/index.js.map +1 -1
  13. package/dist/provider-compats/anthropic.d.ts +6 -4
  14. package/dist/provider-compats/anthropic.d.ts.map +1 -1
  15. package/dist/provider-compats/deepseek.d.ts +6 -4
  16. package/dist/provider-compats/deepseek.d.ts.map +1 -1
  17. package/dist/provider-compats/google.d.ts +6 -4
  18. package/dist/provider-compats/google.d.ts.map +1 -1
  19. package/dist/provider-compats/meta.d.ts +6 -4
  20. package/dist/provider-compats/meta.d.ts.map +1 -1
  21. package/dist/provider-compats/openai-reasoning.d.ts +6 -4
  22. package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
  23. package/dist/provider-compats/openai.d.ts +6 -4
  24. package/dist/provider-compats/openai.d.ts.map +1 -1
  25. package/dist/schema-compatibility-v3.d.ts +319 -0
  26. package/dist/schema-compatibility-v3.d.ts.map +1 -0
  27. package/dist/schema-compatibility-v4.d.ts +310 -0
  28. package/dist/schema-compatibility-v4.d.ts.map +1 -0
  29. package/dist/schema-compatibility.d.ts +79 -132
  30. package/dist/schema-compatibility.d.ts.map +1 -1
  31. package/dist/types.d.ts +6 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/utils-test-suite.d.ts +2 -0
  34. package/dist/utils-test-suite.d.ts.map +1 -0
  35. package/dist/utils.d.ts +16 -4
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/zod-to-json.cjs +12 -0
  38. package/dist/zod-to-json.cjs.map +1 -0
  39. package/dist/zod-to-json.d.ts +6 -0
  40. package/dist/zod-to-json.d.ts.map +1 -0
  41. package/dist/zod-to-json.js +3 -0
  42. package/dist/zod-to-json.js.map +1 -0
  43. package/dist/zodTypes.d.ts +21 -0
  44. package/dist/zodTypes.d.ts.map +1 -0
  45. package/package.json +33 -9
  46. package/.turbo/turbo-build.log +0 -4
  47. package/eslint.config.js +0 -6
  48. package/src/index.ts +0 -39
  49. package/src/provider-compats/anthropic.ts +0 -43
  50. package/src/provider-compats/deepseek.ts +0 -35
  51. package/src/provider-compats/google.ts +0 -63
  52. package/src/provider-compats/meta.ts +0 -36
  53. package/src/provider-compats/openai-reasoning.ts +0 -88
  54. package/src/provider-compats/openai.ts +0 -56
  55. package/src/provider-compats.test.ts +0 -312
  56. package/src/schema-compatibility.test.ts +0 -479
  57. package/src/schema-compatibility.ts +0 -590
  58. package/src/utils.test.ts +0 -442
  59. package/src/utils.ts +0 -205
  60. package/tsconfig.build.json +0 -9
  61. package/tsconfig.json +0 -5
  62. package/tsup.config.ts +0 -22
  63. package/vitest.config.ts +0 -7
package/CHANGELOG.md CHANGED
@@ -1,10 +1,141 @@
1
1
  # @mastra/schema-compat
2
2
 
3
- ## 0.0.0-ai-v5-20250801192614
3
+ ## 0.0.0-consolidate-changesets-20250904042643
4
+
5
+ ### Patch Changes
6
+
7
+ - 637f323: Fix issue with some compilers and calling zod v4's toJSONSchema function
8
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
9
+ - a32248b: dependencies updates:
10
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
11
+ dependencies updates:
12
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
13
+ dependencies updates:
14
+ - Updated dependency [`rollup@~4.49.0` ↗︎](https://www.npmjs.com/package/rollup/v/4.49.0) (from `~4.47.1`, in `dependencies`)
15
+ dependencies updates:
16
+ - Updated dependency [`rollup@~4.50.0` ↗︎](https://www.npmjs.com/package/rollup/v/4.50.0) (from `~4.49.0`, in `dependencies`)
17
+ dependencies updates:
18
+ - Updated dependency [`redis@^5.8.2` ↗︎](https://www.npmjs.com/package/redis/v/5.8.2) (from `^5.8.0`, in `dependencies`)
19
+ dependencies updates:
20
+ - Updated dependency [`@libsql/client@^0.15.14` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.14) (from `^0.15.12`, in `dependencies`)
21
+ dependencies updates:
22
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
23
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
24
+ dependencies updates:
25
+ - Updated dependency [`zod@^4.1.5` ↗︎](https://www.npmjs.com/package/zod/v/4.1.5) (from `^4.0.15`, in `dependencies`)
26
+ dependencies updates:
27
+ - Updated dependency [`@assistant-ui/react@^0.10.44` ↗︎](https://www.npmjs.com/package/@assistant-ui/react/v/0.10.44) (from `^0.7.91`, in `dependencies`)
28
+ - Updated dependency [`@assistant-ui/react-markdown@^0.10.9` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-markdown/v/0.10.9) (from `^0.7.21`, in `dependencies`)
29
+ - Updated dependency [`@assistant-ui/react-syntax-highlighter@^0.10.10` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-syntax-highlighter/v/0.10.10) (from `^0.7.10`, in `dependencies`)
30
+ - Added dependency [`@assistant-ui/react-ui@^0.1.8` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-ui/v/0.1.8) (to `dependencies`)
31
+ dependencies updates:
32
+ - Updated dependency [`@xyflow/react@^12.8.4` ↗︎](https://www.npmjs.com/package/@xyflow/react/v/12.8.4) (from `^12.8.2`, in `dependencies`)
33
+ dependencies updates:
34
+ - Updated dependency [`@assistant-ui/react@^0.10.45` ↗︎](https://www.npmjs.com/package/@assistant-ui/react/v/0.10.45) (from `^0.10.44`, in `dependencies`)
35
+ dependencies updates:
36
+ - Updated dependency [`@qdrant/js-client-rest@^1.15.1` ↗︎](https://www.npmjs.com/package/@qdrant/js-client-rest/v/1.15.1) (from `^1.15.0`, in `dependencies`)
37
+ dependencies updates:
38
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
39
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.23.5`, in `dependencies`)
40
+ - 45e4d39: Try fixing the `Attempted import error: 'z'.'toJSONSchema' is not exported from 'zod'` error by tricking the compiler
41
+
42
+ ## 0.11.2-alpha.3
43
+
44
+ ### Patch Changes
45
+
46
+ - [#7350](https://github.com/mastra-ai/mastra/pull/7350) [`45e4d39`](https://github.com/mastra-ai/mastra/commit/45e4d391a2a09fc70c48e4d60f505586ada1ba0e) Thanks [@LekoArts](https://github.com/LekoArts)! - Try fixing the `Attempted import error: 'z'.'toJSONSchema' is not exported from 'zod'` error by tricking the compiler
47
+
48
+ ## 0.11.2-alpha.2
49
+
50
+ ### Patch Changes
51
+
52
+ - [#7343](https://github.com/mastra-ai/mastra/pull/7343) [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e) Thanks [@LekoArts](https://github.com/LekoArts)! - Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
53
+
54
+ ## 0.11.2-alpha.1
55
+
56
+ ### Patch Changes
57
+
58
+ - [#5816](https://github.com/mastra-ai/mastra/pull/5816) [`ab48c97`](https://github.com/mastra-ai/mastra/commit/ab48c979098ea571faf998a55d3a00e7acd7a715) Thanks [@dane-ai-mastra](https://github.com/apps/dane-ai-mastra)! - dependencies updates:
59
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
60
+
61
+ ## 0.11.2-alpha.0
62
+
63
+ ### Patch Changes
64
+
65
+ - [#7121](https://github.com/mastra-ai/mastra/pull/7121) [`637f323`](https://github.com/mastra-ai/mastra/commit/637f32371d79a8f78c52c0d53411af0915fcec67) Thanks [@DanielSLew](https://github.com/DanielSLew)! - Fix issue with some compilers and calling zod v4's toJSONSchema function
66
+
67
+ ## 0.11.1
68
+
69
+ ### Patch Changes
70
+
71
+ - [`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdpes for @mastra/core
72
+
73
+ ## 0.11.0
4
74
 
5
75
  ### Minor Changes
6
76
 
7
- - 66858d4: AI SDK v5 beta
77
+ - [#7032](https://github.com/mastra-ai/mastra/pull/7032) [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump zod peerdep to 3.25.0 to support both v3/v4
78
+
79
+ ### Patch Changes
80
+
81
+ - [#7028](https://github.com/mastra-ai/mastra/pull/7028) [`da58ccc`](https://github.com/mastra-ai/mastra/commit/da58ccc1f2ac33da0cb97b00443fc6208b45bdec) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix exportsmap
82
+
83
+ - [#6982](https://github.com/mastra-ai/mastra/pull/6982) [`94e9f54`](https://github.com/mastra-ai/mastra/commit/94e9f547d66ef7cd01d9075ab53b5ca9a1cae100) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix AI peerdeps for NPM install
84
+
85
+ - [#6944](https://github.com/mastra-ai/mastra/pull/6944) [`a93f3ba`](https://github.com/mastra-ai/mastra/commit/a93f3ba05eef4cf17f876d61d29cf0841a9e70b7) Thanks [@wardpeet](https://github.com/wardpeet)! - Add support for zod v4
86
+
87
+ ## 0.11.0-alpha.2
88
+
89
+ ### Minor Changes
90
+
91
+ - [#7032](https://github.com/mastra-ai/mastra/pull/7032) [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump zod peerdep to 3.25.0 to support both v3/v4
92
+
93
+ ## 0.10.6-alpha.1
94
+
95
+ ### Patch Changes
96
+
97
+ - [#7028](https://github.com/mastra-ai/mastra/pull/7028) [`da58ccc`](https://github.com/mastra-ai/mastra/commit/da58ccc1f2ac33da0cb97b00443fc6208b45bdec) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix exportsmap
98
+
99
+ ## 0.10.6-alpha.0
100
+
101
+ ### Patch Changes
102
+
103
+ - [#6982](https://github.com/mastra-ai/mastra/pull/6982) [`94e9f54`](https://github.com/mastra-ai/mastra/commit/94e9f547d66ef7cd01d9075ab53b5ca9a1cae100) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix AI peerdeps for NPM install
104
+
105
+ - [#6944](https://github.com/mastra-ai/mastra/pull/6944) [`a93f3ba`](https://github.com/mastra-ai/mastra/commit/a93f3ba05eef4cf17f876d61d29cf0841a9e70b7) Thanks [@wardpeet](https://github.com/wardpeet)! - Add support for zod v4
106
+
107
+ ## 0.10.7
108
+
109
+ ### Patch Changes
110
+
111
+ - dd94a26: Dont rely on the full language model for schema compat
112
+ - 2fff911: Fix vnext working memory tool schema when model is incompatible with schema
113
+ - ae2eb63: Handle regex checks better, return description as a string rather than an object with pattern and flags.
114
+
115
+ ## 0.10.7-alpha.1
116
+
117
+ ### Patch Changes
118
+
119
+ - ae2eb63: Handle regex checks better, return description as a string rather than an object with pattern and flags.
120
+
121
+ ## 0.10.7-alpha.0
122
+
123
+ ### Patch Changes
124
+
125
+ - dd94a26: Dont rely on the full language model for schema compat
126
+ - 2fff911: Fix vnext working memory tool schema when model is incompatible with schema
127
+
128
+ ## 0.10.6
129
+
130
+ ### Patch Changes
131
+
132
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
133
+
134
+ ## 0.10.6-alpha.0
135
+
136
+ ### Patch Changes
137
+
138
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
8
139
 
9
140
  ## 0.10.5
10
141
 
package/README.md CHANGED
@@ -142,7 +142,3 @@ pnpm test
142
142
  # Run tests in watch mode
143
143
  pnpm test --watch
144
144
  ```
145
-
146
- ## License
147
-
148
- Elastic-2.0
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import zodToJsonSchemaOriginal from 'zod-to-json-schema';
3
+
4
+ // src/zod-to-json.ts
5
+ function zodToJsonSchema(zodSchema, target = "jsonSchema7") {
6
+ const fn = "toJSONSchema";
7
+ if (fn in z) {
8
+ return z[fn](zodSchema, {
9
+ unrepresentable: "any",
10
+ override: (ctx) => {
11
+ const def = ctx.zodSchema?._zod?.def;
12
+ if (def && def.type === "date") {
13
+ ctx.jsonSchema.type = "string";
14
+ ctx.jsonSchema.format = "date-time";
15
+ }
16
+ }
17
+ });
18
+ } else {
19
+ return zodToJsonSchemaOriginal(zodSchema, {
20
+ $refStrategy: "none",
21
+ target
22
+ });
23
+ }
24
+ }
25
+
26
+ export { zodToJsonSchema };
27
+ //# sourceMappingURL=chunk-F4D2N3FC.js.map
28
+ //# sourceMappingURL=chunk-F4D2N3FC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/zod-to-json.ts"],"names":[],"mappings":";;;;AAOO,SAAS,eAAA,CAAgB,SAAA,EAAsC,MAAA,GAAkB,aAAA,EAAe;AACrG,EAAA,MAAM,EAAA,GAAK,cAAA;AAEX,EAAA,IAAI,MAAM,CAAA,EAAG;AAEX,IAAA,OAAQ,CAAA,CAAU,EAAE,CAAA,CAAE,SAAA,EAAW;AAAA,MAC/B,eAAA,EAAiB,KAAA;AAAA,MACjB,QAAA,EAAU,CAAC,GAAA,KAAa;AAEtB,QAAA,MAAM,GAAA,GAAM,GAAA,CAAI,SAAA,EAAW,IAAA,EAAM,GAAA;AACjC,QAAA,IAAI,GAAA,IAAO,GAAA,CAAI,IAAA,KAAS,MAAA,EAAQ;AAC9B,UAAA,GAAA,CAAI,WAAW,IAAA,GAAO,QAAA;AACtB,UAAA,GAAA,CAAI,WAAW,MAAA,GAAS,WAAA;AAAA,QAC1B;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAA,OAAO,wBAAwB,SAAA,EAA0B;AAAA,MACvD,YAAA,EAAc,MAAA;AAAA,MACd;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-F4D2N3FC.js","sourcesContent":["import type { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport type { ZodSchema as ZodSchemaV3 } from 'zod/v3';\nimport type { ZodType as ZodSchemaV4 } from 'zod/v4';\nimport type { Targets } from 'zod-to-json-schema';\nimport zodToJsonSchemaOriginal from 'zod-to-json-schema';\n\nexport function zodToJsonSchema(zodSchema: ZodSchemaV3 | ZodSchemaV4, target: Targets = 'jsonSchema7') {\n const fn = 'toJSONSchema';\n\n if (fn in z) {\n // Use dynamic property access to avoid import errors in Zod v3\n return (z as any)[fn](zodSchema, {\n unrepresentable: 'any',\n override: (ctx: any) => {\n // Safe access to handle cases where _zod might be undefined\n const def = ctx.zodSchema?._zod?.def;\n if (def && def.type === 'date') {\n ctx.jsonSchema.type = 'string';\n ctx.jsonSchema.format = 'date-time';\n }\n },\n }) as JSONSchema7;\n } else {\n return zodToJsonSchemaOriginal(zodSchema as ZodSchemaV3, {\n $refStrategy: 'none',\n target,\n }) as JSONSchema7;\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+ var zodToJsonSchemaOriginal = require('zod-to-json-schema');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var zodToJsonSchemaOriginal__default = /*#__PURE__*/_interopDefault(zodToJsonSchemaOriginal);
9
+
10
+ // src/zod-to-json.ts
11
+ function zodToJsonSchema(zodSchema, target = "jsonSchema7") {
12
+ const fn = "toJSONSchema";
13
+ if (fn in zod.z) {
14
+ return zod.z[fn](zodSchema, {
15
+ unrepresentable: "any",
16
+ override: (ctx) => {
17
+ const def = ctx.zodSchema?._zod?.def;
18
+ if (def && def.type === "date") {
19
+ ctx.jsonSchema.type = "string";
20
+ ctx.jsonSchema.format = "date-time";
21
+ }
22
+ }
23
+ });
24
+ } else {
25
+ return zodToJsonSchemaOriginal__default.default(zodSchema, {
26
+ $refStrategy: "none",
27
+ target
28
+ });
29
+ }
30
+ }
31
+
32
+ exports.zodToJsonSchema = zodToJsonSchema;
33
+ //# sourceMappingURL=chunk-WRGSGOLQ.cjs.map
34
+ //# sourceMappingURL=chunk-WRGSGOLQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/zod-to-json.ts"],"names":["z","zodToJsonSchemaOriginal"],"mappings":";;;;;;;;;;AAOO,SAAS,eAAA,CAAgB,SAAA,EAAsC,MAAA,GAAkB,aAAA,EAAe;AACrG,EAAA,MAAM,EAAA,GAAK,cAAA;AAEX,EAAA,IAAI,MAAMA,KAAA,EAAG;AAEX,IAAA,OAAQA,KAAA,CAAU,EAAE,CAAA,CAAE,SAAA,EAAW;AAAA,MAC/B,eAAA,EAAiB,KAAA;AAAA,MACjB,QAAA,EAAU,CAAC,GAAA,KAAa;AAEtB,QAAA,MAAM,GAAA,GAAM,GAAA,CAAI,SAAA,EAAW,IAAA,EAAM,GAAA;AACjC,QAAA,IAAI,GAAA,IAAO,GAAA,CAAI,IAAA,KAAS,MAAA,EAAQ;AAC9B,UAAA,GAAA,CAAI,WAAW,IAAA,GAAO,QAAA;AACtB,UAAA,GAAA,CAAI,WAAW,MAAA,GAAS,WAAA;AAAA,QAC1B;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAA,OAAOC,yCAAwB,SAAA,EAA0B;AAAA,MACvD,YAAA,EAAc,MAAA;AAAA,MACd;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-WRGSGOLQ.cjs","sourcesContent":["import type { JSONSchema7 } from 'json-schema';\nimport { z } from 'zod';\nimport type { ZodSchema as ZodSchemaV3 } from 'zod/v3';\nimport type { ZodType as ZodSchemaV4 } from 'zod/v4';\nimport type { Targets } from 'zod-to-json-schema';\nimport zodToJsonSchemaOriginal from 'zod-to-json-schema';\n\nexport function zodToJsonSchema(zodSchema: ZodSchemaV3 | ZodSchemaV4, target: Targets = 'jsonSchema7') {\n const fn = 'toJSONSchema';\n\n if (fn in z) {\n // Use dynamic property access to avoid import errors in Zod v3\n return (z as any)[fn](zodSchema, {\n unrepresentable: 'any',\n override: (ctx: any) => {\n // Safe access to handle cases where _zod might be undefined\n const def = ctx.zodSchema?._zod?.def;\n if (def && def.type === 'date') {\n ctx.jsonSchema.type = 'string';\n ctx.jsonSchema.format = 'date-time';\n }\n },\n }) as JSONSchema7;\n } else {\n return zodToJsonSchemaOriginal(zodSchema as ZodSchemaV3, {\n $refStrategy: 'none',\n target,\n }) as JSONSchema7;\n }\n}\n"]}