@inixiative/json-rules 2.21.0 → 2.22.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 CHANGED
@@ -356,9 +356,17 @@ format grows a node type, and it goes blind silently.
356
356
 
357
357
  | Function | Purpose |
358
358
  | --- | --- |
359
- | `requiredBindings(rule)` | Names of every `{ bind }` token in the tree — the set a bindings map must cover. |
359
+ | `requiredBindings(rule)` | Names a bindings map must cover — every `{ bind }` token not marked `bindOptional`. A name optional at one leaf and required at another is required. |
360
+ | `bindingNames(rule)` | Every `{ bind }` name in the tree, optional or not — what a lens declares. |
360
361
  | `resolveBindings(rule, bindings)` | Substitutes covered binds with their values, leaving uncovered tokens in place (partial resolution). |
361
362
 
363
+ A leaf may mark its bind optional: `{ field, operator, bind: 'region', bindOptional: true }`. An
364
+ unsupplied required bind is a caller bug — `check()` throws, and both compilers refuse a
365
+ surviving token. An unsupplied *optional* bind is `null` wherever absence is final: `check()`
366
+ compares against `null`, `toPrisma` / `toSql` compile the token as `null`. The rule is evaluated
367
+ as written — the leaf is never pruned, so `in {{bind}}` with nothing bound matches nothing rather
368
+ than everything.
369
+
362
370
 
363
371
  ## Runtime Validation
364
372