@pagecrawl/n8n-nodes-pagecrawl 0.1.0 → 0.1.1
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/README.md
CHANGED
|
@@ -1,42 +1,15 @@
|
|
|
1
|
-
# n8n-nodes-pagecrawl
|
|
1
|
+
# @pagecrawl/n8n-nodes-pagecrawl
|
|
2
2
|
|
|
3
3
|
This is an n8n community node that provides integration with [PageCrawl.io](https://pagecrawl.io) for website monitoring and change detection.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
### Community Node (Recommended)
|
|
8
|
-
|
|
9
7
|
You can install this node directly in n8n:
|
|
10
8
|
|
|
11
9
|
1. Go to **Settings** > **Community Nodes**
|
|
12
|
-
2. Search for
|
|
10
|
+
2. Search for `@pagecrawl/n8n-nodes-pagecrawl`
|
|
13
11
|
3. Click **Install**
|
|
14
12
|
|
|
15
|
-
### Manual Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install n8n-nodes-pagecrawl
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Local Development
|
|
22
|
-
|
|
23
|
-
For development and testing:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Clone the repository
|
|
27
|
-
git clone https://github.com/pagecrawl/n8n-nodes-pagecrawl.git
|
|
28
|
-
cd n8n-nodes-pagecrawl
|
|
29
|
-
|
|
30
|
-
# Install dependencies
|
|
31
|
-
npm install
|
|
32
|
-
|
|
33
|
-
# Build the node
|
|
34
|
-
npm run build
|
|
35
|
-
|
|
36
|
-
# Run n8n with the node
|
|
37
|
-
npm run dev
|
|
38
|
-
```
|
|
39
|
-
|
|
40
13
|
## Authentication
|
|
41
14
|
|
|
42
15
|
To use this node, you'll need a PageCrawl.io API token.
|
|
@@ -189,34 +162,6 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
189
162
|
4. Push to the branch
|
|
190
163
|
5. Open a Pull Request
|
|
191
164
|
|
|
192
|
-
## Development
|
|
193
|
-
|
|
194
|
-
### Building
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
npm run build
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Testing
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# Run linter
|
|
204
|
-
npm run lint
|
|
205
|
-
|
|
206
|
-
# Fix linting issues
|
|
207
|
-
npm run lint:fix
|
|
208
|
-
|
|
209
|
-
# Test in n8n
|
|
210
|
-
npm run dev
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Publishing
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
npm version patch
|
|
217
|
-
npm publish
|
|
218
|
-
```
|
|
219
|
-
|
|
220
165
|
## Changelog
|
|
221
166
|
|
|
222
167
|
### 0.1.0
|
|
@@ -104,7 +104,7 @@ class PageCrawl {
|
|
|
104
104
|
if (!returnAll) {
|
|
105
105
|
qs.limit = this.getNodeParameter('limit', i);
|
|
106
106
|
}
|
|
107
|
-
responseData = await this.helpers.
|
|
107
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
108
108
|
method: 'GET',
|
|
109
109
|
url: `${baseUrl}/api${endpoint}`,
|
|
110
110
|
qs,
|
|
@@ -124,7 +124,7 @@ class PageCrawl {
|
|
|
124
124
|
if (options.take) {
|
|
125
125
|
qs.take = options.take;
|
|
126
126
|
}
|
|
127
|
-
responseData = await this.helpers.
|
|
127
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
128
128
|
method: 'GET',
|
|
129
129
|
url: `${baseUrl}/api/pages/${pageId}`,
|
|
130
130
|
qs,
|
|
@@ -144,7 +144,7 @@ class PageCrawl {
|
|
|
144
144
|
if (additionalFields.ignore_duplicates !== undefined) {
|
|
145
145
|
body.ignore_duplicates = additionalFields.ignore_duplicates;
|
|
146
146
|
}
|
|
147
|
-
responseData = await this.helpers.
|
|
147
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
148
148
|
method: 'POST',
|
|
149
149
|
url: `${baseUrl}/api/track-simple`,
|
|
150
150
|
body,
|
|
@@ -201,7 +201,7 @@ class PageCrawl {
|
|
|
201
201
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in headers field', { itemIndex: i });
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
responseData = await this.helpers.
|
|
204
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
205
205
|
method: 'POST',
|
|
206
206
|
url: `${baseUrl}/api/pages`,
|
|
207
207
|
body,
|
|
@@ -257,7 +257,7 @@ class PageCrawl {
|
|
|
257
257
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in headers field', { itemIndex: i });
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
responseData = await this.helpers.
|
|
260
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
261
261
|
method: 'PUT',
|
|
262
262
|
url: `${baseUrl}/api/pages/${pageId}`,
|
|
263
263
|
body,
|
|
@@ -266,7 +266,7 @@ class PageCrawl {
|
|
|
266
266
|
}
|
|
267
267
|
else if (operation === 'delete') {
|
|
268
268
|
const pageId = this.getNodeParameter('pageId', i);
|
|
269
|
-
responseData = await this.helpers.
|
|
269
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
270
270
|
method: 'DELETE',
|
|
271
271
|
url: `${baseUrl}/api/pages/${pageId}`,
|
|
272
272
|
json: true,
|
|
@@ -280,7 +280,7 @@ class PageCrawl {
|
|
|
280
280
|
if (options.skip_first_notification) {
|
|
281
281
|
qs.skip_first_notification = 1;
|
|
282
282
|
}
|
|
283
|
-
responseData = await this.helpers.
|
|
283
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
284
284
|
method: 'PUT',
|
|
285
285
|
url: `${baseUrl}/api/pages/${pageId}/check`,
|
|
286
286
|
qs,
|
|
@@ -300,7 +300,7 @@ class PageCrawl {
|
|
|
300
300
|
if (options.take) {
|
|
301
301
|
qs.take = options.take;
|
|
302
302
|
}
|
|
303
|
-
responseData = await this.helpers.
|
|
303
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
304
304
|
method: 'GET',
|
|
305
305
|
url: `${baseUrl}/api/pages/${pageId}/history`,
|
|
306
306
|
qs,
|
|
@@ -309,7 +309,7 @@ class PageCrawl {
|
|
|
309
309
|
}
|
|
310
310
|
else if (operation === 'getDiffImage') {
|
|
311
311
|
const checkId = this.getNodeParameter('checkId', i);
|
|
312
|
-
const response = await this.helpers.
|
|
312
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
313
313
|
method: 'GET',
|
|
314
314
|
url: `${baseUrl}/api/pages/${pageId}/checks/${checkId}/diff.png`,
|
|
315
315
|
encoding: 'arraybuffer',
|
|
@@ -321,7 +321,7 @@ class PageCrawl {
|
|
|
321
321
|
}
|
|
322
322
|
else if (operation === 'getDiffHtml') {
|
|
323
323
|
const checkId = this.getNodeParameter('checkId', i);
|
|
324
|
-
const htmlContent = await this.helpers.
|
|
324
|
+
const htmlContent = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
325
325
|
method: 'GET',
|
|
326
326
|
url: `${baseUrl}/api/pages/${pageId}/checks/${checkId}/diff.html`,
|
|
327
327
|
headers: {
|
|
@@ -336,7 +336,7 @@ class PageCrawl {
|
|
|
336
336
|
}
|
|
337
337
|
else if (operation === 'getDiffMarkdown') {
|
|
338
338
|
const checkId = this.getNodeParameter('checkId', i);
|
|
339
|
-
const markdownContent = await this.helpers.
|
|
339
|
+
const markdownContent = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
340
340
|
method: 'GET',
|
|
341
341
|
url: `${baseUrl}/api/pages/${pageId}/checks/${checkId}/diff.markdown`,
|
|
342
342
|
headers: {
|
|
@@ -367,7 +367,7 @@ class PageCrawl {
|
|
|
367
367
|
const checkId = this.getNodeParameter('checkId', i);
|
|
368
368
|
endpoint = `/pages/${pageId}/checks/${checkId}/diff`;
|
|
369
369
|
}
|
|
370
|
-
const response = await this.helpers.
|
|
370
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
371
371
|
method: 'GET',
|
|
372
372
|
url: `${baseUrl}/api${endpoint}`,
|
|
373
373
|
encoding: 'arraybuffer',
|
|
@@ -380,7 +380,7 @@ class PageCrawl {
|
|
|
380
380
|
else if (resource === 'webhook') {
|
|
381
381
|
if (operation === 'getAll') {
|
|
382
382
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
383
|
-
responseData = await this.helpers.
|
|
383
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
384
384
|
method: 'GET',
|
|
385
385
|
url: `${baseUrl}/api/hooks`,
|
|
386
386
|
json: true,
|
|
@@ -400,7 +400,7 @@ class PageCrawl {
|
|
|
400
400
|
if (additionalFields.payload_fields) {
|
|
401
401
|
body.payload_fields = additionalFields.payload_fields;
|
|
402
402
|
}
|
|
403
|
-
responseData = await this.helpers.
|
|
403
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
404
404
|
method: 'POST',
|
|
405
405
|
url: `${baseUrl}/api/hooks`,
|
|
406
406
|
body,
|
|
@@ -410,7 +410,7 @@ class PageCrawl {
|
|
|
410
410
|
else if (operation === 'update') {
|
|
411
411
|
const webhookId = this.getNodeParameter('webhookId', i);
|
|
412
412
|
const updateFields = this.getNodeParameter('updateFields', i);
|
|
413
|
-
responseData = await this.helpers.
|
|
413
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
414
414
|
method: 'PUT',
|
|
415
415
|
url: `${baseUrl}/api/hooks/${webhookId}`,
|
|
416
416
|
body: updateFields,
|
|
@@ -419,7 +419,7 @@ class PageCrawl {
|
|
|
419
419
|
}
|
|
420
420
|
else if (operation === 'delete') {
|
|
421
421
|
const webhookId = this.getNodeParameter('webhookId', i);
|
|
422
|
-
responseData = await this.helpers.
|
|
422
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
423
423
|
method: 'DELETE',
|
|
424
424
|
url: `${baseUrl}/api/hooks/${webhookId}`,
|
|
425
425
|
json: true,
|
|
@@ -428,7 +428,7 @@ class PageCrawl {
|
|
|
428
428
|
}
|
|
429
429
|
else if (operation === 'test') {
|
|
430
430
|
const webhookId = this.getNodeParameter('webhookId', i);
|
|
431
|
-
responseData = await this.helpers.
|
|
431
|
+
responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
432
432
|
method: 'PUT',
|
|
433
433
|
url: `${baseUrl}/api/hooks/${webhookId}/test`,
|
|
434
434
|
json: true,
|
|
@@ -37,7 +37,6 @@ exports.WEBHOOK_PAYLOAD_FIELDS = [
|
|
|
37
37
|
'visual_diff',
|
|
38
38
|
'changed_at',
|
|
39
39
|
'contents',
|
|
40
|
-
'elements',
|
|
41
40
|
'original',
|
|
42
41
|
'difference',
|
|
43
42
|
'human_difference',
|
|
@@ -50,4 +49,6 @@ exports.WEBHOOK_PAYLOAD_FIELDS = [
|
|
|
50
49
|
'json',
|
|
51
50
|
'json_patch',
|
|
52
51
|
'previous_check',
|
|
52
|
+
'ai_summary',
|
|
53
|
+
'ai_priority_score',
|
|
53
54
|
];
|
|
@@ -99,7 +99,7 @@ class PageCrawlTrigger {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
try {
|
|
102
|
-
const response = await this.helpers.
|
|
102
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
103
103
|
method: 'GET',
|
|
104
104
|
url: `${baseUrl}/api/hooks`,
|
|
105
105
|
json: true,
|
|
@@ -132,7 +132,7 @@ class PageCrawlTrigger {
|
|
|
132
132
|
body.payload_fields = payloadFields;
|
|
133
133
|
}
|
|
134
134
|
try {
|
|
135
|
-
const response = await this.helpers.
|
|
135
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
136
136
|
method: 'POST',
|
|
137
137
|
url: `${baseUrl}/api/hooks`,
|
|
138
138
|
body,
|
|
@@ -157,7 +157,7 @@ class PageCrawlTrigger {
|
|
|
157
157
|
return true;
|
|
158
158
|
}
|
|
159
159
|
try {
|
|
160
|
-
await this.helpers.
|
|
160
|
+
await this.helpers.httpRequestWithAuthentication.call(this, 'pageCrawlApi', {
|
|
161
161
|
method: 'DELETE',
|
|
162
162
|
url: `${baseUrl}/api/hooks/${webhookData.webhookId}`,
|
|
163
163
|
json: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagecrawl/n8n-nodes-pagecrawl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "n8n node for PageCrawl.io - Website monitoring and change detection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n",
|
|
@@ -49,16 +49,19 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@types/jest": "^30.0.0",
|
|
52
53
|
"@types/node": "^20.0.0",
|
|
53
54
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
54
55
|
"@typescript-eslint/parser": "^7.0.0",
|
|
55
56
|
"eslint": "^8.56.0",
|
|
56
57
|
"eslint-plugin-n8n-nodes-base": "^1.16.0",
|
|
58
|
+
"jest": "^29.7.0",
|
|
57
59
|
"n8n": "^1.115.3",
|
|
58
60
|
"n8n-workflow": "~1.113.0",
|
|
61
|
+
"ts-jest": "^29.4.6",
|
|
59
62
|
"typescript": "^5.0.0"
|
|
60
63
|
},
|
|
61
64
|
"peerDependencies": {
|
|
62
65
|
"n8n-workflow": "~1.113.0"
|
|
63
66
|
}
|
|
64
|
-
}
|
|
67
|
+
}
|