// Streaming subscription of the tenant's teammate invites. Tenant-scoped like // projects.list — read live from the frontend's team page with // `useSubscription('invites.list')`. import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const listInvites = defineQuery({ name: 'invites.list', // Members only — and of the four domain procedures this is the one whose // guard is load-bearing rather than tidy: the rows are teammates' EMAIL // ADDRESSES. `tenant()` keeps them inside the tenant; this keeps them away // from a caller who has not signed in to that tenant at all. // // Satisfiable as shipped: a matched session gets `team:read` from // `auth.resolveScopes` (authz.ts). Anonymous callers hold no scopes and are // refused with a typed `ScopeError`. guards: [{ scope: 'team:read' }], input: Schema.Struct({}), output: Schema.Array( Schema.Struct({ id: Schema.String, email: Schema.String, status: Schema.String, tenantId: Schema.String, createdAt: Schema.Date, }), ), })