@mastra/schema-compat 0.10.5 → 0.10.6-alpha.1
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/.turbo/turbo-build.log +2 -21
- package/CHANGELOG.md +47 -0
- package/README.md +0 -4
- package/dist/chunk-FTKGHMGD.js +27 -0
- package/dist/chunk-FTKGHMGD.js.map +1 -0
- package/dist/chunk-LNR4XKDU.cjs +33 -0
- package/dist/chunk-LNR4XKDU.cjs.map +1 -0
- package/dist/index.cjs +845 -84
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +844 -85
- package/dist/index.js.map +1 -0
- package/dist/provider-compats/anthropic.d.ts +13 -0
- package/dist/provider-compats/anthropic.d.ts.map +1 -0
- package/dist/provider-compats/deepseek.d.ts +13 -0
- package/dist/provider-compats/deepseek.d.ts.map +1 -0
- package/dist/provider-compats/google.d.ts +13 -0
- package/dist/provider-compats/google.d.ts.map +1 -0
- package/dist/provider-compats/meta.d.ts +13 -0
- package/dist/provider-compats/meta.d.ts.map +1 -0
- package/dist/provider-compats/openai-reasoning.d.ts +14 -0
- package/dist/provider-compats/openai-reasoning.d.ts.map +1 -0
- package/dist/provider-compats/openai.d.ts +13 -0
- package/dist/provider-compats/openai.d.ts.map +1 -0
- package/dist/schema-compatibility-v3.d.ts +319 -0
- package/dist/schema-compatibility-v3.d.ts.map +1 -0
- package/dist/schema-compatibility-v4.d.ts +310 -0
- package/dist/schema-compatibility-v4.d.ts.map +1 -0
- package/dist/schema-compatibility.d.ts +228 -0
- package/dist/schema-compatibility.d.ts.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils-test-suite.d.ts +2 -0
- package/dist/utils-test-suite.d.ts.map +1 -0
- package/dist/utils.d.ts +96 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/zod-to-json.cjs +12 -0
- package/dist/zod-to-json.cjs.map +1 -0
- package/dist/zod-to-json.d.ts +6 -0
- package/dist/zod-to-json.d.ts.map +1 -0
- package/dist/zod-to-json.js +3 -0
- package/dist/zod-to-json.js.map +1 -0
- package/dist/zodTypes.d.ts +21 -0
- package/dist/zodTypes.d.ts.map +1 -0
- package/package.json +19 -8
- package/src/index.ts +4 -3
- package/src/provider-compats/anthropic.ts +30 -13
- package/src/provider-compats/deepseek.ts +15 -10
- package/src/provider-compats/google.ts +19 -33
- package/src/provider-compats/meta.ts +16 -11
- package/src/provider-compats/openai-reasoning.ts +24 -26
- package/src/provider-compats/openai.ts +23 -14
- package/src/provider-compats.test.ts +120 -25
- package/src/schema-compatibility-v3.ts +664 -0
- package/src/schema-compatibility-v4.test.ts +476 -0
- package/src/schema-compatibility-v4.ts +706 -0
- package/src/schema-compatibility.test.ts +9 -9
- package/src/schema-compatibility.ts +266 -383
- package/src/types.ts +5 -0
- package/src/utils-test-suite.ts +467 -0
- package/src/utils-v3.test.ts +9 -0
- package/src/utils-v4.test.ts +9 -0
- package/src/utils.ts +30 -24
- package/src/zod-to-json.ts +27 -0
- package/src/zodTypes.ts +56 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +22 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -507
- package/dist/_tsup-dts-rollup.d.ts +0 -507
- package/dist/index.d.cts +0 -31
- package/src/utils.test.ts +0 -434
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/schema-compat@0.10.
|
|
3
|
-
> tsup
|
|
2
|
+
> @mastra/schema-compat@0.10.6-alpha.1 build /home/runner/work/mastra/mastra/packages/schema-compat
|
|
3
|
+
> tsup --silent --config tsup.config.ts
|
|
4
4
|
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.0
|
|
8
|
-
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in 2195ms
|
|
10
|
-
[34mDTS[39m Build start
|
|
11
|
-
Analysis will use the bundled TypeScript version 5.8.3
|
|
12
|
-
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.ts[39m
|
|
13
|
-
Analysis will use the bundled TypeScript version 5.8.3
|
|
14
|
-
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/schema-compat/dist/_tsup-dts-rollup.d.cts[39m
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in 1946ms
|
|
16
|
-
[34mCLI[39m Target: es2022
|
|
17
|
-
[34mCLI[39m Cleaning output folder
|
|
18
|
-
[34mESM[39m Build start
|
|
19
|
-
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[32m21.14 KB[39m
|
|
21
|
-
[32mESM[39m ⚡️ Build success in 140ms
|
|
22
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m21.76 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in 139ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @mastra/schema-compat
|
|
2
2
|
|
|
3
|
+
## 0.10.6-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
## 0.10.6-alpha.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
15
|
+
- [#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
|
|
16
|
+
|
|
17
|
+
## 0.10.7
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- dd94a26: Dont rely on the full language model for schema compat
|
|
22
|
+
- 2fff911: Fix vnext working memory tool schema when model is incompatible with schema
|
|
23
|
+
- ae2eb63: Handle regex checks better, return description as a string rather than an object with pattern and flags.
|
|
24
|
+
|
|
25
|
+
## 0.10.7-alpha.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- ae2eb63: Handle regex checks better, return description as a string rather than an object with pattern and flags.
|
|
30
|
+
|
|
31
|
+
## 0.10.7-alpha.0
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- dd94a26: Dont rely on the full language model for schema compat
|
|
36
|
+
- 2fff911: Fix vnext working memory tool schema when model is incompatible with schema
|
|
37
|
+
|
|
38
|
+
## 0.10.6
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
|
|
43
|
+
|
|
44
|
+
## 0.10.6-alpha.0
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
|
|
49
|
+
|
|
3
50
|
## 0.10.5
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
if ("toJSONSchema" in z) {
|
|
7
|
+
return z.toJSONSchema(zodSchema, {
|
|
8
|
+
unrepresentable: "any",
|
|
9
|
+
override: (ctx) => {
|
|
10
|
+
const def = ctx.zodSchema._zod.def;
|
|
11
|
+
if (def.type === "date") {
|
|
12
|
+
ctx.jsonSchema.type = "string";
|
|
13
|
+
ctx.jsonSchema.format = "date-time";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
return zodToJsonSchemaOriginal(zodSchema, {
|
|
19
|
+
$refStrategy: "none",
|
|
20
|
+
target
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { zodToJsonSchema };
|
|
26
|
+
//# sourceMappingURL=chunk-FTKGHMGD.js.map
|
|
27
|
+
//# sourceMappingURL=chunk-FTKGHMGD.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,IAAI,kBAAkB,CAAA,EAAG;AAEvB,IAAA,OAAO,CAAA,CAAE,aAAa,SAAA,EAAW;AAAA,MAC/B,eAAA,EAAiB,KAAA;AAAA,MACjB,QAAA,EAAU,CAAC,GAAA,KAAa;AACtB,QAAA,MAAM,GAAA,GAAM,GAAA,CAAI,SAAA,CAAU,IAAA,CAAK,GAAA;AAC/B,QAAA,IAAI,GAAA,CAAI,SAAS,MAAA,EAAQ;AACvB,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-FTKGHMGD.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 if ('toJSONSchema' in z) {\n // @ts-expect-error - type not present main zod v3\n return z.toJSONSchema(zodSchema, {\n unrepresentable: 'any',\n override: (ctx: any) => {\n const def = ctx.zodSchema._zod.def;\n if (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,33 @@
|
|
|
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
|
+
if ("toJSONSchema" in zod.z) {
|
|
13
|
+
return zod.z.toJSONSchema(zodSchema, {
|
|
14
|
+
unrepresentable: "any",
|
|
15
|
+
override: (ctx) => {
|
|
16
|
+
const def = ctx.zodSchema._zod.def;
|
|
17
|
+
if (def.type === "date") {
|
|
18
|
+
ctx.jsonSchema.type = "string";
|
|
19
|
+
ctx.jsonSchema.format = "date-time";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
return zodToJsonSchemaOriginal__default.default(zodSchema, {
|
|
25
|
+
$refStrategy: "none",
|
|
26
|
+
target
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.zodToJsonSchema = zodToJsonSchema;
|
|
32
|
+
//# sourceMappingURL=chunk-LNR4XKDU.cjs.map
|
|
33
|
+
//# sourceMappingURL=chunk-LNR4XKDU.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,IAAI,kBAAkBA,KAAA,EAAG;AAEvB,IAAA,OAAOA,KAAA,CAAE,aAAa,SAAA,EAAW;AAAA,MAC/B,eAAA,EAAiB,KAAA;AAAA,MACjB,QAAA,EAAU,CAAC,GAAA,KAAa;AACtB,QAAA,MAAM,GAAA,GAAM,GAAA,CAAI,SAAA,CAAU,IAAA,CAAK,GAAA;AAC/B,QAAA,IAAI,GAAA,CAAI,SAAS,MAAA,EAAQ;AACvB,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-LNR4XKDU.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 if ('toJSONSchema' in z) {\n // @ts-expect-error - type not present main zod v3\n return z.toJSONSchema(zodSchema, {\n unrepresentable: 'any',\n override: (ctx: any) => {\n const def = ctx.zodSchema._zod.def;\n if (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"]}
|