firecrawl 4.45.0 → 4.47.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.
Files changed (75) hide show
  1. package/README.md +8 -8
  2. package/audit-ci.jsonc +1 -15
  3. package/dist/chunk-H75FJ6LW.js +114 -0
  4. package/dist/index.cjs +61 -27
  5. package/dist/index.d.cts +15 -3
  6. package/dist/index.d.ts +15 -3
  7. package/dist/index.js +58 -21
  8. package/dist/package-NZI5TDUV.js +40 -0
  9. package/package.json +5 -9
  10. package/pnpm-workspace.yaml +0 -6
  11. package/src/__tests__/e2e/v1/index.test.ts +1 -1
  12. package/src/__tests__/e2e/v2/batch.test.ts +1 -1
  13. package/src/__tests__/e2e/v2/crawl.test.ts +1 -1
  14. package/src/__tests__/e2e/v2/extract.test.ts +1 -1
  15. package/src/__tests__/e2e/v2/map.test.ts +1 -1
  16. package/src/__tests__/e2e/v2/parse.test.ts +1 -1
  17. package/src/__tests__/e2e/v2/scrape.test.ts +1 -1
  18. package/src/__tests__/e2e/v2/search.test.ts +1 -1
  19. package/src/__tests__/e2e/v2/usage.test.ts +1 -1
  20. package/src/__tests__/e2e/v2/utils/rateLimit.ts +2 -2
  21. package/src/__tests__/e2e/v2/watcher.test.ts +1 -1
  22. package/src/__tests__/unit/v1/batch-scrape-poll.test.ts +7 -7
  23. package/src/__tests__/unit/v1/monitor-job-status-retry.test.ts +6 -6
  24. package/src/__tests__/unit/v1/next-url-pinning.test.ts +3 -3
  25. package/src/__tests__/unit/v1/optional-params.test.ts +4 -4
  26. package/src/__tests__/unit/v2/agent-effort-trace.unit.test.ts +6 -6
  27. package/src/__tests__/unit/v2/agent-hints.test.ts +3 -3
  28. package/src/__tests__/unit/v2/agent-list.unit.test.ts +4 -4
  29. package/src/__tests__/unit/v2/agent-thread.unit.test.ts +7 -7
  30. package/src/__tests__/unit/v2/agent.test.ts +1 -1
  31. package/src/__tests__/unit/v2/audit-metadata.unit.test.ts +3 -3
  32. package/src/__tests__/unit/v2/branding.test.ts +2 -2
  33. package/src/__tests__/unit/v2/browser.unit.test.ts +28 -0
  34. package/src/__tests__/unit/v2/clientOptions.test.ts +1 -0
  35. package/src/__tests__/unit/v2/crawl-cancel-abort.unit.test.ts +1 -1
  36. package/src/__tests__/unit/v2/developer.test.ts +4 -4
  37. package/src/__tests__/unit/v2/e2eRateLimitRetry.test.ts +16 -16
  38. package/src/__tests__/unit/v2/errorHandler.test.ts +24 -1
  39. package/src/__tests__/unit/v2/extract.unit.test.ts +4 -4
  40. package/src/__tests__/unit/v2/gov.test.ts +4 -4
  41. package/src/__tests__/unit/v2/menu.test.ts +2 -2
  42. package/src/__tests__/unit/v2/monitor-search-target.test.ts +1 -0
  43. package/src/__tests__/unit/v2/next-url-pinning.test.ts +1 -1
  44. package/src/__tests__/unit/v2/pagination.test.ts +26 -6
  45. package/src/__tests__/unit/v2/parse-formats.unit.test.ts +1 -1
  46. package/src/__tests__/unit/v2/parse.unit.test.ts +1 -1
  47. package/src/__tests__/unit/v2/product.test.ts +2 -2
  48. package/src/__tests__/unit/v2/prototype-discoverability.test.ts +1 -0
  49. package/src/__tests__/unit/v2/research.test.ts +1 -1
  50. package/src/__tests__/unit/v2/scrape-browser.unit.test.ts +8 -8
  51. package/src/__tests__/unit/v2/scrape.unit.test.ts +1 -1
  52. package/src/__tests__/unit/v2/scrapeAutoResume.test.ts +13 -13
  53. package/src/__tests__/unit/v2/search-country.unit.test.ts +2 -2
  54. package/src/__tests__/unit/v2/search-data-property.test.ts +3 -3
  55. package/src/__tests__/unit/v2/search-developer.unit.test.ts +2 -2
  56. package/src/__tests__/unit/v2/search-highlights.unit.test.ts +2 -2
  57. package/src/__tests__/unit/v2/threat-protection.unit.test.ts +3 -3
  58. package/src/__tests__/unit/v2/tools.unit.test.ts +3 -3
  59. package/src/__tests__/unit/v2/v1-aliases.test.ts +2 -2
  60. package/src/__tests__/unit/v2/validation.test.ts +40 -2
  61. package/src/__tests__/unit/v2/zodSchemaToJson.test.ts +1 -1
  62. package/src/v1/index.ts +1 -3
  63. package/src/v2/client.ts +1 -1
  64. package/src/v2/methods/browser.ts +3 -0
  65. package/src/v2/methods/crawl.ts +2 -1
  66. package/src/v2/methods/search.ts +2 -1
  67. package/src/v2/types.ts +10 -2
  68. package/src/v2/utils/errorHandler.ts +23 -2
  69. package/src/v2/utils/getVersion.ts +4 -12
  70. package/src/v2/utils/pagination.ts +4 -1
  71. package/src/v2/utils/validation.ts +28 -0
  72. package/vitest.config.ts +7 -0
  73. package/dist/chunk-LKCOCWYW.js +0 -97
  74. package/dist/package-C6PK3CK7.js +0 -4
  75. package/jest.config.js +0 -16
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Firecrawl Node SDK
2
2
 
3
- The Firecrawl Node SDK is a library that lets you easily search, scrape, and interact with the web for AI agents — returning clean Markdown or structured data your agents can ship with. It provides a simple and intuitive interface for the Firecrawl API.
3
+ The Firecrawl Node SDK is the JavaScript client for the Firecrawl API, the context API for AI agents. Search, scrape, parse, crawl, map, and interact with the web, and get back clean Markdown or structured data your agents can ship with.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,7 +13,7 @@ npm install firecrawl
13
13
  ## Usage
14
14
 
15
15
  1. Get an API key from [firecrawl.dev](https://firecrawl.dev)
16
- 2. Set the API key as an environment variable named `FIRECRAWL_API_KEY` or pass it as a parameter to the `FirecrawlApp` class.
16
+ 2. Set the API key as an environment variable named `FIRECRAWL_API_KEY` or pass it as the `apiKey` option to the `Firecrawl` class.
17
17
 
18
18
  Here's an example of how to use the SDK with error handling:
19
19
 
@@ -126,7 +126,7 @@ const crawlResponse = await app.crawl('https://firecrawl.dev', {
126
126
  To start an asynchronous crawl, use `startCrawl`. It returns a job ID you can poll with `getCrawlStatus`.
127
127
 
128
128
  ```js
129
- const start = await app.startCrawl('https://mendable.ai', {
129
+ const start = await app.startCrawl('https://firecrawl.dev', {
130
130
  excludePaths: ['blog/*'],
131
131
  limit: 5,
132
132
  });
@@ -137,7 +137,7 @@ const start = await app.startCrawl('https://mendable.ai', {
137
137
  To check the status of a crawl job with error handling, use the `getCrawlStatus` method. It takes the job ID as a parameter and returns the current status.
138
138
 
139
139
  ```js
140
- const status = await app.getCrawlStatus(id);
140
+ const status = await app.getCrawlStatus(start.id);
141
141
  ```
142
142
 
143
143
  ### Extracting structured data from URLs
@@ -323,7 +323,7 @@ await app.stopInteraction(scrapeJobId);
323
323
  To receive real‑time updates, start a crawl and attach a watcher.
324
324
 
325
325
  ```js
326
- const start = await app.startCrawl('https://mendable.ai', { excludePaths: ['blog/*'], limit: 5 });
326
+ const start = await app.startCrawl('https://firecrawl.dev', { excludePaths: ['blog/*'], limit: 5 });
327
327
  const watch = app.watcher(start.id, { kind: 'crawl', pollInterval: 2 });
328
328
 
329
329
  watch.on('document', (doc) => {
@@ -346,7 +346,7 @@ await watch.start();
346
346
  To batch scrape multiple URLs with error handling, use the `batchScrape` method.
347
347
 
348
348
  ```js
349
- const batchScrapeResponse = await app.batchScrape(['https://firecrawl.dev', 'https://mendable.ai'], {
349
+ const batchScrapeResponse = await app.batchScrape(['https://firecrawl.dev', 'https://docs.firecrawl.dev'], {
350
350
  formats: ['markdown', 'html'],
351
351
  });
352
352
  ```
@@ -357,7 +357,7 @@ const batchScrapeResponse = await app.batchScrape(['https://firecrawl.dev', 'htt
357
357
  To start an asynchronous batch scrape, use `startBatchScrape` and poll with `getBatchScrapeStatus`.
358
358
 
359
359
  ```js
360
- const asyncBatchScrapeResult = await app.startBatchScrape(['https://firecrawl.dev', 'https://mendable.ai'], {
360
+ const asyncBatchScrapeResult = await app.startBatchScrape(['https://firecrawl.dev', 'https://docs.firecrawl.dev'], {
361
361
  formats: ['markdown', 'html'],
362
362
  });
363
363
  ```
@@ -367,7 +367,7 @@ const asyncBatchScrapeResult = await app.startBatchScrape(['https://firecrawl.de
367
367
  To use batch scrape with real‑time updates, start the job and watch it using the watcher.
368
368
 
369
369
  ```js
370
- const start = await app.startBatchScrape(['https://firecrawl.dev', 'https://mendable.ai'], { formats: ['markdown', 'html'] });
370
+ const start = await app.startBatchScrape(['https://firecrawl.dev', 'https://docs.firecrawl.dev'], { formats: ['markdown', 'html'] });
371
371
  const watch = app.watcher(start.id, { kind: 'batch', pollInterval: 2 });
372
372
 
373
373
  watch.on('document', (doc) => {
package/audit-ci.jsonc CHANGED
@@ -1,19 +1,5 @@
1
1
  {
2
2
  "$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
3
3
  "low": true,
4
- "allowlist": [
5
- // GHSA-vfj7-8cjw-p6xm (braces):
6
- // Latest published braces is 3.0.3; advisory range is <=3.0.3 and
7
- // no 3.0.4+ exists on npm. Same-major jest 30.x still resolves
8
- // 3.0.3 via micromatch. Cannot override to a non-existent version.
9
- // Owner: team-engineering-reviewers. Tracking: create internal ticket.
10
- // Expires: 2026-10-17.
11
- "GHSA-vfj7-8cjw-p6xm",
12
- // GHSA-hp3w-g68c-fv3c (sprintf-js):
13
- // Advisory asks for >=1.1.4; latest published sprintf-js is
14
- // 1.1.3. Cannot override to a non-existent version.
15
- // Owner: team-engineering-reviewers. Tracking: create internal ticket.
16
- // Expires: 2026-10-20.
17
- "GHSA-hp3w-g68c-fv3c"
18
- ]
4
+ "allowlist": []
19
5
  }
@@ -0,0 +1,114 @@
1
+ // package.json
2
+ var name = "@mendable/firecrawl-js";
3
+ var version = "4.47.0";
4
+ var 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
+ var main = "dist/index.js";
6
+ var types = "dist/index.d.ts";
7
+ var exports = {
8
+ "./package.json": "./package.json",
9
+ ".": {
10
+ import: "./dist/index.js",
11
+ default: "./dist/index.cjs"
12
+ }
13
+ };
14
+ var type = "module";
15
+ var scripts = {
16
+ build: "tsup",
17
+ "build-and-publish": "pnpm run build && pnpm publish --access public",
18
+ "publish-beta": "pnpm run build && pnpm publish --access public --tag beta",
19
+ test: "vitest run --reporter=verbose src/__tests__/e2e/v2",
20
+ "test:unit": "vitest run --reporter=verbose src/__tests__/unit"
21
+ };
22
+ var repository = {
23
+ type: "git",
24
+ url: "git+https://github.com/firecrawl/firecrawl.git"
25
+ };
26
+ var author = "Mendable.ai";
27
+ var license = "MIT";
28
+ var dependencies = {
29
+ axios: "1.20.0",
30
+ firecrawl: "4.30.1",
31
+ "typescript-event-target": "^1.1.1",
32
+ zod: "^3.23.8",
33
+ "zod-to-json-schema": "^3.23.0"
34
+ };
35
+ var bugs = {
36
+ url: "https://github.com/firecrawl/firecrawl/issues"
37
+ };
38
+ var homepage = "https://github.com/firecrawl/firecrawl#readme";
39
+ var devDependencies = {
40
+ "@types/dotenv": "^8.2.0",
41
+ "@types/node": "^20.12.12",
42
+ "@types/uuid": "^9.0.8",
43
+ dotenv: "^16.4.5",
44
+ tsup: "^8.5.0",
45
+ typescript: "^5.4.5",
46
+ uuid: "^14.0.0",
47
+ vitest: "^4.1.11"
48
+ };
49
+ var keywords = [
50
+ "firecrawl",
51
+ "mendable",
52
+ "crawler",
53
+ "web",
54
+ "scraper",
55
+ "api",
56
+ "sdk",
57
+ "web-search",
58
+ "literature-search",
59
+ "research",
60
+ "scientific-papers",
61
+ "academic-search",
62
+ "biomedical",
63
+ "life-sciences",
64
+ "pubmed",
65
+ "biorxiv",
66
+ "medrxiv",
67
+ "arxiv",
68
+ "preprints",
69
+ "citations",
70
+ "bioinformatics"
71
+ ];
72
+ var engines = {
73
+ node: ">=22.0.0"
74
+ };
75
+ var package_default = {
76
+ name,
77
+ version,
78
+ description,
79
+ main,
80
+ types,
81
+ exports,
82
+ type,
83
+ scripts,
84
+ repository,
85
+ author,
86
+ license,
87
+ dependencies,
88
+ bugs,
89
+ homepage,
90
+ devDependencies,
91
+ keywords,
92
+ engines
93
+ };
94
+
95
+ export {
96
+ name,
97
+ version,
98
+ description,
99
+ main,
100
+ types,
101
+ exports,
102
+ type,
103
+ scripts,
104
+ repository,
105
+ author,
106
+ license,
107
+ dependencies,
108
+ bugs,
109
+ homepage,
110
+ devDependencies,
111
+ keywords,
112
+ engines,
113
+ package_default
114
+ };
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.45.0",
42
+ version: "4.47.0",
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",
@@ -55,8 +55,8 @@ var require_package = __commonJS({
55
55
  build: "tsup",
56
56
  "build-and-publish": "pnpm run build && pnpm publish --access public",
57
57
  "publish-beta": "pnpm run build && pnpm publish --access public --tag beta",
58
- test: "NODE_OPTIONS=--experimental-vm-modules jest --verbose src/__tests__/e2e/v2/*.test.ts --detectOpenHandles",
59
- "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --verbose src/__tests__/unit"
58
+ test: "vitest run --reporter=verbose src/__tests__/e2e/v2",
59
+ "test:unit": "vitest run --reporter=verbose src/__tests__/unit"
60
60
  },
61
61
  repository: {
62
62
  type: "git",
@@ -76,18 +76,14 @@ var require_package = __commonJS({
76
76
  },
77
77
  homepage: "https://github.com/firecrawl/firecrawl#readme",
78
78
  devDependencies: {
79
- "@jest/globals": "^30.2.0",
80
79
  "@types/dotenv": "^8.2.0",
81
- "@types/jest": "^30.0.0",
82
- "@types/mocha": "^10.0.6",
83
80
  "@types/node": "^20.12.12",
84
81
  "@types/uuid": "^9.0.8",
85
82
  dotenv: "^16.4.5",
86
- jest: "^30.2.0",
87
- "ts-jest": "^29.4.5",
88
83
  tsup: "^8.5.0",
89
84
  typescript: "^5.4.5",
90
- uuid: "^14.0.0"
85
+ uuid: "^14.0.0",
86
+ vitest: "^4.1.11"
91
87
  },
92
88
  keywords: [
93
89
  "firecrawl",
@@ -138,16 +134,9 @@ module.exports = __toCommonJS(index_exports);
138
134
  var import_axios = __toESM(require("axios"), 1);
139
135
 
140
136
  // src/v2/utils/getVersion.ts
137
+ var import_package = __toESM(require_package(), 1);
141
138
  function getVersion() {
142
- try {
143
- if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
144
- return process.env.npm_package_version;
145
- }
146
- const pkg = require_package();
147
- return pkg?.version || "3.x.x";
148
- } catch {
149
- return "3.x.x";
150
- }
139
+ return import_package.version;
151
140
  }
152
141
 
153
142
  // src/utils/apiOrigin.ts
@@ -201,7 +190,7 @@ var HttpClient = class {
201
190
  return this.instance.defaults.timeout ?? 3e5;
202
191
  }
203
192
  async request(config) {
204
- const version = getVersion();
193
+ const version2 = getVersion();
205
194
  config.headers = {
206
195
  ...config.headers || {}
207
196
  };
@@ -216,7 +205,7 @@ var HttpClient = class {
216
205
  const data = cfg.data ?? {};
217
206
  cfg.data = {
218
207
  ...data,
219
- origin: typeof data.origin === "string" && data.origin.includes("mcp") ? data.origin : `js-sdk@${version}`
208
+ origin: typeof data.origin === "string" && data.origin.includes("mcp") ? data.origin : `js-sdk@${version2}`
220
209
  };
221
210
  }
222
211
  if (isFormDataBody) {
@@ -455,6 +444,30 @@ function ensureValidFormats(formats) {
455
444
  }
456
445
  }
457
446
  }
447
+ var V1_SCRAPE_OPTION_REPLACEMENTS = {
448
+ pageOptions: "use scrapeOptions",
449
+ includeLinks: "add 'links' to scrapeOptions.formats",
450
+ parsePDF: "use scrapeOptions.parsers"
451
+ };
452
+ var V1_OPTION_REPLACEMENTS = {
453
+ crawl: {
454
+ crawlerOptions: "move its fields to the top level",
455
+ maxDepth: "use maxDiscoveryDepth",
456
+ allowBackwardLinks: "use crawlEntireDomain",
457
+ ignoreSitemap: "use sitemap: 'skip'",
458
+ ...V1_SCRAPE_OPTION_REPLACEMENTS
459
+ },
460
+ search: V1_SCRAPE_OPTION_REPLACEMENTS
461
+ };
462
+ function ensureNoV1Options(options, method) {
463
+ if (!options) return;
464
+ const replacements = V1_OPTION_REPLACEMENTS[method];
465
+ const found = Object.keys(replacements).filter((key) => options[key] != null);
466
+ if (found.length === 0) return;
467
+ throw new Error(
468
+ `${method}: ${found.map((key) => `${key} is a v1 option, ${replacements[key]}`).join("; ")}`
469
+ );
470
+ }
458
471
  function ensureValidScrapeOptions(options) {
459
472
  if (!options) return;
460
473
  if (options.timeout != null && options.timeout <= 0) {
@@ -568,12 +581,28 @@ function ensureValidParseOptions(options) {
568
581
 
569
582
  // src/v2/utils/errorHandler.ts
570
583
  var import_axios2 = require("axios");
584
+ function describeValidationIssues(details) {
585
+ if (!Array.isArray(details)) return void 0;
586
+ const parts = details.slice(0, 3).flatMap((issue) => {
587
+ if (!issue || typeof issue !== "object") return [];
588
+ const { path, message, keys } = issue;
589
+ const what = Array.isArray(keys) && keys.length > 0 ? `unrecognized key(s) ${keys.join(", ")}` : typeof message === "string" ? message : void 0;
590
+ if (!what) return [];
591
+ return Array.isArray(path) && path.length > 0 ? [`${path.join(".")}: ${what}`] : [what];
592
+ });
593
+ return parts.length > 0 ? parts.join("; ") : void 0;
594
+ }
595
+ function withIssues(message, details) {
596
+ const text = typeof message === "string" ? message : JSON.stringify(message);
597
+ const issues = describeValidationIssues(details);
598
+ return issues && !text.includes(issues) ? `${text} (${issues})` : text;
599
+ }
571
600
  function throwForBadResponse(resp, action) {
572
601
  const status = resp.status;
573
602
  const body = resp.data || {};
574
603
  const msg = body?.error || body?.message || `Request failed (${status}) while trying to ${action}`;
575
604
  throw Object.assign(new SdkError(
576
- msg,
605
+ withIssues(msg, body?.details),
577
606
  status,
578
607
  body?.code,
579
608
  body?.details,
@@ -588,7 +617,7 @@ function normalizeAxiosError(err, action) {
588
617
  const message = body?.error || err.message || `Request failed${status ? ` (${status})` : ""} while trying to ${action}`;
589
618
  const code = body?.code || err.code;
590
619
  throw Object.assign(new SdkError(
591
- message,
620
+ withIssues(message, body?.details),
592
621
  status,
593
622
  code,
594
623
  body?.details ?? body,
@@ -759,10 +788,10 @@ async function parse(http, file, options) {
759
788
  throw new Error("file data cannot be empty");
760
789
  }
761
790
  if (options) ensureValidParseOptions(options);
762
- const version = getVersion();
791
+ const version2 = getVersion();
763
792
  const normalizedOptions = {
764
793
  ...options ?? {},
765
- origin: typeof options?.origin === "string" && options.origin.includes("mcp") ? options.origin : options?.origin ?? `js-sdk@${version}`
794
+ origin: typeof options?.origin === "string" && options.origin.includes("mcp") ? options.origin : options?.origin ?? `js-sdk@${version2}`
766
795
  };
767
796
  const formData = new FormData();
768
797
  formData.append("options", JSON.stringify(normalizedOptions));
@@ -800,6 +829,7 @@ async function getParseFormats(http) {
800
829
  // src/v2/methods/search.ts
801
830
  function prepareSearchPayload(req) {
802
831
  if (!req.query || !req.query.trim()) throw new Error("Query cannot be empty");
832
+ ensureNoV1Options(req, "search");
803
833
  if (req.limit != null && req.limit <= 0)
804
834
  throw new Error("limit must be positive");
805
835
  if (req.timeout != null && req.timeout <= 0)
@@ -1167,7 +1197,9 @@ async function fetchAllPages(http, nextUrl, initial, pagination) {
1167
1197
  docs.push(d);
1168
1198
  }
1169
1199
  if (maxResults != null && docs.length >= maxResults) break;
1170
- current = payload.next ?? (Array.isArray(payload.data) ? null : payload.data?.next) ?? null;
1200
+ const next = payload.next ?? (Array.isArray(payload.data) ? null : payload.data?.next) ?? null;
1201
+ if (next === current) break;
1202
+ current = next;
1171
1203
  pageCount += 1;
1172
1204
  }
1173
1205
  return docs;
@@ -1176,6 +1208,7 @@ async function fetchAllPages(http, nextUrl, initial, pagination) {
1176
1208
  // src/v2/methods/crawl.ts
1177
1209
  function prepareCrawlPayload(request) {
1178
1210
  if (!request.url || !request.url.trim()) throw new Error("URL cannot be empty");
1211
+ ensureNoV1Options(request, "crawl");
1179
1212
  const data = { url: request.url.trim() };
1180
1213
  if (request.prompt) data.prompt = request.prompt;
1181
1214
  if (request.excludePaths) data.excludePaths = request.excludePaths;
@@ -1727,6 +1760,7 @@ async function browser(http, args = {}) {
1727
1760
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
1728
1761
  if (args.blockAds != null) body.blockAds = args.blockAds;
1729
1762
  if (args.profile != null) body.profile = args.profile;
1763
+ if (args.location != null) body.location = args.location;
1730
1764
  if (args.integration != null) body.integration = args.integration;
1731
1765
  if (args.origin) body.origin = args.origin;
1732
1766
  try {
@@ -2793,7 +2827,7 @@ var FirecrawlClient = class {
2793
2827
  // Browser
2794
2828
  /**
2795
2829
  * Create a new browser session.
2796
- * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2830
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile, location).
2797
2831
  * @returns Session id, CDP URL, live view URL, and expiration time.
2798
2832
  */
2799
2833
  async browser(args = {}) {
@@ -2935,7 +2969,7 @@ var FirecrawlApp = class {
2935
2969
  const packageJson = await Promise.resolve().then(() => __toESM(require_package(), 1));
2936
2970
  return packageJson.default.version;
2937
2971
  } catch (error) {
2938
- const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
2972
+ const isTest = typeof process !== "undefined" && false;
2939
2973
  if (!isTest) {
2940
2974
  console.error("Error getting version:", error);
2941
2975
  }
package/dist/index.d.cts CHANGED
@@ -16,6 +16,7 @@ interface JsonFormat extends Format {
16
16
  type: "json";
17
17
  prompt?: string;
18
18
  schema?: Record<string, unknown> | ZodTypeAny;
19
+ /** @deprecated Use the top-level `checkPromptInjection` scrape option. */
19
20
  checkPromptInjection?: boolean;
20
21
  }
21
22
  interface ScreenshotFormat {
@@ -200,6 +201,13 @@ interface ScrapeOptions {
200
201
  minAge?: number;
201
202
  storeInCache?: boolean;
202
203
  lockdown?: boolean;
204
+ /**
205
+ * Scans the page content for prompt injection with any format except
206
+ * rawBase64, before LLM-backed formats run. A detection fails the scrape
207
+ * with SCRAPE_PROMPT_INJECTION_DETECTED.
208
+ * Adds 4 credits when the check scans the whole page.
209
+ */
210
+ checkPromptInjection?: boolean;
203
211
  redactPII?: boolean | RedactPIIOptions;
204
212
  threatProtection?: ThreatProtectionOptions;
205
213
  auditMetadata?: AuditMetadata$1;
@@ -757,10 +765,10 @@ interface FindToolsOptions {
757
765
  offset?: number;
758
766
  }
759
767
  interface FindToolsData {
760
- level: "providers" | "groups" | "tools";
768
+ level: "categories" | "providers" | "groups" | "tools";
761
769
  items: Array<{
762
770
  id: string;
763
- name: string;
771
+ name?: string;
764
772
  next?: AlexandriaCall;
765
773
  execute?: Pick<AlexandriaCall, "provider" | "capability">;
766
774
  [key: string]: unknown;
@@ -2111,6 +2119,10 @@ declare function browser(http: HttpClient, args?: {
2111
2119
  name: string;
2112
2120
  saveChanges?: boolean;
2113
2121
  };
2122
+ /** Country the session browses from, as an ISO 3166-1 alpha-2 code (default US). */
2123
+ location?: {
2124
+ country: string;
2125
+ };
2114
2126
  integration?: string;
2115
2127
  origin?: string;
2116
2128
  }): Promise<BrowserCreateResponse>;
@@ -2577,7 +2589,7 @@ declare class FirecrawlClient {
2577
2589
  }): Promise<AgentThreadResponse>;
2578
2590
  /**
2579
2591
  * Create a new browser session.
2580
- * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2592
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile, location).
2581
2593
  * @returns Session id, CDP URL, live view URL, and expiration time.
2582
2594
  */
2583
2595
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ interface JsonFormat extends Format {
16
16
  type: "json";
17
17
  prompt?: string;
18
18
  schema?: Record<string, unknown> | ZodTypeAny;
19
+ /** @deprecated Use the top-level `checkPromptInjection` scrape option. */
19
20
  checkPromptInjection?: boolean;
20
21
  }
21
22
  interface ScreenshotFormat {
@@ -200,6 +201,13 @@ interface ScrapeOptions {
200
201
  minAge?: number;
201
202
  storeInCache?: boolean;
202
203
  lockdown?: boolean;
204
+ /**
205
+ * Scans the page content for prompt injection with any format except
206
+ * rawBase64, before LLM-backed formats run. A detection fails the scrape
207
+ * with SCRAPE_PROMPT_INJECTION_DETECTED.
208
+ * Adds 4 credits when the check scans the whole page.
209
+ */
210
+ checkPromptInjection?: boolean;
203
211
  redactPII?: boolean | RedactPIIOptions;
204
212
  threatProtection?: ThreatProtectionOptions;
205
213
  auditMetadata?: AuditMetadata$1;
@@ -757,10 +765,10 @@ interface FindToolsOptions {
757
765
  offset?: number;
758
766
  }
759
767
  interface FindToolsData {
760
- level: "providers" | "groups" | "tools";
768
+ level: "categories" | "providers" | "groups" | "tools";
761
769
  items: Array<{
762
770
  id: string;
763
- name: string;
771
+ name?: string;
764
772
  next?: AlexandriaCall;
765
773
  execute?: Pick<AlexandriaCall, "provider" | "capability">;
766
774
  [key: string]: unknown;
@@ -2111,6 +2119,10 @@ declare function browser(http: HttpClient, args?: {
2111
2119
  name: string;
2112
2120
  saveChanges?: boolean;
2113
2121
  };
2122
+ /** Country the session browses from, as an ISO 3166-1 alpha-2 code (default US). */
2123
+ location?: {
2124
+ country: string;
2125
+ };
2114
2126
  integration?: string;
2115
2127
  origin?: string;
2116
2128
  }): Promise<BrowserCreateResponse>;
@@ -2577,7 +2589,7 @@ declare class FirecrawlClient {
2577
2589
  }): Promise<AgentThreadResponse>;
2578
2590
  /**
2579
2591
  * Create a new browser session.
2580
- * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2592
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile, location).
2581
2593
  * @returns Session id, CDP URL, live view URL, and expiration time.
2582
2594
  */
2583
2595
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;