firecrawl 4.30.0 → 4.31.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.
@@ -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.30.0",
15
+ version: "4.31.0",
16
16
  description: "JavaScript SDK for Firecrawl API",
17
17
  main: "dist/index.js",
18
18
  types: "dist/index.d.ts",
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  license: "MIT",
40
40
  dependencies: {
41
41
  axios: "1.18.0",
42
- firecrawl: "4.16.0",
42
+ firecrawl: "4.30.1",
43
43
  "typescript-event-target": "^1.1.1",
44
44
  zod: "^3.23.8",
45
45
  "zod-to-json-schema": "^3.23.0"
@@ -81,7 +81,7 @@ var require_package = __commonJS({
81
81
  "rollup@<4.59.0": ">=4.59.0",
82
82
  "picomatch@<4.0.4": ">=4.0.4",
83
83
  handlebars: ">=4.7.9",
84
- "brace-expansion": ">=5.0.6",
84
+ "brace-expansion@>=5.0.0 <5.0.7": "5.0.7",
85
85
  "js-yaml@>=3.0.0 <3.15.0": "3.15.0",
86
86
  "axios@>=1.0.0 <1.16.0": "1.16.1",
87
87
  "follow-redirects@<1.16.0": ">=1.16.0 <2.0.0",
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.30.0",
42
+ version: "4.31.0",
43
43
  description: "JavaScript SDK for Firecrawl API",
44
44
  main: "dist/index.js",
45
45
  types: "dist/index.d.ts",
@@ -66,7 +66,7 @@ var require_package = __commonJS({
66
66
  license: "MIT",
67
67
  dependencies: {
68
68
  axios: "1.18.0",
69
- firecrawl: "4.16.0",
69
+ firecrawl: "4.30.1",
70
70
  "typescript-event-target": "^1.1.1",
71
71
  zod: "^3.23.8",
72
72
  "zod-to-json-schema": "^3.23.0"
@@ -108,7 +108,7 @@ var require_package = __commonJS({
108
108
  "rollup@<4.59.0": ">=4.59.0",
109
109
  "picomatch@<4.0.4": ">=4.0.4",
110
110
  handlebars: ">=4.7.9",
111
- "brace-expansion": ">=5.0.6",
111
+ "brace-expansion@>=5.0.0 <5.0.7": "5.0.7",
112
112
  "js-yaml@>=3.0.0 <3.15.0": "3.15.0",
113
113
  "axios@>=1.0.0 <1.16.0": "1.16.1",
114
114
  "follow-redirects@<1.16.0": ">=1.16.0 <2.0.0",
@@ -717,6 +717,7 @@ function prepareSearchPayload(req) {
717
717
  if (req.ignoreInvalidURLs != null)
718
718
  payload.ignoreInvalidURLs = req.ignoreInvalidURLs;
719
719
  if (req.timeout != null) payload.timeout = req.timeout;
720
+ if (req.highlights != null) payload.highlights = req.highlights;
720
721
  if (req.integration && req.integration.trim())
721
722
  payload.integration = req.integration.trim();
722
723
  if (req.origin) payload.origin = req.origin;
@@ -801,6 +802,8 @@ function prepareMapPayload(url, options) {
801
802
  if (options.location != null) payload.location = options.location;
802
803
  if (options.threatProtection != null)
803
804
  payload.threatProtection = options.threatProtection;
805
+ if (options.auditMetadata != null)
806
+ payload.auditMetadata = options.auditMetadata;
804
807
  }
805
808
  return payload;
806
809
  }
@@ -1294,6 +1297,8 @@ function prepareAgentPayload(args) {
1294
1297
  if (args.webhook != null) body.webhook = args.webhook;
1295
1298
  if (args.threatProtection != null)
1296
1299
  body.threatProtection = args.threatProtection;
1300
+ if (args.auditMetadata != null)
1301
+ body.auditMetadata = args.auditMetadata;
1297
1302
  return body;
1298
1303
  }
1299
1304
  async function startAgent(http, args) {
package/dist/index.d.cts CHANGED
@@ -142,6 +142,7 @@ interface ScrapeOptions {
142
142
  lockdown?: boolean;
143
143
  redactPII?: boolean | RedactPIIOptions;
144
144
  threatProtection?: ThreatProtectionOptions;
145
+ auditMetadata?: Record<string, string>;
145
146
  profile?: {
146
147
  name: string;
147
148
  saveChanges?: boolean;
@@ -544,6 +545,8 @@ interface SearchRequest {
544
545
  location?: string;
545
546
  ignoreInvalidURLs?: boolean;
546
547
  timeout?: number;
548
+ /** Generate query-relevant highlights for search results. Defaults to true. */
549
+ highlights?: boolean;
547
550
  scrapeOptions?: ScrapeOptions;
548
551
  /**
549
552
  * Enterprise search options. Use `["zdr"]` for end-to-end Zero Data
@@ -633,6 +636,7 @@ interface MapOptions {
633
636
  origin?: string;
634
637
  location?: LocationConfig$1;
635
638
  threatProtection?: ThreatProtectionOptions;
639
+ auditMetadata?: Record<string, string>;
636
640
  }
637
641
  type FeedbackRating = "good" | "partial" | "bad";
638
642
  type EndpointFeedbackEndpoint = "search" | "scrape" | "parse" | "map";
@@ -1292,6 +1296,7 @@ declare function prepareAgentPayload(args: {
1292
1296
  model?: "spark-1-pro" | "spark-1-mini";
1293
1297
  webhook?: string | AgentWebhookConfig;
1294
1298
  threatProtection?: ThreatProtectionOptions;
1299
+ auditMetadata?: Record<string, string>;
1295
1300
  }): Record<string, unknown>;
1296
1301
  declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
1297
1302
 
@@ -1855,6 +1860,7 @@ interface CrawlScrapeOptions {
1855
1860
  storeInCache?: boolean;
1856
1861
  maxAge?: number;
1857
1862
  parsePDF?: boolean;
1863
+ auditMetadata?: Record<string, string>;
1858
1864
  }
1859
1865
  type Action = {
1860
1866
  type: "wait";
@@ -2020,6 +2026,7 @@ interface MapParams {
2020
2026
  timeout?: number;
2021
2027
  useIndex?: boolean;
2022
2028
  location?: LocationConfig;
2029
+ auditMetadata?: Record<string, string>;
2023
2030
  }
2024
2031
  /**
2025
2032
  * Response interface for mapping operations.
package/dist/index.d.ts CHANGED
@@ -142,6 +142,7 @@ interface ScrapeOptions {
142
142
  lockdown?: boolean;
143
143
  redactPII?: boolean | RedactPIIOptions;
144
144
  threatProtection?: ThreatProtectionOptions;
145
+ auditMetadata?: Record<string, string>;
145
146
  profile?: {
146
147
  name: string;
147
148
  saveChanges?: boolean;
@@ -544,6 +545,8 @@ interface SearchRequest {
544
545
  location?: string;
545
546
  ignoreInvalidURLs?: boolean;
546
547
  timeout?: number;
548
+ /** Generate query-relevant highlights for search results. Defaults to true. */
549
+ highlights?: boolean;
547
550
  scrapeOptions?: ScrapeOptions;
548
551
  /**
549
552
  * Enterprise search options. Use `["zdr"]` for end-to-end Zero Data
@@ -633,6 +636,7 @@ interface MapOptions {
633
636
  origin?: string;
634
637
  location?: LocationConfig$1;
635
638
  threatProtection?: ThreatProtectionOptions;
639
+ auditMetadata?: Record<string, string>;
636
640
  }
637
641
  type FeedbackRating = "good" | "partial" | "bad";
638
642
  type EndpointFeedbackEndpoint = "search" | "scrape" | "parse" | "map";
@@ -1292,6 +1296,7 @@ declare function prepareAgentPayload(args: {
1292
1296
  model?: "spark-1-pro" | "spark-1-mini";
1293
1297
  webhook?: string | AgentWebhookConfig;
1294
1298
  threatProtection?: ThreatProtectionOptions;
1299
+ auditMetadata?: Record<string, string>;
1295
1300
  }): Record<string, unknown>;
1296
1301
  declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
1297
1302
 
@@ -1855,6 +1860,7 @@ interface CrawlScrapeOptions {
1855
1860
  storeInCache?: boolean;
1856
1861
  maxAge?: number;
1857
1862
  parsePDF?: boolean;
1863
+ auditMetadata?: Record<string, string>;
1858
1864
  }
1859
1865
  type Action = {
1860
1866
  type: "wait";
@@ -2020,6 +2026,7 @@ interface MapParams {
2020
2026
  timeout?: number;
2021
2027
  useIndex?: boolean;
2022
2028
  location?: LocationConfig;
2029
+ auditMetadata?: Record<string, string>;
2023
2030
  }
2024
2031
  /**
2025
2032
  * Response interface for mapping operations.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-OZ7DDARD.js";
3
+ } from "./chunk-PSTSUWZW.js";
4
4
 
5
5
  // src/v2/utils/httpClient.ts
6
6
  import axios from "axios";
@@ -584,6 +584,7 @@ function prepareSearchPayload(req) {
584
584
  if (req.ignoreInvalidURLs != null)
585
585
  payload.ignoreInvalidURLs = req.ignoreInvalidURLs;
586
586
  if (req.timeout != null) payload.timeout = req.timeout;
587
+ if (req.highlights != null) payload.highlights = req.highlights;
587
588
  if (req.integration && req.integration.trim())
588
589
  payload.integration = req.integration.trim();
589
590
  if (req.origin) payload.origin = req.origin;
@@ -668,6 +669,8 @@ function prepareMapPayload(url, options) {
668
669
  if (options.location != null) payload.location = options.location;
669
670
  if (options.threatProtection != null)
670
671
  payload.threatProtection = options.threatProtection;
672
+ if (options.auditMetadata != null)
673
+ payload.auditMetadata = options.auditMetadata;
671
674
  }
672
675
  return payload;
673
676
  }
@@ -1161,6 +1164,8 @@ function prepareAgentPayload(args) {
1161
1164
  if (args.webhook != null) body.webhook = args.webhook;
1162
1165
  if (args.threatProtection != null)
1163
1166
  body.threatProtection = args.threatProtection;
1167
+ if (args.auditMetadata != null)
1168
+ body.auditMetadata = args.auditMetadata;
1164
1169
  return body;
1165
1170
  }
1166
1171
  async function startAgent(http, args) {
@@ -2311,7 +2316,7 @@ var FirecrawlApp = class {
2311
2316
  if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
2312
2317
  return process.env.npm_package_version;
2313
2318
  }
2314
- const packageJson = await import("./package-ZZWOLTXM.js");
2319
+ const packageJson = await import("./package-Q3WPQZ6Q.js");
2315
2320
  return packageJson.default.version;
2316
2321
  } catch (error) {
2317
2322
  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-OZ7DDARD.js";
3
+ } from "./chunk-PSTSUWZW.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "4.30.0",
3
+ "version": "4.31.0",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,79 @@
1
+ import { describe, test, expect, jest } from "@jest/globals";
2
+ import { scrape } from "../../../v2/methods/scrape";
3
+ import { startBatchScrape } from "../../../v2/methods/batch";
4
+ import { startCrawl } from "../../../v2/methods/crawl";
5
+ import { search } from "../../../v2/methods/search";
6
+ import { map } from "../../../v2/methods/map";
7
+ import { startExtract } from "../../../v2/methods/extract";
8
+ import { startAgent } from "../../../v2/methods/agent";
9
+
10
+ const auditMetadata = { requestId: "req-123" };
11
+
12
+ function makeHttp(data: Record<string, unknown>) {
13
+ const post = jest.fn(async () => ({ status: 200, data }));
14
+ return {
15
+ post,
16
+ prepareHeaders: jest.fn(() => undefined),
17
+ } as any;
18
+ }
19
+
20
+ describe("v2 auditMetadata request serialization", () => {
21
+ test("scrape and batch scrape send metadata at the top level", async () => {
22
+ const scrapeHttp = makeHttp({ success: true, data: {} });
23
+ await scrape(scrapeHttp, "https://example.com", { auditMetadata });
24
+ expect(scrapeHttp.post.mock.calls[0][1]).toEqual(
25
+ expect.objectContaining({ auditMetadata }),
26
+ );
27
+
28
+ const batchHttp = makeHttp({ success: true, id: "job", url: "u" });
29
+ await startBatchScrape(batchHttp, ["https://example.com"], {
30
+ options: { auditMetadata },
31
+ });
32
+ expect(batchHttp.post.mock.calls[0][1]).toEqual(
33
+ expect.objectContaining({ auditMetadata }),
34
+ );
35
+ });
36
+
37
+ test("crawl, search, and extract send metadata under scrapeOptions", async () => {
38
+ const crawlHttp = makeHttp({ success: true, id: "job", url: "u" });
39
+ await startCrawl(crawlHttp, {
40
+ url: "https://example.com",
41
+ scrapeOptions: { auditMetadata },
42
+ });
43
+ expect(crawlHttp.post.mock.calls[0][1]).toEqual(
44
+ expect.objectContaining({ scrapeOptions: expect.objectContaining({ auditMetadata }) }),
45
+ );
46
+
47
+ const searchHttp = makeHttp({ success: true, data: {} });
48
+ await search(searchHttp, {
49
+ query: "example",
50
+ scrapeOptions: { auditMetadata },
51
+ });
52
+ expect(searchHttp.post.mock.calls[0][1]).toEqual(
53
+ expect.objectContaining({ scrapeOptions: expect.objectContaining({ auditMetadata }) }),
54
+ );
55
+
56
+ const extractHttp = makeHttp({ success: true, id: "job" });
57
+ await startExtract(extractHttp, {
58
+ urls: ["https://example.com"],
59
+ scrapeOptions: { auditMetadata },
60
+ });
61
+ expect(extractHttp.post.mock.calls[0][1]).toEqual(
62
+ expect.objectContaining({ scrapeOptions: expect.objectContaining({ auditMetadata }) }),
63
+ );
64
+ });
65
+
66
+ test("map and agent send metadata at the top level", async () => {
67
+ const mapHttp = makeHttp({ success: true, links: [] });
68
+ await map(mapHttp, "https://example.com", { auditMetadata });
69
+ expect(mapHttp.post.mock.calls[0][1]).toEqual(
70
+ expect.objectContaining({ auditMetadata }),
71
+ );
72
+
73
+ const agentHttp = makeHttp({ success: true, id: "job" });
74
+ await startAgent(agentHttp, { prompt: "find pricing", auditMetadata });
75
+ expect(agentHttp.post.mock.calls[0][1]).toEqual(
76
+ expect.objectContaining({ auditMetadata }),
77
+ );
78
+ });
79
+ });
@@ -0,0 +1,18 @@
1
+ import { describe, expect, jest, test } from "@jest/globals";
2
+ import { search } from "../../../v2/methods/search";
3
+
4
+ describe("v2 search highlights", () => {
5
+ test("forwards the highlights option", async () => {
6
+ const http = {
7
+ post: jest.fn(async () => ({ status: 200, data: { success: true } })),
8
+ } as any;
9
+
10
+ await search(http, { query: "firecrawl", highlights: false });
11
+
12
+ expect(http.post).toHaveBeenCalledWith(
13
+ "/v2/search",
14
+ { query: "firecrawl", highlights: false },
15
+ {},
16
+ );
17
+ });
18
+ });
package/src/v1/index.ts CHANGED
@@ -135,6 +135,7 @@ export interface CrawlScrapeOptions {
135
135
  storeInCache?: boolean;
136
136
  maxAge?: number;
137
137
  parsePDF?: boolean;
138
+ auditMetadata?: Record<string, string>;
138
139
  }
139
140
 
140
141
  export type Action = {
@@ -310,6 +311,7 @@ export interface MapParams {
310
311
  timeout?: number;
311
312
  useIndex?: boolean;
312
313
  location?: LocationConfig;
314
+ auditMetadata?: Record<string, string>;
313
315
  }
314
316
 
315
317
  /**
@@ -15,6 +15,7 @@ function prepareAgentPayload(args: {
15
15
  model?: "spark-1-pro" | "spark-1-mini";
16
16
  webhook?: string | AgentWebhookConfig;
17
17
  threatProtection?: ThreatProtectionOptions;
18
+ auditMetadata?: Record<string, string>;
18
19
  }): Record<string, unknown> {
19
20
  const body: Record<string, unknown> = {};
20
21
  if (args.urls) body.urls = args.urls;
@@ -30,6 +31,8 @@ function prepareAgentPayload(args: {
30
31
  if (args.webhook != null) body.webhook = args.webhook;
31
32
  if (args.threatProtection != null)
32
33
  body.threatProtection = args.threatProtection;
34
+ if (args.auditMetadata != null)
35
+ body.auditMetadata = args.auditMetadata;
33
36
  return body;
34
37
  }
35
38
 
@@ -26,6 +26,8 @@ function prepareMapPayload(
26
26
  if (options.location != null) payload.location = options.location;
27
27
  if (options.threatProtection != null)
28
28
  payload.threatProtection = options.threatProtection;
29
+ if (options.auditMetadata != null)
30
+ payload.auditMetadata = options.auditMetadata;
29
31
  }
30
32
  return payload;
31
33
  }
@@ -37,6 +37,7 @@ function prepareSearchPayload(req: SearchRequest): Record<string, unknown> {
37
37
  if (req.ignoreInvalidURLs != null)
38
38
  payload.ignoreInvalidURLs = req.ignoreInvalidURLs;
39
39
  if (req.timeout != null) payload.timeout = req.timeout;
40
+ if (req.highlights != null) payload.highlights = req.highlights;
40
41
  if (req.integration && req.integration.trim())
41
42
  payload.integration = req.integration.trim();
42
43
  if (req.origin) payload.origin = req.origin;
package/src/v2/types.ts CHANGED
@@ -209,6 +209,7 @@ export interface ScrapeOptions {
209
209
  lockdown?: boolean;
210
210
  redactPII?: boolean | RedactPIIOptions;
211
211
  threatProtection?: ThreatProtectionOptions;
212
+ auditMetadata?: Record<string, string>;
212
213
  profile?: {
213
214
  name: string;
214
215
  saveChanges?: boolean;
@@ -697,6 +698,8 @@ export interface SearchRequest {
697
698
  location?: string;
698
699
  ignoreInvalidURLs?: boolean;
699
700
  timeout?: number; // ms
701
+ /** Generate query-relevant highlights for search results. Defaults to true. */
702
+ highlights?: boolean;
700
703
  scrapeOptions?: ScrapeOptions;
701
704
  /**
702
705
  * Enterprise search options. Use `["zdr"]` for end-to-end Zero Data
@@ -794,6 +797,7 @@ export interface MapOptions {
794
797
  origin?: string;
795
798
  location?: LocationConfig;
796
799
  threatProtection?: ThreatProtectionOptions;
800
+ auditMetadata?: Record<string, string>;
797
801
  }
798
802
 
799
803
  export type FeedbackRating = "good" | "partial" | "bad";