ui/app_settings_state.svelte.ts

Reactive state for admin app settings management.

Flows every operation through an injected AppSettingsRpc adapter — mirrors AdminInvitesRpc / AuditLogRpc. Tests can inject plain-function stubs and consumers adapt their typed RPC client to the same shape.

Holds two AsyncSlots — list (the initial fetch) and update (the app_settings_update write). Slots track status/error; the canonical settings lives on the class so consumers don't unwrap slot.data.

view source

Declarations
#

4 declarations

app_settings_rpc_context
#

ui/app_settings_state.svelte.ts view source

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

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

AppSettingsRpc
#

ui/app_settings_state.svelte.ts view source

AppSettingsRpc import type {AppSettingsRpc} from '@fuzdev/fuz_app/ui/app_settings_state.svelte.js';

Narrow RPC surface consumed by AppSettingsState. Consumers adapt their typed RPC client to this shape. Method signatures track the wire spec inputs/outputs directly so the adapter needs no casts.

get

type (params?: { acting?: Branded<string, "Uuid"> | undefined; } | undefined): Promise<{ settings: { updated_by_username: string | null; open_signup: boolean; updated_at: string | null; updated_by: Branded<...> | null; }; }>

params?

optional
returns Promise<AppSettingsGetOutput>

update

type (params: { open_signup: boolean; acting?: Branded<string, "Uuid"> | undefined; }): Promise<{ ok: true; settings: { updated_by_username: string | null; open_signup: boolean; updated_at: string | null; updated_by: Branded<...> | null; }; }>

params

returns Promise<AppSettingsUpdateOutput>

AppSettingsState
#

ui/app_settings_state.svelte.ts view source

import {AppSettingsState} from '@fuzdev/fuz_app/ui/app_settings_state.svelte.js';

list

type AsyncSlot<void, string>

readonly

update

type AsyncSlot<void, string>

readonly

settings

type AppSettingsWithUsernameJson | null

$state.raw

constructor

type new (options: AppSettingsStateOptions): AppSettingsState

options

fetch

type (): Promise<void>

returns Promise<void>

update_open_signup

type (value: boolean): Promise<void>

value

type boolean
returns Promise<void>

AppSettingsStateOptions
#

Depends on
#

Imported by
#