firecrawl 4.25.3 → 4.25.5
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/audit-ci.jsonc +1 -4
- package/dist/{chunk-5D4KXCYO.js → chunk-L4JQOWAZ.js} +8 -3
- package/dist/index.cjs +13 -7
- package/dist/index.d.cts +2 -31
- package/dist/index.d.ts +2 -31
- package/dist/index.js +7 -6
- package/dist/{package-HESILIET.js → package-FPTJWPF7.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/clientOptions.test.ts +5 -6
- package/src/v2/client.ts +3 -3
- package/src/v2/types.ts +1 -42
- package/src/v2/utils/httpClient.ts +4 -1
package/audit-ci.jsonc
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
2
|
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
|
|
3
|
+
try {
|
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
throw mod = 0, e;
|
|
7
|
+
}
|
|
4
8
|
};
|
|
5
9
|
|
|
6
10
|
// package.json
|
|
@@ -8,7 +12,7 @@ var require_package = __commonJS({
|
|
|
8
12
|
"package.json"(exports, module) {
|
|
9
13
|
module.exports = {
|
|
10
14
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.25.
|
|
15
|
+
version: "4.25.5",
|
|
12
16
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
17
|
main: "dist/index.js",
|
|
14
18
|
types: "dist/index.d.ts",
|
|
@@ -79,7 +83,8 @@ var require_package = __commonJS({
|
|
|
79
83
|
handlebars: ">=4.7.9",
|
|
80
84
|
"brace-expansion": ">=5.0.6",
|
|
81
85
|
"axios@>=1.0.0 <1.16.0": "1.16.1",
|
|
82
|
-
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0"
|
|
86
|
+
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0",
|
|
87
|
+
"esbuild@>=0.17.0 <0.28.1": "0.28.1"
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
} catch (e2) {
|
|
12
|
+
throw mod = 0, e2;
|
|
13
|
+
}
|
|
10
14
|
};
|
|
11
15
|
var __export = (target, all) => {
|
|
12
16
|
for (var name in all)
|
|
@@ -35,7 +39,7 @@ var require_package = __commonJS({
|
|
|
35
39
|
"package.json"(exports2, module2) {
|
|
36
40
|
module2.exports = {
|
|
37
41
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.25.
|
|
42
|
+
version: "4.25.5",
|
|
39
43
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
44
|
main: "dist/index.js",
|
|
41
45
|
types: "dist/index.d.ts",
|
|
@@ -106,7 +110,8 @@ var require_package = __commonJS({
|
|
|
106
110
|
handlebars: ">=4.7.9",
|
|
107
111
|
"brace-expansion": ">=5.0.6",
|
|
108
112
|
"axios@>=1.0.0 <1.16.0": "1.16.1",
|
|
109
|
-
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0"
|
|
113
|
+
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0",
|
|
114
|
+
"esbuild@>=0.17.0 <0.28.1": "0.28.1"
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
};
|
|
@@ -159,7 +164,10 @@ var HttpClient = class {
|
|
|
159
164
|
baseURL: this.apiUrl,
|
|
160
165
|
timeout: options.timeoutMs ?? 3e5,
|
|
161
166
|
headers: {
|
|
162
|
-
Authorization
|
|
167
|
+
// Omit the Authorization header entirely when no API key is set so that
|
|
168
|
+
// scrape/search/interact can use the keyless free tier (the cloud only
|
|
169
|
+
// grants it when no Authorization header is present).
|
|
170
|
+
...this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}
|
|
163
171
|
},
|
|
164
172
|
transitional: { clarifyTimeoutError: true }
|
|
165
173
|
});
|
|
@@ -1463,6 +1471,7 @@ var ResearchClient = class {
|
|
|
1463
1471
|
constructor(http) {
|
|
1464
1472
|
this.http = http;
|
|
1465
1473
|
}
|
|
1474
|
+
http;
|
|
1466
1475
|
/**
|
|
1467
1476
|
* Search papers by abstract relevance.
|
|
1468
1477
|
* @param query Natural-language search query.
|
|
@@ -1939,9 +1948,6 @@ var FirecrawlClient = class {
|
|
|
1939
1948
|
const opts = typeof options === "string" ? { apiKey: options } : options;
|
|
1940
1949
|
const apiKey = (opts.apiKey ?? process.env.FIRECRAWL_API_KEY ?? "").trim();
|
|
1941
1950
|
const apiUrl = (opts.apiUrl ?? process.env.FIRECRAWL_API_URL ?? "https://api.firecrawl.dev").replace(/\/$/, "");
|
|
1942
|
-
if (this.isCloudService(apiUrl) && !apiKey) {
|
|
1943
|
-
throw new Error("API key is required for the cloud API. Set FIRECRAWL_API_KEY env or pass apiKey.");
|
|
1944
|
-
}
|
|
1945
1951
|
this.http = new HttpClient({
|
|
1946
1952
|
apiKey,
|
|
1947
1953
|
apiUrl,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxiosResponse, AxiosRequestHeaders } from 'axios';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { TypedEventTarget } from 'typescript-event-target';
|
|
6
6
|
|
|
7
|
-
type FormatString = "markdown" | "html" | "rawHtml" | "links" | "images" | "screenshot" | "summary" | "changeTracking" | "json" | "attributes" | "branding" | "audio" | "video"
|
|
7
|
+
type FormatString = "markdown" | "html" | "rawHtml" | "links" | "images" | "screenshot" | "summary" | "changeTracking" | "json" | "attributes" | "branding" | "audio" | "video";
|
|
8
8
|
interface Viewport {
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
@@ -165,34 +165,6 @@ interface RedactPIIOptions {
|
|
|
165
165
|
*/
|
|
166
166
|
replaceStyle?: "tag" | "mask" | "remove";
|
|
167
167
|
}
|
|
168
|
-
type PIISource = "model" | "heuristics" | "unknown";
|
|
169
|
-
interface PIISpan {
|
|
170
|
-
start: number;
|
|
171
|
-
end: number;
|
|
172
|
-
/** Unified entity bucket. Omitted when `kind` doesn't map onto one. */
|
|
173
|
-
entity?: RedactPIIEntity;
|
|
174
|
-
/** Granular recognizer label from fire-privacy. */
|
|
175
|
-
kind: string;
|
|
176
|
-
source: PIISource;
|
|
177
|
-
/** Confidence in [0, 1] when supplied. */
|
|
178
|
-
score?: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* - ok: redaction completed; redactedMarkdown is the result.
|
|
182
|
-
* - skipped: redaction was not performed; see `reason`.
|
|
183
|
-
* - failed: redaction was attempted but did not produce a usable result.
|
|
184
|
-
*/
|
|
185
|
-
type PIIStatus = "ok" | "skipped" | "failed";
|
|
186
|
-
/** Always set when status !== "ok". */
|
|
187
|
-
type PIIReason = "empty_input" | "too_large" | "upstream_skipped" | "service_unavailable" | "timeout" | "error";
|
|
188
|
-
interface PIIBlock {
|
|
189
|
-
status: PIIStatus;
|
|
190
|
-
reason?: PIIReason;
|
|
191
|
-
redactedMarkdown: string | null;
|
|
192
|
-
spans: PIISpan[];
|
|
193
|
-
/** Span count per entity bucket. Only non-zero entries are present. */
|
|
194
|
-
counts: Partial<Record<RedactPIIEntity, number>>;
|
|
195
|
-
}
|
|
196
168
|
type ParseFileData = Blob | File | Buffer | Uint8Array | ArrayBuffer | string;
|
|
197
169
|
interface ParseFile {
|
|
198
170
|
data: ParseFileData;
|
|
@@ -410,7 +382,6 @@ interface Document {
|
|
|
410
382
|
warning?: string;
|
|
411
383
|
changeTracking?: Record<string, unknown>;
|
|
412
384
|
branding?: BrandingProfile;
|
|
413
|
-
pii?: PIIBlock;
|
|
414
385
|
}
|
|
415
386
|
interface PaginationConfig {
|
|
416
387
|
/** When true (default), automatically follow `next` links and aggregate all documents. */
|
|
@@ -2468,4 +2439,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2468
2439
|
get v1(): FirecrawlApp;
|
|
2469
2440
|
}
|
|
2470
2441
|
|
|
2471
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, 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 FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type
|
|
2442
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, 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 FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxiosResponse, AxiosRequestHeaders } from 'axios';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { TypedEventTarget } from 'typescript-event-target';
|
|
6
6
|
|
|
7
|
-
type FormatString = "markdown" | "html" | "rawHtml" | "links" | "images" | "screenshot" | "summary" | "changeTracking" | "json" | "attributes" | "branding" | "audio" | "video"
|
|
7
|
+
type FormatString = "markdown" | "html" | "rawHtml" | "links" | "images" | "screenshot" | "summary" | "changeTracking" | "json" | "attributes" | "branding" | "audio" | "video";
|
|
8
8
|
interface Viewport {
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
@@ -165,34 +165,6 @@ interface RedactPIIOptions {
|
|
|
165
165
|
*/
|
|
166
166
|
replaceStyle?: "tag" | "mask" | "remove";
|
|
167
167
|
}
|
|
168
|
-
type PIISource = "model" | "heuristics" | "unknown";
|
|
169
|
-
interface PIISpan {
|
|
170
|
-
start: number;
|
|
171
|
-
end: number;
|
|
172
|
-
/** Unified entity bucket. Omitted when `kind` doesn't map onto one. */
|
|
173
|
-
entity?: RedactPIIEntity;
|
|
174
|
-
/** Granular recognizer label from fire-privacy. */
|
|
175
|
-
kind: string;
|
|
176
|
-
source: PIISource;
|
|
177
|
-
/** Confidence in [0, 1] when supplied. */
|
|
178
|
-
score?: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* - ok: redaction completed; redactedMarkdown is the result.
|
|
182
|
-
* - skipped: redaction was not performed; see `reason`.
|
|
183
|
-
* - failed: redaction was attempted but did not produce a usable result.
|
|
184
|
-
*/
|
|
185
|
-
type PIIStatus = "ok" | "skipped" | "failed";
|
|
186
|
-
/** Always set when status !== "ok". */
|
|
187
|
-
type PIIReason = "empty_input" | "too_large" | "upstream_skipped" | "service_unavailable" | "timeout" | "error";
|
|
188
|
-
interface PIIBlock {
|
|
189
|
-
status: PIIStatus;
|
|
190
|
-
reason?: PIIReason;
|
|
191
|
-
redactedMarkdown: string | null;
|
|
192
|
-
spans: PIISpan[];
|
|
193
|
-
/** Span count per entity bucket. Only non-zero entries are present. */
|
|
194
|
-
counts: Partial<Record<RedactPIIEntity, number>>;
|
|
195
|
-
}
|
|
196
168
|
type ParseFileData = Blob | File | Buffer | Uint8Array | ArrayBuffer | string;
|
|
197
169
|
interface ParseFile {
|
|
198
170
|
data: ParseFileData;
|
|
@@ -410,7 +382,6 @@ interface Document {
|
|
|
410
382
|
warning?: string;
|
|
411
383
|
changeTracking?: Record<string, unknown>;
|
|
412
384
|
branding?: BrandingProfile;
|
|
413
|
-
pii?: PIIBlock;
|
|
414
385
|
}
|
|
415
386
|
interface PaginationConfig {
|
|
416
387
|
/** When true (default), automatically follow `next` links and aggregate all documents. */
|
|
@@ -2468,4 +2439,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2468
2439
|
get v1(): FirecrawlApp;
|
|
2469
2440
|
}
|
|
2470
2441
|
|
|
2471
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, 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 FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type
|
|
2442
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, 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 FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, 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-L4JQOWAZ.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -34,7 +34,10 @@ var HttpClient = class {
|
|
|
34
34
|
baseURL: this.apiUrl,
|
|
35
35
|
timeout: options.timeoutMs ?? 3e5,
|
|
36
36
|
headers: {
|
|
37
|
-
Authorization
|
|
37
|
+
// Omit the Authorization header entirely when no API key is set so that
|
|
38
|
+
// scrape/search/interact can use the keyless free tier (the cloud only
|
|
39
|
+
// grants it when no Authorization header is present).
|
|
40
|
+
...this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}
|
|
38
41
|
},
|
|
39
42
|
transitional: { clarifyTimeoutError: true }
|
|
40
43
|
});
|
|
@@ -1338,6 +1341,7 @@ var ResearchClient = class {
|
|
|
1338
1341
|
constructor(http) {
|
|
1339
1342
|
this.http = http;
|
|
1340
1343
|
}
|
|
1344
|
+
http;
|
|
1341
1345
|
/**
|
|
1342
1346
|
* Search papers by abstract relevance.
|
|
1343
1347
|
* @param query Natural-language search query.
|
|
@@ -1814,9 +1818,6 @@ var FirecrawlClient = class {
|
|
|
1814
1818
|
const opts = typeof options === "string" ? { apiKey: options } : options;
|
|
1815
1819
|
const apiKey = (opts.apiKey ?? process.env.FIRECRAWL_API_KEY ?? "").trim();
|
|
1816
1820
|
const apiUrl = (opts.apiUrl ?? process.env.FIRECRAWL_API_URL ?? "https://api.firecrawl.dev").replace(/\/$/, "");
|
|
1817
|
-
if (this.isCloudService(apiUrl) && !apiKey) {
|
|
1818
|
-
throw new Error("API key is required for the cloud API. Set FIRECRAWL_API_KEY env or pass apiKey.");
|
|
1819
|
-
}
|
|
1820
1821
|
this.http = new HttpClient({
|
|
1821
1822
|
apiKey,
|
|
1822
1823
|
apiUrl,
|
|
@@ -2243,7 +2244,7 @@ var FirecrawlApp = class {
|
|
|
2243
2244
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2244
2245
|
return process.env.npm_package_version;
|
|
2245
2246
|
}
|
|
2246
|
-
const packageJson = await import("./package-
|
|
2247
|
+
const packageJson = await import("./package-FPTJWPF7.js");
|
|
2247
2248
|
return packageJson.default.version;
|
|
2248
2249
|
} catch (error) {
|
|
2249
2250
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
|
@@ -67,12 +67,11 @@ describe('Firecrawl v2 Client Options', () => {
|
|
|
67
67
|
expect(client).toBeInstanceOf(FirecrawlClient);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
it('should
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
expect(() => new Firecrawl(' ')).toThrow('API key is required');
|
|
70
|
+
it('should construct without an API key for the keyless free tier', () => {
|
|
71
|
+
// No key: scrape/search/interact use the keyless free tier; the SDK no
|
|
72
|
+
// longer throws at construction.
|
|
73
|
+
expect(() => new Firecrawl('')).not.toThrow();
|
|
74
|
+
expect(() => new Firecrawl(' ')).not.toThrow();
|
|
76
75
|
});
|
|
77
76
|
|
|
78
77
|
it('should provide v1 accessor when constructed with string', () => {
|
package/src/v2/client.ts
CHANGED
|
@@ -137,9 +137,9 @@ export class FirecrawlClient {
|
|
|
137
137
|
const apiKey = (opts.apiKey ?? process.env.FIRECRAWL_API_KEY ?? "").trim();
|
|
138
138
|
const apiUrl = (opts.apiUrl ?? process.env.FIRECRAWL_API_URL ?? "https://api.firecrawl.dev").replace(/\/$/, "");
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
// No API key is allowed: scrape, search, and interact fall back to the
|
|
141
|
+
// keyless free tier (rate-limited per IP). Other methods will return 401
|
|
142
|
+
// from the API until a key is provided.
|
|
143
143
|
|
|
144
144
|
this.http = new HttpClient({
|
|
145
145
|
apiKey,
|
package/src/v2/types.ts
CHANGED
|
@@ -14,8 +14,7 @@ export type FormatString =
|
|
|
14
14
|
| "attributes"
|
|
15
15
|
| "branding"
|
|
16
16
|
| "audio"
|
|
17
|
-
| "video"
|
|
18
|
-
| "pii";
|
|
17
|
+
| "video";
|
|
19
18
|
|
|
20
19
|
export interface Viewport {
|
|
21
20
|
width: number;
|
|
@@ -240,45 +239,6 @@ export interface RedactPIIOptions {
|
|
|
240
239
|
replaceStyle?: "tag" | "mask" | "remove";
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
export type PIISource = "model" | "heuristics" | "unknown";
|
|
244
|
-
|
|
245
|
-
export interface PIISpan {
|
|
246
|
-
start: number;
|
|
247
|
-
end: number;
|
|
248
|
-
/** Unified entity bucket. Omitted when `kind` doesn't map onto one. */
|
|
249
|
-
entity?: RedactPIIEntity;
|
|
250
|
-
/** Granular recognizer label from fire-privacy. */
|
|
251
|
-
kind: string;
|
|
252
|
-
source: PIISource;
|
|
253
|
-
/** Confidence in [0, 1] when supplied. */
|
|
254
|
-
score?: number;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* - ok: redaction completed; redactedMarkdown is the result.
|
|
259
|
-
* - skipped: redaction was not performed; see `reason`.
|
|
260
|
-
* - failed: redaction was attempted but did not produce a usable result.
|
|
261
|
-
*/
|
|
262
|
-
export type PIIStatus = "ok" | "skipped" | "failed";
|
|
263
|
-
|
|
264
|
-
/** Always set when status !== "ok". */
|
|
265
|
-
export type PIIReason =
|
|
266
|
-
| "empty_input"
|
|
267
|
-
| "too_large"
|
|
268
|
-
| "upstream_skipped"
|
|
269
|
-
| "service_unavailable"
|
|
270
|
-
| "timeout"
|
|
271
|
-
| "error";
|
|
272
|
-
|
|
273
|
-
export interface PIIBlock {
|
|
274
|
-
status: PIIStatus;
|
|
275
|
-
reason?: PIIReason;
|
|
276
|
-
redactedMarkdown: string | null;
|
|
277
|
-
spans: PIISpan[];
|
|
278
|
-
/** Span count per entity bucket. Only non-zero entries are present. */
|
|
279
|
-
counts: Partial<Record<RedactPIIEntity, number>>;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
242
|
export type ParseFileData =
|
|
283
243
|
| Blob
|
|
284
244
|
| File
|
|
@@ -549,7 +509,6 @@ export interface Document {
|
|
|
549
509
|
warning?: string;
|
|
550
510
|
changeTracking?: Record<string, unknown>;
|
|
551
511
|
branding?: BrandingProfile;
|
|
552
|
-
pii?: PIIBlock;
|
|
553
512
|
}
|
|
554
513
|
|
|
555
514
|
// Pagination configuration for auto-fetching pages from v2 endpoints that return a `next` URL
|
|
@@ -34,7 +34,10 @@ export class HttpClient {
|
|
|
34
34
|
baseURL: this.apiUrl,
|
|
35
35
|
timeout: options.timeoutMs ?? 300000,
|
|
36
36
|
headers: {
|
|
37
|
-
Authorization
|
|
37
|
+
// Omit the Authorization header entirely when no API key is set so that
|
|
38
|
+
// scrape/search/interact can use the keyless free tier (the cloud only
|
|
39
|
+
// grants it when no Authorization header is present).
|
|
40
|
+
...(this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}),
|
|
38
41
|
},
|
|
39
42
|
transitional: { clarifyTimeoutError: true },
|
|
40
43
|
});
|