firecrawl 1.7.0 → 1.7.1
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 +28 -4
- package/dist/index.d.ts +28 -4
- package/package.json +1 -1
- package/src/index.ts +29 -3
package/dist/index.d.cts
CHANGED
|
@@ -142,6 +142,16 @@ interface CrawlResponse {
|
|
|
142
142
|
success: true;
|
|
143
143
|
error?: string;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Response interface for batch scrape operations.
|
|
147
|
+
* Defines the structure of the response received after initiating a crawl.
|
|
148
|
+
*/
|
|
149
|
+
interface BatchScrapeResponse {
|
|
150
|
+
id?: string;
|
|
151
|
+
url?: string;
|
|
152
|
+
success: true;
|
|
153
|
+
error?: string;
|
|
154
|
+
}
|
|
145
155
|
/**
|
|
146
156
|
* Response interface for job status checks.
|
|
147
157
|
* Provides detailed status of a crawl job including progress and results.
|
|
@@ -156,6 +166,20 @@ interface CrawlStatusResponse {
|
|
|
156
166
|
next?: string;
|
|
157
167
|
data: FirecrawlDocument<undefined>[];
|
|
158
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Response interface for batch scrape job status checks.
|
|
171
|
+
* Provides detailed status of a batch scrape job including progress and results.
|
|
172
|
+
*/
|
|
173
|
+
interface BatchScrapeStatusResponse {
|
|
174
|
+
success: true;
|
|
175
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
176
|
+
completed: number;
|
|
177
|
+
total: number;
|
|
178
|
+
creditsUsed: number;
|
|
179
|
+
expiresAt: Date;
|
|
180
|
+
next?: string;
|
|
181
|
+
data: FirecrawlDocument<undefined>[];
|
|
182
|
+
}
|
|
159
183
|
/**
|
|
160
184
|
* Parameters for mapping operations.
|
|
161
185
|
* Defines options for mapping URLs during a crawl.
|
|
@@ -263,8 +287,8 @@ declare class FirecrawlApp {
|
|
|
263
287
|
* @param idempotencyKey - Optional idempotency key for the request.
|
|
264
288
|
* @returns The response from the crawl operation.
|
|
265
289
|
*/
|
|
266
|
-
batchScrapeUrls(urls: string[], params?: ScrapeParams, pollInterval?: number, idempotencyKey?: string): Promise<
|
|
267
|
-
asyncBatchScrapeUrls(urls: string[], params?: ScrapeParams, idempotencyKey?: string): Promise<
|
|
290
|
+
batchScrapeUrls(urls: string[], params?: ScrapeParams, pollInterval?: number, idempotencyKey?: string): Promise<BatchScrapeStatusResponse | ErrorResponse>;
|
|
291
|
+
asyncBatchScrapeUrls(urls: string[], params?: ScrapeParams, idempotencyKey?: string): Promise<BatchScrapeResponse | ErrorResponse>;
|
|
268
292
|
/**
|
|
269
293
|
* Initiates a batch scrape job and returns a CrawlWatcher to monitor the job via WebSocket.
|
|
270
294
|
* @param urls - The URL to scrape.
|
|
@@ -279,7 +303,7 @@ declare class FirecrawlApp {
|
|
|
279
303
|
* @param getAllData - Paginate through all the pages of documents, returning the full list of all documents. (default: `false`)
|
|
280
304
|
* @returns The response containing the job status.
|
|
281
305
|
*/
|
|
282
|
-
checkBatchScrapeStatus(id?: string, getAllData?: boolean): Promise<
|
|
306
|
+
checkBatchScrapeStatus(id?: string, getAllData?: boolean): Promise<BatchScrapeStatusResponse | ErrorResponse>;
|
|
283
307
|
/**
|
|
284
308
|
* Prepares the headers for an API request.
|
|
285
309
|
* @param idempotencyKey - Optional key to ensure idempotency.
|
|
@@ -344,4 +368,4 @@ declare class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
|
|
|
344
368
|
close(): void;
|
|
345
369
|
}
|
|
346
370
|
|
|
347
|
-
export { type Action, type ActionsResult, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, FirecrawlError, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
|
371
|
+
export { type Action, type ActionsResult, type BatchScrapeResponse, type BatchScrapeStatusResponse, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, FirecrawlError, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,16 @@ interface CrawlResponse {
|
|
|
142
142
|
success: true;
|
|
143
143
|
error?: string;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Response interface for batch scrape operations.
|
|
147
|
+
* Defines the structure of the response received after initiating a crawl.
|
|
148
|
+
*/
|
|
149
|
+
interface BatchScrapeResponse {
|
|
150
|
+
id?: string;
|
|
151
|
+
url?: string;
|
|
152
|
+
success: true;
|
|
153
|
+
error?: string;
|
|
154
|
+
}
|
|
145
155
|
/**
|
|
146
156
|
* Response interface for job status checks.
|
|
147
157
|
* Provides detailed status of a crawl job including progress and results.
|
|
@@ -156,6 +166,20 @@ interface CrawlStatusResponse {
|
|
|
156
166
|
next?: string;
|
|
157
167
|
data: FirecrawlDocument<undefined>[];
|
|
158
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Response interface for batch scrape job status checks.
|
|
171
|
+
* Provides detailed status of a batch scrape job including progress and results.
|
|
172
|
+
*/
|
|
173
|
+
interface BatchScrapeStatusResponse {
|
|
174
|
+
success: true;
|
|
175
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
176
|
+
completed: number;
|
|
177
|
+
total: number;
|
|
178
|
+
creditsUsed: number;
|
|
179
|
+
expiresAt: Date;
|
|
180
|
+
next?: string;
|
|
181
|
+
data: FirecrawlDocument<undefined>[];
|
|
182
|
+
}
|
|
159
183
|
/**
|
|
160
184
|
* Parameters for mapping operations.
|
|
161
185
|
* Defines options for mapping URLs during a crawl.
|
|
@@ -263,8 +287,8 @@ declare class FirecrawlApp {
|
|
|
263
287
|
* @param idempotencyKey - Optional idempotency key for the request.
|
|
264
288
|
* @returns The response from the crawl operation.
|
|
265
289
|
*/
|
|
266
|
-
batchScrapeUrls(urls: string[], params?: ScrapeParams, pollInterval?: number, idempotencyKey?: string): Promise<
|
|
267
|
-
asyncBatchScrapeUrls(urls: string[], params?: ScrapeParams, idempotencyKey?: string): Promise<
|
|
290
|
+
batchScrapeUrls(urls: string[], params?: ScrapeParams, pollInterval?: number, idempotencyKey?: string): Promise<BatchScrapeStatusResponse | ErrorResponse>;
|
|
291
|
+
asyncBatchScrapeUrls(urls: string[], params?: ScrapeParams, idempotencyKey?: string): Promise<BatchScrapeResponse | ErrorResponse>;
|
|
268
292
|
/**
|
|
269
293
|
* Initiates a batch scrape job and returns a CrawlWatcher to monitor the job via WebSocket.
|
|
270
294
|
* @param urls - The URL to scrape.
|
|
@@ -279,7 +303,7 @@ declare class FirecrawlApp {
|
|
|
279
303
|
* @param getAllData - Paginate through all the pages of documents, returning the full list of all documents. (default: `false`)
|
|
280
304
|
* @returns The response containing the job status.
|
|
281
305
|
*/
|
|
282
|
-
checkBatchScrapeStatus(id?: string, getAllData?: boolean): Promise<
|
|
306
|
+
checkBatchScrapeStatus(id?: string, getAllData?: boolean): Promise<BatchScrapeStatusResponse | ErrorResponse>;
|
|
283
307
|
/**
|
|
284
308
|
* Prepares the headers for an API request.
|
|
285
309
|
* @param idempotencyKey - Optional key to ensure idempotency.
|
|
@@ -344,4 +368,4 @@ declare class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
|
|
|
344
368
|
close(): void;
|
|
345
369
|
}
|
|
346
370
|
|
|
347
|
-
export { type Action, type ActionsResult, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, FirecrawlError, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
|
371
|
+
export { type Action, type ActionsResult, type BatchScrapeResponse, type BatchScrapeStatusResponse, type CrawlParams, type CrawlResponse, type CrawlScrapeOptions, type CrawlStatusResponse, CrawlWatcher, type ErrorResponse, type FirecrawlAppConfig, type FirecrawlDocument, type FirecrawlDocumentMetadata, FirecrawlError, type MapParams, type MapResponse, type ScrapeParams, type ScrapeResponse, FirecrawlApp as default };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -154,6 +154,17 @@ export interface CrawlResponse {
|
|
|
154
154
|
error?: string;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Response interface for batch scrape operations.
|
|
159
|
+
* Defines the structure of the response received after initiating a crawl.
|
|
160
|
+
*/
|
|
161
|
+
export interface BatchScrapeResponse {
|
|
162
|
+
id?: string;
|
|
163
|
+
url?: string;
|
|
164
|
+
success: true;
|
|
165
|
+
error?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
157
168
|
/**
|
|
158
169
|
* Response interface for job status checks.
|
|
159
170
|
* Provides detailed status of a crawl job including progress and results.
|
|
@@ -169,6 +180,21 @@ export interface CrawlStatusResponse {
|
|
|
169
180
|
data: FirecrawlDocument<undefined>[];
|
|
170
181
|
};
|
|
171
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Response interface for batch scrape job status checks.
|
|
185
|
+
* Provides detailed status of a batch scrape job including progress and results.
|
|
186
|
+
*/
|
|
187
|
+
export interface BatchScrapeStatusResponse {
|
|
188
|
+
success: true;
|
|
189
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
190
|
+
completed: number;
|
|
191
|
+
total: number;
|
|
192
|
+
creditsUsed: number;
|
|
193
|
+
expiresAt: Date;
|
|
194
|
+
next?: string;
|
|
195
|
+
data: FirecrawlDocument<undefined>[];
|
|
196
|
+
};
|
|
197
|
+
|
|
172
198
|
/**
|
|
173
199
|
* Parameters for mapping operations.
|
|
174
200
|
* Defines options for mapping URLs during a crawl.
|
|
@@ -506,7 +532,7 @@ export default class FirecrawlApp {
|
|
|
506
532
|
params?: ScrapeParams,
|
|
507
533
|
pollInterval: number = 2,
|
|
508
534
|
idempotencyKey?: string
|
|
509
|
-
): Promise<
|
|
535
|
+
): Promise<BatchScrapeStatusResponse | ErrorResponse> {
|
|
510
536
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
511
537
|
let jsonData: any = { urls, ...(params ?? {}) };
|
|
512
538
|
try {
|
|
@@ -535,7 +561,7 @@ export default class FirecrawlApp {
|
|
|
535
561
|
urls: string[],
|
|
536
562
|
params?: ScrapeParams,
|
|
537
563
|
idempotencyKey?: string
|
|
538
|
-
): Promise<
|
|
564
|
+
): Promise<BatchScrapeResponse | ErrorResponse> {
|
|
539
565
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
540
566
|
let jsonData: any = { urls, ...(params ?? {}) };
|
|
541
567
|
try {
|
|
@@ -587,7 +613,7 @@ export default class FirecrawlApp {
|
|
|
587
613
|
* @param getAllData - Paginate through all the pages of documents, returning the full list of all documents. (default: `false`)
|
|
588
614
|
* @returns The response containing the job status.
|
|
589
615
|
*/
|
|
590
|
-
async checkBatchScrapeStatus(id?: string, getAllData = false): Promise<
|
|
616
|
+
async checkBatchScrapeStatus(id?: string, getAllData = false): Promise<BatchScrapeStatusResponse | ErrorResponse> {
|
|
591
617
|
if (!id) {
|
|
592
618
|
throw new FirecrawlError("No batch scrape ID provided", 400);
|
|
593
619
|
}
|