## API Report File for "@qwik.dev/router"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import type { Action } from '@qwik.dev/router';
import type { AsyncLocalStorage } from 'node:async_hooks';
import type { EnvGetter as EnvGetter_2 } from '@qwik.dev/router/middleware/request-handler';
import type { FailReturn } from '@qwik.dev/router';
import type { JSXOutput } from '@qwik.dev/core';
import type { Loader as Loader_2 } from '@qwik.dev/router';
import type { QwikIntrinsicElements } from '@qwik.dev/core';
import type { Render } from '@qwik.dev/core/server';
import type { RenderOptions } from '@qwik.dev/core/server';
import { RequestEvent as RequestEvent_2 } from '@qwik.dev/router/middleware/request-handler';
import type { RequestHandler as RequestHandler_2 } from '@qwik.dev/router/middleware/request-handler';
import type { ResolveSyncValue as ResolveSyncValue_2 } from '@qwik.dev/router/middleware/request-handler';
import type { ValueOrPromise } from '@qwik.dev/core';

// @public (undocumented)
export class AbortMessage {
    readonly __controlFlow: true;
}

// Warning: (ae-forgotten-export) The symbol "RequestEventInternal" needs to be exported by the entry point index.d.ts
//
// @internal (undocumented)
export let _asyncRequestStore: AsyncLocalStorage<RequestEventInternal> | undefined;

// Warning: (ae-forgotten-export) The symbol "CacheControlOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type CacheControl = CacheControlOptions | number | 'day' | 'week' | 'month' | 'year' | 'no-cache' | 'immutable' | 'private';

// @public
export function clearLoaderCache(cacheKey?: string): void;

// @public
export function clearSsrCache(cacheKey?: string): void;

// @public (undocumented)
export interface ClientConn {
    // (undocumented)
    country?: string;
    // (undocumented)
    ip?: string;
}

// @public (undocumented)
export interface Cookie {
    append(name: string, value: string | number | Record<string, any>, options?: CookieOptions): void;
    delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain' | 'sameSite'>): void;
    get(name: string): CookieValue | null;
    getAll(): Record<string, CookieValue>;
    has(name: string): boolean;
    headers(): string[];
    set(name: string, value: string | number | Record<string, any>, options?: CookieOptions): void;
}

// @public
export interface CookieOptions {
    domain?: string;
    expires?: Date | string;
    httpOnly?: boolean;
    maxAge?: number | [number, 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks'];
    path?: string;
    sameSite?: 'strict' | 'lax' | 'none' | 'Strict' | 'Lax' | 'None' | boolean;
    secure?: boolean;
}

// @public (undocumented)
export interface CookieValue {
    // (undocumented)
    json: <T = unknown>() => T;
    // (undocumented)
    number: () => number;
    // (undocumented)
    value: string;
}

// @public (undocumented)
export type DeferReturn<T> = () => Promise<T>;

// @public (undocumented)
export interface EnvGetter {
    // (undocumented)
    get(key: string): string | undefined;
}

// @public (undocumented)
export function getErrorHtml(status: number, e: any): string;

// @public
export type InternalRequest = false | 'loader' | 'action';

// Warning: (ae-internal-missing-underscore) The name "isStaticPath" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export function isStaticPath(method: string, url: URL): boolean;

// @public (undocumented)
export const mergeHeadersCookies: (headers: Headers, cookies: Cookie) => Headers;

// @public (undocumented)
export class RedirectMessage extends AbortMessage {
}

// @public (undocumented)
export interface RequestEvent<PLATFORM = QwikRouterPlatform> extends RequestEventCommon<PLATFORM> {
    readonly exited: boolean;
    readonly getWritableStream: () => WritableStream<Uint8Array>;
    readonly headersSent: boolean;
    readonly next: () => Promise<void>;
}

// @public (undocumented)
export interface RequestEventAction<PLATFORM = QwikRouterPlatform> extends RequestEventCommon<PLATFORM> {
    // (undocumented)
    fail: <T extends Record<string, any>>(status: number, returnData: T) => FailReturn<T>;
}

// @public (undocumented)
export interface RequestEventBase<PLATFORM = QwikRouterPlatform> {
    readonly basePathname: string;
    // Warning: (ae-forgotten-export) The symbol "CacheControlTarget" needs to be exported by the entry point index.d.ts
    readonly cacheControl: (cacheControl: CacheControl, target?: CacheControlTarget) => void;
    readonly clientConn: ClientConn;
    readonly cookie: Cookie;
    readonly env: EnvGetter;
    readonly headers: Headers;
    readonly internalRequest: InternalRequest;
    readonly method: string;
    readonly originalUrl: URL;
    readonly params: Readonly<Record<string, string>>;
    readonly parseBody: () => Promise<unknown>;
    readonly pathname: string;
    readonly platform: PLATFORM;
    readonly query: URLSearchParams;
    readonly request: Request;
    readonly sharedMap: Map<string, any>;
    readonly signal: AbortSignal;
    readonly url: URL;
}

// @public (undocumented)
export interface RequestEventCommon<PLATFORM = QwikRouterPlatform> extends RequestEventBase<PLATFORM> {
    // Warning: (ae-forgotten-export) The symbol "ErrorCodes" needs to be exported by the entry point index.d.ts
    readonly error: <T = any>(statusCode: ErrorCodes, message: T) => ServerError<T>;
    // (undocumented)
    readonly exit: () => AbortMessage;
    readonly html: (statusCode: StatusCodes, html: string) => AbortMessage;
    readonly json: (statusCode: StatusCodes, data: any) => AbortMessage;
    readonly locale: (local?: string) => string;
    // Warning: (ae-forgotten-export) The symbol "RedirectCode" needs to be exported by the entry point index.d.ts
    readonly redirect: (statusCode: RedirectCode, url: string) => RedirectMessage;
    readonly rewrite: (pathname: string) => RewriteMessage;
    // Warning: (ae-forgotten-export) The symbol "SendMethod" needs to be exported by the entry point index.d.ts
    readonly send: SendMethod;
    // Warning: (ae-forgotten-export) The symbol "StatusCodes" needs to be exported by the entry point index.d.ts
    readonly status: (statusCode?: StatusCodes) => number;
    readonly text: (statusCode: StatusCodes, text: string) => AbortMessage;
}

// @public (undocumented)
export interface RequestEventLoader<PLATFORM = QwikRouterPlatform> extends RequestEventAction<PLATFORM> {
    // (undocumented)
    defer: <T>(returnData: Promise<T> | (() => Promise<T>)) => DeferReturn<T>;
    // (undocumented)
    resolveValue: ResolveValue;
}

// @public (undocumented)
export type RequestHandler<PLATFORM = QwikRouterPlatform> = (ev: RequestEvent<PLATFORM>) => Promise<void | AbortMessage | ServerError> | void | AbortMessage | ServerError;

// Warning: (ae-forgotten-export) The symbol "QwikRouterRun" needs to be exported by the entry point index.d.ts
//
// @public
export function requestHandler<T = unknown>(serverRequestEv: ServerRequestEvent<T>, opts: ServerRenderOptions): Promise<QwikRouterRun<T> | null>;

// @public (undocumented)
export interface ResolveSyncValue {
    // (undocumented)
    <T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Awaited<T> | undefined;
    // (undocumented)
    <T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Awaited<T>;
}

// @public (undocumented)
export interface ResolveValue {
    // (undocumented)
    <T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Promise<T | undefined>;
    // (undocumented)
    <T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Promise<T>;
}

// @public (undocumented)
export class RewriteMessage extends AbortMessage {
    constructor(pathname: string);
    // (undocumented)
    readonly pathname: string;
}

// @public (undocumented)
export class ServerError<T = any> extends Error {
    constructor(status: number, data: T);
    // (undocumented)
    data: T;
    // (undocumented)
    status: number;
}

// @public (undocumented)
export interface ServerRenderOptions extends RenderOptions {
    checkOrigin?: boolean | 'lax-proto';
    // (undocumented)
    render: Render;
}

// @public
export interface ServerRequestEvent<T = unknown> {
    // (undocumented)
    env: EnvGetter;
    // (undocumented)
    getClientConn: () => ClientConn;
    // (undocumented)
    getWritableStream: ServerResponseHandler<T>;
    // (undocumented)
    locale: string | undefined;
    // (undocumented)
    mode: ServerRequestMode;
    // (undocumented)
    platform: QwikRouterPlatform;
    // (undocumented)
    request: Request;
    // (undocumented)
    url: URL;
}

// @public (undocumented)
export type ServerRequestMode = 'static' | 'server';

// @public (undocumented)
export type ServerResponseHandler<T = any> = (status: number, headers: Headers, cookies: Cookie, resolve: (response: T) => void, requestEv: RequestEvent) => WritableStream<Uint8Array>;

// @internal (undocumented)
export class _TextEncoderStream_polyfill {
    // (undocumented)
    get [Symbol.toStringTag](): string;
    // (undocumented)
    get encoding(): string;
    // (undocumented)
    get readable(): ReadableStream<Uint8Array<ArrayBufferLike>>;
    // (undocumented)
    get writable(): WritableStream<string>;
}

// (No @packageDocumentation comment for this package)

```
