firecrawl 1.15.0 → 1.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -835,11 +835,13 @@ var FirecrawlApp = class {
835
835
  * @param {string} action - The action being performed when the error occurred.
836
836
  */
837
837
  handleError(response, action) {
838
- if ([402, 408, 409, 500].includes(response.status)) {
838
+ if ([400, 402, 408, 409, 500].includes(response.status)) {
839
839
  const errorMessage = response.data.error || "Unknown error occurred";
840
+ const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : "";
840
841
  throw new FirecrawlError(
841
- `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}`,
842
- response.status
842
+ `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
843
+ response.status,
844
+ response.data.details
843
845
  );
844
846
  } else {
845
847
  throw new FirecrawlError(
package/dist/index.d.cts CHANGED
@@ -61,6 +61,7 @@ interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | neve
61
61
  rawHtml?: string;
62
62
  links?: string[];
63
63
  extract?: T;
64
+ json?: T;
64
65
  screenshot?: string;
65
66
  metadata?: FirecrawlDocumentMetadata;
66
67
  actions: ActionsSchema;
@@ -119,7 +120,7 @@ interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema exten
119
120
  schema?: LLMSchema;
120
121
  systemPrompt?: string;
121
122
  };
122
- json?: {
123
+ jsonOptions?: {
123
124
  prompt?: string;
124
125
  schema?: LLMSchema;
125
126
  systemPrompt?: string;
package/dist/index.d.ts CHANGED
@@ -61,6 +61,7 @@ interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult | neve
61
61
  rawHtml?: string;
62
62
  links?: string[];
63
63
  extract?: T;
64
+ json?: T;
64
65
  screenshot?: string;
65
66
  metadata?: FirecrawlDocumentMetadata;
66
67
  actions: ActionsSchema;
@@ -119,7 +120,7 @@ interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema exten
119
120
  schema?: LLMSchema;
120
121
  systemPrompt?: string;
121
122
  };
122
- json?: {
123
+ jsonOptions?: {
123
124
  prompt?: string;
124
125
  schema?: LLMSchema;
125
126
  systemPrompt?: string;
package/dist/index.js CHANGED
@@ -799,11 +799,13 @@ var FirecrawlApp = class {
799
799
  * @param {string} action - The action being performed when the error occurred.
800
800
  */
801
801
  handleError(response, action) {
802
- if ([402, 408, 409, 500].includes(response.status)) {
802
+ if ([400, 402, 408, 409, 500].includes(response.status)) {
803
803
  const errorMessage = response.data.error || "Unknown error occurred";
804
+ const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : "";
804
805
  throw new FirecrawlError(
805
- `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}`,
806
- response.status
806
+ `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
807
+ response.status,
808
+ response.data.details
807
809
  );
808
810
  } else {
809
811
  throw new FirecrawlError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "1.15.0",
3
+ "version": "1.15.3",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ export interface FirecrawlDocument<T = any, ActionsSchema extends (ActionsResult
65
65
  rawHtml?: string;
66
66
  links?: string[];
67
67
  extract?: T;
68
+ json?: T;
68
69
  screenshot?: string;
69
70
  metadata?: FirecrawlDocumentMetadata;
70
71
  actions: ActionsSchema;
@@ -127,7 +128,7 @@ export interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchem
127
128
  schema?: LLMSchema;
128
129
  systemPrompt?: string;
129
130
  };
130
- json?:{
131
+ jsonOptions?:{
131
132
  prompt?: string;
132
133
  schema?: LLMSchema;
133
134
  systemPrompt?: string;
@@ -1254,12 +1255,14 @@ export default class FirecrawlApp {
1254
1255
  * @param {string} action - The action being performed when the error occurred.
1255
1256
  */
1256
1257
  handleError(response: AxiosResponse, action: string): void {
1257
- if ([402, 408, 409, 500].includes(response.status)) {
1258
+ if ([400, 402, 408, 409, 500].includes(response.status)) {
1258
1259
  const errorMessage: string =
1259
1260
  response.data.error || "Unknown error occurred";
1261
+ const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';
1260
1262
  throw new FirecrawlError(
1261
- `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}`,
1262
- response.status
1263
+ `Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
1264
+ response.status,
1265
+ response.data.details
1263
1266
  );
1264
1267
  } else {
1265
1268
  throw new FirecrawlError(