/** * The return type of all the input resolvers. */ type QueryStringRecord = { [key: string]: undefined | string | string[] | [string, string][] | QueryStringRecord | QueryStringRecord[]; }; /** * A partial representation of a FormData object. */ type FormDataLike = Iterable; /** * A partial representation of a Request object. */ type RequestLike = { url: string; clone: () => { formData: () => Promise; }; }; /** * Parses the given URLSearchParams into an object. * * @param queryString the URLSearchParams to parse * @returns the parsed object * * @example * * ```ts * const parsed = inputFromSearch(new URLSearchParams('a=1&b=2')) * // ^? { a: '1', b: '2' } * ``` */ declare function inputFromSearch(queryString: URLSearchParams): QueryStringRecord; /** * Parses the given FormData into an object. * * @param formData the FormData to parse * @returns the parsed object * * @example * * ```ts * const formData = new FormData() * formData.append('a', '1') * formData.append('b', '2') * const parsed = inputFromFormData(formData) * // ^? { a: '1', b: '2' } * ``` */ declare function inputFromFormData(formData: FormDataLike): QueryStringRecord; /** * Parses the given Request's formData into an object. * * @param request the Request to parse * @returns the parsed object * * @example * * ```ts * const formData = new FormData() * formData.append('a', '1') * formData.append('b', '2') * const request = new Request('https://example.com', { * method: 'POST', * body: formData, * }) * const parsed = await inputFromForm(request) * // ^? { a: '1', b: '2' } * ``` */ declare function inputFromForm(request: RequestLike): Promise; /** * Parses the given Request URL's queryString into an object. * * @param request the Request to parse * @returns the parsed object * * @example * * ```ts * const request = new Request('https://example.com?a=1&b=2') * const parsed = inputFromUrl(request) * // ^? { a: '1', b: '2' } * ``` */ declare function inputFromUrl(request: RequestLike): QueryStringRecord; export type { FormDataLike, QueryStringRecord, RequestLike }; export { inputFromForm, inputFromFormData, inputFromSearch, inputFromUrl }; //# sourceMappingURL=input-resolvers.d.ts.map