@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.
Files changed (73) hide show
  1. package/.turbo/turbo-build.log +2 -21
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +0 -4
  4. package/dist/chunk-FTKGHMGD.js +27 -0
  5. package/dist/chunk-FTKGHMGD.js.map +1 -0
  6. package/dist/chunk-LNR4XKDU.cjs +33 -0
  7. package/dist/chunk-LNR4XKDU.cjs.map +1 -0
  8. package/dist/index.cjs +845 -84
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +11 -31
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +844 -85
  13. package/dist/index.js.map +1 -0
  14. package/dist/provider-compats/anthropic.d.ts +13 -0
  15. package/dist/provider-compats/anthropic.d.ts.map +1 -0
  16. package/dist/provider-compats/deepseek.d.ts +13 -0
  17. package/dist/provider-compats/deepseek.d.ts.map +1 -0
  18. package/dist/provider-compats/google.d.ts +13 -0
  19. package/dist/provider-compats/google.d.ts.map +1 -0
  20. package/dist/provider-compats/meta.d.ts +13 -0
  21. package/dist/provider-compats/meta.d.ts.map +1 -0
  22. package/dist/provider-compats/openai-reasoning.d.ts +14 -0
  23. package/dist/provider-compats/openai-reasoning.d.ts.map +1 -0
  24. package/dist/provider-compats/openai.d.ts +13 -0
  25. package/dist/provider-compats/openai.d.ts.map +1 -0
  26. package/dist/schema-compatibility-v3.d.ts +319 -0
  27. package/dist/schema-compatibility-v3.d.ts.map +1 -0
  28. package/dist/schema-compatibility-v4.d.ts +310 -0
  29. package/dist/schema-compatibility-v4.d.ts.map +1 -0
  30. package/dist/schema-compatibility.d.ts +228 -0
  31. package/dist/schema-compatibility.d.ts.map +1 -0
  32. package/dist/types.d.ts +6 -0
  33. package/dist/types.d.ts.map +1 -0
  34. package/dist/utils-test-suite.d.ts +2 -0
  35. package/dist/utils-test-suite.d.ts.map +1 -0
  36. package/dist/utils.d.ts +96 -0
  37. package/dist/utils.d.ts.map +1 -0
  38. package/dist/zod-to-json.cjs +12 -0
  39. package/dist/zod-to-json.cjs.map +1 -0
  40. package/dist/zod-to-json.d.ts +6 -0
  41. package/dist/zod-to-json.d.ts.map +1 -0
  42. package/dist/zod-to-json.js +3 -0
  43. package/dist/zod-to-json.js.map +1 -0
  44. package/dist/zodTypes.d.ts +21 -0
  45. package/dist/zodTypes.d.ts.map +1 -0
  46. package/package.json +19 -8
  47. package/src/index.ts +4 -3
  48. package/src/provider-compats/anthropic.ts +30 -13
  49. package/src/provider-compats/deepseek.ts +15 -10
  50. package/src/provider-compats/google.ts +19 -33
  51. package/src/provider-compats/meta.ts +16 -11
  52. package/src/provider-compats/openai-reasoning.ts +24 -26
  53. package/src/provider-compats/openai.ts +23 -14
  54. package/src/provider-compats.test.ts +120 -25
  55. package/src/schema-compatibility-v3.ts +664 -0
  56. package/src/schema-compatibility-v4.test.ts +476 -0
  57. package/src/schema-compatibility-v4.ts +706 -0
  58. package/src/schema-compatibility.test.ts +9 -9
  59. package/src/schema-compatibility.ts +266 -383
  60. package/src/types.ts +5 -0
  61. package/src/utils-test-suite.ts +467 -0
  62. package/src/utils-v3.test.ts +9 -0
  63. package/src/utils-v4.test.ts +9 -0
  64. package/src/utils.ts +30 -24
  65. package/src/zod-to-json.ts +27 -0
  66. package/src/zodTypes.ts +56 -0
  67. package/tsconfig.build.json +9 -0
  68. package/tsconfig.json +1 -1
  69. package/tsup.config.ts +22 -0
  70. package/dist/_tsup-dts-rollup.d.cts +0 -507
  71. package/dist/_tsup-dts-rollup.d.ts +0 -507
  72. package/dist/index.d.cts +0 -31
  73. package/src/utils.test.ts +0 -434
@@ -1,11 +1,11 @@
1
- import type { LanguageModelV1 } from 'ai';
2
1
  import { MockLanguageModelV1 } from 'ai/test';
3
2
  import { describe, it, expect, beforeEach } from 'vitest';
4
- import { z } from 'zod';
5
- import { isArr, isObj, isOptional, isString, isUnion, SchemaCompatLayer } from './schema-compatibility';
3
+ import { z } from 'zod/v3';
4
+ import { SchemaCompatLayer } from './schema-compatibility';
5
+ import type { ModelInformation } from './types';
6
6
 
7
7
  class MockSchemaCompatibility extends SchemaCompatLayer {
8
- constructor(model: LanguageModelV1) {
8
+ constructor(model: ModelInformation) {
9
9
  super(model);
10
10
  }
11
11
 
@@ -18,16 +18,16 @@ class MockSchemaCompatibility extends SchemaCompatLayer {
18
18
  }
19
19
 
20
20
  processZodType(value: z.ZodTypeAny): z.ZodTypeAny {
21
- if (isObj(value)) {
21
+ if (this.isObj(value)) {
22
22
  return this.defaultZodObjectHandler(value);
23
- } else if (isArr(value)) {
23
+ } else if (this.isArr(value)) {
24
24
  // For these tests, we will handle all checks by converting them to descriptions.
25
25
  return this.defaultZodArrayHandler(value, ['min', 'max', 'length']);
26
- } else if (isOptional(value)) {
26
+ } else if (this.isOptional(value)) {
27
27
  return this.defaultZodOptionalHandler(value);
28
- } else if (isUnion(value)) {
28
+ } else if (this.isUnion(value)) {
29
29
  return this.defaultZodUnionHandler(value);
30
- } else if (isString(value)) {
30
+ } else if (this.isString(value)) {
31
31
  // Add a marker to confirm it was processed
32
32
  return z.string().describe(`${value.description || 'string'}:processed`);
33
33
  } else {