Skip to content

Data model

Core types

CloudProfile (from Rust via IPC)

typescript
interface CloudProfile {
    name: string;
    sso_account_name: string | null;
    sso_account_id: string | null;
    sso_role_name: string | null;
    sso_start_url: string | null;
    region: string | null;
    sso_session: string | null;
    credential_type: CredentialType;  // "SSO" | "AssumeRole" | "Granted/*" | "StaticKeys" | "Unknown"
    auth_expires_at: number | null;   // unix seconds
    session_duration_seconds: number | null;
    role_arn: string | null;
    source_profile: string | null;
    credential_expires_at: number | null;
    // Granted-specific fields
    granted_sso_start_url: string | null;
    granted_sso_account_id: string | null;
    granted_sso_role_name: string | null;
    granted_sso_region: string | null;
    common_fate_generated_from: string | null;
}

AppConfig (from Rust via IPC)

typescript
interface AppConfig {
    version: number;
    profiles: Record<string, Partial<ProfileMeta>>;  // per-profile metadata
    preferences: Preferences;                         // app settings
    activeProfiles: Record<string, string>;           // sso_session → profile name
    defaultProfile: string | null;
}

ProfileMeta (stored per profile)

typescript
interface ProfileMeta {
    label: string;
    tags: string[];
    notes: string;
    starred: boolean;
    hidden: boolean;
    order: number;
    color?: string;
    orgName?: string;
}

ProfileViewModel (computed by mergeProfiles)

typescript
interface ProfileViewModel extends CloudProfile {
    meta: ProfileMeta;
    authState: AuthState;                  // "authenticated" | "expiring" | "expired"
    organizationId: string | null;
    organizationName: string | null;
    isActiveLogin: boolean;
    resolvedSsoSession: string | null;      // walked source_profile chain
    resolvedSsoStartUrl: string | null;
    isMisconfigured: boolean;               // sso_session set but no [sso-session] block
    activeLoginName: string | null;
}

Key tables

FileTypePurpose
src/types.tsAll interfacesShared TS types, DEFAULT_META, DEFAULT_PREFERENCES
src-tauri/src/models.rsRust structsMirror TS types, Serialize/Deserialize

Default values

See DEFAULT_META and DEFAULT_PREFERENCES in src/types.ts. New preference fields are added to DEFAULT_PREFERENCES and merged via withPreferenceDefaults() in appConfig.ts, ensuring existing installs get defaults for new fields.

Auth state derivation

typescript
function authStateFor(expiresAt: number | null, warningMinutes: number): AuthState {
    if (!expiresAt) return "expired";
    const remaining = expiresAt - Date.now() / 1000;
    if (remaining <= 0) return "expired";
    if (remaining <= warningMinutes * 60) return "expiring";
    return "authenticated";
}