Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(js-sdk/extract): use same zod fallback logic (#1711)

Gergő Móriczf4714f48491e
diff --git a/.github/workflows/test-server-self-host.yml b/.github/workflows/test-server-self-host.yml
index 76a786b3e..f404e928d 100644
--- a/.github/workflows/test-server-self-host.yml
+++ b/.github/workflows/test-server-self-host.yml
@@ -4,9 +4,6 @@ on:
pull_request:
branches:
- main
- paths:
- - apps/api/**
- - apps/playwright-service-ts/**
env:
PORT: 3002
diff --git a/.github/workflows/test-server.yml b/.github/workflows/test-server.yml
index 074d1ac79..8cba7ce51 100644
--- a/.github/workflows/test-server.yml
+++ b/.github/workflows/test-server.yml
@@ -4,10 +4,6 @@ on:
pull_request:
branches:
- main
- paths:
- - apps/api/**
- # schedule:
- # - cron: '0 */4 * * *'
env:
BULL_AUTH_KEY: ${{ secrets.BULL_AUTH_KEY }}
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json
index 79fd99f08..877b7e958 100644
--- a/apps/js-sdk/firecrawl/package.json
+++ b/apps/js-sdk/firecrawl/package.json
@@ -1,6 +1,6 @@
{
"name": "@mendable/firecrawl-js",
- "version": "1.26.0",
+ "version": "1.27.0",
"description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts
index 5ec70baaf..4c49b99a5 100644
--- a/apps/js-sdk/firecrawl/src/index.ts
+++ b/apps/js-sdk/firecrawl/src/index.ts
@@ -1244,10 +1244,12 @@ export default class FirecrawlApp {
try {
if (!params?.schema) {
jsonSchema = undefined;
- } 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;
+ try {
+ jsonSchema = zodToJsonSchema(params.schema as zt.ZodType);
+ } catch (_) {
+ jsonSchema = params.schema;
+ }
}
} catch (error: any) {
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);
@@ -1312,10 +1314,14 @@ export default class FirecrawlApp {
let jsonSchema: any;
try {
- if (params?.schema instanceof zt.ZodType) {
- jsonSchema = zodToJsonSchema(params.schema);
+ if (!params?.schema) {
+ jsonSchema = undefined;
} else {
- jsonSchema = params?.schema;
+ try {
+ jsonSchema = zodToJsonSchema(params.schema as zt.ZodType);
+ } catch (_) {
+ jsonSchema = params.schema;
+ }
}
} catch (error: any) {
throw new FirecrawlError("Invalid schema. Schema must be either a valid Zod schema or JSON schema object.", 400);