firecrawl 4.28.2 → 4.28.3
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-XZBMU524.js → chunk-LUZZZPH3.js} +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +38 -4
- package/dist/index.d.ts +38 -4
- package/dist/index.js +3 -2
- package/dist/{package-7QIHFAN4.js → package-GHWNEIJD.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/extract.unit.test.ts +47 -0
- package/src/__tests__/unit/v2/monitor-search-target.test.ts +40 -0
- package/src/v2/methods/extract.ts +3 -1
- package/src/v2/types.ts +48 -3
|
@@ -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.28.
|
|
15
|
+
version: "4.28.3",
|
|
16
16
|
description: "JavaScript SDK for Firecrawl API",
|
|
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.28.
|
|
42
|
+
version: "4.28.3",
|
|
43
43
|
description: "JavaScript SDK for Firecrawl API",
|
|
44
44
|
main: "dist/index.js",
|
|
45
45
|
types: "dist/index.d.ts",
|
|
@@ -1226,6 +1226,7 @@ function prepareExtractPayload(args) {
|
|
|
1226
1226
|
if (args.integration && args.integration.trim()) body.integration = args.integration.trim();
|
|
1227
1227
|
if (args.origin) body.origin = args.origin;
|
|
1228
1228
|
if (args.agent) body.agent = args.agent;
|
|
1229
|
+
if (args.webhook != null) body.webhook = args.webhook;
|
|
1229
1230
|
if (args.scrapeOptions) {
|
|
1230
1231
|
ensureValidScrapeOptions(args.scrapeOptions);
|
|
1231
1232
|
body.scrapeOptions = args.scrapeOptions;
|
package/dist/index.d.cts
CHANGED
|
@@ -705,7 +705,16 @@ interface MonitorCrawlTarget {
|
|
|
705
705
|
crawlOptions?: CrawlOptions;
|
|
706
706
|
scrapeOptions?: ScrapeOptions;
|
|
707
707
|
}
|
|
708
|
-
|
|
708
|
+
interface MonitorSearchTarget {
|
|
709
|
+
id?: string;
|
|
710
|
+
type: "search";
|
|
711
|
+
queries: string[];
|
|
712
|
+
searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
|
|
713
|
+
includeDomains?: string[];
|
|
714
|
+
excludeDomains?: string[];
|
|
715
|
+
maxResults?: number;
|
|
716
|
+
}
|
|
717
|
+
type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget | MonitorSearchTarget;
|
|
709
718
|
interface CreateMonitorRequest {
|
|
710
719
|
name: string;
|
|
711
720
|
schedule: MonitorSchedule;
|
|
@@ -772,10 +781,34 @@ interface MonitorPageJudgment {
|
|
|
772
781
|
reason: string;
|
|
773
782
|
}>;
|
|
774
783
|
}
|
|
784
|
+
interface MonitorScrapeTargetResult {
|
|
785
|
+
targetId: string;
|
|
786
|
+
type: "scrape";
|
|
787
|
+
expectedJobs?: string[];
|
|
788
|
+
}
|
|
789
|
+
interface MonitorCrawlTargetResult {
|
|
790
|
+
targetId: string;
|
|
791
|
+
type: "crawl";
|
|
792
|
+
crawlId?: string;
|
|
793
|
+
}
|
|
794
|
+
interface MonitorSearchTargetResult {
|
|
795
|
+
targetId: string;
|
|
796
|
+
type: "search";
|
|
797
|
+
searchCompleted?: boolean;
|
|
798
|
+
resultCount?: number;
|
|
799
|
+
matches?: number;
|
|
800
|
+
summary?: string;
|
|
801
|
+
judgeDegraded?: boolean;
|
|
802
|
+
degradedReason?: string | null;
|
|
803
|
+
searchCredits?: number;
|
|
804
|
+
judgeCredits?: number;
|
|
805
|
+
resultsJudged?: number;
|
|
806
|
+
}
|
|
807
|
+
type MonitorTargetResult = MonitorScrapeTargetResult | MonitorCrawlTargetResult | MonitorSearchTargetResult;
|
|
775
808
|
interface MonitorCheck {
|
|
776
809
|
id: string;
|
|
777
810
|
monitorId: string;
|
|
778
|
-
status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap";
|
|
811
|
+
status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap" | "skipped_no_credits";
|
|
779
812
|
trigger: "scheduled" | "manual";
|
|
780
813
|
scheduledFor?: string | null;
|
|
781
814
|
startedAt?: string | null;
|
|
@@ -785,7 +818,7 @@ interface MonitorCheck {
|
|
|
785
818
|
actualCredits?: number | null;
|
|
786
819
|
billingStatus: "not_applicable" | "reserved" | "confirmed" | "released" | "failed";
|
|
787
820
|
summary: MonitorSummary;
|
|
788
|
-
targetResults?:
|
|
821
|
+
targetResults?: MonitorTargetResult[];
|
|
789
822
|
notificationStatus?: unknown;
|
|
790
823
|
error?: string | null;
|
|
791
824
|
createdAt: string;
|
|
@@ -1209,6 +1242,7 @@ declare function prepareExtractPayload(args: {
|
|
|
1209
1242
|
integration?: string;
|
|
1210
1243
|
origin?: string;
|
|
1211
1244
|
agent?: AgentOptions$1;
|
|
1245
|
+
webhook?: string | WebhookConfig | null;
|
|
1212
1246
|
}): Record<string, unknown>;
|
|
1213
1247
|
/**
|
|
1214
1248
|
* @deprecated The extract endpoint is in maintenance mode and its use is discouraged.
|
|
@@ -2588,4 +2622,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2588
2622
|
get v1(): FirecrawlApp;
|
|
2589
2623
|
}
|
|
2590
2624
|
|
|
2591
|
-
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 EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type 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 MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type 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, 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 TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2625
|
+
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 EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type 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 PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type 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, 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 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
|
@@ -705,7 +705,16 @@ interface MonitorCrawlTarget {
|
|
|
705
705
|
crawlOptions?: CrawlOptions;
|
|
706
706
|
scrapeOptions?: ScrapeOptions;
|
|
707
707
|
}
|
|
708
|
-
|
|
708
|
+
interface MonitorSearchTarget {
|
|
709
|
+
id?: string;
|
|
710
|
+
type: "search";
|
|
711
|
+
queries: string[];
|
|
712
|
+
searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
|
|
713
|
+
includeDomains?: string[];
|
|
714
|
+
excludeDomains?: string[];
|
|
715
|
+
maxResults?: number;
|
|
716
|
+
}
|
|
717
|
+
type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget | MonitorSearchTarget;
|
|
709
718
|
interface CreateMonitorRequest {
|
|
710
719
|
name: string;
|
|
711
720
|
schedule: MonitorSchedule;
|
|
@@ -772,10 +781,34 @@ interface MonitorPageJudgment {
|
|
|
772
781
|
reason: string;
|
|
773
782
|
}>;
|
|
774
783
|
}
|
|
784
|
+
interface MonitorScrapeTargetResult {
|
|
785
|
+
targetId: string;
|
|
786
|
+
type: "scrape";
|
|
787
|
+
expectedJobs?: string[];
|
|
788
|
+
}
|
|
789
|
+
interface MonitorCrawlTargetResult {
|
|
790
|
+
targetId: string;
|
|
791
|
+
type: "crawl";
|
|
792
|
+
crawlId?: string;
|
|
793
|
+
}
|
|
794
|
+
interface MonitorSearchTargetResult {
|
|
795
|
+
targetId: string;
|
|
796
|
+
type: "search";
|
|
797
|
+
searchCompleted?: boolean;
|
|
798
|
+
resultCount?: number;
|
|
799
|
+
matches?: number;
|
|
800
|
+
summary?: string;
|
|
801
|
+
judgeDegraded?: boolean;
|
|
802
|
+
degradedReason?: string | null;
|
|
803
|
+
searchCredits?: number;
|
|
804
|
+
judgeCredits?: number;
|
|
805
|
+
resultsJudged?: number;
|
|
806
|
+
}
|
|
807
|
+
type MonitorTargetResult = MonitorScrapeTargetResult | MonitorCrawlTargetResult | MonitorSearchTargetResult;
|
|
775
808
|
interface MonitorCheck {
|
|
776
809
|
id: string;
|
|
777
810
|
monitorId: string;
|
|
778
|
-
status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap";
|
|
811
|
+
status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap" | "skipped_no_credits";
|
|
779
812
|
trigger: "scheduled" | "manual";
|
|
780
813
|
scheduledFor?: string | null;
|
|
781
814
|
startedAt?: string | null;
|
|
@@ -785,7 +818,7 @@ interface MonitorCheck {
|
|
|
785
818
|
actualCredits?: number | null;
|
|
786
819
|
billingStatus: "not_applicable" | "reserved" | "confirmed" | "released" | "failed";
|
|
787
820
|
summary: MonitorSummary;
|
|
788
|
-
targetResults?:
|
|
821
|
+
targetResults?: MonitorTargetResult[];
|
|
789
822
|
notificationStatus?: unknown;
|
|
790
823
|
error?: string | null;
|
|
791
824
|
createdAt: string;
|
|
@@ -1209,6 +1242,7 @@ declare function prepareExtractPayload(args: {
|
|
|
1209
1242
|
integration?: string;
|
|
1210
1243
|
origin?: string;
|
|
1211
1244
|
agent?: AgentOptions$1;
|
|
1245
|
+
webhook?: string | WebhookConfig | null;
|
|
1212
1246
|
}): Record<string, unknown>;
|
|
1213
1247
|
/**
|
|
1214
1248
|
* @deprecated The extract endpoint is in maintenance mode and its use is discouraged.
|
|
@@ -2588,4 +2622,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2588
2622
|
get v1(): FirecrawlApp;
|
|
2589
2623
|
}
|
|
2590
2624
|
|
|
2591
|
-
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 EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type 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 MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type 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, 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 TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2625
|
+
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 EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type 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 PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type 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, 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 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-LUZZZPH3.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -1094,6 +1094,7 @@ function prepareExtractPayload(args) {
|
|
|
1094
1094
|
if (args.integration && args.integration.trim()) body.integration = args.integration.trim();
|
|
1095
1095
|
if (args.origin) body.origin = args.origin;
|
|
1096
1096
|
if (args.agent) body.agent = args.agent;
|
|
1097
|
+
if (args.webhook != null) body.webhook = args.webhook;
|
|
1097
1098
|
if (args.scrapeOptions) {
|
|
1098
1099
|
ensureValidScrapeOptions(args.scrapeOptions);
|
|
1099
1100
|
body.scrapeOptions = args.scrapeOptions;
|
|
@@ -2300,7 +2301,7 @@ var FirecrawlApp = class {
|
|
|
2300
2301
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2301
2302
|
return process.env.npm_package_version;
|
|
2302
2303
|
}
|
|
2303
|
-
const packageJson = await import("./package-
|
|
2304
|
+
const packageJson = await import("./package-GHWNEIJD.js");
|
|
2304
2305
|
return packageJson.default.version;
|
|
2305
2306
|
} catch (error) {
|
|
2306
2307
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, expect, test } from "@jest/globals";
|
|
2
|
+
import { startExtract } from "../../../v2/methods/extract";
|
|
3
|
+
import type { WebhookConfig } from "../../../v2/types";
|
|
4
|
+
|
|
5
|
+
describe("v2.extract unit", () => {
|
|
6
|
+
test("startExtract forwards string webhook in request payload", async () => {
|
|
7
|
+
const post = jest.fn().mockResolvedValue({
|
|
8
|
+
status: 200,
|
|
9
|
+
data: { id: "extract-job" },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
await startExtract({ post } as any, {
|
|
13
|
+
urls: ["https://example.com"],
|
|
14
|
+
prompt: "Extract title",
|
|
15
|
+
webhook: "https://example.com/webhook",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
expect(post).toHaveBeenCalledWith("/v2/extract", {
|
|
19
|
+
urls: ["https://example.com"],
|
|
20
|
+
prompt: "Extract title",
|
|
21
|
+
webhook: "https://example.com/webhook",
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("startExtract forwards object webhook in request payload", async () => {
|
|
26
|
+
const post = jest.fn().mockResolvedValue({
|
|
27
|
+
status: 200,
|
|
28
|
+
data: { id: "extract-job" },
|
|
29
|
+
});
|
|
30
|
+
const webhook: WebhookConfig = {
|
|
31
|
+
url: "https://example.com/webhook",
|
|
32
|
+
headers: { "x-signature": "secret" },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
await startExtract({ post } as any, {
|
|
36
|
+
urls: ["https://example.com"],
|
|
37
|
+
prompt: "Extract title",
|
|
38
|
+
webhook,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(post).toHaveBeenCalledWith("/v2/extract", {
|
|
42
|
+
urls: ["https://example.com"],
|
|
43
|
+
prompt: "Extract title",
|
|
44
|
+
webhook,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit test: a search-target monitor request is forwarded intact to the API.
|
|
3
|
+
*/
|
|
4
|
+
import { createMonitor } from "../../../v2/methods/monitor";
|
|
5
|
+
import type { CreateMonitorRequest, MonitorSearchTarget } from "../../../v2/types";
|
|
6
|
+
|
|
7
|
+
describe("v2 monitor search target", () => {
|
|
8
|
+
test("createMonitor forwards a search target with its camelCase fields", async () => {
|
|
9
|
+
let captured: any;
|
|
10
|
+
const http: any = {
|
|
11
|
+
post: async (_path: string, body: any) => {
|
|
12
|
+
captured = body;
|
|
13
|
+
return { status: 200, data: { success: true, data: { id: "mon_1", ...body } } };
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const searchTarget: MonitorSearchTarget = {
|
|
18
|
+
type: "search",
|
|
19
|
+
queries: ["firecrawl launch"],
|
|
20
|
+
searchWindow: "24h",
|
|
21
|
+
includeDomains: ["firecrawl.dev"],
|
|
22
|
+
excludeDomains: ["spam.com"],
|
|
23
|
+
maxResults: 20,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const request: CreateMonitorRequest = {
|
|
27
|
+
name: "Search monitor",
|
|
28
|
+
schedule: { text: "every 30 minutes" },
|
|
29
|
+
goal: "Alert when Firecrawl launches a product",
|
|
30
|
+
targets: [searchTarget],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
await createMonitor(http, request);
|
|
34
|
+
|
|
35
|
+
expect(captured.targets[0]).toEqual(searchTarget);
|
|
36
|
+
expect(captured.targets[0].type).toBe("search");
|
|
37
|
+
expect(captured.targets[0].searchWindow).toBe("24h");
|
|
38
|
+
expect(captured.targets[0].maxResults).toBe(20);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExtractResponse, type ScrapeOptions, type AgentOptions } from "../types";
|
|
1
|
+
import { type ExtractResponse, type ScrapeOptions, type AgentOptions, type WebhookConfig } from "../types";
|
|
2
2
|
import { HttpClient } from "../utils/httpClient";
|
|
3
3
|
import { ensureValidScrapeOptions } from "../utils/validation";
|
|
4
4
|
import { normalizeAxiosError, throwForBadResponse } from "../utils/errorHandler";
|
|
@@ -18,6 +18,7 @@ function prepareExtractPayload(args: {
|
|
|
18
18
|
integration?: string;
|
|
19
19
|
origin?: string;
|
|
20
20
|
agent?: AgentOptions;
|
|
21
|
+
webhook?: string | WebhookConfig | null;
|
|
21
22
|
}): Record<string, unknown> {
|
|
22
23
|
const body: Record<string, unknown> = {};
|
|
23
24
|
if (args.urls) body.urls = args.urls;
|
|
@@ -33,6 +34,7 @@ function prepareExtractPayload(args: {
|
|
|
33
34
|
if (args.integration && args.integration.trim()) body.integration = args.integration.trim();
|
|
34
35
|
if (args.origin) body.origin = args.origin;
|
|
35
36
|
if (args.agent) body.agent = args.agent;
|
|
37
|
+
if (args.webhook != null) body.webhook = args.webhook;
|
|
36
38
|
if (args.scrapeOptions) {
|
|
37
39
|
ensureValidScrapeOptions(args.scrapeOptions);
|
|
38
40
|
body.scrapeOptions = args.scrapeOptions;
|
package/src/v2/types.ts
CHANGED
|
@@ -878,7 +878,20 @@ export interface MonitorCrawlTarget {
|
|
|
878
878
|
scrapeOptions?: ScrapeOptions;
|
|
879
879
|
}
|
|
880
880
|
|
|
881
|
-
export
|
|
881
|
+
export interface MonitorSearchTarget {
|
|
882
|
+
id?: string;
|
|
883
|
+
type: "search";
|
|
884
|
+
queries: string[];
|
|
885
|
+
searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
|
|
886
|
+
includeDomains?: string[];
|
|
887
|
+
excludeDomains?: string[];
|
|
888
|
+
maxResults?: number;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
export type MonitorTarget =
|
|
892
|
+
| MonitorScrapeTarget
|
|
893
|
+
| MonitorCrawlTarget
|
|
894
|
+
| MonitorSearchTarget;
|
|
882
895
|
|
|
883
896
|
export interface CreateMonitorRequest {
|
|
884
897
|
name: string;
|
|
@@ -951,6 +964,37 @@ export interface MonitorPageJudgment {
|
|
|
951
964
|
}>;
|
|
952
965
|
}
|
|
953
966
|
|
|
967
|
+
export interface MonitorScrapeTargetResult {
|
|
968
|
+
targetId: string;
|
|
969
|
+
type: "scrape";
|
|
970
|
+
expectedJobs?: string[];
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
export interface MonitorCrawlTargetResult {
|
|
974
|
+
targetId: string;
|
|
975
|
+
type: "crawl";
|
|
976
|
+
crawlId?: string;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
export interface MonitorSearchTargetResult {
|
|
980
|
+
targetId: string;
|
|
981
|
+
type: "search";
|
|
982
|
+
searchCompleted?: boolean;
|
|
983
|
+
resultCount?: number;
|
|
984
|
+
matches?: number;
|
|
985
|
+
summary?: string;
|
|
986
|
+
judgeDegraded?: boolean;
|
|
987
|
+
degradedReason?: string | null;
|
|
988
|
+
searchCredits?: number;
|
|
989
|
+
judgeCredits?: number;
|
|
990
|
+
resultsJudged?: number;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export type MonitorTargetResult =
|
|
994
|
+
| MonitorScrapeTargetResult
|
|
995
|
+
| MonitorCrawlTargetResult
|
|
996
|
+
| MonitorSearchTargetResult;
|
|
997
|
+
|
|
954
998
|
export interface MonitorCheck {
|
|
955
999
|
id: string;
|
|
956
1000
|
monitorId: string;
|
|
@@ -960,7 +1004,8 @@ export interface MonitorCheck {
|
|
|
960
1004
|
| "completed"
|
|
961
1005
|
| "failed"
|
|
962
1006
|
| "partial"
|
|
963
|
-
| "skipped_overlap"
|
|
1007
|
+
| "skipped_overlap"
|
|
1008
|
+
| "skipped_no_credits";
|
|
964
1009
|
trigger: "scheduled" | "manual";
|
|
965
1010
|
scheduledFor?: string | null;
|
|
966
1011
|
startedAt?: string | null;
|
|
@@ -975,7 +1020,7 @@ export interface MonitorCheck {
|
|
|
975
1020
|
| "released"
|
|
976
1021
|
| "failed";
|
|
977
1022
|
summary: MonitorSummary;
|
|
978
|
-
targetResults?:
|
|
1023
|
+
targetResults?: MonitorTargetResult[];
|
|
979
1024
|
notificationStatus?: unknown;
|
|
980
1025
|
error?: string | null;
|
|
981
1026
|
createdAt: string;
|