@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/dist/index.js 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
  }