@inixiative/json-rules 4.1.0 → 4.2.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 +5 -4
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -47
- package/dist/index.d.ts +182 -47
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -641,7 +641,7 @@ An enum compares exactly against its declared values. String, pattern and ordere
|
|
|
641
641
|
don't apply to one, and the compilers refuse them. A case-insensitive equality or membership, or
|
|
642
642
|
one naming a value the enum doesn't declare, compiles to a membership test over the declared
|
|
643
643
|
values `check()` would match (plus the NULL arm for a negation). The field map must list the
|
|
644
|
-
values (
|
|
644
|
+
values (field-map's Prisma reader does).
|
|
645
645
|
|
|
646
646
|
```ts
|
|
647
647
|
// map: { models: { U: { fields: { role: { kind: 'enum', type: 'Role' } } } }, enums: { Role: ['admin', 'member'] } }
|
|
@@ -1083,7 +1083,7 @@ and `in [null, …]` carry the same hop arms: a user with no profile has a NULL
|
|
|
1083
1083
|
|
|
1084
1084
|
`toPrisma()` can only add the null arm when it knows the column is nullable, because
|
|
1085
1085
|
an `equals: null` on a NOT NULL column is a Prisma validation error. Nullability
|
|
1086
|
-
comes from the field map: `FieldMapEntry.isRequired: false` (
|
|
1086
|
+
comes from the field map: `FieldMapEntry.isRequired: false` (field-map's Prisma reader emits it).
|
|
1087
1087
|
Without `{ map, model }`, or on an entry that doesn't declare it, the bare
|
|
1088
1088
|
`not` / `notIn` is emitted and NULL rows fall out.
|
|
1089
1089
|
|
|
@@ -1194,7 +1194,8 @@ Rules:
|
|
|
1194
1194
|
Lens & bridges:
|
|
1195
1195
|
|
|
1196
1196
|
- `Lens`, `LensNarrowing`, `ModelNarrowing`, `ModelDefaultNarrowing`, `NarrowingDefaults`, `EnumNarrowing`, `SourceSpec`, `SourceEntry`
|
|
1197
|
-
- `
|
|
1197
|
+
- `LensFieldMap`, `LensModelEntry`, `FieldMapEntry`, `BridgeEntry`, `SourceOption`, `FieldMapSet`, `Bridge`, `BridgeEndpoint`, `BridgeCardinality`, `BridgeDictionary` (the schema types themselves, `FieldMap` / `ModelEntry` / `FieldEntry`, are [`@inixiative/field-map`](https://github.com/inixiative/field-map)'s)
|
|
1198
|
+
- Typed spellings over a literal map (`typeof prismaMap`, as `field-map generate` writes it): `ConditionOn`, `ModelNarrowingOn`, `LensNarrowingOn`, `UncheckedPath`
|
|
1198
1199
|
- `createLens`, `storeLens`, `composeLens`, `StoredLens`, `stitchFieldMaps`, `indexBridges`, `validateFieldMaps`, `assertValidFieldMaps`
|
|
1199
1200
|
- `validateNarrowing`, `assertValidNarrowing`, `validateRuleInLens`, `narrowRule`, `coerceRule`
|
|
1200
1201
|
- `bindLens`, `listLensBindings`, `getLensRoot`, `clampLens`, `LensClamps`
|
|
@@ -1401,7 +1402,7 @@ The `Lens` primitive is a schema-aware view layer over one or more `FieldMap`s.
|
|
|
1401
1402
|
|
|
1402
1403
|
### FieldMap & FieldMapSet
|
|
1403
1404
|
|
|
1404
|
-
A `FieldMap` is `{ models, enums? }`: models keyed by name, plus an optional enum registry scoped to that source. A `FieldMapSet` groups one or more `FieldMap`s and declares the cross-source edges between them:
|
|
1405
|
+
A `FieldMap` is `{ models, enums? }`: models keyed by name, plus an optional enum registry scoped to that source. The type, the Prisma reader (`field-map generate`), the JSON Schema reader and the own-property readers are [`@inixiative/field-map`](https://github.com/inixiative/field-map)'s; json-rules reads a map as a `LensFieldMap` (a `FieldMap`, with its bridges stitched in and a projection's options). A `FieldMapSet` groups one or more `FieldMap`s and declares the cross-source edges between them:
|
|
1405
1406
|
|
|
1406
1407
|
```ts
|
|
1407
1408
|
import { stitchFieldMaps } from '@inixiative/json-rules';
|