Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Node): add the Scheduler Node #4223

Merged
merged 18 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions packages/nodes-base/nodes/Cron/Cron.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"nodeVersion": "1.0",
"codexVersion": "1.0",
"details": "The Cron node uses Cron under the hood - a time-based job scheduler in Unix-like computer operating systems. Use this node when you want to trigger workflows periodically, especially in more complex scenarios like \"every Tuesday at 9 am\" or \"Weekdays\".",
"categories": [
"Core Nodes"
],
"categories": ["Core Nodes"],
"resources": {
"primaryDocumentation": [
{
Expand Down Expand Up @@ -130,14 +128,8 @@
}
]
},
"alias": [
"Time",
"Scheduler",
"Polling"
],
"alias": ["Time", "Scheduler", "Polling", "Cron", "Interval"],
"subcategories": {
"Core Nodes": [
"Flow"
]
"Core Nodes": ["Flow"]
}
}
5 changes: 4 additions & 1 deletion packages/nodes-base/nodes/Cron/Cron.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Cron implements INodeType {
icon: 'fa:calendar',
group: ['trigger', 'schedule'],
version: 1,
hidden: true,
description: 'Triggers the workflow at a specific time',
eventTriggerDescription: '',
activationMessage:
Expand Down Expand Up @@ -69,7 +70,9 @@ export class Cron implements INodeType {
const timezone = this.getTimezone();

// Start the cron-jobs
const cronJobs = cronTimes.map(cronTime => new CronJob(cronTime, executeTrigger, undefined, true, timezone));
const cronJobs = cronTimes.map(
(cronTime) => new CronJob(cronTime, executeTrigger, undefined, true, timezone),
);

// Stop the cron-jobs
async function closeFunction() {
Expand Down
1 change: 1 addition & 0 deletions packages/nodes-base/nodes/Interval/Interval.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class Interval implements INodeType {
icon: 'fa:hourglass',
group: ['trigger', 'schedule'],
version: 1,
hidden: true,
description: 'Triggers the workflow in a given interval',
eventTriggerDescription: '',
activationMessage:
Expand Down
9 changes: 9 additions & 0 deletions packages/nodes-base/nodes/Schedule/CronInterface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { IDataObject } from 'n8n-workflow';

export type ICronExpression = [
string | Date,
string | Date,
string | Date,
string | Date,
string | Date,
];
18 changes: 18 additions & 0 deletions packages/nodes-base/nodes/Schedule/ScheduleTrigger.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.scheduleTrigger",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Core Nodes"],
"resources": {
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.scheduleTrigger/"
}
],
"generic": []
},
"alias": ["Time", "Scheduler", "Polling", "Cron", "Interval"],
"subcategories": {
"Core Nodes": ["Flow"]
}
}
Loading