@inixiative/json-rules 2.19.0 → 2.19.2

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/README.md CHANGED
@@ -516,8 +516,24 @@ comes from the field map: `FieldMapEntry.isRequired: false` (prisma-map emits it
516
516
  Without `{ map, model }`, or on an entry that doesn't declare it, the bare
517
517
  `not` / `notIn` is emitted and NULL rows fall out, as they always did.
518
518
 
519
- Date rules are unaffected: `check()` throws on a NULL date column rather than
520
- answering, and the compilers keep the bare `NOT BETWEEN`.
519
+ Date rules follow the same split. The positive operators answer non-match on both
520
+ rails a bare boundary is not something a NULL column satisfies, so `check()`
521
+ reports the rule's ordinary non-match (honoring `error`) and the compilers keep the
522
+ bare `<` / `BETWEEN`. The negative-flavored ones (`notBetween`, `dayNotIn`) follow
523
+ the negation ruling instead: a never-set date is not in the range, so a null column
524
+ MATCHES, and the compilers carry the `IS NULL` arm. To match never-seen rows under a
525
+ positive operator, ask for them:
526
+ `{ any: [{ field, operator: 'notExists' }, { field, dateOperator: 'before', … }] }`.
527
+
528
+ | Rule | `check()` on `{ col: null }` | `toSql()` | `toPrisma()` |
529
+ | --- | --- | --- | --- |
530
+ | positive `dateOperator` (`before`, `between`, `dayIn`, …) | no match | `col < $1` (NULL never satisfies) | `{ col: { lt: … } }` |
531
+ | `notBetween` | matches | `(col NOT BETWEEN $1 AND $2 OR col IS NULL)` | `{ OR: [{ col: { NOT: … } }, { col: { equals: null } }] }` (nullable column, same field-map licensing as above) |
532
+ | `dayNotIn` | matches | `(EXTRACT(DOW FROM col) <> ALL($1) OR col IS NULL)` | — (no Prisma output) |
533
+ | `notExists` OR `before` | matches via the first arm | `(col IS NULL OR col < $1)` | `{ OR: [{ col: { equals: null } }, { col: { lt: … } }] }` |
534
+
535
+ `0` is an instant (1970-01-01) and compares; `''` is malformed data and raises
536
+ `"is not a valid date"`.
521
537
 
522
538
  ### Prisma Limitations
523
539