firecrawl 4.23.0 → 4.24.1
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 +1 -1
- package/dist/{chunk-ZR3KTUEQ.js → chunk-F3RFBUTZ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +110 -59
- package/dist/index.d.ts +110 -59
- package/dist/index.js +2 -2
- package/dist/{package-APBHZ5F3.js → package-B3VSS5SY.js} +1 -1
- package/package.json +1 -1
- package/src/v2/types.ts +168 -108
package/src/v2/types.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { ZodTypeAny } from
|
|
1
|
+
import type { ZodTypeAny } from "zod";
|
|
2
2
|
// Public types for Firecrawl JS/TS SDK v2 (camelCase only)
|
|
3
3
|
|
|
4
4
|
export type FormatString =
|
|
5
|
-
|
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
5
|
+
| "markdown"
|
|
6
|
+
| "html"
|
|
7
|
+
| "rawHtml"
|
|
8
|
+
| "links"
|
|
9
|
+
| "images"
|
|
10
|
+
| "screenshot"
|
|
11
|
+
| "summary"
|
|
12
|
+
| "changeTracking"
|
|
13
|
+
| "json"
|
|
14
|
+
| "attributes"
|
|
15
|
+
| "branding"
|
|
16
|
+
| "audio"
|
|
17
|
+
| "video";
|
|
18
18
|
|
|
19
19
|
export interface Viewport {
|
|
20
20
|
width: number;
|
|
@@ -26,27 +26,32 @@ export interface Format {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface JsonFormat extends Format {
|
|
29
|
-
type:
|
|
29
|
+
type: "json";
|
|
30
30
|
prompt?: string;
|
|
31
31
|
schema?: Record<string, unknown> | ZodTypeAny;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface ScreenshotFormat {
|
|
35
|
-
type:
|
|
35
|
+
type: "screenshot";
|
|
36
36
|
fullPage?: boolean;
|
|
37
37
|
quality?: number;
|
|
38
38
|
viewport?: Viewport | { width: number; height: number };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface ChangeTrackingFormat extends Format {
|
|
42
|
-
type:
|
|
43
|
-
modes: (
|
|
44
|
-
|
|
42
|
+
type: "changeTracking";
|
|
43
|
+
modes: ("git-diff" | "json")[];
|
|
44
|
+
/**
|
|
45
|
+
* Either a JSON Schema object or a Zod schema. Zod schemas are
|
|
46
|
+
* auto-converted to JSON Schema by the SDK before being sent — see
|
|
47
|
+
* `utils/validation.ts`.
|
|
48
|
+
*/
|
|
49
|
+
schema?: Record<string, unknown> | ZodTypeAny;
|
|
45
50
|
prompt?: string;
|
|
46
51
|
tag?: string;
|
|
47
52
|
}
|
|
48
53
|
export interface AttributesFormat extends Format {
|
|
49
|
-
type:
|
|
54
|
+
type: "attributes";
|
|
50
55
|
selectors: Array<{
|
|
51
56
|
selector: string;
|
|
52
57
|
attribute: string;
|
|
@@ -54,20 +59,20 @@ export interface AttributesFormat extends Format {
|
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export interface QuestionFormat {
|
|
57
|
-
type:
|
|
62
|
+
type: "question";
|
|
58
63
|
question: string;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
export interface HighlightsFormat {
|
|
62
|
-
type:
|
|
67
|
+
type: "highlights";
|
|
63
68
|
query: string;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
/** @deprecated Use QuestionFormat or HighlightsFormat instead. */
|
|
67
72
|
export interface QueryFormat {
|
|
68
|
-
type:
|
|
73
|
+
type: "query";
|
|
69
74
|
prompt: string;
|
|
70
|
-
mode?:
|
|
75
|
+
mode?: "freeform" | "directQuote";
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
export type FormatOption =
|
|
@@ -83,7 +88,7 @@ export type FormatOption =
|
|
|
83
88
|
|
|
84
89
|
export type ParseFormatString = Exclude<
|
|
85
90
|
FormatString,
|
|
86
|
-
|
|
91
|
+
"screenshot" | "changeTracking" | "branding" | "audio" | "video"
|
|
87
92
|
>;
|
|
88
93
|
|
|
89
94
|
export interface ParseFormat {
|
|
@@ -105,62 +110,62 @@ export interface LocationConfig {
|
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
export interface WaitAction {
|
|
108
|
-
type:
|
|
113
|
+
type: "wait";
|
|
109
114
|
milliseconds?: number;
|
|
110
115
|
selector?: string;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
export interface ScreenshotAction {
|
|
114
|
-
type:
|
|
119
|
+
type: "screenshot";
|
|
115
120
|
fullPage?: boolean;
|
|
116
121
|
quality?: number;
|
|
117
122
|
viewport?: Viewport | { width: number; height: number };
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
export interface ClickAction {
|
|
121
|
-
type:
|
|
126
|
+
type: "click";
|
|
122
127
|
selector: string;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
export interface WriteAction {
|
|
126
|
-
type:
|
|
131
|
+
type: "write";
|
|
127
132
|
text: string;
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
export interface PressAction {
|
|
131
|
-
type:
|
|
136
|
+
type: "press";
|
|
132
137
|
key: string;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
export interface ScrollAction {
|
|
136
|
-
type:
|
|
137
|
-
direction:
|
|
141
|
+
type: "scroll";
|
|
142
|
+
direction: "up" | "down";
|
|
138
143
|
selector?: string;
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
export interface ScrapeAction {
|
|
142
|
-
type:
|
|
147
|
+
type: "scrape";
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
export interface ExecuteJavascriptAction {
|
|
146
|
-
type:
|
|
151
|
+
type: "executeJavascript";
|
|
147
152
|
script: string;
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
export interface PDFAction {
|
|
151
|
-
type:
|
|
156
|
+
type: "pdf";
|
|
152
157
|
format?:
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
158
|
+
| "A0"
|
|
159
|
+
| "A1"
|
|
160
|
+
| "A2"
|
|
161
|
+
| "A3"
|
|
162
|
+
| "A4"
|
|
163
|
+
| "A5"
|
|
164
|
+
| "A6"
|
|
165
|
+
| "Letter"
|
|
166
|
+
| "Legal"
|
|
167
|
+
| "Tabloid"
|
|
168
|
+
| "Ledger";
|
|
164
169
|
landscape?: boolean;
|
|
165
170
|
scale?: number;
|
|
166
171
|
}
|
|
@@ -185,7 +190,9 @@ export interface ScrapeOptions {
|
|
|
185
190
|
timeout?: number;
|
|
186
191
|
waitFor?: number;
|
|
187
192
|
mobile?: boolean;
|
|
188
|
-
parsers?: Array<
|
|
193
|
+
parsers?: Array<
|
|
194
|
+
string | { type: "pdf"; mode?: "fast" | "auto" | "ocr"; maxPages?: number }
|
|
195
|
+
>;
|
|
189
196
|
actions?: ActionOption[];
|
|
190
197
|
location?: LocationConfig;
|
|
191
198
|
skipTlsVerification?: boolean;
|
|
@@ -193,7 +200,7 @@ export interface ScrapeOptions {
|
|
|
193
200
|
fastMode?: boolean;
|
|
194
201
|
useMock?: string;
|
|
195
202
|
blockAds?: boolean;
|
|
196
|
-
proxy?:
|
|
203
|
+
proxy?: "basic" | "stealth" | "enhanced" | "auto" | string;
|
|
197
204
|
maxAge?: number;
|
|
198
205
|
minAge?: number;
|
|
199
206
|
storeInCache?: boolean;
|
|
@@ -222,30 +229,35 @@ export interface ParseFile {
|
|
|
222
229
|
|
|
223
230
|
export type ParseOptions = Omit<
|
|
224
231
|
ScrapeOptions,
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
232
|
+
| "formats"
|
|
233
|
+
| "waitFor"
|
|
234
|
+
| "mobile"
|
|
235
|
+
| "actions"
|
|
236
|
+
| "location"
|
|
237
|
+
| "maxAge"
|
|
238
|
+
| "minAge"
|
|
239
|
+
| "storeInCache"
|
|
240
|
+
| "lockdown"
|
|
241
|
+
| "proxy"
|
|
235
242
|
> & {
|
|
236
243
|
formats?: ParseFormatOption[];
|
|
237
|
-
proxy?:
|
|
244
|
+
proxy?: "basic" | "auto";
|
|
238
245
|
};
|
|
239
246
|
|
|
240
247
|
export interface WebhookConfig {
|
|
241
248
|
url: string;
|
|
242
249
|
headers?: Record<string, string>;
|
|
243
250
|
metadata?: Record<string, string>;
|
|
244
|
-
events?: Array<
|
|
251
|
+
events?: Array<"completed" | "failed" | "page" | "started">;
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
// Agent webhook events differ from crawl: has 'action' and 'cancelled', no 'page'
|
|
248
|
-
export type AgentWebhookEvent =
|
|
255
|
+
export type AgentWebhookEvent =
|
|
256
|
+
| "started"
|
|
257
|
+
| "action"
|
|
258
|
+
| "completed"
|
|
259
|
+
| "failed"
|
|
260
|
+
| "cancelled";
|
|
249
261
|
|
|
250
262
|
export interface AgentWebhookConfig {
|
|
251
263
|
url: string;
|
|
@@ -255,7 +267,7 @@ export interface AgentWebhookConfig {
|
|
|
255
267
|
}
|
|
256
268
|
|
|
257
269
|
export interface BrandingProfile {
|
|
258
|
-
colorScheme?:
|
|
270
|
+
colorScheme?: "light" | "dark";
|
|
259
271
|
logo?: string | null;
|
|
260
272
|
fonts?: Array<{
|
|
261
273
|
family: string;
|
|
@@ -377,13 +389,13 @@ export interface BrandingProfile {
|
|
|
377
389
|
};
|
|
378
390
|
personality?: {
|
|
379
391
|
tone:
|
|
380
|
-
|
|
|
381
|
-
|
|
|
382
|
-
|
|
|
383
|
-
|
|
|
384
|
-
|
|
|
385
|
-
|
|
|
386
|
-
energy:
|
|
392
|
+
| "professional"
|
|
393
|
+
| "playful"
|
|
394
|
+
| "modern"
|
|
395
|
+
| "traditional"
|
|
396
|
+
| "minimalist"
|
|
397
|
+
| "bold";
|
|
398
|
+
energy: "low" | "medium" | "high";
|
|
387
399
|
targetAudience: string;
|
|
388
400
|
};
|
|
389
401
|
[key: string]: unknown;
|
|
@@ -435,8 +447,8 @@ export interface DocumentMetadata {
|
|
|
435
447
|
numPages?: number;
|
|
436
448
|
contentType?: string;
|
|
437
449
|
timezone?: string;
|
|
438
|
-
proxyUsed?:
|
|
439
|
-
cacheState?:
|
|
450
|
+
proxyUsed?: "basic" | "stealth";
|
|
451
|
+
cacheState?: "hit" | "miss";
|
|
440
452
|
cachedAt?: string;
|
|
441
453
|
creditsUsed?: number;
|
|
442
454
|
concurrencyLimited?: boolean;
|
|
@@ -518,15 +530,15 @@ export interface SearchData {
|
|
|
518
530
|
}
|
|
519
531
|
|
|
520
532
|
export interface CategoryOption {
|
|
521
|
-
type:
|
|
533
|
+
type: "github" | "research" | "pdf";
|
|
522
534
|
}
|
|
523
535
|
|
|
524
536
|
export interface SearchRequest {
|
|
525
537
|
query: string;
|
|
526
538
|
sources?: Array<
|
|
527
|
-
|
|
539
|
+
"web" | "news" | "images" | { type: "web" | "news" | "images" }
|
|
528
540
|
>;
|
|
529
|
-
categories?: Array<
|
|
541
|
+
categories?: Array<"github" | "research" | "pdf" | CategoryOption>;
|
|
530
542
|
includeDomains?: string[];
|
|
531
543
|
excludeDomains?: string[];
|
|
532
544
|
limit?: number;
|
|
@@ -544,7 +556,7 @@ export interface CrawlOptions {
|
|
|
544
556
|
excludePaths?: string[] | null;
|
|
545
557
|
includePaths?: string[] | null;
|
|
546
558
|
maxDiscoveryDepth?: number | null;
|
|
547
|
-
sitemap?:
|
|
559
|
+
sitemap?: "skip" | "include" | "only";
|
|
548
560
|
ignoreQueryParameters?: boolean;
|
|
549
561
|
deduplicateSimilarURLs?: boolean;
|
|
550
562
|
limit?: number | null;
|
|
@@ -570,7 +582,7 @@ export interface CrawlResponse {
|
|
|
570
582
|
|
|
571
583
|
export interface CrawlJob {
|
|
572
584
|
id: string;
|
|
573
|
-
status:
|
|
585
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
574
586
|
total: number;
|
|
575
587
|
completed: number;
|
|
576
588
|
creditsUsed?: number;
|
|
@@ -599,7 +611,7 @@ export interface BatchScrapeResponse {
|
|
|
599
611
|
|
|
600
612
|
export interface BatchScrapeJob {
|
|
601
613
|
id: string;
|
|
602
|
-
status:
|
|
614
|
+
status: "scraping" | "completed" | "failed" | "cancelled";
|
|
603
615
|
completed: number;
|
|
604
616
|
total: number;
|
|
605
617
|
creditsUsed?: number;
|
|
@@ -614,7 +626,7 @@ export interface MapData {
|
|
|
614
626
|
|
|
615
627
|
export interface MapOptions {
|
|
616
628
|
search?: string;
|
|
617
|
-
sitemap?:
|
|
629
|
+
sitemap?: "only" | "include" | "skip";
|
|
618
630
|
includeSubdomains?: boolean;
|
|
619
631
|
ignoreQueryParameters?: boolean;
|
|
620
632
|
limit?: number;
|
|
@@ -624,8 +636,21 @@ export interface MapOptions {
|
|
|
624
636
|
location?: LocationConfig;
|
|
625
637
|
}
|
|
626
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Schedule for a monitor.
|
|
641
|
+
*
|
|
642
|
+
* On create/update, provide exactly one of `cron` or `text`:
|
|
643
|
+
* - `cron`: a 5-field cron expression (e.g. `"*\u002F30 * * * *"`).
|
|
644
|
+
* - `text`: a natural-language schedule (e.g. `"every 30 minutes"`,
|
|
645
|
+
* `"hourly"`, `"daily at 9:00"`). Firecrawl normalizes this to a cron
|
|
646
|
+
* expression server-side.
|
|
647
|
+
*
|
|
648
|
+
* On read, the API always returns the normalized `cron` value, so `cron`
|
|
649
|
+
* is populated in responses even when the monitor was created with `text`.
|
|
650
|
+
*/
|
|
627
651
|
export interface MonitorSchedule {
|
|
628
|
-
cron
|
|
652
|
+
cron?: string;
|
|
653
|
+
text?: string;
|
|
629
654
|
timezone?: string;
|
|
630
655
|
}
|
|
631
656
|
|
|
@@ -648,14 +673,14 @@ export interface MonitorWebhookConfig {
|
|
|
648
673
|
|
|
649
674
|
export interface MonitorScrapeTarget {
|
|
650
675
|
id?: string;
|
|
651
|
-
type:
|
|
676
|
+
type: "scrape";
|
|
652
677
|
urls: string[];
|
|
653
678
|
scrapeOptions?: ScrapeOptions;
|
|
654
679
|
}
|
|
655
680
|
|
|
656
681
|
export interface MonitorCrawlTarget {
|
|
657
682
|
id?: string;
|
|
658
|
-
type:
|
|
683
|
+
type: "crawl";
|
|
659
684
|
url: string;
|
|
660
685
|
crawlOptions?: CrawlOptions;
|
|
661
686
|
scrapeOptions?: ScrapeOptions;
|
|
@@ -674,7 +699,7 @@ export interface CreateMonitorRequest {
|
|
|
674
699
|
|
|
675
700
|
export interface UpdateMonitorRequest {
|
|
676
701
|
name?: string;
|
|
677
|
-
status?:
|
|
702
|
+
status?: "active" | "paused";
|
|
678
703
|
schedule?: MonitorSchedule;
|
|
679
704
|
webhook?: MonitorWebhookConfig | null;
|
|
680
705
|
notification?: MonitorNotification | null;
|
|
@@ -694,7 +719,7 @@ export interface MonitorSummary {
|
|
|
694
719
|
export interface Monitor {
|
|
695
720
|
id: string;
|
|
696
721
|
name: string;
|
|
697
|
-
status:
|
|
722
|
+
status: "active" | "paused" | "deleted";
|
|
698
723
|
schedule: MonitorSchedule;
|
|
699
724
|
nextRunAt?: string | null;
|
|
700
725
|
lastRunAt?: string | null;
|
|
@@ -713,13 +738,13 @@ export interface MonitorCheck {
|
|
|
713
738
|
id: string;
|
|
714
739
|
monitorId: string;
|
|
715
740
|
status:
|
|
716
|
-
|
|
|
717
|
-
|
|
|
718
|
-
|
|
|
719
|
-
|
|
|
720
|
-
|
|
|
721
|
-
|
|
|
722
|
-
trigger:
|
|
741
|
+
| "queued"
|
|
742
|
+
| "running"
|
|
743
|
+
| "completed"
|
|
744
|
+
| "failed"
|
|
745
|
+
| "partial"
|
|
746
|
+
| "skipped_overlap";
|
|
747
|
+
trigger: "scheduled" | "manual";
|
|
723
748
|
scheduledFor?: string | null;
|
|
724
749
|
startedAt?: string | null;
|
|
725
750
|
finishedAt?: string | null;
|
|
@@ -727,11 +752,11 @@ export interface MonitorCheck {
|
|
|
727
752
|
reservedCredits?: number | null;
|
|
728
753
|
actualCredits?: number | null;
|
|
729
754
|
billingStatus:
|
|
730
|
-
|
|
|
731
|
-
|
|
|
732
|
-
|
|
|
733
|
-
|
|
|
734
|
-
|
|
|
755
|
+
| "not_applicable"
|
|
756
|
+
| "reserved"
|
|
757
|
+
| "confirmed"
|
|
758
|
+
| "released"
|
|
759
|
+
| "failed";
|
|
735
760
|
summary: MonitorSummary;
|
|
736
761
|
targetResults?: unknown;
|
|
737
762
|
notificationStatus?: unknown;
|
|
@@ -740,17 +765,48 @@ export interface MonitorCheck {
|
|
|
740
765
|
updatedAt: string;
|
|
741
766
|
}
|
|
742
767
|
|
|
768
|
+
/** Per-field diff for monitors that requested JSON extraction. */
|
|
769
|
+
export interface MonitorJsonFieldDiff {
|
|
770
|
+
[field: string]: { previous: unknown; current: unknown };
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Diff payload returned alongside a monitor page when its scrape produced
|
|
775
|
+
* a change. The shape depends on what the monitor's formats asked for:
|
|
776
|
+
*
|
|
777
|
+
* - markdown-only monitors → `{ text, json }` where `json` is the
|
|
778
|
+
* `parseDiff` AST (a `{ files: [...] }` object).
|
|
779
|
+
* - JSON-extraction monitors → `{ json }` where `json` is the per-field
|
|
780
|
+
* `{ previous, current }` map.
|
|
781
|
+
* - Mixed (JSON + git-diff) monitors → both `text` (markdown sidecar)
|
|
782
|
+
* and `json` (field-level diff) are present.
|
|
783
|
+
*/
|
|
784
|
+
export interface MonitorPageDiff {
|
|
785
|
+
text?: string;
|
|
786
|
+
/** Markdown variants: parseDiff AST. JSON variants: per-field diff. */
|
|
787
|
+
json?: MonitorJsonFieldDiff | { files: unknown[] };
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Snapshot of the current JSON extraction at this run. Present on JSON
|
|
792
|
+
* and mixed-mode monitors; absent for markdown-only.
|
|
793
|
+
*/
|
|
794
|
+
export interface MonitorPageSnapshot {
|
|
795
|
+
json?: Record<string, unknown>;
|
|
796
|
+
}
|
|
797
|
+
|
|
743
798
|
export interface MonitorCheckPage {
|
|
744
799
|
id: string;
|
|
745
800
|
targetId: string;
|
|
746
801
|
url: string;
|
|
747
|
-
status:
|
|
802
|
+
status: "same" | "new" | "changed" | "removed" | "error";
|
|
748
803
|
previousScrapeId?: string | null;
|
|
749
804
|
currentScrapeId?: string | null;
|
|
750
805
|
statusCode?: number | null;
|
|
751
806
|
error?: string | null;
|
|
752
807
|
metadata?: unknown;
|
|
753
|
-
diff?:
|
|
808
|
+
diff?: MonitorPageDiff | null;
|
|
809
|
+
snapshot?: MonitorPageSnapshot | null;
|
|
754
810
|
createdAt: string;
|
|
755
811
|
}
|
|
756
812
|
|
|
@@ -775,7 +831,7 @@ export type GetMonitorCheckOptions = PaginationConfig & {
|
|
|
775
831
|
export interface ExtractResponse {
|
|
776
832
|
success?: boolean;
|
|
777
833
|
id?: string;
|
|
778
|
-
status?:
|
|
834
|
+
status?: "processing" | "completed" | "failed" | "cancelled";
|
|
779
835
|
data?: unknown;
|
|
780
836
|
error?: string;
|
|
781
837
|
warning?: string;
|
|
@@ -794,16 +850,16 @@ export interface AgentResponse {
|
|
|
794
850
|
|
|
795
851
|
export interface AgentStatusResponse {
|
|
796
852
|
success: boolean;
|
|
797
|
-
status:
|
|
853
|
+
status: "processing" | "completed" | "failed";
|
|
798
854
|
error?: string;
|
|
799
855
|
data?: unknown;
|
|
800
|
-
model?:
|
|
856
|
+
model?: "spark-1-pro" | "spark-1-mini";
|
|
801
857
|
expiresAt: string;
|
|
802
858
|
creditsUsed?: number;
|
|
803
859
|
}
|
|
804
860
|
|
|
805
861
|
export interface AgentOptions {
|
|
806
|
-
model:
|
|
862
|
+
model: "FIRE-1" | "v3-beta";
|
|
807
863
|
}
|
|
808
864
|
|
|
809
865
|
export interface ConcurrencyCheck {
|
|
@@ -889,10 +945,10 @@ export class SdkError extends Error {
|
|
|
889
945
|
status?: number,
|
|
890
946
|
code?: string,
|
|
891
947
|
details?: unknown,
|
|
892
|
-
jobId?: string
|
|
948
|
+
jobId?: string,
|
|
893
949
|
) {
|
|
894
950
|
super(message);
|
|
895
|
-
this.name =
|
|
951
|
+
this.name = "FirecrawlSdkError";
|
|
896
952
|
this.status = status;
|
|
897
953
|
this.code = code;
|
|
898
954
|
this.details = details;
|
|
@@ -902,16 +958,20 @@ export class SdkError extends Error {
|
|
|
902
958
|
|
|
903
959
|
export class JobTimeoutError extends SdkError {
|
|
904
960
|
timeoutSeconds: number;
|
|
905
|
-
constructor(
|
|
906
|
-
|
|
961
|
+
constructor(
|
|
962
|
+
jobId: string,
|
|
963
|
+
timeoutSeconds: number,
|
|
964
|
+
jobType: "batch" | "crawl" = "batch",
|
|
965
|
+
) {
|
|
966
|
+
const jobTypeLabel = jobType === "batch" ? "batch scrape" : "crawl";
|
|
907
967
|
super(
|
|
908
968
|
`${jobTypeLabel.charAt(0).toUpperCase() + jobTypeLabel.slice(1)} job ${jobId} did not complete within ${timeoutSeconds} seconds`,
|
|
909
969
|
undefined,
|
|
910
|
-
|
|
970
|
+
"JOB_TIMEOUT",
|
|
911
971
|
undefined,
|
|
912
|
-
jobId
|
|
972
|
+
jobId,
|
|
913
973
|
);
|
|
914
|
-
this.name =
|
|
974
|
+
this.name = "JobTimeoutError";
|
|
915
975
|
this.timeoutSeconds = timeoutSeconds;
|
|
916
976
|
}
|
|
917
977
|
}
|