@inixiative/json-rules 2.19.1 → 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 +10 -5
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -516,15 +516,20 @@ 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
|
|
520
|
-
boundary is not something a NULL column satisfies, so `check()`
|
|
521
|
-
ordinary non-match (honoring `error`)
|
|
522
|
-
|
|
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:
|
|
523
526
|
`{ any: [{ field, operator: 'notExists' }, { field, dateOperator: 'before', … }] }`.
|
|
524
527
|
|
|
525
528
|
| Rule | `check()` on `{ col: null }` | `toSql()` | `toPrisma()` |
|
|
526
529
|
| --- | --- | --- | --- |
|
|
527
|
-
|
|
|
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) |
|
|
528
533
|
| `notExists` OR `before` | matches via the first arm | `(col IS NULL OR col < $1)` | `{ OR: [{ col: { equals: null } }, { col: { lt: … } }] }` |
|
|
529
534
|
|
|
530
535
|
`0` is an instant (1970-01-01) and compares; `''` is malformed data and raises
|