1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-11 13:15:28 +03:00

docs(editor): Nodes icons, Merge node descriptions (#8517)

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
Co-authored-by: Marcus <marcus@n8n.io>
This commit is contained in:
Giulio Andreini 2024-02-21 17:04:57 +01:00 committed by कारतोफ्फेलस्क्रिप्ट™
parent 8b67dfbed9
commit 16496f4424
16 changed files with 514 additions and 494 deletions

View File

@ -485,7 +485,7 @@ describe('Node Creator', () => {
nodeCreatorFeature.getters.searchBar().find('input').clear().type('spreadsheet');
nodeCreatorFeature.getters.nodeItemName().first().should('have.text', 'Convert to File');
nodeCreatorFeature.getters.nodeItemName().eq(1).should('have.text', 'Extract From File');
nodeCreatorFeature.getters.nodeItemName().eq(1).should('have.text', 'Extract from File');
nodeCreatorFeature.getters.nodeItemName().eq(2).should('have.text', 'Google Sheets');
nodeCreatorFeature.getters.searchBar().find('input').clear().type('sheets');

View File

@ -19,14 +19,13 @@ export class Code implements INodeType {
description: INodeTypeDescription = {
displayName: 'Code',
name: 'code',
icon: 'fa:code',
icon: 'file:code.svg',
group: ['transform'],
version: [1, 2],
defaultVersion: 2,
description: 'Run custom JavaScript or Python code',
defaults: {
name: 'Code',
color: '#FF9922',
},
inputs: ['main'],
outputs: ['main'],

View File

@ -0,0 +1,11 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1171_441)">
<path d="M170.283 48H196.5C203.127 48 208.5 42.6274 208.5 36V12C208.5 5.37258 203.127 0 196.5 0H170.283C126.1 0 90.283 35.8172 90.283 80V176C90.283 206.928 65.2109 232 34.283 232H23C16.3726 232 11 237.372 11 244V268C11 274.627 16.3724 280 22.9996 280L34.283 280C65.2109 280 90.283 305.072 90.283 336V440C90.283 479.764 122.518 512 162.283 512H196.5C203.127 512 208.5 506.627 208.5 500V476C208.5 469.373 203.127 464 196.5 464H162.283C149.028 464 138.283 453.255 138.283 440V336C138.283 309.022 128.011 284.443 111.164 265.961C106.109 260.416 106.109 251.584 111.164 246.039C128.011 227.557 138.283 202.978 138.283 176V80C138.283 62.3269 152.61 48 170.283 48Z" fill="#FF9922"/>
<path d="M305 36C305 42.6274 310.373 48 317 48H342.979C360.652 48 374.978 62.3269 374.978 80V176C374.978 202.978 385.251 227.557 402.098 246.039C407.153 251.584 407.153 260.416 402.098 265.961C385.251 284.443 374.978 309.022 374.978 336V432C374.978 449.673 360.652 464 342.979 464H317C310.373 464 305 469.373 305 476V500C305 506.627 310.373 512 317 512H342.979C387.161 512 422.978 476.183 422.978 432V336C422.978 305.072 448.051 280 478.979 280H490C496.627 280 502 274.628 502 268V244C502 237.373 496.628 232 490 232L478.979 232C448.051 232 422.978 206.928 422.978 176V80C422.978 35.8172 387.161 0 342.979 0H317C310.373 0 305 5.37258 305 12V36Z" fill="#FF9922"/>
</g>
<defs>
<clipPath id="clip0_1171_441">
<rect width="512" height="512" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -26,6 +26,7 @@
"JSON",
"HTML",
"ICS",
"iCal",
"RTF",
"64"
],

View File

@ -45,9 +45,9 @@ export class ConvertToFile implements INodeType {
description: 'Transform input data into a table in an HTML file',
},
{
name: 'Convert to iCal',
name: 'Convert to ICS',
value: 'iCal',
action: 'Convert to iCal',
action: 'Convert to ICS',
description: 'Converts each input item to an ICS event file',
},
{

View File

@ -27,6 +27,7 @@
"JSON",
"HTML",
"ICS",
"iCal",
"txt",
"Text",
"RTF",

View File

@ -12,14 +12,14 @@ import * as pdf from './actions/pdf.operation';
export class ExtractFromFile implements INodeType {
// eslint-disable-next-line n8n-nodes-base/node-class-description-missing-subtitle
description: INodeTypeDescription = {
displayName: 'Extract From File',
displayName: 'Extract from File',
name: 'extractFromFile',
icon: 'file:extractFromFile.svg',
group: ['input'],
version: 1,
description: 'Convert binary data to JSON',
defaults: {
name: 'Extract From File',
name: 'Extract from File',
},
inputs: ['main'],
outputs: ['main'],
@ -43,18 +43,18 @@ export class ExtractFromFile implements INodeType {
action: 'Extract from HTML',
description: 'Transform a table in an HTML file into output items',
},
{
name: 'Extract From JSON',
value: 'fromJson',
action: 'Extract from JSON',
description: 'Transform a JSON file into output items',
},
{
name: 'Extract From ICS',
value: 'fromIcs',
action: 'Extract from ICS',
description: 'Transform a ICS file into output items',
},
{
name: 'Extract From JSON',
value: 'fromJson',
action: 'Extract from JSON',
description: 'Transform a JSON file into output items',
},
{
name: 'Extract From ODS',
value: 'ods',
@ -82,7 +82,7 @@ export class ExtractFromFile implements INodeType {
{
name: 'Extract From XML',
value: 'xml',
action: 'Extract from XLS',
action: 'Extract from XML',
description: 'Extracts the content of an XML file',
},
{

View File

@ -9,7 +9,7 @@ export class Merge extends VersionedNodeType {
const baseDescription: INodeTypeBaseDescription = {
displayName: 'Merge',
name: 'merge',
icon: 'fa:code-branch',
icon: 'file:merge.svg',
group: ['transform'],
subtitle: '={{$parameter["mode"]}}',
description: 'Merges data of multiple streams once data from both is available',
@ -20,7 +20,6 @@ export class Merge extends VersionedNodeType {
1: new MergeV1(baseDescription),
2: new MergeV2(baseDescription),
2.1: new MergeV2(baseDescription),
2.2: new MergeV2(baseDescription),
};
super(nodeVersions, baseDescription);

View File

@ -0,0 +1,10 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1177_518)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 48C0 21.4903 21.4903 0 48 0H112C138.51 0 160 21.4903 160 48V56H196.252C240.435 56 276.252 91.8172 276.252 136V192C276.252 214.091 294.161 232 316.252 232H352V224C352 197.49 373.49 176 400 176H464C490.51 176 512 197.49 512 224V288C512 314.51 490.51 336 464 336H400C373.49 336 352 314.51 352 288V280H316.252C294.161 280 276.252 297.909 276.252 320V376C276.252 420.183 240.435 456 196.252 456H160V464C160 490.51 138.51 512 112 512H48C21.4903 512 0 490.51 0 464V400C0 373.49 21.4903 352 48 352H112C138.51 352 160 373.49 160 400V408H196.252C213.925 408 228.252 393.673 228.252 376V320C228.252 294.784 238.859 272.044 255.853 256C238.859 239.956 228.252 217.216 228.252 192V136C228.252 118.327 213.925 104 196.252 104H160V112C160 138.51 138.51 160 112 160H48C21.4903 160 0 138.51 0 112V48ZM104 48C108.418 48 112 51.5817 112 56V104C112 108.418 108.418 112 104 112H56C51.5817 112 48 108.418 48 104V56C48 51.5817 51.5817 48 56 48H104ZM456 224C460.418 224 464 227.582 464 232V280C464 284.418 460.418 288 456 288H408C403.582 288 400 284.418 400 280V232C400 227.582 403.582 224 408 224H456ZM112 408C112 403.582 108.418 400 104 400H56C51.5817 400 48 403.582 48 408V456C48 460.418 51.5817 464 56 464H104C108.418 464 112 460.418 112 456V408Z" fill="#54B8C9"/>
</g>
<defs>
<clipPath id="clip0_1177_518">
<rect width="512" height="512" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -31,7 +31,7 @@
"id": "0cc8ce9e-6c16-4fc9-a1b4-589a33dca5e8",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 100]
},
{
@ -39,7 +39,7 @@
"id": "5ba18ff2-a5b4-4515-a055-1c26fe7e5c02",
"name": "Merge1",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 100]
},
{
@ -51,7 +51,7 @@
"id": "cba07480-4ad6-4238-b786-61bacf7660f4",
"name": "Merge3",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, -60]
},
{
@ -63,7 +63,7 @@
"id": "6f6b87fa-2c63-46ab-9f50-d26a376fc4b4",
"name": "Merge4",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, -60]
},
{
@ -83,7 +83,7 @@
"id": "e4aef8cb-3733-43c5-a615-0d1e64393316",
"name": "Merge2",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 280]
},
{
@ -93,7 +93,7 @@
"id": "10c4f897-503b-4fdc-93c8-577bad12d8f0",
"name": "Merge5",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 280]
},
{
@ -149,7 +149,7 @@
"id": "aafbba65-a18d-43b8-8150-88c300992f1d",
"name": "Merge6",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, -220]
},
{
@ -169,7 +169,7 @@
"id": "9098d926-6006-4aed-ad5d-8128128ce6dc",
"name": "Merge8",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, -220]
},
{
@ -181,7 +181,7 @@
"id": "eeece670-291f-4c50-977a-6f3608e8b815",
"name": "Merge9",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, -380]
},
{
@ -193,7 +193,7 @@
"id": "c5ddf991-a05f-441d-9fdf-d4ba0db55894",
"name": "Merge10",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, -380]
},
{
@ -204,7 +204,7 @@
"id": "2bbdfe57-5541-4634-922b-230b03394ee7",
"name": "Merge7",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 460]
},
{
@ -215,7 +215,7 @@
"id": "fbf20a2d-4d08-4302-8289-c0149d5d804f",
"name": "Merge11",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 460]
},
{
@ -223,7 +223,7 @@
"id": "9729a369-5bc7-49c7-9156-1cef519c2744",
"name": "Merge12",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 1200]
},
{
@ -231,7 +231,7 @@
"id": "068c9d3c-f186-4b00-9d96-1de60ce7a92a",
"name": "Merge13",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 1200]
},
{
@ -243,7 +243,7 @@
"id": "6d2de385-9e01-416b-b9b9-948c1ba77e4f",
"name": "Merge14",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 1040]
},
{
@ -255,7 +255,7 @@
"id": "d4b34831-3757-42b7-93e0-53630a46b734",
"name": "Merge15",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 1040]
},
{
@ -265,7 +265,7 @@
"id": "c51a1ec8-d104-4803-9eb1-83630166c749",
"name": "Merge16",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 1380]
},
{
@ -275,7 +275,7 @@
"id": "af935dce-fc44-4075-b3c6-4629fe796f16",
"name": "Merge17",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 1380]
},
{
@ -295,7 +295,7 @@
"id": "bf586064-63aa-4f0e-9fad-c5e97fa23fb8",
"name": "Merge18",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 880]
},
{
@ -315,7 +315,7 @@
"id": "9908bca5-067a-4184-8333-2e48f74f34a1",
"name": "Merge19",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 880]
},
{
@ -327,7 +327,7 @@
"id": "5fcdc9b3-a0c6-424e-a325-d0e83e27e4f1",
"name": "Merge20",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 720]
},
{
@ -339,7 +339,7 @@
"id": "5a8d7598-e88b-4e81-ac57-5c3b6eadfe5a",
"name": "Merge21",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 720]
},
{
@ -350,7 +350,7 @@
"id": "32797fb4-ed6d-4127-823f-982c72d859a8",
"name": "Merge22",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [820, 1560]
},
{
@ -361,7 +361,7 @@
"id": "5299797d-2aa8-4f6b-a5d8-2a3c2bb0295d",
"name": "Merge23",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.2,
"typeVersion": 2.1,
"position": [1080, 1560]
},
{

View File

@ -15,201 +15,192 @@ import { deepCopy } from 'n8n-workflow';
import { oldVersionNotice } from '@utils/descriptions';
import { generatePairedItemData } from '../../../utils/utilities';
const versionDescription: INodeTypeDescription = {
displayName: 'Merge',
name: 'merge',
icon: 'fa:code-branch',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["mode"]}}',
description: 'Merges data of multiple streams once data from both is available',
defaults: {
name: 'Merge',
color: '#00bbcc',
},
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
inputs: ['main', 'main'],
outputs: ['main'],
inputNames: ['Input 1', 'Input 2'],
properties: [
oldVersionNotice,
{
displayName: 'Mode',
name: 'mode',
type: 'options',
options: [
{
name: 'Append',
value: 'append',
description:
'Combines data of both inputs. The output will contain items of input 1 and input 2.',
},
{
name: 'Keep Key Matches',
value: 'keepKeyMatches',
description: 'Keeps data of input 1 if it does find a match with data of input 2',
},
{
name: 'Merge By Index',
value: 'mergeByIndex',
description:
'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on the index of the items. So first item of input 1 will be merged with first item of input 2 and so on.',
},
{
name: 'Merge By Key',
value: 'mergeByKey',
description:
'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on a defined key.',
},
{
name: 'Multiplex',
value: 'multiplex',
description:
'Merges each value of one input with each value of the other input. The output will contain (m * n) items where (m) and (n) are lengths of the inputs.',
},
{
name: 'Pass-Through',
value: 'passThrough',
description:
'Passes through data of one input. The output will contain only items of the defined input.',
},
{
name: 'Remove Key Matches',
value: 'removeKeyMatches',
description: 'Keeps data of input 1 if it does NOT find match with data of input 2',
},
{
name: 'Wait',
value: 'wait',
description:
'Waits till data of both inputs is available and will then output a single empty item. Source Nodes must connect to both Input 1 and 2. This node only supports 2 Sources, if you need more Sources, connect multiple Merge nodes in series. This node will not output any data.',
},
],
default: 'append',
description: 'How data of branches should be merged',
},
{
displayName: 'Join',
name: 'join',
type: 'options',
displayOptions: {
show: {
mode: ['mergeByIndex'],
},
},
options: [
{
name: 'Inner Join',
value: 'inner',
description:
'Merges as many items as both inputs contain. (Example: Input1 = 5 items, Input2 = 3 items | Output will contain 3 items).',
},
{
name: 'Left Join',
value: 'left',
description:
'Merges as many items as first input contains. (Example: Input1 = 3 items, Input2 = 5 items | Output will contain 3 items).',
},
{
name: 'Outer Join',
value: 'outer',
description:
'Merges as many items as input contains with most items. (Example: Input1 = 3 items, Input2 = 5 items | Output will contain 5 items).',
},
],
default: 'left',
description:
'How many items the output will contain if inputs contain different amount of items',
},
{
displayName: 'Property Input 1',
name: 'propertyName1',
type: 'string',
default: '',
hint: 'The name of the field as text (e.g. “id”)',
required: true,
displayOptions: {
show: {
mode: ['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'],
},
},
description: 'Name of property which decides which items to merge of input 1',
},
{
displayName: 'Property Input 2',
name: 'propertyName2',
type: 'string',
default: '',
hint: 'The name of the field as text (e.g. “id”)',
required: true,
displayOptions: {
show: {
mode: ['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'],
},
},
description: 'Name of property which decides which items to merge of input 2',
},
{
displayName: 'Output Data',
name: 'output',
type: 'options',
displayOptions: {
show: {
mode: ['passThrough'],
},
},
options: [
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'input1',
description: 'Defines of which input the data should be used as output of node',
},
{
displayName: 'Overwrite',
name: 'overwrite',
type: 'options',
displayOptions: {
show: {
mode: ['mergeByKey'],
},
},
options: [
{
name: 'Always',
value: 'always',
description: 'Always overwrites everything',
},
{
name: 'If Blank',
value: 'blank',
description: 'Overwrites only values of "null", "undefined" or empty string',
},
{
name: 'If Missing',
value: 'undefined',
description: 'Only adds values which do not exist yet',
},
],
default: 'always',
description: 'Select when to overwrite the values from Input1 with values from Input 2',
},
],
};
export class MergeV1 implements INodeType {
description: INodeTypeDescription;
constructor(baseDescription: INodeTypeBaseDescription) {
this.description = {
...baseDescription,
...versionDescription,
icon: 'fa:code-branch',
version: 1,
defaults: {
name: 'Merge',
color: '#00bbcc',
},
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
inputs: ['main', 'main'],
outputs: ['main'],
inputNames: ['Input 1', 'Input 2'],
properties: [
oldVersionNotice,
{
displayName: 'Mode',
name: 'mode',
type: 'options',
options: [
{
name: 'Append',
value: 'append',
description:
'Combines data of both inputs. The output will contain items of input 1 and input 2.',
},
{
name: 'Keep Key Matches',
value: 'keepKeyMatches',
description: 'Keeps data of input 1 if it does find a match with data of input 2',
},
{
name: 'Merge By Index',
value: 'mergeByIndex',
description:
'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on the index of the items. So first item of input 1 will be merged with first item of input 2 and so on.',
},
{
name: 'Merge By Key',
value: 'mergeByKey',
description:
'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on a defined key.',
},
{
name: 'Multiplex',
value: 'multiplex',
description:
'Merges each value of one input with each value of the other input. The output will contain (m * n) items where (m) and (n) are lengths of the inputs.',
},
{
name: 'Pass-Through',
value: 'passThrough',
description:
'Passes through data of one input. The output will contain only items of the defined input.',
},
{
name: 'Remove Key Matches',
value: 'removeKeyMatches',
description: 'Keeps data of input 1 if it does NOT find match with data of input 2',
},
{
name: 'Wait',
value: 'wait',
description:
'Waits till data of both inputs is available and will then output a single empty item. Source Nodes must connect to both Input 1 and 2. This node only supports 2 Sources, if you need more Sources, connect multiple Merge nodes in series. This node will not output any data.',
},
],
default: 'append',
description: 'How data of branches should be merged',
},
{
displayName: 'Join',
name: 'join',
type: 'options',
displayOptions: {
show: {
mode: ['mergeByIndex'],
},
},
options: [
{
name: 'Inner Join',
value: 'inner',
description:
'Merges as many items as both inputs contain. (Example: Input1 = 5 items, Input2 = 3 items | Output will contain 3 items).',
},
{
name: 'Left Join',
value: 'left',
description:
'Merges as many items as first input contains. (Example: Input1 = 3 items, Input2 = 5 items | Output will contain 3 items).',
},
{
name: 'Outer Join',
value: 'outer',
description:
'Merges as many items as input contains with most items. (Example: Input1 = 3 items, Input2 = 5 items | Output will contain 5 items).',
},
],
default: 'left',
description:
'How many items the output will contain if inputs contain different amount of items',
},
{
displayName: 'Property Input 1',
name: 'propertyName1',
type: 'string',
default: '',
hint: 'The name of the field as text (e.g. “id”)',
required: true,
displayOptions: {
show: {
mode: ['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'],
},
},
description: 'Name of property which decides which items to merge of input 1',
},
{
displayName: 'Property Input 2',
name: 'propertyName2',
type: 'string',
default: '',
hint: 'The name of the field as text (e.g. “id”)',
required: true,
displayOptions: {
show: {
mode: ['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'],
},
},
description: 'Name of property which decides which items to merge of input 2',
},
{
displayName: 'Output Data',
name: 'output',
type: 'options',
displayOptions: {
show: {
mode: ['passThrough'],
},
},
options: [
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'input1',
description: 'Defines of which input the data should be used as output of node',
},
{
displayName: 'Overwrite',
name: 'overwrite',
type: 'options',
displayOptions: {
show: {
mode: ['mergeByKey'],
},
},
options: [
{
name: 'Always',
value: 'always',
description: 'Always overwrites everything',
},
{
name: 'If Blank',
value: 'blank',
description: 'Overwrites only values of "null", "undefined" or empty string',
},
{
name: 'If Missing',
value: 'undefined',
description: 'Only adds values which do not exist yet',
},
],
default: 'always',
description: 'Select when to overwrite the values from Input1 with values from Input 2',
},
],
};
}

View File

@ -31,274 +31,264 @@ import {
import { optionsDescription } from './OptionsDescription';
import { preparePairedItemDataArray } from '@utils/utilities';
const versionDescription: INodeTypeDescription = {
displayName: 'Merge',
name: 'merge',
icon: 'fa:code-branch',
group: ['transform'],
version: [2, 2.1, 2.2],
subtitle: '={{$parameter["mode"]}}',
description: 'Merge data of two inputs once data from both is available',
defaults: {
name: 'Merge',
color: '#00bbcc',
},
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
inputs: ['main', 'main'],
outputs: ['main'],
inputNames: ['Input 1', 'Input 2'],
// If the node is of version 2.2 or if mode is chooseBranch data from both branches is required
// to continue, else data from any input suffices
requiredInputs: '={{ $parameter["mode"] === "chooseBranch" ? [0, 1] : 1 }}',
properties: [
{
displayName: 'Mode',
name: 'mode',
type: 'options',
options: [
{
name: 'Append',
value: 'append',
description: 'All items of input 1, then all items of input 2',
},
{
name: 'Combine',
value: 'combine',
description: 'Merge matching items together',
},
{
name: 'Choose Branch',
value: 'chooseBranch',
description: 'Output input data, without modifying it',
},
],
default: 'append',
description: 'How data of branches should be merged',
},
{
displayName: 'Combination Mode',
name: 'combinationMode',
type: 'options',
options: [
{
name: 'Merge By Fields',
value: 'mergeByFields',
description: 'Combine items with the same field values',
},
{
name: 'Merge By Position',
value: 'mergeByPosition',
description: 'Combine items based on their order',
},
{
name: 'Multiplex',
value: 'multiplex',
description: 'All possible item combinations (cross join)',
},
],
default: 'mergeByFields',
displayOptions: {
show: {
mode: ['combine'],
},
},
},
// mergeByFields ------------------------------------------------------------------
{
displayName: 'Fields to Match',
name: 'mergeByFields',
type: 'fixedCollection',
placeholder: 'Add Fields to Match',
default: { values: [{ field1: '', field2: '' }] },
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Values',
name: 'values',
values: [
{
displayName: 'Input 1 Field',
name: 'field1',
type: 'string',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
placeholder: 'e.g. id',
hint: ' Enter the field name as text',
requiresDataPath: 'single',
},
{
displayName: 'Input 2 Field',
name: 'field2',
type: 'string',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
placeholder: 'e.g. id',
hint: ' Enter the field name as text',
requiresDataPath: 'single',
},
],
},
],
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
},
},
},
{
displayName: 'Output Type',
name: 'joinMode',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Keep Matches',
value: 'keepMatches',
description: 'Items that match, merged together (inner join)',
},
{
name: 'Keep Non-Matches',
value: 'keepNonMatches',
description: "Items that don't match",
},
{
name: 'Keep Everything',
value: 'keepEverything',
description: "Items that match merged together, plus items that don't match (outer join)",
},
{
name: 'Enrich Input 1',
value: 'enrichInput1',
description: 'All of input 1, with data from input 2 added in (left join)',
},
{
name: 'Enrich Input 2',
value: 'enrichInput2',
description: 'All of input 2, with data from input 1 added in (right join)',
},
],
default: 'keepMatches',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
},
},
},
{
displayName: 'Output Data From',
name: 'outputDataFrom',
type: 'options',
options: [
{
name: 'Both Inputs Merged Together',
value: 'both',
},
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'both',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
joinMode: ['keepMatches'],
},
},
},
{
displayName: 'Output Data From',
name: 'outputDataFrom',
type: 'options',
options: [
{
name: 'Both Inputs Appended Together',
value: 'both',
},
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'both',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
joinMode: ['keepNonMatches'],
},
},
},
// chooseBranch -----------------------------------------------------------------
{
displayName: 'Output Type',
name: 'chooseBranchMode',
type: 'options',
options: [
{
name: 'Wait for Both Inputs to Arrive',
value: 'waitForBoth',
},
],
default: 'waitForBoth',
displayOptions: {
show: {
mode: ['chooseBranch'],
},
},
},
{
displayName: 'Output',
name: 'output',
type: 'options',
options: [
{
name: 'Input 1 Data',
value: 'input1',
},
{
name: 'Input 2 Data',
value: 'input2',
},
{
name: 'A Single, Empty Item',
value: 'empty',
},
],
default: 'input1',
displayOptions: {
show: {
mode: ['chooseBranch'],
chooseBranchMode: ['waitForBoth'],
},
},
},
...optionsDescription,
],
};
export class MergeV2 implements INodeType {
description: INodeTypeDescription;
constructor(baseDescription: INodeTypeBaseDescription) {
this.description = {
...baseDescription,
...versionDescription,
version: [2, 2.1],
defaults: {
name: 'Merge',
},
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
inputs: ['main', 'main'],
outputs: ['main'],
inputNames: ['Input 1', 'Input 2'],
// If mode is chooseBranch data from both branches is required
// to continue, else data from any input suffices
requiredInputs: '={{ $parameter["mode"] === "chooseBranch" ? [0, 1] : 1 }}',
properties: [
{
displayName: 'Mode',
name: 'mode',
type: 'options',
options: [
{
name: 'Append',
value: 'append',
description: 'All items of input 1, then all items of input 2',
},
{
name: 'Combine',
value: 'combine',
description: 'Merge matching items together',
},
{
name: 'Choose Branch',
value: 'chooseBranch',
description: 'Output input data, without modifying it',
},
],
default: 'append',
description: 'How data of branches should be merged',
},
{
displayName: 'Combination Mode',
name: 'combinationMode',
type: 'options',
options: [
{
name: 'Merge By Fields',
value: 'mergeByFields',
description: 'Combine items with the same field values',
},
{
name: 'Merge By Position',
value: 'mergeByPosition',
description: 'Combine items based on their order',
},
{
name: 'Multiplex',
value: 'multiplex',
description: 'All possible item combinations (cross join)',
},
],
default: 'mergeByFields',
displayOptions: {
show: {
mode: ['combine'],
},
},
},
// mergeByFields ------------------------------------------------------------------
{
displayName: 'Fields to Match',
name: 'mergeByFields',
type: 'fixedCollection',
placeholder: 'Add Fields to Match',
default: { values: [{ field1: '', field2: '' }] },
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Values',
name: 'values',
values: [
{
displayName: 'Input 1 Field',
name: 'field1',
type: 'string',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
placeholder: 'e.g. id',
hint: ' Enter the field name as text',
requiresDataPath: 'single',
},
{
displayName: 'Input 2 Field',
name: 'field2',
type: 'string',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
placeholder: 'e.g. id',
hint: ' Enter the field name as text',
requiresDataPath: 'single',
},
],
},
],
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
},
},
},
{
displayName: 'Output Type',
name: 'joinMode',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Keep Matches',
value: 'keepMatches',
description: 'Items that match, merged together (inner join)',
},
{
name: 'Keep Non-Matches',
value: 'keepNonMatches',
description: "Items that don't match",
},
{
name: 'Keep Everything',
value: 'keepEverything',
description:
"Items that match merged together, plus items that don't match (outer join)",
},
{
name: 'Enrich Input 1',
value: 'enrichInput1',
description: 'All of input 1, with data from input 2 added in (left join)',
},
{
name: 'Enrich Input 2',
value: 'enrichInput2',
description: 'All of input 2, with data from input 1 added in (right join)',
},
],
default: 'keepMatches',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
},
},
},
{
displayName: 'Output Data From',
name: 'outputDataFrom',
type: 'options',
options: [
{
name: 'Both Inputs Merged Together',
value: 'both',
},
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'both',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
joinMode: ['keepMatches'],
},
},
},
{
displayName: 'Output Data From',
name: 'outputDataFrom',
type: 'options',
options: [
{
name: 'Both Inputs Appended Together',
value: 'both',
},
{
name: 'Input 1',
value: 'input1',
},
{
name: 'Input 2',
value: 'input2',
},
],
default: 'both',
displayOptions: {
show: {
mode: ['combine'],
combinationMode: ['mergeByFields'],
joinMode: ['keepNonMatches'],
},
},
},
// chooseBranch -----------------------------------------------------------------
{
displayName: 'Output Type',
name: 'chooseBranchMode',
type: 'options',
options: [
{
name: 'Wait for Both Inputs to Arrive',
value: 'waitForBoth',
},
],
default: 'waitForBoth',
displayOptions: {
show: {
mode: ['chooseBranch'],
},
},
},
{
displayName: 'Output',
name: 'output',
type: 'options',
options: [
{
name: 'Input 1 Data',
value: 'input1',
},
{
name: 'Input 2 Data',
value: 'input2',
},
{
name: 'A Single, Empty Item',
value: 'empty',
},
],
default: 'input1',
displayOptions: {
show: {
mode: ['chooseBranch'],
chooseBranchMode: ['waitForBoth'],
},
},
},
...optionsDescription,
],
};
}

View File

@ -27,7 +27,7 @@ export const versionDescription: INodeTypeDescription = {
properties: [
{
displayName:
'This node connects to the Microsoft 365 cloud platform. Use the \'Extract From File\' and \'Convert to File\' nodes to directly manipulate spreadsheet files (.xls, .csv, etc). <a href="/templates/890" target="_blank">More info</a>.',
'This node connects to the Microsoft 365 cloud platform. Use the \'Extract from File\' and \'Convert to File\' nodes to directly manipulate spreadsheet files (.xls, .csv, etc). <a href="/templates/890" target="_blank">More info</a>.',
name: 'notice',
type: 'notice',
default: '',

View File

@ -12,7 +12,7 @@
],
"generic": []
},
"alias": ["Sort", "Order", "Transform", "Array", "List", "Item"],
"alias": ["Sort", "Order", "Transform", "Array", "List", "Item", "Random"],
"subcategories": {
"Core Nodes": ["Data Transformation"]
}

View File

@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.whatsApp",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Communication"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/whatsapp/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.whatsapp/"
}
]
}
}

View File

@ -44,7 +44,7 @@ export class Xml implements INodeType {
},
{
displayName:
"If your XML is inside a binary file, use the 'Extract From File' node to convert it to text first",
"If your XML is inside a binary file, use the 'Extract from File' node to convert it to text first",
name: 'xmlNotice',
type: 'notice',
default: '',