import { IncomingMessage, ServerResponse } from "node:http"; //#region src/server/native-mount.d.ts export type NativeHandler = (req: IncomingMessage, res: ServerResponse) => void | Promise; export interface NativeMountMatcher { /** match requests whose pathname starts with this prefix */ prefix?: string | undefined; /** predicate over the native request; evaluated when no prefix mount matches */ match?: ((req: IncomingMessage) => boolean) | undefined; /** route label for logs, metrics and span names; defaults to the prefix */ name?: string | undefined; } /** * Mount a native `(req, res)` handler on the adapter's server. The handler * owns the response completely — matched requests never reach astro * middleware or rendering. Dispatch happens before static file serving, in * production and dev alike. * * Call from `onStartup`. Returns an unregister function; mounts still * registered after `onShutdown` are removed automatically. * * When several prefix mounts match, the longest prefix wins; predicate * mounts are consulted afterwards in registration order. * * @example * ```ts * // src/boot.ts * import { mountNativeHandler } from '@astroscope/node/native'; * * export function onStartup() { * mountNativeHandler({ prefix: '/oidc', name: 'oidc' }, getOidcProvider().callback()); * } * ``` */ export declare function mountNativeHandler(matcher: NativeMountMatcher, handler: NativeHandler): () => void; /** * Remove every registered mount. Runs after `onShutdown` (prod) and between * dev generations, so re-running `onStartup` never stacks duplicates. */ export declare function clearNativeMounts(): void; /** * Dispatch a request to a matching mount. Returns `false` when no mount * matches — the caller continues with static/astro handling. */ export declare function dispatchNativeMount(req: IncomingMessage, res: ServerResponse): boolean; //#endregion //# sourceMappingURL=native.d.ts.map