mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-14 05:15:56 +08:00
fix(js-sdk): infer keyword collision
This commit is contained in:
parent
d497284b40
commit
d30356a22c
@ -1,5 +1,5 @@
|
|||||||
import axios, { type AxiosResponse, type AxiosRequestHeaders } from "axios";
|
import axios, { type AxiosResponse, type AxiosRequestHeaders } from "axios";
|
||||||
import type { infer as ZodInfer, ZodSchema } from "zod";
|
import type * as zt from "zod";
|
||||||
import { zodToJsonSchema } from "zod-to-json-schema";
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||||
import { WebSocket } from "isows";
|
import { WebSocket } from "isows";
|
||||||
import { TypedEventTarget } from "typescript-event-target";
|
import { TypedEventTarget } from "typescript-event-target";
|
||||||
@ -83,7 +83,7 @@ export interface CrawlScrapeOptions {
|
|||||||
timeout?: number;
|
timeout?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScrapeParams<LLMSchema extends ZodSchema> extends CrawlScrapeOptions {
|
export interface ScrapeParams<LLMSchema extends zt.ZodSchema> extends CrawlScrapeOptions {
|
||||||
extract?: {
|
extract?: {
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
schema?: LLMSchema;
|
schema?: LLMSchema;
|
||||||
@ -200,10 +200,10 @@ export default class FirecrawlApp {
|
|||||||
* @param params - Additional parameters for the scrape request.
|
* @param params - Additional parameters for the scrape request.
|
||||||
* @returns The response from the scrape operation.
|
* @returns The response from the scrape operation.
|
||||||
*/
|
*/
|
||||||
async scrapeUrl<T extends ZodSchema>(
|
async scrapeUrl<T extends zt.ZodSchema>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: ScrapeParams<T>
|
params?: ScrapeParams<T>
|
||||||
): Promise<ScrapeResponse<ZodInfer<T>> | ErrorResponse> {
|
): Promise<ScrapeResponse<zt.infer<T>> | ErrorResponse> {
|
||||||
const headers: AxiosRequestHeaders = {
|
const headers: AxiosRequestHeaders = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Bearer ${this.apiKey}`,
|
Authorization: `Bearer ${this.apiKey}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user