n8n/packages/node-dev
github-actions[bot] 1516c84dad
🚀 Release 1.21.0 (#8019)
#
[1.21.0](https://github.com/n8n-io/n8n/compare/n8n@1.20.0...n8n@1.21.0)
(2023-12-13)


### Bug Fixes

* **core:** Ensure inviter and invitee are set correctly in invite link
([#7943](https://github.com/n8n-io/n8n/issues/7943))
([386bd61](386bd61967))
* **core:** Fix user comparison in same-user subworkflow caller policy
([#7913](https://github.com/n8n-io/n8n/issues/7913))
([92bab72](92bab72cff))
* **core:** Perform multi-main leader check against key ID
([#7964](https://github.com/n8n-io/n8n/issues/7964))
([1a87f70](1a87f70e84))
* **core:** Ensure external hooks post workflow execute run in queue
mode ([#7947](https://github.com/n8n-io/n8n/issues/7947))
([3ba7deb](3ba7deb337))
* **core:** Fix issue preventing secrets from loading if the path
contains - or / ([#7988](https://github.com/n8n-io/n8n/issues/7988))
([0ac9594](0ac959463f))
* **core:** Restrict updating/deleting of shared but not owned
credentials ([#7950](https://github.com/n8n-io/n8n/issues/7950))
([42e828d](42e828d5c6))
* **core:** Prevent workflow history saving error from happening
([#7812](https://github.com/n8n-io/n8n/issues/7812))
([e5581ce](e5581ce802))
* **editor:** Add missing string for worker in log streaming
([#7971](https://github.com/n8n-io/n8n/issues/7971))
([148bc1d](148bc1d303))
* **editor:** Allow SSH protocol in git repository URL for environments
([#7944](https://github.com/n8n-io/n8n/issues/7944))
([bc1c72f](bc1c72f992))
* **editor:** Fix bug with node names with certain characters
([#8013](https://github.com/n8n-io/n8n/issues/8013))
([26f0d57](26f0d57f5f))
* **editor:** Fix Webhook URL expansion icon
([#8011](https://github.com/n8n-io/n8n/issues/8011))
([b00b905](b00b9057a4))
* **editor:** Prevent opening NDV search if `/` is typed in a
contenteditable element
([#7968](https://github.com/n8n-io/n8n/issues/7968))
([e8a493f](e8a493f718))
* **editor:** Return early in ws message handler if no 'command' keyword
is found ([#7946](https://github.com/n8n-io/n8n/issues/7946))
([5b2defc](5b2defc867))
* **FileMaker Node:** Prevent erroring on zero fields loaded
([#7955](https://github.com/n8n-io/n8n/issues/7955))
([10ad386](10ad386604))
* **Google Sheets Node:** Prevent erroring on zero sheet search results
([#7957](https://github.com/n8n-io/n8n/issues/7957))
([9b877a9](9b877a9427))
* **Google Sheets Node:** Prevent erroring when fetching mapping columns
([#7972](https://github.com/n8n-io/n8n/issues/7972))
([29a1066](29a10668d1))
* **Postgres Node:** Do not include id column in upsert fields selection
if it's not unique ([#7975](https://github.com/n8n-io/n8n/issues/7975))
([435392c](435392cbfe))
* **Postgres Trigger Node:** Increase manual trigger timeout from 30 to
60 seconds ([#8015](https://github.com/n8n-io/n8n/issues/8015))
([09a5729](09a5729305))
* **Webhook Node:** Binary data handling
([#7804](https://github.com/n8n-io/n8n/issues/7804))
([565b409](565b409a82))
* **Webhook Node:** Do not create binary data when there is no data in
the request ([#8000](https://github.com/n8n-io/n8n/issues/8000))
([70f0755](70f0755278))


### Features

* **core:** Add config option for external secret update interval
([#7995](https://github.com/n8n-io/n8n/issues/7995))
([b6c1c04](b6c1c04b54))
* AI nodes usability fixes + Summarization Chain V2
([#7949](https://github.com/n8n-io/n8n/issues/7949))
([dcf1286](dcf12867b3))
* **editor:** Data transformation nodes and actions in Nodes Panel
([#7760](https://github.com/n8n-io/n8n/issues/7760))
([675ec21](675ec21d33))
* **editor:** Add AppCues tracking for onboarding event
([#7945](https://github.com/n8n-io/n8n/issues/7945))
([04cabaf](04cabafef7))
* **editor:** Add option to disable NDV in workflow previews
([#7990](https://github.com/n8n-io/n8n/issues/7990))
([393afef](393afef174))
* **editor:** Filter component + implement in If node
([#7490](https://github.com/n8n-io/n8n/issues/7490))
([8a53434](8a5343401d))
* **editor:** Show template credential setup based on feature flag
([#7989](https://github.com/n8n-io/n8n/issues/7989))
([08ee307](08ee307209))
* **editor:** Introduce advanced permissions
([#7844](https://github.com/n8n-io/n8n/issues/7844))
([dbd62a4](dbd62a4992))
* **Google Ads Node:** Update to support v15
([#7962](https://github.com/n8n-io/n8n/issues/7962))
([7f01269](7f0126915a))
* **Local File Trigger Node:** Add polling option typically good to
watch network files/folders
([#7942](https://github.com/n8n-io/n8n/issues/7942))
([2fbdfec](2fbdfec0c0))
* **n8n Form Trigger Node:** Improvements
([#7571](https://github.com/n8n-io/n8n/issues/7571))
([953a58f](953a58f18b))

Co-authored-by: ivov <ivov@users.noreply.github.com>
2023-12-13 16:34:00 +01:00
..
bin Rename n8n-node-dev cli command file 2019-08-28 12:48:29 +02:00
commands refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471) 2023-10-23 13:39:35 +02:00
src refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471) 2023-10-23 13:39:35 +02:00
templates refactor(core): Deprecate prepareOutputData (no-changelog) (#7091) 2023-09-05 12:59:02 +02:00
.eslintrc.js ci: Introduce no-plain-errors lint rule for BE packages (no-changelog) (#7961) 2023-12-08 12:51:49 +01:00
LICENSE.md docs: scope Sustainable Use License to contents of the main branch (#4450) 2022-10-26 16:50:33 +02:00
LICENSE_EE.md docs(license): Introduce n8n Enterprise License (#3945) 2022-08-29 22:08:42 +02:00
package.json 🚀 Release 1.21.0 (#8019) 2023-12-13 16:34:00 +01:00
README.md docs: Replace http://faircode.io to https://faircode.io in .md files (#7908) 2023-12-12 15:23:22 +00:00
tsconfig.json ci: Fix typescript incremental builds (no-changelog) (#7275) 2023-09-29 13:26:06 +02:00

n8n.io - Workflow Automation

n8n-node-dev

Currently very simple and not very sophisticated CLI which makes it easier to create credentials and nodes in TypeScript for n8n.

npm install n8n-node-dev -g

Contents

Usage

The commandline tool can be started with n8n-node-dev <COMMAND>

Commands

The following commands exist:

build

Builds credentials and nodes in the current folder and copies them into the n8n custom extension folder (~/.n8n/custom/) unless destination path is overwritten with --destination <FOLDER_PATH>

When "--watch" gets set it starts in watch mode and automatically builds and copies files whenever they change. To stop press "ctrl + c".

new

Creates new basic credentials or node of the selected type to have a first starting point.

Create a node

The easiest way to create a new node is via the "n8n-node-dev" cli. It sets up all the basics.

A n8n node is a JavaScript file (normally written in TypeScript) which describes some basic information (like name, description, ...) and also at least one method. Depending on which method gets implemented defines if it is a regular-, trigger- or webhook-node.

A simple regular node which:

  • defines one node property
  • sets its value to all items it receives

would look like this:

File named: MyNode.node.ts

import {
	IExecuteFunctions,
	INodeExecutionData,
	INodeType,
	INodeTypeDescription,
} from 'n8n-workflow';


export class MyNode implements INodeType {
	description: INodeTypeDescription = {
		displayName: 'My Node',
		name: 'myNode',
		group: ['transform'],
		version: 1,
		description: 'Adds "myString" on all items to defined value.',
		defaults: {
			name: 'My Node',
			color: '#772244',
		},
		inputs: ['main'],
		outputs: ['main'],
		properties: [
			// Node properties which the user gets displayed and
			// can change on the node.
			{
				displayName: 'My String',
				name: 'myString',
				type: 'string',
				default: '',
				placeholder: 'Placeholder value',
				description: 'The description text',
			}
		]
	};


	async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {

		const items = this.getInputData();

		let item: INodeExecutionData;
		let myString: string;

		// Itterates over all input items and add the key "myString" with the
		// value the parameter "myString" resolves to.
		// (This could be a different value for each item in case it contains an expression)
		for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
			myString = this.getNodeParameter('myString', itemIndex, '') as string;
			item = items[itemIndex];

			item.json['myString'] = myString;
		}

		return [items];

	}
}

The "description" property has to be set on all nodes because it contains all the base information. Additionally all nodes have to have exactly one of the following methods defined which contains the actual logic:

Regular node

Method is called when the workflow gets executed

  • execute: Executed once no matter how many items

By default, execute should always be used, especially when creating a third-party integration. The reason for this is that it provides much more flexibility and allows, for example, returning a different number of items than it received as input. This becomes crucial when a node needs to query data such as return all users. In such cases, the node typically receives only one input item but returns as many items as there are users. Therefore, when in doubt, it is recommended to use execute!

Trigger node

Method is called once when the workflow gets activated. It can then trigger workflow runs and provide the necessary data by itself.

  • trigger

Webhook node

Method is called when webhook gets called.

  • webhook

Node Type

Property overview

  • description [required]: Describes the node like its name, properties, hooks, ... see Node Type Description bellow.
  • execute [optional]: Method is called when the workflow gets executed (once).
  • hooks [optional]: The hook methods.
  • methods [optional]: Additional methods. Currently only "loadOptions" exists which allows loading options for parameters from external services
  • trigger [optional]: Method is called once when the workflow gets activated.
  • webhook [optional]: Method is called when webhook gets called.
  • webhookMethods [optional]: Methods to setup webhooks on external services.

Node Type Description

The following properties can be set in the node description:

  • credentials [optional]: Credentials the node requests access to
  • defaults [required]: Default "name" and "color" to set on node when it gets created
  • displayName [required]: Name to display users in Editor UI
  • description [required]: Description to display users in Editor UI
  • group [required]: Node group for example "transform" or "trigger"
  • hooks [optional]: Methods to execute at different points in time like when the workflow gets activated or deactivated
  • icon [optional]: Icon to display (can be an icon or a font awesome icon)
  • inputs [required]: Types of inputs the node has (currently only "main" exists) and the amount
  • outputs [required]: Types of outputs the node has (currently only "main" exists) and the amount
  • outputNames [optional]: In case a node has multiple outputs, names can be set that users know what data to expect
  • maxNodes [optional]: If an unlimited number of nodes of that type cannot exist in a workflow, the max-amount can be specified
  • name [required]: Name of the node (for n8n to use internally, in camelCase)
  • properties [required]: Properties which get displayed in the Editor UI and can be set by the user
  • subtitle [optional]: Text which should be displayed underneath the name of the node in the Editor UI (can be an expression)
  • version [required]: Version of the node. Currently always "1" (integer). For future usage, does not get used yet
  • webhooks [optional]: Webhooks the node should listen to

Node Properties

The following properties can be set in the node properties:

  • default [required]: Default value of the property
  • description [required]: Description that is displayed to users in the Editor UI
  • displayName [required]: Name that is displayed to users in the Editor UI
  • displayOptions [optional]: Defines logic to decide if a property should be displayed or not
  • name [required]: Name of the property (for n8n to use internally, in camelCase)
  • options [optional]: The options the user can select when type of property is "collection", "fixedCollection" or "options"
  • placeholder [optional]: Placeholder text that is displayed to users in the Editor UI
  • type [required]: Type of the property. If it is for example a "string", "number", ...
  • typeOptions [optional]: Additional options for type. Like for example the min or max value of a number
  • required [optional]: Defines if the value has to be set or if it can stay empty

Node Property Options

The following properties can be set in the node property options:

All properties are optional. However, most only work when the node-property is of a specfic type.

  • alwaysOpenEditWindow [type: json]: If set then the "Editor Window" will always open when the user tries to edit the field. Helpful if long text is typically used in the property
  • loadOptionsMethod [type: options]: Method to use to load options from an external service
  • maxValue [type: number]: Maximum value of the number
  • minValue [type: number]: Minimum value of the number
  • multipleValues [type: all]: If set the property gets turned into an Array and the user can add multiple values
  • multipleValueButtonText [type: all]: Custom text for add button in case "multipleValues" were set
  • numberPrecision [type: number]: The precision of the number. By default, it is "0" and will only allow integers
  • password [type: string]: If a password field should be displayed (normally only used by credentials because all node data is not encrypted and gets saved in clear-text)
  • rows [type: string]: Number of rows the input field should have. By default it is "1"

License

n8n is fair-code distributed under the Sustainable Use License.

Proprietary licenses are available for enterprise customers. Get in touch

Additional information about the license can be found in the docs.