@cqrs-ddd/pipeline-tenant
v0.6.0
Published
The current tenant: the running pipeline's tenant, or the tenant of a runWithTenant scope
Maintainers
Readme
@cqrs-ddd/pipeline-tenant
The current tenant of an execution, kept in AsyncLocalStorage: runWithTenant(id, fn)
sets it for everything fn calls, currentTenantId() reads it, and tenantSource hands
it to createPipeline({ sources }) of @cqrs-ddd/pipeline, so every pipeline runs in the
tenant of the work that started it. No dependencies, no framework.
Documentation: guide · API reference · all packages
Installation
pnpm add @cqrs-ddd/pipeline-tenantRequires Node.js 22.12 or later. Published as an ES module; a CommonJS application loads
it with require().
Example
import { currentTenantId, runWithTenant } from '@cqrs-ddd/pipeline-tenant';
await runWithTenant('acme', async () => {
currentTenantId(); // 'acme'
});License
Dual-licensed under AGPLv3 and a Commercial License. See LICENSE and
COMMERCIAL_LICENSE.txt.
