n8n-nodes-version 0.3.1 → 0.4.0
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
|
@@ -56,9 +56,12 @@ A schedule-based trigger with advanced filtering.
|
|
|
56
56
|
|
|
57
57
|
**Configuration:**
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
**Configuration:**
|
|
60
|
+
|
|
61
|
+
- **Trigger On**: Choose between `Interval` (simple presets) or `Custom Cron Expression`.
|
|
60
62
|
- **Trigger Condition**: Choose between `Update Available` or `Always`.
|
|
61
63
|
- **SemVer Level**: Filter triggers by `Major`, `Minor`, or `Patch` update relevance.
|
|
64
|
+
- **Fetch Changelog**: Optionally fetch and include release notes in the trigger output.
|
|
62
65
|
- **Ignore Prereleases**: Option to skip alpha, beta, and RC versions.
|
|
63
66
|
|
|
64
67
|
---
|
|
@@ -19,14 +19,66 @@ class N8nVersionTrigger {
|
|
|
19
19
|
inputs: [],
|
|
20
20
|
outputs: ['main'],
|
|
21
21
|
properties: [
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Trigger On',
|
|
24
|
+
name: 'triggerOn',
|
|
25
|
+
type: 'options',
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Interval',
|
|
29
|
+
value: 'interval',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Custom Cron Expression',
|
|
33
|
+
value: 'custom',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
default: 'interval',
|
|
37
|
+
description: 'How to specify the schedule',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Interval',
|
|
41
|
+
name: 'interval',
|
|
42
|
+
type: 'options',
|
|
43
|
+
displayOptions: {
|
|
44
|
+
show: {
|
|
45
|
+
triggerOn: ['interval'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Every Minute',
|
|
51
|
+
value: '* * * * *',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Every Hour',
|
|
55
|
+
value: '0 * * * *',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Every Day',
|
|
59
|
+
value: '0 0 * * *',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Every Week',
|
|
63
|
+
value: '0 0 * * 0',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
default: '0 * * * *',
|
|
67
|
+
description: 'How often to check for updates',
|
|
68
|
+
},
|
|
22
69
|
{
|
|
23
70
|
displayName: 'Cron Expression',
|
|
24
71
|
name: 'cronExpression',
|
|
25
72
|
type: 'string',
|
|
26
73
|
default: '0 * * * *',
|
|
74
|
+
displayOptions: {
|
|
75
|
+
show: {
|
|
76
|
+
triggerOn: ['custom'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
27
79
|
required: true,
|
|
28
80
|
placeholder: '0 * * * *',
|
|
29
|
-
description: '
|
|
81
|
+
description: 'Standard cron expression',
|
|
30
82
|
},
|
|
31
83
|
{
|
|
32
84
|
displayName: 'Trigger Condition',
|
|
@@ -84,14 +136,66 @@ class N8nVersionTrigger {
|
|
|
84
136
|
default: true,
|
|
85
137
|
description: 'Whether to ignore versions containing alpha, beta, rc, etc',
|
|
86
138
|
},
|
|
139
|
+
// Changelog Options
|
|
140
|
+
{
|
|
141
|
+
displayName: 'Fetch Changelog',
|
|
142
|
+
name: 'fetchChangelog',
|
|
143
|
+
type: 'boolean',
|
|
144
|
+
default: false,
|
|
145
|
+
description: 'Whether to fetch release notes when triggering',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Changelog Version',
|
|
149
|
+
name: 'changelogVersion',
|
|
150
|
+
type: 'options',
|
|
151
|
+
default: 'latest',
|
|
152
|
+
displayOptions: {
|
|
153
|
+
show: {
|
|
154
|
+
fetchChangelog: [true],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
options: [
|
|
158
|
+
{
|
|
159
|
+
name: 'Latest Version',
|
|
160
|
+
value: 'latest',
|
|
161
|
+
description: 'Fetch changelog for the latest version from npm',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'Current Version',
|
|
165
|
+
value: 'current',
|
|
166
|
+
description: 'Fetch changelog for the currently installed version',
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
displayName: 'Strip Links',
|
|
172
|
+
name: 'stripLinks',
|
|
173
|
+
type: 'boolean',
|
|
174
|
+
default: false,
|
|
175
|
+
displayOptions: {
|
|
176
|
+
show: {
|
|
177
|
+
fetchChangelog: [true],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
87
181
|
],
|
|
88
182
|
};
|
|
89
183
|
}
|
|
90
184
|
async trigger() {
|
|
91
|
-
const
|
|
185
|
+
const triggerOn = this.getNodeParameter('triggerOn');
|
|
186
|
+
let cronExpression = '';
|
|
187
|
+
if (triggerOn === 'interval') {
|
|
188
|
+
cronExpression = this.getNodeParameter('interval');
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
cronExpression = this.getNodeParameter('cronExpression');
|
|
192
|
+
}
|
|
92
193
|
const triggerCondition = this.getNodeParameter('triggerCondition');
|
|
93
194
|
const semverFilter = this.getNodeParameter('semverFilter', 'patch');
|
|
94
195
|
const ignorePrerelease = this.getNodeParameter('ignorePrerelease', true);
|
|
196
|
+
const fetchChangelog = this.getNodeParameter('fetchChangelog', false);
|
|
197
|
+
const changelogVersion = this.getNodeParameter('changelogVersion', 'latest');
|
|
198
|
+
const stripLinks = this.getNodeParameter('stripLinks', false);
|
|
95
199
|
let job;
|
|
96
200
|
try {
|
|
97
201
|
job = new cron_1.CronJob(cronExpression, async () => {
|
|
@@ -116,18 +220,34 @@ class N8nVersionTrigger {
|
|
|
116
220
|
}
|
|
117
221
|
}
|
|
118
222
|
if (shouldTrigger) {
|
|
223
|
+
const json = {
|
|
224
|
+
currentVersion,
|
|
225
|
+
latestVersion,
|
|
226
|
+
isLatest,
|
|
227
|
+
updateType,
|
|
228
|
+
error: error || undefined,
|
|
229
|
+
triggeredAt: new Date().toISOString(),
|
|
230
|
+
triggerCondition,
|
|
231
|
+
};
|
|
232
|
+
if (fetchChangelog) {
|
|
233
|
+
let versionToFetch = changelogVersion === 'latest'
|
|
234
|
+
? (latestVersion || await (0, VersionUtils_1.getLatestN8nVersion)())
|
|
235
|
+
: currentVersion;
|
|
236
|
+
if (versionToFetch && versionToFetch !== 'unknown') {
|
|
237
|
+
const changelogInfo = await (0, VersionUtils_1.getChangelog)(versionToFetch);
|
|
238
|
+
json.changelog = changelogInfo.changelog;
|
|
239
|
+
json.changelogVersion = changelogInfo.version;
|
|
240
|
+
if (changelogInfo.error)
|
|
241
|
+
json.changelogError = changelogInfo.error;
|
|
242
|
+
if (stripLinks && json.changelog) {
|
|
243
|
+
json.changelog = json.changelog.replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
119
247
|
this.emit([
|
|
120
248
|
[
|
|
121
249
|
{
|
|
122
|
-
json
|
|
123
|
-
currentVersion,
|
|
124
|
-
latestVersion,
|
|
125
|
-
isLatest,
|
|
126
|
-
updateType,
|
|
127
|
-
error: error || undefined,
|
|
128
|
-
triggeredAt: new Date().toISOString(),
|
|
129
|
-
triggerCondition,
|
|
130
|
-
},
|
|
250
|
+
json,
|
|
131
251
|
},
|
|
132
252
|
],
|
|
133
253
|
]);
|