mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 03:32:22 +08:00
Update types.ts
This commit is contained in:
parent
68b2e1b209
commit
877d5e4383
|
@ -109,6 +109,16 @@ export const scrapeOptions = z.object({
|
||||||
extract: extractOptions.optional(),
|
extract: extractOptions.optional(),
|
||||||
parsePDF: z.boolean().default(true),
|
parsePDF: z.boolean().default(true),
|
||||||
actions: actionsSchema.optional(),
|
actions: actionsSchema.optional(),
|
||||||
|
// New
|
||||||
|
location: z.object({
|
||||||
|
country: z.string().optional().refine(
|
||||||
|
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
||||||
|
{
|
||||||
|
message: "Invalid country code. Please use a valid ISO 3166-1 alpha-2 country code.",
|
||||||
|
}
|
||||||
|
).transform(val => val ? val.toUpperCase() : 'US')
|
||||||
|
}).optional(),
|
||||||
|
// Deprecated
|
||||||
geolocation: z.object({
|
geolocation: z.object({
|
||||||
country: z.string().optional().refine(
|
country: z.string().optional().refine(
|
||||||
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
||||||
|
@ -445,7 +455,7 @@ export function legacyScrapeOptions(x: ScrapeOptions): PageOptions {
|
||||||
fullPageScreenshot: x.formats.includes("screenshot@fullPage"),
|
fullPageScreenshot: x.formats.includes("screenshot@fullPage"),
|
||||||
parsePDF: x.parsePDF,
|
parsePDF: x.parsePDF,
|
||||||
actions: x.actions as Action[], // no strict null checking grrrr - mogery
|
actions: x.actions as Action[], // no strict null checking grrrr - mogery
|
||||||
geolocation: x.geolocation,
|
geolocation: x.location ?? x.geolocation,
|
||||||
skipTlsVerification: x.skipTlsVerification
|
skipTlsVerification: x.skipTlsVerification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user