firecrawl 4.21.0 → 4.22.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/dist/{chunk-R625SBJY.js → chunk-XWPH5FOQ.js} +3 -3
- package/dist/index.cjs +184 -5
- package/dist/index.d.cts +155 -1
- package/dist/index.d.ts +155 -1
- package/dist/index.js +183 -4
- package/dist/{package-MRLSD24T.js → package-VALCXP74.js} +1 -1
- package/package.json +2 -2
- package/src/__tests__/unit/v2/pagination.test.ts +21 -0
- package/src/v2/client.ts +85 -0
- package/src/v2/methods/monitor.ts +181 -0
- package/src/v2/types.ts +149 -0
- package/src/v2/utils/httpClient.ts +14 -0
- package/src/v2/utils/pagination.ts +12 -9
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.
|
|
11
|
+
version: "4.22.0",
|
|
12
12
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
13
|
main: "dist/index.js",
|
|
14
14
|
types: "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@ var require_package = __commonJS({
|
|
|
34
34
|
author: "Mendable.ai",
|
|
35
35
|
license: "MIT",
|
|
36
36
|
dependencies: {
|
|
37
|
-
axios: "1.15.
|
|
37
|
+
axios: "1.15.2",
|
|
38
38
|
firecrawl: "4.16.0",
|
|
39
39
|
"typescript-event-target": "^1.1.1",
|
|
40
40
|
zod: "^3.23.8",
|
|
@@ -78,7 +78,7 @@ var require_package = __commonJS({
|
|
|
78
78
|
"picomatch@<4.0.4": ">=4.0.4",
|
|
79
79
|
handlebars: ">=4.7.9",
|
|
80
80
|
"brace-expansion": ">=5.0.5",
|
|
81
|
-
"axios@<1.15.
|
|
81
|
+
"axios@<1.15.2": "1.15.2",
|
|
82
82
|
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.
|
|
38
|
+
version: "4.22.0",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -61,7 +61,7 @@ var require_package = __commonJS({
|
|
|
61
61
|
author: "Mendable.ai",
|
|
62
62
|
license: "MIT",
|
|
63
63
|
dependencies: {
|
|
64
|
-
axios: "1.15.
|
|
64
|
+
axios: "1.15.2",
|
|
65
65
|
firecrawl: "4.16.0",
|
|
66
66
|
"typescript-event-target": "^1.1.1",
|
|
67
67
|
zod: "^3.23.8",
|
|
@@ -105,7 +105,7 @@ var require_package = __commonJS({
|
|
|
105
105
|
"picomatch@<4.0.4": ">=4.0.4",
|
|
106
106
|
handlebars: ">=4.7.9",
|
|
107
107
|
"brace-expansion": ">=5.0.5",
|
|
108
|
-
"axios@<1.15.
|
|
108
|
+
"axios@<1.15.2": "1.15.2",
|
|
109
109
|
"follow-redirects@<1.16.0": ">=1.16.0 <2.0.0"
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -237,6 +237,15 @@ var HttpClient = class {
|
|
|
237
237
|
delete(endpoint, headers) {
|
|
238
238
|
return this.request({ method: "delete", url: endpoint, headers });
|
|
239
239
|
}
|
|
240
|
+
patch(endpoint, body, options) {
|
|
241
|
+
return this.request({
|
|
242
|
+
method: "patch",
|
|
243
|
+
url: endpoint,
|
|
244
|
+
data: body,
|
|
245
|
+
headers: options?.headers,
|
|
246
|
+
timeout: options?.timeoutMs
|
|
247
|
+
});
|
|
248
|
+
}
|
|
240
249
|
prepareHeaders(idempotencyKey) {
|
|
241
250
|
const headers = {};
|
|
242
251
|
if (idempotencyKey) headers["x-idempotency-key"] = idempotencyKey;
|
|
@@ -759,12 +768,13 @@ async function fetchAllPages(http, nextUrl, initial, pagination) {
|
|
|
759
768
|
break;
|
|
760
769
|
}
|
|
761
770
|
if (!payload?.success) break;
|
|
762
|
-
|
|
771
|
+
const pageData = Array.isArray(payload.data) ? payload.data : payload.data?.pages || [];
|
|
772
|
+
for (const d of pageData) {
|
|
763
773
|
if (maxResults != null && docs.length >= maxResults) break;
|
|
764
774
|
docs.push(d);
|
|
765
775
|
}
|
|
766
776
|
if (maxResults != null && docs.length >= maxResults) break;
|
|
767
|
-
current = payload.next ?? null;
|
|
777
|
+
current = payload.next ?? (Array.isArray(payload.data) ? null : payload.data?.next) ?? null;
|
|
768
778
|
pageCount += 1;
|
|
769
779
|
}
|
|
770
780
|
return docs;
|
|
@@ -1347,6 +1357,126 @@ async function getTokenUsageHistorical(http, byApiKey) {
|
|
|
1347
1357
|
}
|
|
1348
1358
|
}
|
|
1349
1359
|
|
|
1360
|
+
// src/v2/methods/monitor.ts
|
|
1361
|
+
function queryString(params) {
|
|
1362
|
+
if (!params) return "";
|
|
1363
|
+
const query = new URLSearchParams();
|
|
1364
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1365
|
+
if (value !== void 0 && value !== null) query.set(key, String(value));
|
|
1366
|
+
}
|
|
1367
|
+
const str = query.toString();
|
|
1368
|
+
return str ? `?${str}` : "";
|
|
1369
|
+
}
|
|
1370
|
+
function dataOrThrow(res, action) {
|
|
1371
|
+
if (res.status !== 200 || !res.data?.success || res.data.data == null) {
|
|
1372
|
+
throwForBadResponse(res, action);
|
|
1373
|
+
}
|
|
1374
|
+
return res.data.data;
|
|
1375
|
+
}
|
|
1376
|
+
async function createMonitor(http, request) {
|
|
1377
|
+
try {
|
|
1378
|
+
const res = await http.post("/v2/monitor", request);
|
|
1379
|
+
return dataOrThrow(res, "create monitor");
|
|
1380
|
+
} catch (err) {
|
|
1381
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "create monitor");
|
|
1382
|
+
throw err;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
async function listMonitors(http, options) {
|
|
1386
|
+
try {
|
|
1387
|
+
const res = await http.get(
|
|
1388
|
+
`/v2/monitor${queryString(options)}`
|
|
1389
|
+
);
|
|
1390
|
+
return dataOrThrow(res, "list monitors");
|
|
1391
|
+
} catch (err) {
|
|
1392
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "list monitors");
|
|
1393
|
+
throw err;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
async function getMonitor(http, monitorId) {
|
|
1397
|
+
try {
|
|
1398
|
+
const res = await http.get(`/v2/monitor/${monitorId}`);
|
|
1399
|
+
return dataOrThrow(res, "get monitor");
|
|
1400
|
+
} catch (err) {
|
|
1401
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "get monitor");
|
|
1402
|
+
throw err;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
async function updateMonitor(http, monitorId, request) {
|
|
1406
|
+
try {
|
|
1407
|
+
const res = await http.patch(
|
|
1408
|
+
`/v2/monitor/${monitorId}`,
|
|
1409
|
+
request
|
|
1410
|
+
);
|
|
1411
|
+
return dataOrThrow(res, "update monitor");
|
|
1412
|
+
} catch (err) {
|
|
1413
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "update monitor");
|
|
1414
|
+
throw err;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
async function deleteMonitor(http, monitorId) {
|
|
1418
|
+
try {
|
|
1419
|
+
const res = await http.delete(`/v2/monitor/${monitorId}`);
|
|
1420
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
1421
|
+
throwForBadResponse(res, "delete monitor");
|
|
1422
|
+
}
|
|
1423
|
+
return true;
|
|
1424
|
+
} catch (err) {
|
|
1425
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "delete monitor");
|
|
1426
|
+
throw err;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
async function runMonitor(http, monitorId) {
|
|
1430
|
+
try {
|
|
1431
|
+
const res = await http.post(
|
|
1432
|
+
`/v2/monitor/${monitorId}/run`,
|
|
1433
|
+
{}
|
|
1434
|
+
);
|
|
1435
|
+
return dataOrThrow(res, "run monitor");
|
|
1436
|
+
} catch (err) {
|
|
1437
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "run monitor");
|
|
1438
|
+
throw err;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
async function listMonitorChecks(http, monitorId, options) {
|
|
1442
|
+
try {
|
|
1443
|
+
const res = await http.get(
|
|
1444
|
+
`/v2/monitor/${monitorId}/checks${queryString(options)}`
|
|
1445
|
+
);
|
|
1446
|
+
return dataOrThrow(res, "list monitor checks");
|
|
1447
|
+
} catch (err) {
|
|
1448
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "list monitor checks");
|
|
1449
|
+
throw err;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
async function getMonitorCheck(http, monitorId, checkId, options) {
|
|
1453
|
+
try {
|
|
1454
|
+
const { autoPaginate: _autoPaginate, maxPages: _maxPages, maxResults: _maxResults, maxWaitTime: _maxWaitTime, ...query } = options ?? {};
|
|
1455
|
+
const res = await http.get(
|
|
1456
|
+
`/v2/monitor/${monitorId}/checks/${checkId}${queryString(query)}`
|
|
1457
|
+
);
|
|
1458
|
+
const detail = dataOrThrow(res, "get monitor check");
|
|
1459
|
+
const next = res.data?.next ?? detail.next ?? null;
|
|
1460
|
+
const auto = options?.autoPaginate ?? true;
|
|
1461
|
+
if (!auto || !next) {
|
|
1462
|
+
return { ...detail, next };
|
|
1463
|
+
}
|
|
1464
|
+
return {
|
|
1465
|
+
...detail,
|
|
1466
|
+
pages: await fetchAllPages(
|
|
1467
|
+
http,
|
|
1468
|
+
next,
|
|
1469
|
+
detail.pages || [],
|
|
1470
|
+
options
|
|
1471
|
+
),
|
|
1472
|
+
next: null
|
|
1473
|
+
};
|
|
1474
|
+
} catch (err) {
|
|
1475
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "get monitor check");
|
|
1476
|
+
throw err;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1350
1480
|
// src/v2/watcher.ts
|
|
1351
1481
|
var import_events = require("events");
|
|
1352
1482
|
var hasGlobalWebSocket = () => {
|
|
@@ -1728,6 +1858,55 @@ var FirecrawlClient = class {
|
|
|
1728
1858
|
async crawlParamsPreview(url, prompt) {
|
|
1729
1859
|
return crawlParamsPreview(this.http, url, prompt);
|
|
1730
1860
|
}
|
|
1861
|
+
// Monitor
|
|
1862
|
+
/**
|
|
1863
|
+
* Create a scheduled monitor.
|
|
1864
|
+
*/
|
|
1865
|
+
async createMonitor(request) {
|
|
1866
|
+
return createMonitor(this.http, request);
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* List monitors for the authenticated team.
|
|
1870
|
+
*/
|
|
1871
|
+
async listMonitors(options) {
|
|
1872
|
+
return listMonitors(this.http, options);
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Get a monitor by id.
|
|
1876
|
+
*/
|
|
1877
|
+
async getMonitor(monitorId) {
|
|
1878
|
+
return getMonitor(this.http, monitorId);
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Update a monitor.
|
|
1882
|
+
*/
|
|
1883
|
+
async updateMonitor(monitorId, request) {
|
|
1884
|
+
return updateMonitor(this.http, monitorId, request);
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Delete a monitor.
|
|
1888
|
+
*/
|
|
1889
|
+
async deleteMonitor(monitorId) {
|
|
1890
|
+
return deleteMonitor(this.http, monitorId);
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Trigger a manual monitor check.
|
|
1894
|
+
*/
|
|
1895
|
+
async runMonitor(monitorId) {
|
|
1896
|
+
return runMonitor(this.http, monitorId);
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* List checks for a monitor.
|
|
1900
|
+
*/
|
|
1901
|
+
async listMonitorChecks(monitorId, options) {
|
|
1902
|
+
return listMonitorChecks(this.http, monitorId, options);
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Get a monitor check with paginated page results and inline diffs.
|
|
1906
|
+
*/
|
|
1907
|
+
async getMonitorCheck(monitorId, checkId, options) {
|
|
1908
|
+
return getMonitorCheck(this.http, monitorId, checkId, options);
|
|
1909
|
+
}
|
|
1731
1910
|
// Batch
|
|
1732
1911
|
/**
|
|
1733
1912
|
* Start a batch scrape job for multiple URLs (async).
|
package/dist/index.d.cts
CHANGED
|
@@ -43,6 +43,7 @@ interface AttributesFormat extends Format {
|
|
|
43
43
|
interface QueryFormat {
|
|
44
44
|
type: 'query';
|
|
45
45
|
prompt: string;
|
|
46
|
+
mode?: 'freeform' | 'directQuote';
|
|
46
47
|
}
|
|
47
48
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat | QueryFormat;
|
|
48
49
|
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding'>;
|
|
@@ -483,6 +484,126 @@ interface MapOptions {
|
|
|
483
484
|
origin?: string;
|
|
484
485
|
location?: LocationConfig$1;
|
|
485
486
|
}
|
|
487
|
+
interface MonitorSchedule {
|
|
488
|
+
cron: string;
|
|
489
|
+
timezone?: string;
|
|
490
|
+
}
|
|
491
|
+
interface MonitorEmailNotification {
|
|
492
|
+
enabled?: boolean;
|
|
493
|
+
recipients?: string[];
|
|
494
|
+
includeDiffs?: boolean;
|
|
495
|
+
}
|
|
496
|
+
interface MonitorNotification {
|
|
497
|
+
email?: MonitorEmailNotification;
|
|
498
|
+
}
|
|
499
|
+
interface MonitorWebhookConfig {
|
|
500
|
+
url: string;
|
|
501
|
+
headers?: Record<string, string>;
|
|
502
|
+
metadata?: Record<string, string>;
|
|
503
|
+
events?: string[];
|
|
504
|
+
}
|
|
505
|
+
interface MonitorScrapeTarget {
|
|
506
|
+
id?: string;
|
|
507
|
+
type: 'scrape';
|
|
508
|
+
urls: string[];
|
|
509
|
+
scrapeOptions?: ScrapeOptions;
|
|
510
|
+
}
|
|
511
|
+
interface MonitorCrawlTarget {
|
|
512
|
+
id?: string;
|
|
513
|
+
type: 'crawl';
|
|
514
|
+
url: string;
|
|
515
|
+
crawlOptions?: CrawlOptions;
|
|
516
|
+
scrapeOptions?: ScrapeOptions;
|
|
517
|
+
}
|
|
518
|
+
type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget;
|
|
519
|
+
interface CreateMonitorRequest {
|
|
520
|
+
name: string;
|
|
521
|
+
schedule: MonitorSchedule;
|
|
522
|
+
webhook?: MonitorWebhookConfig;
|
|
523
|
+
notification?: MonitorNotification;
|
|
524
|
+
targets: MonitorTarget[];
|
|
525
|
+
retentionDays?: number;
|
|
526
|
+
}
|
|
527
|
+
interface UpdateMonitorRequest {
|
|
528
|
+
name?: string;
|
|
529
|
+
status?: 'active' | 'paused';
|
|
530
|
+
schedule?: MonitorSchedule;
|
|
531
|
+
webhook?: MonitorWebhookConfig | null;
|
|
532
|
+
notification?: MonitorNotification | null;
|
|
533
|
+
targets?: MonitorTarget[];
|
|
534
|
+
retentionDays?: number;
|
|
535
|
+
}
|
|
536
|
+
interface MonitorSummary {
|
|
537
|
+
totalPages: number;
|
|
538
|
+
same: number;
|
|
539
|
+
changed: number;
|
|
540
|
+
new: number;
|
|
541
|
+
removed: number;
|
|
542
|
+
error: number;
|
|
543
|
+
}
|
|
544
|
+
interface Monitor {
|
|
545
|
+
id: string;
|
|
546
|
+
name: string;
|
|
547
|
+
status: 'active' | 'paused' | 'deleted';
|
|
548
|
+
schedule: MonitorSchedule;
|
|
549
|
+
nextRunAt?: string | null;
|
|
550
|
+
lastRunAt?: string | null;
|
|
551
|
+
currentCheckId?: string | null;
|
|
552
|
+
targets: MonitorTarget[];
|
|
553
|
+
webhook?: MonitorWebhookConfig | null;
|
|
554
|
+
notification?: MonitorNotification | null;
|
|
555
|
+
retentionDays: number;
|
|
556
|
+
estimatedCreditsPerMonth?: number | null;
|
|
557
|
+
lastCheckSummary?: MonitorSummary | null;
|
|
558
|
+
createdAt: string;
|
|
559
|
+
updatedAt: string;
|
|
560
|
+
}
|
|
561
|
+
interface MonitorCheck {
|
|
562
|
+
id: string;
|
|
563
|
+
monitorId: string;
|
|
564
|
+
status: 'queued' | 'running' | 'completed' | 'failed' | 'partial' | 'skipped_overlap';
|
|
565
|
+
trigger: 'scheduled' | 'manual';
|
|
566
|
+
scheduledFor?: string | null;
|
|
567
|
+
startedAt?: string | null;
|
|
568
|
+
finishedAt?: string | null;
|
|
569
|
+
estimatedCredits?: number | null;
|
|
570
|
+
reservedCredits?: number | null;
|
|
571
|
+
actualCredits?: number | null;
|
|
572
|
+
billingStatus: 'not_applicable' | 'reserved' | 'confirmed' | 'released' | 'failed';
|
|
573
|
+
summary: MonitorSummary;
|
|
574
|
+
targetResults?: unknown;
|
|
575
|
+
notificationStatus?: unknown;
|
|
576
|
+
error?: string | null;
|
|
577
|
+
createdAt: string;
|
|
578
|
+
updatedAt: string;
|
|
579
|
+
}
|
|
580
|
+
interface MonitorCheckPage {
|
|
581
|
+
id: string;
|
|
582
|
+
targetId: string;
|
|
583
|
+
url: string;
|
|
584
|
+
status: 'same' | 'new' | 'changed' | 'removed' | 'error';
|
|
585
|
+
previousScrapeId?: string | null;
|
|
586
|
+
currentScrapeId?: string | null;
|
|
587
|
+
statusCode?: number | null;
|
|
588
|
+
error?: string | null;
|
|
589
|
+
metadata?: unknown;
|
|
590
|
+
diff?: unknown;
|
|
591
|
+
createdAt: string;
|
|
592
|
+
}
|
|
593
|
+
interface MonitorCheckDetail extends MonitorCheck {
|
|
594
|
+
pages: MonitorCheckPage[];
|
|
595
|
+
next?: string | null;
|
|
596
|
+
}
|
|
597
|
+
interface ListMonitorsOptions {
|
|
598
|
+
limit?: number;
|
|
599
|
+
offset?: number;
|
|
600
|
+
}
|
|
601
|
+
type ListMonitorChecksOptions = ListMonitorsOptions;
|
|
602
|
+
type GetMonitorCheckOptions = PaginationConfig & {
|
|
603
|
+
limit?: number;
|
|
604
|
+
skip?: number;
|
|
605
|
+
status?: MonitorCheckPage["status"];
|
|
606
|
+
};
|
|
486
607
|
interface ExtractResponse$1 {
|
|
487
608
|
success?: boolean;
|
|
488
609
|
id?: string;
|
|
@@ -670,6 +791,7 @@ declare class HttpClient {
|
|
|
670
791
|
postMultipart<T = any>(endpoint: string, formData: FormData, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
671
792
|
get<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
672
793
|
delete<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
794
|
+
patch<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
673
795
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|
|
674
796
|
}
|
|
675
797
|
|
|
@@ -888,6 +1010,38 @@ declare class FirecrawlClient {
|
|
|
888
1010
|
* @param prompt Natural-language instruction.
|
|
889
1011
|
*/
|
|
890
1012
|
crawlParamsPreview(url: string, prompt: string): Promise<Record<string, unknown>>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Create a scheduled monitor.
|
|
1015
|
+
*/
|
|
1016
|
+
createMonitor(request: CreateMonitorRequest): Promise<Monitor>;
|
|
1017
|
+
/**
|
|
1018
|
+
* List monitors for the authenticated team.
|
|
1019
|
+
*/
|
|
1020
|
+
listMonitors(options?: ListMonitorsOptions): Promise<Monitor[]>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Get a monitor by id.
|
|
1023
|
+
*/
|
|
1024
|
+
getMonitor(monitorId: string): Promise<Monitor>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Update a monitor.
|
|
1027
|
+
*/
|
|
1028
|
+
updateMonitor(monitorId: string, request: UpdateMonitorRequest): Promise<Monitor>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Delete a monitor.
|
|
1031
|
+
*/
|
|
1032
|
+
deleteMonitor(monitorId: string): Promise<boolean>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Trigger a manual monitor check.
|
|
1035
|
+
*/
|
|
1036
|
+
runMonitor(monitorId: string): Promise<MonitorCheck>;
|
|
1037
|
+
/**
|
|
1038
|
+
* List checks for a monitor.
|
|
1039
|
+
*/
|
|
1040
|
+
listMonitorChecks(monitorId: string, options?: ListMonitorChecksOptions): Promise<MonitorCheck[]>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Get a monitor check with paginated page results and inline diffs.
|
|
1043
|
+
*/
|
|
1044
|
+
getMonitorCheck(monitorId: string, checkId: string, options?: GetMonitorCheckOptions): Promise<MonitorCheckDetail>;
|
|
891
1045
|
/**
|
|
892
1046
|
* Start a batch scrape job for multiple URLs (async).
|
|
893
1047
|
* @param urls URLs to scrape.
|
|
@@ -1927,4 +2081,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
1927
2081
|
get v1(): FirecrawlApp;
|
|
1928
2082
|
}
|
|
1929
2083
|
|
|
1930
|
-
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 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, JobTimeoutError, type JsonFormat, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type PressAction, type QueryFormat, 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 Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2084
|
+
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, 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 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.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ interface AttributesFormat extends Format {
|
|
|
43
43
|
interface QueryFormat {
|
|
44
44
|
type: 'query';
|
|
45
45
|
prompt: string;
|
|
46
|
+
mode?: 'freeform' | 'directQuote';
|
|
46
47
|
}
|
|
47
48
|
type FormatOption = FormatString | Format | JsonFormat | ChangeTrackingFormat | ScreenshotFormat | AttributesFormat | QueryFormat;
|
|
48
49
|
type ParseFormatString = Exclude<FormatString, 'screenshot' | 'changeTracking' | 'branding'>;
|
|
@@ -483,6 +484,126 @@ interface MapOptions {
|
|
|
483
484
|
origin?: string;
|
|
484
485
|
location?: LocationConfig$1;
|
|
485
486
|
}
|
|
487
|
+
interface MonitorSchedule {
|
|
488
|
+
cron: string;
|
|
489
|
+
timezone?: string;
|
|
490
|
+
}
|
|
491
|
+
interface MonitorEmailNotification {
|
|
492
|
+
enabled?: boolean;
|
|
493
|
+
recipients?: string[];
|
|
494
|
+
includeDiffs?: boolean;
|
|
495
|
+
}
|
|
496
|
+
interface MonitorNotification {
|
|
497
|
+
email?: MonitorEmailNotification;
|
|
498
|
+
}
|
|
499
|
+
interface MonitorWebhookConfig {
|
|
500
|
+
url: string;
|
|
501
|
+
headers?: Record<string, string>;
|
|
502
|
+
metadata?: Record<string, string>;
|
|
503
|
+
events?: string[];
|
|
504
|
+
}
|
|
505
|
+
interface MonitorScrapeTarget {
|
|
506
|
+
id?: string;
|
|
507
|
+
type: 'scrape';
|
|
508
|
+
urls: string[];
|
|
509
|
+
scrapeOptions?: ScrapeOptions;
|
|
510
|
+
}
|
|
511
|
+
interface MonitorCrawlTarget {
|
|
512
|
+
id?: string;
|
|
513
|
+
type: 'crawl';
|
|
514
|
+
url: string;
|
|
515
|
+
crawlOptions?: CrawlOptions;
|
|
516
|
+
scrapeOptions?: ScrapeOptions;
|
|
517
|
+
}
|
|
518
|
+
type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget;
|
|
519
|
+
interface CreateMonitorRequest {
|
|
520
|
+
name: string;
|
|
521
|
+
schedule: MonitorSchedule;
|
|
522
|
+
webhook?: MonitorWebhookConfig;
|
|
523
|
+
notification?: MonitorNotification;
|
|
524
|
+
targets: MonitorTarget[];
|
|
525
|
+
retentionDays?: number;
|
|
526
|
+
}
|
|
527
|
+
interface UpdateMonitorRequest {
|
|
528
|
+
name?: string;
|
|
529
|
+
status?: 'active' | 'paused';
|
|
530
|
+
schedule?: MonitorSchedule;
|
|
531
|
+
webhook?: MonitorWebhookConfig | null;
|
|
532
|
+
notification?: MonitorNotification | null;
|
|
533
|
+
targets?: MonitorTarget[];
|
|
534
|
+
retentionDays?: number;
|
|
535
|
+
}
|
|
536
|
+
interface MonitorSummary {
|
|
537
|
+
totalPages: number;
|
|
538
|
+
same: number;
|
|
539
|
+
changed: number;
|
|
540
|
+
new: number;
|
|
541
|
+
removed: number;
|
|
542
|
+
error: number;
|
|
543
|
+
}
|
|
544
|
+
interface Monitor {
|
|
545
|
+
id: string;
|
|
546
|
+
name: string;
|
|
547
|
+
status: 'active' | 'paused' | 'deleted';
|
|
548
|
+
schedule: MonitorSchedule;
|
|
549
|
+
nextRunAt?: string | null;
|
|
550
|
+
lastRunAt?: string | null;
|
|
551
|
+
currentCheckId?: string | null;
|
|
552
|
+
targets: MonitorTarget[];
|
|
553
|
+
webhook?: MonitorWebhookConfig | null;
|
|
554
|
+
notification?: MonitorNotification | null;
|
|
555
|
+
retentionDays: number;
|
|
556
|
+
estimatedCreditsPerMonth?: number | null;
|
|
557
|
+
lastCheckSummary?: MonitorSummary | null;
|
|
558
|
+
createdAt: string;
|
|
559
|
+
updatedAt: string;
|
|
560
|
+
}
|
|
561
|
+
interface MonitorCheck {
|
|
562
|
+
id: string;
|
|
563
|
+
monitorId: string;
|
|
564
|
+
status: 'queued' | 'running' | 'completed' | 'failed' | 'partial' | 'skipped_overlap';
|
|
565
|
+
trigger: 'scheduled' | 'manual';
|
|
566
|
+
scheduledFor?: string | null;
|
|
567
|
+
startedAt?: string | null;
|
|
568
|
+
finishedAt?: string | null;
|
|
569
|
+
estimatedCredits?: number | null;
|
|
570
|
+
reservedCredits?: number | null;
|
|
571
|
+
actualCredits?: number | null;
|
|
572
|
+
billingStatus: 'not_applicable' | 'reserved' | 'confirmed' | 'released' | 'failed';
|
|
573
|
+
summary: MonitorSummary;
|
|
574
|
+
targetResults?: unknown;
|
|
575
|
+
notificationStatus?: unknown;
|
|
576
|
+
error?: string | null;
|
|
577
|
+
createdAt: string;
|
|
578
|
+
updatedAt: string;
|
|
579
|
+
}
|
|
580
|
+
interface MonitorCheckPage {
|
|
581
|
+
id: string;
|
|
582
|
+
targetId: string;
|
|
583
|
+
url: string;
|
|
584
|
+
status: 'same' | 'new' | 'changed' | 'removed' | 'error';
|
|
585
|
+
previousScrapeId?: string | null;
|
|
586
|
+
currentScrapeId?: string | null;
|
|
587
|
+
statusCode?: number | null;
|
|
588
|
+
error?: string | null;
|
|
589
|
+
metadata?: unknown;
|
|
590
|
+
diff?: unknown;
|
|
591
|
+
createdAt: string;
|
|
592
|
+
}
|
|
593
|
+
interface MonitorCheckDetail extends MonitorCheck {
|
|
594
|
+
pages: MonitorCheckPage[];
|
|
595
|
+
next?: string | null;
|
|
596
|
+
}
|
|
597
|
+
interface ListMonitorsOptions {
|
|
598
|
+
limit?: number;
|
|
599
|
+
offset?: number;
|
|
600
|
+
}
|
|
601
|
+
type ListMonitorChecksOptions = ListMonitorsOptions;
|
|
602
|
+
type GetMonitorCheckOptions = PaginationConfig & {
|
|
603
|
+
limit?: number;
|
|
604
|
+
skip?: number;
|
|
605
|
+
status?: MonitorCheckPage["status"];
|
|
606
|
+
};
|
|
486
607
|
interface ExtractResponse$1 {
|
|
487
608
|
success?: boolean;
|
|
488
609
|
id?: string;
|
|
@@ -670,6 +791,7 @@ declare class HttpClient {
|
|
|
670
791
|
postMultipart<T = any>(endpoint: string, formData: FormData, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
671
792
|
get<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
672
793
|
delete<T = any>(endpoint: string, headers?: Record<string, string>): Promise<AxiosResponse<T, any, {}>>;
|
|
794
|
+
patch<T = any>(endpoint: string, body: Record<string, unknown>, options?: RequestOptions): Promise<AxiosResponse<T, any, {}>>;
|
|
673
795
|
prepareHeaders(idempotencyKey?: string): Record<string, string>;
|
|
674
796
|
}
|
|
675
797
|
|
|
@@ -888,6 +1010,38 @@ declare class FirecrawlClient {
|
|
|
888
1010
|
* @param prompt Natural-language instruction.
|
|
889
1011
|
*/
|
|
890
1012
|
crawlParamsPreview(url: string, prompt: string): Promise<Record<string, unknown>>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Create a scheduled monitor.
|
|
1015
|
+
*/
|
|
1016
|
+
createMonitor(request: CreateMonitorRequest): Promise<Monitor>;
|
|
1017
|
+
/**
|
|
1018
|
+
* List monitors for the authenticated team.
|
|
1019
|
+
*/
|
|
1020
|
+
listMonitors(options?: ListMonitorsOptions): Promise<Monitor[]>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Get a monitor by id.
|
|
1023
|
+
*/
|
|
1024
|
+
getMonitor(monitorId: string): Promise<Monitor>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Update a monitor.
|
|
1027
|
+
*/
|
|
1028
|
+
updateMonitor(monitorId: string, request: UpdateMonitorRequest): Promise<Monitor>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Delete a monitor.
|
|
1031
|
+
*/
|
|
1032
|
+
deleteMonitor(monitorId: string): Promise<boolean>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Trigger a manual monitor check.
|
|
1035
|
+
*/
|
|
1036
|
+
runMonitor(monitorId: string): Promise<MonitorCheck>;
|
|
1037
|
+
/**
|
|
1038
|
+
* List checks for a monitor.
|
|
1039
|
+
*/
|
|
1040
|
+
listMonitorChecks(monitorId: string, options?: ListMonitorChecksOptions): Promise<MonitorCheck[]>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Get a monitor check with paginated page results and inline diffs.
|
|
1043
|
+
*/
|
|
1044
|
+
getMonitorCheck(monitorId: string, checkId: string, options?: GetMonitorCheckOptions): Promise<MonitorCheckDetail>;
|
|
891
1045
|
/**
|
|
892
1046
|
* Start a batch scrape job for multiple URLs (async).
|
|
893
1047
|
* @param urls URLs to scrape.
|
|
@@ -1927,4 +2081,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
1927
2081
|
get v1(): FirecrawlApp;
|
|
1928
2082
|
}
|
|
1929
2083
|
|
|
1930
|
-
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 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, JobTimeoutError, type JsonFormat, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type PDFAction, type PaginationConfig, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type PressAction, type QueryFormat, 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 Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2084
|
+
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, 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 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 };
|