scopePredicate() function
Compose the scope predicate for one table, or null when nothing constrains it.
Signature:
export declare function scopePredicate(qualifier: string, levels: Record<string, string[]> | undefined, resolvers: Record<string, AccessScopeResolver>): AnyExpression | null;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
qualifier |
string |
Table alias or name to build columns against. |
|
levels |
Record<string, string[]> | undefined |
Scope columns per level for this one table. |
|
resolvers |
Record<string, AccessScopeResolver> |
One resolver per access level. |
Returns:
AnyExpression | null
The predicate, or null when no level is active.
Remarks
Each active level contributes an OR across its columns and the levels are AND-ed together. Exported so the composition can be tested without a database — getting it inverted leaks rows rather than raising an error.
A level configured with no columns yields an empty OR, which Postgres reads as FALSE: it denies everything. That is the safe direction, and it is what an empty column list should mean.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.