basalt / prisma/src / crossTenantScan
Function: crossTenantScan()
> crossTenantScan(client, name, args?): Promise<CrossTenantScanRow[]>
Defined in: prisma/src/cross-tenant.ts:396
Calls a scan function generated by crossTenantScanSql and returns its identifier rows — { tenantId, id }, plus any further identifier column declared in args.columns.
const stuck = await crossTenantScan(db, 'stuck_jobs', { limit: 200 })
This is a raw query, and a deliberate RLS bypass, so it is not exempt from the PRISMA_RAW_IN_TENANT guard the way the internal set_config statement is: that statement is provably harmless (it names the tenant already in scope), while this one reads across every tenant. Instead it refuses to run at all while a tenant is in scope (CrossTenantScanInTenantError) — a sweep is central code by definition. Called from central code, no tenant is in scope, so the raw guard never fires.
Any client works: the extended one (outside tenant scope the extension lets raw queries through) or a plain PrismaClient.
Parameters
client
unknown
name
string
args?
CrossTenantScanArgs = {}
Returns
Promise<CrossTenantScanRow[]>