Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick: fixes

Nicolas60b6e6b1d4bd
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json
index e50205d5c..0dfb4d69d 100644
--- a/apps/js-sdk/firecrawl/package.json
+++ b/apps/js-sdk/firecrawl/package.json
@@ -1,6 +1,6 @@
{
- "name": "firecrawl",
- "version": "1.6.1",
+ "name": "@mendable/firecrawl-js",
+ "version": "1.7.0-beta.2",
"description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts
index e9985683d..3e9c7bdf9 100644
--- a/apps/js-sdk/firecrawl/src/index.ts
+++ b/apps/js-sdk/firecrawl/src/index.ts
@@ -154,6 +154,17 @@ export interface CrawlResponse {
error?: string;
}
+/**
+ * Response interface for crawling operations.
+ * Defines the structure of the response received after initiating a crawl.
+ */
+export interface BatchScrapeResponse {
+ id?: string;
+ url?: string;
+ success: true;
+ error?: string;
+}
+
/**
* Response interface for job status checks.
* Provides detailed status of a crawl job including progress and results.
@@ -169,6 +180,21 @@ export interface CrawlStatusResponse {
data: FirecrawlDocument<undefined>[];
};
+/**
+ * Response interface for job status checks.
+ * Provides detailed status of a crawl job including progress and results.
+ */
+export interface BatchScrapeStatusResponse {
+ success: true;
+ status: "scraping" | "completed" | "failed" | "cancelled";
+ completed: number;
+ total: number;
+ creditsUsed: number;
+ expiresAt: Date;
+ next?: string;
+ data: FirecrawlDocument<undefined>[];
+};
+
/**
* Parameters for mapping operations.
* Defines options for mapping URLs during a crawl.
@@ -506,7 +532,7 @@ export default class FirecrawlApp {
params?: ScrapeParams,
pollInterval: number = 2,
idempotencyKey?: string
- ): Promise<CrawlStatusResponse | ErrorResponse> {
+ ): Promise<BatchScrapeStatusResponse | ErrorResponse> {
const headers = this.prepareHeaders(idempotencyKey);
let jsonData: any = { urls, ...(params ?? {}) };
try {
@@ -535,7 +561,7 @@ export default class FirecrawlApp {
urls: string[],
params?: ScrapeParams,
idempotencyKey?: string
- ): Promise<CrawlResponse | ErrorResponse> {
+ ): Promise<BatchScrapeResponse | ErrorResponse> {
const headers = this.prepareHeaders(idempotencyKey);
let jsonData: any = { urls, ...(params ?? {}) };
try {
@@ -587,7 +613,7 @@ export default class FirecrawlApp {
* @param getAllData - Paginate through all the pages of documents, returning the full list of all documents. (default: `false`)
* @returns The response containing the job status.
*/
- async checkBatchScrapeStatus(id?: string, getAllData = false): Promise<CrawlStatusResponse | ErrorResponse> {
+ async checkBatchScrapeStatus(id?: string, getAllData = false): Promise<BatchScrapeStatusResponse | ErrorResponse> {
if (!id) {
throw new FirecrawlError("No batch scrape ID provided", 400);
}