@inixiative/json-rules 2.19.7 → 2.20.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/README.md +8 -0
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -534,6 +534,13 @@ compilers carry NULL rows explicitly:
|
|
|
534
534
|
| `equals` / `notEquals` with `path: '$.other'` | `null === null` | `IS [NOT] DISTINCT FROM` | — |
|
|
535
535
|
| `exists` / `notExists` | `!= null` / `== null` | `IS NOT NULL` / `IS NULL` | `{ not: null }` / `{ equals: null }` |
|
|
536
536
|
|
|
537
|
+
The **absent set** of a path is wider than a NULL leaf: an optional to-one hop can be NULL too,
|
|
538
|
+
and `{ rel: { col: { equals: null } } }` only matches when the relation exists. So every negation
|
|
539
|
+
also carries `{ rel: { is: null } }` for each optional to-one hop on the path (licensed by the
|
|
540
|
+
relation entry's `isRequired: false`) — `profile.bio notEquals 'x'` compiles to
|
|
541
|
+
`{ OR: [{ profile: { bio: { not: 'x' } } }, { profile: { bio: { equals: null } } }, { profile: { is: null } }] }`,
|
|
542
|
+
matching check() (a missing hop reads as `undefined`) and toSql (LEFT JOIN + `IS NULL`).
|
|
543
|
+
|
|
537
544
|
`toPrisma()` can only add the null arm when it knows the column is nullable —
|
|
538
545
|
an `equals: null` on a NOT NULL column is a Prisma validation error. Nullability
|
|
539
546
|
comes from the field map: `FieldMapEntry.isRequired: false` (prisma-map emits it).
|
|
@@ -807,6 +814,7 @@ Composition across chained narrowings is pure intersection. `where` clauses are
|
|
|
807
814
|
| --- | --- |
|
|
808
815
|
| `validateNarrowing(narrowing)` | Throws on structural or chain violations (incl. unresolvable `where` paths and items invisible from ancestors). Call at narrowing construction. |
|
|
809
816
|
| `projectByPath(lens)` | Returns `Map<dottedPath, ProjectedVisit>` — each declared path keys its own resolved narrowing (path picks/omits/enums chain-intersected ∩ `mapDefaults` for the target model). Sibling paths to the same model stay independent. Use for SDK-contract / OpenAPI emission, search-field enumeration, validation whitelists. See [docs/LENS.md §10](./docs/LENS.md). |
|
|
817
|
+
| `ruleSourceValues(lens, rule)` | The values a rule names at each source the lens declares, keyed like `projectByPath` (`path` + `field`, with the source's `mapName` / `model`). Resolved via `walkLensPath`, so `mapDefaults` sources answer wherever their model appears. `dynamic: true` when the set can't be enumerated: a `path` / `bind` leaf, a substring / pattern / range / window operator, or an operator the catalog doesn't know — callers fail closed on it. The reverse question for a reference registry ("which rows does this rule name") — join `model` + `values`. |
|
|
810
818
|
| `checkRuleAgainstLens(rule, lens)` | Validates a user rule's field paths and enum values against the narrowed lens, path-aware. Returns `{ ok, violations }`. The security gate. |
|
|
811
819
|
| `applyLens(rule, narrowing)` | Composes the user rule with the lens's `where` clauses, injecting each at its anchor in the rule tree. Pass the result to `check` / `toPrisma` / `toSql`. |
|
|
812
820
|
|