Remote / foldkit-remote-drizzle
Field authorization stays in RemoteServer
The adapter never decides what a principal may read. It compiles only the fields
RemoteServer has already allowed:
const UserSource = source(User, {
authorize: (principal, fields) =>
fields.filter(field => field !== 'email' || principal.canReadEmail),
})Conceptually:
client asks for [id,name,email]
|
v
RemoteServer authorize
|
v
allowed [id,name]
|
v
Drizzle source
SELECT id,name ...filter is RemoteServer.entity's per-record decision, passed through the
same way: the Source reads the fields its plan names, and RemoteServer
applies the plan to each record. foldkit-guard/server's GuardServer.filter
is one.
shared names the fields every principal reads alike, of every row, so a live
hub sends a declared write's value of one without a read per principal (see
foldkit-remote-server's "Fields every principal reads alike").
A request for a field the Entity does not declare never reaches the read. The Source still always selects the id needed to normalize rows.
reader(binding, run) is the lower-level injected-executor form when the
database is not provided as the DrizzleDatabase service or when you want to
test the projection compiler directly. It handles scalar and singular-ref
normalization, but collection loading/computed fields belong to source.