Skip to content

basalt / prisma/src / applyTenantScope

Function: applyTenantScope() ​

> applyTenantScope(operation, args, tenantId, field): QueryArgs

Defined in: prisma/src/extension.ts:309

Pure transformation: returns the args scoped to the tenant. Reads and writes are both covered — a caller cannot escape the current tenant, new rows (including nested creates) always carry the tenant field, relation writes are narrowed to the tenant, and an update cannot change the tenant field. An operation it does not know throws UnscopedOperationError (fail closed) instead of running unscoped.

Parameters ​

operation ​

string

args ​

QueryArgs | undefined

tenantId ​

string

field ​

string

Returns ​

QueryArgs

Released under the MIT License.