feat(tenancy): add multi-tenancy primitives (@quatrain/tenancy) #45
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
qa:preview
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quatrain/core!45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/tenancy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
New package
@quatrain/tenancy(1.0.0-beta.0) for an instance shared by several customers:TenantandMembershipmodels stored through any backend adapter byTenancyRepository, an in-memory store, and theTenantStoreInterfaceport. Slugs and (tenant, user) pairs are unique.currentTenant()) that refuses to switch tenant inside a unit of work, and an envelope to carry the scope through a queue.TenantResources: one lazily built resource per tenant, rebuilt when what it is built from changes.The package knows nothing about HTTP frameworks or authentication. Data isolation is enforced where the data lives.
Depends on #33 and on #44
This branch is built on
feat/backend-postgres-row-isolation, itself built onfeat/backend-unique-properties. Until both are merged, the diff also shows their commits; merge them first, in that order.Tests
Unit tests run without a database.
PostgresIsolation.test.tscovers the PostgreSQL set-up end to end (registry and data in one database, restricted role, rows isolated per tenant) and is skipped without a database.To decide
src/, so they are published with the package.1.0.0-beta.0.Closes #43
🤖 Generated with Claude Code