mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-13 06:59:01 +08:00
Update types.ts
This commit is contained in:
parent
9fdcfb9314
commit
dd14744850
@ -186,6 +186,10 @@ export const scrapeOptions = z
|
||||
|
||||
export type ScrapeOptions = z.infer<typeof scrapeOptions>;
|
||||
|
||||
import Ajv from "ajv";
|
||||
|
||||
const ajv = new Ajv();
|
||||
|
||||
export const extractV1Options = z
|
||||
.object({
|
||||
urls: url
|
||||
@ -193,7 +197,20 @@ export const extractV1Options = z
|
||||
.max(10, "Maximum of 10 URLs allowed per request while in beta."),
|
||||
prompt: z.string().optional(),
|
||||
systemPrompt: z.string().optional(),
|
||||
schema: z.any().optional(),
|
||||
schema: z
|
||||
.any()
|
||||
.optional()
|
||||
.refine((val) => {
|
||||
if (!val) return true; // Allow undefined schema
|
||||
try {
|
||||
const validate = ajv.compile(val);
|
||||
return typeof validate === "function";
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
message: "Invalid JSON schema.",
|
||||
}),
|
||||
limit: z.number().int().positive().finite().safe().optional(),
|
||||
ignoreSitemap: z.boolean().default(false),
|
||||
includeSubdomains: z.boolean().default(true),
|
||||
|
Loading…
x
Reference in New Issue
Block a user