import { AthenaAuthUpstreamEnv } from './base-url.js'; /** * @deprecated Prefer `@xylex-group/athena/next/server`: * `createAthenaAuthProxyHandlers({ client: athena })` * with `createClient({ auth: { routing: "same-origin", upstreamUrl } })`. * This module remains for back-compat with existing auth-ui imports. */ /** Options for proxying `/api/auth` requests to an Athena Auth upstream. */ export interface AthenaAuthProxyOptions { fetchImplementation?: typeof fetch; rewriteSetCookiesToRequestOrigin?: boolean; routePrefix?: string; upstreamBaseUrl?: string; upstreamUrl?: string | AthenaAuthUpstreamEnv; } type AthenaAuthProxyHandler = (request: Request) => Promise; /** Decode a single cookie value; returns the raw string if decoding fails. */ export declare function decodeCookieValue(value: string): string; /** * Read one named cookie from a `Cookie` header string. * Values are URI-decoded when possible. */ export declare function readCookieValue(cookieHeader: string | null | undefined, name: string): string | undefined; /** Convenience: read a cookie from a `Request`'s `cookie` header. */ export declare function readCookieValueFromRequest(request: Request, name: string): string | undefined; /** Proxies one incoming request to the configured Athena Auth upstream and normalizes browser-facing headers. */ export declare function proxyAthenaAuthRequest(request: Request, options?: AthenaAuthProxyOptions): Promise; /** Static options or per-request resolver for auth proxy handlers. */ export type AthenaAuthProxyHandlersOptions = AthenaAuthProxyOptions | ((request: Request) => AthenaAuthProxyOptions | Promise); /** * Creates HTTP method handlers suitable for Next.js route modules that proxy * Athena Auth upstream traffic. * * Prefer the shorter alias {@link athenaAuthHandlers}. * * @example * ```ts * // app/api/auth/[...all]/route.ts * export const { DELETE, GET, HEAD, PATCH, POST, PUT } = athenaAuthHandlers({ * rewriteSetCookiesToRequestOrigin: true, * }) * ``` * * @example * ```ts * // Dynamic upstream (routing-debug / multi-tenant) * export const { GET, POST, ... } = athenaAuthHandlers((request) => ({ * rewriteSetCookiesToRequestOrigin: true, * upstreamBaseUrl: resolveUpstream(request), * })) * ``` */ export declare function createAthenaAuthProxyHandlers(options?: AthenaAuthProxyHandlersOptions): { DELETE: AthenaAuthProxyHandler; GET: AthenaAuthProxyHandler; HEAD: AthenaAuthProxyHandler; PATCH: AthenaAuthProxyHandler; POST: AthenaAuthProxyHandler; PUT: AthenaAuthProxyHandler; }; /** * Canonical Next.js App Router auth proxy handlers. * Alias of {@link createAthenaAuthProxyHandlers}. */ export declare const athenaAuthHandlers: typeof createAthenaAuthProxyHandlers; export {};