ui/admin_invites_state.svelte.ts

Reactive state for admin invite management.

Flows every operation through an injected AdminInvitesRpc adapter — the class stays decoupled from the concrete RPC client so tests can inject plain-function stubs. Mirrors AdminAccountsRpc / AuditLogRpc.

Holds two AsyncSlots — list (fetch) and create (singular write) — plus one KeyedAsyncSlot<Uuid> (remove) for the per-row delete with correct per-row supersession and per-row error surfacing. Method names use the submit_* prefix to avoid slot-name collisions (delete is reserved at top-level positions; renamed for symmetry).

view source

Declarations
#

4 declarations

admin_invites_rpc_context
#

ui/admin_invites_state.svelte.ts view source

{ get: (error_message?: string | undefined) => () => AdminInvitesRpc; get_maybe: () => (() => AdminInvitesRpc) | undefined; set: (value: () => AdminInvitesRpc) => () => AdminInvitesRpc; } import {admin_invites_rpc_context} from '@fuzdev/fuz_app/ui/admin_invites_state.svelte.js';

Svelte context carrying the reactive AdminInvitesRpc accessor. Mirrors admin_accounts_rpc_context. get() throws when no provisioner ran above the component — the adapter is required.

AdminInvitesRpc
#

ui/admin_invites_state.svelte.ts view source

AdminInvitesRpc import type {AdminInvitesRpc} from '@fuzdev/fuz_app/ui/admin_invites_state.svelte.js';

Narrow RPC surface consumed by AdminInvitesState. Consumers adapt their typed RPC client to this shape. error.data.reason on thrown errors carries the ERROR_INVITE_* constant — handled by the caller when user-friendly messages are needed. Method signatures track the wire spec types directly so the adapter needs no casts.

list

type (params?: { acting?: Branded<string, "Uuid"> | undefined; } | undefined): Promise<{ invites: { created_by_username: string | null; claimed_by_username: string | null; id: Branded<string, "Uuid">; ... 5 more ...; created_by: Branded<...> | null; }[]; }>

params?

optional
returns Promise<InviteListOutput>

create

type (params: { email?: string | null | undefined; username?: string | null | undefined; acting?: Branded<string, "Uuid"> | undefined; }): Promise<{ ok: true; invite: { id: Branded<string, "Uuid">; ... 5 more ...; created_by: Branded<...> | null; }; }>

params

returns Promise<InviteCreateOutput>

delete

type (params: { invite_id: Branded<string, "Uuid">; acting?: Branded<string, "Uuid"> | undefined; }): Promise<{ ok: true; }>

params

returns Promise<InviteDeleteOutput>

AdminInvitesState
#

ui/admin_invites_state.svelte.ts view source

import {AdminInvitesState} from '@fuzdev/fuz_app/ui/admin_invites_state.svelte.js';

list

type AsyncSlot<void, string>

readonly

create

type AsyncSlot<void, string>

readonly

remove

type KeyedAsyncSlot<Branded, void, string>

readonly

invites

type InviteWithUsernamesJson[]

$state.raw

invite_count

type number

readonly $derived

unclaimed_count

type number

readonly $derived

constructor

type new (options: AdminInvitesStateOptions): AdminInvitesState

options

fetch

type (): Promise<void>

returns Promise<void>

submit_create

type (email?: string | undefined, username?: string | undefined): Promise<boolean>

email?

type string
optional

username?

type string
optional
returns Promise<boolean>

submit_delete

type (id: Branded<string, "Uuid">): Promise<void>

id

type Branded
returns Promise<void>

AdminInvitesStateOptions
#

Depends on
#

Imported by
#