import type { DataResponseMetadata, DataResult, StaticDataResult } from "./types.js"; /** * Redirect the request from a data loader. * * Return it or throw it. `throw redirect("/login")` behaves exactly like * `return redirect("/login")`. */ export declare function redirect(destination: string, permanent?: boolean, response?: undefined): StaticDataResult; export declare function redirect(destination: string, permanent: boolean | undefined, response: DataResponseMetadata): DataResult; /** * Render the 404 page from a data loader. * * Return it or throw it. `throw notFound()` behaves exactly like * `return notFound()`, which is useful deep inside a helper that has no clean * way to return to the loader. */ export declare function notFound(response?: undefined): StaticDataResult; export declare function notFound(response: DataResponseMetadata): DataResult; /** * True when `value` is a control-flow result produced by {@link notFound} or * {@link redirect}. * * These helpers are documented as return values, but `throw notFound()` reads * naturally and is what people coming from other frameworks reach for. Thrown, * the plain object is not an `Error`, so the SSR error handler stringified it * to `[object Object]` and returned a 500 instead of the intended 404 or * redirect. Recognising the brand lets a thrown result behave like a returned * one. * * The check is on the brand, never on the shape. A loader that does * `throw await response.json()` against an upstream answering * `{ notFound: true, message: "record locked" }` is reporting a failure, and * reading that as a 404 would render the wrong page, log nothing, and cache a * 404 the site never asked for. */ export declare function isDataControlResult(value: unknown): value is DataResult; /** * Reduce a thrown control result to the shape a returned one produces. * * Callers apply this inside whatever wraps the data loader, not in an outer * `catch`. A 404 is a routing decision, and a circuit breaker that sees it as a * failure will open on the fifth legitimate one and fail every later data route * for the project. */ export declare function toDataControlResult(result: DataResult): DataResult; //# sourceMappingURL=helpers.d.ts.map