firecrawl 1.23.2 → 1.23.6
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 +374 -699
- package/dist/index.js +376 -701
- package/package.json +1 -1
- package/src/__tests__/v1/snips/change-tracking.test.ts +0 -105
package/package.json
CHANGED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import FirecrawlApp from '../../../../src/index';
|
|
3
|
-
|
|
4
|
-
jest.mock('axios');
|
|
5
|
-
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
|
6
|
-
|
|
7
|
-
describe('Change Tracking Tests', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
jest.resetAllMocks();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should support basic change tracking format', async () => {
|
|
13
|
-
mockedAxios.post.mockResolvedValueOnce({
|
|
14
|
-
status: 200,
|
|
15
|
-
data: {
|
|
16
|
-
success: true,
|
|
17
|
-
data: {
|
|
18
|
-
markdown: 'Test markdown content',
|
|
19
|
-
changeTracking: {
|
|
20
|
-
previousScrapeAt: '2023-01-01T00:00:00Z',
|
|
21
|
-
changeStatus: 'changed',
|
|
22
|
-
visibility: 'visible'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const app = new FirecrawlApp({ apiKey: process.env.TEST_API_KEY || 'dummy-api-key-for-testing' });
|
|
29
|
-
const result = await app.scrapeUrl('https://example.com', {
|
|
30
|
-
formats: ['markdown', 'changeTracking']
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
expect(mockedAxios.post).toHaveBeenCalledTimes(1);
|
|
34
|
-
expect(mockedAxios.post.mock.calls[0][1].formats).toContain('changeTracking');
|
|
35
|
-
|
|
36
|
-
expect(result).toHaveProperty('changeTracking');
|
|
37
|
-
expect(result.changeTracking?.previousScrapeAt).toBe('2023-01-01T00:00:00Z');
|
|
38
|
-
expect(result.changeTracking?.changeStatus).toBe('changed');
|
|
39
|
-
expect(result.changeTracking?.visibility).toBe('visible');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should support change tracking options with git-diff and json modes', async () => {
|
|
43
|
-
mockedAxios.post.mockResolvedValueOnce({
|
|
44
|
-
status: 200,
|
|
45
|
-
data: {
|
|
46
|
-
success: true,
|
|
47
|
-
data: {
|
|
48
|
-
markdown: 'Test markdown content',
|
|
49
|
-
changeTracking: {
|
|
50
|
-
previousScrapeAt: '2023-01-01T00:00:00Z',
|
|
51
|
-
changeStatus: 'changed',
|
|
52
|
-
visibility: 'visible',
|
|
53
|
-
diff: {
|
|
54
|
-
text: '@@ -1,1 +1,1 @@\n-old content\n+new content',
|
|
55
|
-
json: {
|
|
56
|
-
files: [{
|
|
57
|
-
from: null,
|
|
58
|
-
to: null,
|
|
59
|
-
chunks: [{
|
|
60
|
-
content: '@@ -1,1 +1,1 @@',
|
|
61
|
-
changes: [{
|
|
62
|
-
type: 'del',
|
|
63
|
-
content: '-old content',
|
|
64
|
-
del: true,
|
|
65
|
-
ln: 1
|
|
66
|
-
}, {
|
|
67
|
-
type: 'add',
|
|
68
|
-
content: '+new content',
|
|
69
|
-
add: true,
|
|
70
|
-
ln: 1
|
|
71
|
-
}]
|
|
72
|
-
}]
|
|
73
|
-
}]
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
json: {
|
|
77
|
-
title: {
|
|
78
|
-
previous: 'Old Title',
|
|
79
|
-
current: 'New Title'
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const app = new FirecrawlApp({ apiKey: process.env.TEST_API_KEY || 'dummy-api-key-for-testing' });
|
|
88
|
-
const result = await app.scrapeUrl('https://example.com', {
|
|
89
|
-
formats: ['markdown', 'changeTracking'],
|
|
90
|
-
changeTrackingOptions: {
|
|
91
|
-
modes: ['git-diff', 'json'],
|
|
92
|
-
schema: { type: 'object', properties: { title: { type: 'string' } } }
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
expect(mockedAxios.post).toHaveBeenCalledTimes(1);
|
|
97
|
-
expect(mockedAxios.post.mock.calls[0][1].formats).toContain('changeTracking');
|
|
98
|
-
expect(mockedAxios.post.mock.calls[0][1].changeTrackingOptions.modes).toEqual(['git-diff', 'json']);
|
|
99
|
-
|
|
100
|
-
expect(result).toHaveProperty('changeTracking');
|
|
101
|
-
expect(result.changeTracking?.diff?.text).toBe('@@ -1,1 +1,1 @@\n-old content\n+new content');
|
|
102
|
-
expect(result.changeTracking?.json?.title.previous).toBe('Old Title');
|
|
103
|
-
expect(result.changeTracking?.json?.title.current).toBe('New Title');
|
|
104
|
-
});
|
|
105
|
-
});
|