Remote / foldkit-remote-drizzle
source
function · packages/remote-drizzle/src/index.ts:336
function source<P = unknown>(
binding: AnyEntityBinding,
options?: {
readonly authorize?:
EntitySource<P, DrizzleDatabase>['authorize'] | undefined
readonly filter?: EntitySource<P, DrizzleDatabase>['filter'] | undefined
readonly shared?: ReadonlyArray<string> | undefined
readonly policies?:
| Readonly<
Record<string, ((principal: P) => SQL | undefined) | undefined>
>
| undefined
},
): EntitySource<P, DrizzleDatabase>A RemoteServer.entity source backed by the DrizzleDatabase service. It
selects the requested columns in one batch, then resolves each selected
relation: a one relation becomes a ref key, and a many relation loads the
target ids in one IN (...). options.policies adds a principal-scoped filter
to a collection relation (e.g. only rows this principal may see), and
options.filter decides what a principal sees of each record, as
RemoteServer.entity's does.