accessWhere() function
Compose the access-scope where clause for a single model.
Signature:
export declare function accessWhere(where: Record<string, unknown> | undefined, config: Record<string, string[]> | undefined, resolvers: Record<string, AccessScopeResolver>): Record<string, unknown> | undefined;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
where |
Record<string, unknown> | undefined |
The caller's own filter, or undefined. |
|
config |
Record<string, string[]> | undefined |
Scope columns per level for this one model, or undefined when the model is not scoped. |
|
resolvers |
Record<string, AccessScopeResolver> |
One resolver per access level, keyed by level name. |
Returns:
Record<string, unknown> | undefined
The combined filter, or where unchanged when the model is not scoped or no level is active — returned by identity, so callers can compare.
Remarks
Each active level — one whose resolver returns anything other than undefined — contributes an OR across its columns, and the level filters are AND-ed together and AND-ed onto the caller's own where. Nothing is merged by key, so a caller cannot widen or override the scope by supplying a condition on a scope column.
This is the pure half of the mechanism, exported so the composition can be tested and reused directly; accessScope() is what applies it to queries.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.