export type CreateApiTavilyMapArgs = {body: {url: string, instructions?: string | undefined, max_depth?: number | undefined, max_breadth?: number | undefined, limit?: number | undefined, select_paths?: Array | undefined, select_domains?: Array | undefined, exclude_paths?: Array | undefined, exclude_domains?: Array | undefined, allow_external?: boolean | undefined, timeout?: string | undefined}}; export type CreateApiTavilyMapOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Tavily Map traverses websites like a graph and can explore hundreds of paths in parallel with intelligent discovery to generate comprehensive site maps. * * POST /tavily/map */ export const createApiTavilyMap = async (args: CreateApiTavilyMapArgs, options?: CreateApiTavilyMapOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tavily/map${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };