/** Access level a single collection can be granted at. */ export declare type Level = 'none' | 'read' | 'full'; export declare type Selection = { /** `null` means nothing has been chosen yet, which the form's v8n rule rejects. */ preset: 'store' | 'read' | 'custom' | null; /** Level per collection, keyed by the tokens in `COLLECTIONS`. Always fully populated. */ levels: Record; /** Collections with their own `_resend` token. The API includes resend in `full`. */ resend: string[]; /** * Tokens this UI does not model, carried through untouched. `client_full_access` and * `user_full_access` are valid grants the API accepts but the matrix cannot express, so * dropping them on a round trip would silently revoke access the invitation already had. */ extra: string[]; }; /** Parses an invitation's space-separated `scope` string into a UI selection. */ export declare function parseScope(scope: string | undefined): Selection; /** Serializes a UI selection back into a space-separated `scope` string. */ export declare function serializeScope(selection: Selection): string; /** The granter's own scope, prepared for membership checks. */ export declare type Grantable = { storeFullAccess: boolean; tokens: Set; }; /** * Prepares the granting user's scope for grantability checks. * * The server is the enforcement boundary — it rejects any * token the granter does not hold. These helpers exist so the UI never offers a grant that * would be rejected, not to implement the restriction. */ export declare function getGrantable(granterScope: string | undefined): Grantable; /** Whether the granter can give `collection` at `level`. */ export declare function canGrantLevel(grantable: Grantable, collection: string, level: Level): boolean; /** Whether the granter can give `collection` a resend grant. */ export declare function canGrantResend(grantable: Grantable, collection: string): boolean; /** * Whether the "read-only access to everything" preset can be offered. * * It is hidden unless the granter can deliver all 20 reads. Silently redefining it as * "read-only on whatever I happen to be able to share" would make one preset mean different * things to different admins, which is a worse trap than an absent option — `Custom` covers * the gap. */ export declare function canGrantReadPreset(grantable: Grantable): boolean;