/** * mates — useCtx * * Retrieves the current server-side Context (Hono-style) during SSR or * RPC calls. Uses the same global AsyncLocalStorage key as mates-fullstack's * ssr-context.ts, so it works inside the SSR esbuild bundle as well. * * Returns undefined when called outside a request context (e.g. client-side). * * @example * // In a component outer function: * const ctx = useCtx(); * if (ctx) { * console.log("request path:", ctx.req.path); * } */ /** * Minimal Ctx interface matching the Hono-style Context shape. * Defined locally — mates doesn't import from mates-fullstack. */ export interface Ctx { req: { raw: Request; method: string; url: string; path: string; param(name: string): string | undefined; query(name: string): string | undefined; header(name: string): string | undefined; params: Record; queries: Record; }; isSSR: boolean; auth: Record | null; cookie: { get(name: string): string | undefined; getAll(): Record; set(name: string, value: string, options?: Record): void; delete(name: string, options?: Record): void; }; var: Record; set(key: string, value: unknown): void; get(key: string): unknown; [key: string]: unknown; } /** * Get the current server-side Context (Hono-style). * * Returns `undefined` when called: * - On the client (browser) * - Outside a request handler * * Available when called: * - During SSR page rendering * - Inside RPC functions (both SSR and HTTP paths) * - Inside onRequest/onBeforeRPC/onAfterRPC hooks */ export declare function useCtx(): Ctx | undefined; /** * Returns true when currently executing inside an SSR render pass. */ export declare function useIsSSR(): boolean; //# sourceMappingURL=useCtx.d.ts.map