@mendable/firecrawl-js 4.32.2 → 4.34.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.
@@ -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.32.2",
15
+ version: "4.34.0",
16
16
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
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.32.2",
42
+ version: "4.34.0",
43
43
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
44
44
  main: "dist/index.js",
45
45
  types: "dist/index.d.ts",
package/dist/index.d.cts CHANGED
@@ -117,6 +117,45 @@ type ActionOption = WaitAction | ScreenshotAction | ClickAction | WriteAction |
117
117
  interface AuditMetadata$1 {
118
118
  username: string;
119
119
  }
120
+ type PDFParser = {
121
+ type: "pdf";
122
+ mode?: "fast" | "auto" | "ocr";
123
+ maxPages?: number;
124
+ /** Include physical per-page markdown alongside document markdown. Populates `document.pages`. */
125
+ pages?: boolean;
126
+ /**
127
+ * @deprecated Renamed to `pages`. The API still accepts this as a silent alias.
128
+ */
129
+ pageMarkdown?: boolean;
130
+ /** Include per-page typed layout blocks (bounding boxes, block types, reading order). */
131
+ blocks?: boolean;
132
+ };
133
+ interface PdfPage {
134
+ pageNumber: number;
135
+ markdown: string;
136
+ }
137
+ interface PdfBlockConfidence {
138
+ layout: number | null;
139
+ ocr: number | null;
140
+ }
141
+ interface PdfBlockItem {
142
+ id: string;
143
+ type: string;
144
+ label: string | null;
145
+ bbox: [number, number, number, number] | null;
146
+ content: string;
147
+ markdownSpan: [number, number] | null;
148
+ readingOrder: number;
149
+ source: string | null;
150
+ confidence: PdfBlockConfidence;
151
+ }
152
+ interface PdfPageBlocks {
153
+ pageNumber: number;
154
+ width: number | null;
155
+ height: number | null;
156
+ status: string;
157
+ items: PdfBlockItem[];
158
+ }
120
159
  interface ScrapeOptions {
121
160
  formats?: FormatOption[];
122
161
  headers?: Record<string, string>;
@@ -126,11 +165,7 @@ interface ScrapeOptions {
126
165
  timeout?: number;
127
166
  waitFor?: number;
128
167
  mobile?: boolean;
129
- parsers?: Array<string | {
130
- type: "pdf";
131
- mode?: "fast" | "auto" | "ocr";
132
- maxPages?: number;
133
- }>;
168
+ parsers?: Array<string | PDFParser>;
134
169
  actions?: ActionOption[];
135
170
  location?: LocationConfig$1;
136
171
  skipTlsVerification?: boolean;
@@ -501,6 +536,10 @@ interface Document {
501
536
  branding?: BrandingProfile;
502
537
  product?: ProductProfile;
503
538
  menu?: MenuProfile;
539
+ /** Physical PDF pages, present only when `parsers[].pages` is true. */
540
+ pages?: PdfPage[];
541
+ /** Typed PDF layout blocks, present only when `parsers[].blocks` is true. */
542
+ blocks?: PdfPageBlocks[];
504
543
  }
505
544
  interface PaginationConfig {
506
545
  /** When true (default), automatically follow `next` links and aggregate all documents. */
@@ -2762,4 +2801,4 @@ declare class Firecrawl extends FirecrawlClient {
2762
2801
  get v1(): FirecrawlApp;
2763
2802
  }
2764
2803
 
2765
- export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
2804
+ export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 PDFParser, 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 PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, 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 ThreatProtectionOptions, 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
@@ -117,6 +117,45 @@ type ActionOption = WaitAction | ScreenshotAction | ClickAction | WriteAction |
117
117
  interface AuditMetadata$1 {
118
118
  username: string;
119
119
  }
120
+ type PDFParser = {
121
+ type: "pdf";
122
+ mode?: "fast" | "auto" | "ocr";
123
+ maxPages?: number;
124
+ /** Include physical per-page markdown alongside document markdown. Populates `document.pages`. */
125
+ pages?: boolean;
126
+ /**
127
+ * @deprecated Renamed to `pages`. The API still accepts this as a silent alias.
128
+ */
129
+ pageMarkdown?: boolean;
130
+ /** Include per-page typed layout blocks (bounding boxes, block types, reading order). */
131
+ blocks?: boolean;
132
+ };
133
+ interface PdfPage {
134
+ pageNumber: number;
135
+ markdown: string;
136
+ }
137
+ interface PdfBlockConfidence {
138
+ layout: number | null;
139
+ ocr: number | null;
140
+ }
141
+ interface PdfBlockItem {
142
+ id: string;
143
+ type: string;
144
+ label: string | null;
145
+ bbox: [number, number, number, number] | null;
146
+ content: string;
147
+ markdownSpan: [number, number] | null;
148
+ readingOrder: number;
149
+ source: string | null;
150
+ confidence: PdfBlockConfidence;
151
+ }
152
+ interface PdfPageBlocks {
153
+ pageNumber: number;
154
+ width: number | null;
155
+ height: number | null;
156
+ status: string;
157
+ items: PdfBlockItem[];
158
+ }
120
159
  interface ScrapeOptions {
121
160
  formats?: FormatOption[];
122
161
  headers?: Record<string, string>;
@@ -126,11 +165,7 @@ interface ScrapeOptions {
126
165
  timeout?: number;
127
166
  waitFor?: number;
128
167
  mobile?: boolean;
129
- parsers?: Array<string | {
130
- type: "pdf";
131
- mode?: "fast" | "auto" | "ocr";
132
- maxPages?: number;
133
- }>;
168
+ parsers?: Array<string | PDFParser>;
134
169
  actions?: ActionOption[];
135
170
  location?: LocationConfig$1;
136
171
  skipTlsVerification?: boolean;
@@ -501,6 +536,10 @@ interface Document {
501
536
  branding?: BrandingProfile;
502
537
  product?: ProductProfile;
503
538
  menu?: MenuProfile;
539
+ /** Physical PDF pages, present only when `parsers[].pages` is true. */
540
+ pages?: PdfPage[];
541
+ /** Typed PDF layout blocks, present only when `parsers[].blocks` is true. */
542
+ blocks?: PdfPageBlocks[];
504
543
  }
505
544
  interface PaginationConfig {
506
545
  /** When true (default), automatically follow `next` links and aggregate all documents. */
@@ -2762,4 +2801,4 @@ declare class Firecrawl extends FirecrawlClient {
2762
2801
  get v1(): FirecrawlApp;
2763
2802
  }
2764
2803
 
2765
- export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
2804
+ export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, 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 PDFParser, 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 PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, 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 ThreatProtectionOptions, 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-GWKNKKE4.js";
3
+ } from "./chunk-XLYNJU5P.js";
4
4
 
5
5
  // src/v2/utils/httpClient.ts
6
6
  import axios from "axios";
@@ -2342,7 +2342,7 @@ var FirecrawlApp = class {
2342
2342
  if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
2343
2343
  return process.env.npm_package_version;
2344
2344
  }
2345
- const packageJson = await import("./package-RCEGXLHV.js");
2345
+ const packageJson = await import("./package-SEAEKBOR.js");
2346
2346
  return packageJson.default.version;
2347
2347
  } catch (error) {
2348
2348
  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-GWKNKKE4.js";
3
+ } from "./chunk-XLYNJU5P.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "4.32.2",
3
+ "version": "4.34.0",
4
4
  "description": "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -89,6 +89,19 @@ describe("v2 utils: validation", () => {
89
89
  expect(options.parsers).toEqual(before);
90
90
  });
91
91
 
92
+ test("ensureValidScrapeOptions: leaves PDF parser pages and blocks options untouched", () => {
93
+ const options = {
94
+ parsers: [{ type: "pdf", mode: "auto", blocks: true, pages: true }],
95
+ } as any;
96
+ expect(() => ensureValidScrapeOptions(options)).not.toThrow();
97
+ expect(options.parsers[0]).toEqual({
98
+ type: "pdf",
99
+ mode: "auto",
100
+ blocks: true,
101
+ pages: true,
102
+ });
103
+ });
104
+
92
105
  test("ensureValidFormats: detects mistaken use of zod schema.shape", () => {
93
106
  const schema = z.object({ title: z.string(), count: z.number() });
94
107
  // User mistakenly passes schema.shape instead of schema
package/src/v2/types.ts CHANGED
@@ -187,6 +187,50 @@ export interface AuditMetadata {
187
187
  username: string;
188
188
  }
189
189
 
190
+ export type PDFParser = {
191
+ type: "pdf";
192
+ mode?: "fast" | "auto" | "ocr";
193
+ maxPages?: number;
194
+ /** Include physical per-page markdown alongside document markdown. Populates `document.pages`. */
195
+ pages?: boolean;
196
+ /**
197
+ * @deprecated Renamed to `pages`. The API still accepts this as a silent alias.
198
+ */
199
+ pageMarkdown?: boolean;
200
+ /** Include per-page typed layout blocks (bounding boxes, block types, reading order). */
201
+ blocks?: boolean;
202
+ };
203
+
204
+ export interface PdfPage {
205
+ pageNumber: number;
206
+ markdown: string;
207
+ }
208
+
209
+ export interface PdfBlockConfidence {
210
+ layout: number | null;
211
+ ocr: number | null;
212
+ }
213
+
214
+ export interface PdfBlockItem {
215
+ id: string;
216
+ type: string;
217
+ label: string | null;
218
+ bbox: [number, number, number, number] | null;
219
+ content: string;
220
+ markdownSpan: [number, number] | null;
221
+ readingOrder: number;
222
+ source: string | null;
223
+ confidence: PdfBlockConfidence;
224
+ }
225
+
226
+ export interface PdfPageBlocks {
227
+ pageNumber: number;
228
+ width: number | null;
229
+ height: number | null;
230
+ status: string;
231
+ items: PdfBlockItem[];
232
+ }
233
+
190
234
  export interface ScrapeOptions {
191
235
  formats?: FormatOption[];
192
236
  headers?: Record<string, string>;
@@ -196,9 +240,7 @@ export interface ScrapeOptions {
196
240
  timeout?: number;
197
241
  waitFor?: number;
198
242
  mobile?: boolean;
199
- parsers?: Array<
200
- string | { type: "pdf"; mode?: "fast" | "auto" | "ocr"; maxPages?: number }
201
- >;
243
+ parsers?: Array<string | PDFParser>;
202
244
  actions?: ActionOption[];
203
245
  location?: LocationConfig;
204
246
  skipTlsVerification?: boolean;
@@ -647,6 +689,10 @@ export interface Document {
647
689
  branding?: BrandingProfile;
648
690
  product?: ProductProfile;
649
691
  menu?: MenuProfile;
692
+ /** Physical PDF pages, present only when `parsers[].pages` is true. */
693
+ pages?: PdfPage[];
694
+ /** Typed PDF layout blocks, present only when `parsers[].blocks` is true. */
695
+ blocks?: PdfPageBlocks[];
650
696
  }
651
697
 
652
698
  // Pagination configuration for auto-fetching pages from v2 endpoints that return a `next` URL