firecrawl 4.22.2 → 4.24.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 +14 -2
- package/dist/{chunk-HGRZHWZU.js → chunk-C6HAA76K.js} +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +92 -57
- package/dist/index.d.ts +92 -57
- package/dist/index.js +8 -2
- package/dist/{package-WSP46L7M.js → package-7NEHWGT6.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/parse.unit.test.ts +18 -0
- package/src/__tests__/unit/v2/validation.test.ts +5 -0
- package/src/v2/client.ts +1 -0
- package/src/v2/types.ts +149 -105
- package/src/v2/utils/validation.ts +6 -0
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 =
|
|
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;
|
|
@@ -13,12 +13,12 @@ interface Format {
|
|
|
13
13
|
type: FormatString;
|
|
14
14
|
}
|
|
15
15
|
interface JsonFormat extends Format {
|
|
16
|
-
type:
|
|
16
|
+
type: "json";
|
|
17
17
|
prompt?: string;
|
|
18
18
|
schema?: Record<string, unknown> | ZodTypeAny;
|
|
19
19
|
}
|
|
20
20
|
interface ScreenshotFormat {
|
|
21
|
-
type:
|
|
21
|
+
type: "screenshot";
|
|
22
22
|
fullPage?: boolean;
|
|
23
23
|
quality?: number;
|
|
24
24
|
viewport?: Viewport | {
|
|
@@ -27,35 +27,35 @@ interface ScreenshotFormat {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
interface ChangeTrackingFormat extends Format {
|
|
30
|
-
type:
|
|
31
|
-
modes: (
|
|
30
|
+
type: "changeTracking";
|
|
31
|
+
modes: ("git-diff" | "json")[];
|
|
32
32
|
schema?: Record<string, unknown>;
|
|
33
33
|
prompt?: string;
|
|
34
34
|
tag?: string;
|
|
35
35
|
}
|
|
36
36
|
interface AttributesFormat extends Format {
|
|
37
|
-
type:
|
|
37
|
+
type: "attributes";
|
|
38
38
|
selectors: Array<{
|
|
39
39
|
selector: string;
|
|
40
40
|
attribute: string;
|
|
41
41
|
}>;
|
|
42
42
|
}
|
|
43
43
|
interface QuestionFormat {
|
|
44
|
-
type:
|
|
44
|
+
type: "question";
|
|
45
45
|
question: string;
|
|
46
46
|
}
|
|
47
47
|
interface HighlightsFormat {
|
|
48
|
-
type:
|
|
48
|
+
type: "highlights";
|
|
49
49
|
query: string;
|
|
50
50
|
}
|
|
51
51
|
/** @deprecated Use QuestionFormat or HighlightsFormat instead. */
|
|
52
52
|
interface QueryFormat {
|
|
53
|
-
type:
|
|
53
|
+
type: "query";
|
|
54
54
|
prompt: string;
|
|
55
|
-
mode?:
|
|
55
|
+
mode?: "freeform" | "directQuote";
|
|
56
56
|
}
|
|
57
57
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat | QuestionFormat | HighlightsFormat | QueryFormat;
|
|
58
|
-
type ParseFormatString = Exclude<FormatString,
|
|
58
|
+
type ParseFormatString = Exclude<FormatString, "screenshot" | "changeTracking" | "branding" | "audio" | "video">;
|
|
59
59
|
interface ParseFormat {
|
|
60
60
|
type: ParseFormatString;
|
|
61
61
|
}
|
|
@@ -65,12 +65,12 @@ interface LocationConfig$1 {
|
|
|
65
65
|
languages?: string[];
|
|
66
66
|
}
|
|
67
67
|
interface WaitAction {
|
|
68
|
-
type:
|
|
68
|
+
type: "wait";
|
|
69
69
|
milliseconds?: number;
|
|
70
70
|
selector?: string;
|
|
71
71
|
}
|
|
72
72
|
interface ScreenshotAction {
|
|
73
|
-
type:
|
|
73
|
+
type: "screenshot";
|
|
74
74
|
fullPage?: boolean;
|
|
75
75
|
quality?: number;
|
|
76
76
|
viewport?: Viewport | {
|
|
@@ -79,32 +79,32 @@ interface ScreenshotAction {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
interface ClickAction {
|
|
82
|
-
type:
|
|
82
|
+
type: "click";
|
|
83
83
|
selector: string;
|
|
84
84
|
}
|
|
85
85
|
interface WriteAction {
|
|
86
|
-
type:
|
|
86
|
+
type: "write";
|
|
87
87
|
text: string;
|
|
88
88
|
}
|
|
89
89
|
interface PressAction {
|
|
90
|
-
type:
|
|
90
|
+
type: "press";
|
|
91
91
|
key: string;
|
|
92
92
|
}
|
|
93
93
|
interface ScrollAction {
|
|
94
|
-
type:
|
|
95
|
-
direction:
|
|
94
|
+
type: "scroll";
|
|
95
|
+
direction: "up" | "down";
|
|
96
96
|
selector?: string;
|
|
97
97
|
}
|
|
98
98
|
interface ScrapeAction {
|
|
99
|
-
type:
|
|
99
|
+
type: "scrape";
|
|
100
100
|
}
|
|
101
101
|
interface ExecuteJavascriptAction {
|
|
102
|
-
type:
|
|
102
|
+
type: "executeJavascript";
|
|
103
103
|
script: string;
|
|
104
104
|
}
|
|
105
105
|
interface PDFAction {
|
|
106
|
-
type:
|
|
107
|
-
format?:
|
|
106
|
+
type: "pdf";
|
|
107
|
+
format?: "A0" | "A1" | "A2" | "A3" | "A4" | "A5" | "A6" | "Letter" | "Legal" | "Tabloid" | "Ledger";
|
|
108
108
|
landscape?: boolean;
|
|
109
109
|
scale?: number;
|
|
110
110
|
}
|
|
@@ -119,8 +119,8 @@ interface ScrapeOptions {
|
|
|
119
119
|
waitFor?: number;
|
|
120
120
|
mobile?: boolean;
|
|
121
121
|
parsers?: Array<string | {
|
|
122
|
-
type:
|
|
123
|
-
mode?:
|
|
122
|
+
type: "pdf";
|
|
123
|
+
mode?: "fast" | "auto" | "ocr";
|
|
124
124
|
maxPages?: number;
|
|
125
125
|
}>;
|
|
126
126
|
actions?: ActionOption[];
|
|
@@ -130,7 +130,7 @@ interface ScrapeOptions {
|
|
|
130
130
|
fastMode?: boolean;
|
|
131
131
|
useMock?: string;
|
|
132
132
|
blockAds?: boolean;
|
|
133
|
-
proxy?:
|
|
133
|
+
proxy?: "basic" | "stealth" | "enhanced" | "auto" | string;
|
|
134
134
|
maxAge?: number;
|
|
135
135
|
minAge?: number;
|
|
136
136
|
storeInCache?: boolean;
|
|
@@ -148,17 +148,17 @@ interface ParseFile {
|
|
|
148
148
|
filename: string;
|
|
149
149
|
contentType?: string;
|
|
150
150
|
}
|
|
151
|
-
type ParseOptions = Omit<ScrapeOptions,
|
|
151
|
+
type ParseOptions = Omit<ScrapeOptions, "formats" | "waitFor" | "mobile" | "actions" | "location" | "maxAge" | "minAge" | "storeInCache" | "lockdown" | "proxy"> & {
|
|
152
152
|
formats?: ParseFormatOption[];
|
|
153
|
-
proxy?:
|
|
153
|
+
proxy?: "basic" | "auto";
|
|
154
154
|
};
|
|
155
155
|
interface WebhookConfig {
|
|
156
156
|
url: string;
|
|
157
157
|
headers?: Record<string, string>;
|
|
158
158
|
metadata?: Record<string, string>;
|
|
159
|
-
events?: Array<
|
|
159
|
+
events?: Array<"completed" | "failed" | "page" | "started">;
|
|
160
160
|
}
|
|
161
|
-
type AgentWebhookEvent =
|
|
161
|
+
type AgentWebhookEvent = "started" | "action" | "completed" | "failed" | "cancelled";
|
|
162
162
|
interface AgentWebhookConfig {
|
|
163
163
|
url: string;
|
|
164
164
|
headers?: Record<string, string>;
|
|
@@ -166,7 +166,7 @@ interface AgentWebhookConfig {
|
|
|
166
166
|
events?: AgentWebhookEvent[];
|
|
167
167
|
}
|
|
168
168
|
interface BrandingProfile {
|
|
169
|
-
colorScheme?:
|
|
169
|
+
colorScheme?: "light" | "dark";
|
|
170
170
|
logo?: string | null;
|
|
171
171
|
fonts?: Array<{
|
|
172
172
|
family: string;
|
|
@@ -283,8 +283,8 @@ interface BrandingProfile {
|
|
|
283
283
|
[key: string]: string | undefined;
|
|
284
284
|
};
|
|
285
285
|
personality?: {
|
|
286
|
-
tone:
|
|
287
|
-
energy:
|
|
286
|
+
tone: "professional" | "playful" | "modern" | "traditional" | "minimalist" | "bold";
|
|
287
|
+
energy: "low" | "medium" | "high";
|
|
288
288
|
targetAudience: string;
|
|
289
289
|
};
|
|
290
290
|
[key: string]: unknown;
|
|
@@ -327,8 +327,8 @@ interface DocumentMetadata {
|
|
|
327
327
|
numPages?: number;
|
|
328
328
|
contentType?: string;
|
|
329
329
|
timezone?: string;
|
|
330
|
-
proxyUsed?:
|
|
331
|
-
cacheState?:
|
|
330
|
+
proxyUsed?: "basic" | "stealth";
|
|
331
|
+
cacheState?: "hit" | "miss";
|
|
332
332
|
cachedAt?: string;
|
|
333
333
|
creditsUsed?: number;
|
|
334
334
|
concurrencyLimited?: boolean;
|
|
@@ -347,6 +347,7 @@ interface Document {
|
|
|
347
347
|
images?: string[];
|
|
348
348
|
screenshot?: string;
|
|
349
349
|
audio?: string;
|
|
350
|
+
video?: string;
|
|
350
351
|
attributes?: Array<{
|
|
351
352
|
selector: string;
|
|
352
353
|
attribute: string;
|
|
@@ -398,14 +399,14 @@ interface SearchData {
|
|
|
398
399
|
images?: Array<SearchResultImages | Document>;
|
|
399
400
|
}
|
|
400
401
|
interface CategoryOption {
|
|
401
|
-
type:
|
|
402
|
+
type: "github" | "research" | "pdf";
|
|
402
403
|
}
|
|
403
404
|
interface SearchRequest {
|
|
404
405
|
query: string;
|
|
405
|
-
sources?: Array<
|
|
406
|
-
type:
|
|
406
|
+
sources?: Array<"web" | "news" | "images" | {
|
|
407
|
+
type: "web" | "news" | "images";
|
|
407
408
|
}>;
|
|
408
|
-
categories?: Array<
|
|
409
|
+
categories?: Array<"github" | "research" | "pdf" | CategoryOption>;
|
|
409
410
|
includeDomains?: string[];
|
|
410
411
|
excludeDomains?: string[];
|
|
411
412
|
limit?: number;
|
|
@@ -422,7 +423,7 @@ interface CrawlOptions {
|
|
|
422
423
|
excludePaths?: string[] | null;
|
|
423
424
|
includePaths?: string[] | null;
|
|
424
425
|
maxDiscoveryDepth?: number | null;
|
|
425
|
-
sitemap?:
|
|
426
|
+
sitemap?: "skip" | "include" | "only";
|
|
426
427
|
ignoreQueryParameters?: boolean;
|
|
427
428
|
deduplicateSimilarURLs?: boolean;
|
|
428
429
|
limit?: number | null;
|
|
@@ -446,7 +447,7 @@ interface CrawlResponse$1 {
|
|
|
446
447
|
}
|
|
447
448
|
interface CrawlJob {
|
|
448
449
|
id: string;
|
|
449
|
-
status:
|
|
450
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
450
451
|
total: number;
|
|
451
452
|
completed: number;
|
|
452
453
|
creditsUsed?: number;
|
|
@@ -472,7 +473,7 @@ interface BatchScrapeResponse$1 {
|
|
|
472
473
|
}
|
|
473
474
|
interface BatchScrapeJob {
|
|
474
475
|
id: string;
|
|
475
|
-
status:
|
|
476
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
476
477
|
completed: number;
|
|
477
478
|
total: number;
|
|
478
479
|
creditsUsed?: number;
|
|
@@ -485,7 +486,7 @@ interface MapData {
|
|
|
485
486
|
}
|
|
486
487
|
interface MapOptions {
|
|
487
488
|
search?: string;
|
|
488
|
-
sitemap?:
|
|
489
|
+
sitemap?: "only" | "include" | "skip";
|
|
489
490
|
includeSubdomains?: boolean;
|
|
490
491
|
ignoreQueryParameters?: boolean;
|
|
491
492
|
limit?: number;
|
|
@@ -514,13 +515,13 @@ interface MonitorWebhookConfig {
|
|
|
514
515
|
}
|
|
515
516
|
interface MonitorScrapeTarget {
|
|
516
517
|
id?: string;
|
|
517
|
-
type:
|
|
518
|
+
type: "scrape";
|
|
518
519
|
urls: string[];
|
|
519
520
|
scrapeOptions?: ScrapeOptions;
|
|
520
521
|
}
|
|
521
522
|
interface MonitorCrawlTarget {
|
|
522
523
|
id?: string;
|
|
523
|
-
type:
|
|
524
|
+
type: "crawl";
|
|
524
525
|
url: string;
|
|
525
526
|
crawlOptions?: CrawlOptions;
|
|
526
527
|
scrapeOptions?: ScrapeOptions;
|
|
@@ -536,7 +537,7 @@ interface CreateMonitorRequest {
|
|
|
536
537
|
}
|
|
537
538
|
interface UpdateMonitorRequest {
|
|
538
539
|
name?: string;
|
|
539
|
-
status?:
|
|
540
|
+
status?: "active" | "paused";
|
|
540
541
|
schedule?: MonitorSchedule;
|
|
541
542
|
webhook?: MonitorWebhookConfig | null;
|
|
542
543
|
notification?: MonitorNotification | null;
|
|
@@ -554,7 +555,7 @@ interface MonitorSummary {
|
|
|
554
555
|
interface Monitor {
|
|
555
556
|
id: string;
|
|
556
557
|
name: string;
|
|
557
|
-
status:
|
|
558
|
+
status: "active" | "paused" | "deleted";
|
|
558
559
|
schedule: MonitorSchedule;
|
|
559
560
|
nextRunAt?: string | null;
|
|
560
561
|
lastRunAt?: string | null;
|
|
@@ -571,15 +572,15 @@ interface Monitor {
|
|
|
571
572
|
interface MonitorCheck {
|
|
572
573
|
id: string;
|
|
573
574
|
monitorId: string;
|
|
574
|
-
status:
|
|
575
|
-
trigger:
|
|
575
|
+
status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap";
|
|
576
|
+
trigger: "scheduled" | "manual";
|
|
576
577
|
scheduledFor?: string | null;
|
|
577
578
|
startedAt?: string | null;
|
|
578
579
|
finishedAt?: string | null;
|
|
579
580
|
estimatedCredits?: number | null;
|
|
580
581
|
reservedCredits?: number | null;
|
|
581
582
|
actualCredits?: number | null;
|
|
582
|
-
billingStatus:
|
|
583
|
+
billingStatus: "not_applicable" | "reserved" | "confirmed" | "released" | "failed";
|
|
583
584
|
summary: MonitorSummary;
|
|
584
585
|
targetResults?: unknown;
|
|
585
586
|
notificationStatus?: unknown;
|
|
@@ -587,17 +588,50 @@ interface MonitorCheck {
|
|
|
587
588
|
createdAt: string;
|
|
588
589
|
updatedAt: string;
|
|
589
590
|
}
|
|
591
|
+
/** Per-field diff for monitors that requested JSON extraction. */
|
|
592
|
+
interface MonitorJsonFieldDiff {
|
|
593
|
+
[field: string]: {
|
|
594
|
+
previous: unknown;
|
|
595
|
+
current: unknown;
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Diff payload returned alongside a monitor page when its scrape produced
|
|
600
|
+
* a change. The shape depends on what the monitor's formats asked for:
|
|
601
|
+
*
|
|
602
|
+
* - markdown-only monitors → `{ text, json }` where `json` is the
|
|
603
|
+
* `parseDiff` AST (a `{ files: [...] }` object).
|
|
604
|
+
* - JSON-extraction monitors → `{ json }` where `json` is the per-field
|
|
605
|
+
* `{ previous, current }` map.
|
|
606
|
+
* - Mixed (JSON + git-diff) monitors → both `text` (markdown sidecar)
|
|
607
|
+
* and `json` (field-level diff) are present.
|
|
608
|
+
*/
|
|
609
|
+
interface MonitorPageDiff {
|
|
610
|
+
text?: string;
|
|
611
|
+
/** Markdown variants: parseDiff AST. JSON variants: per-field diff. */
|
|
612
|
+
json?: MonitorJsonFieldDiff | {
|
|
613
|
+
files: unknown[];
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Snapshot of the current JSON extraction at this run. Present on JSON
|
|
618
|
+
* and mixed-mode monitors; absent for markdown-only.
|
|
619
|
+
*/
|
|
620
|
+
interface MonitorPageSnapshot {
|
|
621
|
+
json?: Record<string, unknown>;
|
|
622
|
+
}
|
|
590
623
|
interface MonitorCheckPage {
|
|
591
624
|
id: string;
|
|
592
625
|
targetId: string;
|
|
593
626
|
url: string;
|
|
594
|
-
status:
|
|
627
|
+
status: "same" | "new" | "changed" | "removed" | "error";
|
|
595
628
|
previousScrapeId?: string | null;
|
|
596
629
|
currentScrapeId?: string | null;
|
|
597
630
|
statusCode?: number | null;
|
|
598
631
|
error?: string | null;
|
|
599
632
|
metadata?: unknown;
|
|
600
|
-
diff?:
|
|
633
|
+
diff?: MonitorPageDiff | null;
|
|
634
|
+
snapshot?: MonitorPageSnapshot | null;
|
|
601
635
|
createdAt: string;
|
|
602
636
|
}
|
|
603
637
|
interface MonitorCheckDetail extends MonitorCheck {
|
|
@@ -617,7 +651,7 @@ type GetMonitorCheckOptions = PaginationConfig & {
|
|
|
617
651
|
interface ExtractResponse$1 {
|
|
618
652
|
success?: boolean;
|
|
619
653
|
id?: string;
|
|
620
|
-
status?:
|
|
654
|
+
status?: "processing" | "completed" | "failed" | "cancelled";
|
|
621
655
|
data?: unknown;
|
|
622
656
|
error?: string;
|
|
623
657
|
warning?: string;
|
|
@@ -634,15 +668,15 @@ interface AgentResponse {
|
|
|
634
668
|
}
|
|
635
669
|
interface AgentStatusResponse {
|
|
636
670
|
success: boolean;
|
|
637
|
-
status:
|
|
671
|
+
status: "processing" | "completed" | "failed";
|
|
638
672
|
error?: string;
|
|
639
673
|
data?: unknown;
|
|
640
|
-
model?:
|
|
674
|
+
model?: "spark-1-pro" | "spark-1-mini";
|
|
641
675
|
expiresAt: string;
|
|
642
676
|
creditsUsed?: number;
|
|
643
677
|
}
|
|
644
678
|
interface AgentOptions$1 {
|
|
645
|
-
model:
|
|
679
|
+
model: "FIRE-1" | "v3-beta";
|
|
646
680
|
}
|
|
647
681
|
interface ConcurrencyCheck {
|
|
648
682
|
concurrency: number;
|
|
@@ -715,7 +749,7 @@ declare class SdkError extends Error {
|
|
|
715
749
|
}
|
|
716
750
|
declare class JobTimeoutError extends SdkError {
|
|
717
751
|
timeoutSeconds: number;
|
|
718
|
-
constructor(jobId: string, timeoutSeconds: number, jobType?:
|
|
752
|
+
constructor(jobId: string, timeoutSeconds: number, jobType?: "batch" | "crawl");
|
|
719
753
|
}
|
|
720
754
|
interface QueueStatusResponse$1 {
|
|
721
755
|
success: boolean;
|
|
@@ -958,6 +992,7 @@ declare class FirecrawlClient {
|
|
|
958
992
|
* @param file File payload (data, filename, optional contentType).
|
|
959
993
|
* @param options Optional parse options (formats, parsers, etc.).
|
|
960
994
|
* Note: parse does not support changeTracking, screenshot, branding,
|
|
995
|
+
* audio, video,
|
|
961
996
|
* actions, waitFor, location, or mobile options.
|
|
962
997
|
* @returns Parsed document with requested formats.
|
|
963
998
|
*/
|
|
@@ -2109,4 +2144,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2109
2144
|
get v1(): FirecrawlApp;
|
|
2110
2145
|
}
|
|
2111
2146
|
|
|
2112
|
-
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 FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type HighlightsFormat, 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 MonitorNotification, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2147
|
+
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 FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type HighlightsFormat, 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 MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type 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-C6HAA76K.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -302,6 +302,9 @@ function ensureValidParseFormats(formats) {
|
|
|
302
302
|
if (fmt === "branding") {
|
|
303
303
|
throw new Error("parse does not support branding format");
|
|
304
304
|
}
|
|
305
|
+
if (fmt === "audio" || fmt === "video") {
|
|
306
|
+
throw new Error(`parse does not support ${fmt} format`);
|
|
307
|
+
}
|
|
305
308
|
continue;
|
|
306
309
|
}
|
|
307
310
|
const type = fmt.type;
|
|
@@ -314,6 +317,9 @@ function ensureValidParseFormats(formats) {
|
|
|
314
317
|
if (type === "branding") {
|
|
315
318
|
throw new Error("parse does not support branding format");
|
|
316
319
|
}
|
|
320
|
+
if (type === "audio" || type === "video") {
|
|
321
|
+
throw new Error(`parse does not support ${type} format`);
|
|
322
|
+
}
|
|
317
323
|
if (fmt.type === "json") {
|
|
318
324
|
const j = fmt;
|
|
319
325
|
if (!j.prompt && !j.schema) {
|
|
@@ -2036,7 +2042,7 @@ var FirecrawlApp = class {
|
|
|
2036
2042
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2037
2043
|
return process.env.npm_package_version;
|
|
2038
2044
|
}
|
|
2039
|
-
const packageJson = await import("./package-
|
|
2045
|
+
const packageJson = await import("./package-7NEHWGT6.js");
|
|
2040
2046
|
return packageJson.default.version;
|
|
2041
2047
|
} catch (error) {
|
|
2042
2048
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
|
@@ -38,6 +38,24 @@ describe("v2.parse unit", () => {
|
|
|
38
38
|
).rejects.toThrow("parse does not support changeTracking format");
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
test("rejects video format before making requests", async () => {
|
|
42
|
+
const client = new FirecrawlClient({
|
|
43
|
+
apiKey: "test-key",
|
|
44
|
+
apiUrl: "https://localhost:3002",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
await expect(
|
|
48
|
+
client.parse(
|
|
49
|
+
{
|
|
50
|
+
data: Buffer.from("<html></html>"),
|
|
51
|
+
filename: "upload.html",
|
|
52
|
+
contentType: "text/html",
|
|
53
|
+
},
|
|
54
|
+
{ formats: ["video" as any] },
|
|
55
|
+
),
|
|
56
|
+
).rejects.toThrow("parse does not support video format");
|
|
57
|
+
});
|
|
58
|
+
|
|
41
59
|
test("rejects lockdown option before making requests", async () => {
|
|
42
60
|
const client = new FirecrawlClient({
|
|
43
61
|
apiKey: "test-key",
|
|
@@ -9,6 +9,11 @@ describe("v2 utils: validation", () => {
|
|
|
9
9
|
expect(() => ensureValidFormats(formats)).toThrow(/json format must be an object/i);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
+
test("ensureValidFormats: accepts video string format", () => {
|
|
13
|
+
const formats: FormatOption[] = ["markdown", "video"];
|
|
14
|
+
expect(() => ensureValidFormats(formats)).not.toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
12
17
|
test("ensureValidFormats: json format requires prompt or schema", () => {
|
|
13
18
|
// Valid cases - should not throw
|
|
14
19
|
const valid1: FormatOption[] = [{ type: "json", prompt: "p" } as any];
|
package/src/v2/client.ts
CHANGED
|
@@ -204,6 +204,7 @@ export class FirecrawlClient {
|
|
|
204
204
|
* @param file File payload (data, filename, optional contentType).
|
|
205
205
|
* @param options Optional parse options (formats, parsers, etc.).
|
|
206
206
|
* Note: parse does not support changeTracking, screenshot, branding,
|
|
207
|
+
* audio, video,
|
|
207
208
|
* actions, waitFor, location, or mobile options.
|
|
208
209
|
* @returns Parsed document with requested formats.
|
|
209
210
|
*/
|