@mastra/schema-compat 1.3.1 → 1.3.2-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 1.3.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix inverted date constraint descriptions in the Zod v4 schema handler. `z.date().min()` and `z.date().max()` were described with their bounds swapped (a lower bound was labelled "older than" and an upper bound "newer than"), so the schema sent to the model stated the opposite and impossible constraint. The handler now matches Zod semantics and the existing v3 handler. Closes #18581. ([#18582](https://github.com/mastra-ai/mastra/pull/18582))
8
+
9
+ - Fixed 'Type instantiation is excessively deep' (TS2589) errors that occurred when defining workflows with Zod schemas. Workflow and step type inference is now significantly faster and no longer causes TypeScript to crash or report depth errors. ([#18608](https://github.com/mastra-ai/mastra/pull/18608))
10
+
3
11
  ## 1.3.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -4499,18 +4499,20 @@ var SchemaCompatLayer2 = class {
4499
4499
  if (checks) {
4500
4500
  for (const check of checks) {
4501
4501
  switch (check._zod.def.check) {
4502
+ // `.max(d)` lowers the upper bound, stored as a `less_than` check: the date must be older than `d`.
4502
4503
  case "less_than":
4503
- const minDate = new Date(check._zod.def.value);
4504
- if (!isNaN(minDate.getTime())) {
4505
- constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
4506
- }
4507
- break;
4508
- case "greater_than":
4509
4504
  const maxDate = new Date(check._zod.def.value);
4510
4505
  if (!isNaN(maxDate.getTime())) {
4511
4506
  constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);
4512
4507
  }
4513
4508
  break;
4509
+ // `.min(d)` raises the lower bound, stored as a `greater_than` check: the date must be newer than `d`.
4510
+ case "greater_than":
4511
+ const minDate = new Date(check._zod.def.value);
4512
+ if (!isNaN(minDate.getTime())) {
4513
+ constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
4514
+ }
4515
+ break;
4514
4516
  }
4515
4517
  }
4516
4518
  }