Entity / foldkit-entity

What it owns

foldkit-entity owns domain structure: which members an entity has, what kind each is, and which entity a relation points to. It also owns the meaning of the declarations made over it: what a query body, a declared write and an invariant say, as values every interpreter reads the same way.

It does not own:

  • Validity of one value. entity.schema is an ordinary Effect Schema.Struct and stays the rule for a value. An invariant adds only what a Schema cannot judge: a rule across fields, or between a row before and after a write.
  • Storage or fetching. A relation says "one Author", not "a foreign key" or "a join table". A query body fetches nothing; foldkit-remote-drizzle compiles it, and foldkit-remote judges the rows it holds by it.
  • Operations. An Entity implies no create, update, or delete. A Write is declared by an operation, and an Entity having a field grants no one the right to set it.
  • Who may. Authorization is foldkit-guard's, written in the same Expr.
  • Application state. Nothing here touches a Model or dispatches a Message.