Function: deriveTenantScope()
function deriveTenantScope(stacks, entitlement): Promise<TenantScope>;
Defined in: packages/client/src/core/sync/tenants.ts:77
Compiles an entitlement into the stacks it reaches and the class rules it needs.
A stack is served when its name is an entitled tenant - a tenant is a stack - or when it holds at least one class declared for an entitled tenant. Within a served stack:
- classes declared for an entitled tenant travel;
- tenant-neutral classes follow their stack: they travel when the stack itself is the entitled tenant, which is what keeps a datamodel with no declarations at today's behavior exactly;
- classes declared only for other tenants are excluded.
Resolved once per call, the way the sync layer resolves ephemeral classes when a
replication starts (ADR-0028): a declaration that changes later takes effect on the
next sync(), never silently mid-stream.
Parameters
| Parameter | Type | Description |
|---|---|---|
stacks | ClientStack[] | The candidate stacks, typically every open stack. |
entitlement | string[] | The tenant names this channel may see. |
Returns
Promise<TenantScope>
Which stacks to serve, and per-stack class rules where needed.