import { QueryClient } from '@tanstack/react-query'; interface SessionLike { activeOrganizationId?: string | null; [key: string]: unknown; } interface SessionCacheRecord { session?: SessionLike | null; user?: unknown; [key: string]: unknown; } interface AthenaSessionSurface { getSnapshot?: () => { session?: SessionCacheRecord | null; }; refresh?: () => Promise; /** * When present (Athena bindings), authoritative local patch cancels in-flight * refresh (INV-Q). Prefer organization.setActive which already patches SSOT. */ setSession?: (session: SessionCacheRecord | null, status?: "authenticated" | "unauthenticated" | "error") => void; } interface AthenaAuthSurface { organization?: { setActive?: (input: { organizationId: string | null; }) => Promise; }; session?: AthenaSessionSurface; } /** * Resolve `auth` from a root Athena client or auth bindings. */ export declare function resolveAthenaAuthSurface(client: unknown): AthenaAuthSurface | null; /** * Drop in-flight org-scoped reads when identity is leaving an organization * (especially org → personal). Prefix cancel covers queries that never * received an organizationId. */ export declare function cancelOrganizationBoundQueries(queryClient: QueryClient, organizationId?: string | null, userId?: string | null): void; /** * Read the current Better Auth UI session query entry (`["auth", "getSession"]`). * * Derived mirror only — canonical identity is `athena.auth.session`. */ export declare function getCachedSessionData(queryClient: QueryClient): SessionCacheRecord | null | undefined; /** * Optimistically patch active org on Athena SSOT (`auth.session`). * RQ/BA session keys are a derived mirror written by the session query mirror. */ export declare function patchSessionActiveOrganizationId(_queryClient: QueryClient, organizationId: string | null, athenaClient?: unknown): void; /** * Restore a prior session cache snapshot after a failed organization switch. */ export declare function restoreSessionCacheSnapshot(_queryClient: QueryClient, snapshot: SessionCacheRecord | null | undefined, athenaClient?: unknown): void; /** * After organization switch: identity is already on Athena SSOT. * RQ/BA session keys follow via the session query mirror subscriber. */ export declare function syncSessionAfterOrganizationChange(_queryClient: QueryClient, _athenaClient?: unknown): Promise; export {};