ui/account_sessions_state.svelte.ts

Reactive state for managing the authenticated account's auth sessions on a settings page. Reads and mutations flow through a narrow RPC adapter backed by auth/account_actions.ts.

Holds two AsyncSlots — list for the fetch, revoke_all for the bulk revoke — plus one KeyedAsyncSlot<string, void> (revoke) keyed by session_id for per-row revoke (independent supersession across concurrent rows; per-row error surfacing). Method names use the submit_* prefix to avoid slot-name collisions.

view source

Declarations
#

4 declarations

account_sessions_rpc_context
#

ui/account_sessions_state.svelte.ts view source

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

Svelte context carrying the reactive AccountSessionsRpc accessor. Mirrors the admin-side RPC contexts. get() throws when no provisioner ran above the component — the adapter is required.

AccountSessionsRpc
#

ui/account_sessions_state.svelte.ts view source

AccountSessionsRpc import type {AccountSessionsRpc} from '@fuzdev/fuz_app/ui/account_sessions_state.svelte.js';

Narrow RPC surface consumed by AccountSessionsState. Consumers adapt their typed RPC client to this shape. Mirrors the other per-domain *Rpc interfaces (AdminAccountsRpc, AuditLogRpc, AdminInvitesRpc): each method takes its action's input as one params object typed from the action spec, or nothing for an input-less one.

The three methods wrap the corresponding action specs on auth/account_actions.ts:

  • list → account_session_list
  • revoke → account_session_revoke (IDOR-guarded by account_id server-side)
  • revoke_all → account_session_revoke_all

list

type (): Promise<{ sessions: { id: Branded<string, "SessionId">; account_id: Branded<string, "Uuid">; created_at: string; expires_at: string; is_current: boolean; }[]; }>

returns Promise<SessionListOutput>

revoke

type (params: { session_id: Branded<string, "SessionId">; }): Promise<{ ok: true; revoked: boolean; }>

params

returns Promise<SessionRevokeOutput>

revoke_all

type (): Promise<{ ok: true; count: number; }>

returns Promise<SessionRevokeAllOutput>

AccountSessionsState
#

ui/account_sessions_state.svelte.ts view source

import {AccountSessionsState} from '@fuzdev/fuz_app/ui/account_sessions_state.svelte.js';

list

type AsyncSlot<void, string>

readonly

revoke

type KeyedAsyncSlot<string, void, string>

readonly

revoke_all

type AsyncSlot<void, string>

readonly

sessions

type AuthSessionJson[]

$state.raw

active_count

type number

readonly $derived

constructor

type new (options: AccountSessionsStateOptions): AccountSessionsState

options

fetch

type (): Promise<void>

returns Promise<void>

submit_revoke

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

id

type Branded
returns Promise<void>

submit_revoke_all

type (): Promise<void>

returns Promise<void>

AccountSessionsStateOptions
#

ui/account_sessions_state.svelte.ts view source

AccountSessionsStateOptions import type {AccountSessionsStateOptions} from '@fuzdev/fuz_app/ui/account_sessions_state.svelte.js';

get_rpc

Reactive accessor for the RPC adapter. Matches the get_rpc pattern on the admin state classes.

type (): AccountSessionsRpc

Depends on
#

Imported by
#