@mendable/firecrawl 1.19.2 → 1.20.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.cjs CHANGED
@@ -607,7 +607,7 @@ var FirecrawlApp = class {
607
607
  /**
608
608
  * Extracts information from URLs using the Firecrawl API.
609
609
  * Currently in Beta. Expect breaking changes on future minor versions.
610
- * @param url - The URL to extract information from.
610
+ * @param urls - The URLs to extract information from. Optional if using other methods for data extraction.
611
611
  * @param params - Additional parameters for the extract request.
612
612
  * @returns The response from the extract operation.
613
613
  */
@@ -841,7 +841,7 @@ var FirecrawlApp = class {
841
841
  * @param {string} action - The action being performed when the error occurred.
842
842
  */
843
843
  handleError(response, action) {
844
- if ([400, 402, 408, 409, 500].includes(response.status)) {
844
+ if ([400, 402, 403, 408, 409, 500].includes(response.status)) {
845
845
  const errorMessage = response.data.error || "Unknown error occurred";
846
846
  const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : "";
847
847
  throw new FirecrawlError(
package/dist/index.d.cts CHANGED
@@ -97,6 +97,7 @@ type Action = {
97
97
  } | {
98
98
  type: "click";
99
99
  selector: string;
100
+ all?: boolean;
100
101
  } | {
101
102
  type: "screenshot";
102
103
  fullPage?: boolean;
@@ -543,11 +544,11 @@ declare class FirecrawlApp {
543
544
  /**
544
545
  * Extracts information from URLs using the Firecrawl API.
545
546
  * Currently in Beta. Expect breaking changes on future minor versions.
546
- * @param url - The URL to extract information from.
547
+ * @param urls - The URLs to extract information from. Optional if using other methods for data extraction.
547
548
  * @param params - Additional parameters for the extract request.
548
549
  * @returns The response from the extract operation.
549
550
  */
550
- extract<T extends zt.ZodSchema = any>(urls: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse>;
551
+ extract<T extends zt.ZodSchema = any>(urls?: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse>;
551
552
  /**
552
553
  * Initiates an asynchronous extract job for a URL using the Firecrawl API.
553
554
  * @param url - The URL to extract data from.
package/dist/index.d.ts CHANGED
@@ -97,6 +97,7 @@ type Action = {
97
97
  } | {
98
98
  type: "click";
99
99
  selector: string;
100
+ all?: boolean;
100
101
  } | {
101
102
  type: "screenshot";
102
103
  fullPage?: boolean;
@@ -543,11 +544,11 @@ declare class FirecrawlApp {
543
544
  /**
544
545
  * Extracts information from URLs using the Firecrawl API.
545
546
  * Currently in Beta. Expect breaking changes on future minor versions.
546
- * @param url - The URL to extract information from.
547
+ * @param urls - The URLs to extract information from. Optional if using other methods for data extraction.
547
548
  * @param params - Additional parameters for the extract request.
548
549
  * @returns The response from the extract operation.
549
550
  */
550
- extract<T extends zt.ZodSchema = any>(urls: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse>;
551
+ extract<T extends zt.ZodSchema = any>(urls?: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse>;
551
552
  /**
552
553
  * Initiates an asynchronous extract job for a URL using the Firecrawl API.
553
554
  * @param url - The URL to extract data from.
package/dist/index.js CHANGED
@@ -571,7 +571,7 @@ var FirecrawlApp = class {
571
571
  /**
572
572
  * Extracts information from URLs using the Firecrawl API.
573
573
  * Currently in Beta. Expect breaking changes on future minor versions.
574
- * @param url - The URL to extract information from.
574
+ * @param urls - The URLs to extract information from. Optional if using other methods for data extraction.
575
575
  * @param params - Additional parameters for the extract request.
576
576
  * @returns The response from the extract operation.
577
577
  */
@@ -805,7 +805,7 @@ var FirecrawlApp = class {
805
805
  * @param {string} action - The action being performed when the error occurred.
806
806
  */
807
807
  handleError(response, action) {
808
- if ([400, 402, 408, 409, 500].includes(response.status)) {
808
+ if ([400, 402, 403, 408, 409, 500].includes(response.status)) {
809
809
  const errorMessage = response.data.error || "Unknown error occurred";
810
810
  const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : "";
811
811
  throw new FirecrawlError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl",
3
- "version": "1.19.2",
3
+ "version": "1.20.1",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -104,6 +104,7 @@ export type Action = {
104
104
  } | {
105
105
  type: "click",
106
106
  selector: string,
107
+ all?: boolean,
107
108
  } | {
108
109
  type: "screenshot",
109
110
  fullPage?: boolean,
@@ -1119,14 +1120,14 @@ export default class FirecrawlApp {
1119
1120
  /**
1120
1121
  * Extracts information from URLs using the Firecrawl API.
1121
1122
  * Currently in Beta. Expect breaking changes on future minor versions.
1122
- * @param url - The URL to extract information from.
1123
+ * @param urls - The URLs to extract information from. Optional if using other methods for data extraction.
1123
1124
  * @param params - Additional parameters for the extract request.
1124
1125
  * @returns The response from the extract operation.
1125
1126
  */
1126
- async extract<T extends zt.ZodSchema = any>(urls: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse> {
1127
+ async extract<T extends zt.ZodSchema = any>(urls?: string[], params?: ExtractParams<T>): Promise<ExtractResponse<zt.infer<T>> | ErrorResponse> {
1127
1128
  const headers = this.prepareHeaders();
1128
1129
 
1129
- let jsonData: { urls: string[] } & ExtractParams<T> = { urls, ...params };
1130
+ let jsonData: { urls?: string[] } & ExtractParams<T> = { urls: urls, ...params };
1130
1131
  let jsonSchema: any;
1131
1132
  try {
1132
1133
  if (!params?.schema) {
@@ -1388,7 +1389,7 @@ export default class FirecrawlApp {
1388
1389
  * @param {string} action - The action being performed when the error occurred.
1389
1390
  */
1390
1391
  handleError(response: AxiosResponse, action: string): void {
1391
- if ([400, 402, 408, 409, 500].includes(response.status)) {
1392
+ if ([400, 402, 403, 408, 409, 500].includes(response.status)) {
1392
1393
  const errorMessage: string =
1393
1394
  response.data.error || "Unknown error occurred";
1394
1395
  const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';