firecrawl 4.42.3 → 4.43.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.
- package/README.md +21 -1
- package/audit-ci.jsonc +16 -1
- package/dist/{chunk-AMV6GR2H.js → chunk-HEXXQWYV.js} +1 -1
- package/dist/index.cjs +41 -13
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +42 -14
- package/dist/{package-RQDQRVLO.js → package-GSILJ5AJ.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v1/optional-params.test.ts +70 -0
- package/src/__tests__/unit/v2/gov.test.ts +66 -0
- package/src/v1/index.ts +12 -12
- package/src/v2/client.ts +14 -0
- package/src/v2/methods/gov.ts +34 -0
- package/src/v2/types.ts +14 -2
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ const scraped = await app.search('firecrawl changelog', {
|
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
Results are grouped by source: `.web`, `.news` and `.images`. Developer
|
|
194
|
-
category results are served inside `.web`.
|
|
194
|
+
and gov category results are served inside `.web`.
|
|
195
195
|
|
|
196
196
|
Use `categories` to narrow web search to a kind of site:
|
|
197
197
|
|
|
@@ -236,6 +236,26 @@ console.log(evidence.repos); // indexed-status echoes for requested repos
|
|
|
236
236
|
`archived`, `fork`, and `skills: 'only'`. Supplying both `repos` and `sources`
|
|
237
237
|
OR-combines GitHub-backed and documentation results.
|
|
238
238
|
|
|
239
|
+
### Government search
|
|
240
|
+
|
|
241
|
+
Use `govSearch` to search the Firecrawl Government Index: primary
|
|
242
|
+
law and regulatory material from US federal, state, and local government
|
|
243
|
+
sources, including statutes, regulations, codes, court opinions, and other
|
|
244
|
+
government publications. Results come back in the ordinary web-result shape.
|
|
245
|
+
Generic `search('food labeling requirements', { categories: ['gov'] })`
|
|
246
|
+
returns index results inside `.web`; like `developer`, it cannot be combined
|
|
247
|
+
with other categories.
|
|
248
|
+
|
|
249
|
+
```js
|
|
250
|
+
const law = await app.govSearch('food labeling requirements', {
|
|
251
|
+
k: 5,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
for (const result of law.data.web) {
|
|
255
|
+
console.log(result.position, result.title, result.url);
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
239
259
|
### Research / paper search
|
|
240
260
|
|
|
241
261
|
Use `app.research` to search Firecrawl's research paper index: ~43M paper
|
package/audit-ci.jsonc
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
|
|
3
|
-
"low": true
|
|
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
19
|
}
|
|
@@ -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.
|
|
15
|
+
version: "4.43.0",
|
|
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.
|
|
42
|
+
version: "4.43.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",
|
|
@@ -1023,6 +1023,27 @@ async function developerSearch(http, query, options = {}) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
|
+
// src/v2/methods/gov.ts
|
|
1027
|
+
var ENDPOINT2 = "/v2/search/gov";
|
|
1028
|
+
async function govSearch(http, query, options = {}) {
|
|
1029
|
+
if (!query || !query.trim()) throw new Error("query cannot be empty");
|
|
1030
|
+
try {
|
|
1031
|
+
const response = await http.post(ENDPOINT2, {
|
|
1032
|
+
query,
|
|
1033
|
+
...options.k !== void 0 ? { k: options.k } : {}
|
|
1034
|
+
});
|
|
1035
|
+
if (response.status !== 200 || !response.data?.success) {
|
|
1036
|
+
throwForBadResponse(response, "search the Government Index");
|
|
1037
|
+
}
|
|
1038
|
+
return response.data;
|
|
1039
|
+
} catch (error) {
|
|
1040
|
+
if (error?.isAxiosError) {
|
|
1041
|
+
return normalizeAxiosError(error, "search the Government Index");
|
|
1042
|
+
}
|
|
1043
|
+
throw error;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1026
1047
|
// src/v2/methods/map.ts
|
|
1027
1048
|
function prepareMapPayload(url, options) {
|
|
1028
1049
|
if (!url || !url.trim()) throw new Error("URL cannot be empty");
|
|
@@ -2404,6 +2425,13 @@ var FirecrawlClient = class {
|
|
|
2404
2425
|
async developerSearch(query, options = {}) {
|
|
2405
2426
|
return developerSearch(this.http, query, options);
|
|
2406
2427
|
}
|
|
2428
|
+
/**
|
|
2429
|
+
* Search the Government Index: primary law and regulatory material
|
|
2430
|
+
* from US federal, state, and local government sources.
|
|
2431
|
+
*/
|
|
2432
|
+
async govSearch(query, options = {}) {
|
|
2433
|
+
return govSearch(this.http, query, options);
|
|
2434
|
+
}
|
|
2407
2435
|
/**
|
|
2408
2436
|
* Submit feedback for a v2 job.
|
|
2409
2437
|
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
@@ -2875,7 +2903,7 @@ var FirecrawlApp = class {
|
|
|
2875
2903
|
"Content-Type": "application/json",
|
|
2876
2904
|
Authorization: `Bearer ${this.apiKey}`
|
|
2877
2905
|
};
|
|
2878
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
2906
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
2879
2907
|
if (jsonData?.extract?.schema) {
|
|
2880
2908
|
jsonData = {
|
|
2881
2909
|
...jsonData,
|
|
@@ -2939,7 +2967,7 @@ var FirecrawlApp = class {
|
|
|
2939
2967
|
lang: params?.lang ?? "en",
|
|
2940
2968
|
country: params?.country ?? "us",
|
|
2941
2969
|
location: params?.location,
|
|
2942
|
-
origin: typeof params
|
|
2970
|
+
origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}`,
|
|
2943
2971
|
timeout: params?.timeout ?? 6e4,
|
|
2944
2972
|
scrapeOptions: params?.scrapeOptions ?? { formats: [] }
|
|
2945
2973
|
};
|
|
@@ -2994,7 +3022,7 @@ var FirecrawlApp = class {
|
|
|
2994
3022
|
*/
|
|
2995
3023
|
async crawlUrl(url, params, pollInterval = 2, idempotencyKey) {
|
|
2996
3024
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
2997
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3025
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
2998
3026
|
try {
|
|
2999
3027
|
const response = await this.postRequest(
|
|
3000
3028
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -3018,7 +3046,7 @@ var FirecrawlApp = class {
|
|
|
3018
3046
|
}
|
|
3019
3047
|
async asyncCrawlUrl(url, params, idempotencyKey) {
|
|
3020
3048
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
3021
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3049
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3022
3050
|
try {
|
|
3023
3051
|
const response = await this.postRequest(
|
|
3024
3052
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -3177,7 +3205,7 @@ var FirecrawlApp = class {
|
|
|
3177
3205
|
*/
|
|
3178
3206
|
async mapUrl(url, params) {
|
|
3179
3207
|
const headers = this.prepareHeaders();
|
|
3180
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3208
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3181
3209
|
try {
|
|
3182
3210
|
const response = await this.postRequest(
|
|
3183
3211
|
this.apiUrl + `/v1/map`,
|
|
@@ -3206,7 +3234,7 @@ var FirecrawlApp = class {
|
|
|
3206
3234
|
*/
|
|
3207
3235
|
async batchScrapeUrls(urls, params, pollInterval = 2, idempotencyKey, webhook, ignoreInvalidURLs, maxConcurrency) {
|
|
3208
3236
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
3209
|
-
let jsonData = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof params
|
|
3237
|
+
let jsonData = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3210
3238
|
if (jsonData?.extract?.schema) {
|
|
3211
3239
|
jsonData = {
|
|
3212
3240
|
...jsonData,
|
|
@@ -3248,7 +3276,7 @@ var FirecrawlApp = class {
|
|
|
3248
3276
|
}
|
|
3249
3277
|
async asyncBatchScrapeUrls(urls, params, idempotencyKey, webhook, ignoreInvalidURLs) {
|
|
3250
3278
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
3251
|
-
let jsonData = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof params
|
|
3279
|
+
let jsonData = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3252
3280
|
try {
|
|
3253
3281
|
const response = await this.postRequest(
|
|
3254
3282
|
this.apiUrl + `/v1/batch/scrape`,
|
|
@@ -3392,7 +3420,7 @@ var FirecrawlApp = class {
|
|
|
3392
3420
|
try {
|
|
3393
3421
|
const response = await this.postRequest(
|
|
3394
3422
|
this.apiUrl + `/v1/extract`,
|
|
3395
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof params
|
|
3423
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` },
|
|
3396
3424
|
headers
|
|
3397
3425
|
);
|
|
3398
3426
|
if (response.status === 200) {
|
|
@@ -3445,7 +3473,7 @@ var FirecrawlApp = class {
|
|
|
3445
3473
|
try {
|
|
3446
3474
|
const response = await this.postRequest(
|
|
3447
3475
|
this.apiUrl + `/v1/extract`,
|
|
3448
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof params
|
|
3476
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` },
|
|
3449
3477
|
headers
|
|
3450
3478
|
);
|
|
3451
3479
|
if (response.status === 200) {
|
|
@@ -3727,7 +3755,7 @@ var FirecrawlApp = class {
|
|
|
3727
3755
|
*/
|
|
3728
3756
|
async asyncDeepResearch(query, params) {
|
|
3729
3757
|
const headers = this.prepareHeaders();
|
|
3730
|
-
let jsonData = { query, ...params, origin: typeof params
|
|
3758
|
+
let jsonData = { query, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3731
3759
|
if (jsonData?.jsonOptions?.schema) {
|
|
3732
3760
|
jsonData = {
|
|
3733
3761
|
...jsonData,
|
|
@@ -3846,7 +3874,7 @@ var FirecrawlApp = class {
|
|
|
3846
3874
|
async __asyncDeepResearch(topic, params) {
|
|
3847
3875
|
const headers = this.prepareHeaders();
|
|
3848
3876
|
try {
|
|
3849
|
-
let jsonData = { topic, ...params, origin: typeof params
|
|
3877
|
+
let jsonData = { topic, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3850
3878
|
const response = await this.postRequest(
|
|
3851
3879
|
`${this.apiUrl}/v1/deep-research`,
|
|
3852
3880
|
jsonData,
|
|
@@ -3946,7 +3974,7 @@ var FirecrawlApp = class {
|
|
|
3946
3974
|
*/
|
|
3947
3975
|
async asyncGenerateLLMsText(url, params) {
|
|
3948
3976
|
const headers = this.prepareHeaders();
|
|
3949
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3977
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3950
3978
|
try {
|
|
3951
3979
|
const response = await this.postRequest(
|
|
3952
3980
|
`${this.apiUrl}/v1/llmstxt`,
|
package/dist/index.d.cts
CHANGED
|
@@ -659,6 +659,16 @@ interface DeveloperSearchResponse {
|
|
|
659
659
|
/** Present only when sources were requested. */
|
|
660
660
|
sources?: DeveloperSearchSourceStatus[];
|
|
661
661
|
}
|
|
662
|
+
interface GovSearchOptions {
|
|
663
|
+
/** Total ranked results, 1–100 (default 10). */
|
|
664
|
+
k?: number;
|
|
665
|
+
}
|
|
666
|
+
interface GovSearchResponse {
|
|
667
|
+
success: boolean;
|
|
668
|
+
data: {
|
|
669
|
+
web: SearchResultWeb[];
|
|
670
|
+
};
|
|
671
|
+
}
|
|
662
672
|
interface SearchResultWeb {
|
|
663
673
|
url: string;
|
|
664
674
|
title?: string;
|
|
@@ -814,6 +824,8 @@ interface AlexandriaOptions {
|
|
|
814
824
|
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
815
825
|
* - `developer` — developer-index results (issues, pull requests, READMEs and
|
|
816
826
|
* documentation) served in `web`; cannot be combined with other categories.
|
|
827
|
+
* - `gov` — Government Index results served in `web`; cannot be combined
|
|
828
|
+
* with other categories.
|
|
817
829
|
*
|
|
818
830
|
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
819
831
|
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
@@ -825,7 +837,7 @@ interface AlexandriaOptions {
|
|
|
825
837
|
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
826
838
|
*/
|
|
827
839
|
interface CategoryOption {
|
|
828
|
-
type: "github" | "research" | "pdf" | "developer";
|
|
840
|
+
type: "github" | "research" | "pdf" | "developer" | "gov";
|
|
829
841
|
}
|
|
830
842
|
interface SearchRequest {
|
|
831
843
|
query: string;
|
|
@@ -844,7 +856,7 @@ interface SearchRequest {
|
|
|
844
856
|
* over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
|
|
845
857
|
* `firecrawl.research.searchPapers()` instead.
|
|
846
858
|
*/
|
|
847
|
-
categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
|
|
859
|
+
categories?: Array<"github" | "research" | "pdf" | "developer" | "gov" | CategoryOption>;
|
|
848
860
|
includeDomains?: string[];
|
|
849
861
|
excludeDomains?: string[];
|
|
850
862
|
limit?: number;
|
|
@@ -2323,6 +2335,11 @@ declare class FirecrawlClient {
|
|
|
2323
2335
|
* requested passages, citations, license disclosures, and indexing echoes.
|
|
2324
2336
|
*/
|
|
2325
2337
|
developerSearch(query: string, options?: DeveloperSearchOptions): Promise<DeveloperSearchResponse>;
|
|
2338
|
+
/**
|
|
2339
|
+
* Search the Government Index: primary law and regulatory material
|
|
2340
|
+
* from US federal, state, and local government sources.
|
|
2341
|
+
*/
|
|
2342
|
+
govSearch(query: string, options?: GovSearchOptions): Promise<GovSearchResponse>;
|
|
2326
2343
|
/**
|
|
2327
2344
|
* Submit feedback for a v2 job.
|
|
2328
2345
|
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
@@ -3557,4 +3574,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
3557
3574
|
get v1(): FirecrawlApp;
|
|
3558
3575
|
}
|
|
3559
3576
|
|
|
3560
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, 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, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
|
|
3577
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, 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 GovSearchOptions, type GovSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
|
package/dist/index.d.ts
CHANGED
|
@@ -659,6 +659,16 @@ interface DeveloperSearchResponse {
|
|
|
659
659
|
/** Present only when sources were requested. */
|
|
660
660
|
sources?: DeveloperSearchSourceStatus[];
|
|
661
661
|
}
|
|
662
|
+
interface GovSearchOptions {
|
|
663
|
+
/** Total ranked results, 1–100 (default 10). */
|
|
664
|
+
k?: number;
|
|
665
|
+
}
|
|
666
|
+
interface GovSearchResponse {
|
|
667
|
+
success: boolean;
|
|
668
|
+
data: {
|
|
669
|
+
web: SearchResultWeb[];
|
|
670
|
+
};
|
|
671
|
+
}
|
|
662
672
|
interface SearchResultWeb {
|
|
663
673
|
url: string;
|
|
664
674
|
title?: string;
|
|
@@ -814,6 +824,8 @@ interface AlexandriaOptions {
|
|
|
814
824
|
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
815
825
|
* - `developer` — developer-index results (issues, pull requests, READMEs and
|
|
816
826
|
* documentation) served in `web`; cannot be combined with other categories.
|
|
827
|
+
* - `gov` — Government Index results served in `web`; cannot be combined
|
|
828
|
+
* with other categories.
|
|
817
829
|
*
|
|
818
830
|
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
819
831
|
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
@@ -825,7 +837,7 @@ interface AlexandriaOptions {
|
|
|
825
837
|
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
826
838
|
*/
|
|
827
839
|
interface CategoryOption {
|
|
828
|
-
type: "github" | "research" | "pdf" | "developer";
|
|
840
|
+
type: "github" | "research" | "pdf" | "developer" | "gov";
|
|
829
841
|
}
|
|
830
842
|
interface SearchRequest {
|
|
831
843
|
query: string;
|
|
@@ -844,7 +856,7 @@ interface SearchRequest {
|
|
|
844
856
|
* over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
|
|
845
857
|
* `firecrawl.research.searchPapers()` instead.
|
|
846
858
|
*/
|
|
847
|
-
categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
|
|
859
|
+
categories?: Array<"github" | "research" | "pdf" | "developer" | "gov" | CategoryOption>;
|
|
848
860
|
includeDomains?: string[];
|
|
849
861
|
excludeDomains?: string[];
|
|
850
862
|
limit?: number;
|
|
@@ -2323,6 +2335,11 @@ declare class FirecrawlClient {
|
|
|
2323
2335
|
* requested passages, citations, license disclosures, and indexing echoes.
|
|
2324
2336
|
*/
|
|
2325
2337
|
developerSearch(query: string, options?: DeveloperSearchOptions): Promise<DeveloperSearchResponse>;
|
|
2338
|
+
/**
|
|
2339
|
+
* Search the Government Index: primary law and regulatory material
|
|
2340
|
+
* from US federal, state, and local government sources.
|
|
2341
|
+
*/
|
|
2342
|
+
govSearch(query: string, options?: GovSearchOptions): Promise<GovSearchResponse>;
|
|
2326
2343
|
/**
|
|
2327
2344
|
* Submit feedback for a v2 job.
|
|
2328
2345
|
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
@@ -3557,4 +3574,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
3557
3574
|
get v1(): FirecrawlApp;
|
|
3558
3575
|
}
|
|
3559
3576
|
|
|
3560
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, 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, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
|
|
3577
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, 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 GovSearchOptions, type GovSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HEXXQWYV.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -891,6 +891,27 @@ async function developerSearch(http, query, options = {}) {
|
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
|
|
894
|
+
// src/v2/methods/gov.ts
|
|
895
|
+
var ENDPOINT2 = "/v2/search/gov";
|
|
896
|
+
async function govSearch(http, query, options = {}) {
|
|
897
|
+
if (!query || !query.trim()) throw new Error("query cannot be empty");
|
|
898
|
+
try {
|
|
899
|
+
const response = await http.post(ENDPOINT2, {
|
|
900
|
+
query,
|
|
901
|
+
...options.k !== void 0 ? { k: options.k } : {}
|
|
902
|
+
});
|
|
903
|
+
if (response.status !== 200 || !response.data?.success) {
|
|
904
|
+
throwForBadResponse(response, "search the Government Index");
|
|
905
|
+
}
|
|
906
|
+
return response.data;
|
|
907
|
+
} catch (error) {
|
|
908
|
+
if (error?.isAxiosError) {
|
|
909
|
+
return normalizeAxiosError(error, "search the Government Index");
|
|
910
|
+
}
|
|
911
|
+
throw error;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
894
915
|
// src/v2/methods/map.ts
|
|
895
916
|
function prepareMapPayload(url, options) {
|
|
896
917
|
if (!url || !url.trim()) throw new Error("URL cannot be empty");
|
|
@@ -2272,6 +2293,13 @@ var FirecrawlClient = class {
|
|
|
2272
2293
|
async developerSearch(query, options = {}) {
|
|
2273
2294
|
return developerSearch(this.http, query, options);
|
|
2274
2295
|
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Search the Government Index: primary law and regulatory material
|
|
2298
|
+
* from US federal, state, and local government sources.
|
|
2299
|
+
*/
|
|
2300
|
+
async govSearch(query, options = {}) {
|
|
2301
|
+
return govSearch(this.http, query, options);
|
|
2302
|
+
}
|
|
2275
2303
|
/**
|
|
2276
2304
|
* Submit feedback for a v2 job.
|
|
2277
2305
|
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
@@ -2706,7 +2734,7 @@ var FirecrawlApp = class {
|
|
|
2706
2734
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2707
2735
|
return process.env.npm_package_version;
|
|
2708
2736
|
}
|
|
2709
|
-
const packageJson = await import("./package-
|
|
2737
|
+
const packageJson = await import("./package-GSILJ5AJ.js");
|
|
2710
2738
|
return packageJson.default.version;
|
|
2711
2739
|
} catch (error) {
|
|
2712
2740
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
|
@@ -2743,7 +2771,7 @@ var FirecrawlApp = class {
|
|
|
2743
2771
|
"Content-Type": "application/json",
|
|
2744
2772
|
Authorization: `Bearer ${this.apiKey}`
|
|
2745
2773
|
};
|
|
2746
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
2774
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
2747
2775
|
if (jsonData?.extract?.schema) {
|
|
2748
2776
|
jsonData = {
|
|
2749
2777
|
...jsonData,
|
|
@@ -2807,7 +2835,7 @@ var FirecrawlApp = class {
|
|
|
2807
2835
|
lang: params?.lang ?? "en",
|
|
2808
2836
|
country: params?.country ?? "us",
|
|
2809
2837
|
location: params?.location,
|
|
2810
|
-
origin: typeof params
|
|
2838
|
+
origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}`,
|
|
2811
2839
|
timeout: params?.timeout ?? 6e4,
|
|
2812
2840
|
scrapeOptions: params?.scrapeOptions ?? { formats: [] }
|
|
2813
2841
|
};
|
|
@@ -2862,7 +2890,7 @@ var FirecrawlApp = class {
|
|
|
2862
2890
|
*/
|
|
2863
2891
|
async crawlUrl(url, params, pollInterval = 2, idempotencyKey) {
|
|
2864
2892
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
2865
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
2893
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
2866
2894
|
try {
|
|
2867
2895
|
const response = await this.postRequest(
|
|
2868
2896
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -2886,7 +2914,7 @@ var FirecrawlApp = class {
|
|
|
2886
2914
|
}
|
|
2887
2915
|
async asyncCrawlUrl(url, params, idempotencyKey) {
|
|
2888
2916
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
2889
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
2917
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
2890
2918
|
try {
|
|
2891
2919
|
const response = await this.postRequest(
|
|
2892
2920
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -3045,7 +3073,7 @@ var FirecrawlApp = class {
|
|
|
3045
3073
|
*/
|
|
3046
3074
|
async mapUrl(url, params) {
|
|
3047
3075
|
const headers = this.prepareHeaders();
|
|
3048
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3076
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3049
3077
|
try {
|
|
3050
3078
|
const response = await this.postRequest(
|
|
3051
3079
|
this.apiUrl + `/v1/map`,
|
|
@@ -3074,7 +3102,7 @@ var FirecrawlApp = class {
|
|
|
3074
3102
|
*/
|
|
3075
3103
|
async batchScrapeUrls(urls, params, pollInterval = 2, idempotencyKey, webhook, ignoreInvalidURLs, maxConcurrency) {
|
|
3076
3104
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
3077
|
-
let jsonData = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof params
|
|
3105
|
+
let jsonData = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3078
3106
|
if (jsonData?.extract?.schema) {
|
|
3079
3107
|
jsonData = {
|
|
3080
3108
|
...jsonData,
|
|
@@ -3116,7 +3144,7 @@ var FirecrawlApp = class {
|
|
|
3116
3144
|
}
|
|
3117
3145
|
async asyncBatchScrapeUrls(urls, params, idempotencyKey, webhook, ignoreInvalidURLs) {
|
|
3118
3146
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
3119
|
-
let jsonData = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof params
|
|
3147
|
+
let jsonData = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3120
3148
|
try {
|
|
3121
3149
|
const response = await this.postRequest(
|
|
3122
3150
|
this.apiUrl + `/v1/batch/scrape`,
|
|
@@ -3260,7 +3288,7 @@ var FirecrawlApp = class {
|
|
|
3260
3288
|
try {
|
|
3261
3289
|
const response = await this.postRequest(
|
|
3262
3290
|
this.apiUrl + `/v1/extract`,
|
|
3263
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof params
|
|
3291
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` },
|
|
3264
3292
|
headers
|
|
3265
3293
|
);
|
|
3266
3294
|
if (response.status === 200) {
|
|
@@ -3313,7 +3341,7 @@ var FirecrawlApp = class {
|
|
|
3313
3341
|
try {
|
|
3314
3342
|
const response = await this.postRequest(
|
|
3315
3343
|
this.apiUrl + `/v1/extract`,
|
|
3316
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof params
|
|
3344
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` },
|
|
3317
3345
|
headers
|
|
3318
3346
|
);
|
|
3319
3347
|
if (response.status === 200) {
|
|
@@ -3595,7 +3623,7 @@ var FirecrawlApp = class {
|
|
|
3595
3623
|
*/
|
|
3596
3624
|
async asyncDeepResearch(query, params) {
|
|
3597
3625
|
const headers = this.prepareHeaders();
|
|
3598
|
-
let jsonData = { query, ...params, origin: typeof params
|
|
3626
|
+
let jsonData = { query, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3599
3627
|
if (jsonData?.jsonOptions?.schema) {
|
|
3600
3628
|
jsonData = {
|
|
3601
3629
|
...jsonData,
|
|
@@ -3714,7 +3742,7 @@ var FirecrawlApp = class {
|
|
|
3714
3742
|
async __asyncDeepResearch(topic, params) {
|
|
3715
3743
|
const headers = this.prepareHeaders();
|
|
3716
3744
|
try {
|
|
3717
|
-
let jsonData = { topic, ...params, origin: typeof params
|
|
3745
|
+
let jsonData = { topic, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3718
3746
|
const response = await this.postRequest(
|
|
3719
3747
|
`${this.apiUrl}/v1/deep-research`,
|
|
3720
3748
|
jsonData,
|
|
@@ -3814,7 +3842,7 @@ var FirecrawlApp = class {
|
|
|
3814
3842
|
*/
|
|
3815
3843
|
async asyncGenerateLLMsText(url, params) {
|
|
3816
3844
|
const headers = this.prepareHeaders();
|
|
3817
|
-
let jsonData = { url, ...params, origin: typeof params
|
|
3845
|
+
let jsonData = { url, ...params, origin: typeof params?.origin === "string" && params.origin.includes("mcp") ? params.origin : `js-sdk@${this.version}` };
|
|
3818
3846
|
try {
|
|
3819
3847
|
const response = await this.postRequest(
|
|
3820
3848
|
`${this.apiUrl}/v1/llmstxt`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firecrawl",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.43.0",
|
|
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",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, test, expect, jest, beforeEach, afterEach } from "@jest/globals";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import FirecrawlApp from "../../../v1";
|
|
4
|
+
|
|
5
|
+
const API_URL = "https://api.firecrawl.dev";
|
|
6
|
+
|
|
7
|
+
class FakeWebSocket {
|
|
8
|
+
onopen: unknown = null;
|
|
9
|
+
onmessage: unknown = null;
|
|
10
|
+
onerror: unknown = null;
|
|
11
|
+
onclose: unknown = null;
|
|
12
|
+
close() {}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("v1 methods work without params", () => {
|
|
16
|
+
let app: FirecrawlApp;
|
|
17
|
+
let posts: Array<{ url: string; data: any }>;
|
|
18
|
+
const originalWebSocket = (globalThis as any).WebSocket;
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
app = new FirecrawlApp({ apiKey: "fc-test", apiUrl: API_URL });
|
|
22
|
+
posts = [];
|
|
23
|
+
jest.spyOn(axios, "post").mockImplementation(async (url: string, data?: any) => {
|
|
24
|
+
posts.push({ url, data });
|
|
25
|
+
return { status: 200, data: { success: true, id: "job-1", data: [], links: [] } };
|
|
26
|
+
});
|
|
27
|
+
jest.spyOn(axios, "get").mockImplementation(async () => ({
|
|
28
|
+
status: 200,
|
|
29
|
+
data: { success: true, status: "completed", data: [{ markdown: "ok" }] },
|
|
30
|
+
}));
|
|
31
|
+
(globalThis as any).WebSocket = FakeWebSocket;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
jest.restoreAllMocks();
|
|
36
|
+
(globalThis as any).WebSocket = originalWebSocket;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const cases: Array<[string, string, (app: any) => Promise<unknown>]> = [
|
|
40
|
+
["scrapeUrl", "/v1/scrape", app => app.scrapeUrl("https://example.com")],
|
|
41
|
+
["search", "/v1/search", app => app.search("firecrawl")],
|
|
42
|
+
["crawlUrl", "/v1/crawl", app => app.crawlUrl("https://example.com")],
|
|
43
|
+
["asyncCrawlUrl", "/v1/crawl", app => app.asyncCrawlUrl("https://example.com")],
|
|
44
|
+
["crawlUrlAndWatch", "/v1/crawl", app => app.crawlUrlAndWatch("https://example.com")],
|
|
45
|
+
["mapUrl", "/v1/map", app => app.mapUrl("https://example.com")],
|
|
46
|
+
["batchScrapeUrls", "/v1/batch/scrape", app => app.batchScrapeUrls(["https://example.com"])],
|
|
47
|
+
["asyncBatchScrapeUrls", "/v1/batch/scrape", app => app.asyncBatchScrapeUrls(["https://example.com"])],
|
|
48
|
+
["batchScrapeUrlsAndWatch", "/v1/batch/scrape", app => app.batchScrapeUrlsAndWatch(["https://example.com"])],
|
|
49
|
+
["extract", "/v1/extract", app => app.extract(["https://example.com"])],
|
|
50
|
+
["asyncExtract", "/v1/extract", app => app.asyncExtract(["https://example.com"])],
|
|
51
|
+
["deepResearch", "/v1/deep-research", app => app.deepResearch("firecrawl")],
|
|
52
|
+
["asyncDeepResearch", "/v1/deep-research", app => app.asyncDeepResearch("firecrawl")],
|
|
53
|
+
["__deepResearch", "/v1/deep-research", app => app.__deepResearch("firecrawl")],
|
|
54
|
+
["__asyncDeepResearch", "/v1/deep-research", app => app.__asyncDeepResearch("firecrawl")],
|
|
55
|
+
["generateLLMsText", "/v1/llmstxt", app => app.generateLLMsText("https://example.com")],
|
|
56
|
+
["asyncGenerateLLMsText", "/v1/llmstxt", app => app.asyncGenerateLLMsText("https://example.com")],
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
test.each(cases)("%s sends the default origin", async (_method, path, call) => {
|
|
60
|
+
await expect(call(app)).resolves.toBeDefined();
|
|
61
|
+
expect(posts).toHaveLength(1);
|
|
62
|
+
expect(posts[0].url).toBe(`${API_URL}${path}`);
|
|
63
|
+
expect(posts[0].data.origin).toBe(`js-sdk@${app.version}`);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("an mcp origin passed in params is still forwarded", async () => {
|
|
67
|
+
await app.batchScrapeUrls(["https://example.com"], { origin: "mcp-server" } as any);
|
|
68
|
+
expect(posts[0].data.origin).toBe("mcp-server");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { describe, expect, jest, test } from "@jest/globals";
|
|
2
|
+
import { FirecrawlClient } from "../../../v2/client";
|
|
3
|
+
|
|
4
|
+
const response = {
|
|
5
|
+
success: true,
|
|
6
|
+
data: {
|
|
7
|
+
web: [
|
|
8
|
+
{
|
|
9
|
+
url: "https://www.ecfr.gov/current/title-21/chapter-I/subchapter-B/part-101",
|
|
10
|
+
title: "21 CFR Part 101 -- Food Labeling",
|
|
11
|
+
description: "matched snippet",
|
|
12
|
+
position: 1,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function clientWith(http: any) {
|
|
19
|
+
const client = new FirecrawlClient({
|
|
20
|
+
apiKey: "test",
|
|
21
|
+
apiUrl: "http://localhost",
|
|
22
|
+
});
|
|
23
|
+
(client as any).http = http;
|
|
24
|
+
return client;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe("govSearch", () => {
|
|
28
|
+
test.each([
|
|
29
|
+
[{ k: 5 }, { query: "food labeling requirements", k: 5 }],
|
|
30
|
+
[undefined, { query: "food labeling requirements" }],
|
|
31
|
+
])("posts %p and returns web results", async (options, body) => {
|
|
32
|
+
const http = {
|
|
33
|
+
post: jest.fn(async () => ({ status: 200, data: response })),
|
|
34
|
+
} as any;
|
|
35
|
+
|
|
36
|
+
const result = await clientWith(http).govSearch(
|
|
37
|
+
"food labeling requirements",
|
|
38
|
+
options,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
expect(http.post).toHaveBeenCalledWith("/v2/search/gov", body);
|
|
42
|
+
expect(result).toEqual(response);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("rejects an empty query", async () => {
|
|
46
|
+
const http = { post: jest.fn() } as any;
|
|
47
|
+
|
|
48
|
+
await expect(clientWith(http).govSearch(" ")).rejects.toThrow(
|
|
49
|
+
"query cannot be empty",
|
|
50
|
+
);
|
|
51
|
+
expect(http.post).not.toHaveBeenCalled();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("throws on an unsuccessful response body", async () => {
|
|
55
|
+
const http = {
|
|
56
|
+
post: jest.fn(async () => ({
|
|
57
|
+
status: 200,
|
|
58
|
+
data: { success: false, error: "Search failed" },
|
|
59
|
+
})),
|
|
60
|
+
} as any;
|
|
61
|
+
|
|
62
|
+
await expect(clientWith(http).govSearch("zoning variance")).rejects.toThrow(
|
|
63
|
+
"Search failed",
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
});
|
package/src/v1/index.ts
CHANGED
|
@@ -726,7 +726,7 @@ export default class FirecrawlApp {
|
|
|
726
726
|
"Content-Type": "application/json",
|
|
727
727
|
Authorization: `Bearer ${this.apiKey}`,
|
|
728
728
|
} as AxiosRequestHeaders;
|
|
729
|
-
let jsonData: any = { url, ...params, origin: typeof (params as any)
|
|
729
|
+
let jsonData: any = { url, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
730
730
|
if (jsonData?.extract?.schema) {
|
|
731
731
|
jsonData = {
|
|
732
732
|
...jsonData,
|
|
@@ -793,7 +793,7 @@ export default class FirecrawlApp {
|
|
|
793
793
|
lang: params?.lang ?? "en",
|
|
794
794
|
country: params?.country ?? "us",
|
|
795
795
|
location: params?.location,
|
|
796
|
-
origin: typeof (params as any)
|
|
796
|
+
origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}`,
|
|
797
797
|
timeout: params?.timeout ?? 60000,
|
|
798
798
|
scrapeOptions: params?.scrapeOptions ?? { formats: [] },
|
|
799
799
|
};
|
|
@@ -857,7 +857,7 @@ export default class FirecrawlApp {
|
|
|
857
857
|
idempotencyKey?: string
|
|
858
858
|
): Promise<CrawlStatusResponse | ErrorResponse> {
|
|
859
859
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
860
|
-
let jsonData: any = { url, ...params, origin: typeof (params as any)
|
|
860
|
+
let jsonData: any = { url, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
861
861
|
try {
|
|
862
862
|
const response: AxiosResponse = await this.postRequest(
|
|
863
863
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -886,7 +886,7 @@ export default class FirecrawlApp {
|
|
|
886
886
|
idempotencyKey?: string
|
|
887
887
|
): Promise<CrawlResponse | ErrorResponse> {
|
|
888
888
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
889
|
-
let jsonData: any = { url, ...params, origin: typeof (params as any)
|
|
889
|
+
let jsonData: any = { url, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
890
890
|
try {
|
|
891
891
|
const response: AxiosResponse = await this.postRequest(
|
|
892
892
|
this.apiUrl + `/v1/crawl`,
|
|
@@ -1062,7 +1062,7 @@ export default class FirecrawlApp {
|
|
|
1062
1062
|
*/
|
|
1063
1063
|
async mapUrl(url: string, params?: MapParams): Promise<MapResponse | ErrorResponse> {
|
|
1064
1064
|
const headers = this.prepareHeaders();
|
|
1065
|
-
let jsonData: any = { url, ...params, origin: typeof (params as any)
|
|
1065
|
+
let jsonData: any = { url, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
1066
1066
|
|
|
1067
1067
|
try {
|
|
1068
1068
|
const response: AxiosResponse = await this.postRequest(
|
|
@@ -1101,7 +1101,7 @@ export default class FirecrawlApp {
|
|
|
1101
1101
|
maxConcurrency?: number,
|
|
1102
1102
|
): Promise<BatchScrapeStatusResponse | ErrorResponse> {
|
|
1103
1103
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
1104
|
-
let jsonData: any = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof (params as any)
|
|
1104
|
+
let jsonData: any = { urls, webhook, ignoreInvalidURLs, maxConcurrency, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
1105
1105
|
if (jsonData?.extract?.schema) {
|
|
1106
1106
|
jsonData = {
|
|
1107
1107
|
...jsonData,
|
|
@@ -1150,7 +1150,7 @@ export default class FirecrawlApp {
|
|
|
1150
1150
|
ignoreInvalidURLs?: boolean,
|
|
1151
1151
|
): Promise<BatchScrapeResponse | ErrorResponse> {
|
|
1152
1152
|
const headers = this.prepareHeaders(idempotencyKey);
|
|
1153
|
-
let jsonData: any = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof (params as any)
|
|
1153
|
+
let jsonData: any = { urls, webhook, ignoreInvalidURLs, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
1154
1154
|
try {
|
|
1155
1155
|
const response: AxiosResponse = await this.postRequest(
|
|
1156
1156
|
this.apiUrl + `/v1/batch/scrape`,
|
|
@@ -1314,7 +1314,7 @@ export default class FirecrawlApp {
|
|
|
1314
1314
|
try {
|
|
1315
1315
|
const response: AxiosResponse = await this.postRequest(
|
|
1316
1316
|
this.apiUrl + `/v1/extract`,
|
|
1317
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof (params as any)
|
|
1317
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` },
|
|
1318
1318
|
headers
|
|
1319
1319
|
);
|
|
1320
1320
|
|
|
@@ -1374,7 +1374,7 @@ export default class FirecrawlApp {
|
|
|
1374
1374
|
try {
|
|
1375
1375
|
const response: AxiosResponse = await this.postRequest(
|
|
1376
1376
|
this.apiUrl + `/v1/extract`,
|
|
1377
|
-
{ ...jsonData, schema: jsonSchema, origin: typeof (params as any)
|
|
1377
|
+
{ ...jsonData, schema: jsonSchema, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` },
|
|
1378
1378
|
headers
|
|
1379
1379
|
);
|
|
1380
1380
|
|
|
@@ -1742,7 +1742,7 @@ export default class FirecrawlApp {
|
|
|
1742
1742
|
*/
|
|
1743
1743
|
async asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse> {
|
|
1744
1744
|
const headers = this.prepareHeaders();
|
|
1745
|
-
let jsonData: any = { query, ...params, origin: typeof (params as any)
|
|
1745
|
+
let jsonData: any = { query, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
1746
1746
|
|
|
1747
1747
|
if (jsonData?.jsonOptions?.schema) {
|
|
1748
1748
|
jsonData = {
|
|
@@ -1890,7 +1890,7 @@ export default class FirecrawlApp {
|
|
|
1890
1890
|
async __asyncDeepResearch(topic: string, params: DeepResearchParams): Promise<DeepResearchResponse | ErrorResponse> {
|
|
1891
1891
|
const headers = this.prepareHeaders();
|
|
1892
1892
|
try {
|
|
1893
|
-
let jsonData: any = { topic, ...params, origin: typeof (params as any)
|
|
1893
|
+
let jsonData: any = { topic, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
1894
1894
|
const response: AxiosResponse = await this.postRequest(
|
|
1895
1895
|
`${this.apiUrl}/v1/deep-research`,
|
|
1896
1896
|
jsonData,
|
|
@@ -2005,7 +2005,7 @@ export default class FirecrawlApp {
|
|
|
2005
2005
|
*/
|
|
2006
2006
|
async asyncGenerateLLMsText(url: string, params?: GenerateLLMsTextParams): Promise<GenerateLLMsTextResponse | ErrorResponse> {
|
|
2007
2007
|
const headers = this.prepareHeaders();
|
|
2008
|
-
let jsonData: any = { url, ...params, origin: typeof (params as any)
|
|
2008
|
+
let jsonData: any = { url, ...params, origin: typeof (params as any)?.origin === "string" && (params as any).origin.includes("mcp") ? (params as any).origin : `js-sdk@${this.version}` };
|
|
2009
2009
|
try {
|
|
2010
2010
|
const response: AxiosResponse = await this.postRequest(
|
|
2011
2011
|
`${this.apiUrl}/v1/llmstxt`,
|
package/src/v2/client.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { parse as parseMethod, getParseFormats } from "./methods/parse";
|
|
|
8
8
|
import { search } from "./methods/search";
|
|
9
9
|
import { scrapeAlexandria, findTools } from "./methods/tools";
|
|
10
10
|
import { developerSearch as developerSearchMethod } from "./methods/developer";
|
|
11
|
+
import { govSearch as govSearchMethod } from "./methods/gov";
|
|
11
12
|
import { map as mapMethod } from "./methods/map";
|
|
12
13
|
import { feedback as feedbackMethod, searchFeedback as searchFeedbackMethod } from "./methods/feedback";
|
|
13
14
|
import {
|
|
@@ -60,6 +61,8 @@ import type {
|
|
|
60
61
|
SearchRequest,
|
|
61
62
|
DeveloperSearchOptions,
|
|
62
63
|
DeveloperSearchResponse,
|
|
64
|
+
GovSearchOptions,
|
|
65
|
+
GovSearchResponse,
|
|
63
66
|
EndpointFeedbackRequest,
|
|
64
67
|
FeedbackResponse,
|
|
65
68
|
SearchFeedbackRequest,
|
|
@@ -306,6 +309,17 @@ export class FirecrawlClient {
|
|
|
306
309
|
return developerSearchMethod(this.http, query, options);
|
|
307
310
|
}
|
|
308
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Search the Government Index: primary law and regulatory material
|
|
314
|
+
* from US federal, state, and local government sources.
|
|
315
|
+
*/
|
|
316
|
+
async govSearch(
|
|
317
|
+
query: string,
|
|
318
|
+
options: GovSearchOptions = {},
|
|
319
|
+
): Promise<GovSearchResponse> {
|
|
320
|
+
return govSearchMethod(this.http, query, options);
|
|
321
|
+
}
|
|
322
|
+
|
|
309
323
|
/**
|
|
310
324
|
* Submit feedback for a v2 job.
|
|
311
325
|
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GovSearchOptions, GovSearchResponse } from "../types";
|
|
2
|
+
import { HttpClient } from "../utils/httpClient";
|
|
3
|
+
import {
|
|
4
|
+
normalizeAxiosError,
|
|
5
|
+
throwForBadResponse,
|
|
6
|
+
} from "../utils/errorHandler";
|
|
7
|
+
|
|
8
|
+
const ENDPOINT = "/v2/search/gov";
|
|
9
|
+
|
|
10
|
+
/** Search the Government Index. */
|
|
11
|
+
export async function govSearch(
|
|
12
|
+
http: HttpClient,
|
|
13
|
+
query: string,
|
|
14
|
+
options: GovSearchOptions = {},
|
|
15
|
+
): Promise<GovSearchResponse> {
|
|
16
|
+
if (!query || !query.trim()) throw new Error("query cannot be empty");
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const response = await http.post<GovSearchResponse>(ENDPOINT, {
|
|
20
|
+
query,
|
|
21
|
+
...(options.k !== undefined ? { k: options.k } : {}),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (response.status !== 200 || !response.data?.success) {
|
|
25
|
+
throwForBadResponse(response, "search the Government Index");
|
|
26
|
+
}
|
|
27
|
+
return response.data;
|
|
28
|
+
} catch (error: any) {
|
|
29
|
+
if (error?.isAxiosError) {
|
|
30
|
+
return normalizeAxiosError(error, "search the Government Index");
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/v2/types.ts
CHANGED
|
@@ -806,6 +806,16 @@ export interface DeveloperSearchResponse {
|
|
|
806
806
|
sources?: DeveloperSearchSourceStatus[];
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
+
export interface GovSearchOptions {
|
|
810
|
+
/** Total ranked results, 1–100 (default 10). */
|
|
811
|
+
k?: number;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
export interface GovSearchResponse {
|
|
815
|
+
success: boolean;
|
|
816
|
+
data: { web: SearchResultWeb[] };
|
|
817
|
+
}
|
|
818
|
+
|
|
809
819
|
export interface SearchResultWeb {
|
|
810
820
|
url: string;
|
|
811
821
|
title?: string;
|
|
@@ -973,6 +983,8 @@ export interface AlexandriaOptions {
|
|
|
973
983
|
* - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
|
|
974
984
|
* - `developer` — developer-index results (issues, pull requests, READMEs and
|
|
975
985
|
* documentation) served in `web`; cannot be combined with other categories.
|
|
986
|
+
* - `gov` — Government Index results served in `web`; cannot be combined
|
|
987
|
+
* with other categories.
|
|
976
988
|
*
|
|
977
989
|
* ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
|
|
978
990
|
* To search papers themselves — ~43M abstracts, roughly 90% biomedical
|
|
@@ -984,7 +996,7 @@ export interface AlexandriaOptions {
|
|
|
984
996
|
* happen to live on academic domains → `search({ categories: ["research"] })`.
|
|
985
997
|
*/
|
|
986
998
|
export interface CategoryOption {
|
|
987
|
-
type: "github" | "research" | "pdf" | "developer";
|
|
999
|
+
type: "github" | "research" | "pdf" | "developer" | "gov";
|
|
988
1000
|
}
|
|
989
1001
|
|
|
990
1002
|
export interface SearchRequest {
|
|
@@ -1006,7 +1018,7 @@ export interface SearchRequest {
|
|
|
1006
1018
|
* `firecrawl.research.searchPapers()` instead.
|
|
1007
1019
|
*/
|
|
1008
1020
|
categories?: Array<
|
|
1009
|
-
"github" | "research" | "pdf" | "developer" | CategoryOption
|
|
1021
|
+
"github" | "research" | "pdf" | "developer" | "gov" | CategoryOption
|
|
1010
1022
|
>;
|
|
1011
1023
|
includeDomains?: string[];
|
|
1012
1024
|
excludeDomains?: string[];
|