@mendable/firecrawl-js 0.0.25 → 0.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "build/index.js",
6
6
  "types": "types/index.d.ts",
@@ -5,97 +5,97 @@ import dotenv from 'dotenv';
5
5
  dotenv.config();
6
6
 
7
7
  const TEST_API_KEY = process.env.TEST_API_KEY;
8
- const API_URL = process.env.API_URL;
8
+ const API_URL = "http://127.0.0.1:3002";
9
9
 
10
10
  describe('FirecrawlApp E2E Tests', () => {
11
- test('should throw error for no API key', () => {
11
+ test.concurrent('should throw error for no API key', () => {
12
12
  expect(() => {
13
13
  new FirecrawlApp({ apiKey: null, apiUrl: API_URL });
14
14
  }).toThrow("No API key provided");
15
15
  });
16
16
 
17
- test('should throw error for invalid API key on scrape', async () => {
17
+ test.concurrent('should throw error for invalid API key on scrape', async () => {
18
18
  const invalidApp = new FirecrawlApp({ apiKey: "invalid_api_key", apiUrl: API_URL });
19
- await expect(invalidApp.scrapeUrl('https://firecrawl.dev')).rejects.toThrow("Request failed with status code 401");
19
+ await expect(invalidApp.scrapeUrl('https://roastmywebsite.ai')).rejects.toThrow("Request failed with status code 401");
20
20
  });
21
21
 
22
- test('should throw error for blocklisted URL on scrape', async () => {
22
+ test.concurrent('should throw error for blocklisted URL on scrape', async () => {
23
23
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
24
24
  const blocklistedUrl = "https://facebook.com/fake-test";
25
25
  await expect(app.scrapeUrl(blocklistedUrl)).rejects.toThrow("Request failed with status code 403");
26
26
  });
27
27
 
28
- test('should return successful response with valid preview token', async () => {
28
+ test.concurrent('should return successful response with valid preview token', async () => {
29
29
  const app = new FirecrawlApp({ apiKey: "this_is_just_a_preview_token", apiUrl: API_URL });
30
- const response = await app.scrapeUrl('https://firecrawl.dev');
30
+ const response = await app.scrapeUrl('https://roastmywebsite.ai');
31
31
  expect(response).not.toBeNull();
32
- expect(response.data.content).toContain("🔥 Firecrawl");
32
+ expect(response.data.content).toContain("_Roast_");
33
33
  }, 30000); // 30 seconds timeout
34
34
 
35
- test('should return successful response for valid scrape', async () => {
35
+ test.concurrent('should return successful response for valid scrape', async () => {
36
36
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
37
- const response = await app.scrapeUrl('https://firecrawl.dev');
37
+ const response = await app.scrapeUrl('https://roastmywebsite.ai');
38
38
  expect(response).not.toBeNull();
39
- expect(response.data.content).toContain("🔥 Firecrawl");
39
+ expect(response.data.content).toContain("_Roast_");
40
40
  expect(response.data).toHaveProperty('markdown');
41
41
  expect(response.data).toHaveProperty('metadata');
42
42
  expect(response.data).not.toHaveProperty('html');
43
43
  }, 30000); // 30 seconds timeout
44
44
 
45
- test('should return successful response with valid API key and include HTML', async () => {
45
+ test.concurrent('should return successful response with valid API key and include HTML', async () => {
46
46
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
47
- const response = await app.scrapeUrl('https://firecrawl.dev', { pageOptions: { includeHtml: true } });
47
+ const response = await app.scrapeUrl('https://roastmywebsite.ai', { pageOptions: { includeHtml: true } });
48
48
  expect(response).not.toBeNull();
49
- expect(response.data.content).toContain("🔥 Firecrawl");
50
- expect(response.data.markdown).toContain("🔥 Firecrawl");
49
+ expect(response.data.content).toContain("_Roast_");
50
+ expect(response.data.markdown).toContain("_Roast_");
51
51
  expect(response.data.html).toContain("<h1");
52
52
  }, 30000); // 30 seconds timeout
53
53
 
54
- test('should return successful response for valid scrape with PDF file', async () => {
54
+ test.concurrent('should return successful response for valid scrape with PDF file', async () => {
55
55
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
56
56
  const response = await app.scrapeUrl('https://arxiv.org/pdf/astro-ph/9301001.pdf');
57
57
  expect(response).not.toBeNull();
58
58
  expect(response.data.content).toContain('We present spectrophotometric observations of the Broad Line Radio Galaxy');
59
59
  }, 30000); // 30 seconds timeout
60
60
 
61
- test('should return successful response for valid scrape with PDF file without explicit extension', async () => {
61
+ test.concurrent('should return successful response for valid scrape with PDF file without explicit extension', async () => {
62
62
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
63
63
  const response = await app.scrapeUrl('https://arxiv.org/pdf/astro-ph/9301001');
64
64
  expect(response).not.toBeNull();
65
65
  expect(response.data.content).toContain('We present spectrophotometric observations of the Broad Line Radio Galaxy');
66
66
  }, 30000); // 30 seconds timeout
67
67
 
68
- test('should throw error for invalid API key on crawl', async () => {
68
+ test.concurrent('should throw error for invalid API key on crawl', async () => {
69
69
  const invalidApp = new FirecrawlApp({ apiKey: "invalid_api_key", apiUrl: API_URL });
70
- await expect(invalidApp.crawlUrl('https://firecrawl.dev')).rejects.toThrow("Request failed with status code 401");
70
+ await expect(invalidApp.crawlUrl('https://roastmywebsite.ai')).rejects.toThrow("Request failed with status code 401");
71
71
  });
72
72
 
73
- test('should throw error for blocklisted URL on crawl', async () => {
73
+ test.concurrent('should throw error for blocklisted URL on crawl', async () => {
74
74
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
75
75
  const blocklistedUrl = "https://twitter.com/fake-test";
76
76
  await expect(app.crawlUrl(blocklistedUrl)).rejects.toThrow("Request failed with status code 403");
77
77
  });
78
78
 
79
- test('should return successful response for crawl and wait for completion', async () => {
79
+ test.concurrent('should return successful response for crawl and wait for completion', async () => {
80
80
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
81
- const response = await app.crawlUrl('https://firecrawl.dev', { crawlerOptions: { excludes: ['blog/*'] } }, true, 30);
81
+ const response = await app.crawlUrl('https://roastmywebsite.ai', { crawlerOptions: { excludes: ['blog/*'] } }, true, 30);
82
82
  expect(response).not.toBeNull();
83
- expect(response[0].content).toContain("🔥 Firecrawl");
83
+ expect(response[0].content).toContain("_Roast_");
84
84
  }, 60000); // 60 seconds timeout
85
85
 
86
- test('should handle idempotency key for crawl', async () => {
86
+ test.concurrent('should handle idempotency key for crawl', async () => {
87
87
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
88
88
  const uniqueIdempotencyKey = uuidv4();
89
- const response = await app.crawlUrl('https://firecrawl.dev', { crawlerOptions: { excludes: ['blog/*'] } }, false, 2, uniqueIdempotencyKey);
89
+ const response = await app.crawlUrl('https://roastmywebsite.ai', { crawlerOptions: { excludes: ['blog/*'] } }, false, 2, uniqueIdempotencyKey);
90
90
  expect(response).not.toBeNull();
91
91
  expect(response.jobId).toBeDefined();
92
92
 
93
- await expect(app.crawlUrl('https://firecrawl.dev', { crawlerOptions: { excludes: ['blog/*'] } }, true, 2, uniqueIdempotencyKey)).rejects.toThrow("Request failed with status code 409");
93
+ await expect(app.crawlUrl('https://roastmywebsite.ai', { crawlerOptions: { excludes: ['blog/*'] } }, true, 2, uniqueIdempotencyKey)).rejects.toThrow("Request failed with status code 409");
94
94
  });
95
95
 
96
- test('should check crawl status', async () => {
96
+ test.concurrent('should check crawl status', async () => {
97
97
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
98
- const response = await app.crawlUrl('https://firecrawl.dev', { crawlerOptions: { excludes: ['blog/*'] } }, false);
98
+ const response = await app.crawlUrl('https://roastmywebsite.ai', { crawlerOptions: { excludes: ['blog/*'] } }, false);
99
99
  expect(response).not.toBeNull();
100
100
  expect(response.jobId).toBeDefined();
101
101
 
@@ -115,7 +115,7 @@ describe('FirecrawlApp E2E Tests', () => {
115
115
  expect(statusResponse.data.length).toBeGreaterThan(0);
116
116
  }, 35000); // 35 seconds timeout
117
117
 
118
- test('should return successful response for search', async () => {
118
+ test.concurrent('should return successful response for search', async () => {
119
119
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
120
120
  const response = await app.search("test query");
121
121
  expect(response).not.toBeNull();
@@ -123,12 +123,12 @@ describe('FirecrawlApp E2E Tests', () => {
123
123
  expect(response.data.length).toBeGreaterThan(2);
124
124
  }, 30000); // 30 seconds timeout
125
125
 
126
- test('should throw error for invalid API key on search', async () => {
126
+ test.concurrent('should throw error for invalid API key on search', async () => {
127
127
  const invalidApp = new FirecrawlApp({ apiKey: "invalid_api_key", apiUrl: API_URL });
128
128
  await expect(invalidApp.search("test query")).rejects.toThrow("Request failed with status code 401");
129
129
  });
130
130
 
131
- test('should perform LLM extraction', async () => {
131
+ test.concurrent('should perform LLM extraction', async () => {
132
132
  const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL });
133
133
  const response = await app.scrapeUrl("https://mendable.ai", {
134
134
  extractorOptions: {