mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 04:18:59 +08:00
fix(js-sdk/extract): fix zod type check with zod version discrepancy
This commit is contained in:
parent
4cc33e1e8d
commit
0154e40685
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mendable/firecrawl-js",
|
||||
"version": "1.19.0",
|
||||
"version": "1.19.1",
|
||||
"description": "JavaScript SDK for Firecrawl API",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -1130,15 +1130,14 @@ export default class FirecrawlApp {
|
||||
try {
|
||||
if (!params?.schema) {
|
||||
jsonSchema = undefined;
|
||||
} else if (params.schema instanceof zt.ZodType) {
|
||||
jsonSchema = zodToJsonSchema(params.schema);
|
||||
} else if (typeof params.schema === "object" && params.schema !== null && Object.getPrototypeOf(params.schema)?.constructor?.name?.startsWith("Zod")) {
|
||||
jsonSchema = zodToJsonSchema(params.schema as zt.ZodType);
|
||||
} else {
|
||||
jsonSchema = params.schema;
|
||||
}
|
||||
} catch (error: any) {
|
||||
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const response: AxiosResponse = await this.postRequest(
|
||||
|
Loading…
x
Reference in New Issue
Block a user