n8n/packages/nodes-base/nodes/ManualTrigger/ManualTrigger.node.ts
oleg be4f54de15
feat(editor): Node Creator AI nodes improvements (#9484)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
2024-05-30 16:53:33 +02:00

46 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type {
ITriggerFunctions,
INodeType,
INodeTypeDescription,
ITriggerResponse,
} from 'n8n-workflow';
export class ManualTrigger implements INodeType {
description: INodeTypeDescription = {
displayName: 'Manual Trigger',
name: 'manualTrigger',
icon: 'fa:mouse-pointer',
group: ['trigger'],
version: 1,
description: 'Runs the flow on clicking a button in n8n',
eventTriggerDescription: '',
maxNodes: 1,
defaults: {
name: 'When clicking Test workflow',
color: '#909298',
},
inputs: [],
outputs: ['main'],
properties: [
{
displayName:
'This node is where the workflow execution starts (when you click the test button on the canvas).<br><br> <a data-action="showNodeCreator">Explore other ways to trigger your workflow</a> (e.g on a schedule, or a webhook)',
name: 'notice',
type: 'notice',
default: '',
},
],
};
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
const manualTriggerFunction = async () => {
this.emit([this.helpers.returnJsonArray([{}])]);
};
return {
manualTriggerFunction,
};
}
}