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

applyEditsA 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,…
bindBinds 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
checkFieldsEvery 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…
collatedColumnThe 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…
compileOrderByThe 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…
compileWhereThe 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…
cursorSelectionThe tuple columns to re-read for a cursor, keyed as Drizzle select aliases.
databaseLayerProvides a Drizzle database as the DrizzleDatabase service. Any Drizzle database qualifies; the cast is confined here because its builder is generic over…
entity
idColumn
keyCursorA 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
normalizeMaps 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…
orderByTermsThe ORDER BY for a traversal, nulls placed as the term says: backward reverses each term, its nulls with it.
projectsAnyWhether at least one requested field maps to a column, relation, or computed value.
queryA 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…
readCursorWhat 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…
readerA pruned reader backed by an injected executor. Use it when the database is not an Effect service, or to test the projection without one.
runStatementA 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…
selectColumnsThe 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
sortTermsThe 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…
sourceA RemoteServer.entity source backed by the DrizzleDatabase service. It selects the requested columns in one batch, then resolves each selected relation: a…
toQueryPage
whereIdsA whole id batch as one IN (...) — the normalized-store advantage.
writerWhere 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

CursorReadWhat a cursor says: where its page ended, an id from before keys, or nothing this server minted.
drizzleWritesThe 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…
oneA ref field; with nullable: true the ref may be null, as the column may.
returningThe 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.
supportedThe 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

CompileTargetWhat a binding has to offer to be compiled against: a column per field key, and the table, whose dialect decides how text folds.
ComputedConfigAn aggregate over a collection relation, attached to each owning row.
CountDerived
DrizzleDatabaseService
DrizzleSelect
DrizzleStatement
DrizzleWriteA write statement: awaited for its effect, or asked for the columns it wrote.
DrizzleWritesThe writes any Drizzle database for SQLite or Postgres offers, typed by each table's columns.
EntityBinding
InverseOneStorageA 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…
ManyRelationThe foreign key lives on the target table.
ManyStorageA many relation whose foreign key is a column of the target's table.
ManyToManyRelationJoined through a table: localColumn references the owner's id.
OneRelationThe foreign key lives on the owning table.
OneStorageA one relation: the foreign key is a column of the owner's table.
OrderTerm
Page
QueryEdge
QueryPage
SourceQuery
SuppliedDerivedA derived member this package does not compute: the application supplies it, by wrapping the source and answering for the field itself. bind registers the…
ThroughStorageA many relation joined through a table: localColumn references the owner's id.
WindowOptions
WindowShape

Types

AnyEntityBindingA 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
VisibleThe 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…