mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 15:59:04 +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",
|
"name": "@mendable/firecrawl-js",
|
||||||
"version": "1.19.0",
|
"version": "1.19.1",
|
||||||
"description": "JavaScript SDK for Firecrawl API",
|
"description": "JavaScript SDK for Firecrawl API",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -1130,8 +1130,8 @@ export default class FirecrawlApp {
|
|||||||
try {
|
try {
|
||||||
if (!params?.schema) {
|
if (!params?.schema) {
|
||||||
jsonSchema = undefined;
|
jsonSchema = undefined;
|
||||||
} else if (params.schema instanceof zt.ZodType) {
|
} else if (typeof params.schema === "object" && params.schema !== null && Object.getPrototypeOf(params.schema)?.constructor?.name?.startsWith("Zod")) {
|
||||||
jsonSchema = zodToJsonSchema(params.schema);
|
jsonSchema = zodToJsonSchema(params.schema as zt.ZodType);
|
||||||
} else {
|
} else {
|
||||||
jsonSchema = params.schema;
|
jsonSchema = params.schema;
|
||||||
}
|
}
|
||||||
@ -1139,7 +1139,6 @@ export default class FirecrawlApp {
|
|||||||
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
|
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse = await this.postRequest(
|
const response: AxiosResponse = await this.postRequest(
|
||||||
this.apiUrl + `/v1/extract`,
|
this.apiUrl + `/v1/extract`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user