@mastra/schema-compat 1.3.1 → 1.3.2-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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 1.3.2-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix the Zod v4 string handler silently dropping unrecognized `string_format` checks. Formats without a textual description (such as `ipv4`, `ipv6`, `datetime`, `date`, `time`, `base64`, `cuid2`, `ulid`, `nanoid`, `jwt`) are now preserved as validation instead of being removed, so schemas using them keep rejecting invalid input. Closes #18634. ([#18673](https://github.com/mastra-ai/mastra/pull/18673))
8
+
9
+ ## 1.3.2-alpha.0
10
+
11
+ ### Patch Changes
12
+
13
+ - 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))
14
+
15
+ - 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))
16
+
3
17
  ## 1.3.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -4406,6 +4406,9 @@ var SchemaCompatLayer2 = class {
4406
4406
  case "regex":
4407
4407
  constraints.push(`input must match this regex ${check._zod.def.pattern}`);
4408
4408
  break;
4409
+ default:
4410
+ newChecks.push(check);
4411
+ break;
4409
4412
  }
4410
4413
  }
4411
4414
  break;
@@ -4499,18 +4502,20 @@ var SchemaCompatLayer2 = class {
4499
4502
  if (checks) {
4500
4503
  for (const check of checks) {
4501
4504
  switch (check._zod.def.check) {
4505
+ // `.max(d)` lowers the upper bound, stored as a `less_than` check: the date must be older than `d`.
4502
4506
  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
4507
  const maxDate = new Date(check._zod.def.value);
4510
4508
  if (!isNaN(maxDate.getTime())) {
4511
4509
  constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);
4512
4510
  }
4513
4511
  break;
4512
+ // `.min(d)` raises the lower bound, stored as a `greater_than` check: the date must be newer than `d`.
4513
+ case "greater_than":
4514
+ const minDate = new Date(check._zod.def.value);
4515
+ if (!isNaN(minDate.getTime())) {
4516
+ constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);
4517
+ }
4518
+ break;
4514
4519
  }
4515
4520
  }
4516
4521
  }