import type { IncomingMessage, OutgoingMessage } from 'node:http';
import type { Request as ExpressRequest, Response as ExpressResponse } from 'express';
import { l } from '@atproto/lex-schema';
import { type LexXrpcProcedure, type LexXrpcQuery, type LexXrpcSubscription, type Lexicons } from '@atproto/lexicon';
import { type ErrorResult } from './errors.js';
import { type Auth, type Input, type LexMethodInput, type LexMethodOutput, type LexMethodParams, type Output, type Params, type RouteOptions, type UndecodedParams } from './types.js';
export type ParamsVerifierInternal
= (req: IncomingMessage | ExpressRequest) => P;
export type AuthVerifierInternal = (ctx: C) => Promise>;
export type InputVerifierInternal = (req: ExpressRequest, res: ExpressResponse) => Promise;
export type OutputVerifierInternal = (handleOutput: O) => void;
export declare const asArray: (arr: T | T[]) => T[];
export declare function setHeaders(res: OutgoingMessage, headers?: Record): void;
export declare function decodeQueryParam(type: string, value: unknown): string | number | boolean | undefined;
export declare function getQueryParams(req: IncomingMessage | ExpressRequest, opts?: {
parseLoose?: boolean;
}): UndecodedParams;
export declare function createLexiconParamsVerifier(nsid: string, def: LexXrpcQuery | LexXrpcProcedure | LexXrpcSubscription, lexicons: Lexicons): ParamsVerifierInternal
;
export declare function createSchemaParamsVerifier(ns: l.Main, options?: RouteOptions): ParamsVerifierInternal>;
export declare function createLexiconInputVerifier(nsid: string, def: LexXrpcProcedure | LexXrpcQuery, options: RouteOptions, lexicons: Lexicons): InputVerifierInternal;
export declare function createSchemaInputVerifier(ns: l.Main, options: RouteOptions): InputVerifierInternal>;
export declare function createLexiconOutputVerifier(nsid: string, def: LexXrpcProcedure | LexXrpcQuery, lexicons: Lexicons): OutputVerifierInternal;
export declare function createSchemaOutputVerifier(ns: l.Main): OutputVerifierInternal>;
export declare function parseReqEncoding(req: IncomingMessage): string;
export declare function serverTimingHeader(timings: ServerTiming[]): string;
export declare class ServerTimer implements ServerTiming {
name: string;
description?: string | undefined;
duration?: number;
private startMs?;
constructor(name: string, description?: string | undefined);
start(): this;
stop(): this;
}
export interface ServerTiming {
name: string;
duration?: number;
description?: string;
}
export declare const parseReqNsid: (req: ExpressRequest | IncomingMessage) => string;
/**
* Validates and extracts the nsid from an xrpc path
*/
export declare const parseUrlNsid: (url: string) => string;
export declare const extractUrlNsid: (url: string) => string | undefined;
//# sourceMappingURL=util.d.ts.map