import type { Awaitable } from "./utils/common-types.js"; import { Context } from "./context.js"; import { Accepted } from './content-negotiation.js'; export declare const JSON = "application/json"; export declare const FORM = "application/x-www-form-urlencoded"; export declare const FORM_DATA = "multipart/form-data"; export declare const TEXT_HTML = "text/html"; export declare const TEXT_PLAIN = "text/plain"; /** Standard MIME type for binary data */ export declare const BINARY = "application/octet-stream"; /** Non-standard MIME type for binary data. Sometimes used, so included anyway. */ export declare const X_BINARY = "application/x-binary"; export interface BodyParserOptions { defaultJSON?: J; maxSize?: number; } export declare type BodyParsable = typeof FORM | typeof FORM_DATA | typeof JSON | typeof BINARY | typeof X_BINARY | `application/${string}+json` | `text/${string}`; export interface BodyJSONContext { accepted: typeof JSON; body: J; json: J; } export interface BodyVendorJSONContext { accepted: `application/${string}+json`; body: J; json: J; } export interface BodyFormContext { accepted: typeof FORM; body: URLSearchParams; form: URLSearchParams; } export interface BodyFormDataContext { accepted: typeof FORM_DATA; body: FormData; formData: FormData; } export interface BodyBinaryContext { accepted: typeof BINARY | typeof X_BINARY; body: ArrayBuffer; arrayBuffer: ArrayBuffer; blob: Blob; } export interface BodyTextContext { accepted: `text/${string}`; body: string; text: string; } export declare type BodyContext = BodyJSONContext | BodyBinaryContext | BodyFormContext | BodyFormDataContext | BodyTextContext | BodyVendorJSONContext; export declare type BodyParserDeps = Context & Accepted; export declare const bodyParser: (opts?: BodyParserOptions) => (ax: Awaitable) => Promise>; export declare const defaultBodyParser: (options?: BodyParserOptions | undefined) => (ax: Awaitable) => Promise & BodyContext>;