@inixiative/json-rules 4.5.1 → 4.6.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 +13 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -801,6 +801,19 @@ null check (`equals null`, `in` with null among its values), so a rule checked t
|
|
|
801
801
|
on what the row carries. A null check holds on every row without a value, which is how a rule ends
|
|
802
802
|
up granting everything; name the value that is there instead (a kind, an explicit `'none'`).
|
|
803
803
|
|
|
804
|
+
With `rowKey` (the column every row carries, `id`), a null check is accepted where an `exists` on
|
|
805
|
+
its own row's key sits beside it in an `all`: the row is there, so a null read is an empty column
|
|
806
|
+
as long as the row came back with its columns (the gate proves the row, not the projection). The key is
|
|
807
|
+
of the row the column is read on (`org.id` for `org.deletedAt`), another column of the row does not
|
|
808
|
+
stand in for it, and a null check without it is refused (`nullCheckWithoutRowKey`):
|
|
809
|
+
|
|
810
|
+
```ts
|
|
811
|
+
validateRule(
|
|
812
|
+
{ all: [{ field: 'id', operator: 'exists' }, { field: 'role', operator: 'equals', value: null }] },
|
|
813
|
+
{ positive: true, rowKey: 'id' },
|
|
814
|
+
);
|
|
815
|
+
```
|
|
816
|
+
|
|
804
817
|
It also refuses a match without an `exists`: a field compared with a `path` or a `bind` needs an
|
|
805
818
|
`exists` on it beside it in an `all`, because two missing values match (`ownerId equals
|
|
806
819
|
actor:User.id` holds on a record with no owner and a call with no actor). A comparison with a
|