Browse modulesTenancyFunctions
Function: withTenantScope()
function withTenantScope<TClient extends ScopeableClient>(client: TClient, config: TenancyConfig): TClient;Defined in: server/tenancy/client.ts:172
Wrap a Prisma client with the app-layer read-scope belt: on a tenant
binding, AND the tenant column into every non-unique read of a tenant model.
This is the belt; the RLS GUC pinned by withTenantTransaction is the
suspenders (it also closes the by-id / raw / write paths this can't).
Register the returned client as your ambient Prisma client so repositories and taproot features share the one enforced instance.
Type Parameters
| Type Parameter |
|---|
TClient extends ScopeableClient |
Parameters
| Parameter | Type |
|---|---|
client | TClient |
config | TenancyConfig |
Returns
TClient