@mastra/schema-compat 0.0.0-fix-message-list-args-missing-20250807205055 → 0.0.0-vector-query-tool-provider-options-20250828222356

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 (67) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +54 -1
  3. package/README.md +0 -4
  4. package/dist/chunk-MKYBUMTK.js +27 -0
  5. package/dist/chunk-MKYBUMTK.js.map +1 -0
  6. package/dist/chunk-V7Y3FXBJ.cjs +33 -0
  7. package/dist/chunk-V7Y3FXBJ.cjs.map +1 -0
  8. package/dist/index.cjs +842 -83
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +10 -8
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +841 -84
  13. package/dist/index.js.map +1 -1
  14. package/dist/provider-compats/anthropic.d.ts +6 -4
  15. package/dist/provider-compats/anthropic.d.ts.map +1 -1
  16. package/dist/provider-compats/deepseek.d.ts +6 -4
  17. package/dist/provider-compats/deepseek.d.ts.map +1 -1
  18. package/dist/provider-compats/google.d.ts +6 -4
  19. package/dist/provider-compats/google.d.ts.map +1 -1
  20. package/dist/provider-compats/meta.d.ts +6 -4
  21. package/dist/provider-compats/meta.d.ts.map +1 -1
  22. package/dist/provider-compats/openai-reasoning.d.ts +6 -4
  23. package/dist/provider-compats/openai-reasoning.d.ts.map +1 -1
  24. package/dist/provider-compats/openai.d.ts +6 -4
  25. package/dist/provider-compats/openai.d.ts.map +1 -1
  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 +76 -133
  31. package/dist/schema-compatibility.d.ts.map +1 -1
  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 +17 -5
  37. package/dist/utils.d.ts.map +1 -1
  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 +16 -6
  47. package/src/index.ts +4 -3
  48. package/src/provider-compats/anthropic.ts +29 -11
  49. package/src/provider-compats/deepseek.ts +14 -9
  50. package/src/provider-compats/google.ts +18 -32
  51. package/src/provider-compats/meta.ts +15 -10
  52. package/src/provider-compats/openai-reasoning.ts +18 -24
  53. package/src/provider-compats/openai.ts +22 -12
  54. package/src/schema-compatibility-v3.ts +664 -0
  55. package/src/schema-compatibility-v4.test.ts +476 -0
  56. package/src/schema-compatibility-v4.ts +706 -0
  57. package/src/schema-compatibility.test.ts +12 -28
  58. package/src/schema-compatibility.ts +262 -385
  59. package/src/types.ts +5 -0
  60. package/src/utils-test-suite.ts +467 -0
  61. package/src/utils-v3.test.ts +9 -0
  62. package/src/utils-v4.test.ts +9 -0
  63. package/src/utils.ts +30 -24
  64. package/src/zod-to-json.ts +28 -0
  65. package/src/zodTypes.ts +56 -0
  66. package/tsup.config.ts +8 -3
  67. package/src/utils.test.ts +0 -460
@@ -1,8 +1,8 @@
1
1
  import { MockLanguageModelV1 } from 'ai/test';
2
2
  import { describe, it, expect, beforeEach } from 'vitest';
3
- import { z } from 'zod';
4
- import type { ModelInformation } from './schema-compatibility';
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
8
  constructor(model: ModelInformation) {
@@ -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 {
@@ -45,20 +45,12 @@ describe('SchemaCompatLayer', () => {
45
45
  let compatibility: MockSchemaCompatibility;
46
46
 
47
47
  beforeEach(() => {
48
- compatibility = new MockSchemaCompatibility({
49
- modelId: mockModel.modelId,
50
- supportsStructuredOutputs: mockModel.supportsStructuredOutputs ?? false,
51
- provider: mockModel.provider,
52
- });
48
+ compatibility = new MockSchemaCompatibility(mockModel);
53
49
  });
54
50
 
55
51
  describe('constructor and getModel', () => {
56
52
  it('should store and return the model', () => {
57
- expect(compatibility.getModel()).toEqual({
58
- modelId: mockModel.modelId,
59
- supportsStructuredOutputs: mockModel.supportsStructuredOutputs ?? false,
60
- provider: mockModel.provider,
61
- });
53
+ expect(compatibility.getModel()).toBe(mockModel);
62
54
  });
63
55
  });
64
56
 
@@ -359,11 +351,7 @@ describe('SchemaCompatLayer', () => {
359
351
  }
360
352
  }
361
353
 
362
- const testCompat = new TestCompatibility({
363
- modelId: mockModel.modelId,
364
- supportsStructuredOutputs: mockModel.supportsStructuredOutputs ?? false,
365
- provider: mockModel.provider,
366
- });
354
+ const testCompat = new TestCompatibility(mockModel);
367
355
  const result = testCompat.defaultZodOptionalHandler(optionalSchema);
368
356
 
369
357
  expect(result._def.typeName).toBe('ZodOptional');
@@ -412,11 +400,7 @@ describe('SchemaCompatLayer', () => {
412
400
  return super.processZodType(value);
413
401
  }
414
402
  }
415
- const preservingCompat = new PreservingMock({
416
- modelId: mockModel.modelId,
417
- supportsStructuredOutputs: mockModel.supportsStructuredOutputs ?? false,
418
- provider: mockModel.provider,
419
- });
403
+ const preservingCompat = new PreservingMock(mockModel);
420
404
  const preservingResult = preservingCompat.processToAISDKSchema(arraySchema);
421
405
  expect(preservingResult.jsonSchema.description).toBeUndefined();
422
406
  expect(