firecrawl 4.28.2 → 4.28.4

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.
@@ -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.2",
15
+ version: "4.28.4",
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.2",
42
+ version: "4.28.4",
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
@@ -431,6 +431,7 @@ interface DocumentMetadata {
431
431
  statusCode?: number;
432
432
  scrapeId?: string;
433
433
  numPages?: number;
434
+ totalPages?: number;
434
435
  contentType?: string;
435
436
  timezone?: string;
436
437
  proxyUsed?: "basic" | "stealth";
@@ -705,7 +706,16 @@ interface MonitorCrawlTarget {
705
706
  crawlOptions?: CrawlOptions;
706
707
  scrapeOptions?: ScrapeOptions;
707
708
  }
708
- type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget;
709
+ interface MonitorSearchTarget {
710
+ id?: string;
711
+ type: "search";
712
+ queries: string[];
713
+ searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
714
+ includeDomains?: string[];
715
+ excludeDomains?: string[];
716
+ maxResults?: number;
717
+ }
718
+ type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget | MonitorSearchTarget;
709
719
  interface CreateMonitorRequest {
710
720
  name: string;
711
721
  schedule: MonitorSchedule;
@@ -772,10 +782,34 @@ interface MonitorPageJudgment {
772
782
  reason: string;
773
783
  }>;
774
784
  }
785
+ interface MonitorScrapeTargetResult {
786
+ targetId: string;
787
+ type: "scrape";
788
+ expectedJobs?: string[];
789
+ }
790
+ interface MonitorCrawlTargetResult {
791
+ targetId: string;
792
+ type: "crawl";
793
+ crawlId?: string;
794
+ }
795
+ interface MonitorSearchTargetResult {
796
+ targetId: string;
797
+ type: "search";
798
+ searchCompleted?: boolean;
799
+ resultCount?: number;
800
+ matches?: number;
801
+ summary?: string;
802
+ judgeDegraded?: boolean;
803
+ degradedReason?: string | null;
804
+ searchCredits?: number;
805
+ judgeCredits?: number;
806
+ resultsJudged?: number;
807
+ }
808
+ type MonitorTargetResult = MonitorScrapeTargetResult | MonitorCrawlTargetResult | MonitorSearchTargetResult;
775
809
  interface MonitorCheck {
776
810
  id: string;
777
811
  monitorId: string;
778
- status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap";
812
+ status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap" | "skipped_no_credits";
779
813
  trigger: "scheduled" | "manual";
780
814
  scheduledFor?: string | null;
781
815
  startedAt?: string | null;
@@ -785,7 +819,7 @@ interface MonitorCheck {
785
819
  actualCredits?: number | null;
786
820
  billingStatus: "not_applicable" | "reserved" | "confirmed" | "released" | "failed";
787
821
  summary: MonitorSummary;
788
- targetResults?: unknown;
822
+ targetResults?: MonitorTargetResult[];
789
823
  notificationStatus?: unknown;
790
824
  error?: string | null;
791
825
  createdAt: string;
@@ -1209,6 +1243,7 @@ declare function prepareExtractPayload(args: {
1209
1243
  integration?: string;
1210
1244
  origin?: string;
1211
1245
  agent?: AgentOptions$1;
1246
+ webhook?: string | WebhookConfig | null;
1212
1247
  }): Record<string, unknown>;
1213
1248
  /**
1214
1249
  * @deprecated The extract endpoint is in maintenance mode and its use is discouraged.
@@ -2588,4 +2623,4 @@ declare class Firecrawl extends FirecrawlClient {
2588
2623
  get v1(): FirecrawlApp;
2589
2624
  }
2590
2625
 
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 };
2626
+ 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
@@ -431,6 +431,7 @@ interface DocumentMetadata {
431
431
  statusCode?: number;
432
432
  scrapeId?: string;
433
433
  numPages?: number;
434
+ totalPages?: number;
434
435
  contentType?: string;
435
436
  timezone?: string;
436
437
  proxyUsed?: "basic" | "stealth";
@@ -705,7 +706,16 @@ interface MonitorCrawlTarget {
705
706
  crawlOptions?: CrawlOptions;
706
707
  scrapeOptions?: ScrapeOptions;
707
708
  }
708
- type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget;
709
+ interface MonitorSearchTarget {
710
+ id?: string;
711
+ type: "search";
712
+ queries: string[];
713
+ searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
714
+ includeDomains?: string[];
715
+ excludeDomains?: string[];
716
+ maxResults?: number;
717
+ }
718
+ type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget | MonitorSearchTarget;
709
719
  interface CreateMonitorRequest {
710
720
  name: string;
711
721
  schedule: MonitorSchedule;
@@ -772,10 +782,34 @@ interface MonitorPageJudgment {
772
782
  reason: string;
773
783
  }>;
774
784
  }
785
+ interface MonitorScrapeTargetResult {
786
+ targetId: string;
787
+ type: "scrape";
788
+ expectedJobs?: string[];
789
+ }
790
+ interface MonitorCrawlTargetResult {
791
+ targetId: string;
792
+ type: "crawl";
793
+ crawlId?: string;
794
+ }
795
+ interface MonitorSearchTargetResult {
796
+ targetId: string;
797
+ type: "search";
798
+ searchCompleted?: boolean;
799
+ resultCount?: number;
800
+ matches?: number;
801
+ summary?: string;
802
+ judgeDegraded?: boolean;
803
+ degradedReason?: string | null;
804
+ searchCredits?: number;
805
+ judgeCredits?: number;
806
+ resultsJudged?: number;
807
+ }
808
+ type MonitorTargetResult = MonitorScrapeTargetResult | MonitorCrawlTargetResult | MonitorSearchTargetResult;
775
809
  interface MonitorCheck {
776
810
  id: string;
777
811
  monitorId: string;
778
- status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap";
812
+ status: "queued" | "running" | "completed" | "failed" | "partial" | "skipped_overlap" | "skipped_no_credits";
779
813
  trigger: "scheduled" | "manual";
780
814
  scheduledFor?: string | null;
781
815
  startedAt?: string | null;
@@ -785,7 +819,7 @@ interface MonitorCheck {
785
819
  actualCredits?: number | null;
786
820
  billingStatus: "not_applicable" | "reserved" | "confirmed" | "released" | "failed";
787
821
  summary: MonitorSummary;
788
- targetResults?: unknown;
822
+ targetResults?: MonitorTargetResult[];
789
823
  notificationStatus?: unknown;
790
824
  error?: string | null;
791
825
  createdAt: string;
@@ -1209,6 +1243,7 @@ declare function prepareExtractPayload(args: {
1209
1243
  integration?: string;
1210
1244
  origin?: string;
1211
1245
  agent?: AgentOptions$1;
1246
+ webhook?: string | WebhookConfig | null;
1212
1247
  }): Record<string, unknown>;
1213
1248
  /**
1214
1249
  * @deprecated The extract endpoint is in maintenance mode and its use is discouraged.
@@ -2588,4 +2623,4 @@ declare class Firecrawl extends FirecrawlClient {
2588
2623
  get v1(): FirecrawlApp;
2589
2624
  }
2590
2625
 
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 };
2626
+ 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-XZBMU524.js";
3
+ } from "./chunk-VRKVHB52.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-7QIHFAN4.js");
2304
+ const packageJson = await import("./package-EYT327NL.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);
@@ -1,4 +1,4 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-XZBMU524.js";
3
+ } from "./chunk-VRKVHB52.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "4.28.2",
3
+ "version": "4.28.4",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
@@ -570,6 +570,7 @@ export interface DocumentMetadata {
570
570
  statusCode?: number;
571
571
  scrapeId?: string;
572
572
  numPages?: number;
573
+ totalPages?: number;
573
574
  contentType?: string;
574
575
  timezone?: string;
575
576
  proxyUsed?: "basic" | "stealth";
@@ -878,7 +879,20 @@ export interface MonitorCrawlTarget {
878
879
  scrapeOptions?: ScrapeOptions;
879
880
  }
880
881
 
881
- export type MonitorTarget = MonitorScrapeTarget | MonitorCrawlTarget;
882
+ export interface MonitorSearchTarget {
883
+ id?: string;
884
+ type: "search";
885
+ queries: string[];
886
+ searchWindow?: "5m" | "15m" | "1h" | "6h" | "24h" | "7d";
887
+ includeDomains?: string[];
888
+ excludeDomains?: string[];
889
+ maxResults?: number;
890
+ }
891
+
892
+ export type MonitorTarget =
893
+ | MonitorScrapeTarget
894
+ | MonitorCrawlTarget
895
+ | MonitorSearchTarget;
882
896
 
883
897
  export interface CreateMonitorRequest {
884
898
  name: string;
@@ -951,6 +965,37 @@ export interface MonitorPageJudgment {
951
965
  }>;
952
966
  }
953
967
 
968
+ export interface MonitorScrapeTargetResult {
969
+ targetId: string;
970
+ type: "scrape";
971
+ expectedJobs?: string[];
972
+ }
973
+
974
+ export interface MonitorCrawlTargetResult {
975
+ targetId: string;
976
+ type: "crawl";
977
+ crawlId?: string;
978
+ }
979
+
980
+ export interface MonitorSearchTargetResult {
981
+ targetId: string;
982
+ type: "search";
983
+ searchCompleted?: boolean;
984
+ resultCount?: number;
985
+ matches?: number;
986
+ summary?: string;
987
+ judgeDegraded?: boolean;
988
+ degradedReason?: string | null;
989
+ searchCredits?: number;
990
+ judgeCredits?: number;
991
+ resultsJudged?: number;
992
+ }
993
+
994
+ export type MonitorTargetResult =
995
+ | MonitorScrapeTargetResult
996
+ | MonitorCrawlTargetResult
997
+ | MonitorSearchTargetResult;
998
+
954
999
  export interface MonitorCheck {
955
1000
  id: string;
956
1001
  monitorId: string;
@@ -960,7 +1005,8 @@ export interface MonitorCheck {
960
1005
  | "completed"
961
1006
  | "failed"
962
1007
  | "partial"
963
- | "skipped_overlap";
1008
+ | "skipped_overlap"
1009
+ | "skipped_no_credits";
964
1010
  trigger: "scheduled" | "manual";
965
1011
  scheduledFor?: string | null;
966
1012
  startedAt?: string | null;
@@ -975,7 +1021,7 @@ export interface MonitorCheck {
975
1021
  | "released"
976
1022
  | "failed";
977
1023
  summary: MonitorSummary;
978
- targetResults?: unknown;
1024
+ targetResults?: MonitorTargetResult[];
979
1025
  notificationStatus?: unknown;
980
1026
  error?: string | null;
981
1027
  createdAt: string;