import type { Openfort } from '@openfort/openfort-js'; import { AuthenticationError } from '../../errors/auth.js'; export type AuthTransition = { result: Promise; isCurrent: () => boolean; }; export type AuthTransitionStarter = (mutation: () => Promise) => AuthTransition; export type AuthSession = { isCurrent: () => boolean; }; export type LocalAuthTransition = AuthTransition & { settleStale: () => boolean; }; /** Result returned to a caller whose authentication action lost ownership. */ export declare function authTransitionSupersededResult(): { readonly error: AuthenticationError; }; /** Captures ownership of the current authenticated principal without reserving a mutation. */ export declare function captureAuthSession(client: Openfort): AuthSession; /** Reserves the latest auth transition and serializes its credential mutation for one client. */ export declare function reserveAuthTransition(client: Openfort, mutation: () => Promise): AuthTransition; /** Serializes a mutation owned by the current principal without changing that principal. */ export declare function reserveAuthenticatedMutation(client: Openfort, mutation: () => Promise): AuthTransition; /** Keeps stale completion state local to the hook invocation that still owns it. */ export declare function startLocalAuthTransition(startTransition: AuthTransitionStarter, localGeneration: { current: number; }, mutation: () => Promise, onStale: () => void): LocalAuthTransition;