@mendable/firecrawl-js 4.43.0 → 4.44.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.
@@ -12,7 +12,7 @@ var require_package = __commonJS({
12
12
  "package.json"(exports, module) {
13
13
  module.exports = {
14
14
  name: "@mendable/firecrawl-js",
15
- version: "4.43.0",
15
+ version: "4.44.1",
16
16
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
17
17
  main: "dist/index.js",
18
18
  types: "dist/index.d.ts",
package/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports2, module2) {
40
40
  module2.exports = {
41
41
  name: "@mendable/firecrawl-js",
42
- version: "4.43.0",
42
+ version: "4.44.1",
43
43
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
44
44
  main: "dist/index.js",
45
45
  types: "dist/index.d.ts",
@@ -897,6 +897,8 @@ async function search(http, request) {
897
897
 
898
898
  // src/v2/methods/tools.ts
899
899
  var ALEXANDRIA_MAX_CALLS = 10;
900
+ var ALEXANDRIA_MAX_TIMEOUT_MS = 12e4;
901
+ var ALEXANDRIA_RESPONSE_MARGIN_MS = 3e4;
900
902
  function prepareAlexandriaPayload(calls, opts) {
901
903
  if (!Array.isArray(calls) || calls.length === 0) {
902
904
  throw new Error("alexandria requires at least one call");
@@ -946,7 +948,10 @@ async function scrapeAlexandria(http, calls, opts = {}) {
946
948
  const res = await http.post("/v2/scrape", payload, {
947
949
  headers: { "x-request-id": requestId },
948
950
  // Allow response delivery after the API's capped execution deadline.
949
- timeoutMs: Math.min(opts.timeout ?? 5e4, 5e4) + 3e4
951
+ timeoutMs: Math.min(
952
+ opts.timeout ?? ALEXANDRIA_MAX_TIMEOUT_MS,
953
+ ALEXANDRIA_MAX_TIMEOUT_MS
954
+ ) + ALEXANDRIA_RESPONSE_MARGIN_MS
950
955
  });
951
956
  if (res.status !== 200 || !res.data?.success) {
952
957
  throwForBadResponse(res, "alexandria");
@@ -1663,6 +1668,7 @@ async function browser(http, args = {}) {
1663
1668
  if (args.ttl != null) body.ttl = args.ttl;
1664
1669
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
1665
1670
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
1671
+ if (args.blockAds != null) body.blockAds = args.blockAds;
1666
1672
  if (args.profile != null) body.profile = args.profile;
1667
1673
  if (args.integration != null) body.integration = args.integration;
1668
1674
  if (args.origin) body.origin = args.origin;
@@ -2727,7 +2733,7 @@ var FirecrawlClient = class {
2727
2733
  // Browser
2728
2734
  /**
2729
2735
  * Create a new browser session.
2730
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2736
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2731
2737
  * @returns Session id, CDP URL, live view URL, and expiration time.
2732
2738
  */
2733
2739
  async browser(args = {}) {
package/dist/index.d.cts CHANGED
@@ -2105,6 +2105,8 @@ declare function browser(http: HttpClient, args?: {
2105
2105
  ttl?: number;
2106
2106
  activityTtl?: number;
2107
2107
  streamWebView?: boolean;
2108
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
2109
+ blockAds?: boolean;
2108
2110
  profile?: {
2109
2111
  name: string;
2110
2112
  saveChanges?: boolean;
@@ -2572,7 +2574,7 @@ declare class FirecrawlClient {
2572
2574
  }): Promise<AgentThreadResponse>;
2573
2575
  /**
2574
2576
  * Create a new browser session.
2575
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2577
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2576
2578
  * @returns Session id, CDP URL, live view URL, and expiration time.
2577
2579
  */
2578
2580
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
package/dist/index.d.ts CHANGED
@@ -2105,6 +2105,8 @@ declare function browser(http: HttpClient, args?: {
2105
2105
  ttl?: number;
2106
2106
  activityTtl?: number;
2107
2107
  streamWebView?: boolean;
2108
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
2109
+ blockAds?: boolean;
2108
2110
  profile?: {
2109
2111
  name: string;
2110
2112
  saveChanges?: boolean;
@@ -2572,7 +2574,7 @@ declare class FirecrawlClient {
2572
2574
  }): Promise<AgentThreadResponse>;
2573
2575
  /**
2574
2576
  * Create a new browser session.
2575
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2577
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2576
2578
  * @returns Session id, CDP URL, live view URL, and expiration time.
2577
2579
  */
2578
2580
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-HEXXQWYV.js";
3
+ } from "./chunk-JU6NENYM.js";
4
4
 
5
5
  // src/v2/utils/httpClient.ts
6
6
  import axios from "axios";
@@ -765,6 +765,8 @@ async function search(http, request) {
765
765
 
766
766
  // src/v2/methods/tools.ts
767
767
  var ALEXANDRIA_MAX_CALLS = 10;
768
+ var ALEXANDRIA_MAX_TIMEOUT_MS = 12e4;
769
+ var ALEXANDRIA_RESPONSE_MARGIN_MS = 3e4;
768
770
  function prepareAlexandriaPayload(calls, opts) {
769
771
  if (!Array.isArray(calls) || calls.length === 0) {
770
772
  throw new Error("alexandria requires at least one call");
@@ -814,7 +816,10 @@ async function scrapeAlexandria(http, calls, opts = {}) {
814
816
  const res = await http.post("/v2/scrape", payload, {
815
817
  headers: { "x-request-id": requestId },
816
818
  // Allow response delivery after the API's capped execution deadline.
817
- timeoutMs: Math.min(opts.timeout ?? 5e4, 5e4) + 3e4
819
+ timeoutMs: Math.min(
820
+ opts.timeout ?? ALEXANDRIA_MAX_TIMEOUT_MS,
821
+ ALEXANDRIA_MAX_TIMEOUT_MS
822
+ ) + ALEXANDRIA_RESPONSE_MARGIN_MS
818
823
  });
819
824
  if (res.status !== 200 || !res.data?.success) {
820
825
  throwForBadResponse(res, "alexandria");
@@ -1531,6 +1536,7 @@ async function browser(http, args = {}) {
1531
1536
  if (args.ttl != null) body.ttl = args.ttl;
1532
1537
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
1533
1538
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
1539
+ if (args.blockAds != null) body.blockAds = args.blockAds;
1534
1540
  if (args.profile != null) body.profile = args.profile;
1535
1541
  if (args.integration != null) body.integration = args.integration;
1536
1542
  if (args.origin) body.origin = args.origin;
@@ -2595,7 +2601,7 @@ var FirecrawlClient = class {
2595
2601
  // Browser
2596
2602
  /**
2597
2603
  * Create a new browser session.
2598
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2604
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2599
2605
  * @returns Session id, CDP URL, live view URL, and expiration time.
2600
2606
  */
2601
2607
  async browser(args = {}) {
@@ -2734,7 +2740,7 @@ var FirecrawlApp = class {
2734
2740
  if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
2735
2741
  return process.env.npm_package_version;
2736
2742
  }
2737
- const packageJson = await import("./package-GSILJ5AJ.js");
2743
+ const packageJson = await import("./package-FEZU4ANT.js");
2738
2744
  return packageJson.default.version;
2739
2745
  } catch (error) {
2740
2746
  const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
@@ -1,4 +1,4 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-HEXXQWYV.js";
3
+ } from "./chunk-JU6NENYM.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "4.43.0",
3
+ "version": "4.44.1",
4
4
  "description": "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -272,9 +272,11 @@ describe("Alexandria contracts and execution", () => {
272
272
  });
273
273
 
274
274
  test.each([
275
- [undefined, 80000],
275
+ [undefined, 150000],
276
276
  [1000, 31000],
277
- [100000, 80000],
277
+ [100000, 130000],
278
+ [120000, 150000],
279
+ [300000, 150000],
278
280
  ])(
279
281
  "Alexandria timeout %s allows response delivery (%s ms)",
280
282
  async (timeout, timeoutMs) => {
package/src/v2/client.ts CHANGED
@@ -641,7 +641,7 @@ export class FirecrawlClient {
641
641
  // Browser
642
642
  /**
643
643
  * Create a new browser session.
644
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
644
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
645
645
  * @returns Session id, CDP URL, live view URL, and expiration time.
646
646
  */
647
647
  async browser(
@@ -16,6 +16,8 @@ export async function browser(
16
16
  ttl?: number;
17
17
  activityTtl?: number;
18
18
  streamWebView?: boolean;
19
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
20
+ blockAds?: boolean;
19
21
  profile?: {
20
22
  name: string;
21
23
  saveChanges?: boolean;
@@ -28,6 +30,7 @@ export async function browser(
28
30
  if (args.ttl != null) body.ttl = args.ttl;
29
31
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
30
32
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
33
+ if (args.blockAds != null) body.blockAds = args.blockAds;
31
34
  if (args.profile != null) body.profile = args.profile;
32
35
  if (args.integration != null) body.integration = args.integration;
33
36
  if (args.origin) body.origin = args.origin;
@@ -14,6 +14,10 @@ import {
14
14
  } from "../utils/errorHandler";
15
15
 
16
16
  const ALEXANDRIA_MAX_CALLS = 10;
17
+ // Matches the API's default and maximum execution timeout for Alexandria calls.
18
+ const ALEXANDRIA_MAX_TIMEOUT_MS = 120_000;
19
+ // Extra time for the API to deliver a response after its execution deadline.
20
+ const ALEXANDRIA_RESPONSE_MARGIN_MS = 30_000;
17
21
 
18
22
  function prepareAlexandriaPayload(
19
23
  calls: AlexandriaCall[],
@@ -82,7 +86,11 @@ export async function scrapeAlexandria(
82
86
  }>("/v2/scrape", payload, {
83
87
  headers: { "x-request-id": requestId },
84
88
  // Allow response delivery after the API's capped execution deadline.
85
- timeoutMs: Math.min(opts.timeout ?? 50000, 50000) + 30000,
89
+ timeoutMs:
90
+ Math.min(
91
+ opts.timeout ?? ALEXANDRIA_MAX_TIMEOUT_MS,
92
+ ALEXANDRIA_MAX_TIMEOUT_MS,
93
+ ) + ALEXANDRIA_RESPONSE_MARGIN_MS,
86
94
  });
87
95
  if (res.status !== 200 || !res.data?.success) {
88
96
  throwForBadResponse(res, "alexandria");