foldkit-entity 0.14.0 → 0.16.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 +147 -5
- package/dist/collation.d.ts +33 -2
- package/dist/collation.d.ts.map +1 -0
- package/dist/conformance/index.d.ts +4 -4
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +5 -7
- package/dist/conformance/index.js.map +1 -1
- package/dist/conformance/operator.d.ts +1 -2
- package/dist/conformance/operator.d.ts.map +1 -1
- package/dist/conformance/operator.js +2 -6
- package/dist/conformance/operator.js.map +1 -1
- package/dist/conformance/relational.d.ts +17 -17
- package/dist/conformance/relational.d.ts.map +1 -1
- package/dist/conformance/relational.js +1 -3
- package/dist/conformance/relational.js.map +1 -1
- package/dist/conformance/variants.d.ts +47 -0
- package/dist/conformance/variants.d.ts.map +1 -0
- package/dist/conformance/variants.js +126 -0
- package/dist/conformance/variants.js.map +1 -0
- package/dist/context.d.ts +60 -2
- package/dist/context.d.ts.map +1 -0
- package/dist/descriptor.d.ts +33 -0
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +137 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/entity.d.ts +231 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/entity.js +436 -0
- package/dist/entity.js.map +1 -0
- package/dist/evaluate.d.ts +204 -2
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +51 -7
- package/dist/evaluate.js.map +1 -1
- package/dist/expr.d.ts +915 -2
- package/dist/expr.d.ts.map +1 -0
- package/dist/expr.js +50 -10
- package/dist/expr.js.map +1 -1
- package/dist/held.d.ts +112 -2
- package/dist/held.d.ts.map +1 -0
- package/dist/held.js +13 -2
- package/dist/held.js.map +1 -1
- package/dist/ids.d.ts +8 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +8 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +400 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -12
- package/dist/index.js.map +1 -0
- package/dist/invariant.d.ts +123 -2
- package/dist/invariant.d.ts.map +1 -0
- package/dist/invariant.js +236 -1
- package/dist/invariant.js.map +1 -0
- package/dist/law.d.ts +264 -2
- package/dist/law.d.ts.map +1 -0
- package/dist/law.js +1 -1
- package/dist/operators.d.ts +170 -2
- package/dist/operators.d.ts.map +1 -0
- package/dist/operators.js +3 -3
- package/dist/readFilter.d.ts +8 -2
- package/dist/readFilter.d.ts.map +1 -0
- package/dist/sets.d.ts +18 -2
- package/dist/sets.d.ts.map +1 -0
- package/dist/sets.js +1 -1
- package/dist/shape.d.ts +23 -2
- package/dist/shape.d.ts.map +1 -0
- package/dist/tested.d.ts +8 -2
- package/dist/tested.d.ts.map +1 -0
- package/dist/text.d.ts +27 -2
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +1 -1
- package/dist/variants.d.ts +72 -0
- package/dist/variants.d.ts.map +1 -0
- package/dist/variants.js +76 -0
- package/dist/variants.js.map +1 -0
- package/dist/words.d.ts +17 -2
- package/dist/words.d.ts.map +1 -0
- package/dist/write.d.ts +312 -2
- package/dist/write.d.ts.map +1 -0
- package/dist/write.js +3 -3
- package/package.json +3 -3
- package/dist/collation-BB4YTIbY.d.ts +0 -34
- package/dist/collation-BB4YTIbY.d.ts.map +0 -1
- package/dist/index-48JeXG0A.d.ts +0 -2585
- package/dist/index-48JeXG0A.d.ts.map +0 -1
- package/dist/readFilter-CWMnFRVw.d.ts +0 -9
- package/dist/readFilter-CWMnFRVw.d.ts.map +0 -1
- package/dist/shape-LAowRf9f.d.ts +0 -23
- package/dist/shape-LAowRf9f.d.ts.map +0 -1
- package/dist/src-DKhUqLoC.js +0 -731
- package/dist/src-DKhUqLoC.js.map +0 -1
- package/dist/words-a4e9o-TK.d.ts +0 -18
- package/dist/words-a4e9o-TK.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -194,6 +194,23 @@ Object.keys(Blog.Post.members) // id, title, published, author, editor, comments
|
|
|
194
194
|
names it.
|
|
195
195
|
- `target()` returns the related entity, so relations can be followed from
|
|
196
196
|
there, around a cycle too.
|
|
197
|
+
- `Relation.one(Post, { onDelete: 'cascade' })` says a row goes when the row
|
|
198
|
+
it points at is deleted: a comment with its post, a reply with the post it
|
|
199
|
+
answers. It is declared on the link the row holds, as its foreign key is,
|
|
200
|
+
and a `many` declares nothing. `Entity.cascading(Post)` lists every relation
|
|
201
|
+
that takes rows with a deleted post (`{ relation, owner }`), so Remote
|
|
202
|
+
removes those it holds while the delete is pending, counts and lists with
|
|
203
|
+
them, and `remote-drizzle`'s writer removes them where it deletes, on a store
|
|
204
|
+
without foreign keys too. `cascade` is the one action; `setNull` and
|
|
205
|
+
`restrict` are not declared yet (#348).
|
|
206
|
+
- Who may let a cascade take a row is said beside it. By default each row it
|
|
207
|
+
takes is held to its own `Delete` rule, for whoever deletes the row it
|
|
208
|
+
points at: a delete that would take a row they may not delete is refused
|
|
209
|
+
whole (Guard judges it, the writer holds it). `Relation.one(Post, {
|
|
210
|
+
onDelete: 'cascade', authorizedBy: 'parent' })` says whoever may delete the
|
|
211
|
+
post may take these rows with it, whoever wrote them: a post's author
|
|
212
|
+
removing everyone's likes of it. `authorizedBy` is said only beside
|
|
213
|
+
`onDelete`, and reads back as the relation's `authorizedBy`.
|
|
197
214
|
|
|
198
215
|
`Entity.relate` throws, and the types reject, a relation key that is already a
|
|
199
216
|
member, an owner that is not in the first argument, and a target that is not
|
|
@@ -732,7 +749,13 @@ A verdict is `Known` or `Unknown`. A known predicate's truth is SQL's three
|
|
|
732
749
|
values, its null decided (a row is not kept on it); unknown means the answer
|
|
733
750
|
rests on a field or row the holder lacks or may not see, or on an operator only
|
|
734
751
|
the server runs. What can decide anyway does: a null beside an unheld value,
|
|
735
|
-
`and`'s false, `or`'s true, an exists' held witness.
|
|
752
|
+
`and`'s false, `or`'s true, an exists' held witness. An exists is false only
|
|
753
|
+
where the holder's `pointing` says it misses no row: it is given what the
|
|
754
|
+
filter fixes (`Pinned`, each `eq` of a field and a literal, an input or the
|
|
755
|
+
viewer), so a holder that holds every row with those values (a client's list
|
|
756
|
+
of whom the viewer follows) can say so without holding every pointing row.
|
|
757
|
+
`Judge.pins(predicates, { input, context })` works out what a conjunction
|
|
758
|
+
fixes, and whether that is all it says. `Judge.query(…, {
|
|
736
759
|
serverOnly })` names a filter the server adds that the holder does not run. The
|
|
737
760
|
law, checked against SQL by `foldkit-entity/conformance`'s `relationalCases`:
|
|
738
761
|
where `Judge` knows, it is what the server answers.
|
|
@@ -782,6 +805,89 @@ relation.
|
|
|
782
805
|
Only the operations a real query in this repository needs exist. The set grows
|
|
783
806
|
from queries, not from what a database could express.
|
|
784
807
|
|
|
808
|
+
## Rows of several shapes: variants
|
|
809
|
+
|
|
810
|
+
> Experimental (#357): the Entity, its Selections and `Expr`. Remote's
|
|
811
|
+
> store, forms and guards read the stored row for now.
|
|
812
|
+
|
|
813
|
+
A domain search answers `Available`, with a price and a term, or
|
|
814
|
+
`Unconfirmed`, with neither. `Entity.defineVariants` declares that as one
|
|
815
|
+
Entity whose row is one of its cases, each case's fields by its tag, the shape
|
|
816
|
+
`Schema.TaggedUnion` takes:
|
|
817
|
+
|
|
818
|
+
```ts
|
|
819
|
+
const DomainName = { id: Schema.String, name: Schema.String }
|
|
820
|
+
const Domain = Entity.defineVariants('Domain', {
|
|
821
|
+
Available: { ...DomainName, price: Schema.Finite, years: Schema.Int },
|
|
822
|
+
Unconfirmed: DomainName,
|
|
823
|
+
})
|
|
824
|
+
|
|
825
|
+
// The row: Effect's tagged union of the cases, with its own `match`.
|
|
826
|
+
const priceOf = (row: typeof Domain.variants.Type) =>
|
|
827
|
+
Domain.variants.match(row, { Available: ({ price }) => price, Unconfirmed: () => 0 })
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
One Entity has two views of one row:
|
|
831
|
+
|
|
832
|
+
```text
|
|
833
|
+
row Domain.variants { _tag: 'Available', id, name, price, years }
|
|
834
|
+
| { _tag: 'Unconfirmed', id, name }
|
|
835
|
+
stored row Domain.fields { _tag, id, name, price | null, years | null }
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
- **The stored row** is what `fields` and `schema` describe: `_tag`, every
|
|
839
|
+
field all cases have as declared, and every other field nullable, since a
|
|
840
|
+
row of another case holds null there (a field whose stored form holds null
|
|
841
|
+
already, `Schema.OptionFromNullOr`, stays as it is). It is what every
|
|
842
|
+
interpreter reads, so a table, a Remote read and a form work as they do for
|
|
843
|
+
any Entity.
|
|
844
|
+
- **The row** is `Domain.variants`, branched on with its `match`, never by
|
|
845
|
+
reading which fields are null. `Entity.variantsOf(Domain)` holds the codec
|
|
846
|
+
between the two (`stored`): a stored row, encoded, decodes to its case, and
|
|
847
|
+
one holding another case's field is refused.
|
|
848
|
+
- **Each case says what it holds.** A case with fields of its own gets an
|
|
849
|
+
invariant (`variant_Available`: an Available holds `price` and `years`;
|
|
850
|
+
`variant_Unconfirmed`: an Unconfirmed holds none of them), so `Entity.judge`
|
|
851
|
+
and a form refuse a row that mixes cases, and `foldkit-remote-drizzle`
|
|
852
|
+
writes each as a CHECK.
|
|
853
|
+
|
|
854
|
+
A key in several cases is one stored field, so it is declared once and spread
|
|
855
|
+
into each, as `DomainName` is. Refused where declared: fewer than two cases, a
|
|
856
|
+
case declaring `_tag`, an optional key, and a key with two different schemas.
|
|
857
|
+
|
|
858
|
+
`Expr.is` narrows a predicate to a case. Given a function, it hands it the
|
|
859
|
+
case's fields typed as the case holds them, never null:
|
|
860
|
+
|
|
861
|
+
```ts
|
|
862
|
+
const CheapDomains = Query.from(Domain).pipe(
|
|
863
|
+
Query.where(Expr.is(Domain, 'Available', ({ price }) => Expr.lt(price, 20))),
|
|
864
|
+
)
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
It is `_tag = 'Available'` and the predicate, so it is false, not unknown, on
|
|
868
|
+
an Unconfirmed: `Expr.not` of it keeps every Unconfirmed, where
|
|
869
|
+
`Expr.not(Expr.lt(Domain.fields.price, 20))` drops them, since their stored
|
|
870
|
+
`price` is null. Given a `one` relation to a variant Entity, it reads the
|
|
871
|
+
case of the row the relation reaches, each field as a path (`Expr.is(
|
|
872
|
+
Cart.relations.domain, 'Available', …)`). Several cases at once are
|
|
873
|
+
`Expr.in(Domain.fields._tag, ['Available', 'Unconfirmed'])`.
|
|
874
|
+
|
|
875
|
+
A Selection that selects `_tag` reads the row as its case: its schema is a
|
|
876
|
+
tagged union whose cases hold the selected fields they have, typed as the
|
|
877
|
+
case holds them, and every selected relation and derived member.
|
|
878
|
+
|
|
879
|
+
```ts
|
|
880
|
+
const Quote = Entity.select(Domain, { _tag: true, name: true, price: true })
|
|
881
|
+
type Quote = Selected<typeof Quote>
|
|
882
|
+
// { _tag: 'Available', name: string, price: number } | { _tag: 'Unconfirmed', name: string }
|
|
883
|
+
const shown = (quote: Quote) =>
|
|
884
|
+
Quote.schema.match(quote, { Available: ({ price }) => `$${price}`, Unconfirmed: () => 'taken?' })
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
Without `_tag` a Selection is the stored row's Struct, and a field only some
|
|
888
|
+
cases have is refused there, at the type and where it is written: nothing
|
|
889
|
+
would say which case a row is.
|
|
890
|
+
|
|
785
891
|
## Reading an operation's input
|
|
786
892
|
|
|
787
893
|
> Experimental: the smallest mapping that several operation shapes and
|
|
@@ -1084,6 +1190,36 @@ so: a date stored as ISO text is compared with ISO text
|
|
|
1084
1190
|
(`Expr.eq(after.at, '2026-01-01T00:00:00.000Z')`), since a `Date` would never
|
|
1085
1191
|
equal it.
|
|
1086
1192
|
|
|
1193
|
+
A `one` relation is there too, as the id it points at, as it is in a query
|
|
1194
|
+
or a guard: a rule over where a row points stays on the Entity, judged with
|
|
1195
|
+
the rest, and compiles to a CHECK over the columns the relations are stored
|
|
1196
|
+
on. Pipe it onto the Entity `Entity.relate` returned, which has them:
|
|
1197
|
+
|
|
1198
|
+
<!-- docs-check
|
|
1199
|
+
import { Relation } from 'foldkit-entity'
|
|
1200
|
+
-->
|
|
1201
|
+
|
|
1202
|
+
```ts
|
|
1203
|
+
const PersonFields = Entity.define('Person', Schema.Struct({ id: Schema.String }))
|
|
1204
|
+
const Social = Entity.relate(
|
|
1205
|
+
{ Person: PersonFields, Follow: Entity.define('Follow', Schema.Struct({ id: Schema.String })) },
|
|
1206
|
+
{ Follow: { follower: Relation.one(PersonFields), followee: Relation.one(PersonFields) } },
|
|
1207
|
+
)
|
|
1208
|
+
const Follow = Social.Follow.pipe(
|
|
1209
|
+
Entity.invariant('notSelf', ({ after }) => Expr.not(Expr.eq(after.follower, after.followee)), {
|
|
1210
|
+
message: 'You cannot follow yourself',
|
|
1211
|
+
path: ['followee'],
|
|
1212
|
+
}),
|
|
1213
|
+
)
|
|
1214
|
+
|
|
1215
|
+
Entity.judge(Follow, { after: { id: 'f1', follower: 'ada', followee: 'ada' } })
|
|
1216
|
+
// { _tag: 'Invalid', failures: [{ id: 'notSelf', … }] }
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
A row judged holds each relation it reads as that id (null where an optional
|
|
1220
|
+
one points nowhere); `Entity.judgeInput` reads an input key mapped to the
|
|
1221
|
+
relation as it. A `many` relation holds no one value, so it is not there.
|
|
1222
|
+
|
|
1087
1223
|
`Entity.invariant` returns the step that attaches it, carrying its `id` and,
|
|
1088
1224
|
once attached, its Entity's name as `entity`: an id is unique only within an
|
|
1089
1225
|
Entity, so a refusal names both. A declaration attaches to one Entity; reading
|
|
@@ -1114,8 +1250,8 @@ Refusal.isInvalidBy(refusal, reservedWithinQuantity)
|
|
|
1114
1250
|
- It is declared once, on the Entity's metadata, and attaching more adds to it;
|
|
1115
1251
|
the Entity stays the same (`Entity.same`). Its interpreters read it from there.
|
|
1116
1252
|
- It reads stored rows only: one over another Entity, or reading an input, is
|
|
1117
|
-
refused where it is declared, as is an id declared twice or a `path` naming
|
|
1118
|
-
field. So is one reading nothing of `after`: which rows a write may start from
|
|
1253
|
+
refused where it is declared, as is an id declared twice or a `path` naming
|
|
1254
|
+
neither a field nor a `one` relation. So is one reading nothing of `after`: which rows a write may start from
|
|
1119
1255
|
is its `when`. Who may write is a guard's; whether a write applies now is its `when`'s.
|
|
1120
1256
|
- `Entity.judge(entity, { after, before? })` judges rows as the store holds them
|
|
1121
1257
|
(encoded) and is pure. Without `before` (a create) it skips transition
|
|
@@ -1385,8 +1521,11 @@ server on different deploys see which side is behind.
|
|
|
1385
1521
|
| Call | Meaning |
|
|
1386
1522
|
| --- | --- |
|
|
1387
1523
|
| `Entity.define(name, struct)` | A new Entity with a Field per property. |
|
|
1524
|
+
| `Entity.defineVariants(name, { Case: fields, … })` | Experimental. An Entity whose row is one of its cases: `variants` is their tagged union, `fields` the stored row (`_tag`, shared fields, the rest nullable), with an invariant per case. |
|
|
1525
|
+
| `Entity.selectionSchema(entity, schemas)` | The schema a Selection of those members reads, given each one's schema: a Struct, or a variant Entity's union when `_tag` is among them. What an interpreter reading members its own way (Remote's refs) builds a Selection's value with. |
|
|
1526
|
+
| `Entity.variantsOf(entity)` | An Entity's variants for an interpreter (the union, each case's fields, the codec from a stored row to its case), or none. |
|
|
1388
1527
|
| `Entity.relate(entities, { Owner: { key: Relation.one(Target) } })` | The entities with their relations declared; targets resolve to the returned entities. |
|
|
1389
|
-
| `Entity.select(entity, { key: true or Selection })` | A Selection: what was selected (`members`) and the `schema` of the result. |
|
|
1528
|
+
| `Entity.select(entity, { key: true or Selection })` | A Selection: what was selected (`members`) and the `schema` of the result; a tagged union of cases for a variant Entity whose `_tag` is selected. |
|
|
1390
1529
|
| `Entity.page(selection, { first, after } or { last, before })` | In a Selection, a `many` relation read as a page: `items`, `hasNext`, `hasPrevious`. |
|
|
1391
1530
|
| `Entity.fields(entity, ...keys)` | The schemas of those fields, by key, to spread into an input's struct. |
|
|
1392
1531
|
| `Write.update(input, { id, expect?, when?, increment? })` | A declared update of one row: every key the input maps to a field, but the id and the expected revision; `when`, what the row must hold for it to land; `increment`, the number fields it moves by an input amount. |
|
|
@@ -1397,7 +1536,7 @@ server on different deploys see which side is behind.
|
|
|
1397
1536
|
| `Write.writes(write)` / `Write.bind(write, value, keys?)` | The fields it may change; the row and values one input writes, encoded as the store holds them. |
|
|
1398
1537
|
| `Entity.input(entity, struct, mapping?)` | Experimental. Which member each key of an operation's input writes. |
|
|
1399
1538
|
| `Relation.nested(relation, input)` | In an input mapping: the key holds the target itself, written through `input`. |
|
|
1400
|
-
| `Entity.selectFor(input)` | The Selection of the members an input writes: what an edit screen loads. |
|
|
1539
|
+
| `Entity.selectFor(input, { also? })` | The Selection of the members an input writes, and `also` beside them: what an edit screen loads. |
|
|
1401
1540
|
| `Entity.valuesFor(input, value)` | The input values that reproduce a loaded value: fields as they are, refs as ids. |
|
|
1402
1541
|
| `Entity.derived({ key: Derived.make(schema, { predict?, forbids? }) })` | Pipe step adding readable, externally supplied members; `predict` and `forbids` say what a client foresees of one. |
|
|
1403
1542
|
| `Derived.count(Other.relations.pointer)` | A derived member counting the rows whose `one` relation points at this one. |
|
|
@@ -1418,12 +1557,15 @@ server on different deploys see which side is behind.
|
|
|
1418
1557
|
| `Expr.and(a, b, …)` / `Expr.or(a, b, …)` | Every operand holds / at least one does, as SQL's three-valued `and` and `or`. At least one operand; a nested one of the same kind is flattened in. |
|
|
1419
1558
|
| `Expr.not(predicate)` | The predicate does not hold; an unknown stays unknown, so a null matches neither side. |
|
|
1420
1559
|
| `Expr.lt` / `lte` / `gt` / `gte(left, right, { collation? })` | One value orders before or after the other. Numbers as numbers; text only under `binary` or `asciiFold` (the field's declared collation, or the one given), and only against a field. |
|
|
1560
|
+
| `Expr.is(entity or relation, tag, fields => predicate?)` | The row, or the row a `one` relation reaches, is of a case of a variant Entity, and holds what is asked of that case's fields, typed as the case holds them. False on another case. |
|
|
1421
1561
|
| `Expr.path(relation, end)` | What the row a `one` relation points at holds: a field, a further path, or an exists; null where no row is reached. At most `maxPathLength` (4) relations. |
|
|
1422
1562
|
| `Entity.sets({ member: Expr.viewer(E) or Expr.now }, { on })` | Pipe step: members whose value the write's context gives, on every insert (`'create'`) or every insert and update (`'write'`); no input sets them. A value may also be a path from the viewer (`Expr.path(Expr.viewer(E), end)`). `Write.contextValues(write, context, read)` is what they come to. |
|
|
1423
1563
|
| `Expr.eq(Post.relations.author, …)` | A `one` relation as an operand: the id it points at, null for none. |
|
|
1424
1564
|
| `Expr.exists(relation, where?)` | Some row of another Entity points here through its `one` relation and holds `where`, a predicate over its own fields and the input. |
|
|
1425
1565
|
| `Judge.predicate(p, row, options)` / `Judge.query(body, input, row, options)` | The reference semantics over a `HeldRow`: a `Verdict`, `Known` (SQL's answer) or `Unknown` with why. `Judge.match` reads one. |
|
|
1426
1566
|
| `Held.fromRefs(query, row)` | A row holding each `one` relation as its ref key (`'User:ada'`), as a Source answers it and a Remote store keeps it, with each link the query reads given as the id it points at. |
|
|
1567
|
+
| `Judge.pins(predicates, { input, context })` | What a conjunction fixes by field (each `eq` of a field and a literal, an input or the viewer), and whether that is all it says (`whole`). What an exists passes `HeldRow.pointing`, so a holder holding every row with those values can say it misses none. |
|
|
1568
|
+
| `Held.isLink(identity, key)` | Whether `key` is a `one` relation of the Entity `identity` names: how a ref-keyed holder reads a row it knows only by identity, as a row `HeldRow.pointing` returns is. |
|
|
1427
1569
|
| `Held.rows(tables)` | A holder over plain records, each table complete or not, with keys hidden; `row(entity, id)` and `rows(entity)` give `HeldRow`s. |
|
|
1428
1570
|
| `Expr.whenGiven(input, given => predicate)` | A filter applying only when a nullable input is given: `or(isNull(input), predicate)`, the predicate seeing the input as never null. |
|
|
1429
1571
|
| `Expr.operator(id, { input, output, definedAs?, version?, description?, nulls?, collation?, laws? })` | An operator: defined by what a call means (`definedAs`, whose expansion every interpreter runs) or primitive (each interpreter's table implements it). Calling it builds a `Test` predicate (a boolean output) or a `Call` scalar. |
|
package/dist/collation.d.ts
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Option } from "effect";
|
|
2
|
+
import { Metadata } from "foldkit-metadata";
|
|
3
|
+
export type Collation =
|
|
4
|
+
/** By code point: SQLite `BINARY`, Postgres `COLLATE "C"`. */
|
|
5
|
+
{
|
|
6
|
+
readonly _tag: 'Binary';
|
|
7
|
+
} |
|
|
8
|
+
/** ASCII letters folded to lower case, then by code point: SQLite `NOCASE`, Postgres `lower(x COLLATE "C")`. */
|
|
9
|
+
{
|
|
10
|
+
readonly _tag: 'AsciiFold';
|
|
11
|
+
} |
|
|
12
|
+
/** The backend's collation by this name: ordered by the server, never by a client. */
|
|
13
|
+
{
|
|
14
|
+
readonly _tag: 'Locale';
|
|
15
|
+
readonly locale: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const Collation: {
|
|
18
|
+
binary: Collation;
|
|
19
|
+
asciiFold: Collation;
|
|
20
|
+
locale: (locale: string) => Collation;
|
|
21
|
+
/** Member metadata: how a text field orders, wherever a query orders by it. */
|
|
22
|
+
of: (collation: Collation) => Metadata;
|
|
23
|
+
/** The collation a member's metadata declares, if any. */
|
|
24
|
+
declared: (metadata: Metadata) => Option.Option<Collation>;
|
|
25
|
+
/**
|
|
26
|
+
* Text as `asciiFold` compares it: ASCII letters lowercased, every other
|
|
27
|
+
* character as it is, which is what SQLite's `lower` does without ICU and so
|
|
28
|
+
* what compiled SQL folds to. `toLowerCase` would fold `É` to `é` here and not
|
|
29
|
+
* there. An operator implementing `asciiFold` folds with this.
|
|
30
|
+
*/
|
|
31
|
+
foldAscii: (text: string) => string;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=collation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collation.d.ts","names":[],"sources":["../src/collation.ts"],"mappings":";;YAeY;;;WAEG;;;;WAEA;;;;WAEA;WAAyB;;qBAW3B;EACX,QAA6C;EAC7C,WAAmD;EACnD,SAAM,mBAAoB;;EAQ1B,KAAE,WAAc,cAAY;;EAG5B,WAAQ,UAAa,aAAW,OAAO,OAAO;;;;;;;EAS9C,YAAS"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { c as Entity, ln as AnyQuery } from "../index-48JeXG0A.js";
|
|
2
|
-
import { Conformance, Disagreement, LawsVerdict, OperatorReport, Outcome, Runner } from "./operator.js";
|
|
3
|
-
import { HeldWorld, Relational, RelationalCase, RelationalRow, RelationalTable, heldWorlds, relationalCases, relationalContext, relationalTables } from "./relational.js";
|
|
4
1
|
import { Schema } from "effect";
|
|
2
|
+
import { AnyQuery, Entity } from "../index.js";
|
|
3
|
+
export * from "./operator.js";
|
|
4
|
+
export * from "./relational.js";
|
|
5
|
+
export * from "./variants.js";
|
|
5
6
|
/** The one Entity every case reads, with a column of each kind that matters. */
|
|
6
7
|
export declare const Subject: Entity<"Subject", {
|
|
7
8
|
readonly id: Schema.String;
|
|
@@ -62,5 +63,4 @@ export interface ConformanceRefusal {
|
|
|
62
63
|
export declare const refusals: ReadonlyArray<ConformanceRefusal>;
|
|
63
64
|
/** As `refusals`, for bodies calling the kernel's primitive operators. */
|
|
64
65
|
export declare const primitiveRefusals: ReadonlyArray<ConformanceRefusal>;
|
|
65
|
-
export { Conformance, Disagreement, HeldWorld, LawsVerdict, OperatorReport, Outcome, Relational, RelationalCase, RelationalRow, RelationalTable, Runner, heldWorlds, relationalCases, relationalContext, relationalTables };
|
|
66
66
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/conformance/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/conformance/index.ts"],"mappings":";;;;;;qBA4Ca,SAAO;;;;;;;;;;;;;;;iBAmBH;WACN;WACA;WACA;WACA;;WAEA;YACC;;qBAGC,MAAM,cAAc;iBAQhB;;WAEN;WACA,MAAM;;;;;;;WAON,OAAO,SAAS;;WAEhB,UAAU;;qBAwCR,OAAO,cAAc;;;;;;qBAqfrB,gBAAgB,cAAc;;;;;iBA0D1B;WACN;WACA,MAAM;;WAEN,OAAO,SAAS;;qBAKd,UAAU,cAAc;;qBA0CxB,mBAAmB,cAAc"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { Collation } from "../collation.js";
|
|
2
|
-
import { Expr, Order, Query } from "../expr.js";
|
|
3
|
-
import { Text } from "../text.js";
|
|
4
|
-
import { r as Entity } from "../src-DKhUqLoC.js";
|
|
5
|
-
import { Conformance, LawsVerdict, Outcome } from "./operator.js";
|
|
6
|
-
import { Relational, heldWorlds, relationalCases, relationalContext, relationalTables } from "./relational.js";
|
|
7
1
|
import { Schema, SchemaGetter } from "effect";
|
|
2
|
+
import { Collation, Entity, Expr, Order, Query, Text } from "../index.js";
|
|
3
|
+
export * from "./operator.js";
|
|
4
|
+
export * from "./relational.js";
|
|
5
|
+
export * from "./variants.js";
|
|
8
6
|
// src/conformance/index.ts
|
|
9
7
|
/**
|
|
10
8
|
* The conformance suite for a query body: what
|
|
@@ -818,6 +816,6 @@ const primitiveRefusals = [{
|
|
|
818
816
|
body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),
|
|
819
817
|
input: { prefix: `In${NUL}` }
|
|
820
818
|
}];
|
|
821
|
-
export {
|
|
819
|
+
export { Subject, cases, primitiveCases, primitiveRefusals, refusals, rows };
|
|
822
820
|
|
|
823
821
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/conformance/index.ts"],"sourcesContent":["/**\n * The conformance suite for a query body: what\n * [data-query-DESIGN §6.0.1](../../../../docs/design/data-query-DESIGN.md) says\n * each operator means, as cases an interpreter can be run against.\n *\n * Exported rather than kept in this repository's tests, because the interpreter\n * most worth checking against it is one written elsewhere: run every case\n * through yours and compare the ids, in order, against `expected`.\n *\n * §18 names portable-kernel conformance as what the reference interpreter is\n * for. This is that, extracted: one set of cases, run against every interpreter\n * rather than each interpreter having its own tests that happen to agree.\n * `foldkit-remote-server` runs them over rows in memory;\n * `foldkit-remote-drizzle` compiles them to SQL and runs them against a real\n * SQLite. A body that means two things fails in whichever is wrong.\n *\n * The cases are chosen to make interpreters *disagree*, which is the only kind\n * that tests anything. A fixture whose values are all lowercase cannot tell a\n * case-sensitive `contains` from a case-insensitive one — that is not a\n * hypothetical, it is how `contains` reached a released package meaning three\n * different things.\n */\nimport { Schema, SchemaGetter } from 'effect'\nimport { Collation, Entity, Expr, Order, Query, Text, type AnyQuery } from '../index.js'\n\n/**\n * A `Date` on the way in, an ISO string on the wire — the one fixture whose\n * **encoded form differs from its decoded form**.\n *\n * Every other column here encodes to itself, which is why the suite could not\n * previously see an interpreter comparing a decoded value against an encoded\n * row. That is not a hypothetical bug: a store holds wire values and decodes at\n * read, while a `QueryRef`'s input and a body's literals are written in domain\n * terms, so anything that runs a body over stored rows has to reconcile the two\n * and nothing was checking that it did.\n */\nconst Timestamp = Schema.Date.pipe(\n Schema.encodeTo(Schema.String, {\n decode: SchemaGetter.transform((iso: string) => new Date(iso)),\n encode: SchemaGetter.transform((at: Date) => at.toISOString()),\n }),\n)\n\n/** The one Entity every case reads, with a column of each kind that matters. */\nexport const Subject = Entity.define(\n 'Subject',\n Schema.Struct({\n id: Schema.String,\n /** Mixed case on purpose: a case-blind `contains` must be caught. */\n label: Schema.String,\n rank: Schema.Number,\n /** Nullable on purpose: three-valued logic has to be exercised. */\n tag: Schema.String,\n /** Encoded and decoded forms differ on purpose: see `Timestamp`. */\n at: Timestamp,\n }),\n)\n\n/**\n * How a row looks to an interpreter reading values, and to SQL as a table. The\n * index signature is what lets one be read by key without a cast, which is how\n * an interpreter over plain rows reads one.\n */\nexport interface ConformanceRow {\n readonly id: string\n readonly label: string\n readonly rank: number\n readonly tag: string | null\n /** The **encoded** form: what a store holds and an interpreter compares. */\n readonly at: string\n readonly [key: string]: unknown\n}\n\nexport const rows: ReadonlyArray<ConformanceRow> = [\n { id: 'a', label: 'Intro', rank: 2, tag: null, at: '2026-01-01T00:00:00.000Z' },\n { id: 'b', label: 'intro to sql', rank: 1, tag: 'x', at: '2026-01-02T00:00:00.000Z' },\n { id: 'c', label: 'Other', rank: 3, tag: null, at: '2026-01-02T00:00:00.000Z' },\n { id: 'd', label: '100% cotton', rank: 3, tag: 'x', at: '2026-01-03T00:00:00.000Z' },\n { id: 'e', label: 'snake_case', rank: 4, tag: 'y', at: '2026-01-04T00:00:00.000Z' },\n]\n\nexport interface ConformanceCase {\n /** What the case pins, as a sentence an interpreter fails by name. */\n readonly what: string\n readonly body: AnyQuery\n /**\n * The inputs, **encoded** — the space a store's rows are in, not the domain\n * space the body's types describe. For every column but `at` the two are the\n * same value, which is exactly why this has to be said rather than inferred\n * from the fixtures.\n */\n readonly input: Readonly<Record<string, unknown>>\n /** The ids the body matches, in the order it asks for. */\n readonly expected: ReadonlyArray<string>\n}\n\nconst from = Query.from(Subject)\nconst byId = Query.orderBy(Order.asc(Subject.fields.id))\nconst label = Expr.input('label', Schema.String)\nconst text = Expr.input('text', Schema.String)\nconst tag = Expr.input('tag', Schema.String)\nconst present = Expr.input('present', Schema.Boolean)\nconst labels = Expr.input('labels', Schema.Array(Schema.String))\nconst at = Expr.input('at', Timestamp)\n/** An optional filter's input: none chosen is null. */\nconst maybeTag = Expr.input('maybeTag', Schema.NullOr(Schema.String))\nconst below = Expr.input('below', Schema.Number)\nconst from_ = Expr.input('from', Timestamp)\nconst until = Expr.input('until', Timestamp)\nconst binary = { collation: Collation.binary }\n/** A list sorted by what its reader picked: `Order.chosen`'s input. */\nconst sort = Expr.input(\n 'sort',\n Schema.NullOr(\n Schema.Struct({ by: Schema.Literals(['rank']), direction: Schema.Literals(['asc', 'desc']) }),\n ),\n)\n/** Defined operators: an interpreter runs what each means, and needs nothing of its own. */\nconst tagged = Expr.operator('conformance.tagged', {\n input: [Schema.Unknown],\n output: Schema.Boolean,\n definedAs: value => Expr.isNotNull(value),\n})\nconst rankOf = Expr.operator('conformance.rankOf', {\n input: [Schema.Number],\n output: Schema.Number,\n definedAs: rank => rank,\n})\nconst chosen = Query.orderBy(\n Order.chosen(sort, { rank: Subject.fields.rank }),\n Order.asc(Subject.fields.id),\n)\n\nexport const cases: ReadonlyArray<ConformanceCase> = [\n // ---- eq ------------------------------------------------------------------\n {\n what: 'eq matches a field against a literal',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n {\n what: 'eq matches a field against the value the request supplies',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'Other' },\n expected: ['c'],\n },\n {\n what: 'eq is exact: a value that differs only by case does not match',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'other' },\n expected: [],\n },\n {\n what: 'eq against null matches nothing, not even the rows that are null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, tag)), byId),\n input: { tag: null },\n expected: [],\n },\n {\n what: 'eq against a value skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, 'x')), byId),\n input: {},\n expected: ['b', 'd'],\n },\n\n // ---- isNull / isNotNull --------------------------------------------------\n {\n what: 'isNull finds exactly the rows with no value',\n body: from.pipe(Query.where(Expr.isNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'isNotNull finds exactly the rest',\n body: from.pipe(Query.where(Expr.isNotNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a true input is that predicate',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: true },\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a false input is its negation',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: false },\n expected: ['a', 'c'],\n },\n ...[true, false].map(value => ({\n what: `a ${value} input compared to a predicate works in reverse order`,\n body: from.pipe(Query.where(Expr.eq(present, Expr.isNotNull(Subject.fields.tag))), byId),\n input: { present: value },\n expected: value ? ['b', 'd', 'e'] : ['a', 'c'],\n })),\n ...[true, false].map(value => ({\n what: `an unknown equality compared to ${value} stays unknown`,\n body: from.pipe(Query.where(Expr.eq(Expr.eq(Subject.fields.tag, tag), present)), byId),\n input: { tag: null, present: value },\n expected: [],\n })),\n\n // ---- contains ------------------------------------------------------------\n {\n what: 'contains ignores case, which is stated rather than left to the backend',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'INTRO' },\n expected: ['a', 'b'],\n },\n {\n what: 'contains matches anywhere in the value, not only at the start',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'to sql' },\n expected: ['b'],\n },\n {\n what: 'containing the empty string is everything',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a percent is searched for literally, not as a wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '%' },\n expected: ['d'],\n },\n {\n what: 'an underscore is searched for literally, not as a single-character wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '_' },\n expected: ['e'],\n },\n {\n what: 'contains over a null column drops those rows, so it is not the same as no filter',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.tag, label)), byId),\n input: { label: '' },\n expected: ['b', 'd', 'e'],\n },\n // The text searched is an input here so the fixture rows stay ASCII: each\n // case asks the same of every row, so it matches all of them or none.\n {\n what: 'contains folds ASCII letters only: an accented capital does not match its lowercase',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'é' },\n expected: [],\n },\n {\n what: 'contains still matches a non-ASCII letter written the same way',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'Él' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'contains with a null search is unknown for every row',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: null },\n expected: [],\n },\n {\n what: 'an unknown containment compared to false stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.contains(Subject.fields.label, label), false)), byId),\n input: { label: null },\n expected: [],\n },\n\n // ---- in ------------------------------------------------------------------\n {\n what: 'in matches a field against a list written out',\n body: from.pipe(Query.where(Expr.in(Subject.fields.rank, [1, 4])), byId),\n input: {},\n expected: ['b', 'e'],\n },\n {\n what: 'in matches a field against the list the request supplies, exactly',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: ['Other', 'intro'] },\n expected: ['c'],\n },\n {\n what: 'in against an empty list matches nothing',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: [] },\n expected: [],\n },\n {\n what: 'in skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.in(Subject.fields.tag, ['x', 'y'])), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'in compared to false is its negation, and a null column stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, ['x']), present)), byId),\n input: { present: false },\n expected: ['e'],\n },\n {\n what: 'in against an empty list compared to false matches every row, null or not',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, labels), present)), byId),\n input: { labels: [], present: false },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n {\n what: 'in asks of an input as of a field: every row, when the input is listed',\n body: from.pipe(Query.where(Expr.in(text, ['x', 'y'])), byId),\n input: { text: 'y' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'in asks of an input against an empty list: no row',\n body: from.pipe(Query.where(Expr.in(text, labels)), byId),\n input: { text: 'y', labels: [] },\n expected: [],\n },\n\n // ---- conjunction, which is the list rather than an operator ---------------\n {\n what: 'two predicates conjoin: every one must hold',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.rank, 3), Expr.isNotNull(Subject.fields.tag)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'no predicate at all is every row',\n body: from.pipe(byId),\n input: {},\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n // ---- and, or, not: SQL's three values -----------------------------------\n // `tag` is null on a and c, so a comparison of it is unknown there, and a\n // row is kept only on true.\n {\n what: 'or holds where one operand does, true beating unknown',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 2))),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'an and inside an or groups as written',\n body: from.pipe(\n Query.where(\n Expr.or(\n Expr.and(Expr.eq(Subject.fields.rank, 3), Expr.eq(Subject.fields.tag, 'x')),\n Expr.eq(Subject.fields.label, 'Intro'),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'd'],\n },\n {\n what: 'not of an unknown stays unknown, so a null matches neither side',\n body: from.pipe(Query.where(Expr.not(Expr.eq(Subject.fields.tag, 'x'))), byId),\n input: {},\n expected: ['e'],\n },\n {\n what: 'not of an and that is false, false beating unknown, holds',\n body: from.pipe(\n Query.where(\n Expr.not(Expr.and(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 1))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'd', 'e'],\n },\n {\n what: 'everything but one value, nulls included, is said with isNull',\n body: from.pipe(\n Query.where(\n Expr.or(Expr.isNull(Subject.fields.tag), Expr.not(Expr.eq(Subject.fields.tag, 'x'))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'e'],\n },\n {\n what: 'an optional filter with nothing chosen matches every row',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'an optional filter with a value chosen is that filter',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: 'x' },\n expected: ['b', 'd'],\n },\n {\n what: 'an operand decided by the input alone settles an or either way',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(present, true), Expr.eq(Subject.fields.rank, 1))),\n byId,\n ),\n input: { present: false },\n expected: ['b'],\n },\n // ---- comparisons -----------------------------------------------------------\n // Ranks are a 2, b 1, c 3, d 3, e 4; text only under a collation every\n // interpreter agrees on, and a date by its encoded ISO string.\n {\n what: 'lt holds where a number orders before the other',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'gte holds where a number orders after the other, or with it',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd', 'e'],\n },\n {\n what: 'a field written second compares the same: the input is above the rank',\n body: from.pipe(Query.where(Expr.gt(below, Expr.field(Subject.fields.rank))), byId),\n input: { below: 3 },\n expected: ['a', 'b'],\n },\n {\n what: 'a comparison that reads no field orders numbers as numbers: 9 is below 10',\n body: from.pipe(Query.where(Expr.lt(below, 10)), byId),\n input: { below: 9 },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a range of dates compares their encoded ISO strings under binary',\n body: from.pipe(\n Query.where(\n Expr.and(\n Expr.gte(Subject.fields.at, from_, binary),\n Expr.lt(Subject.fields.at, until, binary),\n ),\n ),\n byId,\n ),\n input: { from: '2026-01-02T00:00:00.000Z', until: '2026-01-04T00:00:00.000Z' },\n expected: ['b', 'c', 'd'],\n },\n {\n what: 'text under binary orders by code point: capitals and digits before lower case',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.label, 'a', binary)), byId),\n input: {},\n expected: ['a', 'c', 'd'],\n },\n {\n what: 'text under asciiFold orders with ASCII case folded',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, 'j', { collation: Collation.asciiFold })),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'a null compared is unknown, so it matches neither the comparison nor its not',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.tag, 'x', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'not of a comparison leaves a null out too',\n body: from.pipe(Query.where(Expr.not(Expr.gte(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: [],\n },\n // ---- encoded values ------------------------------------------------------\n // The body's types say `Date`; a store's rows and a request's inputs are ISO\n // strings. An interpreter compares in the **encoded** space, and these are the\n // cases that say so — for every other column the two spaces hold the same\n // value, so nothing here could previously tell them apart.\n //\n // What happens when a caller passes a *decoded* value is deliberately not a\n // case, because the interpreters do not agree: the reference one matches\n // nothing, SQLite raises `datatype mismatch`, and a local engine does\n // whatever its own comparison does. `cases` are what interpreters must agree\n // about. The consequence is pinned in `packages/entity/test/encoding.test.ts`\n // instead, and it is the one that matters: **a runtime error cannot be relied\n // on to catch the mistake**, because one of the three answers is an empty\n // result that reads exactly like a correct one.\n {\n what: 'an input whose encoded form differs from its decoded one matches on the encoded one',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.at, at)), byId),\n input: { at: '2026-01-02T00:00:00.000Z' },\n expected: ['b', 'c'],\n },\n {\n what: 'a literal is encoded too, or it has the same problem as an input',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.at, '2026-01-03T00:00:00.000Z' as never)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n\n // ---- ordering ------------------------------------------------------------\n {\n what: 'orders ascending by a number',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders descending, and a later term breaks the tie',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'puts rows without a value last ascending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag))),\n input: {},\n expected: ['b', 'd', 'e', 'a', 'c'],\n },\n {\n what: 'puts rows without a value first descending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag))),\n input: {},\n expected: ['a', 'c', 'e', 'b', 'd'],\n },\n {\n what: 'puts rows without a value first ascending when the term says so',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag, { nulls: 'first' }))),\n input: {},\n expected: ['a', 'c', 'b', 'd', 'e'],\n },\n {\n what: 'puts rows without a value last descending when the term says so',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag, { nulls: 'last' }))),\n input: {},\n expected: ['e', 'b', 'd', 'a', 'c'],\n },\n {\n what: 'breaks a tie by the id where the order does not say how',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the field the input chose, ascending',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'asc' } },\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders by the field the input chose, descending, the next term breaking the tie',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'desc' } },\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the terms after a chosen order when the input chose none',\n body: from.pipe(chosen),\n input: { sort: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n // ---- text, ordered by a declared collation -------------------------------\n {\n what: 'orders text by code point under a binary collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.binary })),\n ),\n input: {},\n expected: ['d', 'a', 'c', 'b', 'e'],\n },\n {\n what: 'orders text with ASCII case folded under an asciiFold collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.asciiFold })),\n ),\n input: {},\n expected: ['d', 'a', 'b', 'c', 'e'],\n },\n // Ordering by text with no declared collation is deliberately not here. How text compares is the\n // backend's — SQLite by code point, TanStack by locale, Postgres by whatever\n // the database was created with — and §6.0.1 puts it outside the conformant\n // subset rather than pretending one of them is the rule. A case asserting an\n // order would only pin whichever engine was written first.\n\n // ---- defined operators -----------------------------------------------------\n {\n what: 'a defined operator matches the rows what it means does',\n body: from.pipe(Query.where(tagged(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a defined operator under not is the negation of what it means',\n body: from.pipe(Query.where(Expr.not(tagged(Subject.fields.tag))), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'a defined operator over an input only is decided by the request',\n body: from.pipe(Query.where(Expr.or(tagged(maybeTag), Expr.eq(Subject.fields.rank, 3))), byId),\n input: { maybeTag: null },\n expected: ['c', 'd'],\n },\n {\n what: 'a defined scalar operator compares as what it means',\n body: from.pipe(Query.where(Expr.eq(rankOf(Subject.fields.rank), 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n]\n\nconst prefix = Expr.input('prefix', Schema.NullOr(Schema.String))\nconst asciiFold = { collation: Collation.asciiFold }\n\n/**\n * Bodies calling the kernel's primitive operators (`Text.startsWith`). An\n * interpreter runs these once it implements them: the in-memory one through\n * `Operators.kernel`, a compiler through its own table.\n */\nexport const primitiveCases: ReadonlyArray<ConformanceCase> = [\n {\n what: 'startsWith under binary is exact about case',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'In', binary)), byId),\n input: {},\n expected: ['a'],\n },\n {\n what: 'startsWith under asciiFold folds ASCII case on both sides',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'IN', asciiFold)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'startsWith the empty prefix holds for every row with text',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'startsWith over null text is unknown, so its rows are not matched',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.tag, '', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'startsWith a null prefix is unknown for every row',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: null },\n expected: [],\n },\n {\n what: 'startsWith reads % and _ as characters, never as like wildcards',\n body: from.pipe(\n Query.where(\n Expr.or(\n Text.startsWith(Subject.fields.label, '100%', binary),\n Text.startsWith(Subject.fields.label, 'sn_', binary),\n Text.startsWith(Subject.fields.label, 'O%', binary),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'startsWith under not keeps a null unknown',\n body: from.pipe(Query.where(Expr.not(Text.startsWith(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: ['e'],\n },\n]\n\n/**\n * A body whose answer no two interpreters agree on, so every interpreter must\n * refuse it rather than answer. Run each through yours and expect a failure.\n */\nexport interface ConformanceRefusal {\n readonly what: string\n readonly body: AnyQuery\n /** The inputs, encoded, as in `ConformanceCase`. */\n readonly input: Readonly<Record<string, unknown>>\n}\n\nconst NUL = String.fromCharCode(0)\n\nexport const refusals: ReadonlyArray<ConformanceRefusal> = [\n // Postgres text cannot hold NUL and SQLite's `like` stops at it.\n {\n what: 'contains refuses a search holding NUL',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: `in${NUL}` },\n },\n {\n what: 'a comparison refuses text holding NUL',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, label, { collation: Collation.binary })),\n byId,\n ),\n input: { label: `b${NUL}` },\n },\n {\n what: 'contains refuses searched text holding NUL',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: `a${NUL}b`, label: 'b' },\n },\n // SQLite stores NaN as null; Postgres orders it after every number, equal to itself.\n {\n what: 'an equality refuses NaN',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, below)), byId),\n input: { below: Number.NaN },\n },\n {\n what: 'a comparison refuses NaN',\n body: from.pipe(Query.where(Expr.gt(Subject.fields.rank, below)), byId),\n input: { below: Number.NaN },\n },\n {\n what: 'a membership test refuses a list holding NaN',\n body: from.pipe(\n Query.where(Expr.in(Subject.fields.rank, Expr.input('ranks', Schema.Array(Schema.Number)))),\n byId,\n ),\n input: { ranks: [1, Number.NaN] },\n },\n]\n\n/** As `refusals`, for bodies calling the kernel's primitive operators. */\nexport const primitiveRefusals: ReadonlyArray<ConformanceRefusal> = [\n {\n what: 'startsWith refuses a prefix holding NUL',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: `In${NUL}` },\n },\n]\nexport * from './operator.js'\nexport * from './relational.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,YAAY,OAAO,KAAK,KAC5B,OAAO,SAAS,OAAO,QAAQ;CAC7B,QAAQ,aAAa,WAAW,QAAgB,IAAI,KAAK,GAAG,CAAC;CAC7D,QAAQ,aAAa,WAAW,OAAa,GAAG,YAAY,CAAC;AAC/D,CAAC,CACH;;AAGA,MAAa,UAAU,OAAO,OAC5B,WACA,OAAO,OAAO;CACZ,IAAI,OAAO;;CAEX,OAAO,OAAO;CACd,MAAM,OAAO;;CAEb,KAAK,OAAO;;CAEZ,IAAI;AACN,CAAC,CACH;AAiBA,MAAa,OAAsC;CACjD;EAAE,IAAI;EAAK,OAAO;EAAS,MAAM;EAAG,KAAK;EAAM,IAAI;CAA2B;CAC9E;EAAE,IAAI;EAAK,OAAO;EAAgB,MAAM;EAAG,KAAK;EAAK,IAAI;CAA2B;CACpF;EAAE,IAAI;EAAK,OAAO;EAAS,MAAM;EAAG,KAAK;EAAM,IAAI;CAA2B;CAC9E;EAAE,IAAI;EAAK,OAAO;EAAe,MAAM;EAAG,KAAK;EAAK,IAAI;CAA2B;CACnF;EAAE,IAAI;EAAK,OAAO;EAAc,MAAM;EAAG,KAAK;EAAK,I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AuD,CAClE;CACE,MAAM;CACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,QAAQ,OAAO,OAAO,QAAQ,MAAM,CAAC,GAAG,IAAI;CACxF,OAAO,EAAE,QAAQ,KAAK,MAAM;AAC9B,CACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/conformance/index.ts"],"sourcesContent":["/**\n * The conformance suite for a query body: what\n * [data-query-DESIGN §6.0.1](../../../../docs/design/data-query-DESIGN.md) says\n * each operator means, as cases an interpreter can be run against.\n *\n * Exported rather than kept in this repository's tests, because the interpreter\n * most worth checking against it is one written elsewhere: run every case\n * through yours and compare the ids, in order, against `expected`.\n *\n * §18 names portable-kernel conformance as what the reference interpreter is\n * for. This is that, extracted: one set of cases, run against every interpreter\n * rather than each interpreter having its own tests that happen to agree.\n * `foldkit-remote-server` runs them over rows in memory;\n * `foldkit-remote-drizzle` compiles them to SQL and runs them against a real\n * SQLite. A body that means two things fails in whichever is wrong.\n *\n * The cases are chosen to make interpreters *disagree*, which is the only kind\n * that tests anything. A fixture whose values are all lowercase cannot tell a\n * case-sensitive `contains` from a case-insensitive one — that is not a\n * hypothetical, it is how `contains` reached a released package meaning three\n * different things.\n */\nimport { Schema, SchemaGetter } from 'effect'\nimport { Collation, Entity, Expr, Order, Query, Text, type AnyQuery } from '../index.js'\n\n/**\n * A `Date` on the way in, an ISO string on the wire — the one fixture whose\n * **encoded form differs from its decoded form**.\n *\n * Every other column here encodes to itself, which is why the suite could not\n * previously see an interpreter comparing a decoded value against an encoded\n * row. That is not a hypothetical bug: a store holds wire values and decodes at\n * read, while a `QueryRef`'s input and a body's literals are written in domain\n * terms, so anything that runs a body over stored rows has to reconcile the two\n * and nothing was checking that it did.\n */\nconst Timestamp = Schema.Date.pipe(\n Schema.encodeTo(Schema.String, {\n decode: SchemaGetter.transform((iso: string) => new Date(iso)),\n encode: SchemaGetter.transform((at: Date) => at.toISOString()),\n }),\n)\n\n/** The one Entity every case reads, with a column of each kind that matters. */\nexport const Subject = Entity.define(\n 'Subject',\n Schema.Struct({\n id: Schema.String,\n /** Mixed case on purpose: a case-blind `contains` must be caught. */\n label: Schema.String,\n rank: Schema.Number,\n /** Nullable on purpose: three-valued logic has to be exercised. */\n tag: Schema.String,\n /** Encoded and decoded forms differ on purpose: see `Timestamp`. */\n at: Timestamp,\n }),\n)\n\n/**\n * How a row looks to an interpreter reading values, and to SQL as a table. The\n * index signature is what lets one be read by key without a cast, which is how\n * an interpreter over plain rows reads one.\n */\nexport interface ConformanceRow {\n readonly id: string\n readonly label: string\n readonly rank: number\n readonly tag: string | null\n /** The **encoded** form: what a store holds and an interpreter compares. */\n readonly at: string\n readonly [key: string]: unknown\n}\n\nexport const rows: ReadonlyArray<ConformanceRow> = [\n { id: 'a', label: 'Intro', rank: 2, tag: null, at: '2026-01-01T00:00:00.000Z' },\n { id: 'b', label: 'intro to sql', rank: 1, tag: 'x', at: '2026-01-02T00:00:00.000Z' },\n { id: 'c', label: 'Other', rank: 3, tag: null, at: '2026-01-02T00:00:00.000Z' },\n { id: 'd', label: '100% cotton', rank: 3, tag: 'x', at: '2026-01-03T00:00:00.000Z' },\n { id: 'e', label: 'snake_case', rank: 4, tag: 'y', at: '2026-01-04T00:00:00.000Z' },\n]\n\nexport interface ConformanceCase {\n /** What the case pins, as a sentence an interpreter fails by name. */\n readonly what: string\n readonly body: AnyQuery\n /**\n * The inputs, **encoded** — the space a store's rows are in, not the domain\n * space the body's types describe. For every column but `at` the two are the\n * same value, which is exactly why this has to be said rather than inferred\n * from the fixtures.\n */\n readonly input: Readonly<Record<string, unknown>>\n /** The ids the body matches, in the order it asks for. */\n readonly expected: ReadonlyArray<string>\n}\n\nconst from = Query.from(Subject)\nconst byId = Query.orderBy(Order.asc(Subject.fields.id))\nconst label = Expr.input('label', Schema.String)\nconst text = Expr.input('text', Schema.String)\nconst tag = Expr.input('tag', Schema.String)\nconst present = Expr.input('present', Schema.Boolean)\nconst labels = Expr.input('labels', Schema.Array(Schema.String))\nconst at = Expr.input('at', Timestamp)\n/** An optional filter's input: none chosen is null. */\nconst maybeTag = Expr.input('maybeTag', Schema.NullOr(Schema.String))\nconst below = Expr.input('below', Schema.Number)\nconst from_ = Expr.input('from', Timestamp)\nconst until = Expr.input('until', Timestamp)\nconst binary = { collation: Collation.binary }\n/** A list sorted by what its reader picked: `Order.chosen`'s input. */\nconst sort = Expr.input(\n 'sort',\n Schema.NullOr(\n Schema.Struct({ by: Schema.Literals(['rank']), direction: Schema.Literals(['asc', 'desc']) }),\n ),\n)\n/** Defined operators: an interpreter runs what each means, and needs nothing of its own. */\nconst tagged = Expr.operator('conformance.tagged', {\n input: [Schema.Unknown],\n output: Schema.Boolean,\n definedAs: value => Expr.isNotNull(value),\n})\nconst rankOf = Expr.operator('conformance.rankOf', {\n input: [Schema.Number],\n output: Schema.Number,\n definedAs: rank => rank,\n})\nconst chosen = Query.orderBy(\n Order.chosen(sort, { rank: Subject.fields.rank }),\n Order.asc(Subject.fields.id),\n)\n\nexport const cases: ReadonlyArray<ConformanceCase> = [\n // ---- eq ------------------------------------------------------------------\n {\n what: 'eq matches a field against a literal',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n {\n what: 'eq matches a field against the value the request supplies',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'Other' },\n expected: ['c'],\n },\n {\n what: 'eq is exact: a value that differs only by case does not match',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'other' },\n expected: [],\n },\n {\n what: 'eq against null matches nothing, not even the rows that are null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, tag)), byId),\n input: { tag: null },\n expected: [],\n },\n {\n what: 'eq against a value skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, 'x')), byId),\n input: {},\n expected: ['b', 'd'],\n },\n\n // ---- isNull / isNotNull --------------------------------------------------\n {\n what: 'isNull finds exactly the rows with no value',\n body: from.pipe(Query.where(Expr.isNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'isNotNull finds exactly the rest',\n body: from.pipe(Query.where(Expr.isNotNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a true input is that predicate',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: true },\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a false input is its negation',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: false },\n expected: ['a', 'c'],\n },\n ...[true, false].map(value => ({\n what: `a ${value} input compared to a predicate works in reverse order`,\n body: from.pipe(Query.where(Expr.eq(present, Expr.isNotNull(Subject.fields.tag))), byId),\n input: { present: value },\n expected: value ? ['b', 'd', 'e'] : ['a', 'c'],\n })),\n ...[true, false].map(value => ({\n what: `an unknown equality compared to ${value} stays unknown`,\n body: from.pipe(Query.where(Expr.eq(Expr.eq(Subject.fields.tag, tag), present)), byId),\n input: { tag: null, present: value },\n expected: [],\n })),\n\n // ---- contains ------------------------------------------------------------\n {\n what: 'contains ignores case, which is stated rather than left to the backend',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'INTRO' },\n expected: ['a', 'b'],\n },\n {\n what: 'contains matches anywhere in the value, not only at the start',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'to sql' },\n expected: ['b'],\n },\n {\n what: 'containing the empty string is everything',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a percent is searched for literally, not as a wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '%' },\n expected: ['d'],\n },\n {\n what: 'an underscore is searched for literally, not as a single-character wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '_' },\n expected: ['e'],\n },\n {\n what: 'contains over a null column drops those rows, so it is not the same as no filter',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.tag, label)), byId),\n input: { label: '' },\n expected: ['b', 'd', 'e'],\n },\n // The text searched is an input here so the fixture rows stay ASCII: each\n // case asks the same of every row, so it matches all of them or none.\n {\n what: 'contains folds ASCII letters only: an accented capital does not match its lowercase',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'é' },\n expected: [],\n },\n {\n what: 'contains still matches a non-ASCII letter written the same way',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'Él' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'contains with a null search is unknown for every row',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: null },\n expected: [],\n },\n {\n what: 'an unknown containment compared to false stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.contains(Subject.fields.label, label), false)), byId),\n input: { label: null },\n expected: [],\n },\n\n // ---- in ------------------------------------------------------------------\n {\n what: 'in matches a field against a list written out',\n body: from.pipe(Query.where(Expr.in(Subject.fields.rank, [1, 4])), byId),\n input: {},\n expected: ['b', 'e'],\n },\n {\n what: 'in matches a field against the list the request supplies, exactly',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: ['Other', 'intro'] },\n expected: ['c'],\n },\n {\n what: 'in against an empty list matches nothing',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: [] },\n expected: [],\n },\n {\n what: 'in skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.in(Subject.fields.tag, ['x', 'y'])), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'in compared to false is its negation, and a null column stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, ['x']), present)), byId),\n input: { present: false },\n expected: ['e'],\n },\n {\n what: 'in against an empty list compared to false matches every row, null or not',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, labels), present)), byId),\n input: { labels: [], present: false },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n {\n what: 'in asks of an input as of a field: every row, when the input is listed',\n body: from.pipe(Query.where(Expr.in(text, ['x', 'y'])), byId),\n input: { text: 'y' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'in asks of an input against an empty list: no row',\n body: from.pipe(Query.where(Expr.in(text, labels)), byId),\n input: { text: 'y', labels: [] },\n expected: [],\n },\n\n // ---- conjunction, which is the list rather than an operator ---------------\n {\n what: 'two predicates conjoin: every one must hold',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.rank, 3), Expr.isNotNull(Subject.fields.tag)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'no predicate at all is every row',\n body: from.pipe(byId),\n input: {},\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n // ---- and, or, not: SQL's three values -----------------------------------\n // `tag` is null on a and c, so a comparison of it is unknown there, and a\n // row is kept only on true.\n {\n what: 'or holds where one operand does, true beating unknown',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 2))),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'an and inside an or groups as written',\n body: from.pipe(\n Query.where(\n Expr.or(\n Expr.and(Expr.eq(Subject.fields.rank, 3), Expr.eq(Subject.fields.tag, 'x')),\n Expr.eq(Subject.fields.label, 'Intro'),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'd'],\n },\n {\n what: 'not of an unknown stays unknown, so a null matches neither side',\n body: from.pipe(Query.where(Expr.not(Expr.eq(Subject.fields.tag, 'x'))), byId),\n input: {},\n expected: ['e'],\n },\n {\n what: 'not of an and that is false, false beating unknown, holds',\n body: from.pipe(\n Query.where(\n Expr.not(Expr.and(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 1))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'd', 'e'],\n },\n {\n what: 'everything but one value, nulls included, is said with isNull',\n body: from.pipe(\n Query.where(\n Expr.or(Expr.isNull(Subject.fields.tag), Expr.not(Expr.eq(Subject.fields.tag, 'x'))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'e'],\n },\n {\n what: 'an optional filter with nothing chosen matches every row',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'an optional filter with a value chosen is that filter',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: 'x' },\n expected: ['b', 'd'],\n },\n {\n what: 'an operand decided by the input alone settles an or either way',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(present, true), Expr.eq(Subject.fields.rank, 1))),\n byId,\n ),\n input: { present: false },\n expected: ['b'],\n },\n // ---- comparisons -----------------------------------------------------------\n // Ranks are a 2, b 1, c 3, d 3, e 4; text only under a collation every\n // interpreter agrees on, and a date by its encoded ISO string.\n {\n what: 'lt holds where a number orders before the other',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'gte holds where a number orders after the other, or with it',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd', 'e'],\n },\n {\n what: 'a field written second compares the same: the input is above the rank',\n body: from.pipe(Query.where(Expr.gt(below, Expr.field(Subject.fields.rank))), byId),\n input: { below: 3 },\n expected: ['a', 'b'],\n },\n {\n what: 'a comparison that reads no field orders numbers as numbers: 9 is below 10',\n body: from.pipe(Query.where(Expr.lt(below, 10)), byId),\n input: { below: 9 },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a range of dates compares their encoded ISO strings under binary',\n body: from.pipe(\n Query.where(\n Expr.and(\n Expr.gte(Subject.fields.at, from_, binary),\n Expr.lt(Subject.fields.at, until, binary),\n ),\n ),\n byId,\n ),\n input: { from: '2026-01-02T00:00:00.000Z', until: '2026-01-04T00:00:00.000Z' },\n expected: ['b', 'c', 'd'],\n },\n {\n what: 'text under binary orders by code point: capitals and digits before lower case',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.label, 'a', binary)), byId),\n input: {},\n expected: ['a', 'c', 'd'],\n },\n {\n what: 'text under asciiFold orders with ASCII case folded',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, 'j', { collation: Collation.asciiFold })),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'a null compared is unknown, so it matches neither the comparison nor its not',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.tag, 'x', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'not of a comparison leaves a null out too',\n body: from.pipe(Query.where(Expr.not(Expr.gte(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: [],\n },\n // ---- encoded values ------------------------------------------------------\n // The body's types say `Date`; a store's rows and a request's inputs are ISO\n // strings. An interpreter compares in the **encoded** space, and these are the\n // cases that say so — for every other column the two spaces hold the same\n // value, so nothing here could previously tell them apart.\n //\n // What happens when a caller passes a *decoded* value is deliberately not a\n // case, because the interpreters do not agree: the reference one matches\n // nothing, SQLite raises `datatype mismatch`, and a local engine does\n // whatever its own comparison does. `cases` are what interpreters must agree\n // about. The consequence is pinned in `packages/entity/test/encoding.test.ts`\n // instead, and it is the one that matters: **a runtime error cannot be relied\n // on to catch the mistake**, because one of the three answers is an empty\n // result that reads exactly like a correct one.\n {\n what: 'an input whose encoded form differs from its decoded one matches on the encoded one',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.at, at)), byId),\n input: { at: '2026-01-02T00:00:00.000Z' },\n expected: ['b', 'c'],\n },\n {\n what: 'a literal is encoded too, or it has the same problem as an input',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.at, '2026-01-03T00:00:00.000Z' as never)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n\n // ---- ordering ------------------------------------------------------------\n {\n what: 'orders ascending by a number',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders descending, and a later term breaks the tie',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'puts rows without a value last ascending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag))),\n input: {},\n expected: ['b', 'd', 'e', 'a', 'c'],\n },\n {\n what: 'puts rows without a value first descending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag))),\n input: {},\n expected: ['a', 'c', 'e', 'b', 'd'],\n },\n {\n what: 'puts rows without a value first ascending when the term says so',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag, { nulls: 'first' }))),\n input: {},\n expected: ['a', 'c', 'b', 'd', 'e'],\n },\n {\n what: 'puts rows without a value last descending when the term says so',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag, { nulls: 'last' }))),\n input: {},\n expected: ['e', 'b', 'd', 'a', 'c'],\n },\n {\n what: 'breaks a tie by the id where the order does not say how',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the field the input chose, ascending',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'asc' } },\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders by the field the input chose, descending, the next term breaking the tie',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'desc' } },\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the terms after a chosen order when the input chose none',\n body: from.pipe(chosen),\n input: { sort: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n // ---- text, ordered by a declared collation -------------------------------\n {\n what: 'orders text by code point under a binary collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.binary })),\n ),\n input: {},\n expected: ['d', 'a', 'c', 'b', 'e'],\n },\n {\n what: 'orders text with ASCII case folded under an asciiFold collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.asciiFold })),\n ),\n input: {},\n expected: ['d', 'a', 'b', 'c', 'e'],\n },\n // Ordering by text with no declared collation is deliberately not here. How text compares is the\n // backend's — SQLite by code point, TanStack by locale, Postgres by whatever\n // the database was created with — and §6.0.1 puts it outside the conformant\n // subset rather than pretending one of them is the rule. A case asserting an\n // order would only pin whichever engine was written first.\n\n // ---- defined operators -----------------------------------------------------\n {\n what: 'a defined operator matches the rows what it means does',\n body: from.pipe(Query.where(tagged(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a defined operator under not is the negation of what it means',\n body: from.pipe(Query.where(Expr.not(tagged(Subject.fields.tag))), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'a defined operator over an input only is decided by the request',\n body: from.pipe(Query.where(Expr.or(tagged(maybeTag), Expr.eq(Subject.fields.rank, 3))), byId),\n input: { maybeTag: null },\n expected: ['c', 'd'],\n },\n {\n what: 'a defined scalar operator compares as what it means',\n body: from.pipe(Query.where(Expr.eq(rankOf(Subject.fields.rank), 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n]\n\nconst prefix = Expr.input('prefix', Schema.NullOr(Schema.String))\nconst asciiFold = { collation: Collation.asciiFold }\n\n/**\n * Bodies calling the kernel's primitive operators (`Text.startsWith`). An\n * interpreter runs these once it implements them: the in-memory one through\n * `Operators.kernel`, a compiler through its own table.\n */\nexport const primitiveCases: ReadonlyArray<ConformanceCase> = [\n {\n what: 'startsWith under binary is exact about case',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'In', binary)), byId),\n input: {},\n expected: ['a'],\n },\n {\n what: 'startsWith under asciiFold folds ASCII case on both sides',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'IN', asciiFold)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'startsWith the empty prefix holds for every row with text',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'startsWith over null text is unknown, so its rows are not matched',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.tag, '', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'startsWith a null prefix is unknown for every row',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: null },\n expected: [],\n },\n {\n what: 'startsWith reads % and _ as characters, never as like wildcards',\n body: from.pipe(\n Query.where(\n Expr.or(\n Text.startsWith(Subject.fields.label, '100%', binary),\n Text.startsWith(Subject.fields.label, 'sn_', binary),\n Text.startsWith(Subject.fields.label, 'O%', binary),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'startsWith under not keeps a null unknown',\n body: from.pipe(Query.where(Expr.not(Text.startsWith(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: ['e'],\n },\n]\n\n/**\n * A body whose answer no two interpreters agree on, so every interpreter must\n * refuse it rather than answer. Run each through yours and expect a failure.\n */\nexport interface ConformanceRefusal {\n readonly what: string\n readonly body: AnyQuery\n /** The inputs, encoded, as in `ConformanceCase`. */\n readonly input: Readonly<Record<string, unknown>>\n}\n\nconst NUL = String.fromCharCode(0)\n\nexport const refusals: ReadonlyArray<ConformanceRefusal> = [\n // Postgres text cannot hold NUL and SQLite's `like` stops at it.\n {\n what: 'contains refuses a search holding NUL',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: `in${NUL}` },\n },\n {\n what: 'a comparison refuses text holding NUL',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, label, { collation: Collation.binary })),\n byId,\n ),\n input: { label: `b${NUL}` },\n },\n {\n what: 'contains refuses searched text holding NUL',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: `a${NUL}b`, label: 'b' },\n },\n // SQLite stores NaN as null; Postgres orders it after every number, equal to itself.\n {\n what: 'an equality refuses NaN',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, below)), byId),\n input: { below: Number.NaN },\n },\n {\n what: 'a comparison refuses NaN',\n body: from.pipe(Query.where(Expr.gt(Subject.fields.rank, below)), byId),\n input: { below: Number.NaN },\n },\n {\n what: 'a membership test refuses a list holding NaN',\n body: from.pipe(\n Query.where(Expr.in(Subject.fields.rank, Expr.input('ranks', Schema.Array(Schema.Number)))),\n byId,\n ),\n input: { ranks: [1, Number.NaN] },\n },\n]\n\n/** As `refusals`, for bodies calling the kernel's primitive operators. */\nexport const primitiveRefusals: ReadonlyArray<ConformanceRefusal> = [\n {\n what: 'startsWith refuses a prefix holding NUL',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: `In${NUL}` },\n },\n]\nexport * from './operator.js'\nexport * from './relational.js'\nexport * from './variants.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,YAAY,OAAO,KAAK,KAC5B,OAAO,SAAS,OAAO,QAAQ;CAC7B,QAAQ,aAAa,WAAW,QAAgB,IAAI,KAAK,GAAG,CAAC;CAC7D,QAAQ,aAAa,WAAW,OAAa,GAAG,YAAY,CAAC;AAC/D,CAAC,CACH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OAAO;EAAI;CACxC;CAEA;EACE,MAAM;EACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,GAAG,QAAQ,OAAO,MAAM,KAAK,CAAC,GAAG,IAAI;EACtE,OAAO,EAAE,OAAO,IAAW;CAC7B;CACA;EACE,MAAM;EACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,GAAG,QAAQ,OAAO,MAAM,KAAK,CAAC,GAAG,IAAI;EACtE,OAAO,EAAE,OAAO,IAAW;CAC7B;CACA;EACE,MAAM;EACN,MAAM,KAAK,KACT,MAAM,MAAM,KAAK,GAAG,QAAQ,OAAO,MAAM,KAAK,MAAM,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC,CAAC,CAAC,GAC1F,IACF;EACA,OAAO,EAAE,OAAO,CAAC,GAAG,GAAU,EAAE;CAClC;AACF;;AAGA,MAAa,oBAAuD,CAClE;CACE,MAAM;CACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,QAAQ,OAAO,OAAO,QAAQ,MAAM,CAAC,GAAG,IAAI;CACxF,OAAO,EAAE,QAAQ,KAAK,MAAM;AAC9B,CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as Collation } from "../collation-BB4YTIbY.js";
|
|
2
|
-
import { Kt as MemoryOperators, Mn as Operandish, Pn as Operator, Xt as TestedEvidence, gr as LawDescription } from "../index-48JeXG0A.js";
|
|
3
1
|
import { Data, Option, Schema } from "effect";
|
|
2
|
+
import { Collation, LawDescription, MemoryOperators, Operandish, Operator, TestedEvidence } from "../index.js";
|
|
4
3
|
/** What an implementation said of one call: a value, or that it refused it. */
|
|
5
4
|
export type Outcome = Data.TaggedEnum<{
|
|
6
5
|
Value: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","names":[],"sources":["../../src/conformance/operator.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operator.d.ts","names":[],"sources":["../../src/conformance/operator.ts"],"mappings":";;;YAiCY,UAAU,KAAK;EACzB;aAAkB;;EAClB;aAAoB;;;qBAET,SAAO,KAAA,WAAA;;WAFU;;;WADH;;;;;;;YAUf,cAAc,KAAK;EAC7B;aAAkB,UAAU,cAAc;;EAC1C;aACW,KAAK;;aAEL;;EAEX;aACW,KAAK;aACL,MAAM;;aAEN,WAAW,OAAO,OAAO;aACzB,MAAM;aACN,OAAO;;;qBAGP,aAAW,KAAA,WAAA;;WARN,KAAA;WACC,MAAA;WAEK,WAAA,OAAO,OAAO;WACnB,MAAA;WACC,OAAA;;;WAZU,UAAA,cAAc;;;WAE1B,KAAA;WAEG;;;;;;YAiBT,UAAU,MAAM;;iBAGX;WACN,MAAM;WACN,WAAW,OAAO,OAAO;WACzB,UAAU,SAAS,eAAe;;iBAG5B;;WAEN;WACA,eAAe,cAAc;;qBAuV3B;;EAEX,SAAM,WACQ,oBAAkB;;;;;;;;EAWhC,OAAO,WAAW,cAAc,OAAO,MAAM,YAAY,OAAO,KAAG,IAC7D,SAAS,IAAI,MAAI,WACV,iBAAe;aAEf;aACA;aACA;QAEV;;;;;;EAyBH,SAAe,WAAW,cAAc,OAAO,MAAM,YAAY,OAAO,KAAG,IACrE,SAAS,IAAI,MAAI,KAChB,QAAM;aAEA;aACA;aACA;QAEV,QAAQ;;;;;;;;;;EAkCX,WAAiB,WAAW,cAAc,OAAO,MAAM,YAAY,OAAO,KAAG,IACvE,SAAS,IAAI,MAAI;aAEV,iBAAiB,SAAS,eAAe;aACzC,QAAQ,cAAc;aACtB;aACA;aACA,iBAAiB;QAE3B,QAAQ"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Law } from "../
|
|
3
|
-
import { Expr } from "../expr.js";
|
|
1
|
+
import { Data, Option, Schema, SchemaAST } from "effect";
|
|
2
|
+
import { Collation, Evidence, Expr, Law, Operators, QueryEvaluateError, valueOfOperand } from "../index.js";
|
|
4
3
|
import { stampRun, stampTested } from "../tested.js";
|
|
5
|
-
import { Evidence, Operators } from "../operators.js";
|
|
6
|
-
import { QueryEvaluateError, valueOfOperand } from "../evaluate.js";
|
|
7
4
|
import { tuplesOf } from "./tuples.js";
|
|
8
|
-
import { Data, Option, Schema, SchemaAST } from "effect";
|
|
9
5
|
// src/conformance/operator.ts
|
|
10
6
|
/**
|
|
11
7
|
* An operator held to what it declares (expr-operations-DESIGN §10.4): its
|