@mendable/firecrawl 4.3.0 → 4.3.2
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/{chunk-KCQFB5LN.js → chunk-QYSKXMMY.js} +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +16 -3
- package/dist/{package-QFGMHRQZ.js → package-F2DQUYTW.js} +1 -1
- package/package.json +1 -1
- package/src/v1/index.ts +10 -4
- package/src/v2/methods/map.ts +1 -0
- package/src/v2/types.ts +1 -0
- package/src/v2/utils/validation.ts +15 -2
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.3.
|
|
11
|
+
version: "4.3.2",
|
|
12
12
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
13
|
main: "dist/index.js",
|
|
14
14
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.3.
|
|
38
|
+
version: "4.3.2",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -227,7 +227,7 @@ var SdkError = class extends Error {
|
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
// src/v2/utils/validation.ts
|
|
230
|
-
var import_zod_to_json_schema =
|
|
230
|
+
var import_zod_to_json_schema = require("zod-to-json-schema");
|
|
231
231
|
function ensureValidFormats(formats) {
|
|
232
232
|
if (!formats) return;
|
|
233
233
|
for (const fmt of formats) {
|
|
@@ -246,7 +246,19 @@ function ensureValidFormats(formats) {
|
|
|
246
246
|
const isZod = !!maybeSchema && (typeof maybeSchema.safeParse === "function" || typeof maybeSchema.parse === "function") && !!maybeSchema._def;
|
|
247
247
|
if (isZod) {
|
|
248
248
|
try {
|
|
249
|
-
j.schema = (0, import_zod_to_json_schema.
|
|
249
|
+
j.schema = (0, import_zod_to_json_schema.zodToJsonSchema)(maybeSchema);
|
|
250
|
+
} catch {
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (fmt.type === "changeTracking") {
|
|
256
|
+
const ct = fmt;
|
|
257
|
+
const maybeSchema = ct.schema;
|
|
258
|
+
const isZod = !!maybeSchema && (typeof maybeSchema.safeParse === "function" || typeof maybeSchema.parse === "function") && !!maybeSchema._def;
|
|
259
|
+
if (isZod) {
|
|
260
|
+
try {
|
|
261
|
+
ct.schema = (0, import_zod_to_json_schema.zodToJsonSchema)(maybeSchema);
|
|
250
262
|
} catch {
|
|
251
263
|
}
|
|
252
264
|
}
|
|
@@ -372,6 +384,7 @@ function prepareMapPayload(url, options) {
|
|
|
372
384
|
if (options.includeSubdomains != null) payload.includeSubdomains = options.includeSubdomains;
|
|
373
385
|
if (options.limit != null) payload.limit = options.limit;
|
|
374
386
|
if (options.timeout != null) payload.timeout = options.timeout;
|
|
387
|
+
if (options.location != null) payload.location = options.location;
|
|
375
388
|
}
|
|
376
389
|
return payload;
|
|
377
390
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -41,7 +41,7 @@ interface AttributesFormat extends Format {
|
|
|
41
41
|
}>;
|
|
42
42
|
}
|
|
43
43
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat;
|
|
44
|
-
interface LocationConfig {
|
|
44
|
+
interface LocationConfig$1 {
|
|
45
45
|
country?: string;
|
|
46
46
|
languages?: string[];
|
|
47
47
|
}
|
|
@@ -104,7 +104,7 @@ interface ScrapeOptions {
|
|
|
104
104
|
maxPages?: number;
|
|
105
105
|
}>;
|
|
106
106
|
actions?: ActionOption[];
|
|
107
|
-
location?: LocationConfig;
|
|
107
|
+
location?: LocationConfig$1;
|
|
108
108
|
skipTlsVerification?: boolean;
|
|
109
109
|
removeBase64Images?: boolean;
|
|
110
110
|
fastMode?: boolean;
|
|
@@ -271,6 +271,7 @@ interface MapOptions {
|
|
|
271
271
|
includeSubdomains?: boolean;
|
|
272
272
|
limit?: number;
|
|
273
273
|
timeout?: number;
|
|
274
|
+
location?: LocationConfig$1;
|
|
274
275
|
}
|
|
275
276
|
interface ExtractResponse$1 {
|
|
276
277
|
success?: boolean;
|
|
@@ -687,6 +688,13 @@ interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | neve
|
|
|
687
688
|
title?: string;
|
|
688
689
|
description?: string;
|
|
689
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Location configuration for proxy location
|
|
693
|
+
*/
|
|
694
|
+
interface LocationConfig {
|
|
695
|
+
country?: string;
|
|
696
|
+
languages?: string[];
|
|
697
|
+
}
|
|
690
698
|
/**
|
|
691
699
|
* Parameters for scraping operations.
|
|
692
700
|
* Defines the options and configurations available for scraping web content.
|
|
@@ -699,10 +707,7 @@ interface CrawlScrapeOptions {
|
|
|
699
707
|
onlyMainContent?: boolean;
|
|
700
708
|
waitFor?: number;
|
|
701
709
|
timeout?: number;
|
|
702
|
-
location?:
|
|
703
|
-
country?: string;
|
|
704
|
-
languages?: string[];
|
|
705
|
-
};
|
|
710
|
+
location?: LocationConfig;
|
|
706
711
|
mobile?: boolean;
|
|
707
712
|
skipTlsVerification?: boolean;
|
|
708
713
|
removeBase64Images?: boolean;
|
|
@@ -875,6 +880,7 @@ interface MapParams {
|
|
|
875
880
|
limit?: number;
|
|
876
881
|
timeout?: number;
|
|
877
882
|
useIndex?: boolean;
|
|
883
|
+
location?: LocationConfig;
|
|
878
884
|
}
|
|
879
885
|
/**
|
|
880
886
|
* Response interface for mapping operations.
|
|
@@ -1487,4 +1493,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
1487
1493
|
get v1(): FirecrawlApp;
|
|
1488
1494
|
}
|
|
1489
1495
|
|
|
1490
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type JsonFormat, type LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type PressAction, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type Viewport, type WaitAction, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
1496
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type JsonFormat, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type PressAction, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type Viewport, type WaitAction, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ interface AttributesFormat extends Format {
|
|
|
41
41
|
}>;
|
|
42
42
|
}
|
|
43
43
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat;
|
|
44
|
-
interface LocationConfig {
|
|
44
|
+
interface LocationConfig$1 {
|
|
45
45
|
country?: string;
|
|
46
46
|
languages?: string[];
|
|
47
47
|
}
|
|
@@ -104,7 +104,7 @@ interface ScrapeOptions {
|
|
|
104
104
|
maxPages?: number;
|
|
105
105
|
}>;
|
|
106
106
|
actions?: ActionOption[];
|
|
107
|
-
location?: LocationConfig;
|
|
107
|
+
location?: LocationConfig$1;
|
|
108
108
|
skipTlsVerification?: boolean;
|
|
109
109
|
removeBase64Images?: boolean;
|
|
110
110
|
fastMode?: boolean;
|
|
@@ -271,6 +271,7 @@ interface MapOptions {
|
|
|
271
271
|
includeSubdomains?: boolean;
|
|
272
272
|
limit?: number;
|
|
273
273
|
timeout?: number;
|
|
274
|
+
location?: LocationConfig$1;
|
|
274
275
|
}
|
|
275
276
|
interface ExtractResponse$1 {
|
|
276
277
|
success?: boolean;
|
|
@@ -687,6 +688,13 @@ interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | neve
|
|
|
687
688
|
title?: string;
|
|
688
689
|
description?: string;
|
|
689
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Location configuration for proxy location
|
|
693
|
+
*/
|
|
694
|
+
interface LocationConfig {
|
|
695
|
+
country?: string;
|
|
696
|
+
languages?: string[];
|
|
697
|
+
}
|
|
690
698
|
/**
|
|
691
699
|
* Parameters for scraping operations.
|
|
692
700
|
* Defines the options and configurations available for scraping web content.
|
|
@@ -699,10 +707,7 @@ interface CrawlScrapeOptions {
|
|
|
699
707
|
onlyMainContent?: boolean;
|
|
700
708
|
waitFor?: number;
|
|
701
709
|
timeout?: number;
|
|
702
|
-
location?:
|
|
703
|
-
country?: string;
|
|
704
|
-
languages?: string[];
|
|
705
|
-
};
|
|
710
|
+
location?: LocationConfig;
|
|
706
711
|
mobile?: boolean;
|
|
707
712
|
skipTlsVerification?: boolean;
|
|
708
713
|
removeBase64Images?: boolean;
|
|
@@ -875,6 +880,7 @@ interface MapParams {
|
|
|
875
880
|
limit?: number;
|
|
876
881
|
timeout?: number;
|
|
877
882
|
useIndex?: boolean;
|
|
883
|
+
location?: LocationConfig;
|
|
878
884
|
}
|
|
879
885
|
/**
|
|
880
886
|
* Response interface for mapping operations.
|
|
@@ -1487,4 +1493,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
1487
1493
|
get v1(): FirecrawlApp;
|
|
1488
1494
|
}
|
|
1489
1495
|
|
|
1490
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type JsonFormat, type LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type PressAction, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type Viewport, type WaitAction, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
1496
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type JsonFormat, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type PressAction, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type Viewport, type WaitAction, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QYSKXMMY.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -111,7 +111,7 @@ var SdkError = class extends Error {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
// src/v2/utils/validation.ts
|
|
114
|
-
import zodToJsonSchema from "zod-to-json-schema";
|
|
114
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
115
115
|
function ensureValidFormats(formats) {
|
|
116
116
|
if (!formats) return;
|
|
117
117
|
for (const fmt of formats) {
|
|
@@ -136,6 +136,18 @@ function ensureValidFormats(formats) {
|
|
|
136
136
|
}
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
|
+
if (fmt.type === "changeTracking") {
|
|
140
|
+
const ct = fmt;
|
|
141
|
+
const maybeSchema = ct.schema;
|
|
142
|
+
const isZod = !!maybeSchema && (typeof maybeSchema.safeParse === "function" || typeof maybeSchema.parse === "function") && !!maybeSchema._def;
|
|
143
|
+
if (isZod) {
|
|
144
|
+
try {
|
|
145
|
+
ct.schema = zodToJsonSchema(maybeSchema);
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
139
151
|
if (fmt.type === "screenshot") {
|
|
140
152
|
const s = fmt;
|
|
141
153
|
if (s.quality != null && (typeof s.quality !== "number" || s.quality < 0)) {
|
|
@@ -256,6 +268,7 @@ function prepareMapPayload(url, options) {
|
|
|
256
268
|
if (options.includeSubdomains != null) payload.includeSubdomains = options.includeSubdomains;
|
|
257
269
|
if (options.limit != null) payload.limit = options.limit;
|
|
258
270
|
if (options.timeout != null) payload.timeout = options.timeout;
|
|
271
|
+
if (options.location != null) payload.location = options.location;
|
|
259
272
|
}
|
|
260
273
|
return payload;
|
|
261
274
|
}
|
|
@@ -1047,7 +1060,7 @@ var FirecrawlApp = class {
|
|
|
1047
1060
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
1048
1061
|
return process.env.npm_package_version;
|
|
1049
1062
|
}
|
|
1050
|
-
const packageJson = await import("./package-
|
|
1063
|
+
const packageJson = await import("./package-F2DQUYTW.js");
|
|
1051
1064
|
return packageJson.default.version;
|
|
1052
1065
|
} catch (error) {
|
|
1053
1066
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
package/src/v1/index.ts
CHANGED
|
@@ -102,6 +102,14 @@ export interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult
|
|
|
102
102
|
description?: string;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Location configuration for proxy location
|
|
107
|
+
*/
|
|
108
|
+
export interface LocationConfig {
|
|
109
|
+
country?: string;
|
|
110
|
+
languages?: string[];
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
/**
|
|
106
114
|
* Parameters for scraping operations.
|
|
107
115
|
* Defines the options and configurations available for scraping web content.
|
|
@@ -114,10 +122,7 @@ export interface CrawlScrapeOptions {
|
|
|
114
122
|
onlyMainContent?: boolean;
|
|
115
123
|
waitFor?: number;
|
|
116
124
|
timeout?: number;
|
|
117
|
-
location?:
|
|
118
|
-
country?: string;
|
|
119
|
-
languages?: string[];
|
|
120
|
-
};
|
|
125
|
+
location?: LocationConfig;
|
|
121
126
|
mobile?: boolean;
|
|
122
127
|
skipTlsVerification?: boolean;
|
|
123
128
|
removeBase64Images?: boolean;
|
|
@@ -300,6 +305,7 @@ export interface MapParams {
|
|
|
300
305
|
limit?: number;
|
|
301
306
|
timeout?: number;
|
|
302
307
|
useIndex?: boolean;
|
|
308
|
+
location?: LocationConfig;
|
|
303
309
|
}
|
|
304
310
|
|
|
305
311
|
/**
|
package/src/v2/methods/map.ts
CHANGED
|
@@ -11,6 +11,7 @@ function prepareMapPayload(url: string, options?: MapOptions): Record<string, un
|
|
|
11
11
|
if (options.includeSubdomains != null) payload.includeSubdomains = options.includeSubdomains;
|
|
12
12
|
if (options.limit != null) payload.limit = options.limit;
|
|
13
13
|
if (options.timeout != null) payload.timeout = options.timeout;
|
|
14
|
+
if (options.location != null) payload.location = options.location;
|
|
14
15
|
}
|
|
15
16
|
return payload;
|
|
16
17
|
}
|
package/src/v2/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type FormatOption, type JsonFormat, type ScrapeOptions, type ScreenshotFormat } from "../types";
|
|
2
|
-
import zodToJsonSchema from "zod-to-json-schema";
|
|
1
|
+
import { type FormatOption, type JsonFormat, type ScrapeOptions, type ScreenshotFormat, type ChangeTrackingFormat } from "../types";
|
|
2
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
3
|
|
|
4
4
|
export function ensureValidFormats(formats?: FormatOption[]): void {
|
|
5
5
|
if (!formats) return;
|
|
@@ -27,6 +27,19 @@ export function ensureValidFormats(formats?: FormatOption[]): void {
|
|
|
27
27
|
}
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
|
+
if ((fmt as ChangeTrackingFormat).type === "changeTracking") {
|
|
31
|
+
const ct = fmt as ChangeTrackingFormat;
|
|
32
|
+
const maybeSchema: any = ct.schema as any;
|
|
33
|
+
const isZod = !!maybeSchema && (typeof maybeSchema.safeParse === "function" || typeof maybeSchema.parse === "function") && !!maybeSchema._def;
|
|
34
|
+
if (isZod) {
|
|
35
|
+
try {
|
|
36
|
+
(ct as any).schema = zodToJsonSchema(maybeSchema);
|
|
37
|
+
} catch {
|
|
38
|
+
// Best-effort conversion; if it fails, leave original value
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
30
43
|
if ((fmt as ScreenshotFormat).type === "screenshot") {
|
|
31
44
|
// no-op; already camelCase; validate numeric fields if present
|
|
32
45
|
const s = fmt as ScreenshotFormat;
|