@mendable/firecrawl-js 1.18.0-beta.2 → 1.18.0-beta.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
@@ -870,13 +870,13 @@ var FirecrawlApp = class {
870
870
  if ("error" in researchStatus && !researchStatus.success) {
871
871
  return researchStatus;
872
872
  }
873
- if (researchStatus.status === "completed") {
873
+ if (researchStatus.status === "completed" && researchStatus.data) {
874
874
  return researchStatus;
875
875
  } else if (researchStatus.status === "failed") {
876
876
  throw new FirecrawlError(`Research job failed. Error: ${researchStatus.error}`, 500);
877
877
  }
878
878
  await new Promise((resolve) => setTimeout(resolve, 1e3));
879
- } while (researchStatus.status === "processing");
879
+ } while (researchStatus.status === "processing" || researchStatus.status === "completed");
880
880
  }
881
881
  throw new FirecrawlError(`Failed to start research. No job ID returned.`, 500);
882
882
  } catch (error) {
package/dist/index.js CHANGED
@@ -834,13 +834,13 @@ var FirecrawlApp = class {
834
834
  if ("error" in researchStatus && !researchStatus.success) {
835
835
  return researchStatus;
836
836
  }
837
- if (researchStatus.status === "completed") {
837
+ if (researchStatus.status === "completed" && researchStatus.data) {
838
838
  return researchStatus;
839
839
  } else if (researchStatus.status === "failed") {
840
840
  throw new FirecrawlError(`Research job failed. Error: ${researchStatus.error}`, 500);
841
841
  }
842
842
  await new Promise((resolve) => setTimeout(resolve, 1e3));
843
- } while (researchStatus.status === "processing");
843
+ } while (researchStatus.status === "processing" || researchStatus.status === "completed");
844
844
  }
845
845
  throw new FirecrawlError(`Failed to start research. No job ID returned.`, 500);
846
846
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "1.18.0-beta.2",
3
+ "version": "1.18.0-beta.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
@@ -1372,13 +1372,13 @@ export default class FirecrawlApp {
1372
1372
  return researchStatus;
1373
1373
  }
1374
1374
 
1375
- if (researchStatus.status === "completed") {
1375
+ if (researchStatus.status === "completed" && researchStatus.data) {
1376
1376
  return researchStatus;
1377
1377
  } else if (researchStatus.status === "failed") {
1378
1378
  throw new FirecrawlError(`Research job failed. Error: ${researchStatus.error}`, 500);
1379
1379
  }
1380
1380
  await new Promise(resolve => setTimeout(resolve, 1000)); // Polling interval
1381
- } while (researchStatus.status === "processing");
1381
+ } while (researchStatus.status === "processing" || researchStatus.status === "completed");
1382
1382
  }
1383
1383
  throw new FirecrawlError(`Failed to start research. No job ID returned.`, 500);
1384
1384
  } catch (error: any) {