Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
[SDK] fixed none and undefined on response
rafaelmmillerbafcc008bc01
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.jsonindex 9aab848ae..46f853086 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.11.0",+ "version": "1.11.1","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.tsindex af9dbc756..6b89960ed 100644--- a/apps/js-sdk/firecrawl/src/index.ts+++ b/apps/js-sdk/firecrawl/src/index.ts@@ -571,17 +571,30 @@ export default class FirecrawlApp {allData = data;}}- return ({++ let resp: CrawlStatusResponse | ErrorResponse = {success: response.data.success,status: response.data.status,total: response.data.total,completed: response.data.completed,creditsUsed: response.data.creditsUsed,expiresAt: new Date(response.data.expiresAt),- next: response.data.next,- data: allData,- error: response.data.error,- })+ data: allData+ }++ if (!response.data.success && response.data.error) {+ resp = {+ ...resp,+ success: false,+ error: response.data.error+ } as ErrorResponse;+ }++ if (response.data.next) {+ (resp as CrawlStatusResponse).next = response.data.next;+ }++ return resp;} else {this.handleError(response, "check crawl status");}@@ -805,17 +818,30 @@ export default class FirecrawlApp {allData = data;}}- return ({++ let resp: BatchScrapeStatusResponse | ErrorResponse = {success: response.data.success,status: response.data.status,total: response.data.total,completed: response.data.completed,creditsUsed: response.data.creditsUsed,expiresAt: new Date(response.data.expiresAt),- next: response.data.next,- data: allData,- error: response.data.error,- })+ data: allData+ }++ if (!response.data.success && response.data.error) {+ resp = {+ ...resp,+ success: false,+ error: response.data.error+ } as ErrorResponse;+ }++ if (response.data.next) {+ (resp as BatchScrapeStatusResponse).next = response.data.next;+ }++ return resp;} else {this.handleError(response, "check batch scrape status");}diff --git a/apps/python-sdk/firecrawl/__init__.py b/apps/python-sdk/firecrawl/__init__.pyindex d4d246e9e..5528b3b2a 100644--- a/apps/python-sdk/firecrawl/__init__.py+++ b/apps/python-sdk/firecrawl/__init__.py@@ -13,7 +13,7 @@ import osfrom .firecrawl import FirecrawlApp # noqa-__version__ = "1.8.0"+__version__ = "1.8.1"# Define the logger for the Firecrawl projectlogger: logging.Logger = logging.getLogger("firecrawl")diff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.pyindex 271a13f06..8eb7acee9 100644--- a/apps/python-sdk/firecrawl/firecrawl.py+++ b/apps/python-sdk/firecrawl/firecrawl.py@@ -266,17 +266,25 @@ class FirecrawlApp:logger.error(f"Error during pagination request: {e}")breakstatus_data['data'] = data-- return {- 'success': True,++ response = {'status': status_data.get('status'),'total': status_data.get('total'),'completed': status_data.get('completed'),'creditsUsed': status_data.get('creditsUsed'),'expiresAt': status_data.get('expiresAt'),- 'data': status_data.get('data'),- 'error': status_data.get('error'),- 'next': status_data.get('next', None)+ 'data': status_data.get('data')+ }++ if 'error' in status_data:+ response['error'] = status_data['error']++ if 'next' in status_data:+ response['next'] = status_data['next']++ return {+ 'success': False if 'error' in status_data else True,+ **response}else:self._handle_error(response, 'check crawl status')@@ -476,16 +484,24 @@ class FirecrawlApp:breakstatus_data['data'] = data- return {- 'success': True,+ response = {'status': status_data.get('status'),'total': status_data.get('total'),'completed': status_data.get('completed'),'creditsUsed': status_data.get('creditsUsed'),'expiresAt': status_data.get('expiresAt'),- 'data': status_data.get('data'),- 'error': status_data.get('error'),- 'next': status_data.get('next', None)+ 'data': status_data.get('data')+ }++ if 'error' in status_data:+ response['error'] = status_data['error']++ if 'next' in status_data:+ response['next'] = status_data['next']++ return {+ 'success': False if 'error' in status_data else True,+ **response}else:self._handle_error(response, 'check batch scrape status')