firecrawl 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +29 -5
- package/dist/index.d.ts +29 -5
- package/dump.rdb +0 -0
- package/package.json +1 -1
- package/src/index.ts +32 -6
package/dist/index.d.cts
CHANGED
|
@@ -54,7 +54,7 @@ interface FirecrawlDocumentMetadata {
|
|
|
54
54
|
* Document interface for Firecrawl.
|
|
55
55
|
* Represents a document retrieved or processed by Firecrawl.
|
|
56
56
|
*/
|
|
57
|
-
interface FirecrawlDocument<T> {
|
|
57
|
+
interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | never) = never> {
|
|
58
58
|
url?: string;
|
|
59
59
|
markdown?: string;
|
|
60
60
|
html?: string;
|
|
@@ -63,6 +63,7 @@ interface FirecrawlDocument<T> {
|
|
|
63
63
|
extract?: T;
|
|
64
64
|
screenshot?: string;
|
|
65
65
|
metadata?: FirecrawlDocumentMetadata;
|
|
66
|
+
actions: ActionsSchema;
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
69
|
* Parameters for scraping operations.
|
|
@@ -77,18 +78,41 @@ interface CrawlScrapeOptions {
|
|
|
77
78
|
waitFor?: number;
|
|
78
79
|
timeout?: number;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
type Action = {
|
|
82
|
+
type: "wait";
|
|
83
|
+
milliseconds: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "click";
|
|
86
|
+
selector: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "screenshot";
|
|
89
|
+
fullPage?: boolean;
|
|
90
|
+
} | {
|
|
91
|
+
type: "typeText";
|
|
92
|
+
text: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: "pressKey";
|
|
95
|
+
key: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: "scroll";
|
|
98
|
+
direction: "up" | "down";
|
|
99
|
+
};
|
|
100
|
+
interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions {
|
|
81
101
|
extract?: {
|
|
82
102
|
prompt?: string;
|
|
83
103
|
schema?: LLMSchema;
|
|
84
104
|
systemPrompt?: string;
|
|
85
105
|
};
|
|
106
|
+
actions?: ActionsSchema;
|
|
107
|
+
}
|
|
108
|
+
interface ActionsResult {
|
|
109
|
+
screenshots: string[];
|
|
86
110
|
}
|
|
87
111
|
/**
|
|
88
112
|
* Response interface for scraping operations.
|
|
89
113
|
* Defines the structure of the response received after a scraping operation.
|
|
90
114
|
*/
|
|
91
|
-
interface ScrapeResponse<LLMResult> extends FirecrawlDocument<LLMResult> {
|
|
115
|
+
interface ScrapeResponse<LLMResult = any, ActionsSchema extends (ActionsResult | never) = never> extends FirecrawlDocument<LLMResult, ActionsSchema> {
|
|
92
116
|
success: true;
|
|
93
117
|
warning?: string;
|
|
94
118
|
error?: string;
|
|
@@ -177,7 +201,7 @@ declare class FirecrawlApp {
|
|
|
177
201
|
* @param params - Additional parameters for the scrape request.
|
|
178
202
|
* @returns The response from the scrape operation.
|
|
179
203
|
*/
|
|
180
|
-
scrapeUrl<T extends zt.ZodSchema>(url: string, params?: ScrapeParams<T>): Promise<ScrapeResponse<zt.infer<T
|
|
204
|
+
scrapeUrl<T extends zt.ZodSchema, ActionsSchema extends (Action[] | undefined) = undefined>(url: string, params?: ScrapeParams<T, ActionsSchema>): Promise<ScrapeResponse<zt.infer<T>, ActionsSchema extends Action[] ? ActionsResult : never> | ErrorResponse>;
|
|
181
205
|
/**
|
|
182
206
|
* This method is intended to search for a query using the Firecrawl API. However, it is not supported in version 1 of the API.
|
|
183
207
|
* @param query - The search query string.
|
|
@@ -261,4 +285,4 @@ declare class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
|
|
|
261
285
|
close(): void;
|
|
262
286
|
}
|
|
263
287
|
|
|
264
|
-
export { type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
|
288
|
+
export { type Action, type ActionsResult, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ interface FirecrawlDocumentMetadata {
|
|
|
54
54
|
* Document interface for Firecrawl.
|
|
55
55
|
* Represents a document retrieved or processed by Firecrawl.
|
|
56
56
|
*/
|
|
57
|
-
interface FirecrawlDocument<T> {
|
|
57
|
+
interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | never) = never> {
|
|
58
58
|
url?: string;
|
|
59
59
|
markdown?: string;
|
|
60
60
|
html?: string;
|
|
@@ -63,6 +63,7 @@ interface FirecrawlDocument<T> {
|
|
|
63
63
|
extract?: T;
|
|
64
64
|
screenshot?: string;
|
|
65
65
|
metadata?: FirecrawlDocumentMetadata;
|
|
66
|
+
actions: ActionsSchema;
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
69
|
* Parameters for scraping operations.
|
|
@@ -77,18 +78,41 @@ interface CrawlScrapeOptions {
|
|
|
77
78
|
waitFor?: number;
|
|
78
79
|
timeout?: number;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
type Action = {
|
|
82
|
+
type: "wait";
|
|
83
|
+
milliseconds: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "click";
|
|
86
|
+
selector: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "screenshot";
|
|
89
|
+
fullPage?: boolean;
|
|
90
|
+
} | {
|
|
91
|
+
type: "typeText";
|
|
92
|
+
text: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: "pressKey";
|
|
95
|
+
key: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: "scroll";
|
|
98
|
+
direction: "up" | "down";
|
|
99
|
+
};
|
|
100
|
+
interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions {
|
|
81
101
|
extract?: {
|
|
82
102
|
prompt?: string;
|
|
83
103
|
schema?: LLMSchema;
|
|
84
104
|
systemPrompt?: string;
|
|
85
105
|
};
|
|
106
|
+
actions?: ActionsSchema;
|
|
107
|
+
}
|
|
108
|
+
interface ActionsResult {
|
|
109
|
+
screenshots: string[];
|
|
86
110
|
}
|
|
87
111
|
/**
|
|
88
112
|
* Response interface for scraping operations.
|
|
89
113
|
* Defines the structure of the response received after a scraping operation.
|
|
90
114
|
*/
|
|
91
|
-
interface ScrapeResponse<LLMResult> extends FirecrawlDocument<LLMResult> {
|
|
115
|
+
interface ScrapeResponse<LLMResult = any, ActionsSchema extends (ActionsResult | never) = never> extends FirecrawlDocument<LLMResult, ActionsSchema> {
|
|
92
116
|
success: true;
|
|
93
117
|
warning?: string;
|
|
94
118
|
error?: string;
|
|
@@ -177,7 +201,7 @@ declare class FirecrawlApp {
|
|
|
177
201
|
* @param params - Additional parameters for the scrape request.
|
|
178
202
|
* @returns The response from the scrape operation.
|
|
179
203
|
*/
|
|
180
|
-
scrapeUrl<T extends zt.ZodSchema>(url: string, params?: ScrapeParams<T>): Promise<ScrapeResponse<zt.infer<T
|
|
204
|
+
scrapeUrl<T extends zt.ZodSchema, ActionsSchema extends (Action[] | undefined) = undefined>(url: string, params?: ScrapeParams<T, ActionsSchema>): Promise<ScrapeResponse<zt.infer<T>, ActionsSchema extends Action[] ? ActionsResult : never> | ErrorResponse>;
|
|
181
205
|
/**
|
|
182
206
|
* This method is intended to search for a query using the Firecrawl API. However, it is not supported in version 1 of the API.
|
|
183
207
|
* @param query - The search query string.
|
|
@@ -261,4 +285,4 @@ declare class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
|
|
|
261
285
|
close(): void;
|
|
262
286
|
}
|
|
263
287
|
|
|
264
|
-
export { type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
|
288
|
+
export { type Action, type ActionsResult, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
package/dump.rdb
ADDED
|
Binary file
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface FirecrawlDocumentMetadata {
|
|
|
58
58
|
* Document interface for Firecrawl.
|
|
59
59
|
* Represents a document retrieved or processed by Firecrawl.
|
|
60
60
|
*/
|
|
61
|
-
export interface FirecrawlDocument<T> {
|
|
61
|
+
export interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | never) = never> {
|
|
62
62
|
url?: string;
|
|
63
63
|
markdown?: string;
|
|
64
64
|
html?: string;
|
|
@@ -67,6 +67,7 @@ export interface FirecrawlDocument<T> {
|
|
|
67
67
|
extract?: T;
|
|
68
68
|
screenshot?: string;
|
|
69
69
|
metadata?: FirecrawlDocumentMetadata;
|
|
70
|
+
actions: ActionsSchema;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
@@ -83,19 +84,44 @@ export interface CrawlScrapeOptions {
|
|
|
83
84
|
timeout?: number;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
export
|
|
87
|
+
export type Action = {
|
|
88
|
+
type: "wait",
|
|
89
|
+
milliseconds: number,
|
|
90
|
+
} | {
|
|
91
|
+
type: "click",
|
|
92
|
+
selector: string,
|
|
93
|
+
} | {
|
|
94
|
+
type: "screenshot",
|
|
95
|
+
fullPage?: boolean,
|
|
96
|
+
} | {
|
|
97
|
+
type: "typeText",
|
|
98
|
+
text: string,
|
|
99
|
+
} | {
|
|
100
|
+
type: "pressKey",
|
|
101
|
+
key: string,
|
|
102
|
+
} | {
|
|
103
|
+
type: "scroll",
|
|
104
|
+
direction: "up" | "down",
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions {
|
|
87
108
|
extract?: {
|
|
88
109
|
prompt?: string;
|
|
89
110
|
schema?: LLMSchema;
|
|
90
111
|
systemPrompt?: string;
|
|
91
112
|
};
|
|
113
|
+
actions?: ActionsSchema;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ActionsResult {
|
|
117
|
+
screenshots: string[];
|
|
92
118
|
}
|
|
93
119
|
|
|
94
120
|
/**
|
|
95
121
|
* Response interface for scraping operations.
|
|
96
122
|
* Defines the structure of the response received after a scraping operation.
|
|
97
123
|
*/
|
|
98
|
-
export interface ScrapeResponse<LLMResult> extends FirecrawlDocument<LLMResult> {
|
|
124
|
+
export interface ScrapeResponse<LLMResult = any, ActionsSchema extends (ActionsResult | never) = never> extends FirecrawlDocument<LLMResult, ActionsSchema> {
|
|
99
125
|
success: true;
|
|
100
126
|
warning?: string;
|
|
101
127
|
error?: string;
|
|
@@ -200,10 +226,10 @@ export default class FirecrawlApp {
|
|
|
200
226
|
* @param params - Additional parameters for the scrape request.
|
|
201
227
|
* @returns The response from the scrape operation.
|
|
202
228
|
*/
|
|
203
|
-
async scrapeUrl<T extends zt.ZodSchema>(
|
|
229
|
+
async scrapeUrl<T extends zt.ZodSchema, ActionsSchema extends (Action[] | undefined) = undefined>(
|
|
204
230
|
url: string,
|
|
205
|
-
params?: ScrapeParams<T>
|
|
206
|
-
): Promise<ScrapeResponse<zt.infer<T
|
|
231
|
+
params?: ScrapeParams<T, ActionsSchema>
|
|
232
|
+
): Promise<ScrapeResponse<zt.infer<T>, ActionsSchema extends Action[] ? ActionsResult : never> | ErrorResponse> {
|
|
207
233
|
const headers: AxiosRequestHeaders = {
|
|
208
234
|
"Content-Type": "application/json",
|
|
209
235
|
Authorization: `Bearer ${this.apiKey}`,
|