Skip to content

currentTenantId

currentTenantId(): string | undefined

Defined in: tenant-scope.ts:42

Returns the current tenant: that of the innermost runWithTenant call or running pipeline, or undefined outside both. A running pipeline’s tenant is its context.tenantId, which it took from here when it started.

string | undefined

The current tenant id, or undefined for none.

runWithTenant('tenant_a', () => currentTenantId()); // 'tenant_a'