import { Effect } from "effect"; declare const error_status_codes: { readonly ProxyAuthenticationRequired: 407; readonly RequestHeaderFieldsTooLarge: 431; readonly UnavailableForLegalReasons: 451; readonly NetworkAuthenticationRequired: 511; readonly HttpVersionNotSupported: 505; readonly UnprocessableContent: 422; readonly UnprocessableEntity: 422; readonly InternalServerError: 500; readonly FailedDependency: 424; readonly PreconditionRequired: 428; readonly ServiceUnavailable: 503; readonly MisdirectedRequest: 421; readonly InsufficientStorage: 507; readonly VariantAlsoNegotiates: 506; readonly PreconditionFailed: 412; readonly MethodNotAllowed: 405; readonly GatewayTimeout: 504; readonly PaymentRequired: 402; readonly UpgradeRequired: 426; readonly TooManyRequests: 429; readonly LengthRequired: 411; readonly NotAcceptable: 406; readonly RequestTimeout: 408; readonly ContentTooLarge: 413; readonly PayloadTooLarge: 413; readonly UriTooLong: 414; readonly UnsupportedMediaType: 415; readonly RangeNotSatisfiable: 416; readonly ExpectationFailed: 417; readonly ImATeapot: 418; readonly BadRequest: 400; readonly Unauthorized: 401; readonly Forbidden: 403; readonly NotFound: 404; readonly Conflict: 409; readonly Gone: 410; readonly Locked: 423; readonly TooEarly: 425; readonly NotImplemented: 501; readonly BadGateway: 502; readonly LoopDetected: 508; readonly NotExtended: 510; }; declare const redirect_status_codes: { readonly MovedPermanently: 301; readonly TemporaryRedirect: 307; readonly PermanentRedirect: 308; readonly MultipleChoices: 300; readonly NotModified: 304; readonly SwitchProxy: 306; readonly SeeOther: 303; readonly UseProxy: 305; readonly Found: 302; }; type AppErrorStatus = App.Error extends { readonly status?: infer Status; } ? Status : number; /** * Named HTTP status accepted by the {@link Error} helper. * * @example * ```ts * const status: ErrorStatusName = "NotFound"; * ``` * * @since 2.3.0 */ export type ErrorStatusName = keyof typeof error_status_codes; /** * Numeric or named HTTP status accepted by the {@link Error} helper. * * @example * ```ts * const status: ErrorStatus = "InternalServerError"; * ``` * * @since 2.3.0 */ export type ErrorStatus = ErrorStatusName | number; /** * Error body accepted by the {@link Error} helper. * * @example * ```ts * const body: ErrorBody = { message: "Post not found" }; * ``` * * @since 3.4.3 */ export type ErrorBody = (Omit & { readonly status?: AppErrorStatus; }) | string | undefined; /** * Extra SvelteKit app error properties accepted by the {@link Error} helper * when using the SvelteKit 3 string-body overload. * * @example * ```ts * const properties: ErrorProperties = { code: "POST_NOT_FOUND" }; * ``` * * @since 3.4.3 */ export type ErrorProperties = Omit; /** * Named HTTP status accepted by the {@link Redirect} helper. * * @example * ```ts * const status: RedirectStatusName = "TemporaryRedirect"; * ``` * * @since 2.3.0 */ export type RedirectStatusName = keyof typeof redirect_status_codes; /** * Numeric or named HTTP status accepted by the {@link Redirect} helper. * * @example * ```ts * const status: RedirectStatus = "SeeOther"; * ``` * * @since 2.3.0 */ export type RedirectStatus = RedirectStatusName | number; /** * Options accepted by the {@link Redirect} helper. * * @example * ```ts * const options: RedirectOptions = { external: true }; * ``` * * @since 3.4.3 */ export type RedirectOptions = { readonly external?: boolean | string[]; }; /** * Callable shape for the exported {@link Error} helper. * * @example * ```ts * const fail_not_found: ErrorEffectFactory = Error; * ``` * * @since 2.3.0 */ export interface ErrorEffectFactory { /** * Creates an Effect that throws SvelteKit's HTTP error control-flow value. * * @example * ```ts * return yield* Error("NotFound", "Post not found"); * ``` * * @since 2.3.0 * @param status - Numeric HTTP status or PascalCase status name to pass to * SvelteKit's `error` helper. * @param body - Optional SvelteKit error body or message forwarded unchanged * to SvelteKit. * @returns An Effect that never succeeds because SvelteKit takes over request * control flow. */ (status: ErrorStatus, body?: ErrorBody): Effect.Effect; /** * Creates an Effect that throws SvelteKit's HTTP error control-flow value * using the SvelteKit 3 string-body overload with extra properties. * * @example * ```ts * return yield* Error("NotFound", "Post not found", { * code: "POST_NOT_FOUND", * }); * ``` * * @since 3.4.3 * @param status - Numeric HTTP status or PascalCase status name to pass to * SvelteKit's `error` helper. * @param body - Error message forwarded to SvelteKit. * @param properties - Additional app error properties forwarded to * SvelteKit. * @returns An Effect that never succeeds because SvelteKit takes over request * control flow. */ (status: ErrorStatus, body: string, properties: ErrorProperties): Effect.Effect; } /** * Callable shape for the exported {@link Redirect} helper. * * @example * ```ts * const redirect_after_save: RedirectEffectFactory = Redirect; * ``` * * @since 2.3.0 */ export interface RedirectEffectFactory { /** * Creates an Effect that throws SvelteKit's redirect control-flow value. * * @example * ```ts * return yield* Redirect("SeeOther", "/posts"); * ``` * * @since 2.3.0 * @param status - Numeric redirect status or PascalCase status name to pass * to SvelteKit's `redirect` helper. * @param location - Target URL forwarded unchanged to SvelteKit. * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass * `{ external: true }` or an allowlist to redirect to external URLs. * @returns An Effect that never succeeds because SvelteKit takes over request * control flow. */ (status: RedirectStatus, location: string | URL, options?: RedirectOptions): Effect.Effect; } /** * Creates an Effect that raises SvelteKit's HTTP error control flow. * * @example * ```ts * return yield* Error("NotFound", "Post not found"); * ``` * * @since 2.3.0 * @param status - Numeric HTTP status or PascalCase status name to pass to * SvelteKit's `error` helper. * @param body - Optional SvelteKit error body or message forwarded unchanged * to SvelteKit. * @param properties - Optional SvelteKit 3 app error properties forwarded when * using a string error message. * @returns An Effect that never succeeds because SvelteKit takes over request * control flow. */ export declare const Error: ErrorEffectFactory; /** * Creates an Effect that raises SvelteKit's redirect control flow. * * @example * ```ts * return yield* Redirect("SeeOther", "/posts"); * ``` * * @since 2.3.0 * @param status - Numeric redirect status or PascalCase status name to pass to * SvelteKit's `redirect` helper. * @param location - Target URL forwarded unchanged to SvelteKit. * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass * `{ external: true }` or an allowlist to redirect to external URLs. * @returns An Effect that never succeeds because SvelteKit takes over request * control flow. */ export declare const Redirect: RedirectEffectFactory; export {};