import type { HttpResponseInit, JsonBodyType } from "msw"; import { HttpMethods } from "msw"; import type { TContentTypes } from "./contentTypes.d.mts"; import type { THttpHandlerWithExtendedInfo } from "./httpHandler.d.mts"; export type { TContentTypes, TDecoratorArg, TProps, TResponseDataArg, }; type TMock = TBodyInt | FormData | JsonBodyType; type TDecoratorArg = { res: Response; req: Request; mock: TMock; type: TContentTypes; }; type TProps = { description?: string; method?: HttpMethods; mock?: TMock; body?: BodyInit | null; endpoint: string; type?: TContentTypes; delay?: number; tags?: string[]; getDecorator?: (data: TDecoratorArg) => Promise; getResponseData?: (data: TResponseDataArg) => Promise<{ mock: TMock; init: HttpResponseInit; }>; }; type TBodyInt = string | null | undefined; type TResponseDataArg = { req: Request; mock: TMock; type: TContentTypes; }; /** * Получает результат ответа MSW * @param props{Object=} * @param props.description{String=} описание запроса * @param props.method{String=} метод запроса * @param props.mock{Object=} данные ответа на запрос * @param props.endpoint{String} точка запроса * @param props.type{String=} тип ответа * @param props.status{Number=} статус ответа * @param props.delay{Number=} дополнительное время ожидания ответа * @param props.headers{Object=} заголовки ответа * @param props.body{*} пример тела запроса * @param props.tags{String[]} теги * @param url{String=} адрес API * @returns {THttpHandlerWithExtendedInfo} * @example * import { getApiMock } from "@delement/ui/utils/msw"; * * const handler = getApiMock({ * endpoint: "/users", * mock: [{ id: 1, name: "Alex" }], * }); */ declare const getApiMock: { (props: TProps, url?: string | undefined): THttpHandlerWithExtendedInfo; requestMethods: typeof HttpMethods; contentTypes: { json: string; plain: string; binary: string; xml: string; html: string; formData: string; }; }; export { getApiMock, };