Remote / API
foldkit-remote-drizzle
foldkit-remote-drizzle — provisional compiler from Remote
Entity/Selection/Query to Drizzle's typed query graph.
It captures no connection and re-plans nothing: Remote.plan already produces
entity + id + field batches, so this maps a Selection's fields to Drizzle
columns. Each entity is declared once with entity(name, table), which is
both the Drizzle binding and the Remote EntityDescriptor.
Keyset pagination and required-column projection are adapted from fate's
Drizzle integration (MIT); see THIRD_PARTY_NOTICES.md.
Functions
applyEdits | A journal's apply for foldkit-sync's editsJournal: one committed cell edit, written to its column with the sequence it committed at as the row's revision,… |
bind | Binds every Entity of an Entity.relate result to its table in one step, so a relation's target binding can be one that is declared after its owner. |
buildPage | |
checkFields | Every field the body reads has a column here, and every operation it needs is one this compiler runs. Checked once, when the source is registered, so a… |
collatedColumn | The column under the term's collation, and a cursor value made comparable to it; none when the column compares as it is (no collation, or binary on a… |
compileOrderBy | The body's ordering for one input, as this package's order terms: a chosen order resolved to the field the input names. An input naming no order it offers… |
compileWhere | The body's predicates, as the SQL fragments this request needs. Each is separate: the caller conjoins them with whatever else applies, so a body cannot… |
cursorSelection | The tuple columns to re-read for a cursor, keyed as Drizzle select aliases. |
databaseLayer | Provides a Drizzle database as the DrizzleDatabase service. Any Drizzle database qualifies; the cast is confined here because its builder is generic over… |
entity | |
idColumn | |
keyCursor | A cursor holding the order's key values at the row a page ended on, the id among them: where the page ended, whatever that row does after. None when a value… |
keysetWhere | (a CMP A) OR (a = A AND b CMP B) OR ... — the lexicographic predicate that keeps a page contiguous under a multi-column order. forward selects rows after… |
many | |
manyToMany | |
normalize | Maps rows a mutation returned (e.g. Drizzle returning) to entity patches, rewriting a one relation's foreign key to its ref key. fields is the set of… |
orderByTerms | The ORDER BY for a traversal, nulls placed as the term says: backward reverses each term, its nulls with it. |
projectsAny | Whether at least one requested field maps to a column, relation, or computed value. |
query | A RemoteServer.query source over a keyset-paginated table. The connection's cursor is the row identity; a requested cursor's ordering tuple is re-read… |
readCursor | What a cursor says: the key values a keyed one holds, checked against the order it pages (a client sends it, so nothing is trusted that is not one of these… |
reader | A pruned reader backed by an injected executor. Use it when the database is not an Effect service, or to test the projection without one. |
runStatement | A statement, failing as a RemoteServerError that says only failed. The driver's error carries the SQL and its parameters: it is logged for operators and… |
selectColumns | The column map for the requested scalar and relation fields. The primary key is always selected: normalization needs it even when the client did not ask for… |
shapeWindow | |
sortTerms | The order a client asked for, as order terms. sort names one of the orders the server offers, never a column: columns is the server's say in what each name… |
source | A RemoteServer.entity source backed by the DrizzleDatabase service. It selects the requested columns in one batch, then resolves each selected relation: a… |
toQueryPage | |
whereIds | A whole id batch as one IN (...) — the normalized-store advantage. |
writer | Where a declared Write lands in this table, for RemoteServer.write: one update ... returning of the row by id, setting each field's column to its value as… |
Values
CursorRead | What a cursor says: where its page ended, an id from before keys, or nothing this server minted. |
drizzleWrites | The provided database's writes. DrizzleDatabaseService names only the reads a source makes, so a test can fake it with select; a Drizzle database has these… |
one | A ref field; with nullable: true the ref may be null, as the column may. |
returning | The returning columns for fields and the normalization of the rows they yield, paired so a mutation cannot select one set of columns and normalize another. |
supported | The operations this compiler turns into SQL. Declared rather than implied by which cases predicate happens to handle, so a body needing something else is… |
Classes
Interfaces
CompileTarget | What a binding has to offer to be compiled against: a column per field key, and the table, whose dialect decides how text folds. |
ComputedConfig | An aggregate over a collection relation, attached to each owning row. |
CountDerived | |
DrizzleDatabaseService | |
DrizzleSelect | |
DrizzleStatement | |
DrizzleWrite | A write statement: awaited for its effect, or asked for the columns it wrote. |
DrizzleWrites | The writes any Drizzle database for SQLite or Postgres offers, typed by each table's columns. |
EntityBinding | |
InverseOneStorage | A one relation from the other side: the foreign key is a column of the target's table, as a user's profile points at its user. One-to-one only holds if that… |
ManyRelation | The foreign key lives on the target table. |
ManyStorage | A many relation whose foreign key is a column of the target's table. |
ManyToManyRelation | Joined through a table: localColumn references the owner's id. |
OneRelation | The foreign key lives on the owning table. |
OneStorage | A one relation: the foreign key is a column of the owner's table. |
OrderTerm | |
Page | |
QueryEdge | |
QueryPage | |
SourceQuery | |
SuppliedDerived | A derived member this package does not compute: the application supplies it, by wrapping the source and answering for the field itself. bind registers the… |
ThroughStorage | A many relation joined through a table: localColumn references the owner's id. |
WindowOptions | |
WindowShape |
Types
AnyEntityBinding | A binding with its derived field map erased. The field map is invariant through EntityDescriptor.ref, so a concrete binding is not assignable to… |
EntityStorage | |
RelationBinding | |
Traversal | |
Visible | The rows of a table a principal may see, as a condition over that table's columns, or an Effect of one for a rule that must ask something first. It is given… |